@useinsider/guido 1.0.0-beta.02a8faf

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 (117) hide show
  1. package/README.md +217 -0
  2. package/dist/@types/events.d.ts +1 -0
  3. package/dist/@types/generic.d.ts +13 -0
  4. package/dist/App.vue.d.ts +3 -0
  5. package/dist/_virtual/_plugin-vue2_normalizer.js +10 -0
  6. package/dist/components/Guido.vue.d.ts +20 -0
  7. package/dist/components/Guido.vue.js +18 -0
  8. package/dist/components/Guido.vue2.js +43 -0
  9. package/dist/components/organisms/header/HeaderWrapper.vue.d.ts +2 -0
  10. package/dist/components/organisms/header/HeaderWrapper.vue.js +17 -0
  11. package/dist/components/organisms/header/HeaderWrapper.vue2.js +14 -0
  12. package/dist/components/organisms/header/LeftSlot.vue.d.ts +2 -0
  13. package/dist/components/organisms/header/LeftSlot.vue.js +17 -0
  14. package/dist/components/organisms/header/LeftSlot.vue2.js +11 -0
  15. package/dist/components/organisms/header/MiddleSlot.vue.d.ts +2 -0
  16. package/dist/components/organisms/header/MiddleSlot.vue.js +17 -0
  17. package/dist/components/organisms/header/MiddleSlot.vue2.js +20 -0
  18. package/dist/components/organisms/header/RightSlot.vue.d.ts +2 -0
  19. package/dist/components/organisms/header/RightSlot.vue.js +20 -0
  20. package/dist/components/organisms/header/RightSlot.vue2.js +24 -0
  21. package/dist/components/organisms/header/ViewOptions.vue.d.ts +2 -0
  22. package/dist/components/organisms/header/ViewOptions.vue.js +18 -0
  23. package/dist/components/organisms/header/ViewOptions.vue2.js +15 -0
  24. package/dist/components/organisms/header/version-history/VersionHistory.vue.d.ts +2 -0
  25. package/dist/components/organisms/header/version-history/VersionHistory.vue.js +22 -0
  26. package/dist/components/organisms/header/version-history/VersionHistory.vue2.js +15 -0
  27. package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.d.ts +16 -0
  28. package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.js +18 -0
  29. package/dist/components/organisms/header/version-history/VersionHistoryItem.vue2.js +16 -0
  30. package/dist/components/organisms/header/version-history/ViewOptions.vue.d.ts +2 -0
  31. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +18 -0
  32. package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +23 -0
  33. package/dist/composables/useActionsApi.d.ts +4 -0
  34. package/dist/composables/useActionsApi.js +36 -0
  35. package/dist/composables/useApiExample.d.ts +61 -0
  36. package/dist/composables/useCustomInterfaceAppearance.d.ts +3 -0
  37. package/dist/composables/useCustomInterfaceAppearance.js +13 -0
  38. package/dist/composables/useExport.d.ts +3 -0
  39. package/dist/composables/useExport.js +30 -0
  40. package/dist/composables/useHttp.d.ts +78 -0
  41. package/dist/composables/useHttp.js +84 -0
  42. package/dist/composables/usePartner.d.ts +4 -0
  43. package/dist/composables/usePartner.js +16 -0
  44. package/dist/composables/useStripo.d.ts +4 -0
  45. package/dist/composables/useStripo.js +74 -0
  46. package/dist/composables/useTemplates.d.ts +5 -0
  47. package/dist/composables/useTemplates.js +27 -0
  48. package/dist/composables/useToaster.d.ts +21 -0
  49. package/dist/composables/useToaster.js +37 -0
  50. package/dist/composables/useTranslations.d.ts +5 -0
  51. package/dist/composables/useTranslations.js +18 -0
  52. package/dist/composables/useVersionHistoryApi.d.ts +8 -0
  53. package/dist/composables/useVersionHistoryApi.js +53 -0
  54. package/dist/enums/defaults.d.ts +4 -0
  55. package/dist/enums/defaults.js +8 -0
  56. package/dist/guido.css +1 -0
  57. package/dist/guido.png +0 -0
  58. package/dist/library.d.ts +3 -0
  59. package/dist/library.js +4 -0
  60. package/dist/main.d.ts +1 -0
  61. package/dist/mock/api/auth.d.ts +2 -0
  62. package/dist/mock/api/custom-fonts.d.ts +2 -0
  63. package/dist/mock/browser.d.ts +1 -0
  64. package/dist/mock/handlers.d.ts +1 -0
  65. package/dist/mockServiceWorker.js +344 -0
  66. package/dist/node_modules/lodash-es/_Hash.js +20 -0
  67. package/dist/node_modules/lodash-es/_ListCache.js +20 -0
  68. package/dist/node_modules/lodash-es/_Map.js +6 -0
  69. package/dist/node_modules/lodash-es/_MapCache.js +20 -0
  70. package/dist/node_modules/lodash-es/_Symbol.js +5 -0
  71. package/dist/node_modules/lodash-es/_assocIndexOf.js +10 -0
  72. package/dist/node_modules/lodash-es/_baseGetTag.js +10 -0
  73. package/dist/node_modules/lodash-es/_baseIsNative.js +16 -0
  74. package/dist/node_modules/lodash-es/_coreJsData.js +5 -0
  75. package/dist/node_modules/lodash-es/_freeGlobal.js +4 -0
  76. package/dist/node_modules/lodash-es/_getMapData.js +8 -0
  77. package/dist/node_modules/lodash-es/_getNative.js +9 -0
  78. package/dist/node_modules/lodash-es/_getRawTag.js +15 -0
  79. package/dist/node_modules/lodash-es/_getValue.js +6 -0
  80. package/dist/node_modules/lodash-es/_hashClear.js +7 -0
  81. package/dist/node_modules/lodash-es/_hashDelete.js +7 -0
  82. package/dist/node_modules/lodash-es/_hashGet.js +13 -0
  83. package/dist/node_modules/lodash-es/_hashHas.js +9 -0
  84. package/dist/node_modules/lodash-es/_hashSet.js +9 -0
  85. package/dist/node_modules/lodash-es/_isKeyable.js +7 -0
  86. package/dist/node_modules/lodash-es/_isMasked.js +11 -0
  87. package/dist/node_modules/lodash-es/_listCacheClear.js +6 -0
  88. package/dist/node_modules/lodash-es/_listCacheDelete.js +12 -0
  89. package/dist/node_modules/lodash-es/_listCacheGet.js +8 -0
  90. package/dist/node_modules/lodash-es/_listCacheHas.js +7 -0
  91. package/dist/node_modules/lodash-es/_listCacheSet.js +8 -0
  92. package/dist/node_modules/lodash-es/_mapCacheClear.js +13 -0
  93. package/dist/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  94. package/dist/node_modules/lodash-es/_mapCacheGet.js +7 -0
  95. package/dist/node_modules/lodash-es/_mapCacheHas.js +7 -0
  96. package/dist/node_modules/lodash-es/_mapCacheSet.js +8 -0
  97. package/dist/node_modules/lodash-es/_nativeCreate.js +5 -0
  98. package/dist/node_modules/lodash-es/_objectToString.js +7 -0
  99. package/dist/node_modules/lodash-es/_root.js +5 -0
  100. package/dist/node_modules/lodash-es/_toSource.js +17 -0
  101. package/dist/node_modules/lodash-es/eq.js +6 -0
  102. package/dist/node_modules/lodash-es/isFunction.js +12 -0
  103. package/dist/node_modules/lodash-es/isObject.js +7 -0
  104. package/dist/node_modules/lodash-es/memoize.js +18 -0
  105. package/dist/services/stripoApi.d.ts +7 -0
  106. package/dist/services/stripoApi.js +29 -0
  107. package/dist/sprite.svg +3133 -0
  108. package/dist/static/editor.css.js +232 -0
  109. package/dist/static/templates/default/index.html.js +5 -0
  110. package/dist/static/templates/default/style.css.js +119 -0
  111. package/dist/stores/editor.d.ts +5 -0
  112. package/dist/stores/editor.js +11 -0
  113. package/dist/stores/version-history.d.ts +80 -0
  114. package/dist/stores/version-history.js +28 -0
  115. package/dist/utils/dateUtil.d.ts +1 -0
  116. package/dist/utils/dateUtil.js +16 -0
  117. package/package.json +80 -0
@@ -0,0 +1,18 @@
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
+ };
@@ -0,0 +1,23 @@
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
+ };
@@ -0,0 +1,4 @@
1
+ import { GetCompiledEmailOptions, CompiledEmailResult } from '@@/Types/actions-api';
2
+ export declare const useActionsApi: () => {
3
+ getCompiledEmail: (options?: GetCompiledEmailOptions) => Promise<CompiledEmailResult>;
4
+ };
@@ -0,0 +1,36 @@
1
+ const d = () => ({ getCompiledEmail: (t = {}) => new Promise((a, i) => {
2
+ const m = { ...{
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 }, s = {
22
+ callback: (e, l, n, o, c) => {
23
+ e ? i(e) : a({
24
+ html: l,
25
+ ampHtml: n,
26
+ ampErrors: o,
27
+ displayConditions: c
28
+ });
29
+ },
30
+ ...m
31
+ };
32
+ window.StripoEditorApi.actionsApi.compileEmail(s);
33
+ }) });
34
+ export {
35
+ d as useActionsApi
36
+ };
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @deprecated - It's added for example purposes.
3
+ */
4
+ import type { User } from '../@types/generic';
5
+ export declare const useApiExample: () => {
6
+ loading: import("vue").ComputedRef<boolean>;
7
+ error: import("vue").ComputedRef<{
8
+ message: string;
9
+ status?: number | undefined;
10
+ statusText?: string | undefined;
11
+ response?: {
12
+ readonly headers: {
13
+ append: (name: string, value: string) => void;
14
+ delete: (name: string) => void;
15
+ get: (name: string) => string | null;
16
+ getSetCookie: () => string[];
17
+ has: (name: string) => boolean;
18
+ set: (name: string, value: string) => void;
19
+ forEach: (callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any) => void;
20
+ entries: () => IterableIterator<[string, string]>;
21
+ keys: () => IterableIterator<string>;
22
+ values: () => IterableIterator<string>;
23
+ [Symbol.iterator]: () => IterableIterator<[string, string]>;
24
+ };
25
+ readonly ok: boolean;
26
+ readonly redirected: boolean;
27
+ readonly status: number;
28
+ readonly statusText: string;
29
+ readonly type: ResponseType;
30
+ readonly url: string;
31
+ clone: () => Response;
32
+ readonly body: {
33
+ readonly locked: boolean;
34
+ cancel: (reason?: any) => Promise<void>;
35
+ getReader: {
36
+ (options: {
37
+ mode: "byob";
38
+ }): ReadableStreamBYOBReader;
39
+ (): ReadableStreamDefaultReader<Uint8Array>;
40
+ (options?: ReadableStreamGetReaderOptions): ReadableStreamReader<Uint8Array>;
41
+ };
42
+ pipeThrough: <T>(transform: ReadableWritablePair<T, Uint8Array>, options?: StreamPipeOptions) => ReadableStream<T>;
43
+ pipeTo: (destination: WritableStream<Uint8Array>, options?: StreamPipeOptions) => Promise<void>;
44
+ tee: () => [ReadableStream<Uint8Array>, ReadableStream<Uint8Array>];
45
+ } | null;
46
+ readonly bodyUsed: boolean;
47
+ arrayBuffer: () => Promise<ArrayBuffer>;
48
+ blob: () => Promise<Blob>;
49
+ formData: () => Promise<FormData>;
50
+ json: () => Promise<any>;
51
+ text: () => Promise<string>;
52
+ } | undefined;
53
+ } | null>;
54
+ hasError: import("vue").ComputedRef<boolean>;
55
+ fetchUsers: () => Promise<User[]>;
56
+ createUser: (userData: Omit<User, "id">) => Promise<User>;
57
+ updateUser: (id: number, userData: Partial<User>) => Promise<User>;
58
+ deleteUser: (id: number) => Promise<void>;
59
+ uploadFile: (file: File) => Promise<string>;
60
+ clearError: () => void;
61
+ };
@@ -0,0 +1,3 @@
1
+ export declare const useCustomInterfaceAppearance: () => {
2
+ importCss: () => void;
3
+ };
@@ -0,0 +1,13 @@
1
+ import r from "../static/editor.css.js";
2
+ const c = () => ({ importCss: () => {
3
+ const e = new CSSStyleSheet();
4
+ e.replaceSync(r);
5
+ const t = document.querySelector("ui-editor");
6
+ if (!t)
7
+ return;
8
+ const o = t.shadowRoot;
9
+ o && (o.adoptedStyleSheets = [e]);
10
+ } });
11
+ export {
12
+ c as useCustomInterfaceAppearance
13
+ };
@@ -0,0 +1,3 @@
1
+ export declare const useExport: () => {
2
+ exportHtml: () => Promise<void>;
3
+ };
@@ -0,0 +1,30 @@
1
+ import { useActionsApi as l } from "./useActionsApi.js";
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`;
10
+ };
11
+ return { exportHtml: async () => {
12
+ const { getCompiledEmail: r } = l(), { showToaster: t } = m();
13
+ try {
14
+ const { html: e } = await r();
15
+ e ? a(e, c("HTML"), "text/html") : t({
16
+ type: "error",
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}`
24
+ });
25
+ }
26
+ } };
27
+ };
28
+ export {
29
+ u as useExport
30
+ };
@@ -0,0 +1,78 @@
1
+ export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
2
+ export interface HttpOptions extends Omit<RequestInit, 'method' | 'body'> {
3
+ baseURL?: string;
4
+ timeout?: number;
5
+ retry?: number;
6
+ retryDelay?: number;
7
+ }
8
+ export interface HttpResponse<T = unknown> {
9
+ data: T;
10
+ status: number;
11
+ statusText: string;
12
+ headers: Headers;
13
+ }
14
+ export interface HttpError {
15
+ message: string;
16
+ status?: number;
17
+ statusText?: string;
18
+ response?: Response;
19
+ }
20
+ export declare const useHttp: (defaultOptions?: HttpOptions) => {
21
+ loading: import("vue").ComputedRef<boolean>;
22
+ error: import("vue").ComputedRef<{
23
+ message: string;
24
+ status?: number | undefined;
25
+ statusText?: string | undefined;
26
+ response?: {
27
+ readonly headers: {
28
+ append: (name: string, value: string) => void;
29
+ delete: (name: string) => void;
30
+ get: (name: string) => string | null;
31
+ getSetCookie: () => string[];
32
+ has: (name: string) => boolean;
33
+ set: (name: string, value: string) => void;
34
+ forEach: (callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any) => void;
35
+ entries: () => IterableIterator<[string, string]>;
36
+ keys: () => IterableIterator<string>;
37
+ values: () => IterableIterator<string>;
38
+ [Symbol.iterator]: () => IterableIterator<[string, string]>;
39
+ };
40
+ readonly ok: boolean;
41
+ readonly redirected: boolean;
42
+ readonly status: number;
43
+ readonly statusText: string;
44
+ readonly type: ResponseType;
45
+ readonly url: string;
46
+ clone: () => Response;
47
+ readonly body: {
48
+ readonly locked: boolean;
49
+ cancel: (reason?: any) => Promise<void>;
50
+ getReader: {
51
+ (options: {
52
+ mode: "byob";
53
+ }): ReadableStreamBYOBReader;
54
+ (): ReadableStreamDefaultReader<Uint8Array>;
55
+ (options?: ReadableStreamGetReaderOptions): ReadableStreamReader<Uint8Array>;
56
+ };
57
+ pipeThrough: <T>(transform: ReadableWritablePair<T, Uint8Array>, options?: StreamPipeOptions) => ReadableStream<T>;
58
+ pipeTo: (destination: WritableStream<Uint8Array>, options?: StreamPipeOptions) => Promise<void>;
59
+ tee: () => [ReadableStream<Uint8Array>, ReadableStream<Uint8Array>];
60
+ } | null;
61
+ readonly bodyUsed: boolean;
62
+ arrayBuffer: () => Promise<ArrayBuffer>;
63
+ blob: () => Promise<Blob>;
64
+ formData: () => Promise<FormData>;
65
+ json: () => Promise<any>;
66
+ text: () => Promise<string>;
67
+ } | undefined;
68
+ } | null>;
69
+ hasError: import("vue").ComputedRef<boolean>;
70
+ request: <T = unknown>(method: HttpMethod, url: string, data?: unknown, options?: HttpOptions) => Promise<HttpResponse<T>>;
71
+ get: <T = unknown>(url: string, options?: HttpOptions) => Promise<HttpResponse<T>>;
72
+ post: <T = unknown>(url: string, data?: unknown, options?: HttpOptions) => Promise<HttpResponse<T>>;
73
+ put: <T = unknown>(url: string, data?: unknown, options?: HttpOptions) => Promise<HttpResponse<T>>;
74
+ patch: <T = unknown>(url: string, data?: unknown, options?: HttpOptions) => Promise<HttpResponse<T>>;
75
+ delete: <T = unknown>(url: string, options?: HttpOptions) => Promise<HttpResponse<T>>;
76
+ cancel: (reason?: string) => void;
77
+ clearError: () => void;
78
+ };
@@ -0,0 +1,84 @@
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
+ };
@@ -0,0 +1,4 @@
1
+ export declare const usePartner: () => {
2
+ getPartnerName: () => string;
3
+ getProductType: () => string;
4
+ };
@@ -0,0 +1,16 @@
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
+ };
@@ -0,0 +1,4 @@
1
+ import type { Metadata, Template } from '@@/Types/stripo';
2
+ export declare const useStripo: (metadata: Metadata) => {
3
+ initPlugin: (template: Template) => Promise<void>;
4
+ };
@@ -0,0 +1,74 @@
1
+ import { useCustomInterfaceAppearance as m } from "./useCustomInterfaceAppearance.js";
2
+ import { useToaster as g } from "./useToaster.js";
3
+ import { useStripoApi as E } from "../services/stripoApi.js";
4
+ import { useEditorStore as S } from "../stores/editor.js";
5
+ const _ = (c) => {
6
+ const { handleError: d } = g(), { getToken: u, getCustomFonts: a } = E(), l = (e, i = []) => {
7
+ const r = S(), { html: t, css: n } = e;
8
+ window.UIEditor.initEditor(
9
+ document.querySelector("#guido-editor"),
10
+ {
11
+ metadata: c,
12
+ html: t,
13
+ css: n,
14
+ locale: "en",
15
+ undoButtonSelector: "#guido__undo-button",
16
+ redoButtonSelector: "#guido__redo-button",
17
+ mobileViewButtonSelector: ".guido__view-option-selection-mobile",
18
+ desktopViewButtonSelector: ".guido__view-option-selection-desktop",
19
+ codeEditorButtonSelector: "#guido__code-button",
20
+ editorFonts: {
21
+ showDefaultStandardFonts: !0,
22
+ showDefaultNotStandardFonts: !0,
23
+ customFonts: i
24
+ },
25
+ async onTokenRefreshRequest(o) {
26
+ try {
27
+ const s = await u();
28
+ o(s);
29
+ } catch (s) {
30
+ d(s, "Failed to refresh token");
31
+ }
32
+ },
33
+ onTemplateLoaded() {
34
+ try {
35
+ const { importCss: o } = m();
36
+ o();
37
+ } catch (o) {
38
+ d(o, "Failed to load custom interface appearance");
39
+ }
40
+ },
41
+ onCodeEditorVisibilityChanged(o) {
42
+ r.isCodeEditorOpen = o;
43
+ },
44
+ onEditorVisualModeChanged(o) {
45
+ r.editorVisualMode = o.toLowerCase();
46
+ },
47
+ onVersionHistoryVisibilityChanged(o) {
48
+ r.isVersionHistoryOpen = o;
49
+ }
50
+ }
51
+ );
52
+ }, p = (e) => new Promise((i, r) => {
53
+ if (document.getElementById("UiEditorScript")) {
54
+ e(), i();
55
+ return;
56
+ }
57
+ const t = document.createElement("script");
58
+ t.id = "UiEditorScript", t.type = "module", t.src = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", t.onload = () => {
59
+ e(), i();
60
+ }, t.onerror = () => {
61
+ const n = new Error("Failed to load Stripo UIEditor script");
62
+ r(n);
63
+ }, document.body.appendChild(t);
64
+ });
65
+ return { initPlugin: async (e) => {
66
+ await p(async () => {
67
+ const i = await a();
68
+ l(e, i);
69
+ });
70
+ } };
71
+ };
72
+ export {
73
+ _ as useStripo
74
+ };
@@ -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
+ };
@@ -0,0 +1,21 @@
1
+ export type ToasterType = 'success' | 'error' | 'info' | 'warning';
2
+ export type ToasterOptions = {
3
+ type?: ToasterType;
4
+ message: string;
5
+ actionButton?: {
6
+ text: string;
7
+ onClick: () => void;
8
+ };
9
+ };
10
+ export declare const useToaster: () => {
11
+ isToasterVisible: import("vue").Ref<boolean>;
12
+ toasterMessage: import("vue").Ref<string>;
13
+ toasterType: import("vue").Ref<ToasterType>;
14
+ toasterActionButton: import("vue").Ref<({
15
+ text: string;
16
+ onClick: () => void;
17
+ } | undefined)[]>;
18
+ showToaster: (options?: ToasterOptions) => void;
19
+ hideToaster: () => void;
20
+ handleError: (error: unknown, context: string) => void;
21
+ };
@@ -0,0 +1,37 @@
1
+ import { ref as o, watch as T } from "vue";
2
+ const v = () => {
3
+ const t = o(!1), s = o(""), c = o("success"), n = o([]);
4
+ let a = null;
5
+ function i() {
6
+ a && (clearTimeout(a), a = null);
7
+ }
8
+ function u() {
9
+ t.value = !1, n.value = [], s.value = "";
10
+ }
11
+ function l(e = { message: "" }) {
12
+ u(), s.value = e.message, c.value = e.type || "success", n.value = e.actionButton ? [e.actionButton] : [], t.value = !0;
13
+ }
14
+ function f(e, r) {
15
+ const m = e instanceof Error ? e.message : String(e);
16
+ l({
17
+ type: "error",
18
+ message: `${r}: ${m}`
19
+ });
20
+ }
21
+ return T([t, s], ([e, r]) => {
22
+ i(), e && r && (a = setTimeout(() => {
23
+ u();
24
+ }, 6e3));
25
+ }), {
26
+ isToasterVisible: t,
27
+ toasterMessage: s,
28
+ toasterType: c,
29
+ toasterActionButton: n,
30
+ showToaster: l,
31
+ hideToaster: u,
32
+ handleError: f
33
+ };
34
+ };
35
+ export {
36
+ v as useToaster
37
+ };
@@ -0,0 +1,5 @@
1
+ interface TranslationValues {
2
+ [key: string]: string | number | boolean;
3
+ }
4
+ export declare const useTranslations: () => ((key: string, params?: TranslationValues) => string) & import("lodash").MemoizedFunction;
5
+ export {};
@@ -0,0 +1,18 @@
1
+ import memoize from "../node_modules/lodash-es/memoize.js";
2
+ import { ref } from "vue";
3
+ const useTranslations = () => {
4
+ const translations = ref(eval(window.GuidoConfig.translationsPath)), trans = (n, t) => {
5
+ const r = translations.value[n];
6
+ return r ? t ? Object.entries(t).reduce(
7
+ (e, [o, i]) => e.replace(new RegExp(`{${o}}`, "g"), String(i)),
8
+ r
9
+ ) : r : (console.warn(`Translation key not found: ${n}`), n);
10
+ };
11
+ return memoize(
12
+ trans,
13
+ (n, t) => !t || Object.keys(t).length === 0 ? n : JSON.stringify({ key: n, params: t })
14
+ );
15
+ };
16
+ export {
17
+ useTranslations
18
+ };
@@ -0,0 +1,8 @@
1
+ export declare const useVersionHistoryApi: () => {
2
+ openVersionHistory: () => void;
3
+ closeVersionHistory: () => void;
4
+ switchToDesktopPreview: () => void;
5
+ switchToMobilePreview: () => void;
6
+ previewVersion: (id: string) => void;
7
+ restoreVersion: (id: string) => void;
8
+ };
@@ -0,0 +1,53 @@
1
+ import { useVersionHistoryStore as p } from "../stores/version-history.js";
2
+ import { useToaster as c } from "./useToaster.js";
3
+ const l = () => {
4
+ const i = p(), { showToaster: s } = c(), t = (e) => {
5
+ i.$reset(), i.updateState(e);
6
+ }, n = () => {
7
+ i.$reset();
8
+ };
9
+ return {
10
+ openVersionHistory: () => {
11
+ window.StripoEditorApi.versionHistoryApi.openVersionHistory(t, n);
12
+ },
13
+ closeVersionHistory: () => {
14
+ window.StripoEditorApi.versionHistoryApi.closeVersionHistory();
15
+ },
16
+ switchToDesktopPreview: () => {
17
+ window.StripoEditorApi.versionHistoryApi.switchToDesktopPreview();
18
+ },
19
+ switchToMobilePreview: () => {
20
+ window.StripoEditorApi.versionHistoryApi.switchToMobilePreview();
21
+ },
22
+ previewVersion: (e) => {
23
+ window.StripoEditorApi.versionHistoryApi.previewVersion(e, (o) => {
24
+ const r = o instanceof Error ? o.message : String(o);
25
+ s({
26
+ type: "error",
27
+ message: `Error compiling email: ${r}`
28
+ });
29
+ });
30
+ },
31
+ restoreVersion: (e) => {
32
+ window.StripoEditorApi.versionHistoryApi.restoreVersion(
33
+ e,
34
+ () => {
35
+ s({
36
+ type: "success",
37
+ message: `${e} patch restored successfully.`
38
+ });
39
+ },
40
+ (o) => {
41
+ const r = o instanceof Error ? o.message : String(o);
42
+ s({
43
+ type: "error",
44
+ message: `Error compiling email: ${r}`
45
+ });
46
+ }
47
+ );
48
+ }
49
+ };
50
+ };
51
+ export {
52
+ l as useVersionHistoryApi
53
+ };
@@ -0,0 +1,4 @@
1
+ import type { GuidoConfig } from '@@/Types/generic';
2
+ export declare const DefaultGuidoConfig: GuidoConfig;
3
+ export declare const DefaultProductType = "newsletter";
4
+ export declare const DefaultUsername = "Guido User";
@@ -0,0 +1,8 @@
1
+ const t = {
2
+ translationsPath: "window.trans.en"
3
+ }, e = "newsletter", n = "Guido User";
4
+ export {
5
+ t as DefaultGuidoConfig,
6
+ e as DefaultProductType,
7
+ n as DefaultUsername
8
+ };