@useinsider/guido 2.1.0-beta.13ada05 → 2.1.0-beta.1d0cd94
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/price/currencyLocation.js +29 -29
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +29 -29
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +29 -31
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +1 -0
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +27 -29
- package/package.json +1 -1
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { currencyLocationMaps as
|
|
2
|
-
import { UEAttr as
|
|
3
|
-
import { CommonControl as
|
|
4
|
-
import { ItemsBlockControlId as
|
|
5
|
-
import { getItemsBlockConfig as
|
|
6
|
-
const
|
|
1
|
+
import { currencyLocationMaps as p } from "../../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { UEAttr as y, ModificationDescription as R } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
3
|
+
import { CommonControl as L } from "../../../common-control.js";
|
|
4
|
+
import { ItemsBlockControlId as u } from "../../enums/controlEnums.js";
|
|
5
|
+
import { getItemsBlockConfig as l, setItemsBlockConfig as N, escapeReplacement as I } from "../../utils/nodeConfigUtils.js";
|
|
6
|
+
const T = u.PRICE_CURRENCY_LOCATION, i = {
|
|
7
7
|
CURRENCY_LOCATION: "currencyLocation"
|
|
8
8
|
};
|
|
9
|
-
class
|
|
9
|
+
class $ extends L {
|
|
10
10
|
getId() {
|
|
11
|
-
return
|
|
11
|
+
return T;
|
|
12
12
|
}
|
|
13
13
|
getTemplate() {
|
|
14
14
|
return `
|
|
15
|
-
<div class="container ${
|
|
15
|
+
<div class="container ${u.PRICE_CURRENCY_LOCATION}">
|
|
16
16
|
${this._getCurrencyLocation()}
|
|
17
17
|
</div>
|
|
18
18
|
`;
|
|
19
19
|
}
|
|
20
20
|
onRender() {
|
|
21
|
-
const e =
|
|
22
|
-
this.api.setUIEAttribute(
|
|
21
|
+
const e = l(this.currentNode);
|
|
22
|
+
this.api.setUIEAttribute(i.CURRENCY_LOCATION, y.SELECTPICKER.items, p), this.api.updateValues({ [i.CURRENCY_LOCATION]: (e == null ? void 0 : e.priceCurrencyLocation) ?? "0" }), this.api.onValueChanged(i.CURRENCY_LOCATION, (t) => {
|
|
23
23
|
this._onCurrencyLocationChange(t);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
onTemplateNodeUpdated(e) {
|
|
27
27
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
|
|
28
|
-
const t =
|
|
29
|
-
this.api.updateValues({ [
|
|
28
|
+
const t = l(this.currentNode);
|
|
29
|
+
this.api.updateValues({ [i.CURRENCY_LOCATION]: (t == null ? void 0 : t.priceCurrencyLocation) ?? "0" });
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
_onCurrencyLocationChange(e) {
|
|
33
|
-
if (console.debug("Currency location changed to: ", e),
|
|
33
|
+
if (console.debug("Currency location changed to: ", e), N(this.currentNode, this.api, { priceCurrencyLocation: e }), !this.currentNode)
|
|
34
34
|
return;
|
|
35
35
|
const t = this._getPriceBlocks();
|
|
36
36
|
if (!t || t.length === 0)
|
|
37
37
|
return;
|
|
38
|
-
const r =
|
|
39
|
-
t.forEach((
|
|
40
|
-
const
|
|
41
|
-
if (!
|
|
38
|
+
const r = l(this.currentNode), n = e || "0", o = (r == null ? void 0 : r.priceCurrencySymbol) ?? "";
|
|
39
|
+
t.forEach((s) => {
|
|
40
|
+
const c = this._getParagraph(s);
|
|
41
|
+
if (!c)
|
|
42
42
|
return;
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
)
|
|
43
|
+
const m = c.getInnerHTML().trim() || "", a = c.getInnerText().trim() || "", C = (o == null ? void 0 : o.trim()) || "", h = this._removeCurrencySymbol(a, C), d = this._detectSymbolInText(a) || C, g = this._buildPriceContent(h, d, n), _ = m.replace(a, I(g));
|
|
44
|
+
this.api.getDocumentModifier().modifyHtml(c).setInnerHtml(_).apply(new R(
|
|
45
|
+
`Updated currency location to ${n === "1" ? "after" : "before"}`
|
|
46
|
+
));
|
|
47
|
+
});
|
|
48
48
|
}
|
|
49
49
|
_getPriceBlocks() {
|
|
50
50
|
var e, t;
|
|
@@ -65,8 +65,8 @@ class A extends N {
|
|
|
65
65
|
} else {
|
|
66
66
|
const o = r.match(/([^0-9.,\s]+)/);
|
|
67
67
|
if (o && o[1]) {
|
|
68
|
-
const
|
|
69
|
-
n = r.replace(
|
|
68
|
+
const s = o[1].trim(), c = new RegExp(`\\s*${this._escapeRegex(s)}\\s*`);
|
|
69
|
+
n = r.replace(c, "").trim();
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
return n;
|
|
@@ -83,15 +83,15 @@ class A extends N {
|
|
|
83
83
|
${this._GuTwoColumns([
|
|
84
84
|
this._GuLabel({ text: "Currency Location" }),
|
|
85
85
|
this._GuSelect({
|
|
86
|
-
name:
|
|
86
|
+
name: i.CURRENCY_LOCATION,
|
|
87
87
|
placeholder: "",
|
|
88
|
-
options:
|
|
88
|
+
options: p
|
|
89
89
|
})
|
|
90
90
|
])}
|
|
91
91
|
`;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
export {
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
T as CONTROL_BLOCK_ID,
|
|
96
|
+
$ as PriceCurrencyLocationControl
|
|
97
97
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var h = (s, c, e) =>
|
|
4
|
-
import { ModificationDescription as
|
|
5
|
-
import { CommonControl as
|
|
1
|
+
var b = Object.defineProperty;
|
|
2
|
+
var R = (s, c, e) => c in s ? b(s, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[c] = e;
|
|
3
|
+
var h = (s, c, e) => R(s, typeof c != "symbol" ? c + "" : c, e);
|
|
4
|
+
import { ModificationDescription as N } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as B } from "../../../common-control.js";
|
|
6
6
|
import { ItemsBlockControlId as y } from "../../enums/controlEnums.js";
|
|
7
|
-
import { getItemsBlockConfig as
|
|
8
|
-
const I = y.PRICE_CURRENCY_SYMBOL,
|
|
7
|
+
import { getItemsBlockConfig as m, setItemsBlockConfig as E, escapeReplacement as x } from "../../utils/nodeConfigUtils.js";
|
|
8
|
+
const I = y.PRICE_CURRENCY_SYMBOL, p = {
|
|
9
9
|
CURRENCY_SYMBOL: "currencySymbol"
|
|
10
10
|
};
|
|
11
|
-
class
|
|
11
|
+
class O extends B {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
14
14
|
h(this, "originalPriceContents", /* @__PURE__ */ new Map());
|
|
@@ -24,8 +24,8 @@ class P extends E {
|
|
|
24
24
|
`;
|
|
25
25
|
}
|
|
26
26
|
onRender() {
|
|
27
|
-
const e =
|
|
28
|
-
this.api.updateValues({ [
|
|
27
|
+
const e = m(this.currentNode);
|
|
28
|
+
this.api.updateValues({ [p.CURRENCY_SYMBOL]: (e == null ? void 0 : e.priceCurrencySymbol) ?? "" }), this._storeOriginalContents(), this.api.onValueChanged(p.CURRENCY_SYMBOL, (t) => {
|
|
29
29
|
this._onCurrencySymbolChange(t);
|
|
30
30
|
});
|
|
31
31
|
}
|
|
@@ -34,42 +34,42 @@ class P extends E {
|
|
|
34
34
|
}
|
|
35
35
|
onTemplateNodeUpdated(e) {
|
|
36
36
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
|
|
37
|
-
const t =
|
|
38
|
-
this.api.updateValues({ [
|
|
37
|
+
const t = m(this.currentNode);
|
|
38
|
+
this.api.updateValues({ [p.CURRENCY_SYMBOL]: (t == null ? void 0 : t.priceCurrencySymbol) ?? "" }), this._storeOriginalContents();
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
_onCurrencySymbolChange(e) {
|
|
42
|
-
var
|
|
42
|
+
var i;
|
|
43
43
|
console.debug("Currency symbol changed to: ", e);
|
|
44
|
-
const t =
|
|
45
|
-
if (
|
|
44
|
+
const t = m(this.currentNode), o = ((i = t == null ? void 0 : t.priceCurrencySymbol) == null ? void 0 : i.trim()) || "";
|
|
45
|
+
if (E(this.currentNode, this.api, { priceCurrencySymbol: e }), !this.currentNode)
|
|
46
46
|
return;
|
|
47
47
|
const r = this._getPriceBlocks();
|
|
48
48
|
if (!r || r.length === 0)
|
|
49
49
|
return;
|
|
50
|
-
const n = (e == null ? void 0 : e.trim()) || "", l = (t == null ? void 0 : t.priceCurrencyLocation) ?? "0"
|
|
51
|
-
r.forEach((
|
|
52
|
-
const
|
|
53
|
-
if (!
|
|
50
|
+
const n = (e == null ? void 0 : e.trim()) || "", l = (t == null ? void 0 : t.priceCurrencyLocation) ?? "0";
|
|
51
|
+
r.forEach((u) => {
|
|
52
|
+
const a = this._getParagraph(u);
|
|
53
|
+
if (!a)
|
|
54
54
|
return;
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
)
|
|
55
|
+
const d = a.getInnerHTML().trim() || "", C = a.getInnerText().trim() || "", g = this._removeCurrencySymbol(C, o), _ = this._buildPriceContent(g, n, l), S = d.replace(C, x(_));
|
|
56
|
+
this.api.getDocumentModifier().modifyHtml(a).setInnerHtml(S).apply(new N(
|
|
57
|
+
`Updated currency symbol to ${n || "removed"}`
|
|
58
|
+
));
|
|
59
|
+
});
|
|
60
60
|
}
|
|
61
61
|
_storeOriginalContents() {
|
|
62
62
|
if (!this.currentNode)
|
|
63
63
|
return;
|
|
64
|
-
const e =
|
|
64
|
+
const e = m(this.currentNode);
|
|
65
65
|
this.currentNode.querySelectorAll(
|
|
66
66
|
".items-block-price"
|
|
67
67
|
).forEach((o) => {
|
|
68
68
|
var n;
|
|
69
69
|
const r = o.querySelector("p");
|
|
70
70
|
if (r && !this.originalPriceContents.has(r)) {
|
|
71
|
-
const l = r.getInnerText() || "", i = ((n = e == null ? void 0 : e.priceCurrencySymbol) == null ? void 0 : n.trim()) || "",
|
|
72
|
-
this.originalPriceContents.set(r,
|
|
71
|
+
const l = r.getInnerText() || "", i = ((n = e == null ? void 0 : e.priceCurrencySymbol) == null ? void 0 : n.trim()) || "", u = this._removeCurrencySymbol(l, i);
|
|
72
|
+
this.originalPriceContents.set(r, u);
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
}
|
|
@@ -106,7 +106,7 @@ class P extends E {
|
|
|
106
106
|
${this._GuTwoColumns([
|
|
107
107
|
this._GuLabel({ text: "Currency Symbol" }),
|
|
108
108
|
this._GuTextInput({
|
|
109
|
-
name:
|
|
109
|
+
name: p.CURRENCY_SYMBOL,
|
|
110
110
|
placeholder: "Enter Currency Symbol",
|
|
111
111
|
className: "es-180w"
|
|
112
112
|
})
|
|
@@ -116,5 +116,5 @@ class P extends E {
|
|
|
116
116
|
}
|
|
117
117
|
export {
|
|
118
118
|
I as CONTROL_BLOCK_ID,
|
|
119
|
-
|
|
119
|
+
O as PriceCurrencySymbolControl
|
|
120
120
|
};
|
|
@@ -1,65 +1,63 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import { ItemsBlockControlId as
|
|
1
|
+
import { ModificationDescription as A, UIElementType as P, UEAttr as C } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as L } from "../../../common-control.js";
|
|
3
|
+
import { ItemsBlockControlId as p, ItemsBlockId as _ } from "../../enums/controlEnums.js";
|
|
4
4
|
import { productPairs as I } from "../../enums/productEnums.js";
|
|
5
|
-
import { getItemsBlockConfig as d, setItemsBlockConfig as
|
|
6
|
-
const g =
|
|
5
|
+
import { getItemsBlockConfig as d, setItemsBlockConfig as D, escapeReplacement as h } from "../../utils/nodeConfigUtils.js";
|
|
6
|
+
const g = p.PRICE_FORMATTED_PRICE, s = {
|
|
7
7
|
FORMATTED_PRICE: "formattedPrice"
|
|
8
8
|
};
|
|
9
|
-
class
|
|
9
|
+
class $ extends L {
|
|
10
10
|
getId() {
|
|
11
11
|
return g;
|
|
12
12
|
}
|
|
13
13
|
getTemplate() {
|
|
14
14
|
return `
|
|
15
|
-
<div class="container ${
|
|
15
|
+
<div class="container ${p.PRICE_FORMATTED_PRICE}">
|
|
16
16
|
${this._getFormattedPrice()}
|
|
17
17
|
</div>
|
|
18
18
|
`;
|
|
19
19
|
}
|
|
20
20
|
onRender() {
|
|
21
|
-
const
|
|
22
|
-
this.api.updateValues({ [s.FORMATTED_PRICE]: (
|
|
23
|
-
this._onFormattedPriceChange(
|
|
21
|
+
const e = d(this.currentNode);
|
|
22
|
+
this.api.updateValues({ [s.FORMATTED_PRICE]: (e == null ? void 0 : e.priceFormatted) ?? !0 }), this.api.onValueChanged(s.FORMATTED_PRICE, (t) => {
|
|
23
|
+
this._onFormattedPriceChange(t);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
onTemplateNodeUpdated(
|
|
27
|
-
super.onTemplateNodeUpdated(
|
|
28
|
-
const
|
|
29
|
-
this.api.updateValues({ [s.FORMATTED_PRICE]: (
|
|
26
|
+
onTemplateNodeUpdated(e) {
|
|
27
|
+
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
|
|
28
|
+
const t = d(this.currentNode);
|
|
29
|
+
this.api.updateValues({ [s.FORMATTED_PRICE]: (t == null ? void 0 : t.priceFormatted) ?? !0 });
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
_onFormattedPriceChange(
|
|
33
|
-
if (console.debug("Formatted price changed to: ",
|
|
32
|
+
_onFormattedPriceChange(e) {
|
|
33
|
+
if (console.debug("Formatted price changed to: ", e), D(this.currentNode, this.api, { priceFormatted: e }), !this.currentNode)
|
|
34
34
|
return;
|
|
35
|
-
const
|
|
35
|
+
const t = d(this.currentNode), n = (t == null ? void 0 : t.type) ?? "CART_ITEMS", i = (t == null ? void 0 : t.priceSinglePrice) ?? !1, r = I.PAIRS_FOR_EXTENSION.price[n], o = I.PAIRS_FOR_EXTENSION.originalPrice[n], [E, R] = e ? [
|
|
36
36
|
i ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE,
|
|
37
37
|
i ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED
|
|
38
38
|
] : [
|
|
39
39
|
i ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED,
|
|
40
40
|
i ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE
|
|
41
|
-
], l = i ?
|
|
41
|
+
], l = i ? o.DEFAULT_SINGLE_PRICE : o.DEFAULT_PRICE, T = i ? o.DEFAULT_SINGLE_PRICE_FORMATTED : o.DEFAULT_PRICE_FORMATTED, [m, F] = e ? [l, T] : [T, l], c = this.currentNode.closest(".items-block");
|
|
42
|
+
((c == null ? void 0 : c.querySelectorAll(
|
|
42
43
|
`[esd-extension-block-id="${_.PRICE}"]`
|
|
43
|
-
)) || []
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}), ((o == null ? void 0 : o.querySelectorAll(
|
|
44
|
+
)) || []).forEach((a) => {
|
|
45
|
+
this._updatePriceBlock(a, E, R, e, "price");
|
|
46
|
+
}), ((c == null ? void 0 : c.querySelectorAll(
|
|
47
47
|
`[esd-extension-block-id="${_.ORIGINAL_PRICE}"]`
|
|
48
48
|
)) || []).forEach((a) => {
|
|
49
|
-
this._updatePriceBlock(
|
|
50
|
-
})
|
|
51
|
-
`Updated price to ${t ? "formatted" : "unformatted"}`
|
|
52
|
-
));
|
|
49
|
+
this._updatePriceBlock(a, m, F, e, "original price");
|
|
50
|
+
});
|
|
53
51
|
}
|
|
54
|
-
_updatePriceBlock(
|
|
55
|
-
const
|
|
56
|
-
|
|
52
|
+
_updatePriceBlock(e, t, n, i, r) {
|
|
53
|
+
const o = e.getInnerHTML().trim().replace(t, h(n)), E = `Updated ${r} to ${i ? "formatted" : "unformatted"}`;
|
|
54
|
+
this.api.getDocumentModifier().modifyHtml(e).setInnerHtml(o).apply(new A(E));
|
|
57
55
|
}
|
|
58
56
|
_getFormattedPrice() {
|
|
59
57
|
return `
|
|
60
58
|
<div class="display-flex align-items-center justify-content-between">
|
|
61
59
|
<${P.LABEL}
|
|
62
|
-
${
|
|
60
|
+
${C.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
|
|
63
61
|
>
|
|
64
62
|
</${P.LABEL}>
|
|
65
63
|
${this._GuToggle(s.FORMATTED_PRICE)}
|
|
@@ -69,5 +67,5 @@ class k extends h {
|
|
|
69
67
|
}
|
|
70
68
|
export {
|
|
71
69
|
g as CONTROL_BLOCK_ID,
|
|
72
|
-
|
|
70
|
+
$ as PriceFormattedPriceControl
|
|
73
71
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import { ItemsBlockControlId as
|
|
4
|
-
import { productPairs as
|
|
5
|
-
import { getItemsBlockConfig as I, setItemsBlockConfig as u, escapeReplacement as
|
|
6
|
-
const
|
|
1
|
+
import { ModificationDescription as P, UIElementType as _, UEAttr as S } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as m } from "../../../common-control.js";
|
|
3
|
+
import { ItemsBlockControlId as T, ItemsBlockId as g } from "../../enums/controlEnums.js";
|
|
4
|
+
import { productPairs as R } from "../../enums/productEnums.js";
|
|
5
|
+
import { getItemsBlockConfig as I, setItemsBlockConfig as u, escapeReplacement as A } from "../../utils/nodeConfigUtils.js";
|
|
6
|
+
const h = T.PRICE_SINGLE_PRICE, l = {
|
|
7
7
|
SINGLE_PRICE: "singlePrice"
|
|
8
8
|
};
|
|
9
|
-
class
|
|
9
|
+
class M extends m {
|
|
10
10
|
getId() {
|
|
11
|
-
return
|
|
11
|
+
return h;
|
|
12
12
|
}
|
|
13
13
|
getTemplate() {
|
|
14
14
|
return `
|
|
15
|
-
<div class="container ${
|
|
15
|
+
<div class="container ${T.PRICE_SINGLE_PRICE}">
|
|
16
16
|
${this._getSinglePrice()}
|
|
17
17
|
</div>
|
|
18
18
|
`;
|
|
@@ -32,36 +32,34 @@ class y extends h {
|
|
|
32
32
|
_onSinglePriceChange(e) {
|
|
33
33
|
if (console.debug("Single price changed to: ", e), u(this.currentNode, this.api, { priceSinglePrice: e }), !this.currentNode)
|
|
34
34
|
return;
|
|
35
|
-
const t = I(this.currentNode),
|
|
35
|
+
const t = I(this.currentNode), n = (t == null ? void 0 : t.type) ?? "CART_ITEMS", r = (t == null ? void 0 : t.priceFormatted) ?? !1, i = R.PAIRS_FOR_EXTENSION.price[n], c = R.PAIRS_FOR_EXTENSION.originalPrice[n], [E, d] = e ? [
|
|
36
36
|
r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE,
|
|
37
37
|
r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE
|
|
38
38
|
] : [
|
|
39
39
|
r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE,
|
|
40
40
|
r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE
|
|
41
|
-
],
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
this._updatePriceBlock(
|
|
46
|
-
}), ((
|
|
47
|
-
`[esd-extension-block-id="${
|
|
48
|
-
)) || []).forEach((
|
|
49
|
-
this._updatePriceBlock(
|
|
50
|
-
})
|
|
51
|
-
`Updated price to ${e ? "single" : "total"} price`
|
|
52
|
-
));
|
|
41
|
+
], a = r ? c.DEFAULT_PRICE_FORMATTED : c.DEFAULT_PRICE, s = r ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_SINGLE_PRICE, [L, C] = e ? [a, s] : [s, a], o = this.currentNode.closest(".items-block");
|
|
42
|
+
((o == null ? void 0 : o.querySelectorAll(
|
|
43
|
+
`[esd-extension-block-id="${g.PRICE}"]`
|
|
44
|
+
)) || []).forEach((p) => {
|
|
45
|
+
this._updatePriceBlock(p, E, d, e, "price");
|
|
46
|
+
}), ((o == null ? void 0 : o.querySelectorAll(
|
|
47
|
+
`[esd-extension-block-id="${g.ORIGINAL_PRICE}"]`
|
|
48
|
+
)) || []).forEach((p) => {
|
|
49
|
+
this._updatePriceBlock(p, L, C, e, "original price");
|
|
50
|
+
});
|
|
53
51
|
}
|
|
54
|
-
_updatePriceBlock(e, t,
|
|
55
|
-
const c =
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
_updatePriceBlock(e, t, n, r, i) {
|
|
53
|
+
const c = e.getInnerHTML().trim().replace(t, A(n)), E = `Updated ${i} to ${r ? "single" : "total"} price`;
|
|
54
|
+
this.api.getDocumentModifier().modifyHtml(e).setInnerHtml(c).apply(new P(E)), e.querySelectorAll('[product-attr="price"], [product-attr="originalPrice"]').forEach((s) => {
|
|
55
|
+
this.api.getDocumentModifier().modifyHtml(s).setAttribute("data-single_price", r ? "true" : "false").apply(new P("Update single price attribute"));
|
|
58
56
|
});
|
|
59
57
|
}
|
|
60
58
|
_getSinglePrice() {
|
|
61
59
|
return `
|
|
62
60
|
<div class="display-flex align-items-center justify-content-between">
|
|
63
61
|
<${_.LABEL}
|
|
64
|
-
${
|
|
62
|
+
${S.LABEL.text}="${this.api.translate("Show Single Product Price")}"
|
|
65
63
|
>
|
|
66
64
|
</${_.LABEL}>
|
|
67
65
|
${this._GuToggle(l.SINGLE_PRICE)}
|
|
@@ -70,6 +68,6 @@ class y extends h {
|
|
|
70
68
|
}
|
|
71
69
|
}
|
|
72
70
|
export {
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
h as CONTROL_BLOCK_ID,
|
|
72
|
+
M as PriceSinglePriceControl
|
|
75
73
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.1d0cd94",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|