322 lines
17 KiB
TypeScript
322 lines
17 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] */
|
|
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 Record from '../../lib/Record.tsx'; /* Metro dependency 1886 */
|
|
import ApplicationRecord from '../../records/ApplicationRecord.tsx'; /* Metro dependency 4235 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as FlagUtilsModule from '../../external/discord_common/js/shared/utils/FlagUtils.tsx'; /* Metro dependency 1391 */
|
|
import * as SKUConstantsModule from './SKUConstants.tsx'; /* Metro dependency 4274 */
|
|
|
|
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});
|
|
let value = Record;
|
|
value = _fun36230(value);
|
|
(FileImportTrackerModule).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 SKURecord2 = SKURecord;
|
|
Inherits(SKURecord2, a0);
|
|
return CreateClass(SKURecord2, [{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 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 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 object;
|
|
const price = a0.price;
|
|
const object3 = {};
|
|
object3.id = a0.id;
|
|
object3.type = a0.type;
|
|
object3.applicationId = a0.application_id;
|
|
const application = a0.application;
|
|
let value = null;
|
|
let r3 = value != application ? ApplicationRecord.createFromServer(a0.application) : value;
|
|
object3.application = r3;
|
|
const eligible_payment_gateways = a0.eligible_payment_gateways;
|
|
object3.eligiblePaymentGateways = value != eligible_payment_gateways ? eligible_payment_gateways : value;
|
|
const google_sku_ids = a0.google_sku_ids;
|
|
object3.googleSkuIds = value != google_sku_ids ? google_sku_ids : value;
|
|
object3.productLine = a0.product_line;
|
|
const name = a0.name;
|
|
const value3 = '';
|
|
object3.name = value != name ? name : value3;
|
|
object3.releaseDate = value != a0.release_date ? (importDefault(3738) /* metro dependency 3738 */)(a0.release_date) : value;
|
|
object3.preorderReleaseAt = value != a0.preorder_release_at ? (importDefault(3738) /* metro dependency 3738 */)(a0.preorder_release_at) : value;
|
|
object3.preorderApproximateReleaseDate = a0.preorder_approximate_release_date;
|
|
object3.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);
|
|
object3.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);
|
|
object3.genres = set instanceof Object ? set : value10;
|
|
object3.dependentSkuId = a0.dependent_sku_id;
|
|
object3.manifests = a0.manifests;
|
|
object3.availableRegions = a0.available_regions;
|
|
object3.accessType = a0.access_type;
|
|
object3.systemRequirements = a0.system_requirements;
|
|
object3.contentRating = a0.content_rating;
|
|
object3.contentRatingAgency = a0.content_rating_agency;
|
|
object3.legalNotice = a0.legal_notice;
|
|
object3.price = value != price ? {amount: price.amount, currency: price.currency, saleAmount: price.sale_amount,
|
|
salePercentage: price.sale_percentage, premium: price.premium} : value;
|
|
const value13 = undefined;
|
|
object3.prices = (importDefault(4275) /* metro dependency 4275: getPricesFromServer */)(a0.prices);
|
|
const premium = a0.premium;
|
|
object3.premium = value != premium && premium;
|
|
let show_age_gate = a0.show_age_gate;
|
|
show_age_gate = !!show_age_gate && show_age_gate;
|
|
object3.showAgeGate = show_age_gate;
|
|
let restricted = a0.restricted;
|
|
restricted = !!restricted && restricted;
|
|
object3.restricted = restricted;
|
|
const slug = a0.slug;
|
|
let r7 = value != slug ? slug : value3;
|
|
object3.slug = r7;
|
|
let exclusive = a0.exclusive;
|
|
exclusive = !!exclusive && exclusive;
|
|
object3.exclusive = exclusive;
|
|
const locales = a0.locales;
|
|
object3.locales = value != locales ? locales : ['en-US'];
|
|
object3.flags = a0.flags;
|
|
object3.externalPurchaseUrl = a0.external_purchase_url;
|
|
const deleted = a0.deleted;
|
|
object3.deleted = value != deleted && deleted;
|
|
const bundled_sku_ids = a0.bundled_sku_ids;
|
|
object3.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;
|
|
object3.bundledSkus = r7;
|
|
object3.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;
|
|
object3.selectedOptions = r3;
|
|
object3.productId = a0.product_id;
|
|
object3.thumbnailAssetId = a0.thumbnail_asset_id;
|
|
object3.description = a0.description;
|
|
object3.orbsReward = a0.orbs_reward;
|
|
const eligible_offers = a0.eligible_offers;
|
|
object3.eligibleOffers = value != eligible_offers ? eligible_offers : [];
|
|
let preview_asset_paths = a0.preview_asset_paths;
|
|
if (value != preview_asset_paths) {
|
|
object = {};
|
|
preview_asset_paths = a0.preview_asset_paths;
|
|
object.fgStatic = preview_asset_paths.fg_static;
|
|
preview_asset_paths = a0.preview_asset_paths;
|
|
object.fgAnimated = preview_asset_paths.fg_animated;
|
|
preview_asset_paths = a0.preview_asset_paths;
|
|
object.bgStatic = preview_asset_paths.bg_static;
|
|
preview_asset_paths = a0.preview_asset_paths;
|
|
object.bgAnimated = preview_asset_paths.bg_animated;
|
|
r1 = object;
|
|
} else {
|
|
r1 = value;
|
|
}
|
|
object3.previewAssetPaths = r1;
|
|
value = Object.create(SKURecord.prototype, {constructor: {value: SKURecord}});
|
|
const sKURecord = new SKURecord(object3);
|
|
return sKURecord instanceof Object ? sKURecord : value;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
global.__d(_fun36226, 4273, [6, 7, 15, 17, 18, 1886, 4235, 4274, 661, 1391, 3738, 4275, 4276,
|
|
2]) /* metro module 4273, dependencies: [6, 7, 15, 17, 18, 1886, 4235, 4274, 661, 1391, 3738, 4275, 4276, 2] */;
|