decord/source/modules/payments/native/hooks/useOrderContext.tsx

57 lines
1.5 KiB
TypeScript
Raw Normal View History

// Module ID: 10734
// Function ID: 10735
2026-07-20 16:05:17 +00:00
// Name: useOrderContext
2026-07-29 08:29:29 +00:00
// Dependencies: [32, 19, 2]
2026-07-20 16:05:17 +00:00
// Exports: useOrderContext
// Module 10734 (useOrderContext)
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
2026-07-23 10:11:24 +00:00
const size = fn(2);
const result = size.fileFinishedImporting("modules/payments/native/hooks/useOrderContext.tsx");
2026-07-20 16:05:17 +00:00
export const useOrderContext = function useOrderContext(initialOrder) {
let tmp = _slicedToArray(noop.useState(initialOrder), 2);
let order = tmp[0];
const setOrder = tmp3;
const setRevision = noop.useCallback((revision) => {
setOrder((arg0) => {
2026-07-20 16:05:17 +00:00
let tmp = arg0;
if (null != arg0) {
const obj = {};
const merged = Object.assign(arg0);
obj.revision = revision;
2026-07-20 16:05:17 +00:00
tmp = obj;
}
return tmp;
});
}, []);
const items = [order, tmp[1], setRevision];
return noop.useMemo(() => {
const obj = { order, setOrder, setRevision, orderId: null, orderLineItemId: null, revision: null };
2026-07-20 16:05:17 +00:00
let id;
if (order != null) {
2026-07-29 08:29:29 +00:00
id = tmp.id;
2026-07-20 16:05:17 +00:00
}
obj.orderId = id;
2026-07-20 16:05:17 +00:00
let id1;
if (order != null) {
2026-07-29 08:29:29 +00:00
const order_line_items = tmp.order_line_items;
if (order_line_items != null) {
order = order_line_items[0];
if (order != null) {
id1 = order.id;
2026-07-20 16:05:17 +00:00
}
}
}
obj.orderLineItemId = id1;
2026-07-20 16:05:17 +00:00
let revision;
if (order != null) {
2026-07-29 08:29:29 +00:00
revision = tmp.revision;
2026-07-20 16:05:17 +00:00
}
obj.revision = revision;
2026-07-20 16:05:17 +00:00
return obj;
}, items);
};