@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,72 +1,72 @@
|
|
|
1
|
-
import { normalizeSalePriceMap as S, normalizePriceMap as g, isSaleWindowActive as
|
|
1
|
+
import { normalizeSalePriceMap as S, normalizePriceMap as g, isSaleWindowActive as B } from "./currency.es.js";
|
|
2
2
|
function p(e) {
|
|
3
|
-
return !e || typeof e != "object" || Array.isArray(e) ? null : Object.entries(e).reduce((
|
|
3
|
+
return !e || typeof e != "object" || Array.isArray(e) ? null : Object.entries(e).reduce((n, [i, t]) => (typeof t == "string" && t.trim() && (n[i] = t.trim()), n), {});
|
|
4
4
|
}
|
|
5
|
-
function f(e,
|
|
6
|
-
return !i || !
|
|
5
|
+
function f(e, n, i) {
|
|
6
|
+
return !i || !n ? e : n[i]?.trim() || e;
|
|
7
7
|
}
|
|
8
|
-
function j(e,
|
|
9
|
-
return f(e.name, e.name_translations,
|
|
8
|
+
function j(e, n) {
|
|
9
|
+
return f(e.name, e.name_translations, n);
|
|
10
10
|
}
|
|
11
|
-
function L(e,
|
|
12
|
-
return f(e.value, e.value_translations,
|
|
11
|
+
function L(e, n) {
|
|
12
|
+
return f(e.value, e.value_translations, n);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function I(e) {
|
|
15
15
|
return e ? e.startsWith("http") ? e : process.env.NEXT_PUBLIC_R2_BASE_URL ? `${process.env.NEXT_PUBLIC_R2_BASE_URL}/${e}` : process.env.NEXT_PUBLIC_SUPABASE_URL ? `${process.env.NEXT_PUBLIC_SUPABASE_URL}/storage/v1/object/public/media/${e}` : e : null;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function M(e) {
|
|
18
18
|
return e.toLowerCase().trim().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
19
19
|
}
|
|
20
20
|
function y(e) {
|
|
21
21
|
return [...e].sort().join("__");
|
|
22
22
|
}
|
|
23
23
|
function T(e) {
|
|
24
|
-
return e.map((
|
|
24
|
+
return e.map((n) => n.term_value).join(" / ");
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function U(e) {
|
|
27
27
|
return e.length === 0 ? [] : e.reduce(
|
|
28
|
-
(
|
|
28
|
+
(n, i) => n.flatMap((t) => i.map((s) => [...t, s])),
|
|
29
29
|
[[]]
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
function P(e) {
|
|
33
33
|
const {
|
|
34
|
-
baseSku:
|
|
34
|
+
baseSku: n,
|
|
35
35
|
basePrice: i,
|
|
36
36
|
basePrices: t = {},
|
|
37
37
|
baseSalePrice: s = null,
|
|
38
|
-
baseSalePrices:
|
|
39
|
-
selectedAttributes:
|
|
38
|
+
baseSalePrices: r = {},
|
|
39
|
+
selectedAttributes: a,
|
|
40
40
|
previousVariants: c = []
|
|
41
41
|
} = e;
|
|
42
|
-
if (
|
|
42
|
+
if (a.length === 0 || a.some((o) => o.terms.length === 0))
|
|
43
43
|
return [];
|
|
44
|
-
const
|
|
45
|
-
c.map((
|
|
46
|
-
),
|
|
47
|
-
(
|
|
48
|
-
attribute_id:
|
|
49
|
-
attribute_name:
|
|
44
|
+
const u = new Map(
|
|
45
|
+
c.map((o) => [o.combination_key, o])
|
|
46
|
+
), l = a.map(
|
|
47
|
+
(o) => o.terms.map((d) => ({
|
|
48
|
+
attribute_id: o.attribute_id,
|
|
49
|
+
attribute_name: o.attribute_name,
|
|
50
50
|
term: d
|
|
51
51
|
}))
|
|
52
52
|
);
|
|
53
|
-
return
|
|
54
|
-
const d =
|
|
53
|
+
return U(l).map((o) => {
|
|
54
|
+
const d = o.map(({ attribute_id: m, attribute_name: E, term: b }) => ({
|
|
55
55
|
attribute_id: m,
|
|
56
|
-
attribute_name:
|
|
56
|
+
attribute_name: E,
|
|
57
57
|
term_id: b.id,
|
|
58
58
|
term_value: b.value,
|
|
59
59
|
term_slug: b.slug
|
|
60
|
-
})),
|
|
60
|
+
})), h = d.map((m) => m.term_id), A = y(h), _ = u.get(A), v = d.map((m) => (m.term_slug ? m.term_slug : M(m.term_value)).toUpperCase()).filter(Boolean).join("-");
|
|
61
61
|
return {
|
|
62
62
|
id: _?.id,
|
|
63
|
-
combination_key:
|
|
64
|
-
sku: _?.sku || [
|
|
63
|
+
combination_key: A,
|
|
64
|
+
sku: _?.sku || [n.trim(), v].filter(Boolean).join("-"),
|
|
65
65
|
upc: _?.upc ?? null,
|
|
66
66
|
price: _?.price ?? i,
|
|
67
67
|
prices: _?.prices ?? g(t),
|
|
68
68
|
sale_price: _?.sale_price ?? s,
|
|
69
|
-
sale_prices: _?.sale_prices ?? S(
|
|
69
|
+
sale_prices: _?.sale_prices ?? S(r),
|
|
70
70
|
// IMPORTANT (future agents): every per-variant field a user can edit MUST
|
|
71
71
|
// be carried over from `previous` here. This function re-runs whenever the
|
|
72
72
|
// variations editor mounts or attributes/base prices change, replacing the
|
|
@@ -78,151 +78,166 @@ function P(e) {
|
|
|
78
78
|
stock_quantity: _?.stock_quantity ?? 0,
|
|
79
79
|
main_media_id: _?.main_media_id ?? null,
|
|
80
80
|
main_image_url: _?.main_image_url ?? null,
|
|
81
|
-
attribute_term_ids:
|
|
81
|
+
attribute_term_ids: h,
|
|
82
82
|
selected_options: d,
|
|
83
83
|
label: T(d)
|
|
84
84
|
};
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
const
|
|
87
|
+
function V(e) {
|
|
88
|
+
const n = {};
|
|
89
89
|
for (const i of e)
|
|
90
90
|
for (const t of i.selected_options ?? []) {
|
|
91
|
-
const s = new Set(
|
|
92
|
-
s.add(t.term_id),
|
|
91
|
+
const s = new Set(n[t.attribute_id] ?? []);
|
|
92
|
+
s.add(t.term_id), n[t.attribute_id] = [...s];
|
|
93
93
|
}
|
|
94
|
-
return
|
|
94
|
+
return n;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
const i = Object.values(
|
|
96
|
+
function N(e, n) {
|
|
97
|
+
const i = Object.values(n).filter(Boolean);
|
|
98
98
|
return i.length === 0 ? null : e.find(
|
|
99
99
|
(t) => t.attribute_term_ids.length === i.length && i.every((s) => t.attribute_term_ids.includes(s))
|
|
100
100
|
) ?? null;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function k(e, n, i) {
|
|
103
103
|
const t = /* @__PURE__ */ new Set();
|
|
104
104
|
for (const s of e) {
|
|
105
|
-
if (!Object.entries(i).every(([c,
|
|
105
|
+
if (!Object.entries(i).every(([c, u]) => !u || c === n ? !0 : s.attribute_term_ids.includes(u)))
|
|
106
106
|
continue;
|
|
107
|
-
const
|
|
108
|
-
|
|
107
|
+
const a = s.selected_options.find((c) => c.attribute_id === n);
|
|
108
|
+
a && t.add(a.term_id);
|
|
109
109
|
}
|
|
110
110
|
return t;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
const i =
|
|
112
|
+
function O(e, n) {
|
|
113
|
+
const i = n.find((t) => t.stock_quantity > 0) ?? n[0] ?? null;
|
|
114
114
|
return i ? i.selected_options.reduce((t, s) => (t[s.attribute_id] = s.term_id, t), {}) : e.reduce((t, s) => {
|
|
115
|
-
const
|
|
116
|
-
return
|
|
115
|
+
const r = s.terms[0];
|
|
116
|
+
return r && (t[s.id] = r.id), t;
|
|
117
117
|
}, {});
|
|
118
118
|
}
|
|
119
|
-
function w(e,
|
|
119
|
+
function w(e, n, i, t, s) {
|
|
120
|
+
const r = { [t]: s };
|
|
121
|
+
for (const a of e) {
|
|
122
|
+
if (a.id === t)
|
|
123
|
+
continue;
|
|
124
|
+
const c = k(n, a.id, r), u = i[a.id];
|
|
125
|
+
if (u && c.has(u)) {
|
|
126
|
+
r[a.id] = u;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const l = a.terms.find((o) => c.has(o.id));
|
|
130
|
+
l && (r[a.id] = l.id);
|
|
131
|
+
}
|
|
132
|
+
return r;
|
|
133
|
+
}
|
|
134
|
+
function x(e, n, i) {
|
|
120
135
|
const t = { ...i };
|
|
121
136
|
for (const s of e) {
|
|
122
|
-
const
|
|
123
|
-
if (
|
|
137
|
+
const r = k(n, s.id, t);
|
|
138
|
+
if (r.size === 0) {
|
|
124
139
|
delete t[s.id];
|
|
125
140
|
continue;
|
|
126
141
|
}
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
142
|
+
const a = t[s.id];
|
|
143
|
+
if (a && r.has(a))
|
|
129
144
|
continue;
|
|
130
|
-
const c = s.terms.find((
|
|
145
|
+
const c = s.terms.find((u) => r.has(u.id));
|
|
131
146
|
c && (t[s.id] = c.id);
|
|
132
147
|
}
|
|
133
148
|
return t;
|
|
134
149
|
}
|
|
135
|
-
function
|
|
136
|
-
const i = /* @__PURE__ */ new Map(), t = e.map((
|
|
137
|
-
const
|
|
138
|
-
const
|
|
139
|
-
if (!
|
|
150
|
+
function z(e = [], n) {
|
|
151
|
+
const i = /* @__PURE__ */ new Map(), t = e.map((r) => {
|
|
152
|
+
const a = (r.variant_attribute_mapping || []).map((u) => {
|
|
153
|
+
const l = u.product_attribute_terms, o = l?.product_attributes;
|
|
154
|
+
if (!l || !o)
|
|
140
155
|
return null;
|
|
141
|
-
const d = i.get(
|
|
142
|
-
id:
|
|
156
|
+
const d = i.get(o.id) || {
|
|
157
|
+
id: o.id,
|
|
143
158
|
name: f(
|
|
144
|
-
|
|
145
|
-
p(
|
|
146
|
-
|
|
159
|
+
o.name,
|
|
160
|
+
p(o.name_translations),
|
|
161
|
+
n
|
|
147
162
|
),
|
|
148
|
-
slug:
|
|
149
|
-
name_translations: p(
|
|
163
|
+
slug: o.slug,
|
|
164
|
+
name_translations: p(o.name_translations),
|
|
150
165
|
terms: [],
|
|
151
166
|
_termIds: /* @__PURE__ */ new Set()
|
|
152
167
|
};
|
|
153
|
-
return d._termIds.has(
|
|
154
|
-
id:
|
|
155
|
-
attribute_id:
|
|
168
|
+
return d._termIds.has(l.id) || (d.terms.push({
|
|
169
|
+
id: l.id,
|
|
170
|
+
attribute_id: l.attribute_id,
|
|
156
171
|
value: f(
|
|
157
|
-
|
|
158
|
-
p(
|
|
159
|
-
|
|
172
|
+
l.value,
|
|
173
|
+
p(l.value_translations),
|
|
174
|
+
n
|
|
160
175
|
),
|
|
161
|
-
slug:
|
|
162
|
-
sort_order:
|
|
163
|
-
value_translations: p(
|
|
164
|
-
}), d._termIds.add(
|
|
165
|
-
attribute_id:
|
|
176
|
+
slug: l.slug,
|
|
177
|
+
sort_order: l.sort_order ?? null,
|
|
178
|
+
value_translations: p(l.value_translations)
|
|
179
|
+
}), d._termIds.add(l.id)), i.set(o.id, d), {
|
|
180
|
+
attribute_id: o.id,
|
|
166
181
|
attribute_name: f(
|
|
167
|
-
|
|
168
|
-
p(
|
|
169
|
-
|
|
182
|
+
o.name,
|
|
183
|
+
p(o.name_translations),
|
|
184
|
+
n
|
|
170
185
|
),
|
|
171
|
-
term_id:
|
|
186
|
+
term_id: l.id,
|
|
172
187
|
term_value: f(
|
|
173
|
-
|
|
174
|
-
p(
|
|
175
|
-
|
|
188
|
+
l.value,
|
|
189
|
+
p(l.value_translations),
|
|
190
|
+
n
|
|
176
191
|
),
|
|
177
|
-
term_slug:
|
|
192
|
+
term_slug: l.slug
|
|
178
193
|
};
|
|
179
194
|
}).filter(
|
|
180
|
-
(
|
|
195
|
+
(u) => u !== null
|
|
181
196
|
).sort(
|
|
182
|
-
(
|
|
183
|
-
), c =
|
|
197
|
+
(u, l) => u.attribute_name.localeCompare(l.attribute_name)
|
|
198
|
+
), c = a.map((u) => u.term_id);
|
|
184
199
|
return {
|
|
185
|
-
id:
|
|
200
|
+
id: r.id,
|
|
186
201
|
combination_key: y(c),
|
|
187
|
-
sku:
|
|
188
|
-
upc:
|
|
189
|
-
price:
|
|
190
|
-
prices: g(
|
|
191
|
-
sale_price:
|
|
192
|
-
sale_prices: S(
|
|
193
|
-
sale_start_at:
|
|
194
|
-
sale_end_at:
|
|
195
|
-
scheduled_price:
|
|
196
|
-
scheduled_prices: g(
|
|
197
|
-
scheduled_price_at:
|
|
198
|
-
stock_quantity:
|
|
199
|
-
main_media_id:
|
|
200
|
-
image_url:
|
|
201
|
-
|
|
202
|
+
sku: r.sku,
|
|
203
|
+
upc: r.upc ?? null,
|
|
204
|
+
price: r.price ?? 0,
|
|
205
|
+
prices: g(r.prices),
|
|
206
|
+
sale_price: r.sale_price ?? null,
|
|
207
|
+
sale_prices: S(r.sale_prices),
|
|
208
|
+
sale_start_at: r.sale_start_at ?? null,
|
|
209
|
+
sale_end_at: r.sale_end_at ?? null,
|
|
210
|
+
scheduled_price: r.scheduled_price ?? null,
|
|
211
|
+
scheduled_prices: g(r.scheduled_prices),
|
|
212
|
+
scheduled_price_at: r.scheduled_price_at ?? null,
|
|
213
|
+
stock_quantity: r.stock_quantity ?? 0,
|
|
214
|
+
main_media_id: r.main_media_id ?? null,
|
|
215
|
+
image_url: I(
|
|
216
|
+
r.media?.file_path ?? r.media?.object_key ?? null
|
|
202
217
|
),
|
|
203
218
|
attribute_term_ids: c,
|
|
204
|
-
selected_options:
|
|
205
|
-
label: T(
|
|
219
|
+
selected_options: a,
|
|
220
|
+
label: T(a)
|
|
206
221
|
};
|
|
207
222
|
});
|
|
208
|
-
return { attributes: [...i.values()].map((
|
|
209
|
-
id:
|
|
210
|
-
name:
|
|
211
|
-
slug:
|
|
212
|
-
name_translations:
|
|
213
|
-
terms: [...
|
|
214
|
-
const
|
|
215
|
-
return
|
|
223
|
+
return { attributes: [...i.values()].map((r) => ({
|
|
224
|
+
id: r.id,
|
|
225
|
+
name: r.name,
|
|
226
|
+
slug: r.slug,
|
|
227
|
+
name_translations: r.name_translations,
|
|
228
|
+
terms: [...r.terms].sort((a, c) => {
|
|
229
|
+
const u = a.sort_order ?? Number.MAX_SAFE_INTEGER, l = c.sort_order ?? Number.MAX_SAFE_INTEGER;
|
|
230
|
+
return u !== l ? u - l : a.value.localeCompare(c.value);
|
|
216
231
|
})
|
|
217
|
-
})).sort((
|
|
232
|
+
})).sort((r, a) => r.name.localeCompare(a.name)), variants: t };
|
|
218
233
|
}
|
|
219
|
-
function
|
|
234
|
+
function C(e, n) {
|
|
220
235
|
if (!e.length)
|
|
221
236
|
return null;
|
|
222
|
-
const i = e.map((t) =>
|
|
237
|
+
const i = e.map((t) => B({
|
|
223
238
|
saleStartAt: t.sale_start_at,
|
|
224
239
|
saleEndAt: t.sale_end_at,
|
|
225
|
-
now:
|
|
240
|
+
now: n
|
|
226
241
|
}) && typeof t.sale_price == "number" ? t.sale_price : t.price);
|
|
227
242
|
return {
|
|
228
243
|
min: Math.min(...i),
|
|
@@ -230,16 +245,17 @@ function z(e, r) {
|
|
|
230
245
|
};
|
|
231
246
|
}
|
|
232
247
|
export {
|
|
248
|
+
w as applyVariantSelection,
|
|
233
249
|
y as buildCombinationKey,
|
|
234
250
|
T as buildVariantLabel,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
251
|
+
O as chooseInitialVariantSelections,
|
|
252
|
+
V as extractSelectedTermsByAttribute,
|
|
253
|
+
N as findMatchingVariant,
|
|
238
254
|
P as generateVariantDrafts,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
255
|
+
k as getAvailableTermIdsForAttribute,
|
|
256
|
+
C as getVariantEffectivePriceRange,
|
|
257
|
+
z as mapRawVariantRelations,
|
|
258
|
+
x as normalizeSelectionsToAvailableVariants,
|
|
243
259
|
j as resolveAttributeName,
|
|
244
260
|
L as resolveTermValue,
|
|
245
261
|
f as resolveTranslatedText
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextblock-cms/ecom",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.2",
|
|
4
4
|
"license": "AGPL-3.0-or-later",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
},
|
|
12
12
|
"type": "module",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@nextblock-cms/db": "^0.19.
|
|
15
|
-
"@nextblock-cms/ui": "^0.19.
|
|
16
|
-
"@nextblock-cms/utils": "^0.19.
|
|
14
|
+
"@nextblock-cms/db": "^0.19.2",
|
|
15
|
+
"@nextblock-cms/ui": "^0.19.2",
|
|
16
|
+
"@nextblock-cms/utils": "^0.19.2",
|
|
17
17
|
"@freemius/checkout": "^1.4.1",
|
|
18
18
|
"@freemius/sdk": "^0.3.0",
|
|
19
19
|
"@hookform/resolvers": "^5.2.2",
|