decord/source/modules/checkout/native/useGiftCardMobileConsumptionHalfsheet.tsx
github-actions cd74c1f217 chore: update source for alpha 345.5
Skipped 1 file(s) >100MB (GitHub limit): source/__vendor/09xxx/9667_m.js (378 MB)
2026-09-05 10:56:28 +00:00

170 lines
5.5 KiB
TypeScript

// Module ID: 7385
// Function ID: 7386
// Name: useGiftCardMobileConsumptionHalfsheet
// Dependencies: [32, 19, 7386, 4221, 1954, 1085, 7387, 504, 1943, 7388, 4884, 573, 7392, 1896, 4527, 2]
// Exports: useGiftCardMobileConsumptionHalfsheet
// Module 7385 (useGiftCardMobileConsumptionHalfsheet)
import closure_3 from "_slicedToArray" /* 32 */;
import closure_4 from "noop" /* 19 */;
import closure_5 from "set" /* 7386 */;
import closure_6 from "handlePaymentSourceUpdate" /* 4221 */;
import { ContentDismissActionType } from "ContentDismissActionType" /* 1954 */;
import { PaymentSourceTypes } from "sum" /* 1085 */;
const require = arg1;
const GiftCardMobileConsumptionActionSheet = "GiftCardMobileConsumptionActionSheet";
let obj = { Idle: "idle", Opening: "opening", Opened: "opened" };
let Idle = obj.Idle;
const result = require("set").fileFinishedImporting("modules/checkout/native/useGiftCardMobileConsumptionHalfsheet.tsx");
export const useGiftCardMobileConsumptionHalfsheet = function useGiftCardMobileConsumptionHalfsheet() {
enabled = enabled(7387).useGiftCardsExperimentConfig({ location: "useGiftCardMobileConsumptionHalfsheet" }).enabled;
obj = enabled(7387);
let tmp = enabled;
let items = [callback];
let items1 = [enabled];
const stateFromStores = enabled(504).useStateFromStores(items, () => {
if (enabled) {
const _Object = Object;
const values = Object.values(callback.paymentSources);
for (const item10013 of values) {
let tmp7 = item10013;
let tmp8 = closure_1_8;
if (item10013.type === closure_1_8.TDS_WALLET) {
let tmp9 = obj;
obj.return();
return item10013.id;
}
}
return null;
} else {
return null;
}
}, items1);
let obj2 = enabled(504);
const items2 = [closure_5];
const items3 = [stateFromStores];
const stateFromStores1 = enabled(504).useStateFromStores(items2, () => {
let balance = null;
if (null != stateFromStores) {
balance = ref.getBalance(tmp);
}
return balance;
}, items3);
const obj3 = enabled(504);
const items4 = [closure_5];
const items5 = [stateFromStores];
let tmp6 = enabled;
const stateFromStores2 = enabled(504).useStateFromStores(items4, () => {
let isFetching = null != stateFromStores;
if (isFetching) {
isFetching = ref.getIsFetching(tmp);
}
return isFetching;
}, items5);
if (enabled) {
tmp6 = null != stateFromStores;
}
if (tmp6) {
tmp6 = !stateFromStores2;
}
if (tmp6) {
tmp6 = null != stateFromStores1;
}
if (tmp6) {
tmp6 = stateFromStores1.amount > 0;
}
dependencyMap = tmp6;
const items6 = [tmp6];
const memo = React.useMemo(() => {
if (dependencyMap) {
const items = [enabled(1943).DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET];
let items1 = items;
} else {
items1 = [];
}
return items1;
}, items6);
const obj4 = enabled(504);
const tmp10 = first(tmp(7388).useSelectedDismissibleContent(memo, undefined, true), 2);
first = tmp10[0];
React = tmp12;
closure_5 = React.useRef(tmp12);
const items7 = [tmp10[1]];
const effect = React.useEffect(() => {
closure_5.current = closure_4;
}, items7);
callback = React.useCallback((AUTO_DISMISS) => {
ref.current(AUTO_DISMISS);
}, []);
const items8 = [enabled];
const effect1 = React.useEffect(() => {
if (enabled) {
const paymentSources = enabled(4884).fetchPaymentSources();
obj = enabled(4884);
}
}, items8);
const items9 = [stateFromStores];
const effect2 = React.useEffect(() => {
if (null != stateFromStores) {
const walletInformation = enabled(4884).fetchWalletInformation(tmp);
obj = enabled(4884);
}
}, items9);
const items10 = [first, callback];
const effect3 = React.useEffect(() => {
function handleShow(key) {
let tmp = c0;
if (!c0) {
tmp = key.key !== closure_1_9;
}
if (!tmp) {
Idle = closure_1_10.Opened;
}
}
if (first === enabled(1943).DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) {
if (Opening === closure_1_10.Idle) {
Opening = closure_1_10.Opening;
c0 = false;
obj = stateFromStores(573);
const subscription = obj.subscribe("SHOW_ACTION_SHEET", handleShow);
const promise = enabled(1896)(7392, dependencyMap.paths);
promise.catch(() => {
let tmp = c0;
if (!c0) {
tmp = Idle !== closure_1_10.Opening;
}
if (!tmp) {
Idle = closure_1_10.Idle;
}
});
const obj2 = stateFromStores(4527);
obj = { markAsDismissed: null };
obj[0] = callback;
obj2.openLazy(promise, closure_1_9, obj, "stack");
return () => {
c0 = true;
handleShow(closure_1_2[11]).unsubscribe("SHOW_ACTION_SHEET", handleShow);
if (Idle === closure_1_10.Opening) {
Idle = closure_1_10.Idle;
}
};
}
}
}, items10);
const items11 = [first];
const effect4 = React.useEffect(() => {
function handleHide(key) {
if (key.key === closure_1_9) {
ref.current(closure_1_7.USER_DISMISS);
}
}
if (first === enabled(1943).DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) {
const subscription = stateFromStores(573).subscribe("HIDE_ACTION_SHEET", handleHide);
return () => {
stateFromStores(table[11]).unsubscribe("HIDE_ACTION_SHEET", handleHide);
};
}
}, items11);
};