@useinsider/guido 3.0.0-beta.8709edc → 3.0.0-beta.952fc1f

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 (85) hide show
  1. package/dist/components/organisms/header/EditorActions.vue.js +1 -1
  2. package/dist/components/organisms/header/EditorActions.vue2.js +6 -6
  3. package/dist/config/compiler/unsubscribeCompilerRules.js +14 -14
  4. package/dist/config/compiler/utils/recommendationCompilerUtils.js +29 -18
  5. package/dist/config/i18n/en/tooltips.json.js +1 -2
  6. package/dist/extensions/Blocks/Recommendation/block.js +59 -38
  7. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  8. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  9. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -34
  10. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -12
  11. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +4 -4
  12. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +693 -144
  13. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +78 -0
  14. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +15 -15
  15. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +24 -24
  16. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +2 -2
  17. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +107 -78
  18. package/dist/extensions/Blocks/Recommendation/controls/{layout/index.js → main/layoutOrientation.js} +34 -23
  19. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +2 -2
  20. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +58 -0
  21. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +150 -64
  22. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +2 -2
  23. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +202 -200
  24. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +25 -8
  25. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +6 -5
  26. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
  27. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +21 -21
  28. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +13 -13
  29. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +17 -17
  30. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +135 -143
  31. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +65 -0
  32. package/dist/extensions/Blocks/Recommendation/extension.js +20 -18
  33. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +161 -2
  34. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +135 -111
  35. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +9 -7
  36. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +63 -34
  37. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +25 -28
  38. package/dist/extensions/Blocks/Recommendation/templates/index.js +8 -8
  39. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +28 -13
  40. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +25 -44
  41. package/dist/extensions/Blocks/Recommendation/templates/utils.js +62 -38
  42. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
  43. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +17 -16
  44. package/dist/extensions/Blocks/common-control.js +90 -41
  45. package/dist/guido.css +1 -1
  46. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +218 -324
  47. package/dist/package.json.js +1 -1
  48. package/dist/src/components/Guido.vue.d.ts +1 -1
  49. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  50. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  51. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  52. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
  53. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
  54. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +9 -1
  55. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  56. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +10 -0
  57. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +134 -44
  58. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +105 -0
  59. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +3 -2
  60. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +5 -1
  61. package/dist/src/extensions/Blocks/Recommendation/controls/{layout/index.d.ts → main/layoutOrientation.d.ts} +3 -3
  62. package/dist/src/extensions/Blocks/Recommendation/controls/main/productCount.d.ts +28 -0
  63. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +38 -20
  64. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +6 -2
  65. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +23 -1
  66. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +8 -18
  67. package/dist/src/extensions/Blocks/Recommendation/controls/syncInfoMessage.d.ts +34 -0
  68. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
  69. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +1 -1
  70. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +1 -1
  71. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +10 -4
  72. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +37 -2
  73. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +13 -0
  74. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
  75. package/dist/src/extensions/Blocks/common-control.d.ts +24 -2
  76. package/dist/static/styles/components/wide-panel.css.js +1 -0
  77. package/dist/static/styles/customEditorStyle.css.js +9 -0
  78. package/dist/static/styles/variables.css.js +3 -0
  79. package/package.json +3 -3
  80. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.d.ts +0 -25
  81. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.d.ts +0 -15
  82. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.d.ts +0 -15
  83. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.d.ts +0 -15
  84. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.d.ts +0 -15
  85. 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, s, t) => s in p ? G(p, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[s] = t;
3
- var C = (p, s, t) => R(p, typeof s != "symbol" ? s + "" : s, t);
4
- import { EditorStatePropertyType as y, PreviewDeviceMode as w, ModificationDescription as m } 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 S, MOBILE_CONTAINER_SELECTOR as E } from "../../constants/selectors.js";
7
- import { SPACING_STEP as _, MAX_SPACING as N, MIN_SPACING as b, DEFAULT_COLUMN_SPACING as g, 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 L, safeGetParent as U } from "../../utils/tagName.js";
11
- import { getCurrentLayout as f, getBlockElement as x } from "../main/utils.js";
12
- import { useDebounceFn as O } from "../../../../../node_modules/@vueuse/shared/index.js";
13
- const W = "recommendation-spacing-control", i = {
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
+ import { useDebounceFn as f } from "../../../../../node_modules/@vueuse/shared/index.js";
13
+ const U = "recommendation-spacing-control", n = {
14
14
  COLUMN_SPACING: "columnSpacing",
15
15
  COLUMN_SPACING_LABEL: "columnSpacingLabel",
16
16
  ROW_SPACING: "rowSpacing",
@@ -19,93 +19,102 @@ const W = "recommendation-spacing-control", i = {
19
19
  MOBILE_COLUMN_SPACING_LABEL: "mobileColumnSpacingLabel",
20
20
  MOBILE_ROW_SPACING: "mobileRowSpacing",
21
21
  MOBILE_ROW_SPACING_LABEL: "mobileRowSpacingLabel"
22
- }, A = {
22
+ }, O = {
23
23
  COLUMN_SPACING: "data-column-spacing",
24
24
  ROW_SPACING: "data-row-spacing",
25
25
  MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
26
26
  MOBILE_ROW_SPACING: "data-mobile-row-spacing"
27
27
  };
28
- function I(p, s) {
29
- if (!p)
30
- return s;
31
- const t = parseFloat(p);
32
- return Number.isNaN(t) ? s : t;
28
+ function L(u, c) {
29
+ if (!u)
30
+ return c;
31
+ const t = parseFloat(u);
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
- C(this, "store", B());
38
- C(this, "unsubscribeOrientation", null);
37
+ h(this, "store", V());
38
+ h(this, "unsubscribeOrientation", null);
39
39
  /**
40
40
  * Debounced version of _onColumnSpacingChange
41
41
  * Prevents excessive DOM updates when user rapidly adjusts the counter
42
42
  */
43
- C(this, "_debouncedOnColumnSpacingChange", O((t) => {
43
+ h(this, "_debouncedOnColumnSpacingChange", f((t) => {
44
44
  this._onColumnSpacingChange(t);
45
45
  }, 300));
46
46
  /**
47
47
  * Debounced version of _onRowSpacingChange
48
48
  */
49
- C(this, "_debouncedOnRowSpacingChange", O((t) => {
49
+ h(this, "_debouncedOnRowSpacingChange", f((t) => {
50
50
  this._onRowSpacingChange(t);
51
51
  }, 300));
52
52
  /**
53
53
  * Debounced version of _onMobileColumnSpacingChange
54
54
  */
55
- C(this, "_debouncedOnMobileColumnSpacingChange", O((t) => {
55
+ h(this, "_debouncedOnMobileColumnSpacingChange", f((t) => {
56
56
  this._onMobileColumnSpacingChange(t);
57
57
  }, 300));
58
58
  /**
59
59
  * Debounced version of _onMobileRowSpacingChange
60
60
  */
61
- C(this, "_debouncedOnMobileRowSpacingChange", O((t) => {
61
+ h(this, "_debouncedOnMobileRowSpacingChange", f((t) => {
62
62
  this._onMobileRowSpacingChange(t);
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,
75
- minValue: b,
76
- maxValue: N,
77
- step: _
77
+ name: n.COLUMN_SPACING,
78
+ minValue: N,
79
+ maxValue: _,
80
+ step: S
81
+ }),
82
+ this._GuLabel({
83
+ text: this.api.translate("Row Spacing (px)"),
84
+ name: n.ROW_SPACING_LABEL
78
85
  }),
79
- this._GuLabel({ text: "Row Spacing on Desktop (px)", name: i.ROW_SPACING_LABEL }),
80
86
  this._GuCounter({
81
- name: i.ROW_SPACING,
82
- minValue: b,
83
- maxValue: N,
84
- step: _
87
+ name: n.ROW_SPACING,
88
+ minValue: N,
89
+ maxValue: _,
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,
92
- minValue: b,
93
- maxValue: N,
94
- step: _
97
+ name: n.MOBILE_COLUMN_SPACING,
98
+ minValue: N,
99
+ maxValue: _,
100
+ step: S
101
+ }),
102
+ this._GuLabel({
103
+ text: this.api.translate("Row Spacing on Mobile (px)"),
104
+ name: n.MOBILE_ROW_SPACING_LABEL
95
105
  }),
96
- this._GuLabel({ text: "Row Spacing on Mobile (px)", name: i.MOBILE_ROW_SPACING_LABEL }),
97
106
  this._GuCounter({
98
- name: i.MOBILE_ROW_SPACING,
99
- minValue: b,
100
- maxValue: N,
101
- step: _
107
+ name: n.MOBILE_ROW_SPACING,
108
+ minValue: N,
109
+ maxValue: _,
110
+ step: S
102
111
  })
103
112
  ])}
104
113
  </div>
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 || f(this.currentNode), o = n === "grid", a = n === "list", r = this._isMobileMode(), c = t.cardsInRow > 1, u = t.mobileCardsInRow > 1;
136
- this.api.setVisibility(i.COLUMN_SPACING, o && !r && c), this.api.setVisibility(i.COLUMN_SPACING_LABEL, o && !r && c), 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
  /**
@@ -159,20 +165,20 @@ class X extends V {
159
165
  */
160
166
  _getStoredColumnSpacing() {
161
167
  if (!this.currentNode)
162
- return g;
163
- const t = this.currentNode.querySelector(S) ?? this.currentNode;
164
- if (f(this.currentNode) === "grid") {
165
- const u = t.querySelector(".recommendation-attribute-row"), l = (u == null ? void 0 : u.querySelector("td")) ?? null, h = L(l, "padding");
166
- if (!h)
167
- return g;
168
- const M = h.trim().split(/\s+/);
169
- return M.length < 2 ? g : I(M[1], g / 2) * 2;
168
+ return C;
169
+ const t = this.currentNode.querySelector(m) ?? this.currentNode;
170
+ if (b(this.currentNode) === "grid") {
171
+ const d = t.querySelector(".recommendation-attribute-row"), s = d == null ? void 0 : d.querySelector("td"), I = A(s, "padding");
172
+ if (!I)
173
+ return C;
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") ?? null, o = U(n), a = L(o, "padding");
177
+ const o = t.querySelector(".product-card-wrapper"), i = w(o), a = A(i, "padding");
172
178
  if (!a)
173
- return g;
179
+ return C;
174
180
  const r = a.trim().split(/\s+/);
175
- return r.length < 2 ? g : I(r[1], g / 2) * 2;
181
+ return r.length < 2 ? C : L(r[1], C / 2) * 2;
176
182
  }
177
183
  /**
178
184
  * Gets stored row spacing from the first spacer element's height style
@@ -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(S) ?? this.currentNode).querySelector(".spacer") ?? null, n = L(e, "height");
185
- return I(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,23 +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
- ), this._storeDataAttribute(A.COLUMN_SPACING, t);
203
- const n = d.getConfig(this.currentNode).layout || f(this.currentNode), o = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(S);
204
- c && (n === "grid" ? Array.from(
205
- c.querySelectorAll(".attribute-cell")
206
- ).forEach((l) => {
207
- o.modifyHtml(l).setStyle("padding", r);
208
+ ), this._storeDataAttribute(O.COLUMN_SPACING, t);
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(
211
+ l.querySelectorAll(".attribute-cell")
212
+ ).forEach((s) => {
213
+ i.modifyHtml(s).setStyle("padding", r);
208
214
  }) : Array.from(
209
- c.querySelectorAll(".product-card-wrapper")
210
- ).forEach((l) => {
211
- const h = "parent" in l ? l.parent() : void 0;
212
- h && o.modifyHtml(h).setStyle("padding", r);
213
- }), o.apply(new m(`Update column spacing to ${t}px`)));
215
+ l.querySelectorAll(".product-card-wrapper")
216
+ ).forEach((s) => {
217
+ "parent" in s && s.parent() && i.modifyHtml(s.parent()).setStyle("padding", r);
218
+ }), i.apply(new g(`Update column spacing to ${t}px`)));
214
219
  }
215
220
  /**
216
221
  * Handles row spacing changes for desktop.
@@ -219,24 +224,24 @@ class X extends V {
219
224
  _onRowSpacingChange(t) {
220
225
  if (!this.currentNode)
221
226
  return;
222
- d.updateConfig(
227
+ p.updateConfig(
223
228
  this.api,
224
229
  this.currentNode,
225
230
  { rowSpacing: t },
226
231
  `Changed row spacing to ${t}px`
227
- ), this._storeDataAttribute(A.ROW_SPACING, t);
228
- const e = this.currentNode.querySelector(S);
232
+ ), this._storeDataAttribute(O.ROW_SPACING, t);
233
+ const e = this.currentNode.querySelector(m);
229
234
  if (!e)
230
235
  return;
231
- const n = Array.from(
236
+ const o = Array.from(
232
237
  e.querySelectorAll(".spacer")
233
238
  );
234
- if (!n.length)
239
+ if (!o.length)
235
240
  return;
236
- const o = this.api.getDocumentModifier(), a = `${t}px`;
237
- n.forEach((r) => {
238
- o.modifyHtml(r).setStyle("height", a);
239
- }), o.apply(new m(`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`));
240
245
  }
241
246
  // ========================================================================
242
247
  // Mobile Spacing Handlers
@@ -248,23 +253,22 @@ class X extends V {
248
253
  _onMobileColumnSpacingChange(t) {
249
254
  if (!this.currentNode)
250
255
  return;
251
- d.updateConfig(
256
+ p.updateConfig(
252
257
  this.api,
253
258
  this.currentNode,
254
259
  { mobileColumnSpacing: t },
255
260
  `Changed mobile column spacing to ${t}px`
256
- ), this._storeDataAttribute(A.MOBILE_COLUMN_SPACING, t);
257
- const n = d.getConfig(this.currentNode).layout || f(this.currentNode), o = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(E);
258
- c && (n === "grid" ? Array.from(
259
- c.querySelectorAll(".attribute-cell")
260
- ).forEach((l) => {
261
- o.modifyHtml(l).setStyle("padding", r);
261
+ ), this._storeDataAttribute(O.MOBILE_COLUMN_SPACING, t);
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(
264
+ l.querySelectorAll(".attribute-cell")
265
+ ).forEach((s) => {
266
+ i.modifyHtml(s).setStyle("padding", r);
262
267
  }) : Array.from(
263
- c.querySelectorAll(".product-card-wrapper")
264
- ).forEach((l) => {
265
- const h = "parent" in l ? l.parent() : void 0;
266
- h && o.modifyHtml(h).setStyle("padding", r);
267
- }), o.apply(new m(`Update mobile column spacing to ${t}px`)));
268
+ l.querySelectorAll(".product-card-wrapper")
269
+ ).forEach((s) => {
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`)));
268
272
  }
269
273
  /**
270
274
  * Handles row spacing changes for mobile.
@@ -273,24 +277,24 @@ class X extends V {
273
277
  _onMobileRowSpacingChange(t) {
274
278
  if (!this.currentNode)
275
279
  return;
276
- d.updateConfig(
280
+ p.updateConfig(
277
281
  this.api,
278
282
  this.currentNode,
279
283
  { mobileRowSpacing: t },
280
284
  `Changed mobile row spacing to ${t}px`
281
- ), this._storeDataAttribute(A.MOBILE_ROW_SPACING, t);
282
- const e = this.currentNode.querySelector(E);
285
+ ), this._storeDataAttribute(O.MOBILE_ROW_SPACING, t);
286
+ const e = this.currentNode.querySelector(M);
283
287
  if (!e)
284
288
  return;
285
- const n = Array.from(
289
+ const o = Array.from(
286
290
  e.querySelectorAll(".spacer")
287
291
  );
288
- if (!n.length)
292
+ if (!o.length)
289
293
  return;
290
- const o = this.api.getDocumentModifier(), a = `${t}px`;
291
- n.forEach((r) => {
292
- o.modifyHtml(r).setStyle("height", a);
293
- }), o.apply(new m(`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`));
294
298
  }
295
299
  // ========================================================================
296
300
  // Data Attribute Storage
@@ -299,23 +303,23 @@ class X extends V {
299
303
  * Stores a spacing value as a data attribute on the block root element
300
304
  */
301
305
  _storeDataAttribute(t, e) {
302
- const n = x(this.currentNode);
303
- n && this.api.getDocumentModifier().modifyHtml(n).setAttribute(t, e.toString()).apply(new m(`Store ${t}`));
306
+ const o = B(this.currentNode);
307
+ o && this.api.getDocumentModifier().modifyHtml(o).setAttribute(t, e.toString()).apply(new g(`Store ${t}`));
304
308
  }
305
309
  // ========================================================================
306
310
  // Event Listeners
307
311
  // ========================================================================
308
312
  _listenToFormUpdates() {
309
- this.api.onValueChanged(i.COLUMN_SPACING, (t) => {
313
+ this.api.onValueChanged(n.COLUMN_SPACING, (t) => {
310
314
  const e = parseInt(t);
311
315
  Number.isNaN(e) || this._debouncedOnColumnSpacingChange(e);
312
- }), this.api.onValueChanged(i.ROW_SPACING, (t) => {
316
+ }), this.api.onValueChanged(n.ROW_SPACING, (t) => {
313
317
  const e = parseInt(t);
314
318
  Number.isNaN(e) || this._debouncedOnRowSpacingChange(e);
315
- }), this.api.onValueChanged(i.MOBILE_COLUMN_SPACING, (t) => {
319
+ }), this.api.onValueChanged(n.MOBILE_COLUMN_SPACING, (t) => {
316
320
  const e = parseInt(t);
317
321
  Number.isNaN(e) || this._debouncedOnMobileColumnSpacingChange(e);
318
- }), this.api.onValueChanged(i.MOBILE_ROW_SPACING, (t) => {
322
+ }), this.api.onValueChanged(n.MOBILE_ROW_SPACING, (t) => {
319
323
  const e = parseInt(t);
320
324
  Number.isNaN(e) || this._debouncedOnMobileRowSpacingChange(e);
321
325
  });
@@ -329,20 +333,8 @@ class X extends V {
329
333
  t.type === "patch object" && (this._updateSpacingVisibility(), this._setFormValues());
330
334
  });
331
335
  }
332
- /**
333
- * Subscribes to editor preview mode changes via Stripo API.
334
- * Toggles which spacing controls (desktop/mobile) are visible.
335
- */
336
- _subscribeToEditorModeChanges() {
337
- this.api.onEditorStatePropUpdated(
338
- y.previewDeviceMode,
339
- () => {
340
- this._updateSpacingVisibility();
341
- }
342
- );
343
- }
344
336
  }
345
337
  export {
346
- W as SPACING_CONTROL_ID,
347
- X as SpacingControl
338
+ U as SPACING_CONTROL_ID,
339
+ j as SpacingControl
348
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
  };