order-management 0.0.84 → 0.0.85
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.
|
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { defineWidgetConfig, defineRouteConfig } from "@medusajs/admin-sdk";
|
|
3
3
|
import { useState, useEffect, useRef, useCallback, useMemo } from "react";
|
|
4
4
|
import { Container, Text, Heading, Badge, Button, Label, Select, Textarea, Input } from "@medusajs/ui";
|
|
5
|
-
import { CashSolid, PencilSquareSolid, Trash,
|
|
5
|
+
import { CashSolid, PencilSquareSolid, Trash, CreditCard, ArrowPath, Receipt, ArrowLeft, CheckCircle } from "@medusajs/icons";
|
|
6
6
|
import { useNavigate, useParams } from "react-router-dom";
|
|
7
7
|
function roundRectPath(ctx, x, y, w, h, r) {
|
|
8
8
|
ctx.beginPath();
|
|
@@ -865,238 +865,6 @@ const useDebounce$3 = (value, delay) => {
|
|
|
865
865
|
return debouncedValue;
|
|
866
866
|
};
|
|
867
867
|
const getStatusBadgeClass$7 = (status) => {
|
|
868
|
-
const statusLower = status.toLowerCase();
|
|
869
|
-
if (statusLower === "requested") {
|
|
870
|
-
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
871
|
-
}
|
|
872
|
-
if (statusLower === "received") {
|
|
873
|
-
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
874
|
-
}
|
|
875
|
-
if (statusLower === "requires_action") {
|
|
876
|
-
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
877
|
-
}
|
|
878
|
-
if (statusLower === "completed") {
|
|
879
|
-
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
880
|
-
}
|
|
881
|
-
if (statusLower === "canceled") {
|
|
882
|
-
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
883
|
-
}
|
|
884
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
885
|
-
};
|
|
886
|
-
const ReturnsPage = () => {
|
|
887
|
-
const navigate = useNavigate();
|
|
888
|
-
const [items, setItems] = useState([]);
|
|
889
|
-
const [statusFilter, setStatusFilter] = useState("all");
|
|
890
|
-
const [createdByFilter, setCreatedByFilter] = useState("all");
|
|
891
|
-
const [searchQuery, setSearchQuery] = useState("");
|
|
892
|
-
const debouncedSearchQuery = useDebounce$3(searchQuery, 300);
|
|
893
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
894
|
-
const [isFetchingMore, setIsFetchingMore] = useState(false);
|
|
895
|
-
const [error, setError] = useState(null);
|
|
896
|
-
const [offset, setOffset] = useState(0);
|
|
897
|
-
const [count, setCount] = useState(0);
|
|
898
|
-
const limit = 50;
|
|
899
|
-
const loadReturns = useCallback(
|
|
900
|
-
async (nextOffset, replace = false) => {
|
|
901
|
-
var _a;
|
|
902
|
-
try {
|
|
903
|
-
if (replace) {
|
|
904
|
-
setIsLoading(true);
|
|
905
|
-
} else {
|
|
906
|
-
setIsFetchingMore(true);
|
|
907
|
-
}
|
|
908
|
-
setError(null);
|
|
909
|
-
const params = new URLSearchParams();
|
|
910
|
-
params.set("limit", String(limit));
|
|
911
|
-
params.set("offset", String(nextOffset));
|
|
912
|
-
if (statusFilter !== "all") {
|
|
913
|
-
params.set("status", statusFilter);
|
|
914
|
-
}
|
|
915
|
-
if (debouncedSearchQuery.trim()) {
|
|
916
|
-
params.set("q", debouncedSearchQuery.trim());
|
|
917
|
-
}
|
|
918
|
-
if (createdByFilter !== "all") {
|
|
919
|
-
params.set("created_by", createdByFilter);
|
|
920
|
-
}
|
|
921
|
-
params.set("order", "created_at");
|
|
922
|
-
const response = await fetch(
|
|
923
|
-
`/admin/return?${params.toString()}`,
|
|
924
|
-
{ credentials: "include" }
|
|
925
|
-
);
|
|
926
|
-
if (!response.ok) {
|
|
927
|
-
const message = await response.text();
|
|
928
|
-
throw new Error(message || "Unable to load return orders");
|
|
929
|
-
}
|
|
930
|
-
const payload = await response.json();
|
|
931
|
-
setCount(payload.count ?? 0);
|
|
932
|
-
setOffset(nextOffset + (((_a = payload.returns) == null ? void 0 : _a.length) ?? 0));
|
|
933
|
-
setItems(
|
|
934
|
-
(prev) => replace ? payload.returns ?? [] : [...prev, ...payload.returns ?? []]
|
|
935
|
-
);
|
|
936
|
-
} catch (loadError) {
|
|
937
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load return orders";
|
|
938
|
-
setError(message);
|
|
939
|
-
} finally {
|
|
940
|
-
setIsLoading(false);
|
|
941
|
-
setIsFetchingMore(false);
|
|
942
|
-
}
|
|
943
|
-
},
|
|
944
|
-
[statusFilter, createdByFilter, debouncedSearchQuery]
|
|
945
|
-
);
|
|
946
|
-
useEffect(() => {
|
|
947
|
-
void loadReturns(0, true);
|
|
948
|
-
}, [statusFilter, createdByFilter, debouncedSearchQuery, loadReturns]);
|
|
949
|
-
const hasMore = useMemo(() => offset < count, [offset, count]);
|
|
950
|
-
const availableStatuses = useMemo(() => {
|
|
951
|
-
const statuses = /* @__PURE__ */ new Set();
|
|
952
|
-
items.forEach((item) => statuses.add(item.status));
|
|
953
|
-
return Array.from(statuses).sort();
|
|
954
|
-
}, [items]);
|
|
955
|
-
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: [
|
|
956
|
-
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
957
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
958
|
-
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Return Orders" }),
|
|
959
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer return orders" })
|
|
960
|
-
] }),
|
|
961
|
-
/* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () => loadReturns(0, true), children: "Refresh" })
|
|
962
|
-
] }),
|
|
963
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
964
|
-
/* @__PURE__ */ jsx(
|
|
965
|
-
Input,
|
|
966
|
-
{
|
|
967
|
-
placeholder: "Search by return ID, order ID, or customer email",
|
|
968
|
-
value: searchQuery,
|
|
969
|
-
onChange: (event) => setSearchQuery(event.target.value),
|
|
970
|
-
className: "md:max-w-sm"
|
|
971
|
-
}
|
|
972
|
-
),
|
|
973
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
974
|
-
/* @__PURE__ */ jsxs(
|
|
975
|
-
"select",
|
|
976
|
-
{
|
|
977
|
-
value: createdByFilter,
|
|
978
|
-
onChange: (event) => setCreatedByFilter(event.target.value),
|
|
979
|
-
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",
|
|
980
|
-
children: [
|
|
981
|
-
/* @__PURE__ */ jsx("option", { value: "all", children: "All (Created by)" }),
|
|
982
|
-
/* @__PURE__ */ jsx("option", { value: "customer", children: "Customer" }),
|
|
983
|
-
/* @__PURE__ */ jsx("option", { value: "admin", children: "Admin" })
|
|
984
|
-
]
|
|
985
|
-
}
|
|
986
|
-
),
|
|
987
|
-
/* @__PURE__ */ jsxs(
|
|
988
|
-
"select",
|
|
989
|
-
{
|
|
990
|
-
value: statusFilter,
|
|
991
|
-
onChange: (event) => setStatusFilter(event.target.value),
|
|
992
|
-
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",
|
|
993
|
-
children: [
|
|
994
|
-
/* @__PURE__ */ jsx("option", { value: "all", children: "All Statuses" }),
|
|
995
|
-
availableStatuses.map((status) => /* @__PURE__ */ jsx("option", { value: status, children: status.replace(/_/g, " ").toUpperCase() }, status))
|
|
996
|
-
]
|
|
997
|
-
}
|
|
998
|
-
)
|
|
999
|
-
] })
|
|
1000
|
-
] }),
|
|
1001
|
-
error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1002
|
-
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1003
|
-
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(
|
|
1004
|
-
Button,
|
|
1005
|
-
{
|
|
1006
|
-
variant: "secondary",
|
|
1007
|
-
onClick: () => loadReturns(0, true),
|
|
1008
|
-
children: "Try again"
|
|
1009
|
-
}
|
|
1010
|
-
) })
|
|
1011
|
-
] }) : null,
|
|
1012
|
-
isLoading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading return orders..." }) }) : items.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
1013
|
-
/* @__PURE__ */ jsx(Heading, { level: "h3", className: "text-xl", children: "No return orders yet" }),
|
|
1014
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Return orders created by customers will appear here." })
|
|
1015
|
-
] }) : /* @__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: [
|
|
1016
|
-
/* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
1017
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Return ID" }),
|
|
1018
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
1019
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Customer" }),
|
|
1020
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
1021
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Refund Amount" }),
|
|
1022
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1023
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1024
|
-
] }) }),
|
|
1025
|
-
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((returnOrder) => /* @__PURE__ */ jsxs(
|
|
1026
|
-
"tr",
|
|
1027
|
-
{
|
|
1028
|
-
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1029
|
-
onClick: () => navigate(`/returns/${returnOrder.id}`),
|
|
1030
|
-
children: [
|
|
1031
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5", children: /* @__PURE__ */ jsx("span", { children: returnOrder.id }) }) }),
|
|
1032
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.order_id }),
|
|
1033
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.customer_email || returnOrder.order_email || "—" }),
|
|
1034
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx(
|
|
1035
|
-
Badge,
|
|
1036
|
-
{
|
|
1037
|
-
size: "2xsmall",
|
|
1038
|
-
className: `uppercase ${getStatusBadgeClass$7(returnOrder.status)}`,
|
|
1039
|
-
children: returnOrder.status.replace(/_/g, " ")
|
|
1040
|
-
}
|
|
1041
|
-
) }),
|
|
1042
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
|
|
1043
|
-
const amount = returnOrder.refund_amount;
|
|
1044
|
-
if (amount == null || amount === void 0) {
|
|
1045
|
-
return "—";
|
|
1046
|
-
}
|
|
1047
|
-
const displayAmount = Number(amount) / 100;
|
|
1048
|
-
const currency = returnOrder.currency_code || "$";
|
|
1049
|
-
return `${currency}${displayAmount.toFixed(2)}`;
|
|
1050
|
-
})() }),
|
|
1051
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(returnOrder.created_at).toLocaleDateString("en-US", {
|
|
1052
|
-
year: "numeric",
|
|
1053
|
-
month: "short",
|
|
1054
|
-
day: "numeric",
|
|
1055
|
-
hour: "numeric",
|
|
1056
|
-
minute: "2-digit",
|
|
1057
|
-
hour12: true
|
|
1058
|
-
}) }),
|
|
1059
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx(
|
|
1060
|
-
Button,
|
|
1061
|
-
{
|
|
1062
|
-
variant: "transparent",
|
|
1063
|
-
size: "small",
|
|
1064
|
-
onClick: (e) => {
|
|
1065
|
-
e.stopPropagation();
|
|
1066
|
-
navigate(`/app/orders/${returnOrder.order_id}`);
|
|
1067
|
-
},
|
|
1068
|
-
children: "Go to order"
|
|
1069
|
-
}
|
|
1070
|
-
) })
|
|
1071
|
-
]
|
|
1072
|
-
},
|
|
1073
|
-
returnOrder.id
|
|
1074
|
-
)) })
|
|
1075
|
-
] }) }),
|
|
1076
|
-
hasMore ? /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx(
|
|
1077
|
-
Button,
|
|
1078
|
-
{
|
|
1079
|
-
variant: "secondary",
|
|
1080
|
-
isLoading: isFetchingMore,
|
|
1081
|
-
onClick: () => loadReturns(offset, false),
|
|
1082
|
-
children: "Load more"
|
|
1083
|
-
}
|
|
1084
|
-
) }) : null
|
|
1085
|
-
] }) });
|
|
1086
|
-
};
|
|
1087
|
-
const config$7 = defineRouteConfig({
|
|
1088
|
-
label: "Return Orders",
|
|
1089
|
-
icon: ArrowPath
|
|
1090
|
-
});
|
|
1091
|
-
const useDebounce$2 = (value, delay) => {
|
|
1092
|
-
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
1093
|
-
useEffect(() => {
|
|
1094
|
-
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
1095
|
-
return () => clearTimeout(handler);
|
|
1096
|
-
}, [value, delay]);
|
|
1097
|
-
return debouncedValue;
|
|
1098
|
-
};
|
|
1099
|
-
const getStatusBadgeClass$6 = (status) => {
|
|
1100
868
|
const s2 = status.toLowerCase();
|
|
1101
869
|
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1102
870
|
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
@@ -1109,7 +877,7 @@ const PaymentsPage = () => {
|
|
|
1109
877
|
const [items, setItems] = useState([]);
|
|
1110
878
|
const [statusFilter, setStatusFilter] = useState("all");
|
|
1111
879
|
const [orderIdSearch, setOrderIdSearch] = useState("");
|
|
1112
|
-
const debouncedOrderId = useDebounce$
|
|
880
|
+
const debouncedOrderId = useDebounce$3(orderIdSearch, 300);
|
|
1113
881
|
const [isLoading, setIsLoading] = useState(true);
|
|
1114
882
|
const [isFetchingMore, setIsFetchingMore] = useState(false);
|
|
1115
883
|
const [error, setError] = useState(null);
|
|
@@ -1229,7 +997,7 @@ const PaymentsPage = () => {
|
|
|
1229
997
|
Badge,
|
|
1230
998
|
{
|
|
1231
999
|
size: "2xsmall",
|
|
1232
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
1000
|
+
className: `uppercase ${getStatusBadgeClass$7(displayStatus(t))}`,
|
|
1233
1001
|
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
1234
1002
|
}
|
|
1235
1003
|
) }),
|
|
@@ -1284,11 +1052,11 @@ const PaymentsPage = () => {
|
|
|
1284
1052
|
) }) : null
|
|
1285
1053
|
] }) });
|
|
1286
1054
|
};
|
|
1287
|
-
const config$
|
|
1055
|
+
const config$7 = defineRouteConfig({
|
|
1288
1056
|
label: "Payments",
|
|
1289
1057
|
icon: CreditCard
|
|
1290
1058
|
});
|
|
1291
|
-
const useDebounce$
|
|
1059
|
+
const useDebounce$2 = (value, delay) => {
|
|
1292
1060
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
1293
1061
|
useEffect(() => {
|
|
1294
1062
|
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
@@ -1296,28 +1064,258 @@ const useDebounce$1 = (value, delay) => {
|
|
|
1296
1064
|
}, [value, delay]);
|
|
1297
1065
|
return debouncedValue;
|
|
1298
1066
|
};
|
|
1299
|
-
const getStatusBadgeClass$
|
|
1300
|
-
const
|
|
1301
|
-
if (
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
if (
|
|
1305
|
-
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
const
|
|
1320
|
-
const [
|
|
1067
|
+
const getStatusBadgeClass$6 = (status) => {
|
|
1068
|
+
const statusLower = status.toLowerCase();
|
|
1069
|
+
if (statusLower === "requested") {
|
|
1070
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1071
|
+
}
|
|
1072
|
+
if (statusLower === "approved") {
|
|
1073
|
+
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1074
|
+
}
|
|
1075
|
+
if (statusLower === "rejected") {
|
|
1076
|
+
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1077
|
+
}
|
|
1078
|
+
if (statusLower === "completed") {
|
|
1079
|
+
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1080
|
+
}
|
|
1081
|
+
if (statusLower === "cancelled") {
|
|
1082
|
+
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
1083
|
+
}
|
|
1084
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1085
|
+
};
|
|
1086
|
+
const SwapsPage = () => {
|
|
1087
|
+
const navigate = useNavigate();
|
|
1088
|
+
const [items, setItems] = useState([]);
|
|
1089
|
+
const [statusFilter, setStatusFilter] = useState("all");
|
|
1090
|
+
const [createdByFilter, setCreatedByFilter] = useState("all");
|
|
1091
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
1092
|
+
const debouncedSearchQuery = useDebounce$2(searchQuery, 300);
|
|
1093
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
1094
|
+
const [isFetchingMore, setIsFetchingMore] = useState(false);
|
|
1095
|
+
const [error, setError] = useState(null);
|
|
1096
|
+
const [offset, setOffset] = useState(0);
|
|
1097
|
+
const [count, setCount] = useState(0);
|
|
1098
|
+
const limit = 50;
|
|
1099
|
+
const loadSwaps = useCallback(
|
|
1100
|
+
async (nextOffset, replace = false) => {
|
|
1101
|
+
var _a;
|
|
1102
|
+
try {
|
|
1103
|
+
if (replace) {
|
|
1104
|
+
setIsLoading(true);
|
|
1105
|
+
} else {
|
|
1106
|
+
setIsFetchingMore(true);
|
|
1107
|
+
}
|
|
1108
|
+
setError(null);
|
|
1109
|
+
const params = new URLSearchParams();
|
|
1110
|
+
params.set("limit", String(limit));
|
|
1111
|
+
params.set("offset", String(nextOffset));
|
|
1112
|
+
if (statusFilter !== "all") {
|
|
1113
|
+
params.set("status", statusFilter);
|
|
1114
|
+
}
|
|
1115
|
+
if (debouncedSearchQuery.trim()) {
|
|
1116
|
+
params.set("order_id", debouncedSearchQuery.trim());
|
|
1117
|
+
}
|
|
1118
|
+
if (createdByFilter !== "all") {
|
|
1119
|
+
params.set("created_by", createdByFilter);
|
|
1120
|
+
}
|
|
1121
|
+
const response = await fetch(
|
|
1122
|
+
`/admin/swaps?${params.toString()}`,
|
|
1123
|
+
{ credentials: "include" }
|
|
1124
|
+
);
|
|
1125
|
+
if (!response.ok) {
|
|
1126
|
+
const message = await response.text();
|
|
1127
|
+
throw new Error(message || "Unable to load swaps");
|
|
1128
|
+
}
|
|
1129
|
+
const payload = await response.json();
|
|
1130
|
+
setCount(payload.count ?? 0);
|
|
1131
|
+
setOffset(nextOffset + (((_a = payload.swaps) == null ? void 0 : _a.length) ?? 0));
|
|
1132
|
+
setItems(
|
|
1133
|
+
(prev) => replace ? payload.swaps ?? [] : [...prev, ...payload.swaps ?? []]
|
|
1134
|
+
);
|
|
1135
|
+
} catch (loadError) {
|
|
1136
|
+
const message = loadError instanceof Error ? loadError.message : "Unable to load swaps";
|
|
1137
|
+
setError(message);
|
|
1138
|
+
} finally {
|
|
1139
|
+
setIsLoading(false);
|
|
1140
|
+
setIsFetchingMore(false);
|
|
1141
|
+
}
|
|
1142
|
+
},
|
|
1143
|
+
[statusFilter, createdByFilter, debouncedSearchQuery]
|
|
1144
|
+
);
|
|
1145
|
+
useEffect(() => {
|
|
1146
|
+
void loadSwaps(0, true);
|
|
1147
|
+
}, [statusFilter, createdByFilter, debouncedSearchQuery, loadSwaps]);
|
|
1148
|
+
const hasMore = useMemo(() => offset < count, [offset, count]);
|
|
1149
|
+
const availableStatuses = useMemo(() => {
|
|
1150
|
+
const statuses = /* @__PURE__ */ new Set();
|
|
1151
|
+
items.forEach((item) => statuses.add(item.status));
|
|
1152
|
+
return Array.from(statuses).sort();
|
|
1153
|
+
}, [items]);
|
|
1154
|
+
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: [
|
|
1155
|
+
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1156
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1157
|
+
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Exchanges" }),
|
|
1158
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer exchange requests" })
|
|
1159
|
+
] }),
|
|
1160
|
+
/* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () => loadSwaps(0, true), children: "Refresh" })
|
|
1161
|
+
] }),
|
|
1162
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1163
|
+
/* @__PURE__ */ jsx(
|
|
1164
|
+
Input,
|
|
1165
|
+
{
|
|
1166
|
+
placeholder: "Search by swap ID or order ID",
|
|
1167
|
+
value: searchQuery,
|
|
1168
|
+
onChange: (event) => setSearchQuery(event.target.value),
|
|
1169
|
+
className: "md:max-w-sm"
|
|
1170
|
+
}
|
|
1171
|
+
),
|
|
1172
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
1173
|
+
/* @__PURE__ */ jsxs(
|
|
1174
|
+
"select",
|
|
1175
|
+
{
|
|
1176
|
+
value: createdByFilter,
|
|
1177
|
+
onChange: (event) => setCreatedByFilter(event.target.value),
|
|
1178
|
+
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",
|
|
1179
|
+
children: [
|
|
1180
|
+
/* @__PURE__ */ jsx("option", { value: "all", children: "All (Created by)" }),
|
|
1181
|
+
/* @__PURE__ */ jsx("option", { value: "customer", children: "Customer" }),
|
|
1182
|
+
/* @__PURE__ */ jsx("option", { value: "admin", children: "Admin" })
|
|
1183
|
+
]
|
|
1184
|
+
}
|
|
1185
|
+
),
|
|
1186
|
+
/* @__PURE__ */ jsxs(
|
|
1187
|
+
"select",
|
|
1188
|
+
{
|
|
1189
|
+
value: statusFilter,
|
|
1190
|
+
onChange: (event) => setStatusFilter(event.target.value),
|
|
1191
|
+
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",
|
|
1192
|
+
children: [
|
|
1193
|
+
/* @__PURE__ */ jsx("option", { value: "all", children: "All Statuses" }),
|
|
1194
|
+
availableStatuses.map((status) => /* @__PURE__ */ jsx("option", { value: status, children: status.replace(/_/g, " ").toUpperCase() }, status))
|
|
1195
|
+
]
|
|
1196
|
+
}
|
|
1197
|
+
)
|
|
1198
|
+
] })
|
|
1199
|
+
] }),
|
|
1200
|
+
error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1201
|
+
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1202
|
+
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(
|
|
1203
|
+
Button,
|
|
1204
|
+
{
|
|
1205
|
+
variant: "secondary",
|
|
1206
|
+
onClick: () => loadSwaps(0, true),
|
|
1207
|
+
children: "Try again"
|
|
1208
|
+
}
|
|
1209
|
+
) })
|
|
1210
|
+
] }) : null,
|
|
1211
|
+
isLoading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading swaps..." }) }) : items.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
1212
|
+
/* @__PURE__ */ jsx(Heading, { level: "h3", className: "text-xl", children: "No exchanges yet" }),
|
|
1213
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Exchange requests created by customers will appear here." })
|
|
1214
|
+
] }) : /* @__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: [
|
|
1215
|
+
/* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
1216
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Exchange ID" }),
|
|
1217
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
1218
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
1219
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Difference Due" }),
|
|
1220
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1221
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1222
|
+
] }) }),
|
|
1223
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((swap) => /* @__PURE__ */ jsxs(
|
|
1224
|
+
"tr",
|
|
1225
|
+
{
|
|
1226
|
+
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1227
|
+
onClick: () => navigate(`/swaps/${swap.id}`),
|
|
1228
|
+
children: [
|
|
1229
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5", children: /* @__PURE__ */ jsx("span", { children: swap.id }) }) }),
|
|
1230
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: swap.order_id }),
|
|
1231
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx(
|
|
1232
|
+
Badge,
|
|
1233
|
+
{
|
|
1234
|
+
size: "2xsmall",
|
|
1235
|
+
className: `uppercase ${getStatusBadgeClass$6(swap.status)}`,
|
|
1236
|
+
children: swap.status.replace(/_/g, " ")
|
|
1237
|
+
}
|
|
1238
|
+
) }),
|
|
1239
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
|
|
1240
|
+
const amount = swap.difference_due;
|
|
1241
|
+
if (amount == null || amount === void 0) {
|
|
1242
|
+
return "—";
|
|
1243
|
+
}
|
|
1244
|
+
const displayAmount = Number(amount) / 100;
|
|
1245
|
+
const currency = swap.currency_code || "$";
|
|
1246
|
+
const sign = displayAmount >= 0 ? "+" : "";
|
|
1247
|
+
return `${sign}${currency}${displayAmount.toFixed(2)}`;
|
|
1248
|
+
})() }),
|
|
1249
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(swap.created_at).toLocaleDateString("en-US", {
|
|
1250
|
+
year: "numeric",
|
|
1251
|
+
month: "short",
|
|
1252
|
+
day: "numeric",
|
|
1253
|
+
hour: "numeric",
|
|
1254
|
+
minute: "2-digit",
|
|
1255
|
+
hour12: true
|
|
1256
|
+
}) }),
|
|
1257
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx(
|
|
1258
|
+
Button,
|
|
1259
|
+
{
|
|
1260
|
+
variant: "transparent",
|
|
1261
|
+
size: "small",
|
|
1262
|
+
onClick: (e) => {
|
|
1263
|
+
e.stopPropagation();
|
|
1264
|
+
navigate(`/app/orders/${swap.order_id}`);
|
|
1265
|
+
},
|
|
1266
|
+
children: "Go to order"
|
|
1267
|
+
}
|
|
1268
|
+
) })
|
|
1269
|
+
]
|
|
1270
|
+
},
|
|
1271
|
+
swap.id
|
|
1272
|
+
)) })
|
|
1273
|
+
] }) }),
|
|
1274
|
+
hasMore ? /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx(
|
|
1275
|
+
Button,
|
|
1276
|
+
{
|
|
1277
|
+
variant: "secondary",
|
|
1278
|
+
isLoading: isFetchingMore,
|
|
1279
|
+
onClick: () => loadSwaps(offset, false),
|
|
1280
|
+
children: "Load more"
|
|
1281
|
+
}
|
|
1282
|
+
) }) : null
|
|
1283
|
+
] }) });
|
|
1284
|
+
};
|
|
1285
|
+
const config$6 = defineRouteConfig({
|
|
1286
|
+
label: "Exchanges",
|
|
1287
|
+
icon: ArrowPath
|
|
1288
|
+
});
|
|
1289
|
+
const useDebounce$1 = (value, delay) => {
|
|
1290
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
1291
|
+
useEffect(() => {
|
|
1292
|
+
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
1293
|
+
return () => clearTimeout(handler);
|
|
1294
|
+
}, [value, delay]);
|
|
1295
|
+
return debouncedValue;
|
|
1296
|
+
};
|
|
1297
|
+
const getStatusBadgeClass$5 = (status) => {
|
|
1298
|
+
const s2 = status.toLowerCase();
|
|
1299
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1300
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1301
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1302
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1303
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1304
|
+
};
|
|
1305
|
+
const RefundsPage = () => {
|
|
1306
|
+
const navigate = useNavigate();
|
|
1307
|
+
const [items, setItems] = useState([]);
|
|
1308
|
+
const [orderIdSearch, setOrderIdSearch] = useState("");
|
|
1309
|
+
const debouncedOrderId = useDebounce$1(orderIdSearch, 300);
|
|
1310
|
+
const [paymentStatusFilter, setPaymentStatusFilter] = useState("all");
|
|
1311
|
+
const [providerSearch, setProviderSearch] = useState("");
|
|
1312
|
+
const debouncedProvider = useDebounce$1(providerSearch, 300);
|
|
1313
|
+
const [currencySearch, setCurrencySearch] = useState("");
|
|
1314
|
+
const debouncedCurrency = useDebounce$1(currencySearch, 300);
|
|
1315
|
+
const [dateFrom, setDateFrom] = useState("");
|
|
1316
|
+
const [dateTo, setDateTo] = useState("");
|
|
1317
|
+
const [amountMin, setAmountMin] = useState("");
|
|
1318
|
+
const [amountMax, setAmountMax] = useState("");
|
|
1321
1319
|
const [isLoading, setIsLoading] = useState(true);
|
|
1322
1320
|
const [isFetchingMore, setIsFetchingMore] = useState(false);
|
|
1323
1321
|
const [error, setError] = useState(null);
|
|
@@ -1596,21 +1594,21 @@ const getStatusBadgeClass$4 = (status) => {
|
|
|
1596
1594
|
if (statusLower === "requested") {
|
|
1597
1595
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1598
1596
|
}
|
|
1599
|
-
if (statusLower === "
|
|
1597
|
+
if (statusLower === "received") {
|
|
1600
1598
|
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1601
1599
|
}
|
|
1602
|
-
if (statusLower === "
|
|
1600
|
+
if (statusLower === "requires_action") {
|
|
1603
1601
|
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1604
1602
|
}
|
|
1605
1603
|
if (statusLower === "completed") {
|
|
1606
1604
|
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1607
1605
|
}
|
|
1608
|
-
if (statusLower === "
|
|
1606
|
+
if (statusLower === "canceled") {
|
|
1609
1607
|
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
1610
1608
|
}
|
|
1611
1609
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1612
1610
|
};
|
|
1613
|
-
const
|
|
1611
|
+
const ReturnsPage = () => {
|
|
1614
1612
|
const navigate = useNavigate();
|
|
1615
1613
|
const [items, setItems] = useState([]);
|
|
1616
1614
|
const [statusFilter, setStatusFilter] = useState("all");
|
|
@@ -1623,7 +1621,7 @@ const SwapsPage = () => {
|
|
|
1623
1621
|
const [offset, setOffset] = useState(0);
|
|
1624
1622
|
const [count, setCount] = useState(0);
|
|
1625
1623
|
const limit = 50;
|
|
1626
|
-
const
|
|
1624
|
+
const loadReturns = useCallback(
|
|
1627
1625
|
async (nextOffset, replace = false) => {
|
|
1628
1626
|
var _a;
|
|
1629
1627
|
try {
|
|
@@ -1640,27 +1638,28 @@ const SwapsPage = () => {
|
|
|
1640
1638
|
params.set("status", statusFilter);
|
|
1641
1639
|
}
|
|
1642
1640
|
if (debouncedSearchQuery.trim()) {
|
|
1643
|
-
params.set("
|
|
1641
|
+
params.set("q", debouncedSearchQuery.trim());
|
|
1644
1642
|
}
|
|
1645
1643
|
if (createdByFilter !== "all") {
|
|
1646
1644
|
params.set("created_by", createdByFilter);
|
|
1647
1645
|
}
|
|
1646
|
+
params.set("order", "created_at");
|
|
1648
1647
|
const response = await fetch(
|
|
1649
|
-
`/admin/
|
|
1648
|
+
`/admin/return?${params.toString()}`,
|
|
1650
1649
|
{ credentials: "include" }
|
|
1651
1650
|
);
|
|
1652
1651
|
if (!response.ok) {
|
|
1653
1652
|
const message = await response.text();
|
|
1654
|
-
throw new Error(message || "Unable to load
|
|
1653
|
+
throw new Error(message || "Unable to load return orders");
|
|
1655
1654
|
}
|
|
1656
1655
|
const payload = await response.json();
|
|
1657
1656
|
setCount(payload.count ?? 0);
|
|
1658
|
-
setOffset(nextOffset + (((_a = payload.
|
|
1657
|
+
setOffset(nextOffset + (((_a = payload.returns) == null ? void 0 : _a.length) ?? 0));
|
|
1659
1658
|
setItems(
|
|
1660
|
-
(prev) => replace ? payload.
|
|
1659
|
+
(prev) => replace ? payload.returns ?? [] : [...prev, ...payload.returns ?? []]
|
|
1661
1660
|
);
|
|
1662
1661
|
} catch (loadError) {
|
|
1663
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load
|
|
1662
|
+
const message = loadError instanceof Error ? loadError.message : "Unable to load return orders";
|
|
1664
1663
|
setError(message);
|
|
1665
1664
|
} finally {
|
|
1666
1665
|
setIsLoading(false);
|
|
@@ -1670,8 +1669,8 @@ const SwapsPage = () => {
|
|
|
1670
1669
|
[statusFilter, createdByFilter, debouncedSearchQuery]
|
|
1671
1670
|
);
|
|
1672
1671
|
useEffect(() => {
|
|
1673
|
-
void
|
|
1674
|
-
}, [statusFilter, createdByFilter, debouncedSearchQuery,
|
|
1672
|
+
void loadReturns(0, true);
|
|
1673
|
+
}, [statusFilter, createdByFilter, debouncedSearchQuery, loadReturns]);
|
|
1675
1674
|
const hasMore = useMemo(() => offset < count, [offset, count]);
|
|
1676
1675
|
const availableStatuses = useMemo(() => {
|
|
1677
1676
|
const statuses = /* @__PURE__ */ new Set();
|
|
@@ -1681,16 +1680,16 @@ const SwapsPage = () => {
|
|
|
1681
1680
|
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: [
|
|
1682
1681
|
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1683
1682
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1684
|
-
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "
|
|
1685
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer
|
|
1683
|
+
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Return Orders" }),
|
|
1684
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer return orders" })
|
|
1686
1685
|
] }),
|
|
1687
|
-
/* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () =>
|
|
1686
|
+
/* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () => loadReturns(0, true), children: "Refresh" })
|
|
1688
1687
|
] }),
|
|
1689
1688
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1690
1689
|
/* @__PURE__ */ jsx(
|
|
1691
1690
|
Input,
|
|
1692
1691
|
{
|
|
1693
|
-
placeholder: "Search by
|
|
1692
|
+
placeholder: "Search by return ID, order ID, or customer email",
|
|
1694
1693
|
value: searchQuery,
|
|
1695
1694
|
onChange: (event) => setSearchQuery(event.target.value),
|
|
1696
1695
|
className: "md:max-w-sm"
|
|
@@ -1730,50 +1729,51 @@ const SwapsPage = () => {
|
|
|
1730
1729
|
Button,
|
|
1731
1730
|
{
|
|
1732
1731
|
variant: "secondary",
|
|
1733
|
-
onClick: () =>
|
|
1732
|
+
onClick: () => loadReturns(0, true),
|
|
1734
1733
|
children: "Try again"
|
|
1735
1734
|
}
|
|
1736
1735
|
) })
|
|
1737
1736
|
] }) : null,
|
|
1738
|
-
isLoading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading
|
|
1739
|
-
/* @__PURE__ */ jsx(Heading, { level: "h3", className: "text-xl", children: "No
|
|
1740
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "
|
|
1737
|
+
isLoading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading return orders..." }) }) : items.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
1738
|
+
/* @__PURE__ */ jsx(Heading, { level: "h3", className: "text-xl", children: "No return orders yet" }),
|
|
1739
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Return orders created by customers will appear here." })
|
|
1741
1740
|
] }) : /* @__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: [
|
|
1742
1741
|
/* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
1743
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "
|
|
1742
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Return ID" }),
|
|
1744
1743
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
1744
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Customer" }),
|
|
1745
1745
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
1746
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "
|
|
1746
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Refund Amount" }),
|
|
1747
1747
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1748
1748
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1749
1749
|
] }) }),
|
|
1750
|
-
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((
|
|
1750
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((returnOrder) => /* @__PURE__ */ jsxs(
|
|
1751
1751
|
"tr",
|
|
1752
1752
|
{
|
|
1753
1753
|
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1754
|
-
onClick: () => navigate(`/
|
|
1754
|
+
onClick: () => navigate(`/returns/${returnOrder.id}`),
|
|
1755
1755
|
children: [
|
|
1756
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5", children: /* @__PURE__ */ jsx("span", { children:
|
|
1757
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children:
|
|
1756
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-0.5", children: /* @__PURE__ */ jsx("span", { children: returnOrder.id }) }) }),
|
|
1757
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.order_id }),
|
|
1758
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.customer_email || returnOrder.order_email || "—" }),
|
|
1758
1759
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx(
|
|
1759
1760
|
Badge,
|
|
1760
1761
|
{
|
|
1761
1762
|
size: "2xsmall",
|
|
1762
|
-
className: `uppercase ${getStatusBadgeClass$4(
|
|
1763
|
-
children:
|
|
1763
|
+
className: `uppercase ${getStatusBadgeClass$4(returnOrder.status)}`,
|
|
1764
|
+
children: returnOrder.status.replace(/_/g, " ")
|
|
1764
1765
|
}
|
|
1765
1766
|
) }),
|
|
1766
1767
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
|
|
1767
|
-
const amount =
|
|
1768
|
+
const amount = returnOrder.refund_amount;
|
|
1768
1769
|
if (amount == null || amount === void 0) {
|
|
1769
1770
|
return "—";
|
|
1770
1771
|
}
|
|
1771
1772
|
const displayAmount = Number(amount) / 100;
|
|
1772
|
-
const currency =
|
|
1773
|
-
|
|
1774
|
-
return `${sign}${currency}${displayAmount.toFixed(2)}`;
|
|
1773
|
+
const currency = returnOrder.currency_code || "$";
|
|
1774
|
+
return `${currency}${displayAmount.toFixed(2)}`;
|
|
1775
1775
|
})() }),
|
|
1776
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(
|
|
1776
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(returnOrder.created_at).toLocaleDateString("en-US", {
|
|
1777
1777
|
year: "numeric",
|
|
1778
1778
|
month: "short",
|
|
1779
1779
|
day: "numeric",
|
|
@@ -1788,14 +1788,14 @@ const SwapsPage = () => {
|
|
|
1788
1788
|
size: "small",
|
|
1789
1789
|
onClick: (e) => {
|
|
1790
1790
|
e.stopPropagation();
|
|
1791
|
-
navigate(`/app/orders/${
|
|
1791
|
+
navigate(`/app/orders/${returnOrder.order_id}`);
|
|
1792
1792
|
},
|
|
1793
1793
|
children: "Go to order"
|
|
1794
1794
|
}
|
|
1795
1795
|
) })
|
|
1796
1796
|
]
|
|
1797
1797
|
},
|
|
1798
|
-
|
|
1798
|
+
returnOrder.id
|
|
1799
1799
|
)) })
|
|
1800
1800
|
] }) }),
|
|
1801
1801
|
hasMore ? /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx(
|
|
@@ -1803,17 +1803,136 @@ const SwapsPage = () => {
|
|
|
1803
1803
|
{
|
|
1804
1804
|
variant: "secondary",
|
|
1805
1805
|
isLoading: isFetchingMore,
|
|
1806
|
-
onClick: () =>
|
|
1806
|
+
onClick: () => loadReturns(offset, false),
|
|
1807
1807
|
children: "Load more"
|
|
1808
1808
|
}
|
|
1809
1809
|
) }) : null
|
|
1810
1810
|
] }) });
|
|
1811
1811
|
};
|
|
1812
1812
|
const config$4 = defineRouteConfig({
|
|
1813
|
-
label: "
|
|
1813
|
+
label: "Return Orders",
|
|
1814
1814
|
icon: ArrowPath
|
|
1815
1815
|
});
|
|
1816
1816
|
const getStatusBadgeClass$3 = (status) => {
|
|
1817
|
+
const s2 = status.toLowerCase();
|
|
1818
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1819
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1820
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1821
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1822
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1823
|
+
};
|
|
1824
|
+
const PaymentDetailPage = () => {
|
|
1825
|
+
var _a;
|
|
1826
|
+
const navigate = useNavigate();
|
|
1827
|
+
const params = useParams();
|
|
1828
|
+
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
1829
|
+
const [detail, setDetail] = useState(null);
|
|
1830
|
+
const [loading, setLoading] = useState(!!id);
|
|
1831
|
+
const [error, setError] = useState(null);
|
|
1832
|
+
useEffect(() => {
|
|
1833
|
+
if (!id) {
|
|
1834
|
+
setLoading(false);
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1837
|
+
let cancelled = false;
|
|
1838
|
+
setLoading(true);
|
|
1839
|
+
setError(null);
|
|
1840
|
+
fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
|
|
1841
|
+
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
1842
|
+
return res.json();
|
|
1843
|
+
}).then((data) => {
|
|
1844
|
+
if (!cancelled) setDetail(data);
|
|
1845
|
+
}).catch((e) => {
|
|
1846
|
+
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
1847
|
+
}).finally(() => {
|
|
1848
|
+
if (!cancelled) setLoading(false);
|
|
1849
|
+
});
|
|
1850
|
+
return () => {
|
|
1851
|
+
cancelled = true;
|
|
1852
|
+
};
|
|
1853
|
+
}, [id]);
|
|
1854
|
+
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
1855
|
+
const sessionStatusRaw = (detail == null ? void 0 : detail.session_status) ?? "—";
|
|
1856
|
+
const paymentStatusRaw = (detail == null ? void 0 : detail.payment_id) != null ? (detail == null ? void 0 : detail.payment_status) ?? "—" : "—";
|
|
1857
|
+
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
1858
|
+
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: [
|
|
1859
|
+
/* @__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: [
|
|
1860
|
+
/* @__PURE__ */ jsx(Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
1861
|
+
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Payment session" }),
|
|
1862
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
|
|
1863
|
+
] }) }),
|
|
1864
|
+
error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1865
|
+
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1866
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
|
|
1867
|
+
] }) : 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: [
|
|
1868
|
+
/* @__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: [
|
|
1869
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1870
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
|
|
1871
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsx(
|
|
1872
|
+
Button,
|
|
1873
|
+
{
|
|
1874
|
+
variant: "transparent",
|
|
1875
|
+
size: "small",
|
|
1876
|
+
onClick: () => navigate(`/orders/${detail.order_id}`),
|
|
1877
|
+
children: detail.order_id
|
|
1878
|
+
}
|
|
1879
|
+
) : /* @__PURE__ */ jsx(Text, { children: "—" }) })
|
|
1880
|
+
] }),
|
|
1881
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1882
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
1883
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: displayAmount })
|
|
1884
|
+
] }),
|
|
1885
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1886
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
1887
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.provider_id })
|
|
1888
|
+
] }),
|
|
1889
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1890
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
1891
|
+
/* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
|
|
1892
|
+
Badge,
|
|
1893
|
+
{
|
|
1894
|
+
size: "2xsmall",
|
|
1895
|
+
className: `uppercase ${getStatusBadgeClass$3(displayStatus)}`,
|
|
1896
|
+
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
1897
|
+
}
|
|
1898
|
+
) })
|
|
1899
|
+
] }),
|
|
1900
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1901
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
1902
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
1903
|
+
] }),
|
|
1904
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1905
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
1906
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
1907
|
+
] }),
|
|
1908
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1909
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
1910
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
1911
|
+
] }),
|
|
1912
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1913
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
1914
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
1915
|
+
year: "numeric",
|
|
1916
|
+
month: "short",
|
|
1917
|
+
day: "numeric",
|
|
1918
|
+
hour: "numeric",
|
|
1919
|
+
minute: "2-digit",
|
|
1920
|
+
hour12: true
|
|
1921
|
+
}) })
|
|
1922
|
+
] })
|
|
1923
|
+
] }) }),
|
|
1924
|
+
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1925
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
1926
|
+
/* @__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) })
|
|
1927
|
+
] }) : /* @__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." }) })
|
|
1928
|
+
] }) : null
|
|
1929
|
+
] }) });
|
|
1930
|
+
};
|
|
1931
|
+
const config$3 = defineRouteConfig({
|
|
1932
|
+
label: "Payment details",
|
|
1933
|
+
icon: CreditCard
|
|
1934
|
+
});
|
|
1935
|
+
const getStatusBadgeClass$2 = (status) => {
|
|
1817
1936
|
const statusLower = status.toLowerCase();
|
|
1818
1937
|
if (statusLower === "requested") {
|
|
1819
1938
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -1824,105 +1943,109 @@ const getStatusBadgeClass$3 = (status) => {
|
|
|
1824
1943
|
if (statusLower === "rejected") {
|
|
1825
1944
|
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1826
1945
|
}
|
|
1827
|
-
if (statusLower === "received") {
|
|
1828
|
-
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1829
|
-
}
|
|
1830
|
-
if (statusLower === "refunded") {
|
|
1831
|
-
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1832
|
-
}
|
|
1833
1946
|
if (statusLower === "completed") {
|
|
1834
1947
|
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1835
1948
|
}
|
|
1836
|
-
if (statusLower === "cancelled") {
|
|
1949
|
+
if (statusLower === "cancelled" || statusLower === "canceled") {
|
|
1837
1950
|
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
1838
1951
|
}
|
|
1952
|
+
if (statusLower === "pending") {
|
|
1953
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1954
|
+
}
|
|
1839
1955
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1840
1956
|
};
|
|
1841
|
-
const
|
|
1842
|
-
var _a, _b;
|
|
1957
|
+
const SwapDetailPage = () => {
|
|
1958
|
+
var _a, _b, _c;
|
|
1843
1959
|
const navigate = useNavigate();
|
|
1844
1960
|
const { id } = useParams();
|
|
1845
|
-
const [
|
|
1961
|
+
const [swap, setSwap] = useState(null);
|
|
1962
|
+
const [order, setOrder] = useState(null);
|
|
1846
1963
|
const [isLoading, setIsLoading] = useState(true);
|
|
1847
|
-
|
|
1964
|
+
useState(false);
|
|
1965
|
+
const [isCancelling, setIsCancelling] = useState(false);
|
|
1848
1966
|
const [error, setError] = useState(null);
|
|
1849
1967
|
const [updateError, setUpdateError] = useState(null);
|
|
1850
1968
|
const [updateSuccess, setUpdateSuccess] = useState(false);
|
|
1851
1969
|
useEffect(() => {
|
|
1852
1970
|
if (!id) {
|
|
1853
|
-
navigate("/
|
|
1971
|
+
navigate("/swaps");
|
|
1854
1972
|
return;
|
|
1855
1973
|
}
|
|
1856
|
-
const
|
|
1974
|
+
const loadSwap = async () => {
|
|
1857
1975
|
try {
|
|
1858
1976
|
setIsLoading(true);
|
|
1859
1977
|
setError(null);
|
|
1860
|
-
const response = await fetch(`/admin/
|
|
1978
|
+
const response = await fetch(`/admin/swaps/${id}`, {
|
|
1861
1979
|
credentials: "include"
|
|
1862
1980
|
});
|
|
1863
1981
|
if (!response.ok) {
|
|
1864
1982
|
const message = await response.text();
|
|
1865
|
-
throw new Error(message || "Unable to load
|
|
1983
|
+
throw new Error(message || "Unable to load swap");
|
|
1866
1984
|
}
|
|
1867
1985
|
const payload = await response.json();
|
|
1868
|
-
|
|
1986
|
+
setSwap(payload.swap);
|
|
1987
|
+
setOrder(payload.order || null);
|
|
1869
1988
|
} catch (loadError) {
|
|
1870
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load
|
|
1989
|
+
const message = loadError instanceof Error ? loadError.message : "Unable to load swap";
|
|
1871
1990
|
setError(message);
|
|
1872
1991
|
} finally {
|
|
1873
1992
|
setIsLoading(false);
|
|
1874
1993
|
}
|
|
1875
1994
|
};
|
|
1876
|
-
void
|
|
1995
|
+
void loadSwap();
|
|
1877
1996
|
}, [id, navigate]);
|
|
1878
|
-
const
|
|
1997
|
+
const handleCancelExchange = async () => {
|
|
1879
1998
|
if (!id) {
|
|
1880
1999
|
return;
|
|
1881
2000
|
}
|
|
1882
2001
|
try {
|
|
1883
|
-
|
|
2002
|
+
setIsCancelling(true);
|
|
1884
2003
|
setUpdateError(null);
|
|
1885
2004
|
setUpdateSuccess(false);
|
|
1886
|
-
const response = await fetch(`/admin/
|
|
2005
|
+
const response = await fetch(`/admin/swaps/${id}/cancel`, {
|
|
1887
2006
|
method: "POST",
|
|
1888
2007
|
headers: {
|
|
1889
2008
|
"Content-Type": "application/json"
|
|
1890
2009
|
},
|
|
1891
|
-
credentials: "include"
|
|
1892
|
-
body: JSON.stringify({ reason: "Rejected by admin" })
|
|
2010
|
+
credentials: "include"
|
|
1893
2011
|
});
|
|
1894
2012
|
if (!response.ok) {
|
|
1895
2013
|
const message = await response.text();
|
|
1896
|
-
throw new Error(message || "Unable to
|
|
2014
|
+
throw new Error(message || "Unable to cancel exchange");
|
|
1897
2015
|
}
|
|
1898
2016
|
const payload = await response.json();
|
|
1899
|
-
|
|
2017
|
+
setSwap(payload.swap);
|
|
1900
2018
|
setUpdateSuccess(true);
|
|
1901
2019
|
setTimeout(() => setUpdateSuccess(false), 3e3);
|
|
1902
|
-
const detailResponse = await fetch(`/admin/
|
|
2020
|
+
const detailResponse = await fetch(`/admin/swaps/${id}`, {
|
|
1903
2021
|
credentials: "include"
|
|
1904
2022
|
});
|
|
1905
2023
|
if (detailResponse.ok) {
|
|
1906
2024
|
const detailPayload = await detailResponse.json();
|
|
1907
|
-
|
|
2025
|
+
setSwap(detailPayload.swap);
|
|
2026
|
+
setOrder(detailPayload.order || null);
|
|
1908
2027
|
}
|
|
1909
|
-
} catch (
|
|
1910
|
-
const message =
|
|
2028
|
+
} catch (cancelErr) {
|
|
2029
|
+
const message = cancelErr instanceof Error ? cancelErr.message : "Unable to cancel exchange";
|
|
1911
2030
|
setUpdateError(message);
|
|
1912
2031
|
} finally {
|
|
1913
|
-
|
|
2032
|
+
setIsCancelling(false);
|
|
1914
2033
|
}
|
|
1915
2034
|
};
|
|
2035
|
+
const isOrderExchange = Boolean(swap == null ? void 0 : swap.exchange_id);
|
|
2036
|
+
const canCancelExchange = isOrderExchange && swap && !["cancelled", "canceled", "completed", "declined"].includes(
|
|
2037
|
+
((_a = swap.status) == null ? void 0 : _a.toLowerCase()) ?? ""
|
|
2038
|
+
);
|
|
1916
2039
|
if (isLoading) {
|
|
1917
|
-
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
|
|
2040
|
+
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..." }) }) }) });
|
|
1918
2041
|
}
|
|
1919
|
-
if (error || !
|
|
2042
|
+
if (error || !swap) {
|
|
1920
2043
|
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__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1921
|
-
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error || "
|
|
1922
|
-
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => navigate("/
|
|
2044
|
+
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Swap not found" }),
|
|
2045
|
+
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => navigate("/swaps"), children: "Back to list" }) })
|
|
1923
2046
|
] }) }) });
|
|
1924
2047
|
}
|
|
1925
|
-
const statusHistory = ((
|
|
2048
|
+
const statusHistory = ((_b = swap.metadata) == null ? void 0 : _b.status_history) || [];
|
|
1926
2049
|
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: [
|
|
1927
2050
|
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3", children: [
|
|
1928
2051
|
/* @__PURE__ */ jsxs(
|
|
@@ -1930,7 +2053,7 @@ const ReturnDetailPage = () => {
|
|
|
1930
2053
|
{
|
|
1931
2054
|
variant: "transparent",
|
|
1932
2055
|
size: "small",
|
|
1933
|
-
onClick: () => navigate("/
|
|
2056
|
+
onClick: () => navigate("/swaps"),
|
|
1934
2057
|
className: "w-fit",
|
|
1935
2058
|
children: [
|
|
1936
2059
|
/* @__PURE__ */ jsx(ArrowLeft, { className: "mr-2" }),
|
|
@@ -1940,81 +2063,67 @@ const ReturnDetailPage = () => {
|
|
|
1940
2063
|
),
|
|
1941
2064
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
|
|
1942
2065
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1943
|
-
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "
|
|
1944
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children:
|
|
2066
|
+
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Exchange Details" }),
|
|
2067
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: swap.id })
|
|
1945
2068
|
] }),
|
|
1946
2069
|
/* @__PURE__ */ jsx(
|
|
1947
2070
|
Badge,
|
|
1948
2071
|
{
|
|
1949
2072
|
size: "small",
|
|
1950
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
1951
|
-
children:
|
|
2073
|
+
className: `uppercase ${getStatusBadgeClass$2(swap.status)}`,
|
|
2074
|
+
children: swap.status.replace(/_/g, " ")
|
|
1952
2075
|
}
|
|
1953
2076
|
)
|
|
1954
2077
|
] })
|
|
1955
2078
|
] }),
|
|
1956
|
-
|
|
2079
|
+
canCancelExchange && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
1957
2080
|
/* @__PURE__ */ jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsx(
|
|
1958
2081
|
Button,
|
|
1959
2082
|
{
|
|
1960
2083
|
variant: "danger",
|
|
1961
|
-
onClick:
|
|
1962
|
-
disabled:
|
|
1963
|
-
isLoading:
|
|
1964
|
-
children: "
|
|
2084
|
+
onClick: handleCancelExchange,
|
|
2085
|
+
disabled: isCancelling,
|
|
2086
|
+
isLoading: isCancelling,
|
|
2087
|
+
children: "Cancel Exchange"
|
|
1965
2088
|
}
|
|
1966
2089
|
) }),
|
|
1967
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children:
|
|
1968
|
-
] }),
|
|
1969
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
1970
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Information" }),
|
|
1971
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
1972
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1973
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
|
|
1974
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.id })
|
|
1975
|
-
] }),
|
|
1976
|
-
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
1977
|
-
Button,
|
|
1978
|
-
{
|
|
1979
|
-
variant: "secondary",
|
|
1980
|
-
onClick: () => {
|
|
1981
|
-
window.open(
|
|
1982
|
-
`/app/orders/${returnOrder.order_id}`,
|
|
1983
|
-
"_blank"
|
|
1984
|
-
);
|
|
1985
|
-
},
|
|
1986
|
-
children: "View order"
|
|
1987
|
-
}
|
|
1988
|
-
) })
|
|
1989
|
-
] })
|
|
2090
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "This will cancel the exchange request. The order will remain unchanged." })
|
|
1990
2091
|
] }),
|
|
1991
2092
|
/* @__PURE__ */ jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
|
|
1992
2093
|
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
1993
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "
|
|
2094
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Exchange Information" }),
|
|
1994
2095
|
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
1995
2096
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1996
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "
|
|
1997
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children:
|
|
2097
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
|
|
2098
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.id })
|
|
1998
2099
|
] }),
|
|
1999
2100
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2000
2101
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
|
|
2001
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children:
|
|
2102
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.status })
|
|
2002
2103
|
] }),
|
|
2003
|
-
|
|
2104
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2105
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Difference Due" }),
|
|
2106
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.difference_due != null ? `${swap.currency_code || "$"}${(Number(swap.difference_due) / 100).toFixed(2)}` : "—" })
|
|
2107
|
+
] }),
|
|
2108
|
+
swap.reason && /* @__PURE__ */ jsxs("div", { children: [
|
|
2004
2109
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
|
|
2005
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children:
|
|
2110
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.reason })
|
|
2006
2111
|
] }),
|
|
2007
|
-
|
|
2112
|
+
swap.note && /* @__PURE__ */ jsxs("div", { children: [
|
|
2008
2113
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
|
|
2009
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children:
|
|
2114
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.note })
|
|
2010
2115
|
] }),
|
|
2011
2116
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2012
2117
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
|
|
2013
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(
|
|
2118
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(swap.created_at).toLocaleString() })
|
|
2014
2119
|
] }),
|
|
2015
2120
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2016
2121
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
|
|
2017
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(
|
|
2122
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(swap.updated_at).toLocaleString() })
|
|
2123
|
+
] }),
|
|
2124
|
+
swap.exchange_id && /* @__PURE__ */ jsxs("div", { children: [
|
|
2125
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
|
|
2126
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.exchange_id })
|
|
2018
2127
|
] })
|
|
2019
2128
|
] })
|
|
2020
2129
|
] }),
|
|
@@ -2029,7 +2138,7 @@ const ReturnDetailPage = () => {
|
|
|
2029
2138
|
Badge,
|
|
2030
2139
|
{
|
|
2031
2140
|
size: "2xsmall",
|
|
2032
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2141
|
+
className: `uppercase ${getStatusBadgeClass$2(entry.status)}`,
|
|
2033
2142
|
children: entry.status.replace(/_/g, " ")
|
|
2034
2143
|
}
|
|
2035
2144
|
) }),
|
|
@@ -2044,31 +2153,31 @@ const ReturnDetailPage = () => {
|
|
|
2044
2153
|
)) }) : /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
|
|
2045
2154
|
] })
|
|
2046
2155
|
] }),
|
|
2047
|
-
|
|
2156
|
+
order && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2048
2157
|
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
|
|
2049
2158
|
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2050
2159
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2051
2160
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
|
|
2052
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children:
|
|
2161
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: order.id })
|
|
2053
2162
|
] }),
|
|
2054
2163
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2055
2164
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
|
|
2056
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children:
|
|
2165
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: order.status || "—" })
|
|
2057
2166
|
] }),
|
|
2058
2167
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2059
2168
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
2060
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: ((
|
|
2169
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: ((_c = order.customer) == null ? void 0 : _c.email) || order.email || "—" })
|
|
2061
2170
|
] }),
|
|
2062
|
-
|
|
2171
|
+
order.total && /* @__PURE__ */ jsxs("div", { children: [
|
|
2063
2172
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
2064
2173
|
/* @__PURE__ */ jsxs(Text, { className: "font-medium", children: [
|
|
2065
|
-
|
|
2066
|
-
(Number(
|
|
2174
|
+
order.currency_code || "$",
|
|
2175
|
+
(Number(order.total) / 100).toFixed(2)
|
|
2067
2176
|
] })
|
|
2068
2177
|
] })
|
|
2069
2178
|
] })
|
|
2070
2179
|
] }),
|
|
2071
|
-
|
|
2180
|
+
swap.return_items && swap.return_items.length > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2072
2181
|
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
2073
2182
|
/* @__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: [
|
|
2074
2183
|
/* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
@@ -2076,141 +2185,311 @@ const ReturnDetailPage = () => {
|
|
|
2076
2185
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
|
|
2077
2186
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
|
|
2078
2187
|
] }) }),
|
|
2079
|
-
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children:
|
|
2188
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.return_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
2080
2189
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
2081
2190
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
2082
2191
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
2083
2192
|
] }, item.id || index)) })
|
|
2084
2193
|
] }) })
|
|
2085
2194
|
] }),
|
|
2086
|
-
|
|
2087
|
-
|
|
2195
|
+
swap.new_items && swap.new_items.length > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2196
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "New Items" }),
|
|
2197
|
+
/* @__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: [
|
|
2198
|
+
/* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
2199
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Variant ID" }),
|
|
2200
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
|
|
2201
|
+
] }) }),
|
|
2202
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.new_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
2203
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.variant_id }),
|
|
2204
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
|
|
2205
|
+
] }, item.variant_id || index)) })
|
|
2206
|
+
] }) })
|
|
2207
|
+
] })
|
|
2088
2208
|
] }) });
|
|
2089
2209
|
};
|
|
2090
|
-
const config$
|
|
2091
|
-
label: "
|
|
2092
|
-
icon:
|
|
2210
|
+
const config$2 = defineRouteConfig({
|
|
2211
|
+
label: "Swap Details",
|
|
2212
|
+
icon: ArrowPath
|
|
2093
2213
|
});
|
|
2094
|
-
const getStatusBadgeClass$
|
|
2095
|
-
const
|
|
2096
|
-
if (
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
if (
|
|
2214
|
+
const getStatusBadgeClass$1 = (status) => {
|
|
2215
|
+
const statusLower = status.toLowerCase();
|
|
2216
|
+
if (statusLower === "requested") {
|
|
2217
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2218
|
+
}
|
|
2219
|
+
if (statusLower === "approved") {
|
|
2220
|
+
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2221
|
+
}
|
|
2222
|
+
if (statusLower === "rejected") {
|
|
2223
|
+
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2224
|
+
}
|
|
2225
|
+
if (statusLower === "received") {
|
|
2226
|
+
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2227
|
+
}
|
|
2228
|
+
if (statusLower === "refunded") {
|
|
2229
|
+
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2230
|
+
}
|
|
2231
|
+
if (statusLower === "completed") {
|
|
2232
|
+
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2233
|
+
}
|
|
2234
|
+
if (statusLower === "cancelled") {
|
|
2235
|
+
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
2236
|
+
}
|
|
2100
2237
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2101
2238
|
};
|
|
2102
|
-
const
|
|
2103
|
-
var _a;
|
|
2239
|
+
const ReturnDetailPage = () => {
|
|
2240
|
+
var _a, _b;
|
|
2104
2241
|
const navigate = useNavigate();
|
|
2105
|
-
const
|
|
2106
|
-
const
|
|
2107
|
-
const [
|
|
2108
|
-
const [
|
|
2242
|
+
const { id } = useParams();
|
|
2243
|
+
const [returnOrder, setReturnOrder] = useState(null);
|
|
2244
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
2245
|
+
const [isRejecting, setIsRejecting] = useState(false);
|
|
2109
2246
|
const [error, setError] = useState(null);
|
|
2247
|
+
const [updateError, setUpdateError] = useState(null);
|
|
2248
|
+
const [updateSuccess, setUpdateSuccess] = useState(false);
|
|
2110
2249
|
useEffect(() => {
|
|
2111
2250
|
if (!id) {
|
|
2112
|
-
|
|
2251
|
+
navigate("/returns");
|
|
2113
2252
|
return;
|
|
2114
2253
|
}
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2254
|
+
const loadReturn = async () => {
|
|
2255
|
+
try {
|
|
2256
|
+
setIsLoading(true);
|
|
2257
|
+
setError(null);
|
|
2258
|
+
const response = await fetch(`/admin/returns/${id}`, {
|
|
2259
|
+
credentials: "include"
|
|
2260
|
+
});
|
|
2261
|
+
if (!response.ok) {
|
|
2262
|
+
const message = await response.text();
|
|
2263
|
+
throw new Error(message || "Unable to load return order");
|
|
2264
|
+
}
|
|
2265
|
+
const payload = await response.json();
|
|
2266
|
+
setReturnOrder(payload.return);
|
|
2267
|
+
} catch (loadError) {
|
|
2268
|
+
const message = loadError instanceof Error ? loadError.message : "Unable to load return order";
|
|
2269
|
+
setError(message);
|
|
2270
|
+
} finally {
|
|
2271
|
+
setIsLoading(false);
|
|
2272
|
+
}
|
|
2130
2273
|
};
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
const
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2274
|
+
void loadReturn();
|
|
2275
|
+
}, [id, navigate]);
|
|
2276
|
+
const handleReject = async () => {
|
|
2277
|
+
if (!id) {
|
|
2278
|
+
return;
|
|
2279
|
+
}
|
|
2280
|
+
try {
|
|
2281
|
+
setIsRejecting(true);
|
|
2282
|
+
setUpdateError(null);
|
|
2283
|
+
setUpdateSuccess(false);
|
|
2284
|
+
const response = await fetch(`/admin/returns/${id}/reject`, {
|
|
2285
|
+
method: "POST",
|
|
2286
|
+
headers: {
|
|
2287
|
+
"Content-Type": "application/json"
|
|
2288
|
+
},
|
|
2289
|
+
credentials: "include",
|
|
2290
|
+
body: JSON.stringify({ reason: "Rejected by admin" })
|
|
2291
|
+
});
|
|
2292
|
+
if (!response.ok) {
|
|
2293
|
+
const message = await response.text();
|
|
2294
|
+
throw new Error(message || "Unable to reject return");
|
|
2295
|
+
}
|
|
2296
|
+
const payload = await response.json();
|
|
2297
|
+
setReturnOrder(payload.return);
|
|
2298
|
+
setUpdateSuccess(true);
|
|
2299
|
+
setTimeout(() => setUpdateSuccess(false), 3e3);
|
|
2300
|
+
const detailResponse = await fetch(`/admin/returns/${id}`, {
|
|
2301
|
+
credentials: "include"
|
|
2302
|
+
});
|
|
2303
|
+
if (detailResponse.ok) {
|
|
2304
|
+
const detailPayload = await detailResponse.json();
|
|
2305
|
+
setReturnOrder(detailPayload.return);
|
|
2306
|
+
}
|
|
2307
|
+
} catch (updateErr) {
|
|
2308
|
+
const message = updateErr instanceof Error ? updateErr.message : "Unable to reject return";
|
|
2309
|
+
setUpdateError(message);
|
|
2310
|
+
} finally {
|
|
2311
|
+
setIsRejecting(false);
|
|
2312
|
+
}
|
|
2313
|
+
};
|
|
2314
|
+
if (isLoading) {
|
|
2315
|
+
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 return order..." }) }) }) });
|
|
2316
|
+
}
|
|
2317
|
+
if (error || !returnOrder) {
|
|
2318
|
+
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__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2319
|
+
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Return order not found" }),
|
|
2320
|
+
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => navigate("/returns"), children: "Back to list" }) })
|
|
2321
|
+
] }) }) });
|
|
2322
|
+
}
|
|
2323
|
+
const statusHistory = ((_a = returnOrder.metadata) == null ? void 0 : _a.status_history) || [];
|
|
2324
|
+
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: [
|
|
2325
|
+
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3", children: [
|
|
2326
|
+
/* @__PURE__ */ jsxs(
|
|
2327
|
+
Button,
|
|
2328
|
+
{
|
|
2329
|
+
variant: "transparent",
|
|
2330
|
+
size: "small",
|
|
2331
|
+
onClick: () => navigate("/returns"),
|
|
2332
|
+
className: "w-fit",
|
|
2333
|
+
children: [
|
|
2334
|
+
/* @__PURE__ */ jsx(ArrowLeft, { className: "mr-2" }),
|
|
2335
|
+
"Back to list"
|
|
2336
|
+
]
|
|
2337
|
+
}
|
|
2338
|
+
),
|
|
2339
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
|
|
2340
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2341
|
+
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Return Order Details" }),
|
|
2342
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: returnOrder.id })
|
|
2343
|
+
] }),
|
|
2344
|
+
/* @__PURE__ */ jsx(
|
|
2345
|
+
Badge,
|
|
2346
|
+
{
|
|
2347
|
+
size: "small",
|
|
2348
|
+
className: `uppercase ${getStatusBadgeClass$1(returnOrder.status)}`,
|
|
2349
|
+
children: returnOrder.status.replace(/_/g, " ")
|
|
2350
|
+
}
|
|
2351
|
+
)
|
|
2352
|
+
] })
|
|
2353
|
+
] }),
|
|
2354
|
+
returnOrder.status === "requested" && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
2355
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsx(
|
|
2356
|
+
Button,
|
|
2357
|
+
{
|
|
2358
|
+
variant: "danger",
|
|
2359
|
+
onClick: handleReject,
|
|
2360
|
+
disabled: isRejecting,
|
|
2361
|
+
isLoading: isRejecting,
|
|
2362
|
+
children: "Reject (Cancel) Return"
|
|
2363
|
+
}
|
|
2364
|
+
) }),
|
|
2365
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: 'Cancel this return request. Use "Mark as received" when items are received.' })
|
|
2366
|
+
] }),
|
|
2367
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2368
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Information" }),
|
|
2369
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2370
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2371
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
|
|
2372
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.id })
|
|
2373
|
+
] }),
|
|
2374
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
2375
|
+
Button,
|
|
2376
|
+
{
|
|
2377
|
+
variant: "secondary",
|
|
2378
|
+
onClick: () => {
|
|
2379
|
+
window.open(
|
|
2380
|
+
`/app/orders/${returnOrder.order_id}`,
|
|
2381
|
+
"_blank"
|
|
2382
|
+
);
|
|
2383
|
+
},
|
|
2384
|
+
children: "View order"
|
|
2385
|
+
}
|
|
2386
|
+
) })
|
|
2387
|
+
] })
|
|
2388
|
+
] }),
|
|
2389
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
|
|
2390
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2391
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Details" }),
|
|
2392
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2393
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2394
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
|
|
2395
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.id })
|
|
2396
|
+
] }),
|
|
2397
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2398
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
|
|
2399
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.status })
|
|
2400
|
+
] }),
|
|
2401
|
+
returnOrder.reason && /* @__PURE__ */ jsxs("div", { children: [
|
|
2402
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
|
|
2403
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.reason })
|
|
2404
|
+
] }),
|
|
2405
|
+
returnOrder.note && /* @__PURE__ */ jsxs("div", { children: [
|
|
2406
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
|
|
2407
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.note })
|
|
2408
|
+
] }),
|
|
2409
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2410
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
|
|
2411
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(returnOrder.created_at).toLocaleString() })
|
|
2412
|
+
] }),
|
|
2413
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2414
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
|
|
2415
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(returnOrder.updated_at).toLocaleString() })
|
|
2416
|
+
] })
|
|
2200
2417
|
] })
|
|
2201
|
-
] })
|
|
2202
|
-
|
|
2203
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg
|
|
2204
|
-
/* @__PURE__ */ jsx("
|
|
2205
|
-
|
|
2206
|
-
|
|
2418
|
+
] }),
|
|
2419
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2420
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Status History" }),
|
|
2421
|
+
statusHistory.length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-2", children: statusHistory.map((entry, index) => /* @__PURE__ */ jsx(
|
|
2422
|
+
"div",
|
|
2423
|
+
{
|
|
2424
|
+
className: "flex items-center justify-between border-b border-ui-border-subtle pb-2 last:border-0",
|
|
2425
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2426
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx(
|
|
2427
|
+
Badge,
|
|
2428
|
+
{
|
|
2429
|
+
size: "2xsmall",
|
|
2430
|
+
className: `uppercase ${getStatusBadgeClass$1(entry.status)}`,
|
|
2431
|
+
children: entry.status.replace(/_/g, " ")
|
|
2432
|
+
}
|
|
2433
|
+
) }),
|
|
2434
|
+
/* @__PURE__ */ jsxs(Text, { size: "small", className: "text-ui-fg-subtle", children: [
|
|
2435
|
+
new Date(entry.timestamp).toLocaleString(),
|
|
2436
|
+
entry.admin_id && ` by ${entry.admin_id}`,
|
|
2437
|
+
entry.reason && ` - ${entry.reason}`
|
|
2438
|
+
] })
|
|
2439
|
+
] })
|
|
2440
|
+
},
|
|
2441
|
+
index
|
|
2442
|
+
)) }) : /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
|
|
2443
|
+
] })
|
|
2444
|
+
] }),
|
|
2445
|
+
returnOrder.order && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2446
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
|
|
2447
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2448
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2449
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
|
|
2450
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.order.id })
|
|
2451
|
+
] }),
|
|
2452
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2453
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
|
|
2454
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.order.status || "—" })
|
|
2455
|
+
] }),
|
|
2456
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2457
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
2458
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: ((_b = returnOrder.order.customer) == null ? void 0 : _b.email) || returnOrder.order.email || "—" })
|
|
2459
|
+
] }),
|
|
2460
|
+
returnOrder.order.total && /* @__PURE__ */ jsxs("div", { children: [
|
|
2461
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
2462
|
+
/* @__PURE__ */ jsxs(Text, { className: "font-medium", children: [
|
|
2463
|
+
returnOrder.order.currency_code || "$",
|
|
2464
|
+
(Number(returnOrder.order.total) / 100).toFixed(2)
|
|
2465
|
+
] })
|
|
2466
|
+
] })
|
|
2467
|
+
] })
|
|
2468
|
+
] }),
|
|
2469
|
+
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: [
|
|
2470
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
2471
|
+
/* @__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: [
|
|
2472
|
+
/* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
2473
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Item ID" }),
|
|
2474
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
|
|
2475
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
|
|
2476
|
+
] }) }),
|
|
2477
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: returnOrder.return_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
2478
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
2479
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
2480
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
2481
|
+
] }, item.id || index)) })
|
|
2482
|
+
] }) })
|
|
2483
|
+
] }),
|
|
2484
|
+
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 }) }),
|
|
2485
|
+
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" }) })
|
|
2207
2486
|
] }) });
|
|
2208
2487
|
};
|
|
2209
|
-
const config$
|
|
2210
|
-
label: "
|
|
2211
|
-
icon:
|
|
2488
|
+
const config$1 = defineRouteConfig({
|
|
2489
|
+
label: "Return Order Details",
|
|
2490
|
+
icon: CheckCircle
|
|
2212
2491
|
});
|
|
2213
|
-
const getStatusBadgeClass
|
|
2492
|
+
const getStatusBadgeClass = (status) => {
|
|
2214
2493
|
const s2 = status.toLowerCase();
|
|
2215
2494
|
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2216
2495
|
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
@@ -2321,7 +2600,7 @@ const RefundDetailPage = () => {
|
|
|
2321
2600
|
Badge,
|
|
2322
2601
|
{
|
|
2323
2602
|
size: "2xsmall",
|
|
2324
|
-
className: `uppercase ${getStatusBadgeClass
|
|
2603
|
+
className: `uppercase ${getStatusBadgeClass(paymentStatus)}`,
|
|
2325
2604
|
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
2326
2605
|
}
|
|
2327
2606
|
) })
|
|
@@ -2398,333 +2677,54 @@ const RefundDetailPage = () => {
|
|
|
2398
2677
|
] }) : null
|
|
2399
2678
|
] }) });
|
|
2400
2679
|
};
|
|
2401
|
-
const config
|
|
2680
|
+
const config = defineRouteConfig({
|
|
2402
2681
|
label: "Refund details",
|
|
2403
2682
|
icon: Receipt
|
|
2404
2683
|
});
|
|
2405
|
-
const
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2415
|
-
}
|
|
2416
|
-
if (statusLower === "completed") {
|
|
2417
|
-
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2418
|
-
}
|
|
2419
|
-
if (statusLower === "cancelled" || statusLower === "canceled") {
|
|
2420
|
-
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
2421
|
-
}
|
|
2422
|
-
if (statusLower === "pending") {
|
|
2423
|
-
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2424
|
-
}
|
|
2425
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2426
|
-
};
|
|
2427
|
-
const SwapDetailPage = () => {
|
|
2428
|
-
var _a, _b, _c;
|
|
2429
|
-
const navigate = useNavigate();
|
|
2430
|
-
const { id } = useParams();
|
|
2431
|
-
const [swap, setSwap] = useState(null);
|
|
2432
|
-
const [order, setOrder] = useState(null);
|
|
2433
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
2434
|
-
useState(false);
|
|
2435
|
-
const [isCancelling, setIsCancelling] = useState(false);
|
|
2436
|
-
const [error, setError] = useState(null);
|
|
2437
|
-
const [updateError, setUpdateError] = useState(null);
|
|
2438
|
-
const [updateSuccess, setUpdateSuccess] = useState(false);
|
|
2439
|
-
useEffect(() => {
|
|
2440
|
-
if (!id) {
|
|
2441
|
-
navigate("/swaps");
|
|
2442
|
-
return;
|
|
2443
|
-
}
|
|
2444
|
-
const loadSwap = async () => {
|
|
2445
|
-
try {
|
|
2446
|
-
setIsLoading(true);
|
|
2447
|
-
setError(null);
|
|
2448
|
-
const response = await fetch(`/admin/swaps/${id}`, {
|
|
2449
|
-
credentials: "include"
|
|
2450
|
-
});
|
|
2451
|
-
if (!response.ok) {
|
|
2452
|
-
const message = await response.text();
|
|
2453
|
-
throw new Error(message || "Unable to load swap");
|
|
2454
|
-
}
|
|
2455
|
-
const payload = await response.json();
|
|
2456
|
-
setSwap(payload.swap);
|
|
2457
|
-
setOrder(payload.order || null);
|
|
2458
|
-
} catch (loadError) {
|
|
2459
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load swap";
|
|
2460
|
-
setError(message);
|
|
2461
|
-
} finally {
|
|
2462
|
-
setIsLoading(false);
|
|
2463
|
-
}
|
|
2464
|
-
};
|
|
2465
|
-
void loadSwap();
|
|
2466
|
-
}, [id, navigate]);
|
|
2467
|
-
const handleCancelExchange = async () => {
|
|
2468
|
-
if (!id) {
|
|
2469
|
-
return;
|
|
2470
|
-
}
|
|
2471
|
-
try {
|
|
2472
|
-
setIsCancelling(true);
|
|
2473
|
-
setUpdateError(null);
|
|
2474
|
-
setUpdateSuccess(false);
|
|
2475
|
-
const response = await fetch(`/admin/swaps/${id}/cancel`, {
|
|
2476
|
-
method: "POST",
|
|
2477
|
-
headers: {
|
|
2478
|
-
"Content-Type": "application/json"
|
|
2479
|
-
},
|
|
2480
|
-
credentials: "include"
|
|
2481
|
-
});
|
|
2482
|
-
if (!response.ok) {
|
|
2483
|
-
const message = await response.text();
|
|
2484
|
-
throw new Error(message || "Unable to cancel exchange");
|
|
2485
|
-
}
|
|
2486
|
-
const payload = await response.json();
|
|
2487
|
-
setSwap(payload.swap);
|
|
2488
|
-
setUpdateSuccess(true);
|
|
2489
|
-
setTimeout(() => setUpdateSuccess(false), 3e3);
|
|
2490
|
-
const detailResponse = await fetch(`/admin/swaps/${id}`, {
|
|
2491
|
-
credentials: "include"
|
|
2492
|
-
});
|
|
2493
|
-
if (detailResponse.ok) {
|
|
2494
|
-
const detailPayload = await detailResponse.json();
|
|
2495
|
-
setSwap(detailPayload.swap);
|
|
2496
|
-
setOrder(detailPayload.order || null);
|
|
2497
|
-
}
|
|
2498
|
-
} catch (cancelErr) {
|
|
2499
|
-
const message = cancelErr instanceof Error ? cancelErr.message : "Unable to cancel exchange";
|
|
2500
|
-
setUpdateError(message);
|
|
2501
|
-
} finally {
|
|
2502
|
-
setIsCancelling(false);
|
|
2503
|
-
}
|
|
2504
|
-
};
|
|
2505
|
-
const isOrderExchange = Boolean(swap == null ? void 0 : swap.exchange_id);
|
|
2506
|
-
const canCancelExchange = isOrderExchange && swap && !["cancelled", "canceled", "completed", "declined"].includes(
|
|
2507
|
-
((_a = swap.status) == null ? void 0 : _a.toLowerCase()) ?? ""
|
|
2508
|
-
);
|
|
2509
|
-
if (isLoading) {
|
|
2510
|
-
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..." }) }) }) });
|
|
2511
|
-
}
|
|
2512
|
-
if (error || !swap) {
|
|
2513
|
-
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__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2514
|
-
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Swap not found" }),
|
|
2515
|
-
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => navigate("/swaps"), children: "Back to list" }) })
|
|
2516
|
-
] }) }) });
|
|
2517
|
-
}
|
|
2518
|
-
const statusHistory = ((_b = swap.metadata) == null ? void 0 : _b.status_history) || [];
|
|
2519
|
-
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: [
|
|
2520
|
-
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3", children: [
|
|
2521
|
-
/* @__PURE__ */ jsxs(
|
|
2522
|
-
Button,
|
|
2523
|
-
{
|
|
2524
|
-
variant: "transparent",
|
|
2525
|
-
size: "small",
|
|
2526
|
-
onClick: () => navigate("/swaps"),
|
|
2527
|
-
className: "w-fit",
|
|
2528
|
-
children: [
|
|
2529
|
-
/* @__PURE__ */ jsx(ArrowLeft, { className: "mr-2" }),
|
|
2530
|
-
"Back to list"
|
|
2531
|
-
]
|
|
2532
|
-
}
|
|
2533
|
-
),
|
|
2534
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
|
|
2535
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2536
|
-
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Exchange Details" }),
|
|
2537
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: swap.id })
|
|
2538
|
-
] }),
|
|
2539
|
-
/* @__PURE__ */ jsx(
|
|
2540
|
-
Badge,
|
|
2541
|
-
{
|
|
2542
|
-
size: "small",
|
|
2543
|
-
className: `uppercase ${getStatusBadgeClass(swap.status)}`,
|
|
2544
|
-
children: swap.status.replace(/_/g, " ")
|
|
2545
|
-
}
|
|
2546
|
-
)
|
|
2547
|
-
] })
|
|
2548
|
-
] }),
|
|
2549
|
-
canCancelExchange && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
2550
|
-
/* @__PURE__ */ jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsx(
|
|
2551
|
-
Button,
|
|
2552
|
-
{
|
|
2553
|
-
variant: "danger",
|
|
2554
|
-
onClick: handleCancelExchange,
|
|
2555
|
-
disabled: isCancelling,
|
|
2556
|
-
isLoading: isCancelling,
|
|
2557
|
-
children: "Cancel Exchange"
|
|
2558
|
-
}
|
|
2559
|
-
) }),
|
|
2560
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "This will cancel the exchange request. The order will remain unchanged." })
|
|
2561
|
-
] }),
|
|
2562
|
-
/* @__PURE__ */ jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
|
|
2563
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2564
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Exchange Information" }),
|
|
2565
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2566
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2567
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
|
|
2568
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.id })
|
|
2569
|
-
] }),
|
|
2570
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2571
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
|
|
2572
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.status })
|
|
2573
|
-
] }),
|
|
2574
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2575
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Difference Due" }),
|
|
2576
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.difference_due != null ? `${swap.currency_code || "$"}${(Number(swap.difference_due) / 100).toFixed(2)}` : "—" })
|
|
2577
|
-
] }),
|
|
2578
|
-
swap.reason && /* @__PURE__ */ jsxs("div", { children: [
|
|
2579
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
|
|
2580
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.reason })
|
|
2581
|
-
] }),
|
|
2582
|
-
swap.note && /* @__PURE__ */ jsxs("div", { children: [
|
|
2583
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
|
|
2584
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.note })
|
|
2585
|
-
] }),
|
|
2586
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2587
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
|
|
2588
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(swap.created_at).toLocaleString() })
|
|
2589
|
-
] }),
|
|
2590
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2591
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
|
|
2592
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(swap.updated_at).toLocaleString() })
|
|
2593
|
-
] }),
|
|
2594
|
-
swap.exchange_id && /* @__PURE__ */ jsxs("div", { children: [
|
|
2595
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
|
|
2596
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.exchange_id })
|
|
2597
|
-
] })
|
|
2598
|
-
] })
|
|
2599
|
-
] }),
|
|
2600
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2601
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Status History" }),
|
|
2602
|
-
statusHistory.length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-2", children: statusHistory.map((entry, index) => /* @__PURE__ */ jsx(
|
|
2603
|
-
"div",
|
|
2604
|
-
{
|
|
2605
|
-
className: "flex items-center justify-between border-b border-ui-border-subtle pb-2 last:border-0",
|
|
2606
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2607
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx(
|
|
2608
|
-
Badge,
|
|
2609
|
-
{
|
|
2610
|
-
size: "2xsmall",
|
|
2611
|
-
className: `uppercase ${getStatusBadgeClass(entry.status)}`,
|
|
2612
|
-
children: entry.status.replace(/_/g, " ")
|
|
2613
|
-
}
|
|
2614
|
-
) }),
|
|
2615
|
-
/* @__PURE__ */ jsxs(Text, { size: "small", className: "text-ui-fg-subtle", children: [
|
|
2616
|
-
new Date(entry.timestamp).toLocaleString(),
|
|
2617
|
-
entry.admin_id && ` by ${entry.admin_id}`,
|
|
2618
|
-
entry.reason && ` - ${entry.reason}`
|
|
2619
|
-
] })
|
|
2620
|
-
] })
|
|
2621
|
-
},
|
|
2622
|
-
index
|
|
2623
|
-
)) }) : /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
|
|
2624
|
-
] })
|
|
2625
|
-
] }),
|
|
2626
|
-
order && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2627
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
|
|
2628
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2629
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2630
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
|
|
2631
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: order.id })
|
|
2632
|
-
] }),
|
|
2633
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2634
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
|
|
2635
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: order.status || "—" })
|
|
2636
|
-
] }),
|
|
2637
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2638
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
2639
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: ((_c = order.customer) == null ? void 0 : _c.email) || order.email || "—" })
|
|
2640
|
-
] }),
|
|
2641
|
-
order.total && /* @__PURE__ */ jsxs("div", { children: [
|
|
2642
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
2643
|
-
/* @__PURE__ */ jsxs(Text, { className: "font-medium", children: [
|
|
2644
|
-
order.currency_code || "$",
|
|
2645
|
-
(Number(order.total) / 100).toFixed(2)
|
|
2646
|
-
] })
|
|
2647
|
-
] })
|
|
2648
|
-
] })
|
|
2649
|
-
] }),
|
|
2650
|
-
swap.return_items && swap.return_items.length > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2651
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
2652
|
-
/* @__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: [
|
|
2653
|
-
/* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
2654
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Item ID" }),
|
|
2655
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
|
|
2656
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
|
|
2657
|
-
] }) }),
|
|
2658
|
-
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.return_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
2659
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
2660
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
2661
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
2662
|
-
] }, item.id || index)) })
|
|
2663
|
-
] }) })
|
|
2664
|
-
] }),
|
|
2665
|
-
swap.new_items && swap.new_items.length > 0 && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2666
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "New Items" }),
|
|
2667
|
-
/* @__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: [
|
|
2668
|
-
/* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
2669
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Variant ID" }),
|
|
2670
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
|
|
2671
|
-
] }) }),
|
|
2672
|
-
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.new_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
2673
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.variant_id }),
|
|
2674
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
|
|
2675
|
-
] }, item.variant_id || index)) })
|
|
2676
|
-
] }) })
|
|
2677
|
-
] })
|
|
2678
|
-
] }) });
|
|
2679
|
-
};
|
|
2680
|
-
const config = defineRouteConfig({
|
|
2681
|
-
label: "Swap Details",
|
|
2682
|
-
icon: ArrowPath
|
|
2683
|
-
});
|
|
2684
|
-
const i18nTranslations0 = {};
|
|
2685
|
-
const widgetModule = { widgets: [
|
|
2686
|
-
{
|
|
2687
|
-
Component: OrderGiftItemsWidget,
|
|
2688
|
-
zone: ["order.details.side.after"]
|
|
2689
|
-
},
|
|
2690
|
-
{
|
|
2691
|
-
Component: OrderRefundContextWidget,
|
|
2692
|
-
zone: ["order.details.after"]
|
|
2684
|
+
const i18nTranslations0 = {};
|
|
2685
|
+
const widgetModule = { widgets: [
|
|
2686
|
+
{
|
|
2687
|
+
Component: OrderGiftItemsWidget,
|
|
2688
|
+
zone: ["order.details.side.after"]
|
|
2689
|
+
},
|
|
2690
|
+
{
|
|
2691
|
+
Component: OrderRefundContextWidget,
|
|
2692
|
+
zone: ["order.details.after"]
|
|
2693
2693
|
}
|
|
2694
2694
|
] };
|
|
2695
2695
|
const routeModule = {
|
|
2696
2696
|
routes: [
|
|
2697
|
-
{
|
|
2698
|
-
Component: ReturnsPage,
|
|
2699
|
-
path: "/returns"
|
|
2700
|
-
},
|
|
2701
2697
|
{
|
|
2702
2698
|
Component: PaymentsPage,
|
|
2703
2699
|
path: "/payments"
|
|
2704
2700
|
},
|
|
2705
|
-
{
|
|
2706
|
-
Component: RefundsPage,
|
|
2707
|
-
path: "/refunds"
|
|
2708
|
-
},
|
|
2709
2701
|
{
|
|
2710
2702
|
Component: SwapsPage,
|
|
2711
2703
|
path: "/swaps"
|
|
2712
2704
|
},
|
|
2713
2705
|
{
|
|
2714
|
-
Component:
|
|
2715
|
-
path: "/
|
|
2706
|
+
Component: RefundsPage,
|
|
2707
|
+
path: "/refunds"
|
|
2716
2708
|
},
|
|
2717
2709
|
{
|
|
2718
|
-
Component:
|
|
2719
|
-
path: "/
|
|
2710
|
+
Component: ReturnsPage,
|
|
2711
|
+
path: "/returns"
|
|
2720
2712
|
},
|
|
2721
2713
|
{
|
|
2722
|
-
Component:
|
|
2723
|
-
path: "/
|
|
2714
|
+
Component: PaymentDetailPage,
|
|
2715
|
+
path: "/payments/:id"
|
|
2724
2716
|
},
|
|
2725
2717
|
{
|
|
2726
2718
|
Component: SwapDetailPage,
|
|
2727
2719
|
path: "/swaps/:id"
|
|
2720
|
+
},
|
|
2721
|
+
{
|
|
2722
|
+
Component: ReturnDetailPage,
|
|
2723
|
+
path: "/returns/:id"
|
|
2724
|
+
},
|
|
2725
|
+
{
|
|
2726
|
+
Component: RefundDetailPage,
|
|
2727
|
+
path: "/refunds/:id"
|
|
2728
2728
|
}
|
|
2729
2729
|
]
|
|
2730
2730
|
};
|
|
@@ -2733,7 +2733,7 @@ const menuItemModule = {
|
|
|
2733
2733
|
{
|
|
2734
2734
|
label: config$4.label,
|
|
2735
2735
|
icon: config$4.icon,
|
|
2736
|
-
path: "/
|
|
2736
|
+
path: "/returns",
|
|
2737
2737
|
nested: void 0
|
|
2738
2738
|
},
|
|
2739
2739
|
{
|
|
@@ -2745,37 +2745,37 @@ const menuItemModule = {
|
|
|
2745
2745
|
{
|
|
2746
2746
|
label: config$7.label,
|
|
2747
2747
|
icon: config$7.icon,
|
|
2748
|
-
path: "/
|
|
2748
|
+
path: "/payments",
|
|
2749
2749
|
nested: void 0
|
|
2750
2750
|
},
|
|
2751
2751
|
{
|
|
2752
2752
|
label: config$6.label,
|
|
2753
2753
|
icon: config$6.icon,
|
|
2754
|
-
path: "/
|
|
2754
|
+
path: "/swaps",
|
|
2755
2755
|
nested: void 0
|
|
2756
2756
|
},
|
|
2757
2757
|
{
|
|
2758
|
-
label: config.label,
|
|
2759
|
-
icon: config.icon,
|
|
2760
|
-
path: "/
|
|
2758
|
+
label: config$1.label,
|
|
2759
|
+
icon: config$1.icon,
|
|
2760
|
+
path: "/returns/:id",
|
|
2761
2761
|
nested: void 0
|
|
2762
2762
|
},
|
|
2763
2763
|
{
|
|
2764
|
-
label: config
|
|
2765
|
-
icon: config
|
|
2764
|
+
label: config.label,
|
|
2765
|
+
icon: config.icon,
|
|
2766
2766
|
path: "/refunds/:id",
|
|
2767
2767
|
nested: void 0
|
|
2768
2768
|
},
|
|
2769
2769
|
{
|
|
2770
2770
|
label: config$3.label,
|
|
2771
2771
|
icon: config$3.icon,
|
|
2772
|
-
path: "/
|
|
2772
|
+
path: "/payments/:id",
|
|
2773
2773
|
nested: void 0
|
|
2774
2774
|
},
|
|
2775
2775
|
{
|
|
2776
2776
|
label: config$2.label,
|
|
2777
2777
|
icon: config$2.icon,
|
|
2778
|
-
path: "/
|
|
2778
|
+
path: "/swaps/:id",
|
|
2779
2779
|
nested: void 0
|
|
2780
2780
|
}
|
|
2781
2781
|
]
|