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

172 lines
5.5 KiB
TypeScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 5913
// Function ID: 5914
2026-07-20 16:05:17 +00:00
// Name: useGiftCardMobileConsumptionHalfsheet
2026-08-05 07:35:12 +00:00
// Dependencies: [32, 19, 5914, 3904, 1369, 505, 5915, 589, 1358, 5916, 4574, 709, 5920, 1959, 4223, 2]
2026-07-20 16:05:17 +00:00
// Exports: useGiftCardMobileConsumptionHalfsheet
2026-08-05 07:35:12 +00:00
// Module 5913 (useGiftCardMobileConsumptionHalfsheet)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
2026-07-29 08:29:29 +00:00
import noop from "noop";
import set from "set";
import handlePaymentSourceUpdate from "handlePaymentSourceUpdate";
2026-07-23 10:11:24 +00:00
import { ContentDismissActionType } from "ContentDismissActionType";
import { PaymentSourceTypes } from "sum";
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-07-20 16:05:17 +00:00
const 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-05 07:35:12 +00:00
enabled = enabled(5915).useGiftCardsExperimentConfig({ location: "useGiftCardMobileConsumptionHalfsheet" }).enabled;
let obj = enabled(5915);
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;
let tmp8 = outer1_8;
if (item10013.type === outer1_8.TDS_WALLET) {
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);
const items2 = [set];
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);
const items4 = [set];
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-07-29 08:29:29 +00:00
const dependencyMap = tmp6;
const items6 = [tmp6];
2026-07-20 16:05:17 +00:00
const memo = React.useMemo(() => {
2026-07-29 08:29:29 +00:00
if (tmp6) {
const items = [enabled(tmp6[8]).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-05 07:35:12 +00:00
const tmp10 = first(tmp(5916).useSelectedDismissibleContent(memo, undefined, true), 2);
2026-07-29 08:29:29 +00:00
first = tmp10[0];
React = tmp12;
set = React.useRef(tmp12);
const items7 = [tmp10[1]];
2026-07-20 16:05:17 +00:00
const effect = React.useEffect(() => {
2026-07-29 08:29:29 +00:00
set.current = noop;
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-07-29 08:29:29 +00:00
const paymentSources = enabled(tmp6[10]).fetchPaymentSources();
const obj = enabled(tmp6[10]);
2026-07-20 16:05:17 +00:00
}
}, items8);
const items9 = [stateFromStores];
const effect2 = React.useEffect(() => {
if (null != stateFromStores) {
2026-07-29 08:29:29 +00:00
const walletInformation = enabled(tmp6[10]).fetchWalletInformation(tmp);
const obj = enabled(tmp6[10]);
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-07-29 08:29:29 +00:00
tmp = key.key !== outer1_9;
2026-07-20 16:05:17 +00:00
}
if (!tmp) {
2026-07-29 08:29:29 +00:00
const outer1_11 = outer1_10.Opened;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if (first === enabled(tmp6[8]).DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) {
if (outer1_11 === outer1_10.Idle) {
outer1_11 = outer1_10.Opening;
2026-07-23 10:11:24 +00:00
let c0 = false;
2026-07-29 08:29:29 +00:00
let obj = stateFromStores(tmp2[11]);
2026-07-20 16:05:17 +00:00
const subscription = obj.subscribe("SHOW_ACTION_SHEET", handleShow);
2026-07-29 08:29:29 +00:00
const promise = enabled(tmp2[13])(tmp2[12], tmp2.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-07-29 08:29:29 +00:00
tmp = outer1_11 !== outer1_10.Opening;
2026-07-20 16:05:17 +00:00
}
if (!tmp) {
2026-07-29 08:29:29 +00:00
outer1_11 = outer1_10.Idle;
2026-07-20 16:05:17 +00:00
}
});
2026-07-29 08:29:29 +00:00
const obj2 = stateFromStores(tmp2[14]);
obj = { markAsDismissed: null };
obj[0] = callback;
obj2.openLazy(promise, outer1_9, obj, "stack");
2026-07-20 16:05:17 +00:00
return () => {
2026-07-23 10:11:24 +00:00
let c0 = true;
2026-07-29 08:29:29 +00:00
handleShow(outer1_2[11]).unsubscribe("SHOW_ACTION_SHEET", handleShow);
if (outer1_11 === outer1_10.Opening) {
outer1_11 = outer1_10.Idle;
2026-07-20 16:05:17 +00:00
}
};
}
}
}, items10);
const items11 = [first];
const effect4 = React.useEffect(() => {
function handleHide(key) {
2026-07-29 08:29:29 +00:00
if (key.key === outer1_9) {
ref.current(outer1_7.USER_DISMISS);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
if (first === enabled(tmp6[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 () => {
2026-07-23 10:11:24 +00:00
stateFromStores(table[11]).unsubscribe("HIDE_ACTION_SHEET", handleHide);
2026-07-20 16:05:17 +00:00
};
}
2026-07-29 08:29:29 +00:00
tmp = tmp6;
2026-07-20 16:05:17 +00:00
}, items11);
};