@useinsider/guido 3.17.0-beta.db80c84 → 3.17.0-beta.ddd4dde

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 (43) hide show
  1. package/README.md +5 -5
  2. package/dist/composables/useStripo.js +14 -14
  3. package/dist/config/migrator/index.js +8 -9
  4. package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
  5. package/dist/config/migrator/recommendation/extractors.js +24 -29
  6. package/dist/config/migrator/recommendation/htmlBuilder.js +130 -116
  7. package/dist/config/migrator/recommendationMigrator.js +15 -18
  8. package/dist/extensions/Blocks/Items/block.js +98 -49
  9. package/dist/extensions/Blocks/Items/constants/currency.js +11 -0
  10. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
  11. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
  12. package/dist/extensions/Blocks/Items/template.js +153 -152
  13. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  14. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  15. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +22 -23
  16. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +28 -34
  17. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +238 -306
  18. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +8 -9
  19. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +0 -1
  20. package/dist/extensions/Blocks/Recommendation/extension.js +29 -31
  21. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +4 -23
  22. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
  23. package/dist/extensions/Blocks/Recommendation/templates/utils.js +107 -85
  24. package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -8
  25. package/dist/src/extensions/Blocks/Items/block.d.ts +21 -0
  26. package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +19 -0
  27. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +1 -2
  28. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +0 -7
  29. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -1
  30. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  31. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -10
  32. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +0 -10
  33. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +0 -1
  34. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -1
  35. package/dist/static/styles/customEditorStyle.css.js +1 -3
  36. package/dist/utils/pairProductVariables.js +60 -59
  37. package/package.json +2 -2
  38. package/dist/config/migrator/recommendationTitleMigrator.js +0 -119
  39. package/dist/extensions/Blocks/Recommendation/controls/title/index.js +0 -44
  40. package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +0 -33
  41. package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +0 -5
  42. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -86
  43. package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +0 -13
@@ -32,7 +32,6 @@ export declare const DEFAULT_COMPOSITION: string[];
32
32
  /**
33
33
  * Default visibility settings for card elements
34
34
  * Omnibus elements are hidden by default (not all regions require them)
35
- * The block-level title is visible on a fresh drop.
36
35
  */
37
36
  export declare const DEFAULT_VISIBILITY: Record<string, boolean>;
38
37
  /**
@@ -8,6 +8,6 @@
8
8
  */
9
9
  export { RecommendationBlockId } from './blockIds';
10
10
  export { RecommendationControlId } from './controlIds';
11
- export { BLOCK_ROOT_SELECTOR, CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, MOBILE_ROW_SELECTOR, CSS_CLASS_RECO_BUTTON, CSS_CLASS_SKIP_COMPILE, RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, ATTR_RECOMMENDATION_TITLE, SELECTOR_TITLE_CELL, ATTR_CUSTOM_PREFIX, ATTR_DATA_CARD_COMPOSITION, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, CSS_CLASS_ATTRIBUTE_ROW, CSS_CLASS_SPACER, SELECTOR_ATTRIBUTE_ROW, ATTR_DATA_ATTRIBUTE_TYPE, ATTR_DATA_VISIBILITY, PRODUCT_ATTRIBUTE_PREFIX, BUILT_IN_DEFAULT_ATTRIBUTES, } from './selectors';
11
+ export { BLOCK_ROOT_SELECTOR, CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, MOBILE_ROW_SELECTOR, CSS_CLASS_RECO_BUTTON, CSS_CLASS_SKIP_COMPILE, RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, ATTR_CUSTOM_PREFIX, ATTR_DATA_CARD_COMPOSITION, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, SELECTOR_ATTRIBUTE_ROW, ATTR_DATA_ATTRIBUTE_TYPE, PRODUCT_ATTRIBUTE_PREFIX, BUILT_IN_DEFAULT_ATTRIBUTES, } from './selectors';
12
12
  export { LAYOUT_VALUES, LAYOUT_OPTIONS, DEFAULT_PRODUCTS_PER_ROW, DEFAULT_CARDS_IN_ROW, DEFAULT_MOBILE_CARDS_IN_ROW, MAX_PRODUCT_COUNT, MIN_PRODUCT_COUNT, MAX_PRODUCTS_PER_ROW, MIN_PRODUCTS_PER_ROW, MAX_MOBILE_PRODUCTS_PER_ROW, MIN_MOBILE_PRODUCTS_PER_ROW, DEFAULT_COLUMN_SPACING, DEFAULT_ROW_SPACING, DEFAULT_MOBILE_COLUMN_SPACING, DEFAULT_MOBILE_ROW_SPACING, MIN_SPACING, MAX_SPACING, SPACING_STEP, } from './layout';
13
13
  export { DEFAULT_NODE_CONFIG, DEFAULT_CURRENCY, DEFAULT_COMPOSITION, DEFAULT_VISIBILITY, CURRENT_CONFIG_VERSION, EXCLUDED_ALGORITHM_IDS, } from './defaultConfig';
@@ -58,10 +58,6 @@ export declare const ATTR_PRODUCT_OLD_PRICE = "productOldPrice";
58
58
  export declare const ATTR_PRODUCT_OMNIBUS_PRICE = "productOmnibusPrice";
59
59
  export declare const ATTR_PRODUCT_OMNIBUS_DISCOUNT = "productOmnibusDiscount";
60
60
  export declare const ATTR_PRODUCT_BUTTON = "productButton";
61
- export declare const ATTR_RECOMMENDATION_TITLE = "recommendationTitle";
62
- export declare const CSS_CLASS_TITLE_CELL = "ins-recommendation-title";
63
- /** Title cell — the only `esd-block-text` living outside the product containers. */
64
- export declare const SELECTOR_TITLE_CELL = ".ins-recommendation-title";
65
61
  /**
66
62
  * Custom attribute constants
67
63
  * Used for dynamically added product attributes in Card Composition
@@ -74,16 +70,10 @@ export declare const ATTR_DATA_CUSTOM_ATTRIBUTES = "data-custom-attributes";
74
70
  export declare const ATTR_DATA_CARD_COMPOSITION = "data-card-composition";
75
71
  /** HTML attribute on <td> elements identifying the product attribute for compiler template variable generation */
76
72
  export declare const ATTR_PRODUCT_ATTR = "product-attr";
77
- /** Class every composition attribute row carries — the visibility toggle and the compiler both key on it */
78
- export declare const CSS_CLASS_ATTRIBUTE_ROW = "recommendation-attribute-row";
79
73
  /** Row wrapper of one composition entry inside a product card */
80
74
  export declare const SELECTOR_ATTRIBUTE_ROW = ".recommendation-attribute-row";
81
75
  /** HTML attribute on an attribute row holding its composition key */
82
76
  export declare const ATTR_DATA_ATTRIBUTE_TYPE = "data-attribute-type";
83
- /** HTML attribute on an attribute row holding its visibility (`1` / `0`) */
84
- export declare const ATTR_DATA_VISIBILITY = "data-visibility";
85
- /** Class on the spacer cell of the row that trails a title */
86
- export declare const CSS_CLASS_SPACER = "spacer";
87
77
  /** Prefix `resolveProductAttrValue` puts on custom (non-default) product attributes in `product-attr` values */
88
78
  export declare const PRODUCT_ATTRIBUTE_PREFIX = "product_attribute.";
89
79
  /**
@@ -33,8 +33,6 @@ export declare class RecommendationCardCompositionControl extends CommonControl
33
33
  private _normalizeComposition;
34
34
  private _readCustomAttributesFromNode;
35
35
  private _readVisibilityFromRows;
36
- private _withTitlePresence;
37
- private _hasTitle;
38
36
  private _getDefaultVisibilities;
39
37
  private _extractVisibilityFromRows;
40
38
  private _parseVisibilityValue;
@@ -189,14 +187,6 @@ export declare class RecommendationCardCompositionControl extends CommonControl
189
187
  */
190
188
  private _buildCompositionHtml;
191
189
  private _applyVisibilityToBlock;
192
- private _applyTitleVisibilityToBlock;
193
- private _resolveTitleInjection;
194
- private _findTitleRows;
195
- private _findTitleRowsByClass;
196
- private _isSpacerRow;
197
- private _findTitleContainerBody;
198
- private _readInnerHtml;
199
- private _defaultTitleParagraph;
200
190
  /**
201
191
  * Finds the composition array index for the Nth custom attribute (0-based).
202
192
  * Scans left-to-right, counting only entries with the custom prefix.
@@ -11,7 +11,6 @@
11
11
  */
12
12
  export { RecommendationBlockControl, CONTROL_BLOCK_ID, AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID, } from './main';
13
13
  export * from './main/utils';
14
- export { TitleControls } from './title';
15
14
  export { NameControls } from './name';
16
15
  export { PriceControls } from './price';
17
16
  export { OldPriceControls } from './oldPrice';
@@ -70,7 +70,6 @@ export interface RegenerateProductRowsOptions {
70
70
  /** Optional: pass composition directly to avoid stale DOM reads after setAttribute */
71
71
  composition?: string[];
72
72
  }
73
- export declare function getMainContainerTbody(currentNode: ImmutableHtmlNode): ImmutableHtmlNode | null;
74
73
  /**
75
74
  * Regenerates only the mobile product container rows and commits in a single apply().
76
75
  * Standalone entry point for callers that change mobile-only settings
@@ -43,9 +43,7 @@ const n = `.esd-x,
43
43
  .recommendation-block-v2 .product-omnibus-discount ue-node-actions,
44
44
  .recommendation-block-v2 .product-omnibus-discount ue-node-panel,
45
45
  .recommendation-block-v2 .product-button ue-node-actions,
46
- .recommendation-block-v2 .product-button ue-node-panel,
47
- .recommendation-block-v2 .ins-recommendation-title ue-node-actions,
48
- .recommendation-block-v2 .ins-recommendation-title ue-node-panel {
46
+ .recommendation-block-v2 .product-button ue-node-panel {
49
47
  display: none !important;
50
48
  }
51
49
 
@@ -1,82 +1,83 @@
1
+ import { ITEMS_CURRENCY_ATTR as N } from "../extensions/Blocks/Items/constants/currency.js";
1
2
  import { productPairs as L } from "../extensions/Blocks/Items/enums/productEnums.js";
2
- import { DefaultConfigValues as V } from "../extensions/Blocks/Items/enums/settingsEnums.js";
3
- import { escapeReplacement as G } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
3
+ import { DefaultConfigValues as G } from "../extensions/Blocks/Items/enums/settingsEnums.js";
4
+ import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
4
5
  import { preserveTextStyles as F } from "./preserveTextStyles.js";
5
- import { unwrapProductNameLinks as X } from "./unwrapProductNameLink.js";
6
+ import { unwrapProductNameLinks as Y } from "./unwrapProductNameLink.js";
6
7
  const x = {
7
8
  CART_ITEMS: "ins_apr",
8
9
  BROWSED_ITEMS: "browsed_item",
9
10
  PURCHASED_ITEMS: "purchased_item"
10
- }, N = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
11
- function v(S, H, g) {
12
- let $ = H;
13
- for (; $ > 0 && /\s/.test(S[$ - 1]); )
14
- $ -= 1;
15
- return g.some((I) => S.endsWith(I, $));
11
+ }, O = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
12
+ function v(S, I, b) {
13
+ let h = I;
14
+ for (; h > 0 && /\s/.test(S[h - 1]); )
15
+ h -= 1;
16
+ return b.some((P) => S.endsWith(P, h));
16
17
  }
17
- function J(S) {
18
- const H = N(S), g = new DOMParser().parseFromString(H, "text/html");
19
- X(g);
20
- const $ = L.PAIRS_FOR_EXTENSION;
21
- Object.entries($).forEach(([n, d]) => {
22
- g.querySelectorAll(".ins-product-td").forEach((r) => {
18
+ function Z(S) {
19
+ const I = O(S), b = new DOMParser().parseFromString(I, "text/html");
20
+ Y(b);
21
+ const h = L.PAIRS_FOR_EXTENSION;
22
+ Object.entries(h).forEach(([n, d]) => {
23
+ b.querySelectorAll(".ins-product-td").forEach((r) => {
23
24
  const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
24
25
  r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
25
- var T, P, D;
26
- const R = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[R];
27
- if (f)
26
+ var $, H, D;
27
+ const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, u = d[g];
28
+ if (u)
28
29
  switch (n) {
29
30
  case "imageSrc": {
30
31
  let e = null, s = null;
31
32
  if (t.tagName === "IMG" ? (e = t, s = e.closest("a")) : (e = t.querySelector("img"), s = t.querySelector("a") || t.closest("a")), !e)
32
33
  break;
33
- const a = f.DEFAULT, l = f.ATTR;
34
+ const a = u.DEFAULT, l = u.ATTR;
34
35
  if (a && e.src) {
35
36
  const i = e.src;
36
- a.some((b) => {
37
- const u = b.split("/").pop() || "", y = i.split("/").pop() || "";
38
- return i.includes(b) || i.includes(u) || y === u;
37
+ a.some((_) => {
38
+ const f = _.split("/").pop() || "", C = i.split("/").pop() || "";
39
+ return i.includes(_) || i.includes(f) || C === f;
39
40
  }) && (e.src = `{{${l}_${o}}}`);
40
41
  }
41
- const c = (P = (T = $.name) == null ? void 0 : T[R]) == null ? void 0 : P.ATTR;
42
+ const c = (H = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : H.ATTR;
42
43
  if (c && e.setAttribute("alt", `{{${c}_${o}}}`), s) {
43
- const i = (D = $.itemLink) == null ? void 0 : D[R];
44
+ const i = (D = h.itemLink) == null ? void 0 : D[g];
44
45
  if (i) {
45
- const _ = i.HREF, b = i.DEFAULT_HREF || "#!", u = s.href;
46
- (u === "#" || u === "" || u.endsWith("#!") || u.endsWith(b) || u === `${window.location.href}${b}` || !u || u === window.location.href) && (s.href = `{{${_}_${o}}}`);
46
+ const R = i.HREF, _ = i.DEFAULT_HREF || "#!", f = s.href;
47
+ (f === "#" || f === "" || f.endsWith("#!") || f.endsWith(_) || f === `${window.location.href}${_}` || !f || f === window.location.href) && (s.href = `{{${R}_${o}}}`);
47
48
  }
48
49
  }
49
50
  break;
50
51
  }
51
52
  case "name": {
52
- const e = f, s = e.ATTR, a = e.DEFAULT_HREF || "#!", l = e.HREF;
53
+ const e = u, s = e.ATTR, a = e.DEFAULT_HREF || "#!", l = e.HREF;
53
54
  t.textContent && (t.innerHTML = F(t, `{{${s}_${o}}}`));
54
55
  const c = t.closest("a") || (t.tagName === "A" ? t : null);
55
56
  if (c && l) {
56
- const i = c.href, _ = `${window.location.href}${a}`;
57
- (i === _ || i.endsWith(a)) && (c.href = `{{${l}_${o}}}`);
57
+ const i = c.href, R = `${window.location.href}${a}`;
58
+ (i === R || i.endsWith(a)) && (c.href = `{{${l}_${o}}}`);
58
59
  }
59
60
  break;
60
61
  }
61
62
  case "price":
62
63
  case "originalPrice": {
63
- const e = f, s = t.getAttribute("data-formated"), a = t.getAttribute("data-single_price"), l = s === "true", c = a === "true", i = t.getAttribute("data-curency") || "before";
64
- let _;
65
- c ? _ = l ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : _ = l ? e.PRICE_FORMATTED : e.PRICE;
66
- const b = e.CURRENCY;
67
- let u = `{{${_}_${o}}}`;
68
- const y = (t.getAttribute("data-currency_symbol") || "").trim(), W = y !== "" && y !== V.productPriceCurrencySymbolControlValue;
69
- let C = "";
70
- W ? C = y : b && (C = `{{${b}_${o}}}`), C && (u = i === "after" ? `${u} ${C}` : `${C} ${u}`), t.innerHTML = F(t, u);
64
+ const e = u, s = t.getAttribute("data-formated"), a = t.getAttribute("data-single_price"), l = s === "true", c = a === "true", i = t.getAttribute(N.POSITION) || "before";
65
+ let R;
66
+ c ? R = l ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : R = l ? e.PRICE_FORMATTED : e.PRICE;
67
+ const _ = e.CURRENCY;
68
+ let f = `{{${R}_${o}}}`;
69
+ const C = (t.getAttribute(N.SYMBOL) || "").trim(), V = C !== "" && C !== G.productPriceCurrencySymbolControlValue;
70
+ let y = "";
71
+ V ? y = C : _ && (y = `{{${_}_${o}}}`), y && (f = i === "after" ? `${f} ${y}` : `${y} ${f}`), t.innerHTML = F(t, f);
71
72
  break;
72
73
  }
73
74
  case "quantity": {
74
- const e = f, s = e.ATTR, a = e.DEFAULT;
75
+ const e = u, s = e.ATTR, a = e.DEFAULT;
75
76
  t.textContent && t.textContent.trim() === a && (t.innerHTML = F(t, `{{${s}_${o}}}`));
76
77
  break;
77
78
  }
78
79
  case "button": {
79
- const e = f, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t.tagName === "A" ? t : t.querySelector("a");
80
+ const e = u, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t.tagName === "A" ? t : t.querySelector("a");
80
81
  if (l) {
81
82
  const c = l.href || "", i = `${window.location.href}${a}`;
82
83
  (c === "" || c === "#" || c === i || c.endsWith(a) || c.endsWith("#!") || c === window.location.href) && (l.href = `{{${s}_${o}}}`);
@@ -84,7 +85,7 @@ function J(S) {
84
85
  break;
85
86
  }
86
87
  case "itemLink": {
87
- const e = f, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t;
88
+ const e = u, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t;
88
89
  if (l.href) {
89
90
  const c = l.href, i = `${window.location.href}${a}`;
90
91
  (c === i || c.endsWith(a)) && (l.href = `{{${s}_${o}}}`);
@@ -92,8 +93,8 @@ function J(S) {
92
93
  break;
93
94
  }
94
95
  default: {
95
- if ("ATTR" in f) {
96
- const e = f.ATTR;
96
+ if ("ATTR" in u) {
97
+ const e = u.ATTR;
97
98
  t.textContent && (t.innerHTML = F(t, `{{${e}_${o}}}`));
98
99
  }
99
100
  break;
@@ -102,9 +103,9 @@ function J(S) {
102
103
  });
103
104
  });
104
105
  });
105
- const I = H.match(/<!DOCTYPE[^>]*>/i), O = I ? `${I[0]}
106
- ` : "", q = g.querySelectorAll(".ins-product-td"), M = [];
107
- q.forEach((n) => {
106
+ const P = I.match(/<!DOCTYPE[^>]*>/i), q = P ? `${P[0]}
107
+ ` : "", U = b.querySelectorAll(".ins-product-td"), M = [];
108
+ U.forEach((n) => {
108
109
  const d = n.getAttribute("data-type") || "CART_ITEMS", p = n.getAttribute("data-number") || "1", r = n.outerHTML;
109
110
  M.push({
110
111
  element: n,
@@ -113,16 +114,16 @@ function J(S) {
113
114
  number: p
114
115
  });
115
116
  });
116
- let A = O + g.documentElement.outerHTML;
117
+ let A = q + b.documentElement.outerHTML;
117
118
  M.reverse().forEach(({ outerHtml: n, type: d, number: p }) => {
118
119
  const r = x[d], E = r ? `${r}_total_product_kind` : "";
119
120
  if (E) {
120
- const h = parseInt(p) - 1, o = `${`{% if ${E} > ${h} %}`}${n}{% endif %}`;
121
- A = A.replace(n, G(o));
121
+ const T = parseInt(p) - 1, o = `${`{% if ${E} > ${T} %}`}${n}{% endif %}`;
122
+ A = A.replace(n, X(o));
122
123
  }
123
124
  });
124
- const U = g.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
125
- return U.forEach((n) => {
125
+ const W = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
126
+ return W.forEach((n) => {
126
127
  var t;
127
128
  const d = n.getAttribute("data-number"), p = n.getAttribute("data-type");
128
129
  if (!d || !x[p])
@@ -131,20 +132,20 @@ function J(S) {
131
132
  if (!r || k.has(r))
132
133
  return;
133
134
  k.add(r);
134
- const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), h = w.get(E) ?? { number: d, type: p, wrap: [] };
135
- h.wrap.push(m !== "false"), w.set(E, h);
135
+ const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T = w.get(E) ?? { number: d, type: p, wrap: [] };
136
+ T.wrap.push(m !== "false"), w.set(E, T);
136
137
  }), w.forEach(({ number: n, type: d, wrap: p }, r) => {
137
138
  if (r.includes("{% if") || !p.some(Boolean))
138
139
  return;
139
- const E = L.PAIRS_FOR_EXTENSION.price[d].PRICE, m = L.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, h = `{% if ${E}_${n} != ${m}_${n} %}`, t = [h, N(h)];
140
- let R = "", o = 0, f = 0, T = A.indexOf(r);
141
- for (; T !== -1; ) {
142
- const P = p[f] === !0 && !v(A, T, t);
143
- R += A.slice(o, T) + (P ? `${h}${r}{% endif %}` : r), o = T + r.length, f += 1, T = A.indexOf(r, o);
140
+ const E = L.PAIRS_FOR_EXTENSION.price[d].PRICE, m = L.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, O(T)];
141
+ let g = "", o = 0, u = 0, $ = A.indexOf(r);
142
+ for (; $ !== -1; ) {
143
+ const H = p[u] === !0 && !v(A, $, t);
144
+ g += A.slice(o, $) + (H ? `${T}${r}{% endif %}` : r), o = $ + r.length, u += 1, $ = A.indexOf(r, o);
144
145
  }
145
- A = R + A.slice(o);
146
+ A = g + A.slice(o);
146
147
  }), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
147
148
  }
148
149
  export {
149
- J as pairProductVariables
150
+ Z as pairProductVariables
150
151
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.17.0-beta.db80c84",
3
+ "version": "3.17.0-beta.ddd4dde",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",
@@ -25,7 +25,7 @@
25
25
  "start": "vite",
26
26
  "build": "vite build && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.app.json",
27
27
  "preview": "vite preview",
28
- "lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ && bun run type-check",
28
+ "lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ && npm run type-check",
29
29
  "lint:fix": "NODE_OPTIONS=--max-old-space-size=2048 eslint --fix ./",
30
30
  "lint:e2e-quality": "node scripts/lint-e2e-quality.mjs",
31
31
  "lint:e2e-quality:ci": "node scripts/lint-e2e-quality.mjs --ci",
@@ -1,119 +0,0 @@
1
- var R = Object.defineProperty;
2
- var f = (s, t, e) => t in s ? R(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var a = (s, t, e) => f(s, typeof t != "symbol" ? t + "" : t, e);
4
- import { RecommendationBlockId as d } from "../../extensions/Blocks/Recommendation/constants/blockIds.js";
5
- import { BLOCK_ROOT_SELECTOR as u, CSS_CLASS_SKIP_COMPILE as m, ATTR_DATA_ATTRIBUTE_TYPE as S, ATTR_RECOMMENDATION_TITLE as l, CONTAINER_SELECTOR as E, CSS_CLASS_TITLE_CELL as c, CSS_CLASS_SPACER as C, CSS_CLASS_ATTRIBUTE_ROW as A, ATTR_DATA_VISIBILITY as L } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
6
- const p = u.slice(1), g = `${u}:not(.${m})`, O = `[${S}="${l}"]`, h = "td.esd-block-text", _ = "table.container > tbody", T = "esd-ext-config";
7
- class y {
8
- constructor() {
9
- a(this, "parser");
10
- this.parser = new DOMParser();
11
- }
12
- migrate(t) {
13
- try {
14
- if (!t.includes(p))
15
- return t;
16
- const e = this.parser.parseFromString(t, "text/html");
17
- return Array.from(e.querySelectorAll(g)).reduce(
18
- (n, o) => this._migrateBlock(o) || n,
19
- !1
20
- ) ? e.documentElement.outerHTML : t;
21
- } catch (e) {
22
- return console.error("RecommendationTitleMigrator failed:", e), t;
23
- }
24
- }
25
- /** Migrates one block. Returns `true` when the block was changed. */
26
- _migrateBlock(t) {
27
- if (t.querySelector(O) || this._hasRecordedTitleState(t))
28
- return !1;
29
- const e = this._findTitleCell(t), i = e !== null && (e.textContent ?? "").trim().length > 0;
30
- return i ? this._tagExistingTitle(t, e) : this._removeTitleRemnants(t, e), this._writeVisibility(t, i), !0;
31
- }
32
- /** The only `esd-block-text` cell outside the product containers is the title. */
33
- _findTitleCell(t) {
34
- return Array.from(t.querySelectorAll(h)).find((e) => !e.closest(E) && this._isTitlePosition(t, e)) ?? null;
35
- }
36
- _isTitlePosition(t, e) {
37
- var r;
38
- const i = this._wrapperRowOf(t, e);
39
- return e.classList.contains(c) || i !== null && i === ((r = i.parentElement) == null ? void 0 : r.firstElementChild);
40
- }
41
- /**
42
- * Stamps the attribute-row tagging onto the title's wrapper row and the spacer
43
- * below it, so one toggle governs the pair and the compiler drops both when off.
44
- */
45
- _tagExistingTitle(t, e) {
46
- e.classList.add(c), e.setAttribute("esd-extension-block-id", d.TITLE);
47
- const i = this._wrapperRowOf(t, e);
48
- if (!i)
49
- return;
50
- this._tagRow(i);
51
- const r = i.nextElementSibling;
52
- r && this._isSpacerRow(r) && this._tagRow(r);
53
- }
54
- /** The `<tr>` inside `table.container > tbody` that wraps the title's own table. */
55
- _wrapperRowOf(t, e) {
56
- if (!e)
57
- return null;
58
- const i = t.querySelector(_);
59
- return Array.from((i == null ? void 0 : i.children) ?? []).find((r) => r.contains(e)) ?? null;
60
- }
61
- /**
62
- * Direct children only — a product-container row holds spacer cells further down,
63
- * and `querySelector` would happily reach them. (`:scope >` is unsupported in happy-dom.)
64
- */
65
- _isSpacerRow(t) {
66
- return Array.from(t.children).some((e) => e.classList.contains(C));
67
- }
68
- _tagRow(t) {
69
- t.classList.add(A), t.setAttribute(S, l), t.setAttribute(L, "1");
70
- }
71
- /**
72
- * A deleted title leaves nothing to tag — the toggle re-injects the markup only
73
- * when the user switches it back on. Its leftovers (an emptied wrapper row, the
74
- * spacer that trailed it) would otherwise render as blank padding on top.
75
- */
76
- _removeTitleRemnants(t, e) {
77
- var o;
78
- const i = this._wrapperRowOf(t, e), r = i == null ? void 0 : i.nextElementSibling;
79
- if (r && this._isSpacerRow(r) && r.remove(), i) {
80
- i.remove();
81
- return;
82
- }
83
- const n = (o = t.querySelector(_)) == null ? void 0 : o.firstElementChild;
84
- n && this._isSpacerRow(n) && n.remove();
85
- }
86
- /**
87
- * Mirrors the resolved state into the persisted config blob, so a saved module
88
- * whose `data-*` attributes Stripo strips on re-drop still restores the toggle.
89
- */
90
- _writeVisibility(t, e) {
91
- const i = this._readConfig(t);
92
- if (!i)
93
- return;
94
- const r = typeof i.visibility == "object" && i.visibility !== null ? i.visibility : {};
95
- i.visibility = { ...r, [l]: e }, t.setAttribute(T, JSON.stringify(i));
96
- }
97
- _hasRecordedTitleState(t) {
98
- var i;
99
- const e = (i = this._readConfig(t)) == null ? void 0 : i.visibility;
100
- return typeof e == "object" && e !== null && l in e;
101
- }
102
- _readConfig(t) {
103
- const e = t.getAttribute(T);
104
- if (!e)
105
- return null;
106
- try {
107
- const i = JSON.parse(e);
108
- return typeof i == "object" && i !== null ? i : null;
109
- } catch {
110
- return null;
111
- }
112
- }
113
- }
114
- function v(s) {
115
- return new y().migrate(s);
116
- }
117
- export {
118
- v as migrateRecommendationTitle
119
- };
@@ -1,44 +0,0 @@
1
- import { createPaddingsControl as r, createTextBackgroundColorControl as T, createTextFontFamilyControl as e, createTextStyleControl as l, createTextSizeControl as C, createTextColorControl as c, createTextAlignControl as I } from "../../../controlFactories.js";
2
- import { RecommendationBlockId as o } from "../../constants/blockIds.js";
3
- import { RecommendationControlId as t } from "../../constants/controlIds.js";
4
- import { BLOCK_ROOT_SELECTOR as n } from "../../constants/selectors.js";
5
- const L = I(
6
- t.TITLE_ALIGN,
7
- o.TITLE,
8
- n
9
- ), a = c(
10
- t.TITLE_COLOR,
11
- o.TITLE,
12
- n
13
- ), i = C(
14
- t.TITLE_SIZE,
15
- o.TITLE,
16
- n
17
- ), E = l(
18
- t.TITLE_STYLE,
19
- o.TITLE,
20
- n
21
- ), m = e(
22
- t.TITLE_FONT_FAMILY,
23
- o.TITLE,
24
- n
25
- ), s = T(
26
- t.TITLE_BACKGROUND,
27
- o.TITLE,
28
- n
29
- ), d = r(
30
- t.TITLE_PADDINGS,
31
- o.TITLE,
32
- n
33
- ), x = {
34
- align: L,
35
- color: a,
36
- size: i,
37
- style: E,
38
- fontFamily: m,
39
- background: s,
40
- paddings: d
41
- };
42
- export {
43
- x as TitleControls
44
- };
@@ -1,33 +0,0 @@
1
- import { RecommendationBlockId as r } from "../constants/blockIds.js";
2
- import { DEFAULT_ROW_SPACING as l } from "../constants/layout.js";
3
- import { CSS_CLASS_ATTRIBUTE_ROW as d, ATTR_RECOMMENDATION_TITLE as n, ATTR_DATA_VISIBILITY as A, CSS_CLASS_TITLE_CELL as _, CSS_CLASS_SPACER as c } from "../constants/selectors.js";
4
- const a = "You May Also Like!", i = '<p style="font-size: 28px; color: #333333;"><strong>{-{-TITLE-}-}</strong></p>';
5
- function E(s = i, t = !0, T = l) {
6
- const e = `class="${d}" data-attribute-type="${n}" ${A}="${t ? "1" : "0"}"`, o = t ? "" : ' style="display: none;"';
7
- return `
8
- <tr ${e}${o}>
9
- <td>
10
- <table width="100%" cellpadding="0" cellspacing="0" border="0">
11
- <tbody>
12
- <tr>
13
- <td
14
- class="esd-block-text ${_} es-p10t es-p10b es-p20l es-p20r"
15
- align="center"
16
- esd-extension-block-id="${r.TITLE}">
17
- ${s}
18
- </td>
19
- </tr>
20
- </tbody>
21
- </table>
22
- </td>
23
- </tr>
24
- <tr ${e}${o}>
25
- <td class="${c}" style="height: ${T}px;"></td>
26
- </tr>
27
- `;
28
- }
29
- export {
30
- i as DEFAULT_TITLE_PARAGRAPH,
31
- a as DEFAULT_TITLE_TEXT,
32
- E as buildTitleRows
33
- };
@@ -1,5 +0,0 @@
1
- /**
2
- * Runs before the document reaches the editor, so a legacy title is already a
3
- * composition item on the first render — no post-load adoption pass.
4
- */
5
- export declare function migrateRecommendationTitle(html: string): string;
@@ -1,86 +0,0 @@
1
- export declare const TitleControls: {
2
- readonly align: {
3
- new (): {
4
- getId(): string;
5
- getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
6
- getParentControlId(): string;
7
- api: import("@stripoinc/ui-editor-extensions").ControlApi;
8
- getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
9
- getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
10
- getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
11
- isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
12
- };
13
- };
14
- readonly color: {
15
- new (): {
16
- getId(): string;
17
- getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
18
- getParentControlId(): string;
19
- api: import("@stripoinc/ui-editor-extensions").ControlApi;
20
- getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
21
- getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
22
- getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
23
- isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
24
- };
25
- };
26
- readonly size: {
27
- new (): {
28
- getId(): string;
29
- getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
30
- getParentControlId(): string;
31
- api: import("@stripoinc/ui-editor-extensions").ControlApi;
32
- getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
33
- getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
34
- getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
35
- isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
36
- };
37
- };
38
- readonly style: {
39
- new (): {
40
- getId(): string;
41
- getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
42
- getParentControlId(): string;
43
- api: import("@stripoinc/ui-editor-extensions").ControlApi;
44
- getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
45
- getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
46
- getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
47
- isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
48
- };
49
- };
50
- readonly fontFamily: {
51
- new (): {
52
- getId(): string;
53
- getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
54
- getParentControlId(): string;
55
- api: import("@stripoinc/ui-editor-extensions").ControlApi;
56
- getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
57
- getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
58
- getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
59
- isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
60
- };
61
- };
62
- readonly background: {
63
- new (): {
64
- getId(): string;
65
- getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
66
- getAdditionalModifications(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
67
- getParentControlId(): string;
68
- api: import("@stripoinc/ui-editor-extensions").ControlApi;
69
- getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
70
- getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
71
- isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
72
- };
73
- };
74
- readonly paddings: {
75
- new (): {
76
- getId(): string;
77
- getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
78
- getParentControlId(): string;
79
- api: import("@stripoinc/ui-editor-extensions").ControlApi;
80
- getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
81
- getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
82
- getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
83
- isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
84
- };
85
- };
86
- };
@@ -1,13 +0,0 @@
1
- export declare const DEFAULT_TITLE_TEXT = "You May Also Like!";
2
- export declare const DEFAULT_TITLE_PARAGRAPH: string;
3
- /**
4
- * Builds the two block-level title rows: the title itself and the spacer below it.
5
- * Both carry the same `recommendation-attribute-row` tagging a card attribute row has,
6
- * so the Card Composition toggle hides the pair together and the compiler's
7
- * `[data-visibility="0"]` sweep drops both — no leading gap when the title is off.
8
- * @param paragraphHtml - Full `<p>` markup rendered inside the title cell
9
- * @param visible - Whether the title starts visible
10
- * @param spacerHeightPx - Height of the spacer row below the title
11
- * @returns HTML string with the title row followed by its spacer row
12
- */
13
- export declare function buildTitleRows(paragraphHtml?: string, visible?: boolean, spacerHeightPx?: number): string;