order-management 0.0.85 → 0.0.86
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.
|
@@ -866,206 +866,6 @@ const useDebounce$3 = (value, delay) => {
|
|
|
866
866
|
return debouncedValue;
|
|
867
867
|
};
|
|
868
868
|
const getStatusBadgeClass$7 = (status) => {
|
|
869
|
-
const s2 = status.toLowerCase();
|
|
870
|
-
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
871
|
-
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
872
|
-
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
873
|
-
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
874
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
875
|
-
};
|
|
876
|
-
const PaymentsPage = () => {
|
|
877
|
-
const navigate = reactRouterDom.useNavigate();
|
|
878
|
-
const [items, setItems] = react.useState([]);
|
|
879
|
-
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
880
|
-
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
881
|
-
const debouncedOrderId = useDebounce$3(orderIdSearch, 300);
|
|
882
|
-
const [isLoading, setIsLoading] = react.useState(true);
|
|
883
|
-
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
884
|
-
const [error, setError] = react.useState(null);
|
|
885
|
-
const [offset, setOffset] = react.useState(0);
|
|
886
|
-
const [count, setCount] = react.useState(0);
|
|
887
|
-
const limit = 50;
|
|
888
|
-
const loadTransactions = react.useCallback(
|
|
889
|
-
async (nextOffset, replace) => {
|
|
890
|
-
try {
|
|
891
|
-
if (replace) setIsLoading(true);
|
|
892
|
-
else setIsFetchingMore(true);
|
|
893
|
-
setError(null);
|
|
894
|
-
const params = new URLSearchParams();
|
|
895
|
-
params.set("limit", String(limit));
|
|
896
|
-
params.set("offset", String(nextOffset));
|
|
897
|
-
if (statusFilter !== "all") params.set("status", statusFilter);
|
|
898
|
-
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
899
|
-
const response = await fetch(
|
|
900
|
-
`/admin/payment-transactions?${params.toString()}`,
|
|
901
|
-
{ credentials: "include" }
|
|
902
|
-
);
|
|
903
|
-
if (!response.ok) {
|
|
904
|
-
const text = await response.text();
|
|
905
|
-
throw new Error(text || "Failed to load payment transactions");
|
|
906
|
-
}
|
|
907
|
-
const payload = await response.json();
|
|
908
|
-
const list = payload.transactions ?? [];
|
|
909
|
-
setCount(payload.count ?? 0);
|
|
910
|
-
setOffset(nextOffset + list.length);
|
|
911
|
-
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
912
|
-
} catch (e) {
|
|
913
|
-
setError(e instanceof Error ? e.message : "Failed to load");
|
|
914
|
-
} finally {
|
|
915
|
-
setIsLoading(false);
|
|
916
|
-
setIsFetchingMore(false);
|
|
917
|
-
}
|
|
918
|
-
},
|
|
919
|
-
[statusFilter, debouncedOrderId]
|
|
920
|
-
);
|
|
921
|
-
react.useEffect(() => {
|
|
922
|
-
void loadTransactions(0, true);
|
|
923
|
-
}, [loadTransactions]);
|
|
924
|
-
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
925
|
-
const displayStatus = (t) => {
|
|
926
|
-
const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
|
|
927
|
-
return s2 !== "" ? s2 : "—";
|
|
928
|
-
};
|
|
929
|
-
const displayAmount = (t) => {
|
|
930
|
-
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
931
|
-
return `${code} ${Number(t.amount)}`;
|
|
932
|
-
};
|
|
933
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-7xl flex-col gap-6 p-6", children: [
|
|
934
|
-
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
935
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
936
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payments" }),
|
|
937
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
|
|
938
|
-
] }),
|
|
939
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
|
|
940
|
-
] }),
|
|
941
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
942
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
943
|
-
ui.Input,
|
|
944
|
-
{
|
|
945
|
-
placeholder: "Search by Order ID",
|
|
946
|
-
value: orderIdSearch,
|
|
947
|
-
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
948
|
-
className: "md:max-w-sm",
|
|
949
|
-
"aria-label": "Search by order ID"
|
|
950
|
-
}
|
|
951
|
-
),
|
|
952
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
953
|
-
"select",
|
|
954
|
-
{
|
|
955
|
-
value: statusFilter,
|
|
956
|
-
onChange: (e) => setStatusFilter(e.target.value),
|
|
957
|
-
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",
|
|
958
|
-
"aria-label": "Filter by status",
|
|
959
|
-
children: [
|
|
960
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
961
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
962
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
963
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "error", children: "Error" }),
|
|
964
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
965
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
966
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
967
|
-
]
|
|
968
|
-
}
|
|
969
|
-
) })
|
|
970
|
-
] }),
|
|
971
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
972
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
973
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => loadTransactions(0, true), children: "Try again" }) })
|
|
974
|
-
] }) : null,
|
|
975
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading payments…" }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
976
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
|
|
977
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
|
|
978
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
|
|
979
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
980
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
981
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
982
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
983
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
984
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
|
|
985
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
986
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
987
|
-
] }) }),
|
|
988
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
989
|
-
"tr",
|
|
990
|
-
{
|
|
991
|
-
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
992
|
-
onClick: () => navigate(`/payments/${t.payment_session_id}`),
|
|
993
|
-
children: [
|
|
994
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
|
|
995
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
|
|
996
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
|
|
997
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
998
|
-
ui.Badge,
|
|
999
|
-
{
|
|
1000
|
-
size: "2xsmall",
|
|
1001
|
-
className: `uppercase ${getStatusBadgeClass$7(displayStatus(t))}`,
|
|
1002
|
-
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
1003
|
-
}
|
|
1004
|
-
) }),
|
|
1005
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
|
|
1006
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
|
|
1007
|
-
year: "numeric",
|
|
1008
|
-
month: "short",
|
|
1009
|
-
day: "numeric",
|
|
1010
|
-
hour: "numeric",
|
|
1011
|
-
minute: "2-digit",
|
|
1012
|
-
hour12: true
|
|
1013
|
-
}) }),
|
|
1014
|
-
/* @__PURE__ */ jsxRuntime.jsxs("td", { className: "px-4 py-4", children: [
|
|
1015
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1016
|
-
ui.Button,
|
|
1017
|
-
{
|
|
1018
|
-
variant: "transparent",
|
|
1019
|
-
size: "small",
|
|
1020
|
-
onClick: (e) => {
|
|
1021
|
-
e.stopPropagation();
|
|
1022
|
-
navigate(`/payments/${t.payment_session_id}`);
|
|
1023
|
-
},
|
|
1024
|
-
children: "View details"
|
|
1025
|
-
}
|
|
1026
|
-
),
|
|
1027
|
-
t.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1028
|
-
ui.Button,
|
|
1029
|
-
{
|
|
1030
|
-
variant: "transparent",
|
|
1031
|
-
size: "small",
|
|
1032
|
-
onClick: (e) => {
|
|
1033
|
-
e.stopPropagation();
|
|
1034
|
-
navigate(`/orders/${t.order_id}`);
|
|
1035
|
-
},
|
|
1036
|
-
children: "Order"
|
|
1037
|
-
}
|
|
1038
|
-
) : null
|
|
1039
|
-
] })
|
|
1040
|
-
]
|
|
1041
|
-
},
|
|
1042
|
-
t.payment_session_id
|
|
1043
|
-
)) })
|
|
1044
|
-
] }) }),
|
|
1045
|
-
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1046
|
-
ui.Button,
|
|
1047
|
-
{
|
|
1048
|
-
variant: "secondary",
|
|
1049
|
-
isLoading: isFetchingMore,
|
|
1050
|
-
onClick: () => loadTransactions(offset, false),
|
|
1051
|
-
children: "Load more"
|
|
1052
|
-
}
|
|
1053
|
-
) }) : null
|
|
1054
|
-
] }) });
|
|
1055
|
-
};
|
|
1056
|
-
const config$7 = adminSdk.defineRouteConfig({
|
|
1057
|
-
label: "Payments",
|
|
1058
|
-
icon: icons.CreditCard
|
|
1059
|
-
});
|
|
1060
|
-
const useDebounce$2 = (value, delay) => {
|
|
1061
|
-
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
1062
|
-
react.useEffect(() => {
|
|
1063
|
-
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
1064
|
-
return () => clearTimeout(handler);
|
|
1065
|
-
}, [value, delay]);
|
|
1066
|
-
return debouncedValue;
|
|
1067
|
-
};
|
|
1068
|
-
const getStatusBadgeClass$6 = (status) => {
|
|
1069
869
|
const statusLower = status.toLowerCase();
|
|
1070
870
|
if (statusLower === "requested") {
|
|
1071
871
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -1090,7 +890,7 @@ const SwapsPage = () => {
|
|
|
1090
890
|
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
1091
891
|
const [createdByFilter, setCreatedByFilter] = react.useState("all");
|
|
1092
892
|
const [searchQuery, setSearchQuery] = react.useState("");
|
|
1093
|
-
const debouncedSearchQuery = useDebounce$
|
|
893
|
+
const debouncedSearchQuery = useDebounce$3(searchQuery, 300);
|
|
1094
894
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
1095
895
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
1096
896
|
const [error, setError] = react.useState(null);
|
|
@@ -1233,7 +1033,7 @@ const SwapsPage = () => {
|
|
|
1233
1033
|
ui.Badge,
|
|
1234
1034
|
{
|
|
1235
1035
|
size: "2xsmall",
|
|
1236
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
1036
|
+
className: `uppercase ${getStatusBadgeClass$7(swap.status)}`,
|
|
1237
1037
|
children: swap.status.replace(/_/g, " ")
|
|
1238
1038
|
}
|
|
1239
1039
|
) }),
|
|
@@ -1283,11 +1083,11 @@ const SwapsPage = () => {
|
|
|
1283
1083
|
) }) : null
|
|
1284
1084
|
] }) });
|
|
1285
1085
|
};
|
|
1286
|
-
const config$
|
|
1086
|
+
const config$7 = adminSdk.defineRouteConfig({
|
|
1287
1087
|
label: "Exchanges",
|
|
1288
1088
|
icon: icons.ArrowPath
|
|
1289
1089
|
});
|
|
1290
|
-
const useDebounce$
|
|
1090
|
+
const useDebounce$2 = (value, delay) => {
|
|
1291
1091
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
1292
1092
|
react.useEffect(() => {
|
|
1293
1093
|
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
@@ -1295,276 +1095,213 @@ const useDebounce$1 = (value, delay) => {
|
|
|
1295
1095
|
}, [value, delay]);
|
|
1296
1096
|
return debouncedValue;
|
|
1297
1097
|
};
|
|
1298
|
-
const getStatusBadgeClass$
|
|
1299
|
-
const
|
|
1300
|
-
if (
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
if (
|
|
1098
|
+
const getStatusBadgeClass$6 = (status) => {
|
|
1099
|
+
const statusLower = status.toLowerCase();
|
|
1100
|
+
if (statusLower === "requested") {
|
|
1101
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1102
|
+
}
|
|
1103
|
+
if (statusLower === "received") {
|
|
1104
|
+
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1105
|
+
}
|
|
1106
|
+
if (statusLower === "requires_action") {
|
|
1107
|
+
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1108
|
+
}
|
|
1109
|
+
if (statusLower === "completed") {
|
|
1110
|
+
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1111
|
+
}
|
|
1112
|
+
if (statusLower === "canceled") {
|
|
1113
|
+
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
1114
|
+
}
|
|
1304
1115
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1305
1116
|
};
|
|
1306
|
-
const
|
|
1117
|
+
const ReturnsPage = () => {
|
|
1307
1118
|
const navigate = reactRouterDom.useNavigate();
|
|
1308
1119
|
const [items, setItems] = react.useState([]);
|
|
1309
|
-
const [
|
|
1310
|
-
const
|
|
1311
|
-
const [
|
|
1312
|
-
const
|
|
1313
|
-
const debouncedProvider = useDebounce$1(providerSearch, 300);
|
|
1314
|
-
const [currencySearch, setCurrencySearch] = react.useState("");
|
|
1315
|
-
const debouncedCurrency = useDebounce$1(currencySearch, 300);
|
|
1316
|
-
const [dateFrom, setDateFrom] = react.useState("");
|
|
1317
|
-
const [dateTo, setDateTo] = react.useState("");
|
|
1318
|
-
const [amountMin, setAmountMin] = react.useState("");
|
|
1319
|
-
const [amountMax, setAmountMax] = react.useState("");
|
|
1120
|
+
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
1121
|
+
const [createdByFilter, setCreatedByFilter] = react.useState("all");
|
|
1122
|
+
const [searchQuery, setSearchQuery] = react.useState("");
|
|
1123
|
+
const debouncedSearchQuery = useDebounce$2(searchQuery, 300);
|
|
1320
1124
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
1321
1125
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
1322
1126
|
const [error, setError] = react.useState(null);
|
|
1323
1127
|
const [offset, setOffset] = react.useState(0);
|
|
1324
1128
|
const [count, setCount] = react.useState(0);
|
|
1325
1129
|
const limit = 50;
|
|
1326
|
-
const
|
|
1327
|
-
async (nextOffset, replace) => {
|
|
1130
|
+
const loadReturns = react.useCallback(
|
|
1131
|
+
async (nextOffset, replace = false) => {
|
|
1132
|
+
var _a;
|
|
1328
1133
|
try {
|
|
1329
|
-
if (replace)
|
|
1330
|
-
|
|
1134
|
+
if (replace) {
|
|
1135
|
+
setIsLoading(true);
|
|
1136
|
+
} else {
|
|
1137
|
+
setIsFetchingMore(true);
|
|
1138
|
+
}
|
|
1331
1139
|
setError(null);
|
|
1332
1140
|
const params = new URLSearchParams();
|
|
1333
1141
|
params.set("limit", String(limit));
|
|
1334
1142
|
params.set("offset", String(nextOffset));
|
|
1335
|
-
if (
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
if (
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
const response = await fetch(
|
|
1346
|
-
|
|
1347
|
-
|
|
1143
|
+
if (statusFilter !== "all") {
|
|
1144
|
+
params.set("status", statusFilter);
|
|
1145
|
+
}
|
|
1146
|
+
if (debouncedSearchQuery.trim()) {
|
|
1147
|
+
params.set("q", debouncedSearchQuery.trim());
|
|
1148
|
+
}
|
|
1149
|
+
if (createdByFilter !== "all") {
|
|
1150
|
+
params.set("created_by", createdByFilter);
|
|
1151
|
+
}
|
|
1152
|
+
params.set("order", "created_at");
|
|
1153
|
+
const response = await fetch(
|
|
1154
|
+
`/admin/return?${params.toString()}`,
|
|
1155
|
+
{ credentials: "include" }
|
|
1156
|
+
);
|
|
1348
1157
|
if (!response.ok) {
|
|
1349
|
-
const
|
|
1350
|
-
throw new Error(
|
|
1158
|
+
const message = await response.text();
|
|
1159
|
+
throw new Error(message || "Unable to load return orders");
|
|
1351
1160
|
}
|
|
1352
1161
|
const payload = await response.json();
|
|
1353
|
-
const list = payload.refunds ?? [];
|
|
1354
1162
|
setCount(payload.count ?? 0);
|
|
1355
|
-
setOffset(nextOffset +
|
|
1356
|
-
setItems(
|
|
1357
|
-
|
|
1358
|
-
|
|
1163
|
+
setOffset(nextOffset + (((_a = payload.returns) == null ? void 0 : _a.length) ?? 0));
|
|
1164
|
+
setItems(
|
|
1165
|
+
(prev) => replace ? payload.returns ?? [] : [...prev, ...payload.returns ?? []]
|
|
1166
|
+
);
|
|
1167
|
+
} catch (loadError) {
|
|
1168
|
+
const message = loadError instanceof Error ? loadError.message : "Unable to load return orders";
|
|
1169
|
+
setError(message);
|
|
1359
1170
|
} finally {
|
|
1360
1171
|
setIsLoading(false);
|
|
1361
1172
|
setIsFetchingMore(false);
|
|
1362
1173
|
}
|
|
1363
1174
|
},
|
|
1364
|
-
[
|
|
1365
|
-
debouncedOrderId,
|
|
1366
|
-
paymentStatusFilter,
|
|
1367
|
-
debouncedProvider,
|
|
1368
|
-
debouncedCurrency,
|
|
1369
|
-
dateFrom,
|
|
1370
|
-
dateTo,
|
|
1371
|
-
amountMin,
|
|
1372
|
-
amountMax
|
|
1373
|
-
]
|
|
1175
|
+
[statusFilter, createdByFilter, debouncedSearchQuery]
|
|
1374
1176
|
);
|
|
1375
1177
|
react.useEffect(() => {
|
|
1376
|
-
void
|
|
1377
|
-
}, [
|
|
1178
|
+
void loadReturns(0, true);
|
|
1179
|
+
}, [statusFilter, createdByFilter, debouncedSearchQuery, loadReturns]);
|
|
1378
1180
|
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
1379
|
-
const
|
|
1380
|
-
const
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
const s2 = r.payment_status ?? "";
|
|
1385
|
-
return s2 !== "" ? s2 : "—";
|
|
1386
|
-
};
|
|
1181
|
+
const availableStatuses = react.useMemo(() => {
|
|
1182
|
+
const statuses = /* @__PURE__ */ new Set();
|
|
1183
|
+
items.forEach((item) => statuses.add(item.status));
|
|
1184
|
+
return Array.from(statuses).sort();
|
|
1185
|
+
}, [items]);
|
|
1387
1186
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-7xl flex-col gap-6 p-6", children: [
|
|
1388
1187
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1389
1188
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1390
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
1391
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "
|
|
1189
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Return Orders" }),
|
|
1190
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer return orders" })
|
|
1392
1191
|
] }),
|
|
1393
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () =>
|
|
1192
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadReturns(0, true), children: "Refresh" })
|
|
1394
1193
|
] }),
|
|
1395
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1396
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1397
|
-
ui.Input,
|
|
1398
|
-
{
|
|
1399
|
-
placeholder: "Order ID",
|
|
1400
|
-
value: orderIdSearch,
|
|
1401
|
-
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
1402
|
-
className: "md:max-w-[180px]",
|
|
1403
|
-
"aria-label": "Filter by order ID"
|
|
1404
|
-
}
|
|
1405
|
-
),
|
|
1406
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1407
|
-
ui.Input,
|
|
1408
|
-
{
|
|
1409
|
-
placeholder: "Provider",
|
|
1410
|
-
value: providerSearch,
|
|
1411
|
-
onChange: (e) => setProviderSearch(e.target.value),
|
|
1412
|
-
className: "md:max-w-[140px]",
|
|
1413
|
-
"aria-label": "Filter by provider"
|
|
1414
|
-
}
|
|
1415
|
-
),
|
|
1416
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1417
|
-
ui.Input,
|
|
1418
|
-
{
|
|
1419
|
-
placeholder: "Currency",
|
|
1420
|
-
value: currencySearch,
|
|
1421
|
-
onChange: (e) => setCurrencySearch(e.target.value),
|
|
1422
|
-
className: "md:max-w-[100px]",
|
|
1423
|
-
"aria-label": "Filter by currency"
|
|
1424
|
-
}
|
|
1425
|
-
),
|
|
1426
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1427
|
-
"select",
|
|
1428
|
-
{
|
|
1429
|
-
value: paymentStatusFilter,
|
|
1430
|
-
onChange: (e) => setPaymentStatusFilter(e.target.value),
|
|
1431
|
-
className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-[160px]",
|
|
1432
|
-
"aria-label": "Filter by payment status",
|
|
1433
|
-
children: [
|
|
1434
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
1435
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
1436
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
1437
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "error", children: "Error" }),
|
|
1438
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
1439
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
1440
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
1441
|
-
]
|
|
1442
|
-
}
|
|
1443
|
-
),
|
|
1444
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1445
|
-
ui.Input,
|
|
1446
|
-
{
|
|
1447
|
-
type: "date",
|
|
1448
|
-
placeholder: "From",
|
|
1449
|
-
value: dateFrom,
|
|
1450
|
-
onChange: (e) => setDateFrom(e.target.value),
|
|
1451
|
-
className: "md:max-w-[140px]",
|
|
1452
|
-
"aria-label": "Date from"
|
|
1453
|
-
}
|
|
1454
|
-
),
|
|
1455
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1456
|
-
ui.Input,
|
|
1457
|
-
{
|
|
1458
|
-
type: "date",
|
|
1459
|
-
placeholder: "To",
|
|
1460
|
-
value: dateTo,
|
|
1461
|
-
onChange: (e) => setDateTo(e.target.value),
|
|
1462
|
-
className: "md:max-w-[140px]",
|
|
1463
|
-
"aria-label": "Date to"
|
|
1464
|
-
}
|
|
1465
|
-
),
|
|
1194
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1466
1195
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1467
1196
|
ui.Input,
|
|
1468
1197
|
{
|
|
1469
|
-
placeholder: "
|
|
1470
|
-
value:
|
|
1471
|
-
onChange: (
|
|
1472
|
-
|
|
1473
|
-
min: 0,
|
|
1474
|
-
className: "md:max-w-[100px]",
|
|
1475
|
-
"aria-label": "Refund amount minimum"
|
|
1198
|
+
placeholder: "Search by return ID, order ID, or customer email",
|
|
1199
|
+
value: searchQuery,
|
|
1200
|
+
onChange: (event) => setSearchQuery(event.target.value),
|
|
1201
|
+
className: "md:max-w-sm"
|
|
1476
1202
|
}
|
|
1477
1203
|
),
|
|
1478
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1204
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
|
|
1205
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1206
|
+
"select",
|
|
1207
|
+
{
|
|
1208
|
+
value: createdByFilter,
|
|
1209
|
+
onChange: (event) => setCreatedByFilter(event.target.value),
|
|
1210
|
+
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",
|
|
1211
|
+
children: [
|
|
1212
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All (Created by)" }),
|
|
1213
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "customer", children: "Customer" }),
|
|
1214
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "admin", children: "Admin" })
|
|
1215
|
+
]
|
|
1216
|
+
}
|
|
1217
|
+
),
|
|
1218
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1219
|
+
"select",
|
|
1220
|
+
{
|
|
1221
|
+
value: statusFilter,
|
|
1222
|
+
onChange: (event) => setStatusFilter(event.target.value),
|
|
1223
|
+
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",
|
|
1224
|
+
children: [
|
|
1225
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All Statuses" }),
|
|
1226
|
+
availableStatuses.map((status) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: status, children: status.replace(/_/g, " ").toUpperCase() }, status))
|
|
1227
|
+
]
|
|
1228
|
+
}
|
|
1229
|
+
)
|
|
1230
|
+
] })
|
|
1231
|
+
] }),
|
|
1491
1232
|
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1492
1233
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1493
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1234
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1235
|
+
ui.Button,
|
|
1236
|
+
{
|
|
1237
|
+
variant: "secondary",
|
|
1238
|
+
onClick: () => loadReturns(0, true),
|
|
1239
|
+
children: "Try again"
|
|
1240
|
+
}
|
|
1241
|
+
) })
|
|
1494
1242
|
] }) : null,
|
|
1495
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading
|
|
1496
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No
|
|
1497
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "
|
|
1498
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
1243
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading return orders..." }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
1244
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No return orders yet" }),
|
|
1245
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Return orders created by customers will appear here." })
|
|
1246
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
|
|
1499
1247
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1500
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1501
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1502
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1503
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1504
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1505
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1506
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1507
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[14%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Note" }),
|
|
1508
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1509
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[8%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1248
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Return ID" }),
|
|
1249
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
1250
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Customer" }),
|
|
1251
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
1252
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Refund Amount" }),
|
|
1253
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1254
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1510
1255
|
] }) }),
|
|
1511
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((
|
|
1256
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((returnOrder) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1512
1257
|
"tr",
|
|
1513
1258
|
{
|
|
1514
|
-
className: "
|
|
1515
|
-
onClick: () => navigate(`/
|
|
1259
|
+
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1260
|
+
onClick: () => navigate(`/returns/${returnOrder.id}`),
|
|
1516
1261
|
children: [
|
|
1517
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1518
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1519
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1520
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1521
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle uppercase", children: r.currency_code || "—" }),
|
|
1522
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", title: r.provider_id || void 0, children: r.provider_id || "—" }),
|
|
1523
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1262
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-0.5", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: returnOrder.id }) }) }),
|
|
1263
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.order_id }),
|
|
1264
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.customer_email || returnOrder.order_email || "—" }),
|
|
1265
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1524
1266
|
ui.Badge,
|
|
1525
1267
|
{
|
|
1526
1268
|
size: "2xsmall",
|
|
1527
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
1528
|
-
children:
|
|
1269
|
+
className: `uppercase ${getStatusBadgeClass$6(returnOrder.status)}`,
|
|
1270
|
+
children: returnOrder.status.replace(/_/g, " ")
|
|
1529
1271
|
}
|
|
1530
1272
|
) }),
|
|
1531
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1273
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
|
|
1274
|
+
const amount = returnOrder.refund_amount;
|
|
1275
|
+
if (amount == null || amount === void 0) {
|
|
1276
|
+
return "—";
|
|
1277
|
+
}
|
|
1278
|
+
const displayAmount = Number(amount) / 100;
|
|
1279
|
+
const currency = returnOrder.currency_code || "$";
|
|
1280
|
+
return `${currency}${displayAmount.toFixed(2)}`;
|
|
1281
|
+
})() }),
|
|
1282
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(returnOrder.created_at).toLocaleDateString("en-US", {
|
|
1283
|
+
year: "numeric",
|
|
1284
|
+
month: "short",
|
|
1285
|
+
day: "numeric",
|
|
1286
|
+
hour: "numeric",
|
|
1536
1287
|
minute: "2-digit",
|
|
1537
1288
|
hour12: true
|
|
1538
1289
|
}) }),
|
|
1539
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
),
|
|
1552
|
-
r.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1553
|
-
ui.Button,
|
|
1554
|
-
{
|
|
1555
|
-
variant: "transparent",
|
|
1556
|
-
size: "small",
|
|
1557
|
-
onClick: (e) => {
|
|
1558
|
-
e.stopPropagation();
|
|
1559
|
-
navigate(`/orders/${r.order_id}`);
|
|
1560
|
-
},
|
|
1561
|
-
children: "Order"
|
|
1562
|
-
}
|
|
1563
|
-
) : null
|
|
1564
|
-
] }) })
|
|
1290
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1291
|
+
ui.Button,
|
|
1292
|
+
{
|
|
1293
|
+
variant: "transparent",
|
|
1294
|
+
size: "small",
|
|
1295
|
+
onClick: (e) => {
|
|
1296
|
+
e.stopPropagation();
|
|
1297
|
+
navigate(`/app/orders/${returnOrder.order_id}`);
|
|
1298
|
+
},
|
|
1299
|
+
children: "Go to order"
|
|
1300
|
+
}
|
|
1301
|
+
) })
|
|
1565
1302
|
]
|
|
1566
1303
|
},
|
|
1567
|
-
|
|
1304
|
+
returnOrder.id
|
|
1568
1305
|
)) })
|
|
1569
1306
|
] }) }),
|
|
1570
1307
|
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1572,17 +1309,17 @@ const RefundsPage = () => {
|
|
|
1572
1309
|
{
|
|
1573
1310
|
variant: "secondary",
|
|
1574
1311
|
isLoading: isFetchingMore,
|
|
1575
|
-
onClick: () =>
|
|
1312
|
+
onClick: () => loadReturns(offset, false),
|
|
1576
1313
|
children: "Load more"
|
|
1577
1314
|
}
|
|
1578
1315
|
) }) : null
|
|
1579
1316
|
] }) });
|
|
1580
1317
|
};
|
|
1581
|
-
const config$
|
|
1582
|
-
label: "
|
|
1583
|
-
icon: icons.
|
|
1318
|
+
const config$6 = adminSdk.defineRouteConfig({
|
|
1319
|
+
label: "Return Orders",
|
|
1320
|
+
icon: icons.ArrowPath
|
|
1584
1321
|
});
|
|
1585
|
-
const useDebounce = (value, delay) => {
|
|
1322
|
+
const useDebounce$1 = (value, delay) => {
|
|
1586
1323
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
1587
1324
|
react.useEffect(() => {
|
|
1588
1325
|
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
@@ -1590,191 +1327,145 @@ const useDebounce = (value, delay) => {
|
|
|
1590
1327
|
}, [value, delay]);
|
|
1591
1328
|
return debouncedValue;
|
|
1592
1329
|
};
|
|
1593
|
-
const getStatusBadgeClass$
|
|
1594
|
-
const
|
|
1595
|
-
if (
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
if (
|
|
1599
|
-
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1600
|
-
}
|
|
1601
|
-
if (statusLower === "requires_action") {
|
|
1602
|
-
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1603
|
-
}
|
|
1604
|
-
if (statusLower === "completed") {
|
|
1605
|
-
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1606
|
-
}
|
|
1607
|
-
if (statusLower === "canceled") {
|
|
1608
|
-
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
1609
|
-
}
|
|
1330
|
+
const getStatusBadgeClass$5 = (status) => {
|
|
1331
|
+
const s2 = status.toLowerCase();
|
|
1332
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1333
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1334
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1335
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1610
1336
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1611
1337
|
};
|
|
1612
|
-
const
|
|
1338
|
+
const PaymentsPage = () => {
|
|
1613
1339
|
const navigate = reactRouterDom.useNavigate();
|
|
1614
1340
|
const [items, setItems] = react.useState([]);
|
|
1615
1341
|
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
1616
|
-
const [
|
|
1617
|
-
const
|
|
1618
|
-
const debouncedSearchQuery = useDebounce(searchQuery, 300);
|
|
1342
|
+
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
1343
|
+
const debouncedOrderId = useDebounce$1(orderIdSearch, 300);
|
|
1619
1344
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
1620
1345
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
1621
1346
|
const [error, setError] = react.useState(null);
|
|
1622
1347
|
const [offset, setOffset] = react.useState(0);
|
|
1623
1348
|
const [count, setCount] = react.useState(0);
|
|
1624
1349
|
const limit = 50;
|
|
1625
|
-
const
|
|
1626
|
-
async (nextOffset, replace
|
|
1627
|
-
var _a;
|
|
1350
|
+
const loadTransactions = react.useCallback(
|
|
1351
|
+
async (nextOffset, replace) => {
|
|
1628
1352
|
try {
|
|
1629
|
-
if (replace)
|
|
1630
|
-
|
|
1631
|
-
} else {
|
|
1632
|
-
setIsFetchingMore(true);
|
|
1633
|
-
}
|
|
1353
|
+
if (replace) setIsLoading(true);
|
|
1354
|
+
else setIsFetchingMore(true);
|
|
1634
1355
|
setError(null);
|
|
1635
1356
|
const params = new URLSearchParams();
|
|
1636
1357
|
params.set("limit", String(limit));
|
|
1637
1358
|
params.set("offset", String(nextOffset));
|
|
1638
|
-
if (statusFilter !== "all")
|
|
1639
|
-
|
|
1640
|
-
}
|
|
1641
|
-
if (debouncedSearchQuery.trim()) {
|
|
1642
|
-
params.set("q", debouncedSearchQuery.trim());
|
|
1643
|
-
}
|
|
1644
|
-
if (createdByFilter !== "all") {
|
|
1645
|
-
params.set("created_by", createdByFilter);
|
|
1646
|
-
}
|
|
1647
|
-
params.set("order", "created_at");
|
|
1359
|
+
if (statusFilter !== "all") params.set("status", statusFilter);
|
|
1360
|
+
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
1648
1361
|
const response = await fetch(
|
|
1649
|
-
`/admin/
|
|
1362
|
+
`/admin/payment-transactions?${params.toString()}`,
|
|
1650
1363
|
{ credentials: "include" }
|
|
1651
1364
|
);
|
|
1652
1365
|
if (!response.ok) {
|
|
1653
|
-
const
|
|
1654
|
-
throw new Error(
|
|
1366
|
+
const text = await response.text();
|
|
1367
|
+
throw new Error(text || "Failed to load payment transactions");
|
|
1655
1368
|
}
|
|
1656
1369
|
const payload = await response.json();
|
|
1370
|
+
const list = payload.transactions ?? [];
|
|
1657
1371
|
setCount(payload.count ?? 0);
|
|
1658
|
-
setOffset(nextOffset +
|
|
1659
|
-
setItems(
|
|
1660
|
-
|
|
1661
|
-
);
|
|
1662
|
-
} catch (loadError) {
|
|
1663
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load return orders";
|
|
1664
|
-
setError(message);
|
|
1372
|
+
setOffset(nextOffset + list.length);
|
|
1373
|
+
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
1374
|
+
} catch (e) {
|
|
1375
|
+
setError(e instanceof Error ? e.message : "Failed to load");
|
|
1665
1376
|
} finally {
|
|
1666
1377
|
setIsLoading(false);
|
|
1667
1378
|
setIsFetchingMore(false);
|
|
1668
1379
|
}
|
|
1669
1380
|
},
|
|
1670
|
-
[statusFilter,
|
|
1381
|
+
[statusFilter, debouncedOrderId]
|
|
1671
1382
|
);
|
|
1672
1383
|
react.useEffect(() => {
|
|
1673
|
-
void
|
|
1674
|
-
}, [
|
|
1384
|
+
void loadTransactions(0, true);
|
|
1385
|
+
}, [loadTransactions]);
|
|
1675
1386
|
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
1676
|
-
const
|
|
1677
|
-
const
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1387
|
+
const displayStatus = (t) => {
|
|
1388
|
+
const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
|
|
1389
|
+
return s2 !== "" ? s2 : "—";
|
|
1390
|
+
};
|
|
1391
|
+
const displayAmount = (t) => {
|
|
1392
|
+
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
1393
|
+
return `${code} ${Number(t.amount)}`;
|
|
1394
|
+
};
|
|
1681
1395
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-7xl flex-col gap-6 p-6", children: [
|
|
1682
1396
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1683
1397
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1684
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
1685
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "
|
|
1398
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payments" }),
|
|
1399
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "All payment attempts — completed, pending, failed, requires action" })
|
|
1686
1400
|
] }),
|
|
1687
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () =>
|
|
1401
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadTransactions(0, true), children: "Refresh" })
|
|
1688
1402
|
] }),
|
|
1689
1403
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1690
1404
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1691
1405
|
ui.Input,
|
|
1692
1406
|
{
|
|
1693
|
-
placeholder: "Search by
|
|
1694
|
-
value:
|
|
1695
|
-
onChange: (
|
|
1696
|
-
className: "md:max-w-sm"
|
|
1407
|
+
placeholder: "Search by Order ID",
|
|
1408
|
+
value: orderIdSearch,
|
|
1409
|
+
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
1410
|
+
className: "md:max-w-sm",
|
|
1411
|
+
"aria-label": "Search by order ID"
|
|
1697
1412
|
}
|
|
1698
1413
|
),
|
|
1699
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1700
|
-
|
|
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__ */ jsxRuntime.jsx("option", { value: "all", children: "All (Created by)" }),
|
|
1708
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "customer", children: "Customer" }),
|
|
1709
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "admin", children: "Admin" })
|
|
1710
|
-
]
|
|
1711
|
-
}
|
|
1712
|
-
),
|
|
1713
|
-
/* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx("option", { value: "all", children: "All Statuses" }),
|
|
1721
|
-
availableStatuses.map((status) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: status, children: status.replace(/_/g, " ").toUpperCase() }, status))
|
|
1722
|
-
]
|
|
1723
|
-
}
|
|
1724
|
-
)
|
|
1725
|
-
] })
|
|
1726
|
-
] }),
|
|
1727
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1728
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1729
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1730
|
-
ui.Button,
|
|
1414
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1415
|
+
"select",
|
|
1731
1416
|
{
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1417
|
+
value: statusFilter,
|
|
1418
|
+
onChange: (e) => setStatusFilter(e.target.value),
|
|
1419
|
+
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",
|
|
1420
|
+
"aria-label": "Filter by status",
|
|
1421
|
+
children: [
|
|
1422
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
1423
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
1424
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
1425
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "error", children: "Error" }),
|
|
1426
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
1427
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
1428
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
1429
|
+
]
|
|
1735
1430
|
}
|
|
1736
1431
|
) })
|
|
1432
|
+
] }),
|
|
1433
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1434
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1435
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => loadTransactions(0, true), children: "Try again" }) })
|
|
1737
1436
|
] }) : null,
|
|
1738
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading
|
|
1739
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No
|
|
1740
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "
|
|
1437
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading payments…" }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
1438
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No payment transactions yet" }),
|
|
1439
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Payment attempts will appear here." })
|
|
1741
1440
|
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full divide-y divide-ui-border-base", children: [
|
|
1742
1441
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1743
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Return ID" }),
|
|
1744
1442
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
1745
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "
|
|
1443
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
1444
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
1746
1445
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
1747
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "
|
|
1446
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Finalized" }),
|
|
1748
1447
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1749
1448
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1750
1449
|
] }) }),
|
|
1751
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((
|
|
1450
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((t) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1752
1451
|
"tr",
|
|
1753
1452
|
{
|
|
1754
1453
|
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1755
|
-
onClick: () => navigate(`/
|
|
1454
|
+
onClick: () => navigate(`/payments/${t.payment_session_id}`),
|
|
1756
1455
|
children: [
|
|
1757
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children:
|
|
1758
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children:
|
|
1759
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children:
|
|
1456
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: t.order_id ?? "—" }),
|
|
1457
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: displayAmount(t) }),
|
|
1458
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.provider_id }),
|
|
1760
1459
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1761
1460
|
ui.Badge,
|
|
1762
1461
|
{
|
|
1763
1462
|
size: "2xsmall",
|
|
1764
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
1765
|
-
children:
|
|
1463
|
+
className: `uppercase ${getStatusBadgeClass$5(displayStatus(t))}`,
|
|
1464
|
+
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
1766
1465
|
}
|
|
1767
1466
|
) }),
|
|
1768
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children:
|
|
1769
|
-
|
|
1770
|
-
if (amount == null || amount === void 0) {
|
|
1771
|
-
return "—";
|
|
1772
|
-
}
|
|
1773
|
-
const displayAmount = Number(amount) / 100;
|
|
1774
|
-
const currency = returnOrder.currency_code || "$";
|
|
1775
|
-
return `${currency}${displayAmount.toFixed(2)}`;
|
|
1776
|
-
})() }),
|
|
1777
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(returnOrder.created_at).toLocaleDateString("en-US", {
|
|
1467
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: t.payment_id != null ? "Yes" : "No" }),
|
|
1468
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(t.created_at).toLocaleDateString("en-US", {
|
|
1778
1469
|
year: "numeric",
|
|
1779
1470
|
month: "short",
|
|
1780
1471
|
day: "numeric",
|
|
@@ -1782,21 +1473,35 @@ const ReturnsPage = () => {
|
|
|
1782
1473
|
minute: "2-digit",
|
|
1783
1474
|
hour12: true
|
|
1784
1475
|
}) }),
|
|
1785
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
e
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1476
|
+
/* @__PURE__ */ jsxRuntime.jsxs("td", { className: "px-4 py-4", children: [
|
|
1477
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1478
|
+
ui.Button,
|
|
1479
|
+
{
|
|
1480
|
+
variant: "transparent",
|
|
1481
|
+
size: "small",
|
|
1482
|
+
onClick: (e) => {
|
|
1483
|
+
e.stopPropagation();
|
|
1484
|
+
navigate(`/payments/${t.payment_session_id}`);
|
|
1485
|
+
},
|
|
1486
|
+
children: "View details"
|
|
1487
|
+
}
|
|
1488
|
+
),
|
|
1489
|
+
t.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1490
|
+
ui.Button,
|
|
1491
|
+
{
|
|
1492
|
+
variant: "transparent",
|
|
1493
|
+
size: "small",
|
|
1494
|
+
onClick: (e) => {
|
|
1495
|
+
e.stopPropagation();
|
|
1496
|
+
navigate(`/orders/${t.order_id}`);
|
|
1497
|
+
},
|
|
1498
|
+
children: "Order"
|
|
1499
|
+
}
|
|
1500
|
+
) : null
|
|
1501
|
+
] })
|
|
1797
1502
|
]
|
|
1798
1503
|
},
|
|
1799
|
-
|
|
1504
|
+
t.payment_session_id
|
|
1800
1505
|
)) })
|
|
1801
1506
|
] }) }),
|
|
1802
1507
|
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1804,17 +1509,25 @@ const ReturnsPage = () => {
|
|
|
1804
1509
|
{
|
|
1805
1510
|
variant: "secondary",
|
|
1806
1511
|
isLoading: isFetchingMore,
|
|
1807
|
-
onClick: () =>
|
|
1512
|
+
onClick: () => loadTransactions(offset, false),
|
|
1808
1513
|
children: "Load more"
|
|
1809
1514
|
}
|
|
1810
1515
|
) }) : null
|
|
1811
1516
|
] }) });
|
|
1812
1517
|
};
|
|
1813
|
-
const config$
|
|
1814
|
-
label: "
|
|
1815
|
-
icon: icons.
|
|
1518
|
+
const config$5 = adminSdk.defineRouteConfig({
|
|
1519
|
+
label: "Payments",
|
|
1520
|
+
icon: icons.CreditCard
|
|
1816
1521
|
});
|
|
1817
|
-
const
|
|
1522
|
+
const useDebounce = (value, delay) => {
|
|
1523
|
+
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
1524
|
+
react.useEffect(() => {
|
|
1525
|
+
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
1526
|
+
return () => clearTimeout(handler);
|
|
1527
|
+
}, [value, delay]);
|
|
1528
|
+
return debouncedValue;
|
|
1529
|
+
};
|
|
1530
|
+
const getStatusBadgeClass$4 = (status) => {
|
|
1818
1531
|
const s2 = status.toLowerCase();
|
|
1819
1532
|
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1820
1533
|
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
@@ -1822,118 +1535,286 @@ const getStatusBadgeClass$3 = (status) => {
|
|
|
1822
1535
|
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1823
1536
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1824
1537
|
};
|
|
1825
|
-
const
|
|
1826
|
-
var _a;
|
|
1538
|
+
const RefundsPage = () => {
|
|
1827
1539
|
const navigate = reactRouterDom.useNavigate();
|
|
1828
|
-
const
|
|
1829
|
-
const
|
|
1830
|
-
const
|
|
1831
|
-
const [
|
|
1540
|
+
const [items, setItems] = react.useState([]);
|
|
1541
|
+
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
1542
|
+
const debouncedOrderId = useDebounce(orderIdSearch, 300);
|
|
1543
|
+
const [paymentStatusFilter, setPaymentStatusFilter] = react.useState("all");
|
|
1544
|
+
const [providerSearch, setProviderSearch] = react.useState("");
|
|
1545
|
+
const debouncedProvider = useDebounce(providerSearch, 300);
|
|
1546
|
+
const [currencySearch, setCurrencySearch] = react.useState("");
|
|
1547
|
+
const debouncedCurrency = useDebounce(currencySearch, 300);
|
|
1548
|
+
const [dateFrom, setDateFrom] = react.useState("");
|
|
1549
|
+
const [dateTo, setDateTo] = react.useState("");
|
|
1550
|
+
const [amountMin, setAmountMin] = react.useState("");
|
|
1551
|
+
const [amountMax, setAmountMax] = react.useState("");
|
|
1552
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
1553
|
+
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
1832
1554
|
const [error, setError] = react.useState(null);
|
|
1555
|
+
const [offset, setOffset] = react.useState(0);
|
|
1556
|
+
const [count, setCount] = react.useState(0);
|
|
1557
|
+
const limit = 50;
|
|
1558
|
+
const loadRefunds = react.useCallback(
|
|
1559
|
+
async (nextOffset, replace) => {
|
|
1560
|
+
try {
|
|
1561
|
+
if (replace) setIsLoading(true);
|
|
1562
|
+
else setIsFetchingMore(true);
|
|
1563
|
+
setError(null);
|
|
1564
|
+
const params = new URLSearchParams();
|
|
1565
|
+
params.set("limit", String(limit));
|
|
1566
|
+
params.set("offset", String(nextOffset));
|
|
1567
|
+
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
1568
|
+
if (paymentStatusFilter !== "all") params.set("payment_status", paymentStatusFilter);
|
|
1569
|
+
if (debouncedProvider.trim()) params.set("provider_id", debouncedProvider.trim());
|
|
1570
|
+
if (debouncedCurrency.trim()) params.set("currency_code", debouncedCurrency.trim());
|
|
1571
|
+
if (dateFrom.trim()) params.set("date_from", dateFrom.trim());
|
|
1572
|
+
if (dateTo.trim()) params.set("date_to", dateTo.trim());
|
|
1573
|
+
const min = amountMin.trim() ? Number(amountMin) : void 0;
|
|
1574
|
+
const max = amountMax.trim() ? Number(amountMax) : void 0;
|
|
1575
|
+
if (min != null && !Number.isNaN(min)) params.set("amount_min", String(min));
|
|
1576
|
+
if (max != null && !Number.isNaN(max)) params.set("amount_max", String(max));
|
|
1577
|
+
const response = await fetch(`/admin/refunds?${params.toString()}`, {
|
|
1578
|
+
credentials: "include"
|
|
1579
|
+
});
|
|
1580
|
+
if (!response.ok) {
|
|
1581
|
+
const text = await response.text();
|
|
1582
|
+
throw new Error(text || "Failed to load refunds");
|
|
1583
|
+
}
|
|
1584
|
+
const payload = await response.json();
|
|
1585
|
+
const list = payload.refunds ?? [];
|
|
1586
|
+
setCount(payload.count ?? 0);
|
|
1587
|
+
setOffset(nextOffset + list.length);
|
|
1588
|
+
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
1589
|
+
} catch (e) {
|
|
1590
|
+
setError(e instanceof Error ? e.message : "Failed to load");
|
|
1591
|
+
} finally {
|
|
1592
|
+
setIsLoading(false);
|
|
1593
|
+
setIsFetchingMore(false);
|
|
1594
|
+
}
|
|
1595
|
+
},
|
|
1596
|
+
[
|
|
1597
|
+
debouncedOrderId,
|
|
1598
|
+
paymentStatusFilter,
|
|
1599
|
+
debouncedProvider,
|
|
1600
|
+
debouncedCurrency,
|
|
1601
|
+
dateFrom,
|
|
1602
|
+
dateTo,
|
|
1603
|
+
amountMin,
|
|
1604
|
+
amountMax
|
|
1605
|
+
]
|
|
1606
|
+
);
|
|
1833
1607
|
react.useEffect(() => {
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1608
|
+
void loadRefunds(0, true);
|
|
1609
|
+
}, [loadRefunds]);
|
|
1610
|
+
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
1611
|
+
const displayAmount = (r) => {
|
|
1612
|
+
const code = (r.currency_code ?? "USD").toUpperCase();
|
|
1613
|
+
return `${code} ${Number(r.amount)}`;
|
|
1614
|
+
};
|
|
1615
|
+
const displayStatus = (r) => {
|
|
1616
|
+
const s2 = r.payment_status ?? "";
|
|
1617
|
+
return s2 !== "" ? s2 : "—";
|
|
1618
|
+
};
|
|
1619
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-7xl flex-col gap-6 p-6", children: [
|
|
1620
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1621
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1622
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refunds" }),
|
|
1623
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Refund records — amount, order, payment status" })
|
|
1624
|
+
] }),
|
|
1625
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadRefunds(0, true), children: "Refresh" })
|
|
1626
|
+
] }),
|
|
1627
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
1628
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1629
|
+
ui.Input,
|
|
1630
|
+
{
|
|
1631
|
+
placeholder: "Order ID",
|
|
1632
|
+
value: orderIdSearch,
|
|
1633
|
+
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
1634
|
+
className: "md:max-w-[180px]",
|
|
1635
|
+
"aria-label": "Filter by order ID"
|
|
1636
|
+
}
|
|
1637
|
+
),
|
|
1638
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1639
|
+
ui.Input,
|
|
1640
|
+
{
|
|
1641
|
+
placeholder: "Provider",
|
|
1642
|
+
value: providerSearch,
|
|
1643
|
+
onChange: (e) => setProviderSearch(e.target.value),
|
|
1644
|
+
className: "md:max-w-[140px]",
|
|
1645
|
+
"aria-label": "Filter by provider"
|
|
1646
|
+
}
|
|
1647
|
+
),
|
|
1648
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1649
|
+
ui.Input,
|
|
1650
|
+
{
|
|
1651
|
+
placeholder: "Currency",
|
|
1652
|
+
value: currencySearch,
|
|
1653
|
+
onChange: (e) => setCurrencySearch(e.target.value),
|
|
1654
|
+
className: "md:max-w-[100px]",
|
|
1655
|
+
"aria-label": "Filter by currency"
|
|
1656
|
+
}
|
|
1657
|
+
),
|
|
1658
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1659
|
+
"select",
|
|
1660
|
+
{
|
|
1661
|
+
value: paymentStatusFilter,
|
|
1662
|
+
onChange: (e) => setPaymentStatusFilter(e.target.value),
|
|
1663
|
+
className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-[160px]",
|
|
1664
|
+
"aria-label": "Filter by payment status",
|
|
1665
|
+
children: [
|
|
1666
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
1667
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
1668
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
1669
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "error", children: "Error" }),
|
|
1670
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
1671
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
1672
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
1673
|
+
]
|
|
1674
|
+
}
|
|
1675
|
+
),
|
|
1676
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1677
|
+
ui.Input,
|
|
1678
|
+
{
|
|
1679
|
+
type: "date",
|
|
1680
|
+
placeholder: "From",
|
|
1681
|
+
value: dateFrom,
|
|
1682
|
+
onChange: (e) => setDateFrom(e.target.value),
|
|
1683
|
+
className: "md:max-w-[140px]",
|
|
1684
|
+
"aria-label": "Date from"
|
|
1685
|
+
}
|
|
1686
|
+
),
|
|
1687
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1688
|
+
ui.Input,
|
|
1689
|
+
{
|
|
1690
|
+
type: "date",
|
|
1691
|
+
placeholder: "To",
|
|
1692
|
+
value: dateTo,
|
|
1693
|
+
onChange: (e) => setDateTo(e.target.value),
|
|
1694
|
+
className: "md:max-w-[140px]",
|
|
1695
|
+
"aria-label": "Date to"
|
|
1696
|
+
}
|
|
1697
|
+
),
|
|
1698
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1699
|
+
ui.Input,
|
|
1700
|
+
{
|
|
1701
|
+
placeholder: "Amount min",
|
|
1702
|
+
value: amountMin,
|
|
1703
|
+
onChange: (e) => setAmountMin(e.target.value),
|
|
1704
|
+
type: "number",
|
|
1705
|
+
min: 0,
|
|
1706
|
+
className: "md:max-w-[100px]",
|
|
1707
|
+
"aria-label": "Refund amount minimum"
|
|
1708
|
+
}
|
|
1709
|
+
),
|
|
1710
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1711
|
+
ui.Input,
|
|
1712
|
+
{
|
|
1713
|
+
placeholder: "Amount max",
|
|
1714
|
+
value: amountMax,
|
|
1715
|
+
onChange: (e) => setAmountMax(e.target.value),
|
|
1716
|
+
type: "number",
|
|
1717
|
+
min: 0,
|
|
1718
|
+
className: "md:max-w-[100px]",
|
|
1719
|
+
"aria-label": "Refund amount maximum"
|
|
1720
|
+
}
|
|
1721
|
+
)
|
|
1864
1722
|
] }) }),
|
|
1865
1723
|
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1866
1724
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1867
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1868
|
-
] }) :
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
] }),
|
|
1882
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1883
|
-
|
|
1884
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: displayAmount })
|
|
1885
|
-
] }),
|
|
1886
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1887
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
1888
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.provider_id })
|
|
1889
|
-
] }),
|
|
1890
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1891
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
1892
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1893
|
-
ui.Badge,
|
|
1894
|
-
{
|
|
1895
|
-
size: "2xsmall",
|
|
1896
|
-
className: `uppercase ${getStatusBadgeClass$3(displayStatus)}`,
|
|
1897
|
-
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
1898
|
-
}
|
|
1899
|
-
) })
|
|
1900
|
-
] }),
|
|
1901
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1902
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
1903
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
1904
|
-
] }),
|
|
1905
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1906
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
1907
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
1908
|
-
] }),
|
|
1909
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1910
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
1911
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
1912
|
-
] }),
|
|
1913
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1914
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
1915
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
1916
|
-
year: "numeric",
|
|
1917
|
-
month: "short",
|
|
1918
|
-
day: "numeric",
|
|
1919
|
-
hour: "numeric",
|
|
1920
|
-
minute: "2-digit",
|
|
1921
|
-
hour12: true
|
|
1922
|
-
}) })
|
|
1923
|
-
] })
|
|
1725
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => loadRefunds(0, true), children: "Try again" }) })
|
|
1726
|
+
] }) : null,
|
|
1727
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading refunds…" }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
1728
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No refunds yet" }),
|
|
1729
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Refund records will appear here." })
|
|
1730
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full overflow-x-auto rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full table-fixed divide-y divide-ui-border-base", style: { minWidth: 0 }, children: [
|
|
1731
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1732
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Refund ID" }),
|
|
1733
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
1734
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Payment ID" }),
|
|
1735
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[8%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
1736
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[6%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Currency" }),
|
|
1737
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[10%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
1738
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[10%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Payment Status" }),
|
|
1739
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[14%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Note" }),
|
|
1740
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1741
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[8%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1924
1742
|
] }) }),
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1743
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((r) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1744
|
+
"tr",
|
|
1745
|
+
{
|
|
1746
|
+
className: "cursor-pointer hover:bg-ui-bg-subtle/60",
|
|
1747
|
+
onClick: () => navigate(`/refunds/${r.refund_id}`),
|
|
1748
|
+
children: [
|
|
1749
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 font-mono text-sm text-ui-fg-base", title: r.refund_id, children: r.refund_id }),
|
|
1750
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 font-medium text-ui-fg-base", title: r.order_id ?? void 0, children: r.order_id ?? "—" }),
|
|
1751
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 font-mono text-sm text-ui-fg-subtle", title: r.payment_id, children: r.payment_id }),
|
|
1752
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", children: displayAmount(r) }),
|
|
1753
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle uppercase", children: r.currency_code || "—" }),
|
|
1754
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", title: r.provider_id || void 0, children: r.provider_id || "—" }),
|
|
1755
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1756
|
+
ui.Badge,
|
|
1757
|
+
{
|
|
1758
|
+
size: "2xsmall",
|
|
1759
|
+
className: `uppercase ${getStatusBadgeClass$4(displayStatus(r))}`,
|
|
1760
|
+
children: displayStatus(r) !== "—" ? displayStatus(r).replace(/_/g, " ") : "—"
|
|
1761
|
+
}
|
|
1762
|
+
) }),
|
|
1763
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", title: r.note ?? void 0, children: r.note ?? "—" }),
|
|
1764
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle text-xs", children: new Date(r.created_at).toLocaleDateString("en-US", {
|
|
1765
|
+
month: "short",
|
|
1766
|
+
day: "numeric",
|
|
1767
|
+
hour: "numeric",
|
|
1768
|
+
minute: "2-digit",
|
|
1769
|
+
hour12: true
|
|
1770
|
+
}) }),
|
|
1771
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-1", children: [
|
|
1772
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1773
|
+
ui.Button,
|
|
1774
|
+
{
|
|
1775
|
+
variant: "transparent",
|
|
1776
|
+
size: "small",
|
|
1777
|
+
onClick: (e) => {
|
|
1778
|
+
e.stopPropagation();
|
|
1779
|
+
navigate(`/refunds/${r.refund_id}`);
|
|
1780
|
+
},
|
|
1781
|
+
children: "Details"
|
|
1782
|
+
}
|
|
1783
|
+
),
|
|
1784
|
+
r.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1785
|
+
ui.Button,
|
|
1786
|
+
{
|
|
1787
|
+
variant: "transparent",
|
|
1788
|
+
size: "small",
|
|
1789
|
+
onClick: (e) => {
|
|
1790
|
+
e.stopPropagation();
|
|
1791
|
+
navigate(`/orders/${r.order_id}`);
|
|
1792
|
+
},
|
|
1793
|
+
children: "Order"
|
|
1794
|
+
}
|
|
1795
|
+
) : null
|
|
1796
|
+
] }) })
|
|
1797
|
+
]
|
|
1798
|
+
},
|
|
1799
|
+
r.refund_id
|
|
1800
|
+
)) })
|
|
1801
|
+
] }) }),
|
|
1802
|
+
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1803
|
+
ui.Button,
|
|
1804
|
+
{
|
|
1805
|
+
variant: "secondary",
|
|
1806
|
+
isLoading: isFetchingMore,
|
|
1807
|
+
onClick: () => loadRefunds(offset, false),
|
|
1808
|
+
children: "Load more"
|
|
1809
|
+
}
|
|
1810
|
+
) }) : null
|
|
1930
1811
|
] }) });
|
|
1931
1812
|
};
|
|
1932
|
-
const config$
|
|
1933
|
-
label: "
|
|
1934
|
-
icon: icons.
|
|
1813
|
+
const config$4 = adminSdk.defineRouteConfig({
|
|
1814
|
+
label: "Refunds",
|
|
1815
|
+
icon: icons.Receipt
|
|
1935
1816
|
});
|
|
1936
|
-
const getStatusBadgeClass$
|
|
1817
|
+
const getStatusBadgeClass$3 = (status) => {
|
|
1937
1818
|
const statusLower = status.toLowerCase();
|
|
1938
1819
|
if (statusLower === "requested") {
|
|
1939
1820
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -2071,7 +1952,7 @@ const SwapDetailPage = () => {
|
|
|
2071
1952
|
ui.Badge,
|
|
2072
1953
|
{
|
|
2073
1954
|
size: "small",
|
|
2074
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
1955
|
+
className: `uppercase ${getStatusBadgeClass$3(swap.status)}`,
|
|
2075
1956
|
children: swap.status.replace(/_/g, " ")
|
|
2076
1957
|
}
|
|
2077
1958
|
)
|
|
@@ -2139,7 +2020,7 @@ const SwapDetailPage = () => {
|
|
|
2139
2020
|
ui.Badge,
|
|
2140
2021
|
{
|
|
2141
2022
|
size: "2xsmall",
|
|
2142
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2023
|
+
className: `uppercase ${getStatusBadgeClass$3(entry.status)}`,
|
|
2143
2024
|
children: entry.status.replace(/_/g, " ")
|
|
2144
2025
|
}
|
|
2145
2026
|
) }),
|
|
@@ -2208,11 +2089,11 @@ const SwapDetailPage = () => {
|
|
|
2208
2089
|
] })
|
|
2209
2090
|
] }) });
|
|
2210
2091
|
};
|
|
2211
|
-
const config$
|
|
2092
|
+
const config$3 = adminSdk.defineRouteConfig({
|
|
2212
2093
|
label: "Swap Details",
|
|
2213
2094
|
icon: icons.ArrowPath
|
|
2214
2095
|
});
|
|
2215
|
-
const getStatusBadgeClass$
|
|
2096
|
+
const getStatusBadgeClass$2 = (status) => {
|
|
2216
2097
|
const statusLower = status.toLowerCase();
|
|
2217
2098
|
if (statusLower === "requested") {
|
|
2218
2099
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -2346,7 +2227,7 @@ const ReturnDetailPage = () => {
|
|
|
2346
2227
|
ui.Badge,
|
|
2347
2228
|
{
|
|
2348
2229
|
size: "small",
|
|
2349
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2230
|
+
className: `uppercase ${getStatusBadgeClass$2(returnOrder.status)}`,
|
|
2350
2231
|
children: returnOrder.status.replace(/_/g, " ")
|
|
2351
2232
|
}
|
|
2352
2233
|
)
|
|
@@ -2428,7 +2309,7 @@ const ReturnDetailPage = () => {
|
|
|
2428
2309
|
ui.Badge,
|
|
2429
2310
|
{
|
|
2430
2311
|
size: "2xsmall",
|
|
2431
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2312
|
+
className: `uppercase ${getStatusBadgeClass$2(entry.status)}`,
|
|
2432
2313
|
children: entry.status.replace(/_/g, " ")
|
|
2433
2314
|
}
|
|
2434
2315
|
) }),
|
|
@@ -2486,10 +2367,129 @@ const ReturnDetailPage = () => {
|
|
|
2486
2367
|
updateSuccess && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-ui-border-success bg-ui-bg-success-subtle p-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-success", children: "Action completed successfully" }) })
|
|
2487
2368
|
] }) });
|
|
2488
2369
|
};
|
|
2489
|
-
const config$
|
|
2370
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
2490
2371
|
label: "Return Order Details",
|
|
2491
2372
|
icon: icons.CheckCircle
|
|
2492
2373
|
});
|
|
2374
|
+
const getStatusBadgeClass$1 = (status) => {
|
|
2375
|
+
const s2 = status.toLowerCase();
|
|
2376
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2377
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2378
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2379
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2380
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2381
|
+
};
|
|
2382
|
+
const PaymentDetailPage = () => {
|
|
2383
|
+
var _a;
|
|
2384
|
+
const navigate = reactRouterDom.useNavigate();
|
|
2385
|
+
const params = reactRouterDom.useParams();
|
|
2386
|
+
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
2387
|
+
const [detail, setDetail] = react.useState(null);
|
|
2388
|
+
const [loading, setLoading] = react.useState(!!id);
|
|
2389
|
+
const [error, setError] = react.useState(null);
|
|
2390
|
+
react.useEffect(() => {
|
|
2391
|
+
if (!id) {
|
|
2392
|
+
setLoading(false);
|
|
2393
|
+
return;
|
|
2394
|
+
}
|
|
2395
|
+
let cancelled = false;
|
|
2396
|
+
setLoading(true);
|
|
2397
|
+
setError(null);
|
|
2398
|
+
fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
|
|
2399
|
+
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
2400
|
+
return res.json();
|
|
2401
|
+
}).then((data) => {
|
|
2402
|
+
if (!cancelled) setDetail(data);
|
|
2403
|
+
}).catch((e) => {
|
|
2404
|
+
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
2405
|
+
}).finally(() => {
|
|
2406
|
+
if (!cancelled) setLoading(false);
|
|
2407
|
+
});
|
|
2408
|
+
return () => {
|
|
2409
|
+
cancelled = true;
|
|
2410
|
+
};
|
|
2411
|
+
}, [id]);
|
|
2412
|
+
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
2413
|
+
const sessionStatusRaw = (detail == null ? void 0 : detail.session_status) ?? "—";
|
|
2414
|
+
const paymentStatusRaw = (detail == null ? void 0 : detail.payment_id) != null ? (detail == null ? void 0 : detail.payment_status) ?? "—" : "—";
|
|
2415
|
+
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
2416
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-4xl flex-col gap-6 p-6", children: [
|
|
2417
|
+
/* @__PURE__ */ jsxRuntime.jsx("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2418
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
2419
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payment session" }),
|
|
2420
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
|
|
2421
|
+
] }) }),
|
|
2422
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2423
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
2424
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
|
|
2425
|
+
] }) : loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading…" }) }) : detail ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
2426
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-xl border border-ui-border-base p-6 flex flex-col gap-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
2427
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2428
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
|
|
2429
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2430
|
+
ui.Button,
|
|
2431
|
+
{
|
|
2432
|
+
variant: "transparent",
|
|
2433
|
+
size: "small",
|
|
2434
|
+
onClick: () => navigate(`/orders/${detail.order_id}`),
|
|
2435
|
+
children: detail.order_id
|
|
2436
|
+
}
|
|
2437
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "—" }) })
|
|
2438
|
+
] }),
|
|
2439
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2440
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
2441
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: displayAmount })
|
|
2442
|
+
] }),
|
|
2443
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2444
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
2445
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.provider_id })
|
|
2446
|
+
] }),
|
|
2447
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2448
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
2449
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2450
|
+
ui.Badge,
|
|
2451
|
+
{
|
|
2452
|
+
size: "2xsmall",
|
|
2453
|
+
className: `uppercase ${getStatusBadgeClass$1(displayStatus)}`,
|
|
2454
|
+
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
2455
|
+
}
|
|
2456
|
+
) })
|
|
2457
|
+
] }),
|
|
2458
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2459
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
2460
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
2461
|
+
] }),
|
|
2462
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2463
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
2464
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
2465
|
+
] }),
|
|
2466
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2467
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
2468
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
2469
|
+
] }),
|
|
2470
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2471
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
2472
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
2473
|
+
year: "numeric",
|
|
2474
|
+
month: "short",
|
|
2475
|
+
day: "numeric",
|
|
2476
|
+
hour: "numeric",
|
|
2477
|
+
minute: "2-digit",
|
|
2478
|
+
hour12: true
|
|
2479
|
+
}) })
|
|
2480
|
+
] })
|
|
2481
|
+
] }) }),
|
|
2482
|
+
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2483
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
2484
|
+
/* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.data, null, 2) })
|
|
2485
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-xl border border-ui-border-base p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No provider data for this session." }) })
|
|
2486
|
+
] }) : null
|
|
2487
|
+
] }) });
|
|
2488
|
+
};
|
|
2489
|
+
const config$1 = adminSdk.defineRouteConfig({
|
|
2490
|
+
label: "Payment details",
|
|
2491
|
+
icon: icons.CreditCard
|
|
2492
|
+
});
|
|
2493
2493
|
const getStatusBadgeClass = (status) => {
|
|
2494
2494
|
const s2 = status.toLowerCase();
|
|
2495
2495
|
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
@@ -2695,25 +2695,21 @@ const widgetModule = { widgets: [
|
|
|
2695
2695
|
] };
|
|
2696
2696
|
const routeModule = {
|
|
2697
2697
|
routes: [
|
|
2698
|
-
{
|
|
2699
|
-
Component: PaymentsPage,
|
|
2700
|
-
path: "/payments"
|
|
2701
|
-
},
|
|
2702
2698
|
{
|
|
2703
2699
|
Component: SwapsPage,
|
|
2704
2700
|
path: "/swaps"
|
|
2705
2701
|
},
|
|
2706
|
-
{
|
|
2707
|
-
Component: RefundsPage,
|
|
2708
|
-
path: "/refunds"
|
|
2709
|
-
},
|
|
2710
2702
|
{
|
|
2711
2703
|
Component: ReturnsPage,
|
|
2712
2704
|
path: "/returns"
|
|
2713
2705
|
},
|
|
2714
2706
|
{
|
|
2715
|
-
Component:
|
|
2716
|
-
path: "/payments
|
|
2707
|
+
Component: PaymentsPage,
|
|
2708
|
+
path: "/payments"
|
|
2709
|
+
},
|
|
2710
|
+
{
|
|
2711
|
+
Component: RefundsPage,
|
|
2712
|
+
path: "/refunds"
|
|
2717
2713
|
},
|
|
2718
2714
|
{
|
|
2719
2715
|
Component: SwapDetailPage,
|
|
@@ -2723,6 +2719,10 @@ const routeModule = {
|
|
|
2723
2719
|
Component: ReturnDetailPage,
|
|
2724
2720
|
path: "/returns/:id"
|
|
2725
2721
|
},
|
|
2722
|
+
{
|
|
2723
|
+
Component: PaymentDetailPage,
|
|
2724
|
+
path: "/payments/:id"
|
|
2725
|
+
},
|
|
2726
2726
|
{
|
|
2727
2727
|
Component: RefundDetailPage,
|
|
2728
2728
|
path: "/refunds/:id"
|
|
@@ -2734,31 +2734,25 @@ const menuItemModule = {
|
|
|
2734
2734
|
{
|
|
2735
2735
|
label: config$4.label,
|
|
2736
2736
|
icon: config$4.icon,
|
|
2737
|
-
path: "/
|
|
2737
|
+
path: "/refunds",
|
|
2738
2738
|
nested: void 0
|
|
2739
2739
|
},
|
|
2740
2740
|
{
|
|
2741
2741
|
label: config$5.label,
|
|
2742
2742
|
icon: config$5.icon,
|
|
2743
|
-
path: "/
|
|
2743
|
+
path: "/payments",
|
|
2744
2744
|
nested: void 0
|
|
2745
2745
|
},
|
|
2746
2746
|
{
|
|
2747
2747
|
label: config$7.label,
|
|
2748
2748
|
icon: config$7.icon,
|
|
2749
|
-
path: "/
|
|
2749
|
+
path: "/swaps",
|
|
2750
2750
|
nested: void 0
|
|
2751
2751
|
},
|
|
2752
2752
|
{
|
|
2753
2753
|
label: config$6.label,
|
|
2754
2754
|
icon: config$6.icon,
|
|
2755
|
-
path: "/
|
|
2756
|
-
nested: void 0
|
|
2757
|
-
},
|
|
2758
|
-
{
|
|
2759
|
-
label: config$1.label,
|
|
2760
|
-
icon: config$1.icon,
|
|
2761
|
-
path: "/returns/:id",
|
|
2755
|
+
path: "/returns",
|
|
2762
2756
|
nested: void 0
|
|
2763
2757
|
},
|
|
2764
2758
|
{
|
|
@@ -2768,14 +2762,20 @@ const menuItemModule = {
|
|
|
2768
2762
|
nested: void 0
|
|
2769
2763
|
},
|
|
2770
2764
|
{
|
|
2771
|
-
label: config$
|
|
2772
|
-
icon: config$
|
|
2765
|
+
label: config$1.label,
|
|
2766
|
+
icon: config$1.icon,
|
|
2773
2767
|
path: "/payments/:id",
|
|
2774
2768
|
nested: void 0
|
|
2775
2769
|
},
|
|
2776
2770
|
{
|
|
2777
2771
|
label: config$2.label,
|
|
2778
2772
|
icon: config$2.icon,
|
|
2773
|
+
path: "/returns/:id",
|
|
2774
|
+
nested: void 0
|
|
2775
|
+
},
|
|
2776
|
+
{
|
|
2777
|
+
label: config$3.label,
|
|
2778
|
+
icon: config$3.icon,
|
|
2779
2779
|
path: "/swaps/:id",
|
|
2780
2780
|
nested: void 0
|
|
2781
2781
|
}
|