@useinsider/guido 3.20.0 → 3.20.1

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.
Files changed (31) hide show
  1. package/dist/config/compiler/itemsCompilerRules.js +21 -5
  2. package/dist/config/compiler/utils/itemsCompilerUtils.js +64 -17
  3. package/dist/config/migrator/itemsBlockMigrator.js +112 -108
  4. package/dist/extensions/Blocks/Items/block.js +78 -67
  5. package/dist/extensions/Blocks/Items/constants/cardWidth.js +20 -0
  6. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +1 -1
  7. package/dist/extensions/Blocks/Recommendation/block.js +51 -44
  8. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +103 -91
  9. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +90 -73
  10. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +209 -203
  11. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +122 -90
  12. package/dist/extensions/Blocks/Recommendation/utils/blockUrlConfig.js +25 -0
  13. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +72 -70
  14. package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +69 -60
  15. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +46 -25
  16. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +40 -17
  17. package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +10 -0
  18. package/dist/src/extensions/Blocks/Items/block.d.ts +5 -0
  19. package/dist/src/extensions/Blocks/Items/constants/cardWidth.d.ts +12 -0
  20. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +2 -0
  21. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -0
  22. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
  23. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +18 -5
  24. package/dist/src/extensions/Blocks/Recommendation/utils/blockUrlConfig.d.ts +4 -0
  25. package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +4 -0
  26. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +3 -1
  27. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +7 -0
  28. package/dist/src/utils/liquidProtection.d.ts +3 -0
  29. package/dist/utils/liquidProtection.js +5 -0
  30. package/dist/utils/templatePreparation.js +61 -85
  31. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- import { extractWrapperTags as C } from "../../../../utils/preserveTextStyles.js";
1
+ import { extractWrapperTags as A } from "../../../../utils/preserveTextStyles.js";
2
2
  import { RecommendationBlockId as c } from "../constants/blockIds.js";
3
- 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 A, ATTR_PRODUCT_OMNIBUS_DISCOUNT as R, ATTR_PRODUCT_BUTTON as P, ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_ATTR as x } from "../constants/selectors.js";
4
- import { CSS_CLASS_TEXT_TRIM as v } from "../controls/shared/textTrimCssRules.js";
5
- import { toCustomCompositionKey as B } from "../templates/utils.js";
6
- import { resolveRowCompositionKey as U } from "./compositionKeys.js";
7
- import { hasQuerySelectorAll as _, hasGetAttribute as l, hasGetStyle as I, hasGetComputedStyle as N } from "./tagName.js";
3
+ import { DESKTOP_CONTAINER_SELECTOR as b, ATTR_PRODUCT_NAME as k, ATTR_PRODUCT_PRICE as y, ATTR_PRODUCT_OLD_PRICE as p, ATTR_PRODUCT_OMNIBUS_PRICE as R, ATTR_PRODUCT_OMNIBUS_DISCOUNT as _, ATTR_PRODUCT_BUTTON as x, ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_ATTR as v } from "../constants/selectors.js";
4
+ import { CSS_CLASS_TEXT_TRIM as B } from "../controls/shared/textTrimCssRules.js";
5
+ import { toCustomCompositionKey as U } from "../templates/utils.js";
6
+ import { resolveRowVisibilityKeys as N, isMergedInlinePriceRow as C } from "./compositionKeys.js";
7
+ import { hasQuerySelectorAll as I, hasGetAttribute as l, hasGetStyle as O, hasGetComputedStyle as M } from "./tagName.js";
8
8
  const s = [
9
9
  "font-size",
10
10
  "font-family",
@@ -14,14 +14,14 @@ const s = [
14
14
  "text-align",
15
15
  "line-height",
16
16
  "text-decoration"
17
- ], M = [
17
+ ], D = [
18
18
  "background",
19
19
  "background-color",
20
20
  "border-width",
21
21
  "border-color",
22
22
  "border-style",
23
23
  "border-radius"
24
- ], D = [
24
+ ], w = [
25
25
  ...s,
26
26
  "background",
27
27
  "background-color",
@@ -40,47 +40,47 @@ const s = [
40
40
  "border-radius",
41
41
  "margin"
42
42
  ], g = /* @__PURE__ */ new Set(["transparent", "rgba(0, 0, 0, 0)"]), L = [
43
- { attrKey: E, blockId: c.NAME, kind: "text" },
44
- { attrKey: p, blockId: c.PRICE, kind: "text" },
45
- { attrKey: y, blockId: c.OLD_PRICE, kind: "text" },
46
- { attrKey: A, blockId: c.OMNIBUS_PRICE, kind: "text" },
47
- { attrKey: R, blockId: c.OMNIBUS_DISCOUNT, kind: "text" },
48
- { attrKey: P, blockId: c.BUTTON, kind: "button" },
43
+ { attrKey: k, blockId: c.NAME, kind: "text" },
44
+ { attrKey: y, blockId: c.PRICE, kind: "text" },
45
+ { attrKey: p, blockId: c.OLD_PRICE, kind: "text" },
46
+ { attrKey: R, blockId: c.OMNIBUS_PRICE, kind: "text" },
47
+ { attrKey: _, blockId: c.OMNIBUS_DISCOUNT, kind: "text" },
48
+ { attrKey: x, blockId: c.BUTTON, kind: "button" },
49
49
  { attrKey: q, blockId: c.IMAGE, kind: "image" }
50
50
  ];
51
- function O(t) {
51
+ function h(t) {
52
52
  return t && "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "";
53
53
  }
54
- function w(t) {
54
+ function K(t) {
55
55
  return t && "getInnerText" in t && typeof t.getInnerText == "function" ? t.getInnerText().trim() : "";
56
56
  }
57
57
  function a(t, e, r) {
58
- !e || !I(e) || r.forEach((n) => {
58
+ !e || !O(e) || r.forEach((n) => {
59
59
  const o = e.getStyle(n);
60
60
  o && o !== "inherit" && o !== "initial" && (t[n] = o);
61
61
  });
62
62
  }
63
- function h(t) {
63
+ function E(t) {
64
64
  return Object.entries(t).map(([e, r]) => `${e}: ${r};`).join(" ");
65
65
  }
66
- function k(t) {
67
- if (!t || !I(t))
66
+ function P(t) {
67
+ if (!t || !O(t))
68
68
  return;
69
69
  const e = t.getStyle("background-color") || t.getStyle("background");
70
70
  return e && !g.has(e) ? e : void 0;
71
71
  }
72
- function b(t, e) {
72
+ function S(t, e) {
73
73
  const r = {};
74
- return a(r, t, e), h(r);
74
+ return a(r, t, e), E(r);
75
75
  }
76
- function K(t) {
76
+ function $(t) {
77
77
  const e = t.querySelector("p"), r = {};
78
78
  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);
79
- const n = h(r), { openTags: o, closeTags: i } = C(O(e));
79
+ const n = E(r), { openTags: o, closeTags: i } = A(h(e));
80
80
  return !n && !o ? null : { pStyle: n || void 0, openTags: o, closeTags: i };
81
81
  }
82
- function $(t) {
83
- const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n = b(e, M), o = b(r, D), i = e && "getAttribute" in e ? e.getAttribute("class") ?? "" : "", u = /\bes-fw\b/.test(i), { openTags: T, closeTags: d } = C(O(r)), m = w(r);
82
+ function H(t) {
83
+ const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n = S(e, D), o = S(r, w), i = e && "getAttribute" in e ? e.getAttribute("class") ?? "" : "", u = /\bes-fw\b/.test(i), { openTags: T, closeTags: d } = A(h(r)), m = K(r);
84
84
  return !n && !o && !u && !T && !m ? null : {
85
85
  buttonBorderStyle: n || void 0,
86
86
  buttonAnchorStyle: o || void 0,
@@ -90,44 +90,44 @@ function $(t) {
90
90
  closeTags: d
91
91
  };
92
92
  }
93
- function H(t) {
94
- const e = b(t.querySelector("img"), G);
93
+ function F(t) {
94
+ const e = S(t.querySelector("img"), G);
95
95
  return e ? { imgStyle: e } : null;
96
96
  }
97
- function F(t, e) {
98
- return e === "button" ? $(t) : e === "image" ? H(t) : K(t);
97
+ function j(t, e) {
98
+ return e === "button" ? H(t) : e === "image" ? F(t) : $(t);
99
99
  }
100
100
  function f(t, e) {
101
101
  if (!t || !("querySelector" in t))
102
102
  return;
103
- const r = t.querySelector(S) ?? t;
103
+ const r = t.querySelector(b) ?? t;
104
104
  if (L.forEach(({ attrKey: i, blockId: u, kind: T }) => {
105
105
  const d = r.querySelector(`[esd-extension-block-id="${u}"]`);
106
106
  d && e(d, i, T);
107
- }), !_(r))
107
+ }), !I(r))
108
108
  return;
109
109
  const n = /* @__PURE__ */ new Set();
110
110
  r.querySelectorAll(
111
111
  `[esd-extension-block-id="${c.CUSTOM_ATTRIBUTE}"]`
112
112
  ).forEach((i) => {
113
- const u = l(i) ? i.getAttribute(x) : null;
114
- !u || n.has(u) || (n.add(u), e(i, B(u), "text"));
113
+ const u = l(i) ? i.getAttribute(v) : null;
114
+ !u || n.has(u) || (n.add(u), e(i, U(u), "text"));
115
115
  });
116
116
  }
117
- function j(t) {
117
+ function V(t) {
118
118
  const e = {};
119
119
  return f(t, (r, n, o) => {
120
120
  if (!("querySelector" in r))
121
121
  return;
122
- const i = F(r, o);
122
+ const i = j(r, o);
123
123
  i && (e[n] = i);
124
124
  }), e;
125
125
  }
126
126
  function X(t) {
127
127
  if (!t || !("querySelector" in t))
128
128
  return;
129
- const e = t.querySelector(S) ?? t, r = e.querySelector(".product-card-segment") ?? e.querySelector(".product-card-wrapper");
130
- return k(r);
129
+ const e = t.querySelector(b) ?? t, r = e.querySelector(".product-card-segment") ?? e.querySelector(".product-card-wrapper");
130
+ return P(r);
131
131
  }
132
132
  function z(t) {
133
133
  if (!t)
@@ -135,10 +135,10 @@ function z(t) {
135
135
  const e = l(t) ? t.getAttribute("bgcolor") : null;
136
136
  if (e && !g.has(e))
137
137
  return e;
138
- const r = k(t);
138
+ const r = P(t);
139
139
  if (r)
140
140
  return r;
141
- const n = N(t) ? t.getComputedStyle("background-color") : void 0;
141
+ const n = M(t) ? t.getComputedStyle("background-color") : void 0;
142
142
  return n && !g.has(n) ? n : void 0;
143
143
  }
144
144
  function Q(t) {
@@ -150,7 +150,7 @@ function Q(t) {
150
150
  i && (e[n] = i);
151
151
  }), e;
152
152
  }
153
- function V(t) {
153
+ function W(t) {
154
154
  const e = {};
155
155
  return f(t, (r, n, o) => {
156
156
  if (o === "image")
@@ -159,68 +159,70 @@ function V(t) {
159
159
  i && (e[n] = i);
160
160
  }), e;
161
161
  }
162
- const W = /^es-[pm]\d+[trbl]?$/;
163
- function Y(t) {
162
+ const Y = /^es-[pm]\d+[trbl]?$/;
163
+ function J(t) {
164
164
  const e = l(t) ? t.getAttribute("class") : null;
165
165
  if (!e)
166
166
  return;
167
- const r = e.split(/\s+/).filter((n) => W.test(n) || n === v);
167
+ const r = e.split(/\s+/).filter((n) => Y.test(n) || n === B);
168
168
  return r.length ? r.join(" ") : void 0;
169
169
  }
170
- function J(t) {
170
+ function Z(t) {
171
171
  if (!t || !("querySelector" in t))
172
172
  return !1;
173
- const e = t.querySelector(S) ?? t, r = (n) => !!(n && "querySelector" in n && n.querySelector(".product-price") && n.querySelector(".product-old-price"));
174
- return r(e.querySelector(`[data-attribute-type="${p}"]`)) || r(e.querySelector(`[data-attribute-type="${y}"]`));
173
+ const e = t.querySelector(b) ?? t;
174
+ return C(e.querySelector(`[data-attribute-type="${y}"]`)) || C(e.querySelector(`[data-attribute-type="${p}"]`));
175
175
  }
176
- function Z(t) {
177
- const e = {}, r = J(t);
176
+ function tt(t) {
177
+ const e = {}, r = Z(t);
178
178
  return f(t, (n, o, i) => {
179
- if (i === "image" || r && (o === p || o === y))
179
+ if (i === "image" || r && (o === y || o === p))
180
180
  return;
181
- const u = Y(n);
181
+ const u = J(n);
182
182
  u && (e[o] = u);
183
183
  }), e;
184
184
  }
185
- function tt(t) {
185
+ function et(t) {
186
186
  const e = {};
187
187
  return f(t, (r, n) => {
188
- if (n !== A && n !== R || !l(r))
188
+ if (n !== R && n !== _ || !l(r))
189
189
  return;
190
190
  const o = r.getAttribute("data-text-before"), i = r.getAttribute("data-text-after");
191
191
  (o != null || i != null) && (e[n] = { before: o ?? void 0, after: i ?? void 0 });
192
192
  }), e;
193
193
  }
194
- function et(t) {
194
+ function rt(t) {
195
195
  const e = {};
196
196
  if (!t || !("querySelector" in t))
197
197
  return e;
198
- const r = t.querySelector(S) ?? t;
199
- return _(r) && r.querySelectorAll(".recommendation-attribute-row").forEach((n) => {
198
+ const r = t.querySelector(b) ?? t;
199
+ return I(r) && r.querySelectorAll(".recommendation-attribute-row").forEach((n) => {
200
200
  if (!l(n))
201
201
  return;
202
- const o = U(n), i = n.getAttribute("data-visibility");
203
- o && i != null && (e[o] = i !== "0");
202
+ const o = n.getAttribute("data-visibility");
203
+ o != null && N(n).forEach((i) => {
204
+ e[i] = o !== "0";
205
+ });
204
206
  }), e;
205
207
  }
206
- function at(t) {
208
+ function lt(t) {
207
209
  return {
208
- styleTemplates: j(t),
210
+ styleTemplates: V(t),
209
211
  cardBackgroundColor: X(t),
210
212
  cellBackgroundColors: Q(t),
211
- cellAlignments: V(t),
212
- cellClasses: Z(t),
213
- omnibusTexts: tt(t),
214
- visibility: et(t)
213
+ cellAlignments: W(t),
214
+ cellClasses: tt(t),
215
+ omnibusTexts: et(t),
216
+ visibility: rt(t)
215
217
  };
216
218
  }
217
219
  export {
218
- j as captureAttributeStyleTemplates,
220
+ V as captureAttributeStyleTemplates,
219
221
  X as captureCardBackgroundColor,
220
- V as captureCellAlignments,
222
+ W as captureCellAlignments,
221
223
  Q as captureCellBackgroundColors,
222
- Z as captureCellClasses,
223
- tt as captureOmnibusTexts,
224
- at as captureStyles,
225
- et as captureVisibility
224
+ tt as captureCellClasses,
225
+ et as captureOmnibusTexts,
226
+ lt as captureStyles,
227
+ rt as captureVisibility
226
228
  };
@@ -1,89 +1,98 @@
1
- import { ATTR_CUSTOM_PREFIX as s, ATTR_PRODUCT_ATTR as i, PRODUCT_ATTRIBUTE_PREFIX as f, ATTR_DATA_ATTRIBUTE_TYPE as l, SELECTOR_ATTRIBUTE_ROW as R } from "../constants/selectors.js";
2
- function d(t) {
3
- return !t.startsWith(f);
1
+ import { ATTR_CUSTOM_PREFIX as o, ATTR_PRODUCT_PRICE as g, ATTR_PRODUCT_OLD_PRICE as d, PRODUCT_ATTRIBUTE_PREFIX as a, ATTR_DATA_ATTRIBUTE_TYPE as f, ATTR_PRODUCT_ATTR as c, SELECTOR_ATTRIBUTE_ROW as y } from "../constants/selectors.js";
2
+ function q(t) {
3
+ return !t.startsWith(a);
4
4
  }
5
- function y(t) {
6
- return t.startsWith(f) ? t.substring(f.length) : t;
7
- }
8
- function T(t) {
9
- return t.startsWith(s) ? t.substring(s.length) : t;
5
+ function $(t) {
6
+ return t.startsWith(a) ? t.substring(a.length) : t;
10
7
  }
11
8
  function A(t) {
12
- return `${s}${t}`;
9
+ return t.startsWith(o) ? t.substring(o.length) : t;
10
+ }
11
+ function T(t) {
12
+ return `${o}${t}`;
13
13
  }
14
- function P(t) {
15
- return t.type === "defaultAttribute" ? t.attributeName : `${f}${t.attributeName}`;
14
+ function C(t) {
15
+ return t.type === "defaultAttribute" ? t.attributeName : `${a}${t.attributeName}`;
16
16
  }
17
- function _(t, r) {
17
+ function h(t, r) {
18
18
  const n = Object.values(r).filter((e) => e.attributeName === t);
19
19
  return n.find((e) => e.type === "defaultAttribute") ?? n[0];
20
20
  }
21
- function a(t, r) {
21
+ function l(t, r) {
22
22
  return t && "getAttribute" in t ? t.getAttribute(r) : null;
23
23
  }
24
- function m(t, r, n = {}) {
25
- const e = `${s}${t}`, u = r == null ? void 0 : r.querySelector(
26
- `${R}[${l}="${e}"]`
27
- ), c = a(u, i) ?? a(u == null ? void 0 : u.querySelector(`[${i}]`), i);
28
- if (c)
29
- return c;
30
- const o = _(t, n);
31
- return o ? P(o) : t;
24
+ function S(t, r, n = {}) {
25
+ const e = `${o}${t}`, u = r == null ? void 0 : r.querySelector(
26
+ `${y}[${f}="${e}"]`
27
+ ), i = l(u, c) ?? l(u == null ? void 0 : u.querySelector(`[${c}]`), c);
28
+ if (i)
29
+ return i;
30
+ const s = h(t, n);
31
+ return s ? C(s) : t;
32
32
  }
33
- function g(t, r, n = {}) {
34
- return t.startsWith(f) ? t : m(t, r, n);
33
+ function P(t, r, n = {}) {
34
+ return t.startsWith(a) ? t : S(t, r, n);
35
35
  }
36
- function C(t, r, n = {}) {
36
+ function O(t, r, n = {}) {
37
37
  return t.map((e) => {
38
- if (!e.startsWith(s))
38
+ if (!e.startsWith(o))
39
39
  return e;
40
- const u = T(e);
41
- return A(g(u, r, n));
40
+ const u = A(e);
41
+ return T(P(u, r, n));
42
42
  });
43
43
  }
44
- function E(t, r, n = {}) {
45
- return t.map((e) => g(e, r, n));
44
+ function p(t, r, n = {}) {
45
+ return t.map((e) => P(e, r, n));
46
46
  }
47
- function S(t) {
48
- const r = a(t, l);
49
- if (!(r != null && r.startsWith(s)))
47
+ function b(t) {
48
+ const r = l(t, f);
49
+ if (!(r != null && r.startsWith(o)))
50
50
  return r;
51
- const n = "querySelector" in t ? t.querySelector(`[${i}]`) : void 0, e = a(n, i);
52
- return e ? A(e) : r;
51
+ const n = "querySelector" in t ? t.querySelector(`[${c}]`) : void 0, e = l(n, c);
52
+ return e ? T(e) : r;
53
+ }
54
+ function m(t) {
55
+ return !!(t && "querySelector" in t && t.querySelector(".product-price") && t.querySelector(".product-old-price"));
56
+ }
57
+ function D(t) {
58
+ const r = b(t);
59
+ return r ? m(t) ? [g, d] : [r] : [];
53
60
  }
54
- function $(t, r, n) {
55
- const e = a(t, i), u = a(t.querySelector(`[${i}]`), i), c = e ?? u;
56
- return c === null ? n : c === r;
61
+ function R(t, r, n) {
62
+ const e = l(t, c), u = l(t.querySelector(`[${c}]`), c), i = e ?? u;
63
+ return i === null ? n : i === r;
57
64
  }
58
- function W(t, r) {
59
- const n = (h) => t.querySelector(
60
- `${R}[${l}="${h}"]`
65
+ function I(t, r) {
66
+ const n = (_) => t.querySelector(
67
+ `${y}[${f}="${_}"]`
61
68
  );
62
- if (!r.startsWith(s))
69
+ if (!r.startsWith(o))
63
70
  return n(r) ?? null;
64
- const e = T(r), u = n(r);
65
- if (u && $(u, e, !0))
71
+ const e = A(r), u = n(r);
72
+ if (u && R(u, e, !0))
66
73
  return u;
67
- const c = A(y(e)), o = c === r ? void 0 : n(c);
68
- return o && $(o, e, !1) ? o : null;
74
+ const i = T($(e)), s = i === r ? void 0 : n(i);
75
+ return s && R(s, e, !1) ? s : null;
69
76
  }
70
- function q(t, r) {
71
- const n = T(r), e = A(y(n));
77
+ function U(t, r) {
78
+ const n = A(r), e = T($(n));
72
79
  return e === r ? t : t.replace(
73
- `${l}="${e}"`,
74
- `${l}="${r}"`
80
+ `${f}="${e}"`,
81
+ `${f}="${r}"`
75
82
  );
76
83
  }
77
84
  export {
78
- y as bareAttributeName,
79
- T as compositionKeyToProductAttr,
80
- P as filterToProductAttrValue,
81
- W as findAttributeRow,
82
- _ as findFilterByBareName,
83
- d as isDefaultProductAttr,
84
- C as normalizeCompositionKeys,
85
- E as normalizeCustomAttrValues,
86
- A as productAttrToCompositionKey,
87
- S as resolveRowCompositionKey,
88
- q as rewriteLegacyRowKeyHtml
85
+ $ as bareAttributeName,
86
+ A as compositionKeyToProductAttr,
87
+ C as filterToProductAttrValue,
88
+ I as findAttributeRow,
89
+ h as findFilterByBareName,
90
+ q as isDefaultProductAttr,
91
+ m as isMergedInlinePriceRow,
92
+ O as normalizeCompositionKeys,
93
+ p as normalizeCustomAttrValues,
94
+ T as productAttrToCompositionKey,
95
+ b as resolveRowCompositionKey,
96
+ D as resolveRowVisibilityKeys,
97
+ U as rewriteLegacyRowKeyHtml
89
98
  };
@@ -1,32 +1,53 @@
1
- import { ModificationDescription as g } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { RECOMMENDATION_ID_ATTR as s } from "../constants/selectors.js";
3
- import { isPartnerManagedBlock as p, updateProductContentInPlace as C, regenerateProductRowsWithStyles as N } from "../controls/main/utils.js";
1
+ import { ModificationDescription as s } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { RECOMMENDATION_ID_ATTR as a } from "../constants/selectors.js";
3
+ import { isPartnerManagedBlock as C, updateProductContentInPlace as p, regenerateProductRowsWithStyles as y } from "../controls/main/utils.js";
4
4
  import { RecommendationConfigService as m } from "../services/configService.js";
5
- let o = null;
6
- function D(n) {
7
- o = n;
5
+ import { useRecommendationExtensionStore as N } from "../store/recommendation.js";
6
+ let n = null;
7
+ function B(e) {
8
+ n = e;
8
9
  }
9
- function P(n, r, c, l) {
10
- const i = o == null ? void 0 : o.getDocumentRootHtmlNode();
11
- if (!o || !i || !("querySelector" in i))
10
+ function S(e, t) {
11
+ const o = N(), i = o.currentRecommendationId;
12
+ if (i === e || !o.blockStates[e]) {
13
+ t();
14
+ return;
15
+ }
16
+ o.setCurrentBlock(e);
17
+ try {
18
+ t();
19
+ } finally {
20
+ o.$patch({ currentRecommendationId: i });
21
+ }
22
+ }
23
+ function P(e) {
24
+ const t = n == null ? void 0 : n.getDocumentRootHtmlNode();
25
+ return !t || !("querySelectorAll" in t) ? [] : t.querySelectorAll(`[${a}="${e}"]`).map((o) => m.getConfig(o));
26
+ }
27
+ function $(e, t, o, i) {
28
+ const f = n == null ? void 0 : n.getDocumentRootHtmlNode();
29
+ if (!n || !f || !("querySelector" in f))
12
30
  return !1;
13
- const e = i.querySelector(`[${s}="${n}"]`);
14
- if (!e)
31
+ const r = f.querySelector(`[${a}="${e}"]`);
32
+ if (!r)
15
33
  return !1;
16
- const t = o.getDocumentModifier(), a = m.getConfig(e), d = Object.keys(r).some((u) => JSON.stringify(a[u]) !== JSON.stringify(r[u]));
17
- if (m.stageConfig(t, e, r), p(e))
18
- return t.apply(new g(l)), !0;
19
- let f = !1;
20
- return C({
21
- currentNode: e,
22
- documentModifier: t,
23
- products: c,
24
- onApplied: () => {
25
- f = !0;
26
- }
27
- }) || (f = N({ currentNode: e, documentModifier: t, products: c })), !f && d && t.apply(new g(l)), !0;
34
+ const c = n.getDocumentModifier(), d = m.getConfig(r), g = Object.keys(t).some((l) => JSON.stringify(d[l]) !== JSON.stringify(t[l]));
35
+ if (m.stageConfig(c, r, t), C(r))
36
+ return c.apply(new s(i)), !0;
37
+ let u = !1;
38
+ return S(e, () => {
39
+ p({
40
+ currentNode: r,
41
+ documentModifier: c,
42
+ products: o,
43
+ onApplied: () => {
44
+ u = !0;
45
+ }
46
+ }) || (u = y({ currentNode: r, documentModifier: c, products: o }));
47
+ }), !u && g && c.apply(new s(i)), !0;
28
48
  }
29
49
  export {
30
- P as commitBlockChangeOutsidePanel,
31
- D as registerNodeConfigWriter
50
+ $ as commitBlockChangeOutsidePanel,
51
+ P as readBlockNodeConfigs,
52
+ B as registerNodeConfigWriter
32
53
  };
@@ -1,24 +1,47 @@
1
- import { useRecommendationExtensionStore as d } from "../store/recommendation.js";
2
- import { commitBlockChangeOutsidePanel as f } from "./nodeConfigWriter.js";
3
- async function h(e, r) {
4
- const t = d(), o = t.blockStates[e];
5
- if (!o)
1
+ import { useRecommendationExtensionStore as g } from "../store/recommendation.js";
2
+ import { toBlockUrlConfig as m } from "./blockUrlConfig.js";
3
+ import { commitBlockChangeOutsidePanel as d, readBlockNodeConfigs as y } from "./nodeConfigWriter.js";
4
+ function l(t, o) {
5
+ const r = JSON.stringify(m(o));
6
+ return y(t).find((e) => JSON.stringify(m(e)) !== r) ?? o;
7
+ }
8
+ async function C(t, o, r) {
9
+ const e = g(), c = [t, o];
10
+ (/* @__PURE__ */ new Map([[t, l(t, r)], [o, r]])).forEach((n, s) => {
11
+ var a;
12
+ (!!n.strategyId || s === o) && ((a = e.blockStates[s]) == null ? void 0 : a.recommendationConfigs.strategyId) !== n.strategyId && e.seedBlockUrlConfig(s, m(n));
13
+ }), e.resetArrivedBlock(o), await Promise.all(c.map(async (n) => {
14
+ if (!await e.refreshStrategyBlock(n))
15
+ return;
16
+ const { recommendationConfigs: s, recommendationProducts: i } = e.blockStates[n];
17
+ d(
18
+ n,
19
+ { size: s.size },
20
+ i,
21
+ "Refresh duplicated recommendation strategy"
22
+ );
23
+ }));
24
+ }
25
+ async function B(t, o) {
26
+ const r = g(), e = r.blockStates[t];
27
+ if (!e)
6
28
  return !1;
7
- const { strategyId: a, strategy: c, size: i, nodeConfigVersion: s } = o.recommendationConfigs;
8
- if (t.currentRecommendationId === e)
29
+ const { strategyId: c, strategy: f, size: n, nodeConfigVersion: s } = e.recommendationConfigs;
30
+ if (r.currentRecommendationId === t)
9
31
  try {
10
- await t.fetchRecommendationProducts();
11
- } catch (m) {
12
- console.error("[recommendation] product refetch after a strategy change failed", m);
32
+ await r.fetchRecommendationProducts();
33
+ } catch (a) {
34
+ console.error("[recommendation] product refetch after a strategy change failed", a);
13
35
  }
14
- const n = f(
15
- e,
16
- { strategyId: a, strategy: c, size: i, configVersion: s },
17
- o.recommendationProducts,
18
- r
36
+ const i = d(
37
+ t,
38
+ { strategyId: c, strategy: f, size: n, configVersion: s },
39
+ e.recommendationProducts,
40
+ o
19
41
  );
20
- return n || console.error("[recommendation] strategy change did not reach a node", { blockId: e }), n;
42
+ return i || console.error("[recommendation] strategy change did not reach a node", { blockId: t }), i;
21
43
  }
22
44
  export {
23
- h as commitStrategyChange
45
+ B as commitStrategyChange,
46
+ C as refreshDuplicatedStrategyBlocks
24
47
  };
@@ -10,3 +10,13 @@ export declare const MSO_ITEMS_HIDE_END = "MSO_ITEMS_HIDE_END";
10
10
  * and collapse them inline for web-engine Outlook.
11
11
  */
12
12
  export declare function wrapHiddenPriceTdsForOutlook(html: string): string;
13
+ /**
14
+ * Export safety net for a zero Items width: the wrapper gets the 100% pin, the cell's zero is
15
+ * dropped so it keeps its column width (a pin there overflows 33%/50% columns).
16
+ */
17
+ export declare function normalizeItemsBlockWidths(html: string): string;
18
+ /**
19
+ * The mobile `.adapt-img { width: 100% }` rule sizes the horizontal thumbnail by its auto-width column,
20
+ * so it grows in a roomy row and collapses to nothing in a crowded one — bound it to [default, width].
21
+ */
22
+ export declare function lockHorizontalItemImageWidths(html: string): string;
@@ -46,6 +46,11 @@ export declare class ItemsBlock extends Block {
46
46
  * relies on this td-level fallback in pairProductVariables.
47
47
  */
48
48
  private _stampProductTdDomAttributes;
49
+ /**
50
+ * Repairs a saved module's collapsed card into the state the load migrator produces. Acts only
51
+ * on a zero width, so Stripo's non-zero drop-time width never triggers it and a healed block no-ops.
52
+ */
53
+ private _healCollapsedWidths;
49
54
  /**
50
55
  * Whether a currency self-heal pass should run for this block (SD-147588). The only gate here is
51
56
  * once-per-session: heal each instance at most once, so the auto-fix can't fight undo (undo
@@ -0,0 +1,12 @@
1
+ export declare const PRODUCT_TD_SELECTOR = ".ins-product-td";
2
+ export declare const PRODUCT_WRAPPER_SELECTOR = ".ins-product-wrapper";
3
+ /** The declaration `layouts/vertical.html` and `layouts/horizontal.html` ship inline. */
4
+ export declare const WIDTH_PIN_DECLARATION = "width: 100%";
5
+ /** True for a `width` attribute value that renders the card zero-wide (`0`, `0px`, `0%`). */
6
+ export declare const isZeroWidthValue: (value?: string | null) => boolean;
7
+ /** True when an inline style declares a zero `width` (ignores `max-width` / `min-width`). */
8
+ export declare const hasZeroWidthDeclaration: (style: string) => boolean;
9
+ /** Rewrites a zero width to the pin or appends it; a non-zero width is kept. Idempotent. */
10
+ export declare const withWidthPin: (style: string) => string;
11
+ /** Drops a zero `width` declaration; the product cell must inherit its column width, not be pinned. */
12
+ export declare const withoutZeroWidth: (style: string) => string;
@@ -17,6 +17,8 @@ export declare class RecommendationBlock extends Block {
17
17
  private _pendingBlockId;
18
18
  /** Ids already reset under their new name, so the deferred pass skips their stale snapshot. */
19
19
  private _resetSourceIds;
20
+ /** Ids handed to duplicates the document root does not show yet: a copied module renames all its blocks at once. */
21
+ private _unsettledDuplicateIds;
20
22
  constructor();
21
23
  getId(): string;
22
24
  getIcon(): string;
@@ -189,6 +189,9 @@ export declare class RecommendationCardCompositionControl extends CommonControl
189
189
  */
190
190
  private _buildCompositionHtml;
191
191
  private _applyVisibilityToBlock;
192
+ /** Inline "Product Prices" group row is tagged with whichever price comes first, so it drives both keys. */
193
+ private _resolveVisibilityKeys;
194
+ private _isInlinePrices;
192
195
  private _applyTitleVisibilityToBlock;
193
196
  private _resolveTitleInjection;
194
197
  private _readTitleHtml;
@@ -139,6 +139,8 @@ export declare class RecommendationBlockControl extends CommonControl {
139
139
  * fails when the size actually changed.
140
140
  */
141
141
  private _debouncedRegenerateWithProducts;
142
+ /** Draws the current block's products into this panel's node. */
143
+ private _regenerateWithProducts;
142
144
  /**
143
145
  * Listen to store changes that require product refresh or regeneration.
144
146
  *