/* Metro module 14237; source: modules/billing/native/otp/SimpleRequestOTPActionSheet.tsx; dependencies: [5, 57, 31, 27, 1878, 4279, 661, 1880, 33, 3, 1585, 7669, 566, 8461, 5120, 1900, 7298, 10147, 4080, 4496, 5134, 4572, 4573, 6239, 4578, 7641, 491, 7294, 6275, 10109, 2] */
function _fun107664(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#107664, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:6, offset: 0x02304980, size: 344 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(5) /* metro dependency 5 */;
const env0_4 = importDefault(57) /* metro dependency 57 */;
const env0_5 = importAll(31) /* metro dependency 31 */;
const env0_6 = (require(27) /* metro dependency 27 */).View;
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
const skuStore = importDefault(4279) /* metro dependency 4279: SKUStore */;
const env0_9 = (require(661) /* metro dependency 661: Constants */).PriceSetAssignmentPurchaseTypes;
const env0_10 = (require(1880) /* metro dependency 1880: PremiumConstants */).PremiumTypes;
let value = require(33) /* metro dependency 33 */;
const env0_11 = value.jsxs;
const env0_12 = value.jsx;
value = importDefault(3) /* metro dependency 3: Logger */;
value = new value('PaymentFlowTest.android');
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/billing/native/otp/SimpleRequestOTPActionSheet.tsx');
exports.default = _default_107687;
}
function GiftPurchaseSKUView({selectedSkuId, giftRecipientId, giftMessage}) { // fn#107665, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:317, offset: 0x02304ad8, size: 1116 bytes, params: 2, frame: 30
const value3 = (importDefault(1585) /* metro dependency 1585: useSafeAreaInsetsNative */)();
let binding = env0_5;
const [property, env0_2] = env0_4(binding.useState(false), 2);
const currentUser = UserStore.getCurrentUser();
var env0_4 = binding.useRef({});
const nativeGiftContextModule = require(7669) /* metro dependency 7669: NativeGiftContext */;
const useNativeGiftContext = nativeGiftContextModule.useNativeGiftContext;
const giftStyle = Reflect.apply(useNativeGiftContext, nativeGiftContextModule, []).giftStyle;
const value7 = (require(566) /* metro dependency 566: flux */).useStateFromStores([SKUStore], function() {
return SKUStore.get(selectedSkuId);
});
const value8 = (require(8461) /* metro dependency 8461: useFetchCollectiblesProduct */).useFetchCollectiblesProduct(selectedSkuId);
const product = value8.product;
var env0_5 = product;
const isFetching = value8.isFetching;
binding.useEffect(_fun107667, [selectedSkuId]);
let useMemo = binding.useMemo;
const value9 = Reflect.apply(useMemo, binding, [_fun107668, [product, currentUser, selectedSkuId]]);
binding.useEffect(function() {
var env0_0 = _fun107671;
_fun107674();
}, [value9, property, binding.useMemo(_fun107669, [value9])]);
const env0_8 = (importDefault(10147) /* metro dependency 10147: useMobileCollectiblesPurchaseSKUAndroid */)({product: product ?? ({skuId: selectedSkuId,
googleSkuIds: {}}), onPurchaseComplete: onPurchaseComplete, onPurchaseError: onPurchaseError,
onPurchasePending: onPurchasePending, giftParams: {isGift: true, options: {recipient_id: giftRecipientId,
custom_message: giftMessage, gift_style: giftStyle}}});
const value11 = _fun107678();
binding = env0_5;
useMemo = binding.useMemo;
const value13 = env0_4(Reflect.apply(useMemo, binding, [_fun107682, [product]]), 2);
const property2 = value13[0];
const property3 = value13[1];
let r14 = isFetching || property;
r14 = !r14 ? product == null : r14;
const Stack = (require(4572) /* metro dependency 4572: StackNative */).Stack;
const object = {};
object.paddingTop = value3.top;
object.paddingBottom = value3.bottom;
object.paddingHorizontal = 12;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
const name = value7?.name;
const value15 = 'No message';
const items2 = [{'Gifting '}{name}{' to '}{giftRecipientId}{' '}{'\n'}{'Regular price: '}{property3}{' '}{'\n'}{'Premium price: '}{property2}{' '}{'\n'}{giftMessage != null ? giftMessage === '' ? value15 : 'Message: ' + giftMessage : value15}];
const Card = (require(6239) /* metro dependency 6239: CardNative */).Card;
const Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
items2[1] = ;
items2[2] = {'Select style: '}{giftStyle}{((Component) => )(importDefault(7641) /* metro dependency 7641: PremiumGiftBackgroundSelect */)};
return (
{items2}
);
}
function SimpleRequestOTPActionSheet({selectedSkuId, requestType, giftRecipientId, giftMessage}) { // fn#107683, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:3322, offset: 0x02305417, size: 414 bytes, params: 2, frame: 26
var r4;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
var items2;
const value2 = (require(491) /* metro dependency 491 */).v4();
const binding = env0_5;
const useMemo = binding.useMemo;
if (requestType !== 'giftSku') {
items2 = [{'Gift purchasing is the only supported feature on Android in this version.'}];
items2[1] = {'Request type: '}{requestType ?? 'none'};
r4 = {items2};
} else if (selectedSkuId == null) {
items2 = [{'Gift purchasing is the only supported feature on Android in this version.'}];
items2[1] = {'Request type: '}{requestType ?? 'none'};
r4 = {items2};
} else if (giftRecipientId != null) {
const NativeGiftContextProvider = (require(7669) /* metro dependency 7669: NativeGiftContext */).NativeGiftContextProvider;
r4 = ;
} else {
items2 = [{'Gift purchasing is the only supported feature on Android in this version.'}];
items2[1] = {'Request type: '}{requestType ?? 'none'};
r4 = {items2};
}
const BottomSheet = (require(6275) /* metro dependency 6275: BottomSheetNative */).BottomSheet;
return (
{r4}
);
}
function _default_107687(a0) { // fn#107687, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:4106, offset: 0x023055f9, size: 87 bytes, params: 2, frame: 16
const NativePaymentContextProvider = (require(10109) /* metro dependency 10109: NativePaymentContext */).NativePaymentContextProvider;
return (
);
}
function _fun107667() { // fn#107667, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:640, offset: 0x02304f34, size: 57 bytes, params: 1, frame: 12
var value2;
var moduleValue;
if (selectedSkuId != null) {
value2 = environment.__proto__;
moduleValue = require(5120) /* metro dependency 5120: CollectiblesActionCreators */;
moduleValue.fetchCollectiblesProduct(selectedSkuId);
}
}
function _fun107668() { // fn#107668, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:715, offset: 0x02304f6d, size: 221 bytes, params: 1, frame: 16
var binding;
var value3;
if (product == null) {
value3 = environment.__proto__;
binding = env1_13;
binding.warn('No googleSkuIds available for product: ' + selectedSkuId);
return [];
}
let googleSkuIds = product.googleSkuIds;
if (googleSkuIds == null) {
value3 = environment.__proto__;
binding = env1_13;
binding.warn('No googleSkuIds available for product: ' + selectedSkuId);
return [];
}
const premiumTypeUtilsModule = require(1900) /* metro dependency 1900: PremiumTypeUtils */;
const isPremium = premiumTypeUtilsModule.isPremium;
binding = env0_3;
const TIER_2 = PremiumTypes.TIER_2;
const isPremium2 = Reflect.apply(isPremium, premiumTypeUtilsModule, [binding, TIER_2]);
googleSkuIds = product.googleSkuIds;
const r3 = isPremium2 ? googleSkuIds[PriceSetAssignmentPurchaseTypes.MOBILE_PREMIUM_TIER_2] : googleSkuIds[PriceSetAssignmentPurchaseTypes.MOBILE];
return r3 == null ? [r3] : global.Object.values(product.googleSkuIds);
}
function _fun107669() { // fn#107669, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:992, offset: 0x0230504a, size: 33 bytes, params: 1, frame: 11
return env0_6.sort().join(',');
}
function _fun107670() { // fn#107670, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:1034, offset: 0x0230506b, size: 31 bytes, params: 1, frame: 9
(function() {
return _loadGoogleSkus.apply(this, arguments);
})();
}
function GiftPurchaseSKUViewOnPurchaseError() { // fn#107676, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:1576, owner: GiftPurchaseSKUView.onPurchaseError, offset: 0x023051a7, size: 27 bytes, params: 1, frame: 11
env1_13.error('Purchase error occurred');
}
function GiftPurchaseSKUViewOnPurchasePending() { // fn#107677, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:1635, owner: GiftPurchaseSKUView.onPurchasePending, offset: 0x023051c2, size: 28 bytes, params: 1, frame: 11
env1_13.info('Purchase is pending');
}
function _fun107678() { // fn#107678, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:1753, offset: 0x023051de, size: 36 bytes, params: 1, frame: 12
const env0_0 = env1_3(_fun107680);
return submitGiftPurchase;
}
function _fun107682() { // fn#107682, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:2482, offset: 0x023053ac, size: 107 bytes, params: 1, frame: 18
var r0;
var value2;
var moduleValue;
var getFormattedPriceForCollectiblesProduct;
var items2;
var value;
let productBinding = product;
if (productBinding == null) {
r0 = ['Loading...', 'Loading...'];
} else {
value2 = environment.__proto__;
moduleValue = require(5134) /* metro dependency 5134: CollectiblesUtils */;
getFormattedPriceForCollectiblesProduct = moduleValue.getFormattedPriceForCollectiblesProduct;
productBinding = product;
value = Reflect.apply(getFormattedPriceForCollectiblesProduct, moduleValue, [productBinding, true, true]);
items2 = [value];
value = require(5134) /* metro dependency 5134: CollectiblesUtils */;
getFormattedPriceForCollectiblesProduct = value.getFormattedPriceForCollectiblesProduct;
items2[1] = Reflect.apply(getFormattedPriceForCollectiblesProduct, value, [productBinding, false, true]);
r0 = items2;
}
return r0;
}
function _fun107684() { // fn#107684, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:3425, offset: 0x023055b5, size: 68 bytes, params: 1, frame: 12
const value = environment.__proto__;
return (require(7294) /* metro dependency 7294: PremiumAnalyticsUtils */).getBasePurchaseFlowAnalyticsFields({isGift: true,
analyticsLoadId: env0_0, analyticsLocations: []});
}
function _loadGoogleSkus() { // fn#107671, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:1039, offset: 0x0230508a, size: 53 bytes, params: 1, frame: 13
var environment;
const value = environment.__proto__.__proto__;
return env2_3(_fun107673).apply(this, arguments);
}
function* _fun107680() { // fn#107680, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:1773, offset: 0x0230520d, size: 415 bytes, params: 1, frame: 18
var message;
var r4;
var binding;
var value3;
var googleSkuIds;
var value4;
var length;
var value5;
var value6;
var error;
var binding2;
var skuId;
var HermesInternal;
var concat;
var binding3;
var property;
var show;
var object2;
var binding4;
var warn;
var value8;
var JSON;
var stringify;
if (true) {
value = environment.__proto__.__proto__;
reducibleJoin3: while (true) {
reduciblePort60: while (true) {
exceptionLanding55: while (true) {
try {
binding = env2_5;
} catch (error) {
break exceptionLanding55;
}
break reducibleJoin3;
}
value = environment.__proto__.__proto__.__proto__;
binding = env3_13;
warn = binding.warn;
Reflect.apply(warn, binding, ['Error creating gift purchase:', error]);
binding = env3_1;
value = undefined;
value8 = binding(env3_2[19]);
show = value8.show;
reducibleJoin57: while (true) {
if (error == null) {
message = value;
break reducibleJoin57;
}
message = error.message;
break reducibleJoin57;
}
reducibleJoin59: while (true) {
if (message) {
r4 = message;
break reducibleJoin59;
}
JSON = global.JSON;
stringify = JSON.stringify;
value = Reflect.apply(stringify, JSON, [error]);
r4 = value;
break reducibleJoin59;
}
HermesInternal = global.HermesInternal;
concat = HermesInternal.concat;
Reflect.apply(show, value8, [{title: 'Gift Purchase Failed', body: 'Error: ' + r4}]);
break reduciblePort60;
}
return undefined;
}
try {
value3 = binding == null;
} catch (error) {
break exceptionLanding55;
}
if (value3) {
value = environment.__proto__.__proto__.__proto__;
try {
binding = env3_13;
} catch (error) {
break exceptionLanding55;
}
try {
error = binding.error;
} catch (error) {
break exceptionLanding55;
}
try {
Reflect.apply(error, binding, ['Cannot proceed with purchase: collectibleProduct is undefined']);
} catch (error) {
break exceptionLanding55;
}
try {
binding = env3_1;
} catch (error) {
break exceptionLanding55;
}
try {
binding4 = env3_2;
} catch (error) {
break exceptionLanding55;
}
try {
property = binding4[19];
} catch (error) {
break exceptionLanding55;
}
try {
value = binding(property);
} catch (error) {
break exceptionLanding55;
}
try {
show = value.show;
} catch (error) {
break exceptionLanding55;
}
try {
object2 = {'title': 'Product Not Found',
'body': 'The product information could not be loaded. Please try again.'};
} catch (error) {
break exceptionLanding55;
}
try {
Reflect.apply(show, value, [object2]);
} catch (error) {
break exceptionLanding55;
}
} else {
try {
binding = env2_5;
} catch (error) {
break exceptionLanding55;
}
try {
googleSkuIds = binding.googleSkuIds;
} catch (error) {
break exceptionLanding55;
}
try {
value4 = googleSkuIds == null;
} catch (error) {
break exceptionLanding55;
}
if (!value4) {
try {
} catch (error) {
break exceptionLanding55;
}
try {
length = View.length;
} catch (error) {
break exceptionLanding55;
}
try {
value5 = length === 0;
} catch (error) {
break exceptionLanding55;
}
reducibleJoin19: while (true) {
if (!value5) {
try {
} catch (error) {
break exceptionLanding55;
}
try {
value = SKUStore();
} catch (error) {
break exceptionLanding55;
}
yield value;
try {
value = undefined;
value6 = false;
} catch (error) {
break exceptionLanding55;
}
if (value6) {
return value;
}
return undefined;
}
break reducibleJoin19;
}
}
try {
binding = env3_13;
} catch (error) {
break exceptionLanding55;
}
try {
error = binding.error;
} catch (error) {
break exceptionLanding55;
}
try {
binding2 = env2_5;
} catch (error) {
break exceptionLanding55;
}
try {
skuId = binding2.skuId;
} catch (error) {
break exceptionLanding55;
}
try {
} catch (error) {
break exceptionLanding55;
}
try {
} catch (error) {
break exceptionLanding55;
}
try {
value = Reflect.apply(concat, 'No Google SKU IDs available for product ', [skuId]);
} catch (error) {
break exceptionLanding55;
}
try {
Reflect.apply(error, binding, [value]);
} catch (error) {
break exceptionLanding55;
}
try {
binding = env3_1;
} catch (error) {
break exceptionLanding55;
}
try {
binding3 = env3_2;
} catch (error) {
break exceptionLanding55;
}
try {
property = binding3[19];
} catch (error) {
break exceptionLanding55;
}
try {
value = binding(property);
} catch (error) {
break exceptionLanding55;
}
try {
show = value.show;
} catch (error) {
break exceptionLanding55;
}
try {
object2 = {'title': 'Product Not Available',
'body': 'This product is not available for purchase on Google Play.'};
} catch (error) {
break exceptionLanding55;
}
try {
Reflect.apply(show, value, [object2]);
} catch (error) {
break exceptionLanding55;
}
}
}
}
function* _fun107673() { // fn#107673, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14434:1092, offset: 0x023050ca, size: 221 bytes, params: 1, frame: 17
var current;
var value3;
var binding;
var binding2;
var property;
var value4;
var loadInAppSkus;
var inAppSkus;
var value5;
var value6;
var value7;
var error;
var error2;
if (true) {
reducibleJoin3: while (true) {
reduciblePort29: while (true) {
exceptionLanding28: while (true) {
value = environment.__proto__.__proto__.__proto__;
if (UserStore == null) {
break reducibleJoin3;
}
current = env3_4.current;
if (current[UserStore]) {
break reduciblePort29;
}
break reducibleJoin3;
}
binding = env4_13;
error2 = binding.error;
Reflect.apply(error2, binding, ['Unable to fetch product IDs from Google Play store:', error]);
dependencyMap(false);
break reduciblePort29;
}
return undefined;
}
if (View.length !== 0) {
reducibleJoin29: while (true) {
if (importDefault) {
break reducibleJoin29;
}
dependencyMap(true);
value3 = environment.__proto__.__proto__.__proto__.__proto__;
try {
binding = env4_0;
} catch (error) {
break exceptionLanding28;
}
try {
binding2 = env4_2;
} catch (error) {
break exceptionLanding28;
}
try {
property = binding2[16];
} catch (error) {
break exceptionLanding28;
}
try {
value4 = binding(property);
} catch (error) {
break exceptionLanding28;
}
try {
loadInAppSkus = value4.loadInAppSkus;
} catch (error) {
break exceptionLanding28;
}
try {
} catch (error) {
break exceptionLanding28;
}
try {
inAppSkus = Reflect.apply(loadInAppSkus, value4, [View]);
} catch (error) {
break exceptionLanding28;
}
yield inAppSkus;
try {
value5 = undefined;
value6 = false;
} catch (error) {
break exceptionLanding28;
}
if (value6) {
return value5;
}
try {
} catch (error) {
break exceptionLanding28;
}
try {
value7 = UserStore == null;
} catch (error) {
break exceptionLanding28;
}
reducibleJoin24: while (true) {
if (value7) {
break reducibleJoin24;
}
try {
binding = env3_4;
} catch (error) {
break exceptionLanding28;
}
try {
current = binding.current;
} catch (error) {
break exceptionLanding28;
}
try {
} catch (error) {
break exceptionLanding28;
}
try {
current[UserStore] = true;
} catch (error) {
break exceptionLanding28;
}
break reducibleJoin24;
}
try {
} catch (error) {
break exceptionLanding28;
}
try {
dependencyMap(false);
} catch (error) {
break exceptionLanding28;
}
break reducibleJoin29;
}
}
}
}