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