@useinsider/guido 3.11.0-beta.5099e81 → 3.11.0-beta.5589e48
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.
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { migrateCheckbox as
|
|
1
|
+
import { migrateCheckbox as t } from "./checkboxMigrator.js";
|
|
2
2
|
import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
|
|
3
3
|
import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
|
|
4
4
|
import { migrateRadioButton as a } from "./radioButtonMigrator.js";
|
|
5
|
-
import { migrateRecommendation as
|
|
5
|
+
import { migrateRecommendation as c } from "./recommendationMigrator.js";
|
|
6
|
+
import { migrateSocialIcons as g } from "./socialIconMigrator.js";
|
|
6
7
|
import { migrateUnsubscribe as n } from "./unsubscribeMigrator.js";
|
|
7
|
-
const
|
|
8
|
-
let m =
|
|
9
|
-
return m =
|
|
8
|
+
const k = async (o, r = {}) => {
|
|
9
|
+
let m = o;
|
|
10
|
+
return m = t(m), m = a(m), m = await n(m), m = i(m), m = c(m, r), m = e(m), m = g(m), m;
|
|
10
11
|
};
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
+
k as migrate
|
|
13
14
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var T = (e, t, r) => t in e ? u(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var s = (e, t, r) => T(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
const i = "twitter", E = "xcom", o = "esd-tmp-icon-type", p = new RegExp(i, "i");
|
|
5
|
+
class g {
|
|
6
|
+
constructor() {
|
|
7
|
+
s(this, "parser");
|
|
8
|
+
this.parser = new DOMParser();
|
|
9
|
+
}
|
|
10
|
+
migrate(t) {
|
|
11
|
+
try {
|
|
12
|
+
if (!p.test(t))
|
|
13
|
+
return t;
|
|
14
|
+
const r = this.parser.parseFromString(t, "text/html"), a = r.querySelectorAll(`[${o}]`);
|
|
15
|
+
let n = !1;
|
|
16
|
+
return a.forEach((c) => {
|
|
17
|
+
String(c.getAttribute(o)).toLowerCase() === i && (c.setAttribute(o, E), n = !0);
|
|
18
|
+
}), n ? r.documentElement.outerHTML : t;
|
|
19
|
+
} catch (r) {
|
|
20
|
+
return console.error("SocialIconMigrator failed:", r), t;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function _(e) {
|
|
25
|
+
return new g().migrate(e);
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
_ as migrateSocialIcons
|
|
29
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
3
|
-
import { ItemsBlockControlId as R, ItemsBlockId as
|
|
4
|
-
import { productPairs as
|
|
5
|
-
import { getItemsBlockConfig as
|
|
6
|
-
const
|
|
1
|
+
import { ModificationDescription as L, UIElementType as P, UEAttr as D } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as h } from "../../../common-control.js";
|
|
3
|
+
import { ItemsBlockControlId as R, ItemsBlockId as _ } from "../../enums/controlEnums.js";
|
|
4
|
+
import { productPairs as I } from "../../enums/productEnums.js";
|
|
5
|
+
import { getItemsBlockConfig as d, setItemsBlockConfig as u, escapeReplacement as O } from "../../utils/nodeConfigUtils.js";
|
|
6
|
+
const g = R.PRICE_FORMATTED_PRICE, s = {
|
|
7
7
|
FORMATTED_PRICE: "formattedPrice"
|
|
8
8
|
};
|
|
9
|
-
class k extends
|
|
9
|
+
class k extends h {
|
|
10
10
|
getId() {
|
|
11
|
-
return
|
|
11
|
+
return g;
|
|
12
12
|
}
|
|
13
13
|
getTemplate() {
|
|
14
14
|
return `
|
|
@@ -18,58 +18,56 @@ class k extends D {
|
|
|
18
18
|
`;
|
|
19
19
|
}
|
|
20
20
|
onRender() {
|
|
21
|
-
const
|
|
22
|
-
this.api.updateValues({ [
|
|
23
|
-
this._onFormattedPriceChange(
|
|
21
|
+
const t = d(this.currentNode);
|
|
22
|
+
this.api.updateValues({ [s.FORMATTED_PRICE]: (t == null ? void 0 : t.priceFormatted) ?? !0 }), this.api.onValueChanged(s.FORMATTED_PRICE, (e) => {
|
|
23
|
+
this._onFormattedPriceChange(e);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
onTemplateNodeUpdated(
|
|
27
|
-
super.onTemplateNodeUpdated(
|
|
28
|
-
const
|
|
29
|
-
this.api.updateValues({ [
|
|
26
|
+
onTemplateNodeUpdated(t) {
|
|
27
|
+
super.onTemplateNodeUpdated(t), this.handleBlockInstanceChange(() => {
|
|
28
|
+
const e = d(this.currentNode);
|
|
29
|
+
this.api.updateValues({ [s.FORMATTED_PRICE]: (e == null ? void 0 : e.priceFormatted) ?? !0 });
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
_onFormattedPriceChange(
|
|
33
|
-
if (console.debug("Formatted price changed to: ",
|
|
32
|
+
_onFormattedPriceChange(t) {
|
|
33
|
+
if (console.debug("Formatted price changed to: ", t), u(this.currentNode, this.api, { priceFormatted: t }), !this.currentNode)
|
|
34
34
|
return;
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const e = d(this.currentNode), n = (e == null ? void 0 : e.type) ?? "CART_ITEMS", i = (e == null ? void 0 : e.priceSinglePrice) ?? !1, r = I.PAIRS_FOR_EXTENSION.price[n], c = I.PAIRS_FOR_EXTENSION.originalPrice[n], [p, m] = t ? [
|
|
36
|
+
i ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE,
|
|
37
|
+
i ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED
|
|
38
38
|
] : [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
],
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
((
|
|
45
|
-
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
}), s.apply(new C(
|
|
53
|
-
`Updated price to ${e ? "formatted" : "unformatted"}`
|
|
39
|
+
i ? r.DEFAULT_SINGLE_PRICE_FORMATTED : r.DEFAULT_PRICE_FORMATTED,
|
|
40
|
+
i ? r.DEFAULT_SINGLE_PRICE : r.DEFAULT_PRICE
|
|
41
|
+
], l = i ? c.DEFAULT_SINGLE_PRICE : c.DEFAULT_PRICE, T = i ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_PRICE_FORMATTED, [F, A] = t ? [l, T] : [T, l], o = this.currentNode.closest(".items-block"), C = (o == null ? void 0 : o.querySelectorAll(
|
|
42
|
+
`[esd-extension-block-id="${_.PRICE}"]`
|
|
43
|
+
)) || [], E = this.api.getDocumentModifier();
|
|
44
|
+
C.forEach((a) => {
|
|
45
|
+
this._updatePriceBlock(E, a, p, m);
|
|
46
|
+
}), ((o == null ? void 0 : o.querySelectorAll(
|
|
47
|
+
`[esd-extension-block-id="${_.ORIGINAL_PRICE}"]`
|
|
48
|
+
)) || []).forEach((a) => {
|
|
49
|
+
this._updatePriceBlock(E, a, F, A);
|
|
50
|
+
}), E.apply(new L(
|
|
51
|
+
`Updated price to ${t ? "formatted" : "unformatted"}`
|
|
54
52
|
));
|
|
55
53
|
}
|
|
56
|
-
_updatePriceBlock(
|
|
57
|
-
const
|
|
58
|
-
|
|
54
|
+
_updatePriceBlock(t, e, n, i) {
|
|
55
|
+
const r = e.getInnerHTML().trim().replace(n, O(i));
|
|
56
|
+
t.modifyHtml(e).setInnerHtml(r);
|
|
59
57
|
}
|
|
60
58
|
_getFormattedPrice() {
|
|
61
59
|
return `
|
|
62
60
|
<div class="display-flex align-items-center justify-content-between">
|
|
63
|
-
<${
|
|
64
|
-
${
|
|
61
|
+
<${P.LABEL}
|
|
62
|
+
${D.LABEL.text}="${this.api.translate("Formatted Price (e.g. $9.90)")}"
|
|
65
63
|
>
|
|
66
|
-
</${
|
|
67
|
-
${this._GuToggle(
|
|
64
|
+
</${P.LABEL}>
|
|
65
|
+
${this._GuToggle(s.FORMATTED_PRICE)}
|
|
68
66
|
</div>
|
|
69
67
|
`;
|
|
70
68
|
}
|
|
71
69
|
}
|
|
72
70
|
export {
|
|
73
|
-
|
|
71
|
+
g as CONTROL_BLOCK_ID,
|
|
74
72
|
k as PriceFormattedPriceControl
|
|
75
73
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function migrateSocialIcons(html: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.11.0-beta.
|
|
3
|
+
"version": "3.11.0-beta.5589e48",
|
|
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",
|