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