@useinsider/guido 3.20.1 → 3.21.0-beta.0df5409

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 (90) hide show
  1. package/dist/components/Guido.vue.js +1 -1
  2. package/dist/components/Guido.vue2.js +65 -64
  3. package/dist/components/organisms/AutoSaveController.vue2.js +10 -9
  4. package/dist/components/organisms/header/EditorActions.vue.js +4 -4
  5. package/dist/components/organisms/header/EditorActions.vue2.js +53 -51
  6. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
  7. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +23 -22
  8. package/dist/composables/useActionsApi.js +80 -63
  9. package/dist/composables/useAutoSave.js +46 -44
  10. package/dist/composables/useGuidoStateBridge.js +3 -3
  11. package/dist/composables/useLegacyStrategyConversion.js +16 -16
  12. package/dist/composables/useSave.js +26 -23
  13. package/dist/composables/useSaveValidation.js +113 -114
  14. package/dist/composables/useSaveValidationRollout.js +17 -6
  15. package/dist/composables/useStripo.js +11 -10
  16. package/dist/extensions/Blocks/Items/block.js +43 -42
  17. package/dist/extensions/Blocks/Recommendation/block.js +33 -29
  18. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +78 -83
  19. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +1 -2
  20. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +2 -12
  21. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +104 -86
  22. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +348 -263
  23. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +48 -50
  24. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +16 -21
  25. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +44 -40
  26. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +14 -19
  27. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +104 -102
  28. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +18 -23
  29. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +312 -286
  30. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +24 -20
  31. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +6 -7
  32. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +8 -8
  33. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +113 -151
  34. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +221 -203
  35. package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +28 -0
  36. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
  37. package/dist/extensions/Blocks/Recommendation/utils/currencySettings.js +25 -0
  38. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +111 -40
  39. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +31 -35
  40. package/dist/extensions/Blocks/Unsubscribe/block.js +70 -75
  41. package/dist/guido.css +1 -1
  42. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +271 -192
  43. package/dist/package.json.js +1 -1
  44. package/dist/services/settingsApi.js +11 -0
  45. package/dist/src/components/Guido.vue.d.ts +1 -1
  46. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  47. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  48. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  49. package/dist/src/composables/useActionsApi.d.ts +5 -1
  50. package/dist/src/composables/useAutoSave.d.ts +4 -1
  51. package/dist/src/composables/useSaveValidationRollout.d.ts +1 -0
  52. package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +1 -0
  53. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +8 -0
  54. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +40 -0
  55. package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +1 -0
  56. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
  57. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +1 -0
  58. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +11 -0
  59. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -6
  60. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +7 -0
  61. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +2 -0
  62. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +5 -5
  63. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +21 -12
  64. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +6 -3
  65. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +6 -5
  66. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -3
  67. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +21 -9
  68. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +19 -13
  69. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +7 -0
  70. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +7 -0
  71. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +7 -0
  72. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +7 -0
  73. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +7 -0
  74. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +10 -8
  75. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +9 -5
  76. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +7 -0
  77. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +9 -1
  78. package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +17 -0
  79. package/dist/src/extensions/Blocks/Recommendation/utils/currencySettings.d.ts +6 -0
  80. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +18 -11
  81. package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +1 -6
  82. package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +1 -0
  83. package/dist/src/extensions/Blocks/controlFactories.d.ts +22 -0
  84. package/dist/src/services/settingsApi.d.ts +6 -0
  85. package/dist/src/stores/editor.d.ts +3 -1
  86. package/dist/src/stores/setup-settings.d.ts +4 -0
  87. package/dist/static/styles/components/button.css.js +5 -0
  88. package/dist/stores/editor.js +5 -0
  89. package/dist/stores/setup-settings.js +10 -0
  90. package/package.json +4 -4
@@ -1,15 +1,14 @@
1
1
  var f = Object.defineProperty;
2
- var T = (a, n, t) => n in a ? f(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
3
- var l = (a, n, t) => T(a, typeof n != "symbol" ? n + "" : n, t);
4
- import { UEAttr as d, EditorStatePropertyType as b, PreviewDeviceMode as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as P } from "../../../common-control.js";
2
+ var T = (c, a, t) => a in c ? f(c, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[a] = t;
3
+ var h = (c, a, t) => T(c, typeof a != "symbol" ? a + "" : a, t);
4
+ import { UEAttr as _, EditorStatePropertyType as g, PreviewDeviceMode as y, ModificationDescription as O } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as N } from "../../../common-control.js";
6
6
  import "../../constants/selectors.js";
7
- import { MAX_PRODUCTS_PER_ROW as C, MAX_MOBILE_PRODUCTS_PER_ROW as D, DEFAULT_MOBILE_CARDS_IN_ROW as _ } from "../../constants/layout.js";
8
- import { RecommendationConfigService as s } from "../../services/configService.js";
9
- import { useRecommendationExtensionStore as M } from "../../store/recommendation.js";
10
- import { setMobileLayoutOptOut as m, ensureMobileCssRulesExist as L } from "../mobileLayout/cssRules.js";
11
- import { isPartnerManagedBlock as y, getCurrentLayout as w, getBlockElement as U, adjustProductsToSize as I, regenerateProductRowsWithStyles as g, regenerateMobileProductRows as E } from "./utils.js";
12
- import { useDebounceFn as A } from "../../../../../node_modules/@vueuse/shared/index.js";
7
+ import { MAX_PRODUCTS_PER_ROW as b, MAX_MOBILE_PRODUCTS_PER_ROW as M, DEFAULT_MOBILE_CARDS_IN_ROW as R } from "../../constants/layout.js";
8
+ import { RecommendationConfigService as r } from "../../services/configService.js";
9
+ import { useRecommendationExtensionStore as P } from "../../store/recommendation.js";
10
+ import { ensureMobileCssRulesExist as C, stageMobileLayoutOptOut as D } from "../mobileLayout/cssRules.js";
11
+ import { isPartnerManagedBlock as w, getCurrentLayout as U, adjustProductsToSize as L, regenerateProductRowsWithStyles as I, regenerateMobileProductRows as E, getBlockElement as A } from "./utils.js";
13
12
  const B = "recommendation-product-layout-control", e = {
14
13
  // "Products in One Row" — shown when toggle is OFF
15
14
  PRODUCT_IN_ROW: "cardsInRow",
@@ -24,16 +23,13 @@ const B = "recommendation-product-layout-control", e = {
24
23
  MOBILE_LAYOUT_TOGGLE: "mobileLayoutEnabled",
25
24
  MOBILE_LAYOUT_LABEL: "mobileLayoutLabel"
26
25
  };
27
- class F extends P {
26
+ class K extends N {
28
27
  constructor() {
29
28
  super(...arguments);
30
29
  // Store is used for backward compatibility with product fetching and regeneration
31
- l(this, "store", M());
32
- l(this, "storeUnsubscription", () => {
30
+ h(this, "store", P());
31
+ h(this, "storeUnsubscription", () => {
33
32
  });
34
- l(this, "_debouncedRegenerateProductRows", A(() => {
35
- this._regenerateProductRows();
36
- }, 500));
37
33
  }
38
34
  getId() {
39
35
  return B;
@@ -46,19 +42,19 @@ class F extends P {
46
42
  text: this.api.translate("Products in One Row"),
47
43
  name: e.PRODUCT_IN_ROW_LABEL
48
44
  }),
49
- this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: C }),
45
+ this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: b }),
50
46
  this._GuLabel({
51
47
  text: this.api.translate("Products in One Row on Desktop"),
52
48
  name: e.PRODUCT_IN_ROW_DESKTOP_LABEL
53
49
  }),
54
- this._GuCounter({ name: e.PRODUCT_IN_ROW_DESKTOP, maxValue: C }),
50
+ this._GuCounter({ name: e.PRODUCT_IN_ROW_DESKTOP, maxValue: b }),
55
51
  this._GuLabel({
56
52
  text: this.api.translate("Products in One Row on Mobile"),
57
53
  name: e.MOBILE_CARDS_IN_ROW_LABEL
58
54
  }),
59
55
  this._GuCounter({
60
56
  name: e.MOBILE_CARDS_IN_ROW,
61
- maxValue: D
57
+ maxValue: M
62
58
  }),
63
59
  this._GuLabel({
64
60
  text: this.api.translate("Mobile Layout Optimization"),
@@ -86,14 +82,14 @@ class F extends P {
86
82
  * these inputs there. Disabling coexists with the visibility logic above.
87
83
  */
88
84
  _syncDisabledState() {
89
- const t = y(this.currentNode);
90
- this.api.setUIEAttribute(e.PRODUCT_IN_ROW, d.COUNTER.disabled, t), this.api.setUIEAttribute(e.PRODUCT_IN_ROW_DESKTOP, d.COUNTER.disabled, t), this.api.setUIEAttribute(e.MOBILE_CARDS_IN_ROW, d.COUNTER.disabled, t), this.api.setUIEAttribute(e.MOBILE_LAYOUT_TOGGLE, d.SWITCHER.disabled, t);
85
+ const t = w(this.currentNode);
86
+ this.api.setUIEAttribute(e.PRODUCT_IN_ROW, _.COUNTER.disabled, t), this.api.setUIEAttribute(e.PRODUCT_IN_ROW_DESKTOP, _.COUNTER.disabled, t), this.api.setUIEAttribute(e.MOBILE_CARDS_IN_ROW, _.COUNTER.disabled, t), this.api.setUIEAttribute(e.MOBILE_LAYOUT_TOGGLE, _.SWITCHER.disabled, t);
91
87
  }
92
88
  onDestroy() {
93
89
  this.storeUnsubscription();
94
90
  }
95
91
  _setFormValues() {
96
- const t = s.getConfig(this.currentNode);
92
+ const t = r.getConfig(this.currentNode);
97
93
  this.api.updateValues({
98
94
  [e.PRODUCT_IN_ROW]: t.cardsInRow,
99
95
  [e.PRODUCT_IN_ROW_DESKTOP]: t.cardsInRow,
@@ -105,7 +101,7 @@ class F extends P {
105
101
  * Returns true when the editor preview is in mobile mode.
106
102
  */
107
103
  _isMobilePreview() {
108
- return this.api.getEditorState()[b.previewDeviceMode] === N.MOBILE;
104
+ return this.api.getEditorState()[g.previewDeviceMode] === y.MOBILE;
109
105
  }
110
106
  /**
111
107
  * Updates counter visibility based on layout, mobileLayoutEnabled, and editor preview mode.
@@ -120,22 +116,22 @@ class F extends P {
120
116
  */
121
117
  _updateProductsInRowVisibility() {
122
118
  var p;
123
- const t = s.getConfig(this.currentNode), i = (t.layout || w(this.currentNode)) === "grid", { mobileLayoutEnabled: r } = t, u = this._isMobilePreview();
119
+ const t = r.getConfig(this.currentNode), i = (t.layout || U(this.currentNode)) === "grid", { mobileLayoutEnabled: o } = t, n = this._isMobilePreview();
124
120
  this.api.setVisibility(e.MOBILE_LAYOUT_TOGGLE, i), this.api.setVisibility(e.MOBILE_LAYOUT_LABEL, i);
125
- const c = i && !r, h = i && r && !u, R = i && r && u;
126
- this.api.setVisibility(e.PRODUCT_IN_ROW, c), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, c), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP, h), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP_LABEL, h), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, R), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, R);
127
- const O = (p = this.getContainer()) == null ? void 0 : p.querySelector("[data-product-layout-control]");
128
- O && (O.style.display = i ? "" : "none");
121
+ const d = i && !o, l = i && o && !n, u = i && o && n;
122
+ this.api.setVisibility(e.PRODUCT_IN_ROW, d), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, d), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP, l), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP_LABEL, l), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, u), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, u);
123
+ const m = (p = this.getContainer()) == null ? void 0 : p.querySelector("[data-product-layout-control]");
124
+ m && (m.style.display = i ? "" : "none");
129
125
  }
130
126
  /**
131
127
  * Initializes the mobile layout toggle using the same pattern as shuffle.ts.
132
128
  * Sets the initial UI attribute value from the node config.
133
129
  */
134
130
  _initializeMobileLayoutToggle() {
135
- const t = s.getConfig(this.currentNode);
131
+ const t = r.getConfig(this.currentNode);
136
132
  this.api.setUIEAttribute(
137
133
  e.MOBILE_LAYOUT_TOGGLE,
138
- d.SELECTPICKER.items,
134
+ _.SELECTPICKER.items,
139
135
  t.mobileLayoutEnabled
140
136
  );
141
137
  }
@@ -147,85 +143,91 @@ class F extends P {
147
143
  _onMobileLayoutToggleChange(t) {
148
144
  if (!this.currentNode)
149
145
  return;
150
- const o = s.getConfig(this.currentNode);
151
- if (o.mobileLayoutEnabled === t)
152
- return;
153
- const i = U(this.currentNode);
154
- if (t) {
155
- const r = o.previousMobileCardsInRow || _;
156
- s.updateConfig(
157
- this.api,
158
- this.currentNode,
159
- {
160
- mobileLayoutEnabled: !0,
161
- mobileCardsInRow: r
162
- },
163
- "Enabled mobile layout optimization"
164
- ), this.store.patchCurrentBlockConfig(
165
- {
166
- mobileLayoutEnabled: !0,
167
- mobileCardsInRow: r
168
- },
169
- { triggerRefetch: !1 }
170
- ), i && m(this.api, i, !1), L(this.api);
171
- const u = parseInt(o.size) || 6, c = I(this.store.recommendationProducts, u);
172
- g({
173
- currentNode: this.currentNode,
174
- documentModifier: this.api.getDocumentModifier(),
175
- products: c
176
- });
177
- } else {
178
- const r = o.mobileCardsInRow;
179
- s.updateConfig(
180
- this.api,
181
- this.currentNode,
182
- {
183
- mobileLayoutEnabled: !1,
184
- previousMobileCardsInRow: r,
185
- mobileCardsInRow: _
186
- },
187
- "Disabled mobile layout optimization"
188
- ), this.store.patchCurrentBlockConfig(
189
- {
146
+ const s = r.getConfig(this.currentNode);
147
+ if (s.mobileLayoutEnabled !== t) {
148
+ if (t) {
149
+ const o = { mobileLayoutEnabled: !0, mobileCardsInRow: s.previousMobileCardsInRow || R }, n = parseInt(s.size) || 6, d = L(this.store.recommendationProducts, n);
150
+ this._commitMobileLayoutToggle(
151
+ o,
152
+ !1,
153
+ "Enabled mobile layout optimization",
154
+ (u) => {
155
+ C(this.api, u), I({
156
+ currentNode: this.currentNode,
157
+ documentModifier: u,
158
+ products: d,
159
+ configOverrides: o,
160
+ stageOnly: !0
161
+ });
162
+ }
163
+ ) && this.store.patchCurrentBlockConfig(o, { triggerRefetch: !1 });
164
+ } else {
165
+ const i = {
190
166
  mobileLayoutEnabled: !1,
191
- mobileCardsInRow: _
192
- },
193
- { triggerRefetch: !1 }
194
- ), i && m(this.api, i, !0), E({
195
- currentNode: this.currentNode,
196
- documentModifier: this.api.getDocumentModifier()
197
- });
167
+ // Snapshot current mobile cards value before resetting
168
+ previousMobileCardsInRow: s.mobileCardsInRow,
169
+ mobileCardsInRow: R
170
+ };
171
+ this._commitMobileLayoutToggle(
172
+ i,
173
+ !0,
174
+ "Disabled mobile layout optimization",
175
+ (n) => {
176
+ E({
177
+ currentNode: this.currentNode,
178
+ documentModifier: n,
179
+ configOverrides: i,
180
+ stageOnly: !0
181
+ });
182
+ }
183
+ ) && this.store.patchCurrentBlockConfig(
184
+ { mobileLayoutEnabled: !1, mobileCardsInRow: R },
185
+ { triggerRefetch: !1 }
186
+ );
187
+ }
188
+ this._setFormValues(), this._updateProductsInRowVisibility();
189
+ }
190
+ }
191
+ // One apply: a config/class mismatch between two applies makes the block's self-heal write its own entry.
192
+ // Reports false when nothing reached the node, so the caller keeps the store aligned with it.
193
+ _commitMobileLayoutToggle(t, s, i, o) {
194
+ if (!this.currentNode)
195
+ return !1;
196
+ const n = this.api.getDocumentModifier(), d = A(this.currentNode);
197
+ try {
198
+ return r.stageConfig(n, this.currentNode, t), d && D(n, d, s), o(n), n.apply(new O(i)), !0;
199
+ } catch (l) {
200
+ return console.warn("[recommendation] mobile layout toggle write failed", l), !1;
198
201
  }
199
- this._setFormValues(), this._updateProductsInRowVisibility();
200
202
  }
201
203
  _onProductsInRowChange(t) {
202
- !this.currentNode || s.getConfig(this.currentNode).cardsInRow === t || (s.updateConfig(
203
- this.api,
204
- this.currentNode,
205
- { cardsInRow: t },
206
- `Changed products per row to ${t}`
207
- ), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._debouncedRegenerateProductRows());
204
+ if (!this.currentNode || r.getConfig(this.currentNode).cardsInRow === t)
205
+ return;
206
+ const i = { cardsInRow: t }, o = this.api.getDocumentModifier();
207
+ r.stageConfig(o, this.currentNode, i), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._regenerateProductRows(o, i), o.apply(new O(`Changed products per row to ${t}`));
208
208
  }
209
209
  _onMobileCardsInRowChange(t) {
210
- !this.currentNode || s.getConfig(this.currentNode).mobileCardsInRow === t || (s.updateConfig(
211
- this.api,
212
- this.currentNode,
213
- { mobileCardsInRow: t },
214
- `Changed mobile products per row to ${t}`
215
- ), L(this.api), this.store.patchCurrentBlockConfig(
210
+ if (!this.currentNode || r.getConfig(this.currentNode).mobileCardsInRow === t)
211
+ return;
212
+ const i = { mobileCardsInRow: t }, o = this.api.getDocumentModifier();
213
+ r.stageConfig(o, this.currentNode, i), C(this.api, o), this.store.patchCurrentBlockConfig(
216
214
  { mobileCardsInRow: t },
217
215
  { triggerRefetch: !1 }
218
216
  ), E({
219
217
  currentNode: this.currentNode,
220
- documentModifier: this.api.getDocumentModifier()
221
- }));
218
+ documentModifier: o,
219
+ configOverrides: i,
220
+ stageOnly: !0
221
+ }), o.apply(new O(`Changed mobile products per row to ${t}`));
222
222
  }
223
- _regenerateProductRows() {
224
- const t = s.getConfig(this.currentNode), o = parseInt(t.size) || 6, i = I(this.store.recommendationProducts, o);
225
- g({
223
+ _regenerateProductRows(t, s) {
224
+ const i = r.getConfig(this.currentNode), o = parseInt(i.size) || 6, n = L(this.store.recommendationProducts, o);
225
+ I({
226
226
  currentNode: this.currentNode,
227
- documentModifier: this.api.getDocumentModifier(),
228
- products: i
227
+ documentModifier: t,
228
+ products: n,
229
+ configOverrides: s,
230
+ stageOnly: !0
229
231
  });
230
232
  }
231
233
  _listenToFormUpdates() {
@@ -246,8 +248,8 @@ class F extends P {
246
248
  _listenStateUpdates() {
247
249
  let t = this.store.recommendationConfigs.orientation;
248
250
  this.storeUnsubscription = this.store.$subscribe(() => {
249
- const o = this.store.recommendationConfigs.orientation;
250
- o !== t && (t = o, this._updateProductsInRowVisibility());
251
+ const s = this.store.recommendationConfigs.orientation;
252
+ s !== t && (t = s, this._updateProductsInRowVisibility());
251
253
  });
252
254
  }
253
255
  /**
@@ -257,14 +259,14 @@ class F extends P {
257
259
  */
258
260
  _listenEditorModeChanges() {
259
261
  this.api.onEditorStatePropUpdated(
260
- b.previewDeviceMode,
262
+ g.previewDeviceMode,
261
263
  () => {
262
- s.getConfig(this.currentNode).mobileLayoutEnabled && this._updateProductsInRowVisibility();
264
+ r.getConfig(this.currentNode).mobileLayoutEnabled && this._updateProductsInRowVisibility();
263
265
  }
264
266
  );
265
267
  }
266
268
  }
267
269
  export {
268
270
  B as PRODUCT_LAYOUT_CONTROL_ID,
269
- F as ProductLayoutControl
271
+ K as ProductLayoutControl
270
272
  };
@@ -1,28 +1,28 @@
1
1
  var r = Object.defineProperty;
2
- var f = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
- var n = (o, t, e) => f(o, typeof t != "symbol" ? t + "" : t, e);
2
+ var l = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var i = (o, t, e) => l(o, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { UEAttr as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as l } from "../../../common-control.js";
6
- import { RecommendationConfigService as s } from "../../services/configService.js";
7
- import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
8
- const h = "recommendation-shuffle-control", i = {
5
+ import { CommonControl as f } from "../../../common-control.js";
6
+ import { RecommendationConfigService as n } from "../../services/configService.js";
7
+ import { useRecommendationExtensionStore as a } from "../../store/recommendation.js";
8
+ const d = "recommendation-shuffle-control", s = {
9
9
  SHUFFLE_PRODUCTS: "shuffleProducts"
10
10
  };
11
- class S extends l {
11
+ class p extends f {
12
12
  constructor() {
13
13
  super(...arguments);
14
14
  // Store is used for backward compatibility with product fetching
15
- n(this, "store", d());
15
+ i(this, "store", a());
16
16
  }
17
17
  getId() {
18
- return h;
18
+ return d;
19
19
  }
20
20
  getTemplate() {
21
21
  return `
22
22
  <div class="shuffle-control-container" style="border-bottom: 1px solid #e0e0e0;">
23
23
  ${this._GuTwoColumns([
24
24
  this._GuLabel({ text: this.api.translate("Shuffle Recommended Products") }),
25
- this._GuToggle(i.SHUFFLE_PRODUCTS)
25
+ this._GuToggle(s.SHUFFLE_PRODUCTS)
26
26
  ])}
27
27
  </div>
28
28
  `;
@@ -34,34 +34,29 @@ class S extends l {
34
34
  super.onTemplateNodeUpdated(e), this._setFormValues();
35
35
  }
36
36
  _setFormValues() {
37
- const e = s.getConfig(this.currentNode);
37
+ const e = n.getConfig(this.currentNode);
38
38
  this.api.updateValues({
39
- [i.SHUFFLE_PRODUCTS]: e.shuffleProducts
39
+ [s.SHUFFLE_PRODUCTS]: e.shuffleProducts
40
40
  });
41
41
  }
42
42
  _initializeToggle() {
43
- const e = s.getConfig(this.currentNode);
43
+ const e = n.getConfig(this.currentNode);
44
44
  this.api.setUIEAttribute(
45
- i.SHUFFLE_PRODUCTS,
45
+ s.SHUFFLE_PRODUCTS,
46
46
  u.SELECTPICKER.items,
47
47
  e.shuffleProducts
48
48
  );
49
49
  }
50
50
  _onShuffleChange(e) {
51
- !this.currentNode || s.getConfig(this.currentNode).shuffleProducts === e || (s.updateConfig(
52
- this.api,
53
- this.currentNode,
54
- { shuffleProducts: e },
55
- `${e ? "Enabled" : "Disabled"} product shuffle`
56
- ), this.store.patchCurrentBlockConfig({ shuffleProducts: e }));
51
+ this.currentNode && this.store.recommendationConfigs.shuffleProducts !== e && this.store.patchCurrentBlockConfig({ shuffleProducts: e });
57
52
  }
58
53
  _listenToFormUpdates() {
59
- this.api.onValueChanged(i.SHUFFLE_PRODUCTS, (e) => {
54
+ this.api.onValueChanged(s.SHUFFLE_PRODUCTS, (e) => {
60
55
  this._onShuffleChange(!!e);
61
56
  });
62
57
  }
63
58
  }
64
59
  export {
65
- h as SHUFFLE_CONTROL_ID,
66
- S as ShuffleControl
60
+ d as SHUFFLE_CONTROL_ID,
61
+ p as ShuffleControl
67
62
  };