@useinsider/guido 3.30.0-beta.02005ef → 3.30.0-beta.0c48424

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.
@@ -87,6 +87,7 @@ interface StoreState {
87
87
  languages: Languages;
88
88
  currencyList: Currency[];
89
89
  filterList: FiltersResponse;
90
+ isCreateDataFetched: boolean;
90
91
  strategies: RrsStrategy[];
91
92
  strategiesLoading: boolean;
92
93
  strategyUrlTemplates: Record<string, string>;
@@ -111,6 +112,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
111
112
  value: string;
112
113
  }[];
113
114
  filterList: FiltersResponse;
115
+ isCreateDataFetched: boolean;
114
116
  strategies: {
115
117
  [x: string]: unknown;
116
118
  strategy_id: number;
@@ -140,6 +142,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
140
142
  value: string;
141
143
  }[];
142
144
  filterList: FiltersResponse;
145
+ isCreateDataFetched: boolean;
143
146
  strategies: {
144
147
  [x: string]: unknown;
145
148
  strategy_id: number;
@@ -169,6 +172,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
169
172
  value: string;
170
173
  }[];
171
174
  filterList: FiltersResponse;
175
+ isCreateDataFetched: boolean;
172
176
  strategies: {
173
177
  [x: string]: unknown;
174
178
  strategy_id: number;
@@ -195,6 +199,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
195
199
  value: string;
196
200
  }[];
197
201
  filterList: FiltersResponse;
202
+ isCreateDataFetched: boolean;
198
203
  strategies: {
199
204
  [x: string]: unknown;
200
205
  strategy_id: number;
@@ -221,6 +226,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
221
226
  value: string;
222
227
  }[];
223
228
  filterList: FiltersResponse;
229
+ isCreateDataFetched: boolean;
224
230
  strategies: {
225
231
  [x: string]: unknown;
226
232
  strategy_id: number;
@@ -248,6 +254,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
248
254
  value: string;
249
255
  }[];
250
256
  filterList: FiltersResponse;
257
+ isCreateDataFetched: boolean;
251
258
  strategies: {
252
259
  [x: string]: unknown;
253
260
  strategy_id: number;
@@ -274,6 +281,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
274
281
  value: string;
275
282
  }[];
276
283
  filterList: FiltersResponse;
284
+ isCreateDataFetched: boolean;
277
285
  strategies: {
278
286
  [x: string]: unknown;
279
287
  strategy_id: number;
@@ -300,6 +308,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
300
308
  value: string;
301
309
  }[];
302
310
  filterList: FiltersResponse;
311
+ isCreateDataFetched: boolean;
303
312
  strategies: {
304
313
  [x: string]: unknown;
305
314
  strategy_id: number;
@@ -329,6 +338,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
329
338
  value: string;
330
339
  }[];
331
340
  filterList: FiltersResponse;
341
+ isCreateDataFetched: boolean;
332
342
  strategies: {
333
343
  [x: string]: unknown;
334
344
  strategy_id: number;
@@ -358,6 +368,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
358
368
  value: string;
359
369
  }[];
360
370
  filterList: FiltersResponse;
371
+ isCreateDataFetched: boolean;
361
372
  strategies: {
362
373
  [x: string]: unknown;
363
374
  strategy_id: number;
@@ -388,6 +399,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
388
399
  value: string;
389
400
  }[];
390
401
  filterList: FiltersResponse;
402
+ isCreateDataFetched: boolean;
391
403
  strategies: {
392
404
  [x: string]: unknown;
393
405
  strategy_id: number;
@@ -417,6 +429,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
417
429
  value: string;
418
430
  }[];
419
431
  filterList: FiltersResponse;
432
+ isCreateDataFetched: boolean;
420
433
  strategies: {
421
434
  [x: string]: unknown;
422
435
  strategy_id: number;
@@ -446,6 +459,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
446
459
  value: string;
447
460
  }[];
448
461
  filterList: FiltersResponse;
462
+ isCreateDataFetched: boolean;
449
463
  strategies: {
450
464
  [x: string]: unknown;
451
465
  strategy_id: number;
@@ -1,129 +1,128 @@
1
- import { isNewPriceFormatRoot as G, ITEMS_PRICE_FORMAT_ATTR as N, currencyPositionFromLocation as Y, ITEMS_CURRENCY_ATTR as U, isCustomCurrencySymbol as B } from "../extensions/Blocks/Items/constants/currency.js";
2
- import { productPairs as k } from "../extensions/Blocks/Items/enums/productEnums.js";
3
- import { escapeReplacement as v } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
4
- import { preserveTextStyles as w } from "./preserveTextStyles.js";
5
- import { protectTableText as X, restoreTableText as j } from "./protectTableText.js";
6
- import { unwrapProductNameLinks as Q } from "./unwrapProductNameLink.js";
7
- const q = {
1
+ import { isNewPriceFormatRoot as W, ITEMS_PRICE_FORMAT_ATTR as w, currencyPositionFromLocation as V, ITEMS_CURRENCY_ATTR as x, isCustomCurrencySymbol as G } from "../extensions/Blocks/Items/constants/currency.js";
2
+ import { productPairs as N } from "../extensions/Blocks/Items/enums/productEnums.js";
3
+ import { preserveTextStyles as H } from "./preserveTextStyles.js";
4
+ import { protectTableText as Y, restoreTableText as B } from "./protectTableText.js";
5
+ import { unwrapProductNameLinks as X } from "./unwrapProductNameLink.js";
6
+ const D = {
8
7
  CART_ITEMS: "ins_apr",
9
8
  BROWSED_ITEMS: "browsed_item",
10
9
  PURCHASED_ITEMS: "purchased_item"
11
- }, W = (r) => r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
12
- function z(r, h, p) {
13
- let u = h;
14
- for (; u > 0 && /\s/.test(r[u - 1]); )
15
- u -= 1;
16
- return p.some((A) => r.endsWith(A, u));
10
+ }, U = (r) => r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
11
+ function v(r, _, u) {
12
+ let l = _;
13
+ for (; l > 0 && /\s/.test(r[l - 1]); )
14
+ l -= 1;
15
+ return u.some((p) => r.endsWith(p, l));
17
16
  }
18
- const J = /(\s)href=(["'])(?:[^"']*#!|#)?\2/gi;
19
- function K(r, h) {
20
- var u;
21
- const p = r.ownerDocument.createTreeWalker(r, NodeFilter.SHOW_COMMENT);
22
- for (let A = p.nextNode(); A; A = p.nextNode())
23
- (u = A.nodeValue) != null && u.includes("[if mso]") && (A.nodeValue = A.nodeValue.replace(J, (L, P) => `${P}href="${h}"`));
17
+ const j = /(\s)href=(["'])(?:[^"']*#!|#)?\2/gi;
18
+ function Q(r, _) {
19
+ var l;
20
+ const u = r.ownerDocument.createTreeWalker(r, NodeFilter.SHOW_COMMENT);
21
+ for (let p = u.nextNode(); p; p = u.nextNode())
22
+ (l = p.nodeValue) != null && l.includes("[if mso]") && (p.nodeValue = p.nodeValue.replace(j, (I, E) => `${E}href="${_}"`));
24
23
  }
25
- function Z(r) {
24
+ function z(r) {
26
25
  return {
27
26
  isFormatted: r.getAttribute("data-formated") === "true",
28
27
  isSinglePrice: r.getAttribute("data-single_price") === "true",
29
- currencyPosition: r.getAttribute(U.POSITION) || "before",
30
- configuredSymbol: (r.getAttribute(U.SYMBOL) || "").trim()
28
+ currencyPosition: r.getAttribute(x.POSITION) || "before",
29
+ configuredSymbol: (r.getAttribute(x.SYMBOL) || "").trim()
31
30
  };
32
31
  }
33
- function tt(r) {
32
+ function J(r) {
34
33
  return {
35
34
  isFormatted: !1,
36
- isSinglePrice: r.getAttribute(N.SINGLE_PRICE) === "true",
37
- currencyPosition: Y(
38
- r.getAttribute(N.ALIGNMENT) ?? void 0
35
+ isSinglePrice: r.getAttribute(w.SINGLE_PRICE) === "true",
36
+ currencyPosition: V(
37
+ r.getAttribute(w.ALIGNMENT) ?? void 0
39
38
  ),
40
- configuredSymbol: (r.getAttribute(N.SYMBOL) || "").trim()
39
+ configuredSymbol: (r.getAttribute(w.SYMBOL) || "").trim()
41
40
  };
42
41
  }
43
- function et(r, h, p) {
44
- const { isFormatted: u, isSinglePrice: A, currencyPosition: L, configuredSymbol: P } = p;
42
+ function K(r, _, u) {
43
+ const { isFormatted: l, isSinglePrice: p, currencyPosition: I, configuredSymbol: E } = u;
45
44
  let y;
46
- A ? y = u ? r.SINGLE_PRICE_FORMATTED : r.SINGLE_PRICE : y = u ? r.PRICE_FORMATTED : r.PRICE;
47
- const E = r.CURRENCY;
48
- let F = `{{${y}_${h}}}`, R = "";
49
- return B(P) ? R = P : E && (R = `{{${E}_${h}}}`), R && (F = L === "after" ? `${F} ${R}` : `${R} ${F}`), F;
45
+ p ? y = l ? r.SINGLE_PRICE_FORMATTED : r.SINGLE_PRICE : y = l ? r.PRICE_FORMATTED : r.PRICE;
46
+ const b = r.CURRENCY;
47
+ let S = `{{${y}_${_}}}`, o = "";
48
+ return G(E) ? o = E : b && (o = `{{${b}_${_}}}`), o && (S = I === "after" ? `${S} ${o}` : `${o} ${S}`), S;
50
49
  }
51
- function at(r) {
52
- const h = W(X(r)), p = new DOMParser().parseFromString(h, "text/html");
53
- Q(p);
54
- const u = k.PAIRS_FOR_EXTENSION;
55
- Object.entries(u).forEach(([o, T]) => {
56
- p.querySelectorAll(".ins-product-td").forEach((n) => {
57
- const S = n.getAttribute("data-number") || "1", I = n.getAttribute("data-type") || "CART_ITEMS";
50
+ function nt(r) {
51
+ const _ = U(Y(r)), u = new DOMParser().parseFromString(_, "text/html");
52
+ X(u);
53
+ const l = N.PAIRS_FOR_EXTENSION;
54
+ Object.entries(l).forEach(([o, R]) => {
55
+ u.querySelectorAll(".ins-product-td").forEach((n) => {
56
+ const m = n.getAttribute("data-number") || "1", C = n.getAttribute("data-type") || "CART_ITEMS";
58
57
  n.querySelectorAll(`[product-attr="${o}"]`).forEach((t) => {
59
- var g, M, x, D;
60
- const m = t.getAttribute("data-type") || I, c = t.getAttribute("data-number") || S, f = T[m];
61
- if (f)
58
+ var h, L, k, O;
59
+ const P = t.getAttribute("data-type") || C, c = t.getAttribute("data-number") || m, d = R[P];
60
+ if (d)
62
61
  switch (o) {
63
62
  case "imageSrc": {
64
63
  let e = null, i = null;
65
64
  if (t.tagName === "IMG" ? (e = t, i = e.closest("a")) : (e = t.querySelector("img"), i = t.querySelector("a") || t.closest("a")), !e)
66
65
  break;
67
- const d = f.DEFAULT, a = f.ATTR;
68
- if (d && e.src) {
69
- const l = e.src;
70
- d.some((C) => {
71
- const $ = C.split("/").pop() || "", V = l.split("/").pop() || "";
72
- return l.includes(C) || l.includes($) || V === $;
66
+ const A = d.DEFAULT, a = d.ATTR;
67
+ if (A && e.src) {
68
+ const f = e.src;
69
+ A.some((F) => {
70
+ const T = F.split("/").pop() || "", q = f.split("/").pop() || "";
71
+ return f.includes(F) || f.includes(T) || q === T;
73
72
  }) && (e.src = `{{${a}_${c}}}`);
74
73
  }
75
- const s = (M = (g = u.name) == null ? void 0 : g[m]) == null ? void 0 : M.ATTR;
74
+ const s = (L = (h = l.name) == null ? void 0 : h[P]) == null ? void 0 : L.ATTR;
76
75
  if (s && e.setAttribute("alt", `{{${s}_${c}}}`), i) {
77
- const l = (x = u.itemLink) == null ? void 0 : x[m];
78
- if (l) {
79
- const H = l.HREF, C = l.DEFAULT_HREF || "#!", $ = i.href;
80
- ($ === "#" || $ === "" || $.endsWith("#!") || $.endsWith(C) || $ === `${window.location.href}${C}` || !$ || $ === window.location.href) && (i.href = `{{${H}_${c}}}`);
76
+ const f = (k = l.itemLink) == null ? void 0 : k[P];
77
+ if (f) {
78
+ const M = f.HREF, F = f.DEFAULT_HREF || "#!", T = i.href;
79
+ (T === "#" || T === "" || T.endsWith("#!") || T.endsWith(F) || T === `${window.location.href}${F}` || !T || T === window.location.href) && (i.href = `{{${M}_${c}}}`);
81
80
  }
82
81
  }
83
82
  break;
84
83
  }
85
84
  case "name": {
86
- const e = f, i = e.ATTR, d = e.DEFAULT_HREF || "#!", a = e.HREF;
87
- t.textContent && (t.innerHTML = w(t, `{{${i}_${c}}}`));
85
+ const e = d, i = e.ATTR, A = e.DEFAULT_HREF || "#!", a = e.HREF;
86
+ t.textContent && (t.innerHTML = H(t, `{{${i}_${c}}}`));
88
87
  const s = t.closest("a") || (t.tagName === "A" ? t : null);
89
88
  if (s && a) {
90
- const l = s.href, H = `${window.location.href}${d}`;
91
- (l === H || l.endsWith(d)) && (s.href = `{{${a}_${c}}}`);
89
+ const f = s.href, M = `${window.location.href}${A}`;
90
+ (f === M || f.endsWith(A)) && (s.href = `{{${a}_${c}}}`);
92
91
  }
93
92
  break;
94
93
  }
95
94
  case "price":
96
95
  case "originalPrice": {
97
- const e = f, i = G(n) ? tt(n) : Z(t);
98
- t.innerHTML = w(t, et(e, c, i));
96
+ const e = d, i = W(n) ? J(n) : z(t);
97
+ t.innerHTML = H(t, K(e, c, i));
99
98
  break;
100
99
  }
101
100
  case "quantity": {
102
- const e = f, i = e.ATTR, d = [e.DEFAULT, ...e.LEGACY_DEFAULTS], a = (D = t.textContent) == null ? void 0 : D.trim();
103
- a && d.includes(a) && (t.innerHTML = w(t, `{{${i}_${c}}}`));
101
+ const e = d, i = e.ATTR, A = [e.DEFAULT, ...e.LEGACY_DEFAULTS], a = (O = t.textContent) == null ? void 0 : O.trim();
102
+ a && A.includes(a) && (t.innerHTML = H(t, `{{${i}_${c}}}`));
104
103
  break;
105
104
  }
106
105
  case "button": {
107
- const e = f, i = e.HREF, d = e.DEFAULT_HREF || "#!", a = t.tagName === "A" ? t : t.querySelector("a");
106
+ const e = d, i = e.HREF, A = e.DEFAULT_HREF || "#!", a = t.tagName === "A" ? t : t.querySelector("a");
108
107
  if (a) {
109
- const s = a.href || "", l = `${window.location.href}${d}`;
110
- (s === "" || s === "#" || s === l || s.endsWith(d) || s.endsWith("#!") || s === window.location.href) && (a.href = `{{${i}_${c}}}`);
108
+ const s = a.href || "", f = `${window.location.href}${A}`;
109
+ (s === "" || s === "#" || s === f || s.endsWith(A) || s.endsWith("#!") || s === window.location.href) && (a.href = `{{${i}_${c}}}`);
111
110
  }
112
- K(t, `{{${i}_${c}}}`);
111
+ Q(t, `{{${i}_${c}}}`);
113
112
  break;
114
113
  }
115
114
  case "itemLink": {
116
- const e = f, i = e.HREF, d = e.DEFAULT_HREF || "#!", a = t;
115
+ const e = d, i = e.HREF, A = e.DEFAULT_HREF || "#!", a = t;
117
116
  if (a.href) {
118
- const s = a.href, l = `${window.location.href}${d}`;
119
- (s === l || s.endsWith(d)) && (a.href = `{{${i}_${c}}}`);
117
+ const s = a.href, f = `${window.location.href}${A}`;
118
+ (s === f || s.endsWith(A)) && (a.href = `{{${i}_${c}}}`);
120
119
  }
121
120
  break;
122
121
  }
123
122
  default: {
124
- if ("ATTR" in f) {
125
- const e = f.ATTR;
126
- t.textContent && (t.innerHTML = w(t, `{{${e}_${c}}}`));
123
+ if ("ATTR" in d) {
124
+ const e = d.ATTR;
125
+ t.textContent && (t.innerHTML = H(t, `{{${e}_${c}}}`));
127
126
  }
128
127
  break;
129
128
  }
@@ -131,49 +130,40 @@ function at(r) {
131
130
  });
132
131
  });
133
132
  });
134
- const A = h.match(/<!DOCTYPE[^>]*>/i), L = A ? `${A[0]}
135
- ` : "", P = p.querySelectorAll(".ins-product-td"), y = [];
136
- P.forEach((o) => {
137
- const T = o.getAttribute("data-type") || "CART_ITEMS", _ = o.getAttribute("data-number") || "1", n = o.outerHTML;
138
- y.push({
139
- element: o,
140
- outerHtml: n,
141
- type: T,
142
- number: _
143
- });
144
- });
145
- let E = L + p.documentElement.outerHTML;
146
- y.reverse().forEach(({ outerHtml: o, type: T, number: _ }) => {
147
- const n = q[T], S = n ? `${n}_total_product_kind` : "";
148
- if (S) {
149
- const b = parseInt(_) - 1, c = `${`{% if ${S} > ${b} %}`}${o}{% endif %}`;
150
- E = E.replace(o, v(c));
151
- }
133
+ const p = _.match(/<!DOCTYPE[^>]*>/i), I = p ? `${p[0]}
134
+ ` : "";
135
+ u.querySelectorAll(".ins-product-td").forEach((o) => {
136
+ const R = o.getAttribute("data-type") || "CART_ITEMS", $ = D[R];
137
+ if (!$)
138
+ return;
139
+ const n = parseInt(o.getAttribute("data-number") || "1") - 1;
140
+ o.before(u.createComment(`{% if ${$}_total_product_kind > ${n} %}`)), o.after(u.createComment("{% endif %}"));
152
141
  });
153
- const F = p.querySelectorAll('[product-attr="originalPrice"][data-type]'), R = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Set();
154
- return F.forEach((o) => {
142
+ let E = I + u.documentElement.outerHTML;
143
+ const y = u.querySelectorAll('[product-attr="originalPrice"][data-type]'), b = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Set();
144
+ return y.forEach((o) => {
155
145
  var t;
156
- const T = o.getAttribute("data-number"), _ = o.getAttribute("data-type");
157
- if (!T || !q[_])
146
+ const R = o.getAttribute("data-number"), $ = o.getAttribute("data-type");
147
+ if (!R || !D[$])
158
148
  return;
159
149
  const n = o.closest(".product-original-price-class");
160
- if (!n || O.has(n))
150
+ if (!n || S.has(n))
161
151
  return;
162
- O.add(n);
163
- const S = n.outerHTML, I = (t = o.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), b = R.get(S) ?? { number: T, type: _, wrap: [] };
164
- b.wrap.push(I !== "false"), R.set(S, b);
165
- }), R.forEach(({ number: o, type: T, wrap: _ }, n) => {
166
- if (n.includes("{% if") || !_.some(Boolean))
152
+ S.add(n);
153
+ const m = n.outerHTML, C = (t = o.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), g = b.get(m) ?? { number: R, type: $, wrap: [] };
154
+ g.wrap.push(C !== "false"), b.set(m, g);
155
+ }), b.forEach(({ number: o, type: R, wrap: $ }, n) => {
156
+ if (n.includes("{% if") || !$.some(Boolean))
167
157
  return;
168
- const S = k.PAIRS_FOR_EXTENSION.price[T].PRICE, I = k.PAIRS_FOR_EXTENSION.originalPrice[T].PRICE, b = `{% if ${S}_${o} != ${I}_${o} %}`, t = [b, W(b)];
169
- let m = "", c = 0, f = 0, g = E.indexOf(n);
170
- for (; g !== -1; ) {
171
- const M = _[f] === !0 && !z(E, g, t);
172
- m += E.slice(c, g) + (M ? `${b}${n}{% endif %}` : n), c = g + n.length, f += 1, g = E.indexOf(n, c);
158
+ const m = N.PAIRS_FOR_EXTENSION.price[R].PRICE, C = N.PAIRS_FOR_EXTENSION.originalPrice[R].PRICE, g = `{% if ${m}_${o} != ${C}_${o} %}`, t = [g, U(g)];
159
+ let P = "", c = 0, d = 0, h = E.indexOf(n);
160
+ for (; h !== -1; ) {
161
+ const L = $[d] === !0 && !v(E, h, t);
162
+ P += E.slice(c, h) + (L ? `${g}${n}{% endif %}` : n), c = h + n.length, d += 1, h = E.indexOf(n, c);
173
163
  }
174
- E = m + E.slice(c);
175
- }), j(E.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}"));
164
+ E = P + E.slice(c);
165
+ }), B(E.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}"));
176
166
  }
177
167
  export {
178
- at as pairProductVariables
168
+ nt as pairProductVariables
179
169
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.30.0-beta.02005ef",
3
+ "version": "3.30.0-beta.0c48424",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",