@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,260 +1,149 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import { useState as
|
|
4
|
-
import { Label as
|
|
2
|
+
import { jsxs as d, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { useState as h, useEffect as k } from "react";
|
|
4
|
+
import { Label as y, Input as C } from "@nextblock-cms/ui";
|
|
5
5
|
import { getCurrencyMinorUnitFactor as F } from "@nextblock-cms/utils";
|
|
6
|
-
import { normalizeCurrencyRecord as
|
|
7
|
-
function
|
|
8
|
-
return F(
|
|
6
|
+
import { normalizeCurrencyRecord as $ } from "../../../../currency.es.js";
|
|
7
|
+
function _(t) {
|
|
8
|
+
return F(t) === 1 ? 0 : 2;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
10
|
+
function w(t, o) {
|
|
11
|
+
return t == null || Number.isNaN(t) ? "" : t.toFixed(o);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
id:
|
|
15
|
-
currencyCode:
|
|
16
|
-
value:
|
|
17
|
-
disabled:
|
|
18
|
-
placeholder:
|
|
19
|
-
className:
|
|
20
|
-
allowEmpty:
|
|
21
|
-
onValueChange:
|
|
13
|
+
function v({
|
|
14
|
+
id: t,
|
|
15
|
+
currencyCode: o,
|
|
16
|
+
value: s,
|
|
17
|
+
disabled: f,
|
|
18
|
+
placeholder: x,
|
|
19
|
+
className: g,
|
|
20
|
+
allowEmpty: N = !1,
|
|
21
|
+
onValueChange: u
|
|
22
22
|
}) {
|
|
23
|
-
const
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
}, [
|
|
27
|
-
|
|
23
|
+
const a = _(o), [m, p] = h(!1), [b, l] = h(() => w(s, a));
|
|
24
|
+
return k(() => {
|
|
25
|
+
m || l(w(s, a));
|
|
26
|
+
}, [s, a, m]), /* @__PURE__ */ r(
|
|
27
|
+
C,
|
|
28
28
|
{
|
|
29
|
-
id:
|
|
29
|
+
id: t,
|
|
30
30
|
type: "text",
|
|
31
31
|
inputMode: "decimal",
|
|
32
|
-
value:
|
|
33
|
-
disabled:
|
|
34
|
-
placeholder:
|
|
35
|
-
className:
|
|
36
|
-
onFocus: () =>
|
|
32
|
+
value: b,
|
|
33
|
+
disabled: f,
|
|
34
|
+
placeholder: x,
|
|
35
|
+
className: g,
|
|
36
|
+
onFocus: () => p(!0),
|
|
37
37
|
onChange: (e) => {
|
|
38
|
-
let
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
|
|
38
|
+
let n = e.target.value.replace(/[^0-9.]/g, "");
|
|
39
|
+
const c = n.indexOf(".");
|
|
40
|
+
if (c !== -1 && (n = n.slice(0, c + 1) + n.slice(c + 1).replace(/\./g, "")), l(n), n === "" || n === ".") {
|
|
41
|
+
u(N ? null : 0);
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
const
|
|
45
|
-
Number.isNaN(
|
|
44
|
+
const i = Number(n);
|
|
45
|
+
Number.isNaN(i) || u(i);
|
|
46
46
|
},
|
|
47
47
|
onBlur: () => {
|
|
48
|
-
if (
|
|
49
|
-
const e = Number(
|
|
50
|
-
e !==
|
|
48
|
+
if (p(!1), s != null && !Number.isNaN(s)) {
|
|
49
|
+
const e = Number(s.toFixed(a));
|
|
50
|
+
e !== s && u(e);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
}
|
|
54
|
-
void 0,
|
|
55
|
-
!1,
|
|
56
|
-
{
|
|
57
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/CurrencyPriceFields.tsx",
|
|
58
|
-
lineNumber: 67,
|
|
59
|
-
columnNumber: 5
|
|
60
|
-
},
|
|
61
|
-
this
|
|
53
|
+
}
|
|
62
54
|
);
|
|
63
55
|
}
|
|
64
|
-
function
|
|
65
|
-
idPrefix:
|
|
66
|
-
currencies:
|
|
67
|
-
prices:
|
|
68
|
-
salePrices:
|
|
69
|
-
managedCurrencyCodes:
|
|
70
|
-
onPriceChange:
|
|
71
|
-
onSalePriceChange:
|
|
72
|
-
readOnly:
|
|
73
|
-
helperText:
|
|
74
|
-
trailing:
|
|
56
|
+
function z({
|
|
57
|
+
idPrefix: t = "currency",
|
|
58
|
+
currencies: o,
|
|
59
|
+
prices: s,
|
|
60
|
+
salePrices: f,
|
|
61
|
+
managedCurrencyCodes: x = [],
|
|
62
|
+
onPriceChange: g,
|
|
63
|
+
onSalePriceChange: N,
|
|
64
|
+
readOnly: u = !1,
|
|
65
|
+
helperText: a,
|
|
66
|
+
trailing: m
|
|
75
67
|
}) {
|
|
76
|
-
const
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}, this),
|
|
83
|
-
/* @__PURE__ */ s("div", { className: "divide-y divide-muted/50", children: i.map((n) => {
|
|
84
|
-
const e = D(n), c = e.is_default !== !0 && x.has(e.code), l = d || c;
|
|
85
|
-
return /* @__PURE__ */ s(
|
|
68
|
+
const p = o.find((l) => l.is_default) ?? o[0], b = new Set(x);
|
|
69
|
+
return p ? /* @__PURE__ */ d("div", { className: "flex flex-col gap-2", children: [
|
|
70
|
+
a && /* @__PURE__ */ r("p", { className: "text-xs text-muted-foreground bg-muted/20 p-2 rounded-md border", children: a }),
|
|
71
|
+
/* @__PURE__ */ r("div", { className: "divide-y divide-muted/50", children: o.map((l) => {
|
|
72
|
+
const e = $(l), n = e.is_default !== !0 && b.has(e.code), c = u || n;
|
|
73
|
+
return /* @__PURE__ */ d(
|
|
86
74
|
"div",
|
|
87
75
|
{
|
|
88
76
|
className: "flex flex-wrap items-stretch gap-4 py-3 first:pt-0 last:pb-0",
|
|
89
77
|
children: [
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}, this),
|
|
96
|
-
/* @__PURE__ */ s("span", { className: "text-[11px] text-muted-foreground font-medium", children: e.symbol }, void 0, !1, {
|
|
97
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/CurrencyPriceFields.tsx",
|
|
98
|
-
lineNumber: 165,
|
|
99
|
-
columnNumber: 17
|
|
100
|
-
}, this),
|
|
101
|
-
e.is_default ? /* @__PURE__ */ s("span", { className: "text-[9px] uppercase font-bold bg-primary/10 text-primary px-1.5 py-0.5 rounded tracking-widest leading-none", children: "Default" }, void 0, !1, {
|
|
102
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/CurrencyPriceFields.tsx",
|
|
103
|
-
lineNumber: 167,
|
|
104
|
-
columnNumber: 19
|
|
105
|
-
}, this) : c ? /* @__PURE__ */ s("span", { className: "text-[9px] uppercase font-bold bg-muted text-muted-foreground px-1.5 py-0.5 rounded tracking-widest leading-none", children: "Auto" }, void 0, !1, {
|
|
106
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/CurrencyPriceFields.tsx",
|
|
107
|
-
lineNumber: 169,
|
|
108
|
-
columnNumber: 19
|
|
109
|
-
}, this) : null,
|
|
110
|
-
!e.is_default && /* @__PURE__ */ s("span", { className: "text-[9px] text-muted-foreground/80 font-medium tracking-wide leading-none ml-auto", children: [
|
|
78
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-2 w-[160px] shrink-0 self-stretch border-r border-border/50 pr-4", children: [
|
|
79
|
+
/* @__PURE__ */ r("span", { className: "text-sm font-black tracking-tighter text-foreground", children: e.code }),
|
|
80
|
+
/* @__PURE__ */ r("span", { className: "text-[11px] text-muted-foreground font-medium", children: e.symbol }),
|
|
81
|
+
e.is_default ? /* @__PURE__ */ r("span", { className: "text-[9px] uppercase font-bold bg-primary/10 text-primary px-1.5 py-0.5 rounded tracking-widest leading-none", children: "Default" }) : n ? /* @__PURE__ */ r("span", { className: "text-[9px] uppercase font-bold bg-muted text-muted-foreground px-1.5 py-0.5 rounded tracking-widest leading-none", children: "Auto" }) : null,
|
|
82
|
+
!e.is_default && /* @__PURE__ */ d("span", { className: "text-[9px] text-muted-foreground/80 font-medium tracking-wide leading-none ml-auto", children: [
|
|
111
83
|
"x",
|
|
112
84
|
e.exchange_rate
|
|
113
|
-
] }
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/CurrencyPriceFields.tsx",
|
|
120
|
-
lineNumber: 163,
|
|
121
|
-
columnNumber: 13
|
|
122
|
-
}, this),
|
|
123
|
-
/* @__PURE__ */ s("div", { className: "grid flex-1 grid-cols-2 items-end gap-3 sm:grid-cols-4", children: [
|
|
124
|
-
/* @__PURE__ */ s("div", { className: "min-w-0 space-y-1", children: [
|
|
125
|
-
/* @__PURE__ */ s(
|
|
126
|
-
k,
|
|
85
|
+
] })
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ d("div", { className: "grid flex-1 grid-cols-2 items-end gap-3 sm:grid-cols-4", children: [
|
|
88
|
+
/* @__PURE__ */ d("div", { className: "min-w-0 space-y-1", children: [
|
|
89
|
+
/* @__PURE__ */ r(
|
|
90
|
+
y,
|
|
127
91
|
{
|
|
128
|
-
htmlFor: `${
|
|
92
|
+
htmlFor: `${t}-price-${e.code}`,
|
|
129
93
|
className: "block text-[10px] uppercase font-bold text-muted-foreground tracking-widest",
|
|
130
94
|
children: "Price"
|
|
131
|
-
}
|
|
132
|
-
void 0,
|
|
133
|
-
!1,
|
|
134
|
-
{
|
|
135
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/CurrencyPriceFields.tsx",
|
|
136
|
-
lineNumber: 182,
|
|
137
|
-
columnNumber: 17
|
|
138
|
-
},
|
|
139
|
-
this
|
|
95
|
+
}
|
|
140
96
|
),
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
-
/* @__PURE__ */
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
columnNumber: 19
|
|
146
|
-
}, this),
|
|
147
|
-
/* @__PURE__ */ s(
|
|
148
|
-
h,
|
|
97
|
+
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
98
|
+
/* @__PURE__ */ r("span", { className: "absolute left-2.5 top-1/2 -translate-y-1/2 text-xs text-muted-foreground font-bold pointer-events-none", children: e.symbol }),
|
|
99
|
+
/* @__PURE__ */ r(
|
|
100
|
+
v,
|
|
149
101
|
{
|
|
150
|
-
id: `${
|
|
102
|
+
id: `${t}-price-${e.code}`,
|
|
151
103
|
currencyCode: e.code,
|
|
152
|
-
value:
|
|
153
|
-
disabled:
|
|
104
|
+
value: s[e.code],
|
|
105
|
+
disabled: c,
|
|
154
106
|
className: "h-8 w-full text-sm pl-6",
|
|
155
|
-
onValueChange: (
|
|
156
|
-
}
|
|
157
|
-
void 0,
|
|
158
|
-
!1,
|
|
159
|
-
{
|
|
160
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/CurrencyPriceFields.tsx",
|
|
161
|
-
lineNumber: 192,
|
|
162
|
-
columnNumber: 19
|
|
163
|
-
},
|
|
164
|
-
this
|
|
107
|
+
onValueChange: (i) => g(e.code, i ?? 0)
|
|
108
|
+
}
|
|
165
109
|
)
|
|
166
|
-
] }
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
] }, void 0, !0, {
|
|
172
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/CurrencyPriceFields.tsx",
|
|
173
|
-
lineNumber: 181,
|
|
174
|
-
columnNumber: 15
|
|
175
|
-
}, this),
|
|
176
|
-
/* @__PURE__ */ s("div", { className: "min-w-0 space-y-1", children: [
|
|
177
|
-
/* @__PURE__ */ s(
|
|
178
|
-
k,
|
|
110
|
+
] })
|
|
111
|
+
] }),
|
|
112
|
+
/* @__PURE__ */ d("div", { className: "min-w-0 space-y-1", children: [
|
|
113
|
+
/* @__PURE__ */ r(
|
|
114
|
+
y,
|
|
179
115
|
{
|
|
180
|
-
htmlFor: `${
|
|
116
|
+
htmlFor: `${t}-sale-price-${e.code}`,
|
|
181
117
|
className: "block text-[10px] uppercase font-bold text-muted-foreground tracking-widest",
|
|
182
118
|
children: "Sale"
|
|
183
|
-
}
|
|
184
|
-
void 0,
|
|
185
|
-
!1,
|
|
186
|
-
{
|
|
187
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/CurrencyPriceFields.tsx",
|
|
188
|
-
lineNumber: 207,
|
|
189
|
-
columnNumber: 17
|
|
190
|
-
},
|
|
191
|
-
this
|
|
119
|
+
}
|
|
192
120
|
),
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
/* @__PURE__ */
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
columnNumber: 19
|
|
198
|
-
}, this),
|
|
199
|
-
/* @__PURE__ */ s(
|
|
200
|
-
h,
|
|
121
|
+
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
122
|
+
/* @__PURE__ */ r("span", { className: "absolute left-2.5 top-1/2 -translate-y-1/2 text-xs text-muted-foreground font-bold pointer-events-none", children: e.symbol }),
|
|
123
|
+
/* @__PURE__ */ r(
|
|
124
|
+
v,
|
|
201
125
|
{
|
|
202
|
-
id: `${
|
|
126
|
+
id: `${t}-sale-price-${e.code}`,
|
|
203
127
|
currencyCode: e.code,
|
|
204
|
-
value:
|
|
205
|
-
disabled:
|
|
206
|
-
placeholder:
|
|
128
|
+
value: f[e.code],
|
|
129
|
+
disabled: c,
|
|
130
|
+
placeholder: n ? "Auto" : "—",
|
|
207
131
|
allowEmpty: !0,
|
|
208
132
|
className: "h-8 w-full text-sm pl-6",
|
|
209
|
-
onValueChange: (
|
|
210
|
-
}
|
|
211
|
-
void 0,
|
|
212
|
-
!1,
|
|
213
|
-
{
|
|
214
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/CurrencyPriceFields.tsx",
|
|
215
|
-
lineNumber: 217,
|
|
216
|
-
columnNumber: 19
|
|
217
|
-
},
|
|
218
|
-
this
|
|
133
|
+
onValueChange: (i) => N(e.code, i)
|
|
134
|
+
}
|
|
219
135
|
)
|
|
220
|
-
] }
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}, this)
|
|
225
|
-
] }, void 0, !0, {
|
|
226
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/CurrencyPriceFields.tsx",
|
|
227
|
-
lineNumber: 206,
|
|
228
|
-
columnNumber: 15
|
|
229
|
-
}, this),
|
|
230
|
-
a && e.is_default ? a : null
|
|
231
|
-
] }, void 0, !0, {
|
|
232
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/CurrencyPriceFields.tsx",
|
|
233
|
-
lineNumber: 179,
|
|
234
|
-
columnNumber: 13
|
|
235
|
-
}, this)
|
|
136
|
+
] })
|
|
137
|
+
] }),
|
|
138
|
+
m && e.is_default ? m : null
|
|
139
|
+
] })
|
|
236
140
|
]
|
|
237
141
|
},
|
|
238
|
-
e.code
|
|
239
|
-
!0,
|
|
240
|
-
{
|
|
241
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/CurrencyPriceFields.tsx",
|
|
242
|
-
lineNumber: 158,
|
|
243
|
-
columnNumber: 11
|
|
244
|
-
},
|
|
245
|
-
this
|
|
142
|
+
e.code
|
|
246
143
|
);
|
|
247
|
-
}) }
|
|
248
|
-
|
|
249
|
-
lineNumber: 149,
|
|
250
|
-
columnNumber: 7
|
|
251
|
-
}, this)
|
|
252
|
-
] }, void 0, !0, {
|
|
253
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/CurrencyPriceFields.tsx",
|
|
254
|
-
lineNumber: 145,
|
|
255
|
-
columnNumber: 5
|
|
256
|
-
}, this) : null;
|
|
144
|
+
}) })
|
|
145
|
+
] }) : null;
|
|
257
146
|
}
|
|
258
147
|
export {
|
|
259
|
-
|
|
148
|
+
z as CurrencyPriceFields
|
|
260
149
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("@nextblock-cms/ui"),f=require("react"),g=require("lucide-react"),y=require("next/navigation");function p({productName:u,isIcon:c=!1,className:r,redirectTo:n,deleteAction:l}){const[e,d]=f.useTransition(),o=y.useRouter(),i=async s=>{s.preventDefault(),s.stopPropagation(),window.confirm(`Are you sure you want to delete "${u}"? This action cannot be undone.`)&&d(async()=>{try{await l(),n?o.push(n):o.refresh()}catch(h){console.error("Failed to delete product:",h),alert("Failed to delete product. Please try again.")}})};return c?t.jsx(a.Button,{variant:"ghost",size:"icon",onClick:i,disabled:e,className:`text-red-500 hover:text-red-600 hover:bg-red-50 ${r}`,title:"Delete Product",children:t.jsx(g.Trash2,{className:"h-4 w-4"})}):t.jsx(a.Button,{variant:"destructive",onClick:i,disabled:e,className:r,type:"button",children:e?"Deleting...":"Delete Product"})}exports.DeleteProductButton=p;
|
|
@@ -1,68 +1,48 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import { Button as
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { Button as s } from "@nextblock-cms/ui";
|
|
4
4
|
import { useTransition as p } from "react";
|
|
5
|
-
import { Trash2 as
|
|
6
|
-
import { useRouter as
|
|
7
|
-
function
|
|
5
|
+
import { Trash2 as h } from "lucide-react";
|
|
6
|
+
import { useRouter as m } from "next/navigation";
|
|
7
|
+
function b({
|
|
8
8
|
productName: l,
|
|
9
|
-
isIcon:
|
|
10
|
-
className:
|
|
11
|
-
redirectTo:
|
|
12
|
-
deleteAction:
|
|
9
|
+
isIcon: c = !1,
|
|
10
|
+
className: r,
|
|
11
|
+
redirectTo: o,
|
|
12
|
+
deleteAction: d
|
|
13
13
|
}) {
|
|
14
|
-
const [e,
|
|
15
|
-
|
|
14
|
+
const [e, u] = p(), n = m(), i = async (a) => {
|
|
15
|
+
a.preventDefault(), a.stopPropagation(), window.confirm(`Are you sure you want to delete "${l}"? This action cannot be undone.`) && u(async () => {
|
|
16
16
|
try {
|
|
17
|
-
await
|
|
18
|
-
} catch (
|
|
19
|
-
console.error("Failed to delete product:",
|
|
17
|
+
await d(), o ? n.push(o) : n.refresh();
|
|
18
|
+
} catch (f) {
|
|
19
|
+
console.error("Failed to delete product:", f), alert("Failed to delete product. Please try again.");
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
|
-
return
|
|
24
|
-
|
|
23
|
+
return c ? /* @__PURE__ */ t(
|
|
24
|
+
s,
|
|
25
25
|
{
|
|
26
26
|
variant: "ghost",
|
|
27
27
|
size: "icon",
|
|
28
|
-
onClick:
|
|
28
|
+
onClick: i,
|
|
29
29
|
disabled: e,
|
|
30
|
-
className: `text-red-500 hover:text-red-600 hover:bg-red-50 ${
|
|
30
|
+
className: `text-red-500 hover:text-red-600 hover:bg-red-50 ${r}`,
|
|
31
31
|
title: "Delete Product",
|
|
32
|
-
children: /* @__PURE__ */ t(
|
|
33
|
-
|
|
34
|
-
lineNumber: 57,
|
|
35
|
-
columnNumber: 9
|
|
36
|
-
}, this)
|
|
37
|
-
},
|
|
38
|
-
void 0,
|
|
39
|
-
!1,
|
|
40
|
-
{
|
|
41
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/DeleteProductButton.tsx",
|
|
42
|
-
lineNumber: 49,
|
|
43
|
-
columnNumber: 7
|
|
44
|
-
},
|
|
45
|
-
this
|
|
32
|
+
children: /* @__PURE__ */ t(h, { className: "h-4 w-4" })
|
|
33
|
+
}
|
|
46
34
|
) : /* @__PURE__ */ t(
|
|
47
|
-
|
|
35
|
+
s,
|
|
48
36
|
{
|
|
49
37
|
variant: "destructive",
|
|
50
|
-
onClick:
|
|
38
|
+
onClick: i,
|
|
51
39
|
disabled: e,
|
|
52
|
-
className:
|
|
40
|
+
className: r,
|
|
53
41
|
type: "button",
|
|
54
42
|
children: e ? "Deleting..." : "Delete Product"
|
|
55
|
-
}
|
|
56
|
-
void 0,
|
|
57
|
-
!1,
|
|
58
|
-
{
|
|
59
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/DeleteProductButton.tsx",
|
|
60
|
-
lineNumber: 63,
|
|
61
|
-
columnNumber: 5
|
|
62
|
-
},
|
|
63
|
-
this
|
|
43
|
+
}
|
|
64
44
|
);
|
|
65
45
|
}
|
|
66
46
|
export {
|
|
67
|
-
|
|
47
|
+
b as DeleteProductButton
|
|
68
48
|
};
|
|
@@ -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"),h=require("react"),r=require("@nextblock-cms/ui"),o=require("sonner"),m=require("../actions.cjs.js");function b({plans:l}){return e.jsx("div",{className:"w-full",children:l&&l.length>0?e.jsx("div",{className:"space-y-8",children:l.map(a=>e.jsxs("div",{className:"w-full",children:[l.length>1&&e.jsx("h3",{className:"font-semibold text-lg text-slate-700 dark:text-slate-300 border-b pb-2 mb-4 mt-6",children:a.title||a.name}),e.jsx("div",{className:`${l.length>1?"rounded-lg border":"rounded-b-lg border-x border-b"} overflow-x-auto dark:border-slate-700 bg-card`,children:e.jsxs(r.Table,{children:[e.jsx(r.TableHeader,{children:e.jsxs(r.TableRow,{children:[e.jsx(r.TableHead,{children:"Licenses"}),e.jsx(r.TableHead,{children:"API Monthly"}),e.jsx(r.TableHead,{children:"Override Monthly"}),e.jsx(r.TableHead,{children:"API Annual"}),e.jsx(r.TableHead,{children:"Override Annual"}),e.jsx(r.TableHead,{children:"API Lifetime"}),e.jsx(r.TableHead,{children:"Override Lifetime"})]})}),e.jsx(r.TableBody,{children:a.freemius_pricing&&a.freemius_pricing.length>0?a.freemius_pricing.map(s=>e.jsx(x,{pricing:s},s.id)):e.jsx(r.TableRow,{children:e.jsx(r.TableCell,{colSpan:7,className:"text-center text-slate-500 py-4",children:"No pricing configurations found for this plan."})})})]})})]},a.id))}):e.jsxs("div",{className:"text-center py-10 bg-slate-50 dark:bg-slate-800/50 rounded border border-dashed border-slate-300 dark:border-slate-700",children:[e.jsx("p",{className:"text-slate-500",children:"No Freemius plans synchronized yet."}),e.jsx("p",{className:"text-xs mt-2 text-slate-400",children:"Click the full synchronization button to import from Freemius."})]})})}function x({pricing:l}){const[a,s]=h.useTransition(),i=(t,d)=>{const n=d===""?null:parseFloat(d);d!==""&&Number.isNaN(n)||s(async()=>{const{success:c,error:u}=await m.updateFreemiusOverride(l.id,{[t]:n});c?o.toast.success("Pricing override saved"):o.toast.error(u||"Failed to update pricing")})};return e.jsxs(r.TableRow,{children:[e.jsx(r.TableCell,{className:"font-medium",children:l.license_quota||"Unlimited"}),e.jsx(r.TableCell,{className:"text-slate-500",children:l.api_monthly_price?`$${l.api_monthly_price}`:"-"}),e.jsx(r.TableCell,{children:e.jsx(r.Input,{type:"number",step:"0.01",placeholder:"Override...",defaultValue:l.override_monthly_price||"",onBlur:t=>{t.target.value!==(l.override_monthly_price?.toString()||"")&&i("override_monthly_price",t.target.value)},className:"w-24 h-8",disabled:a})}),e.jsx(r.TableCell,{className:"text-slate-500",children:l.api_annual_price?`$${l.api_annual_price}`:"-"}),e.jsx(r.TableCell,{children:e.jsx(r.Input,{type:"number",step:"0.01",placeholder:"Override...",defaultValue:l.override_annual_price||"",onBlur:t=>{t.target.value!==(l.override_annual_price?.toString()||"")&&i("override_annual_price",t.target.value)},className:"w-24 h-8",disabled:a})}),e.jsx(r.TableCell,{className:"text-slate-500",children:l.api_lifetime_price?`$${l.api_lifetime_price}`:"-"}),e.jsx(r.TableCell,{children:e.jsx(r.Input,{type:"number",step:"0.01",placeholder:"Override...",defaultValue:l.override_lifetime_price||"",onBlur:t=>{t.target.value!==(l.override_lifetime_price?.toString()||"")&&i("override_lifetime_price",t.target.value)},className:"w-24 h-8",disabled:a})})]})}exports.FreemiusPricingDashboard=b;
|