@useinsider/guido 1.0.0-beta.070ce4c → 1.0.0-beta.080866c
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.
- package/dist/components/organisms/base/ModalWrapper.vue2.js +2 -2
- package/dist/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/components/organisms/header/RightSlot.vue.js +7 -10
- package/dist/components/organisms/header/RightSlot.vue2.js +13 -16
- package/dist/components/organisms/save-template/SaveTemplateModal.vue.js +6 -6
- package/dist/components/organisms/save-template/SaveTemplateModal.vue2.js +55 -59
- package/dist/composables/{useTemplateSave.d.ts → useSaveAsTemplate.d.ts} +1 -1
- package/dist/composables/{useTemplateSave.js → useSaveAsTemplate.js} +7 -7
- package/dist/composables/useTemplateCategories.d.ts +0 -3
- package/dist/composables/useTemplateCategories.js +23 -25
- package/dist/composables/{useTemplateValidation.d.ts → useTemplateNameValidation.d.ts} +4 -4
- package/dist/composables/useTemplateNameValidation.js +57 -0
- package/dist/guido.css +1 -1
- package/package.json +1 -1
- package/dist/components/organisms/header/ViewOptions.vue.js +0 -18
- package/dist/components/organisms/header/ViewOptions.vue2.js +0 -15
- package/dist/components/organisms/header/version-history/ViewOptions.vue.js +0 -18
- package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +0 -23
- package/dist/composables/useTemplateValidation.js +0 -57
|
@@ -7,10 +7,10 @@ const i = /* @__PURE__ */ o({
|
|
|
7
7
|
title: null,
|
|
8
8
|
description: { default: "" },
|
|
9
9
|
size: { default: "small" },
|
|
10
|
-
primaryButtonText: { default: "
|
|
10
|
+
primaryButtonText: { default: "" },
|
|
11
11
|
primaryButtonDisabled: { type: Boolean, default: !1 },
|
|
12
12
|
primaryButtonLoading: { type: Boolean, default: !1 },
|
|
13
|
-
cancelButtonText: { default: "
|
|
13
|
+
cancelButtonText: { default: "" },
|
|
14
14
|
showCancelButton: { type: Boolean, default: !0 },
|
|
15
15
|
className: { default: "" }
|
|
16
16
|
},
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
2
|
export default _default;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import o from "./RightSlot.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
2
|
import i from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var
|
|
3
|
+
var n = function() {
|
|
5
4
|
var s = this, e = s._self._c, t = s._self._setupProxy;
|
|
6
|
-
return e("div", { staticClass: "d-f
|
|
7
|
-
|
|
8
|
-
} } }) : e(t.InButtonV2, { attrs: { id: "guido__save-button", "label-text": "Save" } })], 1);
|
|
9
|
-
}, n = [], a = /* @__PURE__ */ i(
|
|
5
|
+
return e("div", { staticClass: "d-f" }, [e(t.InButtonV2, { attrs: { id: "guido__history-button", "left-icon": "line-architect-version-history", styling: "ghost", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isVersionHistoryOpen }, on: { click: t.handleVersionHistory } }), e(t.InButtonV2, { attrs: { id: "guido__export-button", "left-icon": "line-export", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1 }, on: { click: t.exportHtml } }), e(t.InButtonV2, { attrs: { id: "guido__save-as-button", "left-icon": "line-newsletter-save-as-template", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1 }, on: { click: t.handleSaveAsTemplate } }), e(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1 } }), e(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "label-text": "Save", "disabled-status": t.editorStore.isVersionHistoryOpen } })], 1);
|
|
6
|
+
}, r = [], a = /* @__PURE__ */ i(
|
|
10
7
|
o,
|
|
11
|
-
r,
|
|
12
8
|
n,
|
|
9
|
+
r,
|
|
13
10
|
!1,
|
|
14
11
|
null,
|
|
15
|
-
|
|
12
|
+
null
|
|
16
13
|
);
|
|
17
|
-
const
|
|
14
|
+
const c = a.exports;
|
|
18
15
|
export {
|
|
19
|
-
|
|
16
|
+
c as default
|
|
20
17
|
};
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useExport as
|
|
3
|
-
import { useVersionHistoryApi as
|
|
4
|
-
import { useEditorStore as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import V from "./version-history/ViewOptions.vue.js";
|
|
8
|
-
import c from "./ViewOptions.vue.js";
|
|
9
|
-
const T = /* @__PURE__ */ n({
|
|
1
|
+
import { defineComponent as s } from "vue";
|
|
2
|
+
import { useExport as n } from "../../../composables/useExport.js";
|
|
3
|
+
import { useVersionHistoryApi as i } from "../../../composables/useVersionHistoryApi.js";
|
|
4
|
+
import { useEditorStore as p } from "../../../stores/editor.js";
|
|
5
|
+
import { InButtonV2 as m } from "@useinsider/design-system-vue";
|
|
6
|
+
const H = /* @__PURE__ */ s({
|
|
10
7
|
__name: "RightSlot",
|
|
11
|
-
setup(
|
|
12
|
-
const { exportHtml:
|
|
13
|
-
return { __sfc: !0, exportHtml:
|
|
8
|
+
setup(a) {
|
|
9
|
+
const { exportHtml: r } = n(), { openVersionHistory: e, closeVersionHistory: t } = i(), o = p();
|
|
10
|
+
return { __sfc: !0, exportHtml: r, openVersionHistory: e, closeVersionHistory: t, editorStore: o, handleVersionHistory: () => {
|
|
14
11
|
if (o.isVersionHistoryOpen) {
|
|
15
|
-
|
|
12
|
+
t();
|
|
16
13
|
return;
|
|
17
14
|
}
|
|
18
|
-
|
|
15
|
+
e();
|
|
19
16
|
}, handleSaveAsTemplate: async () => {
|
|
20
17
|
o.isSaveTemplateModalOpen = !0;
|
|
21
|
-
}, InButtonV2:
|
|
18
|
+
}, InButtonV2: m };
|
|
22
19
|
}
|
|
23
20
|
});
|
|
24
21
|
export {
|
|
25
|
-
|
|
22
|
+
H as default
|
|
26
23
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
var
|
|
1
|
+
import s from "./SaveTemplateModal.vue2.js";
|
|
2
|
+
import l from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
+
var n = function() {
|
|
4
4
|
var r = this, e = r._self._c, t = r._self._setupProxy;
|
|
5
5
|
return e(t.ModalWrapper, { attrs: { "cancel-button-text": t.trans("products.cancel"), description: t.trans("newsletter.save-template-description"), "is-open": t.props.isOpen, "primary-button-loading": t.saveState.saving || t.isLoadingHtml, "primary-button-text": t.trans("products.save"), title: t.trans("products.save-template") }, on: { cancel: t.closeModal, close: t.closeModal, save: t.saveTemplate } }, [e(t.InTextInput, { staticClass: "mb-5 w-1", attrs: { id: "template-name-input", "with-label": "", name: "templateName", invalid: !!t.validationError, "invalid-message": t.validationError, label: t.trans("products.template-name"), placeholder: t.trans("newsletter.enter-template-name") }, model: { value: t.templateNameInput, callback: function(a) {
|
|
6
6
|
t.templateNameInput = typeof a == "string" ? a.trim() : a;
|
|
7
7
|
}, expression: "templateNameInput" } }), e(t.InMultiSelect, { staticClass: "template-category-dropdown mb-5 w-1", attrs: { "create-option-status": "", "search-status": "", "button-status": !1, "character-limit-validation-text": t.trans("validation-v2.duration-value", {
|
|
8
8
|
min: 1,
|
|
9
9
|
max: t.templateCategorySearchInputLimit
|
|
10
|
-
}), "create-button-label": t.trans("products.create-new-category"), "label-text": t.trans("products.template-category"), "loading-state": t.categoriesData.loading || t.categoriesData.loadingCreate, "max-character-limit": t.templateCategorySearchInputLimit, options: t.categoriesData.mappedCategories, "placeholder-text": t.trans("products.select-template-category"), value: t.categoriesData.selectedCategories }, on: { addOption: t.addOption, change: t.
|
|
11
|
-
}, o = [], i = /* @__PURE__ */
|
|
10
|
+
}), "create-button-label": t.trans("products.create-new-category"), "label-text": t.trans("products.template-category"), "loading-state": t.categoriesData.loading || t.categoriesData.loadingCreate, "max-character-limit": t.templateCategorySearchInputLimit, options: t.categoriesData.mappedCategories, "placeholder-text": t.trans("products.select-template-category"), value: t.categoriesData.selectedCategories }, on: { addOption: t.addOption, change: t.setSelectedCategories, resetAllOptions: t.setSelectedCategories, selectAllOptions: t.setSelectedCategories } })], 1);
|
|
11
|
+
}, o = [], i = /* @__PURE__ */ l(
|
|
12
|
+
s,
|
|
12
13
|
n,
|
|
13
|
-
l,
|
|
14
14
|
o,
|
|
15
15
|
!1,
|
|
16
16
|
null,
|
|
@@ -1,90 +1,86 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useActionsApi as
|
|
3
|
-
import { useTemplateCategories as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import B from "
|
|
9
|
-
import {
|
|
10
|
-
const
|
|
1
|
+
import { defineComponent as N, ref as o, watch as C } from "vue";
|
|
2
|
+
import { useActionsApi as O } from "../../../composables/useActionsApi.js";
|
|
3
|
+
import { useTemplateCategories as j } from "../../../composables/useTemplateCategories.js";
|
|
4
|
+
import { useToaster as x } from "../../../composables/useToaster.js";
|
|
5
|
+
import { useTranslations as E } from "../../../composables/useTranslations.js";
|
|
6
|
+
import H from "../base/ModalWrapper.vue.js";
|
|
7
|
+
import { InMultiSelect as R, InTextInput as V } from "@useinsider/design-system-vue";
|
|
8
|
+
import { useSaveAsTemplate as B } from "../../../composables/useSaveAsTemplate.js";
|
|
9
|
+
import { useTemplateNameValidation as P } from "../../../composables/useTemplateNameValidation.js";
|
|
10
|
+
const X = /* @__PURE__ */ N({
|
|
11
11
|
__name: "SaveTemplateModal",
|
|
12
12
|
props: {
|
|
13
13
|
isOpen: { type: Boolean }
|
|
14
14
|
},
|
|
15
15
|
emits: ["close"],
|
|
16
|
-
setup(
|
|
17
|
-
const p =
|
|
18
|
-
data:
|
|
16
|
+
setup(I, { emit: u }) {
|
|
17
|
+
const p = I, l = E(), { showToaster: r } = x(), { getCompiledEmail: v } = O(), {
|
|
18
|
+
data: w,
|
|
19
19
|
fetchCategories: f,
|
|
20
20
|
createCategory: d,
|
|
21
|
-
setSelectedCategories:
|
|
22
|
-
resetSelection:
|
|
23
|
-
getSelectedCategoryIds:
|
|
24
|
-
} =
|
|
21
|
+
setSelectedCategories: _,
|
|
22
|
+
resetSelection: y,
|
|
23
|
+
getSelectedCategoryIds: g
|
|
24
|
+
} = j(), {
|
|
25
25
|
state: M,
|
|
26
|
-
saveTemplate:
|
|
27
|
-
} =
|
|
28
|
-
validationError:
|
|
29
|
-
validateTemplateName:
|
|
30
|
-
clearValidation:
|
|
31
|
-
} =
|
|
32
|
-
t.value = "",
|
|
33
|
-
},
|
|
26
|
+
saveTemplate: T
|
|
27
|
+
} = B(), {
|
|
28
|
+
validationError: b,
|
|
29
|
+
validateTemplateName: n,
|
|
30
|
+
clearValidation: i
|
|
31
|
+
} = P(), t = o(""), a = o(!1), c = o(!1), s = o(""), A = 40, m = () => {
|
|
32
|
+
t.value = "", s.value = "", y(), i();
|
|
33
|
+
}, h = () => {
|
|
34
34
|
m(), u("close");
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
await h({
|
|
44
|
-
name: t.value,
|
|
45
|
-
htmlContent: s.value,
|
|
46
|
-
categoryIds: T.value
|
|
47
|
-
}) && (r({
|
|
48
|
-
message: l(
|
|
49
|
-
"journey-builder.template-saved-successfully",
|
|
50
|
-
{ name: t.value }
|
|
51
|
-
),
|
|
52
|
-
type: "success"
|
|
53
|
-
}), C(), a.value = !1);
|
|
54
|
-
} catch {
|
|
55
|
-
r({
|
|
56
|
-
message: l("journey-builder.template-save-error", { name: t.value }),
|
|
57
|
-
type: "error"
|
|
58
|
-
}), a.value = !1;
|
|
35
|
+
}, D = async () => {
|
|
36
|
+
a.value = !0;
|
|
37
|
+
try {
|
|
38
|
+
if (!(await n(t.value)).isValid) {
|
|
39
|
+
a.value = !1;
|
|
40
|
+
return;
|
|
59
41
|
}
|
|
42
|
+
await T({
|
|
43
|
+
name: t.value,
|
|
44
|
+
htmlContent: s.value,
|
|
45
|
+
categoryIds: g.value
|
|
46
|
+
}) && (r({
|
|
47
|
+
message: l(
|
|
48
|
+
"journey-builder.template-saved-successfully",
|
|
49
|
+
{ name: t.value }
|
|
50
|
+
),
|
|
51
|
+
type: "success"
|
|
52
|
+
}), h(), a.value = !1);
|
|
53
|
+
} catch {
|
|
54
|
+
r({
|
|
55
|
+
message: l("journey-builder.template-save-error", { name: t.value }),
|
|
56
|
+
type: "error"
|
|
57
|
+
}), a.value = !1;
|
|
60
58
|
}
|
|
61
59
|
};
|
|
62
|
-
|
|
63
|
-
e.trim() ?
|
|
60
|
+
C(t, (e) => {
|
|
61
|
+
e.trim() ? n(e) : i();
|
|
64
62
|
});
|
|
65
63
|
const S = async () => {
|
|
66
|
-
|
|
64
|
+
c.value = !0;
|
|
67
65
|
try {
|
|
68
66
|
const { html: e } = await v();
|
|
69
67
|
s.value = e || "";
|
|
70
68
|
} catch {
|
|
71
69
|
s.value = "";
|
|
72
70
|
} finally {
|
|
73
|
-
|
|
71
|
+
c.value = !1;
|
|
74
72
|
}
|
|
75
|
-
}, L = (e) => {
|
|
76
|
-
y(e);
|
|
77
|
-
}, O = async (e) => {
|
|
73
|
+
}, L = async (e) => {
|
|
78
74
|
await d(e);
|
|
79
75
|
};
|
|
80
|
-
return
|
|
76
|
+
return C(() => p.isOpen, async (e) => {
|
|
81
77
|
e ? await Promise.all([
|
|
82
78
|
S(),
|
|
83
79
|
f()
|
|
84
80
|
]) : m();
|
|
85
|
-
}), { __sfc: !0, props: p, emit: u, trans: l, showToaster: r, getCompiledEmail: v, categoriesData:
|
|
81
|
+
}), { __sfc: !0, props: p, emit: u, trans: l, showToaster: r, getCompiledEmail: v, categoriesData: w, fetchCategories: f, createCategory: d, setSelectedCategories: _, resetSelection: y, getSelectedCategoryIds: g, saveState: M, saveTemplateToLibrary: T, validationError: b, validateTemplateName: n, clearValidation: i, templateNameInput: t, isSaving: a, isLoadingHtml: c, htmlData: s, templateCategorySearchInputLimit: A, resetModalState: m, closeModal: h, saveTemplate: D, fetchHtmlData: S, addOption: L, ModalWrapper: H, InTextInput: V, InMultiSelect: R };
|
|
86
82
|
}
|
|
87
83
|
});
|
|
88
84
|
export {
|
|
89
|
-
|
|
85
|
+
X as default
|
|
90
86
|
};
|
|
@@ -8,7 +8,7 @@ interface SaveTemplateData {
|
|
|
8
8
|
recommendationConfigs?: RecommendationConfig;
|
|
9
9
|
recommendationCampaignUrls?: RecommendationCampaignUrls;
|
|
10
10
|
}
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const useSaveAsTemplate: () => {
|
|
12
12
|
state: {
|
|
13
13
|
saving: boolean;
|
|
14
14
|
};
|
|
@@ -2,13 +2,13 @@ import { useHttp as o } from "./useHttp.js";
|
|
|
2
2
|
import { base64EncodeWithSpecialChars as n } from "../utils/base64.js";
|
|
3
3
|
import { reactive as a } from "vue";
|
|
4
4
|
const l = () => {
|
|
5
|
-
const { post: i } = o(),
|
|
5
|
+
const { post: i } = o(), s = a({
|
|
6
6
|
saving: !1
|
|
7
7
|
});
|
|
8
8
|
return {
|
|
9
|
-
state:
|
|
9
|
+
state: s,
|
|
10
10
|
saveTemplate: async (e) => {
|
|
11
|
-
|
|
11
|
+
s.saving = !0;
|
|
12
12
|
try {
|
|
13
13
|
const t = {
|
|
14
14
|
name: e.name,
|
|
@@ -26,19 +26,19 @@ const l = () => {
|
|
|
26
26
|
)), e.recommendationCampaignUrls && (t.recommendationCampaignUrls = n(
|
|
27
27
|
JSON.stringify(e.recommendationCampaignUrls)
|
|
28
28
|
));
|
|
29
|
-
const
|
|
29
|
+
const r = await i(
|
|
30
30
|
"/newsletter/template-library/create-template",
|
|
31
31
|
t
|
|
32
32
|
);
|
|
33
|
-
return !(!
|
|
33
|
+
return !(!r.data || r.data.type === "error");
|
|
34
34
|
} catch {
|
|
35
35
|
return !1;
|
|
36
36
|
} finally {
|
|
37
|
-
|
|
37
|
+
s.saving = !1;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
export {
|
|
43
|
-
l as
|
|
43
|
+
l as useSaveAsTemplate
|
|
44
44
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { TemplateCategory } from '@@/Types/template-categories';
|
|
2
1
|
interface MappedCategory {
|
|
3
2
|
value: string;
|
|
4
3
|
text: string;
|
|
@@ -32,7 +31,5 @@ export declare const useTemplateCategories: ({ getInitialData }?: GetDataProps)
|
|
|
32
31
|
setSelectedCategories: (categories: MappedCategory[]) => void;
|
|
33
32
|
resetSelection: () => void;
|
|
34
33
|
getSelectedCategoryIds: import("vue").ComputedRef<number[]>;
|
|
35
|
-
getCategoryById: (id: number) => TemplateCategory | undefined;
|
|
36
|
-
getCategoryByName: (name: string) => TemplateCategory | undefined;
|
|
37
34
|
};
|
|
38
35
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useHttp as
|
|
2
|
-
import { useToaster as
|
|
3
|
-
import { reactive as
|
|
4
|
-
const
|
|
5
|
-
const { get: c, post: d } =
|
|
1
|
+
import { useHttp as h } from "./useHttp.js";
|
|
2
|
+
import { useToaster as x } from "./useToaster.js";
|
|
3
|
+
import { reactive as w, computed as v } from "vue";
|
|
4
|
+
const b = ({ getInitialData: g = !1 } = {}) => {
|
|
5
|
+
const { get: c, post: d } = h(), { handleError: o, showToaster: n } = x(), e = w({
|
|
6
6
|
loading: !1,
|
|
7
7
|
loadingCreate: !1,
|
|
8
8
|
categories: [],
|
|
@@ -11,10 +11,10 @@ const T = ({ getInitialData: l = !1 } = {}) => {
|
|
|
11
11
|
}), i = async () => {
|
|
12
12
|
e.loading = !0;
|
|
13
13
|
try {
|
|
14
|
-
const
|
|
15
|
-
e.categories =
|
|
16
|
-
value:
|
|
17
|
-
text:
|
|
14
|
+
const s = (await c("/newsletter/template-library/get-template-categories")).data || [];
|
|
15
|
+
e.categories = s, e.mappedCategories = s.map((a) => ({
|
|
16
|
+
value: a.id.toString(),
|
|
17
|
+
text: a.name
|
|
18
18
|
}));
|
|
19
19
|
} catch (t) {
|
|
20
20
|
o(t, "Error fetching template categories:"), e.categories = [], e.mappedCategories = [];
|
|
@@ -23,10 +23,10 @@ const T = ({ getInitialData: l = !1 } = {}) => {
|
|
|
23
23
|
}
|
|
24
24
|
}, p = async (t) => {
|
|
25
25
|
try {
|
|
26
|
-
const
|
|
27
|
-
return (await c(
|
|
28
|
-
} catch (
|
|
29
|
-
return o(
|
|
26
|
+
const a = `/newsletter/template-library/category-name-exists?name=${encodeURIComponent(t)}`;
|
|
27
|
+
return (await c(a)).data.status;
|
|
28
|
+
} catch (s) {
|
|
29
|
+
return o(s, "Error checking category name:"), !1;
|
|
30
30
|
}
|
|
31
31
|
}, m = async (t) => {
|
|
32
32
|
e.loadingCreate = !0;
|
|
@@ -41,40 +41,38 @@ const T = ({ getInitialData: l = !1 } = {}) => {
|
|
|
41
41
|
const r = (await d("/newsletter/template-library/create-category", { name: t })).data;
|
|
42
42
|
if (r) {
|
|
43
43
|
e.categories.push(r);
|
|
44
|
-
const
|
|
44
|
+
const l = {
|
|
45
45
|
value: r.id.toString(),
|
|
46
46
|
text: r.name
|
|
47
47
|
};
|
|
48
|
-
e.mappedCategories.push(
|
|
48
|
+
e.mappedCategories.push(l), e.selectedCategories.push(l), n({
|
|
49
49
|
type: "success",
|
|
50
50
|
message: "Category created successfully"
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
} catch (
|
|
54
|
-
o(
|
|
53
|
+
} catch (s) {
|
|
54
|
+
o(s, "Error creating category:");
|
|
55
55
|
} finally {
|
|
56
56
|
e.loadingCreate = !1;
|
|
57
57
|
}
|
|
58
58
|
}, C = (t) => {
|
|
59
|
-
const
|
|
60
|
-
|
|
59
|
+
const s = e.selectedCategories.findIndex((a) => a.value === t.value);
|
|
60
|
+
s === -1 ? e.selectedCategories.push(t) : e.selectedCategories.splice(s, 1);
|
|
61
61
|
}, y = (t) => {
|
|
62
62
|
e.selectedCategories = [...t];
|
|
63
63
|
}, u = () => {
|
|
64
64
|
e.selectedCategories = [];
|
|
65
|
-
}, f =
|
|
66
|
-
return
|
|
65
|
+
}, f = v(() => e.selectedCategories.map((t) => parseInt(t.value)));
|
|
66
|
+
return g && i(), {
|
|
67
67
|
data: e,
|
|
68
68
|
fetchCategories: i,
|
|
69
69
|
createCategory: m,
|
|
70
70
|
selectCategory: C,
|
|
71
71
|
setSelectedCategories: y,
|
|
72
72
|
resetSelection: u,
|
|
73
|
-
getSelectedCategoryIds: f
|
|
74
|
-
getCategoryById: h,
|
|
75
|
-
getCategoryByName: w
|
|
73
|
+
getSelectedCategoryIds: f
|
|
76
74
|
};
|
|
77
75
|
};
|
|
78
76
|
export {
|
|
79
|
-
|
|
77
|
+
b as useTemplateCategories
|
|
80
78
|
};
|
|
@@ -2,12 +2,12 @@ export interface ValidationResult {
|
|
|
2
2
|
isValid: boolean;
|
|
3
3
|
message: string;
|
|
4
4
|
}
|
|
5
|
-
export declare const
|
|
6
|
-
validationError: import("vue").
|
|
7
|
-
isValidating: import("vue").
|
|
5
|
+
export declare const useTemplateNameValidation: () => {
|
|
6
|
+
validationError: import("vue").Ref<string>;
|
|
7
|
+
isValidating: import("vue").Ref<boolean>;
|
|
8
8
|
validateTemplateName: (name: string) => Promise<ValidationResult>;
|
|
9
9
|
clearValidation: () => void;
|
|
10
10
|
VALIDATION_RULES: {
|
|
11
|
-
|
|
11
|
+
DEBOUNCE_TIME: number;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useHttp as v } from "./useHttp.js";
|
|
2
|
+
import { useToaster as T } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as E } from "./useTranslations.js";
|
|
4
|
+
import { ref as m } from "vue";
|
|
5
|
+
const c = {
|
|
6
|
+
DEBOUNCE_TIME: 500
|
|
7
|
+
}, x = () => {
|
|
8
|
+
const { get: u } = v(), { handleError: d } = T(), l = E(), s = m(""), o = m(!1), r = m(null), p = (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 u(i)).data.status;
|
|
18
|
+
} catch (e) {
|
|
19
|
+
return d(e, "Error checking template name:"), !1;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
validationError: s,
|
|
24
|
+
isValidating: o,
|
|
25
|
+
validateTemplateName: (a) => (r.value && clearTimeout(r.value), new Promise((e) => {
|
|
26
|
+
const i = p(a);
|
|
27
|
+
if (!i.isValid) {
|
|
28
|
+
s.value = i.message, e(i);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
o.value = !0, r.value = setTimeout(async () => {
|
|
32
|
+
try {
|
|
33
|
+
const t = await f(a.trim()), n = {
|
|
34
|
+
isValid: !t,
|
|
35
|
+
message: t ? l("whatsapp-business.template-name-exists") : ""
|
|
36
|
+
};
|
|
37
|
+
s.value = n.message, e(n);
|
|
38
|
+
} catch (t) {
|
|
39
|
+
const n = {
|
|
40
|
+
isValid: !1,
|
|
41
|
+
message: t instanceof Error ? t.message : l("validation.unknown-error")
|
|
42
|
+
};
|
|
43
|
+
s.value = n.message, e(n);
|
|
44
|
+
} finally {
|
|
45
|
+
o.value = !1;
|
|
46
|
+
}
|
|
47
|
+
}, c.DEBOUNCE_TIME);
|
|
48
|
+
})),
|
|
49
|
+
clearValidation: () => {
|
|
50
|
+
s.value = "", o.value = !1, r.value && clearTimeout(r.value);
|
|
51
|
+
},
|
|
52
|
+
VALIDATION_RULES: c
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
x as useTemplateNameValidation
|
|
57
|
+
};
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.version-history-item[data-v-0e2ff42d]{flex-basis:200px}.version-history-wrapper[data-v-187d41fa]{gap:8px}
|
|
1
|
+
.version-history-item[data-v-0e2ff42d]{flex-basis:200px}.version-history-wrapper[data-v-187d41fa]{gap:8px}.guido-editor__wrapper[data-v-f20b186e],.guido-editor__container[data-v-f20b186e]{width:100%;height:100vh}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.080866c",
|
|
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",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import r from "./ViewOptions.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import s from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var n = function() {
|
|
5
|
-
var t = this, o = t._self._c, e = t._self._setupProxy;
|
|
6
|
-
return o(e.InSegments, { attrs: { id: "guido__view-option-selection", "with-icon": "", "segment-list": e.segmentList, selected: e.editorStore.editorVisualMode } });
|
|
7
|
-
}, i = [], _ = /* @__PURE__ */ s(
|
|
8
|
-
r,
|
|
9
|
-
n,
|
|
10
|
-
i,
|
|
11
|
-
!1,
|
|
12
|
-
null,
|
|
13
|
-
"0fff376c"
|
|
14
|
-
);
|
|
15
|
-
const l = _.exports;
|
|
16
|
-
export {
|
|
17
|
-
l as default
|
|
18
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { defineComponent as e } from "vue";
|
|
2
|
-
import { useEditorStore as t } from "../../../stores/editor.js";
|
|
3
|
-
import { InSegments as o } from "@useinsider/design-system-vue";
|
|
4
|
-
const u = /* @__PURE__ */ e({
|
|
5
|
-
__name: "ViewOptions",
|
|
6
|
-
setup(n) {
|
|
7
|
-
return { __sfc: !0, editorStore: t(), segmentList: [
|
|
8
|
-
{ text: "", icon: "line-desktop", value: "desktop" },
|
|
9
|
-
{ text: "", icon: "line-menu-mobileapp", value: "mobile" }
|
|
10
|
-
], InSegments: o };
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
export {
|
|
14
|
-
u as default
|
|
15
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import s from "./ViewOptions.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import i from "../../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var r = function() {
|
|
5
|
-
var t = this, o = t._self._c, e = t._self._setupProxy;
|
|
6
|
-
return o(e.InSegments, { attrs: { id: "guido__verion-history-view-option-selection", "with-icon": "", "segment-list": e.segmentList, selected: e.versionHistoryStore.editorVisualMode }, on: { click: e.changeVisualMode } });
|
|
7
|
-
}, n = [], _ = /* @__PURE__ */ i(
|
|
8
|
-
s,
|
|
9
|
-
r,
|
|
10
|
-
n,
|
|
11
|
-
!1,
|
|
12
|
-
null,
|
|
13
|
-
"6a2bde67"
|
|
14
|
-
);
|
|
15
|
-
const d = _.exports;
|
|
16
|
-
export {
|
|
17
|
-
d as default
|
|
18
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { defineComponent as s } from "vue";
|
|
2
|
-
import { useVersionHistoryApi as n } from "../../../../composables/useVersionHistoryApi.js";
|
|
3
|
-
import { useVersionHistoryStore as r } from "../../../../stores/version-history.js";
|
|
4
|
-
import { InSegments as m } from "@useinsider/design-system-vue";
|
|
5
|
-
const d = /* @__PURE__ */ s({
|
|
6
|
-
__name: "ViewOptions",
|
|
7
|
-
setup(p) {
|
|
8
|
-
const e = r(), { switchToDesktopPreview: o, switchToMobilePreview: t } = n();
|
|
9
|
-
return { __sfc: !0, versionHistoryStore: e, switchToDesktopPreview: o, switchToMobilePreview: t, segmentList: [
|
|
10
|
-
{ text: "", icon: "line-desktop", value: "desktop" },
|
|
11
|
-
{ text: "", icon: "line-menu-mobileapp", value: "mobile" }
|
|
12
|
-
], changeVisualMode: (i) => {
|
|
13
|
-
if (e.editorVisualMode = i, i === "mobile") {
|
|
14
|
-
t();
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
o();
|
|
18
|
-
}, InSegments: m };
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
export {
|
|
22
|
-
d as default
|
|
23
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
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
|
-
};
|