112 lines
4.6 KiB
TypeScript
112 lines
4.6 KiB
TypeScript
// Metro module 6552 (f6553).
|
|
import { SubscriptionStatusTypes } from "../../../../Constants";
|
|
import { PaymentGatewayToFriendlyName } from "../../../../_bundle/Module505";
|
|
import Logger from "../../../debug/Logger";
|
|
import AlertActionCreators from "../../../../actions/native/AlertActionCreators";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
import { isIOS } from "../../../../utils/PlatformUtils";
|
|
import { isMetaQuest } from "../../../device/MetaQuestUtils.android";
|
|
import { goToStandaloneNitroManagementFromMobileApp } from "../../../payments/native/utils/BillingStandaloneNativeUtils";
|
|
import { LinkButton } from "../components/LinkButton";
|
|
let c4213_6, c4213_7, defaultMobileWebNitroManagementFailureCallback;
|
|
const defaultMobileWebNitroManagementSuccessCallback = function defaultMobileWebNitroManagementSuccessCallback() {
|
|
return c4213_6.log("Successfully opened mobile web Nitro Management page");
|
|
};
|
|
defaultMobileWebNitroManagementFailureCallback = function defaultMobileWebNitroManagementFailureCallback(a0) {
|
|
c4213_6.error("Failed to open mobile web Nitro Management page, error response: ", a0);
|
|
AlertActionCreators.show({
|
|
title: intl.string(t.NrBVjw),
|
|
body: intl.string(t["gD+grx"]),
|
|
hideActionSheet: true
|
|
});
|
|
};
|
|
c4213_6 = new Logger("PremiumManagementUtils");
|
|
const r32 = {
|
|
PREMIUM_MANAGEMENT: "premium_management"
|
|
};
|
|
c4213_7 = {
|
|
IN_APP: "manage_in_app",
|
|
IN_EXTERNAL_MOBILE_PAYMENT_GATEWAY: "manage_in_external_mobile_payment_gateway",
|
|
IN_WEB: "manage_in_web"
|
|
};
|
|
export { r32 as MobileWebDestinationTypes };
|
|
export { c4213_7 as PremiumManagementMethod };
|
|
export function getPremiumManagementMethod(a0) {
|
|
let IN_APP;
|
|
const r1 = a0 == null;
|
|
let r2 = null;
|
|
if (!r1) {
|
|
L8: {
|
|
if (a0.isOnPlatformMatchingExternalPaymentGateway) {
|
|
IN_APP = c4213_7.IN_APP;
|
|
} else {
|
|
if (a0.isPurchasedExternally && a0.paymentGateway != null) {
|
|
IN_APP = c4213_7.IN_EXTERNAL_MOBILE_PAYMENT_GATEWAY;
|
|
break L8;
|
|
}
|
|
IN_APP = c4213_7.IN_WEB;
|
|
}
|
|
}
|
|
r2 = IN_APP;
|
|
}
|
|
return r2;
|
|
}
|
|
export function getExternalManagementMessage(a0, r6 = null) {
|
|
let IN_APP;
|
|
let c15788_0 = r6;
|
|
const r0 = a0 == null;
|
|
let r12 = null;
|
|
if (!r0) {
|
|
L10: {
|
|
if (a0.isOnPlatformMatchingExternalPaymentGateway) {
|
|
IN_APP = c4213_7.IN_APP;
|
|
} else {
|
|
if (a0.isPurchasedExternally && a0.paymentGateway != null) {
|
|
IN_APP = c4213_7.IN_EXTERNAL_MOBILE_PAYMENT_GATEWAY;
|
|
break L10;
|
|
}
|
|
IN_APP = c4213_7.IN_WEB;
|
|
}
|
|
}
|
|
r12 = IN_APP;
|
|
}
|
|
if (r12 != null && r12 !== c4213_7.IN_APP) {
|
|
const mobilePlatform = isIOS() ? "iOS" : isMetaQuest() ? "Meta Quest" : "Android";
|
|
if (r12 === c4213_7.IN_EXTERNAL_MOBILE_PAYMENT_GATEWAY && a0 != null && a0.paymentGateway != null) {
|
|
return intl.formatToPlainString(t.cFZnqX, {
|
|
mobilePlatform,
|
|
externalPaymentGateway: PaymentGatewayToFriendlyName[a0.paymentGateway]
|
|
});
|
|
}
|
|
if (r12 === c4213_7.IN_WEB) {
|
|
L26: {
|
|
if (r6 != null && r6.shouldAllowExternalManagement) {
|
|
if (mobilePlatform !== "iOS" && !isMetaQuest()) {
|
|
break L26;
|
|
}
|
|
const status = a0?.status;
|
|
const r54 = status === SubscriptionStatusTypes.CANCELED || status === SubscriptionStatusTypes.PAUSE_PENDING || status === SubscriptionStatusTypes.PAST_DUE;
|
|
return r6.returnCtaAsComponent ? <LinkButton containerStyle={{
|
|
justifyContent: "flex-start"
|
|
}} onPress={() => c15788_0 != null ? goToStandaloneNitroManagementFromMobileApp("premium_external_management", {
|
|
loadId: c15788_0.loadId
|
|
}, c15788_0.onSuccessCallback != null ? c15788_0.onSuccessCallback : defaultMobileWebNitroManagementSuccessCallback, c15788_0.onFailureCallback != null ? c15788_0.onFailureCallback : defaultMobileWebNitroManagementFailureCallback) : void 0} text={intl.string(r54 ? t.tqSSSA : t["olSp/D"])} variant="text-sm/semibold" /> : intl.format(t.IERwUb, {
|
|
manageExternalNitroSubscription: function manageExternalNitroSubscription() {
|
|
if (c15788_0 != null) {
|
|
return goToStandaloneNitroManagementFromMobileApp("premium_external_management", {
|
|
loadId: c15788_0.loadId
|
|
}, c15788_0.onSuccessCallback != null ? c15788_0.onSuccessCallback : defaultMobileWebNitroManagementSuccessCallback, c15788_0.onFailureCallback != null ? c15788_0.onFailureCallback : defaultMobileWebNitroManagementFailureCallback);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
return intl.formatToPlainString(t.CnoyAN, {
|
|
mobilePlatform
|
|
});
|
|
}
|
|
return null;
|
|
}
|
|
return null;
|
|
}
|