@useinsider/guido 3.22.0-beta.e1b5da2 → 3.22.0-beta.e9b6f94

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 (45) hide show
  1. package/README.md +35 -4
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +118 -108
  4. package/dist/composables/useEditorOpenMetrics.js +167 -0
  5. package/dist/composables/useStripo.js +93 -82
  6. package/dist/config/compiler/utils/recommendationCompilerUtils.js +22 -22
  7. package/dist/config/migrator/recommendation/compositionMapper.js +49 -56
  8. package/dist/config/migrator/recommendation/extractors.js +40 -100
  9. package/dist/config/migrator/recommendation/htmlBuilder.js +207 -285
  10. package/dist/config/migrator/recommendation/settingsMapper.js +36 -37
  11. package/dist/config/migrator/recommendation/themeMapper.js +41 -53
  12. package/dist/config/migrator/recommendationMigrator.js +61 -68
  13. package/dist/config/migrator/unsubscribeMigrator.js +60 -87
  14. package/dist/extensions/Blocks/Recommendation/block.js +24 -33
  15. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +19 -20
  16. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +163 -148
  17. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +22 -23
  18. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +18 -19
  19. package/dist/extensions/Blocks/Recommendation/templates/utils.js +91 -82
  20. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +2 -3
  21. package/dist/guido.css +1 -1
  22. package/dist/library.js +12 -10
  23. package/dist/package.json.js +6 -4
  24. package/dist/public/prefetchRuntime.js +4 -0
  25. package/dist/src/composables/useEditorOpenMetrics.d.ts +27 -0
  26. package/dist/src/composables/useStripo.d.ts +2 -1
  27. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +1 -3
  28. package/dist/src/config/migrator/recommendation/extractors.d.ts +6 -35
  29. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +1 -3
  30. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +1 -3
  31. package/dist/src/config/migrator/recommendation/types.d.ts +1 -11
  32. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
  33. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +8 -2
  34. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +13 -1
  35. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +19 -2
  36. package/dist/src/library.d.ts +1 -0
  37. package/dist/src/public/prefetchRuntime.d.ts +1 -0
  38. package/dist/src/utils/runtimePrefetch.d.ts +4 -0
  39. package/dist/src/utils/stripoRuntime.d.ts +3 -0
  40. package/dist/static/stripo-runtime-manifest.json.js +9 -0
  41. package/dist/utils/runtimePrefetch.js +26 -0
  42. package/dist/utils/stripoRuntime.js +13 -0
  43. package/package.json +6 -1
  44. package/dist/extensions/Blocks/Recommendation/utils/inlinePriceOrder.js +0 -12
  45. package/dist/src/extensions/Blocks/Recommendation/utils/inlinePriceOrder.d.ts +0 -9
@@ -1,73 +1,72 @@
1
- var y = Object.defineProperty;
2
- var P = (u, c, e) => c in u ? y(u, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[c] = e;
3
- var r = (u, c, e) => P(u, typeof c != "symbol" ? c + "" : c, e);
4
- import { useConfig as f } from "../../../../../composables/useConfig.js";
5
- import { ModificationDescription as R } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
- import { CommonControl as I } from "../../../common-control.js";
7
- import { RRS_CONFIG_VERSION as k, DEFAULT_NODE_CONFIG as m } from "../../constants/defaultConfig.js";
8
- import { RECOMMENDATION_ID_ATTR as S } from "../../constants/selectors.js";
9
- import { RecommendationConfigService as d } from "../../services/configService.js";
10
- import { useRecommendationExtensionStore as T } from "../../store/recommendation.js";
11
- import { refreshBlockOutsidePanel as O } from "../../utils/blockRefresh.js";
12
- import { mapLegacyStrategy as C } from "../../utils/legacyStrategyMap.js";
13
- import { registerNodeConfigWriter as b, writeBlockConfigOutsidePanel as p, hasEditedConfigChange as B, pickConfigDescription as F, isProductIdsChange as D, PRODUCT_IDS_DESCRIPTION as L } from "../../utils/nodeConfigWriter.js";
1
+ var _ = Object.defineProperty;
2
+ var N = (u, d, e) => d in u ? _(u, d, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[d] = e;
3
+ var s = (u, d, e) => N(u, typeof d != "symbol" ? d + "" : d, e);
4
+ import { useConfig as g } from "../../../../../composables/useConfig.js";
5
+ import { ModificationDescription as y } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
+ import { CommonControl as P } from "../../../common-control.js";
7
+ import { RRS_CONFIG_VERSION as R, DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
8
+ import { RECOMMENDATION_ID_ATTR as I } from "../../constants/selectors.js";
9
+ import { RecommendationConfigService as l } from "../../services/configService.js";
10
+ import { useRecommendationExtensionStore as k } from "../../store/recommendation.js";
11
+ import { refreshBlockOutsidePanel as S } from "../../utils/blockRefresh.js";
12
+ import { registerNodeConfigWriter as T, writeBlockConfigOutsidePanel as m, hasEditedConfigChange as O, pickConfigDescription as b, isProductIdsChange as B, PRODUCT_IDS_DESCRIPTION as F } from "../../utils/nodeConfigWriter.js";
14
13
  import { AlgorithmControl as E } from "./algorithm.js";
15
- import { ALGORITHM_CONTROL_ID as Pe } from "./algorithm.js";
16
- import { CurrencyControl as U } from "./currency.js";
17
- import { CURRENCY_CONTROL_ID as Ie } from "./currency.js";
18
- import { FiltersControl as v } from "./filters.js";
19
- import { FILTERS_CONTROL_ID as Se } from "./filters.js";
20
- import { LayoutOrientationControl as w } from "./layoutOrientation.js";
21
- import { LAYOUT_ORIENTATION_CONTROL_ID as Oe } from "./layoutOrientation.js";
22
- import { LocaleControl as A } from "./locale.js";
23
- import { LOCALE_CONTROL_ID as Be } from "./locale.js";
24
- import { PricePlacementControl as V } from "./pricePlacement.js";
25
- import { PRICE_PLACEMENT_CONTROL_ID as De } from "./pricePlacement.js";
26
- import { ProductCountControl as W } from "./productCount.js";
27
- import { PRODUCT_COUNT_CONTROL_ID as Ee } from "./productCount.js";
28
- import { ProductLayoutControl as x } from "./productLayout.js";
29
- import { PRODUCT_LAYOUT_CONTROL_ID as ve } from "./productLayout.js";
30
- import { ShuffleControl as M } from "./shuffle.js";
31
- import { SHUFFLE_CONTROL_ID as Ae } from "./shuffle.js";
32
- import { StrategyControl as G } from "./strategy.js";
33
- import { STRATEGY_CONTROL_ID as We } from "./strategy.js";
34
- import { setCurrencyAttributes as z, getBlockElement as $, isPartnerManagedBlock as H, updateProductContentInPlace as Y, regenerateProductRowsWithStyles as j } from "./utils.js";
35
- import { adjustProductsToSize as Me, formatProductPrice as Ge, getCardComposition as ze, getCurrentLayout as $e, getMainContainerTbody as He, regenerateMobileProductRows as Ye, updatePricesInPlace as je, updateSingleProductContent as qe } from "./utils.js";
36
- import { useDebounceFn as _ } from "../../../../../node_modules/@vueuse/shared/index.js";
37
- const h = "Update recommendation filters", q = "ui-elements-recommendation-block";
38
- class _e extends I {
14
+ import { ALGORITHM_CONTROL_ID as _e } from "./algorithm.js";
15
+ import { CurrencyControl as L } from "./currency.js";
16
+ import { CURRENCY_CONTROL_ID as ye } from "./currency.js";
17
+ import { FiltersControl as D } from "./filters.js";
18
+ import { FILTERS_CONTROL_ID as Re } from "./filters.js";
19
+ import { LayoutOrientationControl as U } from "./layoutOrientation.js";
20
+ import { LAYOUT_ORIENTATION_CONTROL_ID as ke } from "./layoutOrientation.js";
21
+ import { LocaleControl as v } from "./locale.js";
22
+ import { LOCALE_CONTROL_ID as Te } from "./locale.js";
23
+ import { PricePlacementControl as w } from "./pricePlacement.js";
24
+ import { PRICE_PLACEMENT_CONTROL_ID as be } from "./pricePlacement.js";
25
+ import { ProductCountControl as A } from "./productCount.js";
26
+ import { PRODUCT_COUNT_CONTROL_ID as Fe } from "./productCount.js";
27
+ import { ProductLayoutControl as V } from "./productLayout.js";
28
+ import { PRODUCT_LAYOUT_CONTROL_ID as Le } from "./productLayout.js";
29
+ import { ShuffleControl as W } from "./shuffle.js";
30
+ import { SHUFFLE_CONTROL_ID as Ue } from "./shuffle.js";
31
+ import { StrategyControl as x } from "./strategy.js";
32
+ import { STRATEGY_CONTROL_ID as we } from "./strategy.js";
33
+ import { setCurrencyAttributes as M, getBlockElement as G, isPartnerManagedBlock as z, updateProductContentInPlace as $, regenerateProductRowsWithStyles as H } from "./utils.js";
34
+ import { adjustProductsToSize as Ve, formatProductPrice as We, getCardComposition as xe, getCurrentLayout as Me, getMainContainerTbody as Ge, regenerateMobileProductRows as ze, updatePricesInPlace as $e, updateSingleProductContent as He } from "./utils.js";
35
+ import { useDebounceFn as C } from "../../../../../node_modules/@vueuse/shared/index.js";
36
+ const f = "Update recommendation filters", Y = "ui-elements-recommendation-block";
37
+ class me extends P {
39
38
  constructor() {
40
39
  super(...arguments);
41
- r(this, "store", T());
42
- r(this, "storeUnsubscription", () => {
40
+ s(this, "store", k());
41
+ s(this, "storeUnsubscription", () => {
43
42
  });
44
43
  // A config change waiting to reach the node config. Deferred so it can ride the
45
44
  // re-render's single apply() — one user action must cost one undo press.
46
- r(this, "pendingNodeConfigWrite", null);
47
- r(this, "pendingConfigFlushTimer", null);
45
+ s(this, "pendingNodeConfigWrite", null);
46
+ s(this, "pendingConfigFlushTimer", null);
48
47
  // What the panel still owes the block it watches — finished outside the panel on teardown
49
48
  // and block switch. A new generation tells debounced work queued for the old one to stand down.
50
- r(this, "trackedBlockId", null);
51
- r(this, "fetchedConfigVersion", 0);
52
- r(this, "hasUnrenderedProducts", !1);
53
- r(this, "panelGeneration", 0);
54
- r(this, "isPanelAlive", !0);
49
+ s(this, "trackedBlockId", null);
50
+ s(this, "fetchedConfigVersion", 0);
51
+ s(this, "hasUnrenderedProducts", !1);
52
+ s(this, "panelGeneration", 0);
53
+ s(this, "isPanelAlive", !0);
55
54
  // Sub-control instances for lifecycle management
56
- r(this, "algorithmControl", null);
57
- r(this, "localeControl", null);
58
- r(this, "currencyControl", null);
59
- r(this, "productCountControl", null);
60
- r(this, "productLayoutControl", null);
61
- r(this, "filtersControl", null);
62
- r(this, "shuffleControl", null);
63
- r(this, "pricePlacementControl", null);
64
- r(this, "layoutOrientationControl", null);
65
- r(this, "strategyControl", null);
66
- r(this, "rrsEnabled", !1);
55
+ s(this, "algorithmControl", null);
56
+ s(this, "localeControl", null);
57
+ s(this, "currencyControl", null);
58
+ s(this, "productCountControl", null);
59
+ s(this, "productLayoutControl", null);
60
+ s(this, "filtersControl", null);
61
+ s(this, "shuffleControl", null);
62
+ s(this, "pricePlacementControl", null);
63
+ s(this, "layoutOrientationControl", null);
64
+ s(this, "strategyControl", null);
65
+ s(this, "rrsEnabled", !1);
67
66
  /**
68
67
  * Debounced product fetch to prevent rapid API calls during config changes
69
68
  */
70
- r(this, "_debouncedFetchProducts", _(async (e, t) => {
69
+ s(this, "_debouncedFetchProducts", C(async (e, t) => {
71
70
  if (t !== this.panelGeneration)
72
71
  return;
73
72
  const o = this._getBlockConfigVersion(e);
@@ -88,7 +87,7 @@ class _e extends I {
88
87
  * count. The store pads products to the configured size, so in-place only
89
88
  * fails when the size actually changed.
90
89
  */
91
- r(this, "_debouncedRegenerateWithProducts", _((e) => {
90
+ s(this, "_debouncedRegenerateWithProducts", C((e) => {
92
91
  if (e !== this.panelGeneration || !this.currentNode || !this.api)
93
92
  return;
94
93
  const t = this._getRecommendationIdFromNode(this.currentNode), o = this.store.currentRecommendationId;
@@ -107,7 +106,7 @@ class _e extends I {
107
106
  }, 100));
108
107
  }
109
108
  getId() {
110
- return q;
109
+ return Y;
111
110
  }
112
111
  get _subControls() {
113
112
  return [
@@ -125,10 +124,10 @@ class _e extends I {
125
124
  }
126
125
  getTemplate() {
127
126
  var e;
128
- return this.rrsEnabled = f().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((t) => {
127
+ return this.rrsEnabled = g().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((t) => {
129
128
  var o;
130
129
  return (o = t == null ? void 0 : t.onDestroy) == null ? void 0 : o.call(t);
131
- }), this.algorithmControl = new E(), this.localeControl = new A(), this.currencyControl = new U(), this.productCountControl = new W(), this.productLayoutControl = new x(), this.filtersControl = new v(), this.shuffleControl = new M(), this.pricePlacementControl = new V(), this.layoutOrientationControl = new w(), this.strategyControl = this.rrsEnabled ? new G() : null, this._subControls.forEach((t) => {
130
+ }), this.algorithmControl = new E(), this.localeControl = new v(), this.currencyControl = new L(), this.productCountControl = new A(), this.productLayoutControl = new V(), this.filtersControl = new D(), this.shuffleControl = new W(), this.pricePlacementControl = new w(), this.layoutOrientationControl = new U(), this.strategyControl = this.rrsEnabled ? new x() : null, this._subControls.forEach((t) => {
132
131
  t && (t.api = this.api);
133
132
  }), `
134
133
  <div class="recommendation-controls-container">
@@ -146,16 +145,16 @@ class _e extends I {
146
145
  `;
147
146
  }
148
147
  _showControlsForBlock(e) {
149
- var s;
150
- const t = (s = this.getContainer()) == null ? void 0 : s.querySelector(".recommendation-controls-container");
148
+ var r;
149
+ const t = (r = this.getContainer()) == null ? void 0 : r.querySelector(".recommendation-controls-container");
151
150
  if (!t)
152
151
  return;
153
- const o = this._getRecommendationIdFromNode(e) === null ? null : d.getConfig(e), n = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= k), i = this.rrsEnabled && !!o && !n;
152
+ const o = this._getRecommendationIdFromNode(e) === null ? null : l.getConfig(e), n = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= R), i = this.rrsEnabled && !!o && !n;
154
153
  t.classList.toggle("strategy-block", n), t.classList.toggle("legacy-strategy-block", i);
155
154
  }
156
155
  async onRender() {
157
156
  var o;
158
- b(this.api);
157
+ T(this.api);
159
158
  const e = this._getRecommendationIdFromNode(this.currentNode), t = e ?? this.store.currentRecommendationId;
160
159
  if (t !== null && this.store.setCurrentBlock(t), e !== null && this._syncNodeConfigIfChanged(e), this._listenStateUpdates(), this._showControlsForBlock(this.currentNode), e !== null && this.strategyControl && (this.strategyControl.api = this.api, this.strategyControl.currentNode = this.currentNode, this.strategyControl.onRender()), t !== null && ((o = this.store.blockStates[t]) != null && o.isInitialized)) {
161
160
  this._initializeSubControls();
@@ -220,13 +219,13 @@ class _e extends I {
220
219
  const t = this.store.blockStates[e];
221
220
  if (!t)
222
221
  return;
223
- const o = JSON.stringify(d.getConfig(this.currentNode)), n = t.syncedConfigFingerprint;
222
+ const o = JSON.stringify(l.getConfig(this.currentNode)), n = t.syncedConfigFingerprint;
224
223
  t.syncedConfigFingerprint = o, n !== o && ((i = this.pendingNodeConfigWrite) == null ? void 0 : i.blockId) !== e && this._syncNodeConfigToStore();
225
224
  }
226
225
  /** Whether the deferred write would move the node's strategyId — see the caller (SD-149916). */
227
226
  _isPendingStrategyIdChange() {
228
227
  const e = this.pendingNodeConfigWrite;
229
- return e ? d.getConfig(this.currentNode).strategyId !== e.updates.strategyId : !1;
228
+ return e ? l.getConfig(this.currentNode).strategyId !== e.updates.strategyId : !1;
230
229
  }
231
230
  _capturePendingNodeConfigWrite() {
232
231
  const e = this.store.currentRecommendationId, t = e === null ? void 0 : this.store.blockStates[e];
@@ -241,15 +240,15 @@ class _e extends I {
241
240
  return !e || t !== null && e.blockId !== t ? null : e;
242
241
  }
243
242
  _getNodeConfigUpdates(e) {
244
- const { filters: t, strategy: o, strategyId: n, size: i, productIds: s, nodeConfigVersion: l } = e, { partnerName: a } = f();
243
+ const { filters: t, strategy: o, strategyId: n, size: i, productIds: r, nodeConfigVersion: h } = e, { partnerName: c } = g();
245
244
  return {
246
245
  filters: t,
247
246
  strategy: o,
248
247
  strategyId: n,
249
248
  size: i,
250
- productIds: s,
251
- configVersion: l,
252
- ...a.value ? { partnerName: a.value } : {}
249
+ productIds: r,
250
+ configVersion: h,
251
+ ...c.value ? { partnerName: c.value } : {}
253
252
  };
254
253
  }
255
254
  /**
@@ -264,7 +263,7 @@ class _e extends I {
264
263
  */
265
264
  _stagePendingNodeConfig(e) {
266
265
  const t = this._pendingWriteForNode();
267
- return !t || !this.currentNode ? !1 : (d.stageConfig(e, this.currentNode, t.updates), !0);
266
+ return !t || !this.currentNode ? !1 : (l.stageConfig(e, this.currentNode, t.updates), !0);
268
267
  }
269
268
  /**
270
269
  * Arms the guaranteed fallback write, once the product fetch has settled. The
@@ -289,14 +288,14 @@ class _e extends I {
289
288
  if (this.pendingNodeConfigWrite = null, this._clearConfigFlush(), !(!e || !this.api)) {
290
289
  if (e.blockId !== this.store.currentRecommendationId || !this.currentNode) {
291
290
  const { blockId: t, updates: o } = e;
292
- !p(t, o, h) && this.store.blockStates[t] && console.error("[recommendation] pending config write did not reach a node", { blockId: t });
291
+ !m(t, o, f) && this.store.blockStates[t] && console.error("[recommendation] pending config write did not reach a node", { blockId: t });
293
292
  return;
294
293
  }
295
- B(this.currentNode, e.updates) && d.updateConfig(
294
+ O(this.currentNode, e.updates) && l.updateConfig(
296
295
  this.api,
297
296
  this.currentNode,
298
297
  e.updates,
299
- F(this.currentNode, e.updates, h)
298
+ b(this.currentNode, e.updates, f)
300
299
  );
301
300
  }
302
301
  }
@@ -307,14 +306,14 @@ class _e extends I {
307
306
  /** The Product Ids label when the pending write moves the node's ids; the caller's default otherwise. */
308
307
  _pendingDescription() {
309
308
  const e = this._pendingWriteForNode();
310
- if (!(!e || !this.currentNode || !D(this.currentNode, e.updates)))
311
- return L;
309
+ if (!(!e || !this.currentNode || !B(this.currentNode, e.updates)))
310
+ return F;
312
311
  }
313
312
  _syncNodeConfigToStore() {
314
313
  var n;
315
- const e = d.getConfig(this.currentNode), t = this.store.currentRecommendationId, o = t !== null && ((n = this.store.blockStates[t]) == null ? void 0 : n.isInitialized);
314
+ const e = l.getConfig(this.currentNode), t = this.store.currentRecommendationId, o = t !== null && ((n = this.store.blockStates[t]) == null ? void 0 : n.isInitialized);
316
315
  this.store.patchCurrentBlockConfig({
317
- strategy: C(e.strategy) ?? e.strategy,
316
+ strategy: e.strategy,
318
317
  strategyId: e.strategyId,
319
318
  nodeConfigVersion: e.configVersion,
320
319
  language: e.language,
@@ -374,45 +373,61 @@ class _e extends I {
374
373
  return this.isPanelAlive && this.store.currentRecommendationId === e;
375
374
  }
376
375
  /**
377
- * Falls back to the first available option when the block's currency or locale is not offered (a new block on
378
- * the hard-coded default, or a block copied from another account). Only the default strategy gets an algorithm.
376
+ * Applies smart defaults for newly dropped blocks.
377
+ *
378
+ * For new blocks (config still matches hardcoded defaults), validates that
379
+ * the default currency and algorithm are available from the API response.
380
+ * If not, falls back to the first available option.
381
+ *
382
+ * Saved templates with user-customized config are left unchanged because
383
+ * their values won't match the hardcoded defaults.
379
384
  */
380
385
  _applySmartDefaults() {
381
386
  if (!this.currentNode || !this.api)
382
387
  return;
383
- const e = d.getConfig(this.currentNode), t = {};
388
+ const e = l.getConfig(this.currentNode), t = {};
384
389
  let o = null, n = null, i = null;
385
- const { currencyList: s } = this.store;
386
- if (s.length > 0 && !s.some((a) => a.value === `price.${e.currency.code}`) && (o = s[0].value.replace("price.", ""), t.currency = {
387
- ...e.currency,
388
- code: o,
389
- symbol: o
390
- }), C(e.strategy) === m.strategy) {
391
- const a = this.store.getActivePredictiveAlgorithms;
392
- a.length > 0 && (a.some(
393
- (N) => N.value === m.strategy
394
- ) || (n = a[0].value, t.strategy = n));
390
+ if (e.currency.code === a.currency.code) {
391
+ const { currencyList: r } = this.store;
392
+ r.length > 0 && (r.some(
393
+ (c) => c.value === `price.${a.currency.code}`
394
+ ) || (o = r[0].value.replace("price.", ""), t.currency = {
395
+ ...a.currency,
396
+ code: o,
397
+ symbol: o
398
+ }));
399
+ }
400
+ if (e.strategy === a.strategy) {
401
+ const r = this.store.getActivePredictiveAlgorithms;
402
+ r.length > 0 && (r.some(
403
+ (c) => c.value === a.strategy
404
+ ) || (n = r[0].value, t.strategy = n));
405
+ }
406
+ if (e.language === a.language) {
407
+ const r = this.store.getLanguages;
408
+ r.length > 0 && (r.some(
409
+ (c) => c.value === a.language
410
+ ) || (i = r[0].value, t.language = i));
395
411
  }
396
- const l = this.store.getLanguages;
397
- l.length > 0 && !l.some((a) => a.value === e.language) && (i = l[0].value, t.language = i), !(!o && !n && !i) && (d.updateConfig(
412
+ !o && !n && !i || (l.updateConfig(
398
413
  this.api,
399
414
  this.currentNode,
400
415
  t,
401
416
  "Applied smart defaults"
402
- ), o && t.currency && z({
417
+ ), o && t.currency && M({
403
418
  currentNode: this.currentNode,
404
419
  documentModifier: this.api.getDocumentModifier(),
405
420
  currency: t.currency
406
421
  }), this.store.patchCurrentBlockConfig({
407
- ...o && t.currency ? {
422
+ ...o ? {
408
423
  currencySettings: {
409
424
  name: o,
410
425
  value: o,
411
426
  symbol: o,
412
- alignment: t.currency.alignment === "before" ? "0" : "1",
413
- decimalCount: t.currency.decimalCount.toString(),
414
- decimalSeparator: t.currency.decimalSeparator,
415
- thousandSeparator: t.currency.thousandSeparator
427
+ alignment: a.currency.alignment === "before" ? "0" : "1",
428
+ decimalCount: a.currency.decimalCount.toString(),
429
+ decimalSeparator: a.currency.decimalSeparator,
430
+ thousandSeparator: a.currency.thousandSeparator
416
431
  }
417
432
  } : {},
418
433
  ...n ? { strategy: n } : {},
@@ -423,10 +438,10 @@ class _e extends I {
423
438
  * Reads the recommendation-id attribute from the block element within the node
424
439
  */
425
440
  _getRecommendationIdFromNode(e) {
426
- const t = $(e);
441
+ const t = G(e);
427
442
  if (!t || !("getAttribute" in t))
428
443
  return null;
429
- const o = t.getAttribute(S);
444
+ const o = t.getAttribute(I);
430
445
  if (!o)
431
446
  return null;
432
447
  const n = parseInt(o);
@@ -443,10 +458,10 @@ class _e extends I {
443
458
  if (e === null || !n)
444
459
  return;
445
460
  const i = t !== n.configVersion;
446
- i && !p(
461
+ i && !m(
447
462
  e,
448
463
  this._getNodeConfigUpdates(n.recommendationConfigs),
449
- h
464
+ f
450
465
  ) && console.error("[recommendation] config write outside the panel did not reach a node", { blockId: e }), (i || o) && this._refreshOutsidePanel(e, i);
451
466
  } catch (n) {
452
467
  console.error("[recommendation] finishing the block outside the panel failed", n);
@@ -460,7 +475,7 @@ class _e extends I {
460
475
  };
461
476
  }
462
477
  _refreshOutsidePanel(e, t) {
463
- O(e, {
478
+ S(e, {
464
479
  pickUpdates: (o) => this._getNodeConfigUpdates(o),
465
480
  description: "Update recommendation configuration",
466
481
  fetch: t
@@ -483,19 +498,19 @@ class _e extends I {
483
498
  return;
484
499
  }
485
500
  const e = this.store.recommendationProducts, t = this.api.getDocumentModifier(), o = this._pendingDescription(), n = this._stagePendingNodeConfig(t);
486
- if (H(this.currentNode)) {
501
+ if (z(this.currentNode)) {
487
502
  n && (t.apply(
488
- new R(o ?? "Update recommendation configuration")
503
+ new y(o ?? "Update recommendation configuration")
489
504
  ), this._consumePendingNodeConfig());
490
505
  return;
491
506
  }
492
- Y({
507
+ $({
493
508
  currentNode: this.currentNode,
494
509
  documentModifier: t,
495
510
  products: e,
496
511
  description: o,
497
512
  onApplied: n ? () => this._consumePendingNodeConfig() : void 0
498
- }) || j({
513
+ }) || H({
499
514
  currentNode: this.currentNode,
500
515
  documentModifier: t,
501
516
  products: e,
@@ -526,51 +541,51 @@ class _e extends I {
526
541
  this.panelGeneration++, this.isPanelAlive = !0, this.trackedBlockId = e.currentRecommendationId, this.fetchedConfigVersion = o, this.hasUnrenderedProducts = !1, this.storeUnsubscription = e.$subscribe(() => {
527
542
  const n = e.currentRecommendationId;
528
543
  if (n !== this.trackedBlockId) {
529
- const g = this._trackedBlockSnapshot();
530
- this.panelGeneration++, this.trackedBlockId = n, t = e.recommendationProducts, o = this._getBlockConfigVersion(n), this.fetchedConfigVersion = o, this.hasUnrenderedProducts = !1, this._finishBlockOutsidePanel(g);
544
+ const p = this._trackedBlockSnapshot();
545
+ this.panelGeneration++, this.trackedBlockId = n, t = e.recommendationProducts, o = this._getBlockConfigVersion(n), this.fetchedConfigVersion = o, this.hasUnrenderedProducts = !1, this._finishBlockOutsidePanel(p);
531
546
  return;
532
547
  }
533
548
  const i = this._getBlockConfigVersion(n);
534
549
  i !== o && (o = i, this._capturePendingNodeConfigWrite(), this._isPendingStrategyIdChange() && this._flushPendingNodeConfig(), this._debouncedFetchProducts(n, this.panelGeneration));
535
- const s = e.recommendationProducts, l = s !== t, a = Array.isArray(s) && s.length > 0;
536
- l && a && (t = s, this.hasUnrenderedProducts = !0, this._debouncedRegenerateWithProducts(this.panelGeneration));
550
+ const r = e.recommendationProducts, h = r !== t, c = Array.isArray(r) && r.length > 0;
551
+ h && c && (t = r, this.hasUnrenderedProducts = !0, this._debouncedRegenerateWithProducts(this.panelGeneration));
537
552
  });
538
553
  }
539
554
  }
540
555
  export {
541
- Pe as ALGORITHM_CONTROL_ID,
556
+ _e as ALGORITHM_CONTROL_ID,
542
557
  E as AlgorithmControl,
543
- q as CONTROL_BLOCK_ID,
544
- Ie as CURRENCY_CONTROL_ID,
545
- U as CurrencyControl,
546
- Se as FILTERS_CONTROL_ID,
547
- v as FiltersControl,
548
- Oe as LAYOUT_ORIENTATION_CONTROL_ID,
549
- Be as LOCALE_CONTROL_ID,
550
- w as LayoutOrientationControl,
551
- A as LocaleControl,
552
- De as PRICE_PLACEMENT_CONTROL_ID,
553
- Ee as PRODUCT_COUNT_CONTROL_ID,
554
- ve as PRODUCT_LAYOUT_CONTROL_ID,
555
- V as PricePlacementControl,
556
- W as ProductCountControl,
557
- x as ProductLayoutControl,
558
- _e as RecommendationBlockControl,
559
- Ae as SHUFFLE_CONTROL_ID,
560
- We as STRATEGY_CONTROL_ID,
561
- M as ShuffleControl,
562
- G as StrategyControl,
563
- Me as adjustProductsToSize,
564
- Ge as formatProductPrice,
565
- $ as getBlockElement,
566
- ze as getCardComposition,
567
- $e as getCurrentLayout,
568
- He as getMainContainerTbody,
569
- H as isPartnerManagedBlock,
570
- Ye as regenerateMobileProductRows,
571
- j as regenerateProductRowsWithStyles,
572
- z as setCurrencyAttributes,
573
- je as updatePricesInPlace,
574
- Y as updateProductContentInPlace,
575
- qe as updateSingleProductContent
558
+ Y as CONTROL_BLOCK_ID,
559
+ ye as CURRENCY_CONTROL_ID,
560
+ L as CurrencyControl,
561
+ Re as FILTERS_CONTROL_ID,
562
+ D as FiltersControl,
563
+ ke as LAYOUT_ORIENTATION_CONTROL_ID,
564
+ Te as LOCALE_CONTROL_ID,
565
+ U as LayoutOrientationControl,
566
+ v as LocaleControl,
567
+ be as PRICE_PLACEMENT_CONTROL_ID,
568
+ Fe as PRODUCT_COUNT_CONTROL_ID,
569
+ Le as PRODUCT_LAYOUT_CONTROL_ID,
570
+ w as PricePlacementControl,
571
+ A as ProductCountControl,
572
+ V as ProductLayoutControl,
573
+ me as RecommendationBlockControl,
574
+ Ue as SHUFFLE_CONTROL_ID,
575
+ we as STRATEGY_CONTROL_ID,
576
+ W as ShuffleControl,
577
+ x as StrategyControl,
578
+ Ve as adjustProductsToSize,
579
+ We as formatProductPrice,
580
+ G as getBlockElement,
581
+ xe as getCardComposition,
582
+ Me as getCurrentLayout,
583
+ Ge as getMainContainerTbody,
584
+ z as isPartnerManagedBlock,
585
+ ze as regenerateMobileProductRows,
586
+ H as regenerateProductRowsWithStyles,
587
+ M as setCurrencyAttributes,
588
+ $e as updatePricesInPlace,
589
+ $ as updateProductContentInPlace,
590
+ He as updateSingleProductContent
576
591
  };
@@ -1,8 +1,7 @@
1
- import { ATTR_PRODUCT_PRICE as D, ATTR_PRODUCT_OLD_PRICE as O } from "../../constants/selectors.js";
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 { createBlockTemplate as A, getDefaultProducts as g, DEFAULTS as U, buildSpacer as h, DEFAULT_CARD_COMPOSITION as Y, buildElementRenderer as B, buildCellOptions as m, DEFAULT_CARD_VISIBILITY as F } from "../utils.js";
4
- import { DEFAULT_CELL_PADDING as W, renderInlineGridPriceCell as k, buildFillerCell as H, gridElementRenderer as x } from "./elementRenderer.js";
5
- import { resolveInlinePriceOrder as y } from "../../utils/inlinePriceOrder.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
+ import { DEFAULT_CELL_PADDING as k, renderInlineGridPriceCell as H, buildFillerCell as x, gridElementRenderer as y } from "./elementRenderer.js";
6
5
  const G = `
7
6
  <tr class="recommendation-product-row">
8
7
  <td>
@@ -29,29 +28,29 @@ const G = `
29
28
  {-{-CELLS-}-}
30
29
  </tr>
31
30
  `;
32
- function j(t, r, n, e = Y, c = {}, i = {}) {
33
- const { cellPadding: s = W, cardBackgroundColor: u, visibility: a, priceInline: o = !1 } = i, d = (100 / r).toFixed(2), p = r - t.length, T = p > 0 ? H(d, s).repeat(p) : "", I = B(n, e, c), R = y(e), L = o ? e.filter((l) => l !== R.skip) : e, C = m(D, i), P = m(O, i);
34
- return L.filter((l) => I[l]).map((l) => {
35
- const _ = (a == null ? void 0 : a[l]) ?? F[l] ?? !0, b = _ ? "" : 'style="display: none;"', S = m(l, i, e), f = t.map((E) => (o && l === R.anchor ? k(
31
+ function j(t, r, o, e = Y, c = {}, i = {}) {
32
+ const { cellPadding: s = k, cardBackgroundColor: u, visibility: a, priceInline: n = !1 } = i, d = (100 / r).toFixed(2), p = r - t.length, T = p > 0 ? x(d, s).repeat(p) : "", m = B(o, e, c), R = F(e), L = n ? e.filter((l) => l !== R.skip) : e, C = I(f, i), P = I(O, i);
33
+ return L.filter((l) => m[l]).map((l) => {
34
+ const _ = (a == null ? void 0 : a[l]) ?? W[l] ?? !0, b = _ ? "" : 'style="display: none;"', S = I(l, i, e), D = t.map((E) => (n && l === R.anchor ? H(
36
35
  E,
37
36
  R.originalFirst,
38
37
  C,
39
38
  P,
40
39
  u
41
- ) : I[l](E, S)).replace("<td", `<td width="${d}%"`)).join("");
42
- return V.replace("{-{-ATTR_TYPE-}-}", l).replace("{-{-VISIBILITY-}-}", _ ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", b).replace("{-{-CELLS-}-}", f + T);
40
+ ) : m[l](E, S)).replace("<td", `<td width="${d}%"`)).join("");
41
+ return V.replace("{-{-ATTR_TYPE-}-}", l).replace("{-{-VISIBILITY-}-}", _ ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", b).replace("{-{-CELLS-}-}", D + T);
43
42
  }).join("");
44
43
  }
45
- function v(t, r, n, e, c = {}, i = {}) {
44
+ function v(t, r, o, e, c = {}, i = {}) {
46
45
  const s = [];
47
- for (let o = 0; o < t.length; o += r)
48
- s.push(t.slice(o, o + r));
46
+ for (let n = 0; n < t.length; n += r)
47
+ s.push(t.slice(n, n + r));
49
48
  const u = h(i.rowSpacingPx);
50
- return s.map((o, d) => {
49
+ return s.map((n, d) => {
51
50
  const p = j(
52
- o,
53
- r,
54
51
  n,
52
+ r,
53
+ o,
55
54
  e,
56
55
  c,
57
56
  i
@@ -59,22 +58,22 @@ function v(t, r, n, e, c = {}, i = {}) {
59
58
  return d > 0 ? u + T : T;
60
59
  }).join("");
61
60
  }
62
- function M(t, r, n, e = {}, c = {}) {
61
+ function M(t, r, o, e = {}, c = {}) {
63
62
  return v(
64
63
  t,
65
64
  r,
66
- x,
67
- n,
65
+ y,
66
+ o,
68
67
  e,
69
68
  c
70
69
  );
71
70
  }
72
- function X(t) {
73
- const r = t ? `ins-recommendation-v3-block-${t}` : void 0, n = A("grid", r), e = g(), c = M(e, w);
74
- return n.replace("{-{-TITLE-}-}", U.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
71
+ function Q(t) {
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-}-}", "");
75
74
  }
76
75
  export {
77
- X as getDefaultTemplate,
76
+ Q as getDefaultTemplate,
78
77
  j as prepareGridAttributeRows,
79
78
  v as prepareGridProductRows,
80
79
  M as prepareProductRows