/* Metro module 7669; source: modules/payments/native/NativeGiftContext.tsx; dependencies: [5, 57, 31, 7670, 7261, 7671, 1878, 661, 5141, 1880, 33, 3, 7045, 7299, 3817, 7672, 7640, 1244, 7673, 3802, 5143, 7254, 566, 7674, 7633, 7634, 7635, 4496, 683, 6789, 7677, 694, 477, 7294, 2] */ import Logger from '../../debug/Logger.tsx'; /* Metro dependency 3 */ import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */ import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */ import Dispatcher from '../../../Dispatcher.tsx'; /* Metro dependency 694 */ import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */ import PromotionsStore from '../../premium/promotions/PromotionsStore.tsx'; /* Metro dependency 7261 */ import GiftingBadgeExperiment from '../../premium/gifting/experiments/GiftingBadgeExperiment.tsx'; /* Metro dependency 7633 */ import BadgeDirectoryStore from '../../badges/BadgeDirectoryStore.tsx'; /* Metro dependency 7670 */ import GiftCodeRecord from '../../../records/GiftCodeRecord.tsx'; /* Metro dependency 7671 */ import NitroGiftPriceCopyExperiment from '../../premium/gifting/experiments/NitroGiftPriceCopyExperiment.tsx'; /* Metro dependency 7672 */ 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 JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */ import * as PlatformUtilsModule from '../../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */ import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */ import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */ import * as PremiumConstantsModule from '../../premium/PremiumConstants.tsx'; /* Metro dependency 1880 */ import * as PremiumUtilsModule from '../../../utils/PremiumUtils.tsx'; /* Metro dependency 3802 */ import * as BillingUtilsModule from '../../../utils/BillingUtils.tsx'; /* Metro dependency 3817 */ import * as ConstantsModule2 from '../../gplay/native/Constants.tsx'; /* Metro dependency 5141 */ import * as ProductIdsAndroidModule from '../../premium/native/ProductIds.android.tsx'; /* Metro dependency 5143 */ import * as HandlePremiumPurchaseAndroidModule from '../../premium/native/handlePremiumPurchase.android.tsx'; /* Metro dependency 7254 */ import * as PremiumAnalyticsUtilsModule from '../../premium/native/PremiumAnalyticsUtils.tsx'; /* Metro dependency 7294 */ import * as BadgeIdModule from '../../../external/discord_common/js/shared/shared-constants/BadgeId.tsx'; /* Metro dependency 7635 */ import * as UseGiftStylesModule from '../../premium/gifting/hooks/useGiftStyles.tsx'; /* Metro dependency 7640 */ import * as UseOrderContextModule from './hooks/useOrderContext.tsx'; /* Metro dependency 7673 */ import * as GiftingPromotionUtilsModule from '../../premium/gifting/utils/promotions/GiftingPromotionUtils.tsx'; /* Metro dependency 7674 */ function _fun61229(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#61229, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:6, offset: 0x01b383f6, size: 416 bytes, params: 8, frame: 24 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = Module00057; const value5 = new (Logger)('NativeGiftContext'); value = value((importDefault(7045) /* metro dependency 7045: ContextUtils */)(), 3); const env0_17 = value[0]; const property = value[1]; const property2 = value[2]; (FileImportTrackerModule).fileFinishedImporting('modules/payments/native/NativeGiftContext.tsx'); exports.NativeGiftContextProvider = NativeGiftContextProvider; exports.useNativeGiftContext = property; exports.useForwardedNativeGiftContext = property2; function NativeGiftContextProvider({basePurchaseAnalytics, recipientUserId, premiumType, planInterval, onClose, setCurrentAnalyticsStep, initialOrder, children}) { // fn#61230, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:505, offset: 0x01b38596, size: 1683 bytes, params: 2, frame: 47 var Error; let env0_4 = undefined; let env0_5 = undefined; var value; let binding = env0_5; let useState = binding.useState; const value3 = env0_4(Reflect.apply(useState, binding, [premiumType ?? PremiumTypes.TIER_2]), 2); const property = value3[0]; env0_4 = property; const property2 = value3[1]; env0_5 = property2; const defaultImport = NitroGiftPriceCopyExperiment; let useConfig = defaultImport.useConfig; const value4 = env0_5.useState(planInterval ?? (Reflect.apply(useConfig, defaultImport, [{location: 'NativeGiftContext'}]).monthlyDefaultSelected ? SubscriptionIntervalTypes.MONTH : SubscriptionIntervalTypes.YEAR)); binding = env0_4; const value5 = binding(value4, 2); const property3 = value5[0]; const property4 = value5[1]; const value6 = (UseGiftStylesModule).useGiftStyles(); const binding2 = env0_5; useState = binding2.useState; const value7 = binding(Reflect.apply(useState, binding2, [value6[0]]), 2); const property5 = value7[0]; const env0_9 = value7[1]; useState = binding2.useState; const intl = (IndexNativeModule).intl; const string = intl.string; const ZkOo1U = (IndexNativeModule).t.ZkOo1U; const value8 = binding(Reflect.apply(useState, binding2, [Reflect.apply(string, intl, [ZkOo1U])]), 2); const property6 = value8[0]; const env0_11 = value8[1]; useState = binding2.useState; const value9 = binding(Reflect.apply(useState, binding2, [undefined]), 2); const property7 = value9[0]; const env0_13 = value9[1]; useState = binding2.useState; const value10 = binding(Reflect.apply(useState, binding2, [undefined]), 2); const property8 = value10[0]; const env0_15 = value10[1]; useState = binding2.useState; const value11 = binding(Reflect.apply(useState, binding2, [undefined]), 2); const property9 = value11[0]; const env0_17 = value11[1]; useState = binding2.useState; const value12 = binding(Reflect.apply(useState, binding2, [false]), 2); const property10 = value12[0]; const env0_19 = value12[1]; useState = binding2.useState; const value13 = binding(Reflect.apply(useState, binding2, [null]), 2); const property11 = value13[0]; const property12 = value13[1]; useState = binding2.useState; const value14 = binding(Reflect.apply(useState, binding2, []), 2); const property13 = value14[0]; const property14 = value14[1]; useState = binding2.useState; const value15 = binding(Reflect.apply(useState, binding2, [null]), 2); const property15 = value15[0]; const env0_25 = value15[1]; const value16 = (UseOrderContextModule).useOrderContext(initialOrder, 'NativeGiftContext'); const planIdForPremiumType = (PremiumUtilsModule).getPlanIdForPremiumType(property, property3); const productIdForGift = (ProductIdsAndroidModule).getProductIdForGift(planIdForPremiumType); const property16 = SubscriptionPlanInfo[planIdForPremiumType]; if (property16 == null) { Error = global.Error; value = 'Invalid subscription plan for gift purchase: ' + planIdForPremiumType; throw new Error(); } const skuId = property16.skuId; const value19 = (HandlePremiumPurchaseAndroidModule).useHandlePremiumPurchase(); const value20 = (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([PromotionsStore], function() { return PromotionsStore.getGiftPromotionRewardSkuIds(); }); const value21 = (GiftingPromotionUtilsModule).useFetchClaimableGiftingPromotionRewardSkuIds(); const r6 = value21 != null && value21.length > 0; const defaultImport2 = GiftingBadgeExperiment; useConfig = defaultImport2.useConfig; const enabled = Reflect.apply(useConfig, defaultImport2, [{location: 'NativeGiftContext'}]).enabled; binding = env0_5; binding.useEffect(_fun61232, [enabled]); const value24 = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], _fun61233); const value25 = useGiftInfoOptions({giftStyle: property5, recipientUserId: recipientUserId, customGiftMessage: property6, emojiConfetti: property8, soundEffect: property7, selectedGiftingPromotionReward: property13, premiumType: property}); binding.useEffect(_fun61236, [property11]); binding.useEffect(_fun61237, [property13, r6]); useSyncOrder({order: value16.order, revision: value16.revision, setRevision: value16.setRevision, planId: planIdForPremiumType, giftInfoOptions: value25, isPurchasing: property10, premiumType: property, planInterval: property3, setPremiumType: property2, setPlanInterval: property4, setError: property12}); let useCallback = binding.useCallback; const value26 = Reflect.apply(useCallback, binding, [function(a0) { var env0_0 = a0; var closure = _fun61247; var env0_1 = closure; return closure; }, [planIdForPremiumType, recipientUserId, basePurchaseAnalytics]]); const value28 = binding.useCallback(_fun61248(), [skuId, value16.orderId]); const value29 = binding.useCallback(_fun61252, [setCurrentAnalyticsStep]); useCallback = binding.useCallback; const value31 = binding.useMemo(_fun61259, [value16, recipientUserId, value24, property5, property, property3, productIdForGift, property6, property7, property8, property9, property10, property15, basePurchaseAnalytics, setCurrentAnalyticsStep, property2, property4, onClose, Reflect.apply(useCallback, binding, [_fun61253, [value26, setCurrentAnalyticsStep, value25, value19, productIdForGift, basePurchaseAnalytics, value28, value29, value16.orderId]]), value20, value21, property13, property14]); const Provider = env0_17.Provider; return ( {children} ); function _fun61232() { // fn#61232, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:1867, offset: 0x01b38c3c, size: 74 bytes, params: 1, frame: 14 var value; if (enabled) { value = environment.__proto__; value = require(7634) /* metro dependency 7634: BadgeDirectoryActionCreators */; value.fetchBadge((require(7635) /* metro dependency 7635: BadgeId */).BadgeId.GIFTING); } } function _fun61233() { // fn#61233, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:1970, offset: 0x01b38c86, size: 42 bytes, params: 1, frame: 12 return recipientUserId != null ? UserStore.getUser(recipientUserId) : undefined; } function useGiftInfoOptions({giftStyle, recipientUserId, customGiftMessage, emojiConfetti, soundEffect, selectedGiftingPromotionReward, premiumType}) { // fn#61234, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:2007, owner: NativeGiftContextProvider.useGiftInfoOptions, offset: 0x01b38cb0, size: 181 bytes, params: 2, frame: 21 var environment; let value = environment.__proto__; const binding = env1_5; value = undefined; return binding.useMemo(_fun61235, [giftStyle, recipientUserId, customGiftMessage, emojiConfetti == null ? value : emojiConfetti.id, emojiConfetti == null ? value : emojiConfetti.surrogates, soundEffect == null ? value : soundEffect.soundId, selectedGiftingPromotionReward, premiumType]); function _fun61235() { // fn#61235, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:2183, offset: 0x01b38d65, size: 173 bytes, params: 1, frame: 6 const emojiConfettiBinding = emojiConfetti; const value2 = undefined; return {gift_style: giftStyle, recipient_id: recipientUserId, custom_message: customGiftMessage, emoji_id: emojiConfettiBinding == null ? value2 : emojiConfetti.id, emoji_name: emojiConfetti == null ? value2 : emojiConfetti.surrogates, sound_id: soundEffect == null ? value2 : soundEffect.soundId, reward_sku_ids: selectedGiftingPromotionReward == null ? [] : premiumType === PremiumTypes.TIER_2 ? [selectedGiftingPromotionReward] : []}; } } function _fun61236() { // fn#61236, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:2615, offset: 0x01b38e12, size: 170 bytes, params: 1, frame: 20 var value2; var defaultImport; var show; var object; const intl = (IndexNativeModule).intl; const t = (IndexNativeModule).t; if (env0_20 != null) { value2 = environment.__proto__; defaultImport = importDefault(4496) /* metro dependency 4496: AlertActionCreators */; show = defaultImport.show; object = {}; object.title = intl.string(t.R0RpRX); object.body = intl.string(t.CKsXk3); Reflect.apply(show, defaultImport, [object]); env0_21(null); } } function _fun61237() { // fn#61237, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:2770, offset: 0x01b38ebc, size: 103 bytes, params: 1, frame: 17 var value2; var currentUser; var value4; var defaultImport; if (env0_33) { value2 = environment.__proto__; currentUser = UserStore.getCurrentUser(); value4 = undefined; defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; defaultImport.track(AnalyticEvents.GIFT_PROMOTION_REWARD_SELECTED, {user_id: currentUser == null ? value4 : currentUser.id, reward_sku_id: env0_22}); } } function useSyncOrder({order, revision, setRevision, planId, giftInfoOptions, isPurchasing, premiumType, planInterval, setPremiumType, setPlanInterval, setError}) { // fn#61238, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:2915, owner: NativeGiftContextProvider.useSyncOrder, offset: 0x01b38f23, size: 300 bytes, params: 2, frame: 29 var environment; let value = environment.__proto__; const binding = env1_5; const env0_11 = binding.useRef({orderId: undefined, planId: null, planSelection: {premiumType: premiumType, planInterval: planInterval}, giftInfo: null}); const env0_12 = binding.useRef(false); value = env1_4(binding.useState(0), 2); const property = value[0]; const env0_13 = value[1]; binding.useEffect(_fun61239, [order, revision, planId, giftInfoOptions, isPurchasing, premiumType, planInterval, setPremiumType, setPlanInterval, setRevision, setError, property]); function _fun61239() { // fn#61239, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:3261, offset: 0x01b3904f, size: 587 bytes, params: 1, frame: 19 var environment; var r5; var current; var binding; var value; const orderBinding = order; const value2 = null; const value3 = undefined; let id = value2 == orderBinding ? value3 : order.id; const id2 = value2 == order || value2 == order.order_line_items || value2 == order.order_line_items[0] ? value3 : order.order_line_items[0].id; const sku_id = value2 == order || value2 == order.order_line_items || value2 == order.order_line_items[0] ? value3 : order.order_line_items[0].sku_id; const subscription_plan_id = value2 == order || value2 == order.order_line_items || value2 == order.order_line_items[0] ? value3 : order.order_line_items[0].subscription_plan_id; if (value2 != order && env0_11.current.orderId !== order.id) { binding = env0_11; current = binding.current; current.orderId = order.id; current = binding.current; current.planId = value2 != subscription_plan_id ? subscription_plan_id : value2; current = binding.current; current.planSelection = {premiumType: premiumType, planInterval: planInterval}; } if (value2 != id) { if (value2 == id2) { return value3; } if (value2 == revision) { return value3; } if (isPurchasing) { return value3; } current = env0_12.current; if (current) { return value3; } current = env0_11.current; r5 = current.planId !== planId && (value2 == sku_id || (value2 == SubscriptionPlanInfo[planId] ? value3 : SubscriptionPlanInfo[planId].skuId) === sku_id); current = env0_11.current; var value10 = current.giftInfo !== giftInfoOptions; if (r5) { id = value2 == order ? value3 : order.id; env0_12.current = true; value = environment.__proto__.__proto__; value = env2_3(_fun61241)(); value = value.catch(_fun61242); value.finally(_fun61243); return function() { env0_4 = true; }; } if (value10) { id = value2 == order ? value3 : order.id; env0_12.current = true; value = environment.__proto__.__proto__; value = env2_3(_fun61241)(); value = value.catch(_fun61242); value.finally(_fun61243); return function() { env0_4 = true; }; } } return value3; function* _fun61241() { // fn#61241, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:3896, offset: 0x01b392a3, size: 524 bytes, params: 1, frame: 21 var binding; var binding2; var property; var value4; var patchOrderLineItem; var object; var orderBinding; var revisionBinding; var setCurrentAnalyticsStepBinding; var premiumTypeBinding; var value6; var value7; var value8; var current; var orderId; var isPurchasingBinding; var value9; var onCloseBinding; var value10; var value11; var updateOrder; var value12; var error; var binding3; var planSelection; var premiumType2; var planInterval; if (true) { value = environment.__proto__; if (setRevision) { try { binding = env4_0; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { binding2 = env4_2; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { property = binding2[13]; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { value4 = binding(property); } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { patchOrderLineItem = value4.patchOrderLineItem; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { object = {}; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { orderBinding = order; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { object.orderId = orderBinding; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { revisionBinding = revision; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { object.orderLineItemId = revisionBinding; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { setCurrentAnalyticsStepBinding = setCurrentAnalyticsStep; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { object.subscriptionPlanId = setCurrentAnalyticsStepBinding; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { premiumTypeBinding = premiumType; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { object.expectedRevision = premiumTypeBinding; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { value6 = Reflect.apply(patchOrderLineItem, value4, [object]); } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } yield value6; try { value7 = undefined; value8 = false; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } if (value8) { return value7; } try { env1_6 = value7; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { binding = env2_11; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { current = binding.current; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { orderId = current.orderId; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { isPurchasingBinding = isPurchasing; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { value9 = orderId !== isPurchasingBinding; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } if (value9) { return undefined; } try { binding = env2_11; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { current = binding.current; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { setCurrentAnalyticsStepBinding = setCurrentAnalyticsStep; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { current.planId = setCurrentAnalyticsStepBinding; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { current = binding.current; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { object = {}; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { binding = env2_6; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { object.premiumType = binding; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { binding = env2_7; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { object.planInterval = binding; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { current.planSelection = object; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { onCloseBinding = onClose; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { premiumTypeBinding = premiumType; } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } try { onCloseBinding(premiumTypeBinding); } catch (error) { if (giftInfoOptions) { throw error; } value = environment.__proto__.__proto__; binding = env2_8; binding3 = env2_11; current = binding3.current; planSelection = current.planSelection; premiumType2 = planSelection.premiumType; binding(premiumType2); binding = env2_9; current = binding3.current; planSelection = current.planSelection; planInterval = planSelection.planInterval; binding(planInterval); throw error; } } if (planId) { value10 = environment.__proto__.__proto__.__proto__.__proto__; binding = env4_0; value11 = binding(env4_2[13]); updateOrder = value11.updateOrder; value12 = environment.__proto__.__proto__; binding = env2_4; yield Reflect.apply(updateOrder, value11, [{orderId: order, giftInfo: {recipient_id: binding.recipient_id, gift_style: binding.gift_style, emoji_id: binding.emoji_id, emoji_name: binding.emoji_name, sound_id: binding.sound_id, reward_sku_ids: binding.reward_sku_ids, custom_message_contents: binding.custom_message}, expectedRevision: premiumType}]); if (false) { return undefined; } current = env2_11.current; if (current.orderId !== isPurchasing) { return undefined; } current = env2_11.current; current.giftInfo = env2_4; onClose(premiumType); } } } function _fun61242(a0) { // fn#61242, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:4574, offset: 0x01b394af, size: 166 bytes, params: 2, frame: 19 (BillingUtilsModule).captureBillingException(a0, {tags: {source: 'NativeGiftContext_syncOrder'}, extra: {orderId: id, planId: planId, needsPlanSync: env0_2, needsGiftSync: result}}); env3_16.error('Failed to sync order', {error: a0, orderId: id}); if (!env0_4) { setError(a0); } } function _fun61243() { // fn#61243, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:4791, offset: 0x01b39555, size: 63 bytes, params: 1, frame: 11 env1_12.current = false; if (env1_11.current.orderId !== id) { env1_13(function(a0) { return a0 + 1; }); } } } } function _fun61246(a0) { // fn#61246, offset: 0x01b395a1, size: 20 bytes, params: 2, frame: 2 const env0_0 = a0; return handleGiftCodeCreate; function handleGiftCodeCreate({giftCode}) { // fn#61247, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:5128, offset: 0x01b395b5, size: 255 bytes, params: 2, frame: 21 var r6; var r1; var r3; var value3; var value4; var location_stack; var moduleValue; let value = environment.__proto__.__proto__; const fromServer = GiftCodeRecord.createFromServer(giftCode); if (fromServer.subscriptionPlanId === env1_27) { value3 = undefined; env1_17(fromServer); value4 = recipientUserId != null; if (value4) { location_stack = basePurchaseAnalytics.location_stack; r6 = location_stack == null ? value3 : location_stack.includes((importDefault(6789) /* metro dependency 6789: AnalyticsLocation */).PREMIUM_GIFT_INTENT_CARD); r1 = r6 != null; r3 = r6; } else { r1 = value4; r3 = value3; } r1 = r1 && r3; if (r1) { moduleValue = require(7677) /* metro dependency 7677: PremiumGiftingIntentActionCreators */; moduleValue.logGiftIntentFlowPurchasedGift(recipientUserId); } if (env0_0 != null) { env0_0(); } value = importDefault(694) /* metro dependency 694: Dispatcher */; value.unsubscribe('GIFT_CODE_CREATE', handleGiftCodeCreate); } env1_19(false); } } function _fun61248() { // fn#61248, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:5494, offset: 0x01b396b4, size: 32 bytes, params: 1, frame: 12 const env0_0 = env1_3(_fun61250); return _fun61251; function* _fun61250(a0) { // fn#61250, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:5514, offset: 0x01b396dd, size: 355 bytes, params: 2, frame: 19 var binding; var binding2; var value3; var subscribe; var value4; var isAndroid; var value5; var orderId; var info; var object; var binding3; var binding4; var binding5; var property; var value6; var markOrderAsSigningInProgress; var value7; var value8; var value9; var error; var value10; var captureBillingException; var error2; if (true) { reduciblePort27: while (true) { exceptionLanding26: while (true) { value = environment.__proto__.__proto__.__proto__; binding = env3_1; binding2 = env3_2; value3 = binding(binding2[31]); subscribe = value3.subscribe; Reflect.apply(subscribe, value3, ['GIFT_CODE_CREATE', a0]); binding = env3_0; value4 = binding(binding2[32]); isAndroid = value4.isAndroid; if (Reflect.apply(isAndroid, value4, [])) { break reduciblePort27; } value5 = environment.__proto__.__proto__; orderId = env2_26.orderId; if (orderId == null) { break reduciblePort27; } try { binding = env3_16; } catch (error) { break exceptionLanding26; } try { info = binding.info; } catch (error) { break exceptionLanding26; } try { object = {}; } catch (error) { break exceptionLanding26; } try { binding3 = env2_26; } catch (error) { break exceptionLanding26; } try { orderId = binding3.orderId; } catch (error) { break exceptionLanding26; } try { object.orderId = orderId; } catch (error) { break exceptionLanding26; } try { binding4 = env2_29; } catch (error) { break exceptionLanding26; } try { object.skuId = binding4; } catch (error) { break exceptionLanding26; } try { Reflect.apply(info, binding, ['Starting order signing with pre-created order', object]); } catch (error) { break exceptionLanding26; } try { binding = env3_0; } catch (error) { break exceptionLanding26; } try { binding5 = env3_2; } catch (error) { break exceptionLanding26; } try { property = binding5[13]; } catch (error) { break exceptionLanding26; } try { value6 = binding(property); } catch (error) { break exceptionLanding26; } try { markOrderAsSigningInProgress = value6.markOrderAsSigningInProgress; } catch (error) { break exceptionLanding26; } try { binding = env2_26; } catch (error) { break exceptionLanding26; } try { orderId = binding.orderId; } catch (error) { break exceptionLanding26; } try { value7 = Reflect.apply(markOrderAsSigningInProgress, value6, [orderId]); } catch (error) { break exceptionLanding26; } yield value7; try { value8 = undefined; value9 = false; } catch (error) { break exceptionLanding26; } if (value9) { return value8; } break reduciblePort27; } binding = env3_0; value10 = binding(env3_2[14]); captureBillingException = value10.captureBillingException; orderId = env2_26.orderId; Reflect.apply(captureBillingException, value10, [error, {tags: {source: 'NativeGiftContext_handlePurchaseComplete_sign'}, extra: {skuId: env2_29, orderId: orderId}}]); binding = env3_16; error2 = binding.error; orderId = env2_26.orderId; Reflect.apply(error2, binding, ['Failed to sign order in purchase completion', {error: error, skuId: env2_29, orderId: orderId}]); break reduciblePort27; } } } function _fun61251() { // fn#61251, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:6006, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13 return env0_0.apply(this, arguments); } } function _fun61252(a0) { // fn#61252, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:6087, offset: 0x01b39840, size: 99 bytes, params: 2, frame: 16 (Dispatcher).unsubscribe('GIFT_CODE_CREATE', a0); const setCurrentAnalyticsStepBinding = setCurrentAnalyticsStep; const PaymentFlowStep = (PremiumAnalyticsUtilsModule).PaymentFlowStep; const PLAN_SELECT = PaymentFlowStep.PLAN_SELECT; setCurrentAnalyticsStepBinding(PLAN_SELECT); env0_19(false); } function _fun61253(a0) { // fn#61253, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:6206, offset: 0x01b398a3, size: 439 bytes, params: 2, frame: 18 var current; var value6; let badgeDirectoryStoreBinding = BadgeDirectoryStore; const getNextTier = badgeDirectoryStoreBinding.getNextTier; const value2 = undefined; const BadgeId = (BadgeIdModule).BadgeId; const GIFTING = BadgeId.GIFTING; const value3 = Reflect.apply(getNextTier, badgeDirectoryStoreBinding, [GIFTING]); const value4 = null; if (value4 != value3) { badgeDirectoryStoreBinding = BadgeDirectoryStore; value6 = badgeDirectoryStoreBinding.getSingleRequirementProgress(BadgeId.GIFTING); current = value4 == value6 ? value2 : value6.current; env0_25(value4 != current ? current : value4); } else { env0_25(value4); } env0_19(true); const env0_1 = env0_37(a0); if (PlatformUtilsModule.isAndroid()) { (importDefault(694) /* metro dependency 694: Dispatcher */).subscribe('GPLAY_UPDATE_PURCHASE_STATE', handleGPlayUpdatePurchaseAction); } const setCurrentAnalyticsStepBinding = setCurrentAnalyticsStep; const PaymentFlowStep = (PremiumAnalyticsUtilsModule).PaymentFlowStep; const REVIEW = PaymentFlowStep.REVIEW; setCurrentAnalyticsStepBinding(REVIEW); const binding = env0_30; const object = {productId: env0_28, isGift: true}; const basePurchaseAnalyticsBinding = basePurchaseAnalytics; object.analyticsLoadId = basePurchaseAnalyticsBinding.load_id; object.analyticsLocation = basePurchaseAnalyticsBinding.location; object.analyticsLocations = basePurchaseAnalyticsBinding.location_stack; object.allowPlanChange = false; object.giftInfoOptions = env0_36; const env0_0 = env1_3(_fun61256); object.onPurchaseComplete = onPurchaseComplete; object.onPurchaseError = onPurchaseError; object.orderId = env0_26.orderId; binding(object); return value2; function handleGPlayUpdatePurchaseAction(a0) { // fn#61254, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:6473, offset: 0x01b39a5a, size: 102 bytes, params: 2, frame: 17 var value; var defaultImport; if (a0.isActivePurchase) { value = environment.__proto__.__proto__; defaultImport = importDefault(694) /* metro dependency 694: Dispatcher */; defaultImport.unsubscribe('GPLAY_UPDATE_PURCHASE_STATE', handleGPlayUpdatePurchaseAction); if (a0.billingResult !== GPlayBillingResult.OK) { value = environment.__proto__; env1_39(env0_1); } } } function* _fun61256() { // fn#61256, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:6912, offset: 0x01b39ac9, size: 47 bytes, params: 1, frame: 12 if (true) { value = environment.__proto__.__proto__; var binding = env2_38; value = environment.__proto__; yield binding(recipientUserId); } } function onPurchaseComplete() { // fn#61257, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:6946, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13 return env0_0.apply(this, arguments); } function onPurchaseError() { // fn#61258, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:7006, offset: 0x01b39af8, size: 23 bytes, params: 1, frame: 11 return env1_39(env0_1); } } function _fun61259() { // fn#61259, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7847:7089, offset: 0x01b39b0f, size: 364 bytes, params: 1, frame: 13 const object = {}; copyDataProperties(object, env0_26, undefined); object['recipientUserId'] = recipientUserId; object['recipientUser'] = env0_35; object['giftStyle'] = env0_8; object['premiumType'] = env0_4; object['planInterval'] = env0_6; object['productId'] = env0_28; object['customGiftMessage'] = ConstantsModule.AnalyticEvents; object['soundEffect'] = PremiumConstantsModule.PremiumTypes; object['emojiConfetti'] = PremiumConstantsModule.SubscriptionPlanInfo; object['giftCodeRecord'] = env0_16; object['isPurchasing'] = env0_18; object['prePurchaseGiftingBadgeProgress'] = env0_24; object['basePurchaseAnalytics'] = basePurchaseAnalytics; object['setCurrentAnalyticsStep'] = setCurrentAnalyticsStep; object['setPremiumType'] = env0_5; object['setPlanInterval'] = env0_7; object['setGiftStyle'] = env0_9; object['setCustomGiftMessage'] = env0_11; object['setSoundEffect'] = env0_13; object['setEmojiConfetti'] = env0_15; object['onClose'] = onClose; object['onPurchase'] = env0_40; object['allRewards'] = env0_31; object['claimableRewards'] = env0_32; object['selectedGiftingPromotionReward'] = env0_22; object['setSelectedGiftingPromotionReward'] = env0_23; return object; } } } global.__d(_fun61229, 7669, [5, 57, 31, 7670, 7261, 7671, 1878, 661, 5141, 1880, 33, 3, 7045, 7299, 3817, 7672, 7640, 1244, 7673, 3802, 5143, 7254, 566, 7674, 7633, 7634, 7635, 4496, 683, 6789, 7677, 694, 477, 7294, 2]) /* metro module 7669, dependencies: [5, 57, 31, 7670, 7261, 7671, 1878, 661, 5141, 1880, 33, 3, 7045, 7299, 3817, 7672, 7640, 1244, 7673, 3802, 5143, 7254, 566, 7674, 7633, 7634, 7635, 4496, 683, 6789, 7677, 694, 477, 7294, 2] */;