@useinsider/guido 3.6.0-beta.7ac8612 → 3.6.0-beta.94e390d
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/useHtmlValidator.js +102 -131
- package/dist/composables/useStripoEventHandler.js +20 -12
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +27 -28
- package/dist/config/migrator/recommendation/extractors.js +22 -44
- package/dist/config/migrator/recommendation/htmlBuilder.js +169 -175
- package/dist/config/migrator/recommendationMigrator.js +31 -30
- package/dist/enums/toaster.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +35 -16
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -21
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +24 -38
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +38 -39
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +34 -45
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +2 -3
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +52 -62
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +67 -74
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +6 -7
- package/dist/extensions/Blocks/Recommendation/extension.js +5 -6
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +2 -3
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +2 -3
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +2 -3
- package/dist/extensions/Blocks/Recommendation/templates/index.js +4 -5
- package/dist/extensions/Blocks/Recommendation/useRecommendationBlockWarning.js +16 -0
- package/dist/extensions/Blocks/Recommendation/utils/recommendationBlockCount.js +9 -0
- package/dist/src/composables/useHtmlValidator.d.ts +0 -9
- package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -15
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +0 -8
- package/dist/src/enums/toaster.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -21
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +0 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -9
- package/dist/src/extensions/Blocks/Recommendation/useRecommendationBlockWarning.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.d.ts +28 -0
- package/package.json +1 -1
- package/dist/config/compiler/utils/recommendationIgnoreUtils.js +0 -15
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +0 -17
- /package/dist/src/{composables/useHtmlValidator.test.d.ts → extensions/Blocks/Recommendation/block.test.d.ts} +0 -0
- /package/dist/src/{config/compiler/utils/recommendationIgnoreUtils.test.d.ts → extensions/Blocks/Recommendation/utils/recommendationBlockCount.test.d.ts} +0 -0
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var r = (o, e, t) =>
|
|
4
|
-
import {
|
|
5
|
-
import { CommonControl as
|
|
1
|
+
var O = Object.defineProperty;
|
|
2
|
+
var p = (o, e, t) => e in o ? O(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var r = (o, e, t) => p(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { ModificationDescription as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as N } from "../../../common-control.js";
|
|
6
6
|
import { ATTR_DATA_CUSTOM_ATTRIBUTES as L } from "../../constants/selectors.js";
|
|
7
|
-
import { LAYOUT_OPTIONS as
|
|
8
|
-
import { DEFAULT_COMPOSITION as
|
|
9
|
-
import { RecommendationConfigService as
|
|
10
|
-
import { useRecommendationExtensionStore as
|
|
11
|
-
import {
|
|
12
|
-
const
|
|
7
|
+
import { LAYOUT_OPTIONS as T, DEFAULT_MOBILE_ROW_SPACING as m, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as l, DEFAULT_COLUMN_SPACING as g } from "../../constants/layout.js";
|
|
8
|
+
import { DEFAULT_COMPOSITION as _ } from "../../constants/defaultConfig.js";
|
|
9
|
+
import { RecommendationConfigService as s } from "../../services/configService.js";
|
|
10
|
+
import { useRecommendationExtensionStore as f } from "../../store/recommendation.js";
|
|
11
|
+
import { getCurrentLayout as C, getBlockElement as I, regenerateProductRowsWithStyles as S } from "./utils.js";
|
|
12
|
+
const U = "recommendation-layout-orientation-control", A = "recommendationInfoBannerTest", a = {
|
|
13
13
|
LAYOUT: "layout"
|
|
14
|
-
},
|
|
14
|
+
}, y = "data-card-composition", i = {
|
|
15
15
|
LAYOUT: "data-layout",
|
|
16
16
|
COLUMN_SPACING: "data-column-spacing",
|
|
17
17
|
ROW_SPACING: "data-row-spacing",
|
|
18
18
|
MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
|
|
19
19
|
MOBILE_ROW_SPACING: "data-mobile-row-spacing"
|
|
20
20
|
};
|
|
21
|
-
class
|
|
21
|
+
class Y extends N {
|
|
22
22
|
constructor() {
|
|
23
23
|
super(...arguments);
|
|
24
|
-
r(this, "store",
|
|
24
|
+
r(this, "store", f());
|
|
25
25
|
r(this, "isChangingLayout", !1);
|
|
26
26
|
}
|
|
27
27
|
getId() {
|
|
28
|
-
return
|
|
28
|
+
return U;
|
|
29
29
|
}
|
|
30
30
|
getTemplate() {
|
|
31
31
|
return `
|
|
32
32
|
<div class="layout-control-container">
|
|
33
|
-
${this._GuOnPageMessage({ name:
|
|
33
|
+
${this._GuOnPageMessage({ name: A })}
|
|
34
34
|
|
|
35
35
|
${this._GuTwoColumns([
|
|
36
36
|
this._GuLabel({ text: this.api.translate("Layout Orientation") }),
|
|
37
37
|
this._GuRadioButton({
|
|
38
|
-
name:
|
|
39
|
-
buttons:
|
|
38
|
+
name: a.LAYOUT,
|
|
39
|
+
buttons: T
|
|
40
40
|
})
|
|
41
41
|
])}
|
|
42
42
|
</div>
|
|
@@ -44,31 +44,20 @@ class V extends T {
|
|
|
44
44
|
}
|
|
45
45
|
onRender() {
|
|
46
46
|
this._setInfoMessageValue(
|
|
47
|
-
|
|
47
|
+
A,
|
|
48
48
|
this.api.translate(
|
|
49
49
|
`Note that updating the Layout Orientation, Number of Products and
|
|
50
50
|
Products in One Row settings resets the style of your Recommendation block.`
|
|
51
51
|
)
|
|
52
|
-
), this._setFormValues(), this.
|
|
52
|
+
), this._setFormValues(), this._listenToFormUpdates();
|
|
53
53
|
}
|
|
54
54
|
onTemplateNodeUpdated(t) {
|
|
55
|
-
super.onTemplateNodeUpdated(t), this._setFormValues()
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Layout orientation restructures the whole block, which is meaningless for
|
|
59
|
-
* partner-managed (`ins-skip-compile`) blocks — disable the control there.
|
|
60
|
-
*/
|
|
61
|
-
_syncDisabledState() {
|
|
62
|
-
this.api.setUIEAttribute(
|
|
63
|
-
s.LAYOUT,
|
|
64
|
-
p.RADIO_BUTTONS.disabled,
|
|
65
|
-
I(this.currentNode)
|
|
66
|
-
);
|
|
55
|
+
super.onTemplateNodeUpdated(t), this._setFormValues();
|
|
67
56
|
}
|
|
68
57
|
_setFormValues() {
|
|
69
|
-
const u =
|
|
58
|
+
const u = s.getConfig(this.currentNode).layout || C(this.currentNode);
|
|
70
59
|
this.api.updateValues({
|
|
71
|
-
[
|
|
60
|
+
[a.LAYOUT]: u
|
|
72
61
|
});
|
|
73
62
|
}
|
|
74
63
|
/**
|
|
@@ -76,26 +65,26 @@ class V extends T {
|
|
|
76
65
|
* Updates node config, data attribute and regenerates product rows
|
|
77
66
|
*/
|
|
78
67
|
_onLayoutChange(t) {
|
|
79
|
-
if (this.isChangingLayout || !this.currentNode || (
|
|
68
|
+
if (this.isChangingLayout || !this.currentNode || (s.getConfig(this.currentNode).layout || C(this.currentNode)) === t)
|
|
80
69
|
return;
|
|
81
|
-
const c =
|
|
70
|
+
const c = I(this.currentNode);
|
|
82
71
|
if (c) {
|
|
83
72
|
this.isChangingLayout = !0;
|
|
84
73
|
try {
|
|
85
|
-
|
|
74
|
+
s.updateConfig(
|
|
86
75
|
this.api,
|
|
87
76
|
this.currentNode,
|
|
88
77
|
{
|
|
89
78
|
layout: t,
|
|
90
|
-
columnSpacing:
|
|
79
|
+
columnSpacing: g,
|
|
91
80
|
rowSpacing: l,
|
|
92
81
|
mobileColumnSpacing: d,
|
|
93
82
|
mobileRowSpacing: m
|
|
94
83
|
},
|
|
95
84
|
`Changed layout to ${t}`
|
|
96
85
|
), this.store.patchCurrentBlockConfig({ orientation: t });
|
|
97
|
-
const
|
|
98
|
-
t === "list" ? (
|
|
86
|
+
const n = this.api.getDocumentModifier().modifyHtml(c).setAttribute(i.LAYOUT, t).setAttribute(i.COLUMN_SPACING, g.toString()).setAttribute(i.ROW_SPACING, l.toString()).setAttribute(i.MOBILE_COLUMN_SPACING, d.toString()).setAttribute(i.MOBILE_ROW_SPACING, m.toString());
|
|
87
|
+
t === "list" ? (n.setClass("es-m-p0"), n.setClass("ins-recommendation-list-layout")) : (n.removeClass("es-m-p0"), n.removeClass("ins-recommendation-list-layout")), n.setAttribute(y, _.join(",")).setAttribute(L, "[]"), n.apply(new h(`Update layout to ${t}`)), this._regenerateProductRows(t);
|
|
99
88
|
} finally {
|
|
100
89
|
this.isChangingLayout = !1;
|
|
101
90
|
}
|
|
@@ -107,20 +96,20 @@ class V extends T {
|
|
|
107
96
|
* @param layout - The layout to use for regeneration (passed explicitly to avoid stale DOM reads)
|
|
108
97
|
*/
|
|
109
98
|
_regenerateProductRows(t) {
|
|
110
|
-
this.currentNode &&
|
|
99
|
+
this.currentNode && S({
|
|
111
100
|
currentNode: this.currentNode,
|
|
112
101
|
documentModifier: this.api.getDocumentModifier(),
|
|
113
102
|
layout: t,
|
|
114
|
-
composition:
|
|
103
|
+
composition: _
|
|
115
104
|
});
|
|
116
105
|
}
|
|
117
106
|
_listenToFormUpdates() {
|
|
118
|
-
this.api.onValueChanged(
|
|
107
|
+
this.api.onValueChanged(a.LAYOUT, (t) => {
|
|
119
108
|
this._onLayoutChange(t);
|
|
120
109
|
});
|
|
121
110
|
}
|
|
122
111
|
}
|
|
123
112
|
export {
|
|
124
|
-
|
|
125
|
-
|
|
113
|
+
U as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
114
|
+
Y as LayoutOrientationControl
|
|
126
115
|
};
|
|
@@ -2,14 +2,13 @@ var s = Object.defineProperty;
|
|
|
2
2
|
var u = (e, o, t) => o in e ? s(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
|
|
3
3
|
var i = (e, o, t) => u(e, typeof o != "symbol" ? o + "" : o, t);
|
|
4
4
|
import { CommonControl as a } from "../../../common-control.js";
|
|
5
|
-
import "../../constants/selectors.js";
|
|
6
5
|
import { MAX_PRODUCT_COUNT as c } from "../../constants/layout.js";
|
|
7
6
|
import { RecommendationConfigService as n } from "../../services/configService.js";
|
|
8
7
|
import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
|
|
9
8
|
const C = "recommendation-product-count-control", r = {
|
|
10
9
|
PRODUCT_COUNT: "size"
|
|
11
10
|
};
|
|
12
|
-
class
|
|
11
|
+
class g extends a {
|
|
13
12
|
constructor() {
|
|
14
13
|
super(...arguments);
|
|
15
14
|
i(this, "store", d());
|
|
@@ -55,5 +54,5 @@ class U extends a {
|
|
|
55
54
|
}
|
|
56
55
|
export {
|
|
57
56
|
C as PRODUCT_COUNT_CONTROL_ID,
|
|
58
|
-
|
|
57
|
+
g as ProductCountControl
|
|
59
58
|
};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (a, n, t) =>
|
|
4
|
-
import {
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import "../../constants/
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { isPartnerManagedBlock as U, getCurrentLayout as w, getBlockElement as A, regenerateProductRowsWithStyles as I, regenerateMobileProductRows as E, adjustProductsToSize as S } from "./utils.js";
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var E = (a, n, t) => n in a ? I(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
|
|
3
|
+
var u = (a, n, t) => E(a, typeof n != "symbol" ? n + "" : n, t);
|
|
4
|
+
import { EditorStatePropertyType as O, PreviewDeviceMode as f, UEAttr as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as T } from "../../../common-control.js";
|
|
6
|
+
import { MAX_PRODUCTS_PER_ROW as p, MAX_MOBILE_PRODUCTS_PER_ROW as M, DEFAULT_MOBILE_CARDS_IN_ROW as L, DEFAULT_COLUMN_SPACING as P, DEFAULT_MOBILE_COLUMN_SPACING as y } from "../../constants/layout.js";
|
|
7
|
+
import { RecommendationConfigService as i } from "../../services/configService.js";
|
|
8
|
+
import { useRecommendationExtensionStore as D } from "../../store/recommendation.js";
|
|
9
|
+
import { setMobileLayoutOptOut as m, ensureMobileCssRulesExist as C } from "../mobileLayout/cssRules.js";
|
|
10
|
+
import { getCurrentLayout as w, getBlockElement as U, regenerateProductRowsWithStyles as b, regenerateMobileProductRows as g, adjustProductsToSize as A } from "./utils.js";
|
|
12
11
|
import { useDebounceFn as B } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
13
|
-
const
|
|
12
|
+
const S = "recommendation-product-layout-control", e = {
|
|
14
13
|
// "Products in One Row" — shown when toggle is OFF
|
|
15
14
|
PRODUCT_IN_ROW: "cardsInRow",
|
|
16
15
|
PRODUCT_IN_ROW_LABEL: "cardsInRowLabel",
|
|
@@ -24,11 +23,11 @@ const W = "recommendation-product-layout-control", e = {
|
|
|
24
23
|
MOBILE_LAYOUT_TOGGLE: "mobileLayoutEnabled",
|
|
25
24
|
MOBILE_LAYOUT_LABEL: "mobileLayoutLabel"
|
|
26
25
|
};
|
|
27
|
-
class
|
|
26
|
+
class v extends T {
|
|
28
27
|
constructor() {
|
|
29
28
|
super(...arguments);
|
|
30
29
|
// Store is used for backward compatibility with product fetching and regeneration
|
|
31
|
-
u(this, "store",
|
|
30
|
+
u(this, "store", D());
|
|
32
31
|
u(this, "storeUnsubscription", () => {
|
|
33
32
|
});
|
|
34
33
|
u(this, "_debouncedRegenerateProductRows", B(() => {
|
|
@@ -36,7 +35,7 @@ class X extends f {
|
|
|
36
35
|
}, 500));
|
|
37
36
|
}
|
|
38
37
|
getId() {
|
|
39
|
-
return
|
|
38
|
+
return S;
|
|
40
39
|
}
|
|
41
40
|
getTemplate() {
|
|
42
41
|
return `
|
|
@@ -46,12 +45,12 @@ class X extends f {
|
|
|
46
45
|
text: this.api.translate("Products in One Row"),
|
|
47
46
|
name: e.PRODUCT_IN_ROW_LABEL
|
|
48
47
|
}),
|
|
49
|
-
this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue:
|
|
48
|
+
this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: p }),
|
|
50
49
|
this._GuLabel({
|
|
51
50
|
text: this.api.translate("Products in One Row on Desktop"),
|
|
52
51
|
name: e.PRODUCT_IN_ROW_DESKTOP_LABEL
|
|
53
52
|
}),
|
|
54
|
-
this._GuCounter({ name: e.PRODUCT_IN_ROW_DESKTOP, maxValue:
|
|
53
|
+
this._GuCounter({ name: e.PRODUCT_IN_ROW_DESKTOP, maxValue: p }),
|
|
55
54
|
this._GuLabel({
|
|
56
55
|
text: this.api.translate("Products in One Row on Mobile"),
|
|
57
56
|
name: e.MOBILE_CARDS_IN_ROW_LABEL
|
|
@@ -75,25 +74,16 @@ class X extends f {
|
|
|
75
74
|
`;
|
|
76
75
|
}
|
|
77
76
|
onRender() {
|
|
78
|
-
this._initializeMobileLayoutToggle(), this._setFormValues(), this._updateProductsInRowVisibility(), this.
|
|
77
|
+
this._initializeMobileLayoutToggle(), this._setFormValues(), this._updateProductsInRowVisibility(), this._listenToFormUpdates(), this._listenStateUpdates(), this._listenEditorModeChanges();
|
|
79
78
|
}
|
|
80
79
|
onTemplateNodeUpdated(t) {
|
|
81
|
-
super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateProductsInRowVisibility()
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Products-per-row and mobile-layout restructure the block, which is
|
|
85
|
-
* meaningless for partner-managed (`ins-skip-compile`) blocks — disable
|
|
86
|
-
* these inputs there. Disabling coexists with the visibility logic above.
|
|
87
|
-
*/
|
|
88
|
-
_syncDisabledState() {
|
|
89
|
-
const t = U(this.currentNode);
|
|
90
|
-
this.api.setUIEAttribute(e.PRODUCT_IN_ROW, d.COUNTER.disabled, t), this.api.setUIEAttribute(e.PRODUCT_IN_ROW_DESKTOP, d.COUNTER.disabled, t), this.api.setUIEAttribute(e.MOBILE_CARDS_IN_ROW, d.COUNTER.disabled, t), this.api.setUIEAttribute(e.MOBILE_LAYOUT_TOGGLE, d.SWITCHER.disabled, t);
|
|
80
|
+
super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateProductsInRowVisibility();
|
|
91
81
|
}
|
|
92
82
|
onDestroy() {
|
|
93
83
|
this.storeUnsubscription();
|
|
94
84
|
}
|
|
95
85
|
_setFormValues() {
|
|
96
|
-
const t =
|
|
86
|
+
const t = i.getConfig(this.currentNode);
|
|
97
87
|
this.api.updateValues({
|
|
98
88
|
[e.PRODUCT_IN_ROW]: t.cardsInRow,
|
|
99
89
|
[e.PRODUCT_IN_ROW_DESKTOP]: t.cardsInRow,
|
|
@@ -105,7 +95,7 @@ class X extends f {
|
|
|
105
95
|
* Returns true when the editor preview is in mobile mode.
|
|
106
96
|
*/
|
|
107
97
|
_isMobilePreview() {
|
|
108
|
-
return this.api.getEditorState()[
|
|
98
|
+
return this.api.getEditorState()[O.previewDeviceMode] === f.MOBILE;
|
|
109
99
|
}
|
|
110
100
|
/**
|
|
111
101
|
* Updates counter visibility based on layout, mobileLayoutEnabled, and editor preview mode.
|
|
@@ -120,22 +110,22 @@ class X extends f {
|
|
|
120
110
|
*/
|
|
121
111
|
_updateProductsInRowVisibility() {
|
|
122
112
|
var R;
|
|
123
|
-
const t =
|
|
124
|
-
this.api.setVisibility(e.MOBILE_LAYOUT_TOGGLE,
|
|
125
|
-
const c =
|
|
126
|
-
this.api.setVisibility(e.PRODUCT_IN_ROW, c), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, c), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP,
|
|
127
|
-
const
|
|
128
|
-
|
|
113
|
+
const t = i.getConfig(this.currentNode), o = (t.layout || w(this.currentNode)) === "grid", { mobileLayoutEnabled: r } = t, d = this._isMobilePreview();
|
|
114
|
+
this.api.setVisibility(e.MOBILE_LAYOUT_TOGGLE, o), this.api.setVisibility(e.MOBILE_LAYOUT_LABEL, o);
|
|
115
|
+
const c = o && !r, _ = o && r && !d, l = o && r && d;
|
|
116
|
+
this.api.setVisibility(e.PRODUCT_IN_ROW, c), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, c), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP, _), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP_LABEL, _), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, l), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, l);
|
|
117
|
+
const h = (R = this.getContainer()) == null ? void 0 : R.querySelector("[data-product-layout-control]");
|
|
118
|
+
h && (h.style.display = o ? "" : "none");
|
|
129
119
|
}
|
|
130
120
|
/**
|
|
131
121
|
* Initializes the mobile layout toggle using the same pattern as shuffle.ts.
|
|
132
122
|
* Sets the initial UI attribute value from the node config.
|
|
133
123
|
*/
|
|
134
124
|
_initializeMobileLayoutToggle() {
|
|
135
|
-
const t =
|
|
125
|
+
const t = i.getConfig(this.currentNode);
|
|
136
126
|
this.api.setUIEAttribute(
|
|
137
127
|
e.MOBILE_LAYOUT_TOGGLE,
|
|
138
|
-
|
|
128
|
+
N.SELECTPICKER.items,
|
|
139
129
|
t.mobileLayoutEnabled
|
|
140
130
|
);
|
|
141
131
|
}
|
|
@@ -147,13 +137,13 @@ class X extends f {
|
|
|
147
137
|
_onMobileLayoutToggleChange(t) {
|
|
148
138
|
if (!this.currentNode)
|
|
149
139
|
return;
|
|
150
|
-
const s =
|
|
140
|
+
const s = i.getConfig(this.currentNode);
|
|
151
141
|
if (s.mobileLayoutEnabled === t)
|
|
152
142
|
return;
|
|
153
|
-
const
|
|
143
|
+
const o = U(this.currentNode);
|
|
154
144
|
if (t) {
|
|
155
|
-
const r = s.previousMobileCardsInRow ||
|
|
156
|
-
|
|
145
|
+
const r = s.previousMobileCardsInRow || L;
|
|
146
|
+
i.updateConfig(
|
|
157
147
|
this.api,
|
|
158
148
|
this.currentNode,
|
|
159
149
|
{
|
|
@@ -164,25 +154,25 @@ class X extends f {
|
|
|
164
154
|
), this.store.patchCurrentBlockConfig(
|
|
165
155
|
{ mobileLayoutEnabled: !0 },
|
|
166
156
|
{ triggerRefetch: !1 }
|
|
167
|
-
),
|
|
157
|
+
), o && m(this.api, o, !1), C(this.api), b({
|
|
168
158
|
currentNode: this.currentNode,
|
|
169
159
|
documentModifier: this.api.getDocumentModifier()
|
|
170
160
|
});
|
|
171
161
|
} else {
|
|
172
162
|
const r = s.mobileCardsInRow;
|
|
173
|
-
|
|
163
|
+
i.updateConfig(
|
|
174
164
|
this.api,
|
|
175
165
|
this.currentNode,
|
|
176
166
|
{
|
|
177
167
|
mobileLayoutEnabled: !1,
|
|
178
168
|
previousMobileCardsInRow: r,
|
|
179
|
-
mobileCardsInRow:
|
|
169
|
+
mobileCardsInRow: L
|
|
180
170
|
},
|
|
181
171
|
"Disabled mobile layout optimization"
|
|
182
172
|
), this.store.patchCurrentBlockConfig(
|
|
183
173
|
{ mobileLayoutEnabled: !1 },
|
|
184
174
|
{ triggerRefetch: !1 }
|
|
185
|
-
),
|
|
175
|
+
), o && m(this.api, o, !0), g({
|
|
186
176
|
currentNode: this.currentNode,
|
|
187
177
|
documentModifier: this.api.getDocumentModifier()
|
|
188
178
|
});
|
|
@@ -190,36 +180,36 @@ class X extends f {
|
|
|
190
180
|
this._setFormValues(), this._updateProductsInRowVisibility();
|
|
191
181
|
}
|
|
192
182
|
_onProductsInRowChange(t) {
|
|
193
|
-
if (!this.currentNode ||
|
|
183
|
+
if (!this.currentNode || i.getConfig(this.currentNode).cardsInRow === t)
|
|
194
184
|
return;
|
|
195
|
-
const
|
|
196
|
-
|
|
185
|
+
const o = t === 1 ? 0 : P;
|
|
186
|
+
i.updateConfig(
|
|
197
187
|
this.api,
|
|
198
188
|
this.currentNode,
|
|
199
|
-
{ cardsInRow: t, columnSpacing:
|
|
189
|
+
{ cardsInRow: t, columnSpacing: o },
|
|
200
190
|
`Changed products per row to ${t}`
|
|
201
191
|
), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._debouncedRegenerateProductRows();
|
|
202
192
|
}
|
|
203
193
|
_onMobileCardsInRowChange(t) {
|
|
204
|
-
if (!this.currentNode ||
|
|
194
|
+
if (!this.currentNode || i.getConfig(this.currentNode).mobileCardsInRow === t)
|
|
205
195
|
return;
|
|
206
|
-
const
|
|
207
|
-
|
|
196
|
+
const o = t === 1 ? 0 : y;
|
|
197
|
+
i.updateConfig(
|
|
208
198
|
this.api,
|
|
209
199
|
this.currentNode,
|
|
210
|
-
{ mobileCardsInRow: t, mobileColumnSpacing:
|
|
200
|
+
{ mobileCardsInRow: t, mobileColumnSpacing: o },
|
|
211
201
|
`Changed mobile products per row to ${t}`
|
|
212
|
-
),
|
|
202
|
+
), C(this.api), g({
|
|
213
203
|
currentNode: this.currentNode,
|
|
214
204
|
documentModifier: this.api.getDocumentModifier()
|
|
215
205
|
});
|
|
216
206
|
}
|
|
217
207
|
_regenerateProductRows() {
|
|
218
|
-
const t =
|
|
219
|
-
|
|
208
|
+
const t = i.getConfig(this.currentNode), s = parseInt(t.size) || 6, o = A(this.store.recommendationProducts, s);
|
|
209
|
+
b({
|
|
220
210
|
currentNode: this.currentNode,
|
|
221
211
|
documentModifier: this.api.getDocumentModifier(),
|
|
222
|
-
products:
|
|
212
|
+
products: o
|
|
223
213
|
});
|
|
224
214
|
}
|
|
225
215
|
_listenToFormUpdates() {
|
|
@@ -251,14 +241,14 @@ class X extends f {
|
|
|
251
241
|
*/
|
|
252
242
|
_listenEditorModeChanges() {
|
|
253
243
|
this.api.onEditorStatePropUpdated(
|
|
254
|
-
|
|
244
|
+
O.previewDeviceMode,
|
|
255
245
|
() => {
|
|
256
|
-
|
|
246
|
+
i.getConfig(this.currentNode).mobileLayoutEnabled && this._updateProductsInRowVisibility();
|
|
257
247
|
}
|
|
258
248
|
);
|
|
259
249
|
}
|
|
260
250
|
}
|
|
261
251
|
export {
|
|
262
|
-
|
|
263
|
-
|
|
252
|
+
S as PRODUCT_LAYOUT_CONTROL_ID,
|
|
253
|
+
v as ProductLayoutControl
|
|
264
254
|
};
|