order-management 0.0.97 → 0.0.99
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 +674 -684
- package/.medusa/server/src/admin/index.mjs +675 -685
- 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
|
});
|
|
@@ -2229,16 +2247,216 @@ const getStatusBadgeClass$7 = (status) => {
|
|
|
2229
2247
|
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2230
2248
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2231
2249
|
};
|
|
2232
|
-
const
|
|
2250
|
+
const PaymentsPage = () => {
|
|
2233
2251
|
const navigate = reactRouterDom.useNavigate();
|
|
2234
2252
|
const [items, setItems] = react.useState([]);
|
|
2253
|
+
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
2235
2254
|
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
2236
2255
|
const debouncedOrderId = useDebounce$3(orderIdSearch, 300);
|
|
2256
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
2257
|
+
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
2258
|
+
const [error, setError] = react.useState(null);
|
|
2259
|
+
const [offset, setOffset] = react.useState(0);
|
|
2260
|
+
const [count, setCount] = react.useState(0);
|
|
2261
|
+
const limit = 50;
|
|
2262
|
+
const loadTransactions = react.useCallback(
|
|
2263
|
+
async (nextOffset, replace) => {
|
|
2264
|
+
try {
|
|
2265
|
+
if (replace) setIsLoading(true);
|
|
2266
|
+
else setIsFetchingMore(true);
|
|
2267
|
+
setError(null);
|
|
2268
|
+
const params = new URLSearchParams();
|
|
2269
|
+
params.set("limit", String(limit));
|
|
2270
|
+
params.set("offset", String(nextOffset));
|
|
2271
|
+
if (statusFilter !== "all") params.set("status", statusFilter);
|
|
2272
|
+
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
2273
|
+
const response = await fetch(
|
|
2274
|
+
`/admin/payment-transactions?${params.toString()}`,
|
|
2275
|
+
{ credentials: "include" }
|
|
2276
|
+
);
|
|
2277
|
+
if (!response.ok) {
|
|
2278
|
+
const text = await response.text();
|
|
2279
|
+
throw new Error(text || "Failed to load payment transactions");
|
|
2280
|
+
}
|
|
2281
|
+
const payload = await response.json();
|
|
2282
|
+
const list = payload.transactions ?? [];
|
|
2283
|
+
setCount(payload.count ?? 0);
|
|
2284
|
+
setOffset(nextOffset + list.length);
|
|
2285
|
+
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
2286
|
+
} catch (e) {
|
|
2287
|
+
setError(e instanceof Error ? e.message : "Failed to load");
|
|
2288
|
+
} finally {
|
|
2289
|
+
setIsLoading(false);
|
|
2290
|
+
setIsFetchingMore(false);
|
|
2291
|
+
}
|
|
2292
|
+
},
|
|
2293
|
+
[statusFilter, debouncedOrderId]
|
|
2294
|
+
);
|
|
2295
|
+
react.useEffect(() => {
|
|
2296
|
+
void loadTransactions(0, true);
|
|
2297
|
+
}, [loadTransactions]);
|
|
2298
|
+
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
2299
|
+
const displayStatus = (t) => {
|
|
2300
|
+
const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
|
|
2301
|
+
return s2 !== "" ? s2 : "—";
|
|
2302
|
+
};
|
|
2303
|
+
const displayAmount = (t) => {
|
|
2304
|
+
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
2305
|
+
return `${code} ${Number(t.amount)}`;
|
|
2306
|
+
};
|
|
2307
|
+
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: [
|
|
2308
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
2309
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2310
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payments" }),
|
|
2311
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
|
|
2312
|
+
] }),
|
|
2313
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
|
|
2314
|
+
] }),
|
|
2315
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
2316
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2317
|
+
ui.Input,
|
|
2318
|
+
{
|
|
2319
|
+
placeholder: "Search by Order ID",
|
|
2320
|
+
value: orderIdSearch,
|
|
2321
|
+
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
2322
|
+
className: "md:max-w-sm",
|
|
2323
|
+
"aria-label": "Search by order ID"
|
|
2324
|
+
}
|
|
2325
|
+
),
|
|
2326
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2327
|
+
"select",
|
|
2328
|
+
{
|
|
2329
|
+
value: statusFilter,
|
|
2330
|
+
onChange: (e) => setStatusFilter(e.target.value),
|
|
2331
|
+
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",
|
|
2332
|
+
"aria-label": "Filter by status",
|
|
2333
|
+
children: [
|
|
2334
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
2335
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
2336
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
2337
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "error", children: "Error" }),
|
|
2338
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
2339
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
2340
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
2341
|
+
]
|
|
2342
|
+
}
|
|
2343
|
+
) })
|
|
2344
|
+
] }),
|
|
2345
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2346
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
2347
|
+
/* @__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" }) })
|
|
2348
|
+
] }) : null,
|
|
2349
|
+
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: [
|
|
2350
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
|
|
2351
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
|
|
2352
|
+
] }) : /* @__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: [
|
|
2353
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2354
|
+
/* @__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" }),
|
|
2355
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
2356
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
2357
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
2358
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
|
|
2359
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
2360
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
2361
|
+
] }) }),
|
|
2362
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2363
|
+
"tr",
|
|
2364
|
+
{
|
|
2365
|
+
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
2366
|
+
onClick: () => navigate(`/payments/${t.payment_session_id}`),
|
|
2367
|
+
children: [
|
|
2368
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
|
|
2369
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
|
|
2370
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
|
|
2371
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2372
|
+
ui.Badge,
|
|
2373
|
+
{
|
|
2374
|
+
size: "2xsmall",
|
|
2375
|
+
className: `uppercase ${getStatusBadgeClass$7(displayStatus(t))}`,
|
|
2376
|
+
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
2377
|
+
}
|
|
2378
|
+
) }),
|
|
2379
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
|
|
2380
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
|
|
2381
|
+
year: "numeric",
|
|
2382
|
+
month: "short",
|
|
2383
|
+
day: "numeric",
|
|
2384
|
+
hour: "numeric",
|
|
2385
|
+
minute: "2-digit",
|
|
2386
|
+
hour12: true
|
|
2387
|
+
}) }),
|
|
2388
|
+
/* @__PURE__ */ jsxRuntime.jsxs("td", { className: "px-4 py-4", children: [
|
|
2389
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2390
|
+
ui.Button,
|
|
2391
|
+
{
|
|
2392
|
+
variant: "transparent",
|
|
2393
|
+
size: "small",
|
|
2394
|
+
onClick: (e) => {
|
|
2395
|
+
e.stopPropagation();
|
|
2396
|
+
navigate(`/payments/${t.payment_session_id}`);
|
|
2397
|
+
},
|
|
2398
|
+
children: "View details"
|
|
2399
|
+
}
|
|
2400
|
+
),
|
|
2401
|
+
t.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2402
|
+
ui.Button,
|
|
2403
|
+
{
|
|
2404
|
+
variant: "transparent",
|
|
2405
|
+
size: "small",
|
|
2406
|
+
onClick: (e) => {
|
|
2407
|
+
e.stopPropagation();
|
|
2408
|
+
navigate(`/orders/${t.order_id}`);
|
|
2409
|
+
},
|
|
2410
|
+
children: "Order"
|
|
2411
|
+
}
|
|
2412
|
+
) : null
|
|
2413
|
+
] })
|
|
2414
|
+
]
|
|
2415
|
+
},
|
|
2416
|
+
t.payment_session_id
|
|
2417
|
+
)) })
|
|
2418
|
+
] }) }),
|
|
2419
|
+
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2420
|
+
ui.Button,
|
|
2421
|
+
{
|
|
2422
|
+
variant: "secondary",
|
|
2423
|
+
isLoading: isFetchingMore,
|
|
2424
|
+
onClick: () => loadTransactions(offset, false),
|
|
2425
|
+
children: "Load more"
|
|
2426
|
+
}
|
|
2427
|
+
) }) : null
|
|
2428
|
+
] }) });
|
|
2429
|
+
};
|
|
2430
|
+
const config$7 = adminSdk.defineRouteConfig({
|
|
2431
|
+
label: "Payments",
|
|
2432
|
+
icon: icons.CreditCard
|
|
2433
|
+
});
|
|
2434
|
+
const useDebounce$2 = (value, delay) => {
|
|
2435
|
+
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
2436
|
+
react.useEffect(() => {
|
|
2437
|
+
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
2438
|
+
return () => clearTimeout(handler);
|
|
2439
|
+
}, [value, delay]);
|
|
2440
|
+
return debouncedValue;
|
|
2441
|
+
};
|
|
2442
|
+
const getStatusBadgeClass$6 = (status) => {
|
|
2443
|
+
const s2 = status.toLowerCase();
|
|
2444
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2445
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2446
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2447
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2448
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2449
|
+
};
|
|
2450
|
+
const RefundsPage = () => {
|
|
2451
|
+
const navigate = reactRouterDom.useNavigate();
|
|
2452
|
+
const [items, setItems] = react.useState([]);
|
|
2453
|
+
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
2454
|
+
const debouncedOrderId = useDebounce$2(orderIdSearch, 300);
|
|
2237
2455
|
const [paymentStatusFilter, setPaymentStatusFilter] = react.useState("all");
|
|
2238
2456
|
const [providerSearch, setProviderSearch] = react.useState("");
|
|
2239
|
-
const debouncedProvider = useDebounce$
|
|
2457
|
+
const debouncedProvider = useDebounce$2(providerSearch, 300);
|
|
2240
2458
|
const [currencySearch, setCurrencySearch] = react.useState("");
|
|
2241
|
-
const debouncedCurrency = useDebounce$
|
|
2459
|
+
const debouncedCurrency = useDebounce$2(currencySearch, 300);
|
|
2242
2460
|
const [dateFrom, setDateFrom] = react.useState("");
|
|
2243
2461
|
const [dateTo, setDateTo] = react.useState("");
|
|
2244
2462
|
const [amountMin, setAmountMin] = react.useState("");
|
|
@@ -2450,7 +2668,7 @@ const RefundsPage = () => {
|
|
|
2450
2668
|
ui.Badge,
|
|
2451
2669
|
{
|
|
2452
2670
|
size: "2xsmall",
|
|
2453
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2671
|
+
className: `uppercase ${getStatusBadgeClass$6(displayStatus(r))}`,
|
|
2454
2672
|
children: displayStatus(r) !== "—" ? displayStatus(r).replace(/_/g, " ") : "—"
|
|
2455
2673
|
}
|
|
2456
2674
|
) }),
|
|
@@ -2504,11 +2722,11 @@ const RefundsPage = () => {
|
|
|
2504
2722
|
) }) : null
|
|
2505
2723
|
] }) });
|
|
2506
2724
|
};
|
|
2507
|
-
const config$
|
|
2725
|
+
const config$6 = adminSdk.defineRouteConfig({
|
|
2508
2726
|
label: "Refunds",
|
|
2509
2727
|
icon: icons.Receipt
|
|
2510
2728
|
});
|
|
2511
|
-
const useDebounce$
|
|
2729
|
+
const useDebounce$1 = (value, delay) => {
|
|
2512
2730
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
2513
2731
|
react.useEffect(() => {
|
|
2514
2732
|
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
@@ -2516,7 +2734,7 @@ const useDebounce$2 = (value, delay) => {
|
|
|
2516
2734
|
}, [value, delay]);
|
|
2517
2735
|
return debouncedValue;
|
|
2518
2736
|
};
|
|
2519
|
-
const getStatusBadgeClass$
|
|
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";
|
|
@@ -3928,17 +3950,14 @@ const getStatusBadgeClass$3 = (status) => {
|
|
|
3928
3950
|
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
3929
3951
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
3930
3952
|
};
|
|
3931
|
-
const
|
|
3932
|
-
|
|
3933
|
-
};
|
|
3934
|
-
const RefundDetailPage = () => {
|
|
3953
|
+
const PaymentDetailPage = () => {
|
|
3954
|
+
var _a;
|
|
3935
3955
|
const navigate = reactRouterDom.useNavigate();
|
|
3936
3956
|
const params = reactRouterDom.useParams();
|
|
3937
|
-
const id = params
|
|
3957
|
+
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
3938
3958
|
const [detail, setDetail] = react.useState(null);
|
|
3939
3959
|
const [loading, setLoading] = react.useState(!!id);
|
|
3940
3960
|
const [error, setError] = react.useState(null);
|
|
3941
|
-
const [gatewayExpanded, setGatewayExpanded] = react.useState(false);
|
|
3942
3961
|
react.useEffect(() => {
|
|
3943
3962
|
if (!id) {
|
|
3944
3963
|
setLoading(false);
|
|
@@ -3947,7 +3966,7 @@ const RefundDetailPage = () => {
|
|
|
3947
3966
|
let cancelled = false;
|
|
3948
3967
|
setLoading(true);
|
|
3949
3968
|
setError(null);
|
|
3950
|
-
fetch(`/admin/
|
|
3969
|
+
fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
|
|
3951
3970
|
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
3952
3971
|
return res.json();
|
|
3953
3972
|
}).then((data) => {
|
|
@@ -3961,155 +3980,86 @@ const RefundDetailPage = () => {
|
|
|
3961
3980
|
cancelled = true;
|
|
3962
3981
|
};
|
|
3963
3982
|
}, [id]);
|
|
3964
|
-
const
|
|
3965
|
-
const
|
|
3983
|
+
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
3984
|
+
const sessionStatusRaw = (detail == null ? void 0 : detail.session_status) ?? "—";
|
|
3985
|
+
const paymentStatusRaw = (detail == null ? void 0 : detail.payment_id) != null ? (detail == null ? void 0 : detail.payment_status) ?? "—" : "—";
|
|
3986
|
+
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
3966
3987
|
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
3988
|
/* @__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
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/
|
|
3969
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
3970
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle
|
|
3989
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
3990
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payment session" }),
|
|
3991
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
|
|
3971
3992
|
] }) }),
|
|
3972
3993
|
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
3973
3994
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
3974
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/
|
|
3995
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
|
|
3975
3996
|
] }) : 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: [
|
|
3976
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3977
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3978
|
-
|
|
3979
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
ui.Badge,
|
|
4031
|
-
{
|
|
4032
|
-
size: "2xsmall",
|
|
4033
|
-
className: `uppercase ${getStatusBadgeClass$3(paymentStatus)}`,
|
|
4034
|
-
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
4035
|
-
}
|
|
4036
|
-
) })
|
|
4037
|
-
] }),
|
|
4038
|
-
detail.computed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4039
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4040
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
4041
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
4042
|
-
] }),
|
|
4043
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4044
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
4045
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
4046
|
-
] }),
|
|
4047
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4048
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
4049
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "mt-1 block", children: [
|
|
4050
|
-
detail.computed.refund_percentage.toFixed(1),
|
|
4051
|
-
"%"
|
|
4052
|
-
] })
|
|
4053
|
-
] })
|
|
4054
|
-
] }) : null
|
|
3997
|
+
/* @__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: [
|
|
3998
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3999
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
|
|
4000
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4001
|
+
ui.Button,
|
|
4002
|
+
{
|
|
4003
|
+
variant: "transparent",
|
|
4004
|
+
size: "small",
|
|
4005
|
+
onClick: () => navigate(`/orders/${detail.order_id}`),
|
|
4006
|
+
children: detail.order_id
|
|
4007
|
+
}
|
|
4008
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "—" }) })
|
|
4009
|
+
] }),
|
|
4010
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4011
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
4012
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: displayAmount })
|
|
4013
|
+
] }),
|
|
4014
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4015
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
4016
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.provider_id })
|
|
4017
|
+
] }),
|
|
4018
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4019
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
4020
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4021
|
+
ui.Badge,
|
|
4022
|
+
{
|
|
4023
|
+
size: "2xsmall",
|
|
4024
|
+
className: `uppercase ${getStatusBadgeClass$3(displayStatus)}`,
|
|
4025
|
+
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
4026
|
+
}
|
|
4027
|
+
) })
|
|
4028
|
+
] }),
|
|
4029
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4030
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
4031
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
4032
|
+
] }),
|
|
4033
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4034
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
4035
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
4036
|
+
] }),
|
|
4037
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4038
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
4039
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
4040
|
+
] }),
|
|
4041
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4042
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
4043
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
4044
|
+
year: "numeric",
|
|
4045
|
+
month: "short",
|
|
4046
|
+
day: "numeric",
|
|
4047
|
+
hour: "numeric",
|
|
4048
|
+
minute: "2-digit",
|
|
4049
|
+
hour12: true
|
|
4050
|
+
}) })
|
|
4055
4051
|
] })
|
|
4056
|
-
] }),
|
|
4057
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4058
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
4062
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4063
|
-
ui.Button,
|
|
4064
|
-
{
|
|
4065
|
-
variant: "transparent",
|
|
4066
|
-
size: "small",
|
|
4067
|
-
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
4068
|
-
children: detail.order.order_number ?? detail.order.order_id
|
|
4069
|
-
}
|
|
4070
|
-
) })
|
|
4071
|
-
] }),
|
|
4072
|
-
detail.order.total != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4073
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
4074
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
4075
|
-
] }) : null,
|
|
4076
|
-
detail.order.customer_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4077
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
4078
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
4079
|
-
] }) : null,
|
|
4080
|
-
detail.order.region ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4081
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
4082
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.region })
|
|
4083
|
-
] }) : null,
|
|
4084
|
-
detail.order.fulfillment_status ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4085
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
4086
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
4087
|
-
] }) : null
|
|
4088
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
4089
|
-
] }),
|
|
4090
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4091
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4092
|
-
"button",
|
|
4093
|
-
{
|
|
4094
|
-
type: "button",
|
|
4095
|
-
className: "flex w-full items-center justify-between text-left",
|
|
4096
|
-
onClick: () => setGatewayExpanded((prev) => !prev),
|
|
4097
|
-
"aria-expanded": gatewayExpanded,
|
|
4098
|
-
"aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
|
|
4099
|
-
children: [
|
|
4100
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
|
|
4101
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
|
|
4102
|
-
]
|
|
4103
|
-
}
|
|
4104
|
-
),
|
|
4105
|
-
gatewayExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: hasGatewayData ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.payment.payment_data, null, 2) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No gateway payload for this payment." }) })
|
|
4106
|
-
] })
|
|
4052
|
+
] }) }),
|
|
4053
|
+
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4054
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
4055
|
+
/* @__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) })
|
|
4056
|
+
] }) : /* @__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." }) })
|
|
4107
4057
|
] }) : null
|
|
4108
4058
|
] }) });
|
|
4109
4059
|
};
|
|
4110
4060
|
const config$3 = adminSdk.defineRouteConfig({
|
|
4111
|
-
label: "
|
|
4112
|
-
icon: icons.
|
|
4061
|
+
label: "Payment details",
|
|
4062
|
+
icon: icons.CreditCard
|
|
4113
4063
|
});
|
|
4114
4064
|
const getStatusBadgeClass$2 = (status) => {
|
|
4115
4065
|
const statusLower = status.toLowerCase();
|
|
@@ -4137,6 +4087,7 @@ const getStatusBadgeClass$2 = (status) => {
|
|
|
4137
4087
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
4138
4088
|
};
|
|
4139
4089
|
const ReturnDetailPage = () => {
|
|
4090
|
+
var _a, _b, _c;
|
|
4140
4091
|
const navigate = reactRouterDom.useNavigate();
|
|
4141
4092
|
const { id } = reactRouterDom.useParams();
|
|
4142
4093
|
const [returnOrder, setReturnOrder] = react.useState(null);
|
|
@@ -4219,7 +4170,7 @@ const ReturnDetailPage = () => {
|
|
|
4219
4170
|
/* @__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" }) })
|
|
4220
4171
|
] }) }) });
|
|
4221
4172
|
}
|
|
4222
|
-
const statusHistory = returnOrder.metadata
|
|
4173
|
+
const statusHistory = ((_a = returnOrder.metadata) == null ? void 0 : _a.status_history) || [];
|
|
4223
4174
|
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
4175
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3", children: [
|
|
4225
4176
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4355,11 +4306,11 @@ const ReturnDetailPage = () => {
|
|
|
4355
4306
|
] }),
|
|
4356
4307
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4357
4308
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
4358
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.customer
|
|
4309
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_b = returnOrder.order.customer) == null ? void 0 : _b.email) || returnOrder.order.email || "—" })
|
|
4359
4310
|
] }),
|
|
4360
4311
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4361
4312
|
/* @__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
|
|
4313
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_c = returnOrder.order.order_payment) == null ? void 0 : _c.label) || "—" })
|
|
4363
4314
|
] }),
|
|
4364
4315
|
returnOrder.order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4365
4316
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
@@ -4369,31 +4320,223 @@ const ReturnDetailPage = () => {
|
|
|
4369
4320
|
] })
|
|
4370
4321
|
] })
|
|
4371
4322
|
] })
|
|
4372
|
-
] }),
|
|
4373
|
-
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: [
|
|
4374
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
4375
|
-
/* @__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
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
4377
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Item ID" }),
|
|
4378
|
-
/* @__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
|
-
/* @__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
|
-
] }) }),
|
|
4381
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: returnOrder.return_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
4382
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
4383
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
4384
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
4385
|
-
] }, item.id || index)) })
|
|
4386
|
-
] }) })
|
|
4387
|
-
] }),
|
|
4388
|
-
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 }) }),
|
|
4389
|
-
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" }) })
|
|
4323
|
+
] }),
|
|
4324
|
+
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: [
|
|
4325
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
4326
|
+
/* @__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: [
|
|
4327
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
4328
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Item ID" }),
|
|
4329
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
|
|
4330
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
|
|
4331
|
+
] }) }),
|
|
4332
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: returnOrder.return_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
4333
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
4334
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
4335
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
4336
|
+
] }, item.id || index)) })
|
|
4337
|
+
] }) })
|
|
4338
|
+
] }),
|
|
4339
|
+
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 }) }),
|
|
4340
|
+
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" }) })
|
|
4341
|
+
] }) });
|
|
4342
|
+
};
|
|
4343
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
4344
|
+
label: "Return Order Details",
|
|
4345
|
+
icon: icons.CheckCircle
|
|
4346
|
+
});
|
|
4347
|
+
const getStatusBadgeClass$1 = (status) => {
|
|
4348
|
+
const s2 = status.toLowerCase();
|
|
4349
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
4350
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
4351
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
4352
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
4353
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
4354
|
+
};
|
|
4355
|
+
const formatAmount = (value) => {
|
|
4356
|
+
return String(value);
|
|
4357
|
+
};
|
|
4358
|
+
const RefundDetailPage = () => {
|
|
4359
|
+
var _a, _b, _c;
|
|
4360
|
+
const navigate = reactRouterDom.useNavigate();
|
|
4361
|
+
const params = reactRouterDom.useParams();
|
|
4362
|
+
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
4363
|
+
const [detail, setDetail] = react.useState(null);
|
|
4364
|
+
const [loading, setLoading] = react.useState(!!id);
|
|
4365
|
+
const [error, setError] = react.useState(null);
|
|
4366
|
+
const [gatewayExpanded, setGatewayExpanded] = react.useState(false);
|
|
4367
|
+
react.useEffect(() => {
|
|
4368
|
+
if (!id) {
|
|
4369
|
+
setLoading(false);
|
|
4370
|
+
return;
|
|
4371
|
+
}
|
|
4372
|
+
let cancelled = false;
|
|
4373
|
+
setLoading(true);
|
|
4374
|
+
setError(null);
|
|
4375
|
+
fetch(`/admin/refunds/${id}`, { credentials: "include" }).then((res) => {
|
|
4376
|
+
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
4377
|
+
return res.json();
|
|
4378
|
+
}).then((data) => {
|
|
4379
|
+
if (!cancelled) setDetail(data);
|
|
4380
|
+
}).catch((e) => {
|
|
4381
|
+
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
4382
|
+
}).finally(() => {
|
|
4383
|
+
if (!cancelled) setLoading(false);
|
|
4384
|
+
});
|
|
4385
|
+
return () => {
|
|
4386
|
+
cancelled = true;
|
|
4387
|
+
};
|
|
4388
|
+
}, [id]);
|
|
4389
|
+
const paymentStatus = ((_b = detail == null ? void 0 : detail.payment) == null ? void 0 : _b.status) ?? "—";
|
|
4390
|
+
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;
|
|
4391
|
+
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: [
|
|
4392
|
+
/* @__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: [
|
|
4393
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/refunds"), children: "← Refunds" }),
|
|
4394
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refund details" }),
|
|
4395
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle font-mono", children: id ?? "—" })
|
|
4396
|
+
] }) }),
|
|
4397
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
4398
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
4399
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/refunds"), children: "Back to list" })
|
|
4400
|
+
] }) : 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: [
|
|
4401
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4402
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Refund summary" }),
|
|
4403
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4404
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4405
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund ID" }),
|
|
4406
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.id })
|
|
4407
|
+
] }),
|
|
4408
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4409
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
4410
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.refund.amount) })
|
|
4411
|
+
] }),
|
|
4412
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4413
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Note" }),
|
|
4414
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.refund.note ?? "—" })
|
|
4415
|
+
] }),
|
|
4416
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4417
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created at" }),
|
|
4418
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.refund.created_at).toLocaleDateString("en-US", {
|
|
4419
|
+
year: "numeric",
|
|
4420
|
+
month: "short",
|
|
4421
|
+
day: "numeric",
|
|
4422
|
+
hour: "numeric",
|
|
4423
|
+
minute: "2-digit",
|
|
4424
|
+
hour12: true
|
|
4425
|
+
}) })
|
|
4426
|
+
] }),
|
|
4427
|
+
detail.refund.created_by ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4428
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created by" }),
|
|
4429
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.created_by })
|
|
4430
|
+
] }) : null
|
|
4431
|
+
] })
|
|
4432
|
+
] }),
|
|
4433
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4434
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Payment summary" }),
|
|
4435
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4436
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4437
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment amount" }),
|
|
4438
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.payment_amount) })
|
|
4439
|
+
] }),
|
|
4440
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4441
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Captured amount" }),
|
|
4442
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.captured_amount) })
|
|
4443
|
+
] }),
|
|
4444
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4445
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refunded amount" }),
|
|
4446
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.refunded_amount) })
|
|
4447
|
+
] }),
|
|
4448
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4449
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
4450
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment.provider_id || "—" })
|
|
4451
|
+
] }),
|
|
4452
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4453
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
4454
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4455
|
+
ui.Badge,
|
|
4456
|
+
{
|
|
4457
|
+
size: "2xsmall",
|
|
4458
|
+
className: `uppercase ${getStatusBadgeClass$1(paymentStatus)}`,
|
|
4459
|
+
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
4460
|
+
}
|
|
4461
|
+
) })
|
|
4462
|
+
] }),
|
|
4463
|
+
detail.computed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4464
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4465
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
4466
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
4467
|
+
] }),
|
|
4468
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4469
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
4470
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
4471
|
+
] }),
|
|
4472
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4473
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
4474
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "mt-1 block", children: [
|
|
4475
|
+
detail.computed.refund_percentage.toFixed(1),
|
|
4476
|
+
"%"
|
|
4477
|
+
] })
|
|
4478
|
+
] })
|
|
4479
|
+
] }) : null
|
|
4480
|
+
] })
|
|
4481
|
+
] }),
|
|
4482
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4483
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Order summary" }),
|
|
4484
|
+
detail.order ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4485
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4486
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
4487
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4488
|
+
ui.Button,
|
|
4489
|
+
{
|
|
4490
|
+
variant: "transparent",
|
|
4491
|
+
size: "small",
|
|
4492
|
+
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
4493
|
+
children: detail.order.order_number ?? detail.order.order_id
|
|
4494
|
+
}
|
|
4495
|
+
) })
|
|
4496
|
+
] }),
|
|
4497
|
+
detail.order.total != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4498
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
4499
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
4500
|
+
] }) : null,
|
|
4501
|
+
detail.order.customer_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4502
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
4503
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
4504
|
+
] }) : null,
|
|
4505
|
+
detail.order.region ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4506
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
4507
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.region })
|
|
4508
|
+
] }) : null,
|
|
4509
|
+
detail.order.fulfillment_status ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4510
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
4511
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
4512
|
+
] }) : null
|
|
4513
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
4514
|
+
] }),
|
|
4515
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4516
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4517
|
+
"button",
|
|
4518
|
+
{
|
|
4519
|
+
type: "button",
|
|
4520
|
+
className: "flex w-full items-center justify-between text-left",
|
|
4521
|
+
onClick: () => setGatewayExpanded((prev) => !prev),
|
|
4522
|
+
"aria-expanded": gatewayExpanded,
|
|
4523
|
+
"aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
|
|
4524
|
+
children: [
|
|
4525
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
|
|
4526
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
|
|
4527
|
+
]
|
|
4528
|
+
}
|
|
4529
|
+
),
|
|
4530
|
+
gatewayExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: hasGatewayData ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.payment.payment_data, null, 2) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No gateway payload for this payment." }) })
|
|
4531
|
+
] })
|
|
4532
|
+
] }) : null
|
|
4390
4533
|
] }) });
|
|
4391
4534
|
};
|
|
4392
|
-
const config$
|
|
4393
|
-
label: "
|
|
4394
|
-
icon: icons.
|
|
4535
|
+
const config$1 = adminSdk.defineRouteConfig({
|
|
4536
|
+
label: "Refund details",
|
|
4537
|
+
icon: icons.Receipt
|
|
4395
4538
|
});
|
|
4396
|
-
const getStatusBadgeClass
|
|
4539
|
+
const getStatusBadgeClass = (status) => {
|
|
4397
4540
|
const statusLower = status.toLowerCase();
|
|
4398
4541
|
if (statusLower === "requested") {
|
|
4399
4542
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -4416,12 +4559,13 @@ const getStatusBadgeClass$1 = (status) => {
|
|
|
4416
4559
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
4417
4560
|
};
|
|
4418
4561
|
const SwapDetailPage = () => {
|
|
4562
|
+
var _a, _b, _c;
|
|
4419
4563
|
const navigate = reactRouterDom.useNavigate();
|
|
4420
4564
|
const { id } = reactRouterDom.useParams();
|
|
4421
4565
|
const [swap, setSwap] = react.useState(null);
|
|
4422
4566
|
const [order, setOrder] = react.useState(null);
|
|
4423
4567
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
4424
|
-
|
|
4568
|
+
react.useState(false);
|
|
4425
4569
|
const [isCancelling, setIsCancelling] = react.useState(false);
|
|
4426
4570
|
const [error, setError] = react.useState(null);
|
|
4427
4571
|
const [updateError, setUpdateError] = react.useState(null);
|
|
@@ -4492,9 +4636,9 @@ const SwapDetailPage = () => {
|
|
|
4492
4636
|
setIsCancelling(false);
|
|
4493
4637
|
}
|
|
4494
4638
|
};
|
|
4495
|
-
const isOrderExchange = Boolean(swap
|
|
4639
|
+
const isOrderExchange = Boolean(swap == null ? void 0 : swap.exchange_id);
|
|
4496
4640
|
const canCancelExchange = isOrderExchange && swap && !["cancelled", "canceled", "completed", "declined"].includes(
|
|
4497
|
-
swap.status
|
|
4641
|
+
((_a = swap.status) == null ? void 0 : _a.toLowerCase()) ?? ""
|
|
4498
4642
|
);
|
|
4499
4643
|
if (isLoading) {
|
|
4500
4644
|
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..." }) }) }) });
|
|
@@ -4505,7 +4649,7 @@ const SwapDetailPage = () => {
|
|
|
4505
4649
|
/* @__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" }) })
|
|
4506
4650
|
] }) }) });
|
|
4507
4651
|
}
|
|
4508
|
-
const statusHistory = swap.metadata
|
|
4652
|
+
const statusHistory = ((_b = swap.metadata) == null ? void 0 : _b.status_history) || [];
|
|
4509
4653
|
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
4654
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3", children: [
|
|
4511
4655
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -4530,7 +4674,7 @@ const SwapDetailPage = () => {
|
|
|
4530
4674
|
ui.Badge,
|
|
4531
4675
|
{
|
|
4532
4676
|
size: "small",
|
|
4533
|
-
className: `uppercase ${getStatusBadgeClass
|
|
4677
|
+
className: `uppercase ${getStatusBadgeClass(swap.status)}`,
|
|
4534
4678
|
children: swap.status.replace(/_/g, " ")
|
|
4535
4679
|
}
|
|
4536
4680
|
)
|
|
@@ -4598,7 +4742,7 @@ const SwapDetailPage = () => {
|
|
|
4598
4742
|
ui.Badge,
|
|
4599
4743
|
{
|
|
4600
4744
|
size: "2xsmall",
|
|
4601
|
-
className: `uppercase ${getStatusBadgeClass
|
|
4745
|
+
className: `uppercase ${getStatusBadgeClass(entry.status)}`,
|
|
4602
4746
|
children: entry.status.replace(/_/g, " ")
|
|
4603
4747
|
}
|
|
4604
4748
|
) }),
|
|
@@ -4626,7 +4770,7 @@ const SwapDetailPage = () => {
|
|
|
4626
4770
|
] }),
|
|
4627
4771
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4628
4772
|
/* @__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
|
|
4773
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_c = order.customer) == null ? void 0 : _c.email) || order.email || "—" })
|
|
4630
4774
|
] }),
|
|
4631
4775
|
order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4632
4776
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
@@ -4667,268 +4811,120 @@ const SwapDetailPage = () => {
|
|
|
4667
4811
|
] })
|
|
4668
4812
|
] }) });
|
|
4669
4813
|
};
|
|
4670
|
-
const config
|
|
4814
|
+
const config = adminSdk.defineRouteConfig({
|
|
4671
4815
|
label: "Swap Details",
|
|
4672
4816
|
icon: icons.ArrowPath
|
|
4673
4817
|
});
|
|
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
|
|
4786
|
-
] }) });
|
|
4787
|
-
};
|
|
4788
|
-
const config = adminSdk.defineRouteConfig({
|
|
4789
|
-
label: "Payment details",
|
|
4790
|
-
icon: icons.CreditCard
|
|
4791
|
-
});
|
|
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
|
-
|
|
4833
|
+
path: "/deleted-records-audit"
|
|
4834
|
+
},
|
|
4835
|
+
{
|
|
4836
|
+
Component: PaymentsPage,
|
|
4837
|
+
path: "/payments"
|
|
4811
4838
|
},
|
|
4812
4839
|
{
|
|
4813
4840
|
Component: RefundsPage,
|
|
4814
|
-
path: "/refunds"
|
|
4815
|
-
handle: { label: config$8.label, translationNs: config$8.translationNs }
|
|
4841
|
+
path: "/refunds"
|
|
4816
4842
|
},
|
|
4817
4843
|
{
|
|
4818
4844
|
Component: ReturnsPage,
|
|
4819
|
-
path: "/returns"
|
|
4820
|
-
handle: { label: config$7.label, translationNs: config$7.translationNs }
|
|
4845
|
+
path: "/returns"
|
|
4821
4846
|
},
|
|
4822
4847
|
{
|
|
4823
4848
|
Component: SwapsPage,
|
|
4824
|
-
path: "/swaps"
|
|
4825
|
-
handle: { label: config$6.label, translationNs: config$6.translationNs }
|
|
4826
|
-
},
|
|
4827
|
-
{
|
|
4828
|
-
Component: PaymentsPage,
|
|
4829
|
-
path: "/payments",
|
|
4830
|
-
handle: { label: config$5.label, translationNs: config$5.translationNs }
|
|
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
|
-
Component:
|
|
4839
|
-
path: "/
|
|
4840
|
-
handle: { label: config$3.label, translationNs: config$3.translationNs }
|
|
4856
|
+
Component: PaymentDetailPage,
|
|
4857
|
+
path: "/payments/:id"
|
|
4841
4858
|
},
|
|
4842
4859
|
{
|
|
4843
4860
|
Component: ReturnDetailPage,
|
|
4844
|
-
path: "/returns/:id"
|
|
4845
|
-
handle: { label: config$2.label, translationNs: config$2.translationNs }
|
|
4861
|
+
path: "/returns/:id"
|
|
4846
4862
|
},
|
|
4847
4863
|
{
|
|
4848
|
-
Component:
|
|
4849
|
-
path: "/
|
|
4850
|
-
handle: { label: config$1.label, translationNs: config$1.translationNs }
|
|
4864
|
+
Component: RefundDetailPage,
|
|
4865
|
+
path: "/refunds/:id"
|
|
4851
4866
|
},
|
|
4852
4867
|
{
|
|
4853
|
-
Component:
|
|
4854
|
-
path: "/
|
|
4855
|
-
handle: { label: config.label, translationNs: config.translationNs }
|
|
4868
|
+
Component: SwapDetailPage,
|
|
4869
|
+
path: "/swaps/: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$8.label,
|
|
4877
|
+
icon: config$8.icon,
|
|
4864
4878
|
path: "/deleted-records-audit",
|
|
4865
|
-
nested: void 0
|
|
4866
|
-
rank: void 0,
|
|
4867
|
-
translationNs: void 0
|
|
4879
|
+
nested: void 0
|
|
4868
4880
|
},
|
|
4869
4881
|
{
|
|
4870
|
-
label: config$
|
|
4871
|
-
icon: config$
|
|
4882
|
+
label: config$7.label,
|
|
4883
|
+
icon: config$7.icon,
|
|
4872
4884
|
path: "/payments",
|
|
4873
|
-
nested: void 0
|
|
4874
|
-
rank: void 0,
|
|
4875
|
-
translationNs: void 0
|
|
4885
|
+
nested: void 0
|
|
4876
4886
|
},
|
|
4877
4887
|
{
|
|
4878
4888
|
label: config$6.label,
|
|
4879
4889
|
icon: config$6.icon,
|
|
4880
|
-
path: "/
|
|
4881
|
-
nested: void 0
|
|
4882
|
-
rank: void 0,
|
|
4883
|
-
translationNs: void 0
|
|
4890
|
+
path: "/refunds",
|
|
4891
|
+
nested: void 0
|
|
4884
4892
|
},
|
|
4885
4893
|
{
|
|
4886
|
-
label: config$
|
|
4887
|
-
icon: config$
|
|
4894
|
+
label: config$5.label,
|
|
4895
|
+
icon: config$5.icon,
|
|
4888
4896
|
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
|
-
path: "/refunds",
|
|
4897
|
-
nested: void 0,
|
|
4898
|
-
rank: void 0,
|
|
4899
|
-
translationNs: void 0
|
|
4897
|
+
nested: void 0
|
|
4900
4898
|
},
|
|
4901
4899
|
{
|
|
4902
|
-
label: config.label,
|
|
4903
|
-
icon: config.icon,
|
|
4904
|
-
path: "/
|
|
4905
|
-
nested: void 0
|
|
4906
|
-
rank: void 0,
|
|
4907
|
-
translationNs: void 0
|
|
4900
|
+
label: config$4.label,
|
|
4901
|
+
icon: config$4.icon,
|
|
4902
|
+
path: "/swaps",
|
|
4903
|
+
nested: void 0
|
|
4908
4904
|
},
|
|
4909
4905
|
{
|
|
4910
4906
|
label: config$1.label,
|
|
4911
4907
|
icon: config$1.icon,
|
|
4912
|
-
path: "/
|
|
4913
|
-
nested: void 0
|
|
4914
|
-
|
|
4915
|
-
|
|
4908
|
+
path: "/refunds/:id",
|
|
4909
|
+
nested: void 0
|
|
4910
|
+
},
|
|
4911
|
+
{
|
|
4912
|
+
label: config$3.label,
|
|
4913
|
+
icon: config$3.icon,
|
|
4914
|
+
path: "/payments/:id",
|
|
4915
|
+
nested: void 0
|
|
4916
4916
|
},
|
|
4917
4917
|
{
|
|
4918
4918
|
label: config$2.label,
|
|
4919
4919
|
icon: config$2.icon,
|
|
4920
4920
|
path: "/returns/:id",
|
|
4921
|
-
nested: void 0
|
|
4922
|
-
rank: void 0,
|
|
4923
|
-
translationNs: void 0
|
|
4921
|
+
nested: void 0
|
|
4924
4922
|
},
|
|
4925
4923
|
{
|
|
4926
|
-
label: config
|
|
4927
|
-
icon: config
|
|
4928
|
-
path: "/
|
|
4929
|
-
nested: void 0
|
|
4930
|
-
rank: void 0,
|
|
4931
|
-
translationNs: void 0
|
|
4924
|
+
label: config.label,
|
|
4925
|
+
icon: config.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;
|