@useinsider/guido 3.20.1 → 3.21.0-beta.0df5409
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/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +65 -64
- package/dist/components/organisms/AutoSaveController.vue2.js +10 -9
- package/dist/components/organisms/header/EditorActions.vue.js +4 -4
- package/dist/components/organisms/header/EditorActions.vue2.js +53 -51
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +23 -22
- package/dist/composables/useActionsApi.js +80 -63
- package/dist/composables/useAutoSave.js +46 -44
- package/dist/composables/useGuidoStateBridge.js +3 -3
- package/dist/composables/useLegacyStrategyConversion.js +16 -16
- package/dist/composables/useSave.js +26 -23
- package/dist/composables/useSaveValidation.js +113 -114
- package/dist/composables/useSaveValidationRollout.js +17 -6
- package/dist/composables/useStripo.js +11 -10
- package/dist/extensions/Blocks/Items/block.js +43 -42
- package/dist/extensions/Blocks/Recommendation/block.js +33 -29
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +78 -83
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +1 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +2 -12
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +104 -86
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +348 -263
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +48 -50
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +16 -21
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +44 -40
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +14 -19
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +104 -102
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +18 -23
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +312 -286
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +24 -20
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +6 -7
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +113 -151
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +221 -203
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +28 -0
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/currencySettings.js +25 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +111 -40
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +31 -35
- package/dist/extensions/Blocks/Unsubscribe/block.js +70 -75
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +271 -192
- package/dist/package.json.js +1 -1
- package/dist/services/settingsApi.js +11 -0
- package/dist/src/components/Guido.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/composables/useActionsApi.d.ts +5 -1
- package/dist/src/composables/useAutoSave.d.ts +4 -1
- package/dist/src/composables/useSaveValidationRollout.d.ts +1 -0
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +8 -0
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +40 -0
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +5 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +21 -12
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +6 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +6 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +21 -9
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +19 -13
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +10 -8
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +9 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +9 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +17 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/currencySettings.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +18 -11
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +1 -6
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +22 -0
- package/dist/src/services/settingsApi.d.ts +6 -0
- package/dist/src/stores/editor.d.ts +3 -1
- package/dist/src/stores/setup-settings.d.ts +4 -0
- package/dist/static/styles/components/button.css.js +5 -0
- package/dist/stores/editor.js +5 -0
- package/dist/stores/setup-settings.js +10 -0
- package/package.json +4 -4
|
@@ -1,38 +1,42 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
const r = "ins-recommendation-desktop-container",
|
|
3
|
-
function
|
|
4
|
-
return !!t.querySelector(
|
|
1
|
+
import { ModificationDescription as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
const r = "ins-recommendation-desktop-container", a = "ins-recommendation-mobile-container", i = "ins-recommendation-list-layout", s = "ins-recommendation-no-mobile-layout", m = `.${a} { display: none; }`, p = `@media only screen and (max-width: 480px) { .${r} { display: none !important; } .${a} { display: table !important; } .${i} .${r} { display: table !important; } .${i} .${a}, .${i} .ins-recommendation-mobile-row { display: none !important; } .${i} .product-image-cell { width: 80px !important; } .${i} .product-image-cell img { max-width: 80px !important; } .${i} .button-cell { width: 80px !important; } .${i} .product-info-cell { padding: 5px 8px !important; } }`, d = `@media only screen and (max-width: 480px) { .${s} .${r} { display: table !important; } .${s} .${a}, .${s} .ins-recommendation-mobile-row { display: none !important; } }`, c = `.${a}`;
|
|
3
|
+
function f(t, o) {
|
|
4
|
+
return !!t.querySelector(o);
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function y(t) {
|
|
7
7
|
return t.querySelectorAll(`*${r}`).length > 0;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function _(t) {
|
|
10
10
|
return t.querySelectorAll(`*${s}`).length > 0;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function C(t, o) {
|
|
13
13
|
const e = t.getDocumentRootCssNode();
|
|
14
14
|
if (!e)
|
|
15
|
-
return;
|
|
16
|
-
const
|
|
17
|
-
let
|
|
18
|
-
|
|
15
|
+
return !1;
|
|
16
|
+
const n = o ?? t.getDocumentModifier();
|
|
17
|
+
let l = !1;
|
|
18
|
+
return f(e, c) || (n.modifyCss(e).appendRule(m), l = !0), y(e) || (n.modifyCss(e).appendRule(p), l = !0), _(e) || (n.modifyCss(e).appendRule(d), l = !0), l && !o && n.apply(new u("Add mobile layout CSS rules")), l;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function L(t) {
|
|
21
21
|
return "hasClass" in t ? t.hasClass(s) : !1;
|
|
22
22
|
}
|
|
23
|
-
function O(t,
|
|
23
|
+
function O(t, o, e) {
|
|
24
|
+
e ? t.modifyHtml(o).setClass(s) : t.modifyHtml(o).removeClass(s);
|
|
25
|
+
}
|
|
26
|
+
function $(t, o, e) {
|
|
24
27
|
const n = t.getDocumentModifier();
|
|
25
|
-
|
|
26
|
-
new
|
|
27
|
-
|
|
28
|
+
O(n, o, e), n.apply(
|
|
29
|
+
new u(
|
|
30
|
+
e ? "Opt out of mobile layout" : "Opt in to mobile layout"
|
|
28
31
|
)
|
|
29
32
|
);
|
|
30
33
|
}
|
|
31
34
|
export {
|
|
32
35
|
r as CSS_CLASS_DESKTOP_CONTAINER,
|
|
33
|
-
|
|
36
|
+
a as CSS_CLASS_MOBILE_CONTAINER,
|
|
34
37
|
s as CSS_CLASS_NO_MOBILE_LAYOUT,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
C as ensureMobileCssRulesExist,
|
|
39
|
+
L as hasMobileLayoutOptOut,
|
|
40
|
+
$ as setMobileLayoutOptOut,
|
|
41
|
+
O as stageMobileLayoutOptOut
|
|
38
42
|
};
|
|
@@ -3,7 +3,7 @@ import { CommonControl as u } from "../../../common-control.js";
|
|
|
3
3
|
import { RecommendationBlockId as a } from "../../constants/blockIds.js";
|
|
4
4
|
import { RecommendationControlId as d } from "../../constants/controlIds.js";
|
|
5
5
|
import { BLOCK_ROOT_SELECTOR as m } from "../../constants/selectors.js";
|
|
6
|
-
import { CSS_CLASS_TEXT_TRIM as
|
|
6
|
+
import { CSS_CLASS_TEXT_TRIM as o, ensureTextTrimCssRulesExist as T } from "../shared/textTrimCssRules.js";
|
|
7
7
|
const s = {
|
|
8
8
|
TEXT_TRIM_ENABLED: "textTrimEnabled"
|
|
9
9
|
};
|
|
@@ -37,7 +37,7 @@ class N extends u {
|
|
|
37
37
|
_getCurrentTrimState() {
|
|
38
38
|
if (!this.currentNode || !("hasClass" in this.currentNode))
|
|
39
39
|
return !1;
|
|
40
|
-
if (this.currentNode.hasClass(
|
|
40
|
+
if (this.currentNode.hasClass(o))
|
|
41
41
|
return !0;
|
|
42
42
|
const e = this.currentNode.closest(m);
|
|
43
43
|
if (!e)
|
|
@@ -45,7 +45,7 @@ class N extends u {
|
|
|
45
45
|
const t = e.querySelector(
|
|
46
46
|
`[esd-extension-block-id="${a.NAME}"]`
|
|
47
47
|
);
|
|
48
|
-
return t && "hasClass" in t ? t.hasClass(
|
|
48
|
+
return t && "hasClass" in t ? t.hasClass(o) : !1;
|
|
49
49
|
}
|
|
50
50
|
_onTextTrimChange(e) {
|
|
51
51
|
if (!this.currentNode || !("closest" in this.currentNode))
|
|
@@ -58,11 +58,10 @@ class N extends u {
|
|
|
58
58
|
);
|
|
59
59
|
if (!i.length)
|
|
60
60
|
return;
|
|
61
|
-
|
|
62
|
-
const o = this.api.getDocumentModifier();
|
|
61
|
+
const r = this.api.getDocumentModifier();
|
|
63
62
|
i.forEach((n) => {
|
|
64
|
-
e ?
|
|
65
|
-
}),
|
|
63
|
+
e ? r.modifyHtml(n).setClass(o) : r.modifyHtml(n).removeClass(o);
|
|
64
|
+
}), e && T(this.api, r), r.apply(
|
|
66
65
|
new l(
|
|
67
66
|
e ? "Enable product name text trimming" : "Disable product name text trimming"
|
|
68
67
|
)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
const t = "text-trim-enabled",
|
|
3
|
-
function
|
|
1
|
+
import { ModificationDescription as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
const t = "text-trim-enabled", c = `.${t}`, S = `.${t} p`, T = `.${t} { max-width: 0; }`, d = `.${t} p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; display: block; }`;
|
|
3
|
+
function R(n, r) {
|
|
4
4
|
const e = n.getDocumentRootCssNode();
|
|
5
5
|
if (!e)
|
|
6
|
-
return;
|
|
7
|
-
const
|
|
8
|
-
let
|
|
9
|
-
e.querySelector(
|
|
6
|
+
return !1;
|
|
7
|
+
const s = r ?? n.getDocumentModifier();
|
|
8
|
+
let o = !1;
|
|
9
|
+
return e.querySelector(c) || (s.modifyCss(e).appendRule(T), o = !0), e.querySelectorAll(`*${t}`).some((i) => "getSelector" in i && typeof i.getSelector == "function" && i.getSelector() === S) || (s.modifyCss(e).appendRule(d), o = !0), o && !r && s.apply(new l("Add text trim CSS rules")), o;
|
|
10
10
|
}
|
|
11
11
|
export {
|
|
12
12
|
t as CSS_CLASS_TEXT_TRIM,
|
|
13
|
-
|
|
13
|
+
R as ensureTextTrimCssRulesExist
|
|
14
14
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ModificationDescription as
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var P = (s, r, t) => r in s ? M(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t;
|
|
3
|
+
var l = (s, r, t) => P(s, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
import { ModificationDescription as _ } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as E } from "../../../common-control.js";
|
|
6
|
-
import { DESKTOP_CONTAINER_SELECTOR as
|
|
7
|
-
import { SPACING_STEP as
|
|
8
|
-
import { RecommendationConfigService as
|
|
6
|
+
import { DESKTOP_CONTAINER_SELECTOR as S, MOBILE_CONTAINER_SELECTOR as I } from "../../constants/selectors.js";
|
|
7
|
+
import { SPACING_STEP as G, MAX_SPACING as R, MIN_SPACING as y, DEFAULT_COLUMN_SPACING as p, DEFAULT_ROW_SPACING as f } from "../../constants/layout.js";
|
|
8
|
+
import { RecommendationConfigService as u } from "../../services/configService.js";
|
|
9
9
|
import { useRecommendationExtensionStore as w } from "../../store/recommendation.js";
|
|
10
|
-
import { safeGetStyle as
|
|
11
|
-
import { getCurrentLayout as
|
|
10
|
+
import { safeGetStyle as O, safeGetParent as B } from "../../utils/tagName.js";
|
|
11
|
+
import { getCurrentLayout as b, getBlockElement as U } from "../main/utils.js";
|
|
12
12
|
import { useDebounceFn as N } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
13
|
-
const V = "recommendation-spacing-control",
|
|
13
|
+
const V = "recommendation-spacing-control", e = {
|
|
14
14
|
COLUMN_SPACING: "columnSpacing",
|
|
15
15
|
COLUMN_SPACING_LABEL: "columnSpacingLabel",
|
|
16
16
|
ROW_SPACING: "rowSpacing",
|
|
@@ -19,46 +19,46 @@ const V = "recommendation-spacing-control", o = {
|
|
|
19
19
|
MOBILE_COLUMN_SPACING_LABEL: "mobileColumnSpacingLabel",
|
|
20
20
|
MOBILE_ROW_SPACING: "mobileRowSpacing",
|
|
21
21
|
MOBILE_ROW_SPACING_LABEL: "mobileRowSpacingLabel"
|
|
22
|
-
},
|
|
22
|
+
}, m = {
|
|
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
|
|
29
|
-
if (!
|
|
30
|
-
return
|
|
31
|
-
const t = parseFloat(
|
|
32
|
-
return Number.isNaN(t) ?
|
|
28
|
+
function L(s, r) {
|
|
29
|
+
if (!s)
|
|
30
|
+
return r;
|
|
31
|
+
const t = parseFloat(s);
|
|
32
|
+
return Number.isNaN(t) ? r : t;
|
|
33
33
|
}
|
|
34
|
-
class
|
|
34
|
+
class k extends E {
|
|
35
35
|
constructor() {
|
|
36
36
|
super(...arguments);
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
l(this, "store", w());
|
|
38
|
+
l(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
|
+
l(this, "_debouncedOnColumnSpacingChange", N((t) => {
|
|
44
44
|
this._onColumnSpacingChange(t);
|
|
45
45
|
}, 300));
|
|
46
46
|
/**
|
|
47
47
|
* Debounced version of _onRowSpacingChange
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
l(this, "_debouncedOnRowSpacingChange", N((t) => {
|
|
50
50
|
this._onRowSpacingChange(t);
|
|
51
51
|
}, 300));
|
|
52
52
|
/**
|
|
53
53
|
* Debounced version of _onMobileColumnSpacingChange
|
|
54
54
|
*/
|
|
55
|
-
|
|
55
|
+
l(this, "_debouncedOnMobileColumnSpacingChange", N((t) => {
|
|
56
56
|
this._onMobileColumnSpacingChange(t);
|
|
57
57
|
}, 300));
|
|
58
58
|
/**
|
|
59
59
|
* Debounced version of _onMobileRowSpacingChange
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
l(this, "_debouncedOnMobileRowSpacingChange", N((t) => {
|
|
62
62
|
this._onMobileRowSpacingChange(t);
|
|
63
63
|
}, 300));
|
|
64
64
|
}
|
|
@@ -68,17 +68,17 @@ class j extends E {
|
|
|
68
68
|
getTemplate() {
|
|
69
69
|
return `
|
|
70
70
|
<div class="spacing-control-container">
|
|
71
|
-
${this._spacingRow("Column Spacing (px)",
|
|
72
|
-
${this._spacingRow("Row Spacing (px)",
|
|
71
|
+
${this._spacingRow("Column Spacing (px)", e.COLUMN_SPACING_LABEL, e.COLUMN_SPACING)}
|
|
72
|
+
${this._spacingRow("Row Spacing (px)", e.ROW_SPACING_LABEL, e.ROW_SPACING)}
|
|
73
73
|
${this._spacingRow(
|
|
74
74
|
"Column Spacing on Mobile (px)",
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
e.MOBILE_COLUMN_SPACING_LABEL,
|
|
76
|
+
e.MOBILE_COLUMN_SPACING
|
|
77
77
|
)}
|
|
78
78
|
${this._spacingRow(
|
|
79
79
|
"Row Spacing on Mobile (px)",
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
e.MOBILE_ROW_SPACING_LABEL,
|
|
81
|
+
e.MOBILE_ROW_SPACING
|
|
82
82
|
)}
|
|
83
83
|
</div>
|
|
84
84
|
`;
|
|
@@ -96,14 +96,14 @@ class j extends E {
|
|
|
96
96
|
* One label + counter per two-column row, so every spacing field gets the same
|
|
97
97
|
* 16px-padded row the color controls already render instead of sharing one grid.
|
|
98
98
|
*/
|
|
99
|
-
_spacingRow(t,
|
|
99
|
+
_spacingRow(t, i, o) {
|
|
100
100
|
return this._GuTwoColumns([
|
|
101
|
-
this._GuLabel({ text: this.api.translate(t), name:
|
|
101
|
+
this._GuLabel({ text: this.api.translate(t), name: i }),
|
|
102
102
|
this._GuCounter({
|
|
103
|
-
name:
|
|
104
|
-
minValue:
|
|
105
|
-
maxValue:
|
|
106
|
-
step:
|
|
103
|
+
name: o,
|
|
104
|
+
minValue: y,
|
|
105
|
+
maxValue: R,
|
|
106
|
+
step: G
|
|
107
107
|
})
|
|
108
108
|
]);
|
|
109
109
|
}
|
|
@@ -117,14 +117,14 @@ class j extends E {
|
|
|
117
117
|
_updateSpacingVisibility() {
|
|
118
118
|
if (!this.api)
|
|
119
119
|
return;
|
|
120
|
-
const t =
|
|
121
|
-
this.api.setVisibility(
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
const t = u.getConfig(this.currentNode), i = this.store.recommendationConfigs.orientation, n = (t.layout || i || b(this.currentNode)) === "grid", { mobileLayoutEnabled: a } = t, c = t.cardsInRow > 1, g = t.mobileCardsInRow > 1;
|
|
121
|
+
this.api.setVisibility(e.COLUMN_SPACING, n && c), this.api.setVisibility(e.COLUMN_SPACING_LABEL, n && c), this.api.setVisibility(e.ROW_SPACING, !0), this.api.setVisibility(e.ROW_SPACING_LABEL, !0), this.api.setVisibility(
|
|
122
|
+
e.MOBILE_COLUMN_SPACING,
|
|
123
|
+
n && a && g
|
|
124
124
|
), this.api.setVisibility(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
), this.api.setVisibility(
|
|
125
|
+
e.MOBILE_COLUMN_SPACING_LABEL,
|
|
126
|
+
n && a && g
|
|
127
|
+
), this.api.setVisibility(e.MOBILE_ROW_SPACING, n && a), this.api.setVisibility(e.MOBILE_ROW_SPACING_LABEL, n && a);
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
130
|
* Reads spacing values from node config first, falls back to DOM styles.
|
|
@@ -133,12 +133,12 @@ class j extends E {
|
|
|
133
133
|
_setFormValues() {
|
|
134
134
|
if (!this.api)
|
|
135
135
|
return;
|
|
136
|
-
const t =
|
|
136
|
+
const t = u.hasConfig(this.currentNode), i = u.getConfig(this.currentNode), o = t ? i.columnSpacing : this._getStoredColumnSpacing(), n = t ? i.rowSpacing : this._getStoredRowSpacing();
|
|
137
137
|
this.api.updateValues({
|
|
138
|
-
[
|
|
139
|
-
[
|
|
140
|
-
[
|
|
141
|
-
[
|
|
138
|
+
[e.COLUMN_SPACING]: o,
|
|
139
|
+
[e.ROW_SPACING]: n,
|
|
140
|
+
[e.MOBILE_COLUMN_SPACING]: i.mobileColumnSpacing,
|
|
141
|
+
[e.MOBILE_ROW_SPACING]: i.mobileRowSpacing
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
@@ -150,20 +150,20 @@ class j extends E {
|
|
|
150
150
|
*/
|
|
151
151
|
_getStoredColumnSpacing() {
|
|
152
152
|
if (!this.currentNode)
|
|
153
|
-
return
|
|
154
|
-
const t = this.currentNode.querySelector(
|
|
155
|
-
if (
|
|
156
|
-
const
|
|
157
|
-
if (!
|
|
158
|
-
return
|
|
159
|
-
const A =
|
|
160
|
-
return A.length < 2 ?
|
|
153
|
+
return p;
|
|
154
|
+
const t = this.currentNode.querySelector(S) ?? this.currentNode;
|
|
155
|
+
if (b(this.currentNode) === "grid") {
|
|
156
|
+
const d = t.querySelector(".recommendation-attribute-row"), C = (d == null ? void 0 : d.querySelector("td")) ?? null, h = O(C, "padding");
|
|
157
|
+
if (!h)
|
|
158
|
+
return p;
|
|
159
|
+
const A = h.trim().split(/\s+/);
|
|
160
|
+
return A.length < 2 ? p : L(A[1], p / 2) * 2;
|
|
161
161
|
}
|
|
162
|
-
const
|
|
162
|
+
const o = t.querySelector(".product-card-wrapper") ?? null, n = B(o), a = O(n, "padding");
|
|
163
163
|
if (!a)
|
|
164
|
-
return
|
|
165
|
-
const
|
|
166
|
-
return
|
|
164
|
+
return p;
|
|
165
|
+
const c = a.trim().split(/\s+/);
|
|
166
|
+
return c.length < 2 ? p : L(c[1], p / 2) * 2;
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
169
169
|
* Gets stored row spacing from the first spacer element's height style
|
|
@@ -171,9 +171,9 @@ class j extends E {
|
|
|
171
171
|
*/
|
|
172
172
|
_getStoredRowSpacing() {
|
|
173
173
|
if (!this.currentNode)
|
|
174
|
-
return
|
|
175
|
-
const
|
|
176
|
-
return
|
|
174
|
+
return f;
|
|
175
|
+
const i = (this.currentNode.querySelector(S) ?? this.currentNode).querySelector(".spacer") ?? null, o = O(i, "height");
|
|
176
|
+
return L(o, f);
|
|
177
177
|
}
|
|
178
178
|
// ========================================================================
|
|
179
179
|
// Desktop Spacing Handlers
|
|
@@ -185,23 +185,8 @@ class j extends E {
|
|
|
185
185
|
_onColumnSpacingChange(t) {
|
|
186
186
|
if (!this.currentNode)
|
|
187
187
|
return;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
this.currentNode,
|
|
191
|
-
{ columnSpacing: t },
|
|
192
|
-
`Changed column spacing to ${t}px`
|
|
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(
|
|
196
|
-
c.querySelectorAll(".attribute-cell")
|
|
197
|
-
).forEach((l) => {
|
|
198
|
-
i.modifyHtml(l).setStyle("padding", r);
|
|
199
|
-
}) : Array.from(
|
|
200
|
-
c.querySelectorAll(".product-card-wrapper")
|
|
201
|
-
).forEach((l) => {
|
|
202
|
-
const d = "parent" in l ? l.parent() : void 0;
|
|
203
|
-
d && i.modifyHtml(d).setStyle("padding", r);
|
|
204
|
-
}), i.apply(new S(`Update column spacing to ${t}px`)));
|
|
188
|
+
const i = this.api.getDocumentModifier();
|
|
189
|
+
u.stageConfig(i, this.currentNode, { columnSpacing: t }), this._stageDataAttribute(i, m.COLUMN_SPACING, t), this._stageColumnPadding(i, S, t), i.apply(new _(`Changed column spacing to ${t}px`));
|
|
205
190
|
}
|
|
206
191
|
/**
|
|
207
192
|
* Handles row spacing changes for desktop.
|
|
@@ -210,24 +195,8 @@ class j extends E {
|
|
|
210
195
|
_onRowSpacingChange(t) {
|
|
211
196
|
if (!this.currentNode)
|
|
212
197
|
return;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
this.currentNode,
|
|
216
|
-
{ rowSpacing: t },
|
|
217
|
-
`Changed row spacing to ${t}px`
|
|
218
|
-
), this._storeDataAttribute(b.ROW_SPACING, t);
|
|
219
|
-
const e = this.currentNode.querySelector(m);
|
|
220
|
-
if (!e)
|
|
221
|
-
return;
|
|
222
|
-
const n = Array.from(
|
|
223
|
-
e.querySelectorAll(".spacer")
|
|
224
|
-
);
|
|
225
|
-
if (!n.length)
|
|
226
|
-
return;
|
|
227
|
-
const i = this.api.getDocumentModifier(), a = `${t}px`;
|
|
228
|
-
n.forEach((r) => {
|
|
229
|
-
i.modifyHtml(r).setStyle("height", a);
|
|
230
|
-
}), i.apply(new S(`Update row spacing to ${t}px`));
|
|
198
|
+
const i = this.api.getDocumentModifier();
|
|
199
|
+
u.stageConfig(i, this.currentNode, { rowSpacing: t }), this._stageDataAttribute(i, m.ROW_SPACING, t), this._stageSpacerHeight(i, S, t), i.apply(new _(`Changed row spacing to ${t}px`));
|
|
231
200
|
}
|
|
232
201
|
// ========================================================================
|
|
233
202
|
// Mobile Spacing Handlers
|
|
@@ -239,23 +208,8 @@ class j extends E {
|
|
|
239
208
|
_onMobileColumnSpacingChange(t) {
|
|
240
209
|
if (!this.currentNode)
|
|
241
210
|
return;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
this.currentNode,
|
|
245
|
-
{ mobileColumnSpacing: t },
|
|
246
|
-
`Changed mobile column spacing to ${t}px`
|
|
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(
|
|
250
|
-
c.querySelectorAll(".attribute-cell")
|
|
251
|
-
).forEach((l) => {
|
|
252
|
-
i.modifyHtml(l).setStyle("padding", r);
|
|
253
|
-
}) : Array.from(
|
|
254
|
-
c.querySelectorAll(".product-card-wrapper")
|
|
255
|
-
).forEach((l) => {
|
|
256
|
-
const d = "parent" in l ? l.parent() : void 0;
|
|
257
|
-
d && i.modifyHtml(d).setStyle("padding", r);
|
|
258
|
-
}), i.apply(new S(`Update mobile column spacing to ${t}px`)));
|
|
211
|
+
const i = this.api.getDocumentModifier();
|
|
212
|
+
u.stageConfig(i, this.currentNode, { mobileColumnSpacing: t }), this._stageDataAttribute(i, m.MOBILE_COLUMN_SPACING, t), this._stageColumnPadding(i, I, t), i.apply(new _(`Changed mobile column spacing to ${t}px`));
|
|
259
213
|
}
|
|
260
214
|
/**
|
|
261
215
|
* Handles row spacing changes for mobile.
|
|
@@ -264,51 +218,59 @@ class j extends E {
|
|
|
264
218
|
_onMobileRowSpacingChange(t) {
|
|
265
219
|
if (!this.currentNode)
|
|
266
220
|
return;
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
this.currentNode,
|
|
270
|
-
{ mobileRowSpacing: t },
|
|
271
|
-
`Changed mobile row spacing to ${t}px`
|
|
272
|
-
), this._storeDataAttribute(b.MOBILE_ROW_SPACING, t);
|
|
273
|
-
const e = this.currentNode.querySelector(L);
|
|
274
|
-
if (!e)
|
|
275
|
-
return;
|
|
276
|
-
const n = Array.from(
|
|
277
|
-
e.querySelectorAll(".spacer")
|
|
278
|
-
);
|
|
279
|
-
if (!n.length)
|
|
280
|
-
return;
|
|
281
|
-
const i = this.api.getDocumentModifier(), a = `${t}px`;
|
|
282
|
-
n.forEach((r) => {
|
|
283
|
-
i.modifyHtml(r).setStyle("height", a);
|
|
284
|
-
}), i.apply(new S(`Update mobile row spacing to ${t}px`));
|
|
221
|
+
const i = this.api.getDocumentModifier();
|
|
222
|
+
u.stageConfig(i, this.currentNode, { mobileRowSpacing: t }), this._stageDataAttribute(i, m.MOBILE_ROW_SPACING, t), this._stageSpacerHeight(i, I, t), i.apply(new _(`Changed mobile row spacing to ${t}px`));
|
|
285
223
|
}
|
|
286
224
|
// ========================================================================
|
|
287
|
-
//
|
|
225
|
+
// Staging helpers (the handlers apply once)
|
|
288
226
|
// ========================================================================
|
|
289
|
-
/**
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
227
|
+
/** Horizontal padding on every card cell inside the container the selector finds. */
|
|
228
|
+
_stageColumnPadding(t, i, o) {
|
|
229
|
+
var d;
|
|
230
|
+
const n = (d = this.currentNode) == null ? void 0 : d.querySelector(i);
|
|
231
|
+
if (!this.currentNode || !n)
|
|
232
|
+
return;
|
|
233
|
+
const c = u.getConfig(this.currentNode).layout || b(this.currentNode), g = `0 ${o / 2}px`;
|
|
234
|
+
if (c === "grid") {
|
|
235
|
+
Array.from(n.querySelectorAll(".attribute-cell")).forEach((C) => {
|
|
236
|
+
t.modifyHtml(C).setStyle("padding", g);
|
|
237
|
+
});
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
Array.from(n.querySelectorAll(".product-card-wrapper")).forEach((C) => {
|
|
241
|
+
const h = "parent" in C ? C.parent() : void 0;
|
|
242
|
+
h && t.modifyHtml(h).setStyle("padding", g);
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
/** Height on every spacer row inside the container the selector finds. */
|
|
246
|
+
_stageSpacerHeight(t, i, o) {
|
|
247
|
+
var a;
|
|
248
|
+
const n = (a = this.currentNode) == null ? void 0 : a.querySelector(i);
|
|
249
|
+
n && Array.from(n.querySelectorAll(".spacer")).forEach((c) => {
|
|
250
|
+
t.modifyHtml(c).setStyle("height", `${o}px`);
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
/** Mirrors a spacing value onto the block root as a data attribute (regeneration reads it back). */
|
|
254
|
+
_stageDataAttribute(t, i, o) {
|
|
293
255
|
const n = U(this.currentNode);
|
|
294
|
-
n &&
|
|
256
|
+
n && t.modifyHtml(n).setAttribute(i, o.toString());
|
|
295
257
|
}
|
|
296
258
|
// ========================================================================
|
|
297
259
|
// Event Listeners
|
|
298
260
|
// ========================================================================
|
|
299
261
|
_listenToFormUpdates() {
|
|
300
|
-
this.api.onValueChanged(
|
|
301
|
-
const
|
|
302
|
-
Number.isNaN(
|
|
303
|
-
}), this.api.onValueChanged(
|
|
304
|
-
const
|
|
305
|
-
Number.isNaN(
|
|
306
|
-
}), this.api.onValueChanged(
|
|
307
|
-
const
|
|
308
|
-
Number.isNaN(
|
|
309
|
-
}), this.api.onValueChanged(
|
|
310
|
-
const
|
|
311
|
-
Number.isNaN(
|
|
262
|
+
this.api.onValueChanged(e.COLUMN_SPACING, (t) => {
|
|
263
|
+
const i = parseInt(t);
|
|
264
|
+
Number.isNaN(i) || this._debouncedOnColumnSpacingChange(i);
|
|
265
|
+
}), this.api.onValueChanged(e.ROW_SPACING, (t) => {
|
|
266
|
+
const i = parseInt(t);
|
|
267
|
+
Number.isNaN(i) || this._debouncedOnRowSpacingChange(i);
|
|
268
|
+
}), this.api.onValueChanged(e.MOBILE_COLUMN_SPACING, (t) => {
|
|
269
|
+
const i = parseInt(t);
|
|
270
|
+
Number.isNaN(i) || this._debouncedOnMobileColumnSpacingChange(i);
|
|
271
|
+
}), this.api.onValueChanged(e.MOBILE_ROW_SPACING, (t) => {
|
|
272
|
+
const i = parseInt(t);
|
|
273
|
+
Number.isNaN(i) || this._debouncedOnMobileRowSpacingChange(i);
|
|
312
274
|
});
|
|
313
275
|
}
|
|
314
276
|
/**
|
|
@@ -323,5 +285,5 @@ class j extends E {
|
|
|
323
285
|
}
|
|
324
286
|
export {
|
|
325
287
|
V as SPACING_CONTROL_ID,
|
|
326
|
-
|
|
288
|
+
k as SpacingControl
|
|
327
289
|
};
|