@useinsider/guido 2.1.0-beta.038f431 → 2.1.0-beta.07fb1d6

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 (63) hide show
  1. package/dist/components/organisms/header/HeaderWrapper.vue.js +9 -9
  2. package/dist/composables/useActionsApi.js +15 -13
  3. package/dist/composables/useHtmlValidator.js +95 -87
  4. package/dist/composables/useRecommendation.js +54 -21
  5. package/dist/config/compiler/recommendationCompilerRules.js +45 -39
  6. package/dist/config/compiler/utils/recommendationCompilerUtils.js +116 -0
  7. package/dist/config/migrator/itemsBlockMigrator.js +140 -123
  8. package/dist/enums/extensions/recommendationBlock.js +1 -1
  9. package/dist/enums/recommendation.js +16 -15
  10. package/dist/extensions/Blocks/Items/block.js +19 -28
  11. package/dist/extensions/Blocks/Items/controls/button/link.js +19 -31
  12. package/dist/extensions/Blocks/Items/controls/cardComposition.js +124 -85
  13. package/dist/extensions/Blocks/Items/controls/image/link.js +19 -31
  14. package/dist/extensions/Blocks/Items/controls/name/trimming.js +28 -40
  15. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +35 -47
  16. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +49 -54
  17. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +42 -51
  18. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +23 -36
  19. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +45 -57
  20. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +42 -60
  21. package/dist/extensions/Blocks/Items/controls/settingsControl.js +189 -196
  22. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +0 -2
  23. package/dist/extensions/Blocks/Items/extension.js +8 -9
  24. package/dist/extensions/Blocks/Items/settingsPanel.js +10 -15
  25. package/dist/extensions/Blocks/Items/template.js +181 -175
  26. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +65 -65
  27. package/dist/extensions/Blocks/Recommendation/block.js +20 -18
  28. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +42 -42
  29. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +114 -102
  30. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +4 -4
  31. package/dist/extensions/Blocks/Recommendation/templates/utils.js +19 -23
  32. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +10 -10
  33. package/dist/extensions/Blocks/common-control.js +91 -92
  34. package/dist/guido.css +1 -1
  35. package/dist/services/recommendationApi.js +11 -9
  36. package/dist/services/templateLibraryApi.js +16 -13
  37. package/dist/src/composables/useRecommendation.d.ts +1 -0
  38. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +17 -0
  39. package/dist/src/extensions/Blocks/Items/block.d.ts +0 -1
  40. package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -1
  41. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +5 -5
  42. package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -1
  43. package/dist/src/extensions/Blocks/Items/controls/name/trimming.d.ts +0 -1
  44. package/dist/src/extensions/Blocks/Items/controls/price/currencyLocation.d.ts +0 -1
  45. package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +0 -1
  46. package/dist/src/extensions/Blocks/Items/controls/price/formattedPrice.d.ts +0 -1
  47. package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +0 -1
  48. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +0 -1
  49. package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +0 -5
  50. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +10 -12
  51. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +2 -1
  52. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -1
  53. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +7 -0
  54. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -1
  55. package/dist/src/extensions/Blocks/common-control.d.ts +4 -5
  56. package/dist/static/styles/components/notification.css.js +1 -0
  57. package/dist/static/styles/components/version-history.css.js +10 -2
  58. package/dist/static/styles/components/wide-panel.css.js +18 -2
  59. package/dist/utils/pairProductVariables.js +57 -56
  60. package/dist/utils/templatePreparation.js +15 -14
  61. package/package.json +1 -1
  62. package/dist/extensions/Blocks/Items/store/items-block.js +0 -79
  63. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +0 -45
@@ -1,13 +1,14 @@
1
- import { RecommendationFeedSourceMaps as u, PriceAttributes as g } from "../../../../enums/extensions/recommendationBlock.js";
2
- import { useRecommendationApi as S } from "../../../../services/recommendationApi.js";
3
- import { useConfigStore as p } from "../../../../stores/config.js";
4
- import { defineStore as b } from "pinia";
5
- import { DEFAULT_CARDS_IN_ROW as I } from "../constants/layout.js";
6
- import { generateCompleteFilterQuery as d } from "../utils/filterUtil.js";
7
- const l = S();
8
- function f() {
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() {
9
10
  return {
10
- cardsInRow: I,
11
+ cardsInRow: R,
11
12
  currencySettings: {
12
13
  name: "USD",
13
14
  value: "USD",
@@ -20,7 +21,7 @@ function f() {
20
21
  filters: [],
21
22
  productIds: [],
22
23
  id: 1,
23
- language: "tr_TR",
24
+ language: "en_US",
24
25
  orientation: "grid",
25
26
  recommendedProducts: [],
26
27
  sendProductRequestFlag: !1,
@@ -31,16 +32,17 @@ function f() {
31
32
  size: "6"
32
33
  };
33
34
  }
34
- function R() {
35
+ function C() {
35
36
  return {
36
- recommendationConfigs: f(),
37
+ recommendationConfigs: h(),
37
38
  recommendationProducts: [],
38
39
  filterStatus: !1,
39
40
  filterSelectionDrawerStatus: !1,
40
- filterGroup: 1
41
+ filterGroup: 1,
42
+ isInitialized: !1
41
43
  };
42
44
  }
43
- const k = () => ({
45
+ const y = () => ({
44
46
  recommendationCampaignUrls: {},
45
47
  activePredictiveAlgorithms: [],
46
48
  languages: {},
@@ -49,8 +51,8 @@ const k = () => ({
49
51
  blockStates: {},
50
52
  currentRecommendationId: null,
51
53
  configVersion: 0
52
- }), D = b("guidoRecommendationExtension", {
53
- state: () => k(),
54
+ }), A = I("guidoRecommendationExtension", {
55
+ state: () => y(),
54
56
  getters: {
55
57
  // ====================================================================
56
58
  // Proxy Getters — Backward Compatible Access to Current Block State
@@ -59,32 +61,32 @@ const k = () => ({
59
61
  * Proxy getter: delegates to blockStates[currentRecommendationId].recommendationConfigs
60
62
  * This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
61
63
  */
62
- recommendationConfigs(e) {
63
- return e.currentRecommendationId !== null && e.blockStates[e.currentRecommendationId] ? e.blockStates[e.currentRecommendationId].recommendationConfigs : f();
64
+ recommendationConfigs(t) {
65
+ return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : h();
64
66
  },
65
67
  /**
66
68
  * Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
67
69
  */
68
- recommendationProducts(e) {
69
- return e.currentRecommendationId !== null && e.blockStates[e.currentRecommendationId] ? e.blockStates[e.currentRecommendationId].recommendationProducts : [];
70
+ recommendationProducts(t) {
71
+ return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationProducts : [];
70
72
  },
71
73
  /**
72
74
  * Proxy getter: delegates to blockStates[currentRecommendationId].filterSelectionDrawerStatus
73
75
  */
74
- filterSelectionDrawerStatus(e) {
75
- return e.currentRecommendationId !== null && e.blockStates[e.currentRecommendationId] ? e.blockStates[e.currentRecommendationId].filterSelectionDrawerStatus : !1;
76
+ filterSelectionDrawerStatus(t) {
77
+ return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].filterSelectionDrawerStatus : !1;
76
78
  },
77
79
  /**
78
80
  * Proxy getter: delegates to blockStates[currentRecommendationId].filterStatus
79
81
  */
80
- filterStatus(e) {
81
- return e.currentRecommendationId !== null && e.blockStates[e.currentRecommendationId] ? e.blockStates[e.currentRecommendationId].filterStatus : !1;
82
+ filterStatus(t) {
83
+ return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].filterStatus : !1;
82
84
  },
83
85
  /**
84
86
  * Proxy getter: delegates to blockStates[currentRecommendationId].filterGroup
85
87
  */
86
- filterGroup(e) {
87
- return e.currentRecommendationId !== null && e.blockStates[e.currentRecommendationId] ? e.blockStates[e.currentRecommendationId].filterGroup : 1;
88
+ filterGroup(t) {
89
+ return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].filterGroup : 1;
88
90
  },
89
91
  // ====================================================================
90
92
  // Existing Getters (now reading through proxy)
@@ -93,39 +95,39 @@ const k = () => ({
93
95
  return !!this.recommendationConfigs.filters.length;
94
96
  },
95
97
  getFilterGroupCount() {
96
- const { filters: e } = this.recommendationConfigs;
97
- return e.length && e[e.length - 1].filterGroup || 0;
98
+ const { filters: t } = this.recommendationConfigs;
99
+ return t.length && t[t.length - 1].filterGroup || 0;
98
100
  },
99
- getActivePredictiveAlgorithms: (e) => {
101
+ getActivePredictiveAlgorithms: (t) => {
100
102
  const r = [];
101
- return e.activePredictiveAlgorithms.forEach((t) => {
102
- r.push(...u.filter((n) => n.id === t));
103
- }), r.map((t) => ({
104
- text: t.name,
105
- value: t.key
103
+ return t.activePredictiveAlgorithms.forEach((e) => {
104
+ r.push(...d.filter((n) => n.id === e));
105
+ }), r.map((e) => ({
106
+ text: e.name,
107
+ value: e.key
106
108
  }));
107
109
  },
108
- getLanguages: (e) => Object.entries(e.languages).map(([r, t]) => ({
109
- text: t,
110
+ getLanguages: (t) => Object.entries(t.languages).map(([r, e]) => ({
111
+ text: e,
110
112
  value: r
111
113
  })),
112
- getCurrencySymbolList: (e) => e.currencyList.map((r) => ({
114
+ getCurrencySymbolList: (t) => t.currencyList.map((r) => ({
113
115
  text: r.text,
114
116
  value: r.text
115
117
  })),
116
118
  getFilterList() {
117
- return Object.values(this.filterList).map((e) => {
118
- const r = e.type === "defaultAttribute", t = g.includes(e.attributeName);
119
- let n = r ? e.attributeName : `product_attributes.${e.attributeName}`;
120
- return n = t ? `${n}.${this.recommendationConfigs.currencySettings.value}` : n, {
121
- text: e.displayName,
119
+ return Object.values(this.filterList).map((t) => {
120
+ const r = t.type === "defaultAttribute", e = S.includes(t.attributeName);
121
+ let n = r ? t.attributeName : `product_attributes.${t.attributeName}`;
122
+ return n = e ? `${n}.${this.recommendationConfigs.currencySettings.value}` : n, {
123
+ text: t.displayName,
122
124
  value: n,
123
- type: e.attributeType
125
+ type: t.attributeType
124
126
  };
125
127
  });
126
128
  },
127
129
  getSelectedFilterGroup() {
128
- return (e) => [...this.recommendationConfigs.filters].filter((r) => r.filterGroup === e);
130
+ return (t) => [...this.recommendationConfigs.filters].filter((r) => r.filterGroup === t);
129
131
  }
130
132
  },
131
133
  actions: {
@@ -136,37 +138,44 @@ const k = () => ({
136
138
  * Sets the currently active block ID.
137
139
  * Creates a new entry in blockStates if one doesn't exist.
138
140
  */
139
- setCurrentBlock(e) {
140
- this.blockStates[e] || (this.blockStates = {
141
+ setCurrentBlock(t) {
142
+ this.blockStates[t] || (this.blockStates = {
141
143
  ...this.blockStates,
142
- [e]: R()
143
- }), this.currentRecommendationId = e;
144
+ [t]: C()
145
+ }), this.currentRecommendationId = t;
144
146
  },
145
147
  /**
146
148
  * Removes a block's state from the store.
147
149
  * Resets currentRecommendationId if it was the deleted block.
148
150
  */
149
- removeBlockState(e) {
151
+ removeBlockState(t) {
150
152
  const r = { ...this.blockStates };
151
- if (delete r[e], this.blockStates = r, this.currentRecommendationId === e) {
152
- const t = Object.keys(this.blockStates).map(Number);
153
- this.currentRecommendationId = t.length > 0 ? t[0] : null;
153
+ if (delete r[t], this.blockStates = r, this.currentRecommendationId === t) {
154
+ const e = Object.keys(this.blockStates).map(Number);
155
+ this.currentRecommendationId = e.length > 0 ? e[0] : null;
154
156
  }
155
157
  },
158
+ /**
159
+ * Marks a block as initialized (initial API data has been fetched).
160
+ * Automatically cleaned up when removeBlockState deletes the block entry.
161
+ */
162
+ markBlockInitialized(t) {
163
+ this.blockStates[t] && (this.blockStates[t].isInitialized = !0);
164
+ },
156
165
  /**
157
166
  * Patches the current block's recommendationConfigs.
158
167
  * Replaces `store.$patch({ recommendationConfigs: { ... } })` pattern.
159
168
  */
160
- patchCurrentBlockConfig(e, r = {}) {
169
+ patchCurrentBlockConfig(t, r = {}) {
161
170
  if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
162
171
  return;
163
- const t = this.blockStates[this.currentRecommendationId];
164
- t.recommendationConfigs = {
165
- ...t.recommendationConfigs,
166
- ...e,
172
+ const e = this.blockStates[this.currentRecommendationId];
173
+ e.recommendationConfigs = {
174
+ ...e.recommendationConfigs,
175
+ ...t,
167
176
  currencySettings: {
168
- ...t.recommendationConfigs.currencySettings,
169
- ...e.currencySettings || {}
177
+ ...e.recommendationConfigs.currencySettings,
178
+ ...t.currencySettings || {}
170
179
  }
171
180
  };
172
181
  const { triggerRefetch: n = !0 } = r;
@@ -180,8 +189,8 @@ const k = () => ({
180
189
  openFilterDrawer() {
181
190
  if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
182
191
  return;
183
- const e = this.blockStates[this.currentRecommendationId];
184
- e.recommendationConfigs.filters.length || (e.recommendationConfigs.filters = [{
192
+ const t = this.blockStates[this.currentRecommendationId];
193
+ t.recommendationConfigs.filters.length || (t.recommendationConfigs.filters = [{
185
194
  type: "standardFilter",
186
195
  attribute: "",
187
196
  operatorReplace: "",
@@ -192,7 +201,7 @@ const k = () => ({
192
201
  filterGroup: 1,
193
202
  isValid: !1,
194
203
  value: ""
195
- }]), e.filterSelectionDrawerStatus = !0;
204
+ }]), t.filterSelectionDrawerStatus = !0;
196
205
  },
197
206
  /**
198
207
  * Closes the filter selection drawer for the current block
@@ -207,26 +216,26 @@ const k = () => ({
207
216
  if (this.activePredictiveAlgorithms.length)
208
217
  return;
209
218
  const {
210
- activePredictiveAlgorithms: e,
219
+ activePredictiveAlgorithms: t,
211
220
  languages: r,
212
- currencies: t
213
- } = await l.fetchRecommendationCreateData();
214
- this.activePredictiveAlgorithms = e, this.languages = r;
215
- const [n] = t, o = n.value.includes(".") ? n.value.split(".")[1] : n.value;
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;
216
225
  if (this.currentRecommendationId !== null && this.blockStates[this.currentRecommendationId]) {
217
226
  const i = this.blockStates[this.currentRecommendationId];
218
227
  i.recommendationConfigs.currencySettings.name = n.text, i.recommendationConfigs.currencySettings.value = o, i.filterStatus = !!i.recommendationConfigs.filters.length;
219
228
  }
220
- this.currencyList = t;
229
+ this.currencyList = e;
221
230
  },
222
231
  async fetchRecommendationFilters() {
223
- const e = await l.fetchRecommendationFilters();
224
- this.filterList = e;
232
+ const t = await m.fetchRecommendationFilters();
233
+ this.filterList = t;
225
234
  },
226
235
  // ====================================================================
227
236
  // Per-Block Filter Actions
228
237
  // ====================================================================
229
- addFilterGroup(e) {
238
+ addFilterGroup(t) {
230
239
  this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || this.blockStates[this.currentRecommendationId].recommendationConfigs.filters.push({
231
240
  type: "standardFilter",
232
241
  attribute: "",
@@ -237,68 +246,71 @@ const k = () => ({
237
246
  value: "",
238
247
  filterNumber: 1,
239
248
  isValid: !0,
240
- filterGroup: e
249
+ filterGroup: t
241
250
  });
242
251
  },
243
- updateFilter(e) {
252
+ updateFilter(t) {
244
253
  if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
245
254
  return;
246
- const r = this.blockStates[this.currentRecommendationId], t = r.recommendationConfigs.filters.findIndex((n) => n.filterNumber === e.filterNumber && n.filterGroup === e.filterGroup);
247
- if (t !== -1) {
255
+ const r = this.blockStates[this.currentRecommendationId], e = r.recommendationConfigs.filters.findIndex((n) => n.filterNumber === t.filterNumber && n.filterGroup === t.filterGroup);
256
+ if (e !== -1) {
248
257
  const n = [...r.recommendationConfigs.filters];
249
- n[t] = e, e.value.length && e.operator && e.attribute && e.innerGroupOperator && e.outerGroupOperator ? n[t].isValid = !0 : n[t].isValid = !1, r.recommendationConfigs.filters = n;
258
+ n[e] = t, t.value.length && t.operator && t.attribute && t.innerGroupOperator && t.outerGroupOperator ? n[e].isValid = !0 : n[e].isValid = !1, r.recommendationConfigs.filters = n;
250
259
  }
251
260
  },
252
- deleteFilter(e) {
261
+ deleteFilter(t) {
253
262
  if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
254
263
  return;
255
- const r = this.blockStates[this.currentRecommendationId], t = [...r.recommendationConfigs.filters].findIndex((n) => n.filterNumber === e.filterNumber && n.filterGroup === e.filterGroup);
256
- if (t !== -1) {
264
+ const r = this.blockStates[this.currentRecommendationId], e = [...r.recommendationConfigs.filters].findIndex((n) => n.filterNumber === t.filterNumber && n.filterGroup === t.filterGroup);
265
+ if (e !== -1) {
257
266
  const n = [...r.recommendationConfigs.filters];
258
- n.splice(t, 1), r.recommendationConfigs.filters = n;
267
+ n.splice(e, 1), r.recommendationConfigs.filters = n;
259
268
  }
260
269
  },
261
- addFilter(e) {
270
+ addFilter(t) {
262
271
  if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
263
272
  return;
264
- const r = this.blockStates[this.currentRecommendationId], t = [...r.recommendationConfigs.filters], o = t.filter(
265
- (c) => c.filterGroup === e.filterGroup
266
- ).length + 1, i = t.findLastIndex((c) => c.filterGroup === e.filterGroup);
267
- i !== -1 ? t.splice(i + 1, 0, {
268
- ...e,
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, {
277
+ ...t,
269
278
  filterNumber: o
270
- }) : t.push({
271
- ...e,
279
+ }) : e.push({
280
+ ...t,
272
281
  filterNumber: o
273
- }), r.recommendationConfigs.filters = t;
282
+ }), r.recommendationConfigs.filters = e;
274
283
  },
275
284
  generateFilterQuery() {
276
- return d(this.recommendationConfigs.filters);
285
+ return f(this.recommendationConfigs.filters);
277
286
  },
278
287
  // ====================================================================
279
288
  // Per-Block Product Fetching
280
289
  // ====================================================================
281
290
  async fetchRecommendationProducts() {
282
- var m;
291
+ var u;
283
292
  if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
284
293
  return;
285
- const e = this.currentRecommendationId, r = this.blockStates[e], { recommendationConfigs: t } = r, n = t.filters.filter((a) => a.isValid), o = d(n), i = ((m = u.find((a) => a.key === t.strategy)) == null ? void 0 : m.path) || "", c = p(), s = {
286
- locale: t.language,
287
- currency: t.currencySettings.value,
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 = {
295
+ locale: e.language,
296
+ currency: e.currencySettings.value,
288
297
  partnerName: c.partnerName,
289
- size: t.size,
298
+ size: e.size,
290
299
  details: !0,
291
300
  campaignId: c.variationId
292
301
  };
293
- t.strategy === "manualMerchandising" ? s.productId = t.productIds.join(",") : t.strategy === "similarViewed" && (s.productId = "{itemId}"), o && (s.filter = o), t.shuffleProducts && (s.shuffle = !0);
294
- const h = await l.fetchRecommendationProducts(
295
- i,
296
- s
297
- );
298
- this.blockStates[e] && (this.blockStates[e].recommendationProducts = h);
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;
305
+ try {
306
+ a = await m.fetchRecommendationProducts(i, s);
307
+ } catch {
308
+ a = [];
309
+ }
310
+ this.blockStates[t] && (this.blockStates[t].recommendationProducts = a.length > 0 ? a : k(g));
299
311
  }
300
312
  }
301
313
  });
302
314
  export {
303
- D as useRecommendationExtensionStore
315
+ A as useRecommendationExtensionStore
304
316
  };
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_PRODUCTS_PER_ROW as L } from "../../constants/layout.js";
2
- import { DEFAULT_CARD_COMPOSITION as R, spacer as I, createBlockTemplate as E, DEFAULTS as S, getDefaultProducts as _, DEFAULT_CARD_VISIBILITY as b } from "../utils.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
3
  import { gridElementRenderer as A, ATTRIBUTE_CELL_CLASS as w, DEFAULT_CELL_PADDING as f } from "./elementRenderer.js";
4
4
  const D = `
5
5
  <tr class="recommendation-product-row">
@@ -55,11 +55,11 @@ function U(t, e, r) {
55
55
  return P(t, e, A, r);
56
56
  }
57
57
  function B(t) {
58
- const e = t ? `ins-recommendation-v3-block-${t}` : void 0, r = E("grid", e), c = U(
59
- _(),
58
+ const e = t ? `ins-recommendation-v3-block-${t}` : void 0, r = S("grid", e), c = U(
59
+ E(),
60
60
  L
61
61
  );
62
- return r.replace("{-{-TITLE-}-}", S.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c);
62
+ return r.replace("{-{-TITLE-}-}", _.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c);
63
63
  }
64
64
  export {
65
65
  B as getDefaultTemplate,
@@ -1,23 +1,23 @@
1
- import { ATTR_PRODUCT_IMAGE as a, ATTR_PRODUCT_NAME as o, ATTR_PRODUCT_OLD_PRICE as c, ATTR_PRODUCT_PRICE as s, ATTR_PRODUCT_OMNIBUS_PRICE as l, ATTR_PRODUCT_OMNIBUS_DISCOUNT as n, ATTR_PRODUCT_BUTTON as i } from "../constants/selectors.js";
1
+ import { ATTR_PRODUCT_IMAGE as a, ATTR_PRODUCT_NAME as o, ATTR_PRODUCT_OLD_PRICE as c, ATTR_PRODUCT_PRICE as l, ATTR_PRODUCT_OMNIBUS_PRICE as s, ATTR_PRODUCT_OMNIBUS_DISCOUNT as n, ATTR_PRODUCT_BUTTON as i } from "../constants/selectors.js";
2
2
  const m = {
3
3
  TITLE: "You May Also Like!"
4
- }, g = [
4
+ }, u = [
5
5
  a,
6
6
  o,
7
7
  c,
8
- s,
9
8
  l,
9
+ s,
10
10
  n,
11
11
  i
12
12
  ], b = {
13
13
  [a]: !0,
14
14
  [o]: !0,
15
- [s]: !0,
15
+ [l]: !0,
16
16
  [c]: !0,
17
- [l]: !1,
17
+ [s]: !1,
18
18
  [n]: !1,
19
19
  [i]: !0
20
- }, T = `
20
+ }, p = `
21
21
  <tr>
22
22
  <td class="spacer" style="height: 10px;"></td>
23
23
  </tr>
@@ -25,7 +25,7 @@ const m = {
25
25
  function R(t) {
26
26
  return !t || typeof t != "string" || t.trim() === "" ? d : t.startsWith("http://") ? t.replace("http://", "https://") : t;
27
27
  }
28
- function e(t) {
28
+ function T(t) {
29
29
  return {
30
30
  name: "Product Name",
31
31
  image_url: d,
@@ -40,23 +40,19 @@ function e(t) {
40
40
  category: []
41
41
  };
42
42
  }
43
- function D() {
44
- return [
45
- e("1"),
46
- e("2"),
47
- e("3"),
48
- e("4"),
49
- e("5"),
50
- e("6")
51
- ];
43
+ function D(t = 6) {
44
+ return Array.from(
45
+ { length: t },
46
+ (e, r) => T(String(r + 1))
47
+ );
52
48
  }
53
- function U(t = "grid", r) {
54
- const p = t === "list" ? `
49
+ function A(t = "grid", e) {
50
+ const r = t === "list" ? `
55
51
  data-layout="list"` : "";
56
52
  return `
57
53
  <td
58
54
  align="left"
59
- class="ins-recommendation-v3-block-v2 esd-block-recommendation-v3-block es-p20${r ? ` ${r}` : ""}"${p}>
55
+ class="ins-recommendation-v3-block-v2 esd-block-recommendation-v3-block es-p20${e ? ` ${e}` : ""}"${r}>
60
56
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
61
57
  <tr>
62
58
  <td align="center">
@@ -88,7 +84,7 @@ function U(t = "grid", r) {
88
84
  </table>
89
85
  </td>
90
86
  </tr>
91
- ${T}
87
+ ${p}
92
88
  <tr>
93
89
  <td>
94
90
  <table
@@ -112,11 +108,11 @@ function U(t = "grid", r) {
112
108
  }
113
109
  export {
114
110
  m as DEFAULTS,
115
- g as DEFAULT_CARD_COMPOSITION,
111
+ u as DEFAULT_CARD_COMPOSITION,
116
112
  b as DEFAULT_CARD_VISIBILITY,
117
113
  d as PLACEHOLDER_IMAGE,
118
- U as createBlockTemplate,
114
+ A as createBlockTemplate,
119
115
  D as getDefaultProducts,
120
116
  R as sanitizeImageUrl,
121
- T as spacer
117
+ p as spacer
122
118
  };
@@ -1,25 +1,25 @@
1
- function p(t) {
2
- const r = {
1
+ function m(t) {
2
+ const e = {
3
3
  "&": "&amp;",
4
4
  "<": "&lt;",
5
5
  ">": "&gt;",
6
6
  '"': "&quot;",
7
7
  "'": "&#39;"
8
8
  };
9
- return t.replace(/[&<>"']/g, (n) => r[n]);
9
+ return t.replace(/[&<>"']/g, (n) => e[n]);
10
10
  }
11
- function m(t) {
12
- return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML() : "innerHTML" in t ? t.innerHTML : "";
11
+ function p(t) {
12
+ return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "innerHTML" in t ? t.innerHTML : "";
13
13
  }
14
- function T(t, r) {
15
- const n = p(r);
14
+ function T(t, e) {
15
+ const n = m(e);
16
16
  if (!t)
17
17
  return n;
18
- const e = m(t);
19
- if (!e || e.trim() === "" || !/<(strong|em|u|s|b|i)\b/i.test(e))
18
+ const r = p(t);
19
+ if (!r || r.trim() === "" || !/<(strong|em|u|s|b|i)\b/i.test(r))
20
20
  return n;
21
21
  const i = [], o = [];
22
- let c = e.trim();
22
+ let c = r.trim();
23
23
  for (; ; ) {
24
24
  const u = c.match(/^<(strong|em|u|s|b|i)(\s[^>]*)?>(.*)$/is);
25
25
  if (!u)