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

171 lines
5.5 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 6128
// Function ID: 6129
2026-07-20 16:05:17 +00:00
// Name: useGiftCardMobileConsumptionHalfsheet
2026-08-25 06:04:03 +00:00
// Dependencies: [32, 19, 6129, 4046, 1388, 505, 6130, 589, 1377, 6131, 4725, 709, 6135, 2009, 4347, 2]
2026-07-20 16:05:17 +00:00
// Exports: useGiftCardMobileConsumptionHalfsheet
2026-08-25 06:04:03 +00:00
// Module 6128 (useGiftCardMobileConsumptionHalfsheet)
2026-08-24 06:08:38 +00:00
import closure_3 from "_slicedToArray" /* 32 */;
import closure_4 from "noop" /* 19 */;
2026-08-25 06:04:03 +00:00
import closure_5 from "set" /* 6129 */;
import closure_6 from "handlePaymentSourceUpdate" /* 4046 */;
2026-08-24 06:08:38 +00:00
import { ContentDismissActionType } from "ContentDismissActionType" /* 1388 */;
import { PaymentSourceTypes } from "sum" /* 505 */;
2026-07-21 22:01:30 +00:00
2026-07-23 10:11:24 +00:00
const require = arg1;
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" };
2026-08-24 06:08:38 +00:00
let Idle = obj.Idle;
2026-07-29 08:29:29 +00:00
const result = require("set").fileFinishedImporting("modules/checkout/native/useGiftCardMobileConsumptionHalfsheet.tsx");
2026-07-20 16:05:17 +00:00
export const useGiftCardMobileConsumptionHalfsheet = function useGiftCardMobileConsumptionHalfsheet() {
2026-08-25 06:04:03 +00:00
enabled = enabled(6130).useGiftCardsExperimentConfig({ location: "useGiftCardMobileConsumptionHalfsheet" }).enabled;
obj = enabled(6130);
2026-07-29 08:29:29 +00:00
let tmp = enabled;
2026-07-23 10:11:24 +00:00
let items = [callback];
let items1 = [enabled];
2026-07-29 08:29:29 +00:00
const stateFromStores = enabled(589).useStateFromStores(items, () => {
2026-07-20 16:05:17 +00:00
if (enabled) {
const _Object = Object;
const values = Object.values(callback.paymentSources);
2026-07-29 08:29:29 +00:00
for (const item10013 of values) {
let tmp7 = item10013;
2026-08-24 06:08:38 +00:00
let tmp8 = closure_1_8;
if (item10013.type === closure_1_8.TDS_WALLET) {
2026-07-29 08:29:29 +00:00
let tmp9 = obj;
obj.return();
return item10013.id;
2026-07-20 16:05:17 +00:00
}
}
return null;
} else {
return null;
}
}, items1);
2026-07-29 08:29:29 +00:00
let obj2 = enabled(589);
2026-08-24 06:08:38 +00:00
const items2 = [closure_5];
2026-07-20 16:05:17 +00:00
const items3 = [stateFromStores];
2026-07-29 08:29:29 +00:00
const stateFromStores1 = enabled(589).useStateFromStores(items2, () => {
2026-07-20 16:05:17 +00:00
let balance = null;
if (null != stateFromStores) {
2026-07-29 08:29:29 +00:00
balance = ref.getBalance(tmp);
2026-07-20 16:05:17 +00:00
}
return balance;
}, items3);
2026-07-29 08:29:29 +00:00
const obj3 = enabled(589);
2026-08-24 06:08:38 +00:00
const items4 = [closure_5];
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(589).useStateFromStores(items4, () => {
2026-07-20 16:05:17 +00:00
let isFetching = null != stateFromStores;
if (isFetching) {
2026-07-29 08:29:29 +00:00
isFetching = ref.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];
2026-07-20 16:05:17 +00:00
const memo = React.useMemo(() => {
2026-08-24 06:08:38 +00:00
if (dependencyMap) {
const items = [enabled(1377).DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET];
2026-07-20 16:05:17 +00:00
let items1 = items;
} else {
items1 = [];
}
return items1;
}, items6);
2026-07-29 08:29:29 +00:00
const obj4 = enabled(589);
2026-08-25 06:04:03 +00:00
const tmp10 = first(tmp(6131).useSelectedDismissibleContent(memo, undefined, true), 2);
2026-07-29 08:29:29 +00:00
first = tmp10[0];
React = tmp12;
2026-08-24 06:08:38 +00:00
closure_5 = React.useRef(tmp12);
2026-07-29 08:29:29 +00:00
const items7 = [tmp10[1]];
2026-07-20 16:05:17 +00:00
const effect = React.useEffect(() => {
2026-08-24 06:08:38 +00:00
closure_5.current = closure_4;
2026-07-20 16:05:17 +00:00
}, items7);
2026-07-29 08:29:29 +00:00
callback = React.useCallback((AUTO_DISMISS) => {
ref.current(AUTO_DISMISS);
2026-07-20 16:05:17 +00:00
}, []);
const items8 = [enabled];
const effect1 = React.useEffect(() => {
if (enabled) {
2026-08-25 06:04:03 +00:00
const paymentSources = enabled(4725).fetchPaymentSources();
obj = enabled(4725);
2026-07-20 16:05:17 +00:00
}
}, items8);
const items9 = [stateFromStores];
const effect2 = React.useEffect(() => {
if (null != stateFromStores) {
2026-08-25 06:04:03 +00:00
const walletInformation = enabled(4725).fetchWalletInformation(tmp);
obj = enabled(4725);
2026-07-20 16:05:17 +00:00
}
}, items9);
const items10 = [first, callback];
const effect3 = React.useEffect(() => {
function handleShow(key) {
2026-07-23 10:11:24 +00:00
let tmp = c0;
if (!c0) {
2026-08-24 06:08:38 +00:00
tmp = key.key !== closure_1_9;
2026-07-20 16:05:17 +00:00
}
if (!tmp) {
2026-08-24 06:08:38 +00:00
Idle = closure_1_10.Opened;
2026-07-20 16:05:17 +00:00
}
}
2026-08-24 06:08:38 +00:00
if (first === enabled(1377).DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) {
if (Opening === closure_1_10.Idle) {
Opening = closure_1_10.Opening;
c0 = false;
obj = stateFromStores(709);
2026-07-20 16:05:17 +00:00
const subscription = obj.subscribe("SHOW_ACTION_SHEET", handleShow);
2026-08-25 06:04:03 +00:00
const promise = enabled(2009)(6135, 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) {
2026-08-24 06:08:38 +00:00
tmp = Idle !== closure_1_10.Opening;
2026-07-20 16:05:17 +00:00
}
if (!tmp) {
2026-08-24 06:08:38 +00:00
Idle = closure_1_10.Idle;
2026-07-20 16:05:17 +00:00
}
});
2026-08-25 06:04:03 +00:00
const obj2 = stateFromStores(4347);
2026-07-29 08:29:29 +00:00
obj = { markAsDismissed: null };
obj[0] = callback;
2026-08-24 06:08:38 +00:00
obj2.openLazy(promise, closure_1_9, obj, "stack");
2026-07-20 16:05:17 +00:00
return () => {
2026-08-24 06:08:38 +00:00
c0 = true;
handleShow(closure_1_2[11]).unsubscribe("SHOW_ACTION_SHEET", handleShow);
if (Idle === closure_1_10.Opening) {
Idle = closure_1_10.Idle;
2026-07-20 16:05:17 +00:00
}
};
}
}
}, items10);
const items11 = [first];
const effect4 = React.useEffect(() => {
function handleHide(key) {
2026-08-24 06:08:38 +00:00
if (key.key === closure_1_9) {
ref.current(closure_1_7.USER_DISMISS);
2026-07-20 16:05:17 +00:00
}
}
2026-08-24 06:08:38 +00:00
if (first === enabled(1377).DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) {
const subscription = stateFromStores(709).subscribe("HIDE_ACTION_SHEET", handleHide);
2026-07-20 16:05:17 +00:00
return () => {
2026-07-23 10:11:24 +00:00
stateFromStores(table[11]).unsubscribe("HIDE_ACTION_SHEET", handleHide);
2026-07-20 16:05:17 +00:00
};
}
}, items11);
};