@useinsider/guido 1.0.0-beta.6ebce36 → 1.0.0-beta.6ecc044

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 (61) hide show
  1. package/README.md +1 -191
  2. package/dist/@types/generic.d.ts +0 -3
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +26 -22
  5. package/dist/components/organisms/base/ModalWrapper.vue.d.ts +72 -0
  6. package/dist/components/organisms/base/ModalWrapper.vue.js +19 -0
  7. package/dist/components/organisms/base/ModalWrapper.vue2.js +43 -0
  8. package/dist/components/organisms/header/LeftSlot.vue.d.ts +1 -1
  9. package/dist/components/organisms/header/LeftSlot.vue.js +8 -8
  10. package/dist/components/organisms/header/LeftSlot.vue2.js +3 -5
  11. package/dist/components/organisms/header/MiddleSlot.vue.js +7 -7
  12. package/dist/components/organisms/header/MiddleSlot.vue2.js +4 -6
  13. package/dist/components/organisms/header/RightSlot.vue.d.ts +1 -1
  14. package/dist/components/organisms/header/RightSlot.vue.js +10 -7
  15. package/dist/components/organisms/header/RightSlot.vue2.js +19 -14
  16. package/dist/components/organisms/header/version-history/VersionHistory.vue.d.ts +1 -13
  17. package/dist/components/organisms/header/version-history/VersionHistory.vue.js +7 -7
  18. package/dist/components/organisms/header/version-history/VersionHistory.vue2.js +10 -13
  19. package/dist/components/organisms/save-template/SaveTemplateModal.vue.d.ts +20 -0
  20. package/dist/components/organisms/save-template/SaveTemplateModal.vue.js +19 -0
  21. package/dist/components/organisms/save-template/SaveTemplateModal.vue2.js +66 -0
  22. package/dist/composables/useCustomInterfaceAppearance.js +9 -45
  23. package/dist/composables/useExport.d.ts +1 -1
  24. package/dist/composables/useExport.js +20 -35
  25. package/dist/composables/useStripo.js +8 -13
  26. package/dist/composables/useTemplateValidation.d.ts +13 -0
  27. package/dist/composables/useTemplateValidation.js +57 -0
  28. package/dist/guido.css +1 -1
  29. package/dist/mock/api/template-library.d.ts +2 -0
  30. package/dist/static/editor.css.js +232 -0
  31. package/dist/stores/editor.d.ts +1 -0
  32. package/dist/stores/editor.js +2 -1
  33. package/package.json +1 -1
  34. package/dist/components/organisms/header/version-history/RestoreButton.vue.d.ts +0 -2
  35. package/dist/components/organisms/header/version-history/RestoreButton.vue.js +0 -19
  36. package/dist/components/organisms/header/version-history/RestoreButton.vue2.js +0 -14
  37. package/dist/composables/useHtmlCompiler.d.ts +0 -4
  38. package/dist/composables/useHtmlCompiler.js +0 -16
  39. package/dist/config/compiler/htmlCompilerRules.d.ts +0 -2
  40. package/dist/config/compiler/htmlCompilerRules.js +0 -145
  41. package/dist/config/compiler/outlookCompilerRules.d.ts +0 -0
  42. package/dist/enums/displayConditions.d.ts +0 -2
  43. package/dist/enums/displayConditions.js +0 -80
  44. package/dist/static/styles/base.css.js +0 -11
  45. package/dist/static/styles/components/alert-message.css.js +0 -39
  46. package/dist/static/styles/components/amp-block.css.js +0 -18
  47. package/dist/static/styles/components/base-input.css.js +0 -47
  48. package/dist/static/styles/components/button-group.css.js +0 -54
  49. package/dist/static/styles/components/button.css.js +0 -106
  50. package/dist/static/styles/components/combobox.css.js +0 -49
  51. package/dist/static/styles/components/counter.css.js +0 -42
  52. package/dist/static/styles/components/dropdown-menu.css.js +0 -52
  53. package/dist/static/styles/components/narrow-panel.css.js +0 -38
  54. package/dist/static/styles/components/switcher.css.js +0 -11
  55. package/dist/static/styles/components/tabs.css.js +0 -97
  56. package/dist/static/styles/components/tools.css.js +0 -23
  57. package/dist/static/styles/components/version-history.css.js +0 -30
  58. package/dist/static/styles/components/wide-panel.css.js +0 -135
  59. package/dist/static/styles/variables.css.js +0 -23
  60. package/dist/utils/htmlCompiler.d.ts +0 -12
  61. package/dist/utils/htmlCompiler.js +0 -70
@@ -1,14 +1,2 @@
1
- type __VLS_Props = {
2
- itemStatus?: boolean;
3
- };
4
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
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<{}>>, {}>;
5
2
  export default _default;
6
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
7
- type __VLS_TypePropsToOption<T> = {
8
- [K in keyof T]-?: {} extends Pick<T, K> ? {
9
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
10
- } : {
11
- type: import('vue').PropType<T[K]>;
12
- required: true;
13
- };
14
- };
@@ -2,21 +2,21 @@ import o from "./VersionHistory.vue2.js";
2
2
  /* empty css */
3
3
  import i from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
4
  var n = function() {
5
- var s = this, e = s._self._c, t = s._self._setupProxy;
6
- return e("div", { staticClass: "version-history-wrapper d-f a-i-c f-g-1 mx-3" }, [t.itemStatus ? e(t.VersionHistoryItem, { attrs: { "text-align": "right", date: t.versionHistoryStore.previousPatch.date, description: t.versionHistoryStore.previousPatch.description } }) : s._e(), e("div", { staticClass: "d-f" }, [e(t.InButtonV2, { attrs: { id: "guido__undo-button", "left-icon": "line-undo", styling: "ghost", type: "secondary", "disabled-status": !t.versionHistoryStore.hasPreviousPatch, "label-text-status": !1 }, on: { click: function(r) {
5
+ var r = this, e = r._self._c, t = r._self._setupProxy;
6
+ return e("div", { staticClass: "version-history-wrapper d-f a-i-c f-g-1 mx-2" }, [e(t.VersionHistoryItem, { attrs: { "text-align": "right", date: t.versionHistoryStore.previousPatch.date, description: t.versionHistoryStore.previousPatch.description } }), e("div", { staticClass: "d-f" }, [e(t.InButtonV2, { attrs: { id: "guido__undo-button", "left-icon": "line-undo", styling: "ghost", type: "secondary", "disabled-status": !t.versionHistoryStore.hasPreviousPatch, "label-text-status": !1 }, on: { click: function(s) {
7
7
  return t.previewVersion(t.versionHistoryStore.previousPatch.id);
8
- } } }), e(t.InButtonV2, { attrs: { id: "guido__redo-button", "left-icon": "line-redo", styling: "ghost", type: "secondary", "disabled-status": !t.versionHistoryStore.hasNextPatch, "label-text-status": !1 }, on: { click: function(r) {
8
+ } } }), e(t.InButtonV2, { attrs: { id: "guido__redo-button", "left-icon": "line-redo", styling: "ghost", type: "secondary", "disabled-status": !t.versionHistoryStore.hasNextPatch, "label-text-status": !1 }, on: { click: function(s) {
9
9
  return t.previewVersion(t.versionHistoryStore.nextPatch.id);
10
- } } })], 1), t.itemStatus ? e(t.VersionHistoryItem, { attrs: { "text-align": "left", date: t.versionHistoryStore.nextPatch.date, description: t.versionHistoryStore.nextPatch.description } }) : s._e()], 1);
10
+ } } })], 1), e(t.VersionHistoryItem, { attrs: { "text-align": "left", date: t.versionHistoryStore.nextPatch.date, description: t.versionHistoryStore.nextPatch.description } })], 1);
11
11
  }, a = [], c = /* @__PURE__ */ i(
12
12
  o,
13
13
  n,
14
14
  a,
15
15
  !1,
16
16
  null,
17
- "52a77eec"
17
+ "187d41fa"
18
18
  );
19
- const _ = c.exports;
19
+ const p = c.exports;
20
20
  export {
21
- _ as default
21
+ p as default
22
22
  };
@@ -1,18 +1,15 @@
1
- import { defineComponent as i } from "vue";
2
- import { useVersionHistoryApi as n } from "../../../../composables/useVersionHistoryApi.js";
3
- import { useVersionHistoryStore as m } from "../../../../stores/version-history.js";
4
- import { InButtonV2 as p } from "@useinsider/design-system-vue";
5
- import f from "./VersionHistoryItem.vue.js";
6
- const _ = /* @__PURE__ */ i({
1
+ import { defineComponent as t } from "vue";
2
+ import { useVersionHistoryApi as e } from "../../../../composables/useVersionHistoryApi.js";
3
+ import { useVersionHistoryStore as s } from "../../../../stores/version-history.js";
4
+ import { InButtonV2 as i } from "@useinsider/design-system-vue";
5
+ import n from "./VersionHistoryItem.vue.js";
6
+ const c = /* @__PURE__ */ t({
7
7
  __name: "VersionHistory",
8
- props: {
9
- itemStatus: { type: Boolean }
10
- },
11
- setup(t) {
12
- const o = t, r = m(), { previewVersion: e } = n(), { itemStatus: s = !1 } = o;
13
- return { __sfc: !0, versionHistoryStore: r, previewVersion: e, props: o, itemStatus: s, InButtonV2: p, VersionHistoryItem: f };
8
+ setup(m) {
9
+ const o = s(), { previewVersion: r } = e();
10
+ return { __sfc: !0, versionHistoryStore: o, previewVersion: r, InButtonV2: i, VersionHistoryItem: n };
14
11
  }
15
12
  });
16
13
  export {
17
- _ as default
14
+ c as default
18
15
  };
@@ -0,0 +1,20 @@
1
+ interface TemplateModalProps {
2
+ isOpen: boolean;
3
+ }
4
+ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<TemplateModalProps>, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
5
+ close: () => void;
6
+ save: (data: {
7
+ templateName: string;
8
+ htmlData: string;
9
+ }) => void;
10
+ }, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<TemplateModalProps>>>, {}>;
11
+ export default _default;
12
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
13
+ type __VLS_TypePropsToOption<T> = {
14
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
15
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
16
+ } : {
17
+ type: import('vue').PropType<T[K]>;
18
+ required: true;
19
+ };
20
+ };
@@ -0,0 +1,19 @@
1
+ import s from "./SaveTemplateModal.vue2.js";
2
+ import r from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var l = function() {
4
+ var a = this, n = a._self._c, e = a._self._setupProxy;
5
+ return n(e.ModalWrapper, { attrs: { "cancel-button-text": e.trans("products.cancel"), description: e.trans("newsletter.save-template-description"), "is-open": e.props.isOpen, "primary-button-disabled": e.isSaveButtonDisabled, "primary-button-loading": e.isSaving || e.isLoadingHtml, "primary-button-text": e.trans("products.save"), title: e.trans("products.save-template") }, on: { cancel: e.closeModal, close: e.closeModal, save: e.saveTemplate } }, [n(e.InTextInput, { staticClass: "mb-5 w-1", attrs: { id: "template-name-input", "with-label": "", name: "templateName", disabled: e.isSaving, invalid: !!e.validationError, "invalid-message": e.validationError, label: e.trans("products.template-name"), placeholder: e.trans("newsletter.enter-template-name") }, model: { value: e.templateNameInput, callback: function(t) {
6
+ e.templateNameInput = typeof t == "string" ? t.trim() : t;
7
+ }, expression: "templateNameInput" } })], 1);
8
+ }, o = [], i = /* @__PURE__ */ r(
9
+ s,
10
+ l,
11
+ o,
12
+ !1,
13
+ null,
14
+ null
15
+ );
16
+ const d = i.exports;
17
+ export {
18
+ d as default
19
+ };
@@ -0,0 +1,66 @@
1
+ import { defineComponent as _, ref as s, computed as w, watch as h } from "vue";
2
+ import { useActionsApi as H } from "../../../composables/useActionsApi.js";
3
+ import { useTemplateValidation as N } from "../../../composables/useTemplateValidation.js";
4
+ import { useToaster as D } from "../../../composables/useToaster.js";
5
+ import { useTranslations as L } from "../../../composables/useTranslations.js";
6
+ import S from "../base/ModalWrapper.vue.js";
7
+ import { InTextInput as b } from "@useinsider/design-system-vue";
8
+ const R = /* @__PURE__ */ _({
9
+ __name: "SaveTemplateModal",
10
+ props: {
11
+ isOpen: { type: Boolean }
12
+ },
13
+ emits: ["close", "save"],
14
+ setup(g, { emit: n }) {
15
+ const u = g, y = L(), { handleError: o } = D(), { getCompiledEmail: p } = H(), e = s(""), l = s(!1), r = s(!1), t = s(""), {
16
+ validationError: v,
17
+ isValidating: f,
18
+ validateTemplateName: i,
19
+ clearValidation: m
20
+ } = N(), E = w(() => l.value || f.value || r.value || !e.value.trim() || !!v.value), c = () => {
21
+ e.value = "", m(), t.value = "";
22
+ }, d = () => {
23
+ c(), n("close");
24
+ }, M = async () => {
25
+ if (e.value.trim()) {
26
+ l.value = !0;
27
+ try {
28
+ if (!(await i(e.value)).isValid)
29
+ return;
30
+ if (!t.value) {
31
+ o(new Error("No HTML data available"), "Error saving template:");
32
+ return;
33
+ }
34
+ n("save", {
35
+ templateName: e.value,
36
+ htmlData: t.value
37
+ }), d();
38
+ } catch (a) {
39
+ o(a, "Error saving template:");
40
+ } finally {
41
+ l.value = !1;
42
+ }
43
+ }
44
+ };
45
+ h(e, (a) => {
46
+ a.trim() ? i(a) : m();
47
+ });
48
+ const T = async () => {
49
+ r.value = !0;
50
+ try {
51
+ const { html: a } = await p();
52
+ t.value = a || "", a || o(new Error("No HTML content available"), "Warning:");
53
+ } catch (a) {
54
+ o(a, "Error fetching HTML data:"), t.value = "";
55
+ } finally {
56
+ r.value = !1;
57
+ }
58
+ };
59
+ return h(() => u.isOpen, async (a) => {
60
+ a ? await T() : c();
61
+ }), { __sfc: !0, props: u, emit: n, trans: y, handleError: o, getCompiledEmail: p, templateNameInput: e, isSaving: l, isLoadingHtml: r, htmlData: t, validationError: v, isValidating: f, validateTemplateName: i, clearValidation: m, isSaveButtonDisabled: E, resetModalState: c, closeModal: d, saveTemplate: M, fetchHtmlData: T, ModalWrapper: S, InTextInput: b };
62
+ }
63
+ });
64
+ export {
65
+ R as default
66
+ };
@@ -1,49 +1,13 @@
1
- import S from "../static/styles/base.css.js";
2
- import e from "../static/styles/components/alert-message.css.js";
3
- import m from "../static/styles/components/amp-block.css.js";
4
- import i from "../static/styles/components/base-input.css.js";
5
- import p from "../static/styles/components/button-group.css.js";
6
- import n from "../static/styles/components/button.css.js";
7
- import s from "../static/styles/components/combobox.css.js";
8
- import C from "../static/styles/components/counter.css.js";
9
- import f from "../static/styles/components/dropdown-menu.css.js";
10
- import a from "../static/styles/components/narrow-panel.css.js";
11
- import u from "../static/styles/components/switcher.css.js";
12
- import c from "../static/styles/components/tabs.css.js";
13
- import d from "../static/styles/components/tools.css.js";
14
- import l from "../static/styles/components/version-history.css.js";
15
- import h from "../static/styles/components/wide-panel.css.js";
16
- import w from "../static/styles/variables.css.js";
17
- const y = [
18
- w,
19
- // Must be on top
20
- S,
21
- // Must be on top
22
- e,
23
- m,
24
- i,
25
- p,
26
- n,
27
- s,
28
- C,
29
- f,
30
- a,
31
- u,
32
- c,
33
- d,
34
- l,
35
- h
36
- ].join(`
37
-
38
- `), N = () => ({ importCss: () => {
39
- const o = new CSSStyleSheet();
40
- o.replaceSync(y);
41
- const r = document.querySelector("ui-editor");
42
- if (!r)
1
+ import r from "../static/editor.css.js";
2
+ const c = () => ({ importCss: () => {
3
+ const e = new CSSStyleSheet();
4
+ e.replaceSync(r);
5
+ const t = document.querySelector("ui-editor");
6
+ if (!t)
43
7
  return;
44
- const t = r.shadowRoot;
45
- t && (t.adoptedStyleSheets = [o]);
8
+ const o = t.shadowRoot;
9
+ o && (o.adoptedStyleSheets = [e]);
46
10
  } });
47
11
  export {
48
- N as useCustomInterfaceAppearance
12
+ c as useCustomInterfaceAppearance
49
13
  };
@@ -1,3 +1,3 @@
1
1
  export declare const useExport: () => {
2
- exportHtml: (compile?: boolean) => Promise<void>;
2
+ exportHtml: () => Promise<void>;
3
3
  };
@@ -1,45 +1,30 @@
1
1
  import { useActionsApi as l } from "./useActionsApi.js";
2
- import { useHtmlCompiler as m } from "./useHtmlCompiler.js";
3
- import { useToaster as d } from "./useToaster.js";
4
- const h = () => {
5
- const a = (s, o, r) => {
6
- const i = new Blob([s], { type: r }), t = URL.createObjectURL(i), e = document.createElement("a");
7
- e.href = t, e.download = o, document.body.appendChild(e), e.click(), document.body.removeChild(e), URL.revokeObjectURL(t);
8
- }, c = (s) => {
9
- const o = /* @__PURE__ */ new Date(), r = String(o.getDate()).padStart(2, "0"), i = String(o.getMonth() + 1).padStart(2, "0"), t = o.getFullYear(), e = String(o.getHours()).padStart(2, "0"), n = String(o.getMinutes()).padStart(2, "0");
10
- return `${s}_${r}-${i}-${t}_${e}-${n}.html`;
2
+ import { useToaster as m } from "./useToaster.js";
3
+ const u = () => {
4
+ const a = (r, t, e) => {
5
+ const n = new Blob([r], { type: e }), s = URL.createObjectURL(n), o = document.createElement("a");
6
+ o.href = s, o.download = t, document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(s);
7
+ }, c = (r) => {
8
+ const t = /* @__PURE__ */ new Date(), e = String(t.getDate()).padStart(2, "0"), n = String(t.getMonth() + 1).padStart(2, "0"), s = t.getFullYear(), o = String(t.getHours()).padStart(2, "0"), i = String(t.getMinutes()).padStart(2, "0");
9
+ return `${r}_${e}-${n}-${s}_${o}-${i}.html`;
11
10
  };
12
- return { exportHtml: async (s = !0) => {
13
- const { getCompiledEmail: o } = l(), { showToaster: r } = d(), { compileHtml: i } = m();
11
+ return { exportHtml: async () => {
12
+ const { getCompiledEmail: r } = l(), { showToaster: t } = m();
14
13
  try {
15
- const { html: t } = await o();
16
- if (t) {
17
- let e = t;
18
- if (s) {
19
- const n = i(t);
20
- e = n.compiledHtml, console.debug("HTML Compilation Stats:", {
21
- originalSize: n.stats.originalSize,
22
- compiledSize: n.stats.compiledSize,
23
- reduction: `${n.stats.reductionPercentage.toFixed(2)}%`,
24
- appliedRules: n.appliedRules,
25
- executionTime: `${n.stats.executionTime.toFixed(2)}ms`
26
- });
27
- }
28
- a(e, c("HTML"), "text/html");
29
- } else
30
- r({
31
- type: "error",
32
- message: "No HTML content to download"
33
- });
34
- } catch (t) {
35
- const e = t instanceof Error ? t.message : String(t);
36
- r({
14
+ const { html: e } = await r();
15
+ e ? a(e, c("HTML"), "text/html") : t({
37
16
  type: "error",
38
- message: `Error compiling email: ${e}`
17
+ message: "No HTML content to download"
18
+ });
19
+ } catch (e) {
20
+ const n = e instanceof Error ? e.message : String(e);
21
+ t({
22
+ type: "error",
23
+ message: `Error compiling email: ${n}`
39
24
  });
40
25
  }
41
26
  } };
42
27
  };
43
28
  export {
44
- h as useExport
29
+ u as useExport
45
30
  };
@@ -1,11 +1,10 @@
1
1
  import { useCustomInterfaceAppearance as m } from "./useCustomInterfaceAppearance.js";
2
2
  import { useToaster as g } from "./useToaster.js";
3
- import { displayConditions as E } from "../enums/displayConditions.js";
4
- import { useStripoApi as S } from "../services/stripoApi.js";
5
- import { useEditorStore as w } from "../stores/editor.js";
6
- const F = (c) => {
7
- const { handleError: d } = g(), { getToken: a, getCustomFonts: u } = S(), l = (e, i = []) => {
8
- const r = w(), { html: t, css: n } = e;
3
+ import { useStripoApi as E } from "../services/stripoApi.js";
4
+ import { useEditorStore as S } from "../stores/editor.js";
5
+ const _ = (c) => {
6
+ const { handleError: d } = g(), { getToken: u, getCustomFonts: a } = E(), l = (e, i = []) => {
7
+ const r = S(), { html: t, css: n } = e;
9
8
  window.UIEditor.initEditor(
10
9
  document.querySelector("#guido-editor"),
11
10
  {
@@ -18,10 +17,6 @@ const F = (c) => {
18
17
  mobileViewButtonSelector: ".guido__view-option-selection-mobile",
19
18
  desktopViewButtonSelector: ".guido__view-option-selection-desktop",
20
19
  codeEditorButtonSelector: "#guido__code-button",
21
- conditionsEnabled: !0,
22
- customConditionsEnabled: !0,
23
- conditionCategories: E,
24
- messageSettingsEnabled: !1,
25
20
  editorFonts: {
26
21
  showDefaultStandardFonts: !0,
27
22
  showDefaultNotStandardFonts: !0,
@@ -29,7 +24,7 @@ const F = (c) => {
29
24
  },
30
25
  async onTokenRefreshRequest(o) {
31
26
  try {
32
- const s = await a();
27
+ const s = await u();
33
28
  o(s);
34
29
  } catch (s) {
35
30
  d(s, "Failed to refresh token");
@@ -69,11 +64,11 @@ const F = (c) => {
69
64
  });
70
65
  return { initPlugin: async (e) => {
71
66
  await p(async () => {
72
- const i = await u();
67
+ const i = await a();
73
68
  l(e, i);
74
69
  });
75
70
  } };
76
71
  };
77
72
  export {
78
- F as useStripo
73
+ _ as useStripo
79
74
  };
@@ -0,0 +1,13 @@
1
+ export interface ValidationResult {
2
+ isValid: boolean;
3
+ message: string;
4
+ }
5
+ export declare const useTemplateValidation: () => {
6
+ validationError: import("vue").ComputedRef<string>;
7
+ isValidating: import("vue").ComputedRef<boolean>;
8
+ validateTemplateName: (name: string) => Promise<ValidationResult>;
9
+ clearValidation: () => void;
10
+ VALIDATION_RULES: {
11
+ readonly DEBOUNCE_TIME: 500;
12
+ };
13
+ };
@@ -0,0 +1,57 @@
1
+ import { useHttp as T } from "./useHttp.js";
2
+ import { useToaster as V } from "./useToaster.js";
3
+ import { useTranslations as N } from "./useTranslations.js";
4
+ import { ref as m, computed as u } from "vue";
5
+ const c = {
6
+ DEBOUNCE_TIME: 500
7
+ }, I = () => {
8
+ const { get: d } = T(), { handleError: p } = V(), l = N(), s = m(""), o = m(!1), r = m(null), v = (a) => a.trim() ? {
9
+ isValid: !0,
10
+ message: ""
11
+ } : {
12
+ isValid: !1,
13
+ message: l("validation.required-product-name-to-continue", { product: "template" })
14
+ }, f = async (a) => {
15
+ try {
16
+ const i = `/template-library/template-name-exists?name=${encodeURIComponent(a)}`;
17
+ return (await d(i)).data.status;
18
+ } catch (e) {
19
+ return p(e, "Error checking template name:"), !1;
20
+ }
21
+ }, E = (a) => (r.value && clearTimeout(r.value), new Promise((e) => {
22
+ const i = v(a);
23
+ if (!i.isValid) {
24
+ s.value = i.message, e(i);
25
+ return;
26
+ }
27
+ o.value = !0, r.value = setTimeout(async () => {
28
+ try {
29
+ const t = await f(a.trim()), n = {
30
+ isValid: !t,
31
+ message: t ? l("whatsapp-business.template-name-exists") : ""
32
+ };
33
+ s.value = n.message, e(n);
34
+ } catch (t) {
35
+ const n = {
36
+ isValid: !1,
37
+ message: t instanceof Error ? t.message : l("validation.unknown-error")
38
+ };
39
+ s.value = n.message, e(n);
40
+ } finally {
41
+ o.value = !1;
42
+ }
43
+ }, c.DEBOUNCE_TIME);
44
+ })), g = () => {
45
+ s.value = "", o.value = !1, r.value && clearTimeout(r.value);
46
+ };
47
+ return {
48
+ validationError: u(() => s.value),
49
+ isValidating: u(() => o.value),
50
+ validateTemplateName: E,
51
+ clearValidation: g,
52
+ VALIDATION_RULES: c
53
+ };
54
+ };
55
+ export {
56
+ I as useTemplateValidation
57
+ };
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- .version-history-item[data-v-0e2ff42d]{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-8e229594],.guido-editor__container[data-v-8e229594]{width:100%;height:calc(100vh - 75px)}
1
+ .version-history-item[data-v-0e2ff42d]{flex-basis:200px}.version-history-wrapper[data-v-187d41fa]{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}.header-right-slot[data-v-0318cf78]{gap:16px}.guido-editor__wrapper[data-v-f20b186e],.guido-editor__container[data-v-f20b186e]{width:100%;height:100vh}
@@ -0,0 +1,2 @@
1
+ declare const _default: import("msw").HttpHandler[];
2
+ export default _default;