75 lines
3.4 KiB
TypeScript
75 lines
3.4 KiB
TypeScript
// Metro module 6553 (f6554).
|
|
import { CustomCheckoutFlow } from "../../PaymentConstants";
|
|
import { Routes } from "../../../../Constants";
|
|
import Logger from "../../../debug/Logger";
|
|
import { captureMobileWebRedirectCheckoutSentryError } from "../../utils/MobileWebRedirectCheckoutUtils";
|
|
import { goToStandalonePremiumCheckout, goToBillingStandalonePageWithHandoff } from "../../utils/BillingStandaloneUtils";
|
|
import * as _MetaQuestUtils_android from "../../../device/MetaQuestUtils.android";
|
|
import { LinkingTypes } from "../../../../ConstantsIOS";
|
|
import Linking from "../../../../lib/native/Linking";
|
|
let c4214_5;
|
|
const emitMWRCSentryErrorOnFailure = function emitMWRCSentryErrorOnFailure(args, a1, loadId) {
|
|
const [failure_response, destination_url] = args;
|
|
const extra = {
|
|
destination_url,
|
|
load_id: loadId
|
|
};
|
|
try {
|
|
c4214_5.error(`Failed to open mobile web popout to ${destination_url}, error response: `, failure_response);
|
|
captureMobileWebRedirectCheckoutSentryError(new Error("Mobile web redirect checkout mobile app to web popout failed"), a1, {
|
|
extra: {
|
|
failure_response,
|
|
...extra
|
|
}
|
|
});
|
|
} catch ($e) {
|
|
captureMobileWebRedirectCheckoutSentryError(new Error("Mobile web redirect checkout mobile app to web popout failed"), a1, {
|
|
extra
|
|
});
|
|
}
|
|
};
|
|
c4214_5 = new Logger("BillingStandaloneNativeUtils");
|
|
export function goToStandalonePremiumCheckoutFromMobileApp(c15789_0, a1, c15789_2, c15789_3) {
|
|
let r25;
|
|
let c15789_1 = a1;
|
|
const isMetaQuest = _MetaQuestUtils_android.isMetaQuest();
|
|
const r19 = {
|
|
...a1
|
|
};
|
|
if (isMetaQuest) {
|
|
r19.flowType = CustomCheckoutFlow.META_QUEST_WEB_REDIRECT_CHECKOUT;
|
|
r25 = r19;
|
|
} else {
|
|
r19.deepLinkType = LinkingTypes.MOBILE_WEB_REDIRECT_CHECKOUT;
|
|
r25 = r19;
|
|
}
|
|
return goToStandalonePremiumCheckout(r25, (a0, a1) => {
|
|
a1.searchParams.append("handoff_token", a0.body.handoff_token);
|
|
Linking.openURLExternally(a1.href);
|
|
c15789_2(a0, a1);
|
|
}, function(...args) {
|
|
emitMWRCSentryErrorOnFailure(args, c15789_0, c15789_1.loadId);
|
|
c15789_3.apply(void 0, [...args]);
|
|
});
|
|
}
|
|
export function goToStandaloneNitroManagementFromMobileApp(c15790_0, { loadId }, c15790_2, c15790_3) {
|
|
return goToBillingStandalonePageWithHandoff(_MetaQuestUtils_android.isMetaQuest() ? Routes.BILLING_MANAGE_SUBSCRIPTION_WITH_FLOW_TYPE(CustomCheckoutFlow.META_QUEST_WEB_REDIRECT_CHECKOUT, loadId) : Routes.BILLING_MANAGE_SUBSCRIPTION_WITH_DEEP_LINK(LinkingTypes.MOBILE_WEB_REDIRECT_CHECKOUT, loadId), (a0, a1) => {
|
|
a1.searchParams.append("handoff_token", a0.body.handoff_token);
|
|
Linking.openURLExternally(a1.href);
|
|
c15790_2(a0, a1);
|
|
}, function(...args) {
|
|
emitMWRCSentryErrorOnFailure(args, c15790_0, loadId);
|
|
c15790_3.apply(void 0, [...args]);
|
|
});
|
|
}
|
|
export function goToStandaloneGuildBoostCheckoutFromMobileApp(c15791_0, a1, a2, c15791_2, c15791_3) {
|
|
return goToBillingStandalonePageWithHandoff(Routes.BILLING_STANDALONE_GUILD_BOOST_CHECKOUT_PAGE(a1, _MetaQuestUtils_android.isMetaQuest() ? void 0 : LinkingTypes.MOBILE_WEB_REDIRECT_CHECKOUT, a2, _MetaQuestUtils_android.isMetaQuest() ? CustomCheckoutFlow.META_QUEST_WEB_REDIRECT_CHECKOUT : void 0), (a0, a1) => {
|
|
a1.searchParams.append("handoff_token", a0.body.handoff_token);
|
|
Linking.openURLExternally(a1.href);
|
|
c15791_2(a0, a1);
|
|
}, function(...args) {
|
|
emitMWRCSentryErrorOnFailure(args, c15791_0, a2);
|
|
c15791_3.apply(void 0, [...args]);
|
|
});
|
|
}
|