@useinsider/guido 3.17.0-beta.3e9d6e7 → 3.17.0-beta.3ff6ea0

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 (111) hide show
  1. package/README.md +0 -1
  2. package/dist/@types/config/schemas.js +6 -12
  3. package/dist/components/Guido.vue.js +6 -6
  4. package/dist/components/Guido.vue2.js +61 -63
  5. package/dist/composables/useCustomInterfaceAppearance.js +16 -19
  6. package/dist/composables/useRecommendation.js +34 -41
  7. package/dist/composables/useStripo.js +14 -14
  8. package/dist/config/migrator/index.js +9 -8
  9. package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
  10. package/dist/config/migrator/recommendation/extractors.js +29 -24
  11. package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
  12. package/dist/config/migrator/recommendationMigrator.js +16 -15
  13. package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
  14. package/dist/enums/date.js +3 -4
  15. package/dist/enums/extensions/recommendationBlock.js +23 -25
  16. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  17. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  18. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +20 -21
  19. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +34 -28
  20. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +306 -238
  21. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +95 -122
  22. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
  23. package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
  24. package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
  25. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
  26. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +53 -199
  27. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
  28. package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
  29. package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
  30. package/dist/extensions/Blocks/common-control.js +19 -22
  31. package/dist/guido.css +1 -1
  32. package/dist/services/recommendationApi.js +28 -77
  33. package/dist/src/@types/config/schemas.d.ts +0 -12
  34. package/dist/src/composables/useConfig.d.ts +0 -2
  35. package/dist/src/composables/useRecommendation.d.ts +0 -1
  36. package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
  37. package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
  38. package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
  39. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
  40. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
  41. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
  42. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  43. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +10 -0
  44. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +10 -0
  45. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
  46. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -12
  47. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
  48. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
  49. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +10 -210
  50. package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
  51. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -6
  52. package/dist/src/extensions/Blocks/common-control.d.ts +1 -4
  53. package/dist/src/services/recommendationApi.d.ts +1 -4
  54. package/dist/src/stores/config.d.ts +0 -18
  55. package/dist/static/styles/customEditorStyle.css.js +3 -1
  56. package/dist/utils/dateUtil.js +10 -23
  57. package/dist/utils/templatePreparation.js +34 -37
  58. package/package.json +1 -2
  59. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +0 -18
  60. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +0 -67
  61. package/dist/components/organisms/extensions/recommendation/StrategyInfoBox.vue.js +0 -20
  62. package/dist/components/organisms/extensions/recommendation/StrategyInfoBox.vue2.js +0 -55
  63. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +0 -132
  64. package/dist/node_modules/@useinsider/design-system-organisms/dist/index-Dc9AygoZ.js +0 -526
  65. package/dist/node_modules/@useinsider/design-system-organisms/dist/index.js +0 -9345
  66. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InAccordion.js +0 -174
  67. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InBasicTextInput.js +0 -381
  68. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InBox.js +0 -236
  69. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InBulkActions.js +0 -70
  70. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InButton.js +0 -350
  71. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InButtonV2.js +0 -371
  72. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InCheckBox.js +0 -152
  73. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InChips.js +0 -141
  74. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InCustomDropDown.js +0 -1047
  75. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InDataTableV2.js +0 -96050
  76. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InDatePicker.js +0 -2042
  77. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InDrawer.js +0 -166
  78. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InDropDown.js +0 -1098
  79. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InIcons.js +0 -55
  80. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InInfoBox.js +0 -265
  81. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InLinks.js +0 -184
  82. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InLoading.js +0 -50
  83. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InModals.js +0 -453
  84. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InNoData.js +0 -145
  85. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InOnPageMessage.js +0 -176
  86. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InProgress.js +0 -266
  87. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InRadioButton.js +0 -114
  88. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InSegments.js +0 -200
  89. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InSelect.js +0 -451
  90. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InSkeleton.js +0 -49
  91. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InStatusText.js +0 -119
  92. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InTabs.js +0 -4309
  93. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InTagsText.js +0 -129
  94. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InTextInput.js +0 -503
  95. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InToasts.js +0 -253
  96. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InToggle.js +0 -107
  97. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InTooltip.js +0 -134
  98. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/InTooltipV2.js +0 -464
  99. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/_commonjsHelpers.BItOPCY9.js +0 -28
  100. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/_plugin-vue2_normalizer.WQT2Fc8L.js +0 -23
  101. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/clickOutside.qP9M0QCm.js +0 -29
  102. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/helpers.CgHNyjAJ.js +0 -109
  103. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/index.Bw_06igr.js +0 -2339
  104. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/localLocalesMixin.DYMhydo2.js +0 -16
  105. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/useLocalLocales.Ckuhy7d-.js +0 -17
  106. package/dist/node_modules/@useinsider/design-system-organisms/node_modules/@useinsider/design-system-vue/dist/chunks/vue-property-decorator.BtlM7Epa.js +0 -188
  107. package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +0 -3
  108. package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBox.vue.d.ts +0 -24
  109. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -37
  110. package/dist/src/mock/api/recommendation-strategies.d.ts +0 -43
  111. package/dist/static/styles/components/recommendation-strategy.css.js +0 -171
@@ -1,21 +1,21 @@
1
- import { getRecommendationFeedSourceMaps as p, getOperatorOptions as R, PriceAttributes as C } from "../../../../enums/extensions/recommendationBlock.js";
2
- import { useRecommendationApi as w } from "../../../../services/recommendationApi.js";
3
- import { useConfigStore as P } from "../../../../stores/config.js";
4
- import { defineStore as G } from "pinia";
1
+ import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as C } from "../../../../enums/extensions/recommendationBlock.js";
2
+ import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
3
+ import { useConfigStore as G } from "../../../../stores/config.js";
4
+ import { defineStore as P } from "pinia";
5
5
  import "../constants/selectors.js";
6
- import { DEFAULT_MOBILE_CARDS_IN_ROW as D, DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
7
- import { DEFAULT_NODE_CONFIG as v, EXCLUDED_ALGORITHM_IDS as _ } from "../constants/defaultConfig.js";
8
- import { getDefaultProducts as y } from "../templates/utils.js";
6
+ import { DEFAULT_MOBILE_CARDS_IN_ROW as F, DEFAULT_CARDS_IN_ROW as D } from "../constants/layout.js";
7
+ import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
8
+ import { getDefaultProducts as S } from "../templates/utils.js";
9
9
  import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
10
- import { getPartnerRecommendationParams as U } from "../utils/partnerCustomizations.js";
10
+ import { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
11
11
  import { sanitizeProductIds as N } from "../utils/productIds.js";
12
- import { isFilterValid as L } from "../validation/filterSchema.js";
13
- import { isConfigValid as x } from "../validation/requiredFields.js";
14
- const l = w();
15
- let m = null, u = null, d = null, f = null;
12
+ import { isFilterValid as x } from "../validation/filterSchema.js";
13
+ import { isConfigValid as L } from "../validation/requiredFields.js";
14
+ const h = y();
15
+ let m = null, u = null, d = null;
16
16
  function k() {
17
17
  return {
18
- cardsInRow: F,
18
+ cardsInRow: D,
19
19
  currencySettings: {
20
20
  name: "USD",
21
21
  value: "USD",
@@ -29,14 +29,13 @@ function k() {
29
29
  productIds: [],
30
30
  id: 1,
31
31
  language: "en_US",
32
- mobileCardsInRow: D,
32
+ mobileCardsInRow: F,
33
33
  mobileLayoutEnabled: !1,
34
34
  orientation: "grid",
35
35
  recommendedProducts: [],
36
36
  sendProductRequestFlag: !1,
37
37
  shuffleProducts: !1,
38
38
  strategy: "mostPopular",
39
- strategyId: "",
40
39
  textTrimming: !0,
41
40
  unresponsive: !1,
42
41
  size: "6",
@@ -51,26 +50,22 @@ function I() {
51
50
  recommendationProducts: [],
52
51
  filterStatus: !1,
53
52
  filterSelectionDrawerStatus: !1,
54
- assignStrategyDrawerStatus: !1,
55
53
  filterGroup: 1,
56
54
  isInitialized: !1,
57
55
  filterSnapshot: null
58
56
  };
59
57
  }
60
- const A = () => ({
58
+ const U = () => ({
61
59
  recommendationCampaignUrls: {},
62
60
  activePredictiveAlgorithms: [],
63
61
  languages: {},
64
62
  currencyList: [],
65
63
  filterList: {},
66
- strategies: [],
67
- strategiesLoading: !1,
68
- strategyUrlTemplates: {},
69
64
  blockStates: {},
70
65
  currentRecommendationId: null,
71
66
  configVersion: 0
72
- }), Q = G("guidoRecommendationExtension", {
73
- state: () => A(),
67
+ }), H = P("guidoRecommendationExtension", {
68
+ state: () => U(),
74
69
  getters: {
75
70
  // ====================================================================
76
71
  // Proxy Getters — Backward Compatible Access to Current Block State
@@ -94,20 +89,6 @@ const A = () => ({
94
89
  filterSelectionDrawerStatus(t) {
95
90
  return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].filterSelectionDrawerStatus : !1;
96
91
  },
97
- /**
98
- * Proxy getter: delegates to blockStates[currentRecommendationId].assignStrategyDrawerStatus
99
- */
100
- assignStrategyDrawerStatus(t) {
101
- return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].assignStrategyDrawerStatus : !1;
102
- },
103
- /**
104
- * The current block's assigned strategy record from the listing,
105
- * or null when nothing is assigned / the strategy is no longer listed.
106
- */
107
- assignedStrategy(t) {
108
- const { strategyId: e } = this.recommendationConfigs;
109
- return e ? t.strategies.find((r) => String(r.strategy_id) === e) ?? null : null;
110
- },
111
92
  /**
112
93
  * Proxy getter: delegates to blockStates[currentRecommendationId].filterStatus
113
94
  */
@@ -139,9 +120,9 @@ const A = () => ({
139
120
  return [...new Set(t.map((e) => e.filterGroup))].sort((e, r) => e - r);
140
121
  },
141
122
  getActivePredictiveAlgorithms: (t) => {
142
- const e = p(), r = [];
143
- return t.activePredictiveAlgorithms.filter((n) => !_.includes(n)).forEach((n) => {
144
- r.push(...e.filter((s) => s.id === n));
123
+ const e = g(), r = [];
124
+ return t.activePredictiveAlgorithms.filter((n) => !w.includes(n)).forEach((n) => {
125
+ r.push(...e.filter((c) => c.id === n));
145
126
  }), r.map((n) => ({
146
127
  text: n.name,
147
128
  value: n.key
@@ -212,10 +193,10 @@ const A = () => ({
212
193
  [e]: o
213
194
  };
214
195
  }
215
- const n = t.toString(), s = e.toString(), i = this.recommendationCampaignUrls[n];
196
+ const n = t.toString(), c = e.toString(), i = this.recommendationCampaignUrls[n];
216
197
  i && (this.recommendationCampaignUrls = {
217
198
  ...this.recommendationCampaignUrls,
218
- [s]: i
199
+ [c]: i
219
200
  });
220
201
  },
221
202
  /**
@@ -240,7 +221,7 @@ const A = () => ({
240
221
  * `isInitialized`) alone.
241
222
  */
242
223
  seedBlockUrlConfig(t, e) {
243
- const r = (o, a) => o === "." || o === "," || o === " " ? o : a, n = {
224
+ const r = (o, s) => o === "." || o === "," || o === " " ? o : s, n = {
244
225
  name: e.currencyCode,
245
226
  value: e.currencyCode,
246
227
  symbol: e.currencyCode,
@@ -248,18 +229,17 @@ const A = () => ({
248
229
  decimalCount: String(e.currencyDecimalCount),
249
230
  decimalSeparator: r(e.currencyDecimalSeparator, ","),
250
231
  thousandSeparator: r(e.currencyThousandSeparator, ".")
251
- }, s = !this.blockStates[t], i = s ? I() : this.blockStates[t];
232
+ }, c = !this.blockStates[t], i = c ? I() : this.blockStates[t];
252
233
  i.recommendationConfigs = {
253
234
  ...i.recommendationConfigs,
254
235
  strategy: e.strategy,
255
- strategyId: e.strategyId,
256
236
  language: e.language,
257
237
  size: e.size,
258
238
  productIds: e.productIds,
259
239
  filters: e.filters,
260
240
  shuffleProducts: e.shuffleProducts,
261
241
  currencySettings: n
262
- }, s && (this.blockStates = {
242
+ }, c && (this.blockStates = {
263
243
  ...this.blockStates,
264
244
  [t]: i
265
245
  });
@@ -335,89 +315,6 @@ const A = () => ({
335
315
  t.filterSnapshot !== null && (t.recommendationConfigs.filters = t.filterSnapshot, t.filterSnapshot = null), t.filterSelectionDrawerStatus = !1;
336
316
  },
337
317
  // ====================================================================
338
- // Reusable Recommendation Strategy (SD-149105)
339
- // ====================================================================
340
- /**
341
- * Opens the Assign Strategy drawer for the current block.
342
- * Selection state lives in the drawer component until Assign is
343
- * pressed, so closing without assigning needs no snapshot/revert.
344
- */
345
- openAssignStrategyDrawer() {
346
- this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].assignStrategyDrawerStatus = !0);
347
- },
348
- closeAssignStrategyDrawer() {
349
- this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].assignStrategyDrawerStatus = !1);
350
- },
351
- /**
352
- * Fetches the active + EMAIL strategy listing. Always fetches fresh
353
- * (dead-strategy detection and post-create refresh need freshness);
354
- * only concurrent in-flight calls share one request.
355
- */
356
- async fetchStrategies() {
357
- if (f) {
358
- await f;
359
- return;
360
- }
361
- f = (async () => {
362
- this.strategiesLoading = !0;
363
- try {
364
- this.strategies = await l.fetchRecommendationStrategies();
365
- } finally {
366
- this.strategiesLoading = !1;
367
- }
368
- })();
369
- try {
370
- await f;
371
- } finally {
372
- f = null;
373
- }
374
- },
375
- /**
376
- * Resolves a strategy's recommendation endpoint template via
377
- * endpoint-generate, cached per strategy id + revision. Failures throw
378
- * and are NOT cached, so the next attempt retries.
379
- *
380
- * The revision is part of the key because `full_path` bakes in the
381
- * algorithm path and `size=` as they were when it was generated, while
382
- * the listing is deliberately never cached — editing a strategy in the
383
- * panel and re-assigning it here would otherwise call a stale endpoint.
384
- */
385
- async resolveStrategyUrlTemplate(t) {
386
- const e = typeof t.updated_at == "string" ? t.updated_at : "", r = `${t.strategy_id}:${e}`, n = this.strategyUrlTemplates[r];
387
- if (n)
388
- return n;
389
- const { full_path: s } = await l.generateStrategyEndpoint(t);
390
- return this.strategyUrlTemplates = {
391
- ...this.strategyUrlTemplates,
392
- [r]: s
393
- }, s;
394
- },
395
- /**
396
- * Assigns a strategy to the current block. The config write is
397
- * synchronous (before any await) so a block switch cannot misdirect
398
- * it; the configVersion bump persists it to node config and triggers
399
- * the product refetch via the coordinator control's subscription.
400
- */
401
- assignStrategy(t) {
402
- this.patchCurrentBlockConfig({
403
- strategyId: String(t.strategy_id),
404
- ...t.size !== void 0 ? { size: String(t.size) } : {}
405
- });
406
- },
407
- /**
408
- * Clears the current block's strategy; it falls back to the per-block
409
- * algorithm settings.
410
- *
411
- * `size` goes back to the default rather than staying on the removed
412
- * strategy's count: the Number of Products control is hidden in RRS
413
- * mode (D2), so a block left on the strategy's count would have no UI
414
- * to correct it. The pre-assign count is not restored — that would
415
- * need a persisted snapshot field; tracked for a later phase.
416
- */
417
- removeStrategy() {
418
- this.patchCurrentBlockConfig({ strategyId: "", size: v.size });
419
- },
420
- // ====================================================================
421
318
  // Shared Data Fetching (fetched once, used by all blocks)
422
319
  // ====================================================================
423
320
  async fetchRecommendationCreateData() {
@@ -431,7 +328,7 @@ const A = () => ({
431
328
  activePredictiveAlgorithms: t,
432
329
  languages: e,
433
330
  currencies: r
434
- } = await l.fetchRecommendationCreateData();
331
+ } = await h.fetchRecommendationCreateData();
435
332
  if (this.activePredictiveAlgorithms = t, this.languages = e, this.currentRecommendationId !== null && this.blockStates[this.currentRecommendationId]) {
436
333
  const n = this.blockStates[this.currentRecommendationId];
437
334
  n.filterStatus = !!n.recommendationConfigs.filters.length;
@@ -452,7 +349,7 @@ const A = () => ({
452
349
  return;
453
350
  }
454
351
  u = (async () => {
455
- const t = await l.fetchRecommendationFilters();
352
+ const t = await h.fetchRecommendationFilters();
456
353
  this.filterList = t;
457
354
  })();
458
355
  try {
@@ -473,10 +370,10 @@ const A = () => ({
473
370
  deleteFilterGroup(t) {
474
371
  if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
475
372
  return;
476
- const e = this.blockStates[this.currentRecommendationId], r = e.recommendationConfigs.filters.filter((i) => i.filterGroup !== t), n = [...new Set(r.map((i) => i.filterGroup))].sort((i, o) => i - o), s = new Map(n.map((i, o) => [i, o + 1]));
373
+ const e = this.blockStates[this.currentRecommendationId], r = e.recommendationConfigs.filters.filter((i) => i.filterGroup !== t), n = [...new Set(r.map((i) => i.filterGroup))].sort((i, o) => i - o), c = new Map(n.map((i, o) => [i, o + 1]));
477
374
  e.recommendationConfigs.filters = r.map((i) => ({
478
375
  ...i,
479
- filterGroup: s.get(i.filterGroup) ?? i.filterGroup
376
+ filterGroup: c.get(i.filterGroup) ?? i.filterGroup
480
377
  }));
481
378
  },
482
379
  updateFilter(t) {
@@ -487,7 +384,7 @@ const A = () => ({
487
384
  const n = [...e.recommendationConfigs.filters];
488
385
  n[r] = {
489
386
  ...t,
490
- isValid: L(t)
387
+ isValid: x(t)
491
388
  }, e.recommendationConfigs.filters = n;
492
389
  }
493
390
  },
@@ -501,10 +398,10 @@ const A = () => ({
501
398
  let i = 1;
502
399
  n = n.map((o) => o.filterGroup === t.filterGroup ? { ...o, filterNumber: i++ } : o);
503
400
  } else {
504
- const i = [...new Set(n.map((a) => a.filterGroup))].sort((a, c) => a - c), o = new Map(i.map((a, c) => [a, c + 1]));
505
- n = n.map((a) => ({
506
- ...a,
507
- filterGroup: o.get(a.filterGroup) ?? a.filterGroup
401
+ const i = [...new Set(n.map((s) => s.filterGroup))].sort((s, a) => s - a), o = new Map(i.map((s, a) => [s, a + 1]));
402
+ n = n.map((s) => ({
403
+ ...s,
404
+ filterGroup: o.get(s.filterGroup) ?? s.filterGroup
508
405
  }));
509
406
  }
510
407
  e.recommendationConfigs.filters = n;
@@ -513,15 +410,15 @@ const A = () => ({
513
410
  addFilter(t) {
514
411
  if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
515
412
  return;
516
- const e = this.blockStates[this.currentRecommendationId], r = [...e.recommendationConfigs.filters], s = r.filter(
413
+ const e = this.blockStates[this.currentRecommendationId], r = [...e.recommendationConfigs.filters], c = r.filter(
517
414
  (o) => o.filterGroup === t.filterGroup
518
415
  ).length + 1, i = r.findLastIndex((o) => o.filterGroup === t.filterGroup);
519
416
  i !== -1 ? r.splice(i + 1, 0, {
520
417
  ...t,
521
- filterNumber: s
418
+ filterNumber: c
522
419
  }) : r.push({
523
420
  ...t,
524
- filterNumber: s
421
+ filterNumber: c
525
422
  }), e.recommendationConfigs.filters = r;
526
423
  },
527
424
  generateFilterQuery() {
@@ -533,7 +430,7 @@ const A = () => ({
533
430
  * every block's recommendationConfigs across user edits.
534
431
  */
535
432
  hasInvalidBlock() {
536
- return Object.values(this.blockStates).some((t) => !x(t.recommendationConfigs, this));
433
+ return Object.values(this.blockStates).some((t) => !L(t.recommendationConfigs, this));
537
434
  },
538
435
  // ====================================================================
539
436
  // Per-Block Product Fetching
@@ -553,13 +450,8 @@ const A = () => ({
553
450
  }
554
451
  },
555
452
  async _doFetchProducts() {
556
- var S;
557
- const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e;
558
- if (r.strategyId) {
559
- await this._doFetchStrategyProducts(t);
560
- return;
561
- }
562
- const n = r.filters.filter((g) => g.isValid), s = b(n), i = ((S = p().find((g) => g.key === r.strategy)) == null ? void 0 : S.path) || "", o = P(), a = parseInt(r.size) || 6, c = {
453
+ var p;
454
+ const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = r.filters.filter((l) => l.isValid), c = b(n), i = ((p = g().find((l) => l.key === r.strategy)) == null ? void 0 : p.path) || "", o = G(), s = parseInt(r.size) || 6, a = {
563
455
  locale: r.language,
564
456
  currency: r.currencySettings.value,
565
457
  partnerName: o.partnerName,
@@ -567,64 +459,26 @@ const A = () => ({
567
459
  details: !0,
568
460
  campaignId: o.variationId
569
461
  };
570
- r.strategy === "manualMerchandising" ? c.productId = N(r.productIds) : r.strategy === "similarViewed" && (c.productId = "{itemId}"), r.strategy === "userBased" && (c.userId = "{user_id}"), s && (c.filter = s), r.shuffleProducts && (c.shuffle = !0), Object.assign(
571
- c,
572
- U(o.partnerName, r.strategy)
462
+ r.strategy === "manualMerchandising" ? a.productId = N(r.productIds) : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
463
+ a,
464
+ v(o.partnerName, r.strategy)
573
465
  );
574
- let h;
466
+ let f;
575
467
  try {
576
- h = await l.fetchRecommendationProducts(i, c);
468
+ f = await h.fetchRecommendationProducts(i, a);
577
469
  } catch {
578
- h = [];
470
+ f = [];
579
471
  }
580
- this._setBlockProducts(t, h, a);
581
- },
582
- /**
583
- * Fetches products for a strategy-backed block: listing lookup →
584
- * endpoint-generate template → fill {locale}/{currency}, drop
585
- * {user_id} (resolved at send time) → fetch. Any failure (dead
586
- * strategy, resolution error) falls back to placeholder products.
587
- */
588
- async _doFetchStrategyProducts(t) {
589
- const { recommendationConfigs: e } = this.blockStates[t];
590
- let r = [], n = parseInt(e.size) || 6;
591
- try {
592
- this.strategies.length || await this.fetchStrategies();
593
- const s = this.strategies.find(
594
- (i) => String(i.strategy_id) === e.strategyId
595
- );
596
- if (s) {
597
- n = parseInt(String(s.size ?? "")) || n;
598
- const i = await this.resolveStrategyUrlTemplate(s), o = new URL(
599
- i.replaceAll("{locale}", e.language).replaceAll("{currency}", e.currencySettings.value)
600
- );
601
- o.searchParams.delete("user_id"), r = await l.fetchRecommendationProductsByUrl(o.toString());
602
- }
603
- } catch {
604
- r = [];
472
+ if (this.blockStates[t]) {
473
+ const l = f.length > 0 ? f : S(s);
474
+ l.length < s ? this.blockStates[t].recommendationProducts = [
475
+ ...l,
476
+ ...S(s - l.length)
477
+ ] : l.length > s ? this.blockStates[t].recommendationProducts = l.slice(0, s) : this.blockStates[t].recommendationProducts = l;
605
478
  }
606
- this._setBlockProducts(t, r, n);
607
- },
608
- /**
609
- * Writes products to a block's state, padded/clipped to `size` so
610
- * in-place content updates (which compare DOM element count vs
611
- * products.length) succeed:
612
- * - API returned nothing → fill entirely with defaults
613
- * - fewer than requested → pad with dummies
614
- * - more than requested → clip, preventing the renderer from extending
615
- * its slot grid (which would reset migrator-applied styles).
616
- */
617
- _setBlockProducts(t, e, r) {
618
- if (!this.blockStates[t])
619
- return;
620
- const n = e.length > 0 ? e : y(r);
621
- n.length < r ? this.blockStates[t].recommendationProducts = [
622
- ...n,
623
- ...y(r - n.length)
624
- ] : n.length > r ? this.blockStates[t].recommendationProducts = n.slice(0, r) : this.blockStates[t].recommendationProducts = n;
625
479
  }
626
480
  }
627
481
  });
628
482
  export {
629
- Q as useRecommendationExtensionStore
483
+ H as useRecommendationExtensionStore
630
484
  };
@@ -1,6 +1,6 @@
1
1
  import { ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_OLD_PRICE as O } from "../../constants/selectors.js";
2
2
  import { DEFAULT_PRODUCTS_PER_ROW as w } from "../../constants/layout.js";
3
- import { getDefaultProducts as A, DEFAULTS as g, createBlockTemplate as U, buildSpacer as h, DEFAULT_CARD_COMPOSITION as Y, buildElementRenderer as B, resolveInlinePriceOrder as F, buildCellOptions as I, DEFAULT_CARD_VISIBILITY as W } from "../utils.js";
3
+ import { createBlockTemplate as A, getDefaultProducts as g, DEFAULTS as U, buildSpacer as h, DEFAULT_CARD_COMPOSITION as Y, buildElementRenderer as B, resolveInlinePriceOrder as F, buildCellOptions as I, DEFAULT_CARD_VISIBILITY as W } from "../utils.js";
4
4
  import { DEFAULT_CELL_PADDING as k, renderInlineGridPriceCell as H, buildFillerCell as x, gridElementRenderer as y } from "./elementRenderer.js";
5
5
  const G = `
6
6
  <tr class="recommendation-product-row">
@@ -69,8 +69,8 @@ function M(t, r, o, e = {}, c = {}) {
69
69
  );
70
70
  }
71
71
  function Q(t) {
72
- const r = t ? `ins-recommendation-v3-block-${t}` : void 0, o = U("grid", r), e = A(), c = M(e, w);
73
- return o.replace("{-{-TITLE-}-}", g.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
72
+ const r = t ? `ins-recommendation-v3-block-${t}` : void 0, o = A("grid", r), e = g(), c = M(e, w);
73
+ return o.replace("{-{-TITLE-}-}", U.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
74
74
  }
75
75
  export {
76
76
  Q as getDefaultTemplate,
@@ -0,0 +1,33 @@
1
+ import { RecommendationBlockId as r } from "../constants/blockIds.js";
2
+ import { DEFAULT_ROW_SPACING as l } from "../constants/layout.js";
3
+ import { CSS_CLASS_ATTRIBUTE_ROW as d, ATTR_RECOMMENDATION_TITLE as n, ATTR_DATA_VISIBILITY as A, CSS_CLASS_TITLE_CELL as _, CSS_CLASS_SPACER as c } from "../constants/selectors.js";
4
+ const a = "You May Also Like!", i = '<p style="font-size: 28px; color: #333333;"><strong>{-{-TITLE-}-}</strong></p>';
5
+ function E(s = i, t = !0, T = l) {
6
+ const e = `class="${d}" data-attribute-type="${n}" ${A}="${t ? "1" : "0"}"`, o = t ? "" : ' style="display: none;"';
7
+ return `
8
+ <tr ${e}${o}>
9
+ <td>
10
+ <table width="100%" cellpadding="0" cellspacing="0" border="0">
11
+ <tbody>
12
+ <tr>
13
+ <td
14
+ class="esd-block-text ${_} es-p10t es-p10b es-p20l es-p20r"
15
+ align="center"
16
+ esd-extension-block-id="${r.TITLE}">
17
+ ${s}
18
+ </td>
19
+ </tr>
20
+ </tbody>
21
+ </table>
22
+ </td>
23
+ </tr>
24
+ <tr ${e}${o}>
25
+ <td class="${c}" style="height: ${T}px;"></td>
26
+ </tr>
27
+ `;
28
+ }
29
+ export {
30
+ i as DEFAULT_TITLE_PARAGRAPH,
31
+ a as DEFAULT_TITLE_TEXT,
32
+ E as buildTitleRows
33
+ };