Files
discord-decomp/modules/payments/utils/BillingStandaloneUtils.tsx
T
2026-11-01 12:12:55 +02:00

71 lines
2.1 KiB
TypeScript

// Metro module 6555 (f6556).
import { Endpoints, Routes } from "../../../Constants";
import URLUtils from "../../../utils/URLUtils";
import { v4 } from "../../../_bundle/Module514";
import { HTTP } from "../../../_bundle/sendRequest";
function $mk78788($env) {
return (a0) => {
const r1 = $env;
return (0, r1[1])(a0, r1[3]);
};
}
function $mk78789($env) {
return (a0) => {
const r1 = $env;
return (0, r1[2])(a0, r1[0]);
};
}
const goToStandalonePremiumCheckout = function goToStandalonePremiumCheckout(a0, a1, a2) {
let env15793;
const r10 = Routes.BILLING_STANDALONE_CHECKOUT_PAGE(a0.planId, a0.isGift, a0.loadId, a0.paymentMethodType, a0.deepLinkType, a0.usePresetOffer, a0.flowType);
const r21 = env15793 = {};
env15793[0] = r10;
env15793[1] = a1;
env15793[2] = a2;
env15793[3] = void 0;
const uRL = new URL(URLUtils.makeUrl(Routes.BILLING_LOGIN_HANDOFF, false));
env15793[3] = uRL;
const key = v4();
uRL.searchParams.append("handoff_key", key);
uRL.searchParams.append("redirect_to", r10);
const r52 = HTTP.post({
url: Endpoints.HANDOFF,
body: {
key
},
oldFormErrors: true,
rejectWithError: false
});
const r54 = $mk78789(r21);
return r52.then($mk78788(r21), r54);
};
export function goToBillingStandalonePageWithHandoff(a0, a1, a2) {
let env15792;
const r2 = env15792 = {};
env15792[0] = a0;
env15792[1] = a1;
env15792[2] = a2;
const uRL = new URL(URLUtils.makeUrl(Routes.BILLING_LOGIN_HANDOFF, false));
env15792[3] = uRL;
const key = v4();
uRL.searchParams.append("handoff_key", key);
uRL.searchParams.append("redirect_to", a0);
const r43 = HTTP.post({
url: Endpoints.HANDOFF,
body: {
key
},
oldFormErrors: true,
rejectWithError: false
});
const r45 = $mk78789(r2);
return r43.then($mk78788(r2), r45);
}
export { goToStandalonePremiumCheckout };
export function goToStandalonePremiumCheckoutWeb(a0, a1) {
return goToStandalonePremiumCheckout(a0, (a0, a1) => {
a1.searchParams.append("handoff_token", a0.body.handoff_token);
window.open(a1.href);
}, a1);
}