@useinsider/guido 3.22.0-beta.3f91a42 → 3.22.0-beta.53526b4
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/config/migrator/couponBlockAlignmentMigrator.js +55 -0
- package/dist/config/migrator/index.js +14 -13
- package/dist/extensions/Blocks/Items/controls/button/link.js +17 -14
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +17 -14
- package/dist/extensions/Blocks/Items/controls/image/link.js +17 -14
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +10 -9
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +13 -12
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +30 -29
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +16 -15
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +26 -25
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +28 -27
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +80 -75
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +7 -7
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +13 -13
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +116 -121
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +15 -15
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +12 -12
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +10 -10
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +1 -1
- package/dist/extensions/Blocks/common-control.js +55 -62
- package/dist/package.json.js +1 -1
- package/dist/src/config/migrator/couponBlockAlignmentMigrator.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -3
- package/dist/src/extensions/Blocks/common-control.d.ts +0 -2
- package/package.json +1 -1
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import { ItemsBlockControlId as
|
|
4
|
-
import { getItemsBlockConfig as
|
|
5
|
-
const
|
|
1
|
+
import { ModificationDescription as c, UIElementType as s, UEAttr as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as p } from "../../../common-control.js";
|
|
3
|
+
import { ItemsBlockControlId as r } from "../../enums/controlEnums.js";
|
|
4
|
+
import { getItemsBlockConfig as d, setItemsBlockConfig as u } from "../../utils/nodeConfigUtils.js";
|
|
5
|
+
const D = r.PRICE_HIDE_DISCOUNT, i = {
|
|
6
6
|
HIDE_DISCOUNT: "hideDiscount"
|
|
7
7
|
};
|
|
8
|
-
class
|
|
8
|
+
class E extends p {
|
|
9
9
|
getId() {
|
|
10
|
-
return
|
|
10
|
+
return D;
|
|
11
11
|
}
|
|
12
12
|
getTemplate() {
|
|
13
13
|
return `
|
|
14
|
-
<div class="container ${
|
|
14
|
+
<div class="container ${r.PRICE_HIDE_DISCOUNT}">
|
|
15
15
|
${this._getHideDiscount()}
|
|
16
16
|
</div>
|
|
17
17
|
`;
|
|
18
18
|
}
|
|
19
19
|
onRender() {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
const t = d(this.currentNode);
|
|
21
|
+
this.api.updateValues({ [i.HIDE_DISCOUNT]: (t == null ? void 0 : t.priceHideDiscount) ?? !0 }), this.api.onValueChanged(i.HIDE_DISCOUNT, (e) => {
|
|
22
|
+
this._onHideDiscountChange(e);
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
25
|
onTemplateNodeUpdated(t) {
|
|
25
26
|
super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(() => {
|
|
26
|
-
const e =
|
|
27
|
+
const e = d(this.currentNode);
|
|
27
28
|
this.api.updateValues({ [i.HIDE_DISCOUNT]: (e == null ? void 0 : e.priceHideDiscount) ?? !0 });
|
|
28
29
|
});
|
|
29
30
|
}
|
|
@@ -32,13 +33,13 @@ class g extends a {
|
|
|
32
33
|
const e = this.api.getDocumentModifier();
|
|
33
34
|
u(this.currentNode, this.api, { priceHideDiscount: t }, e);
|
|
34
35
|
const o = (n = this.currentNode) == null ? void 0 : n.closest(".ins-product-td");
|
|
35
|
-
o && e.modifyHtml(o).setAttribute("data-nodup", String(t)), e.apply(new
|
|
36
|
+
o && e.modifyHtml(o).setAttribute("data-nodup", String(t)), e.apply(new c("Update hide-discount setting")), this.api.updateValues({ [i.HIDE_DISCOUNT]: t });
|
|
36
37
|
}
|
|
37
38
|
_getHideDiscount() {
|
|
38
39
|
return `
|
|
39
40
|
<div class="display-flex align-items-center justify-content-between">
|
|
40
41
|
<${s.LABEL}
|
|
41
|
-
${
|
|
42
|
+
${a.LABEL.text}="${this.api.translate("Hide if same as discounted ")}"
|
|
42
43
|
>
|
|
43
44
|
</${s.LABEL}>
|
|
44
45
|
${this._GuToggle(i.HIDE_DISCOUNT)}
|
|
@@ -48,6 +49,6 @@ class g extends a {
|
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
D as CONTROL_BLOCK_ID,
|
|
53
|
+
E as PriceHideDiscountControl
|
|
53
54
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
1
|
+
import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { CommonControl as O } from "../../../common-control.js";
|
|
3
3
|
import { ItemsBlockControlId as m } from "../../enums/controlEnums.js";
|
|
4
|
-
import { SETTINGS_ENUMS as
|
|
5
|
-
import { getItemsBlockConfig as
|
|
6
|
-
const
|
|
4
|
+
import { SETTINGS_ENUMS as h } from "../../enums/settingsEnums.js";
|
|
5
|
+
import { getItemsBlockConfig as u, setItemsBlockConfig as I } from "../../utils/nodeConfigUtils.js";
|
|
6
|
+
const N = m.PRICE_ORIENTATION, c = {
|
|
7
7
|
PRICE_ORIENTATION: "priceOrientation"
|
|
8
|
-
},
|
|
8
|
+
}, y = [
|
|
9
9
|
{ icon: "vertical-orientation", value: "vertical" },
|
|
10
10
|
{ icon: "horizontal-orientation", value: "horizontal" }
|
|
11
11
|
];
|
|
12
12
|
class P extends O {
|
|
13
13
|
getId() {
|
|
14
|
-
return
|
|
14
|
+
return N;
|
|
15
15
|
}
|
|
16
16
|
getTemplate() {
|
|
17
17
|
return `
|
|
@@ -21,14 +21,15 @@ class P extends O {
|
|
|
21
21
|
`;
|
|
22
22
|
}
|
|
23
23
|
onRender() {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const i = u(this.currentNode);
|
|
25
|
+
this.api.updateValues({ [c.PRICE_ORIENTATION]: (i == null ? void 0 : i.priceOrientation) ?? "horizontal" }), this.api.onValueChanged(c.PRICE_ORIENTATION, (t) => {
|
|
26
|
+
typeof t == "string" && this._onPriceOrientationChange(t);
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
onTemplateNodeUpdated(i) {
|
|
29
30
|
super.onTemplateNodeUpdated(i), this.handleBlockInstanceChange(() => {
|
|
30
|
-
const t =
|
|
31
|
-
this.api.updateValues({ [
|
|
31
|
+
const t = u(this.currentNode);
|
|
32
|
+
this.api.updateValues({ [c.PRICE_ORIENTATION]: (t == null ? void 0 : t.priceOrientation) ?? "horizontal" });
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
35
|
_onPriceOrientationChange(i) {
|
|
@@ -36,46 +37,46 @@ class P extends O {
|
|
|
36
37
|
priceOrientation: i
|
|
37
38
|
}), !this.currentNode)
|
|
38
39
|
return;
|
|
39
|
-
const t =
|
|
40
|
+
const t = u(this.currentNode), e = ((t == null ? void 0 : t.orientation) ?? h.ORIENTATION.VERTICAL) === h.ORIENTATION.VERTICAL, o = i === "horizontal";
|
|
40
41
|
e ? this._updateVerticalLayout(o) : this._updateHorizontalLayout(o);
|
|
41
42
|
}
|
|
42
43
|
_updateVerticalLayout(i) {
|
|
43
|
-
var a,
|
|
44
|
-
const t = ((
|
|
44
|
+
var a, s, l, n;
|
|
45
|
+
const t = ((s = (a = this.currentNode) == null ? void 0 : a.closest(".ins-product-td")) == null ? void 0 : s.querySelectorAll(".product-price-class")) || [], r = ((n = (l = this.currentNode) == null ? void 0 : l.closest(".ins-product-td")) == null ? void 0 : n.querySelectorAll(".product-original-price-class")) || [];
|
|
45
46
|
if (!t || !r)
|
|
46
47
|
return;
|
|
47
48
|
const e = i ? "50%" : "100%", o = this.api.getDocumentModifier();
|
|
48
|
-
t.forEach((
|
|
49
|
-
o.modifyHtml(
|
|
50
|
-
}), r.forEach((
|
|
51
|
-
o.modifyHtml(
|
|
52
|
-
}), o.apply(new
|
|
49
|
+
t.forEach((d) => {
|
|
50
|
+
o.modifyHtml(d).setAttribute("width", e).setStyle("width", e);
|
|
51
|
+
}), r.forEach((d) => {
|
|
52
|
+
o.modifyHtml(d).setAttribute("width", e).setStyle("width", e);
|
|
53
|
+
}), o.apply(new p(`Updated original price element width to ${e}`));
|
|
53
54
|
}
|
|
54
55
|
_updateHorizontalLayout(i) {
|
|
55
|
-
var o, a,
|
|
56
|
-
const t = ((a = (o = this.currentNode) == null ? void 0 : o.closest(".ins-product-td")) == null ? void 0 : a.querySelectorAll(".horizontal-price")) || [], r = (
|
|
56
|
+
var o, a, s, l;
|
|
57
|
+
const t = ((a = (o = this.currentNode) == null ? void 0 : o.closest(".ins-product-td")) == null ? void 0 : a.querySelectorAll(".horizontal-price")) || [], r = (l = (s = this.currentNode) == null ? void 0 : s.closest(".ins-product-td")) == null ? void 0 : l.querySelector(".vertical-price");
|
|
57
58
|
if (!t || !r || t.length === 0)
|
|
58
59
|
return;
|
|
59
60
|
const e = this.api.getDocumentModifier();
|
|
60
61
|
i ? (t.forEach((n) => {
|
|
61
62
|
e.modifyHtml(n).setStyle("display", "table-cell");
|
|
62
|
-
}), e.modifyHtml(r).setStyle("display", "none"), e.apply(new
|
|
63
|
+
}), e.modifyHtml(r).setStyle("display", "none"), e.apply(new p("Show horizontal price orientation"))) : (t.forEach((n) => {
|
|
63
64
|
e.modifyHtml(n).setStyle("display", "none");
|
|
64
|
-
}), e.modifyHtml(r).setStyle("display", "table-cell"), e.apply(new
|
|
65
|
+
}), e.modifyHtml(r).setStyle("display", "table-cell"), e.apply(new p("Show vertical price orientation")));
|
|
65
66
|
}
|
|
66
67
|
_getPriceOrientation() {
|
|
67
68
|
return `
|
|
68
69
|
${this._GuTwoColumns([
|
|
69
70
|
this._GuLabel({ text: "Price Orientation" }),
|
|
70
71
|
this._GuRadioButton({
|
|
71
|
-
name:
|
|
72
|
-
buttons:
|
|
72
|
+
name: c.PRICE_ORIENTATION,
|
|
73
|
+
buttons: y
|
|
73
74
|
})
|
|
74
75
|
])}
|
|
75
76
|
`;
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
export {
|
|
79
|
-
|
|
80
|
+
N as CONTROL_BLOCK_ID,
|
|
80
81
|
P as PriceOrientationControl
|
|
81
82
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ModificationDescription as S, UIElementType as
|
|
1
|
+
import { ModificationDescription as S, UIElementType as d, UEAttr as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { CommonControl as A } from "../../../common-control.js";
|
|
3
|
-
import { ItemsBlockControlId as T, ItemsBlockId as
|
|
4
|
-
import { productPairs as
|
|
5
|
-
import { getItemsBlockConfig as
|
|
6
|
-
const u = T.PRICE_SINGLE_PRICE,
|
|
3
|
+
import { ItemsBlockControlId as T, ItemsBlockId as p } from "../../enums/controlEnums.js";
|
|
4
|
+
import { productPairs as R } from "../../enums/productEnums.js";
|
|
5
|
+
import { getItemsBlockConfig as I, setItemsBlockConfig as N, escapeReplacement as h } from "../../utils/nodeConfigUtils.js";
|
|
6
|
+
const u = T.PRICE_SINGLE_PRICE, l = {
|
|
7
7
|
SINGLE_PRICE: "singlePrice"
|
|
8
8
|
};
|
|
9
9
|
class k extends A {
|
|
@@ -18,52 +18,53 @@ class k extends A {
|
|
|
18
18
|
`;
|
|
19
19
|
}
|
|
20
20
|
onRender() {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const e = I(this.currentNode);
|
|
22
|
+
this.api.updateValues({ [l.SINGLE_PRICE]: (e == null ? void 0 : e.priceSinglePrice) ?? !1 }), this.api.onValueChanged(l.SINGLE_PRICE, (i) => {
|
|
23
|
+
this._onSinglePriceChange(i);
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
26
|
onTemplateNodeUpdated(e) {
|
|
26
27
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
|
|
27
|
-
const
|
|
28
|
-
this.api.updateValues({ [
|
|
28
|
+
const i = I(this.currentNode);
|
|
29
|
+
this.api.updateValues({ [l.SINGLE_PRICE]: (i == null ? void 0 : i.priceSinglePrice) ?? !1 });
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
_onSinglePriceChange(e) {
|
|
32
33
|
if (console.debug("Single price changed to: ", e), !this.currentNode)
|
|
33
34
|
return;
|
|
34
|
-
const
|
|
35
|
-
r ?
|
|
36
|
-
r ?
|
|
35
|
+
const i = I(this.currentNode), c = (i == null ? void 0 : i.type) ?? "CART_ITEMS", r = (i == null ? void 0 : i.priceFormatted) ?? !1, t = R.PAIRS_FOR_EXTENSION.price[c], n = R.PAIRS_FOR_EXTENSION.originalPrice[c], [E, g] = e ? [
|
|
36
|
+
r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE,
|
|
37
|
+
r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE
|
|
37
38
|
] : [
|
|
38
|
-
r ?
|
|
39
|
-
r ?
|
|
40
|
-
],
|
|
39
|
+
r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE,
|
|
40
|
+
r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE
|
|
41
|
+
], P = r ? n.DEFAULT_PRICE_FORMATTED : n.DEFAULT_PRICE, _ = r ? n.DEFAULT_SINGLE_PRICE_FORMATTED : n.DEFAULT_SINGLE_PRICE, [L, C] = e ? [P, _] : [_, P], s = this.api.getDocumentModifier();
|
|
41
42
|
N(this.currentNode, this.api, { priceSinglePrice: e }, s);
|
|
42
43
|
const o = this.currentNode.closest(".items-block");
|
|
43
44
|
((o == null ? void 0 : o.querySelectorAll(
|
|
44
|
-
`[esd-extension-block-id="${
|
|
45
|
-
)) || []).forEach((
|
|
46
|
-
this._updatePriceBlock(s,
|
|
45
|
+
`[esd-extension-block-id="${p.PRICE}"]`
|
|
46
|
+
)) || []).forEach((a) => {
|
|
47
|
+
this._updatePriceBlock(s, a, E, g, e);
|
|
47
48
|
}), ((o == null ? void 0 : o.querySelectorAll(
|
|
48
|
-
`[esd-extension-block-id="${
|
|
49
|
-
)) || []).forEach((
|
|
50
|
-
this._updatePriceBlock(s,
|
|
49
|
+
`[esd-extension-block-id="${p.ORIGINAL_PRICE}"]`
|
|
50
|
+
)) || []).forEach((a) => {
|
|
51
|
+
this._updatePriceBlock(s, a, L, C, e);
|
|
51
52
|
}), s.apply(new S(
|
|
52
53
|
`Updated price to ${e ? "single" : "total"} price`
|
|
53
54
|
));
|
|
54
55
|
}
|
|
55
|
-
_updatePriceBlock(e,
|
|
56
|
-
const n = `data-single_price="${
|
|
57
|
-
e.modifyHtml(
|
|
56
|
+
_updatePriceBlock(e, i, c, r, t) {
|
|
57
|
+
const n = `data-single_price="${t ? "true" : "false"}"`, E = i.getInnerHTML().trim().replace(c, h(r)).replace(/data-single_price=(?:"[^"]*"|'[^']*')/g, n);
|
|
58
|
+
e.modifyHtml(i).setInnerHtml(E);
|
|
58
59
|
}
|
|
59
60
|
_getSinglePrice() {
|
|
60
61
|
return `
|
|
61
62
|
<div class="display-flex align-items-center justify-content-between">
|
|
62
|
-
<${
|
|
63
|
+
<${d.LABEL}
|
|
63
64
|
${m.LABEL.text}="${this.api.translate("Show Single Product Price")}"
|
|
64
65
|
>
|
|
65
|
-
</${
|
|
66
|
-
${this._GuToggle(
|
|
66
|
+
</${d.LABEL}>
|
|
67
|
+
${this._GuToggle(l.SINGLE_PRICE)}
|
|
67
68
|
</div>
|
|
68
69
|
`;
|
|
69
70
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { ModificationDescription as N, UEAttr as L } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import { reorientBlockCellPadding as D, nameMaxWidthFor as
|
|
4
|
-
import { ItemsBlockId as
|
|
5
|
-
import { productPairs as
|
|
6
|
-
import { SETTINGS_ENUMS as
|
|
2
|
+
import { CommonControl as $ } from "../../common-control.js";
|
|
3
|
+
import { reorientBlockCellPadding as D, nameMaxWidthFor as f } from "../constants/cardLayout.js";
|
|
4
|
+
import { ItemsBlockId as I } from "../enums/controlEnums.js";
|
|
5
|
+
import { productPairs as y, templateFirstLine as x } from "../enums/productEnums.js";
|
|
6
|
+
import { SETTINGS_ENUMS as T, ItemTypeOptions as H, OrientationOptions as w, ItemInCartOptions as g, DefaultConfigValues as U } from "../enums/settingsEnums.js";
|
|
7
7
|
import q from "../layouts/horizontal.html.js";
|
|
8
|
-
import
|
|
9
|
-
import { getDefaultTemplate as
|
|
8
|
+
import V from "../layouts/vertical.html.js";
|
|
9
|
+
import { getDefaultTemplate as B, wrapInTableRow as C, applyPriceOrientationStyles as G } from "../template.js";
|
|
10
10
|
import { findNameTextNode as Y } from "../utils/nameNode.js";
|
|
11
|
-
import { getItemsBlockConfig as _, setItemsBlockConfig as
|
|
11
|
+
import { getItemsBlockConfig as _, setItemsBlockConfig as M, escapeReplacement as A, deriveItemNumber as v } from "../utils/nodeConfigUtils.js";
|
|
12
12
|
const Q = "ui-elements-items-block", p = {
|
|
13
13
|
ITEMS_TYPE: "itemsType",
|
|
14
14
|
ORIENTATION: "orientation",
|
|
15
15
|
ITEM_IDS: "itemIds"
|
|
16
16
|
};
|
|
17
|
-
class
|
|
17
|
+
class se extends $ {
|
|
18
18
|
getId() {
|
|
19
19
|
return Q;
|
|
20
20
|
}
|
|
@@ -28,14 +28,19 @@ class oe extends F {
|
|
|
28
28
|
`;
|
|
29
29
|
}
|
|
30
30
|
onRender() {
|
|
31
|
-
|
|
31
|
+
const e = _(this.currentNode);
|
|
32
|
+
this.api.updateValues({
|
|
33
|
+
[p.ORIENTATION]: (e == null ? void 0 : e.orientation) ?? T.ORIENTATION.VERTICAL,
|
|
34
|
+
[p.ITEMS_TYPE]: (e == null ? void 0 : e.type) ?? T.ITEMS_TYPE.CART_ITEMS,
|
|
35
|
+
[p.ITEM_IDS]: (e == null ? void 0 : e.itemsSelectValue) ?? ""
|
|
36
|
+
}), this._listenToFormUpdates();
|
|
32
37
|
}
|
|
33
38
|
onTemplateNodeUpdated(e) {
|
|
34
39
|
super.onTemplateNodeUpdated(e), console.debug("Items Block Config", e.getNodeConfig()), this.handleBlockInstanceChange(() => {
|
|
35
40
|
const r = _(this.currentNode);
|
|
36
41
|
this.api.updateValues({
|
|
37
|
-
[p.ORIENTATION]: (r == null ? void 0 : r.orientation) ??
|
|
38
|
-
[p.ITEMS_TYPE]: (r == null ? void 0 : r.type) ??
|
|
42
|
+
[p.ORIENTATION]: (r == null ? void 0 : r.orientation) ?? T.ORIENTATION.VERTICAL,
|
|
43
|
+
[p.ITEMS_TYPE]: (r == null ? void 0 : r.type) ?? T.ITEMS_TYPE.CART_ITEMS,
|
|
39
44
|
[p.ITEM_IDS]: (r == null ? void 0 : r.itemsSelectValue) ?? ""
|
|
40
45
|
}), this._initializeSelectItems();
|
|
41
46
|
});
|
|
@@ -80,7 +85,7 @@ class oe extends F {
|
|
|
80
85
|
_onOrientationChange(e) {
|
|
81
86
|
this.api.updateValues({ [p.ORIENTATION]: e });
|
|
82
87
|
const r = this.api.getDocumentModifier();
|
|
83
|
-
|
|
88
|
+
M(this.currentNode, this.api, {
|
|
84
89
|
orientation: e,
|
|
85
90
|
priceOrientation: "horizontal"
|
|
86
91
|
}, r), r.apply(new N("Changed orientation")), this._reOrderTemplate(), setTimeout(() => {
|
|
@@ -88,15 +93,15 @@ class oe extends F {
|
|
|
88
93
|
}, 50);
|
|
89
94
|
}
|
|
90
95
|
_onItemsTypeChange(e) {
|
|
91
|
-
const r =
|
|
96
|
+
const r = T.ITEMS_TYPE[e], t = g[e], i = t == null ? void 0 : t[0];
|
|
92
97
|
if (!r || !i)
|
|
93
98
|
return;
|
|
94
|
-
const n = i.value,
|
|
95
|
-
|
|
99
|
+
const n = i.value, s = i.value.replace("Url}}", "Image}}"), a = this.api.getDocumentModifier();
|
|
100
|
+
M(this.currentNode, this.api, {
|
|
96
101
|
source: r,
|
|
97
102
|
type: r,
|
|
98
103
|
itemsSelectValue: i.value,
|
|
99
|
-
imageLink:
|
|
104
|
+
imageLink: s,
|
|
100
105
|
buttonLink: n
|
|
101
106
|
}, a), this._updateDataTypeAttributes(r, a), this._initializeSelectItems();
|
|
102
107
|
const l = this._getTemplateData(r, i.value);
|
|
@@ -105,7 +110,7 @@ class oe extends F {
|
|
|
105
110
|
_onItemIdsChange(e) {
|
|
106
111
|
this.api.updateValues({ [p.ITEM_IDS]: e });
|
|
107
112
|
const r = e, t = e.replace("Url}}", "Image}}"), i = this.api.getDocumentModifier();
|
|
108
|
-
|
|
113
|
+
M(this.currentNode, this.api, {
|
|
109
114
|
itemsSelectValue: e,
|
|
110
115
|
imageLink: t,
|
|
111
116
|
buttonLink: r
|
|
@@ -119,11 +124,11 @@ class oe extends F {
|
|
|
119
124
|
L.SELECTPICKER.items,
|
|
120
125
|
H
|
|
121
126
|
);
|
|
122
|
-
const e = _(this.currentNode), r = (e == null ? void 0 : e.type) ??
|
|
127
|
+
const e = _(this.currentNode), r = (e == null ? void 0 : e.type) ?? T.ITEMS_TYPE.CART_ITEMS, t = (e == null ? void 0 : e.itemsSelectValue) ?? "";
|
|
123
128
|
this.api.updateValues({
|
|
124
129
|
[p.ITEMS_TYPE]: r
|
|
125
130
|
});
|
|
126
|
-
const i =
|
|
131
|
+
const i = g[r];
|
|
127
132
|
this.api.setUIEAttribute(
|
|
128
133
|
p.ITEM_IDS,
|
|
129
134
|
L.SELECTPICKER.items,
|
|
@@ -145,113 +150,113 @@ class oe extends F {
|
|
|
145
150
|
);
|
|
146
151
|
}
|
|
147
152
|
_renderTemplate() {
|
|
148
|
-
const e = _(this.currentNode), r = (e == null ? void 0 : e.orientation) ??
|
|
149
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(
|
|
153
|
+
const e = _(this.currentNode), r = (e == null ? void 0 : e.orientation) ?? T.ORIENTATION.VERTICAL, t = (e == null ? void 0 : e.type) ?? T.ITEMS_TYPE.CART_ITEMS, i = (e == null ? void 0 : e.itemsSelectValue) ?? "", n = (e == null ? void 0 : e.priceCurrencySymbol) ?? "", s = (e == null ? void 0 : e.priceCurrencyLocation) ?? "0", a = (e == null ? void 0 : e.priceFormatted) ?? !1;
|
|
154
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(B({
|
|
150
155
|
orientation: r,
|
|
151
156
|
itemsType: t,
|
|
152
157
|
itemId: i,
|
|
153
158
|
currencySymbol: n,
|
|
154
|
-
currencyLocation:
|
|
159
|
+
currencyLocation: s,
|
|
155
160
|
formattedPrice: a
|
|
156
161
|
})).apply(new N("Updated template"));
|
|
157
162
|
}
|
|
158
163
|
_getTemplateData(e, r) {
|
|
159
|
-
const t = _(this.currentNode), i = e ?? (t == null ? void 0 : t.type) ??
|
|
164
|
+
const t = _(this.currentNode), i = e ?? (t == null ? void 0 : t.type) ?? T.ITEMS_TYPE.CART_ITEMS, n = r ?? (t == null ? void 0 : t.itemsSelectValue) ?? "", s = (t == null ? void 0 : t.priceFormatted) ?? !1, a = (t == null ? void 0 : t.priceSinglePrice) ?? !1, l = g[i].findIndex((h) => h.value === n), c = l > -1 ? l : 0, o = y.PAIRS_FOR_EXTENSION.price[i], d = y.PAIRS_FOR_EXTENSION.originalPrice[i];
|
|
160
165
|
let m, u;
|
|
161
|
-
return a ? (m =
|
|
162
|
-
imageSrc:
|
|
163
|
-
name:
|
|
166
|
+
return a ? (m = s ? o.DEFAULT_SINGLE_PRICE_FORMATTED : o.DEFAULT_SINGLE_PRICE, u = s ? d.DEFAULT_SINGLE_PRICE_FORMATTED : d.DEFAULT_SINGLE_PRICE) : (m = s ? o.DEFAULT_PRICE_FORMATTED : o.DEFAULT_PRICE, u = s ? d.DEFAULT_PRICE_FORMATTED : d.DEFAULT_PRICE), {
|
|
167
|
+
imageSrc: y.PAIRS_FOR_EXTENSION.imageSrc[i].DEFAULT[c],
|
|
168
|
+
name: y.PAIRS_FOR_EXTENSION.name[i].DEFAULT[c],
|
|
164
169
|
price: m,
|
|
165
170
|
originalPrice: u,
|
|
166
|
-
quantity:
|
|
167
|
-
button:
|
|
171
|
+
quantity: y.PAIRS_FOR_EXTENSION.quantity[i].DEFAULT,
|
|
172
|
+
button: y.PAIRS_FOR_EXTENSION.button[i].DEFAULT_LABEL
|
|
168
173
|
};
|
|
169
174
|
}
|
|
170
175
|
_updateImageSrc(e, r) {
|
|
171
176
|
var i;
|
|
172
|
-
const t = (i = this.currentNode) == null ? void 0 : i.querySelector(`[esd-extension-block-id="${
|
|
177
|
+
const t = (i = this.currentNode) == null ? void 0 : i.querySelector(`[esd-extension-block-id="${I.IMAGE}"] img`);
|
|
173
178
|
t && r.modifyHtml(t).setAttribute("src", e);
|
|
174
179
|
}
|
|
175
180
|
_updateName(e, r) {
|
|
176
|
-
var
|
|
177
|
-
const t = (
|
|
181
|
+
var s;
|
|
182
|
+
const t = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${I.NAME}"]`);
|
|
178
183
|
if (!t)
|
|
179
184
|
return;
|
|
180
185
|
const i = t.getInnerText().trim();
|
|
181
186
|
let n = t.getInnerHTML().trim();
|
|
182
|
-
n = n.replace(i,
|
|
187
|
+
n = n.replace(i, A(e)), r.modifyHtml(t).setInnerHtml(n);
|
|
183
188
|
}
|
|
184
189
|
_updatePrice(e, r) {
|
|
185
190
|
var a;
|
|
186
191
|
const t = ((a = this.currentNode) == null ? void 0 : a.querySelectorAll(
|
|
187
|
-
`[esd-extension-block-id="${
|
|
188
|
-
)) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "",
|
|
192
|
+
`[esd-extension-block-id="${I.PRICE}"]`
|
|
193
|
+
)) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", s = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
|
|
189
194
|
t.forEach((l) => {
|
|
190
195
|
const c = this._getParagraphFromBlock(l);
|
|
191
196
|
if (!c)
|
|
192
197
|
return;
|
|
193
|
-
const
|
|
194
|
-
r.modifyHtml(c).setInnerHtml(
|
|
198
|
+
const o = c.getInnerHTML().trim() || "", d = c.getInnerText().trim() || "", m = (n == null ? void 0 : n.trim()) || "", u = this._removeCurrencySymbol(d, m), h = this._replacePriceNumber(u, e), E = this._buildPriceContent(h, m, s), S = o.replace(d, A(E));
|
|
199
|
+
r.modifyHtml(c).setInnerHtml(S);
|
|
195
200
|
});
|
|
196
201
|
}
|
|
197
202
|
_updateOriginalPrice(e, r) {
|
|
198
203
|
var a;
|
|
199
204
|
const t = ((a = this.currentNode) == null ? void 0 : a.querySelectorAll(
|
|
200
|
-
`[esd-extension-block-id="${
|
|
201
|
-
)) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "",
|
|
205
|
+
`[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
|
|
206
|
+
)) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", s = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
|
|
202
207
|
t.forEach((l) => {
|
|
203
208
|
const c = this._getParagraphFromBlock(l);
|
|
204
209
|
if (!c)
|
|
205
210
|
return;
|
|
206
|
-
const
|
|
207
|
-
if (!
|
|
211
|
+
const o = c.querySelector("s");
|
|
212
|
+
if (!o)
|
|
208
213
|
return;
|
|
209
|
-
const d =
|
|
210
|
-
r.modifyHtml(c).setInnerHtml(
|
|
214
|
+
const d = o.getInnerHTML().trim() || "", m = o.getInnerText().trim() || "", u = (n == null ? void 0 : n.trim()) || "", h = this._removeCurrencySymbol(m, u), E = this._replacePriceNumber(h, e), S = this._buildPriceContent(E, u, s), R = `<s>${d.replace(m, A(S))}</s>`;
|
|
215
|
+
r.modifyHtml(c).setInnerHtml(R);
|
|
211
216
|
});
|
|
212
217
|
}
|
|
213
218
|
_updateQuantity(e, r, t) {
|
|
214
219
|
var h;
|
|
215
|
-
const i = _(this.currentNode),
|
|
220
|
+
const i = _(this.currentNode), s = (r ?? (i == null ? void 0 : i.type) ?? T.ITEMS_TYPE.CART_ITEMS) !== T.ITEMS_TYPE.BROWSED_ITEMS, a = (i == null ? void 0 : i.quantityControlEnabled) !== !1, l = s && a, c = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`);
|
|
216
221
|
if (!c)
|
|
217
222
|
return;
|
|
218
|
-
const
|
|
219
|
-
if (!
|
|
223
|
+
const o = this._getParagraphFromBlock(c);
|
|
224
|
+
if (!o)
|
|
220
225
|
return;
|
|
221
|
-
const d =
|
|
222
|
-
let m =
|
|
223
|
-
function u(E,
|
|
226
|
+
const d = o.getInnerText().trim();
|
|
227
|
+
let m = o.getInnerHTML().trim();
|
|
228
|
+
function u(E, S, P) {
|
|
224
229
|
return E.replace(
|
|
225
|
-
new RegExp(`(>\\s*)?${
|
|
230
|
+
new RegExp(`(>\\s*)?${S}(\\s*<)?`, "g"),
|
|
226
231
|
`$1${P}$2`
|
|
227
232
|
);
|
|
228
233
|
}
|
|
229
|
-
m = u(m, d, e), t.modifyHtml(
|
|
234
|
+
m = u(m, d, e), t.modifyHtml(o).setInnerHtml(m), t.modifyHtml(c).setStyle("display", l ? "table-cell" : "none");
|
|
230
235
|
}
|
|
231
236
|
_reOrderTemplate(e) {
|
|
232
|
-
var h, E,
|
|
233
|
-
const r = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${
|
|
234
|
-
`[esd-extension-block-id="${
|
|
237
|
+
var h, E, S, P, R, b;
|
|
238
|
+
const r = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${I.IMAGE}"]`), t = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${I.NAME}"]`), i = ((S = this.currentNode) == null ? void 0 : S.querySelectorAll(
|
|
239
|
+
`[esd-extension-block-id="${I.PRICE}"]`
|
|
235
240
|
)) || [], n = ((P = this.currentNode) == null ? void 0 : P.querySelectorAll(
|
|
236
|
-
`[esd-extension-block-id="${
|
|
237
|
-
)) || [], [
|
|
238
|
-
if (!r || !t || !
|
|
241
|
+
`[esd-extension-block-id="${I.ORIGINAL_PRICE}"]`
|
|
242
|
+
)) || [], [s] = i, [a] = n, l = (R = this.currentNode) == null ? void 0 : R.querySelector(`[esd-extension-block-id="${I.QUANTITY}"]`), c = (b = this.currentNode) == null ? void 0 : b.querySelector(`[esd-extension-block-id="${I.BUTTON}"]`);
|
|
243
|
+
if (!r || !t || !s || !a || !l || !c)
|
|
239
244
|
return;
|
|
240
|
-
const
|
|
241
|
-
let u = m ?
|
|
245
|
+
const o = _(this.currentNode), d = (o == null ? void 0 : o.orientation) ?? T.ORIENTATION.VERTICAL, m = d === T.ORIENTATION.VERTICAL;
|
|
246
|
+
let u = m ? V : q;
|
|
242
247
|
setTimeout(() => {
|
|
243
|
-
const
|
|
248
|
+
const k = A(D(s.getOuterHTML(), m)), F = A(
|
|
244
249
|
D(a.getOuterHTML(), m)
|
|
245
250
|
);
|
|
246
|
-
u = u.replace("{-{-TEMPLATE_FIRST_LINE-}-}", m ? x : "").replace("{-{-PRODUCT_IMAGE-}-}", C(r.getOuterHTML())).replace("{-{-PRODUCT_NAME-}-}", C(t.getOuterHTML())).replaceAll("{-{-PRODUCT_PRICE-}-}", C(
|
|
251
|
+
u = u.replace("{-{-TEMPLATE_FIRST_LINE-}-}", m ? x : "").replace("{-{-PRODUCT_IMAGE-}-}", C(r.getOuterHTML())).replace("{-{-PRODUCT_NAME-}-}", C(t.getOuterHTML())).replaceAll("{-{-PRODUCT_PRICE-}-}", C(k)).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", C(F)).replace("{-{-PRODUCT_QUANTITY-}-}", C(l.getOuterHTML())).replace("{-{-PRODUCT_BUTTON-}-}", C(c.getOuterHTML())), u = G(
|
|
247
252
|
u,
|
|
248
253
|
d,
|
|
249
|
-
(
|
|
250
|
-
(
|
|
251
|
-
(
|
|
254
|
+
(o == null ? void 0 : o.priceOrientation) ?? "horizontal",
|
|
255
|
+
(o == null ? void 0 : o.priceVisible) ?? !0,
|
|
256
|
+
(o == null ? void 0 : o.originalPriceVisible) ?? !0
|
|
252
257
|
), u = u.trim().replace(x, "").slice(0, -5);
|
|
253
|
-
const
|
|
254
|
-
|
|
258
|
+
const O = e ?? this.api.getDocumentModifier();
|
|
259
|
+
O.modifyHtml(r.querySelector("img")).setAttribute("width", U.productImageWidth).setAttribute("height", U.productImageWidth), O.modifyHtml(this.currentNode).setInnerHtml(u), e || O.apply(new N("Reordered template"));
|
|
255
260
|
}, 50);
|
|
256
261
|
}
|
|
257
262
|
_updateDataTypeAttributes(e, r) {
|
|
@@ -259,15 +264,15 @@ class oe extends F {
|
|
|
259
264
|
return;
|
|
260
265
|
const t = this.currentNode.closest(".ins-product-td");
|
|
261
266
|
t && r.modifyHtml(t).setAttribute("data-type", e), this.currentNode.querySelectorAll("[data-type]").forEach((n) => {
|
|
262
|
-
const
|
|
263
|
-
r.modifyHtml(
|
|
267
|
+
const s = n;
|
|
268
|
+
r.modifyHtml(s).setAttribute("data-type", e);
|
|
264
269
|
});
|
|
265
270
|
}
|
|
266
271
|
_updateDataNumberAttributes(e, r) {
|
|
267
272
|
if (!this.currentNode)
|
|
268
273
|
return;
|
|
269
|
-
const t = _(this.currentNode), i = (t == null ? void 0 : t.type) ??
|
|
270
|
-
|
|
274
|
+
const t = _(this.currentNode), i = (t == null ? void 0 : t.type) ?? T.ITEMS_TYPE.CART_ITEMS, n = v(e, i), s = this.currentNode.closest(".ins-product-td");
|
|
275
|
+
s && r.modifyHtml(s).setAttribute("data-number", n), this.currentNode.querySelectorAll("[data-number]").forEach((l) => {
|
|
271
276
|
const c = l;
|
|
272
277
|
r.modifyHtml(c).setAttribute("data-number", n);
|
|
273
278
|
});
|
|
@@ -277,16 +282,16 @@ class oe extends F {
|
|
|
277
282
|
this._updateImageSrc(r.imageSrc, t), this._updateName(r.name, t), this._updatePrice(r.price, t), this._updateOriginalPrice(r.originalPrice, t), this._updateQuantity(r.quantity, e, t), t.apply(new N("Refilled template"));
|
|
278
283
|
}
|
|
279
284
|
_recalculateTrimming() {
|
|
280
|
-
var
|
|
285
|
+
var s;
|
|
281
286
|
if (!this.currentNode)
|
|
282
287
|
return;
|
|
283
|
-
const e = (
|
|
288
|
+
const e = (s = this.currentNode) == null ? void 0 : s.querySelector(`[esd-extension-block-id="${I.NAME}"]`);
|
|
284
289
|
if (!e)
|
|
285
290
|
return;
|
|
286
291
|
const r = Y(e);
|
|
287
292
|
if (!r)
|
|
288
293
|
return;
|
|
289
|
-
const t = _(this.currentNode), i = (t == null ? void 0 : t.nameTrimming) ?? !0, n =
|
|
294
|
+
const t = _(this.currentNode), i = (t == null ? void 0 : t.nameTrimming) ?? !0, n = f(t == null ? void 0 : t.orientation);
|
|
290
295
|
this.api.getDocumentModifier().modifyHtml(r).setStyle("overflow", "hidden").setStyle("white-space", i ? "nowrap" : "normal").setStyle("text-overflow", i ? "ellipsis" : "unset").setStyle("max-width", n).removeStyle("width").apply(new N("Recalculated trimming after orientation change"));
|
|
291
296
|
}
|
|
292
297
|
_getParagraphFromBlock(e) {
|
|
@@ -304,7 +309,7 @@ class oe extends F {
|
|
|
304
309
|
} else {
|
|
305
310
|
const n = t.match(/([^0-9.,\s]+)/);
|
|
306
311
|
if (n && n[1]) {
|
|
307
|
-
const
|
|
312
|
+
const s = n[1].trim(), a = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
|
|
308
313
|
i = t.replace(a, "").trim();
|
|
309
314
|
}
|
|
310
315
|
}
|
|
@@ -320,5 +325,5 @@ class oe extends F {
|
|
|
320
325
|
}
|
|
321
326
|
export {
|
|
322
327
|
Q as CONTROL_BLOCK_ID,
|
|
323
|
-
|
|
328
|
+
se as ItemsBlockControl
|
|
324
329
|
};
|
|
@@ -7,7 +7,7 @@ const u = "recommendation-card-background-color-control", e = {
|
|
|
7
7
|
GRID: ".product-card-segment",
|
|
8
8
|
LIST: ".product-card-wrapper"
|
|
9
9
|
};
|
|
10
|
-
class
|
|
10
|
+
class _ extends s {
|
|
11
11
|
getId() {
|
|
12
12
|
return u;
|
|
13
13
|
}
|
|
@@ -18,7 +18,7 @@ class h extends s {
|
|
|
18
18
|
]);
|
|
19
19
|
}
|
|
20
20
|
onRender() {
|
|
21
|
-
this.
|
|
21
|
+
this._setFormValues(), this._listenToFormUpdates();
|
|
22
22
|
}
|
|
23
23
|
onTemplateNodeUpdated(r) {
|
|
24
24
|
super.onTemplateNodeUpdated(r), this._setFormValues();
|
|
@@ -72,5 +72,5 @@ class h extends s {
|
|
|
72
72
|
}
|
|
73
73
|
export {
|
|
74
74
|
u as CARD_BACKGROUND_COLOR_CONTROL_ID,
|
|
75
|
-
|
|
75
|
+
_ as CardBackgroundColorControl
|
|
76
76
|
};
|