@burdenoff/microfe-store 2026.706.1 → 2026.712.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.
@@ -1 +1 @@
1
- {"version":3,"file":"useOrders.js","names":[],"sources":["../../src/hooks/useOrders.ts"],"sourcesContent":["/**\n * Orders Hook\n *\n * Provides order operations that interact with the backend store service.\n * All order data is fetched from the backend via GraphQL.\n */\n\nimport { useState, useEffect, useCallback } from 'react';\nimport { useApolloClient } from '@apollo/client/react';\nimport { GetMyOrdersDocument } from '../generated/global-operations';\nimport type { OrderStatus } from '../generated/global-types';\nimport { useStoreGraphQLWithContext } from './useStoreGraphQLWithContext';\n\nconst DEFAULT_PAGE_SIZE = 20;\n\n// Local type definition until schema is fully generated\ninterface StoreOrder {\n id: string;\n status: string;\n total: number;\n currency: string;\n lineItems: Array<{\n productId: string;\n name: string;\n quantity: number;\n unitPrice: number;\n subtotal: number;\n itemType?: string;\n pricingModel?: string;\n productType?: string;\n productIcon?: string;\n variantId?: string;\n variantName?: string;\n version?: string;\n }>;\n createdAt: string;\n updatedAt: string;\n}\n\n/**\n * Hook for fetching and managing orders with offset-based pagination.\n */\nexport function useOrders(options?: { limit?: number; offset?: number; status?: OrderStatus }) {\n const { query: queryWithContext, hasOrganizationContext } = useStoreGraphQLWithContext();\n const globalClient = useApolloClient();\n\n const limit = options?.limit ?? DEFAULT_PAGE_SIZE;\n const [offset, setOffset] = useState(options?.offset ?? 0);\n const [status] = useState<OrderStatus | undefined>(options?.status);\n\n const [allOrders, setAllOrders] = useState<StoreOrder[]>([]);\n const [hasMore, setHasMore] = useState(false);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchOrders = useCallback(\n async (fetchOffset: number = 0, append = false) => {\n setLoading(true);\n setError(null);\n try {\n const variables = { limit, offset: fetchOffset, status: status ?? null };\n let result;\n\n if (hasOrganizationContext) {\n result = (await queryWithContext({\n query: GetMyOrdersDocument,\n variables,\n fetchPolicy: 'network-only',\n })) as { data?: { myOrders: StoreOrder[] } };\n } else {\n result = await globalClient.query<{ myOrders: StoreOrder[] }>({\n query: GetMyOrdersDocument,\n variables,\n fetchPolicy: 'network-only',\n });\n }\n\n const fetched = (result.data?.myOrders ?? []).map((order) => {\n let parsedLineItems: StoreOrder['lineItems'] = [];\n if (order.lineItems) {\n if (typeof order.lineItems === 'string') {\n try {\n parsedLineItems = JSON.parse(order.lineItems);\n } catch (parseErr) {\n console.error('Failed to parse order lineItems JSON:', parseErr);\n parsedLineItems = [];\n }\n } else {\n parsedLineItems = order.lineItems;\n }\n }\n return { ...order, lineItems: parsedLineItems };\n });\n\n if (append) {\n setAllOrders((prev) => [...prev, ...fetched]);\n } else {\n setAllOrders(fetched);\n }\n setHasMore(fetched.length === limit);\n setOffset(fetchOffset);\n } catch (err) {\n setError(err as Error);\n console.error('Failed to fetch orders:', err);\n } finally {\n setLoading(false);\n }\n },\n [queryWithContext, globalClient, hasOrganizationContext, limit, status]\n );\n\n useEffect(() => {\n fetchOrders(0);\n }, [fetchOrders]);\n\n const loadMore = useCallback(() => {\n if (!hasMore || loading) return;\n fetchOrders(offset + limit, true);\n }, [fetchOrders, hasMore, loading, offset, limit]);\n\n return {\n orders: allOrders,\n hasMore,\n loading,\n error,\n refetchOrders: () => fetchOrders(0),\n loadMore,\n };\n}\n"],"mappings":";;;;;AAaA,IAAM,IAAoB;AA6B1B,SAAgB,EAAU,GAAqE;CAC7F,IAAM,EAAE,OAAO,GAAkB,8BAA2B,GAA4B,EAClF,IAAe,GAAiB,EAEhC,IAAQ,GAAS,SAAS,GAC1B,CAAC,GAAQ,KAAa,EAAS,GAAS,UAAU,EAAE,EACpD,CAAC,KAAU,EAAkC,GAAS,OAAO,EAE7D,CAAC,GAAW,KAAgB,EAAuB,EAAE,CAAC,EACtD,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAS,KAAc,EAAS,GAAK,EACtC,CAAC,GAAO,KAAY,EAAuB,KAAK,EAEhD,IAAc,EAClB,OAAO,IAAsB,GAAG,IAAS,OAAU;AAEjD,EADA,EAAW,GAAK,EAChB,EAAS,KAAK;AACd,MAAI;GACF,IAAM,IAAY;IAAE;IAAO,QAAQ;IAAa,QAAQ,KAAU;IAAM,EACpE;AAEJ,GAOE,IAPE,IACQ,MAAM,EAAiB;IAC/B,OAAO;IACP;IACA,aAAa;IACd,CAAC,GAEO,MAAM,EAAa,MAAkC;IAC5D,OAAO;IACP;IACA,aAAa;IACd,CAAC;GAGJ,IAAM,KAAW,EAAO,MAAM,YAAY,EAAE,EAAE,KAAK,MAAU;IAC3D,IAAI,IAA2C,EAAE;AACjD,QAAI,EAAM,UACR,KAAI,OAAO,EAAM,aAAc,SAC7B,KAAI;AACF,SAAkB,KAAK,MAAM,EAAM,UAAU;aACtC,GAAU;AAEjB,KADA,QAAQ,MAAM,yCAAyC,EAAS,EAChE,IAAkB,EAAE;;QAGtB,KAAkB,EAAM;AAG5B,WAAO;KAAE,GAAG;KAAO,WAAW;KAAiB;KAC/C;AAQF,GALE,EADE,KACY,MAAS,CAAC,GAAG,GAAM,GAAG,EAAQ,GAE/B,EAAQ,EAEvB,EAAW,EAAQ,WAAW,EAAM,EACpC,EAAU,EAAY;WACf,GAAK;AAEZ,GADA,EAAS,EAAa,EACtB,QAAQ,MAAM,2BAA2B,EAAI;YACrC;AACR,KAAW,GAAM;;IAGrB;EAAC;EAAkB;EAAc;EAAwB;EAAO;EAAO,CACxE;AAWD,QATA,QAAgB;AACd,IAAY,EAAE;IACb,CAAC,EAAY,CAAC,EAOV;EACL,QAAQ;EACR;EACA;EACA;EACA,qBAAqB,EAAY,EAAE;EACnC,UAXe,QAAkB;AAC7B,IAAC,KAAW,KAChB,EAAY,IAAS,GAAO,GAAK;KAChC;GAAC;GAAa;GAAS;GAAS;GAAQ;GAAM,CAAC;EASjD"}
1
+ {"version":3,"file":"useOrders.js","names":[],"sources":["../../src/hooks/useOrders.ts"],"sourcesContent":["/**\n * Orders Hook\n *\n * Provides order operations that interact with the backend store service.\n * All order data is fetched from the backend via GraphQL.\n */\n\nimport { useState, useEffect, useCallback } from 'react';\nimport { useApolloClient } from '@apollo/client/react';\nimport { GetMyOrdersDocument } from '../generated/global-operations';\nimport type { OrderStatus } from '../generated/global-types';\nimport { useStoreGraphQLWithContext } from './useStoreGraphQLWithContext';\n\nconst DEFAULT_PAGE_SIZE = 20;\n\n// Local type definition until schema is fully generated\ninterface StoreOrder {\n id: string;\n status: string;\n total: number;\n currency: string;\n lineItems: Array<{\n productId: string;\n name: string;\n quantity: number;\n unitPrice: number;\n subtotal: number;\n itemType?: string;\n pricingModel?: string;\n productType?: string;\n productIcon?: string;\n variantId?: string;\n variantName?: string;\n version?: string;\n }>;\n createdAt: string;\n updatedAt: string;\n fulfillment?: {\n status?: string | null;\n trackingNumber?: string | null;\n trackingUrl?: string | null;\n carrier?: string | null;\n estimatedDeliveryDate?: string | null;\n } | null;\n}\n\n/**\n * Hook for fetching and managing orders with offset-based pagination.\n */\nexport function useOrders(options?: { limit?: number; offset?: number; status?: OrderStatus }) {\n const { query: queryWithContext, hasOrganizationContext } = useStoreGraphQLWithContext();\n const globalClient = useApolloClient();\n\n const limit = options?.limit ?? DEFAULT_PAGE_SIZE;\n const [offset, setOffset] = useState(options?.offset ?? 0);\n const [status] = useState<OrderStatus | undefined>(options?.status);\n\n const [allOrders, setAllOrders] = useState<StoreOrder[]>([]);\n const [hasMore, setHasMore] = useState(false);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n const fetchOrders = useCallback(\n async (fetchOffset: number = 0, append = false) => {\n setLoading(true);\n setError(null);\n try {\n const variables = { limit, offset: fetchOffset, status: status ?? null };\n let result;\n\n if (hasOrganizationContext) {\n result = (await queryWithContext({\n query: GetMyOrdersDocument,\n variables,\n fetchPolicy: 'network-only',\n })) as { data?: { myOrders: StoreOrder[] } };\n } else {\n result = await globalClient.query<{ myOrders: StoreOrder[] }>({\n query: GetMyOrdersDocument,\n variables,\n fetchPolicy: 'network-only',\n });\n }\n\n const fetched = (result.data?.myOrders ?? []).map((order) => {\n let parsedLineItems: StoreOrder['lineItems'] = [];\n if (order.lineItems) {\n if (typeof order.lineItems === 'string') {\n try {\n parsedLineItems = JSON.parse(order.lineItems);\n } catch (parseErr) {\n console.error('Failed to parse order lineItems JSON:', parseErr);\n parsedLineItems = [];\n }\n } else {\n parsedLineItems = order.lineItems;\n }\n }\n return { ...order, lineItems: parsedLineItems };\n });\n\n if (append) {\n setAllOrders((prev) => [...prev, ...fetched]);\n } else {\n setAllOrders(fetched);\n }\n setHasMore(fetched.length === limit);\n setOffset(fetchOffset);\n } catch (err) {\n setError(err as Error);\n console.error('Failed to fetch orders:', err);\n } finally {\n setLoading(false);\n }\n },\n [queryWithContext, globalClient, hasOrganizationContext, limit, status]\n );\n\n useEffect(() => {\n fetchOrders(0);\n }, [fetchOrders]);\n\n const loadMore = useCallback(() => {\n if (!hasMore || loading) return;\n fetchOrders(offset + limit, true);\n }, [fetchOrders, hasMore, loading, offset, limit]);\n\n return {\n orders: allOrders,\n hasMore,\n loading,\n error,\n refetchOrders: () => fetchOrders(0),\n loadMore,\n };\n}\n"],"mappings":";;;;;AAaA,IAAM,IAAoB;AAoC1B,SAAgB,EAAU,GAAqE;CAC7F,IAAM,EAAE,OAAO,GAAkB,8BAA2B,GAA4B,EAClF,IAAe,GAAiB,EAEhC,IAAQ,GAAS,SAAS,GAC1B,CAAC,GAAQ,KAAa,EAAS,GAAS,UAAU,EAAE,EACpD,CAAC,KAAU,EAAkC,GAAS,OAAO,EAE7D,CAAC,GAAW,KAAgB,EAAuB,EAAE,CAAC,EACtD,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAS,KAAc,EAAS,GAAK,EACtC,CAAC,GAAO,KAAY,EAAuB,KAAK,EAEhD,IAAc,EAClB,OAAO,IAAsB,GAAG,IAAS,OAAU;AAEjD,EADA,EAAW,GAAK,EAChB,EAAS,KAAK;AACd,MAAI;GACF,IAAM,IAAY;IAAE;IAAO,QAAQ;IAAa,QAAQ,KAAU;IAAM,EACpE;AAEJ,GAOE,IAPE,IACQ,MAAM,EAAiB;IAC/B,OAAO;IACP;IACA,aAAa;IACd,CAAC,GAEO,MAAM,EAAa,MAAkC;IAC5D,OAAO;IACP;IACA,aAAa;IACd,CAAC;GAGJ,IAAM,KAAW,EAAO,MAAM,YAAY,EAAE,EAAE,KAAK,MAAU;IAC3D,IAAI,IAA2C,EAAE;AACjD,QAAI,EAAM,UACR,KAAI,OAAO,EAAM,aAAc,SAC7B,KAAI;AACF,SAAkB,KAAK,MAAM,EAAM,UAAU;aACtC,GAAU;AAEjB,KADA,QAAQ,MAAM,yCAAyC,EAAS,EAChE,IAAkB,EAAE;;QAGtB,KAAkB,EAAM;AAG5B,WAAO;KAAE,GAAG;KAAO,WAAW;KAAiB;KAC/C;AAQF,GALE,EADE,KACY,MAAS,CAAC,GAAG,GAAM,GAAG,EAAQ,GAE/B,EAAQ,EAEvB,EAAW,EAAQ,WAAW,EAAM,EACpC,EAAU,EAAY;WACf,GAAK;AAEZ,GADA,EAAS,EAAa,EACtB,QAAQ,MAAM,2BAA2B,EAAI;YACrC;AACR,KAAW,GAAM;;IAGrB;EAAC;EAAkB;EAAc;EAAwB;EAAO;EAAO,CACxE;AAWD,QATA,QAAgB;AACd,IAAY,EAAE;IACb,CAAC,EAAY,CAAC,EAOV;EACL,QAAQ;EACR;EACA;EACA;EACA,qBAAqB,EAAY,EAAE;EACnC,UAXe,QAAkB;AAC7B,IAAC,KAAW,KAChB,EAAY,IAAS,GAAO,GAAK;KAChC;GAAC;GAAa;GAAS;GAAS;GAAQ;GAAM,CAAC;EASjD"}
@@ -5,10 +5,10 @@ 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
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
- import { useNavigate as x } from "react-router-dom";
8
+ import { useI18n as l } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
9
+ import { ArrowLeft as u, CheckCircle as d, ChevronRight as f, Clock as p, Download as m, Loader2 as h, Package as g, RefreshCw as _, ShoppingBag as v, XCircle as y } from "lucide-react";
10
+ import { jsx as b, jsxs as x } from "react/jsx-runtime";
11
+ import { useNavigate as ee } 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
14
  var T = [
@@ -20,49 +20,49 @@ var T = [
20
20
  case "COMPLETED":
21
21
  case "FULFILLED":
22
22
  case "PROCESSED": return {
23
- icon: u,
23
+ icon: d,
24
24
  classes: "bg-status-success-bg-subtle/15 text-status-success-text border-status-success-text/20",
25
25
  label: "Completed"
26
26
  };
27
27
  case "PROCESSING": return {
28
- icon: f,
28
+ icon: p,
29
29
  classes: "bg-status-warning-bg-subtle/15 text-status-warning-text border-status-warning-text/20",
30
30
  label: "Processing"
31
31
  };
32
32
  case "PENDING": return {
33
- icon: f,
33
+ icon: p,
34
34
  classes: "bg-status-warning-bg-subtle/15 text-status-warning-text border-status-warning-text/20",
35
35
  label: "Pending"
36
36
  };
37
37
  case "FAILED": return {
38
- icon: v,
38
+ icon: y,
39
39
  classes: "bg-status-error-bg-subtle/15 text-status-error-text border-status-error-text/20",
40
40
  label: "Failed"
41
41
  };
42
42
  case "REFUNDED": return {
43
- icon: g,
43
+ icon: _,
44
44
  classes: "bg-status-warning-bg-subtle/15 text-status-warning-text border-status-warning-text/20",
45
45
  label: "Refunded"
46
46
  };
47
47
  case "CANCELLED": return {
48
- icon: g,
48
+ icon: _,
49
49
  classes: "bg-bg-sunken text-text-muted border-border-default",
50
50
  label: "Cancelled"
51
51
  };
52
52
  default: return {
53
- icon: f,
53
+ icon: p,
54
54
  classes: "bg-bg-sunken text-text-muted border-border-default",
55
55
  label: e
56
56
  };
57
57
  }
58
58
  }, D = ({ status: e }) => {
59
59
  let t = E(e), n = t.icon;
60
- return /* @__PURE__ */ b("span", {
60
+ return /* @__PURE__ */ x("span", {
61
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]
62
+ children: [/* @__PURE__ */ b(n, { className: "size-3.5" }), t.label]
63
63
  });
64
64
  }, O = () => {
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();
65
+ let p = ee(), { basePath: _ } = e(), { t: E } = l(), { orders: O, loading: k, error: A, refetchOrders: j, hasMore: M, loadMore: N } = a(), { installations: P, refetch: te } = i();
66
66
  t({
67
67
  onData: () => {
68
68
  j();
@@ -71,7 +71,7 @@ var T = [
71
71
  console.warn("OrderStatusUpdated subscription error:", e.message);
72
72
  }
73
73
  });
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) => {
74
+ let [ne, re] = 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(P.flatMap((e) => e.status === "ACTIVE" ? [e.productId] : [])), [P]), G = O.map((e) => {
75
75
  let t = e.lineItems || [], n = t.reduce((e, t) => e + t.subtotal, 0), r = e.total - n, i = t.map((t, n) => ({
76
76
  id: `${e.id}-${n}`,
77
77
  productId: t.productId,
@@ -92,10 +92,11 @@ var T = [
92
92
  tax: r,
93
93
  total: e.total,
94
94
  status: e.status,
95
- createdAt: e.createdAt
95
+ createdAt: e.createdAt,
96
+ fulfillment: e.fulfillment ?? null
96
97
  };
97
98
  }), 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
+ re((t) => {
99
100
  let n = new Set(t);
100
101
  return n.has(e) ? n.delete(e) : n.add(e), n;
101
102
  });
@@ -110,36 +111,36 @@ var T = [
110
111
  }, X = () => {
111
112
  R(!1), B(null), H(null), U(null);
112
113
  }, oe = (e, t) => {
113
- X(), ne();
114
+ X(), te();
114
115
  }, se = (e) => {}, Z = () => {
115
- f(`${g}/marketplace`);
116
+ p(`${_}/marketplace`);
116
117
  }, Q = "px-4 py-3 text-sm", $ = "px-4 py-3 text-left text-xs font-semibold uppercase tracking-wider text-text-muted";
117
- return /* @__PURE__ */ b("div", {
118
+ return /* @__PURE__ */ x("div", {
118
119
  className: "flex h-full flex-col",
119
120
  children: [
120
- /* @__PURE__ */ y("header", {
121
+ /* @__PURE__ */ b("header", {
121
122
  className: "flex-shrink-0 border-b border-border-seam bg-bg-surface px-6 py-4",
122
- children: /* @__PURE__ */ y("div", {
123
+ children: /* @__PURE__ */ b("div", {
123
124
  className: "mx-auto max-w-6xl",
124
- children: /* @__PURE__ */ y("div", {
125
+ children: /* @__PURE__ */ b("div", {
125
126
  className: "flex items-center justify-between",
126
- children: /* @__PURE__ */ b("div", {
127
+ children: /* @__PURE__ */ x("div", {
127
128
  className: "flex items-center gap-4",
128
- children: [/* @__PURE__ */ y("button", {
129
+ children: [/* @__PURE__ */ b("button", {
129
130
  type: "button",
130
- onClick: () => f(-1),
131
+ onClick: () => p(-1),
131
132
  "aria-label": "Go back",
132
133
  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", {
134
+ children: /* @__PURE__ */ b(u, { className: "size-5" })
135
+ }), /* @__PURE__ */ x("div", {
135
136
  className: "flex items-center gap-3",
136
137
  children: [
137
- /* @__PURE__ */ y(h, { className: "size-6 text-text-primary" }),
138
- /* @__PURE__ */ y("h1", {
138
+ /* @__PURE__ */ b(g, { className: "size-6 text-text-primary" }),
139
+ /* @__PURE__ */ b("h1", {
139
140
  className: "text-xl font-bold text-text-primary",
140
141
  children: E("pages.orders.title", { defaultValue: "My Orders" })
141
142
  }),
142
- G.length > 0 && /* @__PURE__ */ y("span", {
143
+ G.length > 0 && /* @__PURE__ */ b("span", {
143
144
  className: "rounded-full bg-action-primary-bg/10 px-2.5 py-0.5 text-sm font-medium text-action-primary-bg",
144
145
  children: G.length
145
146
  })
@@ -149,138 +150,138 @@ var T = [
149
150
  })
150
151
  })
151
152
  }),
152
- /* @__PURE__ */ y("div", {
153
+ /* @__PURE__ */ b("div", {
153
154
  className: "flex-1 overflow-y-auto",
154
- children: /* @__PURE__ */ b("div", {
155
+ children: /* @__PURE__ */ x("div", {
155
156
  className: "mx-auto max-w-6xl p-6",
156
- children: [/* @__PURE__ */ y(w, {
157
+ children: [/* @__PURE__ */ b(w, {
157
158
  className: "mb-6",
158
159
  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
+ }), k && G.length === 0 ? /* @__PURE__ */ x("div", {
160
161
  className: "flex flex-col items-center justify-center py-24",
161
- children: [/* @__PURE__ */ y(m, {
162
+ children: [/* @__PURE__ */ b(h, {
162
163
  className: "size-12 animate-spin text-text-muted mb-4",
163
164
  "aria-hidden": "true"
164
- }), /* @__PURE__ */ y("p", {
165
+ }), /* @__PURE__ */ b("p", {
165
166
  className: "text-text-muted",
166
167
  children: "Loading your orders…"
167
168
  })]
168
- }) : A ? /* @__PURE__ */ b("div", {
169
+ }) : A ? /* @__PURE__ */ x("div", {
169
170
  className: "flex flex-col items-center justify-center py-24 text-center",
170
171
  children: [
171
- /* @__PURE__ */ y("div", {
172
+ /* @__PURE__ */ b("div", {
172
173
  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
+ children: /* @__PURE__ */ b(y, { className: "size-16 text-status-error-text" })
174
175
  }),
175
- /* @__PURE__ */ y("h2", {
176
+ /* @__PURE__ */ b("h2", {
176
177
  className: "mb-2 text-2xl font-bold text-text-primary",
177
178
  children: E("pages.orders.failedToLoad", { defaultValue: "Failed to load orders" })
178
179
  }),
179
- /* @__PURE__ */ y("p", {
180
+ /* @__PURE__ */ b("p", {
180
181
  className: "mb-6 max-w-md text-text-muted",
181
182
  children: A.message || "An error occurred while loading your orders. Please try again."
182
183
  }),
183
- /* @__PURE__ */ b("button", {
184
+ /* @__PURE__ */ x("button", {
184
185
  type: "button",
185
186
  onClick: Z,
186
187
  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
+ children: [/* @__PURE__ */ b(v, { className: "size-5" }), "Browse Marketplace"]
188
189
  })
189
190
  ]
190
- }) : G.length === 0 ? /* @__PURE__ */ y(C, {
191
+ }) : G.length === 0 ? /* @__PURE__ */ b(C, {
191
192
  illustration: "empty-data",
192
193
  title: E("pages.orders.emptyTitle", { defaultValue: "No orders yet" }),
193
194
  description: "You have not placed any orders yet. Browse the marketplace to discover apps and products!",
194
- action: /* @__PURE__ */ b("button", {
195
+ action: /* @__PURE__ */ x("button", {
195
196
  type: "button",
196
197
  onClick: Z,
197
198
  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",
198
- children: [/* @__PURE__ */ y(_, { className: "size-5" }), "Browse Marketplace"]
199
+ children: [/* @__PURE__ */ b(v, { className: "size-5" }), "Browse Marketplace"]
199
200
  })
200
- }) : /* @__PURE__ */ b("div", {
201
+ }) : /* @__PURE__ */ x("div", {
201
202
  className: "space-y-4",
202
- children: [/* @__PURE__ */ b("div", {
203
+ children: [/* @__PURE__ */ x("div", {
203
204
  className: "inline-flex rounded-xl border border-border-seam bg-bg-surface p-1",
204
- children: [/* @__PURE__ */ b("button", {
205
+ children: [/* @__PURE__ */ x("button", {
205
206
  type: "button",
206
207
  onClick: () => I("completed"),
207
208
  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
+ children: ["Completed", /* @__PURE__ */ b("span", {
209
210
  className: "ml-2 rounded-full bg-black/10 px-2 py-0.5 text-xs",
210
211
  children: K.length
211
212
  })]
212
- }), /* @__PURE__ */ b("button", {
213
+ }), /* @__PURE__ */ x("button", {
213
214
  type: "button",
214
215
  onClick: () => I("pending"),
215
216
  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
+ children: ["Pending", /* @__PURE__ */ b("span", {
217
218
  className: "ml-2 rounded-full bg-black/10 px-2 py-0.5 text-xs",
218
219
  children: q.length
219
220
  })]
220
221
  })]
221
- }), J.length === 0 ? /* @__PURE__ */ b(S, {
222
+ }), J.length === 0 ? /* @__PURE__ */ x(S, {
222
223
  className: "p-10 text-center",
223
224
  children: [
224
- /* @__PURE__ */ y("div", {
225
+ /* @__PURE__ */ b("div", {
225
226
  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
+ children: /* @__PURE__ */ b(g, { className: "size-6" })
227
228
  }),
228
- /* @__PURE__ */ y("h2", {
229
+ /* @__PURE__ */ b("h2", {
229
230
  className: "mb-2 text-lg font-semibold text-text-primary",
230
231
  children: F === "completed" ? "No completed orders yet" : "No pending orders"
231
232
  }),
232
- /* @__PURE__ */ y("p", {
233
+ /* @__PURE__ */ b("p", {
233
234
  className: "text-sm text-text-muted",
234
235
  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
  })
236
237
  ]
237
- }) : /* @__PURE__ */ b("div", {
238
+ }) : /* @__PURE__ */ x("div", {
238
239
  className: "overflow-hidden rounded-xl border border-border-seam bg-bg-surface",
239
240
  children: [
240
- /* @__PURE__ */ b("div", {
241
+ /* @__PURE__ */ x("div", {
241
242
  className: "hidden border-b border-border-seam bg-bg-sunken/50 md:grid md:grid-cols-[40px_1fr_180px_140px_120px_160px]",
242
243
  children: [
243
- /* @__PURE__ */ y("div", { className: $ }),
244
- /* @__PURE__ */ y("div", {
244
+ /* @__PURE__ */ b("div", { className: $ }),
245
+ /* @__PURE__ */ b("div", {
245
246
  className: $,
246
247
  children: "Order"
247
248
  }),
248
- /* @__PURE__ */ y("div", {
249
+ /* @__PURE__ */ b("div", {
249
250
  className: $,
250
251
  children: "Date"
251
252
  }),
252
- /* @__PURE__ */ y("div", {
253
+ /* @__PURE__ */ b("div", {
253
254
  className: $,
254
255
  children: "Items"
255
256
  }),
256
- /* @__PURE__ */ y("div", {
257
+ /* @__PURE__ */ b("div", {
257
258
  className: `${$} text-right`,
258
259
  children: "Total"
259
260
  }),
260
- /* @__PURE__ */ y("div", {
261
+ /* @__PURE__ */ b("div", {
261
262
  className: `${$} text-center`,
262
263
  children: "Status"
263
264
  })
264
265
  ]
265
266
  }),
266
267
  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", {
268
+ let t = ne.has(e.id), r = e.status === "COMPLETED" || e.status === "FULFILLED" || e.status === "PROCESSED";
269
+ return /* @__PURE__ */ x("div", {
269
270
  className: "border-b border-border-seam last:border-b-0",
270
- children: [/* @__PURE__ */ b("button", {
271
+ children: [/* @__PURE__ */ x("button", {
271
272
  type: "button",
272
273
  onClick: () => Y(e.id),
273
274
  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
275
  children: [
275
- /* @__PURE__ */ y("div", {
276
+ /* @__PURE__ */ b("div", {
276
277
  className: `${Q} flex justify-center`,
277
- children: /* @__PURE__ */ y(d, { className: `size-4 text-text-muted transition-transform duration-200 ${t ? "rotate-90" : ""}` })
278
+ children: /* @__PURE__ */ b(f, { className: `size-4 text-text-muted transition-transform duration-200 ${t ? "rotate-90" : ""}` })
278
279
  }),
279
- /* @__PURE__ */ y("div", {
280
+ /* @__PURE__ */ b("div", {
280
281
  className: `${Q} font-medium text-text-primary`,
281
282
  children: e.orderNumber
282
283
  }),
283
- /* @__PURE__ */ y("div", {
284
+ /* @__PURE__ */ b("div", {
284
285
  className: `${Q} text-text-muted`,
285
286
  children: new Date(e.createdAt).toLocaleDateString("en-US", {
286
287
  year: "numeric",
@@ -288,46 +289,116 @@ var T = [
288
289
  day: "numeric"
289
290
  })
290
291
  }),
291
- /* @__PURE__ */ b("div", {
292
+ /* @__PURE__ */ x("div", {
292
293
  className: `${Q} text-text-muted`,
293
294
  children: [
294
295
  e.items.length,
295
296
  " ",
296
297
  e.items.length === 1 ? "item" : "items",
297
- /* @__PURE__ */ y("span", {
298
+ /* @__PURE__ */ b("span", {
298
299
  className: "block text-xs text-text-muted/70",
299
300
  children: e.items.map((e) => e.productName).join(", ")
300
301
  })
301
302
  ]
302
303
  }),
303
- /* @__PURE__ */ y("div", {
304
+ /* @__PURE__ */ b("div", {
304
305
  className: `${Q} text-right font-semibold tabular-nums text-text-primary`,
305
306
  children: n(e.total)
306
307
  }),
307
- /* @__PURE__ */ y("div", {
308
+ /* @__PURE__ */ b("div", {
308
309
  className: `${Q} flex justify-center`,
309
- children: /* @__PURE__ */ y(D, { status: e.status })
310
+ children: /* @__PURE__ */ b(D, { status: e.status })
310
311
  })
311
312
  ]
312
- }), t && /* @__PURE__ */ b("div", {
313
+ }), t && /* @__PURE__ */ x("div", {
313
314
  className: "border-t border-border-seam bg-bg-sunken/30",
314
315
  children: [
315
- /* @__PURE__ */ b("div", {
316
+ e.fulfillment && /* @__PURE__ */ x("div", {
317
+ className: "mx-4 mt-4 rounded-xl border border-border-seam bg-bg-surface px-4 py-4 md:mx-12",
318
+ children: [/* @__PURE__ */ x("div", {
319
+ className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between",
320
+ children: [/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("div", {
321
+ className: "text-sm font-semibold text-text-primary",
322
+ children: "Order tracking"
323
+ }), /* @__PURE__ */ x("div", {
324
+ className: "mt-1 text-xs text-text-muted",
325
+ children: [
326
+ e.fulfillment.status || "PENDING",
327
+ e.fulfillment.carrier ? ` · ${e.fulfillment.carrier}` : "",
328
+ e.fulfillment.estimatedDeliveryDate ? ` · Est. delivery ${new Date(e.fulfillment.estimatedDeliveryDate).toLocaleDateString()}` : ""
329
+ ]
330
+ })] }), /* @__PURE__ */ x("div", {
331
+ className: "flex flex-col items-start gap-2 md:items-end",
332
+ children: [e.fulfillment.trackingNumber && /* @__PURE__ */ x("div", {
333
+ className: "text-xs text-text-muted",
334
+ children: ["Tracking #: ", /* @__PURE__ */ b("span", {
335
+ className: "font-medium text-text-primary",
336
+ children: e.fulfillment.trackingNumber
337
+ })]
338
+ }), e.fulfillment.trackingUrl && /* @__PURE__ */ x("a", {
339
+ href: e.fulfillment.trackingUrl,
340
+ target: "_blank",
341
+ rel: "noreferrer",
342
+ 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",
343
+ children: ["Track package", /* @__PURE__ */ b(f, { className: "size-3.5" })]
344
+ })]
345
+ })]
346
+ }), /* @__PURE__ */ b("div", {
347
+ className: "mt-4 grid gap-2 sm:grid-cols-4",
348
+ children: [
349
+ {
350
+ key: "PROCESSING",
351
+ label: "Processing"
352
+ },
353
+ {
354
+ key: "SHIPPED",
355
+ label: "Shipped"
356
+ },
357
+ {
358
+ key: "OUT_FOR_DELIVERY",
359
+ label: "Out for delivery"
360
+ },
361
+ {
362
+ key: "DELIVERED",
363
+ label: "Delivered"
364
+ }
365
+ ].map((t) => {
366
+ let n = e.fulfillment?.status || "PENDING";
367
+ return /* @__PURE__ */ b("div", {
368
+ className: `rounded-lg border px-3 py-2 text-xs font-medium ${[
369
+ "PROCESSING",
370
+ "READY_TO_SHIP",
371
+ "SHIPPED",
372
+ "IN_TRANSIT",
373
+ "OUT_FOR_DELIVERY",
374
+ "DELIVERED"
375
+ ].indexOf(n) >= [
376
+ "PROCESSING",
377
+ "SHIPPED",
378
+ "OUT_FOR_DELIVERY",
379
+ "DELIVERED"
380
+ ].indexOf(t.key) ? "border-status-success-border bg-status-success-bg-subtle text-status-success-text" : "border-border-seam bg-bg-sunken/40 text-text-muted"}`,
381
+ children: t.label
382
+ }, t.key);
383
+ })
384
+ })]
385
+ }),
386
+ /* @__PURE__ */ x("div", {
316
387
  className: "hidden grid-cols-[1fr_100px_120px_160px] gap-4 px-12 py-2 md:grid",
317
388
  children: [
318
- /* @__PURE__ */ y("span", {
389
+ /* @__PURE__ */ b("span", {
319
390
  className: "text-xs font-medium text-text-muted",
320
391
  children: "Product"
321
392
  }),
322
- /* @__PURE__ */ y("span", {
393
+ /* @__PURE__ */ b("span", {
323
394
  className: "text-xs font-medium text-text-muted text-right",
324
395
  children: "Qty"
325
396
  }),
326
- /* @__PURE__ */ y("span", {
397
+ /* @__PURE__ */ b("span", {
327
398
  className: "text-xs font-medium text-text-muted text-right",
328
399
  children: "Price"
329
400
  }),
330
- /* @__PURE__ */ y("span", {
401
+ /* @__PURE__ */ b("span", {
331
402
  className: "text-xs font-medium text-text-muted text-center",
332
403
  children: "Action"
333
404
  })
@@ -335,94 +406,94 @@ var T = [
335
406
  }),
336
407
  e.items.map((t) => {
337
408
  let i = t.productType !== "PHYSICAL" && t.productType !== "MERCHANDISE";
338
- return /* @__PURE__ */ b("div", {
409
+ return /* @__PURE__ */ x("div", {
339
410
  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
411
  children: [
341
- /* @__PURE__ */ b("div", {
412
+ /* @__PURE__ */ x("div", {
342
413
  className: "flex items-center gap-3 min-w-0",
343
- children: [/* @__PURE__ */ y("div", {
414
+ children: [/* @__PURE__ */ b("div", {
344
415
  className: "size-10 flex-shrink-0 overflow-hidden rounded-lg bg-bg-sunken",
345
- children: t.productIcon ? /* @__PURE__ */ y("img", {
416
+ children: t.productIcon ? /* @__PURE__ */ b("img", {
346
417
  src: t.productIcon,
347
418
  alt: t.productName,
348
419
  className: "size-full object-cover"
349
- }) : /* @__PURE__ */ y("div", {
420
+ }) : /* @__PURE__ */ b("div", {
350
421
  className: "flex size-full items-center justify-center text-sm font-bold text-text-muted",
351
422
  children: t.productName.charAt(0)
352
423
  })
353
- }), /* @__PURE__ */ b("div", {
424
+ }), /* @__PURE__ */ x("div", {
354
425
  className: "min-w-0",
355
- children: [/* @__PURE__ */ y("p", {
426
+ children: [/* @__PURE__ */ b("p", {
356
427
  className: "truncate text-sm font-medium text-text-primary",
357
428
  children: t.productName
358
- }), /* @__PURE__ */ y("span", {
429
+ }), /* @__PURE__ */ b("span", {
359
430
  className: "inline-flex items-center rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium text-text-muted",
360
431
  children: t.productType
361
432
  })]
362
433
  })]
363
434
  }),
364
- /* @__PURE__ */ y("div", {
435
+ /* @__PURE__ */ b("div", {
365
436
  className: "hidden text-right text-sm text-text-muted md:block",
366
437
  children: t.quantity
367
438
  }),
368
- /* @__PURE__ */ y("div", {
439
+ /* @__PURE__ */ b("div", {
369
440
  className: "hidden text-right text-sm font-semibold tabular-nums text-text-primary md:block",
370
441
  children: n(t.totalPrice)
371
442
  }),
372
- /* @__PURE__ */ b("div", {
443
+ /* @__PURE__ */ x("div", {
373
444
  className: "text-right text-sm text-text-muted md:hidden",
374
- children: [/* @__PURE__ */ b("span", {
445
+ children: [/* @__PURE__ */ x("span", {
375
446
  className: "tabular-nums",
376
447
  children: [t.quantity, " × "]
377
- }), /* @__PURE__ */ y("span", {
448
+ }), /* @__PURE__ */ b("span", {
378
449
  className: "font-semibold text-text-primary tabular-nums",
379
450
  children: n(t.unitPrice)
380
451
  })]
381
452
  }),
382
- /* @__PURE__ */ y("div", {
453
+ /* @__PURE__ */ b("div", {
383
454
  className: "flex justify-end md:justify-center",
384
- children: t.installed ? /* @__PURE__ */ b("span", {
455
+ children: t.installed ? /* @__PURE__ */ x("span", {
385
456
  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", {
457
+ children: [/* @__PURE__ */ b(d, { className: "size-3.5" }), "Installed"]
458
+ }) : r && i ? /* @__PURE__ */ x("button", {
388
459
  type: "button",
389
460
  onClick: (n) => {
390
461
  n.stopPropagation(), ae(e.id, t);
391
462
  },
392
463
  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"]
464
+ children: [/* @__PURE__ */ b(m, { className: "size-3.5" }), "Install App"]
394
465
  }) : null
395
466
  })
396
467
  ]
397
468
  }, t.id);
398
469
  }),
399
- /* @__PURE__ */ y("div", {
470
+ /* @__PURE__ */ b("div", {
400
471
  className: "border-t border-border-seam/50 px-4 py-2 md:px-12",
401
- children: /* @__PURE__ */ b("div", {
472
+ children: /* @__PURE__ */ x("div", {
402
473
  className: "flex justify-end gap-6 text-xs text-text-muted",
403
474
  children: [
404
- /* @__PURE__ */ b("span", { children: [
475
+ /* @__PURE__ */ x("span", { children: [
405
476
  "Subtotal:",
406
477
  " ",
407
- /* @__PURE__ */ y("span", {
478
+ /* @__PURE__ */ b("span", {
408
479
  className: "tabular-nums text-text-primary",
409
480
  children: n(e.subtotal)
410
481
  })
411
482
  ] }),
412
- /* @__PURE__ */ b("span", { children: [
483
+ /* @__PURE__ */ x("span", { children: [
413
484
  "Tax:",
414
485
  " ",
415
- /* @__PURE__ */ y("span", {
486
+ /* @__PURE__ */ b("span", {
416
487
  className: "tabular-nums text-text-primary",
417
488
  children: n(e.tax)
418
489
  })
419
490
  ] }),
420
- /* @__PURE__ */ b("span", {
491
+ /* @__PURE__ */ x("span", {
421
492
  className: "font-semibold",
422
493
  children: [
423
494
  "Total:",
424
495
  " ",
425
- /* @__PURE__ */ y("span", {
496
+ /* @__PURE__ */ b("span", {
426
497
  className: "tabular-nums text-text-primary",
427
498
  children: n(e.total)
428
499
  })
@@ -435,15 +506,15 @@ var T = [
435
506
  })]
436
507
  }, e.id);
437
508
  }),
438
- M && /* @__PURE__ */ y("div", {
509
+ M && /* @__PURE__ */ b("div", {
439
510
  className: "flex justify-center px-4 py-5",
440
- children: /* @__PURE__ */ b("button", {
511
+ children: /* @__PURE__ */ x("button", {
441
512
  type: "button",
442
- onClick: te,
513
+ onClick: N,
443
514
  disabled: k,
444
515
  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
516
  "aria-label": E("common.loadMore", { defaultValue: "Load more" }),
446
- children: [k ? /* @__PURE__ */ y(m, {
517
+ children: [k ? /* @__PURE__ */ b(h, {
447
518
  className: "size-4 animate-spin",
448
519
  "aria-hidden": "true"
449
520
  }) : null, E("common.loadMore", { defaultValue: "Load more" })]
@@ -454,7 +525,7 @@ var T = [
454
525
  })]
455
526
  })
456
527
  }),
457
- V && /* @__PURE__ */ y(r, {
528
+ V && /* @__PURE__ */ b(r, {
458
529
  isOpen: L,
459
530
  onClose: X,
460
531
  app: V,