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

166 lines
5.6 KiB
TypeScript
Raw Normal View History

2026-07-23 10:11:24 +00:00
// Module ID: 5799
2026-07-24 07:16:23 +00:00
// Function ID: 49577
2026-07-20 16:05:17 +00:00
// Name: useGiftCardMobileConsumptionHalfsheet
2026-07-23 10:11:24 +00:00
// Dependencies: [57, 31, 5800, 3779, 1345, 482, 5801, 566, 1334, 5802, 4451, 686, 5806, 1934, 4098, 2]
2026-07-20 16:05:17 +00:00
// Exports: useGiftCardMobileConsumptionHalfsheet
2026-07-23 10:11:24 +00:00
// Module 5799 (useGiftCardMobileConsumptionHalfsheet)
import _slicedToArray from "_slicedToArray";
import result from "result";
import _isNativeReflectConstruct from "_isNativeReflectConstruct";
import closure_6 from "_isNativeReflectConstruct";
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;
let obj = { Idle: "idle", Opening: "opening", Opened: "opened" };
2026-07-20 16:05:17 +00:00
const Idle = obj.Idle;
2026-07-23 10:11:24 +00:00
const result = require("_isNativeReflectConstruct").fileFinishedImporting("modules/checkout/native/useGiftCardMobileConsumptionHalfsheet.tsx");
2026-07-20 16:05:17 +00:00
export const useGiftCardMobileConsumptionHalfsheet = function useGiftCardMobileConsumptionHalfsheet() {
2026-07-23 10:11:24 +00:00
enabled = enabled(5801).useGiftCardsExperimentConfig({ location: "useGiftCardMobileConsumptionHalfsheet" }).enabled;
let obj = enabled(5801);
let items = [callback];
let items1 = [enabled];
const stateFromStores = enabled(566).useStateFromStores(items, () => {
2026-07-20 16:05:17 +00:00
if (enabled) {
const _Object = Object;
const values = Object.values(callback.paymentSources);
let num = 0;
if (0 < values.length) {
2026-07-23 10:11:24 +00:00
while (values[num].type !== outer1_8.TDS_WALLET) {
2026-07-20 16:05:17 +00:00
num = num + 1;
}
return values[num].id;
}
return null;
} else {
return null;
}
}, items1);
2026-07-23 10:11:24 +00:00
let obj2 = enabled(566);
const items2 = [_isNativeReflectConstruct];
2026-07-20 16:05:17 +00:00
const items3 = [stateFromStores];
2026-07-23 10:11:24 +00:00
const stateFromStores1 = enabled(566).useStateFromStores(items2, () => {
2026-07-20 16:05:17 +00:00
let balance = null;
if (null != stateFromStores) {
balance = ref.getBalance(stateFromStores);
}
return balance;
}, items3);
2026-07-23 10:11:24 +00:00
const obj3 = enabled(566);
const items4 = [_isNativeReflectConstruct];
2026-07-20 16:05:17 +00:00
const items5 = [stateFromStores];
let tmp4 = enabled;
2026-07-23 10:11:24 +00:00
const stateFromStores2 = enabled(566).useStateFromStores(items4, () => {
2026-07-20 16:05:17 +00:00
let isFetching = null != stateFromStores;
if (isFetching) {
isFetching = ref.getIsFetching(stateFromStores);
}
return isFetching;
}, items5);
if (enabled) {
tmp4 = null != stateFromStores;
}
if (tmp4) {
tmp4 = !stateFromStores2;
}
if (tmp4) {
tmp4 = null != stateFromStores1;
}
if (tmp4) {
tmp4 = stateFromStores1.amount > 0;
}
const dependencyMap = tmp4;
const items6 = [tmp4];
const memo = React.useMemo(() => {
if (tmp4) {
const items = [enabled(tmp4[8]).DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET];
let items1 = items;
} else {
items1 = [];
}
return items1;
}, items6);
2026-07-23 10:11:24 +00:00
const obj4 = enabled(566);
const tmp8 = first(enabled(5802).useSelectedDismissibleContent(memo, undefined, true), 2);
first = tmp8[0];
React = tmp10;
_isNativeReflectConstruct = React.useRef(tmp10);
2026-07-20 16:05:17 +00:00
const items7 = [tmp8[1]];
const effect = React.useEffect(() => {
2026-07-23 10:11:24 +00:00
_isNativeReflectConstruct.current = result;
2026-07-20 16:05:17 +00:00
}, items7);
callback = React.useCallback((arg0) => {
ref.current(arg0);
}, []);
const items8 = [enabled];
const effect1 = React.useEffect(() => {
if (enabled) {
const paymentSources = enabled(tmp4[10]).fetchPaymentSources();
const obj = enabled(tmp4[10]);
}
}, items8);
const items9 = [stateFromStores];
const effect2 = React.useEffect(() => {
if (null != stateFromStores) {
const walletInformation = enabled(tmp4[10]).fetchWalletInformation(stateFromStores);
const obj = enabled(tmp4[10]);
}
}, 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-20 16:05:17 +00:00
tmp = key.key !== "GiftCardMobileConsumptionActionSheet";
}
if (!tmp) {
2026-07-23 10:11:24 +00:00
const outer2_10 = outer2_9.Opened;
2026-07-20 16:05:17 +00:00
}
}
if (first === enabled(tmp4[8]).DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) {
2026-07-23 10:11:24 +00:00
if (outer1_10 === outer1_9.Idle) {
outer1_10 = outer1_9.Opening;
let c0 = false;
2026-07-20 16:05:17 +00:00
let obj = stateFromStores(tmp4[11]);
const subscription = obj.subscribe("SHOW_ACTION_SHEET", handleShow);
const promise = enabled(stateFromStores[13])(stateFromStores[12], stateFromStores.paths);
promise.catch(() => {
2026-07-23 10:11:24 +00:00
let tmp = c0;
if (!c0) {
tmp = outer2_10 !== outer2_9.Opening;
2026-07-20 16:05:17 +00:00
}
if (!tmp) {
2026-07-23 10:11:24 +00:00
outer2_10 = outer2_9.Idle;
2026-07-20 16:05:17 +00:00
}
});
const obj2 = stateFromStores(stateFromStores[14]);
obj = { markAsDismissed: callback };
obj2.openLazy(promise, "GiftCardMobileConsumptionActionSheet", obj, "stack");
return () => {
2026-07-23 10:11:24 +00:00
let c0 = true;
stateFromStores(table[11]).unsubscribe("SHOW_ACTION_SHEET", handleShow);
if (outer2_10 === outer2_9.Opening) {
outer2_10 = outer2_9.Idle;
2026-07-20 16:05:17 +00:00
}
};
}
}
}, items10);
const items11 = [first];
const effect4 = React.useEffect(() => {
function handleHide(key) {
if (key.key === "GiftCardMobileConsumptionActionSheet") {
2026-07-23 10:11:24 +00:00
outer1_5.current(outer2_7.USER_DISMISS);
2026-07-20 16:05:17 +00:00
}
}
if (first === enabled(tmp4[8]).DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) {
const subscription = stateFromStores(tmp4[11]).subscribe("HIDE_ACTION_SHEET", handleHide);
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);
};