order-management 0.0.90 → 0.0.92
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 +850 -760
- package/.medusa/server/src/admin/index.mjs +852 -762
- package/.medusa/server/src/api/admin/orders/[order_id]/refund-context/route.js +87 -24
- package/.medusa/server/src/api/admin/refund-payment-mapping/[return_id]/mark-refunded/route.js +38 -1
- package/.medusa/server/src/api/admin/return/[id]/route.js +19 -2
- package/.medusa/server/src/api/admin/return/route.js +43 -3
- package/.medusa/server/src/api/middlewares/block-refund-until-return-received.js +97 -0
- package/.medusa/server/src/api/middlewares.js +7 -1
- package/.medusa/server/src/api/store/orders/[order_id]/refund-payment-mappings/route.js +4 -2
- package/.medusa/server/src/api/store/returns/[id]/route.js +13 -3
- package/.medusa/server/src/api/store/returns/route.js +36 -3
- package/.medusa/server/src/helpers/detect-cod.js +81 -13
- package/.medusa/server/src/helpers/index.js +3 -1
- package/.medusa/server/src/helpers/refund-calculation.js +275 -0
- package/.medusa/server/src/helpers/refund-receive-guard.js +48 -0
- package/.medusa/server/src/helpers/returns.js +2 -1
- package/.medusa/server/src/modules/payment-detail/service.js +9 -1
- package/README.md +58 -17
- package/package.json +1 -1
|
@@ -470,6 +470,48 @@ const OrderGiftItemsWidget = ({ data }) => {
|
|
|
470
470
|
adminSdk.defineWidgetConfig({
|
|
471
471
|
zone: "order.details.side.after"
|
|
472
472
|
});
|
|
473
|
+
function formatRefundCurrency(amount, currencyCode = "inr", options) {
|
|
474
|
+
const formatted = new Intl.NumberFormat("en-IN", {
|
|
475
|
+
style: "currency",
|
|
476
|
+
currency: (currencyCode || "inr").toUpperCase(),
|
|
477
|
+
currencyDisplay: "symbol",
|
|
478
|
+
minimumFractionDigits: 2,
|
|
479
|
+
maximumFractionDigits: 2
|
|
480
|
+
}).format(amount);
|
|
481
|
+
if ((options == null ? void 0 : options.signed) && amount > 0) {
|
|
482
|
+
return `−${formatted}`;
|
|
483
|
+
}
|
|
484
|
+
return formatted;
|
|
485
|
+
}
|
|
486
|
+
const RefundCalculationBlock = ({ refund }) => {
|
|
487
|
+
const currency = refund.currency_code || "inr";
|
|
488
|
+
const finalLabel = refund.is_processed ? formatRefundCurrency(refund.final_refund_amount ?? 0, currency) : "Refund pending";
|
|
489
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
490
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Refund calculation" }),
|
|
491
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
492
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
493
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Product amount" }),
|
|
494
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: formatRefundCurrency(refund.product_amount, currency) })
|
|
495
|
+
] }),
|
|
496
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4", children: [
|
|
497
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Return charge" }),
|
|
498
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: formatRefundCurrency(refund.return_charge, currency, { signed: true }) })
|
|
499
|
+
] }),
|
|
500
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4 border-t border-ui-border-base pt-1.5", children: [
|
|
501
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: "Final refund amount" }),
|
|
502
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", children: finalLabel })
|
|
503
|
+
] })
|
|
504
|
+
] }),
|
|
505
|
+
refund.is_processed && refund.destination_label ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "xsmall", className: "text-ui-fg-muted", children: [
|
|
506
|
+
formatRefundCurrency(refund.final_refund_amount ?? 0, currency),
|
|
507
|
+
" will be refunded to",
|
|
508
|
+
" ",
|
|
509
|
+
refund.destination_label,
|
|
510
|
+
"."
|
|
511
|
+
] }) : null,
|
|
512
|
+
!refund.is_processed ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", className: "text-ui-fg-muted", children: "Refund pending." }) : null
|
|
513
|
+
] });
|
|
514
|
+
};
|
|
473
515
|
const FIELD_LABELS = {
|
|
474
516
|
// UPI
|
|
475
517
|
upi_id: "UPI ID",
|
|
@@ -491,7 +533,7 @@ function getOrderIdFromPath() {
|
|
|
491
533
|
return m ? m[1] : void 0;
|
|
492
534
|
}
|
|
493
535
|
const OrderRefundContextWidget = (props) => {
|
|
494
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
536
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
495
537
|
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();
|
|
496
538
|
const [context, setContext] = react.useState(null);
|
|
497
539
|
const [loading, setLoading] = react.useState(!!orderId);
|
|
@@ -530,7 +572,9 @@ const OrderRefundContextWidget = (props) => {
|
|
|
530
572
|
};
|
|
531
573
|
}, [orderId]);
|
|
532
574
|
const handleMarkRefunded = async () => {
|
|
533
|
-
if (!(context == null ? void 0 : context.return_id) || !(context == null ? void 0 : context.refund_mapping) || context.refund_mapping.is_refunded)
|
|
575
|
+
if (!(context == null ? void 0 : context.return_id) || !(context == null ? void 0 : context.refund_mapping) || context.refund_mapping.is_refunded || !context.can_process_refund) {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
534
578
|
setMarking(true);
|
|
535
579
|
setMarkError(null);
|
|
536
580
|
try {
|
|
@@ -549,6 +593,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
549
593
|
var _a2;
|
|
550
594
|
return prev && prev.refund_mapping ? {
|
|
551
595
|
...prev,
|
|
596
|
+
can_process_refund: false,
|
|
552
597
|
refund_mapping: {
|
|
553
598
|
...prev.refund_mapping,
|
|
554
599
|
is_refunded: ((_a2 = data.refund_payment_mapping) == null ? void 0 : _a2.is_refunded) ?? true
|
|
@@ -636,7 +681,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
636
681
|
}
|
|
637
682
|
};
|
|
638
683
|
if (!orderId) return null;
|
|
639
|
-
if (!loading && !error && context && !context.refund_mapping) return null;
|
|
684
|
+
if (!loading && !error && context && !context.refund_mapping && !context.refund) return null;
|
|
640
685
|
if (loading) {
|
|
641
686
|
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-subtle", children: "Loading refund context..." }) }) });
|
|
642
687
|
}
|
|
@@ -645,28 +690,47 @@ const OrderRefundContextWidget = (props) => {
|
|
|
645
690
|
}
|
|
646
691
|
const hasReturn = !!(context == null ? void 0 : context.return_id);
|
|
647
692
|
const hasMapping = !!(context == null ? void 0 : context.refund_mapping);
|
|
648
|
-
const canMarkRefunded =
|
|
693
|
+
const canMarkRefunded = Boolean(context == null ? void 0 : context.can_process_refund);
|
|
694
|
+
const returnStatus = (context == null ? void 0 : context.return_status) ?? null;
|
|
695
|
+
const showReceiveFirstHint = hasReturn && !((_d = context == null ? void 0 : context.refund_mapping) == null ? void 0 : _d.is_refunded) && returnStatus !== "received" && returnStatus !== "canceled";
|
|
649
696
|
const paymentDetail = context == null ? void 0 : context.payment_detail;
|
|
697
|
+
const orderPayment = context == null ? void 0 : context.order_payment;
|
|
650
698
|
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: [
|
|
651
699
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Heading, { level: "h2", className: "flex items-center gap-2", children: [
|
|
652
700
|
/* @__PURE__ */ jsxRuntime.jsx(icons.CashSolid, { className: "text-ui-fg-subtle" }),
|
|
653
701
|
"Refund payment"
|
|
654
702
|
] }),
|
|
655
703
|
!hasReturn && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No return for this order." }),
|
|
704
|
+
showReceiveFirstHint && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Receive returned items before processing a refund. Do not refund from Payments until items are received." }),
|
|
656
705
|
hasMapping && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-4", children: [
|
|
657
706
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
658
707
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Return" }),
|
|
659
708
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: context.return_id }),
|
|
660
|
-
((
|
|
709
|
+
((_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" })
|
|
710
|
+
] }),
|
|
711
|
+
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,
|
|
712
|
+
orderPayment && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 space-y-2 border-t border-ui-border-base pt-3", children: [
|
|
713
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Order payment method" }),
|
|
714
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
715
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { children: orderPayment.label }),
|
|
716
|
+
orderPayment.is_cod ? /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "orange", children: "COD" }) : null
|
|
717
|
+
] }),
|
|
718
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", className: "text-ui-fg-muted", children: orderPayment.provider_id })
|
|
661
719
|
] }),
|
|
662
720
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 space-y-2 border-t border-ui-border-base pt-3", children: [
|
|
663
721
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
664
722
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Payment method (refund destination)" }),
|
|
665
|
-
((
|
|
723
|
+
((_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
|
|
666
724
|
] }),
|
|
667
|
-
((
|
|
668
|
-
!((
|
|
669
|
-
!((
|
|
725
|
+
((_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." }) }),
|
|
726
|
+
!((_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." }) }),
|
|
727
|
+
!((_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: [
|
|
728
|
+
"Refund will go to the original payment method (",
|
|
729
|
+
orderPayment.label,
|
|
730
|
+
")."
|
|
731
|
+
] }) }),
|
|
732
|
+
!((_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." }) }),
|
|
733
|
+
!((_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." }) }),
|
|
670
734
|
paymentDetail && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
671
735
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
672
736
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { children: paymentDetail.type.toUpperCase() }),
|
|
@@ -820,7 +884,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
820
884
|
] }),
|
|
821
885
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
822
886
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", weight: "plus", className: "text-ui-fg-muted", children: "Images" }),
|
|
823
|
-
((
|
|
887
|
+
((_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(
|
|
824
888
|
"a",
|
|
825
889
|
{
|
|
826
890
|
href: url,
|
|
@@ -849,9 +913,20 @@ const OrderRefundContextWidget = (props) => {
|
|
|
849
913
|
}
|
|
850
914
|
),
|
|
851
915
|
markError && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-error", children: markError })
|
|
852
|
-
] })
|
|
916
|
+
] }),
|
|
917
|
+
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." })
|
|
853
918
|
] }),
|
|
854
|
-
hasReturn && !hasMapping && /* @__PURE__ */ jsxRuntime.
|
|
919
|
+
hasReturn && !hasMapping && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-4", children: [
|
|
920
|
+
(context == null ? void 0 : context.refund) ? /* @__PURE__ */ jsxRuntime.jsx(RefundCalculationBlock, { refund: context.refund }) : null,
|
|
921
|
+
orderPayment && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3 space-y-1", children: [
|
|
922
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Order payment method" }),
|
|
923
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
924
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { children: orderPayment.label }),
|
|
925
|
+
orderPayment.is_cod ? /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "orange", children: "COD" }) : null
|
|
926
|
+
] })
|
|
927
|
+
] }),
|
|
928
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No refund payment mapping for this return. Ensure the refund_payment_mapping module is registered and a mapping was created when the return was created." })
|
|
929
|
+
] })
|
|
855
930
|
] }) });
|
|
856
931
|
};
|
|
857
932
|
adminSdk.defineWidgetConfig({
|
|
@@ -873,27 +948,19 @@ const getStatusBadgeClass$7 = (status) => {
|
|
|
873
948
|
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
874
949
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
875
950
|
};
|
|
876
|
-
const
|
|
951
|
+
const PaymentsPage = () => {
|
|
877
952
|
const navigate = reactRouterDom.useNavigate();
|
|
878
953
|
const [items, setItems] = react.useState([]);
|
|
954
|
+
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
879
955
|
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
880
956
|
const debouncedOrderId = useDebounce$3(orderIdSearch, 300);
|
|
881
|
-
const [paymentStatusFilter, setPaymentStatusFilter] = react.useState("all");
|
|
882
|
-
const [providerSearch, setProviderSearch] = react.useState("");
|
|
883
|
-
const debouncedProvider = useDebounce$3(providerSearch, 300);
|
|
884
|
-
const [currencySearch, setCurrencySearch] = react.useState("");
|
|
885
|
-
const debouncedCurrency = useDebounce$3(currencySearch, 300);
|
|
886
|
-
const [dateFrom, setDateFrom] = react.useState("");
|
|
887
|
-
const [dateTo, setDateTo] = react.useState("");
|
|
888
|
-
const [amountMin, setAmountMin] = react.useState("");
|
|
889
|
-
const [amountMax, setAmountMax] = react.useState("");
|
|
890
957
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
891
958
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
892
959
|
const [error, setError] = react.useState(null);
|
|
893
960
|
const [offset, setOffset] = react.useState(0);
|
|
894
961
|
const [count, setCount] = react.useState(0);
|
|
895
962
|
const limit = 50;
|
|
896
|
-
const
|
|
963
|
+
const loadTransactions = react.useCallback(
|
|
897
964
|
async (nextOffset, replace) => {
|
|
898
965
|
try {
|
|
899
966
|
if (replace) setIsLoading(true);
|
|
@@ -902,25 +969,18 @@ const RefundsPage = () => {
|
|
|
902
969
|
const params = new URLSearchParams();
|
|
903
970
|
params.set("limit", String(limit));
|
|
904
971
|
params.set("offset", String(nextOffset));
|
|
972
|
+
if (statusFilter !== "all") params.set("status", statusFilter);
|
|
905
973
|
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
if (dateTo.trim()) params.set("date_to", dateTo.trim());
|
|
911
|
-
const min = amountMin.trim() ? Number(amountMin) : void 0;
|
|
912
|
-
const max = amountMax.trim() ? Number(amountMax) : void 0;
|
|
913
|
-
if (min != null && !Number.isNaN(min)) params.set("amount_min", String(min));
|
|
914
|
-
if (max != null && !Number.isNaN(max)) params.set("amount_max", String(max));
|
|
915
|
-
const response = await fetch(`/admin/refunds?${params.toString()}`, {
|
|
916
|
-
credentials: "include"
|
|
917
|
-
});
|
|
974
|
+
const response = await fetch(
|
|
975
|
+
`/admin/payment-transactions?${params.toString()}`,
|
|
976
|
+
{ credentials: "include" }
|
|
977
|
+
);
|
|
918
978
|
if (!response.ok) {
|
|
919
979
|
const text = await response.text();
|
|
920
|
-
throw new Error(text || "Failed to load
|
|
980
|
+
throw new Error(text || "Failed to load payment transactions");
|
|
921
981
|
}
|
|
922
982
|
const payload = await response.json();
|
|
923
|
-
const list = payload.
|
|
983
|
+
const list = payload.transactions ?? [];
|
|
924
984
|
setCount(payload.count ?? 0);
|
|
925
985
|
setOffset(nextOffset + list.length);
|
|
926
986
|
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
@@ -931,75 +991,46 @@ const RefundsPage = () => {
|
|
|
931
991
|
setIsFetchingMore(false);
|
|
932
992
|
}
|
|
933
993
|
},
|
|
934
|
-
[
|
|
935
|
-
debouncedOrderId,
|
|
936
|
-
paymentStatusFilter,
|
|
937
|
-
debouncedProvider,
|
|
938
|
-
debouncedCurrency,
|
|
939
|
-
dateFrom,
|
|
940
|
-
dateTo,
|
|
941
|
-
amountMin,
|
|
942
|
-
amountMax
|
|
943
|
-
]
|
|
994
|
+
[statusFilter, debouncedOrderId]
|
|
944
995
|
);
|
|
945
996
|
react.useEffect(() => {
|
|
946
|
-
void
|
|
947
|
-
}, [
|
|
997
|
+
void loadTransactions(0, true);
|
|
998
|
+
}, [loadTransactions]);
|
|
948
999
|
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
949
|
-
const
|
|
950
|
-
const
|
|
951
|
-
return `${code} ${Number(r.amount)}`;
|
|
952
|
-
};
|
|
953
|
-
const displayStatus = (r) => {
|
|
954
|
-
const s2 = r.payment_status ?? "";
|
|
1000
|
+
const displayStatus = (t) => {
|
|
1001
|
+
const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
|
|
955
1002
|
return s2 !== "" ? s2 : "—";
|
|
956
1003
|
};
|
|
1004
|
+
const displayAmount = (t) => {
|
|
1005
|
+
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
1006
|
+
return `${code} ${Number(t.amount)}`;
|
|
1007
|
+
};
|
|
957
1008
|
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: [
|
|
958
1009
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
959
1010
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
960
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
961
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "
|
|
1011
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payments" }),
|
|
1012
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
|
|
962
1013
|
] }),
|
|
963
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () =>
|
|
1014
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
|
|
964
1015
|
] }),
|
|
965
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1016
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
966
1017
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
967
1018
|
ui.Input,
|
|
968
1019
|
{
|
|
969
|
-
placeholder: "Order ID",
|
|
1020
|
+
placeholder: "Search by Order ID",
|
|
970
1021
|
value: orderIdSearch,
|
|
971
1022
|
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
972
|
-
className: "md:max-w-
|
|
973
|
-
"aria-label": "
|
|
974
|
-
}
|
|
975
|
-
),
|
|
976
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
977
|
-
ui.Input,
|
|
978
|
-
{
|
|
979
|
-
placeholder: "Provider",
|
|
980
|
-
value: providerSearch,
|
|
981
|
-
onChange: (e) => setProviderSearch(e.target.value),
|
|
982
|
-
className: "md:max-w-[140px]",
|
|
983
|
-
"aria-label": "Filter by provider"
|
|
984
|
-
}
|
|
985
|
-
),
|
|
986
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
987
|
-
ui.Input,
|
|
988
|
-
{
|
|
989
|
-
placeholder: "Currency",
|
|
990
|
-
value: currencySearch,
|
|
991
|
-
onChange: (e) => setCurrencySearch(e.target.value),
|
|
992
|
-
className: "md:max-w-[100px]",
|
|
993
|
-
"aria-label": "Filter by currency"
|
|
1023
|
+
className: "md:max-w-sm",
|
|
1024
|
+
"aria-label": "Search by order ID"
|
|
994
1025
|
}
|
|
995
1026
|
),
|
|
996
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1027
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
997
1028
|
"select",
|
|
998
1029
|
{
|
|
999
|
-
value:
|
|
1000
|
-
onChange: (e) =>
|
|
1001
|
-
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-
|
|
1002
|
-
"aria-label": "Filter by
|
|
1030
|
+
value: statusFilter,
|
|
1031
|
+
onChange: (e) => setStatusFilter(e.target.value),
|
|
1032
|
+
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",
|
|
1033
|
+
"aria-label": "Filter by status",
|
|
1003
1034
|
children: [
|
|
1004
1035
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
1005
1036
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
@@ -1010,103 +1041,52 @@ const RefundsPage = () => {
|
|
|
1010
1041
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
1011
1042
|
]
|
|
1012
1043
|
}
|
|
1013
|
-
)
|
|
1014
|
-
|
|
1015
|
-
ui.Input,
|
|
1016
|
-
{
|
|
1017
|
-
type: "date",
|
|
1018
|
-
placeholder: "From",
|
|
1019
|
-
value: dateFrom,
|
|
1020
|
-
onChange: (e) => setDateFrom(e.target.value),
|
|
1021
|
-
className: "md:max-w-[140px]",
|
|
1022
|
-
"aria-label": "Date from"
|
|
1023
|
-
}
|
|
1024
|
-
),
|
|
1025
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1026
|
-
ui.Input,
|
|
1027
|
-
{
|
|
1028
|
-
type: "date",
|
|
1029
|
-
placeholder: "To",
|
|
1030
|
-
value: dateTo,
|
|
1031
|
-
onChange: (e) => setDateTo(e.target.value),
|
|
1032
|
-
className: "md:max-w-[140px]",
|
|
1033
|
-
"aria-label": "Date to"
|
|
1034
|
-
}
|
|
1035
|
-
),
|
|
1036
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1037
|
-
ui.Input,
|
|
1038
|
-
{
|
|
1039
|
-
placeholder: "Amount min",
|
|
1040
|
-
value: amountMin,
|
|
1041
|
-
onChange: (e) => setAmountMin(e.target.value),
|
|
1042
|
-
type: "number",
|
|
1043
|
-
min: 0,
|
|
1044
|
-
className: "md:max-w-[100px]",
|
|
1045
|
-
"aria-label": "Refund amount minimum"
|
|
1046
|
-
}
|
|
1047
|
-
),
|
|
1048
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1049
|
-
ui.Input,
|
|
1050
|
-
{
|
|
1051
|
-
placeholder: "Amount max",
|
|
1052
|
-
value: amountMax,
|
|
1053
|
-
onChange: (e) => setAmountMax(e.target.value),
|
|
1054
|
-
type: "number",
|
|
1055
|
-
min: 0,
|
|
1056
|
-
className: "md:max-w-[100px]",
|
|
1057
|
-
"aria-label": "Refund amount maximum"
|
|
1058
|
-
}
|
|
1059
|
-
)
|
|
1060
|
-
] }) }),
|
|
1044
|
+
) })
|
|
1045
|
+
] }),
|
|
1061
1046
|
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1062
1047
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1063
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () =>
|
|
1048
|
+
/* @__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" }) })
|
|
1064
1049
|
] }) : null,
|
|
1065
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading
|
|
1066
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No
|
|
1067
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "
|
|
1068
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
1050
|
+
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: [
|
|
1051
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
|
|
1052
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
|
|
1053
|
+
] }) : /* @__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: [
|
|
1069
1054
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1070
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1071
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1072
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1073
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1074
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1075
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1076
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1077
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[14%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Note" }),
|
|
1078
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1079
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[8%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1055
|
+
/* @__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" }),
|
|
1056
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
1057
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
1058
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
1059
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
|
|
1060
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1061
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1080
1062
|
] }) }),
|
|
1081
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((
|
|
1063
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1082
1064
|
"tr",
|
|
1083
1065
|
{
|
|
1084
|
-
className: "
|
|
1085
|
-
onClick: () => navigate(`/
|
|
1066
|
+
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1067
|
+
onClick: () => navigate(`/payments/${t.payment_session_id}`),
|
|
1086
1068
|
children: [
|
|
1087
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1088
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1089
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1090
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1091
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle uppercase", children: r.currency_code || "—" }),
|
|
1092
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", title: r.provider_id || void 0, children: r.provider_id || "—" }),
|
|
1093
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1069
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
|
|
1070
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
|
|
1071
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
|
|
1072
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1094
1073
|
ui.Badge,
|
|
1095
1074
|
{
|
|
1096
1075
|
size: "2xsmall",
|
|
1097
|
-
className: `uppercase ${getStatusBadgeClass$7(displayStatus(
|
|
1098
|
-
children: displayStatus(
|
|
1076
|
+
className: `uppercase ${getStatusBadgeClass$7(displayStatus(t))}`,
|
|
1077
|
+
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
1099
1078
|
}
|
|
1100
1079
|
) }),
|
|
1101
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1102
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1080
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
|
|
1081
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
|
|
1082
|
+
year: "numeric",
|
|
1103
1083
|
month: "short",
|
|
1104
1084
|
day: "numeric",
|
|
1105
1085
|
hour: "numeric",
|
|
1106
1086
|
minute: "2-digit",
|
|
1107
1087
|
hour12: true
|
|
1108
1088
|
}) }),
|
|
1109
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1089
|
+
/* @__PURE__ */ jsxRuntime.jsxs("td", { className: "px-4 py-4", children: [
|
|
1110
1090
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1111
1091
|
ui.Button,
|
|
1112
1092
|
{
|
|
@@ -1114,27 +1094,27 @@ const RefundsPage = () => {
|
|
|
1114
1094
|
size: "small",
|
|
1115
1095
|
onClick: (e) => {
|
|
1116
1096
|
e.stopPropagation();
|
|
1117
|
-
navigate(`/
|
|
1097
|
+
navigate(`/payments/${t.payment_session_id}`);
|
|
1118
1098
|
},
|
|
1119
|
-
children: "
|
|
1099
|
+
children: "View details"
|
|
1120
1100
|
}
|
|
1121
1101
|
),
|
|
1122
|
-
|
|
1102
|
+
t.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1123
1103
|
ui.Button,
|
|
1124
1104
|
{
|
|
1125
1105
|
variant: "transparent",
|
|
1126
1106
|
size: "small",
|
|
1127
1107
|
onClick: (e) => {
|
|
1128
1108
|
e.stopPropagation();
|
|
1129
|
-
navigate(`/orders/${
|
|
1109
|
+
navigate(`/orders/${t.order_id}`);
|
|
1130
1110
|
},
|
|
1131
1111
|
children: "Order"
|
|
1132
1112
|
}
|
|
1133
1113
|
) : null
|
|
1134
|
-
] })
|
|
1114
|
+
] })
|
|
1135
1115
|
]
|
|
1136
1116
|
},
|
|
1137
|
-
|
|
1117
|
+
t.payment_session_id
|
|
1138
1118
|
)) })
|
|
1139
1119
|
] }) }),
|
|
1140
1120
|
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1142,15 +1122,15 @@ const RefundsPage = () => {
|
|
|
1142
1122
|
{
|
|
1143
1123
|
variant: "secondary",
|
|
1144
1124
|
isLoading: isFetchingMore,
|
|
1145
|
-
onClick: () =>
|
|
1125
|
+
onClick: () => loadTransactions(offset, false),
|
|
1146
1126
|
children: "Load more"
|
|
1147
1127
|
}
|
|
1148
1128
|
) }) : null
|
|
1149
1129
|
] }) });
|
|
1150
1130
|
};
|
|
1151
1131
|
const config$7 = adminSdk.defineRouteConfig({
|
|
1152
|
-
label: "
|
|
1153
|
-
icon: icons.
|
|
1132
|
+
label: "Payments",
|
|
1133
|
+
icon: icons.CreditCard
|
|
1154
1134
|
});
|
|
1155
1135
|
const useDebounce$2 = (value, delay) => {
|
|
1156
1136
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
@@ -1336,13 +1316,23 @@ const ReturnsPage = () => {
|
|
|
1336
1316
|
}
|
|
1337
1317
|
) }),
|
|
1338
1318
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
|
|
1339
|
-
const
|
|
1340
|
-
if (
|
|
1319
|
+
const calc = returnOrder.refund;
|
|
1320
|
+
if ((calc == null ? void 0 : calc.is_processed) && calc.final_refund_amount != null) {
|
|
1321
|
+
return formatRefundCurrency(
|
|
1322
|
+
calc.final_refund_amount,
|
|
1323
|
+
calc.currency_code || returnOrder.currency_code
|
|
1324
|
+
);
|
|
1325
|
+
}
|
|
1326
|
+
if (calc) {
|
|
1327
|
+
return "Pending";
|
|
1328
|
+
}
|
|
1329
|
+
if (returnOrder.refund_amount == null) {
|
|
1341
1330
|
return "—";
|
|
1342
1331
|
}
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1332
|
+
return formatRefundCurrency(
|
|
1333
|
+
Number(returnOrder.refund_amount),
|
|
1334
|
+
returnOrder.currency_code
|
|
1335
|
+
);
|
|
1346
1336
|
})() }),
|
|
1347
1337
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(returnOrder.created_at).toLocaleDateString("en-US", {
|
|
1348
1338
|
year: "numeric",
|
|
@@ -1393,13 +1383,308 @@ const useDebounce$1 = (value, delay) => {
|
|
|
1393
1383
|
return debouncedValue;
|
|
1394
1384
|
};
|
|
1395
1385
|
const getStatusBadgeClass$5 = (status) => {
|
|
1396
|
-
const
|
|
1397
|
-
if (
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
if (
|
|
1401
|
-
|
|
1402
|
-
|
|
1386
|
+
const s2 = status.toLowerCase();
|
|
1387
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1388
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1389
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1390
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1391
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1392
|
+
};
|
|
1393
|
+
const RefundsPage = () => {
|
|
1394
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1395
|
+
const [items, setItems] = react.useState([]);
|
|
1396
|
+
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
1397
|
+
const debouncedOrderId = useDebounce$1(orderIdSearch, 300);
|
|
1398
|
+
const [paymentStatusFilter, setPaymentStatusFilter] = react.useState("all");
|
|
1399
|
+
const [providerSearch, setProviderSearch] = react.useState("");
|
|
1400
|
+
const debouncedProvider = useDebounce$1(providerSearch, 300);
|
|
1401
|
+
const [currencySearch, setCurrencySearch] = react.useState("");
|
|
1402
|
+
const debouncedCurrency = useDebounce$1(currencySearch, 300);
|
|
1403
|
+
const [dateFrom, setDateFrom] = react.useState("");
|
|
1404
|
+
const [dateTo, setDateTo] = react.useState("");
|
|
1405
|
+
const [amountMin, setAmountMin] = react.useState("");
|
|
1406
|
+
const [amountMax, setAmountMax] = react.useState("");
|
|
1407
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
1408
|
+
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
1409
|
+
const [error, setError] = react.useState(null);
|
|
1410
|
+
const [offset, setOffset] = react.useState(0);
|
|
1411
|
+
const [count, setCount] = react.useState(0);
|
|
1412
|
+
const limit = 50;
|
|
1413
|
+
const loadRefunds = react.useCallback(
|
|
1414
|
+
async (nextOffset, replace) => {
|
|
1415
|
+
try {
|
|
1416
|
+
if (replace) setIsLoading(true);
|
|
1417
|
+
else setIsFetchingMore(true);
|
|
1418
|
+
setError(null);
|
|
1419
|
+
const params = new URLSearchParams();
|
|
1420
|
+
params.set("limit", String(limit));
|
|
1421
|
+
params.set("offset", String(nextOffset));
|
|
1422
|
+
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
1423
|
+
if (paymentStatusFilter !== "all") params.set("payment_status", paymentStatusFilter);
|
|
1424
|
+
if (debouncedProvider.trim()) params.set("provider_id", debouncedProvider.trim());
|
|
1425
|
+
if (debouncedCurrency.trim()) params.set("currency_code", debouncedCurrency.trim());
|
|
1426
|
+
if (dateFrom.trim()) params.set("date_from", dateFrom.trim());
|
|
1427
|
+
if (dateTo.trim()) params.set("date_to", dateTo.trim());
|
|
1428
|
+
const min = amountMin.trim() ? Number(amountMin) : void 0;
|
|
1429
|
+
const max = amountMax.trim() ? Number(amountMax) : void 0;
|
|
1430
|
+
if (min != null && !Number.isNaN(min)) params.set("amount_min", String(min));
|
|
1431
|
+
if (max != null && !Number.isNaN(max)) params.set("amount_max", String(max));
|
|
1432
|
+
const response = await fetch(`/admin/refunds?${params.toString()}`, {
|
|
1433
|
+
credentials: "include"
|
|
1434
|
+
});
|
|
1435
|
+
if (!response.ok) {
|
|
1436
|
+
const text = await response.text();
|
|
1437
|
+
throw new Error(text || "Failed to load refunds");
|
|
1438
|
+
}
|
|
1439
|
+
const payload = await response.json();
|
|
1440
|
+
const list = payload.refunds ?? [];
|
|
1441
|
+
setCount(payload.count ?? 0);
|
|
1442
|
+
setOffset(nextOffset + list.length);
|
|
1443
|
+
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
1444
|
+
} catch (e) {
|
|
1445
|
+
setError(e instanceof Error ? e.message : "Failed to load");
|
|
1446
|
+
} finally {
|
|
1447
|
+
setIsLoading(false);
|
|
1448
|
+
setIsFetchingMore(false);
|
|
1449
|
+
}
|
|
1450
|
+
},
|
|
1451
|
+
[
|
|
1452
|
+
debouncedOrderId,
|
|
1453
|
+
paymentStatusFilter,
|
|
1454
|
+
debouncedProvider,
|
|
1455
|
+
debouncedCurrency,
|
|
1456
|
+
dateFrom,
|
|
1457
|
+
dateTo,
|
|
1458
|
+
amountMin,
|
|
1459
|
+
amountMax
|
|
1460
|
+
]
|
|
1461
|
+
);
|
|
1462
|
+
react.useEffect(() => {
|
|
1463
|
+
void loadRefunds(0, true);
|
|
1464
|
+
}, [loadRefunds]);
|
|
1465
|
+
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
1466
|
+
const displayAmount = (r) => {
|
|
1467
|
+
const code = (r.currency_code ?? "USD").toUpperCase();
|
|
1468
|
+
return `${code} ${Number(r.amount)}`;
|
|
1469
|
+
};
|
|
1470
|
+
const displayStatus = (r) => {
|
|
1471
|
+
const s2 = r.payment_status ?? "";
|
|
1472
|
+
return s2 !== "" ? s2 : "—";
|
|
1473
|
+
};
|
|
1474
|
+
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: [
|
|
1475
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1476
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1477
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refunds" }),
|
|
1478
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Refund records — amount, order, payment status" })
|
|
1479
|
+
] }),
|
|
1480
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadRefunds(0, true), children: "Refresh" })
|
|
1481
|
+
] }),
|
|
1482
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
1483
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1484
|
+
ui.Input,
|
|
1485
|
+
{
|
|
1486
|
+
placeholder: "Order ID",
|
|
1487
|
+
value: orderIdSearch,
|
|
1488
|
+
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
1489
|
+
className: "md:max-w-[180px]",
|
|
1490
|
+
"aria-label": "Filter by order ID"
|
|
1491
|
+
}
|
|
1492
|
+
),
|
|
1493
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1494
|
+
ui.Input,
|
|
1495
|
+
{
|
|
1496
|
+
placeholder: "Provider",
|
|
1497
|
+
value: providerSearch,
|
|
1498
|
+
onChange: (e) => setProviderSearch(e.target.value),
|
|
1499
|
+
className: "md:max-w-[140px]",
|
|
1500
|
+
"aria-label": "Filter by provider"
|
|
1501
|
+
}
|
|
1502
|
+
),
|
|
1503
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1504
|
+
ui.Input,
|
|
1505
|
+
{
|
|
1506
|
+
placeholder: "Currency",
|
|
1507
|
+
value: currencySearch,
|
|
1508
|
+
onChange: (e) => setCurrencySearch(e.target.value),
|
|
1509
|
+
className: "md:max-w-[100px]",
|
|
1510
|
+
"aria-label": "Filter by currency"
|
|
1511
|
+
}
|
|
1512
|
+
),
|
|
1513
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1514
|
+
"select",
|
|
1515
|
+
{
|
|
1516
|
+
value: paymentStatusFilter,
|
|
1517
|
+
onChange: (e) => setPaymentStatusFilter(e.target.value),
|
|
1518
|
+
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-[160px]",
|
|
1519
|
+
"aria-label": "Filter by payment status",
|
|
1520
|
+
children: [
|
|
1521
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
1522
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
1523
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
1524
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "error", children: "Error" }),
|
|
1525
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
1526
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
1527
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
1528
|
+
]
|
|
1529
|
+
}
|
|
1530
|
+
),
|
|
1531
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1532
|
+
ui.Input,
|
|
1533
|
+
{
|
|
1534
|
+
type: "date",
|
|
1535
|
+
placeholder: "From",
|
|
1536
|
+
value: dateFrom,
|
|
1537
|
+
onChange: (e) => setDateFrom(e.target.value),
|
|
1538
|
+
className: "md:max-w-[140px]",
|
|
1539
|
+
"aria-label": "Date from"
|
|
1540
|
+
}
|
|
1541
|
+
),
|
|
1542
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1543
|
+
ui.Input,
|
|
1544
|
+
{
|
|
1545
|
+
type: "date",
|
|
1546
|
+
placeholder: "To",
|
|
1547
|
+
value: dateTo,
|
|
1548
|
+
onChange: (e) => setDateTo(e.target.value),
|
|
1549
|
+
className: "md:max-w-[140px]",
|
|
1550
|
+
"aria-label": "Date to"
|
|
1551
|
+
}
|
|
1552
|
+
),
|
|
1553
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1554
|
+
ui.Input,
|
|
1555
|
+
{
|
|
1556
|
+
placeholder: "Amount min",
|
|
1557
|
+
value: amountMin,
|
|
1558
|
+
onChange: (e) => setAmountMin(e.target.value),
|
|
1559
|
+
type: "number",
|
|
1560
|
+
min: 0,
|
|
1561
|
+
className: "md:max-w-[100px]",
|
|
1562
|
+
"aria-label": "Refund amount minimum"
|
|
1563
|
+
}
|
|
1564
|
+
),
|
|
1565
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1566
|
+
ui.Input,
|
|
1567
|
+
{
|
|
1568
|
+
placeholder: "Amount max",
|
|
1569
|
+
value: amountMax,
|
|
1570
|
+
onChange: (e) => setAmountMax(e.target.value),
|
|
1571
|
+
type: "number",
|
|
1572
|
+
min: 0,
|
|
1573
|
+
className: "md:max-w-[100px]",
|
|
1574
|
+
"aria-label": "Refund amount maximum"
|
|
1575
|
+
}
|
|
1576
|
+
)
|
|
1577
|
+
] }) }),
|
|
1578
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1579
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1580
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => loadRefunds(0, true), children: "Try again" }) })
|
|
1581
|
+
] }) : null,
|
|
1582
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading refunds…" }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
1583
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No refunds yet" }),
|
|
1584
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Refund records will appear here." })
|
|
1585
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full overflow-x-auto rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full table-fixed divide-y divide-ui-border-base", style: { minWidth: 0 }, children: [
|
|
1586
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1587
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Refund ID" }),
|
|
1588
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
1589
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Payment ID" }),
|
|
1590
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[8%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
1591
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[6%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Currency" }),
|
|
1592
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[10%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
1593
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[10%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Payment Status" }),
|
|
1594
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[14%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Note" }),
|
|
1595
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1596
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[8%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1597
|
+
] }) }),
|
|
1598
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((r) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1599
|
+
"tr",
|
|
1600
|
+
{
|
|
1601
|
+
className: "cursor-pointer hover:bg-ui-bg-subtle/60",
|
|
1602
|
+
onClick: () => navigate(`/refunds/${r.refund_id}`),
|
|
1603
|
+
children: [
|
|
1604
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 font-mono text-sm text-ui-fg-base", title: r.refund_id, children: r.refund_id }),
|
|
1605
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 font-medium text-ui-fg-base", title: r.order_id ?? void 0, children: r.order_id ?? "—" }),
|
|
1606
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 font-mono text-sm text-ui-fg-subtle", title: r.payment_id, children: r.payment_id }),
|
|
1607
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", children: displayAmount(r) }),
|
|
1608
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle uppercase", children: r.currency_code || "—" }),
|
|
1609
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", title: r.provider_id || void 0, children: r.provider_id || "—" }),
|
|
1610
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1611
|
+
ui.Badge,
|
|
1612
|
+
{
|
|
1613
|
+
size: "2xsmall",
|
|
1614
|
+
className: `uppercase ${getStatusBadgeClass$5(displayStatus(r))}`,
|
|
1615
|
+
children: displayStatus(r) !== "—" ? displayStatus(r).replace(/_/g, " ") : "—"
|
|
1616
|
+
}
|
|
1617
|
+
) }),
|
|
1618
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", title: r.note ?? void 0, children: r.note ?? "—" }),
|
|
1619
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle text-xs", children: new Date(r.created_at).toLocaleDateString("en-US", {
|
|
1620
|
+
month: "short",
|
|
1621
|
+
day: "numeric",
|
|
1622
|
+
hour: "numeric",
|
|
1623
|
+
minute: "2-digit",
|
|
1624
|
+
hour12: true
|
|
1625
|
+
}) }),
|
|
1626
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-1", children: [
|
|
1627
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1628
|
+
ui.Button,
|
|
1629
|
+
{
|
|
1630
|
+
variant: "transparent",
|
|
1631
|
+
size: "small",
|
|
1632
|
+
onClick: (e) => {
|
|
1633
|
+
e.stopPropagation();
|
|
1634
|
+
navigate(`/refunds/${r.refund_id}`);
|
|
1635
|
+
},
|
|
1636
|
+
children: "Details"
|
|
1637
|
+
}
|
|
1638
|
+
),
|
|
1639
|
+
r.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1640
|
+
ui.Button,
|
|
1641
|
+
{
|
|
1642
|
+
variant: "transparent",
|
|
1643
|
+
size: "small",
|
|
1644
|
+
onClick: (e) => {
|
|
1645
|
+
e.stopPropagation();
|
|
1646
|
+
navigate(`/orders/${r.order_id}`);
|
|
1647
|
+
},
|
|
1648
|
+
children: "Order"
|
|
1649
|
+
}
|
|
1650
|
+
) : null
|
|
1651
|
+
] }) })
|
|
1652
|
+
]
|
|
1653
|
+
},
|
|
1654
|
+
r.refund_id
|
|
1655
|
+
)) })
|
|
1656
|
+
] }) }),
|
|
1657
|
+
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1658
|
+
ui.Button,
|
|
1659
|
+
{
|
|
1660
|
+
variant: "secondary",
|
|
1661
|
+
isLoading: isFetchingMore,
|
|
1662
|
+
onClick: () => loadRefunds(offset, false),
|
|
1663
|
+
children: "Load more"
|
|
1664
|
+
}
|
|
1665
|
+
) }) : null
|
|
1666
|
+
] }) });
|
|
1667
|
+
};
|
|
1668
|
+
const config$5 = adminSdk.defineRouteConfig({
|
|
1669
|
+
label: "Refunds",
|
|
1670
|
+
icon: icons.Receipt
|
|
1671
|
+
});
|
|
1672
|
+
const useDebounce = (value, delay) => {
|
|
1673
|
+
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
1674
|
+
react.useEffect(() => {
|
|
1675
|
+
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
1676
|
+
return () => clearTimeout(handler);
|
|
1677
|
+
}, [value, delay]);
|
|
1678
|
+
return debouncedValue;
|
|
1679
|
+
};
|
|
1680
|
+
const getStatusBadgeClass$4 = (status) => {
|
|
1681
|
+
const statusLower = status.toLowerCase();
|
|
1682
|
+
if (statusLower === "requested") {
|
|
1683
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1684
|
+
}
|
|
1685
|
+
if (statusLower === "approved") {
|
|
1686
|
+
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1687
|
+
}
|
|
1403
1688
|
if (statusLower === "rejected") {
|
|
1404
1689
|
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1405
1690
|
}
|
|
@@ -1417,7 +1702,7 @@ const SwapsPage = () => {
|
|
|
1417
1702
|
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
1418
1703
|
const [createdByFilter, setCreatedByFilter] = react.useState("all");
|
|
1419
1704
|
const [searchQuery, setSearchQuery] = react.useState("");
|
|
1420
|
-
const debouncedSearchQuery = useDebounce
|
|
1705
|
+
const debouncedSearchQuery = useDebounce(searchQuery, 300);
|
|
1421
1706
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
1422
1707
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
1423
1708
|
const [error, setError] = react.useState(null);
|
|
@@ -1560,7 +1845,7 @@ const SwapsPage = () => {
|
|
|
1560
1845
|
ui.Badge,
|
|
1561
1846
|
{
|
|
1562
1847
|
size: "2xsmall",
|
|
1563
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
1848
|
+
className: `uppercase ${getStatusBadgeClass$4(swap.status)}`,
|
|
1564
1849
|
children: swap.status.replace(/_/g, " ")
|
|
1565
1850
|
}
|
|
1566
1851
|
) }),
|
|
@@ -1610,11 +1895,11 @@ const SwapsPage = () => {
|
|
|
1610
1895
|
) }) : null
|
|
1611
1896
|
] }) });
|
|
1612
1897
|
};
|
|
1613
|
-
const config$
|
|
1898
|
+
const config$4 = adminSdk.defineRouteConfig({
|
|
1614
1899
|
label: "Exchanges",
|
|
1615
1900
|
icon: icons.ArrowPath
|
|
1616
1901
|
});
|
|
1617
|
-
const getStatusBadgeClass$
|
|
1902
|
+
const getStatusBadgeClass$3 = (status) => {
|
|
1618
1903
|
const s2 = status.toLowerCase();
|
|
1619
1904
|
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1620
1905
|
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
@@ -1622,18 +1907,14 @@ const getStatusBadgeClass$4 = (status) => {
|
|
|
1622
1907
|
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1623
1908
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1624
1909
|
};
|
|
1625
|
-
const
|
|
1626
|
-
|
|
1627
|
-
};
|
|
1628
|
-
const RefundDetailPage = () => {
|
|
1629
|
-
var _a, _b, _c;
|
|
1910
|
+
const PaymentDetailPage = () => {
|
|
1911
|
+
var _a;
|
|
1630
1912
|
const navigate = reactRouterDom.useNavigate();
|
|
1631
1913
|
const params = reactRouterDom.useParams();
|
|
1632
1914
|
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
1633
1915
|
const [detail, setDetail] = react.useState(null);
|
|
1634
1916
|
const [loading, setLoading] = react.useState(!!id);
|
|
1635
1917
|
const [error, setError] = react.useState(null);
|
|
1636
|
-
const [gatewayExpanded, setGatewayExpanded] = react.useState(false);
|
|
1637
1918
|
react.useEffect(() => {
|
|
1638
1919
|
if (!id) {
|
|
1639
1920
|
setLoading(false);
|
|
@@ -1642,7 +1923,7 @@ const RefundDetailPage = () => {
|
|
|
1642
1923
|
let cancelled = false;
|
|
1643
1924
|
setLoading(true);
|
|
1644
1925
|
setError(null);
|
|
1645
|
-
fetch(`/admin/
|
|
1926
|
+
fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
|
|
1646
1927
|
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
1647
1928
|
return res.json();
|
|
1648
1929
|
}).then((data) => {
|
|
@@ -1656,157 +1937,88 @@ const RefundDetailPage = () => {
|
|
|
1656
1937
|
cancelled = true;
|
|
1657
1938
|
};
|
|
1658
1939
|
}, [id]);
|
|
1659
|
-
const
|
|
1660
|
-
const
|
|
1940
|
+
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
1941
|
+
const sessionStatusRaw = (detail == null ? void 0 : detail.session_status) ?? "—";
|
|
1942
|
+
const paymentStatusRaw = (detail == null ? void 0 : detail.payment_id) != null ? (detail == null ? void 0 : detail.payment_status) ?? "—" : "—";
|
|
1943
|
+
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
1661
1944
|
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: [
|
|
1662
1945
|
/* @__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: [
|
|
1663
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/
|
|
1664
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
1665
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle
|
|
1946
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
1947
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payment session" }),
|
|
1948
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
|
|
1666
1949
|
] }) }),
|
|
1667
1950
|
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1668
1951
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1669
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/
|
|
1952
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
|
|
1670
1953
|
] }) : 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: [
|
|
1671
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1672
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1673
|
-
|
|
1674
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
ui.Badge,
|
|
1726
|
-
{
|
|
1727
|
-
size: "2xsmall",
|
|
1728
|
-
className: `uppercase ${getStatusBadgeClass$4(paymentStatus)}`,
|
|
1729
|
-
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
1730
|
-
}
|
|
1731
|
-
) })
|
|
1732
|
-
] }),
|
|
1733
|
-
detail.computed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1734
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1735
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
1736
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
1737
|
-
] }),
|
|
1738
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1739
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
1740
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
1741
|
-
] }),
|
|
1742
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1743
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
1744
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "mt-1 block", children: [
|
|
1745
|
-
detail.computed.refund_percentage.toFixed(1),
|
|
1746
|
-
"%"
|
|
1747
|
-
] })
|
|
1748
|
-
] })
|
|
1749
|
-
] }) : null
|
|
1954
|
+
/* @__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: [
|
|
1955
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1956
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
|
|
1957
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1958
|
+
ui.Button,
|
|
1959
|
+
{
|
|
1960
|
+
variant: "transparent",
|
|
1961
|
+
size: "small",
|
|
1962
|
+
onClick: () => navigate(`/orders/${detail.order_id}`),
|
|
1963
|
+
children: detail.order_id
|
|
1964
|
+
}
|
|
1965
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "—" }) })
|
|
1966
|
+
] }),
|
|
1967
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1968
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
1969
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: displayAmount })
|
|
1970
|
+
] }),
|
|
1971
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1972
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
1973
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.provider_id })
|
|
1974
|
+
] }),
|
|
1975
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1976
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
1977
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1978
|
+
ui.Badge,
|
|
1979
|
+
{
|
|
1980
|
+
size: "2xsmall",
|
|
1981
|
+
className: `uppercase ${getStatusBadgeClass$3(displayStatus)}`,
|
|
1982
|
+
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
1983
|
+
}
|
|
1984
|
+
) })
|
|
1985
|
+
] }),
|
|
1986
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1987
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
1988
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
1989
|
+
] }),
|
|
1990
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1991
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
1992
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
1993
|
+
] }),
|
|
1994
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1995
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
1996
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
1997
|
+
] }),
|
|
1998
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1999
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
2000
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
2001
|
+
year: "numeric",
|
|
2002
|
+
month: "short",
|
|
2003
|
+
day: "numeric",
|
|
2004
|
+
hour: "numeric",
|
|
2005
|
+
minute: "2-digit",
|
|
2006
|
+
hour12: true
|
|
2007
|
+
}) })
|
|
1750
2008
|
] })
|
|
1751
|
-
] }),
|
|
1752
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1753
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
1757
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1758
|
-
ui.Button,
|
|
1759
|
-
{
|
|
1760
|
-
variant: "transparent",
|
|
1761
|
-
size: "small",
|
|
1762
|
-
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
1763
|
-
children: detail.order.order_number ?? detail.order.order_id
|
|
1764
|
-
}
|
|
1765
|
-
) })
|
|
1766
|
-
] }),
|
|
1767
|
-
detail.order.total != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1768
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
1769
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
1770
|
-
] }) : null,
|
|
1771
|
-
detail.order.customer_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1772
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
1773
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
1774
|
-
] }) : null,
|
|
1775
|
-
detail.order.region ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1776
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
1777
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.region })
|
|
1778
|
-
] }) : null,
|
|
1779
|
-
detail.order.fulfillment_status ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1780
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
1781
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
1782
|
-
] }) : null
|
|
1783
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
1784
|
-
] }),
|
|
1785
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1786
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1787
|
-
"button",
|
|
1788
|
-
{
|
|
1789
|
-
type: "button",
|
|
1790
|
-
className: "flex w-full items-center justify-between text-left",
|
|
1791
|
-
onClick: () => setGatewayExpanded((prev) => !prev),
|
|
1792
|
-
"aria-expanded": gatewayExpanded,
|
|
1793
|
-
"aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
|
|
1794
|
-
children: [
|
|
1795
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
|
|
1796
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
|
|
1797
|
-
]
|
|
1798
|
-
}
|
|
1799
|
-
),
|
|
1800
|
-
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." }) })
|
|
1801
|
-
] })
|
|
2009
|
+
] }) }),
|
|
2010
|
+
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2011
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
2012
|
+
/* @__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) })
|
|
2013
|
+
] }) : /* @__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." }) })
|
|
1802
2014
|
] }) : null
|
|
1803
2015
|
] }) });
|
|
1804
2016
|
};
|
|
1805
|
-
const config$
|
|
1806
|
-
label: "
|
|
1807
|
-
icon: icons.
|
|
2017
|
+
const config$3 = adminSdk.defineRouteConfig({
|
|
2018
|
+
label: "Payment details",
|
|
2019
|
+
icon: icons.CreditCard
|
|
1808
2020
|
});
|
|
1809
|
-
const getStatusBadgeClass$
|
|
2021
|
+
const getStatusBadgeClass$2 = (status) => {
|
|
1810
2022
|
const statusLower = status.toLowerCase();
|
|
1811
2023
|
if (statusLower === "requested") {
|
|
1812
2024
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -1832,7 +2044,7 @@ const getStatusBadgeClass$3 = (status) => {
|
|
|
1832
2044
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1833
2045
|
};
|
|
1834
2046
|
const ReturnDetailPage = () => {
|
|
1835
|
-
var _a, _b;
|
|
2047
|
+
var _a, _b, _c;
|
|
1836
2048
|
const navigate = reactRouterDom.useNavigate();
|
|
1837
2049
|
const { id } = reactRouterDom.useParams();
|
|
1838
2050
|
const [returnOrder, setReturnOrder] = react.useState(null);
|
|
@@ -1850,7 +2062,7 @@ const ReturnDetailPage = () => {
|
|
|
1850
2062
|
try {
|
|
1851
2063
|
setIsLoading(true);
|
|
1852
2064
|
setError(null);
|
|
1853
|
-
const response = await fetch(`/admin/
|
|
2065
|
+
const response = await fetch(`/admin/return/${id}`, {
|
|
1854
2066
|
credentials: "include"
|
|
1855
2067
|
});
|
|
1856
2068
|
if (!response.ok) {
|
|
@@ -1876,7 +2088,7 @@ const ReturnDetailPage = () => {
|
|
|
1876
2088
|
setIsRejecting(true);
|
|
1877
2089
|
setUpdateError(null);
|
|
1878
2090
|
setUpdateSuccess(false);
|
|
1879
|
-
const response = await fetch(`/admin/
|
|
2091
|
+
const response = await fetch(`/admin/return/${id}/reject`, {
|
|
1880
2092
|
method: "POST",
|
|
1881
2093
|
headers: {
|
|
1882
2094
|
"Content-Type": "application/json"
|
|
@@ -1892,7 +2104,7 @@ const ReturnDetailPage = () => {
|
|
|
1892
2104
|
setReturnOrder(payload.return);
|
|
1893
2105
|
setUpdateSuccess(true);
|
|
1894
2106
|
setTimeout(() => setUpdateSuccess(false), 3e3);
|
|
1895
|
-
const detailResponse = await fetch(`/admin/
|
|
2107
|
+
const detailResponse = await fetch(`/admin/return/${id}`, {
|
|
1896
2108
|
credentials: "include"
|
|
1897
2109
|
});
|
|
1898
2110
|
if (detailResponse.ok) {
|
|
@@ -1940,7 +2152,7 @@ const ReturnDetailPage = () => {
|
|
|
1940
2152
|
ui.Badge,
|
|
1941
2153
|
{
|
|
1942
2154
|
size: "small",
|
|
1943
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2155
|
+
className: `uppercase ${getStatusBadgeClass$2(returnOrder.status)}`,
|
|
1944
2156
|
children: returnOrder.status.replace(/_/g, " ")
|
|
1945
2157
|
}
|
|
1946
2158
|
)
|
|
@@ -1959,6 +2171,7 @@ const ReturnDetailPage = () => {
|
|
|
1959
2171
|
) }),
|
|
1960
2172
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: 'Cancel this return request. Use "Mark as received" when items are received.' })
|
|
1961
2173
|
] }),
|
|
2174
|
+
returnOrder.refund ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: /* @__PURE__ */ jsxRuntime.jsx(RefundCalculationBlock, { refund: returnOrder.refund }) }) : null,
|
|
1962
2175
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
1963
2176
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Information" }),
|
|
1964
2177
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
@@ -2022,7 +2235,7 @@ const ReturnDetailPage = () => {
|
|
|
2022
2235
|
ui.Badge,
|
|
2023
2236
|
{
|
|
2024
2237
|
size: "2xsmall",
|
|
2025
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2238
|
+
className: `uppercase ${getStatusBadgeClass$2(entry.status)}`,
|
|
2026
2239
|
children: entry.status.replace(/_/g, " ")
|
|
2027
2240
|
}
|
|
2028
2241
|
) }),
|
|
@@ -2052,6 +2265,10 @@ const ReturnDetailPage = () => {
|
|
|
2052
2265
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
2053
2266
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_b = returnOrder.order.customer) == null ? void 0 : _b.email) || returnOrder.order.email || "—" })
|
|
2054
2267
|
] }),
|
|
2268
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2269
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Payment method" }),
|
|
2270
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_c = returnOrder.order.order_payment) == null ? void 0 : _c.label) || "—" })
|
|
2271
|
+
] }),
|
|
2055
2272
|
returnOrder.order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2056
2273
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
2057
2274
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "font-medium", children: [
|
|
@@ -2080,11 +2297,203 @@ const ReturnDetailPage = () => {
|
|
|
2080
2297
|
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" }) })
|
|
2081
2298
|
] }) });
|
|
2082
2299
|
};
|
|
2083
|
-
const config$
|
|
2300
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
2084
2301
|
label: "Return Order Details",
|
|
2085
2302
|
icon: icons.CheckCircle
|
|
2086
2303
|
});
|
|
2087
|
-
const getStatusBadgeClass$
|
|
2304
|
+
const getStatusBadgeClass$1 = (status) => {
|
|
2305
|
+
const s2 = status.toLowerCase();
|
|
2306
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2307
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2308
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2309
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2310
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2311
|
+
};
|
|
2312
|
+
const formatAmount = (value) => {
|
|
2313
|
+
return String(value);
|
|
2314
|
+
};
|
|
2315
|
+
const RefundDetailPage = () => {
|
|
2316
|
+
var _a, _b, _c;
|
|
2317
|
+
const navigate = reactRouterDom.useNavigate();
|
|
2318
|
+
const params = reactRouterDom.useParams();
|
|
2319
|
+
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
2320
|
+
const [detail, setDetail] = react.useState(null);
|
|
2321
|
+
const [loading, setLoading] = react.useState(!!id);
|
|
2322
|
+
const [error, setError] = react.useState(null);
|
|
2323
|
+
const [gatewayExpanded, setGatewayExpanded] = react.useState(false);
|
|
2324
|
+
react.useEffect(() => {
|
|
2325
|
+
if (!id) {
|
|
2326
|
+
setLoading(false);
|
|
2327
|
+
return;
|
|
2328
|
+
}
|
|
2329
|
+
let cancelled = false;
|
|
2330
|
+
setLoading(true);
|
|
2331
|
+
setError(null);
|
|
2332
|
+
fetch(`/admin/refunds/${id}`, { credentials: "include" }).then((res) => {
|
|
2333
|
+
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
2334
|
+
return res.json();
|
|
2335
|
+
}).then((data) => {
|
|
2336
|
+
if (!cancelled) setDetail(data);
|
|
2337
|
+
}).catch((e) => {
|
|
2338
|
+
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
2339
|
+
}).finally(() => {
|
|
2340
|
+
if (!cancelled) setLoading(false);
|
|
2341
|
+
});
|
|
2342
|
+
return () => {
|
|
2343
|
+
cancelled = true;
|
|
2344
|
+
};
|
|
2345
|
+
}, [id]);
|
|
2346
|
+
const paymentStatus = ((_b = detail == null ? void 0 : detail.payment) == null ? void 0 : _b.status) ?? "—";
|
|
2347
|
+
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;
|
|
2348
|
+
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: [
|
|
2349
|
+
/* @__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: [
|
|
2350
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/refunds"), children: "← Refunds" }),
|
|
2351
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refund details" }),
|
|
2352
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle font-mono", children: id ?? "—" })
|
|
2353
|
+
] }) }),
|
|
2354
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2355
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
2356
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/refunds"), children: "Back to list" })
|
|
2357
|
+
] }) : 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: [
|
|
2358
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2359
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Refund summary" }),
|
|
2360
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
2361
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2362
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund ID" }),
|
|
2363
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.id })
|
|
2364
|
+
] }),
|
|
2365
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2366
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
2367
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.refund.amount) })
|
|
2368
|
+
] }),
|
|
2369
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2370
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Note" }),
|
|
2371
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.refund.note ?? "—" })
|
|
2372
|
+
] }),
|
|
2373
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2374
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created at" }),
|
|
2375
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.refund.created_at).toLocaleDateString("en-US", {
|
|
2376
|
+
year: "numeric",
|
|
2377
|
+
month: "short",
|
|
2378
|
+
day: "numeric",
|
|
2379
|
+
hour: "numeric",
|
|
2380
|
+
minute: "2-digit",
|
|
2381
|
+
hour12: true
|
|
2382
|
+
}) })
|
|
2383
|
+
] }),
|
|
2384
|
+
detail.refund.created_by ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2385
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created by" }),
|
|
2386
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.created_by })
|
|
2387
|
+
] }) : null
|
|
2388
|
+
] })
|
|
2389
|
+
] }),
|
|
2390
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2391
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Payment summary" }),
|
|
2392
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
2393
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2394
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment amount" }),
|
|
2395
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.payment_amount) })
|
|
2396
|
+
] }),
|
|
2397
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2398
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Captured amount" }),
|
|
2399
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.captured_amount) })
|
|
2400
|
+
] }),
|
|
2401
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2402
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refunded amount" }),
|
|
2403
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.refunded_amount) })
|
|
2404
|
+
] }),
|
|
2405
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2406
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
2407
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment.provider_id || "—" })
|
|
2408
|
+
] }),
|
|
2409
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2410
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
2411
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2412
|
+
ui.Badge,
|
|
2413
|
+
{
|
|
2414
|
+
size: "2xsmall",
|
|
2415
|
+
className: `uppercase ${getStatusBadgeClass$1(paymentStatus)}`,
|
|
2416
|
+
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
2417
|
+
}
|
|
2418
|
+
) })
|
|
2419
|
+
] }),
|
|
2420
|
+
detail.computed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2421
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2422
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
2423
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
2424
|
+
] }),
|
|
2425
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2426
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
2427
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
2428
|
+
] }),
|
|
2429
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2430
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
2431
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "mt-1 block", children: [
|
|
2432
|
+
detail.computed.refund_percentage.toFixed(1),
|
|
2433
|
+
"%"
|
|
2434
|
+
] })
|
|
2435
|
+
] })
|
|
2436
|
+
] }) : null
|
|
2437
|
+
] })
|
|
2438
|
+
] }),
|
|
2439
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2440
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Order summary" }),
|
|
2441
|
+
detail.order ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
2442
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2443
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
2444
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2445
|
+
ui.Button,
|
|
2446
|
+
{
|
|
2447
|
+
variant: "transparent",
|
|
2448
|
+
size: "small",
|
|
2449
|
+
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
2450
|
+
children: detail.order.order_number ?? detail.order.order_id
|
|
2451
|
+
}
|
|
2452
|
+
) })
|
|
2453
|
+
] }),
|
|
2454
|
+
detail.order.total != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2455
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
2456
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
2457
|
+
] }) : null,
|
|
2458
|
+
detail.order.customer_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2459
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
2460
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
2461
|
+
] }) : null,
|
|
2462
|
+
detail.order.region ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2463
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
2464
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.region })
|
|
2465
|
+
] }) : null,
|
|
2466
|
+
detail.order.fulfillment_status ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2467
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
2468
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
2469
|
+
] }) : null
|
|
2470
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
2471
|
+
] }),
|
|
2472
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2473
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2474
|
+
"button",
|
|
2475
|
+
{
|
|
2476
|
+
type: "button",
|
|
2477
|
+
className: "flex w-full items-center justify-between text-left",
|
|
2478
|
+
onClick: () => setGatewayExpanded((prev) => !prev),
|
|
2479
|
+
"aria-expanded": gatewayExpanded,
|
|
2480
|
+
"aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
|
|
2481
|
+
children: [
|
|
2482
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
|
|
2483
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
|
|
2484
|
+
]
|
|
2485
|
+
}
|
|
2486
|
+
),
|
|
2487
|
+
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." }) })
|
|
2488
|
+
] })
|
|
2489
|
+
] }) : null
|
|
2490
|
+
] }) });
|
|
2491
|
+
};
|
|
2492
|
+
const config$1 = adminSdk.defineRouteConfig({
|
|
2493
|
+
label: "Refund details",
|
|
2494
|
+
icon: icons.Receipt
|
|
2495
|
+
});
|
|
2496
|
+
const getStatusBadgeClass = (status) => {
|
|
2088
2497
|
const statusLower = status.toLowerCase();
|
|
2089
2498
|
if (statusLower === "requested") {
|
|
2090
2499
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -2222,7 +2631,7 @@ const SwapDetailPage = () => {
|
|
|
2222
2631
|
ui.Badge,
|
|
2223
2632
|
{
|
|
2224
2633
|
size: "small",
|
|
2225
|
-
className: `uppercase ${getStatusBadgeClass
|
|
2634
|
+
className: `uppercase ${getStatusBadgeClass(swap.status)}`,
|
|
2226
2635
|
children: swap.status.replace(/_/g, " ")
|
|
2227
2636
|
}
|
|
2228
2637
|
)
|
|
@@ -2281,406 +2690,87 @@ const SwapDetailPage = () => {
|
|
|
2281
2690
|
] }),
|
|
2282
2691
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2283
2692
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Status History" }),
|
|
2284
|
-
statusHistory.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: statusHistory.map((entry, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2285
|
-
"div",
|
|
2286
|
-
{
|
|
2287
|
-
className: "flex items-center justify-between border-b border-ui-border-subtle pb-2 last:border-0",
|
|
2288
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2289
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2290
|
-
ui.Badge,
|
|
2291
|
-
{
|
|
2292
|
-
size: "2xsmall",
|
|
2293
|
-
className: `uppercase ${getStatusBadgeClass$2(entry.status)}`,
|
|
2294
|
-
children: entry.status.replace(/_/g, " ")
|
|
2295
|
-
}
|
|
2296
|
-
) }),
|
|
2297
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: [
|
|
2298
|
-
new Date(entry.timestamp).toLocaleString(),
|
|
2299
|
-
entry.admin_id && ` by ${entry.admin_id}`,
|
|
2300
|
-
entry.reason && ` - ${entry.reason}`
|
|
2301
|
-
] })
|
|
2302
|
-
] })
|
|
2303
|
-
},
|
|
2304
|
-
index
|
|
2305
|
-
)) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
|
|
2306
|
-
] })
|
|
2307
|
-
] }),
|
|
2308
|
-
order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2309
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
|
|
2310
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
2311
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2312
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
|
|
2313
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.id })
|
|
2314
|
-
] }),
|
|
2315
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2316
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
|
|
2317
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.status || "—" })
|
|
2318
|
-
] }),
|
|
2319
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2320
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
2321
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_c = order.customer) == null ? void 0 : _c.email) || order.email || "—" })
|
|
2322
|
-
] }),
|
|
2323
|
-
order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2324
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
2325
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "font-medium", children: [
|
|
2326
|
-
order.currency_code || "$",
|
|
2327
|
-
(Number(order.total) / 100).toFixed(2)
|
|
2328
|
-
] })
|
|
2329
|
-
] })
|
|
2330
|
-
] })
|
|
2331
|
-
] }),
|
|
2332
|
-
swap.return_items && swap.return_items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2333
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
2334
|
-
/* @__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: [
|
|
2335
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2336
|
-
/* @__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" }),
|
|
2337
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
|
|
2338
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
|
|
2339
|
-
] }) }),
|
|
2340
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.return_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2341
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
2342
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
2343
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
2344
|
-
] }, item.id || index)) })
|
|
2345
|
-
] }) })
|
|
2346
|
-
] }),
|
|
2347
|
-
swap.new_items && swap.new_items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2348
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "New Items" }),
|
|
2349
|
-
/* @__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: [
|
|
2350
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2351
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Variant ID" }),
|
|
2352
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
|
|
2353
|
-
] }) }),
|
|
2354
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.new_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2355
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.variant_id }),
|
|
2356
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
|
|
2357
|
-
] }, item.variant_id || index)) })
|
|
2358
|
-
] }) })
|
|
2359
|
-
] })
|
|
2360
|
-
] }) });
|
|
2361
|
-
};
|
|
2362
|
-
const config$2 = adminSdk.defineRouteConfig({
|
|
2363
|
-
label: "Swap Details",
|
|
2364
|
-
icon: icons.ArrowPath
|
|
2365
|
-
});
|
|
2366
|
-
const useDebounce = (value, delay) => {
|
|
2367
|
-
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
2368
|
-
react.useEffect(() => {
|
|
2369
|
-
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
2370
|
-
return () => clearTimeout(handler);
|
|
2371
|
-
}, [value, delay]);
|
|
2372
|
-
return debouncedValue;
|
|
2373
|
-
};
|
|
2374
|
-
const getStatusBadgeClass$1 = (status) => {
|
|
2375
|
-
const s2 = status.toLowerCase();
|
|
2376
|
-
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2377
|
-
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2378
|
-
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2379
|
-
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2380
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2381
|
-
};
|
|
2382
|
-
const PaymentsPage = () => {
|
|
2383
|
-
const navigate = reactRouterDom.useNavigate();
|
|
2384
|
-
const [items, setItems] = react.useState([]);
|
|
2385
|
-
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
2386
|
-
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
2387
|
-
const debouncedOrderId = useDebounce(orderIdSearch, 300);
|
|
2388
|
-
const [isLoading, setIsLoading] = react.useState(true);
|
|
2389
|
-
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
2390
|
-
const [error, setError] = react.useState(null);
|
|
2391
|
-
const [offset, setOffset] = react.useState(0);
|
|
2392
|
-
const [count, setCount] = react.useState(0);
|
|
2393
|
-
const limit = 50;
|
|
2394
|
-
const loadTransactions = react.useCallback(
|
|
2395
|
-
async (nextOffset, replace) => {
|
|
2396
|
-
try {
|
|
2397
|
-
if (replace) setIsLoading(true);
|
|
2398
|
-
else setIsFetchingMore(true);
|
|
2399
|
-
setError(null);
|
|
2400
|
-
const params = new URLSearchParams();
|
|
2401
|
-
params.set("limit", String(limit));
|
|
2402
|
-
params.set("offset", String(nextOffset));
|
|
2403
|
-
if (statusFilter !== "all") params.set("status", statusFilter);
|
|
2404
|
-
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
2405
|
-
const response = await fetch(
|
|
2406
|
-
`/admin/payment-transactions?${params.toString()}`,
|
|
2407
|
-
{ credentials: "include" }
|
|
2408
|
-
);
|
|
2409
|
-
if (!response.ok) {
|
|
2410
|
-
const text = await response.text();
|
|
2411
|
-
throw new Error(text || "Failed to load payment transactions");
|
|
2412
|
-
}
|
|
2413
|
-
const payload = await response.json();
|
|
2414
|
-
const list = payload.transactions ?? [];
|
|
2415
|
-
setCount(payload.count ?? 0);
|
|
2416
|
-
setOffset(nextOffset + list.length);
|
|
2417
|
-
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
2418
|
-
} catch (e) {
|
|
2419
|
-
setError(e instanceof Error ? e.message : "Failed to load");
|
|
2420
|
-
} finally {
|
|
2421
|
-
setIsLoading(false);
|
|
2422
|
-
setIsFetchingMore(false);
|
|
2423
|
-
}
|
|
2424
|
-
},
|
|
2425
|
-
[statusFilter, debouncedOrderId]
|
|
2426
|
-
);
|
|
2427
|
-
react.useEffect(() => {
|
|
2428
|
-
void loadTransactions(0, true);
|
|
2429
|
-
}, [loadTransactions]);
|
|
2430
|
-
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
2431
|
-
const displayStatus = (t) => {
|
|
2432
|
-
const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
|
|
2433
|
-
return s2 !== "" ? s2 : "—";
|
|
2434
|
-
};
|
|
2435
|
-
const displayAmount = (t) => {
|
|
2436
|
-
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
2437
|
-
return `${code} ${Number(t.amount)}`;
|
|
2438
|
-
};
|
|
2439
|
-
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: [
|
|
2440
|
-
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
2441
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2442
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payments" }),
|
|
2443
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
|
|
2444
|
-
] }),
|
|
2445
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
|
|
2446
|
-
] }),
|
|
2447
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
2448
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2449
|
-
ui.Input,
|
|
2450
|
-
{
|
|
2451
|
-
placeholder: "Search by Order ID",
|
|
2452
|
-
value: orderIdSearch,
|
|
2453
|
-
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
2454
|
-
className: "md:max-w-sm",
|
|
2455
|
-
"aria-label": "Search by order ID"
|
|
2456
|
-
}
|
|
2457
|
-
),
|
|
2458
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2459
|
-
"select",
|
|
2460
|
-
{
|
|
2461
|
-
value: statusFilter,
|
|
2462
|
-
onChange: (e) => setStatusFilter(e.target.value),
|
|
2463
|
-
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",
|
|
2464
|
-
"aria-label": "Filter by status",
|
|
2465
|
-
children: [
|
|
2466
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
2467
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
2468
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
2469
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "error", children: "Error" }),
|
|
2470
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
2471
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
2472
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
2473
|
-
]
|
|
2474
|
-
}
|
|
2475
|
-
) })
|
|
2476
|
-
] }),
|
|
2477
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2478
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
2479
|
-
/* @__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" }) })
|
|
2480
|
-
] }) : null,
|
|
2481
|
-
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: [
|
|
2482
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
|
|
2483
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
|
|
2484
|
-
] }) : /* @__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: [
|
|
2485
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2486
|
-
/* @__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" }),
|
|
2487
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
2488
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
2489
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
2490
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
|
|
2491
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
2492
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
2493
|
-
] }) }),
|
|
2494
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2495
|
-
"tr",
|
|
2496
|
-
{
|
|
2497
|
-
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
2498
|
-
onClick: () => navigate(`/payments/${t.payment_session_id}`),
|
|
2499
|
-
children: [
|
|
2500
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
|
|
2501
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
|
|
2502
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
|
|
2503
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2504
|
-
ui.Badge,
|
|
2505
|
-
{
|
|
2506
|
-
size: "2xsmall",
|
|
2507
|
-
className: `uppercase ${getStatusBadgeClass$1(displayStatus(t))}`,
|
|
2508
|
-
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
2509
|
-
}
|
|
2510
|
-
) }),
|
|
2511
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
|
|
2512
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
|
|
2513
|
-
year: "numeric",
|
|
2514
|
-
month: "short",
|
|
2515
|
-
day: "numeric",
|
|
2516
|
-
hour: "numeric",
|
|
2517
|
-
minute: "2-digit",
|
|
2518
|
-
hour12: true
|
|
2519
|
-
}) }),
|
|
2520
|
-
/* @__PURE__ */ jsxRuntime.jsxs("td", { className: "px-4 py-4", children: [
|
|
2521
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2522
|
-
ui.Button,
|
|
2523
|
-
{
|
|
2524
|
-
variant: "transparent",
|
|
2525
|
-
size: "small",
|
|
2526
|
-
onClick: (e) => {
|
|
2527
|
-
e.stopPropagation();
|
|
2528
|
-
navigate(`/payments/${t.payment_session_id}`);
|
|
2529
|
-
},
|
|
2530
|
-
children: "View details"
|
|
2531
|
-
}
|
|
2532
|
-
),
|
|
2533
|
-
t.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2534
|
-
ui.Button,
|
|
2693
|
+
statusHistory.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: statusHistory.map((entry, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2694
|
+
"div",
|
|
2695
|
+
{
|
|
2696
|
+
className: "flex items-center justify-between border-b border-ui-border-subtle pb-2 last:border-0",
|
|
2697
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2698
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2699
|
+
ui.Badge,
|
|
2535
2700
|
{
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
e.stopPropagation();
|
|
2540
|
-
navigate(`/orders/${t.order_id}`);
|
|
2541
|
-
},
|
|
2542
|
-
children: "Order"
|
|
2701
|
+
size: "2xsmall",
|
|
2702
|
+
className: `uppercase ${getStatusBadgeClass(entry.status)}`,
|
|
2703
|
+
children: entry.status.replace(/_/g, " ")
|
|
2543
2704
|
}
|
|
2544
|
-
)
|
|
2705
|
+
) }),
|
|
2706
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: [
|
|
2707
|
+
new Date(entry.timestamp).toLocaleString(),
|
|
2708
|
+
entry.admin_id && ` by ${entry.admin_id}`,
|
|
2709
|
+
entry.reason && ` - ${entry.reason}`
|
|
2710
|
+
] })
|
|
2545
2711
|
] })
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
] })
|
|
2551
|
-
|
|
2552
|
-
ui.
|
|
2553
|
-
{
|
|
2554
|
-
variant: "secondary",
|
|
2555
|
-
isLoading: isFetchingMore,
|
|
2556
|
-
onClick: () => loadTransactions(offset, false),
|
|
2557
|
-
children: "Load more"
|
|
2558
|
-
}
|
|
2559
|
-
) }) : null
|
|
2560
|
-
] }) });
|
|
2561
|
-
};
|
|
2562
|
-
const config$1 = adminSdk.defineRouteConfig({
|
|
2563
|
-
label: "Payments",
|
|
2564
|
-
icon: icons.CreditCard
|
|
2565
|
-
});
|
|
2566
|
-
const getStatusBadgeClass = (status) => {
|
|
2567
|
-
const s2 = status.toLowerCase();
|
|
2568
|
-
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2569
|
-
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2570
|
-
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2571
|
-
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2572
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2573
|
-
};
|
|
2574
|
-
const PaymentDetailPage = () => {
|
|
2575
|
-
var _a;
|
|
2576
|
-
const navigate = reactRouterDom.useNavigate();
|
|
2577
|
-
const params = reactRouterDom.useParams();
|
|
2578
|
-
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
2579
|
-
const [detail, setDetail] = react.useState(null);
|
|
2580
|
-
const [loading, setLoading] = react.useState(!!id);
|
|
2581
|
-
const [error, setError] = react.useState(null);
|
|
2582
|
-
react.useEffect(() => {
|
|
2583
|
-
if (!id) {
|
|
2584
|
-
setLoading(false);
|
|
2585
|
-
return;
|
|
2586
|
-
}
|
|
2587
|
-
let cancelled = false;
|
|
2588
|
-
setLoading(true);
|
|
2589
|
-
setError(null);
|
|
2590
|
-
fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
|
|
2591
|
-
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
2592
|
-
return res.json();
|
|
2593
|
-
}).then((data) => {
|
|
2594
|
-
if (!cancelled) setDetail(data);
|
|
2595
|
-
}).catch((e) => {
|
|
2596
|
-
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
2597
|
-
}).finally(() => {
|
|
2598
|
-
if (!cancelled) setLoading(false);
|
|
2599
|
-
});
|
|
2600
|
-
return () => {
|
|
2601
|
-
cancelled = true;
|
|
2602
|
-
};
|
|
2603
|
-
}, [id]);
|
|
2604
|
-
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
2605
|
-
const sessionStatusRaw = (detail == null ? void 0 : detail.session_status) ?? "—";
|
|
2606
|
-
const paymentStatusRaw = (detail == null ? void 0 : detail.payment_id) != null ? (detail == null ? void 0 : detail.payment_status) ?? "—" : "—";
|
|
2607
|
-
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
2608
|
-
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: [
|
|
2609
|
-
/* @__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: [
|
|
2610
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
2611
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payment session" }),
|
|
2612
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
|
|
2613
|
-
] }) }),
|
|
2614
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2615
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
2616
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
|
|
2617
|
-
] }) : 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: [
|
|
2618
|
-
/* @__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: [
|
|
2619
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2620
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
|
|
2621
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2622
|
-
ui.Button,
|
|
2623
|
-
{
|
|
2624
|
-
variant: "transparent",
|
|
2625
|
-
size: "small",
|
|
2626
|
-
onClick: () => navigate(`/orders/${detail.order_id}`),
|
|
2627
|
-
children: detail.order_id
|
|
2628
|
-
}
|
|
2629
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "—" }) })
|
|
2630
|
-
] }),
|
|
2631
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2632
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
2633
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: displayAmount })
|
|
2634
|
-
] }),
|
|
2635
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2636
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
2637
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.provider_id })
|
|
2638
|
-
] }),
|
|
2639
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2640
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
2641
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2642
|
-
ui.Badge,
|
|
2643
|
-
{
|
|
2644
|
-
size: "2xsmall",
|
|
2645
|
-
className: `uppercase ${getStatusBadgeClass(displayStatus)}`,
|
|
2646
|
-
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
2647
|
-
}
|
|
2648
|
-
) })
|
|
2649
|
-
] }),
|
|
2712
|
+
},
|
|
2713
|
+
index
|
|
2714
|
+
)) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
|
|
2715
|
+
] })
|
|
2716
|
+
] }),
|
|
2717
|
+
order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2718
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
|
|
2719
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
2650
2720
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2651
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
2652
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "
|
|
2721
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
|
|
2722
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.id })
|
|
2653
2723
|
] }),
|
|
2654
2724
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2655
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
2656
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "
|
|
2725
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
|
|
2726
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.status || "—" })
|
|
2657
2727
|
] }),
|
|
2658
2728
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2659
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
2660
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "
|
|
2729
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
2730
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_c = order.customer) == null ? void 0 : _c.email) || order.email || "—" })
|
|
2661
2731
|
] }),
|
|
2662
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2663
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
2664
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
hour: "numeric",
|
|
2669
|
-
minute: "2-digit",
|
|
2670
|
-
hour12: true
|
|
2671
|
-
}) })
|
|
2732
|
+
order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2733
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
2734
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "font-medium", children: [
|
|
2735
|
+
order.currency_code || "$",
|
|
2736
|
+
(Number(order.total) / 100).toFixed(2)
|
|
2737
|
+
] })
|
|
2672
2738
|
] })
|
|
2673
|
-
] })
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2739
|
+
] })
|
|
2740
|
+
] }),
|
|
2741
|
+
swap.return_items && swap.return_items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2742
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
2743
|
+
/* @__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: [
|
|
2744
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2745
|
+
/* @__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" }),
|
|
2746
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
|
|
2747
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
|
|
2748
|
+
] }) }),
|
|
2749
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.return_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2750
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
2751
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
2752
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
2753
|
+
] }, item.id || index)) })
|
|
2754
|
+
] }) })
|
|
2755
|
+
] }),
|
|
2756
|
+
swap.new_items && swap.new_items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2757
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "New Items" }),
|
|
2758
|
+
/* @__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: [
|
|
2759
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2760
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Variant ID" }),
|
|
2761
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
|
|
2762
|
+
] }) }),
|
|
2763
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.new_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2764
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.variant_id }),
|
|
2765
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
|
|
2766
|
+
] }, item.variant_id || index)) })
|
|
2767
|
+
] }) })
|
|
2768
|
+
] })
|
|
2679
2769
|
] }) });
|
|
2680
2770
|
};
|
|
2681
2771
|
const config = adminSdk.defineRouteConfig({
|
|
2682
|
-
label: "
|
|
2683
|
-
icon: icons.
|
|
2772
|
+
label: "Swap Details",
|
|
2773
|
+
icon: icons.ArrowPath
|
|
2684
2774
|
});
|
|
2685
2775
|
const i18nTranslations0 = {};
|
|
2686
2776
|
const widgetModule = { widgets: [
|
|
@@ -2696,36 +2786,36 @@ const widgetModule = { widgets: [
|
|
|
2696
2786
|
const routeModule = {
|
|
2697
2787
|
routes: [
|
|
2698
2788
|
{
|
|
2699
|
-
Component:
|
|
2700
|
-
path: "/
|
|
2789
|
+
Component: PaymentsPage,
|
|
2790
|
+
path: "/payments"
|
|
2701
2791
|
},
|
|
2702
2792
|
{
|
|
2703
2793
|
Component: ReturnsPage,
|
|
2704
2794
|
path: "/returns"
|
|
2705
2795
|
},
|
|
2796
|
+
{
|
|
2797
|
+
Component: RefundsPage,
|
|
2798
|
+
path: "/refunds"
|
|
2799
|
+
},
|
|
2706
2800
|
{
|
|
2707
2801
|
Component: SwapsPage,
|
|
2708
2802
|
path: "/swaps"
|
|
2709
2803
|
},
|
|
2710
2804
|
{
|
|
2711
|
-
Component:
|
|
2712
|
-
path: "/
|
|
2805
|
+
Component: PaymentDetailPage,
|
|
2806
|
+
path: "/payments/:id"
|
|
2713
2807
|
},
|
|
2714
2808
|
{
|
|
2715
2809
|
Component: ReturnDetailPage,
|
|
2716
2810
|
path: "/returns/:id"
|
|
2717
2811
|
},
|
|
2718
2812
|
{
|
|
2719
|
-
Component:
|
|
2720
|
-
path: "/
|
|
2721
|
-
},
|
|
2722
|
-
{
|
|
2723
|
-
Component: PaymentsPage,
|
|
2724
|
-
path: "/payments"
|
|
2813
|
+
Component: RefundDetailPage,
|
|
2814
|
+
path: "/refunds/:id"
|
|
2725
2815
|
},
|
|
2726
2816
|
{
|
|
2727
|
-
Component:
|
|
2728
|
-
path: "/
|
|
2817
|
+
Component: SwapDetailPage,
|
|
2818
|
+
path: "/swaps/:id"
|
|
2729
2819
|
}
|
|
2730
2820
|
]
|
|
2731
2821
|
};
|
|
@@ -2738,45 +2828,45 @@ const menuItemModule = {
|
|
|
2738
2828
|
nested: void 0
|
|
2739
2829
|
},
|
|
2740
2830
|
{
|
|
2741
|
-
label: config$
|
|
2742
|
-
icon: config$
|
|
2743
|
-
path: "/
|
|
2831
|
+
label: config$4.label,
|
|
2832
|
+
icon: config$4.icon,
|
|
2833
|
+
path: "/swaps",
|
|
2744
2834
|
nested: void 0
|
|
2745
2835
|
},
|
|
2746
2836
|
{
|
|
2747
2837
|
label: config$7.label,
|
|
2748
2838
|
icon: config$7.icon,
|
|
2749
|
-
path: "/
|
|
2839
|
+
path: "/payments",
|
|
2750
2840
|
nested: void 0
|
|
2751
2841
|
},
|
|
2752
2842
|
{
|
|
2753
2843
|
label: config$5.label,
|
|
2754
2844
|
icon: config$5.icon,
|
|
2755
|
-
path: "/
|
|
2845
|
+
path: "/refunds",
|
|
2756
2846
|
nested: void 0
|
|
2757
2847
|
},
|
|
2758
2848
|
{
|
|
2759
|
-
label: config$
|
|
2760
|
-
icon: config$
|
|
2849
|
+
label: config$2.label,
|
|
2850
|
+
icon: config$2.icon,
|
|
2761
2851
|
path: "/returns/:id",
|
|
2762
2852
|
nested: void 0
|
|
2763
2853
|
},
|
|
2764
2854
|
{
|
|
2765
|
-
label: config
|
|
2766
|
-
icon: config
|
|
2767
|
-
path: "/
|
|
2855
|
+
label: config.label,
|
|
2856
|
+
icon: config.icon,
|
|
2857
|
+
path: "/swaps/:id",
|
|
2768
2858
|
nested: void 0
|
|
2769
2859
|
},
|
|
2770
2860
|
{
|
|
2771
|
-
label: config.label,
|
|
2772
|
-
icon: config.icon,
|
|
2861
|
+
label: config$3.label,
|
|
2862
|
+
icon: config$3.icon,
|
|
2773
2863
|
path: "/payments/:id",
|
|
2774
2864
|
nested: void 0
|
|
2775
2865
|
},
|
|
2776
2866
|
{
|
|
2777
|
-
label: config$
|
|
2778
|
-
icon: config$
|
|
2779
|
-
path: "/
|
|
2867
|
+
label: config$1.label,
|
|
2868
|
+
icon: config$1.icon,
|
|
2869
|
+
path: "/refunds/:id",
|
|
2780
2870
|
nested: void 0
|
|
2781
2871
|
}
|
|
2782
2872
|
]
|