195 lines
11 KiB
TypeScript
195 lines
11 KiB
TypeScript
/* Metro module 15832; source: modules/premium/SubscriptionManager.tsx; dependencies: [5, 7, 6, 15, 17, 18, 1878, 3804, 3808, 5181, 1880, 1900, 4223, 5182, 4860, 2] */
|
|
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
|
|
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 UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import BillingInfoStore from '../../stores/billing/BillingInfoStore.tsx'; /* Metro dependency 3804 */
|
|
import SubscriptionStore from '../../stores/billing/SubscriptionStore.tsx'; /* Metro dependency 3808 */
|
|
import EntitlementStore from '../../stores/game_store/EntitlementStore.tsx'; /* Metro dependency 5181 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as PremiumConstantsModule from './PremiumConstants.tsx'; /* Metro dependency 1880 */
|
|
import * as PremiumTypeUtilsModule from '../../utils/PremiumTypeUtils.tsx'; /* Metro dependency 1900 */
|
|
|
|
function _fun121666(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#121666, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:6, offset: 0x0254d736, size: 338 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = PremiumConstantsModule;
|
|
const env0_12 = value.PREMIUM_SUBSCRIPTION_APPLICATION;
|
|
const env0_13 = value.PremiumTypes;
|
|
value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
|
|
value = _fun121670(value);
|
|
value = new value();
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/premium/SubscriptionManager.tsx');
|
|
exports.default = value;
|
|
function _isNativeReflectConstruct_121667() { // fn#121667, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:263, offset: 0x0254d888, size: 98 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_121667_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun121670(a0) { // fn#121670, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:466, offset: 0x0254d8ea, size: 42 bytes, params: 2, frame: 14
|
|
const SubscriptionManager2 = SubscriptionManager;
|
|
Inherits(SubscriptionManager2, a0);
|
|
return CreateClass(SubscriptionManager2);
|
|
function SubscriptionManager(a0) { // fn#121671, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:478, offset: 0x0254d914, size: 223 bytes, params: 2, frame: 21
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let binding = env1_4;
|
|
binding(this, SubscriptionManager);
|
|
const items2 = [];
|
|
arraySpread(items2, value, 0, items2);
|
|
value = env1_6(SubscriptionManager);
|
|
binding = env1_5;
|
|
if (_isNativeReflectConstruct_121667()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items2, env1_6(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items2);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
value.actions = {POST_CONNECTION_OPEN: POST_CONNECTION_OPEN_121672};
|
|
binding = env1_2;
|
|
value.maybeFetchSubscriptions = binding(_fun121674);
|
|
value.maybeFetchMostRecentSubscription = maybeFetchMostRecentSubscription;
|
|
value.maybeFetchCountryCode = binding(_fun121677);
|
|
value.fetchCountryCode = binding(_fun121679);
|
|
return value;
|
|
function SubscriptionManagerPOST_CONNECTION_OPEN() { // fn#121672, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:753, owner: SubscriptionManager.POST_CONNECTION_OPEN, offset: 0x0254d9f3, size: 41 bytes, params: 1, frame: 9
|
|
const binding = env0_0;
|
|
binding.maybeFetchSubscriptions();
|
|
binding.maybeFetchCountryCode();
|
|
binding.maybeFetchMostRecentSubscription();
|
|
}
|
|
|
|
function* _fun121674() { // fn#121674, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:880, offset: 0x0254da27, size: 260 bytes, params: 1, frame: 15
|
|
var r3;
|
|
var value6;
|
|
var premiumSubscription;
|
|
var value12;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__.__proto__;
|
|
let binding = env3_8;
|
|
const currentUser = binding.getCurrentUser();
|
|
const isSubscriptionFetching = env3_9.isSubscriptionFetching;
|
|
binding = env3_0;
|
|
const value4 = undefined;
|
|
const value5 = binding(env3_1[11]);
|
|
if (value5.isPremium(currentUser)) {
|
|
binding = env3_10;
|
|
r3 = binding.hasFetchedSubscriptions() || isSubscriptionFetching;
|
|
if (r3) {
|
|
binding = env3_10;
|
|
premiumSubscription = binding.getPremiumSubscription();
|
|
if ((premiumSubscription == null ? value4 : premiumSubscription.paymentSourceId) != null || env3_11.applicationIdsFetched.has(env3_12)) {
|
|
return value4;
|
|
}
|
|
binding = env3_0;
|
|
value12 = binding(env3_1[13]);
|
|
yield value12.fetchUserEntitlementsForApplication(env3_12);
|
|
return value4;
|
|
}
|
|
binding = env3_0;
|
|
value6 = binding(env3_1[12]);
|
|
yield value6.fetchSubscriptions();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
binding = env3_10;
|
|
premiumSubscription = binding.getPremiumSubscription();
|
|
r3 = (premiumSubscription == null ? value4 : premiumSubscription.paymentSourceId) != null || env3_11.applicationIdsFetched.has(env3_12);
|
|
if (r3) {
|
|
return value4;
|
|
}
|
|
binding = env3_0;
|
|
value12 = binding(env3_1[13]);
|
|
yield value12.fetchUserEntitlementsForApplication(env3_12);
|
|
}
|
|
return value4;
|
|
}
|
|
|
|
function maybeFetchMostRecentSubscription() { // fn#121675, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:1242, owner: SubscriptionManager.maybeFetchMostRecentSubscription, offset: 0x0254db2b, size: 169 bytes, params: 1, frame: 18
|
|
const value = environment.__proto__.__proto__;
|
|
const currentUser = UserStore.getCurrentUser();
|
|
const value3 = undefined;
|
|
const isPremiumAtMost = PremiumTypeUtilsModule.isPremiumAtMost;
|
|
const value4 = null;
|
|
const premiumType = value4 == currentUser ? value3 : currentUser.premiumType;
|
|
const r4 = value4 != premiumType ? premiumType : value4;
|
|
const TIER_1 = PremiumTypes.TIER_1;
|
|
if (value4 != currentUser && Reflect.apply(isPremiumAtMost, PremiumTypeUtilsModule, [r4,
|
|
TIER_1]) && currentUser.hasHadPremium() && !SubscriptionStore.getIsFetchingMostRecentSubscription()) {
|
|
(require(4223) /* metro dependency 4223: BillingActionCreators */).fetchMostRecentSubscription();
|
|
}
|
|
return value3;
|
|
}
|
|
|
|
function* _fun121677() { // fn#121677, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:1501, offset: 0x0254dbdf, size: 111 bytes, params: 1, frame: 14
|
|
if (true) {
|
|
value = environment.__proto__.__proto__.__proto__;
|
|
if (env3_0(env3_1[11]).isPremium(env3_8.getCurrentUser()) && !env3_9.ipCountryCodeLoaded) {
|
|
value = environment.__proto__;
|
|
yield SubscriptionManager.fetchCountryCode();
|
|
value = undefined;
|
|
return undefined;
|
|
}
|
|
}
|
|
}
|
|
|
|
function* _fun121679() { // fn#121679, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16040:1639, offset: 0x0254dc59, size: 117 bytes, params: 1, frame: 15
|
|
if (true) {
|
|
value = environment.__proto__.__proto__.__proto__;
|
|
var value3 = env3_0(env3_1[12]);
|
|
yield value3.fetchIpCountryCode();
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
if (env3_9.ipCountryCode == null) {
|
|
return undefined;
|
|
}
|
|
value = env3_0(env3_1[12]);
|
|
yield value.fetchPaymentSources();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun121666, 15832, [5, 7, 6, 15, 17, 18, 1878, 3804, 3808, 5181, 1880, 1900, 4223, 5182, 4860,
|
|
2]) /* metro module 15832, dependencies: [5, 7, 6, 15, 17, 18, 1878, 3804, 3808, 5181, 1880, 1900, 4223, 5182, 4860, 2] */;
|