@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.
- package/dist/{AppDownloadScreen-DTxo4z3_.cjs → AppDownloadScreen-ChKim_6A.cjs} +2 -2
- package/dist/{AppDownloadScreen-DTxo4z3_.cjs.map → AppDownloadScreen-ChKim_6A.cjs.map} +1 -1
- package/dist/{AppDownloadScreen-BoGSdsJk.mjs → AppDownloadScreen-DGHd6hYM.mjs} +2 -2
- package/dist/{AppDownloadScreen-BoGSdsJk.mjs.map → AppDownloadScreen-DGHd6hYM.mjs.map} +1 -1
- package/dist/{AppDownloadScreen-Chxavsr_.cjs → AppDownloadScreen-DpyV1tJw.cjs} +2 -2
- package/dist/{ContactsScreen-BKOHursc.mjs → ContactsScreen-Bcea6126.mjs} +3 -3
- package/dist/{ContactsScreen-BKOHursc.mjs.map → ContactsScreen-Bcea6126.mjs.map} +1 -1
- package/dist/{ContactsScreen-DN8Qt2Ih.cjs → ContactsScreen-CsIGZaWy.cjs} +4 -4
- package/dist/{ContactsScreen-DN8Qt2Ih.cjs.map → ContactsScreen-CsIGZaWy.cjs.map} +1 -1
- package/dist/{ContactsScreen-FrVLbjGO.cjs → ContactsScreen-OBDC1046.cjs} +4 -4
- package/dist/{FluidProvider-CgTeGUnF.mjs → FluidProvider-BJQSXofR.mjs} +198 -615
- package/dist/FluidProvider-BJQSXofR.mjs.map +1 -0
- package/dist/{FluidProvider-BMMu_rp3.cjs → FluidProvider-DvqnkjZI.cjs} +196 -625
- package/dist/FluidProvider-DvqnkjZI.cjs.map +1 -0
- package/dist/{MessagingScreen-Bvq3Dd5i.mjs → MessagingScreen-B48ksZOJ.mjs} +3 -3
- package/dist/{MessagingScreen-Bvq3Dd5i.mjs.map → MessagingScreen-B48ksZOJ.mjs.map} +1 -1
- package/dist/{MessagingScreen-DMDXiH97.mjs → MessagingScreen-COGo4S9K.mjs} +2 -2
- package/dist/{MessagingScreen-DgbNN4BF.cjs → MessagingScreen-DYgiatey.cjs} +3 -3
- package/dist/{MessagingScreen-DgbNN4BF.cjs.map → MessagingScreen-DYgiatey.cjs.map} +1 -1
- package/dist/{MessagingScreen-bzzXjQMu.cjs → MessagingScreen-QyUOxYXl.cjs} +2 -2
- package/dist/{MySiteScreen-nV8x9xyy.cjs → MySiteScreen-ByIJ6CkU.cjs} +2 -2
- package/dist/{MySiteScreen-nV8x9xyy.cjs.map → MySiteScreen-ByIJ6CkU.cjs.map} +1 -1
- package/dist/{MySiteScreen-BJH5-RNT.mjs → MySiteScreen-DZ0ru6Bn.mjs} +2 -2
- package/dist/{MySiteScreen-BJH5-RNT.mjs.map → MySiteScreen-DZ0ru6Bn.mjs.map} +1 -1
- package/dist/{MySiteScreen-CYZpUYTn.cjs → MySiteScreen-DrWUJJiH.cjs} +2 -2
- package/dist/{OrdersScreen-BL__flBE.cjs → OrdersScreen-CkvoeTvK.cjs} +3 -3
- package/dist/OrdersScreen-D_7TJgZ4.mjs +561 -0
- package/dist/OrdersScreen-D_7TJgZ4.mjs.map +1 -0
- package/dist/OrdersScreen-DyYYjl9I.cjs +568 -0
- package/dist/OrdersScreen-DyYYjl9I.cjs.map +1 -0
- package/dist/{ProductsScreen-BIYHPaBZ.cjs → ProductsScreen-B8NmyIJy.cjs} +3 -3
- package/dist/{ProductsScreen-COwahI-V.mjs → ProductsScreen-CMnhqsSA.mjs} +5 -5
- package/dist/{ProductsScreen-COwahI-V.mjs.map → ProductsScreen-CMnhqsSA.mjs.map} +1 -1
- package/dist/{ProductsScreen-D6h-r9ht.mjs → ProductsScreen-DzNmbwVi.mjs} +3 -3
- package/dist/{ProductsScreen-C8UfVLRr.cjs → ProductsScreen-Z1hx1YZQ.cjs} +5 -5
- package/dist/{ProductsScreen-C8UfVLRr.cjs.map → ProductsScreen-Z1hx1YZQ.cjs.map} +1 -1
- package/dist/{ProfileScreen-CZp_NrjO.cjs → ProfileScreen-B81Ovmh_.cjs} +2 -2
- package/dist/{ProfileScreen-FYGHStqM.cjs → ProfileScreen-CYTxOGeW.cjs} +526 -137
- package/dist/ProfileScreen-CYTxOGeW.cjs.map +1 -0
- package/dist/{ProfileScreen-BKRn8AqI.mjs → ProfileScreen-QOXtyrJi.mjs} +522 -133
- package/dist/ProfileScreen-QOXtyrJi.mjs.map +1 -0
- package/dist/{ShareablesScreen-BEPVTMeI.cjs → ShareablesScreen-1HpfEjyd.cjs} +7 -7
- package/dist/{ShareablesScreen-BEPVTMeI.cjs.map → ShareablesScreen-1HpfEjyd.cjs.map} +1 -1
- package/dist/{ShareablesScreen-BrC5LGtU.cjs → ShareablesScreen-BXO8MpAy.cjs} +3 -3
- package/dist/{ShareablesScreen-BXzxUg0E.mjs → ShareablesScreen-DSsMJJh_.mjs} +7 -7
- package/dist/{ShareablesScreen-BXzxUg0E.mjs.map → ShareablesScreen-DSsMJJh_.mjs.map} +1 -1
- package/dist/{ShareablesScreen-aMnwEOAH.mjs → ShareablesScreen-Oo3jMHX6.mjs} +3 -3
- package/dist/{ShopScreen-CHH0cx2P.cjs → ShopScreen-BDcWpmi7.cjs} +4 -4
- package/dist/{ShopScreen-CHH0cx2P.cjs.map → ShopScreen-BDcWpmi7.cjs.map} +1 -1
- package/dist/{ShopScreen-8OQhLeLt.cjs → ShopScreen-CWxOPn7H.cjs} +2 -2
- package/dist/{ShopScreen-Yi9sOX_2.mjs → ShopScreen-DsReuJ7P.mjs} +4 -4
- package/dist/{ShopScreen-Yi9sOX_2.mjs.map → ShopScreen-DsReuJ7P.mjs.map} +1 -1
- package/dist/{SubscriptionsScreen-oApGaq11.cjs → SubscriptionsScreen-B8mLGt5-.cjs} +27 -10
- package/dist/SubscriptionsScreen-B8mLGt5-.cjs.map +1 -0
- package/dist/{SubscriptionsScreen-C2F3HNJS.cjs → SubscriptionsScreen-C2zbEjMC.cjs} +4 -4
- package/dist/{SubscriptionsScreen-CZ-1jSO2.mjs → SubscriptionsScreen-DZxLo4up.mjs} +21 -4
- package/dist/SubscriptionsScreen-DZxLo4up.mjs.map +1 -0
- package/dist/index.cjs +37 -37
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +37 -37
- package/dist/order-status-badge-KooNqnAs.mjs +262 -0
- package/dist/order-status-badge-KooNqnAs.mjs.map +1 -0
- package/dist/order-status-badge-cwqA8dZ-.cjs +304 -0
- package/dist/order-status-badge-cwqA8dZ-.cjs.map +1 -0
- package/dist/portal_tenant-CP5Ce8Jn.cjs +261 -0
- package/dist/portal_tenant-CP5Ce8Jn.cjs.map +1 -0
- package/dist/portal_tenant-CWy4Zg2t.mjs +166 -0
- package/dist/portal_tenant-CWy4Zg2t.mjs.map +1 -0
- package/dist/src-BOIW-KES.mjs +3 -0
- package/dist/src-CzwiFO_J.cjs +3 -0
- package/dist/{src-BMUEjfhg.mjs → src-Dgo44BGe.mjs} +1 -1
- package/dist/{src-BMUEjfhg.mjs.map → src-Dgo44BGe.mjs.map} +1 -1
- package/dist/{src-BJdOxgpp.cjs → src-DkhHoxnS.cjs} +1 -1
- package/dist/{src-BJdOxgpp.cjs.map → src-DkhHoxnS.cjs.map} +1 -1
- package/dist/use-account-clients-Dim60sir.mjs +451 -0
- package/dist/use-account-clients-Dim60sir.mjs.map +1 -0
- package/dist/use-account-clients-DoJW3KTx.cjs +481 -0
- package/dist/use-account-clients-DoJW3KTx.cjs.map +1 -0
- package/dist/{use-current-user-DCk55_Qn.mjs → use-current-user-Baxj7HJt.mjs} +3 -3
- package/dist/{use-current-user-DCk55_Qn.mjs.map → use-current-user-Baxj7HJt.mjs.map} +1 -1
- package/dist/{use-current-user-BR5_zaoZ.cjs → use-current-user-BcZWV7oU.cjs} +3 -3
- package/dist/{use-current-user-BR5_zaoZ.cjs.map → use-current-user-BcZWV7oU.cjs.map} +1 -1
- package/dist/{use-fluid-api-CmCAH10d.mjs → use-fluid-api-BP05Cf-f.mjs} +2 -2
- package/dist/{use-fluid-api-CmCAH10d.mjs.map → use-fluid-api-BP05Cf-f.mjs.map} +1 -1
- package/dist/{use-fluid-api-C1KeHB7q.cjs → use-fluid-api-Ds8BInAZ.cjs} +2 -2
- package/dist/{use-fluid-api-C1KeHB7q.cjs.map → use-fluid-api-Ds8BInAZ.cjs.map} +1 -1
- package/dist/{use-fluid-auth-BQEV7ylM.mjs → use-fluid-auth-C-Qpl8j4.mjs} +2 -2
- package/dist/{use-fluid-auth-BQEV7ylM.mjs.map → use-fluid-auth-C-Qpl8j4.mjs.map} +1 -1
- package/dist/{use-fluid-auth-CyKaXLbW.cjs → use-fluid-auth-sGNMgfnt.cjs} +2 -2
- package/dist/{use-fluid-auth-CyKaXLbW.cjs.map → use-fluid-auth-sGNMgfnt.cjs.map} +1 -1
- package/dist/{use-portal-products-client-pptYMuSw.cjs → use-portal-products-client-DKYkBjm-.cjs} +7 -48
- package/dist/use-portal-products-client-DKYkBjm-.cjs.map +1 -0
- package/dist/{use-portal-products-client-BL1xVtex.mjs → use-portal-products-client-s2qtZjhU.mjs} +3 -44
- package/dist/use-portal-products-client-s2qtZjhU.mjs.map +1 -0
- package/package.json +13 -12
- package/dist/FluidProvider-BMMu_rp3.cjs.map +0 -1
- package/dist/FluidProvider-CgTeGUnF.mjs.map +0 -1
- package/dist/OrdersScreen-BLb3_KtI.mjs +0 -176
- package/dist/OrdersScreen-BLb3_KtI.mjs.map +0 -1
- package/dist/OrdersScreen-uL3mRk1h.cjs +0 -183
- package/dist/OrdersScreen-uL3mRk1h.cjs.map +0 -1
- package/dist/ProfileScreen-BKRn8AqI.mjs.map +0 -1
- package/dist/ProfileScreen-FYGHStqM.cjs.map +0 -1
- package/dist/SubscriptionsScreen-CZ-1jSO2.mjs.map +0 -1
- package/dist/SubscriptionsScreen-oApGaq11.cjs.map +0 -1
- package/dist/order-detail-DHXdE4Cl.cjs +0 -961
- package/dist/order-detail-DHXdE4Cl.cjs.map +0 -1
- package/dist/order-detail-iZm_R0TX.mjs +0 -931
- package/dist/order-detail-iZm_R0TX.mjs.map +0 -1
- package/dist/src-BJSTFxSO.mjs +0 -1
- package/dist/src-DMVR26Fk.cjs +0 -1
- package/dist/use-account-clients-CL6rr17o.cjs +0 -214
- package/dist/use-account-clients-CL6rr17o.cjs.map +0 -1
- package/dist/use-account-clients-CMjRB5On.mjs +0 -190
- package/dist/use-account-clients-CMjRB5On.mjs.map +0 -1
- package/dist/use-customer-account-BAolVc3q.mjs +0 -22
- package/dist/use-customer-account-BAolVc3q.mjs.map +0 -1
- package/dist/use-customer-account-DSsXbcme.cjs +0 -28
- package/dist/use-customer-account-DSsXbcme.cjs.map +0 -1
- package/dist/use-portal-products-client-BL1xVtex.mjs.map +0 -1
- package/dist/use-portal-products-client-pptYMuSw.cjs.map +0 -1
|
@@ -1,961 +0,0 @@
|
|
|
1
|
-
require("./chunk-9hOWP6kD.cjs");
|
|
2
|
-
const require_src = require("./src-UnXevN9n.cjs");
|
|
3
|
-
let react = require("react");
|
|
4
|
-
let _tanstack_react_query = require("@tanstack/react-query");
|
|
5
|
-
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
-
let lucide_react = require("lucide-react");
|
|
7
|
-
//#region ../../orders/core/src/context.ts
|
|
8
|
-
const OrdersApiContext = (0, react.createContext)(null);
|
|
9
|
-
const OrdersApiProvider = OrdersApiContext.Provider;
|
|
10
|
-
function useOrdersApi() {
|
|
11
|
-
const api = (0, react.useContext)(OrdersApiContext);
|
|
12
|
-
if (!api) throw new Error("useOrdersApi must be used within an OrdersCoreProvider");
|
|
13
|
-
return api;
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region ../../orders/core/src/provider.tsx
|
|
17
|
-
function OrdersCoreProvider({ api, children }) {
|
|
18
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OrdersApiProvider, {
|
|
19
|
-
value: api,
|
|
20
|
-
children
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region ../../orders/core/src/query-keys.ts
|
|
25
|
-
const ordersKeys = {
|
|
26
|
-
all: ["orders"],
|
|
27
|
-
list: (params) => [
|
|
28
|
-
...ordersKeys.all,
|
|
29
|
-
"list",
|
|
30
|
-
params
|
|
31
|
-
],
|
|
32
|
-
detail: (orderToken) => [
|
|
33
|
-
...ordersKeys.all,
|
|
34
|
-
"detail",
|
|
35
|
-
orderToken
|
|
36
|
-
]
|
|
37
|
-
};
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region ../../orders/core/src/hooks/use-order.ts
|
|
40
|
-
function useOrder(orderToken, options) {
|
|
41
|
-
const api = useOrdersApi();
|
|
42
|
-
return (0, _tanstack_react_query.useQuery)({
|
|
43
|
-
queryKey: ordersKeys.detail(orderToken),
|
|
44
|
-
queryFn: () => api.fetchOrder(orderToken),
|
|
45
|
-
enabled: (options?.enabled ?? true) && !!orderToken
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region ../../orders/core/src/hooks/use-customer-orders.ts
|
|
50
|
-
function useCustomerOrders(params, options) {
|
|
51
|
-
const api = useOrdersApi();
|
|
52
|
-
return (0, _tanstack_react_query.useQuery)({
|
|
53
|
-
queryKey: ordersKeys.list(params),
|
|
54
|
-
queryFn: () => api.fetchCustomerOrders(params),
|
|
55
|
-
enabled: options?.enabled ?? true
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region ../../orders/core/src/utils/format-order-total.ts
|
|
60
|
-
function formatOrderTotal(order) {
|
|
61
|
-
if (order.order_total_after_points_redemption != null) return `${order.currency_symbol || "$"}${Number(order.order_total_after_points_redemption).toFixed(2)}`;
|
|
62
|
-
return order.total_display_amount || `${order.currency_symbol || "$"}${Number(order.amount).toFixed(2)}`;
|
|
63
|
-
}
|
|
64
|
-
//#endregion
|
|
65
|
-
//#region ../../orders/ui/src/components/search-input.tsx
|
|
66
|
-
function SearchInput({ searchTerm, onSearchChange, placeholder }) {
|
|
67
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
68
|
-
className: "relative",
|
|
69
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Search, { className: "text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Input, {
|
|
70
|
-
value: searchTerm,
|
|
71
|
-
onChange: (e) => onSearchChange(e.target.value),
|
|
72
|
-
placeholder,
|
|
73
|
-
className: "pl-9"
|
|
74
|
-
})]
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region ../../orders/ui/src/components/pagination-footer.tsx
|
|
79
|
-
function PaginationFooter({ currentPage, totalPages, pageSize, totalItems, onPageChange, cursorPaginationMode, hasNextPage, hasPrevPage, onCursorNext, onCursorPrev }) {
|
|
80
|
-
const isCursor = !!cursorPaginationMode;
|
|
81
|
-
const isPrevDisabled = isCursor ? !hasPrevPage : currentPage === 1;
|
|
82
|
-
const isNextDisabled = isCursor ? !hasNextPage : totalPages === 0 || currentPage === totalPages;
|
|
83
|
-
const handlePrevClick = () => {
|
|
84
|
-
if (isCursor) onCursorPrev?.();
|
|
85
|
-
else onPageChange?.(currentPage - 1);
|
|
86
|
-
};
|
|
87
|
-
const handleNextClick = () => {
|
|
88
|
-
if (isCursor) onCursorNext?.();
|
|
89
|
-
else onPageChange?.(currentPage + 1);
|
|
90
|
-
};
|
|
91
|
-
const displayText = (() => {
|
|
92
|
-
if (isCursor) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
93
|
-
"Total ",
|
|
94
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
95
|
-
className: "font-medium",
|
|
96
|
-
children: totalItems
|
|
97
|
-
}),
|
|
98
|
-
" results"
|
|
99
|
-
] });
|
|
100
|
-
const start = totalItems === 0 ? 0 : (currentPage - 1) * pageSize + 1;
|
|
101
|
-
const end = Math.min(currentPage * pageSize, totalItems);
|
|
102
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
103
|
-
"Showing ",
|
|
104
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
105
|
-
className: "font-medium",
|
|
106
|
-
children: start
|
|
107
|
-
}),
|
|
108
|
-
" to",
|
|
109
|
-
" ",
|
|
110
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
111
|
-
className: "font-medium",
|
|
112
|
-
children: end
|
|
113
|
-
}),
|
|
114
|
-
" of",
|
|
115
|
-
" ",
|
|
116
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
117
|
-
className: "font-medium",
|
|
118
|
-
children: totalItems
|
|
119
|
-
}),
|
|
120
|
-
" results"
|
|
121
|
-
] });
|
|
122
|
-
})();
|
|
123
|
-
const buttonBase = "relative inline-flex items-center px-3 py-2 text-sm font-medium transition-colors disabled:pointer-events-none disabled:opacity-50";
|
|
124
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
125
|
-
className: "border-border flex items-center justify-between border-t px-4 py-3 sm:px-6",
|
|
126
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
127
|
-
className: "flex flex-1 justify-between sm:hidden",
|
|
128
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
129
|
-
type: "button",
|
|
130
|
-
onClick: handlePrevClick,
|
|
131
|
-
disabled: isPrevDisabled,
|
|
132
|
-
className: require_src.cn(buttonBase, "border-border bg-background text-foreground hover:bg-accent rounded-md border"),
|
|
133
|
-
children: "Previous"
|
|
134
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
135
|
-
type: "button",
|
|
136
|
-
onClick: handleNextClick,
|
|
137
|
-
disabled: isNextDisabled,
|
|
138
|
-
className: require_src.cn(buttonBase, "border-border bg-background text-foreground hover:bg-accent ml-3 rounded-md border"),
|
|
139
|
-
children: "Next"
|
|
140
|
-
})]
|
|
141
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
142
|
-
className: "hidden sm:flex sm:flex-1 sm:items-center sm:justify-between",
|
|
143
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
144
|
-
className: "text-muted-foreground text-xs",
|
|
145
|
-
children: displayText
|
|
146
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("nav", {
|
|
147
|
-
"aria-label": "Pagination",
|
|
148
|
-
className: "isolate inline-flex -space-x-px rounded-md shadow-sm",
|
|
149
|
-
children: [
|
|
150
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
151
|
-
type: "button",
|
|
152
|
-
onClick: handlePrevClick,
|
|
153
|
-
disabled: isPrevDisabled,
|
|
154
|
-
className: require_src.cn(buttonBase, "border-border text-muted-foreground hover:bg-accent rounded-l-md border"),
|
|
155
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
156
|
-
className: "sr-only",
|
|
157
|
-
children: "Previous"
|
|
158
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronLeft, { className: "h-4 w-4" })]
|
|
159
|
-
}),
|
|
160
|
-
!isCursor && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
161
|
-
className: "border-border bg-background text-foreground relative inline-flex items-center border px-4 py-2 text-sm font-medium",
|
|
162
|
-
children: [
|
|
163
|
-
currentPage,
|
|
164
|
-
" / ",
|
|
165
|
-
totalPages
|
|
166
|
-
]
|
|
167
|
-
}),
|
|
168
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
169
|
-
type: "button",
|
|
170
|
-
onClick: handleNextClick,
|
|
171
|
-
disabled: isNextDisabled,
|
|
172
|
-
className: require_src.cn(buttonBase, "border-border text-muted-foreground hover:bg-accent rounded-r-md border"),
|
|
173
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
174
|
-
className: "sr-only",
|
|
175
|
-
children: "Next"
|
|
176
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronRight, { className: "h-4 w-4" })]
|
|
177
|
-
})
|
|
178
|
-
]
|
|
179
|
-
})]
|
|
180
|
-
})]
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
//#endregion
|
|
184
|
-
//#region ../../orders/ui/src/components/status-badge.tsx
|
|
185
|
-
const colorStyles = {
|
|
186
|
-
green: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",
|
|
187
|
-
yellow: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400",
|
|
188
|
-
red: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400",
|
|
189
|
-
blue: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400",
|
|
190
|
-
gray: "bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300"
|
|
191
|
-
};
|
|
192
|
-
const dotColorStyles = {
|
|
193
|
-
green: "bg-green-500",
|
|
194
|
-
yellow: "bg-yellow-500",
|
|
195
|
-
red: "bg-red-500",
|
|
196
|
-
blue: "bg-blue-500",
|
|
197
|
-
gray: "bg-gray-500"
|
|
198
|
-
};
|
|
199
|
-
const sizeStyles = {
|
|
200
|
-
xs: "px-1.5 py-0.5 text-[10px]",
|
|
201
|
-
sm: "px-2 py-0.5 text-xs",
|
|
202
|
-
md: "px-2.5 py-1 text-sm"
|
|
203
|
-
};
|
|
204
|
-
function StatusBadge({ color, dot, size = "md", className, children }) {
|
|
205
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
206
|
-
className: require_src.cn("inline-flex items-center gap-1 rounded-full font-medium whitespace-nowrap", colorStyles[color], sizeStyles[size], className),
|
|
207
|
-
children: [dot && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_src.cn("h-1.5 w-1.5 rounded-full", dotColorStyles[color]) }), children]
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
//#endregion
|
|
211
|
-
//#region ../../orders/ui/src/components/table-column.tsx
|
|
212
|
-
function TableColumn({ label, sortable = true, className, onSortClick, sortBy, sortData, chevronUpIcon, chevronDownIcon }) {
|
|
213
|
-
const hideUpIcon = sortData?.column !== sortBy || sortData?.column === sortBy && sortData?.direction === "asc";
|
|
214
|
-
const hideDownIcon = sortData?.column !== sortBy || sortData?.column === sortBy && sortData?.direction === "desc";
|
|
215
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TableHead, {
|
|
216
|
-
className: require_src.cn("group text-muted-foreground cursor-pointer px-3 text-xs transition-colors duration-200", "hover:text-primary", className),
|
|
217
|
-
onClick: () => sortable && onSortClick?.(sortBy ?? ""),
|
|
218
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
219
|
-
className: "relative flex items-center",
|
|
220
|
-
children: [label, sortable && chevronUpIcon && chevronDownIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
221
|
-
className: `ml-2 inline-flex flex-col items-center justify-center group-hover:opacity-100 ${sortData?.column === sortBy ? "opacity-100" : "opacity-0"} transition-opacity duration-200`,
|
|
222
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
223
|
-
className: "flex flex-col",
|
|
224
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
225
|
-
src: chevronUpIcon,
|
|
226
|
-
alt: "",
|
|
227
|
-
width: 12,
|
|
228
|
-
height: 12,
|
|
229
|
-
className: require_src.cn("text-muted-foreground group-hover:text-primary h-2.5 w-2.5 transition-colors duration-200", hideUpIcon && "opacity-0", sortData?.column !== sortBy && "group-hover:opacity-100")
|
|
230
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
231
|
-
src: chevronDownIcon,
|
|
232
|
-
alt: "",
|
|
233
|
-
width: 12,
|
|
234
|
-
height: 12,
|
|
235
|
-
className: require_src.cn("text-muted-foreground group-hover:text-primary h-2.5 w-2.5 transition-colors duration-200", hideDownIcon && "opacity-0", sortData?.column !== sortBy && "group-hover:opacity-100")
|
|
236
|
-
})]
|
|
237
|
-
})
|
|
238
|
-
})]
|
|
239
|
-
})
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
//#endregion
|
|
243
|
-
//#region ../../orders/ui/src/components/orders-list.tsx
|
|
244
|
-
function OrdersList({ customerId, onOrderClick, onSubscriptionClick, t, pageSize = 10 }) {
|
|
245
|
-
const [cursor, setCursor] = (0, react.useState)(null);
|
|
246
|
-
const [searchTerm, setSearchTerm] = (0, react.useState)("");
|
|
247
|
-
const { data, isLoading } = useCustomerOrders({
|
|
248
|
-
customerId,
|
|
249
|
-
limit: pageSize,
|
|
250
|
-
search: searchTerm || void 0,
|
|
251
|
-
cursor: cursor || void 0,
|
|
252
|
-
sort: "-created_at"
|
|
253
|
-
}, { enabled: !!customerId });
|
|
254
|
-
const handleSearchChange = (0, react.useCallback)((term) => {
|
|
255
|
-
setSearchTerm(term);
|
|
256
|
-
setCursor(null);
|
|
257
|
-
}, []);
|
|
258
|
-
const handleNextPage = (0, react.useCallback)(() => {
|
|
259
|
-
const nextCursor = data?.meta?.pagination?.next_cursor;
|
|
260
|
-
if (nextCursor) setCursor(nextCursor);
|
|
261
|
-
}, [data?.meta?.pagination?.next_cursor]);
|
|
262
|
-
const handlePrevPage = (0, react.useCallback)(() => {
|
|
263
|
-
const prevCursor = data?.meta?.pagination?.prev_cursor;
|
|
264
|
-
if (prevCursor) setCursor(prevCursor);
|
|
265
|
-
else setCursor(null);
|
|
266
|
-
}, [data?.meta?.pagination?.prev_cursor]);
|
|
267
|
-
const ordersList = data?.orders || [];
|
|
268
|
-
const pagination = data?.meta?.pagination;
|
|
269
|
-
const totalItems = pagination?.total_count ?? ordersList.length;
|
|
270
|
-
const totalPages = pagination?.total_pages ?? 1;
|
|
271
|
-
const currentPage = pagination?.current_page ?? 1;
|
|
272
|
-
const hasNextPage = !!pagination?.next_cursor;
|
|
273
|
-
const hasPrevPage = !!pagination?.prev_cursor;
|
|
274
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
275
|
-
className: "border-border overflow-hidden rounded-lg border shadow-sm",
|
|
276
|
-
children: [
|
|
277
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
278
|
-
className: "p-3 text-left",
|
|
279
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
280
|
-
className: "w-full md:mr-auto md:w-1/2 lg:w-1/3",
|
|
281
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchInput, {
|
|
282
|
-
searchTerm,
|
|
283
|
-
onSearchChange: handleSearchChange,
|
|
284
|
-
placeholder: t("search_orders")
|
|
285
|
-
})
|
|
286
|
-
})
|
|
287
|
-
}),
|
|
288
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
289
|
-
className: "block md:hidden",
|
|
290
|
-
children: isLoading ? Array(5).fill(0).map((_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
291
|
-
className: "border-border border-b p-4",
|
|
292
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
293
|
-
className: "flex space-x-3",
|
|
294
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-12 w-12 rounded-md" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
295
|
-
className: "flex-1 space-y-2",
|
|
296
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-4 w-3/4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-3 w-1/2" })]
|
|
297
|
-
})]
|
|
298
|
-
})
|
|
299
|
-
}, `skeleton-${index}`)) : ordersList.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
300
|
-
className: "text-muted-foreground px-3 py-8 text-center text-sm",
|
|
301
|
-
children: searchTerm ? t("no_matching_orders") : t("no_orders_found")
|
|
302
|
-
}) : ordersList.map((order) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
303
|
-
className: "border-border hover:bg-accent cursor-pointer border-b p-4 transition-colors duration-200 ease-in-out last:border-b-0",
|
|
304
|
-
onClick: () => onOrderClick(order),
|
|
305
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
306
|
-
className: "flex items-start space-x-3",
|
|
307
|
-
children: [order.first_item?.image_url ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
308
|
-
src: order.first_item.image_url,
|
|
309
|
-
alt: t("no_image_available"),
|
|
310
|
-
width: 48,
|
|
311
|
-
height: 48,
|
|
312
|
-
className: "h-12 w-12 flex-shrink-0 rounded-md object-cover"
|
|
313
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "bg-border h-12 w-12 flex-shrink-0 rounded-md" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
314
|
-
className: "w-0 min-w-0 flex-1",
|
|
315
|
-
children: [
|
|
316
|
-
order.first_item?.title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
317
|
-
className: "text-foreground truncate text-sm font-medium",
|
|
318
|
-
children: order.first_item.title
|
|
319
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
320
|
-
className: "bg-muted rounded-lg p-2",
|
|
321
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
322
|
-
className: "text-muted-foreground text-xs",
|
|
323
|
-
children: t("this_product_no_longer_exists")
|
|
324
|
-
})
|
|
325
|
-
}),
|
|
326
|
-
order.subscription && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusBadge, {
|
|
327
|
-
color: "blue",
|
|
328
|
-
size: "xs",
|
|
329
|
-
className: "mt-1",
|
|
330
|
-
children: t("subscription")
|
|
331
|
-
}),
|
|
332
|
-
order.subscription && onSubscriptionClick && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
333
|
-
type: "button",
|
|
334
|
-
className: "text-foreground hover:text-foreground/80 mt-1 inline-block text-xs transition-colors duration-200 hover:underline",
|
|
335
|
-
onClick: (e) => {
|
|
336
|
-
e.stopPropagation();
|
|
337
|
-
onSubscriptionClick(order.subscription.subscription_token);
|
|
338
|
-
},
|
|
339
|
-
children: t("view_subscription")
|
|
340
|
-
}),
|
|
341
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
342
|
-
className: "mt-2 grid grid-cols-2 gap-x-4 gap-y-1 text-sm",
|
|
343
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
344
|
-
className: "text-muted-foreground block text-xs",
|
|
345
|
-
children: t("date")
|
|
346
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
347
|
-
className: "text-muted-foreground",
|
|
348
|
-
children: new Date(order.created_at).toLocaleDateString()
|
|
349
|
-
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
350
|
-
className: "text-muted-foreground block text-xs",
|
|
351
|
-
children: t("total")
|
|
352
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
353
|
-
className: "text-foreground font-medium",
|
|
354
|
-
children: formatOrderTotal(order)
|
|
355
|
-
})] })]
|
|
356
|
-
})
|
|
357
|
-
]
|
|
358
|
-
})]
|
|
359
|
-
})
|
|
360
|
-
}, order.id))
|
|
361
|
-
}),
|
|
362
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
363
|
-
className: "hidden md:block",
|
|
364
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Table, {
|
|
365
|
-
className: "min-w-full table-fixed",
|
|
366
|
-
children: [
|
|
367
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("colgroup", { children: [
|
|
368
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("col", { className: "w-2/5 min-w-[240px]" }),
|
|
369
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("col", { className: "w-1/3 min-w-[100px]" }),
|
|
370
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("col", { className: "w-[26.67%] min-w-[100px]" })
|
|
371
|
-
] }),
|
|
372
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TableHeader, {
|
|
373
|
-
className: "bg-muted",
|
|
374
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.TableRow, {
|
|
375
|
-
className: "hover:bg-muted h-10",
|
|
376
|
-
children: [
|
|
377
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableColumn, {
|
|
378
|
-
label: t("product"),
|
|
379
|
-
sortable: false
|
|
380
|
-
}),
|
|
381
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableColumn, {
|
|
382
|
-
label: t("date"),
|
|
383
|
-
sortable: false
|
|
384
|
-
}),
|
|
385
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableColumn, {
|
|
386
|
-
label: t("total"),
|
|
387
|
-
sortable: false
|
|
388
|
-
})
|
|
389
|
-
]
|
|
390
|
-
})
|
|
391
|
-
}),
|
|
392
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TableBody, {
|
|
393
|
-
className: "bg-background",
|
|
394
|
-
children: isLoading ? Array(5).fill(0).map((_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.TableRow, { children: [
|
|
395
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TableCell, {
|
|
396
|
-
className: "px-3 py-4",
|
|
397
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
398
|
-
className: "flex items-center space-x-2",
|
|
399
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-9 w-9 rounded-md" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-4 w-32" })]
|
|
400
|
-
})
|
|
401
|
-
}),
|
|
402
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TableCell, {
|
|
403
|
-
className: "px-3 py-4",
|
|
404
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-4 w-24" })
|
|
405
|
-
}),
|
|
406
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TableCell, {
|
|
407
|
-
className: "px-3 py-4",
|
|
408
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-4 w-24" })
|
|
409
|
-
})
|
|
410
|
-
] }, `skeleton-${index}`)) : ordersList.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TableRow, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TableCell, {
|
|
411
|
-
colSpan: 3,
|
|
412
|
-
className: "text-muted-foreground px-3 py-8 text-center text-sm",
|
|
413
|
-
children: searchTerm ? t("no_matching_orders") : t("no_orders_found")
|
|
414
|
-
}) }) : ordersList.map((order) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.TableRow, {
|
|
415
|
-
className: "cursor-pointer",
|
|
416
|
-
onClick: () => onOrderClick(order),
|
|
417
|
-
children: [
|
|
418
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TableCell, {
|
|
419
|
-
className: "text-muted-foreground px-3 py-4 text-sm",
|
|
420
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
421
|
-
className: "flex max-w-[280px] flex-row items-center space-x-3",
|
|
422
|
-
children: [order.first_item?.image_url ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
423
|
-
src: order.first_item.image_url,
|
|
424
|
-
alt: t("no_image_available"),
|
|
425
|
-
width: 42,
|
|
426
|
-
height: 42,
|
|
427
|
-
className: "h-[42px] w-[42px] flex-shrink-0 rounded-md object-cover"
|
|
428
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "bg-border ml-1 h-9 w-9 flex-shrink-0 rounded-md" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
429
|
-
className: "flex min-w-0 flex-col space-y-1",
|
|
430
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
431
|
-
className: "flex items-center space-x-2",
|
|
432
|
-
children: [order.first_item?.title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
433
|
-
className: "text-foreground truncate text-sm font-medium",
|
|
434
|
-
children: order.first_item.title
|
|
435
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
436
|
-
className: "bg-muted w-full rounded-lg p-2",
|
|
437
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
438
|
-
className: "text-muted-foreground text-xs",
|
|
439
|
-
children: t("this_product_no_longer_exists")
|
|
440
|
-
})
|
|
441
|
-
}), order.subscription && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusBadge, {
|
|
442
|
-
color: "blue",
|
|
443
|
-
size: "xs",
|
|
444
|
-
className: "flex-shrink-0",
|
|
445
|
-
children: t("subscription")
|
|
446
|
-
})]
|
|
447
|
-
}), order.subscription && onSubscriptionClick && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
448
|
-
type: "button",
|
|
449
|
-
className: "text-foreground hover:text-foreground/80 text-left text-xs transition-colors duration-200 hover:underline",
|
|
450
|
-
onClick: (e) => {
|
|
451
|
-
e.stopPropagation();
|
|
452
|
-
onSubscriptionClick(order.subscription.subscription_token);
|
|
453
|
-
},
|
|
454
|
-
children: t("view_subscription")
|
|
455
|
-
})]
|
|
456
|
-
})]
|
|
457
|
-
})
|
|
458
|
-
}),
|
|
459
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TableCell, {
|
|
460
|
-
className: "text-muted-foreground px-3 py-4 text-sm whitespace-nowrap",
|
|
461
|
-
children: new Date(order.created_at).toLocaleDateString()
|
|
462
|
-
}),
|
|
463
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.TableCell, {
|
|
464
|
-
className: "text-foreground px-3 py-4 text-sm whitespace-nowrap",
|
|
465
|
-
children: formatOrderTotal(order)
|
|
466
|
-
})
|
|
467
|
-
]
|
|
468
|
-
}, order.id))
|
|
469
|
-
})
|
|
470
|
-
]
|
|
471
|
-
})
|
|
472
|
-
}),
|
|
473
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationFooter, {
|
|
474
|
-
currentPage,
|
|
475
|
-
totalPages,
|
|
476
|
-
pageSize,
|
|
477
|
-
totalItems,
|
|
478
|
-
cursorPaginationMode: true,
|
|
479
|
-
hasNextPage,
|
|
480
|
-
hasPrevPage,
|
|
481
|
-
onCursorNext: handleNextPage,
|
|
482
|
-
onCursorPrev: handlePrevPage
|
|
483
|
-
})
|
|
484
|
-
]
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
//#endregion
|
|
488
|
-
//#region ../../orders/ui/src/lib/format.ts
|
|
489
|
-
function startCase(str) {
|
|
490
|
-
if (!str) return "";
|
|
491
|
-
return str.replace(/_/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
|
|
492
|
-
}
|
|
493
|
-
function formatCurrency(symbol, value) {
|
|
494
|
-
return `${symbol}${Number(value).toFixed(2)}`;
|
|
495
|
-
}
|
|
496
|
-
//#endregion
|
|
497
|
-
//#region ../../orders/ui/src/components/order-status-badge.tsx
|
|
498
|
-
const statusColorMap = {
|
|
499
|
-
paid: "green",
|
|
500
|
-
fulfilled: "green",
|
|
501
|
-
delivered: "green",
|
|
502
|
-
complete: "green",
|
|
503
|
-
pending: "yellow",
|
|
504
|
-
unfulfilled: "yellow",
|
|
505
|
-
partially_fulfilled: "yellow",
|
|
506
|
-
processing: "yellow",
|
|
507
|
-
refunded: "red",
|
|
508
|
-
cancelled: "red",
|
|
509
|
-
failed: "red",
|
|
510
|
-
voided: "red"
|
|
511
|
-
};
|
|
512
|
-
function OrderStatusBadge({ status, className }) {
|
|
513
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusBadge, {
|
|
514
|
-
color: statusColorMap[status] ?? "gray",
|
|
515
|
-
dot: true,
|
|
516
|
-
size: "sm",
|
|
517
|
-
className,
|
|
518
|
-
children: startCase(status)
|
|
519
|
-
});
|
|
520
|
-
}
|
|
521
|
-
//#endregion
|
|
522
|
-
//#region ../../orders/ui/src/components/order-detail.tsx
|
|
523
|
-
function OrderDetailSkeleton() {
|
|
524
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
525
|
-
className: "flex flex-col lg:grid lg:grid-cols-8",
|
|
526
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
527
|
-
className: "bg-muted flex flex-col items-center px-8 lg:col-span-4",
|
|
528
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
529
|
-
className: "w-full max-w-lg py-6",
|
|
530
|
-
children: [
|
|
531
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "mb-4 h-6 w-48" }),
|
|
532
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
533
|
-
className: "space-y-4",
|
|
534
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
535
|
-
className: "flex items-center space-x-4",
|
|
536
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-24 w-24 rounded" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
537
|
-
className: "flex-1 space-y-2",
|
|
538
|
-
children: [
|
|
539
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-4 w-3/4" }),
|
|
540
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-4 w-1/2" }),
|
|
541
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-4 w-1/4" })
|
|
542
|
-
]
|
|
543
|
-
})]
|
|
544
|
-
})
|
|
545
|
-
}),
|
|
546
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
547
|
-
className: "mt-6 space-y-2",
|
|
548
|
-
children: [
|
|
549
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-4 w-full" }),
|
|
550
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-4 w-full" }),
|
|
551
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-4 w-full" }),
|
|
552
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-5 w-full" })
|
|
553
|
-
]
|
|
554
|
-
})
|
|
555
|
-
]
|
|
556
|
-
})
|
|
557
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
558
|
-
className: "bg-background px-8 pt-4 lg:col-span-4",
|
|
559
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
560
|
-
className: "mx-auto max-w-lg lg:mx-0 lg:mr-auto",
|
|
561
|
-
children: [
|
|
562
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "mb-4 h-10 w-full rounded" }),
|
|
563
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
564
|
-
className: "mt-6 space-y-4",
|
|
565
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-5 w-40" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-16 w-full rounded" })]
|
|
566
|
-
}),
|
|
567
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
568
|
-
className: "mt-6 space-y-4",
|
|
569
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-5 w-40" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-16 w-full rounded" })]
|
|
570
|
-
}),
|
|
571
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
572
|
-
className: "mt-6 space-y-4",
|
|
573
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-5 w-40" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Skeleton, { className: "h-16 w-full rounded" })]
|
|
574
|
-
})
|
|
575
|
-
]
|
|
576
|
-
})
|
|
577
|
-
})]
|
|
578
|
-
});
|
|
579
|
-
}
|
|
580
|
-
function OrderItemRow({ item }) {
|
|
581
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
582
|
-
className: "flex items-center space-x-4 py-4",
|
|
583
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
584
|
-
className: "relative shrink-0",
|
|
585
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
586
|
-
className: "bg-muted h-24 w-24 overflow-hidden rounded",
|
|
587
|
-
children: item.image_url ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
588
|
-
src: item.image_url,
|
|
589
|
-
alt: item.title,
|
|
590
|
-
width: 96,
|
|
591
|
-
height: 96,
|
|
592
|
-
className: "h-full w-full object-cover"
|
|
593
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
594
|
-
className: "text-muted-foreground flex h-full w-full items-center justify-center",
|
|
595
|
-
children: "No image"
|
|
596
|
-
})
|
|
597
|
-
}), item.quantity > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
598
|
-
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",
|
|
599
|
-
children: item.quantity
|
|
600
|
-
})]
|
|
601
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
602
|
-
className: "flex min-w-0 flex-1 flex-col space-y-0.5",
|
|
603
|
-
children: [
|
|
604
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
605
|
-
className: "text-foreground truncate text-sm font-medium",
|
|
606
|
-
title: item.title,
|
|
607
|
-
children: item.title
|
|
608
|
-
}),
|
|
609
|
-
item.ordered_variant.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
610
|
-
className: "text-muted-foreground text-sm",
|
|
611
|
-
children: item.ordered_variant.map((v) => v.value).join(" / ")
|
|
612
|
-
}),
|
|
613
|
-
item.sku && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
614
|
-
className: "text-muted-foreground text-xs",
|
|
615
|
-
children: ["SKU: ", item.sku]
|
|
616
|
-
}),
|
|
617
|
-
item.subscription && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusBadge, {
|
|
618
|
-
color: "blue",
|
|
619
|
-
size: "xs",
|
|
620
|
-
className: "mt-1 self-start",
|
|
621
|
-
children: "Subscription"
|
|
622
|
-
}),
|
|
623
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
624
|
-
className: "text-foreground text-sm font-medium",
|
|
625
|
-
children: item.display_total
|
|
626
|
-
}),
|
|
627
|
-
item.quantity > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
628
|
-
className: "text-muted-foreground text-xs",
|
|
629
|
-
children: [
|
|
630
|
-
item.display_price,
|
|
631
|
-
" x ",
|
|
632
|
-
item.quantity
|
|
633
|
-
]
|
|
634
|
-
})
|
|
635
|
-
]
|
|
636
|
-
})]
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
function OrderItemsSection({ order }) {
|
|
640
|
-
const visibleItems = order.items.filter((item) => item.display_to_customer !== false);
|
|
641
|
-
const sym = order.currency_symbol || "$";
|
|
642
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
|
|
643
|
-
className: "bg-muted flex w-full flex-col items-center px-8 lg:col-span-4",
|
|
644
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
645
|
-
className: "flex w-full max-w-lg flex-col",
|
|
646
|
-
children: [
|
|
647
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
648
|
-
className: "mt-4",
|
|
649
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h2", {
|
|
650
|
-
className: "text-foreground mb-2 text-lg font-medium",
|
|
651
|
-
children: [
|
|
652
|
-
"Items (",
|
|
653
|
-
visibleItems.length,
|
|
654
|
-
")"
|
|
655
|
-
]
|
|
656
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", { className: "border-border" })]
|
|
657
|
-
}),
|
|
658
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
659
|
-
className: "divide-border divide-y",
|
|
660
|
-
children: visibleItems.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OrderItemRow, { item }, item.id))
|
|
661
|
-
}),
|
|
662
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
663
|
-
className: "border-border mb-4 border-t pt-4",
|
|
664
|
-
children: [
|
|
665
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
666
|
-
className: "flex justify-between text-sm",
|
|
667
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
668
|
-
className: "text-muted-foreground font-medium",
|
|
669
|
-
children: "Subtotal"
|
|
670
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
671
|
-
className: "text-muted-foreground font-medium",
|
|
672
|
-
children: order.sub_total_in_currency
|
|
673
|
-
})]
|
|
674
|
-
}),
|
|
675
|
-
Number(order.discount) > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
676
|
-
className: "mt-2 flex justify-between text-sm",
|
|
677
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
678
|
-
className: "text-muted-foreground font-medium",
|
|
679
|
-
children: ["Discount", order.discount_codes?.length ? ` (${order.discount_codes.join(", ")})` : ""]
|
|
680
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
681
|
-
className: "text-muted-foreground font-medium",
|
|
682
|
-
children: ["-", order.discount_in_currency]
|
|
683
|
-
})]
|
|
684
|
-
}),
|
|
685
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
686
|
-
className: "mt-2 flex justify-between text-sm",
|
|
687
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
688
|
-
className: "text-muted-foreground font-medium",
|
|
689
|
-
children: "Shipping"
|
|
690
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
691
|
-
className: "text-muted-foreground font-medium",
|
|
692
|
-
children: order.free_shipping ? "Free" : order.shipping_total_for_display
|
|
693
|
-
})]
|
|
694
|
-
}),
|
|
695
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
696
|
-
className: "mt-2 flex justify-between text-sm",
|
|
697
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
698
|
-
className: "text-muted-foreground font-medium",
|
|
699
|
-
children: ["Tax", order.price_inclusive_of_tax && order.price_inclusive_tax_name ? ` (${order.price_inclusive_tax_name}, included)` : ""]
|
|
700
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
701
|
-
className: "text-muted-foreground font-medium",
|
|
702
|
-
children: order.tax_in_currency
|
|
703
|
-
})]
|
|
704
|
-
}),
|
|
705
|
-
order.points_applied != null && order.points_applied > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
706
|
-
className: "mt-2 flex justify-between text-sm",
|
|
707
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
708
|
-
className: "text-muted-foreground font-medium",
|
|
709
|
-
children: ["Points Applied", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
710
|
-
className: "text-muted-foreground ml-1 text-xs font-normal",
|
|
711
|
-
children: [
|
|
712
|
-
"(",
|
|
713
|
-
order.points_applied.toLocaleString(),
|
|
714
|
-
" ",
|
|
715
|
-
order.points_applied === 1 ? "pt" : "pts",
|
|
716
|
-
")"
|
|
717
|
-
]
|
|
718
|
-
})]
|
|
719
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
720
|
-
className: "text-muted-foreground font-medium",
|
|
721
|
-
children: `-${formatCurrency(sym, order.points_applied_amount ?? 0)}`
|
|
722
|
-
})]
|
|
723
|
-
}),
|
|
724
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
725
|
-
className: "mt-4 flex items-center justify-between text-base font-medium",
|
|
726
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
727
|
-
className: "text-muted-foreground text-sm font-medium",
|
|
728
|
-
children: "Total"
|
|
729
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
730
|
-
className: "text-foreground text-base font-bold",
|
|
731
|
-
children: order.order_total_after_points_redemption != null ? formatCurrency(sym, order.order_total_after_points_redemption) : order.total_in_currency
|
|
732
|
-
})]
|
|
733
|
-
})
|
|
734
|
-
]
|
|
735
|
-
})
|
|
736
|
-
]
|
|
737
|
-
})
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
function OrderDetailsSection({ order }) {
|
|
741
|
-
const paymentDetails = order.payment_details;
|
|
742
|
-
const cardDetails = paymentDetails?.details;
|
|
743
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
744
|
-
className: "bg-background px-8 pt-4 lg:col-span-4",
|
|
745
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
746
|
-
className: "mx-auto max-w-lg lg:mx-0 lg:mr-auto",
|
|
747
|
-
children: [
|
|
748
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
749
|
-
className: "border-border mb-6 border-b pb-6",
|
|
750
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
751
|
-
className: "flex flex-wrap items-center gap-3",
|
|
752
|
-
children: [
|
|
753
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
754
|
-
className: "flex items-center gap-2",
|
|
755
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
756
|
-
className: "text-muted-foreground text-sm",
|
|
757
|
-
children: "Payment:"
|
|
758
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OrderStatusBadge, { status: order.payment_status })]
|
|
759
|
-
}),
|
|
760
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
761
|
-
className: "flex items-center gap-2",
|
|
762
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
763
|
-
className: "text-muted-foreground text-sm",
|
|
764
|
-
children: "Fulfillment:"
|
|
765
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OrderStatusBadge, { status: order.fulfillment_status })]
|
|
766
|
-
}),
|
|
767
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
768
|
-
className: "flex items-center gap-2",
|
|
769
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
770
|
-
className: "text-muted-foreground text-sm",
|
|
771
|
-
children: "Delivery:"
|
|
772
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OrderStatusBadge, { status: order.delivery_status })]
|
|
773
|
-
})
|
|
774
|
-
]
|
|
775
|
-
})
|
|
776
|
-
}),
|
|
777
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
778
|
-
className: "border-border mb-6 border-b pb-6",
|
|
779
|
-
children: [
|
|
780
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
781
|
-
className: "text-foreground mb-3 text-sm/6 font-semibold",
|
|
782
|
-
children: "Order Info"
|
|
783
|
-
}),
|
|
784
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
785
|
-
className: "divide-border flex divide-x",
|
|
786
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
787
|
-
className: "flex-1 pr-4",
|
|
788
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
789
|
-
className: "text-muted-foreground text-sm",
|
|
790
|
-
children: "Order Number"
|
|
791
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
792
|
-
className: "text-foreground font-medium",
|
|
793
|
-
children: order.order_number
|
|
794
|
-
})]
|
|
795
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
796
|
-
className: "flex-1 pl-4 text-right",
|
|
797
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
798
|
-
className: "text-muted-foreground text-sm",
|
|
799
|
-
children: "Date"
|
|
800
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
801
|
-
className: "text-foreground font-medium",
|
|
802
|
-
children: new Date(order.created_at).toLocaleDateString("en-US", {
|
|
803
|
-
year: "numeric",
|
|
804
|
-
month: "short",
|
|
805
|
-
day: "numeric"
|
|
806
|
-
})
|
|
807
|
-
})]
|
|
808
|
-
})]
|
|
809
|
-
}),
|
|
810
|
-
order.email && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
811
|
-
className: "mt-3",
|
|
812
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
813
|
-
className: "text-muted-foreground text-sm",
|
|
814
|
-
children: "Email"
|
|
815
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
816
|
-
className: "text-foreground text-sm font-medium",
|
|
817
|
-
children: order.email
|
|
818
|
-
})]
|
|
819
|
-
})
|
|
820
|
-
]
|
|
821
|
-
}),
|
|
822
|
-
paymentDetails && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
823
|
-
className: "border-border mb-6 border-b pb-4",
|
|
824
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
825
|
-
className: "text-muted-foreground mb-1 text-sm",
|
|
826
|
-
children: "Payment Method"
|
|
827
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
828
|
-
className: "text-foreground flex items-center gap-2 text-sm",
|
|
829
|
-
children: [cardDetails?.logo_url ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
830
|
-
src: cardDetails.logo_url,
|
|
831
|
-
alt: cardDetails.card_type ?? "Card",
|
|
832
|
-
className: "h-6 w-9 object-contain",
|
|
833
|
-
width: 35,
|
|
834
|
-
height: 24
|
|
835
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
836
|
-
className: "bg-muted text-muted-foreground flex h-6 w-9 items-center justify-center rounded text-xs",
|
|
837
|
-
children: (paymentDetails.payment_title || paymentDetails.payment_type || "P").charAt(0)
|
|
838
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
839
|
-
className: "font-medium",
|
|
840
|
-
children: [cardDetails?.card_type ? startCase(cardDetails.card_type) : paymentDetails.payment_title || startCase(paymentDetails.payment_type), cardDetails?.last_four ? ` ending in ${cardDetails.last_four}` : ""]
|
|
841
|
-
})]
|
|
842
|
-
})]
|
|
843
|
-
}),
|
|
844
|
-
order.ship_to && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
845
|
-
className: "border-border mb-6 border-b pb-4",
|
|
846
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
847
|
-
className: "text-muted-foreground mb-1 text-sm",
|
|
848
|
-
children: "Shipping Address"
|
|
849
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
850
|
-
className: "text-foreground flex items-start gap-2 text-sm",
|
|
851
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Truck, { className: "text-muted-foreground mt-0.5 mr-1 h-4 w-4 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
852
|
-
className: "flex flex-col",
|
|
853
|
-
children: [
|
|
854
|
-
order.ship_to.name && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
855
|
-
className: "font-medium",
|
|
856
|
-
children: order.ship_to.name
|
|
857
|
-
}),
|
|
858
|
-
order.ship_to.address1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: order.ship_to.address1 }),
|
|
859
|
-
(order.ship_to.city || order.ship_to.state || order.ship_to.postal_code) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: [[order.ship_to.city, order.ship_to.state].filter(Boolean).join(", "), order.ship_to.postal_code].filter(Boolean).join(" ") }),
|
|
860
|
-
order.ship_to.country_code && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: order.ship_to.country_code })
|
|
861
|
-
]
|
|
862
|
-
})]
|
|
863
|
-
})]
|
|
864
|
-
}),
|
|
865
|
-
order.bill_to && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
866
|
-
className: "border-border mb-6 border-b pb-4",
|
|
867
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
868
|
-
className: "text-muted-foreground mb-1 text-sm",
|
|
869
|
-
children: "Billing Address"
|
|
870
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
871
|
-
className: "text-foreground text-sm",
|
|
872
|
-
children: [
|
|
873
|
-
order.bill_to.name && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
874
|
-
className: "font-medium",
|
|
875
|
-
children: order.bill_to.name
|
|
876
|
-
}),
|
|
877
|
-
order.bill_to.address1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: order.bill_to.address1 }),
|
|
878
|
-
(order.bill_to.city || order.bill_to.state || order.bill_to.postal_code) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: [[order.bill_to.city, order.bill_to.state].filter(Boolean).join(", "), order.bill_to.postal_code].filter(Boolean).join(" ") }),
|
|
879
|
-
order.bill_to.country_code && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: order.bill_to.country_code })
|
|
880
|
-
]
|
|
881
|
-
})]
|
|
882
|
-
}),
|
|
883
|
-
order.shipping_method && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
884
|
-
className: "border-border mb-6 border-b pb-4",
|
|
885
|
-
children: [
|
|
886
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
887
|
-
className: "text-muted-foreground mb-1 text-sm",
|
|
888
|
-
children: "Shipping Method"
|
|
889
|
-
}),
|
|
890
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
891
|
-
className: "text-foreground text-sm font-medium",
|
|
892
|
-
children: order.shipping_method.title
|
|
893
|
-
}),
|
|
894
|
-
order.shipping_method.delivery_time_estimate && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
895
|
-
className: "text-muted-foreground mt-1 text-xs",
|
|
896
|
-
children: ["Est. ", order.shipping_method.delivery_time_estimate]
|
|
897
|
-
})
|
|
898
|
-
]
|
|
899
|
-
})
|
|
900
|
-
]
|
|
901
|
-
})
|
|
902
|
-
});
|
|
903
|
-
}
|
|
904
|
-
function OrderDetail({ token, onNotFound, onError }) {
|
|
905
|
-
const { data, isLoading, error } = useOrder(token);
|
|
906
|
-
const order = data?.order;
|
|
907
|
-
(0, react.useEffect)(() => {
|
|
908
|
-
if (!isLoading && error) onError?.(error);
|
|
909
|
-
}, [
|
|
910
|
-
isLoading,
|
|
911
|
-
error,
|
|
912
|
-
onError
|
|
913
|
-
]);
|
|
914
|
-
(0, react.useEffect)(() => {
|
|
915
|
-
if (!isLoading && !error && !order) onNotFound?.();
|
|
916
|
-
}, [
|
|
917
|
-
isLoading,
|
|
918
|
-
error,
|
|
919
|
-
order,
|
|
920
|
-
onNotFound
|
|
921
|
-
]);
|
|
922
|
-
if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OrderDetailSkeleton, {});
|
|
923
|
-
if (!order) return null;
|
|
924
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
925
|
-
className: "flex flex-col lg:grid lg:grid-cols-8",
|
|
926
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(OrderItemsSection, { order }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OrderDetailsSection, { order })]
|
|
927
|
-
});
|
|
928
|
-
}
|
|
929
|
-
//#endregion
|
|
930
|
-
Object.defineProperty(exports, "OrderDetail", {
|
|
931
|
-
enumerable: true,
|
|
932
|
-
get: function() {
|
|
933
|
-
return OrderDetail;
|
|
934
|
-
}
|
|
935
|
-
});
|
|
936
|
-
Object.defineProperty(exports, "OrdersCoreProvider", {
|
|
937
|
-
enumerable: true,
|
|
938
|
-
get: function() {
|
|
939
|
-
return OrdersCoreProvider;
|
|
940
|
-
}
|
|
941
|
-
});
|
|
942
|
-
Object.defineProperty(exports, "OrdersList", {
|
|
943
|
-
enumerable: true,
|
|
944
|
-
get: function() {
|
|
945
|
-
return OrdersList;
|
|
946
|
-
}
|
|
947
|
-
});
|
|
948
|
-
Object.defineProperty(exports, "PaginationFooter", {
|
|
949
|
-
enumerable: true,
|
|
950
|
-
get: function() {
|
|
951
|
-
return PaginationFooter;
|
|
952
|
-
}
|
|
953
|
-
});
|
|
954
|
-
Object.defineProperty(exports, "TableColumn", {
|
|
955
|
-
enumerable: true,
|
|
956
|
-
get: function() {
|
|
957
|
-
return TableColumn;
|
|
958
|
-
}
|
|
959
|
-
});
|
|
960
|
-
|
|
961
|
-
//# sourceMappingURL=order-detail-DHXdE4Cl.cjs.map
|