Files
discord-decomp/sources/modules/billing/hooks/useSubscriptionPlansLoaded.tsx
T
2026-07-28 01:06:53 +03:00

296 lines
11 KiB
TypeScript

/* Metro module 7563; source: modules/billing/hooks/useSubscriptionPlansLoaded.tsx; dependencies: [3805, 3807, 3808, 1880, 3, 566, 2] */
import Logger from '../../debug/Logger.tsx'; /* Metro dependency 3 */
import PaymentSourceStore from '../../../stores/billing/PaymentSourceStore.tsx'; /* Metro dependency 3805 */
import SubscriptionPlanStore from '../../../stores/billing/SubscriptionPlanStore.tsx'; /* Metro dependency 3807 */
import SubscriptionStore from '../../../stores/billing/SubscriptionStore.tsx'; /* Metro dependency 3808 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as PremiumConstantsModule from '../../premium/PremiumConstants.tsx'; /* Metro dependency 1880 */
function _fun60805(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#60805, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7741:6, offset: 0x017103df, size: 230 bytes, params: 8, frame: 20
const env0_0 = require;
const _arrayLikeToArray_60808 = 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 getSubscriptionPlansLoaded2 = getSubscriptionPlansLoaded;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
Object.create(Logger.prototype, {constructor: {value: Logger}});
new Logger('useSubscriptionPlansLoaded');
(FileImportTrackerModule).fileFinishedImporting('modules/billing/hooks/useSubscriptionPlansLoaded.tsx');
exports.useSubscriptionPlansLoaded = useSubscriptionPlansLoaded;
exports.getSubscriptionPlansLoaded = getSubscriptionPlansLoaded2;
function _createForOfIteratorHelperLoose_60806(a0, a1) { // fn#60806, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7741:161, offset: 0x017104c5, size: 370 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 _fun60807;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_60808(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_60808(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_60808(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun60807;
}
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 _fun60807() { // fn#60807, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7741:732, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function getSubscriptionPlansLoaded() { // fn#60809, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7741:1114, offset: 0x01710637, size: 327 bytes, params: 1, frame: 20
var r6;
var r0;
var r1;
var r2;
var r4;
var r7;
var paymentSourceId;
var items2;
var item3;
var item4;
var hasPaymentSourceForSKUIds;
var value8;
var value9;
let value = a0;
const value2 = a1;
const value3 = undefined;
reducibleJoin2: while (true) {
if (value !== value3) {
r6 = value;
break reducibleJoin2;
}
value = environment;
items2 = [];
arraySpread(items2, ACTIVE_PREMIUM_SKUS, 0, undefined);
r6 = items2;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (value2 !== value3) {
r0 = value2;
break reducibleJoin4;
}
value = environment;
r0 = [PaymentSourceStore, SubscriptionPlanStore, SubscriptionStore];
break reducibleJoin4;
}
const iterator = r0[Symbol.iterator]();
const iterator2 = iterator.next;
let item2 = Reflect.apply(iterator2, iterator, []);
let item = item2.value;
item2 = item2.done ? undefined : iterator;
r0 = item2 === value3 ? value3 : item;
reducibleJoin7: while (true) {
if (value) {
r1 = item2;
r2 = value;
r4 = value3;
break reducibleJoin7;
}
item3 = Reflect.apply(iterator2, item2, []);
item = item3.value;
item3 = item3.done ? undefined : item2;
value = item3 === value3;
if (value) {
r1 = item3;
r2 = value;
r4 = value3;
break reducibleJoin7;
}
r1 = item3;
r2 = value;
r4 = item;
break reducibleJoin7;
}
reducibleJoin9: while (true) {
if (r2) {
r7 = value3;
break reducibleJoin9;
}
item4 = Reflect.apply(iterator2, r1, []);
item = item4.value;
item4 = item4.done ? undefined : r1;
value = item4 === value3;
if (value) {
r1 = item4;
r2 = value;
r7 = value3;
break reducibleJoin9;
}
r1 = item4;
r2 = value;
r7 = item;
break reducibleJoin9;
}
reducibleJoin11: while (true) {
if (r2) {
break reducibleJoin11;
}
r1.return();
break reducibleJoin11;
}
const paymentSourceIds = r0.paymentSourceIds;
const defaultPaymentSourceId = r0.defaultPaymentSourceId;
value = r4.isLoadedForSKUs(r6);
const premiumTypeSubscription = r7.getPremiumTypeSubscription();
reducibleJoin13: while (true) {
if (premiumTypeSubscription == null) {
paymentSourceId = value3;
break reducibleJoin13;
}
paymentSourceId = premiumTypeSubscription.paymentSourceId;
break reducibleJoin13;
}
if (paymentSourceId != null) {
hasPaymentSourceForSKUIds = r4.hasPaymentSourceForSKUIds;
reducibleJoin16: while (true) {
if (!Reflect.apply(hasPaymentSourceForSKUIds, r4, [paymentSourceId, r6])) {
return false;
}
break reducibleJoin16;
}
}
if (defaultPaymentSourceId != null) {
hasPaymentSourceForSKUIds = r4.hasPaymentSourceForSKUIds;
reducibleJoin19: while (true) {
if (!Reflect.apply(hasPaymentSourceForSKUIds, r4, [defaultPaymentSourceId, r6])) {
return false;
}
break reducibleJoin19;
}
}
const value6 = _createForOfIteratorHelperLoose_60806(paymentSourceIds);
const value7 = value6();
let done = value7.done;
if (!done) {
r2 = value7;
reducibleLoop20: while (true) {
value8 = r2.value;
hasPaymentSourceForSKUIds = r4.hasPaymentSourceForSKUIds;
if (!Reflect.apply(hasPaymentSourceForSKUIds, r4, [value8, r6])) {
return false;
}
value9 = value6();
done = value9.done;
if (done) {
return value;
}
r2 = value9;
continue reducibleLoop20;
}
}
return value;
}
function useSubscriptionPlansLoaded() { // fn#60810, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7741:1680, offset: 0x0171077e, size: 116 bytes, params: 1, frame: 17
var r5;
var items2;
const value = a0;
if (value !== undefined) {
r5 = value;
} else {
items2 = [];
arraySpread(items2, ACTIVE_PREMIUM_SKUS, 0, undefined);
r5 = items2;
}
return (FluxModule).useStateFromStores([PaymentSourceStore,
SubscriptionPlanStore, SubscriptionStore], _fun60811, [r5]);
function _fun60811() { // fn#60811, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7741:1770, offset: 0x017107f2, size: 52 bytes, params: 1, frame: 14
return getSubscriptionPlansLoaded(env0_0, [PaymentSourceStore, SubscriptionPlanStore, SubscriptionStore]);
}
}
}
global.__d(_fun60805, 7563, [3805, 3807, 3808, 1880, 3, 566,
2]) /* metro module 7563, dependencies: [3805, 3807, 3808, 1880, 3, 566, 2] */;