@useinsider/guido 3.22.0 → 3.23.0

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 (70) 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/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +11 -11
  5. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +9 -9
  6. package/dist/composables/useEditorOpenMetrics.js +167 -0
  7. package/dist/composables/useStripo.js +93 -82
  8. package/dist/config/compiler/utils/recommendationCompilerUtils.js +22 -22
  9. package/dist/config/migrator/recommendation/compositionMapper.js +56 -49
  10. package/dist/config/migrator/recommendation/extractors.js +100 -40
  11. package/dist/config/migrator/recommendation/htmlBuilder.js +285 -207
  12. package/dist/config/migrator/recommendation/settingsMapper.js +37 -36
  13. package/dist/config/migrator/recommendation/themeMapper.js +53 -41
  14. package/dist/config/migrator/recommendationMigrator.js +68 -61
  15. package/dist/extensions/Blocks/Items/controls/button/link.js +14 -17
  16. package/dist/extensions/Blocks/Items/controls/cardComposition.js +14 -17
  17. package/dist/extensions/Blocks/Items/controls/image/link.js +14 -17
  18. package/dist/extensions/Blocks/Items/controls/name/trimming.js +9 -10
  19. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +24 -25
  20. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -13
  21. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +29 -30
  22. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +15 -16
  23. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +25 -26
  24. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +27 -28
  25. package/dist/extensions/Blocks/Items/controls/settingsControl.js +75 -80
  26. package/dist/extensions/Blocks/Recommendation/block.js +33 -24
  27. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +3 -3
  28. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +27 -26
  29. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +13 -13
  30. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +165 -175
  31. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
  32. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
  33. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +15 -15
  34. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +12 -12
  35. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +10 -10
  36. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +1 -1
  37. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +23 -22
  38. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +19 -18
  39. package/dist/extensions/Blocks/Recommendation/templates/utils.js +82 -91
  40. package/dist/extensions/Blocks/Recommendation/utils/inlinePriceOrder.js +12 -0
  41. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +3 -2
  42. package/dist/extensions/Blocks/common-control.js +62 -55
  43. package/dist/guido.css +1 -1
  44. package/dist/library.js +12 -10
  45. package/dist/package.json.js +6 -4
  46. package/dist/public/prefetchRuntime.js +4 -0
  47. package/dist/src/composables/useEditorOpenMetrics.d.ts +27 -0
  48. package/dist/src/composables/useStripo.d.ts +2 -1
  49. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +3 -1
  50. package/dist/src/config/migrator/recommendation/extractors.d.ts +35 -6
  51. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +3 -1
  52. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +3 -1
  53. package/dist/src/config/migrator/recommendation/types.d.ts +11 -1
  54. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +0 -1
  55. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
  56. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +5 -10
  57. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -13
  58. package/dist/src/extensions/Blocks/Recommendation/utils/inlinePriceOrder.d.ts +9 -0
  59. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +2 -19
  60. package/dist/src/extensions/Blocks/common-control.d.ts +2 -0
  61. package/dist/src/library.d.ts +1 -0
  62. package/dist/src/public/prefetchRuntime.d.ts +1 -0
  63. package/dist/src/stores/unsubscribe.d.ts +10 -0
  64. package/dist/src/utils/runtimePrefetch.d.ts +4 -0
  65. package/dist/src/utils/stripoRuntime.d.ts +3 -0
  66. package/dist/static/stripo-runtime-manifest.json.js +9 -0
  67. package/dist/stores/unsubscribe.js +33 -29
  68. package/dist/utils/runtimePrefetch.js +26 -0
  69. package/dist/utils/stripoRuntime.js +13 -0
  70. package/package.json +7 -2
@@ -1,72 +1,73 @@
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";
1
+ var y = Object.defineProperty;
2
+ var P = (u, d, e) => d in u ? y(u, d, { enumerable: !0, configurable: !0, writable: !0, value: e }) : u[d] = e;
3
+ var r = (u, d, e) => P(u, typeof d != "symbol" ? d + "" : d, 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 S, DEFAULT_NODE_CONFIG as m } from "../../constants/defaultConfig.js";
8
+ import { RECOMMENDATION_ID_ATTR as k } from "../../constants/selectors.js";
9
+ import { RecommendationConfigService as c } 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 p } from "../../utils/legacyStrategyMap.js";
13
+ import { registerNodeConfigWriter as b, writeBlockConfigOutsidePanel as C, hasEditedConfigChange as B, pickConfigDescription as F, isProductIdsChange as L, PRODUCT_IDS_DESCRIPTION as D } from "../../utils/nodeConfigWriter.js";
13
14
  import { AlgorithmControl as E } from "./algorithm.js";
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 {
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 ke } from "./filters.js";
20
+ import { LayoutOrientationControl as A } from "./layoutOrientation.js";
21
+ import { LAYOUT_ORIENTATION_CONTROL_ID as Oe } from "./layoutOrientation.js";
22
+ import { LocaleControl as w } 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 Le } 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 we } 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 $, getBlockElement as z, isPartnerManagedBlock as H, updateProductContentInPlace as Y, regenerateProductRowsWithStyles as j } from "./utils.js";
35
+ import { adjustProductsToSize as Me, formatProductPrice as Ge, getCardComposition as $e, getCurrentLayout as ze, 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 {
38
39
  constructor() {
39
40
  super(...arguments);
40
- s(this, "store", k());
41
- s(this, "storeUnsubscription", () => {
41
+ r(this, "store", T());
42
+ r(this, "storeUnsubscription", () => {
42
43
  });
43
44
  // A config change waiting to reach the node config. Deferred so it can ride the
44
45
  // re-render's single apply() — one user action must cost one undo press.
45
- s(this, "pendingNodeConfigWrite", null);
46
- s(this, "pendingConfigFlushTimer", null);
46
+ r(this, "pendingNodeConfigWrite", null);
47
+ r(this, "pendingConfigFlushTimer", null);
47
48
  // What the panel still owes the block it watches — finished outside the panel on teardown
48
49
  // and block switch. A new generation tells debounced work queued for the old one to stand down.
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);
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);
54
55
  // Sub-control instances for lifecycle management
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);
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);
66
67
  /**
67
68
  * Debounced product fetch to prevent rapid API calls during config changes
68
69
  */
69
- s(this, "_debouncedFetchProducts", C(async (e, t) => {
70
+ r(this, "_debouncedFetchProducts", _(async (e, t) => {
70
71
  if (t !== this.panelGeneration)
71
72
  return;
72
73
  const o = this._getBlockConfigVersion(e);
@@ -87,7 +88,7 @@ class me extends P {
87
88
  * count. The store pads products to the configured size, so in-place only
88
89
  * fails when the size actually changed.
89
90
  */
90
- s(this, "_debouncedRegenerateWithProducts", C((e) => {
91
+ r(this, "_debouncedRegenerateWithProducts", _((e) => {
91
92
  if (e !== this.panelGeneration || !this.currentNode || !this.api)
92
93
  return;
93
94
  const t = this._getRecommendationIdFromNode(this.currentNode), o = this.store.currentRecommendationId;
@@ -106,7 +107,7 @@ class me extends P {
106
107
  }, 100));
107
108
  }
108
109
  getId() {
109
- return Y;
110
+ return q;
110
111
  }
111
112
  get _subControls() {
112
113
  return [
@@ -124,10 +125,10 @@ class me extends P {
124
125
  }
125
126
  getTemplate() {
126
127
  var e;
127
- return this.rrsEnabled = g().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((t) => {
128
+ return this.rrsEnabled = f().isFeatureEnabled("reusableRecommendationStrategy"), this._subControls.forEach((t) => {
128
129
  var o;
129
130
  return (o = t == null ? void 0 : t.onDestroy) == null ? void 0 : o.call(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) => {
131
+ }), this.algorithmControl = new E(), this.localeControl = new w(), 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 A(), this.strategyControl = this.rrsEnabled ? new G() : null, this._subControls.forEach((t) => {
131
132
  t && (t.api = this.api);
132
133
  }), `
133
134
  <div class="recommendation-controls-container">
@@ -145,28 +146,21 @@ class me extends P {
145
146
  `;
146
147
  }
147
148
  _showControlsForBlock(e) {
148
- var r;
149
- const t = (r = this.getContainer()) == null ? void 0 : r.querySelector(".recommendation-controls-container");
149
+ var s;
150
+ const t = (s = this.getContainer()) == null ? void 0 : s.querySelector(".recommendation-controls-container");
150
151
  if (!t)
151
152
  return;
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;
153
+ const o = this._getRecommendationIdFromNode(e) === null ? null : c.getConfig(e), n = this.rrsEnabled && !!o && (!!(o != null && o.strategyId) || ((o == null ? void 0 : o.configVersion) ?? 0) >= S), i = this.rrsEnabled && !!o && !n;
153
154
  t.classList.toggle("strategy-block", n), t.classList.toggle("legacy-strategy-block", i);
154
155
  }
155
- async onRender() {
156
- var o;
157
- T(this.api);
158
- const e = this._getRecommendationIdFromNode(this.currentNode), t = e ?? this.store.currentRecommendationId;
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)) {
160
- this._initializeSubControls();
161
- return;
162
- }
163
- await this._fetchBlockData(t), this._initializeSubControls();
156
+ onRender() {
157
+ b(this.api), this.forgetLastPanelNode(), this._listenStateUpdates();
164
158
  }
165
159
  onTemplateNodeUpdated(e) {
166
160
  var o;
167
161
  super.onTemplateNodeUpdated(e);
168
162
  const t = this._getRecommendationIdFromNode(e);
169
- t !== null && t !== this.store.currentRecommendationId && this.store.setCurrentBlock(t), t !== null && this._syncNodeConfigIfChanged(t), this._showControlsForBlock(e), t !== null && !((o = this.store.blockStates[t]) != null && o.isInitialized) && this._fetchBlockData(t).then(() => {
163
+ t !== null && t !== this.store.currentRecommendationId && this.store.setCurrentBlock(t), t !== null && this._syncNodeConfigIfChanged(t), this._showControlsForBlock(e), this._renderWithPanelNode(t), t !== null && !((o = this.store.blockStates[t]) != null && o.isInitialized) && this._fetchBlockData(t).then(() => {
170
164
  this._initializeSubControls();
171
165
  }), this._subControls.forEach((n) => {
172
166
  var i;
@@ -174,7 +168,7 @@ class me extends P {
174
168
  });
175
169
  }
176
170
  onDestroy() {
177
- this.panelGeneration++, this.isPanelAlive = !1, this.storeUnsubscription(), this._finishBlockOutsidePanel(), this.hasUnrenderedProducts = !1, this._subControls.forEach((e) => {
171
+ this.panelGeneration++, this.isPanelAlive = !1, this.isAwaitingPanelNode = !1, this.storeUnsubscription(), this._finishBlockOutsidePanel(), this.hasUnrenderedProducts = !1, this._subControls.forEach((e) => {
178
172
  var t;
179
173
  return (t = e == null ? void 0 : e.onDestroy) == null ? void 0 : t.call(e);
180
174
  });
@@ -184,11 +178,23 @@ class me extends P {
184
178
  * Each sub-control manages its own form values and event listeners
185
179
  */
186
180
  _initializeSubControls() {
187
- this._subControls.forEach((e) => {
181
+ this.currentNode && this._subControls.forEach((e) => {
188
182
  var t;
189
183
  e && (e.api = this.api, e.currentNode = this.currentNode, (t = e.onRender) == null || t.call(e));
190
184
  });
191
185
  }
186
+ // The panel's own node, not the store's last focused block, decides what to render; the caller
187
+ // fetches an uninitialized block once its config is synced.
188
+ _renderWithPanelNode(e) {
189
+ var t;
190
+ if (!(!this.isAwaitingPanelNode || e === null)) {
191
+ if (this.isAwaitingPanelNode = !1, (t = this.store.blockStates[e]) != null && t.isInitialized) {
192
+ this._initializeSubControls();
193
+ return;
194
+ }
195
+ this.strategyControl && (this.strategyControl.api = this.api, this.strategyControl.currentNode = this.currentNode, this.strategyControl.onRender());
196
+ }
197
+ }
192
198
  /**
193
199
  * Syncs persisted node config into the Pinia store's block state.
194
200
  *
@@ -219,13 +225,13 @@ class me extends P {
219
225
  const t = this.store.blockStates[e];
220
226
  if (!t)
221
227
  return;
222
- const o = JSON.stringify(l.getConfig(this.currentNode)), n = t.syncedConfigFingerprint;
228
+ const o = JSON.stringify(c.getConfig(this.currentNode)), n = t.syncedConfigFingerprint;
223
229
  t.syncedConfigFingerprint = o, n !== o && ((i = this.pendingNodeConfigWrite) == null ? void 0 : i.blockId) !== e && this._syncNodeConfigToStore();
224
230
  }
225
231
  /** Whether the deferred write would move the node's strategyId — see the caller (SD-149916). */
226
232
  _isPendingStrategyIdChange() {
227
233
  const e = this.pendingNodeConfigWrite;
228
- return e ? l.getConfig(this.currentNode).strategyId !== e.updates.strategyId : !1;
234
+ return e ? c.getConfig(this.currentNode).strategyId !== e.updates.strategyId : !1;
229
235
  }
230
236
  _capturePendingNodeConfigWrite() {
231
237
  const e = this.store.currentRecommendationId, t = e === null ? void 0 : this.store.blockStates[e];
@@ -240,15 +246,15 @@ class me extends P {
240
246
  return !e || t !== null && e.blockId !== t ? null : e;
241
247
  }
242
248
  _getNodeConfigUpdates(e) {
243
- const { filters: t, strategy: o, strategyId: n, size: i, productIds: r, nodeConfigVersion: h } = e, { partnerName: c } = g();
249
+ const { filters: t, strategy: o, strategyId: n, size: i, productIds: s, nodeConfigVersion: l } = e, { partnerName: a } = f();
244
250
  return {
245
251
  filters: t,
246
252
  strategy: o,
247
253
  strategyId: n,
248
254
  size: i,
249
- productIds: r,
250
- configVersion: h,
251
- ...c.value ? { partnerName: c.value } : {}
255
+ productIds: s,
256
+ configVersion: l,
257
+ ...a.value ? { partnerName: a.value } : {}
252
258
  };
253
259
  }
254
260
  /**
@@ -263,7 +269,7 @@ class me extends P {
263
269
  */
264
270
  _stagePendingNodeConfig(e) {
265
271
  const t = this._pendingWriteForNode();
266
- return !t || !this.currentNode ? !1 : (l.stageConfig(e, this.currentNode, t.updates), !0);
272
+ return !t || !this.currentNode ? !1 : (c.stageConfig(e, this.currentNode, t.updates), !0);
267
273
  }
268
274
  /**
269
275
  * Arms the guaranteed fallback write, once the product fetch has settled. The
@@ -288,14 +294,14 @@ class me extends P {
288
294
  if (this.pendingNodeConfigWrite = null, this._clearConfigFlush(), !(!e || !this.api)) {
289
295
  if (e.blockId !== this.store.currentRecommendationId || !this.currentNode) {
290
296
  const { blockId: t, updates: o } = e;
291
- !m(t, o, f) && this.store.blockStates[t] && console.error("[recommendation] pending config write did not reach a node", { blockId: t });
297
+ !C(t, o, h) && this.store.blockStates[t] && console.error("[recommendation] pending config write did not reach a node", { blockId: t });
292
298
  return;
293
299
  }
294
- O(this.currentNode, e.updates) && l.updateConfig(
300
+ B(this.currentNode, e.updates) && c.updateConfig(
295
301
  this.api,
296
302
  this.currentNode,
297
303
  e.updates,
298
- b(this.currentNode, e.updates, f)
304
+ F(this.currentNode, e.updates, h)
299
305
  );
300
306
  }
301
307
  }
@@ -306,14 +312,14 @@ class me extends P {
306
312
  /** The Product Ids label when the pending write moves the node's ids; the caller's default otherwise. */
307
313
  _pendingDescription() {
308
314
  const e = this._pendingWriteForNode();
309
- if (!(!e || !this.currentNode || !B(this.currentNode, e.updates)))
310
- return F;
315
+ if (!(!e || !this.currentNode || !L(this.currentNode, e.updates)))
316
+ return D;
311
317
  }
312
318
  _syncNodeConfigToStore() {
313
319
  var n;
314
- const e = l.getConfig(this.currentNode), t = this.store.currentRecommendationId, o = t !== null && ((n = this.store.blockStates[t]) == null ? void 0 : n.isInitialized);
320
+ const e = c.getConfig(this.currentNode), t = this.store.currentRecommendationId, o = t !== null && ((n = this.store.blockStates[t]) == null ? void 0 : n.isInitialized);
315
321
  this.store.patchCurrentBlockConfig({
316
- strategy: e.strategy,
322
+ strategy: p(e.strategy) ?? e.strategy,
317
323
  strategyId: e.strategyId,
318
324
  nodeConfigVersion: e.configVersion,
319
325
  language: e.language,
@@ -347,7 +353,7 @@ class me extends P {
347
353
  * 2. Smart defaults for new blocks (currency, algorithm) — sequential
348
354
  * 3. Product data with correct defaults — sequential
349
355
  *
350
- * Shared by onRender() and onTemplateNodeUpdated() to avoid duplication.
356
+ * Called from onTemplateNodeUpdated() once the node config is synced.
351
357
  * Marks the block as initialized to prevent redundant fetches on re-selection.
352
358
  */
353
359
  async _fetchBlockData(e) {
@@ -373,61 +379,45 @@ class me extends P {
373
379
  return this.isPanelAlive && this.store.currentRecommendationId === e;
374
380
  }
375
381
  /**
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.
382
+ * Falls back to the first available option when the block's currency or locale is not offered (a new block on
383
+ * the hard-coded default, or a block copied from another account). Only the default strategy gets an algorithm.
384
384
  */
385
385
  _applySmartDefaults() {
386
386
  if (!this.currentNode || !this.api)
387
387
  return;
388
- const e = l.getConfig(this.currentNode), t = {};
388
+ const e = c.getConfig(this.currentNode), t = {};
389
389
  let o = null, n = null, i = null;
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));
390
+ const { currencyList: s } = this.store;
391
+ if (s.length > 0 && !s.some((a) => a.value === `price.${e.currency.code}`) && (o = s[0].value.replace("price.", ""), t.currency = {
392
+ ...e.currency,
393
+ code: o,
394
+ symbol: o
395
+ }), p(e.strategy) === m.strategy) {
396
+ const a = this.store.getActivePredictiveAlgorithms;
397
+ a.length > 0 && (a.some(
398
+ (N) => N.value === m.strategy
399
+ ) || (n = a[0].value, t.strategy = n));
411
400
  }
412
- !o && !n && !i || (l.updateConfig(
401
+ const l = this.store.getLanguages;
402
+ l.length > 0 && !l.some((a) => a.value === e.language) && (i = l[0].value, t.language = i), !(!o && !n && !i) && (c.updateConfig(
413
403
  this.api,
414
404
  this.currentNode,
415
405
  t,
416
406
  "Applied smart defaults"
417
- ), o && t.currency && M({
407
+ ), o && t.currency && $({
418
408
  currentNode: this.currentNode,
419
409
  documentModifier: this.api.getDocumentModifier(),
420
410
  currency: t.currency
421
411
  }), this.store.patchCurrentBlockConfig({
422
- ...o ? {
412
+ ...o && t.currency ? {
423
413
  currencySettings: {
424
414
  name: o,
425
415
  value: o,
426
416
  symbol: o,
427
- alignment: a.currency.alignment === "before" ? "0" : "1",
428
- decimalCount: a.currency.decimalCount.toString(),
429
- decimalSeparator: a.currency.decimalSeparator,
430
- thousandSeparator: a.currency.thousandSeparator
417
+ alignment: t.currency.alignment === "before" ? "0" : "1",
418
+ decimalCount: t.currency.decimalCount.toString(),
419
+ decimalSeparator: t.currency.decimalSeparator,
420
+ thousandSeparator: t.currency.thousandSeparator
431
421
  }
432
422
  } : {},
433
423
  ...n ? { strategy: n } : {},
@@ -438,10 +428,10 @@ class me extends P {
438
428
  * Reads the recommendation-id attribute from the block element within the node
439
429
  */
440
430
  _getRecommendationIdFromNode(e) {
441
- const t = G(e);
431
+ const t = z(e);
442
432
  if (!t || !("getAttribute" in t))
443
433
  return null;
444
- const o = t.getAttribute(I);
434
+ const o = t.getAttribute(k);
445
435
  if (!o)
446
436
  return null;
447
437
  const n = parseInt(o);
@@ -458,10 +448,10 @@ class me extends P {
458
448
  if (e === null || !n)
459
449
  return;
460
450
  const i = t !== n.configVersion;
461
- i && !m(
451
+ i && !C(
462
452
  e,
463
453
  this._getNodeConfigUpdates(n.recommendationConfigs),
464
- f
454
+ h
465
455
  ) && console.error("[recommendation] config write outside the panel did not reach a node", { blockId: e }), (i || o) && this._refreshOutsidePanel(e, i);
466
456
  } catch (n) {
467
457
  console.error("[recommendation] finishing the block outside the panel failed", n);
@@ -475,7 +465,7 @@ class me extends P {
475
465
  };
476
466
  }
477
467
  _refreshOutsidePanel(e, t) {
478
- S(e, {
468
+ O(e, {
479
469
  pickUpdates: (o) => this._getNodeConfigUpdates(o),
480
470
  description: "Update recommendation configuration",
481
471
  fetch: t
@@ -498,19 +488,19 @@ class me extends P {
498
488
  return;
499
489
  }
500
490
  const e = this.store.recommendationProducts, t = this.api.getDocumentModifier(), o = this._pendingDescription(), n = this._stagePendingNodeConfig(t);
501
- if (z(this.currentNode)) {
491
+ if (H(this.currentNode)) {
502
492
  n && (t.apply(
503
- new y(o ?? "Update recommendation configuration")
493
+ new R(o ?? "Update recommendation configuration")
504
494
  ), this._consumePendingNodeConfig());
505
495
  return;
506
496
  }
507
- $({
497
+ Y({
508
498
  currentNode: this.currentNode,
509
499
  documentModifier: t,
510
500
  products: e,
511
501
  description: o,
512
502
  onApplied: n ? () => this._consumePendingNodeConfig() : void 0
513
- }) || H({
503
+ }) || j({
514
504
  currentNode: this.currentNode,
515
505
  documentModifier: t,
516
506
  products: e,
@@ -541,51 +531,51 @@ class me extends P {
541
531
  this.panelGeneration++, this.isPanelAlive = !0, this.trackedBlockId = e.currentRecommendationId, this.fetchedConfigVersion = o, this.hasUnrenderedProducts = !1, this.storeUnsubscription = e.$subscribe(() => {
542
532
  const n = e.currentRecommendationId;
543
533
  if (n !== this.trackedBlockId) {
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);
534
+ const g = this._trackedBlockSnapshot();
535
+ this.panelGeneration++, this.trackedBlockId = n, t = e.recommendationProducts, o = this._getBlockConfigVersion(n), this.fetchedConfigVersion = o, this.hasUnrenderedProducts = !1, this._finishBlockOutsidePanel(g);
546
536
  return;
547
537
  }
548
538
  const i = this._getBlockConfigVersion(n);
549
539
  i !== o && (o = i, this._capturePendingNodeConfigWrite(), this._isPendingStrategyIdChange() && this._flushPendingNodeConfig(), this._debouncedFetchProducts(n, 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));
540
+ const s = e.recommendationProducts, l = s !== t, a = Array.isArray(s) && s.length > 0;
541
+ l && a && (t = s, this.hasUnrenderedProducts = !0, this._debouncedRegenerateWithProducts(this.panelGeneration));
552
542
  });
553
543
  }
554
544
  }
555
545
  export {
556
- _e as ALGORITHM_CONTROL_ID,
546
+ Pe as ALGORITHM_CONTROL_ID,
557
547
  E as AlgorithmControl,
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
548
+ q as CONTROL_BLOCK_ID,
549
+ Ie as CURRENCY_CONTROL_ID,
550
+ U as CurrencyControl,
551
+ ke as FILTERS_CONTROL_ID,
552
+ v as FiltersControl,
553
+ Oe as LAYOUT_ORIENTATION_CONTROL_ID,
554
+ Be as LOCALE_CONTROL_ID,
555
+ A as LayoutOrientationControl,
556
+ w as LocaleControl,
557
+ Le as PRICE_PLACEMENT_CONTROL_ID,
558
+ Ee as PRODUCT_COUNT_CONTROL_ID,
559
+ ve as PRODUCT_LAYOUT_CONTROL_ID,
560
+ V as PricePlacementControl,
561
+ W as ProductCountControl,
562
+ x as ProductLayoutControl,
563
+ _e as RecommendationBlockControl,
564
+ we as SHUFFLE_CONTROL_ID,
565
+ We as STRATEGY_CONTROL_ID,
566
+ M as ShuffleControl,
567
+ G as StrategyControl,
568
+ Me as adjustProductsToSize,
569
+ Ge as formatProductPrice,
570
+ z as getBlockElement,
571
+ $e as getCardComposition,
572
+ ze as getCurrentLayout,
573
+ He as getMainContainerTbody,
574
+ H as isPartnerManagedBlock,
575
+ Ye as regenerateMobileProductRows,
576
+ j as regenerateProductRowsWithStyles,
577
+ $ as setCurrencyAttributes,
578
+ je as updatePricesInPlace,
579
+ Y as updateProductContentInPlace,
580
+ qe as updateSingleProductContent
591
581
  };
@@ -1,15 +1,15 @@
1
1
  import { ModificationDescription as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as u } from "../../../common-control.js";
2
+ import { CommonControl as d } from "../../../common-control.js";
3
3
  import { RecommendationBlockId as a } from "../../constants/blockIds.js";
4
- import { RecommendationControlId as d } from "../../constants/controlIds.js";
4
+ import { RecommendationControlId as u } from "../../constants/controlIds.js";
5
5
  import { BLOCK_ROOT_SELECTOR as m } from "../../constants/selectors.js";
6
6
  import { CSS_CLASS_TEXT_TRIM as r, ensureTextTrimCssRulesExist as T } from "../shared/textTrimCssRules.js";
7
7
  const s = {
8
8
  TEXT_TRIM_ENABLED: "textTrimEnabled"
9
9
  };
10
- class N extends u {
10
+ class N extends d {
11
11
  getId() {
12
- return d.NAME_TEXT_TRIM;
12
+ return u.NAME_TEXT_TRIM;
13
13
  }
14
14
  getTemplate() {
15
15
  return `
@@ -23,7 +23,7 @@ class N extends u {
23
23
  `;
24
24
  }
25
25
  onRender() {
26
- this._setFormValues(), this._listenToFormUpdates();
26
+ this.forgetLastPanelNode(), this._listenToFormUpdates();
27
27
  }
28
28
  onTemplateNodeUpdated(e) {
29
29
  super.onTemplateNodeUpdated(e), this._setFormValues();
@@ -4,8 +4,8 @@ import { CommonControl as l } from "../../../common-control.js";
4
4
  import { RecommendationBlockId as d } from "../../constants/blockIds.js";
5
5
  import { RecommendationControlId as T } from "../../constants/controlIds.js";
6
6
  import { BLOCK_ROOT_SELECTOR as f } from "../../constants/selectors.js";
7
- const i = "data-text-after", u = "", p = ".omnibus-text-after";
8
- class g extends l {
7
+ const s = "data-text-after", u = "", p = ".omnibus-text-after";
8
+ class N extends l {
9
9
  getId() {
10
10
  return T.OMNIBUS_DISCOUNT_TEXT_AFTER;
11
11
  }
@@ -24,7 +24,7 @@ class g extends l {
24
24
  `;
25
25
  }
26
26
  onRender() {
27
- this._setFormValues(), this._listenToFormUpdates();
27
+ this.forgetLastPanelNode(), this._listenToFormUpdates();
28
28
  }
29
29
  onTemplateNodeUpdated(t) {
30
30
  super.onTemplateNodeUpdated(t), this._setFormValues();
@@ -38,7 +38,7 @@ class g extends l {
38
38
  _getCurrentText() {
39
39
  if (!this.currentNode || !("getAttribute" in this.currentNode))
40
40
  return u;
41
- const t = this.currentNode.getAttribute(i);
41
+ const t = this.currentNode.getAttribute(s);
42
42
  return t === null ? u : t;
43
43
  }
44
44
  _onTextChange(t) {
@@ -53,9 +53,9 @@ class g extends l {
53
53
  if (!n.length)
54
54
  return;
55
55
  const o = this.api.getDocumentModifier();
56
- n.forEach((s) => {
57
- o.modifyHtml(s).setAttribute(i, t);
58
- const r = s.querySelector(p);
56
+ n.forEach((i) => {
57
+ o.modifyHtml(i).setAttribute(s, t);
58
+ const r = i.querySelector(p);
59
59
  if (r) {
60
60
  const a = m(r, t);
61
61
  o.modifyHtml(r).setInnerHtml(a);
@@ -69,5 +69,5 @@ class g extends l {
69
69
  }
70
70
  }
71
71
  export {
72
- g as OmnibusDiscountTextAfterControl
72
+ N as OmnibusDiscountTextAfterControl
73
73
  };