order-management 0.0.92 → 0.0.93
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 +587 -569
- package/.medusa/server/src/admin/index.mjs +588 -570
- package/.medusa/server/src/api/admin/orders/[order_id]/refund-context/route.js +134 -4
- package/.medusa/server/src/api/admin/payment-transactions/validators.js +2 -2
- package/.medusa/server/src/api/admin/refund-payment-mapping/validators.js +2 -2
- package/.medusa/server/src/api/admin/refunds/validators.js +2 -2
- package/.medusa/server/src/api/admin/return/[id]/reject/route.js +3 -3
- package/.medusa/server/src/api/admin/return/[id]/route.js +10 -5
- package/.medusa/server/src/api/admin/return/route.js +4 -10
- package/.medusa/server/src/api/admin/return/validators.js +2 -2
- package/.medusa/server/src/api/admin/swaps/validators.js +3 -3
- package/.medusa/server/src/api/store/guest-orders/[id]/payment-details/route.js +161 -0
- package/.medusa/server/src/api/store/guest-orders/[id]/returns/[return_id]/refund-payment/route.js +132 -0
- package/.medusa/server/src/api/store/guest-orders/[id]/returns/route.js +132 -12
- package/.medusa/server/src/api/store/guest-orders/[id]/swaps/route.js +2 -2
- package/.medusa/server/src/api/store/orders/[order_id]/refund-payment-mappings/route.js +9 -4
- package/.medusa/server/src/api/store/payment-details/validators.js +63 -31
- package/.medusa/server/src/api/store/returns/[id]/route.js +16 -9
- package/.medusa/server/src/api/store/returns/route.js +39 -15
- package/.medusa/server/src/api/store/returns/validators.js +15 -3
- package/.medusa/server/src/api/store/swaps/route.js +2 -2
- package/.medusa/server/src/api/store/validators/cancel-order.js +2 -2
- package/.medusa/server/src/helpers/resolve-return-refund-payment.js +66 -0
- package/.medusa/server/src/helpers/returns.js +140 -2
- package/README.md +23 -4
- package/package.json +17 -17
|
@@ -375,15 +375,14 @@ const s = {
|
|
|
375
375
|
const OrderGiftItemsWidget = ({ data }) => {
|
|
376
376
|
const [fetchedItems, setFetchedItems] = react.useState(null);
|
|
377
377
|
react.useEffect(() => {
|
|
378
|
-
if (!
|
|
378
|
+
if (!data?.id) return;
|
|
379
379
|
fetch(
|
|
380
380
|
`/admin/orders/${data.id}?fields=*items,items.metadata`
|
|
381
|
-
).then((r) => r.json()).then(({ order }) => setFetchedItems(
|
|
382
|
-
}, [data
|
|
383
|
-
const items = fetchedItems ??
|
|
381
|
+
).then((r) => r.json()).then(({ order }) => setFetchedItems(order?.items ?? [])).catch(() => setFetchedItems(data?.items ?? []));
|
|
382
|
+
}, [data?.id]);
|
|
383
|
+
const items = fetchedItems ?? data?.items ?? [];
|
|
384
384
|
const giftedItems = items.filter((i) => {
|
|
385
|
-
|
|
386
|
-
const flag = (_a = i.metadata) == null ? void 0 : _a.is_gift;
|
|
385
|
+
const flag = i.metadata?.is_gift;
|
|
387
386
|
return flag === "true" || flag === true;
|
|
388
387
|
});
|
|
389
388
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.widget, children: [
|
|
@@ -412,9 +411,9 @@ const OrderGiftItemsWidget = ({ data }) => {
|
|
|
412
411
|
),
|
|
413
412
|
giftedItems.map((item) => {
|
|
414
413
|
const meta = item.metadata;
|
|
415
|
-
const from = meta
|
|
416
|
-
const to = meta
|
|
417
|
-
const message = meta
|
|
414
|
+
const from = meta?.gift_from;
|
|
415
|
+
const to = meta?.gift_to;
|
|
416
|
+
const message = meta?.gift_message;
|
|
418
417
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.card, children: [
|
|
419
418
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.ribbon, children: [
|
|
420
419
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.bowCenter, children: "🎀" }),
|
|
@@ -478,7 +477,7 @@ function formatRefundCurrency(amount, currencyCode = "inr", options) {
|
|
|
478
477
|
minimumFractionDigits: 2,
|
|
479
478
|
maximumFractionDigits: 2
|
|
480
479
|
}).format(amount);
|
|
481
|
-
if (
|
|
480
|
+
if (options?.signed && amount > 0) {
|
|
482
481
|
return `−${formatted}`;
|
|
483
482
|
}
|
|
484
483
|
return formatted;
|
|
@@ -533,8 +532,7 @@ function getOrderIdFromPath() {
|
|
|
533
532
|
return m ? m[1] : void 0;
|
|
534
533
|
}
|
|
535
534
|
const OrderRefundContextWidget = (props) => {
|
|
536
|
-
|
|
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();
|
|
535
|
+
const orderId = props.order?.id ?? props.data?.order?.id ?? getOrderIdFromPath();
|
|
538
536
|
const [context, setContext] = react.useState(null);
|
|
539
537
|
const [loading, setLoading] = react.useState(!!orderId);
|
|
540
538
|
const [error, setError] = react.useState(null);
|
|
@@ -572,7 +570,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
572
570
|
};
|
|
573
571
|
}, [orderId]);
|
|
574
572
|
const handleMarkRefunded = async () => {
|
|
575
|
-
if (!
|
|
573
|
+
if (!context?.return_id || !context?.refund_mapping || context.refund_mapping.is_refunded || !context.can_process_refund) {
|
|
576
574
|
return;
|
|
577
575
|
}
|
|
578
576
|
setMarking(true);
|
|
@@ -589,17 +587,14 @@ const OrderRefundContextWidget = (props) => {
|
|
|
589
587
|
}
|
|
590
588
|
const data = await res.json();
|
|
591
589
|
setContext(
|
|
592
|
-
(prev) => {
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
}
|
|
601
|
-
} : prev;
|
|
602
|
-
}
|
|
590
|
+
(prev) => prev && prev.refund_mapping ? {
|
|
591
|
+
...prev,
|
|
592
|
+
can_process_refund: false,
|
|
593
|
+
refund_mapping: {
|
|
594
|
+
...prev.refund_mapping,
|
|
595
|
+
is_refunded: data.refund_payment_mapping?.is_refunded ?? true
|
|
596
|
+
}
|
|
597
|
+
} : prev
|
|
603
598
|
);
|
|
604
599
|
} catch (e) {
|
|
605
600
|
setMarkError(e instanceof Error ? e.message : "Failed to mark refunded");
|
|
@@ -608,20 +603,19 @@ const OrderRefundContextWidget = (props) => {
|
|
|
608
603
|
}
|
|
609
604
|
};
|
|
610
605
|
const handleEditClick = () => {
|
|
611
|
-
const mapping = context
|
|
612
|
-
const mode = mapping
|
|
606
|
+
const mapping = context?.refund_mapping;
|
|
607
|
+
const mode = mapping?.refund_mode;
|
|
613
608
|
setEditRefundMode(
|
|
614
609
|
mode === "offline" || mode === "online" ? mode : ""
|
|
615
610
|
);
|
|
616
|
-
setEditDetails(
|
|
617
|
-
setEditImageUrls(
|
|
611
|
+
setEditDetails(mapping?.details ?? "");
|
|
612
|
+
setEditImageUrls(mapping?.images ?? []);
|
|
618
613
|
setSaveError(null);
|
|
619
614
|
setUploadError(null);
|
|
620
615
|
setEditing(true);
|
|
621
616
|
};
|
|
622
617
|
const handleUploadImage = async (e) => {
|
|
623
|
-
|
|
624
|
-
const file = (_a2 = e.target.files) == null ? void 0 : _a2[0];
|
|
618
|
+
const file = e.target.files?.[0];
|
|
625
619
|
if (!file) return;
|
|
626
620
|
setUploading(true);
|
|
627
621
|
setUploadError(null);
|
|
@@ -638,7 +632,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
638
632
|
throw new Error(data2.message || "Upload failed");
|
|
639
633
|
}
|
|
640
634
|
const data = await res.json();
|
|
641
|
-
const url =
|
|
635
|
+
const url = data.files?.[0]?.url;
|
|
642
636
|
if (url) setEditImageUrls((prev) => [...prev, url]);
|
|
643
637
|
} catch (err) {
|
|
644
638
|
setUploadError(err instanceof Error ? err.message : "Upload failed");
|
|
@@ -651,7 +645,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
651
645
|
setEditImageUrls((prev) => prev.filter((_, i) => i !== index));
|
|
652
646
|
};
|
|
653
647
|
const handleSaveAdminFields = async () => {
|
|
654
|
-
if (!
|
|
648
|
+
if (!context?.return_id) return;
|
|
655
649
|
setSaving(true);
|
|
656
650
|
setSaveError(null);
|
|
657
651
|
try {
|
|
@@ -688,13 +682,14 @@ const OrderRefundContextWidget = (props) => {
|
|
|
688
682
|
if (error) {
|
|
689
683
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mt-6 divide-y p-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-error", children: error }) }) });
|
|
690
684
|
}
|
|
691
|
-
const hasReturn = !!
|
|
692
|
-
const hasMapping = !!
|
|
693
|
-
const canMarkRefunded = Boolean(context
|
|
694
|
-
const returnStatus =
|
|
695
|
-
const showReceiveFirstHint = hasReturn && !
|
|
696
|
-
const paymentDetail = context
|
|
697
|
-
const
|
|
685
|
+
const hasReturn = !!context?.return_id;
|
|
686
|
+
const hasMapping = !!context?.refund_mapping;
|
|
687
|
+
const canMarkRefunded = Boolean(context?.can_process_refund);
|
|
688
|
+
const returnStatus = context?.return_status ?? null;
|
|
689
|
+
const showReceiveFirstHint = hasReturn && !context?.refund_mapping?.is_refunded && returnStatus !== "received" && returnStatus !== "canceled";
|
|
690
|
+
const paymentDetail = context?.payment_detail;
|
|
691
|
+
const paymentDetails = context?.payment_details && context.payment_details.length > 0 ? context.payment_details : paymentDetail ? [paymentDetail] : [];
|
|
692
|
+
const orderPayment = context?.order_payment;
|
|
698
693
|
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: [
|
|
699
694
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Heading, { level: "h2", className: "flex items-center gap-2", children: [
|
|
700
695
|
/* @__PURE__ */ jsxRuntime.jsx(icons.CashSolid, { className: "text-ui-fg-subtle" }),
|
|
@@ -706,7 +701,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
706
701
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
707
702
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Return" }),
|
|
708
703
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: context.return_id }),
|
|
709
|
-
|
|
704
|
+
context.refund_mapping?.is_refunded ? /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "green", children: "Refunded" }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "orange", children: "Not refunded" })
|
|
710
705
|
] }),
|
|
711
706
|
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
707
|
orderPayment && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 space-y-2 border-t border-ui-border-base pt-3", children: [
|
|
@@ -720,29 +715,29 @@ const OrderRefundContextWidget = (props) => {
|
|
|
720
715
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 space-y-2 border-t border-ui-border-base pt-3", children: [
|
|
721
716
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
722
717
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Payment method (refund destination)" }),
|
|
723
|
-
|
|
718
|
+
context.refund_mapping?.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
|
|
724
719
|
] }),
|
|
725
|
-
|
|
726
|
-
!
|
|
727
|
-
!
|
|
720
|
+
context.refund_mapping?.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." }) }),
|
|
721
|
+
!context.refund_mapping?.payment_id && 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." }) }),
|
|
722
|
+
!context.refund_mapping?.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
723
|
"Refund will go to the original payment method (",
|
|
729
724
|
orderPayment.label,
|
|
730
725
|
")."
|
|
731
726
|
] }) }),
|
|
732
|
-
!
|
|
733
|
-
!
|
|
734
|
-
|
|
727
|
+
!context.refund_mapping?.payment_id && !paymentDetail && (context.is_cod || 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." }) }),
|
|
728
|
+
!context.refund_mapping?.payment_id && !paymentDetail && !orderPayment && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", className: "text-ui-fg-muted", children: "No payment method found for this customer." }) }),
|
|
729
|
+
paymentDetails.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: paymentDetails.map((detail) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
735
730
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
736
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { children:
|
|
737
|
-
|
|
731
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { children: detail.type.toUpperCase() }),
|
|
732
|
+
detail.is_default && /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "blue", children: "Default" })
|
|
738
733
|
] }),
|
|
739
|
-
Object.keys(
|
|
734
|
+
Object.keys(detail.detail_json).length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-2 gap-x-6 gap-y-2", children: Object.entries(detail.detail_json).map(([k, v]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
740
735
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", weight: "plus", className: "text-ui-fg-muted", children: FIELD_LABELS[k] ?? k }),
|
|
741
736
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "block", children: String(v) })
|
|
742
|
-
] }, k)) })
|
|
743
|
-
] })
|
|
737
|
+
] }, `${detail.id}-${k}`)) })
|
|
738
|
+
] }, detail.id)) })
|
|
744
739
|
] }),
|
|
745
|
-
|
|
740
|
+
context?.refund_mapping && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 space-y-3 border-t border-ui-border-base pt-3", children: [
|
|
746
741
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
747
742
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Refund mode, details & images" }),
|
|
748
743
|
!editing ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -830,10 +825,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
830
825
|
variant: "secondary",
|
|
831
826
|
type: "button",
|
|
832
827
|
disabled: uploading,
|
|
833
|
-
onClick: () =>
|
|
834
|
-
var _a2;
|
|
835
|
-
return (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
836
|
-
},
|
|
828
|
+
onClick: () => fileInputRef.current?.click(),
|
|
837
829
|
children: uploading ? "Uploading…" : "Upload image"
|
|
838
830
|
}
|
|
839
831
|
),
|
|
@@ -884,7 +876,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
884
876
|
] }),
|
|
885
877
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
886
878
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "xsmall", weight: "plus", className: "text-ui-fg-muted", children: "Images" }),
|
|
887
|
-
|
|
879
|
+
context.refund_mapping.images?.length ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 flex flex-wrap gap-2", children: context.refund_mapping.images.map((url, i) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
888
880
|
"a",
|
|
889
881
|
{
|
|
890
882
|
href: url,
|
|
@@ -914,10 +906,10 @@ const OrderRefundContextWidget = (props) => {
|
|
|
914
906
|
),
|
|
915
907
|
markError && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-error", children: markError })
|
|
916
908
|
] }),
|
|
917
|
-
hasMapping && !canMarkRefunded && !
|
|
909
|
+
hasMapping && !canMarkRefunded && !context.refund_mapping?.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." })
|
|
918
910
|
] }),
|
|
919
911
|
hasReturn && !hasMapping && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-4", children: [
|
|
920
|
-
|
|
912
|
+
context?.refund ? /* @__PURE__ */ jsxRuntime.jsx(RefundCalculationBlock, { refund: context.refund }) : null,
|
|
921
913
|
orderPayment && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3 space-y-1", children: [
|
|
922
914
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Order payment method" }),
|
|
923
915
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
@@ -1141,248 +1133,6 @@ const useDebounce$2 = (value, delay) => {
|
|
|
1141
1133
|
return debouncedValue;
|
|
1142
1134
|
};
|
|
1143
1135
|
const getStatusBadgeClass$6 = (status) => {
|
|
1144
|
-
const statusLower = status.toLowerCase();
|
|
1145
|
-
if (statusLower === "requested") {
|
|
1146
|
-
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1147
|
-
}
|
|
1148
|
-
if (statusLower === "received") {
|
|
1149
|
-
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1150
|
-
}
|
|
1151
|
-
if (statusLower === "requires_action") {
|
|
1152
|
-
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1153
|
-
}
|
|
1154
|
-
if (statusLower === "completed") {
|
|
1155
|
-
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1156
|
-
}
|
|
1157
|
-
if (statusLower === "canceled") {
|
|
1158
|
-
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
1159
|
-
}
|
|
1160
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1161
|
-
};
|
|
1162
|
-
const ReturnsPage = () => {
|
|
1163
|
-
const navigate = reactRouterDom.useNavigate();
|
|
1164
|
-
const [items, setItems] = react.useState([]);
|
|
1165
|
-
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
1166
|
-
const [createdByFilter, setCreatedByFilter] = react.useState("all");
|
|
1167
|
-
const [searchQuery, setSearchQuery] = react.useState("");
|
|
1168
|
-
const debouncedSearchQuery = useDebounce$2(searchQuery, 300);
|
|
1169
|
-
const [isLoading, setIsLoading] = react.useState(true);
|
|
1170
|
-
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
1171
|
-
const [error, setError] = react.useState(null);
|
|
1172
|
-
const [offset, setOffset] = react.useState(0);
|
|
1173
|
-
const [count, setCount] = react.useState(0);
|
|
1174
|
-
const limit = 50;
|
|
1175
|
-
const loadReturns = react.useCallback(
|
|
1176
|
-
async (nextOffset, replace = false) => {
|
|
1177
|
-
var _a;
|
|
1178
|
-
try {
|
|
1179
|
-
if (replace) {
|
|
1180
|
-
setIsLoading(true);
|
|
1181
|
-
} else {
|
|
1182
|
-
setIsFetchingMore(true);
|
|
1183
|
-
}
|
|
1184
|
-
setError(null);
|
|
1185
|
-
const params = new URLSearchParams();
|
|
1186
|
-
params.set("limit", String(limit));
|
|
1187
|
-
params.set("offset", String(nextOffset));
|
|
1188
|
-
if (statusFilter !== "all") {
|
|
1189
|
-
params.set("status", statusFilter);
|
|
1190
|
-
}
|
|
1191
|
-
if (debouncedSearchQuery.trim()) {
|
|
1192
|
-
params.set("q", debouncedSearchQuery.trim());
|
|
1193
|
-
}
|
|
1194
|
-
if (createdByFilter !== "all") {
|
|
1195
|
-
params.set("created_by", createdByFilter);
|
|
1196
|
-
}
|
|
1197
|
-
params.set("order", "created_at");
|
|
1198
|
-
const response = await fetch(
|
|
1199
|
-
`/admin/return?${params.toString()}`,
|
|
1200
|
-
{ credentials: "include" }
|
|
1201
|
-
);
|
|
1202
|
-
if (!response.ok) {
|
|
1203
|
-
const message = await response.text();
|
|
1204
|
-
throw new Error(message || "Unable to load return orders");
|
|
1205
|
-
}
|
|
1206
|
-
const payload = await response.json();
|
|
1207
|
-
setCount(payload.count ?? 0);
|
|
1208
|
-
setOffset(nextOffset + (((_a = payload.returns) == null ? void 0 : _a.length) ?? 0));
|
|
1209
|
-
setItems(
|
|
1210
|
-
(prev) => replace ? payload.returns ?? [] : [...prev, ...payload.returns ?? []]
|
|
1211
|
-
);
|
|
1212
|
-
} catch (loadError) {
|
|
1213
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load return orders";
|
|
1214
|
-
setError(message);
|
|
1215
|
-
} finally {
|
|
1216
|
-
setIsLoading(false);
|
|
1217
|
-
setIsFetchingMore(false);
|
|
1218
|
-
}
|
|
1219
|
-
},
|
|
1220
|
-
[statusFilter, createdByFilter, debouncedSearchQuery]
|
|
1221
|
-
);
|
|
1222
|
-
react.useEffect(() => {
|
|
1223
|
-
void loadReturns(0, true);
|
|
1224
|
-
}, [statusFilter, createdByFilter, debouncedSearchQuery, loadReturns]);
|
|
1225
|
-
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
1226
|
-
const availableStatuses = react.useMemo(() => {
|
|
1227
|
-
const statuses = /* @__PURE__ */ new Set();
|
|
1228
|
-
items.forEach((item) => statuses.add(item.status));
|
|
1229
|
-
return Array.from(statuses).sort();
|
|
1230
|
-
}, [items]);
|
|
1231
|
-
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: [
|
|
1232
|
-
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1233
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1234
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Return Orders" }),
|
|
1235
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer return orders" })
|
|
1236
|
-
] }),
|
|
1237
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadReturns(0, true), children: "Refresh" })
|
|
1238
|
-
] }),
|
|
1239
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1240
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1241
|
-
ui.Input,
|
|
1242
|
-
{
|
|
1243
|
-
placeholder: "Search by return ID, order ID, or customer email",
|
|
1244
|
-
value: searchQuery,
|
|
1245
|
-
onChange: (event) => setSearchQuery(event.target.value),
|
|
1246
|
-
className: "md:max-w-sm"
|
|
1247
|
-
}
|
|
1248
|
-
),
|
|
1249
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
|
|
1250
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1251
|
-
"select",
|
|
1252
|
-
{
|
|
1253
|
-
value: createdByFilter,
|
|
1254
|
-
onChange: (event) => setCreatedByFilter(event.target.value),
|
|
1255
|
-
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",
|
|
1256
|
-
children: [
|
|
1257
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All (Created by)" }),
|
|
1258
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "customer", children: "Customer" }),
|
|
1259
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "admin", children: "Admin" })
|
|
1260
|
-
]
|
|
1261
|
-
}
|
|
1262
|
-
),
|
|
1263
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1264
|
-
"select",
|
|
1265
|
-
{
|
|
1266
|
-
value: statusFilter,
|
|
1267
|
-
onChange: (event) => setStatusFilter(event.target.value),
|
|
1268
|
-
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",
|
|
1269
|
-
children: [
|
|
1270
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All Statuses" }),
|
|
1271
|
-
availableStatuses.map((status) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: status, children: status.replace(/_/g, " ").toUpperCase() }, status))
|
|
1272
|
-
]
|
|
1273
|
-
}
|
|
1274
|
-
)
|
|
1275
|
-
] })
|
|
1276
|
-
] }),
|
|
1277
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1278
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1279
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1280
|
-
ui.Button,
|
|
1281
|
-
{
|
|
1282
|
-
variant: "secondary",
|
|
1283
|
-
onClick: () => loadReturns(0, true),
|
|
1284
|
-
children: "Try again"
|
|
1285
|
-
}
|
|
1286
|
-
) })
|
|
1287
|
-
] }) : null,
|
|
1288
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading return orders..." }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
1289
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No return orders yet" }),
|
|
1290
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Return orders created by customers will appear here." })
|
|
1291
|
-
] }) : /* @__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: [
|
|
1292
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1293
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Return ID" }),
|
|
1294
|
-
/* @__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" }),
|
|
1295
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Customer" }),
|
|
1296
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
1297
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Refund Amount" }),
|
|
1298
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1299
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1300
|
-
] }) }),
|
|
1301
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((returnOrder) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1302
|
-
"tr",
|
|
1303
|
-
{
|
|
1304
|
-
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1305
|
-
onClick: () => navigate(`/returns/${returnOrder.id}`),
|
|
1306
|
-
children: [
|
|
1307
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-0.5", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: returnOrder.id }) }) }),
|
|
1308
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.order_id }),
|
|
1309
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.customer_email || returnOrder.order_email || "—" }),
|
|
1310
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1311
|
-
ui.Badge,
|
|
1312
|
-
{
|
|
1313
|
-
size: "2xsmall",
|
|
1314
|
-
className: `uppercase ${getStatusBadgeClass$6(returnOrder.status)}`,
|
|
1315
|
-
children: returnOrder.status.replace(/_/g, " ")
|
|
1316
|
-
}
|
|
1317
|
-
) }),
|
|
1318
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
|
|
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) {
|
|
1330
|
-
return "—";
|
|
1331
|
-
}
|
|
1332
|
-
return formatRefundCurrency(
|
|
1333
|
-
Number(returnOrder.refund_amount),
|
|
1334
|
-
returnOrder.currency_code
|
|
1335
|
-
);
|
|
1336
|
-
})() }),
|
|
1337
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(returnOrder.created_at).toLocaleDateString("en-US", {
|
|
1338
|
-
year: "numeric",
|
|
1339
|
-
month: "short",
|
|
1340
|
-
day: "numeric",
|
|
1341
|
-
hour: "numeric",
|
|
1342
|
-
minute: "2-digit",
|
|
1343
|
-
hour12: true
|
|
1344
|
-
}) }),
|
|
1345
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1346
|
-
ui.Button,
|
|
1347
|
-
{
|
|
1348
|
-
variant: "transparent",
|
|
1349
|
-
size: "small",
|
|
1350
|
-
onClick: (e) => {
|
|
1351
|
-
e.stopPropagation();
|
|
1352
|
-
navigate(`/app/orders/${returnOrder.order_id}`);
|
|
1353
|
-
},
|
|
1354
|
-
children: "Go to order"
|
|
1355
|
-
}
|
|
1356
|
-
) })
|
|
1357
|
-
]
|
|
1358
|
-
},
|
|
1359
|
-
returnOrder.id
|
|
1360
|
-
)) })
|
|
1361
|
-
] }) }),
|
|
1362
|
-
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1363
|
-
ui.Button,
|
|
1364
|
-
{
|
|
1365
|
-
variant: "secondary",
|
|
1366
|
-
isLoading: isFetchingMore,
|
|
1367
|
-
onClick: () => loadReturns(offset, false),
|
|
1368
|
-
children: "Load more"
|
|
1369
|
-
}
|
|
1370
|
-
) }) : null
|
|
1371
|
-
] }) });
|
|
1372
|
-
};
|
|
1373
|
-
const config$6 = adminSdk.defineRouteConfig({
|
|
1374
|
-
label: "Return Orders",
|
|
1375
|
-
icon: icons.ArrowPath
|
|
1376
|
-
});
|
|
1377
|
-
const useDebounce$1 = (value, delay) => {
|
|
1378
|
-
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
1379
|
-
react.useEffect(() => {
|
|
1380
|
-
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
1381
|
-
return () => clearTimeout(handler);
|
|
1382
|
-
}, [value, delay]);
|
|
1383
|
-
return debouncedValue;
|
|
1384
|
-
};
|
|
1385
|
-
const getStatusBadgeClass$5 = (status) => {
|
|
1386
1136
|
const s2 = status.toLowerCase();
|
|
1387
1137
|
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1388
1138
|
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
@@ -1394,12 +1144,12 @@ const RefundsPage = () => {
|
|
|
1394
1144
|
const navigate = reactRouterDom.useNavigate();
|
|
1395
1145
|
const [items, setItems] = react.useState([]);
|
|
1396
1146
|
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
1397
|
-
const debouncedOrderId = useDebounce$
|
|
1147
|
+
const debouncedOrderId = useDebounce$2(orderIdSearch, 300);
|
|
1398
1148
|
const [paymentStatusFilter, setPaymentStatusFilter] = react.useState("all");
|
|
1399
1149
|
const [providerSearch, setProviderSearch] = react.useState("");
|
|
1400
|
-
const debouncedProvider = useDebounce$
|
|
1150
|
+
const debouncedProvider = useDebounce$2(providerSearch, 300);
|
|
1401
1151
|
const [currencySearch, setCurrencySearch] = react.useState("");
|
|
1402
|
-
const debouncedCurrency = useDebounce$
|
|
1152
|
+
const debouncedCurrency = useDebounce$2(currencySearch, 300);
|
|
1403
1153
|
const [dateFrom, setDateFrom] = react.useState("");
|
|
1404
1154
|
const [dateTo, setDateTo] = react.useState("");
|
|
1405
1155
|
const [amountMin, setAmountMin] = react.useState("");
|
|
@@ -1611,7 +1361,7 @@ const RefundsPage = () => {
|
|
|
1611
1361
|
ui.Badge,
|
|
1612
1362
|
{
|
|
1613
1363
|
size: "2xsmall",
|
|
1614
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
1364
|
+
className: `uppercase ${getStatusBadgeClass$6(displayStatus(r))}`,
|
|
1615
1365
|
children: displayStatus(r) !== "—" ? displayStatus(r).replace(/_/g, " ") : "—"
|
|
1616
1366
|
}
|
|
1617
1367
|
) }),
|
|
@@ -1665,11 +1415,11 @@ const RefundsPage = () => {
|
|
|
1665
1415
|
) }) : null
|
|
1666
1416
|
] }) });
|
|
1667
1417
|
};
|
|
1668
|
-
const config$
|
|
1418
|
+
const config$6 = adminSdk.defineRouteConfig({
|
|
1669
1419
|
label: "Refunds",
|
|
1670
1420
|
icon: icons.Receipt
|
|
1671
1421
|
});
|
|
1672
|
-
const useDebounce = (value, delay) => {
|
|
1422
|
+
const useDebounce$1 = (value, delay) => {
|
|
1673
1423
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
1674
1424
|
react.useEffect(() => {
|
|
1675
1425
|
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
@@ -1677,26 +1427,267 @@ const useDebounce = (value, delay) => {
|
|
|
1677
1427
|
}, [value, delay]);
|
|
1678
1428
|
return debouncedValue;
|
|
1679
1429
|
};
|
|
1680
|
-
const getStatusBadgeClass$
|
|
1430
|
+
const getStatusBadgeClass$5 = (status) => {
|
|
1681
1431
|
const statusLower = status.toLowerCase();
|
|
1682
1432
|
if (statusLower === "requested") {
|
|
1683
1433
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1684
1434
|
}
|
|
1685
|
-
if (statusLower === "
|
|
1435
|
+
if (statusLower === "received") {
|
|
1686
1436
|
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1687
1437
|
}
|
|
1688
|
-
if (statusLower === "
|
|
1438
|
+
if (statusLower === "requires_action") {
|
|
1689
1439
|
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1690
1440
|
}
|
|
1691
1441
|
if (statusLower === "completed") {
|
|
1692
1442
|
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1693
1443
|
}
|
|
1694
|
-
if (statusLower === "
|
|
1444
|
+
if (statusLower === "canceled") {
|
|
1695
1445
|
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
1696
1446
|
}
|
|
1697
1447
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1698
1448
|
};
|
|
1699
|
-
const
|
|
1449
|
+
const ReturnsPage = () => {
|
|
1450
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1451
|
+
const [items, setItems] = react.useState([]);
|
|
1452
|
+
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
1453
|
+
const [createdByFilter, setCreatedByFilter] = react.useState("all");
|
|
1454
|
+
const [searchQuery, setSearchQuery] = react.useState("");
|
|
1455
|
+
const debouncedSearchQuery = useDebounce$1(searchQuery, 300);
|
|
1456
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
1457
|
+
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
1458
|
+
const [error, setError] = react.useState(null);
|
|
1459
|
+
const [offset, setOffset] = react.useState(0);
|
|
1460
|
+
const [count, setCount] = react.useState(0);
|
|
1461
|
+
const limit = 50;
|
|
1462
|
+
const loadReturns = react.useCallback(
|
|
1463
|
+
async (nextOffset, replace = false) => {
|
|
1464
|
+
try {
|
|
1465
|
+
if (replace) {
|
|
1466
|
+
setIsLoading(true);
|
|
1467
|
+
} else {
|
|
1468
|
+
setIsFetchingMore(true);
|
|
1469
|
+
}
|
|
1470
|
+
setError(null);
|
|
1471
|
+
const params = new URLSearchParams();
|
|
1472
|
+
params.set("limit", String(limit));
|
|
1473
|
+
params.set("offset", String(nextOffset));
|
|
1474
|
+
if (statusFilter !== "all") {
|
|
1475
|
+
params.set("status", statusFilter);
|
|
1476
|
+
}
|
|
1477
|
+
if (debouncedSearchQuery.trim()) {
|
|
1478
|
+
params.set("q", debouncedSearchQuery.trim());
|
|
1479
|
+
}
|
|
1480
|
+
if (createdByFilter !== "all") {
|
|
1481
|
+
params.set("created_by", createdByFilter);
|
|
1482
|
+
}
|
|
1483
|
+
params.set("order", "created_at");
|
|
1484
|
+
const response = await fetch(
|
|
1485
|
+
`/admin/return?${params.toString()}`,
|
|
1486
|
+
{ credentials: "include" }
|
|
1487
|
+
);
|
|
1488
|
+
if (!response.ok) {
|
|
1489
|
+
const message = await response.text();
|
|
1490
|
+
throw new Error(message || "Unable to load return orders");
|
|
1491
|
+
}
|
|
1492
|
+
const payload = await response.json();
|
|
1493
|
+
setCount(payload.count ?? 0);
|
|
1494
|
+
setOffset(nextOffset + (payload.returns?.length ?? 0));
|
|
1495
|
+
setItems(
|
|
1496
|
+
(prev) => replace ? payload.returns ?? [] : [...prev, ...payload.returns ?? []]
|
|
1497
|
+
);
|
|
1498
|
+
} catch (loadError) {
|
|
1499
|
+
const message = loadError instanceof Error ? loadError.message : "Unable to load return orders";
|
|
1500
|
+
setError(message);
|
|
1501
|
+
} finally {
|
|
1502
|
+
setIsLoading(false);
|
|
1503
|
+
setIsFetchingMore(false);
|
|
1504
|
+
}
|
|
1505
|
+
},
|
|
1506
|
+
[statusFilter, createdByFilter, debouncedSearchQuery]
|
|
1507
|
+
);
|
|
1508
|
+
react.useEffect(() => {
|
|
1509
|
+
void loadReturns(0, true);
|
|
1510
|
+
}, [statusFilter, createdByFilter, debouncedSearchQuery, loadReturns]);
|
|
1511
|
+
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
1512
|
+
const availableStatuses = react.useMemo(() => {
|
|
1513
|
+
const statuses = /* @__PURE__ */ new Set();
|
|
1514
|
+
items.forEach((item) => statuses.add(item.status));
|
|
1515
|
+
return Array.from(statuses).sort();
|
|
1516
|
+
}, [items]);
|
|
1517
|
+
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: [
|
|
1518
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1519
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1520
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Return Orders" }),
|
|
1521
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer return orders" })
|
|
1522
|
+
] }),
|
|
1523
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadReturns(0, true), children: "Refresh" })
|
|
1524
|
+
] }),
|
|
1525
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1526
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1527
|
+
ui.Input,
|
|
1528
|
+
{
|
|
1529
|
+
placeholder: "Search by return ID, order ID, or customer email",
|
|
1530
|
+
value: searchQuery,
|
|
1531
|
+
onChange: (event) => setSearchQuery(event.target.value),
|
|
1532
|
+
className: "md:max-w-sm"
|
|
1533
|
+
}
|
|
1534
|
+
),
|
|
1535
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
|
|
1536
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1537
|
+
"select",
|
|
1538
|
+
{
|
|
1539
|
+
value: createdByFilter,
|
|
1540
|
+
onChange: (event) => setCreatedByFilter(event.target.value),
|
|
1541
|
+
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",
|
|
1542
|
+
children: [
|
|
1543
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All (Created by)" }),
|
|
1544
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "customer", children: "Customer" }),
|
|
1545
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "admin", children: "Admin" })
|
|
1546
|
+
]
|
|
1547
|
+
}
|
|
1548
|
+
),
|
|
1549
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1550
|
+
"select",
|
|
1551
|
+
{
|
|
1552
|
+
value: statusFilter,
|
|
1553
|
+
onChange: (event) => setStatusFilter(event.target.value),
|
|
1554
|
+
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",
|
|
1555
|
+
children: [
|
|
1556
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All Statuses" }),
|
|
1557
|
+
availableStatuses.map((status) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: status, children: status.replace(/_/g, " ").toUpperCase() }, status))
|
|
1558
|
+
]
|
|
1559
|
+
}
|
|
1560
|
+
)
|
|
1561
|
+
] })
|
|
1562
|
+
] }),
|
|
1563
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1564
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1565
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1566
|
+
ui.Button,
|
|
1567
|
+
{
|
|
1568
|
+
variant: "secondary",
|
|
1569
|
+
onClick: () => loadReturns(0, true),
|
|
1570
|
+
children: "Try again"
|
|
1571
|
+
}
|
|
1572
|
+
) })
|
|
1573
|
+
] }) : null,
|
|
1574
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading return orders..." }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
1575
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No return orders yet" }),
|
|
1576
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Return orders created by customers will appear here." })
|
|
1577
|
+
] }) : /* @__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: [
|
|
1578
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1579
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Return ID" }),
|
|
1580
|
+
/* @__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" }),
|
|
1581
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Customer" }),
|
|
1582
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
1583
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Refund Amount" }),
|
|
1584
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1585
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1586
|
+
] }) }),
|
|
1587
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((returnOrder) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1588
|
+
"tr",
|
|
1589
|
+
{
|
|
1590
|
+
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1591
|
+
onClick: () => navigate(`/returns/${returnOrder.id}`),
|
|
1592
|
+
children: [
|
|
1593
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-0.5", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: returnOrder.id }) }) }),
|
|
1594
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.order_id }),
|
|
1595
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.customer_email || returnOrder.order_email || "—" }),
|
|
1596
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1597
|
+
ui.Badge,
|
|
1598
|
+
{
|
|
1599
|
+
size: "2xsmall",
|
|
1600
|
+
className: `uppercase ${getStatusBadgeClass$5(returnOrder.status)}`,
|
|
1601
|
+
children: returnOrder.status.replace(/_/g, " ")
|
|
1602
|
+
}
|
|
1603
|
+
) }),
|
|
1604
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
|
|
1605
|
+
const calc = returnOrder.refund;
|
|
1606
|
+
if (calc?.is_processed && calc.final_refund_amount != null) {
|
|
1607
|
+
return formatRefundCurrency(
|
|
1608
|
+
calc.final_refund_amount,
|
|
1609
|
+
calc.currency_code || returnOrder.currency_code
|
|
1610
|
+
);
|
|
1611
|
+
}
|
|
1612
|
+
if (calc) {
|
|
1613
|
+
return "Pending";
|
|
1614
|
+
}
|
|
1615
|
+
if (returnOrder.refund_amount == null) {
|
|
1616
|
+
return "—";
|
|
1617
|
+
}
|
|
1618
|
+
return formatRefundCurrency(
|
|
1619
|
+
Number(returnOrder.refund_amount),
|
|
1620
|
+
returnOrder.currency_code
|
|
1621
|
+
);
|
|
1622
|
+
})() }),
|
|
1623
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(returnOrder.created_at).toLocaleDateString("en-US", {
|
|
1624
|
+
year: "numeric",
|
|
1625
|
+
month: "short",
|
|
1626
|
+
day: "numeric",
|
|
1627
|
+
hour: "numeric",
|
|
1628
|
+
minute: "2-digit",
|
|
1629
|
+
hour12: true
|
|
1630
|
+
}) }),
|
|
1631
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1632
|
+
ui.Button,
|
|
1633
|
+
{
|
|
1634
|
+
variant: "transparent",
|
|
1635
|
+
size: "small",
|
|
1636
|
+
onClick: (e) => {
|
|
1637
|
+
e.stopPropagation();
|
|
1638
|
+
navigate(`/app/orders/${returnOrder.order_id}`);
|
|
1639
|
+
},
|
|
1640
|
+
children: "Go to order"
|
|
1641
|
+
}
|
|
1642
|
+
) })
|
|
1643
|
+
]
|
|
1644
|
+
},
|
|
1645
|
+
returnOrder.id
|
|
1646
|
+
)) })
|
|
1647
|
+
] }) }),
|
|
1648
|
+
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1649
|
+
ui.Button,
|
|
1650
|
+
{
|
|
1651
|
+
variant: "secondary",
|
|
1652
|
+
isLoading: isFetchingMore,
|
|
1653
|
+
onClick: () => loadReturns(offset, false),
|
|
1654
|
+
children: "Load more"
|
|
1655
|
+
}
|
|
1656
|
+
) }) : null
|
|
1657
|
+
] }) });
|
|
1658
|
+
};
|
|
1659
|
+
const config$5 = adminSdk.defineRouteConfig({
|
|
1660
|
+
label: "Return Orders",
|
|
1661
|
+
icon: icons.ArrowPath
|
|
1662
|
+
});
|
|
1663
|
+
const useDebounce = (value, delay) => {
|
|
1664
|
+
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
1665
|
+
react.useEffect(() => {
|
|
1666
|
+
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
1667
|
+
return () => clearTimeout(handler);
|
|
1668
|
+
}, [value, delay]);
|
|
1669
|
+
return debouncedValue;
|
|
1670
|
+
};
|
|
1671
|
+
const getStatusBadgeClass$4 = (status) => {
|
|
1672
|
+
const statusLower = status.toLowerCase();
|
|
1673
|
+
if (statusLower === "requested") {
|
|
1674
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1675
|
+
}
|
|
1676
|
+
if (statusLower === "approved") {
|
|
1677
|
+
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1678
|
+
}
|
|
1679
|
+
if (statusLower === "rejected") {
|
|
1680
|
+
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1681
|
+
}
|
|
1682
|
+
if (statusLower === "completed") {
|
|
1683
|
+
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1684
|
+
}
|
|
1685
|
+
if (statusLower === "cancelled") {
|
|
1686
|
+
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
1687
|
+
}
|
|
1688
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1689
|
+
};
|
|
1690
|
+
const SwapsPage = () => {
|
|
1700
1691
|
const navigate = reactRouterDom.useNavigate();
|
|
1701
1692
|
const [items, setItems] = react.useState([]);
|
|
1702
1693
|
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
@@ -1711,7 +1702,6 @@ const SwapsPage = () => {
|
|
|
1711
1702
|
const limit = 50;
|
|
1712
1703
|
const loadSwaps = react.useCallback(
|
|
1713
1704
|
async (nextOffset, replace = false) => {
|
|
1714
|
-
var _a;
|
|
1715
1705
|
try {
|
|
1716
1706
|
if (replace) {
|
|
1717
1707
|
setIsLoading(true);
|
|
@@ -1741,7 +1731,7 @@ const SwapsPage = () => {
|
|
|
1741
1731
|
}
|
|
1742
1732
|
const payload = await response.json();
|
|
1743
1733
|
setCount(payload.count ?? 0);
|
|
1744
|
-
setOffset(nextOffset + (
|
|
1734
|
+
setOffset(nextOffset + (payload.swaps?.length ?? 0));
|
|
1745
1735
|
setItems(
|
|
1746
1736
|
(prev) => replace ? payload.swaps ?? [] : [...prev, ...payload.swaps ?? []]
|
|
1747
1737
|
);
|
|
@@ -1908,10 +1898,9 @@ const getStatusBadgeClass$3 = (status) => {
|
|
|
1908
1898
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1909
1899
|
};
|
|
1910
1900
|
const PaymentDetailPage = () => {
|
|
1911
|
-
var _a;
|
|
1912
1901
|
const navigate = reactRouterDom.useNavigate();
|
|
1913
1902
|
const params = reactRouterDom.useParams();
|
|
1914
|
-
const id =
|
|
1903
|
+
const id = params?.id?.trim();
|
|
1915
1904
|
const [detail, setDetail] = react.useState(null);
|
|
1916
1905
|
const [loading, setLoading] = react.useState(!!id);
|
|
1917
1906
|
const [error, setError] = react.useState(null);
|
|
@@ -1938,8 +1927,8 @@ const PaymentDetailPage = () => {
|
|
|
1938
1927
|
};
|
|
1939
1928
|
}, [id]);
|
|
1940
1929
|
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
1941
|
-
const sessionStatusRaw =
|
|
1942
|
-
const paymentStatusRaw =
|
|
1930
|
+
const sessionStatusRaw = detail?.session_status ?? "—";
|
|
1931
|
+
const paymentStatusRaw = detail?.payment_id != null ? detail?.payment_status ?? "—" : "—";
|
|
1943
1932
|
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
1944
1933
|
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: [
|
|
1945
1934
|
/* @__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: [
|
|
@@ -2014,11 +2003,202 @@ const PaymentDetailPage = () => {
|
|
|
2014
2003
|
] }) : null
|
|
2015
2004
|
] }) });
|
|
2016
2005
|
};
|
|
2017
|
-
const config$3 = adminSdk.defineRouteConfig({
|
|
2018
|
-
label: "Payment details",
|
|
2019
|
-
icon: icons.CreditCard
|
|
2006
|
+
const config$3 = adminSdk.defineRouteConfig({
|
|
2007
|
+
label: "Payment details",
|
|
2008
|
+
icon: icons.CreditCard
|
|
2009
|
+
});
|
|
2010
|
+
const getStatusBadgeClass$2 = (status) => {
|
|
2011
|
+
const s2 = status.toLowerCase();
|
|
2012
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2013
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2014
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2015
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2016
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2017
|
+
};
|
|
2018
|
+
const formatAmount = (value) => {
|
|
2019
|
+
return String(value);
|
|
2020
|
+
};
|
|
2021
|
+
const RefundDetailPage = () => {
|
|
2022
|
+
const navigate = reactRouterDom.useNavigate();
|
|
2023
|
+
const params = reactRouterDom.useParams();
|
|
2024
|
+
const id = params?.id?.trim();
|
|
2025
|
+
const [detail, setDetail] = react.useState(null);
|
|
2026
|
+
const [loading, setLoading] = react.useState(!!id);
|
|
2027
|
+
const [error, setError] = react.useState(null);
|
|
2028
|
+
const [gatewayExpanded, setGatewayExpanded] = react.useState(false);
|
|
2029
|
+
react.useEffect(() => {
|
|
2030
|
+
if (!id) {
|
|
2031
|
+
setLoading(false);
|
|
2032
|
+
return;
|
|
2033
|
+
}
|
|
2034
|
+
let cancelled = false;
|
|
2035
|
+
setLoading(true);
|
|
2036
|
+
setError(null);
|
|
2037
|
+
fetch(`/admin/refunds/${id}`, { credentials: "include" }).then((res) => {
|
|
2038
|
+
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
2039
|
+
return res.json();
|
|
2040
|
+
}).then((data) => {
|
|
2041
|
+
if (!cancelled) setDetail(data);
|
|
2042
|
+
}).catch((e) => {
|
|
2043
|
+
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
2044
|
+
}).finally(() => {
|
|
2045
|
+
if (!cancelled) setLoading(false);
|
|
2046
|
+
});
|
|
2047
|
+
return () => {
|
|
2048
|
+
cancelled = true;
|
|
2049
|
+
};
|
|
2050
|
+
}, [id]);
|
|
2051
|
+
const paymentStatus = detail?.payment?.status ?? "—";
|
|
2052
|
+
const hasGatewayData = detail?.payment?.payment_data && typeof detail.payment.payment_data === "object" && Object.keys(detail.payment.payment_data).length > 0;
|
|
2053
|
+
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: [
|
|
2054
|
+
/* @__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: [
|
|
2055
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/refunds"), children: "← Refunds" }),
|
|
2056
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refund details" }),
|
|
2057
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle font-mono", children: id ?? "—" })
|
|
2058
|
+
] }) }),
|
|
2059
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2060
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
2061
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/refunds"), children: "Back to list" })
|
|
2062
|
+
] }) : 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: [
|
|
2063
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2064
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Refund summary" }),
|
|
2065
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
2066
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2067
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund ID" }),
|
|
2068
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.id })
|
|
2069
|
+
] }),
|
|
2070
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2071
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
2072
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.refund.amount) })
|
|
2073
|
+
] }),
|
|
2074
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2075
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Note" }),
|
|
2076
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.refund.note ?? "—" })
|
|
2077
|
+
] }),
|
|
2078
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2079
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created at" }),
|
|
2080
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.refund.created_at).toLocaleDateString("en-US", {
|
|
2081
|
+
year: "numeric",
|
|
2082
|
+
month: "short",
|
|
2083
|
+
day: "numeric",
|
|
2084
|
+
hour: "numeric",
|
|
2085
|
+
minute: "2-digit",
|
|
2086
|
+
hour12: true
|
|
2087
|
+
}) })
|
|
2088
|
+
] }),
|
|
2089
|
+
detail.refund.created_by ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2090
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created by" }),
|
|
2091
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.created_by })
|
|
2092
|
+
] }) : null
|
|
2093
|
+
] })
|
|
2094
|
+
] }),
|
|
2095
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2096
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Payment summary" }),
|
|
2097
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
2098
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2099
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment amount" }),
|
|
2100
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.payment_amount) })
|
|
2101
|
+
] }),
|
|
2102
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2103
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Captured amount" }),
|
|
2104
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.captured_amount) })
|
|
2105
|
+
] }),
|
|
2106
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2107
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refunded amount" }),
|
|
2108
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.refunded_amount) })
|
|
2109
|
+
] }),
|
|
2110
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2111
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
2112
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment.provider_id || "—" })
|
|
2113
|
+
] }),
|
|
2114
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2115
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
2116
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2117
|
+
ui.Badge,
|
|
2118
|
+
{
|
|
2119
|
+
size: "2xsmall",
|
|
2120
|
+
className: `uppercase ${getStatusBadgeClass$2(paymentStatus)}`,
|
|
2121
|
+
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
2122
|
+
}
|
|
2123
|
+
) })
|
|
2124
|
+
] }),
|
|
2125
|
+
detail.computed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2126
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2127
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
2128
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
2129
|
+
] }),
|
|
2130
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2131
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
2132
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
2133
|
+
] }),
|
|
2134
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2135
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
2136
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "mt-1 block", children: [
|
|
2137
|
+
detail.computed.refund_percentage.toFixed(1),
|
|
2138
|
+
"%"
|
|
2139
|
+
] })
|
|
2140
|
+
] })
|
|
2141
|
+
] }) : null
|
|
2142
|
+
] })
|
|
2143
|
+
] }),
|
|
2144
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2145
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Order summary" }),
|
|
2146
|
+
detail.order ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
2147
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2148
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
2149
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2150
|
+
ui.Button,
|
|
2151
|
+
{
|
|
2152
|
+
variant: "transparent",
|
|
2153
|
+
size: "small",
|
|
2154
|
+
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
2155
|
+
children: detail.order.order_number ?? detail.order.order_id
|
|
2156
|
+
}
|
|
2157
|
+
) })
|
|
2158
|
+
] }),
|
|
2159
|
+
detail.order.total != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2160
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
2161
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
2162
|
+
] }) : null,
|
|
2163
|
+
detail.order.customer_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2164
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
2165
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
2166
|
+
] }) : null,
|
|
2167
|
+
detail.order.region ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2168
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
2169
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.region })
|
|
2170
|
+
] }) : null,
|
|
2171
|
+
detail.order.fulfillment_status ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2172
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
2173
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
2174
|
+
] }) : null
|
|
2175
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
2176
|
+
] }),
|
|
2177
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2178
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2179
|
+
"button",
|
|
2180
|
+
{
|
|
2181
|
+
type: "button",
|
|
2182
|
+
className: "flex w-full items-center justify-between text-left",
|
|
2183
|
+
onClick: () => setGatewayExpanded((prev) => !prev),
|
|
2184
|
+
"aria-expanded": gatewayExpanded,
|
|
2185
|
+
"aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
|
|
2186
|
+
children: [
|
|
2187
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
|
|
2188
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
|
|
2189
|
+
]
|
|
2190
|
+
}
|
|
2191
|
+
),
|
|
2192
|
+
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." }) })
|
|
2193
|
+
] })
|
|
2194
|
+
] }) : null
|
|
2195
|
+
] }) });
|
|
2196
|
+
};
|
|
2197
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
2198
|
+
label: "Refund details",
|
|
2199
|
+
icon: icons.Receipt
|
|
2020
2200
|
});
|
|
2021
|
-
const getStatusBadgeClass$
|
|
2201
|
+
const getStatusBadgeClass$1 = (status) => {
|
|
2022
2202
|
const statusLower = status.toLowerCase();
|
|
2023
2203
|
if (statusLower === "requested") {
|
|
2024
2204
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -2044,7 +2224,6 @@ const getStatusBadgeClass$2 = (status) => {
|
|
|
2044
2224
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2045
2225
|
};
|
|
2046
2226
|
const ReturnDetailPage = () => {
|
|
2047
|
-
var _a, _b, _c;
|
|
2048
2227
|
const navigate = reactRouterDom.useNavigate();
|
|
2049
2228
|
const { id } = reactRouterDom.useParams();
|
|
2050
2229
|
const [returnOrder, setReturnOrder] = react.useState(null);
|
|
@@ -2127,7 +2306,7 @@ const ReturnDetailPage = () => {
|
|
|
2127
2306
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => navigate("/returns"), children: "Back to list" }) })
|
|
2128
2307
|
] }) }) });
|
|
2129
2308
|
}
|
|
2130
|
-
const statusHistory =
|
|
2309
|
+
const statusHistory = returnOrder.metadata?.status_history || [];
|
|
2131
2310
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: [
|
|
2132
2311
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3", children: [
|
|
2133
2312
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2152,7 +2331,7 @@ const ReturnDetailPage = () => {
|
|
|
2152
2331
|
ui.Badge,
|
|
2153
2332
|
{
|
|
2154
2333
|
size: "small",
|
|
2155
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2334
|
+
className: `uppercase ${getStatusBadgeClass$1(returnOrder.status)}`,
|
|
2156
2335
|
children: returnOrder.status.replace(/_/g, " ")
|
|
2157
2336
|
}
|
|
2158
2337
|
)
|
|
@@ -2235,7 +2414,7 @@ const ReturnDetailPage = () => {
|
|
|
2235
2414
|
ui.Badge,
|
|
2236
2415
|
{
|
|
2237
2416
|
size: "2xsmall",
|
|
2238
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2417
|
+
className: `uppercase ${getStatusBadgeClass$1(entry.status)}`,
|
|
2239
2418
|
children: entry.status.replace(/_/g, " ")
|
|
2240
2419
|
}
|
|
2241
2420
|
) }),
|
|
@@ -2263,11 +2442,11 @@ const ReturnDetailPage = () => {
|
|
|
2263
2442
|
] }),
|
|
2264
2443
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2265
2444
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
2266
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
2445
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.customer?.email || returnOrder.order.email || "—" })
|
|
2267
2446
|
] }),
|
|
2268
2447
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2269
2448
|
/* @__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:
|
|
2449
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.order_payment?.label || "—" })
|
|
2271
2450
|
] }),
|
|
2272
2451
|
returnOrder.order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2273
2452
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
@@ -2297,202 +2476,10 @@ const ReturnDetailPage = () => {
|
|
|
2297
2476
|
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" }) })
|
|
2298
2477
|
] }) });
|
|
2299
2478
|
};
|
|
2300
|
-
const config$
|
|
2479
|
+
const config$1 = adminSdk.defineRouteConfig({
|
|
2301
2480
|
label: "Return Order Details",
|
|
2302
2481
|
icon: icons.CheckCircle
|
|
2303
2482
|
});
|
|
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
2483
|
const getStatusBadgeClass = (status) => {
|
|
2497
2484
|
const statusLower = status.toLowerCase();
|
|
2498
2485
|
if (statusLower === "requested") {
|
|
@@ -2516,13 +2503,12 @@ const getStatusBadgeClass = (status) => {
|
|
|
2516
2503
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2517
2504
|
};
|
|
2518
2505
|
const SwapDetailPage = () => {
|
|
2519
|
-
var _a, _b, _c;
|
|
2520
2506
|
const navigate = reactRouterDom.useNavigate();
|
|
2521
2507
|
const { id } = reactRouterDom.useParams();
|
|
2522
2508
|
const [swap, setSwap] = react.useState(null);
|
|
2523
2509
|
const [order, setOrder] = react.useState(null);
|
|
2524
2510
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
2525
|
-
react.useState(false);
|
|
2511
|
+
const [isRejecting, setIsRejecting] = react.useState(false);
|
|
2526
2512
|
const [isCancelling, setIsCancelling] = react.useState(false);
|
|
2527
2513
|
const [error, setError] = react.useState(null);
|
|
2528
2514
|
const [updateError, setUpdateError] = react.useState(null);
|
|
@@ -2593,9 +2579,9 @@ const SwapDetailPage = () => {
|
|
|
2593
2579
|
setIsCancelling(false);
|
|
2594
2580
|
}
|
|
2595
2581
|
};
|
|
2596
|
-
const isOrderExchange = Boolean(swap
|
|
2582
|
+
const isOrderExchange = Boolean(swap?.exchange_id);
|
|
2597
2583
|
const canCancelExchange = isOrderExchange && swap && !["cancelled", "canceled", "completed", "declined"].includes(
|
|
2598
|
-
|
|
2584
|
+
swap.status?.toLowerCase() ?? ""
|
|
2599
2585
|
);
|
|
2600
2586
|
if (isLoading) {
|
|
2601
2587
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading swap..." }) }) }) });
|
|
@@ -2606,7 +2592,7 @@ const SwapDetailPage = () => {
|
|
|
2606
2592
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => navigate("/swaps"), children: "Back to list" }) })
|
|
2607
2593
|
] }) }) });
|
|
2608
2594
|
}
|
|
2609
|
-
const statusHistory =
|
|
2595
|
+
const statusHistory = swap.metadata?.status_history || [];
|
|
2610
2596
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: [
|
|
2611
2597
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3", children: [
|
|
2612
2598
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2727,7 +2713,7 @@ const SwapDetailPage = () => {
|
|
|
2727
2713
|
] }),
|
|
2728
2714
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2729
2715
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
2730
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
2716
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.customer?.email || order.email || "—" })
|
|
2731
2717
|
] }),
|
|
2732
2718
|
order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2733
2719
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
@@ -2776,98 +2762,124 @@ const i18nTranslations0 = {};
|
|
|
2776
2762
|
const widgetModule = { widgets: [
|
|
2777
2763
|
{
|
|
2778
2764
|
Component: OrderGiftItemsWidget,
|
|
2779
|
-
zone: ["order.details.side.after"]
|
|
2765
|
+
zone: ["order.details.side.after"],
|
|
2766
|
+
widgetId: "Widget-b753"
|
|
2780
2767
|
},
|
|
2781
2768
|
{
|
|
2782
2769
|
Component: OrderRefundContextWidget,
|
|
2783
|
-
zone: ["order.details.after"]
|
|
2770
|
+
zone: ["order.details.after"],
|
|
2771
|
+
widgetId: "Widget-0606"
|
|
2784
2772
|
}
|
|
2785
2773
|
] };
|
|
2786
2774
|
const routeModule = {
|
|
2787
2775
|
routes: [
|
|
2788
2776
|
{
|
|
2789
2777
|
Component: PaymentsPage,
|
|
2790
|
-
path: "/payments"
|
|
2778
|
+
path: "/payments",
|
|
2779
|
+
handle: { label: config$7.label, translationNs: config$7.translationNs }
|
|
2791
2780
|
},
|
|
2792
2781
|
{
|
|
2793
|
-
Component:
|
|
2794
|
-
path: "/
|
|
2782
|
+
Component: RefundsPage,
|
|
2783
|
+
path: "/refunds",
|
|
2784
|
+
handle: { label: config$6.label, translationNs: config$6.translationNs }
|
|
2795
2785
|
},
|
|
2796
2786
|
{
|
|
2797
|
-
Component:
|
|
2798
|
-
path: "/
|
|
2787
|
+
Component: ReturnsPage,
|
|
2788
|
+
path: "/returns",
|
|
2789
|
+
handle: { label: config$5.label, translationNs: config$5.translationNs }
|
|
2799
2790
|
},
|
|
2800
2791
|
{
|
|
2801
2792
|
Component: SwapsPage,
|
|
2802
|
-
path: "/swaps"
|
|
2793
|
+
path: "/swaps",
|
|
2794
|
+
handle: { label: config$4.label, translationNs: config$4.translationNs }
|
|
2803
2795
|
},
|
|
2804
2796
|
{
|
|
2805
2797
|
Component: PaymentDetailPage,
|
|
2806
|
-
path: "/payments/:id"
|
|
2798
|
+
path: "/payments/:id",
|
|
2799
|
+
handle: { label: config$3.label, translationNs: config$3.translationNs }
|
|
2807
2800
|
},
|
|
2808
2801
|
{
|
|
2809
|
-
Component:
|
|
2810
|
-
path: "/
|
|
2802
|
+
Component: RefundDetailPage,
|
|
2803
|
+
path: "/refunds/:id",
|
|
2804
|
+
handle: { label: config$2.label, translationNs: config$2.translationNs }
|
|
2811
2805
|
},
|
|
2812
2806
|
{
|
|
2813
|
-
Component:
|
|
2814
|
-
path: "/
|
|
2807
|
+
Component: ReturnDetailPage,
|
|
2808
|
+
path: "/returns/:id",
|
|
2809
|
+
handle: { label: config$1.label, translationNs: config$1.translationNs }
|
|
2815
2810
|
},
|
|
2816
2811
|
{
|
|
2817
2812
|
Component: SwapDetailPage,
|
|
2818
|
-
path: "/swaps/:id"
|
|
2813
|
+
path: "/swaps/:id",
|
|
2814
|
+
handle: { label: config.label, translationNs: config.translationNs }
|
|
2819
2815
|
}
|
|
2820
2816
|
]
|
|
2821
2817
|
};
|
|
2822
2818
|
const menuItemModule = {
|
|
2823
2819
|
menuItems: [
|
|
2820
|
+
{
|
|
2821
|
+
label: config$7.label,
|
|
2822
|
+
icon: config$7.icon,
|
|
2823
|
+
path: "/payments",
|
|
2824
|
+
nested: void 0,
|
|
2825
|
+
rank: void 0,
|
|
2826
|
+
translationNs: void 0
|
|
2827
|
+
},
|
|
2824
2828
|
{
|
|
2825
2829
|
label: config$6.label,
|
|
2826
2830
|
icon: config$6.icon,
|
|
2831
|
+
path: "/refunds",
|
|
2832
|
+
nested: void 0,
|
|
2833
|
+
rank: void 0,
|
|
2834
|
+
translationNs: void 0
|
|
2835
|
+
},
|
|
2836
|
+
{
|
|
2837
|
+
label: config$5.label,
|
|
2838
|
+
icon: config$5.icon,
|
|
2827
2839
|
path: "/returns",
|
|
2828
|
-
nested: void 0
|
|
2840
|
+
nested: void 0,
|
|
2841
|
+
rank: void 0,
|
|
2842
|
+
translationNs: void 0
|
|
2829
2843
|
},
|
|
2830
2844
|
{
|
|
2831
2845
|
label: config$4.label,
|
|
2832
2846
|
icon: config$4.icon,
|
|
2833
2847
|
path: "/swaps",
|
|
2834
|
-
nested: void 0
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
label: config$7.label,
|
|
2838
|
-
icon: config$7.icon,
|
|
2839
|
-
path: "/payments",
|
|
2840
|
-
nested: void 0
|
|
2848
|
+
nested: void 0,
|
|
2849
|
+
rank: void 0,
|
|
2850
|
+
translationNs: void 0
|
|
2841
2851
|
},
|
|
2842
2852
|
{
|
|
2843
|
-
label: config$
|
|
2844
|
-
icon: config$
|
|
2845
|
-
path: "/
|
|
2846
|
-
nested: void 0
|
|
2853
|
+
label: config$3.label,
|
|
2854
|
+
icon: config$3.icon,
|
|
2855
|
+
path: "/payments/:id",
|
|
2856
|
+
nested: void 0,
|
|
2857
|
+
rank: void 0,
|
|
2858
|
+
translationNs: void 0
|
|
2847
2859
|
},
|
|
2848
2860
|
{
|
|
2849
2861
|
label: config$2.label,
|
|
2850
2862
|
icon: config$2.icon,
|
|
2863
|
+
path: "/refunds/:id",
|
|
2864
|
+
nested: void 0,
|
|
2865
|
+
rank: void 0,
|
|
2866
|
+
translationNs: void 0
|
|
2867
|
+
},
|
|
2868
|
+
{
|
|
2869
|
+
label: config$1.label,
|
|
2870
|
+
icon: config$1.icon,
|
|
2851
2871
|
path: "/returns/:id",
|
|
2852
|
-
nested: void 0
|
|
2872
|
+
nested: void 0,
|
|
2873
|
+
rank: void 0,
|
|
2874
|
+
translationNs: void 0
|
|
2853
2875
|
},
|
|
2854
2876
|
{
|
|
2855
2877
|
label: config.label,
|
|
2856
2878
|
icon: config.icon,
|
|
2857
2879
|
path: "/swaps/:id",
|
|
2858
|
-
nested: void 0
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
label: config$3.label,
|
|
2862
|
-
icon: config$3.icon,
|
|
2863
|
-
path: "/payments/:id",
|
|
2864
|
-
nested: void 0
|
|
2865
|
-
},
|
|
2866
|
-
{
|
|
2867
|
-
label: config$1.label,
|
|
2868
|
-
icon: config$1.icon,
|
|
2869
|
-
path: "/refunds/:id",
|
|
2870
|
-
nested: void 0
|
|
2880
|
+
nested: void 0,
|
|
2881
|
+
rank: void 0,
|
|
2882
|
+
translationNs: void 0
|
|
2871
2883
|
}
|
|
2872
2884
|
]
|
|
2873
2885
|
};
|
|
@@ -2876,12 +2888,18 @@ const displayModule = {
|
|
|
2876
2888
|
displays: {}
|
|
2877
2889
|
};
|
|
2878
2890
|
const i18nModule = { resources: i18nTranslations0 };
|
|
2891
|
+
const cellRendererModule = {};
|
|
2892
|
+
const layoutModule = { layouts: [] };
|
|
2893
|
+
const searchEntityModule = {};
|
|
2879
2894
|
const plugin = {
|
|
2880
2895
|
widgetModule,
|
|
2881
2896
|
routeModule,
|
|
2882
2897
|
menuItemModule,
|
|
2883
2898
|
formModule,
|
|
2884
2899
|
displayModule,
|
|
2885
|
-
i18nModule
|
|
2900
|
+
i18nModule,
|
|
2901
|
+
cellRendererModule,
|
|
2902
|
+
layoutModule,
|
|
2903
|
+
searchEntityModule
|
|
2886
2904
|
};
|
|
2887
2905
|
module.exports = plugin;
|