@fluid-app/portal-sdk 0.1.129 → 0.1.130

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.
Files changed (122) hide show
  1. package/dist/{AppDownloadScreen-DTxo4z3_.cjs → AppDownloadScreen-ChKim_6A.cjs} +2 -2
  2. package/dist/{AppDownloadScreen-DTxo4z3_.cjs.map → AppDownloadScreen-ChKim_6A.cjs.map} +1 -1
  3. package/dist/{AppDownloadScreen-BoGSdsJk.mjs → AppDownloadScreen-DGHd6hYM.mjs} +2 -2
  4. package/dist/{AppDownloadScreen-BoGSdsJk.mjs.map → AppDownloadScreen-DGHd6hYM.mjs.map} +1 -1
  5. package/dist/{AppDownloadScreen-Chxavsr_.cjs → AppDownloadScreen-DpyV1tJw.cjs} +2 -2
  6. package/dist/{ContactsScreen-BKOHursc.mjs → ContactsScreen-Bcea6126.mjs} +3 -3
  7. package/dist/{ContactsScreen-BKOHursc.mjs.map → ContactsScreen-Bcea6126.mjs.map} +1 -1
  8. package/dist/{ContactsScreen-DN8Qt2Ih.cjs → ContactsScreen-CsIGZaWy.cjs} +4 -4
  9. package/dist/{ContactsScreen-DN8Qt2Ih.cjs.map → ContactsScreen-CsIGZaWy.cjs.map} +1 -1
  10. package/dist/{ContactsScreen-FrVLbjGO.cjs → ContactsScreen-OBDC1046.cjs} +4 -4
  11. package/dist/{FluidProvider-CgTeGUnF.mjs → FluidProvider-BJQSXofR.mjs} +198 -615
  12. package/dist/FluidProvider-BJQSXofR.mjs.map +1 -0
  13. package/dist/{FluidProvider-BMMu_rp3.cjs → FluidProvider-DvqnkjZI.cjs} +196 -625
  14. package/dist/FluidProvider-DvqnkjZI.cjs.map +1 -0
  15. package/dist/{MessagingScreen-Bvq3Dd5i.mjs → MessagingScreen-B48ksZOJ.mjs} +3 -3
  16. package/dist/{MessagingScreen-Bvq3Dd5i.mjs.map → MessagingScreen-B48ksZOJ.mjs.map} +1 -1
  17. package/dist/{MessagingScreen-DMDXiH97.mjs → MessagingScreen-COGo4S9K.mjs} +2 -2
  18. package/dist/{MessagingScreen-DgbNN4BF.cjs → MessagingScreen-DYgiatey.cjs} +3 -3
  19. package/dist/{MessagingScreen-DgbNN4BF.cjs.map → MessagingScreen-DYgiatey.cjs.map} +1 -1
  20. package/dist/{MessagingScreen-bzzXjQMu.cjs → MessagingScreen-QyUOxYXl.cjs} +2 -2
  21. package/dist/{MySiteScreen-nV8x9xyy.cjs → MySiteScreen-ByIJ6CkU.cjs} +2 -2
  22. package/dist/{MySiteScreen-nV8x9xyy.cjs.map → MySiteScreen-ByIJ6CkU.cjs.map} +1 -1
  23. package/dist/{MySiteScreen-BJH5-RNT.mjs → MySiteScreen-DZ0ru6Bn.mjs} +2 -2
  24. package/dist/{MySiteScreen-BJH5-RNT.mjs.map → MySiteScreen-DZ0ru6Bn.mjs.map} +1 -1
  25. package/dist/{MySiteScreen-CYZpUYTn.cjs → MySiteScreen-DrWUJJiH.cjs} +2 -2
  26. package/dist/{OrdersScreen-BL__flBE.cjs → OrdersScreen-CkvoeTvK.cjs} +3 -3
  27. package/dist/OrdersScreen-D_7TJgZ4.mjs +561 -0
  28. package/dist/OrdersScreen-D_7TJgZ4.mjs.map +1 -0
  29. package/dist/OrdersScreen-DyYYjl9I.cjs +568 -0
  30. package/dist/OrdersScreen-DyYYjl9I.cjs.map +1 -0
  31. package/dist/{ProductsScreen-BIYHPaBZ.cjs → ProductsScreen-B8NmyIJy.cjs} +3 -3
  32. package/dist/{ProductsScreen-COwahI-V.mjs → ProductsScreen-CMnhqsSA.mjs} +5 -5
  33. package/dist/{ProductsScreen-COwahI-V.mjs.map → ProductsScreen-CMnhqsSA.mjs.map} +1 -1
  34. package/dist/{ProductsScreen-D6h-r9ht.mjs → ProductsScreen-DzNmbwVi.mjs} +3 -3
  35. package/dist/{ProductsScreen-C8UfVLRr.cjs → ProductsScreen-Z1hx1YZQ.cjs} +5 -5
  36. package/dist/{ProductsScreen-C8UfVLRr.cjs.map → ProductsScreen-Z1hx1YZQ.cjs.map} +1 -1
  37. package/dist/{ProfileScreen-CZp_NrjO.cjs → ProfileScreen-B81Ovmh_.cjs} +2 -2
  38. package/dist/{ProfileScreen-FYGHStqM.cjs → ProfileScreen-CYTxOGeW.cjs} +526 -137
  39. package/dist/ProfileScreen-CYTxOGeW.cjs.map +1 -0
  40. package/dist/{ProfileScreen-BKRn8AqI.mjs → ProfileScreen-QOXtyrJi.mjs} +522 -133
  41. package/dist/ProfileScreen-QOXtyrJi.mjs.map +1 -0
  42. package/dist/{ShareablesScreen-BEPVTMeI.cjs → ShareablesScreen-1HpfEjyd.cjs} +7 -7
  43. package/dist/{ShareablesScreen-BEPVTMeI.cjs.map → ShareablesScreen-1HpfEjyd.cjs.map} +1 -1
  44. package/dist/{ShareablesScreen-BrC5LGtU.cjs → ShareablesScreen-BXO8MpAy.cjs} +3 -3
  45. package/dist/{ShareablesScreen-BXzxUg0E.mjs → ShareablesScreen-DSsMJJh_.mjs} +7 -7
  46. package/dist/{ShareablesScreen-BXzxUg0E.mjs.map → ShareablesScreen-DSsMJJh_.mjs.map} +1 -1
  47. package/dist/{ShareablesScreen-aMnwEOAH.mjs → ShareablesScreen-Oo3jMHX6.mjs} +3 -3
  48. package/dist/{ShopScreen-CHH0cx2P.cjs → ShopScreen-BDcWpmi7.cjs} +4 -4
  49. package/dist/{ShopScreen-CHH0cx2P.cjs.map → ShopScreen-BDcWpmi7.cjs.map} +1 -1
  50. package/dist/{ShopScreen-8OQhLeLt.cjs → ShopScreen-CWxOPn7H.cjs} +2 -2
  51. package/dist/{ShopScreen-Yi9sOX_2.mjs → ShopScreen-DsReuJ7P.mjs} +4 -4
  52. package/dist/{ShopScreen-Yi9sOX_2.mjs.map → ShopScreen-DsReuJ7P.mjs.map} +1 -1
  53. package/dist/{SubscriptionsScreen-oApGaq11.cjs → SubscriptionsScreen-B8mLGt5-.cjs} +27 -10
  54. package/dist/SubscriptionsScreen-B8mLGt5-.cjs.map +1 -0
  55. package/dist/{SubscriptionsScreen-C2F3HNJS.cjs → SubscriptionsScreen-C2zbEjMC.cjs} +4 -4
  56. package/dist/{SubscriptionsScreen-CZ-1jSO2.mjs → SubscriptionsScreen-DZxLo4up.mjs} +21 -4
  57. package/dist/SubscriptionsScreen-DZxLo4up.mjs.map +1 -0
  58. package/dist/index.cjs +37 -37
  59. package/dist/index.d.cts.map +1 -1
  60. package/dist/index.d.mts.map +1 -1
  61. package/dist/index.mjs +37 -37
  62. package/dist/order-status-badge-KooNqnAs.mjs +262 -0
  63. package/dist/order-status-badge-KooNqnAs.mjs.map +1 -0
  64. package/dist/order-status-badge-cwqA8dZ-.cjs +304 -0
  65. package/dist/order-status-badge-cwqA8dZ-.cjs.map +1 -0
  66. package/dist/portal_tenant-CP5Ce8Jn.cjs +261 -0
  67. package/dist/portal_tenant-CP5Ce8Jn.cjs.map +1 -0
  68. package/dist/portal_tenant-CWy4Zg2t.mjs +166 -0
  69. package/dist/portal_tenant-CWy4Zg2t.mjs.map +1 -0
  70. package/dist/src-BOIW-KES.mjs +3 -0
  71. package/dist/src-CzwiFO_J.cjs +3 -0
  72. package/dist/{src-BMUEjfhg.mjs → src-Dgo44BGe.mjs} +1 -1
  73. package/dist/{src-BMUEjfhg.mjs.map → src-Dgo44BGe.mjs.map} +1 -1
  74. package/dist/{src-BJdOxgpp.cjs → src-DkhHoxnS.cjs} +1 -1
  75. package/dist/{src-BJdOxgpp.cjs.map → src-DkhHoxnS.cjs.map} +1 -1
  76. package/dist/use-account-clients-Dim60sir.mjs +451 -0
  77. package/dist/use-account-clients-Dim60sir.mjs.map +1 -0
  78. package/dist/use-account-clients-DoJW3KTx.cjs +481 -0
  79. package/dist/use-account-clients-DoJW3KTx.cjs.map +1 -0
  80. package/dist/{use-current-user-DCk55_Qn.mjs → use-current-user-Baxj7HJt.mjs} +3 -3
  81. package/dist/{use-current-user-DCk55_Qn.mjs.map → use-current-user-Baxj7HJt.mjs.map} +1 -1
  82. package/dist/{use-current-user-BR5_zaoZ.cjs → use-current-user-BcZWV7oU.cjs} +3 -3
  83. package/dist/{use-current-user-BR5_zaoZ.cjs.map → use-current-user-BcZWV7oU.cjs.map} +1 -1
  84. package/dist/{use-fluid-api-CmCAH10d.mjs → use-fluid-api-BP05Cf-f.mjs} +2 -2
  85. package/dist/{use-fluid-api-CmCAH10d.mjs.map → use-fluid-api-BP05Cf-f.mjs.map} +1 -1
  86. package/dist/{use-fluid-api-C1KeHB7q.cjs → use-fluid-api-Ds8BInAZ.cjs} +2 -2
  87. package/dist/{use-fluid-api-C1KeHB7q.cjs.map → use-fluid-api-Ds8BInAZ.cjs.map} +1 -1
  88. package/dist/{use-fluid-auth-BQEV7ylM.mjs → use-fluid-auth-C-Qpl8j4.mjs} +2 -2
  89. package/dist/{use-fluid-auth-BQEV7ylM.mjs.map → use-fluid-auth-C-Qpl8j4.mjs.map} +1 -1
  90. package/dist/{use-fluid-auth-CyKaXLbW.cjs → use-fluid-auth-sGNMgfnt.cjs} +2 -2
  91. package/dist/{use-fluid-auth-CyKaXLbW.cjs.map → use-fluid-auth-sGNMgfnt.cjs.map} +1 -1
  92. package/dist/{use-portal-products-client-pptYMuSw.cjs → use-portal-products-client-DKYkBjm-.cjs} +7 -48
  93. package/dist/use-portal-products-client-DKYkBjm-.cjs.map +1 -0
  94. package/dist/{use-portal-products-client-BL1xVtex.mjs → use-portal-products-client-s2qtZjhU.mjs} +3 -44
  95. package/dist/use-portal-products-client-s2qtZjhU.mjs.map +1 -0
  96. package/package.json +13 -12
  97. package/dist/FluidProvider-BMMu_rp3.cjs.map +0 -1
  98. package/dist/FluidProvider-CgTeGUnF.mjs.map +0 -1
  99. package/dist/OrdersScreen-BLb3_KtI.mjs +0 -176
  100. package/dist/OrdersScreen-BLb3_KtI.mjs.map +0 -1
  101. package/dist/OrdersScreen-uL3mRk1h.cjs +0 -183
  102. package/dist/OrdersScreen-uL3mRk1h.cjs.map +0 -1
  103. package/dist/ProfileScreen-BKRn8AqI.mjs.map +0 -1
  104. package/dist/ProfileScreen-FYGHStqM.cjs.map +0 -1
  105. package/dist/SubscriptionsScreen-CZ-1jSO2.mjs.map +0 -1
  106. package/dist/SubscriptionsScreen-oApGaq11.cjs.map +0 -1
  107. package/dist/order-detail-DHXdE4Cl.cjs +0 -961
  108. package/dist/order-detail-DHXdE4Cl.cjs.map +0 -1
  109. package/dist/order-detail-iZm_R0TX.mjs +0 -931
  110. package/dist/order-detail-iZm_R0TX.mjs.map +0 -1
  111. package/dist/src-BJSTFxSO.mjs +0 -1
  112. package/dist/src-DMVR26Fk.cjs +0 -1
  113. package/dist/use-account-clients-CL6rr17o.cjs +0 -214
  114. package/dist/use-account-clients-CL6rr17o.cjs.map +0 -1
  115. package/dist/use-account-clients-CMjRB5On.mjs +0 -190
  116. package/dist/use-account-clients-CMjRB5On.mjs.map +0 -1
  117. package/dist/use-customer-account-BAolVc3q.mjs +0 -22
  118. package/dist/use-customer-account-BAolVc3q.mjs.map +0 -1
  119. package/dist/use-customer-account-DSsXbcme.cjs +0 -28
  120. package/dist/use-customer-account-DSsXbcme.cjs.map +0 -1
  121. package/dist/use-portal-products-client-BL1xVtex.mjs.map +0 -1
  122. package/dist/use-portal-products-client-pptYMuSw.cjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  require("./chunk-9hOWP6kD.cjs");
2
- require("./FluidProvider-BMMu_rp3.cjs");
2
+ require("./FluidProvider-DvqnkjZI.cjs");
3
3
  require("./PointsWidget-Bgl95R-6.cjs");
4
4
  require("./error-state-BDBF2JrB.cjs");
5
5
  require("./ScreenRenderer-D65AsKjr.cjs");
@@ -35,6 +35,6 @@ require("./ToDoWidget-eGB9cfou.cjs");
35
35
  require("./VideoWidget-bfOCjnnn.cjs");
36
36
  require("./ScreenHeaderContext-wrJlkhgN.cjs");
37
37
  require("./dist-BF_4vk1z.cjs");
38
- const require_MySiteScreen = require("./MySiteScreen-nV8x9xyy.cjs");
38
+ const require_MySiteScreen = require("./MySiteScreen-ByIJ6CkU.cjs");
39
39
  exports.MySiteScreen = require_MySiteScreen.MySiteScreen;
40
40
  exports.mySiteScreenPropertySchema = require_MySiteScreen.mySiteScreenPropertySchema;
@@ -1,5 +1,5 @@
1
1
  require("./chunk-9hOWP6kD.cjs");
2
- require("./FluidProvider-BMMu_rp3.cjs");
2
+ require("./FluidProvider-DvqnkjZI.cjs");
3
3
  require("./PointsWidget-Bgl95R-6.cjs");
4
4
  require("./error-state-BDBF2JrB.cjs");
5
5
  require("./ScreenRenderer-D65AsKjr.cjs");
@@ -34,7 +34,7 @@ require("./TableWidget-Lze_mv23.cjs");
34
34
  require("./ToDoWidget-eGB9cfou.cjs");
35
35
  require("./VideoWidget-bfOCjnnn.cjs");
36
36
  require("./ScreenHeaderContext-wrJlkhgN.cjs");
37
- require("./order-detail-DHXdE4Cl.cjs");
38
- const require_OrdersScreen = require("./OrdersScreen-uL3mRk1h.cjs");
37
+ require("./order-status-badge-cwqA8dZ-.cjs");
38
+ const require_OrdersScreen = require("./OrdersScreen-DyYYjl9I.cjs");
39
39
  exports.OrdersScreen = require_OrdersScreen.OrdersScreen;
40
40
  exports.ordersScreenPropertySchema = require_OrdersScreen.ordersScreenPropertySchema;
@@ -0,0 +1,561 @@
1
+ import { n as __exportAll } from "./chunk-ByhMGyNw.mjs";
2
+ import { Gt as BreadcrumbItem, Jt as BreadcrumbPage, Kt as BreadcrumbLink, Wt as Breadcrumb, Yt as BreadcrumbSeparator, d as TableBody, f as TableCell, h as TableRow, m as TableHeader, qt as BreadcrumbList, u as Table, x as Skeleton } from "./src-N020oyu4.mjs";
3
+ import { r as useScreenHeaderBreadcrumbs } from "./ScreenHeaderContext-NdrJ58Mg.mjs";
4
+ import { n as useAppNavigation } from "./AppNavigationContext-BSnbFILQ.mjs";
5
+ import { n as useOrdersApi } from "./use-account-clients-Dim60sir.mjs";
6
+ import { a as usePortalTenantOrder, i as PaginationFooter, n as TableColumn, o as usePortalTenantOrders, r as StatusBadge, s as OrdersCoreProvider, t as OrderStatusBadge } from "./order-status-badge-KooNqnAs.mjs";
7
+ import { useCallback, useEffect, useMemo, useState } from "react";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ //#region ../../orders/ui/src/components/portal-orders-list.tsx
10
+ function formatTotal(order) {
11
+ return `${order.currency} ${Number(order.total).toFixed(2)}`;
12
+ }
13
+ function PortalOrdersList({ onOrderClick, t, pageSize = 10 }) {
14
+ const [cursor, setCursor] = useState(null);
15
+ const { data, isLoading } = usePortalTenantOrders({
16
+ limit: pageSize,
17
+ cursor: cursor || void 0
18
+ });
19
+ const handleNextPage = useCallback(() => {
20
+ const nextCursor = data?.meta?.pagination?.next_cursor;
21
+ if (nextCursor) setCursor(nextCursor);
22
+ }, [data?.meta?.pagination?.next_cursor]);
23
+ const handlePrevPage = useCallback(() => {
24
+ const prevCursor = data?.meta?.pagination?.prev_cursor;
25
+ if (prevCursor) setCursor(prevCursor);
26
+ else setCursor(null);
27
+ }, [data?.meta?.pagination?.prev_cursor]);
28
+ const ordersList = data?.orders || [];
29
+ const pagination = data?.meta?.pagination;
30
+ const totalItems = ordersList.length;
31
+ const hasNextPage = !!pagination?.next_cursor;
32
+ const hasPrevPage = !!pagination?.prev_cursor;
33
+ const firstItem = (order) => order.line_items[0];
34
+ return /* @__PURE__ */ jsxs("div", {
35
+ className: "border-border overflow-hidden rounded-lg border shadow-sm",
36
+ children: [
37
+ /* @__PURE__ */ jsx("div", {
38
+ className: "block md:hidden",
39
+ children: isLoading ? Array(5).fill(0).map((_, index) => /* @__PURE__ */ jsx("div", {
40
+ className: "border-border border-b p-4",
41
+ children: /* @__PURE__ */ jsxs("div", {
42
+ className: "flex space-x-3",
43
+ children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-12 w-12 rounded-md" }), /* @__PURE__ */ jsxs("div", {
44
+ className: "flex-1 space-y-2",
45
+ children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-3/4" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-3 w-1/2" })]
46
+ })]
47
+ })
48
+ }, `skeleton-${index}`)) : ordersList.length === 0 ? /* @__PURE__ */ jsx("div", {
49
+ className: "text-muted-foreground px-3 py-8 text-center text-sm",
50
+ children: t("no_orders_found")
51
+ }) : ordersList.map((order) => /* @__PURE__ */ jsx("div", {
52
+ className: "border-border hover:bg-accent cursor-pointer border-b p-4 transition-colors duration-200 ease-in-out last:border-b-0",
53
+ onClick: () => onOrderClick(order),
54
+ children: /* @__PURE__ */ jsxs("div", {
55
+ className: "flex items-start space-x-3",
56
+ children: [/* @__PURE__ */ jsx("div", { className: "bg-border h-12 w-12 flex-shrink-0 rounded-md" }), /* @__PURE__ */ jsxs("div", {
57
+ className: "w-0 min-w-0 flex-1",
58
+ children: [firstItem(order) ? /* @__PURE__ */ jsx("p", {
59
+ className: "text-foreground truncate text-sm font-medium",
60
+ children: firstItem(order)?.product_name
61
+ }) : /* @__PURE__ */ jsx("div", {
62
+ className: "bg-muted rounded-lg p-2",
63
+ children: /* @__PURE__ */ jsx("div", {
64
+ className: "text-muted-foreground text-xs",
65
+ children: t("this_product_no_longer_exists")
66
+ })
67
+ }), /* @__PURE__ */ jsxs("div", {
68
+ className: "mt-2 grid grid-cols-2 gap-x-4 gap-y-1 text-sm",
69
+ children: [
70
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
71
+ className: "text-muted-foreground block text-xs",
72
+ children: t("date")
73
+ }), /* @__PURE__ */ jsx("span", {
74
+ className: "text-muted-foreground",
75
+ children: new Date(order.created_at).toLocaleDateString()
76
+ })] }),
77
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("span", {
78
+ className: "text-muted-foreground block text-xs",
79
+ children: t("status")
80
+ }), /* @__PURE__ */ jsx(StatusBadge, {
81
+ color: order.status === "delivered" || order.status === "shipped" ? "green" : order.status === "cancelled" || order.status === "returned" ? "red" : "yellow",
82
+ size: "xs",
83
+ children: order.status
84
+ })] }),
85
+ /* @__PURE__ */ jsx("div", {
86
+ className: "col-span-2 mt-1",
87
+ children: /* @__PURE__ */ jsx("span", {
88
+ className: "text-foreground font-medium",
89
+ children: formatTotal(order)
90
+ })
91
+ })
92
+ ]
93
+ })]
94
+ })]
95
+ })
96
+ }, order.id))
97
+ }),
98
+ /* @__PURE__ */ jsx("div", {
99
+ className: "hidden md:block",
100
+ children: /* @__PURE__ */ jsxs(Table, {
101
+ className: "min-w-full table-fixed",
102
+ children: [
103
+ /* @__PURE__ */ jsxs("colgroup", { children: [
104
+ /* @__PURE__ */ jsx("col", { className: "w-2/5 min-w-[240px]" }),
105
+ /* @__PURE__ */ jsx("col", { className: "w-[20%] min-w-[100px]" }),
106
+ /* @__PURE__ */ jsx("col", { className: "w-[20%] min-w-[100px]" }),
107
+ /* @__PURE__ */ jsx("col", { className: "w-[20%] min-w-[100px]" })
108
+ ] }),
109
+ /* @__PURE__ */ jsx(TableHeader, {
110
+ className: "bg-muted",
111
+ children: /* @__PURE__ */ jsxs(TableRow, {
112
+ className: "hover:bg-muted h-10",
113
+ children: [
114
+ /* @__PURE__ */ jsx(TableColumn, {
115
+ label: t("product"),
116
+ sortable: false
117
+ }),
118
+ /* @__PURE__ */ jsx(TableColumn, {
119
+ label: t("date"),
120
+ sortable: false
121
+ }),
122
+ /* @__PURE__ */ jsx(TableColumn, {
123
+ label: t("status"),
124
+ sortable: false
125
+ }),
126
+ /* @__PURE__ */ jsx(TableColumn, {
127
+ label: t("total"),
128
+ sortable: false
129
+ })
130
+ ]
131
+ })
132
+ }),
133
+ /* @__PURE__ */ jsx(TableBody, {
134
+ className: "bg-background",
135
+ children: isLoading ? Array(5).fill(0).map((_, index) => /* @__PURE__ */ jsxs(TableRow, { children: [
136
+ /* @__PURE__ */ jsx(TableCell, {
137
+ className: "px-3 py-4",
138
+ children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-32" })
139
+ }),
140
+ /* @__PURE__ */ jsx(TableCell, {
141
+ className: "px-3 py-4",
142
+ children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24" })
143
+ }),
144
+ /* @__PURE__ */ jsx(TableCell, {
145
+ className: "px-3 py-4",
146
+ children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-20" })
147
+ }),
148
+ /* @__PURE__ */ jsx(TableCell, {
149
+ className: "px-3 py-4",
150
+ children: /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24" })
151
+ })
152
+ ] }, `skeleton-${index}`)) : ordersList.length === 0 ? /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, {
153
+ colSpan: 4,
154
+ className: "text-muted-foreground px-3 py-8 text-center text-sm",
155
+ children: t("no_orders_found")
156
+ }) }) : ordersList.map((order) => /* @__PURE__ */ jsxs(TableRow, {
157
+ className: "cursor-pointer",
158
+ onClick: () => onOrderClick(order),
159
+ children: [
160
+ /* @__PURE__ */ jsx(TableCell, {
161
+ className: "text-foreground px-3 py-4 text-sm font-medium",
162
+ children: firstItem(order)?.product_name ?? /* @__PURE__ */ jsx("span", {
163
+ className: "text-muted-foreground italic",
164
+ children: t("this_product_no_longer_exists")
165
+ })
166
+ }),
167
+ /* @__PURE__ */ jsx(TableCell, {
168
+ className: "text-muted-foreground px-3 py-4 text-sm whitespace-nowrap",
169
+ children: new Date(order.created_at).toLocaleDateString()
170
+ }),
171
+ /* @__PURE__ */ jsx(TableCell, {
172
+ className: "px-3 py-4 text-sm",
173
+ children: /* @__PURE__ */ jsx(StatusBadge, {
174
+ color: order.status === "delivered" || order.status === "shipped" ? "green" : order.status === "cancelled" || order.status === "returned" ? "red" : "yellow",
175
+ size: "xs",
176
+ children: order.status
177
+ })
178
+ }),
179
+ /* @__PURE__ */ jsx(TableCell, {
180
+ className: "text-foreground px-3 py-4 text-sm whitespace-nowrap",
181
+ children: formatTotal(order)
182
+ })
183
+ ]
184
+ }, order.id))
185
+ })
186
+ ]
187
+ })
188
+ }),
189
+ /* @__PURE__ */ jsx(PaginationFooter, {
190
+ currentPage: 1,
191
+ totalPages: 1,
192
+ pageSize,
193
+ totalItems,
194
+ cursorPaginationMode: true,
195
+ hasNextPage,
196
+ hasPrevPage,
197
+ onCursorNext: handleNextPage,
198
+ onCursorPrev: handlePrevPage
199
+ })
200
+ ]
201
+ });
202
+ }
203
+ //#endregion
204
+ //#region ../../orders/ui/src/screens/PortalOrdersListScreen.tsx
205
+ function PortalOrdersListScreen({ onOrderClick, t, pageSize }) {
206
+ useScreenHeaderBreadcrumbs(useMemo(() => /* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsx(BreadcrumbList, {
207
+ className: "text-lg",
208
+ children: /* @__PURE__ */ jsx(BreadcrumbItem, { children: /* @__PURE__ */ jsx(BreadcrumbPage, {
209
+ className: "font-semibold",
210
+ children: "Orders"
211
+ }) })
212
+ }) }), []));
213
+ return /* @__PURE__ */ jsx("div", {
214
+ className: "mx-auto max-w-7xl px-4 py-4 sm:px-6 sm:py-6 lg:px-10 lg:py-8",
215
+ children: /* @__PURE__ */ jsx(PortalOrdersList, {
216
+ onOrderClick,
217
+ t,
218
+ pageSize
219
+ })
220
+ });
221
+ }
222
+ //#endregion
223
+ //#region src/screens/OrdersListScreen.tsx
224
+ const translations = {
225
+ search_orders: "Search orders...",
226
+ order_number: "Order #",
227
+ date: "Date",
228
+ status: "Status",
229
+ product: "Product",
230
+ no_orders_found: "No orders found",
231
+ no_matching_orders: "No matching orders",
232
+ no_image_available: "No image available",
233
+ this_product_no_longer_exists: "This product no longer exists",
234
+ subscription: "Subscription",
235
+ view_subscription: "View Subscription",
236
+ total: "Total",
237
+ results: "results",
238
+ previous: "Previous",
239
+ next: "Next",
240
+ pagination: "Pagination"
241
+ };
242
+ function OrdersListScreen() {
243
+ const ordersApi = useOrdersApi();
244
+ const { navigate } = useAppNavigation();
245
+ const handleOrderClick = (order) => {
246
+ navigate(`orders/${order.token}`);
247
+ };
248
+ return /* @__PURE__ */ jsx(OrdersCoreProvider, {
249
+ api: ordersApi,
250
+ children: /* @__PURE__ */ jsx(PortalOrdersListScreen, {
251
+ onOrderClick: handleOrderClick,
252
+ t: (key) => translations[key] ?? key
253
+ })
254
+ });
255
+ }
256
+ //#endregion
257
+ //#region ../../orders/ui/src/components/portal-order-detail.tsx
258
+ function DetailSkeleton() {
259
+ return /* @__PURE__ */ jsxs("div", {
260
+ className: "flex flex-col lg:grid lg:grid-cols-8",
261
+ children: [/* @__PURE__ */ jsx("div", {
262
+ className: "bg-muted flex flex-col items-center px-8 lg:col-span-4",
263
+ children: /* @__PURE__ */ jsxs("div", {
264
+ className: "w-full max-w-lg py-6",
265
+ children: [
266
+ /* @__PURE__ */ jsx(Skeleton, { className: "mb-4 h-6 w-48" }),
267
+ /* @__PURE__ */ jsx("div", {
268
+ className: "space-y-4",
269
+ children: /* @__PURE__ */ jsxs("div", {
270
+ className: "flex items-center space-x-4",
271
+ children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-24 w-24 rounded" }), /* @__PURE__ */ jsxs("div", {
272
+ className: "flex-1 space-y-2",
273
+ children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-3/4" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-1/2" })]
274
+ })]
275
+ })
276
+ }),
277
+ /* @__PURE__ */ jsxs("div", {
278
+ className: "mt-6 space-y-2",
279
+ children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-full" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-full" })]
280
+ })
281
+ ]
282
+ })
283
+ }), /* @__PURE__ */ jsx("div", {
284
+ className: "bg-background px-8 pt-4 lg:col-span-4",
285
+ children: /* @__PURE__ */ jsxs("div", {
286
+ className: "mx-auto max-w-lg lg:mx-0 lg:mr-auto",
287
+ children: [/* @__PURE__ */ jsx(Skeleton, { className: "mb-4 h-10 w-full rounded" }), /* @__PURE__ */ jsxs("div", {
288
+ className: "mt-6 space-y-4",
289
+ children: [/* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-40" }), /* @__PURE__ */ jsx(Skeleton, { className: "h-16 w-full rounded" })]
290
+ })]
291
+ })
292
+ })]
293
+ });
294
+ }
295
+ function ItemRow({ item }) {
296
+ return /* @__PURE__ */ jsxs("div", {
297
+ className: "flex items-center space-x-4 py-4",
298
+ children: [/* @__PURE__ */ jsxs("div", {
299
+ className: "relative shrink-0",
300
+ children: [/* @__PURE__ */ jsx("div", {
301
+ className: "bg-muted text-muted-foreground flex h-24 w-24 items-center justify-center overflow-hidden rounded",
302
+ children: "No image"
303
+ }), item.quantity > 1 && /* @__PURE__ */ jsx("span", {
304
+ className: "bg-foreground text-background absolute -top-2 -right-2 z-10 flex h-6 w-6 items-center justify-center rounded-full text-xs font-medium",
305
+ children: item.quantity
306
+ })]
307
+ }), /* @__PURE__ */ jsxs("div", {
308
+ className: "flex min-w-0 flex-1 flex-col space-y-0.5",
309
+ children: [
310
+ /* @__PURE__ */ jsx("p", {
311
+ className: "text-foreground truncate text-sm font-medium",
312
+ title: item.product_name,
313
+ children: item.product_name
314
+ }),
315
+ /* @__PURE__ */ jsx("p", {
316
+ className: "text-foreground text-sm font-medium",
317
+ children: item.total
318
+ }),
319
+ item.quantity > 1 && /* @__PURE__ */ jsxs("p", {
320
+ className: "text-muted-foreground text-xs",
321
+ children: [
322
+ item.price,
323
+ " x ",
324
+ item.quantity
325
+ ]
326
+ })
327
+ ]
328
+ })]
329
+ });
330
+ }
331
+ function ItemsSection({ order }) {
332
+ return /* @__PURE__ */ jsx("section", {
333
+ className: "bg-muted flex w-full flex-col items-center px-8 lg:col-span-4",
334
+ children: /* @__PURE__ */ jsxs("div", {
335
+ className: "flex w-full max-w-lg flex-col",
336
+ children: [
337
+ /* @__PURE__ */ jsxs("div", {
338
+ className: "mt-4",
339
+ children: [/* @__PURE__ */ jsxs("h2", {
340
+ className: "text-foreground mb-2 text-lg font-medium",
341
+ children: [
342
+ "Items (",
343
+ order.line_items.length,
344
+ ")"
345
+ ]
346
+ }), /* @__PURE__ */ jsx("hr", { className: "border-border" })]
347
+ }),
348
+ /* @__PURE__ */ jsx("div", {
349
+ className: "divide-border divide-y",
350
+ children: order.line_items.map((item) => /* @__PURE__ */ jsx(ItemRow, { item }, item.id))
351
+ }),
352
+ /* @__PURE__ */ jsx("div", {
353
+ className: "border-border mb-4 border-t pt-4",
354
+ children: /* @__PURE__ */ jsxs("div", {
355
+ className: "mt-4 flex items-center justify-between text-base font-medium",
356
+ children: [/* @__PURE__ */ jsx("p", {
357
+ className: "text-muted-foreground text-sm font-medium",
358
+ children: "Total"
359
+ }), /* @__PURE__ */ jsxs("p", {
360
+ className: "text-foreground text-base font-bold",
361
+ children: [
362
+ order.currency,
363
+ " ",
364
+ order.total
365
+ ]
366
+ })]
367
+ })
368
+ })
369
+ ]
370
+ })
371
+ });
372
+ }
373
+ function DetailsSection({ order }) {
374
+ return /* @__PURE__ */ jsx("div", {
375
+ className: "bg-background px-8 pt-4 lg:col-span-4",
376
+ children: /* @__PURE__ */ jsxs("div", {
377
+ className: "mx-auto max-w-lg lg:mx-0 lg:mr-auto",
378
+ children: [/* @__PURE__ */ jsx("div", {
379
+ className: "border-border mb-6 border-b pb-6",
380
+ children: /* @__PURE__ */ jsx("div", {
381
+ className: "flex flex-wrap items-center gap-3",
382
+ children: /* @__PURE__ */ jsxs("div", {
383
+ className: "flex items-center gap-2",
384
+ children: [/* @__PURE__ */ jsx("span", {
385
+ className: "text-muted-foreground text-sm",
386
+ children: "Status:"
387
+ }), /* @__PURE__ */ jsx(OrderStatusBadge, { status: order.status })]
388
+ })
389
+ })
390
+ }), /* @__PURE__ */ jsxs("div", {
391
+ className: "border-border mb-6 border-b pb-6",
392
+ children: [
393
+ /* @__PURE__ */ jsx("h3", {
394
+ className: "text-foreground mb-3 text-sm/6 font-semibold",
395
+ children: "Order Info"
396
+ }),
397
+ /* @__PURE__ */ jsxs("div", {
398
+ className: "divide-border flex divide-x",
399
+ children: [/* @__PURE__ */ jsxs("div", {
400
+ className: "flex-1 pr-4",
401
+ children: [/* @__PURE__ */ jsx("div", {
402
+ className: "text-muted-foreground text-sm",
403
+ children: "Order"
404
+ }), /* @__PURE__ */ jsxs("div", {
405
+ className: "text-foreground font-medium",
406
+ children: ["#", order.id]
407
+ })]
408
+ }), /* @__PURE__ */ jsxs("div", {
409
+ className: "flex-1 pl-4 text-right",
410
+ children: [/* @__PURE__ */ jsx("div", {
411
+ className: "text-muted-foreground text-sm",
412
+ children: "Date"
413
+ }), /* @__PURE__ */ jsx("div", {
414
+ className: "text-foreground font-medium",
415
+ children: new Date(order.created_at).toLocaleDateString("en-US", {
416
+ year: "numeric",
417
+ month: "short",
418
+ day: "numeric"
419
+ })
420
+ })]
421
+ })]
422
+ }),
423
+ order.customer_email && /* @__PURE__ */ jsxs("div", {
424
+ className: "mt-3",
425
+ children: [/* @__PURE__ */ jsx("div", {
426
+ className: "text-muted-foreground text-sm",
427
+ children: "Email"
428
+ }), /* @__PURE__ */ jsx("div", {
429
+ className: "text-foreground text-sm font-medium",
430
+ children: order.customer_email
431
+ })]
432
+ }),
433
+ order.customer_name && /* @__PURE__ */ jsxs("div", {
434
+ className: "mt-3",
435
+ children: [/* @__PURE__ */ jsx("div", {
436
+ className: "text-muted-foreground text-sm",
437
+ children: "Customer"
438
+ }), /* @__PURE__ */ jsx("div", {
439
+ className: "text-foreground text-sm font-medium",
440
+ children: order.customer_name
441
+ })]
442
+ })
443
+ ]
444
+ })]
445
+ })
446
+ });
447
+ }
448
+ function PortalOrderDetail({ id, onNotFound, onError }) {
449
+ const { data, isLoading, error } = usePortalTenantOrder(id);
450
+ const order = data?.order;
451
+ useEffect(() => {
452
+ if (!isLoading && error) onError?.(error);
453
+ }, [
454
+ isLoading,
455
+ error,
456
+ onError
457
+ ]);
458
+ useEffect(() => {
459
+ if (!isLoading && !error && !order) onNotFound?.();
460
+ }, [
461
+ isLoading,
462
+ error,
463
+ order,
464
+ onNotFound
465
+ ]);
466
+ if (isLoading) return /* @__PURE__ */ jsx(DetailSkeleton, {});
467
+ if (!order) return null;
468
+ return /* @__PURE__ */ jsxs("div", {
469
+ className: "flex flex-col lg:grid lg:grid-cols-8",
470
+ children: [/* @__PURE__ */ jsx(ItemsSection, { order }), /* @__PURE__ */ jsx(DetailsSection, { order })]
471
+ });
472
+ }
473
+ //#endregion
474
+ //#region ../../orders/ui/src/screens/PortalOrderDetailScreen.tsx
475
+ function PortalOrderDetailScreen({ id, onNavigateToList, onNotFound, onError }) {
476
+ useScreenHeaderBreadcrumbs(useMemo(() => /* @__PURE__ */ jsx(Breadcrumb, { children: /* @__PURE__ */ jsxs(BreadcrumbList, {
477
+ className: "text-lg",
478
+ children: [
479
+ /* @__PURE__ */ jsx(BreadcrumbItem, { children: /* @__PURE__ */ jsx(BreadcrumbLink, {
480
+ href: "#",
481
+ onClick: (e) => {
482
+ e.preventDefault();
483
+ onNavigateToList();
484
+ },
485
+ children: "Orders"
486
+ }) }),
487
+ /* @__PURE__ */ jsx(BreadcrumbSeparator, {}),
488
+ /* @__PURE__ */ jsx(BreadcrumbItem, { children: /* @__PURE__ */ jsxs(BreadcrumbPage, {
489
+ className: "font-semibold",
490
+ children: ["Order #", id]
491
+ }) })
492
+ ]
493
+ }) }), [id, onNavigateToList]));
494
+ return /* @__PURE__ */ jsx("div", {
495
+ className: "mx-auto max-w-7xl px-4 py-4 sm:px-6 sm:py-6 lg:px-10 lg:py-8",
496
+ children: /* @__PURE__ */ jsx(PortalOrderDetail, {
497
+ id,
498
+ onNotFound,
499
+ onError
500
+ })
501
+ });
502
+ }
503
+ //#endregion
504
+ //#region src/screens/OrderDetailScreen.tsx
505
+ function OrderDetailScreen({ token, onToast }) {
506
+ const ordersApi = useOrdersApi();
507
+ const { navigate } = useAppNavigation();
508
+ return /* @__PURE__ */ jsx(OrdersCoreProvider, {
509
+ api: ordersApi,
510
+ children: /* @__PURE__ */ jsx(PortalOrderDetailScreen, {
511
+ id: token,
512
+ onNavigateToList: () => navigate("orders"),
513
+ onNotFound: () => {
514
+ onToast("Order not found", "warning");
515
+ navigate("orders");
516
+ },
517
+ onError: (err) => {
518
+ onToast(`Failed to load order: ${err instanceof Error ? err.message : "An error occurred"}`, "error");
519
+ }
520
+ })
521
+ });
522
+ }
523
+ //#endregion
524
+ //#region src/screens/OrdersScreen.tsx
525
+ var OrdersScreen_exports = /* @__PURE__ */ __exportAll({
526
+ OrdersScreen: () => OrdersScreen,
527
+ ordersScreenPropertySchema: () => ordersScreenPropertySchema
528
+ });
529
+ function defaultToast(message, type) {
530
+ if (type === "error" || type === "warning") console.warn("[Orders]", message);
531
+ else console.info("[Orders]", message);
532
+ }
533
+ function OrdersScreen({ onToast, background, textColor, accentColor, padding, borderRadius, ...divProps }) {
534
+ const { currentSlug } = useAppNavigation();
535
+ const effectiveToast = onToast ?? defaultToast;
536
+ const detailToken = currentSlug.split("/")[1];
537
+ if (detailToken !== void 0) return /* @__PURE__ */ jsx("div", {
538
+ ...divProps,
539
+ children: /* @__PURE__ */ jsx(OrderDetailScreen, {
540
+ token: detailToken,
541
+ onToast: effectiveToast
542
+ })
543
+ });
544
+ return /* @__PURE__ */ jsx("div", {
545
+ ...divProps,
546
+ children: /* @__PURE__ */ jsx(OrdersListScreen, {})
547
+ });
548
+ }
549
+ const ordersScreenPropertySchema = {
550
+ widgetType: "OrdersScreen",
551
+ displayName: "Orders Screen",
552
+ tabsConfig: [{
553
+ id: "styling",
554
+ label: "Styling"
555
+ }],
556
+ fields: []
557
+ };
558
+ //#endregion
559
+ export { OrdersScreen_exports as n, ordersScreenPropertySchema as r, OrdersScreen as t };
560
+
561
+ //# sourceMappingURL=OrdersScreen-D_7TJgZ4.mjs.map