@useinsider/guido 3.15.0-beta.94dfda1 → 3.15.0-beta.b62fba5

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.
@@ -1,12 +1,12 @@
1
- import { BlockId as f } from "../../../enums/block.js";
2
- import { useOnboardingStore as g } from "../../../stores/onboarding.js";
3
- import { getMigrationBannerHtml as y } from "../../../utils/migrationBannerHtml.js";
4
- import { Block as I, BlockCompositionType as C, ModificationDescription as c } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { SETTINGS_ENUMS as d, DefaultConfigValues as m } from "./enums/settingsEnums.js";
6
- import { getDefaultTemplate as b } from "./template.js";
7
- import { getItemsBlockContainer as l, getItemsBlockConfig as u, deriveItemNumber as h, getDefaultItemsBlockConfig as N } from "./utils/nodeConfigUtils.js";
8
- const p = f.Items;
9
- class O extends I {
1
+ import { BlockId as g } from "../../../enums/block.js";
2
+ import { useOnboardingStore as y } from "../../../stores/onboarding.js";
3
+ import { getMigrationBannerHtml as I } from "../../../utils/migrationBannerHtml.js";
4
+ import { Block as C, BlockCompositionType as b, ModificationDescription as c } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { SETTINGS_ENUMS as l, DefaultConfigValues as d } from "./enums/settingsEnums.js";
6
+ import { getDefaultTemplate as h } from "./template.js";
7
+ import { getItemsBlockContainer as u, getItemsBlockConfig as f, deriveItemNumber as D, getDefaultItemsBlockConfig as N } from "./utils/nodeConfigUtils.js";
8
+ const p = g.Items;
9
+ class E extends C {
10
10
  getId() {
11
11
  return p;
12
12
  }
@@ -14,7 +14,7 @@ class O extends I {
14
14
  return "items-icon";
15
15
  }
16
16
  getBlockCompositionType() {
17
- return C.CONTAINER;
17
+ return b.CONTAINER;
18
18
  }
19
19
  getName() {
20
20
  return this.api.translate("Items");
@@ -23,20 +23,20 @@ class O extends I {
23
23
  return this.api.translate("Items lets you display personalized products based on user behavior.");
24
24
  }
25
25
  getSettingsPanelTitleHtml() {
26
- return y(
26
+ return I(
27
27
  p,
28
28
  this.api.translate("Items"),
29
29
  this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.")
30
30
  );
31
31
  }
32
32
  getTemplate() {
33
- return b({
34
- orientation: d.ORIENTATION.VERTICAL,
35
- itemsType: d.ITEMS_TYPE.CART_ITEMS,
33
+ return h({
34
+ orientation: l.ORIENTATION.VERTICAL,
35
+ itemsType: l.ITEMS_TYPE.CART_ITEMS,
36
36
  itemId: "{{Abandoned Cart Item (1) Url}}",
37
- currencySymbol: m.productPriceCurrencySymbolControlValue,
38
- currencyLocation: m.productPriceCurrencyLocationControlValue,
39
- formattedPrice: m.productPriceFormattedControlValue === "1"
37
+ currencySymbol: d.productPriceCurrencySymbolControlValue,
38
+ currencyLocation: d.productPriceCurrencyLocationControlValue,
39
+ formattedPrice: d.productPriceFormattedControlValue === "1"
40
40
  });
41
41
  }
42
42
  allowInnerBlocksDND() {
@@ -45,23 +45,23 @@ class O extends I {
45
45
  canBeSavedAsModule() {
46
46
  return !0;
47
47
  }
48
- onCreated(e) {
49
- const t = this.api.getDocumentModifier(), o = this.api.getDocumentRootCssNode();
50
- o.querySelector('[product-attr="imageSrc"] img') || t.modifyCss(o).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
51
- const i = l(e);
52
- if (!i)
48
+ onCreated(n) {
49
+ const t = this.api.getDocumentModifier(), a = this.api.getDocumentRootCssNode();
50
+ a.querySelector('[product-attr="imageSrc"] img') || t.modifyCss(a).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
51
+ const e = u(n);
52
+ if (!e)
53
53
  return;
54
- const r = i.getNodeConfig(), s = r && Object.keys(r).length > 0, n = u(e);
55
- if (n != null && n.initialized)
56
- if (s)
57
- n.blockInstanceId || this.api.getDocumentModifier().modifyHtml(i).setNodeConfig({ ...n, blockInstanceId: String(Date.now()) }).apply(new c("Assign block instance ID to block"));
54
+ const o = e.getNodeConfig(), r = o && Object.keys(o).length > 0, i = f(n);
55
+ if (i != null && i.initialized)
56
+ if (r)
57
+ i.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...i, blockInstanceId: String(Date.now()) }).apply(new c("Assign block instance ID to block"));
58
58
  else {
59
- const a = this.api.getDocumentModifier();
60
- a.modifyHtml(i).setNodeConfig(n), this._stampProductTdDomAttributes(i, n, a), a.apply(new c("Migrate legacy config to nodeConfig"));
59
+ const s = this.api.getDocumentModifier();
60
+ s.modifyHtml(e).setNodeConfig(i), this._stampProductTdDomAttributes(e, i, s), s.apply(new c("Migrate legacy config to nodeConfig"));
61
61
  }
62
62
  else {
63
- const a = N();
64
- this.api.getDocumentModifier().modifyHtml(i).setNodeConfig(a).apply(new c("Initialize Items block with default configuration")), g().startOnboarding("itemsOnboarding");
63
+ const s = N(), m = this.api.getDocumentModifier();
64
+ m.modifyHtml(e).setNodeConfig(s), this._stampProductTdDomAttributes(e, s, m, !0), m.apply(new c("Initialize Items block with default configuration")), y().startOnboarding("itemsOnboarding");
65
65
  }
66
66
  }
67
67
  /**
@@ -70,18 +70,18 @@ class O extends I {
70
70
  * into nodeConfig, so without this a reused module would reset to defaults.
71
71
  * Guarded to the nodeConfig-empty case so it runs once and never loops.
72
72
  */
73
- onDocumentChanged(e) {
74
- const t = l(e);
73
+ onDocumentChanged(n) {
74
+ const t = u(n);
75
75
  if (!t)
76
76
  return;
77
- const o = t.getNodeConfig();
78
- if (o && Object.keys(o).length > 0)
77
+ const a = t.getNodeConfig();
78
+ if (a && Object.keys(a).length > 0)
79
79
  return;
80
- const r = u(e);
81
- if (!(r != null && r.initialized))
80
+ const o = f(n);
81
+ if (!(o != null && o.initialized))
82
82
  return;
83
- const s = this.api.getDocumentModifier();
84
- s.modifyHtml(t).setNodeConfig(r), this._stampProductTdDomAttributes(t, r, s), s.apply(new c("Recover Items block config from saved module"));
83
+ const r = this.api.getDocumentModifier();
84
+ r.modifyHtml(t).setNodeConfig(o), this._stampProductTdDomAttributes(t, o, r), r.apply(new c("Recover Items block config from saved module"));
85
85
  }
86
86
  /**
87
87
  * Bakes the compiler-read DOM attributes (`data-type`, `data-number`, `data-nodup`) onto the
@@ -91,12 +91,14 @@ class O extends I {
91
91
  * restored before export. The name `<a>` carries no data-type/data-number of its own and
92
92
  * relies on this td-level fallback in pairProductVariables.
93
93
  */
94
- _stampProductTdDomAttributes(e, t, o) {
95
- const i = h(t.itemsSelectValue, t.type);
96
- o.modifyHtml(e).setAttribute("data-type", t.type), o.modifyHtml(e).setAttribute("data-number", i), o.modifyHtml(e).setAttribute("data-nodup", String(t.priceHideDiscount));
94
+ _stampProductTdDomAttributes(n, t, a, e = !1) {
95
+ const o = D(t.itemsSelectValue, t.type), r = (i, s) => {
96
+ e && n.getAttribute(i) || a.modifyHtml(n).setAttribute(i, s);
97
+ };
98
+ r("data-type", t.type), r("data-number", o), r("data-nodup", String(t.priceHideDiscount));
97
99
  }
98
100
  }
99
101
  export {
100
102
  p as BLOCK_ID,
101
- O as ItemsBlock
103
+ E as ItemsBlock
102
104
  };
@@ -1,17 +1,17 @@
1
1
  import { escapeHtml as m } from "../../../utils/htmlEscape.js";
2
2
  import { BlockType as R, BlockAttr as S } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
3
  import { ItemsBlockId as O } from "./enums/controlEnums.js";
4
- import { productPairs as h, templateFirstLine as Y } from "./enums/productEnums.js";
5
- import { ItemInCartOptions as q, SETTINGS_ENUMS as N, DefaultConfigValues as k } from "./enums/settingsEnums.js";
6
- import j from "./layouts/horizontal.html.js";
7
- import f from "./layouts/vertical.html.js";
8
- import { deriveItemNumber as J, escapeReplacement as G } from "./utils/nodeConfigUtils.js";
9
- let [X] = h.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [F] = h.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [x] = h.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [L] = h.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [V] = h.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
10
- const D = (s, e) => s.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCase().startsWith(e.toLowerCase())).join("; ").replace(/;\s*$/, ""), U = (s) => D(s, "text-align"), y = (s, e) => {
11
- const l = new RegExp(`${e}\\s*:\\s*([^;]+)`, "i"), a = s.match(l);
4
+ import { productPairs as h, templateFirstLine as q } from "./enums/productEnums.js";
5
+ import { ItemInCartOptions as j, SETTINGS_ENUMS as N, DefaultConfigValues as M } from "./enums/settingsEnums.js";
6
+ import C from "./layouts/horizontal.html.js";
7
+ import J from "./layouts/vertical.html.js";
8
+ import { deriveItemNumber as Z, escapeReplacement as g } from "./utils/nodeConfigUtils.js";
9
+ let [v] = h.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [F] = h.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [x] = h.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [L] = h.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [X] = h.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
10
+ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCase().startsWith(e.toLowerCase())).join("; ").replace(/;\s*$/, ""), k = (s) => U(s, "text-align"), y = (s, e) => {
11
+ const r = new RegExp(`${e}\\s*:\\s*([^;]+)`, "i"), a = s.match(r);
12
12
  return a ? a[1].trim() : null;
13
- }, w = (s) => `<tr>${s}</tr>`, Z = (s, e, l, a) => {
14
- const i = l || k.productImageHeight, d = (a == null ? void 0 : a.imageVisible) === !1 ? "display: none; " : "";
13
+ }, w = (s) => `<tr>${s}</tr>`, f = (s, e, r, a) => {
14
+ const i = r || M.productImageHeight, d = (a == null ? void 0 : a.imageVisible) === !1 ? "display: none; " : "";
15
15
  return w(`
16
16
  <td class="esd-block-image document-node-component default-block-component selectable ng-star-inserted"
17
17
  align="center"
@@ -26,7 +26,7 @@ const D = (s, e) => s.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCa
26
26
  href="#!">
27
27
  <img class="adapt-img document-node-component ng-star-inserted"
28
28
  style="object-fit: contain;"
29
- src="${X}"
29
+ src="${v}"
30
30
  alt="${F}"
31
31
  width="${i}"
32
32
  height="${i}">
@@ -35,18 +35,18 @@ const D = (s, e) => s.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCa
35
35
  `);
36
36
  }, tt = (s, e) => `
37
37
  <${R.BLOCK_IMAGE}
38
- ${S.BLOCK_IMAGE.src}="${X}"
38
+ ${S.BLOCK_IMAGE.src}="${v}"
39
39
  ${S.BLOCK_IMAGE.alt}="${F}"
40
40
  ${S.BLOCK_IMAGE.href}="#!"
41
- ${S.BLOCK_IMAGE.width}="${k.productImageWidth}"
42
- ${S.BLOCK_IMAGE.height}="${k.productImageWidth}"
41
+ ${S.BLOCK_IMAGE.width}="${M.productImageWidth}"
42
+ ${S.BLOCK_IMAGE.height}="${M.productImageWidth}"
43
43
  esd-extension-block-id="${O.IMAGE}"
44
44
  data-slot-1
45
45
  product-attr="imageSrc"
46
46
  data-type="${s}"
47
47
  data-number="${e}"
48
48
  />
49
- `, et = (s, e, l, a) => {
49
+ `, et = (s, e, r, a) => {
50
50
  const i = `
51
51
  word-wrap: break-word;
52
52
  white-space: nowrap;
@@ -56,15 +56,15 @@ const D = (s, e) => s.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCa
56
56
  max-width: 100%;
57
57
  `;
58
58
  if (e) {
59
- const d = y(l || "", "text-align") || "center", n = U(l || i), c = y(n, "font-weight"), r = y(n, "font-style"), p = c === "bold" || c === "700", t = r === "italic", o = D(
60
- D(
61
- D(n, "font-weight"),
59
+ const d = y(r || "", "text-align") || "center", n = k(r || i), c = y(n, "font-weight"), l = y(n, "font-style"), o = c === "bold" || c === "700", t = l === "italic", p = U(
60
+ U(
61
+ U(n, "font-weight"),
62
62
  "font-style"
63
63
  ),
64
64
  "text-decoration"
65
- ), T = (a == null ? void 0 : a.nameVisible) === !1 ? "display: none;" : "display: table-cell;", _ = o ? ` style="${m(o)}"` : "";
66
- let $ = F;
67
- return p && ($ = `<strong>${$}</strong>`), t && ($ = `<em>${$}</em>`), w(`
65
+ ), T = (a == null ? void 0 : a.nameVisible) === !1 ? "display: none;" : "display: table-cell;", _ = p ? ` style="${m(p)}"` : "";
66
+ let E = F;
67
+ return o && (E = `<strong>${E}</strong>`), t && (E = `<em>${E}</em>`), w(`
68
68
  <td class="esd-block-text es-p10"
69
69
  align="${d}"
70
70
  width="100%"
@@ -76,7 +76,7 @@ const D = (s, e) => s.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCa
76
76
  path="1"
77
77
  product-attr="name"
78
78
  data-slot-2${_}>
79
- ${$}
79
+ ${E}
80
80
  </p>
81
81
  </td>
82
82
  `);
@@ -97,15 +97,15 @@ const D = (s, e) => s.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCa
97
97
  </p>
98
98
  </${R.BLOCK_TEXT}>
99
99
  `;
100
- }, at = (s, e, l, a, i, d, n, c, r, p) => {
100
+ }, at = (s, e, r, a, i, d, n, c, l, o) => {
101
101
  let t = x;
102
102
  if (a && a.trim()) {
103
- const E = `${a.trim()}`;
104
- t = (i || "0") === "1" ? `${x}&nbsp;${E}` : `${E}&nbsp;${x}`;
103
+ const $ = `${a.trim()}`;
104
+ t = (i || "0") === "1" ? `${x}&nbsp;${$}` : `${$}&nbsp;${x}`;
105
105
  }
106
- const o = i === "1" ? "after" : "before", T = `data-formated="${l ? "true" : "false"}"`, _ = `data-curency="${o}"`, $ = a ? `data-currency_symbol="${a}"` : "", u = `data-single_price="${c ? "true" : "false"}"`, I = r === N.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
106
+ const p = i === "1" ? "after" : "before", T = `data-formated="${r ? "true" : "false"}"`, _ = `data-curency="${p}"`, E = a ? `data-currency_symbol="${a}"` : "", u = `data-single_price="${c ? "true" : "false"}"`, I = l === N.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
107
107
  if (d) {
108
- const b = U(n || "color: #060606; white-space: nowrap; font-size: 20px;"), A = p ? "" : ' style="display: none;"';
108
+ const b = k(n || "color: #060606; white-space: nowrap; font-size: 20px;"), A = o ? "" : ' style="display: none;"';
109
109
  return w(`
110
110
  <td class="esd-block-text items-block-price${I}"
111
111
  align="center"
@@ -119,7 +119,7 @@ const D = (s, e) => s.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCa
119
119
  data-number="${e}"
120
120
  ${T}
121
121
  ${_}
122
- ${$}
122
+ ${E}
123
123
  ${u}
124
124
  style="${m(b)}">
125
125
  ${t}
@@ -149,20 +149,20 @@ const D = (s, e) => s.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCa
149
149
  </p>
150
150
  </${R.BLOCK_TEXT}>
151
151
  `;
152
- }, st = (s, e, l, a, i, d, n = !0, c, r, p) => {
152
+ }, st = (s, e, r, a, i, d, n = !0, c, l, o) => {
153
153
  let t = L;
154
154
  if (a && a.trim()) {
155
- const E = `${a.trim()}`;
156
- t = (i || "0") === "1" ? `${L}&nbsp;${E}` : `${E}&nbsp;${L}`;
155
+ const $ = `${a.trim()}`;
156
+ t = (i || "0") === "1" ? `${L}&nbsp;${$}` : `${$}&nbsp;${L}`;
157
157
  }
158
- const o = i === "1" ? "after" : "before", T = `data-formated="${l ? "true" : "false"}"`, _ = `data-curency="${o}"`, $ = n ? "" : ' style="display: none;"', u = `data-single_price="${r ? "true" : "false"}"`, I = p === N.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
158
+ const p = i === "1" ? "after" : "before", T = `data-formated="${r ? "true" : "false"}"`, _ = `data-curency="${p}"`, E = n ? "" : ' style="display: none;"', u = `data-single_price="${l ? "true" : "false"}"`, I = o === N.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
159
159
  if (d) {
160
- const b = U(c || "color: #cc0000; white-space: nowrap; font-size: 19px;");
160
+ const b = k(c || "color: #cc0000; white-space: nowrap; font-size: 19px;");
161
161
  return w(`
162
162
  <td class="esd-block-text items-block-price${I}"
163
163
  esd-extension-block-id="${O.ORIGINAL_PRICE}"
164
164
  width="100%"
165
- align="center"${$}>
165
+ align="center"${E}>
166
166
  <p
167
167
  product-attr="originalPrice"
168
168
  contenteditable="false"
@@ -203,10 +203,10 @@ const D = (s, e) => s.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCa
203
203
  </p>
204
204
  </${R.BLOCK_TEXT}>
205
205
  `;
206
- }, lt = (s = !0, e, l) => {
206
+ }, lt = (s = !0, e, r) => {
207
207
  const a = s ? "" : 'style="display: none;"';
208
208
  if (e) {
209
- const i = "font-size: 14px;", d = y(l || "", "text-align") || "center", n = U(l || i);
209
+ const i = "font-size: 14px;", d = y(r || "", "text-align") || "center", n = k(r || i);
210
210
  return w(`
211
211
  <td class="esd-block-text es-p10 document-node-component default-block-component selectable"
212
212
  width="100%" align="${d}"
@@ -218,7 +218,7 @@ const D = (s, e) => s.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCa
218
218
  width="100%"
219
219
  path="1"
220
220
  style="${m(n)}">
221
- ${V}
221
+ ${X}
222
222
  </p>
223
223
  </td>
224
224
  `);
@@ -236,26 +236,26 @@ const D = (s, e) => s.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCa
236
236
  data-slot-3
237
237
  contenteditable="false"
238
238
  width="100%">
239
- ${V}
239
+ ${X}
240
240
  </p>
241
241
  </${R.BLOCK_TEXT}>
242
242
  `;
243
- }, rt = (s, e, l = "Buy", a, i, d = !0, n = !0) => {
243
+ }, rt = (s, e, r = "Buy", a, i, d = !0, n = !0) => {
244
244
  if (a) {
245
- const c = y(i || "", "background") || y(i || "", "background-color"), r = c ? `border-width: 0px; background: ${c};` : "border-width: 0px;", p = d ? "es-fw" : "es-il", t = (i || "").replace("border-width: 0;", "");
245
+ const c = y(i || "", "background") || y(i || "", "background-color"), l = c ? `border-width: 0px; background: ${c};` : "border-width: 0px;", o = d ? "es-fw" : "es-il", t = (i || "").replace("border-width: 0;", "");
246
246
  return w(`
247
247
  <td class="esd-block-button ins-button default-block-component selectable"
248
- align="center" width="100%" name="buy-button" caption="${l}"
248
+ align="center" width="100%" name="buy-button" caption="${r}"
249
249
  esd-extension-block-id="${O.BUTTON}"
250
250
  product-attr="button" data-slot-6="" data-type="${s}" data-number="${e}"
251
251
  ${n ? "" : ' style="display: none;"'}>
252
- <span class="es-button-border ${p}" style="${m(r)}">
252
+ <span class="es-button-border ${o}" style="${m(l)}">
253
253
  <a
254
254
  class="es-button"
255
255
  href="#!"
256
256
  target="_blank"
257
257
  style="${m(t)} padding: 5px 12px;">
258
- ${l}
258
+ ${r}
259
259
  </a>
260
260
  </span>
261
261
  </td>
@@ -266,27 +266,27 @@ const D = (s, e) => s.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCa
266
266
  width="100%"
267
267
  class="ins-button"
268
268
  name="buy-button"
269
- caption="${l}"
269
+ caption="${r}"
270
270
  align="center"
271
271
  esd-extension-block-id="${O.BUTTON}"
272
272
  product-attr="button"
273
273
  data-slot-6
274
274
  data-type="${s}"
275
275
  data-number="${e}"
276
- >${l}
276
+ >${r}
277
277
  </${R.BLOCK_BUTTON}>
278
278
  `;
279
- }, ct = (s, e, l, a = !0, i = !0) => {
280
- const d = e === N.ORIENTATION.VERTICAL, n = l === "horizontal";
279
+ }, ct = (s, e, r, a = !0, i = !0) => {
280
+ const d = e === N.ORIENTATION.VERTICAL, n = r === "horizontal";
281
281
  if (d) {
282
- const c = !n, r = c || !i ? "100%" : "50%", p = c || !a ? "100%" : "50%";
282
+ const c = !n, l = c || !i ? "100%" : "50%", o = c || !a ? "100%" : "50%";
283
283
  let t = s.replace(
284
284
  /<td\s+[^>]*class="([^"]*product-price-class[^"]*)"[^>]*>/gi,
285
- (o) => o.replace(/width="[^"]*"/gi, `width="${r}"`).replace(/width:\s*[^;]+;/gi, `width: ${r};`)
285
+ (p) => p.replace(/width="[^"]*"/gi, `width="${l}"`).replace(/width:\s*[^;]+;/gi, `width: ${l};`)
286
286
  );
287
287
  return t = t.replace(
288
288
  /<td\s+[^>]*class="([^"]*product-original-price-class[^"]*)"[^>]*>/gi,
289
- (o) => o.replace(/width="[^"]*"/gi, `width="${p}"`).replace(/width:\s*[^;]+;/gi, `width: ${p};`)
289
+ (p) => p.replace(/width="[^"]*"/gi, `width="${o}"`).replace(/width:\s*[^;]+;/gi, `width: ${o};`)
290
290
  ), t;
291
291
  }
292
292
  return n ? s : s.replace(
@@ -298,74 +298,74 @@ const D = (s, e) => s.split(";").map((l) => l.trim()).filter((l) => !l.toLowerCa
298
298
  );
299
299
  }, it = (s) => s ? `<td align="center"
300
300
  esd-extension-block-id="items-block"
301
- class="ins-product-td items-block items-block-v2 esd-items-block esd-extension-block esd-container-frame">` : Y, K = (s, e, l, a, i, d, n, c, r, p, t, o, T, _ = "horizontal", $, u, P, I) => {
302
- const A = `${`data-type="${e}" data-number="${l}"`} data-orientation="${a}"`, M = r == null ? void 0 : r["data-product_image_control_image-height"], B = d ? Z(e, l, M, t) : tt(e, l), W = (t == null ? void 0 : t.buttonLabel) || "Buy", z = (t == null ? void 0 : t.buttonFullWidth) !== void 0 ? t.buttonFullWidth : !0, Q = e === N.ITEMS_TYPE.BROWSED_ITEMS ? !1 : t == null ? void 0 : t.quantityControlEnabled, H = (t == null ? void 0 : t.buttonVisible) !== void 0 ? t.buttonVisible : (r == null ? void 0 : r["data-product_button_control_enabled"]) !== "false", g = (t == null ? void 0 : t.priceVisible) !== void 0 ? t.priceVisible : (r == null ? void 0 : r["data-product_price_control_enabled"]) !== "false", v = (t == null ? void 0 : t.originalPriceVisible) !== void 0 ? t.originalPriceVisible : (r == null ? void 0 : r["data-product_original_price_control_enabled"]) !== "false", C = s.replace("{-{-TEMPLATE_FIRST_LINE-}-}", it(d)).replace("{-{-PRODUCT_IMAGE-}-}", B).replace("{-{-PRODUCT_NAME-}-}", et(e, d, o, t)).replaceAll(
301
+ class="ins-product-td items-block items-block-v2 esd-items-block esd-extension-block esd-container-frame">` : q, B = (s, e, r, a, i, d, n, c, l, o, t, p, T, _ = "horizontal", E, u, P, I) => {
302
+ const $ = o !== void 0 ? ` data-nodup="${o}"` : "", A = `${`data-type="${e}" data-number="${r}"`} data-orientation="${a}"${$}`, D = l == null ? void 0 : l["data-product_image_control_image-height"], V = d ? f(e, r, D, t) : tt(e, r), W = (t == null ? void 0 : t.buttonLabel) || "Buy", z = (t == null ? void 0 : t.buttonFullWidth) !== void 0 ? t.buttonFullWidth : !0, H = e === N.ITEMS_TYPE.BROWSED_ITEMS ? !1 : t == null ? void 0 : t.quantityControlEnabled, Q = (t == null ? void 0 : t.buttonVisible) !== void 0 ? t.buttonVisible : (l == null ? void 0 : l["data-product_button_control_enabled"]) !== "false", G = (t == null ? void 0 : t.priceVisible) !== void 0 ? t.priceVisible : (l == null ? void 0 : l["data-product_price_control_enabled"]) !== "false", K = (t == null ? void 0 : t.originalPriceVisible) !== void 0 ? t.originalPriceVisible : (l == null ? void 0 : l["data-product_original_price_control_enabled"]) !== "false", Y = s.replace("{-{-TEMPLATE_FIRST_LINE-}-}", it(d)).replace("{-{-PRODUCT_IMAGE-}-}", V).replace("{-{-PRODUCT_NAME-}-}", et(e, d, p, t)).replaceAll(
303
303
  "{-{-PRODUCT_PRICE-}-}",
304
- G(at(
304
+ g(at(
305
305
  e,
306
- l,
306
+ r,
307
307
  i,
308
308
  n,
309
309
  c,
310
310
  d,
311
- $,
311
+ E,
312
312
  I,
313
313
  a,
314
- g
314
+ G
315
315
  ))
316
316
  ).replaceAll(
317
317
  "{-{-PRODUCT_ORIGINAL_PRICE-}-}",
318
- G(st(
318
+ g(st(
319
319
  e,
320
- l,
320
+ r,
321
321
  i,
322
322
  n,
323
323
  c,
324
324
  d,
325
- v,
325
+ K,
326
326
  u,
327
327
  I,
328
328
  a
329
329
  ))
330
- ).replace("{-{-PRODUCT_QUANTITY-}-}", lt(Q, d, P)).replace(
330
+ ).replace("{-{-PRODUCT_QUANTITY-}-}", lt(H, d, P)).replace(
331
331
  "{-{-PRODUCT_BUTTON-}-}",
332
- rt(e, l, W, d, T, z, H)
332
+ rt(e, r, W, d, T, z, Q)
333
333
  ).replace(
334
334
  /<td([^>]*class="[^"]*ins-product-td[^"]*"[^>]*)>/,
335
335
  `<td$1 ${A}>`
336
336
  );
337
337
  return ct(
338
- C,
338
+ Y,
339
339
  a,
340
340
  _,
341
- g,
342
- v
341
+ G,
342
+ K
343
343
  );
344
344
  };
345
345
  function It({
346
346
  orientation: s,
347
347
  itemsType: e = N.ITEMS_TYPE.CART_ITEMS,
348
- itemId: l,
348
+ itemId: r,
349
349
  currencySymbol: a,
350
350
  currencyLocation: i,
351
351
  migrate: d = !1,
352
352
  formattedPrice: n = !0,
353
353
  configBlockAttributes: c,
354
- nodeConfig: r,
355
- nameStyles: p,
354
+ nodeConfig: l,
355
+ nameStyles: o,
356
356
  buttonStyles: t,
357
- priceStyles: o,
357
+ priceStyles: p,
358
358
  originalPriceStyles: T,
359
359
  quantityStyles: _,
360
- priceOrientation: $
360
+ priceOrientation: E
361
361
  }) {
362
- const u = q[e].findIndex((M) => M.value === l), P = J(l, e), I = (r == null ? void 0 : r.priceSinglePrice) ?? (c == null ? void 0 : c["data-product_price_control_single_price"]) === "1" ?? !1;
363
- X = h.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[u >= 0 ? u : 0], F = h.PAIRS_FOR_EXTENSION.name[e].DEFAULT[u >= 0 ? u : 0];
364
- const E = h.PAIRS_FOR_EXTENSION.price[e], b = h.PAIRS_FOR_EXTENSION.originalPrice[e];
365
- I ? (x = n ? E.DEFAULT_SINGLE_PRICE_FORMATTED : E.DEFAULT_SINGLE_PRICE, L = n ? b.DEFAULT_SINGLE_PRICE_FORMATTED : b.DEFAULT_SINGLE_PRICE) : (x = n ? E.DEFAULT_PRICE_FORMATTED : E.DEFAULT_PRICE, L = n ? b.DEFAULT_PRICE_FORMATTED : b.DEFAULT_PRICE), V = h.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT;
366
- const A = $ || (r == null ? void 0 : r.priceOrientation) || "horizontal";
367
- return s === N.ORIENTATION.VERTICAL ? K(
368
- f,
362
+ const u = j[e].findIndex((V) => V.value === r), P = Z(r, e), I = (l == null ? void 0 : l.priceSinglePrice) ?? (c == null ? void 0 : c["data-product_price_control_single_price"]) === "1" ?? !1;
363
+ v = h.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[u >= 0 ? u : 0], F = h.PAIRS_FOR_EXTENSION.name[e].DEFAULT[u >= 0 ? u : 0];
364
+ const $ = h.PAIRS_FOR_EXTENSION.price[e], b = h.PAIRS_FOR_EXTENSION.originalPrice[e];
365
+ I ? (x = n ? $.DEFAULT_SINGLE_PRICE_FORMATTED : $.DEFAULT_SINGLE_PRICE, L = n ? b.DEFAULT_SINGLE_PRICE_FORMATTED : b.DEFAULT_SINGLE_PRICE) : (x = n ? $.DEFAULT_PRICE_FORMATTED : $.DEFAULT_PRICE, L = n ? b.DEFAULT_PRICE_FORMATTED : b.DEFAULT_PRICE), X = h.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT;
366
+ const A = E || (l == null ? void 0 : l.priceOrientation) || "horizontal", D = (l == null ? void 0 : l.priceHideDiscount) ?? M.productPriceHideDiscountControlValue === "1";
367
+ return s === N.ORIENTATION.VERTICAL ? B(
368
+ J,
369
369
  e,
370
370
  P,
371
371
  s,
@@ -374,18 +374,18 @@ function It({
374
374
  a,
375
375
  i,
376
376
  c,
377
- void 0,
377
+ String(D),
378
378
  // nodup
379
- r,
380
- p,
379
+ l,
380
+ o,
381
381
  t,
382
382
  A,
383
- o,
383
+ p,
384
384
  T,
385
385
  _,
386
386
  I
387
- ) : K(
388
- j,
387
+ ) : B(
388
+ C,
389
389
  e,
390
390
  P,
391
391
  s,
@@ -394,13 +394,13 @@ function It({
394
394
  a,
395
395
  i,
396
396
  c,
397
- void 0,
397
+ String(D),
398
398
  // nodup
399
- r,
400
- p,
399
+ l,
400
+ o,
401
401
  t,
402
402
  A,
403
- o,
403
+ p,
404
404
  T,
405
405
  _,
406
406
  I
@@ -1,4 +1,4 @@
1
- import { useOnboardingApi as r } from "../services/onboardingApi.js";
1
+ import { useOnboardingApi as s } from "../services/onboardingApi.js";
2
2
  import { defineStore as e } from "pinia";
3
3
  const t = () => ({
4
4
  cardIndex: 0,
@@ -72,8 +72,8 @@ const t = () => ({
72
72
  this.onboardings[n].cardIndex > 0 && this.onboardings[n].cardIndex--;
73
73
  },
74
74
  updateCardPosition(n, i, o) {
75
- const s = this.onboardings[n].config[i];
76
- s && (s.top = o.top, s.position = o.position);
75
+ const r = this.onboardings[n].config[i];
76
+ r && (r.top = o.top, r.position = o.position);
77
77
  },
78
78
  setConfig(n, i) {
79
79
  this.onboardings[n].config = i ?? [], this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
@@ -93,12 +93,16 @@ const t = () => ({
93
93
  async fetchUserModalState() {
94
94
  if (this.isFetched)
95
95
  return;
96
- const { fetchUserModalState: n } = r(), i = await n();
97
- this.userModalState = i, this.isFetched = !0;
96
+ const { fetchUserModalState: n } = s();
97
+ try {
98
+ const i = await n();
99
+ this.userModalState = i, this.isFetched = !0;
100
+ } catch {
101
+ }
98
102
  },
99
103
  async setUserModalState(n, i, o) {
100
- const { setUserModalState: s } = r();
101
- await s(n, i, o), this.isFetched = !1, await this.fetchUserModalState();
104
+ const { setUserModalState: r } = s();
105
+ await r(n, i, o), this.isFetched = !1, await this.fetchUserModalState();
102
106
  }
103
107
  }
104
108
  });
@@ -1,88 +1,100 @@
1
- import { productPairs as q } from "../extensions/Blocks/Items/enums/productEnums.js";
2
- import { DefaultConfigValues as O } from "../extensions/Blocks/Items/enums/settingsEnums.js";
3
- import { preserveTextStyles as C } from "./preserveTextStyles.js";
4
- import { unwrapProductNameLinks as U } from "./unwrapProductNameLink.js";
5
- function Y(L) {
6
- const H = L.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), b = new DOMParser().parseFromString(H, "text/html");
7
- U(b);
8
- const R = q.PAIRS_FOR_EXTENSION;
9
- Object.entries(R).forEach(([r, u]) => {
10
- b.querySelectorAll(".ins-product-td").forEach((l) => {
11
- const h = l.getAttribute("data-number") || "1", $ = l.getAttribute("data-type") || "CART_ITEMS";
12
- l.querySelectorAll(`[product-attr="${r}"]`).forEach((t) => {
13
- var F, I, w;
14
- const T = t.getAttribute("data-type") || $, f = t.getAttribute("data-number") || h, d = u[T];
15
- if (d)
16
- switch (r) {
1
+ import { productPairs as L } from "../extensions/Blocks/Items/enums/productEnums.js";
2
+ import { DefaultConfigValues as V } from "../extensions/Blocks/Items/enums/settingsEnums.js";
3
+ import { escapeReplacement as G } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
4
+ import { preserveTextStyles as F } from "./preserveTextStyles.js";
5
+ import { unwrapProductNameLinks as X } from "./unwrapProductNameLink.js";
6
+ const x = {
7
+ CART_ITEMS: "ins_apr",
8
+ BROWSED_ITEMS: "browsed_item",
9
+ PURCHASED_ITEMS: "purchased_item"
10
+ }, N = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
11
+ function v(S, H, g) {
12
+ let $ = H;
13
+ for (; $ > 0 && /\s/.test(S[$ - 1]); )
14
+ $ -= 1;
15
+ return g.some((I) => S.endsWith(I, $));
16
+ }
17
+ function J(S) {
18
+ const H = N(S), g = new DOMParser().parseFromString(H, "text/html");
19
+ X(g);
20
+ const $ = L.PAIRS_FOR_EXTENSION;
21
+ Object.entries($).forEach(([n, d]) => {
22
+ g.querySelectorAll(".ins-product-td").forEach((r) => {
23
+ const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
24
+ r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
25
+ var T, P, D;
26
+ const R = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[R];
27
+ if (f)
28
+ switch (n) {
17
29
  case "imageSrc": {
18
- let e = null, c = null;
19
- if (t.tagName === "IMG" ? (e = t, c = e.closest("a")) : (e = t.querySelector("img"), c = t.querySelector("a") || t.closest("a")), !e)
30
+ let e = null, s = null;
31
+ if (t.tagName === "IMG" ? (e = t, s = e.closest("a")) : (e = t.querySelector("img"), s = t.querySelector("a") || t.closest("a")), !e)
20
32
  break;
21
- const i = d.DEFAULT, a = d.ATTR;
22
- if (i && e.src) {
23
- const o = e.src;
24
- i.some((E) => {
25
- const s = E.split("/").pop() || "", g = o.split("/").pop() || "";
26
- return o.includes(E) || o.includes(s) || g === s;
27
- }) && (e.src = `{{${a}_${f}}}`);
33
+ const a = f.DEFAULT, l = f.ATTR;
34
+ if (a && e.src) {
35
+ const i = e.src;
36
+ a.some((b) => {
37
+ const u = b.split("/").pop() || "", y = i.split("/").pop() || "";
38
+ return i.includes(b) || i.includes(u) || y === u;
39
+ }) && (e.src = `{{${l}_${o}}}`);
28
40
  }
29
- const n = (I = (F = R.name) == null ? void 0 : F[T]) == null ? void 0 : I.ATTR;
30
- if (n && e.setAttribute("alt", `{{${n}_${f}}}`), c) {
31
- const o = (w = R.itemLink) == null ? void 0 : w[T];
32
- if (o) {
33
- const A = o.HREF, E = o.DEFAULT_HREF || "#!", s = c.href;
34
- (s === "#" || s === "" || s.endsWith("#!") || s.endsWith(E) || s === `${window.location.href}${E}` || !s || s === window.location.href) && (c.href = `{{${A}_${f}}}`);
41
+ const c = (P = (T = $.name) == null ? void 0 : T[R]) == null ? void 0 : P.ATTR;
42
+ if (c && e.setAttribute("alt", `{{${c}_${o}}}`), s) {
43
+ const i = (D = $.itemLink) == null ? void 0 : D[R];
44
+ if (i) {
45
+ const _ = i.HREF, b = i.DEFAULT_HREF || "#!", u = s.href;
46
+ (u === "#" || u === "" || u.endsWith("#!") || u.endsWith(b) || u === `${window.location.href}${b}` || !u || u === window.location.href) && (s.href = `{{${_}_${o}}}`);
35
47
  }
36
48
  }
37
49
  break;
38
50
  }
39
51
  case "name": {
40
- const e = d, c = e.ATTR, i = e.DEFAULT_HREF || "#!", a = e.HREF;
41
- t.textContent && (t.innerHTML = C(t, `{{${c}_${f}}}`));
42
- const n = t.closest("a") || (t.tagName === "A" ? t : null);
43
- if (n && a) {
44
- const o = n.href, A = `${window.location.href}${i}`;
45
- (o === A || o.endsWith(i)) && (n.href = `{{${a}_${f}}}`);
52
+ const e = f, s = e.ATTR, a = e.DEFAULT_HREF || "#!", l = e.HREF;
53
+ t.textContent && (t.innerHTML = F(t, `{{${s}_${o}}}`));
54
+ const c = t.closest("a") || (t.tagName === "A" ? t : null);
55
+ if (c && l) {
56
+ const i = c.href, _ = `${window.location.href}${a}`;
57
+ (i === _ || i.endsWith(a)) && (c.href = `{{${l}_${o}}}`);
46
58
  }
47
59
  break;
48
60
  }
49
61
  case "price":
50
62
  case "originalPrice": {
51
- const e = d, c = t.getAttribute("data-formated"), i = t.getAttribute("data-single_price"), a = c === "true", n = i === "true", o = t.getAttribute("data-curency") || "before";
52
- let A;
53
- n ? A = a ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : A = a ? e.PRICE_FORMATTED : e.PRICE;
54
- const E = e.CURRENCY;
55
- let s = `{{${A}_${f}}}`;
56
- const g = (t.getAttribute("data-currency_symbol") || "").trim(), N = g !== "" && g !== O.productPriceCurrencySymbolControlValue;
57
- let m = "";
58
- N ? m = g : E && (m = `{{${E}_${f}}}`), m && (s = o === "after" ? `${s} ${m}` : `${m} ${s}`), t.innerHTML = C(t, s);
63
+ const e = f, s = t.getAttribute("data-formated"), a = t.getAttribute("data-single_price"), l = s === "true", c = a === "true", i = t.getAttribute("data-curency") || "before";
64
+ let _;
65
+ c ? _ = l ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : _ = l ? e.PRICE_FORMATTED : e.PRICE;
66
+ const b = e.CURRENCY;
67
+ let u = `{{${_}_${o}}}`;
68
+ const y = (t.getAttribute("data-currency_symbol") || "").trim(), W = y !== "" && y !== V.productPriceCurrencySymbolControlValue;
69
+ let C = "";
70
+ W ? C = y : b && (C = `{{${b}_${o}}}`), C && (u = i === "after" ? `${u} ${C}` : `${C} ${u}`), t.innerHTML = F(t, u);
59
71
  break;
60
72
  }
61
73
  case "quantity": {
62
- const e = d, c = e.ATTR, i = e.DEFAULT;
63
- t.textContent && t.textContent.trim() === i && (t.innerHTML = C(t, `{{${c}_${f}}}`));
74
+ const e = f, s = e.ATTR, a = e.DEFAULT;
75
+ t.textContent && t.textContent.trim() === a && (t.innerHTML = F(t, `{{${s}_${o}}}`));
64
76
  break;
65
77
  }
66
78
  case "button": {
67
- const e = d, c = e.HREF, i = e.DEFAULT_HREF || "#!", a = t.tagName === "A" ? t : t.querySelector("a");
68
- if (a) {
69
- const n = a.href || "", o = `${window.location.href}${i}`;
70
- (n === "" || n === "#" || n === o || n.endsWith(i) || n.endsWith("#!") || n === window.location.href) && (a.href = `{{${c}_${f}}}`);
79
+ const e = f, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t.tagName === "A" ? t : t.querySelector("a");
80
+ if (l) {
81
+ const c = l.href || "", i = `${window.location.href}${a}`;
82
+ (c === "" || c === "#" || c === i || c.endsWith(a) || c.endsWith("#!") || c === window.location.href) && (l.href = `{{${s}_${o}}}`);
71
83
  }
72
84
  break;
73
85
  }
74
86
  case "itemLink": {
75
- const e = d, c = e.HREF, i = e.DEFAULT_HREF || "#!", a = t;
76
- if (a.href) {
77
- const n = a.href, o = `${window.location.href}${i}`;
78
- (n === o || n.endsWith(i)) && (a.href = `{{${c}_${f}}}`);
87
+ const e = f, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t;
88
+ if (l.href) {
89
+ const c = l.href, i = `${window.location.href}${a}`;
90
+ (c === i || c.endsWith(a)) && (l.href = `{{${s}_${o}}}`);
79
91
  }
80
92
  break;
81
93
  }
82
94
  default: {
83
- if ("ATTR" in d) {
84
- const e = d.ATTR;
85
- t.textContent && (t.innerHTML = C(t, `{{${e}_${f}}}`));
95
+ if ("ATTR" in f) {
96
+ const e = f.ATTR;
97
+ t.textContent && (t.innerHTML = F(t, `{{${e}_${o}}}`));
86
98
  }
87
99
  break;
88
100
  }
@@ -90,55 +102,49 @@ function Y(L) {
90
102
  });
91
103
  });
92
104
  });
93
- const k = H.match(/<!DOCTYPE[^>]*>/i), P = k ? `${k[0]}
94
- ` : "", D = b.querySelectorAll(".ins-product-td"), M = [];
95
- D.forEach((r) => {
96
- const u = r.getAttribute("data-type") || "CART_ITEMS", p = r.getAttribute("data-number") || "1", l = r.outerHTML;
105
+ const I = H.match(/<!DOCTYPE[^>]*>/i), O = I ? `${I[0]}
106
+ ` : "", q = g.querySelectorAll(".ins-product-td"), M = [];
107
+ q.forEach((n) => {
108
+ const d = n.getAttribute("data-type") || "CART_ITEMS", p = n.getAttribute("data-number") || "1", r = n.outerHTML;
97
109
  M.push({
98
- element: r,
99
- outerHtml: l,
100
- type: u,
110
+ element: n,
111
+ outerHtml: r,
112
+ type: d,
101
113
  number: p
102
114
  });
103
115
  });
104
- let _ = P + b.documentElement.outerHTML;
105
- M.reverse().forEach(({ outerHtml: r, type: u, number: p }) => {
106
- let l = "";
107
- switch (u) {
108
- case "CART_ITEMS":
109
- l = "ins_apr_total_product_kind";
110
- break;
111
- case "BROWSED_ITEMS":
112
- l = "browsed_item_total_product_kind";
113
- break;
114
- case "PURCHASED_ITEMS":
115
- l = "purchased_item_total_product_kind";
116
- break;
117
- }
118
- if (l) {
119
- const $ = parseInt(p) - 1, T = `${`{% if ${l} > ${$} %}`}${r}{% endif %}`;
120
- _ = _.replace(r, T);
116
+ let A = O + g.documentElement.outerHTML;
117
+ M.reverse().forEach(({ outerHtml: n, type: d, number: p }) => {
118
+ const r = x[d], E = r ? `${r}_total_product_kind` : "";
119
+ if (E) {
120
+ const h = parseInt(p) - 1, o = `${`{% if ${E} > ${h} %}`}${n}{% endif %}`;
121
+ A = A.replace(n, G(o));
121
122
  }
122
123
  });
123
- const x = b.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), S = [];
124
- return x.forEach((r) => {
125
- var $;
126
- const u = r.getAttribute("data-number"), p = r.getAttribute("data-type");
127
- if (!u || p !== "CART_ITEMS" || (($ = r.closest(".ins-product-td")) == null ? void 0 : $.getAttribute("data-nodup")) === "false")
124
+ const U = g.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
125
+ return U.forEach((n) => {
126
+ var t;
127
+ const d = n.getAttribute("data-number"), p = n.getAttribute("data-type");
128
+ if (!d || !x[p])
128
129
  return;
129
- const h = r.closest(".product-original-price-class");
130
- if (h) {
131
- const y = h.outerHTML;
132
- S.some((T) => T.tdOuterHtml === y) || S.push({ tdOuterHtml: y, number: u });
133
- }
134
- }), S.reverse().forEach(({ tdOuterHtml: r, number: u }) => {
135
- const p = `{% if ins_apr_price_${u} != ins_apr_originalprice_${u} %}`;
136
- if (!_.includes(p) && !r.includes("{% if")) {
137
- const h = `${p}${r}{% endif %}`;
138
- _ = _.replace(r, h);
130
+ const r = n.closest(".product-original-price-class");
131
+ if (!r || k.has(r))
132
+ return;
133
+ k.add(r);
134
+ const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), h = w.get(E) ?? { number: d, type: p, wrap: [] };
135
+ h.wrap.push(m !== "false"), w.set(E, h);
136
+ }), w.forEach(({ number: n, type: d, wrap: p }, r) => {
137
+ if (r.includes("{% if") || !p.some(Boolean))
138
+ return;
139
+ const E = L.PAIRS_FOR_EXTENSION.price[d].PRICE, m = L.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, h = `{% if ${E}_${n} != ${m}_${n} %}`, t = [h, N(h)];
140
+ let R = "", o = 0, f = 0, T = A.indexOf(r);
141
+ for (; T !== -1; ) {
142
+ const P = p[f] === !0 && !v(A, T, t);
143
+ R += A.slice(o, T) + (P ? `${h}${r}{% endif %}` : r), o = T + r.length, f += 1, T = A.indexOf(r, o);
139
144
  }
140
- }), _.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
145
+ A = R + A.slice(o);
146
+ }), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
141
147
  }
142
148
  export {
143
- Y as pairProductVariables
149
+ J as pairProductVariables
144
150
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.15.0-beta.94dfda1",
3
+ "version": "3.15.0-beta.b62fba5",
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",