@useinsider/guido 1.0.2-beta.585f2fc → 1.0.2-beta.69b86db

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,92 +1,92 @@
1
1
  import { useConfig as H } from "./useConfig.js";
2
2
  import { TemplateTypes as V } from "../enums/defaults.js";
3
- import { DISPLAY_CONDITIONS_REGEX as D, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as P, CampaignCouldNotBeSavedKey as R, CanNotMakeAnyChangesForRunningKey as _ } from "../enums/html-validator.js";
3
+ import { DISPLAY_CONDITIONS_REGEX as B, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as _, CampaignCouldNotBeSavedKey as D, CanNotMakeAnyChangesForRunningKey as P } from "../enums/html-validator.js";
4
4
  import { ToasterTypeOptions as l } from "../enums/toaster.js";
5
- import { useRecommendationStore as G } from "../stores/recommendation.js";
5
+ import { useRecommendationStore as R } from "../stores/recommendation.js";
6
6
  import { base64EncodeWithSpecialChars as $ } from "../utils/base64.js";
7
7
  import { useHttp as j } from "./useHttp.js";
8
- import { useToaster as q } from "./useToaster.js";
9
- import { useTranslations as M } from "./useTranslations.js";
10
- const se = () => {
8
+ import { useToaster as G } from "./useToaster.js";
9
+ import { useTranslations as X } from "./useTranslations.js";
10
+ const te = () => {
11
11
  var d;
12
- const { showToaster: c } = q(), { post: y } = j(), { config: h } = H(), a = M(), m = G(), u = ((d = h.partner) == null ? void 0 : d.messageType) === V.transactional, v = async (e) => {
12
+ const { showToaster: c } = G(), { post: y } = j(), { config: h } = H(), o = X(), m = R(), u = ((d = h.partner) == null ? void 0 : d.messageType) === V.transactional, C = async (e) => {
13
13
  const t = await y(
14
14
  "/newsletter/template-library/check-template-html-body",
15
15
  { html: $(e) }
16
- ), { status: n, message: r } = t.data;
16
+ ), { status: n, message: a } = t.data;
17
17
  return n || c({
18
18
  type: l.Alert,
19
- message: n === void 0 ? r : a("newsletter.invalid-url-link-for-toaster")
20
- }), a(R), r === a(_) && c({
19
+ message: n === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
20
+ }), o(D), a === o(P) && c({
21
21
  type: l.Alert,
22
- message: a("newsletter.already-in-progress")
22
+ message: o("newsletter.already-in-progress")
23
23
  }), n;
24
- }, C = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), w = (e) => ["if", "endif"].includes(e.toLowerCase()), S = (e, s) => {
24
+ }, v = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), w = (e) => ["if", "endif"].includes(e.toLowerCase()), S = (e, s) => {
25
25
  const t = e.match(/({%(.*?)%})/g);
26
26
  let n = !0;
27
- return t !== null && !u && t.forEach((r) => {
28
- const o = r.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
29
- if (o && o.length > 0) {
30
- const [i] = o;
31
- C(i) && !s.includes(i) && (c({
27
+ return t !== null && !u && t.forEach((a) => {
28
+ const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
29
+ if (i && i.length > 0) {
30
+ const [r] = i;
31
+ v(r) && !s.includes(r) && (c({
32
32
  type: l.Warning,
33
- message: a("custom-fields.invalid-custom-fields")
33
+ message: o("custom-fields.invalid-custom-fields")
34
34
  }), n = !1);
35
35
  }
36
36
  }), n;
37
37
  }, b = async (e, s, t) => {
38
- const n = t ? await v(e) : !0;
38
+ const n = t ? await C(e) : !0;
39
39
  return S(e, s) && n;
40
40
  }, E = (e) => e.length > 0 ? !0 : (c({
41
41
  type: l.Warning,
42
- message: a("newsletter.html-content-is-empty")
42
+ message: o("newsletter.html-content-is-empty")
43
43
  }), !1), A = (e) => {
44
44
  const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
45
45
  return s > t && c({
46
46
  type: l.Warning,
47
- message: a("custom-fields.missing-closing-braces")
47
+ message: o("custom-fields.missing-closing-braces")
48
48
  }), s < t && c({
49
49
  type: l.Warning,
50
- message: a("custom-fields.missing-opening-braces")
50
+ message: o("custom-fields.missing-opening-braces")
51
51
  }), s === t;
52
52
  }, x = (e) => {
53
53
  const s = e.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
54
54
  return s || c({
55
55
  type: l.Warning,
56
- message: a("custom-fields.invalid-custom-fields")
56
+ message: o("custom-fields.invalid-custom-fields")
57
57
  }), s;
58
- }, k = (e, s) => {
58
+ }, T = (e, s) => {
59
59
  const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
60
60
  if (t && !u) {
61
- const n = new Set(s.map((o) => o.toLowerCase())), r = [];
62
- if (t.forEach((o) => {
63
- const i = o.slice(2, -2).trim().toLowerCase();
64
- (!n.has(i) || i === "") && r.push(i);
65
- }), r.length > 0) {
66
- const o = `
61
+ const n = new Set(s.map((i) => i.toLowerCase())), a = [];
62
+ if (t.forEach((i) => {
63
+ const r = i.slice(2, -2).trim().toLowerCase();
64
+ (!n.has(r) || r === "") && a.push(r);
65
+ }), a.length > 0) {
66
+ const i = `
67
67
  <ul>
68
- ${r.map((i) => `<li>${i}</li>`).join("")}
68
+ ${a.map((r) => `<li>${r}</li>`).join("")}
69
69
  </ul>
70
70
  `;
71
71
  return c({
72
72
  type: l.Alert,
73
- message: a("custom-fields.invalid-custom-fields") + o
73
+ message: o("custom-fields.invalid-custom-fields") + i
74
74
  }), !1;
75
75
  }
76
76
  }
77
77
  return !0;
78
- }, T = (e) => {
78
+ }, k = (e) => {
79
79
  const s = e.match(/{%(.*?)%}/g), t = [];
80
80
  let n = !0;
81
- if (s && s.forEach((r) => {
82
- const o = r.match(D), i = r.match(P), B = (o == null ? void 0 : o.join("")) || "";
83
- (!o || r !== B) && !i && (c({
81
+ if (s && s.forEach((a) => {
82
+ const i = a.match(B), r = a.match(_), O = (i == null ? void 0 : i.join("")) || "";
83
+ (!i || a !== O) && !r && (c({
84
84
  type: l.Alert,
85
- message: a("newsletter.display-conditions-invalid-syntax")
86
- }), n = !1), o && o.forEach((f) => {
85
+ message: o("newsletter.display-conditions-invalid-syntax")
86
+ }), n = !1), i && i.forEach((f) => {
87
87
  f.trim() === "=" && (c({
88
88
  type: l.Alert,
89
- message: a("custom-conditions.wrong-equality-operators")
89
+ message: o("custom-conditions.wrong-equality-operators")
90
90
  }), n = !1);
91
91
  const g = f.match(/^[a-zA-Z]*$/g);
92
92
  g && g.forEach((p) => {
@@ -94,10 +94,10 @@ const se = () => {
94
94
  });
95
95
  });
96
96
  }), t.length) {
97
- const r = t.filter((i) => i === "if"), o = t.filter((i) => i === "endif");
98
- r.length !== o.length && (c({
97
+ const a = t.filter((r) => r === "if"), i = t.filter((r) => r === "endif");
98
+ a.length !== i.length && (c({
99
99
  type: l.Alert,
100
- message: a("custom-conditions.missing-if-endif-tag")
100
+ message: o("custom-conditions.missing-if-endif-tag")
101
101
  }), n = !1);
102
102
  }
103
103
  return n;
@@ -105,44 +105,35 @@ const se = () => {
105
105
  const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, n = s === t;
106
106
  return n || c({
107
107
  type: l.Warning,
108
- message: a("custom-conditions.no-space-after-braces")
108
+ message: o("custom-conditions.no-space-after-braces")
109
109
  }), n;
110
110
  }, I = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (c({
111
111
  type: l.Warning,
112
- message: a("custom-conditions.no-braces-inside-if-tag")
112
+ message: o("custom-conditions.no-braces-inside-if-tag")
113
113
  }), !1) : !0, W = () => m.recommendationConfigs && Object.values(m.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (c({
114
114
  type: l.Alert,
115
- message: a("newsletter.fill-all-necessary-fields")
115
+ message: o("newsletter.fill-all-necessary-fields")
116
116
  }), !1) : !0, L = (e) => {
117
117
  const s = /src="[^"]*\.(svg|pst)"/gm;
118
118
  return e.match(s) === null ? !0 : (c({
119
119
  type: l.Alert,
120
- message: a("newsletter.invalid-image-type")
120
+ message: o("newsletter.invalid-image-type")
121
121
  }), !1);
122
122
  }, N = (e) => {
123
123
  const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
124
- return Array.from(n).find((o) => {
125
- var i;
126
- return !((i = o.id) != null && i.trim());
124
+ return Array.from(n).find((i) => {
125
+ var r;
126
+ return !((r = i.id) != null && r.trim());
127
127
  }) ? (c({
128
128
  type: l.Alert,
129
- message: a("unsubscribe-templates.select-checkbox-groups")
130
- }), !1) : !0;
131
- }, O = (e) => {
132
- const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
133
- return Array.from(n).find((o) => {
134
- var i;
135
- return !((i = o.id) != null && i.trim());
136
- }) ? (c({
137
- type: l.Alert,
138
- message: a("unsubscribe-templates.select-radio-button-groups")
129
+ message: o("unsubscribe-templates.select-checkbox-groups")
139
130
  }), !1) : !0;
140
131
  };
141
132
  return { validateHtml: async (e, s, t = !1) => {
142
- const n = s.map((o) => o.value);
143
- return await b(e, n, t) && E(e) && A(e) && x(e) && k(e, n) && T(e) && F(e) && I(e) && W() && L(e) && N(e) && O(e);
133
+ const n = s.map((i) => i.value);
134
+ return await b(e, n, t) && E(e) && A(e) && x(e) && T(e, n) && k(e) && F(e) && I(e) && W() && L(e) && N(e);
144
135
  } };
145
136
  };
146
137
  export {
147
- se as useHtmlValidator
138
+ te as useHtmlValidator
148
139
  };
@@ -1,17 +1,16 @@
1
1
  import { useActionsApi as f } from "./useActionsApi.js";
2
2
  import { useCustomInterfaceAppearance as S } from "./useCustomInterfaceAppearance.js";
3
- import { useStripoEventHandler as E } from "./useStripoEventHandler.js";
4
- import { useToaster as C } from "./useToaster.js";
3
+ import { useStripoEventHandler as C } from "./useStripoEventHandler.js";
4
+ import { useToaster as E } from "./useToaster.js";
5
5
  import { displayConditions as y } from "../enums/displayConditions.js";
6
6
  import h from "../extensions/Blocks/Checkbox/extension.js";
7
- import w from "../extensions/Blocks/RadioButton/extension.js";
8
- import b from "../extensions/DynamicContent/extension.js";
9
- import { useStripoApi as k } from "../services/stripoApi.js";
10
- import B from "../static/styles/customEditorStyle.css.js";
7
+ import w from "../extensions/DynamicContent/extension.js";
8
+ import { useStripoApi as b } from "../services/stripoApi.js";
9
+ import k from "../static/styles/customEditorStyle.css.js";
11
10
  import { useEditorStore as V } from "../stores/editor.js";
12
11
  import { dynamicContentToMergeTags as _ } from "../utils/genericUtil.js";
13
- const q = (s) => {
14
- const { handleError: d } = C(), { getToken: c, getCustomFonts: u } = k(), { handleEvent: l } = E(), m = (r, i = []) => {
12
+ const H = (s) => {
13
+ const { handleError: d } = E(), { getToken: c, getCustomFonts: u } = b(), { handleEvent: l } = C(), m = (r, i = []) => {
15
14
  const o = V(), { html: e, css: a, forceRecreate: g } = r;
16
15
  window.UIEditor.initEditor(
17
16
  document.querySelector("#guido-editor"),
@@ -29,7 +28,7 @@ const q = (s) => {
29
28
  customAppearanceMergetags: !0,
30
29
  customAppearanceMergetagsBorderColor: "#f1f3fe",
31
30
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
32
- customViewStyles: B,
31
+ customViewStyles: k,
33
32
  conditionsEnabled: !0,
34
33
  customConditionsEnabled: !0,
35
34
  conditionCategories: y,
@@ -78,11 +77,7 @@ const q = (s) => {
78
77
  },
79
78
  onEvent: l,
80
79
  ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal", ".in-on-board-wrapper"],
81
- extensions: [
82
- b,
83
- h,
84
- w
85
- ]
80
+ extensions: [w, h]
86
81
  }
87
82
  );
88
83
  }, p = (r) => new Promise((i, o) => {
@@ -106,5 +101,5 @@ const q = (s) => {
106
101
  } };
107
102
  };
108
103
  export {
109
- q as useStripo
104
+ H as useStripo
110
105
  };
@@ -1,9 +1,5 @@
1
- import { migrateCheckbox as o } from "./checkboxMigrator.js";
2
- import { migrateRadioButton as e } from "./radioButtonMigrator.js";
3
- const a = (r) => {
4
- let t = r;
5
- return t = o(r), t = e(r), t;
6
- };
1
+ import { migrateCheckbox as r } from "./checkboxMigrator.js";
2
+ const e = (o) => r(o);
7
3
  export {
8
- a as migrate
4
+ e as migrate
9
5
  };
@@ -1,3 +1,8 @@
1
1
  import type { DynamicContent, MergeTag } from '@@/Types/generic';
2
2
  export declare const dynamicContentToMergeTags: (dynamicContentList: DynamicContent[]) => MergeTag[];
3
3
  export declare const getCsrfToken: () => string;
4
+ /**
5
+ * URL Parameter utilities
6
+ */
7
+ export declare const getUrlParams: () => URLSearchParams;
8
+ export declare const getUrlParam: (paramName: string, defaultValue?: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.0.2-beta.585f2fc",
3
+ "version": "1.0.2-beta.69b86db",
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",
@@ -1 +0,0 @@
1
- export declare function migrateRadioButton(html: string): string;
@@ -1,86 +0,0 @@
1
- var b = Object.defineProperty;
2
- var f = (r, t, e) => t in r ? b(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var x = (r, t, e) => f(r, typeof t != "symbol" ? t + "" : t, e);
4
- import h from "../../extensions/Blocks/RadioButton/template.js";
5
- class T {
6
- constructor() {
7
- x(this, "parser");
8
- this.parser = new DOMParser();
9
- }
10
- migrate(t) {
11
- try {
12
- const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.radio-button-block");
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"), 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
- `<table id="tempDoc"><tbody><tr>${c}</tr></tbody></table>`,
16
- "text/html"
17
- ).querySelector(".radio-button-v2");
18
- y && s.parentNode && (y.setAttribute("id", o || ""), s.parentNode.replaceChild(y, s));
19
- }), e.documentElement.outerHTML);
20
- } catch (e) {
21
- return console.error("RadioButtonMigrator failed:", e), t;
22
- }
23
- }
24
- extractTextFromElement(t, e) {
25
- var n, c;
26
- const i = t.querySelector(`.${e}`);
27
- if (!i)
28
- return {
29
- text: e === "ins-title" ? "Title" : "Description",
30
- isBold: !1,
31
- isItalic: !1,
32
- align: "left",
33
- styles: "",
34
- classList: ""
35
- };
36
- const s = i.querySelector("p");
37
- if (!s)
38
- return {
39
- text: ((n = i.textContent) == null ? void 0 : n.trim()) || (e === "ins-title" ? "Title" : "Description"),
40
- isBold: !1,
41
- isItalic: !1,
42
- align: i.getAttribute("align") || "left",
43
- styles: "",
44
- classList: ""
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"), d = this.removeStyleProperties(l, ["font-weight", "font-style"]), g = this.convertInlineToBlock(d), m = i.getAttribute("class") || "";
47
- return {
48
- text: o,
49
- isBold: p,
50
- isItalic: u,
51
- align: a,
52
- styles: g,
53
- classList: m
54
- };
55
- }
56
- buildTextBlock(t) {
57
- let e = t.text;
58
- t.isBold && t.isItalic ? e = `<strong path="1,0"><em path="1,0,0">${e}</em></strong>` : t.isBold ? e = `<strong path="1,0">${e}</strong>` : t.isItalic && (e = `<em path="1,0">${e}</em>`);
59
- const i = t.align ? ` align="${t.align}"` : "", s = t.styles ? ` style="${t.styles.replaceAll('"', "'")}"` : "";
60
- return `
61
- <td class="esd-block-text ${t.classList}" ${i}>
62
- <p path="1" ${s}>
63
- ${e}
64
- </p>
65
- </td>
66
- `;
67
- }
68
- removeStyleProperties(t, e) {
69
- return t ? e.reduce((s, o) => {
70
- const l = new RegExp(`${o}\\s*:\\s*[^;]*;?`, "gi");
71
- return s.replace(l, "");
72
- }, t).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
73
- }
74
- convertInlineToBlock(t) {
75
- if (!t)
76
- return "";
77
- let e = t.replace(/display\s*:\s*inline/gi, "display: block");
78
- return /display\s*:/i.test(e) || (e = e ? `${e}; display: block` : "display: block"), e.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
79
- }
80
- }
81
- function A(r) {
82
- return new T().migrate(r);
83
- }
84
- export {
85
- A as migrateRadioButton
86
- };
@@ -1,10 +0,0 @@
1
- import { Block, BlockCompositionType } from '@stripoinc/ui-editor-extensions';
2
- export declare const BLOCK_ID = "radio-button-block";
3
- export declare class RadioButtonCustomBlock extends Block {
4
- getId(): string;
5
- getIcon(): string;
6
- getBlockCompositionType(): BlockCompositionType;
7
- getName(): string;
8
- getDescription(): string;
9
- getTemplate(): string;
10
- }
@@ -1,39 +0,0 @@
1
- import { Block as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/blocks/Block.js";
2
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js";
3
- import { BlockCompositionType as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js";
4
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockName.js";
5
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js";
6
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js";
7
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js";
8
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js";
9
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js";
10
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/Popover.js";
11
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js";
12
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js";
13
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js";
14
- import { getDefaultTemplate as r } from "./template.js";
15
- const i = "radio-button-block";
16
- class D extends t {
17
- getId() {
18
- return i;
19
- }
20
- getIcon() {
21
- return "circle";
22
- }
23
- getBlockCompositionType() {
24
- return o.BLOCK;
25
- }
26
- getName() {
27
- return this.api.translate("Radio Button Block");
28
- }
29
- getDescription() {
30
- return this.api.translate("Radio Button Block Description");
31
- }
32
- getTemplate() {
33
- return r();
34
- }
35
- }
36
- export {
37
- i as BLOCK_ID,
38
- D as RadioButtonCustomBlock
39
- };
@@ -1,17 +0,0 @@
1
- import { Control, ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
- export declare const CONTROL_BLOCK_ID = "ui-elements-radio-button";
3
- export declare class RadioButtonControl extends Control {
4
- private currentNode?;
5
- private selectedUnsubGroup?;
6
- private unsubList;
7
- getId(): string;
8
- _setFormValues(): void;
9
- _getLabel(text: string, name?: string): string;
10
- _getSelectItem(text: string, value: string): string;
11
- _getSelect(): string;
12
- getTemplate(): string;
13
- _onSelectChange(value: string | number): void;
14
- _listenToFormUpdates(): void;
15
- onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
16
- onRender(): Promise<void>;
17
- }
@@ -1,104 +0,0 @@
1
- var E = Object.defineProperty;
2
- var p = (o, i, t) => i in o ? E(o, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[i] = t;
3
- var a = (o, i, t) => p(o, typeof i != "symbol" ? i + "" : i, t);
4
- import { useHttp as m } from "../../../composables/useHttp.js";
5
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js";
6
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js";
7
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockName.js";
8
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js";
9
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js";
10
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js";
11
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js";
12
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js";
13
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/Popover.js";
14
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js";
15
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js";
16
- import { UEAttr as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementsAttributes.js";
17
- import { UIElementType as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js";
18
- import { Control as c } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/controls/Control.js";
19
- import { ModificationDescription as d } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/modifications/ModificationDescription.js";
20
- const l = "ui-elements-radio-button", n = "select", { get: L } = m();
21
- class R extends c {
22
- constructor() {
23
- super(...arguments);
24
- a(this, "currentNode");
25
- a(this, "selectedUnsubGroup");
26
- a(this, "unsubList", []);
27
- }
28
- getId() {
29
- return l;
30
- }
31
- _setFormValues() {
32
- this.api.updateValues({
33
- [n]: ""
34
- });
35
- }
36
- _getLabel(t, s = `${Math.random()}`) {
37
- return `
38
- <${r.LABEL}
39
- ${e.LABEL.text}="${t}"
40
- ${e.LABEL.name}="${s}">
41
- </${r.LABEL}>
42
- `;
43
- }
44
- _getSelectItem(t, s) {
45
- return `
46
- <${r.SELECT_ITEM}
47
- ${e.SELECT_ITEM.text}="${t}"
48
- ${e.SELECT_ITEM.value}="${s}">
49
- </${r.SELECT_ITEM}>`;
50
- }
51
- _getSelect() {
52
- return this.unsubList.map((t) => this._getSelectItem(t.name, t.sendGridId)).join("");
53
- }
54
- getTemplate() {
55
- return `
56
- <div class="checkbox-controls-container">
57
- <div class="checkbox-select-container container two-columns stretch">
58
- <${r.LABEL}
59
- ${e.LABEL.text}="${this.api.translate("Unsubscribe Group")}"
60
- ${e.LABEL.name}="${Math.random()}">
61
- </${r.LABEL}>
62
-
63
- <${r.SELECTPICKER}
64
- ${e.SELECTPICKER.name}="${n}"
65
- ${e.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
66
- ${this._getSelect()}
67
- </${r.SELECTPICKER}>
68
- </div>
69
- </div>
70
- `;
71
- }
72
- _onSelectChange(t) {
73
- this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", t.toString()).apply(new d(`Updated text to ${t}`));
74
- }
75
- _listenToFormUpdates() {
76
- this.api.onValueChanged(n, (t) => this._onSelectChange(t));
77
- }
78
- onTemplateNodeUpdated(t) {
79
- if (this.currentNode = t, "getAttribute" in t) {
80
- const s = Number(t.getAttribute("id"));
81
- s && (this.selectedUnsubGroup = s, this.api.updateValues({
82
- [n]: this.selectedUnsubGroup
83
- }));
84
- }
85
- }
86
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
87
- async onRender() {
88
- const t = await L(
89
- "/unsubscribe-groups/unsubscribe-list"
90
- ), s = t.data.map((u) => ({
91
- [e.SELECT_ITEM.text]: u.name,
92
- [e.SELECT_ITEM.value]: u.sendGridId
93
- }));
94
- this.unsubList = t.data, this.api.setUIEAttribute(
95
- n,
96
- e.SELECTPICKER.items,
97
- s
98
- ), this._setFormValues(), this._listenToFormUpdates();
99
- }
100
- }
101
- export {
102
- l as CONTROL_BLOCK_ID,
103
- R as RadioButtonControl
104
- };
@@ -1,2 +0,0 @@
1
- declare const _default: import("@stripoinc/ui-editor-extensions").Extension;
2
- export default _default;
@@ -1,20 +0,0 @@
1
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js";
2
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js";
3
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockName.js";
4
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js";
5
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js";
6
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js";
7
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js";
8
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js";
9
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/Popover.js";
10
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js";
11
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js";
12
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js";
13
- import { ExtensionBuilder as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/ExtensionBuilder.js";
14
- import { RadioButtonCustomBlock as t } from "./block.js";
15
- import { RadioButtonControl as i } from "./control.js";
16
- import { RadioButtonBlockSettingsPanel as r } from "./settingsPanel.js";
17
- const C = new o().addBlock(t).withSettingsPanelRegistry(r).addControl(i).build();
18
- export {
19
- C as default
20
- };
@@ -1,4 +0,0 @@
1
- import { SettingsPanelRegistry, SettingsPanelTab } from '@stripoinc/ui-editor-extensions';
2
- export declare class RadioButtonBlockSettingsPanel extends SettingsPanelRegistry {
3
- registerBlockControls(blockControlsMap: Record<string, SettingsPanelTab[]>): void;
4
- }
@@ -1,39 +0,0 @@
1
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js";
2
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js";
3
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockName.js";
4
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js";
5
- import { ContainerControls as t, TextControls as m } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js";
6
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js";
7
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js";
8
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js";
9
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/Popover.js";
10
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js";
11
- import { SettingsTab as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js";
12
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js";
13
- import { SettingsPanelRegistry as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelRegistry.js";
14
- import { SettingsPanelTab as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelTab.js";
15
- import { BLOCK_ID as p } from "./block.js";
16
- import { CONTROL_BLOCK_ID as n } from "./control.js";
17
- class K extends e {
18
- registerBlockControls(i) {
19
- i[p] = [
20
- new r(
21
- o.SETTINGS,
22
- [
23
- n,
24
- t.EXTERNAL_INDENTS,
25
- t.DISPLAY_CONDITIONS
26
- ]
27
- ),
28
- new r(
29
- o.STYLES,
30
- [
31
- m.TEXT_BLOCK_BACKGROUND_COLOR
32
- ]
33
- )
34
- ];
35
- }
36
- }
37
- export {
38
- K as RadioButtonBlockSettingsPanel
39
- };
@@ -1,6 +0,0 @@
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
- /**
3
- * @returns The template for the default checkbox block
4
- */
5
- export declare function getDefaultTemplate(): string;
6
- export default migrationTemplate;
@@ -1,160 +0,0 @@
1
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js";
2
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js";
3
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockName.js";
4
- import { BlockType as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js";
5
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js";
6
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js";
7
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js";
8
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js";
9
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/Popover.js";
10
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js";
11
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js";
12
- import "../../../node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js";
13
- const e = {
14
- TITLE: "This is a title text",
15
- DESCRIPTION: "This is a description text",
16
- YES: "Yes",
17
- NO: "No"
18
- }, i = `
19
- <td align="left" class="radio-button-v2 esd-block-radio es-p10t es-p10b es-p30r es-p30l">
20
- <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
21
- <tbody>
22
- <tr>
23
- <td align="left" width="70%" style="vertical-align: top;">
24
- <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
25
- <tbody>
26
- <${t.BLOCK_TEXT}>
27
- {-{-TITLE-}-}
28
- </${t.BLOCK_TEXT}>
29
- <${t.BLOCK_TEXT}>
30
- {-{-DESCRIPTION-}-}
31
- </${t.BLOCK_TEXT}>
32
- </tbody>
33
- </table>
34
- </td>
35
- <td align="right" width="30%" style="vertical-align: middle;">
36
- <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
37
- <tbody>
38
- <tr>
39
- <td width="50%">
40
- <table width="100%">
41
- <tr>
42
- <td width="24">
43
- <input
44
- type="radio"
45
- id="radioYes"
46
- name="unsubscribe"
47
- data-cke-editable="1"
48
- style="margin: 0px; vertical-align: middle;">
49
- </td>
50
- <td style="padding-right: 15px;">
51
- <table width="100%">
52
- <${t.BLOCK_TEXT}>
53
- {-{-YES-}-}
54
- </${t.BLOCK_TEXT}>
55
- </table>
56
- </td>
57
- </tr>
58
- </table>
59
- </td>
60
- <td width="50%">
61
- <table width="100%">
62
- <tr>
63
- <td width="24">
64
- <input
65
- type="radio"
66
- id="radioNo"
67
- name="unsubscribe"
68
- data-cke-editable="1"
69
- style="margin: 0px; vertical-align: middle;">
70
- </td>
71
- <td style="padding-right: 15px;">
72
- <table width="100%">
73
- <${t.BLOCK_TEXT}>
74
- {-{-NO-}-}
75
- </${t.BLOCK_TEXT}>
76
- </table>
77
- </td>
78
- </tr>
79
- </table>
80
- </td>
81
- </tr>
82
- </tbody>
83
- </table>
84
- </td>
85
- </tr>
86
- </tbody>
87
- </table>
88
- </td>
89
- `, h = `
90
- <td
91
- align="left"
92
- esd-extension-block-id="radio-button-block"
93
- esd-handler-name="esd-extension-RadioButtonBlock"
94
- class="radio-button-v2 esd-block-ra esd-radio-button-block esd-extension-block es-p10t es-p10b es-p30r es-p30l"
95
- >
96
- <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
97
- <tbody>
98
- <tr>
99
- <td align="left" width="70%" style="vertical-align: top;">
100
- <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
101
- <tbody>
102
- <tr>
103
- {-{-TITLE-}-}
104
- </tr>
105
- <tr>
106
- {-{-DESCRIPTION-}-}
107
- </tr>
108
- </tbody>
109
- </table>
110
- </td>
111
- <td align="right" width="30%" style="vertical-align: middle;">
112
- <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
113
- <tbody>
114
- <tr>
115
- <td width="50%">
116
- <table width="100%">
117
- <tr>
118
- <td width="24">
119
- <input
120
- type="radio"
121
- id="radioYes"
122
- name="unsubscribe"
123
- data-cke-editable="1"
124
- style="margin: 0px; vertical-align: middle;>
125
- </td>
126
- {-{-YES-}-}
127
- </tr>
128
- </table>
129
- </td>
130
- <td width="50%">
131
- <table width="100%">
132
- <tr>
133
- <td width="24">
134
- <input
135
- type="radio"
136
- id="radioNo"
137
- name="unsubscribe"
138
- data-cke-editable="1"
139
- style="margin: 0px; vertical-align: middle;">
140
- </td>
141
- {-{-NO-}-}
142
- </tr>
143
- </table>
144
- </td>
145
- </tr>
146
- </tbody>
147
- </table>
148
- </td>
149
- </tr>
150
- </tbody>
151
- </table>
152
- </td>
153
- `;
154
- function m() {
155
- 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>`);
156
- }
157
- export {
158
- h as default,
159
- m as getDefaultTemplate
160
- };