decord/source/modules/payments/native/hooks/useOrderContext.tsx
github-actions 20a21ad13f chore: update source for alpha 346.5
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4791.js (118.4 MB)
2026-09-11 19:12:58 +00:00

56 lines
1.5 KiB
TypeScript

// Module ID: 10791
// Function ID: 10792
// Name: useOrderContext
// Dependencies: [32, 19, 2]
// Exports: useOrderContext
// Module 10791 (useOrderContext)
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
const size = fn(2);
const result = size.fileFinishedImporting("modules/payments/native/hooks/useOrderContext.tsx");
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) => {
let tmp = arg0;
if (null != arg0) {
const obj = {};
const merged = Object.assign(arg0);
obj.revision = revision;
tmp = obj;
}
return tmp;
});
}, []);
const items = [order, tmp[1], setRevision];
return noop.useMemo(() => {
const obj = { order, setOrder, setRevision, orderId: null, orderLineItemId: null, revision: null };
let id;
if (order != null) {
id = tmp.id;
}
obj.orderId = id;
let id1;
if (order != null) {
const order_line_items = tmp.order_line_items;
if (order_line_items != null) {
order = order_line_items[0];
if (order != null) {
id1 = order.id;
}
}
}
obj.orderLineItemId = id1;
let revision;
if (order != null) {
revision = tmp.revision;
}
obj.revision = revision;
return obj;
}, items);
};