@useinsider/guido 3.7.2-beta.a114aa7 → 3.7.2-beta.af89512

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 (39) hide show
  1. package/dist/composables/useHtmlCompiler.js +8 -6
  2. package/dist/composables/useHtmlValidator.js +133 -180
  3. package/dist/config/compiler/htmlCompilerRules.js +15 -7
  4. package/dist/config/compiler/utils/recommendationCompilerUtils.js +27 -28
  5. package/dist/config/migrator/fontTagMigrator.js +7 -0
  6. package/dist/config/migrator/index.js +8 -7
  7. package/dist/config/migrator/recommendation/extractors.js +22 -44
  8. package/dist/config/migrator/recommendation/htmlBuilder.js +169 -175
  9. package/dist/config/migrator/recommendationMigrator.js +31 -30
  10. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -21
  11. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +41 -55
  12. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +42 -43
  13. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +33 -44
  14. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +2 -3
  15. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +49 -59
  16. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +82 -89
  17. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +6 -7
  18. package/dist/extensions/Blocks/Recommendation/extension.js +5 -6
  19. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +2 -3
  20. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +2 -3
  21. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +12 -13
  22. package/dist/extensions/Blocks/Recommendation/templates/index.js +4 -5
  23. package/dist/src/composables/useHtmlValidator.d.ts +0 -27
  24. package/dist/src/config/migrator/fontTagMigrator.d.ts +8 -0
  25. package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -15
  26. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +0 -8
  27. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  28. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -21
  29. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +0 -7
  30. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +0 -5
  31. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +0 -6
  32. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -9
  33. package/dist/src/utils/stripFontTags.d.ts +13 -0
  34. package/dist/utils/stripFontTags.js +13 -0
  35. package/package.json +1 -1
  36. package/dist/config/compiler/utils/recommendationIgnoreUtils.js +0 -15
  37. package/dist/src/composables/useHtmlValidator.test.d.ts +0 -1
  38. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +0 -17
  39. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +0 -1
@@ -1,40 +1,36 @@
1
1
  import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { RecommendationBlockId as m } from "../../constants/blockIds.js";
3
- import { CURRENCY_ATTR as S, CSS_CLASS_SKIP_COMPILE as v, MOBILE_CONTAINER_SELECTOR as P, MOBILE_ROW_SELECTOR as _, DESKTOP_CONTAINER_SELECTOR as M, CONTAINER_SELECTOR as j, ATTR_PRODUCT_ATTR as V } from "../../constants/selectors.js";
3
+ import { CURRENCY_ATTR as g, MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as v, ATTR_PRODUCT_ATTR as j } from "../../constants/selectors.js";
4
4
  import { RecommendationConfigService as b } from "../../services/configService.js";
5
5
  import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
6
- import { prepareProductRows as k } from "../../templates/index.js";
7
- import { formatPrice as W } from "../../utils/priceFormatter.js";
8
- import { isTdNode as F } from "../../utils/tagName.js";
9
- import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as R, sanitizeImageUrl as G, toDisplayableAttributeValue as K } from "../../templates/utils.js";
10
- const T = "recommendation-block-v2";
11
- function A(t) {
6
+ import { prepareProductRows as _ } from "../../templates/index.js";
7
+ import { formatPrice as V } from "../../utils/priceFormatter.js";
8
+ import { isTdNode as W } from "../../utils/tagName.js";
9
+ import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as T, sanitizeImageUrl as F, toDisplayableAttributeValue as G } from "../../templates/utils.js";
10
+ const h = "recommendation-block-v2";
11
+ function R(t) {
12
12
  if (!t)
13
13
  return null;
14
14
  if ("getAttribute" in t) {
15
15
  const e = t.getAttribute("class");
16
- if (e && e.includes(T))
16
+ if (e && e.includes(h))
17
17
  return t;
18
18
  }
19
- return "querySelector" in t ? t.querySelector(`.${T}`) ?? null : null;
20
- }
21
- function Y(t) {
22
- const e = A(t);
23
- return !e || !("getAttribute" in e) ? !1 : (e.getAttribute("class") ?? "").split(/\s+/).includes(v);
19
+ return "querySelector" in t ? t.querySelector(`.${h}`) ?? null : null;
24
20
  }
25
21
  function E(t) {
26
- const e = A(t);
22
+ const e = R(t);
27
23
  if (!e || !("getAttribute" in e))
28
24
  return "grid";
29
25
  const o = e.getAttribute("data-layout");
30
26
  return o === "list" || o === "horizontal" ? "list" : "grid";
31
27
  }
32
28
  function H(t) {
33
- const e = A(t);
29
+ const e = R(t);
34
30
  if (!e || !("getAttribute" in e))
35
- return R;
31
+ return T;
36
32
  const o = e.getAttribute("data-card-composition");
37
- return o ? o.split(",").filter(Boolean) : R;
33
+ return o ? o.split(",").filter(Boolean) : T;
38
34
  }
39
35
  function x(t) {
40
36
  if (!t || !("childNodes" in t))
@@ -44,35 +40,35 @@ function x(t) {
44
40
  );
45
41
  return o || e.reduce((n, r) => n || !("getType" in r) || r.getType() === "text" ? n : x(r), null);
46
42
  }
47
- function g(t, e, o) {
43
+ function S(t, e, o) {
48
44
  const n = x(e);
49
45
  return n ? (t.modifyHtml(n).setText(o), !0) : !1;
50
46
  }
51
47
  function D(t, e) {
52
48
  return t && t.length > 0 ? t : e.length > 0 ? e : L();
53
49
  }
54
- function X(t) {
50
+ function Y(t) {
55
51
  const { currentNode: e, documentModifier: o } = t;
56
52
  if (!e || !("querySelector" in e))
57
53
  return;
58
- const n = e.querySelector(_);
54
+ const n = e.querySelector(k);
59
55
  n && (o.modifyHtml(n).setInnerHtml(""), o.apply(new p("Cleared mobile row content")));
60
56
  }
61
- function z(t) {
57
+ function K(t) {
62
58
  return "getOuterHTML" in t && typeof t.getOuterHTML == "function" ? t.getOuterHTML() : "";
63
59
  }
64
- function J(t) {
60
+ function X(t) {
65
61
  const e = t.querySelector(".container");
66
62
  return !e || !("childNodes" in e) ? null : e.childNodes().find((n) => "getTagName" in n && n.getTagName() === "tbody") ?? e.querySelector("tbody") ?? null;
67
63
  }
68
- function Q(t, e, o) {
69
- const n = J(t);
64
+ function z(t, e, o) {
65
+ const n = X(t);
70
66
  if (!n || !("childNodes" in n))
71
67
  return;
72
- const r = n.childNodes().map(z).join(""), l = `<tr class="ins-recommendation-mobile-row">${o}</tr>`;
68
+ const r = n.childNodes().map(K).join(""), l = `<tr class="ins-recommendation-mobile-row">${o}</tr>`;
73
69
  e.modifyHtml(n).setInnerHtml(r + l), e.apply(new p("Added mobile product row"));
74
70
  }
75
- function Z(t) {
71
+ function J(t) {
76
72
  const {
77
73
  currentNode: e,
78
74
  documentModifier: o,
@@ -84,21 +80,21 @@ function Z(t) {
84
80
  return;
85
81
  const i = r ?? E(e), s = b.getConfig(e);
86
82
  if (i === "list" || !s.mobileLayoutEnabled) {
87
- X({ currentNode: e, documentModifier: o });
83
+ Y({ currentNode: e, documentModifier: o });
88
84
  return;
89
85
  }
90
- const u = C(), c = D(n, u.recommendationProducts), d = l ?? H(e), a = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${k(c, i, {
86
+ const u = C(), c = D(n, u.recommendationProducts), d = l ?? H(e), a = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${_(c, i, {
91
87
  productsPerRow: s.mobileCardsInRow,
92
88
  composition: d,
93
89
  filterList: u.filterList
94
- })}</table></td>`, y = e.querySelector(_);
90
+ })}</table></td>`, y = e.querySelector(k);
95
91
  if (!y) {
96
- Q(e, o, a);
92
+ z(e, o, a);
97
93
  return;
98
94
  }
99
95
  o.modifyHtml(y).setInnerHtml(a), o.apply(new p("Updated mobile product rows"));
100
96
  }
101
- function ee(t) {
97
+ function Q(t) {
102
98
  const {
103
99
  currentNode: e,
104
100
  documentModifier: o,
@@ -109,17 +105,17 @@ function ee(t) {
109
105
  } = t;
110
106
  if (!e || !("querySelector" in e))
111
107
  return;
112
- const s = e.querySelector(M) ?? e.querySelector(j);
108
+ const s = e.querySelector(P) ?? e.querySelector(v);
113
109
  if (!s)
114
110
  return;
115
- const u = C(), c = D(r, u.recommendationProducts), { cardsInRow: d } = b.getConfig(e), f = i ?? H(e), a = l ?? E(e), y = k(c, a, {
111
+ const u = C(), c = D(r, u.recommendationProducts), { cardsInRow: d } = b.getConfig(e), f = i ?? H(e), a = l ?? E(e), y = _(c, a, {
116
112
  productsPerRow: d,
117
113
  composition: f,
118
114
  filterList: u.filterList
119
115
  });
120
- o.modifyHtml(s).setInnerHtml(y).apply(new p("Updated product")), Z(t), n == null || n();
116
+ o.modifyHtml(s).setInnerHtml(y).apply(new p("Updated product")), J(t), n == null || n();
121
117
  }
122
- function h(t, e, o, n) {
118
+ function M(t, e, o, n) {
123
119
  const l = `0 ${Math.floor(o / 2)}px`;
124
120
  let i = !1;
125
121
  return n === "grid" ? Array.from(
@@ -130,7 +126,7 @@ function h(t, e, o, n) {
130
126
  t.querySelectorAll(".product-card-wrapper")
131
127
  ).forEach((u) => {
132
128
  const c = "parentNode" in u ? u.parentNode : null;
133
- c && F(c) && (e.modifyHtml(c).setStyle("padding", l), i = !0);
129
+ c && W(c) && (e.modifyHtml(c).setStyle("padding", l), i = !0);
134
130
  }), i;
135
131
  }
136
132
  function I(t, e, o) {
@@ -140,15 +136,15 @@ function I(t, e, o) {
140
136
  e.modifyHtml(i).setStyle("height", n), l = !0;
141
137
  }), l;
142
138
  }
143
- function te(t) {
139
+ function Z(t) {
144
140
  const { currentNode: e, documentModifier: o } = t;
145
141
  if (!e)
146
142
  return;
147
143
  const n = b.getConfig(e), r = E(e);
148
144
  let l = !1;
149
- const i = e.querySelector(M);
145
+ const i = e.querySelector(P);
150
146
  if (i) {
151
- l = h(
147
+ l = M(
152
148
  i,
153
149
  o,
154
150
  n.columnSpacing,
@@ -161,9 +157,9 @@ function te(t) {
161
157
  );
162
158
  l = l || c;
163
159
  }
164
- const s = e.querySelector(P);
160
+ const s = e.querySelector(q);
165
161
  if (s) {
166
- const u = h(
162
+ const u = M(
167
163
  s,
168
164
  o,
169
165
  n.mobileColumnSpacing,
@@ -179,9 +175,9 @@ function te(t) {
179
175
  }
180
176
  l && o.apply(new p("Reapply spacing after regeneration"));
181
177
  }
182
- function ye(t) {
178
+ function me(t) {
183
179
  const { currentNode: e, documentModifier: o, afterRegenerate: n, products: r, layout: l, composition: i } = t;
184
- e && ee({
180
+ e && Q({
185
181
  currentNode: e,
186
182
  documentModifier: o,
187
183
  products: r,
@@ -189,12 +185,12 @@ function ye(t) {
189
185
  composition: i,
190
186
  afterRegenerate: () => {
191
187
  setTimeout(() => {
192
- te({ currentNode: e, documentModifier: o });
188
+ Z({ currentNode: e, documentModifier: o });
193
189
  }, 0), n == null || n();
194
190
  }
195
191
  });
196
192
  }
197
- function Se(t, e) {
193
+ function pe(t, e) {
198
194
  return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...L(e - t.length)];
199
195
  }
200
196
  function U() {
@@ -208,14 +204,14 @@ function U() {
208
204
  thousandSeparator: e.thousandSeparator
209
205
  };
210
206
  }
211
- function q(t, e = "price") {
207
+ function A(t, e = "price") {
212
208
  const o = U(), n = t[e], r = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
213
- return W({
209
+ return V({
214
210
  price: r,
215
211
  currency: o
216
212
  });
217
213
  }
218
- function oe(t) {
214
+ function ee(t) {
219
215
  var l, i;
220
216
  const e = U(), o = ((l = t.original_price) == null ? void 0 : l[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((i = t.price) == null ? void 0 : i[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = o > 0 ? Math.round((o - n) / o * 100) : 0;
221
217
  return r > 0 ? `-${r}%` : "0%";
@@ -224,24 +220,24 @@ function $(t) {
224
220
  const { documentModifier: e, product: o, priceEl: n, oldPriceEl: r, omnibusPriceEl: l, omnibusDiscountEl: i } = t;
225
221
  let s = !1;
226
222
  if (n && "querySelector" in n) {
227
- const u = n.querySelector("strong") ?? n.querySelector("p"), c = q(o, "price");
228
- g(e, u ?? null, c) && (s = !0);
223
+ const u = n.querySelector("strong") ?? n.querySelector("p"), c = A(o, "price");
224
+ S(e, u ?? null, c) && (s = !0);
229
225
  }
230
226
  if (r && "querySelector" in r) {
231
- const u = r.querySelector("strong") ?? r.querySelector("p"), c = q(o, "original_price");
232
- g(e, u ?? null, c) && (s = !0);
227
+ const u = r.querySelector("strong") ?? r.querySelector("p"), c = A(o, "original_price");
228
+ S(e, u ?? null, c) && (s = !0);
233
229
  }
234
230
  if (l && "querySelector" in l) {
235
- const u = l.querySelector(".omnibus-price-value") ?? null, c = q(o, "original_price");
236
- g(e, u, c) && (s = !0);
231
+ const u = l.querySelector(".omnibus-price-value") ?? null, c = A(o, "original_price");
232
+ S(e, u, c) && (s = !0);
237
233
  }
238
234
  if (i && "querySelector" in i) {
239
- const u = i.querySelector(".omnibus-discount-value") ?? null, c = oe(o);
240
- g(e, u, c) && (s = !0);
235
+ const u = i.querySelector(".omnibus-discount-value") ?? null, c = ee(o);
236
+ S(e, u, c) && (s = !0);
241
237
  }
242
238
  return s;
243
239
  }
244
- function ne(t) {
240
+ function te(t) {
245
241
  const {
246
242
  documentModifier: e,
247
243
  product: o,
@@ -256,13 +252,13 @@ function ne(t) {
256
252
  let d = !1;
257
253
  if (n && "querySelector" in n) {
258
254
  const f = n.querySelector("img");
259
- f && (e.modifyHtml(f).setAttribute("src", G(o.image_url)).setAttribute("alt", o.name), d = !0);
255
+ f && (e.modifyHtml(f).setAttribute("src", F(o.image_url)).setAttribute("alt", o.name), d = !0);
260
256
  const a = n.querySelector("a");
261
257
  a && (e.modifyHtml(a).setAttribute("href", o.url), d = !0);
262
258
  }
263
259
  if (r && "querySelector" in r) {
264
260
  const f = r.querySelector("strong") ?? r.querySelector("p");
265
- g(e, f ?? null, o.name) && (d = !0);
261
+ S(e, f ?? null, o.name) && (d = !0);
266
262
  }
267
263
  if ($({
268
264
  documentModifier: e,
@@ -278,10 +274,10 @@ function ne(t) {
278
274
  return d;
279
275
  }
280
276
  function B(t) {
281
- return "querySelector" in t ? t.querySelector(M) ?? t : t;
277
+ return "querySelector" in t ? t.querySelector(P) ?? t : t;
282
278
  }
283
279
  const O = "product_attribute.";
284
- function re(t, e) {
280
+ function oe(t, e) {
285
281
  var n;
286
282
  let o;
287
283
  if (t.startsWith(O)) {
@@ -289,9 +285,9 @@ function re(t, e) {
289
285
  o = (n = e.product_attributes) == null ? void 0 : n[r];
290
286
  } else
291
287
  o = e[t];
292
- return K(o) || null;
288
+ return G(o) || null;
293
289
  }
294
- function ie(t, e, o) {
290
+ function ne(t, e, o) {
295
291
  if (!("querySelectorAll" in t))
296
292
  return !1;
297
293
  const n = t.querySelectorAll(
@@ -303,7 +299,7 @@ function ie(t, e, o) {
303
299
  n.forEach((i) => {
304
300
  if (!("getAttribute" in i))
305
301
  return;
306
- const s = i.getAttribute(V);
302
+ const s = i.getAttribute(j);
307
303
  if (!s)
308
304
  return;
309
305
  const u = r.get(s) ?? [];
@@ -315,11 +311,11 @@ function ie(t, e, o) {
315
311
  i.slice(0, u).forEach((c, d) => {
316
312
  if (!("querySelector" in c))
317
313
  return;
318
- const f = re(s, o[d]);
314
+ const f = oe(s, o[d]);
319
315
  if (f === null)
320
316
  return;
321
317
  const a = c.querySelector("p") ?? null;
322
- g(e, a, f) && (l = !0);
318
+ S(e, a, f) && (l = !0);
323
319
  });
324
320
  }), l;
325
321
  }
@@ -343,7 +339,7 @@ function w(t, e, o) {
343
339
  ), d = Math.min(n.length, o.length);
344
340
  let f = !1;
345
341
  for (let a = 0; a < d; a++) {
346
- const y = ne({
342
+ const y = te({
347
343
  documentModifier: e,
348
344
  product: o[a],
349
345
  imageEl: n[a] ?? null,
@@ -356,9 +352,9 @@ function w(t, e, o) {
356
352
  });
357
353
  f = f || y;
358
354
  }
359
- return ie(t, e, o) && (f = !0), f;
355
+ return ne(t, e, o) && (f = !0), f;
360
356
  }
361
- function ge(t) {
357
+ function ye(t) {
362
358
  const { currentNode: e, documentModifier: o, products: n } = t;
363
359
  if (!e || !("querySelectorAll" in e))
364
360
  return !1;
@@ -370,7 +366,7 @@ function ge(t) {
370
366
  let i = w(r, o, n);
371
367
  const s = E(e), u = b.getConfig(e);
372
368
  if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
373
- const c = e.querySelector(P);
369
+ const c = e.querySelector(q);
374
370
  if (c) {
375
371
  const d = w(
376
372
  c,
@@ -406,12 +402,10 @@ function N(t, e, o) {
406
402
  }) && (u = !0);
407
403
  return u;
408
404
  }
409
- function be(t) {
405
+ function ge(t) {
410
406
  const { currentNode: e, documentModifier: o } = t;
411
407
  if (!e || !("querySelectorAll" in e))
412
408
  return !1;
413
- if (Y(e))
414
- return !0;
415
409
  const r = C().recommendationProducts;
416
410
  if (r.length === 0)
417
411
  return !1;
@@ -419,7 +413,7 @@ function be(t) {
419
413
  let i = N(l, o, r);
420
414
  const s = E(e), u = b.getConfig(e);
421
415
  if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
422
- const c = e.querySelector(P);
416
+ const c = e.querySelector(q);
423
417
  if (c) {
424
418
  const d = N(c, o, r);
425
419
  i = i || d;
@@ -427,28 +421,27 @@ function be(t) {
427
421
  }
428
422
  return i && o.apply(new p("Updated price formatting in-place")), i;
429
423
  }
430
- function Ee(t) {
431
- const { currentNode: e, documentModifier: o, currency: n } = t, r = A(e);
424
+ function Se(t) {
425
+ const { currentNode: e, documentModifier: o, currency: n } = t, r = R(e);
432
426
  if (!r)
433
427
  return;
434
428
  const l = n.alignment === "before" ? "0" : "1", i = (s, u) => {
435
429
  o.modifyHtml(r).setAttribute(s, u);
436
430
  };
437
- i(S.CURRENCY, n.code), i(S.SYMBOL, n.symbol), i(S.ALIGNMENT, l), i(S.THOUSAND_SEPARATOR, n.thousandSeparator), i(S.DECIMAL_SEPARATOR, n.decimalSeparator), i(S.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new p("Update currency attributes"));
431
+ i(g.CURRENCY, n.code), i(g.SYMBOL, n.symbol), i(g.ALIGNMENT, l), i(g.THOUSAND_SEPARATOR, n.thousandSeparator), i(g.DECIMAL_SEPARATOR, n.decimalSeparator), i(g.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new p("Update currency attributes"));
438
432
  }
439
433
  export {
440
- Se as adjustProductsToSize,
441
- q as formatProductPrice,
442
- A as getBlockElement,
434
+ pe as adjustProductsToSize,
435
+ A as formatProductPrice,
436
+ R as getBlockElement,
443
437
  H as getCardComposition,
444
438
  E as getCurrentLayout,
445
- Y as isPartnerManagedBlock,
446
- te as reapplySpacing,
447
- Z as regenerateMobileProductRows,
448
- ee as regenerateProductRows,
449
- ye as regenerateProductRowsWithStyles,
450
- Ee as setCurrencyAttributes,
451
- be as updatePricesInPlace,
452
- ge as updateProductContentInPlace,
453
- ne as updateSingleProductContent
439
+ Z as reapplySpacing,
440
+ J as regenerateMobileProductRows,
441
+ Q as regenerateProductRows,
442
+ me as regenerateProductRowsWithStyles,
443
+ Se as setCurrencyAttributes,
444
+ ge as updatePricesInPlace,
445
+ ye as updateProductContentInPlace,
446
+ te as updateSingleProductContent
454
447
  };
@@ -1,12 +1,11 @@
1
1
  var m = Object.defineProperty;
2
- var p = (o, e, t) => e in o ? m(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var a = (o, e, t) => p(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { UIElementType as c, UEAttr as _ } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ var _ = (o, e, t) => e in o ? m(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var a = (o, e, t) => _(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { UIElementType as c, UEAttr as p } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as d } from "../../common-control.js";
6
6
  import { RecommendationControlId as C } from "../constants/controlIds.js";
7
- import "../constants/selectors.js";
8
7
  const S = C.SYNC_INFO_MESSAGE, r = "sync-info-message", u = "Note that changes will be applied to all product cards in your recommendation block.";
9
- class O extends d {
8
+ class h extends d {
10
9
  constructor() {
11
10
  super(...arguments);
12
11
  a(this, "_repositionedElement", null);
@@ -18,7 +17,7 @@ class O extends d {
18
17
  return `
19
18
  <div class="${r}">
20
19
  <${c.ICON}
21
- ${_.ICON.src}="migration-info-icon"
20
+ ${p.ICON.src}="migration-info-icon"
22
21
  class="${r}__icon">
23
22
  </${c.ICON}>
24
23
  <p class="${r}__text">
@@ -62,5 +61,5 @@ class O extends d {
62
61
  }
63
62
  export {
64
63
  S as SYNC_INFO_MESSAGE_CONTROL_ID,
65
- O as SyncInfoMessageControl
64
+ h as SyncInfoMessageControl
66
65
  };
@@ -1,14 +1,13 @@
1
1
  import { ExtensionBuilder as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { RecommendationBlock as m } from "./block.js";
3
3
  import { RecommendationBlockControl as n } from "./controls/main/index.js";
4
- import "./constants/selectors.js";
5
4
  import "./store/recommendation.js";
6
5
  import { NameControls as i } from "./controls/name/index.js";
7
6
  import { PriceControls as e } from "./controls/price/index.js";
8
7
  import { OldPriceControls as s } from "./controls/oldPrice/index.js";
9
8
  import { OmnibusPriceControls as l } from "./controls/omnibusPrice/index.js";
10
- import { OmnibusDiscountControls as p } from "./controls/omnibusDiscount/index.js";
11
- import { ButtonControls as a } from "./controls/button/index.js";
9
+ import { OmnibusDiscountControls as a } from "./controls/omnibusDiscount/index.js";
10
+ import { ButtonControls as p } from "./controls/button/index.js";
12
11
  import { ImageControls as c } from "./controls/image/index.js";
13
12
  import { CustomAttributeControls as C } from "./controls/customAttribute/index.js";
14
13
  import { SpacingControl as f } from "./controls/spacing/index.js";
@@ -23,8 +22,8 @@ const b = [
23
22
  e,
24
23
  s,
25
24
  l,
26
- p,
27
25
  a,
26
+ p,
28
27
  c,
29
28
  C
30
29
  ], P = [
@@ -36,10 +35,10 @@ const b = [
36
35
  ], S = [
37
36
  ...P,
38
37
  ...b.flatMap((o) => Object.values(o))
39
- ], L = S.reduce(
38
+ ], K = S.reduce(
40
39
  (o, t) => o.addControl(t),
41
40
  new r().addBlock(m).withSettingsPanelRegistry(B)
42
41
  ).addStyles(y).withIconsRegistry(R).build();
43
42
  export {
44
- L as default
43
+ K as default
45
44
  };
@@ -2,7 +2,6 @@ import { SettingsPanelRegistry as E, SettingsPanelTab as _, SettingsTab as O, Co
2
2
  import { BLOCK_ID as U } from "./block.js";
3
3
  import { RecommendationBlockId as S } from "./constants/blockIds.js";
4
4
  import { RecommendationControlId as T } from "./constants/controlIds.js";
5
- import "./constants/selectors.js";
6
5
  import { CONTROL_BLOCK_ID as A } from "./controls/main/index.js";
7
6
  import "./store/recommendation.js";
8
7
  import "./controls/name/index.js";
@@ -16,7 +15,7 @@ import { SPACING_CONTROL_ID as L } from "./controls/spacing/index.js";
16
15
  import { CARD_BACKGROUND_COLOR_CONTROL_ID as D } from "./controls/cardBackground/index.js";
17
16
  import { COMPOSITION_CONTROL_BLOCK_ID as B } from "./controls/cardComposition/index.js";
18
17
  import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
19
- class a extends E {
18
+ class Z extends E {
20
19
  registerBlockControls(I) {
21
20
  I[U] = [
22
21
  new _(
@@ -195,5 +194,5 @@ class a extends E {
195
194
  }
196
195
  }
197
196
  export {
198
- a as SettingsPanel
197
+ Z as SettingsPanel
199
198
  };
@@ -2,7 +2,6 @@ import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAtt
2
2
  import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
3
3
  import { useConfigStore as G } from "../../../../stores/config.js";
4
4
  import { defineStore as P } from "pinia";
5
- import "../constants/selectors.js";
6
5
  import { DEFAULT_MOBILE_CARDS_IN_ROW as D, DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
7
6
  import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
8
7
  import { getDefaultProducts as S } from "../templates/utils.js";
@@ -61,7 +60,7 @@ const L = () => ({
61
60
  blockStates: {},
62
61
  currentRecommendationId: null,
63
62
  configVersion: 0
64
- }), $ = P("guidoRecommendationExtension", {
63
+ }), K = P("guidoRecommendationExtension", {
65
64
  state: () => L(),
66
65
  getters: {
67
66
  // ====================================================================
@@ -477,5 +476,5 @@ const L = () => ({
477
476
  }
478
477
  });
479
478
  export {
480
- $ as useRecommendationExtensionStore
479
+ K as useRecommendationExtensionStore
481
480
  };
@@ -1,4 +1,3 @@
1
- import "../../constants/selectors.js";
2
1
  import { DEFAULT_PRODUCTS_PER_ROW as m } from "../../constants/layout.js";
3
2
  import { getDefaultProducts as I, DEFAULTS as b, createBlockTemplate as E, DEFAULT_CARD_COMPOSITION as L, spacer as S, buildElementRenderer as _, DEFAULT_CARD_VISIBILITY as f } from "../utils.js";
4
3
  import { buildFillerCell as w, gridElementRenderer as A } from "./elementRenderer.js";
@@ -29,36 +28,36 @@ const D = `
29
28
  </tr>
30
29
  `;
31
30
  function O(t, e, n, r = L, c = {}) {
32
- const i = (100 / e).toFixed(2), s = e - t.length, l = s > 0 ? w(i).repeat(s) : "", a = _(n, r, c);
33
- return r.filter((o) => a[o]).map((o) => {
34
- const d = f[o] ?? !0, u = d ? "" : 'style="display: none;"', T = t.map((R) => a[o](R).replace("<td", `<td width="${i}%"`)).join("");
35
- return C.replace("{-{-ATTR_TYPE-}-}", o).replace("{-{-VISIBILITY-}-}", d ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", u).replace("{-{-CELLS-}-}", T + l);
31
+ const a = (100 / e).toFixed(2), s = e - t.length, l = s > 0 ? w(a).repeat(s) : "", i = _(n, r, c);
32
+ return r.filter((o) => i[o]).map((o) => {
33
+ const p = f[o] ?? !0, u = p ? "" : 'style="display: none;"', T = t.map((R) => i[o](R).replace("<td", `<td width="${a}%"`)).join("");
34
+ return C.replace("{-{-ATTR_TYPE-}-}", o).replace("{-{-VISIBILITY-}-}", p ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", u).replace("{-{-CELLS-}-}", T + l);
36
35
  }).join("");
37
36
  }
38
37
  function g(t, e, n, r, c = {}) {
39
- const i = [];
38
+ const a = [];
40
39
  for (let l = 0; l < t.length; l += e)
41
- i.push(t.slice(l, l + e));
42
- return i.map((l, a) => {
43
- const p = O(
40
+ a.push(t.slice(l, l + e));
41
+ return a.map((l, i) => {
42
+ const d = O(
44
43
  l,
45
44
  e,
46
45
  n,
47
46
  r,
48
47
  c
49
- ), o = D.replace("{-{-ATTRIBUTE_ROWS-}-}", p);
50
- return a > 0 ? S + o : o;
48
+ ), o = D.replace("{-{-ATTRIBUTE_ROWS-}-}", d);
49
+ return i > 0 ? S + o : o;
51
50
  }).join("");
52
51
  }
53
52
  function P(t, e, n, r = {}) {
54
53
  return g(t, e, A, n, r);
55
54
  }
56
- function W(t) {
55
+ function B(t) {
57
56
  const e = t ? `ins-recommendation-v3-block-${t}` : void 0, n = E("grid", e), r = I(), c = P(r, m);
58
57
  return n.replace("{-{-TITLE-}-}", b.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
59
58
  }
60
59
  export {
61
- W as getDefaultTemplate,
60
+ B as getDefaultTemplate,
62
61
  O as prepareGridAttributeRows,
63
62
  g as prepareGridProductRows,
64
63
  P as prepareProductRows
@@ -1,13 +1,12 @@
1
- import "../constants/selectors.js";
2
1
  import { DEFAULT_PRODUCTS_PER_ROW as s } from "../constants/layout.js";
3
2
  import { prepareProductRows as c } from "./grid/template.js";
4
- import { prepareProductRows as m } from "./list/template.js";
5
- function f(o, t, r = {}) {
3
+ import { prepareProductRows as R } from "./list/template.js";
4
+ function a(o, t, r = {}) {
6
5
  if (t === "list")
7
- return m(o, r.composition, r.filterList);
6
+ return R(o, r.composition, r.filterList);
8
7
  const { productsPerRow: e = s, composition: p, filterList: i } = r;
9
8
  return c(o, e, p, i);
10
9
  }
11
10
  export {
12
- f as prepareProductRows
11
+ a as prepareProductRows
13
12
  };
@@ -1,31 +1,4 @@
1
1
  import type { DynamicContent } from '@@/Types/generic';
2
- import type { FiltersResponse } from '@@/Types/recommendation';
3
- /**
4
- * Parses a `{{recoId_index_attributeName}}` variable (already stripped of the
5
- * braces/whitespace) into its recommendation id and attribute name. Returns
6
- * null for anything that isn't a well-formed recommendation variable.
7
- */
8
- export declare function parseRecommendationVariable(field: string): {
9
- recoId: string;
10
- attribute: string;
11
- } | null;
12
- /**
13
- * Builds the set of attribute forms valid inside partner-authored
14
- * `{{recoId_index_attribute}}` variables: the built-in compiler attributes plus
15
- * each account attribute in its canonical token form — bare for
16
- * `defaultAttribute`, `product_attribute.<name>` for `productAttribute`. Using
17
- * `resolveProductAttrValue` (the same producer the block builder uses) keeps the
18
- * validator's notion of "valid form" identical to what is actually emitted.
19
- */
20
- export declare function buildPartnerAttributeNameSet(filterList: FiltersResponse): Set<string>;
21
- /**
22
- * Returns the `{{...}}` custom fields in the HTML that are invalid. Partner
23
- * attributes in `ins-skip-compile` blocks (recoId ∈ ignoredIds) are checked
24
- * against `ignoredAttributeNames`; Guido-generated reco variables and known merge
25
- * tags pass. An unrecognized dotted token is ignored: it was never captured
26
- * before, so flagging it would false-positive on merge tags like `{{user.name}}`.
27
- */
28
- export declare function findInvalidCustomFields(html: string, validCustomFields: string[], recommendationBlockIds: string[], ignoredIds: Set<string>, ignoredAttributeNames: Set<string> | null): string[];
29
2
  export declare const useHtmlValidator: () => {
30
3
  validateHtml: (html: string, customFields: DynamicContent[], isOnSaveValidation?: boolean) => Promise<boolean>;
31
4
  };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Heals templates already saved with browser-translate-injected `<font dir="auto">`
3
+ * tags (see {@link stripFontTags}). Runs on load before the block migrators so
4
+ * they operate on clean HTML, and stops the accumulated nesting from
5
+ * re-triggering Chrome's DOM-depth limit when the template is reopened in the
6
+ * editor. Non-translate `<font>` elements are preserved.
7
+ */
8
+ export declare function migrateFontTags(html: string): string;