@useinsider/guido 1.0.3-beta.929417a → 1.0.3-beta.9440b5f
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/radioButtonMigrator.js +5 -5
- package/dist/extensions/Blocks/Checkbox/control.js +15 -14
- package/dist/extensions/Blocks/RadioButton/control.js +18 -17
- package/dist/extensions/Blocks/RadioButton/template.js +10 -9
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ class T {
|
|
|
11
11
|
try {
|
|
12
12
|
const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.radio-button-block");
|
|
13
13
|
return i.length === 0 ? t : (i.forEach((s) => {
|
|
14
|
-
const o = s.getAttribute("id"), l = this.extractTextFromElement(s, "ins-title"), a = this.extractTextFromElement(s, "ins-description"), p = this.extractTextFromElement(s, "ins-subscribe"), u = this.extractTextFromElement(s, "ins-unsubscribe"),
|
|
14
|
+
const o = s.getAttribute("id"), l = this.extractTextFromElement(s, "ins-title"), a = this.extractTextFromElement(s, "ins-description"), p = this.extractTextFromElement(s, "ins-subscribe"), u = this.extractTextFromElement(s, "ins-unsubscribe"), g = this.buildTextBlock(l), d = this.buildTextBlock(a), m = this.buildTextBlock({ ...p, classList: "" }), n = this.buildTextBlock({ ...u, classList: "" }), c = h.replace("{-{-TITLE-}-}", g).replace("{-{-DESCRIPTION-}-}", d).replace("{-{-YES-}-}", m).replace("{-{-NO-}-}", n).replace(/{BLOCK_ID}/g, o || ""), y = this.parser.parseFromString(
|
|
15
15
|
`<table id="tempDoc"><tbody><tr>${c}</tr></tbody></table>`,
|
|
16
16
|
"text/html"
|
|
17
17
|
).querySelector(".radio-button-v2");
|
|
@@ -43,13 +43,13 @@ class T {
|
|
|
43
43
|
styles: "",
|
|
44
44
|
classList: ""
|
|
45
45
|
};
|
|
46
|
-
const o = ((c = s.textContent) == null ? void 0 : c.trim()) || (e === "ins-title" ? "Title" : "Description"), l = s.getAttribute("style") || "", a = i.getAttribute("align") || s.getAttribute("align") || "left", p = /font-weight\s*:\s*bold/i.test(l) || !!s.querySelector("b, strong"), u = /font-style\s*:\s*italic/i.test(l) || !!s.querySelector("i, em"),
|
|
46
|
+
const o = ((c = s.textContent) == null ? void 0 : c.trim()) || (e === "ins-title" ? "Title" : "Description"), l = s.getAttribute("style") || "", a = i.getAttribute("align") || s.getAttribute("align") || "left", p = /font-weight\s*:\s*bold/i.test(l) || !!s.querySelector("b, strong"), u = /font-style\s*:\s*italic/i.test(l) || !!s.querySelector("i, em"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), d = this.convertInlineToBlock(g), m = i.getAttribute("class") || "";
|
|
47
47
|
return {
|
|
48
48
|
text: o,
|
|
49
49
|
isBold: p,
|
|
50
50
|
isItalic: u,
|
|
51
51
|
align: a,
|
|
52
|
-
styles:
|
|
52
|
+
styles: d,
|
|
53
53
|
classList: m
|
|
54
54
|
};
|
|
55
55
|
}
|
|
@@ -78,9 +78,9 @@ class T {
|
|
|
78
78
|
return /display\s*:/i.test(e) || (e = e ? `${e}; display: block` : "display: block"), e.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function I(r) {
|
|
82
82
|
return new T().migrate(r);
|
|
83
83
|
}
|
|
84
84
|
export {
|
|
85
|
-
|
|
85
|
+
I as migrateRadioButton
|
|
86
86
|
};
|
|
@@ -2,9 +2,9 @@ var d = Object.defineProperty;
|
|
|
2
2
|
var l = (r, n, e) => n in r ? d(r, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[n] = e;
|
|
3
3
|
var o = (r, n, e) => l(r, typeof n != "symbol" ? n + "" : n, e);
|
|
4
4
|
import { useHttp as L } from "../../../composables/useHttp.js";
|
|
5
|
-
import { DEFAULT_UNSUBSCRIBE_GROUP as
|
|
5
|
+
import { DEFAULT_UNSUBSCRIBE_GROUP as c } from "../../../enums/unsubscribe.js";
|
|
6
6
|
import { Control as h, UIElementType as i, UEAttr as t, ModificationDescription as p } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
-
const m = "ui-elements-checkbox",
|
|
7
|
+
const m = "ui-elements-checkbox", u = "select", { get: C } = L();
|
|
8
8
|
class S extends h {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
@@ -16,14 +16,15 @@ class S extends h {
|
|
|
16
16
|
return m;
|
|
17
17
|
}
|
|
18
18
|
_setFormValues() {
|
|
19
|
-
if (this.currentNode && "getAttribute" in this.currentNode) {
|
|
19
|
+
if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
|
|
20
20
|
const e = this.currentNode.getAttribute("id");
|
|
21
21
|
if (e) {
|
|
22
|
-
const s = e ===
|
|
23
|
-
s && (this.selectedUnsubGroup = s
|
|
24
|
-
[a]: this.selectedUnsubGroup
|
|
25
|
-
}));
|
|
22
|
+
const s = e === c.sendGridId ? e : Number(e);
|
|
23
|
+
s && (this.selectedUnsubGroup = s);
|
|
26
24
|
}
|
|
25
|
+
this.api.updateValues({
|
|
26
|
+
[u]: this.selectedUnsubGroup
|
|
27
|
+
});
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
_getLabel(e, s = `${Math.random()}`) {
|
|
@@ -54,7 +55,7 @@ class S extends h {
|
|
|
54
55
|
</${i.LABEL}>
|
|
55
56
|
|
|
56
57
|
<${i.SELECTPICKER}
|
|
57
|
-
${t.SELECTPICKER.name}="${
|
|
58
|
+
${t.SELECTPICKER.name}="${u}"
|
|
58
59
|
${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
|
|
59
60
|
${this._getSelect()}
|
|
60
61
|
</${i.SELECTPICKER}>
|
|
@@ -66,21 +67,21 @@ class S extends h {
|
|
|
66
67
|
this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new p(`Updated text to ${e}`));
|
|
67
68
|
}
|
|
68
69
|
_listenToFormUpdates() {
|
|
69
|
-
this.api.onValueChanged(
|
|
70
|
+
this.api.onValueChanged(u, (e) => this._onSelectChange(e));
|
|
70
71
|
}
|
|
71
72
|
onTemplateNodeUpdated(e) {
|
|
72
|
-
this.currentNode = e;
|
|
73
|
+
this.currentNode = e, this._setFormValues();
|
|
73
74
|
}
|
|
74
75
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
75
76
|
async onRender() {
|
|
76
77
|
const e = await C(
|
|
77
78
|
"/unsubscribe-groups/unsubscribe-list"
|
|
78
|
-
), s = [
|
|
79
|
-
[t.SELECT_ITEM.text]:
|
|
80
|
-
[t.SELECT_ITEM.value]:
|
|
79
|
+
), s = [c, ...e.data], E = s.map((a) => ({
|
|
80
|
+
[t.SELECT_ITEM.text]: a.name,
|
|
81
|
+
[t.SELECT_ITEM.value]: a.sendGridId
|
|
81
82
|
}));
|
|
82
83
|
this.unsubList = s, this.api.setUIEAttribute(
|
|
83
|
-
|
|
84
|
+
u,
|
|
84
85
|
t.SELECTPICKER.items,
|
|
85
86
|
E
|
|
86
87
|
), this._setFormValues(), this._listenToFormUpdates();
|
|
@@ -2,10 +2,10 @@ var d = Object.defineProperty;
|
|
|
2
2
|
var l = (r, n, t) => n in r ? d(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
|
|
3
3
|
var o = (r, n, t) => l(r, typeof n != "symbol" ? n + "" : n, t);
|
|
4
4
|
import { useHttp as L } from "../../../composables/useHttp.js";
|
|
5
|
-
import { DEFAULT_UNSUBSCRIBE_GROUP as
|
|
5
|
+
import { DEFAULT_UNSUBSCRIBE_GROUP as c } from "../../../enums/unsubscribe.js";
|
|
6
6
|
import { Control as p, UIElementType as i, UEAttr as e, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
-
const m = "ui-elements-radio-button",
|
|
8
|
-
class
|
|
7
|
+
const m = "ui-elements-radio-button", u = "select", { get: $ } = L();
|
|
8
|
+
class S extends p {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
11
|
o(this, "currentNode");
|
|
@@ -16,15 +16,16 @@ class _ extends p {
|
|
|
16
16
|
return m;
|
|
17
17
|
}
|
|
18
18
|
_setFormValues() {
|
|
19
|
-
if (this.currentNode && "getAttribute" in this.currentNode) {
|
|
19
|
+
if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
|
|
20
20
|
const t = this.currentNode.getAttribute("id");
|
|
21
21
|
if (t) {
|
|
22
|
-
const s = t ===
|
|
23
|
-
s && (this.selectedUnsubGroup = s
|
|
24
|
-
[a]: this.selectedUnsubGroup
|
|
25
|
-
}));
|
|
22
|
+
const s = t === c.sendGridId ? t : Number(t);
|
|
23
|
+
s && (this.selectedUnsubGroup = s);
|
|
26
24
|
}
|
|
27
25
|
}
|
|
26
|
+
this.api.updateValues({
|
|
27
|
+
[u]: this.selectedUnsubGroup
|
|
28
|
+
});
|
|
28
29
|
}
|
|
29
30
|
_getLabel(t, s = `${Math.random()}`) {
|
|
30
31
|
return `
|
|
@@ -54,7 +55,7 @@ class _ extends p {
|
|
|
54
55
|
</${i.LABEL}>
|
|
55
56
|
|
|
56
57
|
<${i.SELECTPICKER}
|
|
57
|
-
${e.SELECTPICKER.name}="${
|
|
58
|
+
${e.SELECTPICKER.name}="${u}"
|
|
58
59
|
${e.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
|
|
59
60
|
${this._getSelect()}
|
|
60
61
|
</${i.SELECTPICKER}>
|
|
@@ -66,27 +67,27 @@ class _ extends p {
|
|
|
66
67
|
this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", t.toString()).apply(new h(`Updated text to ${t}`));
|
|
67
68
|
}
|
|
68
69
|
_listenToFormUpdates() {
|
|
69
|
-
this.api.onValueChanged(
|
|
70
|
+
this.api.onValueChanged(u, (t) => this._onSelectChange(t));
|
|
70
71
|
}
|
|
71
72
|
onTemplateNodeUpdated(t) {
|
|
72
|
-
this.currentNode = t;
|
|
73
|
+
this.currentNode = t, this._setFormValues();
|
|
73
74
|
}
|
|
74
75
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
75
76
|
async onRender() {
|
|
76
77
|
const t = await $(
|
|
77
78
|
"/unsubscribe-groups/unsubscribe-list"
|
|
78
|
-
), s = [
|
|
79
|
-
[e.SELECT_ITEM.text]:
|
|
80
|
-
[e.SELECT_ITEM.value]:
|
|
79
|
+
), s = [c, ...t.data], E = s.map((a) => ({
|
|
80
|
+
[e.SELECT_ITEM.text]: a.name,
|
|
81
|
+
[e.SELECT_ITEM.value]: a.sendGridId
|
|
81
82
|
}));
|
|
82
83
|
this.unsubList = s, this.api.setUIEAttribute(
|
|
83
|
-
|
|
84
|
+
u,
|
|
84
85
|
e.SELECTPICKER.items,
|
|
85
|
-
|
|
86
|
+
E
|
|
86
87
|
), this._setFormValues(), this._listenToFormUpdates();
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
export {
|
|
90
91
|
m as CONTROL_BLOCK_ID,
|
|
91
|
-
|
|
92
|
+
S as RadioButtonControl
|
|
92
93
|
};
|
|
@@ -4,7 +4,7 @@ const e = {
|
|
|
4
4
|
DESCRIPTION: "This is a description text",
|
|
5
5
|
YES: "Yes",
|
|
6
6
|
NO: "No"
|
|
7
|
-
},
|
|
7
|
+
}, i = `
|
|
8
8
|
<td align="left" class="radio-button-v2 esd-block-radio es-p10t es-p10b es-p30r es-p30l">
|
|
9
9
|
<table cellpadding="0" cellspacing="0" role="presentation" width="100%">
|
|
10
10
|
<tbody>
|
|
@@ -32,7 +32,7 @@ const e = {
|
|
|
32
32
|
<input
|
|
33
33
|
type="radio"
|
|
34
34
|
id="radioYes"
|
|
35
|
-
name="unsubscribe"
|
|
35
|
+
name="unsubscribe-{BLOCK_ID}"
|
|
36
36
|
data-cke-editable="1"
|
|
37
37
|
style="margin: 0px; vertical-align: middle;">
|
|
38
38
|
</td>
|
|
@@ -53,7 +53,7 @@ const e = {
|
|
|
53
53
|
<input
|
|
54
54
|
type="radio"
|
|
55
55
|
id="radioNo"
|
|
56
|
-
name="unsubscribe"
|
|
56
|
+
name="unsubscribe-{BLOCK_ID}"
|
|
57
57
|
data-cke-editable="1"
|
|
58
58
|
style="margin: 0px; vertical-align: middle;">
|
|
59
59
|
</td>
|
|
@@ -108,9 +108,9 @@ const e = {
|
|
|
108
108
|
<input
|
|
109
109
|
type="radio"
|
|
110
110
|
id="radioYes"
|
|
111
|
-
name="unsubscribe"
|
|
111
|
+
name="unsubscribe-{BLOCK_ID}"
|
|
112
112
|
data-cke-editable="1"
|
|
113
|
-
style="margin: 0px; vertical-align: middle
|
|
113
|
+
style="margin: 0px; vertical-align: middle;">
|
|
114
114
|
</td>
|
|
115
115
|
{-{-YES-}-}
|
|
116
116
|
</tr>
|
|
@@ -123,7 +123,7 @@ const e = {
|
|
|
123
123
|
<input
|
|
124
124
|
type="radio"
|
|
125
125
|
id="radioNo"
|
|
126
|
-
name="unsubscribe"
|
|
126
|
+
name="unsubscribe-{BLOCK_ID}"
|
|
127
127
|
data-cke-editable="1"
|
|
128
128
|
style="margin: 0px; vertical-align: middle;">
|
|
129
129
|
</td>
|
|
@@ -140,10 +140,11 @@ const e = {
|
|
|
140
140
|
</table>
|
|
141
141
|
</td>
|
|
142
142
|
`;
|
|
143
|
-
function
|
|
144
|
-
|
|
143
|
+
function r() {
|
|
144
|
+
const d = `radio-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
145
|
+
return i.replace("{-{-TITLE-}-}", `<p path="1">${e.TITLE}</p>`).replace("{-{-DESCRIPTION-}-}", `<p path="1">${e.DESCRIPTION}</p>`).replace("{-{-YES-}-}", `<p path="1">${e.YES}</p>`).replace("{-{-NO-}-}", `<p path="1">${e.NO}</p>`).replace(/{BLOCK_ID}/g, d);
|
|
145
146
|
}
|
|
146
147
|
export {
|
|
147
148
|
l as default,
|
|
148
|
-
|
|
149
|
+
r as getDefaultTemplate
|
|
149
150
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const migrationTemplate = "\n <td \n align=\"left\" \n esd-extension-block-id=\"radio-button-block\" \n esd-handler-name=\"esd-extension-RadioButtonBlock\"\n class=\"radio-button-v2 esd-block-ra esd-radio-button-block esd-extension-block es-p10t es-p10b es-p30r es-p30l\"\n >\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" width=\"70%\" style=\"vertical-align: top;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n {-{-TITLE-}-}\n </tr>\n <tr>\n {-{-DESCRIPTION-}-}\n </tr>\n </tbody>\n </table>\n </td>\n <td align=\"right\" width=\"30%\" style=\"vertical-align: middle;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioYes\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle
|
|
1
|
+
declare const migrationTemplate = "\n <td \n align=\"left\" \n esd-extension-block-id=\"radio-button-block\" \n esd-handler-name=\"esd-extension-RadioButtonBlock\"\n class=\"radio-button-v2 esd-block-ra esd-radio-button-block esd-extension-block es-p10t es-p10b es-p30r es-p30l\"\n >\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" width=\"70%\" style=\"vertical-align: top;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n {-{-TITLE-}-}\n </tr>\n <tr>\n {-{-DESCRIPTION-}-}\n </tr>\n </tbody>\n </table>\n </td>\n <td align=\"right\" width=\"30%\" style=\"vertical-align: middle;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioYes\"\n name=\"unsubscribe-{BLOCK_ID}\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-YES-}-}\n </tr>\n </table>\n </td>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioNo\"\n name=\"unsubscribe-{BLOCK_ID}\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-NO-}-}\n </tr>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n";
|
|
2
2
|
/**
|
|
3
3
|
* @returns The template for the default checkbox block
|
|
4
4
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "1.0.3-beta.
|
|
3
|
+
"version": "1.0.3-beta.9440b5f",
|
|
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",
|