@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.
Files changed (66) hide show
  1. package/README.md +24 -384
  2. package/dist/@types/generic.d.ts +0 -12
  3. package/dist/components/Guido.vue.d.ts +7 -16
  4. package/dist/components/Guido.vue.js +8 -8
  5. package/dist/components/Guido.vue2.js +33 -78
  6. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  7. package/dist/components/organisms/header/LeftSlot.vue2.js +8 -10
  8. package/dist/components/organisms/header/MiddleSlot.vue.js +1 -1
  9. package/dist/components/organisms/header/RightSlot.vue.js +5 -5
  10. package/dist/components/organisms/header/RightSlot.vue2.js +14 -30
  11. package/dist/composables/useActionsApi.d.ts +1 -2
  12. package/dist/composables/useActionsApi.js +35 -46
  13. package/dist/composables/useExport.d.ts +1 -1
  14. package/dist/composables/useExport.js +20 -35
  15. package/dist/composables/useHttp.js +21 -23
  16. package/dist/composables/useStripo.js +23 -29
  17. package/dist/composables/useTemplates.d.ts +5 -0
  18. package/dist/composables/useTemplates.js +27 -0
  19. package/dist/extensions/DynamicContent/dynamic-content-modal.d.ts +18 -4
  20. package/dist/extensions/DynamicContent/dynamic-content-modal.js +36 -11
  21. package/dist/extensions/DynamicContent/dynamic-content.d.ts +1 -1
  22. package/dist/extensions/DynamicContent/dynamic-content.js +15 -16
  23. package/dist/guido.css +1 -1
  24. package/dist/services/stripoApi.d.ts +1 -2
  25. package/dist/services/stripoApi.js +7 -27
  26. package/dist/static/templates/default/index.html.js +5 -0
  27. package/dist/static/templates/default/style.css.js +119 -0
  28. package/dist/stores/editor.d.ts +0 -1
  29. package/dist/stores/editor.js +1 -2
  30. package/package.json +4 -2
  31. package/dist/components/organisms/save-template/SaveTemplateModal.vue.d.ts +0 -16
  32. package/dist/components/organisms/save-template/SaveTemplateModal.vue.js +0 -20
  33. package/dist/components/organisms/save-template/SaveTemplateModal.vue2.js +0 -78
  34. package/dist/components/wrappers/ModalWrapper.vue.d.ts +0 -72
  35. package/dist/components/wrappers/ModalWrapper.vue.js +0 -19
  36. package/dist/components/wrappers/ModalWrapper.vue2.js +0 -43
  37. package/dist/composables/useGuidoActions.d.ts +0 -46
  38. package/dist/composables/useGuidoActions.js +0 -37
  39. package/dist/composables/useHtmlCompiler.d.ts +0 -4
  40. package/dist/composables/useHtmlCompiler.js +0 -16
  41. package/dist/composables/useProvideInject.d.ts +0 -14
  42. package/dist/composables/useProvideInject.js +0 -17
  43. package/dist/composables/useSaveAsTemplate.d.ts +0 -7
  44. package/dist/composables/useSaveAsTemplate.js +0 -52
  45. package/dist/composables/useTemplateNameValidation.d.ts +0 -7
  46. package/dist/composables/useTemplateNameValidation.js +0 -33
  47. package/dist/config/compiler/htmlCompilerRules.d.ts +0 -2
  48. package/dist/config/compiler/htmlCompilerRules.js +0 -145
  49. package/dist/config/compiler/outlookCompilerRules.d.ts +0 -0
  50. package/dist/mock/api/default-template.d.ts +0 -2
  51. package/dist/mock/api/template-library.d.ts +0 -2
  52. package/dist/stores/dynamic-content.d.ts +0 -27
  53. package/dist/stores/dynamic-content.js +0 -23
  54. package/dist/stores/template-categories.d.ts +0 -41
  55. package/dist/stores/template-categories.js +0 -91
  56. package/dist/utils/arrayUtil.d.ts +0 -1
  57. package/dist/utils/arrayUtil.js +0 -10
  58. package/dist/utils/base64.d.ts +0 -2
  59. package/dist/utils/base64.js +0 -14
  60. package/dist/utils/generic.d.ts +0 -1
  61. package/dist/utils/generic.js +0 -7
  62. package/dist/utils/genericUtil.d.ts +0 -2
  63. package/dist/utils/genericUtil.js +0 -7
  64. package/dist/utils/htmlCompiler.d.ts +0 -12
  65. package/dist/utils/htmlCompiler.js +0 -70
  66. package/dist/utils/textUtil.d.ts +0 -2
@@ -1,11 +1,11 @@
1
- import n from "./LeftSlot.vue2.js";
1
+ import r from "./LeftSlot.vue2.js";
2
2
  import o from "../../../_virtual/_plugin-vue2_normalizer.js";
3
- var r = function() {
4
- var e = this, s = e._self._c, t = e._self._setupProxy;
5
- return s("div", { staticClass: "d-f a-i-c" }, [s(t.InButtonV2, { staticClass: "p-2", attrs: { id: "guido__back-button", "label-text": "Back", "left-icon": "line-arrow-left", styling: "text", type: "secondary" }, on: { click: t.handleBack } }), t.editorStore.isVersionHistoryOpen ? s(t.RestoreButton, { staticClass: "ml-3" }) : e._e()], 1);
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 r } from "vue";
2
- import { useBack as e } from "../../../composables/useGuidoActions.js";
3
- import { useEditorStore as m } from "../../../stores/editor.js";
4
- import { InButtonV2 as n } from "@useinsider/design-system-vue";
5
- import s from "./version-history/RestoreButton.vue.js";
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(f) {
9
- const o = m(), t = e();
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
- c as default
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", "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);
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 }, 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 }, on: { click: t.handleSave } })], 1);
6
- }, a = [], r = /* @__PURE__ */ i(
5
+ return e("div", { staticClass: "d-f" }, [e(t.InButtonV2, { attrs: { id: "guido__history-button", "left-icon": "line-architect-version-history", styling: "ghost", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isVersionHistoryOpen }, on: { click: t.handleVersionHistory } }), e(t.InButtonV2, { attrs: { id: "guido__export-button", "left-icon": "line-export", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1 }, on: { click: t.exportHtml } }), e(t.InButtonV2, { attrs: { id: "guido__save-as-button", "left-icon": "line-newsletter-save-as-template", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1 } }), 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
- a,
9
+ r,
10
10
  !1,
11
11
  null,
12
12
  null
13
13
  );
14
- const u = r.exports;
14
+ const c = a.exports;
15
15
  export {
16
- u as default
16
+ c as default
17
17
  };
@@ -1,37 +1,21 @@
1
- import { defineComponent as m } from "vue";
2
- import { useActionsApi as p } from "../../../composables/useActionsApi.js";
3
- import { useExport as l } from "../../../composables/useExport.js";
4
- import { useSaveStart as c, useSaveComplete as d } from "../../../composables/useGuidoActions.js";
5
- import { useVersionHistoryApi as f } from "../../../composables/useVersionHistoryApi.js";
6
- import { useEditorStore as u } from "../../../stores/editor.js";
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(h) {
11
- const { exportHtml: i } = l(), { getCompiledEmail: o } = p(), r = c(), s = d(), { openVersionHistory: n, closeVersionHistory: a } = f(), e = u();
12
- return { __sfc: !0, exportHtml: i, getCompiledEmail: o, saveStart: r, saveComplete: s, openVersionHistory: n, closeVersionHistory: a, editorStore: e, handleVersionHistory: () => {
13
- if (e.isVersionHistoryOpen) {
14
- a();
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
- n();
18
- }, handleSaveAsTemplate: async () => {
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
- T as default
20
+ d as default
37
21
  };
@@ -1,6 +1,5 @@
1
- import { GetCompiledEmailOptions, CompiledEmailResult, TemplateDataResult } from '@@/Types/actions-api';
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
- getCompiledEmail: (t = {}) => new Promise((e, i) => {
3
- const o = {
4
- ...{ ...{
5
- minimize: !1,
6
- // TODO: Need to align Stripo Team
7
- utmEntity: {
8
- utmSource: "",
9
- utmMedium: "",
10
- utmCampaign: "",
11
- utmContent: "",
12
- utmTerm: "",
13
- customUtms: [
14
- {
15
- name1: "val1",
16
- name2: "val2"
17
- }
18
- ]
19
- },
20
- mergeTags: ["Tag1", "Tag2"],
21
- forseAmp: !1,
22
- resetDataSavedFlag: !1,
23
- disableLineHeightsReplace: !0
24
- }, ...t },
25
- callback: (a, s, m, n, l) => {
26
- a ? i(a) : e({
27
- html: s,
28
- ampHtml: m,
29
- ampErrors: n,
30
- displayConditions: l
31
- });
32
- }
33
- };
34
- window.StripoEditorApi.actionsApi.compileEmail(o);
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,3 +1,3 @@
1
1
  export declare const useExport: () => {
2
- exportHtml: (compile?: boolean) => Promise<void>;
2
+ exportHtml: () => Promise<void>;
3
3
  };
@@ -1,45 +1,30 @@
1
1
  import { useActionsApi as l } from "./useActionsApi.js";
2
- import { useHtmlCompiler as m } from "./useHtmlCompiler.js";
3
- import { useToaster as d } from "./useToaster.js";
4
- const h = () => {
5
- const a = (s, o, r) => {
6
- const i = new Blob([s], { type: r }), t = URL.createObjectURL(i), e = document.createElement("a");
7
- e.href = t, e.download = o, document.body.appendChild(e), e.click(), document.body.removeChild(e), URL.revokeObjectURL(t);
8
- }, c = (s) => {
9
- const o = /* @__PURE__ */ new Date(), r = String(o.getDate()).padStart(2, "0"), i = String(o.getMonth() + 1).padStart(2, "0"), t = o.getFullYear(), e = String(o.getHours()).padStart(2, "0"), n = String(o.getMinutes()).padStart(2, "0");
10
- return `${s}_${r}-${i}-${t}_${e}-${n}.html`;
2
+ import { useToaster as m } from "./useToaster.js";
3
+ const u = () => {
4
+ const a = (r, t, e) => {
5
+ const n = new Blob([r], { type: e }), s = URL.createObjectURL(n), o = document.createElement("a");
6
+ o.href = s, o.download = t, document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(s);
7
+ }, c = (r) => {
8
+ const t = /* @__PURE__ */ new Date(), e = String(t.getDate()).padStart(2, "0"), n = String(t.getMonth() + 1).padStart(2, "0"), s = t.getFullYear(), o = String(t.getHours()).padStart(2, "0"), i = String(t.getMinutes()).padStart(2, "0");
9
+ return `${r}_${e}-${n}-${s}_${o}-${i}.html`;
11
10
  };
12
- return { exportHtml: async (s = !0) => {
13
- const { getCompiledEmail: o } = l(), { showToaster: r } = d(), { compileHtml: i } = m();
11
+ return { exportHtml: async () => {
12
+ const { getCompiledEmail: r } = l(), { showToaster: t } = m();
14
13
  try {
15
- const { html: t } = await o();
16
- if (t) {
17
- let e = t;
18
- if (s) {
19
- const n = i(t);
20
- e = n.compiledHtml, console.debug("HTML Compilation Stats:", {
21
- originalSize: n.stats.originalSize,
22
- compiledSize: n.stats.compiledSize,
23
- reduction: `${n.stats.reductionPercentage.toFixed(2)}%`,
24
- appliedRules: n.appliedRules,
25
- executionTime: `${n.stats.executionTime.toFixed(2)}ms`
26
- });
27
- }
28
- a(e, c("HTML"), "text/html");
29
- } else
30
- r({
31
- type: "error",
32
- message: "No HTML content to download"
33
- });
34
- } catch (t) {
35
- const e = t instanceof Error ? t.message : String(t);
36
- r({
14
+ const { html: e } = await r();
15
+ e ? a(e, c("HTML"), "text/html") : t({
37
16
  type: "error",
38
- message: `Error compiling email: ${e}`
17
+ message: "No HTML content to download"
18
+ });
19
+ } catch (e) {
20
+ const n = e instanceof Error ? e.message : String(e);
21
+ t({
22
+ type: "error",
23
+ message: `Error compiling email: ${n}`
39
24
  });
40
25
  }
41
26
  } };
42
27
  };
43
28
  export {
44
- h as useExport
29
+ u as useExport
45
30
  };
@@ -1,20 +1,18 @@
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 = {
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
- ...b
11
+ ...y
14
12
  }, w = (e, s) => {
15
13
  if (e.startsWith("http://") || e.startsWith("https://"))
16
14
  return e;
17
- const t = s || v.baseURL || "";
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 = { ...v, ...D }, L = w(s, n.baseURL), c = {
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 E = async (m = 0) => {
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 O = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(O);
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), E(m + 1);
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 E();
57
+ return await b();
60
58
  } finally {
61
59
  h.value = !1, u.value = null;
62
60
  }
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) => {
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: g,
71
- error: T(() => a.value),
72
- hasError: y,
68
+ loading: E,
69
+ error: v(() => a.value),
70
+ hasError: g,
73
71
  // Methods
74
72
  request: i,
75
- get: C,
76
- post: $,
77
- put: R,
78
- patch: U,
79
- delete: A,
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
- k as useHttp
83
+ j as useHttp
86
84
  };
@@ -1,21 +1,19 @@
1
- import { useActionsApi as g } from "./useActionsApi.js";
2
- import { useCustomInterfaceAppearance as f } from "./useCustomInterfaceAppearance.js";
3
- import { useToaster as y } from "./useToaster.js";
4
- import { displayConditions as C } from "../enums/displayConditions.js";
5
- import E from "../extensions/DynamicContent/extension.js";
6
- import { useStripoApi as S } from "../services/stripoApi.js";
7
- import { useEditorStore as w } from "../stores/editor.js";
8
- import { dynamicContentToMergeTags as b } from "../utils/genericUtil.js";
9
- const M = (d) => {
10
- const { handleError: c } = y(), { getToken: a, getCustomFonts: u } = S(), l = (e, r = []) => {
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: d,
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: C,
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 a();
41
+ const n = await c();
49
42
  o(n);
50
43
  } catch (n) {
51
- c(n, "Failed to refresh token");
44
+ d(n, "Failed to refresh token");
52
45
  }
53
46
  },
54
47
  onTemplateLoaded() {
55
48
  try {
56
- const { importCss: o } = f(), { activateCustomViewStyles: n } = g();
49
+ const { importCss: o } = g(), { activateCustomViewStyles: n } = m();
57
50
  o(), n();
58
51
  } catch (o) {
59
- c(o, "Failed to load custom interface appearance");
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
- ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal"],
72
- extensions: [E]
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
- }, m = (e) => new Promise((r, i) => {
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 m(async () => {
83
+ await l(async () => {
90
84
  const r = await u();
91
- l(e, r);
85
+ p(e, r);
92
86
  });
93
87
  } };
94
88
  };
95
89
  export {
96
- M as useStripo
90
+ x as useStripo
97
91
  };
@@ -0,0 +1,5 @@
1
+ import type { Template } from '@@/Types/stripo';
2
+ export declare const useTemplates: () => {
3
+ getDefaultTemplate: () => Promise<Template>;
4
+ getTemplate: (templateName: string) => Promise<Template>;
5
+ };
@@ -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: DynamicContent | null;
4
- dataSelectCallback: (data: DynamicContent) => void;
5
- openMergeTagsLibrary(dynamicContent: DynamicContent, onDataSelectCallback: (data: DynamicContent) => void): void;
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 i = Object.defineProperty;
2
- var d = (t, e, n) => e in t ? i(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var a = (t, e, n) => d(t, typeof e != "symbol" ? e + "" : e, n);
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
- openMergeTagsLibrary(e, n) {
11
- this.dataSelectCallback = n, this.selectedDynamicContent = e;
12
- const s = new CustomEvent("dynamic-content:open", {
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: e
39
+ attribute: t
15
40
  }
16
41
  });
17
- document.dispatchEvent(s);
18
- const o = (l) => {
19
- const c = l.detail;
20
- this.selectedDynamicContent = c, c.text && c.value && this.dataSelectCallback(c), document.removeEventListener("dynamic-content:close", o);
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 selectedDynamicContent;
9
+ private selectedMergeTag;
10
10
  getId(): string;
11
11
  onRender(container: HTMLElement): void;
12
12
  onDestroy(): void;