@useinsider/guido 3.21.2-beta.45bb425 → 3.21.2-beta.4c14c74
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/Items/controls/button/link.js +14 -17
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +14 -17
- package/dist/extensions/Blocks/Items/controls/image/link.js +14 -17
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +9 -10
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +24 -25
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -13
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +29 -30
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +15 -16
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +25 -26
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +27 -28
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +75 -80
- 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 +121 -116
- 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 +62 -55
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -2
- package/dist/src/extensions/Blocks/common-control.d.ts +2 -0
- package/dist/utils/pairProductVariables.js +98 -90
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
1
|
+
import { ModificationDescription as d } 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 u } from "../../enums/settingsEnums.js";
|
|
5
|
+
import { getItemsBlockConfig as h, setItemsBlockConfig as I } from "../../utils/nodeConfigUtils.js";
|
|
6
|
+
const y = m.PRICE_ORIENTATION, p = {
|
|
7
7
|
PRICE_ORIENTATION: "priceOrientation"
|
|
8
|
-
},
|
|
8
|
+
}, N = [
|
|
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 y;
|
|
15
15
|
}
|
|
16
16
|
getTemplate() {
|
|
17
17
|
return `
|
|
@@ -21,15 +21,14 @@ class P extends O {
|
|
|
21
21
|
`;
|
|
22
22
|
}
|
|
23
23
|
onRender() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
typeof t == "string" && this._onPriceOrientationChange(t);
|
|
24
|
+
this.forgetLastPanelNode(), this.api.onValueChanged(p.PRICE_ORIENTATION, (i) => {
|
|
25
|
+
typeof i == "string" && this._onPriceOrientationChange(i);
|
|
27
26
|
});
|
|
28
27
|
}
|
|
29
28
|
onTemplateNodeUpdated(i) {
|
|
30
29
|
super.onTemplateNodeUpdated(i), this.handleBlockInstanceChange(() => {
|
|
31
|
-
const t =
|
|
32
|
-
this.api.updateValues({ [
|
|
30
|
+
const t = h(this.currentNode);
|
|
31
|
+
this.api.updateValues({ [p.PRICE_ORIENTATION]: (t == null ? void 0 : t.priceOrientation) ?? "horizontal" });
|
|
33
32
|
});
|
|
34
33
|
}
|
|
35
34
|
_onPriceOrientationChange(i) {
|
|
@@ -37,46 +36,46 @@ class P extends O {
|
|
|
37
36
|
priceOrientation: i
|
|
38
37
|
}), !this.currentNode)
|
|
39
38
|
return;
|
|
40
|
-
const t =
|
|
39
|
+
const t = h(this.currentNode), e = ((t == null ? void 0 : t.orientation) ?? u.ORIENTATION.VERTICAL) === u.ORIENTATION.VERTICAL, o = i === "horizontal";
|
|
41
40
|
e ? this._updateVerticalLayout(o) : this._updateHorizontalLayout(o);
|
|
42
41
|
}
|
|
43
42
|
_updateVerticalLayout(i) {
|
|
44
|
-
var a,
|
|
45
|
-
const t = ((
|
|
43
|
+
var a, l, s, n;
|
|
44
|
+
const t = ((l = (a = this.currentNode) == null ? void 0 : a.closest(".ins-product-td")) == null ? void 0 : l.querySelectorAll(".product-price-class")) || [], r = ((n = (s = this.currentNode) == null ? void 0 : s.closest(".ins-product-td")) == null ? void 0 : n.querySelectorAll(".product-original-price-class")) || [];
|
|
46
45
|
if (!t || !r)
|
|
47
46
|
return;
|
|
48
47
|
const e = i ? "50%" : "100%", o = this.api.getDocumentModifier();
|
|
49
|
-
t.forEach((
|
|
50
|
-
o.modifyHtml(
|
|
51
|
-
}), r.forEach((
|
|
52
|
-
o.modifyHtml(
|
|
53
|
-
}), o.apply(new
|
|
48
|
+
t.forEach((c) => {
|
|
49
|
+
o.modifyHtml(c).setAttribute("width", e).setStyle("width", e);
|
|
50
|
+
}), r.forEach((c) => {
|
|
51
|
+
o.modifyHtml(c).setAttribute("width", e).setStyle("width", e);
|
|
52
|
+
}), o.apply(new d(`Updated original price element width to ${e}`));
|
|
54
53
|
}
|
|
55
54
|
_updateHorizontalLayout(i) {
|
|
56
|
-
var o, a,
|
|
57
|
-
const t = ((a = (o = this.currentNode) == null ? void 0 : o.closest(".ins-product-td")) == null ? void 0 : a.querySelectorAll(".horizontal-price")) || [], r = (
|
|
55
|
+
var o, a, l, s;
|
|
56
|
+
const t = ((a = (o = this.currentNode) == null ? void 0 : o.closest(".ins-product-td")) == null ? void 0 : a.querySelectorAll(".horizontal-price")) || [], r = (s = (l = this.currentNode) == null ? void 0 : l.closest(".ins-product-td")) == null ? void 0 : s.querySelector(".vertical-price");
|
|
58
57
|
if (!t || !r || t.length === 0)
|
|
59
58
|
return;
|
|
60
59
|
const e = this.api.getDocumentModifier();
|
|
61
60
|
i ? (t.forEach((n) => {
|
|
62
61
|
e.modifyHtml(n).setStyle("display", "table-cell");
|
|
63
|
-
}), e.modifyHtml(r).setStyle("display", "none"), e.apply(new
|
|
62
|
+
}), e.modifyHtml(r).setStyle("display", "none"), e.apply(new d("Show horizontal price orientation"))) : (t.forEach((n) => {
|
|
64
63
|
e.modifyHtml(n).setStyle("display", "none");
|
|
65
|
-
}), e.modifyHtml(r).setStyle("display", "table-cell"), e.apply(new
|
|
64
|
+
}), e.modifyHtml(r).setStyle("display", "table-cell"), e.apply(new d("Show vertical price orientation")));
|
|
66
65
|
}
|
|
67
66
|
_getPriceOrientation() {
|
|
68
67
|
return `
|
|
69
68
|
${this._GuTwoColumns([
|
|
70
69
|
this._GuLabel({ text: "Price Orientation" }),
|
|
71
70
|
this._GuRadioButton({
|
|
72
|
-
name:
|
|
73
|
-
buttons:
|
|
71
|
+
name: p.PRICE_ORIENTATION,
|
|
72
|
+
buttons: N
|
|
74
73
|
})
|
|
75
74
|
])}
|
|
76
75
|
`;
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
export {
|
|
80
|
-
|
|
79
|
+
y as CONTROL_BLOCK_ID,
|
|
81
80
|
P as PriceOrientationControl
|
|
82
81
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ModificationDescription as S, UIElementType as
|
|
1
|
+
import { ModificationDescription as S, UIElementType as _, 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 d } from "../../enums/controlEnums.js";
|
|
4
|
+
import { productPairs as p } from "../../enums/productEnums.js";
|
|
5
|
+
import { getItemsBlockConfig as g, setItemsBlockConfig as N, escapeReplacement as h } from "../../utils/nodeConfigUtils.js";
|
|
6
|
+
const u = T.PRICE_SINGLE_PRICE, a = {
|
|
7
7
|
SINGLE_PRICE: "singlePrice"
|
|
8
8
|
};
|
|
9
9
|
class k extends A {
|
|
@@ -18,53 +18,52 @@ class k extends A {
|
|
|
18
18
|
`;
|
|
19
19
|
}
|
|
20
20
|
onRender() {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this._onSinglePriceChange(i);
|
|
21
|
+
this.forgetLastPanelNode(), this.api.onValueChanged(a.SINGLE_PRICE, (e) => {
|
|
22
|
+
this._onSinglePriceChange(e);
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
25
|
onTemplateNodeUpdated(e) {
|
|
27
26
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
|
|
28
|
-
const
|
|
29
|
-
this.api.updateValues({ [
|
|
27
|
+
const t = g(this.currentNode);
|
|
28
|
+
this.api.updateValues({ [a.SINGLE_PRICE]: (t == null ? void 0 : t.priceSinglePrice) ?? !1 });
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
31
|
_onSinglePriceChange(e) {
|
|
33
32
|
if (console.debug("Single price changed to: ", e), !this.currentNode)
|
|
34
33
|
return;
|
|
35
|
-
const
|
|
36
|
-
r ?
|
|
37
|
-
r ?
|
|
34
|
+
const t = g(this.currentNode), c = (t == null ? void 0 : t.type) ?? "CART_ITEMS", r = (t == null ? void 0 : t.priceFormatted) ?? !1, i = p.PAIRS_FOR_EXTENSION.price[c], n = p.PAIRS_FOR_EXTENSION.originalPrice[c], [l, L] = e ? [
|
|
35
|
+
r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE,
|
|
36
|
+
r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE
|
|
38
37
|
] : [
|
|
39
|
-
r ?
|
|
40
|
-
r ?
|
|
41
|
-
],
|
|
38
|
+
r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE,
|
|
39
|
+
r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE
|
|
40
|
+
], I = r ? n.DEFAULT_PRICE_FORMATTED : n.DEFAULT_PRICE, P = r ? n.DEFAULT_SINGLE_PRICE_FORMATTED : n.DEFAULT_SINGLE_PRICE, [R, C] = e ? [I, P] : [P, I], s = this.api.getDocumentModifier();
|
|
42
41
|
N(this.currentNode, this.api, { priceSinglePrice: e }, s);
|
|
43
42
|
const o = this.currentNode.closest(".items-block");
|
|
44
43
|
((o == null ? void 0 : o.querySelectorAll(
|
|
45
|
-
`[esd-extension-block-id="${
|
|
46
|
-
)) || []).forEach((
|
|
47
|
-
this._updatePriceBlock(s,
|
|
44
|
+
`[esd-extension-block-id="${d.PRICE}"]`
|
|
45
|
+
)) || []).forEach((E) => {
|
|
46
|
+
this._updatePriceBlock(s, E, l, L, e);
|
|
48
47
|
}), ((o == null ? void 0 : o.querySelectorAll(
|
|
49
|
-
`[esd-extension-block-id="${
|
|
50
|
-
)) || []).forEach((
|
|
51
|
-
this._updatePriceBlock(s,
|
|
48
|
+
`[esd-extension-block-id="${d.ORIGINAL_PRICE}"]`
|
|
49
|
+
)) || []).forEach((E) => {
|
|
50
|
+
this._updatePriceBlock(s, E, R, C, e);
|
|
52
51
|
}), s.apply(new S(
|
|
53
52
|
`Updated price to ${e ? "single" : "total"} price`
|
|
54
53
|
));
|
|
55
54
|
}
|
|
56
|
-
_updatePriceBlock(e,
|
|
57
|
-
const n = `data-single_price="${
|
|
58
|
-
e.modifyHtml(
|
|
55
|
+
_updatePriceBlock(e, t, c, r, i) {
|
|
56
|
+
const n = `data-single_price="${i ? "true" : "false"}"`, l = t.getInnerHTML().trim().replace(c, h(r)).replace(/data-single_price=(?:"[^"]*"|'[^']*')/g, n);
|
|
57
|
+
e.modifyHtml(t).setInnerHtml(l);
|
|
59
58
|
}
|
|
60
59
|
_getSinglePrice() {
|
|
61
60
|
return `
|
|
62
61
|
<div class="display-flex align-items-center justify-content-between">
|
|
63
|
-
<${
|
|
62
|
+
<${_.LABEL}
|
|
64
63
|
${m.LABEL.text}="${this.api.translate("Show Single Product Price")}"
|
|
65
64
|
>
|
|
66
|
-
</${
|
|
67
|
-
${this._GuToggle(
|
|
65
|
+
</${_.LABEL}>
|
|
66
|
+
${this._GuToggle(a.SINGLE_PRICE)}
|
|
68
67
|
</div>
|
|
69
68
|
`;
|
|
70
69
|
}
|
|
@@ -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 F } from "../../common-control.js";
|
|
3
|
+
import { reorientBlockCellPadding as D, nameMaxWidthFor as $ } from "../constants/cardLayout.js";
|
|
4
|
+
import { ItemsBlockId as T } from "../enums/controlEnums.js";
|
|
5
|
+
import { productPairs as S, templateFirstLine as x } from "../enums/productEnums.js";
|
|
6
|
+
import { SETTINGS_ENUMS as I, ItemTypeOptions as H, OrientationOptions as w, ItemInCartOptions as O, DefaultConfigValues as U } from "../enums/settingsEnums.js";
|
|
7
7
|
import q from "../layouts/horizontal.html.js";
|
|
8
|
-
import
|
|
9
|
-
import { getDefaultTemplate as
|
|
8
|
+
import B from "../layouts/vertical.html.js";
|
|
9
|
+
import { getDefaultTemplate as V, 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 b, escapeReplacement as g, 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 oe extends F {
|
|
18
18
|
getId() {
|
|
19
19
|
return Q;
|
|
20
20
|
}
|
|
@@ -28,19 +28,14 @@ class se extends $ {
|
|
|
28
28
|
`;
|
|
29
29
|
}
|
|
30
30
|
onRender() {
|
|
31
|
-
|
|
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();
|
|
31
|
+
this.forgetLastPanelNode(), this._listenToFormUpdates();
|
|
37
32
|
}
|
|
38
33
|
onTemplateNodeUpdated(e) {
|
|
39
34
|
super.onTemplateNodeUpdated(e), console.debug("Items Block Config", e.getNodeConfig()), this.handleBlockInstanceChange(() => {
|
|
40
35
|
const r = _(this.currentNode);
|
|
41
36
|
this.api.updateValues({
|
|
42
|
-
[p.ORIENTATION]: (r == null ? void 0 : r.orientation) ??
|
|
43
|
-
[p.ITEMS_TYPE]: (r == null ? void 0 : r.type) ??
|
|
37
|
+
[p.ORIENTATION]: (r == null ? void 0 : r.orientation) ?? I.ORIENTATION.VERTICAL,
|
|
38
|
+
[p.ITEMS_TYPE]: (r == null ? void 0 : r.type) ?? I.ITEMS_TYPE.CART_ITEMS,
|
|
44
39
|
[p.ITEM_IDS]: (r == null ? void 0 : r.itemsSelectValue) ?? ""
|
|
45
40
|
}), this._initializeSelectItems();
|
|
46
41
|
});
|
|
@@ -85,7 +80,7 @@ class se extends $ {
|
|
|
85
80
|
_onOrientationChange(e) {
|
|
86
81
|
this.api.updateValues({ [p.ORIENTATION]: e });
|
|
87
82
|
const r = this.api.getDocumentModifier();
|
|
88
|
-
|
|
83
|
+
b(this.currentNode, this.api, {
|
|
89
84
|
orientation: e,
|
|
90
85
|
priceOrientation: "horizontal"
|
|
91
86
|
}, r), r.apply(new N("Changed orientation")), this._reOrderTemplate(), setTimeout(() => {
|
|
@@ -93,15 +88,15 @@ class se extends $ {
|
|
|
93
88
|
}, 50);
|
|
94
89
|
}
|
|
95
90
|
_onItemsTypeChange(e) {
|
|
96
|
-
const r =
|
|
91
|
+
const r = I.ITEMS_TYPE[e], t = O[e], i = t == null ? void 0 : t[0];
|
|
97
92
|
if (!r || !i)
|
|
98
93
|
return;
|
|
99
|
-
const n = i.value,
|
|
100
|
-
|
|
94
|
+
const n = i.value, o = i.value.replace("Url}}", "Image}}"), a = this.api.getDocumentModifier();
|
|
95
|
+
b(this.currentNode, this.api, {
|
|
101
96
|
source: r,
|
|
102
97
|
type: r,
|
|
103
98
|
itemsSelectValue: i.value,
|
|
104
|
-
imageLink:
|
|
99
|
+
imageLink: o,
|
|
105
100
|
buttonLink: n
|
|
106
101
|
}, a), this._updateDataTypeAttributes(r, a), this._initializeSelectItems();
|
|
107
102
|
const l = this._getTemplateData(r, i.value);
|
|
@@ -110,7 +105,7 @@ class se extends $ {
|
|
|
110
105
|
_onItemIdsChange(e) {
|
|
111
106
|
this.api.updateValues({ [p.ITEM_IDS]: e });
|
|
112
107
|
const r = e, t = e.replace("Url}}", "Image}}"), i = this.api.getDocumentModifier();
|
|
113
|
-
|
|
108
|
+
b(this.currentNode, this.api, {
|
|
114
109
|
itemsSelectValue: e,
|
|
115
110
|
imageLink: t,
|
|
116
111
|
buttonLink: r
|
|
@@ -124,11 +119,11 @@ class se extends $ {
|
|
|
124
119
|
L.SELECTPICKER.items,
|
|
125
120
|
H
|
|
126
121
|
);
|
|
127
|
-
const e = _(this.currentNode), r = (e == null ? void 0 : e.type) ??
|
|
122
|
+
const e = _(this.currentNode), r = (e == null ? void 0 : e.type) ?? I.ITEMS_TYPE.CART_ITEMS, t = (e == null ? void 0 : e.itemsSelectValue) ?? "";
|
|
128
123
|
this.api.updateValues({
|
|
129
124
|
[p.ITEMS_TYPE]: r
|
|
130
125
|
});
|
|
131
|
-
const i =
|
|
126
|
+
const i = O[r];
|
|
132
127
|
this.api.setUIEAttribute(
|
|
133
128
|
p.ITEM_IDS,
|
|
134
129
|
L.SELECTPICKER.items,
|
|
@@ -150,113 +145,113 @@ class se extends $ {
|
|
|
150
145
|
);
|
|
151
146
|
}
|
|
152
147
|
_renderTemplate() {
|
|
153
|
-
const e = _(this.currentNode), r = (e == null ? void 0 : e.orientation) ??
|
|
154
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(
|
|
148
|
+
const e = _(this.currentNode), r = (e == null ? void 0 : e.orientation) ?? I.ORIENTATION.VERTICAL, t = (e == null ? void 0 : e.type) ?? I.ITEMS_TYPE.CART_ITEMS, i = (e == null ? void 0 : e.itemsSelectValue) ?? "", n = (e == null ? void 0 : e.priceCurrencySymbol) ?? "", o = (e == null ? void 0 : e.priceCurrencyLocation) ?? "0", a = (e == null ? void 0 : e.priceFormatted) ?? !1;
|
|
149
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).setInnerHtml(V({
|
|
155
150
|
orientation: r,
|
|
156
151
|
itemsType: t,
|
|
157
152
|
itemId: i,
|
|
158
153
|
currencySymbol: n,
|
|
159
|
-
currencyLocation:
|
|
154
|
+
currencyLocation: o,
|
|
160
155
|
formattedPrice: a
|
|
161
156
|
})).apply(new N("Updated template"));
|
|
162
157
|
}
|
|
163
158
|
_getTemplateData(e, r) {
|
|
164
|
-
const t = _(this.currentNode), i = e ?? (t == null ? void 0 : t.type) ??
|
|
159
|
+
const t = _(this.currentNode), i = e ?? (t == null ? void 0 : t.type) ?? I.ITEMS_TYPE.CART_ITEMS, n = r ?? (t == null ? void 0 : t.itemsSelectValue) ?? "", o = (t == null ? void 0 : t.priceFormatted) ?? !1, a = (t == null ? void 0 : t.priceSinglePrice) ?? !1, l = O[i].findIndex((h) => h.value === n), c = l > -1 ? l : 0, s = S.PAIRS_FOR_EXTENSION.price[i], d = S.PAIRS_FOR_EXTENSION.originalPrice[i];
|
|
165
160
|
let m, u;
|
|
166
|
-
return a ? (m =
|
|
167
|
-
imageSrc:
|
|
168
|
-
name:
|
|
161
|
+
return a ? (m = o ? s.DEFAULT_SINGLE_PRICE_FORMATTED : s.DEFAULT_SINGLE_PRICE, u = o ? d.DEFAULT_SINGLE_PRICE_FORMATTED : d.DEFAULT_SINGLE_PRICE) : (m = o ? s.DEFAULT_PRICE_FORMATTED : s.DEFAULT_PRICE, u = o ? d.DEFAULT_PRICE_FORMATTED : d.DEFAULT_PRICE), {
|
|
162
|
+
imageSrc: S.PAIRS_FOR_EXTENSION.imageSrc[i].DEFAULT[c],
|
|
163
|
+
name: S.PAIRS_FOR_EXTENSION.name[i].DEFAULT[c],
|
|
169
164
|
price: m,
|
|
170
165
|
originalPrice: u,
|
|
171
|
-
quantity:
|
|
172
|
-
button:
|
|
166
|
+
quantity: S.PAIRS_FOR_EXTENSION.quantity[i].DEFAULT,
|
|
167
|
+
button: S.PAIRS_FOR_EXTENSION.button[i].DEFAULT_LABEL
|
|
173
168
|
};
|
|
174
169
|
}
|
|
175
170
|
_updateImageSrc(e, r) {
|
|
176
171
|
var i;
|
|
177
|
-
const t = (i = this.currentNode) == null ? void 0 : i.querySelector(`[esd-extension-block-id="${
|
|
172
|
+
const t = (i = this.currentNode) == null ? void 0 : i.querySelector(`[esd-extension-block-id="${T.IMAGE}"] img`);
|
|
178
173
|
t && r.modifyHtml(t).setAttribute("src", e);
|
|
179
174
|
}
|
|
180
175
|
_updateName(e, r) {
|
|
181
|
-
var
|
|
182
|
-
const t = (
|
|
176
|
+
var o;
|
|
177
|
+
const t = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${T.NAME}"]`);
|
|
183
178
|
if (!t)
|
|
184
179
|
return;
|
|
185
180
|
const i = t.getInnerText().trim();
|
|
186
181
|
let n = t.getInnerHTML().trim();
|
|
187
|
-
n = n.replace(i,
|
|
182
|
+
n = n.replace(i, g(e)), r.modifyHtml(t).setInnerHtml(n);
|
|
188
183
|
}
|
|
189
184
|
_updatePrice(e, r) {
|
|
190
185
|
var a;
|
|
191
186
|
const t = ((a = this.currentNode) == null ? void 0 : a.querySelectorAll(
|
|
192
|
-
`[esd-extension-block-id="${
|
|
193
|
-
)) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "",
|
|
187
|
+
`[esd-extension-block-id="${T.PRICE}"]`
|
|
188
|
+
)) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", o = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
|
|
194
189
|
t.forEach((l) => {
|
|
195
190
|
const c = this._getParagraphFromBlock(l);
|
|
196
191
|
if (!c)
|
|
197
192
|
return;
|
|
198
|
-
const
|
|
199
|
-
r.modifyHtml(c).setInnerHtml(
|
|
193
|
+
const s = 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, o), y = s.replace(d, g(E));
|
|
194
|
+
r.modifyHtml(c).setInnerHtml(y);
|
|
200
195
|
});
|
|
201
196
|
}
|
|
202
197
|
_updateOriginalPrice(e, r) {
|
|
203
198
|
var a;
|
|
204
199
|
const t = ((a = this.currentNode) == null ? void 0 : a.querySelectorAll(
|
|
205
|
-
`[esd-extension-block-id="${
|
|
206
|
-
)) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "",
|
|
200
|
+
`[esd-extension-block-id="${T.ORIGINAL_PRICE}"]`
|
|
201
|
+
)) || [], i = _(this.currentNode), n = (i == null ? void 0 : i.priceCurrencySymbol) ?? "", o = (i == null ? void 0 : i.priceCurrencyLocation) ?? "0";
|
|
207
202
|
t.forEach((l) => {
|
|
208
203
|
const c = this._getParagraphFromBlock(l);
|
|
209
204
|
if (!c)
|
|
210
205
|
return;
|
|
211
|
-
const
|
|
212
|
-
if (!
|
|
206
|
+
const s = c.querySelector("s");
|
|
207
|
+
if (!s)
|
|
213
208
|
return;
|
|
214
|
-
const d =
|
|
215
|
-
r.modifyHtml(c).setInnerHtml(
|
|
209
|
+
const d = s.getInnerHTML().trim() || "", m = s.getInnerText().trim() || "", u = (n == null ? void 0 : n.trim()) || "", h = this._removeCurrencySymbol(m, u), E = this._replacePriceNumber(h, e), y = this._buildPriceContent(E, u, o), A = `<s>${d.replace(m, g(y))}</s>`;
|
|
210
|
+
r.modifyHtml(c).setInnerHtml(A);
|
|
216
211
|
});
|
|
217
212
|
}
|
|
218
213
|
_updateQuantity(e, r, t) {
|
|
219
214
|
var h;
|
|
220
|
-
const i = _(this.currentNode),
|
|
215
|
+
const i = _(this.currentNode), o = (r ?? (i == null ? void 0 : i.type) ?? I.ITEMS_TYPE.CART_ITEMS) !== I.ITEMS_TYPE.BROWSED_ITEMS, a = (i == null ? void 0 : i.quantityControlEnabled) !== !1, l = o && a, c = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${T.QUANTITY}"]`);
|
|
221
216
|
if (!c)
|
|
222
217
|
return;
|
|
223
|
-
const
|
|
224
|
-
if (!
|
|
218
|
+
const s = this._getParagraphFromBlock(c);
|
|
219
|
+
if (!s)
|
|
225
220
|
return;
|
|
226
|
-
const d =
|
|
227
|
-
let m =
|
|
228
|
-
function u(E,
|
|
221
|
+
const d = s.getInnerText().trim();
|
|
222
|
+
let m = s.getInnerHTML().trim();
|
|
223
|
+
function u(E, y, P) {
|
|
229
224
|
return E.replace(
|
|
230
|
-
new RegExp(`(>\\s*)?${
|
|
225
|
+
new RegExp(`(>\\s*)?${y}(\\s*<)?`, "g"),
|
|
231
226
|
`$1${P}$2`
|
|
232
227
|
);
|
|
233
228
|
}
|
|
234
|
-
m = u(m, d, e), t.modifyHtml(
|
|
229
|
+
m = u(m, d, e), t.modifyHtml(s).setInnerHtml(m), t.modifyHtml(c).setStyle("display", l ? "table-cell" : "none");
|
|
235
230
|
}
|
|
236
231
|
_reOrderTemplate(e) {
|
|
237
|
-
var h, E,
|
|
238
|
-
const r = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${
|
|
239
|
-
`[esd-extension-block-id="${
|
|
232
|
+
var h, E, y, P, A, M;
|
|
233
|
+
const r = (h = this.currentNode) == null ? void 0 : h.querySelector(`[esd-extension-block-id="${T.IMAGE}"]`), t = (E = this.currentNode) == null ? void 0 : E.querySelector(`[esd-extension-block-id="${T.NAME}"]`), i = ((y = this.currentNode) == null ? void 0 : y.querySelectorAll(
|
|
234
|
+
`[esd-extension-block-id="${T.PRICE}"]`
|
|
240
235
|
)) || [], n = ((P = this.currentNode) == null ? void 0 : P.querySelectorAll(
|
|
241
|
-
`[esd-extension-block-id="${
|
|
242
|
-
)) || [], [
|
|
243
|
-
if (!r || !t || !
|
|
236
|
+
`[esd-extension-block-id="${T.ORIGINAL_PRICE}"]`
|
|
237
|
+
)) || [], [o] = i, [a] = n, l = (A = this.currentNode) == null ? void 0 : A.querySelector(`[esd-extension-block-id="${T.QUANTITY}"]`), c = (M = this.currentNode) == null ? void 0 : M.querySelector(`[esd-extension-block-id="${T.BUTTON}"]`);
|
|
238
|
+
if (!r || !t || !o || !a || !l || !c)
|
|
244
239
|
return;
|
|
245
|
-
const
|
|
246
|
-
let u = m ?
|
|
240
|
+
const s = _(this.currentNode), d = (s == null ? void 0 : s.orientation) ?? I.ORIENTATION.VERTICAL, m = d === I.ORIENTATION.VERTICAL;
|
|
241
|
+
let u = m ? B : q;
|
|
247
242
|
setTimeout(() => {
|
|
248
|
-
const
|
|
243
|
+
const f = g(D(o.getOuterHTML(), m)), k = g(
|
|
249
244
|
D(a.getOuterHTML(), m)
|
|
250
245
|
);
|
|
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(
|
|
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(f)).replaceAll("{-{-PRODUCT_ORIGINAL_PRICE-}-}", C(k)).replace("{-{-PRODUCT_QUANTITY-}-}", C(l.getOuterHTML())).replace("{-{-PRODUCT_BUTTON-}-}", C(c.getOuterHTML())), u = G(
|
|
252
247
|
u,
|
|
253
248
|
d,
|
|
254
|
-
(
|
|
255
|
-
(
|
|
256
|
-
(
|
|
249
|
+
(s == null ? void 0 : s.priceOrientation) ?? "horizontal",
|
|
250
|
+
(s == null ? void 0 : s.priceVisible) ?? !0,
|
|
251
|
+
(s == null ? void 0 : s.originalPriceVisible) ?? !0
|
|
257
252
|
), u = u.trim().replace(x, "").slice(0, -5);
|
|
258
|
-
const
|
|
259
|
-
|
|
253
|
+
const R = e ?? this.api.getDocumentModifier();
|
|
254
|
+
R.modifyHtml(r.querySelector("img")).setAttribute("width", U.productImageWidth).setAttribute("height", U.productImageWidth), R.modifyHtml(this.currentNode).setInnerHtml(u), e || R.apply(new N("Reordered template"));
|
|
260
255
|
}, 50);
|
|
261
256
|
}
|
|
262
257
|
_updateDataTypeAttributes(e, r) {
|
|
@@ -264,15 +259,15 @@ class se extends $ {
|
|
|
264
259
|
return;
|
|
265
260
|
const t = this.currentNode.closest(".ins-product-td");
|
|
266
261
|
t && r.modifyHtml(t).setAttribute("data-type", e), this.currentNode.querySelectorAll("[data-type]").forEach((n) => {
|
|
267
|
-
const
|
|
268
|
-
r.modifyHtml(
|
|
262
|
+
const o = n;
|
|
263
|
+
r.modifyHtml(o).setAttribute("data-type", e);
|
|
269
264
|
});
|
|
270
265
|
}
|
|
271
266
|
_updateDataNumberAttributes(e, r) {
|
|
272
267
|
if (!this.currentNode)
|
|
273
268
|
return;
|
|
274
|
-
const t = _(this.currentNode), i = (t == null ? void 0 : t.type) ??
|
|
275
|
-
|
|
269
|
+
const t = _(this.currentNode), i = (t == null ? void 0 : t.type) ?? I.ITEMS_TYPE.CART_ITEMS, n = v(e, i), o = this.currentNode.closest(".ins-product-td");
|
|
270
|
+
o && r.modifyHtml(o).setAttribute("data-number", n), this.currentNode.querySelectorAll("[data-number]").forEach((l) => {
|
|
276
271
|
const c = l;
|
|
277
272
|
r.modifyHtml(c).setAttribute("data-number", n);
|
|
278
273
|
});
|
|
@@ -282,16 +277,16 @@ class se extends $ {
|
|
|
282
277
|
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"));
|
|
283
278
|
}
|
|
284
279
|
_recalculateTrimming() {
|
|
285
|
-
var
|
|
280
|
+
var o;
|
|
286
281
|
if (!this.currentNode)
|
|
287
282
|
return;
|
|
288
|
-
const e = (
|
|
283
|
+
const e = (o = this.currentNode) == null ? void 0 : o.querySelector(`[esd-extension-block-id="${T.NAME}"]`);
|
|
289
284
|
if (!e)
|
|
290
285
|
return;
|
|
291
286
|
const r = Y(e);
|
|
292
287
|
if (!r)
|
|
293
288
|
return;
|
|
294
|
-
const t = _(this.currentNode), i = (t == null ? void 0 : t.nameTrimming) ?? !0, n =
|
|
289
|
+
const t = _(this.currentNode), i = (t == null ? void 0 : t.nameTrimming) ?? !0, n = $(t == null ? void 0 : t.orientation);
|
|
295
290
|
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"));
|
|
296
291
|
}
|
|
297
292
|
_getParagraphFromBlock(e) {
|
|
@@ -309,7 +304,7 @@ class se extends $ {
|
|
|
309
304
|
} else {
|
|
310
305
|
const n = t.match(/([^0-9.,\s]+)/);
|
|
311
306
|
if (n && n[1]) {
|
|
312
|
-
const
|
|
307
|
+
const o = n[1].trim(), a = new RegExp(`\\s*${this._escapeRegex(o)}\\s*`);
|
|
313
308
|
i = t.replace(a, "").trim();
|
|
314
309
|
}
|
|
315
310
|
}
|
|
@@ -325,5 +320,5 @@ class se extends $ {
|
|
|
325
320
|
}
|
|
326
321
|
export {
|
|
327
322
|
Q as CONTROL_BLOCK_ID,
|
|
328
|
-
|
|
323
|
+
oe as ItemsBlockControl
|
|
329
324
|
};
|
|
@@ -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 h extends s {
|
|
11
11
|
getId() {
|
|
12
12
|
return u;
|
|
13
13
|
}
|
|
@@ -18,7 +18,7 @@ class _ extends s {
|
|
|
18
18
|
]);
|
|
19
19
|
}
|
|
20
20
|
onRender() {
|
|
21
|
-
this.
|
|
21
|
+
this.forgetLastPanelNode(), this._listenToFormUpdates();
|
|
22
22
|
}
|
|
23
23
|
onTemplateNodeUpdated(r) {
|
|
24
24
|
super.onTemplateNodeUpdated(r), this._setFormValues();
|
|
@@ -72,5 +72,5 @@ class _ extends s {
|
|
|
72
72
|
}
|
|
73
73
|
export {
|
|
74
74
|
u as CARD_BACKGROUND_COLOR_CONTROL_ID,
|
|
75
|
-
|
|
75
|
+
h as CardBackgroundColorControl
|
|
76
76
|
};
|
|
@@ -4,7 +4,7 @@ var v = (_, g, t) => ct(_, typeof g != "symbol" ? g + "" : g, t);
|
|
|
4
4
|
import { ACADEMY_LINKS as dt } from "../../../../../enums/academy.js";
|
|
5
5
|
import { UIElementType as f, UEAttr as O, ModificationDescription as y } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
6
|
import { CommonControl as ut } from "../../../common-control.js";
|
|
7
|
-
import { ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_NAME as mt, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as I, ATTR_PRODUCT_OMNIBUS_PRICE as ht, ATTR_PRODUCT_OMNIBUS_DISCOUNT as pt, ATTR_PRODUCT_BUTTON as F, ATTR_RECOMMENDATION_TITLE as $, ATTR_DATA_CARD_COMPOSITION as K, ATTR_DATA_CUSTOM_ATTRIBUTES as W, ATTR_CUSTOM_PREFIX as N, SELECTOR_ATTRIBUTE_ROW as E, SELECTOR_TITLE_CELL as
|
|
7
|
+
import { ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_NAME as mt, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as I, ATTR_PRODUCT_OMNIBUS_PRICE as ht, ATTR_PRODUCT_OMNIBUS_DISCOUNT as pt, ATTR_PRODUCT_BUTTON as F, ATTR_RECOMMENDATION_TITLE as $, ATTR_DATA_CARD_COMPOSITION as K, ATTR_DATA_CUSTOM_ATTRIBUTES as W, ATTR_CUSTOM_PREFIX as N, SELECTOR_ATTRIBUTE_ROW as E, SELECTOR_TITLE_CELL as G, ATTR_DATA_VISIBILITY as D, ATTR_DATA_ATTRIBUTE_TYPE as R, CSS_CLASS_ATTRIBUTE_ROW as z, CSS_CLASS_SPACER as _t, BUILT_IN_DEFAULT_ATTRIBUTES as gt } from "../../constants/selectors.js";
|
|
8
8
|
import { DEFAULT_COMPOSITION as Y, DEFAULT_VISIBILITY as X } from "../../constants/defaultConfig.js";
|
|
9
9
|
import { RecommendationConfigService as T } from "../../services/configService.js";
|
|
10
10
|
import { useRecommendationExtensionStore as ft } from "../../store/recommendation.js";
|
|
@@ -142,7 +142,7 @@ class se extends ut {
|
|
|
142
142
|
`;
|
|
143
143
|
}
|
|
144
144
|
onRender() {
|
|
145
|
-
this.
|
|
145
|
+
this.forgetLastPanelNode(), this._registerValueChangeListeners(), this._setupEventListeners(), this._updateOrderableState(), this._subscribeToStoreChanges();
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
148
|
* Card composition restructures the block (toggles/reorders/adds attribute
|
|
@@ -230,7 +230,7 @@ class se extends ut {
|
|
|
230
230
|
}
|
|
231
231
|
_hasTitle() {
|
|
232
232
|
var t;
|
|
233
|
-
return !!((t = this.currentNode) != null && t.querySelector(
|
|
233
|
+
return !!((t = this.currentNode) != null && t.querySelector(G));
|
|
234
234
|
}
|
|
235
235
|
_getDefaultVisibilities() {
|
|
236
236
|
return { ...X };
|
|
@@ -712,7 +712,7 @@ class se extends ut {
|
|
|
712
712
|
);
|
|
713
713
|
}
|
|
714
714
|
).join(""), ot = Ct(x, l).repeat(S - B);
|
|
715
|
-
return `<tr class="${
|
|
715
|
+
return `<tr class="${z}" ${R}="${r}" ${D}="1">${st}${ot}</tr>`;
|
|
716
716
|
}
|
|
717
717
|
return this._getExistingRowHtml(u, j);
|
|
718
718
|
}).join("");
|
|
@@ -867,7 +867,7 @@ class se extends ut {
|
|
|
867
867
|
return t.length > 0 ? t : this._findTitleRowsByClass();
|
|
868
868
|
}
|
|
869
869
|
_findTitleRowsByClass() {
|
|
870
|
-
const t = this._findTitleContainerBody(), e = t && "children" in t ? t.children() : [], r = e.findIndex((s) => !!s.querySelector(
|
|
870
|
+
const t = this._findTitleContainerBody(), e = t && "children" in t ? t.children() : [], r = e.findIndex((s) => !!s.querySelector(G));
|
|
871
871
|
if (r === -1)
|
|
872
872
|
return [];
|
|
873
873
|
const i = e[r + 1];
|
|
@@ -974,7 +974,7 @@ class se extends ut {
|
|
|
974
974
|
const r = this.store.recommendationConfigs.orientation;
|
|
975
975
|
r !== t && (t = r, this._updateOrderableState());
|
|
976
976
|
const i = Object.keys(this.store.filterList).sort().join(",");
|
|
977
|
-
i !== e && (e = i, this._initializeComposition());
|
|
977
|
+
i !== e && (e = i, this.currentNode && this._initializeComposition());
|
|
978
978
|
});
|
|
979
979
|
}
|
|
980
980
|
/**
|
|
@@ -1027,7 +1027,7 @@ class se extends ut {
|
|
|
1027
1027
|
[i]: e,
|
|
1028
1028
|
product_attributes: { [i]: e }
|
|
1029
1029
|
}, l = s[r](o).replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
1030
|
-
return `<tr class="${
|
|
1030
|
+
return `<tr class="${z}" ${R}="${r}" ${D}="1">${l}</tr>`;
|
|
1031
1031
|
}
|
|
1032
1032
|
}
|
|
1033
1033
|
export {
|