@useinsider/guido 1.0.0-beta.c798ebe → 1.0.0-beta.c99b3ab

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 (77) hide show
  1. package/dist/@types/generic.d.ts +0 -5
  2. package/dist/@types/save-as-template.d.ts +11 -0
  3. package/dist/components/Guido.vue.d.ts +1 -0
  4. package/dist/components/Guido.vue.js +8 -8
  5. package/dist/components/Guido.vue2.js +41 -41
  6. package/dist/components/organisms/header/MiddleSlot.vue.js +9 -9
  7. package/dist/components/organisms/header/MiddleSlot.vue2.js +14 -19
  8. package/dist/components/organisms/header/RightSlot.vue.js +5 -5
  9. package/dist/components/organisms/header/RightSlot.vue2.js +20 -19
  10. package/dist/components/organisms/header/ViewOptions.vue.js +8 -8
  11. package/dist/components/organisms/header/ViewOptions.vue2.js +8 -10
  12. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue.js +20 -0
  13. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +58 -0
  14. package/dist/components/wrappers/{WpModal.vue.d.ts → WpDrawer.vue.d.ts} +27 -40
  15. package/dist/components/wrappers/WpDrawer.vue.js +25 -0
  16. package/dist/components/wrappers/WpDrawer.vue2.js +23 -0
  17. package/dist/composables/useActionsApi.d.ts +0 -2
  18. package/dist/composables/useActionsApi.js +36 -52
  19. package/dist/composables/useStripo.js +13 -9
  20. package/dist/composables/useValidation.d.ts +30 -0
  21. package/dist/composables/useValidation.js +19 -0
  22. package/dist/composables/validators/saveAsTemplate.d.ts +26 -0
  23. package/dist/composables/validators/saveAsTemplate.js +21 -0
  24. package/dist/enums/defaults.js +5 -9
  25. package/dist/guido.css +1 -1
  26. package/dist/mock/api/template-library.d.ts +2 -0
  27. package/dist/node_modules/valibot/dist/index.js +157 -0
  28. package/dist/stores/editor.d.ts +2 -0
  29. package/dist/stores/editor.js +5 -3
  30. package/dist/stores/save-as-template.d.ts +25 -0
  31. package/dist/stores/save-as-template.js +44 -0
  32. package/package.json +2 -1
  33. package/dist/components/organisms/email-preview/PreviewContainer.vue.js +0 -19
  34. package/dist/components/organisms/email-preview/PreviewContainer.vue2.js +0 -19
  35. package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue.d.ts +0 -4
  36. package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue.js +0 -22
  37. package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue2.js +0 -30
  38. package/dist/components/organisms/email-preview/amp/AmpToggle.vue.d.ts +0 -2
  39. package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +0 -19
  40. package/dist/components/organisms/email-preview/amp/AmpToggle.vue2.js +0 -29
  41. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.d.ts +0 -2
  42. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +0 -22
  43. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +0 -30
  44. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue.d.ts +0 -2
  45. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue.js +0 -17
  46. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +0 -20
  47. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.d.ts +0 -2
  48. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +0 -18
  49. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +0 -22
  50. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.d.ts +0 -4
  51. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +0 -19
  52. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +0 -23
  53. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.d.ts +0 -4
  54. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.js +0 -20
  55. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +0 -21
  56. package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue.d.ts +0 -2
  57. package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue.js +0 -17
  58. package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue2.js +0 -22
  59. package/dist/components/wrappers/WpModal.vue.js +0 -27
  60. package/dist/components/wrappers/WpModal.vue2.js +0 -22
  61. package/dist/composables/useCodeEditorApi.d.ts +0 -4
  62. package/dist/composables/useCodeEditorApi.js +0 -11
  63. package/dist/composables/useConfig.d.ts +0 -5
  64. package/dist/composables/useConfig.js +0 -11
  65. package/dist/composables/useDebounce.d.ts +0 -4
  66. package/dist/composables/useDebounce.js +0 -12
  67. package/dist/composables/usePreviewMode.d.ts +0 -5
  68. package/dist/composables/usePreviewMode.js +0 -31
  69. package/dist/composables/useResponsivePreview.d.ts +0 -5
  70. package/dist/composables/useResponsivePreview.js +0 -86
  71. package/dist/enums/preview.d.ts +0 -13
  72. package/dist/enums/preview.js +0 -23
  73. package/dist/static/assets/inbox-mockup.svg.js +0 -4
  74. package/dist/static/assets/phone-mockup.svg.js +0 -4
  75. package/dist/stores/preview.d.ts +0 -89
  76. package/dist/stores/preview.js +0 -63
  77. /package/dist/components/organisms/{email-preview/PreviewContainer.vue.d.ts → save-as-template/SaveAsTemplateDrawer.vue.d.ts} +0 -0
@@ -1,54 +1,38 @@
1
- const w = () => {
2
- const s = (t = {}) => new Promise((e, a) => {
3
- const i = { ...{
4
- minimize: !0,
5
- utmEntity: {
6
- utmSource: "",
7
- utmMedium: "",
8
- utmCampaign: "",
9
- utmContent: "",
10
- utmTerm: "",
11
- customUtms: [
12
- {
13
- name1: "val1",
14
- name2: "val2"
15
- }
16
- ]
17
- },
18
- mergeTags: ["Tag1", "Tag2"],
19
- forseAmp: !1,
20
- resetDataSavedFlag: !1,
21
- disableLineHeightsReplace: !0
22
- }, ...t }, n = {
23
- callback: (m, l, c, r, p) => {
24
- m ? a(m) : e({
25
- html: l,
26
- ampHtml: c,
27
- ampErrors: r,
28
- displayConditions: p
29
- });
30
- },
31
- ...i
32
- };
33
- window.StripoEditorApi.actionsApi.compileEmail(n);
34
- });
35
- return { getCompiledEmail: s, activateCustomViewStyles: (t = !0) => {
36
- window.StripoEditorApi.actionsApi.activateCustomViewStyles(t);
37
- }, getPreviewData: async (t) => {
38
- const {
39
- html: e,
40
- displayConditions: a,
41
- ampHtml: o = "",
42
- ampErrors: i = []
43
- } = await s({ minimize: !1, resetDataSavedFlag: !1, ...t });
44
- return {
45
- html: e,
46
- ampHtml: o,
47
- ampErrors: i,
48
- displayConditions: a
49
- };
50
- } };
51
- };
1
+ const g = () => ({ getCompiledEmail: (t = {}) => new Promise((i, a) => {
2
+ const s = { ...{
3
+ minimize: !0,
4
+ utmEntity: {
5
+ utmSource: "",
6
+ utmMedium: "",
7
+ utmCampaign: "",
8
+ utmContent: "",
9
+ utmTerm: "",
10
+ customUtms: [
11
+ {
12
+ name1: "val1",
13
+ name2: "val2"
14
+ }
15
+ ]
16
+ },
17
+ mergeTags: ["Tag1", "Tag2"],
18
+ forseAmp: !1,
19
+ resetDataSavedFlag: !1,
20
+ disableLineHeightsReplace: !0
21
+ }, ...t }, o = {
22
+ callback: (e, m, l, n, c) => {
23
+ e ? a(e) : i({
24
+ html: m,
25
+ ampHtml: l,
26
+ ampErrors: n,
27
+ displayConditions: c
28
+ });
29
+ },
30
+ ...s
31
+ };
32
+ window.StripoEditorApi.actionsApi.compileEmail(o);
33
+ }), activateCustomViewStyles: (t = !0) => {
34
+ window.StripoEditorApi.actionsApi.activateCustomViewStyles(t);
35
+ } });
52
36
  export {
53
- w as useActionsApi
37
+ g as useActionsApi
54
38
  };
@@ -1,13 +1,13 @@
1
1
  import { useActionsApi as g } from "./useActionsApi.js";
2
2
  import { useCustomInterfaceAppearance as f } from "./useCustomInterfaceAppearance.js";
3
- import { useToaster as E } from "./useToaster.js";
4
- import { displayConditions as S } from "../enums/displayConditions.js";
5
- import y from "../extensions/DynamicContent/extension.js";
6
- import { useStripoApi as C } from "../services/stripoApi.js";
7
- import { useEditorStore as w } from "../stores/editor.js";
3
+ import { useToaster as S } from "./useToaster.js";
4
+ import { displayConditions as C } from "../enums/displayConditions.js";
5
+ import E from "../extensions/DynamicContent/extension.js";
6
+ import { useStripoApi as y } from "../services/stripoApi.js";
7
+ import { useEditorStore as h } from "../stores/editor.js";
8
8
  const A = (a) => {
9
- const { handleError: d } = E(), { getToken: c, getCustomFonts: u } = C(), l = (e, r = []) => {
10
- const i = w(), { html: t, css: s, forceRecreate: m } = e;
9
+ const { handleError: d } = S(), { getToken: c, getCustomFonts: u } = y(), l = (e, r = []) => {
10
+ const i = h(), { html: t, css: s, forceRecreate: m } = e;
11
11
  window.UIEditor.initEditor(
12
12
  document.querySelector("#guido-editor"),
13
13
  {
@@ -30,7 +30,8 @@ const A = (a) => {
30
30
  `,
31
31
  conditionsEnabled: !0,
32
32
  customConditionsEnabled: !0,
33
- conditionCategories: S,
33
+ conditionCategories: C,
34
+ enableXSSSecurity: !0,
34
35
  messageSettingsEnabled: !1,
35
36
  editorFonts: {
36
37
  showDefaultStandardFonts: !0,
@@ -62,8 +63,11 @@ const A = (a) => {
62
63
  onVersionHistoryVisibilityChanged(o) {
63
64
  i.isVersionHistoryOpen = o;
64
65
  },
66
+ onDataChanged() {
67
+ i.hasChanges = !0;
68
+ },
65
69
  ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal"],
66
- extensions: [y]
70
+ extensions: [E]
67
71
  }
68
72
  );
69
73
  }, p = (e) => new Promise((r, i) => {
@@ -0,0 +1,30 @@
1
+ import { type BaseIssue, type BaseSchema } from 'valibot';
2
+ import { type Ref } from 'vue';
3
+ type Base = BaseSchema<unknown, unknown, BaseIssue<unknown>>;
4
+ type MaybeRefOrGetter<T> = T | Ref<T> | (() => T);
5
+ export declare function useValidation<const Schema extends Base = Base>(input: MaybeRefOrGetter<unknown>, schema: Schema): {
6
+ schema: Schema;
7
+ validate: () => {
8
+ error: import("valibot").InferIssue<Schema> | undefined;
9
+ errorMessage: string;
10
+ typed: true;
11
+ success: true;
12
+ output: import("valibot").InferOutput<Schema>;
13
+ issues: undefined;
14
+ } | {
15
+ error: import("valibot").InferIssue<Schema> | undefined;
16
+ errorMessage: string;
17
+ typed: true;
18
+ success: false;
19
+ output: import("valibot").InferOutput<Schema>;
20
+ issues: [import("valibot").InferIssue<Schema>, ...import("valibot").InferIssue<Schema>[]];
21
+ } | {
22
+ error: import("valibot").InferIssue<Schema> | undefined;
23
+ errorMessage: string;
24
+ typed: false;
25
+ success: false;
26
+ output: unknown;
27
+ issues: [import("valibot").InferIssue<Schema>, ...import("valibot").InferIssue<Schema>[]];
28
+ };
29
+ };
30
+ export {};
@@ -0,0 +1,19 @@
1
+ import { safeParse as i } from "../node_modules/valibot/dist/index.js";
2
+ import { unref as u } from "vue";
3
+ function l(a, e) {
4
+ return {
5
+ schema: e,
6
+ validate: () => {
7
+ var s, t, o;
8
+ const r = i(e, u(a), { abortPipeEarly: !0 });
9
+ return {
10
+ ...r,
11
+ error: (s = r.issues) == null ? void 0 : s[0],
12
+ errorMessage: ((o = (t = r.issues) == null ? void 0 : t[0]) == null ? void 0 : o.message) || ""
13
+ };
14
+ }
15
+ };
16
+ }
17
+ export {
18
+ l as useValidation
19
+ };
@@ -0,0 +1,26 @@
1
+ import type { Ref } from 'vue';
2
+ export declare const useTemplateNameValidator: (name: Ref<string>) => {
3
+ schema: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").NonEmptyAction<string, string>, import("valibot").MaxLengthAction<string, 255, string>]>;
4
+ validate: () => {
5
+ error: import("valibot").StringIssue | import("valibot").NonEmptyIssue<string> | import("valibot").MaxLengthIssue<string, 255> | undefined;
6
+ errorMessage: string;
7
+ typed: true;
8
+ success: true;
9
+ output: string;
10
+ issues: undefined;
11
+ } | {
12
+ error: import("valibot").StringIssue | import("valibot").NonEmptyIssue<string> | import("valibot").MaxLengthIssue<string, 255> | undefined;
13
+ errorMessage: string;
14
+ typed: true;
15
+ success: false;
16
+ output: string;
17
+ issues: [import("valibot").StringIssue | import("valibot").NonEmptyIssue<string> | import("valibot").MaxLengthIssue<string, 255>, ...(import("valibot").StringIssue | import("valibot").NonEmptyIssue<string> | import("valibot").MaxLengthIssue<string, 255>)[]];
18
+ } | {
19
+ error: import("valibot").StringIssue | import("valibot").NonEmptyIssue<string> | import("valibot").MaxLengthIssue<string, 255> | undefined;
20
+ errorMessage: string;
21
+ typed: false;
22
+ success: false;
23
+ output: unknown;
24
+ issues: [import("valibot").StringIssue | import("valibot").NonEmptyIssue<string> | import("valibot").MaxLengthIssue<string, 255>, ...(import("valibot").StringIssue | import("valibot").NonEmptyIssue<string> | import("valibot").MaxLengthIssue<string, 255>)[]];
25
+ };
26
+ };
@@ -0,0 +1,21 @@
1
+ import { pipe as r, maxLength as i, nonEmpty as n, string as o } from "../../node_modules/valibot/dist/index.js";
2
+ import { useTranslations as s } from "../useTranslations.js";
3
+ import { useValidation as m } from "../useValidation.js";
4
+ const u = (e) => {
5
+ const t = s(), a = 255;
6
+ return m(e, r(
7
+ o(),
8
+ n(t("whatsapp-business.template-name-required")),
9
+ i(
10
+ a,
11
+ t("validations.enter-up-to-x-characters", {
12
+ article: "a",
13
+ field: t("products.template-name"),
14
+ max: a
15
+ })
16
+ )
17
+ ));
18
+ };
19
+ export {
20
+ u as useTemplateNameValidator
21
+ };
@@ -1,12 +1,8 @@
1
- const e = {
2
- translationsPath: "window.trans.en",
3
- emailHeader: {
4
- senderName: "",
5
- subject: ""
6
- }
7
- }, t = "newsletter", n = "Guido User";
1
+ const t = {
2
+ translationsPath: "window.trans.en"
3
+ }, e = "newsletter", n = "Guido User";
8
4
  export {
9
- e as DefaultGuidoConfig,
10
- t as DefaultProductType,
5
+ t as DefaultGuidoConfig,
6
+ e as DefaultProductType,
11
7
  n as DefaultUsername
12
8
  };
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- .version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}[data-v-6a2bde67] .guido__verion-history-view-option-selection-desktop svg,[data-v-6a2bde67] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6a2bde67] .in-segments-wrapper__button_selected,[data-v-6a2bde67] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-c4fe2637] .guido__view-option-selection-desktop svg,[data-v-c4fe2637] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-c4fe2637] .in-segments-wrapper__button_selected,[data-v-c4fe2637] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.guido-editor__wrapper[data-v-5fe1cbdf],.guido-editor__container[data-v-5fe1cbdf]{width:100%;height:calc(100vh - 75px)}.error-list[data-v-cfb613b7]{gap:16px}[data-v-bd212ce2] .in-progress-wrapper__progress p span:last-child{display:none!important}.desktop-preview-container[data-v-9c6e7ff0],[data-v-9c6e7ff0] .desktop-preview-container .in-container{min-height:720px!important;height:100%}.cropped-text[data-v-d3bb77b4]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
1
+ .version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}[data-v-6a2bde67] .guido__verion-history-view-option-selection-desktop svg,[data-v-6a2bde67] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6a2bde67] .in-segments-wrapper__button_selected,[data-v-6a2bde67] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-0fff376c] .guido__view-option-selection-desktop svg,[data-v-0fff376c] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-0fff376c] .in-segments-wrapper__button_selected,[data-v-0fff376c] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.guido-editor__wrapper[data-v-202b6818],.guido-editor__container[data-v-202b6818]{width:100%;height:calc(100vh - 75px)}
@@ -0,0 +1,2 @@
1
+ declare const _default: import("msw").HttpHandler[];
2
+ export default _default;
@@ -0,0 +1,157 @@
1
+ var a;
2
+ // @__NO_SIDE_EFFECTS__
3
+ function f(e) {
4
+ return {
5
+ lang: (e == null ? void 0 : e.lang) ?? (a == null ? void 0 : a.lang),
6
+ message: e == null ? void 0 : e.message,
7
+ abortEarly: (e == null ? void 0 : e.abortEarly) ?? (a == null ? void 0 : a.abortEarly),
8
+ abortPipeEarly: (e == null ? void 0 : e.abortPipeEarly) ?? (a == null ? void 0 : a.abortPipeEarly)
9
+ };
10
+ }
11
+ var p;
12
+ // @__NO_SIDE_EFFECTS__
13
+ function E(e) {
14
+ return p == null ? void 0 : p.get(e);
15
+ }
16
+ var y;
17
+ // @__NO_SIDE_EFFECTS__
18
+ function k(e) {
19
+ return y == null ? void 0 : y.get(e);
20
+ }
21
+ var m;
22
+ // @__NO_SIDE_EFFECTS__
23
+ function P(e, n) {
24
+ var s;
25
+ return (s = m == null ? void 0 : m.get(e)) == null ? void 0 : s.get(n);
26
+ }
27
+ // @__NO_SIDE_EFFECTS__
28
+ function $(e) {
29
+ var s, r;
30
+ const n = typeof e;
31
+ return n === "string" ? `"${e}"` : n === "number" || n === "bigint" || n === "boolean" ? `${e}` : n === "object" || n === "function" ? (e && ((r = (s = Object.getPrototypeOf(e)) == null ? void 0 : s.constructor) == null ? void 0 : r.name)) ?? "null" : n;
32
+ }
33
+ function c(e, n, s, r, u) {
34
+ const g = u && "input" in u ? u.input : s.value, t = (u == null ? void 0 : u.expected) ?? e.expects ?? null, v = (u == null ? void 0 : u.received) ?? /* @__PURE__ */ $(g), i = {
35
+ kind: e.kind,
36
+ type: e.type,
37
+ input: g,
38
+ expected: t,
39
+ received: v,
40
+ message: `Invalid ${n}: ${t ? `Expected ${t} but r` : "R"}eceived ${v}`,
41
+ requirement: e.requirement,
42
+ path: u == null ? void 0 : u.path,
43
+ issues: u == null ? void 0 : u.issues,
44
+ lang: r.lang,
45
+ abortEarly: r.abortEarly,
46
+ abortPipeEarly: r.abortPipeEarly
47
+ }, b = e.kind === "schema", l = (u == null ? void 0 : u.message) ?? e.message ?? /* @__PURE__ */ P(e.reference, i.lang) ?? (b ? /* @__PURE__ */ k(i.lang) : null) ?? r.message ?? /* @__PURE__ */ E(i.lang);
48
+ l !== void 0 && (i.message = typeof l == "function" ? (
49
+ // @ts-expect-error
50
+ l(i)
51
+ ) : l), b && (s.typed = !1), s.issues ? s.issues.push(i) : s.issues = [i];
52
+ }
53
+ // @__NO_SIDE_EFFECTS__
54
+ function d(e) {
55
+ return {
56
+ version: 1,
57
+ vendor: "valibot",
58
+ validate(n) {
59
+ return e["~run"]({ value: n }, /* @__PURE__ */ f());
60
+ }
61
+ };
62
+ }
63
+ // @__NO_SIDE_EFFECTS__
64
+ function _(e, n) {
65
+ return {
66
+ kind: "validation",
67
+ type: "max_length",
68
+ reference: _,
69
+ async: !1,
70
+ expects: `<=${e}`,
71
+ requirement: e,
72
+ message: n,
73
+ "~run"(s, r) {
74
+ return s.typed && s.value.length > this.requirement && c(this, "length", s, r, {
75
+ received: `${s.value.length}`
76
+ }), s;
77
+ }
78
+ };
79
+ }
80
+ // @__NO_SIDE_EFFECTS__
81
+ function x(e) {
82
+ return {
83
+ kind: "validation",
84
+ type: "non_empty",
85
+ reference: x,
86
+ async: !1,
87
+ expects: "!0",
88
+ message: e,
89
+ "~run"(n, s) {
90
+ return n.typed && n.value.length === 0 && c(this, "length", n, s, {
91
+ received: "0"
92
+ }), n;
93
+ }
94
+ };
95
+ }
96
+ // @__NO_SIDE_EFFECTS__
97
+ function S(e) {
98
+ return {
99
+ kind: "schema",
100
+ type: "string",
101
+ reference: S,
102
+ expects: "string",
103
+ async: !1,
104
+ message: e,
105
+ get "~standard"() {
106
+ return /* @__PURE__ */ d(this);
107
+ },
108
+ "~run"(n, s) {
109
+ return typeof n.value == "string" ? n.typed = !0 : c(this, "type", n, s), n;
110
+ }
111
+ };
112
+ }
113
+ // @__NO_SIDE_EFFECTS__
114
+ function M(...e) {
115
+ return {
116
+ ...e[0],
117
+ pipe: e,
118
+ get "~standard"() {
119
+ return /* @__PURE__ */ d(this);
120
+ },
121
+ "~run"(n, s) {
122
+ for (const r of e)
123
+ if (r.kind !== "metadata") {
124
+ if (n.issues && (r.kind === "schema" || r.kind === "transformation")) {
125
+ n.typed = !1;
126
+ break;
127
+ }
128
+ (!n.issues || !s.abortEarly && !s.abortPipeEarly) && (n = r["~run"](n, s));
129
+ }
130
+ return n;
131
+ }
132
+ };
133
+ }
134
+ // @__NO_SIDE_EFFECTS__
135
+ function j(e, n, s) {
136
+ const r = e["~run"]({ value: n }, /* @__PURE__ */ f(s));
137
+ return {
138
+ typed: r.typed,
139
+ success: !r.issues,
140
+ output: r.value,
141
+ issues: r.issues
142
+ };
143
+ }
144
+ export {
145
+ c as _addIssue,
146
+ d as _getStandardProps,
147
+ $ as _stringify,
148
+ f as getGlobalConfig,
149
+ E as getGlobalMessage,
150
+ k as getSchemaMessage,
151
+ P as getSpecificMessage,
152
+ _ as maxLength,
153
+ x as nonEmpty,
154
+ M as pipe,
155
+ j as safeParse,
156
+ S as string
157
+ };
@@ -1,5 +1,7 @@
1
1
  export declare const useEditorStore: import("pinia").StoreDefinition<"editor", {
2
2
  isCodeEditorOpen: boolean;
3
+ isSaveAsTemplateDrawerOpen: boolean;
3
4
  isVersionHistoryOpen: boolean;
4
5
  editorVisualMode: string;
6
+ hasChanges: boolean;
5
7
  }, {}, {}>;
@@ -1,11 +1,13 @@
1
1
  import { defineStore as e } from "pinia";
2
- const t = e("editor", {
2
+ const o = e("editor", {
3
3
  state: () => ({
4
4
  isCodeEditorOpen: !1,
5
+ isSaveAsTemplateDrawerOpen: !1,
5
6
  isVersionHistoryOpen: !1,
6
- editorVisualMode: "desktop"
7
+ editorVisualMode: "desktop",
8
+ hasChanges: !1
7
9
  })
8
10
  });
9
11
  export {
10
- t as useEditorStore
12
+ o as useEditorStore
11
13
  };
@@ -0,0 +1,25 @@
1
+ import type { MappedCategory } from '@@/Types/save-as-template';
2
+ interface StoreState {
3
+ templateName: string;
4
+ categories: MappedCategory[];
5
+ selectedCategories: MappedCategory[];
6
+ skeletonStatus: boolean;
7
+ }
8
+ export declare const useSaveAsTemplateStore: import("pinia").StoreDefinition<"saveAsTemplate", StoreState, {
9
+ getTemplateName: (state: {
10
+ templateName: string;
11
+ categories: {
12
+ value: string;
13
+ text: string;
14
+ }[];
15
+ selectedCategories: {
16
+ value: string;
17
+ text: string;
18
+ }[];
19
+ skeletonStatus: boolean;
20
+ } & import("pinia").PiniaCustomStateProperties<StoreState>) => string;
21
+ }, {
22
+ fetchCategories(): Promise<void>;
23
+ createCategory(category: string): Promise<void>;
24
+ }>;
25
+ export {};
@@ -0,0 +1,44 @@
1
+ import { useHttp as s } from "../composables/useHttp.js";
2
+ import { useToaster as o } from "../composables/useToaster.js";
3
+ import { defineStore as i } from "pinia";
4
+ const c = () => ({
5
+ templateName: "",
6
+ categories: [],
7
+ selectedCategories: [],
8
+ skeletonStatus: !0
9
+ }), { get: l, post: m } = s(), { handleError: r } = o(), d = i("saveAsTemplate", {
10
+ state: () => c(),
11
+ getters: {
12
+ getTemplateName: (e) => e.templateName.trim()
13
+ },
14
+ actions: {
15
+ async fetchCategories() {
16
+ try {
17
+ const { data: e = [] } = await l("/newsletter/template-library/get-template-categories");
18
+ this.categories = e.map((t) => ({
19
+ value: t.id.toString(),
20
+ text: t.name
21
+ }));
22
+ } catch (e) {
23
+ r(e, "Failed to fetch template categories");
24
+ }
25
+ },
26
+ async createCategory(e) {
27
+ try {
28
+ const { data: { id: t } } = await m(
29
+ "/newsletter/template-library/create-category",
30
+ { category: e }
31
+ ), a = {
32
+ value: t.toString(),
33
+ text: e
34
+ };
35
+ this.categories.push(a), this.selectedCategories.push(a);
36
+ } catch (t) {
37
+ r(t, "Failed to create category");
38
+ }
39
+ }
40
+ }
41
+ });
42
+ export {
43
+ d as useSaveAsTemplateStore
44
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.0.0-beta.c798ebe",
3
+ "version": "1.0.0-beta.c99b3ab",
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",
@@ -35,6 +35,7 @@
35
35
  "@vuelidate/validators": "2.0.4",
36
36
  "lodash-es": "4.17.21",
37
37
  "pinia": "2.3.1",
38
+ "valibot": "1.1.0",
38
39
  "vite": "6.3.5",
39
40
  "vue": "2.7.14"
40
41
  },
@@ -1,19 +0,0 @@
1
- import i from "./PreviewContainer.vue2.js";
2
- import o from "../../../_virtual/_plugin-vue2_normalizer.js";
3
- var t = function() {
4
- var s = this, e = s._self._c, r = s._self._setupProxy;
5
- return e("div", { staticClass: "d-f f-d-c h-1 b-c-5 bor-r-2 pb-5" }, [e("div", { staticClass: "f-g-1 d-f p-5 o-a g-4 min-h-600" }, [r.previewStore.isLoading ? [e("div", { staticClass: "d-f a-i-c j-c-c w-1 h-1 f-g-1" }, [e(r.InLoading, { attrs: { "color-class": "i-c-1", size: "32" } })], 1)] : [e(r.DesktopPreview, { staticClass: "f-g-1 min-w-0" }), e(r.MobilePreview, { staticClass: "f-0 min-w-a" })]], 2), r.previewStore.isAMPErrorModalVisible ? e(r.AmpErrorModal, { on: { close: function(l) {
6
- return r.previewStore.closeErrorModal();
7
- } } }) : s._e()], 1);
8
- }, a = [], n = /* @__PURE__ */ o(
9
- i,
10
- t,
11
- a,
12
- !1,
13
- null,
14
- null
15
- );
16
- const d = n.exports;
17
- export {
18
- d as default
19
- };
@@ -1,19 +0,0 @@
1
- import { defineComponent as r, onMounted as t } from "vue";
2
- import { usePreviewMode as i } from "../../../composables/usePreviewMode.js";
3
- import { usePreviewStore as m } from "../../../stores/preview.js";
4
- import { InLoading as n } from "@useinsider/design-system-vue";
5
- import p from "./amp/AmpErrorModal.vue.js";
6
- import f from "./desktop-preview/DesktopPreview.vue.js";
7
- import s from "./mobile-preview/MobilePreview.vue.js";
8
- const l = /* @__PURE__ */ r({
9
- __name: "PreviewContainer",
10
- setup(a) {
11
- const { loadPreviewData: o } = i(), e = m();
12
- return t(() => {
13
- o();
14
- }), { __sfc: !0, loadPreviewData: o, previewStore: e, InLoading: n, AmpErrorModal: p, DesktopPreview: f, MobilePreview: s };
15
- }
16
- });
17
- export {
18
- l as default
19
- };
@@ -1,4 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
2
- close: () => void;
3
- }, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
4
- export default _default;
@@ -1,22 +0,0 @@
1
- import s from "./AmpErrorModal.vue2.js";
2
- /* empty css */
3
- import a from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
- var n = function() {
5
- var e = this, r = e._self._c, t = e._self._setupProxy;
6
- return r(t.WpModal, { attrs: { id: "amp-error-modal", size: "medium", description: t.trans("email-editor.amp-validation-description"), "footer-button-options": t.footerButtonOptions, title: t.trans("email-editor.amp-validation-title") }, on: { close: function(o) {
7
- return t.emit("close");
8
- }, "primary-action": t.handleFixInCodeEditor } }, [r("div", { staticClass: "d-f f-d-c" }, [r("div", { staticClass: "mb-3" }, [r("div", { staticClass: "l-s-5 f-s-1 f-w-600 t-c-55 t-t-u" }, [e._v(" " + e._s(t.errorCountText) + " ")])]), r("div", { staticClass: "d-f f-d-c g-13 max-h-21-s o-y-a error-list" }, e._l(t.previewStore.ampErrors, function(o, i) {
9
- return r(t.InOnPageMessage, { key: i, attrs: { icon: "filled-error-box", size: "medium", type: "alert", text: o } });
10
- }), 1)])]);
11
- }, l = [], d = /* @__PURE__ */ a(
12
- s,
13
- n,
14
- l,
15
- !1,
16
- null,
17
- "cfb613b7"
18
- );
19
- const _ = d.exports;
20
- export {
21
- _ as default
22
- };
@@ -1,30 +0,0 @@
1
- import { defineComponent as p, ref as m, computed as c } from "vue";
2
- import d from "../../../wrappers/WpModal.vue.js";
3
- import { useCodeEditorApi as l } from "../../../../composables/useCodeEditorApi.js";
4
- import { usePreviewMode as u } from "../../../../composables/usePreviewMode.js";
5
- import { useTranslations as f } from "../../../../composables/useTranslations.js";
6
- import { usePreviewStore as _ } from "../../../../stores/preview.js";
7
- import { InOnPageMessage as g } from "@useinsider/design-system-vue";
8
- const P = /* @__PURE__ */ p({
9
- __name: "AmpErrorModal",
10
- emits: ["close"],
11
- setup(x, { emit: e }) {
12
- const o = f(), { closePreviewMode: r } = u(), { openCodeEditor: t } = l(), n = _(), s = m({
13
- cancelOrBackButton: {
14
- type: "secondary",
15
- labelText: o("campaign-builder.cancel"),
16
- styling: "ghost"
17
- },
18
- primaryButton: {
19
- type: "primary",
20
- labelText: o("email-editor.amp-validation-fix")
21
- }
22
- }), i = () => {
23
- e("close"), r(), t();
24
- }, a = c(() => `${o("products.errors")}(${n.ampErrors.length})`);
25
- return { __sfc: !0, emit: e, trans: o, closePreviewMode: r, openCodeEditor: t, previewStore: n, footerButtonOptions: s, handleFixInCodeEditor: i, errorCountText: a, WpModal: d, InOnPageMessage: g };
26
- }
27
- });
28
- export {
29
- P as default
30
- };
@@ -1,2 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
- export default _default;
@@ -1,19 +0,0 @@
1
- import o from "./AmpToggle.vue2.js";
2
- import n from "../../../../_virtual/_plugin-vue2_normalizer.js";
3
- var s = function() {
4
- var r = this, t = r._self._c, e = r._self._setupProxy;
5
- return t("div", [t("div", { staticClass: "d-f a-i-c ml-3" }, [t(e.InSegments, { attrs: { id: "guido__amp-toggle", "segment-list": e.segmentList, selected: e.previewStore.emailFormat }, on: { click: e.handleFormatChange } }), e.previewStore.showAMPErrorButton ? t(e.InButtonV2, { staticClass: "ml-2 d-f a-i-c b-c-11 b-c-h-11 t-c-4 t-c-h-4 i-c-4 bor-w-1 bor-s-s bor-c-11 bor-r-2", attrs: { id: "guido__amp-error-button", "left-icon": "line-error-box", type: "danger", "label-text-status": !1 }, on: { click: function(c) {
6
- return e.previewStore.openErrorModal();
7
- } } }) : r._e()], 1)]);
8
- }, a = [], i = /* @__PURE__ */ n(
9
- o,
10
- s,
11
- a,
12
- !1,
13
- null,
14
- null
15
- );
16
- const d = i.exports;
17
- export {
18
- d as default
19
- };