@useinsider/guido 2.0.0-beta.ab9d733 → 2.0.0-beta.abf145c

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 (41) hide show
  1. package/README.md +2 -0
  2. package/dist/@types/config/schemas.js +55 -39
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +15 -17
  5. package/dist/components/organisms/email-preview/desktop-preview/DesktopBrowserHeader.vue.js +18 -0
  6. package/dist/components/organisms/email-preview/desktop-preview/DesktopBrowserHeader.vue2.js +15 -0
  7. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +9 -9
  8. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +11 -15
  9. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.js +5 -5
  10. package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue.js +1 -1
  11. package/dist/components/organisms/header/EditorActions.vue.js +20 -0
  12. package/dist/components/organisms/header/EditorActions.vue2.js +41 -0
  13. package/dist/components/organisms/header/EditorToolbar.vue.js +18 -0
  14. package/dist/components/organisms/header/EditorToolbar.vue2.js +17 -0
  15. package/dist/components/organisms/header/HeaderWrapper.vue.js +9 -8
  16. package/dist/components/organisms/header/MiddleSlot.vue.js +11 -12
  17. package/dist/components/organisms/header/MiddleSlot.vue2.js +11 -16
  18. package/dist/components/organisms/header/RightSlot.vue.js +11 -14
  19. package/dist/components/organisms/header/RightSlot.vue2.js +13 -36
  20. package/dist/composables/useConfig.js +29 -27
  21. package/dist/composables/useSave.js +13 -11
  22. package/dist/composables/useStripo.js +40 -40
  23. package/dist/enums/academy.js +2 -2
  24. package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
  25. package/dist/extensions/Blocks/common-control.js +6 -7
  26. package/dist/guido.css +1 -1
  27. package/dist/services/stripoApi.js +6 -10
  28. package/dist/src/@types/config/index.d.ts +2 -2
  29. package/dist/src/@types/config/schemas.d.ts +30 -0
  30. package/dist/src/@types/config/types.d.ts +7 -1
  31. package/dist/src/components/organisms/email-preview/desktop-preview/DesktopBrowserHeader.vue.d.ts +2 -0
  32. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +4 -0
  33. package/dist/src/components/organisms/header/EditorToolbar.vue.d.ts +2 -0
  34. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  35. package/dist/src/composables/useConfig.d.ts +8 -0
  36. package/dist/src/enums/academy.d.ts +3 -3
  37. package/dist/src/extensions/Blocks/common-control.d.ts +1 -1
  38. package/dist/src/stores/config.d.ts +164 -1
  39. package/dist/static/styles/components/button.css.js +1 -1
  40. package/dist/stores/config.js +7 -0
  41. package/package.json +1 -1
@@ -1,21 +1,16 @@
1
- import { defineComponent as m, computed as i } from "vue";
2
- import { usePreviewMode as p } from "../../../composables/usePreviewMode.js";
3
- import { useTranslations as l } from "../../../composables/useTranslations.js";
4
- import d from "../email-preview/amp/AmpToggle.vue.js";
5
- import w from "../email-preview/desktop-preview/EmailSizeIndicator.vue.js";
6
- import { useEditorStore as c } from "../../../stores/editor.js";
7
- import { getTooltipOptions as f } from "../../../utils/tooltipUtils.js";
8
- import { InButtonV2 as a } from "@useinsider/design-system-vue";
9
- import v from "./version-history/VersionHistory.vue.js";
10
- import u from "./version-history/ViewOptions.vue.js";
11
- import T from "./ViewOptions.vue.js";
12
- const I = /* @__PURE__ */ m({
1
+ import { defineComponent as o } from "vue";
2
+ import r from "../email-preview/amp/AmpToggle.vue.js";
3
+ import t from "../email-preview/desktop-preview/EmailSizeIndicator.vue.js";
4
+ import { useEditorStore as i } from "../../../stores/editor.js";
5
+ import e from "./EditorToolbar.vue.js";
6
+ import m from "./version-history/VersionHistory.vue.js";
7
+ import p from "./version-history/ViewOptions.vue.js";
8
+ const S = /* @__PURE__ */ o({
13
9
  __name: "MiddleSlot",
14
- setup(_) {
15
- const o = c(), e = l(), { openPreviewMode: t, closePreviewMode: r } = p(), s = i(() => o.isPreviewModeOpen ? e("newsletter.close-email-preview") : e("newsletter.email-preview")), n = i(() => o.isCodeEditorOpen ? e("newsletter.close-html-editor") : e("newsletter.html-editor"));
16
- return { __sfc: !0, editorStore: o, trans: e, openPreviewMode: t, closePreviewMode: r, previewTooltipText: s, codeEditorTooltipText: n, handlePreviewToggle: () => o.isPreviewModeOpen ? r() : t(), AmpToggle: d, EmailSizeIndicator: w, getTooltipOptions: f, InButtonV2: a, VersionHistory: v, VersionHistoryViewOptions: u, ViewOptions: T };
10
+ setup(s) {
11
+ return { __sfc: !0, editorStore: i(), AmpToggle: r, EmailSizeIndicator: t, EditorToolbar: e, VersionHistory: m, VersionHistoryViewOptions: p };
17
12
  }
18
13
  });
19
14
  export {
20
- I as default
15
+ S as default
21
16
  };
@@ -1,20 +1,17 @@
1
- import l from "./RightSlot.vue2.js";
2
- import r from "../../../_virtual/_plugin-vue2_normalizer.js";
3
- var d = function() {
4
- var s, i, n, a;
5
- var o = this, e = o._self._c, t = o._self._setupProxy;
6
- return e("div", { staticClass: "d-f" }, [t.editorStore.isVersionHistoryOpen ? e(t.RestoreButton) : [t.isVersionHistoryButtonVisible ? e(t.InButtonV2, { attrs: { id: "guido__history-button", "left-icon": "line-architect-version-history", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryButtonDisabled, "label-text-status": !1, "selected-status": t.editorStore.isVersionHistoryOpen, "tooltip-options": t.getTooltipOptions("guido__history-button"), "tooltip-text": t.versionHistoryTooltipText }, on: { click: t.handleVersionHistory } }) : o._e(), e(t.InButtonV2, { attrs: { id: "guido__export-button", "left-icon": "line-export", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isExportButtonDisabled, "label-text-status": !1, "loading-status": t.isExporting, "tooltip-options": t.getTooltipOptions("guido__export-button"), "tooltip-text": t.trans("newsletter.export") }, on: { click: t.handleExport } }), (i = (s = t.config) == null ? void 0 : s.features) != null && i.saveAsTemplate ? e(t.InButtonV2, { attrs: { id: "guido__save-as-button", "left-icon": "line-newsletter-save-as-template", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isSaveAsButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__save-as-button"), "tooltip-text": t.trans("newsletter.save-templates") }, on: { click: t.handleSaveAs } }) : o._e(), (a = (n = t.config) == null ? void 0 : n.features) != null && a.testMessage ? e(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isTestButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__test-button", { dynamicPosition: !0 }), "tooltip-text": t.trans("newsletter.test-email") }, on: { click: t.testEmailClick } }) : o._e(), t.editorStore.isPreviewModeOpen ? o._e() : e(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "label-text": "Save", "disabled-status": !t.isSaving && t.editorStore.isSaveButtonDisabled, "loading-status": t.isSaving }, on: { click: function(_) {
7
- return t.handleSave(!1);
8
- } } })]], 2);
9
- }, u = [], p = /* @__PURE__ */ r(
10
- l,
11
- d,
12
- u,
1
+ import o from "./RightSlot.vue2.js";
2
+ import s from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var n = function() {
4
+ var r = this, t = r._self._c, e = r._self._setupProxy;
5
+ return t("div", { staticClass: "d-f" }, [e.editorStore.isVersionHistoryOpen ? t(e.RestoreButton) : t(e.EditorActions, { ref: "editorActionsRef" })], 1);
6
+ }, i = [], _ = /* @__PURE__ */ s(
7
+ o,
8
+ n,
9
+ i,
13
10
  !1,
14
11
  null,
15
12
  null
16
13
  );
17
- const f = p.exports;
14
+ const l = _.exports;
18
15
  export {
19
- f as default
16
+ l as default
20
17
  };
@@ -1,42 +1,19 @@
1
- import { defineComponent as _, ref as c, computed as f } from "vue";
2
- import { useConfig as h } from "../../../composables/useConfig.js";
3
- import { useExport as w } from "../../../composables/useExport.js";
4
- import { useTestEmailClick as x } from "../../../composables/useGuidoActions.js";
5
- import { useSave as E } from "../../../composables/useSave.js";
6
- import { useTranslations as T } from "../../../composables/useTranslations.js";
7
- import { useVersionHistoryApi as O } from "../../../composables/useVersionHistoryApi.js";
8
- import { useEditorStore as C } from "../../../stores/editor.js";
9
- import { getTooltipOptions as A } from "../../../utils/tooltipUtils.js";
10
- import { InButtonV2 as B } from "@useinsider/design-system-vue";
11
- import k from "./version-history/RestoreButton.vue.js";
12
- const K = /* @__PURE__ */ _({
1
+ import { defineComponent as i, ref as s } from "vue";
2
+ import { useEditorStore as m } from "../../../stores/editor.js";
3
+ import f from "./EditorActions.vue.js";
4
+ import a from "./version-history/RestoreButton.vue.js";
5
+ const l = /* @__PURE__ */ i({
13
6
  __name: "RightSlot",
14
- setup(R, { expose: v }) {
15
- const { config: n } = h(), { exportHtml: a } = w(), { save: l } = E(), { openVersionHistory: p, closeVersionHistory: m } = O(), o = C(), s = T(), r = c(!1), i = c(!1), d = x(), y = () => {
16
- if (o.isVersionHistoryOpen) {
17
- m();
18
- return;
7
+ setup(p, { expose: e }) {
8
+ const r = m(), o = s(null);
9
+ return e({
10
+ handleSave: (n) => {
11
+ var t;
12
+ return (t = o.value) == null ? void 0 : t.handleSave(n);
19
13
  }
20
- p();
21
- }, H = async () => {
22
- r.value = !0, await a(), r.value = !1;
23
- }, S = () => {
24
- o.isSaveAsTemplateDrawerOpen = !0;
25
- }, V = f(() => o.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), g = f(
26
- () => {
27
- var t, e;
28
- return ((e = (t = n.value) == null ? void 0 : t.features) == null ? void 0 : e.versionHistory) && !o.isPreviewModeOpen;
29
- }
30
- ), u = async (t) => {
31
- i.value = !0, o.loadingStatus = !0;
32
- const e = await l(t);
33
- return i.value = !1, t && (o.loadingStatus = !1), e;
34
- };
35
- return v({
36
- handleSave: u
37
- }), { __sfc: !0, config: n, exportHtml: a, save: l, openVersionHistory: p, closeVersionHistory: m, editorStore: o, trans: s, isExporting: r, isSaving: i, testEmailClick: d, handleVersionHistory: y, handleExport: H, handleSaveAs: S, versionHistoryTooltipText: V, isVersionHistoryButtonVisible: g, handleSave: u, getTooltipOptions: A, InButtonV2: B, RestoreButton: k };
14
+ }), { __sfc: !0, editorStore: r, editorActionsRef: o, EditorActions: f, RestoreButton: a };
38
15
  }
39
16
  });
40
17
  export {
41
- K as default
18
+ l as default
42
19
  };
@@ -1,26 +1,27 @@
1
- import { useConfigStore as F } from "../stores/config.js";
2
- import { storeToRefs as I } from "pinia";
3
- const k = () => {
4
- const e = F(), {
1
+ import { useConfigStore as I } from "../stores/config.js";
2
+ import { storeToRefs as T } from "pinia";
3
+ const w = () => {
4
+ const e = I(), {
5
5
  config: t,
6
6
  initialized: o,
7
7
  identity: r,
8
8
  partner: i,
9
- template: n,
10
- editor: a,
9
+ template: a,
10
+ editor: n,
11
11
  ui: s,
12
- features: u,
13
- blocks: d,
14
- compiler: p,
15
- templateId: c,
12
+ features: c,
13
+ blocks: u,
14
+ compiler: d,
15
+ callbacks: l,
16
+ templateId: p,
16
17
  userId: f,
17
18
  variationId: m,
18
19
  partnerName: g,
19
- productType: l,
20
- messageType: b,
21
- username: C,
22
- showHeader: y
23
- } = I(e);
20
+ productType: b,
21
+ messageType: C,
22
+ username: y,
23
+ showHeader: E
24
+ } = T(e);
24
25
  return {
25
26
  // State refs
26
27
  config: t,
@@ -28,26 +29,27 @@ const k = () => {
28
29
  // Section refs
29
30
  identity: r,
30
31
  partner: i,
31
- template: n,
32
- editor: a,
32
+ template: a,
33
+ editor: n,
33
34
  ui: s,
34
- features: u,
35
- blocks: d,
36
- compiler: p,
35
+ features: c,
36
+ blocks: u,
37
+ compiler: d,
38
+ callbacks: l,
37
39
  // Convenience refs
38
- templateId: c,
40
+ templateId: p,
39
41
  userId: f,
40
42
  variationId: m,
41
43
  partnerName: g,
42
- productType: l,
43
- messageType: b,
44
- username: C,
45
- showHeader: y,
44
+ productType: b,
45
+ messageType: C,
46
+ username: y,
47
+ showHeader: E,
46
48
  // Methods
47
49
  getConfig: () => t.value,
48
- isFeatureEnabled: (E) => e.isFeatureEnabled(E)
50
+ isFeatureEnabled: (F) => e.isFeatureEnabled(F)
49
51
  };
50
52
  };
51
53
  export {
52
- k as useConfig
54
+ w as useConfig
53
55
  };
@@ -1,15 +1,17 @@
1
- import { useSaveStart as i, useSaveComplete as m } from "./useGuidoActions.js";
2
- import { useTemplatePreparation as n } from "../utils/templatePreparation.js";
3
- import { useHtmlValidator as l } from "./useHtmlValidator.js";
4
- const f = () => {
5
- const e = i(), a = m(), { validateHtml: s } = l();
6
- return { save: async (o = !1) => {
7
- e();
8
- const { prepareTemplateDetails: r } = n(), t = await r();
9
- if (await s(t.compiledHtml, t.dynamicContentList, !0))
10
- return o || a(t), t;
1
+ import { useConfig as l } from "./useConfig.js";
2
+ import { useSaveStart as m, useSaveComplete as c } from "./useGuidoActions.js";
3
+ import { useTemplatePreparation as d } from "../utils/templatePreparation.js";
4
+ import { useHtmlValidator as p } from "./useHtmlValidator.js";
5
+ const w = () => {
6
+ const i = m(), s = c(), { validateHtml: o } = p(), { callbacks: a } = l();
7
+ return { save: async (r = !1) => {
8
+ var e;
9
+ i();
10
+ const { prepareTemplateDetails: n } = d(), t = await n();
11
+ if (await o(t.compiledHtml, t.dynamicContentList, !0) && !((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)))
12
+ return r || s(t), t;
11
13
  } };
12
14
  };
13
15
  export {
14
- f as useSave
16
+ w as useSave
15
17
  };
@@ -1,26 +1,26 @@
1
- import { useActionsApi as T } from "./useActionsApi.js";
2
- import { useBlocksConfig as V } from "./useBlocksConfig.js";
3
- import { useConfig as _ } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
5
- import { useStripoEventHandler as v } from "./useStripoEventHandler.js";
6
- import { useToaster as A } from "./useToaster.js";
7
- import { displayConditions as F } from "../enums/displayConditions.js";
8
- import { useStripoApi as D } from "../services/stripoApi.js";
9
- import I from "../static/styles/customEditorStyle.css.js";
10
- import { useEditorStore as M } from "../stores/editor.js";
11
- import { dynamicContentToMergeTags as U } from "../utils/genericUtil.js";
12
- import P from "../package.json.js";
13
- const K = (c) => {
14
- const { features: l } = _(), { handleError: u } = A(), { getToken: y, getCustomFonts: S } = D(), { handleEvent: C } = v(), { getStripoBlocksConfig: E } = V(), h = async (i, n = []) => {
15
- var g, f;
16
- const o = M(), { html: r, css: p, forceRecreate: a } = i, { baseBlocks: t, extensions: d } = await E(), m = ((g = l.value) == null ? void 0 : g.displayConditions) ?? !0, b = ((f = l.value) == null ? void 0 : f.modulesDisabled) ?? !1;
1
+ import { useActionsApi as _ } from "./useActionsApi.js";
2
+ import { useBlocksConfig as B } from "./useBlocksConfig.js";
3
+ import { useConfig as v } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as A } from "./useCustomInterfaceAppearance.js";
5
+ import { useStripoEventHandler as F } from "./useStripoEventHandler.js";
6
+ import { useToaster as D } from "./useToaster.js";
7
+ import { displayConditions as I } from "../enums/displayConditions.js";
8
+ import { useStripoApi as M } from "../services/stripoApi.js";
9
+ import U from "../static/styles/customEditorStyle.css.js";
10
+ import { useEditorStore as P } from "../stores/editor.js";
11
+ import { dynamicContentToMergeTags as R } from "../utils/genericUtil.js";
12
+ import H from "../package.json.js";
13
+ const W = (c) => {
14
+ const { features: l, template: y } = v(), { handleError: u } = D(), { getToken: C, getCustomFonts: S } = M(), { handleEvent: E } = F(), { getStripoBlocksConfig: h } = B(), w = async (i, n = []) => {
15
+ var m, g, f;
16
+ const o = P(), { html: r, css: p } = i, { baseBlocks: s, extensions: t } = await h(), a = ((m = l.value) == null ? void 0 : m.displayConditions) ?? !0, k = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, T = ((f = y.value) == null ? void 0 : f.forceRecreate) ?? !1;
17
17
  window.UIEditor.initEditor(
18
18
  document.querySelector("#guido-editor"),
19
19
  {
20
20
  metadata: c,
21
21
  html: r,
22
22
  css: p,
23
- forceRecreate: a,
23
+ forceRecreate: T,
24
24
  locale: "en",
25
25
  undoButtonSelector: "#guido__undo-button",
26
26
  redoButtonSelector: "#guido__redo-button",
@@ -30,19 +30,19 @@ const K = (c) => {
30
30
  customAppearanceMergetags: !0,
31
31
  customAppearanceMergetagsBorderColor: "#f1f3fe",
32
32
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
33
- customViewStyles: I,
34
- conditionsEnabled: m,
35
- customConditionsEnabled: m,
36
- conditionCategories: F,
33
+ customViewStyles: U,
34
+ conditionsEnabled: a,
35
+ customConditionsEnabled: a,
36
+ conditionCategories: I,
37
37
  enableXSSSecurity: !0,
38
- modulesDisabled: b,
38
+ modulesDisabled: k,
39
39
  messageSettingsEnabled: !0,
40
40
  displayGmailAnnotations: !0,
41
41
  displayHiddenPreheader: !1,
42
42
  displayTitle: !1,
43
43
  displayUTM: !1,
44
44
  selectElementAfterDrop: !0,
45
- ...t ? { baseBlocks: t } : {},
45
+ ...s ? { baseBlocks: s } : {},
46
46
  editorFonts: {
47
47
  showDefaultStandardFonts: !0,
48
48
  showDefaultNotStandardFonts: !0,
@@ -50,21 +50,21 @@ const K = (c) => {
50
50
  },
51
51
  mergeTags: [
52
52
  {
53
- entries: U(c.preselectedDynamicContentList)
53
+ entries: R(c.preselectedDynamicContentList)
54
54
  }
55
55
  ],
56
56
  async onTokenRefreshRequest(e) {
57
57
  try {
58
- const s = await y();
59
- e(s);
60
- } catch (s) {
61
- u(s, "Failed to refresh token");
58
+ const d = await C();
59
+ e(d);
60
+ } catch (d) {
61
+ u(d, "Failed to refresh token");
62
62
  }
63
63
  },
64
64
  onTemplateLoaded() {
65
65
  try {
66
- const { importCss: e } = B(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: k } = T();
67
- e(), s(), k(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
66
+ const { importCss: e } = A(), { activateCustomViewStyles: d, updateTimerInClonedTemplate: V } = _();
67
+ e(), d(), V(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
68
68
  o.hasChanges = !1;
69
69
  }, 1e3);
70
70
  } catch (e) {
@@ -83,35 +83,35 @@ const K = (c) => {
83
83
  onDataChanged() {
84
84
  o.hasChanges = !0;
85
85
  },
86
- onEvent: C,
86
+ onEvent: E,
87
87
  ignoreClickOutsideSelectors: [
88
88
  "#guido-dynamic-content-modal",
89
89
  ".in-on-board-wrapper",
90
90
  ".in-drawer__container"
91
91
  ],
92
- extensions: d
92
+ extensions: t
93
93
  }
94
94
  );
95
- }, w = (i) => new Promise((n, o) => {
96
- var d;
95
+ }, b = (i) => new Promise((n, o) => {
96
+ var a;
97
97
  if (document.getElementById("UiEditorScript")) {
98
98
  i(), n();
99
99
  return;
100
100
  }
101
- const r = P.guido, a = `https://email-static.useinsider.com/guido/${(d = r == null ? void 0 : r.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
102
- t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
101
+ const r = H.guido, s = `https://email-static.useinsider.com/guido/${(a = r == null ? void 0 : r.stripo) == null ? void 0 : a.version}/UIEditor.js`, t = document.createElement("script");
102
+ t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
103
103
  i(), n();
104
104
  }, t.onerror = () => {
105
- o(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
105
+ o(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
106
106
  }, document.body.appendChild(t);
107
107
  });
108
108
  return { initPlugin: async (i) => {
109
- await w(async () => {
109
+ await b(async () => {
110
110
  const n = await S();
111
- await h(i, n);
111
+ await w(i, n);
112
112
  });
113
113
  } };
114
114
  };
115
115
  export {
116
- K as useStripo
116
+ W as useStripo
117
117
  };
@@ -1,5 +1,5 @@
1
- const e = "https://academy.useinsider.com", o = {
2
- EMAIL_EDITOR: `${e}/docs/email-drag-drop-editor`,
1
+ const e = "https://academy.insiderone.com/", o = {
2
+ EMAIL_EDITOR: `${e}/docs/email-drag-and-drop-editor`,
3
3
  GLOBAL_UNSUBSCRIBE: `${e}/docs/global-unsubscribe-preference-center`,
4
4
  AMP_FOR_EMAILS: `${e}/docs/amp-for-emails`
5
5
  };
@@ -1,21 +1,21 @@
1
1
  import { ExtensionBuilder as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { UnsubscribeBlock as i } from "./block.js";
3
3
  import { UnsubscribeControl as t } from "./control.js";
4
- import { PreviewUIElement as o } from "./elements/preview.js";
5
- import { UnsubscribeIconsRegistry as r } from "./iconsRegistry.js";
6
- import { SettingsPanel as s } from "./settingsPanel.js";
4
+ import { PreviewUIElement as s } from "./elements/preview.js";
5
+ import { UnsubscribeIconsRegistry as o } from "./iconsRegistry.js";
6
+ import { SettingsPanel as r } from "./settingsPanel.js";
7
7
  import n from "./styles.css.js";
8
- import { UnsubscribeTagRegistry as l } from "./tagRegistry.js";
9
- const f = new e().addBlock(i).withSettingsPanelRegistry(s).addControl(t).addUiElement(o).addStyles(n).withLocalization({
8
+ import { UnsubscribeTagRegistry as c } from "./tagRegistry.js";
9
+ const g = new e().addBlock(i).withSettingsPanelRegistry(r).addControl(t).addUiElement(s).addStyles(n).withLocalization({
10
10
  en: {
11
- "Unsubscribe Block": "Unsubscribe Block",
12
- "Unsubscribe Block Description": "Add an unsubscribe link to your email",
11
+ "Unsubscribe Block": "Unsubscribe",
12
+ "Unsubscribe Block Description": "Unsubscribe lets you add an Unsubscribe Link to direct users to opt out of receiving your messages.",
13
13
  "Select Template": "Select Template",
14
14
  "Unsubscribe Template": "Unsubscribe Template",
15
15
  Showing: "Showing",
16
16
  of: "of"
17
17
  }
18
- }).withUiElementTagRegistry(l).withIconsRegistry(r).build();
18
+ }).withUiElementTagRegistry(c).withIconsRegistry(o).build();
19
19
  export {
20
- f as default
20
+ g as default
21
21
  };
@@ -1,12 +1,12 @@
1
1
  var c = Object.defineProperty;
2
2
  var I = (a, r, e) => r in a ? c(a, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[r] = e;
3
- var l = (a, r, e) => I(a, typeof r != "symbol" ? r + "" : r, e);
3
+ var u = (a, r, e) => I(a, typeof r != "symbol" ? r + "" : r, e);
4
4
  import { Control as O, UIElementType as t, UEAttr as $ } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  class _ extends O {
6
6
  constructor() {
7
7
  super(...arguments);
8
- l(this, "currentNode");
9
- l(this, "lastBlockInstanceId", null);
8
+ u(this, "currentNode");
9
+ u(this, "lastBlockInstanceId", null);
10
10
  }
11
11
  getContainer() {
12
12
  var e;
@@ -52,10 +52,9 @@ class _ extends O {
52
52
  const T = o !== this.lastBlockInstanceId;
53
53
  return T ? (this.currentNode && e(this.currentNode), n(), this.lastBlockInstanceId = o) : n(), T;
54
54
  }
55
- _GuLabel({ text: e, name: n = "", position: E = "top" }) {
55
+ _GuLabel({ text: e, name: n = "" }) {
56
56
  return `
57
57
  <${t.LABEL}
58
- style="${E === "top" ? "margin-bottom: 8px;" : ""}"
59
58
  ${$.LABEL.text}="${e}"
60
59
  ${$.LABEL.name}="${n || `${e} Label`}">
61
60
  </${t.LABEL}>
@@ -170,9 +169,9 @@ class _ extends O {
170
169
  _GuOrderable(e, n) {
171
170
  let E = "";
172
171
  n.forEach((T) => {
173
- const u = $.ORDERABLE_ITEM && "name" in $.ORDERABLE_ITEM ? $.ORDERABLE_ITEM.name : "name";
172
+ const l = $.ORDERABLE_ITEM && "name" in $.ORDERABLE_ITEM ? $.ORDERABLE_ITEM.name : "name";
174
173
  E += `
175
- <${t.ORDERABLE_ITEM} ${u}="${T.key}">
174
+ <${t.ORDERABLE_ITEM} ${l}="${T.key}">
176
175
  ${T.content}
177
176
  </${t.ORDERABLE_ITEM}>
178
177
  `;
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- .gap-16[data-v-6562e38c],.gap-16[data-v-1ccb6d4a]{gap:16px}[data-v-aa6fa221] .in-button-v2__wrapper{line-height:0}[data-v-913a3417] .in-progress-wrapper__progress p span:last-child{display:none!important}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.middle-slot__buttons[data-v-1245a10c]{gap:4px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-282ca4d1]{position:relative;width:100%;height:calc(100vh - 128px)}.guido-editor__container[data-v-282ca4d1]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-282ca4d1]{height:calc(100vh - 75px)}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-a86fc486]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-a86fc486]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-a86fc486]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-a86fc486]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-a86fc486]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-a00b5f5f]{gap:16px}.desktop-preview[data-v-c696a488]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview__browser-header[data-v-c696a488]{height:79px;min-height:79px}.desktop-preview__browser-header-left[data-v-c696a488]{-webkit-user-drag:none;height:79px;width:378px}.desktop-preview__browser-header-center[data-v-c696a488]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-preview__browser-header-right[data-v-c696a488]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview iframe[data-v-c696a488]{min-height:504px}.iframe-wrapper[data-v-f413124b]{width:258px}.iframe-scaled[data-v-f413124b]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-d0c87cb5]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.empty-row[data-v-d0c87cb5]{height:64px}.mobile-preview-wrapper__phone[data-v-f9d20813]{width:282px}.mobile-preview-wrapper__phone img[data-v-f9d20813]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-f9d20813]{width:258px;height:450px;left:12px}[data-v-d3c52b44] .vueperslides__bullets,[data-v-dd1a237a] .vueperslides__bullets{pointer-events:none!important}[data-v-dd1a237a] .vueperslides__parallax-wrapper{height:110px!important}[data-v-a408dcea] .vueperslides__bullets{pointer-events:none!important}[data-v-a408dcea] .vueperslides__parallax-wrapper{height:110px!important}
1
+ .gap-16[data-v-6562e38c],.gap-16[data-v-1ccb6d4a]{gap:16px}[data-v-aa6fa221] .in-button-v2__wrapper{line-height:0}[data-v-913a3417] .in-progress-wrapper__progress p span:last-child{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.header-wrapper[data-v-5df46e7a]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-890b5336]{position:relative;width:100%;height:calc(100vh - 128px)}.guido-editor__container[data-v-890b5336]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-890b5336]{height:calc(100vh - 75px)}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-a86fc486]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-a86fc486]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-a86fc486]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-a86fc486]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-a86fc486]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-a00b5f5f]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-e59b43cb]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-e59b43cb]{min-height:504px}.iframe-wrapper[data-v-f413124b]{width:258px}.iframe-scaled[data-v-f413124b]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-d3c52b44] .vueperslides__bullets,[data-v-dd1a237a] .vueperslides__bullets{pointer-events:none!important}[data-v-dd1a237a] .vueperslides__parallax-wrapper{height:110px!important}[data-v-a408dcea] .vueperslides__bullets{pointer-events:none!important}[data-v-a408dcea] .vueperslides__parallax-wrapper{height:110px!important}
@@ -1,8 +1,8 @@
1
1
  import { useHttp as m } from "../composables/useHttp.js";
2
- import { useToaster as u } from "../composables/useToaster.js";
3
- import { MAX_DEFAULT_TEMPLATE_ID as i } from "../enums/defaults.js";
2
+ import { useToaster as i } from "../composables/useToaster.js";
3
+ import { MAX_DEFAULT_TEMPLATE_ID as p } from "../enums/defaults.js";
4
4
  const y = () => {
5
- const { get: r } = m(), { handleError: o } = u();
5
+ const { get: r } = m(), { handleError: o } = i();
6
6
  return {
7
7
  getToken: async () => {
8
8
  try {
@@ -26,17 +26,13 @@ const y = () => {
26
26
  getDefaultTemplate: async () => {
27
27
  const t = {
28
28
  html: "",
29
- css: "",
30
- forceRecreate: !0
29
+ css: ""
31
30
  };
32
31
  try {
33
- const c = new URLSearchParams(window.location.search).get("default-template"), s = c ? parseInt(c) : 0, l = s >= 1 && s <= i ? s : 0, { data: n } = await r(
32
+ const c = new URLSearchParams(window.location.search).get("default-template"), s = c ? parseInt(c) : 0, l = s >= 1 && s <= p ? s : 0, { data: n } = await r(
34
33
  `/stripo/default-template/${l}`
35
34
  ), a = typeof n == "string" ? JSON.parse(n) : n;
36
- return !a || typeof a != "object" || !("html" in a) || !("css" in a) ? t : {
37
- ...a,
38
- forceRecreate: !0
39
- };
35
+ return !a || typeof a != "object" || !("html" in a) || !("css" in a) ? t : a;
40
36
  } catch (e) {
41
37
  return o(e, "Failed to fetch default template"), t;
42
38
  }
@@ -7,8 +7,8 @@
7
7
  * - Default values for optional configuration
8
8
  * - Validation utilities
9
9
  */
10
- export { MessageType, ProductType, GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, DynamicContentSchema, EmailHeaderSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema, CompilerRuleSchema, CompilerRuleTypeSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, } from './schemas';
11
- export type { GuidoConfig, GuidoConfigInput, IdentityConfig, IdentityConfigInput, PartnerConfig, PartnerConfigInput, TemplateConfig, TemplateConfigInput, EditorConfig, EditorConfigInput, UIConfig, UIConfigInput, FeaturesConfig, FeaturesConfigInput, BlocksConfig, BlocksConfigInput, CompilerConfig, CompilerConfigInput, EmailHeader, DynamicContent, DefaultBlockType, CustomBlockType, BlockType, FeatureName, CompilerRule, ReplaceRule, RegexRule, RemoveRule, CustomRule, DeepPartial, ConfigOverrides, } from './types';
10
+ export { MessageType, ProductType, GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, CallbacksSchema, DynamicContentSchema, EmailHeaderSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema, CompilerRuleSchema, CompilerRuleTypeSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, } from './schemas';
11
+ export type { GuidoConfig, GuidoConfigInput, IdentityConfig, IdentityConfigInput, PartnerConfig, PartnerConfigInput, TemplateConfig, TemplateConfigInput, EditorConfig, EditorConfigInput, UIConfig, UIConfigInput, FeaturesConfig, FeaturesConfigInput, BlocksConfig, BlocksConfigInput, CompilerConfig, CompilerConfigInput, CallbacksConfig, CallbacksConfigInput, ExternalValidationHandler, EmailHeader, DynamicContent, DefaultBlockType, CustomBlockType, BlockType, FeatureName, CompilerRule, ReplaceRule, RegexRule, RemoveRule, CustomRule, DeepPartial, ConfigOverrides, } from './types';
12
12
  export { DEFAULT_EMAIL_HEADER, DEFAULT_TEMPLATE, DEFAULT_EDITOR, DEFAULT_UI, DEFAULT_FEATURES, DEFAULT_BLOCKS, DEFAULT_COMPILER, DEFAULT_PRODUCT_TYPE, DEFAULT_MESSAGE_TYPE, DEFAULT_USERNAME, EDITOR_TYPE, TEST_PARTNERS, isTestPartner, } from './defaults';
13
13
  export { validateConfig, parseConfig, parseConfigSafe, getValidationErrors, isValidConfig, validateIdentity, validatePartner, } from './validator';
14
14
  export type { ValidationResult, ValidationError, } from './validator';
@@ -5,7 +5,14 @@
5
5
  * All types are inferred from these schemas to ensure single source of truth.
6
6
  * @module @types/config/schemas
7
7
  */
8
+ import type { SavedTemplateDetails } from '../stripo';
8
9
  import * as v from 'valibot';
10
+ /**
11
+ * Handler function for external validation before save
12
+ * @param data - The template details to validate
13
+ * @returns Promise<boolean> - true if valid, false to cancel save
14
+ */
15
+ export type ExternalValidationHandler = (data: SavedTemplateDetails) => Promise<boolean>;
9
16
  /**
10
17
  * Message type constants for email templates
11
18
  */
@@ -90,6 +97,8 @@ export declare const TemplateSchema: v.ObjectSchema<{
90
97
  }, undefined>, undefined>, readonly []>;
91
98
  /** Selected unsubscribe page IDs */
92
99
  readonly selectedUnsubscribePages: v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>;
100
+ /** Force recreate template in Stripo storage (use true when updating externally modified templates) */
101
+ readonly forceRecreate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
93
102
  }, undefined>;
94
103
  /**
95
104
  * Email header configuration (sender name and subject)
@@ -344,6 +353,16 @@ export declare const CompilerSchema: v.ObjectSchema<{
344
353
  /** Skip default compiler rules */
345
354
  readonly ignoreDefaultRules: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
346
355
  }, undefined>;
356
+ /**
357
+ * Callbacks configuration - event handlers and hooks
358
+ */
359
+ export declare const CallbacksSchema: v.ObjectSchema<{
360
+ /**
361
+ * External validation handler called before save completes.
362
+ * Return false to cancel the save operation.
363
+ */
364
+ readonly externalValidation: v.OptionalSchema<v.CustomSchema<ExternalValidationHandler, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
365
+ }, undefined>;
347
366
  /**
348
367
  * Complete Guido configuration schema
349
368
  *
@@ -356,6 +375,7 @@ export declare const CompilerSchema: v.ObjectSchema<{
356
375
  * - features: Feature toggles
357
376
  * - blocks: Block configuration
358
377
  * - compiler: HTML compilation
378
+ * - callbacks: Event handlers and hooks
359
379
  */
360
380
  export declare const GuidoConfigSchema: v.ObjectSchema<{
361
381
  /** Identity configuration (required) */
@@ -400,6 +420,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
400
420
  }, undefined>, undefined>, readonly []>;
401
421
  /** Selected unsubscribe page IDs */
402
422
  readonly selectedUnsubscribePages: v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>;
423
+ /** Force recreate template in Stripo storage (use true when updating externally modified templates) */
424
+ readonly forceRecreate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
403
425
  }, undefined>, {}>;
404
426
  /** Editor settings */
405
427
  readonly editor: v.OptionalSchema<v.ObjectSchema<{
@@ -506,4 +528,12 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
506
528
  /** Skip default compiler rules */
507
529
  readonly ignoreDefaultRules: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
508
530
  }, undefined>, {}>;
531
+ /** Callbacks and event handlers */
532
+ readonly callbacks: v.OptionalSchema<v.ObjectSchema<{
533
+ /**
534
+ * External validation handler called before save completes.
535
+ * Return false to cancel the save operation.
536
+ */
537
+ readonly externalValidation: v.OptionalSchema<v.CustomSchema<ExternalValidationHandler, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
538
+ }, undefined>, {}>;
509
539
  }, undefined>;