decord/source/modules/checkout/native/useGiftCardMobileConsumptionHalfsheet.tsx

172 lines
5.8 KiB
TypeScript
Raw Normal View History

// Module ID: 7459
// Function ID: 7460
2026-07-20 16:05:17 +00:00
// Name: useGiftCardMobileConsumptionHalfsheet
// Dependencies: [32, 19, 7460, 4267, 1954, 1085, 7461, 504, 1943, 7462, 4931, 573, 7466, 1896, 4574, 2]
2026-07-20 16:05:17 +00:00
// Exports: useGiftCardMobileConsumptionHalfsheet
// Module 7459 (useGiftCardMobileConsumptionHalfsheet)
import DispatcherDefault from "Dispatcher" /* 573 */;
import asyncRequireImpl from "asyncRequireImpl" /* 1896 */;
import dismissible_content from "dismissible_content" /* 1943 */;
import ActionSheetActionCreatorsDefault from "ActionSheetActionCreators" /* 4574 */;
import actions_BillingActionCreators from "actions/BillingActionCreators" /* 4931 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
import WalletBalanceStore from "WalletBalanceStore" /* 7460 */;
import PaymentSourceStore from "PaymentSourceStore" /* 4267 */;
2026-07-21 22:01:30 +00:00
require = fn;
const ContentDismissActionType = fn(1954).ContentDismissActionType;
const PaymentSourceTypes = fn(1085).PaymentSourceTypes;
2026-07-29 08:29:29 +00:00
const GiftCardMobileConsumptionActionSheet = "GiftCardMobileConsumptionActionSheet";
2026-07-23 10:11:24 +00:00
let obj = { Idle: "idle", Opening: "opening", Opened: "opened" };
let Opening = obj.Idle;
const size = fn(2);
const result = size.fileFinishedImporting("modules/checkout/native/useGiftCardMobileConsumptionHalfsheet.tsx");
2026-07-20 16:05:17 +00:00
export const useGiftCardMobileConsumptionHalfsheet = function useGiftCardMobileConsumptionHalfsheet() {
enabled = enabled(7461).useGiftCardsExperimentConfig({ location: "useGiftCardMobileConsumptionHalfsheet" }).enabled;
obj = enabled(7461);
2026-07-29 08:29:29 +00:00
let tmp = enabled;
let items = [markAsDismissed];
2026-07-23 10:11:24 +00:00
let items1 = [enabled];
const stateFromStores = enabled(504).useStateFromStores(items, () => {
2026-07-20 16:05:17 +00:00
if (enabled) {
const _Object = Object;
const values = Object.values(PaymentSourceStore.paymentSources);
2026-07-29 08:29:29 +00:00
for (const item10013 of values) {
if (item10013.type === PaymentSourceTypes.TDS_WALLET) {
2026-07-29 08:29:29 +00:00
obj.return();
return item10013.id;
2026-07-20 16:05:17 +00:00
}
}
return null;
} else {
return null;
}
}, items1);
let obj2 = enabled(504);
const items2 = [ref];
2026-07-20 16:05:17 +00:00
const items3 = [stateFromStores];
const stateFromStores1 = enabled(504).useStateFromStores(items2, () => {
2026-07-20 16:05:17 +00:00
let balance = null;
if (null != stateFromStores) {
balance = WalletBalanceStore.getBalance(tmp);
2026-07-20 16:05:17 +00:00
}
return balance;
}, items3);
let obj3 = enabled(504);
const items4 = [ref];
2026-07-20 16:05:17 +00:00
const items5 = [stateFromStores];
2026-07-29 08:29:29 +00:00
let tmp6 = enabled;
const stateFromStores2 = enabled(504).useStateFromStores(items4, () => {
2026-07-20 16:05:17 +00:00
let isFetching = null != stateFromStores;
if (isFetching) {
isFetching = WalletBalanceStore.getIsFetching(tmp);
2026-07-20 16:05:17 +00:00
}
return isFetching;
}, items5);
if (enabled) {
2026-07-29 08:29:29 +00:00
tmp6 = null != stateFromStores;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp6) {
tmp6 = !stateFromStores2;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp6) {
tmp6 = null != stateFromStores1;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp6) {
tmp6 = stateFromStores1.amount > 0;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
dependencyMap = tmp6;
2026-07-29 08:29:29 +00:00
const items6 = [tmp6];
const memo = noop.useMemo(() => {
if (closure_2) {
const items = [dismissible_content.DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET];
2026-07-20 16:05:17 +00:00
let items1 = items;
} else {
items1 = [];
}
return items1;
}, items6);
const obj4 = enabled(504);
const tmp10 = first(tmp(7462).useSelectedDismissibleContent(memo, undefined, true), 2);
2026-07-29 08:29:29 +00:00
first = tmp10[0];
noop = tmp12;
ref = noop.useRef(tmp10[1]);
2026-07-29 08:29:29 +00:00
const items7 = [tmp10[1]];
const effect = noop.useEffect(() => {
closure_5.current = current;
2026-07-20 16:05:17 +00:00
}, items7);
markAsDismissed = noop.useCallback((AUTO_DISMISS) => {
2026-07-29 08:29:29 +00:00
ref.current(AUTO_DISMISS);
2026-07-20 16:05:17 +00:00
}, []);
const items8 = [enabled];
const effect1 = noop.useEffect(() => {
2026-07-20 16:05:17 +00:00
if (enabled) {
const paymentSources = actions_BillingActionCreators.fetchPaymentSources();
2026-07-20 16:05:17 +00:00
}
}, items8);
const items9 = [stateFromStores];
const effect2 = noop.useEffect(() => {
2026-07-20 16:05:17 +00:00
if (null != stateFromStores) {
const walletInformation = actions_BillingActionCreators.fetchWalletInformation(tmp);
2026-07-20 16:05:17 +00:00
}
}, items9);
const items10 = [first, markAsDismissed];
const effect3 = noop.useEffect(() => {
2026-07-20 16:05:17 +00:00
function handleShow(key) {
2026-07-23 10:11:24 +00:00
let tmp = c0;
if (!c0) {
tmp = key.key !== GiftCardMobileConsumptionActionSheet;
2026-07-20 16:05:17 +00:00
}
if (!tmp) {
Idle = obj.Opened;
2026-07-20 16:05:17 +00:00
}
}
if (first === dismissible_content.DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) {
if (Opening === obj.Idle) {
Opening = obj.Opening;
2026-08-24 06:08:38 +00:00
c0 = false;
obj = DispatcherDefault;
2026-07-20 16:05:17 +00:00
const subscription = obj.subscribe("SHOW_ACTION_SHEET", handleShow);
const promise = asyncRequireImpl(7466, dependencyMap.paths);
2026-07-20 16:05:17 +00:00
promise.catch(() => {
2026-07-23 10:11:24 +00:00
let tmp = c0;
if (!c0) {
tmp = Idle !== obj.Opening;
2026-07-20 16:05:17 +00:00
}
if (!tmp) {
Idle = obj.Idle;
2026-07-20 16:05:17 +00:00
}
});
const obj2 = ActionSheetActionCreatorsDefault;
const obj3 = { markAsDismissed };
obj2.openLazy(promise, GiftCardMobileConsumptionActionSheet, obj3, "stack");
2026-07-20 16:05:17 +00:00
return () => {
2026-08-24 06:08:38 +00:00
c0 = true;
stateFromStores(closure_2[11]).unsubscribe("SHOW_ACTION_SHEET", handleShow);
if (Idle === obj.Opening) {
Idle = obj.Idle;
2026-07-20 16:05:17 +00:00
}
};
}
}
}, items10);
const items11 = [first];
const effect4 = noop.useEffect(() => {
2026-07-20 16:05:17 +00:00
function handleHide(key) {
if (key.key === GiftCardMobileConsumptionActionSheet) {
ref.current(constants.USER_DISMISS);
2026-07-20 16:05:17 +00:00
}
}
if (first === enabled(closure_2[8]).DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) {
const subscription = stateFromStores(tmp[11]).subscribe("HIDE_ACTION_SHEET", handleHide);
2026-07-20 16:05:17 +00:00
return () => {
DispatcherDefault.unsubscribe("HIDE_ACTION_SHEET", handleHide);
2026-07-20 16:05:17 +00:00
};
}
tmp = closure_2;
2026-07-20 16:05:17 +00:00
}, items11);
};