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

321 lines
15 KiB
TypeScript

/* Metro module 4273; source: modules/skus/SKURecord.tsx; dependencies: [6, 7, 15, 17, 18, 1886, 4235, 4274, 661, 1391, 3738, 4275, 4276, 2] */
function _fun36226(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#36226, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4445:6, offset: 0x01085bc4, size: 296 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(6) /* metro dependency 6 */;
const env0_4 = importDefault(7) /* metro dependency 7 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
let value = importDefault(1886) /* metro dependency 1886: Record */;
const applicationRecord = importDefault(4235) /* metro dependency 4235: ApplicationRecord */;
const env0_9 = (require(4274) /* metro dependency 4274: SKUConstants */).THE_GAME_AWARD_WINNER_SKUS;
const constantsModule = require(661) /* metro dependency 661: Constants */;
const env0_10 = constantsModule.GIFTABLE_CURRENCIES;
const env0_11 = constantsModule.OperatingSystems;
const env0_12 = constantsModule.SKUFlags;
const env0_13 = constantsModule.SKUTypes;
value = _fun36230(value);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/skus/SKURecord.tsx');
exports.default = value;
}
function _isNativeReflectConstruct_36227() { // fn#36227, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4445:286, offset: 0x01085cec, 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_36227_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun36230(a0) { // fn#36230, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4445:485, offset: 0x01085d4a, size: 390 bytes, params: 2, frame: 17
const closure = SKURecord;
env0_7(closure, a0);
return env0_4(closure, [{key: 'supportedOperatingSystems', get: function() {
var r0;
r0 = this.systemRequirements != null ? global.Object.keys(this.systemRequirements) : [];
r0 = !(r0.length > 0) ? [OperatingSystems.WINDOWS] : r0;
return r0;
}}, {key: 'isOnSale', get: function() {
return this.price != null && this.price.saleAmount != null;
}}, {key: 'isGiftable', value: value_36234}, {key: 'getPrice', value: value_36235},
{key: 'getDisplaySalePercentage', value: function() {
var value = null;
return value == this.price || value == this.price.salePercentage ? value : '-' + this.price.salePercentage + '%';
}}, {key: 'requiresPayment', get: function() {
var value = this.getPrice();
return !this.premium && value != null && value.amount > 0;
}}, {key: 'isTheGameAwardsWinner', get: function() {
return THE_GAME_AWARD_WINNER_SKUS.has(this.id);
}}, {key: 'available', get: get_36239}, {key: 'isAvailableForDistribution', value: value_36240},
{key: 'isAvailable', value: function() {
return require(dependencyMap[9]).hasFlag(this.flags, SKUFlags.AVAILABLE);
}}, {key: 'isPremiumPerk', value: function() {
return this.premium && (require(dependencyMap[9]).hasFlag(this.flags,
SKUFlags.PREMIUM_PURCHASE) || require(dependencyMap[9]).hasFlag(this.flags,
SKUFlags.PREMIUM_AND_DISTRIBUTION));
}}, {key: 'hasFeature', value: function(a0) {
return this.features.has(a0);
}}, {key: 'isPreorder', value: function() {
return this.preorderReleaseAt != null || this.preorderApproximateReleaseDate != null;
}}], [{key: 'createFromServer', value: value_36245}]);
}
function SKURecord({id, type, applicationId, application, eligiblePaymentGateways, googleSkuIds, productLine, name, preorderReleaseAt, preorderApproximateReleaseDate, releaseDate, summary, features, genres, dependentSkuId, manifests, availableRegions, accessType, systemRequirements, contentRating, contentRatingAgency, legalNotice, price, prices, premium, showAgeGate, restricted, slug, exclusive, locales, flags, externalPurchaseUrl, deleted, bundledSkuIds, bundledSkus, tenantMetadata, selectedOptions, productId, thumbnailAssetId, description, orbsReward, eligibleOffers, previewAssetPaths}) { // fn#36231, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4445:497, offset: 0x01085ed0, size: 625 bytes, params: 2, frame: 20
let value = environment.__proto__;
env1_3(this, SKURecord);
const value3 = env1_6(SKURecord);
value = env1_5(this, _isNativeReflectConstruct_36227() ? global.Reflect.construct(value3, [],
env1_6(this).constructor) : value3.apply(this, undefined));
value.id = id;
value.type = type;
value.applicationId = applicationId;
value.application = application;
value.eligiblePaymentGateways = eligiblePaymentGateways;
value.googleSkuIds = googleSkuIds;
value.productLine = productLine;
value.name = name;
value.preorderReleaseAt = preorderReleaseAt;
value.preorderApproximateReleaseDate = preorderApproximateReleaseDate;
value.releaseDate = releaseDate;
value.summary = summary;
value.features = features;
value.genres = genres;
value.dependentSkuId = dependentSkuId;
value.manifests = manifests;
value.availableRegions = availableRegions;
value.accessType = accessType;
value.systemRequirements = systemRequirements;
value.contentRating = contentRating;
value.contentRatingAgency = contentRatingAgency;
value.legalNotice = legalNotice;
value.price = price;
value.prices = prices;
value.premium = premium;
value.showAgeGate = showAgeGate;
value.restricted = restricted;
value.slug = slug;
value.exclusive = exclusive;
value.locales = locales;
value.flags = flags;
externalPurchaseUrl = !externalPurchaseUrl ? null : externalPurchaseUrl;
value.externalPurchaseUrl = externalPurchaseUrl;
value.deleted = deleted;
value.bundledSkuIds = bundledSkuIds;
value.bundledSkus = bundledSkus;
value.tenantMetadata = tenantMetadata;
value.selectedOptions = selectedOptions;
value.productId = productId;
value.thumbnailAssetId = thumbnailAssetId;
value.description = description;
value.orbsReward = orbsReward;
value.eligibleOffers = eligibleOffers;
value.previewAssetPaths = previewAssetPaths;
return value;
}
function value_36234() { // fn#36234, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4445:2247, offset: 0x010861b7, size: 109 bytes, params: 1, frame: 13
let value = a0;
const r2 = value !== undefined ? value : this.price;
const type = this.type;
value = environment.__proto__;
const DURABLE_PRIMARY = SKUTypes.DURABLE_PRIMARY;
let r0 = type === DURABLE_PRIMARY && this.available && this.requiresPayment;
r0 = r0 && r2 != null && GIFTABLE_CURRENCIES.has(r2.currency) && this.externalPurchaseUrl == null;
return r0;
}
function value_36235() { // fn#36235, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4445:2429, offset: 0x01086224, size: 161 bytes, params: 1, frame: 7
const value = a0;
const value2 = a1;
const value3 = undefined;
const r5 = value !== value3 ? value : null;
let r1 = !(value2 !== value3) || value2;
const price = this.price;
if (price == null) {
return null;
}
if (r5 != null) {
var premium = price.premium;
var r3 = premium == null ? value3 : premium[r5];
if (r3 != null) {
return {amount: r3.amount, currency: price.currency};
}
}
r1 = r1 && price.saleAmount != null ? {amount: price.saleAmount, currency: price.currency} : {amount: price.amount,
currency: price.currency};
return r1;
}
function get_36239() { // fn#36239, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4445:3047, offset: 0x01086362, size: 72 bytes, params: 1, frame: 14
const value = environment.__proto__;
const flagUtilsModule = require(1391) /* metro dependency 1391: FlagUtils */;
const hasFlag = flagUtilsModule.hasFlag;
const flags = this.flags;
const AVAILABLE = SKUFlags.AVAILABLE;
return Reflect.apply(hasFlag, flagUtilsModule, [flags, AVAILABLE]) || this.externalPurchaseUrl != null;
}
function value_36240() { // fn#36240, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4445:3179, offset: 0x010863aa, size: 115 bytes, params: 1, frame: 16
var r0;
var r1;
var value;
var premium;
var moduleValue;
const available = this.available;
if (available) {
value = this.getPrice();
value = value != null;
r0 = value;
} else {
r0 = available;
}
r0 = r0 && this.externalPurchaseUrl == null;
if (r0) {
premium = this.premium;
value = !premium;
if (premium) {
value = environment.__proto__;
moduleValue = require(1391) /* metro dependency 1391: FlagUtils */;
value = moduleValue.hasFlag(this.flags, SKUFlags.PREMIUM_AND_DISTRIBUTION);
r1 = value;
} else {
r1 = value;
}
r0 = r1;
}
return r0;
}
function value_36245(a0) { // fn#36245, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4445:3807, offset: 0x01086500, size: 1081 bytes, params: 2, frame: 19
var r1;
var object2;
const price = a0.price;
const object4 = {};
object4.id = a0.id;
object4.type = a0.type;
object4.applicationId = a0.application_id;
const application = a0.application;
let value = null;
let r3 = value != application ? ApplicationRecord.createFromServer(a0.application) : value;
object4.application = r3;
const eligible_payment_gateways = a0.eligible_payment_gateways;
object4.eligiblePaymentGateways = value != eligible_payment_gateways ? eligible_payment_gateways : value;
const google_sku_ids = a0.google_sku_ids;
object4.googleSkuIds = value != google_sku_ids ? google_sku_ids : value;
object4.productLine = a0.product_line;
const name = a0.name;
const value3 = '';
object4.name = value != name ? name : value3;
object4.releaseDate = value != a0.release_date ? (importDefault(3738) /* metro dependency 3738 */)(a0.release_date) : value;
object4.preorderReleaseAt = value != a0.preorder_release_at ? (importDefault(3738) /* metro dependency 3738 */)(a0.preorder_release_at) : value;
object4.preorderApproximateReleaseDate = a0.preorder_approximate_release_date;
object4.summary = a0.summary;
let Set = global.Set;
const features = a0.features;
const value8 = Object.create(Set.prototype, {constructor: {value: Set}});
let set = new Set(features);
object4.features = set instanceof Object ? set : value8;
Set = global.Set;
const genres = a0.genres;
const value10 = Object.create(Set.prototype, {constructor: {value: Set}});
set = new Set(genres);
object4.genres = set instanceof Object ? set : value10;
object4.dependentSkuId = a0.dependent_sku_id;
object4.manifests = a0.manifests;
object4.availableRegions = a0.available_regions;
object4.accessType = a0.access_type;
object4.systemRequirements = a0.system_requirements;
object4.contentRating = a0.content_rating;
object4.contentRatingAgency = a0.content_rating_agency;
object4.legalNotice = a0.legal_notice;
object4.price = value != price ? {amount: price.amount, currency: price.currency, saleAmount: price.sale_amount,
salePercentage: price.sale_percentage, premium: price.premium} : value;
const value13 = undefined;
object4.prices = (importDefault(4275) /* metro dependency 4275: getPricesFromServer */)(a0.prices);
const premium = a0.premium;
object4.premium = value != premium && premium;
let show_age_gate = a0.show_age_gate;
show_age_gate = !!show_age_gate && show_age_gate;
object4.showAgeGate = show_age_gate;
let restricted = a0.restricted;
restricted = !!restricted && restricted;
object4.restricted = restricted;
const slug = a0.slug;
let r7 = value != slug ? slug : value3;
object4.slug = r7;
let exclusive = a0.exclusive;
exclusive = !!exclusive && exclusive;
object4.exclusive = exclusive;
const locales = a0.locales;
object4.locales = value != locales ? locales : ['en-US'];
object4.flags = a0.flags;
object4.externalPurchaseUrl = a0.external_purchase_url;
const deleted = a0.deleted;
object4.deleted = value != deleted && deleted;
const bundled_sku_ids = a0.bundled_sku_ids;
object4.bundledSkuIds = value != bundled_sku_ids ? bundled_sku_ids : [];
const bundled_skus = a0.bundled_skus;
r7 = value == bundled_skus ? value13 : bundled_skus.map(function(a0) {
return SKURecord.createFromServer(a0);
});
r7 = value == r7 ? [] : r7;
object4.bundledSkus = r7;
object4.tenantMetadata = (importDefault(4276) /* metro dependency 4276: transformSKUTenantMetadata */)(a0.tenant_metadata);
const selected_options = a0.selected_options;
r3 = value == selected_options ? value13 : selected_options.map(function({option_name, option_value}) {
return {optionName: option_name, optionValue: option_value};
});
r3 = value == r3 ? [] : r3;
object4.selectedOptions = r3;
object4.productId = a0.product_id;
object4.thumbnailAssetId = a0.thumbnail_asset_id;
object4.description = a0.description;
object4.orbsReward = a0.orbs_reward;
const eligible_offers = a0.eligible_offers;
object4.eligibleOffers = value != eligible_offers ? eligible_offers : [];
let preview_asset_paths = a0.preview_asset_paths;
if (value != preview_asset_paths) {
object2 = {};
preview_asset_paths = a0.preview_asset_paths;
object2.fgStatic = preview_asset_paths.fg_static;
preview_asset_paths = a0.preview_asset_paths;
object2.fgAnimated = preview_asset_paths.fg_animated;
preview_asset_paths = a0.preview_asset_paths;
object2.bgStatic = preview_asset_paths.bg_static;
preview_asset_paths = a0.preview_asset_paths;
object2.bgAnimated = preview_asset_paths.bg_animated;
r1 = object2;
} else {
r1 = value;
}
object4.previewAssetPaths = r1;
value = Object.create(SKURecord.prototype, {constructor: {value: SKURecord}});
const sKURecord = new SKURecord(object4);
return sKURecord instanceof Object ? sKURecord : value;
}