@nextblock-cms/ecom 0.19.0 → 0.19.2
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/index.cjs.js +1 -1
- package/index.es.js +26 -25
- package/lib/CurrencyProvider.cjs.js +1 -1
- package/lib/CurrencyProvider.es.js +41 -45
- package/lib/PaymentReadinessProvider.cjs.js +1 -1
- package/lib/PaymentReadinessProvider.es.js +15 -19
- package/lib/cart-store.cjs.js +1 -1
- package/lib/cart-store.d.ts +4 -0
- package/lib/cart-store.es.js +77 -69
- package/lib/components/AccountNavigationMenu.cjs.js +1 -1
- package/lib/components/AccountNavigationMenu.es.js +44 -62
- package/lib/components/AddToCartButton.cjs.js +1 -1
- package/lib/components/AddToCartButton.es.js +50 -78
- package/lib/components/Cart.cjs.js +1 -1
- package/lib/components/Cart.es.js +154 -381
- package/lib/components/CartDrawer.cjs.js +1 -1
- package/lib/components/CartDrawer.es.js +143 -297
- package/lib/components/CartIcon.cjs.js +1 -1
- package/lib/components/CartIcon.es.js +21 -47
- package/lib/components/Checkout.cjs.js +1 -1
- package/lib/components/Checkout.es.js +814 -1614
- package/lib/components/CouponForm.cjs.js +1 -1
- package/lib/components/CouponForm.es.js +104 -155
- package/lib/components/CurrencySwitcher.cjs.js +1 -1
- package/lib/components/CurrencySwitcher.es.js +14 -33
- package/lib/components/CustomerProfileForm.cjs.js +1 -1
- package/lib/components/CustomerProfileForm.es.js +264 -672
- package/lib/components/FeaturedProduct.cjs.js +1 -1
- package/lib/components/FeaturedProduct.es.js +46 -125
- package/lib/components/FreemiusLicensePanel.cjs.js +1 -1
- package/lib/components/FreemiusLicensePanel.es.js +45 -125
- package/lib/components/InvoiceDocument.cjs.js +1 -1
- package/lib/components/InvoiceDocument.es.js +148 -487
- package/lib/components/InvoiceViewerShell.cjs.js +2 -2
- package/lib/components/InvoiceViewerShell.d.ts +4 -1
- package/lib/components/InvoiceViewerShell.es.js +59 -142
- package/lib/components/ProductCard.cjs.js +1 -1
- package/lib/components/ProductCard.d.ts +3 -1
- package/lib/components/ProductCard.es.js +128 -242
- package/lib/components/ProductDetailsLayout.cjs.js +1 -1
- package/lib/components/ProductDetailsLayout.es.js +311 -652
- package/lib/components/ProductGallery.cjs.js +1 -1
- package/lib/components/ProductGallery.d.ts +2 -0
- package/lib/components/ProductGallery.es.js +37 -66
- package/lib/components/ProductGrid.cjs.js +1 -1
- package/lib/components/ProductGrid.es.js +23 -32
- package/lib/components/ShippingEstimator.cjs.js +1 -1
- package/lib/components/ShippingEstimator.es.js +118 -231
- package/lib/components/SimpleTiptapRenderer.cjs.js +1 -1
- package/lib/components/SimpleTiptapRenderer.es.js +111 -294
- package/lib/components/SubscriptionSelector.cjs.js +1 -1
- package/lib/components/SubscriptionSelector.es.js +120 -181
- package/lib/invoice.cjs.js +1 -1
- package/lib/invoice.d.ts +1 -1
- package/lib/invoice.es.js +6 -5
- package/lib/pages/cms/coupons/CouponEditorForm.cjs.js +1 -1
- package/lib/pages/cms/coupons/CouponEditorForm.es.js +115 -375
- package/lib/pages/cms/coupons/CouponsPage.cjs.js +2 -2
- package/lib/pages/cms/coupons/CouponsPage.es.js +116 -368
- package/lib/pages/cms/coupons/CreateCouponDialog.cjs.js +1 -1
- package/lib/pages/cms/coupons/CreateCouponDialog.es.js +26 -62
- package/lib/pages/cms/coupons/EditCouponPage.cjs.js +1 -1
- package/lib/pages/cms/coupons/EditCouponPage.es.js +35 -71
- package/lib/pages/cms/coupons/ProductScopePicker.cjs.js +1 -1
- package/lib/pages/cms/coupons/ProductScopePicker.es.js +72 -167
- package/lib/pages/cms/orders/ExportReportsDialog.cjs.js +1 -1
- package/lib/pages/cms/orders/ExportReportsDialog.es.js +87 -247
- package/lib/pages/cms/orders/OrderDetailPage.cjs.js +1 -1
- package/lib/pages/cms/orders/OrderDetailPage.es.js +95 -283
- package/lib/pages/cms/orders/OrderPrintButton.cjs.js +1 -1
- package/lib/pages/cms/orders/OrderPrintButton.es.js +9 -21
- package/lib/pages/cms/orders/OrderStatusForm.cjs.js +1 -1
- package/lib/pages/cms/orders/OrderStatusForm.es.js +46 -106
- package/lib/pages/cms/orders/OrdersPage.cjs.js +1 -1
- package/lib/pages/cms/orders/OrdersPage.es.js +78 -257
- package/lib/pages/cms/payments/PaymentsClient.cjs.js +1 -1
- package/lib/pages/cms/payments/PaymentsClient.es.js +192 -580
- package/lib/pages/cms/payments/PaymentsPage.cjs.js +1 -1
- package/lib/pages/cms/payments/PaymentsPage.es.js +14 -22
- package/lib/pages/cms/products/ProductsPage.cjs.js +1 -1
- package/lib/pages/cms/products/ProductsPage.es.js +47 -87
- package/lib/pages/cms/products/_id_/edit/EditProductPage.cjs.js +1 -1
- package/lib/pages/cms/products/_id_/edit/EditProductPage.es.js +97 -177
- package/lib/pages/cms/products/attributes/AttributeManagementPage.cjs.js +1 -1
- package/lib/pages/cms/products/attributes/AttributeManagementPage.es.js +40 -84
- package/lib/pages/cms/products/attributes/components/AttributeManager.cjs.js +1 -1
- package/lib/pages/cms/products/attributes/components/AttributeManager.es.js +192 -455
- package/lib/pages/cms/products/categories/CategoryManagementPage.cjs.js +1 -1
- package/lib/pages/cms/products/categories/CategoryManagementPage.es.js +28 -72
- package/lib/pages/cms/products/categories/components/CategoryManager.cjs.js +1 -1
- package/lib/pages/cms/products/categories/components/CategoryManager.es.js +183 -490
- package/lib/pages/cms/products/components/CopyProductFromLanguage.cjs.js +1 -1
- package/lib/pages/cms/products/components/CopyProductFromLanguage.es.js +69 -177
- package/lib/pages/cms/products/components/CurrencyPriceFields.cjs.js +1 -1
- package/lib/pages/cms/products/components/CurrencyPriceFields.es.js +102 -213
- package/lib/pages/cms/products/components/DeleteProductButton.cjs.js +1 -1
- package/lib/pages/cms/products/components/DeleteProductButton.es.js +25 -45
- package/lib/pages/cms/products/components/FreemiusPricingDashboard.cjs.js +1 -1
- package/lib/pages/cms/products/components/FreemiusPricingDashboard.es.js +58 -202
- package/lib/pages/cms/products/components/ProductCategorySelector.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductCategorySelector.es.js +89 -235
- package/lib/pages/cms/products/components/ProductForm.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductForm.es.js +526 -1110
- package/lib/pages/cms/products/components/ProductMediaManager.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductMediaManager.es.js +63 -154
- package/lib/pages/cms/products/components/ProductsBulkTable.cjs.js +1 -1
- package/lib/pages/cms/products/components/ProductsBulkTable.es.js +213 -544
- package/lib/pages/cms/products/components/SaleScheduleFields.cjs.js +1 -1
- package/lib/pages/cms/products/components/SaleScheduleFields.es.js +91 -207
- package/lib/pages/cms/products/components/SyncFreemiusButton.cjs.js +1 -1
- package/lib/pages/cms/products/components/SyncFreemiusButton.es.js +16 -28
- package/lib/pages/cms/products/components/SyncFreemiusPricingButton.cjs.js +2 -2
- package/lib/pages/cms/products/components/SyncFreemiusPricingButton.es.js +25 -37
- package/lib/pages/cms/products/components/VariationsEditor.cjs.js +1 -1
- package/lib/pages/cms/products/components/VariationsEditor.es.js +261 -492
- package/lib/pages/cms/products/inventory/InventoryPage.cjs.js +1 -1
- package/lib/pages/cms/products/inventory/InventoryPage.es.js +12 -32
- package/lib/pages/cms/products/inventory/InventoryTableClient.cjs.js +2 -2
- package/lib/pages/cms/products/inventory/InventoryTableClient.es.js +145 -365
- package/lib/pages/cms/products/new/NewProductPage.cjs.js +1 -1
- package/lib/pages/cms/products/new/NewProductPage.es.js +30 -42
- package/lib/pages/cms/shipping/ShippingPage.cjs.js +2 -2
- package/lib/pages/cms/shipping/ShippingPage.es.js +155 -507
- package/lib/pages/cms/shipping/components/RateForm.cjs.js +1 -1
- package/lib/pages/cms/shipping/components/RateForm.es.js +334 -717
- package/lib/pages/cms/shipping/components/ZoneForm.cjs.js +1 -1
- package/lib/pages/cms/shipping/components/ZoneForm.es.js +158 -392
- package/lib/pages/cms/taxes/TaxesPage.cjs.js +1 -1
- package/lib/pages/cms/taxes/TaxesPage.es.js +119 -447
- package/lib/pages/cms/taxes/components/TaxRateForm.cjs.js +1 -1
- package/lib/pages/cms/taxes/components/TaxRateForm.es.js +52 -156
- package/lib/product-context.cjs.js +1 -1
- package/lib/product-context.es.js +10 -14
- package/lib/trials.cjs.js +1 -1
- package/lib/trials.d.ts +10 -3
- package/lib/trials.es.js +28 -21
- package/lib/types.d.ts +2 -0
- package/lib/use-price-formatter.cjs.js +1 -0
- package/lib/use-price-formatter.d.ts +11 -0
- package/lib/use-price-formatter.es.js +13 -0
- package/lib/variation-utils.cjs.js +1 -1
- package/lib/variation-utils.d.ts +10 -0
- package/lib/variation-utils.es.js +139 -123
- package/package.json +4 -4
|
@@ -1,303 +1,149 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import { Sheet as
|
|
4
|
-
import { Badge as
|
|
5
|
-
import { Button as
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { jsx as t, jsxs as r, Fragment as x } from "react/jsx-runtime";
|
|
3
|
+
import { Sheet as C, SheetContent as k, SheetHeader as j, SheetTitle as q, SheetDescription as S } from "@nextblock-cms/ui/sheet";
|
|
4
|
+
import { Badge as F } from "@nextblock-cms/ui/badge";
|
|
5
|
+
import { Button as d } from "@nextblock-cms/ui/button";
|
|
6
|
+
import b from "next/link";
|
|
7
|
+
import { useRef as D } from "react";
|
|
8
|
+
import { Minus as P, Plus as R, Trash2 as A } from "lucide-react";
|
|
9
|
+
import { useCartSubtotal as O, getCartItemActivePrice as Q } from "../cart-store.es.js";
|
|
9
10
|
import { useCart as T } from "../use-cart.es.js";
|
|
10
|
-
import { useTranslations as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
r.image_url ? /* @__PURE__ */ e("div", { className: "relative aspect-square h-20 w-20 min-w-fit overflow-hidden rounded border bg-neutral-100", children: /* @__PURE__ */ e(
|
|
54
|
-
"img",
|
|
55
|
-
{
|
|
56
|
-
src: r.image_url,
|
|
57
|
-
alt: r.title,
|
|
58
|
-
className: "h-full w-full object-cover"
|
|
59
|
-
},
|
|
60
|
-
void 0,
|
|
61
|
-
!1,
|
|
62
|
-
{
|
|
63
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
64
|
-
lineNumber: 81,
|
|
65
|
-
columnNumber: 23
|
|
66
|
-
},
|
|
67
|
-
void 0
|
|
68
|
-
) }, void 0, !1, {
|
|
69
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
70
|
-
lineNumber: 80,
|
|
71
|
-
columnNumber: 21
|
|
72
|
-
}, void 0) : /* @__PURE__ */ e("div", { className: "flex h-20 w-20 items-center justify-center rounded bg-secondary", children: /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: s("ecommerce.no_image") }, void 0, !1, {
|
|
73
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
74
|
-
lineNumber: 89,
|
|
75
|
-
columnNumber: 23
|
|
76
|
-
}, void 0) }, void 0, !1, {
|
|
77
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
78
|
-
lineNumber: 88,
|
|
79
|
-
columnNumber: 21
|
|
80
|
-
}, void 0),
|
|
81
|
-
/* @__PURE__ */ e("div", { className: "flex flex-1 flex-col justify-between", children: [
|
|
82
|
-
/* @__PURE__ */ e("div", { className: "flex justify-between gap-2", children: [
|
|
83
|
-
/* @__PURE__ */ e("div", { children: [
|
|
84
|
-
/* @__PURE__ */ e("span", { className: "line-clamp-2 text-sm font-medium leading-tight", children: r.title }, void 0, !1, {
|
|
85
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
86
|
-
lineNumber: 96,
|
|
87
|
-
columnNumber: 25
|
|
88
|
-
}, void 0),
|
|
89
|
-
r.variant_label && /* @__PURE__ */ e("div", { className: "mt-1 text-xs text-muted-foreground", children: r.variant_label }, void 0, !1, {
|
|
90
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
91
|
-
lineNumber: 100,
|
|
92
|
-
columnNumber: 27
|
|
93
|
-
}, void 0),
|
|
94
|
-
c && /* @__PURE__ */ e("div", { className: "mt-1 text-xs font-medium text-emerald-700", children: [
|
|
95
|
-
c.label,
|
|
96
|
-
" - ",
|
|
97
|
-
c.paymentRequirementLabel
|
|
98
|
-
] }, void 0, !0, {
|
|
99
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
100
|
-
lineNumber: 105,
|
|
101
|
-
columnNumber: 27
|
|
102
|
-
}, void 0)
|
|
103
|
-
] }, void 0, !0, {
|
|
104
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
105
|
-
lineNumber: 95,
|
|
106
|
-
columnNumber: 23
|
|
107
|
-
}, void 0),
|
|
108
|
-
/* @__PURE__ */ e("span", { className: "text-sm font-semibold", children: [
|
|
109
|
-
n.sale_price && /* @__PURE__ */ e("span", { className: "mr-1.5 text-xs font-normal text-muted-foreground line-through", children: a(n.price, t) }, void 0, !1, {
|
|
110
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
111
|
-
lineNumber: 112,
|
|
112
|
-
columnNumber: 27
|
|
113
|
-
}, void 0),
|
|
114
|
-
a(n.sale_price ?? n.price, t)
|
|
115
|
-
] }, void 0, !0, {
|
|
116
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
117
|
-
lineNumber: 110,
|
|
118
|
-
columnNumber: 23
|
|
119
|
-
}, void 0)
|
|
120
|
-
] }, void 0, !0, {
|
|
121
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
122
|
-
lineNumber: 94,
|
|
123
|
-
columnNumber: 21
|
|
124
|
-
}, void 0),
|
|
125
|
-
/* @__PURE__ */ e("div", { className: "flex items-center justify-between text-sm", children: [
|
|
126
|
-
b(r) ? /* @__PURE__ */ e(U, { variant: "secondary", className: "font-normal text-xs", children: "1 (License)" }, void 0, !1, {
|
|
127
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
128
|
-
lineNumber: 122,
|
|
129
|
-
columnNumber: 25
|
|
130
|
-
}, void 0) : /* @__PURE__ */ e("div", { className: "flex items-center rounded-md border text-xs", children: [
|
|
131
|
-
/* @__PURE__ */ e(
|
|
132
|
-
"button",
|
|
133
|
-
{
|
|
134
|
-
onClick: () => N(r.id, r.quantity - 1),
|
|
135
|
-
className: "flex h-7 w-7 items-center justify-center border-r",
|
|
136
|
-
type: "button",
|
|
137
|
-
children: /* @__PURE__ */ e(g, { className: "h-3 w-3" }, void 0, !1, {
|
|
138
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
139
|
-
lineNumber: 132,
|
|
140
|
-
columnNumber: 29
|
|
141
|
-
}, void 0)
|
|
142
|
-
},
|
|
143
|
-
void 0,
|
|
144
|
-
!1,
|
|
145
|
-
{
|
|
146
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
147
|
-
lineNumber: 127,
|
|
148
|
-
columnNumber: 27
|
|
149
|
-
},
|
|
150
|
-
void 0
|
|
151
|
-
),
|
|
152
|
-
/* @__PURE__ */ e("span", { className: "flex h-7 w-8 items-center justify-center", children: r.quantity }, void 0, !1, {
|
|
153
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
154
|
-
lineNumber: 134,
|
|
155
|
-
columnNumber: 27
|
|
156
|
-
}, void 0),
|
|
157
|
-
/* @__PURE__ */ e(
|
|
158
|
-
"button",
|
|
159
|
-
{
|
|
160
|
-
onClick: () => N(r.id, r.quantity + 1),
|
|
161
|
-
className: "flex h-7 w-7 items-center justify-center border-l",
|
|
162
|
-
type: "button",
|
|
163
|
-
disabled: typeof r.stock == "number" && o >= r.stock,
|
|
164
|
-
children: /* @__PURE__ */ e(_, { className: "h-3 w-3" }, void 0, !1, {
|
|
165
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
166
|
-
lineNumber: 146,
|
|
167
|
-
columnNumber: 29
|
|
168
|
-
}, void 0)
|
|
169
|
-
},
|
|
170
|
-
void 0,
|
|
171
|
-
!1,
|
|
172
|
-
{
|
|
173
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
174
|
-
lineNumber: 137,
|
|
175
|
-
columnNumber: 27
|
|
176
|
-
},
|
|
177
|
-
void 0
|
|
178
|
-
)
|
|
179
|
-
] }, void 0, !0, {
|
|
180
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
181
|
-
lineNumber: 126,
|
|
182
|
-
columnNumber: 25
|
|
183
|
-
}, void 0),
|
|
184
|
-
/* @__PURE__ */ e(
|
|
185
|
-
"button",
|
|
11
|
+
import { useTranslations as I } from "@nextblock-cms/utils";
|
|
12
|
+
import { usePriceFormatter as $ } from "../use-price-formatter.es.js";
|
|
13
|
+
import { isDigitalItem as g } from "../types.es.js";
|
|
14
|
+
import { useCurrency as B } from "../CurrencyProvider.es.js";
|
|
15
|
+
import { getTrialSummary as L } from "../trials.es.js";
|
|
16
|
+
import { CouponForm as z } from "./CouponForm.es.js";
|
|
17
|
+
const ne = () => {
|
|
18
|
+
const u = $(), f = T((e) => e), v = O(), { t: n } = I(), h = D(null), l = (e, s, c) => {
|
|
19
|
+
const a = n(e, c);
|
|
20
|
+
return a === e ? s : a;
|
|
21
|
+
}, { activeCurrencyCode: o, currencies: y } = B();
|
|
22
|
+
if (!f) return null;
|
|
23
|
+
const { isOpen: N, setIsOpen: m, items: i, updateQuantity: p, removeItem: w } = f, _ = (e) => i.reduce((s, c) => g(c) || c.sku !== e ? s : s + c.quantity, 0);
|
|
24
|
+
return /* @__PURE__ */ t(C, { open: N, onOpenChange: m, children: /* @__PURE__ */ r(
|
|
25
|
+
k,
|
|
26
|
+
{
|
|
27
|
+
className: "flex w-full flex-col pr-0 sm:max-w-lg",
|
|
28
|
+
onOpenAutoFocus: () => {
|
|
29
|
+
h.current = document.activeElement;
|
|
30
|
+
},
|
|
31
|
+
onCloseAutoFocus: (e) => {
|
|
32
|
+
e.preventDefault(), h.current?.focus();
|
|
33
|
+
},
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ r(j, { className: "px-1 text-left", children: [
|
|
36
|
+
/* @__PURE__ */ r(q, { children: [
|
|
37
|
+
n("ecommerce.shopping_cart"),
|
|
38
|
+
" (",
|
|
39
|
+
i.length,
|
|
40
|
+
")"
|
|
41
|
+
] }),
|
|
42
|
+
/* @__PURE__ */ t(S, { className: "sr-only", children: n("ecommerce.shopping_cart") })
|
|
43
|
+
] }),
|
|
44
|
+
i.length > 0 ? /* @__PURE__ */ t("div", { className: "flex flex-1 flex-col gap-5 overflow-y-auto overscroll-contain p-1 pr-6 pt-4", children: i.map((e) => {
|
|
45
|
+
const s = _(e.sku);
|
|
46
|
+
return /* @__PURE__ */ t("div", { className: "flex gap-4", children: (() => {
|
|
47
|
+
const c = Q(e, {
|
|
48
|
+
currencyCode: o,
|
|
49
|
+
currencies: y
|
|
50
|
+
}), a = L(e, n);
|
|
51
|
+
return /* @__PURE__ */ r(x, { children: [
|
|
52
|
+
e.image_url ? /* @__PURE__ */ t("div", { className: "relative aspect-square h-20 w-20 min-w-fit overflow-hidden rounded border bg-neutral-100", children: /* @__PURE__ */ t(
|
|
53
|
+
"img",
|
|
186
54
|
{
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
lineNumber: 188,
|
|
279
|
-
columnNumber: 14
|
|
280
|
-
}, void 0),
|
|
281
|
-
/* @__PURE__ */ e(m, { className: "w-full", onClick: h, children: s("ecommerce.ready_to_checkout") }, void 0, !1, {
|
|
282
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
283
|
-
lineNumber: 191,
|
|
284
|
-
columnNumber: 14
|
|
285
|
-
}, void 0)
|
|
286
|
-
] }, void 0, !0, {
|
|
287
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
288
|
-
lineNumber: 177,
|
|
289
|
-
columnNumber: 11
|
|
290
|
-
}, void 0)
|
|
291
|
-
] }, void 0, !0, {
|
|
292
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
293
|
-
lineNumber: 55,
|
|
294
|
-
columnNumber: 7
|
|
295
|
-
}, void 0) }, void 0, !1, {
|
|
296
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartDrawer.tsx",
|
|
297
|
-
lineNumber: 54,
|
|
298
|
-
columnNumber: 5
|
|
299
|
-
}, void 0);
|
|
55
|
+
src: e.image_url,
|
|
56
|
+
alt: "",
|
|
57
|
+
width: 80,
|
|
58
|
+
height: 80,
|
|
59
|
+
loading: "lazy",
|
|
60
|
+
decoding: "async",
|
|
61
|
+
className: "h-full w-full object-cover"
|
|
62
|
+
}
|
|
63
|
+
) }) : /* @__PURE__ */ t("div", { className: "flex h-20 w-20 items-center justify-center rounded bg-secondary", children: /* @__PURE__ */ t("span", { className: "text-xs text-muted-foreground", children: n("ecommerce.no_image") }) }),
|
|
64
|
+
/* @__PURE__ */ r("div", { className: "flex min-w-0 flex-1 flex-col justify-between", children: [
|
|
65
|
+
/* @__PURE__ */ r("div", { className: "flex justify-between gap-2", children: [
|
|
66
|
+
/* @__PURE__ */ r("div", { className: "min-w-0", children: [
|
|
67
|
+
/* @__PURE__ */ t("span", { className: "line-clamp-2 text-sm font-medium leading-tight", children: e.title }),
|
|
68
|
+
e.variant_label && /* @__PURE__ */ t("div", { className: "mt-1 text-xs text-muted-foreground", children: e.variant_label }),
|
|
69
|
+
a && /* @__PURE__ */ r("div", { className: "mt-1 text-xs font-medium text-emerald-700", children: [
|
|
70
|
+
a.label,
|
|
71
|
+
" - ",
|
|
72
|
+
a.paymentRequirementLabel
|
|
73
|
+
] })
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ r("span", { className: "text-sm font-semibold tabular-nums", children: [
|
|
76
|
+
c.sale_price && /* @__PURE__ */ r(x, { children: [
|
|
77
|
+
/* @__PURE__ */ r("span", { className: "sr-only", children: [
|
|
78
|
+
l("ecommerce.regular_price", "Regular price"),
|
|
79
|
+
" "
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ t("s", { className: "mr-1.5 text-xs font-normal text-muted-foreground", children: u(c.price, o) }),
|
|
82
|
+
/* @__PURE__ */ r("span", { className: "sr-only", children: [
|
|
83
|
+
l("ecommerce.sale_price", "Sale price"),
|
|
84
|
+
" "
|
|
85
|
+
] })
|
|
86
|
+
] }),
|
|
87
|
+
u(c.sale_price ?? c.price, o)
|
|
88
|
+
] })
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ r("div", { className: "flex items-center justify-between text-sm", children: [
|
|
91
|
+
g(e) ? /* @__PURE__ */ t(F, { variant: "secondary", className: "font-normal text-xs", children: l("ecommerce.license_count_one", "1 license", { count: 1 }) }) : /* @__PURE__ */ r("div", { role: "group", "aria-label": `${l("ecommerce.quantity", "Quantity")}: ${e.title}`, className: "flex items-center rounded-md border text-xs", children: [
|
|
92
|
+
/* @__PURE__ */ t(
|
|
93
|
+
"button",
|
|
94
|
+
{
|
|
95
|
+
onClick: () => p(e.id, e.quantity - 1),
|
|
96
|
+
className: "flex h-7 w-7 items-center justify-center rounded-l-md border-r focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
|
|
97
|
+
type: "button",
|
|
98
|
+
"aria-label": l("ecommerce.decrease_quantity", "Decrease quantity"),
|
|
99
|
+
children: /* @__PURE__ */ t(P, { className: "h-3 w-3" })
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ t("span", { "aria-live": "polite", "aria-atomic": "true", className: "flex h-7 w-8 items-center justify-center tabular-nums", children: e.quantity }),
|
|
103
|
+
/* @__PURE__ */ t(
|
|
104
|
+
"button",
|
|
105
|
+
{
|
|
106
|
+
onClick: () => p(e.id, e.quantity + 1),
|
|
107
|
+
className: "flex h-7 w-7 items-center justify-center rounded-r-md border-l focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
|
|
108
|
+
type: "button",
|
|
109
|
+
"aria-label": l("ecommerce.increase_quantity", "Increase quantity"),
|
|
110
|
+
disabled: typeof e.stock == "number" && s >= e.stock,
|
|
111
|
+
children: /* @__PURE__ */ t(R, { className: "h-3 w-3" })
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
] }),
|
|
115
|
+
/* @__PURE__ */ t(
|
|
116
|
+
"button",
|
|
117
|
+
{
|
|
118
|
+
onClick: () => w(e.id),
|
|
119
|
+
className: "inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-destructive focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
|
|
120
|
+
type: "button",
|
|
121
|
+
"aria-label": l("ecommerce.remove_item", `Remove ${e.title} from cart`, { item: e.title }),
|
|
122
|
+
children: /* @__PURE__ */ t(A, { className: "h-4 w-4" })
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
] })
|
|
126
|
+
] })
|
|
127
|
+
] });
|
|
128
|
+
})() }, e.id);
|
|
129
|
+
}) }) : /* @__PURE__ */ r("div", { className: "flex h-full flex-col items-center justify-center space-y-2", children: [
|
|
130
|
+
/* @__PURE__ */ t("span", { className: "text-muted-foreground", children: n("ecommerce.cart_empty") }),
|
|
131
|
+
/* @__PURE__ */ t(d, { variant: "outline", onClick: () => m(!1), children: n("ecommerce.continue_shopping") })
|
|
132
|
+
] }),
|
|
133
|
+
i.length > 0 && /* @__PURE__ */ r("div", { className: "border-t pr-6 pt-4", children: [
|
|
134
|
+
/* @__PURE__ */ r("div", { className: "flex items-center justify-between text-base font-medium", children: [
|
|
135
|
+
/* @__PURE__ */ t("span", { children: n("ecommerce.subtotal") }),
|
|
136
|
+
/* @__PURE__ */ t("span", { children: u(v, o) })
|
|
137
|
+
] }),
|
|
138
|
+
/* @__PURE__ */ t("p", { className: "mb-4 mt-1 text-xs text-muted-foreground", children: n("ecommerce.shipping_taxes_calculated") }),
|
|
139
|
+
/* @__PURE__ */ t("div", { className: "mb-4", children: /* @__PURE__ */ t(z, { items: i, currencyCode: o, compact: !0 }) }),
|
|
140
|
+
/* @__PURE__ */ t(d, { asChild: !0, variant: "outline", className: "w-full mb-3", children: /* @__PURE__ */ t(b, { href: "/cart", onClick: () => m(!1), children: n("ecommerce.view_full_cart") }) }),
|
|
141
|
+
/* @__PURE__ */ t(d, { asChild: !0, className: "w-full", children: /* @__PURE__ */ t(b, { href: "/checkout", onClick: () => m(!1), children: n("ecommerce.ready_to_checkout") }) })
|
|
142
|
+
] })
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
) });
|
|
300
146
|
};
|
|
301
147
|
export {
|
|
302
|
-
|
|
148
|
+
ne as CartDrawer
|
|
303
149
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("@nextblock-cms/ui/badge"),o=require("@nextblock-cms/ui/button"),n=require("lucide-react"),g=require("@nextblock-cms/utils"),c=require("../cart-store.cjs.js"),d=require("../use-cart.cjs.js"),m=()=>{const i=c.useCartStore(a=>a.toggleCart),t=c.useCartTotalItems(),l=d.useCart(a=>a.isOpen)!==void 0,{t:u}=g.useTranslations(),r=u("ecommerce.open_cart_count",{count:t}),s=r==="ecommerce.open_cart_count"?`Open cart (${t} items)`:r;return l?e.jsxs(o.Button,{variant:"ghost",size:"icon",className:"relative",onClick:i,"aria-label":s,"aria-haspopup":"dialog",children:[e.jsx(n.ShoppingBag,{className:"h-5 w-5"}),t>0&&e.jsx(p.Badge,{variant:"destructive",className:"absolute -right-1 -top-1 h-4 w-4 items-center justify-center p-0 text-[10px]",children:t})]}):e.jsx(o.Button,{variant:"ghost",size:"icon",className:"relative","aria-label":s,"aria-haspopup":"dialog",children:e.jsx(n.ShoppingBag,{className:"h-5 w-5"})})};exports.CartIcon=m;
|
|
@@ -1,62 +1,36 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import { Badge as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { ShoppingBag as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { jsx as a, jsxs as l } from "react/jsx-runtime";
|
|
3
|
+
import { Badge as p } from "@nextblock-cms/ui/badge";
|
|
4
|
+
import { Button as s } from "@nextblock-cms/ui/button";
|
|
5
|
+
import { ShoppingBag as i } from "lucide-react";
|
|
6
|
+
import { useTranslations as u } from "@nextblock-cms/utils";
|
|
7
|
+
import { useCartStore as h, useCartTotalItems as g } from "../cart-store.es.js";
|
|
8
|
+
import { useCart as d } from "../use-cart.es.js";
|
|
9
|
+
const j = () => {
|
|
10
|
+
const n = h((e) => e.toggleCart), t = g(), c = d((e) => e.isOpen) !== void 0, { t: m } = u(), o = m("ecommerce.open_cart_count", { count: t }), r = o === "ecommerce.open_cart_count" ? `Open cart (${t} items)` : o;
|
|
11
|
+
return c ? /* @__PURE__ */ l(
|
|
12
|
+
s,
|
|
12
13
|
{
|
|
13
14
|
variant: "ghost",
|
|
14
15
|
size: "icon",
|
|
15
16
|
className: "relative",
|
|
16
17
|
onClick: n,
|
|
17
|
-
"aria-label":
|
|
18
|
+
"aria-label": r,
|
|
19
|
+
"aria-haspopup": "dialog",
|
|
18
20
|
children: [
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
columnNumber: 7
|
|
23
|
-
}, void 0),
|
|
24
|
-
s > 0 && /* @__PURE__ */ e(
|
|
25
|
-
i,
|
|
21
|
+
/* @__PURE__ */ a(i, { className: "h-5 w-5" }),
|
|
22
|
+
t > 0 && /* @__PURE__ */ a(
|
|
23
|
+
p,
|
|
26
24
|
{
|
|
27
25
|
variant: "destructive",
|
|
28
26
|
className: "absolute -right-1 -top-1 h-4 w-4 items-center justify-center p-0 text-[10px]",
|
|
29
|
-
children:
|
|
30
|
-
}
|
|
31
|
-
void 0,
|
|
32
|
-
!1,
|
|
33
|
-
{
|
|
34
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartIcon.tsx",
|
|
35
|
-
lineNumber: 36,
|
|
36
|
-
columnNumber: 9
|
|
37
|
-
},
|
|
38
|
-
void 0
|
|
27
|
+
children: t
|
|
28
|
+
}
|
|
39
29
|
)
|
|
40
30
|
]
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
!0,
|
|
44
|
-
{
|
|
45
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartIcon.tsx",
|
|
46
|
-
lineNumber: 27,
|
|
47
|
-
columnNumber: 5
|
|
48
|
-
},
|
|
49
|
-
void 0
|
|
50
|
-
) : /* @__PURE__ */ e(t, { variant: "ghost", size: "icon", className: "relative", "aria-label": "Open cart", children: /* @__PURE__ */ e(o, { className: "h-5 w-5" }, void 0, !1, {
|
|
51
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartIcon.tsx",
|
|
52
|
-
lineNumber: 21,
|
|
53
|
-
columnNumber: 13
|
|
54
|
-
}, void 0) }, void 0, !1, {
|
|
55
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/components/CartIcon.tsx",
|
|
56
|
-
lineNumber: 20,
|
|
57
|
-
columnNumber: 9
|
|
58
|
-
}, void 0);
|
|
31
|
+
}
|
|
32
|
+
) : /* @__PURE__ */ a(s, { variant: "ghost", size: "icon", className: "relative", "aria-label": r, "aria-haspopup": "dialog", children: /* @__PURE__ */ a(i, { className: "h-5 w-5" }) });
|
|
59
33
|
};
|
|
60
34
|
export {
|
|
61
|
-
|
|
35
|
+
j as CartIcon
|
|
62
36
|
};
|