@useinsider/guido 3.10.0-beta.f7505c1 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -122,10 +122,10 @@ const d = [
122
122
  ], i = /<head>([\S\s]*)<\/head>/, o = new RegExp(i);
123
123
  if (!e.match(o))
124
124
  return e;
125
- let s = e;
126
- return t.forEach((r) => {
127
- s = s.replace("</head>", `${r}</head>`);
128
- }), s;
125
+ let r = e;
126
+ return t.forEach((s) => {
127
+ r = r.replace("</head>", `${s}</head>`);
128
+ }), r;
129
129
  },
130
130
  priority: 30
131
131
  },
@@ -156,9 +156,9 @@ const d = [
156
156
  type: "custom",
157
157
  processor: (e) => {
158
158
  const t = (i) => i.toString(16).padStart(2, "0");
159
- return e.replace(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/gi, (i, o, n, s) => {
160
- const [r, a, c] = [Number(o), Number(n), Number(s)];
161
- return r > 255 || a > 255 || c > 255 ? i : `#${t(r)}${t(a)}${t(c)}`;
159
+ return e.replace(/rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)/gi, (i, o, n, r) => {
160
+ const [s, a, c] = [Number(o), Number(n), Number(r)];
161
+ return s > 255 || a > 255 || c > 255 ? i : `#${t(s)}${t(a)}${t(c)}`;
162
162
  }).replace(/#([0-9a-f])\1([0-9a-f])\2([0-9a-f])\3\b/gi, "#$1$2$3");
163
163
  },
164
164
  priority: 44
@@ -174,6 +174,29 @@ const d = [
174
174
  replacement: "",
175
175
  flags: "g",
176
176
  priority: 45
177
+ },
178
+ {
179
+ id: "remove-script-tags",
180
+ // SD-145051: parity with HB HtmlCleaner.removeUnsafeHtmlTags — strip <script> from
181
+ // compiled email. Priority 50 runs after the &lt;/&gt; unescape rules (13/14) so
182
+ // post-unescape tags are still caught. Do NOT add to AMP_SAFE_RULE_IDS (AMP needs <script>).
183
+ description: "Strip <script>…<\/script> tags from compiled email",
184
+ type: "regex",
185
+ pattern: "<script[^>]*>.*?<\/script>",
186
+ replacement: "",
187
+ flags: "gis",
188
+ priority: 50
189
+ },
190
+ {
191
+ id: "remove-iframe-tags",
192
+ // SD-145051: parity with HB HtmlCleaner.removeUnsafeHtmlTags — strip <iframe>.
193
+ // Do NOT add this id to AMP_SAFE_RULE_IDS.
194
+ description: "Strip <iframe>…</iframe> tags from compiled email",
195
+ type: "regex",
196
+ pattern: "<iframe[^>]*>.*?</iframe>",
197
+ replacement: "",
198
+ flags: "gis",
199
+ priority: 51
177
200
  }
178
201
  ];
179
202
  export {
@@ -1,189 +1,176 @@
1
- import { useConfig as q } from "../../../composables/useConfig.js";
2
- import { useRecommendation as C } from "../../../composables/useRecommendation.js";
3
- import { CSS_CLASS_RECO_BUTTON as E } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
4
- import { useRecommendationExtensionStore as w } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
- import { isIgnoredRecommendationBlock as P } from "./recommendationIgnoreUtils.js";
6
- function f(t, o, e, n, s = "") {
7
- const i = `{{${s}${t}_${o}_${e}}}`, r = `{{${s}${t}_${o}_currency}}`;
8
- return n === "before" ? `${r} ${i}` : `${i} ${r}`;
1
+ import { useConfig as _ } from "../../../composables/useConfig.js";
2
+ import { useRecommendation as q } from "../../../composables/useRecommendation.js";
3
+ import { CSS_CLASS_RECO_BUTTON as C } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
4
+ import { useRecommendationExtensionStore as E } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ import { isIgnoredRecommendationBlock as w } from "./recommendationIgnoreUtils.js";
6
+ function P(t, r, e, n, s = "") {
7
+ const c = `{{${s}${t}_${r}_${e}}}`, o = `{{${s}${t}_${r}_currency}}`;
8
+ return n === "before" ? `${o} ${c}` : `${c} ${o}`;
9
9
  }
10
10
  function m(t) {
11
- let o = t;
12
- for (; o.children.length === 1; )
13
- [o] = o.children;
14
- return o;
11
+ let r = t;
12
+ for (; r.children.length === 1; )
13
+ [r] = r.children;
14
+ return r;
15
15
  }
16
- function h(t, o, e, n, s, i) {
17
- switch (o) {
16
+ function b(t, r, e, n, s, c) {
17
+ switch (r) {
18
18
  case "productImage": {
19
- const r = t.querySelector("img");
20
- r && (r.setAttribute("src", `{{${i}${e}_${n}_image_url}}`), r.setAttribute("alt", `{{${i}${e}_${n}_name}}`));
21
- const c = t.querySelector("a");
22
- c && (c.setAttribute("href", `{{${i}${e}_${n}_url}}`), c.classList.add(E));
19
+ const o = t.querySelector("img");
20
+ o && (o.setAttribute("src", `{{${c}${e}_${n}_image_url}}`), o.setAttribute("alt", `{{${c}${e}_${n}_name}}`));
21
+ const i = t.querySelector("a");
22
+ i && (i.setAttribute("href", `{{${c}${e}_${n}_url}}`), i.classList.add(C));
23
23
  break;
24
24
  }
25
25
  case "productName": {
26
- const r = t.querySelector("p");
27
- r && (m(r).textContent = `{{${i}${e}_${n}_name}}`);
28
- break;
29
- }
30
- case "productPrice": {
31
- const r = t.querySelector(".product-price p") ?? t.querySelector("p");
32
- r && (m(r).textContent = f(
33
- e,
34
- n,
35
- "price",
36
- s,
37
- i
38
- ));
39
- const c = t.querySelector(".product-old-price p");
40
- c && (m(c).textContent = f(
41
- e,
42
- n,
43
- "original_price",
44
- s,
45
- i
46
- ));
26
+ const o = t.querySelector("p");
27
+ o && (m(o).textContent = `{{${c}${e}_${n}_name}}`);
47
28
  break;
48
29
  }
30
+ // Inline mode ("Move to next line" OFF) merges BOTH prices into one row
31
+ // anchored on whichever attribute comes first in the composition, so
32
+ // substitute by cell content, not by the row's anchor (SD-145161).
33
+ case "productPrice":
49
34
  case "productOldPrice": {
50
- const r = t.querySelector("p");
51
- r && (m(r).textContent = f(
52
- e,
53
- n,
54
- "original_price",
55
- s,
56
- i
57
- ));
35
+ const o = (d, l) => {
36
+ d && (m(d).textContent = P(
37
+ e,
38
+ n,
39
+ l,
40
+ s,
41
+ c
42
+ ));
43
+ }, i = t.querySelector(".product-price p"), a = t.querySelector(".product-old-price p"), u = !i && !a ? t.querySelector("p") : null;
44
+ o(i ?? (r === "productPrice" ? u : null), "price"), o(a ?? (r === "productOldPrice" ? u : null), "original_price");
58
45
  break;
59
46
  }
60
47
  case "productButton": {
61
- const r = t.querySelector("a");
62
- r && r.setAttribute("href", `{{${i}${e}_${n}_url}}`);
48
+ const o = t.querySelector("a");
49
+ o && o.setAttribute("href", `{{${c}${e}_${n}_url}}`);
63
50
  break;
64
51
  }
65
52
  case "productOmnibusPrice": {
66
- const r = t.querySelector(".omnibus-price-value");
67
- if (r) {
68
- r.textContent = `{{${i}${e}_${n}_omnibus_price}}`;
69
- const c = r.closest("p");
70
- c && (c.setAttribute("product-attr", "omnibus_price"), c.setAttribute("composition", "true"));
53
+ const o = t.querySelector(".omnibus-price-value");
54
+ if (o) {
55
+ o.textContent = `{{${c}${e}_${n}_omnibus_price}}`;
56
+ const i = o.closest("p");
57
+ i && (i.setAttribute("product-attr", "omnibus_price"), i.setAttribute("composition", "true"));
71
58
  }
72
59
  break;
73
60
  }
74
61
  case "productOmnibusDiscount": {
75
- const r = t.querySelector(".omnibus-discount-value");
76
- if (r) {
77
- r.textContent = `{{${i}${e}_${n}_omnibus_discount}}`;
78
- const c = r.closest("p");
79
- c && (c.setAttribute("product-attr", "omnibus_discount"), c.setAttribute("composition", "true"));
62
+ const o = t.querySelector(".omnibus-discount-value");
63
+ if (o) {
64
+ o.textContent = `{{${c}${e}_${n}_omnibus_discount}}`;
65
+ const i = o.closest("p");
66
+ i && (i.setAttribute("product-attr", "omnibus_discount"), i.setAttribute("composition", "true"));
80
67
  }
81
68
  break;
82
69
  }
83
70
  default: {
84
- const r = t.getAttribute("product-attr") ? t : t.querySelector("[product-attr]");
85
- if (r) {
86
- const c = r.getAttribute("product-attr"), l = r.querySelector("p");
87
- l && (m(l).textContent = `{{${i}${e}_${n}_${c}}}`);
71
+ const o = t.getAttribute("product-attr") ? t : t.querySelector("[product-attr]");
72
+ if (o) {
73
+ const i = o.getAttribute("product-attr"), a = o.querySelector("p");
74
+ a && (m(a).textContent = `{{${c}${e}_${n}_${i}}}`);
88
75
  }
89
76
  break;
90
77
  }
91
78
  }
92
79
  }
93
- function R(t, o, e, n) {
94
- t.querySelectorAll(".recommendation-product-row").forEach((i, r) => {
95
- i.querySelectorAll("[data-attribute-type]").forEach((l) => {
96
- const u = l.getAttribute("data-attribute-type") || "", p = l.querySelectorAll(".attribute-cell");
97
- p.length > 0 ? p.forEach((a) => {
98
- h(a, u, o, r, e, n);
99
- }) : h(l, u, o, r, e, n);
80
+ function R(t, r, e, n) {
81
+ t.querySelectorAll(".recommendation-product-row").forEach((c, o) => {
82
+ c.querySelectorAll("[data-attribute-type]").forEach((a) => {
83
+ const u = a.getAttribute("data-attribute-type") || "", d = a.querySelectorAll(".attribute-cell");
84
+ d.length > 0 ? d.forEach((l) => {
85
+ b(l, u, r, o, e, n);
86
+ }) : b(a, u, r, o, e, n);
100
87
  });
101
88
  });
102
89
  }
103
- function W(t, o, e, n) {
90
+ function W(t, r, e, n) {
104
91
  const s = t.querySelectorAll(".recommendation-product-row");
105
92
  if (!s.length)
106
93
  return;
107
- const [i] = s, r = i.querySelector("[data-attribute-type]"), c = r ? r.querySelectorAll(".attribute-cell").length : 1;
108
- s.forEach((l, u) => {
109
- l.querySelectorAll("[data-attribute-type]").forEach((a) => {
110
- const d = a.getAttribute("data-attribute-type") || "";
111
- a.querySelectorAll(".attribute-cell").forEach((S, _) => {
112
- const g = u * c + _;
113
- h(S, d, o, g, e, n);
94
+ const [c] = s, o = c.querySelector("[data-attribute-type]"), i = o ? o.querySelectorAll(".attribute-cell").length : 1;
95
+ s.forEach((a, u) => {
96
+ a.querySelectorAll("[data-attribute-type]").forEach((l) => {
97
+ const p = l.getAttribute("data-attribute-type") || "";
98
+ l.querySelectorAll(".attribute-cell").forEach(($, S) => {
99
+ const g = u * i + S;
100
+ b($, p, r, g, e, n);
114
101
  });
115
102
  });
116
103
  });
117
104
  }
118
- function v(t, o, e, n) {
119
- t.querySelectorAll(".ins-recommendation-product-container").forEach((i) => {
120
- W(i, o, e, n);
105
+ function v(t, r, e, n) {
106
+ t.querySelectorAll(".ins-recommendation-product-container").forEach((c) => {
107
+ W(c, r, e, n);
121
108
  });
122
109
  }
123
- function O(t, o, e) {
110
+ function O(t, r, e) {
124
111
  const n = t.getAttribute("data-layout") || "grid", s = t.getAttribute("currency-alignment") || "after";
125
- n === "list" ? R(t, o, s, e) : v(t, o, s, e);
112
+ n === "list" ? R(t, r, s, e) : v(t, r, s, e);
126
113
  }
127
- function b(t, o, e) {
128
- const n = new RegExp(`${o}\\s*:\\s*(\\d+)\\s*px`, "i"), s = t.match(n);
114
+ function f(t, r, e) {
115
+ const n = new RegExp(`${r}\\s*:\\s*(\\d+)\\s*px`, "i"), s = t.match(n);
129
116
  return s ? parseInt(s[1]) : e;
130
117
  }
131
- function A(t) {
132
- const o = t.trim();
133
- return o.endsWith("%") ? parseFloat(o) < 100 : /^\d+(?:\.\d+)?(?:px)?$/.test(o) && parseInt(o) > 0;
118
+ function y(t) {
119
+ const r = t.trim();
120
+ return r.endsWith("%") ? parseFloat(r) < 100 : /^\d+(?:\.\d+)?(?:px)?$/.test(r) && parseInt(r) > 0;
134
121
  }
135
- function $(t) {
136
- const o = t.getAttribute("width");
137
- if (o && A(o))
138
- return o.trim();
122
+ function A(t) {
123
+ const r = t.getAttribute("width");
124
+ if (r && y(r))
125
+ return r.trim();
139
126
  const e = (t.getAttribute("style") || "").match(/(?:^|[;\s])width\s*:\s*(\d+(?:\.\d+)?(?:px|%))/i);
140
- return e && A(e[1]) ? e[1] : null;
127
+ return e && y(e[1]) ? e[1] : null;
141
128
  }
142
- function T(t, o) {
129
+ function M(t, r) {
143
130
  let e = t.parentElement;
144
- for (; e && e !== o; ) {
145
- if (e.tagName === "TD" && $(e))
131
+ for (; e && e !== r; ) {
132
+ if (e.tagName === "TD" && A(e))
146
133
  return e;
147
134
  e = e.parentElement;
148
135
  }
149
136
  return null;
150
137
  }
151
- function M(t) {
152
- const o = t.getAttribute("style") || "", e = b(o, "width", 600), n = b(o, "padding", 0) * 2, s = Math.max(0, e - n);
153
- s !== 0 && t.querySelectorAll("img.adapt-img").forEach((i) => {
154
- if (i.hasAttribute("width"))
138
+ function T(t) {
139
+ const r = t.getAttribute("style") || "", e = f(r, "width", 600), n = f(r, "padding", 0) * 2, s = Math.max(0, e - n);
140
+ s !== 0 && t.querySelectorAll("img.adapt-img").forEach((c) => {
141
+ if (c.hasAttribute("width"))
155
142
  return;
156
- const r = T(i, t);
157
- if (!r)
143
+ const o = M(c, t);
144
+ if (!o)
158
145
  return;
159
- const c = $(r), l = b(r.getAttribute("style") || "", "padding", 0) * 2, u = c.endsWith("%") ? Math.floor(s * parseFloat(c) / 100) : parseInt(c), p = Math.max(1, u - l);
160
- i.setAttribute("width", String(p));
161
- const a = i.getAttribute("style") || "";
162
- if (!/\bwidth\s*:\s*\d/i.test(a)) {
163
- const d = a && !a.trim().endsWith(";") ? "; " : "";
164
- i.setAttribute("style", `${a}${d}width: ${p}px`);
146
+ const i = A(o), a = f(o.getAttribute("style") || "", "padding", 0) * 2, u = i.endsWith("%") ? Math.floor(s * parseFloat(i) / 100) : parseInt(i), d = Math.max(1, u - a);
147
+ c.setAttribute("width", String(d));
148
+ const l = c.getAttribute("style") || "";
149
+ if (!/\bwidth\s*:\s*\d/i.test(l)) {
150
+ const p = l && !l.trim().endsWith(";") ? "; " : "";
151
+ c.setAttribute("style", `${l}${p}width: ${d}px`);
165
152
  }
166
153
  });
167
154
  }
168
- function B(t, o) {
155
+ function B(t, r) {
169
156
  const e = t.match(/<!DOCTYPE[^>]*>/i);
170
157
  return (e ? `${e[0]}
171
- ` : "") + o.documentElement.outerHTML;
158
+ ` : "") + r.documentElement.outerHTML;
172
159
  }
173
160
  function G(t) {
174
- const o = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(o, "text/html"), n = e.querySelectorAll(".recommendation-block-v2");
161
+ const r = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"), n = e.querySelectorAll(".recommendation-block-v2");
175
162
  if (!n.length)
176
163
  return t;
177
- const { buildCampaignUrl: s } = C(), i = w();
178
- i.recommendationCampaignUrls = {};
179
- const { isFeatureEnabled: r } = q(), c = r("liquidSyntax") ? "reco_" : "";
164
+ const { buildCampaignUrl: s } = q(), c = E();
165
+ c.recommendationCampaignUrls = {};
166
+ const { isFeatureEnabled: o } = _(), i = o("liquidSyntax") ? "reco_" : "";
180
167
  return n.forEach((u) => {
181
- var a, d;
182
- const p = u.getAttribute("recommendation-id");
183
- p && ((a = u.parentNode) == null || a.insertBefore(e.createComment("REC_START"), u), (d = u.parentNode) == null || d.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((y) => y.remove()), s(p), P(u) || O(u, p, c), M(u));
184
- }), B(o, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
168
+ var l, p;
169
+ const d = u.getAttribute("recommendation-id");
170
+ d && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (p = u.parentNode) == null || p.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((h) => h.remove()), s(d), w(u) || O(u, d, i), T(u));
171
+ }), B(r, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
185
172
  }
186
173
  export {
187
- f as formatPriceVariable,
174
+ P as formatPriceVariable,
188
175
  G as prepareRecommendationBlocks
189
176
  };
@@ -1,12 +1,15 @@
1
1
  const e = {
2
2
  transactional: 2
3
- }, o = 2, t = 13, s = {
3
+ }, s = 2, a = 13, t = "https://email-static.useinsider.com", o = `${t}/templates/campaign/default.html`, l = `${t}/templates/campaign/default.css`, E = {
4
4
  SAVED_MODULES: "savedModules",
5
5
  DEFAULT_MODULES: "defaultModules"
6
6
  };
7
7
  export {
8
- o as EditorType,
9
- t as MAX_DEFAULT_TEMPLATE_ID,
10
- s as ModuleFolderDefaults,
8
+ l as BLANK_TEMPLATE_CSS_URL,
9
+ o as BLANK_TEMPLATE_HTML_URL,
10
+ t as EMAIL_STATIC_BASE_URL,
11
+ s as EditorType,
12
+ a as MAX_DEFAULT_TEMPLATE_ID,
13
+ E as ModuleFolderDefaults,
11
14
  e as TemplateTypes
12
15
  };
@@ -53,7 +53,7 @@ class P extends E {
53
53
  if (!m)
54
54
  return;
55
55
  const g = m.getInnerHTML().trim() || "", C = m.getInnerText().trim() || "", _ = this._removeCurrencySymbol(C, o), S = this._buildPriceContent(_, n, l), b = g.replace(C, f(S));
56
- i.modifyHtml(m).setInnerHtml(b);
56
+ i.modifyHtml(m).setInnerHtml(b).setAttribute("data-currency_symbol", n);
57
57
  }), i.apply(new B(
58
58
  `Updated currency symbol to ${n || "removed"}`
59
59
  ));
@@ -1,9 +1,9 @@
1
1
  import { RecommendationBlockId as c } from "../constants/blockIds.js";
2
- import { DESKTOP_CONTAINER_SELECTOR as S, ATTR_PRODUCT_NAME as k, ATTR_PRODUCT_PRICE as E, ATTR_PRODUCT_OLD_PRICE as h, ATTR_PRODUCT_OMNIBUS_PRICE as y, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_BUTTON as P, ATTR_PRODUCT_IMAGE as x, ATTR_PRODUCT_ATTR as v } from "../constants/selectors.js";
2
+ import { DESKTOP_CONTAINER_SELECTOR as S, ATTR_PRODUCT_NAME as E, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as y, ATTR_PRODUCT_OMNIBUS_PRICE as C, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_BUTTON as P, ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_ATTR as x } from "../constants/selectors.js";
3
3
  import { CSS_CLASS_TEXT_TRIM as B } from "../controls/shared/textTrimCssRules.js";
4
- import { toCustomCompositionKey as U } from "../templates/utils.js";
5
- import { extractWrapperTags as C } from "./preserveTextStyles.js";
6
- import { hasQuerySelectorAll as A, hasGetAttribute as l, hasGetStyle as R, hasGetComputedStyle as q } from "./tagName.js";
4
+ import { toCustomCompositionKey as v } from "../templates/utils.js";
5
+ import { extractWrapperTags as R } from "./preserveTextStyles.js";
6
+ import { hasQuerySelectorAll as _, hasGetAttribute as l, hasGetStyle as I, hasGetComputedStyle as U } from "./tagName.js";
7
7
  const s = [
8
8
  "font-size",
9
9
  "font-family",
@@ -39,94 +39,94 @@ const s = [
39
39
  "border-radius",
40
40
  "margin"
41
41
  ], b = /* @__PURE__ */ new Set(["transparent", "rgba(0, 0, 0, 0)"]), G = [
42
- { attrKey: k, blockId: c.NAME, kind: "text" },
43
- { attrKey: E, blockId: c.PRICE, kind: "text" },
44
- { attrKey: h, blockId: c.OLD_PRICE, kind: "text" },
45
- { attrKey: y, blockId: c.OMNIBUS_PRICE, kind: "text" },
46
- { attrKey: m, blockId: c.OMNIBUS_DISCOUNT, kind: "text" },
42
+ { attrKey: E, blockId: c.NAME, kind: "text" },
43
+ { attrKey: p, blockId: c.PRICE, kind: "text" },
44
+ { attrKey: y, blockId: c.OLD_PRICE, kind: "text" },
45
+ { attrKey: C, blockId: c.OMNIBUS_PRICE, kind: "text" },
46
+ { attrKey: A, blockId: c.OMNIBUS_DISCOUNT, kind: "text" },
47
47
  { attrKey: P, blockId: c.BUTTON, kind: "button" },
48
- { attrKey: x, blockId: c.IMAGE, kind: "image" }
48
+ { attrKey: q, blockId: c.IMAGE, kind: "image" }
49
49
  ];
50
- function _(t) {
50
+ function O(t) {
51
51
  return t && "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "";
52
52
  }
53
53
  function L(t) {
54
54
  return t && "getInnerText" in t && typeof t.getInnerText == "function" ? t.getInnerText().trim() : "";
55
55
  }
56
56
  function a(t, e, r) {
57
- !e || !R(e) || r.forEach((n) => {
58
- const i = e.getStyle(n);
59
- i && i !== "inherit" && i !== "initial" && (t[n] = i);
57
+ !e || !I(e) || r.forEach((n) => {
58
+ const o = e.getStyle(n);
59
+ o && o !== "inherit" && o !== "initial" && (t[n] = o);
60
60
  });
61
61
  }
62
- function I(t) {
62
+ function h(t) {
63
63
  return Object.entries(t).map(([e, r]) => `${e}: ${r};`).join(" ");
64
64
  }
65
- function O(t) {
66
- if (!t || !R(t))
65
+ function k(t) {
66
+ if (!t || !I(t))
67
67
  return;
68
68
  const e = t.getStyle("background-color") || t.getStyle("background");
69
69
  return e && !b.has(e) ? e : void 0;
70
70
  }
71
71
  function g(t, e) {
72
72
  const r = {};
73
- return a(r, t, e), I(r);
73
+ return a(r, t, e), h(r);
74
74
  }
75
75
  function w(t) {
76
76
  const e = t.querySelector("p"), r = {};
77
77
  a(r, t, s), a(r, e, s), a(r, t.querySelector("strong"), s), a(r, t.querySelector("em"), s), a(r, t.querySelector("s"), s);
78
- const n = I(r), { openTags: i, closeTags: o } = C(_(e));
79
- return !n && !i ? null : { pStyle: n || void 0, openTags: i, closeTags: o };
78
+ const n = h(r), { openTags: o, closeTags: i } = R(O(e));
79
+ return !n && !o ? null : { pStyle: n || void 0, openTags: o, closeTags: i };
80
80
  }
81
- function K(t) {
82
- const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n = g(e, N), i = g(r, M), o = e && "getAttribute" in e ? e.getAttribute("class") ?? "" : "", u = /\bes-fw\b/.test(o), { openTags: T, closeTags: d } = C(_(r)), p = L(r);
83
- return !n && !i && !u && !T && !p ? null : {
81
+ function $(t) {
82
+ const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n = g(e, N), o = g(r, M), i = e && "getAttribute" in e ? e.getAttribute("class") ?? "" : "", u = /\bes-fw\b/.test(i), { openTags: T, closeTags: d } = R(O(r)), m = L(r);
83
+ return !n && !o && !u && !T && !m ? null : {
84
84
  buttonBorderStyle: n || void 0,
85
- buttonAnchorStyle: i || void 0,
85
+ buttonAnchorStyle: o || void 0,
86
86
  buttonFitToContainer: u || void 0,
87
- buttonText: p || void 0,
87
+ buttonText: m || void 0,
88
88
  openTags: T,
89
89
  closeTags: d
90
90
  };
91
91
  }
92
- function H(t) {
92
+ function K(t) {
93
93
  const e = g(t.querySelector("img"), D);
94
94
  return e ? { imgStyle: e } : null;
95
95
  }
96
- function $(t, e) {
97
- return e === "button" ? K(t) : e === "image" ? H(t) : w(t);
96
+ function H(t, e) {
97
+ return e === "button" ? $(t) : e === "image" ? K(t) : w(t);
98
98
  }
99
99
  function f(t, e) {
100
100
  if (!t || !("querySelector" in t))
101
101
  return;
102
102
  const r = t.querySelector(S) ?? t;
103
- if (G.forEach(({ attrKey: o, blockId: u, kind: T }) => {
103
+ if (G.forEach(({ attrKey: i, blockId: u, kind: T }) => {
104
104
  const d = r.querySelector(`[esd-extension-block-id="${u}"]`);
105
- d && e(d, o, T);
106
- }), !A(r))
105
+ d && e(d, i, T);
106
+ }), !_(r))
107
107
  return;
108
108
  const n = /* @__PURE__ */ new Set();
109
109
  r.querySelectorAll(
110
110
  `[esd-extension-block-id="${c.CUSTOM_ATTRIBUTE}"]`
111
- ).forEach((o) => {
112
- const u = l(o) ? o.getAttribute(v) : null;
113
- !u || n.has(u) || (n.add(u), e(o, U(u), "text"));
111
+ ).forEach((i) => {
112
+ const u = l(i) ? i.getAttribute(x) : null;
113
+ !u || n.has(u) || (n.add(u), e(i, v(u), "text"));
114
114
  });
115
115
  }
116
116
  function F(t) {
117
117
  const e = {};
118
- return f(t, (r, n, i) => {
118
+ return f(t, (r, n, o) => {
119
119
  if (!("querySelector" in r))
120
120
  return;
121
- const o = $(r, i);
122
- o && (e[n] = o);
121
+ const i = H(r, o);
122
+ i && (e[n] = i);
123
123
  }), e;
124
124
  }
125
125
  function j(t) {
126
126
  if (!t || !("querySelector" in t))
127
127
  return;
128
128
  const e = t.querySelector(S) ?? t, r = e.querySelector(".product-card-segment") ?? e.querySelector(".product-card-wrapper");
129
- return O(r);
129
+ return k(r);
130
130
  }
131
131
  function X(t) {
132
132
  if (!t)
@@ -134,28 +134,28 @@ function X(t) {
134
134
  const e = l(t) ? t.getAttribute("bgcolor") : null;
135
135
  if (e && !b.has(e))
136
136
  return e;
137
- const r = O(t);
137
+ const r = k(t);
138
138
  if (r)
139
139
  return r;
140
- const n = q(t) ? t.getComputedStyle("background-color") : void 0;
140
+ const n = U(t) ? t.getComputedStyle("background-color") : void 0;
141
141
  return n && !b.has(n) ? n : void 0;
142
142
  }
143
143
  function z(t) {
144
144
  const e = {};
145
- return f(t, (r, n, i) => {
146
- if (i !== "text")
145
+ return f(t, (r, n, o) => {
146
+ if (o !== "text")
147
147
  return;
148
- const o = X(r);
149
- o && (e[n] = o);
148
+ const i = X(r);
149
+ i && (e[n] = i);
150
150
  }), e;
151
151
  }
152
152
  function Q(t) {
153
153
  const e = {};
154
- return f(t, (r, n, i) => {
155
- if (i === "image")
154
+ return f(t, (r, n, o) => {
155
+ if (o === "image")
156
156
  return;
157
- const o = l(r) ? r.getAttribute("align") : null;
158
- o && (e[n] = o);
157
+ const i = l(r) ? r.getAttribute("align") : null;
158
+ i && (e[n] = i);
159
159
  }), e;
160
160
  }
161
161
  const V = /^es-[pm]\d+[trbl]?$/;
@@ -167,44 +167,50 @@ function W(t) {
167
167
  return r.length ? r.join(" ") : void 0;
168
168
  }
169
169
  function Y(t) {
170
- const e = {};
171
- return f(t, (r, n, i) => {
172
- if (i === "image")
170
+ if (!t || !("querySelector" in t))
171
+ return !1;
172
+ const e = t.querySelector(S) ?? t, r = (n) => !!(n && "querySelector" in n && n.querySelector(".product-price") && n.querySelector(".product-old-price"));
173
+ return r(e.querySelector(`[data-attribute-type="${p}"]`)) || r(e.querySelector(`[data-attribute-type="${y}"]`));
174
+ }
175
+ function J(t) {
176
+ const e = {}, r = Y(t);
177
+ return f(t, (n, o, i) => {
178
+ if (i === "image" || r && (o === p || o === y))
173
179
  return;
174
- const o = W(r);
175
- o && (e[n] = o);
180
+ const u = W(n);
181
+ u && (e[o] = u);
176
182
  }), e;
177
183
  }
178
- function J(t) {
184
+ function Z(t) {
179
185
  const e = {};
180
186
  return f(t, (r, n) => {
181
- if (n !== y && n !== m || !l(r))
187
+ if (n !== C && n !== A || !l(r))
182
188
  return;
183
- const i = r.getAttribute("data-text-before"), o = r.getAttribute("data-text-after");
184
- (i != null || o != null) && (e[n] = { before: i ?? void 0, after: o ?? void 0 });
189
+ const o = r.getAttribute("data-text-before"), i = r.getAttribute("data-text-after");
190
+ (o != null || i != null) && (e[n] = { before: o ?? void 0, after: i ?? void 0 });
185
191
  }), e;
186
192
  }
187
- function Z(t) {
193
+ function tt(t) {
188
194
  const e = {};
189
195
  if (!t || !("querySelector" in t))
190
196
  return e;
191
197
  const r = t.querySelector(S) ?? t;
192
- return A(r) && r.querySelectorAll(".recommendation-attribute-row").forEach((n) => {
198
+ return _(r) && r.querySelectorAll(".recommendation-attribute-row").forEach((n) => {
193
199
  if (!l(n))
194
200
  return;
195
- const i = n.getAttribute("data-attribute-type"), o = n.getAttribute("data-visibility");
196
- i && o != null && (e[i] = o !== "0");
201
+ const o = n.getAttribute("data-attribute-type"), i = n.getAttribute("data-visibility");
202
+ o && i != null && (e[o] = i !== "0");
197
203
  }), e;
198
204
  }
199
- function ut(t) {
205
+ function ct(t) {
200
206
  return {
201
207
  styleTemplates: F(t),
202
208
  cardBackgroundColor: j(t),
203
209
  cellBackgroundColors: z(t),
204
210
  cellAlignments: Q(t),
205
- cellClasses: Y(t),
206
- omnibusTexts: J(t),
207
- visibility: Z(t)
211
+ cellClasses: J(t),
212
+ omnibusTexts: Z(t),
213
+ visibility: tt(t)
208
214
  };
209
215
  }
210
216
  export {
@@ -212,8 +218,8 @@ export {
212
218
  j as captureCardBackgroundColor,
213
219
  Q as captureCellAlignments,
214
220
  z as captureCellBackgroundColors,
215
- Y as captureCellClasses,
216
- J as captureOmnibusTexts,
217
- ut as captureStyles,
218
- Z as captureVisibility
221
+ J as captureCellClasses,
222
+ Z as captureOmnibusTexts,
223
+ ct as captureStyles,
224
+ tt as captureVisibility
219
225
  };