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

143 lines
5.5 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 12035
// Function ID: 12036
2026-07-20 16:05:17 +00:00
// Name: useOrbCheckoutModalContextProvider
2026-08-24 06:08:38 +00:00
// Dependencies: [19, 1922, 4526, 21, 514, 589, 4042, 10520, 7243, 10416, 5317, 4057, 9293, 2]
2026-07-20 16:05:17 +00:00
// Exports: OrbCheckoutModalContextProvider, useOrbCheckoutModalContext
2026-08-24 06:08:38 +00:00
// Module 12035 (useOrbCheckoutModalContextProvider)
import set from "set" /* 2 */;
import jsxProd from "jsxProd" /* 21 */;
import noop from "noop" /* 19 */;
import closure_6 from "mergeGuildAvatar" /* 1922 */;
import closure_7 from "addSku" /* 4526 */;
import v1 from "v1" /* 514 */;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
function useOrbCheckoutModalContextProvider(value) {
const skuId = value.skuId;
const loadId = value.loadId;
const onCheckoutSuccess = value.onCheckoutSuccess;
let stateFromStores;
2026-07-20 16:05:17 +00:00
let sKUOrbPrice;
2026-07-23 10:11:24 +00:00
let callback2;
let redeemVirtualCurrency;
2026-07-29 08:29:29 +00:00
({ onSignFailure, order } = value);
2026-07-23 10:11:24 +00:00
let obj = skuId(onCheckoutSuccess[5]);
const items = [redeemVirtualCurrency];
2026-07-29 08:29:29 +00:00
stateFromStores = obj.useStateFromStores(items, () => loadId(onCheckoutSuccess[6]).canUseShopDiscounts(redeemVirtualCurrency.getCurrentUser()));
2026-08-24 06:08:38 +00:00
obj1 = skuId(onCheckoutSuccess[5]);
const items1 = [closure_7];
2026-07-20 16:05:17 +00:00
const items2 = [skuId];
2026-08-24 06:08:38 +00:00
const stateFromStores1 = obj1.useStateFromStores(items1, () => closure_1_7.get(skuId), items2);
2026-07-20 16:05:17 +00:00
let productLine = null;
if (null != stateFromStores1) {
productLine = stateFromStores1.productLine;
}
let applicationId;
2026-07-29 08:29:29 +00:00
if (stateFromStores1 != null) {
2026-07-20 16:05:17 +00:00
applicationId = stateFromStores1.applicationId;
}
2026-07-29 08:29:29 +00:00
if (applicationId == null) {
let tmpResult = tmp(tmp2[7]);
applicationId = tmpResult.get1PShopApplicationIdForSKU(skuId);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmpResult = tmp(tmp2[8]);
sKUOrbPrice = tmpResult.useSKUOrbPrice({ sku: stateFromStores1 });
2026-07-23 10:11:24 +00:00
const product = skuId(onCheckoutSuccess[9]).useFetchCollectiblesProduct(skuId).product;
callback2 = product;
2026-07-20 16:05:17 +00:00
const items3 = [sKUOrbPrice, product, stateFromStores];
2026-07-23 10:11:24 +00:00
const tmp8 = callback2(() => {
2026-07-20 16:05:17 +00:00
if (null != sKUOrbPrice) {
2026-07-29 08:29:29 +00:00
let obj = { orbPriceAmount: null };
obj[0] = tmp.amount;
2026-07-20 16:05:17 +00:00
return obj;
2026-07-23 10:11:24 +00:00
} else if (null != c5) {
2026-07-20 16:05:17 +00:00
obj = skuId(onCheckoutSuccess[10]);
2026-07-29 08:29:29 +00:00
obj = { product: null, hasShopDiscount: null };
obj[0] = tmp2;
obj[1] = stateFromStores;
2026-07-20 16:05:17 +00:00
const productOrbPrice = obj.getProductOrbPrice(obj);
let amount = null;
if (null !== productOrbPrice) {
amount = productOrbPrice.amount;
}
2026-08-24 06:08:38 +00:00
obj1 = { orbPriceAmount: null };
2026-07-29 08:29:29 +00:00
obj1[0] = amount;
2026-07-20 16:05:17 +00:00
return obj1;
} else {
return null;
}
}, items3);
let orbPriceAmount;
2026-07-29 08:29:29 +00:00
if (tmp8 != null) {
2026-07-20 16:05:17 +00:00
orbPriceAmount = tmp8.orbPriceAmount;
}
if (null == orbPriceAmount) {
2026-07-29 08:29:29 +00:00
obj = { tags: null };
obj = { sku_id: null };
obj[0] = skuId;
obj[0] = obj;
const result = tmp(tmp2[11]).captureBillingMessage("Orb price not found for product", obj);
const tmpResult2 = tmp(tmp2[11]);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const tmpResult1 = skuId(onCheckoutSuccess[9]);
2026-07-23 10:11:24 +00:00
redeemVirtualCurrency = skuId(onCheckoutSuccess[12]).useRedeemVirtualCurrency({ skuId, loadId, order, onSignFailure });
2026-07-20 16:05:17 +00:00
redeemVirtualCurrency = redeemVirtualCurrency.redeemVirtualCurrency;
const items4 = [skuId, loadId, redeemVirtualCurrency, onCheckoutSuccess];
({ isSubmitting, error } = redeemVirtualCurrency);
obj1 = {
skuId,
skuProductLine: productLine,
skuApplicationId: applicationId,
loadId,
orbProductContext: tmp8,
onRedeemVirtualCurrency: sKUOrbPrice((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-29 08:29:29 +00:00
redeemVirtualCurrency(closure_0, loadId, (arg0) => {
2026-08-24 06:08:38 +00:00
if (closure_1_2 != null) {
2026-07-29 08:29:29 +00:00
const obj = { entitlements: null, skuId: null };
obj[0] = arg0;
obj[1] = callback;
tmp(obj);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
callback(arg0);
2026-07-20 16:05:17 +00:00
});
}, items4),
isRedeeming: isSubmitting,
orbRedemptionError: error
};
return obj1;
}
2026-07-29 08:29:29 +00:00
({ useContext: c3, useCallback: c4, useMemo: c5, createContext } = noop);
2026-08-24 06:08:38 +00:00
const jsx = jsxProd.jsx;
2026-08-10 06:55:34 +00:00
let obj = { skuId: "123", skuProductLine: null, skuApplicationId: "r", loadId: "ct", analyticsLocations: null, analyticsSourceLocation: null, isRedeeming: null, orbRedemptionError: "lg", orbProductContext: null, onRedeemVirtualCurrency: true };
2026-07-29 08:29:29 +00:00
obj[3] = v1.v4();
obj[4] = [];
obj[9] = function onRedeemVirtualCurrency() {
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
let closure_9 = createContext(obj);
2026-08-24 06:08:38 +00:00
let result = set.fileFinishedImporting("modules/virtual_currency/checkout/OrbCheckoutModalContext.tsx");
2026-07-20 16:05:17 +00:00
export { useOrbCheckoutModalContextProvider };
export const OrbCheckoutModalContextProvider = function OrbCheckoutModalContextProvider(onCheckoutSuccess) {
({ skuId, loadId, analyticsLocations } = onCheckoutSuccess);
2026-07-29 08:29:29 +00:00
let value = { skuId, loadId, onCheckoutSuccess: onCheckoutSuccess.onCheckoutSuccess };
2026-07-20 16:05:17 +00:00
({ analyticsSourceLocation, children } = onCheckoutSuccess);
2026-07-29 08:29:29 +00:00
const tmp = useOrbCheckoutModalContextProvider(value);
value = { skuId, skuProductLine: tmp.skuProductLine, skuApplicationId: tmp.skuApplicationId, loadId, analyticsLocations: null, analyticsSourceLocation: null, orbProductContext: null, onRedeemVirtualCurrency: null, isRedeeming: null, orbRedemptionError: null };
2026-07-20 16:05:17 +00:00
({ orbProductContext, onRedeemVirtualCurrency, isRedeeming, orbRedemptionError } = tmp);
2026-07-29 08:29:29 +00:00
if (analyticsLocations == null) {
2026-07-20 16:05:17 +00:00
analyticsLocations = [];
}
2026-07-29 08:29:29 +00:00
value[4] = analyticsLocations;
value[5] = analyticsSourceLocation;
value[6] = orbProductContext;
value[7] = onRedeemVirtualCurrency;
value[8] = isRedeeming;
value[9] = orbRedemptionError;
return <redux.Provider value={value}>{children}</redux.Provider>;
2026-07-20 16:05:17 +00:00
};
export const useOrbCheckoutModalContext = function useOrbCheckoutModalContext() {
return callback(closure_9);
};