@useinsider/guido 3.15.0-beta.244c73c → 3.15.0-beta.360c5d6

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,21 +3,20 @@ import { MinDeviceViewport as C, DefaultPadding as b } from "../enums/recommenda
3
3
  import { useRecommendationExtensionStore as l } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
4
  import { generateCompleteFilterQuery as h } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
5
5
  import { getPartnerRecommendationParams as y } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
6
- import { sanitizeProductIds as x } from "../extensions/Blocks/Recommendation/utils/productIds.js";
7
- import { useConfigStore as P } from "../stores/config.js";
8
- const B = () => ({
6
+ import { useConfigStore as x } from "../stores/config.js";
7
+ const k = () => ({
9
8
  calculateCardWidth: ({
10
9
  mobileLeftPadding: a,
11
10
  mobileRightPadding: s,
12
11
  cardsInRow: c,
13
- unresponsive: n
12
+ unresponsive: o
14
13
  }) => {
15
- const r = n ? c : 1, e = a + s + (r - 1) * b;
14
+ const r = o ? c : 1, e = a + s + (r - 1) * b;
16
15
  return (C - e) / r;
17
16
  },
18
17
  getRecommendationCampaignData: (a) => {
19
- const s = l(), c = Number(a), n = s.blockStates[c];
20
- if (!n)
18
+ const s = l(), c = Number(a), o = s.blockStates[c];
19
+ if (!o)
21
20
  return {
22
21
  textTrimming: !1,
23
22
  orientation: "vertical",
@@ -30,7 +29,7 @@ const B = () => ({
30
29
  discountBeforeTextValue: "",
31
30
  discountAfterTextValue: ""
32
31
  };
33
- const { recommendationConfigs: r } = n, e = r.orientation === "grid" ? "vertical" : "horizontal";
32
+ const { recommendationConfigs: r } = o, e = r.orientation === "grid" ? "vertical" : "horizontal";
34
33
  return {
35
34
  textTrimming: r.textTrimming,
36
35
  orientation: e,
@@ -46,7 +45,7 @@ const B = () => ({
46
45
  },
47
46
  buildCampaignUrl: (a, s) => {
48
47
  var m;
49
- const c = l(), n = P(), r = Number(a);
48
+ const c = l(), o = x(), r = Number(a);
50
49
  let e;
51
50
  if (s)
52
51
  e = s;
@@ -54,25 +53,25 @@ const B = () => ({
54
53
  const i = c.blockStates[r];
55
54
  if (!i)
56
55
  return "";
57
- const { recommendationConfigs: o } = i;
56
+ const { recommendationConfigs: n } = i;
58
57
  e = {
59
- strategy: o.strategy,
60
- language: o.language,
61
- currencyCode: o.currencySettings.value,
62
- size: o.size,
63
- productIds: o.productIds,
64
- filters: o.filters,
65
- shuffleProducts: o.shuffleProducts
58
+ strategy: n.strategy,
59
+ language: n.language,
60
+ currencyCode: n.currencySettings.value,
61
+ size: n.size,
62
+ productIds: n.productIds,
63
+ filters: n.filters,
64
+ shuffleProducts: n.shuffleProducts
66
65
  };
67
66
  }
68
67
  const f = ((m = I().find((i) => i.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
69
- t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", n.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", n.variationId), e.strategy === "manualMerchandising" ? t.set("productId", x(e.productIds)) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
68
+ t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", o.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", o.variationId), e.strategy === "manualMerchandising" ? t.set("productId", e.productIds.join(",")) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
70
69
  const g = e.filters.filter((i) => i.isValid), d = h(g);
71
- d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(y(n.partnerName, e.strategy)).forEach(([i, o]) => t.set(i, o));
70
+ d && t.set("filter", d), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(y(o.partnerName, e.strategy)).forEach(([i, n]) => t.set(i, n));
72
71
  const p = decodeURIComponent(t.toString()), u = `${R.RECOMMENDATION_API_URL}/v2/${f}?${p}`;
73
72
  return c.recommendationCampaignUrls[a] = u, u;
74
73
  }
75
74
  });
76
75
  export {
77
- B as useRecommendation
76
+ k as useRecommendation
78
77
  };
@@ -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,23 +1,23 @@
1
- var d = Object.defineProperty;
2
- var h = (r, o, t) => o in r ? d(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t;
3
- var c = (r, o, t) => h(r, typeof o != "symbol" ? o + "" : o, t);
4
- import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as g } from "../../../common-control.js";
1
+ var c = Object.defineProperty;
2
+ var l = (s, o, t) => o in s ? c(s, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[o] = t;
3
+ var a = (s, o, t) => l(s, typeof o != "symbol" ? o + "" : o, t);
4
+ import { UEAttr as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as d } from "../../../common-control.js";
6
6
  import { RecommendationConfigService as n } from "../../services/configService.js";
7
7
  import { useRecommendationExtensionStore as m } from "../../store/recommendation.js";
8
- import { mapLegacyStrategy as u } from "../../utils/legacyStrategyMap.js";
9
- const p = "recommendation-algorithm-control", e = {
8
+ import { mapLegacyStrategy as g } from "../../utils/legacyStrategyMap.js";
9
+ const u = "recommendation-algorithm-control", i = {
10
10
  ALGORITHM: "strategy",
11
11
  PRODUCT_IDS: "productIds"
12
12
  };
13
- class S extends g {
13
+ class R extends d {
14
14
  constructor() {
15
15
  super(...arguments);
16
16
  // Store is used ONLY for API-fetched data (algorithms list), not for config
17
- c(this, "store", m());
17
+ a(this, "store", m());
18
18
  }
19
19
  getId() {
20
- return p;
20
+ return u;
21
21
  }
22
22
  getTemplate() {
23
23
  return `
@@ -25,13 +25,13 @@ class S extends g {
25
25
  ${this._GuTwoColumns([
26
26
  this._GuLabel({ text: this.api.translate("Recommendation Algorithm") }),
27
27
  this._GuSelect({
28
- name: e.ALGORITHM,
28
+ name: i.ALGORITHM,
29
29
  placeholder: this.api.translate("Select Recommendation Algorithm"),
30
30
  options: this.store.getActivePredictiveAlgorithms
31
31
  }),
32
- this._GuLabel({ text: this.api.translate("Product Ids"), name: `${e.PRODUCT_IDS}_label` }),
32
+ this._GuLabel({ text: this.api.translate("Product Ids"), name: `${i.PRODUCT_IDS}_label` }),
33
33
  this._GuTextInput({
34
- name: e.PRODUCT_IDS,
34
+ name: i.PRODUCT_IDS,
35
35
  placeholder: this.api.translate("Enter Product Ids"),
36
36
  className: "es-180w"
37
37
  })
@@ -46,28 +46,29 @@ class S extends g {
46
46
  super.onTemplateNodeUpdated(t), this._initializeSelectItems(), this._setFormValues();
47
47
  }
48
48
  _setFormValues() {
49
- const t = n.getConfig(this.currentNode), s = u(t.strategy) ?? t.strategy;
50
- this._setProductIdsVisibility(s);
51
- const i = { [e.ALGORITHM]: s }, a = t.productIds.join(",");
52
- this.api.getValues()[e.PRODUCT_IDS] !== a && (i[e.PRODUCT_IDS] = a), this.api.updateValues(i);
49
+ const t = n.getConfig(this.currentNode), e = g(t.strategy) ?? t.strategy;
50
+ this._setProductIdsVisibility(e), this.api.updateValues({
51
+ [i.ALGORITHM]: e,
52
+ [i.PRODUCT_IDS]: t.productIds.join(",")
53
+ });
53
54
  }
54
55
  _initializeSelectItems() {
55
- var s;
56
- const t = (s = this.store) == null ? void 0 : s.getActivePredictiveAlgorithms;
56
+ var e;
57
+ const t = (e = this.store) == null ? void 0 : e.getActivePredictiveAlgorithms;
57
58
  if (t != null && t.length)
58
59
  try {
59
60
  this.api.setUIEAttribute(
60
- e.ALGORITHM,
61
- l.SELECTPICKER.items,
61
+ i.ALGORITHM,
62
+ h.SELECTPICKER.items,
62
63
  t
63
64
  );
64
- } catch (i) {
65
- console.warn("[AlgorithmControl] Failed to set algorithm options:", i);
65
+ } catch (r) {
66
+ console.warn("[AlgorithmControl] Failed to set algorithm options:", r);
66
67
  }
67
68
  }
68
69
  _setProductIdsVisibility(t) {
69
- const i = (t ?? n.getConfig(this.currentNode).strategy) === "manualMerchandising";
70
- this.api.setVisibility(e.PRODUCT_IDS, i), this.api.setVisibility(`${e.PRODUCT_IDS}_label`, i);
70
+ const r = (t ?? n.getConfig(this.currentNode).strategy) === "manualMerchandising";
71
+ this.api.setVisibility(i.PRODUCT_IDS, r), this.api.setVisibility(`${i.PRODUCT_IDS}_label`, r);
71
72
  }
72
73
  _onAlgorithmChange(t) {
73
74
  !this.currentNode || n.getConfig(this.currentNode).strategy === t || (n.updateConfig(
@@ -78,25 +79,25 @@ class S extends g {
78
79
  ), this.store.patchCurrentBlockConfig({ strategy: t }), this._setProductIdsVisibility(t));
79
80
  }
80
81
  _onProductIdsChange(t) {
81
- if (!this.currentNode || n.getConfig(this.currentNode).productIds.join(",") === t)
82
+ if (!this.currentNode)
82
83
  return;
83
- const i = t.split(",");
84
+ const e = t.split(",").map((r) => r.trim()).filter(Boolean);
84
85
  n.updateConfig(
85
86
  this.api,
86
87
  this.currentNode,
87
- { productIds: i },
88
+ { productIds: e },
88
89
  "Updated product IDs"
89
- ), this.store.patchCurrentBlockConfig({ productIds: i });
90
+ ), this.store.patchCurrentBlockConfig({ productIds: e });
90
91
  }
91
92
  _listenToFormUpdates() {
92
- this.api.onValueChanged(e.ALGORITHM, (t) => {
93
+ this.api.onValueChanged(i.ALGORITHM, (t) => {
93
94
  this._onAlgorithmChange(t);
94
- }), this.api.onValueChanged(e.PRODUCT_IDS, (t) => {
95
+ }), this.api.onValueChanged(i.PRODUCT_IDS, (t) => {
95
96
  this._onProductIdsChange(t);
96
97
  });
97
98
  }
98
99
  }
99
100
  export {
100
- p as ALGORITHM_CONTROL_ID,
101
- S as AlgorithmControl
101
+ u as ALGORITHM_CONTROL_ID,
102
+ R as AlgorithmControl
102
103
  };
@@ -1,16 +1,15 @@
1
1
  import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as C } from "../../../../enums/extensions/recommendationBlock.js";
2
2
  import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
3
3
  import { useConfigStore as G } from "../../../../stores/config.js";
4
- import { defineStore as P } from "pinia";
4
+ import { defineStore as F } from "pinia";
5
5
  import "../constants/selectors.js";
6
- import { DEFAULT_MOBILE_CARDS_IN_ROW as F, DEFAULT_CARDS_IN_ROW as D } from "../constants/layout.js";
6
+ import { DEFAULT_MOBILE_CARDS_IN_ROW as P, DEFAULT_CARDS_IN_ROW as D } from "../constants/layout.js";
7
7
  import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
8
8
  import { getDefaultProducts as S } from "../templates/utils.js";
9
9
  import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
10
10
  import { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
11
- import { sanitizeProductIds as N } from "../utils/productIds.js";
12
- import { isFilterValid as x } from "../validation/filterSchema.js";
13
- import { isConfigValid as L } from "../validation/requiredFields.js";
11
+ import { isFilterValid as N } from "../validation/filterSchema.js";
12
+ import { isConfigValid as x } from "../validation/requiredFields.js";
14
13
  const h = y();
15
14
  let m = null, u = null, d = null;
16
15
  function k() {
@@ -29,7 +28,7 @@ function k() {
29
28
  productIds: [],
30
29
  id: 1,
31
30
  language: "en_US",
32
- mobileCardsInRow: F,
31
+ mobileCardsInRow: P,
33
32
  mobileLayoutEnabled: !1,
34
33
  orientation: "grid",
35
34
  recommendedProducts: [],
@@ -55,7 +54,7 @@ function I() {
55
54
  filterSnapshot: null
56
55
  };
57
56
  }
58
- const U = () => ({
57
+ const L = () => ({
59
58
  recommendationCampaignUrls: {},
60
59
  activePredictiveAlgorithms: [],
61
60
  languages: {},
@@ -64,8 +63,8 @@ const U = () => ({
64
63
  blockStates: {},
65
64
  currentRecommendationId: null,
66
65
  configVersion: 0
67
- }), H = P("guidoRecommendationExtension", {
68
- state: () => U(),
66
+ }), $ = F("guidoRecommendationExtension", {
67
+ state: () => L(),
69
68
  getters: {
70
69
  // ====================================================================
71
70
  // Proxy Getters — Backward Compatible Access to Current Block State
@@ -384,7 +383,7 @@ const U = () => ({
384
383
  const n = [...e.recommendationConfigs.filters];
385
384
  n[r] = {
386
385
  ...t,
387
- isValid: x(t)
386
+ isValid: N(t)
388
387
  }, e.recommendationConfigs.filters = n;
389
388
  }
390
389
  },
@@ -430,7 +429,7 @@ const U = () => ({
430
429
  * every block's recommendationConfigs across user edits.
431
430
  */
432
431
  hasInvalidBlock() {
433
- return Object.values(this.blockStates).some((t) => !L(t.recommendationConfigs, this));
432
+ return Object.values(this.blockStates).some((t) => !x(t.recommendationConfigs, this));
434
433
  },
435
434
  // ====================================================================
436
435
  // Per-Block Product Fetching
@@ -459,7 +458,7 @@ const U = () => ({
459
458
  details: !0,
460
459
  campaignId: o.variationId
461
460
  };
462
- r.strategy === "manualMerchandising" ? a.productId = N(r.productIds) : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
461
+ r.strategy === "manualMerchandising" ? a.productId = r.productIds.join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
463
462
  a,
464
463
  v(o.partnerName, r.strategy)
465
464
  );
@@ -480,5 +479,5 @@ const U = () => ({
480
479
  }
481
480
  });
482
481
  export {
483
- H as useRecommendationExtensionStore
482
+ $ as useRecommendationExtensionStore
484
483
  };
@@ -1,88 +1,94 @@
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)
1
+ import { productPairs as I } from "../extensions/Blocks/Items/enums/productEnums.js";
2
+ import { DefaultConfigValues as G } from "../extensions/Blocks/Items/enums/settingsEnums.js";
3
+ import { escapeReplacement as N } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
4
+ import { preserveTextStyles as S } 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
+ }, O = (m) => m.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
11
+ function z(m) {
12
+ const P = O(m), b = new DOMParser().parseFromString(P, "text/html");
13
+ X(b);
14
+ const C = I.PAIRS_FOR_EXTENSION;
15
+ Object.entries(C).forEach(([r, l]) => {
16
+ b.querySelectorAll(".ins-product-td").forEach((u) => {
17
+ const p = u.getAttribute("data-number") || "1", T = u.getAttribute("data-type") || "CART_ITEMS";
18
+ u.querySelectorAll(`[product-attr="${r}"]`).forEach((t) => {
19
+ var w, k, D;
20
+ const _ = t.getAttribute("data-type") || T, f = t.getAttribute("data-number") || p, A = l[_];
21
+ if (A)
16
22
  switch (r) {
17
23
  case "imageSrc": {
18
24
  let e = null, c = null;
19
25
  if (t.tagName === "IMG" ? (e = t, c = e.closest("a")) : (e = t.querySelector("img"), c = t.querySelector("a") || t.closest("a")), !e)
20
26
  break;
21
- const i = d.DEFAULT, a = d.ATTR;
27
+ const i = A.DEFAULT, s = A.ATTR;
22
28
  if (i && e.src) {
23
29
  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}}}`);
30
+ i.some(($) => {
31
+ const a = $.split("/").pop() || "", g = o.split("/").pop() || "";
32
+ return o.includes($) || o.includes(a) || g === a;
33
+ }) && (e.src = `{{${s}_${f}}}`);
28
34
  }
29
- const n = (I = (F = R.name) == null ? void 0 : F[T]) == null ? void 0 : I.ATTR;
35
+ const n = (k = (w = C.name) == null ? void 0 : w[_]) == null ? void 0 : k.ATTR;
30
36
  if (n && e.setAttribute("alt", `{{${n}_${f}}}`), c) {
31
- const o = (w = R.itemLink) == null ? void 0 : w[T];
37
+ const o = (D = C.itemLink) == null ? void 0 : D[_];
32
38
  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}}}`);
39
+ const E = o.HREF, $ = o.DEFAULT_HREF || "#!", a = c.href;
40
+ (a === "#" || a === "" || a.endsWith("#!") || a.endsWith($) || a === `${window.location.href}${$}` || !a || a === window.location.href) && (c.href = `{{${E}_${f}}}`);
35
41
  }
36
42
  }
37
43
  break;
38
44
  }
39
45
  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}}}`));
46
+ const e = A, c = e.ATTR, i = e.DEFAULT_HREF || "#!", s = e.HREF;
47
+ t.textContent && (t.innerHTML = S(t, `{{${c}_${f}}}`));
42
48
  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}}}`);
49
+ if (n && s) {
50
+ const o = n.href, E = `${window.location.href}${i}`;
51
+ (o === E || o.endsWith(i)) && (n.href = `{{${s}_${f}}}`);
46
52
  }
47
53
  break;
48
54
  }
49
55
  case "price":
50
56
  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);
57
+ const e = A, c = t.getAttribute("data-formated"), i = t.getAttribute("data-single_price"), s = c === "true", n = i === "true", o = t.getAttribute("data-curency") || "before";
58
+ let E;
59
+ n ? E = s ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : E = s ? e.PRICE_FORMATTED : e.PRICE;
60
+ const $ = e.CURRENCY;
61
+ let a = `{{${E}_${f}}}`;
62
+ const g = (t.getAttribute("data-currency_symbol") || "").trim(), W = g !== "" && g !== G.productPriceCurrencySymbolControlValue;
63
+ let y = "";
64
+ W ? y = g : $ && (y = `{{${$}_${f}}}`), y && (a = o === "after" ? `${a} ${y}` : `${y} ${a}`), t.innerHTML = S(t, a);
59
65
  break;
60
66
  }
61
67
  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}}}`));
68
+ const e = A, c = e.ATTR, i = e.DEFAULT;
69
+ t.textContent && t.textContent.trim() === i && (t.innerHTML = S(t, `{{${c}_${f}}}`));
64
70
  break;
65
71
  }
66
72
  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}}}`);
73
+ const e = A, c = e.HREF, i = e.DEFAULT_HREF || "#!", s = t.tagName === "A" ? t : t.querySelector("a");
74
+ if (s) {
75
+ const n = s.href || "", o = `${window.location.href}${i}`;
76
+ (n === "" || n === "#" || n === o || n.endsWith(i) || n.endsWith("#!") || n === window.location.href) && (s.href = `{{${c}_${f}}}`);
71
77
  }
72
78
  break;
73
79
  }
74
80
  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}}}`);
81
+ const e = A, c = e.HREF, i = e.DEFAULT_HREF || "#!", s = t;
82
+ if (s.href) {
83
+ const n = s.href, o = `${window.location.href}${i}`;
84
+ (n === o || n.endsWith(i)) && (s.href = `{{${c}_${f}}}`);
79
85
  }
80
86
  break;
81
87
  }
82
88
  default: {
83
- if ("ATTR" in d) {
84
- const e = d.ATTR;
85
- t.textContent && (t.innerHTML = C(t, `{{${e}_${f}}}`));
89
+ if ("ATTR" in A) {
90
+ const e = A.ATTR;
91
+ t.textContent && (t.innerHTML = S(t, `{{${e}_${f}}}`));
86
92
  }
87
93
  break;
88
94
  }
@@ -90,55 +96,50 @@ function Y(L) {
90
96
  });
91
97
  });
92
98
  });
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;
97
- M.push({
99
+ const F = P.match(/<!DOCTYPE[^>]*>/i), q = F ? `${F[0]}
100
+ ` : "", U = b.querySelectorAll(".ins-product-td"), L = [];
101
+ U.forEach((r) => {
102
+ const l = r.getAttribute("data-type") || "CART_ITEMS", d = r.getAttribute("data-number") || "1", u = r.outerHTML;
103
+ L.push({
98
104
  element: r,
99
- outerHtml: l,
100
- type: u,
101
- number: p
105
+ outerHtml: u,
106
+ type: l,
107
+ number: d
102
108
  });
103
109
  });
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);
110
+ let h = q + b.documentElement.outerHTML;
111
+ L.reverse().forEach(({ outerHtml: r, type: l, number: d }) => {
112
+ const u = x[l], p = u ? `${u}_total_product_kind` : "";
113
+ if (p) {
114
+ const R = parseInt(d) - 1, f = `${`{% if ${p} > ${R} %}`}${r}{% endif %}`;
115
+ h = h.replace(r, N(f));
121
116
  }
122
117
  });
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")
118
+ const V = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), H = [], M = /* @__PURE__ */ new Set();
119
+ return V.forEach((r) => {
120
+ var t;
121
+ const l = r.getAttribute("data-number"), d = r.getAttribute("data-type");
122
+ if (!l || !x[d])
123
+ return;
124
+ const u = r.closest(".product-original-price-class");
125
+ if (!u)
126
+ return;
127
+ const p = u.outerHTML;
128
+ if (((t = r.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup")) === "false") {
129
+ M.add(p);
128
130
  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);
139
131
  }
140
- }), _.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
132
+ H.some((_) => _.tdOuterHtml === p) || H.push({ tdOuterHtml: p, number: l, type: d });
133
+ }), H.forEach(({ tdOuterHtml: r, number: l, type: d }) => {
134
+ if (M.has(r))
135
+ return;
136
+ const u = I.PAIRS_FOR_EXTENSION.price[d].PRICE, p = I.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${u}_${l} != ${p}_${l} %}`, R = h.includes(`${T}${r}`) || h.includes(`${O(T)}${r}`);
137
+ r.includes("{% if") || R || (h = h.replaceAll(
138
+ r,
139
+ N(`${T}${r}{% endif %}`)
140
+ ));
141
+ }), h.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
141
142
  }
142
143
  export {
143
- Y as pairProductVariables
144
+ z as pairProductVariables
144
145
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.15.0-beta.244c73c",
3
+ "version": "3.15.0-beta.360c5d6",
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",
@@ -1,6 +0,0 @@
1
- function n(t) {
2
- return t.map((i) => i.trim()).filter(Boolean).join(",");
3
- }
4
- export {
5
- n as sanitizeProductIds
6
- };
@@ -1,6 +0,0 @@
1
- /**
2
- * Builds the request/URL `productId` value from raw product ID segments.
3
- * Trimming happens here — NOT on input change — so the user's in-progress
4
- * text (trailing commas, spaces) is never rewritten under the caret (SD-147111).
5
- */
6
- export declare function sanitizeProductIds(ids: string[]): string;