order-management 0.0.59 → 0.0.61
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.
- package/.medusa/server/src/admin/index.js +1091 -624
- package/.medusa/server/src/admin/index.mjs +1093 -626
- package/package.json +1 -1
|
@@ -1,10 +1,475 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const react = require("react");
|
|
4
3
|
const adminSdk = require("@medusajs/admin-sdk");
|
|
4
|
+
const react = require("react");
|
|
5
5
|
const ui = require("@medusajs/ui");
|
|
6
6
|
const icons = require("@medusajs/icons");
|
|
7
7
|
const reactRouterDom = require("react-router-dom");
|
|
8
|
+
function roundRectPath(ctx, x, y, w, h, r) {
|
|
9
|
+
ctx.beginPath();
|
|
10
|
+
ctx.moveTo(x + r, y);
|
|
11
|
+
ctx.lineTo(x + w - r, y);
|
|
12
|
+
ctx.quadraticCurveTo(x + w, y, x + w, y + r);
|
|
13
|
+
ctx.lineTo(x + w, y + h - r);
|
|
14
|
+
ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
|
|
15
|
+
ctx.lineTo(x + r, y + h);
|
|
16
|
+
ctx.quadraticCurveTo(x, y + h, x, y + h - r);
|
|
17
|
+
ctx.lineTo(x, y + r);
|
|
18
|
+
ctx.quadraticCurveTo(x, y, x + r, y);
|
|
19
|
+
ctx.closePath();
|
|
20
|
+
}
|
|
21
|
+
function wrapText(ctx, text, maxWidth) {
|
|
22
|
+
const words = text.split(" ");
|
|
23
|
+
const lines = [];
|
|
24
|
+
let cur = "";
|
|
25
|
+
for (const word of words) {
|
|
26
|
+
const test = cur ? `${cur} ${word}` : word;
|
|
27
|
+
if (ctx.measureText(test).width > maxWidth && cur) {
|
|
28
|
+
lines.push(cur);
|
|
29
|
+
cur = word;
|
|
30
|
+
} else {
|
|
31
|
+
cur = test;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (cur) lines.push(cur);
|
|
35
|
+
return lines;
|
|
36
|
+
}
|
|
37
|
+
function drawBow(ctx, cx, cy) {
|
|
38
|
+
ctx.save();
|
|
39
|
+
ctx.translate(cx, cy);
|
|
40
|
+
ctx.fillStyle = "#9f1239";
|
|
41
|
+
ctx.beginPath();
|
|
42
|
+
ctx.moveTo(0, -1);
|
|
43
|
+
ctx.bezierCurveTo(-6, -20, -38, -24, -34, -5);
|
|
44
|
+
ctx.bezierCurveTo(-30, 10, -6, 5, 0, 1);
|
|
45
|
+
ctx.fill();
|
|
46
|
+
ctx.beginPath();
|
|
47
|
+
ctx.moveTo(0, -1);
|
|
48
|
+
ctx.bezierCurveTo(6, -20, 38, -24, 34, -5);
|
|
49
|
+
ctx.bezierCurveTo(30, 10, 6, 5, 0, 1);
|
|
50
|
+
ctx.fill();
|
|
51
|
+
ctx.beginPath();
|
|
52
|
+
ctx.moveTo(-5, 5);
|
|
53
|
+
ctx.lineTo(-16, 26);
|
|
54
|
+
ctx.lineTo(-10, 26);
|
|
55
|
+
ctx.lineTo(0, 6);
|
|
56
|
+
ctx.fill();
|
|
57
|
+
ctx.beginPath();
|
|
58
|
+
ctx.moveTo(5, 5);
|
|
59
|
+
ctx.lineTo(16, 26);
|
|
60
|
+
ctx.lineTo(10, 26);
|
|
61
|
+
ctx.lineTo(0, 6);
|
|
62
|
+
ctx.fill();
|
|
63
|
+
const kg = ctx.createRadialGradient(0, -1, 0, 0, -1, 9);
|
|
64
|
+
kg.addColorStop(0, "#fb7185");
|
|
65
|
+
kg.addColorStop(1, "#9f1239");
|
|
66
|
+
ctx.fillStyle = kg;
|
|
67
|
+
ctx.beginPath();
|
|
68
|
+
ctx.ellipse(0, -1, 8, 7, 0, 0, Math.PI * 2);
|
|
69
|
+
ctx.fill();
|
|
70
|
+
ctx.restore();
|
|
71
|
+
}
|
|
72
|
+
function generateGiftCardCanvas(productName, variantTitle, from, to, message) {
|
|
73
|
+
const W = 600;
|
|
74
|
+
const H = 420;
|
|
75
|
+
const S = 2;
|
|
76
|
+
const canvas = document.createElement("canvas");
|
|
77
|
+
canvas.width = W * S;
|
|
78
|
+
canvas.height = H * S;
|
|
79
|
+
const ctx = canvas.getContext("2d");
|
|
80
|
+
ctx.scale(S, S);
|
|
81
|
+
const bg = ctx.createLinearGradient(0, 0, W, H);
|
|
82
|
+
bg.addColorStop(0, "#fff9f5");
|
|
83
|
+
bg.addColorStop(1, "#fff4f7");
|
|
84
|
+
ctx.fillStyle = bg;
|
|
85
|
+
roundRectPath(ctx, 0, 0, W, H, 16);
|
|
86
|
+
ctx.fill();
|
|
87
|
+
ctx.strokeStyle = "#fda4af";
|
|
88
|
+
ctx.lineWidth = 2.5;
|
|
89
|
+
roundRectPath(ctx, 3, 3, W - 6, H - 6, 14);
|
|
90
|
+
ctx.stroke();
|
|
91
|
+
ctx.strokeStyle = "#fee2e2";
|
|
92
|
+
ctx.lineWidth = 1;
|
|
93
|
+
ctx.setLineDash([7, 5]);
|
|
94
|
+
roundRectPath(ctx, 12, 12, W - 24, H - 24, 10);
|
|
95
|
+
ctx.stroke();
|
|
96
|
+
ctx.setLineDash([]);
|
|
97
|
+
ctx.fillStyle = "#fca5a5";
|
|
98
|
+
ctx.font = "14px serif";
|
|
99
|
+
ctx.textAlign = "center";
|
|
100
|
+
ctx.textBaseline = "middle";
|
|
101
|
+
[[27, 27], [W - 27, 27], [27, H - 27], [W - 27, H - 27]].forEach(
|
|
102
|
+
([x, y]) => ctx.fillText("✦", x, y)
|
|
103
|
+
);
|
|
104
|
+
const RY = 78;
|
|
105
|
+
ctx.shadowColor = "rgba(0,0,0,0.10)";
|
|
106
|
+
ctx.shadowBlur = 6;
|
|
107
|
+
ctx.shadowOffsetY = 2;
|
|
108
|
+
const rg = ctx.createLinearGradient(0, RY - 18, 0, RY + 18);
|
|
109
|
+
rg.addColorStop(0, "#fb7185");
|
|
110
|
+
rg.addColorStop(0.45, "#e11d48");
|
|
111
|
+
rg.addColorStop(1, "#be123c");
|
|
112
|
+
ctx.fillStyle = rg;
|
|
113
|
+
ctx.fillRect(0, RY - 18, W, 36);
|
|
114
|
+
ctx.shadowColor = "transparent";
|
|
115
|
+
ctx.shadowBlur = 0;
|
|
116
|
+
ctx.shadowOffsetY = 0;
|
|
117
|
+
ctx.fillStyle = "rgba(255,255,255,0.14)";
|
|
118
|
+
ctx.fillRect(0, RY - 18, W, 11);
|
|
119
|
+
drawBow(ctx, W / 2, RY);
|
|
120
|
+
const label = productName + (variantTitle ? ` · ${variantTitle}` : "");
|
|
121
|
+
ctx.fillStyle = "#fce7f3";
|
|
122
|
+
ctx.font = "500 11px system-ui, -apple-system, sans-serif";
|
|
123
|
+
ctx.textAlign = "center";
|
|
124
|
+
ctx.textBaseline = "middle";
|
|
125
|
+
ctx.fillText(
|
|
126
|
+
label.length > 55 ? label.slice(0, 55) + "…" : label,
|
|
127
|
+
W / 2,
|
|
128
|
+
40
|
|
129
|
+
);
|
|
130
|
+
const BT = RY + 36;
|
|
131
|
+
ctx.textBaseline = "top";
|
|
132
|
+
ctx.fillStyle = "#be123c";
|
|
133
|
+
ctx.font = "700 10px system-ui, sans-serif";
|
|
134
|
+
ctx.textAlign = "left";
|
|
135
|
+
ctx.fillText("TO", 44, BT + 8);
|
|
136
|
+
ctx.fillStyle = "#111827";
|
|
137
|
+
ctx.font = `bold 28px Georgia, "Times New Roman", serif`;
|
|
138
|
+
const toStr = (to || "—").slice(0, 22);
|
|
139
|
+
ctx.fillText(toStr + (to && to.length > 22 ? "…" : ""), 44, BT + 22);
|
|
140
|
+
ctx.fillStyle = "#be123c";
|
|
141
|
+
ctx.font = "700 10px system-ui, sans-serif";
|
|
142
|
+
ctx.textAlign = "right";
|
|
143
|
+
ctx.fillText("FROM", W - 44, BT + 8);
|
|
144
|
+
ctx.fillStyle = "#374151";
|
|
145
|
+
ctx.font = `600 20px Georgia, "Times New Roman", serif`;
|
|
146
|
+
const fromStr = (from || "—").slice(0, 26);
|
|
147
|
+
ctx.fillText(fromStr + (from && from.length > 26 ? "…" : ""), W - 44, BT + 26);
|
|
148
|
+
const DY = BT + 68;
|
|
149
|
+
ctx.strokeStyle = "#fca5a5";
|
|
150
|
+
ctx.lineWidth = 1;
|
|
151
|
+
ctx.setLineDash([5, 5]);
|
|
152
|
+
ctx.beginPath();
|
|
153
|
+
ctx.moveTo(44, DY);
|
|
154
|
+
ctx.lineTo(W - 44, DY);
|
|
155
|
+
ctx.stroke();
|
|
156
|
+
ctx.setLineDash([]);
|
|
157
|
+
const ML = 44;
|
|
158
|
+
const MT = DY + 14;
|
|
159
|
+
const MW = W - 88;
|
|
160
|
+
const MH = H - MT - 42;
|
|
161
|
+
ctx.shadowColor = "rgba(0,0,0,0.07)";
|
|
162
|
+
ctx.shadowBlur = 8;
|
|
163
|
+
ctx.shadowOffsetY = 3;
|
|
164
|
+
ctx.fillStyle = "#ffffff";
|
|
165
|
+
roundRectPath(ctx, ML, MT, MW, MH, 7);
|
|
166
|
+
ctx.fill();
|
|
167
|
+
ctx.shadowColor = "transparent";
|
|
168
|
+
ctx.shadowBlur = 0;
|
|
169
|
+
ctx.shadowOffsetY = 0;
|
|
170
|
+
ctx.strokeStyle = "#fed7aa";
|
|
171
|
+
ctx.lineWidth = 1;
|
|
172
|
+
roundRectPath(ctx, ML, MT, MW, MH, 7);
|
|
173
|
+
ctx.stroke();
|
|
174
|
+
ctx.strokeStyle = "#fef9c3";
|
|
175
|
+
ctx.lineWidth = 0.7;
|
|
176
|
+
for (let ly = MT + 26; ly < MT + MH - 8; ly += 21) {
|
|
177
|
+
ctx.beginPath();
|
|
178
|
+
ctx.moveTo(ML + 12, ly);
|
|
179
|
+
ctx.lineTo(ML + MW - 12, ly);
|
|
180
|
+
ctx.stroke();
|
|
181
|
+
}
|
|
182
|
+
if (message) {
|
|
183
|
+
ctx.fillStyle = "#1f2937";
|
|
184
|
+
ctx.font = `italic 13.5px Georgia, "Times New Roman", serif`;
|
|
185
|
+
ctx.textAlign = "left";
|
|
186
|
+
ctx.textBaseline = "top";
|
|
187
|
+
const lines = wrapText(ctx, `"${message}"`, MW - 32);
|
|
188
|
+
const maxLines = Math.floor((MH - 18) / 21);
|
|
189
|
+
lines.slice(0, maxLines).forEach((line, i) => {
|
|
190
|
+
ctx.fillText(line, ML + 16, MT + 13 + i * 21);
|
|
191
|
+
});
|
|
192
|
+
} else {
|
|
193
|
+
ctx.fillStyle = "#9ca3af";
|
|
194
|
+
ctx.font = `italic 12px Georgia, serif`;
|
|
195
|
+
ctx.textAlign = "center";
|
|
196
|
+
ctx.textBaseline = "middle";
|
|
197
|
+
ctx.fillText("No message included", W / 2, MT + MH / 2);
|
|
198
|
+
}
|
|
199
|
+
ctx.fillStyle = "#fca5a5";
|
|
200
|
+
ctx.font = "12px serif";
|
|
201
|
+
ctx.textAlign = "center";
|
|
202
|
+
ctx.textBaseline = "middle";
|
|
203
|
+
ctx.fillText("♥ · ♥ · ♥", W / 2, H - 21);
|
|
204
|
+
return canvas;
|
|
205
|
+
}
|
|
206
|
+
function downloadGiftCard(productName, variantTitle, from, to, message) {
|
|
207
|
+
const canvas = generateGiftCardCanvas(productName, variantTitle, from, to, message);
|
|
208
|
+
const a = document.createElement("a");
|
|
209
|
+
a.download = `gift-card-${productName.replace(/\s+/g, "-").toLowerCase()}.png`;
|
|
210
|
+
a.href = canvas.toDataURL("image/png");
|
|
211
|
+
a.click();
|
|
212
|
+
}
|
|
213
|
+
const s = {
|
|
214
|
+
widget: {
|
|
215
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
216
|
+
marginTop: "10px"
|
|
217
|
+
},
|
|
218
|
+
header: {
|
|
219
|
+
display: "flex",
|
|
220
|
+
alignItems: "center",
|
|
221
|
+
gap: "10px",
|
|
222
|
+
marginBottom: "14px"
|
|
223
|
+
},
|
|
224
|
+
iconBox: {
|
|
225
|
+
display: "flex",
|
|
226
|
+
alignItems: "center",
|
|
227
|
+
justifyContent: "center",
|
|
228
|
+
width: "30px",
|
|
229
|
+
height: "30px",
|
|
230
|
+
borderRadius: "8px",
|
|
231
|
+
background: "#fce7f3",
|
|
232
|
+
color: "#be123c",
|
|
233
|
+
fontSize: "16px",
|
|
234
|
+
flexShrink: 0
|
|
235
|
+
},
|
|
236
|
+
badge: {
|
|
237
|
+
marginLeft: "auto",
|
|
238
|
+
fontSize: "11px",
|
|
239
|
+
fontWeight: 600,
|
|
240
|
+
background: "#eef2ff",
|
|
241
|
+
color: "#4338ca",
|
|
242
|
+
borderRadius: "999px",
|
|
243
|
+
padding: "3px 10px"
|
|
244
|
+
},
|
|
245
|
+
card: {
|
|
246
|
+
position: "relative",
|
|
247
|
+
borderRadius: "12px",
|
|
248
|
+
overflow: "hidden",
|
|
249
|
+
border: "1px solid #f3f4f6",
|
|
250
|
+
background: "#ffffff",
|
|
251
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.06)",
|
|
252
|
+
marginBottom: "14px"
|
|
253
|
+
},
|
|
254
|
+
ribbon: {
|
|
255
|
+
background: "linear-gradient(90deg,#fb7185,#e11d48)",
|
|
256
|
+
padding: "14px 18px",
|
|
257
|
+
display: "flex",
|
|
258
|
+
alignItems: "center",
|
|
259
|
+
justifyContent: "center",
|
|
260
|
+
position: "relative"
|
|
261
|
+
},
|
|
262
|
+
bowCenter: {
|
|
263
|
+
position: "absolute",
|
|
264
|
+
top: "50%",
|
|
265
|
+
left: "50%",
|
|
266
|
+
transform: "translate(-50%, -50%)",
|
|
267
|
+
fontSize: "20px",
|
|
268
|
+
userSelect: "none"
|
|
269
|
+
},
|
|
270
|
+
productLabel: {
|
|
271
|
+
fontSize: "11px",
|
|
272
|
+
fontWeight: 500,
|
|
273
|
+
color: "rgba(255,255,255,0.9)",
|
|
274
|
+
position: "absolute",
|
|
275
|
+
bottom: "6px",
|
|
276
|
+
left: 0,
|
|
277
|
+
right: 0,
|
|
278
|
+
textAlign: "center",
|
|
279
|
+
whiteSpace: "nowrap",
|
|
280
|
+
overflow: "hidden",
|
|
281
|
+
textOverflow: "ellipsis",
|
|
282
|
+
padding: "0 90px"
|
|
283
|
+
},
|
|
284
|
+
downloadBtn: {
|
|
285
|
+
position: "absolute",
|
|
286
|
+
top: "10px",
|
|
287
|
+
right: "12px",
|
|
288
|
+
display: "flex",
|
|
289
|
+
alignItems: "center",
|
|
290
|
+
gap: "6px",
|
|
291
|
+
fontSize: "11px",
|
|
292
|
+
fontWeight: 600,
|
|
293
|
+
color: "#ffffff",
|
|
294
|
+
background: "linear-gradient(180deg,#fb7185,#e11d48)",
|
|
295
|
+
border: "none",
|
|
296
|
+
borderRadius: "6px",
|
|
297
|
+
padding: "6px 10px",
|
|
298
|
+
cursor: "pointer",
|
|
299
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.15)"
|
|
300
|
+
},
|
|
301
|
+
body: {
|
|
302
|
+
padding: "14px 18px"
|
|
303
|
+
},
|
|
304
|
+
toFromRow: {
|
|
305
|
+
display: "flex",
|
|
306
|
+
justifyContent: "space-between",
|
|
307
|
+
alignItems: "flex-start",
|
|
308
|
+
marginBottom: "12px"
|
|
309
|
+
},
|
|
310
|
+
toBlock: {
|
|
311
|
+
display: "flex",
|
|
312
|
+
flexDirection: "column",
|
|
313
|
+
gap: "2px"
|
|
314
|
+
},
|
|
315
|
+
fromBlock: {
|
|
316
|
+
display: "flex",
|
|
317
|
+
flexDirection: "column",
|
|
318
|
+
alignItems: "flex-end",
|
|
319
|
+
gap: "2px"
|
|
320
|
+
},
|
|
321
|
+
fieldLabel: {
|
|
322
|
+
fontSize: "9px",
|
|
323
|
+
fontWeight: 700,
|
|
324
|
+
color: "#be123c",
|
|
325
|
+
letterSpacing: "0.08em",
|
|
326
|
+
textTransform: "uppercase"
|
|
327
|
+
},
|
|
328
|
+
toValue: {
|
|
329
|
+
fontSize: "22px",
|
|
330
|
+
fontWeight: 700,
|
|
331
|
+
fontFamily: `Georgia, "Times New Roman", serif`,
|
|
332
|
+
color: "#111827",
|
|
333
|
+
lineHeight: 1.15,
|
|
334
|
+
maxWidth: "160px",
|
|
335
|
+
overflow: "hidden",
|
|
336
|
+
textOverflow: "ellipsis",
|
|
337
|
+
whiteSpace: "nowrap"
|
|
338
|
+
},
|
|
339
|
+
fromValue: {
|
|
340
|
+
fontSize: "16px",
|
|
341
|
+
fontWeight: 600,
|
|
342
|
+
fontFamily: `Georgia, "Times New Roman", serif`,
|
|
343
|
+
color: "#374151",
|
|
344
|
+
maxWidth: "140px",
|
|
345
|
+
overflow: "hidden",
|
|
346
|
+
textOverflow: "ellipsis",
|
|
347
|
+
whiteSpace: "nowrap",
|
|
348
|
+
textAlign: "right"
|
|
349
|
+
},
|
|
350
|
+
divider: {
|
|
351
|
+
borderTop: "1px solid #e5e7eb",
|
|
352
|
+
margin: "10px 0 14px"
|
|
353
|
+
},
|
|
354
|
+
noteBox: {
|
|
355
|
+
background: "#f9fafb",
|
|
356
|
+
border: "1px solid #e5e7eb",
|
|
357
|
+
borderRadius: "8px",
|
|
358
|
+
padding: "14px 16px",
|
|
359
|
+
minHeight: "70px"
|
|
360
|
+
},
|
|
361
|
+
messageText: {
|
|
362
|
+
fontSize: "13px",
|
|
363
|
+
fontStyle: "italic",
|
|
364
|
+
fontFamily: `Georgia, "Times New Roman", serif`,
|
|
365
|
+
color: "#1f2937",
|
|
366
|
+
lineHeight: 1.6,
|
|
367
|
+
margin: 0
|
|
368
|
+
},
|
|
369
|
+
noMessage: {
|
|
370
|
+
fontSize: "11px",
|
|
371
|
+
color: "#9ca3af",
|
|
372
|
+
fontStyle: "italic"
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
const OrderGiftItemsWidget = ({ data }) => {
|
|
376
|
+
const [fetchedItems, setFetchedItems] = react.useState(null);
|
|
377
|
+
react.useEffect(() => {
|
|
378
|
+
if (!(data == null ? void 0 : data.id)) return;
|
|
379
|
+
fetch(
|
|
380
|
+
`/admin/orders/${data.id}?fields=*items,items.metadata`
|
|
381
|
+
).then((r) => r.json()).then(({ order }) => setFetchedItems((order == null ? void 0 : order.items) ?? [])).catch(() => setFetchedItems((data == null ? void 0 : data.items) ?? []));
|
|
382
|
+
}, [data == null ? void 0 : data.id]);
|
|
383
|
+
const items = fetchedItems ?? (data == null ? void 0 : data.items) ?? [];
|
|
384
|
+
const giftedItems = items.filter((i) => {
|
|
385
|
+
var _a;
|
|
386
|
+
const flag = (_a = i.metadata) == null ? void 0 : _a.is_gift;
|
|
387
|
+
return flag === "true" || flag === true;
|
|
388
|
+
});
|
|
389
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.widget, children: [
|
|
390
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.header, children: [
|
|
391
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: s.iconBox, children: "🎁" }),
|
|
392
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
393
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "13px", fontWeight: 600, color: "#111827" }, children: "Gift Items" }),
|
|
394
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "11px", color: "#6b7280" }, children: "Items marked as gifts in this order" })
|
|
395
|
+
] }),
|
|
396
|
+
giftedItems.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: s.badge, children: giftedItems.length })
|
|
397
|
+
] }),
|
|
398
|
+
giftedItems.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
399
|
+
"div",
|
|
400
|
+
{
|
|
401
|
+
style: {
|
|
402
|
+
padding: "14px 16px",
|
|
403
|
+
background: "#f9fafb",
|
|
404
|
+
border: "1px solid #f3f4f6",
|
|
405
|
+
borderRadius: "8px",
|
|
406
|
+
fontSize: "12px",
|
|
407
|
+
color: "#9ca3af",
|
|
408
|
+
textAlign: "center"
|
|
409
|
+
},
|
|
410
|
+
children: "No gift items in this order"
|
|
411
|
+
}
|
|
412
|
+
),
|
|
413
|
+
giftedItems.map((item) => {
|
|
414
|
+
const meta = item.metadata;
|
|
415
|
+
const from = meta == null ? void 0 : meta.gift_from;
|
|
416
|
+
const to = meta == null ? void 0 : meta.gift_to;
|
|
417
|
+
const message = meta == null ? void 0 : meta.gift_message;
|
|
418
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.card, children: [
|
|
419
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.ribbon, children: [
|
|
420
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.bowCenter, children: "🎀" }),
|
|
421
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: s.productLabel, children: [
|
|
422
|
+
item.product_title,
|
|
423
|
+
item.variant_title ? ` · ${item.variant_title}` : ""
|
|
424
|
+
] }),
|
|
425
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
426
|
+
"button",
|
|
427
|
+
{
|
|
428
|
+
style: s.downloadBtn,
|
|
429
|
+
onClick: () => downloadGiftCard(
|
|
430
|
+
item.product_title ?? "Gift",
|
|
431
|
+
item.variant_title ?? void 0,
|
|
432
|
+
from,
|
|
433
|
+
to,
|
|
434
|
+
message
|
|
435
|
+
),
|
|
436
|
+
title: "Download gift card as image",
|
|
437
|
+
children: [
|
|
438
|
+
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
439
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
440
|
+
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "7 10 12 15 17 10" }),
|
|
441
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
|
|
442
|
+
] }),
|
|
443
|
+
"Download"
|
|
444
|
+
]
|
|
445
|
+
}
|
|
446
|
+
)
|
|
447
|
+
] }),
|
|
448
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.body, children: [
|
|
449
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.toFromRow, children: [
|
|
450
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.toBlock, children: [
|
|
451
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.fieldLabel, children: "To" }),
|
|
452
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.toValue, children: to || "—" })
|
|
453
|
+
] }),
|
|
454
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.fromBlock, children: [
|
|
455
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.fieldLabel, children: "From" }),
|
|
456
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.fromValue, children: from || "—" })
|
|
457
|
+
] })
|
|
458
|
+
] }),
|
|
459
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: s.divider }),
|
|
460
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: s.noteBox, children: message ? /* @__PURE__ */ jsxRuntime.jsxs("p", { style: s.messageText, children: [
|
|
461
|
+
"“",
|
|
462
|
+
message,
|
|
463
|
+
"”"
|
|
464
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: s.noMessage, children: "No message included" }) })
|
|
465
|
+
] })
|
|
466
|
+
] }, item.id);
|
|
467
|
+
})
|
|
468
|
+
] });
|
|
469
|
+
};
|
|
470
|
+
adminSdk.defineWidgetConfig({
|
|
471
|
+
zone: "order.details.side.after"
|
|
472
|
+
});
|
|
8
473
|
function getOrderIdFromPath() {
|
|
9
474
|
if (typeof window === "undefined") return void 0;
|
|
10
475
|
const m = window.location.pathname.match(/\/orders\/([^/]+)/);
|
|
@@ -379,11 +844,11 @@ const useDebounce$3 = (value, delay) => {
|
|
|
379
844
|
return debouncedValue;
|
|
380
845
|
};
|
|
381
846
|
const getStatusBadgeClass$7 = (status) => {
|
|
382
|
-
const
|
|
383
|
-
if (
|
|
384
|
-
if (
|
|
385
|
-
if (
|
|
386
|
-
if (
|
|
847
|
+
const s2 = status.toLowerCase();
|
|
848
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
849
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
850
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
851
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
387
852
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
388
853
|
};
|
|
389
854
|
const PaymentsPage = () => {
|
|
@@ -436,13 +901,12 @@ const PaymentsPage = () => {
|
|
|
436
901
|
}, [loadTransactions]);
|
|
437
902
|
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
438
903
|
const displayStatus = (t) => {
|
|
439
|
-
const
|
|
440
|
-
return
|
|
904
|
+
const s2 = t.payment_id != null && t.payment_status != null && t.payment_status !== "" ? t.payment_status : t.session_status ?? "";
|
|
905
|
+
return s2 !== "" ? s2 : "—";
|
|
441
906
|
};
|
|
442
907
|
const displayAmount = (t) => {
|
|
443
|
-
const num = Number(t.amount) / 100;
|
|
444
908
|
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
445
|
-
return `${code} ${
|
|
909
|
+
return `${code} ${Number(t.amount)}`;
|
|
446
910
|
};
|
|
447
911
|
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: [
|
|
448
912
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
@@ -580,276 +1044,212 @@ const useDebounce$2 = (value, delay) => {
|
|
|
580
1044
|
return debouncedValue;
|
|
581
1045
|
};
|
|
582
1046
|
const getStatusBadgeClass$6 = (status) => {
|
|
583
|
-
const
|
|
584
|
-
if (
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
if (
|
|
1047
|
+
const statusLower = status.toLowerCase();
|
|
1048
|
+
if (statusLower === "requested") {
|
|
1049
|
+
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1050
|
+
}
|
|
1051
|
+
if (statusLower === "received") {
|
|
1052
|
+
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1053
|
+
}
|
|
1054
|
+
if (statusLower === "requires_action") {
|
|
1055
|
+
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1056
|
+
}
|
|
1057
|
+
if (statusLower === "completed") {
|
|
1058
|
+
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1059
|
+
}
|
|
1060
|
+
if (statusLower === "canceled") {
|
|
1061
|
+
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
1062
|
+
}
|
|
588
1063
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
589
1064
|
};
|
|
590
|
-
const
|
|
1065
|
+
const ReturnsPage = () => {
|
|
591
1066
|
const navigate = reactRouterDom.useNavigate();
|
|
592
1067
|
const [items, setItems] = react.useState([]);
|
|
593
|
-
const [
|
|
594
|
-
const
|
|
595
|
-
const [
|
|
596
|
-
const
|
|
597
|
-
const debouncedProvider = useDebounce$2(providerSearch, 300);
|
|
598
|
-
const [currencySearch, setCurrencySearch] = react.useState("");
|
|
599
|
-
const debouncedCurrency = useDebounce$2(currencySearch, 300);
|
|
600
|
-
const [dateFrom, setDateFrom] = react.useState("");
|
|
601
|
-
const [dateTo, setDateTo] = react.useState("");
|
|
602
|
-
const [amountMin, setAmountMin] = react.useState("");
|
|
603
|
-
const [amountMax, setAmountMax] = react.useState("");
|
|
1068
|
+
const [statusFilter, setStatusFilter] = react.useState("all");
|
|
1069
|
+
const [createdByFilter, setCreatedByFilter] = react.useState("all");
|
|
1070
|
+
const [searchQuery, setSearchQuery] = react.useState("");
|
|
1071
|
+
const debouncedSearchQuery = useDebounce$2(searchQuery, 300);
|
|
604
1072
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
605
1073
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
606
1074
|
const [error, setError] = react.useState(null);
|
|
607
1075
|
const [offset, setOffset] = react.useState(0);
|
|
608
1076
|
const [count, setCount] = react.useState(0);
|
|
609
1077
|
const limit = 50;
|
|
610
|
-
const
|
|
611
|
-
async (nextOffset, replace) => {
|
|
1078
|
+
const loadReturns = react.useCallback(
|
|
1079
|
+
async (nextOffset, replace = false) => {
|
|
1080
|
+
var _a;
|
|
612
1081
|
try {
|
|
613
|
-
if (replace)
|
|
614
|
-
|
|
1082
|
+
if (replace) {
|
|
1083
|
+
setIsLoading(true);
|
|
1084
|
+
} else {
|
|
1085
|
+
setIsFetchingMore(true);
|
|
1086
|
+
}
|
|
615
1087
|
setError(null);
|
|
616
1088
|
const params = new URLSearchParams();
|
|
617
1089
|
params.set("limit", String(limit));
|
|
618
1090
|
params.set("offset", String(nextOffset));
|
|
619
|
-
if (
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
if (
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
const response = await fetch(
|
|
630
|
-
|
|
631
|
-
|
|
1091
|
+
if (statusFilter !== "all") {
|
|
1092
|
+
params.set("status", statusFilter);
|
|
1093
|
+
}
|
|
1094
|
+
if (debouncedSearchQuery.trim()) {
|
|
1095
|
+
params.set("q", debouncedSearchQuery.trim());
|
|
1096
|
+
}
|
|
1097
|
+
if (createdByFilter !== "all") {
|
|
1098
|
+
params.set("created_by", createdByFilter);
|
|
1099
|
+
}
|
|
1100
|
+
params.set("order", "created_at");
|
|
1101
|
+
const response = await fetch(
|
|
1102
|
+
`/admin/return?${params.toString()}`,
|
|
1103
|
+
{ credentials: "include" }
|
|
1104
|
+
);
|
|
632
1105
|
if (!response.ok) {
|
|
633
|
-
const
|
|
634
|
-
throw new Error(
|
|
1106
|
+
const message = await response.text();
|
|
1107
|
+
throw new Error(message || "Unable to load return orders");
|
|
635
1108
|
}
|
|
636
1109
|
const payload = await response.json();
|
|
637
|
-
const list = payload.refunds ?? [];
|
|
638
1110
|
setCount(payload.count ?? 0);
|
|
639
|
-
setOffset(nextOffset +
|
|
640
|
-
setItems(
|
|
641
|
-
|
|
642
|
-
|
|
1111
|
+
setOffset(nextOffset + (((_a = payload.returns) == null ? void 0 : _a.length) ?? 0));
|
|
1112
|
+
setItems(
|
|
1113
|
+
(prev) => replace ? payload.returns ?? [] : [...prev, ...payload.returns ?? []]
|
|
1114
|
+
);
|
|
1115
|
+
} catch (loadError) {
|
|
1116
|
+
const message = loadError instanceof Error ? loadError.message : "Unable to load return orders";
|
|
1117
|
+
setError(message);
|
|
643
1118
|
} finally {
|
|
644
1119
|
setIsLoading(false);
|
|
645
1120
|
setIsFetchingMore(false);
|
|
646
1121
|
}
|
|
647
1122
|
},
|
|
648
|
-
[
|
|
649
|
-
debouncedOrderId,
|
|
650
|
-
paymentStatusFilter,
|
|
651
|
-
debouncedProvider,
|
|
652
|
-
debouncedCurrency,
|
|
653
|
-
dateFrom,
|
|
654
|
-
dateTo,
|
|
655
|
-
amountMin,
|
|
656
|
-
amountMax
|
|
657
|
-
]
|
|
1123
|
+
[statusFilter, createdByFilter, debouncedSearchQuery]
|
|
658
1124
|
);
|
|
659
1125
|
react.useEffect(() => {
|
|
660
|
-
void
|
|
661
|
-
}, [
|
|
1126
|
+
void loadReturns(0, true);
|
|
1127
|
+
}, [statusFilter, createdByFilter, debouncedSearchQuery, loadReturns]);
|
|
662
1128
|
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
663
|
-
const
|
|
664
|
-
const
|
|
665
|
-
|
|
666
|
-
return
|
|
667
|
-
};
|
|
668
|
-
const displayStatus = (r) => {
|
|
669
|
-
const s = r.payment_status ?? "";
|
|
670
|
-
return s !== "" ? s : "—";
|
|
671
|
-
};
|
|
1129
|
+
const availableStatuses = react.useMemo(() => {
|
|
1130
|
+
const statuses = /* @__PURE__ */ new Set();
|
|
1131
|
+
items.forEach((item) => statuses.add(item.status));
|
|
1132
|
+
return Array.from(statuses).sort();
|
|
1133
|
+
}, [items]);
|
|
672
1134
|
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: [
|
|
673
1135
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
674
1136
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
675
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
676
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "
|
|
1137
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Return Orders" }),
|
|
1138
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "View and manage all customer return orders" })
|
|
677
1139
|
] }),
|
|
678
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () =>
|
|
1140
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadReturns(0, true), children: "Refresh" })
|
|
679
1141
|
] }),
|
|
680
|
-
/* @__PURE__ */ jsxRuntime.
|
|
681
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
682
|
-
ui.Input,
|
|
683
|
-
{
|
|
684
|
-
placeholder: "Order ID",
|
|
685
|
-
value: orderIdSearch,
|
|
686
|
-
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
687
|
-
className: "md:max-w-[180px]",
|
|
688
|
-
"aria-label": "Filter by order ID"
|
|
689
|
-
}
|
|
690
|
-
),
|
|
1142
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
691
1143
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
692
1144
|
ui.Input,
|
|
693
1145
|
{
|
|
694
|
-
placeholder: "
|
|
695
|
-
value:
|
|
696
|
-
onChange: (
|
|
697
|
-
className: "md:max-w-
|
|
698
|
-
"aria-label": "Filter by provider"
|
|
1146
|
+
placeholder: "Search by return ID, order ID, or customer email",
|
|
1147
|
+
value: searchQuery,
|
|
1148
|
+
onChange: (event) => setSearchQuery(event.target.value),
|
|
1149
|
+
className: "md:max-w-sm"
|
|
699
1150
|
}
|
|
700
1151
|
),
|
|
701
|
-
/* @__PURE__ */ jsxRuntime.
|
|
702
|
-
|
|
1152
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3", children: [
|
|
1153
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1154
|
+
"select",
|
|
1155
|
+
{
|
|
1156
|
+
value: createdByFilter,
|
|
1157
|
+
onChange: (event) => setCreatedByFilter(event.target.value),
|
|
1158
|
+
className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-xs",
|
|
1159
|
+
children: [
|
|
1160
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All (Created by)" }),
|
|
1161
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "customer", children: "Customer" }),
|
|
1162
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "admin", children: "Admin" })
|
|
1163
|
+
]
|
|
1164
|
+
}
|
|
1165
|
+
),
|
|
1166
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1167
|
+
"select",
|
|
1168
|
+
{
|
|
1169
|
+
value: statusFilter,
|
|
1170
|
+
onChange: (event) => setStatusFilter(event.target.value),
|
|
1171
|
+
className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-xs",
|
|
1172
|
+
children: [
|
|
1173
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All Statuses" }),
|
|
1174
|
+
availableStatuses.map((status) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: status, children: status.replace(/_/g, " ").toUpperCase() }, status))
|
|
1175
|
+
]
|
|
1176
|
+
}
|
|
1177
|
+
)
|
|
1178
|
+
] })
|
|
1179
|
+
] }),
|
|
1180
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1181
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1182
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1183
|
+
ui.Button,
|
|
703
1184
|
{
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
className: "md:max-w-[100px]",
|
|
708
|
-
"aria-label": "Filter by currency"
|
|
1185
|
+
variant: "secondary",
|
|
1186
|
+
onClick: () => loadReturns(0, true),
|
|
1187
|
+
children: "Try again"
|
|
709
1188
|
}
|
|
710
|
-
)
|
|
711
|
-
|
|
712
|
-
|
|
1189
|
+
) })
|
|
1190
|
+
] }) : null,
|
|
1191
|
+
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: [
|
|
1192
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No return orders yet" }),
|
|
1193
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Return orders created by customers will appear here." })
|
|
1194
|
+
] }) : /* @__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: [
|
|
1195
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1196
|
+
/* @__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" }),
|
|
1197
|
+
/* @__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" }),
|
|
1198
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Customer" }),
|
|
1199
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Status" }),
|
|
1200
|
+
/* @__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" }),
|
|
1201
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1202
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1203
|
+
] }) }),
|
|
1204
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((returnOrder) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1205
|
+
"tr",
|
|
713
1206
|
{
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-[160px]",
|
|
717
|
-
"aria-label": "Filter by payment status",
|
|
1207
|
+
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1208
|
+
onClick: () => navigate(`/returns/${returnOrder.id}`),
|
|
718
1209
|
children: [
|
|
719
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
720
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
721
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
722
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
723
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
724
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
725
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
726
|
-
]
|
|
727
|
-
}
|
|
728
|
-
),
|
|
729
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
730
|
-
ui.Input,
|
|
731
|
-
{
|
|
732
|
-
type: "date",
|
|
733
|
-
placeholder: "From",
|
|
734
|
-
value: dateFrom,
|
|
735
|
-
onChange: (e) => setDateFrom(e.target.value),
|
|
736
|
-
className: "md:max-w-[140px]",
|
|
737
|
-
"aria-label": "Date from"
|
|
738
|
-
}
|
|
739
|
-
),
|
|
740
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
741
|
-
ui.Input,
|
|
742
|
-
{
|
|
743
|
-
type: "date",
|
|
744
|
-
placeholder: "To",
|
|
745
|
-
value: dateTo,
|
|
746
|
-
onChange: (e) => setDateTo(e.target.value),
|
|
747
|
-
className: "md:max-w-[140px]",
|
|
748
|
-
"aria-label": "Date to"
|
|
749
|
-
}
|
|
750
|
-
),
|
|
751
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
752
|
-
ui.Input,
|
|
753
|
-
{
|
|
754
|
-
placeholder: "Amount min",
|
|
755
|
-
value: amountMin,
|
|
756
|
-
onChange: (e) => setAmountMin(e.target.value),
|
|
757
|
-
type: "number",
|
|
758
|
-
min: 0,
|
|
759
|
-
className: "md:max-w-[100px]",
|
|
760
|
-
"aria-label": "Refund amount minimum"
|
|
761
|
-
}
|
|
762
|
-
),
|
|
763
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
764
|
-
ui.Input,
|
|
765
|
-
{
|
|
766
|
-
placeholder: "Amount max",
|
|
767
|
-
value: amountMax,
|
|
768
|
-
onChange: (e) => setAmountMax(e.target.value),
|
|
769
|
-
type: "number",
|
|
770
|
-
min: 0,
|
|
771
|
-
className: "md:max-w-[100px]",
|
|
772
|
-
"aria-label": "Refund amount maximum"
|
|
773
|
-
}
|
|
774
|
-
)
|
|
775
|
-
] }) }),
|
|
776
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
777
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
778
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => loadRefunds(0, true), children: "Try again" }) })
|
|
779
|
-
] }) : null,
|
|
780
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading refunds…" }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
781
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No refunds yet" }),
|
|
782
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Refund records will appear here." })
|
|
783
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full overflow-x-auto rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full table-fixed divide-y divide-ui-border-base", style: { minWidth: 0 }, children: [
|
|
784
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
785
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Refund ID" }),
|
|
786
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
787
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Payment ID" }),
|
|
788
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[8%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
789
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[6%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Currency" }),
|
|
790
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[10%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
791
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[10%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Payment Status" }),
|
|
792
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[14%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Note" }),
|
|
793
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
794
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[8%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
795
|
-
] }) }),
|
|
796
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((r) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
797
|
-
"tr",
|
|
798
|
-
{
|
|
799
|
-
className: "cursor-pointer hover:bg-ui-bg-subtle/60",
|
|
800
|
-
onClick: () => navigate(`/refunds/${r.refund_id}`),
|
|
801
|
-
children: [
|
|
802
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 font-mono text-sm text-ui-fg-base", title: r.refund_id, children: r.refund_id }),
|
|
803
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 font-medium text-ui-fg-base", title: r.order_id ?? void 0, children: r.order_id ?? "—" }),
|
|
804
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 font-mono text-sm text-ui-fg-subtle", title: r.payment_id, children: r.payment_id }),
|
|
805
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", children: displayAmount(r) }),
|
|
806
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle uppercase", children: r.currency_code || "—" }),
|
|
807
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", title: r.provider_id || void 0, children: r.provider_id || "—" }),
|
|
808
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1210
|
+
/* @__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 }) }) }),
|
|
1211
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.order_id }),
|
|
1212
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: returnOrder.customer_email || returnOrder.order_email || "—" }),
|
|
1213
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
809
1214
|
ui.Badge,
|
|
810
1215
|
{
|
|
811
1216
|
size: "2xsmall",
|
|
812
|
-
className: `uppercase ${getStatusBadgeClass$6(
|
|
813
|
-
children:
|
|
1217
|
+
className: `uppercase ${getStatusBadgeClass$6(returnOrder.status)}`,
|
|
1218
|
+
children: returnOrder.status.replace(/_/g, " ")
|
|
814
1219
|
}
|
|
815
1220
|
) }),
|
|
816
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
817
|
-
|
|
1221
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
|
|
1222
|
+
const amount = returnOrder.refund_amount;
|
|
1223
|
+
if (amount == null || amount === void 0) {
|
|
1224
|
+
return "—";
|
|
1225
|
+
}
|
|
1226
|
+
const displayAmount = Number(amount) / 100;
|
|
1227
|
+
const currency = returnOrder.currency_code || "$";
|
|
1228
|
+
return `${currency}${displayAmount.toFixed(2)}`;
|
|
1229
|
+
})() }),
|
|
1230
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(returnOrder.created_at).toLocaleDateString("en-US", {
|
|
1231
|
+
year: "numeric",
|
|
818
1232
|
month: "short",
|
|
819
1233
|
day: "numeric",
|
|
820
1234
|
hour: "numeric",
|
|
821
1235
|
minute: "2-digit",
|
|
822
1236
|
hour12: true
|
|
823
1237
|
}) }),
|
|
824
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
),
|
|
837
|
-
r.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
838
|
-
ui.Button,
|
|
839
|
-
{
|
|
840
|
-
variant: "transparent",
|
|
841
|
-
size: "small",
|
|
842
|
-
onClick: (e) => {
|
|
843
|
-
e.stopPropagation();
|
|
844
|
-
navigate(`/orders/${r.order_id}`);
|
|
845
|
-
},
|
|
846
|
-
children: "Order"
|
|
847
|
-
}
|
|
848
|
-
) : null
|
|
849
|
-
] }) })
|
|
1238
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1239
|
+
ui.Button,
|
|
1240
|
+
{
|
|
1241
|
+
variant: "transparent",
|
|
1242
|
+
size: "small",
|
|
1243
|
+
onClick: (e) => {
|
|
1244
|
+
e.stopPropagation();
|
|
1245
|
+
navigate(`/app/orders/${returnOrder.order_id}`);
|
|
1246
|
+
},
|
|
1247
|
+
children: "Go to order"
|
|
1248
|
+
}
|
|
1249
|
+
) })
|
|
850
1250
|
]
|
|
851
1251
|
},
|
|
852
|
-
|
|
1252
|
+
returnOrder.id
|
|
853
1253
|
)) })
|
|
854
1254
|
] }) }),
|
|
855
1255
|
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -857,15 +1257,15 @@ const RefundsPage = () => {
|
|
|
857
1257
|
{
|
|
858
1258
|
variant: "secondary",
|
|
859
1259
|
isLoading: isFetchingMore,
|
|
860
|
-
onClick: () =>
|
|
1260
|
+
onClick: () => loadReturns(offset, false),
|
|
861
1261
|
children: "Load more"
|
|
862
1262
|
}
|
|
863
1263
|
) }) : null
|
|
864
1264
|
] }) });
|
|
865
1265
|
};
|
|
866
1266
|
const config$6 = adminSdk.defineRouteConfig({
|
|
867
|
-
label: "
|
|
868
|
-
icon: icons.
|
|
1267
|
+
label: "Return Orders",
|
|
1268
|
+
icon: icons.ArrowPath
|
|
869
1269
|
});
|
|
870
1270
|
const useDebounce$1 = (value, delay) => {
|
|
871
1271
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
@@ -876,212 +1276,275 @@ const useDebounce$1 = (value, delay) => {
|
|
|
876
1276
|
return debouncedValue;
|
|
877
1277
|
};
|
|
878
1278
|
const getStatusBadgeClass$5 = (status) => {
|
|
879
|
-
const
|
|
880
|
-
if (
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
if (
|
|
884
|
-
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
885
|
-
}
|
|
886
|
-
if (statusLower === "requires_action") {
|
|
887
|
-
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
888
|
-
}
|
|
889
|
-
if (statusLower === "completed") {
|
|
890
|
-
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
891
|
-
}
|
|
892
|
-
if (statusLower === "canceled") {
|
|
893
|
-
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
894
|
-
}
|
|
1279
|
+
const s2 = status.toLowerCase();
|
|
1280
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1281
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1282
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1283
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
895
1284
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
896
1285
|
};
|
|
897
|
-
const
|
|
1286
|
+
const RefundsPage = () => {
|
|
898
1287
|
const navigate = reactRouterDom.useNavigate();
|
|
899
1288
|
const [items, setItems] = react.useState([]);
|
|
900
|
-
const [
|
|
901
|
-
const
|
|
902
|
-
const [
|
|
903
|
-
const
|
|
1289
|
+
const [orderIdSearch, setOrderIdSearch] = react.useState("");
|
|
1290
|
+
const debouncedOrderId = useDebounce$1(orderIdSearch, 300);
|
|
1291
|
+
const [paymentStatusFilter, setPaymentStatusFilter] = react.useState("all");
|
|
1292
|
+
const [providerSearch, setProviderSearch] = react.useState("");
|
|
1293
|
+
const debouncedProvider = useDebounce$1(providerSearch, 300);
|
|
1294
|
+
const [currencySearch, setCurrencySearch] = react.useState("");
|
|
1295
|
+
const debouncedCurrency = useDebounce$1(currencySearch, 300);
|
|
1296
|
+
const [dateFrom, setDateFrom] = react.useState("");
|
|
1297
|
+
const [dateTo, setDateTo] = react.useState("");
|
|
1298
|
+
const [amountMin, setAmountMin] = react.useState("");
|
|
1299
|
+
const [amountMax, setAmountMax] = react.useState("");
|
|
904
1300
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
905
1301
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
906
1302
|
const [error, setError] = react.useState(null);
|
|
907
1303
|
const [offset, setOffset] = react.useState(0);
|
|
908
1304
|
const [count, setCount] = react.useState(0);
|
|
909
1305
|
const limit = 50;
|
|
910
|
-
const
|
|
911
|
-
async (nextOffset, replace
|
|
912
|
-
var _a;
|
|
1306
|
+
const loadRefunds = react.useCallback(
|
|
1307
|
+
async (nextOffset, replace) => {
|
|
913
1308
|
try {
|
|
914
|
-
if (replace)
|
|
915
|
-
|
|
916
|
-
} else {
|
|
917
|
-
setIsFetchingMore(true);
|
|
918
|
-
}
|
|
1309
|
+
if (replace) setIsLoading(true);
|
|
1310
|
+
else setIsFetchingMore(true);
|
|
919
1311
|
setError(null);
|
|
920
1312
|
const params = new URLSearchParams();
|
|
921
1313
|
params.set("limit", String(limit));
|
|
922
1314
|
params.set("offset", String(nextOffset));
|
|
923
|
-
if (
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
if (
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
params.set("
|
|
933
|
-
const response = await fetch(
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
);
|
|
1315
|
+
if (debouncedOrderId.trim()) params.set("order_id", debouncedOrderId.trim());
|
|
1316
|
+
if (paymentStatusFilter !== "all") params.set("payment_status", paymentStatusFilter);
|
|
1317
|
+
if (debouncedProvider.trim()) params.set("provider_id", debouncedProvider.trim());
|
|
1318
|
+
if (debouncedCurrency.trim()) params.set("currency_code", debouncedCurrency.trim());
|
|
1319
|
+
if (dateFrom.trim()) params.set("date_from", dateFrom.trim());
|
|
1320
|
+
if (dateTo.trim()) params.set("date_to", dateTo.trim());
|
|
1321
|
+
const min = amountMin.trim() ? Number(amountMin) : void 0;
|
|
1322
|
+
const max = amountMax.trim() ? Number(amountMax) : void 0;
|
|
1323
|
+
if (min != null && !Number.isNaN(min)) params.set("amount_min", String(min));
|
|
1324
|
+
if (max != null && !Number.isNaN(max)) params.set("amount_max", String(max));
|
|
1325
|
+
const response = await fetch(`/admin/refunds?${params.toString()}`, {
|
|
1326
|
+
credentials: "include"
|
|
1327
|
+
});
|
|
937
1328
|
if (!response.ok) {
|
|
938
|
-
const
|
|
939
|
-
throw new Error(
|
|
1329
|
+
const text = await response.text();
|
|
1330
|
+
throw new Error(text || "Failed to load refunds");
|
|
940
1331
|
}
|
|
941
1332
|
const payload = await response.json();
|
|
1333
|
+
const list = payload.refunds ?? [];
|
|
942
1334
|
setCount(payload.count ?? 0);
|
|
943
|
-
setOffset(nextOffset +
|
|
944
|
-
setItems(
|
|
945
|
-
|
|
946
|
-
);
|
|
947
|
-
} catch (loadError) {
|
|
948
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load return orders";
|
|
949
|
-
setError(message);
|
|
1335
|
+
setOffset(nextOffset + list.length);
|
|
1336
|
+
setItems((prev) => replace ? list : [...prev, ...list]);
|
|
1337
|
+
} catch (e) {
|
|
1338
|
+
setError(e instanceof Error ? e.message : "Failed to load");
|
|
950
1339
|
} finally {
|
|
951
1340
|
setIsLoading(false);
|
|
952
1341
|
setIsFetchingMore(false);
|
|
953
1342
|
}
|
|
954
1343
|
},
|
|
955
|
-
[
|
|
1344
|
+
[
|
|
1345
|
+
debouncedOrderId,
|
|
1346
|
+
paymentStatusFilter,
|
|
1347
|
+
debouncedProvider,
|
|
1348
|
+
debouncedCurrency,
|
|
1349
|
+
dateFrom,
|
|
1350
|
+
dateTo,
|
|
1351
|
+
amountMin,
|
|
1352
|
+
amountMax
|
|
1353
|
+
]
|
|
956
1354
|
);
|
|
957
1355
|
react.useEffect(() => {
|
|
958
|
-
void
|
|
959
|
-
}, [
|
|
1356
|
+
void loadRefunds(0, true);
|
|
1357
|
+
}, [loadRefunds]);
|
|
960
1358
|
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
961
|
-
const
|
|
962
|
-
const
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
1359
|
+
const displayAmount = (r) => {
|
|
1360
|
+
const code = (r.currency_code ?? "USD").toUpperCase();
|
|
1361
|
+
return `${code} ${Number(r.amount)}`;
|
|
1362
|
+
};
|
|
1363
|
+
const displayStatus = (r) => {
|
|
1364
|
+
const s2 = r.payment_status ?? "";
|
|
1365
|
+
return s2 !== "" ? s2 : "—";
|
|
1366
|
+
};
|
|
966
1367
|
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: [
|
|
967
1368
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
968
1369
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
969
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
970
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "
|
|
1370
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refunds" }),
|
|
1371
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle", children: "Refund records — amount, order, payment status" })
|
|
971
1372
|
] }),
|
|
972
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () =>
|
|
1373
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadRefunds(0, true), children: "Refresh" })
|
|
973
1374
|
] }),
|
|
974
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1375
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
975
1376
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
976
1377
|
ui.Input,
|
|
977
1378
|
{
|
|
978
|
-
placeholder: "
|
|
979
|
-
value:
|
|
980
|
-
onChange: (
|
|
981
|
-
className: "md:max-w-
|
|
1379
|
+
placeholder: "Order ID",
|
|
1380
|
+
value: orderIdSearch,
|
|
1381
|
+
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
1382
|
+
className: "md:max-w-[180px]",
|
|
1383
|
+
"aria-label": "Filter by order ID"
|
|
982
1384
|
}
|
|
983
1385
|
),
|
|
984
|
-
/* @__PURE__ */ jsxRuntime.
|
|
985
|
-
|
|
986
|
-
"select",
|
|
987
|
-
{
|
|
988
|
-
value: createdByFilter,
|
|
989
|
-
onChange: (event) => setCreatedByFilter(event.target.value),
|
|
990
|
-
className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-xs",
|
|
991
|
-
children: [
|
|
992
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All (Created by)" }),
|
|
993
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "customer", children: "Customer" }),
|
|
994
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "admin", children: "Admin" })
|
|
995
|
-
]
|
|
996
|
-
}
|
|
997
|
-
),
|
|
998
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
999
|
-
"select",
|
|
1000
|
-
{
|
|
1001
|
-
value: statusFilter,
|
|
1002
|
-
onChange: (event) => setStatusFilter(event.target.value),
|
|
1003
|
-
className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-xs",
|
|
1004
|
-
children: [
|
|
1005
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All Statuses" }),
|
|
1006
|
-
availableStatuses.map((status) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: status, children: status.replace(/_/g, " ").toUpperCase() }, status))
|
|
1007
|
-
]
|
|
1008
|
-
}
|
|
1009
|
-
)
|
|
1010
|
-
] })
|
|
1011
|
-
] }),
|
|
1012
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1013
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1014
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1015
|
-
ui.Button,
|
|
1386
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1387
|
+
ui.Input,
|
|
1016
1388
|
{
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1389
|
+
placeholder: "Provider",
|
|
1390
|
+
value: providerSearch,
|
|
1391
|
+
onChange: (e) => setProviderSearch(e.target.value),
|
|
1392
|
+
className: "md:max-w-[140px]",
|
|
1393
|
+
"aria-label": "Filter by provider"
|
|
1020
1394
|
}
|
|
1021
|
-
)
|
|
1395
|
+
),
|
|
1396
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1397
|
+
ui.Input,
|
|
1398
|
+
{
|
|
1399
|
+
placeholder: "Currency",
|
|
1400
|
+
value: currencySearch,
|
|
1401
|
+
onChange: (e) => setCurrencySearch(e.target.value),
|
|
1402
|
+
className: "md:max-w-[100px]",
|
|
1403
|
+
"aria-label": "Filter by currency"
|
|
1404
|
+
}
|
|
1405
|
+
),
|
|
1406
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1407
|
+
"select",
|
|
1408
|
+
{
|
|
1409
|
+
value: paymentStatusFilter,
|
|
1410
|
+
onChange: (e) => setPaymentStatusFilter(e.target.value),
|
|
1411
|
+
className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-[160px]",
|
|
1412
|
+
"aria-label": "Filter by payment status",
|
|
1413
|
+
children: [
|
|
1414
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All statuses" }),
|
|
1415
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "pending", children: "Pending" }),
|
|
1416
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "requires_more", children: "Requires more" }),
|
|
1417
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "error", children: "Error" }),
|
|
1418
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
1419
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
1420
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
1421
|
+
]
|
|
1422
|
+
}
|
|
1423
|
+
),
|
|
1424
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1425
|
+
ui.Input,
|
|
1426
|
+
{
|
|
1427
|
+
type: "date",
|
|
1428
|
+
placeholder: "From",
|
|
1429
|
+
value: dateFrom,
|
|
1430
|
+
onChange: (e) => setDateFrom(e.target.value),
|
|
1431
|
+
className: "md:max-w-[140px]",
|
|
1432
|
+
"aria-label": "Date from"
|
|
1433
|
+
}
|
|
1434
|
+
),
|
|
1435
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1436
|
+
ui.Input,
|
|
1437
|
+
{
|
|
1438
|
+
type: "date",
|
|
1439
|
+
placeholder: "To",
|
|
1440
|
+
value: dateTo,
|
|
1441
|
+
onChange: (e) => setDateTo(e.target.value),
|
|
1442
|
+
className: "md:max-w-[140px]",
|
|
1443
|
+
"aria-label": "Date to"
|
|
1444
|
+
}
|
|
1445
|
+
),
|
|
1446
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1447
|
+
ui.Input,
|
|
1448
|
+
{
|
|
1449
|
+
placeholder: "Amount min",
|
|
1450
|
+
value: amountMin,
|
|
1451
|
+
onChange: (e) => setAmountMin(e.target.value),
|
|
1452
|
+
type: "number",
|
|
1453
|
+
min: 0,
|
|
1454
|
+
className: "md:max-w-[100px]",
|
|
1455
|
+
"aria-label": "Refund amount minimum"
|
|
1456
|
+
}
|
|
1457
|
+
),
|
|
1458
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1459
|
+
ui.Input,
|
|
1460
|
+
{
|
|
1461
|
+
placeholder: "Amount max",
|
|
1462
|
+
value: amountMax,
|
|
1463
|
+
onChange: (e) => setAmountMax(e.target.value),
|
|
1464
|
+
type: "number",
|
|
1465
|
+
min: 0,
|
|
1466
|
+
className: "md:max-w-[100px]",
|
|
1467
|
+
"aria-label": "Refund amount maximum"
|
|
1468
|
+
}
|
|
1469
|
+
)
|
|
1470
|
+
] }) }),
|
|
1471
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1472
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1473
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", onClick: () => loadRefunds(0, true), children: "Try again" }) })
|
|
1022
1474
|
] }) : null,
|
|
1023
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading
|
|
1024
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No
|
|
1025
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "
|
|
1026
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-
|
|
1475
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading refunds…" }) }) : items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-dashed border-ui-border-strong p-10 text-center", children: [
|
|
1476
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No refunds yet" }),
|
|
1477
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Refund records will appear here." })
|
|
1478
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full overflow-x-auto rounded-xl border border-ui-border-base", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full table-fixed divide-y divide-ui-border-base", style: { minWidth: 0 }, children: [
|
|
1027
1479
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1028
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
1029
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
1030
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
1031
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
1032
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
1033
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
1034
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
1480
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Refund ID" }),
|
|
1481
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Order ID" }),
|
|
1482
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Payment ID" }),
|
|
1483
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[8%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Amount" }),
|
|
1484
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[6%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Currency" }),
|
|
1485
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[10%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Provider" }),
|
|
1486
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[10%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Payment Status" }),
|
|
1487
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[14%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Note" }),
|
|
1488
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[11%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Created" }),
|
|
1489
|
+
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "w-[8%] min-w-0 px-3 py-3 text-left text-xs font-semibold uppercase tracking-wide text-ui-fg-muted", children: "Actions" })
|
|
1035
1490
|
] }) }),
|
|
1036
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((
|
|
1491
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((r) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1037
1492
|
"tr",
|
|
1038
1493
|
{
|
|
1039
|
-
className: "hover:bg-ui-bg-subtle/60
|
|
1040
|
-
onClick: () => navigate(`/
|
|
1494
|
+
className: "cursor-pointer hover:bg-ui-bg-subtle/60",
|
|
1495
|
+
onClick: () => navigate(`/refunds/${r.refund_id}`),
|
|
1041
1496
|
children: [
|
|
1042
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-
|
|
1043
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-
|
|
1044
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-
|
|
1045
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-
|
|
1497
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 font-mono text-sm text-ui-fg-base", title: r.refund_id, children: r.refund_id }),
|
|
1498
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 font-medium text-ui-fg-base", title: r.order_id ?? void 0, children: r.order_id ?? "—" }),
|
|
1499
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 font-mono text-sm text-ui-fg-subtle", title: r.payment_id, children: r.payment_id }),
|
|
1500
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", children: displayAmount(r) }),
|
|
1501
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle uppercase", children: r.currency_code || "—" }),
|
|
1502
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", title: r.provider_id || void 0, children: r.provider_id || "—" }),
|
|
1503
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1046
1504
|
ui.Badge,
|
|
1047
1505
|
{
|
|
1048
1506
|
size: "2xsmall",
|
|
1049
|
-
className: `uppercase ${getStatusBadgeClass$5(
|
|
1050
|
-
children:
|
|
1051
|
-
}
|
|
1052
|
-
) }),
|
|
1053
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
|
|
1054
|
-
const amount = returnOrder.refund_amount;
|
|
1055
|
-
if (amount == null || amount === void 0) {
|
|
1056
|
-
return "—";
|
|
1507
|
+
className: `uppercase ${getStatusBadgeClass$5(displayStatus(r))}`,
|
|
1508
|
+
children: displayStatus(r) !== "—" ? displayStatus(r).replace(/_/g, " ") : "—"
|
|
1057
1509
|
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
})() }),
|
|
1062
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(returnOrder.created_at).toLocaleDateString("en-US", {
|
|
1063
|
-
year: "numeric",
|
|
1510
|
+
) }),
|
|
1511
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", title: r.note ?? void 0, children: r.note ?? "—" }),
|
|
1512
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle text-xs", children: new Date(r.created_at).toLocaleDateString("en-US", {
|
|
1064
1513
|
month: "short",
|
|
1065
1514
|
day: "numeric",
|
|
1066
1515
|
hour: "numeric",
|
|
1067
1516
|
minute: "2-digit",
|
|
1068
1517
|
hour12: true
|
|
1069
1518
|
}) }),
|
|
1070
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
e
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1519
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 px-3 py-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-1", children: [
|
|
1520
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1521
|
+
ui.Button,
|
|
1522
|
+
{
|
|
1523
|
+
variant: "transparent",
|
|
1524
|
+
size: "small",
|
|
1525
|
+
onClick: (e) => {
|
|
1526
|
+
e.stopPropagation();
|
|
1527
|
+
navigate(`/refunds/${r.refund_id}`);
|
|
1528
|
+
},
|
|
1529
|
+
children: "Details"
|
|
1530
|
+
}
|
|
1531
|
+
),
|
|
1532
|
+
r.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1533
|
+
ui.Button,
|
|
1534
|
+
{
|
|
1535
|
+
variant: "transparent",
|
|
1536
|
+
size: "small",
|
|
1537
|
+
onClick: (e) => {
|
|
1538
|
+
e.stopPropagation();
|
|
1539
|
+
navigate(`/orders/${r.order_id}`);
|
|
1540
|
+
},
|
|
1541
|
+
children: "Order"
|
|
1542
|
+
}
|
|
1543
|
+
) : null
|
|
1544
|
+
] }) })
|
|
1082
1545
|
]
|
|
1083
1546
|
},
|
|
1084
|
-
|
|
1547
|
+
r.refund_id
|
|
1085
1548
|
)) })
|
|
1086
1549
|
] }) }),
|
|
1087
1550
|
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1089,15 +1552,15 @@ const ReturnsPage = () => {
|
|
|
1089
1552
|
{
|
|
1090
1553
|
variant: "secondary",
|
|
1091
1554
|
isLoading: isFetchingMore,
|
|
1092
|
-
onClick: () =>
|
|
1555
|
+
onClick: () => loadRefunds(offset, false),
|
|
1093
1556
|
children: "Load more"
|
|
1094
1557
|
}
|
|
1095
1558
|
) }) : null
|
|
1096
1559
|
] }) });
|
|
1097
1560
|
};
|
|
1098
1561
|
const config$5 = adminSdk.defineRouteConfig({
|
|
1099
|
-
label: "
|
|
1100
|
-
icon: icons.
|
|
1562
|
+
label: "Refunds",
|
|
1563
|
+
icon: icons.Receipt
|
|
1101
1564
|
});
|
|
1102
1565
|
const useDebounce = (value, delay) => {
|
|
1103
1566
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
@@ -1330,11 +1793,11 @@ const config$4 = adminSdk.defineRouteConfig({
|
|
|
1330
1793
|
icon: icons.ArrowPath
|
|
1331
1794
|
});
|
|
1332
1795
|
const getStatusBadgeClass$3 = (status) => {
|
|
1333
|
-
const
|
|
1334
|
-
if (
|
|
1335
|
-
if (
|
|
1336
|
-
if (
|
|
1337
|
-
if (
|
|
1796
|
+
const s2 = status.toLowerCase();
|
|
1797
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1798
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1799
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1800
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1338
1801
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1339
1802
|
};
|
|
1340
1803
|
const PaymentDetailPage = () => {
|
|
@@ -1370,7 +1833,7 @@ const PaymentDetailPage = () => {
|
|
|
1370
1833
|
const displayStatus = detail ? (detail.payment_id != null && detail.payment_status != null && detail.payment_status !== "" ? detail.payment_status : detail.session_status ?? "") || "—" : "";
|
|
1371
1834
|
const sessionStatusRaw = (detail == null ? void 0 : detail.session_status) ?? "—";
|
|
1372
1835
|
const paymentStatusRaw = (detail == null ? void 0 : detail.payment_id) != null ? (detail == null ? void 0 : detail.payment_status) ?? "—" : "—";
|
|
1373
|
-
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${
|
|
1836
|
+
const displayAmount = detail ? `${(detail.currency_code ?? "USD").toUpperCase()} ${Number(detail.amount)}` : "";
|
|
1374
1837
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-4xl flex-col gap-6 p-6", children: [
|
|
1375
1838
|
/* @__PURE__ */ jsxRuntime.jsx("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1376
1839
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/payments"), children: "← Payments" }),
|
|
@@ -1425,222 +1888,30 @@ const PaymentDetailPage = () => {
|
|
|
1425
1888
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
1426
1889
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
1427
1890
|
] }),
|
|
1428
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1429
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
1430
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
1431
|
-
year: "numeric",
|
|
1432
|
-
month: "short",
|
|
1433
|
-
day: "numeric",
|
|
1434
|
-
hour: "numeric",
|
|
1435
|
-
minute: "2-digit",
|
|
1436
|
-
hour12: true
|
|
1437
|
-
}) })
|
|
1438
|
-
] })
|
|
1439
|
-
] }) }),
|
|
1440
|
-
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1441
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
1442
|
-
/* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.data, null, 2) })
|
|
1443
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-xl border border-ui-border-base p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No provider data for this session." }) })
|
|
1444
|
-
] }) : null
|
|
1445
|
-
] }) });
|
|
1446
|
-
};
|
|
1447
|
-
const config$3 = adminSdk.defineRouteConfig({
|
|
1448
|
-
label: "Payment details",
|
|
1449
|
-
icon: icons.CreditCard
|
|
1450
|
-
});
|
|
1451
|
-
const getStatusBadgeClass$2 = (status) => {
|
|
1452
|
-
const s = status.toLowerCase();
|
|
1453
|
-
if (s === "captured" || s === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1454
|
-
if (s === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1455
|
-
if (s === "error" || s === "canceled" || s === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1456
|
-
if (s === "pending" || s === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1457
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1458
|
-
};
|
|
1459
|
-
const formatAmount = (value) => {
|
|
1460
|
-
return (value / 100).toFixed(2);
|
|
1461
|
-
};
|
|
1462
|
-
const RefundDetailPage = () => {
|
|
1463
|
-
var _a, _b, _c;
|
|
1464
|
-
const navigate = reactRouterDom.useNavigate();
|
|
1465
|
-
const params = reactRouterDom.useParams();
|
|
1466
|
-
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
1467
|
-
const [detail, setDetail] = react.useState(null);
|
|
1468
|
-
const [loading, setLoading] = react.useState(!!id);
|
|
1469
|
-
const [error, setError] = react.useState(null);
|
|
1470
|
-
const [gatewayExpanded, setGatewayExpanded] = react.useState(false);
|
|
1471
|
-
react.useEffect(() => {
|
|
1472
|
-
if (!id) {
|
|
1473
|
-
setLoading(false);
|
|
1474
|
-
return;
|
|
1475
|
-
}
|
|
1476
|
-
let cancelled = false;
|
|
1477
|
-
setLoading(true);
|
|
1478
|
-
setError(null);
|
|
1479
|
-
fetch(`/admin/refunds/${id}`, { credentials: "include" }).then((res) => {
|
|
1480
|
-
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
1481
|
-
return res.json();
|
|
1482
|
-
}).then((data) => {
|
|
1483
|
-
if (!cancelled) setDetail(data);
|
|
1484
|
-
}).catch((e) => {
|
|
1485
|
-
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
1486
|
-
}).finally(() => {
|
|
1487
|
-
if (!cancelled) setLoading(false);
|
|
1488
|
-
});
|
|
1489
|
-
return () => {
|
|
1490
|
-
cancelled = true;
|
|
1491
|
-
};
|
|
1492
|
-
}, [id]);
|
|
1493
|
-
const paymentStatus = ((_b = detail == null ? void 0 : detail.payment) == null ? void 0 : _b.status) ?? "—";
|
|
1494
|
-
const hasGatewayData = ((_c = detail == null ? void 0 : detail.payment) == null ? void 0 : _c.payment_data) && typeof detail.payment.payment_data === "object" && Object.keys(detail.payment.payment_data).length > 0;
|
|
1495
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-4xl flex-col gap-6 p-6", children: [
|
|
1496
|
-
/* @__PURE__ */ jsxRuntime.jsx("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
1497
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/refunds"), children: "← Refunds" }),
|
|
1498
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refund details" }),
|
|
1499
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle font-mono", children: id ?? "—" })
|
|
1500
|
-
] }) }),
|
|
1501
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1502
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1503
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/refunds"), children: "Back to list" })
|
|
1504
|
-
] }) : loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading…" }) }) : detail ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
1505
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1506
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Refund summary" }),
|
|
1507
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
1508
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1509
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund ID" }),
|
|
1510
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.id })
|
|
1511
|
-
] }),
|
|
1512
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1513
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
1514
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.refund.amount) })
|
|
1515
|
-
] }),
|
|
1516
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1517
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Note" }),
|
|
1518
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.refund.note ?? "—" })
|
|
1519
|
-
] }),
|
|
1520
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1521
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created at" }),
|
|
1522
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.refund.created_at).toLocaleDateString("en-US", {
|
|
1523
|
-
year: "numeric",
|
|
1524
|
-
month: "short",
|
|
1525
|
-
day: "numeric",
|
|
1526
|
-
hour: "numeric",
|
|
1527
|
-
minute: "2-digit",
|
|
1528
|
-
hour12: true
|
|
1529
|
-
}) })
|
|
1530
|
-
] }),
|
|
1531
|
-
detail.refund.created_by ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1532
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created by" }),
|
|
1533
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.created_by })
|
|
1534
|
-
] }) : null
|
|
1535
|
-
] })
|
|
1536
|
-
] }),
|
|
1537
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1538
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Payment summary" }),
|
|
1539
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
1540
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1541
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment amount" }),
|
|
1542
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.payment_amount) })
|
|
1543
|
-
] }),
|
|
1544
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1545
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Captured amount" }),
|
|
1546
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.captured_amount) })
|
|
1547
|
-
] }),
|
|
1548
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1549
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refunded amount" }),
|
|
1550
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.refunded_amount) })
|
|
1551
|
-
] }),
|
|
1552
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1553
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
1554
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment.provider_id || "—" })
|
|
1555
|
-
] }),
|
|
1556
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1557
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
1558
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1559
|
-
ui.Badge,
|
|
1560
|
-
{
|
|
1561
|
-
size: "2xsmall",
|
|
1562
|
-
className: `uppercase ${getStatusBadgeClass$2(paymentStatus)}`,
|
|
1563
|
-
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
1564
|
-
}
|
|
1565
|
-
) })
|
|
1566
|
-
] }),
|
|
1567
|
-
detail.computed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1568
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1569
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
1570
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
1571
|
-
] }),
|
|
1572
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1573
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
1574
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
1575
|
-
] }),
|
|
1576
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1577
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
1578
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "mt-1 block", children: [
|
|
1579
|
-
detail.computed.refund_percentage.toFixed(1),
|
|
1580
|
-
"%"
|
|
1581
|
-
] })
|
|
1582
|
-
] })
|
|
1583
|
-
] }) : null
|
|
1584
|
-
] })
|
|
1585
|
-
] }),
|
|
1586
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1587
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Order summary" }),
|
|
1588
|
-
detail.order ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
1589
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1590
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
1591
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1592
|
-
ui.Button,
|
|
1593
|
-
{
|
|
1594
|
-
variant: "transparent",
|
|
1595
|
-
size: "small",
|
|
1596
|
-
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
1597
|
-
children: detail.order.order_number ?? detail.order.order_id
|
|
1598
|
-
}
|
|
1599
|
-
) })
|
|
1600
|
-
] }),
|
|
1601
|
-
detail.order.total != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1602
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
1603
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
1604
|
-
] }) : null,
|
|
1605
|
-
detail.order.customer_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1606
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
1607
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
1608
|
-
] }) : null,
|
|
1609
|
-
detail.order.region ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1610
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
1611
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.region })
|
|
1612
|
-
] }) : null,
|
|
1613
|
-
detail.order.fulfillment_status ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1614
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
1615
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
1616
|
-
] }) : null
|
|
1617
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
1618
|
-
] }),
|
|
1619
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1620
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1621
|
-
"button",
|
|
1622
|
-
{
|
|
1623
|
-
type: "button",
|
|
1624
|
-
className: "flex w-full items-center justify-between text-left",
|
|
1625
|
-
onClick: () => setGatewayExpanded((prev) => !prev),
|
|
1626
|
-
"aria-expanded": gatewayExpanded,
|
|
1627
|
-
"aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
|
|
1628
|
-
children: [
|
|
1629
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
|
|
1630
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
|
|
1631
|
-
]
|
|
1632
|
-
}
|
|
1633
|
-
),
|
|
1634
|
-
gatewayExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: hasGatewayData ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.payment.payment_data, null, 2) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No gateway payload for this payment." }) })
|
|
1635
|
-
] })
|
|
1891
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1892
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
1893
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
1894
|
+
year: "numeric",
|
|
1895
|
+
month: "short",
|
|
1896
|
+
day: "numeric",
|
|
1897
|
+
hour: "numeric",
|
|
1898
|
+
minute: "2-digit",
|
|
1899
|
+
hour12: true
|
|
1900
|
+
}) })
|
|
1901
|
+
] })
|
|
1902
|
+
] }) }),
|
|
1903
|
+
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1904
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
1905
|
+
/* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.data, null, 2) })
|
|
1906
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-xl border border-ui-border-base p-6", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No provider data for this session." }) })
|
|
1636
1907
|
] }) : null
|
|
1637
1908
|
] }) });
|
|
1638
1909
|
};
|
|
1639
|
-
const config$
|
|
1640
|
-
label: "
|
|
1641
|
-
icon: icons.
|
|
1910
|
+
const config$3 = adminSdk.defineRouteConfig({
|
|
1911
|
+
label: "Payment details",
|
|
1912
|
+
icon: icons.CreditCard
|
|
1642
1913
|
});
|
|
1643
|
-
const getStatusBadgeClass$
|
|
1914
|
+
const getStatusBadgeClass$2 = (status) => {
|
|
1644
1915
|
const statusLower = status.toLowerCase();
|
|
1645
1916
|
if (statusLower === "requested") {
|
|
1646
1917
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -1774,7 +2045,7 @@ const ReturnDetailPage = () => {
|
|
|
1774
2045
|
ui.Badge,
|
|
1775
2046
|
{
|
|
1776
2047
|
size: "small",
|
|
1777
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2048
|
+
className: `uppercase ${getStatusBadgeClass$2(returnOrder.status)}`,
|
|
1778
2049
|
children: returnOrder.status.replace(/_/g, " ")
|
|
1779
2050
|
}
|
|
1780
2051
|
)
|
|
@@ -1856,7 +2127,7 @@ const ReturnDetailPage = () => {
|
|
|
1856
2127
|
ui.Badge,
|
|
1857
2128
|
{
|
|
1858
2129
|
size: "2xsmall",
|
|
1859
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2130
|
+
className: `uppercase ${getStatusBadgeClass$2(entry.status)}`,
|
|
1860
2131
|
children: entry.status.replace(/_/g, " ")
|
|
1861
2132
|
}
|
|
1862
2133
|
) }),
|
|
@@ -1914,10 +2185,202 @@ const ReturnDetailPage = () => {
|
|
|
1914
2185
|
updateSuccess && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-ui-border-success bg-ui-bg-success-subtle p-4", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-success", children: "Action completed successfully" }) })
|
|
1915
2186
|
] }) });
|
|
1916
2187
|
};
|
|
1917
|
-
const config$
|
|
2188
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
1918
2189
|
label: "Return Order Details",
|
|
1919
2190
|
icon: icons.CheckCircle
|
|
1920
2191
|
});
|
|
2192
|
+
const getStatusBadgeClass$1 = (status) => {
|
|
2193
|
+
const s2 = status.toLowerCase();
|
|
2194
|
+
if (s2 === "captured" || s2 === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
2195
|
+
if (s2 === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
2196
|
+
if (s2 === "error" || s2 === "canceled" || s2 === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
2197
|
+
if (s2 === "pending" || s2 === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
2198
|
+
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
2199
|
+
};
|
|
2200
|
+
const formatAmount = (value) => {
|
|
2201
|
+
return String(value);
|
|
2202
|
+
};
|
|
2203
|
+
const RefundDetailPage = () => {
|
|
2204
|
+
var _a, _b, _c;
|
|
2205
|
+
const navigate = reactRouterDom.useNavigate();
|
|
2206
|
+
const params = reactRouterDom.useParams();
|
|
2207
|
+
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
2208
|
+
const [detail, setDetail] = react.useState(null);
|
|
2209
|
+
const [loading, setLoading] = react.useState(!!id);
|
|
2210
|
+
const [error, setError] = react.useState(null);
|
|
2211
|
+
const [gatewayExpanded, setGatewayExpanded] = react.useState(false);
|
|
2212
|
+
react.useEffect(() => {
|
|
2213
|
+
if (!id) {
|
|
2214
|
+
setLoading(false);
|
|
2215
|
+
return;
|
|
2216
|
+
}
|
|
2217
|
+
let cancelled = false;
|
|
2218
|
+
setLoading(true);
|
|
2219
|
+
setError(null);
|
|
2220
|
+
fetch(`/admin/refunds/${id}`, { credentials: "include" }).then((res) => {
|
|
2221
|
+
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
2222
|
+
return res.json();
|
|
2223
|
+
}).then((data) => {
|
|
2224
|
+
if (!cancelled) setDetail(data);
|
|
2225
|
+
}).catch((e) => {
|
|
2226
|
+
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
2227
|
+
}).finally(() => {
|
|
2228
|
+
if (!cancelled) setLoading(false);
|
|
2229
|
+
});
|
|
2230
|
+
return () => {
|
|
2231
|
+
cancelled = true;
|
|
2232
|
+
};
|
|
2233
|
+
}, [id]);
|
|
2234
|
+
const paymentStatus = ((_b = detail == null ? void 0 : detail.payment) == null ? void 0 : _b.status) ?? "—";
|
|
2235
|
+
const hasGatewayData = ((_c = detail == null ? void 0 : detail.payment) == null ? void 0 : _c.payment_data) && typeof detail.payment.payment_data === "object" && Object.keys(detail.payment.payment_data).length > 0;
|
|
2236
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full p-6", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "mx-auto flex w-full max-w-4xl flex-col gap-6 p-6", children: [
|
|
2237
|
+
/* @__PURE__ */ jsxRuntime.jsx("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
2238
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/refunds"), children: "← Refunds" }),
|
|
2239
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refund details" }),
|
|
2240
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle font-mono", children: id ?? "—" })
|
|
2241
|
+
] }) }),
|
|
2242
|
+
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
2243
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
2244
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/refunds"), children: "Back to list" })
|
|
2245
|
+
] }) : loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading…" }) }) : detail ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-6", children: [
|
|
2246
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2247
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Refund summary" }),
|
|
2248
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
2249
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2250
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund ID" }),
|
|
2251
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.id })
|
|
2252
|
+
] }),
|
|
2253
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2254
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
2255
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.refund.amount) })
|
|
2256
|
+
] }),
|
|
2257
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2258
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Note" }),
|
|
2259
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.refund.note ?? "—" })
|
|
2260
|
+
] }),
|
|
2261
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2262
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created at" }),
|
|
2263
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.refund.created_at).toLocaleDateString("en-US", {
|
|
2264
|
+
year: "numeric",
|
|
2265
|
+
month: "short",
|
|
2266
|
+
day: "numeric",
|
|
2267
|
+
hour: "numeric",
|
|
2268
|
+
minute: "2-digit",
|
|
2269
|
+
hour12: true
|
|
2270
|
+
}) })
|
|
2271
|
+
] }),
|
|
2272
|
+
detail.refund.created_by ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2273
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created by" }),
|
|
2274
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.created_by })
|
|
2275
|
+
] }) : null
|
|
2276
|
+
] })
|
|
2277
|
+
] }),
|
|
2278
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2279
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Payment summary" }),
|
|
2280
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
2281
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2282
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment amount" }),
|
|
2283
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.payment_amount) })
|
|
2284
|
+
] }),
|
|
2285
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2286
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Captured amount" }),
|
|
2287
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.captured_amount) })
|
|
2288
|
+
] }),
|
|
2289
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2290
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refunded amount" }),
|
|
2291
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.refunded_amount) })
|
|
2292
|
+
] }),
|
|
2293
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2294
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
2295
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment.provider_id || "—" })
|
|
2296
|
+
] }),
|
|
2297
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2298
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
2299
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2300
|
+
ui.Badge,
|
|
2301
|
+
{
|
|
2302
|
+
size: "2xsmall",
|
|
2303
|
+
className: `uppercase ${getStatusBadgeClass$1(paymentStatus)}`,
|
|
2304
|
+
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
2305
|
+
}
|
|
2306
|
+
) })
|
|
2307
|
+
] }),
|
|
2308
|
+
detail.computed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2309
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2310
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
2311
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
2312
|
+
] }),
|
|
2313
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2314
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
2315
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
2316
|
+
] }),
|
|
2317
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2318
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
2319
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "mt-1 block", children: [
|
|
2320
|
+
detail.computed.refund_percentage.toFixed(1),
|
|
2321
|
+
"%"
|
|
2322
|
+
] })
|
|
2323
|
+
] })
|
|
2324
|
+
] }) : null
|
|
2325
|
+
] })
|
|
2326
|
+
] }),
|
|
2327
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2328
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Order summary" }),
|
|
2329
|
+
detail.order ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
2330
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2331
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
2332
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2333
|
+
ui.Button,
|
|
2334
|
+
{
|
|
2335
|
+
variant: "transparent",
|
|
2336
|
+
size: "small",
|
|
2337
|
+
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
2338
|
+
children: detail.order.order_number ?? detail.order.order_id
|
|
2339
|
+
}
|
|
2340
|
+
) })
|
|
2341
|
+
] }),
|
|
2342
|
+
detail.order.total != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2343
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
2344
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
2345
|
+
] }) : null,
|
|
2346
|
+
detail.order.customer_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2347
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
2348
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
2349
|
+
] }) : null,
|
|
2350
|
+
detail.order.region ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2351
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
2352
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.region })
|
|
2353
|
+
] }) : null,
|
|
2354
|
+
detail.order.fulfillment_status ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2355
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
2356
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
2357
|
+
] }) : null
|
|
2358
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
2359
|
+
] }),
|
|
2360
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
2361
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2362
|
+
"button",
|
|
2363
|
+
{
|
|
2364
|
+
type: "button",
|
|
2365
|
+
className: "flex w-full items-center justify-between text-left",
|
|
2366
|
+
onClick: () => setGatewayExpanded((prev) => !prev),
|
|
2367
|
+
"aria-expanded": gatewayExpanded,
|
|
2368
|
+
"aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
|
|
2369
|
+
children: [
|
|
2370
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
|
|
2371
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
|
|
2372
|
+
]
|
|
2373
|
+
}
|
|
2374
|
+
),
|
|
2375
|
+
gatewayExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4", children: hasGatewayData ? /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "text-xs bg-ui-bg-subtle p-4 rounded-lg overflow-auto max-h-96", children: JSON.stringify(detail.payment.payment_data, null, 2) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No gateway payload for this payment." }) })
|
|
2376
|
+
] })
|
|
2377
|
+
] }) : null
|
|
2378
|
+
] }) });
|
|
2379
|
+
};
|
|
2380
|
+
const config$1 = adminSdk.defineRouteConfig({
|
|
2381
|
+
label: "Refund details",
|
|
2382
|
+
icon: icons.Receipt
|
|
2383
|
+
});
|
|
1921
2384
|
const getStatusBadgeClass = (status) => {
|
|
1922
2385
|
const statusLower = status.toLowerCase();
|
|
1923
2386
|
if (statusLower === "requested") {
|
|
@@ -2199,6 +2662,10 @@ const config = adminSdk.defineRouteConfig({
|
|
|
2199
2662
|
});
|
|
2200
2663
|
const i18nTranslations0 = {};
|
|
2201
2664
|
const widgetModule = { widgets: [
|
|
2665
|
+
{
|
|
2666
|
+
Component: OrderGiftItemsWidget,
|
|
2667
|
+
zone: ["order.details.side.after"]
|
|
2668
|
+
},
|
|
2202
2669
|
{
|
|
2203
2670
|
Component: OrderRefundContextWidget,
|
|
2204
2671
|
zone: ["order.details.after"]
|
|
@@ -2210,14 +2677,14 @@ const routeModule = {
|
|
|
2210
2677
|
Component: PaymentsPage,
|
|
2211
2678
|
path: "/payments"
|
|
2212
2679
|
},
|
|
2213
|
-
{
|
|
2214
|
-
Component: RefundsPage,
|
|
2215
|
-
path: "/refunds"
|
|
2216
|
-
},
|
|
2217
2680
|
{
|
|
2218
2681
|
Component: ReturnsPage,
|
|
2219
2682
|
path: "/returns"
|
|
2220
2683
|
},
|
|
2684
|
+
{
|
|
2685
|
+
Component: RefundsPage,
|
|
2686
|
+
path: "/refunds"
|
|
2687
|
+
},
|
|
2221
2688
|
{
|
|
2222
2689
|
Component: SwapsPage,
|
|
2223
2690
|
path: "/swaps"
|
|
@@ -2226,14 +2693,14 @@ const routeModule = {
|
|
|
2226
2693
|
Component: PaymentDetailPage,
|
|
2227
2694
|
path: "/payments/:id"
|
|
2228
2695
|
},
|
|
2229
|
-
{
|
|
2230
|
-
Component: RefundDetailPage,
|
|
2231
|
-
path: "/refunds/:id"
|
|
2232
|
-
},
|
|
2233
2696
|
{
|
|
2234
2697
|
Component: ReturnDetailPage,
|
|
2235
2698
|
path: "/returns/:id"
|
|
2236
2699
|
},
|
|
2700
|
+
{
|
|
2701
|
+
Component: RefundDetailPage,
|
|
2702
|
+
path: "/refunds/:id"
|
|
2703
|
+
},
|
|
2237
2704
|
{
|
|
2238
2705
|
Component: SwapDetailPage,
|
|
2239
2706
|
path: "/swaps/:id"
|
|
@@ -2248,10 +2715,16 @@ const menuItemModule = {
|
|
|
2248
2715
|
path: "/payments",
|
|
2249
2716
|
nested: void 0
|
|
2250
2717
|
},
|
|
2718
|
+
{
|
|
2719
|
+
label: config$5.label,
|
|
2720
|
+
icon: config$5.icon,
|
|
2721
|
+
path: "/refunds",
|
|
2722
|
+
nested: void 0
|
|
2723
|
+
},
|
|
2251
2724
|
{
|
|
2252
2725
|
label: config$6.label,
|
|
2253
2726
|
icon: config$6.icon,
|
|
2254
|
-
path: "/
|
|
2727
|
+
path: "/returns",
|
|
2255
2728
|
nested: void 0
|
|
2256
2729
|
},
|
|
2257
2730
|
{
|
|
@@ -2260,22 +2733,22 @@ const menuItemModule = {
|
|
|
2260
2733
|
path: "/swaps",
|
|
2261
2734
|
nested: void 0
|
|
2262
2735
|
},
|
|
2263
|
-
{
|
|
2264
|
-
label: config$5.label,
|
|
2265
|
-
icon: config$5.icon,
|
|
2266
|
-
path: "/returns",
|
|
2267
|
-
nested: void 0
|
|
2268
|
-
},
|
|
2269
2736
|
{
|
|
2270
2737
|
label: config$3.label,
|
|
2271
2738
|
icon: config$3.icon,
|
|
2272
2739
|
path: "/payments/:id",
|
|
2273
2740
|
nested: void 0
|
|
2274
2741
|
},
|
|
2742
|
+
{
|
|
2743
|
+
label: config$1.label,
|
|
2744
|
+
icon: config$1.icon,
|
|
2745
|
+
path: "/refunds/:id",
|
|
2746
|
+
nested: void 0
|
|
2747
|
+
},
|
|
2275
2748
|
{
|
|
2276
2749
|
label: config$2.label,
|
|
2277
2750
|
icon: config$2.icon,
|
|
2278
|
-
path: "/
|
|
2751
|
+
path: "/returns/:id",
|
|
2279
2752
|
nested: void 0
|
|
2280
2753
|
},
|
|
2281
2754
|
{
|
|
@@ -2283,12 +2756,6 @@ const menuItemModule = {
|
|
|
2283
2756
|
icon: config.icon,
|
|
2284
2757
|
path: "/swaps/:id",
|
|
2285
2758
|
nested: void 0
|
|
2286
|
-
},
|
|
2287
|
-
{
|
|
2288
|
-
label: config$1.label,
|
|
2289
|
-
icon: config$1.icon,
|
|
2290
|
-
path: "/returns/:id",
|
|
2291
|
-
nested: void 0
|
|
2292
2759
|
}
|
|
2293
2760
|
]
|
|
2294
2761
|
};
|