order-management 0.0.87 → 0.0.89
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, Receipt, ArrowPath, CheckCircle, ArrowLeft } 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,188 +865,144 @@ const useDebounce$3 = (value, delay) => {
|
|
|
865
865
|
return debouncedValue;
|
|
866
866
|
};
|
|
867
867
|
const getStatusBadgeClass$7 = (status) => {
|
|
868
|
-
const
|
|
869
|
-
if (
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
if (
|
|
873
|
-
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
874
|
-
}
|
|
875
|
-
if (statusLower === "rejected") {
|
|
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 === "cancelled") {
|
|
882
|
-
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
883
|
-
}
|
|
868
|
+
const s2 = status.toLowerCase();
|
|
869
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
870
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
871
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
872
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
884
873
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
885
874
|
};
|
|
886
|
-
const
|
|
875
|
+
const PaymentsPage = () => {
|
|
887
876
|
const navigate = useNavigate();
|
|
888
877
|
const [items, setItems] = useState([]);
|
|
889
878
|
const [statusFilter, setStatusFilter] = useState("all");
|
|
890
|
-
const [
|
|
891
|
-
const
|
|
892
|
-
const debouncedSearchQuery = useDebounce$3(searchQuery, 300);
|
|
879
|
+
const [orderIdSearch, setOrderIdSearch] = useState("");
|
|
880
|
+
const debouncedOrderId = useDebounce$3(orderIdSearch, 300);
|
|
893
881
|
const [isLoading, setIsLoading] = useState(true);
|
|
894
882
|
const [isFetchingMore, setIsFetchingMore] = useState(false);
|
|
895
883
|
const [error, setError] = useState(null);
|
|
896
884
|
const [offset, setOffset] = useState(0);
|
|
897
885
|
const [count, setCount] = useState(0);
|
|
898
886
|
const limit = 50;
|
|
899
|
-
const
|
|
900
|
-
async (nextOffset, replace
|
|
901
|
-
var _a;
|
|
887
|
+
const loadTransactions = useCallback(
|
|
888
|
+
async (nextOffset, replace) => {
|
|
902
889
|
try {
|
|
903
|
-
if (replace)
|
|
904
|
-
|
|
905
|
-
} else {
|
|
906
|
-
setIsFetchingMore(true);
|
|
907
|
-
}
|
|
890
|
+
if (replace) setIsLoading(true);
|
|
891
|
+
else setIsFetchingMore(true);
|
|
908
892
|
setError(null);
|
|
909
893
|
const params = new URLSearchParams();
|
|
910
894
|
params.set("limit", String(limit));
|
|
911
895
|
params.set("offset", String(nextOffset));
|
|
912
|
-
if (statusFilter !== "all")
|
|
913
|
-
|
|
914
|
-
}
|
|
915
|
-
if (debouncedSearchQuery.trim()) {
|
|
916
|
-
params.set("order_id", debouncedSearchQuery.trim());
|
|
917
|
-
}
|
|
918
|
-
if (createdByFilter !== "all") {
|
|
919
|
-
params.set("created_by", createdByFilter);
|
|
920
|
-
}
|
|
896
|
+
if (statusFilter !== "all") params.set("status", statusFilter);
|
|
897
|
+
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
921
898
|
const response = await fetch(
|
|
922
|
-
`/admin/
|
|
899
|
+
`/admin/payment-transactions?${params.toString()}`,
|
|
923
900
|
{ credentials: "include" }
|
|
924
901
|
);
|
|
925
902
|
if (!response.ok) {
|
|
926
|
-
const
|
|
927
|
-
throw new Error(
|
|
903
|
+
const text = await response.text();
|
|
904
|
+
throw new Error(text || "Failed to load payment transactions");
|
|
928
905
|
}
|
|
929
906
|
const payload = await response.json();
|
|
907
|
+
const list = payload.transactions ?? [];
|
|
930
908
|
setCount(payload.count ?? 0);
|
|
931
|
-
setOffset(nextOffset +
|
|
932
|
-
setItems(
|
|
933
|
-
|
|
934
|
-
);
|
|
935
|
-
} catch (loadError) {
|
|
936
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load swaps";
|
|
937
|
-
setError(message);
|
|
909
|
+
setOffset(nextOffset + list.length);
|
|
910
|
+
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
911
|
+
} catch (e) {
|
|
912
|
+
setError(e instanceof Error ? e.message : "Failed to load");
|
|
938
913
|
} finally {
|
|
939
914
|
setIsLoading(false);
|
|
940
915
|
setIsFetchingMore(false);
|
|
941
916
|
}
|
|
942
917
|
},
|
|
943
|
-
[statusFilter,
|
|
918
|
+
[statusFilter, debouncedOrderId]
|
|
944
919
|
);
|
|
945
920
|
useEffect(() => {
|
|
946
|
-
void
|
|
947
|
-
}, [
|
|
921
|
+
void loadTransactions(0, true);
|
|
922
|
+
}, [loadTransactions]);
|
|
948
923
|
const hasMore = useMemo(() => offset < count, [offset, count]);
|
|
949
|
-
const
|
|
950
|
-
const
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
924
|
+
const displayStatus = (t) => {
|
|
925
|
+
const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
|
|
926
|
+
return s2 !== "" ? s2 : "—";
|
|
927
|
+
};
|
|
928
|
+
const displayAmount = (t) => {
|
|
929
|
+
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
930
|
+
return `${code} ${Number(t.amount)}`;
|
|
931
|
+
};
|
|
954
932
|
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: [
|
|
955
933
|
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
956
934
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
957
|
-
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "
|
|
958
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "
|
|
935
|
+
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Payments" }),
|
|
936
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
|
|
959
937
|
] }),
|
|
960
|
-
/* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () =>
|
|
938
|
+
/* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
|
|
961
939
|
] }),
|
|
962
940
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
963
941
|
/* @__PURE__ */ jsx(
|
|
964
942
|
Input,
|
|
965
943
|
{
|
|
966
|
-
placeholder: "Search by
|
|
967
|
-
value:
|
|
968
|
-
onChange: (
|
|
969
|
-
className: "md:max-w-sm"
|
|
944
|
+
placeholder: "Search by Order ID",
|
|
945
|
+
value: orderIdSearch,
|
|
946
|
+
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
947
|
+
className: "md:max-w-sm",
|
|
948
|
+
"aria-label": "Search by order ID"
|
|
970
949
|
}
|
|
971
950
|
),
|
|
972
|
-
/* @__PURE__ */
|
|
973
|
-
|
|
974
|
-
"select",
|
|
975
|
-
{
|
|
976
|
-
value: createdByFilter,
|
|
977
|
-
onChange: (event) => setCreatedByFilter(event.target.value),
|
|
978
|
-
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",
|
|
979
|
-
children: [
|
|
980
|
-
/* @__PURE__ */ jsx("option", { value: "all", children: "All (Created by)" }),
|
|
981
|
-
/* @__PURE__ */ jsx("option", { value: "customer", children: "Customer" }),
|
|
982
|
-
/* @__PURE__ */ jsx("option", { value: "admin", children: "Admin" })
|
|
983
|
-
]
|
|
984
|
-
}
|
|
985
|
-
),
|
|
986
|
-
/* @__PURE__ */ jsxs(
|
|
987
|
-
"select",
|
|
988
|
-
{
|
|
989
|
-
value: statusFilter,
|
|
990
|
-
onChange: (event) => setStatusFilter(event.target.value),
|
|
991
|
-
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",
|
|
992
|
-
children: [
|
|
993
|
-
/* @__PURE__ */ jsx("option", { value: "all", children: "All Statuses" }),
|
|
994
|
-
availableStatuses.map((status) => /* @__PURE__ */ jsx("option", { value: status, children: status.replace(/_/g, " ").toUpperCase() }, status))
|
|
995
|
-
]
|
|
996
|
-
}
|
|
997
|
-
)
|
|
998
|
-
] })
|
|
999
|
-
] }),
|
|
1000
|
-
error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1001
|
-
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1002
|
-
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(
|
|
1003
|
-
Button,
|
|
951
|
+
/* @__PURE__ */ jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxs(
|
|
952
|
+
"select",
|
|
1004
953
|
{
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
954
|
+
value: statusFilter,
|
|
955
|
+
onChange: (e) => setStatusFilter(e.target.value),
|
|
956
|
+
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",
|
|
957
|
+
"aria-label": "Filter by status",
|
|
958
|
+
children: [
|
|
959
|
+
/* @__PURE__ */ jsx("option", { value: "all", children: "All statuses" }),
|
|
960
|
+
/* @__PURE__ */ jsx("option", { value: "pending", children: "Pending" }),
|
|
961
|
+
/* @__PURE__ */ jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
962
|
+
/* @__PURE__ */ jsx("option", { value: "error", children: "Error" }),
|
|
963
|
+
/* @__PURE__ */ jsx("option", { value: "canceled", children: "Canceled" }),
|
|
964
|
+
/* @__PURE__ */ jsx("option", { value: "authorized", children: "Authorized" }),
|
|
965
|
+
/* @__PURE__ */ jsx("option", { value: "captured", children: "Captured" })
|
|
966
|
+
]
|
|
1008
967
|
}
|
|
1009
968
|
) })
|
|
969
|
+
] }),
|
|
970
|
+
error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
971
|
+
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
972
|
+
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => loadTransactions(0, true), children: "Try again" }) })
|
|
1010
973
|
] }) : null,
|
|
1011
|
-
isLoading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading
|
|
1012
|
-
/* @__PURE__ */ jsx(Heading, { level: "h3", className: "text-xl", children: "No
|
|
1013
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "
|
|
974
|
+
isLoading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading payments…" }) }) : items.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
975
|
+
/* @__PURE__ */ jsx(Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
|
|
976
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
|
|
1014
977
|
] }) : /* @__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: [
|
|
1015
978
|
/* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
1016
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Exchange ID" }),
|
|
1017
979
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
980
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
981
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
1018
982
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
1019
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "
|
|
983
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
|
|
1020
984
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1021
985
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1022
986
|
] }) }),
|
|
1023
|
-
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((
|
|
987
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxs(
|
|
1024
988
|
"tr",
|
|
1025
989
|
{
|
|
1026
990
|
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1027
|
-
onClick: () => navigate(`/
|
|
991
|
+
onClick: () => navigate(`/payments/${t.payment_session_id}`),
|
|
1028
992
|
children: [
|
|
1029
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children:
|
|
1030
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children:
|
|
993
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
|
|
994
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
|
|
995
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
|
|
1031
996
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx(
|
|
1032
997
|
Badge,
|
|
1033
998
|
{
|
|
1034
999
|
size: "2xsmall",
|
|
1035
|
-
className: `uppercase ${getStatusBadgeClass$7(
|
|
1036
|
-
children:
|
|
1000
|
+
className: `uppercase ${getStatusBadgeClass$7(displayStatus(t))}`,
|
|
1001
|
+
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
1037
1002
|
}
|
|
1038
1003
|
) }),
|
|
1039
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children:
|
|
1040
|
-
|
|
1041
|
-
if (amount == null || amount === void 0) {
|
|
1042
|
-
return "—";
|
|
1043
|
-
}
|
|
1044
|
-
const displayAmount = Number(amount) / 100;
|
|
1045
|
-
const currency = swap.currency_code || "$";
|
|
1046
|
-
const sign = displayAmount >= 0 ? "+" : "";
|
|
1047
|
-
return `${sign}${currency}${displayAmount.toFixed(2)}`;
|
|
1048
|
-
})() }),
|
|
1049
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(swap.created_at).toLocaleDateString("en-US", {
|
|
1004
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
|
|
1005
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
|
|
1050
1006
|
year: "numeric",
|
|
1051
1007
|
month: "short",
|
|
1052
1008
|
day: "numeric",
|
|
@@ -1054,21 +1010,35 @@ const SwapsPage = () => {
|
|
|
1054
1010
|
minute: "2-digit",
|
|
1055
1011
|
hour12: true
|
|
1056
1012
|
}) }),
|
|
1057
|
-
/* @__PURE__ */
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
e
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1013
|
+
/* @__PURE__ */ jsxs("td", { className: "px-4 py-4", children: [
|
|
1014
|
+
/* @__PURE__ */ jsx(
|
|
1015
|
+
Button,
|
|
1016
|
+
{
|
|
1017
|
+
variant: "transparent",
|
|
1018
|
+
size: "small",
|
|
1019
|
+
onClick: (e) => {
|
|
1020
|
+
e.stopPropagation();
|
|
1021
|
+
navigate(`/payments/${t.payment_session_id}`);
|
|
1022
|
+
},
|
|
1023
|
+
children: "View details"
|
|
1024
|
+
}
|
|
1025
|
+
),
|
|
1026
|
+
t.order_id ? /* @__PURE__ */ jsx(
|
|
1027
|
+
Button,
|
|
1028
|
+
{
|
|
1029
|
+
variant: "transparent",
|
|
1030
|
+
size: "small",
|
|
1031
|
+
onClick: (e) => {
|
|
1032
|
+
e.stopPropagation();
|
|
1033
|
+
navigate(`/orders/${t.order_id}`);
|
|
1034
|
+
},
|
|
1035
|
+
children: "Order"
|
|
1036
|
+
}
|
|
1037
|
+
) : null
|
|
1038
|
+
] })
|
|
1069
1039
|
]
|
|
1070
1040
|
},
|
|
1071
|
-
|
|
1041
|
+
t.payment_session_id
|
|
1072
1042
|
)) })
|
|
1073
1043
|
] }) }),
|
|
1074
1044
|
hasMore ? /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx(
|
|
@@ -1076,15 +1046,15 @@ const SwapsPage = () => {
|
|
|
1076
1046
|
{
|
|
1077
1047
|
variant: "secondary",
|
|
1078
1048
|
isLoading: isFetchingMore,
|
|
1079
|
-
onClick: () =>
|
|
1049
|
+
onClick: () => loadTransactions(offset, false),
|
|
1080
1050
|
children: "Load more"
|
|
1081
1051
|
}
|
|
1082
1052
|
) }) : null
|
|
1083
1053
|
] }) });
|
|
1084
1054
|
};
|
|
1085
1055
|
const config$7 = defineRouteConfig({
|
|
1086
|
-
label: "
|
|
1087
|
-
icon:
|
|
1056
|
+
label: "Payments",
|
|
1057
|
+
icon: CreditCard
|
|
1088
1058
|
});
|
|
1089
1059
|
const useDebounce$2 = (value, delay) => {
|
|
1090
1060
|
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
@@ -1622,144 +1592,188 @@ const useDebounce = (value, delay) => {
|
|
|
1622
1592
|
return debouncedValue;
|
|
1623
1593
|
};
|
|
1624
1594
|
const getStatusBadgeClass$4 = (status) => {
|
|
1625
|
-
const
|
|
1626
|
-
if (
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
if (
|
|
1630
|
-
|
|
1631
|
-
}
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
const
|
|
1645
|
-
|
|
1595
|
+
const statusLower = status.toLowerCase();
|
|
1596
|
+
if (statusLower === "requested") {
|
|
1597
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1598
|
+
}
|
|
1599
|
+
if (statusLower === "approved") {
|
|
1600
|
+
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1601
|
+
}
|
|
1602
|
+
if (statusLower === "rejected") {
|
|
1603
|
+
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1604
|
+
}
|
|
1605
|
+
if (statusLower === "completed") {
|
|
1606
|
+
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1607
|
+
}
|
|
1608
|
+
if (statusLower === "cancelled") {
|
|
1609
|
+
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
1610
|
+
}
|
|
1611
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1612
|
+
};
|
|
1613
|
+
const SwapsPage = () => {
|
|
1614
|
+
const navigate = useNavigate();
|
|
1615
|
+
const [items, setItems] = useState([]);
|
|
1616
|
+
const [statusFilter, setStatusFilter] = useState("all");
|
|
1617
|
+
const [createdByFilter, setCreatedByFilter] = useState("all");
|
|
1618
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
1619
|
+
const debouncedSearchQuery = useDebounce(searchQuery, 300);
|
|
1620
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
1621
|
+
const [isFetchingMore, setIsFetchingMore] = useState(false);
|
|
1622
|
+
const [error, setError] = useState(null);
|
|
1623
|
+
const [offset, setOffset] = useState(0);
|
|
1624
|
+
const [count, setCount] = useState(0);
|
|
1625
|
+
const limit = 50;
|
|
1626
|
+
const loadSwaps = useCallback(
|
|
1627
|
+
async (nextOffset, replace = false) => {
|
|
1628
|
+
var _a;
|
|
1646
1629
|
try {
|
|
1647
|
-
if (replace)
|
|
1648
|
-
|
|
1630
|
+
if (replace) {
|
|
1631
|
+
setIsLoading(true);
|
|
1632
|
+
} else {
|
|
1633
|
+
setIsFetchingMore(true);
|
|
1634
|
+
}
|
|
1649
1635
|
setError(null);
|
|
1650
1636
|
const params = new URLSearchParams();
|
|
1651
1637
|
params.set("limit", String(limit));
|
|
1652
1638
|
params.set("offset", String(nextOffset));
|
|
1653
|
-
if (statusFilter !== "all")
|
|
1654
|
-
|
|
1639
|
+
if (statusFilter !== "all") {
|
|
1640
|
+
params.set("status", statusFilter);
|
|
1641
|
+
}
|
|
1642
|
+
if (debouncedSearchQuery.trim()) {
|
|
1643
|
+
params.set("order_id", debouncedSearchQuery.trim());
|
|
1644
|
+
}
|
|
1645
|
+
if (createdByFilter !== "all") {
|
|
1646
|
+
params.set("created_by", createdByFilter);
|
|
1647
|
+
}
|
|
1655
1648
|
const response = await fetch(
|
|
1656
|
-
`/admin/
|
|
1649
|
+
`/admin/swaps?${params.toString()}`,
|
|
1657
1650
|
{ credentials: "include" }
|
|
1658
1651
|
);
|
|
1659
1652
|
if (!response.ok) {
|
|
1660
|
-
const
|
|
1661
|
-
throw new Error(
|
|
1653
|
+
const message = await response.text();
|
|
1654
|
+
throw new Error(message || "Unable to load swaps");
|
|
1662
1655
|
}
|
|
1663
1656
|
const payload = await response.json();
|
|
1664
|
-
const list = payload.transactions ?? [];
|
|
1665
1657
|
setCount(payload.count ?? 0);
|
|
1666
|
-
setOffset(nextOffset +
|
|
1667
|
-
setItems(
|
|
1668
|
-
|
|
1669
|
-
|
|
1658
|
+
setOffset(nextOffset + (((_a = payload.swaps) == null ? void 0 : _a.length) ?? 0));
|
|
1659
|
+
setItems(
|
|
1660
|
+
(prev) => replace ? payload.swaps ?? [] : [...prev, ...payload.swaps ?? []]
|
|
1661
|
+
);
|
|
1662
|
+
} catch (loadError) {
|
|
1663
|
+
const message = loadError instanceof Error ? loadError.message : "Unable to load swaps";
|
|
1664
|
+
setError(message);
|
|
1670
1665
|
} finally {
|
|
1671
1666
|
setIsLoading(false);
|
|
1672
1667
|
setIsFetchingMore(false);
|
|
1673
1668
|
}
|
|
1674
1669
|
},
|
|
1675
|
-
[statusFilter,
|
|
1670
|
+
[statusFilter, createdByFilter, debouncedSearchQuery]
|
|
1676
1671
|
);
|
|
1677
1672
|
useEffect(() => {
|
|
1678
|
-
void
|
|
1679
|
-
}, [
|
|
1673
|
+
void loadSwaps(0, true);
|
|
1674
|
+
}, [statusFilter, createdByFilter, debouncedSearchQuery, loadSwaps]);
|
|
1680
1675
|
const hasMore = useMemo(() => offset < count, [offset, count]);
|
|
1681
|
-
const
|
|
1682
|
-
const
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
1687
|
-
return `${code} ${Number(t.amount)}`;
|
|
1688
|
-
};
|
|
1676
|
+
const availableStatuses = useMemo(() => {
|
|
1677
|
+
const statuses = /* @__PURE__ */ new Set();
|
|
1678
|
+
items.forEach((item) => statuses.add(item.status));
|
|
1679
|
+
return Array.from(statuses).sort();
|
|
1680
|
+
}, [items]);
|
|
1689
1681
|
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: [
|
|
1690
1682
|
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1691
1683
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1692
|
-
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "
|
|
1693
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "
|
|
1684
|
+
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Exchanges" }),
|
|
1685
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer exchange requests" })
|
|
1694
1686
|
] }),
|
|
1695
|
-
/* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () =>
|
|
1687
|
+
/* @__PURE__ */ jsx(Button, { variant: "primary", onClick: () => loadSwaps(0, true), children: "Refresh" })
|
|
1696
1688
|
] }),
|
|
1697
1689
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1698
1690
|
/* @__PURE__ */ jsx(
|
|
1699
1691
|
Input,
|
|
1700
1692
|
{
|
|
1701
|
-
placeholder: "Search by
|
|
1702
|
-
value:
|
|
1703
|
-
onChange: (
|
|
1704
|
-
className: "md:max-w-sm"
|
|
1705
|
-
"aria-label": "Search by order ID"
|
|
1693
|
+
placeholder: "Search by swap ID or order ID",
|
|
1694
|
+
value: searchQuery,
|
|
1695
|
+
onChange: (event) => setSearchQuery(event.target.value),
|
|
1696
|
+
className: "md:max-w-sm"
|
|
1706
1697
|
}
|
|
1707
1698
|
),
|
|
1708
|
-
/* @__PURE__ */
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1699
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
|
|
1700
|
+
/* @__PURE__ */ jsxs(
|
|
1701
|
+
"select",
|
|
1702
|
+
{
|
|
1703
|
+
value: createdByFilter,
|
|
1704
|
+
onChange: (event) => setCreatedByFilter(event.target.value),
|
|
1705
|
+
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",
|
|
1706
|
+
children: [
|
|
1707
|
+
/* @__PURE__ */ jsx("option", { value: "all", children: "All (Created by)" }),
|
|
1708
|
+
/* @__PURE__ */ jsx("option", { value: "customer", children: "Customer" }),
|
|
1709
|
+
/* @__PURE__ */ jsx("option", { value: "admin", children: "Admin" })
|
|
1710
|
+
]
|
|
1711
|
+
}
|
|
1712
|
+
),
|
|
1713
|
+
/* @__PURE__ */ jsxs(
|
|
1714
|
+
"select",
|
|
1715
|
+
{
|
|
1716
|
+
value: statusFilter,
|
|
1717
|
+
onChange: (event) => setStatusFilter(event.target.value),
|
|
1718
|
+
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",
|
|
1719
|
+
children: [
|
|
1720
|
+
/* @__PURE__ */ jsx("option", { value: "all", children: "All Statuses" }),
|
|
1721
|
+
availableStatuses.map((status) => /* @__PURE__ */ jsx("option", { value: status, children: status.replace(/_/g, " ").toUpperCase() }, status))
|
|
1722
|
+
]
|
|
1723
|
+
}
|
|
1724
|
+
)
|
|
1725
|
+
] })
|
|
1726
1726
|
] }),
|
|
1727
1727
|
error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1728
1728
|
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1729
|
-
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(
|
|
1729
|
+
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(
|
|
1730
|
+
Button,
|
|
1731
|
+
{
|
|
1732
|
+
variant: "secondary",
|
|
1733
|
+
onClick: () => loadSwaps(0, true),
|
|
1734
|
+
children: "Try again"
|
|
1735
|
+
}
|
|
1736
|
+
) })
|
|
1730
1737
|
] }) : null,
|
|
1731
|
-
isLoading ? /* @__PURE__ */ jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsx(Text, { children: "Loading
|
|
1732
|
-
/* @__PURE__ */ jsx(Heading, { level: "h3", className: "text-xl", children: "No
|
|
1733
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "
|
|
1738
|
+
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: [
|
|
1739
|
+
/* @__PURE__ */ jsx(Heading, { level: "h3", className: "text-xl", children: "No exchanges yet" }),
|
|
1740
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Exchange requests created by customers will appear here." })
|
|
1734
1741
|
] }) : /* @__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: [
|
|
1735
1742
|
/* @__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: "Exchange ID" }),
|
|
1736
1744
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
1737
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
1738
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
1739
1745
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
1740
|
-
/* @__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: "Difference Due" }),
|
|
1741
1747
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1742
1748
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1743
1749
|
] }) }),
|
|
1744
|
-
/* @__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((swap) => /* @__PURE__ */ jsxs(
|
|
1745
1751
|
"tr",
|
|
1746
1752
|
{
|
|
1747
1753
|
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1748
|
-
onClick: () => navigate(`/
|
|
1754
|
+
onClick: () => navigate(`/swaps/${swap.id}`),
|
|
1749
1755
|
children: [
|
|
1750
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children:
|
|
1751
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children:
|
|
1752
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
|
|
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: swap.id }) }) }),
|
|
1757
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: swap.order_id }),
|
|
1753
1758
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx(
|
|
1754
1759
|
Badge,
|
|
1755
1760
|
{
|
|
1756
1761
|
size: "2xsmall",
|
|
1757
|
-
className: `uppercase ${getStatusBadgeClass$4(
|
|
1758
|
-
children:
|
|
1762
|
+
className: `uppercase ${getStatusBadgeClass$4(swap.status)}`,
|
|
1763
|
+
children: swap.status.replace(/_/g, " ")
|
|
1759
1764
|
}
|
|
1760
1765
|
) }),
|
|
1761
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children:
|
|
1762
|
-
|
|
1766
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
|
|
1767
|
+
const amount = swap.difference_due;
|
|
1768
|
+
if (amount == null || amount === void 0) {
|
|
1769
|
+
return "—";
|
|
1770
|
+
}
|
|
1771
|
+
const displayAmount = Number(amount) / 100;
|
|
1772
|
+
const currency = swap.currency_code || "$";
|
|
1773
|
+
const sign = displayAmount >= 0 ? "+" : "";
|
|
1774
|
+
return `${sign}${currency}${displayAmount.toFixed(2)}`;
|
|
1775
|
+
})() }),
|
|
1776
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(swap.created_at).toLocaleDateString("en-US", {
|
|
1763
1777
|
year: "numeric",
|
|
1764
1778
|
month: "short",
|
|
1765
1779
|
day: "numeric",
|
|
@@ -1767,35 +1781,21 @@ const PaymentsPage = () => {
|
|
|
1767
1781
|
minute: "2-digit",
|
|
1768
1782
|
hour12: true
|
|
1769
1783
|
}) }),
|
|
1770
|
-
/* @__PURE__ */
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
),
|
|
1783
|
-
t.order_id ? /* @__PURE__ */ jsx(
|
|
1784
|
-
Button,
|
|
1785
|
-
{
|
|
1786
|
-
variant: "transparent",
|
|
1787
|
-
size: "small",
|
|
1788
|
-
onClick: (e) => {
|
|
1789
|
-
e.stopPropagation();
|
|
1790
|
-
navigate(`/orders/${t.order_id}`);
|
|
1791
|
-
},
|
|
1792
|
-
children: "Order"
|
|
1793
|
-
}
|
|
1794
|
-
) : null
|
|
1795
|
-
] })
|
|
1784
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsx(
|
|
1785
|
+
Button,
|
|
1786
|
+
{
|
|
1787
|
+
variant: "transparent",
|
|
1788
|
+
size: "small",
|
|
1789
|
+
onClick: (e) => {
|
|
1790
|
+
e.stopPropagation();
|
|
1791
|
+
navigate(`/app/orders/${swap.order_id}`);
|
|
1792
|
+
},
|
|
1793
|
+
children: "Go to order"
|
|
1794
|
+
}
|
|
1795
|
+
) })
|
|
1796
1796
|
]
|
|
1797
1797
|
},
|
|
1798
|
-
|
|
1798
|
+
swap.id
|
|
1799
1799
|
)) })
|
|
1800
1800
|
] }) }),
|
|
1801
1801
|
hasMore ? /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx(
|
|
@@ -1803,294 +1803,134 @@ const PaymentsPage = () => {
|
|
|
1803
1803
|
{
|
|
1804
1804
|
variant: "secondary",
|
|
1805
1805
|
isLoading: isFetchingMore,
|
|
1806
|
-
onClick: () =>
|
|
1806
|
+
onClick: () => loadSwaps(offset, false),
|
|
1807
1807
|
children: "Load more"
|
|
1808
1808
|
}
|
|
1809
1809
|
) }) : null
|
|
1810
1810
|
] }) });
|
|
1811
1811
|
};
|
|
1812
1812
|
const config$4 = defineRouteConfig({
|
|
1813
|
-
label: "
|
|
1814
|
-
icon:
|
|
1813
|
+
label: "Exchanges",
|
|
1814
|
+
icon: ArrowPath
|
|
1815
1815
|
});
|
|
1816
1816
|
const getStatusBadgeClass$3 = (status) => {
|
|
1817
|
-
const
|
|
1818
|
-
if (
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
if (
|
|
1822
|
-
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1823
|
-
}
|
|
1824
|
-
if (statusLower === "rejected") {
|
|
1825
|
-
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1826
|
-
}
|
|
1827
|
-
if (statusLower === "completed") {
|
|
1828
|
-
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1829
|
-
}
|
|
1830
|
-
if (statusLower === "cancelled" || statusLower === "canceled") {
|
|
1831
|
-
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
1832
|
-
}
|
|
1833
|
-
if (statusLower === "pending") {
|
|
1834
|
-
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1835
|
-
}
|
|
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";
|
|
1836
1822
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1837
1823
|
};
|
|
1838
|
-
const
|
|
1839
|
-
var _a
|
|
1824
|
+
const PaymentDetailPage = () => {
|
|
1825
|
+
var _a;
|
|
1840
1826
|
const navigate = useNavigate();
|
|
1841
|
-
const
|
|
1842
|
-
const
|
|
1843
|
-
const [
|
|
1844
|
-
const [
|
|
1845
|
-
useState(false);
|
|
1846
|
-
const [isCancelling, setIsCancelling] = useState(false);
|
|
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);
|
|
1847
1831
|
const [error, setError] = useState(null);
|
|
1848
|
-
const [updateError, setUpdateError] = useState(null);
|
|
1849
|
-
const [updateSuccess, setUpdateSuccess] = useState(false);
|
|
1850
1832
|
useEffect(() => {
|
|
1851
1833
|
if (!id) {
|
|
1852
|
-
|
|
1834
|
+
setLoading(false);
|
|
1853
1835
|
return;
|
|
1854
1836
|
}
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load swap";
|
|
1871
|
-
setError(message);
|
|
1872
|
-
} finally {
|
|
1873
|
-
setIsLoading(false);
|
|
1874
|
-
}
|
|
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;
|
|
1875
1852
|
};
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
const
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
});
|
|
1904
|
-
if (detailResponse.ok) {
|
|
1905
|
-
const detailPayload = await detailResponse.json();
|
|
1906
|
-
setSwap(detailPayload.swap);
|
|
1907
|
-
setOrder(detailPayload.order || null);
|
|
1908
|
-
}
|
|
1909
|
-
} catch (cancelErr) {
|
|
1910
|
-
const message = cancelErr instanceof Error ? cancelErr.message : "Unable to cancel exchange";
|
|
1911
|
-
setUpdateError(message);
|
|
1912
|
-
} finally {
|
|
1913
|
-
setIsCancelling(false);
|
|
1914
|
-
}
|
|
1915
|
-
};
|
|
1916
|
-
const isOrderExchange = Boolean(swap == null ? void 0 : swap.exchange_id);
|
|
1917
|
-
const canCancelExchange = isOrderExchange && swap && !["cancelled", "canceled", "completed", "declined"].includes(
|
|
1918
|
-
((_a = swap.status) == null ? void 0 : _a.toLowerCase()) ?? ""
|
|
1919
|
-
);
|
|
1920
|
-
if (isLoading) {
|
|
1921
|
-
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..." }) }) }) });
|
|
1922
|
-
}
|
|
1923
|
-
if (error || !swap) {
|
|
1924
|
-
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: [
|
|
1925
|
-
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Swap not found" }),
|
|
1926
|
-
/* @__PURE__ */ jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => navigate("/swaps"), children: "Back to list" }) })
|
|
1927
|
-
] }) }) });
|
|
1928
|
-
}
|
|
1929
|
-
const statusHistory = ((_b = swap.metadata) == null ? void 0 : _b.status_history) || [];
|
|
1930
|
-
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: [
|
|
1931
|
-
/* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3", children: [
|
|
1932
|
-
/* @__PURE__ */ jsxs(
|
|
1933
|
-
Button,
|
|
1934
|
-
{
|
|
1935
|
-
variant: "transparent",
|
|
1936
|
-
size: "small",
|
|
1937
|
-
onClick: () => navigate("/swaps"),
|
|
1938
|
-
className: "w-fit",
|
|
1939
|
-
children: [
|
|
1940
|
-
/* @__PURE__ */ jsx(ArrowLeft, { className: "mr-2" }),
|
|
1941
|
-
"Back to list"
|
|
1942
|
-
]
|
|
1943
|
-
}
|
|
1944
|
-
),
|
|
1945
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
|
|
1946
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1947
|
-
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Exchange Details" }),
|
|
1948
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: swap.id })
|
|
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: "—" }) })
|
|
1949
1880
|
] }),
|
|
1950
|
-
/* @__PURE__ */ jsx(
|
|
1951
|
-
Badge,
|
|
1952
|
-
{
|
|
1953
|
-
size: "small",
|
|
1954
|
-
className: `uppercase ${getStatusBadgeClass$3(swap.status)}`,
|
|
1955
|
-
children: swap.status.replace(/_/g, " ")
|
|
1956
|
-
}
|
|
1957
|
-
)
|
|
1958
|
-
] })
|
|
1959
|
-
] }),
|
|
1960
|
-
canCancelExchange && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
1961
|
-
/* @__PURE__ */ jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsx(
|
|
1962
|
-
Button,
|
|
1963
|
-
{
|
|
1964
|
-
variant: "danger",
|
|
1965
|
-
onClick: handleCancelExchange,
|
|
1966
|
-
disabled: isCancelling,
|
|
1967
|
-
isLoading: isCancelling,
|
|
1968
|
-
children: "Cancel Exchange"
|
|
1969
|
-
}
|
|
1970
|
-
) }),
|
|
1971
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "This will cancel the exchange request. The order will remain unchanged." })
|
|
1972
|
-
] }),
|
|
1973
|
-
/* @__PURE__ */ jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
|
|
1974
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
1975
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Exchange Information" }),
|
|
1976
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
1977
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1978
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
|
|
1979
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.id })
|
|
1980
|
-
] }),
|
|
1981
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1982
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
|
|
1983
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.status })
|
|
1984
|
-
] }),
|
|
1985
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1986
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Difference Due" }),
|
|
1987
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.difference_due != null ? `${swap.currency_code || "$"}${(Number(swap.difference_due) / 100).toFixed(2)}` : "—" })
|
|
1988
|
-
] }),
|
|
1989
|
-
swap.reason && /* @__PURE__ */ jsxs("div", { children: [
|
|
1990
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
|
|
1991
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.reason })
|
|
1992
|
-
] }),
|
|
1993
|
-
swap.note && /* @__PURE__ */ jsxs("div", { children: [
|
|
1994
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
|
|
1995
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.note })
|
|
1996
|
-
] }),
|
|
1997
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
1998
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
|
|
1999
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(swap.created_at).toLocaleString() })
|
|
2000
|
-
] }),
|
|
2001
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2002
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
|
|
2003
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(swap.updated_at).toLocaleString() })
|
|
2004
|
-
] }),
|
|
2005
|
-
swap.exchange_id && /* @__PURE__ */ jsxs("div", { children: [
|
|
2006
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
|
|
2007
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.exchange_id })
|
|
2008
|
-
] })
|
|
2009
|
-
] })
|
|
2010
|
-
] }),
|
|
2011
|
-
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2012
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Status History" }),
|
|
2013
|
-
statusHistory.length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-2", children: statusHistory.map((entry, index) => /* @__PURE__ */ jsx(
|
|
2014
|
-
"div",
|
|
2015
|
-
{
|
|
2016
|
-
className: "flex items-center justify-between border-b border-ui-border-subtle pb-2 last:border-0",
|
|
2017
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2018
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx(
|
|
2019
|
-
Badge,
|
|
2020
|
-
{
|
|
2021
|
-
size: "2xsmall",
|
|
2022
|
-
className: `uppercase ${getStatusBadgeClass$3(entry.status)}`,
|
|
2023
|
-
children: entry.status.replace(/_/g, " ")
|
|
2024
|
-
}
|
|
2025
|
-
) }),
|
|
2026
|
-
/* @__PURE__ */ jsxs(Text, { size: "small", className: "text-ui-fg-subtle", children: [
|
|
2027
|
-
new Date(entry.timestamp).toLocaleString(),
|
|
2028
|
-
entry.admin_id && ` by ${entry.admin_id}`,
|
|
2029
|
-
entry.reason && ` - ${entry.reason}`
|
|
2030
|
-
] })
|
|
2031
|
-
] })
|
|
2032
|
-
},
|
|
2033
|
-
index
|
|
2034
|
-
)) }) : /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
|
|
2035
|
-
] })
|
|
2036
|
-
] }),
|
|
2037
|
-
order && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2038
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
|
|
2039
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2040
1881
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2041
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-
|
|
2042
|
-
/* @__PURE__ */ jsx(Text, { className: "
|
|
1882
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
1883
|
+
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: displayAmount })
|
|
2043
1884
|
] }),
|
|
2044
1885
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2045
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-
|
|
2046
|
-
/* @__PURE__ */ jsx(Text, { className: "
|
|
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 })
|
|
2047
1888
|
] }),
|
|
2048
1889
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2049
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-
|
|
2050
|
-
/* @__PURE__ */ jsx(
|
|
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
|
+
) })
|
|
2051
1899
|
] }),
|
|
2052
|
-
|
|
2053
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-
|
|
2054
|
-
/* @__PURE__ */
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
/* @__PURE__ */
|
|
2065
|
-
/* @__PURE__ */ jsx(
|
|
2066
|
-
/* @__PURE__ */ jsx(
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
|
|
2082
|
-
] }) }),
|
|
2083
|
-
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.new_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
2084
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.variant_id }),
|
|
2085
|
-
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
|
|
2086
|
-
] }, item.variant_id || index)) })
|
|
2087
|
-
] }) })
|
|
2088
|
-
] })
|
|
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
|
|
2089
1929
|
] }) });
|
|
2090
1930
|
};
|
|
2091
1931
|
const config$3 = defineRouteConfig({
|
|
2092
|
-
label: "
|
|
2093
|
-
icon:
|
|
1932
|
+
label: "Payment details",
|
|
1933
|
+
icon: CreditCard
|
|
2094
1934
|
});
|
|
2095
1935
|
const getStatusBadgeClass$2 = (status) => {
|
|
2096
1936
|
const s2 = status.toLowerCase();
|
|
@@ -2456,36 +2296,304 @@ const ReturnDetailPage = () => {
|
|
|
2456
2296
|
},
|
|
2457
2297
|
children: "View order"
|
|
2458
2298
|
}
|
|
2459
|
-
) })
|
|
2299
|
+
) })
|
|
2300
|
+
] })
|
|
2301
|
+
] }),
|
|
2302
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
|
|
2303
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2304
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Details" }),
|
|
2305
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2306
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2307
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
|
|
2308
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.id })
|
|
2309
|
+
] }),
|
|
2310
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2311
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
|
|
2312
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.status })
|
|
2313
|
+
] }),
|
|
2314
|
+
returnOrder.reason && /* @__PURE__ */ jsxs("div", { children: [
|
|
2315
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
|
|
2316
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.reason })
|
|
2317
|
+
] }),
|
|
2318
|
+
returnOrder.note && /* @__PURE__ */ jsxs("div", { children: [
|
|
2319
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
|
|
2320
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.note })
|
|
2321
|
+
] }),
|
|
2322
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2323
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
|
|
2324
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(returnOrder.created_at).toLocaleString() })
|
|
2325
|
+
] }),
|
|
2326
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2327
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
|
|
2328
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(returnOrder.updated_at).toLocaleString() })
|
|
2329
|
+
] })
|
|
2330
|
+
] })
|
|
2331
|
+
] }),
|
|
2332
|
+
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2333
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Status History" }),
|
|
2334
|
+
statusHistory.length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-2", children: statusHistory.map((entry, index) => /* @__PURE__ */ jsx(
|
|
2335
|
+
"div",
|
|
2336
|
+
{
|
|
2337
|
+
className: "flex items-center justify-between border-b border-ui-border-subtle pb-2 last:border-0",
|
|
2338
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2339
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx(
|
|
2340
|
+
Badge,
|
|
2341
|
+
{
|
|
2342
|
+
size: "2xsmall",
|
|
2343
|
+
className: `uppercase ${getStatusBadgeClass$1(entry.status)}`,
|
|
2344
|
+
children: entry.status.replace(/_/g, " ")
|
|
2345
|
+
}
|
|
2346
|
+
) }),
|
|
2347
|
+
/* @__PURE__ */ jsxs(Text, { size: "small", className: "text-ui-fg-subtle", children: [
|
|
2348
|
+
new Date(entry.timestamp).toLocaleString(),
|
|
2349
|
+
entry.admin_id && ` by ${entry.admin_id}`,
|
|
2350
|
+
entry.reason && ` - ${entry.reason}`
|
|
2351
|
+
] })
|
|
2352
|
+
] })
|
|
2353
|
+
},
|
|
2354
|
+
index
|
|
2355
|
+
)) }) : /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
|
|
2356
|
+
] })
|
|
2357
|
+
] }),
|
|
2358
|
+
returnOrder.order && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2359
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
|
|
2360
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2361
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2362
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
|
|
2363
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.order.id })
|
|
2364
|
+
] }),
|
|
2365
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2366
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
|
|
2367
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: returnOrder.order.status || "—" })
|
|
2368
|
+
] }),
|
|
2369
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
2370
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
2371
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: ((_b = returnOrder.order.customer) == null ? void 0 : _b.email) || returnOrder.order.email || "—" })
|
|
2372
|
+
] }),
|
|
2373
|
+
returnOrder.order.total && /* @__PURE__ */ jsxs("div", { children: [
|
|
2374
|
+
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
2375
|
+
/* @__PURE__ */ jsxs(Text, { className: "font-medium", children: [
|
|
2376
|
+
returnOrder.order.currency_code || "$",
|
|
2377
|
+
(Number(returnOrder.order.total) / 100).toFixed(2)
|
|
2378
|
+
] })
|
|
2379
|
+
] })
|
|
2380
|
+
] })
|
|
2381
|
+
] }),
|
|
2382
|
+
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: [
|
|
2383
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
2384
|
+
/* @__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: [
|
|
2385
|
+
/* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
2386
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Item ID" }),
|
|
2387
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
|
|
2388
|
+
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
|
|
2389
|
+
] }) }),
|
|
2390
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: returnOrder.return_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
2391
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
2392
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
2393
|
+
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
2394
|
+
] }, item.id || index)) })
|
|
2395
|
+
] }) })
|
|
2396
|
+
] }),
|
|
2397
|
+
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 }) }),
|
|
2398
|
+
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" }) })
|
|
2399
|
+
] }) });
|
|
2400
|
+
};
|
|
2401
|
+
const config$1 = defineRouteConfig({
|
|
2402
|
+
label: "Return Order Details",
|
|
2403
|
+
icon: CheckCircle
|
|
2404
|
+
});
|
|
2405
|
+
const getStatusBadgeClass = (status) => {
|
|
2406
|
+
const statusLower = status.toLowerCase();
|
|
2407
|
+
if (statusLower === "requested") {
|
|
2408
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2409
|
+
}
|
|
2410
|
+
if (statusLower === "approved") {
|
|
2411
|
+
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2412
|
+
}
|
|
2413
|
+
if (statusLower === "rejected") {
|
|
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
|
+
)
|
|
2460
2547
|
] })
|
|
2461
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
|
+
] }),
|
|
2462
2562
|
/* @__PURE__ */ jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
|
|
2463
2563
|
/* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2464
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "
|
|
2564
|
+
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Exchange Information" }),
|
|
2465
2565
|
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2466
2566
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2467
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "
|
|
2468
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", 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 })
|
|
2469
2569
|
] }),
|
|
2470
2570
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2471
2571
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
|
|
2472
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children:
|
|
2572
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.status })
|
|
2473
2573
|
] }),
|
|
2474
|
-
|
|
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: [
|
|
2475
2579
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
|
|
2476
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children:
|
|
2580
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.reason })
|
|
2477
2581
|
] }),
|
|
2478
|
-
|
|
2582
|
+
swap.note && /* @__PURE__ */ jsxs("div", { children: [
|
|
2479
2583
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
|
|
2480
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children:
|
|
2584
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: swap.note })
|
|
2481
2585
|
] }),
|
|
2482
2586
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2483
2587
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
|
|
2484
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(
|
|
2588
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(swap.created_at).toLocaleString() })
|
|
2485
2589
|
] }),
|
|
2486
2590
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2487
2591
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
|
|
2488
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: new Date(
|
|
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 })
|
|
2489
2597
|
] })
|
|
2490
2598
|
] })
|
|
2491
2599
|
] }),
|
|
@@ -2500,7 +2608,7 @@ const ReturnDetailPage = () => {
|
|
|
2500
2608
|
Badge,
|
|
2501
2609
|
{
|
|
2502
2610
|
size: "2xsmall",
|
|
2503
|
-
className: `uppercase ${getStatusBadgeClass
|
|
2611
|
+
className: `uppercase ${getStatusBadgeClass(entry.status)}`,
|
|
2504
2612
|
children: entry.status.replace(/_/g, " ")
|
|
2505
2613
|
}
|
|
2506
2614
|
) }),
|
|
@@ -2515,31 +2623,31 @@ const ReturnDetailPage = () => {
|
|
|
2515
2623
|
)) }) : /* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
|
|
2516
2624
|
] })
|
|
2517
2625
|
] }),
|
|
2518
|
-
|
|
2626
|
+
order && /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2519
2627
|
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
|
|
2520
2628
|
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
2521
2629
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2522
2630
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
|
|
2523
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children:
|
|
2631
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: order.id })
|
|
2524
2632
|
] }),
|
|
2525
2633
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2526
2634
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
|
|
2527
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children:
|
|
2635
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: order.status || "—" })
|
|
2528
2636
|
] }),
|
|
2529
2637
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2530
2638
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
2531
|
-
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: ((
|
|
2639
|
+
/* @__PURE__ */ jsx(Text, { className: "font-medium", children: ((_c = order.customer) == null ? void 0 : _c.email) || order.email || "—" })
|
|
2532
2640
|
] }),
|
|
2533
|
-
|
|
2641
|
+
order.total && /* @__PURE__ */ jsxs("div", { children: [
|
|
2534
2642
|
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
2535
2643
|
/* @__PURE__ */ jsxs(Text, { className: "font-medium", children: [
|
|
2536
|
-
|
|
2537
|
-
(Number(
|
|
2644
|
+
order.currency_code || "$",
|
|
2645
|
+
(Number(order.total) / 100).toFixed(2)
|
|
2538
2646
|
] })
|
|
2539
2647
|
] })
|
|
2540
2648
|
] })
|
|
2541
2649
|
] }),
|
|
2542
|
-
|
|
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: [
|
|
2543
2651
|
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
2544
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: [
|
|
2545
2653
|
/* @__PURE__ */ jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
@@ -2547,139 +2655,31 @@ const ReturnDetailPage = () => {
|
|
|
2547
2655
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
|
|
2548
2656
|
/* @__PURE__ */ jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
|
|
2549
2657
|
] }) }),
|
|
2550
|
-
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children:
|
|
2658
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.return_items.map((item, index) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
2551
2659
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
2552
2660
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
2553
2661
|
/* @__PURE__ */ jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
2554
2662
|
] }, item.id || index)) })
|
|
2555
2663
|
] }) })
|
|
2556
2664
|
] }),
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2571
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2572
|
-
};
|
|
2573
|
-
const PaymentDetailPage = () => {
|
|
2574
|
-
var _a;
|
|
2575
|
-
const navigate = useNavigate();
|
|
2576
|
-
const params = useParams();
|
|
2577
|
-
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
2578
|
-
const [detail, setDetail] = useState(null);
|
|
2579
|
-
const [loading, setLoading] = useState(!!id);
|
|
2580
|
-
const [error, setError] = useState(null);
|
|
2581
|
-
useEffect(() => {
|
|
2582
|
-
if (!id) {
|
|
2583
|
-
setLoading(false);
|
|
2584
|
-
return;
|
|
2585
|
-
}
|
|
2586
|
-
let cancelled = false;
|
|
2587
|
-
setLoading(true);
|
|
2588
|
-
setError(null);
|
|
2589
|
-
fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
|
|
2590
|
-
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
2591
|
-
return res.json();
|
|
2592
|
-
}).then((data) => {
|
|
2593
|
-
if (!cancelled) setDetail(data);
|
|
2594
|
-
}).catch((e) => {
|
|
2595
|
-
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
2596
|
-
}).finally(() => {
|
|
2597
|
-
if (!cancelled) setLoading(false);
|
|
2598
|
-
});
|
|
2599
|
-
return () => {
|
|
2600
|
-
cancelled = true;
|
|
2601
|
-
};
|
|
2602
|
-
}, [id]);
|
|
2603
|
-
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
2604
|
-
const sessionStatusRaw = (detail == null ? void 0 : detail.session_status) ?? "—";
|
|
2605
|
-
const paymentStatusRaw = (detail == null ? void 0 : detail.payment_id) != null ? (detail == null ? void 0 : detail.payment_status) ?? "—" : "—";
|
|
2606
|
-
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
2607
|
-
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: [
|
|
2608
|
-
/* @__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: [
|
|
2609
|
-
/* @__PURE__ */ jsx(Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
2610
|
-
/* @__PURE__ */ jsx(Heading, { level: "h1", children: "Payment session" }),
|
|
2611
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
|
|
2612
|
-
] }) }),
|
|
2613
|
-
error ? /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2614
|
-
/* @__PURE__ */ jsx(Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
2615
|
-
/* @__PURE__ */ jsx(Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
|
|
2616
|
-
] }) : 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: [
|
|
2617
|
-
/* @__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: [
|
|
2618
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2619
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
|
|
2620
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsx(
|
|
2621
|
-
Button,
|
|
2622
|
-
{
|
|
2623
|
-
variant: "transparent",
|
|
2624
|
-
size: "small",
|
|
2625
|
-
onClick: () => navigate(`/orders/${detail.order_id}`),
|
|
2626
|
-
children: detail.order_id
|
|
2627
|
-
}
|
|
2628
|
-
) : /* @__PURE__ */ jsx(Text, { children: "—" }) })
|
|
2629
|
-
] }),
|
|
2630
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2631
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
2632
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: displayAmount })
|
|
2633
|
-
] }),
|
|
2634
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2635
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
2636
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.provider_id })
|
|
2637
|
-
] }),
|
|
2638
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2639
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
2640
|
-
/* @__PURE__ */ jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsx(
|
|
2641
|
-
Badge,
|
|
2642
|
-
{
|
|
2643
|
-
size: "2xsmall",
|
|
2644
|
-
className: `uppercase ${getStatusBadgeClass(displayStatus)}`,
|
|
2645
|
-
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
2646
|
-
}
|
|
2647
|
-
) })
|
|
2648
|
-
] }),
|
|
2649
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2650
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
2651
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
2652
|
-
] }),
|
|
2653
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2654
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
2655
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
2656
|
-
] }),
|
|
2657
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2658
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
2659
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
2660
|
-
] }),
|
|
2661
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
2662
|
-
/* @__PURE__ */ jsx(Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
2663
|
-
/* @__PURE__ */ jsx(Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
2664
|
-
year: "numeric",
|
|
2665
|
-
month: "short",
|
|
2666
|
-
day: "numeric",
|
|
2667
|
-
hour: "numeric",
|
|
2668
|
-
minute: "2-digit",
|
|
2669
|
-
hour12: true
|
|
2670
|
-
}) })
|
|
2671
|
-
] })
|
|
2672
|
-
] }) }),
|
|
2673
|
-
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2674
|
-
/* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
2675
|
-
/* @__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) })
|
|
2676
|
-
] }) : /* @__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." }) })
|
|
2677
|
-
] }) : null
|
|
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
2678
|
] }) });
|
|
2679
2679
|
};
|
|
2680
2680
|
const config = defineRouteConfig({
|
|
2681
|
-
label: "
|
|
2682
|
-
icon:
|
|
2681
|
+
label: "Swap Details",
|
|
2682
|
+
icon: ArrowPath
|
|
2683
2683
|
});
|
|
2684
2684
|
const i18nTranslations0 = {};
|
|
2685
2685
|
const widgetModule = { widgets: [
|
|
@@ -2695,8 +2695,8 @@ const widgetModule = { widgets: [
|
|
|
2695
2695
|
const routeModule = {
|
|
2696
2696
|
routes: [
|
|
2697
2697
|
{
|
|
2698
|
-
Component:
|
|
2699
|
-
path: "/
|
|
2698
|
+
Component: PaymentsPage,
|
|
2699
|
+
path: "/payments"
|
|
2700
2700
|
},
|
|
2701
2701
|
{
|
|
2702
2702
|
Component: RefundsPage,
|
|
@@ -2707,12 +2707,12 @@ const routeModule = {
|
|
|
2707
2707
|
path: "/returns"
|
|
2708
2708
|
},
|
|
2709
2709
|
{
|
|
2710
|
-
Component:
|
|
2711
|
-
path: "/
|
|
2710
|
+
Component: SwapsPage,
|
|
2711
|
+
path: "/swaps"
|
|
2712
2712
|
},
|
|
2713
2713
|
{
|
|
2714
|
-
Component:
|
|
2715
|
-
path: "/
|
|
2714
|
+
Component: PaymentDetailPage,
|
|
2715
|
+
path: "/payments/:id"
|
|
2716
2716
|
},
|
|
2717
2717
|
{
|
|
2718
2718
|
Component: RefundDetailPage,
|
|
@@ -2723,17 +2723,17 @@ const routeModule = {
|
|
|
2723
2723
|
path: "/returns/:id"
|
|
2724
2724
|
},
|
|
2725
2725
|
{
|
|
2726
|
-
Component:
|
|
2727
|
-
path: "/
|
|
2726
|
+
Component: SwapDetailPage,
|
|
2727
|
+
path: "/swaps/:id"
|
|
2728
2728
|
}
|
|
2729
2729
|
]
|
|
2730
2730
|
};
|
|
2731
2731
|
const menuItemModule = {
|
|
2732
2732
|
menuItems: [
|
|
2733
2733
|
{
|
|
2734
|
-
label: config$
|
|
2735
|
-
icon: config$
|
|
2736
|
-
path: "/
|
|
2734
|
+
label: config$7.label,
|
|
2735
|
+
icon: config$7.icon,
|
|
2736
|
+
path: "/payments",
|
|
2737
2737
|
nested: void 0
|
|
2738
2738
|
},
|
|
2739
2739
|
{
|
|
@@ -2743,26 +2743,20 @@ const menuItemModule = {
|
|
|
2743
2743
|
nested: void 0
|
|
2744
2744
|
},
|
|
2745
2745
|
{
|
|
2746
|
-
label: config$
|
|
2747
|
-
icon: config$
|
|
2748
|
-
path: "/
|
|
2746
|
+
label: config$5.label,
|
|
2747
|
+
icon: config$5.icon,
|
|
2748
|
+
path: "/returns",
|
|
2749
2749
|
nested: void 0
|
|
2750
2750
|
},
|
|
2751
2751
|
{
|
|
2752
|
-
label: config$
|
|
2753
|
-
icon: config$
|
|
2752
|
+
label: config$4.label,
|
|
2753
|
+
icon: config$4.icon,
|
|
2754
2754
|
path: "/swaps",
|
|
2755
2755
|
nested: void 0
|
|
2756
2756
|
},
|
|
2757
2757
|
{
|
|
2758
|
-
label: config$
|
|
2759
|
-
icon: config$
|
|
2760
|
-
path: "/returns/:id",
|
|
2761
|
-
nested: void 0
|
|
2762
|
-
},
|
|
2763
|
-
{
|
|
2764
|
-
label: config.label,
|
|
2765
|
-
icon: config.icon,
|
|
2758
|
+
label: config$3.label,
|
|
2759
|
+
icon: config$3.icon,
|
|
2766
2760
|
path: "/payments/:id",
|
|
2767
2761
|
nested: void 0
|
|
2768
2762
|
},
|
|
@@ -2773,8 +2767,14 @@ const menuItemModule = {
|
|
|
2773
2767
|
nested: void 0
|
|
2774
2768
|
},
|
|
2775
2769
|
{
|
|
2776
|
-
label: config$
|
|
2777
|
-
icon: config$
|
|
2770
|
+
label: config$1.label,
|
|
2771
|
+
icon: config$1.icon,
|
|
2772
|
+
path: "/returns/:id",
|
|
2773
|
+
nested: void 0
|
|
2774
|
+
},
|
|
2775
|
+
{
|
|
2776
|
+
label: config.label,
|
|
2777
|
+
icon: config.icon,
|
|
2778
2778
|
path: "/swaps/:id",
|
|
2779
2779
|
nested: void 0
|
|
2780
2780
|
}
|