@useinsider/guido 1.0.0-beta.ae2520e → 1.0.0-beta.afdfab7
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 +35 -19
- package/dist/components/Guido.vue.d.ts +4 -0
- package/dist/components/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +34 -18
- package/dist/components/organisms/base/ModalWrapper.vue.d.ts +72 -0
- package/dist/components/organisms/base/ModalWrapper.vue.js +19 -0
- package/dist/components/organisms/base/ModalWrapper.vue2.js +43 -0
- package/dist/components/organisms/{top-bar/Header.vue.js → header/HeaderWrapper.vue.js} +7 -7
- package/dist/components/organisms/header/HeaderWrapper.vue2.js +14 -0
- package/dist/components/organisms/header/LeftSlot.vue.js +17 -0
- package/dist/components/organisms/header/LeftSlot.vue2.js +13 -0
- package/dist/components/organisms/header/MiddleSlot.vue.d.ts +2 -0
- package/dist/components/organisms/header/MiddleSlot.vue.js +17 -0
- package/dist/components/organisms/header/MiddleSlot.vue2.js +22 -0
- package/dist/components/organisms/header/RightSlot.vue.js +17 -0
- package/dist/components/organisms/header/RightSlot.vue2.js +21 -0
- package/dist/components/organisms/{top-bar/HeaderViewOptions.vue.js → header/ViewOptions.vue.js} +5 -5
- package/dist/components/organisms/{top-bar/HeaderViewOptions.vue2.js → header/ViewOptions.vue2.js} +3 -3
- package/dist/components/organisms/header/version-history/RestoreButton.vue.js +19 -0
- package/dist/components/organisms/header/version-history/RestoreButton.vue2.js +14 -0
- package/dist/components/organisms/header/version-history/VersionHistory.vue.d.ts +14 -0
- package/dist/components/organisms/header/version-history/VersionHistory.vue.js +22 -0
- package/dist/components/organisms/header/version-history/VersionHistory.vue2.js +18 -0
- package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.d.ts +16 -0
- package/dist/components/organisms/header/version-history/VersionHistoryItem.vue.js +18 -0
- package/dist/components/organisms/header/version-history/VersionHistoryItem.vue2.js +16 -0
- package/dist/components/organisms/header/version-history/ViewOptions.vue.d.ts +2 -0
- package/dist/components/organisms/header/version-history/ViewOptions.vue.js +18 -0
- package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +23 -0
- package/dist/components/organisms/save-template/SaveTemplateModal.vue.d.ts +16 -0
- package/dist/components/organisms/save-template/SaveTemplateModal.vue.js +22 -0
- package/dist/components/organisms/save-template/SaveTemplateModal.vue2.js +86 -0
- package/dist/composables/useActionsApi.d.ts +4 -0
- package/dist/composables/useActionsApi.js +36 -0
- package/dist/composables/useCustomInterfaceAppearance.js +45 -9
- package/dist/composables/useExport.d.ts +3 -0
- package/dist/composables/useExport.js +30 -0
- package/dist/composables/useHttp.js +84 -0
- package/dist/composables/usePartner.d.ts +4 -0
- package/dist/composables/usePartner.js +16 -0
- package/dist/composables/useSaveAsTemplate.d.ts +17 -0
- package/dist/composables/useSaveAsTemplate.js +44 -0
- package/dist/composables/useStripo.d.ts +2 -2
- package/dist/composables/useStripo.js +53 -55
- package/dist/composables/useTemplateCategories.d.ts +35 -0
- package/dist/composables/useTemplateCategories.js +78 -0
- package/dist/composables/useTemplateNameValidation.d.ts +13 -0
- package/dist/composables/useTemplateNameValidation.js +57 -0
- package/dist/composables/useToaster.d.ts +1 -0
- package/dist/composables/useToaster.js +37 -0
- package/dist/composables/useTranslations.d.ts +1 -3
- package/dist/composables/useTranslations.js +18 -0
- package/dist/composables/useVersionHistoryApi.d.ts +8 -0
- package/dist/composables/useVersionHistoryApi.js +53 -0
- package/dist/enums/defaults.d.ts +2 -0
- package/dist/enums/defaults.js +5 -3
- package/dist/enums/displayConditions.d.ts +2 -0
- package/dist/enums/displayConditions.js +80 -0
- package/dist/guido.css +1 -1
- package/dist/mock/api/custom-fonts.d.ts +2 -0
- package/dist/mock/api/template-library.d.ts +2 -0
- package/dist/node_modules/lodash-es/_Hash.js +20 -0
- package/dist/node_modules/lodash-es/_ListCache.js +20 -0
- package/dist/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/lodash-es/_MapCache.js +20 -0
- package/dist/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/lodash-es/_assocIndexOf.js +10 -0
- package/dist/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/lodash-es/_baseIsNative.js +16 -0
- package/dist/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/lodash-es/_getRawTag.js +15 -0
- package/dist/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/lodash-es/_listCacheDelete.js +12 -0
- package/dist/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/lodash-es/_toSource.js +17 -0
- package/dist/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/lodash-es/isFunction.js +12 -0
- package/dist/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/lodash-es/memoize.js +18 -0
- package/dist/services/stripoApi.d.ts +7 -0
- package/dist/services/stripoApi.js +29 -0
- package/dist/static/styles/base.css.js +11 -0
- package/dist/static/styles/components/alert-message.css.js +39 -0
- package/dist/static/styles/components/amp-block.css.js +18 -0
- package/dist/static/styles/components/base-input.css.js +47 -0
- package/dist/static/styles/components/button-group.css.js +54 -0
- package/dist/static/styles/components/button.css.js +106 -0
- package/dist/static/styles/components/combobox.css.js +49 -0
- package/dist/static/styles/components/counter.css.js +42 -0
- package/dist/static/styles/components/dropdown-menu.css.js +52 -0
- package/dist/static/styles/components/narrow-panel.css.js +38 -0
- package/dist/static/styles/components/switcher.css.js +11 -0
- package/dist/static/styles/components/tabs.css.js +97 -0
- package/dist/static/styles/components/tools.css.js +23 -0
- package/dist/static/styles/components/version-history.css.js +30 -0
- package/dist/static/styles/components/wide-panel.css.js +135 -0
- package/dist/static/styles/variables.css.js +23 -0
- package/dist/stores/editor.d.ts +4 -4
- package/dist/stores/editor.js +4 -2
- package/dist/stores/version-history.d.ts +80 -0
- package/dist/stores/version-history.js +28 -0
- package/dist/utils/base64.d.ts +1 -0
- package/dist/utils/base64.js +14 -0
- package/dist/utils/dateUtil.d.ts +1 -0
- package/dist/utils/dateUtil.js +16 -0
- package/package.json +1 -1
- package/dist/components/organisms/top-bar/Header.vue2.js +0 -14
- package/dist/components/organisms/top-bar/HeaderLeftSlot.vue.js +0 -17
- package/dist/components/organisms/top-bar/HeaderLeftSlot.vue2.js +0 -11
- package/dist/components/organisms/top-bar/HeaderMiddleSlot.vue.js +0 -17
- package/dist/components/organisms/top-bar/HeaderMiddleSlot.vue2.js +0 -17
- package/dist/components/organisms/top-bar/HeaderRightSlot.vue.js +0 -18
- package/dist/components/organisms/top-bar/HeaderRightSlot.vue2.js +0 -12
- package/dist/node_modules/pinia/dist/pinia.js +0 -314
- package/dist/node_modules/pinia/node_modules/vue-demi/lib/index.js +0 -11
- package/dist/static/editor.css.js +0 -182
- package/dist/stores/counter.d.ts +0 -12
- /package/dist/components/organisms/{top-bar/Header.vue.d.ts → header/HeaderWrapper.vue.d.ts} +0 -0
- /package/dist/components/organisms/{top-bar/HeaderRightSlot.vue.d.ts → header/LeftSlot.vue.d.ts} +0 -0
- /package/dist/components/organisms/{top-bar/HeaderLeftSlot.vue.d.ts → header/RightSlot.vue.d.ts} +0 -0
- /package/dist/components/organisms/{top-bar/HeaderMiddleSlot.vue.d.ts → header/ViewOptions.vue.d.ts} +0 -0
- /package/dist/components/organisms/{top-bar/HeaderViewOptions.vue.d.ts → header/version-history/RestoreButton.vue.d.ts} +0 -0
|
@@ -1,81 +1,79 @@
|
|
|
1
|
-
import { useCustomInterfaceAppearance as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
secretKey: void 0,
|
|
10
|
-
role: void 0,
|
|
11
|
-
userId: s
|
|
12
|
-
});
|
|
13
|
-
return fetch("/v2/stripo/get-token", {
|
|
14
|
-
method: "POST",
|
|
15
|
-
headers: t,
|
|
16
|
-
body: r,
|
|
17
|
-
redirect: "follow"
|
|
18
|
-
}).then((o) => o.json());
|
|
19
|
-
}, d = (t) => {
|
|
20
|
-
const r = l(), n = t.html, o = t.css;
|
|
1
|
+
import { useCustomInterfaceAppearance as m } from "./useCustomInterfaceAppearance.js";
|
|
2
|
+
import { useToaster as g } from "./useToaster.js";
|
|
3
|
+
import { displayConditions as E } from "../enums/displayConditions.js";
|
|
4
|
+
import { useStripoApi as S } from "../services/stripoApi.js";
|
|
5
|
+
import { useEditorStore as w } from "../stores/editor.js";
|
|
6
|
+
const F = (c) => {
|
|
7
|
+
const { handleError: d } = g(), { getToken: a, getCustomFonts: u } = S(), l = (e, i = []) => {
|
|
8
|
+
const r = w(), { html: t, css: n } = e;
|
|
21
9
|
window.UIEditor.initEditor(
|
|
22
10
|
document.querySelector("#guido-editor"),
|
|
23
11
|
{
|
|
24
|
-
metadata:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
username: "Plugin Demo User"
|
|
28
|
-
},
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
30
|
-
html: n,
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
32
|
-
css: o,
|
|
12
|
+
metadata: c,
|
|
13
|
+
html: t,
|
|
14
|
+
css: n,
|
|
33
15
|
locale: "en",
|
|
34
16
|
undoButtonSelector: "#guido__undo-button",
|
|
35
17
|
redoButtonSelector: "#guido__redo-button",
|
|
36
18
|
mobileViewButtonSelector: ".guido__view-option-selection-mobile",
|
|
37
19
|
desktopViewButtonSelector: ".guido__view-option-selection-desktop",
|
|
38
|
-
versionHistoryButtonSelector: "#guido__history-button",
|
|
39
20
|
codeEditorButtonSelector: "#guido__code-button",
|
|
40
|
-
|
|
21
|
+
conditionsEnabled: !0,
|
|
22
|
+
customConditionsEnabled: !0,
|
|
23
|
+
conditionCategories: E,
|
|
24
|
+
messageSettingsEnabled: !1,
|
|
25
|
+
editorFonts: {
|
|
26
|
+
showDefaultStandardFonts: !0,
|
|
27
|
+
showDefaultNotStandardFonts: !0,
|
|
28
|
+
customFonts: i
|
|
29
|
+
},
|
|
30
|
+
async onTokenRefreshRequest(o) {
|
|
41
31
|
try {
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
} catch (
|
|
45
|
-
|
|
32
|
+
const s = await a();
|
|
33
|
+
o(s);
|
|
34
|
+
} catch (s) {
|
|
35
|
+
d(s, "Failed to refresh token");
|
|
46
36
|
}
|
|
47
37
|
},
|
|
48
38
|
onTemplateLoaded() {
|
|
49
39
|
try {
|
|
50
|
-
const { importCss:
|
|
51
|
-
|
|
52
|
-
} catch (
|
|
53
|
-
|
|
40
|
+
const { importCss: o } = m();
|
|
41
|
+
o();
|
|
42
|
+
} catch (o) {
|
|
43
|
+
d(o, "Failed to load custom interface appearance");
|
|
54
44
|
}
|
|
55
45
|
},
|
|
56
|
-
onCodeEditorVisibilityChanged(
|
|
57
|
-
r.isCodeEditorOpen =
|
|
46
|
+
onCodeEditorVisibilityChanged(o) {
|
|
47
|
+
r.isCodeEditorOpen = o;
|
|
58
48
|
},
|
|
59
|
-
onEditorVisualModeChanged(
|
|
60
|
-
r.editorVisualMode =
|
|
49
|
+
onEditorVisualModeChanged(o) {
|
|
50
|
+
r.editorVisualMode = o.toLowerCase();
|
|
51
|
+
},
|
|
52
|
+
onVersionHistoryVisibilityChanged(o) {
|
|
53
|
+
r.isVersionHistoryOpen = o;
|
|
61
54
|
}
|
|
62
55
|
}
|
|
63
56
|
);
|
|
64
|
-
}
|
|
65
|
-
return { initPlugin: (t) => new Promise((r, n) => {
|
|
57
|
+
}, p = (e) => new Promise((i, r) => {
|
|
66
58
|
if (document.getElementById("UiEditorScript")) {
|
|
67
|
-
|
|
59
|
+
e(), i();
|
|
68
60
|
return;
|
|
69
61
|
}
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
const
|
|
75
|
-
n
|
|
76
|
-
}, document.body.appendChild(
|
|
77
|
-
})
|
|
62
|
+
const t = document.createElement("script");
|
|
63
|
+
t.id = "UiEditorScript", t.type = "module", t.src = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", t.onload = () => {
|
|
64
|
+
e(), i();
|
|
65
|
+
}, t.onerror = () => {
|
|
66
|
+
const n = new Error("Failed to load Stripo UIEditor script");
|
|
67
|
+
r(n);
|
|
68
|
+
}, document.body.appendChild(t);
|
|
69
|
+
});
|
|
70
|
+
return { initPlugin: async (e) => {
|
|
71
|
+
await p(async () => {
|
|
72
|
+
const i = await u();
|
|
73
|
+
l(e, i);
|
|
74
|
+
});
|
|
75
|
+
} };
|
|
78
76
|
};
|
|
79
77
|
export {
|
|
80
|
-
|
|
78
|
+
F as useStripo
|
|
81
79
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
interface MappedCategory {
|
|
2
|
+
value: string;
|
|
3
|
+
text: string;
|
|
4
|
+
}
|
|
5
|
+
interface GetDataProps {
|
|
6
|
+
getInitialData?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const useTemplateCategories: ({ getInitialData }?: GetDataProps) => {
|
|
9
|
+
data: {
|
|
10
|
+
loading: boolean;
|
|
11
|
+
loadingCreate: boolean;
|
|
12
|
+
categories: {
|
|
13
|
+
id: number;
|
|
14
|
+
name: string;
|
|
15
|
+
partnerId: number;
|
|
16
|
+
isStripo: boolean;
|
|
17
|
+
templatesCount: number;
|
|
18
|
+
}[];
|
|
19
|
+
mappedCategories: {
|
|
20
|
+
value: string;
|
|
21
|
+
text: string;
|
|
22
|
+
}[];
|
|
23
|
+
selectedCategories: {
|
|
24
|
+
value: string;
|
|
25
|
+
text: string;
|
|
26
|
+
}[];
|
|
27
|
+
};
|
|
28
|
+
fetchCategories: () => Promise<void>;
|
|
29
|
+
createCategory: (name: string) => Promise<void>;
|
|
30
|
+
selectCategory: (category: MappedCategory) => void;
|
|
31
|
+
setSelectedCategories: (categories: MappedCategory[]) => void;
|
|
32
|
+
resetSelection: () => void;
|
|
33
|
+
getSelectedCategoryIds: import("vue").ComputedRef<number[]>;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { useHttp as h } from "./useHttp.js";
|
|
2
|
+
import { useToaster as x } from "./useToaster.js";
|
|
3
|
+
import { reactive as w, computed as v } from "vue";
|
|
4
|
+
const b = ({ getInitialData: g = !1 } = {}) => {
|
|
5
|
+
const { get: c, post: d } = h(), { handleError: o, showToaster: n } = x(), e = w({
|
|
6
|
+
loading: !1,
|
|
7
|
+
loadingCreate: !1,
|
|
8
|
+
categories: [],
|
|
9
|
+
mappedCategories: [],
|
|
10
|
+
selectedCategories: []
|
|
11
|
+
}), i = async () => {
|
|
12
|
+
e.loading = !0;
|
|
13
|
+
try {
|
|
14
|
+
const s = (await c("/newsletter/template-library/get-template-categories")).data || [];
|
|
15
|
+
e.categories = s, e.mappedCategories = s.map((a) => ({
|
|
16
|
+
value: a.id.toString(),
|
|
17
|
+
text: a.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 a = `/newsletter/template-library/category-name-exists?name=${encodeURIComponent(t)}`;
|
|
27
|
+
return (await c(a)).data.status;
|
|
28
|
+
} catch (s) {
|
|
29
|
+
return o(s, "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 l = {
|
|
45
|
+
value: r.id.toString(),
|
|
46
|
+
text: r.name
|
|
47
|
+
};
|
|
48
|
+
e.mappedCategories.push(l), e.selectedCategories.push(l), n({
|
|
49
|
+
type: "success",
|
|
50
|
+
message: "Category created successfully"
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
} catch (s) {
|
|
54
|
+
o(s, "Error creating category:");
|
|
55
|
+
} finally {
|
|
56
|
+
e.loadingCreate = !1;
|
|
57
|
+
}
|
|
58
|
+
}, C = (t) => {
|
|
59
|
+
const s = e.selectedCategories.findIndex((a) => a.value === t.value);
|
|
60
|
+
s === -1 ? e.selectedCategories.push(t) : e.selectedCategories.splice(s, 1);
|
|
61
|
+
}, y = (t) => {
|
|
62
|
+
e.selectedCategories = [...t];
|
|
63
|
+
}, u = () => {
|
|
64
|
+
e.selectedCategories = [];
|
|
65
|
+
}, f = v(() => e.selectedCategories.map((t) => parseInt(t.value)));
|
|
66
|
+
return g && i(), {
|
|
67
|
+
data: e,
|
|
68
|
+
fetchCategories: i,
|
|
69
|
+
createCategory: m,
|
|
70
|
+
selectCategory: C,
|
|
71
|
+
setSelectedCategories: y,
|
|
72
|
+
resetSelection: u,
|
|
73
|
+
getSelectedCategoryIds: f
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
b as useTemplateCategories
|
|
78
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ValidationResult {
|
|
2
|
+
isValid: boolean;
|
|
3
|
+
message: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const useTemplateNameValidation: () => {
|
|
6
|
+
validationError: import("vue").Ref<string>;
|
|
7
|
+
isValidating: import("vue").Ref<boolean>;
|
|
8
|
+
validateTemplateName: (name: string) => Promise<ValidationResult>;
|
|
9
|
+
clearValidation: () => void;
|
|
10
|
+
VALIDATION_RULES: {
|
|
11
|
+
DEBOUNCE_TIME: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useHttp as v } from "./useHttp.js";
|
|
2
|
+
import { useToaster as T } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as E } from "./useTranslations.js";
|
|
4
|
+
import { ref as m } from "vue";
|
|
5
|
+
const c = {
|
|
6
|
+
DEBOUNCE_TIME: 500
|
|
7
|
+
}, x = () => {
|
|
8
|
+
const { get: u } = v(), { handleError: d } = T(), l = E(), s = m(""), o = m(!1), r = m(null), p = (a) => a.trim() ? {
|
|
9
|
+
isValid: !0,
|
|
10
|
+
message: ""
|
|
11
|
+
} : {
|
|
12
|
+
isValid: !1,
|
|
13
|
+
message: l("validation.required-product-name-to-continue", { product: "template" })
|
|
14
|
+
}, f = async (a) => {
|
|
15
|
+
try {
|
|
16
|
+
const i = `/template-library/template-name-exists?name=${encodeURIComponent(a)}`;
|
|
17
|
+
return (await u(i)).data.status;
|
|
18
|
+
} catch (e) {
|
|
19
|
+
return d(e, "Error checking template name:"), !1;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
validationError: s,
|
|
24
|
+
isValidating: o,
|
|
25
|
+
validateTemplateName: (a) => (r.value && clearTimeout(r.value), new Promise((e) => {
|
|
26
|
+
const i = p(a);
|
|
27
|
+
if (!i.isValid) {
|
|
28
|
+
s.value = i.message, e(i);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
o.value = !0, r.value = setTimeout(async () => {
|
|
32
|
+
try {
|
|
33
|
+
const t = await f(a.trim()), n = {
|
|
34
|
+
isValid: !t,
|
|
35
|
+
message: t ? l("whatsapp-business.template-name-exists") : ""
|
|
36
|
+
};
|
|
37
|
+
s.value = n.message, e(n);
|
|
38
|
+
} catch (t) {
|
|
39
|
+
const n = {
|
|
40
|
+
isValid: !1,
|
|
41
|
+
message: t instanceof Error ? t.message : l("validation.unknown-error")
|
|
42
|
+
};
|
|
43
|
+
s.value = n.message, e(n);
|
|
44
|
+
} finally {
|
|
45
|
+
o.value = !1;
|
|
46
|
+
}
|
|
47
|
+
}, c.DEBOUNCE_TIME);
|
|
48
|
+
})),
|
|
49
|
+
clearValidation: () => {
|
|
50
|
+
s.value = "", o.value = !1, r.value && clearTimeout(r.value);
|
|
51
|
+
},
|
|
52
|
+
VALIDATION_RULES: c
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
x as useTemplateNameValidation
|
|
57
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
interface TranslationValues {
|
|
2
2
|
[key: string]: string | number | boolean;
|
|
3
3
|
}
|
|
4
|
-
export declare const useTranslations: () =>
|
|
5
|
-
trans: ((key: string, params?: TranslationValues) => string) & import("lodash").MemoizedFunction;
|
|
6
|
-
};
|
|
4
|
+
export declare const useTranslations: () => ((key: string, params?: TranslationValues) => string) & import("lodash").MemoizedFunction;
|
|
7
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
|
+
};
|
package/dist/enums/defaults.d.ts
CHANGED
package/dist/enums/defaults.js
CHANGED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const e = [
|
|
2
|
+
{
|
|
3
|
+
category: "Demographics",
|
|
4
|
+
conditions: [
|
|
5
|
+
{
|
|
6
|
+
id: 1,
|
|
7
|
+
name: "Language",
|
|
8
|
+
description: "Users who are in the English will see the banner",
|
|
9
|
+
beforeScript: '{% if language == "en_US" %}',
|
|
10
|
+
afterScript: "{% endif %}"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: 2,
|
|
14
|
+
name: "Country",
|
|
15
|
+
description: "Only people who live in Australia will see the banner",
|
|
16
|
+
beforeScript: '{% if country == "Australia" %}',
|
|
17
|
+
afterScript: "{% endif %}"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: 3,
|
|
21
|
+
name: "Country & City",
|
|
22
|
+
description: "Only people who are located in that country and city",
|
|
23
|
+
beforeScript: '{% if country == "United Kingdom" and city == "London" %}',
|
|
24
|
+
afterScript: "{% endif %}"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 4,
|
|
28
|
+
name: "Age (Less than operator)",
|
|
29
|
+
description: "Users whose age is less than 18",
|
|
30
|
+
beforeScript: "{% if age < 18 %}",
|
|
31
|
+
afterScript: "{% endif %}"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 5,
|
|
35
|
+
name: "Age (Equal and greater than operator)",
|
|
36
|
+
description: "Users whose age is equal or greater than 25",
|
|
37
|
+
beforeScript: "{% if age >= 25 %}",
|
|
38
|
+
afterScript: "{% endif %}"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 6,
|
|
42
|
+
name: "Age (Greater than & less than operators)",
|
|
43
|
+
description: "Users whose age is between 18 and 25",
|
|
44
|
+
beforeScript: "{% if age > 18 and age < 25 %}",
|
|
45
|
+
afterScript: "{% endif %}"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 7,
|
|
49
|
+
name: "Gender",
|
|
50
|
+
description: "Users whose gender is Female",
|
|
51
|
+
beforeScript: '{% if gender == "Female" %}',
|
|
52
|
+
afterScript: "{% endif %}"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 8,
|
|
56
|
+
name: "State",
|
|
57
|
+
description: "Users whose state is one of the followings. c_state is a custom attribute. Use this condition if you have the attribute with the same naming. ",
|
|
58
|
+
beforeScript: '{% if c_state == "VIC" or c_state == "NSW" or c_state == "QLD" %}',
|
|
59
|
+
afterScript: "{% endif %}"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 9,
|
|
63
|
+
name: "VIP User",
|
|
64
|
+
description: "Users who are VIP users for that brand. c_is_vip_user = true. c_is_vip_user is a custom attribute. Use this condition if you have the attribute with the same naming.",
|
|
65
|
+
beforeScript: "{% if c_is_vip_user %}",
|
|
66
|
+
afterScript: "{% endif %}"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 10,
|
|
70
|
+
name: "Membership Type",
|
|
71
|
+
description: "Users who belong to gold or silver membership type. c_is_gold_member = true, c_is_silver_member = true. These are custom attributes. Use this condition if you have the attribute with the same naming.",
|
|
72
|
+
beforeScript: "{% if c_is_gold_member or c_is_silver_member %}",
|
|
73
|
+
afterScript: "{% endif %}"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
];
|
|
78
|
+
export {
|
|
79
|
+
e as displayConditions
|
|
80
|
+
};
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
[data-v-
|
|
1
|
+
.version-history-item[data-v-0e2ff42d]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}[data-v-6a2bde67] .guido__verion-history-view-option-selection-desktop svg,[data-v-6a2bde67] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6a2bde67] .in-segments-wrapper__button_selected,[data-v-6a2bde67] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-0fff376c] .guido__view-option-selection-desktop svg,[data-v-0fff376c] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-0fff376c] .in-segments-wrapper__button_selected,[data-v-0fff376c] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.guido-editor__wrapper[data-v-69c35c60],.guido-editor__container[data-v-69c35c60]{width:100%;height:calc(100vh - 75px)}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import p from "./_hashClear.js";
|
|
2
|
+
import a from "./_hashDelete.js";
|
|
3
|
+
import l from "./_hashGet.js";
|
|
4
|
+
import s from "./_hashHas.js";
|
|
5
|
+
import m from "./_hashSet.js";
|
|
6
|
+
function t(o) {
|
|
7
|
+
var e = -1, h = o == null ? 0 : o.length;
|
|
8
|
+
for (this.clear(); ++e < h; ) {
|
|
9
|
+
var r = o[e];
|
|
10
|
+
this.set(r[0], r[1]);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
t.prototype.clear = p;
|
|
14
|
+
t.prototype.delete = a;
|
|
15
|
+
t.prototype.get = l;
|
|
16
|
+
t.prototype.has = s;
|
|
17
|
+
t.prototype.set = m;
|
|
18
|
+
export {
|
|
19
|
+
t as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import p from "./_listCacheClear.js";
|
|
2
|
+
import a from "./_listCacheDelete.js";
|
|
3
|
+
import i from "./_listCacheGet.js";
|
|
4
|
+
import h from "./_listCacheHas.js";
|
|
5
|
+
import s from "./_listCacheSet.js";
|
|
6
|
+
function t(e) {
|
|
7
|
+
var o = -1, l = e == null ? 0 : e.length;
|
|
8
|
+
for (this.clear(); ++o < l; ) {
|
|
9
|
+
var r = e[o];
|
|
10
|
+
this.set(r[0], r[1]);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
t.prototype.clear = p;
|
|
14
|
+
t.prototype.delete = a;
|
|
15
|
+
t.prototype.get = i;
|
|
16
|
+
t.prototype.has = h;
|
|
17
|
+
t.prototype.set = s;
|
|
18
|
+
export {
|
|
19
|
+
t as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import r from "./_mapCacheClear.js";
|
|
2
|
+
import m from "./_mapCacheDelete.js";
|
|
3
|
+
import h from "./_mapCacheGet.js";
|
|
4
|
+
import l from "./_mapCacheHas.js";
|
|
5
|
+
import c from "./_mapCacheSet.js";
|
|
6
|
+
function e(t) {
|
|
7
|
+
var o = -1, a = t == null ? 0 : t.length;
|
|
8
|
+
for (this.clear(); ++o < a; ) {
|
|
9
|
+
var p = t[o];
|
|
10
|
+
this.set(p[0], p[1]);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
e.prototype.clear = r;
|
|
14
|
+
e.prototype.delete = m;
|
|
15
|
+
e.prototype.get = h;
|
|
16
|
+
e.prototype.has = l;
|
|
17
|
+
e.prototype.set = c;
|
|
18
|
+
export {
|
|
19
|
+
e as default
|
|
20
|
+
};
|