@useinsider/guido 3.17.0-beta.bdc7d25 → 3.17.0-beta.c3ab4de

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 (122) hide show
  1. package/README.md +5 -5
  2. package/dist/@types/config/schemas.js +15 -18
  3. package/dist/components/Guido.vue.js +10 -10
  4. package/dist/components/Guido.vue2.js +70 -66
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +76 -39
  7. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.js +17 -0
  8. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +57 -0
  9. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +11 -11
  10. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +56 -6
  11. package/dist/components/organisms/header/AutoSaveStatus.vue.js +17 -0
  12. package/dist/components/organisms/header/AutoSaveStatus.vue2.js +21 -0
  13. package/dist/components/organisms/header/EditorActions.vue.js +13 -13
  14. package/dist/components/organisms/header/EditorActions.vue2.js +34 -50
  15. package/dist/components/organisms/header/EditorActionsMenu.vue.js +20 -0
  16. package/dist/components/organisms/header/EditorActionsMenu.vue2.js +39 -0
  17. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  18. package/dist/components/organisms/header/LeftSlot.vue2.js +28 -23
  19. package/dist/components/organisms/header/MiddleSlot.vue.js +4 -4
  20. package/dist/components/organisms/header/MiddleSlot.vue2.js +8 -7
  21. package/dist/components/organisms/header/RightSlot.vue.js +7 -6
  22. package/dist/components/organisms/header/RightSlot.vue2.js +17 -15
  23. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue.js +18 -0
  24. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue2.js +37 -0
  25. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue.js +24 -0
  26. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue2.js +48 -0
  27. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue.js +18 -0
  28. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue2.js +74 -0
  29. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +43 -34
  30. package/dist/composables/useAccessibilityApi.js +31 -0
  31. package/dist/composables/useCustomInterfaceAppearance.js +31 -28
  32. package/dist/composables/useRecommendation.js +29 -30
  33. package/dist/composables/useStripo.js +14 -14
  34. package/dist/config/i18n/en/labels.json.js +29 -5
  35. package/dist/config/migrator/index.js +9 -8
  36. package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
  37. package/dist/config/migrator/recommendation/extractors.js +29 -24
  38. package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
  39. package/dist/config/migrator/recommendation/settingsMapper.js +0 -2
  40. package/dist/config/migrator/recommendationMigrator.js +30 -26
  41. package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
  42. package/dist/enums/date.js +5 -4
  43. package/dist/enums/extensions/recommendationBlock.js +0 -1
  44. package/dist/extensions/Blocks/Recommendation/block.js +12 -11
  45. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  46. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  47. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +24 -24
  48. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +35 -28
  49. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +329 -257
  50. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +180 -133
  51. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +1 -19
  52. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
  53. package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
  54. package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
  55. package/dist/extensions/Blocks/Recommendation/services/configService.js +34 -16
  56. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
  57. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +83 -128
  58. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
  59. package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
  60. package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
  61. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +22 -0
  62. package/dist/guido.css +1 -1
  63. package/dist/node_modules/@vueuse/core/index.js +102 -0
  64. package/dist/node_modules/@vueuse/shared/index.js +40 -28
  65. package/dist/services/recommendationApi.js +10 -16
  66. package/dist/sprite.svg +6 -0
  67. package/dist/src/@types/config/schemas.d.ts +4 -10
  68. package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +2 -4
  69. package/dist/src/components/organisms/header/AutoSaveStatus.vue.d.ts +2 -0
  70. package/dist/src/components/organisms/header/EditorActionsMenu.vue.d.ts +2 -0
  71. package/dist/src/components/organisms/header/accessibility/AccessibilityToolbar.vue.d.ts +2 -0
  72. package/dist/src/components/organisms/header/accessibility/ColorVisionSelect.vue.d.ts +2 -0
  73. package/dist/src/components/organisms/onboarding/EditorTabBarOnboarding.vue.d.ts +2 -0
  74. package/dist/src/composables/useAccessibilityApi.d.ts +15 -0
  75. package/dist/src/composables/useActionsApi.d.ts +2 -2
  76. package/dist/src/composables/useConfig.d.ts +2 -0
  77. package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
  78. package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
  79. package/dist/src/enums/date.d.ts +1 -0
  80. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
  81. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
  82. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -5
  83. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  84. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -0
  85. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +11 -0
  86. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
  87. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +39 -15
  88. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -14
  89. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
  90. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
  91. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +12 -1
  92. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +26 -56
  93. package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
  94. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -5
  95. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +31 -0
  96. package/dist/src/mock/api/recommendation-strategies.d.ts +0 -61
  97. package/dist/src/services/recommendationApi.d.ts +1 -1
  98. package/dist/src/stores/config.d.ts +18 -0
  99. package/dist/src/stores/editor.d.ts +76 -0
  100. package/dist/src/stores/onboarding.d.ts +377 -0
  101. package/dist/src/stores/save-as-template.d.ts +4 -3
  102. package/dist/src/stores/version-history.d.ts +1 -1
  103. package/dist/src/utils/genericUtil.d.ts +5 -0
  104. package/dist/src/utils/timeUtil.d.ts +10 -0
  105. package/dist/static/assets/icons/line-delete.svg.js +2 -2
  106. package/dist/static/assets/icons/line-plus.svg.js +2 -2
  107. package/dist/static/styles/components/accessibility.css.js +137 -0
  108. package/dist/static/styles/components/recommendation-strategy.css.js +2 -35
  109. package/dist/static/styles/customEditorStyle.css.js +3 -1
  110. package/dist/static/styles/variables.css.js +1 -0
  111. package/dist/stores/editor.js +4 -1
  112. package/dist/stores/onboarding.js +16 -11
  113. package/dist/utils/dateUtil.js +18 -24
  114. package/dist/utils/genericUtil.js +28 -27
  115. package/dist/utils/templatePreparation.js +0 -2
  116. package/dist/utils/timeUtil.js +6 -17
  117. package/package.json +3 -3
  118. package/dist/components/organisms/header/AutoSaveToggle.vue.js +0 -22
  119. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +0 -19
  120. package/dist/src/utils/strategyInfoBox.d.ts +0 -35
  121. package/dist/utils/strategyInfoBox.js +0 -68
  122. /package/dist/src/components/organisms/{header/AutoSaveToggle.vue.d.ts → extensions/recommendation/RemoveStrategyModal.vue.d.ts} +0 -0
@@ -2,13 +2,13 @@ import { ModificationDescription as h } from "../../../../node_modules/@stripoin
2
2
  import { PRE_RRS_CONFIG_VERSION as C, DEFAULT_NODE_CONFIG as c } from "../constants/defaultConfig.js";
3
3
  import { setCurrencyAttributes as D } from "../controls/main/utils.js";
4
4
  import { hasMinimalConfig as S } from "../types/nodeConfig.js";
5
- function A(n) {
6
- return n === "." || n === "," || n === " ";
5
+ function A(r) {
6
+ return r === "." || r === "," || r === " ";
7
7
  }
8
- function N(n) {
9
- return n === "." || n === "," || n === " " || n === "";
8
+ function N(r) {
9
+ return r === "." || r === "," || r === " " || r === "";
10
10
  }
11
- class F {
11
+ class M {
12
12
  // ========================================================================
13
13
  // Read Operations
14
14
  // ========================================================================
@@ -83,9 +83,27 @@ class F {
83
83
  * @returns The new complete configuration
84
84
  */
85
85
  static updateConfig(i, t, o, e) {
86
- const r = this.getConfig(t), u = this.deepMerge(r, o);
86
+ const n = this.getConfig(t), u = this.deepMerge(n, o);
87
87
  return this.saveConfig(i, t, u, e), u;
88
88
  }
89
+ /**
90
+ * Accumulate a config update into an existing modifier batch, WITHOUT applying.
91
+ *
92
+ * The caller owns the apply(), so the write shares one undo entry with the rest
93
+ * of that batch — a change whose visible result only lands after an async product
94
+ * fetch would otherwise cost the user two undo presses (SD-149105).
95
+ * @param documentModifier - The batch to accumulate into (caller applies)
96
+ * @param node - The immutable HTML node to write to
97
+ * @param updates - Partial config with values to update
98
+ */
99
+ static stageConfig(i, t, o) {
100
+ const e = this.deepMerge(this.getConfig(t), o);
101
+ try {
102
+ i.modifyHtml(t).setNodeConfig(e);
103
+ } catch (n) {
104
+ console.warn("[RecommendationConfigService] Failed to stage config:", n);
105
+ }
106
+ }
89
107
  /**
90
108
  * Initialize configuration for a new block
91
109
  *
@@ -126,8 +144,8 @@ class F {
126
144
  static saveConfig(i, t, o, e) {
127
145
  try {
128
146
  i.getDocumentModifier().modifyHtml(t).setNodeConfig(o).apply(new h(e));
129
- } catch (r) {
130
- console.warn("[RecommendationConfigService] Failed to save config:", r);
147
+ } catch (n) {
148
+ console.warn("[RecommendationConfigService] Failed to save config:", n);
131
149
  }
132
150
  }
133
151
  // ========================================================================
@@ -164,20 +182,20 @@ class F {
164
182
  s && typeof s == "object" && Object.assign(o, s);
165
183
  } catch {
166
184
  }
167
- const r = t.getAttribute("data-layout");
168
- r === "list" || r === "horizontal" ? o.layout = "list" : (r === "grid" || r === "vertical") && (o.layout = "grid");
185
+ const n = t.getAttribute("data-layout");
186
+ n === "list" || n === "horizontal" ? o.layout = "list" : (n === "grid" || n === "vertical") && (o.layout = "grid");
169
187
  const u = t.getAttribute("data-card-composition");
170
188
  u && (o.composition = u.split(",").filter(Boolean));
171
189
  const l = t.getAttribute("data-column-spacing");
172
190
  l && (o.columnSpacing = parseInt(l) || c.columnSpacing);
173
- const b = t.getAttribute("data-row-spacing");
174
- if (b && (o.rowSpacing = parseInt(b) || c.rowSpacing), !o.currency) {
175
- const s = t.getAttribute("currency"), p = t.getAttribute("currency-symbol"), y = t.getAttribute("currency-alignment"), f = t.getAttribute("currency-thousand-separator"), g = t.getAttribute("currency-decimal-separator"), m = t.getAttribute("currency-decimal-count");
176
- if (s || p || y || f || g || m) {
191
+ const p = t.getAttribute("data-row-spacing");
192
+ if (p && (o.rowSpacing = parseInt(p) || c.rowSpacing), !o.currency) {
193
+ const s = t.getAttribute("currency"), b = t.getAttribute("currency-symbol"), y = t.getAttribute("currency-alignment"), f = t.getAttribute("currency-thousand-separator"), g = t.getAttribute("currency-decimal-separator"), m = t.getAttribute("currency-decimal-count");
194
+ if (s || b || y || f || g || m) {
177
195
  const a = c.currency, d = m ? parseInt(m) : NaN;
178
196
  o.currency = {
179
197
  code: s ?? a.code,
180
- symbol: p ?? a.symbol,
198
+ symbol: b ?? a.symbol,
181
199
  alignment: y === "0" ? "before" : "after",
182
200
  decimalCount: Number.isFinite(d) ? d : a.decimalCount,
183
201
  decimalSeparator: A(g) ? g : a.decimalSeparator,
@@ -279,5 +297,5 @@ class F {
279
297
  }
280
298
  }
281
299
  export {
282
- F as RecommendationConfigService
300
+ M as RecommendationConfigService
283
301
  };
@@ -3,9 +3,10 @@ import { BLOCK_ID as R } from "./block.js";
3
3
  import { RecommendationBlockId as S } from "./constants/blockIds.js";
4
4
  import { RecommendationControlId as T } from "./constants/controlIds.js";
5
5
  import "./constants/selectors.js";
6
- import { CONTROL_BLOCK_ID as U } from "./controls/main/index.js";
6
+ import { CONTROL_BLOCK_ID as L } from "./controls/main/index.js";
7
7
  import "./store/recommendation.js";
8
8
  import "./utils/captureStyleTemplates.js";
9
+ import "./controls/title/index.js";
9
10
  import "./controls/name/index.js";
10
11
  import "./controls/price/index.js";
11
12
  import "./controls/oldPrice/index.js";
@@ -15,7 +16,7 @@ import "./controls/button/index.js";
15
16
  import "./controls/image/index.js";
16
17
  import { SPACING_CONTROL_ID as A } from "./controls/spacing/index.js";
17
18
  import "./controls/blockBackground/index.js";
18
- import { CARD_BACKGROUND_COLOR_CONTROL_ID as L } from "./controls/cardBackground/index.js";
19
+ import { CARD_BACKGROUND_COLOR_CONTROL_ID as U } from "./controls/cardBackground/index.js";
19
20
  import { COMPOSITION_CONTROL_BLOCK_ID as D } from "./controls/cardComposition/index.js";
20
21
  import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
21
22
  class s extends E {
@@ -24,7 +25,7 @@ class s extends E {
24
25
  new _(
25
26
  I.SETTINGS,
26
27
  [
27
- U,
28
+ L,
28
29
  C.EXTERNAL_INDENTS
29
30
  ]
30
31
  ),
@@ -32,7 +33,7 @@ class s extends E {
32
33
  I.STYLES,
33
34
  [
34
35
  T.BLOCK_BACKGROUND,
35
- L,
36
+ U,
36
37
  A
37
38
  ]
38
39
  ),
@@ -42,6 +43,24 @@ class s extends E {
42
43
  D
43
44
  ]
44
45
  ).withLabel(this.api.translate("Card Composition"))
46
+ ], O[S.TITLE] = [
47
+ new _(
48
+ I.SETTINGS,
49
+ [
50
+ T.TITLE_STYLE,
51
+ T.TITLE_ALIGN,
52
+ T.TITLE_PADDINGS
53
+ ]
54
+ ),
55
+ new _(
56
+ I.STYLES,
57
+ [
58
+ T.TITLE_BACKGROUND,
59
+ T.TITLE_FONT_FAMILY,
60
+ T.TITLE_SIZE,
61
+ T.TITLE_COLOR
62
+ ]
63
+ )
45
64
  ], O[S.NAME] = [
46
65
  new _(
47
66
  I.SETTINGS,
@@ -1,22 +1,22 @@
1
- import { useConfig as C } from "../../../../composables/useConfig.js";
2
- import { getRecommendationFeedSourceMaps as y, getOperatorOptions as w, PriceAttributes as G } from "../../../../enums/extensions/recommendationBlock.js";
1
+ import { getRecommendationFeedSourceMaps as b, getOperatorOptions as G, PriceAttributes as v } from "../../../../enums/extensions/recommendationBlock.js";
3
2
  import { useRecommendationApi as D } from "../../../../services/recommendationApi.js";
4
3
  import { useConfigStore as P } from "../../../../stores/config.js";
5
4
  import { defineStore as F } from "pinia";
6
5
  import "../constants/selectors.js";
7
- import { DEFAULT_MOBILE_CARDS_IN_ROW as v, DEFAULT_CARDS_IN_ROW as _ } from "../constants/layout.js";
8
- import { DEFAULT_NODE_CONFIG as U, EXCLUDED_ALGORITHM_IDS as N } from "../constants/defaultConfig.js";
9
- import { getDefaultProducts as b } from "../templates/utils.js";
10
- import { generateCompleteFilterQuery as I } from "../utils/filterUtil.js";
11
- import { getPartnerRecommendationParams as L } from "../utils/partnerCustomizations.js";
12
- import { sanitizeProductIds as x } from "../utils/productIds.js";
13
- import { isFilterValid as A } from "../validation/filterSchema.js";
14
- import { isConfigValid as B } from "../validation/requiredFields.js";
15
- const d = D();
16
- let f = null, g = null, h = null, S = null;
17
- function R() {
6
+ import { DEFAULT_MOBILE_CARDS_IN_ROW as _, DEFAULT_CARDS_IN_ROW as U } from "../constants/layout.js";
7
+ import { DEFAULT_NODE_CONFIG as N, EXCLUDED_ALGORITHM_IDS as L } from "../constants/defaultConfig.js";
8
+ import { getDefaultProducts as R } from "../templates/utils.js";
9
+ import { generateCompleteFilterQuery as k } from "../utils/filterUtil.js";
10
+ import { getPartnerRecommendationParams as x } from "../utils/partnerCustomizations.js";
11
+ import { sanitizeProductIds as A } from "../utils/productIds.js";
12
+ import { isFilterValid as B } from "../validation/filterSchema.js";
13
+ import { isConfigValid as M } from "../validation/requiredFields.js";
14
+ const u = D();
15
+ let f = null, h = null, g = null, S = null;
16
+ const p = /* @__PURE__ */ new Map();
17
+ function w() {
18
18
  return {
19
- cardsInRow: _,
19
+ cardsInRow: U,
20
20
  currencySettings: {
21
21
  name: "USD",
22
22
  value: "USD",
@@ -30,7 +30,7 @@ function R() {
30
30
  productIds: [],
31
31
  id: 1,
32
32
  language: "en_US",
33
- mobileCardsInRow: v,
33
+ mobileCardsInRow: _,
34
34
  mobileLayoutEnabled: !1,
35
35
  orientation: "grid",
36
36
  recommendedProducts: [],
@@ -46,13 +46,14 @@ function R() {
46
46
  priceHideIfSameAsDiscounted: !1
47
47
  };
48
48
  }
49
- function k() {
49
+ function C() {
50
50
  return {
51
- recommendationConfigs: R(),
51
+ recommendationConfigs: w(),
52
52
  recommendationProducts: [],
53
53
  filterStatus: !1,
54
54
  filterSelectionDrawerStatus: !1,
55
55
  assignStrategyDrawerStatus: !1,
56
+ removeStrategyModalStatus: !1,
56
57
  filterGroup: 1,
57
58
  isInitialized: !1,
58
59
  filterSnapshot: null
@@ -81,7 +82,7 @@ const z = () => ({
81
82
  * This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
82
83
  */
83
84
  recommendationConfigs(t) {
84
- return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : R();
85
+ return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : w();
85
86
  },
86
87
  /**
87
88
  * Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
@@ -95,16 +96,12 @@ const z = () => ({
95
96
  filterSelectionDrawerStatus(t) {
96
97
  return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].filterSelectionDrawerStatus : !1;
97
98
  },
98
- /**
99
- * Proxy getter: delegates to blockStates[currentRecommendationId].assignStrategyDrawerStatus
100
- */
101
99
  assignStrategyDrawerStatus(t) {
102
100
  return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].assignStrategyDrawerStatus : !1;
103
101
  },
104
- /**
105
- * The current block's assigned strategy record from the listing,
106
- * or null when nothing is assigned / the strategy is no longer listed.
107
- */
102
+ removeStrategyModalStatus(t) {
103
+ return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].removeStrategyModalStatus : !1;
104
+ },
108
105
  assignedStrategy(t) {
109
106
  const { strategyId: e } = this.recommendationConfigs;
110
107
  return e ? t.strategies.find((r) => String(r.strategy_id) === e) ?? null : null;
@@ -140,8 +137,8 @@ const z = () => ({
140
137
  return [...new Set(t.map((e) => e.filterGroup))].sort((e, r) => e - r);
141
138
  },
142
139
  getActivePredictiveAlgorithms: (t) => {
143
- const e = y(), r = [];
144
- return t.activePredictiveAlgorithms.filter((n) => !N.includes(n)).forEach((n) => {
140
+ const e = b(), r = [];
141
+ return t.activePredictiveAlgorithms.filter((n) => !L.includes(n)).forEach((n) => {
145
142
  r.push(...e.filter((s) => s.id === n));
146
143
  }), r.map((n) => ({
147
144
  text: n.name,
@@ -159,7 +156,7 @@ const z = () => ({
159
156
  getFilterList() {
160
157
  return Object.values(this.filterList).filter((t) => t.isFilterable !== 0 && t.isFilterable !== !1).map((t) => {
161
158
  let e;
162
- return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : G.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
159
+ return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : v.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
163
160
  text: t.displayName,
164
161
  value: e,
165
162
  type: t.attributeType
@@ -181,7 +178,7 @@ const z = () => ({
181
178
  setCurrentBlock(t) {
182
179
  this.blockStates[t] || (this.blockStates = {
183
180
  ...this.blockStates,
184
- [t]: k()
181
+ [t]: C()
185
182
  }), this.currentRecommendationId = t;
186
183
  },
187
184
  /**
@@ -241,7 +238,7 @@ const z = () => ({
241
238
  * `isInitialized`) alone.
242
239
  */
243
240
  seedBlockUrlConfig(t, e) {
244
- const r = (o, a) => o === "." || o === "," || o === " " ? o : a, n = {
241
+ const r = (o, c) => o === "." || o === "," || o === " " ? o : c, n = {
245
242
  name: e.currencyCode,
246
243
  value: e.currencyCode,
247
244
  symbol: e.currencyCode,
@@ -249,7 +246,7 @@ const z = () => ({
249
246
  decimalCount: String(e.currencyDecimalCount),
250
247
  decimalSeparator: r(e.currencyDecimalSeparator, ","),
251
248
  thousandSeparator: r(e.currencyThousandSeparator, ".")
252
- }, s = !this.blockStates[t], i = s ? k() : this.blockStates[t];
249
+ }, s = !this.blockStates[t], i = s ? C() : this.blockStates[t];
253
250
  i.recommendationConfigs = {
254
251
  ...i.recommendationConfigs,
255
252
  strategy: e.strategy,
@@ -288,7 +285,7 @@ const z = () => ({
288
285
  * Creates a filter with the first available attribute and operator pre-selected.
289
286
  */
290
287
  createDefaultFilter(t, e) {
291
- const [r] = this.getFilterList, [n] = w(r == null ? void 0 : r.type);
288
+ const [r] = this.getFilterList, [n] = G(r == null ? void 0 : r.type);
292
289
  return {
293
290
  type: "standardFilter",
294
291
  attribute: (r == null ? void 0 : r.value) ?? "",
@@ -335,25 +332,18 @@ const z = () => ({
335
332
  const t = this.blockStates[this.currentRecommendationId];
336
333
  t.filterSnapshot !== null && (t.recommendationConfigs.filters = t.filterSnapshot, t.filterSnapshot = null), t.filterSelectionDrawerStatus = !1;
337
334
  },
338
- // ====================================================================
339
- // Reusable Recommendation Strategy (SD-149105)
340
- // ====================================================================
341
- /**
342
- * Opens the Assign Strategy drawer for the current block.
343
- * Selection state lives in the drawer component until Assign is
344
- * pressed, so closing without assigning needs no snapshot/revert.
345
- */
346
335
  openAssignStrategyDrawer() {
347
336
  this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].assignStrategyDrawerStatus = !0);
348
337
  },
349
338
  closeAssignStrategyDrawer() {
350
339
  this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].assignStrategyDrawerStatus = !1);
351
340
  },
352
- /**
353
- * Fetches the active + EMAIL strategy listing. Always fetches fresh
354
- * (dead-strategy detection and post-create refresh need freshness);
355
- * only concurrent in-flight calls share one request.
356
- */
341
+ openRemoveStrategyModal() {
342
+ this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].removeStrategyModalStatus = !0);
343
+ },
344
+ closeRemoveStrategyModal() {
345
+ this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].removeStrategyModalStatus = !1);
346
+ },
357
347
  async fetchStrategies() {
358
348
  if (S) {
359
349
  await S;
@@ -362,7 +352,7 @@ const z = () => ({
362
352
  S = (async () => {
363
353
  this.strategiesLoading = !0;
364
354
  try {
365
- this.strategies = await d.fetchRecommendationStrategies();
355
+ this.strategies = await u.fetchRecommendationStrategies();
366
356
  } finally {
367
357
  this.strategiesLoading = !1;
368
358
  }
@@ -373,49 +363,24 @@ const z = () => ({
373
363
  S = null;
374
364
  }
375
365
  },
376
- /**
377
- * Resolves a strategy's recommendation endpoint template via
378
- * endpoint-generate, cached per strategy id + revision + currency.
379
- * Failures throw and are NOT cached, so the next attempt retries.
380
- *
381
- * `full_path` bakes in the algorithm path and `size=` as they were when
382
- * generated, so the revision keys the cache — and a record with no
383
- * revision is not cached at all, since its key could never change.
384
- * Currency joins the key because it is sent in the request body, so two
385
- * currencies can resolve to different paths for the same revision.
386
- */
387
366
  async resolveStrategyUrlTemplate(t, e) {
388
367
  const r = typeof t.updated_at == "string" ? t.updated_at : "", n = r ? `${t.strategy_id}:${r}:${e}` : "", s = n ? this.strategyUrlTemplates[n] : void 0;
389
368
  if (s)
390
369
  return s;
391
- const { full_path: i } = await d.generateStrategyEndpoint(t, e);
392
- return n && (this.strategyUrlTemplates = {
370
+ const { full_path: i = "" } = await u.generateStrategyEndpoint(t, e) ?? {};
371
+ return n && i && (this.strategyUrlTemplates = {
393
372
  ...this.strategyUrlTemplates,
394
373
  [n]: i
395
374
  }), i;
396
375
  },
397
- /**
398
- * Assigns a strategy to the current block. The config write is
399
- * synchronous (before any await) so a block switch cannot misdirect
400
- * it; the configVersion bump persists it to node config and triggers
401
- * the product refetch via the coordinator control's subscription.
402
- */
403
376
  assignStrategy(t) {
404
377
  this.patchCurrentBlockConfig({
405
378
  strategyId: String(t.strategy_id),
406
379
  ...t.size !== void 0 ? { size: String(t.size) } : {}
407
380
  });
408
381
  },
409
- /**
410
- * Clears the current block's strategy; it falls back to the per-block
411
- * algorithm settings.
412
- *
413
- * `size` goes back to the default rather than staying on the removed
414
- * strategy's count: with Number of Products hidden in RRS mode, a block
415
- * left on that count would have no UI to correct it.
416
- */
417
382
  removeStrategy() {
418
- this.patchCurrentBlockConfig({ strategyId: "", size: U.size });
383
+ this.patchCurrentBlockConfig({ strategyId: "", size: N.size });
419
384
  },
420
385
  // ====================================================================
421
386
  // Shared Data Fetching (fetched once, used by all blocks)
@@ -431,7 +396,7 @@ const z = () => ({
431
396
  activePredictiveAlgorithms: t,
432
397
  languages: e,
433
398
  currencies: r
434
- } = await d.fetchRecommendationCreateData();
399
+ } = await u.fetchRecommendationCreateData();
435
400
  if (this.activePredictiveAlgorithms = t, this.languages = e, this.currentRecommendationId !== null && this.blockStates[this.currentRecommendationId]) {
436
401
  const n = this.blockStates[this.currentRecommendationId];
437
402
  n.filterStatus = !!n.recommendationConfigs.filters.length;
@@ -447,18 +412,18 @@ const z = () => ({
447
412
  },
448
413
  async fetchRecommendationFilters() {
449
414
  if (!Object.keys(this.filterList).length) {
450
- if (g) {
451
- await g;
415
+ if (h) {
416
+ await h;
452
417
  return;
453
418
  }
454
- g = (async () => {
455
- const t = await d.fetchRecommendationFilters();
419
+ h = (async () => {
420
+ const t = await u.fetchRecommendationFilters();
456
421
  this.filterList = t;
457
422
  })();
458
423
  try {
459
- await g;
424
+ await h;
460
425
  } finally {
461
- g = null;
426
+ h = null;
462
427
  }
463
428
  }
464
429
  },
@@ -487,7 +452,7 @@ const z = () => ({
487
452
  const n = [...e.recommendationConfigs.filters];
488
453
  n[r] = {
489
454
  ...t,
490
- isValid: A(t)
455
+ isValid: B(t)
491
456
  }, e.recommendationConfigs.filters = n;
492
457
  }
493
458
  },
@@ -501,10 +466,10 @@ const z = () => ({
501
466
  let i = 1;
502
467
  n = n.map((o) => o.filterGroup === t.filterGroup ? { ...o, filterNumber: i++ } : o);
503
468
  } 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
469
+ const i = [...new Set(n.map((c) => c.filterGroup))].sort((c, a) => c - a), o = new Map(i.map((c, a) => [c, a + 1]));
470
+ n = n.map((c) => ({
471
+ ...c,
472
+ filterGroup: o.get(c.filterGroup) ?? c.filterGroup
508
473
  }));
509
474
  }
510
475
  e.recommendationConfigs.filters = n;
@@ -525,7 +490,7 @@ const z = () => ({
525
490
  }), e.recommendationConfigs.filters = r;
526
491
  },
527
492
  generateFilterQuery() {
528
- return I(this.recommendationConfigs.filters);
493
+ return k(this.recommendationConfigs.filters);
529
494
  },
530
495
  /**
531
496
  * Validation-only check invoked at save-CTA time. Defined as an action
@@ -533,33 +498,33 @@ const z = () => ({
533
498
  * every block's recommendationConfigs across user edits.
534
499
  */
535
500
  hasInvalidBlock() {
536
- return Object.values(this.blockStates).some((t) => !B(t.recommendationConfigs, this));
501
+ return Object.values(this.blockStates).some((t) => !M(t.recommendationConfigs, this));
537
502
  },
538
503
  // ====================================================================
539
504
  // Per-Block Product Fetching
540
505
  // ====================================================================
541
506
  async fetchRecommendationProducts() {
542
507
  if (!(this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])) {
543
- if (h) {
544
- await h;
508
+ if (g) {
509
+ await g;
545
510
  return;
546
511
  }
547
- h = this._doFetchProducts();
512
+ g = this._doFetchProducts();
548
513
  try {
549
- await h;
514
+ await g;
550
515
  } finally {
551
- h = null;
516
+ g = null;
552
517
  }
553
518
  }
554
519
  },
555
520
  async _doFetchProducts() {
556
- var p;
557
- const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = P(), { isFeatureEnabled: s } = C();
558
- if (s("reusableRecommendationStrategy") && r.strategyId) {
521
+ var d;
522
+ const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = P();
523
+ if (r.strategyId && n.isFeatureEnabled("reusableRecommendationStrategy")) {
559
524
  await this._doFetchStrategyProducts(t);
560
525
  return;
561
526
  }
562
- const i = r.filters.filter((u) => u.isValid), o = I(i), a = ((p = y().find((u) => u.key === r.strategy)) == null ? void 0 : p.path) || "", c = parseInt(r.size) || 6, l = {
527
+ const s = r.filters.filter((m) => m.isValid), i = k(s), o = ((d = b().find((m) => m.key === r.strategy)) == null ? void 0 : d.path) || "", c = parseInt(r.size) || 6, a = {
563
528
  locale: r.language,
564
529
  currency: r.currencySettings.value,
565
530
  partnerName: n.partnerName,
@@ -567,55 +532,45 @@ const z = () => ({
567
532
  details: !0,
568
533
  campaignId: n.variationId
569
534
  };
570
- r.strategy === "manualMerchandising" ? l.productId = x(r.productIds) : r.strategy === "similarViewed" && (l.productId = "{itemId}"), r.strategy === "userBased" && (l.userId = "{user_id}"), o && (l.filter = o), r.shuffleProducts && (l.shuffle = !0), Object.assign(
571
- l,
572
- L(n.partnerName, r.strategy)
535
+ r.strategy === "manualMerchandising" ? a.productId = A(r.productIds) : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), i && (a.filter = i), r.shuffleProducts && (a.shuffle = !0), Object.assign(
536
+ a,
537
+ x(n.partnerName, r.strategy)
573
538
  );
574
- let m;
539
+ let l;
575
540
  try {
576
- m = await d.fetchRecommendationProducts(a, l);
541
+ l = await u.fetchRecommendationProducts(o, a);
577
542
  } catch {
578
- m = [];
543
+ l = [];
579
544
  }
580
- this._setBlockProducts(t, m, c);
545
+ this._setBlockProducts(t, l, c);
581
546
  },
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
547
  async _doFetchStrategyProducts(t) {
589
- const { recommendationConfigs: e } = this.blockStates[t];
590
- let r = [], n = parseInt(e.size) || 6;
548
+ const e = (p.get(t) ?? 0) + 1;
549
+ p.set(t, e);
550
+ const { recommendationConfigs: r } = this.blockStates[t];
551
+ let n = [], s = parseInt(r.size) || 6;
591
552
  try {
592
553
  await this.fetchStrategies();
593
- const s = this.strategies.find(
594
- (i) => String(i.strategy_id) === e.strategyId
554
+ const i = this.strategies.find(
555
+ (o) => String(o.strategy_id) === r.strategyId
595
556
  );
596
- if (s) {
597
- n = parseInt(String(s.size ?? "")) || n;
598
- const i = e.currencySettings.value, a = (await this.resolveStrategyUrlTemplate(s, i)).replaceAll("{locale}", e.language).replaceAll("{currency}", i), c = a.indexOf("?"), l = c === -1 ? a : a.slice(0, c), m = (c === -1 ? "" : a.slice(c + 1)).split("&").filter((u) => u && !u.startsWith("user_id=")), p = m.length ? `${l}?${m.join("&")}` : l;
599
- r = await d.fetchRecommendationProductsByUrl(p);
557
+ if (i) {
558
+ s = parseInt(String(i.size ?? "")) || s;
559
+ const o = r.currencySettings.value, a = (await this.resolveStrategyUrlTemplate(i, o)).replaceAll("{locale}", r.language).replaceAll("{currency}", o), l = a.indexOf("?"), d = l === -1 ? a : a.slice(0, l), m = (l === -1 ? "" : a.slice(l + 1)).split("&").filter((I) => I && !I.startsWith("user_id=")), y = m.length ? `${d}?${m.join("&")}` : d;
560
+ y && (n = await u.fetchRecommendationProductsByUrl(y));
600
561
  }
601
562
  } catch {
602
- r = [];
563
+ n = [];
603
564
  }
604
- this._setBlockProducts(t, r, n);
565
+ p.get(t) === e && this._setBlockProducts(t, n, s);
605
566
  },
606
- /**
607
- * Writes products to a block's state, padded/clipped to exactly `size`:
608
- * in-place content updates compare the DOM element count against
609
- * products.length, and a longer list makes the renderer extend its slot
610
- * grid, which resets migrator-applied styles.
611
- */
612
567
  _setBlockProducts(t, e, r) {
613
568
  if (!this.blockStates[t])
614
569
  return;
615
- const n = e.length > 0 ? e : b(r);
570
+ const n = e.length > 0 ? e : R(r);
616
571
  this.blockStates[t].recommendationProducts = [
617
572
  ...n.slice(0, r),
618
- ...b(Math.max(0, r - n.length))
573
+ ...R(Math.max(0, r - n.length))
619
574
  ];
620
575
  }
621
576
  }
@@ -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
+ };