@useinsider/guido 3.1.1-beta.1320eab → 3.1.1-beta.15cdaf9
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.
|
@@ -1,27 +1,42 @@
|
|
|
1
|
-
import { useHttp as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { useHttp as c } from "../composables/useHttp.js";
|
|
2
|
+
import { URLS as i } from "../enums/extensions/recommendationBlock.js";
|
|
3
|
+
const f = () => {
|
|
4
|
+
const { get: r } = c(), a = "6KcLM9TwheVB1mgK";
|
|
5
|
+
return {
|
|
5
6
|
fetchRecommendationCreateData: async () => {
|
|
6
7
|
try {
|
|
7
|
-
return (await
|
|
8
|
+
return (await r("/newsletter/recommendations/create-data")).data;
|
|
8
9
|
} catch (e) {
|
|
9
10
|
throw console.error("fetchUserModalState error:", e), e;
|
|
10
11
|
}
|
|
11
12
|
},
|
|
12
13
|
fetchRecommendationFilters: async () => {
|
|
13
14
|
try {
|
|
14
|
-
const { data: e } = await
|
|
15
|
+
const { data: e } = await r("/stripo/email-recommendation-attributes");
|
|
15
16
|
return e;
|
|
16
17
|
} catch (e) {
|
|
17
18
|
throw console.error("fetchRecommendationFilters error:", e), e;
|
|
18
19
|
}
|
|
19
20
|
},
|
|
20
|
-
fetchRecommendationProducts: async (e,
|
|
21
|
-
|
|
21
|
+
fetchRecommendationProducts: async (e, s) => {
|
|
22
|
+
var n;
|
|
23
|
+
try {
|
|
24
|
+
const t = decodeURIComponent(new URLSearchParams(Object.entries(s)).toString());
|
|
25
|
+
console.debug("🏁 Recommendation API Query:", t);
|
|
26
|
+
const { get: m } = c({
|
|
27
|
+
headers: {
|
|
28
|
+
"X-CLIENT-ID": a
|
|
29
|
+
}
|
|
30
|
+
}), o = await m(
|
|
31
|
+
`${i.RECOMMENDATION_API_URL}/v2/${e}?${t}`
|
|
32
|
+
);
|
|
33
|
+
return ((n = o == null ? void 0 : o.data) == null ? void 0 : n.data) ?? [];
|
|
34
|
+
} catch (t) {
|
|
35
|
+
throw console.error("fetchRecommendationProducts error:", t), t;
|
|
36
|
+
}
|
|
22
37
|
}
|
|
23
38
|
};
|
|
24
39
|
};
|
|
25
40
|
export {
|
|
26
|
-
|
|
41
|
+
f as useRecommendationApi
|
|
27
42
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { useHttp as d } from "../composables/useHttp.js";
|
|
2
2
|
import { useToaster as m } from "../composables/useToaster.js";
|
|
3
3
|
import { MAX_DEFAULT_TEMPLATE_ID as y } from "../enums/defaults.js";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import f from "../static/templates/empty/index.html.js";
|
|
5
|
+
import g from "../static/templates/empty/style.css.js";
|
|
6
6
|
const E = () => {
|
|
7
7
|
const { get: s, post: c } = d(), { handleError: r } = m();
|
|
8
8
|
return {
|
|
9
9
|
getToken: async () => {
|
|
10
10
|
try {
|
|
11
|
-
const
|
|
12
|
-
return
|
|
11
|
+
const { data: t } = await s("/stripo/get-user-token");
|
|
12
|
+
return t.body.token;
|
|
13
13
|
} catch (t) {
|
|
14
14
|
return r(t, "Failed to fetch token"), "";
|
|
15
15
|
}
|
|
@@ -27,14 +27,14 @@ const E = () => {
|
|
|
27
27
|
},
|
|
28
28
|
getDefaultTemplate: async () => {
|
|
29
29
|
const t = {
|
|
30
|
-
html:
|
|
31
|
-
css:
|
|
30
|
+
html: f,
|
|
31
|
+
css: g
|
|
32
32
|
};
|
|
33
33
|
try {
|
|
34
|
-
const e = new URLSearchParams(window.location.search), u = e.get("default-template"),
|
|
35
|
-
if (!i && !
|
|
34
|
+
const e = new URLSearchParams(window.location.search), u = e.get("default-template"), p = e.get("master"), a = u ? parseInt(u) : 0, i = a >= 1 && a <= y ? a : 0;
|
|
35
|
+
if (!i && !p)
|
|
36
36
|
return t;
|
|
37
|
-
const
|
|
37
|
+
const l = `/stripo/default-template/${i}`, { data: n } = await s(l), o = typeof n == "string" ? JSON.parse(n) : n;
|
|
38
38
|
return !o || typeof o != "object" || !("html" in o) || !("css" in o) ? t : o;
|
|
39
39
|
} catch (e) {
|
|
40
40
|
return r(e, "Failed to fetch default template"), t;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.1.1-beta.
|
|
3
|
+
"version": "3.1.1-beta.15cdaf9",
|
|
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",
|