@burdenoff/microfe-store 2026.831.1 → 2026.912.1
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/dist/generated/global-operations.d.ts +7 -0
- package/dist/generated/global-operations.js +6 -0
- package/dist/generated/global-operations.js.map +1 -1
- package/dist/hooks/useOrders.d.ts +16 -0
- package/dist/hooks/useOrders.js.map +1 -1
- package/dist/pages/OrdersPage.js +213 -201
- package/dist/pages/OrdersPage.js.map +1 -1
- package/dist/providers/StoreProvider.js +35 -35
- package/dist/providers/StoreProvider.js.map +1 -1
- package/package.json +1 -1
package/dist/pages/OrdersPage.js
CHANGED
|
@@ -3,77 +3,80 @@ import { useOrderStatusUpdatedSubscription as t } from "../generated/global-oper
|
|
|
3
3
|
import { formatPrice as n } from "../utils/index.js";
|
|
4
4
|
import { useTr as r } from "../shared/hooks/useTr.js";
|
|
5
5
|
import { InstallAppModal as i } from "../components/InstallAppModal.js";
|
|
6
|
-
import { useInstallations as
|
|
7
|
-
import { useOrders as
|
|
8
|
-
import { useCallback as
|
|
9
|
-
import { useNavigate as
|
|
10
|
-
import { useI18n as
|
|
11
|
-
import { ArrowLeft as
|
|
12
|
-
import { jsx as
|
|
13
|
-
import { GlassCard as
|
|
6
|
+
import { useInstallations as a } from "../hooks/useInstallations.js";
|
|
7
|
+
import { useOrders as o } from "../hooks/useOrders.js";
|
|
8
|
+
import { useCallback as s, useMemo as c, useState as l } from "react";
|
|
9
|
+
import { useNavigate as u } from "react-router";
|
|
10
|
+
import { useI18n as d } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
11
|
+
import { ArrowLeft as f, CheckCircle as p, ChevronRight as m, Clock as h, Download as g, Loader2 as _, Package as v, RefreshCw as y, ShoppingBag as b, XCircle as x } from "lucide-react";
|
|
12
|
+
import { jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
13
|
+
import { GlassCard as ee, IllustratedEmptyState as w, PagePurpose as T } from "@burdenoff/fe-libs/ui";
|
|
14
14
|
//#region src/pages/OrdersPage.tsx
|
|
15
|
-
|
|
15
|
+
function E(e) {
|
|
16
|
+
return typeof e == "number" && Number.isFinite(e) ? e : null;
|
|
17
|
+
}
|
|
18
|
+
var D = [
|
|
16
19
|
"COMPLETED",
|
|
17
20
|
"FULFILLED",
|
|
18
21
|
"PROCESSED"
|
|
19
|
-
],
|
|
22
|
+
], O = (e, t) => {
|
|
20
23
|
switch (e) {
|
|
21
24
|
case "COMPLETED":
|
|
22
25
|
case "FULFILLED":
|
|
23
26
|
case "PROCESSED": return {
|
|
24
|
-
icon:
|
|
27
|
+
icon: p,
|
|
25
28
|
classes: "bg-status-success-bg-subtle/15 text-status-success-text border-status-success-text/20",
|
|
26
29
|
label: t("pages.orders.statusCompleted", "Completed")
|
|
27
30
|
};
|
|
28
31
|
case "PROCESSING": return {
|
|
29
|
-
icon:
|
|
32
|
+
icon: h,
|
|
30
33
|
classes: "bg-status-warning-bg-subtle/15 text-status-warning-text border-status-warning-text/20",
|
|
31
34
|
label: t("pages.orders.statusProcessing", "Processing")
|
|
32
35
|
};
|
|
33
36
|
case "PENDING": return {
|
|
34
|
-
icon:
|
|
37
|
+
icon: h,
|
|
35
38
|
classes: "bg-status-warning-bg-subtle/15 text-status-warning-text border-status-warning-text/20",
|
|
36
39
|
label: t("pages.orders.statusPending", "Pending")
|
|
37
40
|
};
|
|
38
41
|
case "FAILED": return {
|
|
39
|
-
icon:
|
|
42
|
+
icon: x,
|
|
40
43
|
classes: "bg-status-error-bg-subtle/15 text-status-error-text border-status-error-text/20",
|
|
41
44
|
label: t("pages.orders.statusFailed", "Failed")
|
|
42
45
|
};
|
|
43
46
|
case "REFUNDED": return {
|
|
44
|
-
icon:
|
|
47
|
+
icon: y,
|
|
45
48
|
classes: "bg-status-warning-bg-subtle/15 text-status-warning-text border-status-warning-text/20",
|
|
46
49
|
label: t("pages.orders.statusRefunded", "Refunded")
|
|
47
50
|
};
|
|
48
51
|
case "CANCELLED": return {
|
|
49
|
-
icon:
|
|
52
|
+
icon: y,
|
|
50
53
|
classes: "bg-bg-sunken text-text-muted border-border-default",
|
|
51
54
|
label: t("pages.orders.statusCancelled", "Cancelled")
|
|
52
55
|
};
|
|
53
56
|
default: return {
|
|
54
|
-
icon:
|
|
57
|
+
icon: h,
|
|
55
58
|
classes: "bg-bg-sunken text-text-muted border-border-default",
|
|
56
59
|
label: e
|
|
57
60
|
};
|
|
58
61
|
}
|
|
59
|
-
},
|
|
60
|
-
let n =
|
|
61
|
-
return /* @__PURE__ */
|
|
62
|
+
}, te = ({ status: e, tr: t }) => {
|
|
63
|
+
let n = O(e, t), r = n.icon;
|
|
64
|
+
return /* @__PURE__ */ C("span", {
|
|
62
65
|
className: `inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-semibold ${n.classes}`,
|
|
63
|
-
children: [/* @__PURE__ */
|
|
66
|
+
children: [/* @__PURE__ */ S(r, { className: "size-3.5" }), n.label]
|
|
64
67
|
});
|
|
65
|
-
},
|
|
66
|
-
let
|
|
68
|
+
}, k = () => {
|
|
69
|
+
let h = u(), { basePath: y } = e(), { t: O } = d(), k = r(), { orders: A, loading: j, error: M, refetchOrders: N, hasMore: P, loadMore: F } = o(), { installations: I, refetch: ne } = a();
|
|
67
70
|
t({
|
|
68
71
|
onData: () => {
|
|
69
|
-
|
|
72
|
+
N();
|
|
70
73
|
},
|
|
71
74
|
onError: (e) => {
|
|
72
75
|
console.warn("OrderStatusUpdated subscription error:", e.message);
|
|
73
76
|
}
|
|
74
77
|
});
|
|
75
|
-
let [
|
|
76
|
-
let t = e.lineItems || [], n = t.reduce((e, t) => e + t.subtotal, 0), r = e.total
|
|
78
|
+
let [re, ie] = l(/* @__PURE__ */ new Set()), [L, R] = l("completed"), [ae, z] = l(!1), [B, V] = l(null), [H, U] = l(null), [oe, W] = l(null), G = c(() => new Set(I.flatMap((e) => e.status === "ACTIVE" ? [e.productId] : [])), [I]), K = A.map((e) => {
|
|
79
|
+
let t = e.lineItems || [], n = t.reduce((e, t) => e + t.subtotal, 0), r = e.transaction?.metadata, i = E(r?.subtotal), a = E(r?.taxAmount), o = E(r?.total), s = i != null && o != null && e.transaction?.currency != null, c = s ? e.transaction.currency : e.currency, l = s ? i : n, u = s ? a ?? 0 : 0, d = s ? o : e.total, f = t.map((t, n) => ({
|
|
77
80
|
id: `${e.id}-${n}`,
|
|
78
81
|
productId: t.productId,
|
|
79
82
|
productName: t.name,
|
|
@@ -83,67 +86,70 @@ var T = [
|
|
|
83
86
|
quantity: t.quantity,
|
|
84
87
|
unitPrice: t.unitPrice,
|
|
85
88
|
totalPrice: t.subtotal,
|
|
86
|
-
installed:
|
|
89
|
+
installed: G.has(t.productId)
|
|
87
90
|
}));
|
|
88
91
|
return {
|
|
89
92
|
id: e.id,
|
|
90
93
|
orderNumber: `#${e.id.slice(-8).toUpperCase()}`,
|
|
91
|
-
items:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
items: f,
|
|
95
|
+
catalogCurrency: e.currency,
|
|
96
|
+
currency: c,
|
|
97
|
+
subtotal: l,
|
|
98
|
+
tax: u,
|
|
99
|
+
total: d,
|
|
100
|
+
isActualCharge: s,
|
|
95
101
|
status: e.status,
|
|
96
102
|
createdAt: e.createdAt,
|
|
97
103
|
fulfillment: e.fulfillment ?? null
|
|
98
104
|
};
|
|
99
|
-
}),
|
|
100
|
-
|
|
105
|
+
}), q = c(() => K.filter((e) => D.includes(e.status)), [K]), J = c(() => K.filter((e) => !D.includes(e.status)), [K]), Y = L === "completed" ? q : J, se = s((e) => {
|
|
106
|
+
ie((t) => {
|
|
101
107
|
let n = new Set(t);
|
|
102
108
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
103
109
|
});
|
|
104
110
|
}, []), ce = (e, t) => {
|
|
105
|
-
|
|
111
|
+
V(e), W(t.id), U({
|
|
106
112
|
id: t.productId,
|
|
107
113
|
name: t.productName,
|
|
108
114
|
icon: t.productIcon,
|
|
109
115
|
type: t.productType,
|
|
110
116
|
version: t.version
|
|
111
|
-
}),
|
|
112
|
-
},
|
|
113
|
-
|
|
117
|
+
}), z(!0);
|
|
118
|
+
}, X = () => {
|
|
119
|
+
z(!1), V(null), U(null), W(null);
|
|
114
120
|
}, le = (e, t) => {
|
|
115
|
-
|
|
116
|
-
},
|
|
117
|
-
|
|
121
|
+
X(), ne();
|
|
122
|
+
}, ue = (e) => {}, Z = () => {
|
|
123
|
+
h(`${y}/marketplace`);
|
|
118
124
|
}, Q = "px-4 py-3 text-sm", $ = "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wider text-text-muted";
|
|
119
|
-
return /* @__PURE__ */
|
|
125
|
+
return /* @__PURE__ */ C("div", {
|
|
120
126
|
className: "flex h-full flex-col",
|
|
121
127
|
children: [
|
|
122
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ S("header", {
|
|
123
129
|
className: "flex-shrink-0 border-b border-border-seam bg-bg-surface px-6 py-4",
|
|
124
|
-
children: /* @__PURE__ */
|
|
130
|
+
children: /* @__PURE__ */ S("div", {
|
|
125
131
|
className: "mx-auto max-w-6xl",
|
|
126
|
-
children: /* @__PURE__ */
|
|
132
|
+
children: /* @__PURE__ */ S("div", {
|
|
127
133
|
className: "flex items-center justify-between",
|
|
128
|
-
children: /* @__PURE__ */
|
|
134
|
+
children: /* @__PURE__ */ C("div", {
|
|
129
135
|
className: "flex items-center gap-4",
|
|
130
|
-
children: [/* @__PURE__ */
|
|
136
|
+
children: [/* @__PURE__ */ S("button", {
|
|
131
137
|
type: "button",
|
|
132
|
-
onClick: () =>
|
|
138
|
+
onClick: () => h(-1),
|
|
133
139
|
"aria-label": "Go back",
|
|
134
140
|
className: "cursor-pointer rounded-lg p-2 text-text-muted transition-colors hover:bg-bg-sunken hover:text-text-primary",
|
|
135
|
-
children: /* @__PURE__ */
|
|
136
|
-
}), /* @__PURE__ */
|
|
141
|
+
children: /* @__PURE__ */ S(f, { className: "size-5" })
|
|
142
|
+
}), /* @__PURE__ */ C("div", {
|
|
137
143
|
className: "flex items-center gap-3",
|
|
138
144
|
children: [
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ S(v, { className: "size-6 text-text-primary" }),
|
|
146
|
+
/* @__PURE__ */ S("h1", {
|
|
141
147
|
className: "text-xl font-bold text-text-primary",
|
|
142
|
-
children:
|
|
148
|
+
children: O("pages.orders.title", { defaultValue: "My Orders" })
|
|
143
149
|
}),
|
|
144
|
-
|
|
150
|
+
K.length > 0 && /* @__PURE__ */ S("span", {
|
|
145
151
|
className: "rounded-full bg-action-primary-bg/10 px-2.5 py-0.5 text-sm font-medium text-action-primary-bg",
|
|
146
|
-
children:
|
|
152
|
+
children: K.length
|
|
147
153
|
})
|
|
148
154
|
]
|
|
149
155
|
})]
|
|
@@ -151,138 +157,138 @@ var T = [
|
|
|
151
157
|
})
|
|
152
158
|
})
|
|
153
159
|
}),
|
|
154
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ S("div", {
|
|
155
161
|
className: "flex-1 overflow-y-auto",
|
|
156
|
-
children: /* @__PURE__ */
|
|
162
|
+
children: /* @__PURE__ */ C("div", {
|
|
157
163
|
className: "mx-auto max-w-6xl p-6",
|
|
158
|
-
children: [/* @__PURE__ */
|
|
164
|
+
children: [/* @__PURE__ */ S(T, {
|
|
159
165
|
className: "mb-6",
|
|
160
|
-
children:
|
|
161
|
-
}),
|
|
166
|
+
children: k("pages.orders.purpose", "A record of everything you've purchased from the marketplace. Track each order's status, review what you paid, and — once an order is complete — install the apps you bought into a workspace right from here. Come back to re-install on a new workspace or check a past receipt.")
|
|
167
|
+
}), j && K.length === 0 ? /* @__PURE__ */ C("div", {
|
|
162
168
|
className: "flex flex-col items-center justify-center py-24",
|
|
163
|
-
children: [/* @__PURE__ */
|
|
169
|
+
children: [/* @__PURE__ */ S(_, {
|
|
164
170
|
className: "size-12 animate-spin text-text-muted mb-4",
|
|
165
171
|
"aria-hidden": "true"
|
|
166
|
-
}), /* @__PURE__ */
|
|
172
|
+
}), /* @__PURE__ */ S("p", {
|
|
167
173
|
className: "text-text-muted",
|
|
168
|
-
children:
|
|
174
|
+
children: k("pages.orders.loading", "Loading your orders…")
|
|
169
175
|
})]
|
|
170
|
-
}) :
|
|
176
|
+
}) : M ? /* @__PURE__ */ C("div", {
|
|
171
177
|
className: "flex flex-col items-center justify-center py-24 text-center",
|
|
172
178
|
children: [
|
|
173
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ S("div", {
|
|
174
180
|
className: "mb-6 rounded-full bg-status-error-bg-subtle/10 p-6",
|
|
175
|
-
children: /* @__PURE__ */
|
|
181
|
+
children: /* @__PURE__ */ S(x, { className: "size-16 text-status-error-text" })
|
|
176
182
|
}),
|
|
177
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ S("h2", {
|
|
178
184
|
className: "mb-2 text-2xl font-bold text-text-primary",
|
|
179
|
-
children:
|
|
185
|
+
children: O("pages.orders.failedToLoad", { defaultValue: "Failed to load orders" })
|
|
180
186
|
}),
|
|
181
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ S("p", {
|
|
182
188
|
className: "mb-6 max-w-md text-text-muted",
|
|
183
|
-
children:
|
|
189
|
+
children: M.message || k("pages.orders.errorDescription", "An error occurred while loading your orders. Please try again.")
|
|
184
190
|
}),
|
|
185
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ C("button", {
|
|
186
192
|
type: "button",
|
|
187
193
|
onClick: Z,
|
|
188
194
|
className: "cursor-pointer flex items-center gap-2 rounded-lg bg-action-primary-bg px-6 py-3 font-semibold text-action-primary-text transition-opacity hover:opacity-90",
|
|
189
|
-
children: [/* @__PURE__ */ b
|
|
195
|
+
children: [/* @__PURE__ */ S(b, { className: "size-5" }), k("pages.orders.browseMarketplace", "Browse Marketplace")]
|
|
190
196
|
})
|
|
191
197
|
]
|
|
192
|
-
}) :
|
|
198
|
+
}) : K.length === 0 ? /* @__PURE__ */ S(w, {
|
|
193
199
|
illustration: "empty-data",
|
|
194
|
-
title:
|
|
195
|
-
description:
|
|
196
|
-
action: /* @__PURE__ */
|
|
200
|
+
title: O("pages.orders.emptyTitle", { defaultValue: "No orders yet" }),
|
|
201
|
+
description: k("pages.orders.emptyDescription", "You have not placed any orders yet. Browse the marketplace to discover apps and products!"),
|
|
202
|
+
action: /* @__PURE__ */ C("button", {
|
|
197
203
|
type: "button",
|
|
198
204
|
onClick: Z,
|
|
199
205
|
className: "cursor-pointer flex items-center gap-2 rounded-lg bg-action-primary-bg px-6 py-3 font-semibold text-action-primary-text transition-opacity hover:opacity-90",
|
|
200
|
-
children: [/* @__PURE__ */ b
|
|
206
|
+
children: [/* @__PURE__ */ S(b, { className: "size-5" }), k("pages.orders.browseMarketplace", "Browse Marketplace")]
|
|
201
207
|
})
|
|
202
|
-
}) : /* @__PURE__ */
|
|
208
|
+
}) : /* @__PURE__ */ C("div", {
|
|
203
209
|
className: "space-y-4",
|
|
204
|
-
children: [/* @__PURE__ */
|
|
210
|
+
children: [/* @__PURE__ */ C("div", {
|
|
205
211
|
className: "inline-flex rounded-xl border border-border-seam bg-bg-surface p-1",
|
|
206
|
-
children: [/* @__PURE__ */
|
|
212
|
+
children: [/* @__PURE__ */ C("button", {
|
|
207
213
|
type: "button",
|
|
208
|
-
onClick: () =>
|
|
209
|
-
className: `rounded-lg px-4 py-2 text-sm font-medium transition-colors ${
|
|
210
|
-
children: [
|
|
214
|
+
onClick: () => R("completed"),
|
|
215
|
+
className: `rounded-lg px-4 py-2 text-sm font-medium transition-colors ${L === "completed" ? "bg-action-primary-bg text-action-primary-text" : "text-text-muted hover:bg-bg-sunken hover:text-text-primary"}`,
|
|
216
|
+
children: [k("pages.orders.tabCompleted", "Completed"), /* @__PURE__ */ S("span", {
|
|
211
217
|
className: "ml-2 rounded-full bg-black/10 px-2 py-0.5 text-xs",
|
|
212
|
-
children:
|
|
218
|
+
children: q.length
|
|
213
219
|
})]
|
|
214
|
-
}), /* @__PURE__ */
|
|
220
|
+
}), /* @__PURE__ */ C("button", {
|
|
215
221
|
type: "button",
|
|
216
|
-
onClick: () =>
|
|
217
|
-
className: `rounded-lg px-4 py-2 text-sm font-medium transition-colors ${
|
|
218
|
-
children: [
|
|
222
|
+
onClick: () => R("pending"),
|
|
223
|
+
className: `rounded-lg px-4 py-2 text-sm font-medium transition-colors ${L === "pending" ? "bg-action-primary-bg text-action-primary-text" : "text-text-muted hover:bg-bg-sunken hover:text-text-primary"}`,
|
|
224
|
+
children: [k("pages.orders.tabPending", "Pending"), /* @__PURE__ */ S("span", {
|
|
219
225
|
className: "ml-2 rounded-full bg-black/10 px-2 py-0.5 text-xs",
|
|
220
|
-
children:
|
|
226
|
+
children: J.length
|
|
221
227
|
})]
|
|
222
228
|
})]
|
|
223
|
-
}),
|
|
229
|
+
}), Y.length === 0 ? /* @__PURE__ */ C(ee, {
|
|
224
230
|
className: "p-10 text-center",
|
|
225
231
|
children: [
|
|
226
|
-
/* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ S("div", {
|
|
227
233
|
className: "mx-auto mb-4 flex size-14 items-center justify-center rounded-full bg-bg-sunken text-text-muted",
|
|
228
|
-
children: /* @__PURE__ */
|
|
234
|
+
children: /* @__PURE__ */ S(v, { className: "size-6" })
|
|
229
235
|
}),
|
|
230
|
-
/* @__PURE__ */
|
|
236
|
+
/* @__PURE__ */ S("h2", {
|
|
231
237
|
className: "mb-2 text-lg font-semibold text-text-primary",
|
|
232
|
-
children:
|
|
238
|
+
children: L === "completed" ? k("pages.orders.noCompletedTitle", "No completed orders yet") : k("pages.orders.noPendingTitle", "No pending orders")
|
|
233
239
|
}),
|
|
234
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ S("p", {
|
|
235
241
|
className: "text-sm text-text-muted",
|
|
236
|
-
children:
|
|
242
|
+
children: L === "completed" ? k("pages.orders.noCompletedDescription", "Completed purchases will appear here once payment is successful.") : k("pages.orders.noPendingDescription", "Orders that are pending, processing, failed, refunded, or cancelled will appear here.")
|
|
237
243
|
})
|
|
238
244
|
]
|
|
239
|
-
}) : /* @__PURE__ */
|
|
245
|
+
}) : /* @__PURE__ */ C("div", {
|
|
240
246
|
className: "overflow-hidden rounded-xl border border-border-seam bg-bg-surface",
|
|
241
247
|
children: [
|
|
242
|
-
/* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ C("div", {
|
|
243
249
|
className: "hidden border-b border-border-seam bg-bg-sunken/50 md:grid md:grid-cols-[40px_1fr_180px_140px_120px_160px]",
|
|
244
250
|
children: [
|
|
245
|
-
/* @__PURE__ */
|
|
246
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ S("div", { className: $ }),
|
|
252
|
+
/* @__PURE__ */ S("div", {
|
|
247
253
|
className: $,
|
|
248
|
-
children:
|
|
254
|
+
children: k("pages.orders.colOrder", "Order")
|
|
249
255
|
}),
|
|
250
|
-
/* @__PURE__ */
|
|
256
|
+
/* @__PURE__ */ S("div", {
|
|
251
257
|
className: $,
|
|
252
|
-
children:
|
|
258
|
+
children: k("pages.orders.colDate", "Date")
|
|
253
259
|
}),
|
|
254
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ S("div", {
|
|
255
261
|
className: $,
|
|
256
|
-
children:
|
|
262
|
+
children: k("pages.orders.colItems", "Items")
|
|
257
263
|
}),
|
|
258
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ S("div", {
|
|
259
265
|
className: `${$} text-right`,
|
|
260
|
-
children:
|
|
266
|
+
children: k("pages.orders.colTotal", "Total")
|
|
261
267
|
}),
|
|
262
|
-
/* @__PURE__ */
|
|
268
|
+
/* @__PURE__ */ S("div", {
|
|
263
269
|
className: `${$} text-center`,
|
|
264
|
-
children:
|
|
270
|
+
children: k("pages.orders.colStatus", "Status")
|
|
265
271
|
})
|
|
266
272
|
]
|
|
267
273
|
}),
|
|
268
|
-
|
|
269
|
-
let t =
|
|
270
|
-
return /* @__PURE__ */
|
|
274
|
+
Y.map((e) => {
|
|
275
|
+
let t = re.has(e.id), r = e.status === "COMPLETED" || e.status === "FULFILLED" || e.status === "PROCESSED";
|
|
276
|
+
return /* @__PURE__ */ C("div", {
|
|
271
277
|
className: "border-b border-border-seam last:border-b-0",
|
|
272
|
-
children: [/* @__PURE__ */
|
|
278
|
+
children: [/* @__PURE__ */ C("button", {
|
|
273
279
|
type: "button",
|
|
274
280
|
onClick: () => se(e.id),
|
|
275
281
|
className: "grid w-full cursor-pointer grid-cols-[40px_1fr_180px_140px_120px_160px] items-center transition-colors hover:bg-bg-sunken/50 md:grid",
|
|
276
282
|
children: [
|
|
277
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ S("div", {
|
|
278
284
|
className: `${Q} flex justify-center`,
|
|
279
|
-
children: /* @__PURE__ */
|
|
285
|
+
children: /* @__PURE__ */ S(m, { className: `size-4 text-text-muted transition-transform duration-200 ${t ? "rotate-90" : ""}` })
|
|
280
286
|
}),
|
|
281
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ S("div", {
|
|
282
288
|
className: `${Q} font-medium text-text-primary`,
|
|
283
289
|
children: e.orderNumber
|
|
284
290
|
}),
|
|
285
|
-
/* @__PURE__ */
|
|
291
|
+
/* @__PURE__ */ S("div", {
|
|
286
292
|
className: `${Q} text-text-muted`,
|
|
287
293
|
children: new Date(e.createdAt).toLocaleDateString("en-US", {
|
|
288
294
|
year: "numeric",
|
|
@@ -290,82 +296,82 @@ var T = [
|
|
|
290
296
|
day: "numeric"
|
|
291
297
|
})
|
|
292
298
|
}),
|
|
293
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ C("div", {
|
|
294
300
|
className: `${Q} text-text-muted`,
|
|
295
301
|
children: [
|
|
296
302
|
e.items.length,
|
|
297
303
|
" ",
|
|
298
|
-
e.items.length === 1 ?
|
|
299
|
-
/* @__PURE__ */
|
|
304
|
+
e.items.length === 1 ? k("pages.orders.item", "item") : k("pages.orders.items", "items"),
|
|
305
|
+
/* @__PURE__ */ S("span", {
|
|
300
306
|
className: "block text-xs text-text-muted/70",
|
|
301
307
|
children: e.items.map((e) => e.productName).join(", ")
|
|
302
308
|
})
|
|
303
309
|
]
|
|
304
310
|
}),
|
|
305
|
-
/* @__PURE__ */
|
|
311
|
+
/* @__PURE__ */ S("div", {
|
|
306
312
|
className: `${Q} text-right font-semibold tabular-nums text-text-primary`,
|
|
307
|
-
children: n(e.total)
|
|
313
|
+
children: n(e.total, e.currency)
|
|
308
314
|
}),
|
|
309
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ S("div", {
|
|
310
316
|
className: `${Q} flex justify-center`,
|
|
311
|
-
children: /* @__PURE__ */
|
|
317
|
+
children: /* @__PURE__ */ S(te, {
|
|
312
318
|
status: e.status,
|
|
313
|
-
tr:
|
|
319
|
+
tr: k
|
|
314
320
|
})
|
|
315
321
|
})
|
|
316
322
|
]
|
|
317
|
-
}), t && /* @__PURE__ */
|
|
323
|
+
}), t && /* @__PURE__ */ C("div", {
|
|
318
324
|
className: "border-t border-border-seam bg-bg-sunken/30",
|
|
319
325
|
children: [
|
|
320
|
-
e.fulfillment && /* @__PURE__ */
|
|
326
|
+
e.fulfillment && /* @__PURE__ */ C("div", {
|
|
321
327
|
className: "mx-4 mt-4 rounded-xl border border-border-seam bg-bg-surface px-4 py-4 md:mx-12",
|
|
322
|
-
children: [/* @__PURE__ */
|
|
328
|
+
children: [/* @__PURE__ */ C("div", {
|
|
323
329
|
className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between",
|
|
324
|
-
children: [/* @__PURE__ */
|
|
330
|
+
children: [/* @__PURE__ */ C("div", { children: [/* @__PURE__ */ S("div", {
|
|
325
331
|
className: "text-sm font-semibold text-text-primary",
|
|
326
|
-
children:
|
|
327
|
-
}), /* @__PURE__ */
|
|
332
|
+
children: k("pages.orders.orderTracking", "Order tracking")
|
|
333
|
+
}), /* @__PURE__ */ C("div", {
|
|
328
334
|
className: "mt-1 text-xs text-text-muted",
|
|
329
335
|
children: [
|
|
330
|
-
e.fulfillment.status ||
|
|
336
|
+
e.fulfillment.status || k("pages.orders.statusPending", "Pending"),
|
|
331
337
|
e.fulfillment.carrier ? ` · ${e.fulfillment.carrier}` : "",
|
|
332
|
-
e.fulfillment.estimatedDeliveryDate ? ` · ${
|
|
338
|
+
e.fulfillment.estimatedDeliveryDate ? ` · ${k("pages.orders.estimatedDelivery", "Est. delivery {{date}}", { date: new Date(e.fulfillment.estimatedDeliveryDate).toLocaleDateString() })}` : ""
|
|
333
339
|
]
|
|
334
|
-
})] }), /* @__PURE__ */
|
|
340
|
+
})] }), /* @__PURE__ */ C("div", {
|
|
335
341
|
className: "flex flex-col items-start gap-2 md:items-end",
|
|
336
|
-
children: [e.fulfillment.trackingNumber && /* @__PURE__ */
|
|
342
|
+
children: [e.fulfillment.trackingNumber && /* @__PURE__ */ S("div", {
|
|
337
343
|
className: "text-xs text-text-muted",
|
|
338
|
-
children:
|
|
339
|
-
}), e.fulfillment.trackingUrl && /* @__PURE__ */
|
|
344
|
+
children: k("pages.orders.trackingNumber", "Tracking #: {{number}}", { number: e.fulfillment.trackingNumber })
|
|
345
|
+
}), e.fulfillment.trackingUrl && /* @__PURE__ */ C("a", {
|
|
340
346
|
href: e.fulfillment.trackingUrl,
|
|
341
347
|
target: "_blank",
|
|
342
348
|
rel: "noreferrer",
|
|
343
349
|
className: "inline-flex items-center gap-1 rounded-md border border-border-default px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken",
|
|
344
|
-
children: [
|
|
350
|
+
children: [k("pages.orders.trackPackage", "Track package"), /* @__PURE__ */ S(m, { className: "size-3.5" })]
|
|
345
351
|
})]
|
|
346
352
|
})]
|
|
347
|
-
}), /* @__PURE__ */
|
|
353
|
+
}), /* @__PURE__ */ S("div", {
|
|
348
354
|
className: "mt-4 grid gap-2 sm:grid-cols-4",
|
|
349
355
|
children: [
|
|
350
356
|
{
|
|
351
357
|
key: "PROCESSING",
|
|
352
|
-
label:
|
|
358
|
+
label: k("pages.orders.stepProcessing", "Processing")
|
|
353
359
|
},
|
|
354
360
|
{
|
|
355
361
|
key: "SHIPPED",
|
|
356
|
-
label:
|
|
362
|
+
label: k("pages.orders.stepShipped", "Shipped")
|
|
357
363
|
},
|
|
358
364
|
{
|
|
359
365
|
key: "OUT_FOR_DELIVERY",
|
|
360
|
-
label:
|
|
366
|
+
label: k("pages.orders.stepOutForDelivery", "Out for delivery")
|
|
361
367
|
},
|
|
362
368
|
{
|
|
363
369
|
key: "DELIVERED",
|
|
364
|
-
label:
|
|
370
|
+
label: k("pages.orders.stepDelivered", "Delivered")
|
|
365
371
|
}
|
|
366
372
|
].map((t) => {
|
|
367
373
|
let n = e.fulfillment?.status || "PENDING";
|
|
368
|
-
return /* @__PURE__ */
|
|
374
|
+
return /* @__PURE__ */ S("div", {
|
|
369
375
|
className: `rounded-lg border px-3 py-2 text-xs font-medium ${[
|
|
370
376
|
"PROCESSING",
|
|
371
377
|
"READY_TO_SHIP",
|
|
@@ -384,141 +390,147 @@ var T = [
|
|
|
384
390
|
})
|
|
385
391
|
})]
|
|
386
392
|
}),
|
|
387
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ C("div", {
|
|
388
394
|
className: "hidden grid-cols-[1fr_100px_120px_160px] gap-4 px-12 py-2 md:grid",
|
|
389
395
|
children: [
|
|
390
|
-
/* @__PURE__ */
|
|
396
|
+
/* @__PURE__ */ S("span", {
|
|
391
397
|
className: "text-xs font-medium text-text-muted",
|
|
392
|
-
children:
|
|
398
|
+
children: k("pages.orders.colProduct", "Product")
|
|
393
399
|
}),
|
|
394
|
-
/* @__PURE__ */
|
|
400
|
+
/* @__PURE__ */ S("span", {
|
|
395
401
|
className: "text-xs font-medium text-text-muted text-right",
|
|
396
|
-
children:
|
|
402
|
+
children: k("pages.orders.colQty", "Qty")
|
|
397
403
|
}),
|
|
398
|
-
/* @__PURE__ */
|
|
404
|
+
/* @__PURE__ */ S("span", {
|
|
399
405
|
className: "text-xs font-medium text-text-muted text-right",
|
|
400
|
-
children:
|
|
406
|
+
children: k("pages.orders.colPrice", "Price")
|
|
401
407
|
}),
|
|
402
|
-
/* @__PURE__ */
|
|
408
|
+
/* @__PURE__ */ S("span", {
|
|
403
409
|
className: "text-xs font-medium text-text-muted text-center",
|
|
404
|
-
children:
|
|
410
|
+
children: k("pages.orders.colAction", "Action")
|
|
405
411
|
})
|
|
406
412
|
]
|
|
407
413
|
}),
|
|
408
414
|
e.items.map((t) => {
|
|
409
415
|
let i = t.productType !== "PHYSICAL" && t.productType !== "MERCHANDISE";
|
|
410
|
-
return /* @__PURE__ */
|
|
416
|
+
return /* @__PURE__ */ C("div", {
|
|
411
417
|
className: "grid grid-cols-[auto_1fr_auto] items-center gap-3 px-4 py-3 md:px-12 md:grid-cols-[1fr_100px_120px_160px]",
|
|
412
418
|
children: [
|
|
413
|
-
/* @__PURE__ */
|
|
419
|
+
/* @__PURE__ */ C("div", {
|
|
414
420
|
className: "flex items-center gap-3 min-w-0",
|
|
415
|
-
children: [/* @__PURE__ */
|
|
421
|
+
children: [/* @__PURE__ */ S("div", {
|
|
416
422
|
className: "size-10 flex-shrink-0 overflow-hidden rounded-lg bg-bg-sunken",
|
|
417
|
-
children: t.productIcon ? /* @__PURE__ */
|
|
423
|
+
children: t.productIcon ? /* @__PURE__ */ S("img", {
|
|
418
424
|
src: t.productIcon,
|
|
419
425
|
alt: t.productName,
|
|
420
426
|
className: "size-full object-cover"
|
|
421
|
-
}) : /* @__PURE__ */
|
|
427
|
+
}) : /* @__PURE__ */ S("div", {
|
|
422
428
|
className: "flex size-full items-center justify-center text-sm font-bold text-text-muted",
|
|
423
429
|
children: t.productName.charAt(0)
|
|
424
430
|
})
|
|
425
|
-
}), /* @__PURE__ */
|
|
431
|
+
}), /* @__PURE__ */ C("div", {
|
|
426
432
|
className: "min-w-0",
|
|
427
|
-
children: [/* @__PURE__ */
|
|
433
|
+
children: [/* @__PURE__ */ S("p", {
|
|
428
434
|
className: "truncate text-sm font-medium text-text-primary",
|
|
429
435
|
children: t.productName
|
|
430
|
-
}), /* @__PURE__ */
|
|
436
|
+
}), /* @__PURE__ */ S("span", {
|
|
431
437
|
className: "inline-flex items-center rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-muted",
|
|
432
438
|
children: t.productType
|
|
433
439
|
})]
|
|
434
440
|
})]
|
|
435
441
|
}),
|
|
436
|
-
/* @__PURE__ */
|
|
442
|
+
/* @__PURE__ */ S("div", {
|
|
437
443
|
className: "hidden text-right text-sm text-text-muted md:block",
|
|
438
444
|
children: t.quantity
|
|
439
445
|
}),
|
|
440
|
-
/* @__PURE__ */
|
|
446
|
+
/* @__PURE__ */ S("div", {
|
|
441
447
|
className: "hidden text-right text-sm font-semibold tabular-nums text-text-primary md:block",
|
|
442
|
-
children: n(t.totalPrice)
|
|
448
|
+
children: n(t.totalPrice, e.catalogCurrency)
|
|
443
449
|
}),
|
|
444
|
-
/* @__PURE__ */
|
|
450
|
+
/* @__PURE__ */ S("div", {
|
|
445
451
|
className: "text-right text-sm text-text-muted md:hidden",
|
|
446
|
-
children: /* @__PURE__ */
|
|
452
|
+
children: /* @__PURE__ */ S("span", {
|
|
447
453
|
className: "tabular-nums",
|
|
448
|
-
children:
|
|
454
|
+
children: k("pages.orders.qtyTimesPrice", "{{qty}} × {{price}}", {
|
|
449
455
|
qty: t.quantity,
|
|
450
|
-
price: n(t.unitPrice)
|
|
456
|
+
price: n(t.unitPrice, e.catalogCurrency)
|
|
451
457
|
})
|
|
452
458
|
})
|
|
453
459
|
}),
|
|
454
|
-
/* @__PURE__ */
|
|
460
|
+
/* @__PURE__ */ S("div", {
|
|
455
461
|
className: "flex justify-end md:justify-center",
|
|
456
|
-
children: t.installed ? /* @__PURE__ */
|
|
462
|
+
children: t.installed ? /* @__PURE__ */ C("span", {
|
|
457
463
|
className: "inline-flex items-center gap-1 rounded-lg px-3 py-1.5 text-xs font-medium text-status-success-text",
|
|
458
|
-
children: [/* @__PURE__ */
|
|
459
|
-
}) : r && i ? /* @__PURE__ */
|
|
464
|
+
children: [/* @__PURE__ */ S(p, { className: "size-3.5" }), k("pages.orders.installed", "Installed")]
|
|
465
|
+
}) : r && i ? /* @__PURE__ */ C("button", {
|
|
460
466
|
type: "button",
|
|
461
467
|
onClick: (n) => {
|
|
462
468
|
n.stopPropagation(), ce(e.id, t);
|
|
463
469
|
},
|
|
464
470
|
className: "inline-flex cursor-pointer items-center gap-1.5 rounded-lg bg-action-primary-bg px-3 py-1.5 text-xs font-medium text-action-primary-text transition-all hover:opacity-90 active:scale-95",
|
|
465
|
-
children: [/* @__PURE__ */
|
|
471
|
+
children: [/* @__PURE__ */ S(g, { className: "size-3.5" }), k("pages.orders.installApp", "Install App")]
|
|
466
472
|
}) : null
|
|
467
473
|
})
|
|
468
474
|
]
|
|
469
475
|
}, t.id);
|
|
470
476
|
}),
|
|
471
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ C("div", {
|
|
472
478
|
className: "border-t border-border-seam/50 px-4 py-2 md:px-12",
|
|
473
|
-
children: /* @__PURE__ */
|
|
479
|
+
children: [e.isActualCharge && e.currency !== e.catalogCurrency && /* @__PURE__ */ S("p", {
|
|
480
|
+
className: "mb-1 text-right text-xs text-text-muted",
|
|
481
|
+
children: k("pages.orders.paidInCurrency", "Listed in {{catalogCurrency}}, actually charged in {{currency}}", {
|
|
482
|
+
catalogCurrency: e.catalogCurrency,
|
|
483
|
+
currency: e.currency
|
|
484
|
+
})
|
|
485
|
+
}), /* @__PURE__ */ C("div", {
|
|
474
486
|
className: "flex justify-end gap-6 text-xs text-text-muted",
|
|
475
487
|
children: [
|
|
476
|
-
/* @__PURE__ */
|
|
477
|
-
|
|
488
|
+
/* @__PURE__ */ C("span", { children: [
|
|
489
|
+
k("pages.orders.subtotal", "Subtotal:"),
|
|
478
490
|
" ",
|
|
479
|
-
/* @__PURE__ */
|
|
491
|
+
/* @__PURE__ */ S("span", {
|
|
480
492
|
className: "tabular-nums text-text-primary",
|
|
481
|
-
children: n(e.subtotal)
|
|
493
|
+
children: n(e.subtotal, e.currency)
|
|
482
494
|
})
|
|
483
495
|
] }),
|
|
484
|
-
/* @__PURE__ */
|
|
485
|
-
|
|
496
|
+
/* @__PURE__ */ C("span", { children: [
|
|
497
|
+
k("pages.orders.tax", "Tax:"),
|
|
486
498
|
" ",
|
|
487
|
-
/* @__PURE__ */
|
|
499
|
+
/* @__PURE__ */ S("span", {
|
|
488
500
|
className: "tabular-nums text-text-primary",
|
|
489
|
-
children: n(e.tax)
|
|
501
|
+
children: n(e.tax, e.currency)
|
|
490
502
|
})
|
|
491
503
|
] }),
|
|
492
|
-
/* @__PURE__ */
|
|
504
|
+
/* @__PURE__ */ C("span", {
|
|
493
505
|
className: "font-semibold",
|
|
494
506
|
children: [
|
|
495
|
-
|
|
507
|
+
k("pages.orders.total", "Total:"),
|
|
496
508
|
" ",
|
|
497
|
-
/* @__PURE__ */
|
|
509
|
+
/* @__PURE__ */ S("span", {
|
|
498
510
|
className: "tabular-nums text-text-primary",
|
|
499
|
-
children: n(e.total)
|
|
511
|
+
children: n(e.total, e.currency)
|
|
500
512
|
})
|
|
501
513
|
]
|
|
502
514
|
})
|
|
503
515
|
]
|
|
504
|
-
})
|
|
516
|
+
})]
|
|
505
517
|
})
|
|
506
518
|
]
|
|
507
519
|
})]
|
|
508
520
|
}, e.id);
|
|
509
521
|
}),
|
|
510
|
-
|
|
522
|
+
P && /* @__PURE__ */ S("div", {
|
|
511
523
|
className: "flex justify-center px-4 py-5",
|
|
512
|
-
children: /* @__PURE__ */
|
|
524
|
+
children: /* @__PURE__ */ C("button", {
|
|
513
525
|
type: "button",
|
|
514
|
-
onClick:
|
|
515
|
-
disabled:
|
|
526
|
+
onClick: F,
|
|
527
|
+
disabled: j,
|
|
516
528
|
className: "flex items-center gap-2 rounded-lg border border-border-default px-6 py-2.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-subtle disabled:opacity-50",
|
|
517
|
-
"aria-label":
|
|
518
|
-
children: [
|
|
529
|
+
"aria-label": O("common.loadMore", { defaultValue: "Load more" }),
|
|
530
|
+
children: [j ? /* @__PURE__ */ S(_, {
|
|
519
531
|
className: "size-4 animate-spin",
|
|
520
532
|
"aria-hidden": "true"
|
|
521
|
-
}) : null,
|
|
533
|
+
}) : null, O("common.loadMore", { defaultValue: "Load more" })]
|
|
522
534
|
})
|
|
523
535
|
})
|
|
524
536
|
]
|
|
@@ -526,18 +538,18 @@ var T = [
|
|
|
526
538
|
})]
|
|
527
539
|
})
|
|
528
540
|
}),
|
|
529
|
-
|
|
530
|
-
isOpen:
|
|
531
|
-
onClose:
|
|
532
|
-
app:
|
|
533
|
-
orderId:
|
|
541
|
+
H && /* @__PURE__ */ S(i, {
|
|
542
|
+
isOpen: ae,
|
|
543
|
+
onClose: X,
|
|
544
|
+
app: H,
|
|
545
|
+
orderId: B,
|
|
534
546
|
onInstallSuccess: le,
|
|
535
|
-
onInstallError:
|
|
547
|
+
onInstallError: ue
|
|
536
548
|
})
|
|
537
549
|
]
|
|
538
550
|
});
|
|
539
551
|
};
|
|
540
552
|
//#endregion
|
|
541
|
-
export {
|
|
553
|
+
export { k as OrdersPage };
|
|
542
554
|
|
|
543
555
|
//# sourceMappingURL=OrdersPage.js.map
|