@useinsider/guido 3.23.0 → 3.24.0-beta.88c24c1

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 (70) hide show
  1. package/README.md +2 -0
  2. package/dist/@types/config/schemas.js +21 -18
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +103 -92
  5. package/dist/components/organisms/AutoSaveController.vue2.js +20 -10
  6. package/dist/components/organisms/header/AutoSaveStatus.vue.js +17 -0
  7. package/dist/components/organisms/header/AutoSaveStatus.vue2.js +25 -0
  8. package/dist/components/organisms/header/EditorActions.vue.js +13 -13
  9. package/dist/components/organisms/header/EditorActions.vue2.js +58 -73
  10. package/dist/components/organisms/header/EditorActionsMenu.vue.js +20 -0
  11. package/dist/components/organisms/header/EditorActionsMenu.vue2.js +99 -0
  12. package/dist/components/organisms/header/HeaderWrapper.vue.js +6 -6
  13. package/dist/components/organisms/header/HeaderWrapper.vue2.js +9 -17
  14. package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
  15. package/dist/components/organisms/header/LeftSlot.vue2.js +28 -23
  16. package/dist/components/organisms/header/MiddleSlot.vue.js +4 -4
  17. package/dist/components/organisms/header/MiddleSlot.vue2.js +8 -7
  18. package/dist/components/organisms/header/RightSlot.vue.js +11 -10
  19. package/dist/components/organisms/header/RightSlot.vue2.js +13 -18
  20. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue.js +18 -0
  21. package/dist/components/organisms/header/accessibility/AccessibilityToolbar.vue2.js +37 -0
  22. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue.js +22 -0
  23. package/dist/components/organisms/header/accessibility/ColorVisionSelect.vue2.js +48 -0
  24. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue.js +19 -0
  25. package/dist/components/organisms/onboarding/EditorTabBarOnboarding.vue2.js +90 -0
  26. package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +12 -12
  27. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +60 -35
  28. package/dist/composables/useAccessibilityApi.js +51 -0
  29. package/dist/composables/useCustomInterfaceAppearance.js +42 -41
  30. package/dist/composables/useSave.js +57 -52
  31. package/dist/composables/useSaveValidation.js +118 -110
  32. package/dist/composables/validators/useUnsubscribeBlockValidator.js +48 -33
  33. package/dist/config/i18n/en/labels.json.js +36 -4
  34. package/dist/config/i18n/en/tooltips.json.js +2 -1
  35. package/dist/enums/save-validation.js +1 -1
  36. package/dist/guido.css +1 -1
  37. package/dist/package.json.js +2 -2
  38. package/dist/sprite.svg +10 -0
  39. package/dist/src/@types/config/schemas.d.ts +6 -0
  40. package/dist/src/components/organisms/AutoSaveController.vue.d.ts +19 -1
  41. package/dist/src/components/organisms/header/EditorActionsMenu.vue.d.ts +2 -0
  42. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -19
  43. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -19
  44. package/dist/src/components/organisms/header/accessibility/AccessibilityToolbar.vue.d.ts +2 -0
  45. package/dist/src/components/organisms/header/accessibility/ColorVisionSelect.vue.d.ts +2 -0
  46. package/dist/src/components/organisms/onboarding/EditorTabBarOnboarding.vue.d.ts +2 -0
  47. package/dist/src/composables/useAccessibilityApi.d.ts +13 -0
  48. package/dist/src/composables/useActionsApi.d.ts +2 -2
  49. package/dist/src/composables/useConfig.d.ts +4 -0
  50. package/dist/src/composables/useSaveValidation.d.ts +1 -1
  51. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +4 -0
  52. package/dist/src/enums/save-validation.d.ts +2 -1
  53. package/dist/src/stores/autosave.d.ts +73 -1
  54. package/dist/src/stores/config.d.ts +40 -0
  55. package/dist/src/stores/editor.d.ts +109 -0
  56. package/dist/src/stores/onboarding.d.ts +966 -35
  57. package/dist/src/stores/version-history.d.ts +1 -1
  58. package/dist/src/utils/templatePreparation.d.ts +1 -1
  59. package/dist/src/utils/timeUtil.d.ts +5 -8
  60. package/dist/static/stripo-runtime-manifest.json.js +1 -1
  61. package/dist/static/styles/components/accessibility.css.js +234 -0
  62. package/dist/static/styles/variables.css.js +2 -0
  63. package/dist/stores/autosave.js +12 -7
  64. package/dist/stores/editor.js +8 -3
  65. package/dist/stores/onboarding.js +48 -22
  66. package/dist/utils/timeUtil.js +6 -17
  67. package/package.json +2 -2
  68. package/dist/components/organisms/header/AutoSaveToggle.vue.js +0 -22
  69. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +0 -19
  70. /package/dist/src/components/organisms/header/{AutoSaveToggle.vue.d.ts → AutoSaveStatus.vue.d.ts} +0 -0
@@ -1,91 +1,96 @@
1
- import { useActionsApi as q } from "./useActionsApi.js";
2
- import { useConfig as O } from "./useConfig.js";
3
- import { useEditorLock as D } from "./useEditorLock.js";
4
- import { useSaveStart as F, useSaveComplete as j } from "./useGuidoActions.js";
5
- import { useSaveValidation as z } from "./useSaveValidation.js";
6
- import { useSaveValidationRollout as G } from "./useSaveValidationRollout.js";
7
- import { useSyncModuleExtractor as I } from "./useSyncModuleExtractor.js";
1
+ import { useActionsApi as O } from "./useActionsApi.js";
2
+ import { useConfig as D } from "./useConfig.js";
3
+ import { useEditorLock as F } from "./useEditorLock.js";
4
+ import { useSaveStart as I, useSaveComplete as N } from "./useGuidoActions.js";
5
+ import { useSaveValidation as j } from "./useSaveValidation.js";
6
+ import { useSaveValidationRollout as z } from "./useSaveValidationRollout.js";
7
+ import { useSyncModuleExtractor as G } from "./useSyncModuleExtractor.js";
8
8
  import { ToasterTypeOptions as J } from "../enums/toaster.js";
9
9
  import { useStripoApi as K } from "../services/stripoApi.js";
10
- import { useConfigStore as N } from "../stores/config.js";
11
- import { useDynamicContentStore as Q } from "../stores/dynamic-content.js";
12
- import { useSaveValidationStore as X } from "../stores/save-validation.js";
13
- import { useTemplatePreparation as Y, getHtmlReferencedUnsubscribePages as Z } from "../utils/templatePreparation.js";
14
- import { useAllowlist as _ } from "./useAllowlist.js";
15
- import { useHtmlValidator as $ } from "./useHtmlValidator.js";
16
- import { useToaster as tt } from "./useToaster.js";
17
- import { useCouponBlockValidator as et } from "./validators/useCouponBlockValidator.js";
18
- import { useHtmlDocumentCountValidator as ot } from "./validators/useHtmlDocumentCountValidator.js";
19
- import { useLiquidValidator as it } from "./validators/useLiquidValidator.js";
20
- import { useSyncModuleBlockValidator as st } from "./validators/useSyncModuleBlockValidator.js";
10
+ import { useConfigStore as Q } from "../stores/config.js";
11
+ import { useDynamicContentStore as X } from "../stores/dynamic-content.js";
12
+ import { useSaveValidationStore as Y } from "../stores/save-validation.js";
13
+ import { useTemplatePreparation as Z, getHtmlReferencedUnsubscribePages as _ } from "../utils/templatePreparation.js";
14
+ import { useAllowlist as $ } from "./useAllowlist.js";
15
+ import { useHtmlValidator as tt } from "./useHtmlValidator.js";
16
+ import { useToaster as et } from "./useToaster.js";
17
+ import { useCouponBlockValidator as ot } from "./validators/useCouponBlockValidator.js";
18
+ import { useHtmlDocumentCountValidator as it } from "./validators/useHtmlDocumentCountValidator.js";
19
+ import { useLiquidValidator as st } from "./validators/useLiquidValidator.js";
20
+ import { useSyncModuleBlockValidator as rt } from "./validators/useSyncModuleBlockValidator.js";
21
21
  import { useUnsubscribeBlockValidator as at } from "./validators/useUnsubscribeBlockValidator.js";
22
22
  const Pt = () => {
23
- const n = F(), w = j(), { validateHtml: y } = $(), { validateLiquidSyntax: E } = it(), { validateCouponBlockTags: b } = et(), { validateUnsubscribeBlockUniqueness: g, validateUnsubscribeBlockHasTemplate: H } = at(), { validateSyncModuleBlocks: l } = st(), { validateSingleHtmlDocument: c } = ot(), { callbacks: r, isFeatureEnabled: v } = O(), { extractSyncModuleData: V } = I(), { setSyncModuleUnsubscriptionPages: x } = K(), { editorSave: C, getTemplateData: u } = q(), { showToaster: k } = tt(), { getBlockedDomains: h, resolveToast: B } = _(), { prepareTemplateDetails: p } = Y(), { collectSaveValidationErrors: T } = z(), { isEnabled: P } = G(), L = X(), U = Q(), S = N(), { runExclusive: m } = D(), d = async (t, e, i) => {
24
- if (!v("allowlistEnabled"))
23
+ const n = I(), S = N(), { validateHtml: y } = tt(), { validateLiquidSyntax: b } = st(), { validateCouponBlockTags: H } = ot(), {
24
+ validateUnsubscribeBlockUniqueness: E,
25
+ validateUnsubscribeBlockHasTemplate: g,
26
+ validateNoInsiderUnsubscribeCode: V
27
+ } = at(), { validateSyncModuleBlocks: l } = rt(), { validateSingleHtmlDocument: c } = it(), { callbacks: a, isFeatureEnabled: u } = D(), { extractSyncModuleData: x } = G(), { setSyncModuleUnsubscriptionPages: k } = K(), { editorSave: C, getTemplateData: m } = O(), { showToaster: h } = et(), { getBlockedDomains: B, resolveToast: T } = $(), { prepareTemplateDetails: p } = Z(), { collectSaveValidationErrors: L } = j(), { isEnabled: P } = z(), U = Y(), A = X(), w = Q(), { runExclusive: d } = F(), f = async (t, e, i) => {
28
+ if (!u("allowlistEnabled"))
25
29
  return !1;
26
- const o = await h(t, e);
30
+ const o = await B(t, e);
27
31
  if (!o.length)
28
32
  return !1;
29
33
  if (!i) {
30
- const s = await B(o);
31
- s != null && s.message && k({
34
+ const s = await T(o);
35
+ s != null && s.message && h({
32
36
  type: J.Warning,
33
37
  message: s.message,
34
38
  actionButton: s.actionButton
35
39
  });
36
40
  }
37
41
  return !0;
38
- }, A = async (t) => !b(t.compiledHtml) || !g(t.compiledHtml) || !H(t.compiledHtml) ? !1 : v("liquidSyntax") ? E(t.compiledHtml) : y(t.compiledHtml, t.dynamicContentList, !0), f = async (t, e) => {
42
+ }, M = async (t, e) => !H(t.compiledHtml) || u("blockUnsubscribeLinks") && !V(t.rawHtml, e) || !E(t.compiledHtml) || !g(t.compiledHtml) ? !1 : u("liquidSyntax") ? b(t.compiledHtml) : y(t.compiledHtml, t.dynamicContentList, !0), v = async (t, e) => {
39
43
  if (!await C())
40
44
  return;
41
- const { unsubscribePayload: o, stripoModules: s } = V(t.rawHtml);
42
- if (await x(o), t.modules = s, !e.suppress) {
43
- const a = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
44
- w({ ...t, ...a, silent: e.silent });
45
+ const { unsubscribePayload: o, stripoModules: s } = x(t.rawHtml);
46
+ if (await k(o), t.modules = s, !e.suppress) {
47
+ const r = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
48
+ S({ ...t, ...r, silent: e.silent });
45
49
  }
46
50
  return t;
47
- }, M = async (t, e) => {
51
+ }, W = async (t, e) => {
48
52
  var s;
49
53
  n();
50
- const i = await u();
54
+ const i = await m();
51
55
  if (!c(i.html, e))
52
56
  return;
53
57
  const o = await p(i);
54
58
  if (l(o.rawHtml, e)) {
55
59
  if (P.value && !e) {
56
- const a = await T(
60
+ const r = await L(
57
61
  o.compiledHtml,
58
- o.dynamicContentList
62
+ o.dynamicContentList,
63
+ o.rawHtml
59
64
  );
60
- if (a.length) {
61
- L.open(a, "save");
65
+ if (r.length) {
66
+ U.open(r, "save");
62
67
  return;
63
68
  }
64
- } else if (!await A(o))
69
+ } else if (!await M(o, e))
65
70
  return;
66
- if (!((s = r.value) != null && s.externalValidation && !await r.value.externalValidation(o)) && !await d(o.compiledHtml, o.css, e))
67
- return f(o, { silent: e, suppress: t });
71
+ if (!((s = a.value) != null && s.externalValidation && !await a.value.externalValidation(o)) && !await f(o.compiledHtml, o.css, e))
72
+ return v(o, { silent: e, suppress: t });
68
73
  }
69
- }, W = async () => {
74
+ }, R = async () => {
70
75
  var i;
71
- if (!S.allowSaveWithErrors)
76
+ if (!w.allowSaveWithErrors)
72
77
  return;
73
78
  n();
74
- const t = await u();
79
+ const t = await m();
75
80
  if (!c(t.html, !1))
76
81
  return;
77
82
  const e = await p(t);
78
- if (l(e.rawHtml, !1) && !((i = r.value) != null && i.externalValidation && !await r.value.externalValidation(e)) && !await d(e.compiledHtml, e.css, !1))
79
- return f(e, { silent: !1, blankCompiled: !0 });
80
- }, R = async () => {
81
- if (!S.allowSaveWithErrors)
83
+ if (l(e.rawHtml, !1) && !((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(e)) && !await f(e.compiledHtml, e.css, !1))
84
+ return v(e, { silent: !1, blankCompiled: !0 });
85
+ }, q = async () => {
86
+ if (!w.allowSaveWithErrors)
82
87
  return;
83
88
  n();
84
- const { html: t, css: e } = await u();
85
- if (!c(t, !0) || !l(t, !0) || await d(t, e, !0))
89
+ const { html: t, css: e } = await m();
90
+ if (!c(t, !0) || !l(t, !0) || await f(t, e, !0))
86
91
  return;
87
- const i = Z(t), o = {
88
- dynamicContentList: U.getSelectedDynamicContentList,
92
+ const i = _(t), o = {
93
+ dynamicContentList: A.getSelectedDynamicContentList,
89
94
  compiledHtml: "",
90
95
  rawHtml: t,
91
96
  css: e,
@@ -99,11 +104,11 @@ const Pt = () => {
99
104
  config: i
100
105
  }
101
106
  };
102
- return f(o, { silent: !0 });
107
+ return v(o, { silent: !0 });
103
108
  };
104
- return { save: (t = !1, e = !1) => m(
105
- () => M(t, e)
106
- ), saveWithErrors: () => m(W), saveRawOnly: () => m(R) };
109
+ return { save: (t = !1, e = !1) => d(
110
+ () => W(t, e)
111
+ ), saveWithErrors: () => d(R), saveRawOnly: () => d(q) };
107
112
  };
108
113
  export {
109
114
  Pt as useSave
@@ -1,11 +1,11 @@
1
1
  import { getIgnoredRecommendationBlockIds as Y } from "../config/compiler/utils/recommendationIgnoreUtils.js";
2
- import { CanNotMakeAnyChangesForRunningKey as k, DISPLAY_CONDITIONS_REGEX as x, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as M } from "../enums/html-validator.js";
2
+ import { CanNotMakeAnyChangesForRunningKey as k, DISPLAY_CONDITIONS_REGEX as U, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as M } from "../enums/html-validator.js";
3
3
  import { SaveValidationRule as o } from "../enums/save-validation.js";
4
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 P } from "../extensions/Blocks/Items/enums/productEnums.js";
7
- import { BLOCK_ROOT_SELECTOR as W } from "../extensions/Blocks/RadioButton/constants/selectors.js";
8
- import { useRecommendationExtensionStore as G } from "../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ import { BLOCK_ROOT_SELECTOR as x } from "../extensions/Blocks/Checkbox/constants/selectors.js";
6
+ import { itemsBlockDynamicVariables as W } from "../extensions/Blocks/Items/enums/productEnums.js";
7
+ import { BLOCK_ROOT_SELECTOR as G } from "../extensions/Blocks/RadioButton/constants/selectors.js";
8
+ import { useRecommendationExtensionStore as P } from "../extensions/Blocks/Recommendation/store/recommendation.js";
9
9
  import { getInvalidFields as q, STRATEGY_FIELD_KEY as H, RecommendationAssignStrategyKey as V, RecommendationRequiredFieldsKey as X } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
10
10
  import { useConfigStore as j } from "../stores/config.js";
11
11
  import { useDynamicContentStore as z } from "../stores/dynamic-content.js";
@@ -20,9 +20,9 @@ import { buildPartnerAttributeNameSet as ne, getInvalidDynamicContentTags as ie,
20
20
  import { useHttp as se } from "./useHttp.js";
21
21
  import { useTranslations as ae } from "./useTranslations.js";
22
22
  import { findInvalidCouponBlocks as ce, COUPON_TAG_MODIFIED_KEY as le } from "./validators/useCouponBlockValidator.js";
23
- import { findDuplicateUnsubPageTypes as me, countUnsubBlocksWithoutPage as ue, EMPTY_BLOCK_KEY as de } from "./validators/useUnsubscribeBlockValidator.js";
24
- const pe = "newsletter.html-content-is-empty", ge = "custom-fields.missing-closing-braces", fe = "custom-fields.missing-opening-braces", S = "custom-fields.invalid-custom-fields", ye = "newsletter.display-conditions-invalid-syntax", Ee = "custom-conditions.wrong-equality-operators", Ie = "custom-conditions.missing-if-endif-tag", Se = "custom-conditions.no-space-after-braces", _e = "custom-conditions.no-braces-inside-if-tag", Ce = "newsletter.fill-all-necessary-fields", he = "newsletter.invalid-image-type", ke = "unsubscribe-templates.select-checkbox-groups", Te = "unsubscribe-templates.select-radio-button-groups", F = "newsletter.invalid-url-link-for-toaster", R = "journey-builder.liquid-validation-failed", Fe = "/newsletter/template-library/check-template-html-body", Re = /src="[^"]*\.(svg|pst)"/gm, L = /({%(.*?)%})/g, Oe = ["if", "endif", "else", "elif", "now"], Le = (t) => !Oe.includes(t.toLowerCase()), Ne = (t) => ["if", "endif"].includes(t.toLowerCase());
25
- function be(t) {
23
+ import { hasInsiderUnsubscribeCode as ue, EXTERNALLY_MANAGED_UNSUBSCRIBE_KEY as me, findDuplicateUnsubPageTypes as de, countUnsubBlocksWithoutPage as pe, EMPTY_BLOCK_KEY as ge } from "./validators/useUnsubscribeBlockValidator.js";
24
+ const fe = "newsletter.html-content-is-empty", ye = "custom-fields.missing-closing-braces", Ee = "custom-fields.missing-opening-braces", S = "custom-fields.invalid-custom-fields", Ie = "newsletter.display-conditions-invalid-syntax", Se = "custom-conditions.wrong-equality-operators", _e = "custom-conditions.missing-if-endif-tag", Ce = "custom-conditions.no-space-after-braces", he = "custom-conditions.no-braces-inside-if-tag", ke = "newsletter.fill-all-necessary-fields", Te = "newsletter.invalid-image-type", Fe = "unsubscribe-templates.select-checkbox-groups", be = "unsubscribe-templates.select-radio-button-groups", F = "newsletter.invalid-url-link-for-toaster", b = "journey-builder.liquid-validation-failed", Re = "/newsletter/template-library/check-template-html-body", Le = /src="[^"]*\.(svg|pst)"/gm, L = /({%(.*?)%})/g, Ne = ["if", "endif", "else", "elif", "now"], Oe = (t) => !Ne.includes(t.toLowerCase()), Ae = (t) => ["if", "endif"].includes(t.toLowerCase());
25
+ function De(t) {
26
26
  return ce(t).map((i) => ({
27
27
  rule: o.CouponTagModified,
28
28
  type: r.Warning,
@@ -30,54 +30,61 @@ function be(t) {
30
30
  detail: i
31
31
  }));
32
32
  }
33
- function Ae(t) {
34
- return me(t).map((i) => ({
33
+ function ve(t) {
34
+ return de(t).map((i) => ({
35
35
  rule: o.DuplicateUnsubBlock,
36
36
  type: r.Error,
37
37
  key: i.messageKey
38
38
  }));
39
39
  }
40
- function ve(t) {
41
- return Array.from({ length: ue(t) }, () => ({
40
+ function Ke(t) {
41
+ return Array.from({ length: pe(t) }, () => ({
42
42
  rule: o.UnsubBlockMissingTemplate,
43
43
  type: r.Warning,
44
- key: de
44
+ key: ge
45
45
  }));
46
46
  }
47
- function De(t, i) {
47
+ function Be(t) {
48
+ return ue(t) ? [{
49
+ rule: o.ExternallyManagedUnsubscribe,
50
+ type: r.Warning,
51
+ key: me
52
+ }] : [];
53
+ }
54
+ function we(t, i) {
48
55
  const n = t.match(L);
49
56
  if (!n)
50
57
  return [];
51
- const l = [];
52
- return n.forEach((u) => {
53
- const c = u.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
58
+ const u = [];
59
+ return n.forEach((m) => {
60
+ const c = m.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
54
61
  if (c && c.length > 0) {
55
62
  const [d] = c;
56
- Le(d) && !i.includes(d) && l.push({
63
+ Oe(d) && !i.includes(d) && u.push({
57
64
  rule: o.CustomFieldScript,
58
65
  type: r.Warning,
59
66
  key: S,
60
67
  detail: d
61
68
  });
62
69
  }
63
- }), l;
70
+ }), u;
64
71
  }
65
- function Ke(t) {
66
- return t.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: pe }];
72
+ function Ye(t) {
73
+ return t.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: fe }];
67
74
  }
68
- function we(t) {
75
+ function Ue(t) {
69
76
  const i = (t.match(/{/gm) || []).length, n = (t.match(/}/gm) || []).length;
70
77
  return i > n ? [{
71
78
  rule: o.MismatchedBraces,
72
79
  type: r.Warning,
73
- key: ge
80
+ key: ye
74
81
  }] : i < n ? [{
75
82
  rule: o.MismatchedBraces,
76
83
  type: r.Warning,
77
- key: fe
84
+ key: Ee
78
85
  }] : [];
79
86
  }
80
- function Be(t) {
87
+ function Me(t) {
81
88
  return ie(t).map((i) => ({
82
89
  rule: o.InvalidDynamicTag,
83
90
  type: r.Warning,
@@ -85,75 +92,75 @@ function Be(t) {
85
92
  detail: i
86
93
  }));
87
94
  }
88
- function Ye(t, i, n, l) {
89
- const u = oe(t);
90
- return re(t, i, u, n, l).map((c) => ({
95
+ function xe(t, i, n, u) {
96
+ const m = oe(t);
97
+ return re(t, i, m, n, u).map((c) => ({
91
98
  rule: o.InvalidCustomField,
92
99
  type: r.Error,
93
100
  key: S,
94
101
  detail: c
95
102
  }));
96
103
  }
97
- function xe(t) {
98
- const i = t.match(/{%(.*?)%}/g), n = [], l = [];
99
- if (i && i.forEach((u) => {
100
- const c = u.match(x), d = u.match(M), I = (c == null ? void 0 : c.join("")) || "";
101
- (!c || u !== I) && !d && l.push({
104
+ function We(t) {
105
+ const i = t.match(/{%(.*?)%}/g), n = [], u = [];
106
+ if (i && i.forEach((m) => {
107
+ const c = m.match(U), d = m.match(M), I = (c == null ? void 0 : c.join("")) || "";
108
+ (!c || m !== I) && !d && u.push({
102
109
  rule: o.ConditionsSyntax,
103
110
  type: r.Error,
104
- key: ye,
105
- detail: u
111
+ key: Ie,
112
+ detail: m
106
113
  }), c && c.forEach((g) => {
107
- g.trim() === "=" && l.push({
114
+ g.trim() === "=" && u.push({
108
115
  rule: o.WrongEqualityOperator,
109
116
  type: r.Error,
110
- key: Ee
117
+ key: Se
111
118
  }), (g.match(/^[a-zA-Z]*$/g) ?? []).forEach((f) => {
112
- Ne(f) && n.push(f);
119
+ Ae(f) && n.push(f);
113
120
  });
114
121
  });
115
122
  }), n.length) {
116
- const u = n.filter((d) => d === "if").length, c = n.filter((d) => d === "endif").length;
117
- u !== c && l.push({
123
+ const m = n.filter((d) => d === "if").length, c = n.filter((d) => d === "endif").length;
124
+ m !== c && u.push({
118
125
  rule: o.MissingIfEndif,
119
126
  type: r.Error,
120
- key: Ie
127
+ key: _e
121
128
  });
122
129
  }
123
- return l;
130
+ return u;
124
131
  }
125
- function Me(t) {
132
+ function Ge(t) {
126
133
  const i = (t.match(/{% /gm) || []).length, n = (t.match(/ %}/gm) || []).length;
127
134
  return i === n ? [] : [{
128
135
  rule: o.ConditionTagSpacing,
129
136
  type: r.Warning,
130
- key: Se
137
+ key: Ce
131
138
  }];
132
139
  }
133
- function Ue(t) {
134
- return (t.match(L) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, l) => n + l, 0) === 0 ? [] : [{
140
+ function Pe(t) {
141
+ return (t.match(L) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, u) => n + u, 0) === 0 ? [] : [{
135
142
  rule: o.BracesInsideIfTag,
136
143
  type: r.Warning,
137
- key: _e
144
+ key: he
138
145
  }];
139
146
  }
140
- function Pe(t) {
141
- return (t.match(Re) ?? []).map((i) => ({
147
+ function qe(t) {
148
+ return (t.match(Le) ?? []).map((i) => ({
142
149
  rule: o.InvalidImageType,
143
150
  type: r.Error,
144
- key: he,
151
+ key: Te,
145
152
  detail: i
146
153
  }));
147
154
  }
148
- function O(t, i, n, l) {
149
- const u = new DOMParser().parseFromString(t, "text/html");
150
- return Array.from(u.querySelectorAll(i)).filter((c) => {
155
+ function R(t, i, n, u) {
156
+ const m = new DOMParser().parseFromString(t, "text/html");
157
+ return Array.from(m.querySelectorAll(i)).filter((c) => {
151
158
  var d;
152
159
  return !((d = c.id) != null && d.trim());
153
- }).map(() => ({ rule: n, type: r.Error, key: l }));
160
+ }).map(() => ({ rule: n, type: r.Error, key: u }));
154
161
  }
155
- const dt = () => {
156
- const { config: t, isFeatureEnabled: i } = ee(), n = ae(), { post: l } = se(), { getCompiledEmail: u, getTemplateData: c } = J(), { compileHtml: d } = te(), { hydrateRecommendationStore: I } = Z(), g = z(), f = $(), y = G(), N = j(), b = (e) => ({
162
+ const ft = () => {
163
+ const { config: t, isFeatureEnabled: i } = ee(), n = ae(), { post: u } = se(), { getCompiledEmail: m, getTemplateData: c } = J(), { compileHtml: d } = te(), { hydrateRecommendationStore: I } = Z(), g = z(), f = $(), y = P(), N = j(), O = (e) => ({
157
164
  rule: e.rule,
158
165
  type: e.type,
159
166
  detail: e.detail,
@@ -167,24 +174,24 @@ const dt = () => {
167
174
  return null;
168
175
  }
169
176
  return ne(y.filterList);
170
- }, v = async (e) => {
177
+ }, D = async (e) => {
171
178
  try {
172
- const s = await l(Fe, { html: T(e) }), { status: a, message: m } = s.data, p = [], E = a === void 0 && !!m && m !== n(F);
173
- return a || p.push({
179
+ const a = await u(Re, { html: T(e) }), { status: s, message: l } = a.data, p = [], E = s === void 0 && !!l && l !== n(F);
180
+ return s || p.push({
174
181
  rule: o.InvalidLinks,
175
182
  type: r.Error,
176
- ...E ? { message: m } : { key: F }
177
- }), m === n(k) && p.push({
183
+ ...E ? { message: l } : { key: F }
184
+ }), l === n(k) && p.push({
178
185
  rule: o.LinkCheckInProgress,
179
186
  type: r.Error,
180
187
  key: k
181
188
  }), p;
182
- } catch (s) {
183
- return console.warn("Link-check collector failed; skipping the link rule.", s), [];
189
+ } catch (a) {
190
+ return console.warn("Link-check collector failed; skipping the link rule.", a), [];
184
191
  }
185
- }, D = async (e) => {
192
+ }, v = async (e) => {
186
193
  try {
187
- const s = await l("/newsletter/contents/validate-syntax", [{
194
+ const a = await u("/newsletter/contents/validate-syntax", [{
188
195
  identifier: "default",
189
196
  syntax: "liquid",
190
197
  contents: {
@@ -194,88 +201,89 @@ const dt = () => {
194
201
  ampHtml: null
195
202
  }
196
203
  }]);
197
- if (!Array.isArray(s.data)) {
198
- const m = s.data;
204
+ if (!Array.isArray(a.data)) {
205
+ const l = a.data;
199
206
  return [{
200
207
  rule: o.LiquidSyntax,
201
208
  type: r.Warning,
202
- message: m.message ?? n(R)
209
+ message: l.message ?? n(b)
203
210
  }];
204
211
  }
205
- const [a] = s.data;
206
- return Object.values((a == null ? void 0 : a.errors) ?? {}).map((m) => ({
212
+ const [s] = a.data;
213
+ return Object.values((s == null ? void 0 : s.errors) ?? {}).map((l) => ({
207
214
  rule: o.LiquidSyntax,
208
215
  type: r.Warning,
209
- message: m.replace(/^line \d+:\s*/, "")
216
+ message: l.replace(/^line \d+:\s*/, "")
210
217
  }));
211
- } catch (s) {
212
- if (s != null && s.authReported)
213
- throw s;
218
+ } catch (a) {
219
+ if (a != null && a.authReported)
220
+ throw a;
214
221
  return [{
215
222
  rule: o.LiquidSyntax,
216
223
  type: r.Error,
217
- message: n(R)
224
+ message: n(b)
218
225
  }];
219
226
  }
220
227
  }, K = () => {
221
- const e = Object.values(y.blockStates).map((a) => q(a.recommendationConfigs, y)).filter((a) => a.length > 0).map((a) => {
222
- const m = a.every((p) => p === H);
228
+ const e = Object.values(y.blockStates).map((s) => q(s.recommendationConfigs, y)).filter((s) => s.length > 0).map((s) => {
229
+ const l = s.every((p) => p === H);
223
230
  return {
224
231
  rule: o.RecommendationRequiredFields,
225
- type: m ? r.Warning : r.Error,
226
- key: m ? V : X
232
+ type: l ? r.Warning : r.Error,
233
+ key: l ? V : X
227
234
  };
228
- }), s = (f.recommendationConfigs ?? []).filter((a) => a.filters.some((m) => m.value === "")).map(() => ({
235
+ }), a = (f.recommendationConfigs ?? []).filter((s) => s.filters.some((l) => l.value === "")).map(() => ({
229
236
  rule: o.RecommendationFilters,
230
237
  type: r.Error,
231
- key: Ce
238
+ key: ke
232
239
  }));
233
- return [...e, ...s];
234
- }, w = async (e, s) => {
240
+ return [...e, ...a];
241
+ }, B = async (e, a) => {
235
242
  var C, h;
236
- const a = [
237
- ...s.map((B) => B.value),
238
- ...P,
243
+ const s = [
244
+ ...a.map((w) => w.value),
245
+ ...W,
239
246
  ...((h = (C = t.value) == null ? void 0 : C.template) == null ? void 0 : h.customFieldAttributes) ?? []
240
- ], m = Y(e), p = await A(m), { isTransactional: E } = N;
247
+ ], l = Y(e), p = await A(l), { isTransactional: E } = N;
241
248
  return [
242
- ...await v(e),
243
- ...E ? [] : De(e, a),
244
- ...Ke(e),
245
- ...we(e),
246
- ...Be(e),
247
- ...E ? [] : Ye(e, a, m, p),
248
- ...xe(e),
249
- ...Me(e),
249
+ ...await D(e),
250
+ ...E ? [] : we(e, s),
251
+ ...Ye(e),
250
252
  ...Ue(e),
251
- ...K(),
253
+ ...Me(e),
254
+ ...E ? [] : xe(e, s, l, p),
255
+ ...We(e),
256
+ ...Ge(e),
252
257
  ...Pe(e),
253
- ...O(
258
+ ...K(),
259
+ ...qe(e),
260
+ ...R(
254
261
  e,
255
- U,
262
+ x,
256
263
  o.CheckboxUnsubGroup,
257
- ke
264
+ Fe
258
265
  ),
259
- ...O(
266
+ ...R(
260
267
  e,
261
- W,
268
+ G,
262
269
  o.RadioButtonUnsubGroup,
263
- Te
270
+ be
264
271
  )
265
272
  ];
266
- }, _ = async (e, s) => [
267
- ...be(e),
268
- ...Ae(e),
273
+ }, _ = async (e, a, s) => [
274
+ ...De(e),
275
+ ...i("blockUnsubscribeLinks") ? Be(s) : [],
269
276
  ...ve(e),
270
- ...i("liquidSyntax") ? await D(e) : await w(e, s)
271
- ].map(b);
277
+ ...Ke(e),
278
+ ...i("liquidSyntax") ? await v(e) : await B(e, a)
279
+ ].map(O);
272
280
  return { collectSaveValidationErrors: _, validateCurrentTemplate: async () => {
273
281
  const { html: e } = await c();
274
282
  await I(e);
275
- const { html: s } = await u({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: a } = d(s);
276
- return _(a, g.getSelectedDynamicContentList);
283
+ const { html: a } = await m({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: s } = d(a);
284
+ return _(s, g.getSelectedDynamicContentList, e);
277
285
  } };
278
286
  };
279
287
  export {
280
- dt as useSaveValidation
288
+ ft as useSaveValidation
281
289
  };
@@ -1,8 +1,8 @@
1
- import { ToasterTypeOptions as c } from "../../enums/toaster.js";
2
- import { PAGE_TYPES as u } from "../../enums/unsubscribe.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";
1
+ import { ToasterTypeOptions as i } from "../../enums/toaster.js";
2
+ import { MERGE_TAGS as p, PAGE_TYPES as u } from "../../enums/unsubscribe.js";
3
+ import { UNSUBSCRIBE_BLOCK_SELECTOR as l, DATA_ATTRIBUTES as c } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
4
+ import { useToaster as E } from "../useToaster.js";
5
+ import { useTranslations as b } from "../useTranslations.js";
6
6
  const T = [
7
7
  {
8
8
  pageType: u.GLOBAL_UNSUBSCRIBE,
@@ -12,37 +12,52 @@ 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", 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);
15
+ ], g = "unsubscription-preference.duplicate-both", _ = "unsubscription-preference.select-page-to-continue", m = "newsletter.sfmc-remove-unsubscribe-link", f = Object.values(p).map((e) => e.slice(2, -2).replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), U = new RegExp(
16
+ `{{\\s*(?:${f})\\s*}}|(?:%|%25)(?:asm_[a-z_]+_raw_url|unsub)(?:%|%25)`,
17
+ "i"
18
+ );
19
+ function S(e) {
20
+ return U.test(e);
22
21
  }
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;
22
+ function A(e) {
23
+ const t = new DOMParser().parseFromString(e, "text/html"), s = /* @__PURE__ */ new Map();
24
+ return t.querySelectorAll(l).forEach((r) => {
25
+ const n = Number(r.getAttribute(c.PAGE_TYPE));
26
+ s.set(n, (s.get(n) ?? 0) + 1);
27
+ }), T.filter((r) => (s.get(r.pageType) ?? 0) > 1);
28
+ }
29
+ function B(e) {
30
+ const t = new DOMParser().parseFromString(e, "text/html");
31
+ return Array.from(t.querySelectorAll(l)).filter((s) => {
32
+ const r = s.getAttribute(c.PAGE_TYPE), n = s.getAttribute(c.PAGE_LIST);
33
+ return !r || !n;
28
34
  }).length;
29
35
  }
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)
37
- }), !1) : !0;
38
- }, validateUnsubscribeBlockHasTemplate: (e) => b(e) === 0 ? !0 : (r({
39
- type: c.Warning,
40
- message: s(E)
41
- }), !1) };
36
+ const I = () => {
37
+ const { showToaster: e } = E(), t = b();
38
+ return {
39
+ validateUnsubscribeBlockUniqueness: (o) => {
40
+ const a = A(o);
41
+ return a.length ? (e({
42
+ type: i.Error,
43
+ message: t(a.length > 1 ? g : a[0].messageKey)
44
+ }), !1) : !0;
45
+ },
46
+ validateUnsubscribeBlockHasTemplate: (o) => B(o) === 0 ? !0 : (e({
47
+ type: i.Warning,
48
+ message: t(_)
49
+ }), !1),
50
+ validateNoInsiderUnsubscribeCode: (o, a = !1) => S(o) ? (a || e({
51
+ type: i.Warning,
52
+ message: t(m)
53
+ }), !1) : !0
54
+ };
42
55
  };
43
56
  export {
44
- E as EMPTY_BLOCK_KEY,
45
- b as countUnsubBlocksWithoutPage,
46
- m as findDuplicateUnsubPageTypes,
47
- y as useUnsubscribeBlockValidator
57
+ _ as EMPTY_BLOCK_KEY,
58
+ m as EXTERNALLY_MANAGED_UNSUBSCRIBE_KEY,
59
+ B as countUnsubBlocksWithoutPage,
60
+ A as findDuplicateUnsubPageTypes,
61
+ S as hasInsiderUnsubscribeCode,
62
+ I as useUnsubscribeBlockValidator
48
63
  };