212 lines
13 KiB
TypeScript
212 lines
13 KiB
TypeScript
/* Metro module 7022; source: modules/premium/native/utils/PremiumManagementUtils.tsx; dependencies: [661, 482, 33, 3, 4496, 1244, 477, 1581, 7023, 7025, 2] */
|
|
function _fun55645(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#55645, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7200:6, offset: 0x013acb19, size: 316 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = (require(661) /* metro dependency 661: Constants */).SubscriptionStatusTypes;
|
|
const env0_4 = (require(482) /* metro dependency 482: Constants */).PaymentGatewayToFriendlyName;
|
|
const env0_5 = (require(33) /* metro dependency 33 */).jsx;
|
|
let value = importDefault(3) /* metro dependency 3: Logger */;
|
|
value = new value('PremiumManagementUtils');
|
|
const closure = getPremiumManagementMethod;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/premium/native/utils/PremiumManagementUtils.tsx');
|
|
exports.MobileWebDestinationTypes = {PREMIUM_MANAGEMENT: 'premium_management'};
|
|
exports.PremiumManagementMethod = {IN_APP: 'manage_in_app',
|
|
IN_EXTERNAL_MOBILE_PAYMENT_GATEWAY: 'manage_in_external_mobile_payment_gateway', IN_WEB: 'manage_in_web'};
|
|
exports.getPremiumManagementMethod = closure;
|
|
exports.getExternalManagementMessage = getExternalManagementMessage;
|
|
}
|
|
|
|
function getPremiumManagementMethod(a0) { // fn#55646, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7200:480, offset: 0x013acc55, size: 90 bytes, params: 2, frame: 4
|
|
const value = null;
|
|
return value == a0 ? value : a0.isOnPlatformMatchingExternalPaymentGateway ? env0_7.IN_APP : a0.isPurchasedExternally && value != a0.paymentGateway ? env0_7.IN_EXTERNAL_MOBILE_PAYMENT_GATEWAY : env0_7.IN_WEB;
|
|
}
|
|
|
|
function defaultMobileWebNitroManagementSuccessCallback() { // fn#55647, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7200:691, offset: 0x013accaf, size: 26 bytes, params: 1, frame: 11
|
|
return env0_6.log('Successfully opened mobile web Nitro Management page');
|
|
}
|
|
|
|
function defaultMobileWebNitroManagementFailureCallback(a0) { // fn#55648, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7200:804, offset: 0x013accc9, size: 174 bytes, params: 2, frame: 19
|
|
env0_6.error('Failed to open mobile web Nitro Management page, error response: ', a0);
|
|
const defaultImport = importDefault(4496) /* metro dependency 4496: AlertActionCreators */;
|
|
const show = defaultImport.show;
|
|
const object2 = {};
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const string = intl.string;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
const NrBVjw = t.NrBVjw;
|
|
object2.title = Reflect.apply(string, intl, [NrBVjw]);
|
|
object2.body = intl.string(t['gD+grx']);
|
|
object2.hideActionSheet = true;
|
|
Reflect.apply(show, defaultImport, [object2]);
|
|
}
|
|
|
|
function getExternalManagementMessage(a0) { // fn#55649, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7200:1248, offset: 0x013acd77, size: 708 bytes, params: 2, frame: 24
|
|
var r1;
|
|
var r7;
|
|
var status;
|
|
var r9;
|
|
var moduleValue3;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
var closure;
|
|
const LinkButton = (require(7025) /* metro dependency 7025: LinkButton */).LinkButton;
|
|
const value = a1;
|
|
const value2 = undefined;
|
|
const env0_0 = value !== value2 ? value : null;
|
|
const premiumManagementMethod = getPremiumManagementMethod(a0);
|
|
if (premiumManagementMethod != null) {
|
|
var IN_APP = env0_7.IN_APP;
|
|
if (premiumManagementMethod === IN_APP) {
|
|
return null;
|
|
}
|
|
var isIOS2 = (require(477) /* metro dependency 477: PlatformUtils */).isIOS();
|
|
var value4 = 'iOS';
|
|
r7 = isIOS2 ? value4 : (require(1581) /* metro dependency 1581: MetaQuestUtilsAndroid */).isMetaQuest() ? 'Meta Quest' : 'Android';
|
|
var IN_EXTERNAL_MOBILE_PAYMENT_GATEWAY = env0_7.IN_EXTERNAL_MOBILE_PAYMENT_GATEWAY;
|
|
if (premiumManagementMethod !== IN_EXTERNAL_MOBILE_PAYMENT_GATEWAY) {
|
|
if (premiumManagementMethod === env0_7.IN_WEB) {
|
|
if (r1 == null) {
|
|
return intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.CnoyAN,
|
|
{mobilePlatform: r7});
|
|
}
|
|
if (r1.shouldAllowExternalManagement) {
|
|
if (value4 === r7) {
|
|
closure = manageExternalNitroSubscription;
|
|
status = a0 == null ? value2 : a0.status;
|
|
r9 = status === SubscriptionStatusTypes.CANCELED || status === SubscriptionStatusTypes.PAUSE_PENDING;
|
|
r9 = !r9 ? status === SubscriptionStatusTypes.PAST_DUE : r9;
|
|
r1 = r1.returnCtaAsComponent ? <LinkButton containerStyle={{justifyContent: 'flex-start'}} onPress={function() {
|
|
return manageExternalNitroSubscription();
|
|
}} text={intl.string(r9 ? t.tqSSSA : t['olSp/D'])} variant="text-sm/semibold" /> : intl.format((require(1244) /* metro dependency 1244: indexNative */).t.IERwUb,
|
|
|
|
|
|
|
|
|
|
|
|
{manageExternalNitroSubscription: closure});
|
|
return r1;
|
|
}
|
|
moduleValue3 = require(1581) /* metro dependency 1581: MetaQuestUtilsAndroid */;
|
|
if (moduleValue3.isMetaQuest()) {
|
|
closure = manageExternalNitroSubscription;
|
|
status = a0 == null ? value2 : a0.status;
|
|
r9 = status === SubscriptionStatusTypes.CANCELED || status === SubscriptionStatusTypes.PAUSE_PENDING;
|
|
r9 = !r9 ? status === SubscriptionStatusTypes.PAST_DUE : r9;
|
|
r1 = r1.returnCtaAsComponent ? <LinkButton containerStyle={{justifyContent: 'flex-start'}} onPress={onPress_55651} text={intl.string(r9 ? t.tqSSSA : t['olSp/D'])} variant="text-sm/semibold" /> : intl.format((require(1244) /* metro dependency 1244: indexNative */).t.IERwUb,
|
|
|
|
|
|
|
|
|
|
|
|
{manageExternalNitroSubscription: closure});
|
|
return r1;
|
|
}
|
|
return intl.formatToPlainString(t.CnoyAN, {mobilePlatform: r7});
|
|
}
|
|
return intl.formatToPlainString(t.CnoyAN, {mobilePlatform: r7});
|
|
}
|
|
return null;
|
|
}
|
|
if (a0 == null) {
|
|
if (premiumManagementMethod === env0_7.IN_WEB) {
|
|
if (r1 == null) {
|
|
return intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.CnoyAN,
|
|
{mobilePlatform: r7});
|
|
}
|
|
if (r1.shouldAllowExternalManagement) {
|
|
if (value4 === r7) {
|
|
closure = manageExternalNitroSubscription;
|
|
status = a0 == null ? value2 : a0.status;
|
|
r9 = status === SubscriptionStatusTypes.CANCELED || status === SubscriptionStatusTypes.PAUSE_PENDING;
|
|
r9 = !r9 ? status === SubscriptionStatusTypes.PAST_DUE : r9;
|
|
r1 = r1.returnCtaAsComponent ? <LinkButton containerStyle={{justifyContent: 'flex-start'}} onPress={function() {
|
|
return manageExternalNitroSubscription();
|
|
}} text={intl.string(r9 ? t.tqSSSA : t['olSp/D'])} variant="text-sm/semibold" /> : intl.format((require(1244) /* metro dependency 1244: indexNative */).t.IERwUb,
|
|
|
|
|
|
|
|
|
|
|
|
{manageExternalNitroSubscription: closure});
|
|
return r1;
|
|
}
|
|
moduleValue3 = require(1581) /* metro dependency 1581: MetaQuestUtilsAndroid */;
|
|
if (moduleValue3.isMetaQuest()) {
|
|
closure = manageExternalNitroSubscription;
|
|
status = a0 == null ? value2 : a0.status;
|
|
r9 = status === SubscriptionStatusTypes.CANCELED || status === SubscriptionStatusTypes.PAUSE_PENDING;
|
|
r9 = !r9 ? status === SubscriptionStatusTypes.PAST_DUE : r9;
|
|
r1 = r1.returnCtaAsComponent ? <LinkButton containerStyle={{justifyContent: 'flex-start'}} onPress={onPress_55651} text={intl.string(r9 ? t.tqSSSA : t['olSp/D'])} variant="text-sm/semibold" /> : intl.format((require(1244) /* metro dependency 1244: indexNative */).t.IERwUb,
|
|
|
|
|
|
|
|
|
|
|
|
{manageExternalNitroSubscription: closure});
|
|
return r1;
|
|
}
|
|
return intl.formatToPlainString(t.CnoyAN, {mobilePlatform: r7});
|
|
}
|
|
return intl.formatToPlainString(t.CnoyAN, {mobilePlatform: r7});
|
|
}
|
|
return null;
|
|
}
|
|
if (a0.paymentGateway != null) {
|
|
return intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.cFZnqX,
|
|
{mobilePlatform: r7, externalPaymentGateway: PaymentGatewayToFriendlyName[a0.paymentGateway]});
|
|
}
|
|
if (premiumManagementMethod === env0_7.IN_WEB) {
|
|
if (r1 == null) {
|
|
return intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.CnoyAN,
|
|
{mobilePlatform: r7});
|
|
}
|
|
if (r1.shouldAllowExternalManagement) {
|
|
if (value4 === r7) {
|
|
closure = manageExternalNitroSubscription;
|
|
status = a0 == null ? value2 : a0.status;
|
|
r9 = status === SubscriptionStatusTypes.CANCELED || status === SubscriptionStatusTypes.PAUSE_PENDING;
|
|
r9 = !r9 ? status === SubscriptionStatusTypes.PAST_DUE : r9;
|
|
r1 = r1.returnCtaAsComponent ? <LinkButton containerStyle={{justifyContent: 'flex-start'}} onPress={function() {
|
|
return manageExternalNitroSubscription();
|
|
}} text={intl.string(r9 ? t.tqSSSA : t['olSp/D'])} variant="text-sm/semibold" /> : intl.format((require(1244) /* metro dependency 1244: indexNative */).t.IERwUb,
|
|
|
|
|
|
|
|
|
|
{manageExternalNitroSubscription: closure});
|
|
return r1;
|
|
}
|
|
moduleValue3 = require(1581) /* metro dependency 1581: MetaQuestUtilsAndroid */;
|
|
if (moduleValue3.isMetaQuest()) {
|
|
closure = manageExternalNitroSubscription;
|
|
status = a0 == null ? value2 : a0.status;
|
|
r9 = status === SubscriptionStatusTypes.CANCELED || status === SubscriptionStatusTypes.PAUSE_PENDING;
|
|
r9 = !r9 ? status === SubscriptionStatusTypes.PAST_DUE : r9;
|
|
r1 = r1.returnCtaAsComponent ? <LinkButton containerStyle={{justifyContent: 'flex-start'}} onPress={onPress_55651} text={intl.string(r9 ? t.tqSSSA : t['olSp/D'])} variant="text-sm/semibold" /> : intl.format((require(1244) /* metro dependency 1244: indexNative */).t.IERwUb,
|
|
|
|
|
|
|
|
|
|
{manageExternalNitroSubscription: closure});
|
|
return r1;
|
|
}
|
|
return intl.formatToPlainString(t.CnoyAN, {mobilePlatform: r7});
|
|
}
|
|
return intl.formatToPlainString(t.CnoyAN, {mobilePlatform: r7});
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function manageExternalNitroSubscription() { // fn#55650, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7200:1773, owner: getExternalManagementMessage.manageExternalNitroSubscription, offset: 0x013ad03b, size: 133 bytes, params: 1, frame: 19
|
|
const billingStandaloneNativeUtilsModule = require(7023) /* metro dependency 7023: BillingStandaloneNativeUtils */;
|
|
const goToStandaloneNitroManagementFromMobileApp = billingStandaloneNativeUtilsModule.goToStandaloneNitroManagementFromMobileApp;
|
|
const binding = env0_0;
|
|
return Reflect.apply(goToStandaloneNitroManagementFromMobileApp, billingStandaloneNativeUtilsModule,
|
|
['premium_external_management', {loadId: binding.loadId},
|
|
binding.onSuccessCallback != null ? env0_0.onSuccessCallback : defaultMobileWebNitroManagementSuccessCallback,
|
|
env0_0.onFailureCallback ?? defaultMobileWebNitroManagementFailureCallback]);
|
|
}
|
|
|