@useinsider/guido 3.23.0-beta.31d0f5f → 3.23.0-beta.6555b16
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/dist/package.json.js
CHANGED
|
@@ -1,66 +1,70 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useHttp as
|
|
1
|
+
import { useActionsApi as v } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useConfig as A } from "../composables/useConfig.js";
|
|
3
|
+
import { useHttp as E } from "../composables/useHttp.js";
|
|
4
4
|
import { useToaster as x } from "../composables/useToaster.js";
|
|
5
|
-
import { useTranslations as
|
|
6
|
-
import { useHtmlDocumentCountValidator as
|
|
7
|
-
import { useLiquidValidator as
|
|
8
|
-
import { EditorType as
|
|
9
|
-
import { ToasterTypeOptions as
|
|
10
|
-
import { useRecommendationExtensionStore as
|
|
11
|
-
import { useSaveAsTemplateStore as
|
|
5
|
+
import { useTranslations as N } from "../composables/useTranslations.js";
|
|
6
|
+
import { useHtmlDocumentCountValidator as H } from "../composables/validators/useHtmlDocumentCountValidator.js";
|
|
7
|
+
import { useLiquidValidator as P } from "../composables/validators/useLiquidValidator.js";
|
|
8
|
+
import { EditorType as D } from "../enums/defaults.js";
|
|
9
|
+
import { ToasterTypeOptions as T } from "../enums/toaster.js";
|
|
10
|
+
import { useRecommendationExtensionStore as L } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
11
|
+
import { useSaveAsTemplateStore as q } from "../stores/save-as-template.js";
|
|
12
12
|
import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
|
|
13
|
-
import { isPlainObject as
|
|
13
|
+
import { isPlainObject as w } from "../utils/genericUtil.js";
|
|
14
14
|
import { useTemplatePreparation as F } from "../utils/templatePreparation.js";
|
|
15
15
|
const Z = () => {
|
|
16
|
-
const { get:
|
|
16
|
+
const { get: m, post: l } = E(), { handleError: o, showToaster: i } = x(), { config: c, isFeatureEnabled: p } = A(), { validateLiquidSyntax: b } = P(), { validateSingleHtmlDocument: h } = H(), { getTemplateData: C } = v(), u = N();
|
|
17
17
|
return {
|
|
18
18
|
getCategories: async () => {
|
|
19
19
|
try {
|
|
20
|
-
const { data: e
|
|
21
|
-
|
|
20
|
+
const { data: e } = await m("/newsletter/template-library/get-template-categories");
|
|
21
|
+
if (Array.isArray(e))
|
|
22
|
+
return e;
|
|
23
|
+
if (w(e) && e.type === "alert" && typeof e.message == "string")
|
|
24
|
+
return i({ message: e.message, type: T.Error }), [];
|
|
25
|
+
throw new Error("Unexpected get-template-categories response");
|
|
22
26
|
} catch (e) {
|
|
23
|
-
return
|
|
27
|
+
return o(e, "Failed to fetch template categories"), [];
|
|
24
28
|
}
|
|
25
29
|
},
|
|
26
30
|
checkTemplateNameAvailability: async (e) => {
|
|
27
|
-
const { data: { status: t = !1 } } = await
|
|
31
|
+
const { data: { status: t = !1 } } = await m(
|
|
28
32
|
`/newsletter/template-library/template-name-exists?name=${e}`
|
|
29
33
|
);
|
|
30
34
|
return !t;
|
|
31
35
|
},
|
|
32
36
|
createCategory: async (e) => {
|
|
33
37
|
try {
|
|
34
|
-
const { data: { id: t } } = await
|
|
38
|
+
const { data: { id: t } } = await l(
|
|
35
39
|
"/newsletter/template-library/create-category",
|
|
36
40
|
{ name: e }
|
|
37
41
|
);
|
|
38
42
|
return t.toString();
|
|
39
43
|
} catch (t) {
|
|
40
|
-
return
|
|
44
|
+
return o(t, "Failed to create category"), "";
|
|
41
45
|
}
|
|
42
46
|
},
|
|
43
47
|
createTemplate: async () => {
|
|
44
48
|
var e, t, d, y;
|
|
45
49
|
try {
|
|
46
|
-
const { prepareTemplateDetails:
|
|
47
|
-
if (!
|
|
50
|
+
const { prepareTemplateDetails: n } = F(), s = q(), g = await C();
|
|
51
|
+
if (!h(g.html))
|
|
48
52
|
return !1;
|
|
49
|
-
const a = await
|
|
50
|
-
if (p("liquidSyntax") && !await
|
|
53
|
+
const a = await n(g);
|
|
54
|
+
if (p("liquidSyntax") && !await b(a.compiledHtml))
|
|
51
55
|
return !1;
|
|
52
|
-
const
|
|
53
|
-
name:
|
|
54
|
-
categories:
|
|
56
|
+
const S = {
|
|
57
|
+
name: s.getTemplateName,
|
|
58
|
+
categories: s.getSelectedCategoryIds,
|
|
55
59
|
productId: ((t = (e = c.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
|
|
56
|
-
editorType:
|
|
60
|
+
editorType: D,
|
|
57
61
|
messageType: ((y = (d = c.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
|
|
58
62
|
content: r(a.compiledHtml),
|
|
59
63
|
css: r(a.css),
|
|
60
64
|
unsubscriptionPreferencePageStatus: !1,
|
|
61
65
|
unsubscriptionPreferencePages: [],
|
|
62
66
|
recommendationCampaignUrls: r(
|
|
63
|
-
|
|
67
|
+
L().recommendationCampaignUrls
|
|
64
68
|
),
|
|
65
69
|
recommendationConfigs: r({}),
|
|
66
70
|
isGuido: !0,
|
|
@@ -72,27 +76,27 @@ const Z = () => {
|
|
|
72
76
|
css: a.css,
|
|
73
77
|
dynamicContentList: a.dynamicContentList
|
|
74
78
|
})
|
|
75
|
-
}, { data: f } = await
|
|
79
|
+
}, { data: f } = await l(
|
|
76
80
|
"/newsletter/template-library/create-template",
|
|
77
|
-
|
|
81
|
+
S
|
|
78
82
|
);
|
|
79
|
-
if (!
|
|
83
|
+
if (!w(f))
|
|
80
84
|
throw new Error("Unexpected create-template response");
|
|
81
|
-
return f.type === "alert" ? (
|
|
85
|
+
return f.type === "alert" ? (i({
|
|
82
86
|
message: u(
|
|
83
87
|
"newsletter.template-library-save-alert",
|
|
84
|
-
{ templateName:
|
|
88
|
+
{ templateName: s.getTemplateName }
|
|
85
89
|
),
|
|
86
|
-
type:
|
|
87
|
-
}), !1) : (
|
|
90
|
+
type: T.Error
|
|
91
|
+
}), !1) : (i({
|
|
88
92
|
message: u(
|
|
89
93
|
"newsletter.template-library-save-success",
|
|
90
|
-
{ templateName:
|
|
94
|
+
{ templateName: s.getTemplateName }
|
|
91
95
|
),
|
|
92
96
|
type: "success"
|
|
93
97
|
}), !0);
|
|
94
|
-
} catch (
|
|
95
|
-
return
|
|
98
|
+
} catch (n) {
|
|
99
|
+
return o(n, "Failed to create template"), !1;
|
|
96
100
|
}
|
|
97
101
|
}
|
|
98
102
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useTemplateLibraryApi as o } from "../services/templateLibraryApi.js";
|
|
2
|
-
import { defineStore as
|
|
3
|
-
const
|
|
2
|
+
import { defineStore as r } from "pinia";
|
|
3
|
+
const i = () => ({
|
|
4
4
|
templateName: "",
|
|
5
5
|
categories: [],
|
|
6
6
|
selectedCategories: [],
|
|
@@ -17,8 +17,8 @@ const r = () => ({
|
|
|
17
17
|
editor: 2,
|
|
18
18
|
message: 1
|
|
19
19
|
}
|
|
20
|
-
}), g =
|
|
21
|
-
state: () =>
|
|
20
|
+
}), g = r("guidoSaveAsTemplate", {
|
|
21
|
+
state: () => i(),
|
|
22
22
|
getters: {
|
|
23
23
|
getTemplateName: (e) => e.templateName.trim(),
|
|
24
24
|
getSelectedCategoryIds: (e) => e.selectedCategories.map((a) => Number(a.value))
|
|
@@ -26,7 +26,7 @@ const r = () => ({
|
|
|
26
26
|
actions: {
|
|
27
27
|
async fetchCategories() {
|
|
28
28
|
const { getCategories: e } = o(), a = await e();
|
|
29
|
-
this.categories = a.map((t) => ({
|
|
29
|
+
this.categories = (Array.isArray(a) ? a : []).map((t) => ({
|
|
30
30
|
value: t.id.toString(),
|
|
31
31
|
text: t.name
|
|
32
32
|
})).sort((t, s) => t.text.localeCompare(s.text));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.23.0-beta.
|
|
3
|
+
"version": "3.23.0-beta.6555b16",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|