@useinsider/guido 2.0.0-beta.1c331b8 → 2.0.0-beta.1f72712
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/extensions/Blocks/Recommendation/block.js +40 -6
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +64 -0
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +9 -4
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +17 -9
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +48 -54
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +42 -36
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +51 -27
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +146 -73
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +49 -35
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +23 -13
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +41 -41
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +27 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +79 -67
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +85 -79
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +8 -4
- package/dist/extensions/Blocks/Recommendation/services/configService.js +239 -0
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +30 -28
- package/dist/extensions/Blocks/Recommendation/templates/horizontal/elementRenderer.js +49 -25
- package/dist/extensions/Blocks/Recommendation/templates/horizontal/template.js +18 -19
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +44 -101
- package/dist/extensions/Blocks/Recommendation/templates/vertical/elementRenderer.js +60 -35
- package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +6 -0
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +29 -0
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +46 -0
- package/dist/extensions/Blocks/common-control.js +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +214 -157
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +49 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +3 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +13 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +30 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +4 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +13 -2
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +151 -0
- package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +154 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +33 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +77 -0
- package/package.json +1 -1
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
var u = Object.defineProperty;
|
|
2
2
|
var d = (i, o, t) => o in i ? u(i, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[o] = t;
|
|
3
|
-
var
|
|
4
|
-
import { UEAttr as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
3
|
+
var n = (i, o, t) => d(i, typeof o != "symbol" ? o + "" : o, t);
|
|
5
4
|
import { CommonControl as c } from "../../../common-control.js";
|
|
6
|
-
import { MAX_PRODUCT_COUNT as _, MAX_PRODUCTS_PER_ROW as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
5
|
+
import { MAX_PRODUCT_COUNT as _, MAX_PRODUCTS_PER_ROW as h } from "../../constants/layout.js";
|
|
6
|
+
import { RecommendationConfigService as r } from "../../services/configService.js";
|
|
7
|
+
import { useRecommendationExtensionStore as R } from "../../store/recommendation.js";
|
|
8
|
+
import { getCurrentLayout as m, regenerateProductRows as p, reapplySpacing as C } from "./utils.js";
|
|
9
|
+
import { useDebounceFn as g } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
10
|
+
const l = "recommendation-product-layout-control", e = {
|
|
11
11
|
PRODUCT_COUNT: "size",
|
|
12
12
|
PRODUCT_IN_ROW: "cardsInRow",
|
|
13
13
|
PRODUCT_IN_ROW_LABEL: "cardsInRowLabel"
|
|
14
14
|
};
|
|
15
|
-
class
|
|
15
|
+
class b extends c {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments);
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
// Store is used for backward compatibility with product fetching and regeneration
|
|
19
|
+
n(this, "store", R());
|
|
20
|
+
n(this, "storeUnsubscription", () => {
|
|
20
21
|
});
|
|
21
|
-
|
|
22
|
+
n(this, "_debouncedRegenerateProductRows", g(() => {
|
|
22
23
|
this._regenerateProductRows();
|
|
23
24
|
}, 500));
|
|
24
25
|
}
|
|
25
26
|
getId() {
|
|
26
|
-
return
|
|
27
|
+
return l;
|
|
27
28
|
}
|
|
28
29
|
getTemplate() {
|
|
29
30
|
return `
|
|
@@ -32,68 +33,66 @@ class D extends c {
|
|
|
32
33
|
this._GuLabel({ text: "Number of Products" }),
|
|
33
34
|
this._GuCounter({ name: e.PRODUCT_COUNT, maxValue: _ }),
|
|
34
35
|
this._GuLabel({ text: "Products in One Row", name: e.PRODUCT_IN_ROW_LABEL }),
|
|
35
|
-
this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue:
|
|
36
|
+
this._GuCounter({ name: e.PRODUCT_IN_ROW, maxValue: h })
|
|
36
37
|
])}
|
|
37
38
|
</div>
|
|
38
39
|
`;
|
|
39
40
|
}
|
|
40
41
|
onRender() {
|
|
41
|
-
this.
|
|
42
|
+
this._setFormValues(), this._updateProductsInRowVisibility(), this._listenToFormUpdates(), this._listenStateUpdates();
|
|
42
43
|
}
|
|
43
44
|
onTemplateNodeUpdated(t) {
|
|
44
|
-
super.onTemplateNodeUpdated(t), this._updateProductsInRowVisibility();
|
|
45
|
+
super.onTemplateNodeUpdated(t), this._setFormValues(), this._updateProductsInRowVisibility();
|
|
45
46
|
}
|
|
46
47
|
onDestroy() {
|
|
47
48
|
this.storeUnsubscription();
|
|
48
49
|
}
|
|
49
50
|
_setFormValues() {
|
|
50
|
-
const
|
|
51
|
+
const t = r.getConfig(this.currentNode);
|
|
51
52
|
this.api.updateValues({
|
|
52
53
|
[e.PRODUCT_COUNT]: t.size,
|
|
53
54
|
[e.PRODUCT_IN_ROW]: t.cardsInRow
|
|
54
55
|
});
|
|
55
56
|
}
|
|
56
|
-
_initializeCounterValues() {
|
|
57
|
-
const { recommendationConfigs: t } = this.store;
|
|
58
|
-
this.api.setUIEAttribute(
|
|
59
|
-
e.PRODUCT_COUNT,
|
|
60
|
-
a.SELECTPICKER.items,
|
|
61
|
-
Number(t.size)
|
|
62
|
-
), this.api.setUIEAttribute(
|
|
63
|
-
e.PRODUCT_IN_ROW,
|
|
64
|
-
a.SELECTPICKER.items,
|
|
65
|
-
t.cardsInRow
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
57
|
/**
|
|
69
58
|
* Updates "Products in One Row" visibility based on layout orientation
|
|
70
59
|
* This control is hidden for horizontal layout (products always take full width)
|
|
71
|
-
* Reads from
|
|
60
|
+
* Reads from node config first, falls back to DOM
|
|
72
61
|
*/
|
|
73
62
|
_updateProductsInRowVisibility() {
|
|
74
|
-
const
|
|
75
|
-
this.api.setVisibility(e.PRODUCT_IN_ROW,
|
|
63
|
+
const a = (r.getConfig(this.currentNode).layout || m(this.currentNode)) === "vertical";
|
|
64
|
+
this.api.setVisibility(e.PRODUCT_IN_ROW, a), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, a);
|
|
76
65
|
}
|
|
77
66
|
_onProductCountChange(t) {
|
|
78
|
-
this.
|
|
67
|
+
this.currentNode && (r.updateConfig(
|
|
68
|
+
this.api,
|
|
69
|
+
this.currentNode,
|
|
70
|
+
{ size: t },
|
|
71
|
+
`Changed product count to ${t}`
|
|
72
|
+
), this.store.$patch({
|
|
79
73
|
recommendationConfigs: {
|
|
80
74
|
size: t
|
|
81
75
|
}
|
|
82
|
-
}), this._debouncedRegenerateProductRows();
|
|
76
|
+
}), this._debouncedRegenerateProductRows());
|
|
83
77
|
}
|
|
84
78
|
_onProductsInRowChange(t) {
|
|
85
|
-
this.
|
|
79
|
+
this.currentNode && (r.updateConfig(
|
|
80
|
+
this.api,
|
|
81
|
+
this.currentNode,
|
|
82
|
+
{ cardsInRow: t },
|
|
83
|
+
`Changed products per row to ${t}`
|
|
84
|
+
), this.store.$patch({
|
|
86
85
|
recommendationConfigs: {
|
|
87
86
|
cardsInRow: t
|
|
88
87
|
}
|
|
89
|
-
}), this._debouncedRegenerateProductRows();
|
|
88
|
+
}), this._debouncedRegenerateProductRows());
|
|
90
89
|
}
|
|
91
90
|
_regenerateProductRows() {
|
|
92
|
-
|
|
91
|
+
p({
|
|
93
92
|
currentNode: this.currentNode,
|
|
94
93
|
documentModifier: this.api.getDocumentModifier(),
|
|
95
94
|
afterRegenerate: () => {
|
|
96
|
-
|
|
95
|
+
C({
|
|
97
96
|
currentNode: this.currentNode,
|
|
98
97
|
documentModifier: this.api.getDocumentModifier()
|
|
99
98
|
});
|
|
@@ -109,16 +108,17 @@ class D extends c {
|
|
|
109
108
|
}
|
|
110
109
|
/**
|
|
111
110
|
* Subscribe to store changes to update visibility when layout changes
|
|
111
|
+
* This is still needed because layout changes come from LayoutControl
|
|
112
112
|
*/
|
|
113
113
|
_listenStateUpdates() {
|
|
114
114
|
let t = this.store.recommendationConfigs.orientation;
|
|
115
115
|
this.storeUnsubscription = this.store.$subscribe(() => {
|
|
116
|
-
const
|
|
117
|
-
|
|
116
|
+
const s = this.store.recommendationConfigs.orientation;
|
|
117
|
+
s !== t && (t = s, this._updateProductsInRowVisibility());
|
|
118
118
|
});
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
export {
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
l as PRODUCT_LAYOUT_CONTROL_ID,
|
|
123
|
+
b as ProductLayoutControl
|
|
124
124
|
};
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { UEAttr as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
var r = Object.defineProperty;
|
|
2
|
+
var u = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var n = (o, t, e) => u(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { UEAttr as f } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as l } from "../../../common-control.js";
|
|
6
|
+
import { RecommendationConfigService as i } from "../../services/configService.js";
|
|
7
|
+
import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
|
|
8
|
+
const a = "recommendation-shuffle-control", s = {
|
|
8
9
|
SHUFFLE_PRODUCTS: "shuffleProducts"
|
|
9
10
|
};
|
|
10
|
-
class C extends
|
|
11
|
+
class C extends l {
|
|
11
12
|
constructor() {
|
|
12
13
|
super(...arguments);
|
|
13
|
-
|
|
14
|
+
// Store is used for backward compatibility with product fetching
|
|
15
|
+
n(this, "store", d());
|
|
14
16
|
}
|
|
15
17
|
getId() {
|
|
16
|
-
return
|
|
18
|
+
return a;
|
|
17
19
|
}
|
|
18
20
|
getTemplate() {
|
|
19
21
|
return `
|
|
@@ -28,25 +30,34 @@ class C extends u {
|
|
|
28
30
|
onRender() {
|
|
29
31
|
this._initializeToggle(), this._setFormValues(), this._listenToFormUpdates();
|
|
30
32
|
}
|
|
33
|
+
onTemplateNodeUpdated(e) {
|
|
34
|
+
super.onTemplateNodeUpdated(e), this._setFormValues();
|
|
35
|
+
}
|
|
31
36
|
_setFormValues() {
|
|
32
|
-
const
|
|
37
|
+
const e = i.getConfig(this.currentNode);
|
|
33
38
|
this.api.updateValues({
|
|
34
39
|
[s.SHUFFLE_PRODUCTS]: e.shuffleProducts
|
|
35
40
|
});
|
|
36
41
|
}
|
|
37
42
|
_initializeToggle() {
|
|
43
|
+
const e = i.getConfig(this.currentNode);
|
|
38
44
|
this.api.setUIEAttribute(
|
|
39
45
|
s.SHUFFLE_PRODUCTS,
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
f.SELECTPICKER.items,
|
|
47
|
+
e.shuffleProducts
|
|
42
48
|
);
|
|
43
49
|
}
|
|
44
50
|
_onShuffleChange(e) {
|
|
45
|
-
this.
|
|
51
|
+
this.currentNode && (i.updateConfig(
|
|
52
|
+
this.api,
|
|
53
|
+
this.currentNode,
|
|
54
|
+
{ shuffleProducts: e },
|
|
55
|
+
`${e ? "Enabled" : "Disabled"} product shuffle`
|
|
56
|
+
), this.store.$patch({
|
|
46
57
|
recommendationConfigs: {
|
|
47
58
|
shuffleProducts: e
|
|
48
59
|
}
|
|
49
|
-
});
|
|
60
|
+
}));
|
|
50
61
|
}
|
|
51
62
|
_listenToFormUpdates() {
|
|
52
63
|
this.api.onValueChanged(s.SHUFFLE_PRODUCTS, (e) => {
|
|
@@ -55,6 +66,6 @@ class C extends u {
|
|
|
55
66
|
}
|
|
56
67
|
}
|
|
57
68
|
export {
|
|
58
|
-
|
|
69
|
+
a as SHUFFLE_CONTROL_ID,
|
|
59
70
|
C as ShuffleControl
|
|
60
71
|
};
|
|
@@ -1,112 +1,124 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CONTAINER_SELECTOR as
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
4
|
-
import { prepareProductRows as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CURRENCY_ATTR as s, CONTAINER_SELECTOR as S } from "../../constants/selectors.js";
|
|
3
|
+
import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
|
|
4
|
+
import { prepareProductRows as b } from "../../templates/index.js";
|
|
5
|
+
import { hasGetStyle as f, isTdNode as E } from "../../utils/tagName.js";
|
|
6
|
+
import { DEFAULT_CARD_COMPOSITION as m, getDefaultProducts as h } from "../../templates/utils.js";
|
|
7
|
+
const g = "ins-recommendation-v3-block-v2";
|
|
8
|
+
function d(e) {
|
|
8
9
|
if (!e)
|
|
9
10
|
return null;
|
|
10
11
|
if ("getAttribute" in e) {
|
|
11
12
|
const t = e.getAttribute("class");
|
|
12
|
-
if (t && t.includes(
|
|
13
|
+
if (t && t.includes(g))
|
|
13
14
|
return e;
|
|
14
15
|
}
|
|
15
|
-
return "querySelector" in e ? e.querySelector(`.${
|
|
16
|
+
return "querySelector" in e ? e.querySelector(`.${g}`) : null;
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
const t =
|
|
18
|
+
function y(e) {
|
|
19
|
+
const t = d(e);
|
|
19
20
|
return !t || !("getAttribute" in t) ? "vertical" : t.getAttribute("data-layout") === "horizontal" ? "horizontal" : "vertical";
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
const t =
|
|
22
|
+
function R(e) {
|
|
23
|
+
const t = d(e);
|
|
23
24
|
if (!t || !("getAttribute" in t))
|
|
24
|
-
return
|
|
25
|
-
const
|
|
26
|
-
return
|
|
25
|
+
return m;
|
|
26
|
+
const o = t.getAttribute("data-card-composition");
|
|
27
|
+
return o ? o.split(",").filter(Boolean) : m;
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
-
const { currentNode: t, documentModifier:
|
|
29
|
+
function P(e) {
|
|
30
|
+
const { currentNode: t, documentModifier: o, afterRegenerate: r } = e;
|
|
30
31
|
if (!t || !("querySelector" in t))
|
|
31
32
|
return;
|
|
32
|
-
const a = t.querySelector(
|
|
33
|
+
const a = t.querySelector(S);
|
|
33
34
|
if (!a)
|
|
34
35
|
return;
|
|
35
|
-
const c =
|
|
36
|
+
const c = C(), n = c.recommendationProducts.length > 0 ? c.recommendationProducts : h(), { cardsInRow: l } = c.recommendationConfigs, i = R(t), u = y(t), A = b(n, u, {
|
|
36
37
|
productsPerRow: l,
|
|
37
|
-
composition:
|
|
38
|
+
composition: i
|
|
38
39
|
});
|
|
39
|
-
|
|
40
|
+
o.modifyHtml(a).setInnerHtml(A).apply(new p("Updated product")), r == null || r();
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
const c = `0 ${Math.floor(
|
|
43
|
-
let
|
|
44
|
-
return
|
|
42
|
+
function w(e, t, o, r) {
|
|
43
|
+
const c = `0 ${Math.floor(o / 2)}px`;
|
|
44
|
+
let n = !1;
|
|
45
|
+
return r === "vertical" ? Array.from(
|
|
45
46
|
e.querySelectorAll(".attribute-cell")
|
|
46
|
-
).forEach((
|
|
47
|
-
t.modifyHtml(
|
|
47
|
+
).forEach((i) => {
|
|
48
|
+
t.modifyHtml(i).setStyle("padding", c), n = !0;
|
|
48
49
|
}) : Array.from(
|
|
49
50
|
e.querySelectorAll(".product-card-wrapper")
|
|
50
|
-
).forEach((
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
).forEach((i) => {
|
|
52
|
+
const u = "parentNode" in i ? i.parentNode : null;
|
|
53
|
+
u && E(u) && (t.modifyHtml(u).setStyle("padding", c), n = !0);
|
|
54
|
+
}), n;
|
|
53
55
|
}
|
|
54
|
-
function
|
|
55
|
-
const
|
|
56
|
+
function M(e, t, o) {
|
|
57
|
+
const r = `${o}px`, a = Array.from(e.querySelectorAll(".spacer"));
|
|
56
58
|
let c = !1;
|
|
57
|
-
return a.forEach((
|
|
58
|
-
t.modifyHtml(
|
|
59
|
+
return a.forEach((n) => {
|
|
60
|
+
t.modifyHtml(n).setStyle("height", r), c = !0;
|
|
59
61
|
}), c;
|
|
60
62
|
}
|
|
61
|
-
function
|
|
62
|
-
const { currentNode: t, documentModifier:
|
|
63
|
+
function H(e) {
|
|
64
|
+
const { currentNode: t, documentModifier: o } = e;
|
|
63
65
|
if (!t)
|
|
64
66
|
return;
|
|
65
|
-
const
|
|
66
|
-
if (!
|
|
67
|
+
const r = d(t);
|
|
68
|
+
if (!r || !("getAttribute" in r))
|
|
67
69
|
return;
|
|
68
|
-
const a =
|
|
70
|
+
const a = r.getAttribute("data-column-spacing"), c = r.getAttribute("data-row-spacing"), n = y(t);
|
|
69
71
|
let l = !1;
|
|
70
72
|
if (a) {
|
|
71
|
-
const
|
|
72
|
-
Number.isNaN(
|
|
73
|
+
const i = parseInt(a);
|
|
74
|
+
Number.isNaN(i) || (l = w(
|
|
73
75
|
t,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
o,
|
|
77
|
+
i,
|
|
78
|
+
n
|
|
77
79
|
));
|
|
78
80
|
}
|
|
79
81
|
if (c) {
|
|
80
|
-
const
|
|
81
|
-
if (!Number.isNaN(
|
|
82
|
-
const u =
|
|
82
|
+
const i = parseInt(c);
|
|
83
|
+
if (!Number.isNaN(i)) {
|
|
84
|
+
const u = M(t, o, i);
|
|
83
85
|
l = l || u;
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
|
-
l &&
|
|
88
|
+
l && o.apply(new p("Reapply spacing after regeneration"));
|
|
87
89
|
}
|
|
88
|
-
function
|
|
90
|
+
function L(e) {
|
|
89
91
|
if (!e)
|
|
90
92
|
return null;
|
|
91
|
-
const t = e.querySelector(".product-card-segment"),
|
|
92
|
-
let
|
|
93
|
-
return t &&
|
|
93
|
+
const t = e.querySelector(".product-card-segment"), o = e.querySelector(".product-card-wrapper");
|
|
94
|
+
let r = null;
|
|
95
|
+
return t && f(t) && (r = t.getStyle("background-color") ?? null), (!r || r === "transparent") && o && f(o) && (r = o.getStyle("background-color") ?? null), r;
|
|
96
|
+
}
|
|
97
|
+
function _(e) {
|
|
98
|
+
const { currentNode: t, documentModifier: o, bgColor: r, layout: a } = e;
|
|
99
|
+
if (!r || r === "transparent" || !t)
|
|
100
|
+
return;
|
|
101
|
+
const c = a === "vertical" ? ".product-card-segment" : ".product-card-wrapper", n = Array.from(t.querySelectorAll(c));
|
|
102
|
+
n.length !== 0 && (n.forEach((l) => {
|
|
103
|
+
o.modifyHtml(l).setStyle("background-color", r);
|
|
104
|
+
}), o.apply(new p("Apply card background color")));
|
|
94
105
|
}
|
|
95
|
-
function
|
|
96
|
-
const { currentNode: t, documentModifier:
|
|
97
|
-
if (!
|
|
106
|
+
function D(e) {
|
|
107
|
+
const { currentNode: t, documentModifier: o, currency: r } = e, a = d(t);
|
|
108
|
+
if (!a)
|
|
98
109
|
return;
|
|
99
|
-
const c =
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
110
|
+
const c = r.alignment === "before" ? "0" : "1", n = (l, i) => {
|
|
111
|
+
o.modifyHtml(a).setAttribute(l, i);
|
|
112
|
+
};
|
|
113
|
+
n(s.CURRENCY, r.code), n(s.SYMBOL, r.symbol), n(s.ALIGNMENT, c), n(s.THOUSAND_SEPARATOR, r.thousandSeparator), n(s.DECIMAL_SEPARATOR, r.decimalSeparator), n(s.DECIMAL_COUNT, r.decimalCount.toString()), o.apply(new p("Update currency attributes"));
|
|
103
114
|
}
|
|
104
115
|
export {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
116
|
+
_ as applyCardBackgroundColor,
|
|
117
|
+
d as getBlockElement,
|
|
118
|
+
R as getCardComposition,
|
|
119
|
+
L as getCurrentCardBackgroundColor,
|
|
120
|
+
y as getCurrentLayout,
|
|
121
|
+
H as reapplySpacing,
|
|
122
|
+
P as regenerateProductRows,
|
|
123
|
+
D as setCurrencyAttributes
|
|
112
124
|
};
|
|
@@ -5,7 +5,7 @@ import { RecommendationControlId as d } from "../../constants/controlIds.js";
|
|
|
5
5
|
import { CONTAINER_SELECTOR as T } from "../../constants/selectors.js";
|
|
6
6
|
import { preserveTextStyles as f } from "../../utils/preserveTextStyles.js";
|
|
7
7
|
const i = "data-text-before", u = "", p = ".omnibus-text-before";
|
|
8
|
-
class
|
|
8
|
+
class g extends l {
|
|
9
9
|
getId() {
|
|
10
10
|
return d.OMNIBUS_DISCOUNT_TEXT_BEFORE;
|
|
11
11
|
}
|
|
@@ -64,10 +64,10 @@ class B extends l {
|
|
|
64
64
|
}
|
|
65
65
|
_listenToFormUpdates() {
|
|
66
66
|
this.api.onValueChanged("omnibusDiscountTextBefore", (e) => {
|
|
67
|
-
this._onTextChange(e);
|
|
67
|
+
typeof e == "string" && this._onTextChange(e);
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
export {
|
|
72
|
-
|
|
72
|
+
g as OmnibusDiscountTextBeforeControl
|
|
73
73
|
};
|