@useinsider/guido 3.20.1 → 3.21.0-beta.0df5409
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/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +65 -64
- package/dist/components/organisms/AutoSaveController.vue2.js +10 -9
- package/dist/components/organisms/header/EditorActions.vue.js +4 -4
- package/dist/components/organisms/header/EditorActions.vue2.js +53 -51
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +23 -22
- package/dist/composables/useActionsApi.js +80 -63
- package/dist/composables/useAutoSave.js +46 -44
- package/dist/composables/useGuidoStateBridge.js +3 -3
- package/dist/composables/useLegacyStrategyConversion.js +16 -16
- package/dist/composables/useSave.js +26 -23
- package/dist/composables/useSaveValidation.js +113 -114
- package/dist/composables/useSaveValidationRollout.js +17 -6
- package/dist/composables/useStripo.js +11 -10
- package/dist/extensions/Blocks/Items/block.js +43 -42
- package/dist/extensions/Blocks/Recommendation/block.js +33 -29
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +78 -83
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +1 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +2 -12
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +104 -86
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +348 -263
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +48 -50
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +16 -21
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +44 -40
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +14 -19
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +104 -102
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +18 -23
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +312 -286
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +24 -20
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +6 -7
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +113 -151
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +221 -203
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +28 -0
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/currencySettings.js +25 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +111 -40
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +31 -35
- package/dist/extensions/Blocks/Unsubscribe/block.js +70 -75
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +271 -192
- package/dist/package.json.js +1 -1
- package/dist/services/settingsApi.js +11 -0
- package/dist/src/components/Guido.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/composables/useActionsApi.d.ts +5 -1
- package/dist/src/composables/useAutoSave.d.ts +4 -1
- package/dist/src/composables/useSaveValidationRollout.d.ts +1 -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/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 +1 -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 -6
- 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 +5 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +21 -12
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +6 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +6 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +21 -9
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +19 -13
- 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 +10 -8
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +9 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +9 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +17 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/currencySettings.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +18 -11
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +1 -6
- 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/services/settingsApi.d.ts +6 -0
- package/dist/src/stores/editor.d.ts +3 -1
- package/dist/src/stores/setup-settings.d.ts +4 -0
- package/dist/static/styles/components/button.css.js +5 -0
- package/dist/stores/editor.js +5 -0
- package/dist/stores/setup-settings.js +10 -0
- package/package.json +4 -4
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { UEAttr as
|
|
5
|
-
import { CommonControl as
|
|
1
|
+
var N = Object.defineProperty;
|
|
2
|
+
var O = (o, e, t) => e in o ? N(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var c = (o, e, t) => O(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { UEAttr as A, ModificationDescription as S } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as f } from "../../../common-control.js";
|
|
6
6
|
import "../../constants/selectors.js";
|
|
7
|
-
import { LAYOUT_OPTIONS as
|
|
8
|
-
import { RecommendationConfigService as
|
|
9
|
-
import { useRecommendationExtensionStore as
|
|
10
|
-
import { isPartnerManagedBlock as
|
|
11
|
-
const
|
|
7
|
+
import { LAYOUT_OPTIONS as T, DEFAULT_MOBILE_ROW_SPACING as g, DEFAULT_MOBILE_COLUMN_SPACING as C, DEFAULT_ROW_SPACING as _, DEFAULT_COLUMN_SPACING as h } from "../../constants/layout.js";
|
|
8
|
+
import { RecommendationConfigService as l } from "../../services/configService.js";
|
|
9
|
+
import { useRecommendationExtensionStore as U } from "../../store/recommendation.js";
|
|
10
|
+
import { isPartnerManagedBlock as I, getCurrentLayout as L, getBlockElement as y, getCardComposition as E, regenerateProductRowsWithStyles as R } from "./utils.js";
|
|
11
|
+
const b = "recommendation-layout-orientation-control", u = {
|
|
12
12
|
LAYOUT: "layout"
|
|
13
|
-
},
|
|
13
|
+
}, i = {
|
|
14
14
|
LAYOUT: "data-layout",
|
|
15
15
|
COLUMN_SPACING: "data-column-spacing",
|
|
16
16
|
ROW_SPACING: "data-row-spacing",
|
|
17
17
|
MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
|
|
18
18
|
MOBILE_ROW_SPACING: "data-mobile-row-spacing"
|
|
19
19
|
};
|
|
20
|
-
class
|
|
20
|
+
class W extends f {
|
|
21
21
|
constructor() {
|
|
22
22
|
super(...arguments);
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
c(this, "store", U());
|
|
24
|
+
c(this, "isChangingLayout", !1);
|
|
25
25
|
}
|
|
26
26
|
getId() {
|
|
27
|
-
return
|
|
27
|
+
return b;
|
|
28
28
|
}
|
|
29
29
|
getTemplate() {
|
|
30
30
|
return `
|
|
@@ -32,8 +32,8 @@ class F extends A {
|
|
|
32
32
|
${this._GuTwoColumns([
|
|
33
33
|
this._GuLabel({ text: this.api.translate("Layout Orientation") }),
|
|
34
34
|
this._GuRadioButton({
|
|
35
|
-
name:
|
|
36
|
-
buttons:
|
|
35
|
+
name: u.LAYOUT,
|
|
36
|
+
buttons: T
|
|
37
37
|
})
|
|
38
38
|
])}
|
|
39
39
|
</div>
|
|
@@ -51,15 +51,15 @@ class F extends A {
|
|
|
51
51
|
*/
|
|
52
52
|
_syncDisabledState() {
|
|
53
53
|
this.api.setUIEAttribute(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
u.LAYOUT,
|
|
55
|
+
A.RADIO_BUTTONS.disabled,
|
|
56
|
+
I(this.currentNode)
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
59
|
_setFormValues() {
|
|
60
|
-
const
|
|
60
|
+
const n = l.getConfig(this.currentNode).layout || L(this.currentNode);
|
|
61
61
|
this.api.updateValues({
|
|
62
|
-
[
|
|
62
|
+
[u.LAYOUT]: n
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
@@ -67,53 +67,51 @@ class F extends A {
|
|
|
67
67
|
* Updates node config, data attribute and regenerates product rows
|
|
68
68
|
*/
|
|
69
69
|
_onLayoutChange(t) {
|
|
70
|
-
if (this.isChangingLayout || !this.currentNode || (
|
|
70
|
+
if (this.isChangingLayout || !this.currentNode || (l.getConfig(this.currentNode).layout || L(this.currentNode)) === t)
|
|
71
71
|
return;
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
72
|
+
const r = y(this.currentNode);
|
|
73
|
+
if (r) {
|
|
74
74
|
this.isChangingLayout = !0;
|
|
75
75
|
try {
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
`Changed layout to ${t}`
|
|
88
|
-
), this.store.patchCurrentBlockConfig({ orientation: t });
|
|
89
|
-
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.apply(new N(`Update layout to ${t}`)), this._regenerateProductRows(t, h);
|
|
76
|
+
const p = E(this.currentNode, this.store.filterList), m = {
|
|
77
|
+
layout: t,
|
|
78
|
+
columnSpacing: h,
|
|
79
|
+
rowSpacing: _,
|
|
80
|
+
mobileColumnSpacing: C,
|
|
81
|
+
mobileRowSpacing: g
|
|
82
|
+
}, s = this.api.getDocumentModifier();
|
|
83
|
+
l.stageConfig(s, this.currentNode, m), this.store.patchCurrentBlockConfig({ orientation: t });
|
|
84
|
+
const a = s.modifyHtml(r).setAttribute(i.LAYOUT, t).setAttribute(i.COLUMN_SPACING, h.toString()).setAttribute(i.ROW_SPACING, _.toString()).setAttribute(i.MOBILE_COLUMN_SPACING, C.toString()).setAttribute(i.MOBILE_ROW_SPACING, g.toString());
|
|
85
|
+
t === "list" ? (a.setClass("es-m-p0"), a.setClass("ins-recommendation-list-layout")) : (a.removeClass("es-m-p0"), a.removeClass("ins-recommendation-list-layout")), this._regenerateProductRows(s, t, p, m), s.apply(new S(`Changed layout to ${t}`));
|
|
91
86
|
} finally {
|
|
92
87
|
this.isChangingLayout = !1;
|
|
93
88
|
}
|
|
94
89
|
}
|
|
95
90
|
}
|
|
96
91
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
92
|
+
* Stages the product rows for the selected layout into the caller's batch,
|
|
93
|
+
* with the user's styles preserved.
|
|
99
94
|
* @param layout - The layout to use for regeneration (passed explicitly to avoid stale DOM reads)
|
|
100
95
|
* @param composition - The preserved card composition, incl. customAttr:* entries
|
|
96
|
+
* @param configOverrides - The config staged in the same batch (spacing defaults)
|
|
101
97
|
*/
|
|
102
|
-
_regenerateProductRows(t, r) {
|
|
103
|
-
this.currentNode &&
|
|
98
|
+
_regenerateProductRows(t, n, d, r) {
|
|
99
|
+
this.currentNode && R({
|
|
104
100
|
currentNode: this.currentNode,
|
|
105
|
-
documentModifier:
|
|
106
|
-
layout:
|
|
107
|
-
composition:
|
|
101
|
+
documentModifier: t,
|
|
102
|
+
layout: n,
|
|
103
|
+
composition: d,
|
|
104
|
+
configOverrides: r,
|
|
105
|
+
stageOnly: !0
|
|
108
106
|
});
|
|
109
107
|
}
|
|
110
108
|
_listenToFormUpdates() {
|
|
111
|
-
this.api.onValueChanged(
|
|
109
|
+
this.api.onValueChanged(u.LAYOUT, (t) => {
|
|
112
110
|
this._onLayoutChange(t);
|
|
113
111
|
});
|
|
114
112
|
}
|
|
115
113
|
}
|
|
116
114
|
export {
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
b as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
116
|
+
W as LayoutOrientationControl
|
|
119
117
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { UEAttr as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { RecommendationConfigService as
|
|
7
|
-
import { useRecommendationExtensionStore as
|
|
8
|
-
const
|
|
1
|
+
var a = Object.defineProperty;
|
|
2
|
+
var s = (o, t, e) => t in o ? a(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var i = (o, t, e) => s(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { UEAttr as r } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as l } from "../../../common-control.js";
|
|
6
|
+
import { RecommendationConfigService as m } from "../../services/configService.js";
|
|
7
|
+
import { useRecommendationExtensionStore as c } from "../../store/recommendation.js";
|
|
8
|
+
const g = "recommendation-locale-control", n = {
|
|
9
9
|
LOCALE: "language"
|
|
10
10
|
};
|
|
11
|
-
class
|
|
11
|
+
class C extends l {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
14
14
|
// Store is used ONLY for API-fetched data (language options), not for config
|
|
15
|
-
|
|
15
|
+
i(this, "store", c());
|
|
16
16
|
}
|
|
17
17
|
getId() {
|
|
18
|
-
return
|
|
18
|
+
return g;
|
|
19
19
|
}
|
|
20
20
|
getTemplate() {
|
|
21
21
|
return `
|
|
@@ -38,7 +38,7 @@ class E extends c {
|
|
|
38
38
|
super.onTemplateNodeUpdated(e), this._setFormValues();
|
|
39
39
|
}
|
|
40
40
|
_setFormValues() {
|
|
41
|
-
const e =
|
|
41
|
+
const e = m.getConfig(this.currentNode);
|
|
42
42
|
this.api.updateValues({
|
|
43
43
|
[n.LOCALE]: e.language
|
|
44
44
|
});
|
|
@@ -46,17 +46,12 @@ class E extends c {
|
|
|
46
46
|
_initializeSelectItems() {
|
|
47
47
|
this.api.setUIEAttribute(
|
|
48
48
|
n.LOCALE,
|
|
49
|
-
|
|
49
|
+
r.SELECTPICKER.items,
|
|
50
50
|
this.store.getLanguages
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
_onLocaleChange(e) {
|
|
54
|
-
|
|
55
|
-
this.api,
|
|
56
|
-
this.currentNode,
|
|
57
|
-
{ language: e },
|
|
58
|
-
`Changed language to ${e}`
|
|
59
|
-
), this.store.patchCurrentBlockConfig({ language: e }));
|
|
54
|
+
this.currentNode && this.store.recommendationConfigs.language !== e && this.store.patchCurrentBlockConfig({ language: e });
|
|
60
55
|
}
|
|
61
56
|
_listenToFormUpdates() {
|
|
62
57
|
this.api.onValueChanged(n.LOCALE, (e) => {
|
|
@@ -65,6 +60,6 @@ class E extends c {
|
|
|
65
60
|
}
|
|
66
61
|
}
|
|
67
62
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
g as LOCALE_CONTROL_ID,
|
|
64
|
+
C as LocaleControl
|
|
70
65
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var d = (
|
|
4
|
-
import { UEAttr as
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var h = (o, n, e) => n in o ? p(o, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[n] = e;
|
|
3
|
+
var d = (o, n, e) => h(o, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
+
import { UEAttr as l, ModificationDescription as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
5
|
import { CommonControl as f } from "../../../common-control.js";
|
|
6
6
|
import { ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OLD_PRICE as I } from "../../constants/selectors.js";
|
|
7
|
-
import { RecommendationConfigService as
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
import { getBlockElement as
|
|
7
|
+
import { RecommendationConfigService as a } from "../../services/configService.js";
|
|
8
|
+
import { useRecommendationExtensionStore as g } from "../../store/recommendation.js";
|
|
9
|
+
import { getBlockElement as m, regenerateProductRowsWithStyles as T } from "./utils.js";
|
|
10
10
|
const E = "recommendation-price-placement-control", N = "hide-price", r = {
|
|
11
11
|
ORIENTATION: "priceOrientation",
|
|
12
12
|
HIDE_IF_SAME: "priceHideIfSameAsDiscounted"
|
|
13
13
|
}, A = [
|
|
14
14
|
{ icon: "vertical-orientation", value: "vertical" },
|
|
15
15
|
{ icon: "horizontal-orientation", value: "horizontal" }
|
|
16
|
-
], C = (
|
|
17
|
-
class
|
|
16
|
+
], C = (o) => o ? "vertical" : "horizontal";
|
|
17
|
+
class y extends f {
|
|
18
18
|
constructor() {
|
|
19
19
|
super(...arguments);
|
|
20
|
-
d(this, "store",
|
|
20
|
+
d(this, "store", g());
|
|
21
21
|
}
|
|
22
22
|
getId() {
|
|
23
23
|
return E;
|
|
@@ -40,11 +40,11 @@ class P extends f {
|
|
|
40
40
|
`;
|
|
41
41
|
}
|
|
42
42
|
onRender() {
|
|
43
|
-
const e =
|
|
43
|
+
const e = a.getConfig(this.currentNode);
|
|
44
44
|
this._initializeHideToggle(e), this._setFormValues(e), this._updateOrientationDisabled(), this._listenToFormUpdates();
|
|
45
45
|
}
|
|
46
46
|
onTemplateNodeUpdated(e) {
|
|
47
|
-
super.onTemplateNodeUpdated(e), this._setFormValues(
|
|
47
|
+
super.onTemplateNodeUpdated(e), this._setFormValues(a.getConfig(this.currentNode)), this._updateOrientationDisabled();
|
|
48
48
|
}
|
|
49
49
|
_setFormValues(e) {
|
|
50
50
|
this.api.updateValues({
|
|
@@ -55,7 +55,7 @@ class P extends f {
|
|
|
55
55
|
_initializeHideToggle(e) {
|
|
56
56
|
this.api.setUIEAttribute(
|
|
57
57
|
r.HIDE_IF_SAME,
|
|
58
|
-
|
|
58
|
+
l.SELECTPICKER.items,
|
|
59
59
|
e.priceHideIfSameAsDiscounted
|
|
60
60
|
);
|
|
61
61
|
}
|
|
@@ -67,56 +67,60 @@ class P extends f {
|
|
|
67
67
|
* the merged "Product Prices" entry (the price row) governs.
|
|
68
68
|
*/
|
|
69
69
|
_updateOrientationDisabled() {
|
|
70
|
-
const e =
|
|
70
|
+
const e = m(this.currentNode);
|
|
71
71
|
if (!e || !("querySelectorAll" in e))
|
|
72
72
|
return;
|
|
73
|
-
const
|
|
73
|
+
const i = Array.from(
|
|
74
74
|
e.querySelectorAll(".recommendation-attribute-row[data-attribute-type]")
|
|
75
|
-
).some((
|
|
76
|
-
const
|
|
77
|
-
return (
|
|
75
|
+
).some((c) => {
|
|
76
|
+
const s = c.getAttribute("data-attribute-type");
|
|
77
|
+
return (s === _ || s === I) && c.getAttribute("data-visibility") === "0";
|
|
78
78
|
});
|
|
79
79
|
this.api.setUIEAttribute(
|
|
80
80
|
r.ORIENTATION,
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
l.RADIO_BUTTONS.disabled,
|
|
82
|
+
i ? "true" : "false"
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
_onOrientationChange(e) {
|
|
86
86
|
if (!this.currentNode)
|
|
87
87
|
return;
|
|
88
88
|
const t = e === "vertical";
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
`${t ? "Stacked" : "Inlined"} recommendation prices`
|
|
94
|
-
)
|
|
89
|
+
if (a.getConfig(this.currentNode).priceMovedToNextLine === t)
|
|
90
|
+
return;
|
|
91
|
+
const c = { priceMovedToNextLine: t }, s = this.api.getDocumentModifier();
|
|
92
|
+
a.stageConfig(s, this.currentNode, c), this.store.patchCurrentBlockConfig({ priceMovedToNextLine: t }), this._regenerate(s, c), s.apply(
|
|
93
|
+
new u(`${t ? "Stacked" : "Inlined"} recommendation prices`)
|
|
94
|
+
);
|
|
95
95
|
}
|
|
96
96
|
_onHideIfSameChange(e) {
|
|
97
|
-
!this.currentNode ||
|
|
98
|
-
|
|
97
|
+
if (!this.currentNode || a.getConfig(this.currentNode).priceHideIfSameAsDiscounted === e)
|
|
98
|
+
return;
|
|
99
|
+
const i = this.api.getDocumentModifier();
|
|
100
|
+
a.stageConfig(
|
|
101
|
+
i,
|
|
99
102
|
this.currentNode,
|
|
100
|
-
{ priceHideIfSameAsDiscounted: e }
|
|
101
|
-
|
|
102
|
-
), this.store.patchCurrentBlockConfig({ priceHideIfSameAsDiscounted: e }), this._stampHideIfSameAttr(e));
|
|
103
|
+
{ priceHideIfSameAsDiscounted: e }
|
|
104
|
+
), this.store.patchCurrentBlockConfig({ priceHideIfSameAsDiscounted: e }), this._stampHideIfSameAttr(i, e), i.apply(new u(`${e ? "Enabled" : "Disabled"} hide-if-same price`));
|
|
103
105
|
}
|
|
104
106
|
/**
|
|
105
107
|
* Mirrors the hide-if-same flag onto the durable `hide-price` block attribute
|
|
106
108
|
* read by email-service at send time.
|
|
107
109
|
*/
|
|
108
|
-
_stampHideIfSameAttr(e) {
|
|
109
|
-
const
|
|
110
|
-
|
|
110
|
+
_stampHideIfSameAttr(e, t) {
|
|
111
|
+
const i = m(this.currentNode);
|
|
112
|
+
i && e.modifyHtml(i).setAttribute(N, String(t));
|
|
111
113
|
}
|
|
112
114
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
+
* Stages the rebuilt product rows into the caller's batch so the renderer
|
|
116
|
+
* reads the inline/stacked flag being written. Used by the orientation change only.
|
|
115
117
|
*/
|
|
116
|
-
_regenerate() {
|
|
117
|
-
this.currentNode &&
|
|
118
|
+
_regenerate(e, t) {
|
|
119
|
+
this.currentNode && T({
|
|
118
120
|
currentNode: this.currentNode,
|
|
119
|
-
documentModifier:
|
|
121
|
+
documentModifier: e,
|
|
122
|
+
configOverrides: t,
|
|
123
|
+
stageOnly: !0
|
|
120
124
|
});
|
|
121
125
|
}
|
|
122
126
|
_listenToFormUpdates() {
|
|
@@ -129,5 +133,5 @@ class P extends f {
|
|
|
129
133
|
}
|
|
130
134
|
export {
|
|
131
135
|
E as PRICE_PLACEMENT_CONTROL_ID,
|
|
132
|
-
|
|
136
|
+
y as PricePlacementControl
|
|
133
137
|
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var s = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
2
|
+
var i = (e, o, t) => o in e ? s(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
|
|
3
|
+
var r = (e, o, t) => i(e, typeof o != "symbol" ? o + "" : o, t);
|
|
4
4
|
import { CommonControl as a } from "../../../common-control.js";
|
|
5
5
|
import "../../constants/selectors.js";
|
|
6
|
-
import { MAX_PRODUCT_COUNT as
|
|
7
|
-
import { RecommendationConfigService as
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
const
|
|
6
|
+
import { MAX_PRODUCT_COUNT as m } from "../../constants/layout.js";
|
|
7
|
+
import { RecommendationConfigService as u } from "../../services/configService.js";
|
|
8
|
+
import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
|
|
9
|
+
const d = "recommendation-product-count-control", n = {
|
|
10
10
|
PRODUCT_COUNT: "size"
|
|
11
11
|
};
|
|
12
12
|
class U extends a {
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
|
-
|
|
15
|
+
r(this, "store", C());
|
|
16
16
|
}
|
|
17
17
|
getId() {
|
|
18
|
-
return
|
|
18
|
+
return d;
|
|
19
19
|
}
|
|
20
20
|
getTemplate() {
|
|
21
21
|
return `
|
|
22
22
|
<div class="product-count-control-container">
|
|
23
23
|
${this._GuTwoColumns([
|
|
24
24
|
this._GuLabel({ text: this.api.translate("Number of Products") }),
|
|
25
|
-
this._GuCounter({ name:
|
|
25
|
+
this._GuCounter({ name: n.PRODUCT_COUNT, maxValue: m })
|
|
26
26
|
])}
|
|
27
27
|
</div>
|
|
28
28
|
`;
|
|
@@ -34,26 +34,21 @@ class U extends a {
|
|
|
34
34
|
super.onTemplateNodeUpdated(t), this._setFormValues();
|
|
35
35
|
}
|
|
36
36
|
_setFormValues() {
|
|
37
|
-
const t =
|
|
37
|
+
const t = u.getConfig(this.currentNode);
|
|
38
38
|
this.api.updateValues({
|
|
39
|
-
[
|
|
39
|
+
[n.PRODUCT_COUNT]: t.size
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
_onProductCountChange(t) {
|
|
43
|
-
|
|
44
|
-
this.api,
|
|
45
|
-
this.currentNode,
|
|
46
|
-
{ size: t },
|
|
47
|
-
`Changed product count to ${t}`
|
|
48
|
-
), this.store.patchCurrentBlockConfig({ size: t }));
|
|
43
|
+
this.currentNode && this.store.recommendationConfigs.size !== t && this.store.patchCurrentBlockConfig({ size: t });
|
|
49
44
|
}
|
|
50
45
|
_listenToFormUpdates() {
|
|
51
|
-
this.api.onValueChanged(
|
|
46
|
+
this.api.onValueChanged(n.PRODUCT_COUNT, (t) => {
|
|
52
47
|
this._onProductCountChange(t.toString());
|
|
53
48
|
});
|
|
54
49
|
}
|
|
55
50
|
}
|
|
56
51
|
export {
|
|
57
|
-
|
|
52
|
+
d as PRODUCT_COUNT_CONTROL_ID,
|
|
58
53
|
U as ProductCountControl
|
|
59
54
|
};
|