@useinsider/guido 3.18.1-beta.e9a6c91 → 3.18.1-beta.fefef3c

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 (48) hide show
  1. package/README.md +21 -3
  2. package/dist/@types/config/schemas.js +59 -51
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +72 -70
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -9
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +83 -72
  7. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
  8. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
  9. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +24 -22
  10. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -26
  11. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
  12. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
  13. package/dist/composables/useCustomInterfaceAppearance.js +46 -42
  14. package/dist/composables/useHtmlValidator.js +79 -84
  15. package/dist/composables/useLegacyStrategyConversion.js +61 -0
  16. package/dist/composables/useRecommendation.js +18 -21
  17. package/dist/enums/extensions/recommendationBlock.js +25 -29
  18. package/dist/extensions/Blocks/Recommendation/block.js +39 -43
  19. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +72 -71
  20. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +70 -40
  21. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +45 -44
  22. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +108 -138
  23. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +72 -0
  24. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
  25. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +12 -21
  26. package/dist/guido.css +1 -1
  27. package/dist/services/recommendationApi.js +93 -84
  28. package/dist/src/@types/config/schemas.d.ts +16 -0
  29. package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
  30. package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
  31. package/dist/src/composables/useConfig.d.ts +4 -0
  32. package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
  33. package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -2
  34. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +1 -0
  35. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -0
  36. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +54 -50
  37. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +44 -0
  38. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +0 -4
  39. package/dist/src/services/recommendationApi.d.ts +2 -1
  40. package/dist/src/stores/config.d.ts +322 -0
  41. package/dist/src/stores/onboarding.d.ts +421 -0
  42. package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
  43. package/dist/static/assets/icons/line-info.svg.js +5 -0
  44. package/dist/static/styles/components/recommendation-strategy.css.js +74 -43
  45. package/dist/stores/config.js +74 -60
  46. package/dist/stores/onboarding.js +6 -1
  47. package/dist/utils/templatePreparation.js +50 -50
  48. package/package.json +1 -1
@@ -1,37 +1,37 @@
1
- var D = Object.defineProperty;
2
- var y = (l, c, t) => c in l ? D(l, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[c] = t;
3
- var f = (l, c, t) => y(l, typeof c != "symbol" ? c + "" : c, t);
4
- import { useConfig as C } from "../../../composables/useConfig.js";
5
- import { BlockId as b } from "../../../enums/block.js";
6
- import { getMigrationBannerHtml as A } from "../../../utils/migrationBannerHtml.js";
7
- import { Block as E, BlockCompositionType as S, ModificationDescription as g } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
- import { CURRENT_CONFIG_VERSION as N, PRE_RRS_CONFIG_VERSION as O } from "./constants/defaultConfig.js";
1
+ var R = Object.defineProperty;
2
+ var B = (a, c, t) => c in a ? R(a, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[c] = t;
3
+ var p = (a, c, t) => B(a, typeof c != "symbol" ? c + "" : c, t);
4
+ import { useConfig as D } from "../../../composables/useConfig.js";
5
+ import { BlockId as y } from "../../../enums/block.js";
6
+ import { getMigrationBannerHtml as C } from "../../../utils/migrationBannerHtml.js";
7
+ import { Block as b, BlockCompositionType as A, ModificationDescription as g } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
+ import { CURRENT_CONFIG_VERSION as E, PRE_RRS_CONFIG_VERSION as S } from "./constants/defaultConfig.js";
9
9
  import { RECOMMENDATION_ID_ATTR as m } from "./constants/selectors.js";
10
- import { regenerateMobileProductRows as M } from "./controls/main/utils.js";
11
- import { ensureMobileCssRulesExist as _, setMobileLayoutOptOut as I, hasMobileLayoutOptOut as w } from "./controls/mobileLayout/cssRules.js";
10
+ import { regenerateMobileProductRows as N } from "./controls/main/utils.js";
11
+ import { ensureMobileCssRulesExist as h, setMobileLayoutOptOut as f, hasMobileLayoutOptOut as O } from "./controls/mobileLayout/cssRules.js";
12
12
  import { RecommendationConfigService as s } from "./services/configService.js";
13
13
  import { useRecommendationExtensionStore as d } from "./store/recommendation.js";
14
- import { getDefaultTemplate as x } from "./templates/grid/template.js";
15
- import { useRecommendationBlockWarning as H } from "./useRecommendationBlockWarning.js";
16
- const k = b.Recommendation, u = "recommendation-block-v2", R = "hide-price";
17
- let B = !1;
18
- class j extends E {
14
+ import { getDefaultTemplate as M } from "./templates/grid/template.js";
15
+ import { useRecommendationBlockWarning as w } from "./useRecommendationBlockWarning.js";
16
+ const _ = y.Recommendation, u = "recommendation-block-v2", I = "hide-price";
17
+ let k = !1;
18
+ class W extends b {
19
19
  constructor() {
20
20
  super();
21
21
  /**
22
22
  * Stores the ID generated in getTemplate() so onCreated() can reuse it.
23
23
  * This avoids generating a new (different) ID in onCreated().
24
24
  */
25
- f(this, "_pendingBlockId", null);
25
+ p(this, "_pendingBlockId", null);
26
26
  }
27
27
  getId() {
28
- return k;
28
+ return _;
29
29
  }
30
30
  getIcon() {
31
31
  return "recommendation-icon";
32
32
  }
33
33
  getBlockCompositionType() {
34
- return S.CONTAINER;
34
+ return A.CONTAINER;
35
35
  }
36
36
  getName() {
37
37
  return this.api.translate("Recommendation Block");
@@ -42,8 +42,8 @@ class j extends E {
42
42
  );
43
43
  }
44
44
  getSettingsPanelTitleHtml() {
45
- return A(
46
- k,
45
+ return C(
46
+ _,
47
47
  this.api.translate("Recommendation Block"),
48
48
  this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.")
49
49
  );
@@ -66,7 +66,7 @@ class j extends E {
66
66
  */
67
67
  getTemplate() {
68
68
  const t = this._generateNextId();
69
- return this._pendingBlockId = t, x(t);
69
+ return this._pendingBlockId = t, M(t);
70
70
  }
71
71
  /**
72
72
  * Called when a new block is dropped into the template
@@ -89,27 +89,23 @@ class j extends E {
89
89
  }
90
90
  const i = this._pendingBlockId ?? this._generateNextId();
91
91
  this._pendingBlockId = null, this._assignRecommendationId(t, i);
92
- const n = C().isFeatureEnabled("reusableRecommendationStrategy"), o = n && !s.hasConfig(t), { config: r, wasFreshDrop: a } = s.initializeConfig(
92
+ const { config: n, wasFreshDrop: o } = s.initializeConfig(
93
93
  this.api,
94
94
  t,
95
95
  {
96
96
  recommendationId: i,
97
- configVersion: n ? N : O,
98
- // An RRS block picks a strategy, not an algorithm, and its algorithm control is
99
- // hidden. Keeping the `mostPopular` default would bake a most-popular feed URL
100
- // at save for a block the user never configured.
101
- ...o ? { strategy: "" } : {}
97
+ configVersion: D().isFeatureEnabled("reusableRecommendationStrategy") ? E : S
102
98
  }
103
- ), p = d();
104
- if (p.setCurrentBlock(i), this._stampHidePrice(t, r.priceHideIfSameAsDiscounted), a) {
105
- _(this.api);
106
- const h = this._getBlockElement(t);
107
- h && (I(this.api, h, !0), M({
99
+ ), r = d();
100
+ if (r.setCurrentBlock(i), this._stampHidePrice(t, n.priceHideIfSameAsDiscounted), o) {
101
+ h(this.api);
102
+ const l = this._getBlockElement(t);
103
+ l && (f(this.api, l, !0), N({
108
104
  currentNode: t,
109
105
  documentModifier: this.api.getDocumentModifier()
110
106
  }));
111
107
  }
112
- p.patchCurrentBlockConfig({ language: r.language }, { triggerRefetch: !1 }), this._warnIfMultipleBlocks();
108
+ r.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 }), this._warnIfMultipleBlocks();
113
109
  }
114
110
  /**
115
111
  * Called when the document changes or template is loaded
@@ -131,11 +127,11 @@ class j extends E {
131
127
  }
132
128
  this._healLingeringDuplicate(t), s.needsMigration(t) && this._migrateFromLegacy(t), this._healHidePriceAttr(t);
133
129
  try {
134
- B || (_(this.api), B = !0);
130
+ k || (h(this.api), k = !0);
135
131
  const e = s.getConfig(t), i = this._getBlockElement(t);
136
132
  if (i) {
137
133
  const n = !e.mobileLayoutEnabled;
138
- w(i) !== n && I(this.api, i, n);
134
+ O(i) !== n && f(this.api, i, n);
139
135
  }
140
136
  } catch {
141
137
  }
@@ -165,7 +161,7 @@ class j extends E {
165
161
  */
166
162
  _warnIfMultipleBlocks() {
167
163
  try {
168
- H().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
164
+ w().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
169
165
  } catch {
170
166
  }
171
167
  }
@@ -215,9 +211,9 @@ class j extends E {
215
211
  if (!o)
216
212
  return;
217
213
  let r = -1;
218
- for (let a = 0; a < n.length; a++)
219
- if (n[a] === o) {
220
- r = a;
214
+ for (let l = 0; l < n.length; l++)
215
+ if (n[l] === o) {
216
+ r = l;
221
217
  break;
222
218
  }
223
219
  if (r <= 0)
@@ -297,7 +293,7 @@ class j extends E {
297
293
  */
298
294
  _stampHidePrice(t, e) {
299
295
  const i = this._getBlockElement(t);
300
- i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(R, String(e)).apply(new g("Stamp hide-price"));
296
+ i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(I, String(e)).apply(new g("Stamp hide-price"));
301
297
  }
302
298
  /**
303
299
  * Stamps `hide-price` from config only when the block lacks the attribute —
@@ -305,7 +301,7 @@ class j extends E {
305
301
  */
306
302
  _healHidePriceAttr(t) {
307
303
  const e = this._getBlockElement(t);
308
- if (!e || !("getAttribute" in e) || e.getAttribute(R) !== null)
304
+ if (!e || !("getAttribute" in e) || e.getAttribute(I) !== null)
309
305
  return;
310
306
  const { priceHideIfSameAsDiscounted: i } = s.getConfig(t);
311
307
  this._stampHidePrice(t, i);
@@ -342,6 +338,6 @@ class j extends E {
342
338
  }
343
339
  }
344
340
  export {
345
- k as BLOCK_ID,
346
- j as RecommendationBlock
341
+ _ as BLOCK_ID,
342
+ W as RecommendationBlock
347
343
  };
@@ -1,6 +1,6 @@
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, l, t) => l in g ? m(g, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[l] = t;
3
+ var r = (g, l, t) => C(g, typeof l != "symbol" ? l + "" : l, 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";
@@ -12,9 +12,9 @@ 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 ft } from "./filters.js";
17
+ import { FILTERS_CONTROL_ID as ht } 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";
@@ -29,38 +29,38 @@ import { ShuffleControl as F } from "./shuffle.js";
29
29
  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
- 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 Dt, getCardComposition as Ft, getCurrentLayout as wt, getMainContainerTbody as At, regenerateMobileProductRows as vt, updatePricesInPlace as xt, updateSingleProductContent as Bt } from "./utils.js";
34
- import { useDebounceFn as g } from "../../../../../node_modules/@vueuse/shared/index.js";
32
+ import { setCurrencyAttributes as A, getBlockElement as B, isPartnerManagedBlock as v, updateProductContentInPlace as x, regenerateProductRowsWithStyles as U } from "./utils.js";
33
+ import { adjustProductsToSize as kt, formatProductPrice as Dt, getCardComposition as Ft, getCurrentLayout as wt, getMainContainerTbody as At, regenerateMobileProductRows as Bt, updatePricesInPlace as vt, updateSingleProductContent as xt } from "./utils.js";
34
+ import { useDebounceFn as f } from "../../../../../node_modules/@vueuse/shared/index.js";
35
35
  const $ = "ui-elements-recommendation-block";
36
36
  class at extends N {
37
37
  constructor() {
38
38
  super(...arguments);
39
- n(this, "store", R());
40
- n(this, "storeUnsubscription", () => {
39
+ r(this, "store", R());
40
+ r(this, "storeUnsubscription", () => {
41
41
  });
42
42
  // blockId -> fingerprint of the node config as it looked at the last sync.
43
- n(this, "syncedConfigs", /* @__PURE__ */ new Map());
43
+ r(this, "syncedConfigs", /* @__PURE__ */ new Map());
44
44
  // A config change waiting to reach the node config. Deferred so it can ride the
45
45
  // re-render's single apply() — one user action must cost one undo press.
46
- n(this, "pendingNodeConfigWrite", null);
47
- n(this, "pendingConfigFlushTimer", null);
46
+ r(this, "pendingNodeConfigWrite", null);
47
+ r(this, "pendingConfigFlushTimer", null);
48
48
  // Sub-control instances for lifecycle management
49
- n(this, "algorithmControl", null);
50
- n(this, "localeControl", null);
51
- n(this, "currencyControl", null);
52
- n(this, "productCountControl", null);
53
- n(this, "productLayoutControl", null);
54
- n(this, "filtersControl", null);
55
- n(this, "shuffleControl", null);
56
- n(this, "pricePlacementControl", null);
57
- n(this, "layoutOrientationControl", null);
58
- n(this, "strategyControl", null);
59
- n(this, "rrsEnabled", !1);
49
+ r(this, "algorithmControl", null);
50
+ r(this, "localeControl", null);
51
+ r(this, "currencyControl", null);
52
+ r(this, "productCountControl", null);
53
+ r(this, "productLayoutControl", null);
54
+ r(this, "filtersControl", null);
55
+ r(this, "shuffleControl", null);
56
+ r(this, "pricePlacementControl", null);
57
+ r(this, "layoutOrientationControl", null);
58
+ r(this, "strategyControl", null);
59
+ r(this, "rrsEnabled", !1);
60
60
  /**
61
61
  * Debounced product fetch to prevent rapid API calls during config changes
62
62
  */
63
- n(this, "_debouncedFetchProducts", g(async () => {
63
+ r(this, "_debouncedFetchProducts", f(async () => {
64
64
  try {
65
65
  await this.store.fetchRecommendationProducts();
66
66
  } finally {
@@ -78,16 +78,16 @@ class at extends N {
78
78
  * count. The store pads products to the configured size, so in-place only
79
79
  * fails when the size actually changed.
80
80
  */
81
- n(this, "_debouncedRegenerateWithProducts", g(() => {
81
+ r(this, "_debouncedRegenerateWithProducts", f(() => {
82
82
  const t = this.store.recommendationProducts;
83
83
  if (!this.currentNode || !this.api)
84
84
  return;
85
85
  const e = this.api.getDocumentModifier(), o = this._stagePendingNodeConfig(e);
86
- if (x(this.currentNode)) {
86
+ if (v(this.currentNode)) {
87
87
  o && (e.apply(new y("Update recommendation configuration")), this.pendingNodeConfigWrite = null, this._clearConfigFlush());
88
88
  return;
89
89
  }
90
- B({
90
+ x({
91
91
  currentNode: this.currentNode,
92
92
  documentModifier: e,
93
93
  products: t
@@ -142,14 +142,14 @@ class at extends N {
142
142
  const e = (i = this.getContainer()) == null ? void 0 : i.querySelector(".recommendation-controls-container");
143
143
  if (!e)
144
144
  return;
145
- 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) >= _);
146
- e.classList.toggle("strategy-block", r);
145
+ const o = this._getRecommendationIdFromNode(t) === null ? null : c.getConfig(t), n = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= _), s = this.rrsEnabled && !!o && !n;
146
+ e.classList.toggle("strategy-block", n), e.classList.toggle("legacy-strategy-block", s);
147
147
  }
148
148
  async onRender() {
149
149
  var o;
150
150
  b(this.api);
151
151
  const t = this._getRecommendationIdFromNode(this.currentNode), e = t ?? this.store.currentRecommendationId;
152
- 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)) {
152
+ 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)) {
153
153
  this._initializeSubControls();
154
154
  return;
155
155
  }
@@ -161,9 +161,9 @@ class at extends N {
161
161
  const e = this._getRecommendationIdFromNode(t);
162
162
  e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), e !== null && this._syncNodeConfigIfChanged(e), this._showControlsForBlock(t), e !== null && !((o = this.store.blockStates[e]) != null && o.isInitialized) && this._fetchBlockData(e).then(() => {
163
163
  this._initializeSubControls();
164
- }), this._subControls.forEach((r) => {
165
- var i;
166
- r != null && r.api && (r.currentNode = t, (i = r.onTemplateNodeUpdated) == null || i.call(r, t));
164
+ }), this._subControls.forEach((n) => {
165
+ var s;
166
+ n != null && n.api && (n.currentNode = t, (s = n.onTemplateNodeUpdated) == null || s.call(n, t));
167
167
  });
168
168
  }
169
169
  onDestroy() {
@@ -210,11 +210,11 @@ class at extends N {
210
210
  const t = this.store.currentRecommendationId;
211
211
  if (!this.currentNode || !this.api || t === null)
212
212
  return;
213
- const { filters: e, strategyId: o, size: r } = this.store.recommendationConfigs;
213
+ const { filters: e, strategyId: o, size: n, nodeConfigVersion: s } = this.store.recommendationConfigs;
214
214
  this.pendingNodeConfigWrite = {
215
215
  blockId: t,
216
216
  node: this.currentNode,
217
- updates: { filters: e, strategyId: o, size: r }
217
+ updates: { filters: e, strategyId: o, size: n, configVersion: s }
218
218
  };
219
219
  }
220
220
  /**
@@ -257,11 +257,12 @@ class at extends N {
257
257
  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");
258
258
  }
259
259
  _syncNodeConfigToStore() {
260
- var r;
261
- const t = c.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
260
+ var n;
261
+ const t = c.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((n = this.store.blockStates[e]) == null ? void 0 : n.isInitialized);
262
262
  this.store.patchCurrentBlockConfig({
263
263
  strategy: t.strategy,
264
264
  strategyId: t.strategyId,
265
+ nodeConfigVersion: t.configVersion,
265
266
  language: t.language,
266
267
  size: t.size,
267
268
  productIds: t.productIds,
@@ -300,8 +301,8 @@ class at extends N {
300
301
  t !== null && this.store.markBlockInitialized(t), (await Promise.allSettled([
301
302
  this.store.fetchRecommendationCreateData(),
302
303
  this.store.fetchRecommendationFilters()
303
- ])).forEach((o, r) => {
304
- o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][r]} failed`, o.reason);
304
+ ])).forEach((o, n) => {
305
+ o.status === "rejected" && console.warn(`Recommendation block: ${["fetchRecommendationCreateData", "fetchRecommendationFilters"][n]} failed`, o.reason);
305
306
  }), this._applySmartDefaults();
306
307
  try {
307
308
  await this.store.fetchRecommendationProducts();
@@ -323,30 +324,30 @@ class at extends N {
323
324
  if (!this.currentNode || !this.api)
324
325
  return;
325
326
  const t = c.getConfig(this.currentNode), e = {};
326
- let o = null, r = null, i = null;
327
+ let o = null, n = null, s = null;
327
328
  if (t.currency.code === a.currency.code) {
328
- const { currencyList: s } = this.store;
329
- s.length > 0 && (s.some(
329
+ const { currencyList: i } = this.store;
330
+ i.length > 0 && (i.some(
330
331
  (d) => d.value === `price.${a.currency.code}`
331
- ) || (o = s[0].value.replace("price.", ""), e.currency = {
332
+ ) || (o = i[0].value.replace("price.", ""), e.currency = {
332
333
  ...a.currency,
333
334
  code: o,
334
335
  symbol: o
335
336
  }));
336
337
  }
337
338
  if (t.strategy === a.strategy) {
338
- const s = this.store.getActivePredictiveAlgorithms;
339
- s.length > 0 && (s.some(
339
+ const i = this.store.getActivePredictiveAlgorithms;
340
+ i.length > 0 && (i.some(
340
341
  (d) => d.value === a.strategy
341
- ) || (r = s[0].value, e.strategy = r));
342
+ ) || (n = i[0].value, e.strategy = n));
342
343
  }
343
344
  if (t.language === a.language) {
344
- const s = this.store.getLanguages;
345
- s.length > 0 && (s.some(
345
+ const i = this.store.getLanguages;
346
+ i.length > 0 && (i.some(
346
347
  (d) => d.value === a.language
347
- ) || (i = s[0].value, e.language = i));
348
+ ) || (s = i[0].value, e.language = s));
348
349
  }
349
- !o && !r && !i || (c.updateConfig(
350
+ !o && !n && !s || (c.updateConfig(
350
351
  this.api,
351
352
  this.currentNode,
352
353
  e,
@@ -367,22 +368,22 @@ class at extends N {
367
368
  thousandSeparator: a.currency.thousandSeparator
368
369
  }
369
370
  } : {},
370
- ...r ? { strategy: r } : {},
371
- ...i ? { language: i } : {}
371
+ ...n ? { strategy: n } : {},
372
+ ...s ? { language: s } : {}
372
373
  }, { triggerRefetch: !1 }));
373
374
  }
374
375
  /**
375
376
  * Reads the recommendation-id attribute from the block element within the node
376
377
  */
377
378
  _getRecommendationIdFromNode(t) {
378
- const e = v(t);
379
+ const e = B(t);
379
380
  if (!e || !("getAttribute" in e))
380
381
  return null;
381
382
  const o = e.getAttribute(I);
382
383
  if (!o)
383
384
  return null;
384
- const r = parseInt(o);
385
- return Number.isNaN(r) ? null : r;
385
+ const n = parseInt(o);
386
+ return Number.isNaN(n) ? null : n;
386
387
  }
387
388
  /**
388
389
  * Listen to store changes that require product refresh or regeneration.
@@ -399,17 +400,17 @@ class at extends N {
399
400
  */
400
401
  _listenStateUpdates() {
401
402
  const { store: t } = this;
402
- let e = t.recommendationProducts, o = t.$state.configVersion, r = t.currentRecommendationId;
403
+ let e = t.recommendationProducts, o = t.$state.configVersion, n = t.currentRecommendationId;
403
404
  this.storeUnsubscription = t.$subscribe(() => {
404
- const i = t.currentRecommendationId;
405
- if (i !== r) {
406
- r = i, e = t.recommendationProducts, o = t.$state.configVersion;
405
+ const s = t.currentRecommendationId;
406
+ if (s !== n) {
407
+ n = s, e = t.recommendationProducts, o = t.$state.configVersion;
407
408
  return;
408
409
  }
409
- const s = t.$state.configVersion;
410
- s !== o && (o = s, this._capturePendingNodeConfigWrite(), this._debouncedFetchProducts());
411
- const u = t.recommendationProducts, d = u !== e, f = Array.isArray(u) && u.length > 0;
412
- d && f && (e = u, this._debouncedRegenerateWithProducts());
410
+ const i = t.$state.configVersion;
411
+ i !== o && (o = i, this._capturePendingNodeConfigWrite(), this._debouncedFetchProducts());
412
+ const u = t.recommendationProducts, d = u !== e, h = Array.isArray(u) && u.length > 0;
413
+ d && h && (e = u, this._debouncedRegenerateWithProducts());
413
414
  });
414
415
  }
415
416
  }
@@ -417,9 +418,9 @@ export {
417
418
  ut as ALGORITHM_CONTROL_ID,
418
419
  T as AlgorithmControl,
419
420
  $ as CONTROL_BLOCK_ID,
420
- ht as CURRENCY_CONTROL_ID,
421
+ gt as CURRENCY_CONTROL_ID,
421
422
  P as CurrencyControl,
422
- ft as FILTERS_CONTROL_ID,
423
+ ht as FILTERS_CONTROL_ID,
423
424
  S as FiltersControl,
424
425
  Ct as LAYOUT_ORIENTATION_CONTROL_ID,
425
426
  yt as LOCALE_CONTROL_ID,
@@ -438,15 +439,15 @@ export {
438
439
  w as StrategyControl,
439
440
  kt as adjustProductsToSize,
440
441
  Dt as formatProductPrice,
441
- v as getBlockElement,
442
+ B as getBlockElement,
442
443
  Ft as getCardComposition,
443
444
  wt as getCurrentLayout,
444
445
  At as getMainContainerTbody,
445
- x as isPartnerManagedBlock,
446
- vt as regenerateMobileProductRows,
446
+ v as isPartnerManagedBlock,
447
+ Bt as regenerateMobileProductRows,
447
448
  U as regenerateProductRowsWithStyles,
448
449
  A as setCurrencyAttributes,
449
- xt as updatePricesInPlace,
450
- B as updateProductContentInPlace,
451
- Bt as updateSingleProductContent
450
+ vt as updatePricesInPlace,
451
+ x as updateProductContentInPlace,
452
+ xt as updateSingleProductContent
452
453
  };