order-management 0.0.52 → 0.0.55

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.
Files changed (34) hide show
  1. package/.medusa/server/src/admin/index.js +405 -276
  2. package/.medusa/server/src/admin/index.mjs +409 -280
  3. package/.medusa/server/src/api/admin/orders/[order_id]/refund-context/route.js +122 -0
  4. package/.medusa/server/src/api/admin/refund-payment-mapping/[return_id]/mark-refunded/route.js +45 -0
  5. package/.medusa/server/src/api/admin/return/[id]/reject/route.js +69 -0
  6. package/.medusa/server/src/api/admin/return/[id]/route.js +75 -0
  7. package/.medusa/server/src/api/admin/return/route.js +91 -0
  8. package/.medusa/server/src/api/admin/return/validators.js +29 -0
  9. package/.medusa/server/src/api/store/guest-orders/[id]/returns/route.js +15 -1
  10. package/.medusa/server/src/api/store/payment-details/[id]/make-default/route.js +56 -0
  11. package/.medusa/server/src/api/store/payment-details/[id]/route.js +124 -0
  12. package/.medusa/server/src/api/store/payment-details/route.js +88 -0
  13. package/.medusa/server/src/api/store/payment-details/validators.js +65 -0
  14. package/.medusa/server/src/api/store/refund-payment-mapping/[return_id]/route.js +140 -0
  15. package/.medusa/server/src/api/store/returns/route.js +39 -1
  16. package/.medusa/server/src/api/store/returns/validators.js +2 -1
  17. package/.medusa/server/src/api/store/swaps/route.js +2 -2
  18. package/.medusa/server/src/modules/payment-detail/index.js +14 -0
  19. package/.medusa/server/src/modules/payment-detail/migrations/Migration20260216000000.js +35 -0
  20. package/.medusa/server/src/modules/payment-detail/models/payment-detail.js +12 -0
  21. package/.medusa/server/src/modules/payment-detail/service.js +226 -0
  22. package/.medusa/server/src/modules/payment-detail/types.js +3 -0
  23. package/.medusa/server/src/modules/payment-detail/validation.js +67 -0
  24. package/.medusa/server/src/modules/refund-payment-mapping/index.js +14 -0
  25. package/.medusa/server/src/modules/refund-payment-mapping/migrations/Migration20260216100000.js +34 -0
  26. package/.medusa/server/src/modules/refund-payment-mapping/models/refund-payment-mapping.js +11 -0
  27. package/.medusa/server/src/modules/refund-payment-mapping/service.js +112 -0
  28. package/.medusa/server/src/modules/refund-payment-mapping/types.js +3 -0
  29. package/README.md +54 -3
  30. package/package.json +1 -1
  31. package/.medusa/server/src/api/admin/returns/[id]/reject/route.js +0 -69
  32. package/.medusa/server/src/api/admin/returns/[id]/route.js +0 -75
  33. package/.medusa/server/src/api/admin/returns/route.js +0 -91
  34. package/.medusa/server/src/api/admin/returns/validators.js +0 -29
@@ -5,6 +5,130 @@ const adminSdk = require("@medusajs/admin-sdk");
5
5
  const ui = require("@medusajs/ui");
6
6
  const icons = require("@medusajs/icons");
7
7
  const reactRouterDom = require("react-router-dom");
8
+ function getOrderIdFromPath() {
9
+ if (typeof window === "undefined") return void 0;
10
+ const m = window.location.pathname.match(/\/orders\/([^/]+)/);
11
+ return m ? m[1] : void 0;
12
+ }
13
+ const OrderRefundContextWidget = (props) => {
14
+ var _a, _b, _c, _d, _e;
15
+ const orderId = ((_a = props.order) == null ? void 0 : _a.id) ?? ((_c = (_b = props.data) == null ? void 0 : _b.order) == null ? void 0 : _c.id) ?? getOrderIdFromPath();
16
+ const [context, setContext] = react.useState(null);
17
+ const [loading, setLoading] = react.useState(!!orderId);
18
+ const [error, setError] = react.useState(null);
19
+ const [marking, setMarking] = react.useState(false);
20
+ const [markError, setMarkError] = react.useState(null);
21
+ react.useEffect(() => {
22
+ if (!orderId) {
23
+ setLoading(false);
24
+ return;
25
+ }
26
+ let cancelled = false;
27
+ setLoading(true);
28
+ setError(null);
29
+ fetch(`/admin/orders/${orderId}/refund-context`, { credentials: "include" }).then((res) => {
30
+ if (!res.ok) throw new Error(res.statusText || "Failed to load refund context");
31
+ return res.json();
32
+ }).then((data) => {
33
+ if (!cancelled) setContext(data);
34
+ }).catch((e) => {
35
+ if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
36
+ }).finally(() => {
37
+ if (!cancelled) setLoading(false);
38
+ });
39
+ return () => {
40
+ cancelled = true;
41
+ };
42
+ }, [orderId]);
43
+ const handleMarkRefunded = async () => {
44
+ if (!(context == null ? void 0 : context.return_id) || !(context == null ? void 0 : context.refund_mapping) || context.refund_mapping.is_refunded) return;
45
+ setMarking(true);
46
+ setMarkError(null);
47
+ try {
48
+ const res = await fetch(`/admin/refund-payment-mapping/${context.return_id}/mark-refunded`, {
49
+ method: "POST",
50
+ headers: { "Content-Type": "application/json" },
51
+ credentials: "include"
52
+ });
53
+ if (!res.ok) {
54
+ const data2 = await res.json().catch(() => ({}));
55
+ throw new Error(data2.message || "Failed to mark refunded");
56
+ }
57
+ const data = await res.json();
58
+ setContext(
59
+ (prev) => {
60
+ var _a2;
61
+ return prev && prev.refund_mapping ? {
62
+ ...prev,
63
+ refund_mapping: {
64
+ ...prev.refund_mapping,
65
+ is_refunded: ((_a2 = data.refund_payment_mapping) == null ? void 0 : _a2.is_refunded) ?? true
66
+ }
67
+ } : prev;
68
+ }
69
+ );
70
+ } catch (e) {
71
+ setMarkError(e instanceof Error ? e.message : "Failed to mark refunded");
72
+ } finally {
73
+ setMarking(false);
74
+ }
75
+ };
76
+ if (!orderId) return null;
77
+ if (loading) {
78
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mt-6 divide-y p-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-subtle", children: "Loading refund context..." }) }) });
79
+ }
80
+ if (error) {
81
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mt-6 divide-y p-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-error", children: error }) }) });
82
+ }
83
+ const hasReturn = !!(context == null ? void 0 : context.return_id);
84
+ const hasMapping = !!(context == null ? void 0 : context.refund_mapping);
85
+ const canMarkRefunded = hasReturn && hasMapping && !context.refund_mapping.is_refunded;
86
+ const paymentDetail = context == null ? void 0 : context.payment_detail;
87
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "mt-6 divide-y p-0", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4 py-4", children: [
88
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Heading, { level: "h2", className: "flex items-center gap-2", children: [
89
+ /* @__PURE__ */ jsxRuntime.jsx(icons.CashSolid, { className: "text-ui-fg-subtle" }),
90
+ "Refund payment"
91
+ ] }),
92
+ !hasReturn && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No return for this order." }),
93
+ hasMapping && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-subtle p-4", children: [
94
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
95
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Return" }),
96
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: context.return_id }),
97
+ ((_d = context.refund_mapping) == null ? void 0 : _d.is_refunded) ? /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "green", children: "Refunded" }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "orange", children: "Not refunded" })
98
+ ] }),
99
+ paymentDetail && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 space-y-1 border-t border-ui-border-base pt-3", children: [
100
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", weight: "plus", className: "text-ui-fg-subtle", children: "Payment method (refund destination)" }),
101
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2", children: [
102
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { children: paymentDetail.type }),
103
+ paymentDetail.is_default && /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "blue", children: "Default" })
104
+ ] }),
105
+ Object.keys(paymentDetail.detail_json).length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2 flex flex-wrap gap-x-4 gap-y-1 text-ui-fg-subtle", children: Object.entries(paymentDetail.detail_json).map(([k, v]) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs", children: [
106
+ k,
107
+ ": ",
108
+ String(v)
109
+ ] }, k)) })
110
+ ] }),
111
+ !paymentDetail && ((_e = context.refund_mapping) == null ? void 0 : _e.payment_id) && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-muted", children: "Payment detail not found or not accessible." }),
112
+ canMarkRefunded && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-4", children: [
113
+ /* @__PURE__ */ jsxRuntime.jsx(
114
+ ui.Button,
115
+ {
116
+ size: "small",
117
+ onClick: handleMarkRefunded,
118
+ disabled: marking,
119
+ isLoading: marking,
120
+ children: "Mark refunded"
121
+ }
122
+ ),
123
+ markError && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-error", children: markError })
124
+ ] })
125
+ ] }),
126
+ hasReturn && !hasMapping && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No refund payment mapping for this return. Ensure the refund_payment_mapping module is registered and a mapping was created when the return was created." })
127
+ ] }) });
128
+ };
129
+ adminSdk.defineWidgetConfig({
130
+ zone: "order.details.after"
131
+ });
8
132
  const useDebounce$1 = (value, delay) => {
9
133
  const [debouncedValue, setDebouncedValue] = react.useState(value);
10
134
  react.useEffect(() => {
@@ -18,21 +142,21 @@ const getStatusBadgeClass$3 = (status) => {
18
142
  if (statusLower === "requested") {
19
143
  return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
20
144
  }
21
- if (statusLower === "approved") {
145
+ if (statusLower === "received") {
22
146
  return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
23
147
  }
24
- if (statusLower === "rejected") {
148
+ if (statusLower === "requires_action") {
25
149
  return "bg-ui-tag-red-bg text-ui-tag-red-text";
26
150
  }
27
151
  if (statusLower === "completed") {
28
152
  return "bg-ui-tag-green-bg text-ui-tag-green-text";
29
153
  }
30
- if (statusLower === "cancelled") {
154
+ if (statusLower === "canceled") {
31
155
  return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
32
156
  }
33
157
  return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
34
158
  };
35
- const SwapsPage = () => {
159
+ const ReturnsPage = () => {
36
160
  const navigate = reactRouterDom.useNavigate();
37
161
  const [items, setItems] = react.useState([]);
38
162
  const [statusFilter, setStatusFilter] = react.useState("all");
@@ -45,7 +169,7 @@ const SwapsPage = () => {
45
169
  const [offset, setOffset] = react.useState(0);
46
170
  const [count, setCount] = react.useState(0);
47
171
  const limit = 50;
48
- const loadSwaps = react.useCallback(
172
+ const loadReturns = react.useCallback(
49
173
  async (nextOffset, replace = false) => {
50
174
  var _a;
51
175
  try {
@@ -62,27 +186,28 @@ const SwapsPage = () => {
62
186
  params.set("status", statusFilter);
63
187
  }
64
188
  if (debouncedSearchQuery.trim()) {
65
- params.set("order_id", debouncedSearchQuery.trim());
189
+ params.set("q", debouncedSearchQuery.trim());
66
190
  }
67
191
  if (createdByFilter !== "all") {
68
192
  params.set("created_by", createdByFilter);
69
193
  }
194
+ params.set("order", "created_at");
70
195
  const response = await fetch(
71
- `/admin/swaps?${params.toString()}`,
196
+ `/admin/return?${params.toString()}`,
72
197
  { credentials: "include" }
73
198
  );
74
199
  if (!response.ok) {
75
200
  const message = await response.text();
76
- throw new Error(message || "Unable to load swaps");
201
+ throw new Error(message || "Unable to load return orders");
77
202
  }
78
203
  const payload = await response.json();
79
204
  setCount(payload.count ?? 0);
80
- setOffset(nextOffset + (((_a = payload.swaps) == null ? void 0 : _a.length) ?? 0));
205
+ setOffset(nextOffset + (((_a = payload.returns) == null ? void 0 : _a.length) ?? 0));
81
206
  setItems(
82
- (prev) => replace ? payload.swaps ?? [] : [...prev, ...payload.swaps ?? []]
207
+ (prev) => replace ? payload.returns ?? [] : [...prev, ...payload.returns ?? []]
83
208
  );
84
209
  } catch (loadError) {
85
- const message = loadError instanceof Error ? loadError.message : "Unable to load swaps";
210
+ const message = loadError instanceof Error ? loadError.message : "Unable to load return orders";
86
211
  setError(message);
87
212
  } finally {
88
213
  setIsLoading(false);
@@ -92,8 +217,8 @@ const SwapsPage = () => {
92
217
  [statusFilter, createdByFilter, debouncedSearchQuery]
93
218
  );
94
219
  react.useEffect(() => {
95
- void loadSwaps(0, true);
96
- }, [statusFilter, createdByFilter, debouncedSearchQuery, loadSwaps]);
220
+ void loadReturns(0, true);
221
+ }, [statusFilter, createdByFilter, debouncedSearchQuery, loadReturns]);
97
222
  const hasMore = react.useMemo(() => offset < count, [offset, count]);
98
223
  const availableStatuses = react.useMemo(() => {
99
224
  const statuses = /* @__PURE__ */ new Set();
@@ -103,16 +228,16 @@ const SwapsPage = () => {
103
228
  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: [
104
229
  /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
105
230
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
106
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Exchanges" }),
107
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer exchange requests" })
231
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Return Orders" }),
232
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer return orders" })
108
233
  ] }),
109
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadSwaps(0, true), children: "Refresh" })
234
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadReturns(0, true), children: "Refresh" })
110
235
  ] }),
111
236
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
112
237
  /* @__PURE__ */ jsxRuntime.jsx(
113
238
  ui.Input,
114
239
  {
115
- placeholder: "Search by swap ID or order ID",
240
+ placeholder: "Search by return ID, order ID, or customer email",
116
241
  value: searchQuery,
117
242
  onChange: (event) => setSearchQuery(event.target.value),
118
243
  className: "md:max-w-sm"
@@ -152,50 +277,51 @@ const SwapsPage = () => {
152
277
  ui.Button,
153
278
  {
154
279
  variant: "secondary",
155
- onClick: () => loadSwaps(0, true),
280
+ onClick: () => loadReturns(0, true),
156
281
  children: "Try again"
157
282
  }
158
283
  ) })
159
284
  ] }) : null,
160
- 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: [
161
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No exchanges yet" }),
162
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Exchange requests created by customers will appear here." })
285
+ isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading return orders..." }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
286
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No return orders yet" }),
287
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Return orders created by customers will appear here." })
163
288
  ] }) : /* @__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: [
164
289
  /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
165
- /* @__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" }),
290
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Return ID" }),
166
291
  /* @__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" }),
292
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Customer" }),
167
293
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
168
- /* @__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" }),
294
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Refund Amount" }),
169
295
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
170
296
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
171
297
  ] }) }),
172
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((swap) => /* @__PURE__ */ jsxRuntime.jsxs(
298
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((returnOrder) => /* @__PURE__ */ jsxRuntime.jsxs(
173
299
  "tr",
174
300
  {
175
301
  className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
176
- onClick: () => navigate(`/swaps/${swap.id}`),
302
+ onClick: () => navigate(`/returns/${returnOrder.id}`),
177
303
  children: [
178
- /* @__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 }) }) }),
179
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: swap.order_id }),
304
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-0.5", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: returnOrder.id }) }) }),
305
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.order_id }),
306
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.customer_email || returnOrder.order_email || "—" }),
180
307
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
181
308
  ui.Badge,
182
309
  {
183
310
  size: "2xsmall",
184
- className: `uppercase ${getStatusBadgeClass$3(swap.status)}`,
185
- children: swap.status.replace(/_/g, " ")
311
+ className: `uppercase ${getStatusBadgeClass$3(returnOrder.status)}`,
312
+ children: returnOrder.status.replace(/_/g, " ")
186
313
  }
187
314
  ) }),
188
315
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
189
- const amount = swap.difference_due;
316
+ const amount = returnOrder.refund_amount;
190
317
  if (amount == null || amount === void 0) {
191
318
  return "—";
192
319
  }
193
320
  const displayAmount = Number(amount) / 100;
194
- const currency = swap.currency_code || "$";
195
- const sign = displayAmount >= 0 ? "+" : "";
196
- return `${sign}${currency}${displayAmount.toFixed(2)}`;
321
+ const currency = returnOrder.currency_code || "$";
322
+ return `${currency}${displayAmount.toFixed(2)}`;
197
323
  })() }),
198
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(swap.created_at).toLocaleDateString("en-US", {
324
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(returnOrder.created_at).toLocaleDateString("en-US", {
199
325
  year: "numeric",
200
326
  month: "short",
201
327
  day: "numeric",
@@ -210,14 +336,14 @@ const SwapsPage = () => {
210
336
  size: "small",
211
337
  onClick: (e) => {
212
338
  e.stopPropagation();
213
- navigate(`/app/orders/${swap.order_id}`);
339
+ navigate(`/app/orders/${returnOrder.order_id}`);
214
340
  },
215
341
  children: "Go to order"
216
342
  }
217
343
  ) })
218
344
  ]
219
345
  },
220
- swap.id
346
+ returnOrder.id
221
347
  )) })
222
348
  ] }) }),
223
349
  hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -225,14 +351,14 @@ const SwapsPage = () => {
225
351
  {
226
352
  variant: "secondary",
227
353
  isLoading: isFetchingMore,
228
- onClick: () => loadSwaps(offset, false),
354
+ onClick: () => loadReturns(offset, false),
229
355
  children: "Load more"
230
356
  }
231
357
  ) }) : null
232
358
  ] }) });
233
359
  };
234
360
  const config$3 = adminSdk.defineRouteConfig({
235
- label: "Exchanges",
361
+ label: "Return Orders",
236
362
  icon: icons.ArrowPath
237
363
  });
238
364
  const useDebounce = (value, delay) => {
@@ -248,21 +374,21 @@ const getStatusBadgeClass$2 = (status) => {
248
374
  if (statusLower === "requested") {
249
375
  return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
250
376
  }
251
- if (statusLower === "received") {
377
+ if (statusLower === "approved") {
252
378
  return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
253
379
  }
254
- if (statusLower === "requires_action") {
380
+ if (statusLower === "rejected") {
255
381
  return "bg-ui-tag-red-bg text-ui-tag-red-text";
256
382
  }
257
383
  if (statusLower === "completed") {
258
384
  return "bg-ui-tag-green-bg text-ui-tag-green-text";
259
385
  }
260
- if (statusLower === "canceled") {
386
+ if (statusLower === "cancelled") {
261
387
  return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
262
388
  }
263
389
  return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
264
390
  };
265
- const ReturnsPage = () => {
391
+ const SwapsPage = () => {
266
392
  const navigate = reactRouterDom.useNavigate();
267
393
  const [items, setItems] = react.useState([]);
268
394
  const [statusFilter, setStatusFilter] = react.useState("all");
@@ -275,7 +401,7 @@ const ReturnsPage = () => {
275
401
  const [offset, setOffset] = react.useState(0);
276
402
  const [count, setCount] = react.useState(0);
277
403
  const limit = 50;
278
- const loadReturns = react.useCallback(
404
+ const loadSwaps = react.useCallback(
279
405
  async (nextOffset, replace = false) => {
280
406
  var _a;
281
407
  try {
@@ -292,28 +418,27 @@ const ReturnsPage = () => {
292
418
  params.set("status", statusFilter);
293
419
  }
294
420
  if (debouncedSearchQuery.trim()) {
295
- params.set("q", debouncedSearchQuery.trim());
421
+ params.set("order_id", debouncedSearchQuery.trim());
296
422
  }
297
423
  if (createdByFilter !== "all") {
298
424
  params.set("created_by", createdByFilter);
299
425
  }
300
- params.set("order", "created_at");
301
426
  const response = await fetch(
302
- `/admin/returns?${params.toString()}`,
427
+ `/admin/swaps?${params.toString()}`,
303
428
  { credentials: "include" }
304
429
  );
305
430
  if (!response.ok) {
306
431
  const message = await response.text();
307
- throw new Error(message || "Unable to load return orders");
432
+ throw new Error(message || "Unable to load swaps");
308
433
  }
309
434
  const payload = await response.json();
310
435
  setCount(payload.count ?? 0);
311
- setOffset(nextOffset + (((_a = payload.returns) == null ? void 0 : _a.length) ?? 0));
436
+ setOffset(nextOffset + (((_a = payload.swaps) == null ? void 0 : _a.length) ?? 0));
312
437
  setItems(
313
- (prev) => replace ? payload.returns ?? [] : [...prev, ...payload.returns ?? []]
438
+ (prev) => replace ? payload.swaps ?? [] : [...prev, ...payload.swaps ?? []]
314
439
  );
315
440
  } catch (loadError) {
316
- const message = loadError instanceof Error ? loadError.message : "Unable to load return orders";
441
+ const message = loadError instanceof Error ? loadError.message : "Unable to load swaps";
317
442
  setError(message);
318
443
  } finally {
319
444
  setIsLoading(false);
@@ -323,8 +448,8 @@ const ReturnsPage = () => {
323
448
  [statusFilter, createdByFilter, debouncedSearchQuery]
324
449
  );
325
450
  react.useEffect(() => {
326
- void loadReturns(0, true);
327
- }, [statusFilter, createdByFilter, debouncedSearchQuery, loadReturns]);
451
+ void loadSwaps(0, true);
452
+ }, [statusFilter, createdByFilter, debouncedSearchQuery, loadSwaps]);
328
453
  const hasMore = react.useMemo(() => offset < count, [offset, count]);
329
454
  const availableStatuses = react.useMemo(() => {
330
455
  const statuses = /* @__PURE__ */ new Set();
@@ -334,16 +459,16 @@ const ReturnsPage = () => {
334
459
  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: [
335
460
  /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
336
461
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
337
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Return Orders" }),
338
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer return orders" })
462
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Exchanges" }),
463
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer exchange requests" })
339
464
  ] }),
340
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadReturns(0, true), children: "Refresh" })
465
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadSwaps(0, true), children: "Refresh" })
341
466
  ] }),
342
467
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
343
468
  /* @__PURE__ */ jsxRuntime.jsx(
344
469
  ui.Input,
345
470
  {
346
- placeholder: "Search by return ID, order ID, or customer email",
471
+ placeholder: "Search by swap ID or order ID",
347
472
  value: searchQuery,
348
473
  onChange: (event) => setSearchQuery(event.target.value),
349
474
  className: "md:max-w-sm"
@@ -383,51 +508,50 @@ const ReturnsPage = () => {
383
508
  ui.Button,
384
509
  {
385
510
  variant: "secondary",
386
- onClick: () => loadReturns(0, true),
511
+ onClick: () => loadSwaps(0, true),
387
512
  children: "Try again"
388
513
  }
389
514
  ) })
390
515
  ] }) : null,
391
- isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading return orders..." }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
392
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No return orders yet" }),
393
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Return orders created by customers will appear here." })
516
+ 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: [
517
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No exchanges yet" }),
518
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Exchange requests created by customers will appear here." })
394
519
  ] }) : /* @__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: [
395
520
  /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
396
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Return ID" }),
521
+ /* @__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" }),
397
522
  /* @__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" }),
398
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Customer" }),
399
523
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
400
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Refund Amount" }),
524
+ /* @__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" }),
401
525
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
402
526
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
403
527
  ] }) }),
404
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((returnOrder) => /* @__PURE__ */ jsxRuntime.jsxs(
528
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((swap) => /* @__PURE__ */ jsxRuntime.jsxs(
405
529
  "tr",
406
530
  {
407
531
  className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
408
- onClick: () => navigate(`/returns/${returnOrder.id}`),
532
+ onClick: () => navigate(`/swaps/${swap.id}`),
409
533
  children: [
410
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-0.5", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: returnOrder.id }) }) }),
411
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.order_id }),
412
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.customer_email || returnOrder.order_email || "—" }),
534
+ /* @__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 }) }) }),
535
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: swap.order_id }),
413
536
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
414
537
  ui.Badge,
415
538
  {
416
539
  size: "2xsmall",
417
- className: `uppercase ${getStatusBadgeClass$2(returnOrder.status)}`,
418
- children: returnOrder.status.replace(/_/g, " ")
540
+ className: `uppercase ${getStatusBadgeClass$2(swap.status)}`,
541
+ children: swap.status.replace(/_/g, " ")
419
542
  }
420
543
  ) }),
421
544
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
422
- const amount = returnOrder.refund_amount;
545
+ const amount = swap.difference_due;
423
546
  if (amount == null || amount === void 0) {
424
547
  return "—";
425
548
  }
426
549
  const displayAmount = Number(amount) / 100;
427
- const currency = returnOrder.currency_code || "$";
428
- return `${currency}${displayAmount.toFixed(2)}`;
550
+ const currency = swap.currency_code || "$";
551
+ const sign = displayAmount >= 0 ? "+" : "";
552
+ return `${sign}${currency}${displayAmount.toFixed(2)}`;
429
553
  })() }),
430
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(returnOrder.created_at).toLocaleDateString("en-US", {
554
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(swap.created_at).toLocaleDateString("en-US", {
431
555
  year: "numeric",
432
556
  month: "short",
433
557
  day: "numeric",
@@ -442,14 +566,14 @@ const ReturnsPage = () => {
442
566
  size: "small",
443
567
  onClick: (e) => {
444
568
  e.stopPropagation();
445
- navigate(`/app/orders/${returnOrder.order_id}`);
569
+ navigate(`/app/orders/${swap.order_id}`);
446
570
  },
447
571
  children: "Go to order"
448
572
  }
449
573
  ) })
450
574
  ]
451
575
  },
452
- returnOrder.id
576
+ swap.id
453
577
  )) })
454
578
  ] }) }),
455
579
  hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -457,14 +581,14 @@ const ReturnsPage = () => {
457
581
  {
458
582
  variant: "secondary",
459
583
  isLoading: isFetchingMore,
460
- onClick: () => loadReturns(offset, false),
584
+ onClick: () => loadSwaps(offset, false),
461
585
  children: "Load more"
462
586
  }
463
587
  ) }) : null
464
588
  ] }) });
465
589
  };
466
590
  const config$2 = adminSdk.defineRouteConfig({
467
- label: "Return Orders",
591
+ label: "Exchanges",
468
592
  icon: icons.ArrowPath
469
593
  });
470
594
  const getStatusBadgeClass$1 = (status) => {
@@ -478,109 +602,105 @@ const getStatusBadgeClass$1 = (status) => {
478
602
  if (statusLower === "rejected") {
479
603
  return "bg-ui-tag-red-bg text-ui-tag-red-text";
480
604
  }
605
+ if (statusLower === "received") {
606
+ return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
607
+ }
608
+ if (statusLower === "refunded") {
609
+ return "bg-ui-tag-green-bg text-ui-tag-green-text";
610
+ }
481
611
  if (statusLower === "completed") {
482
612
  return "bg-ui-tag-green-bg text-ui-tag-green-text";
483
613
  }
484
- if (statusLower === "cancelled" || statusLower === "canceled") {
614
+ if (statusLower === "cancelled") {
485
615
  return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
486
616
  }
487
- if (statusLower === "pending") {
488
- return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
489
- }
490
617
  return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
491
618
  };
492
- const SwapDetailPage = () => {
493
- var _a, _b, _c;
619
+ const ReturnDetailPage = () => {
620
+ var _a, _b;
494
621
  const navigate = reactRouterDom.useNavigate();
495
622
  const { id } = reactRouterDom.useParams();
496
- const [swap, setSwap] = react.useState(null);
497
- const [order, setOrder] = react.useState(null);
623
+ const [returnOrder, setReturnOrder] = react.useState(null);
498
624
  const [isLoading, setIsLoading] = react.useState(true);
499
- react.useState(false);
500
- const [isCancelling, setIsCancelling] = react.useState(false);
625
+ const [isRejecting, setIsRejecting] = react.useState(false);
501
626
  const [error, setError] = react.useState(null);
502
627
  const [updateError, setUpdateError] = react.useState(null);
503
628
  const [updateSuccess, setUpdateSuccess] = react.useState(false);
504
629
  react.useEffect(() => {
505
630
  if (!id) {
506
- navigate("/swaps");
631
+ navigate("/returns");
507
632
  return;
508
633
  }
509
- const loadSwap = async () => {
634
+ const loadReturn = async () => {
510
635
  try {
511
636
  setIsLoading(true);
512
637
  setError(null);
513
- const response = await fetch(`/admin/swaps/${id}`, {
638
+ const response = await fetch(`/admin/returns/${id}`, {
514
639
  credentials: "include"
515
640
  });
516
641
  if (!response.ok) {
517
642
  const message = await response.text();
518
- throw new Error(message || "Unable to load swap");
643
+ throw new Error(message || "Unable to load return order");
519
644
  }
520
645
  const payload = await response.json();
521
- setSwap(payload.swap);
522
- setOrder(payload.order || null);
646
+ setReturnOrder(payload.return);
523
647
  } catch (loadError) {
524
- const message = loadError instanceof Error ? loadError.message : "Unable to load swap";
648
+ const message = loadError instanceof Error ? loadError.message : "Unable to load return order";
525
649
  setError(message);
526
650
  } finally {
527
651
  setIsLoading(false);
528
652
  }
529
653
  };
530
- void loadSwap();
654
+ void loadReturn();
531
655
  }, [id, navigate]);
532
- const handleCancelExchange = async () => {
656
+ const handleReject = async () => {
533
657
  if (!id) {
534
658
  return;
535
659
  }
536
660
  try {
537
- setIsCancelling(true);
661
+ setIsRejecting(true);
538
662
  setUpdateError(null);
539
663
  setUpdateSuccess(false);
540
- const response = await fetch(`/admin/swaps/${id}/cancel`, {
664
+ const response = await fetch(`/admin/returns/${id}/reject`, {
541
665
  method: "POST",
542
666
  headers: {
543
667
  "Content-Type": "application/json"
544
668
  },
545
- credentials: "include"
669
+ credentials: "include",
670
+ body: JSON.stringify({ reason: "Rejected by admin" })
546
671
  });
547
672
  if (!response.ok) {
548
673
  const message = await response.text();
549
- throw new Error(message || "Unable to cancel exchange");
674
+ throw new Error(message || "Unable to reject return");
550
675
  }
551
676
  const payload = await response.json();
552
- setSwap(payload.swap);
677
+ setReturnOrder(payload.return);
553
678
  setUpdateSuccess(true);
554
679
  setTimeout(() => setUpdateSuccess(false), 3e3);
555
- const detailResponse = await fetch(`/admin/swaps/${id}`, {
680
+ const detailResponse = await fetch(`/admin/returns/${id}`, {
556
681
  credentials: "include"
557
682
  });
558
683
  if (detailResponse.ok) {
559
684
  const detailPayload = await detailResponse.json();
560
- setSwap(detailPayload.swap);
561
- setOrder(detailPayload.order || null);
685
+ setReturnOrder(detailPayload.return);
562
686
  }
563
- } catch (cancelErr) {
564
- const message = cancelErr instanceof Error ? cancelErr.message : "Unable to cancel exchange";
687
+ } catch (updateErr) {
688
+ const message = updateErr instanceof Error ? updateErr.message : "Unable to reject return";
565
689
  setUpdateError(message);
566
690
  } finally {
567
- setIsCancelling(false);
691
+ setIsRejecting(false);
568
692
  }
569
693
  };
570
- const isOrderExchange = Boolean(swap == null ? void 0 : swap.exchange_id);
571
- const canCancelExchange = isOrderExchange && swap && !["cancelled", "canceled", "completed", "declined"].includes(
572
- ((_a = swap.status) == null ? void 0 : _a.toLowerCase()) ?? ""
573
- );
574
694
  if (isLoading) {
575
- 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..." }) }) }) });
695
+ 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..." }) }) }) });
576
696
  }
577
- if (error || !swap) {
697
+ if (error || !returnOrder) {
578
698
  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: [
579
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Swap not found" }),
580
- /* @__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" }) })
699
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Return order not found" }),
700
+ /* @__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" }) })
581
701
  ] }) }) });
582
702
  }
583
- const statusHistory = ((_b = swap.metadata) == null ? void 0 : _b.status_history) || [];
703
+ const statusHistory = ((_a = returnOrder.metadata) == null ? void 0 : _a.status_history) || [];
584
704
  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: [
585
705
  /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3", children: [
586
706
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -588,7 +708,7 @@ const SwapDetailPage = () => {
588
708
  {
589
709
  variant: "transparent",
590
710
  size: "small",
591
- onClick: () => navigate("/swaps"),
711
+ onClick: () => navigate("/returns"),
592
712
  className: "w-fit",
593
713
  children: [
594
714
  /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, { className: "mr-2" }),
@@ -598,67 +718,81 @@ const SwapDetailPage = () => {
598
718
  ),
599
719
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
600
720
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
601
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Exchange Details" }),
602
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: swap.id })
721
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Return Order Details" }),
722
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: returnOrder.id })
603
723
  ] }),
604
724
  /* @__PURE__ */ jsxRuntime.jsx(
605
725
  ui.Badge,
606
726
  {
607
727
  size: "small",
608
- className: `uppercase ${getStatusBadgeClass$1(swap.status)}`,
609
- children: swap.status.replace(/_/g, " ")
728
+ className: `uppercase ${getStatusBadgeClass$1(returnOrder.status)}`,
729
+ children: returnOrder.status.replace(/_/g, " ")
610
730
  }
611
731
  )
612
732
  ] })
613
733
  ] }),
614
- canCancelExchange && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
734
+ returnOrder.status === "requested" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
615
735
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsx(
616
736
  ui.Button,
617
737
  {
618
738
  variant: "danger",
619
- onClick: handleCancelExchange,
620
- disabled: isCancelling,
621
- isLoading: isCancelling,
622
- children: "Cancel Exchange"
739
+ onClick: handleReject,
740
+ disabled: isRejecting,
741
+ isLoading: isRejecting,
742
+ children: "Reject (Cancel) Return"
623
743
  }
624
744
  ) }),
625
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This will cancel the exchange request. The order will remain unchanged." })
745
+ /* @__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.' })
746
+ ] }),
747
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
748
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Information" }),
749
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
750
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
751
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
752
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.id })
753
+ ] }),
754
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
755
+ ui.Button,
756
+ {
757
+ variant: "secondary",
758
+ onClick: () => {
759
+ window.open(
760
+ `/app/orders/${returnOrder.order_id}`,
761
+ "_blank"
762
+ );
763
+ },
764
+ children: "View order"
765
+ }
766
+ ) })
767
+ ] })
626
768
  ] }),
627
769
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
628
770
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
629
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Exchange Information" }),
771
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Details" }),
630
772
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
631
773
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
632
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
633
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.id })
774
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
775
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.id })
634
776
  ] }),
635
777
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
636
778
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
637
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.status })
638
- ] }),
639
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
640
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Difference Due" }),
641
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.difference_due != null ? `${swap.currency_code || "$"}${(Number(swap.difference_due) / 100).toFixed(2)}` : "—" })
779
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.status })
642
780
  ] }),
643
- swap.reason && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
781
+ returnOrder.reason && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
644
782
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
645
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.reason })
783
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.reason })
646
784
  ] }),
647
- swap.note && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
785
+ returnOrder.note && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
648
786
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
649
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.note })
787
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.note })
650
788
  ] }),
651
789
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
652
790
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
653
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(swap.created_at).toLocaleString() })
791
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(returnOrder.created_at).toLocaleString() })
654
792
  ] }),
655
793
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
656
794
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
657
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(swap.updated_at).toLocaleString() })
658
- ] }),
659
- swap.exchange_id && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
660
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
661
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.exchange_id })
795
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(returnOrder.updated_at).toLocaleString() })
662
796
  ] })
663
797
  ] })
664
798
  ] }),
@@ -688,31 +822,31 @@ const SwapDetailPage = () => {
688
822
  )) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
689
823
  ] })
690
824
  ] }),
691
- order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
825
+ returnOrder.order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
692
826
  /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
693
827
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
694
828
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
695
829
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
696
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.id })
830
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.id })
697
831
  ] }),
698
832
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
699
833
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
700
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.status || "—" })
834
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.status || "—" })
701
835
  ] }),
702
836
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
703
837
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
704
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_c = order.customer) == null ? void 0 : _c.email) || order.email || "—" })
838
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_b = returnOrder.order.customer) == null ? void 0 : _b.email) || returnOrder.order.email || "—" })
705
839
  ] }),
706
- order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
840
+ returnOrder.order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
707
841
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
708
842
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "font-medium", children: [
709
- order.currency_code || "$",
710
- (Number(order.total) / 100).toFixed(2)
843
+ returnOrder.order.currency_code || "$",
844
+ (Number(returnOrder.order.total) / 100).toFixed(2)
711
845
  ] })
712
846
  ] })
713
847
  ] })
714
848
  ] }),
715
- 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: [
849
+ 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: [
716
850
  /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
717
851
  /* @__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: [
718
852
  /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
@@ -720,31 +854,20 @@ const SwapDetailPage = () => {
720
854
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
721
855
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
722
856
  ] }) }),
723
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.return_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
857
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: returnOrder.return_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
724
858
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
725
859
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
726
860
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
727
861
  ] }, item.id || index)) })
728
862
  ] }) })
729
863
  ] }),
730
- 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: [
731
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "New Items" }),
732
- /* @__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: [
733
- /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
734
- /* @__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" }),
735
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
736
- ] }) }),
737
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.new_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
738
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.variant_id }),
739
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
740
- ] }, item.variant_id || index)) })
741
- ] }) })
742
- ] })
864
+ 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 }) }),
865
+ 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" }) })
743
866
  ] }) });
744
867
  };
745
868
  const config$1 = adminSdk.defineRouteConfig({
746
- label: "Swap Details",
747
- icon: icons.ArrowPath
869
+ label: "Return Order Details",
870
+ icon: icons.CheckCircle
748
871
  });
749
872
  const getStatusBadgeClass = (status) => {
750
873
  const statusLower = status.toLowerCase();
@@ -757,105 +880,109 @@ const getStatusBadgeClass = (status) => {
757
880
  if (statusLower === "rejected") {
758
881
  return "bg-ui-tag-red-bg text-ui-tag-red-text";
759
882
  }
760
- if (statusLower === "received") {
761
- return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
762
- }
763
- if (statusLower === "refunded") {
764
- return "bg-ui-tag-green-bg text-ui-tag-green-text";
765
- }
766
883
  if (statusLower === "completed") {
767
884
  return "bg-ui-tag-green-bg text-ui-tag-green-text";
768
885
  }
769
- if (statusLower === "cancelled") {
886
+ if (statusLower === "cancelled" || statusLower === "canceled") {
770
887
  return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
771
888
  }
889
+ if (statusLower === "pending") {
890
+ return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
891
+ }
772
892
  return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
773
893
  };
774
- const ReturnDetailPage = () => {
775
- var _a, _b;
894
+ const SwapDetailPage = () => {
895
+ var _a, _b, _c;
776
896
  const navigate = reactRouterDom.useNavigate();
777
897
  const { id } = reactRouterDom.useParams();
778
- const [returnOrder, setReturnOrder] = react.useState(null);
898
+ const [swap, setSwap] = react.useState(null);
899
+ const [order, setOrder] = react.useState(null);
779
900
  const [isLoading, setIsLoading] = react.useState(true);
780
- const [isRejecting, setIsRejecting] = react.useState(false);
901
+ react.useState(false);
902
+ const [isCancelling, setIsCancelling] = react.useState(false);
781
903
  const [error, setError] = react.useState(null);
782
904
  const [updateError, setUpdateError] = react.useState(null);
783
905
  const [updateSuccess, setUpdateSuccess] = react.useState(false);
784
906
  react.useEffect(() => {
785
907
  if (!id) {
786
- navigate("/returns");
908
+ navigate("/swaps");
787
909
  return;
788
910
  }
789
- const loadReturn = async () => {
911
+ const loadSwap = async () => {
790
912
  try {
791
913
  setIsLoading(true);
792
914
  setError(null);
793
- const response = await fetch(`/admin/returns/${id}`, {
915
+ const response = await fetch(`/admin/swaps/${id}`, {
794
916
  credentials: "include"
795
917
  });
796
918
  if (!response.ok) {
797
919
  const message = await response.text();
798
- throw new Error(message || "Unable to load return order");
920
+ throw new Error(message || "Unable to load swap");
799
921
  }
800
922
  const payload = await response.json();
801
- setReturnOrder(payload.return);
923
+ setSwap(payload.swap);
924
+ setOrder(payload.order || null);
802
925
  } catch (loadError) {
803
- const message = loadError instanceof Error ? loadError.message : "Unable to load return order";
926
+ const message = loadError instanceof Error ? loadError.message : "Unable to load swap";
804
927
  setError(message);
805
928
  } finally {
806
929
  setIsLoading(false);
807
930
  }
808
931
  };
809
- void loadReturn();
932
+ void loadSwap();
810
933
  }, [id, navigate]);
811
- const handleReject = async () => {
934
+ const handleCancelExchange = async () => {
812
935
  if (!id) {
813
936
  return;
814
937
  }
815
938
  try {
816
- setIsRejecting(true);
939
+ setIsCancelling(true);
817
940
  setUpdateError(null);
818
941
  setUpdateSuccess(false);
819
- const response = await fetch(`/admin/returns/${id}/reject`, {
942
+ const response = await fetch(`/admin/swaps/${id}/cancel`, {
820
943
  method: "POST",
821
944
  headers: {
822
945
  "Content-Type": "application/json"
823
946
  },
824
- credentials: "include",
825
- body: JSON.stringify({ reason: "Rejected by admin" })
947
+ credentials: "include"
826
948
  });
827
949
  if (!response.ok) {
828
950
  const message = await response.text();
829
- throw new Error(message || "Unable to reject return");
951
+ throw new Error(message || "Unable to cancel exchange");
830
952
  }
831
953
  const payload = await response.json();
832
- setReturnOrder(payload.return);
954
+ setSwap(payload.swap);
833
955
  setUpdateSuccess(true);
834
956
  setTimeout(() => setUpdateSuccess(false), 3e3);
835
- const detailResponse = await fetch(`/admin/returns/${id}`, {
957
+ const detailResponse = await fetch(`/admin/swaps/${id}`, {
836
958
  credentials: "include"
837
959
  });
838
960
  if (detailResponse.ok) {
839
961
  const detailPayload = await detailResponse.json();
840
- setReturnOrder(detailPayload.return);
962
+ setSwap(detailPayload.swap);
963
+ setOrder(detailPayload.order || null);
841
964
  }
842
- } catch (updateErr) {
843
- const message = updateErr instanceof Error ? updateErr.message : "Unable to reject return";
965
+ } catch (cancelErr) {
966
+ const message = cancelErr instanceof Error ? cancelErr.message : "Unable to cancel exchange";
844
967
  setUpdateError(message);
845
968
  } finally {
846
- setIsRejecting(false);
969
+ setIsCancelling(false);
847
970
  }
848
971
  };
972
+ const isOrderExchange = Boolean(swap == null ? void 0 : swap.exchange_id);
973
+ const canCancelExchange = isOrderExchange && swap && !["cancelled", "canceled", "completed", "declined"].includes(
974
+ ((_a = swap.status) == null ? void 0 : _a.toLowerCase()) ?? ""
975
+ );
849
976
  if (isLoading) {
850
- 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..." }) }) }) });
977
+ 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..." }) }) }) });
851
978
  }
852
- if (error || !returnOrder) {
979
+ if (error || !swap) {
853
980
  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: [
854
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Return order not found" }),
855
- /* @__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" }) })
981
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Swap not found" }),
982
+ /* @__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" }) })
856
983
  ] }) }) });
857
984
  }
858
- const statusHistory = ((_a = returnOrder.metadata) == null ? void 0 : _a.status_history) || [];
985
+ const statusHistory = ((_b = swap.metadata) == null ? void 0 : _b.status_history) || [];
859
986
  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: [
860
987
  /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3", children: [
861
988
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -863,7 +990,7 @@ const ReturnDetailPage = () => {
863
990
  {
864
991
  variant: "transparent",
865
992
  size: "small",
866
- onClick: () => navigate("/returns"),
993
+ onClick: () => navigate("/swaps"),
867
994
  className: "w-fit",
868
995
  children: [
869
996
  /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, { className: "mr-2" }),
@@ -873,81 +1000,67 @@ const ReturnDetailPage = () => {
873
1000
  ),
874
1001
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
875
1002
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
876
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Return Order Details" }),
877
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: returnOrder.id })
1003
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Exchange Details" }),
1004
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: swap.id })
878
1005
  ] }),
879
1006
  /* @__PURE__ */ jsxRuntime.jsx(
880
1007
  ui.Badge,
881
1008
  {
882
1009
  size: "small",
883
- className: `uppercase ${getStatusBadgeClass(returnOrder.status)}`,
884
- children: returnOrder.status.replace(/_/g, " ")
1010
+ className: `uppercase ${getStatusBadgeClass(swap.status)}`,
1011
+ children: swap.status.replace(/_/g, " ")
885
1012
  }
886
1013
  )
887
1014
  ] })
888
1015
  ] }),
889
- returnOrder.status === "requested" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
1016
+ canCancelExchange && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
890
1017
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsx(
891
1018
  ui.Button,
892
1019
  {
893
1020
  variant: "danger",
894
- onClick: handleReject,
895
- disabled: isRejecting,
896
- isLoading: isRejecting,
897
- children: "Reject (Cancel) Return"
1021
+ onClick: handleCancelExchange,
1022
+ disabled: isCancelling,
1023
+ isLoading: isCancelling,
1024
+ children: "Cancel Exchange"
898
1025
  }
899
1026
  ) }),
900
- /* @__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.' })
901
- ] }),
902
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
903
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Information" }),
904
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
905
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
906
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
907
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.id })
908
- ] }),
909
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
910
- ui.Button,
911
- {
912
- variant: "secondary",
913
- onClick: () => {
914
- window.open(
915
- `/app/orders/${returnOrder.order_id}`,
916
- "_blank"
917
- );
918
- },
919
- children: "View order"
920
- }
921
- ) })
922
- ] })
1027
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "This will cancel the exchange request. The order will remain unchanged." })
923
1028
  ] }),
924
1029
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
925
1030
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
926
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Details" }),
1031
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Exchange Information" }),
927
1032
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
928
1033
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
929
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
930
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.id })
1034
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
1035
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.id })
931
1036
  ] }),
932
1037
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
933
1038
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
934
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.status })
1039
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.status })
935
1040
  ] }),
936
- returnOrder.reason && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1041
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1042
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Difference Due" }),
1043
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.difference_due != null ? `${swap.currency_code || "$"}${(Number(swap.difference_due) / 100).toFixed(2)}` : "—" })
1044
+ ] }),
1045
+ swap.reason && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
937
1046
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
938
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.reason })
1047
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.reason })
939
1048
  ] }),
940
- returnOrder.note && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1049
+ swap.note && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
941
1050
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
942
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.note })
1051
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.note })
943
1052
  ] }),
944
1053
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
945
1054
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
946
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(returnOrder.created_at).toLocaleString() })
1055
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(swap.created_at).toLocaleString() })
947
1056
  ] }),
948
1057
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
949
1058
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
950
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(returnOrder.updated_at).toLocaleString() })
1059
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(swap.updated_at).toLocaleString() })
1060
+ ] }),
1061
+ swap.exchange_id && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1062
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
1063
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.exchange_id })
951
1064
  ] })
952
1065
  ] })
953
1066
  ] }),
@@ -977,31 +1090,31 @@ const ReturnDetailPage = () => {
977
1090
  )) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
978
1091
  ] })
979
1092
  ] }),
980
- returnOrder.order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
1093
+ order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
981
1094
  /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
982
1095
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
983
1096
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
984
1097
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
985
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.id })
1098
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.id })
986
1099
  ] }),
987
1100
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
988
1101
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
989
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.status || "—" })
1102
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.status || "—" })
990
1103
  ] }),
991
1104
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
992
1105
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
993
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_b = returnOrder.order.customer) == null ? void 0 : _b.email) || returnOrder.order.email || "—" })
1106
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_c = order.customer) == null ? void 0 : _c.email) || order.email || "—" })
994
1107
  ] }),
995
- returnOrder.order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1108
+ order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
996
1109
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
997
1110
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "font-medium", children: [
998
- returnOrder.order.currency_code || "$",
999
- (Number(returnOrder.order.total) / 100).toFixed(2)
1111
+ order.currency_code || "$",
1112
+ (Number(order.total) / 100).toFixed(2)
1000
1113
  ] })
1001
1114
  ] })
1002
1115
  ] })
1003
1116
  ] }),
1004
- 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: [
1117
+ 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: [
1005
1118
  /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
1006
1119
  /* @__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: [
1007
1120
  /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
@@ -1009,66 +1122,82 @@ const ReturnDetailPage = () => {
1009
1122
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
1010
1123
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
1011
1124
  ] }) }),
1012
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: returnOrder.return_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
1125
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.return_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
1013
1126
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
1014
1127
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
1015
1128
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
1016
1129
  ] }, item.id || index)) })
1017
1130
  ] }) })
1018
1131
  ] }),
1019
- 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 }) }),
1020
- 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" }) })
1132
+ 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: [
1133
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "New Items" }),
1134
+ /* @__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: [
1135
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
1136
+ /* @__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" }),
1137
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
1138
+ ] }) }),
1139
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.new_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
1140
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.variant_id }),
1141
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
1142
+ ] }, item.variant_id || index)) })
1143
+ ] }) })
1144
+ ] })
1021
1145
  ] }) });
1022
1146
  };
1023
1147
  const config = adminSdk.defineRouteConfig({
1024
- label: "Return Order Details",
1025
- icon: icons.CheckCircle
1148
+ label: "Swap Details",
1149
+ icon: icons.ArrowPath
1026
1150
  });
1027
1151
  const i18nTranslations0 = {};
1028
- const widgetModule = { widgets: [] };
1152
+ const widgetModule = { widgets: [
1153
+ {
1154
+ Component: OrderRefundContextWidget,
1155
+ zone: ["order.details.after"]
1156
+ }
1157
+ ] };
1029
1158
  const routeModule = {
1030
1159
  routes: [
1031
- {
1032
- Component: SwapsPage,
1033
- path: "/swaps"
1034
- },
1035
1160
  {
1036
1161
  Component: ReturnsPage,
1037
1162
  path: "/returns"
1038
1163
  },
1039
1164
  {
1040
- Component: SwapDetailPage,
1041
- path: "/swaps/:id"
1165
+ Component: SwapsPage,
1166
+ path: "/swaps"
1042
1167
  },
1043
1168
  {
1044
1169
  Component: ReturnDetailPage,
1045
1170
  path: "/returns/:id"
1171
+ },
1172
+ {
1173
+ Component: SwapDetailPage,
1174
+ path: "/swaps/:id"
1046
1175
  }
1047
1176
  ]
1048
1177
  };
1049
1178
  const menuItemModule = {
1050
1179
  menuItems: [
1051
1180
  {
1052
- label: config$2.label,
1053
- icon: config$2.icon,
1181
+ label: config$3.label,
1182
+ icon: config$3.icon,
1054
1183
  path: "/returns",
1055
1184
  nested: void 0
1056
1185
  },
1057
1186
  {
1058
- label: config$3.label,
1059
- icon: config$3.icon,
1187
+ label: config$2.label,
1188
+ icon: config$2.icon,
1060
1189
  path: "/swaps",
1061
1190
  nested: void 0
1062
1191
  },
1063
1192
  {
1064
- label: config.label,
1065
- icon: config.icon,
1193
+ label: config$1.label,
1194
+ icon: config$1.icon,
1066
1195
  path: "/returns/:id",
1067
1196
  nested: void 0
1068
1197
  },
1069
1198
  {
1070
- label: config$1.label,
1071
- icon: config$1.icon,
1199
+ label: config.label,
1200
+ icon: config.icon,
1072
1201
  path: "/swaps/:id",
1073
1202
  nested: void 0
1074
1203
  }