@useinsider/guido 3.17.0-beta.ea65303 → 3.17.0-beta.eae947f

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 (55) hide show
  1. package/README.md +5 -6
  2. package/dist/@types/config/schemas.js +27 -29
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +76 -78
  5. package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
  6. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  7. package/dist/components/organisms/header/EditorActions.vue2.js +43 -74
  8. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  9. package/dist/components/organisms/header/LeftSlot.vue2.js +12 -16
  10. package/dist/components/wrappers/WpDrawer.vue.js +7 -9
  11. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  12. package/dist/composables/useHtmlCompiler.js +26 -37
  13. package/dist/composables/useHtmlValidator.js +0 -2
  14. package/dist/composables/useSave.js +41 -84
  15. package/dist/composables/validators/useCouponBlockValidator.js +21 -24
  16. package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
  17. package/dist/extensions/Blocks/Items/block.js +98 -49
  18. package/dist/extensions/Blocks/Items/constants/currency.js +11 -0
  19. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
  20. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
  21. package/dist/extensions/Blocks/Items/template.js +153 -152
  22. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +26 -33
  23. package/dist/guido.css +1 -1
  24. package/dist/src/@types/config/schemas.d.ts +0 -4
  25. package/dist/src/components/Guido.vue.d.ts +1 -17
  26. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
  27. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
  28. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
  29. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
  30. package/dist/src/composables/useConfig.d.ts +0 -2
  31. package/dist/src/composables/useHtmlValidator.d.ts +0 -21
  32. package/dist/src/composables/useSave.d.ts +1 -6
  33. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
  34. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
  35. package/dist/src/extensions/Blocks/Items/block.d.ts +21 -0
  36. package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +19 -0
  37. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -5
  38. package/dist/src/stores/config.d.ts +0 -30
  39. package/dist/src/utils/templatePreparation.d.ts +0 -30
  40. package/dist/stores/config.js +22 -39
  41. package/dist/utils/pairProductVariables.js +60 -59
  42. package/dist/utils/templatePreparation.js +25 -28
  43. package/package.json +2 -2
  44. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
  45. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -48
  46. package/dist/composables/useSaveValidation.js +0 -279
  47. package/dist/composables/useSaveValidationRollout.js +0 -9
  48. package/dist/enums/save-validation.js +0 -4
  49. package/dist/src/@types/save-validation.d.ts +0 -19
  50. package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +0 -2
  51. package/dist/src/composables/useSaveValidation.d.ts +0 -6
  52. package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
  53. package/dist/src/enums/save-validation.d.ts +0 -27
  54. package/dist/src/stores/save-validation.d.ts +0 -22
  55. package/dist/stores/save-validation.js +0 -30
@@ -1,97 +1,66 @@
1
- import { defineComponent as R, computed as l, ref as m } from "vue";
2
- import { useActionsApi as D } from "../../../composables/useActionsApi.js";
3
- import { useConfig as F } from "../../../composables/useConfig.js";
4
- import { useExport as z } from "../../../composables/useExport.js";
5
- import { useTestEmailClick as I } from "../../../composables/useGuidoActions.js";
6
- import { useHtmlCompiler as P } from "../../../composables/useHtmlCompiler.js";
7
- import { useSave as W } from "../../../composables/useSave.js";
8
- import { useSaveValidation as j } from "../../../composables/useSaveValidation.js";
9
- import { useSaveValidationRollout as G } from "../../../composables/useSaveValidationRollout.js";
10
- import { useToaster as J } from "../../../composables/useToaster.js";
11
- import { useTranslations as K } from "../../../composables/useTranslations.js";
12
- import { useVersionHistoryApi as N } from "../../../composables/useVersionHistoryApi.js";
13
- import { useLiquidValidator as Q } from "../../../composables/validators/useLiquidValidator.js";
14
- import { ToasterTypeOptions as U } from "../../../enums/toaster.js";
15
- import { useConfigStore as X } from "../../../stores/config.js";
16
- import { useEditorStore as Y } from "../../../stores/editor.js";
17
- import { useSaveValidationStore as Z } from "../../../stores/save-validation.js";
18
- import { useTemplateStore as $ } from "../../../stores/template.js";
19
- import { getTooltipOptions as tt } from "../../../utils/tooltipUtils.js";
20
- import { InButtonV2 as ot } from "@useinsider/design-system-vue";
21
- import { storeToRefs as et } from "pinia";
22
- import rt from "./MigrationConfirmModal.vue.js";
23
- const At = /* @__PURE__ */ R({
1
+ import { defineComponent as O, ref as n, computed as h } from "vue";
2
+ import { useActionsApi as q } from "../../../composables/useActionsApi.js";
3
+ import { useConfig as b } from "../../../composables/useConfig.js";
4
+ import { useExport as k } from "../../../composables/useExport.js";
5
+ import { useTestEmailClick as B } from "../../../composables/useGuidoActions.js";
6
+ import { useHtmlCompiler as D } from "../../../composables/useHtmlCompiler.js";
7
+ import { useSave as F } from "../../../composables/useSave.js";
8
+ import { useTranslations as L } from "../../../composables/useTranslations.js";
9
+ import { useVersionHistoryApi as R } from "../../../composables/useVersionHistoryApi.js";
10
+ import { useLiquidValidator as z } from "../../../composables/validators/useLiquidValidator.js";
11
+ import { useEditorStore as I } from "../../../stores/editor.js";
12
+ import { useTemplateStore as P } from "../../../stores/template.js";
13
+ import { getTooltipOptions as j } from "../../../utils/tooltipUtils.js";
14
+ import { InButtonV2 as G } from "@useinsider/design-system-vue";
15
+ import { storeToRefs as J } from "pinia";
16
+ import K from "./MigrationConfirmModal.vue.js";
17
+ const ut = /* @__PURE__ */ O({
24
18
  __name: "EditorActions",
25
- setup(it, { expose: A }) {
26
- const { config: u, isFeatureEnabled: c } = F(), { exportHtml: f } = z(), { save: p } = W(), { validateCurrentTemplate: d } = j(), { isEnabled: i } = G(), { showToaster: v } = J(), { openVersionHistory: S, closeVersionHistory: y } = N(), { getCompiledEmail: g } = D(), { compileHtml: h } = P(), { validateLiquidSyntax: V } = Q(), T = X(), e = Y(), w = Z(), H = $(), { hasMigrations: E } = et(H), r = K(), O = l(() => i.value && T.allowSaveWithErrors ? r("email-editor.save-and-continue") : "Save"), s = m(!1), a = m(!1), x = m(), n = I(), M = () => {
19
+ setup(N, { expose: x }) {
20
+ const { config: a, isFeatureEnabled: l } = b(), { exportHtml: m } = k(), { save: u } = F(), { openVersionHistory: c, closeVersionHistory: p } = R(), { getCompiledEmail: f } = q(), { compileHtml: d } = D(), { validateLiquidSyntax: v } = z(), e = I(), y = P(), { hasMigrations: g } = J(y), s = L(), i = n(!1), r = n(!1), S = n(), H = B(), T = () => {
27
21
  if (e.isVersionHistoryOpen) {
28
- y();
22
+ p();
29
23
  return;
30
24
  }
31
- S();
32
- }, b = async () => {
33
- s.value = !0, await f(), s.value = !1;
34
- }, k = () => {
25
+ c();
26
+ }, w = async () => {
27
+ i.value = !0, await m(), i.value = !1;
28
+ }, _ = () => {
35
29
  e.isSaveAsTemplateDrawerOpen = !0;
36
- }, q = l(() => e.isVersionHistoryOpen ? r("newsletter.close-version-history") : r("newsletter.version-history")), B = l(
30
+ }, C = h(() => e.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), A = h(
37
31
  () => {
38
32
  var t, o;
39
- return ((o = (t = u.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
33
+ return ((o = (t = a.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
40
34
  }
41
- ), C = async (t) => {
42
- a.value = !0, t || (e.loadingStatus = !0);
43
- const o = await p(t);
44
- return a.value = !1, !t && !o && (e.loadingStatus = !1), o;
45
- }, _ = (t) => {
35
+ ), V = async (t) => {
36
+ r.value = !0, t || (e.loadingStatus = !0);
37
+ const o = await u(t);
38
+ return r.value = !1, !t && !o && (e.loadingStatus = !1), o;
39
+ }, E = (t) => {
46
40
  var o;
47
- if (!t && E.value) {
48
- (o = x.value) == null || o.open();
41
+ if (!t && g.value) {
42
+ (o = S.value) == null || o.open();
49
43
  return;
50
44
  }
51
- return C(t);
52
- }, L = async () => {
53
- if (i.value) {
45
+ return V(t);
46
+ }, M = async () => {
47
+ if (l("liquidSyntax")) {
54
48
  e.loadingStatus = !0;
55
- let t = [];
56
49
  try {
57
- t = await d();
58
- } catch (o) {
59
- console.warn("Test-path validation failed; sending without the drawer.", o);
60
- } finally {
61
- e.loadingStatus = !1;
62
- }
63
- if (t.length) {
64
- v({
65
- type: U.Error,
66
- message: r("email-editor.validation-errors-found"),
67
- actionButton: {
68
- text: r("email-editor.check-errors"),
69
- onClick: () => w.open(t, "test")
70
- },
71
- autoHide: !1
72
- });
73
- return;
74
- }
75
- n();
76
- return;
77
- }
78
- if (c("liquidSyntax")) {
79
- e.loadingStatus = !0;
80
- try {
81
- const { html: t } = await g({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = h(t);
82
- if (!await V(o))
50
+ const { html: t } = await f({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = d(t);
51
+ if (!await v(o))
83
52
  return;
84
53
  } finally {
85
54
  e.loadingStatus = !1;
86
55
  }
87
56
  }
88
- n();
57
+ H();
89
58
  };
90
- return A({
91
- handleSave: _
92
- }), { __sfc: !0, config: u, isFeatureEnabled: c, exportHtml: f, save: p, validateCurrentTemplate: d, isEnabled: i, showToaster: v, openVersionHistory: S, closeVersionHistory: y, getCompiledEmail: g, compileHtml: h, validateLiquidSyntax: V, configStore: T, editorStore: e, saveValidationStore: w, templateStore: H, hasMigrations: E, trans: r, saveLabel: O, isExporting: s, isSaving: a, migrationModalRef: x, testEmailClick: n, handleVersionHistory: M, handleExport: b, handleSaveAs: k, versionHistoryTooltipText: q, isVersionHistoryButtonVisible: B, executeSave: C, handleSave: _, handleTestEmail: L, getTooltipOptions: tt, InButtonV2: ot, MigrationConfirmModal: rt };
59
+ return x({
60
+ handleSave: E
61
+ }), { __sfc: !0, config: a, isFeatureEnabled: l, exportHtml: m, save: u, openVersionHistory: c, closeVersionHistory: p, getCompiledEmail: f, compileHtml: d, validateLiquidSyntax: v, editorStore: e, templateStore: y, hasMigrations: g, trans: s, isExporting: i, isSaving: r, migrationModalRef: S, testEmailClick: H, handleVersionHistory: T, handleExport: w, handleSaveAs: _, versionHistoryTooltipText: C, isVersionHistoryButtonVisible: A, executeSave: V, handleSave: E, handleTestEmail: M, getTooltipOptions: j, InButtonV2: G, MigrationConfirmModal: K };
93
62
  }
94
63
  });
95
64
  export {
96
- At as default
65
+ ut as default
97
66
  };
@@ -1,16 +1,16 @@
1
1
  import o from "./LeftSlot.vue2.js";
2
2
  /* empty css */
3
- import n from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var a = function() {
3
+ import a from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var n = function() {
5
5
  var e = this, s = e._self._c, t = e._self._setupProxy;
6
6
  return s("div", { staticClass: "d-f a-i-c" }, [s(t.InButtonV2, { attrs: { id: "guido__back-button", "left-icon": "line-arrow-left", styling: "ghost", type: "secondary", "disabled-status": t.isBackButtonDisabled, "label-text": t.backButtonLabel, "skeleton-sizing": { width: 150, height: 26 }, "skeleton-status": t.editorStore.loadingStatus }, on: { click: t.handleBackClick } })], 1);
7
- }, i = [], r = /* @__PURE__ */ n(
7
+ }, i = [], r = /* @__PURE__ */ a(
8
8
  o,
9
- a,
9
+ n,
10
10
  i,
11
11
  !1,
12
12
  null,
13
- "b8f24f34"
13
+ "73199fa4"
14
14
  );
15
15
  const f = r.exports;
16
16
  export {
@@ -1,19 +1,19 @@
1
- import { defineComponent as m, computed as p, ref as d } from "vue";
1
+ import { defineComponent as l, computed as p, ref as d } from "vue";
2
2
  import { useConfig as k } from "../../../composables/useConfig.js";
3
3
  import { useBack as B } from "../../../composables/useGuidoActions.js";
4
4
  import { usePreviewMode as b } from "../../../composables/usePreviewMode.js";
5
5
  import { useTranslations as v } from "../../../composables/useTranslations.js";
6
6
  import { useVersionHistoryApi as _ } from "../../../composables/useVersionHistoryApi.js";
7
- import { useEditorStore as y } from "../../../stores/editor.js";
7
+ import { useEditorStore as V } from "../../../stores/editor.js";
8
8
  import { InButtonV2 as w } from "@useinsider/design-system-vue";
9
- import { useDebounceFn as V } from "../../../node_modules/@vueuse/shared/index.js";
10
- const D = /* @__PURE__ */ m({
9
+ import { useDebounceFn as y } from "../../../node_modules/@vueuse/shared/index.js";
10
+ const D = /* @__PURE__ */ l({
11
11
  __name: "LeftSlot",
12
12
  setup(C) {
13
- const e = y(), i = B(), { closeVersionHistory: n } = _(), { closePreviewMode: s } = b(), o = v(), { config: t } = k(), l = p(() => {
14
- var u, f;
15
- return e.isVersionHistoryOpen || e.isPreviewModeOpen ? o("email-editor.back-to-editor") : (f = (u = t.value) == null ? void 0 : u.ui) != null && f.backButtonLabel ? t.value.ui.backButtonLabel : o("email-editor.back-to-design");
16
- }), r = d(!1), a = () => {
13
+ const e = V(), i = B(), { closeVersionHistory: n } = _(), { closePreviewMode: s } = b(), o = v(), { config: t } = k(), f = p(() => {
14
+ var u, m;
15
+ return e.isVersionHistoryOpen || e.isPreviewModeOpen ? o("email-editor.back-to-editor") : (m = (u = t.value) == null ? void 0 : u.ui) != null && m.backButtonLabel ? t.value.ui.backButtonLabel : o("email-editor.back-to-design");
16
+ }), r = d(!1), c = () => {
17
17
  if (e.isVersionHistoryOpen) {
18
18
  n();
19
19
  return;
@@ -23,15 +23,11 @@ const D = /* @__PURE__ */ m({
23
23
  return;
24
24
  }
25
25
  i();
26
- }, c = V(async () => {
27
- try {
28
- await a();
29
- } finally {
30
- r.value = !1;
31
- }
26
+ }, a = y(() => {
27
+ c(), r.value = !1;
32
28
  }, 500);
33
- return { __sfc: !0, editorStore: e, handleBack: i, closeVersionHistory: n, closePreviewMode: s, trans: o, config: t, backButtonLabel: l, isBackButtonDisabled: r, executeBackAction: a, debouncedBackAction: c, handleBackClick: () => {
34
- r.value = !0, c();
29
+ return { __sfc: !0, editorStore: e, handleBack: i, closeVersionHistory: n, closePreviewMode: s, trans: o, config: t, backButtonLabel: f, isBackButtonDisabled: r, executeBackAction: c, debouncedBackAction: a, handleBackClick: () => {
30
+ r.value = !0, a();
35
31
  }, InButtonV2: w };
36
32
  }
37
33
  });
@@ -1,19 +1,17 @@
1
1
  import r from "./WpDrawer.vue2.js";
2
2
  import s from "../../_virtual/_plugin-vue2_normalizer.js";
3
3
  var u = function() {
4
- var t = this, o = t._self._c, e = t._self._setupProxy;
5
- return o(e.InDrawer, { class: t.className, attrs: { id: t.id, "footer-status": "", "close-on-outside-click": t.closeOnOutsideClick, "description-status": t.descriptionStatus, "description-text": t.descriptionText, "footer-button-group-options": t.footerButtonGroupOptions, size: t.size, status: t.status, "title-text": t.titleText }, on: { cancelOrBackButtonEvent: function(n) {
4
+ var t = this, n = t._self._c, e = t._self._setupProxy;
5
+ return n(e.InDrawer, { class: t.className, attrs: { id: t.id, "footer-status": "", "close-on-outside-click": t.closeOnOutsideClick, "description-status": t.descriptionStatus, "description-text": t.descriptionText, "footer-button-group-options": t.footerButtonGroupOptions, size: t.size, status: t.status, "title-text": t.titleText }, on: { cancelOrBackButtonEvent: function(o) {
6
6
  return e.emit("cancelOrBackButtonEvent");
7
- }, onCloseEvent: function(n) {
7
+ }, onCloseEvent: function(o) {
8
8
  return e.emit("onCloseEvent");
9
- }, primaryButtonEvent: function(n) {
9
+ }, primaryButtonEvent: function(o) {
10
10
  return e.emit("primaryButtonEvent");
11
- }, secondaryButtonEvent: function(n) {
12
- return e.emit("secondaryButtonEvent");
13
11
  } }, scopedSlots: t._u([t.$slots.headerBottomSlot ? { key: "headerBottomSlot", fn: function() {
14
12
  return [t._t("headerBottomSlot")];
15
13
  }, proxy: !0 } : null, { key: "contentSlot", fn: function() {
16
- return [o("div", [t._t("default")], 2)];
14
+ return [n("div", [t._t("default")], 2)];
17
15
  }, proxy: !0 }], null, !0) });
18
16
  }, i = [], c = /* @__PURE__ */ s(
19
17
  r,
@@ -23,7 +21,7 @@ var u = function() {
23
21
  null,
24
22
  null
25
23
  );
26
- const p = c.exports;
24
+ const f = c.exports;
27
25
  export {
28
- p as default
26
+ f as default
29
27
  };
@@ -13,7 +13,7 @@ const r = /* @__PURE__ */ e({
13
13
  status: { type: Boolean },
14
14
  titleText: null
15
15
  },
16
- emits: ["cancelOrBackButtonEvent", "onCloseEvent", "primaryButtonEvent", "secondaryButtonEvent"],
16
+ emits: ["cancelOrBackButtonEvent", "onCloseEvent", "primaryButtonEvent"],
17
17
  setup(n, { emit: t }) {
18
18
  return { __sfc: !0, emit: t, InDrawer: o };
19
19
  }
@@ -1,14 +1,13 @@
1
- import { defaultHtmlCompilerRules as d } from "../config/compiler/htmlCompilerRules.js";
2
- import { itemsCompilerRules as f } from "../config/compiler/itemsCompilerRules.js";
3
- import { liquidCompilerRules as g } from "../config/compiler/liquidCompilerRules.js";
4
- import { outlookCompilerRules as R } from "../config/compiler/outlookCompilerRules.js";
1
+ import { defaultHtmlCompilerRules as R } from "../config/compiler/htmlCompilerRules.js";
2
+ import { itemsCompilerRules as g } from "../config/compiler/itemsCompilerRules.js";
3
+ import { liquidCompilerRules as C } from "../config/compiler/liquidCompilerRules.js";
4
+ import { outlookCompilerRules as b } from "../config/compiler/outlookCompilerRules.js";
5
5
  import { recommendationCompilerRules as v } from "../config/compiler/recommendationCompilerRules.js";
6
6
  import { socialCompilerRules as H } from "../config/compiler/socialCompilerRules.js";
7
- import { unsubscribeCompilerRules as b } from "../config/compiler/unsubscribeCompilerRules.js";
8
- import { createHtmlCompiler as n } from "../utils/htmlCompiler.js";
9
- import { computed as p } from "vue";
10
- import { useConfig as C } from "./useConfig.js";
11
- const x = /* @__PURE__ */ new Set([
7
+ import { unsubscribeCompilerRules as x } from "../config/compiler/unsubscribeCompilerRules.js";
8
+ import { createHtmlCompiler as s } from "../utils/htmlCompiler.js";
9
+ import { useConfig as k } from "./useConfig.js";
10
+ const y = /* @__PURE__ */ new Set([
12
11
  // URL/tag encoding fixes — keep merge-tag and placeholder integrity intact.
13
12
  "fix-url-encoding-start",
14
13
  "fix-url-encoding-end",
@@ -31,34 +30,24 @@ const x = /* @__PURE__ */ new Set([
31
30
  // Editor-only attribute strip — AMP4EMAIL has no `contenteditable`, so leaving
32
31
  // it in narrows/breaks rendering. Pure attribute removal, emits nothing.
33
32
  "remove-contenteditable"
34
- ]), I = () => {
35
- const { compiler: i, isFeatureEnabled: u, partner: a } = C(), c = p(() => {
36
- var m, l;
37
- const e = ((m = i.value) == null ? void 0 : m.customRules) || [];
38
- return [
39
- ...!!((l = i.value) != null && l.ignoreDefaultRules) ? [] : d,
40
- ...v,
41
- ...b,
42
- ...f,
43
- ...R,
44
- ...H,
45
- ...u("liquidSyntax") ? g : [],
46
- ...e.map((t, o) => ({
47
- ...t,
48
- priority: t.priority + 1e3 + o
49
- // Ensure additional rules run after default rules
50
- }))
51
- ];
52
- }), r = p(() => {
53
- var t;
54
- const e = c.value, s = n(e), m = n(e.filter((o) => x.has(o.id))), l = (t = a.value) == null ? void 0 : t.fallbackFont;
55
- return {
56
- compileHtml: (o) => s.compile(o, void 0, l),
57
- compileAmpHtml: (o) => m.compile(o, void 0, l)
58
- };
59
- });
60
- return { compileHtml: (e) => r.value.compileHtml(e), compileAmpHtml: (e) => r.value.compileAmpHtml(e) };
33
+ ]), M = () => {
34
+ var i, m, r;
35
+ const { compiler: o, isFeatureEnabled: n, partner: a } = k(), p = ((i = o.value) == null ? void 0 : i.customRules) || [], l = [
36
+ ...!!((m = o.value) != null && m.ignoreDefaultRules) ? [] : R,
37
+ ...v,
38
+ ...x,
39
+ ...g,
40
+ ...b,
41
+ ...H,
42
+ ...n("liquidSyntax") ? C : [],
43
+ ...p.map((e, f) => ({
44
+ ...e,
45
+ priority: e.priority + 1e3 + f
46
+ // Ensure additional rules run after default rules
47
+ }))
48
+ ], u = s(l), c = l.filter((e) => y.has(e.id)), d = s(c), t = (r = a.value) == null ? void 0 : r.fallbackFont;
49
+ return { compileHtml: (e) => u.compile(e, void 0, t), compileAmpHtml: (e) => d.compile(e, void 0, t) };
61
50
  };
62
51
  export {
63
- I as useHtmlCompiler
52
+ M as useHtmlCompiler
64
53
  };
@@ -221,8 +221,6 @@ const De = () => {
221
221
  export {
222
222
  de as buildPartnerAttributeNameSet,
223
223
  fe as findInvalidCustomFields,
224
- pe as getInvalidDynamicContentTags,
225
- ce as getRecommendationBlockIds,
226
224
  ue as parseRecommendationVariable,
227
225
  De as useHtmlValidator
228
226
  };
@@ -1,94 +1,51 @@
1
- import { useActionsApi as U } 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 W } from "./useSyncModuleExtractor.js";
7
- import { ToasterTypeOptions as O } from "../enums/toaster.js";
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";
8
6
  import { useStripoApi as D } from "../services/stripoApi.js";
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 wt = () => {
20
- const r = A(), u = q(), { validateHtml: d } = K(), { validateLiquidSyntax: f } = X(), { validateCouponBlockTags: p } = Q(), { validateUnsubscribeBlockUniqueness: v, validateUnsubscribeBlockHasTemplate: S } = Y(), { callbacks: a, isFeatureEnabled: c } = L(), { extractSyncModuleData: y } = W(), { setSyncModuleUnsubscriptionPages: w } = D(), { editorSave: b, getTemplateData: g } = U(), { showToaster: H } = N(), { getBlockedDomains: V, resolveToast: E } = J(), { prepareTemplateDetails: m } = G(), { collectSaveValidationErrors: C } = M(), { isEnabled: x } = R(), k = z(), B = j(), T = F(), n = 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 E(i);
28
- s != null && s.message && H({
29
- type: O.Warning,
30
- message: s.message,
31
- actionButton: s.actionButton
32
- });
33
- }
34
- return !0;
35
- }, P = async (t) => !p(t.compiledHtml) || !v(t.compiledHtml) || !S(t.compiledHtml) ? !1 : c("liquidSyntax") ? f(t.compiledHtml) : d(t.compiledHtml, t.dynamicContentList, !0), l = async (t, e) => {
36
- if (!await b())
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))
37
21
  return;
38
- const { unsubscribePayload: i, stripoModules: s } = y(t.rawHtml);
39
- if (await w(i), t.modules = s, !e.suppress) {
40
- const h = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
41
- u({ ...t, ...h, silent: e.silent });
42
- }
43
- return t;
44
- };
45
- return { save: async (t = !1, e = !1) => {
46
- var i;
47
- r();
48
- const o = await m();
49
- if (x.value && !e) {
50
- const s = await C(
51
- o.compiledHtml,
52
- o.dynamicContentList
53
- );
54
- if (s.length) {
55
- k.open(s, "save");
22
+ if (a("liquidSyntax")) {
23
+ if (!await d(t.compiledHtml))
56
24
  return;
57
- }
58
- } else if (!await P(o))
59
- return;
60
- if (!((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(o)) && !await n(o.compiledHtml, o.css, e))
61
- return l(o, { silent: e, suppress: t });
62
- }, saveWithErrors: async () => {
63
- var e;
64
- if (!T.allowSaveWithErrors)
25
+ } else if (!await c(t.compiledHtml, t.dynamicContentList, !0))
65
26
  return;
66
- r();
67
- const t = await m();
68
- if (!((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)) && !await n(t.compiledHtml, t.css, !1))
69
- return l(t, { silent: !1, blankCompiled: !0 });
70
- }, saveRawOnly: async () => {
71
- r();
72
- const { html: t, css: e } = await g();
73
- if (await n(t, e, !0))
27
+ if ((r = e.value) != null && r.externalValidation && !await e.value.externalValidation(t))
74
28
  return;
75
- const o = I(t), i = {
76
- dynamicContentList: B.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
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;
87
41
  }
88
- };
89
- return l(i, { silent: !0 });
42
+ }
43
+ if (!await S())
44
+ return;
45
+ const { unsubscribePayload: g, stripoModules: x } = f(t.rawHtml);
46
+ return await v(g), t.modules = x, y || l({ ...t, silent: s }), t;
90
47
  } };
91
48
  };
92
49
  export {
93
- wt as useSave
50
+ $ as useSave
94
51
  };
@@ -1,27 +1,24 @@
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 };
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
+ } };
22
21
  };
23
22
  export {
24
- p as COUPON_TAG_MODIFIED_KEY,
25
- u as findInvalidCouponBlocks,
26
- T as useCouponBlockValidator
23
+ A as useCouponBlockValidator
27
24
  };
@@ -1,8 +1,8 @@
1
- import { ToasterTypeOptions as c } from "../../enums/toaster.js";
1
+ import { ToasterTypeOptions as i } from "../../enums/toaster.js";
2
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";
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";
6
6
  const T = [
7
7
  {
8
8
  pageType: u.GLOBAL_UNSUBSCRIBE,
@@ -12,37 +12,30 @@ 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);
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)
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])
37
27
  }), !1) : !0;
38
- }, validateUnsubscribeBlockHasTemplate: (e) => b(e) === 0 ? !0 : (r({
39
- type: c.Warning,
40
- message: s(E)
41
- }), !1) };
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
+ } };
42
38
  };
43
39
  export {
44
- E as EMPTY_BLOCK_KEY,
45
- b as countUnsubBlocksWithoutPage,
46
- m as findDuplicateUnsubPageTypes,
47
- y as useUnsubscribeBlockValidator
40
+ P as useUnsubscribeBlockValidator
48
41
  };