@useinsider/guido 3.20.1-beta.2c8da49 → 3.20.1-beta.2d09f29
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/composables/useActionsApi.js +64 -80
- package/dist/composables/useFullStoryBridge.js +10 -9
- package/dist/composables/useGuidoStateBridge.js +3 -3
- package/dist/composables/useLegacyStrategyConversion.js +16 -16
- package/dist/composables/useStripo.js +10 -11
- package/dist/config/migrator/fullStoryScriptMigrator.js +5 -0
- package/dist/config/migrator/index.js +11 -10
- package/dist/extensions/Blocks/Items/block.js +42 -43
- package/dist/extensions/Blocks/Recommendation/block.js +29 -33
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +83 -78
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +2 -1
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +12 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +86 -104
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +263 -348
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +50 -48
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +21 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +40 -44
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +19 -14
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +102 -104
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +23 -18
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +286 -312
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +20 -24
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +7 -6
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +151 -113
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +205 -219
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +40 -111
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +35 -31
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +192 -271
- package/dist/package.json.js +1 -1
- package/dist/src/composables/useActionsApi.d.ts +1 -5
- package/dist/src/config/migrator/fullStoryScriptMigrator.d.ts +1 -0
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +0 -8
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +0 -40
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -11
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +6 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +5 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +12 -21
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +3 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +5 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +3 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -21
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +13 -19
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +8 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +5 -9
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -8
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +11 -18
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +0 -1
- package/dist/src/extensions/Blocks/controlFactories.d.ts +0 -22
- package/dist/src/stores/editor.d.ts +1 -3
- package/dist/src/utils/fullStoryScripts.d.ts +6 -0
- package/dist/static/styles/components/button.css.js +0 -5
- package/dist/stores/editor.js +0 -5
- package/dist/utils/fullStoryScripts.js +8 -0
- package/package.json +3 -3
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +0 -28
- package/dist/extensions/Blocks/Recommendation/utils/currencySettings.js +0 -25
- package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +0 -17
- package/dist/src/extensions/Blocks/Recommendation/utils/currencySettings.d.ts +0 -6
|
@@ -1,42 +1,38 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
const r = "ins-recommendation-desktop-container",
|
|
3
|
-
function
|
|
4
|
-
return !!t.querySelector(
|
|
1
|
+
import { ModificationDescription as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
const r = "ins-recommendation-desktop-container", l = "ins-recommendation-mobile-container", i = "ins-recommendation-list-layout", s = "ins-recommendation-no-mobile-layout", u = `.${l} { display: none; }`, m = `@media only screen and (max-width: 480px) { .${r} { display: none !important; } .${l} { display: table !important; } .${i} .${r} { display: table !important; } .${i} .${l}, .${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} .${l}, .${s} .ins-recommendation-mobile-row { display: none !important; } }`, p = `.${l}`;
|
|
3
|
+
function c(t, e) {
|
|
4
|
+
return !!t.querySelector(e);
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function f(t) {
|
|
7
7
|
return t.querySelectorAll(`*${r}`).length > 0;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function y(t) {
|
|
10
10
|
return t.querySelectorAll(`*${s}`).length > 0;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function S(t) {
|
|
13
13
|
const e = t.getDocumentRootCssNode();
|
|
14
14
|
if (!e)
|
|
15
|
-
return
|
|
16
|
-
const
|
|
17
|
-
let
|
|
18
|
-
|
|
15
|
+
return;
|
|
16
|
+
const o = t.getDocumentModifier();
|
|
17
|
+
let n = !1;
|
|
18
|
+
c(e, p) || (o.modifyCss(e).appendRule(u), n = !0), f(e) || (o.modifyCss(e).appendRule(m), n = !0), y(e) || (o.modifyCss(e).appendRule(d), n = !0), n && o.apply(new a("Add mobile layout CSS rules"));
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function C(t) {
|
|
21
21
|
return "hasClass" in t ? t.hasClass(s) : !1;
|
|
22
22
|
}
|
|
23
|
-
function O(t,
|
|
24
|
-
e ? t.modifyHtml(o).setClass(s) : t.modifyHtml(o).removeClass(s);
|
|
25
|
-
}
|
|
26
|
-
function $(t, o, e) {
|
|
23
|
+
function O(t, e, o) {
|
|
27
24
|
const n = t.getDocumentModifier();
|
|
28
|
-
|
|
29
|
-
new
|
|
30
|
-
|
|
25
|
+
o ? n.modifyHtml(e).setClass(s) : n.modifyHtml(e).removeClass(s), n.apply(
|
|
26
|
+
new a(
|
|
27
|
+
o ? "Opt out of mobile layout" : "Opt in to mobile layout"
|
|
31
28
|
)
|
|
32
29
|
);
|
|
33
30
|
}
|
|
34
31
|
export {
|
|
35
32
|
r as CSS_CLASS_DESKTOP_CONTAINER,
|
|
36
|
-
|
|
33
|
+
l as CSS_CLASS_MOBILE_CONTAINER,
|
|
37
34
|
s as CSS_CLASS_NO_MOBILE_LAYOUT,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
O as stageMobileLayoutOptOut
|
|
35
|
+
S as ensureMobileCssRulesExist,
|
|
36
|
+
C as hasMobileLayoutOptOut,
|
|
37
|
+
O as setMobileLayoutOptOut
|
|
42
38
|
};
|
|
@@ -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 r, 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(r))
|
|
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(r) : !1;
|
|
49
49
|
}
|
|
50
50
|
_onTextTrimChange(e) {
|
|
51
51
|
if (!this.currentNode || !("closest" in this.currentNode))
|
|
@@ -58,10 +58,11 @@ class N extends u {
|
|
|
58
58
|
);
|
|
59
59
|
if (!i.length)
|
|
60
60
|
return;
|
|
61
|
-
|
|
61
|
+
e && T(this.api);
|
|
62
|
+
const o = this.api.getDocumentModifier();
|
|
62
63
|
i.forEach((n) => {
|
|
63
|
-
e ?
|
|
64
|
-
}),
|
|
64
|
+
e ? o.modifyHtml(n).setClass(r) : o.modifyHtml(n).removeClass(r);
|
|
65
|
+
}), o.apply(
|
|
65
66
|
new l(
|
|
66
67
|
e ? "Enable product name text trimming" : "Disable product name text trimming"
|
|
67
68
|
)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
const t = "text-trim-enabled",
|
|
3
|
-
function
|
|
1
|
+
import { ModificationDescription as r } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
const t = "text-trim-enabled", l = `.${t}`, c = `.${t} p`, S = `.${t} { max-width: 0; }`, T = `.${t} p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; display: block; }`;
|
|
3
|
+
function f(n) {
|
|
4
4
|
const e = n.getDocumentRootCssNode();
|
|
5
5
|
if (!e)
|
|
6
|
-
return
|
|
7
|
-
const
|
|
8
|
-
let
|
|
9
|
-
|
|
6
|
+
return;
|
|
7
|
+
const o = n.getDocumentModifier();
|
|
8
|
+
let i = !1;
|
|
9
|
+
e.querySelector(l) || (o.modifyCss(e).appendRule(S), i = !0), e.querySelectorAll(`*${t}`).some((s) => "getSelector" in s && typeof s.getSelector == "function" && s.getSelector() === c) || (o.modifyCss(e).appendRule(T), i = !0), i && o.apply(new r("Add text trim CSS rules"));
|
|
10
10
|
}
|
|
11
11
|
export {
|
|
12
12
|
t as CSS_CLASS_TEXT_TRIM,
|
|
13
|
-
|
|
13
|
+
f as ensureTextTrimCssRulesExist
|
|
14
14
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { ModificationDescription 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
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 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
|
+
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
|
|
10
|
+
import { safeGetStyle as f, safeGetParent as B } from "../../utils/tagName.js";
|
|
11
|
+
import { getCurrentLayout as _, 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", o = {
|
|
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", e = {
|
|
|
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
|
|
29
|
-
if (!
|
|
30
|
-
return
|
|
31
|
-
const t = parseFloat(
|
|
32
|
-
return Number.isNaN(t) ?
|
|
28
|
+
function O(u, s) {
|
|
29
|
+
if (!u)
|
|
30
|
+
return s;
|
|
31
|
+
const t = parseFloat(u);
|
|
32
|
+
return Number.isNaN(t) ? s : t;
|
|
33
33
|
}
|
|
34
|
-
class
|
|
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
|
}
|
|
@@ -68,17 +68,17 @@ class k 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)", o.COLUMN_SPACING_LABEL, o.COLUMN_SPACING)}
|
|
72
|
+
${this._spacingRow("Row Spacing (px)", o.ROW_SPACING_LABEL, o.ROW_SPACING)}
|
|
73
73
|
${this._spacingRow(
|
|
74
74
|
"Column Spacing on Mobile (px)",
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
o.MOBILE_COLUMN_SPACING_LABEL,
|
|
76
|
+
o.MOBILE_COLUMN_SPACING
|
|
77
77
|
)}
|
|
78
78
|
${this._spacingRow(
|
|
79
79
|
"Row Spacing on Mobile (px)",
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
o.MOBILE_ROW_SPACING_LABEL,
|
|
81
|
+
o.MOBILE_ROW_SPACING
|
|
82
82
|
)}
|
|
83
83
|
</div>
|
|
84
84
|
`;
|
|
@@ -96,14 +96,14 @@ class k 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, e, n) {
|
|
100
100
|
return this._GuTwoColumns([
|
|
101
|
-
this._GuLabel({ text: this.api.translate(t), name:
|
|
101
|
+
this._GuLabel({ text: this.api.translate(t), name: e }),
|
|
102
102
|
this._GuCounter({
|
|
103
|
-
name:
|
|
104
|
-
minValue:
|
|
105
|
-
maxValue:
|
|
106
|
-
step:
|
|
103
|
+
name: n,
|
|
104
|
+
minValue: R,
|
|
105
|
+
maxValue: G,
|
|
106
|
+
step: P
|
|
107
107
|
})
|
|
108
108
|
]);
|
|
109
109
|
}
|
|
@@ -117,14 +117,14 @@ class k 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 = 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,
|
|
123
|
+
i && a && c
|
|
124
124
|
), this.api.setVisibility(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
), this.api.setVisibility(
|
|
125
|
+
o.MOBILE_COLUMN_SPACING_LABEL,
|
|
126
|
+
i && a && c
|
|
127
|
+
), this.api.setVisibility(o.MOBILE_ROW_SPACING, i && a), this.api.setVisibility(o.MOBILE_ROW_SPACING_LABEL, i && a);
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
130
|
* Reads spacing values from node config first, falls back to DOM styles.
|
|
@@ -133,12 +133,12 @@ class k extends E {
|
|
|
133
133
|
_setFormValues() {
|
|
134
134
|
if (!this.api)
|
|
135
135
|
return;
|
|
136
|
-
const t =
|
|
136
|
+
const t = p.hasConfig(this.currentNode), e = p.getConfig(this.currentNode), n = t ? e.columnSpacing : this._getStoredColumnSpacing(), i = t ? e.rowSpacing : this._getStoredRowSpacing();
|
|
137
137
|
this.api.updateValues({
|
|
138
|
-
[
|
|
139
|
-
[
|
|
140
|
-
[
|
|
141
|
-
[
|
|
138
|
+
[o.COLUMN_SPACING]: n,
|
|
139
|
+
[o.ROW_SPACING]: i,
|
|
140
|
+
[o.MOBILE_COLUMN_SPACING]: e.mobileColumnSpacing,
|
|
141
|
+
[o.MOBILE_ROW_SPACING]: e.mobileRowSpacing
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
@@ -150,20 +150,20 @@ class k 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 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");
|
|
157
|
+
if (!d)
|
|
158
|
+
return C;
|
|
159
|
+
const A = d.trim().split(/\s+/);
|
|
160
|
+
return A.length < 2 ? C : O(A[1], C / 2) * 2;
|
|
161
161
|
}
|
|
162
|
-
const
|
|
162
|
+
const n = t.querySelector(".product-card-wrapper") ?? null, i = B(n), a = f(i, "padding");
|
|
163
163
|
if (!a)
|
|
164
|
-
return
|
|
165
|
-
const
|
|
166
|
-
return
|
|
164
|
+
return C;
|
|
165
|
+
const r = a.trim().split(/\s+/);
|
|
166
|
+
return r.length < 2 ? C : O(r[1], C / 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 k extends E {
|
|
|
171
171
|
*/
|
|
172
172
|
_getStoredRowSpacing() {
|
|
173
173
|
if (!this.currentNode)
|
|
174
|
-
return
|
|
175
|
-
const
|
|
176
|
-
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);
|
|
177
177
|
}
|
|
178
178
|
// ========================================================================
|
|
179
179
|
// Desktop Spacing Handlers
|
|
@@ -185,8 +185,23 @@ class k extends E {
|
|
|
185
185
|
_onColumnSpacingChange(t) {
|
|
186
186
|
if (!this.currentNode)
|
|
187
187
|
return;
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
p.updateConfig(
|
|
189
|
+
this.api,
|
|
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`)));
|
|
190
205
|
}
|
|
191
206
|
/**
|
|
192
207
|
* Handles row spacing changes for desktop.
|
|
@@ -195,8 +210,24 @@ class k extends E {
|
|
|
195
210
|
_onRowSpacingChange(t) {
|
|
196
211
|
if (!this.currentNode)
|
|
197
212
|
return;
|
|
198
|
-
|
|
199
|
-
|
|
213
|
+
p.updateConfig(
|
|
214
|
+
this.api,
|
|
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`));
|
|
200
231
|
}
|
|
201
232
|
// ========================================================================
|
|
202
233
|
// Mobile Spacing Handlers
|
|
@@ -208,8 +239,23 @@ class k extends E {
|
|
|
208
239
|
_onMobileColumnSpacingChange(t) {
|
|
209
240
|
if (!this.currentNode)
|
|
210
241
|
return;
|
|
211
|
-
|
|
212
|
-
|
|
242
|
+
p.updateConfig(
|
|
243
|
+
this.api,
|
|
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`)));
|
|
213
259
|
}
|
|
214
260
|
/**
|
|
215
261
|
* Handles row spacing changes for mobile.
|
|
@@ -218,59 +264,51 @@ class k extends E {
|
|
|
218
264
|
_onMobileRowSpacingChange(t) {
|
|
219
265
|
if (!this.currentNode)
|
|
220
266
|
return;
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
var d;
|
|
230
|
-
const n = (d = this.currentNode) == null ? void 0 : d.querySelector(i);
|
|
231
|
-
if (!this.currentNode || !n)
|
|
267
|
+
p.updateConfig(
|
|
268
|
+
this.api,
|
|
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)
|
|
232
275
|
return;
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
});
|
|
276
|
+
const n = Array.from(
|
|
277
|
+
e.querySelectorAll(".spacer")
|
|
278
|
+
);
|
|
279
|
+
if (!n.length)
|
|
238
280
|
return;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
});
|
|
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`));
|
|
244
285
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
/** Mirrors a spacing value onto the block root as a data attribute (regeneration reads it back). */
|
|
254
|
-
_stageDataAttribute(t, i, o) {
|
|
286
|
+
// ========================================================================
|
|
287
|
+
// Data Attribute Storage
|
|
288
|
+
// ========================================================================
|
|
289
|
+
/**
|
|
290
|
+
* Stores a spacing value as a data attribute on the block root element
|
|
291
|
+
*/
|
|
292
|
+
_storeDataAttribute(t, e) {
|
|
255
293
|
const n = U(this.currentNode);
|
|
256
|
-
n &&
|
|
294
|
+
n && this.api.getDocumentModifier().modifyHtml(n).setAttribute(t, e.toString()).apply(new S(`Store ${t}`));
|
|
257
295
|
}
|
|
258
296
|
// ========================================================================
|
|
259
297
|
// Event Listeners
|
|
260
298
|
// ========================================================================
|
|
261
299
|
_listenToFormUpdates() {
|
|
262
|
-
this.api.onValueChanged(
|
|
263
|
-
const
|
|
264
|
-
Number.isNaN(
|
|
265
|
-
}), this.api.onValueChanged(
|
|
266
|
-
const
|
|
267
|
-
Number.isNaN(
|
|
268
|
-
}), this.api.onValueChanged(
|
|
269
|
-
const
|
|
270
|
-
Number.isNaN(
|
|
271
|
-
}), this.api.onValueChanged(
|
|
272
|
-
const
|
|
273
|
-
Number.isNaN(
|
|
300
|
+
this.api.onValueChanged(o.COLUMN_SPACING, (t) => {
|
|
301
|
+
const e = parseInt(t);
|
|
302
|
+
Number.isNaN(e) || this._debouncedOnColumnSpacingChange(e);
|
|
303
|
+
}), this.api.onValueChanged(o.ROW_SPACING, (t) => {
|
|
304
|
+
const e = parseInt(t);
|
|
305
|
+
Number.isNaN(e) || this._debouncedOnRowSpacingChange(e);
|
|
306
|
+
}), this.api.onValueChanged(o.MOBILE_COLUMN_SPACING, (t) => {
|
|
307
|
+
const e = parseInt(t);
|
|
308
|
+
Number.isNaN(e) || this._debouncedOnMobileColumnSpacingChange(e);
|
|
309
|
+
}), this.api.onValueChanged(o.MOBILE_ROW_SPACING, (t) => {
|
|
310
|
+
const e = parseInt(t);
|
|
311
|
+
Number.isNaN(e) || this._debouncedOnMobileRowSpacingChange(e);
|
|
274
312
|
});
|
|
275
313
|
}
|
|
276
314
|
/**
|
|
@@ -285,5 +323,5 @@ class k extends E {
|
|
|
285
323
|
}
|
|
286
324
|
export {
|
|
287
325
|
V as SPACING_CONTROL_ID,
|
|
288
|
-
|
|
326
|
+
j as SpacingControl
|
|
289
327
|
};
|