order-management 0.0.86 → 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,210 +866,275 @@ const useDebounce$3 = (value, delay) => {
|
|
|
866
866
|
return debouncedValue;
|
|
867
867
|
};
|
|
868
868
|
const getStatusBadgeClass$7 = (status) => {
|
|
869
|
-
const
|
|
870
|
-
if (
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
if (
|
|
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
|
-
}
|
|
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";
|
|
885
874
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
886
875
|
};
|
|
887
|
-
const
|
|
876
|
+
const RefundsPage = () => {
|
|
888
877
|
const navigate = reactRouterDom.useNavigate();
|
|
889
878
|
const [items, setItems] = react.useState([]);
|
|
890
|
-
const [
|
|
891
|
-
const
|
|
892
|
-
const [
|
|
893
|
-
const
|
|
879
|
+
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
880
|
+
const debouncedOrderId = useDebounce$3(orderIdSearch, 300);
|
|
881
|
+
const [paymentStatusFilter, setPaymentStatusFilter] = react.useState("all");
|
|
882
|
+
const [providerSearch, setProviderSearch] = react.useState("");
|
|
883
|
+
const debouncedProvider = useDebounce$3(providerSearch, 300);
|
|
884
|
+
const [currencySearch, setCurrencySearch] = react.useState("");
|
|
885
|
+
const debouncedCurrency = useDebounce$3(currencySearch, 300);
|
|
886
|
+
const [dateFrom, setDateFrom] = react.useState("");
|
|
887
|
+
const [dateTo, setDateTo] = react.useState("");
|
|
888
|
+
const [amountMin, setAmountMin] = react.useState("");
|
|
889
|
+
const [amountMax, setAmountMax] = react.useState("");
|
|
894
890
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
895
891
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
896
892
|
const [error, setError] = react.useState(null);
|
|
897
893
|
const [offset, setOffset] = react.useState(0);
|
|
898
894
|
const [count, setCount] = react.useState(0);
|
|
899
895
|
const limit = 50;
|
|
900
|
-
const
|
|
901
|
-
async (nextOffset, replace
|
|
902
|
-
var _a;
|
|
896
|
+
const loadRefunds = react.useCallback(
|
|
897
|
+
async (nextOffset, replace) => {
|
|
903
898
|
try {
|
|
904
|
-
if (replace)
|
|
905
|
-
|
|
906
|
-
} else {
|
|
907
|
-
setIsFetchingMore(true);
|
|
908
|
-
}
|
|
899
|
+
if (replace) setIsLoading(true);
|
|
900
|
+
else setIsFetchingMore(true);
|
|
909
901
|
setError(null);
|
|
910
902
|
const params = new URLSearchParams();
|
|
911
903
|
params.set("limit", String(limit));
|
|
912
904
|
params.set("offset", String(nextOffset));
|
|
913
|
-
if (
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
if (
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
);
|
|
905
|
+
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
906
|
+
if (paymentStatusFilter !== "all") params.set("payment_status", paymentStatusFilter);
|
|
907
|
+
if (debouncedProvider.trim()) params.set("provider_id", debouncedProvider.trim());
|
|
908
|
+
if (debouncedCurrency.trim()) params.set("currency_code", debouncedCurrency.trim());
|
|
909
|
+
if (dateFrom.trim()) params.set("date_from", dateFrom.trim());
|
|
910
|
+
if (dateTo.trim()) params.set("date_to", dateTo.trim());
|
|
911
|
+
const min = amountMin.trim() ? Number(amountMin) : void 0;
|
|
912
|
+
const max = amountMax.trim() ? Number(amountMax) : void 0;
|
|
913
|
+
if (min != null && !Number.isNaN(min)) params.set("amount_min", String(min));
|
|
914
|
+
if (max != null && !Number.isNaN(max)) params.set("amount_max", String(max));
|
|
915
|
+
const response = await fetch(`/admin/refunds?${params.toString()}`, {
|
|
916
|
+
credentials: "include"
|
|
917
|
+
});
|
|
926
918
|
if (!response.ok) {
|
|
927
|
-
const
|
|
928
|
-
throw new Error(
|
|
919
|
+
const text = await response.text();
|
|
920
|
+
throw new Error(text || "Failed to load refunds");
|
|
929
921
|
}
|
|
930
922
|
const payload = await response.json();
|
|
923
|
+
const list = payload.refunds ?? [];
|
|
931
924
|
setCount(payload.count ?? 0);
|
|
932
|
-
setOffset(nextOffset +
|
|
933
|
-
setItems(
|
|
934
|
-
|
|
935
|
-
);
|
|
936
|
-
} catch (loadError) {
|
|
937
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load swaps";
|
|
938
|
-
setError(message);
|
|
925
|
+
setOffset(nextOffset + list.length);
|
|
926
|
+
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
927
|
+
} catch (e) {
|
|
928
|
+
setError(e instanceof Error ? e.message : "Failed to load");
|
|
939
929
|
} finally {
|
|
940
930
|
setIsLoading(false);
|
|
941
931
|
setIsFetchingMore(false);
|
|
942
932
|
}
|
|
943
933
|
},
|
|
944
|
-
[
|
|
934
|
+
[
|
|
935
|
+
debouncedOrderId,
|
|
936
|
+
paymentStatusFilter,
|
|
937
|
+
debouncedProvider,
|
|
938
|
+
debouncedCurrency,
|
|
939
|
+
dateFrom,
|
|
940
|
+
dateTo,
|
|
941
|
+
amountMin,
|
|
942
|
+
amountMax
|
|
943
|
+
]
|
|
945
944
|
);
|
|
946
945
|
react.useEffect(() => {
|
|
947
|
-
void
|
|
948
|
-
}, [
|
|
946
|
+
void loadRefunds(0, true);
|
|
947
|
+
}, [loadRefunds]);
|
|
949
948
|
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
950
|
-
const
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
949
|
+
const displayAmount = (r) => {
|
|
950
|
+
const code = (r.currency_code ?? "USD").toUpperCase();
|
|
951
|
+
return `${code} ${Number(r.amount)}`;
|
|
952
|
+
};
|
|
953
|
+
const displayStatus = (r) => {
|
|
954
|
+
const s2 = r.payment_status ?? "";
|
|
955
|
+
return s2 !== "" ? s2 : "—";
|
|
956
|
+
};
|
|
955
957
|
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
958
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
957
959
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
958
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
959
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "
|
|
960
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refunds" }),
|
|
961
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Refund records — amount, order, payment status" })
|
|
960
962
|
] }),
|
|
961
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () =>
|
|
963
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadRefunds(0, true), children: "Refresh" })
|
|
962
964
|
] }),
|
|
963
|
-
/* @__PURE__ */ jsxRuntime.
|
|
965
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
964
966
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
965
967
|
ui.Input,
|
|
966
968
|
{
|
|
967
|
-
placeholder: "
|
|
968
|
-
value:
|
|
969
|
-
onChange: (
|
|
970
|
-
className: "md:max-w-
|
|
969
|
+
placeholder: "Order ID",
|
|
970
|
+
value: orderIdSearch,
|
|
971
|
+
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
972
|
+
className: "md:max-w-[180px]",
|
|
973
|
+
"aria-label": "Filter by order ID"
|
|
971
974
|
}
|
|
972
975
|
),
|
|
973
|
-
/* @__PURE__ */ jsxRuntime.
|
|
974
|
-
|
|
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,
|
|
976
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
977
|
+
ui.Input,
|
|
1005
978
|
{
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
979
|
+
placeholder: "Provider",
|
|
980
|
+
value: providerSearch,
|
|
981
|
+
onChange: (e) => setProviderSearch(e.target.value),
|
|
982
|
+
className: "md:max-w-[140px]",
|
|
983
|
+
"aria-label": "Filter by provider"
|
|
1009
984
|
}
|
|
1010
|
-
)
|
|
1011
|
-
|
|
1012
|
-
|
|
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",
|
|
985
|
+
),
|
|
986
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
987
|
+
ui.Input,
|
|
1026
988
|
{
|
|
1027
|
-
|
|
1028
|
-
|
|
989
|
+
placeholder: "Currency",
|
|
990
|
+
value: currencySearch,
|
|
991
|
+
onChange: (e) => setCurrencySearch(e.target.value),
|
|
992
|
+
className: "md:max-w-[100px]",
|
|
993
|
+
"aria-label": "Filter by currency"
|
|
994
|
+
}
|
|
995
|
+
),
|
|
996
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
997
|
+
"select",
|
|
998
|
+
{
|
|
999
|
+
value: paymentStatusFilter,
|
|
1000
|
+
onChange: (e) => setPaymentStatusFilter(e.target.value),
|
|
1001
|
+
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]",
|
|
1002
|
+
"aria-label": "Filter by payment status",
|
|
1029
1003
|
children: [
|
|
1030
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
1031
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
1032
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1004
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
1005
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
1006
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
1007
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "error", children: "Error" }),
|
|
1008
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
1009
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
1010
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
1011
|
+
]
|
|
1012
|
+
}
|
|
1013
|
+
),
|
|
1014
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1015
|
+
ui.Input,
|
|
1016
|
+
{
|
|
1017
|
+
type: "date",
|
|
1018
|
+
placeholder: "From",
|
|
1019
|
+
value: dateFrom,
|
|
1020
|
+
onChange: (e) => setDateFrom(e.target.value),
|
|
1021
|
+
className: "md:max-w-[140px]",
|
|
1022
|
+
"aria-label": "Date from"
|
|
1023
|
+
}
|
|
1024
|
+
),
|
|
1025
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1026
|
+
ui.Input,
|
|
1027
|
+
{
|
|
1028
|
+
type: "date",
|
|
1029
|
+
placeholder: "To",
|
|
1030
|
+
value: dateTo,
|
|
1031
|
+
onChange: (e) => setDateTo(e.target.value),
|
|
1032
|
+
className: "md:max-w-[140px]",
|
|
1033
|
+
"aria-label": "Date to"
|
|
1034
|
+
}
|
|
1035
|
+
),
|
|
1036
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1037
|
+
ui.Input,
|
|
1038
|
+
{
|
|
1039
|
+
placeholder: "Amount min",
|
|
1040
|
+
value: amountMin,
|
|
1041
|
+
onChange: (e) => setAmountMin(e.target.value),
|
|
1042
|
+
type: "number",
|
|
1043
|
+
min: 0,
|
|
1044
|
+
className: "md:max-w-[100px]",
|
|
1045
|
+
"aria-label": "Refund amount minimum"
|
|
1046
|
+
}
|
|
1047
|
+
),
|
|
1048
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1049
|
+
ui.Input,
|
|
1050
|
+
{
|
|
1051
|
+
placeholder: "Amount max",
|
|
1052
|
+
value: amountMax,
|
|
1053
|
+
onChange: (e) => setAmountMax(e.target.value),
|
|
1054
|
+
type: "number",
|
|
1055
|
+
min: 0,
|
|
1056
|
+
className: "md:max-w-[100px]",
|
|
1057
|
+
"aria-label": "Refund amount maximum"
|
|
1058
|
+
}
|
|
1059
|
+
)
|
|
1060
|
+
] }) }),
|
|
1061
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1062
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1063
|
+
/* @__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" }) })
|
|
1064
|
+
] }) : null,
|
|
1065
|
+
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: [
|
|
1066
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No refunds yet" }),
|
|
1067
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Refund records will appear here." })
|
|
1068
|
+
] }) : /* @__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: [
|
|
1069
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1070
|
+
/* @__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" }),
|
|
1071
|
+
/* @__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" }),
|
|
1072
|
+
/* @__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" }),
|
|
1073
|
+
/* @__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" }),
|
|
1074
|
+
/* @__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" }),
|
|
1075
|
+
/* @__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" }),
|
|
1076
|
+
/* @__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" }),
|
|
1077
|
+
/* @__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" }),
|
|
1078
|
+
/* @__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" }),
|
|
1079
|
+
/* @__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" })
|
|
1080
|
+
] }) }),
|
|
1081
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((r) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1082
|
+
"tr",
|
|
1083
|
+
{
|
|
1084
|
+
className: "cursor-pointer hover:bg-ui-bg-subtle/60",
|
|
1085
|
+
onClick: () => navigate(`/refunds/${r.refund_id}`),
|
|
1086
|
+
children: [
|
|
1087
|
+
/* @__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 }),
|
|
1088
|
+
/* @__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 ?? "—" }),
|
|
1089
|
+
/* @__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 }),
|
|
1090
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", children: displayAmount(r) }),
|
|
1091
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle uppercase", children: r.currency_code || "—" }),
|
|
1092
|
+
/* @__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 || "—" }),
|
|
1093
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1094
|
+
ui.Badge,
|
|
1095
|
+
{
|
|
1096
|
+
size: "2xsmall",
|
|
1097
|
+
className: `uppercase ${getStatusBadgeClass$7(displayStatus(r))}`,
|
|
1098
|
+
children: displayStatus(r) !== "—" ? displayStatus(r).replace(/_/g, " ") : "—"
|
|
1099
|
+
}
|
|
1100
|
+
) }),
|
|
1101
|
+
/* @__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 ?? "—" }),
|
|
1102
|
+
/* @__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", {
|
|
1103
|
+
month: "short",
|
|
1104
|
+
day: "numeric",
|
|
1105
|
+
hour: "numeric",
|
|
1106
|
+
minute: "2-digit",
|
|
1107
|
+
hour12: true
|
|
1108
|
+
}) }),
|
|
1109
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-1", children: [
|
|
1110
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1111
|
+
ui.Button,
|
|
1112
|
+
{
|
|
1113
|
+
variant: "transparent",
|
|
1114
|
+
size: "small",
|
|
1115
|
+
onClick: (e) => {
|
|
1116
|
+
e.stopPropagation();
|
|
1117
|
+
navigate(`/refunds/${r.refund_id}`);
|
|
1118
|
+
},
|
|
1119
|
+
children: "Details"
|
|
1120
|
+
}
|
|
1121
|
+
),
|
|
1122
|
+
r.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1123
|
+
ui.Button,
|
|
1124
|
+
{
|
|
1125
|
+
variant: "transparent",
|
|
1126
|
+
size: "small",
|
|
1127
|
+
onClick: (e) => {
|
|
1128
|
+
e.stopPropagation();
|
|
1129
|
+
navigate(`/orders/${r.order_id}`);
|
|
1130
|
+
},
|
|
1131
|
+
children: "Order"
|
|
1132
|
+
}
|
|
1133
|
+
) : null
|
|
1134
|
+
] }) })
|
|
1070
1135
|
]
|
|
1071
1136
|
},
|
|
1072
|
-
|
|
1137
|
+
r.refund_id
|
|
1073
1138
|
)) })
|
|
1074
1139
|
] }) }),
|
|
1075
1140
|
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1077,15 +1142,15 @@ const SwapsPage = () => {
|
|
|
1077
1142
|
{
|
|
1078
1143
|
variant: "secondary",
|
|
1079
1144
|
isLoading: isFetchingMore,
|
|
1080
|
-
onClick: () =>
|
|
1145
|
+
onClick: () => loadRefunds(offset, false),
|
|
1081
1146
|
children: "Load more"
|
|
1082
1147
|
}
|
|
1083
1148
|
) }) : null
|
|
1084
1149
|
] }) });
|
|
1085
1150
|
};
|
|
1086
1151
|
const config$7 = adminSdk.defineRouteConfig({
|
|
1087
|
-
label: "
|
|
1088
|
-
icon: icons.
|
|
1152
|
+
label: "Refunds",
|
|
1153
|
+
icon: icons.Receipt
|
|
1089
1154
|
});
|
|
1090
1155
|
const useDebounce$2 = (value, delay) => {
|
|
1091
1156
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
@@ -1528,275 +1593,210 @@ const useDebounce = (value, delay) => {
|
|
|
1528
1593
|
return debouncedValue;
|
|
1529
1594
|
};
|
|
1530
1595
|
const getStatusBadgeClass$4 = (status) => {
|
|
1531
|
-
const
|
|
1532
|
-
if (
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
if (
|
|
1596
|
+
const statusLower = status.toLowerCase();
|
|
1597
|
+
if (statusLower === "requested") {
|
|
1598
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1599
|
+
}
|
|
1600
|
+
if (statusLower === "approved") {
|
|
1601
|
+
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1602
|
+
}
|
|
1603
|
+
if (statusLower === "rejected") {
|
|
1604
|
+
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1605
|
+
}
|
|
1606
|
+
if (statusLower === "completed") {
|
|
1607
|
+
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1608
|
+
}
|
|
1609
|
+
if (statusLower === "cancelled") {
|
|
1610
|
+
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
1611
|
+
}
|
|
1536
1612
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1537
1613
|
};
|
|
1538
|
-
const
|
|
1614
|
+
const SwapsPage = () => {
|
|
1539
1615
|
const navigate = reactRouterDom.useNavigate();
|
|
1540
1616
|
const [items, setItems] = react.useState([]);
|
|
1541
|
-
const [
|
|
1542
|
-
const
|
|
1543
|
-
const [
|
|
1544
|
-
const
|
|
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("");
|
|
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);
|
|
1552
1621
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
1553
1622
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
1554
1623
|
const [error, setError] = react.useState(null);
|
|
1555
1624
|
const [offset, setOffset] = react.useState(0);
|
|
1556
1625
|
const [count, setCount] = react.useState(0);
|
|
1557
1626
|
const limit = 50;
|
|
1558
|
-
const
|
|
1559
|
-
async (nextOffset, replace) => {
|
|
1627
|
+
const loadSwaps = react.useCallback(
|
|
1628
|
+
async (nextOffset, replace = false) => {
|
|
1629
|
+
var _a;
|
|
1560
1630
|
try {
|
|
1561
|
-
if (replace)
|
|
1562
|
-
|
|
1631
|
+
if (replace) {
|
|
1632
|
+
setIsLoading(true);
|
|
1633
|
+
} else {
|
|
1634
|
+
setIsFetchingMore(true);
|
|
1635
|
+
}
|
|
1563
1636
|
setError(null);
|
|
1564
1637
|
const params = new URLSearchParams();
|
|
1565
1638
|
params.set("limit", String(limit));
|
|
1566
1639
|
params.set("offset", String(nextOffset));
|
|
1567
|
-
if (
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
if (
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
credentials: "include"
|
|
1579
|
-
|
|
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
|
+
);
|
|
1580
1653
|
if (!response.ok) {
|
|
1581
|
-
const
|
|
1582
|
-
throw new Error(
|
|
1654
|
+
const message = await response.text();
|
|
1655
|
+
throw new Error(message || "Unable to load swaps");
|
|
1583
1656
|
}
|
|
1584
1657
|
const payload = await response.json();
|
|
1585
|
-
const list = payload.refunds ?? [];
|
|
1586
1658
|
setCount(payload.count ?? 0);
|
|
1587
|
-
setOffset(nextOffset +
|
|
1588
|
-
setItems(
|
|
1589
|
-
|
|
1590
|
-
|
|
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);
|
|
1591
1666
|
} finally {
|
|
1592
1667
|
setIsLoading(false);
|
|
1593
1668
|
setIsFetchingMore(false);
|
|
1594
1669
|
}
|
|
1595
1670
|
},
|
|
1596
|
-
[
|
|
1597
|
-
debouncedOrderId,
|
|
1598
|
-
paymentStatusFilter,
|
|
1599
|
-
debouncedProvider,
|
|
1600
|
-
debouncedCurrency,
|
|
1601
|
-
dateFrom,
|
|
1602
|
-
dateTo,
|
|
1603
|
-
amountMin,
|
|
1604
|
-
amountMax
|
|
1605
|
-
]
|
|
1671
|
+
[statusFilter, createdByFilter, debouncedSearchQuery]
|
|
1606
1672
|
);
|
|
1607
1673
|
react.useEffect(() => {
|
|
1608
|
-
void
|
|
1609
|
-
}, [
|
|
1674
|
+
void loadSwaps(0, true);
|
|
1675
|
+
}, [statusFilter, createdByFilter, debouncedSearchQuery, loadSwaps]);
|
|
1610
1676
|
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
1611
|
-
const
|
|
1612
|
-
const
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
const s2 = r.payment_status ?? "";
|
|
1617
|
-
return s2 !== "" ? s2 : "—";
|
|
1618
|
-
};
|
|
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]);
|
|
1619
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: [
|
|
1620
1683
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1621
1684
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1622
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
1623
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", 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" })
|
|
1624
1687
|
] }),
|
|
1625
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () =>
|
|
1688
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadSwaps(0, true), children: "Refresh" })
|
|
1626
1689
|
] }),
|
|
1627
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1690
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
1628
1691
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1629
1692
|
ui.Input,
|
|
1630
1693
|
{
|
|
1631
|
-
placeholder: "
|
|
1632
|
-
value:
|
|
1633
|
-
onChange: (
|
|
1634
|
-
className: "md:max-w-
|
|
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"
|
|
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"
|
|
1708
1698
|
}
|
|
1709
1699
|
),
|
|
1710
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
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
|
+
] }),
|
|
1723
1728
|
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1724
1729
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1725
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
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
|
+
) })
|
|
1726
1738
|
] }) : null,
|
|
1727
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading
|
|
1728
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No
|
|
1729
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "
|
|
1730
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
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: [
|
|
1731
1743
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1732
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1733
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1734
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1735
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1736
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
1737
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "
|
|
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" })
|
|
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" })
|
|
1742
1750
|
] }) }),
|
|
1743
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((
|
|
1751
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((swap) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1744
1752
|
"tr",
|
|
1745
1753
|
{
|
|
1746
|
-
className: "
|
|
1747
|
-
onClick: () => navigate(`/
|
|
1754
|
+
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1755
|
+
onClick: () => navigate(`/swaps/${swap.id}`),
|
|
1748
1756
|
children: [
|
|
1749
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1750
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1751
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
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(
|
|
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(
|
|
1756
1760
|
ui.Badge,
|
|
1757
1761
|
{
|
|
1758
1762
|
size: "2xsmall",
|
|
1759
|
-
className: `uppercase ${getStatusBadgeClass$4(
|
|
1760
|
-
children:
|
|
1763
|
+
className: `uppercase ${getStatusBadgeClass$4(swap.status)}`,
|
|
1764
|
+
children: swap.status.replace(/_/g, " ")
|
|
1761
1765
|
}
|
|
1762
1766
|
) }),
|
|
1763
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1764
|
-
|
|
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",
|
|
1765
1779
|
month: "short",
|
|
1766
1780
|
day: "numeric",
|
|
1767
1781
|
hour: "numeric",
|
|
1768
1782
|
minute: "2-digit",
|
|
1769
1783
|
hour12: true
|
|
1770
1784
|
}) }),
|
|
1771
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
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
|
-
] }) })
|
|
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
1797
|
]
|
|
1798
1798
|
},
|
|
1799
|
-
|
|
1799
|
+
swap.id
|
|
1800
1800
|
)) })
|
|
1801
1801
|
] }) }),
|
|
1802
1802
|
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1804,294 +1804,207 @@ const RefundsPage = () => {
|
|
|
1804
1804
|
{
|
|
1805
1805
|
variant: "secondary",
|
|
1806
1806
|
isLoading: isFetchingMore,
|
|
1807
|
-
onClick: () =>
|
|
1807
|
+
onClick: () => loadSwaps(offset, false),
|
|
1808
1808
|
children: "Load more"
|
|
1809
1809
|
}
|
|
1810
1810
|
) }) : null
|
|
1811
1811
|
] }) });
|
|
1812
1812
|
};
|
|
1813
1813
|
const config$4 = adminSdk.defineRouteConfig({
|
|
1814
|
-
label: "
|
|
1815
|
-
icon: icons.
|
|
1814
|
+
label: "Exchanges",
|
|
1815
|
+
icon: icons.ArrowPath
|
|
1816
1816
|
});
|
|
1817
1817
|
const getStatusBadgeClass$3 = (status) => {
|
|
1818
|
-
const
|
|
1819
|
-
if (
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
if (
|
|
1823
|
-
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1824
|
-
}
|
|
1825
|
-
if (statusLower === "rejected") {
|
|
1826
|
-
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1827
|
-
}
|
|
1828
|
-
if (statusLower === "completed") {
|
|
1829
|
-
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1830
|
-
}
|
|
1831
|
-
if (statusLower === "cancelled" || statusLower === "canceled") {
|
|
1832
|
-
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
1833
|
-
}
|
|
1834
|
-
if (statusLower === "pending") {
|
|
1835
|
-
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1836
|
-
}
|
|
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";
|
|
1837
1823
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1838
1824
|
};
|
|
1839
|
-
const
|
|
1825
|
+
const formatAmount = (value) => {
|
|
1826
|
+
return String(value);
|
|
1827
|
+
};
|
|
1828
|
+
const RefundDetailPage = () => {
|
|
1840
1829
|
var _a, _b, _c;
|
|
1841
1830
|
const navigate = reactRouterDom.useNavigate();
|
|
1842
|
-
const
|
|
1843
|
-
const
|
|
1844
|
-
const [
|
|
1845
|
-
const [
|
|
1846
|
-
react.useState(false);
|
|
1847
|
-
const [isCancelling, setIsCancelling] = react.useState(false);
|
|
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);
|
|
1848
1835
|
const [error, setError] = react.useState(null);
|
|
1849
|
-
const [
|
|
1850
|
-
const [updateSuccess, setUpdateSuccess] = react.useState(false);
|
|
1836
|
+
const [gatewayExpanded, setGatewayExpanded] = react.useState(false);
|
|
1851
1837
|
react.useEffect(() => {
|
|
1852
1838
|
if (!id) {
|
|
1853
|
-
|
|
1839
|
+
setLoading(false);
|
|
1854
1840
|
return;
|
|
1855
1841
|
}
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load swap";
|
|
1872
|
-
setError(message);
|
|
1873
|
-
} finally {
|
|
1874
|
-
setIsLoading(false);
|
|
1875
|
-
}
|
|
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;
|
|
1876
1857
|
};
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
const
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
},
|
|
1892
|
-
|
|
1893
|
-
});
|
|
1894
|
-
if (!response.ok) {
|
|
1895
|
-
const message = await response.text();
|
|
1896
|
-
throw new Error(message || "Unable to cancel exchange");
|
|
1897
|
-
}
|
|
1898
|
-
const payload = await response.json();
|
|
1899
|
-
setSwap(payload.swap);
|
|
1900
|
-
setUpdateSuccess(true);
|
|
1901
|
-
setTimeout(() => setUpdateSuccess(false), 3e3);
|
|
1902
|
-
const detailResponse = await fetch(`/admin/swaps/${id}`, {
|
|
1903
|
-
credentials: "include"
|
|
1904
|
-
});
|
|
1905
|
-
if (detailResponse.ok) {
|
|
1906
|
-
const detailPayload = await detailResponse.json();
|
|
1907
|
-
setSwap(detailPayload.swap);
|
|
1908
|
-
setOrder(detailPayload.order || null);
|
|
1909
|
-
}
|
|
1910
|
-
} catch (cancelErr) {
|
|
1911
|
-
const message = cancelErr instanceof Error ? cancelErr.message : "Unable to cancel exchange";
|
|
1912
|
-
setUpdateError(message);
|
|
1913
|
-
} finally {
|
|
1914
|
-
setIsCancelling(false);
|
|
1915
|
-
}
|
|
1916
|
-
};
|
|
1917
|
-
const isOrderExchange = Boolean(swap == null ? void 0 : swap.exchange_id);
|
|
1918
|
-
const canCancelExchange = isOrderExchange && swap && !["cancelled", "canceled", "completed", "declined"].includes(
|
|
1919
|
-
((_a = swap.status) == null ? void 0 : _a.toLowerCase()) ?? ""
|
|
1920
|
-
);
|
|
1921
|
-
if (isLoading) {
|
|
1922
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading swap..." }) }) }) });
|
|
1923
|
-
}
|
|
1924
|
-
if (error || !swap) {
|
|
1925
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1926
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Swap not found" }),
|
|
1927
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => navigate("/swaps"), children: "Back to list" }) })
|
|
1928
|
-
] }) }) });
|
|
1929
|
-
}
|
|
1930
|
-
const statusHistory = ((_b = swap.metadata) == null ? void 0 : _b.status_history) || [];
|
|
1931
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: [
|
|
1932
|
-
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3", children: [
|
|
1933
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1934
|
-
ui.Button,
|
|
1935
|
-
{
|
|
1936
|
-
variant: "transparent",
|
|
1937
|
-
size: "small",
|
|
1938
|
-
onClick: () => navigate("/swaps"),
|
|
1939
|
-
className: "w-fit",
|
|
1940
|
-
children: [
|
|
1941
|
-
/* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, { className: "mr-2" }),
|
|
1942
|
-
"Back to list"
|
|
1943
|
-
]
|
|
1944
|
-
}
|
|
1945
|
-
),
|
|
1946
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
|
|
1947
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1948
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Exchange Details" }),
|
|
1949
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: swap.id })
|
|
1950
|
-
] }),
|
|
1951
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1952
|
-
ui.Badge,
|
|
1953
|
-
{
|
|
1954
|
-
size: "small",
|
|
1955
|
-
className: `uppercase ${getStatusBadgeClass$3(swap.status)}`,
|
|
1956
|
-
children: swap.status.replace(/_/g, " ")
|
|
1957
|
-
}
|
|
1958
|
-
)
|
|
1959
|
-
] })
|
|
1960
|
-
] }),
|
|
1961
|
-
canCancelExchange && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
1962
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1963
|
-
ui.Button,
|
|
1964
|
-
{
|
|
1965
|
-
variant: "danger",
|
|
1966
|
-
onClick: handleCancelExchange,
|
|
1967
|
-
disabled: isCancelling,
|
|
1968
|
-
isLoading: isCancelling,
|
|
1969
|
-
children: "Cancel Exchange"
|
|
1970
|
-
}
|
|
1971
|
-
) }),
|
|
1972
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This will cancel the exchange request. The order will remain unchanged." })
|
|
1973
|
-
] }),
|
|
1974
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
|
|
1975
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
1976
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Exchange Information" }),
|
|
1977
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
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: [
|
|
1978
1874
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1979
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
1980
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-
|
|
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 })
|
|
1981
1877
|
] }),
|
|
1982
1878
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1983
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
1984
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "
|
|
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) })
|
|
1985
1881
|
] }),
|
|
1986
1882
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1987
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
1988
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "
|
|
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 ?? "—" })
|
|
1989
1885
|
] }),
|
|
1990
|
-
|
|
1991
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
1992
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "
|
|
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
|
+
}) })
|
|
1993
1896
|
] }),
|
|
1994
|
-
|
|
1995
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
1996
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-
|
|
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) })
|
|
1997
1909
|
] }),
|
|
1998
1910
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1999
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
2000
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "
|
|
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) })
|
|
2001
1913
|
] }),
|
|
2002
1914
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2003
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
2004
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "
|
|
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) })
|
|
2005
1917
|
] }),
|
|
2006
|
-
|
|
2007
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
2008
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "
|
|
2009
|
-
] })
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
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
|
+
"%"
|
|
2031
1947
|
] })
|
|
2032
1948
|
] })
|
|
2033
|
-
}
|
|
2034
|
-
index
|
|
2035
|
-
)) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
|
|
2036
|
-
] })
|
|
2037
|
-
] }),
|
|
2038
|
-
order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2039
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
|
|
2040
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
2041
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2042
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
|
|
2043
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.id })
|
|
2044
|
-
] }),
|
|
2045
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2046
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
|
|
2047
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.status || "—" })
|
|
2048
|
-
] }),
|
|
2049
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2050
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
2051
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_c = order.customer) == null ? void 0 : _c.email) || order.email || "—" })
|
|
2052
|
-
] }),
|
|
2053
|
-
order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2054
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
2055
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "font-medium", children: [
|
|
2056
|
-
order.currency_code || "$",
|
|
2057
|
-
(Number(order.total) / 100).toFixed(2)
|
|
2058
|
-
] })
|
|
1949
|
+
] }) : null
|
|
2059
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." }) })
|
|
2060
2001
|
] })
|
|
2061
|
-
] })
|
|
2062
|
-
swap.return_items && swap.return_items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2063
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
2064
|
-
/* @__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: [
|
|
2065
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2066
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Item ID" }),
|
|
2067
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
|
|
2068
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
|
|
2069
|
-
] }) }),
|
|
2070
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.return_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2071
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
2072
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
2073
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
2074
|
-
] }, item.id || index)) })
|
|
2075
|
-
] }) })
|
|
2076
|
-
] }),
|
|
2077
|
-
swap.new_items && swap.new_items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2078
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "New Items" }),
|
|
2079
|
-
/* @__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: [
|
|
2080
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2081
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Variant ID" }),
|
|
2082
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
|
|
2083
|
-
] }) }),
|
|
2084
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.new_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2085
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.variant_id }),
|
|
2086
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
|
|
2087
|
-
] }, item.variant_id || index)) })
|
|
2088
|
-
] }) })
|
|
2089
|
-
] })
|
|
2002
|
+
] }) : null
|
|
2090
2003
|
] }) });
|
|
2091
2004
|
};
|
|
2092
2005
|
const config$3 = adminSdk.defineRouteConfig({
|
|
2093
|
-
label: "
|
|
2094
|
-
icon: icons.
|
|
2006
|
+
label: "Refund details",
|
|
2007
|
+
icon: icons.Receipt
|
|
2095
2008
|
});
|
|
2096
2009
|
const getStatusBadgeClass$2 = (status) => {
|
|
2097
2010
|
const statusLower = status.toLowerCase();
|
|
@@ -2104,105 +2017,109 @@ const getStatusBadgeClass$2 = (status) => {
|
|
|
2104
2017
|
if (statusLower === "rejected") {
|
|
2105
2018
|
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2106
2019
|
}
|
|
2107
|
-
if (statusLower === "received") {
|
|
2108
|
-
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2109
|
-
}
|
|
2110
|
-
if (statusLower === "refunded") {
|
|
2111
|
-
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2112
|
-
}
|
|
2113
2020
|
if (statusLower === "completed") {
|
|
2114
2021
|
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2115
2022
|
}
|
|
2116
|
-
if (statusLower === "cancelled") {
|
|
2023
|
+
if (statusLower === "cancelled" || statusLower === "canceled") {
|
|
2117
2024
|
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
2118
2025
|
}
|
|
2026
|
+
if (statusLower === "pending") {
|
|
2027
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2028
|
+
}
|
|
2119
2029
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2120
2030
|
};
|
|
2121
|
-
const
|
|
2122
|
-
var _a, _b;
|
|
2031
|
+
const SwapDetailPage = () => {
|
|
2032
|
+
var _a, _b, _c;
|
|
2123
2033
|
const navigate = reactRouterDom.useNavigate();
|
|
2124
2034
|
const { id } = reactRouterDom.useParams();
|
|
2125
|
-
const [
|
|
2035
|
+
const [swap, setSwap] = react.useState(null);
|
|
2036
|
+
const [order, setOrder] = react.useState(null);
|
|
2126
2037
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
2127
|
-
|
|
2038
|
+
react.useState(false);
|
|
2039
|
+
const [isCancelling, setIsCancelling] = react.useState(false);
|
|
2128
2040
|
const [error, setError] = react.useState(null);
|
|
2129
2041
|
const [updateError, setUpdateError] = react.useState(null);
|
|
2130
2042
|
const [updateSuccess, setUpdateSuccess] = react.useState(false);
|
|
2131
2043
|
react.useEffect(() => {
|
|
2132
2044
|
if (!id) {
|
|
2133
|
-
navigate("/
|
|
2045
|
+
navigate("/swaps");
|
|
2134
2046
|
return;
|
|
2135
2047
|
}
|
|
2136
|
-
const
|
|
2048
|
+
const loadSwap = async () => {
|
|
2137
2049
|
try {
|
|
2138
2050
|
setIsLoading(true);
|
|
2139
2051
|
setError(null);
|
|
2140
|
-
const response = await fetch(`/admin/
|
|
2052
|
+
const response = await fetch(`/admin/swaps/${id}`, {
|
|
2141
2053
|
credentials: "include"
|
|
2142
2054
|
});
|
|
2143
2055
|
if (!response.ok) {
|
|
2144
2056
|
const message = await response.text();
|
|
2145
|
-
throw new Error(message || "Unable to load
|
|
2057
|
+
throw new Error(message || "Unable to load swap");
|
|
2146
2058
|
}
|
|
2147
2059
|
const payload = await response.json();
|
|
2148
|
-
|
|
2060
|
+
setSwap(payload.swap);
|
|
2061
|
+
setOrder(payload.order || null);
|
|
2149
2062
|
} catch (loadError) {
|
|
2150
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load
|
|
2063
|
+
const message = loadError instanceof Error ? loadError.message : "Unable to load swap";
|
|
2151
2064
|
setError(message);
|
|
2152
2065
|
} finally {
|
|
2153
2066
|
setIsLoading(false);
|
|
2154
2067
|
}
|
|
2155
2068
|
};
|
|
2156
|
-
void
|
|
2069
|
+
void loadSwap();
|
|
2157
2070
|
}, [id, navigate]);
|
|
2158
|
-
const
|
|
2071
|
+
const handleCancelExchange = async () => {
|
|
2159
2072
|
if (!id) {
|
|
2160
2073
|
return;
|
|
2161
2074
|
}
|
|
2162
2075
|
try {
|
|
2163
|
-
|
|
2076
|
+
setIsCancelling(true);
|
|
2164
2077
|
setUpdateError(null);
|
|
2165
2078
|
setUpdateSuccess(false);
|
|
2166
|
-
const response = await fetch(`/admin/
|
|
2079
|
+
const response = await fetch(`/admin/swaps/${id}/cancel`, {
|
|
2167
2080
|
method: "POST",
|
|
2168
2081
|
headers: {
|
|
2169
2082
|
"Content-Type": "application/json"
|
|
2170
2083
|
},
|
|
2171
|
-
credentials: "include"
|
|
2172
|
-
body: JSON.stringify({ reason: "Rejected by admin" })
|
|
2084
|
+
credentials: "include"
|
|
2173
2085
|
});
|
|
2174
2086
|
if (!response.ok) {
|
|
2175
2087
|
const message = await response.text();
|
|
2176
|
-
throw new Error(message || "Unable to
|
|
2088
|
+
throw new Error(message || "Unable to cancel exchange");
|
|
2177
2089
|
}
|
|
2178
2090
|
const payload = await response.json();
|
|
2179
|
-
|
|
2091
|
+
setSwap(payload.swap);
|
|
2180
2092
|
setUpdateSuccess(true);
|
|
2181
2093
|
setTimeout(() => setUpdateSuccess(false), 3e3);
|
|
2182
|
-
const detailResponse = await fetch(`/admin/
|
|
2094
|
+
const detailResponse = await fetch(`/admin/swaps/${id}`, {
|
|
2183
2095
|
credentials: "include"
|
|
2184
2096
|
});
|
|
2185
2097
|
if (detailResponse.ok) {
|
|
2186
2098
|
const detailPayload = await detailResponse.json();
|
|
2187
|
-
|
|
2099
|
+
setSwap(detailPayload.swap);
|
|
2100
|
+
setOrder(detailPayload.order || null);
|
|
2188
2101
|
}
|
|
2189
|
-
} catch (
|
|
2190
|
-
const message =
|
|
2102
|
+
} catch (cancelErr) {
|
|
2103
|
+
const message = cancelErr instanceof Error ? cancelErr.message : "Unable to cancel exchange";
|
|
2191
2104
|
setUpdateError(message);
|
|
2192
2105
|
} finally {
|
|
2193
|
-
|
|
2106
|
+
setIsCancelling(false);
|
|
2194
2107
|
}
|
|
2195
2108
|
};
|
|
2109
|
+
const isOrderExchange = Boolean(swap == null ? void 0 : swap.exchange_id);
|
|
2110
|
+
const canCancelExchange = isOrderExchange && swap && !["cancelled", "canceled", "completed", "declined"].includes(
|
|
2111
|
+
((_a = swap.status) == null ? void 0 : _a.toLowerCase()) ?? ""
|
|
2112
|
+
);
|
|
2196
2113
|
if (isLoading) {
|
|
2197
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading
|
|
2114
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading swap..." }) }) }) });
|
|
2198
2115
|
}
|
|
2199
|
-
if (error || !
|
|
2116
|
+
if (error || !swap) {
|
|
2200
2117
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2201
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "
|
|
2202
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => navigate("/
|
|
2118
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Swap not found" }),
|
|
2119
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => navigate("/swaps"), children: "Back to list" }) })
|
|
2203
2120
|
] }) }) });
|
|
2204
2121
|
}
|
|
2205
|
-
const statusHistory = ((
|
|
2122
|
+
const statusHistory = ((_b = swap.metadata) == null ? void 0 : _b.status_history) || [];
|
|
2206
2123
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: [
|
|
2207
2124
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3", children: [
|
|
2208
2125
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2210,7 +2127,7 @@ const ReturnDetailPage = () => {
|
|
|
2210
2127
|
{
|
|
2211
2128
|
variant: "transparent",
|
|
2212
2129
|
size: "small",
|
|
2213
|
-
onClick: () => navigate("/
|
|
2130
|
+
onClick: () => navigate("/swaps"),
|
|
2214
2131
|
className: "w-fit",
|
|
2215
2132
|
children: [
|
|
2216
2133
|
/* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, { className: "mr-2" }),
|
|
@@ -2220,81 +2137,67 @@ const ReturnDetailPage = () => {
|
|
|
2220
2137
|
),
|
|
2221
2138
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
|
|
2222
2139
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2223
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
2224
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children:
|
|
2140
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Exchange Details" }),
|
|
2141
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: swap.id })
|
|
2225
2142
|
] }),
|
|
2226
2143
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2227
2144
|
ui.Badge,
|
|
2228
2145
|
{
|
|
2229
2146
|
size: "small",
|
|
2230
|
-
className: `uppercase ${getStatusBadgeClass$2(
|
|
2231
|
-
children:
|
|
2147
|
+
className: `uppercase ${getStatusBadgeClass$2(swap.status)}`,
|
|
2148
|
+
children: swap.status.replace(/_/g, " ")
|
|
2232
2149
|
}
|
|
2233
2150
|
)
|
|
2234
2151
|
] })
|
|
2235
2152
|
] }),
|
|
2236
|
-
|
|
2153
|
+
canCancelExchange && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
2237
2154
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2238
2155
|
ui.Button,
|
|
2239
2156
|
{
|
|
2240
2157
|
variant: "danger",
|
|
2241
|
-
onClick:
|
|
2242
|
-
disabled:
|
|
2243
|
-
isLoading:
|
|
2244
|
-
children: "
|
|
2158
|
+
onClick: handleCancelExchange,
|
|
2159
|
+
disabled: isCancelling,
|
|
2160
|
+
isLoading: isCancelling,
|
|
2161
|
+
children: "Cancel Exchange"
|
|
2245
2162
|
}
|
|
2246
2163
|
) }),
|
|
2247
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children:
|
|
2248
|
-
] }),
|
|
2249
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2250
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Information" }),
|
|
2251
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
2252
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2253
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
|
|
2254
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.id })
|
|
2255
|
-
] }),
|
|
2256
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2257
|
-
ui.Button,
|
|
2258
|
-
{
|
|
2259
|
-
variant: "secondary",
|
|
2260
|
-
onClick: () => {
|
|
2261
|
-
window.open(
|
|
2262
|
-
`/app/orders/${returnOrder.order_id}`,
|
|
2263
|
-
"_blank"
|
|
2264
|
-
);
|
|
2265
|
-
},
|
|
2266
|
-
children: "View order"
|
|
2267
|
-
}
|
|
2268
|
-
) })
|
|
2269
|
-
] })
|
|
2164
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This will cancel the exchange request. The order will remain unchanged." })
|
|
2270
2165
|
] }),
|
|
2271
2166
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
|
|
2272
2167
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2273
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "
|
|
2168
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Exchange Information" }),
|
|
2274
2169
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
2275
2170
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2276
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "
|
|
2277
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
2171
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
|
|
2172
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.id })
|
|
2278
2173
|
] }),
|
|
2279
2174
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2280
2175
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
|
|
2281
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
2176
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.status })
|
|
2177
|
+
] }),
|
|
2178
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2179
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Difference Due" }),
|
|
2180
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.difference_due != null ? `${swap.currency_code || "$"}${(Number(swap.difference_due) / 100).toFixed(2)}` : "—" })
|
|
2282
2181
|
] }),
|
|
2283
|
-
|
|
2182
|
+
swap.reason && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2284
2183
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
|
|
2285
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
2184
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.reason })
|
|
2286
2185
|
] }),
|
|
2287
|
-
|
|
2186
|
+
swap.note && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2288
2187
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
|
|
2289
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
2188
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.note })
|
|
2290
2189
|
] }),
|
|
2291
2190
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2292
2191
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
|
|
2293
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(
|
|
2192
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(swap.created_at).toLocaleString() })
|
|
2294
2193
|
] }),
|
|
2295
2194
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2296
2195
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
|
|
2297
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(
|
|
2196
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(swap.updated_at).toLocaleString() })
|
|
2197
|
+
] }),
|
|
2198
|
+
swap.exchange_id && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2199
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
|
|
2200
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.exchange_id })
|
|
2298
2201
|
] })
|
|
2299
2202
|
] })
|
|
2300
2203
|
] }),
|
|
@@ -2324,31 +2227,31 @@ const ReturnDetailPage = () => {
|
|
|
2324
2227
|
)) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
|
|
2325
2228
|
] })
|
|
2326
2229
|
] }),
|
|
2327
|
-
|
|
2230
|
+
order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2328
2231
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
|
|
2329
2232
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
2330
2233
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2331
2234
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
|
|
2332
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
2235
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.id })
|
|
2333
2236
|
] }),
|
|
2334
2237
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2335
2238
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
|
|
2336
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children:
|
|
2239
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.status || "—" })
|
|
2337
2240
|
] }),
|
|
2338
2241
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2339
2242
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
2340
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((
|
|
2243
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_c = order.customer) == null ? void 0 : _c.email) || order.email || "—" })
|
|
2341
2244
|
] }),
|
|
2342
|
-
|
|
2245
|
+
order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2343
2246
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
2344
2247
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "font-medium", children: [
|
|
2345
|
-
|
|
2346
|
-
(Number(
|
|
2248
|
+
order.currency_code || "$",
|
|
2249
|
+
(Number(order.total) / 100).toFixed(2)
|
|
2347
2250
|
] })
|
|
2348
2251
|
] })
|
|
2349
2252
|
] })
|
|
2350
2253
|
] }),
|
|
2351
|
-
|
|
2254
|
+
swap.return_items && swap.return_items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2352
2255
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
2353
2256
|
/* @__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: [
|
|
2354
2257
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
@@ -2356,20 +2259,31 @@ const ReturnDetailPage = () => {
|
|
|
2356
2259
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
|
|
2357
2260
|
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
|
|
2358
2261
|
] }) }),
|
|
2359
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children:
|
|
2262
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.return_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2360
2263
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
2361
2264
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
2362
2265
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
2363
2266
|
] }, item.id || index)) })
|
|
2364
2267
|
] }) })
|
|
2365
2268
|
] }),
|
|
2366
|
-
|
|
2367
|
-
|
|
2269
|
+
swap.new_items && swap.new_items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2270
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "New Items" }),
|
|
2271
|
+
/* @__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: [
|
|
2272
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2273
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Variant ID" }),
|
|
2274
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
|
|
2275
|
+
] }) }),
|
|
2276
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.new_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2277
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.variant_id }),
|
|
2278
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
|
|
2279
|
+
] }, item.variant_id || index)) })
|
|
2280
|
+
] }) })
|
|
2281
|
+
] })
|
|
2368
2282
|
] }) });
|
|
2369
2283
|
};
|
|
2370
2284
|
const config$2 = adminSdk.defineRouteConfig({
|
|
2371
|
-
label: "
|
|
2372
|
-
icon: icons.
|
|
2285
|
+
label: "Swap Details",
|
|
2286
|
+
icon: icons.ArrowPath
|
|
2373
2287
|
});
|
|
2374
2288
|
const getStatusBadgeClass$1 = (status) => {
|
|
2375
2289
|
const s2 = status.toLowerCase();
|
|
@@ -2491,196 +2405,282 @@ const config$1 = adminSdk.defineRouteConfig({
|
|
|
2491
2405
|
icon: icons.CreditCard
|
|
2492
2406
|
});
|
|
2493
2407
|
const getStatusBadgeClass = (status) => {
|
|
2494
|
-
const
|
|
2495
|
-
if (
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
if (
|
|
2408
|
+
const statusLower = status.toLowerCase();
|
|
2409
|
+
if (statusLower === "requested") {
|
|
2410
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2411
|
+
}
|
|
2412
|
+
if (statusLower === "approved") {
|
|
2413
|
+
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2414
|
+
}
|
|
2415
|
+
if (statusLower === "rejected") {
|
|
2416
|
+
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2417
|
+
}
|
|
2418
|
+
if (statusLower === "received") {
|
|
2419
|
+
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2420
|
+
}
|
|
2421
|
+
if (statusLower === "refunded") {
|
|
2422
|
+
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2423
|
+
}
|
|
2424
|
+
if (statusLower === "completed") {
|
|
2425
|
+
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2426
|
+
}
|
|
2427
|
+
if (statusLower === "cancelled") {
|
|
2428
|
+
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
2429
|
+
}
|
|
2499
2430
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2500
2431
|
};
|
|
2501
|
-
const
|
|
2502
|
-
|
|
2503
|
-
};
|
|
2504
|
-
const RefundDetailPage = () => {
|
|
2505
|
-
var _a, _b, _c;
|
|
2432
|
+
const ReturnDetailPage = () => {
|
|
2433
|
+
var _a, _b;
|
|
2506
2434
|
const navigate = reactRouterDom.useNavigate();
|
|
2507
|
-
const
|
|
2508
|
-
const
|
|
2509
|
-
const [
|
|
2510
|
-
const [
|
|
2435
|
+
const { id } = reactRouterDom.useParams();
|
|
2436
|
+
const [returnOrder, setReturnOrder] = react.useState(null);
|
|
2437
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
2438
|
+
const [isRejecting, setIsRejecting] = react.useState(false);
|
|
2511
2439
|
const [error, setError] = react.useState(null);
|
|
2512
|
-
const [
|
|
2440
|
+
const [updateError, setUpdateError] = react.useState(null);
|
|
2441
|
+
const [updateSuccess, setUpdateSuccess] = react.useState(false);
|
|
2513
2442
|
react.useEffect(() => {
|
|
2514
2443
|
if (!id) {
|
|
2515
|
-
|
|
2444
|
+
navigate("/returns");
|
|
2516
2445
|
return;
|
|
2517
2446
|
}
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2447
|
+
const loadReturn = async () => {
|
|
2448
|
+
try {
|
|
2449
|
+
setIsLoading(true);
|
|
2450
|
+
setError(null);
|
|
2451
|
+
const response = await fetch(`/admin/returns/${id}`, {
|
|
2452
|
+
credentials: "include"
|
|
2453
|
+
});
|
|
2454
|
+
if (!response.ok) {
|
|
2455
|
+
const message = await response.text();
|
|
2456
|
+
throw new Error(message || "Unable to load return order");
|
|
2457
|
+
}
|
|
2458
|
+
const payload = await response.json();
|
|
2459
|
+
setReturnOrder(payload.return);
|
|
2460
|
+
} catch (loadError) {
|
|
2461
|
+
const message = loadError instanceof Error ? loadError.message : "Unable to load return order";
|
|
2462
|
+
setError(message);
|
|
2463
|
+
} finally {
|
|
2464
|
+
setIsLoading(false);
|
|
2465
|
+
}
|
|
2533
2466
|
};
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
const
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2467
|
+
void loadReturn();
|
|
2468
|
+
}, [id, navigate]);
|
|
2469
|
+
const handleReject = async () => {
|
|
2470
|
+
if (!id) {
|
|
2471
|
+
return;
|
|
2472
|
+
}
|
|
2473
|
+
try {
|
|
2474
|
+
setIsRejecting(true);
|
|
2475
|
+
setUpdateError(null);
|
|
2476
|
+
setUpdateSuccess(false);
|
|
2477
|
+
const response = await fetch(`/admin/returns/${id}/reject`, {
|
|
2478
|
+
method: "POST",
|
|
2479
|
+
headers: {
|
|
2480
|
+
"Content-Type": "application/json"
|
|
2481
|
+
},
|
|
2482
|
+
credentials: "include",
|
|
2483
|
+
body: JSON.stringify({ reason: "Rejected by admin" })
|
|
2484
|
+
});
|
|
2485
|
+
if (!response.ok) {
|
|
2486
|
+
const message = await response.text();
|
|
2487
|
+
throw new Error(message || "Unable to reject return");
|
|
2488
|
+
}
|
|
2489
|
+
const payload = await response.json();
|
|
2490
|
+
setReturnOrder(payload.return);
|
|
2491
|
+
setUpdateSuccess(true);
|
|
2492
|
+
setTimeout(() => setUpdateSuccess(false), 3e3);
|
|
2493
|
+
const detailResponse = await fetch(`/admin/returns/${id}`, {
|
|
2494
|
+
credentials: "include"
|
|
2495
|
+
});
|
|
2496
|
+
if (detailResponse.ok) {
|
|
2497
|
+
const detailPayload = await detailResponse.json();
|
|
2498
|
+
setReturnOrder(detailPayload.return);
|
|
2499
|
+
}
|
|
2500
|
+
} catch (updateErr) {
|
|
2501
|
+
const message = updateErr instanceof Error ? updateErr.message : "Unable to reject return";
|
|
2502
|
+
setUpdateError(message);
|
|
2503
|
+
} finally {
|
|
2504
|
+
setIsRejecting(false);
|
|
2505
|
+
}
|
|
2506
|
+
};
|
|
2507
|
+
if (isLoading) {
|
|
2508
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading return order..." }) }) }) });
|
|
2509
|
+
}
|
|
2510
|
+
if (error || !returnOrder) {
|
|
2511
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2512
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Return order not found" }),
|
|
2513
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => navigate("/returns"), children: "Back to list" }) })
|
|
2514
|
+
] }) }) });
|
|
2515
|
+
}
|
|
2516
|
+
const statusHistory = ((_a = returnOrder.metadata) == null ? void 0 : _a.status_history) || [];
|
|
2517
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-5xl flex-col gap-6 p-6", children: [
|
|
2518
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3", children: [
|
|
2519
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2520
|
+
ui.Button,
|
|
2521
|
+
{
|
|
2522
|
+
variant: "transparent",
|
|
2523
|
+
size: "small",
|
|
2524
|
+
onClick: () => navigate("/returns"),
|
|
2525
|
+
className: "w-fit",
|
|
2526
|
+
children: [
|
|
2527
|
+
/* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, { className: "mr-2" }),
|
|
2528
|
+
"Back to list"
|
|
2529
|
+
]
|
|
2530
|
+
}
|
|
2531
|
+
),
|
|
2532
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
|
|
2533
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2534
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Return Order Details" }),
|
|
2535
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: returnOrder.id })
|
|
2536
|
+
] }),
|
|
2537
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2538
|
+
ui.Badge,
|
|
2539
|
+
{
|
|
2540
|
+
size: "small",
|
|
2541
|
+
className: `uppercase ${getStatusBadgeClass(returnOrder.status)}`,
|
|
2542
|
+
children: returnOrder.status.replace(/_/g, " ")
|
|
2543
|
+
}
|
|
2544
|
+
)
|
|
2545
|
+
] })
|
|
2546
|
+
] }),
|
|
2547
|
+
returnOrder.status === "requested" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
2548
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2549
|
+
ui.Button,
|
|
2550
|
+
{
|
|
2551
|
+
variant: "danger",
|
|
2552
|
+
onClick: handleReject,
|
|
2553
|
+
disabled: isRejecting,
|
|
2554
|
+
isLoading: isRejecting,
|
|
2555
|
+
children: "Reject (Cancel) Return"
|
|
2556
|
+
}
|
|
2557
|
+
) }),
|
|
2558
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: 'Cancel this return request. Use "Mark as received" when items are received.' })
|
|
2559
|
+
] }),
|
|
2560
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2561
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Information" }),
|
|
2562
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
2563
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2564
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
|
|
2565
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.id })
|
|
2566
|
+
] }),
|
|
2567
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2568
|
+
ui.Button,
|
|
2569
|
+
{
|
|
2570
|
+
variant: "secondary",
|
|
2571
|
+
onClick: () => {
|
|
2572
|
+
window.open(
|
|
2573
|
+
`/app/orders/${returnOrder.order_id}`,
|
|
2574
|
+
"_blank"
|
|
2575
|
+
);
|
|
2576
|
+
},
|
|
2577
|
+
children: "View order"
|
|
2578
|
+
}
|
|
2579
|
+
) })
|
|
2580
|
+
] })
|
|
2581
|
+
] }),
|
|
2582
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
|
|
2583
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2584
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Details" }),
|
|
2585
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
2562
2586
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2563
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
2564
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "
|
|
2565
|
-
year: "numeric",
|
|
2566
|
-
month: "short",
|
|
2567
|
-
day: "numeric",
|
|
2568
|
-
hour: "numeric",
|
|
2569
|
-
minute: "2-digit",
|
|
2570
|
-
hour12: true
|
|
2571
|
-
}) })
|
|
2587
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
|
|
2588
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.id })
|
|
2572
2589
|
] }),
|
|
2573
|
-
detail.refund.created_by ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2574
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created by" }),
|
|
2575
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.created_by })
|
|
2576
|
-
] }) : null
|
|
2577
|
-
] })
|
|
2578
|
-
] }),
|
|
2579
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2580
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Payment summary" }),
|
|
2581
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
2582
2590
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2583
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
2584
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "
|
|
2591
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
|
|
2592
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.status })
|
|
2585
2593
|
] }),
|
|
2586
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2587
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
2588
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "
|
|
2594
|
+
returnOrder.reason && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2595
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
|
|
2596
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.reason })
|
|
2589
2597
|
] }),
|
|
2590
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2591
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
2592
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "
|
|
2598
|
+
returnOrder.note && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2599
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
|
|
2600
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.note })
|
|
2593
2601
|
] }),
|
|
2594
2602
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2595
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
2596
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "
|
|
2603
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
|
|
2604
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(returnOrder.created_at).toLocaleString() })
|
|
2597
2605
|
] }),
|
|
2598
2606
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2599
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-
|
|
2600
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2601
|
-
|
|
2602
|
-
{
|
|
2603
|
-
size: "2xsmall",
|
|
2604
|
-
className: `uppercase ${getStatusBadgeClass(paymentStatus)}`,
|
|
2605
|
-
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
2606
|
-
}
|
|
2607
|
-
) })
|
|
2608
|
-
] }),
|
|
2609
|
-
detail.computed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2610
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2611
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
2612
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
2613
|
-
] }),
|
|
2614
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2615
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
2616
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
2617
|
-
] }),
|
|
2618
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2619
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
2620
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "mt-1 block", children: [
|
|
2621
|
-
detail.computed.refund_percentage.toFixed(1),
|
|
2622
|
-
"%"
|
|
2623
|
-
] })
|
|
2624
|
-
] })
|
|
2625
|
-
] }) : null
|
|
2607
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
|
|
2608
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(returnOrder.updated_at).toLocaleString() })
|
|
2609
|
+
] })
|
|
2626
2610
|
] })
|
|
2627
2611
|
] }),
|
|
2628
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-
|
|
2629
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
2633
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2634
|
-
ui.Button,
|
|
2635
|
-
{
|
|
2636
|
-
variant: "transparent",
|
|
2637
|
-
size: "small",
|
|
2638
|
-
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
2639
|
-
children: detail.order.order_number ?? detail.order.order_id
|
|
2640
|
-
}
|
|
2641
|
-
) })
|
|
2642
|
-
] }),
|
|
2643
|
-
detail.order.total != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2644
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
2645
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
2646
|
-
] }) : null,
|
|
2647
|
-
detail.order.customer_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2648
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
2649
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
2650
|
-
] }) : null,
|
|
2651
|
-
detail.order.region ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2652
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
2653
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.region })
|
|
2654
|
-
] }) : null,
|
|
2655
|
-
detail.order.fulfillment_status ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2656
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
2657
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
2658
|
-
] }) : null
|
|
2659
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
2660
|
-
] }),
|
|
2661
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2662
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2663
|
-
"button",
|
|
2612
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2613
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Status History" }),
|
|
2614
|
+
statusHistory.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: statusHistory.map((entry, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2615
|
+
"div",
|
|
2664
2616
|
{
|
|
2665
|
-
|
|
2666
|
-
className: "flex
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2617
|
+
className: "flex items-center justify-between border-b border-ui-border-subtle pb-2 last:border-0",
|
|
2618
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2619
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2620
|
+
ui.Badge,
|
|
2621
|
+
{
|
|
2622
|
+
size: "2xsmall",
|
|
2623
|
+
className: `uppercase ${getStatusBadgeClass(entry.status)}`,
|
|
2624
|
+
children: entry.status.replace(/_/g, " ")
|
|
2625
|
+
}
|
|
2626
|
+
) }),
|
|
2627
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: [
|
|
2628
|
+
new Date(entry.timestamp).toLocaleString(),
|
|
2629
|
+
entry.admin_id && ` by ${entry.admin_id}`,
|
|
2630
|
+
entry.reason && ` - ${entry.reason}`
|
|
2631
|
+
] })
|
|
2632
|
+
] })
|
|
2633
|
+
},
|
|
2634
|
+
index
|
|
2635
|
+
)) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
|
|
2677
2636
|
] })
|
|
2678
|
-
] })
|
|
2637
|
+
] }),
|
|
2638
|
+
returnOrder.order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2639
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
|
|
2640
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
|
|
2641
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2642
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
|
|
2643
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.id })
|
|
2644
|
+
] }),
|
|
2645
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2646
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
|
|
2647
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.status || "—" })
|
|
2648
|
+
] }),
|
|
2649
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2650
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
|
|
2651
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_b = returnOrder.order.customer) == null ? void 0 : _b.email) || returnOrder.order.email || "—" })
|
|
2652
|
+
] }),
|
|
2653
|
+
returnOrder.order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2654
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
|
|
2655
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "font-medium", children: [
|
|
2656
|
+
returnOrder.order.currency_code || "$",
|
|
2657
|
+
(Number(returnOrder.order.total) / 100).toFixed(2)
|
|
2658
|
+
] })
|
|
2659
|
+
] })
|
|
2660
|
+
] })
|
|
2661
|
+
] }),
|
|
2662
|
+
returnOrder.return_items && returnOrder.return_items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
|
|
2663
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
|
|
2664
|
+
/* @__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: [
|
|
2665
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2666
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Item ID" }),
|
|
2667
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
|
|
2668
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
|
|
2669
|
+
] }) }),
|
|
2670
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: returnOrder.return_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
2671
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
|
|
2672
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
|
|
2673
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
|
|
2674
|
+
] }, item.id || index)) })
|
|
2675
|
+
] }) })
|
|
2676
|
+
] }),
|
|
2677
|
+
updateError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-ui-border-error bg-ui-bg-error-subtle p-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-error", children: updateError }) }),
|
|
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" }) })
|
|
2679
2679
|
] }) });
|
|
2680
2680
|
};
|
|
2681
2681
|
const config = adminSdk.defineRouteConfig({
|
|
2682
|
-
label: "
|
|
2683
|
-
icon: icons.
|
|
2682
|
+
label: "Return Order Details",
|
|
2683
|
+
icon: icons.CheckCircle
|
|
2684
2684
|
});
|
|
2685
2685
|
const i18nTranslations0 = {};
|
|
2686
2686
|
const widgetModule = { widgets: [
|
|
@@ -2696,8 +2696,8 @@ const widgetModule = { widgets: [
|
|
|
2696
2696
|
const routeModule = {
|
|
2697
2697
|
routes: [
|
|
2698
2698
|
{
|
|
2699
|
-
Component:
|
|
2700
|
-
path: "/
|
|
2699
|
+
Component: RefundsPage,
|
|
2700
|
+
path: "/refunds"
|
|
2701
2701
|
},
|
|
2702
2702
|
{
|
|
2703
2703
|
Component: ReturnsPage,
|
|
@@ -2708,57 +2708,57 @@ const routeModule = {
|
|
|
2708
2708
|
path: "/payments"
|
|
2709
2709
|
},
|
|
2710
2710
|
{
|
|
2711
|
-
Component:
|
|
2712
|
-
path: "/
|
|
2711
|
+
Component: SwapsPage,
|
|
2712
|
+
path: "/swaps"
|
|
2713
2713
|
},
|
|
2714
2714
|
{
|
|
2715
|
-
Component:
|
|
2716
|
-
path: "/
|
|
2715
|
+
Component: RefundDetailPage,
|
|
2716
|
+
path: "/refunds/:id"
|
|
2717
2717
|
},
|
|
2718
2718
|
{
|
|
2719
|
-
Component:
|
|
2720
|
-
path: "/
|
|
2719
|
+
Component: SwapDetailPage,
|
|
2720
|
+
path: "/swaps/:id"
|
|
2721
2721
|
},
|
|
2722
2722
|
{
|
|
2723
2723
|
Component: PaymentDetailPage,
|
|
2724
2724
|
path: "/payments/:id"
|
|
2725
2725
|
},
|
|
2726
2726
|
{
|
|
2727
|
-
Component:
|
|
2728
|
-
path: "/
|
|
2727
|
+
Component: ReturnDetailPage,
|
|
2728
|
+
path: "/returns/:id"
|
|
2729
2729
|
}
|
|
2730
2730
|
]
|
|
2731
2731
|
};
|
|
2732
2732
|
const menuItemModule = {
|
|
2733
2733
|
menuItems: [
|
|
2734
|
-
{
|
|
2735
|
-
label: config$4.label,
|
|
2736
|
-
icon: config$4.icon,
|
|
2737
|
-
path: "/refunds",
|
|
2738
|
-
nested: void 0
|
|
2739
|
-
},
|
|
2740
2734
|
{
|
|
2741
2735
|
label: config$5.label,
|
|
2742
2736
|
icon: config$5.icon,
|
|
2743
2737
|
path: "/payments",
|
|
2744
2738
|
nested: void 0
|
|
2745
2739
|
},
|
|
2740
|
+
{
|
|
2741
|
+
label: config$6.label,
|
|
2742
|
+
icon: config$6.icon,
|
|
2743
|
+
path: "/returns",
|
|
2744
|
+
nested: void 0
|
|
2745
|
+
},
|
|
2746
2746
|
{
|
|
2747
2747
|
label: config$7.label,
|
|
2748
2748
|
icon: config$7.icon,
|
|
2749
|
-
path: "/
|
|
2749
|
+
path: "/refunds",
|
|
2750
2750
|
nested: void 0
|
|
2751
2751
|
},
|
|
2752
2752
|
{
|
|
2753
|
-
label: config$
|
|
2754
|
-
icon: config$
|
|
2755
|
-
path: "/
|
|
2753
|
+
label: config$4.label,
|
|
2754
|
+
icon: config$4.icon,
|
|
2755
|
+
path: "/swaps",
|
|
2756
2756
|
nested: void 0
|
|
2757
2757
|
},
|
|
2758
2758
|
{
|
|
2759
2759
|
label: config.label,
|
|
2760
2760
|
icon: config.icon,
|
|
2761
|
-
path: "/
|
|
2761
|
+
path: "/returns/:id",
|
|
2762
2762
|
nested: void 0
|
|
2763
2763
|
},
|
|
2764
2764
|
{
|
|
@@ -2770,13 +2770,13 @@ const menuItemModule = {
|
|
|
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
|
]
|