@useinsider/guido 1.0.0-beta.180c0fa → 1.0.0-beta.184e162
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/README.md +24 -384
- package/dist/@types/generic.d.ts +0 -12
- package/dist/components/Guido.vue.d.ts +7 -16
- package/dist/components/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +33 -78
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +8 -10
- package/dist/components/organisms/header/MiddleSlot.vue.js +1 -1
- package/dist/components/organisms/header/RightSlot.vue.js +5 -5
- package/dist/components/organisms/header/RightSlot.vue2.js +14 -30
- package/dist/composables/useActionsApi.d.ts +1 -2
- package/dist/composables/useActionsApi.js +35 -46
- package/dist/composables/useExport.d.ts +1 -1
- package/dist/composables/useExport.js +20 -35
- package/dist/composables/useHttp.js +21 -23
- package/dist/composables/useStripo.js +23 -29
- package/dist/composables/useTemplates.d.ts +5 -0
- package/dist/composables/useTemplates.js +27 -0
- package/dist/extensions/DynamicContent/dynamic-content-modal.d.ts +18 -4
- package/dist/extensions/DynamicContent/dynamic-content-modal.js +36 -11
- package/dist/extensions/DynamicContent/dynamic-content.d.ts +1 -1
- package/dist/extensions/DynamicContent/dynamic-content.js +15 -16
- package/dist/guido.css +1 -1
- package/dist/services/stripoApi.d.ts +1 -2
- package/dist/services/stripoApi.js +7 -27
- package/dist/static/templates/default/index.html.js +5 -0
- package/dist/static/templates/default/style.css.js +119 -0
- package/dist/stores/editor.d.ts +0 -1
- package/dist/stores/editor.js +1 -2
- package/package.json +4 -2
- package/dist/components/organisms/save-template/SaveTemplateModal.vue.d.ts +0 -16
- package/dist/components/organisms/save-template/SaveTemplateModal.vue.js +0 -20
- package/dist/components/organisms/save-template/SaveTemplateModal.vue2.js +0 -78
- package/dist/components/wrappers/ModalWrapper.vue.d.ts +0 -72
- package/dist/components/wrappers/ModalWrapper.vue.js +0 -19
- package/dist/components/wrappers/ModalWrapper.vue2.js +0 -43
- package/dist/composables/useGuidoActions.d.ts +0 -46
- package/dist/composables/useGuidoActions.js +0 -37
- package/dist/composables/useHtmlCompiler.d.ts +0 -4
- package/dist/composables/useHtmlCompiler.js +0 -16
- package/dist/composables/useProvideInject.d.ts +0 -14
- package/dist/composables/useProvideInject.js +0 -17
- package/dist/composables/useSaveAsTemplate.d.ts +0 -7
- package/dist/composables/useSaveAsTemplate.js +0 -52
- package/dist/composables/useTemplateNameValidation.d.ts +0 -7
- package/dist/composables/useTemplateNameValidation.js +0 -33
- package/dist/config/compiler/htmlCompilerRules.d.ts +0 -2
- package/dist/config/compiler/htmlCompilerRules.js +0 -145
- package/dist/config/compiler/outlookCompilerRules.d.ts +0 -0
- package/dist/mock/api/default-template.d.ts +0 -2
- package/dist/mock/api/template-library.d.ts +0 -2
- package/dist/stores/dynamic-content.d.ts +0 -27
- package/dist/stores/dynamic-content.js +0 -23
- package/dist/stores/template-categories.d.ts +0 -41
- package/dist/stores/template-categories.js +0 -91
- package/dist/utils/arrayUtil.d.ts +0 -1
- package/dist/utils/arrayUtil.js +0 -10
- package/dist/utils/base64.d.ts +0 -2
- package/dist/utils/base64.js +0 -14
- package/dist/utils/generic.d.ts +0 -1
- package/dist/utils/generic.js +0 -7
- package/dist/utils/genericUtil.d.ts +0 -2
- package/dist/utils/genericUtil.js +0 -7
- package/dist/utils/htmlCompiler.d.ts +0 -12
- package/dist/utils/htmlCompiler.js +0 -70
- package/dist/utils/textUtil.d.ts +0 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from "./LeftSlot.vue2.js";
|
|
2
2
|
import o from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
return
|
|
3
|
+
var n = function() {
|
|
4
|
+
var t = this, e = t._self._c, s = t._self._setupProxy;
|
|
5
|
+
return e("div", { staticClass: "d-f a-i-c" }, [e(s.InButtonV2, { staticClass: "p-2", attrs: { id: "guido__back-button", "label-text": "Back", "left-icon": "line-arrow-left", styling: "text", type: "secondary" } }), s.editorStore.isVersionHistoryOpen ? e(s.RestoreButton, { staticClass: "ml-3" }) : t._e()], 1);
|
|
6
6
|
}, a = [], i = /* @__PURE__ */ o(
|
|
7
|
-
n,
|
|
8
7
|
r,
|
|
8
|
+
n,
|
|
9
9
|
a,
|
|
10
10
|
!1,
|
|
11
11
|
null,
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
const c = /* @__PURE__ */ r({
|
|
1
|
+
import { defineComponent as t } from "vue";
|
|
2
|
+
import { useEditorStore as o } from "../../../stores/editor.js";
|
|
3
|
+
import { InButtonV2 as r } from "@useinsider/design-system-vue";
|
|
4
|
+
import e from "./version-history/RestoreButton.vue.js";
|
|
5
|
+
const _ = /* @__PURE__ */ t({
|
|
7
6
|
__name: "LeftSlot",
|
|
8
|
-
setup(
|
|
9
|
-
|
|
10
|
-
return { __sfc: !0, editorStore: o, handleBack: t, InButtonV2: n, RestoreButton: s };
|
|
7
|
+
setup(m) {
|
|
8
|
+
return { __sfc: !0, editorStore: o(), InButtonV2: r, RestoreButton: e };
|
|
11
9
|
}
|
|
12
10
|
});
|
|
13
11
|
export {
|
|
14
|
-
|
|
12
|
+
_ as default
|
|
15
13
|
};
|
|
@@ -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", "
|
|
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);
|
|
6
6
|
}, l = [], r = /* @__PURE__ */ i(
|
|
7
7
|
s,
|
|
8
8
|
n,
|
|
@@ -2,16 +2,16 @@ 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 }
|
|
6
|
-
},
|
|
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);
|
|
6
|
+
}, r = [], a = /* @__PURE__ */ i(
|
|
7
7
|
o,
|
|
8
8
|
n,
|
|
9
|
-
|
|
9
|
+
r,
|
|
10
10
|
!1,
|
|
11
11
|
null,
|
|
12
12
|
null
|
|
13
13
|
);
|
|
14
|
-
const
|
|
14
|
+
const c = a.exports;
|
|
15
15
|
export {
|
|
16
|
-
|
|
16
|
+
c as default
|
|
17
17
|
};
|
|
@@ -1,37 +1,21 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { InButtonV2 as S } from "@useinsider/design-system-vue";
|
|
8
|
-
const T = /* @__PURE__ */ m({
|
|
1
|
+
import { defineComponent as s } from "vue";
|
|
2
|
+
import { useExport as i } from "../../../composables/useExport.js";
|
|
3
|
+
import { useVersionHistoryApi as n } 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 d = /* @__PURE__ */ s({
|
|
9
7
|
__name: "RightSlot",
|
|
10
|
-
setup(
|
|
11
|
-
const { exportHtml:
|
|
12
|
-
return { __sfc: !0, exportHtml:
|
|
13
|
-
if (
|
|
14
|
-
|
|
8
|
+
setup(f) {
|
|
9
|
+
const { exportHtml: e } = i(), { openVersionHistory: o, closeVersionHistory: r } = n(), t = p();
|
|
10
|
+
return { __sfc: !0, exportHtml: e, openVersionHistory: o, closeVersionHistory: r, editorStore: t, handleVersionHistory: () => {
|
|
11
|
+
if (t.isVersionHistoryOpen) {
|
|
12
|
+
r();
|
|
15
13
|
return;
|
|
16
14
|
}
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
e.isSaveTemplateModalOpen = !0;
|
|
20
|
-
}, handleSave: async () => {
|
|
21
|
-
r();
|
|
22
|
-
try {
|
|
23
|
-
const { html: t } = await o();
|
|
24
|
-
s({
|
|
25
|
-
html: t || "",
|
|
26
|
-
css: ""
|
|
27
|
-
// CSS is embedded in HTML from Stripo
|
|
28
|
-
});
|
|
29
|
-
} catch (t) {
|
|
30
|
-
console.error("Failed to get template data for save:", t);
|
|
31
|
-
}
|
|
32
|
-
}, InButtonV2: S };
|
|
15
|
+
o();
|
|
16
|
+
}, InButtonV2: m };
|
|
33
17
|
}
|
|
34
18
|
});
|
|
35
19
|
export {
|
|
36
|
-
|
|
20
|
+
d as default
|
|
37
21
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { GetCompiledEmailOptions, CompiledEmailResult
|
|
1
|
+
import { GetCompiledEmailOptions, CompiledEmailResult } from '@@/Types/actions-api';
|
|
2
2
|
export declare const useActionsApi: () => {
|
|
3
3
|
getCompiledEmail: (options?: GetCompiledEmailOptions) => Promise<CompiledEmailResult>;
|
|
4
|
-
getRawTemplateData: () => Promise<TemplateDataResult>;
|
|
5
4
|
activateCustomViewStyles: (isActive?: boolean) => void;
|
|
6
5
|
};
|
|
@@ -1,49 +1,38 @@
|
|
|
1
|
-
const g = () => ({
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
getRawTemplateData: () => new Promise((t) => {
|
|
37
|
-
window.StripoEditorApi.actionsApi.getTemplateData(
|
|
38
|
-
(e) => {
|
|
39
|
-
t(e);
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
}),
|
|
43
|
-
activateCustomViewStyles: (t = !0) => {
|
|
44
|
-
window.StripoEditorApi.actionsApi.activateCustomViewStyles(t);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
1
|
+
const g = () => ({ getCompiledEmail: (t = {}) => new Promise((i, a) => {
|
|
2
|
+
const s = { ...{
|
|
3
|
+
minimize: !0,
|
|
4
|
+
utmEntity: {
|
|
5
|
+
utmSource: "",
|
|
6
|
+
utmMedium: "",
|
|
7
|
+
utmCampaign: "",
|
|
8
|
+
utmContent: "",
|
|
9
|
+
utmTerm: "",
|
|
10
|
+
customUtms: [
|
|
11
|
+
{
|
|
12
|
+
name1: "val1",
|
|
13
|
+
name2: "val2"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
mergeTags: ["Tag1", "Tag2"],
|
|
18
|
+
forseAmp: !1,
|
|
19
|
+
resetDataSavedFlag: !1,
|
|
20
|
+
disableLineHeightsReplace: !0
|
|
21
|
+
}, ...t }, o = {
|
|
22
|
+
callback: (e, m, l, n, c) => {
|
|
23
|
+
e ? a(e) : i({
|
|
24
|
+
html: m,
|
|
25
|
+
ampHtml: l,
|
|
26
|
+
ampErrors: n,
|
|
27
|
+
displayConditions: c
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
...s
|
|
31
|
+
};
|
|
32
|
+
window.StripoEditorApi.actionsApi.compileEmail(o);
|
|
33
|
+
}), activateCustomViewStyles: (t = !0) => {
|
|
34
|
+
window.StripoEditorApi.actionsApi.activateCustomViewStyles(t);
|
|
35
|
+
} });
|
|
47
36
|
export {
|
|
48
37
|
g as useActionsApi
|
|
49
38
|
};
|
|
@@ -1,45 +1,30 @@
|
|
|
1
1
|
import { useActionsApi as l } from "./useActionsApi.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return `${s}_${r}-${i}-${t}_${e}-${n}.html`;
|
|
2
|
+
import { useToaster as m } from "./useToaster.js";
|
|
3
|
+
const u = () => {
|
|
4
|
+
const a = (r, t, e) => {
|
|
5
|
+
const n = new Blob([r], { type: e }), s = URL.createObjectURL(n), o = document.createElement("a");
|
|
6
|
+
o.href = s, o.download = t, document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(s);
|
|
7
|
+
}, c = (r) => {
|
|
8
|
+
const t = /* @__PURE__ */ new Date(), e = String(t.getDate()).padStart(2, "0"), n = String(t.getMonth() + 1).padStart(2, "0"), s = t.getFullYear(), o = String(t.getHours()).padStart(2, "0"), i = String(t.getMinutes()).padStart(2, "0");
|
|
9
|
+
return `${r}_${e}-${n}-${s}_${o}-${i}.html`;
|
|
11
10
|
};
|
|
12
|
-
return { exportHtml: async (
|
|
13
|
-
const { getCompiledEmail:
|
|
11
|
+
return { exportHtml: async () => {
|
|
12
|
+
const { getCompiledEmail: r } = l(), { showToaster: t } = m();
|
|
14
13
|
try {
|
|
15
|
-
const { html:
|
|
16
|
-
|
|
17
|
-
let e = t;
|
|
18
|
-
if (s) {
|
|
19
|
-
const n = i(t);
|
|
20
|
-
e = n.compiledHtml, console.debug("HTML Compilation Stats:", {
|
|
21
|
-
originalSize: n.stats.originalSize,
|
|
22
|
-
compiledSize: n.stats.compiledSize,
|
|
23
|
-
reduction: `${n.stats.reductionPercentage.toFixed(2)}%`,
|
|
24
|
-
appliedRules: n.appliedRules,
|
|
25
|
-
executionTime: `${n.stats.executionTime.toFixed(2)}ms`
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
a(e, c("HTML"), "text/html");
|
|
29
|
-
} else
|
|
30
|
-
r({
|
|
31
|
-
type: "error",
|
|
32
|
-
message: "No HTML content to download"
|
|
33
|
-
});
|
|
34
|
-
} catch (t) {
|
|
35
|
-
const e = t instanceof Error ? t.message : String(t);
|
|
36
|
-
r({
|
|
14
|
+
const { html: e } = await r();
|
|
15
|
+
e ? a(e, c("HTML"), "text/html") : t({
|
|
37
16
|
type: "error",
|
|
38
|
-
message:
|
|
17
|
+
message: "No HTML content to download"
|
|
18
|
+
});
|
|
19
|
+
} catch (e) {
|
|
20
|
+
const n = e instanceof Error ? e.message : String(e);
|
|
21
|
+
t({
|
|
22
|
+
type: "error",
|
|
23
|
+
message: `Error compiling email: ${n}`
|
|
39
24
|
});
|
|
40
25
|
}
|
|
41
26
|
} };
|
|
42
27
|
};
|
|
43
28
|
export {
|
|
44
|
-
|
|
29
|
+
u as useExport
|
|
45
30
|
};
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { ref as p, computed as
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const h = p(!1), a = p(null), u = p(null), g = T(() => h.value), y = T(() => a.value !== null), v = {
|
|
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 = {
|
|
5
4
|
baseURL: "",
|
|
6
5
|
timeout: 1e4,
|
|
7
6
|
retry: 0,
|
|
8
7
|
retryDelay: 1e3,
|
|
9
8
|
headers: {
|
|
10
|
-
"Content-Type": "application/json"
|
|
11
|
-
"X-CSRF-TOKEN": H()
|
|
9
|
+
"Content-Type": "application/json"
|
|
12
10
|
},
|
|
13
|
-
...
|
|
11
|
+
...y
|
|
14
12
|
}, w = (e, s) => {
|
|
15
13
|
if (e.startsWith("http://") || e.startsWith("https://"))
|
|
16
14
|
return e;
|
|
17
|
-
const t = s ||
|
|
15
|
+
const t = s || T.baseURL || "";
|
|
18
16
|
return t.endsWith("/") && e.startsWith("/") ? `${t}${e.slice(1)}` : t.endsWith("/") || e.startsWith("/") ? `${t}${e}` : `${t}/${e}`;
|
|
19
17
|
}, P = (e) => new Promise((s, t) => {
|
|
20
18
|
setTimeout(() => {
|
|
@@ -24,20 +22,20 @@ const k = (b = {}) => {
|
|
|
24
22
|
setTimeout(s, e);
|
|
25
23
|
}), i = async (e, s, t, D = {}) => {
|
|
26
24
|
a.value = null, h.value = !0, u.value = new AbortController();
|
|
27
|
-
const n = { ...
|
|
25
|
+
const n = { ...T, ...D }, L = w(s, n.baseURL), c = {
|
|
28
26
|
method: e,
|
|
29
27
|
headers: { ...n.headers },
|
|
30
28
|
signal: u.value.signal,
|
|
31
29
|
...n
|
|
32
30
|
};
|
|
33
31
|
t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete c.headers["Content-Type"], c.body = t) : c.body = JSON.stringify(t));
|
|
34
|
-
const
|
|
32
|
+
const b = async (m = 0) => {
|
|
35
33
|
try {
|
|
36
34
|
const o = [fetch(L, c)];
|
|
37
35
|
n.timeout && o.push(P(n.timeout));
|
|
38
36
|
const r = await Promise.race(o);
|
|
39
37
|
if (!r.ok) {
|
|
40
|
-
const
|
|
38
|
+
const H = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(H);
|
|
41
39
|
throw d.status = r.status, d.statusText = r.statusText, d.response = r, d;
|
|
42
40
|
}
|
|
43
41
|
let f;
|
|
@@ -51,36 +49,36 @@ const k = (b = {}) => {
|
|
|
51
49
|
} catch (o) {
|
|
52
50
|
const r = o instanceof Error && o.name === "AbortError";
|
|
53
51
|
if (m < (n.retry || 0) && !r)
|
|
54
|
-
return await x(n.retryDelay || 1e3),
|
|
52
|
+
return await x(n.retryDelay || 1e3), b(m + 1);
|
|
55
53
|
throw o instanceof Error ? o.name === "AbortError" ? a.value = { message: "Request was cancelled" } : a.value = { message: o.message } : a.value = o, o;
|
|
56
54
|
}
|
|
57
55
|
};
|
|
58
56
|
try {
|
|
59
|
-
return await
|
|
57
|
+
return await b();
|
|
60
58
|
} finally {
|
|
61
59
|
h.value = !1, u.value = null;
|
|
62
60
|
}
|
|
63
|
-
},
|
|
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) => {
|
|
64
62
|
u.value && u.value.abort(e);
|
|
65
63
|
}, q = () => {
|
|
66
64
|
a.value = null;
|
|
67
65
|
};
|
|
68
66
|
return {
|
|
69
67
|
// State
|
|
70
|
-
loading:
|
|
71
|
-
error:
|
|
72
|
-
hasError:
|
|
68
|
+
loading: E,
|
|
69
|
+
error: v(() => a.value),
|
|
70
|
+
hasError: g,
|
|
73
71
|
// Methods
|
|
74
72
|
request: i,
|
|
75
|
-
get:
|
|
76
|
-
post:
|
|
77
|
-
put:
|
|
78
|
-
patch:
|
|
79
|
-
delete:
|
|
73
|
+
get: $,
|
|
74
|
+
post: C,
|
|
75
|
+
put: U,
|
|
76
|
+
patch: A,
|
|
77
|
+
delete: R,
|
|
80
78
|
cancel: W,
|
|
81
79
|
clearError: q
|
|
82
80
|
};
|
|
83
81
|
};
|
|
84
82
|
export {
|
|
85
|
-
|
|
83
|
+
j as useHttp
|
|
86
84
|
};
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useCustomInterfaceAppearance as
|
|
3
|
-
import { useToaster as
|
|
4
|
-
import { displayConditions as
|
|
5
|
-
import
|
|
6
|
-
import { useStripoApi as
|
|
7
|
-
import { useEditorStore as
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const i = w(), { html: t, css: s, forceRecreate: p } = e;
|
|
1
|
+
import { useActionsApi as m } from "./useActionsApi.js";
|
|
2
|
+
import { useCustomInterfaceAppearance as g } from "./useCustomInterfaceAppearance.js";
|
|
3
|
+
import { useToaster as f } from "./useToaster.js";
|
|
4
|
+
import { displayConditions as E } from "../enums/displayConditions.js";
|
|
5
|
+
import S from "../extensions/DynamicContent/extension.js";
|
|
6
|
+
import { useStripoApi as w } from "../services/stripoApi.js";
|
|
7
|
+
import { useEditorStore as y } from "../stores/editor.js";
|
|
8
|
+
const x = (a) => {
|
|
9
|
+
const { handleError: d } = f(), { getToken: c, getCustomFonts: u } = w(), p = (e, r = []) => {
|
|
10
|
+
const i = y(), { html: t, css: s } = e;
|
|
12
11
|
window.UIEditor.initEditor(
|
|
13
12
|
document.querySelector("#guido-editor"),
|
|
14
13
|
{
|
|
15
|
-
metadata:
|
|
14
|
+
metadata: a,
|
|
16
15
|
html: t,
|
|
17
16
|
css: s,
|
|
18
|
-
forceRecreate: p,
|
|
19
17
|
locale: "en",
|
|
20
18
|
undoButtonSelector: "#guido__undo-button",
|
|
21
19
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -31,32 +29,27 @@ const M = (d) => {
|
|
|
31
29
|
`,
|
|
32
30
|
conditionsEnabled: !0,
|
|
33
31
|
customConditionsEnabled: !0,
|
|
34
|
-
conditionCategories:
|
|
32
|
+
conditionCategories: E,
|
|
35
33
|
messageSettingsEnabled: !1,
|
|
36
34
|
editorFonts: {
|
|
37
35
|
showDefaultStandardFonts: !0,
|
|
38
36
|
showDefaultNotStandardFonts: !0,
|
|
39
37
|
customFonts: r
|
|
40
38
|
},
|
|
41
|
-
mergeTags: [
|
|
42
|
-
{
|
|
43
|
-
entries: b(d.preselectedDynamicContentList)
|
|
44
|
-
}
|
|
45
|
-
],
|
|
46
39
|
async onTokenRefreshRequest(o) {
|
|
47
40
|
try {
|
|
48
|
-
const n = await
|
|
41
|
+
const n = await c();
|
|
49
42
|
o(n);
|
|
50
43
|
} catch (n) {
|
|
51
|
-
|
|
44
|
+
d(n, "Failed to refresh token");
|
|
52
45
|
}
|
|
53
46
|
},
|
|
54
47
|
onTemplateLoaded() {
|
|
55
48
|
try {
|
|
56
|
-
const { importCss: o } =
|
|
49
|
+
const { importCss: o } = g(), { activateCustomViewStyles: n } = m();
|
|
57
50
|
o(), n();
|
|
58
51
|
} catch (o) {
|
|
59
|
-
|
|
52
|
+
d(o, "Failed to load custom interface appearance");
|
|
60
53
|
}
|
|
61
54
|
},
|
|
62
55
|
onCodeEditorVisibilityChanged(o) {
|
|
@@ -68,11 +61,12 @@ const M = (d) => {
|
|
|
68
61
|
onVersionHistoryVisibilityChanged(o) {
|
|
69
62
|
i.isVersionHistoryOpen = o;
|
|
70
63
|
},
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
// TODO: It might be needed to ignore click outside selectors for the dynamic content extension
|
|
65
|
+
// ignoreClickOutsideSelectors: ['#externalMergeTags'],
|
|
66
|
+
extensions: [S]
|
|
73
67
|
}
|
|
74
68
|
);
|
|
75
|
-
},
|
|
69
|
+
}, l = (e) => new Promise((r, i) => {
|
|
76
70
|
if (document.getElementById("UiEditorScript")) {
|
|
77
71
|
e(), r();
|
|
78
72
|
return;
|
|
@@ -86,12 +80,12 @@ const M = (d) => {
|
|
|
86
80
|
}, document.body.appendChild(t);
|
|
87
81
|
});
|
|
88
82
|
return { initPlugin: async (e) => {
|
|
89
|
-
await
|
|
83
|
+
await l(async () => {
|
|
90
84
|
const r = await u();
|
|
91
|
-
|
|
85
|
+
p(e, r);
|
|
92
86
|
});
|
|
93
87
|
} };
|
|
94
88
|
};
|
|
95
89
|
export {
|
|
96
|
-
|
|
90
|
+
x as useStripo
|
|
97
91
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const s = () => {
|
|
2
|
+
const t = async () => {
|
|
3
|
+
const [e, a] = await Promise.all([
|
|
4
|
+
// eslint-disable-next-line import/extensions
|
|
5
|
+
import("../static/templates/default/index.html.js"),
|
|
6
|
+
import("../static/templates/default/style.css.js")
|
|
7
|
+
]);
|
|
8
|
+
return {
|
|
9
|
+
html: e.default,
|
|
10
|
+
css: a.default
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
getDefaultTemplate: t,
|
|
15
|
+
getTemplate: async (e) => {
|
|
16
|
+
switch (e) {
|
|
17
|
+
case "default":
|
|
18
|
+
return t();
|
|
19
|
+
default:
|
|
20
|
+
return t();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
s as useTemplates
|
|
27
|
+
};
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import type { DynamicContent } from '@@/Types/generic';
|
|
2
1
|
export declare class ExternalMergeTagsLibrary {
|
|
3
|
-
selectedDynamicContent:
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
selectedDynamicContent: {
|
|
3
|
+
value: string;
|
|
4
|
+
} | null;
|
|
5
|
+
dataSelectCallback: (data: Record<string, string>) => void;
|
|
6
|
+
activeCategory: string;
|
|
7
|
+
/**
|
|
8
|
+
* Handles click events on tag cards
|
|
9
|
+
* @param e - Click event
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Opens the merge tags library modal
|
|
13
|
+
* @param mergeTag - Currently selected merge tag value (if any)
|
|
14
|
+
* @param onDataSelectCallback - Callback when tag is selected
|
|
15
|
+
*/
|
|
16
|
+
openMergeTagsLibrary(dynamicContent: {
|
|
17
|
+
value: string;
|
|
18
|
+
label: string;
|
|
19
|
+
}, onDataSelectCallback: (data: Record<string, string>) => void): void;
|
|
6
20
|
}
|
|
@@ -1,23 +1,48 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var a = (
|
|
1
|
+
var d = Object.defineProperty;
|
|
2
|
+
var r = (e, t, n) => t in e ? d(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var a = (e, t, n) => r(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
class y {
|
|
5
5
|
constructor() {
|
|
6
6
|
a(this, "selectedDynamicContent", null);
|
|
7
7
|
a(this, "dataSelectCallback", () => {
|
|
8
8
|
});
|
|
9
|
+
a(this, "activeCategory", "all");
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Handles click events on tag cards
|
|
13
|
+
* @param e - Click event
|
|
14
|
+
*/
|
|
15
|
+
// onTagClick (e) {
|
|
16
|
+
// // Check if clicked on tag card or any of its children
|
|
17
|
+
// const tagCard = e.target.closest('.tag-card');
|
|
18
|
+
// if (!tagCard) {
|
|
19
|
+
// return;
|
|
20
|
+
// }
|
|
21
|
+
// // Create callback object with tag data
|
|
22
|
+
// const tagData = {
|
|
23
|
+
// value: tagCard.getAttribute('data-value'),
|
|
24
|
+
// label: tagCard.getAttribute('data-label'),
|
|
25
|
+
// };
|
|
26
|
+
// // Close modal and execute callback
|
|
27
|
+
// this.close();
|
|
28
|
+
// this.dataSelectCallback(tagData);
|
|
29
|
+
// }
|
|
30
|
+
/**
|
|
31
|
+
* Opens the merge tags library modal
|
|
32
|
+
* @param mergeTag - Currently selected merge tag value (if any)
|
|
33
|
+
* @param onDataSelectCallback - Callback when tag is selected
|
|
34
|
+
*/
|
|
35
|
+
openMergeTagsLibrary(t, n) {
|
|
36
|
+
this.dataSelectCallback = n, this.selectedDynamicContent = t;
|
|
37
|
+
const l = new CustomEvent("dynamic-content:open", {
|
|
13
38
|
detail: {
|
|
14
|
-
attribute:
|
|
39
|
+
attribute: t
|
|
15
40
|
}
|
|
16
41
|
});
|
|
17
|
-
document.dispatchEvent(
|
|
18
|
-
const o = (
|
|
19
|
-
const c =
|
|
20
|
-
|
|
42
|
+
document.dispatchEvent(l);
|
|
43
|
+
const o = (i) => {
|
|
44
|
+
const c = i.detail, s = c == null ? void 0 : c.attribute;
|
|
45
|
+
s && this.dataSelectCallback(s), document.removeEventListener("dynamic-content:close", o);
|
|
21
46
|
};
|
|
22
47
|
document.addEventListener("dynamic-content:close", o);
|
|
23
48
|
}
|
|
@@ -6,7 +6,7 @@ export declare class DynamicContentUiElementExtension extends UIElement {
|
|
|
6
6
|
private mergeTagsButton;
|
|
7
7
|
private listener;
|
|
8
8
|
private mergeTagsLibrary;
|
|
9
|
-
private
|
|
9
|
+
private selectedMergeTag;
|
|
10
10
|
getId(): string;
|
|
11
11
|
onRender(container: HTMLElement): void;
|
|
12
12
|
onDestroy(): void;
|