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

57 lines
1.5 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 9664
// Function ID: 9665
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
2026-08-24 06:08:38 +00:00
// Module 9664 (useOrderContext)
import closure_0 from "_slicedToArray" /* 32 */;
import closure_1 from "noop" /* 19 */;
2026-07-23 10:11:24 +00:00
const result = require("set").fileFinishedImporting("modules/payments/native/hooks/useOrderContext.tsx");
2026-07-20 16:05:17 +00:00
export const useOrderContext = function useOrderContext(initialOrder, NativeGiftContext) {
2026-07-23 10:11:24 +00:00
let tmp = first(React.useState(initialOrder), 2);
first = tmp[0];
React = tmp3;
const callback = React.useCallback((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
callback((arg0) => {
2026-07-20 16:05:17 +00:00
let tmp = arg0;
if (null != arg0) {
const obj = {};
const merged = Object.assign(arg0);
2026-08-24 06:08:38 +00:00
obj.revision = closure_0;
2026-07-20 16:05:17 +00:00
tmp = obj;
}
return tmp;
});
}, []);
const items = [first, tmp[1], callback];
return React.useMemo(() => {
2026-08-24 06:08:38 +00:00
const obj = { order: first, setOrder: closure_1, setRevision: callback, orderId: null, orderLineItemId: null, revision: null };
2026-07-20 16:05:17 +00:00
let id;
2026-07-29 08:29:29 +00:00
if (first != null) {
id = tmp.id;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[3] = id;
2026-07-20 16:05:17 +00:00
let id1;
2026-07-29 08:29:29 +00:00
if (first != null) {
const order_line_items = tmp.order_line_items;
if (order_line_items != null) {
2026-07-23 10:11:24 +00:00
first = order_line_items[0];
2026-07-29 08:29:29 +00:00
if (first != null) {
2026-07-20 16:05:17 +00:00
id1 = first.id;
}
}
}
2026-07-29 08:29:29 +00:00
obj[4] = id1;
2026-07-20 16:05:17 +00:00
let revision;
2026-07-29 08:29:29 +00:00
if (first != null) {
revision = tmp.revision;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[5] = revision;
2026-07-20 16:05:17 +00:00
return obj;
}, items);
};