@useinsider/guido 2.1.0-beta.29e4650 → 2.1.0-beta.2d0ecb3

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 (98) hide show
  1. package/README.md +36 -0
  2. package/dist/@types/config/schemas.js +70 -65
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +69 -58
  5. package/dist/components/organisms/base/Toaster.vue.js +4 -4
  6. package/dist/components/organisms/base/Toaster.vue2.js +12 -9
  7. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
  8. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
  9. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
  10. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
  11. package/dist/composables/useBlocksConfig.js +26 -16
  12. package/dist/composables/useHtmlValidator.js +107 -119
  13. package/dist/composables/useRecommendation.js +9 -9
  14. package/dist/composables/useStripo.js +25 -23
  15. package/dist/composables/useVersionHistoryApi.js +1 -1
  16. package/dist/config/compiler/utils/recommendationCompilerUtils.js +28 -23
  17. package/dist/config/i18n/en/index.js +11 -0
  18. package/dist/config/i18n/en/labels.json.js +7 -0
  19. package/dist/config/i18n/en/toasters.json.js +56 -0
  20. package/dist/config/i18n/en/tooltips.json.js +82 -0
  21. package/dist/config/i18n/index.js +7 -0
  22. package/dist/config/migrator/itemsBlockMigrator.js +127 -122
  23. package/dist/config/migrator/recommendationMigrator.js +1 -1
  24. package/dist/enums/defaults.js +8 -4
  25. package/dist/extensions/Blocks/Recommendation/block.js +24 -23
  26. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +37 -33
  27. package/dist/extensions/Blocks/Recommendation/constants/layout.js +16 -12
  28. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -11
  29. package/dist/extensions/Blocks/Recommendation/controls/button/index.js +9 -9
  30. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +1 -1
  31. package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +41 -29
  32. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +16 -16
  33. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +30 -32
  34. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +203 -99
  35. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +9 -9
  36. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +97 -39
  37. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +16 -16
  38. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +304 -209
  39. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +21 -0
  40. package/dist/extensions/Blocks/Recommendation/controls/name/index.js +10 -10
  41. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
  42. package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +14 -14
  43. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +9 -9
  44. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +3 -3
  45. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +1 -1
  46. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +9 -9
  47. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +3 -3
  48. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +3 -3
  49. package/dist/extensions/Blocks/Recommendation/controls/price/index.js +3 -3
  50. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +223 -99
  51. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +94 -55
  52. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +25 -30
  53. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +1 -1
  54. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +27 -30
  55. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +20 -25
  56. package/dist/extensions/Blocks/Recommendation/templates/utils.js +47 -31
  57. package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
  58. package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
  59. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
  60. package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
  61. package/dist/extensions/ModulesTabIcons/extension.js +17 -0
  62. package/dist/guido.css +1 -1
  63. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +257 -187
  64. package/dist/services/stripoApi.js +20 -17
  65. package/dist/src/@types/config/schemas.d.ts +8 -0
  66. package/dist/src/composables/useConfig.d.ts +4 -0
  67. package/dist/src/config/i18n/en/index.d.ts +1 -0
  68. package/dist/src/config/i18n/index.d.ts +16 -0
  69. package/dist/src/enums/defaults.d.ts +4 -0
  70. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -0
  71. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +3 -3
  72. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +12 -2
  73. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -1
  74. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +45 -10
  75. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +22 -4
  76. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +36 -16
  77. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +29 -0
  78. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +50 -17
  79. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -0
  80. package/dist/src/extensions/Blocks/Recommendation/templates/grid/migration.d.ts +1 -1
  81. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +1 -1
  82. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +4 -0
  83. package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +1 -1
  84. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +11 -2
  85. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +14 -0
  86. package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
  87. package/dist/src/extensions/ModulesTabIcons/extension.d.ts +2 -0
  88. package/dist/src/stores/config.d.ts +36 -0
  89. package/dist/static/styles/components/notification.css.js +19 -0
  90. package/dist/static/styles/components/tools.css.js +6 -2
  91. package/dist/static/styles/components/version-history.css.js +10 -2
  92. package/dist/static/styles/components/wide-panel.css.js +18 -2
  93. package/dist/static/styles/customEditorStyle.css.js +59 -31
  94. package/dist/static/styles/variables.css.js +2 -0
  95. package/dist/static/templates/empty/index.html.js +74 -0
  96. package/dist/static/templates/empty/style.css.js +779 -0
  97. package/dist/stores/unsubscribe.js +37 -34
  98. package/package.json +1 -1
@@ -1,14 +1,16 @@
1
- import { RecommendationFeedSourceMaps as d, PriceAttributes as S } from "../../../../enums/extensions/recommendationBlock.js";
2
- import { useRecommendationApi as p } from "../../../../services/recommendationApi.js";
3
- import { useConfigStore as b } from "../../../../stores/config.js";
4
- import { defineStore as I } from "pinia";
5
- import { DEFAULT_CARDS_IN_ROW as R } from "../constants/layout.js";
6
- import { getDefaultProducts as k } from "../templates/utils.js";
7
- import { generateCompleteFilterQuery as f } from "../utils/filterUtil.js";
8
- const m = p();
9
- function h() {
1
+ import { RecommendationFeedSourceMaps as S, PriceAttributes as R } from "../../../../enums/extensions/recommendationBlock.js";
2
+ import { useRecommendationApi as k } from "../../../../services/recommendationApi.js";
3
+ import { useConfigStore as y } from "../../../../stores/config.js";
4
+ import { defineStore as C } from "pinia";
5
+ import { DEFAULT_CARDS_IN_ROW as G } from "../constants/layout.js";
6
+ import { EXCLUDED_ALGORITHM_IDS as P } from "../constants/defaultConfig.js";
7
+ import { getDefaultProducts as p } from "../templates/utils.js";
8
+ import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
9
+ const h = k();
10
+ let a = null, l = null, u = null;
11
+ function I() {
10
12
  return {
11
- cardsInRow: R,
13
+ cardsInRow: G,
12
14
  currencySettings: {
13
15
  name: "USD",
14
16
  value: "USD",
@@ -32,9 +34,9 @@ function h() {
32
34
  size: "6"
33
35
  };
34
36
  }
35
- function C() {
37
+ function v() {
36
38
  return {
37
- recommendationConfigs: h(),
39
+ recommendationConfigs: I(),
38
40
  recommendationProducts: [],
39
41
  filterStatus: !1,
40
42
  filterSelectionDrawerStatus: !1,
@@ -42,7 +44,7 @@ function C() {
42
44
  isInitialized: !1
43
45
  };
44
46
  }
45
- const y = () => ({
47
+ const D = () => ({
46
48
  recommendationCampaignUrls: {},
47
49
  activePredictiveAlgorithms: [],
48
50
  languages: {},
@@ -51,8 +53,8 @@ const y = () => ({
51
53
  blockStates: {},
52
54
  currentRecommendationId: null,
53
55
  configVersion: 0
54
- }), A = I("guidoRecommendationExtension", {
55
- state: () => y(),
56
+ }), _ = C("guidoRecommendationExtension", {
57
+ state: () => D(),
56
58
  getters: {
57
59
  // ====================================================================
58
60
  // Proxy Getters — Backward Compatible Access to Current Block State
@@ -62,7 +64,7 @@ const y = () => ({
62
64
  * This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
63
65
  */
64
66
  recommendationConfigs(t) {
65
- return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : h();
67
+ return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : I();
66
68
  },
67
69
  /**
68
70
  * Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
@@ -100,8 +102,8 @@ const y = () => ({
100
102
  },
101
103
  getActivePredictiveAlgorithms: (t) => {
102
104
  const r = [];
103
- return t.activePredictiveAlgorithms.forEach((e) => {
104
- r.push(...d.filter((n) => n.id === e));
105
+ return t.activePredictiveAlgorithms.filter((e) => !P.includes(e)).forEach((e) => {
106
+ r.push(...S.filter((n) => n.id === e));
105
107
  }), r.map((e) => ({
106
108
  text: e.name,
107
109
  value: e.key
@@ -117,7 +119,7 @@ const y = () => ({
117
119
  })),
118
120
  getFilterList() {
119
121
  return Object.values(this.filterList).map((t) => {
120
- const r = t.type === "defaultAttribute", e = S.includes(t.attributeName);
122
+ const r = t.type === "defaultAttribute", e = R.includes(t.attributeName);
121
123
  let n = r ? t.attributeName : `product_attributes.${t.attributeName}`;
122
124
  return n = e ? `${n}.${this.recommendationConfigs.currencySettings.value}` : n, {
123
125
  text: t.displayName,
@@ -141,7 +143,7 @@ const y = () => ({
141
143
  setCurrentBlock(t) {
142
144
  this.blockStates[t] || (this.blockStates = {
143
145
  ...this.blockStates,
144
- [t]: C()
146
+ [t]: v()
145
147
  }), this.currentRecommendationId = t;
146
148
  },
147
149
  /**
@@ -213,24 +215,46 @@ const y = () => ({
213
215
  // Shared Data Fetching (fetched once, used by all blocks)
214
216
  // ====================================================================
215
217
  async fetchRecommendationCreateData() {
216
- if (this.activePredictiveAlgorithms.length)
217
- return;
218
- const {
219
- activePredictiveAlgorithms: t,
220
- languages: r,
221
- currencies: e
222
- } = await m.fetchRecommendationCreateData();
223
- this.activePredictiveAlgorithms = t, this.languages = r;
224
- const [n] = e, o = n.value.includes(".") ? n.value.split(".")[1] : n.value;
225
- if (this.currentRecommendationId !== null && this.blockStates[this.currentRecommendationId]) {
226
- const i = this.blockStates[this.currentRecommendationId];
227
- i.recommendationConfigs.currencySettings.name = n.text, i.recommendationConfigs.currencySettings.value = o, i.filterStatus = !!i.recommendationConfigs.filters.length;
218
+ if (!this.activePredictiveAlgorithms.length) {
219
+ if (a) {
220
+ await a;
221
+ return;
222
+ }
223
+ a = (async () => {
224
+ const {
225
+ activePredictiveAlgorithms: t,
226
+ languages: r,
227
+ currencies: e
228
+ } = await h.fetchRecommendationCreateData();
229
+ if (this.activePredictiveAlgorithms = t, this.languages = r, this.currentRecommendationId !== null && this.blockStates[this.currentRecommendationId]) {
230
+ const n = this.blockStates[this.currentRecommendationId];
231
+ n.filterStatus = !!n.recommendationConfigs.filters.length;
232
+ }
233
+ this.currencyList = e;
234
+ })();
235
+ try {
236
+ await a;
237
+ } finally {
238
+ a = null;
239
+ }
228
240
  }
229
- this.currencyList = e;
230
241
  },
231
242
  async fetchRecommendationFilters() {
232
- const t = await m.fetchRecommendationFilters();
233
- this.filterList = t;
243
+ if (!Object.keys(this.filterList).length) {
244
+ if (l) {
245
+ await l;
246
+ return;
247
+ }
248
+ l = (async () => {
249
+ const t = await h.fetchRecommendationFilters();
250
+ this.filterList = t;
251
+ })();
252
+ try {
253
+ await l;
254
+ } finally {
255
+ l = null;
256
+ }
257
+ }
234
258
  },
235
259
  // ====================================================================
236
260
  // Per-Block Filter Actions
@@ -270,47 +294,62 @@ const y = () => ({
270
294
  addFilter(t) {
271
295
  if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
272
296
  return;
273
- const r = this.blockStates[this.currentRecommendationId], e = [...r.recommendationConfigs.filters], o = e.filter(
274
- (c) => c.filterGroup === t.filterGroup
275
- ).length + 1, i = e.findLastIndex((c) => c.filterGroup === t.filterGroup);
276
- i !== -1 ? e.splice(i + 1, 0, {
297
+ const r = this.blockStates[this.currentRecommendationId], e = [...r.recommendationConfigs.filters], s = e.filter(
298
+ (o) => o.filterGroup === t.filterGroup
299
+ ).length + 1, m = e.findLastIndex((o) => o.filterGroup === t.filterGroup);
300
+ m !== -1 ? e.splice(m + 1, 0, {
277
301
  ...t,
278
- filterNumber: o
302
+ filterNumber: s
279
303
  }) : e.push({
280
304
  ...t,
281
- filterNumber: o
305
+ filterNumber: s
282
306
  }), r.recommendationConfigs.filters = e;
283
307
  },
284
308
  generateFilterQuery() {
285
- return f(this.recommendationConfigs.filters);
309
+ return b(this.recommendationConfigs.filters);
286
310
  },
287
311
  // ====================================================================
288
312
  // Per-Block Product Fetching
289
313
  // ====================================================================
290
314
  async fetchRecommendationProducts() {
291
- var u;
292
- if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
293
- return;
294
- const t = this.currentRecommendationId, r = this.blockStates[t], { recommendationConfigs: e } = r, n = e.filters.filter((l) => l.isValid), o = f(n), i = ((u = d.find((l) => l.key === e.strategy)) == null ? void 0 : u.path) || "", c = b(), s = {
315
+ if (!(this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])) {
316
+ if (u) {
317
+ await u;
318
+ return;
319
+ }
320
+ u = this._doFetchProducts();
321
+ try {
322
+ await u;
323
+ } finally {
324
+ u = null;
325
+ }
326
+ }
327
+ },
328
+ async _doFetchProducts() {
329
+ var g;
330
+ const t = this.currentRecommendationId, r = this.blockStates[t], { recommendationConfigs: e } = r, n = e.filters.filter((i) => i.isValid), s = b(n), m = ((g = S.find((i) => i.key === e.strategy)) == null ? void 0 : g.path) || "", o = y(), c = {
295
331
  locale: e.language,
296
332
  currency: e.currencySettings.value,
297
- partnerName: c.partnerName,
333
+ partnerName: o.partnerName,
298
334
  size: e.size,
299
335
  details: !0,
300
- campaignId: c.variationId
336
+ campaignId: o.variationId
301
337
  };
302
- e.strategy === "manualMerchandising" ? s.productId = e.productIds.join(",") : e.strategy === "similarViewed" && (s.productId = "{itemId}"), o && (s.filter = o), e.shuffleProducts && (s.shuffle = !0);
303
- const g = parseInt(e.size) || 6;
304
- let a;
338
+ e.strategy === "manualMerchandising" ? c.productId = e.productIds.join(",") : e.strategy === "similarViewed" && (c.productId = "{itemId}"), e.strategy === "userBased" && (c.userId = "{user_id}"), s && (c.filter = s), e.shuffleProducts && (c.shuffle = !0);
339
+ const f = parseInt(e.size) || 6;
340
+ let d;
305
341
  try {
306
- a = await m.fetchRecommendationProducts(i, s);
342
+ d = await h.fetchRecommendationProducts(m, c);
307
343
  } catch {
308
- a = [];
344
+ d = [];
345
+ }
346
+ if (this.blockStates[t]) {
347
+ const i = d.length > 0 ? d : p(f);
348
+ this.blockStates[t].recommendationProducts = i.length < f ? [...i, ...p(f - i.length)] : i;
309
349
  }
310
- this.blockStates[t] && (this.blockStates[t].recommendationProducts = a.length > 0 ? a : k(g));
311
350
  }
312
351
  }
313
352
  });
314
353
  export {
315
- A as useRecommendationExtensionStore
354
+ _ as useRecommendationExtensionStore
316
355
  };
@@ -3,7 +3,7 @@ import { ATTR_PRODUCT_BUTTON as b, ATTR_PRODUCT_OMNIBUS_DISCOUNT as u, ATTR_PROD
3
3
  import { useRecommendationExtensionStore as T } from "../../store/recommendation.js";
4
4
  import { formatPrice as _ } from "../../utils/priceFormatter.js";
5
5
  import { sanitizeImageUrl as $ } from "../utils.js";
6
- const o = "0 5px", a = "attribute-cell";
6
+ const a = "0 5px", o = "attribute-cell";
7
7
  function p() {
8
8
  const t = T(), { currencySettings: e } = t.recommendationConfigs;
9
9
  return {
@@ -15,16 +15,16 @@ function p() {
15
15
  thousandSeparator: e.thousandSeparator
16
16
  };
17
17
  }
18
- function r(t, e = "price") {
19
- const n = p(), l = t[e], i = (l == null ? void 0 : l[n.code]) ?? Object.values(l ?? {})[0] ?? 0;
18
+ function c(t, e = "price") {
19
+ const n = p(), l = t[e], r = (l == null ? void 0 : l[n.code]) ?? Object.values(l ?? {})[0] ?? 0;
20
20
  return _({
21
- price: i,
21
+ price: r,
22
22
  currency: n
23
23
  });
24
24
  }
25
25
  const P = {
26
26
  [x]: (t) => `
27
- <td class="${a}" style="padding: ${o}; height: 100%;" valign="top">
27
+ <td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
28
28
  <table
29
29
  class="product-card-segment"
30
30
  width="100%"
@@ -38,18 +38,13 @@ const P = {
38
38
  class="esd-block-image product-image"
39
39
  align="center"
40
40
  esd-extension-block-id="${s.IMAGE}">
41
- <div style="position: relative; width: 100%; padding-bottom: 100%; overflow: hidden;">
42
- <a
43
- target="_blank"
44
- href="${t.url}"
45
- style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;">
46
- <img
47
- src="${$(t.image_url)}"
48
- alt="${t.name}"
49
- style="max-width: 100%; max-height: 100%; object-fit: contain; display: block;"
50
- class="adapt-img">
51
- </a>
52
- </div>
41
+ <a target="_blank" href="${t.url}">
42
+ <img
43
+ src="${$(t.image_url)}"
44
+ alt="${t.name}"
45
+ style="display: block; max-width: 100%; height: auto;"
46
+ class="adapt-img">
47
+ </a>
53
48
  </td>
54
49
  </tr>
55
50
  </tbody>
@@ -57,7 +52,7 @@ const P = {
57
52
  </td>
58
53
  `,
59
54
  [f]: (t) => `
60
- <td class="${a}" style="padding: ${o}; height: 100%;" valign="middle">
55
+ <td class="${o}" style="padding: ${a}; height: 100%;" valign="middle">
61
56
  <table
62
57
  class="product-card-segment"
63
58
  width="100%"
@@ -82,7 +77,7 @@ const P = {
82
77
  </td>
83
78
  `,
84
79
  [y]: (t) => `
85
- <td class="${a}" style="padding: ${o}; height: 100%;" valign="top">
80
+ <td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
86
81
  <table
87
82
  class="product-card-segment"
88
83
  width="100%"
@@ -97,7 +92,7 @@ const P = {
97
92
  align="center"
98
93
  esd-extension-block-id="${s.PRICE}">
99
94
  <p contenteditable="false" style="font-size: 16px; color: #333333;">
100
- <strong>${r(t, "price")}</strong>
95
+ <strong>${c(t, "price")}</strong>
101
96
  </p>
102
97
  </td>
103
98
  </tr>
@@ -106,7 +101,7 @@ const P = {
106
101
  </td>
107
102
  `,
108
103
  [h]: (t) => `
109
- <td class="${a}" style="padding: ${o}; height: 100%;" valign="top">
104
+ <td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
110
105
  <table
111
106
  class="product-card-segment"
112
107
  width="100%"
@@ -121,7 +116,7 @@ const P = {
121
116
  align="center"
122
117
  esd-extension-block-id="${s.OLD_PRICE}">
123
118
  <p contenteditable="false" style="font-size: 14px; color: #999999;">
124
- <strong>${r(t, "original_price")}</strong>
119
+ <strong>${c(t, "original_price")}</strong>
125
120
  </p>
126
121
  </td>
127
122
  </tr>
@@ -130,7 +125,7 @@ const P = {
130
125
  </td>
131
126
  `,
132
127
  [m]: (t) => `
133
- <td class="${a}" style="padding: ${o}; height: 100%;" valign="top">
128
+ <td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
134
129
  <table
135
130
  class="product-card-segment"
136
131
  width="100%"
@@ -148,7 +143,7 @@ const P = {
148
143
  esd-extension-block-id="${s.OMNIBUS_PRICE}">
149
144
  <p style="font-size: 12px; color: #666666;">
150
145
  <span class="omnibus-text-before">Lowest 30-day price: </span>
151
- <span class="omnibus-price-value">${r(t, "original_price")}</span>
146
+ <span class="omnibus-price-value">${c(t, "original_price")}</span>
152
147
  <span class="omnibus-text-after"></span>
153
148
  </p>
154
149
  </td>
@@ -158,10 +153,10 @@ const P = {
158
153
  </td>
159
154
  `,
160
155
  [u]: (t) => {
161
- var d, c;
162
- const e = p(), n = ((d = t.original_price) == null ? void 0 : d[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, l = ((c = t.price) == null ? void 0 : c[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, i = n > 0 ? Math.round((n - l) / n * 100) : 0, g = i > 0 ? `-${i}%` : "0%";
156
+ var d, i;
157
+ const e = p(), n = ((d = t.original_price) == null ? void 0 : d[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, l = ((i = t.price) == null ? void 0 : i[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - l) / n * 100) : 0, g = r > 0 ? `-${r}%` : "0%";
163
158
  return `
164
- <td class="${a}" style="padding: ${o}; height: 100%;" valign="top">
159
+ <td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
165
160
  <table
166
161
  class="product-card-segment"
167
162
  width="100%"
@@ -190,7 +185,7 @@ const P = {
190
185
  `;
191
186
  },
192
187
  [b]: () => `
193
- <td class="${a}" style="padding: ${o}; height: 100%;" valign="top">
188
+ <td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
194
189
  <table
195
190
  class="product-card-segment"
196
191
  width="100%"
@@ -227,7 +222,7 @@ const P = {
227
222
  `
228
223
  };
229
224
  export {
230
- a as ATTRIBUTE_CELL_CLASS,
231
- o as DEFAULT_CELL_PADDING,
225
+ o as ATTRIBUTE_CELL_CLASS,
226
+ a as DEFAULT_CELL_PADDING,
232
227
  P as gridElementRenderer
233
228
  };
@@ -5,7 +5,7 @@ const u = `
5
5
  align="left"
6
6
  esd-extension-block-id="recommendation-block"
7
7
  esd-handler-name="esd-extension-RecommendationBlock"
8
- class="ins-recommendation-v3-block-v2 esd-block-recommendation-v3-block esd-extension-block es-p20"
8
+ class="recommendation-block-v2 esd-block-recommendation-v3-block esd-extension-block es-p20"
9
9
  >
10
10
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
11
11
  <tr>
@@ -1,7 +1,7 @@
1
- import { DEFAULT_PRODUCTS_PER_ROW as L } from "../../constants/layout.js";
2
- import { DEFAULT_CARD_COMPOSITION as R, spacer as I, getDefaultProducts as E, createBlockTemplate as S, DEFAULTS as _, DEFAULT_CARD_VISIBILITY as b } from "../utils.js";
3
- import { gridElementRenderer as A, ATTRIBUTE_CELL_CLASS as w, DEFAULT_CELL_PADDING as f } from "./elementRenderer.js";
4
- const D = `
1
+ import { DEFAULT_PRODUCTS_PER_ROW as m, DEFAULT_MOBILE_CARDS_IN_ROW as I } from "../../constants/layout.js";
2
+ import { DEFAULT_CARD_COMPOSITION as _, spacer as E, getDefaultProducts as S, createBlockTemplate as A, DEFAULTS as b, DEFAULT_CARD_VISIBILITY as D } from "../utils.js";
3
+ import { gridElementRenderer as w, ATTRIBUTE_CELL_CLASS as C, DEFAULT_CELL_PADDING as f } from "./elementRenderer.js";
4
+ const O = `
5
5
  <tr class="recommendation-product-row">
6
6
  <td>
7
7
  <table
@@ -18,7 +18,7 @@ const D = `
18
18
  </table>
19
19
  </td>
20
20
  </tr>
21
- `, C = `
21
+ `, U = `
22
22
  <tr
23
23
  class="recommendation-attribute-row"
24
24
  data-attribute-type="{-{-ATTR_TYPE-}-}"
@@ -27,43 +27,40 @@ const D = `
27
27
  {-{-CELLS-}-}
28
28
  </tr>
29
29
  `;
30
- function g(t, e, r, c = R) {
31
- const n = (100 / e).toFixed(2), i = e - t.length, o = `<td class="${w}" style="padding: ${f};" width="${n}%"></td>`, a = i > 0 ? o.repeat(i) : "";
32
- return c.filter((l) => r[l]).map((l) => {
33
- const d = b[l] ?? !0, p = d ? "" : 'style="display: none;"', T = t.map((u) => {
34
- const m = r[l];
35
- return m(u).replace("<td", `<td width="${n}%"`);
30
+ function g(t, e, r, n = _) {
31
+ const c = (100 / e).toFixed(2), s = e - t.length, o = `<td class="${C}" style="padding: ${f};" width="${c}%"></td>`, i = s > 0 ? o.repeat(s) : "";
32
+ return n.filter((l) => r[l]).map((l) => {
33
+ const p = D[l] ?? !0, T = p ? "" : 'style="display: none;"', u = t.map((R) => {
34
+ const L = r[l];
35
+ return L(R).replace("<td", `<td width="${c}%"`);
36
36
  }).join("");
37
- return C.replace("{-{-ATTR_TYPE-}-}", l).replace("{-{-VISIBILITY-}-}", d ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", p).replace("{-{-CELLS-}-}", T + a);
37
+ return U.replace("{-{-ATTR_TYPE-}-}", l).replace("{-{-VISIBILITY-}-}", p ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", T).replace("{-{-CELLS-}-}", u + i);
38
38
  }).join("");
39
39
  }
40
- function P(t, e, r, c) {
41
- const n = [];
40
+ function P(t, e, r, n) {
41
+ const c = [];
42
42
  for (let o = 0; o < t.length; o += e)
43
- n.push(t.slice(o, o + e));
44
- return n.map((o, a) => {
45
- const s = g(
43
+ c.push(t.slice(o, o + e));
44
+ return c.map((o, i) => {
45
+ const a = g(
46
46
  o,
47
47
  e,
48
48
  r,
49
- c
50
- ), l = D.replace("{-{-ATTRIBUTE_ROWS-}-}", s);
51
- return a > 0 ? I + l : l;
49
+ n
50
+ ), l = O.replace("{-{-ATTRIBUTE_ROWS-}-}", a);
51
+ return i > 0 ? E + l : l;
52
52
  }).join("");
53
53
  }
54
- function U(t, e, r) {
55
- return P(t, e, A, r);
54
+ function d(t, e, r) {
55
+ return P(t, e, w, r);
56
56
  }
57
- function B(t) {
58
- const e = t ? `ins-recommendation-v3-block-${t}` : void 0, r = S("grid", e), c = U(
59
- E(),
60
- L
61
- );
62
- return r.replace("{-{-TITLE-}-}", _.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c);
57
+ function W(t) {
58
+ const e = t ? `ins-recommendation-v3-block-${t}` : void 0, r = A("grid", e), n = S(), c = d(n, m), s = d(n, I);
59
+ return r.replace("{-{-TITLE-}-}", b.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", s);
63
60
  }
64
61
  export {
65
- B as getDefaultTemplate,
62
+ W as getDefaultTemplate,
66
63
  g as prepareGridAttributeRows,
67
64
  P as prepareGridProductRows,
68
- U as prepareProductRows
65
+ d as prepareProductRows
69
66
  };
@@ -1,5 +1,5 @@
1
1
  import { RecommendationBlockId as o } from "../../constants/blockIds.js";
2
- import { ATTR_PRODUCT_BUTTON as l, ATTR_PRODUCT_IMAGE as d, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_OMNIBUS_PRICE as u, ATTR_PRODUCT_OLD_PRICE as g, ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_NAME as x } from "../../constants/selectors.js";
2
+ import { ATTR_PRODUCT_BUTTON as l, ATTR_PRODUCT_IMAGE as d, ATTR_PRODUCT_OMNIBUS_DISCOUNT as u, ATTR_PRODUCT_OMNIBUS_PRICE as m, ATTR_PRODUCT_OLD_PRICE as g, ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_NAME as x } from "../../constants/selectors.js";
3
3
  import { useRecommendationExtensionStore as T } from "../../store/recommendation.js";
4
4
  import { formatPrice as _ } from "../../utils/priceFormatter.js";
5
5
  import { sanitizeImageUrl as y } from "../utils.js";
@@ -14,14 +14,14 @@ function p() {
14
14
  thousandSeparator: e.thousandSeparator
15
15
  };
16
16
  }
17
- function a(t, e = "price") {
18
- const n = p(), r = t[e], i = (r == null ? void 0 : r[n.code]) ?? Object.values(r ?? {})[0] ?? 0;
17
+ function s(t, e = "price") {
18
+ const n = p(), r = t[e], a = (r == null ? void 0 : r[n.code]) ?? Object.values(r ?? {})[0] ?? 0;
19
19
  return _({
20
- price: i,
20
+ price: a,
21
21
  currency: n
22
22
  });
23
23
  }
24
- const P = {
24
+ const $ = {
25
25
  /**
26
26
  * Image cell - left column (120px fixed width)
27
27
  * Has recommendation-attribute-row class and data attributes for Card Composition control
@@ -35,18 +35,13 @@ const P = {
35
35
  data-visibility="1"
36
36
  align="center"
37
37
  valign="middle">
38
- <div style="position: relative; width: 100%; padding-bottom: 100%; overflow: hidden;">
39
- <a
40
- target="_blank"
41
- href="${t.url}"
42
- style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;">
43
- <img
44
- src="${y(t.image_url)}"
45
- alt="${t.name}"
46
- style="max-width: 100%; max-height: 100%; object-fit: contain; display: block;"
47
- class="adapt-img product-image">
48
- </a>
49
- </div>
38
+ <a target="_blank" href="${t.url}">
39
+ <img
40
+ src="${y(t.image_url)}"
41
+ alt="${t.name}"
42
+ style="display: block; max-width: 100%; height: auto;"
43
+ class="adapt-img product-image">
44
+ </a>
50
45
  </td>
51
46
  `,
52
47
  /**
@@ -74,7 +69,7 @@ const P = {
74
69
  esd-extension-block-id="${o.PRICE}"
75
70
  align="left">
76
71
  <p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: bold; margin: 0;">
77
- <strong>${a(t, "price")}</strong>
72
+ <strong>${s(t, "price")}</strong>
78
73
  </p>
79
74
  </td>
80
75
  </tr>
@@ -91,7 +86,7 @@ const P = {
91
86
  <p
92
87
  contenteditable="false"
93
88
  style="font-size: 14px; color: #999999; text-decoration: line-through; margin: 0;">
94
- <strong>${a(t, "original_price")}</strong>
89
+ <strong>${s(t, "original_price")}</strong>
95
90
  </p>
96
91
  </td>
97
92
  </tr>
@@ -99,7 +94,7 @@ const P = {
99
94
  /**
100
95
  * Omnibus price element - row for info cell table
101
96
  */
102
- [u]: (t) => `
97
+ [m]: (t) => `
103
98
  <tr>
104
99
  <td
105
100
  class="esd-block-text product-omnibus-price"
@@ -109,7 +104,7 @@ const P = {
109
104
  align="left">
110
105
  <p style="font-size: 12px; color: #666666; margin: 0;">
111
106
  <span class="omnibus-text-before">Lowest 30-day price: </span>
112
- <span class="omnibus-price-value">${a(t, "original_price")}</span>
107
+ <span class="omnibus-price-value">${s(t, "original_price")}</span>
113
108
  <span class="omnibus-text-after"></span>
114
109
  </p>
115
110
  </td>
@@ -118,9 +113,9 @@ const P = {
118
113
  /**
119
114
  * Omnibus discount element - row for info cell table
120
115
  */
121
- [m]: (t) => {
122
- var s, c;
123
- const e = p(), n = ((s = t.original_price) == null ? void 0 : s[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, r = ((c = t.price) == null ? void 0 : c[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, i = n > 0 ? Math.round((n - r) / n * 100) : 0, b = i > 0 ? `-${i}%` : "0%";
116
+ [u]: (t) => {
117
+ var i, c;
118
+ const e = p(), n = ((i = t.original_price) == null ? void 0 : i[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, r = ((c = t.price) == null ? void 0 : c[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, a = n > 0 ? Math.round((n - r) / n * 100) : 0, b = a > 0 ? `-${a}%` : "0%";
124
119
  return `
125
120
  <tr>
126
121
  <td
@@ -170,5 +165,5 @@ const P = {
170
165
  `
171
166
  };
172
167
  export {
173
- P as listElementRenderer
168
+ $ as listElementRenderer
174
169
  };