@useinsider/guido 3.0.0-beta.7a5aecd → 3.0.0-beta.7d3a300
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/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +1 -1
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +2 -2
- package/dist/config/compiler/unsubscribeCompilerRules.js +14 -14
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +29 -18
- package/dist/config/i18n/en/tooltips.json.js +2 -1
- package/dist/extensions/Blocks/Recommendation/block.js +4 -1
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -12
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +693 -144
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +78 -0
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +27 -24
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +96 -88
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +83 -81
- package/dist/extensions/Blocks/Recommendation/extension.js +18 -16
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +126 -2
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +124 -106
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +8 -7
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +63 -34
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -33
- package/dist/extensions/Blocks/Recommendation/templates/index.js +8 -8
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +28 -13
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +25 -44
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +62 -38
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +324 -218
- package/dist/package.json.js +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +8 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +134 -44
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +105 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +10 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +37 -2
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
- package/dist/static/styles/components/button.css.js +13 -7
- package/dist/static/styles/components/narrow-panel.css.js +52 -0
- package/dist/static/styles/variables.css.js +3 -0
- package/package.json +3 -3
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { TextPaddingsBuiltInControl as d, ButtonBackgroundColorBuiltInControl as c, TextFontFamilyBuiltInControl as u, TextStyleBuiltInControl as i, TextSizeBuiltInControl as C, TextColorBuiltInControl as g, TextAlignBuiltInControl as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { RecommendationBlockId as l } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as e } from "../../constants/controlIds.js";
|
|
4
|
+
import { BLOCK_ROOT_SELECTOR as I, ATTR_PRODUCT_ATTR as s } from "../../constants/selectors.js";
|
|
5
|
+
function o(t) {
|
|
6
|
+
const n = t.closest(I);
|
|
7
|
+
if (!n)
|
|
8
|
+
return [];
|
|
9
|
+
const r = t.asElement().getAttribute(s);
|
|
10
|
+
if (r) {
|
|
11
|
+
const T = `[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"][${s}="${r}"]`;
|
|
12
|
+
return n.querySelectorAll(T);
|
|
13
|
+
}
|
|
14
|
+
return n.querySelectorAll(
|
|
15
|
+
`[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"]`
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
const A = class extends a {
|
|
19
|
+
getId() {
|
|
20
|
+
return e.CUSTOM_ATTR_ALIGN;
|
|
21
|
+
}
|
|
22
|
+
getTargetNodes(t) {
|
|
23
|
+
return o(t);
|
|
24
|
+
}
|
|
25
|
+
}, _ = class extends g {
|
|
26
|
+
getId() {
|
|
27
|
+
return e.CUSTOM_ATTR_COLOR;
|
|
28
|
+
}
|
|
29
|
+
getTargetNodes(t) {
|
|
30
|
+
return o(t);
|
|
31
|
+
}
|
|
32
|
+
}, S = class extends C {
|
|
33
|
+
getId() {
|
|
34
|
+
return e.CUSTOM_ATTR_SIZE;
|
|
35
|
+
}
|
|
36
|
+
getTargetNodes(t) {
|
|
37
|
+
return o(t);
|
|
38
|
+
}
|
|
39
|
+
}, m = class extends i {
|
|
40
|
+
getId() {
|
|
41
|
+
return e.CUSTOM_ATTR_STYLE;
|
|
42
|
+
}
|
|
43
|
+
getTargetNodes(t) {
|
|
44
|
+
return o(t);
|
|
45
|
+
}
|
|
46
|
+
}, O = class extends u {
|
|
47
|
+
getId() {
|
|
48
|
+
return e.CUSTOM_ATTR_FONT_FAMILY;
|
|
49
|
+
}
|
|
50
|
+
getTargetNodes(t) {
|
|
51
|
+
return o(t);
|
|
52
|
+
}
|
|
53
|
+
}, R = class extends c {
|
|
54
|
+
getId() {
|
|
55
|
+
return e.CUSTOM_ATTR_BACKGROUND;
|
|
56
|
+
}
|
|
57
|
+
getTargetNodes(t) {
|
|
58
|
+
return o(t);
|
|
59
|
+
}
|
|
60
|
+
}, x = class extends d {
|
|
61
|
+
getId() {
|
|
62
|
+
return e.CUSTOM_ATTR_PADDINGS;
|
|
63
|
+
}
|
|
64
|
+
getTargetNodes(t) {
|
|
65
|
+
return o(t);
|
|
66
|
+
}
|
|
67
|
+
}, k = {
|
|
68
|
+
align: A,
|
|
69
|
+
color: _,
|
|
70
|
+
size: S,
|
|
71
|
+
style: m,
|
|
72
|
+
fontFamily: O,
|
|
73
|
+
background: R,
|
|
74
|
+
paddings: x
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
k as CustomAttributeControls
|
|
78
|
+
};
|
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var r = (
|
|
4
|
-
import { ModificationDescription as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import {
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var p = (e, o, t) => o in e ? A(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
|
|
3
|
+
var r = (e, o, t) => p(e, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { ModificationDescription as L } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as O } from "../../../common-control.js";
|
|
6
|
+
import { ATTR_DATA_CUSTOM_ATTRIBUTES as T } from "../../constants/selectors.js";
|
|
7
|
+
import { LAYOUT_OPTIONS as h, DEFAULT_MOBILE_ROW_SPACING as m, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as l, DEFAULT_COLUMN_SPACING as C } from "../../constants/layout.js";
|
|
8
|
+
import { DEFAULT_COMPOSITION as g } from "../../constants/defaultConfig.js";
|
|
7
9
|
import { RecommendationConfigService as s } from "../../services/configService.js";
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
import { getCurrentLayout as
|
|
10
|
-
const
|
|
10
|
+
import { useRecommendationExtensionStore as N } from "../../store/recommendation.js";
|
|
11
|
+
import { getCurrentLayout as _, getBlockElement as f, regenerateProductRowsWithStyles as S } from "../main/utils.js";
|
|
12
|
+
const I = "recommendation-layout-control", a = {
|
|
11
13
|
LAYOUT: "layout"
|
|
12
|
-
}, n = {
|
|
14
|
+
}, U = "data-card-composition", n = {
|
|
13
15
|
LAYOUT: "data-layout",
|
|
14
16
|
COLUMN_SPACING: "data-column-spacing",
|
|
15
17
|
ROW_SPACING: "data-row-spacing",
|
|
16
18
|
MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
|
|
17
19
|
MOBILE_ROW_SPACING: "data-mobile-row-spacing"
|
|
18
20
|
};
|
|
19
|
-
class
|
|
21
|
+
class w extends O {
|
|
20
22
|
constructor() {
|
|
21
23
|
super(...arguments);
|
|
22
|
-
r(this, "store",
|
|
24
|
+
r(this, "store", N());
|
|
23
25
|
r(this, "isChangingLayout", !1);
|
|
24
26
|
}
|
|
25
27
|
getId() {
|
|
26
|
-
return
|
|
28
|
+
return I;
|
|
27
29
|
}
|
|
28
30
|
getTemplate() {
|
|
29
31
|
return `
|
|
@@ -32,7 +34,7 @@ class G extends h {
|
|
|
32
34
|
this._GuLabel({ text: "Layout Orientation" }),
|
|
33
35
|
this._GuRadioButton({
|
|
34
36
|
name: a.LAYOUT,
|
|
35
|
-
buttons:
|
|
37
|
+
buttons: h
|
|
36
38
|
})
|
|
37
39
|
])}
|
|
38
40
|
</div>
|
|
@@ -45,7 +47,7 @@ class G extends h {
|
|
|
45
47
|
super.onTemplateNodeUpdated(t), this._setFormValues();
|
|
46
48
|
}
|
|
47
49
|
_setFormValues() {
|
|
48
|
-
const u = s.getConfig(this.currentNode).layout ||
|
|
50
|
+
const u = s.getConfig(this.currentNode).layout || _(this.currentNode);
|
|
49
51
|
this.api.updateValues({
|
|
50
52
|
[a.LAYOUT]: u
|
|
51
53
|
});
|
|
@@ -55,9 +57,9 @@ class G extends h {
|
|
|
55
57
|
* Updates node config, data attribute and regenerates product rows
|
|
56
58
|
*/
|
|
57
59
|
_onLayoutChange(t) {
|
|
58
|
-
if (this.isChangingLayout || !this.currentNode || (s.getConfig(this.currentNode).layout ||
|
|
60
|
+
if (this.isChangingLayout || !this.currentNode || (s.getConfig(this.currentNode).layout || _(this.currentNode)) === t)
|
|
59
61
|
return;
|
|
60
|
-
const c =
|
|
62
|
+
const c = f(this.currentNode);
|
|
61
63
|
if (c) {
|
|
62
64
|
this.isChangingLayout = !0;
|
|
63
65
|
try {
|
|
@@ -66,15 +68,15 @@ class G extends h {
|
|
|
66
68
|
this.currentNode,
|
|
67
69
|
{
|
|
68
70
|
layout: t,
|
|
69
|
-
columnSpacing:
|
|
71
|
+
columnSpacing: C,
|
|
70
72
|
rowSpacing: l,
|
|
71
73
|
mobileColumnSpacing: d,
|
|
72
74
|
mobileRowSpacing: m
|
|
73
75
|
},
|
|
74
76
|
`Changed layout to ${t}`
|
|
75
77
|
), this.store.patchCurrentBlockConfig({ orientation: t });
|
|
76
|
-
const i = this.api.getDocumentModifier().modifyHtml(c).setAttribute(n.LAYOUT, t).setAttribute(n.COLUMN_SPACING,
|
|
77
|
-
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
|
|
78
|
+
const i = this.api.getDocumentModifier().modifyHtml(c).setAttribute(n.LAYOUT, t).setAttribute(n.COLUMN_SPACING, C.toString()).setAttribute(n.ROW_SPACING, l.toString()).setAttribute(n.MOBILE_COLUMN_SPACING, d.toString()).setAttribute(n.MOBILE_ROW_SPACING, m.toString());
|
|
79
|
+
t === "list" ? (i.setClass("es-m-p0"), i.setClass("ins-recommendation-list-layout")) : (i.removeClass("es-m-p0"), i.removeClass("ins-recommendation-list-layout")), i.setAttribute(U, g.join(",")).setAttribute(T, "[]"), i.apply(new L(`Update layout to ${t}`)), this._regenerateProductRows(t);
|
|
78
80
|
} finally {
|
|
79
81
|
this.isChangingLayout = !1;
|
|
80
82
|
}
|
|
@@ -86,10 +88,11 @@ class G extends h {
|
|
|
86
88
|
* @param layout - The layout to use for regeneration (passed explicitly to avoid stale DOM reads)
|
|
87
89
|
*/
|
|
88
90
|
_regenerateProductRows(t) {
|
|
89
|
-
this.currentNode &&
|
|
91
|
+
this.currentNode && S({
|
|
90
92
|
currentNode: this.currentNode,
|
|
91
93
|
documentModifier: this.api.getDocumentModifier(),
|
|
92
|
-
layout: t
|
|
94
|
+
layout: t,
|
|
95
|
+
composition: g
|
|
93
96
|
});
|
|
94
97
|
}
|
|
95
98
|
_listenToFormUpdates() {
|
|
@@ -99,6 +102,6 @@ class G extends h {
|
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
export {
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
I as LAYOUT_CONTROL_ID,
|
|
106
|
+
w as LayoutControl
|
|
104
107
|
};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RecommendationBlockId as m } from "../../constants/blockIds.js";
|
|
3
|
-
import { MOBILE_CONTAINER_SELECTOR as g, CURRENCY_ATTR as y, DESKTOP_CONTAINER_SELECTOR as
|
|
4
|
-
import { RecommendationConfigService as
|
|
3
|
+
import { MOBILE_CONTAINER_SELECTOR as g, CURRENCY_ATTR as y, DESKTOP_CONTAINER_SELECTOR as A, CONTAINER_SELECTOR as $, MOBILE_ROW_SELECTOR as N } from "../../constants/selectors.js";
|
|
4
|
+
import { RecommendationConfigService as k } from "../../services/configService.js";
|
|
5
5
|
import { useRecommendationExtensionStore as E } from "../../store/recommendation.js";
|
|
6
|
-
import { prepareProductRows as
|
|
6
|
+
import { prepareProductRows as T } from "../../templates/index.js";
|
|
7
7
|
import { formatPrice as B } from "../../utils/priceFormatter.js";
|
|
8
8
|
import { isTdNode as v } from "../../utils/tagName.js";
|
|
9
|
-
import { getDefaultProducts as
|
|
10
|
-
const
|
|
11
|
-
function
|
|
9
|
+
import { getDefaultProducts as _, DEFAULT_CARD_COMPOSITION as M, sanitizeImageUrl as j } from "../../templates/utils.js";
|
|
10
|
+
const h = "recommendation-block-v2";
|
|
11
|
+
function P(t) {
|
|
12
12
|
if (!t)
|
|
13
13
|
return null;
|
|
14
14
|
if ("getAttribute" in t) {
|
|
15
15
|
const e = t.getAttribute("class");
|
|
16
|
-
if (e && e.includes(
|
|
16
|
+
if (e && e.includes(h))
|
|
17
17
|
return t;
|
|
18
18
|
}
|
|
19
|
-
return "querySelector" in t ? t.querySelector(`.${
|
|
19
|
+
return "querySelector" in t ? t.querySelector(`.${h}`) ?? null : null;
|
|
20
20
|
}
|
|
21
21
|
function b(t) {
|
|
22
|
-
const e =
|
|
22
|
+
const e = P(t);
|
|
23
23
|
if (!e || !("getAttribute" in e))
|
|
24
24
|
return "grid";
|
|
25
25
|
const o = e.getAttribute("data-layout");
|
|
26
26
|
return o === "list" || o === "horizontal" ? "list" : "grid";
|
|
27
27
|
}
|
|
28
|
-
function
|
|
29
|
-
const e =
|
|
28
|
+
function x(t) {
|
|
29
|
+
const e = P(t);
|
|
30
30
|
if (!e || !("getAttribute" in e))
|
|
31
|
-
return
|
|
31
|
+
return M;
|
|
32
32
|
const o = e.getAttribute("data-card-composition");
|
|
33
|
-
return o ? o.split(",").filter(Boolean) :
|
|
33
|
+
return o ? o.split(",").filter(Boolean) : M;
|
|
34
34
|
}
|
|
35
35
|
function S(t, e, o) {
|
|
36
36
|
if (!e || !("childNodes" in e))
|
|
@@ -40,41 +40,47 @@ function S(t, e, o) {
|
|
|
40
40
|
);
|
|
41
41
|
return r ? (t.modifyHtml(r).setText(o), !0) : !1;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return t && t.length > 0 ? t : e.length > 0 ? e :
|
|
43
|
+
function D(t, e) {
|
|
44
|
+
return t && t.length > 0 ? t : e.length > 0 ? e : _();
|
|
45
45
|
}
|
|
46
46
|
function V(t) {
|
|
47
47
|
const { currentNode: e, documentModifier: o } = t;
|
|
48
48
|
if (!e || !("querySelector" in e))
|
|
49
49
|
return;
|
|
50
|
-
const n = e.querySelector(
|
|
50
|
+
const n = e.querySelector(N), r = e.querySelector(g);
|
|
51
51
|
n && o.modifyHtml(n).setStyle("display", "none"), r && o.modifyHtml(r).setInnerHtml(""), (n || r) && o.apply(new p("Hide mobile row for list layout"));
|
|
52
52
|
}
|
|
53
53
|
function W(t) {
|
|
54
54
|
const { currentNode: e, documentModifier: o } = t;
|
|
55
55
|
if (!e || !("querySelector" in e))
|
|
56
56
|
return;
|
|
57
|
-
const n = e.querySelector(
|
|
57
|
+
const n = e.querySelector(N);
|
|
58
58
|
n && o.modifyHtml(n).removeStyle("display").apply(new p("Show mobile row for grid layout"));
|
|
59
59
|
}
|
|
60
60
|
function G(t) {
|
|
61
|
-
const {
|
|
61
|
+
const {
|
|
62
|
+
currentNode: e,
|
|
63
|
+
documentModifier: o,
|
|
64
|
+
products: n,
|
|
65
|
+
layout: r,
|
|
66
|
+
composition: c
|
|
67
|
+
} = t;
|
|
62
68
|
if (!e || !("querySelector" in e))
|
|
63
69
|
return;
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
70
|
+
const i = r ?? b(e);
|
|
71
|
+
if (i === "list") {
|
|
66
72
|
V({ currentNode: e, documentModifier: o });
|
|
67
73
|
return;
|
|
68
74
|
}
|
|
69
75
|
W({ currentNode: e, documentModifier: o });
|
|
70
|
-
const
|
|
71
|
-
if (!
|
|
76
|
+
const s = e.querySelector(g);
|
|
77
|
+
if (!s)
|
|
72
78
|
return;
|
|
73
|
-
const
|
|
74
|
-
productsPerRow:
|
|
75
|
-
composition:
|
|
79
|
+
const u = E(), l = k.getConfig(e), f = D(n, u.recommendationProducts), d = c ?? x(e), a = T(f, i, {
|
|
80
|
+
productsPerRow: l.mobileCardsInRow,
|
|
81
|
+
composition: d
|
|
76
82
|
});
|
|
77
|
-
o.modifyHtml(
|
|
83
|
+
o.modifyHtml(s).setInnerHtml(a).apply(new p("Updated mobile product rows"));
|
|
78
84
|
}
|
|
79
85
|
function Y(t) {
|
|
80
86
|
const {
|
|
@@ -82,20 +88,21 @@ function Y(t) {
|
|
|
82
88
|
documentModifier: o,
|
|
83
89
|
afterRegenerate: n,
|
|
84
90
|
products: r,
|
|
85
|
-
layout: c
|
|
91
|
+
layout: c,
|
|
92
|
+
composition: i
|
|
86
93
|
} = t;
|
|
87
94
|
if (!e || !("querySelector" in e))
|
|
88
95
|
return;
|
|
89
|
-
const
|
|
90
|
-
if (!
|
|
96
|
+
const s = e.querySelector(A) ?? e.querySelector($);
|
|
97
|
+
if (!s)
|
|
91
98
|
return;
|
|
92
|
-
const
|
|
93
|
-
productsPerRow:
|
|
94
|
-
composition:
|
|
99
|
+
const u = E(), l = D(r, u.recommendationProducts), { cardsInRow: f } = u.recommendationConfigs, d = i ?? x(e), a = c ?? b(e), C = T(l, a, {
|
|
100
|
+
productsPerRow: f,
|
|
101
|
+
composition: d
|
|
95
102
|
});
|
|
96
|
-
o.modifyHtml(
|
|
103
|
+
o.modifyHtml(s).setInnerHtml(C).apply(new p("Updated product")), G(t), n == null || n();
|
|
97
104
|
}
|
|
98
|
-
function
|
|
105
|
+
function R(t, e, o, n) {
|
|
99
106
|
const c = `0 ${Math.floor(o / 2)}px`;
|
|
100
107
|
let i = !1;
|
|
101
108
|
return n === "grid" ? Array.from(
|
|
@@ -109,7 +116,7 @@ function h(t, e, o, n) {
|
|
|
109
116
|
l && v(l) && (e.modifyHtml(l).setStyle("padding", c), i = !0);
|
|
110
117
|
}), i;
|
|
111
118
|
}
|
|
112
|
-
function
|
|
119
|
+
function I(t, e, o) {
|
|
113
120
|
const n = `${o}px`, r = Array.from(t.querySelectorAll(".spacer"));
|
|
114
121
|
let c = !1;
|
|
115
122
|
return r.forEach((i) => {
|
|
@@ -120,17 +127,17 @@ function F(t) {
|
|
|
120
127
|
const { currentNode: e, documentModifier: o } = t;
|
|
121
128
|
if (!e)
|
|
122
129
|
return;
|
|
123
|
-
const n =
|
|
130
|
+
const n = k.getConfig(e), r = b(e);
|
|
124
131
|
let c = !1;
|
|
125
|
-
const i = e.querySelector(
|
|
132
|
+
const i = e.querySelector(A);
|
|
126
133
|
if (i) {
|
|
127
|
-
c =
|
|
134
|
+
c = R(
|
|
128
135
|
i,
|
|
129
136
|
o,
|
|
130
137
|
n.columnSpacing,
|
|
131
138
|
r
|
|
132
139
|
);
|
|
133
|
-
const l =
|
|
140
|
+
const l = I(
|
|
134
141
|
i,
|
|
135
142
|
o,
|
|
136
143
|
n.rowSpacing
|
|
@@ -139,14 +146,14 @@ function F(t) {
|
|
|
139
146
|
}
|
|
140
147
|
const s = e.querySelector(g);
|
|
141
148
|
if (s) {
|
|
142
|
-
const u =
|
|
149
|
+
const u = R(
|
|
143
150
|
s,
|
|
144
151
|
o,
|
|
145
152
|
n.mobileColumnSpacing,
|
|
146
153
|
r
|
|
147
154
|
);
|
|
148
155
|
c = c || u;
|
|
149
|
-
const l =
|
|
156
|
+
const l = I(
|
|
150
157
|
s,
|
|
151
158
|
o,
|
|
152
159
|
n.mobileRowSpacing
|
|
@@ -156,12 +163,13 @@ function F(t) {
|
|
|
156
163
|
c && o.apply(new p("Reapply spacing after regeneration"));
|
|
157
164
|
}
|
|
158
165
|
function ie(t) {
|
|
159
|
-
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: r, layout: c } = t;
|
|
166
|
+
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: r, layout: c, composition: i } = t;
|
|
160
167
|
e && Y({
|
|
161
168
|
currentNode: e,
|
|
162
169
|
documentModifier: o,
|
|
163
170
|
products: r,
|
|
164
171
|
layout: c,
|
|
172
|
+
composition: i,
|
|
165
173
|
afterRegenerate: () => {
|
|
166
174
|
setTimeout(() => {
|
|
167
175
|
F({ currentNode: e, documentModifier: o });
|
|
@@ -170,9 +178,9 @@ function ie(t) {
|
|
|
170
178
|
});
|
|
171
179
|
}
|
|
172
180
|
function ce(t, e) {
|
|
173
|
-
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...
|
|
181
|
+
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ..._(e - t.length)];
|
|
174
182
|
}
|
|
175
|
-
function
|
|
183
|
+
function H() {
|
|
176
184
|
const t = E(), { currencySettings: e } = t.recommendationConfigs, o = parseInt(e.decimalCount);
|
|
177
185
|
return {
|
|
178
186
|
code: e.value,
|
|
@@ -183,8 +191,8 @@ function D() {
|
|
|
183
191
|
thousandSeparator: e.thousandSeparator
|
|
184
192
|
};
|
|
185
193
|
}
|
|
186
|
-
function
|
|
187
|
-
const o =
|
|
194
|
+
function q(t, e = "price") {
|
|
195
|
+
const o = H(), n = t[e], r = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
188
196
|
return B({
|
|
189
197
|
price: r,
|
|
190
198
|
currency: o
|
|
@@ -192,22 +200,22 @@ function C(t, e = "price") {
|
|
|
192
200
|
}
|
|
193
201
|
function K(t) {
|
|
194
202
|
var c, i;
|
|
195
|
-
const e =
|
|
203
|
+
const e = H(), o = ((c = t.original_price) == null ? void 0 : c[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((i = t.price) == null ? void 0 : i[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = o > 0 ? Math.round((o - n) / o * 100) : 0;
|
|
196
204
|
return r > 0 ? `-${r}%` : "0%";
|
|
197
205
|
}
|
|
198
|
-
function
|
|
206
|
+
function L(t) {
|
|
199
207
|
const { documentModifier: e, product: o, priceEl: n, oldPriceEl: r, omnibusPriceEl: c, omnibusDiscountEl: i } = t;
|
|
200
208
|
let s = !1;
|
|
201
209
|
if (n && "querySelector" in n) {
|
|
202
|
-
const u = n.querySelector("strong"), l =
|
|
210
|
+
const u = n.querySelector("strong"), l = q(o, "price");
|
|
203
211
|
S(e, u, l) && (s = !0);
|
|
204
212
|
}
|
|
205
213
|
if (r && "querySelector" in r) {
|
|
206
|
-
const u = r.querySelector("strong"), l =
|
|
214
|
+
const u = r.querySelector("strong"), l = q(o, "original_price");
|
|
207
215
|
S(e, u, l) && (s = !0);
|
|
208
216
|
}
|
|
209
217
|
if (c && "querySelector" in c) {
|
|
210
|
-
const u = c.querySelector(".omnibus-price-value"), l =
|
|
218
|
+
const u = c.querySelector(".omnibus-price-value"), l = q(o, "original_price");
|
|
211
219
|
S(e, u, l) && (s = !0);
|
|
212
220
|
}
|
|
213
221
|
if (i && "querySelector" in i) {
|
|
@@ -230,16 +238,16 @@ function z(t) {
|
|
|
230
238
|
} = t;
|
|
231
239
|
let f = !1;
|
|
232
240
|
if (n && "querySelector" in n) {
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
const
|
|
236
|
-
|
|
241
|
+
const d = n.querySelector("img");
|
|
242
|
+
d && (e.modifyHtml(d).setAttribute("src", j(o.image_url)).setAttribute("alt", o.name), f = !0);
|
|
243
|
+
const a = n.querySelector("a");
|
|
244
|
+
a && (e.modifyHtml(a).setAttribute("href", o.url), f = !0);
|
|
237
245
|
}
|
|
238
246
|
if (r && "querySelector" in r) {
|
|
239
|
-
const
|
|
240
|
-
S(e,
|
|
247
|
+
const d = r.querySelector("strong");
|
|
248
|
+
S(e, d, o.name) && (f = !0);
|
|
241
249
|
}
|
|
242
|
-
if (
|
|
250
|
+
if (L({
|
|
243
251
|
documentModifier: e,
|
|
244
252
|
product: o,
|
|
245
253
|
priceEl: c,
|
|
@@ -247,15 +255,15 @@ function z(t) {
|
|
|
247
255
|
omnibusPriceEl: s,
|
|
248
256
|
omnibusDiscountEl: u
|
|
249
257
|
}) && (f = !0), l && "querySelector" in l) {
|
|
250
|
-
const
|
|
251
|
-
|
|
258
|
+
const d = l.querySelector("a.es-button") || l.querySelector("a");
|
|
259
|
+
d && (e.modifyHtml(d).setAttribute("href", o.url), f = !0);
|
|
252
260
|
}
|
|
253
261
|
return f;
|
|
254
262
|
}
|
|
255
|
-
function
|
|
256
|
-
return "querySelector" in t ? t.querySelector(
|
|
263
|
+
function U(t) {
|
|
264
|
+
return "querySelector" in t ? t.querySelector(A) ?? t : t;
|
|
257
265
|
}
|
|
258
|
-
function
|
|
266
|
+
function w(t, e, o) {
|
|
259
267
|
if (!("querySelectorAll" in t))
|
|
260
268
|
return !1;
|
|
261
269
|
const n = t.querySelectorAll(
|
|
@@ -273,37 +281,37 @@ function I(t, e, o) {
|
|
|
273
281
|
), l = t.querySelectorAll(
|
|
274
282
|
`[esd-extension-block-id="${m.BUTTON}"]`
|
|
275
283
|
), f = Math.min(n.length, o.length);
|
|
276
|
-
let
|
|
277
|
-
for (let
|
|
278
|
-
const
|
|
284
|
+
let d = !1;
|
|
285
|
+
for (let a = 0; a < f; a++) {
|
|
286
|
+
const C = z({
|
|
279
287
|
documentModifier: e,
|
|
280
|
-
product: o[
|
|
281
|
-
imageEl: n[
|
|
282
|
-
nameEl: r[
|
|
283
|
-
priceEl: c[
|
|
284
|
-
oldPriceEl: i[
|
|
285
|
-
omnibusPriceEl: s[
|
|
286
|
-
omnibusDiscountEl: u[
|
|
287
|
-
buttonEl: l[
|
|
288
|
+
product: o[a],
|
|
289
|
+
imageEl: n[a] ?? null,
|
|
290
|
+
nameEl: r[a] ?? null,
|
|
291
|
+
priceEl: c[a] ?? null,
|
|
292
|
+
oldPriceEl: i[a] ?? null,
|
|
293
|
+
omnibusPriceEl: s[a] ?? null,
|
|
294
|
+
omnibusDiscountEl: u[a] ?? null,
|
|
295
|
+
buttonEl: l[a] ?? null
|
|
288
296
|
});
|
|
289
|
-
|
|
297
|
+
d = d || C;
|
|
290
298
|
}
|
|
291
|
-
return
|
|
299
|
+
return d;
|
|
292
300
|
}
|
|
293
301
|
function le(t) {
|
|
294
302
|
const { currentNode: e, documentModifier: o, products: n } = t;
|
|
295
303
|
if (!e || !("querySelectorAll" in e))
|
|
296
304
|
return !1;
|
|
297
|
-
const r =
|
|
305
|
+
const r = U(e);
|
|
298
306
|
if (!("querySelectorAll" in r) || r.querySelectorAll(
|
|
299
307
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
300
308
|
).length !== n.length)
|
|
301
309
|
return !1;
|
|
302
|
-
let i =
|
|
310
|
+
let i = w(r, o, n);
|
|
303
311
|
if (b(e) !== "list" && "querySelector" in e) {
|
|
304
312
|
const u = e.querySelector(g);
|
|
305
313
|
if (u) {
|
|
306
|
-
const l =
|
|
314
|
+
const l = w(
|
|
307
315
|
u,
|
|
308
316
|
o,
|
|
309
317
|
n
|
|
@@ -313,7 +321,7 @@ function le(t) {
|
|
|
313
321
|
}
|
|
314
322
|
return i && o.apply(new p("Updated product content in-place")), !0;
|
|
315
323
|
}
|
|
316
|
-
function
|
|
324
|
+
function O(t, e, o) {
|
|
317
325
|
if (!("querySelectorAll" in t))
|
|
318
326
|
return !1;
|
|
319
327
|
const n = t.querySelectorAll(
|
|
@@ -327,7 +335,7 @@ function w(t, e, o) {
|
|
|
327
335
|
), s = Math.min(n.length, o.length);
|
|
328
336
|
let u = !1;
|
|
329
337
|
for (let l = 0; l < s; l++)
|
|
330
|
-
|
|
338
|
+
L({
|
|
331
339
|
documentModifier: e,
|
|
332
340
|
product: o[l],
|
|
333
341
|
priceEl: n[l] ?? null,
|
|
@@ -344,19 +352,19 @@ function ue(t) {
|
|
|
344
352
|
const r = E().recommendationProducts;
|
|
345
353
|
if (r.length === 0)
|
|
346
354
|
return !1;
|
|
347
|
-
const c =
|
|
348
|
-
let i =
|
|
355
|
+
const c = U(e);
|
|
356
|
+
let i = O(c, o, r);
|
|
349
357
|
if (b(e) !== "list" && "querySelector" in e) {
|
|
350
358
|
const u = e.querySelector(g);
|
|
351
359
|
if (u) {
|
|
352
|
-
const l =
|
|
360
|
+
const l = O(u, o, r);
|
|
353
361
|
i = i || l;
|
|
354
362
|
}
|
|
355
363
|
}
|
|
356
364
|
return i && o.apply(new p("Updated price formatting in-place")), i;
|
|
357
365
|
}
|
|
358
366
|
function se(t) {
|
|
359
|
-
const { currentNode: e, documentModifier: o, currency: n } = t, r =
|
|
367
|
+
const { currentNode: e, documentModifier: o, currency: n } = t, r = P(e);
|
|
360
368
|
if (!r)
|
|
361
369
|
return;
|
|
362
370
|
const c = n.alignment === "before" ? "0" : "1", i = (s, u) => {
|
|
@@ -366,9 +374,9 @@ function se(t) {
|
|
|
366
374
|
}
|
|
367
375
|
export {
|
|
368
376
|
ce as adjustProductsToSize,
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
377
|
+
q as formatProductPrice,
|
|
378
|
+
P as getBlockElement,
|
|
379
|
+
x as getCardComposition,
|
|
372
380
|
b as getCurrentLayout,
|
|
373
381
|
F as reapplySpacing,
|
|
374
382
|
G as regenerateMobileProductRows,
|