@burdenoff/microfe-store 2026.704.1 → 2026.706.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.
@@ -4,196 +4,74 @@ import { formatPrice as n } from "../utils/index.js";
4
4
  import { InstallAppModal as r } from "../components/InstallAppModal.js";
5
5
  import { useInstallations as i } from "../hooks/useInstallations.js";
6
6
  import { useOrders as a } from "../hooks/useOrders.js";
7
- import { useMemo as o, useState as s } from "react";
8
- import { useI18n as c } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
9
- import { ArrowLeft as l, CheckCircle as u, Clock as d, Download as f, Loader2 as p, Package as m, RefreshCw as h, ShoppingBag as g, XCircle as _ } from "lucide-react";
10
- import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
7
+ import { useCallback as o, useMemo as s, useState as c } from "react";
8
+ import { useI18n as ee } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
9
+ import { ArrowLeft as l, CheckCircle as u, ChevronRight as d, Clock as f, Download as p, Loader2 as m, Package as h, RefreshCw as g, ShoppingBag as _, XCircle as v } from "lucide-react";
10
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
11
11
  import { useNavigate as x } from "react-router-dom";
12
12
  import { GlassCard as S, IllustratedEmptyState as C, PagePurpose as w } from "@burdenoff/fe-libs/ui";
13
13
  //#region src/pages/OrdersPage.tsx
14
- var T = (e) => {
14
+ var T = [
15
+ "COMPLETED",
16
+ "FULFILLED",
17
+ "PROCESSED"
18
+ ], E = (e) => {
15
19
  switch (e) {
16
20
  case "COMPLETED":
17
21
  case "FULFILLED":
18
22
  case "PROCESSED": return {
19
23
  icon: u,
20
- color: "text-status-success-text bg-status-success-bg-subtle/10",
24
+ classes: "bg-status-success-bg-subtle/15 text-status-success-text border-status-success-text/20",
21
25
  label: "Completed"
22
26
  };
23
27
  case "PROCESSING": return {
24
- icon: d,
25
- color: "text-status-warning-text bg-status-warning-bg-subtle/10",
28
+ icon: f,
29
+ classes: "bg-status-warning-bg-subtle/15 text-status-warning-text border-status-warning-text/20",
26
30
  label: "Processing"
27
31
  };
28
32
  case "PENDING": return {
29
- icon: d,
30
- color: "text-status-warning-text bg-status-warning-bg-subtle/10",
33
+ icon: f,
34
+ classes: "bg-status-warning-bg-subtle/15 text-status-warning-text border-status-warning-text/20",
31
35
  label: "Pending"
32
36
  };
33
37
  case "FAILED": return {
34
- icon: _,
35
- color: "text-status-error-text bg-status-error-bg-subtle/10",
38
+ icon: v,
39
+ classes: "bg-status-error-bg-subtle/15 text-status-error-text border-status-error-text/20",
36
40
  label: "Failed"
37
41
  };
38
42
  case "REFUNDED": return {
39
- icon: h,
40
- color: "text-status-warning-text bg-status-warning-bg-subtle/10",
43
+ icon: g,
44
+ classes: "bg-status-warning-bg-subtle/15 text-status-warning-text border-status-warning-text/20",
41
45
  label: "Refunded"
42
46
  };
43
47
  case "CANCELLED": return {
44
- icon: h,
45
- color: "text-text-muted bg-bg-sunken",
48
+ icon: g,
49
+ classes: "bg-bg-sunken text-text-muted border-border-default",
46
50
  label: "Cancelled"
47
51
  };
48
52
  default: return {
49
- icon: d,
50
- color: "text-text-muted",
53
+ icon: f,
54
+ classes: "bg-bg-sunken text-text-muted border-border-default",
51
55
  label: e
52
56
  };
53
57
  }
54
- }, E = ({ item: e, orderId: t, orderStatus: r, onOpenInstallModal: i, installing: a }) => {
55
- let o = r === "COMPLETED" || r === "FULFILLED" || r === "PROCESSED", s = e.productType !== "PHYSICAL" && e.productType !== "MERCHANDISE";
56
- return /* @__PURE__ */ b("div", {
57
- className: "flex items-center gap-4 rounded-lg border border-border-seam bg-bg-sunken/50 p-4",
58
- children: [
59
- /* @__PURE__ */ y("div", {
60
- className: "size-14 flex-shrink-0 overflow-hidden rounded-lg bg-bg-sunken",
61
- children: e.productIcon ? /* @__PURE__ */ y("img", {
62
- src: e.productIcon,
63
- alt: e.productName,
64
- className: "size-full object-cover"
65
- }) : /* @__PURE__ */ y("div", {
66
- className: "flex size-full items-center justify-center text-lg font-bold text-text-muted",
67
- children: e.productName.charAt(0)
68
- })
69
- }),
70
- /* @__PURE__ */ b("div", {
71
- className: "flex-1 min-w-0",
72
- children: [/* @__PURE__ */ y("h4", {
73
- className: "font-medium text-text-primary truncate",
74
- children: e.productName
75
- }), /* @__PURE__ */ b("div", {
76
- className: "flex items-center gap-2 mt-1",
77
- children: [/* @__PURE__ */ y("span", {
78
- className: "inline-flex items-center rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-muted",
79
- children: e.productType
80
- }), /* @__PURE__ */ b("span", {
81
- className: "text-sm text-text-muted",
82
- children: [
83
- e.quantity,
84
- " x ",
85
- n(e.unitPrice)
86
- ]
87
- })]
88
- })]
89
- }),
90
- /* @__PURE__ */ y("div", {
91
- className: "text-right",
92
- children: /* @__PURE__ */ y("p", {
93
- className: "font-semibold tabular-nums text-text-primary",
94
- children: n(e.totalPrice)
95
- })
96
- }),
97
- /* @__PURE__ */ y("div", {
98
- className: "flex-shrink-0",
99
- children: e.installed ? /* @__PURE__ */ b("span", {
100
- className: "inline-flex items-center gap-1.5 rounded-lg bg-status-success-bg-subtle/10 px-4 py-2 text-sm font-medium text-status-success-text",
101
- children: [/* @__PURE__ */ y(u, { className: "size-4" }), "Installed"]
102
- }) : o && s ? /* @__PURE__ */ y("button", {
103
- type: "button",
104
- onClick: () => i(t, e),
105
- disabled: a,
106
- className: "inline-flex cursor-pointer items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-opacity hover:opacity-90 disabled:opacity-50",
107
- children: a ? /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(p, { className: "size-4 animate-spin" }), "Installing…"] }) : /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(f, { className: "size-4" }), "Install App"] })
108
- }) : null
109
- })
110
- ]
111
- });
112
- }, D = ({ order: e, onOpenInstallModal: t, installingItem: r }) => {
113
- let i = T(e.status), a = i.icon;
114
- return /* @__PURE__ */ b(S, {
115
- className: "p-6",
116
- children: [
117
- /* @__PURE__ */ b("div", {
118
- className: "flex items-start justify-between mb-4",
119
- children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ b("div", {
120
- className: "flex items-center gap-3",
121
- children: [/* @__PURE__ */ y("h3", {
122
- className: "text-lg font-semibold text-text-primary",
123
- children: e.orderNumber
124
- }), /* @__PURE__ */ b("span", {
125
- className: `inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-sm font-semibold ${i.color}`,
126
- children: [/* @__PURE__ */ y(a, { className: "size-4" }), i.label]
127
- })]
128
- }), /* @__PURE__ */ y("p", {
129
- className: "text-sm text-text-muted mt-1",
130
- children: new Date(e.createdAt).toLocaleDateString("en-US", {
131
- year: "numeric",
132
- month: "long",
133
- day: "numeric",
134
- hour: "2-digit",
135
- minute: "2-digit"
136
- })
137
- })] }), /* @__PURE__ */ b("div", {
138
- className: "text-right",
139
- children: [/* @__PURE__ */ y("p", {
140
- className: "text-xl font-bold tabular-nums text-text-primary",
141
- children: n(e.total)
142
- }), /* @__PURE__ */ b("p", {
143
- className: "text-xs text-text-muted",
144
- children: [
145
- e.items.length,
146
- " ",
147
- e.items.length === 1 ? "item" : "items"
148
- ]
149
- })]
150
- })]
151
- }),
152
- /* @__PURE__ */ y("div", {
153
- className: "space-y-3",
154
- children: e.items.map((n) => /* @__PURE__ */ y(E, {
155
- item: n,
156
- orderId: e.id,
157
- orderStatus: e.status,
158
- onOpenInstallModal: t,
159
- installing: r === n.id
160
- }, n.id))
161
- }),
162
- /* @__PURE__ */ b("div", {
163
- className: "mt-4 pt-4 border-t border-border-seam",
164
- children: [/* @__PURE__ */ b("div", {
165
- className: "flex justify-between text-sm",
166
- children: [/* @__PURE__ */ y("span", {
167
- className: "text-text-muted",
168
- children: "Subtotal"
169
- }), /* @__PURE__ */ y("span", {
170
- className: "tabular-nums text-text-primary",
171
- children: n(e.subtotal)
172
- })]
173
- }), /* @__PURE__ */ b("div", {
174
- className: "flex justify-between text-sm mt-1",
175
- children: [/* @__PURE__ */ y("span", {
176
- className: "text-text-muted",
177
- children: "Tax"
178
- }), /* @__PURE__ */ y("span", {
179
- className: "tabular-nums text-text-primary",
180
- children: n(e.tax)
181
- })]
182
- })]
183
- })
184
- ]
58
+ }, D = ({ status: e }) => {
59
+ let t = E(e), n = t.icon;
60
+ return /* @__PURE__ */ b("span", {
61
+ className: `inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-semibold ${t.classes}`,
62
+ children: [/* @__PURE__ */ y(n, { className: "size-3.5" }), t.label]
185
63
  });
186
64
  }, O = () => {
187
- let n = x(), { basePath: u } = e(), { t: d } = c(), { orders: f, loading: h, error: v, refetchOrders: S, hasMore: T, loadMore: E } = a(), { installations: O, refetch: k } = i();
65
+ let f = x(), { basePath: g } = e(), { t: E } = ee(), { orders: O, loading: k, error: A, refetchOrders: j, hasMore: M, loadMore: te } = a(), { installations: N, refetch: ne } = i();
188
66
  t({
189
67
  onData: () => {
190
- S();
68
+ j();
191
69
  },
192
70
  onError: (e) => {
193
71
  console.warn("OrderStatusUpdated subscription error:", e.message);
194
72
  }
195
73
  });
196
- let [A, j] = s(!1), [M, N] = s(null), [P, F] = s(null), [I, L] = s(null), R = o(() => new Set(O.flatMap((e) => e.status === "ACTIVE" ? [e.productId] : [])), [O]), z = f.map((e) => {
74
+ let [re, P] = c(/* @__PURE__ */ new Set()), [F, I] = c("completed"), [L, R] = c(!1), [z, B] = c(null), [V, H] = c(null), [ie, U] = c(null), W = s(() => new Set(N.flatMap((e) => e.status === "ACTIVE" ? [e.productId] : [])), [N]), G = O.map((e) => {
197
75
  let t = e.lineItems || [], n = t.reduce((e, t) => e + t.subtotal, 0), r = e.total - n, i = t.map((t, n) => ({
198
76
  id: `${e.id}-${n}`,
199
77
  productId: t.productId,
@@ -204,7 +82,7 @@ var T = (e) => {
204
82
  quantity: t.quantity,
205
83
  unitPrice: t.unitPrice,
206
84
  totalPrice: t.subtotal,
207
- installed: R.has(t.productId)
85
+ installed: W.has(t.productId)
208
86
  }));
209
87
  return {
210
88
  id: e.id,
@@ -216,132 +94,373 @@ var T = (e) => {
216
94
  status: e.status,
217
95
  createdAt: e.createdAt
218
96
  };
219
- }), B = (e, t) => {
220
- N(e), L(t.id), F({
97
+ }), K = s(() => G.filter((e) => T.includes(e.status)), [G]), q = s(() => G.filter((e) => !T.includes(e.status)), [G]), J = F === "completed" ? K : q, Y = o((e) => {
98
+ P((t) => {
99
+ let n = new Set(t);
100
+ return n.has(e) ? n.delete(e) : n.add(e), n;
101
+ });
102
+ }, []), ae = (e, t) => {
103
+ B(e), U(t.id), H({
221
104
  id: t.productId,
222
105
  name: t.productName,
223
106
  icon: t.productIcon,
224
107
  type: t.productType,
225
108
  version: t.version
226
- }), j(!0);
227
- }, V = () => {
228
- j(!1), N(null), F(null), L(null);
229
- }, H = (e, t) => {
230
- !M || !I || (console.log(`Successfully installed ${P?.name} to workspace ${t} (${e})`), V(), k());
231
- }, U = (e) => {
232
- console.error("Installation failed:", e.message);
233
- }, W = () => {
234
- n(`${u}/marketplace`);
235
- };
109
+ }), R(!0);
110
+ }, X = () => {
111
+ R(!1), B(null), H(null), U(null);
112
+ }, oe = (e, t) => {
113
+ X(), ne();
114
+ }, se = (e) => {}, Z = () => {
115
+ f(`${g}/marketplace`);
116
+ }, Q = "px-4 py-3 text-sm", $ = "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wider text-text-muted";
236
117
  return /* @__PURE__ */ b("div", {
237
- className: "h-full overflow-y-auto",
118
+ className: "flex h-full flex-col",
238
119
  children: [
239
120
  /* @__PURE__ */ y("header", {
240
- className: "sticky top-0 z-10 border-b border-border-seam bg-bg-surface px-6 py-4",
121
+ className: "flex-shrink-0 border-b border-border-seam bg-bg-surface px-6 py-4",
241
122
  children: /* @__PURE__ */ y("div", {
242
- className: "mx-auto max-w-4xl",
243
- children: /* @__PURE__ */ b("div", {
244
- className: "flex items-center gap-4",
245
- children: [/* @__PURE__ */ y("button", {
246
- type: "button",
247
- onClick: () => n(-1),
248
- "aria-label": "Go back",
249
- className: "cursor-pointer rounded-lg p-2 text-text-muted transition-colors hover:bg-bg-sunken hover:text-text-primary",
250
- children: /* @__PURE__ */ y(l, { className: "size-5" })
251
- }), /* @__PURE__ */ b("div", {
252
- className: "flex items-center gap-3",
253
- children: [
254
- /* @__PURE__ */ y(m, { className: "size-6 text-text-primary" }),
255
- /* @__PURE__ */ y("h1", {
256
- className: "text-xl font-bold text-text-primary",
257
- children: d("pages.orders.title", { defaultValue: "My Orders" })
258
- }),
259
- z.length > 0 && /* @__PURE__ */ y("span", {
260
- className: "rounded-full bg-action-primary-bg px-2.5 py-0.5 text-sm font-medium text-action-primary-text",
261
- children: z.length
262
- })
263
- ]
264
- })]
123
+ className: "mx-auto max-w-6xl",
124
+ children: /* @__PURE__ */ y("div", {
125
+ className: "flex items-center justify-between",
126
+ children: /* @__PURE__ */ b("div", {
127
+ className: "flex items-center gap-4",
128
+ children: [/* @__PURE__ */ y("button", {
129
+ type: "button",
130
+ onClick: () => f(-1),
131
+ "aria-label": "Go back",
132
+ className: "cursor-pointer rounded-lg p-2 text-text-muted transition-colors hover:bg-bg-sunken hover:text-text-primary",
133
+ children: /* @__PURE__ */ y(l, { className: "size-5" })
134
+ }), /* @__PURE__ */ b("div", {
135
+ className: "flex items-center gap-3",
136
+ children: [
137
+ /* @__PURE__ */ y(h, { className: "size-6 text-text-primary" }),
138
+ /* @__PURE__ */ y("h1", {
139
+ className: "text-xl font-bold text-text-primary",
140
+ children: E("pages.orders.title", { defaultValue: "My Orders" })
141
+ }),
142
+ G.length > 0 && /* @__PURE__ */ y("span", {
143
+ className: "rounded-full bg-action-primary-bg/10 px-2.5 py-0.5 text-sm font-medium text-action-primary-bg",
144
+ children: G.length
145
+ })
146
+ ]
147
+ })]
148
+ })
265
149
  })
266
150
  })
267
151
  }),
268
- /* @__PURE__ */ b("main", {
269
- className: "mx-auto max-w-4xl p-6",
270
- children: [/* @__PURE__ */ y(w, {
271
- className: "mb-6",
272
- children: "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."
273
- }), h ? /* @__PURE__ */ b("output", {
274
- "aria-label": "Loading orders",
275
- className: "flex flex-col items-center justify-center py-16",
276
- children: [/* @__PURE__ */ y(p, {
277
- className: "size-12 animate-spin text-text-muted mb-4",
278
- "aria-hidden": "true"
279
- }), /* @__PURE__ */ y("p", {
280
- className: "text-text-muted",
281
- children: "Loading your orders…"
282
- })]
283
- }) : v ? /* @__PURE__ */ b("div", {
284
- role: "alert",
285
- className: "flex flex-col items-center justify-center py-16 text-center",
286
- children: [
287
- /* @__PURE__ */ y("div", {
288
- className: "mb-6 rounded-full bg-status-error-bg-subtle/10 p-6",
289
- children: /* @__PURE__ */ y(_, { className: "size-16 text-status-error-text" })
290
- }),
291
- /* @__PURE__ */ y("h2", {
292
- className: "mb-2 text-2xl font-bold text-text-primary",
293
- children: d("pages.orders.failedToLoad", { defaultValue: "Failed to load orders" })
294
- }),
295
- /* @__PURE__ */ y("p", {
296
- className: "mb-6 max-w-md text-text-muted",
297
- children: v.message || "An error occurred while loading your orders. Please try again."
298
- }),
299
- /* @__PURE__ */ b("button", {
152
+ /* @__PURE__ */ y("div", {
153
+ className: "flex-1 overflow-y-auto",
154
+ children: /* @__PURE__ */ b("div", {
155
+ className: "mx-auto max-w-6xl p-6",
156
+ children: [/* @__PURE__ */ y(w, {
157
+ className: "mb-6",
158
+ children: "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."
159
+ }), k && G.length === 0 ? /* @__PURE__ */ b("div", {
160
+ className: "flex flex-col items-center justify-center py-24",
161
+ children: [/* @__PURE__ */ y(m, {
162
+ className: "size-12 animate-spin text-text-muted mb-4",
163
+ "aria-hidden": "true"
164
+ }), /* @__PURE__ */ y("p", {
165
+ className: "text-text-muted",
166
+ children: "Loading your orders…"
167
+ })]
168
+ }) : A ? /* @__PURE__ */ b("div", {
169
+ className: "flex flex-col items-center justify-center py-24 text-center",
170
+ children: [
171
+ /* @__PURE__ */ y("div", {
172
+ className: "mb-6 rounded-full bg-status-error-bg-subtle/10 p-6",
173
+ children: /* @__PURE__ */ y(v, { className: "size-16 text-status-error-text" })
174
+ }),
175
+ /* @__PURE__ */ y("h2", {
176
+ className: "mb-2 text-2xl font-bold text-text-primary",
177
+ children: E("pages.orders.failedToLoad", { defaultValue: "Failed to load orders" })
178
+ }),
179
+ /* @__PURE__ */ y("p", {
180
+ className: "mb-6 max-w-md text-text-muted",
181
+ children: A.message || "An error occurred while loading your orders. Please try again."
182
+ }),
183
+ /* @__PURE__ */ b("button", {
184
+ type: "button",
185
+ onClick: Z,
186
+ 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",
187
+ children: [/* @__PURE__ */ y(_, { className: "size-5" }), "Browse Marketplace"]
188
+ })
189
+ ]
190
+ }) : G.length === 0 ? /* @__PURE__ */ y(C, {
191
+ illustration: "empty-data",
192
+ title: E("pages.orders.emptyTitle", { defaultValue: "No orders yet" }),
193
+ description: "You have not placed any orders yet. Browse the marketplace to discover apps and products!",
194
+ action: /* @__PURE__ */ b("button", {
300
195
  type: "button",
301
- onClick: W,
196
+ onClick: Z,
302
197
  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",
303
- children: [/* @__PURE__ */ y(g, { className: "size-5" }), "Browse Marketplace"]
304
- })
305
- ]
306
- }) : z.length === 0 ? /* @__PURE__ */ y(C, {
307
- illustration: "empty-data",
308
- title: d("pages.orders.emptyTitle", { defaultValue: "No orders yet" }),
309
- description: "You have not placed any orders yet. Browse the marketplace to discover apps and products!",
310
- action: /* @__PURE__ */ b("button", {
311
- type: "button",
312
- onClick: W,
313
- 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",
314
- children: [/* @__PURE__ */ y(g, { className: "size-5" }), "Browse Marketplace"]
315
- })
316
- }) : /* @__PURE__ */ b("ul", {
317
- className: "space-y-6",
318
- children: [z.map((e) => /* @__PURE__ */ y("li", { children: /* @__PURE__ */ y(D, {
319
- order: e,
320
- onOpenInstallModal: B,
321
- installingItem: A ? I : null
322
- }) }, e.id)), T && /* @__PURE__ */ y("li", {
323
- className: "flex justify-center pt-4 list-none",
324
- children: /* @__PURE__ */ b("button", {
325
- type: "button",
326
- onClick: E,
327
- disabled: h,
328
- className: "flex items-center gap-2 rounded-lg border border-border-default px-6 py-2.5 text-sm font-medium text-text-primary hover:bg-bg-subtle disabled:opacity-50",
329
- "aria-label": d("common.loadMore", { defaultValue: "Load more" }),
330
- children: [h ? /* @__PURE__ */ y(p, {
331
- className: "size-4 animate-spin",
332
- "aria-hidden": "true"
333
- }) : null, d("common.loadMore", { defaultValue: "Load more" })]
198
+ children: [/* @__PURE__ */ y(_, { className: "size-5" }), "Browse Marketplace"]
334
199
  })
200
+ }) : /* @__PURE__ */ b("div", {
201
+ className: "space-y-4",
202
+ children: [/* @__PURE__ */ b("div", {
203
+ className: "inline-flex rounded-xl border border-border-seam bg-bg-surface p-1",
204
+ children: [/* @__PURE__ */ b("button", {
205
+ type: "button",
206
+ onClick: () => I("completed"),
207
+ className: `rounded-lg px-4 py-2 text-sm font-medium transition-colors ${F === "completed" ? "bg-action-primary-bg text-action-primary-text" : "text-text-muted hover:bg-bg-sunken hover:text-text-primary"}`,
208
+ children: ["Completed", /* @__PURE__ */ y("span", {
209
+ className: "ml-2 rounded-full bg-black/10 px-2 py-0.5 text-xs",
210
+ children: K.length
211
+ })]
212
+ }), /* @__PURE__ */ b("button", {
213
+ type: "button",
214
+ onClick: () => I("pending"),
215
+ className: `rounded-lg px-4 py-2 text-sm font-medium transition-colors ${F === "pending" ? "bg-action-primary-bg text-action-primary-text" : "text-text-muted hover:bg-bg-sunken hover:text-text-primary"}`,
216
+ children: ["Pending", /* @__PURE__ */ y("span", {
217
+ className: "ml-2 rounded-full bg-black/10 px-2 py-0.5 text-xs",
218
+ children: q.length
219
+ })]
220
+ })]
221
+ }), J.length === 0 ? /* @__PURE__ */ b(S, {
222
+ className: "p-10 text-center",
223
+ children: [
224
+ /* @__PURE__ */ y("div", {
225
+ className: "mx-auto mb-4 flex size-14 items-center justify-center rounded-full bg-bg-sunken text-text-muted",
226
+ children: /* @__PURE__ */ y(h, { className: "size-6" })
227
+ }),
228
+ /* @__PURE__ */ y("h2", {
229
+ className: "mb-2 text-lg font-semibold text-text-primary",
230
+ children: F === "completed" ? "No completed orders yet" : "No pending orders"
231
+ }),
232
+ /* @__PURE__ */ y("p", {
233
+ className: "text-sm text-text-muted",
234
+ children: F === "completed" ? "Completed purchases will appear here once payment is successful." : "Orders that are pending, processing, failed, refunded, or cancelled will appear here."
235
+ })
236
+ ]
237
+ }) : /* @__PURE__ */ b("div", {
238
+ className: "overflow-hidden rounded-xl border border-border-seam bg-bg-surface",
239
+ children: [
240
+ /* @__PURE__ */ b("div", {
241
+ className: "hidden border-b border-border-seam bg-bg-sunken/50 md:grid md:grid-cols-[40px_1fr_180px_140px_120px_160px]",
242
+ children: [
243
+ /* @__PURE__ */ y("div", { className: $ }),
244
+ /* @__PURE__ */ y("div", {
245
+ className: $,
246
+ children: "Order"
247
+ }),
248
+ /* @__PURE__ */ y("div", {
249
+ className: $,
250
+ children: "Date"
251
+ }),
252
+ /* @__PURE__ */ y("div", {
253
+ className: $,
254
+ children: "Items"
255
+ }),
256
+ /* @__PURE__ */ y("div", {
257
+ className: `${$} text-right`,
258
+ children: "Total"
259
+ }),
260
+ /* @__PURE__ */ y("div", {
261
+ className: `${$} text-center`,
262
+ children: "Status"
263
+ })
264
+ ]
265
+ }),
266
+ J.map((e) => {
267
+ let t = re.has(e.id), r = e.status === "COMPLETED" || e.status === "FULFILLED" || e.status === "PROCESSED";
268
+ return /* @__PURE__ */ b("div", {
269
+ className: "border-b border-border-seam last:border-b-0",
270
+ children: [/* @__PURE__ */ b("button", {
271
+ type: "button",
272
+ onClick: () => Y(e.id),
273
+ 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",
274
+ children: [
275
+ /* @__PURE__ */ y("div", {
276
+ className: `${Q} flex justify-center`,
277
+ children: /* @__PURE__ */ y(d, { className: `size-4 text-text-muted transition-transform duration-200 ${t ? "rotate-90" : ""}` })
278
+ }),
279
+ /* @__PURE__ */ y("div", {
280
+ className: `${Q} font-medium text-text-primary`,
281
+ children: e.orderNumber
282
+ }),
283
+ /* @__PURE__ */ y("div", {
284
+ className: `${Q} text-text-muted`,
285
+ children: new Date(e.createdAt).toLocaleDateString("en-US", {
286
+ year: "numeric",
287
+ month: "short",
288
+ day: "numeric"
289
+ })
290
+ }),
291
+ /* @__PURE__ */ b("div", {
292
+ className: `${Q} text-text-muted`,
293
+ children: [
294
+ e.items.length,
295
+ " ",
296
+ e.items.length === 1 ? "item" : "items",
297
+ /* @__PURE__ */ y("span", {
298
+ className: "block text-xs text-text-muted/70",
299
+ children: e.items.map((e) => e.productName).join(", ")
300
+ })
301
+ ]
302
+ }),
303
+ /* @__PURE__ */ y("div", {
304
+ className: `${Q} text-right font-semibold tabular-nums text-text-primary`,
305
+ children: n(e.total)
306
+ }),
307
+ /* @__PURE__ */ y("div", {
308
+ className: `${Q} flex justify-center`,
309
+ children: /* @__PURE__ */ y(D, { status: e.status })
310
+ })
311
+ ]
312
+ }), t && /* @__PURE__ */ b("div", {
313
+ className: "border-t border-border-seam bg-bg-sunken/30",
314
+ children: [
315
+ /* @__PURE__ */ b("div", {
316
+ className: "hidden grid-cols-[1fr_100px_120px_160px] gap-4 px-12 py-2 md:grid",
317
+ children: [
318
+ /* @__PURE__ */ y("span", {
319
+ className: "text-xs font-medium text-text-muted",
320
+ children: "Product"
321
+ }),
322
+ /* @__PURE__ */ y("span", {
323
+ className: "text-xs font-medium text-text-muted text-right",
324
+ children: "Qty"
325
+ }),
326
+ /* @__PURE__ */ y("span", {
327
+ className: "text-xs font-medium text-text-muted text-right",
328
+ children: "Price"
329
+ }),
330
+ /* @__PURE__ */ y("span", {
331
+ className: "text-xs font-medium text-text-muted text-center",
332
+ children: "Action"
333
+ })
334
+ ]
335
+ }),
336
+ e.items.map((t) => {
337
+ let i = t.productType !== "PHYSICAL" && t.productType !== "MERCHANDISE";
338
+ return /* @__PURE__ */ b("div", {
339
+ 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]",
340
+ children: [
341
+ /* @__PURE__ */ b("div", {
342
+ className: "flex items-center gap-3 min-w-0",
343
+ children: [/* @__PURE__ */ y("div", {
344
+ className: "size-10 flex-shrink-0 overflow-hidden rounded-lg bg-bg-sunken",
345
+ children: t.productIcon ? /* @__PURE__ */ y("img", {
346
+ src: t.productIcon,
347
+ alt: t.productName,
348
+ className: "size-full object-cover"
349
+ }) : /* @__PURE__ */ y("div", {
350
+ className: "flex size-full items-center justify-center text-sm font-bold text-text-muted",
351
+ children: t.productName.charAt(0)
352
+ })
353
+ }), /* @__PURE__ */ b("div", {
354
+ className: "min-w-0",
355
+ children: [/* @__PURE__ */ y("p", {
356
+ className: "truncate text-sm font-medium text-text-primary",
357
+ children: t.productName
358
+ }), /* @__PURE__ */ y("span", {
359
+ className: "inline-flex items-center rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-muted",
360
+ children: t.productType
361
+ })]
362
+ })]
363
+ }),
364
+ /* @__PURE__ */ y("div", {
365
+ className: "hidden text-right text-sm text-text-muted md:block",
366
+ children: t.quantity
367
+ }),
368
+ /* @__PURE__ */ y("div", {
369
+ className: "hidden text-right text-sm font-semibold tabular-nums text-text-primary md:block",
370
+ children: n(t.totalPrice)
371
+ }),
372
+ /* @__PURE__ */ b("div", {
373
+ className: "text-right text-sm text-text-muted md:hidden",
374
+ children: [/* @__PURE__ */ b("span", {
375
+ className: "tabular-nums",
376
+ children: [t.quantity, " × "]
377
+ }), /* @__PURE__ */ y("span", {
378
+ className: "font-semibold text-text-primary tabular-nums",
379
+ children: n(t.unitPrice)
380
+ })]
381
+ }),
382
+ /* @__PURE__ */ y("div", {
383
+ className: "flex justify-end md:justify-center",
384
+ children: t.installed ? /* @__PURE__ */ b("span", {
385
+ className: "inline-flex items-center gap-1 rounded-lg px-3 py-1.5 text-xs font-medium text-status-success-text",
386
+ children: [/* @__PURE__ */ y(u, { className: "size-3.5" }), "Installed"]
387
+ }) : r && i ? /* @__PURE__ */ b("button", {
388
+ type: "button",
389
+ onClick: (n) => {
390
+ n.stopPropagation(), ae(e.id, t);
391
+ },
392
+ 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",
393
+ children: [/* @__PURE__ */ y(p, { className: "size-3.5" }), "Install App"]
394
+ }) : null
395
+ })
396
+ ]
397
+ }, t.id);
398
+ }),
399
+ /* @__PURE__ */ y("div", {
400
+ className: "border-t border-border-seam/50 px-4 py-2 md:px-12",
401
+ children: /* @__PURE__ */ b("div", {
402
+ className: "flex justify-end gap-6 text-xs text-text-muted",
403
+ children: [
404
+ /* @__PURE__ */ b("span", { children: [
405
+ "Subtotal:",
406
+ " ",
407
+ /* @__PURE__ */ y("span", {
408
+ className: "tabular-nums text-text-primary",
409
+ children: n(e.subtotal)
410
+ })
411
+ ] }),
412
+ /* @__PURE__ */ b("span", { children: [
413
+ "Tax:",
414
+ " ",
415
+ /* @__PURE__ */ y("span", {
416
+ className: "tabular-nums text-text-primary",
417
+ children: n(e.tax)
418
+ })
419
+ ] }),
420
+ /* @__PURE__ */ b("span", {
421
+ className: "font-semibold",
422
+ children: [
423
+ "Total:",
424
+ " ",
425
+ /* @__PURE__ */ y("span", {
426
+ className: "tabular-nums text-text-primary",
427
+ children: n(e.total)
428
+ })
429
+ ]
430
+ })
431
+ ]
432
+ })
433
+ })
434
+ ]
435
+ })]
436
+ }, e.id);
437
+ }),
438
+ M && /* @__PURE__ */ y("div", {
439
+ className: "flex justify-center px-4 py-5",
440
+ children: /* @__PURE__ */ b("button", {
441
+ type: "button",
442
+ onClick: te,
443
+ disabled: k,
444
+ 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",
445
+ "aria-label": E("common.loadMore", { defaultValue: "Load more" }),
446
+ children: [k ? /* @__PURE__ */ y(m, {
447
+ className: "size-4 animate-spin",
448
+ "aria-hidden": "true"
449
+ }) : null, E("common.loadMore", { defaultValue: "Load more" })]
450
+ })
451
+ })
452
+ ]
453
+ })]
335
454
  })]
336
- })]
455
+ })
337
456
  }),
338
- P && /* @__PURE__ */ y(r, {
339
- isOpen: A,
340
- onClose: V,
341
- app: P,
342
- orderId: M,
343
- onInstallSuccess: H,
344
- onInstallError: U
457
+ V && /* @__PURE__ */ y(r, {
458
+ isOpen: L,
459
+ onClose: X,
460
+ app: V,
461
+ orderId: z,
462
+ onInstallSuccess: oe,
463
+ onInstallError: se
345
464
  })
346
465
  ]
347
466
  });