@nextblock-cms/ecom 0.18.6 → 0.18.7
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.
|
@@ -3,7 +3,7 @@ import { syncSharedInventoryForSavedProduct as k } from "./shared-inventory.es.j
|
|
|
3
3
|
import { normalizeCurrencyCode as E } from "@nextblock-cms/utils/utils";
|
|
4
4
|
import { buildPublishedAtOrFilter as M } from "@nextblock-cms/utils";
|
|
5
5
|
const w = (e) => Math.round(e * 100);
|
|
6
|
-
function
|
|
6
|
+
function q(e) {
|
|
7
7
|
return Object.entries(e || {}).reduce(
|
|
8
8
|
(t, [i, r]) => (typeof r == "number" && Number.isFinite(r) && r >= 0 && (t[E(i)] = w(r)), t),
|
|
9
9
|
{}
|
|
@@ -16,8 +16,8 @@ function A(e) {
|
|
|
16
16
|
upc: t.upc ?? null,
|
|
17
17
|
price: w(t.price),
|
|
18
18
|
sale_price: typeof t.sale_price == "number" && !isNaN(t.sale_price) ? w(t.sale_price) : null,
|
|
19
|
-
prices:
|
|
20
|
-
sale_prices:
|
|
19
|
+
prices: q(t.prices),
|
|
20
|
+
sale_prices: q(t.sale_prices),
|
|
21
21
|
sale_start_at: t.sale_start_at ?? null,
|
|
22
22
|
sale_end_at: t.sale_end_at ?? null,
|
|
23
23
|
stock_quantity: t.stock_quantity,
|
|
@@ -42,8 +42,8 @@ function P(e, t) {
|
|
|
42
42
|
metadata: {},
|
|
43
43
|
price: w(e.price),
|
|
44
44
|
sale_price: typeof e.sale_price == "number" && !isNaN(e.sale_price) ? w(e.sale_price) : null,
|
|
45
|
-
prices:
|
|
46
|
-
sale_prices:
|
|
45
|
+
prices: q(e.prices),
|
|
46
|
+
sale_prices: q(e.sale_prices),
|
|
47
47
|
sale_start_at: e.sale_start_at ?? null,
|
|
48
48
|
sale_end_at: e.sale_end_at ?? null,
|
|
49
49
|
freemius_plan_id: e.freemius_plan_id ?? null,
|
|
@@ -144,7 +144,7 @@ async function N(e, {
|
|
|
144
144
|
return { data: [], error: m, count: 0 };
|
|
145
145
|
const y = Array.from(
|
|
146
146
|
new Set(
|
|
147
|
-
(h || []).map((
|
|
147
|
+
(h || []).map((v) => v.product_id).filter(Boolean)
|
|
148
148
|
)
|
|
149
149
|
);
|
|
150
150
|
if (y.length === 0)
|
|
@@ -260,7 +260,8 @@ async function O(e, t, i) {
|
|
|
260
260
|
file_name,
|
|
261
261
|
blur_data_url,
|
|
262
262
|
width,
|
|
263
|
-
height
|
|
263
|
+
height,
|
|
264
|
+
variants
|
|
264
265
|
)
|
|
265
266
|
),
|
|
266
267
|
product_variants (
|
|
@@ -392,8 +393,8 @@ async function B(e, t, i) {
|
|
|
392
393
|
const { data: m } = await e.from("media").select("object_key, variants").eq("id", n).single();
|
|
393
394
|
if (m) {
|
|
394
395
|
const y = [m.object_key];
|
|
395
|
-
m.variants && Array.isArray(m.variants) && m.variants.forEach((
|
|
396
|
-
|
|
396
|
+
m.variants && Array.isArray(m.variants) && m.variants.forEach((v) => {
|
|
397
|
+
v.objectKey && y.push(v.objectKey);
|
|
397
398
|
}), await F(y), await e.from("media").delete().eq("id", n);
|
|
398
399
|
}
|
|
399
400
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextblock-cms/ecom",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.7",
|
|
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.18.
|
|
15
|
-
"@nextblock-cms/ui": "^0.18.
|
|
16
|
-
"@nextblock-cms/utils": "^0.18.
|
|
14
|
+
"@nextblock-cms/db": "^0.18.7",
|
|
15
|
+
"@nextblock-cms/ui": "^0.18.7",
|
|
16
|
+
"@nextblock-cms/utils": "^0.18.7",
|
|
17
17
|
"@freemius/checkout": "^1.4.1",
|
|
18
18
|
"@freemius/sdk": "^0.3.0",
|
|
19
19
|
"@hookform/resolvers": "^5.2.2",
|