order-management 0.0.60 → 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 +1100 -631
- package/.medusa/server/src/admin/index.mjs +1102 -633
- 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,8 +901,8 @@ 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
908
|
const code = (t.currency_code ?? "USD").toUpperCase();
|
|
@@ -579,275 +1044,212 @@ const useDebounce$2 = (value, delay) => {
|
|
|
579
1044
|
return debouncedValue;
|
|
580
1045
|
};
|
|
581
1046
|
const getStatusBadgeClass$6 = (status) => {
|
|
582
|
-
const
|
|
583
|
-
if (
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
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
|
+
}
|
|
587
1063
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
588
1064
|
};
|
|
589
|
-
const
|
|
1065
|
+
const ReturnsPage = () => {
|
|
590
1066
|
const navigate = reactRouterDom.useNavigate();
|
|
591
1067
|
const [items, setItems] = react.useState([]);
|
|
592
|
-
const [
|
|
593
|
-
const
|
|
594
|
-
const [
|
|
595
|
-
const
|
|
596
|
-
const debouncedProvider = useDebounce$2(providerSearch, 300);
|
|
597
|
-
const [currencySearch, setCurrencySearch] = react.useState("");
|
|
598
|
-
const debouncedCurrency = useDebounce$2(currencySearch, 300);
|
|
599
|
-
const [dateFrom, setDateFrom] = react.useState("");
|
|
600
|
-
const [dateTo, setDateTo] = react.useState("");
|
|
601
|
-
const [amountMin, setAmountMin] = react.useState("");
|
|
602
|
-
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);
|
|
603
1072
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
604
1073
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
605
1074
|
const [error, setError] = react.useState(null);
|
|
606
1075
|
const [offset, setOffset] = react.useState(0);
|
|
607
1076
|
const [count, setCount] = react.useState(0);
|
|
608
1077
|
const limit = 50;
|
|
609
|
-
const
|
|
610
|
-
async (nextOffset, replace) => {
|
|
1078
|
+
const loadReturns = react.useCallback(
|
|
1079
|
+
async (nextOffset, replace = false) => {
|
|
1080
|
+
var _a;
|
|
611
1081
|
try {
|
|
612
|
-
if (replace)
|
|
613
|
-
|
|
1082
|
+
if (replace) {
|
|
1083
|
+
setIsLoading(true);
|
|
1084
|
+
} else {
|
|
1085
|
+
setIsFetchingMore(true);
|
|
1086
|
+
}
|
|
614
1087
|
setError(null);
|
|
615
1088
|
const params = new URLSearchParams();
|
|
616
1089
|
params.set("limit", String(limit));
|
|
617
1090
|
params.set("offset", String(nextOffset));
|
|
618
|
-
if (
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
if (
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
const response = await fetch(
|
|
629
|
-
|
|
630
|
-
|
|
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
|
+
);
|
|
631
1105
|
if (!response.ok) {
|
|
632
|
-
const
|
|
633
|
-
throw new Error(
|
|
1106
|
+
const message = await response.text();
|
|
1107
|
+
throw new Error(message || "Unable to load return orders");
|
|
634
1108
|
}
|
|
635
1109
|
const payload = await response.json();
|
|
636
|
-
const list = payload.refunds ?? [];
|
|
637
1110
|
setCount(payload.count ?? 0);
|
|
638
|
-
setOffset(nextOffset +
|
|
639
|
-
setItems(
|
|
640
|
-
|
|
641
|
-
|
|
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);
|
|
642
1118
|
} finally {
|
|
643
1119
|
setIsLoading(false);
|
|
644
1120
|
setIsFetchingMore(false);
|
|
645
1121
|
}
|
|
646
1122
|
},
|
|
647
|
-
[
|
|
648
|
-
debouncedOrderId,
|
|
649
|
-
paymentStatusFilter,
|
|
650
|
-
debouncedProvider,
|
|
651
|
-
debouncedCurrency,
|
|
652
|
-
dateFrom,
|
|
653
|
-
dateTo,
|
|
654
|
-
amountMin,
|
|
655
|
-
amountMax
|
|
656
|
-
]
|
|
1123
|
+
[statusFilter, createdByFilter, debouncedSearchQuery]
|
|
657
1124
|
);
|
|
658
1125
|
react.useEffect(() => {
|
|
659
|
-
void
|
|
660
|
-
}, [
|
|
1126
|
+
void loadReturns(0, true);
|
|
1127
|
+
}, [statusFilter, createdByFilter, debouncedSearchQuery, loadReturns]);
|
|
661
1128
|
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
662
|
-
const
|
|
663
|
-
const
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
const s = r.payment_status ?? "";
|
|
668
|
-
return s !== "" ? s : "—";
|
|
669
|
-
};
|
|
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]);
|
|
670
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: [
|
|
671
1135
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
672
1136
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
673
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
674
|
-
/* @__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" })
|
|
675
1139
|
] }),
|
|
676
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () =>
|
|
1140
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadReturns(0, true), children: "Refresh" })
|
|
677
1141
|
] }),
|
|
678
|
-
/* @__PURE__ */ jsxRuntime.
|
|
679
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
680
|
-
ui.Input,
|
|
681
|
-
{
|
|
682
|
-
placeholder: "Order ID",
|
|
683
|
-
value: orderIdSearch,
|
|
684
|
-
onChange: (e) => setOrderIdSearch(e.target.value),
|
|
685
|
-
className: "md:max-w-[180px]",
|
|
686
|
-
"aria-label": "Filter by order ID"
|
|
687
|
-
}
|
|
688
|
-
),
|
|
1142
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
689
1143
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
690
1144
|
ui.Input,
|
|
691
1145
|
{
|
|
692
|
-
placeholder: "
|
|
693
|
-
value:
|
|
694
|
-
onChange: (
|
|
695
|
-
className: "md:max-w-
|
|
696
|
-
"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"
|
|
697
1150
|
}
|
|
698
1151
|
),
|
|
699
|
-
/* @__PURE__ */ jsxRuntime.
|
|
700
|
-
|
|
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,
|
|
701
1184
|
{
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
className: "md:max-w-[100px]",
|
|
706
|
-
"aria-label": "Filter by currency"
|
|
1185
|
+
variant: "secondary",
|
|
1186
|
+
onClick: () => loadReturns(0, true),
|
|
1187
|
+
children: "Try again"
|
|
707
1188
|
}
|
|
708
|
-
)
|
|
709
|
-
|
|
710
|
-
|
|
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",
|
|
711
1206
|
{
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
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]",
|
|
715
|
-
"aria-label": "Filter by payment status",
|
|
1207
|
+
className: "hover:bg-ui-bg-subtle/60 cursor-pointer",
|
|
1208
|
+
onClick: () => navigate(`/returns/${returnOrder.id}`),
|
|
716
1209
|
children: [
|
|
717
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
718
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
719
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
720
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
721
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "canceled", children: "Canceled" }),
|
|
722
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "authorized", children: "Authorized" }),
|
|
723
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "captured", children: "Captured" })
|
|
724
|
-
]
|
|
725
|
-
}
|
|
726
|
-
),
|
|
727
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
728
|
-
ui.Input,
|
|
729
|
-
{
|
|
730
|
-
type: "date",
|
|
731
|
-
placeholder: "From",
|
|
732
|
-
value: dateFrom,
|
|
733
|
-
onChange: (e) => setDateFrom(e.target.value),
|
|
734
|
-
className: "md:max-w-[140px]",
|
|
735
|
-
"aria-label": "Date from"
|
|
736
|
-
}
|
|
737
|
-
),
|
|
738
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
739
|
-
ui.Input,
|
|
740
|
-
{
|
|
741
|
-
type: "date",
|
|
742
|
-
placeholder: "To",
|
|
743
|
-
value: dateTo,
|
|
744
|
-
onChange: (e) => setDateTo(e.target.value),
|
|
745
|
-
className: "md:max-w-[140px]",
|
|
746
|
-
"aria-label": "Date to"
|
|
747
|
-
}
|
|
748
|
-
),
|
|
749
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
750
|
-
ui.Input,
|
|
751
|
-
{
|
|
752
|
-
placeholder: "Amount min",
|
|
753
|
-
value: amountMin,
|
|
754
|
-
onChange: (e) => setAmountMin(e.target.value),
|
|
755
|
-
type: "number",
|
|
756
|
-
min: 0,
|
|
757
|
-
className: "md:max-w-[100px]",
|
|
758
|
-
"aria-label": "Refund amount minimum"
|
|
759
|
-
}
|
|
760
|
-
),
|
|
761
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
762
|
-
ui.Input,
|
|
763
|
-
{
|
|
764
|
-
placeholder: "Amount max",
|
|
765
|
-
value: amountMax,
|
|
766
|
-
onChange: (e) => setAmountMax(e.target.value),
|
|
767
|
-
type: "number",
|
|
768
|
-
min: 0,
|
|
769
|
-
className: "md:max-w-[100px]",
|
|
770
|
-
"aria-label": "Refund amount maximum"
|
|
771
|
-
}
|
|
772
|
-
)
|
|
773
|
-
] }) }),
|
|
774
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
775
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
776
|
-
/* @__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" }) })
|
|
777
|
-
] }) : null,
|
|
778
|
-
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: [
|
|
779
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No refunds yet" }),
|
|
780
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "Refund records will appear here." })
|
|
781
|
-
] }) : /* @__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: [
|
|
782
|
-
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
783
|
-
/* @__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" }),
|
|
784
|
-
/* @__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" }),
|
|
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: "Payment ID" }),
|
|
786
|
-
/* @__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" }),
|
|
787
|
-
/* @__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" }),
|
|
788
|
-
/* @__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" }),
|
|
789
|
-
/* @__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" }),
|
|
790
|
-
/* @__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" }),
|
|
791
|
-
/* @__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" }),
|
|
792
|
-
/* @__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" })
|
|
793
|
-
] }) }),
|
|
794
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-ui-border-subtle", children: items.map((r) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
795
|
-
"tr",
|
|
796
|
-
{
|
|
797
|
-
className: "cursor-pointer hover:bg-ui-bg-subtle/60",
|
|
798
|
-
onClick: () => navigate(`/refunds/${r.refund_id}`),
|
|
799
|
-
children: [
|
|
800
|
-
/* @__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 }),
|
|
801
|
-
/* @__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 ?? "—" }),
|
|
802
|
-
/* @__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 }),
|
|
803
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle", children: displayAmount(r) }),
|
|
804
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "min-w-0 truncate px-3 py-3 text-ui-fg-subtle uppercase", children: r.currency_code || "—" }),
|
|
805
|
-
/* @__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 || "—" }),
|
|
806
|
-
/* @__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(
|
|
807
1214
|
ui.Badge,
|
|
808
1215
|
{
|
|
809
1216
|
size: "2xsmall",
|
|
810
|
-
className: `uppercase ${getStatusBadgeClass$6(
|
|
811
|
-
children:
|
|
1217
|
+
className: `uppercase ${getStatusBadgeClass$6(returnOrder.status)}`,
|
|
1218
|
+
children: returnOrder.status.replace(/_/g, " ")
|
|
812
1219
|
}
|
|
813
1220
|
) }),
|
|
814
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
815
|
-
|
|
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",
|
|
816
1232
|
month: "short",
|
|
817
1233
|
day: "numeric",
|
|
818
1234
|
hour: "numeric",
|
|
819
1235
|
minute: "2-digit",
|
|
820
1236
|
hour12: true
|
|
821
1237
|
}) }),
|
|
822
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
),
|
|
835
|
-
r.order_id ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
836
|
-
ui.Button,
|
|
837
|
-
{
|
|
838
|
-
variant: "transparent",
|
|
839
|
-
size: "small",
|
|
840
|
-
onClick: (e) => {
|
|
841
|
-
e.stopPropagation();
|
|
842
|
-
navigate(`/orders/${r.order_id}`);
|
|
843
|
-
},
|
|
844
|
-
children: "Order"
|
|
845
|
-
}
|
|
846
|
-
) : null
|
|
847
|
-
] }) })
|
|
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
|
+
) })
|
|
848
1250
|
]
|
|
849
1251
|
},
|
|
850
|
-
|
|
1252
|
+
returnOrder.id
|
|
851
1253
|
)) })
|
|
852
1254
|
] }) }),
|
|
853
1255
|
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -855,15 +1257,15 @@ const RefundsPage = () => {
|
|
|
855
1257
|
{
|
|
856
1258
|
variant: "secondary",
|
|
857
1259
|
isLoading: isFetchingMore,
|
|
858
|
-
onClick: () =>
|
|
1260
|
+
onClick: () => loadReturns(offset, false),
|
|
859
1261
|
children: "Load more"
|
|
860
1262
|
}
|
|
861
1263
|
) }) : null
|
|
862
1264
|
] }) });
|
|
863
1265
|
};
|
|
864
1266
|
const config$6 = adminSdk.defineRouteConfig({
|
|
865
|
-
label: "
|
|
866
|
-
icon: icons.
|
|
1267
|
+
label: "Return Orders",
|
|
1268
|
+
icon: icons.ArrowPath
|
|
867
1269
|
});
|
|
868
1270
|
const useDebounce$1 = (value, delay) => {
|
|
869
1271
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
@@ -874,212 +1276,275 @@ const useDebounce$1 = (value, delay) => {
|
|
|
874
1276
|
return debouncedValue;
|
|
875
1277
|
};
|
|
876
1278
|
const getStatusBadgeClass$5 = (status) => {
|
|
877
|
-
const
|
|
878
|
-
if (
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
if (
|
|
882
|
-
return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
883
|
-
}
|
|
884
|
-
if (statusLower === "requires_action") {
|
|
885
|
-
return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
886
|
-
}
|
|
887
|
-
if (statusLower === "completed") {
|
|
888
|
-
return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
889
|
-
}
|
|
890
|
-
if (statusLower === "canceled") {
|
|
891
|
-
return "bg-ui-tag-grey-bg text-ui-tag-grey-text";
|
|
892
|
-
}
|
|
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";
|
|
893
1284
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
894
1285
|
};
|
|
895
|
-
const
|
|
1286
|
+
const RefundsPage = () => {
|
|
896
1287
|
const navigate = reactRouterDom.useNavigate();
|
|
897
1288
|
const [items, setItems] = react.useState([]);
|
|
898
|
-
const [
|
|
899
|
-
const
|
|
900
|
-
const [
|
|
901
|
-
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("");
|
|
902
1300
|
const [isLoading, setIsLoading] = react.useState(true);
|
|
903
1301
|
const [isFetchingMore, setIsFetchingMore] = react.useState(false);
|
|
904
1302
|
const [error, setError] = react.useState(null);
|
|
905
1303
|
const [offset, setOffset] = react.useState(0);
|
|
906
1304
|
const [count, setCount] = react.useState(0);
|
|
907
1305
|
const limit = 50;
|
|
908
|
-
const
|
|
909
|
-
async (nextOffset, replace
|
|
910
|
-
var _a;
|
|
1306
|
+
const loadRefunds = react.useCallback(
|
|
1307
|
+
async (nextOffset, replace) => {
|
|
911
1308
|
try {
|
|
912
|
-
if (replace)
|
|
913
|
-
|
|
914
|
-
} else {
|
|
915
|
-
setIsFetchingMore(true);
|
|
916
|
-
}
|
|
1309
|
+
if (replace) setIsLoading(true);
|
|
1310
|
+
else setIsFetchingMore(true);
|
|
917
1311
|
setError(null);
|
|
918
1312
|
const params = new URLSearchParams();
|
|
919
1313
|
params.set("limit", String(limit));
|
|
920
1314
|
params.set("offset", String(nextOffset));
|
|
921
|
-
if (
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
if (
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
params.set("
|
|
931
|
-
const response = await fetch(
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
);
|
|
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
|
+
});
|
|
935
1328
|
if (!response.ok) {
|
|
936
|
-
const
|
|
937
|
-
throw new Error(
|
|
1329
|
+
const text = await response.text();
|
|
1330
|
+
throw new Error(text || "Failed to load refunds");
|
|
938
1331
|
}
|
|
939
1332
|
const payload = await response.json();
|
|
1333
|
+
const list = payload.refunds ?? [];
|
|
940
1334
|
setCount(payload.count ?? 0);
|
|
941
|
-
setOffset(nextOffset +
|
|
942
|
-
setItems(
|
|
943
|
-
|
|
944
|
-
);
|
|
945
|
-
} catch (loadError) {
|
|
946
|
-
const message = loadError instanceof Error ? loadError.message : "Unable to load return orders";
|
|
947
|
-
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");
|
|
948
1339
|
} finally {
|
|
949
1340
|
setIsLoading(false);
|
|
950
1341
|
setIsFetchingMore(false);
|
|
951
1342
|
}
|
|
952
1343
|
},
|
|
953
|
-
[
|
|
1344
|
+
[
|
|
1345
|
+
debouncedOrderId,
|
|
1346
|
+
paymentStatusFilter,
|
|
1347
|
+
debouncedProvider,
|
|
1348
|
+
debouncedCurrency,
|
|
1349
|
+
dateFrom,
|
|
1350
|
+
dateTo,
|
|
1351
|
+
amountMin,
|
|
1352
|
+
amountMax
|
|
1353
|
+
]
|
|
954
1354
|
);
|
|
955
1355
|
react.useEffect(() => {
|
|
956
|
-
void
|
|
957
|
-
}, [
|
|
1356
|
+
void loadRefunds(0, true);
|
|
1357
|
+
}, [loadRefunds]);
|
|
958
1358
|
const hasMore = react.useMemo(() => offset < count, [offset, count]);
|
|
959
|
-
const
|
|
960
|
-
const
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
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
|
+
};
|
|
964
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: [
|
|
965
1368
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
|
|
966
1369
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
967
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "
|
|
968
|
-
/* @__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" })
|
|
969
1372
|
] }),
|
|
970
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () =>
|
|
1373
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "primary", onClick: () => loadRefunds(0, true), children: "Refresh" })
|
|
971
1374
|
] }),
|
|
972
|
-
/* @__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: [
|
|
973
1376
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
974
1377
|
ui.Input,
|
|
975
1378
|
{
|
|
976
|
-
placeholder: "
|
|
977
|
-
value:
|
|
978
|
-
onChange: (
|
|
979
|
-
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"
|
|
980
1384
|
}
|
|
981
1385
|
),
|
|
982
|
-
/* @__PURE__ */ jsxRuntime.
|
|
983
|
-
|
|
984
|
-
"select",
|
|
985
|
-
{
|
|
986
|
-
value: createdByFilter,
|
|
987
|
-
onChange: (event) => setCreatedByFilter(event.target.value),
|
|
988
|
-
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",
|
|
989
|
-
children: [
|
|
990
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All (Created by)" }),
|
|
991
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "customer", children: "Customer" }),
|
|
992
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "admin", children: "Admin" })
|
|
993
|
-
]
|
|
994
|
-
}
|
|
995
|
-
),
|
|
996
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
997
|
-
"select",
|
|
998
|
-
{
|
|
999
|
-
value: statusFilter,
|
|
1000
|
-
onChange: (event) => setStatusFilter(event.target.value),
|
|
1001
|
-
className: "h-9 rounded-md border border-ui-border-base bg-transparent px-3 text-sm text-ui-fg-base outline-none transition focus:ring-2 focus:ring-ui-fg-interactive md:max-w-xs",
|
|
1002
|
-
children: [
|
|
1003
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "all", children: "All Statuses" }),
|
|
1004
|
-
availableStatuses.map((status) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: status, children: status.replace(/_/g, " ").toUpperCase() }, status))
|
|
1005
|
-
]
|
|
1006
|
-
}
|
|
1007
|
-
)
|
|
1008
|
-
] })
|
|
1009
|
-
] }),
|
|
1010
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1011
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1012
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1013
|
-
ui.Button,
|
|
1386
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1387
|
+
ui.Input,
|
|
1014
1388
|
{
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
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"
|
|
1018
1394
|
}
|
|
1019
|
-
)
|
|
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" }) })
|
|
1020
1474
|
] }) : null,
|
|
1021
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center py-16", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading
|
|
1022
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h3", className: "text-xl", children: "No
|
|
1023
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "mt-2 text-ui-fg-subtle", children: "
|
|
1024
|
-
] }) : /* @__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: [
|
|
1025
1479
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-ui-bg-subtle", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
1026
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
1027
|
-
/* @__PURE__ */ jsxRuntime.jsx("th", { className: "px-
|
|
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-
|
|
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" })
|
|
1033
1490
|
] }) }),
|
|
1034
|
-
/* @__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(
|
|
1035
1492
|
"tr",
|
|
1036
1493
|
{
|
|
1037
|
-
className: "hover:bg-ui-bg-subtle/60
|
|
1038
|
-
onClick: () => navigate(`/
|
|
1494
|
+
className: "cursor-pointer hover:bg-ui-bg-subtle/60",
|
|
1495
|
+
onClick: () => navigate(`/refunds/${r.refund_id}`),
|
|
1039
1496
|
children: [
|
|
1040
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-
|
|
1041
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-
|
|
1042
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-
|
|
1043
|
-
/* @__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(
|
|
1044
1504
|
ui.Badge,
|
|
1045
1505
|
{
|
|
1046
1506
|
size: "2xsmall",
|
|
1047
|
-
className: `uppercase ${getStatusBadgeClass$5(
|
|
1048
|
-
children:
|
|
1049
|
-
}
|
|
1050
|
-
) }),
|
|
1051
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: (() => {
|
|
1052
|
-
const amount = returnOrder.refund_amount;
|
|
1053
|
-
if (amount == null || amount === void 0) {
|
|
1054
|
-
return "—";
|
|
1055
|
-
}
|
|
1056
|
-
const displayAmount = Number(amount) / 100;
|
|
1057
|
-
const currency = returnOrder.currency_code || "$";
|
|
1058
|
-
return `${currency}${displayAmount.toFixed(2)}`;
|
|
1059
|
-
})() }),
|
|
1060
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4 text-ui-fg-subtle", children: new Date(returnOrder.created_at).toLocaleDateString("en-US", {
|
|
1061
|
-
year: "numeric",
|
|
1062
|
-
month: "short",
|
|
1063
|
-
day: "numeric",
|
|
1064
|
-
hour: "numeric",
|
|
1065
|
-
minute: "2-digit",
|
|
1066
|
-
hour12: true
|
|
1067
|
-
}) }),
|
|
1068
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1069
|
-
ui.Button,
|
|
1070
|
-
{
|
|
1071
|
-
variant: "transparent",
|
|
1072
|
-
size: "small",
|
|
1073
|
-
onClick: (e) => {
|
|
1074
|
-
e.stopPropagation();
|
|
1075
|
-
navigate(`/app/orders/${returnOrder.order_id}`);
|
|
1076
|
-
},
|
|
1077
|
-
children: "Go to order"
|
|
1507
|
+
className: `uppercase ${getStatusBadgeClass$5(displayStatus(r))}`,
|
|
1508
|
+
children: displayStatus(r) !== "—" ? displayStatus(r).replace(/_/g, " ") : "—"
|
|
1078
1509
|
}
|
|
1079
|
-
) })
|
|
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", {
|
|
1513
|
+
month: "short",
|
|
1514
|
+
day: "numeric",
|
|
1515
|
+
hour: "numeric",
|
|
1516
|
+
minute: "2-digit",
|
|
1517
|
+
hour12: true
|
|
1518
|
+
}) }),
|
|
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
|
+
] }) })
|
|
1080
1545
|
]
|
|
1081
1546
|
},
|
|
1082
|
-
|
|
1547
|
+
r.refund_id
|
|
1083
1548
|
)) })
|
|
1084
1549
|
] }) }),
|
|
1085
1550
|
hasMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1087,15 +1552,15 @@ const ReturnsPage = () => {
|
|
|
1087
1552
|
{
|
|
1088
1553
|
variant: "secondary",
|
|
1089
1554
|
isLoading: isFetchingMore,
|
|
1090
|
-
onClick: () =>
|
|
1555
|
+
onClick: () => loadRefunds(offset, false),
|
|
1091
1556
|
children: "Load more"
|
|
1092
1557
|
}
|
|
1093
1558
|
) }) : null
|
|
1094
1559
|
] }) });
|
|
1095
1560
|
};
|
|
1096
1561
|
const config$5 = adminSdk.defineRouteConfig({
|
|
1097
|
-
label: "
|
|
1098
|
-
icon: icons.
|
|
1562
|
+
label: "Refunds",
|
|
1563
|
+
icon: icons.Receipt
|
|
1099
1564
|
});
|
|
1100
1565
|
const useDebounce = (value, delay) => {
|
|
1101
1566
|
const [debouncedValue, setDebouncedValue] = react.useState(value);
|
|
@@ -1328,11 +1793,11 @@ const config$4 = adminSdk.defineRouteConfig({
|
|
|
1328
1793
|
icon: icons.ArrowPath
|
|
1329
1794
|
});
|
|
1330
1795
|
const getStatusBadgeClass$3 = (status) => {
|
|
1331
|
-
const
|
|
1332
|
-
if (
|
|
1333
|
-
if (
|
|
1334
|
-
if (
|
|
1335
|
-
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";
|
|
1336
1801
|
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1337
1802
|
};
|
|
1338
1803
|
const PaymentDetailPage = () => {
|
|
@@ -1412,233 +1877,41 @@ const PaymentDetailPage = () => {
|
|
|
1412
1877
|
) })
|
|
1413
1878
|
] }),
|
|
1414
1879
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1415
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
1416
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
1417
|
-
] }),
|
|
1418
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1419
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
1420
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
1421
|
-
] }),
|
|
1422
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1423
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
1424
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
1425
|
-
] }),
|
|
1426
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1427
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created" }),
|
|
1428
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.created_at).toLocaleDateString("en-US", {
|
|
1429
|
-
year: "numeric",
|
|
1430
|
-
month: "short",
|
|
1431
|
-
day: "numeric",
|
|
1432
|
-
hour: "numeric",
|
|
1433
|
-
minute: "2-digit",
|
|
1434
|
-
hour12: true
|
|
1435
|
-
}) })
|
|
1436
|
-
] })
|
|
1437
|
-
] }) }),
|
|
1438
|
-
Object.keys(detail.data ?? {}).length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1439
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Provider data" }),
|
|
1440
|
-
/* @__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) })
|
|
1441
|
-
] }) : /* @__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." }) })
|
|
1442
|
-
] }) : null
|
|
1443
|
-
] }) });
|
|
1444
|
-
};
|
|
1445
|
-
const config$3 = adminSdk.defineRouteConfig({
|
|
1446
|
-
label: "Payment details",
|
|
1447
|
-
icon: icons.CreditCard
|
|
1448
|
-
});
|
|
1449
|
-
const getStatusBadgeClass$2 = (status) => {
|
|
1450
|
-
const s = status.toLowerCase();
|
|
1451
|
-
if (s === "captured" || s === "completed") return "bg-ui-tag-green-bg text-ui-tag-green-text";
|
|
1452
|
-
if (s === "authorized") return "bg-ui-tag-blue-bg text-ui-tag-blue-text";
|
|
1453
|
-
if (s === "error" || s === "canceled" || s === "cancelled") return "bg-ui-tag-red-bg text-ui-tag-red-text";
|
|
1454
|
-
if (s === "pending" || s === "requires_more") return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
1455
|
-
return "bg-ui-tag-purple-bg text-ui-tag-purple-text";
|
|
1456
|
-
};
|
|
1457
|
-
const formatAmount = (value) => {
|
|
1458
|
-
return String(value);
|
|
1459
|
-
};
|
|
1460
|
-
const RefundDetailPage = () => {
|
|
1461
|
-
var _a, _b, _c;
|
|
1462
|
-
const navigate = reactRouterDom.useNavigate();
|
|
1463
|
-
const params = reactRouterDom.useParams();
|
|
1464
|
-
const id = (_a = params == null ? void 0 : params.id) == null ? void 0 : _a.trim();
|
|
1465
|
-
const [detail, setDetail] = react.useState(null);
|
|
1466
|
-
const [loading, setLoading] = react.useState(!!id);
|
|
1467
|
-
const [error, setError] = react.useState(null);
|
|
1468
|
-
const [gatewayExpanded, setGatewayExpanded] = react.useState(false);
|
|
1469
|
-
react.useEffect(() => {
|
|
1470
|
-
if (!id) {
|
|
1471
|
-
setLoading(false);
|
|
1472
|
-
return;
|
|
1473
|
-
}
|
|
1474
|
-
let cancelled = false;
|
|
1475
|
-
setLoading(true);
|
|
1476
|
-
setError(null);
|
|
1477
|
-
fetch(`/admin/refunds/${id}`, { credentials: "include" }).then((res) => {
|
|
1478
|
-
if (!res.ok) throw new Error(res.statusText || "Failed to load");
|
|
1479
|
-
return res.json();
|
|
1480
|
-
}).then((data) => {
|
|
1481
|
-
if (!cancelled) setDetail(data);
|
|
1482
|
-
}).catch((e) => {
|
|
1483
|
-
if (!cancelled) setError(e instanceof Error ? e.message : "Failed to load");
|
|
1484
|
-
}).finally(() => {
|
|
1485
|
-
if (!cancelled) setLoading(false);
|
|
1486
|
-
});
|
|
1487
|
-
return () => {
|
|
1488
|
-
cancelled = true;
|
|
1489
|
-
};
|
|
1490
|
-
}, [id]);
|
|
1491
|
-
const paymentStatus = ((_b = detail == null ? void 0 : detail.payment) == null ? void 0 : _b.status) ?? "—";
|
|
1492
|
-
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;
|
|
1493
|
-
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: [
|
|
1494
|
-
/* @__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: [
|
|
1495
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: () => navigate("/refunds"), children: "← Refunds" }),
|
|
1496
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Refund details" }),
|
|
1497
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-subtle font-mono", children: id ?? "—" })
|
|
1498
|
-
] }) }),
|
|
1499
|
-
error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg border border-ui-border-strong p-6 text-center", children: [
|
|
1500
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { weight: "plus", className: "text-ui-fg-error", children: error }),
|
|
1501
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "secondary", className: "mt-4", onClick: () => navigate("/refunds"), children: "Back to list" })
|
|
1502
|
-
] }) : 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: [
|
|
1503
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1504
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Refund summary" }),
|
|
1505
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
1506
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1507
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund ID" }),
|
|
1508
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.id })
|
|
1509
|
-
] }),
|
|
1510
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1511
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Amount" }),
|
|
1512
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.refund.amount) })
|
|
1513
|
-
] }),
|
|
1514
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1515
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Note" }),
|
|
1516
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.refund.note ?? "—" })
|
|
1517
|
-
] }),
|
|
1518
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1519
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created at" }),
|
|
1520
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: new Date(detail.refund.created_at).toLocaleDateString("en-US", {
|
|
1521
|
-
year: "numeric",
|
|
1522
|
-
month: "short",
|
|
1523
|
-
day: "numeric",
|
|
1524
|
-
hour: "numeric",
|
|
1525
|
-
minute: "2-digit",
|
|
1526
|
-
hour12: true
|
|
1527
|
-
}) })
|
|
1528
|
-
] }),
|
|
1529
|
-
detail.refund.created_by ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1530
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Created by" }),
|
|
1531
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.refund.created_by })
|
|
1532
|
-
] }) : null
|
|
1533
|
-
] })
|
|
1534
|
-
] }),
|
|
1535
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1536
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Payment summary" }),
|
|
1537
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
1538
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1539
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment amount" }),
|
|
1540
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.payment_amount) })
|
|
1541
|
-
] }),
|
|
1542
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1543
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Captured amount" }),
|
|
1544
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.captured_amount) })
|
|
1545
|
-
] }),
|
|
1546
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1547
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refunded amount" }),
|
|
1548
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.payment.refunded_amount) })
|
|
1549
|
-
] }),
|
|
1550
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1551
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Provider" }),
|
|
1552
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment.provider_id || "—" })
|
|
1553
|
-
] }),
|
|
1554
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1555
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Status" }),
|
|
1556
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1557
|
-
ui.Badge,
|
|
1558
|
-
{
|
|
1559
|
-
size: "2xsmall",
|
|
1560
|
-
className: `uppercase ${getStatusBadgeClass$2(paymentStatus)}`,
|
|
1561
|
-
children: paymentStatus !== "—" ? paymentStatus.replace(/_/g, " ") : "—"
|
|
1562
|
-
}
|
|
1563
|
-
) })
|
|
1564
|
-
] }),
|
|
1565
|
-
detail.computed ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1566
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1567
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Full refund" }),
|
|
1568
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.computed.is_full_refund ? "Yes" : "No" })
|
|
1569
|
-
] }),
|
|
1570
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1571
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Remaining refundable" }),
|
|
1572
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.computed.remaining_refundable_amount) })
|
|
1573
|
-
] }),
|
|
1574
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1575
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Refund %" }),
|
|
1576
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { className: "mt-1 block", children: [
|
|
1577
|
-
detail.computed.refund_percentage.toFixed(1),
|
|
1578
|
-
"%"
|
|
1579
|
-
] })
|
|
1580
|
-
] })
|
|
1581
|
-
] }) : null
|
|
1582
|
-
] })
|
|
1583
|
-
] }),
|
|
1584
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1585
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg mb-4", children: "Order summary" }),
|
|
1586
|
-
detail.order ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
|
|
1587
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1588
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Order" }),
|
|
1589
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1590
|
-
ui.Button,
|
|
1591
|
-
{
|
|
1592
|
-
variant: "transparent",
|
|
1593
|
-
size: "small",
|
|
1594
|
-
onClick: () => navigate(`/orders/${detail.order.order_id}`),
|
|
1595
|
-
children: detail.order.order_number ?? detail.order.order_id
|
|
1596
|
-
}
|
|
1597
|
-
) })
|
|
1598
|
-
] }),
|
|
1599
|
-
detail.order.total != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1600
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Total" }),
|
|
1601
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: formatAmount(detail.order.total) })
|
|
1602
|
-
] }) : null,
|
|
1603
|
-
detail.order.customer_id ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1604
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Customer ID" }),
|
|
1605
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block font-mono text-sm", children: detail.order.customer_id })
|
|
1606
|
-
] }) : null,
|
|
1607
|
-
detail.order.region ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1608
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Region" }),
|
|
1609
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.region })
|
|
1610
|
-
] }) : null,
|
|
1611
|
-
detail.order.fulfillment_status ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1612
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Fulfillment status" }),
|
|
1613
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.order.fulfillment_status })
|
|
1614
|
-
] }) : null
|
|
1615
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "No order linked to this refund." })
|
|
1616
|
-
] }),
|
|
1617
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-ui-border-base p-6", children: [
|
|
1618
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1619
|
-
"button",
|
|
1620
|
-
{
|
|
1621
|
-
type: "button",
|
|
1622
|
-
className: "flex w-full items-center justify-between text-left",
|
|
1623
|
-
onClick: () => setGatewayExpanded((prev) => !prev),
|
|
1624
|
-
"aria-expanded": gatewayExpanded,
|
|
1625
|
-
"aria-label": gatewayExpanded ? "Collapse gateway data" : "Expand gateway data",
|
|
1626
|
-
children: [
|
|
1627
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-lg", children: "Gateway data" }),
|
|
1628
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: gatewayExpanded ? "Collapse" : "Expand" })
|
|
1629
|
-
]
|
|
1630
|
-
}
|
|
1631
|
-
),
|
|
1632
|
-
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." }) })
|
|
1633
|
-
] })
|
|
1880
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Session status (DB)" }),
|
|
1881
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: sessionStatusRaw })
|
|
1882
|
+
] }),
|
|
1883
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1884
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Payment status (DB)" }),
|
|
1885
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: paymentStatusRaw })
|
|
1886
|
+
] }),
|
|
1887
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1888
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "small", className: "text-ui-fg-muted", children: "Finalized" }),
|
|
1889
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "mt-1 block", children: detail.payment_id != null ? "Yes" : "No" })
|
|
1890
|
+
] }),
|
|
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." }) })
|
|
1634
1907
|
] }) : null
|
|
1635
1908
|
] }) });
|
|
1636
1909
|
};
|
|
1637
|
-
const config$
|
|
1638
|
-
label: "
|
|
1639
|
-
icon: icons.
|
|
1910
|
+
const config$3 = adminSdk.defineRouteConfig({
|
|
1911
|
+
label: "Payment details",
|
|
1912
|
+
icon: icons.CreditCard
|
|
1640
1913
|
});
|
|
1641
|
-
const getStatusBadgeClass$
|
|
1914
|
+
const getStatusBadgeClass$2 = (status) => {
|
|
1642
1915
|
const statusLower = status.toLowerCase();
|
|
1643
1916
|
if (statusLower === "requested") {
|
|
1644
1917
|
return "bg-ui-tag-orange-bg text-ui-tag-orange-text";
|
|
@@ -1772,7 +2045,7 @@ const ReturnDetailPage = () => {
|
|
|
1772
2045
|
ui.Badge,
|
|
1773
2046
|
{
|
|
1774
2047
|
size: "small",
|
|
1775
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2048
|
+
className: `uppercase ${getStatusBadgeClass$2(returnOrder.status)}`,
|
|
1776
2049
|
children: returnOrder.status.replace(/_/g, " ")
|
|
1777
2050
|
}
|
|
1778
2051
|
)
|
|
@@ -1854,7 +2127,7 @@ const ReturnDetailPage = () => {
|
|
|
1854
2127
|
ui.Badge,
|
|
1855
2128
|
{
|
|
1856
2129
|
size: "2xsmall",
|
|
1857
|
-
className: `uppercase ${getStatusBadgeClass$
|
|
2130
|
+
className: `uppercase ${getStatusBadgeClass$2(entry.status)}`,
|
|
1858
2131
|
children: entry.status.replace(/_/g, " ")
|
|
1859
2132
|
}
|
|
1860
2133
|
) }),
|
|
@@ -1912,10 +2185,202 @@ const ReturnDetailPage = () => {
|
|
|
1912
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" }) })
|
|
1913
2186
|
] }) });
|
|
1914
2187
|
};
|
|
1915
|
-
const config$
|
|
2188
|
+
const config$2 = adminSdk.defineRouteConfig({
|
|
1916
2189
|
label: "Return Order Details",
|
|
1917
2190
|
icon: icons.CheckCircle
|
|
1918
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
|
+
});
|
|
1919
2384
|
const getStatusBadgeClass = (status) => {
|
|
1920
2385
|
const statusLower = status.toLowerCase();
|
|
1921
2386
|
if (statusLower === "requested") {
|
|
@@ -2197,6 +2662,10 @@ const config = adminSdk.defineRouteConfig({
|
|
|
2197
2662
|
});
|
|
2198
2663
|
const i18nTranslations0 = {};
|
|
2199
2664
|
const widgetModule = { widgets: [
|
|
2665
|
+
{
|
|
2666
|
+
Component: OrderGiftItemsWidget,
|
|
2667
|
+
zone: ["order.details.side.after"]
|
|
2668
|
+
},
|
|
2200
2669
|
{
|
|
2201
2670
|
Component: OrderRefundContextWidget,
|
|
2202
2671
|
zone: ["order.details.after"]
|
|
@@ -2208,14 +2677,14 @@ const routeModule = {
|
|
|
2208
2677
|
Component: PaymentsPage,
|
|
2209
2678
|
path: "/payments"
|
|
2210
2679
|
},
|
|
2211
|
-
{
|
|
2212
|
-
Component: RefundsPage,
|
|
2213
|
-
path: "/refunds"
|
|
2214
|
-
},
|
|
2215
2680
|
{
|
|
2216
2681
|
Component: ReturnsPage,
|
|
2217
2682
|
path: "/returns"
|
|
2218
2683
|
},
|
|
2684
|
+
{
|
|
2685
|
+
Component: RefundsPage,
|
|
2686
|
+
path: "/refunds"
|
|
2687
|
+
},
|
|
2219
2688
|
{
|
|
2220
2689
|
Component: SwapsPage,
|
|
2221
2690
|
path: "/swaps"
|
|
@@ -2224,14 +2693,14 @@ const routeModule = {
|
|
|
2224
2693
|
Component: PaymentDetailPage,
|
|
2225
2694
|
path: "/payments/:id"
|
|
2226
2695
|
},
|
|
2227
|
-
{
|
|
2228
|
-
Component: RefundDetailPage,
|
|
2229
|
-
path: "/refunds/:id"
|
|
2230
|
-
},
|
|
2231
2696
|
{
|
|
2232
2697
|
Component: ReturnDetailPage,
|
|
2233
2698
|
path: "/returns/:id"
|
|
2234
2699
|
},
|
|
2700
|
+
{
|
|
2701
|
+
Component: RefundDetailPage,
|
|
2702
|
+
path: "/refunds/:id"
|
|
2703
|
+
},
|
|
2235
2704
|
{
|
|
2236
2705
|
Component: SwapDetailPage,
|
|
2237
2706
|
path: "/swaps/:id"
|
|
@@ -2247,14 +2716,14 @@ const menuItemModule = {
|
|
|
2247
2716
|
nested: void 0
|
|
2248
2717
|
},
|
|
2249
2718
|
{
|
|
2250
|
-
label: config$
|
|
2251
|
-
icon: config$
|
|
2719
|
+
label: config$5.label,
|
|
2720
|
+
icon: config$5.icon,
|
|
2252
2721
|
path: "/refunds",
|
|
2253
2722
|
nested: void 0
|
|
2254
2723
|
},
|
|
2255
2724
|
{
|
|
2256
|
-
label: config$
|
|
2257
|
-
icon: config$
|
|
2725
|
+
label: config$6.label,
|
|
2726
|
+
icon: config$6.icon,
|
|
2258
2727
|
path: "/returns",
|
|
2259
2728
|
nested: void 0
|
|
2260
2729
|
},
|
|
@@ -2271,14 +2740,14 @@ const menuItemModule = {
|
|
|
2271
2740
|
nested: void 0
|
|
2272
2741
|
},
|
|
2273
2742
|
{
|
|
2274
|
-
label: config$
|
|
2275
|
-
icon: config$
|
|
2743
|
+
label: config$1.label,
|
|
2744
|
+
icon: config$1.icon,
|
|
2276
2745
|
path: "/refunds/:id",
|
|
2277
2746
|
nested: void 0
|
|
2278
2747
|
},
|
|
2279
2748
|
{
|
|
2280
|
-
label: config$
|
|
2281
|
-
icon: config$
|
|
2749
|
+
label: config$2.label,
|
|
2750
|
+
icon: config$2.icon,
|
|
2282
2751
|
path: "/returns/:id",
|
|
2283
2752
|
nested: void 0
|
|
2284
2753
|
},
|