@useinsider/guido 1.0.3-beta.5faf575 → 1.0.3-beta.6080fe3

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.
@@ -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"), 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(
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"), d = this.buildTextBlock(l), g = this.buildTextBlock(a), m = this.buildTextBlock({ ...p, classList: "" }), n = this.buildTextBlock({ ...u, classList: "" }), c = h.replace("{-{-TITLE-}-}", d).replace("{-{-DESCRIPTION-}-}", g).replace("{-{-YES-}-}", m).replace("{-{-NO-}-}", n), 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"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), d = this.convertInlineToBlock(g), m = i.getAttribute("class") || "";
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"), d = this.removeStyleProperties(l, ["font-weight", "font-style"]), g = this.convertInlineToBlock(d), 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: d,
52
+ styles: g,
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 I(r) {
81
+ function A(r) {
82
82
  return new T().migrate(r);
83
83
  }
84
84
  export {
85
- I as migrateRadioButton
85
+ A 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 c } from "../../../enums/unsubscribe.js";
5
+ import { DEFAULT_UNSUBSCRIBE_GROUP as u } 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", u = "select", { get: C } = L();
7
+ const m = "ui-elements-checkbox", a = "select", { get: C } = L();
8
8
  class S extends h {
9
9
  constructor() {
10
10
  super(...arguments);
@@ -16,15 +16,14 @@ class S extends h {
16
16
  return m;
17
17
  }
18
18
  _setFormValues() {
19
- if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
19
+ if (this.currentNode && "getAttribute" in this.currentNode) {
20
20
  const e = this.currentNode.getAttribute("id");
21
21
  if (e) {
22
- const s = e === c.sendGridId ? e : Number(e);
23
- s && (this.selectedUnsubGroup = s);
22
+ const s = e === u.sendGridId ? e : Number(e);
23
+ s && (this.selectedUnsubGroup = s, this.api.updateValues({
24
+ [a]: this.selectedUnsubGroup
25
+ }));
24
26
  }
25
- this.api.updateValues({
26
- [u]: this.selectedUnsubGroup
27
- });
28
27
  }
29
28
  }
30
29
  _getLabel(e, s = `${Math.random()}`) {
@@ -55,7 +54,7 @@ class S extends h {
55
54
  </${i.LABEL}>
56
55
 
57
56
  <${i.SELECTPICKER}
58
- ${t.SELECTPICKER.name}="${u}"
57
+ ${t.SELECTPICKER.name}="${a}"
59
58
  ${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
60
59
  ${this._getSelect()}
61
60
  </${i.SELECTPICKER}>
@@ -67,21 +66,21 @@ class S extends h {
67
66
  this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new p(`Updated text to ${e}`));
68
67
  }
69
68
  _listenToFormUpdates() {
70
- this.api.onValueChanged(u, (e) => this._onSelectChange(e));
69
+ this.api.onValueChanged(a, (e) => this._onSelectChange(e));
71
70
  }
72
71
  onTemplateNodeUpdated(e) {
73
- this.currentNode = e, this._setFormValues();
72
+ this.currentNode = e;
74
73
  }
75
74
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
76
75
  async onRender() {
77
76
  const e = await C(
78
77
  "/unsubscribe-groups/unsubscribe-list"
79
- ), s = [c, ...e.data], E = s.map((a) => ({
80
- [t.SELECT_ITEM.text]: a.name,
81
- [t.SELECT_ITEM.value]: a.sendGridId
78
+ ), s = [u, ...e.data], E = s.map((c) => ({
79
+ [t.SELECT_ITEM.text]: c.name,
80
+ [t.SELECT_ITEM.value]: c.sendGridId
82
81
  }));
83
82
  this.unsubList = s, this.api.setUIEAttribute(
84
- u,
83
+ a,
85
84
  t.SELECTPICKER.items,
86
85
  E
87
86
  ), 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 c } from "../../../enums/unsubscribe.js";
5
+ import { DEFAULT_UNSUBSCRIBE_GROUP as E } 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", u = "select", { get: $ } = L();
8
- class S extends p {
7
+ const m = "ui-elements-radio-button", a = "select", { get: $ } = L();
8
+ class _ extends p {
9
9
  constructor() {
10
10
  super(...arguments);
11
11
  o(this, "currentNode");
@@ -16,16 +16,15 @@ class S extends p {
16
16
  return m;
17
17
  }
18
18
  _setFormValues() {
19
- if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
19
+ if (this.currentNode && "getAttribute" in this.currentNode) {
20
20
  const t = this.currentNode.getAttribute("id");
21
21
  if (t) {
22
- const s = t === c.sendGridId ? t : Number(t);
23
- s && (this.selectedUnsubGroup = s);
22
+ const s = t === E.sendGridId ? t : Number(t);
23
+ s && (this.selectedUnsubGroup = s, this.api.updateValues({
24
+ [a]: this.selectedUnsubGroup
25
+ }));
24
26
  }
25
27
  }
26
- this.api.updateValues({
27
- [u]: this.selectedUnsubGroup
28
- });
29
28
  }
30
29
  _getLabel(t, s = `${Math.random()}`) {
31
30
  return `
@@ -55,7 +54,7 @@ class S extends p {
55
54
  </${i.LABEL}>
56
55
 
57
56
  <${i.SELECTPICKER}
58
- ${e.SELECTPICKER.name}="${u}"
57
+ ${e.SELECTPICKER.name}="${a}"
59
58
  ${e.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
60
59
  ${this._getSelect()}
61
60
  </${i.SELECTPICKER}>
@@ -67,27 +66,27 @@ class S extends p {
67
66
  this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", t.toString()).apply(new h(`Updated text to ${t}`));
68
67
  }
69
68
  _listenToFormUpdates() {
70
- this.api.onValueChanged(u, (t) => this._onSelectChange(t));
69
+ this.api.onValueChanged(a, (t) => this._onSelectChange(t));
71
70
  }
72
71
  onTemplateNodeUpdated(t) {
73
- this.currentNode = t, this._setFormValues();
72
+ this.currentNode = t;
74
73
  }
75
74
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
76
75
  async onRender() {
77
76
  const t = await $(
78
77
  "/unsubscribe-groups/unsubscribe-list"
79
- ), s = [c, ...t.data], E = s.map((a) => ({
80
- [e.SELECT_ITEM.text]: a.name,
81
- [e.SELECT_ITEM.value]: a.sendGridId
78
+ ), s = [E, ...t.data], c = s.map((u) => ({
79
+ [e.SELECT_ITEM.text]: u.name,
80
+ [e.SELECT_ITEM.value]: u.sendGridId
82
81
  }));
83
82
  this.unsubList = s, this.api.setUIEAttribute(
84
- u,
83
+ a,
85
84
  e.SELECTPICKER.items,
86
- E
85
+ c
87
86
  ), this._setFormValues(), this._listenToFormUpdates();
88
87
  }
89
88
  }
90
89
  export {
91
90
  m as CONTROL_BLOCK_ID,
92
- S as RadioButtonControl
91
+ _ as RadioButtonControl
93
92
  };
@@ -4,7 +4,7 @@ const e = {
4
4
  DESCRIPTION: "This is a description text",
5
5
  YES: "Yes",
6
6
  NO: "No"
7
- }, a = `
7
+ }, d = `
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-{BLOCK_ID}"
35
+ name="unsubscribe"
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-{BLOCK_ID}"
56
+ name="unsubscribe"
57
57
  data-cke-editable="1"
58
58
  style="margin: 0px; vertical-align: middle;">
59
59
  </td>
@@ -108,10 +108,9 @@ const e = {
108
108
  <input
109
109
  type="radio"
110
110
  id="radioYes"
111
- name="radio-group"
112
- class="radio-yes"
111
+ name="unsubscribe"
113
112
  data-cke-editable="1"
114
- style="margin: 0px; vertical-align: middle;">
113
+ style="margin: 0px; vertical-align: middle;>
115
114
  </td>
116
115
  {-{-YES-}-}
117
116
  </tr>
@@ -124,8 +123,7 @@ const e = {
124
123
  <input
125
124
  type="radio"
126
125
  id="radioNo"
127
- name="radio-group"
128
- class="radio-no"
126
+ name="unsubscribe"
129
127
  data-cke-editable="1"
130
128
  style="margin: 0px; vertical-align: middle;">
131
129
  </td>
@@ -142,11 +140,10 @@ const e = {
142
140
  </table>
143
141
  </td>
144
142
  `;
145
- function r() {
146
- const d = `radio-group-${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
147
- return a.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>`).replaceAll('name="radio-group"', `name="${d}"`);
143
+ function a() {
144
+ return d.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>`);
148
145
  }
149
146
  export {
150
147
  l as default,
151
- r as getDefaultTemplate
148
+ a as getDefaultTemplate
152
149
  };
@@ -1,6 +1,6 @@
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=\"radio-group\"\n class=\"radio-yes\"\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=\"radio-group\"\n class=\"radio-no\"\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";
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;>\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\"\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
- * @returns The template for the default radio button block with unique name attribute
3
+ * @returns The template for the default checkbox block
4
4
  */
5
5
  export declare function getDefaultTemplate(): string;
6
6
  export default migrationTemplate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.0.3-beta.5faf575",
3
+ "version": "1.0.3-beta.6080fe3",
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",
@@ -44,7 +44,7 @@
44
44
  "@cspell/eslint-plugin": "8.17.5",
45
45
  "@eslint/eslintrc": "3.3.0",
46
46
  "@eslint/js": "8.57.1",
47
- "@playwright/test": "1.55.0",
47
+ "@playwright/test": "1.57.0",
48
48
  "@stylistic/eslint-plugin": "3.1.0",
49
49
  "@stylistic/eslint-plugin-migrate": "3.1.0",
50
50
  "@types/eslint": "8.56.12",