@useinsider/guido 3.0.0-beta.7d3a300 → 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.
- package/dist/config/i18n/en/tooltips.json.js +1 -2
- package/dist/extensions/Blocks/Recommendation/block.js +56 -38
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -34
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +4 -4
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +15 -15
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +24 -24
- package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +2 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +107 -78
- package/dist/extensions/Blocks/Recommendation/controls/{layout/index.js → main/layoutOrientation.js} +35 -27
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +2 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +58 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +150 -64
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +2 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +198 -204
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +25 -8
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +6 -5
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +21 -21
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +13 -13
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +17 -17
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +134 -142
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +65 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +13 -13
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +35 -0
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +21 -15
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -0
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +27 -27
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +17 -16
- package/dist/extensions/Blocks/common-control.js +90 -41
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +218 -324
- package/dist/package.json.js +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +2 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +5 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/{layout/index.d.ts → main/layoutOrientation.d.ts} +3 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productCount.d.ts +28 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +38 -20
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +23 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +8 -18
- package/dist/src/extensions/Blocks/Recommendation/controls/syncInfoMessage.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
- package/dist/src/extensions/Blocks/common-control.d.ts +24 -2
- package/dist/static/styles/components/button.css.js +7 -13
- package/dist/static/styles/components/narrow-panel.css.js +0 -52
- package/dist/static/styles/components/wide-panel.css.js +1 -0
- package/dist/static/styles/customEditorStyle.css.js +9 -0
- package/package.json +3 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.d.ts +0 -25
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/spacingControl.d.ts +0 -60
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { DESKTOP_CONTAINER_SELECTOR as
|
|
7
|
-
import { SPACING_STEP as
|
|
8
|
-
import { RecommendationConfigService as
|
|
9
|
-
import { useRecommendationExtensionStore as
|
|
10
|
-
import { safeGetStyle as
|
|
11
|
-
import { getCurrentLayout as
|
|
12
|
-
import { useDebounceFn as
|
|
13
|
-
const
|
|
1
|
+
var G = Object.defineProperty;
|
|
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
|
-
},
|
|
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
|
|
28
|
+
function L(u, c) {
|
|
29
29
|
if (!u)
|
|
30
|
-
return
|
|
30
|
+
return c;
|
|
31
31
|
const t = parseFloat(u);
|
|
32
|
-
return Number.isNaN(t) ?
|
|
32
|
+
return Number.isNaN(t) ? c : t;
|
|
33
33
|
}
|
|
34
|
-
class
|
|
34
|
+
class j extends R {
|
|
35
35
|
constructor() {
|
|
36
36
|
super(...arguments);
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
61
|
+
h(this, "_debouncedOnMobileRowSpacingChange", f((t) => {
|
|
62
62
|
this._onMobileRowSpacingChange(t);
|
|
63
63
|
}, 300));
|
|
64
64
|
}
|
|
65
65
|
getId() {
|
|
66
|
-
return
|
|
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({
|
|
72
|
+
this._GuLabel({
|
|
73
|
+
text: this.api.translate("Column Spacing (px)"),
|
|
74
|
+
name: n.COLUMN_SPACING_LABEL
|
|
75
|
+
}),
|
|
73
76
|
this._GuCounter({
|
|
74
|
-
name:
|
|
75
|
-
minValue:
|
|
76
|
-
maxValue:
|
|
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:
|
|
82
|
-
minValue:
|
|
83
|
-
maxValue:
|
|
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:
|
|
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:
|
|
92
|
-
minValue:
|
|
93
|
-
maxValue:
|
|
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:
|
|
99
|
-
minValue:
|
|
100
|
-
maxValue:
|
|
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()
|
|
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 B {
|
|
|
114
123
|
this.unsubscribeOrientation && (this.unsubscribeOrientation(), this.unsubscribeOrientation = null);
|
|
115
124
|
}
|
|
116
125
|
/**
|
|
117
|
-
*
|
|
118
|
-
* using Stripo's EditorStatePropertyType API.
|
|
119
|
-
*/
|
|
120
|
-
_isMobileMode() {
|
|
121
|
-
return this.api.getEditorState()[E.previewDeviceMode] === V.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
|
|
129
|
-
* - Mobile
|
|
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 =
|
|
136
|
-
this.api.setVisibility(
|
|
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 B {
|
|
|
142
148
|
_setFormValues() {
|
|
143
149
|
if (!this.api)
|
|
144
150
|
return;
|
|
145
|
-
const t =
|
|
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
|
-
[
|
|
148
|
-
[
|
|
149
|
-
[
|
|
150
|
-
[
|
|
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 B {
|
|
|
159
165
|
*/
|
|
160
166
|
_getStoredColumnSpacing() {
|
|
161
167
|
if (!this.currentNode)
|
|
162
|
-
return
|
|
163
|
-
const t = this.currentNode.querySelector(
|
|
164
|
-
if (
|
|
165
|
-
const
|
|
166
|
-
if (!
|
|
167
|
-
return
|
|
168
|
-
const y =
|
|
169
|
-
return y.length < 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
|
|
177
|
+
const o = t.querySelector(".product-card-wrapper"), i = w(o), a = A(i, "padding");
|
|
172
178
|
if (!a)
|
|
173
|
-
return
|
|
179
|
+
return C;
|
|
174
180
|
const r = a.trim().split(/\s+/);
|
|
175
|
-
return r.length < 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 B {
|
|
|
180
186
|
*/
|
|
181
187
|
_getStoredRowSpacing() {
|
|
182
188
|
if (!this.currentNode)
|
|
183
|
-
return
|
|
184
|
-
const e = (this.currentNode.querySelector(
|
|
185
|
-
return
|
|
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 B {
|
|
|
194
200
|
_onColumnSpacingChange(t) {
|
|
195
201
|
if (!this.currentNode)
|
|
196
202
|
return;
|
|
197
|
-
|
|
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(
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
).forEach((
|
|
207
|
-
|
|
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
|
-
|
|
210
|
-
).forEach((
|
|
211
|
-
|
|
212
|
-
|
|
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 B {
|
|
|
219
224
|
_onRowSpacingChange(t) {
|
|
220
225
|
if (!this.currentNode)
|
|
221
226
|
return;
|
|
222
|
-
|
|
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(
|
|
228
|
-
const e = this.currentNode.querySelector(
|
|
232
|
+
), this._storeDataAttribute(O.ROW_SPACING, t);
|
|
233
|
+
const e = this.currentNode.querySelector(m);
|
|
229
234
|
if (!e)
|
|
230
235
|
return;
|
|
231
|
-
const
|
|
236
|
+
const o = Array.from(
|
|
232
237
|
e.querySelectorAll(".spacer")
|
|
233
238
|
);
|
|
234
|
-
if (!
|
|
239
|
+
if (!o.length)
|
|
235
240
|
return;
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}),
|
|
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 B {
|
|
|
248
253
|
_onMobileColumnSpacingChange(t) {
|
|
249
254
|
if (!this.currentNode)
|
|
250
255
|
return;
|
|
251
|
-
|
|
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(
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
).forEach((
|
|
261
|
-
|
|
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
|
-
|
|
264
|
-
).forEach((
|
|
265
|
-
|
|
266
|
-
|
|
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 B {
|
|
|
273
277
|
_onMobileRowSpacingChange(t) {
|
|
274
278
|
if (!this.currentNode)
|
|
275
279
|
return;
|
|
276
|
-
|
|
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(
|
|
282
|
-
const e = this.currentNode.querySelector(
|
|
285
|
+
), this._storeDataAttribute(O.MOBILE_ROW_SPACING, t);
|
|
286
|
+
const e = this.currentNode.querySelector(M);
|
|
283
287
|
if (!e)
|
|
284
288
|
return;
|
|
285
|
-
const
|
|
289
|
+
const o = Array.from(
|
|
286
290
|
e.querySelectorAll(".spacer")
|
|
287
291
|
);
|
|
288
|
-
if (!
|
|
292
|
+
if (!o.length)
|
|
289
293
|
return;
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}),
|
|
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 B {
|
|
|
299
303
|
* Stores a spacing value as a data attribute on the block root element
|
|
300
304
|
*/
|
|
301
305
|
_storeDataAttribute(t, e) {
|
|
302
|
-
const
|
|
303
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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 B {
|
|
|
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
|
-
E.previewDeviceMode,
|
|
339
|
-
() => {
|
|
340
|
-
this._updateSpacingVisibility();
|
|
341
|
-
}
|
|
342
|
-
);
|
|
343
|
-
}
|
|
344
336
|
}
|
|
345
337
|
export {
|
|
346
|
-
|
|
347
|
-
|
|
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,41 +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
|
|
8
|
-
import { OmnibusPriceControls as
|
|
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
|
-
import { ImageControls as
|
|
12
|
-
import { CustomAttributeControls as
|
|
11
|
+
import { ImageControls as c } from "./controls/image/index.js";
|
|
12
|
+
import { CustomAttributeControls as C } from "./controls/customAttribute/index.js";
|
|
13
13
|
import { SpacingControl as f } from "./controls/spacing/index.js";
|
|
14
14
|
import { CardBackgroundColorControl as d } from "./controls/cardBackground/index.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { RecommendationCardCompositionControl as u } from "./controls/cardComposition/index.js";
|
|
16
|
+
import { SyncInfoMessageControl as g } from "./controls/syncInfoMessage.js";
|
|
17
17
|
import { RecommendationIconsRegistry as R } from "./iconsRegistry.js";
|
|
18
18
|
import y from "./recommendation.css.js";
|
|
19
19
|
import { SettingsPanel as B } from "./settingsPanel.js";
|
|
20
20
|
const b = [
|
|
21
21
|
i,
|
|
22
22
|
e,
|
|
23
|
-
l,
|
|
24
23
|
s,
|
|
24
|
+
l,
|
|
25
25
|
a,
|
|
26
26
|
p,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
c,
|
|
28
|
+
C
|
|
29
29
|
], P = [
|
|
30
30
|
n,
|
|
31
31
|
d,
|
|
32
|
-
u,
|
|
33
32
|
f,
|
|
33
|
+
u,
|
|
34
34
|
g
|
|
35
|
-
],
|
|
35
|
+
], S = [
|
|
36
36
|
...P,
|
|
37
37
|
...b.flatMap((o) => Object.values(o))
|
|
38
|
-
],
|
|
38
|
+
], K = S.reduce(
|
|
39
39
|
(o, t) => o.addControl(t),
|
|
40
40
|
new r().addBlock(m).withSettingsPanelRegistry(B)
|
|
41
41
|
).addStyles(y).withIconsRegistry(R).build();
|
|
42
42
|
export {
|
|
43
|
-
|
|
43
|
+
K as default
|
|
44
44
|
};
|
|
@@ -18,6 +18,11 @@ const n = `/* Utils */
|
|
|
18
18
|
padding: 0
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/* Right-align the mobile layout toggle within the two-column grid */
|
|
22
|
+
.product-layout-control-container ue-switcher {
|
|
23
|
+
justify-self: end;
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
/* Hide drag icon for list layout (ordering disabled) — legacy UE-ORDERABLE */
|
|
22
27
|
ue-orderable.orderable-disabled .droppable-icon {
|
|
23
28
|
display: none;
|
|
@@ -194,6 +199,36 @@ ue-orderable.orderable-disabled .droppable-icon {
|
|
|
194
199
|
font-weight: 400;
|
|
195
200
|
line-height: 16px;
|
|
196
201
|
}
|
|
202
|
+
|
|
203
|
+
/* ─── Sync Info Message ─────────────────────────────────────────────── */
|
|
204
|
+
/* Shown above tabs in sub-block panels (Name, Button, Image) to indicate
|
|
205
|
+
that editing applies to all product cards. Same structure as migration info. */
|
|
206
|
+
|
|
207
|
+
.sync-info-message {
|
|
208
|
+
display: flex;
|
|
209
|
+
align-items: flex-start;
|
|
210
|
+
gap: 8px;
|
|
211
|
+
padding: 12px;
|
|
212
|
+
margin: 16px 16px 0;
|
|
213
|
+
background: var(--guido-color-background-onpage-message-info);
|
|
214
|
+
border: 1px solid var(--guido-color-border-onpage-message-info);
|
|
215
|
+
border-radius: 4px;
|
|
216
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.sync-info-message__icon {
|
|
220
|
+
flex-shrink: 0;
|
|
221
|
+
width: 24px;
|
|
222
|
+
height: 24px;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.sync-info-message__text {
|
|
226
|
+
margin: 4px 0;
|
|
227
|
+
white-space: normal;
|
|
228
|
+
font-size: 13px;
|
|
229
|
+
font-weight: 400;
|
|
230
|
+
line-height: 16px;
|
|
231
|
+
}
|
|
197
232
|
`;
|
|
198
233
|
export {
|
|
199
234
|
n as default
|