Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4791.js (118.4 MB)
221 lines
8.2 KiB
TypeScript
221 lines
8.2 KiB
TypeScript
// Module ID: 13603
|
|
// Function ID: 13604
|
|
// Name: usePremiumTier2DeltaPriceString
|
|
// Dependencies: [19, 7497, 7310, 1373, 7482, 7313, 1115, 7307, 4279, 504, 2]
|
|
// Exports: usePremiumTier2DeltaPriceString
|
|
|
|
// Module 13603 (usePremiumTier2DeltaPriceString)
|
|
import BillingUtils from "BillingUtils" /* 4279 */;
|
|
import PremiumBundledPlansUtils from "PremiumBundledPlansUtils" /* 7482 */;
|
|
import noop from "module_19" /* 19 */;
|
|
import IAPStore from "IAPStore" /* 7310 */;
|
|
|
|
const require = globalThis.__r;
|
|
|
|
require = fn;
|
|
function getViewerProductId(subscription) {
|
|
if (null == subscription) {
|
|
return null;
|
|
} else {
|
|
try {
|
|
const productIdFromSubscription = PremiumBundledPlansUtils.getProductIdFromSubscription(subscription, false);
|
|
try {
|
|
const productIdFromSubscription1 = tmp3(7482).getProductIdFromSubscription(subscription, true);
|
|
const tmp8 = tmp3(7313).AppStorePremiumProductIdsToPremiumBundledItems[productIdFromSubscription];
|
|
const tmp10 = tmp3(7313).AppStorePremiumProductIdsToPremiumBundledItems[productIdFromSubscription1];
|
|
if (null != tmp8) {
|
|
if (null != tmp10) {
|
|
if (tmp8.numPremiumGuild === tmp10.numPremiumGuild) {
|
|
let tmp11 = productIdFromSubscription1;
|
|
}
|
|
return tmp11;
|
|
}
|
|
}
|
|
tmp11 = productIdFromSubscription;
|
|
const tmp3Result = tmp3(7482);
|
|
} catch (err) {
|
|
return tmp2;
|
|
}
|
|
} catch (err) {
|
|
return tmp;
|
|
}
|
|
}
|
|
}
|
|
const useNativeCheckoutStore = fn(7497).useNativeCheckoutStore;
|
|
const PremiumTypes = fn(1373).PremiumTypes;
|
|
const priceString = { priceString: null, failure: null };
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("modules/premium/native/hooks/usePremiumTier2DeltaPriceString.tsx");
|
|
|
|
export const usePremiumTier2DeltaPriceString = function usePremiumTier2DeltaPriceString(plan, subscription, currencyCode, flag4) {
|
|
const tmp = useNativeCheckoutStore((orderRequired) => ({ orderRequired: orderRequired.orderRequired, checkoutContext: orderRequired.getCheckoutContextRecord() }));
|
|
const checkoutContext = tmp.checkoutContext;
|
|
const tmp3 = getViewerProductId(subscription);
|
|
_require = tmp3;
|
|
const items = [IAPStore];
|
|
const stateFromStores = require("initialize").useStateFromStores(items, () => {
|
|
let product = null;
|
|
if (null != closure_0) {
|
|
product = IAPStore.getProduct(tmp);
|
|
}
|
|
return product;
|
|
});
|
|
let obj = require("initialize");
|
|
const tmp2 = getViewerProductId;
|
|
let obj2 = require("PlatformUtils");
|
|
let flag = false;
|
|
if (flag4) {
|
|
flag = false;
|
|
if (plan.premiumTier === PremiumTypes.TIER_2) {
|
|
flag = false;
|
|
if (plan.numPremiumGuild >= 1) {
|
|
const tmp2Result = tmp2(subscription);
|
|
let tmp11 = null;
|
|
if (null != tmp2Result) {
|
|
tmp11 = tmp4(7313).AppStorePremiumProductIdsToPremiumBundledItems[tmp2Result];
|
|
}
|
|
flag = null != tmp11 && tmp11.basePlanId === plan.basePlanId && tmp11.numPremiumGuild < plan.numPremiumGuild;
|
|
const tmp12 = null != tmp11 && tmp11.basePlanId === plan.basePlanId && tmp11.numPremiumGuild < plan.numPremiumGuild;
|
|
}
|
|
}
|
|
}
|
|
if (flag) {
|
|
if (!tmp7) {
|
|
if (null != currencyCode) {
|
|
if (null != stateFromStores) {
|
|
const platformName = tmp4(1115).getPlatformName();
|
|
if (currencyCode.currencyCode !== stateFromStores.currencyCode) {
|
|
let obj3 = { priceString: null, failure: null };
|
|
const obj4 = { kind: "currency_mismatch", platform: platformName, productId: plan.productId, currencyCode: currencyCode.currencyCode };
|
|
obj3.failure = obj4;
|
|
let obj6 = obj3;
|
|
} else {
|
|
const diff = currencyCode.price - stateFromStores.price;
|
|
if (diff > 0) {
|
|
if (diff < currencyCode.price) {
|
|
let result = diff;
|
|
if (tmp4Result7.isAndroid()) {
|
|
result = diff / 100;
|
|
}
|
|
const obj5 = { priceString: null, failure: null };
|
|
tmp4Result7 = tmp4(1115);
|
|
obj5.priceString = tmp4(7307).formatPrice(result, currencyCode.currencyCode, { convertToMajorUnits: false });
|
|
obj6 = obj5;
|
|
const tmp4Result8 = tmp4(7307);
|
|
}
|
|
}
|
|
obj6 = { priceString: null, failure: null };
|
|
const obj7 = { kind: "delta_out_of_range", platform: platformName, productId: plan.productId, currencyCode: currencyCode.currencyCode };
|
|
obj6.failure = obj7;
|
|
}
|
|
const tmp4Result = tmp4(1115);
|
|
}
|
|
}
|
|
obj6 = priceString;
|
|
}
|
|
if (null == checkoutContext) {
|
|
} else {
|
|
const availablePlanForItems = checkoutContext.getAvailablePlanForItems(tmp4(7482).getSubscriptionItemsForProduct(plan.productId));
|
|
if (null == availablePlanForItems) {
|
|
} else {
|
|
const addOnPrice = availablePlanForItems.getAddOnPrice();
|
|
if (null != addOnPrice) {
|
|
if (addOnPrice.majorUnits > 0) {
|
|
let tmp17 = null;
|
|
if (null != tmp3) {
|
|
tmp17 = tmp4(7313).AppStorePremiumProductIdsToPremiumBundledItems[tmp3];
|
|
}
|
|
if (null != tmp3) {
|
|
if (null != tmp17) {
|
|
if (0 !== tmp17.numPremiumGuild) {
|
|
const availablePlanForItems1 = checkoutContext.getAvailablePlanForItems(tmp4(7482).getSubscriptionItemsForProduct(tmp3));
|
|
let addOnPrice1;
|
|
if (availablePlanForItems1 != null) {
|
|
addOnPrice1 = availablePlanForItems1.getAddOnPrice();
|
|
}
|
|
if (null != addOnPrice1) {
|
|
const diff1 = addOnPrice.majorUnits - addOnPrice1.majorUnits;
|
|
if (diff1 > 0) {
|
|
const obj8 = { priceString: tmp4(7307).formatPrice(diff1, addOnPrice.currency, { convertToMajorUnits: false }), failure: null };
|
|
const tmp4Result11 = tmp4(7307);
|
|
}
|
|
}
|
|
const tmp4Result10 = tmp4(7482);
|
|
}
|
|
}
|
|
}
|
|
const obj9 = { priceString: tmp4(7307).formatPrice(addOnPrice.majorUnits, addOnPrice.currency, { convertToMajorUnits: false }), failure: null };
|
|
const tmp4Result12 = tmp4(7307);
|
|
}
|
|
}
|
|
}
|
|
const tmp4Result9 = tmp4(7482);
|
|
}
|
|
} else {
|
|
const failure = tmp13.failure;
|
|
closure_129_0 = undefined;
|
|
closure_129_1 = undefined;
|
|
closure_129_2 = undefined;
|
|
closure_129_3 = undefined;
|
|
let kind;
|
|
if (failure != null) {
|
|
kind = failure.kind;
|
|
}
|
|
if (kind == null) {
|
|
kind = null;
|
|
}
|
|
closure_129_0 = kind;
|
|
let platform;
|
|
if (failure != null) {
|
|
platform = failure.platform;
|
|
}
|
|
if (platform == null) {
|
|
platform = null;
|
|
}
|
|
closure_129_1 = platform;
|
|
currencyCode = undefined;
|
|
if (failure != null) {
|
|
currencyCode = failure.currencyCode;
|
|
}
|
|
if (currencyCode == null) {
|
|
currencyCode = null;
|
|
}
|
|
closure_129_2 = currencyCode;
|
|
let productId;
|
|
if (failure != null) {
|
|
productId = failure.productId;
|
|
}
|
|
if (productId == null) {
|
|
productId = null;
|
|
}
|
|
closure_129_3 = productId;
|
|
const items1 = [kind, platform, currencyCode, productId];
|
|
const effect = noop.useEffect(() => {
|
|
if (null != closure_0) {
|
|
const _Error = Error;
|
|
const _HermesInternal = HermesInternal;
|
|
const error = new Error("delta_price_integrity_" + tmp);
|
|
const obj3 = { source: "usePremiumTier2DeltaPriceString", delta_failure_kind: tmp, delta_platform: null, delta_currency_code: null, delta_product_id: null };
|
|
let str = dependencyMap;
|
|
if (dependencyMap == null) {
|
|
str = "unknown";
|
|
}
|
|
obj3.delta_platform = str;
|
|
let str2 = noop;
|
|
if (noop == null) {
|
|
str2 = "unknown";
|
|
}
|
|
obj3.delta_currency_code = str2;
|
|
let str3 = useNativeCheckoutStore;
|
|
if (useNativeCheckoutStore == null) {
|
|
str3 = "unknown";
|
|
}
|
|
const obj = { tags: null };
|
|
obj3.delta_product_id = str3;
|
|
obj.tags = obj3;
|
|
const result = BillingUtils.captureBillingException(error, obj);
|
|
}
|
|
}, items1);
|
|
return priceString.priceString;
|
|
}
|
|
};
|