@useinsider/guido 3.0.0 → 3.1.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 (101) hide show
  1. package/dist/components/organisms/header/EditorActions.vue.js +10 -8
  2. package/dist/components/organisms/header/EditorActions.vue2.js +41 -31
  3. package/dist/components/organisms/header/MigrationConfirmModal.vue.js +17 -0
  4. package/dist/components/organisms/header/MigrationConfirmModal.vue2.js +39 -0
  5. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
  6. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +1 -1
  7. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +1 -1
  8. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +2 -2
  9. package/dist/config/compiler/unsubscribeCompilerRules.js +14 -14
  10. package/dist/config/compiler/utils/recommendationCompilerUtils.js +29 -18
  11. package/dist/config/i18n/en/labels.json.js +8 -3
  12. package/dist/config/migrator/itemsBlockMigrator.js +135 -131
  13. package/dist/config/migrator/recommendationMigrator.js +58 -54
  14. package/dist/enums/block.js +4 -0
  15. package/dist/extensions/Blocks/Items/block.js +30 -21
  16. package/dist/extensions/Blocks/Items/iconsRegistry.js +7 -6
  17. package/dist/extensions/Blocks/Items/items.css.js +48 -0
  18. package/dist/extensions/Blocks/Recommendation/block.js +64 -34
  19. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  20. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  21. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -34
  22. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -12
  23. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +4 -4
  24. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +693 -144
  25. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +78 -0
  26. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +15 -15
  27. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +24 -24
  28. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +2 -2
  29. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +107 -78
  30. package/dist/extensions/Blocks/Recommendation/controls/{layout/index.js → main/layoutOrientation.js} +34 -23
  31. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +2 -2
  32. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +58 -0
  33. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +150 -64
  34. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +2 -2
  35. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +202 -200
  36. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +25 -8
  37. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +6 -5
  38. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
  39. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +21 -21
  40. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +13 -13
  41. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +17 -17
  42. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +94 -100
  43. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +65 -0
  44. package/dist/extensions/Blocks/Recommendation/extension.js +20 -18
  45. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +5 -4
  46. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +209 -2
  47. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +135 -111
  48. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +9 -7
  49. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +63 -34
  50. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +25 -28
  51. package/dist/extensions/Blocks/Recommendation/templates/index.js +8 -8
  52. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +28 -13
  53. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +25 -44
  54. package/dist/extensions/Blocks/Recommendation/templates/utils.js +62 -38
  55. package/dist/extensions/Blocks/common-control.js +96 -39
  56. package/dist/guido.css +1 -1
  57. package/dist/src/@types/extensions/block.d.ts +2 -0
  58. package/dist/src/App.vue.d.ts +3 -1
  59. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  60. package/dist/src/components/organisms/header/MigrationConfirmModal.vue.d.ts +6 -0
  61. package/dist/src/components/wrappers/WpModal.vue.d.ts +2 -2
  62. package/dist/src/enums/block.d.ts +4 -0
  63. package/dist/src/extensions/Blocks/Items/block.d.ts +3 -1
  64. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +4 -1
  65. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
  66. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +9 -1
  67. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  68. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +10 -0
  69. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +134 -44
  70. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +105 -0
  71. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +3 -2
  72. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +5 -1
  73. package/dist/src/extensions/Blocks/Recommendation/controls/{layout/index.d.ts → main/layoutOrientation.d.ts} +3 -3
  74. package/dist/src/extensions/Blocks/Recommendation/controls/main/productCount.d.ts +28 -0
  75. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +38 -20
  76. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +6 -2
  77. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +23 -1
  78. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +8 -18
  79. package/dist/src/extensions/Blocks/Recommendation/controls/syncInfoMessage.d.ts +34 -0
  80. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
  81. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +1 -1
  82. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +1 -1
  83. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +10 -4
  84. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +37 -2
  85. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +13 -0
  86. package/dist/src/extensions/Blocks/common-control.d.ts +29 -2
  87. package/dist/src/stores/template.d.ts +29 -0
  88. package/dist/src/utils/migrationBannerHtml.d.ts +2 -0
  89. package/dist/static/assets/info.svg.js +5 -0
  90. package/dist/static/styles/components/wide-panel.css.js +1 -0
  91. package/dist/static/styles/customEditorStyle.css.js +9 -0
  92. package/dist/static/styles/variables.css.js +3 -0
  93. package/dist/stores/template.js +15 -0
  94. package/dist/utils/migrationBannerHtml.js +21 -0
  95. package/package.json +3 -2
  96. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.d.ts +0 -25
  97. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.d.ts +0 -15
  98. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.d.ts +0 -15
  99. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.d.ts +0 -15
  100. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.d.ts +0 -15
  101. package/dist/src/extensions/Blocks/Recommendation/controls/spacingControl.d.ts +0 -60
@@ -1,16 +1,16 @@
1
1
  var G = Object.defineProperty;
2
- var R = (p, c, t) => c in p ? G(p, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[c] = t;
3
- var h = (p, c, t) => R(p, typeof c != "symbol" ? c + "" : c, t);
4
- import { EditorStatePropertyType as y, PreviewDeviceMode as w, ModificationDescription as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { CommonControl as V } from "../../../common-control.js";
6
- import { DESKTOP_CONTAINER_SELECTOR as m, MOBILE_CONTAINER_SELECTOR as E } from "../../constants/selectors.js";
7
- import { SPACING_STEP as S, MAX_SPACING as _, MIN_SPACING as N, DEFAULT_COLUMN_SPACING as C, DEFAULT_ROW_SPACING as P } from "../../constants/layout.js";
8
- import { RecommendationConfigService as d } from "../../services/configService.js";
9
- import { useRecommendationExtensionStore as B } from "../../store/recommendation.js";
10
- import { safeGetStyle as A, safeGetParent as U } from "../../utils/tagName.js";
11
- import { getCurrentLayout as b, getBlockElement as x } from "../main/utils.js";
2
+ var P = (u, c, t) => c in u ? G(u, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[c] = t;
3
+ var h = (u, c, t) => P(u, typeof c != "symbol" ? c + "" : c, t);
4
+ import { ModificationDescription as g } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as R } from "../../../common-control.js";
6
+ import { DESKTOP_CONTAINER_SELECTOR as m, MOBILE_CONTAINER_SELECTOR as M } from "../../constants/selectors.js";
7
+ import { SPACING_STEP as S, MAX_SPACING as _, MIN_SPACING as N, DEFAULT_COLUMN_SPACING as C, DEFAULT_ROW_SPACING as E } from "../../constants/layout.js";
8
+ import { RecommendationConfigService as p } from "../../services/configService.js";
9
+ import { useRecommendationExtensionStore as V } from "../../store/recommendation.js";
10
+ import { safeGetStyle as A, safeGetParent as w } from "../../utils/tagName.js";
11
+ import { getCurrentLayout as b, getBlockElement as B } from "../main/utils.js";
12
12
  import { useDebounceFn as f } from "../../../../../node_modules/@vueuse/shared/index.js";
13
- const W = "recommendation-spacing-control", i = {
13
+ const U = "recommendation-spacing-control", n = {
14
14
  COLUMN_SPACING: "columnSpacing",
15
15
  COLUMN_SPACING_LABEL: "columnSpacingLabel",
16
16
  ROW_SPACING: "rowSpacing",
@@ -25,16 +25,16 @@ const W = "recommendation-spacing-control", i = {
25
25
  MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
26
26
  MOBILE_ROW_SPACING: "data-mobile-row-spacing"
27
27
  };
28
- function L(p, c) {
29
- if (!p)
28
+ function L(u, c) {
29
+ if (!u)
30
30
  return c;
31
- const t = parseFloat(p);
31
+ const t = parseFloat(u);
32
32
  return Number.isNaN(t) ? c : t;
33
33
  }
34
- class X extends V {
34
+ class j extends R {
35
35
  constructor() {
36
36
  super(...arguments);
37
- h(this, "store", B());
37
+ h(this, "store", V());
38
38
  h(this, "unsubscribeOrientation", null);
39
39
  /**
40
40
  * Debounced version of _onColumnSpacingChange
@@ -63,39 +63,48 @@ class X extends V {
63
63
  }, 300));
64
64
  }
65
65
  getId() {
66
- return W;
66
+ return U;
67
67
  }
68
68
  getTemplate() {
69
69
  return `
70
70
  <div class="spacing-control-container">
71
71
  ${this._GuTwoColumns([
72
- this._GuLabel({ text: "Column Spacing on Desktop (px)", name: i.COLUMN_SPACING_LABEL }),
72
+ this._GuLabel({
73
+ text: this.api.translate("Column Spacing (px)"),
74
+ name: n.COLUMN_SPACING_LABEL
75
+ }),
73
76
  this._GuCounter({
74
- name: i.COLUMN_SPACING,
77
+ name: n.COLUMN_SPACING,
75
78
  minValue: N,
76
79
  maxValue: _,
77
80
  step: S
78
81
  }),
79
- this._GuLabel({ text: "Row Spacing on Desktop (px)", name: i.ROW_SPACING_LABEL }),
82
+ this._GuLabel({
83
+ text: this.api.translate("Row Spacing (px)"),
84
+ name: n.ROW_SPACING_LABEL
85
+ }),
80
86
  this._GuCounter({
81
- name: i.ROW_SPACING,
87
+ name: n.ROW_SPACING,
82
88
  minValue: N,
83
89
  maxValue: _,
84
90
  step: S
85
91
  }),
86
92
  this._GuLabel({
87
- text: "Column Spacing on Mobile (px)",
88
- name: i.MOBILE_COLUMN_SPACING_LABEL
93
+ text: this.api.translate("Column Spacing on Mobile (px)"),
94
+ name: n.MOBILE_COLUMN_SPACING_LABEL
89
95
  }),
90
96
  this._GuCounter({
91
- name: i.MOBILE_COLUMN_SPACING,
97
+ name: n.MOBILE_COLUMN_SPACING,
92
98
  minValue: N,
93
99
  maxValue: _,
94
100
  step: S
95
101
  }),
96
- this._GuLabel({ text: "Row Spacing on Mobile (px)", name: i.MOBILE_ROW_SPACING_LABEL }),
102
+ this._GuLabel({
103
+ text: this.api.translate("Row Spacing on Mobile (px)"),
104
+ name: n.MOBILE_ROW_SPACING_LABEL
105
+ }),
97
106
  this._GuCounter({
98
- name: i.MOBILE_ROW_SPACING,
107
+ name: n.MOBILE_ROW_SPACING,
99
108
  minValue: N,
100
109
  maxValue: _,
101
110
  step: S
@@ -105,7 +114,7 @@ class X extends V {
105
114
  `;
106
115
  }
107
116
  onRender() {
108
- this._setFormValues(), this._updateSpacingVisibility(), this._listenToFormUpdates(), this._subscribeToOrientationChanges(), this._subscribeToEditorModeChanges();
117
+ this._setFormValues(), this._updateSpacingVisibility(), this._listenToFormUpdates(), this._subscribeToOrientationChanges();
109
118
  }
110
119
  onTemplateNodeUpdated(t) {
111
120
  super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateSpacingVisibility();
@@ -114,26 +123,23 @@ class X extends V {
114
123
  this.unsubscribeOrientation && (this.unsubscribeOrientation(), this.unsubscribeOrientation = null);
115
124
  }
116
125
  /**
117
- * Checks if the editor is currently in mobile preview mode
118
- * using Stripo's EditorStatePropertyType API.
119
- */
120
- _isMobileMode() {
121
- return this.api.getEditorState()[y.previewDeviceMode] === w.MOBILE;
122
- }
123
- /**
124
- * Updates spacing control visibility based on layout orientation, editor mode,
125
- * and products-per-row count.
126
+ * Updates spacing control visibility based on layout orientation and mobileLayoutEnabled.
126
127
  * - List layout: hide column spacing (products are full-width), hide ALL mobile
127
128
  * spacing controls (list is responsive — single row spacing applies to both views)
128
- * - Desktop mode: show desktop spacing, hide mobile spacing
129
- * - Mobile mode: show mobile spacing, hide desktop spacing
130
- * - 1 product per row: hide column spacing (no gap between single column)
129
+ * - Desktop controls: always visible for grid layout (column spacing needs 2+ per row)
130
+ * - Mobile controls: visible when mobileLayoutEnabled is true (grid only)
131
131
  */
132
132
  _updateSpacingVisibility() {
133
133
  if (!this.api)
134
134
  return;
135
- const t = d.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, n = t.layout || e || b(this.currentNode), o = n === "grid", a = n === "list", r = this._isMobileMode(), l = t.cardsInRow > 1, u = t.mobileCardsInRow > 1;
136
- this.api.setVisibility(i.COLUMN_SPACING, o && !r && l), this.api.setVisibility(i.COLUMN_SPACING_LABEL, o && !r && l), this.api.setVisibility(i.ROW_SPACING, a || !r), this.api.setVisibility(i.ROW_SPACING_LABEL, a || !r), this.api.setVisibility(i.MOBILE_COLUMN_SPACING, o && r && u), this.api.setVisibility(i.MOBILE_COLUMN_SPACING_LABEL, o && r && u), this.api.setVisibility(i.MOBILE_ROW_SPACING, !a && r), this.api.setVisibility(i.MOBILE_ROW_SPACING_LABEL, !a && r);
135
+ const t = p.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, i = (t.layout || e || b(this.currentNode)) === "grid", { mobileLayoutEnabled: a } = t, r = t.cardsInRow > 1, l = t.mobileCardsInRow > 1;
136
+ this.api.setVisibility(n.COLUMN_SPACING, i && r), this.api.setVisibility(n.COLUMN_SPACING_LABEL, i && r), this.api.setVisibility(n.ROW_SPACING, !0), this.api.setVisibility(n.ROW_SPACING_LABEL, !0), this.api.setVisibility(
137
+ n.MOBILE_COLUMN_SPACING,
138
+ i && a && l
139
+ ), this.api.setVisibility(
140
+ n.MOBILE_COLUMN_SPACING_LABEL,
141
+ i && a && l
142
+ ), this.api.setVisibility(n.MOBILE_ROW_SPACING, i && a), this.api.setVisibility(n.MOBILE_ROW_SPACING_LABEL, i && a);
137
143
  }
138
144
  /**
139
145
  * Reads spacing values from node config first, falls back to DOM styles.
@@ -142,12 +148,12 @@ class X extends V {
142
148
  _setFormValues() {
143
149
  if (!this.api)
144
150
  return;
145
- const t = d.hasConfig(this.currentNode), e = d.getConfig(this.currentNode), n = t ? e.columnSpacing : this._getStoredColumnSpacing(), o = t ? e.rowSpacing : this._getStoredRowSpacing();
151
+ const t = p.hasConfig(this.currentNode), e = p.getConfig(this.currentNode), o = t ? e.columnSpacing : this._getStoredColumnSpacing(), i = t ? e.rowSpacing : this._getStoredRowSpacing();
146
152
  this.api.updateValues({
147
- [i.COLUMN_SPACING]: n,
148
- [i.ROW_SPACING]: o,
149
- [i.MOBILE_COLUMN_SPACING]: e.mobileColumnSpacing,
150
- [i.MOBILE_ROW_SPACING]: e.mobileRowSpacing
153
+ [n.COLUMN_SPACING]: o,
154
+ [n.ROW_SPACING]: i,
155
+ [n.MOBILE_COLUMN_SPACING]: e.mobileColumnSpacing,
156
+ [n.MOBILE_ROW_SPACING]: e.mobileRowSpacing
151
157
  });
152
158
  }
153
159
  /**
@@ -162,13 +168,13 @@ class X extends V {
162
168
  return C;
163
169
  const t = this.currentNode.querySelector(m) ?? this.currentNode;
164
170
  if (b(this.currentNode) === "grid") {
165
- const u = t.querySelector(".recommendation-attribute-row"), s = u == null ? void 0 : u.querySelector("td"), I = A(s, "padding");
171
+ const d = t.querySelector(".recommendation-attribute-row"), s = d == null ? void 0 : d.querySelector("td"), I = A(s, "padding");
166
172
  if (!I)
167
173
  return C;
168
- const M = I.trim().split(/\s+/);
169
- return M.length < 2 ? C : L(M[1], C / 2) * 2;
174
+ const y = I.trim().split(/\s+/);
175
+ return y.length < 2 ? C : L(y[1], C / 2) * 2;
170
176
  }
171
- const n = t.querySelector(".product-card-wrapper"), o = U(n), a = A(o, "padding");
177
+ const o = t.querySelector(".product-card-wrapper"), i = w(o), a = A(i, "padding");
172
178
  if (!a)
173
179
  return C;
174
180
  const r = a.trim().split(/\s+/);
@@ -180,9 +186,9 @@ class X extends V {
180
186
  */
181
187
  _getStoredRowSpacing() {
182
188
  if (!this.currentNode)
183
- return P;
184
- const e = (this.currentNode.querySelector(m) ?? this.currentNode).querySelector(".spacer"), n = A(e, "height");
185
- return L(n, P);
189
+ return E;
190
+ const e = (this.currentNode.querySelector(m) ?? this.currentNode).querySelector(".spacer"), o = A(e, "height");
191
+ return L(o, E);
186
192
  }
187
193
  // ========================================================================
188
194
  // Desktop Spacing Handlers
@@ -194,22 +200,22 @@ class X extends V {
194
200
  _onColumnSpacingChange(t) {
195
201
  if (!this.currentNode)
196
202
  return;
197
- d.updateConfig(
203
+ p.updateConfig(
198
204
  this.api,
199
205
  this.currentNode,
200
206
  { columnSpacing: t },
201
207
  `Changed column spacing to ${t}px`
202
208
  ), this._storeDataAttribute(O.COLUMN_SPACING, t);
203
- const n = d.getConfig(this.currentNode).layout || b(this.currentNode), o = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, l = this.currentNode.querySelector(m);
204
- l && (n === "grid" ? Array.from(
209
+ const o = p.getConfig(this.currentNode).layout || b(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, l = this.currentNode.querySelector(m);
210
+ l && (o === "grid" ? Array.from(
205
211
  l.querySelectorAll(".attribute-cell")
206
212
  ).forEach((s) => {
207
- o.modifyHtml(s).setStyle("padding", r);
213
+ i.modifyHtml(s).setStyle("padding", r);
208
214
  }) : Array.from(
209
215
  l.querySelectorAll(".product-card-wrapper")
210
216
  ).forEach((s) => {
211
- "parent" in s && s.parent() && o.modifyHtml(s.parent()).setStyle("padding", r);
212
- }), o.apply(new g(`Update column spacing to ${t}px`)));
217
+ "parent" in s && s.parent() && i.modifyHtml(s.parent()).setStyle("padding", r);
218
+ }), i.apply(new g(`Update column spacing to ${t}px`)));
213
219
  }
214
220
  /**
215
221
  * Handles row spacing changes for desktop.
@@ -218,7 +224,7 @@ class X extends V {
218
224
  _onRowSpacingChange(t) {
219
225
  if (!this.currentNode)
220
226
  return;
221
- d.updateConfig(
227
+ p.updateConfig(
222
228
  this.api,
223
229
  this.currentNode,
224
230
  { rowSpacing: t },
@@ -227,15 +233,15 @@ class X extends V {
227
233
  const e = this.currentNode.querySelector(m);
228
234
  if (!e)
229
235
  return;
230
- const n = Array.from(
236
+ const o = Array.from(
231
237
  e.querySelectorAll(".spacer")
232
238
  );
233
- if (!n.length)
239
+ if (!o.length)
234
240
  return;
235
- const o = this.api.getDocumentModifier(), a = `${t}px`;
236
- n.forEach((r) => {
237
- o.modifyHtml(r).setStyle("height", a);
238
- }), o.apply(new g(`Update row spacing to ${t}px`));
241
+ const i = this.api.getDocumentModifier(), a = `${t}px`;
242
+ o.forEach((r) => {
243
+ i.modifyHtml(r).setStyle("height", a);
244
+ }), i.apply(new g(`Update row spacing to ${t}px`));
239
245
  }
240
246
  // ========================================================================
241
247
  // Mobile Spacing Handlers
@@ -247,22 +253,22 @@ class X extends V {
247
253
  _onMobileColumnSpacingChange(t) {
248
254
  if (!this.currentNode)
249
255
  return;
250
- d.updateConfig(
256
+ p.updateConfig(
251
257
  this.api,
252
258
  this.currentNode,
253
259
  { mobileColumnSpacing: t },
254
260
  `Changed mobile column spacing to ${t}px`
255
261
  ), this._storeDataAttribute(O.MOBILE_COLUMN_SPACING, t);
256
- const n = d.getConfig(this.currentNode).layout || b(this.currentNode), o = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, l = this.currentNode.querySelector(E);
257
- l && (n === "grid" ? Array.from(
262
+ const o = p.getConfig(this.currentNode).layout || b(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, l = this.currentNode.querySelector(M);
263
+ l && (o === "grid" ? Array.from(
258
264
  l.querySelectorAll(".attribute-cell")
259
265
  ).forEach((s) => {
260
- o.modifyHtml(s).setStyle("padding", r);
266
+ i.modifyHtml(s).setStyle("padding", r);
261
267
  }) : Array.from(
262
268
  l.querySelectorAll(".product-card-wrapper")
263
269
  ).forEach((s) => {
264
- "parent" in s && s.parent() && o.modifyHtml(s.parent()).setStyle("padding", r);
265
- }), o.apply(new g(`Update mobile column spacing to ${t}px`)));
270
+ "parent" in s && s.parent() && i.modifyHtml(s.parent()).setStyle("padding", r);
271
+ }), i.apply(new g(`Update mobile column spacing to ${t}px`)));
266
272
  }
267
273
  /**
268
274
  * Handles row spacing changes for mobile.
@@ -271,24 +277,24 @@ class X extends V {
271
277
  _onMobileRowSpacingChange(t) {
272
278
  if (!this.currentNode)
273
279
  return;
274
- d.updateConfig(
280
+ p.updateConfig(
275
281
  this.api,
276
282
  this.currentNode,
277
283
  { mobileRowSpacing: t },
278
284
  `Changed mobile row spacing to ${t}px`
279
285
  ), this._storeDataAttribute(O.MOBILE_ROW_SPACING, t);
280
- const e = this.currentNode.querySelector(E);
286
+ const e = this.currentNode.querySelector(M);
281
287
  if (!e)
282
288
  return;
283
- const n = Array.from(
289
+ const o = Array.from(
284
290
  e.querySelectorAll(".spacer")
285
291
  );
286
- if (!n.length)
292
+ if (!o.length)
287
293
  return;
288
- const o = this.api.getDocumentModifier(), a = `${t}px`;
289
- n.forEach((r) => {
290
- o.modifyHtml(r).setStyle("height", a);
291
- }), o.apply(new g(`Update mobile row spacing to ${t}px`));
294
+ const i = this.api.getDocumentModifier(), a = `${t}px`;
295
+ o.forEach((r) => {
296
+ i.modifyHtml(r).setStyle("height", a);
297
+ }), i.apply(new g(`Update mobile row spacing to ${t}px`));
292
298
  }
293
299
  // ========================================================================
294
300
  // Data Attribute Storage
@@ -297,23 +303,23 @@ class X extends V {
297
303
  * Stores a spacing value as a data attribute on the block root element
298
304
  */
299
305
  _storeDataAttribute(t, e) {
300
- const n = x(this.currentNode);
301
- n && this.api.getDocumentModifier().modifyHtml(n).setAttribute(t, e.toString()).apply(new g(`Store ${t}`));
306
+ const o = B(this.currentNode);
307
+ o && this.api.getDocumentModifier().modifyHtml(o).setAttribute(t, e.toString()).apply(new g(`Store ${t}`));
302
308
  }
303
309
  // ========================================================================
304
310
  // Event Listeners
305
311
  // ========================================================================
306
312
  _listenToFormUpdates() {
307
- this.api.onValueChanged(i.COLUMN_SPACING, (t) => {
313
+ this.api.onValueChanged(n.COLUMN_SPACING, (t) => {
308
314
  const e = parseInt(t);
309
315
  Number.isNaN(e) || this._debouncedOnColumnSpacingChange(e);
310
- }), this.api.onValueChanged(i.ROW_SPACING, (t) => {
316
+ }), this.api.onValueChanged(n.ROW_SPACING, (t) => {
311
317
  const e = parseInt(t);
312
318
  Number.isNaN(e) || this._debouncedOnRowSpacingChange(e);
313
- }), this.api.onValueChanged(i.MOBILE_COLUMN_SPACING, (t) => {
319
+ }), this.api.onValueChanged(n.MOBILE_COLUMN_SPACING, (t) => {
314
320
  const e = parseInt(t);
315
321
  Number.isNaN(e) || this._debouncedOnMobileColumnSpacingChange(e);
316
- }), this.api.onValueChanged(i.MOBILE_ROW_SPACING, (t) => {
322
+ }), this.api.onValueChanged(n.MOBILE_ROW_SPACING, (t) => {
317
323
  const e = parseInt(t);
318
324
  Number.isNaN(e) || this._debouncedOnMobileRowSpacingChange(e);
319
325
  });
@@ -327,20 +333,8 @@ class X extends V {
327
333
  t.type === "patch object" && (this._updateSpacingVisibility(), this._setFormValues());
328
334
  });
329
335
  }
330
- /**
331
- * Subscribes to editor preview mode changes via Stripo API.
332
- * Toggles which spacing controls (desktop/mobile) are visible.
333
- */
334
- _subscribeToEditorModeChanges() {
335
- this.api.onEditorStatePropUpdated(
336
- y.previewDeviceMode,
337
- () => {
338
- this._updateSpacingVisibility();
339
- }
340
- );
341
- }
342
336
  }
343
337
  export {
344
- W as SPACING_CONTROL_ID,
345
- X as SpacingControl
338
+ U as SPACING_CONTROL_ID,
339
+ j as SpacingControl
346
340
  };
@@ -0,0 +1,65 @@
1
+ var m = Object.defineProperty;
2
+ var _ = (o, e, t) => e in o ? m(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var a = (o, e, t) => _(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { UIElementType as c, UEAttr as p } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { CommonControl as d } from "../../common-control.js";
6
+ import { RecommendationControlId as C } from "../constants/controlIds.js";
7
+ const S = C.SYNC_INFO_MESSAGE, r = "sync-info-message", u = "Note that changes will be applied to all product cards in your recommendation block.";
8
+ class h extends d {
9
+ constructor() {
10
+ super(...arguments);
11
+ a(this, "_repositionedElement", null);
12
+ }
13
+ getId() {
14
+ return S;
15
+ }
16
+ getTemplate() {
17
+ return `
18
+ <div class="${r}">
19
+ <${c.ICON}
20
+ ${p.ICON.src}="migration-info-icon"
21
+ class="${r}__icon">
22
+ </${c.ICON}>
23
+ <p class="${r}__text">
24
+ ${this.api.translate(u)}
25
+ </p>
26
+ </div>
27
+ `;
28
+ }
29
+ onRender() {
30
+ this._repositionAboveTabs();
31
+ }
32
+ onDestroy() {
33
+ var t;
34
+ super.onDestroy(), (t = this._repositionedElement) == null || t.remove(), this._repositionedElement = null;
35
+ }
36
+ /**
37
+ * Moves the info message from inside the Settings tab content
38
+ * to above the tab bar in the DOM tree.
39
+ *
40
+ * DOM structure (Stripo internals):
41
+ * ue-control-panel
42
+ * div.control-panel-header-wrapper
43
+ * div.control-panel-header ← title bar (X, title, undo)
44
+ * ue-tabs-header.control-panel-tabs ← tab bar (Settings | Styles)
45
+ * div.control-panel-content-wrapper ← tab content (where our control renders)
46
+ *
47
+ * We insert the message between the title bar and the tab bar.
48
+ * The element reference is stored so onDestroy() can remove it.
49
+ */
50
+ _repositionAboveTabs() {
51
+ var l;
52
+ const n = this.getContainer().querySelector(`.${r}`);
53
+ if (!n)
54
+ return;
55
+ const i = n.closest("ue-control-panel");
56
+ if (!i)
57
+ return;
58
+ const s = i.querySelector("ue-tabs-header");
59
+ s && ((l = s.parentElement) == null || l.insertBefore(n, s), this._repositionedElement = n);
60
+ }
61
+ }
62
+ export {
63
+ S as SYNC_INFO_MESSAGE_CONTROL_ID,
64
+ h as SyncInfoMessageControl
65
+ };
@@ -4,39 +4,41 @@ import { RecommendationBlockControl as n } from "./controls/main/index.js";
4
4
  import "./store/recommendation.js";
5
5
  import { NameControls as i } from "./controls/name/index.js";
6
6
  import { PriceControls as e } from "./controls/price/index.js";
7
- import { OldPriceControls as l } from "./controls/oldPrice/index.js";
8
- import { OmnibusPriceControls as s } from "./controls/omnibusPrice/index.js";
7
+ import { OldPriceControls as s } from "./controls/oldPrice/index.js";
8
+ import { OmnibusPriceControls as l } from "./controls/omnibusPrice/index.js";
9
9
  import { OmnibusDiscountControls as a } from "./controls/omnibusDiscount/index.js";
10
10
  import { ButtonControls as p } from "./controls/button/index.js";
11
11
  import { ImageControls as c } from "./controls/image/index.js";
12
- import { SpacingControl as C } from "./controls/spacing/index.js";
12
+ import { CustomAttributeControls as C } from "./controls/customAttribute/index.js";
13
+ import { SpacingControl as f } from "./controls/spacing/index.js";
13
14
  import { CardBackgroundColorControl as d } from "./controls/cardBackground/index.js";
14
- import { LayoutControl as f } from "./controls/layout/index.js";
15
15
  import { RecommendationCardCompositionControl as u } from "./controls/cardComposition/index.js";
16
- import { RecommendationIconsRegistry as g } from "./iconsRegistry.js";
17
- import R from "./recommendation.css.js";
18
- import { SettingsPanel as y } from "./settingsPanel.js";
19
- const B = [
16
+ import { SyncInfoMessageControl as g } from "./controls/syncInfoMessage.js";
17
+ import { RecommendationIconsRegistry as R } from "./iconsRegistry.js";
18
+ import y from "./recommendation.css.js";
19
+ import { SettingsPanel as B } from "./settingsPanel.js";
20
+ const b = [
20
21
  i,
21
22
  e,
22
- l,
23
23
  s,
24
+ l,
24
25
  a,
25
26
  p,
26
- c
27
+ c,
28
+ C
27
29
  ], P = [
28
30
  n,
29
31
  d,
30
32
  f,
31
- C,
32
- u
33
- ], b = [
33
+ u,
34
+ g
35
+ ], S = [
34
36
  ...P,
35
- ...B.flatMap((o) => Object.values(o))
36
- ], F = b.reduce(
37
+ ...b.flatMap((o) => Object.values(o))
38
+ ], K = S.reduce(
37
39
  (o, t) => o.addControl(t),
38
- new r().addBlock(m).withSettingsPanelRegistry(y)
39
- ).addStyles(R).withIconsRegistry(g).build();
40
+ new r().addBlock(m).withSettingsPanelRegistry(B)
41
+ ).addStyles(y).withIconsRegistry(R).build();
40
42
  export {
41
- F as default
43
+ K as default
42
44
  };
@@ -1,5 +1,6 @@
1
- import { IconsRegistry as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- class o extends r {
1
+ import r from "../../../static/assets/info.svg.js";
2
+ import { IconsRegistry as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ class h extends t {
3
4
  registerIconsSvg(C) {
4
5
  C["recommendation-icon"] = `
5
6
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
@@ -59,9 +60,9 @@ class o extends r {
59
60
  <circle cx="3" cy="16" r="1" stroke="currentColor" stroke-width="1"/>
60
61
  <rect x="7" y="15" width="11" height="2" rx="1"/>
61
62
  </svg>
62
- `;
63
+ `, C["migration-info-icon"] = r;
63
64
  }
64
65
  }
65
66
  export {
66
- o as RecommendationIconsRegistry
67
+ h as RecommendationIconsRegistry
67
68
  };