shop-client 3.25.0 → 3.26.0
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/dist/{chunk-YIDIKN7A.mjs → chunk-7T4T55F3.mjs} +2 -1
- package/dist/{chunk-X5KZU6K4.mjs → chunk-EVJ2GFZS.mjs} +1 -1
- package/dist/{chunk-RWIOOEQS.mjs → chunk-OALENMRM.mjs} +1 -1
- package/dist/{chunk-ISOBE3NA.mjs → chunk-SAGZXYF6.mjs} +33 -19
- package/dist/collections.mjs +2 -2
- package/dist/index.mjs +6 -6
- package/dist/products.mjs +2 -2
- package/dist/store.mjs +2 -2
- package/dist/utils/func.mjs +1 -1
- package/package.json +1 -1
|
@@ -86,7 +86,8 @@ function safeParseDate(input) {
|
|
|
86
86
|
return Number.isNaN(d.getTime()) ? void 0 : d;
|
|
87
87
|
}
|
|
88
88
|
function normalizeKey(input) {
|
|
89
|
-
|
|
89
|
+
const ascii = input.normalize("NFKD").replace(/\p{Sc}+/gu, " ").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/ß/g, "ss").replace(/æ/g, "ae").replace(/œ/g, "oe").replace(/ø/g, "o").replace(/ð/g, "d").replace(/þ/g, "th").replace(/đ/g, "d").replace(/ħ/g, "h").replace(/ı/g, "i").replace(/ł/g, "l").replace(/[^\u0020-\u007e]/g, "");
|
|
90
|
+
return ascii.replace(/[^a-z0-9]+/g, "_").replace(/_+/g, "_");
|
|
90
91
|
}
|
|
91
92
|
function buildVariantOptionsMap(optionNames, variants) {
|
|
92
93
|
const keys = optionNames.map(normalizeKey);
|
|
@@ -2,8 +2,9 @@ import {
|
|
|
2
2
|
rateLimitedFetch
|
|
3
3
|
} from "./chunk-4GPP2KXF.mjs";
|
|
4
4
|
import {
|
|
5
|
-
formatPrice
|
|
6
|
-
|
|
5
|
+
formatPrice,
|
|
6
|
+
normalizeKey
|
|
7
|
+
} from "./chunk-7T4T55F3.mjs";
|
|
7
8
|
|
|
8
9
|
// src/products.ts
|
|
9
10
|
import { filter, isNonNullish } from "remeda";
|
|
@@ -745,20 +746,24 @@ function createProductOperations(baseUrl, storeDomain, fetchProducts, productsDt
|
|
|
745
746
|
if (product.variants && product.variants.length > 0) {
|
|
746
747
|
if (product.options && product.options.length > 0) {
|
|
747
748
|
product.options.forEach((option) => {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
749
|
+
var _a;
|
|
750
|
+
const optionKey = option.key || normalizeKey(option.name);
|
|
751
|
+
if (!optionKey) return;
|
|
752
|
+
if (!filterMap[optionKey]) {
|
|
753
|
+
filterMap[optionKey] = /* @__PURE__ */ new Set();
|
|
751
754
|
}
|
|
752
|
-
|
|
755
|
+
const values = ((_a = option.data) == null ? void 0 : _a.length) ? option.data : option.values;
|
|
756
|
+
values.forEach((value) => {
|
|
753
757
|
const trimmed = value == null ? void 0 : value.trim();
|
|
754
|
-
if (trimmed)
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
set
|
|
758
|
+
if (!trimmed) return;
|
|
759
|
+
const normalized = normalizeKey(trimmed);
|
|
760
|
+
if (!normalized) return;
|
|
761
|
+
let set = filterMap[optionKey];
|
|
762
|
+
if (!set) {
|
|
763
|
+
set = /* @__PURE__ */ new Set();
|
|
764
|
+
filterMap[optionKey] = set;
|
|
761
765
|
}
|
|
766
|
+
set.add(normalized);
|
|
762
767
|
});
|
|
763
768
|
});
|
|
764
769
|
}
|
|
@@ -766,29 +771,38 @@ function createProductOperations(baseUrl, storeDomain, fetchProducts, productsDt
|
|
|
766
771
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
767
772
|
if ((_a = product.options) == null ? void 0 : _a.length) return;
|
|
768
773
|
if (variant.option1) {
|
|
769
|
-
const optionName = (
|
|
774
|
+
const optionName = normalizeKey(
|
|
775
|
+
((_c = (_b = product.options) == null ? void 0 : _b[0]) == null ? void 0 : _c.name) || "Option 1"
|
|
776
|
+
);
|
|
770
777
|
let set1 = filterMap[optionName];
|
|
771
778
|
if (!set1) {
|
|
772
779
|
set1 = /* @__PURE__ */ new Set();
|
|
773
780
|
filterMap[optionName] = set1;
|
|
774
781
|
}
|
|
775
|
-
|
|
782
|
+
const normalized = normalizeKey(variant.option1.trim());
|
|
783
|
+
if (normalized) set1.add(normalized);
|
|
776
784
|
}
|
|
777
785
|
if (variant.option2) {
|
|
778
|
-
const optionName = (
|
|
786
|
+
const optionName = normalizeKey(
|
|
787
|
+
((_e = (_d = product.options) == null ? void 0 : _d[1]) == null ? void 0 : _e.name) || "Option 2"
|
|
788
|
+
);
|
|
779
789
|
let set2 = filterMap[optionName];
|
|
780
790
|
if (!set2) {
|
|
781
791
|
set2 = /* @__PURE__ */ new Set();
|
|
782
792
|
filterMap[optionName] = set2;
|
|
783
793
|
}
|
|
784
|
-
|
|
794
|
+
const normalized = normalizeKey(variant.option2.trim());
|
|
795
|
+
if (normalized) set2.add(normalized);
|
|
785
796
|
}
|
|
786
797
|
if (variant.option3) {
|
|
787
|
-
const optionName = (
|
|
798
|
+
const optionName = normalizeKey(
|
|
799
|
+
((_g = (_f = product.options) == null ? void 0 : _f[2]) == null ? void 0 : _g.name) || "Option 3"
|
|
800
|
+
);
|
|
788
801
|
if (!filterMap[optionName]) {
|
|
789
802
|
filterMap[optionName] = /* @__PURE__ */ new Set();
|
|
790
803
|
}
|
|
791
|
-
|
|
804
|
+
const normalized = normalizeKey(variant.option3.trim());
|
|
805
|
+
if (normalized) filterMap[optionName].add(normalized);
|
|
792
806
|
}
|
|
793
807
|
});
|
|
794
808
|
}
|
package/dist/collections.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
} from "./chunk-W4SF6W2P.mjs";
|
|
4
4
|
import {
|
|
5
5
|
createCollectionOperations
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OALENMRM.mjs";
|
|
7
7
|
import {
|
|
8
8
|
createProductOperations
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SAGZXYF6.mjs";
|
|
10
10
|
import {
|
|
11
11
|
createShopOperations,
|
|
12
12
|
getInfoForShop
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-EVJ2GFZS.mjs";
|
|
14
14
|
import {
|
|
15
15
|
classifyProduct,
|
|
16
16
|
determineStoreType,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
normalizeKey,
|
|
35
35
|
safeParseDate,
|
|
36
36
|
sanitizeDomain
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-7T4T55F3.mjs";
|
|
38
38
|
|
|
39
39
|
// src/ai/determine-store-type.ts
|
|
40
40
|
async function determineStoreTypeForStore(args) {
|
|
@@ -236,7 +236,7 @@ function mapProductsDto(products, ctx, options) {
|
|
|
236
236
|
}));
|
|
237
237
|
const optionsFull = product.options.map((option) => ({
|
|
238
238
|
key: normalizeKey(option.name),
|
|
239
|
-
data: option.values,
|
|
239
|
+
data: option.values.map(normalizeKey),
|
|
240
240
|
name: option.name,
|
|
241
241
|
position: option.position,
|
|
242
242
|
values: option.values
|
|
@@ -369,7 +369,7 @@ function mapProductDto(product, ctx, options) {
|
|
|
369
369
|
}));
|
|
370
370
|
const optionsFull = product.options.map((option) => ({
|
|
371
371
|
key: normalizeKey(option.name),
|
|
372
|
-
data: option.values,
|
|
372
|
+
data: option.values.map(normalizeKey),
|
|
373
373
|
name: option.name,
|
|
374
374
|
position: option.position,
|
|
375
375
|
values: option.values
|
package/dist/products.mjs
CHANGED
package/dist/store.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createShopOperations
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EVJ2GFZS.mjs";
|
|
4
4
|
import "./chunk-4GPP2KXF.mjs";
|
|
5
5
|
import "./chunk-SBHTEKLB.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-7T4T55F3.mjs";
|
|
7
7
|
export {
|
|
8
8
|
createShopOperations
|
|
9
9
|
};
|
package/dist/utils/func.mjs
CHANGED