@useinsider/guido 1.4.4-beta.42313ae → 1.4.4-beta.8b3f647

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.
@@ -1,4 +1,4 @@
1
- import { defineComponent as H, ref as m, computed as _ } from "vue";
1
+ import { defineComponent as H, ref as c, computed as _ } from "vue";
2
2
  import { useConfig as h } from "../../../composables/useConfig.js";
3
3
  import { useExport as V } from "../../../composables/useExport.js";
4
4
  import { useTestEmailClick as x } from "../../../composables/useGuidoActions.js";
@@ -10,25 +10,25 @@ import { getTooltipOptions as O } from "../../../utils/tooltipUtils.js";
10
10
  import { InButtonV2 as A } from "@useinsider/design-system-vue";
11
11
  const J = /* @__PURE__ */ H({
12
12
  __name: "RightSlot",
13
- setup(k, { expose: c }) {
14
- const { config: u } = h(), { exportHtml: r } = V(), { save: n } = E(), { openVersionHistory: i, closeVersionHistory: a } = w(), o = C(), t = T(), e = m(!1), s = m(!1), f = x(), v = () => {
13
+ setup(k, { expose: u }) {
14
+ const { config: f } = h(), { exportHtml: r } = V(), { save: n } = E(), { openVersionHistory: i, closeVersionHistory: a } = w(), o = C(), t = T(), e = c(!1), s = c(!1), v = x(), d = () => {
15
15
  if (o.isVersionHistoryOpen) {
16
16
  a();
17
17
  return;
18
18
  }
19
19
  i();
20
- }, d = async () => {
20
+ }, y = async () => {
21
21
  e.value = !0, await r(), e.value = !1;
22
- }, y = () => {
22
+ }, S = () => {
23
23
  o.isSaveAsTemplateDrawerOpen = !0;
24
- }, S = _(() => o.isVersionHistoryOpen ? t("newsletter.close-version-history") : t("newsletter.version-history")), l = async (p) => {
24
+ }, g = _(() => o.isVersionHistoryOpen ? t("newsletter.close-version-history") : t("newsletter.version-history")), l = async (p) => {
25
25
  s.value = !0, o.loadingStatus = !0;
26
- const g = await n(p);
27
- return s.value = !1, p && (o.loadingStatus = !1), g;
26
+ const m = await n(p);
27
+ return s.value = !1, (p || !m) && (o.loadingStatus = !1), m;
28
28
  };
29
- return c({
29
+ return u({
30
30
  handleSave: l
31
- }), { __sfc: !0, config: u, exportHtml: r, save: n, openVersionHistory: i, closeVersionHistory: a, editorStore: o, trans: t, isExporting: e, isSaving: s, testEmailClick: f, handleVersionHistory: v, handleExport: d, handleSaveAs: y, versionHistoryTooltipText: S, handleSave: l, getTooltipOptions: O, InButtonV2: A };
31
+ }), { __sfc: !0, config: f, exportHtml: r, save: n, openVersionHistory: i, closeVersionHistory: a, editorStore: o, trans: t, isExporting: e, isSaving: s, testEmailClick: v, handleVersionHistory: d, handleExport: y, handleSaveAs: S, versionHistoryTooltipText: g, handleSave: l, getTooltipOptions: O, InButtonV2: A };
32
32
  }
33
33
  });
34
34
  export {
@@ -1,15 +1,16 @@
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) => {
1
+ import { useConfig as n } from "./useConfig.js";
2
+ import { useSaveStart as l, useSaveComplete as m } from "./useGuidoActions.js";
3
+ import { useTemplatePreparation as c } from "../utils/templatePreparation.js";
4
+ import { useHtmlValidator as p } from "./useHtmlValidator.js";
5
+ const C = () => {
6
+ const e = l(), i = m(), { validateHtml: o } = p(), { config: a } = n();
7
+ return { save: async (r = !1) => {
7
8
  e();
8
- const { prepareTemplateDetails: r } = n(), t = await r();
9
- if (await s(t.compiledHtml, t.dynamicContentList, !0))
10
- return o || a(t), t;
9
+ const { prepareTemplateDetails: s } = c(), t = await s();
10
+ if (await o(t.compiledHtml, t.dynamicContentList, !0) && !(a.externalValidation && !await a.externalValidation(t)))
11
+ return r || i(t), t;
11
12
  } };
12
13
  };
13
14
  export {
14
- f as useSave
15
+ C as useSave
15
16
  };
@@ -23,11 +23,11 @@ const e = {
23
23
  }, t = {
24
24
  promotional: 1,
25
25
  transactional: 2
26
- }, a = "email", o = "Guido User", s = t.promotional, n = 2, i = 13, u = {
26
+ }, a = "email", o = "Guido User", s = t.promotional, n = 2, i = {
27
27
  email: 60,
28
28
  architect: 49,
29
29
  unsubscribePages: 97
30
- }, r = [
30
+ }, u = [
31
31
  "alfredtesting",
32
32
  "electio",
33
33
  "eurekatest",
@@ -65,8 +65,7 @@ export {
65
65
  a as DefaultProductType,
66
66
  o as DefaultUsername,
67
67
  n as EditorType,
68
- i as MAX_DEFAULT_TEMPLATE_ID,
69
- u as ProductIds,
70
- r as TEST_PARTNER_LIST,
68
+ i as ProductIds,
69
+ u as TEST_PARTNER_LIST,
71
70
  t as TemplateTypes
72
71
  };
@@ -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,8 +1,7 @@
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";
4
- const y = () => {
5
- const { get: r } = m(), { handleError: o } = u();
1
+ import { useHttp as a } from "../composables/useHttp.js";
2
+ import { useToaster as s } from "../composables/useToaster.js";
3
+ const m = () => {
4
+ const { get: r } = a(), { handleError: o } = s();
6
5
  return {
7
6
  getToken: async () => {
8
7
  try {
@@ -30,13 +29,15 @@ const y = () => {
30
29
  forceRecreate: !0
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(
34
- `/stripo/default-template/${l}`
35
- ), 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
- };
32
+ const { data: e } = await r("/stripo/default-template/0");
33
+ try {
34
+ return {
35
+ ...JSON.parse(e),
36
+ forceRecreate: !0
37
+ };
38
+ } catch {
39
+ return t;
40
+ }
40
41
  } catch (e) {
41
42
  return o(e, "Failed to fetch default template"), t;
42
43
  }
@@ -44,5 +45,5 @@ const y = () => {
44
45
  };
45
46
  };
46
47
  export {
47
- y as useStripoApi
48
+ m as useStripoApi
48
49
  };
@@ -1,4 +1,5 @@
1
1
  import type { CompilerRule } from './html-compiler';
2
+ import type { SavedTemplateDetails } from './stripo';
2
3
  type Extensions = {
3
4
  unsubscribe?: boolean;
4
5
  };
@@ -20,6 +21,7 @@ type BlocksConfig = {
20
21
  excludeDefaults?: GuidoBlockType[];
21
22
  includeCustoms?: GuidoCustomBlockType[];
22
23
  };
24
+ export type ExternalValidationHandler = (data: SavedTemplateDetails) => Promise<boolean>;
23
25
  export type GuidoConfig = {
24
26
  translationsPath: string;
25
27
  htmlCompilerRules?: CompilerRule[];
@@ -32,6 +34,7 @@ export type GuidoConfig = {
32
34
  features?: Features;
33
35
  blocks?: BlocksConfig;
34
36
  backButtonLabel?: string;
37
+ externalValidation?: ExternalValidationHandler;
35
38
  };
36
39
  export type TemplateConfig = {
37
40
  preselectedDynamicContentList?: DynamicContent[];
@@ -8,6 +8,5 @@ export declare const DefaultProductType = "email";
8
8
  export declare const DefaultUsername = "Guido User";
9
9
  export declare const DefaultMessageType: number;
10
10
  export declare const EditorType: number;
11
- export declare const MAX_DEFAULT_TEMPLATE_ID = 13;
12
11
  export declare const ProductIds: Record<string, number>;
13
12
  export declare const TEST_PARTNER_LIST: string[];
@@ -85,6 +85,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guidoConfi
85
85
  includeCustoms?: import("@@/Types/generic").GuidoCustomBlockType[] | undefined;
86
86
  } | undefined;
87
87
  backButtonLabel?: string | undefined;
88
+ externalValidation?: import("@@/Types/generic").ExternalValidationHandler | undefined;
88
89
  };
89
90
  templateConfig?: {
90
91
  preselectedDynamicContentList?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.4.4-beta.42313ae",
3
+ "version": "1.4.4-beta.8b3f647",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",