@useinsider/guido 3.2.0-beta.739a669 → 3.2.0-beta.78d83bd

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 (46) hide show
  1. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +31 -51
  2. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
  3. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +22 -23
  4. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
  5. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +39 -37
  6. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
  7. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +41 -30
  8. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +14 -15
  9. package/dist/composables/useFullStoryBridge.js +14 -0
  10. package/dist/composables/useStripo.js +44 -42
  11. package/dist/config/compiler/unsubscribeCompilerRules.js +40 -37
  12. package/dist/config/compiler/utils/recommendationCompilerUtils.js +33 -30
  13. package/dist/config/migrator/recommendationMigrator.js +1 -1
  14. package/dist/enums/onboarding.js +2 -7
  15. package/dist/enums/unsubscribe.js +34 -27
  16. package/dist/extensions/Blocks/Items/template.js +46 -48
  17. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  18. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
  19. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
  20. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +6 -6
  21. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
  22. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
  23. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
  24. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
  25. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +29 -25
  26. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +11 -11
  27. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
  28. package/dist/guido.css +1 -1
  29. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +324 -219
  30. package/dist/package.json.js +1 -1
  31. package/dist/src/composables/useFullStoryBridge.d.ts +11 -0
  32. package/dist/src/enums/onboarding.d.ts +0 -6
  33. package/dist/src/enums/unsubscribe.d.ts +5 -0
  34. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  35. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
  36. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
  37. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
  38. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
  39. package/dist/src/stores/onboarding.d.ts +0 -4
  40. package/dist/static/styles/components/button.css.js +16 -9
  41. package/dist/static/styles/components/loader.css.js +4 -0
  42. package/dist/static/styles/components/narrow-panel.css.js +52 -0
  43. package/dist/stores/onboarding.js +0 -4
  44. package/package.json +3 -3
  45. package/dist/composables/useRibbonOffset.js +0 -21
  46. package/dist/src/composables/useRibbonOffset.d.ts +0 -4
@@ -1,19 +1,19 @@
1
- import { BlockType as b, BlockAttr as N } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { BlockType as b, BlockAttr as S } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { ItemsBlockId as O } from "./enums/controlEnums.js";
3
- import { productPairs as A, templateFirstLine as C } from "./enums/productEnums.js";
4
- import { ItemInCartOptions as Y, SETTINGS_ENUMS as x, DefaultConfigValues as D } from "./enums/settingsEnums.js";
3
+ import { productPairs as P, templateFirstLine as C } from "./enums/productEnums.js";
4
+ import { ItemInCartOptions as Y, SETTINGS_ENUMS as x, DefaultConfigValues as F } from "./enums/settingsEnums.js";
5
5
  import j from "./layouts/horizontal.html.js";
6
6
  import q from "./layouts/vertical.html.js";
7
7
  import { escapeReplacement as V } from "./utils/nodeConfigUtils.js";
8
- let [g] = A.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [L] = A.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [m] = A.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [S] = A.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [M] = A.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
9
- const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCase().startsWith(e.toLowerCase())).join("; ").replace(/;\s*$/, ""), F = (s) => U(s, "text-align"), w = (s, e) => {
8
+ let [M] = P.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [D] = P.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [N] = P.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [m] = P.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [U] = P.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
9
+ const g = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCase().startsWith(e.toLowerCase())).join("; ").replace(/;\s*$/, ""), L = (s) => g(s, "text-align"), A = (s, e) => {
10
10
  const r = new RegExp(`${e}\\s*:\\s*([^;]+)`, "i"), a = s.match(r);
11
11
  return a ? a[1].trim() : null;
12
12
  }, v = (s, e, r) => new RegExp(`(${e}\\s*:\\s*)[^;]+`, "gi").test(s) ? s.replace(
13
13
  new RegExp(`(${e}\\s*:\\s*)[^;]+`, "gi"),
14
14
  `$1${r}`
15
15
  ) : s, Z = (s, e, r, a) => {
16
- const i = r || D.productImageHeight, n = (a == null ? void 0 : a.imageVisible) === !1 ? "display: none; " : "";
16
+ const i = r || F.productImageHeight, n = (a == null ? void 0 : a.imageVisible) === !1 ? "display: none; " : "";
17
17
  return `
18
18
  <td class="esd-block-image document-node-component default-block-component selectable ng-star-inserted"
19
19
  align="center"
@@ -28,8 +28,7 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
28
28
  href="#!">
29
29
  <img class="adapt-img document-node-component ng-star-inserted"
30
30
  style="object-fit: contain;"
31
- src="${g}"
32
- alt="${L}"
31
+ src="${M}"
33
32
  width="${i}"
34
33
  height="${i}">
35
34
  </a>
@@ -37,11 +36,10 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
37
36
  `;
38
37
  }, J = (s, e) => `
39
38
  <${b.BLOCK_IMAGE}
40
- ${N.BLOCK_IMAGE.src}="${g}"
41
- ${N.BLOCK_IMAGE.alt}="${L}"
42
- ${N.BLOCK_IMAGE.href}="#!"
43
- ${N.BLOCK_IMAGE.width}="${D.productImageWidth}"
44
- ${N.BLOCK_IMAGE.height}="${D.productImageWidth}"
39
+ ${S.BLOCK_IMAGE.src}="${M}"
40
+ ${S.BLOCK_IMAGE.href}="#!"
41
+ ${S.BLOCK_IMAGE.width}="${F.productImageWidth}"
42
+ ${S.BLOCK_IMAGE.height}="${F.productImageWidth}"
45
43
  esd-extension-block-id="${O.IMAGE}"
46
44
  data-slot-1
47
45
  product-attr="imageSrc"
@@ -64,7 +62,7 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
64
62
  text-overflow: ellipsis;
65
63
  `;
66
64
  if (e) {
67
- const c = w(a || "", "text-align") || "center", l = F(a || o), $ = w(l, "color"), t = w(l, "font-size"), E = w(l, "font-family"), _ = w(l, "font-weight"), u = w(l, "font-style"), P = _ === "bold" || _ === "700", p = u === "italic", R = [
65
+ const c = A(a || "", "text-align") || "center", l = L(a || o), $ = A(l, "color"), t = A(l, "font-size"), E = A(l, "font-family"), _ = A(l, "font-weight"), u = A(l, "font-style"), w = _ === "bold" || _ === "700", p = u === "italic", R = [
68
66
  $ ? `color: ${$}` : "",
69
67
  t ? `font-size: ${t}` : "",
70
68
  E ? `font-family: ${E}` : ""
@@ -74,17 +72,17 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
74
72
  "font-size",
75
73
  "inherit"
76
74
  );
77
- d = U(d, "font-weight"), d = U(d, "font-style");
75
+ d = g(d, "font-weight"), d = g(d, "font-style");
78
76
  const T = (i == null ? void 0 : i.nameVisible) === !1 ? "display: none;" : "display: table-cell;";
79
- let h = `<a
77
+ let I = `<a
80
78
  href="#!"
81
79
  style="${d}"
82
80
  product-attr="name"
83
81
  data-slot-2
84
82
  width="100%">
85
- ${L}
83
+ ${D}
86
84
  </a>`;
87
- return P && (h = `<strong>${h}</strong>`), p && (h = `<em>${h}</em>`), `
85
+ return w && (I = `<strong>${I}</strong>`), p && (I = `<em>${I}</em>`), `
88
86
  <td class="esd-block-text es-p10"
89
87
  align="${c}"
90
88
  width="100%"
@@ -92,7 +90,7 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
92
90
  esd-extension-block-id="${O.NAME}"
93
91
  style="${T}">
94
92
  <p contenteditable="false" path="1"${R ? ` style="${R}"` : ""}>
95
- ${h}
93
+ ${I}
96
94
  </p>
97
95
  </td>
98
96
  `;
@@ -124,26 +122,26 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
124
122
  product-attr="name"
125
123
  data-slot-2
126
124
  width="100%">
127
- ${L}
125
+ ${D}
128
126
  </a>
129
127
  </p>
130
128
  </${b.BLOCK_TEXT}>
131
129
  `;
132
130
  }, et = (s, e, r, a, i, n, o, c, l, $) => {
133
- let t = m;
131
+ let t = N;
134
132
  if (a && a.trim()) {
135
133
  const T = `${a.trim()}`;
136
- t = (i || "0") === "1" ? `${m}&nbsp;${T}` : `${T}&nbsp;${m}`;
134
+ t = (i || "0") === "1" ? `${N}&nbsp;${T}` : `${T}&nbsp;${N}`;
137
135
  }
138
- const E = i === "1" ? "after" : "before", _ = `data-formated="${r ? "true" : "false"}"`, u = `data-curency="${E}"`, P = a ? `data-currency_symbol="${a}"` : "", p = `data-single_price="${c ? "true" : "false"}"`, d = l === x.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
136
+ const E = i === "1" ? "after" : "before", _ = `data-formated="${r ? "true" : "false"}"`, u = `data-curency="${E}"`, w = a ? `data-currency_symbol="${a}"` : "", p = `data-single_price="${c ? "true" : "false"}"`, d = l === x.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
139
137
  if (n) {
140
- const I = F(o || "color: #060606; white-space: nowrap; font-size: 20px;"), h = $ ? "" : ' style="display: none;"';
138
+ const h = L(o || "color: #060606; white-space: nowrap; font-size: 20px;"), I = $ ? "" : ' style="display: none;"';
141
139
  return `
142
140
  <td class="esd-block-text items-block-price${d}"
143
141
  align="center"
144
142
  esd-extension-block-id="${O.PRICE}"
145
143
  width="100%"
146
- ${h}>
144
+ ${I}>
147
145
  <p product-attr="price"
148
146
  contenteditable="false"
149
147
  data-slot-4
@@ -151,9 +149,9 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
151
149
  data-number="${e}"
152
150
  ${_}
153
151
  ${u}
154
- ${P}
152
+ ${w}
155
153
  ${p}
156
- style="${I}">
154
+ style="${h}">
157
155
  ${t}
158
156
  </p>
159
157
  </td>`;
@@ -181,19 +179,19 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
181
179
  </${b.BLOCK_TEXT}>
182
180
  `;
183
181
  }, at = (s, e, r, a, i, n, o = !0, c, l, $) => {
184
- let t = S;
182
+ let t = m;
185
183
  if (a && a.trim()) {
186
184
  const T = `${a.trim()}`;
187
- t = (i || "0") === "1" ? `${S}&nbsp;${T}` : `${T}&nbsp;${S}`;
185
+ t = (i || "0") === "1" ? `${m}&nbsp;${T}` : `${T}&nbsp;${m}`;
188
186
  }
189
- const E = i === "1" ? "after" : "before", _ = `data-formated="${r ? "true" : "false"}"`, u = `data-curency="${E}"`, P = o ? "" : ' style="display: none;"', p = `data-single_price="${l ? "true" : "false"}"`, d = $ === x.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
187
+ const E = i === "1" ? "after" : "before", _ = `data-formated="${r ? "true" : "false"}"`, u = `data-curency="${E}"`, w = o ? "" : ' style="display: none;"', p = `data-single_price="${l ? "true" : "false"}"`, d = $ === x.ORIENTATION.VERTICAL ? " es-p10b es-p10t" : "";
190
188
  if (n) {
191
- const I = F(c || "color: #cc0000; white-space: nowrap; font-size: 19px;");
189
+ const h = L(c || "color: #cc0000; white-space: nowrap; font-size: 19px;");
192
190
  return `
193
191
  <td class="esd-block-text items-block-price${d}"
194
192
  esd-extension-block-id="${O.ORIGINAL_PRICE}"
195
193
  width="100%"
196
- align="center"${P}>
194
+ align="center"${w}>
197
195
  <p
198
196
  product-attr="originalPrice"
199
197
  contenteditable="false"
@@ -204,7 +202,7 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
204
202
  ${u}
205
203
  ${a ? `data-currency_symbol="${a}"` : ""}
206
204
  ${p}
207
- style="${I}">
205
+ style="${h}">
208
206
  <s>${t}</s>
209
207
  </p>
210
208
  </td>
@@ -237,7 +235,7 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
237
235
  }, st = (s = !0, e, r) => {
238
236
  const a = s ? "" : 'style="display: none;"';
239
237
  if (e) {
240
- const i = "font-size: 14px;", n = w(r || "", "text-align") || "center", o = F(r || i);
238
+ const i = "font-size: 14px;", n = A(r || "", "text-align") || "center", o = L(r || i);
241
239
  return `
242
240
  <td class="esd-block-text es-p10 document-node-component default-block-component selectable"
243
241
  width="100%" align="${n}"
@@ -249,7 +247,7 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
249
247
  width="100%"
250
248
  path="1"
251
249
  style="${o}">
252
- ${M}
250
+ ${U}
253
251
  </p>
254
252
  </td>`;
255
253
  }
@@ -266,13 +264,13 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
266
264
  data-slot-3
267
265
  contenteditable="false"
268
266
  width="100%">
269
- ${M}
267
+ ${U}
270
268
  </p>
271
269
  </${b.BLOCK_TEXT}>
272
270
  `;
273
271
  }, lt = (s, e, r = "Buy", a, i, n = !0, o = !0) => {
274
272
  if (a) {
275
- const c = w(i || "", "background") || w(i || "", "background-color"), l = c ? `border-width: 0px; background: ${c};` : "border-width: 0px;", $ = n ? "es-fw" : "es-il", t = (i || "").replace("border-width: 0;", "");
273
+ const c = A(i || "", "background") || A(i || "", "background-color"), l = c ? `border-width: 0px; background: ${c};` : "border-width: 0px;", $ = n ? "es-fw" : "es-il", t = (i || "").replace("border-width: 0;", "");
276
274
  return `
277
275
  <td class="esd-block-button ins-button default-block-component selectable"
278
276
  align="center" width="100%" name="buy-button" caption="${r}"
@@ -328,10 +326,10 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
328
326
  }, it = (s) => s ? `<td align="center"
329
327
  esd-extension-block-id="items-block" width="560"
330
328
  data-number="4"
331
- class="ins-product-td items-block items-block-v2 esd-items-block esd-extension-block esd-container-frame">` : C, z = (s, e, r, a, i, n, o, c, l, $, t, E, _, u = "horizontal", P, p, R, d) => {
332
- const h = `${`data-type="${e}" data-number="${r}"`} data-orientation="${a}"`, y = s.replace(
329
+ class="ins-product-td items-block items-block-v2 esd-items-block esd-extension-block esd-container-frame">` : C, z = (s, e, r, a, i, n, o, c, l, $, t, E, _, u = "horizontal", w, p, R, d) => {
330
+ const I = `${`data-type="${e}" data-number="${r}"`} data-orientation="${a}"`, y = s.replace(
333
331
  /<td([^>]*class="[^"]*ins-product-td[^"]*"[^>]*)>/,
334
- `<td$1 ${h}>`
332
+ `<td$1 ${I}>`
335
333
  ), X = l == null ? void 0 : l["data-product_image_control_image-height"], G = n ? Z(e, r, X, t) : J(e, r), K = (t == null ? void 0 : t.buttonLabel) || "Buy", B = (t == null ? void 0 : t.buttonFullWidth) !== void 0 ? t.buttonFullWidth : !0, W = e === x.ITEMS_TYPE.BROWSED_ITEMS ? !1 : t == null ? void 0 : t.quantityControlEnabled, Q = (t == null ? void 0 : t.buttonVisible) !== void 0 ? t.buttonVisible : (l == null ? void 0 : l["data-product_button_control_enabled"]) !== "false", k = (t == null ? void 0 : t.priceVisible) !== void 0 ? t.priceVisible : (l == null ? void 0 : l["data-product_price_control_enabled"]) !== "false", f = (t == null ? void 0 : t.originalPriceVisible) !== void 0 ? t.originalPriceVisible : (l == null ? void 0 : l["data-product_original_price_control_enabled"]) !== "false", H = y.replace("{-{-TEMPLATE_FIRST_LINE-}-}", it(n)).replace("{-{-PRODUCT_IMAGE-}-}", G).replace("{-{-PRODUCT_NAME-}-}", tt(e, n, a, E, t)).replaceAll(
336
334
  "{-{-PRODUCT_PRICE-}-}",
337
335
  V(et(
@@ -341,7 +339,7 @@ const U = (s, e) => s.split(";").map((r) => r.trim()).filter((r) => !r.toLowerCa
341
339
  o,
342
340
  c,
343
341
  n,
344
- P,
342
+ w,
345
343
  d,
346
344
  a,
347
345
  k
@@ -387,7 +385,7 @@ function Tt({
387
385
  priceStyles: E,
388
386
  originalPriceStyles: _,
389
387
  quantityStyles: u,
390
- priceOrientation: P
388
+ priceOrientation: w
391
389
  }) {
392
390
  const p = Y[e].findIndex((y) => y.value === r);
393
391
  let R = "1";
@@ -398,10 +396,10 @@ function Tt({
398
396
  y && y[1] && ([, R] = y);
399
397
  }
400
398
  const d = (l == null ? void 0 : l.priceSinglePrice) ?? (c == null ? void 0 : c["data-product_price_control_single_price"]) === "1" ?? !1;
401
- g = A.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[p >= 0 ? p : 0], L = A.PAIRS_FOR_EXTENSION.name[e].DEFAULT[p >= 0 ? p : 0];
402
- const T = A.PAIRS_FOR_EXTENSION.price[e], I = A.PAIRS_FOR_EXTENSION.originalPrice[e];
403
- d ? (m = o ? T.DEFAULT_SINGLE_PRICE_FORMATTED : T.DEFAULT_SINGLE_PRICE, S = o ? I.DEFAULT_SINGLE_PRICE_FORMATTED : I.DEFAULT_SINGLE_PRICE) : (m = o ? T.DEFAULT_PRICE_FORMATTED : T.DEFAULT_PRICE, S = o ? I.DEFAULT_PRICE_FORMATTED : I.DEFAULT_PRICE), M = A.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT;
404
- const h = P || (l == null ? void 0 : l.priceOrientation) || "horizontal";
399
+ M = P.PAIRS_FOR_EXTENSION.imageSrc[e].DEFAULT[p >= 0 ? p : 0], D = P.PAIRS_FOR_EXTENSION.name[e].DEFAULT[p >= 0 ? p : 0];
400
+ const T = P.PAIRS_FOR_EXTENSION.price[e], h = P.PAIRS_FOR_EXTENSION.originalPrice[e];
401
+ d ? (N = o ? T.DEFAULT_SINGLE_PRICE_FORMATTED : T.DEFAULT_SINGLE_PRICE, m = o ? h.DEFAULT_SINGLE_PRICE_FORMATTED : h.DEFAULT_SINGLE_PRICE) : (N = o ? T.DEFAULT_PRICE_FORMATTED : T.DEFAULT_PRICE, m = o ? h.DEFAULT_PRICE_FORMATTED : h.DEFAULT_PRICE), U = P.PAIRS_FOR_EXTENSION.quantity[e].DEFAULT;
402
+ const I = w || (l == null ? void 0 : l.priceOrientation) || "horizontal";
405
403
  return s === x.ORIENTATION.VERTICAL ? z(
406
404
  q,
407
405
  e,
@@ -417,7 +415,7 @@ function Tt({
417
415
  l,
418
416
  $,
419
417
  t,
420
- h,
418
+ I,
421
419
  E,
422
420
  _,
423
421
  u,
@@ -437,7 +435,7 @@ function Tt({
437
435
  l,
438
436
  $,
439
437
  t,
440
- h,
438
+ I,
441
439
  E,
442
440
  _,
443
441
  u,
@@ -1,4 +1,4 @@
1
- var o = /* @__PURE__ */ ((c) => (c.BUTTON_ALIGN = "recommendation-block-button-align-control", c.BUTTON_BORDER = "recommendation-block-button-border-control", c.BUTTON_BORDER_RADIUS = "recommendation-block-button-border-radius-control", c.BUTTON_COLOR = "recommendation-block-button-color-control", c.BUTTON_FIT_TO_CONTENT = "recommendation-block-button-fit-to-content-control", c.BUTTON_FONT_FAMILY = "recommendation-block-button-font-family-control", c.BUTTON_MARGINS = "recommendation-block-button-margins-control", c.BUTTON_PADDINGS = "recommendation-block-button-paddings-control", c.BUTTON_TEXT = "recommendation-block-button-text-control", c.BUTTON_TEXT_SIZE = "recommendation-block-button-text-size-control", c.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "recommendation-block-button-text-style-and-font-color-control", c.NAME_ALIGN = "recommendation-block-name-align-control", c.NAME_BACKGROUND = "recommendation-block-name-background-control", c.NAME_COLOR = "recommendation-block-name-color-control", c.NAME_FONT_FAMILY = "recommendation-block-name-font-family-control", c.NAME_PADDINGS = "recommendation-block-name-paddings-control", c.NAME_SIZE = "recommendation-block-name-size-control", c.NAME_STYLE = "recommendation-block-name-style-control", c.NAME_TEXT_TRIM = "recommendation-block-name-text-trim-control", c.PRICE_ALIGN = "recommendation-block-price-align-control", c.PRICE_BACKGROUND = "recommendation-block-price-background-control", c.PRICE_COLOR = "recommendation-block-price-color-control", c.PRICE_FONT_FAMILY = "recommendation-block-price-font-family-control", c.PRICE_PADDINGS = "recommendation-block-price-paddings-control", c.PRICE_SIZE = "recommendation-block-price-size-control", c.PRICE_STYLE = "recommendation-block-price-style-control", c.OLD_PRICE_ALIGN = "recommendation-block-old-price-align-control", c.OLD_PRICE_BACKGROUND = "recommendation-block-old-price-background-control", c.OLD_PRICE_COLOR = "recommendation-block-old-price-color-control", c.OLD_PRICE_FONT_FAMILY = "recommendation-block-old-price-font-family-control", c.OLD_PRICE_PADDINGS = "recommendation-block-old-price-paddings-control", c.OLD_PRICE_SIZE = "recommendation-block-old-price-size-control", c.OLD_PRICE_STYLE = "recommendation-block-old-price-style-control", c.OMNIBUS_PRICE_ALIGN = "recommendation-block-omnibus-price-align-control", c.OMNIBUS_PRICE_BACKGROUND = "recommendation-block-omnibus-price-background-control", c.OMNIBUS_PRICE_COLOR = "recommendation-block-omnibus-price-color-control", c.OMNIBUS_PRICE_FONT_FAMILY = "recommendation-block-omnibus-price-font-family-control", c.OMNIBUS_PRICE_PADDINGS = "recommendation-block-omnibus-price-paddings-control", c.OMNIBUS_PRICE_SIZE = "recommendation-block-omnibus-price-size-control", c.OMNIBUS_PRICE_STYLE = "recommendation-block-omnibus-price-style-control", c.OMNIBUS_PRICE_TEXT_BEFORE = "recommendation-block-omnibus-price-text-before-control", c.OMNIBUS_PRICE_TEXT_AFTER = "recommendation-block-omnibus-price-text-after-control", c.OMNIBUS_DISCOUNT_ALIGN = "recommendation-block-omnibus-discount-align-control", c.OMNIBUS_DISCOUNT_BACKGROUND = "recommendation-block-omnibus-discount-background-control", c.OMNIBUS_DISCOUNT_COLOR = "recommendation-block-omnibus-discount-color-control", c.OMNIBUS_DISCOUNT_FONT_FAMILY = "recommendation-block-omnibus-discount-font-family-control", c.OMNIBUS_DISCOUNT_PADDINGS = "recommendation-block-omnibus-discount-paddings-control", c.OMNIBUS_DISCOUNT_SIZE = "recommendation-block-omnibus-discount-size-control", c.OMNIBUS_DISCOUNT_STYLE = "recommendation-block-omnibus-discount-style-control", c.OMNIBUS_DISCOUNT_TEXT_BEFORE = "recommendation-block-omnibus-discount-text-before-control", c.OMNIBUS_DISCOUNT_TEXT_AFTER = "recommendation-block-omnibus-discount-text-after-control", c.IMAGE_SIZE = "recommendation-block-image-size-control", c.IMAGE_MARGINS = "recommendation-block-image-margins-control", c.CUSTOM_ATTR_ALIGN = "recommendation-block-custom-attr-align-control", c.CUSTOM_ATTR_BACKGROUND = "recommendation-block-custom-attr-background-control", c.CUSTOM_ATTR_COLOR = "recommendation-block-custom-attr-color-control", c.CUSTOM_ATTR_FONT_FAMILY = "recommendation-block-custom-attr-font-family-control", c.CUSTOM_ATTR_PADDINGS = "recommendation-block-custom-attr-paddings-control", c.CUSTOM_ATTR_SIZE = "recommendation-block-custom-attr-size-control", c.CUSTOM_ATTR_STYLE = "recommendation-block-custom-attr-style-control", c.SYNC_INFO_MESSAGE = "recommendation-block-sync-info-message", c))(o || {});
1
+ var o = /* @__PURE__ */ ((c) => (c.BUTTON_ALIGN = "recommendation-block-button-align-control", c.BUTTON_BORDER = "recommendation-block-button-border-control", c.BUTTON_BORDER_RADIUS = "recommendation-block-button-border-radius-control", c.BUTTON_COLOR = "recommendation-block-button-color-control", c.BUTTON_FIT_TO_CONTENT = "recommendation-block-button-fit-to-content-control", c.BUTTON_FONT_FAMILY = "recommendation-block-button-font-family-control", c.BUTTON_MARGINS = "recommendation-block-button-margins-control", c.BUTTON_PADDINGS = "recommendation-block-button-paddings-control", c.BUTTON_TEXT = "recommendation-block-button-text-control", c.BUTTON_TEXT_SIZE = "recommendation-block-button-text-size-control", c.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "recommendation-block-button-text-style-and-font-color-control", c.NAME_ALIGN = "recommendation-block-name-align-control", c.NAME_BACKGROUND = "recommendation-block-name-background-control", c.NAME_COLOR = "recommendation-block-name-color-control", c.NAME_FONT_FAMILY = "recommendation-block-name-font-family-control", c.NAME_PADDINGS = "recommendation-block-name-paddings-control", c.NAME_SIZE = "recommendation-block-name-size-control", c.NAME_STYLE = "recommendation-block-name-style-control", c.NAME_TEXT_TRIM = "recommendation-block-name-text-trim-control", c.PRICE_ALIGN = "recommendation-block-price-align-control", c.PRICE_BACKGROUND = "recommendation-block-price-background-control", c.PRICE_COLOR = "recommendation-block-price-color-control", c.PRICE_FONT_FAMILY = "recommendation-block-price-font-family-control", c.PRICE_PADDINGS = "recommendation-block-price-paddings-control", c.PRICE_SIZE = "recommendation-block-price-size-control", c.PRICE_STYLE = "recommendation-block-price-style-control", c.OLD_PRICE_ALIGN = "recommendation-block-old-price-align-control", c.OLD_PRICE_BACKGROUND = "recommendation-block-old-price-background-control", c.OLD_PRICE_COLOR = "recommendation-block-old-price-color-control", c.OLD_PRICE_FONT_FAMILY = "recommendation-block-old-price-font-family-control", c.OLD_PRICE_PADDINGS = "recommendation-block-old-price-paddings-control", c.OLD_PRICE_SIZE = "recommendation-block-old-price-size-control", c.OLD_PRICE_STYLE = "recommendation-block-old-price-style-control", c.OMNIBUS_PRICE_ALIGN = "recommendation-block-omnibus-price-align-control", c.OMNIBUS_PRICE_BACKGROUND = "recommendation-block-omnibus-price-background-control", c.OMNIBUS_PRICE_COLOR = "recommendation-block-omnibus-price-color-control", c.OMNIBUS_PRICE_FONT_FAMILY = "recommendation-block-omnibus-price-font-family-control", c.OMNIBUS_PRICE_PADDINGS = "recommendation-block-omnibus-price-paddings-control", c.OMNIBUS_PRICE_SIZE = "recommendation-block-omnibus-price-size-control", c.OMNIBUS_PRICE_STYLE = "recommendation-block-omnibus-price-style-control", c.OMNIBUS_PRICE_TEXT_BEFORE = "recommendation-block-omnibus-price-text-before-control", c.OMNIBUS_PRICE_TEXT_AFTER = "recommendation-block-omnibus-price-text-after-control", c.OMNIBUS_DISCOUNT_ALIGN = "recommendation-block-omnibus-discount-align-control", c.OMNIBUS_DISCOUNT_BACKGROUND = "recommendation-block-omnibus-discount-background-control", c.OMNIBUS_DISCOUNT_COLOR = "recommendation-block-omnibus-discount-color-control", c.OMNIBUS_DISCOUNT_FONT_FAMILY = "recommendation-block-omnibus-discount-font-family-control", c.OMNIBUS_DISCOUNT_PADDINGS = "recommendation-block-omnibus-discount-paddings-control", c.OMNIBUS_DISCOUNT_SIZE = "recommendation-block-omnibus-discount-size-control", c.OMNIBUS_DISCOUNT_STYLE = "recommendation-block-omnibus-discount-style-control", c.OMNIBUS_DISCOUNT_TEXT_BEFORE = "recommendation-block-omnibus-discount-text-before-control", c.OMNIBUS_DISCOUNT_TEXT_AFTER = "recommendation-block-omnibus-discount-text-after-control", c.IMAGE_SIZE = "recommendation-block-image-size-control", c.IMAGE_MARGINS = "recommendation-block-image-margins-control", c.CUSTOM_ATTR_ALIGN = "recommendation-block-custom-attr-align-control", c.CUSTOM_ATTR_BACKGROUND = "recommendation-block-custom-attr-background-control", c.CUSTOM_ATTR_COLOR = "recommendation-block-custom-attr-color-control", c.CUSTOM_ATTR_FONT_FAMILY = "recommendation-block-custom-attr-font-family-control", c.CUSTOM_ATTR_PADDINGS = "recommendation-block-custom-attr-paddings-control", c.CUSTOM_ATTR_SIZE = "recommendation-block-custom-attr-size-control", c.CUSTOM_ATTR_STYLE = "recommendation-block-custom-attr-style-control", c.CUSTOM_ATTR_TEXT_TRIM = "recommendation-block-custom-attr-text-trim-control", c.SYNC_INFO_MESSAGE = "recommendation-block-sync-info-message", c))(o || {});
2
2
  export {
3
3
  o as RecommendationControlId
4
4
  };
@@ -1,21 +1,22 @@
1
- import { TextPaddingsBuiltInControl as d, ButtonBackgroundColorBuiltInControl as c, TextFontFamilyBuiltInControl as u, TextStyleBuiltInControl as i, TextSizeBuiltInControl as C, TextColorBuiltInControl as g, TextAlignBuiltInControl as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { TextPaddingsBuiltInControl as d, ButtonBackgroundColorBuiltInControl as i, TextFontFamilyBuiltInControl as u, TextStyleBuiltInControl as c, TextSizeBuiltInControl as C, TextColorBuiltInControl as g, TextAlignBuiltInControl as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { RecommendationBlockId as l } from "../../constants/blockIds.js";
3
3
  import { RecommendationControlId as e } from "../../constants/controlIds.js";
4
- import { BLOCK_ROOT_SELECTOR as I, ATTR_PRODUCT_ATTR as s } from "../../constants/selectors.js";
4
+ import { BLOCK_ROOT_SELECTOR as A, ATTR_PRODUCT_ATTR as s } from "../../constants/selectors.js";
5
+ import { CustomAttributeTextTrimControl as I } from "./textTrim.js";
5
6
  function o(t) {
6
- const n = t.closest(I);
7
- if (!n)
7
+ const r = t.closest(A);
8
+ if (!r)
8
9
  return [];
9
- const r = t.asElement().getAttribute(s);
10
- if (r) {
11
- const T = `[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"][${s}="${r}"]`;
12
- return n.querySelectorAll(T);
10
+ const n = t.asElement().getAttribute(s);
11
+ if (n) {
12
+ const T = `[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"][${s}="${n}"]`;
13
+ return r.querySelectorAll(T);
13
14
  }
14
- return n.querySelectorAll(
15
+ return r.querySelectorAll(
15
16
  `[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"]`
16
17
  );
17
18
  }
18
- const A = class extends a {
19
+ const m = class extends a {
19
20
  getId() {
20
21
  return e.CUSTOM_ATTR_ALIGN;
21
22
  }
@@ -36,7 +37,7 @@ const A = class extends a {
36
37
  getTargetNodes(t) {
37
38
  return o(t);
38
39
  }
39
- }, m = class extends i {
40
+ }, x = class extends c {
40
41
  getId() {
41
42
  return e.CUSTOM_ATTR_STYLE;
42
43
  }
@@ -50,29 +51,31 @@ const A = class extends a {
50
51
  getTargetNodes(t) {
51
52
  return o(t);
52
53
  }
53
- }, R = class extends c {
54
+ }, R = class extends i {
54
55
  getId() {
55
56
  return e.CUSTOM_ATTR_BACKGROUND;
56
57
  }
57
58
  getTargetNodes(t) {
58
59
  return o(t);
59
60
  }
60
- }, x = class extends d {
61
+ }, B = class extends d {
61
62
  getId() {
62
63
  return e.CUSTOM_ATTR_PADDINGS;
63
64
  }
64
65
  getTargetNodes(t) {
65
66
  return o(t);
66
67
  }
67
- }, k = {
68
- align: A,
68
+ }, p = {
69
+ align: m,
69
70
  color: _,
70
71
  size: S,
71
- style: m,
72
+ style: x,
72
73
  fontFamily: O,
73
74
  background: R,
74
- paddings: x
75
+ paddings: B,
76
+ textTrim: I
75
77
  };
76
78
  export {
77
- k as CustomAttributeControls
79
+ p as CustomAttributeControls,
80
+ I as CustomAttributeTextTrimControl
78
81
  };
@@ -0,0 +1,99 @@
1
+ import { ModificationDescription as T } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as m } from "../../../common-control.js";
3
+ import { RecommendationBlockId as n } from "../../constants/blockIds.js";
4
+ import { RecommendationControlId as l } from "../../constants/controlIds.js";
5
+ import { BLOCK_ROOT_SELECTOR as u, ATTR_PRODUCT_ATTR as a } from "../../constants/selectors.js";
6
+ import { CSS_CLASS_TEXT_TRIM as o, ensureTextTrimCssRulesExist as c } from "../shared/textTrimCssRules.js";
7
+ const i = {
8
+ TEXT_TRIM_ENABLED: "customAttrTextTrimEnabled"
9
+ };
10
+ class g extends m {
11
+ getId() {
12
+ return l.CUSTOM_ATTR_TEXT_TRIM;
13
+ }
14
+ getTemplate() {
15
+ return `
16
+ <hr style="margin: 0; border: none; border-top: 1px solid #e0e0e0;" />
17
+ <div class="custom-attr-text-trim-control-container">
18
+ ${this._GuTwoColumns([
19
+ this._GuLabel({ text: this.api.translate("Trim Long Text") }),
20
+ this._GuToggle(i.TEXT_TRIM_ENABLED)
21
+ ])}
22
+ </div>
23
+ `;
24
+ }
25
+ onRender() {
26
+ this._setFormValues(), this._listenToFormUpdates();
27
+ }
28
+ onTemplateNodeUpdated(t) {
29
+ super.onTemplateNodeUpdated(t), this._setFormValues();
30
+ }
31
+ // ========================================================================
32
+ // State Reading
33
+ // ========================================================================
34
+ _setFormValues() {
35
+ this.api.updateValues({
36
+ [i.TEXT_TRIM_ENABLED]: this._getCurrentTrimState()
37
+ });
38
+ }
39
+ _getCurrentTrimState() {
40
+ if (!this.currentNode || !("hasClass" in this.currentNode))
41
+ return !1;
42
+ if (this.currentNode.hasClass(o))
43
+ return !0;
44
+ const t = this._getTargetElements();
45
+ return t.length > 0 && "hasClass" in t[0] ? t[0].hasClass(o) : !1;
46
+ }
47
+ // ========================================================================
48
+ // Target Element Discovery (per-attribute scoping)
49
+ // ========================================================================
50
+ /**
51
+ * Finds all custom attribute elements of the same type as the current node.
52
+ *
53
+ * Similar to getCustomAttrTargetNodes in customAttribute/index.ts, but adapted
54
+ * for CommonControl lifecycle where currentNode is a class property (not a
55
+ * parameter from Stripo's getTargetNodes override).
56
+ */
57
+ _getTargetElements() {
58
+ if (!this.currentNode || !("closest" in this.currentNode))
59
+ return [];
60
+ const t = this.currentNode.closest(u);
61
+ if (!t)
62
+ return [];
63
+ const e = "asElement" in this.currentNode ? this.currentNode.asElement().getAttribute(a) : null;
64
+ if (e) {
65
+ const s = `[esd-extension-block-id="${n.CUSTOM_ATTRIBUTE}"][${a}="${e}"]`;
66
+ return Array.from(t.querySelectorAll(s));
67
+ }
68
+ return Array.from(
69
+ t.querySelectorAll(
70
+ `[esd-extension-block-id="${n.CUSTOM_ATTRIBUTE}"]`
71
+ )
72
+ );
73
+ }
74
+ // ========================================================================
75
+ // Toggle Handler
76
+ // ========================================================================
77
+ _onTextTrimChange(t) {
78
+ const e = this._getTargetElements();
79
+ if (!e.length)
80
+ return;
81
+ t && c(this.api);
82
+ const r = this.api.getDocumentModifier();
83
+ e.forEach((s) => {
84
+ t ? r.modifyHtml(s).setClass(o) : r.modifyHtml(s).removeClass(o);
85
+ }), r.apply(
86
+ new T(
87
+ t ? "Enable custom attribute text trimming" : "Disable custom attribute text trimming"
88
+ )
89
+ );
90
+ }
91
+ _listenToFormUpdates() {
92
+ this.api.onValueChanged(i.TEXT_TRIM_ENABLED, (t) => {
93
+ this._onTextTrimChange(t);
94
+ });
95
+ }
96
+ }
97
+ export {
98
+ g as CustomAttributeTextTrimControl
99
+ };
@@ -1,7 +1,7 @@
1
- var c = Object.defineProperty;
2
- var h = (s, i, t) => i in s ? c(s, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[i] = t;
3
- var a = (s, i, t) => h(s, typeof i != "symbol" ? i + "" : i, t);
4
- import { UEAttr as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ var l = Object.defineProperty;
2
+ var c = (s, i, t) => i in s ? l(s, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[i] = t;
3
+ var a = (s, i, t) => c(s, typeof i != "symbol" ? i + "" : i, t);
4
+ import { UEAttr as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as d } from "../../../common-control.js";
6
6
  import { RecommendationConfigService as n } from "../../services/configService.js";
7
7
  import { useRecommendationExtensionStore as m } from "../../store/recommendation.js";
@@ -42,7 +42,7 @@ class T extends d {
42
42
  this._initializeSelectItems(), this._setFormValues(), this._listenToFormUpdates();
43
43
  }
44
44
  onTemplateNodeUpdated(t) {
45
- super.onTemplateNodeUpdated(t), this._setFormValues();
45
+ super.onTemplateNodeUpdated(t), this._initializeSelectItems(), this._setFormValues();
46
46
  }
47
47
  _setFormValues() {
48
48
  const t = n.getConfig(this.currentNode);
@@ -58,7 +58,7 @@ class T extends d {
58
58
  try {
59
59
  this.api.setUIEAttribute(
60
60
  e.ALGORITHM,
61
- l.SELECTPICKER.items,
61
+ h.SELECTPICKER.items,
62
62
  t
63
63
  );
64
64
  } catch (r) {
@@ -114,7 +114,9 @@ class H extends g {
114
114
  var r;
115
115
  super.onTemplateNodeUpdated(t);
116
116
  const e = this._getRecommendationIdFromNode(t);
117
- e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), this._syncNodeConfigToStore(), e !== null && !((r = this.store.blockStates[e]) != null && r.isInitialized) && this._fetchBlockData(e), [
117
+ e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), e !== null && this._syncNodeConfigToStore(), e !== null && !((r = this.store.blockStates[e]) != null && r.isInitialized) && this._fetchBlockData(e).then(() => {
118
+ this._initializeSubControls();
119
+ }), [
118
120
  this.layoutOrientationControl,
119
121
  this.productCountControl,
120
122
  this.algorithmControl,
@@ -1,14 +1,15 @@
1
- import { ModificationDescription as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as d } from "../../../common-control.js";
3
- import { RecommendationBlockId as l } from "../../constants/blockIds.js";
4
- import { RecommendationControlId as m } from "../../constants/controlIds.js";
5
- import { BLOCK_ROOT_SELECTOR as u } from "../../constants/selectors.js";
6
- const i = {
1
+ import { ModificationDescription as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as u } from "../../../common-control.js";
3
+ import { RecommendationBlockId as a } from "../../constants/blockIds.js";
4
+ import { RecommendationControlId as d } from "../../constants/controlIds.js";
5
+ import { BLOCK_ROOT_SELECTOR as m } from "../../constants/selectors.js";
6
+ import { CSS_CLASS_TEXT_TRIM as r, ensureTextTrimCssRulesExist as T } from "../shared/textTrimCssRules.js";
7
+ const s = {
7
8
  TEXT_TRIM_ENABLED: "textTrimEnabled"
8
- }, o = "text-trim-enabled", c = `.${o}`, T = `.${o} p`, p = `.${o} { max-width: 0; }`, _ = `.${o} p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; display: block; }`;
9
- class N extends d {
9
+ };
10
+ class N extends u {
10
11
  getId() {
11
- return m.NAME_TEXT_TRIM;
12
+ return d.NAME_TEXT_TRIM;
12
13
  }
13
14
  getTemplate() {
14
15
  return `
@@ -16,7 +17,7 @@ class N extends d {
16
17
  <div class="name-text-trim-control-container">
17
18
  ${this._GuTwoColumns([
18
19
  this._GuLabel({ text: this.api.translate("Trim Long Text") }),
19
- this._GuToggle(i.TEXT_TRIM_ENABLED)
20
+ this._GuToggle(s.TEXT_TRIM_ENABLED)
20
21
  ])}
21
22
  </div>
22
23
  `;
@@ -30,76 +31,45 @@ class N extends d {
30
31
  _setFormValues() {
31
32
  const e = this._getCurrentTrimState();
32
33
  this.api.updateValues({
33
- [i.TEXT_TRIM_ENABLED]: e
34
+ [s.TEXT_TRIM_ENABLED]: e
34
35
  });
35
36
  }
36
37
  _getCurrentTrimState() {
37
38
  if (!this.currentNode || !("hasClass" in this.currentNode))
38
39
  return !1;
39
- if (this.currentNode.hasClass(o))
40
+ if (this.currentNode.hasClass(r))
40
41
  return !0;
41
- const e = this.currentNode.closest(u);
42
+ const e = this.currentNode.closest(m);
42
43
  if (!e)
43
44
  return !1;
44
45
  const t = e.querySelector(
45
- `[esd-extension-block-id="${l.NAME}"]`
46
+ `[esd-extension-block-id="${a.NAME}"]`
46
47
  );
47
- return t && "hasClass" in t ? t.hasClass(o) : !1;
48
- }
49
- /**
50
- * Finds an existing CSS rule in the document stylesheet by exact query
51
- * @param query - The CSS query to search for (uses Stripo's CSS query syntax)
52
- * @returns The CSS rule node if found, undefined otherwise
53
- */
54
- _findCssRule(e) {
55
- const t = this.api.getDocumentRootCssNode();
56
- if (t)
57
- return t.querySelector(e);
58
- }
59
- /**
60
- * Finds the .text-trim-enabled p rule by searching all text-trim rules and comparing selectors
61
- * This is needed because Stripo's CSS query syntax interprets spaces as path separators
62
- * @returns true if the rule exists
63
- */
64
- _hasParagraphRule() {
65
- const e = this.api.getDocumentRootCssNode();
66
- return e ? e.querySelectorAll(`*${o}`).some((s) => "getSelector" in s && typeof s.getSelector == "function" ? s.getSelector() === T : !1) : !1;
67
- }
68
- /**
69
- * Ensures the text-trim CSS rules exist in the document stylesheet
70
- * Only adds rules if they don't already exist (prevents duplicates across multiple blocks)
71
- */
72
- _ensureCssRulesExist() {
73
- const e = this.api.getDocumentRootCssNode();
74
- if (!e)
75
- return;
76
- const t = this.api.getDocumentModifier();
77
- let s = !1;
78
- this._findCssRule(c) || (t.modifyCss(e).appendRule(p), s = !0), this._hasParagraphRule() || (t.modifyCss(e).appendRule(_), s = !0), s && t.apply(new a("Add text trim CSS rules"));
48
+ return t && "hasClass" in t ? t.hasClass(r) : !1;
79
49
  }
80
50
  _onTextTrimChange(e) {
81
51
  if (!this.currentNode || !("closest" in this.currentNode))
82
52
  return;
83
- const t = this.currentNode.closest(u);
53
+ const t = this.currentNode.closest(m);
84
54
  if (!t || !("querySelectorAll" in t))
85
55
  return;
86
- const s = Array.from(
87
- t.querySelectorAll(`[esd-extension-block-id="${l.NAME}"]`)
56
+ const i = Array.from(
57
+ t.querySelectorAll(`[esd-extension-block-id="${a.NAME}"]`)
88
58
  );
89
- if (!s.length)
59
+ if (!i.length)
90
60
  return;
91
- e && this._ensureCssRulesExist();
92
- const r = this.api.getDocumentModifier();
93
- s.forEach((n) => {
94
- e ? r.modifyHtml(n).setClass(o) : r.modifyHtml(n).removeClass(o);
95
- }), r.apply(
96
- new a(
61
+ e && T(this.api);
62
+ const o = this.api.getDocumentModifier();
63
+ i.forEach((n) => {
64
+ e ? o.modifyHtml(n).setClass(r) : o.modifyHtml(n).removeClass(r);
65
+ }), o.apply(
66
+ new l(
97
67
  e ? "Enable product name text trimming" : "Disable product name text trimming"
98
68
  )
99
69
  );
100
70
  }
101
71
  _listenToFormUpdates() {
102
- this.api.onValueChanged(i.TEXT_TRIM_ENABLED, (e) => {
72
+ this.api.onValueChanged(s.TEXT_TRIM_ENABLED, (e) => {
103
73
  this._onTextTrimChange(e);
104
74
  });
105
75
  }