@useinsider/guido 1.0.0-beta.83deaec → 1.0.0-beta.8861b13

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 (70) hide show
  1. package/README.md +17 -17
  2. package/dist/components/Guido.vue.d.ts +0 -4
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +18 -34
  5. package/dist/components/organisms/{header/HeaderWrapper.vue.js → top-bar/Header.vue.js} +7 -7
  6. package/dist/components/organisms/top-bar/Header.vue2.js +14 -0
  7. package/dist/components/organisms/{header/LeftSlot.vue.js → top-bar/HeaderLeftSlot.vue.js} +7 -7
  8. package/dist/components/organisms/top-bar/HeaderLeftSlot.vue2.js +11 -0
  9. package/dist/components/organisms/top-bar/HeaderMiddleSlot.vue.js +17 -0
  10. package/dist/components/organisms/top-bar/HeaderMiddleSlot.vue2.js +19 -0
  11. package/dist/components/organisms/top-bar/HeaderRightSlot.vue.js +18 -0
  12. package/dist/components/organisms/top-bar/HeaderRightSlot.vue2.js +14 -0
  13. package/dist/components/organisms/{header/ViewOptions.vue.js → top-bar/HeaderViewOptions.vue.js} +5 -5
  14. package/dist/components/organisms/{header/ViewOptions.vue2.js → top-bar/HeaderViewOptions.vue2.js} +3 -3
  15. package/dist/composables/useStripo.d.ts +2 -2
  16. package/dist/composables/useStripo.js +55 -48
  17. package/dist/composables/useToaster.d.ts +0 -1
  18. package/dist/composables/useToaster.js +16 -24
  19. package/dist/enums/defaults.d.ts +0 -2
  20. package/dist/enums/defaults.js +3 -5
  21. package/dist/guido.css +1 -1
  22. package/dist/node_modules/pinia/dist/pinia.js +314 -0
  23. package/dist/node_modules/pinia/node_modules/vue-demi/lib/index.js +11 -0
  24. package/dist/static/editor.css.js +22 -72
  25. package/dist/stores/editor.d.ts +0 -2
  26. package/dist/stores/editor.js +2 -4
  27. package/package.json +1 -1
  28. package/dist/components/organisms/base/ModalWrapper.vue.d.ts +0 -72
  29. package/dist/components/organisms/base/ModalWrapper.vue.js +0 -19
  30. package/dist/components/organisms/base/ModalWrapper.vue2.js +0 -43
  31. package/dist/components/organisms/header/HeaderWrapper.vue2.js +0 -14
  32. package/dist/components/organisms/header/LeftSlot.vue2.js +0 -11
  33. package/dist/components/organisms/header/MiddleSlot.vue.js +0 -17
  34. package/dist/components/organisms/header/MiddleSlot.vue2.js +0 -20
  35. package/dist/components/organisms/header/RightSlot.vue.d.ts +0 -2
  36. package/dist/components/organisms/header/RightSlot.vue.js +0 -20
  37. package/dist/components/organisms/header/RightSlot.vue2.js +0 -26
  38. package/dist/components/organisms/header/version-history/VersionHistory.vue.d.ts +0 -2
  39. package/dist/components/organisms/header/version-history/VersionHistory.vue.js +0 -22
  40. package/dist/components/organisms/header/version-history/VersionHistory.vue2.js +0 -15
  41. package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.d.ts +0 -16
  42. package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.js +0 -18
  43. package/dist/components/organisms/header/version-history/VersionHistoryItem.vue2.js +0 -16
  44. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +0 -18
  45. package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +0 -23
  46. package/dist/components/organisms/save-template/SaveTemplateModal.vue.d.ts +0 -21
  47. package/dist/components/organisms/save-template/SaveTemplateModal.vue.js +0 -22
  48. package/dist/components/organisms/save-template/SaveTemplateModal.vue2.js +0 -81
  49. package/dist/composables/useHttp.js +0 -84
  50. package/dist/composables/usePartner.d.ts +0 -4
  51. package/dist/composables/usePartner.js +0 -16
  52. package/dist/composables/useTemplateCategories.d.ts +0 -38
  53. package/dist/composables/useTemplateCategories.js +0 -80
  54. package/dist/composables/useTemplateValidation.d.ts +0 -13
  55. package/dist/composables/useTemplateValidation.js +0 -57
  56. package/dist/composables/useVersionHistoryApi.d.ts +0 -8
  57. package/dist/composables/useVersionHistoryApi.js +0 -53
  58. package/dist/mock/api/custom-fonts.d.ts +0 -2
  59. package/dist/mock/api/template-library.d.ts +0 -2
  60. package/dist/services/stripoApi.d.ts +0 -7
  61. package/dist/services/stripoApi.js +0 -29
  62. package/dist/stores/version-history.d.ts +0 -80
  63. package/dist/stores/version-history.js +0 -28
  64. package/dist/utils/dateUtil.d.ts +0 -1
  65. package/dist/utils/dateUtil.js +0 -16
  66. /package/dist/components/organisms/{header/HeaderWrapper.vue.d.ts → top-bar/Header.vue.d.ts} +0 -0
  67. /package/dist/components/organisms/{header/LeftSlot.vue.d.ts → top-bar/HeaderLeftSlot.vue.d.ts} +0 -0
  68. /package/dist/components/organisms/{header/ViewOptions.vue.d.ts → top-bar/HeaderMiddleSlot.vue.d.ts} +0 -0
  69. /package/dist/components/organisms/{header/MiddleSlot.vue.d.ts → top-bar/HeaderRightSlot.vue.d.ts} +0 -0
  70. /package/dist/components/organisms/{header/version-history/ViewOptions.vue.d.ts → top-bar/HeaderViewOptions.vue.d.ts} +0 -0
@@ -1,11 +0,0 @@
1
- import { defineComponent as t } from "vue";
2
- import { InButtonV2 as o } from "@useinsider/design-system-vue";
3
- const _ = /* @__PURE__ */ t({
4
- __name: "LeftSlot",
5
- setup(e) {
6
- return { __sfc: !0, InButtonV2: o };
7
- }
8
- });
9
- export {
10
- _ as default
11
- };
@@ -1,17 +0,0 @@
1
- import s from "./MiddleSlot.vue2.js";
2
- import n from "../../../_virtual/_plugin-vue2_normalizer.js";
3
- var i = function() {
4
- var e = this, o = e._self._c, t = e._self._setupProxy;
5
- return t.editorStore.isVersionHistoryOpen ? o(t.VersionHistory) : 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") } })], 1);
6
- }, l = [], r = /* @__PURE__ */ n(
7
- s,
8
- i,
9
- l,
10
- !1,
11
- null,
12
- null
13
- );
14
- const _ = r.exports;
15
- export {
16
- _ as default
17
- };
@@ -1,20 +0,0 @@
1
- import { defineComponent as r } from "vue";
2
- import { useTranslations as s } from "../../../composables/useTranslations.js";
3
- import { useEditorStore as n } from "../../../stores/editor.js";
4
- import { InButtonV2 as e } from "@useinsider/design-system-vue";
5
- import m from "./version-history/VersionHistory.vue.js";
6
- const _ = /* @__PURE__ */ r({
7
- __name: "MiddleSlot",
8
- setup(p) {
9
- const o = n(), t = s();
10
- return { __sfc: !0, editorStore: o, trans: t, getTooltipOptions: (i) => ({
11
- id: `${i}-tooltip`,
12
- dynamicPosition: !1,
13
- staticPosition: "bottom center",
14
- iconStatus: !1
15
- }), InButtonV2: e, VersionHistory: m };
16
- }
17
- });
18
- export {
19
- _ as default
20
- };
@@ -1,2 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
- export default _default;
@@ -1,20 +0,0 @@
1
- import o from "./RightSlot.vue2.js";
2
- /* empty css */
3
- import i from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var r = function() {
5
- var s = this, e = s._self._c, t = s._self._setupProxy;
6
- return e("div", { staticClass: "d-f header-right-slot" }, [e("div", { staticClass: "d-f" }, [t.editorStore.isVersionHistoryOpen ? e(t.VersionHistoryViewOptions) : e(t.ViewOptions)], 1), 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 } })], 1), t.editorStore.isVersionHistoryOpen ? e(t.InButtonV2, { attrs: { id: "guido__restore-button", "label-text": "Restore" }, on: { click: function(d) {
7
- return t.restoreVersion(t.versionHistoryStore.currentPatch.id);
8
- } } }) : e(t.InButtonV2, { attrs: { id: "guido__save-button", "label-text": "Save" } })], 1);
9
- }, n = [], a = /* @__PURE__ */ i(
10
- o,
11
- r,
12
- n,
13
- !1,
14
- null,
15
- "78791c47"
16
- );
17
- const p = a.exports;
18
- export {
19
- p as default
20
- };
@@ -1,26 +0,0 @@
1
- import { defineComponent as n } from "vue";
2
- import { useExport as p } from "../../../composables/useExport.js";
3
- import { useVersionHistoryApi as m } from "../../../composables/useVersionHistoryApi.js";
4
- import { useEditorStore as a } from "../../../stores/editor.js";
5
- import { useVersionHistoryStore as f } from "../../../stores/version-history.js";
6
- import { InButtonV2 as l } from "@useinsider/design-system-vue";
7
- import V from "./version-history/ViewOptions.vue.js";
8
- import c from "./ViewOptions.vue.js";
9
- const T = /* @__PURE__ */ n({
10
- __name: "RightSlot",
11
- setup(u) {
12
- const { exportHtml: t } = p(), { openVersionHistory: r, closeVersionHistory: e, restoreVersion: s } = m(), o = a(), i = f();
13
- return { __sfc: !0, exportHtml: t, openVersionHistory: r, closeVersionHistory: e, restoreVersion: s, editorStore: o, versionHistoryStore: i, handleVersionHistory: () => {
14
- if (o.isVersionHistoryOpen) {
15
- e();
16
- return;
17
- }
18
- r();
19
- }, handleSaveAsTemplate: async () => {
20
- o.isSaveTemplateModalOpen = !0;
21
- }, InButtonV2: l, VersionHistoryViewOptions: V, ViewOptions: c };
22
- }
23
- });
24
- export {
25
- T as default
26
- };
@@ -1,2 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
- export default _default;
@@ -1,22 +0,0 @@
1
- import o from "./VersionHistory.vue2.js";
2
- /* empty css */
3
- import i from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
- var n = function() {
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
- 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(s) {
9
- return t.previewVersion(t.versionHistoryStore.nextPatch.id);
10
- } } })], 1), e(t.VersionHistoryItem, { attrs: { "text-align": "left", date: t.versionHistoryStore.nextPatch.date, description: t.versionHistoryStore.nextPatch.description } })], 1);
11
- }, a = [], c = /* @__PURE__ */ i(
12
- o,
13
- n,
14
- a,
15
- !1,
16
- null,
17
- "187d41fa"
18
- );
19
- const p = c.exports;
20
- export {
21
- p as default
22
- };
@@ -1,15 +0,0 @@
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
- __name: "VersionHistory",
8
- setup(m) {
9
- const o = s(), { previewVersion: r } = e();
10
- return { __sfc: !0, versionHistoryStore: o, previewVersion: r, InButtonV2: i, VersionHistoryItem: n };
11
- }
12
- });
13
- export {
14
- c as default
15
- };
@@ -1,16 +0,0 @@
1
- type __VLS_Props = {
2
- description: string;
3
- date: number;
4
- textAlign: string;
5
- };
6
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_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
- };
@@ -1,18 +0,0 @@
1
- import e from "./VersionHistoryItem.vue2.js";
2
- /* empty css */
3
- import o from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
- var i = function() {
5
- var s = this, r = s._self._c, t = s._self._setupProxy;
6
- return r("div", { staticClass: "version-history-item f-g-1" }, [t.props.description ? r("div", { staticClass: "d-f f-d-c", class: { "t-a-r": t.props.textAlign === "right" } }, [r("div", { staticClass: "t-o-e o-h w-s-n-w", domProps: { innerHTML: s._s(t.props.description) } }), r("div", { staticClass: "f-s-1" }, [s._v(" " + s._s(t.formatPatchDate(t.props.date)) + " ")])]) : s._e()]);
7
- }, a = [], n = /* @__PURE__ */ o(
8
- e,
9
- i,
10
- a,
11
- !1,
12
- null,
13
- "0e2ff42d"
14
- );
15
- const d = n.exports;
16
- export {
17
- d as default
18
- };
@@ -1,16 +0,0 @@
1
- import { defineComponent as o } from "vue";
2
- import { formatPatchDate as e } from "../../../../utils/dateUtil.js";
3
- const s = /* @__PURE__ */ o({
4
- __name: "VersionHistoryItem",
5
- props: {
6
- description: null,
7
- date: null,
8
- textAlign: null
9
- },
10
- setup(t) {
11
- return { __sfc: !0, props: t, formatPatchDate: e };
12
- }
13
- });
14
- export {
15
- s as default
16
- };
@@ -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,21 +0,0 @@
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
- categoryIds: number[];
10
- }) => void;
11
- }, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<TemplateModalProps>>>, {}>;
12
- export default _default;
13
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
14
- type __VLS_TypePropsToOption<T> = {
15
- [K in keyof T]-?: {} extends Pick<T, K> ? {
16
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
17
- } : {
18
- type: import('vue').PropType<T[K]>;
19
- required: true;
20
- };
21
- };
@@ -1,22 +0,0 @@
1
- import n from "./SaveTemplateModal.vue2.js";
2
- import s from "../../../_virtual/_plugin-vue2_normalizer.js";
3
- var l = function() {
4
- var r = this, e = r._self._c, t = r._self._setupProxy;
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.isSaving || 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", disabled: t.isSaving, 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
- t.templateNameInput = typeof a == "string" ? a.trim() : a;
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
- min: 1,
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.categoryChangeHandler, resetAllOptions: t.categoryChangeHandler, selectAllOptions: t.categoryChangeHandler } })], 1);
11
- }, o = [], i = /* @__PURE__ */ s(
12
- n,
13
- l,
14
- o,
15
- !1,
16
- null,
17
- null
18
- );
19
- const d = i.exports;
20
- export {
21
- d as default
22
- };
@@ -1,81 +0,0 @@
1
- import { defineComponent as N, ref as r, watch as C } from "vue";
2
- import { useActionsApi as D } from "../../../composables/useActionsApi.js";
3
- import { useTemplateCategories as O } from "../../../composables/useTemplateCategories.js";
4
- import { useTemplateValidation as b } from "../../../composables/useTemplateValidation.js";
5
- import { useToaster as x } from "../../../composables/useToaster.js";
6
- import { useTranslations as A } from "../../../composables/useTranslations.js";
7
- import R from "../base/ModalWrapper.vue.js";
8
- import { InMultiSelect as V, InTextInput as W } from "@useinsider/design-system-vue";
9
- const J = /* @__PURE__ */ N({
10
- __name: "SaveTemplateModal",
11
- props: {
12
- isOpen: { type: Boolean }
13
- },
14
- emits: ["close", "save"],
15
- setup(E, { emit: l }) {
16
- const p = E, M = A(), { handleError: o } = x(), { getCompiledEmail: u } = D(), {
17
- data: S,
18
- fetchCategories: f,
19
- createCategory: v,
20
- setSelectedCategories: d,
21
- resetSelection: g,
22
- getSelectedCategoryIds: y
23
- } = O(), a = r(""), s = r(!1), n = r(!1), t = r(""), I = 40, {
24
- validationError: w,
25
- validateTemplateName: i,
26
- clearValidation: c
27
- } = b(), m = () => {
28
- a.value = "", g(), c(), t.value = "";
29
- }, h = () => {
30
- m(), l("close");
31
- }, H = async () => {
32
- if (a.value.trim()) {
33
- s.value = !0;
34
- try {
35
- if (!(await i(a.value)).isValid)
36
- return;
37
- if (!t.value) {
38
- o(new Error("No HTML data available"), "Error saving template:");
39
- return;
40
- }
41
- l("save", {
42
- templateName: a.value,
43
- htmlData: t.value,
44
- categoryIds: y.value
45
- }), h();
46
- } catch (e) {
47
- o(e, "Error saving template:");
48
- } finally {
49
- s.value = !1;
50
- }
51
- }
52
- };
53
- C(a, (e) => {
54
- e.trim() ? i(e) : c();
55
- });
56
- const T = async () => {
57
- n.value = !0;
58
- try {
59
- const { html: e } = await u();
60
- t.value = e || "", e || o(new Error("No HTML content available"), "Warning:");
61
- } catch (e) {
62
- o(e, "Error fetching HTML data:"), t.value = "";
63
- } finally {
64
- n.value = !1;
65
- }
66
- }, _ = (e) => {
67
- d(e);
68
- }, L = async (e) => {
69
- await v(e);
70
- };
71
- return C(() => p.isOpen, async (e) => {
72
- e ? await Promise.all([
73
- T(),
74
- f()
75
- ]) : m();
76
- }), { __sfc: !0, props: p, emit: l, trans: M, handleError: o, getCompiledEmail: u, categoriesData: S, fetchCategories: f, createCategory: v, setSelectedCategories: d, resetSelection: g, getSelectedCategoryIds: y, templateNameInput: a, isSaving: s, isLoadingHtml: n, htmlData: t, templateCategorySearchInputLimit: I, validationError: w, validateTemplateName: i, clearValidation: c, resetModalState: m, closeModal: h, saveTemplate: H, fetchHtmlData: T, categoryChangeHandler: _, addOption: L, ModalWrapper: R, InTextInput: W, InMultiSelect: V };
77
- }
78
- });
79
- export {
80
- J as default
81
- };
@@ -1,84 +0,0 @@
1
- import { ref as p, computed as v } from "vue";
2
- const j = (y = {}) => {
3
- const h = p(!1), a = p(null), u = p(null), E = v(() => h.value), g = v(() => a.value !== null), T = {
4
- baseURL: "",
5
- timeout: 1e4,
6
- retry: 0,
7
- retryDelay: 1e3,
8
- headers: {
9
- "Content-Type": "application/json"
10
- },
11
- ...y
12
- }, w = (e, s) => {
13
- if (e.startsWith("http://") || e.startsWith("https://"))
14
- return e;
15
- const t = s || T.baseURL || "";
16
- return t.endsWith("/") && e.startsWith("/") ? `${t}${e.slice(1)}` : t.endsWith("/") || e.startsWith("/") ? `${t}${e}` : `${t}/${e}`;
17
- }, P = (e) => new Promise((s, t) => {
18
- setTimeout(() => {
19
- t(new Error("Request timeout"));
20
- }, e);
21
- }), x = (e) => new Promise((s) => {
22
- setTimeout(s, e);
23
- }), i = async (e, s, t, D = {}) => {
24
- a.value = null, h.value = !0, u.value = new AbortController();
25
- const n = { ...T, ...D }, L = w(s, n.baseURL), c = {
26
- method: e,
27
- headers: { ...n.headers },
28
- signal: u.value.signal,
29
- ...n
30
- };
31
- t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete c.headers["Content-Type"], c.body = t) : c.body = JSON.stringify(t));
32
- const b = async (m = 0) => {
33
- try {
34
- const o = [fetch(L, c)];
35
- n.timeout && o.push(P(n.timeout));
36
- const r = await Promise.race(o);
37
- if (!r.ok) {
38
- const H = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(H);
39
- throw d.status = r.status, d.statusText = r.statusText, d.response = r, d;
40
- }
41
- let f;
42
- const l = r.headers.get("content-type");
43
- return l != null && l.includes("application/json") ? f = await r.json() : l != null && l.includes("text/") ? f = await r.text() : f = await r.blob(), {
44
- data: f,
45
- status: r.status,
46
- statusText: r.statusText,
47
- headers: r.headers
48
- };
49
- } catch (o) {
50
- const r = o instanceof Error && o.name === "AbortError";
51
- if (m < (n.retry || 0) && !r)
52
- return await x(n.retryDelay || 1e3), b(m + 1);
53
- throw o instanceof Error ? o.name === "AbortError" ? a.value = { message: "Request was cancelled" } : a.value = { message: o.message } : a.value = o, o;
54
- }
55
- };
56
- try {
57
- return await b();
58
- } finally {
59
- h.value = !1, u.value = null;
60
- }
61
- }, $ = (e, s) => i("GET", e, void 0, s), C = (e, s, t) => i("POST", e, s, t), U = (e, s, t) => i("PUT", e, s, t), A = (e, s, t) => i("PATCH", e, s, t), R = (e, s) => i("DELETE", e, void 0, s), W = (e) => {
62
- u.value && u.value.abort(e);
63
- }, q = () => {
64
- a.value = null;
65
- };
66
- return {
67
- // State
68
- loading: E,
69
- error: v(() => a.value),
70
- hasError: g,
71
- // Methods
72
- request: i,
73
- get: $,
74
- post: C,
75
- put: U,
76
- patch: A,
77
- delete: R,
78
- cancel: W,
79
- clearError: q
80
- };
81
- };
82
- export {
83
- j as useHttp
84
- };
@@ -1,4 +0,0 @@
1
- export declare const usePartner: () => {
2
- getPartnerName: () => string;
3
- getProductType: () => string;
4
- };
@@ -1,16 +0,0 @@
1
- import { DefaultProductType as o } from "../enums/defaults.js";
2
- const p = () => {
3
- const e = {
4
- email: "newsletter"
5
- };
6
- return {
7
- getPartnerName: () => window.location.hostname.split(".")[0] || "",
8
- getProductType: () => {
9
- const t = window.location.pathname.split("/").filter(Boolean)[0] || o;
10
- return e[t] || t;
11
- }
12
- };
13
- };
14
- export {
15
- p as usePartner
16
- };
@@ -1,38 +0,0 @@
1
- import type { TemplateCategory } from '@@/Types/template-categories';
2
- interface MappedCategory {
3
- value: string;
4
- text: string;
5
- }
6
- interface GetDataProps {
7
- getInitialData?: boolean;
8
- }
9
- export declare const useTemplateCategories: ({ getInitialData }?: GetDataProps) => {
10
- data: {
11
- loading: boolean;
12
- loadingCreate: boolean;
13
- categories: {
14
- id: number;
15
- name: string;
16
- partnerId: number;
17
- isStripo: boolean;
18
- templatesCount: number;
19
- }[];
20
- mappedCategories: {
21
- value: string;
22
- text: string;
23
- }[];
24
- selectedCategories: {
25
- value: string;
26
- text: string;
27
- }[];
28
- };
29
- fetchCategories: () => Promise<void>;
30
- createCategory: (name: string) => Promise<void>;
31
- selectCategory: (category: MappedCategory) => void;
32
- setSelectedCategories: (categories: MappedCategory[]) => void;
33
- resetSelection: () => void;
34
- getSelectedCategoryIds: import("vue").ComputedRef<number[]>;
35
- getCategoryById: (id: number) => TemplateCategory | undefined;
36
- getCategoryByName: (name: string) => TemplateCategory | undefined;
37
- };
38
- export {};
@@ -1,80 +0,0 @@
1
- import { useHttp as x } from "./useHttp.js";
2
- import { useToaster as v } from "./useToaster.js";
3
- import { reactive as E, computed as I } from "vue";
4
- const T = ({ getInitialData: l = !1 } = {}) => {
5
- const { get: c, post: d } = x(), { handleError: o, showToaster: n } = v(), e = E({
6
- loading: !1,
7
- loadingCreate: !1,
8
- categories: [],
9
- mappedCategories: [],
10
- selectedCategories: []
11
- }), i = async () => {
12
- e.loading = !0;
13
- try {
14
- const a = (await c("/newsletter/template-library/get-template-categories")).data || [];
15
- e.categories = a, e.mappedCategories = a.map((s) => ({
16
- value: s.id.toString(),
17
- text: s.name
18
- }));
19
- } catch (t) {
20
- o(t, "Error fetching template categories:"), e.categories = [], e.mappedCategories = [];
21
- } finally {
22
- e.loading = !1;
23
- }
24
- }, p = async (t) => {
25
- try {
26
- const s = `/newsletter/template-library/category-name-exists?name=${encodeURIComponent(t)}`;
27
- return (await c(s)).data.status;
28
- } catch (a) {
29
- return o(a, "Error checking category name:"), !1;
30
- }
31
- }, m = async (t) => {
32
- e.loadingCreate = !0;
33
- try {
34
- if (await p(t)) {
35
- n({
36
- type: "error",
37
- message: "Category name already exists"
38
- });
39
- return;
40
- }
41
- const r = (await d("/newsletter/template-library/create-category", { name: t })).data;
42
- if (r) {
43
- e.categories.push(r);
44
- const g = {
45
- value: r.id.toString(),
46
- text: r.name
47
- };
48
- e.mappedCategories.push(g), e.selectedCategories.push(g), n({
49
- type: "success",
50
- message: "Category created successfully"
51
- });
52
- }
53
- } catch (a) {
54
- o(a, "Error creating category:");
55
- } finally {
56
- e.loadingCreate = !1;
57
- }
58
- }, C = (t) => {
59
- const a = e.selectedCategories.findIndex((s) => s.value === t.value);
60
- a === -1 ? e.selectedCategories.push(t) : e.selectedCategories.splice(a, 1);
61
- }, y = (t) => {
62
- e.selectedCategories = [...t];
63
- }, u = () => {
64
- e.selectedCategories = [];
65
- }, f = I(() => e.selectedCategories.map((t) => parseInt(t.value))), h = (t) => e.categories.find((a) => a.id === t), w = (t) => e.categories.find((a) => a.name.toLowerCase() === t.toLowerCase());
66
- return l && i(), {
67
- data: e,
68
- fetchCategories: i,
69
- createCategory: m,
70
- selectCategory: C,
71
- setSelectedCategories: y,
72
- resetSelection: u,
73
- getSelectedCategoryIds: f,
74
- getCategoryById: h,
75
- getCategoryByName: w
76
- };
77
- };
78
- export {
79
- T as useTemplateCategories
80
- };
@@ -1,13 +0,0 @@
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
- };