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.
@@ -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
- return input.toLowerCase().replace(/\s+/g, "_");
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);
@@ -8,7 +8,7 @@ import {
8
8
  extractDomainWithoutSuffix,
9
9
  generateStoreSlug,
10
10
  sanitizeDomain
11
- } from "./chunk-YIDIKN7A.mjs";
11
+ } from "./chunk-7T4T55F3.mjs";
12
12
 
13
13
  // src/client/get-info.ts
14
14
  import { unique } from "remeda";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-4GPP2KXF.mjs";
4
4
  import {
5
5
  formatPrice
6
- } from "./chunk-YIDIKN7A.mjs";
6
+ } from "./chunk-7T4T55F3.mjs";
7
7
 
8
8
  // src/collections.ts
9
9
  import { filter, isNonNullish } from "remeda";
@@ -2,8 +2,9 @@ import {
2
2
  rateLimitedFetch
3
3
  } from "./chunk-4GPP2KXF.mjs";
4
4
  import {
5
- formatPrice
6
- } from "./chunk-YIDIKN7A.mjs";
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
- const lowercaseOptionName = option.name.toLowerCase();
749
- if (!filterMap[lowercaseOptionName]) {
750
- filterMap[lowercaseOptionName] = /* @__PURE__ */ new Set();
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
- option.values.forEach((value) => {
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
- let set = filterMap[lowercaseOptionName];
756
- if (!set) {
757
- set = /* @__PURE__ */ new Set();
758
- filterMap[lowercaseOptionName] = set;
759
- }
760
- set.add(trimmed.toLowerCase());
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 = (((_c = (_b = product.options) == null ? void 0 : _b[0]) == null ? void 0 : _c.name) || "Option 1").toLowerCase();
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
- set1.add(variant.option1.trim().toLowerCase());
782
+ const normalized = normalizeKey(variant.option1.trim());
783
+ if (normalized) set1.add(normalized);
776
784
  }
777
785
  if (variant.option2) {
778
- const optionName = (((_e = (_d = product.options) == null ? void 0 : _d[1]) == null ? void 0 : _e.name) || "Option 2").toLowerCase();
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
- set2.add(variant.option2.trim().toLowerCase());
794
+ const normalized = normalizeKey(variant.option2.trim());
795
+ if (normalized) set2.add(normalized);
785
796
  }
786
797
  if (variant.option3) {
787
- const optionName = (((_g = (_f = product.options) == null ? void 0 : _f[2]) == null ? void 0 : _g.name) || "Option 3").toLowerCase();
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
- filterMap[optionName].add(variant.option3.trim().toLowerCase());
804
+ const normalized = normalizeKey(variant.option3.trim());
805
+ if (normalized) filterMap[optionName].add(normalized);
792
806
  }
793
807
  });
794
808
  }
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createCollectionOperations
3
- } from "./chunk-RWIOOEQS.mjs";
3
+ } from "./chunk-OALENMRM.mjs";
4
4
  import "./chunk-4GPP2KXF.mjs";
5
- import "./chunk-YIDIKN7A.mjs";
5
+ import "./chunk-7T4T55F3.mjs";
6
6
  export {
7
7
  createCollectionOperations
8
8
  };
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-RWIOOEQS.mjs";
6
+ } from "./chunk-OALENMRM.mjs";
7
7
  import {
8
8
  createProductOperations
9
- } from "./chunk-ISOBE3NA.mjs";
9
+ } from "./chunk-SAGZXYF6.mjs";
10
10
  import {
11
11
  createShopOperations,
12
12
  getInfoForShop
13
- } from "./chunk-X5KZU6K4.mjs";
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-YIDIKN7A.mjs";
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
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createProductOperations
3
- } from "./chunk-ISOBE3NA.mjs";
3
+ } from "./chunk-SAGZXYF6.mjs";
4
4
  import "./chunk-4GPP2KXF.mjs";
5
- import "./chunk-YIDIKN7A.mjs";
5
+ import "./chunk-7T4T55F3.mjs";
6
6
  export {
7
7
  createProductOperations
8
8
  };
package/dist/store.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createShopOperations
3
- } from "./chunk-X5KZU6K4.mjs";
3
+ } from "./chunk-EVJ2GFZS.mjs";
4
4
  import "./chunk-4GPP2KXF.mjs";
5
5
  import "./chunk-SBHTEKLB.mjs";
6
- import "./chunk-YIDIKN7A.mjs";
6
+ import "./chunk-7T4T55F3.mjs";
7
7
  export {
8
8
  createShopOperations
9
9
  };
@@ -10,7 +10,7 @@ import {
10
10
  normalizeKey,
11
11
  safeParseDate,
12
12
  sanitizeDomain
13
- } from "../chunk-YIDIKN7A.mjs";
13
+ } from "../chunk-7T4T55F3.mjs";
14
14
  export {
15
15
  buildVariantKey,
16
16
  buildVariantOptionsMap,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shop-client",
3
- "version": "3.25.0",
3
+ "version": "3.26.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.mjs",