130 lines
7.7 KiB
TypeScript
130 lines
7.7 KiB
TypeScript
/* Metro module 7942; source: modules/premium/native/hooks/usePremiumPlanPrice.tsx; dependencies: [3807, 3808, 5140, 566, 7334, 7943, 7944, 5143, 477, 5137, 2] */
|
|
import SubscriptionPlanStore from '../../../../stores/billing/SubscriptionPlanStore.tsx'; /* Metro dependency 3807 */
|
|
import SubscriptionStore from '../../../../stores/billing/SubscriptionStore.tsx'; /* Metro dependency 3808 */
|
|
import IAPStoreAndroid from '../../../../stores/native/IAPStore.android.tsx'; /* Metro dependency 5140 */
|
|
import NativePaymentHooksAndroid from '../../../payments/native/hooks/NativePaymentHooks.android.tsx'; /* Metro dependency 7943 */
|
|
import UseStoreFrontPrice from '../../../billing/native/subscription/useStoreFrontPrice.tsx'; /* Metro dependency 7944 */
|
|
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as FluxModule from '../../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import * as ACOMExperimentsModule from '../../../billing/native/ACOMExperiments.tsx'; /* Metro dependency 7334 */
|
|
import * as UseStoreFrontPriceModule from '../../../billing/native/subscription/useStoreFrontPrice.tsx'; /* Metro dependency 7944 */
|
|
|
|
function _fun63377(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#63377, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8120:6, offset: 0x01b7d848, size: 148 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/premium/native/hooks/usePremiumPlanPrice.tsx');
|
|
exports.default = usePremiumPlanPrice;
|
|
function usePremiumPlanPrice(a0) { // fn#63378, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8120:223, offset: 0x01b7d8dc, size: 632 bytes, params: 2, frame: 26
|
|
var r1;
|
|
var r2;
|
|
var r0;
|
|
var moduleValue4;
|
|
const PriceStates = (UseStoreFrontPriceModule).PriceStates;
|
|
var amount;
|
|
var currency;
|
|
var formatPrice;
|
|
const env0_0 = a0;
|
|
var value;
|
|
const value2 = undefined;
|
|
let useStateFromStores = FluxModule.useStateFromStores;
|
|
let object = [SubscriptionStore];
|
|
const premiumSubscription = Reflect.apply(useStateFromStores, FluxModule, [object, function() {
|
|
return SubscriptionStore.getPremiumSubscription();
|
|
}]);
|
|
const NitroACOMSubscriptionExperiment = (ACOMExperimentsModule).NitroACOMSubscriptionExperiment;
|
|
const useConfig = NitroACOMSubscriptionExperiment.useConfig;
|
|
const enabled = Reflect.apply(useConfig, NitroACOMSubscriptionExperiment,
|
|
[{location: 'usePremiumPlanPrice'}]).enabled;
|
|
const defaultImport = NativePaymentHooksAndroid;
|
|
const useNativeIAPPayments = defaultImport.useNativeIAPPayments;
|
|
const storeFront = Reflect.apply(useNativeIAPPayments, defaultImport, []).storeFront;
|
|
useStateFromStores = FluxModule.useStateFromStores;
|
|
const {price,
|
|
priceState} = (UseStoreFrontPrice)(Reflect.apply(useStateFromStores,
|
|
FluxModule, [[SubscriptionPlanStore], _fun63380, [a0]]), storeFront);
|
|
const value5 = null;
|
|
const value6 = FluxModule.useStateFromStores([IAPStoreAndroid], _fun63381,
|
|
[value5 != a0 ? (require(5143) /* metro dependency 5143: ProductIdsAndroid */).BasePlanIdToProductId[a0] : value5]);
|
|
if (value5 == a0) {
|
|
r0 = value5;
|
|
} else {
|
|
moduleValue4 = require(477) /* metro dependency 477: PlatformUtils */;
|
|
if (moduleValue4.isIOS()) {
|
|
if (enabled) {
|
|
if (priceState !== PriceStates.PRICE_AVAILABLE) {
|
|
r2 = value5;
|
|
} else if (value5 != price) {
|
|
object = {};
|
|
amount = price.amount;
|
|
object.price = amount;
|
|
currency = price.currency;
|
|
object.currency = currency;
|
|
object.countryCode = value5 == storeFront ? value2 : storeFront.country;
|
|
value = require(5137) /* metro dependency 5137: PriceUtils */;
|
|
formatPrice = value.formatPrice;
|
|
amount = price.amount;
|
|
currency = price.currency;
|
|
object.priceString = Reflect.apply(formatPrice, value, [amount, currency]);
|
|
object.source = 'API';
|
|
r2 = object;
|
|
} else {
|
|
r2 = value5;
|
|
}
|
|
r1 = r2;
|
|
} else if ((value5 == premiumSubscription ? value2 : premiumSubscription.isACOM) === true) {
|
|
if (priceState !== PriceStates.PRICE_AVAILABLE) {
|
|
r2 = value5;
|
|
} else if (value5 != price) {
|
|
object = {};
|
|
amount = price.amount;
|
|
object.price = amount;
|
|
currency = price.currency;
|
|
object.currency = currency;
|
|
object.countryCode = value5 == storeFront ? value2 : storeFront.country;
|
|
value = require(5137) /* metro dependency 5137: PriceUtils */;
|
|
formatPrice = value.formatPrice;
|
|
amount = price.amount;
|
|
currency = price.currency;
|
|
object.priceString = Reflect.apply(formatPrice, value, [amount, currency]);
|
|
object.source = 'API';
|
|
r2 = object;
|
|
} else {
|
|
r2 = value5;
|
|
}
|
|
r1 = r2;
|
|
} else {
|
|
r1 = value5 != value6 ? {price: value6.price, currency: value6.currencyCode,
|
|
countryCode: value5 != (value5 == storeFront ? value2 : storeFront.country) ? value5 == storeFront ? value2 : storeFront.country : value6.countryCode,
|
|
|
|
|
|
|
|
priceString: value6.priceString, source: 'IAP'} : value5;
|
|
}
|
|
} else {
|
|
r1 = value5 != value6 ? {price: value6.price, currency: value6.currencyCode,
|
|
countryCode: value5 != (value5 == storeFront ? value2 : storeFront.country) ? value5 == storeFront ? value2 : storeFront.country : value6.countryCode,
|
|
|
|
|
|
priceString: value6.priceString, source: 'IAP'} : value5;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
function _fun63380() { // fn#63380, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8120:500, offset: 0x01b7db67, size: 39 bytes, params: 1, frame: 12
|
|
const value2 = null;
|
|
return value2 != env0_0 ? SubscriptionPlanStore.get(env0_0) : value2;
|
|
}
|
|
|
|
function _fun63381() { // fn#63381, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8120:654, offset: 0x01b7db8e, size: 40 bytes, params: 1, frame: 12
|
|
const value2 = null;
|
|
return value2 != env0_1 ? IAPStoreAndroid.getProduct(env0_1) : value2;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun63377, 7942, [3807, 3808, 5140, 566, 7334, 7943, 7944, 5143, 477, 5137,
|
|
2]) /* metro module 7942, dependencies: [3807, 3808, 5140, 566, 7334, 7943, 7944, 5143, 477, 5137, 2] */;
|