order-management 0.0.97 → 0.0.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.medusa/server/src/admin/index.js +674 -684
- package/.medusa/server/src/admin/index.mjs +675 -685
- package/.medusa/server/src/utils/notification-handler.js +38 -11
- package/README.md +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1
4
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
5
|
import { defineWidgetConfig, defineRouteConfig } from "@medusajs/admin-sdk";
|
|
3
6
|
import { useState, useEffect, useRef, useMemo, useCallback } from "react";
|
|
4
7
|
import { Text, Container, Heading, Badge, Button, Label, Select, Textarea, Popover, clx, Input, Copy, Skeleton, Tooltip, toast } from "@medusajs/ui";
|
|
5
|
-
import { CashSolid, PencilSquareSolid, Trash, ChevronDownMini, Check, ArrowPath, InformationCircle,
|
|
8
|
+
import { CashSolid, PencilSquareSolid, Trash, ChevronDownMini, Check, ArrowPath, InformationCircle, ChevronRightMini, MagnifierAlert, ExclamationCircle, CreditCard, Receipt, ArrowLeft, ClockSolid, SquareTwoStack, ShieldCheck, CheckCircle } from "@medusajs/icons";
|
|
6
9
|
import { useNavigate, useLocation, useSearchParams, useParams } from "react-router-dom";
|
|
7
10
|
function roundRectPath(ctx, x, y, w, h, r) {
|
|
8
11
|
ctx.beginPath();
|
|
@@ -374,14 +377,15 @@ const s = {
|
|
|
374
377
|
const OrderGiftItemsWidget = ({ data }) => {
|
|
375
378
|
const [fetchedItems, setFetchedItems] = useState(null);
|
|
376
379
|
useEffect(() => {
|
|
377
|
-
if (!data
|
|
380
|
+
if (!(data == null ? void 0 : data.id)) return;
|
|
378
381
|
fetch(
|
|
379
382
|
`/admin/orders/${data.id}?fields=*items,items.metadata`
|
|
380
|
-
).then((r) => r.json()).then(({ order }) => setFetchedItems(order
|
|
381
|
-
}, [data
|
|
382
|
-
const items = fetchedItems ?? data
|
|
383
|
+
).then((r) => r.json()).then(({ order }) => setFetchedItems((order == null ? void 0 : order.items) ?? [])).catch(() => setFetchedItems((data == null ? void 0 : data.items) ?? []));
|
|
384
|
+
}, [data == null ? void 0 : data.id]);
|
|
385
|
+
const items = fetchedItems ?? (data == null ? void 0 : data.items) ?? [];
|
|
383
386
|
const giftedItems = items.filter((i) => {
|
|
384
|
-
|
|
387
|
+
var _a;
|
|
388
|
+
const flag = (_a = i.metadata) == null ? void 0 : _a.is_gift;
|
|
385
389
|
return flag === "true" || flag === true;
|
|
386
390
|
});
|
|
387
391
|
return /* @__PURE__ */ jsxs("div", { style: s.widget, children: [
|
|
@@ -410,9 +414,9 @@ const OrderGiftItemsWidget = ({ data }) => {
|
|
|
410
414
|
),
|
|
411
415
|
giftedItems.map((item) => {
|
|
412
416
|
const meta = item.metadata;
|
|
413
|
-
const from = meta
|
|
414
|
-
const to = meta
|
|
415
|
-
const message = meta
|
|
417
|
+
const from = meta == null ? void 0 : meta.gift_from;
|
|
418
|
+
const to = meta == null ? void 0 : meta.gift_to;
|
|
419
|
+
const message = meta == null ? void 0 : meta.gift_message;
|
|
416
420
|
return /* @__PURE__ */ jsxs("div", { style: s.card, children: [
|
|
417
421
|
/* @__PURE__ */ jsxs("div", { style: s.ribbon, children: [
|
|
418
422
|
/* @__PURE__ */ jsx("span", { style: s.bowCenter, children: "🎀" }),
|
|
@@ -476,7 +480,7 @@ function formatRefundCurrency(amount, currencyCode = "inr", options) {
|
|
|
476
480
|
minimumFractionDigits: 2,
|
|
477
481
|
maximumFractionDigits: 2
|
|
478
482
|
}).format(amount);
|
|
479
|
-
if (options
|
|
483
|
+
if ((options == null ? void 0 : options.signed) && amount > 0) {
|
|
480
484
|
return `−${formatted}`;
|
|
481
485
|
}
|
|
482
486
|
return formatted;
|
|
@@ -531,7 +535,8 @@ function getOrderIdFromPath() {
|
|
|
531
535
|
return m ? m[1] : void 0;
|
|
532
536
|
}
|
|
533
537
|
const OrderRefundContextWidget = (props) => {
|
|
534
|
-
|
|
538
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
539
|
+
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
540
|
const [context, setContext] = useState(null);
|
|
536
541
|
const [loading, setLoading] = useState(!!orderId);
|
|
537
542
|
const [error, setError] = useState(null);
|
|
@@ -569,7 +574,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
569
574
|
};
|
|
570
575
|
}, [orderId]);
|
|
571
576
|
const handleMarkRefunded = async () => {
|
|
572
|
-
if (!context
|
|
577
|
+
if (!(context == null ? void 0 : context.return_id) || !(context == null ? void 0 : context.refund_mapping) || context.refund_mapping.is_refunded || !context.can_process_refund) {
|
|
573
578
|
return;
|
|
574
579
|
}
|
|
575
580
|
setMarking(true);
|
|
@@ -586,14 +591,17 @@ const OrderRefundContextWidget = (props) => {
|
|
|
586
591
|
}
|
|
587
592
|
const data = await res.json();
|
|
588
593
|
setContext(
|
|
589
|
-
(prev) =>
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
594
|
+
(prev) => {
|
|
595
|
+
var _a2;
|
|
596
|
+
return prev && prev.refund_mapping ? {
|
|
597
|
+
...prev,
|
|
598
|
+
can_process_refund: false,
|
|
599
|
+
refund_mapping: {
|
|
600
|
+
...prev.refund_mapping,
|
|
601
|
+
is_refunded: ((_a2 = data.refund_payment_mapping) == null ? void 0 : _a2.is_refunded) ?? true
|
|
602
|
+
}
|
|
603
|
+
} : prev;
|
|
604
|
+
}
|
|
597
605
|
);
|
|
598
606
|
} catch (e) {
|
|
599
607
|
setMarkError(e instanceof Error ? e.message : "Failed to mark refunded");
|
|
@@ -602,19 +610,20 @@ const OrderRefundContextWidget = (props) => {
|
|
|
602
610
|
}
|
|
603
611
|
};
|
|
604
612
|
const handleEditClick = () => {
|
|
605
|
-
const mapping = context
|
|
606
|
-
const mode = mapping
|
|
613
|
+
const mapping = context == null ? void 0 : context.refund_mapping;
|
|
614
|
+
const mode = mapping == null ? void 0 : mapping.refund_mode;
|
|
607
615
|
setEditRefundMode(
|
|
608
616
|
mode === "offline" || mode === "online" ? mode : ""
|
|
609
617
|
);
|
|
610
|
-
setEditDetails(mapping
|
|
611
|
-
setEditImageUrls(mapping
|
|
618
|
+
setEditDetails((mapping == null ? void 0 : mapping.details) ?? "");
|
|
619
|
+
setEditImageUrls((mapping == null ? void 0 : mapping.images) ?? []);
|
|
612
620
|
setSaveError(null);
|
|
613
621
|
setUploadError(null);
|
|
614
622
|
setEditing(true);
|
|
615
623
|
};
|
|
616
624
|
const handleUploadImage = async (e) => {
|
|
617
|
-
|
|
625
|
+
var _a2, _b2, _c2;
|
|
626
|
+
const file = (_a2 = e.target.files) == null ? void 0 : _a2[0];
|
|
618
627
|
if (!file) return;
|
|
619
628
|
setUploading(true);
|
|
620
629
|
setUploadError(null);
|
|
@@ -631,7 +640,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
631
640
|
throw new Error(data2.message || "Upload failed");
|
|
632
641
|
}
|
|
633
642
|
const data = await res.json();
|
|
634
|
-
const url = data.files
|
|
643
|
+
const url = (_c2 = (_b2 = data.files) == null ? void 0 : _b2[0]) == null ? void 0 : _c2.url;
|
|
635
644
|
if (url) setEditImageUrls((prev) => [...prev, url]);
|
|
636
645
|
} catch (err) {
|
|
637
646
|
setUploadError(err instanceof Error ? err.message : "Upload failed");
|
|
@@ -644,7 +653,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
644
653
|
setEditImageUrls((prev) => prev.filter((_, i) => i !== index));
|
|
645
654
|
};
|
|
646
655
|
const handleSaveAdminFields = async () => {
|
|
647
|
-
if (!context
|
|
656
|
+
if (!(context == null ? void 0 : context.return_id)) return;
|
|
648
657
|
setSaving(true);
|
|
649
658
|
setSaveError(null);
|
|
650
659
|
try {
|
|
@@ -681,14 +690,14 @@ const OrderRefundContextWidget = (props) => {
|
|
|
681
690
|
if (error) {
|
|
682
691
|
return /* @__PURE__ */ jsx(Container, { className: "mt-6 divide-y p-0", children: /* @__PURE__ */ jsx("div", { className: "py-4", children: /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-error", children: error }) }) });
|
|
683
692
|
}
|
|
684
|
-
const hasReturn = !!context
|
|
685
|
-
const hasMapping = !!context
|
|
686
|
-
const canMarkRefunded = Boolean(context
|
|
687
|
-
const returnStatus = context
|
|
688
|
-
const showReceiveFirstHint = hasReturn && !context
|
|
689
|
-
const paymentDetail = context
|
|
690
|
-
const paymentDetails = context
|
|
691
|
-
const orderPayment = context
|
|
693
|
+
const hasReturn = !!(context == null ? void 0 : context.return_id);
|
|
694
|
+
const hasMapping = !!(context == null ? void 0 : context.refund_mapping);
|
|
695
|
+
const canMarkRefunded = Boolean(context == null ? void 0 : context.can_process_refund);
|
|
696
|
+
const returnStatus = (context == null ? void 0 : context.return_status) ?? null;
|
|
697
|
+
const showReceiveFirstHint = hasReturn && !((_d = context == null ? void 0 : context.refund_mapping) == null ? void 0 : _d.is_refunded) && returnStatus !== "received" && returnStatus !== "canceled";
|
|
698
|
+
const paymentDetail = context == null ? void 0 : context.payment_detail;
|
|
699
|
+
const paymentDetails = (context == null ? void 0 : context.payment_details) && context.payment_details.length > 0 ? context.payment_details : paymentDetail ? [paymentDetail] : [];
|
|
700
|
+
const orderPayment = context == null ? void 0 : context.order_payment;
|
|
692
701
|
return /* @__PURE__ */ jsx(Container, { className: "mt-6 divide-y p-0", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 py-4", children: [
|
|
693
702
|
/* @__PURE__ */ jsxs(Heading, { level: "h2", className: "flex items-center gap-2", children: [
|
|
694
703
|
/* @__PURE__ */ jsx(CashSolid, { className: "text-ui-fg-subtle" }),
|
|
@@ -700,7 +709,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
700
709
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
701
710
|
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Return" }),
|
|
702
711
|
/* @__PURE__ */ jsx(Text, { size: "small", children: context.return_id }),
|
|
703
|
-
context.refund_mapping
|
|
712
|
+
((_e = context.refund_mapping) == null ? void 0 : _e.is_refunded) ? /* @__PURE__ */ jsx(Badge, { color: "green", children: "Refunded" }) : /* @__PURE__ */ jsx(Badge, { color: "orange", children: "Not refunded" })
|
|
704
713
|
] }),
|
|
705
714
|
context.refund ? /* @__PURE__ */ jsx("div", { className: "mt-3 border-t border-ui-border-base pt-3", children: /* @__PURE__ */ jsx(RefundCalculationBlock, { refund: context.refund }) }) : null,
|
|
706
715
|
orderPayment && /* @__PURE__ */ jsxs("div", { className: "mt-3 space-y-2 border-t border-ui-border-base pt-3", children: [
|
|
@@ -714,17 +723,17 @@ const OrderRefundContextWidget = (props) => {
|
|
|
714
723
|
/* @__PURE__ */ jsxs("div", { className: "mt-3 space-y-2 border-t border-ui-border-base pt-3", children: [
|
|
715
724
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
716
725
|
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Payment method (refund destination)" }),
|
|
717
|
-
context.refund_mapping
|
|
726
|
+
((_f = context.refund_mapping) == null ? void 0 : _f.payment_id) ? /* @__PURE__ */ jsx(Badge, { color: "green", children: "Customer specified" }) : paymentDetail ? /* @__PURE__ */ jsx(Badge, { color: "orange", children: "Customer default" }) : orderPayment && !orderPayment.is_cod ? /* @__PURE__ */ jsx(Badge, { color: "blue", children: "Original payment method" }) : null
|
|
718
727
|
] }),
|
|
719
|
-
context.refund_mapping
|
|
720
|
-
!context.refund_mapping
|
|
721
|
-
!context.refund_mapping
|
|
728
|
+
((_g = context.refund_mapping) == null ? void 0 : _g.payment_id) && !paymentDetail && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-orange-200 bg-orange-50 px-3 py-2", children: /* @__PURE__ */ jsx(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." }) }),
|
|
729
|
+
!((_h = context.refund_mapping) == null ? void 0 : _h.payment_id) && (paymentDetail == null ? void 0 : paymentDetail.source) === "default" && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsx(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." }) }),
|
|
730
|
+
!((_i = context.refund_mapping) == null ? void 0 : _i.payment_id) && !paymentDetail && orderPayment && !orderPayment.is_cod && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsxs(Text, { size: "xsmall", className: "text-ui-fg-muted", children: [
|
|
722
731
|
"Refund will go to the original payment method (",
|
|
723
732
|
orderPayment.label,
|
|
724
733
|
")."
|
|
725
734
|
] }) }),
|
|
726
|
-
!context.refund_mapping
|
|
727
|
-
!context.refund_mapping
|
|
735
|
+
!((_j = context.refund_mapping) == null ? void 0 : _j.payment_id) && !paymentDetail && (context.is_cod || (orderPayment == null ? void 0 : orderPayment.is_cod)) && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsx(Text, { size: "xsmall", className: "text-ui-fg-muted", children: "This order was paid with Cash on Delivery. No stored bank/UPI refund destination." }) }),
|
|
736
|
+
!((_k = context.refund_mapping) == null ? void 0 : _k.payment_id) && !paymentDetail && !orderPayment && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-ui-border-base bg-ui-bg-subtle px-3 py-2", children: /* @__PURE__ */ jsx(Text, { size: "xsmall", className: "text-ui-fg-muted", children: "No payment method found for this customer." }) }),
|
|
728
737
|
paymentDetails.length > 0 && /* @__PURE__ */ jsx("div", { className: "space-y-3", children: paymentDetails.map((detail) => /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
729
738
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
730
739
|
/* @__PURE__ */ jsx(Badge, { children: detail.type.toUpperCase() }),
|
|
@@ -736,7 +745,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
736
745
|
] }, `${detail.id}-${k}`)) })
|
|
737
746
|
] }, detail.id)) })
|
|
738
747
|
] }),
|
|
739
|
-
context
|
|
748
|
+
(context == null ? void 0 : context.refund_mapping) && /* @__PURE__ */ jsxs("div", { className: "mt-3 space-y-3 border-t border-ui-border-base pt-3", children: [
|
|
740
749
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
741
750
|
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Refund mode, details & images" }),
|
|
742
751
|
!editing ? /* @__PURE__ */ jsxs(
|
|
@@ -824,7 +833,10 @@ const OrderRefundContextWidget = (props) => {
|
|
|
824
833
|
variant: "secondary",
|
|
825
834
|
type: "button",
|
|
826
835
|
disabled: uploading,
|
|
827
|
-
onClick: () =>
|
|
836
|
+
onClick: () => {
|
|
837
|
+
var _a2;
|
|
838
|
+
return (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
839
|
+
},
|
|
828
840
|
children: uploading ? "Uploading…" : "Upload image"
|
|
829
841
|
}
|
|
830
842
|
),
|
|
@@ -875,7 +887,7 @@ const OrderRefundContextWidget = (props) => {
|
|
|
875
887
|
] }),
|
|
876
888
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
877
889
|
/* @__PURE__ */ jsx(Text, { size: "xsmall", weight: "plus", className: "text-ui-fg-muted", children: "Images" }),
|
|
878
|
-
context.refund_mapping.images
|
|
890
|
+
((_l = context.refund_mapping.images) == null ? void 0 : _l.length) ? /* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-wrap gap-2", children: context.refund_mapping.images.map((url, i) => /* @__PURE__ */ jsxs(
|
|
879
891
|
"a",
|
|
880
892
|
{
|
|
881
893
|
href: url,
|
|
@@ -905,10 +917,10 @@ const OrderRefundContextWidget = (props) => {
|
|
|
905
917
|
),
|
|
906
918
|
markError && /* @__PURE__ */ jsx(Text, { size: "small", className: "mt-2 text-ui-fg-error", children: markError })
|
|
907
919
|
] }),
|
|
908
|
-
hasMapping && !canMarkRefunded && !context.refund_mapping
|
|
920
|
+
hasMapping && !canMarkRefunded && !((_m = context.refund_mapping) == null ? void 0 : _m.is_refunded) && showReceiveFirstHint && /* @__PURE__ */ jsx(Text, { size: "small", className: "mt-4 text-ui-fg-muted", children: "Mark refunded is available after the return is received." })
|
|
909
921
|
] }),
|
|
910
922
|
hasReturn && !hasMapping && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-4", children: [
|
|
911
|
-
context
|
|
923
|
+
(context == null ? void 0 : context.refund) ? /* @__PURE__ */ jsx(RefundCalculationBlock, { refund: context.refund }) : null,
|
|
912
924
|
orderPayment && /* @__PURE__ */ jsxs("div", { className: "mb-3 space-y-1", children: [
|
|
913
925
|
/* @__PURE__ */ jsx(Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Order payment method" }),
|
|
914
926
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
@@ -1346,7 +1358,7 @@ function getEntityInfo(tableName) {
|
|
|
1346
1358
|
const def = ENTITY_DEFINITIONS[tableName];
|
|
1347
1359
|
return {
|
|
1348
1360
|
tableName,
|
|
1349
|
-
label: def
|
|
1361
|
+
label: (def == null ? void 0 : def.label) ?? humanizeTableName(tableName),
|
|
1350
1362
|
category: def && CATEGORY_BY_ID.get(def.category) || SYSTEM_CATEGORY
|
|
1351
1363
|
};
|
|
1352
1364
|
}
|
|
@@ -1371,11 +1383,13 @@ function getTablesForCategory(id) {
|
|
|
1371
1383
|
}
|
|
1372
1384
|
const GROUPS = getEntitiesByCategory();
|
|
1373
1385
|
function triggerLabel(entity, category) {
|
|
1386
|
+
var _a;
|
|
1374
1387
|
if (entity) return getEntityInfo(entity).label;
|
|
1375
|
-
if (category) return `All ${getCategory(category)
|
|
1388
|
+
if (category) return `All ${((_a = getCategory(category)) == null ? void 0 : _a.label) ?? category}`;
|
|
1376
1389
|
return "All entities";
|
|
1377
1390
|
}
|
|
1378
1391
|
const EntityPicker = ({ entity, category, onChange }) => {
|
|
1392
|
+
var _a;
|
|
1379
1393
|
const [open, setOpen] = useState(false);
|
|
1380
1394
|
const [search, setSearch] = useState("");
|
|
1381
1395
|
const searchRef = useRef(null);
|
|
@@ -1395,7 +1409,7 @@ const EntityPicker = ({ entity, category, onChange }) => {
|
|
|
1395
1409
|
setOpen(false);
|
|
1396
1410
|
setSearch("");
|
|
1397
1411
|
};
|
|
1398
|
-
const firstMatch = filteredGroups[0]
|
|
1412
|
+
const firstMatch = (_a = filteredGroups[0]) == null ? void 0 : _a.entities[0];
|
|
1399
1413
|
const isAll = !entity && !category;
|
|
1400
1414
|
return /* @__PURE__ */ jsxs(
|
|
1401
1415
|
Popover,
|
|
@@ -1428,8 +1442,9 @@ const EntityPicker = ({ entity, category, onChange }) => {
|
|
|
1428
1442
|
align: "start",
|
|
1429
1443
|
className: "w-[min(360px,calc(100vw-2rem))] p-0",
|
|
1430
1444
|
onOpenAutoFocus: (event) => {
|
|
1445
|
+
var _a2;
|
|
1431
1446
|
event.preventDefault();
|
|
1432
|
-
searchRef.current
|
|
1447
|
+
(_a2 = searchRef.current) == null ? void 0 : _a2.focus();
|
|
1433
1448
|
},
|
|
1434
1449
|
children: [
|
|
1435
1450
|
/* @__PURE__ */ jsx("div", { className: "border-b border-ui-border-base p-2", children: /* @__PURE__ */ jsx(
|
|
@@ -1569,7 +1584,7 @@ function formatNumber(value) {
|
|
|
1569
1584
|
return new Intl.NumberFormat().format(value);
|
|
1570
1585
|
}
|
|
1571
1586
|
function formatMoney(amount, currencyCode) {
|
|
1572
|
-
const code = currencyCode
|
|
1587
|
+
const code = currencyCode == null ? void 0 : currencyCode.trim().toUpperCase();
|
|
1573
1588
|
if (code && /^[A-Z]{3}$/.test(code)) {
|
|
1574
1589
|
try {
|
|
1575
1590
|
return new Intl.NumberFormat(void 0, { style: "currency", currency: code }).format(amount);
|
|
@@ -1636,9 +1651,9 @@ const SummaryCards = ({ stats, loading, failed }) => {
|
|
|
1636
1651
|
};
|
|
1637
1652
|
const BASE = "/admin/deleted-records-audit";
|
|
1638
1653
|
class AuditApiError extends Error {
|
|
1639
|
-
status;
|
|
1640
1654
|
constructor(message, status) {
|
|
1641
1655
|
super(message);
|
|
1656
|
+
__publicField(this, "status");
|
|
1642
1657
|
this.status = status;
|
|
1643
1658
|
}
|
|
1644
1659
|
}
|
|
@@ -1703,7 +1718,10 @@ const URL_KEYS = {
|
|
|
1703
1718
|
const DATE_PRESET_VALUES = new Set(DATE_PRESETS.map((p) => p.value));
|
|
1704
1719
|
const DAY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
1705
1720
|
function filtersFromSearchParams(params) {
|
|
1706
|
-
const read = (key) =>
|
|
1721
|
+
const read = (key) => {
|
|
1722
|
+
var _a;
|
|
1723
|
+
return ((_a = params.get(URL_KEYS[key])) == null ? void 0 : _a.trim()) ?? "";
|
|
1724
|
+
};
|
|
1707
1725
|
const date = read("date");
|
|
1708
1726
|
const from = read("from");
|
|
1709
1727
|
const to = read("to");
|
|
@@ -1857,9 +1875,9 @@ const DeletedRecordsPage = () => {
|
|
|
1857
1875
|
try {
|
|
1858
1876
|
setStats(await fetchAuditStats(signal));
|
|
1859
1877
|
} catch (e) {
|
|
1860
|
-
if (!signal
|
|
1878
|
+
if (!(signal == null ? void 0 : signal.aborted)) setStatsFailed(true);
|
|
1861
1879
|
} finally {
|
|
1862
|
-
if (!signal
|
|
1880
|
+
if (!(signal == null ? void 0 : signal.aborted)) setStatsLoading(false);
|
|
1863
1881
|
}
|
|
1864
1882
|
}, []);
|
|
1865
1883
|
useEffect(() => {
|
|
@@ -1916,7 +1934,7 @@ const DeletedRecordsPage = () => {
|
|
|
1916
1934
|
const visible = Array.from(document.querySelectorAll(`[data-audit-row="${lastViewed}"]`)).find(
|
|
1917
1935
|
(el) => el.offsetParent !== null
|
|
1918
1936
|
);
|
|
1919
|
-
visible
|
|
1937
|
+
visible == null ? void 0 : visible.scrollIntoView({ block: "center" });
|
|
1920
1938
|
});
|
|
1921
1939
|
const handle = setTimeout(() => setHighlightId(null), 2500);
|
|
1922
1940
|
return () => clearTimeout(handle);
|
|
@@ -1943,8 +1961,8 @@ const DeletedRecordsPage = () => {
|
|
|
1943
1961
|
};
|
|
1944
1962
|
const refresh = () => setReloadToken((t) => t + 1);
|
|
1945
1963
|
const hasMore = items.length < count;
|
|
1946
|
-
const knownSources = stats
|
|
1947
|
-
const knownDeletedBy = stats
|
|
1964
|
+
const knownSources = (stats == null ? void 0 : stats.sources) ?? [];
|
|
1965
|
+
const knownDeletedBy = (stats == null ? void 0 : stats.deleted_by) ?? [];
|
|
1948
1966
|
const attributionMissing = !!stats && stats.total > 0 && knownSources.length === 0 && knownDeletedBy.length === 0;
|
|
1949
1967
|
return /* @__PURE__ */ jsx("div", { className: "w-full p-3 md:p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-7xl flex-col gap-6 p-4 md:p-6", children: [
|
|
1950
1968
|
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-start md:justify-between", children: [
|
|
@@ -2208,7 +2226,7 @@ const ErrorState = ({ onRetry, detail }) => /* @__PURE__ */ jsxs("div", { classN
|
|
|
2208
2226
|
/* @__PURE__ */ jsx(Text, { size: "xsmall", className: "max-w-md font-mono text-ui-fg-muted", children: detail }),
|
|
2209
2227
|
/* @__PURE__ */ jsx(Button, { variant: "secondary", size: "small", className: "mt-2", onClick: onRetry, children: "Try again" })
|
|
2210
2228
|
] });
|
|
2211
|
-
const config$
|
|
2229
|
+
const config$8 = defineRouteConfig({
|
|
2212
2230
|
label: "Deleted Records",
|
|
2213
2231
|
icon: Trash
|
|
2214
2232
|
});
|
|
@@ -2228,16 +2246,216 @@ const getStatusBadgeClass$7 = (status) => {
|
|
|
2228
2246
|
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2229
2247
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2230
2248
|
};
|
|
2231
|
-
const
|
|
2249
|
+
const PaymentsPage = () => {
|
|
2232
2250
|
const navigate = useNavigate();
|
|
2233
2251
|
const [items, setItems] = useState([]);
|
|
2252
|
+
const [statusFilter, setStatusFilter] = useState("all");
|
|
2234
2253
|
const [orderIdSearch, setOrderIdSearch] = useState("");
|
|
2235
2254
|
const debouncedOrderId = useDebounce$3(orderIdSearch, 300);
|
|
2255
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
2256
|
+
const [isFetchingMore, setIsFetchingMore] = useState(false);
|
|
2257
|
+
const [error, setError] = useState(null);
|
|
2258
|
+
const [offset, setOffset] = useState(0);
|
|
2259
|
+
const [count, setCount] = useState(0);
|
|
2260
|
+
const limit = 50;
|
|
2261
|
+
const loadTransactions = useCallback(
|
|
2262
|
+
async (nextOffset, replace) => {
|
|
2263
|
+
try {
|
|
2264
|
+
if (replace) setIsLoading(true);
|
|
2265
|
+
else setIsFetchingMore(true);
|
|
2266
|
+
setError(null);
|
|
2267
|
+
const params = new URLSearchParams();
|
|
2268
|
+
params.set("limit", String(limit));
|
|
2269
|
+
params.set("offset", String(nextOffset));
|
|
2270
|
+
if (statusFilter !== "all") params.set("status", statusFilter);
|
|
2271
|
+
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
2272
|
+
const response = await fetch(
|
|
2273
|
+
`/admin/payment-transactions?${params.toString()}`,
|
|
2274
|
+
{ credentials: "include" }
|
|
2275
|
+
);
|
|
2276
|
+
if (!response.ok) {
|
|
2277
|
+
const text = await response.text();
|
|
2278
|
+
throw new Error(text || "Failed to load payment transactions");
|
|
2279
|
+
}
|
|
2280
|
+
const payload = await response.json();
|
|
2281
|
+
const list = payload.transactions ?? [];
|
|
2282
|
+
setCount(payload.count ?? 0);
|
|
2283
|
+
setOffset(nextOffset + list.length);
|
|
2284
|
+
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
2285
|
+
} catch (e) {
|
|
2286
|
+
setError(e instanceof Error ? e.message : "Failed to load");
|
|
2287
|
+
} finally {
|
|
2288
|
+
setIsLoading(false);
|
|
2289
|
+
setIsFetchingMore(false);
|
|
2290
|
+
}
|
|
2291
|
+
},
|
|
2292
|
+
[statusFilter, debouncedOrderId]
|
|
2293
|
+
);
|
|
2294
|
+
useEffect(() => {
|
|
2295
|
+
void loadTransactions(0, true);
|
|
2296
|
+
}, [loadTransactions]);
|
|
2297
|
+
const hasMore = useMemo(() => offset < count, [offset, count]);
|
|
2298
|
+
const displayStatus = (t) => {
|
|
2299
|
+
const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
|
|
2300
|
+
return s2 !== "" ? s2 : "—";
|
|
2301
|
+
};
|
|
2302
|
+
const displayAmount = (t) => {
|
|
2303
|
+
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
2304
|
+
return `${code} ${Number(t.amount)}`;
|
|
2305
|
+
};
|
|
2306
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-7xl flex-col gap-6 p-6", children: [
|
|
2307
|
+
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
2308
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2309
|
+
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Payments" }),
|
|
2310
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
|
|
2311
|
+
] }),
|
|
2312
|
+
/* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
|
|
2313
|
+
] }),
|
|
2314
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
2315
|
+
/* @__PURE__ */ jsx(
|
|
2316
|
+
Input,
|
|
2317
|
+
{
|
|
2318
|
+
placeholder: "Search by Order ID",
|
|
2319
|
+
value: orderIdSearch,
|
|
2320
|
+
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
2321
|
+
className: "md:max-w-sm",
|
|
2322
|
+
"aria-label": "Search by order ID"
|
|
2323
|
+
}
|
|
2324
|
+
),
|
|
2325
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxs(
|
|
2326
|
+
"select",
|
|
2327
|
+
{
|
|
2328
|
+
value: statusFilter,
|
|
2329
|
+
onChange: (e) => setStatusFilter(e.target.value),
|
|
2330
|
+
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",
|
|
2331
|
+
"aria-label": "Filter by status",
|
|
2332
|
+
children: [
|
|
2333
|
+
/* @__PURE__ */ jsx("option", { value: "all", children: "All statuses" }),
|
|
2334
|
+
/* @__PURE__ */ jsx("option", { value: "pending", children: "Pending" }),
|
|
2335
|
+
/* @__PURE__ */ jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
2336
|
+
/* @__PURE__ */ jsx("option", { value: "error", children: "Error" }),
|
|
2337
|
+
/* @__PURE__ */ jsx("option", { value: "canceled", children: "Canceled" }),
|
|
2338
|
+
/* @__PURE__ */ jsx("option", { value: "authorized", children: "Authorized" }),
|
|
2339
|
+
/* @__PURE__ */ jsx("option", { value: "captured", children: "Captured" })
|
|
2340
|
+
]
|
|
2341
|
+
}
|
|
2342
|
+
) })
|
|
2343
|
+
] }),
|
|
2344
|
+
error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2345
|
+
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
2346
|
+
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => loadTransactions(0, true), children: "Try again" }) })
|
|
2347
|
+
] }) : null,
|
|
2348
|
+
isLoading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading payments…" }) }) : items.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
2349
|
+
/* @__PURE__ */ jsx(Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
|
|
2350
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
|
|
2351
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
|
|
2352
|
+
/* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
2353
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
2354
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
2355
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
2356
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
2357
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
|
|
2358
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
2359
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
2360
|
+
] }) }),
|
|
2361
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxs(
|
|
2362
|
+
"tr",
|
|
2363
|
+
{
|
|
2364
|
+
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
2365
|
+
onClick: () => navigate(`/payments/${t.payment_session_id}`),
|
|
2366
|
+
children: [
|
|
2367
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
|
|
2368
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
|
|
2369
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
|
|
2370
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx(
|
|
2371
|
+
Badge,
|
|
2372
|
+
{
|
|
2373
|
+
size: "2xsmall",
|
|
2374
|
+
className: `uppercase ${getStatusBadgeClass$7(displayStatus(t))}`,
|
|
2375
|
+
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
2376
|
+
}
|
|
2377
|
+
) }),
|
|
2378
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
|
|
2379
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
|
|
2380
|
+
year: "numeric",
|
|
2381
|
+
month: "short",
|
|
2382
|
+
day: "numeric",
|
|
2383
|
+
hour: "numeric",
|
|
2384
|
+
minute: "2-digit",
|
|
2385
|
+
hour12: true
|
|
2386
|
+
}) }),
|
|
2387
|
+
/* @__PURE__ */ jsxs("td", { className: "px-4 py-4", children: [
|
|
2388
|
+
/* @__PURE__ */ jsx(
|
|
2389
|
+
Button,
|
|
2390
|
+
{
|
|
2391
|
+
variant: "transparent",
|
|
2392
|
+
size: "small",
|
|
2393
|
+
onClick: (e) => {
|
|
2394
|
+
e.stopPropagation();
|
|
2395
|
+
navigate(`/payments/${t.payment_session_id}`);
|
|
2396
|
+
},
|
|
2397
|
+
children: "View details"
|
|
2398
|
+
}
|
|
2399
|
+
),
|
|
2400
|
+
t.order_id ? /* @__PURE__ */ jsx(
|
|
2401
|
+
Button,
|
|
2402
|
+
{
|
|
2403
|
+
variant: "transparent",
|
|
2404
|
+
size: "small",
|
|
2405
|
+
onClick: (e) => {
|
|
2406
|
+
e.stopPropagation();
|
|
2407
|
+
navigate(`/orders/${t.order_id}`);
|
|
2408
|
+
},
|
|
2409
|
+
children: "Order"
|
|
2410
|
+
}
|
|
2411
|
+
) : null
|
|
2412
|
+
] })
|
|
2413
|
+
]
|
|
2414
|
+
},
|
|
2415
|
+
t.payment_session_id
|
|
2416
|
+
)) })
|
|
2417
|
+
] }) }),
|
|
2418
|
+
hasMore ? /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx(
|
|
2419
|
+
Button,
|
|
2420
|
+
{
|
|
2421
|
+
variant: "secondary",
|
|
2422
|
+
isLoading: isFetchingMore,
|
|
2423
|
+
onClick: () => loadTransactions(offset, false),
|
|
2424
|
+
children: "Load more"
|
|
2425
|
+
}
|
|
2426
|
+
) }) : null
|
|
2427
|
+
] }) });
|
|
2428
|
+
};
|
|
2429
|
+
const config$7 = defineRouteConfig({
|
|
2430
|
+
label: "Payments",
|
|
2431
|
+
icon: CreditCard
|
|
2432
|
+
});
|
|
2433
|
+
const useDebounce$2 = (value, delay) => {
|
|
2434
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
2435
|
+
useEffect(() => {
|
|
2436
|
+
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
2437
|
+
return () => clearTimeout(handler);
|
|
2438
|
+
}, [value, delay]);
|
|
2439
|
+
return debouncedValue;
|
|
2440
|
+
};
|
|
2441
|
+
const getStatusBadgeClass$6 = (status) => {
|
|
2442
|
+
const s2 = status.toLowerCase();
|
|
2443
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2444
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2445
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2446
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2447
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2448
|
+
};
|
|
2449
|
+
const RefundsPage = () => {
|
|
2450
|
+
const navigate = useNavigate();
|
|
2451
|
+
const [items, setItems] = useState([]);
|
|
2452
|
+
const [orderIdSearch, setOrderIdSearch] = useState("");
|
|
2453
|
+
const debouncedOrderId = useDebounce$2(orderIdSearch, 300);
|
|
2236
2454
|
const [paymentStatusFilter, setPaymentStatusFilter] = useState("all");
|
|
2237
2455
|
const [providerSearch, setProviderSearch] = useState("");
|
|
2238
|
-
const debouncedProvider = useDebounce$
|
|
2456
|
+
const debouncedProvider = useDebounce$2(providerSearch, 300);
|
|
2239
2457
|
const [currencySearch, setCurrencySearch] = useState("");
|
|
2240
|
-
const debouncedCurrency = useDebounce$
|
|
2458
|
+
const debouncedCurrency = useDebounce$2(currencySearch, 300);
|
|
2241
2459
|
const [dateFrom, setDateFrom] = useState("");
|
|
2242
2460
|
const [dateTo, setDateTo] = useState("");
|
|
2243
2461
|
const [amountMin, setAmountMin] = useState("");
|
|
@@ -2449,7 +2667,7 @@ const RefundsPage = () => {
|
|
|
2449
2667
|
Badge,
|
|
2450
2668
|
{
|
|
2451
2669
|
size: "2xsmall",
|
|
2452
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2670
|
+
className: `uppercase ${getStatusBadgeClass$6(displayStatus(r))}`,
|
|
2453
2671
|
children: displayStatus(r) !== "—" ? displayStatus(r).replace(/_/g, " ") : "—"
|
|
2454
2672
|
}
|
|
2455
2673
|
) }),
|
|
@@ -2503,11 +2721,11 @@ const RefundsPage = () => {
|
|
|
2503
2721
|
) }) : null
|
|
2504
2722
|
] }) });
|
|
2505
2723
|
};
|
|
2506
|
-
const config$
|
|
2724
|
+
const config$6 = defineRouteConfig({
|
|
2507
2725
|
label: "Refunds",
|
|
2508
2726
|
icon: Receipt
|
|
2509
2727
|
});
|
|
2510
|
-
const useDebounce$
|
|
2728
|
+
const useDebounce$1 = (value, delay) => {
|
|
2511
2729
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
2512
2730
|
useEffect(() => {
|
|
2513
2731
|
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
@@ -2515,7 +2733,7 @@ const useDebounce$2 = (value, delay) => {
|
|
|
2515
2733
|
}, [value, delay]);
|
|
2516
2734
|
return debouncedValue;
|
|
2517
2735
|
};
|
|
2518
|
-
const getStatusBadgeClass$
|
|
2736
|
+
const getStatusBadgeClass$5 = (status) => {
|
|
2519
2737
|
const statusLower = status.toLowerCase();
|
|
2520
2738
|
if (statusLower === "requested") {
|
|
2521
2739
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -2540,7 +2758,7 @@ const ReturnsPage = () => {
|
|
|
2540
2758
|
const [statusFilter, setStatusFilter] = useState("all");
|
|
2541
2759
|
const [createdByFilter, setCreatedByFilter] = useState("all");
|
|
2542
2760
|
const [searchQuery, setSearchQuery] = useState("");
|
|
2543
|
-
const debouncedSearchQuery = useDebounce$
|
|
2761
|
+
const debouncedSearchQuery = useDebounce$1(searchQuery, 300);
|
|
2544
2762
|
const [isLoading, setIsLoading] = useState(true);
|
|
2545
2763
|
const [isFetchingMore, setIsFetchingMore] = useState(false);
|
|
2546
2764
|
const [error, setError] = useState(null);
|
|
@@ -2549,6 +2767,7 @@ const ReturnsPage = () => {
|
|
|
2549
2767
|
const limit = 50;
|
|
2550
2768
|
const loadReturns = useCallback(
|
|
2551
2769
|
async (nextOffset, replace = false) => {
|
|
2770
|
+
var _a;
|
|
2552
2771
|
try {
|
|
2553
2772
|
if (replace) {
|
|
2554
2773
|
setIsLoading(true);
|
|
@@ -2579,7 +2798,7 @@ const ReturnsPage = () => {
|
|
|
2579
2798
|
}
|
|
2580
2799
|
const payload = await response.json();
|
|
2581
2800
|
setCount(payload.count ?? 0);
|
|
2582
|
-
setOffset(nextOffset + (payload.returns
|
|
2801
|
+
setOffset(nextOffset + (((_a = payload.returns) == null ? void 0 : _a.length) ?? 0));
|
|
2583
2802
|
setItems(
|
|
2584
2803
|
(prev) => replace ? payload.returns ?? [] : [...prev, ...payload.returns ?? []]
|
|
2585
2804
|
);
|
|
@@ -2685,13 +2904,13 @@ const ReturnsPage = () => {
|
|
|
2685
2904
|
Badge,
|
|
2686
2905
|
{
|
|
2687
2906
|
size: "2xsmall",
|
|
2688
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2907
|
+
className: `uppercase ${getStatusBadgeClass$5(returnOrder.status)}`,
|
|
2689
2908
|
children: returnOrder.status.replace(/_/g, " ")
|
|
2690
2909
|
}
|
|
2691
2910
|
) }),
|
|
2692
2911
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
|
|
2693
2912
|
const calc = returnOrder.refund;
|
|
2694
|
-
if (calc
|
|
2913
|
+
if ((calc == null ? void 0 : calc.is_processed) && calc.final_refund_amount != null) {
|
|
2695
2914
|
return formatRefundCurrency(
|
|
2696
2915
|
calc.final_refund_amount,
|
|
2697
2916
|
calc.currency_code || returnOrder.currency_code
|
|
@@ -2744,11 +2963,11 @@ const ReturnsPage = () => {
|
|
|
2744
2963
|
) }) : null
|
|
2745
2964
|
] }) });
|
|
2746
2965
|
};
|
|
2747
|
-
const config$
|
|
2966
|
+
const config$5 = defineRouteConfig({
|
|
2748
2967
|
label: "Return Orders",
|
|
2749
2968
|
icon: ArrowPath
|
|
2750
2969
|
});
|
|
2751
|
-
const useDebounce
|
|
2970
|
+
const useDebounce = (value, delay) => {
|
|
2752
2971
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
2753
2972
|
useEffect(() => {
|
|
2754
2973
|
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
@@ -2756,7 +2975,7 @@ const useDebounce$1 = (value, delay) => {
|
|
|
2756
2975
|
}, [value, delay]);
|
|
2757
2976
|
return debouncedValue;
|
|
2758
2977
|
};
|
|
2759
|
-
const getStatusBadgeClass$
|
|
2978
|
+
const getStatusBadgeClass$4 = (status) => {
|
|
2760
2979
|
const statusLower = status.toLowerCase();
|
|
2761
2980
|
if (statusLower === "requested") {
|
|
2762
2981
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -2781,7 +3000,7 @@ const SwapsPage = () => {
|
|
|
2781
3000
|
const [statusFilter, setStatusFilter] = useState("all");
|
|
2782
3001
|
const [createdByFilter, setCreatedByFilter] = useState("all");
|
|
2783
3002
|
const [searchQuery, setSearchQuery] = useState("");
|
|
2784
|
-
const debouncedSearchQuery = useDebounce
|
|
3003
|
+
const debouncedSearchQuery = useDebounce(searchQuery, 300);
|
|
2785
3004
|
const [isLoading, setIsLoading] = useState(true);
|
|
2786
3005
|
const [isFetchingMore, setIsFetchingMore] = useState(false);
|
|
2787
3006
|
const [error, setError] = useState(null);
|
|
@@ -2790,6 +3009,7 @@ const SwapsPage = () => {
|
|
|
2790
3009
|
const limit = 50;
|
|
2791
3010
|
const loadSwaps = useCallback(
|
|
2792
3011
|
async (nextOffset, replace = false) => {
|
|
3012
|
+
var _a;
|
|
2793
3013
|
try {
|
|
2794
3014
|
if (replace) {
|
|
2795
3015
|
setIsLoading(true);
|
|
@@ -2819,7 +3039,7 @@ const SwapsPage = () => {
|
|
|
2819
3039
|
}
|
|
2820
3040
|
const payload = await response.json();
|
|
2821
3041
|
setCount(payload.count ?? 0);
|
|
2822
|
-
setOffset(nextOffset + (payload.swaps
|
|
3042
|
+
setOffset(nextOffset + (((_a = payload.swaps) == null ? void 0 : _a.length) ?? 0));
|
|
2823
3043
|
setItems(
|
|
2824
3044
|
(prev) => replace ? payload.swaps ?? [] : [...prev, ...payload.swaps ?? []]
|
|
2825
3045
|
);
|
|
@@ -2923,7 +3143,7 @@ const SwapsPage = () => {
|
|
|
2923
3143
|
Badge,
|
|
2924
3144
|
{
|
|
2925
3145
|
size: "2xsmall",
|
|
2926
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
3146
|
+
className: `uppercase ${getStatusBadgeClass$4(swap.status)}`,
|
|
2927
3147
|
children: swap.status.replace(/_/g, " ")
|
|
2928
3148
|
}
|
|
2929
3149
|
) }),
|
|
@@ -2973,235 +3193,35 @@ const SwapsPage = () => {
|
|
|
2973
3193
|
) }) : null
|
|
2974
3194
|
] }) });
|
|
2975
3195
|
};
|
|
2976
|
-
const config$
|
|
3196
|
+
const config$4 = defineRouteConfig({
|
|
2977
3197
|
label: "Exchanges",
|
|
2978
3198
|
icon: ArrowPath
|
|
2979
3199
|
});
|
|
2980
|
-
const
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
const [offset, setOffset] = useState(0);
|
|
3006
|
-
const [count, setCount] = useState(0);
|
|
3007
|
-
const limit = 50;
|
|
3008
|
-
const loadTransactions = useCallback(
|
|
3009
|
-
async (nextOffset, replace) => {
|
|
3010
|
-
try {
|
|
3011
|
-
if (replace) setIsLoading(true);
|
|
3012
|
-
else setIsFetchingMore(true);
|
|
3013
|
-
setError(null);
|
|
3014
|
-
const params = new URLSearchParams();
|
|
3015
|
-
params.set("limit", String(limit));
|
|
3016
|
-
params.set("offset", String(nextOffset));
|
|
3017
|
-
if (statusFilter !== "all") params.set("status", statusFilter);
|
|
3018
|
-
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
3019
|
-
const response = await fetch(
|
|
3020
|
-
`/admin/payment-transactions?${params.toString()}`,
|
|
3021
|
-
{ credentials: "include" }
|
|
3022
|
-
);
|
|
3023
|
-
if (!response.ok) {
|
|
3024
|
-
const text = await response.text();
|
|
3025
|
-
throw new Error(text || "Failed to load payment transactions");
|
|
3026
|
-
}
|
|
3027
|
-
const payload = await response.json();
|
|
3028
|
-
const list = payload.transactions ?? [];
|
|
3029
|
-
setCount(payload.count ?? 0);
|
|
3030
|
-
setOffset(nextOffset + list.length);
|
|
3031
|
-
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
3032
|
-
} catch (e) {
|
|
3033
|
-
setError(e instanceof Error ? e.message : "Failed to load");
|
|
3034
|
-
} finally {
|
|
3035
|
-
setIsLoading(false);
|
|
3036
|
-
setIsFetchingMore(false);
|
|
3037
|
-
}
|
|
3038
|
-
},
|
|
3039
|
-
[statusFilter, debouncedOrderId]
|
|
3040
|
-
);
|
|
3041
|
-
useEffect(() => {
|
|
3042
|
-
void loadTransactions(0, true);
|
|
3043
|
-
}, [loadTransactions]);
|
|
3044
|
-
const hasMore = useMemo(() => offset < count, [offset, count]);
|
|
3045
|
-
const displayStatus = (t) => {
|
|
3046
|
-
const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
|
|
3047
|
-
return s2 !== "" ? s2 : "—";
|
|
3048
|
-
};
|
|
3049
|
-
const displayAmount = (t) => {
|
|
3050
|
-
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
3051
|
-
return `${code} ${Number(t.amount)}`;
|
|
3052
|
-
};
|
|
3053
|
-
return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-7xl flex-col gap-6 p-6", children: [
|
|
3054
|
-
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
3055
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
3056
|
-
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Payments" }),
|
|
3057
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
|
|
3058
|
-
] }),
|
|
3059
|
-
/* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
|
|
3060
|
-
] }),
|
|
3061
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
3062
|
-
/* @__PURE__ */ jsx(
|
|
3063
|
-
Input,
|
|
3064
|
-
{
|
|
3065
|
-
placeholder: "Search by Order ID",
|
|
3066
|
-
value: orderIdSearch,
|
|
3067
|
-
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
3068
|
-
className: "md:max-w-sm",
|
|
3069
|
-
"aria-label": "Search by order ID"
|
|
3070
|
-
}
|
|
3071
|
-
),
|
|
3072
|
-
/* @__PURE__ */ jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxs(
|
|
3073
|
-
"select",
|
|
3074
|
-
{
|
|
3075
|
-
value: statusFilter,
|
|
3076
|
-
onChange: (e) => setStatusFilter(e.target.value),
|
|
3077
|
-
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",
|
|
3078
|
-
"aria-label": "Filter by status",
|
|
3079
|
-
children: [
|
|
3080
|
-
/* @__PURE__ */ jsx("option", { value: "all", children: "All statuses" }),
|
|
3081
|
-
/* @__PURE__ */ jsx("option", { value: "pending", children: "Pending" }),
|
|
3082
|
-
/* @__PURE__ */ jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
3083
|
-
/* @__PURE__ */ jsx("option", { value: "error", children: "Error" }),
|
|
3084
|
-
/* @__PURE__ */ jsx("option", { value: "canceled", children: "Canceled" }),
|
|
3085
|
-
/* @__PURE__ */ jsx("option", { value: "authorized", children: "Authorized" }),
|
|
3086
|
-
/* @__PURE__ */ jsx("option", { value: "captured", children: "Captured" })
|
|
3087
|
-
]
|
|
3088
|
-
}
|
|
3089
|
-
) })
|
|
3090
|
-
] }),
|
|
3091
|
-
error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
3092
|
-
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
3093
|
-
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => loadTransactions(0, true), children: "Try again" }) })
|
|
3094
|
-
] }) : null,
|
|
3095
|
-
isLoading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading payments…" }) }) : items.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
3096
|
-
/* @__PURE__ */ jsx(Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
|
|
3097
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
|
|
3098
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
|
|
3099
|
-
/* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
3100
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
3101
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
3102
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
3103
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
3104
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
|
|
3105
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
3106
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
3107
|
-
] }) }),
|
|
3108
|
-
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxs(
|
|
3109
|
-
"tr",
|
|
3110
|
-
{
|
|
3111
|
-
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
3112
|
-
onClick: () => navigate(`/payments/${t.payment_session_id}`),
|
|
3113
|
-
children: [
|
|
3114
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
|
|
3115
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
|
|
3116
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
|
|
3117
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx(
|
|
3118
|
-
Badge,
|
|
3119
|
-
{
|
|
3120
|
-
size: "2xsmall",
|
|
3121
|
-
className: `uppercase ${getStatusBadgeClass$4(displayStatus(t))}`,
|
|
3122
|
-
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
3123
|
-
}
|
|
3124
|
-
) }),
|
|
3125
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
|
|
3126
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
|
|
3127
|
-
year: "numeric",
|
|
3128
|
-
month: "short",
|
|
3129
|
-
day: "numeric",
|
|
3130
|
-
hour: "numeric",
|
|
3131
|
-
minute: "2-digit",
|
|
3132
|
-
hour12: true
|
|
3133
|
-
}) }),
|
|
3134
|
-
/* @__PURE__ */ jsxs("td", { className: "px-4 py-4", children: [
|
|
3135
|
-
/* @__PURE__ */ jsx(
|
|
3136
|
-
Button,
|
|
3137
|
-
{
|
|
3138
|
-
variant: "transparent",
|
|
3139
|
-
size: "small",
|
|
3140
|
-
onClick: (e) => {
|
|
3141
|
-
e.stopPropagation();
|
|
3142
|
-
navigate(`/payments/${t.payment_session_id}`);
|
|
3143
|
-
},
|
|
3144
|
-
children: "View details"
|
|
3145
|
-
}
|
|
3146
|
-
),
|
|
3147
|
-
t.order_id ? /* @__PURE__ */ jsx(
|
|
3148
|
-
Button,
|
|
3149
|
-
{
|
|
3150
|
-
variant: "transparent",
|
|
3151
|
-
size: "small",
|
|
3152
|
-
onClick: (e) => {
|
|
3153
|
-
e.stopPropagation();
|
|
3154
|
-
navigate(`/orders/${t.order_id}`);
|
|
3155
|
-
},
|
|
3156
|
-
children: "Order"
|
|
3157
|
-
}
|
|
3158
|
-
) : null
|
|
3159
|
-
] })
|
|
3160
|
-
]
|
|
3161
|
-
},
|
|
3162
|
-
t.payment_session_id
|
|
3163
|
-
)) })
|
|
3164
|
-
] }) }),
|
|
3165
|
-
hasMore ? /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx(
|
|
3166
|
-
Button,
|
|
3167
|
-
{
|
|
3168
|
-
variant: "secondary",
|
|
3169
|
-
isLoading: isFetchingMore,
|
|
3170
|
-
onClick: () => loadTransactions(offset, false),
|
|
3171
|
-
children: "Load more"
|
|
3172
|
-
}
|
|
3173
|
-
) }) : null
|
|
3174
|
-
] }) });
|
|
3175
|
-
};
|
|
3176
|
-
const config$5 = defineRouteConfig({
|
|
3177
|
-
label: "Payments",
|
|
3178
|
-
icon: CreditCard
|
|
3179
|
-
});
|
|
3180
|
-
const MASKED_VALUE = "••••••••••••";
|
|
3181
|
-
const SENSITIVE_KEY_PATTERNS = [
|
|
3182
|
-
/password|passwd|passphrase/i,
|
|
3183
|
-
/secret/i,
|
|
3184
|
-
/token/i,
|
|
3185
|
-
/api_?key$/i,
|
|
3186
|
-
/private_?key/i,
|
|
3187
|
-
/access_?key/i,
|
|
3188
|
-
/(^|_)hash(ed)?($|_)/i,
|
|
3189
|
-
/(^|_)salt$/i,
|
|
3190
|
-
/^cvv$|^cvc$|security_code/i,
|
|
3191
|
-
/card_?number/i,
|
|
3192
|
-
/account_?number/i,
|
|
3193
|
-
/credential/i,
|
|
3194
|
-
/authorization/i,
|
|
3195
|
-
/recovery_?code/i,
|
|
3196
|
-
/(^|_)otp($|_)/i,
|
|
3197
|
-
/verification_?code/i,
|
|
3198
|
-
/^code_hash$/i,
|
|
3199
|
-
/webhook_?signature/i
|
|
3200
|
-
];
|
|
3201
|
-
const TABLE_SENSITIVE_KEYS = {
|
|
3202
|
-
otp_verification: /* @__PURE__ */ new Set(["code", "value"]),
|
|
3203
|
-
auth_verification: /* @__PURE__ */ new Set(["code", "value"]),
|
|
3204
|
-
auth_mfa_factor: /* @__PURE__ */ new Set(["value", "config"])
|
|
3200
|
+
const MASKED_VALUE = "••••••••••••";
|
|
3201
|
+
const SENSITIVE_KEY_PATTERNS = [
|
|
3202
|
+
/password|passwd|passphrase/i,
|
|
3203
|
+
/secret/i,
|
|
3204
|
+
/token/i,
|
|
3205
|
+
/api_?key$/i,
|
|
3206
|
+
/private_?key/i,
|
|
3207
|
+
/access_?key/i,
|
|
3208
|
+
/(^|_)hash(ed)?($|_)/i,
|
|
3209
|
+
/(^|_)salt$/i,
|
|
3210
|
+
/^cvv$|^cvc$|security_code/i,
|
|
3211
|
+
/card_?number/i,
|
|
3212
|
+
/account_?number/i,
|
|
3213
|
+
/credential/i,
|
|
3214
|
+
/authorization/i,
|
|
3215
|
+
/recovery_?code/i,
|
|
3216
|
+
/(^|_)otp($|_)/i,
|
|
3217
|
+
/verification_?code/i,
|
|
3218
|
+
/^code_hash$/i,
|
|
3219
|
+
/webhook_?signature/i
|
|
3220
|
+
];
|
|
3221
|
+
const TABLE_SENSITIVE_KEYS = {
|
|
3222
|
+
otp_verification: /* @__PURE__ */ new Set(["code", "value"]),
|
|
3223
|
+
auth_verification: /* @__PURE__ */ new Set(["code", "value"]),
|
|
3224
|
+
auth_mfa_factor: /* @__PURE__ */ new Set(["value", "config"])
|
|
3205
3225
|
};
|
|
3206
3226
|
const SAFE_KEYS = /* @__PURE__ */ new Set([
|
|
3207
3227
|
"token_type",
|
|
@@ -3218,12 +3238,13 @@ function isSensitiveKey(key) {
|
|
|
3218
3238
|
const FULLY_SECRET_TABLES = /* @__PURE__ */ new Set(["auth_mfa_recovery_code", "auth_password_reset_token"]);
|
|
3219
3239
|
const ALWAYS_VISIBLE_KEYS = /* @__PURE__ */ new Set(["id", "created_at", "updated_at", "deleted_at", "expires_at", "used_at"]);
|
|
3220
3240
|
function maskValue(value, ctx, depth) {
|
|
3241
|
+
var _a;
|
|
3221
3242
|
if (Array.isArray(value)) return value.map((item) => maskValue(item, ctx, depth + 1));
|
|
3222
3243
|
if (value !== null && typeof value === "object") {
|
|
3223
3244
|
const out = {};
|
|
3224
3245
|
for (const [key, inner] of Object.entries(value)) {
|
|
3225
3246
|
const topLevel = depth === 0;
|
|
3226
|
-
const secret = inner !== null && inner !== void 0 && inner !== "" && (isSensitiveKey(key) || topLevel && ctx.tableKeys
|
|
3247
|
+
const secret = inner !== null && inner !== void 0 && inner !== "" && (isSensitiveKey(key) || topLevel && ((_a = ctx.tableKeys) == null ? void 0 : _a.has(key.toLowerCase())) === true || topLevel && ctx.maskAll && !ALWAYS_VISIBLE_KEYS.has(key) && !key.endsWith("_id"));
|
|
3227
3248
|
if (secret) {
|
|
3228
3249
|
ctx.count += 1;
|
|
3229
3250
|
out[key] = MASKED_VALUE;
|
|
@@ -3689,12 +3710,13 @@ function readLastListSearch() {
|
|
|
3689
3710
|
}
|
|
3690
3711
|
}
|
|
3691
3712
|
const DeletedRecordDetailPage = () => {
|
|
3713
|
+
var _a;
|
|
3692
3714
|
const navigate = useNavigate();
|
|
3693
3715
|
const location = useLocation();
|
|
3694
3716
|
const { id = "" } = useParams();
|
|
3695
3717
|
const [state, setState] = useState({ status: "loading" });
|
|
3696
3718
|
const [reloadToken, setReloadToken] = useState(0);
|
|
3697
|
-
const cameFromList = location.state
|
|
3719
|
+
const cameFromList = ((_a = location.state) == null ? void 0 : _a.fromList) === true;
|
|
3698
3720
|
const goBack = () => {
|
|
3699
3721
|
if (cameFromList) navigate(-1);
|
|
3700
3722
|
else navigate(`/deleted-records-audit${readLastListSearch()}`);
|
|
@@ -3918,7 +3940,7 @@ const DetailError = ({
|
|
|
3918
3940
|
!notFound ? /* @__PURE__ */ jsx(Button, { variant: "primary", size: "small", onClick: onRetry, children: "Try again" }) : null
|
|
3919
3941
|
] })
|
|
3920
3942
|
] });
|
|
3921
|
-
|
|
3943
|
+
defineRouteConfig({});
|
|
3922
3944
|
const getStatusBadgeClass$3 = (status) => {
|
|
3923
3945
|
const s2 = status.toLowerCase();
|
|
3924
3946
|
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
@@ -3927,17 +3949,14 @@ const getStatusBadgeClass$3 = (status) => {
|
|
|
3927
3949
|
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
3928
3950
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
3929
3951
|
};
|
|
3930
|
-
const
|
|
3931
|
-
|
|
3932
|
-
};
|
|
3933
|
-
const RefundDetailPage = () => {
|
|
3952
|
+
const PaymentDetailPage = () => {
|
|
3953
|
+
var _a;
|
|
3934
3954
|
const navigate = useNavigate();
|
|
3935
3955
|
const params = useParams();
|
|
3936
|
-
const id = params
|
|
3956
|
+
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
3937
3957
|
const [detail, setDetail] = useState(null);
|
|
3938
3958
|
const [loading, setLoading] = useState(!!id);
|
|
3939
3959
|
const [error, setError] = useState(null);
|
|
3940
|
-
const [gatewayExpanded, setGatewayExpanded] = useState(false);
|
|
3941
3960
|
useEffect(() => {
|
|
3942
3961
|
if (!id) {
|
|
3943
3962
|
setLoading(false);
|
|
@@ -3946,7 +3965,7 @@ const RefundDetailPage = () => {
|
|
|
3946
3965
|
let cancelled = false;
|
|
3947
3966
|
setLoading(true);
|
|
3948
3967
|
setError(null);
|
|
3949
|
-
fetch(`/admin/
|
|
3968
|
+
fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
|
|
3950
3969
|
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
3951
3970
|
return res.json();
|
|
3952
3971
|
}).then((data) => {
|
|
@@ -3960,155 +3979,86 @@ const RefundDetailPage = () => {
|
|
|
3960
3979
|
cancelled = true;
|
|
3961
3980
|
};
|
|
3962
3981
|
}, [id]);
|
|
3963
|
-
const
|
|
3964
|
-
const
|
|
3982
|
+
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
3983
|
+
const sessionStatusRaw = (detail == null ? void 0 : detail.session_status) ?? "—";
|
|
3984
|
+
const paymentStatusRaw = (detail == null ? void 0 : detail.payment_id) != null ? (detail == null ? void 0 : detail.payment_status) ?? "—" : "—";
|
|
3985
|
+
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
3965
3986
|
return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-4xl flex-col gap-6 p-6", children: [
|
|
3966
3987
|
/* @__PURE__ */ jsx("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
3967
|
-
/* @__PURE__ */ jsx(Button, { variant: "transparent", size: "small", onClick: () => navigate("/
|
|
3968
|
-
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "
|
|
3969
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle
|
|
3988
|
+
/* @__PURE__ */ jsx(Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
3989
|
+
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Payment session" }),
|
|
3990
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
|
|
3970
3991
|
] }) }),
|
|
3971
3992
|
error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
3972
3993
|
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
3973
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/
|
|
3994
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
|
|
3974
3995
|
] }) : loading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading…" }) }) : detail ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
3975
|
-
/* @__PURE__ */
|
|
3976
|
-
/* @__PURE__ */
|
|
3977
|
-
|
|
3978
|
-
/* @__PURE__ */
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
/* @__PURE__ */
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
/* @__PURE__ */
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
Badge,
|
|
4030
|
-
{
|
|
4031
|
-
size: "2xsmall",
|
|
4032
|
-
className: `uppercase ${getStatusBadgeClass$3(paymentStatus)}`,
|
|
4033
|
-
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
4034
|
-
}
|
|
4035
|
-
) })
|
|
4036
|
-
] }),
|
|
4037
|
-
detail.computed ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4038
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4039
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
4040
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
4041
|
-
] }),
|
|
4042
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4043
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
4044
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
4045
|
-
] }),
|
|
4046
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4047
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
4048
|
-
/* @__PURE__ */ jsxs(Text, { className: "mt-1 block", children: [
|
|
4049
|
-
detail.computed.refund_percentage.toFixed(1),
|
|
4050
|
-
"%"
|
|
4051
|
-
] })
|
|
4052
|
-
] })
|
|
4053
|
-
] }) : null
|
|
3996
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-xl border border-ui-border-base p-6 flex flex-col gap-4", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
3997
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
3998
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
|
|
3999
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsx(
|
|
4000
|
+
Button,
|
|
4001
|
+
{
|
|
4002
|
+
variant: "transparent",
|
|
4003
|
+
size: "small",
|
|
4004
|
+
onClick: () => navigate(`/orders/${detail.order_id}`),
|
|
4005
|
+
children: detail.order_id
|
|
4006
|
+
}
|
|
4007
|
+
) : /* @__PURE__ */ jsx(Text, { children: "—" }) })
|
|
4008
|
+
] }),
|
|
4009
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4010
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
4011
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: displayAmount })
|
|
4012
|
+
] }),
|
|
4013
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4014
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
4015
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.provider_id })
|
|
4016
|
+
] }),
|
|
4017
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4018
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
4019
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
|
|
4020
|
+
Badge,
|
|
4021
|
+
{
|
|
4022
|
+
size: "2xsmall",
|
|
4023
|
+
className: `uppercase ${getStatusBadgeClass$3(displayStatus)}`,
|
|
4024
|
+
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
4025
|
+
}
|
|
4026
|
+
) })
|
|
4027
|
+
] }),
|
|
4028
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4029
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
4030
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
4031
|
+
] }),
|
|
4032
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4033
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
4034
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
4035
|
+
] }),
|
|
4036
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4037
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
4038
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
4039
|
+
] }),
|
|
4040
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4041
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
4042
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
4043
|
+
year: "numeric",
|
|
4044
|
+
month: "short",
|
|
4045
|
+
day: "numeric",
|
|
4046
|
+
hour: "numeric",
|
|
4047
|
+
minute: "2-digit",
|
|
4048
|
+
hour12: true
|
|
4049
|
+
}) })
|
|
4054
4050
|
] })
|
|
4055
|
-
] }),
|
|
4056
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4057
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
4061
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
|
|
4062
|
-
Button,
|
|
4063
|
-
{
|
|
4064
|
-
variant: "transparent",
|
|
4065
|
-
size: "small",
|
|
4066
|
-
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
4067
|
-
children: detail.order.order_number ?? detail.order.order_id
|
|
4068
|
-
}
|
|
4069
|
-
) })
|
|
4070
|
-
] }),
|
|
4071
|
-
detail.order.total != null ? /* @__PURE__ */ jsxs("div", { children: [
|
|
4072
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
4073
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
4074
|
-
] }) : null,
|
|
4075
|
-
detail.order.customer_id ? /* @__PURE__ */ jsxs("div", { children: [
|
|
4076
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
4077
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
4078
|
-
] }) : null,
|
|
4079
|
-
detail.order.region ? /* @__PURE__ */ jsxs("div", { children: [
|
|
4080
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
4081
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.order.region })
|
|
4082
|
-
] }) : null,
|
|
4083
|
-
detail.order.fulfillment_status ? /* @__PURE__ */ jsxs("div", { children: [
|
|
4084
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
4085
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
4086
|
-
] }) : null
|
|
4087
|
-
] }) : /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
4088
|
-
] }),
|
|
4089
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4090
|
-
/* @__PURE__ */ jsxs(
|
|
4091
|
-
"button",
|
|
4092
|
-
{
|
|
4093
|
-
type: "button",
|
|
4094
|
-
className: "flex w-full items-center justify-between text-left",
|
|
4095
|
-
onClick: () => setGatewayExpanded((prev) => !prev),
|
|
4096
|
-
"aria-expanded": gatewayExpanded,
|
|
4097
|
-
"aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
|
|
4098
|
-
children: [
|
|
4099
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
|
|
4100
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
|
|
4101
|
-
]
|
|
4102
|
-
}
|
|
4103
|
-
),
|
|
4104
|
-
gatewayExpanded && /* @__PURE__ */ jsx("div", { className: "mt-4", children: hasGatewayData ? /* @__PURE__ */ 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__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "No gateway payload for this payment." }) })
|
|
4105
|
-
] })
|
|
4051
|
+
] }) }),
|
|
4052
|
+
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4053
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
4054
|
+
/* @__PURE__ */ jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.data, null, 2) })
|
|
4055
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "rounded-xl border border-ui-border-base p-6", children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "No provider data for this session." }) })
|
|
4106
4056
|
] }) : null
|
|
4107
4057
|
] }) });
|
|
4108
4058
|
};
|
|
4109
4059
|
const config$3 = defineRouteConfig({
|
|
4110
|
-
label: "
|
|
4111
|
-
icon:
|
|
4060
|
+
label: "Payment details",
|
|
4061
|
+
icon: CreditCard
|
|
4112
4062
|
});
|
|
4113
4063
|
const getStatusBadgeClass$2 = (status) => {
|
|
4114
4064
|
const statusLower = status.toLowerCase();
|
|
@@ -4136,6 +4086,7 @@ const getStatusBadgeClass$2 = (status) => {
|
|
|
4136
4086
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
4137
4087
|
};
|
|
4138
4088
|
const ReturnDetailPage = () => {
|
|
4089
|
+
var _a, _b, _c;
|
|
4139
4090
|
const navigate = useNavigate();
|
|
4140
4091
|
const { id } = useParams();
|
|
4141
4092
|
const [returnOrder, setReturnOrder] = useState(null);
|
|
@@ -4218,7 +4169,7 @@ const ReturnDetailPage = () => {
|
|
|
4218
4169
|
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => navigate("/returns"), children: "Back to list" }) })
|
|
4219
4170
|
] }) }) });
|
|
4220
4171
|
}
|
|
4221
|
-
const statusHistory = returnOrder.metadata
|
|
4172
|
+
const statusHistory = ((_a = returnOrder.metadata) == null ? void 0 : _a.status_history) || [];
|
|
4222
4173
|
return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: [
|
|
4223
4174
|
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3", children: [
|
|
4224
4175
|
/* @__PURE__ */ jsxs(
|
|
@@ -4354,11 +4305,11 @@ const ReturnDetailPage = () => {
|
|
|
4354
4305
|
] }),
|
|
4355
4306
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
4356
4307
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
4357
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.order.customer
|
|
4308
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: ((_b = returnOrder.order.customer) == null ? void 0 : _b.email) || returnOrder.order.email || "—" })
|
|
4358
4309
|
] }),
|
|
4359
4310
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
4360
4311
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Payment method" }),
|
|
4361
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.order.order_payment
|
|
4312
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: ((_c = returnOrder.order.order_payment) == null ? void 0 : _c.label) || "—" })
|
|
4362
4313
|
] }),
|
|
4363
4314
|
returnOrder.order.total && /* @__PURE__ */ jsxs("div", { children: [
|
|
4364
4315
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
@@ -4368,31 +4319,223 @@ const ReturnDetailPage = () => {
|
|
|
4368
4319
|
] })
|
|
4369
4320
|
] })
|
|
4370
4321
|
] })
|
|
4371
|
-
] }),
|
|
4372
|
-
returnOrder.return_items && returnOrder.return_items.length > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
4373
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
4374
|
-
/* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
|
|
4375
|
-
/* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
4376
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Item ID" }),
|
|
4377
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
|
|
4378
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
|
|
4379
|
-
] }) }),
|
|
4380
|
-
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: returnOrder.return_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
4381
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
4382
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
4383
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
4384
|
-
] }, item.id || index)) })
|
|
4385
|
-
] }) })
|
|
4386
|
-
] }),
|
|
4387
|
-
updateError && /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-ui-border-error bg-ui-bg-error-subtle p-4", children: /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-error", children: updateError }) }),
|
|
4388
|
-
updateSuccess && /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-ui-border-success bg-ui-bg-success-subtle p-4", children: /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-success", children: "Action completed successfully" }) })
|
|
4322
|
+
] }),
|
|
4323
|
+
returnOrder.return_items && returnOrder.return_items.length > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
4324
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
4325
|
+
/* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
|
|
4326
|
+
/* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
4327
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Item ID" }),
|
|
4328
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
|
|
4329
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
|
|
4330
|
+
] }) }),
|
|
4331
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: returnOrder.return_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
4332
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
4333
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
4334
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
4335
|
+
] }, item.id || index)) })
|
|
4336
|
+
] }) })
|
|
4337
|
+
] }),
|
|
4338
|
+
updateError && /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-ui-border-error bg-ui-bg-error-subtle p-4", children: /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-error", children: updateError }) }),
|
|
4339
|
+
updateSuccess && /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-ui-border-success bg-ui-bg-success-subtle p-4", children: /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-success", children: "Action completed successfully" }) })
|
|
4340
|
+
] }) });
|
|
4341
|
+
};
|
|
4342
|
+
const config$2 = defineRouteConfig({
|
|
4343
|
+
label: "Return Order Details",
|
|
4344
|
+
icon: CheckCircle
|
|
4345
|
+
});
|
|
4346
|
+
const getStatusBadgeClass$1 = (status) => {
|
|
4347
|
+
const s2 = status.toLowerCase();
|
|
4348
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
4349
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
4350
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
4351
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
4352
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
4353
|
+
};
|
|
4354
|
+
const formatAmount = (value) => {
|
|
4355
|
+
return String(value);
|
|
4356
|
+
};
|
|
4357
|
+
const RefundDetailPage = () => {
|
|
4358
|
+
var _a, _b, _c;
|
|
4359
|
+
const navigate = useNavigate();
|
|
4360
|
+
const params = useParams();
|
|
4361
|
+
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
4362
|
+
const [detail, setDetail] = useState(null);
|
|
4363
|
+
const [loading, setLoading] = useState(!!id);
|
|
4364
|
+
const [error, setError] = useState(null);
|
|
4365
|
+
const [gatewayExpanded, setGatewayExpanded] = useState(false);
|
|
4366
|
+
useEffect(() => {
|
|
4367
|
+
if (!id) {
|
|
4368
|
+
setLoading(false);
|
|
4369
|
+
return;
|
|
4370
|
+
}
|
|
4371
|
+
let cancelled = false;
|
|
4372
|
+
setLoading(true);
|
|
4373
|
+
setError(null);
|
|
4374
|
+
fetch(`/admin/refunds/${id}`, { credentials: "include" }).then((res) => {
|
|
4375
|
+
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
4376
|
+
return res.json();
|
|
4377
|
+
}).then((data) => {
|
|
4378
|
+
if (!cancelled) setDetail(data);
|
|
4379
|
+
}).catch((e) => {
|
|
4380
|
+
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
4381
|
+
}).finally(() => {
|
|
4382
|
+
if (!cancelled) setLoading(false);
|
|
4383
|
+
});
|
|
4384
|
+
return () => {
|
|
4385
|
+
cancelled = true;
|
|
4386
|
+
};
|
|
4387
|
+
}, [id]);
|
|
4388
|
+
const paymentStatus = ((_b = detail == null ? void 0 : detail.payment) == null ? void 0 : _b.status) ?? "—";
|
|
4389
|
+
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;
|
|
4390
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-4xl flex-col gap-6 p-6", children: [
|
|
4391
|
+
/* @__PURE__ */ jsx("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
4392
|
+
/* @__PURE__ */ jsx(Button, { variant: "transparent", size: "small", onClick: () => navigate("/refunds"), children: "← Refunds" }),
|
|
4393
|
+
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Refund details" }),
|
|
4394
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle font-mono", children: id ?? "—" })
|
|
4395
|
+
] }) }),
|
|
4396
|
+
error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
4397
|
+
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
4398
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/refunds"), children: "Back to list" })
|
|
4399
|
+
] }) : loading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading…" }) }) : detail ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
4400
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4401
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "Refund summary" }),
|
|
4402
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4403
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4404
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Refund ID" }),
|
|
4405
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.id })
|
|
4406
|
+
] }),
|
|
4407
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4408
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
4409
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.refund.amount) })
|
|
4410
|
+
] }),
|
|
4411
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4412
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Note" }),
|
|
4413
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.refund.note ?? "—" })
|
|
4414
|
+
] }),
|
|
4415
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4416
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Created at" }),
|
|
4417
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: new Date(detail.refund.created_at).toLocaleDateString("en-US", {
|
|
4418
|
+
year: "numeric",
|
|
4419
|
+
month: "short",
|
|
4420
|
+
day: "numeric",
|
|
4421
|
+
hour: "numeric",
|
|
4422
|
+
minute: "2-digit",
|
|
4423
|
+
hour12: true
|
|
4424
|
+
}) })
|
|
4425
|
+
] }),
|
|
4426
|
+
detail.refund.created_by ? /* @__PURE__ */ jsxs("div", { children: [
|
|
4427
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Created by" }),
|
|
4428
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.created_by })
|
|
4429
|
+
] }) : null
|
|
4430
|
+
] })
|
|
4431
|
+
] }),
|
|
4432
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4433
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "Payment summary" }),
|
|
4434
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4435
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4436
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Payment amount" }),
|
|
4437
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.payment.payment_amount) })
|
|
4438
|
+
] }),
|
|
4439
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4440
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Captured amount" }),
|
|
4441
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.payment.captured_amount) })
|
|
4442
|
+
] }),
|
|
4443
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4444
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Refunded amount" }),
|
|
4445
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.payment.refunded_amount) })
|
|
4446
|
+
] }),
|
|
4447
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4448
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
4449
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.payment.provider_id || "—" })
|
|
4450
|
+
] }),
|
|
4451
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4452
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
4453
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
|
|
4454
|
+
Badge,
|
|
4455
|
+
{
|
|
4456
|
+
size: "2xsmall",
|
|
4457
|
+
className: `uppercase ${getStatusBadgeClass$1(paymentStatus)}`,
|
|
4458
|
+
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
4459
|
+
}
|
|
4460
|
+
) })
|
|
4461
|
+
] }),
|
|
4462
|
+
detail.computed ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4463
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4464
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
4465
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
4466
|
+
] }),
|
|
4467
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4468
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
4469
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
4470
|
+
] }),
|
|
4471
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4472
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
4473
|
+
/* @__PURE__ */ jsxs(Text, { className: "mt-1 block", children: [
|
|
4474
|
+
detail.computed.refund_percentage.toFixed(1),
|
|
4475
|
+
"%"
|
|
4476
|
+
] })
|
|
4477
|
+
] })
|
|
4478
|
+
] }) : null
|
|
4479
|
+
] })
|
|
4480
|
+
] }),
|
|
4481
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4482
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "Order summary" }),
|
|
4483
|
+
detail.order ? /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4484
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
4485
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
4486
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
|
|
4487
|
+
Button,
|
|
4488
|
+
{
|
|
4489
|
+
variant: "transparent",
|
|
4490
|
+
size: "small",
|
|
4491
|
+
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
4492
|
+
children: detail.order.order_number ?? detail.order.order_id
|
|
4493
|
+
}
|
|
4494
|
+
) })
|
|
4495
|
+
] }),
|
|
4496
|
+
detail.order.total != null ? /* @__PURE__ */ jsxs("div", { children: [
|
|
4497
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
4498
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
4499
|
+
] }) : null,
|
|
4500
|
+
detail.order.customer_id ? /* @__PURE__ */ jsxs("div", { children: [
|
|
4501
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
4502
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
4503
|
+
] }) : null,
|
|
4504
|
+
detail.order.region ? /* @__PURE__ */ jsxs("div", { children: [
|
|
4505
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
4506
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.order.region })
|
|
4507
|
+
] }) : null,
|
|
4508
|
+
detail.order.fulfillment_status ? /* @__PURE__ */ jsxs("div", { children: [
|
|
4509
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
4510
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
4511
|
+
] }) : null
|
|
4512
|
+
] }) : /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
4513
|
+
] }),
|
|
4514
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4515
|
+
/* @__PURE__ */ jsxs(
|
|
4516
|
+
"button",
|
|
4517
|
+
{
|
|
4518
|
+
type: "button",
|
|
4519
|
+
className: "flex w-full items-center justify-between text-left",
|
|
4520
|
+
onClick: () => setGatewayExpanded((prev) => !prev),
|
|
4521
|
+
"aria-expanded": gatewayExpanded,
|
|
4522
|
+
"aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
|
|
4523
|
+
children: [
|
|
4524
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
|
|
4525
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
|
|
4526
|
+
]
|
|
4527
|
+
}
|
|
4528
|
+
),
|
|
4529
|
+
gatewayExpanded && /* @__PURE__ */ jsx("div", { className: "mt-4", children: hasGatewayData ? /* @__PURE__ */ 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__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "No gateway payload for this payment." }) })
|
|
4530
|
+
] })
|
|
4531
|
+
] }) : null
|
|
4389
4532
|
] }) });
|
|
4390
4533
|
};
|
|
4391
|
-
const config$
|
|
4392
|
-
label: "
|
|
4393
|
-
icon:
|
|
4534
|
+
const config$1 = defineRouteConfig({
|
|
4535
|
+
label: "Refund details",
|
|
4536
|
+
icon: Receipt
|
|
4394
4537
|
});
|
|
4395
|
-
const getStatusBadgeClass
|
|
4538
|
+
const getStatusBadgeClass = (status) => {
|
|
4396
4539
|
const statusLower = status.toLowerCase();
|
|
4397
4540
|
if (statusLower === "requested") {
|
|
4398
4541
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -4415,12 +4558,13 @@ const getStatusBadgeClass$1 = (status) => {
|
|
|
4415
4558
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
4416
4559
|
};
|
|
4417
4560
|
const SwapDetailPage = () => {
|
|
4561
|
+
var _a, _b, _c;
|
|
4418
4562
|
const navigate = useNavigate();
|
|
4419
4563
|
const { id } = useParams();
|
|
4420
4564
|
const [swap, setSwap] = useState(null);
|
|
4421
4565
|
const [order, setOrder] = useState(null);
|
|
4422
4566
|
const [isLoading, setIsLoading] = useState(true);
|
|
4423
|
-
|
|
4567
|
+
useState(false);
|
|
4424
4568
|
const [isCancelling, setIsCancelling] = useState(false);
|
|
4425
4569
|
const [error, setError] = useState(null);
|
|
4426
4570
|
const [updateError, setUpdateError] = useState(null);
|
|
@@ -4491,9 +4635,9 @@ const SwapDetailPage = () => {
|
|
|
4491
4635
|
setIsCancelling(false);
|
|
4492
4636
|
}
|
|
4493
4637
|
};
|
|
4494
|
-
const isOrderExchange = Boolean(swap
|
|
4638
|
+
const isOrderExchange = Boolean(swap == null ? void 0 : swap.exchange_id);
|
|
4495
4639
|
const canCancelExchange = isOrderExchange && swap && !["cancelled", "canceled", "completed", "declined"].includes(
|
|
4496
|
-
swap.status
|
|
4640
|
+
((_a = swap.status) == null ? void 0 : _a.toLowerCase()) ?? ""
|
|
4497
4641
|
);
|
|
4498
4642
|
if (isLoading) {
|
|
4499
4643
|
return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsx(Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading swap..." }) }) }) });
|
|
@@ -4504,7 +4648,7 @@ const SwapDetailPage = () => {
|
|
|
4504
4648
|
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => navigate("/swaps"), children: "Back to list" }) })
|
|
4505
4649
|
] }) }) });
|
|
4506
4650
|
}
|
|
4507
|
-
const statusHistory = swap.metadata
|
|
4651
|
+
const statusHistory = ((_b = swap.metadata) == null ? void 0 : _b.status_history) || [];
|
|
4508
4652
|
return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: [
|
|
4509
4653
|
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3", children: [
|
|
4510
4654
|
/* @__PURE__ */ jsxs(
|
|
@@ -4529,7 +4673,7 @@ const SwapDetailPage = () => {
|
|
|
4529
4673
|
Badge,
|
|
4530
4674
|
{
|
|
4531
4675
|
size: "small",
|
|
4532
|
-
className: `uppercase ${getStatusBadgeClass
|
|
4676
|
+
className: `uppercase ${getStatusBadgeClass(swap.status)}`,
|
|
4533
4677
|
children: swap.status.replace(/_/g, " ")
|
|
4534
4678
|
}
|
|
4535
4679
|
)
|
|
@@ -4597,7 +4741,7 @@ const SwapDetailPage = () => {
|
|
|
4597
4741
|
Badge,
|
|
4598
4742
|
{
|
|
4599
4743
|
size: "2xsmall",
|
|
4600
|
-
className: `uppercase ${getStatusBadgeClass
|
|
4744
|
+
className: `uppercase ${getStatusBadgeClass(entry.status)}`,
|
|
4601
4745
|
children: entry.status.replace(/_/g, " ")
|
|
4602
4746
|
}
|
|
4603
4747
|
) }),
|
|
@@ -4625,7 +4769,7 @@ const SwapDetailPage = () => {
|
|
|
4625
4769
|
] }),
|
|
4626
4770
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
4627
4771
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
4628
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: order.customer
|
|
4772
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: ((_c = order.customer) == null ? void 0 : _c.email) || order.email || "—" })
|
|
4629
4773
|
] }),
|
|
4630
4774
|
order.total && /* @__PURE__ */ jsxs("div", { children: [
|
|
4631
4775
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
@@ -4666,268 +4810,120 @@ const SwapDetailPage = () => {
|
|
|
4666
4810
|
] })
|
|
4667
4811
|
] }) });
|
|
4668
4812
|
};
|
|
4669
|
-
const config
|
|
4813
|
+
const config = defineRouteConfig({
|
|
4670
4814
|
label: "Swap Details",
|
|
4671
4815
|
icon: ArrowPath
|
|
4672
4816
|
});
|
|
4673
|
-
const getStatusBadgeClass = (status) => {
|
|
4674
|
-
const s2 = status.toLowerCase();
|
|
4675
|
-
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
4676
|
-
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
4677
|
-
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
4678
|
-
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
4679
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
4680
|
-
};
|
|
4681
|
-
const PaymentDetailPage = () => {
|
|
4682
|
-
const navigate = useNavigate();
|
|
4683
|
-
const params = useParams();
|
|
4684
|
-
const id = params?.id?.trim();
|
|
4685
|
-
const [detail, setDetail] = useState(null);
|
|
4686
|
-
const [loading, setLoading] = useState(!!id);
|
|
4687
|
-
const [error, setError] = useState(null);
|
|
4688
|
-
useEffect(() => {
|
|
4689
|
-
if (!id) {
|
|
4690
|
-
setLoading(false);
|
|
4691
|
-
return;
|
|
4692
|
-
}
|
|
4693
|
-
let cancelled = false;
|
|
4694
|
-
setLoading(true);
|
|
4695
|
-
setError(null);
|
|
4696
|
-
fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
|
|
4697
|
-
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
4698
|
-
return res.json();
|
|
4699
|
-
}).then((data) => {
|
|
4700
|
-
if (!cancelled) setDetail(data);
|
|
4701
|
-
}).catch((e) => {
|
|
4702
|
-
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
4703
|
-
}).finally(() => {
|
|
4704
|
-
if (!cancelled) setLoading(false);
|
|
4705
|
-
});
|
|
4706
|
-
return () => {
|
|
4707
|
-
cancelled = true;
|
|
4708
|
-
};
|
|
4709
|
-
}, [id]);
|
|
4710
|
-
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
4711
|
-
const sessionStatusRaw = detail?.session_status ?? "—";
|
|
4712
|
-
const paymentStatusRaw = detail?.payment_id != null ? detail?.payment_status ?? "—" : "—";
|
|
4713
|
-
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
4714
|
-
return /* @__PURE__ */ jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxs(Container, { className: "mx-auto flex w-full max-w-4xl flex-col gap-6 p-6", children: [
|
|
4715
|
-
/* @__PURE__ */ jsx("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
4716
|
-
/* @__PURE__ */ jsx(Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
4717
|
-
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Payment session" }),
|
|
4718
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
|
|
4719
|
-
] }) }),
|
|
4720
|
-
error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
4721
|
-
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
4722
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
|
|
4723
|
-
] }) : loading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading…" }) }) : detail ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
4724
|
-
/* @__PURE__ */ jsx("div", { className: "rounded-xl border border-ui-border-base p-6 flex flex-col gap-4", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
4725
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4726
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
|
|
4727
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsx(
|
|
4728
|
-
Button,
|
|
4729
|
-
{
|
|
4730
|
-
variant: "transparent",
|
|
4731
|
-
size: "small",
|
|
4732
|
-
onClick: () => navigate(`/orders/${detail.order_id}`),
|
|
4733
|
-
children: detail.order_id
|
|
4734
|
-
}
|
|
4735
|
-
) : /* @__PURE__ */ jsx(Text, { children: "—" }) })
|
|
4736
|
-
] }),
|
|
4737
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4738
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
4739
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: displayAmount })
|
|
4740
|
-
] }),
|
|
4741
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4742
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
4743
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.provider_id })
|
|
4744
|
-
] }),
|
|
4745
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4746
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
4747
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
|
|
4748
|
-
Badge,
|
|
4749
|
-
{
|
|
4750
|
-
size: "2xsmall",
|
|
4751
|
-
className: `uppercase ${getStatusBadgeClass(displayStatus)}`,
|
|
4752
|
-
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
4753
|
-
}
|
|
4754
|
-
) })
|
|
4755
|
-
] }),
|
|
4756
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4757
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
4758
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
4759
|
-
] }),
|
|
4760
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4761
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
4762
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
4763
|
-
] }),
|
|
4764
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4765
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
4766
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
4767
|
-
] }),
|
|
4768
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4769
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
4770
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
4771
|
-
year: "numeric",
|
|
4772
|
-
month: "short",
|
|
4773
|
-
day: "numeric",
|
|
4774
|
-
hour: "numeric",
|
|
4775
|
-
minute: "2-digit",
|
|
4776
|
-
hour12: true
|
|
4777
|
-
}) })
|
|
4778
|
-
] })
|
|
4779
|
-
] }) }),
|
|
4780
|
-
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
4781
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
4782
|
-
/* @__PURE__ */ jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.data, null, 2) })
|
|
4783
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "rounded-xl border border-ui-border-base p-6", children: /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "No provider data for this session." }) })
|
|
4784
|
-
] }) : null
|
|
4785
|
-
] }) });
|
|
4786
|
-
};
|
|
4787
|
-
const config = defineRouteConfig({
|
|
4788
|
-
label: "Payment details",
|
|
4789
|
-
icon: CreditCard
|
|
4790
|
-
});
|
|
4791
4817
|
const i18nTranslations0 = {};
|
|
4792
4818
|
const widgetModule = { widgets: [
|
|
4793
4819
|
{
|
|
4794
4820
|
Component: OrderGiftItemsWidget,
|
|
4795
|
-
zone: ["order.details.side.after"]
|
|
4796
|
-
widgetId: "Widget-b753"
|
|
4821
|
+
zone: ["order.details.side.after"]
|
|
4797
4822
|
},
|
|
4798
4823
|
{
|
|
4799
4824
|
Component: OrderRefundContextWidget,
|
|
4800
|
-
zone: ["order.details.after"]
|
|
4801
|
-
widgetId: "Widget-0606"
|
|
4825
|
+
zone: ["order.details.after"]
|
|
4802
4826
|
}
|
|
4803
4827
|
] };
|
|
4804
4828
|
const routeModule = {
|
|
4805
4829
|
routes: [
|
|
4806
4830
|
{
|
|
4807
4831
|
Component: DeletedRecordsPage,
|
|
4808
|
-
path: "/deleted-records-audit"
|
|
4809
|
-
|
|
4832
|
+
path: "/deleted-records-audit"
|
|
4833
|
+
},
|
|
4834
|
+
{
|
|
4835
|
+
Component: PaymentsPage,
|
|
4836
|
+
path: "/payments"
|
|
4810
4837
|
},
|
|
4811
4838
|
{
|
|
4812
4839
|
Component: RefundsPage,
|
|
4813
|
-
path: "/refunds"
|
|
4814
|
-
handle: { label: config$8.label, translationNs: config$8.translationNs }
|
|
4840
|
+
path: "/refunds"
|
|
4815
4841
|
},
|
|
4816
4842
|
{
|
|
4817
4843
|
Component: ReturnsPage,
|
|
4818
|
-
path: "/returns"
|
|
4819
|
-
handle: { label: config$7.label, translationNs: config$7.translationNs }
|
|
4844
|
+
path: "/returns"
|
|
4820
4845
|
},
|
|
4821
4846
|
{
|
|
4822
4847
|
Component: SwapsPage,
|
|
4823
|
-
path: "/swaps"
|
|
4824
|
-
handle: { label: config$6.label, translationNs: config$6.translationNs }
|
|
4825
|
-
},
|
|
4826
|
-
{
|
|
4827
|
-
Component: PaymentsPage,
|
|
4828
|
-
path: "/payments",
|
|
4829
|
-
handle: { label: config$5.label, translationNs: config$5.translationNs }
|
|
4848
|
+
path: "/swaps"
|
|
4830
4849
|
},
|
|
4831
4850
|
{
|
|
4832
4851
|
Component: DeletedRecordDetailPage,
|
|
4833
|
-
path: "/deleted-records-audit/:id"
|
|
4834
|
-
handle: { label: config$4.label, translationNs: config$4.translationNs }
|
|
4852
|
+
path: "/deleted-records-audit/:id"
|
|
4835
4853
|
},
|
|
4836
4854
|
{
|
|
4837
|
-
Component:
|
|
4838
|
-
path: "/
|
|
4839
|
-
handle: { label: config$3.label, translationNs: config$3.translationNs }
|
|
4855
|
+
Component: PaymentDetailPage,
|
|
4856
|
+
path: "/payments/:id"
|
|
4840
4857
|
},
|
|
4841
4858
|
{
|
|
4842
4859
|
Component: ReturnDetailPage,
|
|
4843
|
-
path: "/returns/:id"
|
|
4844
|
-
handle: { label: config$2.label, translationNs: config$2.translationNs }
|
|
4860
|
+
path: "/returns/:id"
|
|
4845
4861
|
},
|
|
4846
4862
|
{
|
|
4847
|
-
Component:
|
|
4848
|
-
path: "/
|
|
4849
|
-
handle: { label: config$1.label, translationNs: config$1.translationNs }
|
|
4863
|
+
Component: RefundDetailPage,
|
|
4864
|
+
path: "/refunds/:id"
|
|
4850
4865
|
},
|
|
4851
4866
|
{
|
|
4852
|
-
Component:
|
|
4853
|
-
path: "/
|
|
4854
|
-
handle: { label: config.label, translationNs: config.translationNs }
|
|
4867
|
+
Component: SwapDetailPage,
|
|
4868
|
+
path: "/swaps/:id"
|
|
4855
4869
|
}
|
|
4856
4870
|
]
|
|
4857
4871
|
};
|
|
4858
4872
|
const menuItemModule = {
|
|
4859
4873
|
menuItems: [
|
|
4860
4874
|
{
|
|
4861
|
-
label: config$
|
|
4862
|
-
icon: config$
|
|
4875
|
+
label: config$8.label,
|
|
4876
|
+
icon: config$8.icon,
|
|
4863
4877
|
path: "/deleted-records-audit",
|
|
4864
|
-
nested: void 0
|
|
4865
|
-
rank: void 0,
|
|
4866
|
-
translationNs: void 0
|
|
4878
|
+
nested: void 0
|
|
4867
4879
|
},
|
|
4868
4880
|
{
|
|
4869
|
-
label: config$
|
|
4870
|
-
icon: config$
|
|
4881
|
+
label: config$7.label,
|
|
4882
|
+
icon: config$7.icon,
|
|
4871
4883
|
path: "/payments",
|
|
4872
|
-
nested: void 0
|
|
4873
|
-
rank: void 0,
|
|
4874
|
-
translationNs: void 0
|
|
4884
|
+
nested: void 0
|
|
4875
4885
|
},
|
|
4876
4886
|
{
|
|
4877
4887
|
label: config$6.label,
|
|
4878
4888
|
icon: config$6.icon,
|
|
4879
|
-
path: "/
|
|
4880
|
-
nested: void 0
|
|
4881
|
-
rank: void 0,
|
|
4882
|
-
translationNs: void 0
|
|
4889
|
+
path: "/refunds",
|
|
4890
|
+
nested: void 0
|
|
4883
4891
|
},
|
|
4884
4892
|
{
|
|
4885
|
-
label: config$
|
|
4886
|
-
icon: config$
|
|
4893
|
+
label: config$5.label,
|
|
4894
|
+
icon: config$5.icon,
|
|
4887
4895
|
path: "/returns",
|
|
4888
|
-
nested: void 0
|
|
4889
|
-
rank: void 0,
|
|
4890
|
-
translationNs: void 0
|
|
4891
|
-
},
|
|
4892
|
-
{
|
|
4893
|
-
label: config$8.label,
|
|
4894
|
-
icon: config$8.icon,
|
|
4895
|
-
path: "/refunds",
|
|
4896
|
-
nested: void 0,
|
|
4897
|
-
rank: void 0,
|
|
4898
|
-
translationNs: void 0
|
|
4896
|
+
nested: void 0
|
|
4899
4897
|
},
|
|
4900
4898
|
{
|
|
4901
|
-
label: config.label,
|
|
4902
|
-
icon: config.icon,
|
|
4903
|
-
path: "/
|
|
4904
|
-
nested: void 0
|
|
4905
|
-
rank: void 0,
|
|
4906
|
-
translationNs: void 0
|
|
4899
|
+
label: config$4.label,
|
|
4900
|
+
icon: config$4.icon,
|
|
4901
|
+
path: "/swaps",
|
|
4902
|
+
nested: void 0
|
|
4907
4903
|
},
|
|
4908
4904
|
{
|
|
4909
4905
|
label: config$1.label,
|
|
4910
4906
|
icon: config$1.icon,
|
|
4911
|
-
path: "/
|
|
4912
|
-
nested: void 0
|
|
4913
|
-
|
|
4914
|
-
|
|
4907
|
+
path: "/refunds/:id",
|
|
4908
|
+
nested: void 0
|
|
4909
|
+
},
|
|
4910
|
+
{
|
|
4911
|
+
label: config$3.label,
|
|
4912
|
+
icon: config$3.icon,
|
|
4913
|
+
path: "/payments/:id",
|
|
4914
|
+
nested: void 0
|
|
4915
4915
|
},
|
|
4916
4916
|
{
|
|
4917
4917
|
label: config$2.label,
|
|
4918
4918
|
icon: config$2.icon,
|
|
4919
4919
|
path: "/returns/:id",
|
|
4920
|
-
nested: void 0
|
|
4921
|
-
rank: void 0,
|
|
4922
|
-
translationNs: void 0
|
|
4920
|
+
nested: void 0
|
|
4923
4921
|
},
|
|
4924
4922
|
{
|
|
4925
|
-
label: config
|
|
4926
|
-
icon: config
|
|
4927
|
-
path: "/
|
|
4928
|
-
nested: void 0
|
|
4929
|
-
rank: void 0,
|
|
4930
|
-
translationNs: void 0
|
|
4923
|
+
label: config.label,
|
|
4924
|
+
icon: config.icon,
|
|
4925
|
+
path: "/swaps/:id",
|
|
4926
|
+
nested: void 0
|
|
4931
4927
|
}
|
|
4932
4928
|
]
|
|
4933
4929
|
};
|
|
@@ -4936,19 +4932,13 @@ const displayModule = {
|
|
|
4936
4932
|
displays: {}
|
|
4937
4933
|
};
|
|
4938
4934
|
const i18nModule = { resources: i18nTranslations0 };
|
|
4939
|
-
const cellRendererModule = {};
|
|
4940
|
-
const layoutModule = { layouts: [] };
|
|
4941
|
-
const searchEntityModule = {};
|
|
4942
4935
|
const plugin = {
|
|
4943
4936
|
widgetModule,
|
|
4944
4937
|
routeModule,
|
|
4945
4938
|
menuItemModule,
|
|
4946
4939
|
formModule,
|
|
4947
4940
|
displayModule,
|
|
4948
|
-
i18nModule
|
|
4949
|
-
cellRendererModule,
|
|
4950
|
-
layoutModule,
|
|
4951
|
-
searchEntityModule
|
|
4941
|
+
i18nModule
|
|
4952
4942
|
};
|
|
4953
4943
|
export {
|
|
4954
4944
|
plugin as default
|