order-management 0.0.97 → 0.0.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/index.js +717 -727
- package/.medusa/server/src/admin/index.mjs +718 -728
- package/.medusa/server/src/utils/notification-handler.js +38 -11
- package/README.md +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2
5
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
6
|
const adminSdk = require("@medusajs/admin-sdk");
|
|
4
7
|
const react = require("react");
|
|
@@ -375,14 +378,15 @@ const s = {
|
|
|
375
378
|
const OrderGiftItemsWidget = ({ data }) => {
|
|
376
379
|
const [fetchedItems, setFetchedItems] = react.useState(null);
|
|
377
380
|
react.useEffect(() => {
|
|
378
|
-
if (!data
|
|
381
|
+
if (!(data == null ? void 0 : data.id)) return;
|
|
379
382
|
fetch(
|
|
380
383
|
`/admin/orders/${data.id}?fields=*items,items.metadata`
|
|
381
|
-
).then((r) => r.json()).then(({ order }) => setFetchedItems(order
|
|
382
|
-
}, [data
|
|
383
|
-
const items = fetchedItems ?? data
|
|
384
|
+
).then((r) => r.json()).then(({ order }) => setFetchedItems((order == null ? void 0 : order.items) ?? [])).catch(() => setFetchedItems((data == null ? void 0 : data.items) ?? []));
|
|
385
|
+
}, [data == null ? void 0 : data.id]);
|
|
386
|
+
const items = fetchedItems ?? (data == null ? void 0 : data.items) ?? [];
|
|
384
387
|
const giftedItems = items.filter((i) => {
|
|
385
|
-
|
|
388
|
+
var _a;
|
|
389
|
+
const flag = (_a = i.metadata) == null ? void 0 : _a.is_gift;
|
|
386
390
|
return flag === "true" || flag === true;
|
|
387
391
|
});
|
|
388
392
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.widget, children: [
|
|
@@ -411,9 +415,9 @@ const OrderGiftItemsWidget = ({ data }) => {
|
|
|
411
415
|
),
|
|
412
416
|
giftedItems.map((item) => {
|
|
413
417
|
const meta = item.metadata;
|
|
414
|
-
const from = meta
|
|
415
|
-
const to = meta
|
|
416
|
-
const message = meta
|
|
418
|
+
const from = meta == null ? void 0 : meta.gift_from;
|
|
419
|
+
const to = meta == null ? void 0 : meta.gift_to;
|
|
420
|
+
const message = meta == null ? void 0 : meta.gift_message;
|
|
417
421
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.card, children: [
|
|
418
422
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.ribbon, children: [
|
|
419
423
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.bowCenter, children: "🎀" }),
|
|
@@ -477,7 +481,7 @@ function formatRefundCurrency(amount, currencyCode = "inr", options) {
|
|
|
477
481
|
minimumFractionDigits: 2,
|
|
478
482
|
maximumFractionDigits: 2
|
|
479
483
|
}).format(amount);
|
|
480
|
-
if (options
|
|
484
|
+
if ((options == null ? void 0 : options.signed) && amount > 0) {
|
|
481
485
|
return `−${formatted}`;
|
|
482
486
|
}
|
|
483
487
|
return formatted;
|
|
@@ -532,7 +536,8 @@ function getOrderIdFromPath() {
|
|
|
532
536
|
return m ? m[1] : void 0;
|
|
533
537
|
}
|
|
534
538
|
const OrderRefundContextWidget = (props) => {
|
|
535
|
-
|
|
539
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
540
|
+
const orderId = ((_a = props.order) == null ? void 0 : _a.id) ?? ((_c = (_b = props.data) == null ? void 0 : _b.order) == null ? void 0 : _c.id) ?? getOrderIdFromPath();
|
|
536
541
|
const [context, setContext] = react.useState(null);
|
|
537
542
|
const [loading, setLoading] = react.useState(!!orderId);
|
|
538
543
|
const [error, setError] = react.useState(null);
|
|
@@ -570,7 +575,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
570
575
|
};
|
|
571
576
|
}, [orderId]);
|
|
572
577
|
const handleMarkRefunded = async () => {
|
|
573
|
-
if (!context
|
|
578
|
+
if (!(context == null ? void 0 : context.return_id) || !(context == null ? void 0 : context.refund_mapping) || context.refund_mapping.is_refunded || !context.can_process_refund) {
|
|
574
579
|
return;
|
|
575
580
|
}
|
|
576
581
|
setMarking(true);
|
|
@@ -587,14 +592,17 @@ const OrderRefundContextWidget = (props) => {
|
|
|
587
592
|
}
|
|
588
593
|
const data = await res.json();
|
|
589
594
|
setContext(
|
|
590
|
-
(prev) =>
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
595
|
+
(prev) => {
|
|
596
|
+
var _a2;
|
|
597
|
+
return prev && prev.refund_mapping ? {
|
|
598
|
+
...prev,
|
|
599
|
+
can_process_refund: false,
|
|
600
|
+
refund_mapping: {
|
|
601
|
+
...prev.refund_mapping,
|
|
602
|
+
is_refunded: ((_a2 = data.refund_payment_mapping) == null ? void 0 : _a2.is_refunded) ?? true
|
|
603
|
+
}
|
|
604
|
+
} : prev;
|
|
605
|
+
}
|
|
598
606
|
);
|
|
599
607
|
} catch (e) {
|
|
600
608
|
setMarkError(e instanceof Error ? e.message : "Failed to mark refunded");
|
|
@@ -603,19 +611,20 @@ const OrderRefundContextWidget = (props) => {
|
|
|
603
611
|
}
|
|
604
612
|
};
|
|
605
613
|
const handleEditClick = () => {
|
|
606
|
-
const mapping = context
|
|
607
|
-
const mode = mapping
|
|
614
|
+
const mapping = context == null ? void 0 : context.refund_mapping;
|
|
615
|
+
const mode = mapping == null ? void 0 : mapping.refund_mode;
|
|
608
616
|
setEditRefundMode(
|
|
609
617
|
mode === "offline" || mode === "online" ? mode : ""
|
|
610
618
|
);
|
|
611
|
-
setEditDetails(mapping
|
|
612
|
-
setEditImageUrls(mapping
|
|
619
|
+
setEditDetails((mapping == null ? void 0 : mapping.details) ?? "");
|
|
620
|
+
setEditImageUrls((mapping == null ? void 0 : mapping.images) ?? []);
|
|
613
621
|
setSaveError(null);
|
|
614
622
|
setUploadError(null);
|
|
615
623
|
setEditing(true);
|
|
616
624
|
};
|
|
617
625
|
const handleUploadImage = async (e) => {
|
|
618
|
-
|
|
626
|
+
var _a2, _b2, _c2;
|
|
627
|
+
const file = (_a2 = e.target.files) == null ? void 0 : _a2[0];
|
|
619
628
|
if (!file) return;
|
|
620
629
|
setUploading(true);
|
|
621
630
|
setUploadError(null);
|
|
@@ -632,7 +641,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
632
641
|
throw new Error(data2.message || "Upload failed");
|
|
633
642
|
}
|
|
634
643
|
const data = await res.json();
|
|
635
|
-
const url = data.files
|
|
644
|
+
const url = (_c2 = (_b2 = data.files) == null ? void 0 : _b2[0]) == null ? void 0 : _c2.url;
|
|
636
645
|
if (url) setEditImageUrls((prev) => [...prev, url]);
|
|
637
646
|
} catch (err) {
|
|
638
647
|
setUploadError(err instanceof Error ? err.message : "Upload failed");
|
|
@@ -645,7 +654,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
645
654
|
setEditImageUrls((prev) => prev.filter((_, i) => i !== index));
|
|
646
655
|
};
|
|
647
656
|
const handleSaveAdminFields = async () => {
|
|
648
|
-
if (!context
|
|
657
|
+
if (!(context == null ? void 0 : context.return_id)) return;
|
|
649
658
|
setSaving(true);
|
|
650
659
|
setSaveError(null);
|
|
651
660
|
try {
|
|
@@ -682,14 +691,14 @@ const OrderRefundContextWidget = (props) => {
|
|
|
682
691
|
if (error) {
|
|
683
692
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mt-6 divide-y p-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-error", children: error }) }) });
|
|
684
693
|
}
|
|
685
|
-
const hasReturn = !!context
|
|
686
|
-
const hasMapping = !!context
|
|
687
|
-
const canMarkRefunded = Boolean(context
|
|
688
|
-
const returnStatus = context
|
|
689
|
-
const showReceiveFirstHint = hasReturn && !context
|
|
690
|
-
const paymentDetail = context
|
|
691
|
-
const paymentDetails = context
|
|
692
|
-
const orderPayment = context
|
|
694
|
+
const hasReturn = !!(context == null ? void 0 : context.return_id);
|
|
695
|
+
const hasMapping = !!(context == null ? void 0 : context.refund_mapping);
|
|
696
|
+
const canMarkRefunded = Boolean(context == null ? void 0 : context.can_process_refund);
|
|
697
|
+
const returnStatus = (context == null ? void 0 : context.return_status) ?? null;
|
|
698
|
+
const showReceiveFirstHint = hasReturn && !((_d = context == null ? void 0 : context.refund_mapping) == null ? void 0 : _d.is_refunded) && returnStatus !== "received" && returnStatus !== "canceled";
|
|
699
|
+
const paymentDetail = context == null ? void 0 : context.payment_detail;
|
|
700
|
+
const paymentDetails = (context == null ? void 0 : context.payment_details) && context.payment_details.length > 0 ? context.payment_details : paymentDetail ? [paymentDetail] : [];
|
|
701
|
+
const orderPayment = context == null ? void 0 : context.order_payment;
|
|
693
702
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mt-6 divide-y p-0", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4 py-4", children: [
|
|
694
703
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Heading, { level: "h2", className: "flex items-center gap-2", children: [
|
|
695
704
|
/* @__PURE__ */ jsxRuntime.jsx(icons.CashSolid, { className: "text-ui-fg-subtle" }),
|
|
@@ -701,7 +710,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
701
710
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
702
711
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Return" }),
|
|
703
712
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: context.return_id }),
|
|
704
|
-
context.refund_mapping
|
|
713
|
+
((_e = context.refund_mapping) == null ? void 0 : _e.is_refunded) ? /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "green", children: "Refunded" }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "orange", children: "Not refunded" })
|
|
705
714
|
] }),
|
|
706
715
|
context.refund ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 border-t border-ui-border-base pt-3", children: /* @__PURE__ */ jsxRuntime.jsx(RefundCalculationBlock, { refund: context.refund }) }) : null,
|
|
707
716
|
orderPayment && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 space-y-2 border-t border-ui-border-base pt-3", children: [
|
|
@@ -715,17 +724,17 @@ const OrderRefundContextWidget = (props) => {
|
|
|
715
724
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 space-y-2 border-t border-ui-border-base pt-3", children: [
|
|
716
725
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
717
726
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Payment method (refund destination)" }),
|
|
718
|
-
context.refund_mapping
|
|
727
|
+
((_f = context.refund_mapping) == null ? void 0 : _f.payment_id) ? /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "green", children: "Customer specified" }) : paymentDetail ? /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "orange", children: "Customer default" }) : orderPayment && !orderPayment.is_cod ? /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "blue", children: "Original payment method" }) : null
|
|
719
728
|
] }),
|
|
720
|
-
context.refund_mapping
|
|
721
|
-
!context.refund_mapping
|
|
722
|
-
!context.refund_mapping
|
|
729
|
+
((_g = context.refund_mapping) == null ? void 0 : _g.payment_id) && !paymentDetail && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-orange-200 bg-orange-50 px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", className: "text-ui-fg-muted", children: "The customer specified a payment method for this return, but that payment method has since been removed from their account. Ask the customer to update their refund payment method." }) }),
|
|
730
|
+
!((_h = context.refund_mapping) == null ? void 0 : _h.payment_id) && (paymentDetail == null ? void 0 : paymentDetail.source) === "default" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", className: "text-ui-fg-muted", children: "The customer did not specify a payment method for this return. Showing their default payment method." }) }),
|
|
731
|
+
!((_i = context.refund_mapping) == null ? void 0 : _i.payment_id) && !paymentDetail && orderPayment && !orderPayment.is_cod && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "xsmall", className: "text-ui-fg-muted", children: [
|
|
723
732
|
"Refund will go to the original payment method (",
|
|
724
733
|
orderPayment.label,
|
|
725
734
|
")."
|
|
726
735
|
] }) }),
|
|
727
|
-
!context.refund_mapping
|
|
728
|
-
!context.refund_mapping
|
|
736
|
+
!((_j = context.refund_mapping) == null ? void 0 : _j.payment_id) && !paymentDetail && (context.is_cod || (orderPayment == null ? void 0 : orderPayment.is_cod)) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", className: "text-ui-fg-muted", children: "This order was paid with Cash on Delivery. No stored bank/UPI refund destination." }) }),
|
|
737
|
+
!((_k = context.refund_mapping) == null ? void 0 : _k.payment_id) && !paymentDetail && !orderPayment && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", className: "text-ui-fg-muted", children: "No payment method found for this customer." }) }),
|
|
729
738
|
paymentDetails.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: paymentDetails.map((detail) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
730
739
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
731
740
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { children: detail.type.toUpperCase() }),
|
|
@@ -737,7 +746,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
737
746
|
] }, `${detail.id}-${k}`)) })
|
|
738
747
|
] }, detail.id)) })
|
|
739
748
|
] }),
|
|
740
|
-
context
|
|
749
|
+
(context == null ? void 0 : context.refund_mapping) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 space-y-3 border-t border-ui-border-base pt-3", children: [
|
|
741
750
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
742
751
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Refund mode, details & images" }),
|
|
743
752
|
!editing ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -825,7 +834,10 @@ const OrderRefundContextWidget = (props) => {
|
|
|
825
834
|
variant: "secondary",
|
|
826
835
|
type: "button",
|
|
827
836
|
disabled: uploading,
|
|
828
|
-
onClick: () =>
|
|
837
|
+
onClick: () => {
|
|
838
|
+
var _a2;
|
|
839
|
+
return (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
840
|
+
},
|
|
829
841
|
children: uploading ? "Uploading…" : "Upload image"
|
|
830
842
|
}
|
|
831
843
|
),
|
|
@@ -876,7 +888,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
876
888
|
] }),
|
|
877
889
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
878
890
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", weight: "plus", className: "text-ui-fg-muted", children: "Images" }),
|
|
879
|
-
context.refund_mapping.images
|
|
891
|
+
((_l = context.refund_mapping.images) == null ? void 0 : _l.length) ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 flex flex-wrap gap-2", children: context.refund_mapping.images.map((url, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
880
892
|
"a",
|
|
881
893
|
{
|
|
882
894
|
href: url,
|
|
@@ -906,10 +918,10 @@ const OrderRefundContextWidget = (props) => {
|
|
|
906
918
|
),
|
|
907
919
|
markError && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-error", children: markError })
|
|
908
920
|
] }),
|
|
909
|
-
hasMapping && !canMarkRefunded && !context.refund_mapping
|
|
921
|
+
hasMapping && !canMarkRefunded && !((_m = context.refund_mapping) == null ? void 0 : _m.is_refunded) && showReceiveFirstHint && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-4 text-ui-fg-muted", children: "Mark refunded is available after the return is received." })
|
|
910
922
|
] }),
|
|
911
923
|
hasReturn && !hasMapping && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-4", children: [
|
|
912
|
-
context
|
|
924
|
+
(context == null ? void 0 : context.refund) ? /* @__PURE__ */ jsxRuntime.jsx(RefundCalculationBlock, { refund: context.refund }) : null,
|
|
913
925
|
orderPayment && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3 space-y-1", children: [
|
|
914
926
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Order payment method" }),
|
|
915
927
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
@@ -1347,7 +1359,7 @@ function getEntityInfo(tableName) {
|
|
|
1347
1359
|
const def = ENTITY_DEFINITIONS[tableName];
|
|
1348
1360
|
return {
|
|
1349
1361
|
tableName,
|
|
1350
|
-
label: def
|
|
1362
|
+
label: (def == null ? void 0 : def.label) ?? humanizeTableName(tableName),
|
|
1351
1363
|
category: def && CATEGORY_BY_ID.get(def.category) || SYSTEM_CATEGORY
|
|
1352
1364
|
};
|
|
1353
1365
|
}
|
|
@@ -1372,11 +1384,13 @@ function getTablesForCategory(id) {
|
|
|
1372
1384
|
}
|
|
1373
1385
|
const GROUPS = getEntitiesByCategory();
|
|
1374
1386
|
function triggerLabel(entity, category) {
|
|
1387
|
+
var _a;
|
|
1375
1388
|
if (entity) return getEntityInfo(entity).label;
|
|
1376
|
-
if (category) return `All ${getCategory(category)
|
|
1389
|
+
if (category) return `All ${((_a = getCategory(category)) == null ? void 0 : _a.label) ?? category}`;
|
|
1377
1390
|
return "All entities";
|
|
1378
1391
|
}
|
|
1379
1392
|
const EntityPicker = ({ entity, category, onChange }) => {
|
|
1393
|
+
var _a;
|
|
1380
1394
|
const [open, setOpen] = react.useState(false);
|
|
1381
1395
|
const [search, setSearch] = react.useState("");
|
|
1382
1396
|
const searchRef = react.useRef(null);
|
|
@@ -1396,7 +1410,7 @@ const EntityPicker = ({ entity, category, onChange }) => {
|
|
|
1396
1410
|
setOpen(false);
|
|
1397
1411
|
setSearch("");
|
|
1398
1412
|
};
|
|
1399
|
-
const firstMatch = filteredGroups[0]
|
|
1413
|
+
const firstMatch = (_a = filteredGroups[0]) == null ? void 0 : _a.entities[0];
|
|
1400
1414
|
const isAll = !entity && !category;
|
|
1401
1415
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1402
1416
|
ui.Popover,
|
|
@@ -1429,8 +1443,9 @@ const EntityPicker = ({ entity, category, onChange }) => {
|
|
|
1429
1443
|
align: "start",
|
|
1430
1444
|
className: "w-[min(360px,calc(100vw-2rem))] p-0",
|
|
1431
1445
|
onOpenAutoFocus: (event) => {
|
|
1446
|
+
var _a2;
|
|
1432
1447
|
event.preventDefault();
|
|
1433
|
-
searchRef.current
|
|
1448
|
+
(_a2 = searchRef.current) == null ? void 0 : _a2.focus();
|
|
1434
1449
|
},
|
|
1435
1450
|
children: [
|
|
1436
1451
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-ui-border-base p-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1570,7 +1585,7 @@ function formatNumber(value) {
|
|
|
1570
1585
|
return new Intl.NumberFormat().format(value);
|
|
1571
1586
|
}
|
|
1572
1587
|
function formatMoney(amount, currencyCode) {
|
|
1573
|
-
const code = currencyCode
|
|
1588
|
+
const code = currencyCode == null ? void 0 : currencyCode.trim().toUpperCase();
|
|
1574
1589
|
if (code && /^[A-Z]{3}$/.test(code)) {
|
|
1575
1590
|
try {
|
|
1576
1591
|
return new Intl.NumberFormat(void 0, { style: "currency", currency: code }).format(amount);
|
|
@@ -1637,9 +1652,9 @@ const SummaryCards = ({ stats, loading, failed }) => {
|
|
|
1637
1652
|
};
|
|
1638
1653
|
const BASE = "/admin/deleted-records-audit";
|
|
1639
1654
|
class AuditApiError extends Error {
|
|
1640
|
-
status;
|
|
1641
1655
|
constructor(message, status) {
|
|
1642
1656
|
super(message);
|
|
1657
|
+
__publicField(this, "status");
|
|
1643
1658
|
this.status = status;
|
|
1644
1659
|
}
|
|
1645
1660
|
}
|
|
@@ -1704,7 +1719,10 @@ const URL_KEYS = {
|
|
|
1704
1719
|
const DATE_PRESET_VALUES = new Set(DATE_PRESETS.map((p) => p.value));
|
|
1705
1720
|
const DAY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
1706
1721
|
function filtersFromSearchParams(params) {
|
|
1707
|
-
const read = (key) =>
|
|
1722
|
+
const read = (key) => {
|
|
1723
|
+
var _a;
|
|
1724
|
+
return ((_a = params.get(URL_KEYS[key])) == null ? void 0 : _a.trim()) ?? "";
|
|
1725
|
+
};
|
|
1708
1726
|
const date = read("date");
|
|
1709
1727
|
const from = read("from");
|
|
1710
1728
|
const to = read("to");
|
|
@@ -1858,9 +1876,9 @@ const DeletedRecordsPage = () => {
|
|
|
1858
1876
|
try {
|
|
1859
1877
|
setStats(await fetchAuditStats(signal));
|
|
1860
1878
|
} catch (e) {
|
|
1861
|
-
if (!signal
|
|
1879
|
+
if (!(signal == null ? void 0 : signal.aborted)) setStatsFailed(true);
|
|
1862
1880
|
} finally {
|
|
1863
|
-
if (!signal
|
|
1881
|
+
if (!(signal == null ? void 0 : signal.aborted)) setStatsLoading(false);
|
|
1864
1882
|
}
|
|
1865
1883
|
}, []);
|
|
1866
1884
|
react.useEffect(() => {
|
|
@@ -1917,7 +1935,7 @@ const DeletedRecordsPage = () => {
|
|
|
1917
1935
|
const visible = Array.from(document.querySelectorAll(`[data-audit-row="${lastViewed}"]`)).find(
|
|
1918
1936
|
(el) => el.offsetParent !== null
|
|
1919
1937
|
);
|
|
1920
|
-
visible
|
|
1938
|
+
visible == null ? void 0 : visible.scrollIntoView({ block: "center" });
|
|
1921
1939
|
});
|
|
1922
1940
|
const handle = setTimeout(() => setHighlightId(null), 2500);
|
|
1923
1941
|
return () => clearTimeout(handle);
|
|
@@ -1944,8 +1962,8 @@ const DeletedRecordsPage = () => {
|
|
|
1944
1962
|
};
|
|
1945
1963
|
const refresh = () => setReloadToken((t) => t + 1);
|
|
1946
1964
|
const hasMore = items.length < count;
|
|
1947
|
-
const knownSources = stats
|
|
1948
|
-
const knownDeletedBy = stats
|
|
1965
|
+
const knownSources = (stats == null ? void 0 : stats.sources) ?? [];
|
|
1966
|
+
const knownDeletedBy = (stats == null ? void 0 : stats.deleted_by) ?? [];
|
|
1949
1967
|
const attributionMissing = !!stats && stats.total > 0 && knownSources.length === 0 && knownDeletedBy.length === 0;
|
|
1950
1968
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-3 md:p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-7xl flex-col gap-6 p-4 md:p-6", children: [
|
|
1951
1969
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-start md:justify-between", children: [
|
|
@@ -2209,7 +2227,7 @@ const ErrorState = ({ onRetry, detail }) => /* @__PURE__ */ jsxRuntime.jsxs("div
|
|
|
2209
2227
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", className: "max-w-md font-mono text-ui-fg-muted", children: detail }),
|
|
2210
2228
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", size: "small", className: "mt-2", onClick: onRetry, children: "Try again" })
|
|
2211
2229
|
] });
|
|
2212
|
-
const config$
|
|
2230
|
+
const config$8 = adminSdk.defineRouteConfig({
|
|
2213
2231
|
label: "Deleted Records",
|
|
2214
2232
|
icon: icons.Trash
|
|
2215
2233
|
});
|
|
@@ -2504,7 +2522,7 @@ const RefundsPage = () => {
|
|
|
2504
2522
|
) }) : null
|
|
2505
2523
|
] }) });
|
|
2506
2524
|
};
|
|
2507
|
-
const config$
|
|
2525
|
+
const config$7 = adminSdk.defineRouteConfig({
|
|
2508
2526
|
label: "Refunds",
|
|
2509
2527
|
icon: icons.Receipt
|
|
2510
2528
|
});
|
|
@@ -2517,6 +2535,206 @@ const useDebounce$2 = (value, delay) => {
|
|
|
2517
2535
|
return debouncedValue;
|
|
2518
2536
|
};
|
|
2519
2537
|
const getStatusBadgeClass$6 = (status) => {
|
|
2538
|
+
const s2 = status.toLowerCase();
|
|
2539
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2540
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2541
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2542
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2543
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2544
|
+
};
|
|
2545
|
+
const PaymentsPage = () => {
|
|
2546
|
+
const navigate = reactRouterDom.useNavigate();
|
|
2547
|
+
const [items, setItems] = react.useState([]);
|
|
2548
|
+
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
2549
|
+
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
2550
|
+
const debouncedOrderId = useDebounce$2(orderIdSearch, 300);
|
|
2551
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
2552
|
+
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
2553
|
+
const [error, setError] = react.useState(null);
|
|
2554
|
+
const [offset, setOffset] = react.useState(0);
|
|
2555
|
+
const [count, setCount] = react.useState(0);
|
|
2556
|
+
const limit = 50;
|
|
2557
|
+
const loadTransactions = react.useCallback(
|
|
2558
|
+
async (nextOffset, replace) => {
|
|
2559
|
+
try {
|
|
2560
|
+
if (replace) setIsLoading(true);
|
|
2561
|
+
else setIsFetchingMore(true);
|
|
2562
|
+
setError(null);
|
|
2563
|
+
const params = new URLSearchParams();
|
|
2564
|
+
params.set("limit", String(limit));
|
|
2565
|
+
params.set("offset", String(nextOffset));
|
|
2566
|
+
if (statusFilter !== "all") params.set("status", statusFilter);
|
|
2567
|
+
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
2568
|
+
const response = await fetch(
|
|
2569
|
+
`/admin/payment-transactions?${params.toString()}`,
|
|
2570
|
+
{ credentials: "include" }
|
|
2571
|
+
);
|
|
2572
|
+
if (!response.ok) {
|
|
2573
|
+
const text = await response.text();
|
|
2574
|
+
throw new Error(text || "Failed to load payment transactions");
|
|
2575
|
+
}
|
|
2576
|
+
const payload = await response.json();
|
|
2577
|
+
const list = payload.transactions ?? [];
|
|
2578
|
+
setCount(payload.count ?? 0);
|
|
2579
|
+
setOffset(nextOffset + list.length);
|
|
2580
|
+
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
2581
|
+
} catch (e) {
|
|
2582
|
+
setError(e instanceof Error ? e.message : "Failed to load");
|
|
2583
|
+
} finally {
|
|
2584
|
+
setIsLoading(false);
|
|
2585
|
+
setIsFetchingMore(false);
|
|
2586
|
+
}
|
|
2587
|
+
},
|
|
2588
|
+
[statusFilter, debouncedOrderId]
|
|
2589
|
+
);
|
|
2590
|
+
react.useEffect(() => {
|
|
2591
|
+
void loadTransactions(0, true);
|
|
2592
|
+
}, [loadTransactions]);
|
|
2593
|
+
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
2594
|
+
const displayStatus = (t) => {
|
|
2595
|
+
const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
|
|
2596
|
+
return s2 !== "" ? s2 : "—";
|
|
2597
|
+
};
|
|
2598
|
+
const displayAmount = (t) => {
|
|
2599
|
+
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
2600
|
+
return `${code} ${Number(t.amount)}`;
|
|
2601
|
+
};
|
|
2602
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-7xl flex-col gap-6 p-6", children: [
|
|
2603
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
2604
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2605
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payments" }),
|
|
2606
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
|
|
2607
|
+
] }),
|
|
2608
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
|
|
2609
|
+
] }),
|
|
2610
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
2611
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2612
|
+
ui.Input,
|
|
2613
|
+
{
|
|
2614
|
+
placeholder: "Search by Order ID",
|
|
2615
|
+
value: orderIdSearch,
|
|
2616
|
+
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
2617
|
+
className: "md:max-w-sm",
|
|
2618
|
+
"aria-label": "Search by order ID"
|
|
2619
|
+
}
|
|
2620
|
+
),
|
|
2621
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2622
|
+
"select",
|
|
2623
|
+
{
|
|
2624
|
+
value: statusFilter,
|
|
2625
|
+
onChange: (e) => setStatusFilter(e.target.value),
|
|
2626
|
+
className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-xs",
|
|
2627
|
+
"aria-label": "Filter by status",
|
|
2628
|
+
children: [
|
|
2629
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
2630
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
2631
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
2632
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "error", children: "Error" }),
|
|
2633
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
2634
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
2635
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
2636
|
+
]
|
|
2637
|
+
}
|
|
2638
|
+
) })
|
|
2639
|
+
] }),
|
|
2640
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2641
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
2642
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => loadTransactions(0, true), children: "Try again" }) })
|
|
2643
|
+
] }) : null,
|
|
2644
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading payments…" }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
2645
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
|
|
2646
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
|
|
2647
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
|
|
2648
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2649
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
2650
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
2651
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
2652
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
2653
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
|
|
2654
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
2655
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
2656
|
+
] }) }),
|
|
2657
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2658
|
+
"tr",
|
|
2659
|
+
{
|
|
2660
|
+
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
2661
|
+
onClick: () => navigate(`/payments/${t.payment_session_id}`),
|
|
2662
|
+
children: [
|
|
2663
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
|
|
2664
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
|
|
2665
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
|
|
2666
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2667
|
+
ui.Badge,
|
|
2668
|
+
{
|
|
2669
|
+
size: "2xsmall",
|
|
2670
|
+
className: `uppercase ${getStatusBadgeClass$6(displayStatus(t))}`,
|
|
2671
|
+
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
2672
|
+
}
|
|
2673
|
+
) }),
|
|
2674
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
|
|
2675
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
|
|
2676
|
+
year: "numeric",
|
|
2677
|
+
month: "short",
|
|
2678
|
+
day: "numeric",
|
|
2679
|
+
hour: "numeric",
|
|
2680
|
+
minute: "2-digit",
|
|
2681
|
+
hour12: true
|
|
2682
|
+
}) }),
|
|
2683
|
+
/* @__PURE__ */ jsxRuntime.jsxs("td", { className: "px-4 py-4", children: [
|
|
2684
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2685
|
+
ui.Button,
|
|
2686
|
+
{
|
|
2687
|
+
variant: "transparent",
|
|
2688
|
+
size: "small",
|
|
2689
|
+
onClick: (e) => {
|
|
2690
|
+
e.stopPropagation();
|
|
2691
|
+
navigate(`/payments/${t.payment_session_id}`);
|
|
2692
|
+
},
|
|
2693
|
+
children: "View details"
|
|
2694
|
+
}
|
|
2695
|
+
),
|
|
2696
|
+
t.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2697
|
+
ui.Button,
|
|
2698
|
+
{
|
|
2699
|
+
variant: "transparent",
|
|
2700
|
+
size: "small",
|
|
2701
|
+
onClick: (e) => {
|
|
2702
|
+
e.stopPropagation();
|
|
2703
|
+
navigate(`/orders/${t.order_id}`);
|
|
2704
|
+
},
|
|
2705
|
+
children: "Order"
|
|
2706
|
+
}
|
|
2707
|
+
) : null
|
|
2708
|
+
] })
|
|
2709
|
+
]
|
|
2710
|
+
},
|
|
2711
|
+
t.payment_session_id
|
|
2712
|
+
)) })
|
|
2713
|
+
] }) }),
|
|
2714
|
+
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2715
|
+
ui.Button,
|
|
2716
|
+
{
|
|
2717
|
+
variant: "secondary",
|
|
2718
|
+
isLoading: isFetchingMore,
|
|
2719
|
+
onClick: () => loadTransactions(offset, false),
|
|
2720
|
+
children: "Load more"
|
|
2721
|
+
}
|
|
2722
|
+
) }) : null
|
|
2723
|
+
] }) });
|
|
2724
|
+
};
|
|
2725
|
+
const config$6 = adminSdk.defineRouteConfig({
|
|
2726
|
+
label: "Payments",
|
|
2727
|
+
icon: icons.CreditCard
|
|
2728
|
+
});
|
|
2729
|
+
const useDebounce$1 = (value, delay) => {
|
|
2730
|
+
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
2731
|
+
react.useEffect(() => {
|
|
2732
|
+
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
2733
|
+
return () => clearTimeout(handler);
|
|
2734
|
+
}, [value, delay]);
|
|
2735
|
+
return debouncedValue;
|
|
2736
|
+
};
|
|
2737
|
+
const getStatusBadgeClass$5 = (status) => {
|
|
2520
2738
|
const statusLower = status.toLowerCase();
|
|
2521
2739
|
if (statusLower === "requested") {
|
|
2522
2740
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -2541,7 +2759,7 @@ const ReturnsPage = () => {
|
|
|
2541
2759
|
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
2542
2760
|
const [createdByFilter, setCreatedByFilter] = react.useState("all");
|
|
2543
2761
|
const [searchQuery, setSearchQuery] = react.useState("");
|
|
2544
|
-
const debouncedSearchQuery = useDebounce$
|
|
2762
|
+
const debouncedSearchQuery = useDebounce$1(searchQuery, 300);
|
|
2545
2763
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
2546
2764
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
2547
2765
|
const [error, setError] = react.useState(null);
|
|
@@ -2550,6 +2768,7 @@ const ReturnsPage = () => {
|
|
|
2550
2768
|
const limit = 50;
|
|
2551
2769
|
const loadReturns = react.useCallback(
|
|
2552
2770
|
async (nextOffset, replace = false) => {
|
|
2771
|
+
var _a;
|
|
2553
2772
|
try {
|
|
2554
2773
|
if (replace) {
|
|
2555
2774
|
setIsLoading(true);
|
|
@@ -2580,7 +2799,7 @@ const ReturnsPage = () => {
|
|
|
2580
2799
|
}
|
|
2581
2800
|
const payload = await response.json();
|
|
2582
2801
|
setCount(payload.count ?? 0);
|
|
2583
|
-
setOffset(nextOffset + (payload.returns
|
|
2802
|
+
setOffset(nextOffset + (((_a = payload.returns) == null ? void 0 : _a.length) ?? 0));
|
|
2584
2803
|
setItems(
|
|
2585
2804
|
(prev) => replace ? payload.returns ?? [] : [...prev, ...payload.returns ?? []]
|
|
2586
2805
|
);
|
|
@@ -2686,13 +2905,13 @@ const ReturnsPage = () => {
|
|
|
2686
2905
|
ui.Badge,
|
|
2687
2906
|
{
|
|
2688
2907
|
size: "2xsmall",
|
|
2689
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2908
|
+
className: `uppercase ${getStatusBadgeClass$5(returnOrder.status)}`,
|
|
2690
2909
|
children: returnOrder.status.replace(/_/g, " ")
|
|
2691
2910
|
}
|
|
2692
2911
|
) }),
|
|
2693
2912
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
|
|
2694
2913
|
const calc = returnOrder.refund;
|
|
2695
|
-
if (calc
|
|
2914
|
+
if ((calc == null ? void 0 : calc.is_processed) && calc.final_refund_amount != null) {
|
|
2696
2915
|
return formatRefundCurrency(
|
|
2697
2916
|
calc.final_refund_amount,
|
|
2698
2917
|
calc.currency_code || returnOrder.currency_code
|
|
@@ -2745,11 +2964,11 @@ const ReturnsPage = () => {
|
|
|
2745
2964
|
) }) : null
|
|
2746
2965
|
] }) });
|
|
2747
2966
|
};
|
|
2748
|
-
const config$
|
|
2967
|
+
const config$5 = adminSdk.defineRouteConfig({
|
|
2749
2968
|
label: "Return Orders",
|
|
2750
2969
|
icon: icons.ArrowPath
|
|
2751
2970
|
});
|
|
2752
|
-
const useDebounce
|
|
2971
|
+
const useDebounce = (value, delay) => {
|
|
2753
2972
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
2754
2973
|
react.useEffect(() => {
|
|
2755
2974
|
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
@@ -2757,7 +2976,7 @@ const useDebounce$1 = (value, delay) => {
|
|
|
2757
2976
|
}, [value, delay]);
|
|
2758
2977
|
return debouncedValue;
|
|
2759
2978
|
};
|
|
2760
|
-
const getStatusBadgeClass$
|
|
2979
|
+
const getStatusBadgeClass$4 = (status) => {
|
|
2761
2980
|
const statusLower = status.toLowerCase();
|
|
2762
2981
|
if (statusLower === "requested") {
|
|
2763
2982
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -2782,7 +3001,7 @@ const SwapsPage = () => {
|
|
|
2782
3001
|
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
2783
3002
|
const [createdByFilter, setCreatedByFilter] = react.useState("all");
|
|
2784
3003
|
const [searchQuery, setSearchQuery] = react.useState("");
|
|
2785
|
-
const debouncedSearchQuery = useDebounce
|
|
3004
|
+
const debouncedSearchQuery = useDebounce(searchQuery, 300);
|
|
2786
3005
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
2787
3006
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
2788
3007
|
const [error, setError] = react.useState(null);
|
|
@@ -2791,6 +3010,7 @@ const SwapsPage = () => {
|
|
|
2791
3010
|
const limit = 50;
|
|
2792
3011
|
const loadSwaps = react.useCallback(
|
|
2793
3012
|
async (nextOffset, replace = false) => {
|
|
3013
|
+
var _a;
|
|
2794
3014
|
try {
|
|
2795
3015
|
if (replace) {
|
|
2796
3016
|
setIsLoading(true);
|
|
@@ -2820,7 +3040,7 @@ const SwapsPage = () => {
|
|
|
2820
3040
|
}
|
|
2821
3041
|
const payload = await response.json();
|
|
2822
3042
|
setCount(payload.count ?? 0);
|
|
2823
|
-
setOffset(nextOffset + (payload.swaps
|
|
3043
|
+
setOffset(nextOffset + (((_a = payload.swaps) == null ? void 0 : _a.length) ?? 0));
|
|
2824
3044
|
setItems(
|
|
2825
3045
|
(prev) => replace ? payload.swaps ?? [] : [...prev, ...payload.swaps ?? []]
|
|
2826
3046
|
);
|
|
@@ -2924,7 +3144,7 @@ const SwapsPage = () => {
|
|
|
2924
3144
|
ui.Badge,
|
|
2925
3145
|
{
|
|
2926
3146
|
size: "2xsmall",
|
|
2927
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
3147
|
+
className: `uppercase ${getStatusBadgeClass$4(swap.status)}`,
|
|
2928
3148
|
children: swap.status.replace(/_/g, " ")
|
|
2929
3149
|
}
|
|
2930
3150
|
) }),
|
|
@@ -2974,235 +3194,35 @@ const SwapsPage = () => {
|
|
|
2974
3194
|
) }) : null
|
|
2975
3195
|
] }) });
|
|
2976
3196
|
};
|
|
2977
|
-
const config$
|
|
3197
|
+
const config$4 = adminSdk.defineRouteConfig({
|
|
2978
3198
|
label: "Exchanges",
|
|
2979
3199
|
icon: icons.ArrowPath
|
|
2980
3200
|
});
|
|
2981
|
-
const
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
const [offset, setOffset] = react.useState(0);
|
|
3007
|
-
const [count, setCount] = react.useState(0);
|
|
3008
|
-
const limit = 50;
|
|
3009
|
-
const loadTransactions = react.useCallback(
|
|
3010
|
-
async (nextOffset, replace) => {
|
|
3011
|
-
try {
|
|
3012
|
-
if (replace) setIsLoading(true);
|
|
3013
|
-
else setIsFetchingMore(true);
|
|
3014
|
-
setError(null);
|
|
3015
|
-
const params = new URLSearchParams();
|
|
3016
|
-
params.set("limit", String(limit));
|
|
3017
|
-
params.set("offset", String(nextOffset));
|
|
3018
|
-
if (statusFilter !== "all") params.set("status", statusFilter);
|
|
3019
|
-
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
3020
|
-
const response = await fetch(
|
|
3021
|
-
`/admin/payment-transactions?${params.toString()}`,
|
|
3022
|
-
{ credentials: "include" }
|
|
3023
|
-
);
|
|
3024
|
-
if (!response.ok) {
|
|
3025
|
-
const text = await response.text();
|
|
3026
|
-
throw new Error(text || "Failed to load payment transactions");
|
|
3027
|
-
}
|
|
3028
|
-
const payload = await response.json();
|
|
3029
|
-
const list = payload.transactions ?? [];
|
|
3030
|
-
setCount(payload.count ?? 0);
|
|
3031
|
-
setOffset(nextOffset + list.length);
|
|
3032
|
-
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
3033
|
-
} catch (e) {
|
|
3034
|
-
setError(e instanceof Error ? e.message : "Failed to load");
|
|
3035
|
-
} finally {
|
|
3036
|
-
setIsLoading(false);
|
|
3037
|
-
setIsFetchingMore(false);
|
|
3038
|
-
}
|
|
3039
|
-
},
|
|
3040
|
-
[statusFilter, debouncedOrderId]
|
|
3041
|
-
);
|
|
3042
|
-
react.useEffect(() => {
|
|
3043
|
-
void loadTransactions(0, true);
|
|
3044
|
-
}, [loadTransactions]);
|
|
3045
|
-
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
3046
|
-
const displayStatus = (t) => {
|
|
3047
|
-
const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
|
|
3048
|
-
return s2 !== "" ? s2 : "—";
|
|
3049
|
-
};
|
|
3050
|
-
const displayAmount = (t) => {
|
|
3051
|
-
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
3052
|
-
return `${code} ${Number(t.amount)}`;
|
|
3053
|
-
};
|
|
3054
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-7xl flex-col gap-6 p-6", children: [
|
|
3055
|
-
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
3056
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
3057
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payments" }),
|
|
3058
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
|
|
3059
|
-
] }),
|
|
3060
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
|
|
3061
|
-
] }),
|
|
3062
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
3063
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3064
|
-
ui.Input,
|
|
3065
|
-
{
|
|
3066
|
-
placeholder: "Search by Order ID",
|
|
3067
|
-
value: orderIdSearch,
|
|
3068
|
-
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
3069
|
-
className: "md:max-w-sm",
|
|
3070
|
-
"aria-label": "Search by order ID"
|
|
3071
|
-
}
|
|
3072
|
-
),
|
|
3073
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3074
|
-
"select",
|
|
3075
|
-
{
|
|
3076
|
-
value: statusFilter,
|
|
3077
|
-
onChange: (e) => setStatusFilter(e.target.value),
|
|
3078
|
-
className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-xs",
|
|
3079
|
-
"aria-label": "Filter by status",
|
|
3080
|
-
children: [
|
|
3081
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
3082
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
3083
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
3084
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "error", children: "Error" }),
|
|
3085
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
3086
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
3087
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
3088
|
-
]
|
|
3089
|
-
}
|
|
3090
|
-
) })
|
|
3091
|
-
] }),
|
|
3092
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
3093
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
3094
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => loadTransactions(0, true), children: "Try again" }) })
|
|
3095
|
-
] }) : null,
|
|
3096
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading payments…" }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
3097
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
|
|
3098
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
|
|
3099
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
|
|
3100
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
3101
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
3102
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
3103
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
3104
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
3105
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
|
|
3106
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
3107
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
3108
|
-
] }) }),
|
|
3109
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3110
|
-
"tr",
|
|
3111
|
-
{
|
|
3112
|
-
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
3113
|
-
onClick: () => navigate(`/payments/${t.payment_session_id}`),
|
|
3114
|
-
children: [
|
|
3115
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
|
|
3116
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
|
|
3117
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
|
|
3118
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3119
|
-
ui.Badge,
|
|
3120
|
-
{
|
|
3121
|
-
size: "2xsmall",
|
|
3122
|
-
className: `uppercase ${getStatusBadgeClass$4(displayStatus(t))}`,
|
|
3123
|
-
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
3124
|
-
}
|
|
3125
|
-
) }),
|
|
3126
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
|
|
3127
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
|
|
3128
|
-
year: "numeric",
|
|
3129
|
-
month: "short",
|
|
3130
|
-
day: "numeric",
|
|
3131
|
-
hour: "numeric",
|
|
3132
|
-
minute: "2-digit",
|
|
3133
|
-
hour12: true
|
|
3134
|
-
}) }),
|
|
3135
|
-
/* @__PURE__ */ jsxRuntime.jsxs("td", { className: "px-4 py-4", children: [
|
|
3136
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3137
|
-
ui.Button,
|
|
3138
|
-
{
|
|
3139
|
-
variant: "transparent",
|
|
3140
|
-
size: "small",
|
|
3141
|
-
onClick: (e) => {
|
|
3142
|
-
e.stopPropagation();
|
|
3143
|
-
navigate(`/payments/${t.payment_session_id}`);
|
|
3144
|
-
},
|
|
3145
|
-
children: "View details"
|
|
3146
|
-
}
|
|
3147
|
-
),
|
|
3148
|
-
t.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3149
|
-
ui.Button,
|
|
3150
|
-
{
|
|
3151
|
-
variant: "transparent",
|
|
3152
|
-
size: "small",
|
|
3153
|
-
onClick: (e) => {
|
|
3154
|
-
e.stopPropagation();
|
|
3155
|
-
navigate(`/orders/${t.order_id}`);
|
|
3156
|
-
},
|
|
3157
|
-
children: "Order"
|
|
3158
|
-
}
|
|
3159
|
-
) : null
|
|
3160
|
-
] })
|
|
3161
|
-
]
|
|
3162
|
-
},
|
|
3163
|
-
t.payment_session_id
|
|
3164
|
-
)) })
|
|
3165
|
-
] }) }),
|
|
3166
|
-
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3167
|
-
ui.Button,
|
|
3168
|
-
{
|
|
3169
|
-
variant: "secondary",
|
|
3170
|
-
isLoading: isFetchingMore,
|
|
3171
|
-
onClick: () => loadTransactions(offset, false),
|
|
3172
|
-
children: "Load more"
|
|
3173
|
-
}
|
|
3174
|
-
) }) : null
|
|
3175
|
-
] }) });
|
|
3176
|
-
};
|
|
3177
|
-
const config$5 = adminSdk.defineRouteConfig({
|
|
3178
|
-
label: "Payments",
|
|
3179
|
-
icon: icons.CreditCard
|
|
3180
|
-
});
|
|
3181
|
-
const MASKED_VALUE = "••••••••••••";
|
|
3182
|
-
const SENSITIVE_KEY_PATTERNS = [
|
|
3183
|
-
/password|passwd|passphrase/i,
|
|
3184
|
-
/secret/i,
|
|
3185
|
-
/token/i,
|
|
3186
|
-
/api_?key$/i,
|
|
3187
|
-
/private_?key/i,
|
|
3188
|
-
/access_?key/i,
|
|
3189
|
-
/(^|_)hash(ed)?($|_)/i,
|
|
3190
|
-
/(^|_)salt$/i,
|
|
3191
|
-
/^cvv$|^cvc$|security_code/i,
|
|
3192
|
-
/card_?number/i,
|
|
3193
|
-
/account_?number/i,
|
|
3194
|
-
/credential/i,
|
|
3195
|
-
/authorization/i,
|
|
3196
|
-
/recovery_?code/i,
|
|
3197
|
-
/(^|_)otp($|_)/i,
|
|
3198
|
-
/verification_?code/i,
|
|
3199
|
-
/^code_hash$/i,
|
|
3200
|
-
/webhook_?signature/i
|
|
3201
|
-
];
|
|
3202
|
-
const TABLE_SENSITIVE_KEYS = {
|
|
3203
|
-
otp_verification: /* @__PURE__ */ new Set(["code", "value"]),
|
|
3204
|
-
auth_verification: /* @__PURE__ */ new Set(["code", "value"]),
|
|
3205
|
-
auth_mfa_factor: /* @__PURE__ */ new Set(["value", "config"])
|
|
3201
|
+
const MASKED_VALUE = "••••••••••••";
|
|
3202
|
+
const SENSITIVE_KEY_PATTERNS = [
|
|
3203
|
+
/password|passwd|passphrase/i,
|
|
3204
|
+
/secret/i,
|
|
3205
|
+
/token/i,
|
|
3206
|
+
/api_?key$/i,
|
|
3207
|
+
/private_?key/i,
|
|
3208
|
+
/access_?key/i,
|
|
3209
|
+
/(^|_)hash(ed)?($|_)/i,
|
|
3210
|
+
/(^|_)salt$/i,
|
|
3211
|
+
/^cvv$|^cvc$|security_code/i,
|
|
3212
|
+
/card_?number/i,
|
|
3213
|
+
/account_?number/i,
|
|
3214
|
+
/credential/i,
|
|
3215
|
+
/authorization/i,
|
|
3216
|
+
/recovery_?code/i,
|
|
3217
|
+
/(^|_)otp($|_)/i,
|
|
3218
|
+
/verification_?code/i,
|
|
3219
|
+
/^code_hash$/i,
|
|
3220
|
+
/webhook_?signature/i
|
|
3221
|
+
];
|
|
3222
|
+
const TABLE_SENSITIVE_KEYS = {
|
|
3223
|
+
otp_verification: /* @__PURE__ */ new Set(["code", "value"]),
|
|
3224
|
+
auth_verification: /* @__PURE__ */ new Set(["code", "value"]),
|
|
3225
|
+
auth_mfa_factor: /* @__PURE__ */ new Set(["value", "config"])
|
|
3206
3226
|
};
|
|
3207
3227
|
const SAFE_KEYS = /* @__PURE__ */ new Set([
|
|
3208
3228
|
"token_type",
|
|
@@ -3219,12 +3239,13 @@ function isSensitiveKey(key) {
|
|
|
3219
3239
|
const FULLY_SECRET_TABLES = /* @__PURE__ */ new Set(["auth_mfa_recovery_code", "auth_password_reset_token"]);
|
|
3220
3240
|
const ALWAYS_VISIBLE_KEYS = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "deleted_at", "expires_at", "used_at"]);
|
|
3221
3241
|
function maskValue(value, ctx, depth) {
|
|
3242
|
+
var _a;
|
|
3222
3243
|
if (Array.isArray(value)) return value.map((item) => maskValue(item, ctx, depth + 1));
|
|
3223
3244
|
if (value !== null && typeof value === "object") {
|
|
3224
3245
|
const out = {};
|
|
3225
3246
|
for (const [key, inner] of Object.entries(value)) {
|
|
3226
3247
|
const topLevel = depth === 0;
|
|
3227
|
-
const secret = inner !== null && inner !== void 0 && inner !== "" && (isSensitiveKey(key) || topLevel && ctx.tableKeys
|
|
3248
|
+
const secret = inner !== null && inner !== void 0 && inner !== "" && (isSensitiveKey(key) || topLevel && ((_a = ctx.tableKeys) == null ? void 0 : _a.has(key.toLowerCase())) === true || topLevel && ctx.maskAll && !ALWAYS_VISIBLE_KEYS.has(key) && !key.endsWith("_id"));
|
|
3228
3249
|
if (secret) {
|
|
3229
3250
|
ctx.count += 1;
|
|
3230
3251
|
out[key] = MASKED_VALUE;
|
|
@@ -3690,12 +3711,13 @@ function readLastListSearch() {
|
|
|
3690
3711
|
}
|
|
3691
3712
|
}
|
|
3692
3713
|
const DeletedRecordDetailPage = () => {
|
|
3714
|
+
var _a;
|
|
3693
3715
|
const navigate = reactRouterDom.useNavigate();
|
|
3694
3716
|
const location = reactRouterDom.useLocation();
|
|
3695
3717
|
const { id = "" } = reactRouterDom.useParams();
|
|
3696
3718
|
const [state, setState] = react.useState({ status: "loading" });
|
|
3697
3719
|
const [reloadToken, setReloadToken] = react.useState(0);
|
|
3698
|
-
const cameFromList = location.state
|
|
3720
|
+
const cameFromList = ((_a = location.state) == null ? void 0 : _a.fromList) === true;
|
|
3699
3721
|
const goBack = () => {
|
|
3700
3722
|
if (cameFromList) navigate(-1);
|
|
3701
3723
|
else navigate(`/deleted-records-audit${readLastListSearch()}`);
|
|
@@ -3919,7 +3941,7 @@ const DetailError = ({
|
|
|
3919
3941
|
!notFound ? /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", size: "small", onClick: onRetry, children: "Try again" }) : null
|
|
3920
3942
|
] })
|
|
3921
3943
|
] });
|
|
3922
|
-
|
|
3944
|
+
adminSdk.defineRouteConfig({});
|
|
3923
3945
|
const getStatusBadgeClass$3 = (status) => {
|
|
3924
3946
|
const s2 = status.toLowerCase();
|
|
3925
3947
|
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
@@ -3932,9 +3954,10 @@ const formatAmount = (value) => {
|
|
|
3932
3954
|
return String(value);
|
|
3933
3955
|
};
|
|
3934
3956
|
const RefundDetailPage = () => {
|
|
3957
|
+
var _a, _b, _c;
|
|
3935
3958
|
const navigate = reactRouterDom.useNavigate();
|
|
3936
3959
|
const params = reactRouterDom.useParams();
|
|
3937
|
-
const id = params
|
|
3960
|
+
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
3938
3961
|
const [detail, setDetail] = react.useState(null);
|
|
3939
3962
|
const [loading, setLoading] = react.useState(!!id);
|
|
3940
3963
|
const [error, setError] = react.useState(null);
|
|
@@ -3961,8 +3984,8 @@ const RefundDetailPage = () => {
|
|
|
3961
3984
|
cancelled = true;
|
|
3962
3985
|
};
|
|
3963
3986
|
}, [id]);
|
|
3964
|
-
const paymentStatus = detail
|
|
3965
|
-
const hasGatewayData = detail
|
|
3987
|
+
const paymentStatus = ((_b = detail == null ? void 0 : detail.payment) == null ? void 0 : _b.status) ?? "—";
|
|
3988
|
+
const hasGatewayData = ((_c = detail == null ? void 0 : detail.payment) == null ? void 0 : _c.payment_data) && typeof detail.payment.payment_data === "object" && Object.keys(detail.payment.payment_data).length > 0;
|
|
3966
3989
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-4xl flex-col gap-6 p-6", children: [
|
|
3967
3990
|
/* @__PURE__ */ jsxRuntime.jsx("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
3968
3991
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/refunds"), children: "← Refunds" }),
|
|
@@ -4112,114 +4135,238 @@ const config$3 = adminSdk.defineRouteConfig({
|
|
|
4112
4135
|
icon: icons.Receipt
|
|
4113
4136
|
});
|
|
4114
4137
|
const getStatusBadgeClass$2 = (status) => {
|
|
4115
|
-
const
|
|
4116
|
-
if (
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
if (
|
|
4120
|
-
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
4121
|
-
}
|
|
4122
|
-
if (statusLower === "rejected") {
|
|
4123
|
-
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
4124
|
-
}
|
|
4125
|
-
if (statusLower === "received") {
|
|
4126
|
-
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
4127
|
-
}
|
|
4128
|
-
if (statusLower === "refunded") {
|
|
4129
|
-
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
4130
|
-
}
|
|
4131
|
-
if (statusLower === "completed") {
|
|
4132
|
-
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
4133
|
-
}
|
|
4134
|
-
if (statusLower === "cancelled") {
|
|
4135
|
-
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
4136
|
-
}
|
|
4138
|
+
const s2 = status.toLowerCase();
|
|
4139
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
4140
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
4141
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
4142
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
4137
4143
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
4138
4144
|
};
|
|
4139
|
-
const
|
|
4145
|
+
const PaymentDetailPage = () => {
|
|
4146
|
+
var _a;
|
|
4140
4147
|
const navigate = reactRouterDom.useNavigate();
|
|
4141
|
-
const
|
|
4142
|
-
const
|
|
4143
|
-
const [
|
|
4144
|
-
const [
|
|
4148
|
+
const params = reactRouterDom.useParams();
|
|
4149
|
+
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
4150
|
+
const [detail, setDetail] = react.useState(null);
|
|
4151
|
+
const [loading, setLoading] = react.useState(!!id);
|
|
4145
4152
|
const [error, setError] = react.useState(null);
|
|
4146
|
-
const [updateError, setUpdateError] = react.useState(null);
|
|
4147
|
-
const [updateSuccess, setUpdateSuccess] = react.useState(false);
|
|
4148
4153
|
react.useEffect(() => {
|
|
4149
4154
|
if (!id) {
|
|
4150
|
-
|
|
4155
|
+
setLoading(false);
|
|
4151
4156
|
return;
|
|
4152
4157
|
}
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4158
|
+
let cancelled = false;
|
|
4159
|
+
setLoading(true);
|
|
4160
|
+
setError(null);
|
|
4161
|
+
fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
|
|
4162
|
+
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
4163
|
+
return res.json();
|
|
4164
|
+
}).then((data) => {
|
|
4165
|
+
if (!cancelled) setDetail(data);
|
|
4166
|
+
}).catch((e) => {
|
|
4167
|
+
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
4168
|
+
}).finally(() => {
|
|
4169
|
+
if (!cancelled) setLoading(false);
|
|
4170
|
+
});
|
|
4171
|
+
return () => {
|
|
4172
|
+
cancelled = true;
|
|
4173
|
+
};
|
|
4174
|
+
}, [id]);
|
|
4175
|
+
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
4176
|
+
const sessionStatusRaw = (detail == null ? void 0 : detail.session_status) ?? "—";
|
|
4177
|
+
const paymentStatusRaw = (detail == null ? void 0 : detail.payment_id) != null ? (detail == null ? void 0 : detail.payment_status) ?? "—" : "—";
|
|
4178
|
+
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
4179
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-4xl flex-col gap-6 p-6", children: [
|
|
4180
|
+
/* @__PURE__ */ jsxRuntime.jsx("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
4181
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
4182
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payment session" }),
|
|
4183
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
|
|
4184
|
+
] }) }),
|
|
4185
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
4186
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
4187
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
|
|
4188
|
+
] }) : loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading…" }) }) : detail ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
4189
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-xl border border-ui-border-base p-6 flex flex-col gap-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4190
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4191
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
|
|
4192
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4193
|
+
ui.Button,
|
|
4194
|
+
{
|
|
4195
|
+
variant: "transparent",
|
|
4196
|
+
size: "small",
|
|
4197
|
+
onClick: () => navigate(`/orders/${detail.order_id}`),
|
|
4198
|
+
children: detail.order_id
|
|
4199
|
+
}
|
|
4200
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "—" }) })
|
|
4201
|
+
] }),
|
|
4202
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4203
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
4204
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: displayAmount })
|
|
4205
|
+
] }),
|
|
4206
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4207
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
4208
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.provider_id })
|
|
4209
|
+
] }),
|
|
4210
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4211
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
4212
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4213
|
+
ui.Badge,
|
|
4214
|
+
{
|
|
4215
|
+
size: "2xsmall",
|
|
4216
|
+
className: `uppercase ${getStatusBadgeClass$2(displayStatus)}`,
|
|
4217
|
+
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
4218
|
+
}
|
|
4219
|
+
) })
|
|
4220
|
+
] }),
|
|
4221
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4222
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
4223
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
4224
|
+
] }),
|
|
4225
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4226
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
4227
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
4228
|
+
] }),
|
|
4229
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4230
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
4231
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
4232
|
+
] }),
|
|
4233
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4234
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
4235
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
4236
|
+
year: "numeric",
|
|
4237
|
+
month: "short",
|
|
4238
|
+
day: "numeric",
|
|
4239
|
+
hour: "numeric",
|
|
4240
|
+
minute: "2-digit",
|
|
4241
|
+
hour12: true
|
|
4242
|
+
}) })
|
|
4243
|
+
] })
|
|
4244
|
+
] }) }),
|
|
4245
|
+
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4246
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
4247
|
+
/* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.data, null, 2) })
|
|
4248
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-xl border border-ui-border-base p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No provider data for this session." }) })
|
|
4249
|
+
] }) : null
|
|
4250
|
+
] }) });
|
|
4251
|
+
};
|
|
4252
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
4253
|
+
label: "Payment details",
|
|
4254
|
+
icon: icons.CreditCard
|
|
4255
|
+
});
|
|
4256
|
+
const getStatusBadgeClass$1 = (status) => {
|
|
4257
|
+
const statusLower = status.toLowerCase();
|
|
4258
|
+
if (statusLower === "requested") {
|
|
4259
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
4260
|
+
}
|
|
4261
|
+
if (statusLower === "approved") {
|
|
4262
|
+
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
4263
|
+
}
|
|
4264
|
+
if (statusLower === "rejected") {
|
|
4265
|
+
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
4266
|
+
}
|
|
4267
|
+
if (statusLower === "completed") {
|
|
4268
|
+
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
4269
|
+
}
|
|
4270
|
+
if (statusLower === "cancelled" || statusLower === "canceled") {
|
|
4271
|
+
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
4272
|
+
}
|
|
4273
|
+
if (statusLower === "pending") {
|
|
4274
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
4275
|
+
}
|
|
4276
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
4277
|
+
};
|
|
4278
|
+
const SwapDetailPage = () => {
|
|
4279
|
+
var _a, _b, _c;
|
|
4280
|
+
const navigate = reactRouterDom.useNavigate();
|
|
4281
|
+
const { id } = reactRouterDom.useParams();
|
|
4282
|
+
const [swap, setSwap] = react.useState(null);
|
|
4283
|
+
const [order, setOrder] = react.useState(null);
|
|
4284
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
4285
|
+
react.useState(false);
|
|
4286
|
+
const [isCancelling, setIsCancelling] = react.useState(false);
|
|
4287
|
+
const [error, setError] = react.useState(null);
|
|
4288
|
+
const [updateError, setUpdateError] = react.useState(null);
|
|
4289
|
+
const [updateSuccess, setUpdateSuccess] = react.useState(false);
|
|
4290
|
+
react.useEffect(() => {
|
|
4291
|
+
if (!id) {
|
|
4292
|
+
navigate("/swaps");
|
|
4293
|
+
return;
|
|
4294
|
+
}
|
|
4295
|
+
const loadSwap = async () => {
|
|
4296
|
+
try {
|
|
4297
|
+
setIsLoading(true);
|
|
4298
|
+
setError(null);
|
|
4299
|
+
const response = await fetch(`/admin/swaps/${id}`, {
|
|
4300
|
+
credentials: "include"
|
|
4301
|
+
});
|
|
4302
|
+
if (!response.ok) {
|
|
4303
|
+
const message = await response.text();
|
|
4304
|
+
throw new Error(message || "Unable to load swap");
|
|
4163
4305
|
}
|
|
4164
4306
|
const payload = await response.json();
|
|
4165
|
-
|
|
4307
|
+
setSwap(payload.swap);
|
|
4308
|
+
setOrder(payload.order || null);
|
|
4166
4309
|
} catch (loadError) {
|
|
4167
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load
|
|
4310
|
+
const message = loadError instanceof Error ? loadError.message : "Unable to load swap";
|
|
4168
4311
|
setError(message);
|
|
4169
4312
|
} finally {
|
|
4170
4313
|
setIsLoading(false);
|
|
4171
4314
|
}
|
|
4172
4315
|
};
|
|
4173
|
-
void
|
|
4316
|
+
void loadSwap();
|
|
4174
4317
|
}, [id, navigate]);
|
|
4175
|
-
const
|
|
4318
|
+
const handleCancelExchange = async () => {
|
|
4176
4319
|
if (!id) {
|
|
4177
4320
|
return;
|
|
4178
4321
|
}
|
|
4179
4322
|
try {
|
|
4180
|
-
|
|
4323
|
+
setIsCancelling(true);
|
|
4181
4324
|
setUpdateError(null);
|
|
4182
4325
|
setUpdateSuccess(false);
|
|
4183
|
-
const response = await fetch(`/admin/
|
|
4326
|
+
const response = await fetch(`/admin/swaps/${id}/cancel`, {
|
|
4184
4327
|
method: "POST",
|
|
4185
4328
|
headers: {
|
|
4186
4329
|
"Content-Type": "application/json"
|
|
4187
4330
|
},
|
|
4188
|
-
credentials: "include"
|
|
4189
|
-
body: JSON.stringify({ reason: "Rejected by admin" })
|
|
4331
|
+
credentials: "include"
|
|
4190
4332
|
});
|
|
4191
4333
|
if (!response.ok) {
|
|
4192
4334
|
const message = await response.text();
|
|
4193
|
-
throw new Error(message || "Unable to
|
|
4335
|
+
throw new Error(message || "Unable to cancel exchange");
|
|
4194
4336
|
}
|
|
4195
4337
|
const payload = await response.json();
|
|
4196
|
-
|
|
4338
|
+
setSwap(payload.swap);
|
|
4197
4339
|
setUpdateSuccess(true);
|
|
4198
4340
|
setTimeout(() => setUpdateSuccess(false), 3e3);
|
|
4199
|
-
const detailResponse = await fetch(`/admin/
|
|
4341
|
+
const detailResponse = await fetch(`/admin/swaps/${id}`, {
|
|
4200
4342
|
credentials: "include"
|
|
4201
4343
|
});
|
|
4202
4344
|
if (detailResponse.ok) {
|
|
4203
4345
|
const detailPayload = await detailResponse.json();
|
|
4204
|
-
|
|
4346
|
+
setSwap(detailPayload.swap);
|
|
4347
|
+
setOrder(detailPayload.order || null);
|
|
4205
4348
|
}
|
|
4206
|
-
} catch (
|
|
4207
|
-
const message =
|
|
4349
|
+
} catch (cancelErr) {
|
|
4350
|
+
const message = cancelErr instanceof Error ? cancelErr.message : "Unable to cancel exchange";
|
|
4208
4351
|
setUpdateError(message);
|
|
4209
4352
|
} finally {
|
|
4210
|
-
|
|
4353
|
+
setIsCancelling(false);
|
|
4211
4354
|
}
|
|
4212
4355
|
};
|
|
4356
|
+
const isOrderExchange = Boolean(swap == null ? void 0 : swap.exchange_id);
|
|
4357
|
+
const canCancelExchange = isOrderExchange && swap && !["cancelled", "canceled", "completed", "declined"].includes(
|
|
4358
|
+
((_a = swap.status) == null ? void 0 : _a.toLowerCase()) ?? ""
|
|
4359
|
+
);
|
|
4213
4360
|
if (isLoading) {
|
|
4214
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading
|
|
4361
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading swap..." }) }) }) });
|
|
4215
4362
|
}
|
|
4216
|
-
if (error || !
|
|
4363
|
+
if (error || !swap) {
|
|
4217
4364
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
4218
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "
|
|
4219
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => navigate("/
|
|
4365
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Swap not found" }),
|
|
4366
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => navigate("/swaps"), children: "Back to list" }) })
|
|
4220
4367
|
] }) }) });
|
|
4221
4368
|
}
|
|
4222
|
-
const statusHistory =
|
|
4369
|
+
const statusHistory = ((_b = swap.metadata) == null ? void 0 : _b.status_history) || [];
|
|
4223
4370
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: [
|
|
4224
4371
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3", children: [
|
|
4225
4372
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4227,7 +4374,7 @@ const ReturnDetailPage = () => {
|
|
|
4227
4374
|
{
|
|
4228
4375
|
variant: "transparent",
|
|
4229
4376
|
size: "small",
|
|
4230
|
-
onClick: () => navigate("/
|
|
4377
|
+
onClick: () => navigate("/swaps"),
|
|
4231
4378
|
className: "w-fit",
|
|
4232
4379
|
children: [
|
|
4233
4380
|
/* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, { className: "mr-2" }),
|
|
@@ -4237,82 +4384,67 @@ const ReturnDetailPage = () => {
|
|
|
4237
4384
|
),
|
|
4238
4385
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
|
|
4239
4386
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
4240
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
4241
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children:
|
|
4387
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Exchange Details" }),
|
|
4388
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: swap.id })
|
|
4242
4389
|
] }),
|
|
4243
4390
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4244
4391
|
ui.Badge,
|
|
4245
4392
|
{
|
|
4246
4393
|
size: "small",
|
|
4247
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
4248
|
-
children:
|
|
4394
|
+
className: `uppercase ${getStatusBadgeClass$1(swap.status)}`,
|
|
4395
|
+
children: swap.status.replace(/_/g, " ")
|
|
4249
4396
|
}
|
|
4250
4397
|
)
|
|
4251
4398
|
] })
|
|
4252
4399
|
] }),
|
|
4253
|
-
|
|
4400
|
+
canCancelExchange && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
4254
4401
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4255
4402
|
ui.Button,
|
|
4256
4403
|
{
|
|
4257
4404
|
variant: "danger",
|
|
4258
|
-
onClick:
|
|
4259
|
-
disabled:
|
|
4260
|
-
isLoading:
|
|
4261
|
-
children: "
|
|
4405
|
+
onClick: handleCancelExchange,
|
|
4406
|
+
disabled: isCancelling,
|
|
4407
|
+
isLoading: isCancelling,
|
|
4408
|
+
children: "Cancel Exchange"
|
|
4262
4409
|
}
|
|
4263
4410
|
) }),
|
|
4264
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children:
|
|
4265
|
-
] }),
|
|
4266
|
-
returnOrder.refund ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: /* @__PURE__ */ jsxRuntime.jsx(RefundCalculationBlock, { refund: returnOrder.refund }) }) : null,
|
|
4267
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
4268
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Information" }),
|
|
4269
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
4270
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4271
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
|
|
4272
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.id })
|
|
4273
|
-
] }),
|
|
4274
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4275
|
-
ui.Button,
|
|
4276
|
-
{
|
|
4277
|
-
variant: "secondary",
|
|
4278
|
-
onClick: () => {
|
|
4279
|
-
window.open(
|
|
4280
|
-
`/app/orders/${returnOrder.order_id}`,
|
|
4281
|
-
"_blank"
|
|
4282
|
-
);
|
|
4283
|
-
},
|
|
4284
|
-
children: "View order"
|
|
4285
|
-
}
|
|
4286
|
-
) })
|
|
4287
|
-
] })
|
|
4411
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This will cancel the exchange request. The order will remain unchanged." })
|
|
4288
4412
|
] }),
|
|
4289
4413
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
|
|
4290
4414
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
4291
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "
|
|
4415
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Exchange Information" }),
|
|
4292
4416
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
4293
4417
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4294
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "
|
|
4295
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
4418
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
|
|
4419
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.id })
|
|
4296
4420
|
] }),
|
|
4297
4421
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4298
4422
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
|
|
4299
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
4423
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.status })
|
|
4300
4424
|
] }),
|
|
4301
|
-
|
|
4425
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4426
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Difference Due" }),
|
|
4427
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.difference_due != null ? `${swap.currency_code || "$"}${(Number(swap.difference_due) / 100).toFixed(2)}` : "—" })
|
|
4428
|
+
] }),
|
|
4429
|
+
swap.reason && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4302
4430
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
|
|
4303
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
4431
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.reason })
|
|
4304
4432
|
] }),
|
|
4305
|
-
|
|
4433
|
+
swap.note && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4306
4434
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
|
|
4307
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
4435
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.note })
|
|
4308
4436
|
] }),
|
|
4309
4437
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4310
4438
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
|
|
4311
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(
|
|
4439
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(swap.created_at).toLocaleString() })
|
|
4312
4440
|
] }),
|
|
4313
4441
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4314
4442
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
|
|
4315
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(
|
|
4443
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(swap.updated_at).toLocaleString() })
|
|
4444
|
+
] }),
|
|
4445
|
+
swap.exchange_id && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4446
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
|
|
4447
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.exchange_id })
|
|
4316
4448
|
] })
|
|
4317
4449
|
] })
|
|
4318
4450
|
] }),
|
|
@@ -4327,7 +4459,7 @@ const ReturnDetailPage = () => {
|
|
|
4327
4459
|
ui.Badge,
|
|
4328
4460
|
{
|
|
4329
4461
|
size: "2xsmall",
|
|
4330
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
4462
|
+
className: `uppercase ${getStatusBadgeClass$1(entry.status)}`,
|
|
4331
4463
|
children: entry.status.replace(/_/g, " ")
|
|
4332
4464
|
}
|
|
4333
4465
|
) }),
|
|
@@ -4342,35 +4474,31 @@ const ReturnDetailPage = () => {
|
|
|
4342
4474
|
)) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
|
|
4343
4475
|
] })
|
|
4344
4476
|
] }),
|
|
4345
|
-
|
|
4477
|
+
order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
4346
4478
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
|
|
4347
4479
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
4348
4480
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4349
4481
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
|
|
4350
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
4482
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.id })
|
|
4351
4483
|
] }),
|
|
4352
4484
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4353
4485
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
|
|
4354
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
4486
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.status || "—" })
|
|
4355
4487
|
] }),
|
|
4356
4488
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4357
4489
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
4358
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
4359
|
-
] }),
|
|
4360
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4361
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Payment method" }),
|
|
4362
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.order_payment?.label || "—" })
|
|
4490
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_c = order.customer) == null ? void 0 : _c.email) || order.email || "—" })
|
|
4363
4491
|
] }),
|
|
4364
|
-
|
|
4492
|
+
order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4365
4493
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
4366
4494
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "font-medium", children: [
|
|
4367
|
-
|
|
4368
|
-
(Number(
|
|
4495
|
+
order.currency_code || "$",
|
|
4496
|
+
(Number(order.total) / 100).toFixed(2)
|
|
4369
4497
|
] })
|
|
4370
4498
|
] })
|
|
4371
4499
|
] })
|
|
4372
4500
|
] }),
|
|
4373
|
-
|
|
4501
|
+
swap.return_items && swap.return_items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
4374
4502
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
4375
4503
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
|
|
4376
4504
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
@@ -4378,22 +4506,33 @@ const ReturnDetailPage = () => {
|
|
|
4378
4506
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
|
|
4379
4507
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
|
|
4380
4508
|
] }) }),
|
|
4381
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children:
|
|
4509
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.return_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
4382
4510
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
4383
4511
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
4384
4512
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
4385
4513
|
] }, item.id || index)) })
|
|
4386
4514
|
] }) })
|
|
4387
4515
|
] }),
|
|
4388
|
-
|
|
4389
|
-
|
|
4516
|
+
swap.new_items && swap.new_items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
4517
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "New Items" }),
|
|
4518
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
|
|
4519
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
4520
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Variant ID" }),
|
|
4521
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
|
|
4522
|
+
] }) }),
|
|
4523
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.new_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
4524
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.variant_id }),
|
|
4525
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
|
|
4526
|
+
] }, item.variant_id || index)) })
|
|
4527
|
+
] }) })
|
|
4528
|
+
] })
|
|
4390
4529
|
] }) });
|
|
4391
4530
|
};
|
|
4392
|
-
const config$
|
|
4393
|
-
label: "
|
|
4394
|
-
icon: icons.
|
|
4531
|
+
const config$1 = adminSdk.defineRouteConfig({
|
|
4532
|
+
label: "Swap Details",
|
|
4533
|
+
icon: icons.ArrowPath
|
|
4395
4534
|
});
|
|
4396
|
-
const getStatusBadgeClass
|
|
4535
|
+
const getStatusBadgeClass = (status) => {
|
|
4397
4536
|
const statusLower = status.toLowerCase();
|
|
4398
4537
|
if (statusLower === "requested") {
|
|
4399
4538
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -4404,108 +4543,105 @@ const getStatusBadgeClass$1 = (status) => {
|
|
|
4404
4543
|
if (statusLower === "rejected") {
|
|
4405
4544
|
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
4406
4545
|
}
|
|
4546
|
+
if (statusLower === "received") {
|
|
4547
|
+
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
4548
|
+
}
|
|
4549
|
+
if (statusLower === "refunded") {
|
|
4550
|
+
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
4551
|
+
}
|
|
4407
4552
|
if (statusLower === "completed") {
|
|
4408
4553
|
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
4409
4554
|
}
|
|
4410
|
-
if (statusLower === "cancelled"
|
|
4555
|
+
if (statusLower === "cancelled") {
|
|
4411
4556
|
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
4412
4557
|
}
|
|
4413
|
-
if (statusLower === "pending") {
|
|
4414
|
-
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
4415
|
-
}
|
|
4416
4558
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
4417
4559
|
};
|
|
4418
|
-
const
|
|
4560
|
+
const ReturnDetailPage = () => {
|
|
4561
|
+
var _a, _b, _c;
|
|
4419
4562
|
const navigate = reactRouterDom.useNavigate();
|
|
4420
4563
|
const { id } = reactRouterDom.useParams();
|
|
4421
|
-
const [
|
|
4422
|
-
const [order, setOrder] = react.useState(null);
|
|
4564
|
+
const [returnOrder, setReturnOrder] = react.useState(null);
|
|
4423
4565
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
4424
4566
|
const [isRejecting, setIsRejecting] = react.useState(false);
|
|
4425
|
-
const [isCancelling, setIsCancelling] = react.useState(false);
|
|
4426
4567
|
const [error, setError] = react.useState(null);
|
|
4427
4568
|
const [updateError, setUpdateError] = react.useState(null);
|
|
4428
4569
|
const [updateSuccess, setUpdateSuccess] = react.useState(false);
|
|
4429
4570
|
react.useEffect(() => {
|
|
4430
4571
|
if (!id) {
|
|
4431
|
-
navigate("/
|
|
4572
|
+
navigate("/returns");
|
|
4432
4573
|
return;
|
|
4433
4574
|
}
|
|
4434
|
-
const
|
|
4575
|
+
const loadReturn = async () => {
|
|
4435
4576
|
try {
|
|
4436
4577
|
setIsLoading(true);
|
|
4437
4578
|
setError(null);
|
|
4438
|
-
const response = await fetch(`/admin/
|
|
4579
|
+
const response = await fetch(`/admin/return/${id}`, {
|
|
4439
4580
|
credentials: "include"
|
|
4440
4581
|
});
|
|
4441
4582
|
if (!response.ok) {
|
|
4442
4583
|
const message = await response.text();
|
|
4443
|
-
throw new Error(message || "Unable to load
|
|
4584
|
+
throw new Error(message || "Unable to load return order");
|
|
4444
4585
|
}
|
|
4445
4586
|
const payload = await response.json();
|
|
4446
|
-
|
|
4447
|
-
setOrder(payload.order || null);
|
|
4587
|
+
setReturnOrder(payload.return);
|
|
4448
4588
|
} catch (loadError) {
|
|
4449
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load
|
|
4589
|
+
const message = loadError instanceof Error ? loadError.message : "Unable to load return order";
|
|
4450
4590
|
setError(message);
|
|
4451
4591
|
} finally {
|
|
4452
4592
|
setIsLoading(false);
|
|
4453
4593
|
}
|
|
4454
4594
|
};
|
|
4455
|
-
void
|
|
4595
|
+
void loadReturn();
|
|
4456
4596
|
}, [id, navigate]);
|
|
4457
|
-
const
|
|
4597
|
+
const handleReject = async () => {
|
|
4458
4598
|
if (!id) {
|
|
4459
4599
|
return;
|
|
4460
4600
|
}
|
|
4461
4601
|
try {
|
|
4462
|
-
|
|
4602
|
+
setIsRejecting(true);
|
|
4463
4603
|
setUpdateError(null);
|
|
4464
4604
|
setUpdateSuccess(false);
|
|
4465
|
-
const response = await fetch(`/admin/
|
|
4605
|
+
const response = await fetch(`/admin/return/${id}/reject`, {
|
|
4466
4606
|
method: "POST",
|
|
4467
4607
|
headers: {
|
|
4468
4608
|
"Content-Type": "application/json"
|
|
4469
4609
|
},
|
|
4470
|
-
credentials: "include"
|
|
4610
|
+
credentials: "include",
|
|
4611
|
+
body: JSON.stringify({ reason: "Rejected by admin" })
|
|
4471
4612
|
});
|
|
4472
4613
|
if (!response.ok) {
|
|
4473
4614
|
const message = await response.text();
|
|
4474
|
-
throw new Error(message || "Unable to
|
|
4615
|
+
throw new Error(message || "Unable to reject return");
|
|
4475
4616
|
}
|
|
4476
4617
|
const payload = await response.json();
|
|
4477
|
-
|
|
4618
|
+
setReturnOrder(payload.return);
|
|
4478
4619
|
setUpdateSuccess(true);
|
|
4479
4620
|
setTimeout(() => setUpdateSuccess(false), 3e3);
|
|
4480
|
-
const detailResponse = await fetch(`/admin/
|
|
4621
|
+
const detailResponse = await fetch(`/admin/return/${id}`, {
|
|
4481
4622
|
credentials: "include"
|
|
4482
4623
|
});
|
|
4483
4624
|
if (detailResponse.ok) {
|
|
4484
4625
|
const detailPayload = await detailResponse.json();
|
|
4485
|
-
|
|
4486
|
-
setOrder(detailPayload.order || null);
|
|
4626
|
+
setReturnOrder(detailPayload.return);
|
|
4487
4627
|
}
|
|
4488
|
-
} catch (
|
|
4489
|
-
const message =
|
|
4628
|
+
} catch (updateErr) {
|
|
4629
|
+
const message = updateErr instanceof Error ? updateErr.message : "Unable to reject return";
|
|
4490
4630
|
setUpdateError(message);
|
|
4491
4631
|
} finally {
|
|
4492
|
-
|
|
4632
|
+
setIsRejecting(false);
|
|
4493
4633
|
}
|
|
4494
4634
|
};
|
|
4495
|
-
const isOrderExchange = Boolean(swap?.exchange_id);
|
|
4496
|
-
const canCancelExchange = isOrderExchange && swap && !["cancelled", "canceled", "completed", "declined"].includes(
|
|
4497
|
-
swap.status?.toLowerCase() ?? ""
|
|
4498
|
-
);
|
|
4499
4635
|
if (isLoading) {
|
|
4500
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading
|
|
4636
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading return order..." }) }) }) });
|
|
4501
4637
|
}
|
|
4502
|
-
if (error || !
|
|
4638
|
+
if (error || !returnOrder) {
|
|
4503
4639
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
4504
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "
|
|
4505
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => navigate("/
|
|
4640
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Return order not found" }),
|
|
4641
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => navigate("/returns"), children: "Back to list" }) })
|
|
4506
4642
|
] }) }) });
|
|
4507
4643
|
}
|
|
4508
|
-
const statusHistory =
|
|
4644
|
+
const statusHistory = ((_a = returnOrder.metadata) == null ? void 0 : _a.status_history) || [];
|
|
4509
4645
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: [
|
|
4510
4646
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3", children: [
|
|
4511
4647
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4513,7 +4649,7 @@ const SwapDetailPage = () => {
|
|
|
4513
4649
|
{
|
|
4514
4650
|
variant: "transparent",
|
|
4515
4651
|
size: "small",
|
|
4516
|
-
onClick: () => navigate("/
|
|
4652
|
+
onClick: () => navigate("/returns"),
|
|
4517
4653
|
className: "w-fit",
|
|
4518
4654
|
children: [
|
|
4519
4655
|
/* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, { className: "mr-2" }),
|
|
@@ -4523,67 +4659,82 @@ const SwapDetailPage = () => {
|
|
|
4523
4659
|
),
|
|
4524
4660
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
|
|
4525
4661
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
4526
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
4527
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children:
|
|
4662
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Return Order Details" }),
|
|
4663
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: returnOrder.id })
|
|
4528
4664
|
] }),
|
|
4529
4665
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4530
4666
|
ui.Badge,
|
|
4531
4667
|
{
|
|
4532
4668
|
size: "small",
|
|
4533
|
-
className: `uppercase ${getStatusBadgeClass
|
|
4534
|
-
children:
|
|
4669
|
+
className: `uppercase ${getStatusBadgeClass(returnOrder.status)}`,
|
|
4670
|
+
children: returnOrder.status.replace(/_/g, " ")
|
|
4671
|
+
}
|
|
4672
|
+
)
|
|
4673
|
+
] })
|
|
4674
|
+
] }),
|
|
4675
|
+
returnOrder.status === "requested" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
4676
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4677
|
+
ui.Button,
|
|
4678
|
+
{
|
|
4679
|
+
variant: "danger",
|
|
4680
|
+
onClick: handleReject,
|
|
4681
|
+
disabled: isRejecting,
|
|
4682
|
+
isLoading: isRejecting,
|
|
4683
|
+
children: "Reject (Cancel) Return"
|
|
4684
|
+
}
|
|
4685
|
+
) }),
|
|
4686
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: 'Cancel this return request. Use "Mark as received" when items are received.' })
|
|
4687
|
+
] }),
|
|
4688
|
+
returnOrder.refund ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: /* @__PURE__ */ jsxRuntime.jsx(RefundCalculationBlock, { refund: returnOrder.refund }) }) : null,
|
|
4689
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
4690
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Information" }),
|
|
4691
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
4692
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4693
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
|
|
4694
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.id })
|
|
4695
|
+
] }),
|
|
4696
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4697
|
+
ui.Button,
|
|
4698
|
+
{
|
|
4699
|
+
variant: "secondary",
|
|
4700
|
+
onClick: () => {
|
|
4701
|
+
window.open(
|
|
4702
|
+
`/app/orders/${returnOrder.order_id}`,
|
|
4703
|
+
"_blank"
|
|
4704
|
+
);
|
|
4705
|
+
},
|
|
4706
|
+
children: "View order"
|
|
4535
4707
|
}
|
|
4536
|
-
)
|
|
4708
|
+
) })
|
|
4537
4709
|
] })
|
|
4538
4710
|
] }),
|
|
4539
|
-
canCancelExchange && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
4540
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4541
|
-
ui.Button,
|
|
4542
|
-
{
|
|
4543
|
-
variant: "danger",
|
|
4544
|
-
onClick: handleCancelExchange,
|
|
4545
|
-
disabled: isCancelling,
|
|
4546
|
-
isLoading: isCancelling,
|
|
4547
|
-
children: "Cancel Exchange"
|
|
4548
|
-
}
|
|
4549
|
-
) }),
|
|
4550
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This will cancel the exchange request. The order will remain unchanged." })
|
|
4551
|
-
] }),
|
|
4552
4711
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
|
|
4553
4712
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
4554
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "
|
|
4713
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Details" }),
|
|
4555
4714
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
4556
4715
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4557
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "
|
|
4558
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
4716
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
|
|
4717
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.id })
|
|
4559
4718
|
] }),
|
|
4560
4719
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4561
4720
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
|
|
4562
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
4563
|
-
] }),
|
|
4564
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4565
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Difference Due" }),
|
|
4566
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.difference_due != null ? `${swap.currency_code || "$"}${(Number(swap.difference_due) / 100).toFixed(2)}` : "—" })
|
|
4721
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.status })
|
|
4567
4722
|
] }),
|
|
4568
|
-
|
|
4723
|
+
returnOrder.reason && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4569
4724
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
|
|
4570
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
4725
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.reason })
|
|
4571
4726
|
] }),
|
|
4572
|
-
|
|
4727
|
+
returnOrder.note && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4573
4728
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
|
|
4574
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
4729
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.note })
|
|
4575
4730
|
] }),
|
|
4576
4731
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4577
4732
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
|
|
4578
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(
|
|
4733
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(returnOrder.created_at).toLocaleString() })
|
|
4579
4734
|
] }),
|
|
4580
4735
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4581
4736
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
|
|
4582
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(
|
|
4583
|
-
] }),
|
|
4584
|
-
swap.exchange_id && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4585
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
|
|
4586
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.exchange_id })
|
|
4737
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(returnOrder.updated_at).toLocaleString() })
|
|
4587
4738
|
] })
|
|
4588
4739
|
] })
|
|
4589
4740
|
] }),
|
|
@@ -4598,7 +4749,7 @@ const SwapDetailPage = () => {
|
|
|
4598
4749
|
ui.Badge,
|
|
4599
4750
|
{
|
|
4600
4751
|
size: "2xsmall",
|
|
4601
|
-
className: `uppercase ${getStatusBadgeClass
|
|
4752
|
+
className: `uppercase ${getStatusBadgeClass(entry.status)}`,
|
|
4602
4753
|
children: entry.status.replace(/_/g, " ")
|
|
4603
4754
|
}
|
|
4604
4755
|
) }),
|
|
@@ -4613,31 +4764,35 @@ const SwapDetailPage = () => {
|
|
|
4613
4764
|
)) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
|
|
4614
4765
|
] })
|
|
4615
4766
|
] }),
|
|
4616
|
-
order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
4767
|
+
returnOrder.order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
4617
4768
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
|
|
4618
4769
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
4619
4770
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4620
4771
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
|
|
4621
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.id })
|
|
4772
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.id })
|
|
4622
4773
|
] }),
|
|
4623
4774
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4624
4775
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
|
|
4625
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.status || "—" })
|
|
4776
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.status || "—" })
|
|
4626
4777
|
] }),
|
|
4627
4778
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4628
4779
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
4629
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.customer
|
|
4780
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_b = returnOrder.order.customer) == null ? void 0 : _b.email) || returnOrder.order.email || "—" })
|
|
4630
4781
|
] }),
|
|
4631
|
-
|
|
4782
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4783
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Payment method" }),
|
|
4784
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_c = returnOrder.order.order_payment) == null ? void 0 : _c.label) || "—" })
|
|
4785
|
+
] }),
|
|
4786
|
+
returnOrder.order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4632
4787
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
4633
4788
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "font-medium", children: [
|
|
4634
|
-
order.currency_code || "$",
|
|
4635
|
-
(Number(order.total) / 100).toFixed(2)
|
|
4789
|
+
returnOrder.order.currency_code || "$",
|
|
4790
|
+
(Number(returnOrder.order.total) / 100).toFixed(2)
|
|
4636
4791
|
] })
|
|
4637
4792
|
] })
|
|
4638
4793
|
] })
|
|
4639
4794
|
] }),
|
|
4640
|
-
|
|
4795
|
+
returnOrder.return_items && returnOrder.return_items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
4641
4796
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
4642
4797
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
|
|
4643
4798
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
@@ -4645,290 +4800,131 @@ const SwapDetailPage = () => {
|
|
|
4645
4800
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
|
|
4646
4801
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
|
|
4647
4802
|
] }) }),
|
|
4648
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children:
|
|
4803
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: returnOrder.return_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
4649
4804
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
4650
4805
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
4651
4806
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
4652
4807
|
] }, item.id || index)) })
|
|
4653
4808
|
] }) })
|
|
4654
4809
|
] }),
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
|
|
4658
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
4659
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Variant ID" }),
|
|
4660
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
|
|
4661
|
-
] }) }),
|
|
4662
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.new_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
4663
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.variant_id }),
|
|
4664
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
|
|
4665
|
-
] }, item.variant_id || index)) })
|
|
4666
|
-
] }) })
|
|
4667
|
-
] })
|
|
4668
|
-
] }) });
|
|
4669
|
-
};
|
|
4670
|
-
const config$1 = adminSdk.defineRouteConfig({
|
|
4671
|
-
label: "Swap Details",
|
|
4672
|
-
icon: icons.ArrowPath
|
|
4673
|
-
});
|
|
4674
|
-
const getStatusBadgeClass = (status) => {
|
|
4675
|
-
const s2 = status.toLowerCase();
|
|
4676
|
-
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
4677
|
-
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
4678
|
-
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
4679
|
-
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
4680
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
4681
|
-
};
|
|
4682
|
-
const PaymentDetailPage = () => {
|
|
4683
|
-
const navigate = reactRouterDom.useNavigate();
|
|
4684
|
-
const params = reactRouterDom.useParams();
|
|
4685
|
-
const id = params?.id?.trim();
|
|
4686
|
-
const [detail, setDetail] = react.useState(null);
|
|
4687
|
-
const [loading, setLoading] = react.useState(!!id);
|
|
4688
|
-
const [error, setError] = react.useState(null);
|
|
4689
|
-
react.useEffect(() => {
|
|
4690
|
-
if (!id) {
|
|
4691
|
-
setLoading(false);
|
|
4692
|
-
return;
|
|
4693
|
-
}
|
|
4694
|
-
let cancelled = false;
|
|
4695
|
-
setLoading(true);
|
|
4696
|
-
setError(null);
|
|
4697
|
-
fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
|
|
4698
|
-
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
4699
|
-
return res.json();
|
|
4700
|
-
}).then((data) => {
|
|
4701
|
-
if (!cancelled) setDetail(data);
|
|
4702
|
-
}).catch((e) => {
|
|
4703
|
-
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
4704
|
-
}).finally(() => {
|
|
4705
|
-
if (!cancelled) setLoading(false);
|
|
4706
|
-
});
|
|
4707
|
-
return () => {
|
|
4708
|
-
cancelled = true;
|
|
4709
|
-
};
|
|
4710
|
-
}, [id]);
|
|
4711
|
-
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
4712
|
-
const sessionStatusRaw = detail?.session_status ?? "—";
|
|
4713
|
-
const paymentStatusRaw = detail?.payment_id != null ? detail?.payment_status ?? "—" : "—";
|
|
4714
|
-
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
4715
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-4xl flex-col gap-6 p-6", children: [
|
|
4716
|
-
/* @__PURE__ */ jsxRuntime.jsx("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
4717
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
4718
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payment session" }),
|
|
4719
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
|
|
4720
|
-
] }) }),
|
|
4721
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
4722
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
4723
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
|
|
4724
|
-
] }) : loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading…" }) }) : detail ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
4725
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-xl border border-ui-border-base p-6 flex flex-col gap-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4726
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4727
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
|
|
4728
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4729
|
-
ui.Button,
|
|
4730
|
-
{
|
|
4731
|
-
variant: "transparent",
|
|
4732
|
-
size: "small",
|
|
4733
|
-
onClick: () => navigate(`/orders/${detail.order_id}`),
|
|
4734
|
-
children: detail.order_id
|
|
4735
|
-
}
|
|
4736
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "—" }) })
|
|
4737
|
-
] }),
|
|
4738
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4739
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
4740
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: displayAmount })
|
|
4741
|
-
] }),
|
|
4742
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4743
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
4744
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.provider_id })
|
|
4745
|
-
] }),
|
|
4746
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4747
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
4748
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4749
|
-
ui.Badge,
|
|
4750
|
-
{
|
|
4751
|
-
size: "2xsmall",
|
|
4752
|
-
className: `uppercase ${getStatusBadgeClass(displayStatus)}`,
|
|
4753
|
-
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
4754
|
-
}
|
|
4755
|
-
) })
|
|
4756
|
-
] }),
|
|
4757
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4758
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
4759
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
4760
|
-
] }),
|
|
4761
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4762
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
4763
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
4764
|
-
] }),
|
|
4765
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4766
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
4767
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
4768
|
-
] }),
|
|
4769
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4770
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
4771
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
4772
|
-
year: "numeric",
|
|
4773
|
-
month: "short",
|
|
4774
|
-
day: "numeric",
|
|
4775
|
-
hour: "numeric",
|
|
4776
|
-
minute: "2-digit",
|
|
4777
|
-
hour12: true
|
|
4778
|
-
}) })
|
|
4779
|
-
] })
|
|
4780
|
-
] }) }),
|
|
4781
|
-
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4782
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
4783
|
-
/* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.data, null, 2) })
|
|
4784
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-xl border border-ui-border-base p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No provider data for this session." }) })
|
|
4785
|
-
] }) : null
|
|
4810
|
+
updateError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-ui-border-error bg-ui-bg-error-subtle p-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-error", children: updateError }) }),
|
|
4811
|
+
updateSuccess && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-ui-border-success bg-ui-bg-success-subtle p-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-success", children: "Action completed successfully" }) })
|
|
4786
4812
|
] }) });
|
|
4787
4813
|
};
|
|
4788
4814
|
const config = adminSdk.defineRouteConfig({
|
|
4789
|
-
label: "
|
|
4790
|
-
icon: icons.
|
|
4815
|
+
label: "Return Order Details",
|
|
4816
|
+
icon: icons.CheckCircle
|
|
4791
4817
|
});
|
|
4792
4818
|
const i18nTranslations0 = {};
|
|
4793
4819
|
const widgetModule = { widgets: [
|
|
4794
4820
|
{
|
|
4795
4821
|
Component: OrderGiftItemsWidget,
|
|
4796
|
-
zone: ["order.details.side.after"]
|
|
4797
|
-
widgetId: "Widget-b753"
|
|
4822
|
+
zone: ["order.details.side.after"]
|
|
4798
4823
|
},
|
|
4799
4824
|
{
|
|
4800
4825
|
Component: OrderRefundContextWidget,
|
|
4801
|
-
zone: ["order.details.after"]
|
|
4802
|
-
widgetId: "Widget-0606"
|
|
4826
|
+
zone: ["order.details.after"]
|
|
4803
4827
|
}
|
|
4804
4828
|
] };
|
|
4805
4829
|
const routeModule = {
|
|
4806
4830
|
routes: [
|
|
4807
4831
|
{
|
|
4808
4832
|
Component: DeletedRecordsPage,
|
|
4809
|
-
path: "/deleted-records-audit"
|
|
4810
|
-
handle: { label: config$9.label, translationNs: config$9.translationNs }
|
|
4833
|
+
path: "/deleted-records-audit"
|
|
4811
4834
|
},
|
|
4812
4835
|
{
|
|
4813
4836
|
Component: RefundsPage,
|
|
4814
|
-
path: "/refunds"
|
|
4815
|
-
handle: { label: config$8.label, translationNs: config$8.translationNs }
|
|
4837
|
+
path: "/refunds"
|
|
4816
4838
|
},
|
|
4817
4839
|
{
|
|
4818
|
-
Component:
|
|
4819
|
-
path: "/
|
|
4820
|
-
handle: { label: config$7.label, translationNs: config$7.translationNs }
|
|
4840
|
+
Component: PaymentsPage,
|
|
4841
|
+
path: "/payments"
|
|
4821
4842
|
},
|
|
4822
4843
|
{
|
|
4823
|
-
Component:
|
|
4824
|
-
path: "/
|
|
4825
|
-
handle: { label: config$6.label, translationNs: config$6.translationNs }
|
|
4844
|
+
Component: ReturnsPage,
|
|
4845
|
+
path: "/returns"
|
|
4826
4846
|
},
|
|
4827
4847
|
{
|
|
4828
|
-
Component:
|
|
4829
|
-
path: "/
|
|
4830
|
-
handle: { label: config$5.label, translationNs: config$5.translationNs }
|
|
4848
|
+
Component: SwapsPage,
|
|
4849
|
+
path: "/swaps"
|
|
4831
4850
|
},
|
|
4832
4851
|
{
|
|
4833
4852
|
Component: DeletedRecordDetailPage,
|
|
4834
|
-
path: "/deleted-records-audit/:id"
|
|
4835
|
-
handle: { label: config$4.label, translationNs: config$4.translationNs }
|
|
4853
|
+
path: "/deleted-records-audit/:id"
|
|
4836
4854
|
},
|
|
4837
4855
|
{
|
|
4838
4856
|
Component: RefundDetailPage,
|
|
4839
|
-
path: "/refunds/:id"
|
|
4840
|
-
handle: { label: config$3.label, translationNs: config$3.translationNs }
|
|
4857
|
+
path: "/refunds/:id"
|
|
4841
4858
|
},
|
|
4842
4859
|
{
|
|
4843
|
-
Component:
|
|
4844
|
-
path: "/
|
|
4845
|
-
handle: { label: config$2.label, translationNs: config$2.translationNs }
|
|
4860
|
+
Component: PaymentDetailPage,
|
|
4861
|
+
path: "/payments/:id"
|
|
4846
4862
|
},
|
|
4847
4863
|
{
|
|
4848
4864
|
Component: SwapDetailPage,
|
|
4849
|
-
path: "/swaps/:id"
|
|
4850
|
-
handle: { label: config$1.label, translationNs: config$1.translationNs }
|
|
4865
|
+
path: "/swaps/:id"
|
|
4851
4866
|
},
|
|
4852
4867
|
{
|
|
4853
|
-
Component:
|
|
4854
|
-
path: "/
|
|
4855
|
-
handle: { label: config.label, translationNs: config.translationNs }
|
|
4868
|
+
Component: ReturnDetailPage,
|
|
4869
|
+
path: "/returns/:id"
|
|
4856
4870
|
}
|
|
4857
4871
|
]
|
|
4858
4872
|
};
|
|
4859
4873
|
const menuItemModule = {
|
|
4860
4874
|
menuItems: [
|
|
4861
4875
|
{
|
|
4862
|
-
label: config$
|
|
4863
|
-
icon: config$
|
|
4876
|
+
label: config$6.label,
|
|
4877
|
+
icon: config$6.icon,
|
|
4878
|
+
path: "/payments",
|
|
4879
|
+
nested: void 0
|
|
4880
|
+
},
|
|
4881
|
+
{
|
|
4882
|
+
label: config$8.label,
|
|
4883
|
+
icon: config$8.icon,
|
|
4864
4884
|
path: "/deleted-records-audit",
|
|
4865
|
-
nested: void 0
|
|
4866
|
-
rank: void 0,
|
|
4867
|
-
translationNs: void 0
|
|
4885
|
+
nested: void 0
|
|
4868
4886
|
},
|
|
4869
4887
|
{
|
|
4870
4888
|
label: config$5.label,
|
|
4871
4889
|
icon: config$5.icon,
|
|
4872
|
-
path: "/
|
|
4873
|
-
nested: void 0
|
|
4874
|
-
rank: void 0,
|
|
4875
|
-
translationNs: void 0
|
|
4876
|
-
},
|
|
4877
|
-
{
|
|
4878
|
-
label: config$6.label,
|
|
4879
|
-
icon: config$6.icon,
|
|
4880
|
-
path: "/swaps",
|
|
4881
|
-
nested: void 0,
|
|
4882
|
-
rank: void 0,
|
|
4883
|
-
translationNs: void 0
|
|
4890
|
+
path: "/returns",
|
|
4891
|
+
nested: void 0
|
|
4884
4892
|
},
|
|
4885
4893
|
{
|
|
4886
4894
|
label: config$7.label,
|
|
4887
4895
|
icon: config$7.icon,
|
|
4888
|
-
path: "/returns",
|
|
4889
|
-
nested: void 0,
|
|
4890
|
-
rank: void 0,
|
|
4891
|
-
translationNs: void 0
|
|
4892
|
-
},
|
|
4893
|
-
{
|
|
4894
|
-
label: config$8.label,
|
|
4895
|
-
icon: config$8.icon,
|
|
4896
4896
|
path: "/refunds",
|
|
4897
|
-
nested: void 0
|
|
4898
|
-
rank: void 0,
|
|
4899
|
-
translationNs: void 0
|
|
4900
|
-
},
|
|
4901
|
-
{
|
|
4902
|
-
label: config.label,
|
|
4903
|
-
icon: config.icon,
|
|
4904
|
-
path: "/payments/:id",
|
|
4905
|
-
nested: void 0,
|
|
4906
|
-
rank: void 0,
|
|
4907
|
-
translationNs: void 0
|
|
4897
|
+
nested: void 0
|
|
4908
4898
|
},
|
|
4909
4899
|
{
|
|
4910
|
-
label: config$
|
|
4911
|
-
icon: config$
|
|
4912
|
-
path: "/swaps
|
|
4913
|
-
nested: void 0
|
|
4914
|
-
rank: void 0,
|
|
4915
|
-
translationNs: void 0
|
|
4900
|
+
label: config$4.label,
|
|
4901
|
+
icon: config$4.icon,
|
|
4902
|
+
path: "/swaps",
|
|
4903
|
+
nested: void 0
|
|
4916
4904
|
},
|
|
4917
4905
|
{
|
|
4918
4906
|
label: config$2.label,
|
|
4919
4907
|
icon: config$2.icon,
|
|
4908
|
+
path: "/payments/:id",
|
|
4909
|
+
nested: void 0
|
|
4910
|
+
},
|
|
4911
|
+
{
|
|
4912
|
+
label: config.label,
|
|
4913
|
+
icon: config.icon,
|
|
4920
4914
|
path: "/returns/:id",
|
|
4921
|
-
nested: void 0
|
|
4922
|
-
rank: void 0,
|
|
4923
|
-
translationNs: void 0
|
|
4915
|
+
nested: void 0
|
|
4924
4916
|
},
|
|
4925
4917
|
{
|
|
4926
4918
|
label: config$3.label,
|
|
4927
4919
|
icon: config$3.icon,
|
|
4928
4920
|
path: "/refunds/:id",
|
|
4929
|
-
nested: void 0
|
|
4930
|
-
|
|
4931
|
-
|
|
4921
|
+
nested: void 0
|
|
4922
|
+
},
|
|
4923
|
+
{
|
|
4924
|
+
label: config$1.label,
|
|
4925
|
+
icon: config$1.icon,
|
|
4926
|
+
path: "/swaps/:id",
|
|
4927
|
+
nested: void 0
|
|
4932
4928
|
}
|
|
4933
4929
|
]
|
|
4934
4930
|
};
|
|
@@ -4937,18 +4933,12 @@ const displayModule = {
|
|
|
4937
4933
|
displays: {}
|
|
4938
4934
|
};
|
|
4939
4935
|
const i18nModule = { resources: i18nTranslations0 };
|
|
4940
|
-
const cellRendererModule = {};
|
|
4941
|
-
const layoutModule = { layouts: [] };
|
|
4942
|
-
const searchEntityModule = {};
|
|
4943
4936
|
const plugin = {
|
|
4944
4937
|
widgetModule,
|
|
4945
4938
|
routeModule,
|
|
4946
4939
|
menuItemModule,
|
|
4947
4940
|
formModule,
|
|
4948
4941
|
displayModule,
|
|
4949
|
-
i18nModule
|
|
4950
|
-
cellRendererModule,
|
|
4951
|
-
layoutModule,
|
|
4952
|
-
searchEntityModule
|
|
4942
|
+
i18nModule
|
|
4953
4943
|
};
|
|
4954
4944
|
module.exports = plugin;
|