order-management 0.0.87 → 0.0.88
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,236 +866,6 @@ const useDebounce$3 = (value, delay) => {
|
|
|
866
866
|
return debouncedValue;
|
|
867
867
|
};
|
|
868
868
|
const getStatusBadgeClass$7 = (status) => {
|
|
869
|
-
const statusLower = status.toLowerCase();
|
|
870
|
-
if (statusLower === "requested") {
|
|
871
|
-
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
872
|
-
}
|
|
873
|
-
if (statusLower === "approved") {
|
|
874
|
-
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
875
|
-
}
|
|
876
|
-
if (statusLower === "rejected") {
|
|
877
|
-
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
878
|
-
}
|
|
879
|
-
if (statusLower === "completed") {
|
|
880
|
-
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
881
|
-
}
|
|
882
|
-
if (statusLower === "cancelled") {
|
|
883
|
-
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
884
|
-
}
|
|
885
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
886
|
-
};
|
|
887
|
-
const SwapsPage = () => {
|
|
888
|
-
const navigate = reactRouterDom.useNavigate();
|
|
889
|
-
const [items, setItems] = react.useState([]);
|
|
890
|
-
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
891
|
-
const [createdByFilter, setCreatedByFilter] = react.useState("all");
|
|
892
|
-
const [searchQuery, setSearchQuery] = react.useState("");
|
|
893
|
-
const debouncedSearchQuery = useDebounce$3(searchQuery, 300);
|
|
894
|
-
const [isLoading, setIsLoading] = react.useState(true);
|
|
895
|
-
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
896
|
-
const [error, setError] = react.useState(null);
|
|
897
|
-
const [offset, setOffset] = react.useState(0);
|
|
898
|
-
const [count, setCount] = react.useState(0);
|
|
899
|
-
const limit = 50;
|
|
900
|
-
const loadSwaps = react.useCallback(
|
|
901
|
-
async (nextOffset, replace = false) => {
|
|
902
|
-
var _a;
|
|
903
|
-
try {
|
|
904
|
-
if (replace) {
|
|
905
|
-
setIsLoading(true);
|
|
906
|
-
} else {
|
|
907
|
-
setIsFetchingMore(true);
|
|
908
|
-
}
|
|
909
|
-
setError(null);
|
|
910
|
-
const params = new URLSearchParams();
|
|
911
|
-
params.set("limit", String(limit));
|
|
912
|
-
params.set("offset", String(nextOffset));
|
|
913
|
-
if (statusFilter !== "all") {
|
|
914
|
-
params.set("status", statusFilter);
|
|
915
|
-
}
|
|
916
|
-
if (debouncedSearchQuery.trim()) {
|
|
917
|
-
params.set("order_id", debouncedSearchQuery.trim());
|
|
918
|
-
}
|
|
919
|
-
if (createdByFilter !== "all") {
|
|
920
|
-
params.set("created_by", createdByFilter);
|
|
921
|
-
}
|
|
922
|
-
const response = await fetch(
|
|
923
|
-
`/admin/swaps?${params.toString()}`,
|
|
924
|
-
{ credentials: "include" }
|
|
925
|
-
);
|
|
926
|
-
if (!response.ok) {
|
|
927
|
-
const message = await response.text();
|
|
928
|
-
throw new Error(message || "Unable to load swaps");
|
|
929
|
-
}
|
|
930
|
-
const payload = await response.json();
|
|
931
|
-
setCount(payload.count ?? 0);
|
|
932
|
-
setOffset(nextOffset + (((_a = payload.swaps) == null ? void 0 : _a.length) ?? 0));
|
|
933
|
-
setItems(
|
|
934
|
-
(prev) => replace ? payload.swaps ?? [] : [...prev, ...payload.swaps ?? []]
|
|
935
|
-
);
|
|
936
|
-
} catch (loadError) {
|
|
937
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load swaps";
|
|
938
|
-
setError(message);
|
|
939
|
-
} finally {
|
|
940
|
-
setIsLoading(false);
|
|
941
|
-
setIsFetchingMore(false);
|
|
942
|
-
}
|
|
943
|
-
},
|
|
944
|
-
[statusFilter, createdByFilter, debouncedSearchQuery]
|
|
945
|
-
);
|
|
946
|
-
react.useEffect(() => {
|
|
947
|
-
void loadSwaps(0, true);
|
|
948
|
-
}, [statusFilter, createdByFilter, debouncedSearchQuery, loadSwaps]);
|
|
949
|
-
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
950
|
-
const availableStatuses = react.useMemo(() => {
|
|
951
|
-
const statuses = /* @__PURE__ */ new Set();
|
|
952
|
-
items.forEach((item) => statuses.add(item.status));
|
|
953
|
-
return Array.from(statuses).sort();
|
|
954
|
-
}, [items]);
|
|
955
|
-
return /* @__PURE__ */ 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: [
|
|
956
|
-
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
957
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
958
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Exchanges" }),
|
|
959
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer exchange requests" })
|
|
960
|
-
] }),
|
|
961
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadSwaps(0, true), children: "Refresh" })
|
|
962
|
-
] }),
|
|
963
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
964
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
965
|
-
ui.Input,
|
|
966
|
-
{
|
|
967
|
-
placeholder: "Search by swap ID or order ID",
|
|
968
|
-
value: searchQuery,
|
|
969
|
-
onChange: (event) => setSearchQuery(event.target.value),
|
|
970
|
-
className: "md:max-w-sm"
|
|
971
|
-
}
|
|
972
|
-
),
|
|
973
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
|
|
974
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
975
|
-
"select",
|
|
976
|
-
{
|
|
977
|
-
value: createdByFilter,
|
|
978
|
-
onChange: (event) => setCreatedByFilter(event.target.value),
|
|
979
|
-
className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-xs",
|
|
980
|
-
children: [
|
|
981
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All (Created by)" }),
|
|
982
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "customer", children: "Customer" }),
|
|
983
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "admin", children: "Admin" })
|
|
984
|
-
]
|
|
985
|
-
}
|
|
986
|
-
),
|
|
987
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
988
|
-
"select",
|
|
989
|
-
{
|
|
990
|
-
value: statusFilter,
|
|
991
|
-
onChange: (event) => setStatusFilter(event.target.value),
|
|
992
|
-
className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-xs",
|
|
993
|
-
children: [
|
|
994
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All Statuses" }),
|
|
995
|
-
availableStatuses.map((status) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: status, children: status.replace(/_/g, " ").toUpperCase() }, status))
|
|
996
|
-
]
|
|
997
|
-
}
|
|
998
|
-
)
|
|
999
|
-
] })
|
|
1000
|
-
] }),
|
|
1001
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1002
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1003
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1004
|
-
ui.Button,
|
|
1005
|
-
{
|
|
1006
|
-
variant: "secondary",
|
|
1007
|
-
onClick: () => loadSwaps(0, true),
|
|
1008
|
-
children: "Try again"
|
|
1009
|
-
}
|
|
1010
|
-
) })
|
|
1011
|
-
] }) : null,
|
|
1012
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading swaps..." }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
1013
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No exchanges yet" }),
|
|
1014
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Exchange requests created by customers will appear here." })
|
|
1015
|
-
] }) : /* @__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: [
|
|
1016
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1017
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Exchange ID" }),
|
|
1018
|
-
/* @__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" }),
|
|
1019
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
1020
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Difference Due" }),
|
|
1021
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1022
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1023
|
-
] }) }),
|
|
1024
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((swap) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1025
|
-
"tr",
|
|
1026
|
-
{
|
|
1027
|
-
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1028
|
-
onClick: () => navigate(`/swaps/${swap.id}`),
|
|
1029
|
-
children: [
|
|
1030
|
-
/* @__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: swap.id }) }) }),
|
|
1031
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: swap.order_id }),
|
|
1032
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1033
|
-
ui.Badge,
|
|
1034
|
-
{
|
|
1035
|
-
size: "2xsmall",
|
|
1036
|
-
className: `uppercase ${getStatusBadgeClass$7(swap.status)}`,
|
|
1037
|
-
children: swap.status.replace(/_/g, " ")
|
|
1038
|
-
}
|
|
1039
|
-
) }),
|
|
1040
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
|
|
1041
|
-
const amount = swap.difference_due;
|
|
1042
|
-
if (amount == null || amount === void 0) {
|
|
1043
|
-
return "—";
|
|
1044
|
-
}
|
|
1045
|
-
const displayAmount = Number(amount) / 100;
|
|
1046
|
-
const currency = swap.currency_code || "$";
|
|
1047
|
-
const sign = displayAmount >= 0 ? "+" : "";
|
|
1048
|
-
return `${sign}${currency}${displayAmount.toFixed(2)}`;
|
|
1049
|
-
})() }),
|
|
1050
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(swap.created_at).toLocaleDateString("en-US", {
|
|
1051
|
-
year: "numeric",
|
|
1052
|
-
month: "short",
|
|
1053
|
-
day: "numeric",
|
|
1054
|
-
hour: "numeric",
|
|
1055
|
-
minute: "2-digit",
|
|
1056
|
-
hour12: true
|
|
1057
|
-
}) }),
|
|
1058
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1059
|
-
ui.Button,
|
|
1060
|
-
{
|
|
1061
|
-
variant: "transparent",
|
|
1062
|
-
size: "small",
|
|
1063
|
-
onClick: (e) => {
|
|
1064
|
-
e.stopPropagation();
|
|
1065
|
-
navigate(`/app/orders/${swap.order_id}`);
|
|
1066
|
-
},
|
|
1067
|
-
children: "Go to order"
|
|
1068
|
-
}
|
|
1069
|
-
) })
|
|
1070
|
-
]
|
|
1071
|
-
},
|
|
1072
|
-
swap.id
|
|
1073
|
-
)) })
|
|
1074
|
-
] }) }),
|
|
1075
|
-
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1076
|
-
ui.Button,
|
|
1077
|
-
{
|
|
1078
|
-
variant: "secondary",
|
|
1079
|
-
isLoading: isFetchingMore,
|
|
1080
|
-
onClick: () => loadSwaps(offset, false),
|
|
1081
|
-
children: "Load more"
|
|
1082
|
-
}
|
|
1083
|
-
) }) : null
|
|
1084
|
-
] }) });
|
|
1085
|
-
};
|
|
1086
|
-
const config$7 = adminSdk.defineRouteConfig({
|
|
1087
|
-
label: "Exchanges",
|
|
1088
|
-
icon: icons.ArrowPath
|
|
1089
|
-
});
|
|
1090
|
-
const useDebounce$2 = (value, delay) => {
|
|
1091
|
-
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
1092
|
-
react.useEffect(() => {
|
|
1093
|
-
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
1094
|
-
return () => clearTimeout(handler);
|
|
1095
|
-
}, [value, delay]);
|
|
1096
|
-
return debouncedValue;
|
|
1097
|
-
};
|
|
1098
|
-
const getStatusBadgeClass$6 = (status) => {
|
|
1099
869
|
const s2 = status.toLowerCase();
|
|
1100
870
|
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1101
871
|
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
@@ -1107,12 +877,12 @@ const RefundsPage = () => {
|
|
|
1107
877
|
const navigate = reactRouterDom.useNavigate();
|
|
1108
878
|
const [items, setItems] = react.useState([]);
|
|
1109
879
|
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
1110
|
-
const debouncedOrderId = useDebounce$
|
|
880
|
+
const debouncedOrderId = useDebounce$3(orderIdSearch, 300);
|
|
1111
881
|
const [paymentStatusFilter, setPaymentStatusFilter] = react.useState("all");
|
|
1112
882
|
const [providerSearch, setProviderSearch] = react.useState("");
|
|
1113
|
-
const debouncedProvider = useDebounce$
|
|
883
|
+
const debouncedProvider = useDebounce$3(providerSearch, 300);
|
|
1114
884
|
const [currencySearch, setCurrencySearch] = react.useState("");
|
|
1115
|
-
const debouncedCurrency = useDebounce$
|
|
885
|
+
const debouncedCurrency = useDebounce$3(currencySearch, 300);
|
|
1116
886
|
const [dateFrom, setDateFrom] = react.useState("");
|
|
1117
887
|
const [dateTo, setDateTo] = react.useState("");
|
|
1118
888
|
const [amountMin, setAmountMin] = react.useState("");
|
|
@@ -1324,7 +1094,7 @@ const RefundsPage = () => {
|
|
|
1324
1094
|
ui.Badge,
|
|
1325
1095
|
{
|
|
1326
1096
|
size: "2xsmall",
|
|
1327
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
1097
|
+
className: `uppercase ${getStatusBadgeClass$7(displayStatus(r))}`,
|
|
1328
1098
|
children: displayStatus(r) !== "—" ? displayStatus(r).replace(/_/g, " ") : "—"
|
|
1329
1099
|
}
|
|
1330
1100
|
) }),
|
|
@@ -1378,11 +1148,11 @@ const RefundsPage = () => {
|
|
|
1378
1148
|
) }) : null
|
|
1379
1149
|
] }) });
|
|
1380
1150
|
};
|
|
1381
|
-
const config$
|
|
1151
|
+
const config$7 = adminSdk.defineRouteConfig({
|
|
1382
1152
|
label: "Refunds",
|
|
1383
1153
|
icon: icons.Receipt
|
|
1384
1154
|
});
|
|
1385
|
-
const useDebounce$
|
|
1155
|
+
const useDebounce$2 = (value, delay) => {
|
|
1386
1156
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
1387
1157
|
react.useEffect(() => {
|
|
1388
1158
|
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
@@ -1390,7 +1160,7 @@ const useDebounce$1 = (value, delay) => {
|
|
|
1390
1160
|
}, [value, delay]);
|
|
1391
1161
|
return debouncedValue;
|
|
1392
1162
|
};
|
|
1393
|
-
const getStatusBadgeClass$
|
|
1163
|
+
const getStatusBadgeClass$6 = (status) => {
|
|
1394
1164
|
const statusLower = status.toLowerCase();
|
|
1395
1165
|
if (statusLower === "requested") {
|
|
1396
1166
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -1415,7 +1185,7 @@ const ReturnsPage = () => {
|
|
|
1415
1185
|
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
1416
1186
|
const [createdByFilter, setCreatedByFilter] = react.useState("all");
|
|
1417
1187
|
const [searchQuery, setSearchQuery] = react.useState("");
|
|
1418
|
-
const debouncedSearchQuery = useDebounce$
|
|
1188
|
+
const debouncedSearchQuery = useDebounce$2(searchQuery, 300);
|
|
1419
1189
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
1420
1190
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
1421
1191
|
const [error, setError] = react.useState(null);
|
|
@@ -1561,7 +1331,7 @@ const ReturnsPage = () => {
|
|
|
1561
1331
|
ui.Badge,
|
|
1562
1332
|
{
|
|
1563
1333
|
size: "2xsmall",
|
|
1564
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
1334
|
+
className: `uppercase ${getStatusBadgeClass$6(returnOrder.status)}`,
|
|
1565
1335
|
children: returnOrder.status.replace(/_/g, " ")
|
|
1566
1336
|
}
|
|
1567
1337
|
) }),
|
|
@@ -1610,11 +1380,11 @@ const ReturnsPage = () => {
|
|
|
1610
1380
|
) }) : null
|
|
1611
1381
|
] }) });
|
|
1612
1382
|
};
|
|
1613
|
-
const config$
|
|
1383
|
+
const config$6 = adminSdk.defineRouteConfig({
|
|
1614
1384
|
label: "Return Orders",
|
|
1615
1385
|
icon: icons.ArrowPath
|
|
1616
1386
|
});
|
|
1617
|
-
const useDebounce = (value, delay) => {
|
|
1387
|
+
const useDebounce$1 = (value, delay) => {
|
|
1618
1388
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
1619
1389
|
react.useEffect(() => {
|
|
1620
1390
|
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
@@ -1622,7 +1392,7 @@ const useDebounce = (value, delay) => {
|
|
|
1622
1392
|
}, [value, delay]);
|
|
1623
1393
|
return debouncedValue;
|
|
1624
1394
|
};
|
|
1625
|
-
const getStatusBadgeClass$
|
|
1395
|
+
const getStatusBadgeClass$5 = (status) => {
|
|
1626
1396
|
const s2 = status.toLowerCase();
|
|
1627
1397
|
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1628
1398
|
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
@@ -1635,7 +1405,7 @@ const PaymentsPage = () => {
|
|
|
1635
1405
|
const [items, setItems] = react.useState([]);
|
|
1636
1406
|
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
1637
1407
|
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
1638
|
-
const debouncedOrderId = useDebounce(orderIdSearch, 300);
|
|
1408
|
+
const debouncedOrderId = useDebounce$1(orderIdSearch, 300);
|
|
1639
1409
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
1640
1410
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
1641
1411
|
const [error, setError] = react.useState(null);
|
|
@@ -1755,7 +1525,7 @@ const PaymentsPage = () => {
|
|
|
1755
1525
|
ui.Badge,
|
|
1756
1526
|
{
|
|
1757
1527
|
size: "2xsmall",
|
|
1758
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
1528
|
+
className: `uppercase ${getStatusBadgeClass$5(displayStatus(t))}`,
|
|
1759
1529
|
children: displayStatus(t) !== "—" ? displayStatus(t).replace(/_/g, " ") : "—"
|
|
1760
1530
|
}
|
|
1761
1531
|
) }),
|
|
@@ -1810,11 +1580,19 @@ const PaymentsPage = () => {
|
|
|
1810
1580
|
) }) : null
|
|
1811
1581
|
] }) });
|
|
1812
1582
|
};
|
|
1813
|
-
const config$
|
|
1583
|
+
const config$5 = adminSdk.defineRouteConfig({
|
|
1814
1584
|
label: "Payments",
|
|
1815
1585
|
icon: icons.CreditCard
|
|
1816
1586
|
});
|
|
1817
|
-
const
|
|
1587
|
+
const useDebounce = (value, delay) => {
|
|
1588
|
+
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
1589
|
+
react.useEffect(() => {
|
|
1590
|
+
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
1591
|
+
return () => clearTimeout(handler);
|
|
1592
|
+
}, [value, delay]);
|
|
1593
|
+
return debouncedValue;
|
|
1594
|
+
};
|
|
1595
|
+
const getStatusBadgeClass$4 = (status) => {
|
|
1818
1596
|
const statusLower = status.toLowerCase();
|
|
1819
1597
|
if (statusLower === "requested") {
|
|
1820
1598
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -1828,11 +1606,425 @@ const getStatusBadgeClass$3 = (status) => {
|
|
|
1828
1606
|
if (statusLower === "completed") {
|
|
1829
1607
|
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1830
1608
|
}
|
|
1831
|
-
if (statusLower === "cancelled"
|
|
1609
|
+
if (statusLower === "cancelled") {
|
|
1832
1610
|
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
1833
1611
|
}
|
|
1834
|
-
|
|
1835
|
-
|
|
1612
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1613
|
+
};
|
|
1614
|
+
const SwapsPage = () => {
|
|
1615
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1616
|
+
const [items, setItems] = react.useState([]);
|
|
1617
|
+
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
1618
|
+
const [createdByFilter, setCreatedByFilter] = react.useState("all");
|
|
1619
|
+
const [searchQuery, setSearchQuery] = react.useState("");
|
|
1620
|
+
const debouncedSearchQuery = useDebounce(searchQuery, 300);
|
|
1621
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
1622
|
+
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
1623
|
+
const [error, setError] = react.useState(null);
|
|
1624
|
+
const [offset, setOffset] = react.useState(0);
|
|
1625
|
+
const [count, setCount] = react.useState(0);
|
|
1626
|
+
const limit = 50;
|
|
1627
|
+
const loadSwaps = react.useCallback(
|
|
1628
|
+
async (nextOffset, replace = false) => {
|
|
1629
|
+
var _a;
|
|
1630
|
+
try {
|
|
1631
|
+
if (replace) {
|
|
1632
|
+
setIsLoading(true);
|
|
1633
|
+
} else {
|
|
1634
|
+
setIsFetchingMore(true);
|
|
1635
|
+
}
|
|
1636
|
+
setError(null);
|
|
1637
|
+
const params = new URLSearchParams();
|
|
1638
|
+
params.set("limit", String(limit));
|
|
1639
|
+
params.set("offset", String(nextOffset));
|
|
1640
|
+
if (statusFilter !== "all") {
|
|
1641
|
+
params.set("status", statusFilter);
|
|
1642
|
+
}
|
|
1643
|
+
if (debouncedSearchQuery.trim()) {
|
|
1644
|
+
params.set("order_id", debouncedSearchQuery.trim());
|
|
1645
|
+
}
|
|
1646
|
+
if (createdByFilter !== "all") {
|
|
1647
|
+
params.set("created_by", createdByFilter);
|
|
1648
|
+
}
|
|
1649
|
+
const response = await fetch(
|
|
1650
|
+
`/admin/swaps?${params.toString()}`,
|
|
1651
|
+
{ credentials: "include" }
|
|
1652
|
+
);
|
|
1653
|
+
if (!response.ok) {
|
|
1654
|
+
const message = await response.text();
|
|
1655
|
+
throw new Error(message || "Unable to load swaps");
|
|
1656
|
+
}
|
|
1657
|
+
const payload = await response.json();
|
|
1658
|
+
setCount(payload.count ?? 0);
|
|
1659
|
+
setOffset(nextOffset + (((_a = payload.swaps) == null ? void 0 : _a.length) ?? 0));
|
|
1660
|
+
setItems(
|
|
1661
|
+
(prev) => replace ? payload.swaps ?? [] : [...prev, ...payload.swaps ?? []]
|
|
1662
|
+
);
|
|
1663
|
+
} catch (loadError) {
|
|
1664
|
+
const message = loadError instanceof Error ? loadError.message : "Unable to load swaps";
|
|
1665
|
+
setError(message);
|
|
1666
|
+
} finally {
|
|
1667
|
+
setIsLoading(false);
|
|
1668
|
+
setIsFetchingMore(false);
|
|
1669
|
+
}
|
|
1670
|
+
},
|
|
1671
|
+
[statusFilter, createdByFilter, debouncedSearchQuery]
|
|
1672
|
+
);
|
|
1673
|
+
react.useEffect(() => {
|
|
1674
|
+
void loadSwaps(0, true);
|
|
1675
|
+
}, [statusFilter, createdByFilter, debouncedSearchQuery, loadSwaps]);
|
|
1676
|
+
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
1677
|
+
const availableStatuses = react.useMemo(() => {
|
|
1678
|
+
const statuses = /* @__PURE__ */ new Set();
|
|
1679
|
+
items.forEach((item) => statuses.add(item.status));
|
|
1680
|
+
return Array.from(statuses).sort();
|
|
1681
|
+
}, [items]);
|
|
1682
|
+
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: [
|
|
1683
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1684
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1685
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Exchanges" }),
|
|
1686
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer exchange requests" })
|
|
1687
|
+
] }),
|
|
1688
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadSwaps(0, true), children: "Refresh" })
|
|
1689
|
+
] }),
|
|
1690
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1691
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1692
|
+
ui.Input,
|
|
1693
|
+
{
|
|
1694
|
+
placeholder: "Search by swap ID or order ID",
|
|
1695
|
+
value: searchQuery,
|
|
1696
|
+
onChange: (event) => setSearchQuery(event.target.value),
|
|
1697
|
+
className: "md:max-w-sm"
|
|
1698
|
+
}
|
|
1699
|
+
),
|
|
1700
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
|
|
1701
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1702
|
+
"select",
|
|
1703
|
+
{
|
|
1704
|
+
value: createdByFilter,
|
|
1705
|
+
onChange: (event) => setCreatedByFilter(event.target.value),
|
|
1706
|
+
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",
|
|
1707
|
+
children: [
|
|
1708
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All (Created by)" }),
|
|
1709
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "customer", children: "Customer" }),
|
|
1710
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "admin", children: "Admin" })
|
|
1711
|
+
]
|
|
1712
|
+
}
|
|
1713
|
+
),
|
|
1714
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1715
|
+
"select",
|
|
1716
|
+
{
|
|
1717
|
+
value: statusFilter,
|
|
1718
|
+
onChange: (event) => setStatusFilter(event.target.value),
|
|
1719
|
+
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",
|
|
1720
|
+
children: [
|
|
1721
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All Statuses" }),
|
|
1722
|
+
availableStatuses.map((status) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: status, children: status.replace(/_/g, " ").toUpperCase() }, status))
|
|
1723
|
+
]
|
|
1724
|
+
}
|
|
1725
|
+
)
|
|
1726
|
+
] })
|
|
1727
|
+
] }),
|
|
1728
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1729
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1730
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1731
|
+
ui.Button,
|
|
1732
|
+
{
|
|
1733
|
+
variant: "secondary",
|
|
1734
|
+
onClick: () => loadSwaps(0, true),
|
|
1735
|
+
children: "Try again"
|
|
1736
|
+
}
|
|
1737
|
+
) })
|
|
1738
|
+
] }) : null,
|
|
1739
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading swaps..." }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
1740
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No exchanges yet" }),
|
|
1741
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Exchange requests created by customers will appear here." })
|
|
1742
|
+
] }) : /* @__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: [
|
|
1743
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1744
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Exchange 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: "Order ID" }),
|
|
1746
|
+
/* @__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: "Difference Due" }),
|
|
1748
|
+
/* @__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
|
+
/* @__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
|
+
] }) }),
|
|
1751
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((swap) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1752
|
+
"tr",
|
|
1753
|
+
{
|
|
1754
|
+
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1755
|
+
onClick: () => navigate(`/swaps/${swap.id}`),
|
|
1756
|
+
children: [
|
|
1757
|
+
/* @__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: swap.id }) }) }),
|
|
1758
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: swap.order_id }),
|
|
1759
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1760
|
+
ui.Badge,
|
|
1761
|
+
{
|
|
1762
|
+
size: "2xsmall",
|
|
1763
|
+
className: `uppercase ${getStatusBadgeClass$4(swap.status)}`,
|
|
1764
|
+
children: swap.status.replace(/_/g, " ")
|
|
1765
|
+
}
|
|
1766
|
+
) }),
|
|
1767
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
|
|
1768
|
+
const amount = swap.difference_due;
|
|
1769
|
+
if (amount == null || amount === void 0) {
|
|
1770
|
+
return "—";
|
|
1771
|
+
}
|
|
1772
|
+
const displayAmount = Number(amount) / 100;
|
|
1773
|
+
const currency = swap.currency_code || "$";
|
|
1774
|
+
const sign = displayAmount >= 0 ? "+" : "";
|
|
1775
|
+
return `${sign}${currency}${displayAmount.toFixed(2)}`;
|
|
1776
|
+
})() }),
|
|
1777
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(swap.created_at).toLocaleDateString("en-US", {
|
|
1778
|
+
year: "numeric",
|
|
1779
|
+
month: "short",
|
|
1780
|
+
day: "numeric",
|
|
1781
|
+
hour: "numeric",
|
|
1782
|
+
minute: "2-digit",
|
|
1783
|
+
hour12: true
|
|
1784
|
+
}) }),
|
|
1785
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1786
|
+
ui.Button,
|
|
1787
|
+
{
|
|
1788
|
+
variant: "transparent",
|
|
1789
|
+
size: "small",
|
|
1790
|
+
onClick: (e) => {
|
|
1791
|
+
e.stopPropagation();
|
|
1792
|
+
navigate(`/app/orders/${swap.order_id}`);
|
|
1793
|
+
},
|
|
1794
|
+
children: "Go to order"
|
|
1795
|
+
}
|
|
1796
|
+
) })
|
|
1797
|
+
]
|
|
1798
|
+
},
|
|
1799
|
+
swap.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: () => loadSwaps(offset, false),
|
|
1808
|
+
children: "Load more"
|
|
1809
|
+
}
|
|
1810
|
+
) }) : null
|
|
1811
|
+
] }) });
|
|
1812
|
+
};
|
|
1813
|
+
const config$4 = adminSdk.defineRouteConfig({
|
|
1814
|
+
label: "Exchanges",
|
|
1815
|
+
icon: icons.ArrowPath
|
|
1816
|
+
});
|
|
1817
|
+
const getStatusBadgeClass$3 = (status) => {
|
|
1818
|
+
const s2 = status.toLowerCase();
|
|
1819
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1820
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1821
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1822
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1823
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1824
|
+
};
|
|
1825
|
+
const formatAmount = (value) => {
|
|
1826
|
+
return String(value);
|
|
1827
|
+
};
|
|
1828
|
+
const RefundDetailPage = () => {
|
|
1829
|
+
var _a, _b, _c;
|
|
1830
|
+
const navigate = reactRouterDom.useNavigate();
|
|
1831
|
+
const params = reactRouterDom.useParams();
|
|
1832
|
+
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
1833
|
+
const [detail, setDetail] = react.useState(null);
|
|
1834
|
+
const [loading, setLoading] = react.useState(!!id);
|
|
1835
|
+
const [error, setError] = react.useState(null);
|
|
1836
|
+
const [gatewayExpanded, setGatewayExpanded] = react.useState(false);
|
|
1837
|
+
react.useEffect(() => {
|
|
1838
|
+
if (!id) {
|
|
1839
|
+
setLoading(false);
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1842
|
+
let cancelled = false;
|
|
1843
|
+
setLoading(true);
|
|
1844
|
+
setError(null);
|
|
1845
|
+
fetch(`/admin/refunds/${id}`, { credentials: "include" }).then((res) => {
|
|
1846
|
+
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
1847
|
+
return res.json();
|
|
1848
|
+
}).then((data) => {
|
|
1849
|
+
if (!cancelled) setDetail(data);
|
|
1850
|
+
}).catch((e) => {
|
|
1851
|
+
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
1852
|
+
}).finally(() => {
|
|
1853
|
+
if (!cancelled) setLoading(false);
|
|
1854
|
+
});
|
|
1855
|
+
return () => {
|
|
1856
|
+
cancelled = true;
|
|
1857
|
+
};
|
|
1858
|
+
}, [id]);
|
|
1859
|
+
const paymentStatus = ((_b = detail == null ? void 0 : detail.payment) == null ? void 0 : _b.status) ?? "—";
|
|
1860
|
+
const hasGatewayData = ((_c = detail == null ? void 0 : detail.payment) == null ? void 0 : _c.payment_data) && typeof detail.payment.payment_data === "object" && Object.keys(detail.payment.payment_data).length > 0;
|
|
1861
|
+
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: [
|
|
1862
|
+
/* @__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: [
|
|
1863
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/refunds"), children: "← Refunds" }),
|
|
1864
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refund details" }),
|
|
1865
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle font-mono", children: id ?? "—" })
|
|
1866
|
+
] }) }),
|
|
1867
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1868
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1869
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/refunds"), children: "Back to list" })
|
|
1870
|
+
] }) : 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: [
|
|
1871
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1872
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Refund summary" }),
|
|
1873
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
1874
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1875
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund ID" }),
|
|
1876
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.id })
|
|
1877
|
+
] }),
|
|
1878
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1879
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
1880
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.refund.amount) })
|
|
1881
|
+
] }),
|
|
1882
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1883
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Note" }),
|
|
1884
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.refund.note ?? "—" })
|
|
1885
|
+
] }),
|
|
1886
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1887
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created at" }),
|
|
1888
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.refund.created_at).toLocaleDateString("en-US", {
|
|
1889
|
+
year: "numeric",
|
|
1890
|
+
month: "short",
|
|
1891
|
+
day: "numeric",
|
|
1892
|
+
hour: "numeric",
|
|
1893
|
+
minute: "2-digit",
|
|
1894
|
+
hour12: true
|
|
1895
|
+
}) })
|
|
1896
|
+
] }),
|
|
1897
|
+
detail.refund.created_by ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1898
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created by" }),
|
|
1899
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.created_by })
|
|
1900
|
+
] }) : null
|
|
1901
|
+
] })
|
|
1902
|
+
] }),
|
|
1903
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1904
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Payment summary" }),
|
|
1905
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
1906
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1907
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment amount" }),
|
|
1908
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.payment_amount) })
|
|
1909
|
+
] }),
|
|
1910
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1911
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Captured amount" }),
|
|
1912
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.captured_amount) })
|
|
1913
|
+
] }),
|
|
1914
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1915
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refunded amount" }),
|
|
1916
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.refunded_amount) })
|
|
1917
|
+
] }),
|
|
1918
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1919
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
1920
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment.provider_id || "—" })
|
|
1921
|
+
] }),
|
|
1922
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1923
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
1924
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1925
|
+
ui.Badge,
|
|
1926
|
+
{
|
|
1927
|
+
size: "2xsmall",
|
|
1928
|
+
className: `uppercase ${getStatusBadgeClass$3(paymentStatus)}`,
|
|
1929
|
+
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
1930
|
+
}
|
|
1931
|
+
) })
|
|
1932
|
+
] }),
|
|
1933
|
+
detail.computed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1934
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1935
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
1936
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
1937
|
+
] }),
|
|
1938
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1939
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
1940
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
1941
|
+
] }),
|
|
1942
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1943
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
1944
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "mt-1 block", children: [
|
|
1945
|
+
detail.computed.refund_percentage.toFixed(1),
|
|
1946
|
+
"%"
|
|
1947
|
+
] })
|
|
1948
|
+
] })
|
|
1949
|
+
] }) : null
|
|
1950
|
+
] })
|
|
1951
|
+
] }),
|
|
1952
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1953
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Order summary" }),
|
|
1954
|
+
detail.order ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
1955
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1956
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
1957
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1958
|
+
ui.Button,
|
|
1959
|
+
{
|
|
1960
|
+
variant: "transparent",
|
|
1961
|
+
size: "small",
|
|
1962
|
+
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
1963
|
+
children: detail.order.order_number ?? detail.order.order_id
|
|
1964
|
+
}
|
|
1965
|
+
) })
|
|
1966
|
+
] }),
|
|
1967
|
+
detail.order.total != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1968
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
1969
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
1970
|
+
] }) : null,
|
|
1971
|
+
detail.order.customer_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1972
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
1973
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
1974
|
+
] }) : null,
|
|
1975
|
+
detail.order.region ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1976
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
1977
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.region })
|
|
1978
|
+
] }) : null,
|
|
1979
|
+
detail.order.fulfillment_status ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1980
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
1981
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
1982
|
+
] }) : null
|
|
1983
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
1984
|
+
] }),
|
|
1985
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1986
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1987
|
+
"button",
|
|
1988
|
+
{
|
|
1989
|
+
type: "button",
|
|
1990
|
+
className: "flex w-full items-center justify-between text-left",
|
|
1991
|
+
onClick: () => setGatewayExpanded((prev) => !prev),
|
|
1992
|
+
"aria-expanded": gatewayExpanded,
|
|
1993
|
+
"aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
|
|
1994
|
+
children: [
|
|
1995
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
|
|
1996
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
|
|
1997
|
+
]
|
|
1998
|
+
}
|
|
1999
|
+
),
|
|
2000
|
+
gatewayExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: hasGatewayData ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.payment.payment_data, null, 2) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No gateway payload for this payment." }) })
|
|
2001
|
+
] })
|
|
2002
|
+
] }) : null
|
|
2003
|
+
] }) });
|
|
2004
|
+
};
|
|
2005
|
+
const config$3 = adminSdk.defineRouteConfig({
|
|
2006
|
+
label: "Refund details",
|
|
2007
|
+
icon: icons.Receipt
|
|
2008
|
+
});
|
|
2009
|
+
const getStatusBadgeClass$2 = (status) => {
|
|
2010
|
+
const statusLower = status.toLowerCase();
|
|
2011
|
+
if (statusLower === "requested") {
|
|
2012
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2013
|
+
}
|
|
2014
|
+
if (statusLower === "approved") {
|
|
2015
|
+
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2016
|
+
}
|
|
2017
|
+
if (statusLower === "rejected") {
|
|
2018
|
+
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2019
|
+
}
|
|
2020
|
+
if (statusLower === "completed") {
|
|
2021
|
+
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2022
|
+
}
|
|
2023
|
+
if (statusLower === "cancelled" || statusLower === "canceled") {
|
|
2024
|
+
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
2025
|
+
}
|
|
2026
|
+
if (statusLower === "pending") {
|
|
2027
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1836
2028
|
}
|
|
1837
2029
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1838
2030
|
};
|
|
@@ -1952,7 +2144,7 @@ const SwapDetailPage = () => {
|
|
|
1952
2144
|
ui.Badge,
|
|
1953
2145
|
{
|
|
1954
2146
|
size: "small",
|
|
1955
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2147
|
+
className: `uppercase ${getStatusBadgeClass$2(swap.status)}`,
|
|
1956
2148
|
children: swap.status.replace(/_/g, " ")
|
|
1957
2149
|
}
|
|
1958
2150
|
)
|
|
@@ -2020,7 +2212,7 @@ const SwapDetailPage = () => {
|
|
|
2020
2212
|
ui.Badge,
|
|
2021
2213
|
{
|
|
2022
2214
|
size: "2xsmall",
|
|
2023
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2215
|
+
className: `uppercase ${getStatusBadgeClass$2(entry.status)}`,
|
|
2024
2216
|
children: entry.status.replace(/_/g, " ")
|
|
2025
2217
|
}
|
|
2026
2218
|
) }),
|
|
@@ -2089,11 +2281,11 @@ const SwapDetailPage = () => {
|
|
|
2089
2281
|
] })
|
|
2090
2282
|
] }) });
|
|
2091
2283
|
};
|
|
2092
|
-
const config$
|
|
2284
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
2093
2285
|
label: "Swap Details",
|
|
2094
2286
|
icon: icons.ArrowPath
|
|
2095
2287
|
});
|
|
2096
|
-
const getStatusBadgeClass$
|
|
2288
|
+
const getStatusBadgeClass$1 = (status) => {
|
|
2097
2289
|
const s2 = status.toLowerCase();
|
|
2098
2290
|
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2099
2291
|
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
@@ -2101,18 +2293,14 @@ const getStatusBadgeClass$2 = (status) => {
|
|
|
2101
2293
|
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2102
2294
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2103
2295
|
};
|
|
2104
|
-
const
|
|
2105
|
-
|
|
2106
|
-
};
|
|
2107
|
-
const RefundDetailPage = () => {
|
|
2108
|
-
var _a, _b, _c;
|
|
2296
|
+
const PaymentDetailPage = () => {
|
|
2297
|
+
var _a;
|
|
2109
2298
|
const navigate = reactRouterDom.useNavigate();
|
|
2110
2299
|
const params = reactRouterDom.useParams();
|
|
2111
2300
|
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
2112
2301
|
const [detail, setDetail] = react.useState(null);
|
|
2113
2302
|
const [loading, setLoading] = react.useState(!!id);
|
|
2114
2303
|
const [error, setError] = react.useState(null);
|
|
2115
|
-
const [gatewayExpanded, setGatewayExpanded] = react.useState(false);
|
|
2116
2304
|
react.useEffect(() => {
|
|
2117
2305
|
if (!id) {
|
|
2118
2306
|
setLoading(false);
|
|
@@ -2121,7 +2309,7 @@ const RefundDetailPage = () => {
|
|
|
2121
2309
|
let cancelled = false;
|
|
2122
2310
|
setLoading(true);
|
|
2123
2311
|
setError(null);
|
|
2124
|
-
fetch(`/admin/
|
|
2312
|
+
fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
|
|
2125
2313
|
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
2126
2314
|
return res.json();
|
|
2127
2315
|
}).then((data) => {
|
|
@@ -2135,157 +2323,88 @@ const RefundDetailPage = () => {
|
|
|
2135
2323
|
cancelled = true;
|
|
2136
2324
|
};
|
|
2137
2325
|
}, [id]);
|
|
2138
|
-
const
|
|
2139
|
-
const
|
|
2326
|
+
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
2327
|
+
const sessionStatusRaw = (detail == null ? void 0 : detail.session_status) ?? "—";
|
|
2328
|
+
const paymentStatusRaw = (detail == null ? void 0 : detail.payment_id) != null ? (detail == null ? void 0 : detail.payment_status) ?? "—" : "—";
|
|
2329
|
+
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
2140
2330
|
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: [
|
|
2141
2331
|
/* @__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: [
|
|
2142
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/
|
|
2143
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
2144
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle
|
|
2332
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
2333
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payment session" }),
|
|
2334
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
|
|
2145
2335
|
] }) }),
|
|
2146
2336
|
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2147
2337
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
2148
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/
|
|
2338
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
|
|
2149
2339
|
] }) : 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: [
|
|
2150
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2151
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2152
|
-
|
|
2153
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
ui.Badge,
|
|
2205
|
-
{
|
|
2206
|
-
size: "2xsmall",
|
|
2207
|
-
className: `uppercase ${getStatusBadgeClass$2(paymentStatus)}`,
|
|
2208
|
-
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
2209
|
-
}
|
|
2210
|
-
) })
|
|
2211
|
-
] }),
|
|
2212
|
-
detail.computed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2213
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2214
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
2215
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
2216
|
-
] }),
|
|
2217
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2218
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
2219
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
2220
|
-
] }),
|
|
2221
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2222
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
2223
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "mt-1 block", children: [
|
|
2224
|
-
detail.computed.refund_percentage.toFixed(1),
|
|
2225
|
-
"%"
|
|
2226
|
-
] })
|
|
2227
|
-
] })
|
|
2228
|
-
] }) : null
|
|
2340
|
+
/* @__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: [
|
|
2341
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2342
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
|
|
2343
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2344
|
+
ui.Button,
|
|
2345
|
+
{
|
|
2346
|
+
variant: "transparent",
|
|
2347
|
+
size: "small",
|
|
2348
|
+
onClick: () => navigate(`/orders/${detail.order_id}`),
|
|
2349
|
+
children: detail.order_id
|
|
2350
|
+
}
|
|
2351
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "—" }) })
|
|
2352
|
+
] }),
|
|
2353
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2354
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
2355
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: displayAmount })
|
|
2356
|
+
] }),
|
|
2357
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2358
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
2359
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.provider_id })
|
|
2360
|
+
] }),
|
|
2361
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2362
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
2363
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2364
|
+
ui.Badge,
|
|
2365
|
+
{
|
|
2366
|
+
size: "2xsmall",
|
|
2367
|
+
className: `uppercase ${getStatusBadgeClass$1(displayStatus)}`,
|
|
2368
|
+
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
2369
|
+
}
|
|
2370
|
+
) })
|
|
2371
|
+
] }),
|
|
2372
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2373
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
2374
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
2375
|
+
] }),
|
|
2376
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2377
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
2378
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
2379
|
+
] }),
|
|
2380
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2381
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
2382
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
2383
|
+
] }),
|
|
2384
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2385
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
2386
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
2387
|
+
year: "numeric",
|
|
2388
|
+
month: "short",
|
|
2389
|
+
day: "numeric",
|
|
2390
|
+
hour: "numeric",
|
|
2391
|
+
minute: "2-digit",
|
|
2392
|
+
hour12: true
|
|
2393
|
+
}) })
|
|
2229
2394
|
] })
|
|
2230
|
-
] }),
|
|
2231
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2232
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
2236
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2237
|
-
ui.Button,
|
|
2238
|
-
{
|
|
2239
|
-
variant: "transparent",
|
|
2240
|
-
size: "small",
|
|
2241
|
-
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
2242
|
-
children: detail.order.order_number ?? detail.order.order_id
|
|
2243
|
-
}
|
|
2244
|
-
) })
|
|
2245
|
-
] }),
|
|
2246
|
-
detail.order.total != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2247
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
2248
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
2249
|
-
] }) : null,
|
|
2250
|
-
detail.order.customer_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2251
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
2252
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
2253
|
-
] }) : null,
|
|
2254
|
-
detail.order.region ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2255
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
2256
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.region })
|
|
2257
|
-
] }) : null,
|
|
2258
|
-
detail.order.fulfillment_status ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2259
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
2260
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
2261
|
-
] }) : null
|
|
2262
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
2263
|
-
] }),
|
|
2264
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2265
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2266
|
-
"button",
|
|
2267
|
-
{
|
|
2268
|
-
type: "button",
|
|
2269
|
-
className: "flex w-full items-center justify-between text-left",
|
|
2270
|
-
onClick: () => setGatewayExpanded((prev) => !prev),
|
|
2271
|
-
"aria-expanded": gatewayExpanded,
|
|
2272
|
-
"aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
|
|
2273
|
-
children: [
|
|
2274
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
|
|
2275
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
|
|
2276
|
-
]
|
|
2277
|
-
}
|
|
2278
|
-
),
|
|
2279
|
-
gatewayExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: hasGatewayData ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.payment.payment_data, null, 2) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No gateway payload for this payment." }) })
|
|
2280
|
-
] })
|
|
2395
|
+
] }) }),
|
|
2396
|
+
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2397
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
2398
|
+
/* @__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) })
|
|
2399
|
+
] }) : /* @__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." }) })
|
|
2281
2400
|
] }) : null
|
|
2282
2401
|
] }) });
|
|
2283
2402
|
};
|
|
2284
|
-
const config$
|
|
2285
|
-
label: "
|
|
2286
|
-
icon: icons.
|
|
2403
|
+
const config$1 = adminSdk.defineRouteConfig({
|
|
2404
|
+
label: "Payment details",
|
|
2405
|
+
icon: icons.CreditCard
|
|
2287
2406
|
});
|
|
2288
|
-
const getStatusBadgeClass
|
|
2407
|
+
const getStatusBadgeClass = (status) => {
|
|
2289
2408
|
const statusLower = status.toLowerCase();
|
|
2290
2409
|
if (statusLower === "requested") {
|
|
2291
2410
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -2419,7 +2538,7 @@ const ReturnDetailPage = () => {
|
|
|
2419
2538
|
ui.Badge,
|
|
2420
2539
|
{
|
|
2421
2540
|
size: "small",
|
|
2422
|
-
className: `uppercase ${getStatusBadgeClass
|
|
2541
|
+
className: `uppercase ${getStatusBadgeClass(returnOrder.status)}`,
|
|
2423
2542
|
children: returnOrder.status.replace(/_/g, " ")
|
|
2424
2543
|
}
|
|
2425
2544
|
)
|
|
@@ -2501,7 +2620,7 @@ const ReturnDetailPage = () => {
|
|
|
2501
2620
|
ui.Badge,
|
|
2502
2621
|
{
|
|
2503
2622
|
size: "2xsmall",
|
|
2504
|
-
className: `uppercase ${getStatusBadgeClass
|
|
2623
|
+
className: `uppercase ${getStatusBadgeClass(entry.status)}`,
|
|
2505
2624
|
children: entry.status.replace(/_/g, " ")
|
|
2506
2625
|
}
|
|
2507
2626
|
) }),
|
|
@@ -2559,129 +2678,10 @@ const ReturnDetailPage = () => {
|
|
|
2559
2678
|
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" }) })
|
|
2560
2679
|
] }) });
|
|
2561
2680
|
};
|
|
2562
|
-
const config
|
|
2681
|
+
const config = adminSdk.defineRouteConfig({
|
|
2563
2682
|
label: "Return Order Details",
|
|
2564
2683
|
icon: icons.CheckCircle
|
|
2565
2684
|
});
|
|
2566
|
-
const getStatusBadgeClass = (status) => {
|
|
2567
|
-
const s2 = status.toLowerCase();
|
|
2568
|
-
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2569
|
-
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2570
|
-
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2571
|
-
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2572
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2573
|
-
};
|
|
2574
|
-
const PaymentDetailPage = () => {
|
|
2575
|
-
var _a;
|
|
2576
|
-
const navigate = reactRouterDom.useNavigate();
|
|
2577
|
-
const params = reactRouterDom.useParams();
|
|
2578
|
-
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
2579
|
-
const [detail, setDetail] = react.useState(null);
|
|
2580
|
-
const [loading, setLoading] = react.useState(!!id);
|
|
2581
|
-
const [error, setError] = react.useState(null);
|
|
2582
|
-
react.useEffect(() => {
|
|
2583
|
-
if (!id) {
|
|
2584
|
-
setLoading(false);
|
|
2585
|
-
return;
|
|
2586
|
-
}
|
|
2587
|
-
let cancelled = false;
|
|
2588
|
-
setLoading(true);
|
|
2589
|
-
setError(null);
|
|
2590
|
-
fetch(`/admin/payment-transactions/${id}`, { credentials: "include" }).then((res) => {
|
|
2591
|
-
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
2592
|
-
return res.json();
|
|
2593
|
-
}).then((data) => {
|
|
2594
|
-
if (!cancelled) setDetail(data);
|
|
2595
|
-
}).catch((e) => {
|
|
2596
|
-
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
2597
|
-
}).finally(() => {
|
|
2598
|
-
if (!cancelled) setLoading(false);
|
|
2599
|
-
});
|
|
2600
|
-
return () => {
|
|
2601
|
-
cancelled = true;
|
|
2602
|
-
};
|
|
2603
|
-
}, [id]);
|
|
2604
|
-
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
2605
|
-
const sessionStatusRaw = (detail == null ? void 0 : detail.session_status) ?? "—";
|
|
2606
|
-
const paymentStatusRaw = (detail == null ? void 0 : detail.payment_id) != null ? (detail == null ? void 0 : detail.payment_status) ?? "—" : "—";
|
|
2607
|
-
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
2608
|
-
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: [
|
|
2609
|
-
/* @__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: [
|
|
2610
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
2611
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Payment session" }),
|
|
2612
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: id ?? "—" })
|
|
2613
|
-
] }) }),
|
|
2614
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2615
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
2616
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/payments"), children: "Back to list" })
|
|
2617
|
-
] }) : 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: [
|
|
2618
|
-
/* @__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: [
|
|
2619
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2620
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order ID" }),
|
|
2621
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: detail.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2622
|
-
ui.Button,
|
|
2623
|
-
{
|
|
2624
|
-
variant: "transparent",
|
|
2625
|
-
size: "small",
|
|
2626
|
-
onClick: () => navigate(`/orders/${detail.order_id}`),
|
|
2627
|
-
children: detail.order_id
|
|
2628
|
-
}
|
|
2629
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "—" }) })
|
|
2630
|
-
] }),
|
|
2631
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2632
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
2633
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: displayAmount })
|
|
2634
|
-
] }),
|
|
2635
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2636
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
2637
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.provider_id })
|
|
2638
|
-
] }),
|
|
2639
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2640
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
2641
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2642
|
-
ui.Badge,
|
|
2643
|
-
{
|
|
2644
|
-
size: "2xsmall",
|
|
2645
|
-
className: `uppercase ${getStatusBadgeClass(displayStatus)}`,
|
|
2646
|
-
children: displayStatus !== "—" ? displayStatus.replace(/_/g, " ") : "—"
|
|
2647
|
-
}
|
|
2648
|
-
) })
|
|
2649
|
-
] }),
|
|
2650
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2651
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
2652
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
2653
|
-
] }),
|
|
2654
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2655
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
2656
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
2657
|
-
] }),
|
|
2658
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2659
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
2660
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
2661
|
-
] }),
|
|
2662
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2663
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
2664
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
2665
|
-
year: "numeric",
|
|
2666
|
-
month: "short",
|
|
2667
|
-
day: "numeric",
|
|
2668
|
-
hour: "numeric",
|
|
2669
|
-
minute: "2-digit",
|
|
2670
|
-
hour12: true
|
|
2671
|
-
}) })
|
|
2672
|
-
] })
|
|
2673
|
-
] }) }),
|
|
2674
|
-
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2675
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
2676
|
-
/* @__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) })
|
|
2677
|
-
] }) : /* @__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." }) })
|
|
2678
|
-
] }) : null
|
|
2679
|
-
] }) });
|
|
2680
|
-
};
|
|
2681
|
-
const config = adminSdk.defineRouteConfig({
|
|
2682
|
-
label: "Payment details",
|
|
2683
|
-
icon: icons.CreditCard
|
|
2684
|
-
});
|
|
2685
2685
|
const i18nTranslations0 = {};
|
|
2686
2686
|
const widgetModule = { widgets: [
|
|
2687
2687
|
{
|
|
@@ -2695,10 +2695,6 @@ const widgetModule = { widgets: [
|
|
|
2695
2695
|
] };
|
|
2696
2696
|
const routeModule = {
|
|
2697
2697
|
routes: [
|
|
2698
|
-
{
|
|
2699
|
-
Component: SwapsPage,
|
|
2700
|
-
path: "/swaps"
|
|
2701
|
-
},
|
|
2702
2698
|
{
|
|
2703
2699
|
Component: RefundsPage,
|
|
2704
2700
|
path: "/refunds"
|
|
@@ -2712,20 +2708,24 @@ const routeModule = {
|
|
|
2712
2708
|
path: "/payments"
|
|
2713
2709
|
},
|
|
2714
2710
|
{
|
|
2715
|
-
Component:
|
|
2716
|
-
path: "/swaps
|
|
2711
|
+
Component: SwapsPage,
|
|
2712
|
+
path: "/swaps"
|
|
2717
2713
|
},
|
|
2718
2714
|
{
|
|
2719
2715
|
Component: RefundDetailPage,
|
|
2720
2716
|
path: "/refunds/:id"
|
|
2721
2717
|
},
|
|
2722
2718
|
{
|
|
2723
|
-
Component:
|
|
2724
|
-
path: "/
|
|
2719
|
+
Component: SwapDetailPage,
|
|
2720
|
+
path: "/swaps/:id"
|
|
2725
2721
|
},
|
|
2726
2722
|
{
|
|
2727
2723
|
Component: PaymentDetailPage,
|
|
2728
2724
|
path: "/payments/:id"
|
|
2725
|
+
},
|
|
2726
|
+
{
|
|
2727
|
+
Component: ReturnDetailPage,
|
|
2728
|
+
path: "/returns/:id"
|
|
2729
2729
|
}
|
|
2730
2730
|
]
|
|
2731
2731
|
};
|
|
@@ -2734,49 +2734,49 @@ const menuItemModule = {
|
|
|
2734
2734
|
{
|
|
2735
2735
|
label: config$5.label,
|
|
2736
2736
|
icon: config$5.icon,
|
|
2737
|
-
path: "/
|
|
2737
|
+
path: "/payments",
|
|
2738
2738
|
nested: void 0
|
|
2739
2739
|
},
|
|
2740
2740
|
{
|
|
2741
2741
|
label: config$6.label,
|
|
2742
2742
|
icon: config$6.icon,
|
|
2743
|
-
path: "/
|
|
2743
|
+
path: "/returns",
|
|
2744
2744
|
nested: void 0
|
|
2745
2745
|
},
|
|
2746
2746
|
{
|
|
2747
|
-
label: config$
|
|
2748
|
-
icon: config$
|
|
2749
|
-
path: "/
|
|
2747
|
+
label: config$7.label,
|
|
2748
|
+
icon: config$7.icon,
|
|
2749
|
+
path: "/refunds",
|
|
2750
2750
|
nested: void 0
|
|
2751
2751
|
},
|
|
2752
2752
|
{
|
|
2753
|
-
label: config$
|
|
2754
|
-
icon: config$
|
|
2753
|
+
label: config$4.label,
|
|
2754
|
+
icon: config$4.icon,
|
|
2755
2755
|
path: "/swaps",
|
|
2756
2756
|
nested: void 0
|
|
2757
2757
|
},
|
|
2758
2758
|
{
|
|
2759
|
-
label: config
|
|
2760
|
-
icon: config
|
|
2759
|
+
label: config.label,
|
|
2760
|
+
icon: config.icon,
|
|
2761
2761
|
path: "/returns/:id",
|
|
2762
2762
|
nested: void 0
|
|
2763
2763
|
},
|
|
2764
2764
|
{
|
|
2765
|
-
label: config.label,
|
|
2766
|
-
icon: config.icon,
|
|
2765
|
+
label: config$1.label,
|
|
2766
|
+
icon: config$1.icon,
|
|
2767
2767
|
path: "/payments/:id",
|
|
2768
2768
|
nested: void 0
|
|
2769
2769
|
},
|
|
2770
2770
|
{
|
|
2771
2771
|
label: config$2.label,
|
|
2772
2772
|
icon: config$2.icon,
|
|
2773
|
-
path: "/
|
|
2773
|
+
path: "/swaps/:id",
|
|
2774
2774
|
nested: void 0
|
|
2775
2775
|
},
|
|
2776
2776
|
{
|
|
2777
2777
|
label: config$3.label,
|
|
2778
2778
|
icon: config$3.icon,
|
|
2779
|
-
path: "/
|
|
2779
|
+
path: "/refunds/:id",
|
|
2780
2780
|
nested: void 0
|
|
2781
2781
|
}
|
|
2782
2782
|
]
|