251 lines
12 KiB
TypeScript
251 lines
12 KiB
TypeScript
/* Metro module 5140; source: stores/native/IAPStore.android.tsx; dependencies: [6, 7, 15, 17, 18, 5141, 482, 5137, 3817, 566, 694, 2] */
|
|
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 PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
|
|
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
|
|
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
|
|
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../../external/discord_common/js/shared/Constants.tsx'; /* Metro dependency 482 */
|
|
import * as ConstantsModule2 from '../../modules/gplay/native/Constants.tsx'; /* Metro dependency 5141 */
|
|
|
|
function _fun45333(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#45333, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5318:6, offset: 0x0118c266, size: 587 bytes, params: 8, frame: 21
|
|
const env0_0 = require;
|
|
const GPLAY_SUBSCRIPTION_SKUS_LOADED2 = GPLAY_SUBSCRIPTION_SKUS_LOADED;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const constantsModule = ConstantsModule2;
|
|
const GPlayConnectionState = constantsModule.GPlayConnectionState;
|
|
const env0_8 = constantsModule.GPlaySkusType;
|
|
let env0_10 = GPlayConnectionState.DISCONNECTED;
|
|
const Map = global.Map;
|
|
const map = new Map();
|
|
let Set = global.Set;
|
|
let set = new Set();
|
|
Set = global.Set;
|
|
set = new Set();
|
|
const Store = (Flux).Store;
|
|
_fun45344(Store).displayName = 'IAPStore';
|
|
set = new set(importDefault(694) /* metro dependency 694: Dispatcher */,
|
|
{GPLAY_UPDATE_CONNECTION_STATE: function(a0) {
|
|
env0_10 = a0.connectionState;
|
|
}, GPLAY_FETCH_SUBSCRIPTION_SKUS_START: function() {
|
|
env0_18 = true;
|
|
}, GPLAY_SUBSCRIPTION_SKUS_LOADED: GPLAY_SUBSCRIPTION_SKUS_LOADED2,
|
|
GPLAY_FETCH_SUBSCRIPTION_SKUS_FAILED: function() {
|
|
env0_18 = false;
|
|
}, GPLAY_FETCH_IN_APP_SKUS_START: function() {
|
|
env0_17 = true;
|
|
}, GPLAY_IN_APP_SKUS_LOADED: GPLAY_SUBSCRIPTION_SKUS_LOADED2, GPLAY_FETCH_IN_APP_SKUS_FAILED: function() {
|
|
env0_17 = false;
|
|
}, GPLAY_VERIFICATION_START: GPLAY_VERIFICATION_START, GPLAY_VERIFICATION_END: GPLAY_VERIFICATION_END,
|
|
GPLAY_UPDATE_PENDING_DOWNGRADE: function(a0) {
|
|
env0_15 = a0.pendingDowngrade;
|
|
}, GPLAY_UPDATE_IS_DOWNGRADING: function(a0) {
|
|
env0_16 = a0.isDowngrading;
|
|
}, GPLAY_SET_USER_COUNTRY: function(a0) {
|
|
env0_19 = a0.countryCode;
|
|
}});
|
|
(FileImportTrackerModule).fileFinishedImporting('stores/native/IAPStore.android.tsx');
|
|
exports.default = set;
|
|
function _isNativeReflectConstruct_45334() { // fn#45334, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5318:225, offset: 0x0118c4b1, size: 94 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_45334_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function updateProduct(a0) { // fn#45337, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5318:505, offset: 0x0118c50f, size: 197 bytes, params: 2, frame: 18
|
|
const value = a0.currencyCode.toLowerCase();
|
|
const value2 = a0.price / 100;
|
|
const r2 = env0_19 !== 'BG' ? (require(5137) /* metro dependency 5137: PriceUtils */).formatSingleCurrencyPrice(value2,
|
|
value,
|
|
{convertToMajorUnits: false}) : value === CurrencyCodes.EUR ? (require(5137) /* metro dependency 5137: PriceUtils */).formatDualPriceForBG(value2,
|
|
{convertToMajorUnits: false}) : (require(5137) /* metro dependency 5137: PriceUtils */).formatSingleCurrencyPrice(value2,
|
|
value, {convertToMajorUnits: false});
|
|
const object = {};
|
|
copyDataProperties(object, a0, undefined);
|
|
object['price'] = a0.price;
|
|
object['currencyCode'] = value;
|
|
object['priceString'] = r2;
|
|
return object;
|
|
}
|
|
|
|
function GPLAY_IN_APP_SKUS_LOADED({skus, skusType}) { // fn#45338, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5318:779, offset: 0x0118c5d4, size: 269 bytes, params: 2, frame: 19
|
|
var r5;
|
|
var value5;
|
|
var value6;
|
|
var error;
|
|
var moduleValue;
|
|
skus.forEach(_fun45339);
|
|
const Array = global.Array;
|
|
const from = Array.from;
|
|
let binding = env0_12;
|
|
const r9 = Reflect.apply(from, Array, [binding.values()])?.filter(function(a0) {
|
|
return a0 != null;
|
|
});
|
|
env0_11 = r9;
|
|
if (r9 != null) {
|
|
r9.forEach(function(a0) {
|
|
var r3;
|
|
var value = undefined;
|
|
r3 = a0 == null ? value : a0.offerIds;
|
|
if (r3 != null) {
|
|
r3.forEach(_fun45342);
|
|
}
|
|
return value;
|
|
});
|
|
}
|
|
try {
|
|
binding = env0_11;
|
|
value5 = binding == null;
|
|
if (value5) {
|
|
r5 = undefined;
|
|
} else {
|
|
value6 = binding.map(updateProduct);
|
|
r5 = value6;
|
|
}
|
|
env0_11 = r5;
|
|
} catch (error) {
|
|
moduleValue = require(3817) /* metro dependency 3817: BillingUtils */;
|
|
moduleValue.captureBillingException(error);
|
|
}
|
|
binding = env0_11;
|
|
if (binding != null) {
|
|
binding.forEach(_fun45343);
|
|
}
|
|
const IN_APP = GPlaySkusType.IN_APP;
|
|
if (IN_APP !== skusType) {
|
|
if (GPlaySkusType.SUBSCRIPTION !== skusType) {
|
|
}
|
|
}
|
|
function _fun45339(a0) { // fn#45339, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5318:841, offset: 0x0118c6e1, size: 31 bytes, params: 2, frame: 13
|
|
const binding = env1_12;
|
|
binding.set(a0.identifier, a0);
|
|
}
|
|
|
|
function _fun45341(a0) { // fn#45341, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5318:957, offset: 0x0118c700, size: 45 bytes, params: 2, frame: 13
|
|
const value = undefined;
|
|
const offerIds = a0 == null ? value : a0.offerIds;
|
|
if (offerIds != null) {
|
|
offerIds.forEach(_fun45342);
|
|
}
|
|
return value;
|
|
function _fun45342(a0) { // fn#45342, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5318:1013, offset: 0x0118c72d, size: 22 bytes, params: 2, frame: 11
|
|
return env2_13.add(a0);
|
|
}
|
|
|
|
}
|
|
|
|
function _fun45343(a0) { // fn#45343, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5318:1157, offset: 0x0118c6e1, size: 31 bytes, params: 2, frame: 13
|
|
const binding = env1_12;
|
|
binding.set(a0.identifier, a0);
|
|
}
|
|
|
|
}
|
|
|
|
function _fun45344(a0) { // fn#45344, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5318:1246, offset: 0x0118c743, size: 302 bytes, params: 2, frame: 16
|
|
const IAPStore2 = IAPStore;
|
|
Inherits(IAPStore2, a0);
|
|
return CreateClass(IAPStore2, [{key: 'getProducts', value: value_45346}, {key: 'getOfferIds', value: value_45347},
|
|
{key: 'getProduct', value: value_45348}, {key: 'isBusy', value: value_45349}, {key: 'isPurchasingProduct',
|
|
value: value_45350}, {key: 'isReady', value: function() {
|
|
return DISCONNECTED === GPlayConnectionState.CONNECTED;
|
|
}}, {key: 'hasConnectionError', value: function() {
|
|
return DISCONNECTED === GPlayConnectionState.ERROR;
|
|
}}, {key: 'getPendingDowngrade', value: value_45353}, {key: 'isFetchingGoogleSkus', value: value_45354},
|
|
{key: 'isFetchingProducts', value: value_45355}, {key: 'getUserCountry', value: value_45356}]);
|
|
function IAPStore() { // fn#45345, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5318:1258, offset: 0x00f7eb2a, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_2(this, IAPStore);
|
|
const value3 = env1_5(IAPStore);
|
|
return env1_4(this, _isNativeReflectConstruct_45334() ? global.Reflect.construct(value3, arguments,
|
|
env1_5(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
function value_45346() { // fn#45346, offset: 0x00ef8482, size: 9 bytes, params: 1, frame: 1
|
|
return env1_11;
|
|
}
|
|
|
|
function value_45347() { // fn#45347, offset: 0x00e2f9d5, size: 9 bytes, params: 1, frame: 1
|
|
return env1_13;
|
|
}
|
|
|
|
function value_45348(a0) { // fn#45348, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5318:1610, offset: 0x0118c871, size: 34 bytes, params: 2, frame: 11
|
|
let value = environment.__proto__;
|
|
value = env1_12.get(a0);
|
|
const value2 = null;
|
|
return value2 != value ? value : value2;
|
|
}
|
|
|
|
function value_45349() { // fn#45349, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5318:1683, offset: 0x0118c893, size: 27 bytes, params: 1, frame: 3
|
|
return env1_14.size > 0 || env1_16;
|
|
}
|
|
|
|
function value_45350(a0) { // fn#45350, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5318:1748, offset: 0x011578f1, size: 22 bytes, params: 2, frame: 11
|
|
return env1_14.has(a0);
|
|
}
|
|
|
|
function value_45353() { // fn#45353, offset: 0x00df0e8b, size: 9 bytes, params: 1, frame: 1
|
|
return env1_15;
|
|
}
|
|
|
|
function value_45354() { // fn#45354, offset: 0x0118c8dc, size: 16 bytes, params: 1, frame: 3
|
|
return env1_18 || env1_17;
|
|
}
|
|
|
|
function value_45355() { // fn#45355, offset: 0x0118c8dc, size: 16 bytes, params: 1, frame: 3
|
|
return env1_18 || env1_17;
|
|
}
|
|
|
|
function value_45356() { // fn#45356, offset: 0x00d406a2, size: 9 bytes, params: 1, frame: 1
|
|
return env1_19;
|
|
}
|
|
|
|
}
|
|
|
|
function GPLAY_VERIFICATION_START({productId}) { // fn#45362, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5318:2697, offset: 0x0118c927, size: 30 bytes, params: 2, frame: 11
|
|
env0_14.add(productId);
|
|
}
|
|
|
|
function GPLAY_VERIFICATION_END({productId}) { // fn#45363, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5318:2778, offset: 0x0118c945, size: 99 bytes, params: 2, frame: 13
|
|
const binding = env0_14;
|
|
if (binding.has(productId)) {
|
|
env0_14.delete(productId);
|
|
return undefined;
|
|
}
|
|
const Error = global.Error;
|
|
const value = 'Tried verifying product without initialization: ' + productId;
|
|
const value2 = Object.create(Error.prototype, {constructor: {value: Error}});
|
|
const error = new Error(value);
|
|
throw error instanceof Object ? error : value2;
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun45333, 5140, [6, 7, 15, 17, 18, 5141, 482, 5137, 3817, 566, 694,
|
|
2]) /* metro module 5140, dependencies: [6, 7, 15, 17, 18, 5141, 482, 5137, 3817, 566, 694, 2] */;
|