@useinsider/guido 3.17.0 → 3.18.0

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 (110) hide show
  1. package/README.md +6 -5
  2. package/dist/@types/config/schemas.js +7 -6
  3. package/dist/components/Guido.vue.js +10 -10
  4. package/dist/components/Guido.vue2.js +82 -76
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +21 -0
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +106 -0
  7. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.js +17 -0
  8. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +57 -0
  9. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +19 -0
  10. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +63 -0
  11. package/dist/composables/useCustomInterfaceAppearance.js +52 -38
  12. package/dist/composables/useModuleRepair.js +33 -0
  13. package/dist/composables/useRecommendation.js +41 -34
  14. package/dist/composables/useSave.js +30 -29
  15. package/dist/composables/useStripo.js +15 -15
  16. package/dist/composables/useSyncModuleExtractor.js +15 -13
  17. package/dist/composables/validators/useSyncModuleBlockValidator.js +24 -0
  18. package/dist/config/i18n/en/labels.json.js +1 -1
  19. package/dist/config/migrator/index.js +9 -8
  20. package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
  21. package/dist/config/migrator/recommendation/extractors.js +29 -24
  22. package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
  23. package/dist/config/migrator/recommendation/settingsMapper.js +17 -17
  24. package/dist/config/migrator/recommendationMigrator.js +31 -25
  25. package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
  26. package/dist/enums/academy.js +2 -1
  27. package/dist/enums/date.js +5 -3
  28. package/dist/enums/extensions/recommendationBlock.js +3 -1
  29. package/dist/extensions/Blocks/Items/block.js +118 -49
  30. package/dist/extensions/Blocks/Items/constants/currency.js +25 -0
  31. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
  32. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
  33. package/dist/extensions/Blocks/Items/template.js +153 -152
  34. package/dist/extensions/Blocks/Items/utils/constants.js +4 -0
  35. package/dist/extensions/Blocks/Recommendation/block.js +35 -29
  36. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  37. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  38. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +29 -27
  39. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +35 -28
  40. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +309 -236
  41. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +241 -180
  42. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +124 -0
  43. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
  44. package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
  45. package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
  46. package/dist/extensions/Blocks/Recommendation/services/configService.js +54 -36
  47. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
  48. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +175 -79
  49. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
  50. package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
  51. package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
  52. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +22 -0
  53. package/dist/extensions/Blocks/Recommendation/utils/recommendationBlockCount.js +10 -6
  54. package/dist/extensions/Blocks/common-control.js +22 -19
  55. package/dist/guido.css +1 -1
  56. package/dist/services/recommendationApi.js +69 -30
  57. package/dist/src/@types/config/schemas.d.ts +2 -0
  58. package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +3 -0
  59. package/dist/src/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.d.ts +2 -0
  60. package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +15 -0
  61. package/dist/src/composables/useConfig.d.ts +2 -0
  62. package/dist/src/composables/useModuleRepair.d.ts +18 -0
  63. package/dist/src/composables/useRecommendation.d.ts +1 -0
  64. package/dist/src/composables/useSyncModuleExtractor.d.ts +2 -0
  65. package/dist/src/composables/validators/useSyncModuleBlockValidator.d.ts +3 -0
  66. package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
  67. package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
  68. package/dist/src/enums/academy.d.ts +1 -0
  69. package/dist/src/enums/date.d.ts +1 -0
  70. package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
  71. package/dist/src/extensions/Blocks/Items/block.d.ts +35 -0
  72. package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +43 -0
  73. package/dist/src/extensions/Blocks/Items/utils/constants.d.ts +6 -0
  74. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
  75. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
  76. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +3 -6
  77. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +2 -2
  78. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -0
  79. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +11 -0
  80. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
  81. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +44 -8
  82. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +16 -0
  83. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
  84. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
  85. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +12 -1
  86. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +176 -10
  87. package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
  88. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +7 -0
  89. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +31 -0
  90. package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.d.ts +6 -2
  91. package/dist/src/extensions/Blocks/common-control.d.ts +4 -1
  92. package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
  93. package/dist/src/services/recommendationApi.d.ts +4 -1
  94. package/dist/src/stores/config.d.ts +18 -0
  95. package/dist/src/stores/save-as-template.d.ts +4 -3
  96. package/dist/src/utils/genericUtil.d.ts +5 -0
  97. package/dist/src/utils/itemsCurrencyRepair.d.ts +17 -0
  98. package/dist/static/assets/icons/line-change.svg.js +5 -0
  99. package/dist/static/assets/icons/line-delete.svg.js +5 -0
  100. package/dist/static/assets/icons/line-plus.svg.js +5 -0
  101. package/dist/static/styles/components/recommendation-strategy.css.js +155 -0
  102. package/dist/static/styles/customEditorStyle.css.js +3 -1
  103. package/dist/utils/dateUtil.js +23 -10
  104. package/dist/utils/genericUtil.js +28 -27
  105. package/dist/utils/itemsCurrencyRepair.js +39 -0
  106. package/dist/utils/pairProductVariables.js +58 -58
  107. package/dist/utils/templatePreparation.js +35 -34
  108. package/package.json +3 -2
  109. package/dist/composables/useModuleDynamicContentRepair.js +0 -37
  110. package/dist/src/composables/useModuleDynamicContentRepair.d.ts +0 -13
@@ -1,17 +1,18 @@
1
1
  import { RecommendationBlockId as g } from "../../../extensions/Blocks/Recommendation/constants/blockIds.js";
2
- import { CSS_CLASS_SKIP_COMPILE as st, CURRENCY_ATTR as _, ATTR_PRODUCT_IMAGE as I, ATTR_PRODUCT_BUTTON as O, CSS_CLASS_RECO_BUTTON as z, ATTR_PRODUCT_NAME as H, ATTR_PRODUCT_PRICE as j, ATTR_PRODUCT_OLD_PRICE as V, ATTR_PRODUCT_OMNIBUS_PRICE as L, ATTR_PRODUCT_OMNIBUS_DISCOUNT as Y, ATTR_CUSTOM_PREFIX as F } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
3
- import { compositionKeyToProductAttr as K, bareAttributeName as J } from "../../../extensions/Blocks/Recommendation/utils/compositionKeys.js";
2
+ import { CSS_CLASS_SKIP_COMPILE as st, ATTR_RECOMMENDATION_TITLE as lt, CURRENCY_ATTR as R, ATTR_PRODUCT_IMAGE as I, ATTR_PRODUCT_BUTTON as O, CSS_CLASS_RECO_BUTTON as H, ATTR_PRODUCT_NAME as j, ATTR_PRODUCT_PRICE as V, ATTR_PRODUCT_OLD_PRICE as Y, ATTR_PRODUCT_OMNIBUS_PRICE as M, ATTR_PRODUCT_OMNIBUS_DISCOUNT as F, ATTR_CUSTOM_PREFIX as K } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
3
+ import { buildTitleRows as it } from "../../../extensions/Blocks/Recommendation/templates/titleRows.js";
4
+ import { compositionKeyToProductAttr as J, bareAttributeName as X } from "../../../extensions/Blocks/Recommendation/utils/compositionKeys.js";
4
5
  import { formatPrice as B } from "../../../extensions/Blocks/Recommendation/utils/priceFormatter.js";
5
6
  import { escapeHtml as r } from "../../../utils/htmlEscape.js";
6
7
  import { appendStyle as $ } from "./themeMapper.js";
7
- const X = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png", q = "attribute-cell", Q = "Buy", Z = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79)", W = "color: rgb(56, 118, 29); background: rgb(217, 234, 211); font-family: arial, 'helvetica neue', helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 120%; mso-border-alt: 10px solid rgb(217, 234, 211); mso-padding-alt: 0", lt = "ins-recommendation-product-container ins-recommendation-desktop-container";
8
- function it(t) {
8
+ const q = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png", Q = "attribute-cell", Z = "Buy", W = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79)", tt = "color: rgb(56, 118, 29); background: rgb(217, 234, 211); font-family: arial, 'helvetica neue', helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 120%; mso-border-alt: 10px solid rgb(217, 234, 211); mso-padding-alt: 0", rt = "ins-recommendation-product-container ins-recommendation-desktop-container";
9
+ function ct(t) {
9
10
  return t.replace(/>\s+</g, "><").trim();
10
11
  }
11
- function y(t) {
12
+ function f(t) {
12
13
  return t ? ` align="${r(t)}"` : ' align="center"';
13
14
  }
14
- function R() {
15
+ function _() {
15
16
  return {
16
17
  tdStyle: "",
17
18
  pStyle: "",
@@ -20,25 +21,25 @@ function R() {
20
21
  textTrimming: !1
21
22
  };
22
23
  }
23
- function tt(t) {
24
- return t ? { ...t, wrapBold: !0 } : { ...R(), wrapBold: !0 };
24
+ function et(t) {
25
+ return t ? { ...t, wrapBold: !0 } : { ..._(), wrapBold: !0 };
25
26
  }
26
- function k(t, o) {
27
+ function N(t, o) {
27
28
  let e = r(t);
28
29
  return o.wrapBold && o.wrapItalic ? e = `<strong><em>${e}</em></strong>` : o.wrapBold ? e = `<strong>${e}</strong>` : o.wrapItalic && (e = `<em>${e}</em>`), e;
29
30
  }
30
31
  function u(t) {
31
32
  return t ? ` style="${r(t)}"` : "";
32
33
  }
33
- function E(t, o) {
34
- return `<td width="${t}%" class="${q}" ${o}`;
34
+ function P(t, o) {
35
+ return `<td width="${t}%" class="${Q}" ${o}`;
35
36
  }
36
- function rt(t, o, e, s) {
37
+ function at(t, o, e, s) {
37
38
  const l = t.width ? ` width="${t.width}"` : "", n = t.height ? ` height="${t.height}"` : "", i = ["display: block", "max-width: 100%", "height: auto"];
38
39
  t.width && i.push(`width: ${t.width}px`), t.height && i.push(`height: ${t.height}px`);
39
40
  const c = i.join("; "), a = e ? ` style="background-color: ${r(e)}"` : "";
40
41
  return `
41
- ${E(s, 'valign="top" style="padding: 0 5px; height: 100%"')}>
42
+ ${P(s, 'valign="top" style="padding: 0 5px; height: 100%"')}>
42
43
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
43
44
  class="product-card-segment"${a}>
44
45
  <tbody>
@@ -47,7 +48,7 @@ function rt(t, o, e, s) {
47
48
  class="esd-block-image product-image es-p5"
48
49
  esd-extension-block-id="${g.IMAGE}">
49
50
  <a target="_blank" href="https://example.com/product/${o + 1}">
50
- <img src="${X}" alt="Product Name"
51
+ <img src="${q}" alt="Product Name"
51
52
  class="adapt-img"${l}${n}
52
53
  style="${c}">
53
54
  </a>
@@ -58,10 +59,10 @@ function rt(t, o, e, s) {
58
59
  </td>
59
60
  `;
60
61
  }
61
- function D(t, o, e, s, l, n, i) {
62
- const a = `table-layout: fixed${n ? `; background-color: ${r(n)}` : ""}`, d = u(l.tdStyle), p = y(l.align), b = `esd-block-text ${o}`.trim(), m = $(s, l.pStyle);
62
+ function G(t, o, e, s, l, n, i) {
63
+ const a = `table-layout: fixed${n ? `; background-color: ${r(n)}` : ""}`, d = u(l.tdStyle), p = f(l.align), b = `esd-block-text ${o}`.trim(), m = $(s, l.pStyle);
63
64
  return `
64
- ${E(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
65
+ ${P(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
65
66
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
66
67
  class="product-card-segment" style="${a}">
67
68
  <tbody>
@@ -69,7 +70,7 @@ function D(t, o, e, s, l, n, i) {
69
70
  <td${p}
70
71
  class="${b}"
71
72
  esd-extension-block-id="${t}"${d}>
72
- <p contenteditable="false"${u(m)}>${k(e, l)}</p>
73
+ <p contenteditable="false"${u(m)}>${N(e, l)}</p>
73
74
  </td>
74
75
  </tr>
75
76
  </tbody>
@@ -77,10 +78,10 @@ function D(t, o, e, s, l, n, i) {
77
78
  </td>
78
79
  `;
79
80
  }
80
- function ct(t, o, e, s) {
81
- const l = o ? ` style="background-color: ${r(o)}"` : "", n = u(t.tdStyle), i = y(t.align), a = $("font-size: 14px; color: #999999", t.pStyle);
81
+ function dt(t, o, e, s) {
82
+ const l = o ? ` style="background-color: ${r(o)}"` : "", n = u(t.tdStyle), i = f(t.align), a = $("font-size: 14px; color: #999999", t.pStyle);
82
83
  return `
83
- ${E(e, 'valign="top" style="padding: 0 5px; height: 100%"')}>
84
+ ${P(e, 'valign="top" style="padding: 0 5px; height: 100%"')}>
84
85
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
85
86
  class="product-card-segment"${l}>
86
87
  <tbody>
@@ -89,7 +90,7 @@ function ct(t, o, e, s) {
89
90
  class="esd-block-text product-old-price es-p15l es-p15r"
90
91
  esd-extension-block-id="${g.OLD_PRICE}"${n}>
91
92
  <p contenteditable="false"${u(a)}>
92
- <s>${k(s, t)}</s>
93
+ <s>${N(s, t)}</s>
93
94
  </p>
94
95
  </td>
95
96
  </tr>
@@ -98,10 +99,10 @@ function ct(t, o, e, s) {
98
99
  </td>
99
100
  `;
100
101
  }
101
- function G(t, o, e, s, l, n, i) {
102
- const c = l ? `; background-color: ${r(l)}` : "", a = u(s.tdStyle), d = y(s.align), b = $("font-size: 12px; color: #666666", s.pStyle);
102
+ function z(t, o, e, s, l, n, i) {
103
+ const c = l ? `; background-color: ${r(l)}` : "", a = u(s.tdStyle), d = f(s.align), b = $("font-size: 12px; color: #666666", s.pStyle);
103
104
  return `
104
- ${E(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
105
+ ${P(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
105
106
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
106
107
  class="product-card-segment" style="table-layout: fixed${c}">
107
108
  <tbody>
@@ -122,10 +123,10 @@ function G(t, o, e, s, l, n, i) {
122
123
  </td>
123
124
  `;
124
125
  }
125
- function at(t, o, e, s) {
126
- const l = e ? ` style="background-color: ${r(e)}"` : "", n = $("padding: 0 5px; height: 100%", o.tdStyle), i = y(o.align), c = o.text || Q, a = $(Z, o.spanStyle), d = $(W, o.aStyle);
126
+ function pt(t, o, e, s) {
127
+ const l = e ? ` style="background-color: ${r(e)}"` : "", n = $("padding: 0 5px; height: 100%", o.tdStyle), i = f(o.align), c = o.text || Z, a = $(W, o.spanStyle), d = $(tt, o.aStyle);
127
128
  return `
128
- ${E(s, `valign="top" style="${r(n)}"`)}>
129
+ ${P(s, `valign="top" style="${r(n)}"`)}>
129
130
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
130
131
  class="product-card-segment"${l}>
131
132
  <tbody>
@@ -135,7 +136,7 @@ function at(t, o, e, s) {
135
136
  esd-extension-block-id="${g.BUTTON}">
136
137
  <span class="es-button-border" style="${r(a)}">
137
138
  <a href="https://example.com/product/${t + 1}" target="_blank"
138
- class="es-button ${z}"
139
+ class="es-button ${H}"
139
140
  style="${r(d)}">${r(c)}</a>
140
141
  </span>
141
142
  </td>
@@ -145,10 +146,10 @@ function at(t, o, e, s) {
145
146
  </td>
146
147
  `;
147
148
  }
148
- function dt(t, o, e, s, l) {
149
- const n = s ? `; background-color: ${r(s)}` : "", i = u(e.tdStyle), c = y(e.align), d = $("font-size: 12px; color: #666666; margin: 0", e.pStyle), p = o.replace(/_/g, " ").replace(/\b\w/g, (b) => b.toUpperCase());
149
+ function ut(t, o, e, s, l) {
150
+ const n = s ? `; background-color: ${r(s)}` : "", i = u(e.tdStyle), c = f(e.align), d = $("font-size: 12px; color: #666666; margin: 0", e.pStyle), p = o.replace(/_/g, " ").replace(/\b\w/g, (b) => b.toUpperCase());
150
151
  return `
151
- ${E(l, 'valign="middle" style="padding: 0 5px; height: 100%"')}>
152
+ ${P(l, 'valign="middle" style="padding: 0 5px; height: 100%"')}>
152
153
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
153
154
  class="product-card-segment" style="table-layout: fixed${n}">
154
155
  <tbody>
@@ -164,18 +165,18 @@ function dt(t, o, e, s, l) {
164
165
  </td>
165
166
  `;
166
167
  }
167
- function pt(t, o, e, s, l, n, i) {
168
- const c = o[t], a = c ?? R();
168
+ function bt(t, o, e, s, l, n, i) {
169
+ const c = o[t], a = c ?? _();
169
170
  switch (t) {
170
171
  case I:
171
- return rt(
172
+ return at(
172
173
  c ?? {},
173
174
  l,
174
175
  s,
175
176
  n
176
177
  );
177
- case H:
178
- return D(
178
+ case j:
179
+ return G(
179
180
  g.NAME,
180
181
  "product-name es-p10t es-p10b es-p15l es-p15r",
181
182
  "Product Name",
@@ -184,20 +185,20 @@ function pt(t, o, e, s, l, n, i) {
184
185
  s,
185
186
  n
186
187
  );
187
- case j:
188
- return D(
188
+ case V:
189
+ return G(
189
190
  g.PRICE,
190
191
  "product-price es-p15l es-p15r",
191
192
  i.pricePlaceholder,
192
193
  "font-size: 16px; color: #333333",
193
- tt(c),
194
+ et(c),
194
195
  s,
195
196
  n
196
197
  );
197
- case V:
198
- return ct(a, s, n, i.oldPricePlaceholder);
199
- case L:
200
- return G(
198
+ case Y:
199
+ return dt(a, s, n, i.oldPricePlaceholder);
200
+ case M:
201
+ return z(
201
202
  g.OMNIBUS_PRICE,
202
203
  "omnibus-price-value",
203
204
  i.omnibusPricePlaceholder,
@@ -206,8 +207,8 @@ function pt(t, o, e, s, l, n, i) {
206
207
  "product-omnibus-price",
207
208
  n
208
209
  );
209
- case Y:
210
- return G(
210
+ case F:
211
+ return z(
211
212
  g.OMNIBUS_DISCOUNT,
212
213
  "omnibus-discount-value",
213
214
  "-10%",
@@ -217,57 +218,57 @@ function pt(t, o, e, s, l, n, i) {
217
218
  n
218
219
  );
219
220
  case O:
220
- return at(
221
+ return pt(
221
222
  l,
222
223
  c ?? {},
223
224
  s,
224
225
  n
225
226
  );
226
227
  default:
227
- if (t.startsWith(F)) {
228
- const d = e[t] ?? K(t), p = J(d);
229
- return dt(d, p, a, s, n);
228
+ if (t.startsWith(K)) {
229
+ const d = e[t] ?? J(t), p = X(d);
230
+ return ut(d, p, a, s, n);
230
231
  }
231
232
  return null;
232
233
  }
233
234
  }
234
- const et = `
235
+ const ot = `
235
236
  <tr>
236
237
  <td class="spacer" style="height: 10px"></td>
237
238
  </tr>
238
239
  `;
239
- function ut(t) {
240
+ function gt(t) {
240
241
  return {
241
242
  pricePlaceholder: B({ price: 18, currency: t }),
242
243
  oldPricePlaceholder: B({ price: 20, currency: t }),
243
244
  omnibusPricePlaceholder: B({ price: 20, currency: t })
244
245
  };
245
246
  }
246
- function bt(t, o, e, s) {
247
- const { composition: l, visibility: n, perElement: i, customAttrValues: c, cardBg: a } = s, d = (100 / e).toFixed(2), p = e - o, b = `<td class="${q}" style="padding: 0 5px;" width="${d}%"></td>`, m = p > 0 ? b.repeat(p) : "";
247
+ function mt(t, o, e, s) {
248
+ const { composition: l, visibility: n, perElement: i, customAttrValues: c, cardBg: a } = s, d = (100 / e).toFixed(2), p = e - o, b = `<td class="${Q}" style="padding: 0 5px;" width="${d}%"></td>`, m = p > 0 ? b.repeat(p) : "";
248
249
  return `
249
250
  <tr class="recommendation-product-row">
250
251
  <td>
251
252
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
252
253
  class="product-card-wrapper" style="table-layout: fixed">
253
- <tbody>${l.map((T) => {
254
- const C = n[T] !== !1, f = C ? "" : ' style="display: none"', w = C ? "1" : "0", x = [];
255
- for (let A = 0; A < o; A += 1) {
256
- const P = pt(
257
- T,
254
+ <tbody>${l.map((w) => {
255
+ const C = n[w] !== !1, S = C ? "" : ' style="display: none"', A = C ? "1" : "0", x = [];
256
+ for (let T = 0; T < o; T += 1) {
257
+ const E = bt(
258
+ w,
258
259
  i,
259
260
  c,
260
261
  a,
261
- t + A,
262
+ t + T,
262
263
  d,
263
264
  s
264
265
  );
265
- P && x.push(P);
266
+ E && x.push(E);
266
267
  }
267
268
  return x.length === 0 ? "" : `
268
269
  <tr class="recommendation-attribute-row"
269
- data-attribute-type="${r(T)}"
270
- data-visibility="${w}"${f}>
270
+ data-attribute-type="${r(w)}"
271
+ data-visibility="${A}"${S}>
271
272
  ${x.join("")}${m}
272
273
  </tr>
273
274
  `;
@@ -277,45 +278,45 @@ function bt(t, o, e, s) {
277
278
  </tr>
278
279
  `;
279
280
  }
280
- function gt(t, o, e) {
281
+ function $t(t, o, e) {
281
282
  const s = [];
282
283
  for (let l = 0; l < t; l += o) {
283
284
  const n = Math.min(o, t - l);
284
- l > 0 && s.push(et), s.push(bt(l, n, o, e));
285
+ l > 0 && s.push(ot), s.push(mt(l, n, o, e));
285
286
  }
286
287
  return s.join("");
287
288
  }
288
- function mt(t, o, e, s) {
289
+ function ft(t, o, e, s) {
289
290
  const l = o[t];
290
- if (t === H) {
291
- const n = l ?? R(), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), c = y(n.align ?? "left");
291
+ if (t === j) {
292
+ const n = l ?? _(), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), c = f(n.align ?? "left");
292
293
  return `
293
294
  <td class="esd-block-text product-name"
294
295
  esd-extension-block-id="${g.NAME}"${c}${u(n.tdStyle)}>
295
- <p contenteditable="false"${u(i)}>${k("Product Name", n)}</p>
296
+ <p contenteditable="false"${u(i)}>${N("Product Name", n)}</p>
296
297
  </td>
297
298
  `;
298
299
  }
299
- if (t === j) {
300
- const n = tt(l), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), c = y(n.align ?? "left");
300
+ if (t === V) {
301
+ const n = et(l), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), c = f(n.align ?? "left");
301
302
  return `
302
303
  <td class="esd-block-text product-price"
303
304
  esd-extension-block-id="${g.PRICE}"${c}${u(n.tdStyle)}>
304
- <p contenteditable="false"${u(i)}>${k(s.pricePlaceholder, n)}</p>
305
+ <p contenteditable="false"${u(i)}>${N(s.pricePlaceholder, n)}</p>
305
306
  </td>
306
307
  `;
307
308
  }
308
- if (t === V) {
309
- const n = l ?? R(), c = $("font-size: 14px; color: #999999; text-decoration: line-through; margin: 0", n.pStyle), a = y(n.align ?? "left");
309
+ if (t === Y) {
310
+ const n = l ?? _(), c = $("font-size: 14px; color: #999999; text-decoration: line-through; margin: 0", n.pStyle), a = f(n.align ?? "left");
310
311
  return `
311
312
  <td class="esd-block-text product-old-price"
312
313
  esd-extension-block-id="${g.OLD_PRICE}"${a}${u(n.tdStyle)}>
313
- <p contenteditable="false"${u(c)}><s>${k(s.oldPricePlaceholder, n)}</s></p>
314
+ <p contenteditable="false"${u(c)}><s>${N(s.oldPricePlaceholder, n)}</s></p>
314
315
  </td>
315
316
  `;
316
317
  }
317
- if (t === L || t === Y) {
318
- const n = t === L, i = n ? g.OMNIBUS_PRICE : g.OMNIBUS_DISCOUNT, c = n ? "omnibus-price-value" : "omnibus-discount-value", a = n ? s.omnibusPricePlaceholder : "-10%", d = n ? "product-omnibus-price" : "product-omnibus-discount", p = l ?? R(), b = $("font-size: 12px; color: #666666; margin: 0", p.pStyle), m = y(p.align ?? "left");
318
+ if (t === M || t === F) {
319
+ const n = t === M, i = n ? g.OMNIBUS_PRICE : g.OMNIBUS_DISCOUNT, c = n ? "omnibus-price-value" : "omnibus-discount-value", a = n ? s.omnibusPricePlaceholder : "-10%", d = n ? "product-omnibus-price" : "product-omnibus-discount", p = l ?? _(), b = $("font-size: 12px; color: #666666; margin: 0", p.pStyle), m = f(p.align ?? "left");
319
320
  return `
320
321
  <td class="esd-block-text ${d}"
321
322
  data-text-before="" data-text-after=""
@@ -328,8 +329,8 @@ function mt(t, o, e, s) {
328
329
  </td>
329
330
  `;
330
331
  }
331
- if (t.startsWith(F)) {
332
- const n = l ?? R(), i = e[t] ?? K(t), a = J(i).replace(/_/g, " ").replace(/\b\w/g, (m) => m.toUpperCase()), d = $("font-size: 12px; color: #666666; margin: 0", n.pStyle), p = y(n.align ?? "left"), b = g.CUSTOM_ATTRIBUTE;
332
+ if (t.startsWith(K)) {
333
+ const n = l ?? _(), i = e[t] ?? J(t), a = X(i).replace(/_/g, " ").replace(/\b\w/g, (m) => m.toUpperCase()), d = $("font-size: 12px; color: #666666; margin: 0", n.pStyle), p = f(n.align ?? "left"), b = g.CUSTOM_ATTRIBUTE;
333
334
  return `
334
335
  <td product-attr="${r(i)}"
335
336
  class="esd-block-text product-custom-attribute"
@@ -340,8 +341,8 @@ function mt(t, o, e, s) {
340
341
  }
341
342
  return null;
342
343
  }
343
- function $t(t, o) {
344
- const { composition: e, visibility: s, perElement: l, customAttrValues: n, cardBg: i } = o, c = i ? `background-color: ${r(i)}` : "", a = c ? `style="table-layout: fixed; ${c}"` : 'style="table-layout: fixed"', d = l[I] ?? {}, p = s[I] !== !1, b = d.width ? ` width="${d.width}"` : "", m = p ? "" : ' style="display: none"', S = `
344
+ function yt(t, o) {
345
+ const { composition: e, visibility: s, perElement: l, customAttrValues: n, cardBg: i } = o, c = i ? `background-color: ${r(i)}` : "", a = c ? `style="table-layout: fixed; ${c}"` : 'style="table-layout: fixed"', d = l[I] ?? {}, p = s[I] !== !1, b = d.width ? ` width="${d.width}"` : "", m = p ? "" : ' style="display: none"', h = `
345
346
  <td width="120"
346
347
  class="esd-block-image product-image-cell recommendation-attribute-row es-p5"
347
348
  esd-extension-block-id="${g.IMAGE}"
@@ -349,7 +350,7 @@ function $t(t, o) {
349
350
  data-visibility="${p ? "1" : "0"}"
350
351
  align="center" valign="middle"${m}>
351
352
  <a target="_blank" href="https://example.com/product/${t + 1}">
352
- <img src="${X}" alt="Product Name"
353
+ <img src="${q}" alt="Product Name"
353
354
  class="adapt-img product-image"${b}
354
355
  style="display: block; max-width: 100%; height: auto">
355
356
  </a>
@@ -358,26 +359,26 @@ function $t(t, o) {
358
359
  <td class="product-info-cell" valign="middle" style="padding: 15px">
359
360
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%"
360
361
  style="table-layout: fixed">
361
- <tbody>${e.filter((h) => h !== I && h !== O).map((h) => {
362
- const U = s[h] !== !1, ot = U ? "" : ' style="display: none"', nt = U ? "1" : "0", M = mt(h, l, n, o);
363
- return M ? `<tr class="recommendation-attribute-row"
364
- data-attribute-type="${r(h)}"
365
- data-visibility="${nt}"${ot}>${M}</tr>` : "";
362
+ <tbody>${e.filter((y) => y !== I && y !== O).map((y) => {
363
+ const v = s[y] !== !1, L = v ? "" : ' style="display: none"', nt = v ? "1" : "0", D = ft(y, l, n, o);
364
+ return D ? `<tr class="recommendation-attribute-row"
365
+ data-attribute-type="${r(y)}"
366
+ data-visibility="${nt}"${L}>${D}</tr>` : "";
366
367
  }).filter(Boolean).join(`
367
368
  `)}</tbody>
368
369
  </table>
369
370
  </td>
370
- `, f = l[O] ?? {}, w = s[O] !== !1, x = f.text || Q, A = $(Z, f.spanStyle ?? ""), P = $(W, f.aStyle ?? ""), N = w ? "" : ' style="display: none"', v = `
371
+ `, S = l[O] ?? {}, A = s[O] !== !1, x = S.text || Z, T = $(W, S.spanStyle ?? ""), E = $(tt, S.aStyle ?? ""), U = A ? "" : ' style="display: none"', k = `
371
372
  <td width="100"
372
373
  class="esd-block-button button-cell recommendation-attribute-row product-button es-p5l es-p5r"
373
374
  esd-extension-block-id="${g.BUTTON}"
374
375
  data-attribute-type="${O}"
375
- data-visibility="${w ? "1" : "0"}"
376
- align="${r(f.align ?? "center")}" valign="middle"${N}>
377
- <span class="es-button-border" style="${r(A)}">
376
+ data-visibility="${A ? "1" : "0"}"
377
+ align="${r(S.align ?? "center")}" valign="middle"${U}>
378
+ <span class="es-button-border" style="${r(T)}">
378
379
  <a href="https://example.com/product/${t + 1}" target="_blank"
379
- class="es-button ${z}"
380
- style="${r(P)}">${r(x)}</a>
380
+ class="es-button ${H}"
381
+ style="${r(E)}">${r(x)}</a>
381
382
  </span>
382
383
  </td>
383
384
  `;
@@ -387,35 +388,31 @@ function $t(t, o) {
387
388
  <table width="100%" cellpadding="0" cellspacing="0" border="0"
388
389
  class="product-card-wrapper" ${a}>
389
390
  <tbody>
390
- <tr>${S}${C}${v}</tr>
391
+ <tr>${h}${C}${k}</tr>
391
392
  </tbody>
392
393
  </table>
393
394
  </td>
394
395
  </tr>
395
396
  `;
396
397
  }
397
- function yt(t, o) {
398
+ function St(t, o) {
398
399
  const e = [];
399
400
  for (let s = 0; s < t; s += 1)
400
- s > 0 && e.push(et), e.push($t(s, o));
401
+ s > 0 && e.push(ot), e.push(yt(s, o));
401
402
  return e.join("");
402
403
  }
403
- function ft(t, o) {
404
- var a, d, p, b, m, S;
404
+ function ht(t, o) {
405
+ var a, d, p, b, m, h;
405
406
  const e = t == null ? void 0 : t.theme, s = [];
406
407
  (a = e == null ? void 0 : e.textStyle) != null && a["font-family"] && s.push(`font-family: ${e.textStyle["font-family"]}`), s.push(`font-size: ${((d = e == null ? void 0 : e.textStyle) == null ? void 0 : d["font-size"]) ?? "28px"}`), s.push(`color: ${((p = e == null ? void 0 : e.textColor) == null ? void 0 : p.color) ?? "#333333"}`), (b = e == null ? void 0 : e.textStyle) != null && b["font-weight"] && s.push(`font-weight: ${e.textStyle["font-weight"]}`), (m = e == null ? void 0 : e.textStyle) != null && m["font-style"] && s.push(`font-style: ${e.textStyle["font-style"]}`);
407
- const l = s.join("; "), n = ((S = e == null ? void 0 : e.textStyle) == null ? void 0 : S["font-weight"]) !== "normal", i = r(o), c = n ? `<strong>${i}</strong>` : i;
408
- return `
409
- <td class="esd-block-text es-p10t es-p10b es-p20l es-p20r" align="center">
410
- <p${u(l)}>${c}</p>
411
- </td>
412
- `;
408
+ const l = s.join("; "), n = ((h = e == null ? void 0 : e.textStyle) == null ? void 0 : h["font-weight"]) !== "normal", i = r(o), c = n ? `<strong>${i}</strong>` : i;
409
+ return `<p${u(l)}>${c}</p>`;
413
410
  }
414
- function ht(t) {
411
+ function xt(t) {
415
412
  const o = t.alignment === "before" ? "0" : "1";
416
- return ` ${_.CURRENCY}="${r(t.code)}" ${_.SYMBOL}="${r(t.symbol)}" ${_.ALIGNMENT}="${o}" ${_.THOUSAND_SEPARATOR}="${r(t.thousandSeparator)}" ${_.DECIMAL_SEPARATOR}="${r(t.decimalSeparator)}" ${_.DECIMAL_COUNT}="${t.decimalCount}"`;
413
+ return ` ${R.CURRENCY}="${r(t.code)}" ${R.SYMBOL}="${r(t.symbol)}" ${R.ALIGNMENT}="${o}" ${R.THOUSAND_SEPARATOR}="${r(t.thousandSeparator)}" ${R.DECIMAL_SEPARATOR}="${r(t.decimalSeparator)}" ${R.DECIMAL_COUNT}="${t.decimalCount}"`;
417
414
  }
418
- function Pt(t) {
415
+ function Et(t) {
419
416
  const {
420
417
  nodeConfig: o,
421
418
  composition: e,
@@ -426,7 +423,7 @@ function Pt(t) {
426
423
  legacyBgColor: c,
427
424
  preserveInnerHtml: a,
428
425
  skipCompile: d = !1
429
- } = t, p = o.layout === "list" ? ' data-layout="list"' : "", b = o.layout === "list" ? " es-m-p0 ins-recommendation-list-layout" : "", m = e.composition.join(","), S = JSON.stringify(e.customAttributes), T = [
426
+ } = t, p = o.layout === "list" ? ' data-layout="list"' : "", b = o.layout === "list" ? " es-m-p0 ins-recommendation-list-layout" : "", m = e.composition.join(","), h = JSON.stringify(e.customAttributes), w = [
430
427
  "recommendation-block-v2",
431
428
  "esd-block-recommendation-v3-block",
432
429
  `es-p20${b}`,
@@ -440,15 +437,15 @@ function Pt(t) {
440
437
  "ins-recommendation-no-mobile-layout",
441
438
  d ? st : "",
442
439
  n
443
- ].filter(Boolean).join(" "), C = ht(o.currency), f = ` esd-ext-config="${r(JSON.stringify(o))}"`, w = i ? ` id="${r(i)}"` : "", x = c ? ` bgcolor="${r(c)}"` : "", P = a ?? (() => {
444
- const N = parseInt(o.size) || 6, v = {
440
+ ].filter(Boolean).join(" "), C = xt(o.currency), S = o.visibility[lt] !== !1, A = ` esd-ext-config="${r(JSON.stringify(o))}"`, x = i ? ` id="${r(i)}"` : "", T = c ? ` bgcolor="${r(c)}"` : "", U = a ?? (() => {
441
+ const k = parseInt(o.size) || 6, y = {
445
442
  composition: e.composition,
446
443
  visibility: e.visibility,
447
444
  perElement: e.perElementStyles,
448
445
  customAttrValues: e.customAttrValues,
449
446
  cardBg: s,
450
- ...ut(o.currency)
451
- }, h = o.layout === "list" ? yt(N, v) : gt(N, o.cardsInRow, v);
447
+ ...gt(o.currency)
448
+ }, v = o.layout === "list" ? St(k, y) : $t(k, o.cardsInRow, y);
452
449
  return `
453
450
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
454
451
  <tbody>
@@ -456,22 +453,11 @@ function Pt(t) {
456
453
  <td align="center">
457
454
  <table class="container" width="100%" cellpadding="0" cellspacing="0" border="0">
458
455
  <tbody>
459
- <tr>
460
- <td>
461
- <table width="100%" cellpadding="0" cellspacing="0" border="0">
462
- <tbody>
463
- <tr>${ft(e.titleVariable, l)}</tr>
464
- </tbody>
465
- </table>
466
- </td>
467
- </tr>
468
- <tr>
469
- <td class="spacer" style="height: ${o.rowSpacing}px"></td>
470
- </tr>
456
+ ${S ? it(ht(e.titleVariable, l), !0, o.rowSpacing) : ""}
471
457
  <tr>
472
458
  <td>
473
459
  <table width="100%" cellpadding="0" cellspacing="0" border="0"
474
- class="${lt}">${h}
460
+ class="${rt}">${v}
475
461
  </table>
476
462
  </td>
477
463
  </tr>
@@ -483,22 +469,22 @@ function Pt(t) {
483
469
  </tbody>
484
470
  </table>`;
485
471
  })();
486
- return it(`
472
+ return ct(`
487
473
  <td align="left"
488
474
  esd-extension-block-id="recommendation-block"
489
475
  width="520"
490
- class="${T}"${w}${x}
476
+ class="${w}"${x}${T}
491
477
  recommendation-id="${o.recommendationId}"${C}
492
478
  data-card-composition="${r(m)}"
493
- data-custom-attributes="${r(S)}"
479
+ data-custom-attributes="${r(h)}"
494
480
  data-column-spacing="${o.columnSpacing}"
495
481
  data-row-spacing="${o.rowSpacing}"
496
482
  data-mobile-column-spacing="${o.mobileColumnSpacing}"
497
483
  data-mobile-row-spacing="${o.mobileRowSpacing}"
498
- hide-price="${o.priceHideIfSameAsDiscounted}"${p}${f}>${P}
484
+ hide-price="${o.priceHideIfSameAsDiscounted}"${p}${A}>${U}
499
485
  </td>
500
486
  `);
501
487
  }
502
488
  export {
503
- Pt as buildBlockHtml
489
+ Et as buildBlockHtml
504
490
  };
@@ -1,10 +1,10 @@
1
- import { CURRENT_CONFIG_VERSION as s, DEFAULT_CURRENCY as i } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
- import { DEFAULT_CARDS_IN_ROW as m, DEFAULT_MOBILE_ROW_SPACING as p, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as f, DEFAULT_COLUMN_SPACING as S, DEFAULT_MOBILE_CARDS_IN_ROW as a } from "../../../extensions/Blocks/Recommendation/constants/layout.js";
1
+ import { PRE_RRS_CONFIG_VERSION as s, DEFAULT_CURRENCY as i } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
+ import { DEFAULT_CARDS_IN_ROW as m, DEFAULT_MOBILE_ROW_SPACING as p, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as S, DEFAULT_COLUMN_SPACING as f, DEFAULT_MOBILE_CARDS_IN_ROW as a } from "../../../extensions/Blocks/Recommendation/constants/layout.js";
3
3
  import { mapLegacyStrategy as l } from "../../../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
4
4
  function c(t) {
5
5
  return t === "0" || t === 0 ? "before" : "after";
6
6
  }
7
- function I(t) {
7
+ function _(t) {
8
8
  if (typeof t == "number" && Number.isFinite(t))
9
9
  return t;
10
10
  if (typeof t == "string") {
@@ -14,13 +14,13 @@ function I(t) {
14
14
  }
15
15
  return i.decimalCount;
16
16
  }
17
- function _(t) {
17
+ function I(t) {
18
18
  return t === "." || t === "," || t === " " || t === "" ? t : ",";
19
19
  }
20
- function N(t) {
20
+ function A(t) {
21
21
  return t === "." || t === "," || t === " " ? t : ".";
22
22
  }
23
- function A(t) {
23
+ function L(t) {
24
24
  if (!t || typeof t != "object")
25
25
  return { ...i };
26
26
  const o = t, n = o.value ?? o.name ?? i.code, r = o.symbol ?? n;
@@ -28,18 +28,18 @@ function A(t) {
28
28
  code: n,
29
29
  symbol: r,
30
30
  alignment: c(o.alignment),
31
- decimalCount: I(o.decimalCount),
32
- decimalSeparator: N(o.decimalSeparator),
33
- thousandSeparator: _(o.thousandSeparator)
31
+ decimalCount: _(o.decimalCount),
32
+ decimalSeparator: A(o.decimalSeparator),
33
+ thousandSeparator: I(o.thousandSeparator)
34
34
  };
35
35
  }
36
- function L(t) {
36
+ function N(t) {
37
37
  return t === "horizontal" || t === "list" ? "list" : "grid";
38
38
  }
39
39
  function R(t) {
40
40
  return l(t) || "mostPopular";
41
41
  }
42
- function U(t, o, n) {
42
+ function O(t, o, n) {
43
43
  const r = o.rowCount ?? t.cardsInRow ?? m, u = o.totalCount ?? (typeof t.size == "string" ? parseInt(t.size) : t.size) ?? 6;
44
44
  return {
45
45
  recommendationId: n,
@@ -48,15 +48,15 @@ function U(t, o, n) {
48
48
  size: String(u),
49
49
  shuffleProducts: !!t.shuffleProducts,
50
50
  language: t.language ?? "en_US",
51
- currency: A(t.currencySettings),
51
+ currency: L(t.currencySettings),
52
52
  filters: (t.filters ?? []).map((e) => ({ ...e })),
53
- layout: L(t.orientation ?? o.orientation),
53
+ layout: N(t.orientation ?? o.orientation),
54
54
  cardsInRow: r,
55
55
  mobileCardsInRow: a,
56
56
  mobileLayoutEnabled: !1,
57
57
  previousMobileCardsInRow: a,
58
- columnSpacing: S,
59
- rowSpacing: f,
58
+ columnSpacing: f,
59
+ rowSpacing: S,
60
60
  mobileColumnSpacing: d,
61
61
  mobileRowSpacing: p,
62
62
  omnibusPrice: { textBefore: "", textAfter: "" },
@@ -70,6 +70,6 @@ function U(t, o, n) {
70
70
  };
71
71
  }
72
72
  export {
73
- A as mapCurrency,
74
- U as mapSettings
73
+ L as mapCurrency,
74
+ O as mapSettings
75
75
  };