shop-client 3.9.1 → 3.9.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.
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-2MF53V33.js";
4
4
  import {
5
5
  detectShopCountry
6
- } from "./chunk-ROH545KI.js";
6
+ } from "./chunk-QUDGES3A.js";
7
7
  import {
8
8
  extractDomainWithoutSuffix,
9
9
  generateStoreSlug,
@@ -33,40 +33,6 @@ var COUNTRY_CODES = {
33
33
  "+7": "RU"
34
34
  // Russia
35
35
  };
36
- var CURRENCY_SYMBOLS = {
37
- Rs: "IN",
38
- // India
39
- "\u20B9": "IN",
40
- // India
41
- $: "US",
42
- // United States (primary, though many countries use $)
43
- CA$: "CA",
44
- // Canada
45
- A$: "AU",
46
- // Australia
47
- "\xA3": "GB",
48
- // United Kingdom
49
- "\u20AC": "EU",
50
- // European Union (not a country code, but commonly used)
51
- AED: "AE",
52
- // United Arab Emirates
53
- "\u20A9": "KR",
54
- // South Korea
55
- "\xA5": "JP"
56
- // Japan (primary, though China also uses ¥)
57
- };
58
- var CURRENCY_SYMBOL_TO_CODE = {
59
- Rs: "INR",
60
- "\u20B9": "INR",
61
- $: "USD",
62
- CA$: "CAD",
63
- A$: "AUD",
64
- "\xA3": "GBP",
65
- "\u20AC": "EUR",
66
- AED: "AED",
67
- "\u20A9": "KRW",
68
- "\xA5": "JPY"
69
- };
70
36
  var CURRENCY_CODE_TO_COUNTRY = {
71
37
  INR: "IN",
72
38
  USD: "US",
@@ -86,54 +52,9 @@ function scoreCountry(countryScores, country, weight, reason) {
86
52
  countryScores[country].reasons.push(reason);
87
53
  }
88
54
  async function detectShopCountry(html) {
89
- var _a, _b;
55
+ var _a;
90
56
  const countryScores = {};
91
57
  let detectedCurrencyCode;
92
- const shopifyFeaturesMatch = html.match(
93
- /<script[^>]+id=["']shopify-features["'][^>]*>([\s\S]*?)<\/script>/
94
- );
95
- if (shopifyFeaturesMatch) {
96
- try {
97
- const json = shopifyFeaturesMatch[1];
98
- if (!json) {
99
- } else {
100
- const data = JSON.parse(json);
101
- if (data.country)
102
- scoreCountry(
103
- countryScores,
104
- data.country,
105
- 1,
106
- "shopify-features.country"
107
- );
108
- if ((_a = data.locale) == null ? void 0 : _a.includes("-")) {
109
- const [, localeCountry] = data.locale.split("-");
110
- if (localeCountry) {
111
- scoreCountry(
112
- countryScores,
113
- localeCountry.toUpperCase(),
114
- 0.7,
115
- "shopify-features.locale"
116
- );
117
- }
118
- }
119
- if (data.moneyFormat) {
120
- for (const symbol in CURRENCY_SYMBOLS) {
121
- if (data.moneyFormat.includes(symbol)) {
122
- const iso = CURRENCY_SYMBOLS[symbol];
123
- if (typeof iso === "string") {
124
- scoreCountry(countryScores, iso, 0.6, "moneyFormat symbol");
125
- }
126
- const code = CURRENCY_SYMBOL_TO_CODE[symbol];
127
- if (!detectedCurrencyCode && typeof code === "string") {
128
- detectedCurrencyCode = code;
129
- }
130
- }
131
- }
132
- }
133
- }
134
- } catch (_error) {
135
- }
136
- }
137
58
  const currencyJsonMatch = html.match(/Shopify\.currency\s*=\s*(\{[^}]*\})/);
138
59
  if (currencyJsonMatch) {
139
60
  try {
@@ -178,7 +99,7 @@ async function detectShopCountry(html) {
178
99
  const phones = html.match(/\+\d{1,3}[\s\-()0-9]{5,}/g);
179
100
  if (phones) {
180
101
  for (const phone of phones) {
181
- const prefix = (_b = phone.match(/^\+\d{1,3}/)) == null ? void 0 : _b[0];
102
+ const prefix = (_a = phone.match(/^\+\d{1,3}/)) == null ? void 0 : _a[0];
182
103
  if (prefix && COUNTRY_CODES[prefix])
183
104
  scoreCountry(
184
105
  countryScores,
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  createStoreOperations,
12
12
  getInfoForStore
13
- } from "./chunk-V52MFQZE.js";
13
+ } from "./chunk-DJQEZNHG.js";
14
14
  import {
15
15
  classifyProduct,
16
16
  determineStoreType,
@@ -22,7 +22,7 @@ import {
22
22
  } from "./chunk-2MF53V33.js";
23
23
  import {
24
24
  detectShopCountry
25
- } from "./chunk-ROH545KI.js";
25
+ } from "./chunk-QUDGES3A.js";
26
26
  import {
27
27
  buildVariantOptionsMap,
28
28
  calculateDiscount,
package/dist/store.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createStoreOperations
3
- } from "./chunk-V52MFQZE.js";
3
+ } from "./chunk-DJQEZNHG.js";
4
4
  import "./chunk-2MF53V33.js";
5
- import "./chunk-ROH545KI.js";
5
+ import "./chunk-QUDGES3A.js";
6
6
  import "./chunk-CN7L3BHG.js";
7
7
  export {
8
8
  createStoreOperations
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  detectShopCountry
3
- } from "../chunk-ROH545KI.js";
3
+ } from "../chunk-QUDGES3A.js";
4
4
  export {
5
5
  detectShopCountry
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shop-client",
3
- "version": "3.9.1",
3
+ "version": "3.9.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.mjs",
6
6
  "module": "./dist/index.mjs",