@useinsider/guido 1.0.0-beta.7c7bcef → 1.0.0-beta.7f477db
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/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +26 -22
- package/dist/components/organisms/header/MiddleSlot.vue.js +1 -1
- package/dist/components/organisms/header/RightSlot.vue.js +1 -1
- package/dist/components/organisms/header/RightSlot.vue2.js +12 -10
- package/dist/components/organisms/save-template/SaveTemplateModal.vue.d.ts +16 -0
- package/dist/components/organisms/save-template/SaveTemplateModal.vue.js +20 -0
- package/dist/components/organisms/save-template/SaveTemplateModal.vue2.js +78 -0
- package/dist/components/wrappers/ModalWrapper.vue.d.ts +72 -0
- package/dist/components/wrappers/ModalWrapper.vue.js +19 -0
- package/dist/components/wrappers/ModalWrapper.vue2.js +43 -0
- package/dist/composables/useActionsApi.d.ts +2 -1
- package/dist/composables/useActionsApi.js +42 -33
- package/dist/composables/useHttp.js +23 -21
- package/dist/composables/useSaveAsTemplate.d.ts +7 -0
- package/dist/composables/useSaveAsTemplate.js +51 -0
- package/dist/composables/useTemplateNameValidation.d.ts +7 -0
- package/dist/composables/useTemplateNameValidation.js +33 -0
- package/dist/guido.css +1 -1
- package/dist/mock/api/template-library.d.ts +2 -0
- package/dist/stores/editor.d.ts +1 -0
- package/dist/stores/editor.js +2 -1
- package/dist/stores/template-categories.d.ts +41 -0
- package/dist/stores/template-categories.js +91 -0
- package/dist/utils/base64.d.ts +2 -0
- package/dist/utils/base64.js +14 -0
- package/dist/utils/generic.d.ts +1 -0
- package/dist/utils/generic.js +7 -0
- package/dist/utils/textUtil.d.ts +2 -0
- package/package.json +5 -7
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import o from "./Guido.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
3
|
+
import a from "../_virtual/_plugin-vue2_normalizer.js";
|
|
4
4
|
var s = function() {
|
|
5
|
-
var
|
|
6
|
-
return
|
|
7
|
-
},
|
|
5
|
+
var t = this, e = t._self._c, r = t._self._setupProxy;
|
|
6
|
+
return e("div", { staticClass: "guido-editor__wrapper" }, [e(r.HeaderWrapper), e("div", { staticClass: "guido-editor__container", attrs: { id: "guido-editor" } }), e(r.SaveTemplateModal, { attrs: { "is-open": r.editorStore.isSaveTemplateModalOpen }, on: { close: r.handleCloseSaveTemplateModal } })], 1);
|
|
7
|
+
}, i = [], n = /* @__PURE__ */ a(
|
|
8
8
|
o,
|
|
9
9
|
s,
|
|
10
|
-
|
|
10
|
+
i,
|
|
11
11
|
!1,
|
|
12
12
|
null,
|
|
13
|
-
"
|
|
13
|
+
"69c35c60"
|
|
14
14
|
);
|
|
15
|
-
const
|
|
15
|
+
const c = n.exports;
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
c as default
|
|
18
18
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { usePartner as
|
|
3
|
-
import { useStripo as
|
|
4
|
-
import { useTemplates as
|
|
5
|
-
import { DefaultUsername as
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
import { defineComponent as g, onMounted as T } from "vue";
|
|
2
|
+
import { usePartner as S } from "../composables/usePartner.js";
|
|
3
|
+
import { useStripo as C } from "../composables/useStripo.js";
|
|
4
|
+
import { useTemplates as _ } from "../composables/useTemplates.js";
|
|
5
|
+
import { DefaultUsername as y, DefaultGuidoConfig as w } from "../enums/defaults.js";
|
|
6
|
+
import I from "./organisms/header/HeaderWrapper.vue.js";
|
|
7
|
+
import M from "./organisms/save-template/SaveTemplateModal.vue.js";
|
|
8
|
+
import { useEditorStore as P } from "../stores/editor.js";
|
|
9
|
+
const F = /* @__PURE__ */ g({
|
|
8
10
|
__name: "Guido",
|
|
9
11
|
props: {
|
|
10
12
|
emailId: null,
|
|
@@ -14,30 +16,32 @@ const h = /* @__PURE__ */ f({
|
|
|
14
16
|
username: null,
|
|
15
17
|
guidoConfig: null
|
|
16
18
|
},
|
|
17
|
-
setup(
|
|
18
|
-
const o =
|
|
19
|
-
emailId:
|
|
20
|
-
userId:
|
|
21
|
-
guidoConfig:
|
|
22
|
-
partnerName:
|
|
23
|
-
productType:
|
|
24
|
-
username:
|
|
19
|
+
setup(f) {
|
|
20
|
+
const o = f, { getPartnerName: t, getProductType: r } = S(), {
|
|
21
|
+
emailId: a,
|
|
22
|
+
userId: n,
|
|
23
|
+
guidoConfig: i,
|
|
24
|
+
partnerName: l = t(),
|
|
25
|
+
productType: m = r(),
|
|
26
|
+
username: p = y
|
|
25
27
|
} = o;
|
|
26
28
|
window.GuidoConfig = {
|
|
27
|
-
...
|
|
28
|
-
...
|
|
29
|
+
...w,
|
|
30
|
+
...i
|
|
29
31
|
};
|
|
30
|
-
const { initPlugin:
|
|
31
|
-
|
|
32
|
+
const { initPlugin: u } = C({ emailId: a, userId: n, username: p, partnerName: l, productType: m }), { getDefaultTemplate: s } = _(), d = P(), c = () => {
|
|
33
|
+
d.isSaveTemplateModalOpen = !1;
|
|
34
|
+
};
|
|
35
|
+
return T(async () => {
|
|
32
36
|
try {
|
|
33
37
|
const e = await s();
|
|
34
|
-
await
|
|
38
|
+
await u(e);
|
|
35
39
|
} catch (e) {
|
|
36
40
|
console.error("Failed to initialize Stripo editor:", e);
|
|
37
41
|
}
|
|
38
|
-
}), { __sfc: !0, props: o, getPartnerName:
|
|
42
|
+
}), { __sfc: !0, props: o, getPartnerName: t, getProductType: r, emailId: a, userId: n, guidoConfig: i, partnerName: l, productType: m, username: p, initPlugin: u, getDefaultTemplate: s, editorStore: d, handleCloseSaveTemplateModal: c, HeaderWrapper: I, SaveTemplateModal: M };
|
|
39
43
|
}
|
|
40
44
|
});
|
|
41
45
|
export {
|
|
42
|
-
|
|
46
|
+
F as default
|
|
43
47
|
};
|
|
@@ -2,7 +2,7 @@ import s from "./MiddleSlot.vue2.js";
|
|
|
2
2
|
import i from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
3
|
var n = function() {
|
|
4
4
|
var e = this, o = e._self._c, t = e._self._setupProxy;
|
|
5
|
-
return t.editorStore.isVersionHistoryOpen ? o("div", { staticClass: "d-f" }, [o(t.VersionHistory), o(t.VersionHistoryViewOptions)], 1) : o("div", { staticClass: "d-f" }, [o(t.InButtonV2, { attrs: { id: "guido__undo-button", "left-icon": "line-undo", styling: "ghost", type: "secondary", "label-text-status": !1 } }), o(t.InButtonV2, { attrs: { id: "guido__redo-button", "left-icon": "line-redo", styling: "ghost", type: "secondary", "label-text-status": !1 } }), o(t.InButtonV2, { attrs: { id: "guido__code-button", "left-icon": "line-code", styling: "ghost", "tooltip-text": "Code Editor", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isCodeEditorOpen, "tooltip-options": t.getTooltipOptions("guido__code-button") } }), o(t.InButtonV2, { attrs: { id: "guido__preview-button", "left-icon": "line-show-on", styling: "ghost", type: "secondary", "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__preview-button"), "tooltip-text": t.trans("newsletter.email-preview") } }), o(t.ViewOptions, { staticClass: "ml-3" })], 1);
|
|
5
|
+
return t.editorStore.isVersionHistoryOpen ? o("div", { staticClass: "d-f" }, [o(t.VersionHistory), o(t.VersionHistoryViewOptions)], 1) : o("div", { staticClass: "d-f" }, [o(t.InButtonV2, { attrs: { id: "guido__undo-button", "left-icon": "line-undo", styling: "ghost", type: "secondary", "label-text-status": !1 } }), o(t.InButtonV2, { attrs: { id: "guido__redo-button", "left-icon": "line-redo", styling: "ghost", type: "secondary", "label-text-status": !1 } }), o(t.InButtonV2, { attrs: { id: "guido__code-button", "data-testid": "Code Editor", "left-icon": "line-code", styling: "ghost", "tooltip-text": "Code Editor", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isCodeEditorOpen, "tooltip-options": t.getTooltipOptions("guido__code-button") } }), o(t.InButtonV2, { attrs: { id: "guido__preview-button", "left-icon": "line-show-on", styling: "ghost", type: "secondary", "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__preview-button"), "tooltip-text": t.trans("newsletter.email-preview") } }), o(t.ViewOptions, { staticClass: "ml-3" })], 1);
|
|
6
6
|
}, l = [], r = /* @__PURE__ */ i(
|
|
7
7
|
s,
|
|
8
8
|
n,
|
|
@@ -2,7 +2,7 @@ import o from "./RightSlot.vue2.js";
|
|
|
2
2
|
import i from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
3
|
var n = function() {
|
|
4
4
|
var s = this, e = s._self._c, t = s._self._setupProxy;
|
|
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 } }), 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);
|
|
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
6
|
}, r = [], a = /* @__PURE__ */ i(
|
|
7
7
|
o,
|
|
8
8
|
n,
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { defineComponent as s } from "vue";
|
|
2
|
-
import { useExport as
|
|
3
|
-
import { useVersionHistoryApi as
|
|
2
|
+
import { useExport as n } from "../../../composables/useExport.js";
|
|
3
|
+
import { useVersionHistoryApi as i } from "../../../composables/useVersionHistoryApi.js";
|
|
4
4
|
import { useEditorStore as p } from "../../../stores/editor.js";
|
|
5
5
|
import { InButtonV2 as m } from "@useinsider/design-system-vue";
|
|
6
|
-
const
|
|
6
|
+
const H = /* @__PURE__ */ s({
|
|
7
7
|
__name: "RightSlot",
|
|
8
|
-
setup(
|
|
9
|
-
const { exportHtml:
|
|
10
|
-
return { __sfc: !0, exportHtml:
|
|
11
|
-
if (
|
|
12
|
-
|
|
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: () => {
|
|
11
|
+
if (o.isVersionHistoryOpen) {
|
|
12
|
+
t();
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
e();
|
|
16
|
+
}, handleSaveAsTemplate: async () => {
|
|
17
|
+
o.isSaveTemplateModalOpen = !0;
|
|
16
18
|
}, InButtonV2: m };
|
|
17
19
|
}
|
|
18
20
|
});
|
|
19
21
|
export {
|
|
20
|
-
|
|
22
|
+
H as default
|
|
21
23
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
}
|
|
4
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<Props>, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
|
|
5
|
+
close: () => void;
|
|
6
|
+
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<Props>>>, {}>;
|
|
7
|
+
export default _default;
|
|
8
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
9
|
+
type __VLS_TypePropsToOption<T> = {
|
|
10
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
11
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
12
|
+
} : {
|
|
13
|
+
type: import('vue').PropType<T[K]>;
|
|
14
|
+
required: true;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import s from "./SaveTemplateModal.vue2.js";
|
|
2
|
+
import r from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
+
var o = function() {
|
|
4
|
+
var a = this, t = a._self._c, e = a._self._setupProxy;
|
|
5
|
+
return t(e.ModalWrapper, { attrs: { "cancel-button-text": e.trans("products.cancel"), description: e.trans("newsletter.save-template-description"), "is-open": e.props.isOpen, "primary-button-loading": e.saveState.saving, "primary-button-text": e.trans(e.saveState.saving ? "newsletter.saving" : "products.save"), title: e.trans("products.save-template") }, on: { cancel: e.closeModal, close: e.closeModal, save: e.saveTemplate } }, [t(e.InBasicTextInput, { staticClass: "mb-5 w-1", attrs: { id: "template-name-input", name: "templateName", "character-counter-status": !1, "disabled-status": e.saveState.saving, "label-text": e.trans("products.template-name"), "placeholder-text": e.trans("newsletter.enter-template-name"), "state-message": e.getValidationMessage(), states: e.hasError() ? "error" : "", "tooltip-status": !1, value: e.templateName }, on: { input: e.templateNameInputHandler } }), t(e.InMultiSelect, { staticClass: "template-category-dropdown mb-5 w-1", attrs: { "create-option-status": "", "search-status": "", "button-status": !1, "character-limit-validation-text": e.trans("validation-v2.duration-value", {
|
|
6
|
+
min: 1,
|
|
7
|
+
max: e.templateCategorySearchInputLimit
|
|
8
|
+
}), "create-button-label": e.trans("products.create-new-category"), "disabled-status": e.saveState.saving, "label-text": e.trans("products.template-category"), "loading-state": e.categoriesStore.loading || e.categoriesStore.loadingCreate, "max-character-limit": e.templateCategorySearchInputLimit, options: e.categoriesStore.mappedCategories, "placeholder-text": e.trans("products.select-template-category"), value: e.categoriesStore.selectedCategories }, on: { addOption: e.addOption, change: e.categoriesStore.setSelectedCategories, resetAllOptions: e.categoriesStore.setSelectedCategories, selectAllOptions: e.categoriesStore.setSelectedCategories } })], 1);
|
|
9
|
+
}, n = [], l = /* @__PURE__ */ r(
|
|
10
|
+
s,
|
|
11
|
+
o,
|
|
12
|
+
n,
|
|
13
|
+
!1,
|
|
14
|
+
null,
|
|
15
|
+
null
|
|
16
|
+
);
|
|
17
|
+
const d = l.exports;
|
|
18
|
+
export {
|
|
19
|
+
d as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { defineComponent as b, ref as u, computed as A, watch as H } from "vue";
|
|
2
|
+
import L from "../../wrappers/ModalWrapper.vue.js";
|
|
3
|
+
import { useActionsApi as N } from "../../../composables/useActionsApi.js";
|
|
4
|
+
import { useToaster as V } from "../../../composables/useToaster.js";
|
|
5
|
+
import { useTranslations as j } from "../../../composables/useTranslations.js";
|
|
6
|
+
import { useTemplateCategoriesStore as x } from "../../../stores/template-categories.js";
|
|
7
|
+
import { InMultiSelect as B, InBasicTextInput as P } from "@useinsider/design-system-vue";
|
|
8
|
+
import { useSaveAsTemplate as E } from "../../../composables/useSaveAsTemplate.js";
|
|
9
|
+
import { useTemplateNameValidation as R } from "../../../composables/useTemplateNameValidation.js";
|
|
10
|
+
const U = /* @__PURE__ */ b({
|
|
11
|
+
__name: "SaveTemplateModal",
|
|
12
|
+
props: {
|
|
13
|
+
isOpen: { type: Boolean }
|
|
14
|
+
},
|
|
15
|
+
emits: ["close"],
|
|
16
|
+
setup(S, { emit: p }) {
|
|
17
|
+
const v = S, n = j(), { showToaster: c } = V(), { getRawTemplateData: f } = N(), a = x(), {
|
|
18
|
+
state: t,
|
|
19
|
+
saveTemplate: d
|
|
20
|
+
} = E(), {
|
|
21
|
+
templateName: s,
|
|
22
|
+
getValidationMessage: I,
|
|
23
|
+
hasError: w,
|
|
24
|
+
validateInputs: g,
|
|
25
|
+
resetValidation: i
|
|
26
|
+
} = R(), l = u(!1), o = u(""), r = u(""), C = 40, y = A(() => t.saving || l.value || a.loading || a.loadingCreate), m = () => {
|
|
27
|
+
s.value = "", o.value = "", r.value = "", a.resetSelection(), i();
|
|
28
|
+
}, M = (e) => {
|
|
29
|
+
s.value = e, i();
|
|
30
|
+
}, T = () => {
|
|
31
|
+
m(), p("close");
|
|
32
|
+
}, _ = async () => {
|
|
33
|
+
if (!y.value) {
|
|
34
|
+
if (t.saving = !0, !await g()) {
|
|
35
|
+
t.saving = !1;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
await d({
|
|
40
|
+
name: s.value,
|
|
41
|
+
htmlContent: o.value,
|
|
42
|
+
categoryIds: a.getSelectedCategoryIds,
|
|
43
|
+
css: r.value
|
|
44
|
+
}) && (t.saving = !1, c({
|
|
45
|
+
message: n("journey-builder.template-saved-successfully", { name: s.value }),
|
|
46
|
+
type: "success"
|
|
47
|
+
}), T());
|
|
48
|
+
} catch {
|
|
49
|
+
t.saving = !1, c({
|
|
50
|
+
message: n("journey-builder.template-save-error", { name: s.value }),
|
|
51
|
+
type: "error"
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}, h = async () => {
|
|
56
|
+
l.value = !0;
|
|
57
|
+
try {
|
|
58
|
+
const { html: e, css: O } = await f();
|
|
59
|
+
r.value = O || "", o.value = e || "";
|
|
60
|
+
} catch {
|
|
61
|
+
o.value = "", r.value = "";
|
|
62
|
+
} finally {
|
|
63
|
+
l.value = !1;
|
|
64
|
+
}
|
|
65
|
+
}, D = async (e) => {
|
|
66
|
+
await a.createCategory(e);
|
|
67
|
+
};
|
|
68
|
+
return H(() => v.isOpen, async (e) => {
|
|
69
|
+
e ? await Promise.all([
|
|
70
|
+
h(),
|
|
71
|
+
a.fetchCategories()
|
|
72
|
+
]) : m();
|
|
73
|
+
}), { __sfc: !0, props: v, emit: p, trans: n, showToaster: c, getRawTemplateData: f, categoriesStore: a, saveState: t, saveTemplateToLibrary: d, templateName: s, getValidationMessage: I, hasError: w, validateInputs: g, resetValidation: i, isLoadingHtml: l, htmlData: o, cssData: r, templateCategorySearchInputLimit: C, isOperationInProgress: y, resetModalState: m, templateNameInputHandler: M, closeModal: T, saveTemplate: _, fetchHtmlData: h, addOption: D, ModalWrapper: L, InBasicTextInput: P, InMultiSelect: B };
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
export {
|
|
77
|
+
U as default
|
|
78
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
interface ModalWrapperProps {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
title: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
size?: 'small' | 'medium' | 'large';
|
|
6
|
+
primaryButtonText?: string;
|
|
7
|
+
primaryButtonDisabled?: boolean;
|
|
8
|
+
primaryButtonLoading?: boolean;
|
|
9
|
+
cancelButtonText?: string;
|
|
10
|
+
showCancelButton?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
declare var __VLS_12: {};
|
|
14
|
+
type __VLS_Slots = {} & {
|
|
15
|
+
default?: (props: typeof __VLS_12) => any;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<ModalWrapperProps>, {
|
|
18
|
+
description: string;
|
|
19
|
+
size: string;
|
|
20
|
+
primaryButtonText: string;
|
|
21
|
+
primaryButtonDisabled: boolean;
|
|
22
|
+
primaryButtonLoading: boolean;
|
|
23
|
+
cancelButtonText: string;
|
|
24
|
+
showCancelButton: boolean;
|
|
25
|
+
className: string;
|
|
26
|
+
}>, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
|
|
27
|
+
close: () => void;
|
|
28
|
+
save: () => void;
|
|
29
|
+
cancel: () => void;
|
|
30
|
+
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<ModalWrapperProps>, {
|
|
31
|
+
description: string;
|
|
32
|
+
size: string;
|
|
33
|
+
primaryButtonText: string;
|
|
34
|
+
primaryButtonDisabled: boolean;
|
|
35
|
+
primaryButtonLoading: boolean;
|
|
36
|
+
cancelButtonText: string;
|
|
37
|
+
showCancelButton: boolean;
|
|
38
|
+
className: string;
|
|
39
|
+
}>>>, {
|
|
40
|
+
className: string;
|
|
41
|
+
size: "small" | "medium" | "large";
|
|
42
|
+
description: string;
|
|
43
|
+
primaryButtonText: string;
|
|
44
|
+
primaryButtonDisabled: boolean;
|
|
45
|
+
primaryButtonLoading: boolean;
|
|
46
|
+
cancelButtonText: string;
|
|
47
|
+
showCancelButton: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
50
|
+
export default _default;
|
|
51
|
+
type __VLS_WithDefaults<P, D> = {
|
|
52
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
53
|
+
default: D[K];
|
|
54
|
+
}> : P[K];
|
|
55
|
+
};
|
|
56
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
57
|
+
type __VLS_TypePropsToOption<T> = {
|
|
58
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
59
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
60
|
+
} : {
|
|
61
|
+
type: import('vue').PropType<T[K]>;
|
|
62
|
+
required: true;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
66
|
+
new (): {
|
|
67
|
+
$scopedSlots: S;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
type __VLS_PrettifyLocal<T> = {
|
|
71
|
+
[K in keyof T]: T[K];
|
|
72
|
+
} & {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import r from "./ModalWrapper.vue2.js";
|
|
2
|
+
import o from "../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
+
var s = function() {
|
|
4
|
+
var t = this, n = t._self._c, e = t._self._setupProxy;
|
|
5
|
+
return n(e.InDrawer, { attrs: { id: "modal-wrapper", "description-text": t.description, "footer-button-group-options": e.drawerFooterOptions, size: t.size, status: t.isOpen, "title-text": t.title }, on: { cancelOrBackButtonEvent: e.handleCancel, onCloseEvent: e.handleClose, primaryButtonEvent: e.handleSave }, scopedSlots: t._u([{ key: "contentSlot", fn: function() {
|
|
6
|
+
return [n("div", { staticClass: "modal-content-wrapper", class: t.className }, [t._t("default")], 2)];
|
|
7
|
+
}, proxy: !0 }], null, !0) });
|
|
8
|
+
}, a = [], l = /* @__PURE__ */ o(
|
|
9
|
+
r,
|
|
10
|
+
s,
|
|
11
|
+
a,
|
|
12
|
+
!1,
|
|
13
|
+
null,
|
|
14
|
+
null
|
|
15
|
+
);
|
|
16
|
+
const u = l.exports;
|
|
17
|
+
export {
|
|
18
|
+
u as default
|
|
19
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineComponent as o, computed as l } from "vue";
|
|
2
|
+
import { InDrawer as s } from "@useinsider/design-system-vue";
|
|
3
|
+
const i = /* @__PURE__ */ o({
|
|
4
|
+
__name: "ModalWrapper",
|
|
5
|
+
props: {
|
|
6
|
+
isOpen: { type: Boolean },
|
|
7
|
+
title: null,
|
|
8
|
+
description: { default: "" },
|
|
9
|
+
size: { default: "small" },
|
|
10
|
+
primaryButtonText: { default: "" },
|
|
11
|
+
primaryButtonDisabled: { type: Boolean, default: !1 },
|
|
12
|
+
primaryButtonLoading: { type: Boolean, default: !1 },
|
|
13
|
+
cancelButtonText: { default: "" },
|
|
14
|
+
showCancelButton: { type: Boolean, default: !0 },
|
|
15
|
+
className: { default: "" }
|
|
16
|
+
},
|
|
17
|
+
emits: ["close", "save", "cancel"],
|
|
18
|
+
setup(a, { emit: t }) {
|
|
19
|
+
const e = a, n = l(() => ({
|
|
20
|
+
primaryButton: {
|
|
21
|
+
styling: "solid",
|
|
22
|
+
type: "primary",
|
|
23
|
+
labelText: e.primaryButtonText,
|
|
24
|
+
disabledStatus: e.primaryButtonDisabled || e.primaryButtonLoading
|
|
25
|
+
},
|
|
26
|
+
cancelOrBackButton: e.showCancelButton ? {
|
|
27
|
+
type: "secondary",
|
|
28
|
+
styling: "ghost",
|
|
29
|
+
labelText: e.cancelButtonText
|
|
30
|
+
} : void 0
|
|
31
|
+
}));
|
|
32
|
+
return { __sfc: !0, props: e, emit: t, drawerFooterOptions: n, handleClose: () => {
|
|
33
|
+
t("close");
|
|
34
|
+
}, handleSave: () => {
|
|
35
|
+
t("save");
|
|
36
|
+
}, handleCancel: () => {
|
|
37
|
+
t("cancel");
|
|
38
|
+
}, InDrawer: s };
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
export {
|
|
42
|
+
i as default
|
|
43
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { GetCompiledEmailOptions, CompiledEmailResult } from '@@/Types/actions-api';
|
|
1
|
+
import { GetCompiledEmailOptions, CompiledEmailResult, TemplateDataResult } from '@@/Types/actions-api';
|
|
2
2
|
export declare const useActionsApi: () => {
|
|
3
3
|
getCompiledEmail: (options?: GetCompiledEmailOptions) => Promise<CompiledEmailResult>;
|
|
4
|
+
getRawTemplateData: () => Promise<TemplateDataResult>;
|
|
4
5
|
};
|
|
@@ -1,36 +1,45 @@
|
|
|
1
|
-
const d = () => ({
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
const d = () => ({
|
|
2
|
+
getCompiledEmail: (t = {}) => new Promise((e, i) => {
|
|
3
|
+
const m = {
|
|
4
|
+
...{ ...{
|
|
5
|
+
minimize: !0,
|
|
6
|
+
utmEntity: {
|
|
7
|
+
utmSource: "",
|
|
8
|
+
utmMedium: "",
|
|
9
|
+
utmCampaign: "",
|
|
10
|
+
utmContent: "",
|
|
11
|
+
utmTerm: "",
|
|
12
|
+
customUtms: [
|
|
13
|
+
{
|
|
14
|
+
name1: "val1",
|
|
15
|
+
name2: "val2"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
mergeTags: ["Tag1", "Tag2"],
|
|
20
|
+
forseAmp: !1,
|
|
21
|
+
resetDataSavedFlag: !1,
|
|
22
|
+
disableLineHeightsReplace: !0
|
|
23
|
+
}, ...t },
|
|
24
|
+
callback: (a, o, n, s, l) => {
|
|
25
|
+
a ? i(a) : e({
|
|
26
|
+
html: o,
|
|
27
|
+
ampHtml: n,
|
|
28
|
+
ampErrors: s,
|
|
29
|
+
displayConditions: l
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
window.StripoEditorApi.actionsApi.compileEmail(m);
|
|
34
|
+
}),
|
|
35
|
+
getRawTemplateData: () => new Promise((t) => {
|
|
36
|
+
window.StripoEditorApi.actionsApi.getTemplateData(
|
|
37
|
+
(e) => {
|
|
38
|
+
t(e);
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
})
|
|
42
|
+
});
|
|
34
43
|
export {
|
|
35
44
|
d as useActionsApi
|
|
36
45
|
};
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { ref as p, computed as
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ref as p, computed as T } from "vue";
|
|
2
|
+
import { getCsrfToken as H } from "../utils/generic.js";
|
|
3
|
+
const k = (b = {}) => {
|
|
4
|
+
const h = p(!1), a = p(null), u = p(null), g = T(() => h.value), y = T(() => a.value !== null), v = {
|
|
4
5
|
baseURL: "",
|
|
5
6
|
timeout: 1e4,
|
|
6
7
|
retry: 0,
|
|
7
8
|
retryDelay: 1e3,
|
|
8
9
|
headers: {
|
|
9
|
-
"Content-Type": "application/json"
|
|
10
|
+
"Content-Type": "application/json",
|
|
11
|
+
"X-CSRF-TOKEN": H()
|
|
10
12
|
},
|
|
11
|
-
...
|
|
13
|
+
...b
|
|
12
14
|
}, w = (e, s) => {
|
|
13
15
|
if (e.startsWith("http://") || e.startsWith("https://"))
|
|
14
16
|
return e;
|
|
15
|
-
const t = s ||
|
|
17
|
+
const t = s || v.baseURL || "";
|
|
16
18
|
return t.endsWith("/") && e.startsWith("/") ? `${t}${e.slice(1)}` : t.endsWith("/") || e.startsWith("/") ? `${t}${e}` : `${t}/${e}`;
|
|
17
19
|
}, P = (e) => new Promise((s, t) => {
|
|
18
20
|
setTimeout(() => {
|
|
@@ -22,20 +24,20 @@ const j = (y = {}) => {
|
|
|
22
24
|
setTimeout(s, e);
|
|
23
25
|
}), i = async (e, s, t, D = {}) => {
|
|
24
26
|
a.value = null, h.value = !0, u.value = new AbortController();
|
|
25
|
-
const n = { ...
|
|
27
|
+
const n = { ...v, ...D }, L = w(s, n.baseURL), c = {
|
|
26
28
|
method: e,
|
|
27
29
|
headers: { ...n.headers },
|
|
28
30
|
signal: u.value.signal,
|
|
29
31
|
...n
|
|
30
32
|
};
|
|
31
33
|
t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete c.headers["Content-Type"], c.body = t) : c.body = JSON.stringify(t));
|
|
32
|
-
const
|
|
34
|
+
const E = async (m = 0) => {
|
|
33
35
|
try {
|
|
34
36
|
const o = [fetch(L, c)];
|
|
35
37
|
n.timeout && o.push(P(n.timeout));
|
|
36
38
|
const r = await Promise.race(o);
|
|
37
39
|
if (!r.ok) {
|
|
38
|
-
const
|
|
40
|
+
const O = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(O);
|
|
39
41
|
throw d.status = r.status, d.statusText = r.statusText, d.response = r, d;
|
|
40
42
|
}
|
|
41
43
|
let f;
|
|
@@ -49,36 +51,36 @@ const j = (y = {}) => {
|
|
|
49
51
|
} catch (o) {
|
|
50
52
|
const r = o instanceof Error && o.name === "AbortError";
|
|
51
53
|
if (m < (n.retry || 0) && !r)
|
|
52
|
-
return await x(n.retryDelay || 1e3),
|
|
54
|
+
return await x(n.retryDelay || 1e3), E(m + 1);
|
|
53
55
|
throw o instanceof Error ? o.name === "AbortError" ? a.value = { message: "Request was cancelled" } : a.value = { message: o.message } : a.value = o, o;
|
|
54
56
|
}
|
|
55
57
|
};
|
|
56
58
|
try {
|
|
57
|
-
return await
|
|
59
|
+
return await E();
|
|
58
60
|
} finally {
|
|
59
61
|
h.value = !1, u.value = null;
|
|
60
62
|
}
|
|
61
|
-
},
|
|
63
|
+
}, C = (e, s) => i("GET", e, void 0, s), $ = (e, s, t) => i("POST", e, s, t), R = (e, s, t) => i("PUT", e, s, t), U = (e, s, t) => i("PATCH", e, s, t), A = (e, s) => i("DELETE", e, void 0, s), W = (e) => {
|
|
62
64
|
u.value && u.value.abort(e);
|
|
63
65
|
}, q = () => {
|
|
64
66
|
a.value = null;
|
|
65
67
|
};
|
|
66
68
|
return {
|
|
67
69
|
// State
|
|
68
|
-
loading:
|
|
69
|
-
error:
|
|
70
|
-
hasError:
|
|
70
|
+
loading: g,
|
|
71
|
+
error: T(() => a.value),
|
|
72
|
+
hasError: y,
|
|
71
73
|
// Methods
|
|
72
74
|
request: i,
|
|
73
|
-
get:
|
|
74
|
-
post:
|
|
75
|
-
put:
|
|
76
|
-
patch:
|
|
77
|
-
delete:
|
|
75
|
+
get: C,
|
|
76
|
+
post: $,
|
|
77
|
+
put: R,
|
|
78
|
+
patch: U,
|
|
79
|
+
delete: A,
|
|
78
80
|
cancel: W,
|
|
79
81
|
clearError: q
|
|
80
82
|
};
|
|
81
83
|
};
|
|
82
84
|
export {
|
|
83
|
-
|
|
85
|
+
k as useHttp
|
|
84
86
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useHttp as m } from "./useHttp.js";
|
|
2
|
+
import { base64EncodeWithSpecialChars as t } from "../utils/base64.js";
|
|
3
|
+
import { reactive as a } from "vue";
|
|
4
|
+
const u = () => {
|
|
5
|
+
const { post: o } = m(), n = a({
|
|
6
|
+
saving: !1
|
|
7
|
+
});
|
|
8
|
+
return {
|
|
9
|
+
state: n,
|
|
10
|
+
saveTemplate: async (e) => {
|
|
11
|
+
n.saving = !0;
|
|
12
|
+
const i = {
|
|
13
|
+
editor: "stripo",
|
|
14
|
+
html: t(e.htmlContent),
|
|
15
|
+
css: t(e.css)
|
|
16
|
+
}, c = t(JSON.stringify(i ?? ""));
|
|
17
|
+
try {
|
|
18
|
+
const s = {
|
|
19
|
+
name: e.name,
|
|
20
|
+
categories: e.categoryIds,
|
|
21
|
+
productId: 60,
|
|
22
|
+
editorType: 2,
|
|
23
|
+
messageType: 2,
|
|
24
|
+
stripoConfig: c,
|
|
25
|
+
content: t(e.htmlContent),
|
|
26
|
+
unsubscriptionPreferencePages: [],
|
|
27
|
+
unsubscriptionPreferencePageStatus: !1
|
|
28
|
+
};
|
|
29
|
+
e.css && (s.css = t(e.css)), e.stripoConfig && (s.stripoConfig = t(
|
|
30
|
+
JSON.stringify(e.stripoConfig)
|
|
31
|
+
)), e.recommendationConfigs && (s.recommendationConfigs = t(
|
|
32
|
+
JSON.stringify(e.recommendationConfigs)
|
|
33
|
+
)), e.recommendationCampaignUrls && (s.recommendationCampaignUrls = t(
|
|
34
|
+
JSON.stringify(e.recommendationCampaignUrls)
|
|
35
|
+
));
|
|
36
|
+
const r = await o(
|
|
37
|
+
"/newsletter/template-library/create-template",
|
|
38
|
+
s
|
|
39
|
+
);
|
|
40
|
+
return !(!r.data || r.data.type === "error");
|
|
41
|
+
} catch {
|
|
42
|
+
return !1;
|
|
43
|
+
} finally {
|
|
44
|
+
n.saving = !1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
u as useSaveAsTemplate
|
|
51
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ref as r } from "vue";
|
|
2
|
+
import { useHttp as i } from "./useHttp.js";
|
|
3
|
+
import { useTranslations as m } from "./useTranslations.js";
|
|
4
|
+
const o = 255;
|
|
5
|
+
function h() {
|
|
6
|
+
const n = r(""), e = r(""), t = m();
|
|
7
|
+
return {
|
|
8
|
+
templateName: n,
|
|
9
|
+
getValidationMessage: () => e.value,
|
|
10
|
+
hasError: () => !!e.value.length,
|
|
11
|
+
validateInputs: async () => {
|
|
12
|
+
const a = n.value.trim();
|
|
13
|
+
if (!a)
|
|
14
|
+
return e.value = t("whatsapp-business.template-name-required"), !1;
|
|
15
|
+
if (a.length > o)
|
|
16
|
+
return e.value = t("validations.enter-up-to-x-characters", {
|
|
17
|
+
article: "a",
|
|
18
|
+
field: t("products.template-name"),
|
|
19
|
+
max: o
|
|
20
|
+
}), !1;
|
|
21
|
+
const l = encodeURIComponent(a), { data: s = {} } = await i().get(
|
|
22
|
+
`/newsletter/template-library/template-name-exists?name=${l}`
|
|
23
|
+
);
|
|
24
|
+
return s != null && s.status ? (e.value = t("whatsapp-business.template-name-exists"), !1) : !0;
|
|
25
|
+
},
|
|
26
|
+
resetValidation: () => {
|
|
27
|
+
e.value = "";
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
h as useTemplateNameValidation
|
|
33
|
+
};
|
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-
|
|
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-69c35c60],.guido-editor__container[data-v-69c35c60]{width:100%;height:calc(100vh - 75px)}
|
package/dist/stores/editor.d.ts
CHANGED
package/dist/stores/editor.js
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { TemplateCategory } from '@@/Types/save-as-template';
|
|
2
|
+
export interface MappedCategory {
|
|
3
|
+
value: string;
|
|
4
|
+
text: string;
|
|
5
|
+
}
|
|
6
|
+
export interface TemplateCategoriesState {
|
|
7
|
+
categories: TemplateCategory[];
|
|
8
|
+
mappedCategories: MappedCategory[];
|
|
9
|
+
selectedCategories: MappedCategory[];
|
|
10
|
+
loading: boolean;
|
|
11
|
+
loadingCreate: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const useTemplateCategoriesStore: import("pinia").StoreDefinition<"templateCategories", TemplateCategoriesState, {
|
|
14
|
+
getSelectedCategoryIds: (state: {
|
|
15
|
+
categories: {
|
|
16
|
+
id: number;
|
|
17
|
+
name: string;
|
|
18
|
+
partnerId: number;
|
|
19
|
+
isStripo: boolean;
|
|
20
|
+
templatesCount: number;
|
|
21
|
+
}[];
|
|
22
|
+
mappedCategories: {
|
|
23
|
+
value: string;
|
|
24
|
+
text: string;
|
|
25
|
+
}[];
|
|
26
|
+
selectedCategories: {
|
|
27
|
+
value: string;
|
|
28
|
+
text: string;
|
|
29
|
+
}[];
|
|
30
|
+
loading: boolean;
|
|
31
|
+
loadingCreate: boolean;
|
|
32
|
+
} & import("pinia").PiniaCustomStateProperties<TemplateCategoriesState>) => number[];
|
|
33
|
+
}, {
|
|
34
|
+
fetchCategories(): Promise<void>;
|
|
35
|
+
checkCategoryNameExists(name: string): Promise<boolean>;
|
|
36
|
+
createCategory(name: string): Promise<void>;
|
|
37
|
+
setSelectedCategories(categories: MappedCategory[]): void;
|
|
38
|
+
selectCategory(category: MappedCategory): void;
|
|
39
|
+
resetSelection(): void;
|
|
40
|
+
resetStore(): void;
|
|
41
|
+
}>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { useHttp as c } from "../composables/useHttp.js";
|
|
2
|
+
import { useToaster as r } from "../composables/useToaster.js";
|
|
3
|
+
import { defineStore as g } from "pinia";
|
|
4
|
+
const l = () => ({
|
|
5
|
+
categories: [],
|
|
6
|
+
mappedCategories: [],
|
|
7
|
+
selectedCategories: [],
|
|
8
|
+
loading: !1,
|
|
9
|
+
loadingCreate: !1
|
|
10
|
+
}), m = g("templateCategories", {
|
|
11
|
+
state: () => l(),
|
|
12
|
+
getters: {
|
|
13
|
+
getSelectedCategoryIds: (e) => e.selectedCategories.map((s) => parseInt(s.value))
|
|
14
|
+
},
|
|
15
|
+
actions: {
|
|
16
|
+
async fetchCategories() {
|
|
17
|
+
this.loading = !0;
|
|
18
|
+
const { get: e } = c();
|
|
19
|
+
try {
|
|
20
|
+
const t = (await e("/newsletter/template-library/get-template-categories")).data || [];
|
|
21
|
+
this.categories = t, this.mappedCategories = t.map((a) => ({
|
|
22
|
+
value: a.id.toString(),
|
|
23
|
+
text: a.name
|
|
24
|
+
}));
|
|
25
|
+
} catch (s) {
|
|
26
|
+
const { handleError: t } = r();
|
|
27
|
+
t(s, "Error fetching template categories:"), this.categories = [], this.mappedCategories = [];
|
|
28
|
+
} finally {
|
|
29
|
+
this.loading = !1;
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
async checkCategoryNameExists(e) {
|
|
33
|
+
const { get: s } = c();
|
|
34
|
+
try {
|
|
35
|
+
const a = `/newsletter/template-library/category-name-exists?name=${encodeURIComponent(e)}`;
|
|
36
|
+
return (await s(a)).data.status;
|
|
37
|
+
} catch (t) {
|
|
38
|
+
const { handleError: a } = r();
|
|
39
|
+
return a(t, "Error checking category name:"), !1;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
async createCategory(e) {
|
|
43
|
+
this.loadingCreate = !0;
|
|
44
|
+
const { post: s } = c(), { showToaster: t } = r();
|
|
45
|
+
try {
|
|
46
|
+
if (await this.checkCategoryNameExists(e)) {
|
|
47
|
+
t({
|
|
48
|
+
type: "error",
|
|
49
|
+
message: "Category name already exists"
|
|
50
|
+
});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const i = (await s("/newsletter/template-library/create-category", { name: e })).data;
|
|
54
|
+
if (i) {
|
|
55
|
+
this.categories.push(i);
|
|
56
|
+
const n = {
|
|
57
|
+
value: i.id.toString(),
|
|
58
|
+
text: e
|
|
59
|
+
};
|
|
60
|
+
this.mappedCategories.push(n), this.selectedCategories.push(n), t({
|
|
61
|
+
type: "success",
|
|
62
|
+
message: "Category created successfully"
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
} catch (a) {
|
|
66
|
+
const { handleError: o } = r();
|
|
67
|
+
o(a, "Error creating category:");
|
|
68
|
+
} finally {
|
|
69
|
+
this.loadingCreate = !1;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
setSelectedCategories(e) {
|
|
73
|
+
this.selectedCategories = [...e];
|
|
74
|
+
},
|
|
75
|
+
selectCategory(e) {
|
|
76
|
+
const s = this.selectedCategories.findIndex(
|
|
77
|
+
(t) => t.value === e.value
|
|
78
|
+
);
|
|
79
|
+
s === -1 ? this.selectedCategories.push(e) : this.selectedCategories.splice(s, 1);
|
|
80
|
+
},
|
|
81
|
+
resetSelection() {
|
|
82
|
+
this.selectedCategories = [];
|
|
83
|
+
},
|
|
84
|
+
resetStore() {
|
|
85
|
+
Object.assign(this, l());
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
export {
|
|
90
|
+
m as useTemplateCategoriesStore
|
|
91
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const c = (e) => {
|
|
2
|
+
try {
|
|
3
|
+
const n = new TextEncoder().encode(e);
|
|
4
|
+
let o = "";
|
|
5
|
+
return n.forEach((r) => {
|
|
6
|
+
o += String.fromCharCode(r);
|
|
7
|
+
}), window.btoa(o);
|
|
8
|
+
} catch {
|
|
9
|
+
return window.btoa(unescape(encodeURIComponent(e)));
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
c as base64EncodeWithSpecialChars
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getCsrfToken: () => string;
|
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.7f477db",
|
|
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",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
],
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
"import": "./dist/library.js",
|
|
14
|
+
"types": "./dist/components/Guido.vue.d.ts",
|
|
15
|
+
"require": "./dist/components/Guido.vue.js"
|
|
16
16
|
},
|
|
17
17
|
"./style": "./dist/guido.css"
|
|
18
18
|
},
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"start": "vite",
|
|
22
22
|
"build": "vite build && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.app.json",
|
|
23
23
|
"preview": "vite preview",
|
|
24
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
25
24
|
"lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ && bun run type-check",
|
|
26
25
|
"lint:fix": "NODE_OPTIONS=--max-old-space-size=2048 eslint --fix ./",
|
|
27
26
|
"type-check": "vue-tsc --noEmit --project tsconfig.config.json && vue-tsc --noEmit --project tsconfig.app.json"
|
|
@@ -31,8 +30,6 @@
|
|
|
31
30
|
"license": "ISC",
|
|
32
31
|
"dependencies": {
|
|
33
32
|
"@useinsider/design-system-vue": "0.14.8",
|
|
34
|
-
"@vuelidate/core": "2.0.3",
|
|
35
|
-
"@vuelidate/validators": "2.0.4",
|
|
36
33
|
"lodash-es": "4.17.21",
|
|
37
34
|
"pinia": "2.3.1",
|
|
38
35
|
"vite": "6.3.5",
|
|
@@ -42,6 +39,7 @@
|
|
|
42
39
|
"@cspell/eslint-plugin": "8.17.5",
|
|
43
40
|
"@eslint/eslintrc": "3.3.0",
|
|
44
41
|
"@eslint/js": "8.57.1",
|
|
42
|
+
"@playwright/test": "^1.54.2",
|
|
45
43
|
"@stylistic/eslint-plugin": "3.1.0",
|
|
46
44
|
"@stylistic/eslint-plugin-migrate": "3.1.0",
|
|
47
45
|
"@types/eslint": "8.56.12",
|