decord/beta/source/modules/checkout/native/useGiftCardMobileConsumptionHalfsheet.tsx
github-actions 84d017ff78 chore: update source for beta 348.6
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5021.js (118.4 MB)
2026-09-28 16:18:32 +00:00

171 lines
5.8 KiB
TypeScript

// Module ID: 6803
// Function ID: 6804
// Name: useGiftCardMobileConsumptionHalfsheet
// Dependencies: [32, 19, 6804, 4491, 2042, 1085, 6805, 504, 2029, 6806, 5174, 573, 6810, 1981, 4800, 2]
// Exports: useGiftCardMobileConsumptionHalfsheet
// Module 6803 (useGiftCardMobileConsumptionHalfsheet)
import DispatcherDefault from "Dispatcher" /* 573 */;
import asyncRequireImpl from "asyncRequireImpl" /* 1981 */;
import dismissible_content from "dismissible_content" /* 2029 */;
import ActionSheetActionCreatorsDefault from "ActionSheetActionCreators" /* 4800 */;
import actions_BillingActionCreators from "actions/BillingActionCreators" /* 5174 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
import WalletBalanceStore from "WalletBalanceStore" /* 6804 */;
import PaymentSourceStore from "PaymentSourceStore" /* 4491 */;
require = fn;
const ContentDismissActionType = fn(2042).ContentDismissActionType;
const PaymentSourceTypes = fn(1085).PaymentSourceTypes;
const GiftCardMobileConsumptionActionSheet = "GiftCardMobileConsumptionActionSheet";
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");
export const useGiftCardMobileConsumptionHalfsheet = function useGiftCardMobileConsumptionHalfsheet() {
enabled = enabled(6805).useGiftCardsExperimentConfig({ location: "useGiftCardMobileConsumptionHalfsheet" }).enabled;
obj = enabled(6805);
let tmp = enabled;
let items = [markAsDismissed];
let items1 = [enabled];
const stateFromStores = enabled(504).useStateFromStores(items, () => {
if (enabled) {
const _Object = Object;
const values = Object.values(PaymentSourceStore.paymentSources);
for (const item10013 of values) {
if (item10013.type === PaymentSourceTypes.TDS_WALLET) {
obj.return();
return item10013.id;
}
}
return null;
} else {
return null;
}
}, items1);
let obj2 = enabled(504);
const items2 = [ref];
const items3 = [stateFromStores];
const stateFromStores1 = enabled(504).useStateFromStores(items2, () => {
let balance = null;
if (null != stateFromStores) {
balance = WalletBalanceStore.getBalance(tmp);
}
return balance;
}, items3);
let obj3 = enabled(504);
const items4 = [ref];
const items5 = [stateFromStores];
let tmp6 = enabled;
const stateFromStores2 = enabled(504).useStateFromStores(items4, () => {
let isFetching = null != stateFromStores;
if (isFetching) {
isFetching = WalletBalanceStore.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 = noop.useMemo(() => {
if (closure_2) {
const items = [dismissible_content.DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET];
let items1 = items;
} else {
items1 = [];
}
return items1;
}, items6);
const obj4 = enabled(504);
const tmp10 = first(tmp(6806).useSelectedDismissibleContent(memo, undefined, true), 2);
first = tmp10[0];
noop = tmp12;
ref = noop.useRef(tmp10[1]);
const items7 = [tmp10[1]];
const effect = noop.useEffect(() => {
closure_5.current = current;
}, items7);
markAsDismissed = noop.useCallback((AUTO_DISMISS) => {
ref.current(AUTO_DISMISS);
}, []);
const items8 = [enabled];
const effect1 = noop.useEffect(() => {
if (enabled) {
const paymentSources = actions_BillingActionCreators.fetchPaymentSources();
}
}, items8);
const items9 = [stateFromStores];
const effect2 = noop.useEffect(() => {
if (null != stateFromStores) {
const walletInformation = actions_BillingActionCreators.fetchWalletInformation(tmp);
}
}, items9);
const items10 = [first, markAsDismissed];
const effect3 = noop.useEffect(() => {
function handleShow(key) {
let tmp = c0;
if (!c0) {
tmp = key.key !== GiftCardMobileConsumptionActionSheet;
}
if (!tmp) {
Idle = obj.Opened;
}
}
if (first === dismissible_content.DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) {
if (Opening === obj.Idle) {
Opening = obj.Opening;
c0 = false;
obj = DispatcherDefault;
const subscription = obj.subscribe("SHOW_ACTION_SHEET", handleShow);
const promise = asyncRequireImpl(6810, dependencyMap.paths);
promise.catch(() => {
let tmp = c0;
if (!c0) {
tmp = Idle !== obj.Opening;
}
if (!tmp) {
Idle = obj.Idle;
}
});
const obj2 = ActionSheetActionCreatorsDefault;
const obj3 = { markAsDismissed };
obj2.openLazy(promise, GiftCardMobileConsumptionActionSheet, obj3, "stack");
return () => {
c0 = true;
stateFromStores(closure_2[11]).unsubscribe("SHOW_ACTION_SHEET", handleShow);
if (Idle === obj.Opening) {
Idle = obj.Idle;
}
};
}
}
}, items10);
const items11 = [first];
const effect4 = noop.useEffect(() => {
function handleHide(key) {
if (key.key === GiftCardMobileConsumptionActionSheet) {
ref.current(constants.USER_DISMISS);
}
}
if (first === enabled(closure_2[8]).DismissibleContent.GIFT_CARD_MOBILE_CONSUMPTION_UNAVAILABLE_HALFSHEET) {
const subscription = stateFromStores(tmp[11]).subscribe("HIDE_ACTION_SHEET", handleHide);
return () => {
DispatcherDefault.unsubscribe("HIDE_ACTION_SHEET", handleHide);
};
}
tmp = closure_2;
}, items11);
};