@useinsider/guido 3.30.0-beta.4cfd8a2 → 3.30.0-beta.52efeeb

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,114 +1,222 @@
1
- import { CURRENCY_ATTR as l, CSS_CLASS_SKIP_COMPILE as m } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
2
- const a = "You May Also Like!";
3
- function C(e) {
1
+ import { CURRENCY_ATTR as m, CSS_CLASS_SKIP_COMPILE as _ } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
2
+ const h = "You May Also Like!";
3
+ function v(t) {
4
4
  var n;
5
- const r = e.querySelector(".ext-recommendation-title");
5
+ const r = t.querySelector(".ext-recommendation-title");
6
6
  if (!r)
7
- return a;
8
- const t = (n = r.textContent) == null ? void 0 : n.trim();
9
- return t && t.length > 0 ? t : a;
7
+ return h;
8
+ const o = (n = r.textContent) == null ? void 0 : n.trim();
9
+ return o && o.length > 0 ? o : h;
10
10
  }
11
- function A(e) {
12
- const r = e.querySelector(".ext-recommendation-title");
11
+ function K(t) {
12
+ const r = t.querySelector(".ext-recommendation-title");
13
13
  return r ? !/display\s*:\s*none/i.test(r.getAttribute("style") ?? "") : !1;
14
14
  }
15
- function _(e) {
16
- var t;
17
- const r = e.querySelector(".ext-recommendation-title");
18
- return !!r && !((t = r == null ? void 0 : r.textContent) != null && t.trim());
15
+ function $(t) {
16
+ var o;
17
+ const r = t.querySelector(".ext-recommendation-title");
18
+ return !!r && !((o = r == null ? void 0 : r.textContent) != null && o.trim());
19
19
  }
20
- function E(e) {
21
- const r = e.querySelector(".ext-product-price"), t = e.querySelector(".ext-product-original-price");
22
- return !r || !t ? !1 : r.compareDocumentPosition(t) === Node.DOCUMENT_POSITION_PRECEDING;
20
+ function V(t) {
21
+ const r = t.querySelector(".ext-product-price"), o = t.querySelector(".ext-product-original-price");
22
+ return !r || !o ? !1 : r.compareDocumentPosition(o) === Node.DOCUMENT_POSITION_PRECEDING;
23
23
  }
24
- function d(e) {
25
- return /(?:^|;)\s*display\s*:\s*table-cell/i.test(e.getAttribute("style") ?? "");
24
+ function S(t) {
25
+ return /(?:^|;)\s*display\s*:\s*table-cell/i.test(t.getAttribute("style") ?? "");
26
26
  }
27
- function T(e) {
28
- var n, o;
29
- const r = (n = e.querySelector(".ext-product-price")) == null ? void 0 : n.closest("tr"), t = (o = e.querySelector(".ext-product-original-price")) == null ? void 0 : o.closest("tr");
30
- return !r || !t || r === t ? !1 : !d(r) && !d(t);
27
+ function X(t) {
28
+ var n, e;
29
+ const r = (n = t.querySelector(".ext-product-price")) == null ? void 0 : n.closest("tr"), o = (e = t.querySelector(".ext-product-original-price")) == null ? void 0 : e.closest("tr");
30
+ return !r || !o || r === o ? !1 : !S(r) && !S(o);
31
31
  }
32
- const p = /* @__PURE__ */ new Map([
32
+ const E = /* @__PURE__ */ new Map([
33
33
  ["p_name", ".ext-product-name p"],
34
34
  ["p_price", ".ext-product-price p"],
35
35
  ["p_original_price", ".ext-product-original-price p"]
36
36
  ]);
37
- function f(e) {
38
- const r = ((e == null ? void 0 : e.getAttribute("style")) ?? "").match(/(?:^|;)\s*color\s*:\s*([^;]+)/i);
37
+ function A(t) {
38
+ const r = ((t == null ? void 0 : t.getAttribute("style")) ?? "").match(/(?:^|;)\s*color\s*:\s*([^;]+)/i);
39
39
  return (r == null ? void 0 : r[1].trim()) || void 0;
40
40
  }
41
- const x = "ins-trim-text";
42
- function h(e, r) {
43
- return e == null ? void 0 : e.map((t) => {
44
- var s, u;
45
- const n = p.get(t.variable ?? "");
41
+ const L = "ins-trim-text";
42
+ function j(t, r) {
43
+ return t == null ? void 0 : t.map((o) => {
44
+ var s, d;
45
+ const n = E.get(o.variable ?? "");
46
46
  if (!n)
47
- return t;
48
- const o = r.querySelector(n), c = (u = (s = t.theme) == null ? void 0 : s.textColor) != null && u.color ? void 0 : f(o), i = t.variable === "p_name" && (o == null ? void 0 : o.classList.contains(x));
49
- return !c && !i ? t : {
50
- ...t,
47
+ return o;
48
+ const e = r.querySelector(n), i = (d = (s = o.theme) == null ? void 0 : s.textColor) != null && d.color ? void 0 : A(e), c = o.variable === "p_name" && (e == null ? void 0 : e.classList.contains(L));
49
+ return !i && !c ? o : {
50
+ ...o,
51
51
  theme: {
52
- ...t.theme,
53
- ...c ? { textColor: { color: c } } : {},
54
- ...i ? { textTrimming: !0 } : {}
52
+ ...o.theme,
53
+ ...i ? { textColor: { color: i } } : {},
54
+ ...c ? { textTrimming: !0 } : {}
55
55
  }
56
56
  };
57
57
  });
58
58
  }
59
- function R(e) {
59
+ const R = /^(?:#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\([\d.,\s%]+\)|[a-z]+)$/i, I = new Set(
60
+ ["none", "transparent", "inherit", "initial", "unset", "revert", "currentColor"].map((t) => t.toLowerCase())
61
+ ), O = /^(\d+(?:\.\d+)?)(?:px)?$/i, P = /* @__PURE__ */ new Set([
62
+ "none",
63
+ "hidden",
64
+ "dotted",
65
+ "dashed",
66
+ "solid",
67
+ "double",
68
+ "groove",
69
+ "ridge",
70
+ "inset",
71
+ "outset"
72
+ ]), w = /\s/, B = /\s*!important\s*$/i, N = ["padding-top", "padding-right", "padding-bottom", "padding-left"];
73
+ function x(t) {
74
+ const r = /* @__PURE__ */ new Map();
75
+ return ((t == null ? void 0 : t.getAttribute("style")) ?? "").split(";").forEach((o, n) => {
76
+ const e = o.indexOf(":");
77
+ if (e < 0)
78
+ return;
79
+ const i = o.slice(0, e).trim().toLowerCase(), c = o.slice(e + 1).replace(B, "").trim();
80
+ i && c && r.set(i, { value: c, position: n });
81
+ }), r;
82
+ }
83
+ function u(t, r) {
84
+ var o;
85
+ return (o = t.get(r)) == null ? void 0 : o.value;
86
+ }
87
+ function l(t) {
88
+ return t && R.test(t) && !I.has(t.toLowerCase()) ? t : void 0;
89
+ }
90
+ function f(t) {
91
+ const r = t == null ? void 0 : t.match(O);
92
+ return (r == null ? void 0 : r[1]) !== void 0 ? Number(r[1]) : void 0;
93
+ }
94
+ function b(t) {
95
+ const r = t == null ? void 0 : t.toLowerCase();
96
+ return r && P.has(r) ? r : void 0;
97
+ }
98
+ function T(t) {
99
+ let r = 0;
100
+ return Array.from(t).reduce((n, e) => (e === "(" ? r += 1 : e === ")" && r > 0 && (r -= 1), r === 0 && w.test(e) ? n.push("") : n[n.length - 1] += e, n), [""]).filter(Boolean);
101
+ }
102
+ function y(t, r) {
103
+ const o = T(t ?? "").map(r);
104
+ if (o.length === 0 || o.length > 4 || o.some((s) => s === void 0))
105
+ return;
106
+ const [n, e = n, i = n, c = e] = o;
107
+ return { top: n, right: e, bottom: i, left: c };
108
+ }
109
+ function D(t) {
110
+ const r = u(t, "padding");
111
+ if (r !== void 0)
112
+ return y(r, f);
113
+ const [o, n, e, i] = N.map((c) => f(u(t, c)));
114
+ if (!(o === void 0 || n === void 0 || e === void 0 || i === void 0))
115
+ return { top: o, right: n, bottom: e, left: i };
116
+ }
117
+ function q(t) {
118
+ return t === void 0 ? void 0 : { top: t, right: t, bottom: t, left: t };
119
+ }
120
+ function k(t) {
121
+ return T(t ?? "").reduce((o, n) => {
122
+ const e = f(n), i = b(n), c = l(n);
123
+ if (o) {
124
+ if (e !== void 0 && o.width === void 0)
125
+ return { ...o, width: e };
126
+ if (i && !o.style)
127
+ return { ...o, style: i };
128
+ if (c && !o.color)
129
+ return { ...o, color: c };
130
+ }
131
+ }, {}) ?? {};
132
+ }
133
+ function p(t, r, o, n) {
134
+ var s, d;
135
+ const e = y(u(t, r), o), i = q(n);
136
+ return (((s = t.get(r)) == null ? void 0 : s.position) ?? -1) > (((d = t.get("border")) == null ? void 0 : d.position) ?? -1) ? e ?? i : i ?? e;
137
+ }
138
+ function M(t) {
139
+ const r = k(u(t, "border")), o = p(t, "border-width", f, r.width);
140
+ if (!o)
141
+ return;
142
+ const n = p(t, "border-style", b, r.style), e = p(t, "border-color", l, r.color);
143
+ return {
144
+ width: o,
145
+ ...n ? { style: n } : {},
146
+ ...e ? { color: e } : {}
147
+ };
148
+ }
149
+ function C(t) {
150
+ return l(u(t, "background")) ?? l(u(t, "background-color"));
151
+ }
152
+ function Y(t, r = {}) {
153
+ var a, g;
154
+ const o = x(t.querySelector(".ext-product-button a.es-button")), n = x(t.querySelector(".ext-product-button .es-button-border")), e = {}, i = (a = r.buttonColor) != null && a.color ? void 0 : C(n) ?? C(o), c = (g = r.textButtonColor) != null && g.color ? void 0 : l(u(o, "color")), s = r.buttonBorder === void 0 ? M(n) : void 0, d = r.buttonInternalPadding === void 0 ? D(o) : void 0;
155
+ return i && (e.buttonColor = { color: i }), c && (e.textButtonColor = { color: c }), s && (e.buttonBorder = s), d && (e.buttonInternalPadding = { desktop: d }), e;
156
+ }
157
+ function H(t, r) {
158
+ return t == null ? void 0 : t.map((o) => {
159
+ if (o.variable !== "p_button")
160
+ return o;
161
+ const n = Y(r, o.theme ?? {});
162
+ return Object.keys(n).length === 0 ? o : { ...o, theme: { ...o.theme, ...n } };
163
+ });
164
+ }
165
+ function W(t) {
60
166
  const r = [
61
- e,
62
- ...Array.from(e.querySelectorAll(".product-card, .ext-recommendation-card"))
167
+ t,
168
+ ...Array.from(t.querySelectorAll(".product-card, .ext-recommendation-card"))
63
169
  ];
64
- let t = "";
170
+ let o = "";
65
171
  return r.some((n) => {
66
- const o = n.getAttribute("bgcolor");
67
- if (o && o.trim())
68
- return t = o.trim(), !0;
69
- const i = (n.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
70
- return i && i[1] ? (t = i[1].trim(), !0) : !1;
71
- }), t;
72
- }
73
- function L(e) {
74
- const r = e.getAttribute(l.CURRENCY), t = e.getAttribute(l.SYMBOL);
172
+ const e = n.getAttribute("bgcolor");
173
+ if (e && e.trim())
174
+ return o = e.trim(), !0;
175
+ const c = (n.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
176
+ return c && c[1] ? (o = c[1].trim(), !0) : !1;
177
+ }), o;
178
+ }
179
+ function z(t) {
180
+ const r = t.getAttribute(m.CURRENCY), o = t.getAttribute(m.SYMBOL);
75
181
  return {
76
182
  ...r ? { value: r } : {},
77
183
  // An empty `currency-symbol` is omitted so `mapCurrency` falls back to
78
184
  // the currency code as the symbol.
79
- ...t ? { symbol: t } : {},
185
+ ...o ? { symbol: o } : {},
80
186
  alignment: 1,
81
187
  decimalCount: "2",
82
188
  decimalSeparator: ",",
83
189
  thousandSeparator: "."
84
190
  };
85
191
  }
86
- const S = /^es-p(\d+)([trbl]?)$/, g = { t: "top", r: "right", b: "bottom", l: "left" };
87
- function P(e) {
88
- const r = e.querySelector("td.esd-structure.esd-extension-internal-block");
192
+ const F = /^es-p(\d+)([trbl]?)$/, G = { t: "top", r: "right", b: "bottom", l: "left" };
193
+ function J(t) {
194
+ const r = t.querySelector("td.esd-structure.esd-extension-internal-block");
89
195
  if (!r)
90
196
  return;
91
- const t = { top: 0, right: 0, bottom: 0, left: 0 };
197
+ const o = { top: 0, right: 0, bottom: 0, left: 0 };
92
198
  return r.classList.forEach((n) => {
93
- const o = n.match(S);
94
- if (!o)
199
+ const e = n.match(F);
200
+ if (!e)
95
201
  return;
96
- const c = Number(o[1]), i = o[2];
97
- i ? t[g[i]] = c : Object.assign(t, { top: c, right: c, bottom: c, left: c });
98
- }), t;
202
+ const i = Number(e[1]), c = e[2];
203
+ c ? o[G[c]] = i : Object.assign(o, { top: i, right: i, bottom: i, left: i });
204
+ }), o;
99
205
  }
100
- function I(e) {
101
- return e.classList.contains(m);
206
+ function Q(t) {
207
+ return t.classList.contains(_);
102
208
  }
103
209
  export {
104
- R as extractCardBgColor,
105
- L as extractCurrencyFromBlock,
106
- P as extractRenderedBlockPadding,
107
- C as extractTitleText,
108
- _ as hasEmptyTitle,
109
- A as hasVisibleTitle,
110
- E as isOldPriceFirst,
111
- I as isPartnerManagedBlock,
112
- T as isPriceOnNextLine,
113
- h as withRenderedTextTheme
210
+ W as extractCardBgColor,
211
+ z as extractCurrencyFromBlock,
212
+ J as extractRenderedBlockPadding,
213
+ Y as extractRenderedButtonTheme,
214
+ v as extractTitleText,
215
+ $ as hasEmptyTitle,
216
+ K as hasVisibleTitle,
217
+ V as isOldPriceFirst,
218
+ Q as isPartnerManagedBlock,
219
+ X as isPriceOnNextLine,
220
+ H as withRenderedButtonTheme,
221
+ j as withRenderedTextTheme
114
222
  };
@@ -16,21 +16,21 @@ function P(n) {
16
16
  const t = n.top ?? n.all ?? 0, o = n.right ?? n.all ?? 0, i = n.bottom ?? n.all ?? 0, l = n.left ?? n.all ?? 0;
17
17
  return t === 0 && o === 0 && i === 0 && l === 0 ? null : `${t}px ${o}px ${i}px ${l}px`;
18
18
  }
19
- function z(n) {
19
+ function C(n) {
20
20
  if (!n)
21
21
  return null;
22
22
  const { top: t, right: o, bottom: i, left: l } = n;
23
23
  return t === void 0 ? null : t === o && t === i && t === l ? t : null;
24
24
  }
25
25
  function $(n, t, o, i) {
26
- const l = z(o);
26
+ const l = C(o);
27
27
  if (l !== null) {
28
28
  r(n, `border-${t}`, i(l));
29
29
  return;
30
30
  }
31
31
  o && (r(n, `border-top-${t}`, o.top !== void 0 ? i(o.top) : null), r(n, `border-right-${t}`, o.right !== void 0 ? i(o.right) : null), r(n, `border-bottom-${t}`, o.bottom !== void 0 ? i(o.bottom) : null), r(n, `border-left-${t}`, o.left !== void 0 ? i(o.left) : null));
32
32
  }
33
- function D(n) {
33
+ function I(n) {
34
34
  if (!n)
35
35
  return null;
36
36
  const t = x(n.radius ?? n.borderRadius);
@@ -42,14 +42,14 @@ function D(n) {
42
42
  }
43
43
  return null;
44
44
  }
45
- function I(n) {
45
+ function v(n) {
46
46
  var t, o;
47
47
  return ((t = n.textLineSpacing) == null ? void 0 : t.lineSpacing) ?? ((o = n.textLineSpacing) == null ? void 0 : o["font-lineSpacing"]);
48
48
  }
49
49
  function N(n) {
50
- var u, s, a, d, g, b, p, y;
50
+ var u, s, a, d, g, p, b, y;
51
51
  const t = [], o = [], i = (u = n == null ? void 0 : n.textAlign) == null ? void 0 : u.align, l = P((s = n == null ? void 0 : n.textPadding) == null ? void 0 : s.desktop), f = (a = n == null ? void 0 : n.textStyle) == null ? void 0 : a["font-weight"], c = (d = n == null ? void 0 : n.textStyle) == null ? void 0 : d["font-style"];
52
- return r(t, "background-color", (g = n == null ? void 0 : n.textBackgroundColor) == null ? void 0 : g.color), r(t, "padding", l), r(o, "font-family", (b = n == null ? void 0 : n.textStyle) == null ? void 0 : b["font-family"]), r(o, "font-size", (p = n == null ? void 0 : n.textStyle) == null ? void 0 : p["font-size"]), r(o, "font-weight", f), r(o, "font-style", c), r(o, "color", (y = n == null ? void 0 : n.textColor) == null ? void 0 : y.color), r(o, "line-height", I(n ?? {})), r(o, "text-align", i), {
52
+ return r(t, "background-color", (g = n == null ? void 0 : n.textBackgroundColor) == null ? void 0 : g.color), r(t, "padding", l), r(o, "font-family", (p = n == null ? void 0 : n.textStyle) == null ? void 0 : p["font-family"]), r(o, "font-size", (b = n == null ? void 0 : n.textStyle) == null ? void 0 : b["font-size"]), r(o, "font-weight", f), r(o, "font-style", c), r(o, "color", (y = n == null ? void 0 : n.textColor) == null ? void 0 : y.color), r(o, "line-height", v(n ?? {})), r(o, "text-align", i), {
53
53
  tdStyle: t.join("; "),
54
54
  pStyle: o.join("; "),
55
55
  align: i || void 0,
@@ -59,47 +59,59 @@ function N(n) {
59
59
  };
60
60
  }
61
61
  function E(n) {
62
- var s, a, d, g, b, p, y, k, w, B, T, j;
62
+ var s, a, d, g, p, b, y, k, w, B, j, T;
63
63
  const t = [], o = [], i = [];
64
- r(t, "padding", P((s = n == null ? void 0 : n.buttonExternalPadding) == null ? void 0 : s.desktop)), r(i, "padding", P((a = n == null ? void 0 : n.buttonInternalPadding) == null ? void 0 : a.desktop)), r(i, "font-family", (d = n == null ? void 0 : n.buttonStyle) == null ? void 0 : d["font-family"]), r(i, "font-size", (g = n == null ? void 0 : n.buttonStyle) == null ? void 0 : g["font-size"]), r(i, "font-weight", (b = n == null ? void 0 : n.buttonStyle) == null ? void 0 : b["font-weight"]), r(i, "font-style", (p = n == null ? void 0 : n.buttonStyle) == null ? void 0 : p["font-style"]);
64
+ r(t, "padding", P((s = n == null ? void 0 : n.buttonExternalPadding) == null ? void 0 : s.desktop)), r(i, "padding", P((a = n == null ? void 0 : n.buttonInternalPadding) == null ? void 0 : a.desktop)), r(i, "font-family", (d = n == null ? void 0 : n.buttonStyle) == null ? void 0 : d["font-family"]), r(i, "font-size", (g = n == null ? void 0 : n.buttonStyle) == null ? void 0 : g["font-size"]), r(i, "font-weight", (p = n == null ? void 0 : n.buttonStyle) == null ? void 0 : p["font-weight"]), r(i, "font-style", (b = n == null ? void 0 : n.buttonStyle) == null ? void 0 : b["font-style"]);
65
65
  const l = (y = n == null ? void 0 : n.buttonColor) == null ? void 0 : y.color, f = (k = n == null ? void 0 : n.textButtonColor) == null ? void 0 : k.color;
66
- r(o, "background", l), r(i, "background", l), r(i, "color", f);
66
+ r(o, "background", l), r(i, "background", l), r(i, "color", f), r(i, "mso-border-alt", l ? `10px solid ${l}` : void 0);
67
67
  const c = n == null ? void 0 : n.buttonBorder;
68
68
  $(o, "width", c == null ? void 0 : c.width, (S) => `${S}px`), $(o, "style", c == null ? void 0 : c.style, (S) => S), $(o, "color", c == null ? void 0 : c.color, (S) => S);
69
- const u = D((n == null ? void 0 : n.buttonBorderRadius) ?? (n == null ? void 0 : n.borderRadius));
69
+ const u = I((n == null ? void 0 : n.buttonBorderRadius) ?? (n == null ? void 0 : n.borderRadius));
70
70
  return u && (r(o, "border-radius", u), r(i, "border-radius", u)), ((w = n == null ? void 0 : n.buttonStretch) == null ? void 0 : w.stretched) === !1 ? (r(o, "display", "inline-block"), r(i, "display", "inline-block")) : ((B = n == null ? void 0 : n.buttonStretch) == null ? void 0 : B.stretched) === !0 && (r(o, "display", "block"), r(i, "display", "block")), {
71
71
  tdStyle: t.join("; "),
72
- align: ((T = n == null ? void 0 : n.buttonAlign) == null ? void 0 : T.align) || void 0,
72
+ align: ((j = n == null ? void 0 : n.buttonAlign) == null ? void 0 : j.align) || void 0,
73
73
  spanStyle: o.join("; "),
74
74
  aStyle: i.join("; "),
75
- text: (j = n == null ? void 0 : n.buttonText) == null ? void 0 : j.text
75
+ text: (T = n == null ? void 0 : n.buttonText) == null ? void 0 : T.text
76
76
  };
77
77
  }
78
- function L(n) {
78
+ function R(n) {
79
79
  var t, o;
80
80
  return {
81
81
  width: x((t = n == null ? void 0 : n.imageSize) == null ? void 0 : t.width),
82
82
  height: x((o = n == null ? void 0 : n.imageSize) == null ? void 0 : o.height)
83
83
  };
84
84
  }
85
- const A = /* @__PURE__ */ new Set([5, 10, 15, 20, 25, 30, 35, 40]), C = [["t", "top"], ["r", "right"], ["b", "bottom"], ["l", "left"]];
86
- function R(n) {
85
+ const A = /* @__PURE__ */ new Set([5, 10, 15, 20, 25, 30, 35, 40]), L = [["t", "top"], ["r", "right"], ["b", "bottom"], ["l", "left"]];
86
+ function _(n) {
87
87
  if (!n)
88
88
  return;
89
89
  const t = [], o = [];
90
- return C.forEach(([i, l]) => {
90
+ return L.forEach(([i, l]) => {
91
91
  const f = x(n[l] ?? n.all) ?? 0;
92
92
  A.has(f) ? t.push(`es-p${f}${i}`) : f > 0 && o.push(`padding-${l}: ${f}px`);
93
93
  }), { classes: t.join(" "), style: o.join("; ") };
94
94
  }
95
- function v(n, t) {
95
+ function z(n) {
96
+ return n.split(";").map((t) => t.trim()).filter(Boolean);
97
+ }
98
+ function D(n) {
99
+ const t = n.indexOf(":");
100
+ return (t === -1 ? n : n.slice(0, t)).trim().toLowerCase();
101
+ }
102
+ function F(n, t) {
96
103
  const o = (n ?? "").trim().replace(/;$/, "").trim(), i = (t ?? "").trim().replace(/;$/, "").trim();
97
- return o ? i ? `${o}; ${i}` : o : i;
104
+ if (!o)
105
+ return i;
106
+ if (!i)
107
+ return o;
108
+ const l = new Set(z(i).map(D)), f = z(o), c = f.filter((u) => !l.has(D(u)));
109
+ return c.length === f.length ? `${o}; ${i}` : c.length ? `${c.join("; ")}; ${i}` : i;
98
110
  }
99
111
  export {
100
- v as appendStyle,
101
- R as mapBlockPadding,
112
+ F as appendStyle,
113
+ _ as mapBlockPadding,
102
114
  E as mapButtonTheme,
103
- L as mapImageTheme,
115
+ R as mapImageTheme,
104
116
  N as mapTextTheme
105
117
  };
@@ -1,59 +1,64 @@
1
- import { BlockId as b } from "../../enums/block.js";
2
- import { DEFAULT_NODE_CONFIG as C } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
3
- import { ATTR_RECOMMENDATION_TITLE as f } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
4
- import { useTemplateStore as M } from "../../stores/template.js";
5
- import { mapComposition as x } from "./recommendation/compositionMapper.js";
6
- import { isPriceOnNextLine as R, extractCurrencyFromBlock as h, isOldPriceFirst as S, withRenderedTextTheme as w, extractTitleText as E, hasEmptyTitle as L, hasVisibleTitle as B, extractCardBgColor as P, isPartnerManagedBlock as A, extractRenderedBlockPadding as H } from "./recommendation/extractors.js";
7
- import { buildBlockHtml as N } from "./recommendation/htmlBuilder.js";
8
- import { parseRecommendationId as O, parseLegacyConfig as F } from "./recommendation/parseLegacyConfig.js";
9
- import { mapSettings as I } from "./recommendation/settingsMapper.js";
10
- import { mapBlockPadding as _ } from "./recommendation/themeMapper.js";
11
- const k = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
12
- function $(c, e, m) {
13
- var l, g, p;
14
- const t = O(e);
1
+ import { BlockId as C } from "../../enums/block.js";
2
+ import { DEFAULT_NODE_CONFIG as b } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
3
+ import { ATTR_PRODUCT_BUTTON as f, ATTR_RECOMMENDATION_TITLE as T } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
4
+ import { useTemplateStore as x } from "../../stores/template.js";
5
+ import { mapComposition as M } from "./recommendation/compositionMapper.js";
6
+ import { isPriceOnNextLine as B, extractCurrencyFromBlock as S, isOldPriceFirst as E, withRenderedButtonTheme as w, withRenderedTextTheme as L, extractRenderedButtonTheme as O, extractTitleText as P, hasEmptyTitle as A, hasVisibleTitle as H, extractCardBgColor as N, isPartnerManagedBlock as F, extractRenderedBlockPadding as I } from "./recommendation/extractors.js";
7
+ import { buildBlockHtml as _ } from "./recommendation/htmlBuilder.js";
8
+ import { parseRecommendationId as D, parseLegacyConfig as $ } from "./recommendation/parseLegacyConfig.js";
9
+ import { mapSettings as k } from "./recommendation/settingsMapper.js";
10
+ import { mapButtonTheme as U, mapBlockPadding as V } from "./recommendation/themeMapper.js";
11
+ const q = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
12
+ function G(c, e, m) {
13
+ var l, p, g;
14
+ const t = D(e);
15
15
  if (t === null)
16
16
  return console.warn(
17
17
  "[RecommendationMigrator] Skipping block — missing/invalid `ins-recommendation-v3-campaign-id`"
18
18
  ), !1;
19
- const r = F(e);
20
- if (!r)
19
+ const o = $(e);
20
+ if (!o)
21
21
  return console.warn(
22
22
  `[RecommendationMigrator] Aborting block id=${t} — \`esd-dev-product-config\` missing or unable to be parsed`
23
23
  ), !1;
24
- const o = m[String(t)] ?? {}, n = {
25
- ...o,
26
- currencySettings: o.currencySettings ?? h(e),
27
- isPriceMovedToNextLine: o.isPriceMovedToNextLine ?? R(e)
28
- }, a = I(n, r, t), i = x(
29
- w((l = r.composition) == null ? void 0 : l.variables, e),
30
- { oldPriceFirst: S(e) }
31
- ), u = E(e);
32
- L(e) ? i.visibility[f] = !1 : i.titleVariable || (i.visibility[f] = B(e));
33
- const y = P(e), T = {
24
+ const i = m[String(t)] ?? {}, n = {
25
+ ...i,
26
+ currencySettings: i.currencySettings ?? S(e),
27
+ isPriceMovedToNextLine: i.isPriceMovedToNextLine ?? B(e)
28
+ }, a = k(n, o, t), r = M(
29
+ w(L((l = o.composition) == null ? void 0 : l.variables, e), e),
30
+ { oldPriceFirst: E(e) }
31
+ );
32
+ if (r.perElementStyles[f] === void 0) {
33
+ const u = O(e);
34
+ Object.keys(u).length > 0 && (r.perElementStyles[f] = U(u));
35
+ }
36
+ const y = P(e);
37
+ A(e) ? r.visibility[T] = !1 : r.titleVariable || (r.visibility[T] = H(e));
38
+ const v = N(e), h = {
34
39
  ...a,
35
40
  strategyId: "",
36
- composition: i.composition,
37
- visibility: i.visibility,
38
- previousTitleHtml: C.previousTitleHtml,
39
- textTrimming: i.anyTextTrimming
40
- }, s = A(e), v = `
41
+ composition: r.composition,
42
+ visibility: r.visibility,
43
+ previousTitleHtml: b.previousTitleHtml,
44
+ textTrimming: r.anyTextTrimming
45
+ }, s = F(e), R = `
41
46
  <table>
42
47
  <tbody>
43
48
  <tr>
44
49
  <td class="esd-structure" align="left">
45
50
  <table width="100%" cellpadding="0" cellspacing="0">
46
51
  <tbody>
47
- <tr>${N({
48
- nodeConfig: T,
49
- composition: i,
50
- cardBg: y,
51
- titleText: u,
52
+ <tr>${_({
53
+ nodeConfig: h,
54
+ composition: r,
55
+ cardBg: v,
56
+ titleText: y,
52
57
  legacyId: e.getAttribute("id") ?? void 0,
53
58
  legacyBgColor: e.getAttribute("bgcolor") ?? void 0,
54
59
  preserveInnerHtml: s ? e.innerHTML : void 0,
55
60
  skipCompile: s,
56
- blockPadding: _(((p = (g = r.theme) == null ? void 0 : g.blockPadding) == null ? void 0 : p.desktop) ?? H(e))
61
+ blockPadding: V(((g = (p = o.theme) == null ? void 0 : p.blockPadding) == null ? void 0 : g.desktop) ?? I(e))
57
62
  })}</tr>
58
63
  </tbody>
59
64
  </table>
@@ -61,12 +66,12 @@ function $(c, e, m) {
61
66
  </tr>
62
67
  </tbody>
63
68
  </table>
64
- `, d = c.parseFromString(v, "text/html").querySelector("td.esd-structure");
69
+ `, d = c.parseFromString(R, "text/html").querySelector("td.esd-structure");
65
70
  return !d || !e.parentNode ? (console.warn(
66
71
  `[RecommendationMigrator] Aborting block id=${t} — failed to construct new HTML element`
67
72
  ), !1) : (e.parentNode.replaceChild(d, e), !0);
68
73
  }
69
- function X(c, e = {}) {
74
+ function oe(c, e = {}) {
70
75
  const m = new DOMParser();
71
76
  let t;
72
77
  try {
@@ -74,27 +79,27 @@ function X(c, e = {}) {
74
79
  } catch (n) {
75
80
  return console.error("[RecommendationMigrator] Failed to parse template:", n), c;
76
81
  }
77
- const r = Array.from(t.querySelectorAll(k));
82
+ const o = Array.from(t.querySelectorAll(q));
78
83
  try {
79
- M().$patch((a) => {
84
+ x().$patch((a) => {
80
85
  a.migrations = {
81
86
  ...a.migrations,
82
- [b.Recommendation]: r.length
87
+ [C.Recommendation]: o.length
83
88
  };
84
89
  });
85
90
  } catch {
86
91
  }
87
- if (r.length === 0)
92
+ if (o.length === 0)
88
93
  return c;
89
- let o = 0;
90
- return r.forEach((n) => {
94
+ let i = 0;
95
+ return o.forEach((n) => {
91
96
  try {
92
- $(m, n, e) && (o += 1);
97
+ G(m, n, e) && (i += 1);
93
98
  } catch (a) {
94
99
  console.error("[RecommendationMigrator] Unexpected error migrating block:", a);
95
100
  }
96
- }), o > 0 && console.info(`[RecommendationMigrator] Migrated ${o} legacy Recommendation block(s)`), t.documentElement.outerHTML;
101
+ }), i > 0 && console.info(`[RecommendationMigrator] Migrated ${i} legacy Recommendation block(s)`), t.documentElement.outerHTML;
97
102
  }
98
103
  export {
99
- X as migrateRecommendation
104
+ oe as migrateRecommendation
100
105
  };
@@ -1,9 +1,9 @@
1
- const o = "3.30.0-beta.4cfd8a2", s = { stripo: { version: "2.87.0" } }, t = {
2
- version: o,
3
- guido: s
1
+ const e = "3.30.0-beta.52efeeb", o = { stripo: { version: "2.87.0" } }, s = {
2
+ version: e,
3
+ guido: o
4
4
  };
5
5
  export {
6
- t as default,
7
- s as guido,
8
- o as version
6
+ s as default,
7
+ o as guido,
8
+ e as version
9
9
  };
@@ -1,4 +1,4 @@
1
- import type { LegacyPaddingViewport, LegacyVariable } from './types';
1
+ import type { LegacyButtonTheme, LegacyPaddingViewport, LegacyVariable } from './types';
2
2
  export declare function extractTitleText(block: Element): string;
3
3
  /**
4
4
  * Fallback for legacy configs that carry no `p_recommendation_title` variable:
@@ -33,6 +33,20 @@ export declare function isPriceOnNextLine(block: Element): boolean;
33
33
  * @returns The variables, with `textColor` / `textTrimming` filled from the rendered HTML where the theme lacks them
34
34
  */
35
35
  export declare function withRenderedTextTheme(variables: LegacyVariable[] | undefined, block: Element): LegacyVariable[] | undefined;
36
+ /**
37
+ * Reads the first legacy product button's inline colors, border and internal padding.
38
+ * @param block - The legacy recommendation block element
39
+ * @param theme - The legacy button theme; keys it already holds are not read
40
+ * @returns Only the keys filled from the rendered button, or an empty object
41
+ */
42
+ export declare function extractRenderedButtonTheme(block: Element, theme?: LegacyButtonTheme): LegacyButtonTheme;
43
+ /**
44
+ * Legacy keeps the product button's colors, border and internal padding inline on the rendered button.
45
+ * @param variables - The legacy composition variables
46
+ * @param block - The legacy recommendation block element
47
+ * @returns The variables, with the `p_button` theme filled from the rendered button where the theme lacks a value
48
+ */
49
+ export declare function withRenderedButtonTheme(variables: LegacyVariable[] | undefined, block: Element): LegacyVariable[] | undefined;
36
50
  /**
37
51
  * Card background lives on either the block (`bgcolor`/`style`) or per-card
38
52
  * cells (`.product-card`). Returns empty string when no background is set —
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.30.0-beta.4cfd8a2",
3
+ "version": "3.30.0-beta.52efeeb",
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",