@useinsider/guido 3.19.0-beta.f0d5980 → 3.19.0-beta.f10986f

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 (74) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +39 -37
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +91 -82
  5. package/dist/components/organisms/AutoSaveController.vue2.js +9 -8
  6. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  7. package/dist/components/organisms/header/EditorActions.vue2.js +90 -55
  8. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  9. package/dist/components/organisms/header/LeftSlot.vue2.js +16 -12
  10. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
  11. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +49 -0
  12. package/dist/components/wrappers/WpDrawer.vue.js +9 -7
  13. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  14. package/dist/composables/useAutoSave.js +11 -11
  15. package/dist/composables/useCortexBlueprintBridge.js +122 -54
  16. package/dist/composables/useEmailTemplateApplier.js +111 -50
  17. package/dist/composables/useHtmlCompiler.js +37 -26
  18. package/dist/composables/useHtmlValidator.js +2 -0
  19. package/dist/composables/useSave.js +90 -45
  20. package/dist/composables/useSaveValidation.js +282 -0
  21. package/dist/composables/useSaveValidationRollout.js +9 -0
  22. package/dist/composables/validators/useCouponBlockValidator.js +24 -21
  23. package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
  24. package/dist/config/migrator/itemsBlockMigrator.js +236 -248
  25. package/dist/config/migrator/recommendationMigrator.js +28 -21
  26. package/dist/config/migrator/recommendationPartnerMigrator.js +36 -30
  27. package/dist/enums/save-validation.js +4 -0
  28. package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
  29. package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
  30. package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
  31. package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
  32. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
  33. package/dist/extensions/Blocks/Items/template.js +219 -204
  34. package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +3 -1
  35. package/dist/guido.css +1 -1
  36. package/dist/src/@types/config/schemas.d.ts +4 -0
  37. package/dist/src/@types/save-validation.d.ts +19 -0
  38. package/dist/src/components/Guido.vue.d.ts +17 -1
  39. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
  40. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
  41. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
  42. package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
  43. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
  44. package/dist/src/composables/useConfig.d.ts +2 -0
  45. package/dist/src/composables/useCortexBlueprintBridge.d.ts +2 -3
  46. package/dist/src/composables/useEmailTemplateApplier.d.ts +18 -5
  47. package/dist/src/composables/useGuidoActions.d.ts +2 -0
  48. package/dist/src/composables/useHtmlValidator.d.ts +21 -0
  49. package/dist/src/composables/useSave.d.ts +6 -1
  50. package/dist/src/composables/useSaveValidation.d.ts +6 -0
  51. package/dist/src/composables/useSaveValidationRollout.d.ts +3 -0
  52. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  53. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
  54. package/dist/src/enums/save-validation.d.ts +27 -0
  55. package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
  56. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
  57. package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
  58. package/dist/src/mock/cortexChatStore.d.ts +12 -0
  59. package/dist/src/stores/config.d.ts +32 -0
  60. package/dist/src/stores/guido-email-editor.d.ts +20 -10
  61. package/dist/src/stores/onboarding.d.ts +4 -0
  62. package/dist/src/stores/recommendation.d.ts +5 -0
  63. package/dist/src/stores/save-validation.d.ts +22 -0
  64. package/dist/src/utils/dateUtil.d.ts +10 -0
  65. package/dist/src/utils/genericUtil.d.ts +3 -0
  66. package/dist/src/utils/templatePreparation.d.ts +30 -0
  67. package/dist/static/styles/components/version-history.css.js +2 -6
  68. package/dist/stores/config.js +84 -67
  69. package/dist/stores/guido-email-editor.js +3 -1
  70. package/dist/stores/onboarding.js +4 -0
  71. package/dist/stores/save-validation.js +30 -0
  72. package/dist/utils/pairProductVariables.js +71 -71
  73. package/dist/utils/templatePreparation.js +39 -36
  74. package/package.json +1 -1
@@ -0,0 +1,282 @@
1
+ import { getIgnoredRecommendationBlockIds as B } from "../config/compiler/utils/recommendationIgnoreUtils.js";
2
+ import { CanNotMakeAnyChangesForRunningKey as k, DISPLAY_CONDITIONS_REGEX as Y, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as x } from "../enums/html-validator.js";
3
+ import { SaveValidationRule as o } from "../enums/save-validation.js";
4
+ import { ToasterTypeOptions as r } from "../enums/toaster.js";
5
+ import { BLOCK_ROOT_SELECTOR as M } from "../extensions/Blocks/Checkbox/constants/selectors.js";
6
+ import { itemsBlockDynamicVariables as U } from "../extensions/Blocks/Items/enums/productEnums.js";
7
+ import { BLOCK_ROOT_SELECTOR as P } from "../extensions/Blocks/RadioButton/constants/selectors.js";
8
+ import { useRecommendationExtensionStore as W } from "../extensions/Blocks/Recommendation/store/recommendation.js";
9
+ import { getInvalidFields as G, STRATEGY_FIELD_KEY as q, RecommendationAssignStrategyKey as H, RecommendationRequiredFieldsKey as V } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
10
+ import { useConfigStore as X } from "../stores/config.js";
11
+ import { useDynamicContentStore as j } from "../stores/dynamic-content.js";
12
+ import { useRecommendationStore as z } from "../stores/recommendation.js";
13
+ import { base64EncodeWithSpecialChars as T } from "../utils/base64.js";
14
+ import { escapeHtml as $ } from "../utils/htmlEscape.js";
15
+ import { useTemplatePreparation as Q } from "../utils/templatePreparation.js";
16
+ import { useActionsApi as Z } from "./useActionsApi.js";
17
+ import { useConfig as J } from "./useConfig.js";
18
+ import { useHtmlCompiler as ee } from "./useHtmlCompiler.js";
19
+ import { buildPartnerAttributeNameSet as te, getInvalidDynamicContentTags as ne, getRecommendationBlockIds as ie, findInvalidCustomFields as oe } from "./useHtmlValidator.js";
20
+ import { useHttp as re } from "./useHttp.js";
21
+ import { useTranslations as se } from "./useTranslations.js";
22
+ import { findInvalidCouponBlocks as ae, COUPON_TAG_MODIFIED_KEY as ce } from "./validators/useCouponBlockValidator.js";
23
+ import { findDuplicateUnsubPageTypes as le, countUnsubBlocksWithoutPage as me, EMPTY_BLOCK_KEY as ue } from "./validators/useUnsubscribeBlockValidator.js";
24
+ const de = "newsletter.html-content-is-empty", pe = "custom-fields.missing-closing-braces", ge = "custom-fields.missing-opening-braces", I = "custom-fields.invalid-custom-fields", fe = "newsletter.display-conditions-invalid-syntax", ye = "custom-conditions.wrong-equality-operators", Ee = "custom-conditions.missing-if-endif-tag", Ie = "custom-conditions.no-space-after-braces", Se = "custom-conditions.no-braces-inside-if-tag", _e = "newsletter.fill-all-necessary-fields", Ce = "newsletter.invalid-image-type", he = "unsubscribe-templates.select-checkbox-groups", ke = "unsubscribe-templates.select-radio-button-groups", Te = "newsletter.invalid-url-link-for-toaster", F = "journey-builder.liquid-validation-failed", Fe = "/newsletter/template-library/check-template-html-body", Oe = /src="[^"]*\.(svg|pst)"/gm, R = /({%(.*?)%})/g, Re = ["if", "endif", "else", "elif", "now"], Le = (t) => !Re.includes(t.toLowerCase()), Ne = (t) => ["if", "endif"].includes(t.toLowerCase());
25
+ function be(t) {
26
+ return ae(t).map((i) => ({
27
+ rule: o.CouponTagModified,
28
+ type: r.Warning,
29
+ key: ce,
30
+ detail: i
31
+ }));
32
+ }
33
+ function Ae(t) {
34
+ return le(t).map((i) => ({
35
+ rule: o.DuplicateUnsubBlock,
36
+ type: r.Error,
37
+ key: i.messageKey
38
+ }));
39
+ }
40
+ function ve(t) {
41
+ return Array.from({ length: me(t) }, () => ({
42
+ rule: o.UnsubBlockMissingTemplate,
43
+ type: r.Warning,
44
+ key: ue
45
+ }));
46
+ }
47
+ function De(t, i) {
48
+ const n = t.match(R);
49
+ if (!n)
50
+ return [];
51
+ const c = [];
52
+ return n.forEach((u) => {
53
+ const a = u.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
54
+ if (a && a.length > 0) {
55
+ const [d] = a;
56
+ Le(d) && !i.includes(d) && c.push({
57
+ rule: o.CustomFieldScript,
58
+ type: r.Warning,
59
+ key: I,
60
+ detail: d
61
+ });
62
+ }
63
+ }), c;
64
+ }
65
+ function Ke(t) {
66
+ return t.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: de }];
67
+ }
68
+ function we(t) {
69
+ const i = (t.match(/{/gm) || []).length, n = (t.match(/}/gm) || []).length;
70
+ return i > n ? [{
71
+ rule: o.MismatchedBraces,
72
+ type: r.Warning,
73
+ key: pe
74
+ }] : i < n ? [{
75
+ rule: o.MismatchedBraces,
76
+ type: r.Warning,
77
+ key: ge
78
+ }] : [];
79
+ }
80
+ function Be(t) {
81
+ return ne(t).map((i) => ({
82
+ rule: o.InvalidDynamicTag,
83
+ type: r.Warning,
84
+ key: I,
85
+ detail: i
86
+ }));
87
+ }
88
+ function Ye(t, i, n, c) {
89
+ const u = ie(t);
90
+ return oe(t, i, u, n, c).map((a) => ({
91
+ rule: o.InvalidCustomField,
92
+ type: r.Error,
93
+ key: I,
94
+ detail: a
95
+ }));
96
+ }
97
+ function xe(t) {
98
+ const i = t.match(/{%(.*?)%}/g), n = [], c = [];
99
+ if (i && i.forEach((u) => {
100
+ const a = u.match(Y), d = u.match(x), E = (a == null ? void 0 : a.join("")) || "";
101
+ (!a || u !== E) && !d && c.push({
102
+ rule: o.ConditionsSyntax,
103
+ type: r.Error,
104
+ key: fe,
105
+ detail: u
106
+ }), a && a.forEach((g) => {
107
+ g.trim() === "=" && c.push({
108
+ rule: o.WrongEqualityOperator,
109
+ type: r.Error,
110
+ key: ye
111
+ }), (g.match(/^[a-zA-Z]*$/g) ?? []).forEach((f) => {
112
+ Ne(f) && n.push(f);
113
+ });
114
+ });
115
+ }), n.length) {
116
+ const u = n.filter((d) => d === "if").length, a = n.filter((d) => d === "endif").length;
117
+ u !== a && c.push({
118
+ rule: o.MissingIfEndif,
119
+ type: r.Error,
120
+ key: Ee
121
+ });
122
+ }
123
+ return c;
124
+ }
125
+ function Me(t) {
126
+ const i = (t.match(/{% /gm) || []).length, n = (t.match(/ %}/gm) || []).length;
127
+ return i === n ? [] : [{
128
+ rule: o.ConditionTagSpacing,
129
+ type: r.Warning,
130
+ key: Ie
131
+ }];
132
+ }
133
+ function Ue(t) {
134
+ return (t.match(R) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, c) => n + c, 0) === 0 ? [] : [{
135
+ rule: o.BracesInsideIfTag,
136
+ type: r.Warning,
137
+ key: Se
138
+ }];
139
+ }
140
+ function Pe(t) {
141
+ return (t.match(Oe) ?? []).map((i) => ({
142
+ rule: o.InvalidImageType,
143
+ type: r.Error,
144
+ key: Ce,
145
+ detail: i
146
+ }));
147
+ }
148
+ function O(t, i, n, c) {
149
+ const u = new DOMParser().parseFromString(t, "text/html");
150
+ return Array.from(u.querySelectorAll(i)).filter((a) => {
151
+ var d;
152
+ return !((d = a.id) != null && d.trim());
153
+ }).map(() => ({ rule: n, type: r.Error, key: c }));
154
+ }
155
+ const dt = () => {
156
+ const { config: t, isFeatureEnabled: i } = J(), n = se(), { post: c } = re(), { getCompiledEmail: u, getTemplateData: a } = Z(), { compileHtml: d } = ee(), { hydrateRecommendationStore: E } = Q(), g = j(), f = z(), y = W(), L = X(), N = (e) => ({
157
+ rule: e.rule,
158
+ type: e.type,
159
+ detail: e.detail,
160
+ message: "key" in e ? n(e.key) : $(e.message)
161
+ }), b = async (e) => {
162
+ if (e.size === 0)
163
+ return /* @__PURE__ */ new Set();
164
+ try {
165
+ await y.fetchRecommendationFilters();
166
+ } catch {
167
+ return null;
168
+ }
169
+ return te(y.filterList);
170
+ }, A = async (e) => {
171
+ try {
172
+ const l = await c(Fe, { html: T(e) }), { status: s, message: m } = l.data, p = [];
173
+ return s || p.push({
174
+ rule: o.InvalidLinks,
175
+ type: r.Error,
176
+ // status===undefined means a bare message instead of a boolean; surface it,
177
+ // but fall back to the canned key when it's missing so a malformed body
178
+ // never renders a literal 'undefined' row (SD-147430).
179
+ ...s === void 0 && m ? { message: m } : { key: Te }
180
+ }), m === n(k) && p.push({
181
+ rule: o.LinkCheckInProgress,
182
+ type: r.Error,
183
+ key: k
184
+ }), p;
185
+ } catch (l) {
186
+ return console.warn("Link-check collector failed; skipping the link rule.", l), [];
187
+ }
188
+ }, v = async (e) => {
189
+ try {
190
+ const l = await c("/newsletter/contents/validate-syntax", [{
191
+ identifier: "default",
192
+ syntax: "liquid",
193
+ contents: {
194
+ subject: null,
195
+ preheader: null,
196
+ html: T(e),
197
+ ampHtml: null
198
+ }
199
+ }]);
200
+ if (!Array.isArray(l.data)) {
201
+ const m = l.data;
202
+ return [{
203
+ rule: o.LiquidSyntax,
204
+ type: r.Warning,
205
+ message: m.message ?? n(F)
206
+ }];
207
+ }
208
+ const [s] = l.data;
209
+ return Object.values((s == null ? void 0 : s.errors) ?? {}).map((m) => ({
210
+ rule: o.LiquidSyntax,
211
+ type: r.Warning,
212
+ message: m.replace(/^line \d+:\s*/, "")
213
+ }));
214
+ } catch {
215
+ return [{
216
+ rule: o.LiquidSyntax,
217
+ type: r.Error,
218
+ message: n(F)
219
+ }];
220
+ }
221
+ }, D = () => {
222
+ const e = Object.values(y.blockStates).map((s) => G(s.recommendationConfigs, y)).filter((s) => s.length > 0).map((s) => {
223
+ const m = s.every((p) => p === q);
224
+ return {
225
+ rule: o.RecommendationRequiredFields,
226
+ type: m ? r.Warning : r.Error,
227
+ key: m ? H : V
228
+ };
229
+ }), l = (f.recommendationConfigs ?? []).filter((s) => s.filters.some((m) => m.value === "")).map(() => ({
230
+ rule: o.RecommendationFilters,
231
+ type: r.Error,
232
+ key: _e
233
+ }));
234
+ return [...e, ...l];
235
+ }, K = async (e, l) => {
236
+ var C, h;
237
+ const s = [
238
+ ...l.map((w) => w.value),
239
+ ...U,
240
+ ...((h = (C = t.value) == null ? void 0 : C.template) == null ? void 0 : h.customFieldAttributes) ?? []
241
+ ], m = B(e), p = await b(m), { isTransactional: _ } = L;
242
+ return [
243
+ ...await A(e),
244
+ ..._ ? [] : De(e, s),
245
+ ...Ke(e),
246
+ ...we(e),
247
+ ...Be(e),
248
+ ..._ ? [] : Ye(e, s, m, p),
249
+ ...xe(e),
250
+ ...Me(e),
251
+ ...Ue(e),
252
+ ...D(),
253
+ ...Pe(e),
254
+ ...O(
255
+ e,
256
+ M,
257
+ o.CheckboxUnsubGroup,
258
+ he
259
+ ),
260
+ ...O(
261
+ e,
262
+ P,
263
+ o.RadioButtonUnsubGroup,
264
+ ke
265
+ )
266
+ ];
267
+ }, S = async (e, l) => [
268
+ ...be(e),
269
+ ...Ae(e),
270
+ ...ve(e),
271
+ ...i("liquidSyntax") ? await v(e) : await K(e, l)
272
+ ].map(N);
273
+ return { collectSaveValidationErrors: S, validateCurrentTemplate: async () => {
274
+ const { html: e } = await a();
275
+ await E(e);
276
+ const { html: l } = await u({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: s } = d(l);
277
+ return S(s, g.getSelectedDynamicContentList);
278
+ } };
279
+ };
280
+ export {
281
+ dt as useSaveValidation
282
+ };
@@ -0,0 +1,9 @@
1
+ import { useConfigStore as t } from "../stores/config.js";
2
+ import { computed as o } from "vue";
3
+ const n = ["newsletteruatcamp", "newsletterqacamp"], c = () => {
4
+ const e = t();
5
+ return { isEnabled: o(() => n.includes(e.partnerName)) };
6
+ };
7
+ export {
8
+ c as useSaveValidationRollout
9
+ };
@@ -1,24 +1,27 @@
1
- import { ToasterTypeOptions as c } from "../../enums/toaster.js";
2
- import { COUPON_PLACEHOLDER_DEFAULT as i, COUPON_PLACEHOLDER_LIQUID as l } from "../../extensions/Blocks/CouponBlock/template.js";
3
- import { useToaster as m } from "../useToaster.js";
4
- import { useTranslations as p } from "../useTranslations.js";
5
- const u = /* @__PURE__ */ new Set([
6
- i,
7
- l
8
- ]), A = () => {
9
- const { showToaster: t } = m(), r = p();
10
- return { validateCouponBlockTags: (e) => {
11
- const n = new DOMParser().parseFromString(e, "text/html");
12
- return Array.from(n.querySelectorAll(".coupon-block")).find((s) => {
13
- var o;
14
- const a = ((o = s.textContent) == null ? void 0 : o.trim()) ?? "";
15
- return !u.has(a);
16
- }) ? (t({
17
- type: c.Warning,
18
- message: r("newsletter.coupon-tag-modified")
19
- }), !1) : !0;
20
- } };
1
+ import { ToasterTypeOptions as n } from "../../enums/toaster.js";
2
+ import { COUPON_PLACEHOLDER_DEFAULT as s, COUPON_PLACEHOLDER_LIQUID as a } from "../../extensions/Blocks/CouponBlock/template.js";
3
+ import { useToaster as i } from "../useToaster.js";
4
+ import { useTranslations as l } from "../useTranslations.js";
5
+ const c = /* @__PURE__ */ new Set([
6
+ s,
7
+ a
8
+ ]), p = "newsletter.coupon-tag-modified";
9
+ function u(r) {
10
+ const e = new DOMParser().parseFromString(r, "text/html");
11
+ return Array.from(e.querySelectorAll(".coupon-block")).map((o) => {
12
+ var t;
13
+ return ((t = o.textContent) == null ? void 0 : t.trim()) ?? "";
14
+ }).filter((o) => !c.has(o));
15
+ }
16
+ const T = () => {
17
+ const { showToaster: r } = i(), e = l();
18
+ return { validateCouponBlockTags: (t) => u(t).length > 0 ? (r({
19
+ type: n.Warning,
20
+ message: e(p)
21
+ }), !1) : !0 };
21
22
  };
22
23
  export {
23
- A as useCouponBlockValidator
24
+ p as COUPON_TAG_MODIFIED_KEY,
25
+ u as findInvalidCouponBlocks,
26
+ T as useCouponBlockValidator
24
27
  };
@@ -1,8 +1,8 @@
1
- import { ToasterTypeOptions as i } from "../../enums/toaster.js";
1
+ import { ToasterTypeOptions as c } from "../../enums/toaster.js";
2
2
  import { PAGE_TYPES as u } from "../../enums/unsubscribe.js";
3
- import { UNSUBSCRIBE_BLOCK_SELECTOR as l, DATA_ATTRIBUTES as a } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
4
- import { useToaster as E } from "../useToaster.js";
5
- import { useTranslations as m } from "../useTranslations.js";
3
+ import { UNSUBSCRIBE_BLOCK_SELECTOR as i, DATA_ATTRIBUTES as a } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
4
+ import { useToaster as p } from "../useToaster.js";
5
+ import { useTranslations as l } from "../useTranslations.js";
6
6
  const T = [
7
7
  {
8
8
  pageType: u.GLOBAL_UNSUBSCRIBE,
@@ -12,30 +12,37 @@ const T = [
12
12
  pageType: u.SUBSCRIPTION_PREFERENCE_CENTER,
13
13
  messageKey: "unsubscription-preference.duplicate-pref-center"
14
14
  }
15
- ], g = "unsubscription-preference.duplicate-both", b = "unsubscription-preference.select-page-to-continue", P = () => {
16
- const { showToaster: c } = E(), p = m();
17
- return { validateUnsubscribeBlockUniqueness: (n) => {
18
- const o = new DOMParser().parseFromString(n, "text/html"), r = /* @__PURE__ */ new Map();
19
- o.querySelectorAll(l).forEach((e) => {
20
- const s = Number(e.getAttribute(a.PAGE_TYPE));
21
- r.set(s, (r.get(s) ?? 0) + 1);
22
- });
23
- const t = T.filter((e) => (r.get(e.pageType) ?? 0) > 1).map((e) => e.messageKey);
24
- return t.length ? (c({
25
- type: i.Error,
26
- message: p(t.length > 1 ? g : t[0])
15
+ ], g = "unsubscription-preference.duplicate-both", E = "unsubscription-preference.select-page-to-continue";
16
+ function m(r) {
17
+ const s = new DOMParser().parseFromString(r, "text/html"), t = /* @__PURE__ */ new Map();
18
+ return s.querySelectorAll(i).forEach((n) => {
19
+ const e = Number(n.getAttribute(a.PAGE_TYPE));
20
+ t.set(e, (t.get(e) ?? 0) + 1);
21
+ }), T.filter((n) => (t.get(n.pageType) ?? 0) > 1);
22
+ }
23
+ function b(r) {
24
+ const s = new DOMParser().parseFromString(r, "text/html");
25
+ return Array.from(s.querySelectorAll(i)).filter((t) => {
26
+ const n = t.getAttribute(a.PAGE_TYPE), e = t.getAttribute(a.PAGE_LIST);
27
+ return !n || !e;
28
+ }).length;
29
+ }
30
+ const y = () => {
31
+ const { showToaster: r } = p(), s = l();
32
+ return { validateUnsubscribeBlockUniqueness: (e) => {
33
+ const o = m(e);
34
+ return o.length ? (r({
35
+ type: c.Error,
36
+ message: s(o.length > 1 ? g : o[0].messageKey)
27
37
  }), !1) : !0;
28
- }, validateUnsubscribeBlockHasTemplate: (n) => {
29
- const o = new DOMParser().parseFromString(n, "text/html");
30
- return Array.from(o.querySelectorAll(l)).some((t) => {
31
- const e = t.getAttribute(a.PAGE_TYPE), s = t.getAttribute(a.PAGE_LIST);
32
- return !e || !s;
33
- }) ? (c({
34
- type: i.Warning,
35
- message: p(b)
36
- }), !1) : !0;
37
- } };
38
+ }, validateUnsubscribeBlockHasTemplate: (e) => b(e) === 0 ? !0 : (r({
39
+ type: c.Warning,
40
+ message: s(E)
41
+ }), !1) };
38
42
  };
39
43
  export {
40
- P as useUnsubscribeBlockValidator
44
+ E as EMPTY_BLOCK_KEY,
45
+ b as countUnsubBlocksWithoutPage,
46
+ m as findDuplicateUnsubPageTypes,
47
+ y as useUnsubscribeBlockValidator
41
48
  };