/* Metro module 7356; source: modules/billing/native/StorekitIAPQueue.tsx; dependencies: [5, 6, 7, 27, 3837, 5138, 7336, 2] */ import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */ import ClassCallCheck from '../../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */ import * as CountryCodeUtilsModule from '../../i18n/CountryCodeUtils.tsx'; /* Metro dependency 3837 */ import * as PriceUtilsModule from '../../../external/discord_common/js/shared/utils/PriceUtils.tsx'; /* Metro dependency 5138 */ function _fun59285(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#59285, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:6, offset: 0x016e4a4f, size: 236 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const NativeModules = (ReactNativeModule).NativeModules; const env0_6 = NativeModules.RNIapIosSk2; let value = _fun59289(); value = new value(); (FileImportTrackerModule).fileFinishedImporting('modules/billing/native/StorekitIAPQueue.tsx'); exports.default = value; function productSK2ToIAPProduct(a0) { // fn#59286, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:194, offset: 0x016e4b3b, size: 334 bytes, params: 2, frame: 18 const r1 = a0.subscription.promotionalOffers == null ? [] : a0.subscription.promotionalOffers.map(function(a0) { return promoOfferToDiscount(a0); }); if (a0.subscription.introductoryOffer != null) { r1.push(promoOfferToDiscount(a0.subscription.introductoryOffer)); } const Number = global.Number; const price = a0.price; const toFixed = price.toFixed; const CurrencyExponents = (PriceUtilsModule).CurrencyExponents; const currency = a0.currency; const value = Number(Reflect.apply(toFixed, price, [CurrencyExponents[currency.toLowerCase()]])); object = {}; let String = global.String; object.identifier = String(a0.id); object.price = value; object.currencySymbol = a0.displayPrice.split(RegExp('[0-9]', ''))[0]; object.currencyCode = a0.currency.toLowerCase(); String = global.String; object.priceString = String(value); object.countryCode = ''; object.downloadable = false; object.description = a0.description; object.title = a0.displayName; object.discounts = r1; return object; } function _fun59289() { // fn#59289, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1166, offset: 0x016e4d38, size: 121 bytes, params: 1, frame: 17 const StorekitIAPQueueClass2 = StorekitIAPQueueClass; let env0_0 = Module00005(_fun59304); return CreateClass(StorekitIAPQueueClass2, [{key: 'fetchSubscriptions', value: function(a0) { var env0_0 = this; var env0_1 = a0; var Promise = global.Promise; var value2 = new Promise(_fun59292); this.processQueue(); return value2; }}, {key: 'fetchProducts', value: function(a0) { var env0_0 = this; var env0_1 = a0; var Promise = global.Promise; var value2 = new Promise(_fun59297); this.processQueue(); return value2; }}, {key: 'processQueue', value: value_59305}]); function StorekitIAPQueueClass() { // fn#59290, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1187, offset: 0x016e4db1, size: 45 bytes, params: 1, frame: 13 env1_3(this, StorekitIAPQueueClass); this._queue = []; this._processingQueue = false; } function value_59291(a0) { // fn#59291, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1325, offset: 0x016e4dde, size: 61 bytes, params: 2, frame: 12 const env0_1 = a0; const Promise = global.Promise; const promise = new Promise(_fun59292); this.processQueue(); return promise; function _fun59292(a0, a1) { // fn#59292, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1356, offset: 0x016e4e1b, size: 60 bytes, params: 3, frame: 13 const env0_0 = a0; const env0_1 = a1; const _queue = env0_0._queue; _queue.push(env2_2(_fun59294)); function* _fun59294() { // fn#59294, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1384, offset: 0x016e4e60, size: 116 bytes, params: 1, frame: 13 var environment; var binding; var getItems; var value4; var value5; var value6; var filter; var closure; var value7; var map; var error; if (true) { value = environment.__proto__.__proto__.__proto__.__proto__; try { binding = env4_6; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { getItems = binding.getItems; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { value4 = Reflect.apply(getItems, binding, [StorekitIAPQueueClass]); } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } yield value4; try { value5 = undefined; value6 = false; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } if (value6) { return value5; } try { filter = value5.filter; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { closure = function(a0) { return a0.subscription != null; }; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { value7 = Reflect.apply(filter, value5, [closure]); } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { map = value7.map; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { binding = env4_7; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { value = Reflect.apply(map, value7, [binding]); } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { binding = env1_0; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { binding(value); } catch (error) { value = environment.__proto__; env1_1(error); } } } } } function value_59296(a0) { // fn#59296, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1575, offset: 0x016e4ee5, size: 61 bytes, params: 2, frame: 12 const env0_1 = a0; const Promise = global.Promise; const promise = new Promise(_fun59297); this.processQueue(); return promise; function _fun59297(a0, a1) { // fn#59297, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1606, offset: 0x016e4f22, size: 60 bytes, params: 3, frame: 13 const env0_0 = a0; const env0_1 = a1; const _queue = env0_0._queue; _queue.push(env2_2(_fun59299)); function* _fun59299() { // fn#59299, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1634, offset: 0x016e4f67, size: 125 bytes, params: 1, frame: 14 var environment; var binding; var binding2; var property; var getProducts; var object; var then; var closure; var value4; var error; if (true) { value = environment.__proto__.__proto__.__proto__.__proto__; try { binding = env4_0; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { binding2 = env4_1; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { property = binding2[6]; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { value = binding(property); } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { getProducts = value.getProducts; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { object = {}; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { object.skus = StorekitIAPQueueClass; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { value = Reflect.apply(getProducts, value, [object]); } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { then = value.then; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { closure = function(a0) { return a0.filter(_fun59301).map(_fun59302); }; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { value = Reflect.apply(then, value, [closure]); } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } yield value; try { value = undefined; value4 = false; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } if (value4) { return value; } try { binding = env1_0; } catch (error) { value = environment.__proto__; env1_1(error); return undefined; } try { binding(value); } catch (error) { value = environment.__proto__; env1_1(error); } } function _fun59300(a0) { // fn#59300, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1698, offset: 0x016e4fe4, size: 37 bytes, params: 2, frame: 12 return a0.filter(function(a0) { return a0.type === 'iap'; }).map(_fun59302); function _fun59302(a0) { // fn#59302, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1736, offset: 0x016e501d, size: 252 bytes, params: 2, frame: 16 var r3; var value2; var binding; var value3; var error; let value = ''; let countryCode = a0.countryCode; if (countryCode == null) { r3 = value; } else { countryCode = a0.countryCode; if (countryCode.length === 0) { r3 = value; } else { try { value2 = environment.__proto__.__proto__.__proto__.__proto__.__proto__.__proto__; binding = env6_5; countryCode = a0.countryCode; value3 = binding(countryCode); r3 = value3; } catch (error) { r3 = value; } } } const object = {}; object.identifier = a0.productId; const parseFloat = global.parseFloat; const price = a0.price; value = undefined; object.price = parseFloat(price); const localizedPrice = a0.localizedPrice; object.currencySymbol = localizedPrice == null ? value : localizedPrice.split(RegExp('[0-9]', ''))[0]; object.currencyCode = a0.currency.toLowerCase(); object.priceString = a0.price; object.countryCode = r3; object.downloadable = false; object.description = a0.description; object.title = a0.title; object.discounts = 'discounts' in a0 ? a0.discounts : value; return object; } } } } } function value_59305() { // fn#59305, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:2428, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13 return env0_0.apply(this, arguments); } } } function promoOfferToDiscount(a0) { // fn#59288, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:772, offset: 0x016e4c89, size: 175 bytes, params: 2, frame: 12 const paymentMode = a0.paymentMode; const r2 = paymentMode === 'freeTrial' ? 'FREETRIAL' : paymentMode === 'payAsYouGo' ? 'PAYASYOUGO' : paymentMode === 'payUpFront' ? 'PAYUPFRONT' : ''; const object = {}; object.identifier = a0.id; object.type = 'SUBSCRIPTION'; object.numberOfPeriods = a0.period.value.toString(); object.price = a0.price.toString(); object.localizedPrice = a0.displayPrice; object.paymentMode = r2; object.subscriptionPeriod = a0.period.unit.toUpperCase(); return object; } function _fun59301({type}) { // fn#59301, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:1711, offset: 0x016e5009, size: 20 bytes, params: 2, frame: 2 return type === 'iap'; } function* _fun59304() { // fn#59304, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7534:2257, offset: 0x016e5122, size: 132 bytes, params: 1, frame: 13 var _queue; var length; var shift; var value3; var error; let value = undefined; if (false) { return value; } if (!this._processingQueue) { this._processingQueue = true; try { _queue = this._queue; } catch (error) { this._processingQueue = false; throw error; } try { length = _queue.length; } catch (error) { this._processingQueue = false; throw error; } try { value = length > 0; } catch (error) { this._processingQueue = false; throw error; } if (value) { while (true) { try { _queue = this._queue; } catch (error) { this._processingQueue = false; throw error; } try { shift = _queue.shift; } catch (error) { this._processingQueue = false; throw error; } try { value = Reflect.apply(shift, _queue, []); } catch (error) { this._processingQueue = false; throw error; } try { value = value(); } catch (error) { this._processingQueue = false; throw error; } yield value; try { value = undefined; value3 = false; } catch (error) { this._processingQueue = false; throw error; } if (value3) { this._processingQueue = false; return value; } try { _queue = this._queue; } catch (error) { this._processingQueue = false; throw error; } try { length = _queue.length; } catch (error) { this._processingQueue = false; throw error; } try { value = length > 0; } catch (error) { this._processingQueue = false; throw error; } if (value) { continue; } break; } this._processingQueue = false; return undefined; } this._processingQueue = false; } } global.__d(_fun59285, 7356, [5, 6, 7, 27, 3837, 5138, 7336, 2]) /* metro module 7356, dependencies: [5, 6, 7, 27, 3837, 5138, 7336, 2] */;