@useinsider/guido 3.20.0 → 3.20.1-beta.04cd240
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/useLegacyStrategyConversion.js +16 -16
- package/dist/composables/useStripo.js +11 -10
- package/dist/composables/useVersionHistoryApi.js +42 -37
- package/dist/config/compiler/itemsCompilerRules.js +21 -5
- package/dist/config/compiler/utils/itemsCompilerUtils.js +64 -17
- package/dist/config/migrator/itemsBlockMigrator.js +112 -108
- package/dist/extensions/Blocks/Items/block.js +76 -64
- package/dist/extensions/Blocks/Items/constants/cardWidth.js +20 -0
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +60 -49
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +163 -149
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +1 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +102 -78
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +313 -210
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +17 -12
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +92 -84
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +219 -193
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +23 -18
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +1 -2
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +6 -6
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +12 -9
- package/dist/extensions/Blocks/Recommendation/extension.js +4 -2
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +4 -2
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +240 -190
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +19 -0
- package/dist/extensions/Blocks/Recommendation/utils/blockUrlConfig.js +25 -0
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +72 -70
- package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +69 -60
- package/dist/extensions/Blocks/Recommendation/utils/followUpApply.js +34 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +73 -28
- package/dist/extensions/Blocks/Recommendation/utils/restoreRefresh.js +36 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +39 -20
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +271 -192
- package/dist/package.json.js +1 -1
- package/dist/src/config/compiler/utils/itemsCompilerUtils.d.ts +10 -0
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +8 -0
- package/dist/src/extensions/Blocks/Items/block.d.ts +5 -0
- package/dist/src/extensions/Blocks/Items/constants/cardWidth.d.ts +12 -0
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +40 -0
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +22 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +1 -18
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +10 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +2 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +28 -6
- package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/blockUrlConfig.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/followUpApply.d.ts +20 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +15 -2
- package/dist/src/extensions/Blocks/Recommendation/utils/restoreRefresh.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +7 -0
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +22 -0
- package/dist/src/stores/editor.d.ts +3 -1
- package/dist/src/utils/liquidProtection.d.ts +3 -0
- package/dist/static/styles/components/button.css.js +5 -0
- package/dist/stores/editor.js +5 -0
- package/dist/utils/liquidProtection.js +5 -0
- package/dist/utils/templatePreparation.js +61 -85
- package/package.json +3 -3
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (o, e, t) =>
|
|
4
|
-
import { UEAttr as L
|
|
5
|
-
import { CommonControl as
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var _ = (o, e, t) => e in o ? p(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var a = (o, e, t) => _(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { UEAttr as L } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as N } from "../../../common-control.js";
|
|
6
6
|
import "../../constants/selectors.js";
|
|
7
|
-
import { LAYOUT_OPTIONS as
|
|
7
|
+
import { LAYOUT_OPTIONS as A, DEFAULT_MOBILE_ROW_SPACING as d, DEFAULT_MOBILE_COLUMN_SPACING as m, DEFAULT_ROW_SPACING as l, DEFAULT_COLUMN_SPACING as g } from "../../constants/layout.js";
|
|
8
8
|
import { RecommendationConfigService as u } from "../../services/configService.js";
|
|
9
|
-
import { useRecommendationExtensionStore as
|
|
9
|
+
import { useRecommendationExtensionStore as O } from "../../store/recommendation.js";
|
|
10
|
+
import { applyFollowUp as f } from "../../utils/followUpApply.js";
|
|
10
11
|
import { isPartnerManagedBlock as S, getCurrentLayout as C, getBlockElement as T, getCardComposition as U, regenerateProductRowsWithStyles as I } from "./utils.js";
|
|
11
12
|
const y = "recommendation-layout-orientation-control", s = {
|
|
12
13
|
LAYOUT: "layout"
|
|
@@ -17,10 +18,10 @@ const y = "recommendation-layout-orientation-control", s = {
|
|
|
17
18
|
MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
|
|
18
19
|
MOBILE_ROW_SPACING: "data-mobile-row-spacing"
|
|
19
20
|
};
|
|
20
|
-
class
|
|
21
|
+
class Y extends N {
|
|
21
22
|
constructor() {
|
|
22
23
|
super(...arguments);
|
|
23
|
-
a(this, "store",
|
|
24
|
+
a(this, "store", O());
|
|
24
25
|
a(this, "isChangingLayout", !1);
|
|
25
26
|
}
|
|
26
27
|
getId() {
|
|
@@ -33,7 +34,7 @@ class F extends A {
|
|
|
33
34
|
this._GuLabel({ text: this.api.translate("Layout Orientation") }),
|
|
34
35
|
this._GuRadioButton({
|
|
35
36
|
name: s.LAYOUT,
|
|
36
|
-
buttons:
|
|
37
|
+
buttons: A
|
|
37
38
|
})
|
|
38
39
|
])}
|
|
39
40
|
</div>
|
|
@@ -87,7 +88,7 @@ class F extends A {
|
|
|
87
88
|
`Changed layout to ${t}`
|
|
88
89
|
), this.store.patchCurrentBlockConfig({ orientation: t });
|
|
89
90
|
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, m.toString()).setAttribute(n.MOBILE_ROW_SPACING, d.toString());
|
|
90
|
-
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
|
|
91
|
+
t === "list" ? (i.setClass("es-m-p0"), i.setClass("ins-recommendation-list-layout")) : (i.removeClass("es-m-p0"), i.removeClass("ins-recommendation-list-layout")), f(i, `Update layout to ${t}`, !0), this._regenerateProductRows(t, h);
|
|
91
92
|
} finally {
|
|
92
93
|
this.isChangingLayout = !1;
|
|
93
94
|
}
|
|
@@ -104,7 +105,8 @@ class F extends A {
|
|
|
104
105
|
currentNode: this.currentNode,
|
|
105
106
|
documentModifier: this.api.getDocumentModifier(),
|
|
106
107
|
layout: t,
|
|
107
|
-
composition: r
|
|
108
|
+
composition: r,
|
|
109
|
+
hidden: !0
|
|
108
110
|
});
|
|
109
111
|
}
|
|
110
112
|
_listenToFormUpdates() {
|
|
@@ -115,5 +117,5 @@ class F extends A {
|
|
|
115
117
|
}
|
|
116
118
|
export {
|
|
117
119
|
y as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
118
|
-
|
|
120
|
+
Y as LayoutOrientationControl
|
|
119
121
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
var m = Object.defineProperty;
|
|
2
2
|
var p = (i, o, e) => o in i ? m(i, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[o] = e;
|
|
3
|
-
var
|
|
4
|
-
import { UEAttr as u
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { ATTR_PRODUCT_PRICE as
|
|
3
|
+
var c = (i, o, e) => p(i, typeof o != "symbol" ? o + "" : o, e);
|
|
4
|
+
import { UEAttr as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as h } from "../../../common-control.js";
|
|
6
|
+
import { ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_OLD_PRICE as _ } from "../../constants/selectors.js";
|
|
7
7
|
import { RecommendationConfigService as n } from "../../services/configService.js";
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
8
|
+
import { useRecommendationExtensionStore as I } from "../../store/recommendation.js";
|
|
9
|
+
import { applyFollowUp as T } from "../../utils/followUpApply.js";
|
|
9
10
|
import { getBlockElement as l, regenerateProductRowsWithStyles as g } from "./utils.js";
|
|
10
11
|
const E = "recommendation-price-placement-control", N = "hide-price", r = {
|
|
11
12
|
ORIENTATION: "priceOrientation",
|
|
@@ -14,10 +15,10 @@ const E = "recommendation-price-placement-control", N = "hide-price", r = {
|
|
|
14
15
|
{ icon: "vertical-orientation", value: "vertical" },
|
|
15
16
|
{ icon: "horizontal-orientation", value: "horizontal" }
|
|
16
17
|
], C = (i) => i ? "vertical" : "horizontal";
|
|
17
|
-
class
|
|
18
|
+
class v extends h {
|
|
18
19
|
constructor() {
|
|
19
20
|
super(...arguments);
|
|
20
|
-
|
|
21
|
+
c(this, "store", I());
|
|
21
22
|
}
|
|
22
23
|
getId() {
|
|
23
24
|
return E;
|
|
@@ -73,8 +74,8 @@ class P extends f {
|
|
|
73
74
|
const s = Array.from(
|
|
74
75
|
e.querySelectorAll(".recommendation-attribute-row[data-attribute-type]")
|
|
75
76
|
).some((a) => {
|
|
76
|
-
const
|
|
77
|
-
return (
|
|
77
|
+
const d = a.getAttribute("data-attribute-type");
|
|
78
|
+
return (d === f || d === _) && a.getAttribute("data-visibility") === "0";
|
|
78
79
|
});
|
|
79
80
|
this.api.setUIEAttribute(
|
|
80
81
|
r.ORIENTATION,
|
|
@@ -107,7 +108,10 @@ class P extends f {
|
|
|
107
108
|
*/
|
|
108
109
|
_stampHideIfSameAttr(e) {
|
|
109
110
|
const t = l(this.currentNode);
|
|
110
|
-
|
|
111
|
+
if (!t)
|
|
112
|
+
return;
|
|
113
|
+
const s = this.api.getDocumentModifier();
|
|
114
|
+
s.modifyHtml(t).setAttribute(N, String(e)), T(s, "Update hide-if-same price flag", !0);
|
|
111
115
|
}
|
|
112
116
|
/**
|
|
113
117
|
* Rebuilds the product rows so the renderer re-reads the inline/stacked
|
|
@@ -116,7 +120,8 @@ class P extends f {
|
|
|
116
120
|
_regenerate() {
|
|
117
121
|
this.currentNode && g({
|
|
118
122
|
currentNode: this.currentNode,
|
|
119
|
-
documentModifier: this.api.getDocumentModifier()
|
|
123
|
+
documentModifier: this.api.getDocumentModifier(),
|
|
124
|
+
hidden: !0
|
|
120
125
|
});
|
|
121
126
|
}
|
|
122
127
|
_listenToFormUpdates() {
|
|
@@ -129,5 +134,5 @@ class P extends f {
|
|
|
129
134
|
}
|
|
130
135
|
export {
|
|
131
136
|
E as PRICE_PLACEMENT_CONTROL_ID,
|
|
132
|
-
|
|
137
|
+
v as PricePlacementControl
|
|
133
138
|
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { UEAttr as
|
|
5
|
-
import { CommonControl as
|
|
1
|
+
var E = Object.defineProperty;
|
|
2
|
+
var f = (d, r, t) => r in d ? E(d, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[r] = t;
|
|
3
|
+
var c = (d, r, t) => f(d, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
import { UEAttr as u, EditorStatePropertyType as p, PreviewDeviceMode as T, ModificationDescription as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as M } from "../../../common-control.js";
|
|
6
6
|
import "../../constants/selectors.js";
|
|
7
|
-
import { MAX_PRODUCTS_PER_ROW as
|
|
7
|
+
import { MAX_PRODUCTS_PER_ROW as b, MAX_MOBILE_PRODUCTS_PER_ROW as y, DEFAULT_MOBILE_CARDS_IN_ROW as _ } from "../../constants/layout.js";
|
|
8
8
|
import { RecommendationConfigService as s } from "../../services/configService.js";
|
|
9
|
-
import { useRecommendationExtensionStore as
|
|
10
|
-
import {
|
|
11
|
-
import { isPartnerManagedBlock as
|
|
12
|
-
import { useDebounceFn as A } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
9
|
+
import { useRecommendationExtensionStore as D } from "../../store/recommendation.js";
|
|
10
|
+
import { ensureMobileCssRulesExist as C, stageMobileLayoutOptOut as P } from "../mobileLayout/cssRules.js";
|
|
11
|
+
import { isPartnerManagedBlock as w, getCurrentLayout as U, adjustProductsToSize as g, regenerateProductRowsWithStyles as L, regenerateMobileProductRows as I, getBlockElement as A } from "./utils.js";
|
|
13
12
|
const B = "recommendation-product-layout-control", e = {
|
|
14
13
|
// "Products in One Row" — shown when toggle is OFF
|
|
15
14
|
PRODUCT_IN_ROW: "cardsInRow",
|
|
@@ -24,16 +23,13 @@ const B = "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
|
-
l(this, "_debouncedRegenerateProductRows", A(() => {
|
|
35
|
-
this._regenerateProductRows();
|
|
36
|
-
}, 500));
|
|
37
33
|
}
|
|
38
34
|
getId() {
|
|
39
35
|
return B;
|
|
@@ -46,19 +42,19 @@ class F extends P {
|
|
|
46
42
|
text: this.api.translate("Products in One Row"),
|
|
47
43
|
name: e.PRODUCT_IN_ROW_LABEL
|
|
48
44
|
}),
|
|
49
|
-
this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue:
|
|
45
|
+
this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: b }),
|
|
50
46
|
this._GuLabel({
|
|
51
47
|
text: this.api.translate("Products in One Row on Desktop"),
|
|
52
48
|
name: e.PRODUCT_IN_ROW_DESKTOP_LABEL
|
|
53
49
|
}),
|
|
54
|
-
this._GuCounter({ name: e.PRODUCT_IN_ROW_DESKTOP, maxValue:
|
|
50
|
+
this._GuCounter({ name: e.PRODUCT_IN_ROW_DESKTOP, maxValue: b }),
|
|
55
51
|
this._GuLabel({
|
|
56
52
|
text: this.api.translate("Products in One Row on Mobile"),
|
|
57
53
|
name: e.MOBILE_CARDS_IN_ROW_LABEL
|
|
58
54
|
}),
|
|
59
55
|
this._GuCounter({
|
|
60
56
|
name: e.MOBILE_CARDS_IN_ROW,
|
|
61
|
-
maxValue:
|
|
57
|
+
maxValue: y
|
|
62
58
|
}),
|
|
63
59
|
this._GuLabel({
|
|
64
60
|
text: this.api.translate("Mobile Layout Optimization"),
|
|
@@ -86,8 +82,8 @@ class F extends P {
|
|
|
86
82
|
* these inputs there. Disabling coexists with the visibility logic above.
|
|
87
83
|
*/
|
|
88
84
|
_syncDisabledState() {
|
|
89
|
-
const t =
|
|
90
|
-
this.api.setUIEAttribute(e.PRODUCT_IN_ROW,
|
|
85
|
+
const t = w(this.currentNode);
|
|
86
|
+
this.api.setUIEAttribute(e.PRODUCT_IN_ROW, u.COUNTER.disabled, t), this.api.setUIEAttribute(e.PRODUCT_IN_ROW_DESKTOP, u.COUNTER.disabled, t), this.api.setUIEAttribute(e.MOBILE_CARDS_IN_ROW, u.COUNTER.disabled, t), this.api.setUIEAttribute(e.MOBILE_LAYOUT_TOGGLE, u.SWITCHER.disabled, t);
|
|
91
87
|
}
|
|
92
88
|
onDestroy() {
|
|
93
89
|
this.storeUnsubscription();
|
|
@@ -105,7 +101,7 @@ class F extends P {
|
|
|
105
101
|
* Returns true when the editor preview is in mobile mode.
|
|
106
102
|
*/
|
|
107
103
|
_isMobilePreview() {
|
|
108
|
-
return this.api.getEditorState()[
|
|
104
|
+
return this.api.getEditorState()[p.previewDeviceMode] === T.MOBILE;
|
|
109
105
|
}
|
|
110
106
|
/**
|
|
111
107
|
* Updates counter visibility based on layout, mobileLayoutEnabled, and editor preview mode.
|
|
@@ -119,12 +115,12 @@ class F extends P {
|
|
|
119
115
|
* elements, which Stripo does not apply reliably.
|
|
120
116
|
*/
|
|
121
117
|
_updateProductsInRowVisibility() {
|
|
122
|
-
var
|
|
123
|
-
const t = s.getConfig(this.currentNode), i = (t.layout ||
|
|
118
|
+
var m;
|
|
119
|
+
const t = s.getConfig(this.currentNode), i = (t.layout || U(this.currentNode)) === "grid", { mobileLayoutEnabled: n } = t, a = this._isMobilePreview();
|
|
124
120
|
this.api.setVisibility(e.MOBILE_LAYOUT_TOGGLE, i), this.api.setVisibility(e.MOBILE_LAYOUT_LABEL, i);
|
|
125
|
-
const
|
|
126
|
-
this.api.setVisibility(e.PRODUCT_IN_ROW,
|
|
127
|
-
const O = (
|
|
121
|
+
const l = i && !n, h = i && n && !a, R = i && n && a;
|
|
122
|
+
this.api.setVisibility(e.PRODUCT_IN_ROW, l), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, l), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP, h), this.api.setVisibility(e.PRODUCT_IN_ROW_DESKTOP_LABEL, h), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, R), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, R);
|
|
123
|
+
const O = (m = this.getContainer()) == null ? void 0 : m.querySelector("[data-product-layout-control]");
|
|
128
124
|
O && (O.style.display = i ? "" : "none");
|
|
129
125
|
}
|
|
130
126
|
/**
|
|
@@ -135,7 +131,7 @@ class F extends P {
|
|
|
135
131
|
const t = s.getConfig(this.currentNode);
|
|
136
132
|
this.api.setUIEAttribute(
|
|
137
133
|
e.MOBILE_LAYOUT_TOGGLE,
|
|
138
|
-
|
|
134
|
+
u.SELECTPICKER.items,
|
|
139
135
|
t.mobileLayoutEnabled
|
|
140
136
|
);
|
|
141
137
|
}
|
|
@@ -148,55 +144,65 @@ class F extends P {
|
|
|
148
144
|
if (!this.currentNode)
|
|
149
145
|
return;
|
|
150
146
|
const o = s.getConfig(this.currentNode);
|
|
151
|
-
if (o.mobileLayoutEnabled
|
|
147
|
+
if (o.mobileLayoutEnabled !== t) {
|
|
148
|
+
if (t) {
|
|
149
|
+
const i = o.previousMobileCardsInRow || _;
|
|
150
|
+
this._commitMobileLayoutToggle(
|
|
151
|
+
{
|
|
152
|
+
mobileLayoutEnabled: !0,
|
|
153
|
+
mobileCardsInRow: i
|
|
154
|
+
},
|
|
155
|
+
!1,
|
|
156
|
+
"Enabled mobile layout optimization"
|
|
157
|
+
), this.store.patchCurrentBlockConfig(
|
|
158
|
+
{
|
|
159
|
+
mobileLayoutEnabled: !0,
|
|
160
|
+
mobileCardsInRow: i
|
|
161
|
+
},
|
|
162
|
+
{ triggerRefetch: !1 }
|
|
163
|
+
), C(this.api, !0);
|
|
164
|
+
const n = parseInt(o.size) || 6, a = g(this.store.recommendationProducts, n);
|
|
165
|
+
L({
|
|
166
|
+
currentNode: this.currentNode,
|
|
167
|
+
documentModifier: this.api.getDocumentModifier(),
|
|
168
|
+
products: a,
|
|
169
|
+
hidden: !0
|
|
170
|
+
});
|
|
171
|
+
} else {
|
|
172
|
+
const i = o.mobileCardsInRow;
|
|
173
|
+
this._commitMobileLayoutToggle(
|
|
174
|
+
{
|
|
175
|
+
mobileLayoutEnabled: !1,
|
|
176
|
+
previousMobileCardsInRow: i,
|
|
177
|
+
mobileCardsInRow: _
|
|
178
|
+
},
|
|
179
|
+
!0,
|
|
180
|
+
"Disabled mobile layout optimization"
|
|
181
|
+
), this.store.patchCurrentBlockConfig(
|
|
182
|
+
{
|
|
183
|
+
mobileLayoutEnabled: !1,
|
|
184
|
+
mobileCardsInRow: _
|
|
185
|
+
},
|
|
186
|
+
{ triggerRefetch: !1 }
|
|
187
|
+
), I({
|
|
188
|
+
currentNode: this.currentNode,
|
|
189
|
+
documentModifier: this.api.getDocumentModifier(),
|
|
190
|
+
hidden: !0
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
this._setFormValues(), this._updateProductsInRowVisibility();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// One apply: a config/class mismatch between two applies makes the block's self-heal write its own entry.
|
|
197
|
+
_commitMobileLayoutToggle(t, o, i) {
|
|
198
|
+
if (!this.currentNode)
|
|
152
199
|
return;
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
this.currentNode,
|
|
159
|
-
{
|
|
160
|
-
mobileLayoutEnabled: !0,
|
|
161
|
-
mobileCardsInRow: r
|
|
162
|
-
},
|
|
163
|
-
"Enabled mobile layout optimization"
|
|
164
|
-
), this.store.patchCurrentBlockConfig(
|
|
165
|
-
{
|
|
166
|
-
mobileLayoutEnabled: !0,
|
|
167
|
-
mobileCardsInRow: r
|
|
168
|
-
},
|
|
169
|
-
{ triggerRefetch: !1 }
|
|
170
|
-
), i && m(this.api, i, !1), L(this.api);
|
|
171
|
-
const u = parseInt(o.size) || 6, c = I(this.store.recommendationProducts, u);
|
|
172
|
-
g({
|
|
173
|
-
currentNode: this.currentNode,
|
|
174
|
-
documentModifier: this.api.getDocumentModifier(),
|
|
175
|
-
products: c
|
|
176
|
-
});
|
|
177
|
-
} else {
|
|
178
|
-
const r = o.mobileCardsInRow;
|
|
179
|
-
s.updateConfig(
|
|
180
|
-
this.api,
|
|
181
|
-
this.currentNode,
|
|
182
|
-
{
|
|
183
|
-
mobileLayoutEnabled: !1,
|
|
184
|
-
previousMobileCardsInRow: r,
|
|
185
|
-
mobileCardsInRow: _
|
|
186
|
-
},
|
|
187
|
-
"Disabled mobile layout optimization"
|
|
188
|
-
), this.store.patchCurrentBlockConfig(
|
|
189
|
-
{
|
|
190
|
-
mobileLayoutEnabled: !1,
|
|
191
|
-
mobileCardsInRow: _
|
|
192
|
-
},
|
|
193
|
-
{ triggerRefetch: !1 }
|
|
194
|
-
), i && m(this.api, i, !0), E({
|
|
195
|
-
currentNode: this.currentNode,
|
|
196
|
-
documentModifier: this.api.getDocumentModifier()
|
|
197
|
-
});
|
|
200
|
+
const n = this.api.getDocumentModifier(), a = A(this.currentNode);
|
|
201
|
+
try {
|
|
202
|
+
s.stageConfig(n, this.currentNode, t), a && P(n, a, o), n.apply(new N(i));
|
|
203
|
+
} catch (l) {
|
|
204
|
+
console.warn("[recommendation] mobile layout toggle write failed", l);
|
|
198
205
|
}
|
|
199
|
-
this._setFormValues(), this._updateProductsInRowVisibility();
|
|
200
206
|
}
|
|
201
207
|
_onProductsInRowChange(t) {
|
|
202
208
|
!this.currentNode || s.getConfig(this.currentNode).cardsInRow === t || (s.updateConfig(
|
|
@@ -204,7 +210,7 @@ class F extends P {
|
|
|
204
210
|
this.currentNode,
|
|
205
211
|
{ cardsInRow: t },
|
|
206
212
|
`Changed products per row to ${t}`
|
|
207
|
-
), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this.
|
|
213
|
+
), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._regenerateProductRows());
|
|
208
214
|
}
|
|
209
215
|
_onMobileCardsInRowChange(t) {
|
|
210
216
|
!this.currentNode || s.getConfig(this.currentNode).mobileCardsInRow === t || (s.updateConfig(
|
|
@@ -212,20 +218,22 @@ class F extends P {
|
|
|
212
218
|
this.currentNode,
|
|
213
219
|
{ mobileCardsInRow: t },
|
|
214
220
|
`Changed mobile products per row to ${t}`
|
|
215
|
-
),
|
|
221
|
+
), C(this.api, !0), this.store.patchCurrentBlockConfig(
|
|
216
222
|
{ mobileCardsInRow: t },
|
|
217
223
|
{ triggerRefetch: !1 }
|
|
218
|
-
),
|
|
224
|
+
), I({
|
|
219
225
|
currentNode: this.currentNode,
|
|
220
|
-
documentModifier: this.api.getDocumentModifier()
|
|
226
|
+
documentModifier: this.api.getDocumentModifier(),
|
|
227
|
+
hidden: !0
|
|
221
228
|
}));
|
|
222
229
|
}
|
|
223
230
|
_regenerateProductRows() {
|
|
224
|
-
const t = s.getConfig(this.currentNode), o = parseInt(t.size) || 6, i =
|
|
225
|
-
|
|
231
|
+
const t = s.getConfig(this.currentNode), o = parseInt(t.size) || 6, i = g(this.store.recommendationProducts, o);
|
|
232
|
+
L({
|
|
226
233
|
currentNode: this.currentNode,
|
|
227
234
|
documentModifier: this.api.getDocumentModifier(),
|
|
228
|
-
products: i
|
|
235
|
+
products: i,
|
|
236
|
+
hidden: !0
|
|
229
237
|
});
|
|
230
238
|
}
|
|
231
239
|
_listenToFormUpdates() {
|
|
@@ -257,7 +265,7 @@ class F extends P {
|
|
|
257
265
|
*/
|
|
258
266
|
_listenEditorModeChanges() {
|
|
259
267
|
this.api.onEditorStatePropUpdated(
|
|
260
|
-
|
|
268
|
+
p.previewDeviceMode,
|
|
261
269
|
() => {
|
|
262
270
|
s.getConfig(this.currentNode).mobileLayoutEnabled && this._updateProductsInRowVisibility();
|
|
263
271
|
}
|
|
@@ -266,5 +274,5 @@ class F extends P {
|
|
|
266
274
|
}
|
|
267
275
|
export {
|
|
268
276
|
B as PRODUCT_LAYOUT_CONTROL_ID,
|
|
269
|
-
|
|
277
|
+
v as ProductLayoutControl
|
|
270
278
|
};
|