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