Files
discord-decomp/sources/modules/storefront/SKUPricesStore.tsx
T
2026-07-27 16:20:00 +03:00

177 lines
7.9 KiB
TypeScript

/* Metro module 6834; source: modules/storefront/SKUPricesStore.tsx; dependencies: [6, 7, 15, 17, 18, 1949, 1360, 566, 694, 2] */
function _fun53816(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#53816, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7012:6, offset: 0x01356644, size: 370 bytes, params: 8, frame: 20
const env0_0 = require;
const serializeStorefrontPriceId = function(a0) {
return a0.type === 'application' ? 'application:' + a0.applicationId : 'skus:' + a0.skuId;
};
const closure = function() {
env0_8 = {};
env0_9 = {};
env0_10 = {};
env0_11 = {};
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(6) /* metro dependency 6 */;
const env0_3 = importDefault(7) /* metro dependency 7 */;
const env0_4 = importDefault(15) /* metro dependency 15 */;
const env0_5 = importDefault(17) /* metro dependency 17 */;
const env0_6 = importDefault(18) /* metro dependency 18 */;
const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */;
let env0_8 = {};
let env0_9 = {};
let env0_10 = {};
let env0_11 = {};
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
let value = _fun53824(Store);
value.displayName = 'SKUPricesStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {LOGOUT: closure,
SKUS_PRICING_FETCH_START: function({priceId}) {
setPriceIdState(priceId, {type: 'loading'});
}, SKUS_PRICING_FETCH_SUCCESS: SKUS_PRICING_FETCH_SUCCESS, SKUS_PRICING_FETCH_FAIL: function({priceId}) {
var setPriceIdStateBinding = setPriceIdState;
var object = {type: 'error'};
var Date = global.Date;
object.fetchedAt = Date.now();
setPriceIdStateBinding(priceId, object);
}, STOREFRONT_PROMOTION_ID_OVERRIDE_SET: closure});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/storefront/SKUPricesStore.tsx');
exports.default = value;
}
function _isNativeReflectConstruct_53817() { // fn#53817, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7012:158, offset: 0x013567b6, 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_53817_isNativeReflectConstruct = function() {
return !!result;
})();
}
function setPriceIdState(a0, a1) { // fn#53821, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7012:494, offset: 0x01356862, size: 154 bytes, params: 3, frame: 18
var object3;
var Object;
var fromEntries;
var skuIds;
var serializeStorefrontPriceIdBinding;
var object4;
const env0_0 = a1;
if (a0.type === 'application') {
object3 = {};
copyDataProperties(object3, env0_8, undefined);
serializeStorefrontPriceIdBinding = serializeStorefrontPriceId;
object4 = {type: 'application'};
object4.applicationId = a0.applicationId;
object3[serializeStorefrontPriceIdBinding(object4)] = a1;
} else {
object3 = {};
copyDataProperties(object3, env0_8, undefined);
Object = global.Object;
fromEntries = Object.fromEntries;
skuIds = a0.skuIds;
copyDataProperties(object3, Reflect.apply(fromEntries, Object, [skuIds.map(_fun53822)]), skuIds);
}
}
function _fun53824(a0) { // fn#53824, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7012:794, offset: 0x0135694f, size: 168 bytes, params: 2, frame: 16
const closure = SKUPricesStore;
env0_6(closure, a0);
return env0_3(closure, [{key: 'initialize', value: function() {
this.waitFor(LocaleStore);
this.syncWith([LocaleStore], LOGOUT_53823);
}}, {key: 'getPricesForSkuId', value: value_53827}, {key: 'getFetchStateForSkuId', value: value_53828},
{key: 'getFetchStateForApplicationId', value: value_53829}, {key: 'getRewardsForSkuId', value: value_53830}]);
}
function SKUS_PRICING_FETCH_SUCCESS({priceId, data}) { // fn#53833, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7012:1924, offset: 0x01356b52, size: 224 bytes, params: 2, frame: 19
var object2;
var r9;
var Object;
const Date = global.Date;
const value = Date.now();
setPriceIdState(priceId, {type: 'success', fetchedAt: value});
if (priceId.type === 'application') {
setPriceIdStateBinding = setPriceIdState;
Object = global.Object;
setPriceIdStateBinding({type: 'skus', skuIds: Object.keys(data.skuPriceMap)}, {type: 'success',
fetchedAt: value});
r9 = Object;
}
object2 = {};
copyDataProperties(object2, env0_9, r9);
copyDataProperties(object2, data.pricingResultIdMap, r9);
object2 = {};
copyDataProperties(object2, env0_11, r9);
copyDataProperties(object2, data.skuPriceMap, r9);
object2 = {};
copyDataProperties(object2, env0_10, r9);
copyDataProperties(object2, data.rewardResultIdMap, r9);
}
function _fun53822(a0) { // fn#53822, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7012:681, offset: 0x013568fc, size: 52 bytes, params: 2, frame: 11
const value = environment.__proto__;
const serializeStorefrontPriceIdBinding = serializeStorefrontPriceId;
let object = {type: 'sku', skuId: a0};
object = [serializeStorefrontPriceIdBinding(object)];
object[1] = require;
return object;
}
function value_53827(a0) { // fn#53827, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7012:1189, offset: 0x01356a28, size: 53 bytes, params: 2, frame: 5
if (a0 != null) {
var pricingResultId = env1_11[a0]?.pricingResultId;
if (pricingResultId != null) {
return env1_9[pricingResultId];
}
}
}
function value_53828(a0) { // fn#53828, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7012:1326, offset: 0x01356a5d, size: 51 bytes, params: 2, frame: 13
var value;
if (a0 != null) {
value = environment.__proto__;
return env1_8[serializeStorefrontPriceId({type: 'sku', skuId: a0})];
}
}
function value_53829(a0) { // fn#53829, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7012:1453, offset: 0x01356a90, size: 51 bytes, params: 2, frame: 13
var value;
if (a0 != null) {
value = environment.__proto__;
return env1_8[serializeStorefrontPriceId({type: 'application', applicationId: a0})];
}
}
function value_53830(a0) { // fn#53830, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7012:1585, offset: 0x01356ac3, size: 91 bytes, params: 2, frame: 13
var value2;
if (a0 != null) {
var property = env1_11[a0];
if (property != null) {
value2 = property.rewardResultIds.map(_fun53831);
return value2.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish);
}
}
}