@useinsider/guido 3.18.2-beta.9be830c → 3.18.2-beta.a5a0a11

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 (92) hide show
  1. package/dist/@types/config/schemas.js +13 -15
  2. package/dist/components/Guido.vue.js +7 -7
  3. package/dist/components/Guido.vue2.js +30 -30
  4. package/dist/components/organisms/AutoSaveController.vue2.js +8 -10
  5. package/dist/components/organisms/base/Toaster.vue2.js +13 -12
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
  7. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +74 -57
  8. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +23 -37
  9. package/dist/components/organisms/header/AutoSaveToggle.vue.js +22 -0
  10. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
  11. package/dist/components/organisms/header/EditorActions.vue.js +13 -13
  12. package/dist/components/organisms/header/EditorActions.vue2.js +52 -36
  13. package/dist/components/organisms/header/HeaderWrapper.vue.js +6 -6
  14. package/dist/components/organisms/header/HeaderWrapper.vue2.js +17 -9
  15. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  16. package/dist/components/organisms/header/LeftSlot.vue2.js +23 -28
  17. package/dist/components/organisms/header/MiddleSlot.vue.js +4 -4
  18. package/dist/components/organisms/header/MiddleSlot.vue2.js +7 -8
  19. package/dist/components/organisms/header/RightSlot.vue.js +8 -9
  20. package/dist/components/organisms/header/RightSlot.vue2.js +18 -13
  21. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +12 -12
  22. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +38 -54
  23. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
  24. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
  25. package/dist/composables/useCustomInterfaceAppearance.js +52 -45
  26. package/dist/composables/useHtmlValidator.js +87 -82
  27. package/dist/composables/useRecommendation.js +40 -35
  28. package/dist/composables/useStripo.js +30 -30
  29. package/dist/composables/useToaster.js +14 -20
  30. package/dist/config/i18n/en/labels.json.js +4 -36
  31. package/dist/config/i18n/en/tooltips.json.js +1 -2
  32. package/dist/enums/extensions/recommendationBlock.js +38 -31
  33. package/dist/extensions/Blocks/Recommendation/block.js +61 -42
  34. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
  35. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +40 -35
  36. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +84 -52
  37. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
  38. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +260 -140
  39. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
  40. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
  41. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
  42. package/dist/guido.css +1 -1
  43. package/dist/node_modules/@vueuse/shared/index.js +28 -40
  44. package/dist/sprite.svg +0 -6
  45. package/dist/src/@types/config/schemas.d.ts +0 -4
  46. package/dist/src/components/organisms/AutoSaveController.vue.d.ts +1 -3
  47. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +3 -1
  48. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +3 -1
  49. package/dist/src/composables/useActionsApi.d.ts +2 -2
  50. package/dist/src/composables/useConfig.d.ts +0 -2
  51. package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
  52. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
  53. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
  54. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  55. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
  56. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +9 -0
  57. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
  58. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +86 -0
  59. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
  60. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
  61. package/dist/src/stores/config.d.ts +0 -18
  62. package/dist/src/stores/editor.d.ts +0 -107
  63. package/dist/src/stores/onboarding.d.ts +21 -195
  64. package/dist/src/stores/version-history.d.ts +1 -1
  65. package/dist/src/utils/timeUtil.d.ts +0 -10
  66. package/dist/static/styles/components/recommendation-strategy.css.js +34 -4
  67. package/dist/static/styles/components/skeleton.css.js +23 -0
  68. package/dist/static/styles/variables.css.js +0 -2
  69. package/dist/stores/editor.js +4 -13
  70. package/dist/stores/onboarding.js +50 -66
  71. package/dist/utils/templatePreparation.js +55 -55
  72. package/dist/utils/timeUtil.js +17 -7
  73. package/package.json +5 -5
  74. package/dist/components/organisms/header/AutoSaveStatus.vue.js +0 -17
  75. package/dist/components/organisms/header/AutoSaveStatus.vue2.js +0 -27
  76. package/dist/components/organisms/header/EditorActionsMenu.vue.js +0 -20
  77. package/dist/components/organisms/header/EditorActionsMenu.vue2.js +0 -48
  78. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue.js +0 -18
  79. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue2.js +0 -37
  80. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue.js +0 -24
  81. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue2.js +0 -48
  82. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue.js +0 -19
  83. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue2.js +0 -82
  84. package/dist/composables/useAccessibilityApi.js +0 -35
  85. package/dist/node_modules/@vueuse/core/index.js +0 -102
  86. package/dist/src/components/organisms/header/accessibility/AccessibilityToolbar.vue.d.ts +0 -2
  87. package/dist/src/components/organisms/header/accessibility/ColorVisionSelect.vue.d.ts +0 -2
  88. package/dist/src/components/organisms/onboarding/EditorTabBarOnboarding.vue.d.ts +0 -2
  89. package/dist/src/composables/useAccessibilityApi.d.ts +0 -15
  90. package/dist/static/styles/components/accessibility.css.js +0 -282
  91. /package/dist/src/components/organisms/header/{AutoSaveStatus.vue.d.ts → AutoSaveToggle.vue.d.ts} +0 -0
  92. /package/dist/src/components/organisms/{header/EditorActionsMenu.vue.d.ts → onboarding/RecommendationStrategyOnboarding.vue.d.ts} +0 -0
@@ -1,13 +1,13 @@
1
- import { DEFAULT_COLUMN_SPACING as R, DEFAULT_ROW_SPACING as s, DEFAULT_MOBILE_ROW_SPACING as n, DEFAULT_MOBILE_COLUMN_SPACING as O, DEFAULT_MOBILE_CARDS_IN_ROW as e, DEFAULT_CARDS_IN_ROW as C } from "./layout.js";
2
- import { ATTR_PRODUCT_IMAGE as o, ATTR_PRODUCT_NAME as t, ATTR_PRODUCT_OLD_PRICE as _, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OMNIBUS_PRICE as r, ATTR_PRODUCT_OMNIBUS_DISCOUNT as I, ATTR_PRODUCT_BUTTON as i, ATTR_RECOMMENDATION_TITLE as U } from "./selectors.js";
3
- const A = 1, u = 2, D = {
1
+ import { DEFAULT_COLUMN_SPACING as i, DEFAULT_ROW_SPACING as s, DEFAULT_MOBILE_ROW_SPACING as n, DEFAULT_MOBILE_COLUMN_SPACING as O, DEFAULT_MOBILE_CARDS_IN_ROW as e, DEFAULT_CARDS_IN_ROW as C } from "./layout.js";
2
+ import { ATTR_PRODUCT_IMAGE as o, ATTR_PRODUCT_NAME as t, ATTR_PRODUCT_OLD_PRICE as _, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OMNIBUS_PRICE as I, ATTR_PRODUCT_OMNIBUS_DISCOUNT as R, ATTR_PRODUCT_BUTTON as r, ATTR_RECOMMENDATION_TITLE as E } from "./selectors.js";
3
+ const U = 1, u = 2, m = 2, A = {
4
4
  code: "USD",
5
5
  symbol: "USD",
6
6
  alignment: "after",
7
7
  decimalCount: 2,
8
8
  decimalSeparator: ".",
9
9
  thousandSeparator: ","
10
- }, E = {
10
+ }, D = {
11
11
  textBefore: "",
12
12
  textAfter: ""
13
13
  }, a = {
@@ -18,26 +18,26 @@ const A = 1, u = 2, D = {
18
18
  t,
19
19
  _,
20
20
  T,
21
- r,
22
21
  I,
23
- i
22
+ R,
23
+ r
24
24
  ], N = {
25
- [U]: !0,
25
+ [E]: !0,
26
26
  [o]: !0,
27
27
  [t]: !0,
28
28
  [T]: !0,
29
29
  [_]: !0,
30
- [r]: !1,
31
30
  [I]: !1,
32
- [i]: !0
33
- }, m = {
31
+ [R]: !1,
32
+ [r]: !0
33
+ }, L = {
34
34
  // Settings
35
35
  strategy: "mostPopular",
36
36
  productIds: [],
37
37
  size: "6",
38
38
  shuffleProducts: !1,
39
39
  language: "en_US",
40
- currency: D,
40
+ currency: A,
41
41
  filters: [],
42
42
  strategyId: "",
43
43
  // Layout
@@ -46,7 +46,7 @@ const A = 1, u = 2, D = {
46
46
  mobileCardsInRow: e,
47
47
  mobileLayoutEnabled: !1,
48
48
  previousMobileCardsInRow: e,
49
- columnSpacing: R,
49
+ columnSpacing: i,
50
50
  rowSpacing: s,
51
51
  mobileColumnSpacing: O,
52
52
  mobileRowSpacing: n,
@@ -55,7 +55,7 @@ const A = 1, u = 2, D = {
55
55
  visibility: N,
56
56
  previousTitleHtml: "",
57
57
  // Element settings
58
- omnibusPrice: E,
58
+ omnibusPrice: D,
59
59
  omnibusDiscount: a,
60
60
  textTrimming: !1,
61
61
  // Price placement (block-level, affects all cards)
@@ -66,17 +66,18 @@ const A = 1, u = 2, D = {
66
66
  // of "false" (the actual hiding happens server-side at send).
67
67
  priceHideIfSameAsDiscounted: !1,
68
68
  // Meta
69
- configVersion: A,
69
+ configVersion: U,
70
70
  recommendationId: 0
71
- }, L = [11, 12];
71
+ }, P = [11, 12];
72
72
  export {
73
73
  u as CURRENT_CONFIG_VERSION,
74
74
  c as DEFAULT_COMPOSITION,
75
- D as DEFAULT_CURRENCY,
76
- m as DEFAULT_NODE_CONFIG,
75
+ A as DEFAULT_CURRENCY,
76
+ L as DEFAULT_NODE_CONFIG,
77
77
  a as DEFAULT_OMNIBUS_DISCOUNT,
78
- E as DEFAULT_OMNIBUS_PRICE,
78
+ D as DEFAULT_OMNIBUS_PRICE,
79
79
  N as DEFAULT_VISIBILITY,
80
- L as EXCLUDED_ALGORITHM_IDS,
81
- A as PRE_RRS_CONFIG_VERSION
80
+ P as EXCLUDED_ALGORITHM_IDS,
81
+ U as PRE_RRS_CONFIG_VERSION,
82
+ m as RRS_CONFIG_VERSION
82
83
  };
@@ -1,27 +1,27 @@
1
1
  var m = Object.defineProperty;
2
- var C = (h, l, t) => l in h ? m(h, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[l] = t;
3
- var n = (h, l, t) => C(h, typeof l != "symbol" ? l + "" : l, t);
2
+ var C = (g, c, t) => c in g ? m(g, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[c] = t;
3
+ var n = (g, c, t) => C(g, typeof c != "symbol" ? c + "" : c, t);
4
4
  import { useConfig as p } from "../../../../../composables/useConfig.js";
5
5
  import { ModificationDescription as y } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
6
  import { CommonControl as N } from "../../../common-control.js";
7
- import { CURRENT_CONFIG_VERSION as _, DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
7
+ import { RRS_CONFIG_VERSION as _, DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
8
8
  import { RECOMMENDATION_ID_ATTR as I } from "../../constants/selectors.js";
9
- import { RecommendationConfigService as c } from "../../services/configService.js";
9
+ import { RecommendationConfigService as l } from "../../services/configService.js";
10
10
  import { useRecommendationExtensionStore as R } from "../../store/recommendation.js";
11
11
  import { registerNodeConfigWriter as b } from "../../utils/nodeConfigWriter.js";
12
12
  import { AlgorithmControl as T } from "./algorithm.js";
13
13
  import { ALGORITHM_CONTROL_ID as ut } from "./algorithm.js";
14
14
  import { CurrencyControl as P } from "./currency.js";
15
- import { CURRENCY_CONTROL_ID as ht } from "./currency.js";
15
+ import { CURRENCY_CONTROL_ID as gt } from "./currency.js";
16
16
  import { FiltersControl as S } from "./filters.js";
17
- import { FILTERS_CONTROL_ID as gt } from "./filters.js";
17
+ import { FILTERS_CONTROL_ID as ft } from "./filters.js";
18
18
  import { LayoutOrientationControl as O } from "./layoutOrientation.js";
19
19
  import { LAYOUT_ORIENTATION_CONTROL_ID as Ct } from "./layoutOrientation.js";
20
20
  import { LocaleControl as L } from "./locale.js";
21
21
  import { LOCALE_CONTROL_ID as yt } from "./locale.js";
22
- import { PricePlacementControl as E } from "./pricePlacement.js";
22
+ import { PricePlacementControl as k } from "./pricePlacement.js";
23
23
  import { PRICE_PLACEMENT_CONTROL_ID as _t } from "./pricePlacement.js";
24
- import { ProductCountControl as k } from "./productCount.js";
24
+ import { ProductCountControl as E } from "./productCount.js";
25
25
  import { PRODUCT_COUNT_CONTROL_ID as Rt } from "./productCount.js";
26
26
  import { ProductLayoutControl as F } from "./productLayout.js";
27
27
  import { PRODUCT_LAYOUT_CONTROL_ID as Tt } from "./productLayout.js";
@@ -30,9 +30,9 @@ import { SHUFFLE_CONTROL_ID as St } from "./shuffle.js";
30
30
  import { StrategyControl as w } from "./strategy.js";
31
31
  import { STRATEGY_CONTROL_ID as Lt } from "./strategy.js";
32
32
  import { setCurrencyAttributes as A, getBlockElement as v, isPartnerManagedBlock as x, updateProductContentInPlace as B, regenerateProductRowsWithStyles as U } from "./utils.js";
33
- import { adjustProductsToSize as kt, formatProductPrice as Ft, getCardComposition as Dt, getCurrentLayout as wt, getMainContainerTbody as At, regenerateMobileProductRows as vt, updatePricesInPlace as xt, updateSingleProductContent as Bt } from "./utils.js";
34
- import { useDebounceFn as f } from "../../../../../node_modules/@vueuse/shared/index.js";
35
- const $ = "ui-elements-recommendation-block";
33
+ import { adjustProductsToSize as Et, formatProductPrice as Ft, getCardComposition as Dt, getCurrentLayout as wt, getMainContainerTbody as At, regenerateMobileProductRows as vt, updatePricesInPlace as xt, updateSingleProductContent as Bt } from "./utils.js";
34
+ import { useDebounceFn as h } from "../../../../../node_modules/@vueuse/shared/index.js";
35
+ const W = "ui-elements-recommendation-block";
36
36
  class at extends N {
37
37
  constructor() {
38
38
  super(...arguments);
@@ -58,7 +58,7 @@ class at extends N {
58
58
  /**
59
59
  * Debounced product fetch to prevent rapid API calls during config changes
60
60
  */
61
- n(this, "_debouncedFetchProducts", f(async () => {
61
+ n(this, "_debouncedFetchProducts", h(async () => {
62
62
  try {
63
63
  await this.store.fetchRecommendationProducts();
64
64
  } finally {
@@ -76,7 +76,7 @@ class at extends N {
76
76
  * count. The store pads products to the configured size, so in-place only
77
77
  * fails when the size actually changed.
78
78
  */
79
- n(this, "_debouncedRegenerateWithProducts", f(() => {
79
+ n(this, "_debouncedRegenerateWithProducts", h(() => {
80
80
  const t = this.store.recommendationProducts;
81
81
  if (!this.currentNode || !this.api)
82
82
  return;
@@ -97,7 +97,7 @@ class at extends N {
97
97
  }, 100));
98
98
  }
99
99
  getId() {
100
- return $;
100
+ return W;
101
101
  }
102
102
  get _subControls() {
103
103
  return [
@@ -118,7 +118,7 @@ class at extends N {
118
118
  return this.rrsEnabled = p().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((e) => {
119
119
  var o;
120
120
  return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
121
- }), this.algorithmControl = new T(), this.localeControl = new L(), this.currencyControl = new P(), this.productCountControl = new k(), this.productLayoutControl = new F(), this.filtersControl = new S(), this.shuffleControl = new D(), this.pricePlacementControl = new E(), this.layoutOrientationControl = new O(), this.strategyControl = this.rrsEnabled ? new w() : null, this._subControls.forEach((e) => {
121
+ }), this.algorithmControl = new T(), this.localeControl = new L(), this.currencyControl = new P(), this.productCountControl = new E(), this.productLayoutControl = new F(), this.filtersControl = new S(), this.shuffleControl = new D(), this.pricePlacementControl = new k(), this.layoutOrientationControl = new O(), this.strategyControl = this.rrsEnabled ? new w() : null, this._subControls.forEach((e) => {
122
122
  e && (e.api = this.api);
123
123
  }), `
124
124
  <div class="recommendation-controls-container">
@@ -140,14 +140,14 @@ class at extends N {
140
140
  const e = (i = this.getContainer()) == null ? void 0 : i.querySelector(".recommendation-controls-container");
141
141
  if (!e)
142
142
  return;
143
- const o = this._getRecommendationIdFromNode(t) === null ? null : c.getConfig(t), r = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= _);
143
+ const o = this._getRecommendationIdFromNode(t) === null ? null : l.getConfig(t), r = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= _);
144
144
  e.classList.toggle("strategy-block", r);
145
145
  }
146
146
  async onRender() {
147
147
  var o;
148
148
  b(this.api);
149
149
  const t = this._getRecommendationIdFromNode(this.currentNode), e = t ?? this.store.currentRecommendationId;
150
- if (e !== null && this.store.setCurrentBlock(e), t !== null && this._syncNodeConfigIfChanged(t), this._listenStateUpdates(), this._showControlsForBlock(this.currentNode), e !== null && ((o = this.store.blockStates[e]) != null && o.isInitialized)) {
150
+ if (e !== null && this.store.setCurrentBlock(e), t !== null && this._syncNodeConfigIfChanged(t), this._listenStateUpdates(), this._showControlsForBlock(this.currentNode), t !== null && this.strategyControl && (this.strategyControl.api = this.api, this.strategyControl.currentNode = this.currentNode, this.strategyControl.onRender()), e !== null && ((o = this.store.blockStates[e]) != null && o.isInitialized)) {
151
151
  this._initializeSubControls();
152
152
  return;
153
153
  }
@@ -209,18 +209,23 @@ class at extends N {
209
209
  const e = this.store.blockStates[t];
210
210
  if (!e)
211
211
  return;
212
- const o = JSON.stringify(c.getConfig(this.currentNode)), r = e.syncedConfigFingerprint;
212
+ const o = JSON.stringify(l.getConfig(this.currentNode)), r = e.syncedConfigFingerprint;
213
213
  e.syncedConfigFingerprint = o, r !== o && (this.pendingNodeConfigWrite || this._syncNodeConfigToStore());
214
214
  }
215
+ /** Whether the deferred write would move the node's strategyId — see the caller (SD-149916). */
216
+ _isPendingStrategyIdChange() {
217
+ const t = this.pendingNodeConfigWrite;
218
+ return t ? l.getConfig(this.currentNode).strategyId !== t.updates.strategyId : !1;
219
+ }
215
220
  _capturePendingNodeConfigWrite() {
216
221
  const t = this.store.currentRecommendationId;
217
222
  if (!this.currentNode || !this.api || t === null)
218
223
  return;
219
- const { filters: e, strategyId: o, size: r } = this.store.recommendationConfigs;
224
+ const { filters: e, strategy: o, strategyId: r, size: i } = this.store.recommendationConfigs;
220
225
  this.pendingNodeConfigWrite = {
221
226
  blockId: t,
222
227
  node: this.currentNode,
223
- updates: { filters: e, strategyId: o, size: r }
228
+ updates: { filters: e, strategy: o, strategyId: r, size: i }
224
229
  };
225
230
  }
226
231
  /**
@@ -235,7 +240,7 @@ class at extends N {
235
240
  */
236
241
  _stagePendingNodeConfig(t) {
237
242
  const e = this.pendingNodeConfigWrite;
238
- return !e || !this.currentNode ? !1 : (c.stageConfig(t, this.currentNode, e.updates), !0);
243
+ return !e || !this.currentNode ? !1 : (l.stageConfig(t, this.currentNode, e.updates), !0);
239
244
  }
240
245
  /**
241
246
  * Arms the guaranteed fallback write, once the product fetch has settled. The
@@ -259,12 +264,12 @@ class at extends N {
259
264
  const t = this.pendingNodeConfigWrite;
260
265
  if (this.pendingNodeConfigWrite = null, this._clearConfigFlush(), !t || !this.api)
261
266
  return;
262
- const e = t.blockId === this.store.currentRecommendationId && this.currentNode ? this.currentNode : t.node, o = c.getConfig(e);
263
- JSON.stringify(o.filters) === JSON.stringify(t.updates.filters) && o.strategyId === t.updates.strategyId && o.size === t.updates.size || c.updateConfig(this.api, e, t.updates, "Update recommendation filters");
267
+ const e = t.blockId === this.store.currentRecommendationId && this.currentNode ? this.currentNode : t.node, o = l.getConfig(e);
268
+ JSON.stringify(o.filters) === JSON.stringify(t.updates.filters) && o.strategy === t.updates.strategy && o.strategyId === t.updates.strategyId && o.size === t.updates.size || l.updateConfig(this.api, e, t.updates, "Update recommendation filters");
264
269
  }
265
270
  _syncNodeConfigToStore() {
266
271
  var r;
267
- const t = c.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
272
+ const t = l.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
268
273
  this.store.patchCurrentBlockConfig({
269
274
  strategy: t.strategy,
270
275
  strategyId: t.strategyId,
@@ -328,7 +333,7 @@ class at extends N {
328
333
  _applySmartDefaults() {
329
334
  if (!this.currentNode || !this.api)
330
335
  return;
331
- const t = c.getConfig(this.currentNode), e = {};
336
+ const t = l.getConfig(this.currentNode), e = {};
332
337
  let o = null, r = null, i = null;
333
338
  if (t.currency.code === a.currency.code) {
334
339
  const { currencyList: s } = this.store;
@@ -352,7 +357,7 @@ class at extends N {
352
357
  (d) => d.value === a.language
353
358
  ) || (i = s[0].value, e.language = i));
354
359
  }
355
- !o && !r && !i || (c.updateConfig(
360
+ !o && !r && !i || (l.updateConfig(
356
361
  this.api,
357
362
  this.currentNode,
358
363
  e,
@@ -413,19 +418,19 @@ class at extends N {
413
418
  return;
414
419
  }
415
420
  const s = t.$state.configVersion;
416
- s !== o && (o = s, this._capturePendingNodeConfigWrite(), this._debouncedFetchProducts());
417
- const u = t.recommendationProducts, d = u !== e, g = Array.isArray(u) && u.length > 0;
418
- d && g && (e = u, this._debouncedRegenerateWithProducts());
421
+ s !== o && (o = s, this._capturePendingNodeConfigWrite(), this._isPendingStrategyIdChange() && this._flushPendingNodeConfig(), this._debouncedFetchProducts());
422
+ const u = t.recommendationProducts, d = u !== e, f = Array.isArray(u) && u.length > 0;
423
+ d && f && (e = u, this._debouncedRegenerateWithProducts());
419
424
  });
420
425
  }
421
426
  }
422
427
  export {
423
428
  ut as ALGORITHM_CONTROL_ID,
424
429
  T as AlgorithmControl,
425
- $ as CONTROL_BLOCK_ID,
426
- ht as CURRENCY_CONTROL_ID,
430
+ W as CONTROL_BLOCK_ID,
431
+ gt as CURRENCY_CONTROL_ID,
427
432
  P as CurrencyControl,
428
- gt as FILTERS_CONTROL_ID,
433
+ ft as FILTERS_CONTROL_ID,
429
434
  S as FiltersControl,
430
435
  Ct as LAYOUT_ORIENTATION_CONTROL_ID,
431
436
  yt as LOCALE_CONTROL_ID,
@@ -434,15 +439,15 @@ export {
434
439
  _t as PRICE_PLACEMENT_CONTROL_ID,
435
440
  Rt as PRODUCT_COUNT_CONTROL_ID,
436
441
  Tt as PRODUCT_LAYOUT_CONTROL_ID,
437
- E as PricePlacementControl,
438
- k as ProductCountControl,
442
+ k as PricePlacementControl,
443
+ E as ProductCountControl,
439
444
  F as ProductLayoutControl,
440
445
  at as RecommendationBlockControl,
441
446
  St as SHUFFLE_CONTROL_ID,
442
447
  Lt as STRATEGY_CONTROL_ID,
443
448
  D as ShuffleControl,
444
449
  w as StrategyControl,
445
- kt as adjustProductsToSize,
450
+ Et as adjustProductsToSize,
446
451
  Ft as formatProductPrice,
447
452
  v as getBlockElement,
448
453
  Dt as getCardComposition,
@@ -1,21 +1,25 @@
1
- var d = Object.defineProperty;
2
- var y = (r, s, t) => s in r ? d(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
3
- var o = (r, s, t) => y(r, typeof s != "symbol" ? s + "" : s, t);
4
- import { ACADEMY_LINKS as m } from "../../../../../enums/academy.js";
5
- import { CommonControl as h } from "../../../common-control.js";
6
- import { useRecommendationExtensionStore as u } from "../../store/recommendation.js";
7
- const p = "recommendation-strategy-control";
8
- class f extends h {
1
+ var u = Object.defineProperty;
2
+ var S = (o, n, t) => n in o ? u(o, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[n] = t;
3
+ var r = (o, n, t) => S(o, typeof n != "symbol" ? n + "" : n, t);
4
+ import { ACADEMY_LINKS as _ } from "../../../../../enums/academy.js";
5
+ import { useOnboardingStore as f } from "../../../../../stores/onboarding.js";
6
+ import { CommonControl as v } from "../../../common-control.js";
7
+ import { RRS_CONFIG_VERSION as b } from "../../constants/defaultConfig.js";
8
+ import { RecommendationConfigService as h } from "../../services/configService.js";
9
+ import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
10
+ const k = "recommendation-strategy-control";
11
+ class I extends v {
9
12
  constructor() {
10
13
  super(...arguments);
11
- o(this, "store", u());
12
- o(this, "storeUnsubscription", () => {
14
+ r(this, "store", C());
15
+ r(this, "onboardingStore", f());
16
+ r(this, "storeUnsubscription", () => {
13
17
  });
14
- o(this, "listeners", []);
15
- o(this, "lastPaintedState", null);
18
+ r(this, "listeners", []);
19
+ r(this, "lastPaintedState", null);
16
20
  }
17
21
  getId() {
18
- return p;
22
+ return k;
19
23
  }
20
24
  getTemplate() {
21
25
  const t = this.api.translate(
@@ -23,21 +27,34 @@ class f extends h {
23
27
  ), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy");
24
28
  return `
25
29
  <div class="strategy-control-container">
26
- <div class="strategy-control-header">
27
- <h3 class="strategy-control-title">${this.api.translate("Recommendation Strategy")}</h3>
28
- </div>
29
- <div class="strategy-control-description-row">
30
- <p class="strategy-control-description">
31
- ${t}
32
- ${e}
33
- <a
34
- href="${m.EMAIL_RECOMMENDATION_BLOCK}"
35
- target="_blank"
36
- rel="noopener noreferrer">${a}</a>.
37
- </p>
30
+ <div data-strategy-loading-state>
31
+ <div class="strategy-control-header">
32
+ <span class="guido-skeleton guido-skeleton--strategy-title"></span>
33
+ </div>
34
+ <div class="strategy-control-description-row">
35
+ <span class="guido-skeleton guido-skeleton--strategy-description"></span>
36
+ </div>
37
+ <div class="strategy-control-skeleton-row">
38
+ <span class="guido-skeleton guido-skeleton--strategy-cta"></span>
39
+ <span class="guido-skeleton guido-skeleton--strategy-cta"></span>
40
+ </div>
38
41
  </div>
39
- <div data-strategy-empty-state>
40
- ${this._GuTwoColumns([
42
+ <div data-strategy-content style="display: none;">
43
+ <div class="strategy-control-header">
44
+ <h3 class="strategy-control-title">${this.api.translate("Recommendation Strategy")}</h3>
45
+ </div>
46
+ <div class="strategy-control-description-row">
47
+ <p class="strategy-control-description">
48
+ ${t}
49
+ ${e}
50
+ <a
51
+ href="${_.EMAIL_RECOMMENDATION_BLOCK}"
52
+ target="_blank"
53
+ rel="noopener noreferrer">${a}</a>.
54
+ </p>
55
+ </div>
56
+ <div data-strategy-empty-state style="display: none;">
57
+ ${this._GuTwoColumns([
41
58
  this._GuButton({
42
59
  name: "assignStrategy",
43
60
  label: this.api.translate("Assign Strategy"),
@@ -48,26 +65,28 @@ class f extends h {
48
65
  name: "createStrategy",
49
66
  label: this.api.translate("Create New Strategy"),
50
67
  id: "guido__btn-create-strategy",
51
- className: "strategy-control-cta primary",
52
- disabled: !0
68
+ className: "strategy-control-cta primary"
53
69
  })
54
70
  ], "strategy-control-cta-row")}
55
- </div>
56
- <div data-strategy-assigned-state style="display: none;">
57
- <div class="strategy-control-name-band">
58
- <span class="strategy-control-name" data-strategy-name></span>
59
71
  </div>
60
- <div class="strategy-control-actions">
61
- ${this._strategyAction({
72
+ <div data-strategy-assigned-state style="display: none;">
73
+ <div class="strategy-control-name-band">
74
+ <span class="strategy-control-name" data-strategy-name></span>
75
+ <span
76
+ class="guido-skeleton guido-skeleton--strategy-name" data-strategy-name-skeleton></span>
77
+ </div>
78
+ <div class="strategy-control-actions">
79
+ ${this._strategyAction({
62
80
  id: "guido__btn-change-strategy",
63
81
  label: this.api.translate("Change"),
64
82
  modifier: "change"
65
83
  })}
66
- ${this._strategyAction({
84
+ ${this._strategyAction({
67
85
  id: "guido__btn-remove-strategy",
68
86
  label: this.api.translate("Remove"),
69
87
  modifier: "remove"
70
88
  })}
89
+ </div>
71
90
  </div>
72
91
  </div>
73
92
  </div>
@@ -84,41 +103,54 @@ class f extends h {
84
103
  `;
85
104
  }
86
105
  onRender() {
87
- this._teardown(), this._setupButtonListeners(), this._renderState(), this.storeUnsubscription = this.store.$subscribe(() => {
106
+ this._teardown(), this.store.strategyPanelOpen = !0, this._setupButtonListeners(), this._renderState(), this.storeUnsubscription = this.store.$subscribe(() => {
88
107
  this._renderState();
89
- }), this.store.recommendationConfigs.strategyId && !this.store.strategies.length && this.store.fetchStrategies().catch(() => {
108
+ }), this.store.recommendationConfigs.strategyId && !this.store.strategiesFetched && this.store.fetchStrategies().catch(() => {
90
109
  });
91
110
  }
111
+ /**
112
+ * Whether the document itself says this block has no strategy.
113
+ *
114
+ * Read the node, not the store: when the main control cannot resolve the block id off the
115
+ * node it never syncs the persisted config, so the store still holds defaults (empty
116
+ * strategyId) for an assigned block.
117
+ */
118
+ _isNodeUnassigned() {
119
+ if (!h.hasConfig(this.currentNode))
120
+ return !1;
121
+ const t = h.getConfig(this.currentNode);
122
+ return !t.strategyId && (t.configVersion ?? 0) >= b;
123
+ }
92
124
  onDestroy() {
93
125
  this._teardown();
94
126
  }
95
127
  _teardown() {
96
- this.storeUnsubscription(), this.storeUnsubscription = () => {
128
+ this.store.strategyPanelOpen = !1, this.storeUnsubscription(), this.storeUnsubscription = () => {
97
129
  }, this.lastPaintedState = null, this.listeners.forEach(({ element: t, handler: e }) => t.removeEventListener("click", e)), this.listeners = [];
98
130
  }
99
131
  _setupButtonListeners() {
100
132
  const t = this.getContainer();
101
133
  if (!t)
102
134
  return;
103
- const e = (a, n) => {
104
- const i = t.querySelector(a);
105
- i && (i.addEventListener("click", n), this.listeners.push({ element: i, handler: n }));
135
+ const e = (a, i) => {
136
+ const s = t.querySelector(a);
137
+ s && (s.addEventListener("click", i), this.listeners.push({ element: s, handler: i }));
106
138
  };
107
- e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal());
139
+ e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-create-strategy", () => this.store.openStrategyCreation()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal());
108
140
  }
109
141
  _renderState() {
110
- var l;
111
- const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((l = this.store.assignedStrategy) == null ? void 0 : l.name) ?? "" : "", a = `${t}\0${e}`;
112
- if (a === this.lastPaintedState)
142
+ var p;
143
+ const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((p = this.store.assignedStrategy) == null ? void 0 : p.name) ?? "" : "", a = !!t && !e && (this.store.strategiesLoading || !this.store.strategiesSettled), i = `${t}\0${e}\0${a}`;
144
+ if (i === this.lastPaintedState)
113
145
  return;
114
- const n = this.getContainer();
115
- if (!n)
146
+ const s = this.getContainer();
147
+ if (!s)
116
148
  return;
117
- const i = n.querySelector("[data-strategy-empty-state]"), c = n.querySelector("[data-strategy-assigned-state]"), g = n.querySelector("[data-strategy-name]");
118
- !i || !c || (i.style.display = t ? "none" : "", c.style.display = t ? "" : "none", g && t && (g.textContent = e || `#${t}`), this.lastPaintedState = a);
149
+ const c = s.querySelector("[data-strategy-empty-state]"), g = s.querySelector("[data-strategy-assigned-state]"), l = s.querySelector("[data-strategy-loading-state]"), y = s.querySelector("[data-strategy-content]"), d = s.querySelector("[data-strategy-name]"), m = s.querySelector("[data-strategy-name-skeleton]");
150
+ !c || !g || (l && (l.style.display = "none"), y && (y.style.display = ""), c.style.display = t ? "none" : "", g.style.display = t ? "" : "none", !t && this._isNodeUnassigned() && this.onboardingStore.startOnboarding("recommendationStrategyOnboarding"), d && (d.style.display = a ? "none" : "", t && !a && (d.textContent = e || `#${t}`)), m && (m.style.display = a ? "block" : "none"), this.lastPaintedState = i);
119
151
  }
120
152
  }
121
153
  export {
122
- p as STRATEGY_CONTROL_ID,
123
- f as StrategyControl
154
+ k as STRATEGY_CONTROL_ID,
155
+ I as StrategyControl
124
156
  };