259 lines
10 KiB
TypeScript
259 lines
10 KiB
TypeScript
/* Metro module 10066; source: modules/collectibles/native/CollectiblesUtils.tsx; dependencies: [661, 5137, 3815, 5140, 5134, 5133, 10067, 10068, 2] */
|
|
function _fun78672(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#78672, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10252:6, offset: 0x01e313d2, size: 230 bytes, params: 8, frame: 18
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_78675 = function(a0, a1) {
|
|
var r0;
|
|
var r1;
|
|
var r2;
|
|
var value3;
|
|
var length;
|
|
var value5;
|
|
var value = undefined;
|
|
var value2 = value == null;
|
|
reducibleJoin2: while (true) {
|
|
if (value2) {
|
|
r0 = value2;
|
|
break reducibleJoin2;
|
|
}
|
|
value3 = value > a0.length;
|
|
r0 = value3;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (r0) {
|
|
length = a0.length;
|
|
r1 = length;
|
|
break reducibleJoin4;
|
|
}
|
|
r1 = value;
|
|
break reducibleJoin4;
|
|
}
|
|
value = (0, global.Array)(r1);
|
|
var value4 = 0;
|
|
if (value4 < r1) {
|
|
r2 = value4;
|
|
reducibleLoop5: while (true) {
|
|
value[r2] = a0[r2];
|
|
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value5 < r1) {
|
|
r2 = value5;
|
|
continue reducibleLoop5;
|
|
}
|
|
break reducibleLoop5;
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = (require(661) /* metro dependency 661: Constants */).PriceSetAssignmentPurchaseTypes;
|
|
const closure = extractPriceByPurchaseTypes_78676;
|
|
const closure2 = isGPlaySynced;
|
|
const hasAtLeastOneGPlaySynced = function({products}) {
|
|
products = products.filter(_fun78680).length;
|
|
return products > 0;
|
|
};
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/collectibles/native/CollectiblesUtils.tsx');
|
|
exports.getFormattedPriceForCollectiblesProduct = getFormattedPriceForCollectiblesProduct_78681;
|
|
exports.extractPriceByPurchaseTypes = closure;
|
|
exports.isGPlaySynced = closure2;
|
|
exports.filterGPlaySyncedCategories = function(a0) {
|
|
var r2;
|
|
var value5;
|
|
var value6;
|
|
if (a0 == null) {
|
|
return [];
|
|
}
|
|
var items = [];
|
|
var value3 = _createForOfIteratorHelperLoose_78673(a0.values());
|
|
var value4 = value3();
|
|
if (!value4.done) {
|
|
r2 = value4;
|
|
while (true) {
|
|
value5 = r2.value;
|
|
if (hasAtLeastOneGPlaySynced(value5)) {
|
|
items.push(value5);
|
|
}
|
|
value6 = value3();
|
|
if (value6.done) {
|
|
break;
|
|
}
|
|
r2 = value6;
|
|
continue;
|
|
}
|
|
}
|
|
return items;
|
|
};
|
|
exports.filterHiddenCategories = function(a0) {
|
|
return a0.filter(_fun78684);
|
|
};
|
|
exports.createOrbProfileBadge = function() {
|
|
var object = {};
|
|
object.id = require(dependencyMap[6]).OrbBadges.ORB_PROFILE_BADGE;
|
|
object.icon = require(dependencyMap[6]).OrbBadges.ORB_PROFILE_BADGE;
|
|
object.iconSrc = importDefault(dependencyMap[7]);
|
|
object.description = '';
|
|
object.isPreviewMode = true;
|
|
return object;
|
|
};
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_78673(a0, a1) { // fn#78673, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10252:143, offset: 0x01e314b8, size: 372 bytes, params: 3, frame: 20
|
|
var r6;
|
|
var r9;
|
|
var r5;
|
|
var value3;
|
|
var regexp;
|
|
const env0_0 = a0;
|
|
const Symbol = global.Symbol;
|
|
let value = typeof Symbol !== 'undefined';
|
|
let r1 = value && a0[global.Symbol.iterator];
|
|
r1 = !r1 ? a0['@@iterator'] : r1;
|
|
if (r1) {
|
|
value = r1.call(a0);
|
|
return value.next.bind(value);
|
|
}
|
|
const Array = global.Array;
|
|
if (Array.isArray(a0)) {
|
|
if (r1) {
|
|
}
|
|
return _fun78674;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_78675(a0, value);
|
|
r5 = value;
|
|
} else {
|
|
value3 = ({}).toString.call(a0).slice(8, -1);
|
|
r6 = value3 === 'Object' && a0.constructor;
|
|
r9 = r6 ? a0.constructor.name : value3;
|
|
if (r9 === 'Map') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Set') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Arguments') {
|
|
value = _arrayLikeToArray_78675(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_78675(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun78674;
|
|
}
|
|
const TypeError = global.TypeError;
|
|
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
|
}
|
|
|
|
function extractPriceByPurchaseTypes_78676(a0, a1) { // fn#78676, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10252:1085, offset: 0x01e3162c, size: 225 bytes, params: 3, frame: 17
|
|
var getProduct;
|
|
var googleSkuIds;
|
|
var value;
|
|
const value2 = undefined;
|
|
const billingPlatformUtilsModule = require(3815) /* metro dependency 3815: BillingPlatformUtils */;
|
|
if (billingPlatformUtilsModule.isGooglePlayBillingSupported()) {
|
|
if (a1 === PriceSetAssignmentPurchaseTypes.MOBILE) {
|
|
value = importDefault(5140) /* metro dependency 5140: IAPStoreAndroid */;
|
|
getProduct = value.getProduct;
|
|
googleSkuIds = a0.googleSkuIds;
|
|
value = Reflect.apply(getProduct, value, [googleSkuIds == null ? value2 : googleSkuIds[a1]]);
|
|
return value != null ? {amount: value.price, currency: value.currencyCode, priceString: value.priceString,
|
|
tax: 0,
|
|
taxInclusive: false} : value2;
|
|
}
|
|
if (a1 !== PriceSetAssignmentPurchaseTypes.MOBILE_PREMIUM_TIER_2) {
|
|
return null;
|
|
}
|
|
value = importDefault(5140) /* metro dependency 5140: IAPStoreAndroid */;
|
|
getProduct = value.getProduct;
|
|
googleSkuIds = a0.googleSkuIds;
|
|
value = Reflect.apply(getProduct, value, [googleSkuIds == null ? value2 : googleSkuIds[a1]]);
|
|
return value != null ? {amount: value.price, currency: value.currencyCode, priceString: value.priceString,
|
|
tax: 0,
|
|
taxInclusive: false} : value2;
|
|
}
|
|
return (require(5134) /* metro dependency 5134: CollectiblesUtils */).extractPriceByPurchaseTypes(a0, a1);
|
|
}
|
|
|
|
function isGPlaySynced(a0) { // fn#78677, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10252:1434, offset: 0x01e3170d, size: 205 bytes, params: 2, frame: 18
|
|
const value2 = undefined;
|
|
const collectiblesProductUtilsModule = require(5133) /* metro dependency 5133: CollectiblesProductUtils */;
|
|
const getIsVariantProduct = collectiblesProductUtilsModule.getIsVariantProduct;
|
|
if (Reflect.apply(getIsVariantProduct, collectiblesProductUtilsModule, [a0])) {
|
|
return a0.variants.every(function(a0) {
|
|
return isGPlaySynced(a0);
|
|
});
|
|
}
|
|
const defaultImport = importDefault(5140) /* metro dependency 5140: IAPStoreAndroid */;
|
|
let getProduct = defaultImport.getProduct;
|
|
let googleSkuIds = a0.googleSkuIds;
|
|
const value3 = Reflect.apply(getProduct, defaultImport,
|
|
[googleSkuIds == null ? value2 : googleSkuIds[PriceSetAssignmentPurchaseTypes.MOBILE]]);
|
|
const defaultImport2 = defaultImport;
|
|
getProduct = defaultImport2.getProduct;
|
|
googleSkuIds = a0.googleSkuIds;
|
|
return value3 != null && Reflect.apply(getProduct, defaultImport2,
|
|
[googleSkuIds == null ? value2 : googleSkuIds[PriceSetAssignmentPurchaseTypes.MOBILE_PREMIUM_TIER_2]]) != null;
|
|
}
|
|
|
|
function hasAtLeastOneGPlaySynced({products}) { // fn#78679, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10252:1729, offset: 0x01e317da, size: 41 bytes, params: 2, frame: 11
|
|
return products.filter(function(a0) {
|
|
return isGPlaySynced(a0);
|
|
}).length > 0;
|
|
}
|
|
|
|
function getFormattedPriceForCollectiblesProduct_78681(a0, a1, a2) { // fn#78681, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10252:1909, offset: 0x01e31803, size: 148 bytes, params: 4, frame: 15
|
|
var r0;
|
|
var r1;
|
|
var value;
|
|
const value2 = extractPriceByPurchaseTypes_78676(a0,
|
|
a2 ? a1 ? PriceSetAssignmentPurchaseTypes.MOBILE_PREMIUM_TIER_2 : PriceSetAssignmentPurchaseTypes.MOBILE : a1 ? PriceSetAssignmentPurchaseTypes.PREMIUM_TIER_2 : PriceSetAssignmentPurchaseTypes.DEFAULT);
|
|
const value3 = null;
|
|
if (value3 == value2) {
|
|
r0 = value3;
|
|
} else {
|
|
if (value3 != value2.priceString) {
|
|
r1 = value2.priceString;
|
|
} else {
|
|
value = require(5137) /* metro dependency 5137: PriceUtils */;
|
|
value = value.formatPrice(value2.amount, value2.currency);
|
|
r1 = value;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function filterHiddenCategories(a0) { // fn#78683, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10252:2440, offset: 0x01e318f9, size: 24 bytes, params: 2, frame: 11
|
|
return a0.filter(function(a0) {
|
|
var r0;
|
|
var unpublishedAt;
|
|
var value2;
|
|
var value = a0.unpublishedAt == null;
|
|
if (value) {
|
|
r0 = value;
|
|
} else {
|
|
unpublishedAt = a0.unpublishedAt;
|
|
value2 = new global.Date();
|
|
value2 = unpublishedAt > value2;
|
|
r0 = value2;
|
|
}
|
|
r0 = r0 && a0.products.length > 0;
|
|
return r0;
|
|
});
|
|
}
|
|
|