@useinsider/guido 3.1.1 → 3.2.0-beta.22a0c4c

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 (89) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +66 -54
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +91 -81
  5. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
  6. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
  7. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  8. package/dist/components/organisms/header/EditorActions.vue2.js +51 -36
  9. package/dist/components/organisms/header/RightSlot.vue.js +10 -10
  10. package/dist/components/organisms/header/RightSlot.vue2.js +16 -13
  11. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
  12. package/dist/composables/useHtmlCompiler.js +23 -21
  13. package/dist/composables/useHtmlValidator.js +40 -38
  14. package/dist/composables/usePreviewMode.js +20 -16
  15. package/dist/composables/useSave.js +23 -15
  16. package/dist/composables/useStripo.js +44 -41
  17. package/dist/composables/validators/useLiquidValidator.js +42 -0
  18. package/dist/config/compiler/liquidCompilerRules.js +15 -0
  19. package/dist/config/compiler/recommendationCompilerRules.js +158 -44
  20. package/dist/config/compiler/unsubscribeCompilerRules.js +37 -37
  21. package/dist/config/compiler/utils/recommendationCompilerUtils.js +52 -46
  22. package/dist/config/i18n/en/tooltips.json.js +2 -1
  23. package/dist/config/migrator/checkboxMigrator.js +5 -3
  24. package/dist/config/migrator/radioButtonMigrator.js +14 -12
  25. package/dist/config/migrator/recommendationMigrator.js +1 -1
  26. package/dist/enums/extensions/recommendationBlock.js +14 -11
  27. package/dist/enums/recommendation.js +2 -2
  28. package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
  29. package/dist/extensions/Blocks/Recommendation/block.js +1 -1
  30. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  31. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
  32. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
  33. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
  34. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
  35. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +6 -6
  36. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
  37. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +95 -93
  38. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
  39. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
  40. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +75 -73
  41. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
  42. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +29 -25
  43. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +7 -5
  44. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
  45. package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
  46. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +3 -1
  47. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
  48. package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
  49. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
  50. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
  51. package/dist/extensions/DynamicContent/dynamic-content.js +17 -12
  52. package/dist/guido.css +1 -1
  53. package/dist/services/recommendationApi.js +15 -15
  54. package/dist/services/stripoApi.js +9 -9
  55. package/dist/services/templateLibraryApi.js +48 -46
  56. package/dist/src/@types/config/index.d.ts +1 -1
  57. package/dist/src/@types/config/schemas.d.ts +28 -0
  58. package/dist/src/@types/config/types.d.ts +3 -1
  59. package/dist/src/@types/generic.d.ts +0 -1
  60. package/dist/src/@types/save-as-template.d.ts +1 -0
  61. package/dist/src/composables/useConfig.d.ts +12 -0
  62. package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
  63. package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
  64. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
  65. package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -0
  66. package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
  67. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  68. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  69. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
  70. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
  71. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
  72. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
  73. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
  74. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
  75. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  76. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  77. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
  78. package/dist/src/services/templateLibraryApi.d.ts +1 -1
  79. package/dist/src/stores/config.d.ts +108 -0
  80. package/dist/src/stores/preview.d.ts +3 -0
  81. package/dist/src/utils/genericUtil.d.ts +1 -1
  82. package/dist/src/utils/htmlCompiler.d.ts +2 -1
  83. package/dist/static/styles/base.css.js +7 -2
  84. package/dist/stores/preview.js +4 -3
  85. package/dist/utils/genericUtil.js +42 -20
  86. package/dist/utils/htmlCompiler.js +48 -41
  87. package/dist/utils/templatePreparation.js +36 -25
  88. package/dist/utils/tooltipUtils.js +4 -5
  89. package/package.json +2 -2
@@ -1,14 +1,14 @@
1
1
  import { RecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as k } from "../../../../enums/extensions/recommendationBlock.js";
2
- import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
3
- import { useConfigStore as C } from "../../../../stores/config.js";
2
+ import { useRecommendationApi as C } from "../../../../services/recommendationApi.js";
3
+ import { useConfigStore as y } from "../../../../stores/config.js";
4
4
  import { defineStore as G } from "pinia";
5
5
  import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
6
6
  import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
7
7
  import { getDefaultProducts as S } from "../templates/utils.js";
8
8
  import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
9
9
  import { isFilterValid as D } from "../validation/filterSchema.js";
10
- const h = y();
11
- let u = null, m = null, d = null;
10
+ const h = C();
11
+ let m = null, u = null, d = null;
12
12
  function I() {
13
13
  return {
14
14
  cardsInRow: F,
@@ -57,7 +57,7 @@ const v = () => ({
57
57
  blockStates: {},
58
58
  currentRecommendationId: null,
59
59
  configVersion: 0
60
- }), E = G("guidoRecommendationExtension", {
60
+ }), z = G("guidoRecommendationExtension", {
61
61
  state: () => v(),
62
62
  getters: {
63
63
  // ====================================================================
@@ -131,11 +131,10 @@ const v = () => ({
131
131
  })),
132
132
  getFilterList() {
133
133
  return Object.values(this.filterList).map((t) => {
134
- const r = t.type === "defaultAttribute", e = k.includes(t.attributeName);
135
- let n = r ? t.attributeName : `product_attributes.${t.attributeName}`;
136
- return n = e ? `${n}.${this.recommendationConfigs.currencySettings.value}` : n, {
134
+ let r;
135
+ return t.type === "productAttribute" ? r = `product_attributes.${t.attributeName}` : k.includes(t.attributeName) ? r = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : r = t.attributeName, {
137
136
  text: t.displayName,
138
- value: n,
137
+ value: r,
139
138
  type: t.attributeType
140
139
  };
141
140
  });
@@ -163,10 +162,15 @@ const v = () => ({
163
162
  * Resets currentRecommendationId if it was the deleted block.
164
163
  */
165
164
  removeBlockState(t) {
166
- const r = { ...this.blockStates };
167
- if (delete r[t], this.blockStates = r, this.currentRecommendationId === t) {
168
- const e = Object.keys(this.blockStates).map(Number);
169
- this.currentRecommendationId = e.length > 0 ? e[0] : null;
165
+ const r = t.toString();
166
+ if (this.recommendationCampaignUrls[r]) {
167
+ const n = { ...this.recommendationCampaignUrls };
168
+ delete n[r], this.recommendationCampaignUrls = n;
169
+ }
170
+ const e = { ...this.blockStates };
171
+ if (delete e[t], this.blockStates = e, this.currentRecommendationId === t) {
172
+ const n = Object.keys(this.blockStates).map(Number);
173
+ this.currentRecommendationId = n.length > 0 ? n[0] : null;
170
174
  }
171
175
  },
172
176
  /**
@@ -251,11 +255,11 @@ const v = () => ({
251
255
  // ====================================================================
252
256
  async fetchRecommendationCreateData() {
253
257
  if (!this.activePredictiveAlgorithms.length) {
254
- if (u) {
255
- await u;
258
+ if (m) {
259
+ await m;
256
260
  return;
257
261
  }
258
- u = (async () => {
262
+ m = (async () => {
259
263
  const {
260
264
  activePredictiveAlgorithms: t,
261
265
  languages: r,
@@ -268,26 +272,26 @@ const v = () => ({
268
272
  this.currencyList = e;
269
273
  })();
270
274
  try {
271
- await u;
275
+ await m;
272
276
  } finally {
273
- u = null;
277
+ m = null;
274
278
  }
275
279
  }
276
280
  },
277
281
  async fetchRecommendationFilters() {
278
282
  if (!Object.keys(this.filterList).length) {
279
- if (m) {
280
- await m;
283
+ if (u) {
284
+ await u;
281
285
  return;
282
286
  }
283
- m = (async () => {
287
+ u = (async () => {
284
288
  const t = await h.fetchRecommendationFilters();
285
289
  this.filterList = t;
286
290
  })();
287
291
  try {
288
- await m;
292
+ await u;
289
293
  } finally {
290
- m = null;
294
+ u = null;
291
295
  }
292
296
  }
293
297
  },
@@ -375,7 +379,7 @@ const v = () => ({
375
379
  },
376
380
  async _doFetchProducts() {
377
381
  var p;
378
- const t = this.currentRecommendationId, r = this.blockStates[t], { recommendationConfigs: e } = r, n = e.filters.filter((a) => a.isValid), c = b(n), i = ((p = g.find((a) => a.key === e.strategy)) == null ? void 0 : p.path) || "", o = C(), s = {
382
+ const t = this.currentRecommendationId, r = this.blockStates[t], { recommendationConfigs: e } = r, n = e.filters.filter((a) => a.isValid), c = b(n), i = ((p = g.find((a) => a.key === e.strategy)) == null ? void 0 : p.path) || "", o = y(), s = {
379
383
  locale: e.language,
380
384
  currency: e.currencySettings.value,
381
385
  partnerName: o.partnerName,
@@ -399,5 +403,5 @@ const v = () => ({
399
403
  }
400
404
  });
401
405
  export {
402
- E as useRecommendationExtensionStore
406
+ z as useRecommendationExtensionStore
403
407
  };
@@ -1,11 +1,11 @@
1
1
  import { RecommendationBlockId as s } from "../../constants/blockIds.js";
2
- import { ATTR_PRODUCT_ATTR as g, ATTR_PRODUCT_BUTTON as u, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_OMNIBUS_PRICE as h, ATTR_PRODUCT_OLD_PRICE as y, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_NAME as f, ATTR_PRODUCT_IMAGE as _ } from "../../constants/selectors.js";
3
- import { useRecommendationExtensionStore as x } from "../../store/recommendation.js";
2
+ import { ATTR_PRODUCT_ATTR as g, ATTR_PRODUCT_BUTTON as u, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_OMNIBUS_PRICE as h, ATTR_PRODUCT_OLD_PRICE as y, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_NAME as f, ATTR_PRODUCT_IMAGE as x } from "../../constants/selectors.js";
3
+ import { useRecommendationExtensionStore as _ } from "../../store/recommendation.js";
4
4
  import { formatPrice as $ } from "../../utils/priceFormatter.js";
5
5
  import { sanitizeImageUrl as C, CUSTOM_CELL_HTML as R } from "../utils.js";
6
6
  const a = "0 5px", l = "attribute-cell";
7
7
  function p() {
8
- const t = x(), { currencySettings: e } = t.recommendationConfigs;
8
+ const t = _(), { currencySettings: e } = t.recommendationConfigs;
9
9
  return {
10
10
  code: e.value,
11
11
  symbol: e.symbol,
@@ -23,7 +23,7 @@ function r(t, e = "price") {
23
23
  });
24
24
  }
25
25
  const I = {
26
- [_]: (t) => `
26
+ [x]: (t) => `
27
27
  <td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
28
28
  <table
29
29
  class="product-card-segment"
@@ -224,6 +224,8 @@ const I = {
224
224
  * Custom attribute cell template — same structure as built-in entries
225
225
  * (outer td → inner product-card-segment table).
226
226
  * Used by `buildElementRenderer` for `customAttr:*` composition entries.
227
+ * @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
228
+ * @param content - Display content for the cell
227
229
  */
228
230
  [R]: (t, e) => `
229
231
  <td class="${l}" style="padding: ${a}; height: 100%;" valign="middle">
@@ -238,7 +240,7 @@ const I = {
238
240
  <tbody>
239
241
  <tr valign="top">
240
242
  <td
241
- ${g}="product_attribute.${t}"
243
+ ${g}="${t}"
242
244
  class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
243
245
  align="center"
244
246
  esd-extension-block-id="${s.CUSTOM_ATTRIBUTE}">
@@ -1,7 +1,7 @@
1
- import { DEFAULT_PRODUCTS_PER_ROW as m } from "../../constants/layout.js";
2
- import { DEFAULT_CARD_COMPOSITION as L, spacer as E, getDefaultProducts as I, createBlockTemplate as _, DEFAULTS as S, buildElementRenderer as b, DEFAULT_CARD_VISIBILITY as A } from "../utils.js";
3
- import { gridElementRenderer as f, ATTRIBUTE_CELL_CLASS as w, DEFAULT_CELL_PADDING as D } from "./elementRenderer.js";
4
- const C = `
1
+ import { DEFAULT_PRODUCTS_PER_ROW as L } from "../../constants/layout.js";
2
+ import { DEFAULT_CARD_COMPOSITION as E, spacer as I, getDefaultProducts as _, createBlockTemplate as S, DEFAULTS as b, buildElementRenderer as A, DEFAULT_CARD_VISIBILITY as f } from "../utils.js";
3
+ import { gridElementRenderer as w, ATTRIBUTE_CELL_CLASS as D, DEFAULT_CELL_PADDING as C } from "./elementRenderer.js";
4
+ const O = `
5
5
  <tr class="recommendation-product-row">
6
6
  <td>
7
7
  <table
@@ -18,7 +18,7 @@ const C = `
18
18
  </table>
19
19
  </td>
20
20
  </tr>
21
- `, O = `
21
+ `, g = `
22
22
  <tr
23
23
  class="recommendation-attribute-row"
24
24
  data-attribute-type="{-{-ATTR_TYPE-}-}"
@@ -27,37 +27,38 @@ const C = `
27
27
  {-{-CELLS-}-}
28
28
  </tr>
29
29
  `;
30
- function g(t, e, l, n = L) {
31
- const o = (100 / e).toFixed(2), a = e - t.length, r = `<td class="${w}" style="padding: ${D};" width="${o}%"></td>`, i = a > 0 ? r.repeat(a) : "", s = b(l, n);
32
- return n.filter((c) => s[c]).map((c) => {
33
- const p = A[c] ?? !0, T = p ? "" : 'style="display: none;"', u = t.map((R) => s[c](R).replace("<td", `<td width="${o}%"`)).join("");
34
- return O.replace("{-{-ATTR_TYPE-}-}", c).replace("{-{-VISIBILITY-}-}", p ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", T).replace("{-{-CELLS-}-}", u + i);
30
+ function P(t, e, o, r = E, n = {}) {
31
+ const c = (100 / e).toFixed(2), i = e - t.length, l = `<td class="${D}" style="padding: ${C};" width="${c}%"></td>`, d = i > 0 ? l.repeat(i) : "", a = A(o, r, n);
32
+ return r.filter((s) => a[s]).map((s) => {
33
+ const T = f[s] ?? !0, u = T ? "" : 'style="display: none;"', R = t.map((m) => a[s](m).replace("<td", `<td width="${c}%"`)).join("");
34
+ return g.replace("{-{-ATTR_TYPE-}-}", s).replace("{-{-VISIBILITY-}-}", T ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", u).replace("{-{-CELLS-}-}", R + d);
35
35
  }).join("");
36
36
  }
37
- function P(t, e, l, n) {
38
- const o = [];
39
- for (let r = 0; r < t.length; r += e)
40
- o.push(t.slice(r, r + e));
41
- return o.map((r, i) => {
42
- const s = g(
43
- r,
44
- e,
37
+ function U(t, e, o, r, n = {}) {
38
+ const c = [];
39
+ for (let l = 0; l < t.length; l += e)
40
+ c.push(t.slice(l, l + e));
41
+ return c.map((l, d) => {
42
+ const a = P(
45
43
  l,
44
+ e,
45
+ o,
46
+ r,
46
47
  n
47
- ), d = C.replace("{-{-ATTRIBUTE_ROWS-}-}", s);
48
- return i > 0 ? E + d : d;
48
+ ), p = O.replace("{-{-ATTRIBUTE_ROWS-}-}", a);
49
+ return d > 0 ? I + p : p;
49
50
  }).join("");
50
51
  }
51
- function U(t, e, l) {
52
- return P(t, e, f, l);
52
+ function h(t, e, o, r = {}) {
53
+ return U(t, e, w, o, r);
53
54
  }
54
- function W(t) {
55
- const e = t ? `ins-recommendation-v3-block-${t}` : void 0, l = _("grid", e), n = I(), o = U(n, m);
56
- return l.replace("{-{-TITLE-}-}", S.TITLE).replace("{-{-PRODUCT_ROWS-}-}", o).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
55
+ function F(t) {
56
+ const e = t ? `ins-recommendation-v3-block-${t}` : void 0, o = S("grid", e), r = _(), n = h(r, L);
57
+ return o.replace("{-{-TITLE-}-}", b.TITLE).replace("{-{-PRODUCT_ROWS-}-}", n).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
57
58
  }
58
59
  export {
59
- W as getDefaultTemplate,
60
- g as prepareGridAttributeRows,
61
- P as prepareGridProductRows,
62
- U as prepareProductRows
60
+ F as getDefaultTemplate,
61
+ P as prepareGridAttributeRows,
62
+ U as prepareGridProductRows,
63
+ h as prepareProductRows
63
64
  };
@@ -1,12 +1,12 @@
1
1
  import { DEFAULT_PRODUCTS_PER_ROW as s } from "../constants/layout.js";
2
2
  import { prepareProductRows as c } from "./grid/template.js";
3
- import { prepareProductRows as i } from "./list/template.js";
4
- function P(r, p, o = {}) {
5
- if (p === "list")
6
- return i(r, o.composition);
7
- const { productsPerRow: t = s, composition: e } = o;
8
- return c(r, t, e);
3
+ import { prepareProductRows as R } from "./list/template.js";
4
+ function a(o, t, r = {}) {
5
+ if (t === "list")
6
+ return R(o, r.composition, r.filterList);
7
+ const { productsPerRow: e = s, composition: p, filterList: i } = r;
8
+ return c(o, e, p, i);
9
9
  }
10
10
  export {
11
- P as prepareProductRows
11
+ a as prepareProductRows
12
12
  };
@@ -166,11 +166,13 @@ const I = {
166
166
  /**
167
167
  * Custom attribute row template — same tr-td structure as Name, Price, etc.
168
168
  * Used by `buildElementRenderer` for `customAttr:*` composition entries.
169
+ * @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
170
+ * @param content - Display content for the cell
169
171
  */
170
172
  [y]: (t, e) => `
171
173
  <tr>
172
174
  <td
173
- ${u}="product_attribute.${t}"
175
+ ${u}="${t}"
174
176
  class="esd-block-text product-custom-attribute"
175
177
  esd-extension-block-id="${o.CUSTOM_ATTRIBUTE}"
176
178
  align="left">
@@ -1,14 +1,14 @@
1
- import { ATTR_PRODUCT_IMAGE as i, ATTR_PRODUCT_BUTTON as d } from "../../constants/selectors.js";
2
- import { DEFAULT_CARD_COMPOSITION as u, spacer as m, buildElementRenderer as C, DEFAULT_CARD_VISIBILITY as b } from "../utils.js";
3
- import { listElementRenderer as T } from "./elementRenderer.js";
4
- function R(r, n, t) {
5
- const l = t ? "" : ' style="display: none;"', o = r.replace(/<tr>/, "").replace(/<\/tr>/, "");
1
+ import { ATTR_PRODUCT_IMAGE as a, ATTR_PRODUCT_BUTTON as d } from "../../constants/selectors.js";
2
+ import { DEFAULT_CARD_COMPOSITION as b, spacer as m, buildElementRenderer as C, DEFAULT_CARD_VISIBILITY as T } from "../utils.js";
3
+ import { listElementRenderer as f } from "./elementRenderer.js";
4
+ function R(r, n, l) {
5
+ const t = l ? "" : ' style="display: none;"', o = r.replace(/<tr>/, "").replace(/<\/tr>/, "");
6
6
  return `<tr
7
7
  class="recommendation-attribute-row"
8
8
  data-attribute-type="${n}"
9
- data-visibility="${t ? "1" : "0"}"${l}>${o}</tr>`;
9
+ data-visibility="${l ? "1" : "0"}"${t}>${o}</tr>`;
10
10
  }
11
- const f = `
11
+ const y = `
12
12
  <tr class="recommendation-product-row">
13
13
  <td style="padding: 0 5px;">
14
14
  <table
@@ -26,29 +26,29 @@ const f = `
26
26
  </td>
27
27
  </tr>
28
28
  `;
29
- function y(r, n = u) {
30
- const t = C(T, n), l = t[i](r), a = `
29
+ function O(r, n = b, l = {}) {
30
+ const t = C(f, n, l), o = t[a](r), c = `
31
31
  <td class="product-info-cell" valign="middle" style="padding: 15px;">
32
- <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
32
+ <table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="table-layout: fixed;">
33
33
  <tbody>
34
- ${n.filter((e) => e !== i && e !== d).filter((e) => t[e]).map((e) => {
35
- const p = b[e] ?? !0;
36
- return R(t[e](r), e, p);
34
+ ${n.filter((e) => e !== a && e !== d).filter((e) => t[e]).map((e) => {
35
+ const u = T[e] ?? !0;
36
+ return R(t[e](r), e, u);
37
37
  }).join(`
38
38
  `)}
39
39
  </tbody>
40
40
  </table>
41
41
  </td>
42
- `, c = t[d](r), s = l + a + c;
43
- return f.replace("{-{-PRODUCT_CONTENT-}-}", s);
42
+ `, s = t[d](r), p = o + c + s;
43
+ return y.replace("{-{-PRODUCT_CONTENT-}-}", p);
44
44
  }
45
- function w(r, n) {
46
- return r.map((t, l) => {
47
- const o = y(t, n);
48
- return l > 0 ? m + o : o;
45
+ function D(r, n, l = {}) {
46
+ return r.map((t, o) => {
47
+ const i = O(t, n, l);
48
+ return o > 0 ? m + i : i;
49
49
  }).join("");
50
50
  }
51
51
  export {
52
- y as getListProductCard,
53
- w as prepareProductRows
52
+ O as getListProductCard,
53
+ D as prepareProductRows
54
54
  };
@@ -1,55 +1,60 @@
1
- import { ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as p, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as u, ATTR_PRODUCT_OMNIBUS_PRICE as _, ATTR_PRODUCT_OMNIBUS_DISCOUNT as b, ATTR_PRODUCT_BUTTON as g, ATTR_CUSTOM_PREFIX as d } from "../constants/selectors.js";
2
- function R(t) {
1
+ import { ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as b, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OMNIBUS_PRICE as g, ATTR_PRODUCT_OMNIBUS_DISCOUNT as C, ATTR_PRODUCT_BUTTON as f, ATTR_CUSTOM_PREFIX as u } from "../constants/selectors.js";
2
+ function U(t) {
3
3
  return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
4
4
  }
5
- const O = Symbol("customCellHtml");
6
- function f(t, e) {
7
- const n = t[O];
8
- if (!n)
5
+ function R(t, e) {
6
+ const n = Object.values(e).find((r) => r.attributeName === t);
7
+ return (n == null ? void 0 : n.type) === "defaultAttribute";
8
+ }
9
+ function y(t, e) {
10
+ return R(t, e) ? t : `product_attribute.${t}`;
11
+ }
12
+ const P = Symbol("customCellHtml");
13
+ function S(t, e, n = {}) {
14
+ const r = t[P];
15
+ if (!r)
9
16
  return { ...t };
10
- const r = { ...t };
11
- return e.filter((o) => o.startsWith(d) && !r[o]).forEach((o) => {
12
- const s = o.substring(d.length), l = R(s);
13
- r[o] = (i) => {
14
- var a;
15
- const c = (a = i.product_attributes) == null ? void 0 : a[s];
16
- return n(
17
- s,
18
- c != null ? String(c) : l
19
- );
17
+ const l = { ...t };
18
+ return e.filter((o) => o.startsWith(u) && !l[o]).forEach((o) => {
19
+ const s = o.substring(u.length), a = U(s), D = y(s, n), O = R(s, n);
20
+ l[o] = (d) => {
21
+ var p;
22
+ const i = O ? d[s] : (p = d.product_attributes) == null ? void 0 : p[s];
23
+ let c = a;
24
+ return typeof i == "string" ? c = i : typeof i == "number" && (c = String(i)), r(D, c);
20
25
  };
21
- }), r;
26
+ }), l;
22
27
  }
23
- const h = {
28
+ const L = {
24
29
  TITLE: "You May Also Like!"
25
- }, I = [
30
+ }, M = [
26
31
  m,
27
- p,
32
+ b,
28
33
  T,
29
- u,
30
34
  _,
31
- b,
32
- g
33
- ], P = {
35
+ g,
36
+ C,
37
+ f
38
+ ], $ = {
34
39
  [m]: !0,
35
- [p]: !0,
36
- [u]: !0,
40
+ [b]: !0,
41
+ [_]: !0,
37
42
  [T]: !0,
38
- [_]: !1,
39
- [b]: !1,
40
- [g]: !0
41
- }, U = `
43
+ [g]: !1,
44
+ [C]: !1,
45
+ [f]: !0
46
+ }, h = `
42
47
  <tr>
43
48
  <td class="spacer" style="height: 10px;"></td>
44
49
  </tr>
45
- `, C = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
46
- function E(t) {
47
- return !t || typeof t != "string" || t.trim() === "" ? C : t.startsWith("http://") ? t.replace("http://", "https://") : t;
50
+ `, A = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
51
+ function w(t) {
52
+ return !t || typeof t != "string" || t.trim() === "" ? A : t.startsWith("http://") ? t.replace("http://", "https://") : t;
48
53
  }
49
- function D(t) {
54
+ function I(t) {
50
55
  return {
51
56
  name: "Product Name",
52
- image_url: C,
57
+ image_url: A,
53
58
  price: { USD: 18 },
54
59
  original_price: { USD: 20 },
55
60
  discount: { USD: 2 },
@@ -61,13 +66,13 @@ function D(t) {
61
66
  category: []
62
67
  };
63
68
  }
64
- function S(t = 6) {
69
+ function N(t = 6) {
65
70
  return Array.from(
66
71
  { length: t },
67
- (e, n) => D(String(n + 1))
72
+ (e, n) => I(String(n + 1))
68
73
  );
69
74
  }
70
- function y(t = "grid", e) {
75
+ function k(t = "grid", e) {
71
76
  const n = t === "list" ? `
72
77
  data-layout="list"` : "", r = e ? ` ${e}` : "";
73
78
  return `
@@ -105,7 +110,7 @@ function y(t = "grid", e) {
105
110
  </table>
106
111
  </td>
107
112
  </tr>
108
- ${U}
113
+ ${h}
109
114
  <tr>
110
115
  <td>
111
116
  <table
@@ -144,15 +149,17 @@ function y(t = "grid", e) {
144
149
  `;
145
150
  }
146
151
  export {
147
- O as CUSTOM_CELL_HTML,
148
- h as DEFAULTS,
149
- I as DEFAULT_CARD_COMPOSITION,
150
- P as DEFAULT_CARD_VISIBILITY,
151
- C as PLACEHOLDER_IMAGE,
152
- f as buildElementRenderer,
153
- y as createBlockTemplate,
154
- S as getDefaultProducts,
155
- E as sanitizeImageUrl,
156
- U as spacer,
157
- R as toDisplayName
152
+ P as CUSTOM_CELL_HTML,
153
+ L as DEFAULTS,
154
+ M as DEFAULT_CARD_COMPOSITION,
155
+ $ as DEFAULT_CARD_VISIBILITY,
156
+ A as PLACEHOLDER_IMAGE,
157
+ S as buildElementRenderer,
158
+ k as createBlockTemplate,
159
+ N as getDefaultProducts,
160
+ R as isDefaultAttribute,
161
+ y as resolveProductAttrValue,
162
+ w as sanitizeImageUrl,
163
+ h as spacer,
164
+ U as toDisplayName
158
165
  };
@@ -1,10 +1,10 @@
1
1
  function a(t) {
2
2
  return typeof t == "object" && t !== null && "tagName" in t && typeof t.tagName == "string";
3
3
  }
4
- function r(t) {
4
+ function n(t) {
5
5
  return typeof t == "object" && t !== null && "getTagName" in t && typeof t.getTagName == "function";
6
6
  }
7
- function n(t) {
7
+ function r(t) {
8
8
  return typeof t == "object" && t !== null && "getStyle" in t && typeof t.getStyle == "function";
9
9
  }
10
10
  function u(t) {
@@ -14,13 +14,13 @@ function g(t) {
14
14
  return typeof t == "object" && t !== null && "tagName" in t && t.tagName === "TD";
15
15
  }
16
16
  function p(t, e) {
17
- return !t || !n(t) ? null : t.getStyle(e);
17
+ return !t || !r(t) ? null : t.getStyle(e);
18
18
  }
19
19
  function N(t) {
20
- return !t || !u(t) ? null : t.parent();
20
+ return !t || !u(t) ? null : t.parent() ?? null;
21
21
  }
22
22
  function l(t, e = "UNKNOWN") {
23
- return t ? a(t) ? t.tagName.toUpperCase() : r(t) ? t.getTagName().toUpperCase() : e : e;
23
+ return t ? a(t) ? t.tagName.toUpperCase() : n(t) ? t.getTagName().toUpperCase() : e : e;
24
24
  }
25
25
  const f = /* @__PURE__ */ new Set(["TD", "BLOCK_IMAGE", "BLOCK_BUTTON"]);
26
26
  function i(t) {
@@ -36,7 +36,7 @@ function s(t) {
36
36
  export {
37
37
  s as getTableDisplayValue,
38
38
  l as getTagName,
39
- n as hasGetStyle,
39
+ r as hasGetStyle,
40
40
  u as hasParent,
41
41
  c as isTableCellNode,
42
42
  i as isTableCellTag,
@@ -1,35 +1,34 @@
1
- import { SettingsPanelRegistry as e, SettingsPanelTab as N, SettingsTab as t, TextControls as O } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { SettingsPanelRegistry as e, SettingsPanelTab as O, SettingsTab as t, TextControls as N } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { UNSUBSCRIBE_BLOCK_ID as I } from "./block.js";
3
3
  import { UNSUBSCRIBE_CONTROL_ID as _ } from "./control.js";
4
- class R extends e {
4
+ class o extends e {
5
5
  registerBlockControls(T) {
6
6
  T[I] = [
7
- new N(
7
+ new O(
8
8
  t.SETTINGS,
9
9
  [
10
10
  _,
11
- O.FORMAT,
12
- O.ALIGN,
13
- O.LINE_HEIGHT,
14
- O.DIRECTION,
15
- O.INTERNAL_INDENTS,
16
- O.HIDDEN_NODE
11
+ N.FORMAT,
12
+ N.ALIGN,
13
+ N.LINE_HEIGHT,
14
+ N.DIRECTION,
15
+ N.INTERNAL_INDENTS,
16
+ N.HIDDEN_NODE
17
17
  ]
18
18
  ),
19
- new N(
19
+ new O(
20
20
  t.STYLES,
21
21
  [
22
- O.TEXT_BLOCK_BACKGROUND_COLOR,
23
- O.FONT_FAMILY,
24
- O.FONT_SIZE,
25
- O.FONT_COLOR,
26
- O.FONT_BACKGROUND_COLOR,
27
- O.LINKS_COLOR
22
+ N.TEXT_BLOCK_BACKGROUND_COLOR,
23
+ N.FONT_FAMILY,
24
+ N.FONT_SIZE,
25
+ N.FONT_COLOR,
26
+ N.FONT_BACKGROUND_COLOR
28
27
  ]
29
28
  )
30
29
  ];
31
30
  }
32
31
  }
33
32
  export {
34
- R as SettingsPanel
33
+ o as SettingsPanel
35
34
  };