/* Metro module 10148; source: modules/billing/native/hooks/useMobilePurchaseSKU.android.tsx; dependencies: [5, 31, 1878, 661, 5141, 7254, 6518, 683, 694, 1861, 7500, 491, 2] */ import Module00005 from '../../../../by-id/module-00005.js'; /* Metro dependency 5 */ import Dispatcher from '../../../../Dispatcher.tsx'; /* Metro dependency 694 */ import UserStore from '../../../../stores/UserStore.tsx'; /* Metro dependency 1878 */ import UseInitialValue from '../../../../hooks/useInitialValue.tsx'; /* Metro dependency 6518 */ import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */ import * as ConstantsModule from '../../../../Constants.tsx'; /* Metro dependency 661 */ import * as AnalyticsUtilsModule from '../../../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */ import * as ConstantsModule2 from '../../../gplay/native/Constants.tsx'; /* Metro dependency 5141 */ import * as HandlePremiumPurchaseAndroidModule from '../../../premium/native/handlePremiumPurchase.android.tsx'; /* Metro dependency 7254 */ function _fun79099(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#79099, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10334:6, offset: 0x01e44eb9, size: 197 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/billing/native/hooks/useMobilePurchaseSKU.android.tsx'); exports.default = _default_79100; function _default_79100({skuId, platformSkuId, analyticsLocations, analyticsLoadId, onPurchaseComplete, onPurchaseError, freePurchaseCallback, onPurchasePending, giftParams, isFreeForStaffSelfPurchase}) { // fn#79100, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10334:188, offset: 0x01e44f7e, size: 530 bytes, params: 2, frame: 31 var r7; let env0_3 = analyticsLoadId; const onPurchaseComplete2 = onPurchaseComplete; const value = undefined; isFreeForStaffSelfPurchase = isFreeForStaffSelfPurchase === value || isFreeForStaffSelfPurchase; const currentUser = UserStore.getCurrentUser(); const value5 = (HandlePremiumPurchaseAndroidModule).useHandlePremiumPurchase(); let binding = onPurchaseComplete2; const env0_11 = binding.useRef(false); const r13 = value !== currentUser && currentUser.isStaff(); const value7 = (UseInitialValue)(_fun79101); const isGift = giftParams == null ? value : giftParams.isGift; const r12 = isGift != null && isGift; if (analyticsLoadId != null) { r7 = analyticsLoadId; } else { env0_3 = value7; r7 = value7; } binding = onPurchaseComplete2; const value9 = binding.useCallback(_fun79102, [onPurchaseComplete]); binding.useEffect(_fun79105, [binding.useCallback(_fun79104, [value9, onPurchaseError, onPurchasePending]), value9, binding.useCallback(_fun79103, [onPurchaseError, value9])]); return binding.useCallback(env0_3(_fun79108), [skuId, platformSkuId, r13, r12, value5, onPurchaseComplete, onPurchaseError, freePurchaseCallback, r7, analyticsLocations, giftParams, isFreeForStaffSelfPurchase]); function _fun79101() { // fn#79101, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10334:500, offset: 0x01e45190, size: 37 bytes, params: 1, frame: 11 const value = environment.__proto__; return (AnalyticsUtilsModule).getNewAnalyticsLoadId(); } function _fun79102() { // fn#79102, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10334:613, offset: 0x01e451b5, size: 72 bytes, params: 1, frame: 15 const value = environment.__proto__; (Dispatcher).unsubscribe('GPLAY_PURCHASE_VERIFIED', env0_14); env0_11.current = false; onPurchaseComplete(); } function _fun79103() { // fn#79103, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10334:708, offset: 0x01e451fd, size: 72 bytes, params: 1, frame: 15 const value = environment.__proto__; (Dispatcher).unsubscribe('GPLAY_PURCHASE_VERIFIED', env0_14); env0_11.current = false; onPurchaseError(); } function _fun79104({billingResult}) { // fn#79104, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10334:805, offset: 0x01e45245, size: 108 bytes, params: 2, frame: 15 const value = environment.__proto__; const OK = GPlayBillingResult.OK; if (billingResult !== OK) { (importDefault(694) /* metro dependency 694: Dispatcher */).unsubscribe('GPLAY_PURCHASE_VERIFIED', env0_14); env0_11.current = false; onPurchaseError(); } onPurchasePending(); } function _fun79105() { // fn#79105, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10334:936, offset: 0x01e452b1, size: 123 bytes, params: 1, frame: 18 var environment; const value = environment.__proto__; (Dispatcher).subscribe('GPLAY_UPDATE_PURCHASE_STATE', env0_16); (Dispatcher).subscribe('GPLAY_PURCHASE_VERIFIED', env0_14); (Dispatcher).subscribe('GPLAY_PURCHASE_VERIFICATION_FAILED', env0_15); return _fun79106; function _fun79106() { // fn#79106, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10334:1097, offset: 0x01e4532c, size: 114 bytes, params: 1, frame: 18 const value = environment.__proto__.__proto__; (Dispatcher).unsubscribe('GPLAY_UPDATE_PURCHASE_STATE', env1_16); (Dispatcher).unsubscribe('GPLAY_PURCHASE_VERIFIED', env1_14); (Dispatcher).unsubscribe('GPLAY_PURCHASE_VERIFICATION_FAILED', env1_15); } } function* _fun79108() { // fn#79108, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10334:1293, offset: 0x01e453a9, size: 561 bytes, params: 1, frame: 20 var r6; var options; var value; var value2; var value3; var current; var value4; var binding; var value5; var isNullOrEmpty; var value6; var binding2; var property; var value7; var purchaseSKU; var object; var USD; var binding3; var value8; var v4; var value9; var value10; var value11; var value12; var error; var userStoreBinding; var binding4; var binding5; var binding6; var value13; var binding7; var value14; var value15; var value16; exceptionSkip94: while (true) { exceptionLanding94: while (true) { exceptionSkip92: while (true) { exceptionLanding92: while (true) { exceptionSkip59: while (true) { exceptionLanding59: while (true) { exceptionSkip55: while (true) { exceptionLanding55: while (true) { value = undefined; value2 = false; if (value2) { return value; } value = undefined; value3 = environment.__proto__; current = env1_11.current; if (current) { throw new global.Error('Purchase already in progress'); } value4 = environment.__proto__.__proto__; binding = env2_0; value5 = binding(env2_2[9]); isNullOrEmpty = value5.isNullOrEmpty; if (Reflect.apply(isNullOrEmpty, value5, [importDefault])) { throw new global.Error('Missing google play sku ID'); } try { try { binding = env1_11; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding.current = true; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding = env1_12; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } if (binding) { try { try { binding = env1_9; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } if (binding) { try { try { binding = env1_13; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } if (binding) { try { try { binding = env1_10; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object = {}; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.productId = importDefault; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.skuId = require; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.isOneTimePurchase = true; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding4 = env1_3; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.analyticsLoadId = binding4; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.analyticsLocations = dependencyMap; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding5 = env1_13; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.isGift = binding5; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding6 = env1_8; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { value13 = binding6 == null; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } if (value13) { options = value; } else { try { try { binding7 = env1_8; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { options = binding7.options; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } } try { try { object.giftInfoOptions = options; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { userStoreBinding = UserStore; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.onPurchaseError = userStoreBinding; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { value14 = binding(object); } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } yield value14; try { try { value15 = undefined; value16 = false; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } if (value16) { env1_11.current = false; return value15; } env1_11.current = false; return value; } try { try { } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { value6 = CurrencyCodes != null; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } if (value6) { try { try { } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } r6 = CurrencyCodes; } else { try { try { binding = env2_0; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding2 = env2_2; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { property = binding2[10]; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { value7 = binding(property); } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { purchaseSKU = value7.purchaseSKU; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } r6 = purchaseSKU; } try { try { try { try { } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { try { object = {}; } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { try { object.expectedAmount = 0; } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { try { binding = env2_6; } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { try { USD = binding.USD; } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { try { object.expectedCurrency = USD; } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { try { binding = env2_0; } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { try { binding3 = env2_2; } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { try { property = binding3[11]; } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { try { value8 = binding(property); } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { try { v4 = value8.v4; } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { try { value9 = Reflect.apply(v4, value8, []); } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { try { object.loadId = value9; } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { try { value10 = r6('collectibles', require, object); } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } yield value10; try { try { try { try { value11 = undefined; value12 = false; } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } if (value12) { try { try { binding = env1_11; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding.current = false; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } env1_11.current = false; return value11; } try { try { try { try { binding = env1_4; } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { try { binding(); } catch (error) { break exceptionLanding55; } } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding = env1_11; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding.current = false; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } env1_11.current = false; return value; } try { try { binding = env1_10; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object = {}; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.productId = importDefault; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.skuId = require; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.isOneTimePurchase = true; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding4 = env1_3; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.analyticsLoadId = binding4; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.analyticsLocations = dependencyMap; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding5 = env1_13; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.isGift = binding5; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding6 = env1_8; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { value13 = binding6 == null; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } if (value13) { options = value; } else { try { try { binding7 = env1_8; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { options = binding7.options; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } } try { try { object.giftInfoOptions = options; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { userStoreBinding = UserStore; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.onPurchaseError = userStoreBinding; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { value14 = binding(object); } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } yield value14; try { try { value15 = undefined; value16 = false; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } if (value16) { env1_11.current = false; return value15; } env1_11.current = false; return value; } try { try { binding = env1_10; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object = {}; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.productId = importDefault; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.skuId = require; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.isOneTimePurchase = true; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding4 = env1_3; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.analyticsLoadId = binding4; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.analyticsLocations = dependencyMap; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding5 = env1_13; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.isGift = binding5; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding6 = env1_8; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { value13 = binding6 == null; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } if (value13) { options = value; } else { try { try { binding7 = env1_8; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { options = binding7.options; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } } try { try { object.giftInfoOptions = options; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { userStoreBinding = UserStore; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { object.onPurchaseError = userStoreBinding; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { value14 = binding(object); } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } yield value14; try { try { value15 = undefined; value16 = false; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } if (value16) { env1_11.current = false; return value15; } env1_11.current = false; return value; break exceptionSkip55; } try { try { try { userStoreBinding = UserStore; } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { userStoreBinding(); } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { try { throw error; } catch (error) { break exceptionLanding59; } } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } break exceptionSkip55; } break exceptionSkip59; } try { try { binding = env1_11; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { binding.current = false; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } try { try { throw error; } catch (error) { break exceptionLanding92; } } catch (error) { break exceptionLanding94; } break exceptionSkip59; } break exceptionSkip92; } try { throw error; } catch (error) { break exceptionLanding94; } break exceptionSkip92; } break exceptionSkip94; } env1_11.current = false; throw error; break exceptionSkip94; } } } } global.__d(_fun79099, 10148, [5, 31, 1878, 661, 5141, 7254, 6518, 683, 694, 1861, 7500, 491, 2]) /* metro module 10148, dependencies: [5, 31, 1878, 661, 5141, 7254, 6518, 683, 694, 1861, 7500, 491, 2] */;