@useinsider/guido 3.14.0-beta.a087424 → 3.14.0-beta.a865e56

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.
Files changed (33) hide show
  1. package/dist/composables/useHtmlValidator.js +91 -89
  2. package/dist/config/migrator/checkboxMigrator.js +20 -19
  3. package/dist/config/migrator/radioButtonMigrator.js +26 -25
  4. package/dist/extensions/Blocks/Checkbox/constants/controlIds.js +4 -0
  5. package/dist/extensions/Blocks/Checkbox/constants/selectors.js +6 -0
  6. package/dist/extensions/Blocks/Checkbox/controls/blockBackground/index.js +10 -0
  7. package/dist/extensions/Blocks/Checkbox/extension.js +6 -5
  8. package/dist/extensions/Blocks/Checkbox/settingsPanel.js +15 -14
  9. package/dist/extensions/Blocks/Checkbox/template.js +10 -9
  10. package/dist/extensions/Blocks/RadioButton/constants/controlIds.js +4 -0
  11. package/dist/extensions/Blocks/RadioButton/constants/selectors.js +6 -0
  12. package/dist/extensions/Blocks/RadioButton/controls/blockBackground/index.js +10 -0
  13. package/dist/extensions/Blocks/RadioButton/extension.js +5 -4
  14. package/dist/extensions/Blocks/RadioButton/settingsPanel.js +12 -11
  15. package/dist/extensions/Blocks/RadioButton/template.js +16 -9
  16. package/dist/extensions/Blocks/controlFactories.js +117 -115
  17. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +12 -12
  18. package/dist/package.json.js +1 -1
  19. package/dist/src/extensions/Blocks/Checkbox/constants/controlIds.d.ts +7 -0
  20. package/dist/src/extensions/Blocks/Checkbox/constants/index.d.ts +10 -0
  21. package/dist/src/extensions/Blocks/Checkbox/constants/selectors.d.ts +16 -0
  22. package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +14 -0
  23. package/dist/src/extensions/Blocks/RadioButton/constants/controlIds.d.ts +7 -0
  24. package/dist/src/extensions/Blocks/RadioButton/constants/index.d.ts +10 -0
  25. package/dist/src/extensions/Blocks/RadioButton/constants/selectors.d.ts +16 -0
  26. package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +14 -0
  27. package/dist/src/extensions/Blocks/_Boilerplate/constants/controlIds.d.ts +7 -0
  28. package/dist/src/extensions/Blocks/_Boilerplate/constants/index.d.ts +10 -0
  29. package/dist/src/extensions/Blocks/_Boilerplate/constants/selectors.d.ts +16 -0
  30. package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +14 -0
  31. package/dist/static/styles/components/wide-panel.css.js +7 -0
  32. package/dist/static/styles/customEditorStyle.css.js +8 -0
  33. package/package.json +3 -3
@@ -1,64 +1,66 @@
1
1
  import { useConfig as W } from "./useConfig.js";
2
2
  import { getIgnoredRecommendationBlockIds as G } from "../config/compiler/utils/recommendationIgnoreUtils.js";
3
3
  import { TemplateTypes as H } from "../enums/defaults.js";
4
- import { DISPLAY_CONDITIONS_REGEX as P, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as X, CampaignCouldNotBeSavedKey as $, CanNotMakeAnyChangesForRunningKey as Y, DATA_ATTRIBUTE_REGEX as U, DYNAMIC_CONTENT_TAG_REGEX as j, ALLOWED_DYNAMIC_SYSTEM_TOKENS as q, VALID_DYNAMIC_VARIABLE_REGEX as K } from "../enums/html-validator.js";
4
+ import { DISPLAY_CONDITIONS_REGEX as P, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as X, CampaignCouldNotBeSavedKey as $, CanNotMakeAnyChangesForRunningKey as K, DATA_ATTRIBUTE_REGEX as Y, DYNAMIC_CONTENT_TAG_REGEX as U, ALLOWED_DYNAMIC_SYSTEM_TOKENS as j, VALID_DYNAMIC_VARIABLE_REGEX as q } from "../enums/html-validator.js";
5
5
  import { ToasterTypeOptions as c } from "../enums/toaster.js";
6
- import { itemsBlockDynamicVariables as z } from "../extensions/Blocks/Items/enums/productEnums.js";
7
- import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as Z } from "../extensions/Blocks/Recommendation/constants/selectors.js";
8
- import { useRecommendationExtensionStore as J } from "../extensions/Blocks/Recommendation/store/recommendation.js";
9
- import { resolveProductAttrValue as Q } from "../extensions/Blocks/Recommendation/templates/utils.js";
10
- import { RecommendationRequiredFieldsKey as ee } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
11
- import { useRecommendationStore as te } from "../stores/recommendation.js";
12
- import { base64EncodeWithSpecialChars as ne } from "../utils/base64.js";
13
- import { useHttp as se } from "./useHttp.js";
14
- import { useToaster as re } from "./useToaster.js";
15
- import { useTranslations as oe } from "./useTranslations.js";
16
- const ie = /recommendation-id="(\d+)"/g;
17
- function ae(t) {
18
- return [...t.matchAll(ie)].map((m) => m[1]);
6
+ import { BLOCK_ROOT_SELECTOR as z } from "../extensions/Blocks/Checkbox/constants/selectors.js";
7
+ import { itemsBlockDynamicVariables as Z } from "../extensions/Blocks/Items/enums/productEnums.js";
8
+ import { BLOCK_ROOT_SELECTOR as J } from "../extensions/Blocks/RadioButton/constants/selectors.js";
9
+ import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as Q } from "../extensions/Blocks/Recommendation/constants/selectors.js";
10
+ import { useRecommendationExtensionStore as ee } from "../extensions/Blocks/Recommendation/store/recommendation.js";
11
+ import { resolveProductAttrValue as te } from "../extensions/Blocks/Recommendation/templates/utils.js";
12
+ import { RecommendationRequiredFieldsKey as ne } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
13
+ import { useRecommendationStore as se } from "../stores/recommendation.js";
14
+ import { base64EncodeWithSpecialChars as re } from "../utils/base64.js";
15
+ import { useHttp as oe } from "./useHttp.js";
16
+ import { useToaster as ie } from "./useToaster.js";
17
+ import { useTranslations as ae } from "./useTranslations.js";
18
+ const ce = /recommendation-id="(\d+)"/g;
19
+ function me(t) {
20
+ return [...t.matchAll(ce)].map((l) => l[1]);
19
21
  }
20
- function ce(t, m) {
21
- return m.some((f) => t.startsWith(`${f}_`));
22
+ function le(t, l) {
23
+ return l.some((f) => t.startsWith(`${f}_`));
22
24
  }
23
- const le = /^(\d+)_\d+_(.+)$/;
24
- function me(t) {
25
- const m = t.match(le);
26
- return m ? { recoId: m[1], attribute: m[2] } : null;
25
+ const ue = /^(\d+)_\d+_(.+)$/;
26
+ function de(t) {
27
+ const l = t.match(ue);
28
+ return l ? { recoId: l[1], attribute: l[2] } : null;
27
29
  }
28
- function ue(t) {
29
- const m = new Set(Z);
30
+ function fe(t) {
31
+ const l = new Set(Q);
30
32
  return Object.values(t).forEach((f) => {
31
- m.add(Q(f.attributeName, t).toLowerCase());
32
- }), m;
33
+ l.add(te(f.attributeName, t).toLowerCase());
34
+ }), l;
33
35
  }
34
- function de(t, m, f, o, d) {
36
+ function pe(t, l, f, o, d) {
35
37
  const u = t.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
36
38
  if (!u)
37
39
  return [];
38
- const p = new Set(m.map((h) => h.toLowerCase())), E = [];
39
- return u.forEach((h) => {
40
- const g = h.slice(2, -2).trim().toLowerCase();
41
- if (g !== "" && p.has(g))
40
+ const g = new Set(l.map((C) => C.toLowerCase())), E = [];
41
+ return u.forEach((C) => {
42
+ const p = C.slice(2, -2).trim().toLowerCase();
43
+ if (p !== "" && g.has(p))
42
44
  return;
43
- const y = me(g);
44
- if (y && o.has(y.recoId)) {
45
- if (!d || d.has(y.attribute))
45
+ const h = de(p);
46
+ if (h && o.has(h.recoId)) {
47
+ if (!d || d.has(h.attribute))
46
48
  return;
47
- E.push(g);
49
+ E.push(p);
48
50
  return;
49
51
  }
50
- ce(g, f) || g.includes(".") || E.push(g);
52
+ le(p, f) || p.includes(".") || E.push(p);
51
53
  }), E;
52
54
  }
53
- function fe(t) {
54
- return (t.replace(U, "$1").match(j) ?? []).filter((o) => {
55
- const d = o.slice(2, -2), u = d.indexOf("|"), p = (u === -1 ? d : d.slice(0, u)).trim();
56
- return q.includes(p) ? !1 : K.test(p) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
55
+ function ge(t) {
56
+ return (t.replace(Y, "$1").match(U) ?? []).filter((o) => {
57
+ const d = o.slice(2, -2), u = d.indexOf("|"), g = (u === -1 ? d : d.slice(0, u)).trim();
58
+ return j.includes(g) ? !1 : q.test(g) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
57
59
  });
58
60
  }
59
- const xe = () => {
60
- var b, S;
61
- const { showToaster: t } = re(), { post: m } = se(), { config: f } = W(), o = oe(), d = te(), u = J(), p = ((S = (b = f.value) == null ? void 0 : b.partner) == null ? void 0 : S.messageType) === H.transactional, E = async (e) => {
61
+ const De = () => {
62
+ var S, T;
63
+ const { showToaster: t } = ie(), { post: l } = oe(), { config: f } = W(), o = ae(), d = se(), u = ee(), g = ((T = (S = f.value) == null ? void 0 : S.partner) == null ? void 0 : T.messageType) === H.transactional, E = async (e) => {
62
64
  if (e.size === 0)
63
65
  return /* @__PURE__ */ new Set();
64
66
  try {
@@ -66,39 +68,39 @@ const xe = () => {
66
68
  } catch {
67
69
  return null;
68
70
  }
69
- return ue(u.filterList);
70
- }, h = async (e) => {
71
- const n = await m(
71
+ return fe(u.filterList);
72
+ }, C = async (e) => {
73
+ const n = await l(
72
74
  "/newsletter/template-library/check-template-html-body",
73
- { html: ne(e) }
75
+ { html: re(e) }
74
76
  ), { status: r, message: a } = n.data;
75
77
  return r || t({
76
78
  type: c.Error,
77
79
  message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
78
- }), o($), a === o(Y) && t({
80
+ }), o($), a === o(K) && t({
79
81
  type: c.Error,
80
82
  message: o("newsletter.already-in-progress")
81
83
  }), r;
82
- }, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()), T = (e, s) => {
84
+ }, p = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), h = (e) => ["if", "endif"].includes(e.toLowerCase()), R = (e, s) => {
83
85
  const n = e.match(/({%(.*?)%})/g);
84
86
  let r = !0;
85
- return n !== null && !p && n.forEach((a) => {
87
+ return n !== null && !g && n.forEach((a) => {
86
88
  const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
87
89
  if (i && i.length > 0) {
88
- const [l] = i;
89
- g(l) && !s.includes(l) && (t({
90
+ const [m] = i;
91
+ p(m) && !s.includes(m) && (t({
90
92
  type: c.Warning,
91
93
  message: o("custom-fields.invalid-custom-fields")
92
94
  }), r = !1);
93
95
  }
94
96
  }), r;
95
- }, w = async (e, s, n) => {
96
- const r = n ? await h(e) : !0;
97
- return T(e, s) && r;
98
- }, R = (e) => e.length > 0 ? !0 : (t({
97
+ }, A = async (e, s, n) => {
98
+ const r = n ? await C(e) : !0;
99
+ return R(e, s) && r;
100
+ }, _ = (e) => e.length > 0 ? !0 : (t({
99
101
  type: c.Warning,
100
102
  message: o("newsletter.html-content-is-empty")
101
- }), !1), _ = (e) => {
103
+ }), !1), O = (e) => {
102
104
  const s = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
103
105
  return s > n && t({
104
106
  type: c.Warning,
@@ -107,26 +109,26 @@ const xe = () => {
107
109
  type: c.Warning,
108
110
  message: o("custom-fields.missing-opening-braces")
109
111
  }), s === n;
110
- }, N = (e) => {
111
- const s = fe(e).length === 0;
112
+ }, w = (e) => {
113
+ const s = ge(e).length === 0;
112
114
  return s || t({
113
115
  type: c.Warning,
114
116
  message: o("custom-fields.invalid-custom-fields")
115
117
  }), s;
116
- }, x = (e, s, n, r) => {
117
- if (p)
118
+ }, N = (e, s, n, r) => {
119
+ if (g)
118
120
  return !0;
119
- const a = de(
121
+ const a = pe(
120
122
  e,
121
123
  s,
122
- ae(e),
124
+ me(e),
123
125
  n,
124
126
  r
125
127
  );
126
128
  if (a.length > 0) {
127
129
  const i = `
128
130
  <ul>
129
- ${a.map((l) => `<li>${l}</li>`).join("")}
131
+ ${a.map((m) => `<li>${m}</li>`).join("")}
130
132
  </ul>
131
133
  `;
132
134
  return t({
@@ -135,85 +137,85 @@ const xe = () => {
135
137
  }), !1;
136
138
  }
137
139
  return !0;
138
- }, O = (e) => {
140
+ }, L = (e) => {
139
141
  const s = e.match(/{%(.*?)%}/g), n = [];
140
142
  let r = !0;
141
143
  if (s && s.forEach((a) => {
142
- const i = a.match(P), l = a.match(X), v = (i == null ? void 0 : i.join("")) || "";
143
- (!i || a !== v) && !l && (t({
144
+ const i = a.match(P), m = a.match(X), v = (i == null ? void 0 : i.join("")) || "";
145
+ (!i || a !== v) && !m && (t({
144
146
  type: c.Error,
145
147
  message: o("newsletter.display-conditions-invalid-syntax")
146
- }), r = !1), i && i.forEach((C) => {
147
- C.trim() === "=" && (t({
148
+ }), r = !1), i && i.forEach((y) => {
149
+ y.trim() === "=" && (t({
148
150
  type: c.Error,
149
151
  message: o("custom-conditions.wrong-equality-operators")
150
152
  }), r = !1);
151
- const I = C.match(/^[a-zA-Z]*$/g);
152
- I && I.forEach((A) => {
153
- y(A) && n.push(A);
153
+ const I = y.match(/^[a-zA-Z]*$/g);
154
+ I && I.forEach((b) => {
155
+ h(b) && n.push(b);
154
156
  });
155
157
  });
156
158
  }), n.length) {
157
- const a = n.filter((l) => l === "if"), i = n.filter((l) => l === "endif");
159
+ const a = n.filter((m) => m === "if"), i = n.filter((m) => m === "endif");
158
160
  a.length !== i.length && (t({
159
161
  type: c.Error,
160
162
  message: o("custom-conditions.missing-if-endif-tag")
161
163
  }), r = !1);
162
164
  }
163
165
  return r;
164
- }, k = (e) => {
166
+ }, B = (e) => {
165
167
  const s = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, r = s === n;
166
168
  return r || t({
167
169
  type: c.Warning,
168
170
  message: o("custom-conditions.no-space-after-braces")
169
171
  }), r;
170
- }, B = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (t({
172
+ }, x = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (t({
171
173
  type: c.Warning,
172
174
  message: o("custom-conditions.no-braces-inside-if-tag")
173
175
  }), !1) : !0, D = () => u.hasInvalidBlock() ? (t({
174
176
  type: c.Error,
175
- message: o(ee)
177
+ message: o(ne)
176
178
  }), !1) : !0, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((s) => s.filters.find((n) => n.value === "")) !== void 0 ? (t({
177
179
  type: c.Error,
178
180
  message: o("newsletter.fill-all-necessary-fields")
179
- }), !1) : !0, L = (e) => {
181
+ }), !1) : !0, k = (e) => {
180
182
  const s = /src="[^"]*\.(svg|pst)"/gm;
181
183
  return e.match(s) === null ? !0 : (t({
182
184
  type: c.Error,
183
185
  message: o("newsletter.invalid-image-type")
184
186
  }), !1);
185
187
  }, V = (e) => {
186
- const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
188
+ const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(z);
187
189
  return Array.from(r).find((i) => {
188
- var l;
189
- return !((l = i.id) != null && l.trim());
190
+ var m;
191
+ return !((m = i.id) != null && m.trim());
190
192
  }) ? (t({
191
193
  type: c.Error,
192
194
  message: o("unsubscribe-templates.select-checkbox-groups")
193
195
  }), !1) : !0;
194
196
  }, M = (e) => {
195
- const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
197
+ const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(J);
196
198
  return Array.from(r).find((i) => {
197
- var l;
198
- return !((l = i.id) != null && l.trim());
199
+ var m;
200
+ return !((m = i.id) != null && m.trim());
199
201
  }) ? (t({
200
202
  type: c.Error,
201
203
  message: o("unsubscribe-templates.select-radio-button-groups")
202
204
  }), !1) : !0;
203
205
  };
204
206
  return { validateHtml: async (e, s, n = !1) => {
205
- var v, C;
207
+ var v, y;
206
208
  const r = [
207
209
  ...s.map((I) => I.value),
208
- ...z,
209
- ...((C = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : C.customFieldAttributes) ?? []
210
+ ...Z,
211
+ ...((y = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : y.customFieldAttributes) ?? []
210
212
  ], a = G(e), i = await E(a);
211
- return await w(e, r, n) && R(e) && _(e) && N(e) && x(e, r, a, i) && O(e) && k(e) && B(e) && D() && F() && L(e) && V(e) && M(e);
213
+ return await A(e, r, n) && _(e) && O(e) && w(e) && N(e, r, a, i) && L(e) && B(e) && x(e) && D() && F() && k(e) && V(e) && M(e);
212
214
  } };
213
215
  };
214
216
  export {
215
- ue as buildPartnerAttributeNameSet,
216
- de as findInvalidCustomFields,
217
- me as parseRecommendationVariable,
218
- xe as useHtmlValidator
217
+ fe as buildPartnerAttributeNameSet,
218
+ pe as findInvalidCustomFields,
219
+ de as parseRecommendationVariable,
220
+ De as useHtmlValidator
219
221
  };
@@ -1,36 +1,37 @@
1
- var h = Object.defineProperty;
2
- var g = (r, t, e) => t in r ? h(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
- var l = (r, t, e) => g(r, typeof t != "symbol" ? t + "" : t, e);
4
- import f from "../../extensions/Blocks/Checkbox/template.js";
5
- import { extractTextFromElement as m, buildTextBlock as p } from "./textBlockMigration.js";
6
- class C {
1
+ var g = Object.defineProperty;
2
+ var x = (r, t, e) => t in r ? g(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
+ var m = (r, t, e) => x(r, typeof t != "symbol" ? t + "" : t, e);
4
+ import { CSS_CLASS_CHECKBOX_BLOCK as b, CSS_CLASS_CHECKBOX_BLOCK_V2 as T, BLOCK_ROOT_SELECTOR as f } from "../../extensions/Blocks/Checkbox/constants/selectors.js";
5
+ import h from "../../extensions/Blocks/Checkbox/template.js";
6
+ import { extractTextFromElement as p, buildTextBlock as C } from "./textBlockMigration.js";
7
+ class O {
7
8
  constructor() {
8
- l(this, "parser");
9
+ m(this, "parser");
9
10
  this.parser = new DOMParser();
10
11
  }
11
12
  migrate(t) {
12
13
  try {
13
- const e = this.parser.parseFromString(t, "text/html"), n = e.querySelectorAll("td.checkbox-block");
14
- if (n.length === 0)
14
+ const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll(`td.${b}`);
15
+ if (i.length === 0)
15
16
  return t;
16
- let i = !1;
17
- return n.forEach((o) => {
18
- if (o.classList.contains("checkbox-block-v2"))
17
+ let s = !1;
18
+ return i.forEach((o) => {
19
+ if (o.classList.contains(T))
19
20
  return;
20
- const b = o.getAttribute("id"), s = m(o, "ins-title"), a = m(o, "ins-description"), u = p(s, s.containerClass), x = p(a, a.containerClass), d = f.replace("{-{-TITLE-}-}", u).replace("{-{-DESCRIPTION-}-}", x), c = this.parser.parseFromString(
21
+ const l = o.getAttribute("id"), c = p(o, "ins-title"), a = p(o, "ins-description"), u = C(c, c.containerClass), S = C(a, a.containerClass), d = h.replace("{-{-TITLE-}-}", u).replace("{-{-DESCRIPTION-}-}", S), n = this.parser.parseFromString(
21
22
  `<table id="tempDoc"><tbody><tr>${d}</tr></tbody></table>`,
22
23
  "text/html"
23
- ).querySelector(".checkbox-block-v2");
24
- c && o.parentNode && (c.setAttribute("id", b || ""), o.parentNode.replaceChild(c, o), i = !0);
25
- }), i ? e.documentElement.outerHTML : t;
24
+ ).querySelector(f);
25
+ n && o.parentNode && (n.setAttribute("id", l || ""), o.parentNode.replaceChild(n, o), s = !0);
26
+ }), s ? e.documentElement.outerHTML : t;
26
27
  } catch (e) {
27
28
  return console.error("CheckboxMigrator failed:", e), t;
28
29
  }
29
30
  }
30
31
  }
31
- function E(r) {
32
- return new C().migrate(r);
32
+ function D(r) {
33
+ return new O().migrate(r);
33
34
  }
34
35
  export {
35
- E as migrateCheckbox
36
+ D as migrateCheckbox
36
37
  };
@@ -1,53 +1,54 @@
1
- var q = Object.defineProperty;
2
- var C = (o, t, e) => t in o ? q(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
- var g = (o, t, e) => C(o, typeof t != "symbol" ? t + "" : t, e);
1
+ var R = Object.defineProperty;
2
+ var b = (n, t, e) => t in n ? R(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var g = (n, t, e) => b(n, typeof t != "symbol" ? t + "" : t, e);
4
+ import { CSS_CLASS_RADIO_BUTTON_BLOCK as C, CSS_CLASS_RADIO_BUTTON_BLOCK_V2 as T, BLOCK_ROOT_SELECTOR as A } from "../../extensions/Blocks/RadioButton/constants/selectors.js";
4
5
  import N from "../../extensions/Blocks/RadioButton/template.js";
5
- import { extractTextFromElement as b, buildTextBlock as f } from "./textBlockMigration.js";
6
- class R {
6
+ import { extractTextFromElement as S, buildTextBlock as f } from "./textBlockMigration.js";
7
+ class _ {
7
8
  constructor() {
8
9
  g(this, "parser");
9
10
  this.parser = new DOMParser();
10
11
  }
11
12
  migrate(t) {
12
13
  try {
13
- const e = this.parser.parseFromString(t, "text/html"), n = e.querySelectorAll("td.radio-button-block"), a = e.querySelectorAll("td.radio-button-v2");
14
- if (n.length === 0 && a.length === 0)
14
+ const e = this.parser.parseFromString(t, "text/html"), o = e.querySelectorAll(`td.${C}`), a = e.querySelectorAll(`td.${T}`);
15
+ if (o.length === 0 && a.length === 0)
15
16
  return t;
16
- let i = !1;
17
- return n.forEach((r) => {
18
- if (r.classList.contains("radio-button-v2"))
17
+ let s = !1;
18
+ return o.forEach((r) => {
19
+ if (r.classList.contains(T))
19
20
  return;
20
- const s = r.getAttribute("id"), c = b(r, "ins-title"), d = b(r, "ins-description"), u = b(r, "ins-subscribe"), l = b(r, "ins-unsubscribe"), p = f(c, c.containerClass), m = f(d, d.containerClass), h = f(u), S = f(l), T = N.replace("{-{-TITLE-}-}", p).replace("{-{-DESCRIPTION-}-}", m).replace("{-{-YES-}-}", h).replace("{-{-NO-}-}", S), y = this.parser.parseFromString(
21
- `<table id="tempDoc"><tbody><tr>${T}</tr></tbody></table>`,
21
+ const i = r.getAttribute("id"), c = S(r, "ins-title"), p = S(r, "ins-description"), l = S(r, "ins-subscribe"), u = S(r, "ins-unsubscribe"), d = f(c, c.containerClass), m = f(p, p.containerClass), h = f(l), L = f(u), O = N.replace("{-{-TITLE-}-}", d).replace("{-{-DESCRIPTION-}-}", m).replace("{-{-YES-}-}", h).replace("{-{-NO-}-}", L), y = this.parser.parseFromString(
22
+ `<table id="tempDoc"><tbody><tr>${O}</tr></tbody></table>`,
22
23
  "text/html"
23
- ).querySelector(".radio-button-v2");
24
- y && r.parentNode && (y.setAttribute("id", s || ""), r.parentNode.replaceChild(y, r), i = !0);
25
- }), i = this.healRadioButtonV2(e) || i, i ? e.documentElement.outerHTML : t;
24
+ ).querySelector(A);
25
+ y && r.parentNode && (y.setAttribute("id", i || ""), r.parentNode.replaceChild(y, r), s = !0);
26
+ }), s = this.healRadioButtonV2(e) || s, s ? e.documentElement.outerHTML : t;
26
27
  } catch (e) {
27
28
  return console.error("RadioButtonMigrator failed:", e), t;
28
29
  }
29
30
  }
30
31
  healRadioButtonV2(t) {
31
32
  let e = !1;
32
- return t.querySelectorAll("td.radio-button-v2").forEach((n) => {
33
+ return t.querySelectorAll(`td.${T}`).forEach((o) => {
33
34
  var m;
34
- n.classList.contains("radio-button-block") || (n.classList.add("radio-button-block"), e = !0);
35
- const a = n.querySelector("input#radioYes"), i = n.querySelector("input#radioNo");
36
- if (!a || !i)
35
+ o.classList.contains(C) || (o.classList.add(C), e = !0);
36
+ const a = o.querySelector("input#radioYes"), s = o.querySelector("input#radioNo");
37
+ if (!a || !s)
37
38
  return;
38
39
  const r = ((m = a.parentElement) == null ? void 0 : m.querySelector(":scope > p")) || null;
39
40
  if (!r && !a.hasAttribute("align"))
40
41
  return;
41
- const s = a.closest("tr"), c = i.closest("tr");
42
- if (!s || !c || s === c || !s.parentNode)
42
+ const i = a.closest("tr"), c = s.closest("tr");
43
+ if (!i || !c || i === c || !i.parentNode)
43
44
  return;
44
- const d = (r == null ? void 0 : r.innerHTML.trim()) || "Yes", u = c.cloneNode(!0), l = u.querySelector("input#radioNo"), p = u.querySelector("p");
45
- l && (l.setAttribute("id", "radioYes"), l.removeAttribute("align")), p && (p.innerHTML = d), s.parentNode.replaceChild(u, s), e = !0;
45
+ const p = (r == null ? void 0 : r.innerHTML.trim()) || "Yes", l = c.cloneNode(!0), u = l.querySelector("input#radioNo"), d = l.querySelector("p");
46
+ u && (u.setAttribute("id", "radioYes"), u.removeAttribute("align")), d && (d.innerHTML = p), i.parentNode.replaceChild(l, i), e = !0;
46
47
  }), e;
47
48
  }
48
49
  }
49
- function w(o) {
50
- return new R().migrate(o);
50
+ function w(n) {
51
+ return new _().migrate(n);
51
52
  }
52
53
  export {
53
54
  w as migrateRadioButton
@@ -0,0 +1,4 @@
1
+ var r = /* @__PURE__ */ ((o) => (o.BLOCK_BACKGROUND = "checkbox-block-background-color-control", o))(r || {});
2
+ export {
3
+ r as CheckboxControlId
4
+ };
@@ -0,0 +1,6 @@
1
+ const c = "checkbox-block", C = "checkbox-block-v2", S = `.${C}`;
2
+ export {
3
+ S as BLOCK_ROOT_SELECTOR,
4
+ c as CSS_CLASS_CHECKBOX_BLOCK,
5
+ C as CSS_CLASS_CHECKBOX_BLOCK_V2
6
+ };
@@ -0,0 +1,10 @@
1
+ import { createBlockBackgroundColorControl as o } from "../../../controlFactories.js";
2
+ import { CheckboxControlId as r } from "../../constants/controlIds.js";
3
+ import { BLOCK_ROOT_SELECTOR as C } from "../../constants/selectors.js";
4
+ const k = o(
5
+ r.BLOCK_BACKGROUND,
6
+ C
7
+ );
8
+ export {
9
+ k as CheckboxBlockBackgroundControl
10
+ };
@@ -1,9 +1,10 @@
1
1
  import { ExtensionBuilder as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { CheckboxBlock as t } from "./block.js";
3
- import { CheckboxControl as e } from "./control.js";
4
- import { CheckboxIconsRegistry as r } from "./iconsRegistry.js";
5
- import { CheckboxBlockSettings as i } from "./settingsPanel.js";
6
- const d = new o().addBlock(t).withSettingsPanelRegistry(i).addControl(e).withIconsRegistry(r).build();
3
+ import { CheckboxControl as r } from "./control.js";
4
+ import { CheckboxBlockBackgroundControl as e } from "./controls/blockBackground/index.js";
5
+ import { CheckboxIconsRegistry as i } from "./iconsRegistry.js";
6
+ import { CheckboxBlockSettings as n } from "./settingsPanel.js";
7
+ const C = new o().addBlock(t).withSettingsPanelRegistry(n).addControl(r).addControl(e).withIconsRegistry(i).build();
7
8
  export {
8
- d as default
9
+ C as default
9
10
  };
@@ -1,25 +1,26 @@
1
- import { SettingsPanelRegistry as C, SettingsPanelTab as t, SettingsTab as e, ContainerControls as n, TextControls as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CHECKBOX_BLOCK_ID as s } from "./block.js";
3
- import { CHECKBOX_CONTROL_BLOCK_ID as T } from "./control.js";
4
- class l extends C {
5
- registerBlockControls(o) {
6
- o[s] = [
7
- new t(
8
- e.SETTINGS,
1
+ import { SettingsPanelRegistry as r, SettingsPanelTab as o, SettingsTab as t, ContainerControls as C } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CHECKBOX_BLOCK_ID as n } from "./block.js";
3
+ import { CheckboxControlId as i } from "./constants/controlIds.js";
4
+ import { CHECKBOX_CONTROL_BLOCK_ID as s } from "./control.js";
5
+ class T extends r {
6
+ registerBlockControls(e) {
7
+ e[n] = [
8
+ new o(
9
+ t.SETTINGS,
9
10
  [
10
- T,
11
- n.EXTERNAL_INDENTS
11
+ s,
12
+ C.EXTERNAL_INDENTS
12
13
  ]
13
14
  ),
14
- new t(
15
- e.STYLES,
15
+ new o(
16
+ t.STYLES,
16
17
  [
17
- r.TEXT_BLOCK_BACKGROUND_COLOR
18
+ i.BLOCK_BACKGROUND
18
19
  ]
19
20
  )
20
21
  ];
21
22
  }
22
23
  }
23
24
  export {
24
- l as CheckboxBlockSettings
25
+ T as CheckboxBlockSettings
25
26
  };
@@ -1,9 +1,10 @@
1
1
  import { BlockType as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CSS_CLASS_CHECKBOX_BLOCK as l, CSS_CLASS_CHECKBOX_BLOCK_V2 as a } from "./constants/selectors.js";
2
3
  const e = {
3
4
  TITLE: "Unsubscribe From All Email Lists",
4
5
  DESCRIPTION: "You will still receive important transactional and billing-related emails."
5
- }, l = `
6
- <td align="left" class="checkbox-block checkbox-block-v2 esd-block-checkbox es-p20">
6
+ }, i = `
7
+ <td align="left" class="${l} ${a} esd-block-checkbox es-p20">
7
8
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
8
9
  <tbody>
9
10
  <tr>
@@ -26,13 +27,13 @@ const e = {
26
27
  </tbody>
27
28
  </table>
28
29
  </td>
29
- `, o = `
30
+ `, d = `
30
31
  <td
31
32
  align="left"
32
33
  esd-extension-block-id="checkbox-block"
33
34
  class="
34
- checkbox-block
35
- checkbox-block-v2
35
+ ${l}
36
+ ${a}
36
37
  esd-block-checkbox
37
38
  esd-checkbox-block
38
39
  esd-extension-block es-p20"
@@ -60,10 +61,10 @@ const e = {
60
61
  </table>
61
62
  </td>
62
63
  `;
63
- function a() {
64
- return l.replace("{-{-TITLE-}-}", `<p path="1">${e.TITLE}</p>`).replace("{-{-DESCRIPTION-}-}", `<p path="1">${e.DESCRIPTION}</p>`);
64
+ function n() {
65
+ return i.replace("{-{-TITLE-}-}", `<p path="1">${e.TITLE}</p>`).replace("{-{-DESCRIPTION-}-}", `<p path="1">${e.DESCRIPTION}</p>`);
65
66
  }
66
67
  export {
67
- o as default,
68
- a as getDefaultTemplate
68
+ d as default,
69
+ n as getDefaultTemplate
69
70
  };
@@ -0,0 +1,4 @@
1
+ var r = /* @__PURE__ */ ((o) => (o.BLOCK_BACKGROUND = "radio-button-block-background-color-control", o))(r || {});
2
+ export {
3
+ r as RadioButtonControlId
4
+ };
@@ -0,0 +1,6 @@
1
+ const O = "radio-button-block", _ = "radio-button-v2", o = `.${_}`;
2
+ export {
3
+ o as BLOCK_ROOT_SELECTOR,
4
+ O as CSS_CLASS_RADIO_BUTTON_BLOCK,
5
+ _ as CSS_CLASS_RADIO_BUTTON_BLOCK_V2
6
+ };
@@ -0,0 +1,10 @@
1
+ import { createBlockBackgroundColorControl as o } from "../../../controlFactories.js";
2
+ import { RadioButtonControlId as r } from "../../constants/controlIds.js";
3
+ import { BLOCK_ROOT_SELECTOR as t } from "../../constants/selectors.js";
4
+ const c = o(
5
+ r.BLOCK_BACKGROUND,
6
+ t
7
+ );
8
+ export {
9
+ c as RadioButtonBlockBackgroundControl
10
+ };
@@ -1,9 +1,10 @@
1
1
  import { ExtensionBuilder as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { RadioButtonCustomBlock as t } from "./block.js";
3
3
  import { RadioButtonControl as i } from "./control.js";
4
- import { RadioButtonIconsRegistry as n } from "./iconsRegistry.js";
5
- import { RadioButtonBlockSettingsPanel as r } from "./settingsPanel.js";
6
- const l = new o().addBlock(t).withSettingsPanelRegistry(r).addControl(i).withIconsRegistry(n).build();
4
+ import { RadioButtonBlockBackgroundControl as n } from "./controls/blockBackground/index.js";
5
+ import { RadioButtonIconsRegistry as r } from "./iconsRegistry.js";
6
+ import { RadioButtonBlockSettingsPanel as d } from "./settingsPanel.js";
7
+ const u = new o().addBlock(t).withSettingsPanelRegistry(d).addControl(i).addControl(n).withIconsRegistry(r).build();
7
8
  export {
8
- l as default
9
+ u as default
9
10
  };