@useinsider/guido 3.15.0 → 3.16.0-beta.0faee0c
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/@types/config/schemas.js +108 -92
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +78 -75
- package/dist/composables/useActionsApi.js +30 -22
- package/dist/composables/useEmailTemplateApplier.js +25 -23
- package/dist/composables/useHtmlValidator.js +108 -106
- package/dist/composables/useStripo.js +30 -29
- package/dist/composables/useTimerClone.js +21 -19
- package/dist/config/i18n/en/labels.json.js +7 -3
- package/dist/config/migrator/checkboxMigrator.js +20 -19
- package/dist/config/migrator/radioButtonMigrator.js +26 -25
- package/dist/config/migrator/recommendation/compositionMapper.js +26 -23
- package/dist/config/migrator/recommendation/htmlBuilder.js +156 -155
- package/dist/extensions/Blocks/Checkbox/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/Checkbox/constants/selectors.js +6 -0
- package/dist/extensions/Blocks/Checkbox/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/Checkbox/extension.js +6 -5
- package/dist/extensions/Blocks/Checkbox/settingsPanel.js +15 -14
- package/dist/extensions/Blocks/Checkbox/template.js +10 -9
- package/dist/extensions/Blocks/Items/block.js +44 -42
- package/dist/extensions/Blocks/Items/template.js +86 -86
- package/dist/extensions/Blocks/RadioButton/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/RadioButton/constants/selectors.js +6 -0
- package/dist/extensions/Blocks/RadioButton/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/RadioButton/extension.js +5 -4
- package/dist/extensions/Blocks/RadioButton/settingsPanel.js +12 -11
- package/dist/extensions/Blocks/RadioButton/template.js +16 -9
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +18 -15
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +5 -9
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +363 -322
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +271 -231
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +98 -113
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +21 -0
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +16 -16
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +16 -16
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +120 -120
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +55 -54
- package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +89 -0
- package/dist/extensions/Blocks/common-control.js +42 -35
- package/dist/extensions/Blocks/controlFactories.js +117 -115
- package/dist/guido.css +1 -1
- package/dist/library.js +11 -7
- package/dist/node_modules/valibot/dist/index.js +230 -216
- package/dist/public/trackingIds.js +8 -0
- package/dist/src/@types/config/schemas.d.ts +20 -0
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useHtmlValidator.d.ts +3 -2
- package/dist/src/config/migrator/recommendation/types.d.ts +1 -0
- package/dist/src/extensions/Blocks/Checkbox/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/Checkbox/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/Checkbox/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/RadioButton/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/RadioButton/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/RadioButton/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +27 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -11
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +47 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +3 -1
- package/dist/src/library.d.ts +1 -0
- package/dist/src/public/trackingIds.d.ts +9 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/dist/src/stores/editor.d.ts +25 -0
- package/dist/src/utils/linkTrackingIds.d.ts +30 -0
- package/dist/stores/editor.js +4 -1
- package/dist/stores/onboarding.js +11 -7
- package/dist/utils/linkTrackingIds.js +56 -0
- package/dist/utils/pairProductVariables.js +105 -99
- package/dist/utils/templatePreparation.js +72 -61
- package/package.json +5 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ModificationDescription as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { DESKTOP_CONTAINER_SELECTOR as
|
|
7
|
-
import { SPACING_STEP as
|
|
1
|
+
var y = Object.defineProperty;
|
|
2
|
+
var M = (u, s, t) => s in u ? y(u, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[s] = t;
|
|
3
|
+
var g = (u, s, t) => M(u, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { ModificationDescription as S } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as E } from "../../../common-control.js";
|
|
6
|
+
import { DESKTOP_CONTAINER_SELECTOR as m, MOBILE_CONTAINER_SELECTOR as L } from "../../constants/selectors.js";
|
|
7
|
+
import { SPACING_STEP as P, MAX_SPACING as G, MIN_SPACING as R, DEFAULT_COLUMN_SPACING as C, DEFAULT_ROW_SPACING as I } from "../../constants/layout.js";
|
|
8
8
|
import { RecommendationConfigService as p } from "../../services/configService.js";
|
|
9
9
|
import { useRecommendationExtensionStore as w } from "../../store/recommendation.js";
|
|
10
|
-
import { safeGetStyle as
|
|
11
|
-
import { getCurrentLayout as
|
|
12
|
-
import { useDebounceFn as
|
|
13
|
-
const
|
|
10
|
+
import { safeGetStyle as f, safeGetParent as B } from "../../utils/tagName.js";
|
|
11
|
+
import { getCurrentLayout as _, getBlockElement as U } from "../main/utils.js";
|
|
12
|
+
import { useDebounceFn as N } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
13
|
+
const V = "recommendation-spacing-control", o = {
|
|
14
14
|
COLUMN_SPACING: "columnSpacing",
|
|
15
15
|
COLUMN_SPACING_LABEL: "columnSpacingLabel",
|
|
16
16
|
ROW_SPACING: "rowSpacing",
|
|
@@ -19,97 +19,67 @@ const U = "recommendation-spacing-control", n = {
|
|
|
19
19
|
MOBILE_COLUMN_SPACING_LABEL: "mobileColumnSpacingLabel",
|
|
20
20
|
MOBILE_ROW_SPACING: "mobileRowSpacing",
|
|
21
21
|
MOBILE_ROW_SPACING_LABEL: "mobileRowSpacingLabel"
|
|
22
|
-
},
|
|
22
|
+
}, b = {
|
|
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 O(u, s) {
|
|
29
29
|
if (!u)
|
|
30
30
|
return s;
|
|
31
31
|
const t = parseFloat(u);
|
|
32
32
|
return Number.isNaN(t) ? s : t;
|
|
33
33
|
}
|
|
34
|
-
class j extends
|
|
34
|
+
class j extends E {
|
|
35
35
|
constructor() {
|
|
36
36
|
super(...arguments);
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
g(this, "store", w());
|
|
38
|
+
g(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
|
+
g(this, "_debouncedOnColumnSpacingChange", N((t) => {
|
|
44
44
|
this._onColumnSpacingChange(t);
|
|
45
45
|
}, 300));
|
|
46
46
|
/**
|
|
47
47
|
* Debounced version of _onRowSpacingChange
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
g(this, "_debouncedOnRowSpacingChange", N((t) => {
|
|
50
50
|
this._onRowSpacingChange(t);
|
|
51
51
|
}, 300));
|
|
52
52
|
/**
|
|
53
53
|
* Debounced version of _onMobileColumnSpacingChange
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
g(this, "_debouncedOnMobileColumnSpacingChange", N((t) => {
|
|
56
56
|
this._onMobileColumnSpacingChange(t);
|
|
57
57
|
}, 300));
|
|
58
58
|
/**
|
|
59
59
|
* Debounced version of _onMobileRowSpacingChange
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
g(this, "_debouncedOnMobileRowSpacingChange", N((t) => {
|
|
62
62
|
this._onMobileRowSpacingChange(t);
|
|
63
63
|
}, 300));
|
|
64
64
|
}
|
|
65
65
|
getId() {
|
|
66
|
-
return
|
|
66
|
+
return V;
|
|
67
67
|
}
|
|
68
68
|
getTemplate() {
|
|
69
69
|
return `
|
|
70
70
|
<div class="spacing-control-container">
|
|
71
|
-
${this.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
text: this.api.translate("Row Spacing (px)"),
|
|
84
|
-
name: n.ROW_SPACING_LABEL
|
|
85
|
-
}),
|
|
86
|
-
this._GuCounter({
|
|
87
|
-
name: n.ROW_SPACING,
|
|
88
|
-
minValue: b,
|
|
89
|
-
maxValue: N,
|
|
90
|
-
step: _
|
|
91
|
-
}),
|
|
92
|
-
this._GuLabel({
|
|
93
|
-
text: this.api.translate("Column Spacing on Mobile (px)"),
|
|
94
|
-
name: n.MOBILE_COLUMN_SPACING_LABEL
|
|
95
|
-
}),
|
|
96
|
-
this._GuCounter({
|
|
97
|
-
name: n.MOBILE_COLUMN_SPACING,
|
|
98
|
-
minValue: b,
|
|
99
|
-
maxValue: N,
|
|
100
|
-
step: _
|
|
101
|
-
}),
|
|
102
|
-
this._GuLabel({
|
|
103
|
-
text: this.api.translate("Row Spacing on Mobile (px)"),
|
|
104
|
-
name: n.MOBILE_ROW_SPACING_LABEL
|
|
105
|
-
}),
|
|
106
|
-
this._GuCounter({
|
|
107
|
-
name: n.MOBILE_ROW_SPACING,
|
|
108
|
-
minValue: b,
|
|
109
|
-
maxValue: N,
|
|
110
|
-
step: _
|
|
111
|
-
})
|
|
112
|
-
])}
|
|
71
|
+
${this._spacingRow("Column Spacing (px)", o.COLUMN_SPACING_LABEL, o.COLUMN_SPACING)}
|
|
72
|
+
${this._spacingRow("Row Spacing (px)", o.ROW_SPACING_LABEL, o.ROW_SPACING)}
|
|
73
|
+
${this._spacingRow(
|
|
74
|
+
"Column Spacing on Mobile (px)",
|
|
75
|
+
o.MOBILE_COLUMN_SPACING_LABEL,
|
|
76
|
+
o.MOBILE_COLUMN_SPACING
|
|
77
|
+
)}
|
|
78
|
+
${this._spacingRow(
|
|
79
|
+
"Row Spacing on Mobile (px)",
|
|
80
|
+
o.MOBILE_ROW_SPACING_LABEL,
|
|
81
|
+
o.MOBILE_ROW_SPACING
|
|
82
|
+
)}
|
|
113
83
|
</div>
|
|
114
84
|
`;
|
|
115
85
|
}
|
|
@@ -122,6 +92,21 @@ class j extends R {
|
|
|
122
92
|
onDestroy() {
|
|
123
93
|
this.unsubscribeOrientation && (this.unsubscribeOrientation(), this.unsubscribeOrientation = null);
|
|
124
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* One label + counter per two-column row, so every spacing field gets the same
|
|
97
|
+
* 16px-padded row the color controls already render instead of sharing one grid.
|
|
98
|
+
*/
|
|
99
|
+
_spacingRow(t, e, n) {
|
|
100
|
+
return this._GuTwoColumns([
|
|
101
|
+
this._GuLabel({ text: this.api.translate(t), name: e }),
|
|
102
|
+
this._GuCounter({
|
|
103
|
+
name: n,
|
|
104
|
+
minValue: R,
|
|
105
|
+
maxValue: G,
|
|
106
|
+
step: P
|
|
107
|
+
})
|
|
108
|
+
]);
|
|
109
|
+
}
|
|
125
110
|
/**
|
|
126
111
|
* Updates spacing control visibility based on layout orientation and mobileLayoutEnabled.
|
|
127
112
|
* - List layout: hide column spacing (products are full-width), hide ALL mobile
|
|
@@ -132,14 +117,14 @@ class j extends R {
|
|
|
132
117
|
_updateSpacingVisibility() {
|
|
133
118
|
if (!this.api)
|
|
134
119
|
return;
|
|
135
|
-
const t = p.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, i = (t.layout || e ||
|
|
136
|
-
this.api.setVisibility(
|
|
137
|
-
|
|
120
|
+
const t = p.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, i = (t.layout || e || _(this.currentNode)) === "grid", { mobileLayoutEnabled: a } = t, r = t.cardsInRow > 1, c = t.mobileCardsInRow > 1;
|
|
121
|
+
this.api.setVisibility(o.COLUMN_SPACING, i && r), this.api.setVisibility(o.COLUMN_SPACING_LABEL, i && r), this.api.setVisibility(o.ROW_SPACING, !0), this.api.setVisibility(o.ROW_SPACING_LABEL, !0), this.api.setVisibility(
|
|
122
|
+
o.MOBILE_COLUMN_SPACING,
|
|
138
123
|
i && a && c
|
|
139
124
|
), this.api.setVisibility(
|
|
140
|
-
|
|
125
|
+
o.MOBILE_COLUMN_SPACING_LABEL,
|
|
141
126
|
i && a && c
|
|
142
|
-
), this.api.setVisibility(
|
|
127
|
+
), this.api.setVisibility(o.MOBILE_ROW_SPACING, i && a), this.api.setVisibility(o.MOBILE_ROW_SPACING_LABEL, i && a);
|
|
143
128
|
}
|
|
144
129
|
/**
|
|
145
130
|
* Reads spacing values from node config first, falls back to DOM styles.
|
|
@@ -148,12 +133,12 @@ class j extends R {
|
|
|
148
133
|
_setFormValues() {
|
|
149
134
|
if (!this.api)
|
|
150
135
|
return;
|
|
151
|
-
const t = p.hasConfig(this.currentNode), e = p.getConfig(this.currentNode),
|
|
136
|
+
const t = p.hasConfig(this.currentNode), e = p.getConfig(this.currentNode), n = t ? e.columnSpacing : this._getStoredColumnSpacing(), i = t ? e.rowSpacing : this._getStoredRowSpacing();
|
|
152
137
|
this.api.updateValues({
|
|
153
|
-
[
|
|
154
|
-
[
|
|
155
|
-
[
|
|
156
|
-
[
|
|
138
|
+
[o.COLUMN_SPACING]: n,
|
|
139
|
+
[o.ROW_SPACING]: i,
|
|
140
|
+
[o.MOBILE_COLUMN_SPACING]: e.mobileColumnSpacing,
|
|
141
|
+
[o.MOBILE_ROW_SPACING]: e.mobileRowSpacing
|
|
157
142
|
});
|
|
158
143
|
}
|
|
159
144
|
/**
|
|
@@ -165,20 +150,20 @@ class j extends R {
|
|
|
165
150
|
*/
|
|
166
151
|
_getStoredColumnSpacing() {
|
|
167
152
|
if (!this.currentNode)
|
|
168
|
-
return
|
|
169
|
-
const t = this.currentNode.querySelector(
|
|
170
|
-
if (
|
|
171
|
-
const h = t.querySelector(".recommendation-attribute-row"), l = (h == null ? void 0 : h.querySelector("td")) ?? null, d =
|
|
153
|
+
return C;
|
|
154
|
+
const t = this.currentNode.querySelector(m) ?? this.currentNode;
|
|
155
|
+
if (_(this.currentNode) === "grid") {
|
|
156
|
+
const h = t.querySelector(".recommendation-attribute-row"), l = (h == null ? void 0 : h.querySelector("td")) ?? null, d = f(l, "padding");
|
|
172
157
|
if (!d)
|
|
173
|
-
return
|
|
174
|
-
const
|
|
175
|
-
return
|
|
158
|
+
return C;
|
|
159
|
+
const A = d.trim().split(/\s+/);
|
|
160
|
+
return A.length < 2 ? C : O(A[1], C / 2) * 2;
|
|
176
161
|
}
|
|
177
|
-
const
|
|
162
|
+
const n = t.querySelector(".product-card-wrapper") ?? null, i = B(n), a = f(i, "padding");
|
|
178
163
|
if (!a)
|
|
179
|
-
return
|
|
164
|
+
return C;
|
|
180
165
|
const r = a.trim().split(/\s+/);
|
|
181
|
-
return r.length < 2 ?
|
|
166
|
+
return r.length < 2 ? C : O(r[1], C / 2) * 2;
|
|
182
167
|
}
|
|
183
168
|
/**
|
|
184
169
|
* Gets stored row spacing from the first spacer element's height style
|
|
@@ -186,9 +171,9 @@ class j extends R {
|
|
|
186
171
|
*/
|
|
187
172
|
_getStoredRowSpacing() {
|
|
188
173
|
if (!this.currentNode)
|
|
189
|
-
return
|
|
190
|
-
const e = (this.currentNode.querySelector(
|
|
191
|
-
return
|
|
174
|
+
return I;
|
|
175
|
+
const e = (this.currentNode.querySelector(m) ?? this.currentNode).querySelector(".spacer") ?? null, n = f(e, "height");
|
|
176
|
+
return O(n, I);
|
|
192
177
|
}
|
|
193
178
|
// ========================================================================
|
|
194
179
|
// Desktop Spacing Handlers
|
|
@@ -205,9 +190,9 @@ class j extends R {
|
|
|
205
190
|
this.currentNode,
|
|
206
191
|
{ columnSpacing: t },
|
|
207
192
|
`Changed column spacing to ${t}px`
|
|
208
|
-
), this._storeDataAttribute(
|
|
209
|
-
const
|
|
210
|
-
c && (
|
|
193
|
+
), this._storeDataAttribute(b.COLUMN_SPACING, t);
|
|
194
|
+
const n = p.getConfig(this.currentNode).layout || _(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(m);
|
|
195
|
+
c && (n === "grid" ? Array.from(
|
|
211
196
|
c.querySelectorAll(".attribute-cell")
|
|
212
197
|
).forEach((l) => {
|
|
213
198
|
i.modifyHtml(l).setStyle("padding", r);
|
|
@@ -216,7 +201,7 @@ class j extends R {
|
|
|
216
201
|
).forEach((l) => {
|
|
217
202
|
const d = "parent" in l ? l.parent() : void 0;
|
|
218
203
|
d && i.modifyHtml(d).setStyle("padding", r);
|
|
219
|
-
}), i.apply(new
|
|
204
|
+
}), i.apply(new S(`Update column spacing to ${t}px`)));
|
|
220
205
|
}
|
|
221
206
|
/**
|
|
222
207
|
* Handles row spacing changes for desktop.
|
|
@@ -230,19 +215,19 @@ class j extends R {
|
|
|
230
215
|
this.currentNode,
|
|
231
216
|
{ rowSpacing: t },
|
|
232
217
|
`Changed row spacing to ${t}px`
|
|
233
|
-
), this._storeDataAttribute(
|
|
234
|
-
const e = this.currentNode.querySelector(
|
|
218
|
+
), this._storeDataAttribute(b.ROW_SPACING, t);
|
|
219
|
+
const e = this.currentNode.querySelector(m);
|
|
235
220
|
if (!e)
|
|
236
221
|
return;
|
|
237
|
-
const
|
|
222
|
+
const n = Array.from(
|
|
238
223
|
e.querySelectorAll(".spacer")
|
|
239
224
|
);
|
|
240
|
-
if (!
|
|
225
|
+
if (!n.length)
|
|
241
226
|
return;
|
|
242
227
|
const i = this.api.getDocumentModifier(), a = `${t}px`;
|
|
243
|
-
|
|
228
|
+
n.forEach((r) => {
|
|
244
229
|
i.modifyHtml(r).setStyle("height", a);
|
|
245
|
-
}), i.apply(new
|
|
230
|
+
}), i.apply(new S(`Update row spacing to ${t}px`));
|
|
246
231
|
}
|
|
247
232
|
// ========================================================================
|
|
248
233
|
// Mobile Spacing Handlers
|
|
@@ -259,9 +244,9 @@ class j extends R {
|
|
|
259
244
|
this.currentNode,
|
|
260
245
|
{ mobileColumnSpacing: t },
|
|
261
246
|
`Changed mobile column spacing to ${t}px`
|
|
262
|
-
), this._storeDataAttribute(
|
|
263
|
-
const
|
|
264
|
-
c && (
|
|
247
|
+
), this._storeDataAttribute(b.MOBILE_COLUMN_SPACING, t);
|
|
248
|
+
const n = p.getConfig(this.currentNode).layout || _(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(L);
|
|
249
|
+
c && (n === "grid" ? Array.from(
|
|
265
250
|
c.querySelectorAll(".attribute-cell")
|
|
266
251
|
).forEach((l) => {
|
|
267
252
|
i.modifyHtml(l).setStyle("padding", r);
|
|
@@ -270,7 +255,7 @@ class j extends R {
|
|
|
270
255
|
).forEach((l) => {
|
|
271
256
|
const d = "parent" in l ? l.parent() : void 0;
|
|
272
257
|
d && i.modifyHtml(d).setStyle("padding", r);
|
|
273
|
-
}), i.apply(new
|
|
258
|
+
}), i.apply(new S(`Update mobile column spacing to ${t}px`)));
|
|
274
259
|
}
|
|
275
260
|
/**
|
|
276
261
|
* Handles row spacing changes for mobile.
|
|
@@ -284,19 +269,19 @@ class j extends R {
|
|
|
284
269
|
this.currentNode,
|
|
285
270
|
{ mobileRowSpacing: t },
|
|
286
271
|
`Changed mobile row spacing to ${t}px`
|
|
287
|
-
), this._storeDataAttribute(
|
|
288
|
-
const e = this.currentNode.querySelector(
|
|
272
|
+
), this._storeDataAttribute(b.MOBILE_ROW_SPACING, t);
|
|
273
|
+
const e = this.currentNode.querySelector(L);
|
|
289
274
|
if (!e)
|
|
290
275
|
return;
|
|
291
|
-
const
|
|
276
|
+
const n = Array.from(
|
|
292
277
|
e.querySelectorAll(".spacer")
|
|
293
278
|
);
|
|
294
|
-
if (!
|
|
279
|
+
if (!n.length)
|
|
295
280
|
return;
|
|
296
281
|
const i = this.api.getDocumentModifier(), a = `${t}px`;
|
|
297
|
-
|
|
282
|
+
n.forEach((r) => {
|
|
298
283
|
i.modifyHtml(r).setStyle("height", a);
|
|
299
|
-
}), i.apply(new
|
|
284
|
+
}), i.apply(new S(`Update mobile row spacing to ${t}px`));
|
|
300
285
|
}
|
|
301
286
|
// ========================================================================
|
|
302
287
|
// Data Attribute Storage
|
|
@@ -305,23 +290,23 @@ class j extends R {
|
|
|
305
290
|
* Stores a spacing value as a data attribute on the block root element
|
|
306
291
|
*/
|
|
307
292
|
_storeDataAttribute(t, e) {
|
|
308
|
-
const
|
|
309
|
-
|
|
293
|
+
const n = U(this.currentNode);
|
|
294
|
+
n && this.api.getDocumentModifier().modifyHtml(n).setAttribute(t, e.toString()).apply(new S(`Store ${t}`));
|
|
310
295
|
}
|
|
311
296
|
// ========================================================================
|
|
312
297
|
// Event Listeners
|
|
313
298
|
// ========================================================================
|
|
314
299
|
_listenToFormUpdates() {
|
|
315
|
-
this.api.onValueChanged(
|
|
300
|
+
this.api.onValueChanged(o.COLUMN_SPACING, (t) => {
|
|
316
301
|
const e = parseInt(t);
|
|
317
302
|
Number.isNaN(e) || this._debouncedOnColumnSpacingChange(e);
|
|
318
|
-
}), this.api.onValueChanged(
|
|
303
|
+
}), this.api.onValueChanged(o.ROW_SPACING, (t) => {
|
|
319
304
|
const e = parseInt(t);
|
|
320
305
|
Number.isNaN(e) || this._debouncedOnRowSpacingChange(e);
|
|
321
|
-
}), this.api.onValueChanged(
|
|
306
|
+
}), this.api.onValueChanged(o.MOBILE_COLUMN_SPACING, (t) => {
|
|
322
307
|
const e = parseInt(t);
|
|
323
308
|
Number.isNaN(e) || this._debouncedOnMobileColumnSpacingChange(e);
|
|
324
|
-
}), this.api.onValueChanged(
|
|
309
|
+
}), this.api.onValueChanged(o.MOBILE_ROW_SPACING, (t) => {
|
|
325
310
|
const e = parseInt(t);
|
|
326
311
|
Number.isNaN(e) || this._debouncedOnMobileRowSpacingChange(e);
|
|
327
312
|
});
|
|
@@ -337,6 +322,6 @@ class j extends R {
|
|
|
337
322
|
}
|
|
338
323
|
}
|
|
339
324
|
export {
|
|
340
|
-
|
|
325
|
+
V as SPACING_CONTROL_ID,
|
|
341
326
|
j as SpacingControl
|
|
342
327
|
};
|
|
@@ -25,6 +25,27 @@ const n = `/* Utils */
|
|
|
25
25
|
border-top: none;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/* The editor's row-separator rule only reaches \`.container\`s that are direct
|
|
29
|
+
children of \`.container-wrapper\`; the spacing rows sit one level deeper, so the
|
|
30
|
+
first one loses its line. Restore it with the editor's own border token. */
|
|
31
|
+
.spacing-control-container > .container {
|
|
32
|
+
border-top: var(--ue-border-width-1, 1px) solid var(--ue-panels-border-color, rgba(0, 0, 0, 0.07));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* A spacing field that doesn't apply (mobile rows, column spacing in list layout) is
|
|
36
|
+
removed from its row and leaves the wrapper behind — collapse it so it can't
|
|
37
|
+
render as an empty separator-topped strip. */
|
|
38
|
+
.spacing-control-container > .container:not(:has(ue-counter)) {
|
|
39
|
+
display: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* The block background row stacks the editor's "inherits background color" banner
|
|
43
|
+
above its field, separated by the editor's default 10px gap — match the tab's 16px.
|
|
44
|
+
Scoped via the spacing control so other blocks keep the default. */
|
|
45
|
+
.ue-scrollable-content:has(.spacing-control-container) .e2e-block-bg-color {
|
|
46
|
+
row-gap: 16px;
|
|
47
|
+
}
|
|
48
|
+
|
|
28
49
|
/* Right-align the mobile layout toggle within the two-column grid */
|
|
29
50
|
.product-layout-control-container ue-switcher {
|
|
30
51
|
justify-self: end;
|
|
@@ -28,10 +28,10 @@ const G = `
|
|
|
28
28
|
{-{-CELLS-}-}
|
|
29
29
|
</tr>
|
|
30
30
|
`;
|
|
31
|
-
function j(
|
|
32
|
-
const { cellPadding: s = k, cardBackgroundColor: u, visibility: a, priceInline:
|
|
31
|
+
function j(t, r, o, e = Y, c = {}, i = {}) {
|
|
32
|
+
const { cellPadding: s = k, cardBackgroundColor: u, visibility: a, priceInline: n = !1 } = i, d = (100 / r).toFixed(2), p = r - t.length, T = p > 0 ? x(d, s).repeat(p) : "", m = B(o, e, c), R = F(e), L = n ? e.filter((l) => l !== R.skip) : e, C = I(f, i), P = I(O, i);
|
|
33
33
|
return L.filter((l) => m[l]).map((l) => {
|
|
34
|
-
const _ = (a == null ? void 0 : a[l]) ?? W[l] ?? !0, b = _ ? "" : 'style="display: none;"', S = I(l, i), D =
|
|
34
|
+
const _ = (a == null ? void 0 : a[l]) ?? W[l] ?? !0, b = _ ? "" : 'style="display: none;"', S = I(l, i, e), D = t.map((E) => (n && l === R.anchor ? H(
|
|
35
35
|
E,
|
|
36
36
|
R.originalFirst,
|
|
37
37
|
C,
|
|
@@ -41,36 +41,36 @@ function j(e, t, n, r = Y, c = {}, i = {}) {
|
|
|
41
41
|
return V.replace("{-{-ATTR_TYPE-}-}", l).replace("{-{-VISIBILITY-}-}", _ ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", b).replace("{-{-CELLS-}-}", D + T);
|
|
42
42
|
}).join("");
|
|
43
43
|
}
|
|
44
|
-
function v(
|
|
44
|
+
function v(t, r, o, e, c = {}, i = {}) {
|
|
45
45
|
const s = [];
|
|
46
|
-
for (let
|
|
47
|
-
s.push(
|
|
46
|
+
for (let n = 0; n < t.length; n += r)
|
|
47
|
+
s.push(t.slice(n, n + r));
|
|
48
48
|
const u = h(i.rowSpacingPx);
|
|
49
|
-
return s.map((
|
|
49
|
+
return s.map((n, d) => {
|
|
50
50
|
const p = j(
|
|
51
|
-
o,
|
|
52
|
-
t,
|
|
53
51
|
n,
|
|
54
52
|
r,
|
|
53
|
+
o,
|
|
54
|
+
e,
|
|
55
55
|
c,
|
|
56
56
|
i
|
|
57
57
|
), T = G.replace("{-{-ATTRIBUTE_ROWS-}-}", p);
|
|
58
58
|
return d > 0 ? u + T : T;
|
|
59
59
|
}).join("");
|
|
60
60
|
}
|
|
61
|
-
function M(
|
|
61
|
+
function M(t, r, o, e = {}, c = {}) {
|
|
62
62
|
return v(
|
|
63
|
-
e,
|
|
64
63
|
t,
|
|
65
|
-
y,
|
|
66
|
-
n,
|
|
67
64
|
r,
|
|
65
|
+
y,
|
|
66
|
+
o,
|
|
67
|
+
e,
|
|
68
68
|
c
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
|
-
function Q(
|
|
72
|
-
const
|
|
73
|
-
return
|
|
71
|
+
function Q(t) {
|
|
72
|
+
const r = t ? `ins-recommendation-v3-block-${t}` : void 0, o = U("grid", r), e = A(), c = M(e, w);
|
|
73
|
+
return o.replace("{-{-TITLE-}-}", g.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
|
|
74
74
|
}
|
|
75
75
|
export {
|
|
76
76
|
Q as getDefaultTemplate,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_IMAGE as p, ATTR_PRODUCT_BUTTON as C, ATTR_PRODUCT_OLD_PRICE as A, ATTR_PRODUCT_PRICE as
|
|
2
|
-
import { buildSpacer as
|
|
1
|
+
import { ATTR_PRODUCT_IMAGE as p, ATTR_PRODUCT_BUTTON as C, ATTR_PRODUCT_OLD_PRICE as A, ATTR_PRODUCT_PRICE as I } from "../../constants/selectors.js";
|
|
2
|
+
import { buildSpacer as m, DEFAULT_CARD_COMPOSITION as g, buildElementRenderer as E, buildCellOptions as i, resolveInlinePriceOrder as w, DEFAULT_CARD_VISIBILITY as y } from "../utils.js";
|
|
3
3
|
import { listElementRenderer as L, renderInlineListPriceRow as O } from "./elementRenderer.js";
|
|
4
4
|
const S = "0 5px";
|
|
5
5
|
function U(l, r, n) {
|
|
6
|
-
const
|
|
6
|
+
const t = n ? "" : ' style="display: none;"', o = l.replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
7
7
|
return `<tr
|
|
8
8
|
class="recommendation-attribute-row"
|
|
9
9
|
data-attribute-type="${r}"
|
|
10
|
-
data-visibility="${n ? "1" : "0"}"${
|
|
10
|
+
data-visibility="${n ? "1" : "0"}"${t}>${o}</tr>`;
|
|
11
11
|
}
|
|
12
12
|
const N = `
|
|
13
13
|
<tr class="recommendation-product-row">
|
|
@@ -27,36 +27,36 @@ const N = `
|
|
|
27
27
|
</td>
|
|
28
28
|
</tr>
|
|
29
29
|
`;
|
|
30
|
-
function x(l, r = g, n = {},
|
|
30
|
+
function x(l, r = g, n = {}, t = {}) {
|
|
31
31
|
const {
|
|
32
32
|
cellPadding: o = S,
|
|
33
33
|
cardBackgroundColor: d,
|
|
34
34
|
visibility: c,
|
|
35
35
|
priceInline: a = !1
|
|
36
|
-
} =
|
|
36
|
+
} = t, u = d ? ` style="table-layout: fixed; background-color: ${d};"` : ' style="table-layout: fixed;"', s = E(L, r, n), P = s[p](l, i(p, t)), R = w(r), T = `
|
|
37
37
|
<td class="product-info-cell" valign="middle" style="padding: 15px;">
|
|
38
38
|
<table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="table-layout: fixed;">
|
|
39
39
|
<tbody>
|
|
40
|
-
${r.filter((
|
|
41
|
-
const b = (c == null ? void 0 : c[
|
|
40
|
+
${r.filter((e) => e !== p && e !== C).filter((e) => !(a && e === R.skip)).filter((e) => s[e]).map((e) => {
|
|
41
|
+
const b = (c == null ? void 0 : c[e]) ?? y[e] ?? !0, f = a && e === R.anchor ? O(
|
|
42
42
|
l,
|
|
43
43
|
R.originalFirst,
|
|
44
|
-
i(
|
|
45
|
-
i(A,
|
|
46
|
-
) : s[
|
|
47
|
-
return U(f,
|
|
44
|
+
i(I, t),
|
|
45
|
+
i(A, t)
|
|
46
|
+
) : s[e](l, i(e, t, r));
|
|
47
|
+
return U(f, e, b);
|
|
48
48
|
}).join(`
|
|
49
49
|
`)}
|
|
50
50
|
</tbody>
|
|
51
51
|
</table>
|
|
52
52
|
</td>
|
|
53
|
-
`, _ = s[C](l, i(C,
|
|
53
|
+
`, _ = s[C](l, i(C, t)), D = P + T + _;
|
|
54
54
|
return N.replace("{-{-CARD_PADDING-}-}", o).replace("{-{-WRAPPER_STYLE-}-}", u).replace("{-{-PRODUCT_CONTENT-}-}", D);
|
|
55
55
|
}
|
|
56
|
-
function W(l, r, n = {},
|
|
57
|
-
const o =
|
|
56
|
+
function W(l, r, n = {}, t = {}) {
|
|
57
|
+
const o = m(t.rowSpacingPx);
|
|
58
58
|
return l.map((d, c) => {
|
|
59
|
-
const a = x(d, r, n,
|
|
59
|
+
const a = x(d, r, n, t);
|
|
60
60
|
return c > 0 ? o + a : a;
|
|
61
61
|
}).join("");
|
|
62
62
|
}
|