@useinsider/guido 3.16.0-beta.20cd2fe → 3.16.0-beta.8645953

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 (79) hide show
  1. package/dist/@types/config/schemas.js +23 -25
  2. package/dist/components/Guido.vue.js +8 -8
  3. package/dist/components/Guido.vue2.js +78 -76
  4. package/dist/components/organisms/AutoSaveController.vue2.js +9 -8
  5. package/dist/components/organisms/header/AutoSaveToggle.vue.js +22 -0
  6. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
  7. package/dist/components/organisms/header/EditorActions.vue.js +11 -11
  8. package/dist/components/organisms/header/EditorActions.vue2.js +81 -34
  9. package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
  10. package/dist/components/organisms/header/LeftSlot.vue2.js +42 -25
  11. package/dist/components/organisms/header/MiddleSlot.vue.js +4 -4
  12. package/dist/components/organisms/header/MiddleSlot.vue2.js +7 -8
  13. package/dist/components/organisms/header/RightSlot.vue.js +6 -6
  14. package/dist/components/organisms/header/RightSlot.vue2.js +15 -17
  15. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +34 -43
  16. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
  17. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +61 -0
  18. package/dist/components/wrappers/WpDrawer.vue.js +9 -7
  19. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  20. package/dist/composables/useHtmlValidator.js +1 -0
  21. package/dist/composables/useSave.js +84 -41
  22. package/dist/composables/useSaveValidation.js +276 -0
  23. package/dist/composables/useSaveValidationRollout.js +9 -0
  24. package/dist/composables/validators/useCouponBlockValidator.js +24 -21
  25. package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
  26. package/dist/config/i18n/en/labels.json.js +4 -28
  27. package/dist/enums/save-validation.js +4 -0
  28. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +31 -24
  29. package/dist/guido.css +1 -1
  30. package/dist/node_modules/@vueuse/shared/index.js +28 -40
  31. package/dist/src/@types/config/schemas.d.ts +0 -4
  32. package/dist/src/@types/save-validation.d.ts +19 -0
  33. package/dist/src/components/Guido.vue.d.ts +17 -1
  34. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
  35. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
  36. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
  37. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
  38. package/dist/src/composables/useActionsApi.d.ts +2 -2
  39. package/dist/src/composables/useConfig.d.ts +0 -2
  40. package/dist/src/composables/useHtmlValidator.d.ts +14 -0
  41. package/dist/src/composables/useSave.d.ts +6 -1
  42. package/dist/src/composables/useSaveValidation.d.ts +6 -0
  43. package/dist/src/composables/useSaveValidationRollout.d.ts +3 -0
  44. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  45. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
  46. package/dist/src/enums/save-validation.d.ts +27 -0
  47. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +5 -0
  48. package/dist/src/stores/config.d.ts +5 -18
  49. package/dist/src/stores/editor.d.ts +0 -107
  50. package/dist/src/stores/onboarding.d.ts +0 -377
  51. package/dist/src/stores/save-validation.d.ts +22 -0
  52. package/dist/src/stores/version-history.d.ts +1 -1
  53. package/dist/src/utils/templatePreparation.d.ts +30 -0
  54. package/dist/src/utils/timeUtil.d.ts +0 -10
  55. package/dist/stores/config.js +13 -6
  56. package/dist/stores/editor.js +1 -5
  57. package/dist/stores/onboarding.js +11 -16
  58. package/dist/stores/save-validation.js +30 -0
  59. package/dist/utils/templatePreparation.js +28 -25
  60. package/dist/utils/timeUtil.js +17 -6
  61. package/package.json +1 -1
  62. package/dist/components/organisms/header/AutoSaveStatus.vue.js +0 -17
  63. package/dist/components/organisms/header/AutoSaveStatus.vue2.js +0 -21
  64. package/dist/components/organisms/header/EditorActionsMenu.vue.js +0 -20
  65. package/dist/components/organisms/header/EditorActionsMenu.vue2.js +0 -39
  66. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue.js +0 -18
  67. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue2.js +0 -37
  68. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue.js +0 -24
  69. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue2.js +0 -48
  70. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue.js +0 -18
  71. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue2.js +0 -74
  72. package/dist/composables/useAccessibilityApi.js +0 -31
  73. package/dist/node_modules/@vueuse/core/index.js +0 -102
  74. package/dist/src/components/organisms/header/accessibility/AccessibilityToolbar.vue.d.ts +0 -2
  75. package/dist/src/components/organisms/header/accessibility/ColorVisionSelect.vue.d.ts +0 -2
  76. package/dist/src/components/organisms/onboarding/EditorTabBarOnboarding.vue.d.ts +0 -2
  77. package/dist/src/composables/useAccessibilityApi.d.ts +0 -15
  78. /package/dist/src/components/organisms/header/{AutoSaveStatus.vue.d.ts → AutoSaveToggle.vue.d.ts} +0 -0
  79. /package/dist/src/components/organisms/{header/EditorActionsMenu.vue.d.ts → validation/ValidationErrorDrawer.vue.d.ts} +0 -0
@@ -1,51 +1,94 @@
1
- import { useActionsApi as T } from "./useActionsApi.js";
2
- import { useConfig as k } from "./useConfig.js";
3
- import { useSaveStart as B, useSaveComplete as E } from "./useGuidoActions.js";
4
- import { useSyncModuleExtractor as q } from "./useSyncModuleExtractor.js";
5
- import { ToasterTypeOptions as C } from "../enums/toaster.js";
1
+ import { useActionsApi as h } from "./useActionsApi.js";
2
+ import { useConfig as L } from "./useConfig.js";
3
+ import { useSaveStart as A, useSaveComplete as q } from "./useGuidoActions.js";
4
+ import { useSaveValidation as M } from "./useSaveValidation.js";
5
+ import { useSaveValidationRollout as R } from "./useSaveValidationRollout.js";
6
+ import { useSyncModuleExtractor as O } from "./useSyncModuleExtractor.js";
7
+ import { ToasterTypeOptions as W } from "../enums/toaster.js";
6
8
  import { useStripoApi as D } from "../services/stripoApi.js";
7
- import { useTemplatePreparation as L } from "../utils/templatePreparation.js";
8
- import { useAllowlist as P } from "./useAllowlist.js";
9
- import { useHtmlValidator as U } from "./useHtmlValidator.js";
10
- import { useToaster as A } from "./useToaster.js";
11
- import { useCouponBlockValidator as M } from "./validators/useCouponBlockValidator.js";
12
- import { useLiquidValidator as h } from "./validators/useLiquidValidator.js";
13
- import { useUnsubscribeBlockValidator as F } from "./validators/useUnsubscribeBlockValidator.js";
14
- const $ = () => {
15
- const n = B(), l = E(), { validateHtml: c } = U(), { validateLiquidSyntax: d } = h(), { validateCouponBlockTags: m } = M(), { validateUnsubscribeBlockUniqueness: u, validateUnsubscribeBlockHasTemplate: p } = F(), { callbacks: e, isFeatureEnabled: a } = k(), { extractSyncModuleData: f } = q(), { setSyncModuleUnsubscriptionPages: v } = D(), { editorSave: S } = T(), { showToaster: b } = A(), { getBlockedDomains: w, resolveToast: V } = P();
16
- return { save: async (y = !1, s = !1) => {
17
- var r;
18
- n();
19
- const { prepareTemplateDetails: H } = L(), t = await H();
20
- if (!m(t.compiledHtml) || !u(t.compiledHtml) || !p(t.compiledHtml))
9
+ import { useConfigStore as F } from "../stores/config.js";
10
+ import { useDynamicContentStore as j } from "../stores/dynamic-content.js";
11
+ import { useSaveValidationStore as z } from "../stores/save-validation.js";
12
+ import { useTemplatePreparation as G, getHtmlReferencedUnsubscribePages as I } from "../utils/templatePreparation.js";
13
+ import { useAllowlist as J } from "./useAllowlist.js";
14
+ import { useHtmlValidator as K } from "./useHtmlValidator.js";
15
+ import { useToaster as N } from "./useToaster.js";
16
+ import { useCouponBlockValidator as Q } from "./validators/useCouponBlockValidator.js";
17
+ import { useLiquidValidator as X } from "./validators/useLiquidValidator.js";
18
+ import { useUnsubscribeBlockValidator as Y } from "./validators/useUnsubscribeBlockValidator.js";
19
+ const bt = () => {
20
+ const n = A(), d = q(), { validateHtml: u } = K(), { validateLiquidSyntax: f } = X(), { validateCouponBlockTags: p } = Q(), { validateUnsubscribeBlockUniqueness: v, validateUnsubscribeBlockHasTemplate: y } = Y(), { callbacks: a, isFeatureEnabled: c } = L(), { extractSyncModuleData: S } = O(), { setSyncModuleUnsubscriptionPages: b } = D(), { editorSave: g, getTemplateData: w } = h(), { showToaster: H } = N(), { getBlockedDomains: V, resolveToast: C } = J(), { prepareTemplateDetails: m } = G(), { collectSaveValidationErrors: E } = M(), { isEnabled: x } = R(), k = z(), T = j(), B = F(), r = async (t, e, o) => {
21
+ if (!c("allowlistEnabled"))
22
+ return !1;
23
+ const i = await V(t, e);
24
+ if (!i.length)
25
+ return !1;
26
+ if (!o) {
27
+ const s = await C(i);
28
+ s != null && s.message && H({
29
+ type: W.Warning,
30
+ message: s.message,
31
+ actionButton: s.actionButton
32
+ });
33
+ }
34
+ return !0;
35
+ }, P = async (t) => !p(t.compiledHtml) || !v(t.compiledHtml) || !y(t.compiledHtml) ? !1 : c("liquidSyntax") ? f(t.compiledHtml) : u(t.compiledHtml, t.dynamicContentList, !0), l = async (t, e) => {
36
+ if (!await g())
21
37
  return;
22
- if (a("liquidSyntax")) {
23
- if (!await d(t.compiledHtml))
38
+ const { unsubscribePayload: i, stripoModules: s } = S(t.rawHtml);
39
+ if (await b(i), t.modules = s, !e.suppress) {
40
+ const U = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
41
+ d({ ...t, ...U, silent: e.silent });
42
+ }
43
+ return t;
44
+ };
45
+ return { save: async (t = !1, e = !1) => {
46
+ var i;
47
+ n();
48
+ const o = await m();
49
+ if (x.value && !t && !e) {
50
+ const s = await E(
51
+ o.compiledHtml,
52
+ o.dynamicContentList
53
+ );
54
+ if (s.length) {
55
+ k.open(s, "save");
24
56
  return;
25
- } else if (!await c(t.compiledHtml, t.dynamicContentList, !0))
57
+ }
58
+ } else if (!await P(o))
26
59
  return;
27
- if ((r = e.value) != null && r.externalValidation && !await e.value.externalValidation(t))
60
+ if (!((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(o)) && !await r(o.compiledHtml, o.css, e))
61
+ return l(o, { silent: e, suppress: t });
62
+ }, saveWithErrors: async () => {
63
+ var e;
64
+ if (B.isTransactional)
28
65
  return;
29
- if (a("allowlistEnabled")) {
30
- const i = await w(t.compiledHtml, t.css);
31
- if (i.length) {
32
- if (!s) {
33
- const o = await V(i);
34
- o != null && o.message && b({
35
- type: C.Warning,
36
- message: o.message,
37
- actionButton: o.actionButton
38
- });
39
- }
40
- return;
41
- }
42
- }
43
- if (!await S())
66
+ n();
67
+ const t = await m();
68
+ if (!((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)) && !await r(t.compiledHtml, t.css, !1))
69
+ return l(t, { silent: !1, blankCompiled: !0 });
70
+ }, saveRawOnly: async () => {
71
+ n();
72
+ const { html: t, css: e } = await w();
73
+ if (await r(t, e, !0))
44
74
  return;
45
- const { unsubscribePayload: g, stripoModules: x } = f(t.rawHtml);
46
- return await v(g), t.modules = x, y || l({ ...t, silent: s }), t;
75
+ const o = I(t), i = {
76
+ dynamicContentList: T.getSelectedDynamicContentList,
77
+ compiledHtml: "",
78
+ rawHtml: t,
79
+ css: e,
80
+ ampHtml: "",
81
+ ampErrors: [],
82
+ modules: [],
83
+ recommendation: { campaignUrls: {}, configs: {} },
84
+ unsubscribe: {
85
+ status: o.length > 0,
86
+ config: o
87
+ }
88
+ };
89
+ return l(i, { silent: !0 });
47
90
  } };
48
91
  };
49
92
  export {
50
- $ as useSave
93
+ bt as useSave
51
94
  };
@@ -0,0 +1,276 @@
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 U } from "../extensions/Blocks/Checkbox/constants/selectors.js";
6
+ import { itemsBlockDynamicVariables as M } 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 { RecommendationRequiredFieldsKey as G } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
10
+ import { useConfigStore as q } from "../stores/config.js";
11
+ import { useDynamicContentStore as H } from "../stores/dynamic-content.js";
12
+ import { useRecommendationStore as V } from "../stores/recommendation.js";
13
+ import { base64EncodeWithSpecialChars as T } from "../utils/base64.js";
14
+ import { useTemplatePreparation as X } from "../utils/templatePreparation.js";
15
+ import { useActionsApi as j } from "./useActionsApi.js";
16
+ import { useConfig as z } from "./useConfig.js";
17
+ import { useHtmlCompiler as $ } from "./useHtmlCompiler.js";
18
+ import { buildPartnerAttributeNameSet as Q, getInvalidDynamicContentTags as Z, findInvalidCustomFields as J } from "./useHtmlValidator.js";
19
+ import { useHttp as tt } from "./useHttp.js";
20
+ import { useTranslations as et } from "./useTranslations.js";
21
+ import { findInvalidCouponBlocks as nt, COUPON_TAG_MODIFIED_KEY as it } from "./validators/useCouponBlockValidator.js";
22
+ import { findDuplicateUnsubPageTypes as ot, countUnsubBlocksWithoutPage as rt, EMPTY_BLOCK_KEY as st } from "./validators/useUnsubscribeBlockValidator.js";
23
+ const at = "newsletter.html-content-is-empty", ct = "custom-fields.missing-closing-braces", lt = "custom-fields.missing-opening-braces", I = "custom-fields.invalid-custom-fields", ut = "newsletter.display-conditions-invalid-syntax", mt = "custom-conditions.wrong-equality-operators", dt = "custom-conditions.missing-if-endif-tag", pt = "custom-conditions.no-space-after-braces", gt = "custom-conditions.no-braces-inside-if-tag", ft = "newsletter.fill-all-necessary-fields", yt = "newsletter.invalid-image-type", Et = "unsubscribe-templates.select-checkbox-groups", It = "unsubscribe-templates.select-radio-button-groups", St = "newsletter.invalid-url-link-for-toaster", F = "journey-builder.liquid-validation-failed", Ct = "/newsletter/template-library/check-template-html-body", _t = /src="[^"]*\.(svg|pst)"/gm, L = /({%(.*?)%})/g, ht = ["if", "endif", "else", "elif", "now"], kt = (e) => !ht.includes(e.toLowerCase()), Tt = (e) => ["if", "endif"].includes(e.toLowerCase());
24
+ function Ft(e) {
25
+ return nt(e).map((i) => ({
26
+ rule: o.CouponTagModified,
27
+ type: r.Warning,
28
+ key: it,
29
+ detail: i
30
+ }));
31
+ }
32
+ function Ot(e) {
33
+ return ot(e).map((i) => ({
34
+ rule: o.DuplicateUnsubBlock,
35
+ type: r.Error,
36
+ key: i.messageKey
37
+ }));
38
+ }
39
+ function Lt(e) {
40
+ return Array.from({ length: rt(e) }, () => ({
41
+ rule: o.UnsubBlockMissingTemplate,
42
+ type: r.Warning,
43
+ key: st
44
+ }));
45
+ }
46
+ function Nt(e, i) {
47
+ const n = e.match(L);
48
+ if (!n)
49
+ return [];
50
+ const a = [];
51
+ return n.forEach((u) => {
52
+ const s = u.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
53
+ if (s && s.length > 0) {
54
+ const [m] = s;
55
+ kt(m) && !i.includes(m) && a.push({
56
+ rule: o.CustomFieldScript,
57
+ type: r.Warning,
58
+ key: I,
59
+ detail: m
60
+ });
61
+ }
62
+ }), a;
63
+ }
64
+ function Rt(e) {
65
+ return e.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: at }];
66
+ }
67
+ function At(e) {
68
+ const i = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
69
+ return i > n ? [{
70
+ rule: o.MismatchedBraces,
71
+ type: r.Warning,
72
+ key: ct
73
+ }] : i < n ? [{
74
+ rule: o.MismatchedBraces,
75
+ type: r.Warning,
76
+ key: lt
77
+ }] : [];
78
+ }
79
+ function bt(e) {
80
+ return Z(e).map((i) => ({
81
+ rule: o.InvalidDynamicTag,
82
+ type: r.Warning,
83
+ key: I,
84
+ detail: i
85
+ }));
86
+ }
87
+ function Dt(e, i, n, a) {
88
+ const u = [...e.matchAll(/recommendation-id="(\d+)"/g)].map((s) => s[1]);
89
+ return J(e, i, u, n, a).map((s) => ({
90
+ rule: o.InvalidCustomField,
91
+ type: r.Error,
92
+ key: I,
93
+ detail: s
94
+ }));
95
+ }
96
+ function vt(e) {
97
+ const i = e.match(/{%(.*?)%}/g), n = [], a = [];
98
+ if (i && i.forEach((u) => {
99
+ const s = u.match(Y), m = u.match(x), y = (s == null ? void 0 : s.join("")) || "";
100
+ (!s || u !== y) && !m && a.push({
101
+ rule: o.ConditionsSyntax,
102
+ type: r.Error,
103
+ key: ut,
104
+ detail: u
105
+ }), s && s.forEach((g) => {
106
+ g.trim() === "=" && a.push({
107
+ rule: o.WrongEqualityOperator,
108
+ type: r.Error,
109
+ key: mt
110
+ }), (g.match(/^[a-zA-Z]*$/g) ?? []).forEach((f) => {
111
+ Tt(f) && n.push(f);
112
+ });
113
+ });
114
+ }), n.length) {
115
+ const u = n.filter((m) => m === "if").length, s = n.filter((m) => m === "endif").length;
116
+ u !== s && a.push({
117
+ rule: o.MissingIfEndif,
118
+ type: r.Error,
119
+ key: dt
120
+ });
121
+ }
122
+ return a;
123
+ }
124
+ function Kt(e) {
125
+ const i = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length;
126
+ return i === n ? [] : [{
127
+ rule: o.ConditionTagSpacing,
128
+ type: r.Warning,
129
+ key: pt
130
+ }];
131
+ }
132
+ function wt(e) {
133
+ return (e.match(L) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, a) => n + a, 0) === 0 ? [] : [{
134
+ rule: o.BracesInsideIfTag,
135
+ type: r.Warning,
136
+ key: gt
137
+ }];
138
+ }
139
+ function Bt(e) {
140
+ return (e.match(_t) ?? []).map((i) => ({
141
+ rule: o.InvalidImageType,
142
+ type: r.Error,
143
+ key: yt,
144
+ detail: i
145
+ }));
146
+ }
147
+ function O(e, i, n, a) {
148
+ const u = new DOMParser().parseFromString(e, "text/html");
149
+ return Array.from(u.querySelectorAll(i)).filter((s) => {
150
+ var m;
151
+ return !((m = s.id) != null && m.trim());
152
+ }).map(() => ({ rule: n, type: r.Error, key: a }));
153
+ }
154
+ const se = () => {
155
+ const { config: e, isFeatureEnabled: i } = z(), n = et(), { post: a } = tt(), { getCompiledEmail: u, getTemplateData: s } = j(), { compileHtml: m } = $(), { hydrateRecommendationStore: y } = X(), g = H(), f = V(), E = W(), N = q(), R = (t) => ({
156
+ rule: t.rule,
157
+ type: t.type,
158
+ detail: t.detail,
159
+ message: "key" in t ? n(t.key) : t.message
160
+ }), A = async (t) => {
161
+ if (t.size === 0)
162
+ return /* @__PURE__ */ new Set();
163
+ try {
164
+ await E.fetchRecommendationFilters();
165
+ } catch {
166
+ return null;
167
+ }
168
+ return Q(E.filterList);
169
+ }, b = async (t) => {
170
+ try {
171
+ const l = await a(Ct, { html: T(t) }), { status: c, message: d } = l.data, p = [];
172
+ return c || p.push({
173
+ rule: o.InvalidLinks,
174
+ type: r.Error,
175
+ ...c === void 0 ? { message: d } : { key: St }
176
+ }), d === n(k) && p.push({
177
+ rule: o.LinkCheckInProgress,
178
+ type: r.Error,
179
+ key: k
180
+ }), p;
181
+ } catch (l) {
182
+ return console.warn("Link-check collector failed; skipping the link rule.", l), [];
183
+ }
184
+ }, D = async (t) => {
185
+ try {
186
+ const l = await a("/newsletter/contents/validate-syntax", [{
187
+ identifier: "default",
188
+ syntax: "liquid",
189
+ contents: {
190
+ subject: null,
191
+ preheader: null,
192
+ html: T(t),
193
+ ampHtml: null
194
+ }
195
+ }]);
196
+ if (!Array.isArray(l.data)) {
197
+ const d = l.data;
198
+ return [{
199
+ rule: o.LiquidSyntax,
200
+ type: r.Warning,
201
+ message: d.message ?? n(F)
202
+ }];
203
+ }
204
+ const [c] = l.data;
205
+ return Object.values((c == null ? void 0 : c.errors) ?? {}).map((d) => ({
206
+ rule: o.LiquidSyntax,
207
+ type: r.Warning,
208
+ message: d.replace(/^line \d+:\s*/, "")
209
+ }));
210
+ } catch {
211
+ return [{
212
+ rule: o.LiquidSyntax,
213
+ type: r.Error,
214
+ message: n(F)
215
+ }];
216
+ }
217
+ }, v = () => {
218
+ const t = E.invalidBlockIds().map((c) => ({
219
+ rule: o.RecommendationRequiredFields,
220
+ type: r.Error,
221
+ key: G,
222
+ detail: c
223
+ })), l = (f.recommendationConfigs ?? []).filter((c) => c.filters.some((d) => d.value === "")).map(() => ({
224
+ rule: o.RecommendationFilters,
225
+ type: r.Error,
226
+ key: ft
227
+ }));
228
+ return [...t, ...l];
229
+ }, K = async (t, l) => {
230
+ var _, h;
231
+ const c = [
232
+ ...l.map((w) => w.value),
233
+ ...M,
234
+ ...((h = (_ = e.value) == null ? void 0 : _.template) == null ? void 0 : h.customFieldAttributes) ?? []
235
+ ], d = B(t), p = await A(d), { isTransactional: C } = N;
236
+ return [
237
+ ...await b(t),
238
+ ...C ? [] : Nt(t, c),
239
+ ...Rt(t),
240
+ ...At(t),
241
+ ...bt(t),
242
+ ...C ? [] : Dt(t, c, d, p),
243
+ ...vt(t),
244
+ ...Kt(t),
245
+ ...wt(t),
246
+ ...v(),
247
+ ...Bt(t),
248
+ ...O(
249
+ t,
250
+ U,
251
+ o.CheckboxUnsubGroup,
252
+ Et
253
+ ),
254
+ ...O(
255
+ t,
256
+ P,
257
+ o.RadioButtonUnsubGroup,
258
+ It
259
+ )
260
+ ];
261
+ }, S = async (t, l) => [
262
+ ...Ft(t),
263
+ ...Ot(t),
264
+ ...Lt(t),
265
+ ...i("liquidSyntax") ? await D(t) : await K(t, l)
266
+ ].map(R);
267
+ return { collectSaveValidationErrors: S, validateCurrentTemplate: async () => {
268
+ const { html: t } = await s();
269
+ await y(t);
270
+ const { html: l } = await u({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: c } = m(l);
271
+ return S(c, g.getSelectedDynamicContentList);
272
+ } };
273
+ };
274
+ export {
275
+ se as useSaveValidation
276
+ };
@@ -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
  };
@@ -1,43 +1,19 @@
1
- const e = "Items", o = "Default", i = "Custom", t = {
1
+ const e = "Items", o = "Default", t = "Custom", s = {
2
2
  "Global Styles & Layout": "Global Styles and Layout",
3
3
  "Structures & Modules": "Structures and Modules",
4
4
  "Recommendation Block": "Recommendation",
5
5
  Items: e,
6
6
  "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.",
7
7
  "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.",
8
- "email-editor.a11y-hide-images": "Hide images",
9
- "email-editor.a11y-show-images": "Show images",
10
- "email-editor.cvd-none": "No Color Deficiency",
11
- "email-editor.cvd-protanopia": "Protanopia",
12
- "email-editor.cvd-protanopia-description": "Causes red-green confusion and makes reds appear darker.",
13
- "email-editor.cvd-deuteranopia": "Deuteranopia",
14
- "email-editor.cvd-deuteranopia-description": "Causes red-green confusion.",
15
- "email-editor.cvd-tritanopia": "Tritanopia",
16
- "email-editor.cvd-tritanopia-description": "Causes blue-yellow confusion.",
17
- "email-editor.cvd-achromatopsia": "Achromatopsia",
18
- "email-editor.cvd-achromatopsia-description": "Causes complete color blindness.",
19
- "email-editor.more-actions": "More actions",
20
- "email-editor.preferences": "Preferences",
21
- "email-editor.actions": "Actions",
22
- "email-editor.accessibility-test": "Accessibility Test",
23
- "email-editor.autosaved-at-today": "Autosaved at {time}, Today",
24
- "email-editor.autosaved-at-date": "Autosaved at {date}",
25
- "email-editor.export-html": "Export HTML",
26
- "email-editor.onboarding-kebab-title": "Discover Preferences and Actions",
27
- "email-editor.onboarding-kebab-description": "You can now access your Preferences and Actions easily such as Autosave, Export HTML, Version History, Accessibility Test and Save As Template.",
28
- "email-editor.onboarding-autosave-title": "Autosave Your Design",
29
- "email-editor.onboarding-autosave-description": "You can save your design automatically by enabling Autosave without losing your work.",
30
- "email-editor.onboarding-accessibility-title": "Test Accessibility of Your Design",
31
- "email-editor.onboarding-accessibility-description": "You can test the accessibility of your design to see the Failed, Passed items and update the Failed ones accordingly.",
32
8
  "Pixel Tracking Opt-in": "Pixel Tracking Opt-in",
33
9
  "OPT-IN SELECTION": "OPT-IN SELECTION",
34
10
  "UNSUBSCRIBE GROUPS": "UNSUBSCRIBE GROUPS",
35
11
  Default: o,
36
- Custom: i
12
+ Custom: t
37
13
  };
38
14
  export {
39
- i as Custom,
15
+ t as Custom,
40
16
  o as Default,
41
17
  e as Items,
42
- t as default
18
+ s as default
43
19
  };
@@ -0,0 +1,4 @@
1
+ var n = /* @__PURE__ */ ((s) => (s.CouponTagModified = "coupon-tag-modified", s.DuplicateUnsubBlock = "duplicate-unsub-block", s.UnsubBlockMissingTemplate = "unsub-block-missing-template", s.LiquidSyntax = "liquid-syntax", s.InvalidLinks = "invalid-links", s.LinkCheckInProgress = "link-check-in-progress", s.CustomFieldScript = "custom-field-script", s.EmptyHtml = "empty-html", s.MismatchedBraces = "mismatched-braces", s.InvalidDynamicTag = "invalid-dynamic-tag", s.InvalidCustomField = "invalid-custom-field", s.ConditionsSyntax = "conditions-syntax", s.WrongEqualityOperator = "wrong-equality-operator", s.MissingIfEndif = "missing-if-endif", s.ConditionTagSpacing = "condition-tag-spacing", s.BracesInsideIfTag = "braces-inside-if-tag", s.RecommendationRequiredFields = "recommendation-required-fields", s.RecommendationFilters = "recommendation-filters", s.InvalidImageType = "invalid-image-type", s.CheckboxUnsubGroup = "checkbox-unsub-group", s.RadioButtonUnsubGroup = "radio-button-unsub-group", s))(n || {});
2
+ export {
3
+ n as SaveValidationRule
4
+ };