@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,639 +1,408 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { useState as
|
|
5
|
-
import { Badge as
|
|
6
|
-
import { extractSelectedTermsByAttribute as
|
|
2
|
+
import { jsxs as i, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import F from "next/link";
|
|
4
|
+
import { useState as R, useMemo as E, useEffect as v } from "react";
|
|
5
|
+
import { Badge as D, Button as z, Label as P, Input as U } from "@nextblock-cms/ui";
|
|
6
|
+
import { extractSelectedTermsByAttribute as re, resolveTermValue as L, resolveAttributeName as q, generateVariantDrafts as ne } from "../../../../variation-utils.es.js";
|
|
7
7
|
import { CurrencyPriceFields as oe } from "./CurrencyPriceFields.es.js";
|
|
8
|
-
import { SaleScheduleFields as
|
|
9
|
-
import { normalizeSalePriceMap as
|
|
10
|
-
import { sanitizeVariantDraftsForStoreManagedCurrencies as
|
|
11
|
-
import { majorUnitAmountToMinor as
|
|
12
|
-
const
|
|
13
|
-
function
|
|
8
|
+
import { SaleScheduleFields as se } from "./SaleScheduleFields.es.js";
|
|
9
|
+
import { normalizeSalePriceMap as ie, normalizePriceMap as de, convertMinorUnitAmount as I } from "../../../../currency.es.js";
|
|
10
|
+
import { sanitizeVariantDraftsForStoreManagedCurrencies as K, getStoreManagedPriceCurrencyCodes as ce, resolveEditorCurrencyPriceMaps as le } from "../product-price-sync.es.js";
|
|
11
|
+
import { majorUnitAmountToMinor as X, minorUnitAmountToMajor as G } from "@nextblock-cms/utils";
|
|
12
|
+
const O = process.env.NEXT_PUBLIC_R2_BASE_URL || "", Q = process.env.NEXT_PUBLIC_SUPABASE_URL || "", ae = (c) => c.startsWith("http") ? c : O ? `${O.replace(/\/+$/, "")}/${c.replace(/^\/+/, "")}` : Q ? `${Q.replace(/\/+$/, "")}/storage/v1/object/public/media/${c.replace(/^\/+/, "")}` : c;
|
|
13
|
+
function W(c, m = "USD") {
|
|
14
14
|
return new Intl.NumberFormat("en-US", {
|
|
15
15
|
style: "currency",
|
|
16
|
-
currency:
|
|
16
|
+
currency: m
|
|
17
17
|
}).format(c);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return Object.entries(c).filter(([,
|
|
19
|
+
function me(c) {
|
|
20
|
+
return Object.entries(c).filter(([, m]) => m.length > 0).map(([m, _]) => ({ attribute_id: m, term_ids: _ }));
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function Ne({
|
|
23
23
|
globalAttributes: c,
|
|
24
|
-
currentLanguageCode:
|
|
25
|
-
baseSku:
|
|
26
|
-
basePrice:
|
|
27
|
-
basePrices:
|
|
28
|
-
baseSalePrice:
|
|
29
|
-
baseSalePrices:
|
|
30
|
-
currencies:
|
|
24
|
+
currentLanguageCode: m,
|
|
25
|
+
baseSku: _,
|
|
26
|
+
basePrice: $,
|
|
27
|
+
basePrices: M,
|
|
28
|
+
baseSalePrice: w,
|
|
29
|
+
baseSalePrices: A,
|
|
30
|
+
currencies: d,
|
|
31
31
|
availableVariantImages: x = [],
|
|
32
|
-
initialVariationAttributes:
|
|
33
|
-
initialVariants:
|
|
34
|
-
onChange:
|
|
32
|
+
initialVariationAttributes: b,
|
|
33
|
+
initialVariants: T,
|
|
34
|
+
onChange: B
|
|
35
35
|
}) {
|
|
36
|
-
const [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
const [g, H] = R(() => b && b.length > 0 ? b.reduce((e, r) => (e[r.attribute_id] = r.term_ids, e), {}) : re(T || [])), [h, f] = R(
|
|
37
|
+
K(
|
|
38
|
+
T || [],
|
|
39
|
+
d
|
|
40
40
|
)
|
|
41
|
-
),
|
|
41
|
+
), y = E(
|
|
42
42
|
() => c.map((e) => ({
|
|
43
43
|
attribute_id: e.id,
|
|
44
|
-
attribute_name:
|
|
45
|
-
terms: e.terms.filter((
|
|
46
|
-
...
|
|
47
|
-
value:
|
|
44
|
+
attribute_name: q(e, m),
|
|
45
|
+
terms: e.terms.filter((r) => (g[e.id] || []).includes(r.id)).map((r) => ({
|
|
46
|
+
...r,
|
|
47
|
+
value: L(r, m)
|
|
48
48
|
}))
|
|
49
49
|
})).filter((e) => e.terms.length > 0),
|
|
50
|
-
[
|
|
50
|
+
[m, c, g]
|
|
51
51
|
);
|
|
52
|
-
|
|
53
|
-
if (
|
|
54
|
-
|
|
52
|
+
v(() => {
|
|
53
|
+
if (y.length === 0) {
|
|
54
|
+
f([]);
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
(e) =>
|
|
59
|
-
|
|
60
|
-
baseSku:
|
|
61
|
-
basePrice:
|
|
62
|
-
basePrices:
|
|
63
|
-
baseSalePrice:
|
|
64
|
-
baseSalePrices:
|
|
65
|
-
selectedAttributes:
|
|
57
|
+
f(
|
|
58
|
+
(e) => K(
|
|
59
|
+
ne({
|
|
60
|
+
baseSku: _,
|
|
61
|
+
basePrice: $,
|
|
62
|
+
basePrices: de(M),
|
|
63
|
+
baseSalePrice: w,
|
|
64
|
+
baseSalePrices: ie(A),
|
|
65
|
+
selectedAttributes: y,
|
|
66
66
|
previousVariants: e
|
|
67
67
|
}),
|
|
68
|
-
|
|
68
|
+
d
|
|
69
69
|
)
|
|
70
70
|
);
|
|
71
|
-
}, [
|
|
72
|
-
|
|
73
|
-
variationAttributes:
|
|
74
|
-
variants:
|
|
71
|
+
}, [$, M, w, A, _, d, y]), v(() => {
|
|
72
|
+
B({
|
|
73
|
+
variationAttributes: me(g),
|
|
74
|
+
variants: h
|
|
75
75
|
});
|
|
76
|
-
}, [
|
|
77
|
-
const
|
|
78
|
-
(e,
|
|
76
|
+
}, [B, g, h]);
|
|
77
|
+
const J = h.reduce(
|
|
78
|
+
(e, r) => e + (r.stock_quantity || 0),
|
|
79
79
|
0
|
|
80
|
-
),
|
|
81
|
-
() => ce(
|
|
82
|
-
[
|
|
83
|
-
),
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
return
|
|
87
|
-
...
|
|
88
|
-
[e]: [...
|
|
80
|
+
), k = d.find((e) => e.is_default) ?? d[0], N = E(
|
|
81
|
+
() => ce(d),
|
|
82
|
+
[d]
|
|
83
|
+
), Y = (e, r) => {
|
|
84
|
+
H((t) => {
|
|
85
|
+
const n = new Set(t[e] || []);
|
|
86
|
+
return n.has(r) ? n.delete(r) : n.add(r), {
|
|
87
|
+
...t,
|
|
88
|
+
[e]: [...n]
|
|
89
89
|
};
|
|
90
90
|
});
|
|
91
|
-
}, C = (e,
|
|
92
|
-
|
|
93
|
-
(
|
|
94
|
-
if (
|
|
95
|
-
return
|
|
96
|
-
if (
|
|
91
|
+
}, C = (e, r, t) => {
|
|
92
|
+
f(
|
|
93
|
+
(n) => n.map((s) => {
|
|
94
|
+
if (s.combination_key !== e)
|
|
95
|
+
return s;
|
|
96
|
+
if (r === "sku")
|
|
97
97
|
return {
|
|
98
|
-
...
|
|
99
|
-
sku:
|
|
98
|
+
...s,
|
|
99
|
+
sku: t
|
|
100
100
|
};
|
|
101
|
-
if (
|
|
101
|
+
if (r === "upc")
|
|
102
102
|
return {
|
|
103
|
-
...
|
|
104
|
-
upc:
|
|
103
|
+
...s,
|
|
104
|
+
upc: t
|
|
105
105
|
};
|
|
106
|
-
if (
|
|
106
|
+
if (r === "sale_price" && t === "")
|
|
107
107
|
return {
|
|
108
|
-
...
|
|
108
|
+
...s,
|
|
109
109
|
sale_price: null
|
|
110
110
|
};
|
|
111
|
-
if (
|
|
112
|
-
return
|
|
113
|
-
const
|
|
111
|
+
if (r === "prices" || r === "sale_prices")
|
|
112
|
+
return s;
|
|
113
|
+
const l = t === "" ? 0 : Number(t);
|
|
114
114
|
return {
|
|
115
|
-
...
|
|
116
|
-
[
|
|
115
|
+
...s,
|
|
116
|
+
[r]: Number.isFinite(l) ? l : 0
|
|
117
117
|
};
|
|
118
118
|
})
|
|
119
119
|
);
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
(
|
|
123
|
-
(
|
|
120
|
+
}, Z = (e, r, t) => {
|
|
121
|
+
f(
|
|
122
|
+
(n) => n.map(
|
|
123
|
+
(s) => s.combination_key === e ? { ...s, [r]: t } : s
|
|
124
124
|
)
|
|
125
125
|
);
|
|
126
|
-
},
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
(
|
|
130
|
-
if (
|
|
131
|
-
return
|
|
126
|
+
}, V = (e, r, t, n) => {
|
|
127
|
+
const s = d.find((l) => l.is_default) ?? d[0];
|
|
128
|
+
f(
|
|
129
|
+
(l) => l.map((p) => {
|
|
130
|
+
if (p.combination_key !== e)
|
|
131
|
+
return p;
|
|
132
132
|
const u = {
|
|
133
|
-
...
|
|
134
|
-
[
|
|
133
|
+
...t === "prices" ? p.prices : p.sale_prices,
|
|
134
|
+
[r]: n
|
|
135
135
|
};
|
|
136
136
|
return {
|
|
137
|
-
...
|
|
138
|
-
[
|
|
139
|
-
...
|
|
137
|
+
...p,
|
|
138
|
+
[t]: u,
|
|
139
|
+
...r === s?.code ? t === "prices" ? { price: n ?? 0 } : { sale_price: n } : {}
|
|
140
140
|
};
|
|
141
141
|
})
|
|
142
142
|
);
|
|
143
|
-
},
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
(
|
|
147
|
-
if (
|
|
148
|
-
return
|
|
149
|
-
const
|
|
150
|
-
if (
|
|
143
|
+
}, ee = (e) => {
|
|
144
|
+
const r = d.find((n) => n.is_default) ?? d[0], t = new Set(N);
|
|
145
|
+
r && f(
|
|
146
|
+
(n) => n.map((s) => {
|
|
147
|
+
if (s.combination_key !== e)
|
|
148
|
+
return s;
|
|
149
|
+
const l = d.reduce((u, a) => {
|
|
150
|
+
if (a.code !== r.code && t.has(a.code))
|
|
151
151
|
return u;
|
|
152
|
-
const
|
|
153
|
-
amount:
|
|
154
|
-
fromCurrencyCode:
|
|
155
|
-
toCurrencyCode:
|
|
156
|
-
currencies:
|
|
152
|
+
const S = I({
|
|
153
|
+
amount: X(s.price, r.code),
|
|
154
|
+
fromCurrencyCode: r.code,
|
|
155
|
+
toCurrencyCode: a.code,
|
|
156
|
+
currencies: d,
|
|
157
157
|
applyRounding: !0
|
|
158
158
|
});
|
|
159
|
-
return u[
|
|
160
|
-
}, {}),
|
|
161
|
-
(u,
|
|
162
|
-
if (
|
|
159
|
+
return u[a.code] = G(S, a.code), u;
|
|
160
|
+
}, {}), p = d.reduce(
|
|
161
|
+
(u, a) => {
|
|
162
|
+
if (a.code !== r.code && t.has(a.code))
|
|
163
163
|
return u;
|
|
164
|
-
if (typeof
|
|
165
|
-
return u[
|
|
166
|
-
const
|
|
167
|
-
amount:
|
|
168
|
-
fromCurrencyCode:
|
|
169
|
-
toCurrencyCode:
|
|
170
|
-
currencies:
|
|
164
|
+
if (typeof s.sale_price != "number")
|
|
165
|
+
return u[a.code] = null, u;
|
|
166
|
+
const S = I({
|
|
167
|
+
amount: X(s.sale_price, r.code),
|
|
168
|
+
fromCurrencyCode: r.code,
|
|
169
|
+
toCurrencyCode: a.code,
|
|
170
|
+
currencies: d,
|
|
171
171
|
applyRounding: !0
|
|
172
172
|
});
|
|
173
|
-
return u[
|
|
173
|
+
return u[a.code] = G(S, a.code), u;
|
|
174
174
|
},
|
|
175
175
|
{}
|
|
176
176
|
);
|
|
177
177
|
return {
|
|
178
|
-
...
|
|
179
|
-
prices:
|
|
180
|
-
sale_prices:
|
|
178
|
+
...s,
|
|
179
|
+
prices: l,
|
|
180
|
+
sale_prices: p
|
|
181
181
|
};
|
|
182
182
|
})
|
|
183
183
|
);
|
|
184
|
-
},
|
|
185
|
-
const
|
|
186
|
-
if (!
|
|
184
|
+
}, te = (e, r) => {
|
|
185
|
+
const t = x.find((l) => l.media_id === r);
|
|
186
|
+
if (!t)
|
|
187
187
|
return;
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
(
|
|
191
|
-
(
|
|
192
|
-
...
|
|
193
|
-
main_media_id:
|
|
194
|
-
main_image_url:
|
|
195
|
-
} :
|
|
188
|
+
const n = t.file_path, s = ae(n);
|
|
189
|
+
f(
|
|
190
|
+
(l) => l.map(
|
|
191
|
+
(p) => p.combination_key === e ? {
|
|
192
|
+
...p,
|
|
193
|
+
main_media_id: t.media_id,
|
|
194
|
+
main_image_url: s
|
|
195
|
+
} : p
|
|
196
196
|
)
|
|
197
197
|
);
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
(
|
|
201
|
-
(
|
|
202
|
-
...
|
|
198
|
+
}, j = (e) => {
|
|
199
|
+
f(
|
|
200
|
+
(r) => r.map(
|
|
201
|
+
(t) => t.combination_key === e ? {
|
|
202
|
+
...t,
|
|
203
203
|
main_media_id: null,
|
|
204
204
|
main_image_url: null
|
|
205
|
-
} :
|
|
205
|
+
} : t
|
|
206
206
|
)
|
|
207
207
|
);
|
|
208
208
|
};
|
|
209
|
-
return c.length === 0 ? /* @__PURE__ */
|
|
209
|
+
return c.length === 0 ? /* @__PURE__ */ i("div", { className: "rounded-lg border border-dashed p-6 text-sm text-muted-foreground", children: [
|
|
210
210
|
"No global attributes have been created yet. Create them first in",
|
|
211
211
|
" ",
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
214
|
-
lineNumber: 402,
|
|
215
|
-
columnNumber: 9
|
|
216
|
-
}, this),
|
|
212
|
+
/* @__PURE__ */ o(F, { href: "/cms/products/attributes", className: "font-medium text-primary underline-offset-4 hover:underline", children: "Attribute Management" }),
|
|
217
213
|
"."
|
|
218
|
-
] }
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
|
|
226
|
-
/* @__PURE__ */ r("span", { className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none", children: "Attributes" }, void 0, !1, {
|
|
227
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
228
|
-
lineNumber: 416,
|
|
229
|
-
columnNumber: 13
|
|
230
|
-
}, this),
|
|
231
|
-
/* @__PURE__ */ r(A, { variant: "outline", className: "text-[10px] px-1.5 h-4", children: [
|
|
232
|
-
N.length,
|
|
214
|
+
] }) : /* @__PURE__ */ i("div", { className: "space-y-3", children: [
|
|
215
|
+
/* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
216
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-3", children: [
|
|
217
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-3", children: [
|
|
218
|
+
/* @__PURE__ */ o("span", { className: "text-xs uppercase font-bold text-muted-foreground tracking-wider leading-none", children: "Attributes" }),
|
|
219
|
+
/* @__PURE__ */ i(D, { variant: "outline", className: "text-[10px] px-1.5 h-4", children: [
|
|
220
|
+
h.length,
|
|
233
221
|
" variants"
|
|
234
|
-
] },
|
|
235
|
-
|
|
236
|
-
lineNumber: 417,
|
|
237
|
-
columnNumber: 13
|
|
238
|
-
}, this),
|
|
239
|
-
/* @__PURE__ */ r(A, { variant: "secondary", className: "text-[10px] px-1.5 h-4", children: [
|
|
222
|
+
] }),
|
|
223
|
+
/* @__PURE__ */ i(D, { variant: "secondary", className: "text-[10px] px-1.5 h-4", children: [
|
|
240
224
|
"Stock: ",
|
|
241
|
-
|
|
242
|
-
] }
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
254
|
-
lineNumber: 421,
|
|
255
|
-
columnNumber: 13
|
|
256
|
-
}, this) }, void 0, !1, {
|
|
257
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
258
|
-
lineNumber: 420,
|
|
259
|
-
columnNumber: 11
|
|
260
|
-
}, this)
|
|
261
|
-
] }, void 0, !0, {
|
|
262
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
263
|
-
lineNumber: 414,
|
|
264
|
-
columnNumber: 9
|
|
265
|
-
}, this),
|
|
266
|
-
/* @__PURE__ */ r("div", { className: "grid gap-2 lg:grid-cols-2", children: c.map((e) => {
|
|
267
|
-
const o = b[e.id] || [];
|
|
268
|
-
return /* @__PURE__ */ r("div", { className: "flex items-center gap-3 rounded border p-2.5", children: [
|
|
269
|
-
/* @__PURE__ */ r("div", { className: "shrink-0 w-[100px]", children: [
|
|
270
|
-
/* @__PURE__ */ r("span", { className: "text-sm font-bold block leading-tight", children: z(e, a) }, void 0, !1, {
|
|
271
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
272
|
-
lineNumber: 432,
|
|
273
|
-
columnNumber: 19
|
|
274
|
-
}, this),
|
|
275
|
-
/* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground leading-none", children: [
|
|
276
|
-
o.length,
|
|
225
|
+
J
|
|
226
|
+
] })
|
|
227
|
+
] }),
|
|
228
|
+
/* @__PURE__ */ o(z, { asChild: !0, variant: "outline", size: "sm", className: "h-7 text-xs px-3", children: /* @__PURE__ */ o(F, { href: "/cms/products/attributes", children: "Manage" }) })
|
|
229
|
+
] }),
|
|
230
|
+
/* @__PURE__ */ o("div", { className: "grid gap-2 lg:grid-cols-2", children: c.map((e) => {
|
|
231
|
+
const r = g[e.id] || [];
|
|
232
|
+
return /* @__PURE__ */ i("div", { className: "flex items-center gap-3 rounded border p-2.5", children: [
|
|
233
|
+
/* @__PURE__ */ i("div", { className: "shrink-0 w-[100px]", children: [
|
|
234
|
+
/* @__PURE__ */ o("span", { className: "text-sm font-bold block leading-tight", children: q(e, m) }),
|
|
235
|
+
/* @__PURE__ */ i("span", { className: "text-[10px] text-muted-foreground leading-none", children: [
|
|
236
|
+
r.length,
|
|
277
237
|
" selected"
|
|
278
|
-
] }
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
] }, void 0, !0, {
|
|
284
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
285
|
-
lineNumber: 431,
|
|
286
|
-
columnNumber: 17
|
|
287
|
-
}, this),
|
|
288
|
-
/* @__PURE__ */ r("div", { className: "flex flex-wrap gap-1.5 flex-1", children: e.terms.map((s) => {
|
|
289
|
-
const i = o.includes(s.id);
|
|
290
|
-
return /* @__PURE__ */ r(
|
|
238
|
+
] })
|
|
239
|
+
] }),
|
|
240
|
+
/* @__PURE__ */ o("div", { className: "flex flex-wrap gap-1.5 flex-1", children: e.terms.map((t) => {
|
|
241
|
+
const n = r.includes(t.id);
|
|
242
|
+
return /* @__PURE__ */ o(
|
|
291
243
|
"button",
|
|
292
244
|
{
|
|
293
245
|
type: "button",
|
|
294
|
-
onClick: () =>
|
|
295
|
-
className: `rounded-full border px-2.5 py-0.5 text-[11px] font-medium transition-colors ${
|
|
296
|
-
children:
|
|
246
|
+
onClick: () => Y(e.id, t.id),
|
|
247
|
+
className: `rounded-full border px-2.5 py-0.5 text-[11px] font-medium transition-colors ${n ? "border-primary bg-primary/10 text-primary" : "border-border bg-background text-foreground hover:border-primary/40"}`,
|
|
248
|
+
children: L(t, m)
|
|
297
249
|
},
|
|
298
|
-
|
|
299
|
-
!1,
|
|
300
|
-
{
|
|
301
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
302
|
-
lineNumber: 440,
|
|
303
|
-
columnNumber: 23
|
|
304
|
-
},
|
|
305
|
-
this
|
|
250
|
+
t.id
|
|
306
251
|
);
|
|
307
|
-
}) }
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
lineNumber: 430,
|
|
315
|
-
columnNumber: 15
|
|
316
|
-
}, this);
|
|
317
|
-
}) }, void 0, !1, {
|
|
318
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
319
|
-
lineNumber: 425,
|
|
320
|
-
columnNumber: 9
|
|
321
|
-
}, this)
|
|
322
|
-
] }, void 0, !0, {
|
|
323
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
324
|
-
lineNumber: 413,
|
|
325
|
-
columnNumber: 7
|
|
326
|
-
}, this),
|
|
327
|
-
N.length === 0 ? /* @__PURE__ */ r("div", { className: "rounded border border-dashed p-3 text-xs text-muted-foreground text-center", children: "Select terms above to generate variations." }, void 0, !1, {
|
|
328
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
329
|
-
lineNumber: 463,
|
|
330
|
-
columnNumber: 9
|
|
331
|
-
}, this) : /* @__PURE__ */ r("div", { className: "space-y-2", children: N.map((e) => {
|
|
332
|
-
const o = me({
|
|
333
|
-
currencies: n,
|
|
252
|
+
}) })
|
|
253
|
+
] }, e.id);
|
|
254
|
+
}) })
|
|
255
|
+
] }),
|
|
256
|
+
h.length === 0 ? /* @__PURE__ */ o("div", { className: "rounded border border-dashed p-3 text-xs text-muted-foreground text-center", children: "Select terms above to generate variations." }) : /* @__PURE__ */ o("div", { className: "space-y-2", children: h.map((e) => {
|
|
257
|
+
const r = le({
|
|
258
|
+
currencies: d,
|
|
334
259
|
prices: e.prices || {},
|
|
335
260
|
salePrices: e.sale_prices || {},
|
|
336
261
|
fallbackPrice: e.price,
|
|
337
262
|
fallbackSalePrice: e.sale_price
|
|
338
263
|
});
|
|
339
|
-
return /* @__PURE__ */
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
/* @__PURE__ */
|
|
342
|
-
/* @__PURE__ */
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
/* @__PURE__ */ r("span", { className: "text-xs text-muted-foreground", children: e.selected_options.map((s) => `${s.attribute_name}: ${s.term_value}`).join(" · ") }, void 0, !1, {
|
|
348
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
349
|
-
lineNumber: 483,
|
|
350
|
-
columnNumber: 21
|
|
351
|
-
}, this)
|
|
352
|
-
] }, void 0, !0, {
|
|
353
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
354
|
-
lineNumber: 481,
|
|
355
|
-
columnNumber: 19
|
|
356
|
-
}, this),
|
|
357
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-3 text-xs text-muted-foreground", children: [
|
|
358
|
-
/* @__PURE__ */ r("span", { children: [
|
|
264
|
+
return /* @__PURE__ */ i("div", { className: "rounded border p-3 space-y-2", children: [
|
|
265
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-3", children: [
|
|
266
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
267
|
+
/* @__PURE__ */ o("span", { className: "text-sm font-bold", children: e.label }),
|
|
268
|
+
/* @__PURE__ */ o("span", { className: "text-xs text-muted-foreground", children: e.selected_options.map((t) => `${t.attribute_name}: ${t.term_value}`).join(" · ") })
|
|
269
|
+
] }),
|
|
270
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-3 text-xs text-muted-foreground", children: [
|
|
271
|
+
/* @__PURE__ */ i("span", { children: [
|
|
359
272
|
"Reg: ",
|
|
360
|
-
|
|
361
|
-
] },
|
|
362
|
-
|
|
363
|
-
lineNumber: 490,
|
|
364
|
-
columnNumber: 21
|
|
365
|
-
}, this),
|
|
366
|
-
/* @__PURE__ */ r("span", { children: [
|
|
273
|
+
W(e.price, k?.code || "USD")
|
|
274
|
+
] }),
|
|
275
|
+
/* @__PURE__ */ i("span", { children: [
|
|
367
276
|
"Sale:",
|
|
368
277
|
" ",
|
|
369
|
-
e.sale_price !== null && e.sale_price !== void 0 ?
|
|
370
|
-
] }
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
columnNumber: 19
|
|
379
|
-
}, this)
|
|
380
|
-
] }, void 0, !0, {
|
|
381
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
382
|
-
lineNumber: 480,
|
|
383
|
-
columnNumber: 17
|
|
384
|
-
}, this),
|
|
385
|
-
/* @__PURE__ */ r("div", { className: "grid grid-cols-3 gap-2.5", children: [
|
|
386
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
387
|
-
/* @__PURE__ */ r(y, { htmlFor: `variant-sku-${e.combination_key}`, className: "text-xs uppercase font-bold text-muted-foreground tracking-wider shrink-0", children: "SKU" }, void 0, !1, {
|
|
388
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
389
|
-
lineNumber: 503,
|
|
390
|
-
columnNumber: 21
|
|
391
|
-
}, this),
|
|
392
|
-
/* @__PURE__ */ r(
|
|
393
|
-
B,
|
|
278
|
+
e.sale_price !== null && e.sale_price !== void 0 ? W(e.sale_price, k?.code || "USD") : "—"
|
|
279
|
+
] })
|
|
280
|
+
] })
|
|
281
|
+
] }),
|
|
282
|
+
/* @__PURE__ */ i("div", { className: "grid grid-cols-3 gap-2.5", children: [
|
|
283
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
284
|
+
/* @__PURE__ */ o(P, { htmlFor: `variant-sku-${e.combination_key}`, className: "text-xs uppercase font-bold text-muted-foreground tracking-wider shrink-0", children: "SKU" }),
|
|
285
|
+
/* @__PURE__ */ o(
|
|
286
|
+
U,
|
|
394
287
|
{
|
|
395
288
|
id: `variant-sku-${e.combination_key}`,
|
|
396
289
|
value: e.sku,
|
|
397
|
-
onChange: (
|
|
290
|
+
onChange: (t) => C(e.combination_key, "sku", t.target.value),
|
|
398
291
|
placeholder: "SKU",
|
|
399
292
|
className: "h-8 text-sm font-mono"
|
|
400
|
-
}
|
|
401
|
-
void 0,
|
|
402
|
-
!1,
|
|
403
|
-
{
|
|
404
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
405
|
-
lineNumber: 504,
|
|
406
|
-
columnNumber: 21
|
|
407
|
-
},
|
|
408
|
-
this
|
|
293
|
+
}
|
|
409
294
|
)
|
|
410
|
-
] },
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
416
|
-
/* @__PURE__ */ r(y, { htmlFor: `variant-upc-${e.combination_key}`, className: "text-xs uppercase font-bold text-muted-foreground tracking-wider shrink-0", children: "UPC" }, void 0, !1, {
|
|
417
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
418
|
-
lineNumber: 515,
|
|
419
|
-
columnNumber: 21
|
|
420
|
-
}, this),
|
|
421
|
-
/* @__PURE__ */ r(
|
|
422
|
-
B,
|
|
295
|
+
] }),
|
|
296
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
297
|
+
/* @__PURE__ */ o(P, { htmlFor: `variant-upc-${e.combination_key}`, className: "text-xs uppercase font-bold text-muted-foreground tracking-wider shrink-0", children: "UPC" }),
|
|
298
|
+
/* @__PURE__ */ o(
|
|
299
|
+
U,
|
|
423
300
|
{
|
|
424
301
|
id: `variant-upc-${e.combination_key}`,
|
|
425
302
|
value: e.upc ?? "",
|
|
426
|
-
onChange: (
|
|
303
|
+
onChange: (t) => C(e.combination_key, "upc", t.target.value),
|
|
427
304
|
placeholder: "—",
|
|
428
305
|
className: "h-8 text-sm font-mono"
|
|
429
|
-
}
|
|
430
|
-
void 0,
|
|
431
|
-
!1,
|
|
432
|
-
{
|
|
433
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
434
|
-
lineNumber: 516,
|
|
435
|
-
columnNumber: 21
|
|
436
|
-
},
|
|
437
|
-
this
|
|
306
|
+
}
|
|
438
307
|
)
|
|
439
|
-
] },
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
445
|
-
/* @__PURE__ */ r(y, { htmlFor: `variant-stock-${e.combination_key}`, className: "text-xs uppercase font-bold text-muted-foreground tracking-wider shrink-0", children: "Qty" }, void 0, !1, {
|
|
446
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
447
|
-
lineNumber: 527,
|
|
448
|
-
columnNumber: 21
|
|
449
|
-
}, this),
|
|
450
|
-
/* @__PURE__ */ r(
|
|
451
|
-
B,
|
|
308
|
+
] }),
|
|
309
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
310
|
+
/* @__PURE__ */ o(P, { htmlFor: `variant-stock-${e.combination_key}`, className: "text-xs uppercase font-bold text-muted-foreground tracking-wider shrink-0", children: "Qty" }),
|
|
311
|
+
/* @__PURE__ */ o(
|
|
312
|
+
U,
|
|
452
313
|
{
|
|
453
314
|
id: `variant-stock-${e.combination_key}`,
|
|
454
315
|
type: "number",
|
|
455
316
|
min: "0",
|
|
456
317
|
value: e.stock_quantity,
|
|
457
|
-
onChange: (
|
|
318
|
+
onChange: (t) => C(
|
|
458
319
|
e.combination_key,
|
|
459
320
|
"stock_quantity",
|
|
460
|
-
|
|
321
|
+
t.target.value
|
|
461
322
|
),
|
|
462
323
|
className: "h-8 text-sm font-mono w-20"
|
|
463
|
-
}
|
|
464
|
-
void 0,
|
|
465
|
-
!1,
|
|
466
|
-
{
|
|
467
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
468
|
-
lineNumber: 528,
|
|
469
|
-
columnNumber: 21
|
|
470
|
-
},
|
|
471
|
-
this
|
|
324
|
+
}
|
|
472
325
|
)
|
|
473
|
-
] }
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
columnNumber: 19
|
|
477
|
-
}, this)
|
|
478
|
-
] }, void 0, !0, {
|
|
479
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
480
|
-
lineNumber: 501,
|
|
481
|
-
columnNumber: 17
|
|
482
|
-
}, this),
|
|
483
|
-
/* @__PURE__ */ r(
|
|
326
|
+
] })
|
|
327
|
+
] }),
|
|
328
|
+
/* @__PURE__ */ o(
|
|
484
329
|
oe,
|
|
485
330
|
{
|
|
486
331
|
idPrefix: `variant-${e.combination_key}`,
|
|
487
|
-
currencies:
|
|
488
|
-
prices:
|
|
489
|
-
salePrices:
|
|
490
|
-
managedCurrencyCodes:
|
|
491
|
-
onPriceChange: (
|
|
332
|
+
currencies: d,
|
|
333
|
+
prices: r.prices,
|
|
334
|
+
salePrices: r.salePrices,
|
|
335
|
+
managedCurrencyCodes: N,
|
|
336
|
+
onPriceChange: (t, n) => V(
|
|
492
337
|
e.combination_key,
|
|
493
|
-
|
|
338
|
+
t,
|
|
494
339
|
"prices",
|
|
495
|
-
|
|
340
|
+
n
|
|
496
341
|
),
|
|
497
|
-
onSalePriceChange: (
|
|
342
|
+
onSalePriceChange: (t, n) => V(
|
|
498
343
|
e.combination_key,
|
|
499
|
-
|
|
344
|
+
t,
|
|
500
345
|
"sale_prices",
|
|
501
|
-
|
|
346
|
+
n
|
|
502
347
|
),
|
|
503
|
-
onAutoFill: () =>
|
|
504
|
-
helperText:
|
|
505
|
-
trailing: /* @__PURE__ */
|
|
506
|
-
|
|
348
|
+
onAutoFill: () => ee(e.combination_key),
|
|
349
|
+
helperText: N.length > 0 ? `Store-managed currencies derive from ${k?.code || "the base currency"}.` : void 0,
|
|
350
|
+
trailing: /* @__PURE__ */ o(
|
|
351
|
+
se,
|
|
507
352
|
{
|
|
508
353
|
idPrefix: `variant-${e.combination_key}`,
|
|
509
354
|
startAt: e.sale_start_at,
|
|
510
355
|
endAt: e.sale_end_at,
|
|
511
|
-
onChange: (
|
|
356
|
+
onChange: (t, n) => Z(e.combination_key, t, n),
|
|
512
357
|
bare: !0
|
|
513
|
-
}
|
|
514
|
-
void 0,
|
|
515
|
-
!1,
|
|
516
|
-
{
|
|
517
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
518
|
-
lineNumber: 575,
|
|
519
|
-
columnNumber: 21
|
|
520
|
-
},
|
|
521
|
-
this
|
|
358
|
+
}
|
|
522
359
|
)
|
|
523
|
-
}
|
|
524
|
-
void 0,
|
|
525
|
-
!1,
|
|
526
|
-
{
|
|
527
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
528
|
-
lineNumber: 546,
|
|
529
|
-
columnNumber: 17
|
|
530
|
-
},
|
|
531
|
-
this
|
|
360
|
+
}
|
|
532
361
|
),
|
|
533
|
-
/* @__PURE__ */
|
|
534
|
-
e.main_image_url && /* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-3 pt-1.5 border-t border-muted/30", children: [
|
|
363
|
+
e.main_image_url && /* @__PURE__ */ o("div", { className: "h-9 w-9 overflow-hidden rounded border bg-background shrink-0", children: /* @__PURE__ */ o(
|
|
535
364
|
"img",
|
|
536
365
|
{
|
|
537
366
|
src: e.main_image_url,
|
|
538
367
|
alt: `${e.label} image`,
|
|
539
368
|
className: "h-full w-full object-cover"
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
545
|
-
lineNumber: 591,
|
|
546
|
-
columnNumber: 23
|
|
547
|
-
},
|
|
548
|
-
this
|
|
549
|
-
) }, void 0, !1, {
|
|
550
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
551
|
-
lineNumber: 590,
|
|
552
|
-
columnNumber: 21
|
|
553
|
-
}, this),
|
|
554
|
-
/* @__PURE__ */ r("span", { className: "text-xs uppercase font-bold text-muted-foreground tracking-wider shrink-0", children: "Image" }, void 0, !1, {
|
|
555
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
556
|
-
lineNumber: 598,
|
|
557
|
-
columnNumber: 19
|
|
558
|
-
}, this),
|
|
559
|
-
x.length > 0 ? /* @__PURE__ */ r(
|
|
369
|
+
}
|
|
370
|
+
) }),
|
|
371
|
+
/* @__PURE__ */ o("span", { className: "text-xs uppercase font-bold text-muted-foreground tracking-wider shrink-0", children: "Image" }),
|
|
372
|
+
x.length > 0 ? /* @__PURE__ */ i(
|
|
560
373
|
"select",
|
|
561
374
|
{
|
|
562
375
|
className: "flex h-8 rounded-md border border-input bg-background px-2 py-1 text-sm min-w-[180px]",
|
|
563
376
|
value: e.main_media_id ?? "",
|
|
564
|
-
onChange: (
|
|
565
|
-
if (!
|
|
566
|
-
|
|
377
|
+
onChange: (t) => {
|
|
378
|
+
if (!t.target.value) {
|
|
379
|
+
j(e.combination_key);
|
|
567
380
|
return;
|
|
568
381
|
}
|
|
569
|
-
|
|
382
|
+
te(e.combination_key, t.target.value);
|
|
570
383
|
},
|
|
571
384
|
children: [
|
|
572
|
-
/* @__PURE__ */
|
|
573
|
-
|
|
574
|
-
lineNumber: 611,
|
|
575
|
-
columnNumber: 23
|
|
576
|
-
}, this),
|
|
577
|
-
x.map((s, i) => /* @__PURE__ */ r("option", { value: s.media_id, children: s.alt?.trim() || `Gallery image ${i + 1}` }, s.media_id, !1, {
|
|
578
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
579
|
-
lineNumber: 613,
|
|
580
|
-
columnNumber: 25
|
|
581
|
-
}, this))
|
|
385
|
+
/* @__PURE__ */ o("option", { value: "", children: "Use parent image" }),
|
|
386
|
+
x.map((t, n) => /* @__PURE__ */ o("option", { value: t.media_id, children: t.alt?.trim() || `Gallery image ${n + 1}` }, t.media_id))
|
|
582
387
|
]
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
588
|
-
lineNumber: 600,
|
|
589
|
-
columnNumber: 21
|
|
590
|
-
},
|
|
591
|
-
this
|
|
592
|
-
) : /* @__PURE__ */ r("span", { className: "text-xs text-muted-foreground", children: "Add gallery images first." }, void 0, !1, {
|
|
593
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
594
|
-
lineNumber: 619,
|
|
595
|
-
columnNumber: 21
|
|
596
|
-
}, this),
|
|
597
|
-
e.main_media_id && /* @__PURE__ */ r(
|
|
598
|
-
T,
|
|
388
|
+
}
|
|
389
|
+
) : /* @__PURE__ */ o("span", { className: "text-xs text-muted-foreground", children: "Add gallery images first." }),
|
|
390
|
+
e.main_media_id && /* @__PURE__ */ o(
|
|
391
|
+
z,
|
|
599
392
|
{
|
|
600
393
|
type: "button",
|
|
601
394
|
variant: "ghost",
|
|
602
395
|
size: "sm",
|
|
603
396
|
className: "h-7 text-xs px-2 text-muted-foreground hover:text-destructive",
|
|
604
|
-
onClick: () =>
|
|
397
|
+
onClick: () => j(e.combination_key),
|
|
605
398
|
children: "Remove"
|
|
606
|
-
}
|
|
607
|
-
void 0,
|
|
608
|
-
!1,
|
|
609
|
-
{
|
|
610
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
611
|
-
lineNumber: 622,
|
|
612
|
-
columnNumber: 21
|
|
613
|
-
},
|
|
614
|
-
this
|
|
399
|
+
}
|
|
615
400
|
)
|
|
616
|
-
] }
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
}, this)
|
|
621
|
-
] }, e.combination_key, !0, {
|
|
622
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
623
|
-
lineNumber: 478,
|
|
624
|
-
columnNumber: 15
|
|
625
|
-
}, this);
|
|
626
|
-
}) }, void 0, !1, {
|
|
627
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
628
|
-
lineNumber: 467,
|
|
629
|
-
columnNumber: 9
|
|
630
|
-
}, this)
|
|
631
|
-
] }, void 0, !0, {
|
|
632
|
-
fileName: "C:/Users/desjardinsn/Desktop/NRH-NextBlock/libs/ecommerce/src/lib/pages/cms/products/components/VariationsEditor.tsx",
|
|
633
|
-
lineNumber: 411,
|
|
634
|
-
columnNumber: 5
|
|
635
|
-
}, this);
|
|
401
|
+
] })
|
|
402
|
+
] }, e.combination_key);
|
|
403
|
+
}) })
|
|
404
|
+
] });
|
|
636
405
|
}
|
|
637
406
|
export {
|
|
638
|
-
|
|
407
|
+
Ne as VariationsEditor
|
|
639
408
|
};
|