Files
discord-decomp/sources/records/SubscriptionPlanRecord.tsx
2026-07-28 01:06:53 +03:00

249 lines
13 KiB
TypeScript

/* Metro module 3803; source: records/SubscriptionPlanRecord.tsx; dependencies: [6, 7, 15, 17, 18, 1886, 1880, 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 * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as PremiumConstantsModule from '../modules/premium/PremiumConstants.tsx'; /* Metro dependency 1880 */
function _fun29196(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#29196, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3930:6, offset: 0x00fbcd98, size: 262 bytes, params: 8, frame: 20
const closure = function(a0, a1) {
return {amount: a0.amount, currency: a0.currency, tax: 0, taxInclusive: a1};
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = Record;
value = _fun29201(value);
(FileImportTrackerModule).fileFinishedImporting('records/SubscriptionPlanRecord.tsx');
exports.default = value;
exports.getPriceFromServer = closure;
exports.isNoneSubscription = function(a0) {
var NONE_MONTH = SubscriptionPlans.NONE_MONTH;
return [NONE_MONTH, SubscriptionPlans.NONE_3_MONTH, SubscriptionPlans.NONE_6_MONTH,
SubscriptionPlans.NONE_YEAR].includes(a0);
};
function _isNativeReflectConstruct_29197() { // fn#29197, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3930:235, offset: 0x00fbce9e, 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_29197_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun29201(a0) { // fn#29201, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3930:532, offset: 0x00fbcf28, size: 121 bytes, params: 2, frame: 17
const SubscriptionPlanRecord2 = SubscriptionPlanRecord;
Inherits(SubscriptionPlanRecord2, a0);
return CreateClass(SubscriptionPlanRecord2, [{key: 'premiumSubscriptionType', get: function() {
var skuId = this.skuId;
if (PremiumSubscriptionSKUs.LEGACY === skuId) {
return PremiumTypes.TIER_2;
}
if (PremiumSubscriptionSKUs.TIER_2 === skuId) {
return PremiumTypes.TIER_2;
}
if (PremiumSubscriptionSKUs.TIER_1 === skuId) {
return PremiumTypes.TIER_1;
}
if (PremiumSubscriptionSKUs.TIER_0 === skuId) {
return PremiumTypes.TIER_0;
}
return null;
}}, {key: 'toServerData', value: value_29204}], [{key: 'createFromServer', value: value_29206}]);
function SubscriptionPlanRecord({id, name, interval, intervalCount, taxInclusive, skuId, currency, price, prices}) { // fn#29202, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3930:544, offset: 0x00fbcfa1, size: 216 bytes, params: 2, frame: 20
let value = environment.__proto__;
env1_0(this, SubscriptionPlanRecord);
const value3 = env1_3(SubscriptionPlanRecord);
value = env1_2(this, _isNativeReflectConstruct_29197() ? global.Reflect.construct(value3, [],
env1_3(this).constructor) : value3.apply(this, undefined));
value.id = id;
value.name = name;
value.interval = interval;
value.intervalCount = intervalCount;
value.taxInclusive = taxInclusive;
value.skuId = skuId;
value.currency = currency;
value.price = price;
value.prices = prices;
return value;
}
function value_29204() { // fn#29204, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3930:1247, offset: 0x00fbd0e4, size: 157 bytes, params: 1, frame: 14
const Object = global.Object;
Object.keys(this.prices).forEach(_fun29205);
return {id: this.id, name: this.name, sku_id: this.skuId, interval: this.interval,
interval_count: this.intervalCount, tax_inclusive: this.taxInclusive, currency: this.currency,
price: this.price, prices: {}, price_tier: this.price};
function _fun29205(a0) { // fn#29205, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3930:1308, offset: 0x00fbd181, size: 86 bytes, params: 2, frame: 6
const property = ClassCallCheck.prices[a0];
CreateClass[a0] = {country_prices: {country_code: property.countryPrices.countryCode,
prices: property.countryPrices.prices}, payment_source_prices: property.paymentSourcePrices};
}
}
function value_29206(a0) { // fn#29206, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3930:1715, offset: 0x00fbd1d7, size: 188 bytes, params: 2, frame: 15
var r1;
var Object;
var value;
const env0_0 = a0;
let object = {};
if (a0.prices == null) {
r1 = object;
} else {
Object = global.Object;
value = Object.keys(a0.prices);
value = value.reduce(_fun29207, {});
r1 = value;
}
object = {};
object.id = a0.id;
object.name = a0.name;
object.interval = a0.interval;
object.intervalCount = a0.interval_count;
object.taxInclusive = a0.tax_inclusive;
object.skuId = a0.sku_id;
object.currency = a0.currency;
object.price = a0.price;
object.prices = r1;
value = Object.create(SubscriptionPlanRecord.prototype, {constructor: {value: SubscriptionPlanRecord}});
const subscriptionPlanRecord = new SubscriptionPlanRecord(object);
return subscriptionPlanRecord instanceof Object ? subscriptionPlanRecord : value;
function _fun29207(a0, a1) { // fn#29207, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3930:1792, offset: 0x00fbd293, size: 159 bytes, params: 3, frame: 18
let prices = env0_0.prices;
if (prices != null) {
prices = env0_0.prices;
var property = prices[a1];
var object = {};
var object2 = {};
var country_prices = property.country_prices;
object2.countryCode = country_prices.country_code;
country_prices = property.country_prices;
prices = country_prices.prices;
object2.prices = prices.map(_fun29208);
object.countryPrices = object2;
var Object = global.Object;
object.paymentSourcePrices = Object.entries(property.payment_source_prices).reduce(function(a0, a1) {
var r1;
var r3;
var r4;
var item3;
var value3;
var iterator = a1[Symbol.iterator]();
var iterator2 = iterator.next;
var item2 = Reflect.apply(iterator2, iterator, []);
var item = item2.value;
item2 = item2.done ? undefined : iterator;
var value = undefined;
var value2 = item2 === value;
var r2 = value2 ? value : item;
if (value2) {
r1 = item2;
r3 = value2;
r4 = value;
} else {
item3 = Reflect.apply(iterator2, item2, []);
item = item3.value;
item3 = item3.done ? undefined : item2;
value3 = item3 === value;
if (value3) {
r1 = item3;
r3 = value3;
r4 = value;
} else {
r1 = item3;
r3 = value3;
r4 = item;
}
}
if (!r3) {
r1.return();
}
a0[r2] = r4.map(_fun29210);
return a0;
}, {});
a0[a1] = object;
}
return a0;
function _fun29208(a0) { // fn#29208, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3930:1951, offset: 0x00fbd332, size: 33 bytes, params: 2, frame: 13
return getPriceFromServer(a0, env1_0.tax_inclusive);
}
function _fun29209(a0, a1) { // fn#29209, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3930:2063, offset: 0x00fbd353, size: 89 bytes, params: 3, frame: 16
var r1;
var r3;
var r4;
var item3;
var value3;
const iterator = a1[Symbol.iterator]();
const iterator2 = iterator.next;
let item2 = Reflect.apply(iterator2, iterator, []);
let item = item2.value;
item2 = item2.done ? undefined : iterator;
const value = undefined;
const value2 = item2 === value;
const r2 = value2 ? value : item;
if (value2) {
r1 = item2;
r3 = value2;
r4 = value;
} else {
item3 = Reflect.apply(iterator2, item2, []);
item = item3.value;
item3 = item3.done ? undefined : item2;
value3 = item3 === value;
if (value3) {
r1 = item3;
r3 = value3;
r4 = value;
} else {
r1 = item3;
r3 = value3;
r4 = item;
}
}
if (!r3) {
r1.return();
}
a0[r2] = r4.map(_fun29210);
return a0;
function _fun29210(a0) { // fn#29210, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3930:2087, offset: 0x00fbd3ac, size: 33 bytes, params: 2, frame: 13
return getPriceFromServer(a0, env2_0.tax_inclusive);
}
}
}
}
}
}
global.__d(_fun29196, 3803, [6, 7, 15, 17, 18, 1886, 1880,
2]) /* metro module 3803, dependencies: [6, 7, 15, 17, 18, 1886, 1880, 2] */;