@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.
- package/dist/components/organisms/header/EditorActions.vue.js +10 -8
- package/dist/components/organisms/header/EditorActions.vue2.js +41 -31
- package/dist/components/organisms/header/MigrationConfirmModal.vue.js +17 -0
- package/dist/components/organisms/header/MigrationConfirmModal.vue2.js +39 -0
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +1 -1
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +2 -2
- package/dist/config/compiler/unsubscribeCompilerRules.js +14 -14
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +29 -18
- package/dist/config/i18n/en/labels.json.js +8 -3
- package/dist/config/migrator/itemsBlockMigrator.js +135 -131
- package/dist/config/migrator/recommendationMigrator.js +58 -54
- package/dist/enums/block.js +4 -0
- package/dist/extensions/Blocks/Items/block.js +30 -21
- package/dist/extensions/Blocks/Items/iconsRegistry.js +7 -6
- package/dist/extensions/Blocks/Items/items.css.js +48 -0
- package/dist/extensions/Blocks/Recommendation/block.js +64 -34
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
- 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/constants/selectors.js +15 -12
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +4 -4
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +693 -144
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +78 -0
- 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} +34 -23
- 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 +202 -200
- 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 +94 -100
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +65 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +20 -18
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +5 -4
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +209 -2
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +135 -111
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +9 -7
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +63 -34
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +25 -28
- package/dist/extensions/Blocks/Recommendation/templates/index.js +8 -8
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +28 -13
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +25 -44
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +62 -38
- package/dist/extensions/Blocks/common-control.js +96 -39
- package/dist/guido.css +1 -1
- package/dist/src/@types/extensions/block.d.ts +2 -0
- package/dist/src/App.vue.d.ts +3 -1
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/MigrationConfirmModal.vue.d.ts +6 -0
- package/dist/src/components/wrappers/WpModal.vue.d.ts +2 -2
- package/dist/src/enums/block.d.ts +4 -0
- package/dist/src/extensions/Blocks/Items/block.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +4 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +9 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +134 -44
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +105 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +3 -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 +6 -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 +2 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +10 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +37 -2
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +13 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +29 -2
- package/dist/src/stores/template.d.ts +29 -0
- package/dist/src/utils/migrationBannerHtml.d.ts +2 -0
- package/dist/static/assets/info.svg.js +5 -0
- package/dist/static/styles/components/wide-panel.css.js +1 -0
- package/dist/static/styles/customEditorStyle.css.js +9 -0
- package/dist/static/styles/variables.css.js +3 -0
- package/dist/stores/template.js +15 -0
- package/dist/utils/migrationBannerHtml.js +21 -0
- package/package.json +3 -2
- 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
1
|
var G = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var h = (
|
|
4
|
-
import {
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { DESKTOP_CONTAINER_SELECTOR as m, MOBILE_CONTAINER_SELECTOR as
|
|
7
|
-
import { SPACING_STEP as S, MAX_SPACING as _, MIN_SPACING as N, DEFAULT_COLUMN_SPACING as C, DEFAULT_ROW_SPACING as
|
|
8
|
-
import { RecommendationConfigService as
|
|
9
|
-
import { useRecommendationExtensionStore as
|
|
10
|
-
import { safeGetStyle as A, safeGetParent as
|
|
11
|
-
import { getCurrentLayout as b, getBlockElement as
|
|
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
|
|
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(
|
|
29
|
-
if (!
|
|
28
|
+
function L(u, c) {
|
|
29
|
+
if (!u)
|
|
30
30
|
return c;
|
|
31
|
-
const t = parseFloat(
|
|
31
|
+
const t = parseFloat(u);
|
|
32
32
|
return Number.isNaN(t) ? c : t;
|
|
33
33
|
}
|
|
34
|
-
class
|
|
34
|
+
class j extends R {
|
|
35
35
|
constructor() {
|
|
36
36
|
super(...arguments);
|
|
37
|
-
h(this, "store",
|
|
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
|
|
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:
|
|
77
|
+
name: n.COLUMN_SPACING,
|
|
75
78
|
minValue: N,
|
|
76
79
|
maxValue: _,
|
|
77
80
|
step: S
|
|
78
81
|
}),
|
|
79
|
-
this._GuLabel({
|
|
82
|
+
this._GuLabel({
|
|
83
|
+
text: this.api.translate("Row Spacing (px)"),
|
|
84
|
+
name: n.ROW_SPACING_LABEL
|
|
85
|
+
}),
|
|
80
86
|
this._GuCounter({
|
|
81
|
-
name:
|
|
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:
|
|
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:
|
|
97
|
+
name: n.MOBILE_COLUMN_SPACING,
|
|
92
98
|
minValue: N,
|
|
93
99
|
maxValue: _,
|
|
94
100
|
step: S
|
|
95
101
|
}),
|
|
96
|
-
this._GuLabel({
|
|
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:
|
|
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()
|
|
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
|
-
*
|
|
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
|
|
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 V {
|
|
|
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
|
/**
|
|
@@ -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
|
|
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
|
|
169
|
-
return
|
|
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
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
|
|
184
|
-
const e = (this.currentNode.querySelector(m) ?? this.currentNode).querySelector(".spacer"),
|
|
185
|
-
return L(
|
|
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
|
-
|
|
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
|
|
204
|
-
l && (
|
|
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
|
-
|
|
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() &&
|
|
212
|
-
}),
|
|
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
|
-
|
|
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
|
|
236
|
+
const o = Array.from(
|
|
231
237
|
e.querySelectorAll(".spacer")
|
|
232
238
|
);
|
|
233
|
-
if (!
|
|
239
|
+
if (!o.length)
|
|
234
240
|
return;
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}),
|
|
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
|
-
|
|
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
|
|
257
|
-
l && (
|
|
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
|
-
|
|
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() &&
|
|
265
|
-
}),
|
|
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
|
-
|
|
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(
|
|
286
|
+
const e = this.currentNode.querySelector(M);
|
|
281
287
|
if (!e)
|
|
282
288
|
return;
|
|
283
|
-
const
|
|
289
|
+
const o = Array.from(
|
|
284
290
|
e.querySelectorAll(".spacer")
|
|
285
291
|
);
|
|
286
|
-
if (!
|
|
292
|
+
if (!o.length)
|
|
287
293
|
return;
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}),
|
|
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
|
|
301
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
-
|
|
345
|
-
|
|
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
|
|
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
11
|
import { ImageControls as c } from "./controls/image/index.js";
|
|
12
|
-
import {
|
|
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 {
|
|
17
|
-
import R from "./
|
|
18
|
-
import
|
|
19
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
],
|
|
33
|
+
u,
|
|
34
|
+
g
|
|
35
|
+
], S = [
|
|
34
36
|
...P,
|
|
35
|
-
...
|
|
36
|
-
],
|
|
37
|
+
...b.flatMap((o) => Object.values(o))
|
|
38
|
+
], K = S.reduce(
|
|
37
39
|
(o, t) => o.addControl(t),
|
|
38
|
-
new r().addBlock(m).withSettingsPanelRegistry(
|
|
39
|
-
).addStyles(
|
|
40
|
+
new r().addBlock(m).withSettingsPanelRegistry(B)
|
|
41
|
+
).addStyles(y).withIconsRegistry(R).build();
|
|
40
42
|
export {
|
|
41
|
-
|
|
43
|
+
K as default
|
|
42
44
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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
|
-
|
|
67
|
+
h as RecommendationIconsRegistry
|
|
67
68
|
};
|