order-management 0.0.22 → 0.0.24

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.
@@ -18,21 +18,21 @@ const getStatusBadgeClass$3 = (status) => {
18
18
  if (statusLower === "requested") {
19
19
  return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
20
20
  }
21
- if (statusLower === "received") {
21
+ if (statusLower === "approved") {
22
22
  return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
23
23
  }
24
- if (statusLower === "requires_action") {
24
+ if (statusLower === "rejected") {
25
25
  return "bg-ui-tag-red-bg text-ui-tag-red-text";
26
26
  }
27
27
  if (statusLower === "completed") {
28
28
  return "bg-ui-tag-green-bg text-ui-tag-green-text";
29
29
  }
30
- if (statusLower === "canceled") {
30
+ if (statusLower === "cancelled") {
31
31
  return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
32
32
  }
33
33
  return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
34
34
  };
35
- const ReturnsPage = () => {
35
+ const SwapsPage = () => {
36
36
  const navigate = reactRouterDom.useNavigate();
37
37
  const [items, setItems] = react.useState([]);
38
38
  const [statusFilter, setStatusFilter] = react.useState("all");
@@ -44,7 +44,7 @@ const ReturnsPage = () => {
44
44
  const [offset, setOffset] = react.useState(0);
45
45
  const [count, setCount] = react.useState(0);
46
46
  const limit = 50;
47
- const loadReturns = react.useCallback(
47
+ const loadSwaps = react.useCallback(
48
48
  async (nextOffset, replace = false) => {
49
49
  var _a;
50
50
  try {
@@ -61,25 +61,24 @@ const ReturnsPage = () => {
61
61
  params.set("status", statusFilter);
62
62
  }
63
63
  if (debouncedSearchQuery.trim()) {
64
- params.set("q", debouncedSearchQuery.trim());
64
+ params.set("order_id", debouncedSearchQuery.trim());
65
65
  }
66
- params.set("order", "created_at");
67
66
  const response = await fetch(
68
- `/admin/returns?${params.toString()}`,
67
+ `/admin/swaps?${params.toString()}`,
69
68
  { credentials: "include" }
70
69
  );
71
70
  if (!response.ok) {
72
71
  const message = await response.text();
73
- throw new Error(message || "Unable to load return orders");
72
+ throw new Error(message || "Unable to load swaps");
74
73
  }
75
74
  const payload = await response.json();
76
75
  setCount(payload.count ?? 0);
77
- setOffset(nextOffset + (((_a = payload.returns) == null ? void 0 : _a.length) ?? 0));
76
+ setOffset(nextOffset + (((_a = payload.swaps) == null ? void 0 : _a.length) ?? 0));
78
77
  setItems(
79
- (prev) => replace ? payload.returns ?? [] : [...prev, ...payload.returns ?? []]
78
+ (prev) => replace ? payload.swaps ?? [] : [...prev, ...payload.swaps ?? []]
80
79
  );
81
80
  } catch (loadError) {
82
- const message = loadError instanceof Error ? loadError.message : "Unable to load return orders";
81
+ const message = loadError instanceof Error ? loadError.message : "Unable to load swaps";
83
82
  setError(message);
84
83
  } finally {
85
84
  setIsLoading(false);
@@ -89,8 +88,8 @@ const ReturnsPage = () => {
89
88
  [statusFilter, debouncedSearchQuery]
90
89
  );
91
90
  react.useEffect(() => {
92
- void loadReturns(0, true);
93
- }, [statusFilter, debouncedSearchQuery, loadReturns]);
91
+ void loadSwaps(0, true);
92
+ }, [statusFilter, debouncedSearchQuery, loadSwaps]);
94
93
  const hasMore = react.useMemo(() => offset < count, [offset, count]);
95
94
  const availableStatuses = react.useMemo(() => {
96
95
  const statuses = /* @__PURE__ */ new Set();
@@ -100,16 +99,16 @@ const ReturnsPage = () => {
100
99
  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: [
101
100
  /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
102
101
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
103
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Return Orders" }),
104
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer return orders" })
102
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Swaps" }),
103
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer swap requests" })
105
104
  ] }),
106
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadReturns(0, true), children: "Refresh" })
105
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadSwaps(0, true), children: "Refresh" })
107
106
  ] }),
108
107
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
109
108
  /* @__PURE__ */ jsxRuntime.jsx(
110
109
  ui.Input,
111
110
  {
112
- placeholder: "Search by return ID, order ID, or customer email",
111
+ placeholder: "Search by swap ID or order ID",
113
112
  value: searchQuery,
114
113
  onChange: (event) => setSearchQuery(event.target.value),
115
114
  className: "md:max-w-sm"
@@ -134,51 +133,50 @@ const ReturnsPage = () => {
134
133
  ui.Button,
135
134
  {
136
135
  variant: "secondary",
137
- onClick: () => loadReturns(0, true),
136
+ onClick: () => loadSwaps(0, true),
138
137
  children: "Try again"
139
138
  }
140
139
  ) })
141
140
  ] }) : null,
142
- 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: [
143
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No return orders yet" }),
144
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Return orders created by customers will appear here." })
141
+ 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: [
142
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No swaps yet" }),
143
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Swap requests created by customers will appear here." })
145
144
  ] }) : /* @__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: [
146
145
  /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
147
- /* @__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" }),
146
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Swap ID" }),
148
147
  /* @__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" }),
149
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Customer" }),
150
148
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
151
- /* @__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" }),
149
+ /* @__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" }),
152
150
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
153
151
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
154
152
  ] }) }),
155
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((returnOrder) => /* @__PURE__ */ jsxRuntime.jsxs(
153
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((swap) => /* @__PURE__ */ jsxRuntime.jsxs(
156
154
  "tr",
157
155
  {
158
156
  className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
159
- onClick: () => navigate(`/returns/${returnOrder.id}`),
157
+ onClick: () => navigate(`/swaps/${swap.id}`),
160
158
  children: [
161
- /* @__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 }) }) }),
162
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.order_id }),
163
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.customer_email || returnOrder.order_email || "—" }),
159
+ /* @__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 }) }) }),
160
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: swap.order_id }),
164
161
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
165
162
  ui.Badge,
166
163
  {
167
164
  size: "2xsmall",
168
- className: `uppercase ${getStatusBadgeClass$3(returnOrder.status)}`,
169
- children: returnOrder.status.replace(/_/g, " ")
165
+ className: `uppercase ${getStatusBadgeClass$3(swap.status)}`,
166
+ children: swap.status.replace(/_/g, " ")
170
167
  }
171
168
  ) }),
172
169
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
173
- const amount = returnOrder.refund_amount;
170
+ const amount = swap.difference_due;
174
171
  if (amount == null || amount === void 0) {
175
172
  return "—";
176
173
  }
177
174
  const displayAmount = Number(amount) / 100;
178
- const currency = returnOrder.currency_code || "$";
179
- return `${currency}${displayAmount.toFixed(2)}`;
175
+ const currency = swap.currency_code || "$";
176
+ const sign = displayAmount >= 0 ? "+" : "";
177
+ return `${sign}${currency}${displayAmount.toFixed(2)}`;
180
178
  })() }),
181
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(returnOrder.created_at).toLocaleDateString("en-US", {
179
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(swap.created_at).toLocaleDateString("en-US", {
182
180
  year: "numeric",
183
181
  month: "short",
184
182
  day: "numeric",
@@ -193,14 +191,14 @@ const ReturnsPage = () => {
193
191
  size: "small",
194
192
  onClick: (e) => {
195
193
  e.stopPropagation();
196
- navigate(`/returns/${returnOrder.id}`);
194
+ navigate(`/swaps/${swap.id}`);
197
195
  },
198
196
  children: "View"
199
197
  }
200
198
  ) })
201
199
  ]
202
200
  },
203
- returnOrder.id
201
+ swap.id
204
202
  )) })
205
203
  ] }) }),
206
204
  hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -208,14 +206,14 @@ const ReturnsPage = () => {
208
206
  {
209
207
  variant: "secondary",
210
208
  isLoading: isFetchingMore,
211
- onClick: () => loadReturns(offset, false),
209
+ onClick: () => loadSwaps(offset, false),
212
210
  children: "Load more"
213
211
  }
214
212
  ) }) : null
215
213
  ] }) });
216
214
  };
217
215
  const config$3 = adminSdk.defineRouteConfig({
218
- label: "Return Orders",
216
+ label: "Swaps",
219
217
  icon: icons.ArrowPath
220
218
  });
221
219
  const useDebounce = (value, delay) => {
@@ -231,21 +229,21 @@ const getStatusBadgeClass$2 = (status) => {
231
229
  if (statusLower === "requested") {
232
230
  return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
233
231
  }
234
- if (statusLower === "approved") {
232
+ if (statusLower === "received") {
235
233
  return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
236
234
  }
237
- if (statusLower === "rejected") {
235
+ if (statusLower === "requires_action") {
238
236
  return "bg-ui-tag-red-bg text-ui-tag-red-text";
239
237
  }
240
238
  if (statusLower === "completed") {
241
239
  return "bg-ui-tag-green-bg text-ui-tag-green-text";
242
240
  }
243
- if (statusLower === "cancelled") {
241
+ if (statusLower === "canceled") {
244
242
  return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
245
243
  }
246
244
  return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
247
245
  };
248
- const SwapsPage = () => {
246
+ const ReturnsPage = () => {
249
247
  const navigate = reactRouterDom.useNavigate();
250
248
  const [items, setItems] = react.useState([]);
251
249
  const [statusFilter, setStatusFilter] = react.useState("all");
@@ -257,7 +255,7 @@ const SwapsPage = () => {
257
255
  const [offset, setOffset] = react.useState(0);
258
256
  const [count, setCount] = react.useState(0);
259
257
  const limit = 50;
260
- const loadSwaps = react.useCallback(
258
+ const loadReturns = react.useCallback(
261
259
  async (nextOffset, replace = false) => {
262
260
  var _a;
263
261
  try {
@@ -274,24 +272,25 @@ const SwapsPage = () => {
274
272
  params.set("status", statusFilter);
275
273
  }
276
274
  if (debouncedSearchQuery.trim()) {
277
- params.set("order_id", debouncedSearchQuery.trim());
275
+ params.set("q", debouncedSearchQuery.trim());
278
276
  }
277
+ params.set("order", "created_at");
279
278
  const response = await fetch(
280
- `/admin/swaps?${params.toString()}`,
279
+ `/admin/returns?${params.toString()}`,
281
280
  { credentials: "include" }
282
281
  );
283
282
  if (!response.ok) {
284
283
  const message = await response.text();
285
- throw new Error(message || "Unable to load swaps");
284
+ throw new Error(message || "Unable to load return orders");
286
285
  }
287
286
  const payload = await response.json();
288
287
  setCount(payload.count ?? 0);
289
- setOffset(nextOffset + (((_a = payload.swaps) == null ? void 0 : _a.length) ?? 0));
288
+ setOffset(nextOffset + (((_a = payload.returns) == null ? void 0 : _a.length) ?? 0));
290
289
  setItems(
291
- (prev) => replace ? payload.swaps ?? [] : [...prev, ...payload.swaps ?? []]
290
+ (prev) => replace ? payload.returns ?? [] : [...prev, ...payload.returns ?? []]
292
291
  );
293
292
  } catch (loadError) {
294
- const message = loadError instanceof Error ? loadError.message : "Unable to load swaps";
293
+ const message = loadError instanceof Error ? loadError.message : "Unable to load return orders";
295
294
  setError(message);
296
295
  } finally {
297
296
  setIsLoading(false);
@@ -301,8 +300,8 @@ const SwapsPage = () => {
301
300
  [statusFilter, debouncedSearchQuery]
302
301
  );
303
302
  react.useEffect(() => {
304
- void loadSwaps(0, true);
305
- }, [statusFilter, debouncedSearchQuery, loadSwaps]);
303
+ void loadReturns(0, true);
304
+ }, [statusFilter, debouncedSearchQuery, loadReturns]);
306
305
  const hasMore = react.useMemo(() => offset < count, [offset, count]);
307
306
  const availableStatuses = react.useMemo(() => {
308
307
  const statuses = /* @__PURE__ */ new Set();
@@ -312,16 +311,16 @@ const SwapsPage = () => {
312
311
  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: [
313
312
  /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
314
313
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
315
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Swaps" }),
316
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer swap requests" })
314
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Return Orders" }),
315
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer return orders" })
317
316
  ] }),
318
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadSwaps(0, true), children: "Refresh" })
317
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadReturns(0, true), children: "Refresh" })
319
318
  ] }),
320
319
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
321
320
  /* @__PURE__ */ jsxRuntime.jsx(
322
321
  ui.Input,
323
322
  {
324
- placeholder: "Search by swap ID or order ID",
323
+ placeholder: "Search by return ID, order ID, or customer email",
325
324
  value: searchQuery,
326
325
  onChange: (event) => setSearchQuery(event.target.value),
327
326
  className: "md:max-w-sm"
@@ -346,50 +345,51 @@ const SwapsPage = () => {
346
345
  ui.Button,
347
346
  {
348
347
  variant: "secondary",
349
- onClick: () => loadSwaps(0, true),
348
+ onClick: () => loadReturns(0, true),
350
349
  children: "Try again"
351
350
  }
352
351
  ) })
353
352
  ] }) : null,
354
- 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: [
355
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No swaps yet" }),
356
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Swap requests created by customers will appear here." })
353
+ 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: [
354
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No return orders yet" }),
355
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Return orders created by customers will appear here." })
357
356
  ] }) : /* @__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: [
358
357
  /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
359
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Swap ID" }),
358
+ /* @__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" }),
360
359
  /* @__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" }),
360
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Customer" }),
361
361
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
362
- /* @__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" }),
362
+ /* @__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" }),
363
363
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
364
364
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
365
365
  ] }) }),
366
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((swap) => /* @__PURE__ */ jsxRuntime.jsxs(
366
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((returnOrder) => /* @__PURE__ */ jsxRuntime.jsxs(
367
367
  "tr",
368
368
  {
369
369
  className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
370
- onClick: () => navigate(`/swaps/${swap.id}`),
370
+ onClick: () => navigate(`/returns/${returnOrder.id}`),
371
371
  children: [
372
- /* @__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 }) }) }),
373
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: swap.order_id }),
372
+ /* @__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 }) }) }),
373
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.order_id }),
374
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.customer_email || returnOrder.order_email || "—" }),
374
375
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
375
376
  ui.Badge,
376
377
  {
377
378
  size: "2xsmall",
378
- className: `uppercase ${getStatusBadgeClass$2(swap.status)}`,
379
- children: swap.status.replace(/_/g, " ")
379
+ className: `uppercase ${getStatusBadgeClass$2(returnOrder.status)}`,
380
+ children: returnOrder.status.replace(/_/g, " ")
380
381
  }
381
382
  ) }),
382
383
  /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
383
- const amount = swap.difference_due;
384
+ const amount = returnOrder.refund_amount;
384
385
  if (amount == null || amount === void 0) {
385
386
  return "—";
386
387
  }
387
388
  const displayAmount = Number(amount) / 100;
388
- const currency = swap.currency_code || "$";
389
- const sign = displayAmount >= 0 ? "+" : "";
390
- return `${sign}${currency}${displayAmount.toFixed(2)}`;
389
+ const currency = returnOrder.currency_code || "$";
390
+ return `${currency}${displayAmount.toFixed(2)}`;
391
391
  })() }),
392
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(swap.created_at).toLocaleDateString("en-US", {
392
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(returnOrder.created_at).toLocaleDateString("en-US", {
393
393
  year: "numeric",
394
394
  month: "short",
395
395
  day: "numeric",
@@ -404,14 +404,14 @@ const SwapsPage = () => {
404
404
  size: "small",
405
405
  onClick: (e) => {
406
406
  e.stopPropagation();
407
- navigate(`/swaps/${swap.id}`);
407
+ navigate(`/returns/${returnOrder.id}`);
408
408
  },
409
409
  children: "View"
410
410
  }
411
411
  ) })
412
412
  ]
413
413
  },
414
- swap.id
414
+ returnOrder.id
415
415
  )) })
416
416
  ] }) }),
417
417
  hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -419,14 +419,14 @@ const SwapsPage = () => {
419
419
  {
420
420
  variant: "secondary",
421
421
  isLoading: isFetchingMore,
422
- onClick: () => loadSwaps(offset, false),
422
+ onClick: () => loadReturns(offset, false),
423
423
  children: "Load more"
424
424
  }
425
425
  ) }) : null
426
426
  ] }) });
427
427
  };
428
428
  const config$2 = adminSdk.defineRouteConfig({
429
- label: "Swaps",
429
+ label: "Return Orders",
430
430
  icon: icons.ArrowPath
431
431
  });
432
432
  const getStatusBadgeClass$1 = (status) => {
@@ -434,65 +434,67 @@ const getStatusBadgeClass$1 = (status) => {
434
434
  if (statusLower === "requested") {
435
435
  return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
436
436
  }
437
- if (statusLower === "received") {
437
+ if (statusLower === "approved") {
438
438
  return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
439
439
  }
440
- if (statusLower === "requires_action") {
440
+ if (statusLower === "rejected") {
441
441
  return "bg-ui-tag-red-bg text-ui-tag-red-text";
442
442
  }
443
443
  if (statusLower === "completed") {
444
444
  return "bg-ui-tag-green-bg text-ui-tag-green-text";
445
445
  }
446
- if (statusLower === "canceled") {
446
+ if (statusLower === "cancelled") {
447
447
  return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
448
448
  }
449
449
  return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
450
450
  };
451
- const ReturnDetailPage = () => {
452
- var _a, _b, _c;
451
+ const SwapDetailPage = () => {
452
+ var _a, _b;
453
453
  const navigate = reactRouterDom.useNavigate();
454
454
  const { id } = reactRouterDom.useParams();
455
- const [returnOrder, setReturnOrder] = react.useState(null);
455
+ const [swap, setSwap] = react.useState(null);
456
+ const [order, setOrder] = react.useState(null);
456
457
  const [selectedStatus, setSelectedStatus] = react.useState("");
457
458
  const [isLoading, setIsLoading] = react.useState(true);
458
459
  const [isUpdating, setIsUpdating] = react.useState(false);
460
+ const [isApproving, setIsApproving] = react.useState(false);
461
+ const [isRejecting, setIsRejecting] = react.useState(false);
462
+ const [isCreatingExchange, setIsCreatingExchange] = react.useState(false);
463
+ const [sendNotification, setSendNotification] = react.useState(false);
464
+ const [exchangeError, setExchangeError] = react.useState(null);
465
+ const [exchangeSuccess, setExchangeSuccess] = react.useState(false);
459
466
  const [error, setError] = react.useState(null);
460
467
  const [updateError, setUpdateError] = react.useState(null);
461
468
  const [updateSuccess, setUpdateSuccess] = react.useState(false);
462
- const availableStatuses = [
463
- "requested",
464
- "received",
465
- "requires_action",
466
- "completed",
467
- "canceled"
468
- ];
469
+ const availableStatuses = ["requested", "approved", "rejected"];
469
470
  react.useEffect(() => {
470
471
  if (!id) {
471
- navigate("/returns");
472
+ navigate("/swaps");
472
473
  return;
473
474
  }
474
- const loadReturn = async () => {
475
+ const loadSwap = async () => {
475
476
  try {
476
477
  setIsLoading(true);
477
478
  setError(null);
478
- const response = await fetch(`/admin/returns/${id}`, {
479
+ const response = await fetch(`/admin/swaps/${id}`, {
479
480
  credentials: "include"
480
481
  });
481
482
  if (!response.ok) {
482
483
  const message = await response.text();
483
- throw new Error(message || "Unable to load return order");
484
+ throw new Error(message || "Unable to load swap");
484
485
  }
485
486
  const payload = await response.json();
486
- setReturnOrder(payload.return);
487
+ setSwap(payload.swap);
488
+ setOrder(payload.order || null);
487
489
  setSelectedStatus("");
488
490
  } catch (loadError) {
489
- const message = loadError instanceof Error ? loadError.message : "Unable to load return order";
491
+ const message = loadError instanceof Error ? loadError.message : "Unable to load swap";
490
492
  setError(message);
491
493
  } finally {
492
494
  setIsLoading(false);
493
495
  }
494
496
  };
495
- void loadReturn();
497
+ void loadSwap();
496
498
  }, [id, navigate]);
497
499
  const handleStatusUpdate = async () => {
498
500
  if (!id || !selectedStatus) {
@@ -502,7 +504,7 @@ const ReturnDetailPage = () => {
502
504
  setIsUpdating(true);
503
505
  setUpdateError(null);
504
506
  setUpdateSuccess(false);
505
- const response = await fetch(`/admin/returns/${id}/status`, {
507
+ const response = await fetch(`/admin/swaps/${id}/status`, {
506
508
  method: "POST",
507
509
  headers: {
508
510
  "Content-Type": "application/json"
@@ -515,16 +517,17 @@ const ReturnDetailPage = () => {
515
517
  throw new Error(message || "Unable to update status");
516
518
  }
517
519
  const payload = await response.json();
518
- setReturnOrder(payload.return);
520
+ setSwap(payload.swap);
519
521
  setSelectedStatus("");
520
522
  setUpdateSuccess(true);
521
523
  setTimeout(() => setUpdateSuccess(false), 3e3);
522
- const detailResponse = await fetch(`/admin/returns/${id}`, {
524
+ const detailResponse = await fetch(`/admin/swaps/${id}`, {
523
525
  credentials: "include"
524
526
  });
525
527
  if (detailResponse.ok) {
526
528
  const detailPayload = await detailResponse.json();
527
- setReturnOrder(detailPayload.return);
529
+ setSwap(detailPayload.swap);
530
+ setOrder(detailPayload.order || null);
528
531
  }
529
532
  } catch (updateErr) {
530
533
  const message = updateErr instanceof Error ? updateErr.message : "Unable to update status";
@@ -533,64 +536,204 @@ const ReturnDetailPage = () => {
533
536
  setIsUpdating(false);
534
537
  }
535
538
  };
536
- if (isLoading) {
537
- 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..." }) }) }) });
538
- }
539
- if (error || !returnOrder) {
540
- 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: [
541
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Return order not found" }),
542
- /* @__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" }) })
543
- ] }) }) });
544
- }
545
- const statusHistory = ((_a = returnOrder.metadata) == null ? void 0 : _a.status_history) || [];
546
- 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: [
547
- /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3", children: [
548
- /* @__PURE__ */ jsxRuntime.jsxs(
549
- ui.Button,
550
- {
551
- variant: "transparent",
552
- size: "small",
553
- onClick: () => navigate("/returns"),
554
- className: "w-fit",
555
- children: [
556
- /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, { className: "mr-2" }),
557
- "Back to list"
558
- ]
559
- }
560
- ),
561
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
562
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
563
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Return Order Details" }),
564
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: returnOrder.id })
565
- ] }),
566
- /* @__PURE__ */ jsxRuntime.jsx(
567
- ui.Badge,
568
- {
569
- size: "small",
570
- className: `uppercase ${getStatusBadgeClass$1(returnOrder.status)}`,
571
- children: returnOrder.status.replace("_", " ")
572
- }
573
- )
574
- ] })
575
- ] }),
576
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
577
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Update Status" }),
578
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-end", children: [
579
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
580
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "mb-2 block text-sm font-medium text-ui-fg-base", children: "New Status" }),
581
- /* @__PURE__ */ jsxRuntime.jsxs(
582
- "select",
583
- {
584
- value: selectedStatus,
585
- onChange: (event) => setSelectedStatus(event.target.value),
586
- className: "h-9 w-full 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",
587
- children: [
588
- /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "Select new status" }),
589
- availableStatuses.filter((status) => status !== returnOrder.status).map((status) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: status, children: status.replace("_", " ").toUpperCase() }, status))
590
- ]
591
- }
592
- )
593
- ] }),
539
+ const handleApprove = async () => {
540
+ if (!id) {
541
+ return;
542
+ }
543
+ try {
544
+ setIsApproving(true);
545
+ setUpdateError(null);
546
+ setUpdateSuccess(false);
547
+ const response = await fetch(`/admin/swaps/${id}/approve`, {
548
+ method: "POST",
549
+ headers: {
550
+ "Content-Type": "application/json"
551
+ },
552
+ credentials: "include"
553
+ });
554
+ if (!response.ok) {
555
+ const message = await response.text();
556
+ throw new Error(message || "Unable to approve swap");
557
+ }
558
+ const payload = await response.json();
559
+ setSwap(payload.swap);
560
+ setUpdateSuccess(true);
561
+ setTimeout(() => setUpdateSuccess(false), 5e3);
562
+ const detailResponse = await fetch(`/admin/swaps/${id}`, {
563
+ credentials: "include"
564
+ });
565
+ if (detailResponse.ok) {
566
+ const detailPayload = await detailResponse.json();
567
+ setSwap(detailPayload.swap);
568
+ setOrder(detailPayload.order || null);
569
+ }
570
+ } catch (updateErr) {
571
+ const message = updateErr instanceof Error ? updateErr.message : "Unable to approve swap";
572
+ setUpdateError(message);
573
+ } finally {
574
+ setIsApproving(false);
575
+ }
576
+ };
577
+ const handleReject = async () => {
578
+ if (!id) {
579
+ return;
580
+ }
581
+ try {
582
+ setIsRejecting(true);
583
+ setUpdateError(null);
584
+ setUpdateSuccess(false);
585
+ const response = await fetch(`/admin/swaps/${id}/reject`, {
586
+ method: "POST",
587
+ headers: {
588
+ "Content-Type": "application/json"
589
+ },
590
+ credentials: "include",
591
+ body: JSON.stringify({ reason: "Rejected by admin" })
592
+ });
593
+ if (!response.ok) {
594
+ const message = await response.text();
595
+ throw new Error(message || "Unable to reject swap");
596
+ }
597
+ const payload = await response.json();
598
+ setSwap(payload.swap);
599
+ setUpdateSuccess(true);
600
+ setTimeout(() => setUpdateSuccess(false), 3e3);
601
+ const detailResponse = await fetch(`/admin/swaps/${id}`, {
602
+ credentials: "include"
603
+ });
604
+ if (detailResponse.ok) {
605
+ const detailPayload = await response.json();
606
+ setSwap(detailPayload.swap);
607
+ setOrder(detailPayload.order || null);
608
+ }
609
+ } catch (updateErr) {
610
+ const message = updateErr instanceof Error ? updateErr.message : "Unable to reject swap";
611
+ setUpdateError(message);
612
+ } finally {
613
+ setIsRejecting(false);
614
+ }
615
+ };
616
+ const handleCreateExchange = async () => {
617
+ if (!id) {
618
+ return;
619
+ }
620
+ try {
621
+ setIsCreatingExchange(true);
622
+ setExchangeError(null);
623
+ setExchangeSuccess(false);
624
+ const response = await fetch(`/admin/swaps/${id}/confirm-exchange`, {
625
+ method: "POST",
626
+ headers: {
627
+ "Content-Type": "application/json"
628
+ },
629
+ credentials: "include",
630
+ body: JSON.stringify({
631
+ send_notification: sendNotification
632
+ })
633
+ });
634
+ if (!response.ok) {
635
+ const errorData = await response.json().catch(() => ({ message: "Failed to create exchange" }));
636
+ throw new Error(errorData.message || errorData.error || "Failed to create exchange");
637
+ }
638
+ const result = await response.json();
639
+ setSwap(result.swap);
640
+ setExchangeSuccess(true);
641
+ setTimeout(() => setExchangeSuccess(false), 5e3);
642
+ const detailResponse = await fetch(`/admin/swaps/${id}`, {
643
+ credentials: "include"
644
+ });
645
+ if (detailResponse.ok) {
646
+ const detailPayload = await detailResponse.json();
647
+ setSwap(detailPayload.swap);
648
+ setOrder(detailPayload.order || null);
649
+ }
650
+ } catch (createErr) {
651
+ const message = createErr instanceof Error ? createErr.message : "Unable to create exchange";
652
+ setExchangeError(message);
653
+ } finally {
654
+ setIsCreatingExchange(false);
655
+ }
656
+ };
657
+ if (isLoading) {
658
+ 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..." }) }) }) });
659
+ }
660
+ if (error || !swap) {
661
+ 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: [
662
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Swap not found" }),
663
+ /* @__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" }) })
664
+ ] }) }) });
665
+ }
666
+ const statusHistory = ((_a = swap.metadata) == null ? void 0 : _a.status_history) || [];
667
+ 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: [
668
+ /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3", children: [
669
+ /* @__PURE__ */ jsxRuntime.jsxs(
670
+ ui.Button,
671
+ {
672
+ variant: "transparent",
673
+ size: "small",
674
+ onClick: () => navigate("/swaps"),
675
+ className: "w-fit",
676
+ children: [
677
+ /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, { className: "mr-2" }),
678
+ "Back to list"
679
+ ]
680
+ }
681
+ ),
682
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
683
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
684
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Swap Details" }),
685
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: swap.id })
686
+ ] }),
687
+ /* @__PURE__ */ jsxRuntime.jsx(
688
+ ui.Badge,
689
+ {
690
+ size: "small",
691
+ className: `uppercase ${getStatusBadgeClass$1(swap.status)}`,
692
+ children: swap.status.replace(/_/g, " ")
693
+ }
694
+ )
695
+ ] })
696
+ ] }),
697
+ swap.status === "requested" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
698
+ /* @__PURE__ */ jsxRuntime.jsx(
699
+ ui.Button,
700
+ {
701
+ variant: "primary",
702
+ onClick: handleApprove,
703
+ disabled: isApproving || isRejecting,
704
+ isLoading: isApproving,
705
+ children: "Approve Swap"
706
+ }
707
+ ),
708
+ /* @__PURE__ */ jsxRuntime.jsx(
709
+ ui.Button,
710
+ {
711
+ variant: "secondary",
712
+ onClick: handleReject,
713
+ disabled: isApproving || isRejecting,
714
+ isLoading: isRejecting,
715
+ children: "Reject Swap"
716
+ }
717
+ )
718
+ ] }),
719
+ swap.status === "requested" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
720
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Update Status" }),
721
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-end", children: [
722
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
723
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "mb-2 block text-sm font-medium text-ui-fg-base", children: "New Status" }),
724
+ /* @__PURE__ */ jsxRuntime.jsxs(
725
+ "select",
726
+ {
727
+ value: selectedStatus,
728
+ onChange: (event) => setSelectedStatus(event.target.value),
729
+ className: "h-9 w-full 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",
730
+ children: [
731
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "Select new status" }),
732
+ availableStatuses.filter((status) => status !== swap.status).map((status) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: status, children: status.replace(/_/g, " ").toUpperCase() }, status))
733
+ ]
734
+ }
735
+ )
736
+ ] }),
594
737
  /* @__PURE__ */ jsxRuntime.jsx(
595
738
  ui.Button,
596
739
  {
@@ -605,37 +748,139 @@ const ReturnDetailPage = () => {
605
748
  updateError && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-error", children: updateError }),
606
749
  updateSuccess && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-success", children: "Status updated successfully" })
607
750
  ] }),
751
+ swap.status === "approved" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
752
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Exchange Information" }),
753
+ swap.exchange_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
754
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
755
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
756
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.exchange_id })
757
+ ] }),
758
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
759
+ ui.Button,
760
+ {
761
+ variant: "secondary",
762
+ onClick: () => {
763
+ window.open(`/app/orders/${swap.order_id}/exchanges/${swap.exchange_id}`, "_blank");
764
+ },
765
+ children: "View Exchange"
766
+ }
767
+ ) })
768
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
769
+ swap.return_items && swap.return_items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
770
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "mb-3 text-base", children: "Return Items (Inbound)" }),
771
+ /* @__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: [
772
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
773
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Item" }),
774
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
775
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
776
+ ] }) }),
777
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle bg-ui-bg-base", children: swap.return_items.map((item, index) => {
778
+ var _a2;
779
+ const orderItem = (_a2 = order == null ? void 0 : order.items) == null ? void 0 : _a2.find((oi) => oi.id === item.id);
780
+ return /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
781
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: (orderItem == null ? void 0 : orderItem.title) || item.id }),
782
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
783
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
784
+ ] }, item.id || index);
785
+ }) })
786
+ ] }) })
787
+ ] }),
788
+ swap.new_items && swap.new_items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
789
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "mb-3 text-base", children: "New Items (Outbound)" }),
790
+ /* @__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: [
791
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
792
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Product/Variant" }),
793
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
794
+ ] }) }),
795
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle bg-ui-bg-base", children: swap.new_items.map((item, index) => {
796
+ var _a2;
797
+ const orderItem = (_a2 = order == null ? void 0 : order.items) == null ? void 0 : _a2.find((oi) => oi.variant_id === item.variant_id);
798
+ return /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
799
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: (orderItem == null ? void 0 : orderItem.title) || item.variant_id }),
800
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
801
+ ] }, item.variant_id || index);
802
+ }) })
803
+ ] }) })
804
+ ] }),
805
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3 rounded-lg border border-ui-border-base bg-ui-bg-subtle p-4", children: [
806
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-base", children: "Exchange Details" }),
807
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-3 md:grid-cols-2", children: [
808
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
809
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Return Location" }),
810
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.return_location_id || "—" })
811
+ ] }),
812
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
813
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Return Shipping Method" }),
814
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.return_shipping_method_id || "—" })
815
+ ] }),
816
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
817
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Outbound Shipping Method" }),
818
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.outbound_shipping_method_id || "—" })
819
+ ] })
820
+ ] })
821
+ ] }),
822
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
823
+ /* @__PURE__ */ jsxRuntime.jsx(
824
+ "input",
825
+ {
826
+ type: "checkbox",
827
+ id: "send-notification",
828
+ checked: sendNotification,
829
+ onChange: (e) => setSendNotification(e.target.checked),
830
+ className: "h-4 w-4 rounded border-ui-border-base text-ui-fg-interactive focus:ring-2 focus:ring-ui-fg-interactive"
831
+ }
832
+ ),
833
+ /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: "send-notification", className: "cursor-pointer", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", children: "Send notification to customer about exchange" }) })
834
+ ] }),
835
+ exchangeError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-ui-border-error bg-ui-bg-error-subtle p-3", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-error", children: exchangeError }) }),
836
+ exchangeSuccess && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-ui-border-success bg-ui-bg-success-subtle p-3", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-success", children: "Exchange created successfully!" }) }),
837
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
838
+ ui.Button,
839
+ {
840
+ variant: "primary",
841
+ onClick: handleCreateExchange,
842
+ disabled: isCreatingExchange,
843
+ isLoading: isCreatingExchange,
844
+ children: "Confirm & Create Exchange"
845
+ }
846
+ ) })
847
+ ] })
848
+ ] }),
608
849
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
609
850
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
610
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Information" }),
851
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Swap Information" }),
611
852
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
612
853
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
613
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
614
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.id })
854
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Swap ID" }),
855
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.id })
615
856
  ] }),
616
857
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
617
858
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
618
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.status })
859
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.status })
619
860
  ] }),
620
861
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
621
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Refund Amount" }),
622
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.refund_amount ? `${((_b = returnOrder.order) == null ? void 0 : _b.currency_code) || "$"}${Number(returnOrder.refund_amount).toFixed(2)}` : "—" })
862
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Difference Due" }),
863
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.difference_due != null ? `${swap.currency_code || "$"}${(Number(swap.difference_due) / 100).toFixed(2)}` : "—" })
623
864
  ] }),
624
- returnOrder.reason && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
865
+ swap.reason && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
625
866
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
626
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.reason })
867
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.reason })
627
868
  ] }),
628
- returnOrder.note && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
869
+ swap.note && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
629
870
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
630
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.note })
871
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.note })
631
872
  ] }),
632
873
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
633
874
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
634
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(returnOrder.created_at).toLocaleString() })
875
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(swap.created_at).toLocaleString() })
635
876
  ] }),
636
877
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
637
878
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
638
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(returnOrder.updated_at).toLocaleString() })
879
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(swap.updated_at).toLocaleString() })
880
+ ] }),
881
+ swap.exchange_id && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
882
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
883
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.exchange_id })
639
884
  ] })
640
885
  ] })
641
886
  ] }),
@@ -646,23 +891,18 @@ const ReturnDetailPage = () => {
646
891
  {
647
892
  className: "flex items-center justify-between border-b border-ui-border-subtle pb-2 last:border-0",
648
893
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
649
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
650
- /* @__PURE__ */ jsxRuntime.jsx(
651
- ui.Badge,
652
- {
653
- size: "2xsmall",
654
- className: `uppercase ${getStatusBadgeClass$1(entry.to)}`,
655
- children: entry.to.replace("_", " ")
656
- }
657
- ),
658
- entry.from && /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: [
659
- "from ",
660
- entry.from.replace("_", " ")
661
- ] })
662
- ] }),
894
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
895
+ ui.Badge,
896
+ {
897
+ size: "2xsmall",
898
+ className: `uppercase ${getStatusBadgeClass$1(entry.status)}`,
899
+ children: entry.status.replace(/_/g, " ")
900
+ }
901
+ ) }),
663
902
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: [
664
- new Date(entry.changed_at).toLocaleString(),
665
- entry.changed_by && ` by ${entry.changed_by}`
903
+ new Date(entry.timestamp).toLocaleString(),
904
+ entry.admin_id && ` by ${entry.admin_id}`,
905
+ entry.reason && ` - ${entry.reason}`
666
906
  ] })
667
907
  ] })
668
908
  },
@@ -670,76 +910,62 @@ const ReturnDetailPage = () => {
670
910
  )) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
671
911
  ] })
672
912
  ] }),
673
- returnOrder.order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
913
+ order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
674
914
  /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
675
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
676
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
677
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
678
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
679
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.id })
680
- ] }),
681
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
682
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
683
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.status || "—" })
684
- ] }),
685
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
686
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
687
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_c = returnOrder.order.customer) == null ? void 0 : _c.email) || returnOrder.order.email || "—" })
688
- ] }),
689
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
690
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
691
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.total ? `${returnOrder.order.currency_code || "$"}${Number(returnOrder.order.total).toFixed(2)}` : "—" })
692
- ] })
915
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
916
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
917
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
918
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.id })
693
919
  ] }),
694
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
695
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
696
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Subtotal" }),
697
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.subtotal ? `${returnOrder.order.currency_code || "$"}${Number(returnOrder.order.subtotal).toFixed(2)}` : "—" })
698
- ] }),
699
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
700
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Tax Total" }),
701
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.tax_total ? `${returnOrder.order.currency_code || "$"}${Number(returnOrder.order.tax_total).toFixed(2)}` : "—" })
702
- ] }),
703
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
704
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Shipping Total" }),
705
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.shipping_total ? `${returnOrder.order.currency_code || "$"}${Number(returnOrder.order.shipping_total).toFixed(2)}` : "—" })
706
- ] }),
707
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
708
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Created" }),
709
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.created_at ? new Date(returnOrder.order.created_at).toLocaleString() : "—" })
920
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
921
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
922
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.status || "" })
923
+ ] }),
924
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
925
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
926
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_b = order.customer) == null ? void 0 : _b.email) || order.email || "—" })
927
+ ] }),
928
+ order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
929
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
930
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "font-medium", children: [
931
+ order.currency_code || "$",
932
+ (Number(order.total) / 100).toFixed(2)
710
933
  ] })
711
934
  ] })
712
935
  ] })
713
936
  ] }),
714
- returnOrder.items && returnOrder.items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
937
+ 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: [
715
938
  /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
716
939
  /* @__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: [
717
940
  /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
718
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Item" }),
719
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
941
+ /* @__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" }),
942
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
943
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
720
944
  ] }) }),
721
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: returnOrder.items.map((item) => {
722
- var _a2, _b2;
723
- return /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
724
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: ((_a2 = item.item) == null ? void 0 : _a2.title) || ((_b2 = item.item) == null ? void 0 : _b2.id) || item.id }),
725
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
726
- ] }, item.id);
727
- }) })
945
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.return_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
946
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
947
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
948
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
949
+ ] }, item.id || index)) })
728
950
  ] }) })
729
951
  ] }),
730
- returnOrder.metadata && Object.keys(returnOrder.metadata).filter(
731
- (key) => key !== "status_history"
732
- ).length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
733
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Metadata" }),
734
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: Object.entries(returnOrder.metadata).filter(([key]) => key !== "status_history").map(([key, value]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
735
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: key }),
736
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "font-medium", children: typeof value === "string" ? value : JSON.stringify(value) })
737
- ] }, key)) })
952
+ 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: [
953
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "New Items" }),
954
+ /* @__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: [
955
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
956
+ /* @__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" }),
957
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
958
+ ] }) }),
959
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.new_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
960
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.variant_id }),
961
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
962
+ ] }, item.variant_id || index)) })
963
+ ] }) })
738
964
  ] })
739
965
  ] }) });
740
966
  };
741
967
  const config$1 = adminSdk.defineRouteConfig({
742
- label: "Return Order Details",
968
+ label: "Swap Details",
743
969
  icon: icons.ArrowPath
744
970
  });
745
971
  const getStatusBadgeClass = (status) => {
@@ -747,63 +973,65 @@ const getStatusBadgeClass = (status) => {
747
973
  if (statusLower === "requested") {
748
974
  return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
749
975
  }
750
- if (statusLower === "approved") {
976
+ if (statusLower === "received") {
751
977
  return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
752
978
  }
753
- if (statusLower === "rejected") {
979
+ if (statusLower === "requires_action") {
754
980
  return "bg-ui-tag-red-bg text-ui-tag-red-text";
755
981
  }
756
982
  if (statusLower === "completed") {
757
983
  return "bg-ui-tag-green-bg text-ui-tag-green-text";
758
984
  }
759
- if (statusLower === "cancelled") {
985
+ if (statusLower === "canceled") {
760
986
  return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
761
987
  }
762
988
  return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
763
989
  };
764
- const SwapDetailPage = () => {
765
- var _a, _b;
990
+ const ReturnDetailPage = () => {
991
+ var _a, _b, _c;
766
992
  const navigate = reactRouterDom.useNavigate();
767
993
  const { id } = reactRouterDom.useParams();
768
- const [swap, setSwap] = react.useState(null);
769
- const [order, setOrder] = react.useState(null);
994
+ const [returnOrder, setReturnOrder] = react.useState(null);
770
995
  const [selectedStatus, setSelectedStatus] = react.useState("");
771
996
  const [isLoading, setIsLoading] = react.useState(true);
772
997
  const [isUpdating, setIsUpdating] = react.useState(false);
773
- const [isApproving, setIsApproving] = react.useState(false);
774
- const [isRejecting, setIsRejecting] = react.useState(false);
775
998
  const [error, setError] = react.useState(null);
776
999
  const [updateError, setUpdateError] = react.useState(null);
777
1000
  const [updateSuccess, setUpdateSuccess] = react.useState(false);
778
- const availableStatuses = ["requested", "approved", "rejected"];
1001
+ const availableStatuses = [
1002
+ "requested",
1003
+ "received",
1004
+ "requires_action",
1005
+ "completed",
1006
+ "canceled"
1007
+ ];
779
1008
  react.useEffect(() => {
780
1009
  if (!id) {
781
- navigate("/swaps");
1010
+ navigate("/returns");
782
1011
  return;
783
1012
  }
784
- const loadSwap = async () => {
1013
+ const loadReturn = async () => {
785
1014
  try {
786
1015
  setIsLoading(true);
787
1016
  setError(null);
788
- const response = await fetch(`/admin/swaps/${id}`, {
1017
+ const response = await fetch(`/admin/returns/${id}`, {
789
1018
  credentials: "include"
790
1019
  });
791
1020
  if (!response.ok) {
792
1021
  const message = await response.text();
793
- throw new Error(message || "Unable to load swap");
1022
+ throw new Error(message || "Unable to load return order");
794
1023
  }
795
1024
  const payload = await response.json();
796
- setSwap(payload.swap);
797
- setOrder(payload.order || null);
1025
+ setReturnOrder(payload.return);
798
1026
  setSelectedStatus("");
799
1027
  } catch (loadError) {
800
- const message = loadError instanceof Error ? loadError.message : "Unable to load swap";
1028
+ const message = loadError instanceof Error ? loadError.message : "Unable to load return order";
801
1029
  setError(message);
802
1030
  } finally {
803
1031
  setIsLoading(false);
804
1032
  }
805
1033
  };
806
- void loadSwap();
1034
+ void loadReturn();
807
1035
  }, [id, navigate]);
808
1036
  const handleStatusUpdate = async () => {
809
1037
  if (!id || !selectedStatus) {
@@ -813,125 +1041,47 @@ const SwapDetailPage = () => {
813
1041
  setIsUpdating(true);
814
1042
  setUpdateError(null);
815
1043
  setUpdateSuccess(false);
816
- const response = await fetch(`/admin/swaps/${id}/status`, {
817
- method: "POST",
818
- headers: {
819
- "Content-Type": "application/json"
820
- },
821
- credentials: "include",
822
- body: JSON.stringify({ status: selectedStatus })
823
- });
824
- if (!response.ok) {
825
- const message = await response.text();
826
- throw new Error(message || "Unable to update status");
827
- }
828
- const payload = await response.json();
829
- setSwap(payload.swap);
830
- setSelectedStatus("");
831
- setUpdateSuccess(true);
832
- setTimeout(() => setUpdateSuccess(false), 3e3);
833
- const detailResponse = await fetch(`/admin/swaps/${id}`, {
834
- credentials: "include"
835
- });
836
- if (detailResponse.ok) {
837
- const detailPayload = await detailResponse.json();
838
- setSwap(detailPayload.swap);
839
- setOrder(detailPayload.order || null);
840
- }
841
- } catch (updateErr) {
842
- const message = updateErr instanceof Error ? updateErr.message : "Unable to update status";
843
- setUpdateError(message);
844
- } finally {
845
- setIsUpdating(false);
846
- }
847
- };
848
- const handleApprove = async () => {
849
- if (!id) {
850
- return;
851
- }
852
- try {
853
- setIsApproving(true);
854
- setUpdateError(null);
855
- setUpdateSuccess(false);
856
- const response = await fetch(`/admin/swaps/${id}/approve`, {
857
- method: "POST",
858
- headers: {
859
- "Content-Type": "application/json"
860
- },
861
- credentials: "include"
862
- });
863
- if (!response.ok) {
864
- const message = await response.text();
865
- throw new Error(message || "Unable to approve swap");
866
- }
867
- const payload = await response.json();
868
- setSwap(payload.swap);
869
- setUpdateSuccess(true);
870
- setTimeout(() => setUpdateSuccess(false), 5e3);
871
- const detailResponse = await fetch(`/admin/swaps/${id}`, {
872
- credentials: "include"
873
- });
874
- if (detailResponse.ok) {
875
- const detailPayload = await detailResponse.json();
876
- setSwap(detailPayload.swap);
877
- setOrder(detailPayload.order || null);
878
- }
879
- } catch (updateErr) {
880
- const message = updateErr instanceof Error ? updateErr.message : "Unable to approve swap";
881
- setUpdateError(message);
882
- } finally {
883
- setIsApproving(false);
884
- }
885
- };
886
- const handleReject = async () => {
887
- if (!id) {
888
- return;
889
- }
890
- try {
891
- setIsRejecting(true);
892
- setUpdateError(null);
893
- setUpdateSuccess(false);
894
- const response = await fetch(`/admin/swaps/${id}/reject`, {
1044
+ const response = await fetch(`/admin/returns/${id}/status`, {
895
1045
  method: "POST",
896
1046
  headers: {
897
1047
  "Content-Type": "application/json"
898
1048
  },
899
1049
  credentials: "include",
900
- body: JSON.stringify({ reason: "Rejected by admin" })
1050
+ body: JSON.stringify({ status: selectedStatus })
901
1051
  });
902
1052
  if (!response.ok) {
903
1053
  const message = await response.text();
904
- throw new Error(message || "Unable to reject swap");
1054
+ throw new Error(message || "Unable to update status");
905
1055
  }
906
1056
  const payload = await response.json();
907
- setSwap(payload.swap);
1057
+ setReturnOrder(payload.return);
1058
+ setSelectedStatus("");
908
1059
  setUpdateSuccess(true);
909
1060
  setTimeout(() => setUpdateSuccess(false), 3e3);
910
- const detailResponse = await fetch(`/admin/swaps/${id}`, {
1061
+ const detailResponse = await fetch(`/admin/returns/${id}`, {
911
1062
  credentials: "include"
912
1063
  });
913
1064
  if (detailResponse.ok) {
914
- const detailPayload = await response.json();
915
- setSwap(detailPayload.swap);
916
- setOrder(detailPayload.order || null);
1065
+ const detailPayload = await detailResponse.json();
1066
+ setReturnOrder(detailPayload.return);
917
1067
  }
918
1068
  } catch (updateErr) {
919
- const message = updateErr instanceof Error ? updateErr.message : "Unable to reject swap";
1069
+ const message = updateErr instanceof Error ? updateErr.message : "Unable to update status";
920
1070
  setUpdateError(message);
921
1071
  } finally {
922
- setIsRejecting(false);
1072
+ setIsUpdating(false);
923
1073
  }
924
1074
  };
925
1075
  if (isLoading) {
926
- 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..." }) }) }) });
1076
+ 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..." }) }) }) });
927
1077
  }
928
- if (error || !swap) {
1078
+ if (error || !returnOrder) {
929
1079
  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: [
930
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Swap not found" }),
931
- /* @__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" }) })
1080
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error || "Return order not found" }),
1081
+ /* @__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" }) })
932
1082
  ] }) }) });
933
1083
  }
934
- const statusHistory = ((_a = swap.metadata) == null ? void 0 : _a.status_history) || [];
1084
+ const statusHistory = ((_a = returnOrder.metadata) == null ? void 0 : _a.status_history) || [];
935
1085
  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: [
936
1086
  /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3", children: [
937
1087
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -939,7 +1089,7 @@ const SwapDetailPage = () => {
939
1089
  {
940
1090
  variant: "transparent",
941
1091
  size: "small",
942
- onClick: () => navigate("/swaps"),
1092
+ onClick: () => navigate("/returns"),
943
1093
  className: "w-fit",
944
1094
  children: [
945
1095
  /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeft, { className: "mr-2" }),
@@ -949,42 +1099,20 @@ const SwapDetailPage = () => {
949
1099
  ),
950
1100
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 md:flex-row md:items-center md:justify-between", children: [
951
1101
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
952
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Swap Details" }),
953
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: swap.id })
1102
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Return Order Details" }),
1103
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: returnOrder.id })
954
1104
  ] }),
955
1105
  /* @__PURE__ */ jsxRuntime.jsx(
956
1106
  ui.Badge,
957
1107
  {
958
1108
  size: "small",
959
- className: `uppercase ${getStatusBadgeClass(swap.status)}`,
960
- children: swap.status.replace(/_/g, " ")
1109
+ className: `uppercase ${getStatusBadgeClass(returnOrder.status)}`,
1110
+ children: returnOrder.status.replace("_", " ")
961
1111
  }
962
1112
  )
963
1113
  ] })
964
1114
  ] }),
965
- swap.status === "requested" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
966
- /* @__PURE__ */ jsxRuntime.jsx(
967
- ui.Button,
968
- {
969
- variant: "primary",
970
- onClick: handleApprove,
971
- disabled: isApproving || isRejecting,
972
- isLoading: isApproving,
973
- children: "Approve Swap"
974
- }
975
- ),
976
- /* @__PURE__ */ jsxRuntime.jsx(
977
- ui.Button,
978
- {
979
- variant: "secondary",
980
- onClick: handleReject,
981
- disabled: isApproving || isRejecting,
982
- isLoading: isRejecting,
983
- children: "Reject Swap"
984
- }
985
- )
986
- ] }),
987
- swap.status === "requested" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
1115
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
988
1116
  /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Update Status" }),
989
1117
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-end", children: [
990
1118
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1", children: [
@@ -997,7 +1125,7 @@ const SwapDetailPage = () => {
997
1125
  className: "h-9 w-full 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",
998
1126
  children: [
999
1127
  /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "Select new status" }),
1000
- availableStatuses.filter((status) => status !== swap.status).map((status) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: status, children: status.replace(/_/g, " ").toUpperCase() }, status))
1128
+ availableStatuses.filter((status) => status !== returnOrder.status).map((status) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: status, children: status.replace("_", " ").toUpperCase() }, status))
1001
1129
  ]
1002
1130
  }
1003
1131
  )
@@ -1016,73 +1144,37 @@ const SwapDetailPage = () => {
1016
1144
  updateError && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-error", children: updateError }),
1017
1145
  updateSuccess && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-success", children: "Status updated successfully" })
1018
1146
  ] }),
1019
- swap.status === "approved" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
1020
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Exchange Information" }),
1021
- swap.exchange_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
1022
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1023
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
1024
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.exchange_id })
1025
- ] }),
1026
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
1027
- ui.Button,
1028
- {
1029
- variant: "secondary",
1030
- onClick: () => {
1031
- window.open(`/app/orders/${swap.order_id}/exchanges/${swap.exchange_id}`, "_blank");
1032
- },
1033
- children: "View Exchange"
1034
- }
1035
- ) })
1036
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
1037
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Swap approved. Please create the exchange using Medusa's exchange creation form." }),
1038
- /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
1039
- ui.Button,
1040
- {
1041
- variant: "primary",
1042
- onClick: () => {
1043
- window.open(`/app/orders/${swap.order_id}/exchanges`, "_blank");
1044
- },
1045
- children: "Create Exchange"
1046
- }
1047
- ) }),
1048
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "The exchange will be automatically linked to this swap once created." })
1049
- ] })
1050
- ] }),
1051
1147
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
1052
1148
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
1053
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Swap Information" }),
1149
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Information" }),
1054
1150
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
1055
1151
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1056
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Swap ID" }),
1057
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.id })
1152
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Return ID" }),
1153
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.id })
1058
1154
  ] }),
1059
1155
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1060
1156
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Status" }),
1061
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.status })
1157
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.status })
1062
1158
  ] }),
1063
1159
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1064
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Difference Due" }),
1065
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.difference_due != null ? `${swap.currency_code || "$"}${(Number(swap.difference_due) / 100).toFixed(2)}` : "—" })
1160
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Refund Amount" }),
1161
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.refund_amount ? `${((_b = returnOrder.order) == null ? void 0 : _b.currency_code) || "$"}${Number(returnOrder.refund_amount).toFixed(2)}` : "—" })
1066
1162
  ] }),
1067
- swap.reason && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1163
+ returnOrder.reason && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1068
1164
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Reason" }),
1069
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.reason })
1165
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.reason })
1070
1166
  ] }),
1071
- swap.note && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1167
+ returnOrder.note && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1072
1168
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Note" }),
1073
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.note })
1169
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.note })
1074
1170
  ] }),
1075
1171
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1076
1172
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Created" }),
1077
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(swap.created_at).toLocaleString() })
1173
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(returnOrder.created_at).toLocaleString() })
1078
1174
  ] }),
1079
1175
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1080
1176
  /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Last Updated" }),
1081
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(swap.updated_at).toLocaleString() })
1082
- ] }),
1083
- swap.exchange_id && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1084
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Exchange ID" }),
1085
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: swap.exchange_id })
1177
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: new Date(returnOrder.updated_at).toLocaleString() })
1086
1178
  ] })
1087
1179
  ] })
1088
1180
  ] }),
@@ -1093,18 +1185,23 @@ const SwapDetailPage = () => {
1093
1185
  {
1094
1186
  className: "flex items-center justify-between border-b border-ui-border-subtle pb-2 last:border-0",
1095
1187
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
1096
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsx(
1097
- ui.Badge,
1098
- {
1099
- size: "2xsmall",
1100
- className: `uppercase ${getStatusBadgeClass(entry.status)}`,
1101
- children: entry.status.replace(/_/g, " ")
1102
- }
1103
- ) }),
1188
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
1189
+ /* @__PURE__ */ jsxRuntime.jsx(
1190
+ ui.Badge,
1191
+ {
1192
+ size: "2xsmall",
1193
+ className: `uppercase ${getStatusBadgeClass(entry.to)}`,
1194
+ children: entry.to.replace("_", " ")
1195
+ }
1196
+ ),
1197
+ entry.from && /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: [
1198
+ "from ",
1199
+ entry.from.replace("_", " ")
1200
+ ] })
1201
+ ] }),
1104
1202
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: [
1105
- new Date(entry.timestamp).toLocaleString(),
1106
- entry.admin_id && ` by ${entry.admin_id}`,
1107
- entry.reason && ` - ${entry.reason}`
1203
+ new Date(entry.changed_at).toLocaleString(),
1204
+ entry.changed_by && ` by ${entry.changed_by}`
1108
1205
  ] })
1109
1206
  ] })
1110
1207
  },
@@ -1112,83 +1209,97 @@ const SwapDetailPage = () => {
1112
1209
  )) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "No status history available" })
1113
1210
  ] })
1114
1211
  ] }),
1115
- order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
1212
+ returnOrder.order && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
1116
1213
  /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Related Order Information" }),
1117
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
1118
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1119
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
1120
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.id })
1121
- ] }),
1122
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1123
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
1124
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: order.status || "—" })
1125
- ] }),
1126
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1127
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
1128
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_b = order.customer) == null ? void 0 : _b.email) || order.email || "" })
1214
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-6 md:grid-cols-2", children: [
1215
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
1216
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1217
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order ID" }),
1218
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.id })
1219
+ ] }),
1220
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1221
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Status" }),
1222
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.status || "—" })
1223
+ ] }),
1224
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1225
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Customer" }),
1226
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: ((_c = returnOrder.order.customer) == null ? void 0 : _c.email) || returnOrder.order.email || "—" })
1227
+ ] }),
1228
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1229
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
1230
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.total ? `${returnOrder.order.currency_code || "$"}${Number(returnOrder.order.total).toFixed(2)}` : "—" })
1231
+ ] })
1129
1232
  ] }),
1130
- order.total && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1131
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Total" }),
1132
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "font-medium", children: [
1133
- order.currency_code || "$",
1134
- (Number(order.total) / 100).toFixed(2)
1233
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-3", children: [
1234
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1235
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Subtotal" }),
1236
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.subtotal ? `${returnOrder.order.currency_code || "$"}${Number(returnOrder.order.subtotal).toFixed(2)}` : "—" })
1237
+ ] }),
1238
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1239
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Tax Total" }),
1240
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.tax_total ? `${returnOrder.order.currency_code || "$"}${Number(returnOrder.order.tax_total).toFixed(2)}` : "—" })
1241
+ ] }),
1242
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1243
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Shipping Total" }),
1244
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.shipping_total ? `${returnOrder.order.currency_code || "$"}${Number(returnOrder.order.shipping_total).toFixed(2)}` : "—" })
1245
+ ] }),
1246
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1247
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Order Created" }),
1248
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "font-medium", children: returnOrder.order.created_at ? new Date(returnOrder.order.created_at).toLocaleString() : "—" })
1135
1249
  ] })
1136
1250
  ] })
1137
1251
  ] })
1138
1252
  ] }),
1139
- 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: [
1253
+ returnOrder.items && returnOrder.items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
1140
1254
  /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Return Items" }),
1141
1255
  /* @__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: [
1142
1256
  /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
1143
- /* @__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" }),
1144
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" }),
1145
- /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Reason" })
1146
- ] }) }),
1147
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.return_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
1148
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.id }),
1149
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity }),
1150
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.reason || "—" })
1151
- ] }, item.id || index)) })
1152
- ] }) })
1153
- ] }),
1154
- 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: [
1155
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "New Items" }),
1156
- /* @__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: [
1157
- /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
1158
- /* @__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" }),
1257
+ /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Item" }),
1159
1258
  /* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Quantity" })
1160
1259
  ] }) }),
1161
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: swap.new_items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
1162
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: item.variant_id }),
1163
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
1164
- ] }, item.variant_id || index)) })
1260
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: returnOrder.items.map((item) => {
1261
+ var _a2, _b2;
1262
+ return /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
1263
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 font-medium text-ui-fg-base", children: ((_a2 = item.item) == null ? void 0 : _a2.title) || ((_b2 = item.item) == null ? void 0 : _b2.id) || item.id }),
1264
+ /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: item.quantity })
1265
+ ] }, item.id);
1266
+ }) })
1165
1267
  ] }) })
1268
+ ] }),
1269
+ returnOrder.metadata && Object.keys(returnOrder.metadata).filter(
1270
+ (key) => key !== "status_history"
1271
+ ).length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-base bg-ui-bg-base p-6", children: [
1272
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "mb-4 text-lg", children: "Metadata" }),
1273
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: Object.entries(returnOrder.metadata).filter(([key]) => key !== "status_history").map(([key, value]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
1274
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: key }),
1275
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "font-medium", children: typeof value === "string" ? value : JSON.stringify(value) })
1276
+ ] }, key)) })
1166
1277
  ] })
1167
1278
  ] }) });
1168
1279
  };
1169
1280
  const config = adminSdk.defineRouteConfig({
1170
- label: "Swap Details",
1281
+ label: "Return Order Details",
1171
1282
  icon: icons.ArrowPath
1172
1283
  });
1173
1284
  const i18nTranslations0 = {};
1174
1285
  const widgetModule = { widgets: [] };
1175
1286
  const routeModule = {
1176
1287
  routes: [
1177
- {
1178
- Component: ReturnsPage,
1179
- path: "/returns"
1180
- },
1181
1288
  {
1182
1289
  Component: SwapsPage,
1183
1290
  path: "/swaps"
1184
1291
  },
1185
1292
  {
1186
- Component: ReturnDetailPage,
1187
- path: "/returns/:id"
1293
+ Component: ReturnsPage,
1294
+ path: "/returns"
1188
1295
  },
1189
1296
  {
1190
1297
  Component: SwapDetailPage,
1191
1298
  path: "/swaps/:id"
1299
+ },
1300
+ {
1301
+ Component: ReturnDetailPage,
1302
+ path: "/returns/:id"
1192
1303
  }
1193
1304
  ]
1194
1305
  };
@@ -1197,25 +1308,25 @@ const menuItemModule = {
1197
1308
  {
1198
1309
  label: config$3.label,
1199
1310
  icon: config$3.icon,
1200
- path: "/returns",
1311
+ path: "/swaps",
1201
1312
  nested: void 0
1202
1313
  },
1203
1314
  {
1204
1315
  label: config$2.label,
1205
1316
  icon: config$2.icon,
1206
- path: "/swaps",
1317
+ path: "/returns",
1207
1318
  nested: void 0
1208
1319
  },
1209
1320
  {
1210
1321
  label: config$1.label,
1211
1322
  icon: config$1.icon,
1212
- path: "/returns/:id",
1323
+ path: "/swaps/:id",
1213
1324
  nested: void 0
1214
1325
  },
1215
1326
  {
1216
1327
  label: config.label,
1217
1328
  icon: config.icon,
1218
- path: "/swaps/:id",
1329
+ path: "/returns/:id",
1219
1330
  nested: void 0
1220
1331
  }
1221
1332
  ]