@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.
- package/dist/composables/useHtmlValidator.js +91 -89
- package/dist/config/migrator/checkboxMigrator.js +20 -19
- package/dist/config/migrator/radioButtonMigrator.js +26 -25
- package/dist/extensions/Blocks/Checkbox/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/Checkbox/constants/selectors.js +6 -0
- package/dist/extensions/Blocks/Checkbox/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/Checkbox/extension.js +6 -5
- package/dist/extensions/Blocks/Checkbox/settingsPanel.js +15 -14
- package/dist/extensions/Blocks/Checkbox/template.js +10 -9
- package/dist/extensions/Blocks/RadioButton/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/RadioButton/constants/selectors.js +6 -0
- package/dist/extensions/Blocks/RadioButton/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/RadioButton/extension.js +5 -4
- package/dist/extensions/Blocks/RadioButton/settingsPanel.js +12 -11
- package/dist/extensions/Blocks/RadioButton/template.js +16 -9
- package/dist/extensions/Blocks/controlFactories.js +117 -115
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +12 -12
- package/dist/package.json.js +1 -1
- package/dist/src/extensions/Blocks/Checkbox/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/Checkbox/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/Checkbox/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/RadioButton/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/RadioButton/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/RadioButton/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +14 -0
- package/dist/static/styles/components/wide-panel.css.js +7 -0
- package/dist/static/styles/customEditorStyle.css.js +8 -0
- 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
|
|
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 {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
21
|
-
return
|
|
22
|
+
function le(t, l) {
|
|
23
|
+
return l.some((f) => t.startsWith(`${f}_`));
|
|
22
24
|
}
|
|
23
|
-
const
|
|
24
|
-
function
|
|
25
|
-
const
|
|
26
|
-
return
|
|
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
|
|
29
|
-
const
|
|
30
|
+
function fe(t) {
|
|
31
|
+
const l = new Set(Q);
|
|
30
32
|
return Object.values(t).forEach((f) => {
|
|
31
|
-
|
|
32
|
-
}),
|
|
33
|
+
l.add(te(f.attributeName, t).toLowerCase());
|
|
34
|
+
}), l;
|
|
33
35
|
}
|
|
34
|
-
function
|
|
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
|
|
39
|
-
return u.forEach((
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
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
|
|
44
|
-
if (
|
|
45
|
-
if (!d || d.has(
|
|
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(
|
|
49
|
+
E.push(p);
|
|
48
50
|
return;
|
|
49
51
|
}
|
|
50
|
-
|
|
52
|
+
le(p, f) || p.includes(".") || E.push(p);
|
|
51
53
|
}), E;
|
|
52
54
|
}
|
|
53
|
-
function
|
|
54
|
-
return (t.replace(
|
|
55
|
-
const d = o.slice(2, -2), u = d.indexOf("|"),
|
|
56
|
-
return
|
|
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
|
|
60
|
-
var
|
|
61
|
-
const { showToaster: t } =
|
|
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
|
|
70
|
-
},
|
|
71
|
-
const n = await
|
|
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:
|
|
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(
|
|
80
|
+
}), o($), a === o(K) && t({
|
|
79
81
|
type: c.Error,
|
|
80
82
|
message: o("newsletter.already-in-progress")
|
|
81
83
|
}), r;
|
|
82
|
-
},
|
|
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 && !
|
|
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 [
|
|
89
|
-
|
|
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
|
-
},
|
|
96
|
-
const r = n ? await
|
|
97
|
-
return
|
|
98
|
-
},
|
|
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),
|
|
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
|
-
},
|
|
111
|
-
const s =
|
|
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
|
-
},
|
|
117
|
-
if (
|
|
118
|
+
}, N = (e, s, n, r) => {
|
|
119
|
+
if (g)
|
|
118
120
|
return !0;
|
|
119
|
-
const a =
|
|
121
|
+
const a = pe(
|
|
120
122
|
e,
|
|
121
123
|
s,
|
|
122
|
-
|
|
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((
|
|
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
|
-
},
|
|
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),
|
|
143
|
-
(!i || a !== v) && !
|
|
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((
|
|
147
|
-
|
|
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 =
|
|
152
|
-
I && I.forEach((
|
|
153
|
-
|
|
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((
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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(
|
|
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,
|
|
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(
|
|
188
|
+
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(z);
|
|
187
189
|
return Array.from(r).find((i) => {
|
|
188
|
-
var
|
|
189
|
-
return !((
|
|
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(
|
|
197
|
+
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(J);
|
|
196
198
|
return Array.from(r).find((i) => {
|
|
197
|
-
var
|
|
198
|
-
return !((
|
|
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,
|
|
207
|
+
var v, y;
|
|
206
208
|
const r = [
|
|
207
209
|
...s.map((I) => I.value),
|
|
208
|
-
...
|
|
209
|
-
...((
|
|
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
|
|
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
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
fe as buildPartnerAttributeNameSet,
|
|
218
|
+
pe as findInvalidCustomFields,
|
|
219
|
+
de as parseRecommendationVariable,
|
|
220
|
+
De as useHtmlValidator
|
|
219
221
|
};
|
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import f from "../../extensions/Blocks/Checkbox/
|
|
5
|
-
import
|
|
6
|
-
|
|
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
|
-
|
|
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"),
|
|
14
|
-
if (
|
|
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
|
|
17
|
-
return
|
|
18
|
-
if (o.classList.contains(
|
|
17
|
+
let s = !1;
|
|
18
|
+
return i.forEach((o) => {
|
|
19
|
+
if (o.classList.contains(T))
|
|
19
20
|
return;
|
|
20
|
-
const
|
|
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(
|
|
24
|
-
|
|
25
|
-
}),
|
|
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
|
|
32
|
-
return new
|
|
32
|
+
function D(r) {
|
|
33
|
+
return new O().migrate(r);
|
|
33
34
|
}
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
+
D as migrateCheckbox
|
|
36
37
|
};
|
|
@@ -1,53 +1,54 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var g = (
|
|
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
|
|
6
|
-
class
|
|
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"),
|
|
14
|
-
if (
|
|
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
|
|
17
|
-
return
|
|
18
|
-
if (r.classList.contains(
|
|
17
|
+
let s = !1;
|
|
18
|
+
return o.forEach((r) => {
|
|
19
|
+
if (r.classList.contains(T))
|
|
19
20
|
return;
|
|
20
|
-
const
|
|
21
|
-
`<table id="tempDoc"><tbody><tr>${
|
|
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(
|
|
24
|
-
y && r.parentNode && (y.setAttribute("id",
|
|
25
|
-
}),
|
|
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(
|
|
33
|
+
return t.querySelectorAll(`td.${T}`).forEach((o) => {
|
|
33
34
|
var m;
|
|
34
|
-
|
|
35
|
-
const a =
|
|
36
|
-
if (!a || !
|
|
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
|
|
42
|
-
if (!
|
|
42
|
+
const i = a.closest("tr"), c = s.closest("tr");
|
|
43
|
+
if (!i || !c || i === c || !i.parentNode)
|
|
43
44
|
return;
|
|
44
|
-
const
|
|
45
|
-
|
|
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(
|
|
50
|
-
return new
|
|
50
|
+
function w(n) {
|
|
51
|
+
return new _().migrate(n);
|
|
51
52
|
}
|
|
52
53
|
export {
|
|
53
54
|
w as migrateRadioButton
|
|
@@ -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
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
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
|
-
|
|
9
|
+
C as default
|
|
9
10
|
};
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { SettingsPanelRegistry as
|
|
2
|
-
import { CHECKBOX_BLOCK_ID as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
11
|
-
|
|
11
|
+
s,
|
|
12
|
+
C.EXTERNAL_INDENTS
|
|
12
13
|
]
|
|
13
14
|
),
|
|
14
|
-
new
|
|
15
|
-
|
|
15
|
+
new o(
|
|
16
|
+
t.STYLES,
|
|
16
17
|
[
|
|
17
|
-
|
|
18
|
+
i.BLOCK_BACKGROUND
|
|
18
19
|
]
|
|
19
20
|
)
|
|
20
21
|
];
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
export {
|
|
24
|
-
|
|
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
|
-
},
|
|
6
|
-
<td align="left" class="
|
|
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
|
-
`,
|
|
30
|
+
`, d = `
|
|
30
31
|
<td
|
|
31
32
|
align="left"
|
|
32
33
|
esd-extension-block-id="checkbox-block"
|
|
33
34
|
class="
|
|
34
|
-
|
|
35
|
-
|
|
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
|
|
64
|
-
return
|
|
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
|
-
|
|
68
|
-
|
|
68
|
+
d as default,
|
|
69
|
+
n as getDefaultTemplate
|
|
69
70
|
};
|
|
@@ -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 {
|
|
5
|
-
import {
|
|
6
|
-
|
|
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
|
-
|
|
9
|
+
u as default
|
|
9
10
|
};
|