decord/source/modules/virtual_currency/checkout/OrbCheckoutUtils.tsx

107 lines
4.3 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 7246
// Function ID: 7247
2026-07-20 16:05:17 +00:00
// Name: getOrbPriceFromPrices
2026-08-24 06:08:38 +00:00
// Dependencies: [676, 678, 7247, 1236, 7248, 4064, 2]
2026-07-20 16:05:17 +00:00
// Exports: getOrbCheckoutDisclaimerMessage, getOrbPriceFromPrices, resolveOrbCheckoutErrorMessage
2026-08-24 06:08:38 +00:00
// Module 7246 (getOrbPriceFromPrices)
import set from "set" /* 2 */;
import items2 from "items" /* 678 */;
import getSystemLocale from "getSystemLocale" /* 1236 */;
import ConstraintReasonCode2 from "ConstraintReasonCode" /* 7247 */;
import _signOrder from "_signOrder" /* 7248 */;
import ME from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
({ CurrencyCodes: obj1, MarketingURLs: c3, PriceSetAssignmentPurchaseTypes: c4 } = ME);
2026-08-24 06:08:38 +00:00
const EXTERNAL_PRODUCT_SKU_IDS = items2.EXTERNAL_PRODUCT_SKU_IDS;
const ConstraintReasonCode = ConstraintReasonCode2.ConstraintReasonCode;
const result = set.fileFinishedImporting("modules/virtual_currency/checkout/OrbCheckoutUtils.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const getOrbPriceFromPrices = function getOrbPriceFromPrices(prices, memo1) {
if (memo1) {
2026-07-20 16:05:17 +00:00
if (null != prices[closure_4.PREMIUM_TIER_2]) {
2026-07-29 08:29:29 +00:00
let tmp2 = prices[closure_4.PREMIUM_TIER_2];
2026-07-20 16:05:17 +00:00
}
let substr;
2026-07-29 08:29:29 +00:00
if (tmp2 != null) {
const countryPrices = tmp2.countryPrices;
if (countryPrices != null) {
2026-07-20 16:05:17 +00:00
prices = countryPrices.prices;
2026-07-29 08:29:29 +00:00
if (prices != null) {
2026-07-20 16:05:17 +00:00
substr = prices.slice(0, 2);
}
}
}
2026-07-29 08:29:29 +00:00
if (substr == null) {
2026-07-20 16:05:17 +00:00
substr = [];
}
2026-07-29 08:29:29 +00:00
let found = substr.find((currency) => currency.currency === constants.DISCORD_ORB);
if (found == null) {
found = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return found;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp2 = prices[closure_4.DEFAULT];
2026-07-20 16:05:17 +00:00
};
export const getOrbCheckoutDisclaimerMessage = function getOrbCheckoutDisclaimerMessage(skuId) {
2026-08-24 06:08:38 +00:00
const intl = getSystemLocale.intl;
2026-07-29 08:29:29 +00:00
const obj = { buyButtonLabel: null, paidServiceTermURL: null, virtualGoodsURL: null };
2026-08-24 06:08:38 +00:00
const intl2 = getSystemLocale.intl;
obj[0] = intl2.string(getSystemLocale.t["zLch/S"]);
2026-07-29 08:29:29 +00:00
({ PAID_TERMS: obj[1], PAID_TERMS_VIRTUAL_GOODS: obj[2] } = closure_3);
2026-08-24 06:08:38 +00:00
const intl3 = getSystemLocale.intl;
let stringResult = intl3.string(getSystemLocale.t["Sxed/G"]);
2026-07-20 16:05:17 +00:00
if (skuId === EXTERNAL_PRODUCT_SKU_IDS.ORB_PROFILE_BADGE) {
2026-07-29 08:29:29 +00:00
const intl5 = tmp(1236).intl;
stringResult = intl5.string(tmp(1236).t.APcKRo);
} else if (skuId === tmp5.FRACTIONAL_PREMIUM) {
const intl4 = tmp(1236).intl;
stringResult = intl4.string(tmp(1236).t.FhJ74j);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
const items = [intl.format(getSystemLocale.t["5qdUrO"], obj), " ", stringResult];
2026-07-20 16:05:17 +00:00
return items;
};
export const resolveOrbCheckoutErrorMessage = function resolveOrbCheckoutErrorMessage(code) {
if (null == code) {
return null;
} else {
2026-07-29 08:29:29 +00:00
let keFvXM = dependencyMap;
2026-08-24 06:08:38 +00:00
let OrderSigningFailedWithConstraintsError = _signOrder.OrderSigningFailedWithConstraintsError;
2026-07-29 08:29:29 +00:00
if (!(code instanceof OrderSigningFailedWithConstraintsError)) {
2026-08-24 06:08:38 +00:00
if (code instanceof tmp(7248).OrderProcessingPendingError) {
2026-07-29 08:29:29 +00:00
const intl5 = tmp(1236).intl;
let stringResult = intl5.string(tmp(1236).t["2BmwgV"]);
2026-08-24 06:08:38 +00:00
} else if (code.code === tmp(4064).ErrorCodes.VIRTUAL_CURRENCY_INSUFFICIENT_BALANCE) {
2026-07-29 08:29:29 +00:00
const intl4 = tmp(1236).intl;
stringResult = intl4.string(tmp(1236).t.keFvXM);
2026-08-24 06:08:38 +00:00
} else if (code.code === tmp(4064).ErrorCodes.ALREADY_PURCHASED) {
2026-07-29 08:29:29 +00:00
const intl3 = tmp(1236).intl;
stringResult = intl3.string(tmp(1236).t.m371Mx);
2026-08-24 06:08:38 +00:00
} else if (code.code === tmp(4064).ErrorCodes.BILLING_ORDER_NOT_SIGNABLE) {
2026-07-29 08:29:29 +00:00
const intl2 = tmp(1236).intl;
stringResult = intl2.string(tmp(1236).t.ZHgEG7);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const intl = tmp(1236).intl;
stringResult = intl.string(tmp(1236).t.fqJZ11);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
} else {
OrderSigningFailedWithConstraintsError = arg1;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (ConstraintReasonCode.INSUFFICIENT_ORB_BALANCE === OrderSigningFailedWithConstraintsError) {
const intl9 = tmp(1236).intl;
keFvXM = tmp(1236).t.keFvXM;
let stringResult1 = intl9.string(keFvXM);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
if (tmp3.SKU_ALREADY_OWNED === OrderSigningFailedWithConstraintsError) {
const intl8 = tmp(1236).intl;
stringResult1 = intl8.string(tmp(1236).t.m371Mx);
} else if (tmp3.BUNDLE_PARTIALLY_OWNED !== OrderSigningFailedWithConstraintsError) {
const intl6 = tmp(1236).intl;
stringResult1 = intl6.string(tmp(1236).t.fqJZ11);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const intl7 = tmp(1236).intl;
stringResult1 = intl7.string(tmp(1236).t.v9oC0p);
2026-07-20 16:05:17 +00:00
}
}
};