@useinsider/guido 3.30.1-beta.34bc10d → 3.30.1-beta.49c2d00
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 +14 -0
- package/dist/@types/config/schemas.js +4 -4
- package/dist/@types/email-be/html-validation.js +1 -1
- package/dist/components/Guido.vue.js +9 -9
- package/dist/components/Guido.vue2.js +156 -130
- package/dist/components/organisms/dynamic-content/InvalidDynamicContentCard.vue.js +22 -0
- package/dist/components/organisms/dynamic-content/InvalidDynamicContentCard.vue2.js +30 -0
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue.js +2 -2
- package/dist/composables/useInvalidDynamicContentMarking.js +105 -0
- package/dist/enums/defaults.js +5 -4
- package/dist/enums/email-be.js +9 -20
- package/dist/extensions/DynamicContent/dynamic-content.js +39 -57
- package/dist/guido.css +1 -1
- package/dist/node_modules/valibot/dist/index.js +90 -95
- package/dist/package.json.js +1 -1
- package/dist/services/emailBe/errors/ApiError.js +26 -27
- package/dist/services/templateLibraryApi.js +87 -59
- package/dist/src/@types/generic.d.ts +11 -0
- package/dist/src/@types/save-as-template.d.ts +23 -1
- package/dist/src/components/Guido.vue.d.ts +5 -1
- package/dist/src/components/organisms/dynamic-content/InvalidDynamicContentCard.vue.d.ts +22 -0
- package/dist/src/composables/useInvalidDynamicContentMarking.d.ts +4 -0
- package/dist/src/enums/email-be.d.ts +0 -11
- package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +0 -8
- package/dist/src/library.d.ts +1 -1
- package/dist/src/stores/dynamic-content.d.ts +42 -1
- package/dist/src/utils/editorCanvas.d.ts +3 -0
- package/dist/static/styles/customEditorStyle.css.js +4 -0
- package/dist/stores/dynamic-content.js +19 -7
- package/dist/utils/editorCanvas.js +18 -0
- package/package.json +1 -1
- package/dist/@types/email-be/templates.js +0 -15
- package/dist/services/emailBe/templates/TemplateService.js +0 -149
- package/dist/services/emailBe/templates/index.js +0 -6
- package/dist/src/@types/email-be/templates.d.ts +0 -40
- package/dist/src/services/emailBe/templates/TemplateService.d.ts +0 -13
- package/dist/src/services/emailBe/templates/index.d.ts +0 -2
|
@@ -1,77 +1,105 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { useSaveAsTemplateStore as
|
|
12
|
-
import {
|
|
13
|
-
import "
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const { handleError: y, showToaster: f } = v(), { config: T, isFeatureEnabled: g } = k(), { validateLiquidSyntax: C } = L(), { validateSingleHtmlDocument: w } = b(), { getTemplateData: h } = S(), i = A();
|
|
1
|
+
import { useActionsApi as A } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useConfig as S } from "../composables/useConfig.js";
|
|
3
|
+
import { useHttp as E } from "../composables/useHttp.js";
|
|
4
|
+
import { useToaster as x } from "../composables/useToaster.js";
|
|
5
|
+
import { useTranslations as P } from "../composables/useTranslations.js";
|
|
6
|
+
import { useHtmlDocumentCountValidator as L } from "../composables/validators/useHtmlDocumentCountValidator.js";
|
|
7
|
+
import { useLiquidValidator as N } from "../composables/validators/useLiquidValidator.js";
|
|
8
|
+
import { EditorType as H } from "../enums/defaults.js";
|
|
9
|
+
import { ToasterTypeOptions as T } from "../enums/toaster.js";
|
|
10
|
+
import { useRecommendationExtensionStore as D } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
11
|
+
import { useSaveAsTemplateStore as q } from "../stores/save-as-template.js";
|
|
12
|
+
import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
|
|
13
|
+
import { isPlainObject as w } from "../utils/genericUtil.js";
|
|
14
|
+
import { useTemplatePreparation as F } from "../utils/templatePreparation.js";
|
|
15
|
+
const Z = () => {
|
|
16
|
+
const { get: l, post: c } = E(), { handleError: o, showToaster: i } = x(), { config: p, isFeatureEnabled: u } = S(), { validateLiquidSyntax: b } = N(), { validateSingleHtmlDocument: C } = L(), { getTemplateData: h } = A(), n = P();
|
|
18
17
|
return {
|
|
19
18
|
getCategories: async () => {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
try {
|
|
20
|
+
const { data: e } = await l("/newsletter/template-library/get-template-categories");
|
|
21
|
+
return Array.isArray(e) ? e : ((!w(e) || e.type !== "alert") && console.error("[TEMPLATE_LIBRARY_API] Unexpected get-template-categories response", e), i({
|
|
22
|
+
message: n("newsletter.template-library-service-error"),
|
|
23
|
+
type: T.Error
|
|
24
|
+
}), []);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
return o(e, "Failed to fetch template categories"), [];
|
|
27
|
+
}
|
|
22
28
|
},
|
|
23
29
|
checkTemplateNameAvailability: async (e) => {
|
|
24
|
-
const t = await
|
|
25
|
-
|
|
30
|
+
const { data: { status: t = !1 } } = await l(
|
|
31
|
+
`/newsletter/template-library/template-name-exists?name=${e}`
|
|
32
|
+
);
|
|
33
|
+
return !t;
|
|
26
34
|
},
|
|
27
35
|
createCategory: async (e) => {
|
|
28
|
-
|
|
29
|
-
|
|
36
|
+
try {
|
|
37
|
+
const { data: { id: t } } = await c(
|
|
38
|
+
"/newsletter/template-library/create-category",
|
|
39
|
+
{ name: e }
|
|
40
|
+
);
|
|
41
|
+
return t.toString();
|
|
42
|
+
} catch (t) {
|
|
43
|
+
return o(t, "Failed to create category"), "";
|
|
44
|
+
}
|
|
30
45
|
},
|
|
31
46
|
createTemplate: async () => {
|
|
32
|
-
var e;
|
|
47
|
+
var e, t, d, y;
|
|
33
48
|
try {
|
|
34
|
-
const { prepareTemplateDetails:
|
|
35
|
-
if (!
|
|
49
|
+
const { prepareTemplateDetails: m } = F(), s = q(), g = await h();
|
|
50
|
+
if (!C(g.html))
|
|
36
51
|
return !1;
|
|
37
|
-
const a = await
|
|
38
|
-
if (
|
|
52
|
+
const a = await m(g);
|
|
53
|
+
if (u("liquidSyntax") && !await b(a.compiledHtml))
|
|
39
54
|
return !1;
|
|
40
|
-
const
|
|
41
|
-
name:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
const v = {
|
|
56
|
+
name: s.getTemplateName,
|
|
57
|
+
categories: s.getSelectedCategoryIds,
|
|
58
|
+
productId: ((t = (e = p.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
|
|
59
|
+
editorType: H,
|
|
60
|
+
messageType: ((y = (d = p.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
|
|
61
|
+
content: r(a.compiledHtml),
|
|
62
|
+
css: r(a.css),
|
|
63
|
+
unsubscriptionPreferencePageStatus: !1,
|
|
64
|
+
unsubscriptionPreferencePages: [],
|
|
65
|
+
recommendationCampaignUrls: r(
|
|
66
|
+
D().recommendationCampaignUrls
|
|
67
|
+
),
|
|
68
|
+
recommendationConfigs: r({}),
|
|
69
|
+
isGuido: !0,
|
|
70
|
+
// eslint-disable-next-line camelcase
|
|
71
|
+
template_engine: u("liquidSyntax") ? 1 : 0,
|
|
72
|
+
stripoConfig: r({
|
|
73
|
+
editor: "stripo",
|
|
74
|
+
html: a.rawHtml,
|
|
75
|
+
css: a.css,
|
|
76
|
+
dynamicContentList: a.dynamicContentList
|
|
77
|
+
})
|
|
78
|
+
}, { data: f } = await c(
|
|
79
|
+
"/newsletter/template-library/create-template",
|
|
80
|
+
v
|
|
81
|
+
);
|
|
82
|
+
if (!w(f))
|
|
83
|
+
throw new Error("Unexpected create-template response");
|
|
84
|
+
return f.type === "alert" ? (i({
|
|
85
|
+
message: n(
|
|
86
|
+
"newsletter.template-library-save-alert",
|
|
87
|
+
{ templateName: s.getTemplateName }
|
|
88
|
+
),
|
|
89
|
+
type: T.Error
|
|
90
|
+
}), !1) : (i({
|
|
91
|
+
message: n(
|
|
92
|
+
"newsletter.template-library-save-success",
|
|
93
|
+
{ templateName: s.getTemplateName }
|
|
94
|
+
),
|
|
95
|
+
type: "success"
|
|
68
96
|
}), !0);
|
|
69
|
-
} catch (
|
|
70
|
-
return
|
|
97
|
+
} catch (m) {
|
|
98
|
+
return o(m, "Failed to create template"), !1;
|
|
71
99
|
}
|
|
72
100
|
}
|
|
73
101
|
};
|
|
74
102
|
};
|
|
75
103
|
export {
|
|
76
|
-
|
|
104
|
+
Z as useTemplateLibraryApi
|
|
77
105
|
};
|
|
@@ -13,6 +13,13 @@ export type BaseDynamicContent = {
|
|
|
13
13
|
export type DynamicContent = BaseDynamicContent & {
|
|
14
14
|
text: string;
|
|
15
15
|
};
|
|
16
|
+
export type InvalidDynamicContent = {
|
|
17
|
+
value: string;
|
|
18
|
+
title: string;
|
|
19
|
+
description: string;
|
|
20
|
+
actionLabel: string;
|
|
21
|
+
actionAvailable: boolean;
|
|
22
|
+
};
|
|
16
23
|
/**
|
|
17
24
|
* A node in the partner-keyed dynamic-content tree (backend categorized-fields
|
|
18
25
|
* shape). Category nodes carry `children`/`select_items`; leaf nodes are the
|
|
@@ -54,6 +61,10 @@ export type DynamicContentEvent = {
|
|
|
54
61
|
attribute: DynamicContent;
|
|
55
62
|
position?: PositionData;
|
|
56
63
|
};
|
|
64
|
+
export type InvalidDynamicContentHoverEvent = {
|
|
65
|
+
entry: InvalidDynamicContent;
|
|
66
|
+
position: PositionData;
|
|
67
|
+
};
|
|
57
68
|
export type MergeTagClickEvent = {
|
|
58
69
|
position: PositionData;
|
|
59
70
|
element: HTMLElement;
|
|
@@ -2,7 +2,29 @@ export interface MappedCategory {
|
|
|
2
2
|
value: string;
|
|
3
3
|
text: string;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export interface Category {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
partnerId: number;
|
|
9
|
+
isStripo: boolean;
|
|
10
|
+
templatesCount: number;
|
|
11
|
+
}
|
|
6
12
|
export interface RecommendationCampaignUrls {
|
|
7
13
|
[key: string]: string;
|
|
8
14
|
}
|
|
15
|
+
export interface CreateTemplateRequest {
|
|
16
|
+
name: string;
|
|
17
|
+
categories: number[];
|
|
18
|
+
productId: number;
|
|
19
|
+
editorType: number;
|
|
20
|
+
messageType?: number;
|
|
21
|
+
content: string;
|
|
22
|
+
css?: string;
|
|
23
|
+
stripoConfig: string;
|
|
24
|
+
recommendationConfigs?: string;
|
|
25
|
+
recommendationCampaignUrls?: string;
|
|
26
|
+
unsubscriptionPreferencePages: number[];
|
|
27
|
+
unsubscriptionPreferencePageStatus: boolean;
|
|
28
|
+
isGuido: boolean;
|
|
29
|
+
template_engine: number;
|
|
30
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DynamicContent, GuidoConfigInput } from '@@/Types/config';
|
|
2
|
-
import type { PositionData } from '@@/Types/generic';
|
|
2
|
+
import type { InvalidDynamicContent, PositionData } from '@@/Types/generic';
|
|
3
3
|
import type { SavedTemplateDetails } from '@@/Types/stripo';
|
|
4
4
|
type __VLS_Props = {
|
|
5
5
|
/** Guido configuration object */
|
|
@@ -13,6 +13,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
13
13
|
dynamicContent: {
|
|
14
14
|
insert: (data: DynamicContent) => void;
|
|
15
15
|
close: () => void;
|
|
16
|
+
setInvalid: (list: InvalidDynamicContent[]) => void;
|
|
16
17
|
};
|
|
17
18
|
hasChanges: import("vue").ComputedRef<boolean>;
|
|
18
19
|
saveSilent: () => Promise<{
|
|
@@ -50,6 +51,9 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
50
51
|
ready: () => void;
|
|
51
52
|
"onboarding:finished": () => void;
|
|
52
53
|
"test-email:click": () => void;
|
|
54
|
+
"dynamic-content:invalid-action": (detail: {
|
|
55
|
+
value: string;
|
|
56
|
+
}) => void;
|
|
53
57
|
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
54
58
|
ready: boolean;
|
|
55
59
|
}>>>, {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { InvalidDynamicContent, PositionData } from '@@/Types/generic';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
entry: InvalidDynamicContent;
|
|
4
|
+
position: PositionData;
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
|
|
7
|
+
"dynamic-content:invalid-action": (detail: {
|
|
8
|
+
value: string;
|
|
9
|
+
}) => void;
|
|
10
|
+
mouseenter: () => void;
|
|
11
|
+
mouseleave: () => void;
|
|
12
|
+
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
15
|
+
type __VLS_TypePropsToOption<T> = {
|
|
16
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
17
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
18
|
+
} : {
|
|
19
|
+
type: import('vue').PropType<T[K]>;
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
export declare const EMAIL_BE_BASE_URL = "/email-proxy";
|
|
2
2
|
export declare const EmailBeEndPoints: {
|
|
3
3
|
readonly HTML_VALIDATE: "/v1/html/validate";
|
|
4
|
-
readonly TEMPLATES: "/v1/templates";
|
|
5
|
-
readonly TEMPLATE_NAME_CHECK: "/v1/templates/name-check";
|
|
6
|
-
readonly TEMPLATE_CATEGORIES: "/v1/templates/categories";
|
|
7
|
-
readonly ALLOWLIST_VALIDATE: "/v1/allowlist/validate";
|
|
8
4
|
};
|
|
9
|
-
export declare const ALLOWLIST_TEMPLATE_TYPE = "emailTemplateLibrary";
|
|
10
5
|
export declare const EmailBeErrorCodes: {
|
|
11
6
|
readonly BAD_GATEWAY: "bad_gateway";
|
|
12
7
|
readonly BAD_REQUEST: "bad_request";
|
|
@@ -22,12 +17,6 @@ export declare const EmailBeErrorCodes: {
|
|
|
22
17
|
readonly NETWORK: "network_error";
|
|
23
18
|
readonly TIMEOUT: "timeout";
|
|
24
19
|
readonly UNKNOWN: "unknown";
|
|
25
|
-
readonly PRODUCT_TYPE_DISABLED: "product-type:errors.disabled";
|
|
26
|
-
readonly PRODUCT_TYPE_FETCH_FAILED: "product-type:errors.fetch-failed";
|
|
27
|
-
readonly TEMPLATE_NAME_CONFLICT: "template:errors.name-conflict";
|
|
28
|
-
readonly TEMPLATE_CATEGORY_NAME_CONFLICT: "template:errors.category-name-conflict";
|
|
29
|
-
readonly TEMPLATE_CONTENT_REJECTED: "template:errors.content-rejected";
|
|
30
|
-
readonly TEMPLATE_ALLOWLIST_UNAVAILABLE: "template:errors.allowlist-unavailable";
|
|
31
20
|
};
|
|
32
21
|
export type ApiErrorCode = typeof EmailBeErrorCodes[keyof typeof EmailBeErrorCodes];
|
|
33
22
|
export declare const HtmlSyntax: {
|
|
@@ -37,10 +37,6 @@ export declare class DynamicContentUiElementExtension extends UIElement {
|
|
|
37
37
|
* Workaround from Stripo intercepting click events - tracks mousedown events instead
|
|
38
38
|
*/
|
|
39
39
|
private _setupCoordinateTracking;
|
|
40
|
-
/**
|
|
41
|
-
* Gets the editor iframe element
|
|
42
|
-
*/
|
|
43
|
-
private _getEditorFrame;
|
|
44
40
|
/**
|
|
45
41
|
* Finds merge tag element in the element tree
|
|
46
42
|
*/
|
|
@@ -50,10 +46,6 @@ export declare class DynamicContentUiElementExtension extends UIElement {
|
|
|
50
46
|
* This ensures we always use the correct element's position even with rapid clicks
|
|
51
47
|
*/
|
|
52
48
|
private _getLastClickedPosition;
|
|
53
|
-
/**
|
|
54
|
-
* Calculates absolute position of element relative to page
|
|
55
|
-
*/
|
|
56
|
-
private _calculateAbsolutePosition;
|
|
57
49
|
/**
|
|
58
50
|
* Cleans up the coordinate tracking event listener
|
|
59
51
|
*/
|
package/dist/src/library.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export { useGuidoEmailEditorStore } from './public/editorState';
|
|
|
6
6
|
export type { GuidoEmailEditorState } from './public/editorState';
|
|
7
7
|
export { prefetchGuidoRuntime } from './public/prefetchRuntime';
|
|
8
8
|
export type { StripoEventType } from './@types/events';
|
|
9
|
-
export type { PositionData, DynamicContentEvent, MergeTagClickEvent, MergeTag, BaseDynamicContent, DynamicContentNode, DynamicContentList, TooltipOptions, TextValueObject, L10n, } from './@types/generic';
|
|
9
|
+
export type { PositionData, DynamicContentEvent, MergeTagClickEvent, MergeTag, BaseDynamicContent, InvalidDynamicContent, DynamicContentNode, DynamicContentList, TooltipOptions, TextValueObject, L10n, } from './@types/generic';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { DynamicContent } from '@@/Types/generic';
|
|
1
|
+
import type { DynamicContent, InvalidDynamicContent } from '@@/Types/generic';
|
|
2
2
|
export declare const useDynamicContentStore: import("pinia").StoreDefinition<"guidoDynamicContent", {
|
|
3
3
|
selectedDynamicContent: DynamicContent;
|
|
4
4
|
selectedDynamicContentList: DynamicContent[];
|
|
5
|
+
invalidDynamicContentList: InvalidDynamicContent[];
|
|
5
6
|
}, {
|
|
6
7
|
getSelectedDynamicContentList: (state: {
|
|
7
8
|
selectedDynamicContent: {
|
|
@@ -22,9 +23,17 @@ export declare const useDynamicContentStore: import("pinia").StoreDefinition<"gu
|
|
|
22
23
|
} | undefined;
|
|
23
24
|
text: string;
|
|
24
25
|
}[];
|
|
26
|
+
invalidDynamicContentList: {
|
|
27
|
+
value: string;
|
|
28
|
+
title: string;
|
|
29
|
+
description: string;
|
|
30
|
+
actionLabel: string;
|
|
31
|
+
actionAvailable: boolean;
|
|
32
|
+
}[];
|
|
25
33
|
} & import("pinia").PiniaCustomStateProperties<{
|
|
26
34
|
selectedDynamicContent: DynamicContent;
|
|
27
35
|
selectedDynamicContentList: DynamicContent[];
|
|
36
|
+
invalidDynamicContentList: InvalidDynamicContent[];
|
|
28
37
|
}>) => {
|
|
29
38
|
text: string;
|
|
30
39
|
value: string;
|
|
@@ -34,6 +43,37 @@ export declare const useDynamicContentStore: import("pinia").StoreDefinition<"gu
|
|
|
34
43
|
value: string;
|
|
35
44
|
} | undefined;
|
|
36
45
|
}[];
|
|
46
|
+
getInvalidDynamicContent: (state: {
|
|
47
|
+
selectedDynamicContent: {
|
|
48
|
+
value: string;
|
|
49
|
+
fallback?: string | undefined;
|
|
50
|
+
format?: {
|
|
51
|
+
key: string;
|
|
52
|
+
value: string;
|
|
53
|
+
} | undefined;
|
|
54
|
+
text: string;
|
|
55
|
+
};
|
|
56
|
+
selectedDynamicContentList: {
|
|
57
|
+
value: string;
|
|
58
|
+
fallback?: string | undefined;
|
|
59
|
+
format?: {
|
|
60
|
+
key: string;
|
|
61
|
+
value: string;
|
|
62
|
+
} | undefined;
|
|
63
|
+
text: string;
|
|
64
|
+
}[];
|
|
65
|
+
invalidDynamicContentList: {
|
|
66
|
+
value: string;
|
|
67
|
+
title: string;
|
|
68
|
+
description: string;
|
|
69
|
+
actionLabel: string;
|
|
70
|
+
actionAvailable: boolean;
|
|
71
|
+
}[];
|
|
72
|
+
} & import("pinia").PiniaCustomStateProperties<{
|
|
73
|
+
selectedDynamicContent: DynamicContent;
|
|
74
|
+
selectedDynamicContentList: DynamicContent[];
|
|
75
|
+
invalidDynamicContentList: InvalidDynamicContent[];
|
|
76
|
+
}>) => (value: string) => InvalidDynamicContent | undefined;
|
|
37
77
|
}, {
|
|
38
78
|
setSelectedDynamicContent(dynamicContent: DynamicContent): void;
|
|
39
79
|
/**
|
|
@@ -44,4 +84,5 @@ export declare const useDynamicContentStore: import("pinia").StoreDefinition<"gu
|
|
|
44
84
|
* reactivity can't write a later mutation back into the host's catalog.
|
|
45
85
|
*/
|
|
46
86
|
registerDynamicContent(items: DynamicContent[]): void;
|
|
87
|
+
setInvalidDynamicContent(list: unknown): void;
|
|
47
88
|
}>;
|
|
@@ -9,6 +9,10 @@ const n = `.esd-x,
|
|
|
9
9
|
border-radius: 4px !important;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
merge-tag-selector {
|
|
13
|
+
--guido-dc-invalid-color: #dc2a2a;
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
.ue-preview-control-wrapper ue-icon-component:not([disabled=true]):not(.stripo-static-icon):hover {
|
|
13
17
|
background: none;
|
|
14
18
|
}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import { removeDuplicatesFromArray as
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { removeDuplicatesFromArray as i } from "../utils/arrayUtil.js";
|
|
2
|
+
import { isPlainObject as o } from "../utils/genericUtil.js";
|
|
3
|
+
import { defineStore as l } from "pinia";
|
|
4
|
+
const n = (t) => typeof t == "string" ? t : "", c = (t) => !o(t) || typeof t.value != "string" || t.value === "" ? null : {
|
|
5
|
+
value: t.value,
|
|
6
|
+
title: n(t.title),
|
|
7
|
+
description: n(t.description),
|
|
8
|
+
actionLabel: n(t.actionLabel),
|
|
9
|
+
actionAvailable: t.actionAvailable === !0
|
|
10
|
+
}, m = l("guidoDynamicContent", {
|
|
4
11
|
state: () => ({
|
|
5
12
|
selectedDynamicContent: { text: "", value: "" },
|
|
6
|
-
selectedDynamicContentList: []
|
|
13
|
+
selectedDynamicContentList: [],
|
|
14
|
+
invalidDynamicContentList: []
|
|
7
15
|
}),
|
|
8
16
|
actions: {
|
|
9
17
|
setSelectedDynamicContent(t) {
|
|
@@ -18,17 +26,21 @@ const c = a("guidoDynamicContent", {
|
|
|
18
26
|
*/
|
|
19
27
|
registerDynamicContent(t) {
|
|
20
28
|
this.selectedDynamicContentList.push(...t.map((e) => ({ ...e })));
|
|
29
|
+
},
|
|
30
|
+
setInvalidDynamicContent(t) {
|
|
31
|
+
this.invalidDynamicContentList = Array.isArray(t) ? t.map(c).filter((e) => e !== null) : [];
|
|
21
32
|
}
|
|
22
33
|
},
|
|
23
34
|
getters: {
|
|
24
|
-
getSelectedDynamicContentList: (t) =>
|
|
35
|
+
getSelectedDynamicContentList: (t) => i(t.selectedDynamicContentList).map((e) => ({
|
|
25
36
|
text: e.text,
|
|
26
37
|
value: e.value,
|
|
27
38
|
fallback: e.fallback,
|
|
28
39
|
format: e.format
|
|
29
|
-
}))
|
|
40
|
+
})),
|
|
41
|
+
getInvalidDynamicContent: (t) => (e) => t.invalidDynamicContentList.find((a) => a.value === e)
|
|
30
42
|
}
|
|
31
43
|
});
|
|
32
44
|
export {
|
|
33
|
-
|
|
45
|
+
m as useDynamicContentStore
|
|
34
46
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { findEditorShadowRoot as i } from "./editorShadowRoot.js";
|
|
2
|
+
const c = () => {
|
|
3
|
+
var e, n;
|
|
4
|
+
const t = (e = i()) == null ? void 0 : e.querySelector("iframe");
|
|
5
|
+
return (n = t == null ? void 0 : t.contentWindow) != null && n.document ? t : null;
|
|
6
|
+
}, d = (t, e) => {
|
|
7
|
+
const n = t.getBoundingClientRect(), o = e.getBoundingClientRect();
|
|
8
|
+
return {
|
|
9
|
+
x: n.x + o.x,
|
|
10
|
+
y: n.y + o.y,
|
|
11
|
+
width: o.width,
|
|
12
|
+
height: o.height
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
d as getCanvasElementPosition,
|
|
17
|
+
c as getEditorCanvasFrame
|
|
18
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.30.1-beta.
|
|
3
|
+
"version": "3.30.1-beta.49c2d00",
|
|
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",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { array as c, object as e, string as a, number as t, boolean as o, optional as m, record as i, unknown as n } from "../../node_modules/valibot/dist/index.js";
|
|
2
|
-
const r = e({
|
|
3
|
-
id: t(),
|
|
4
|
-
name: a()
|
|
5
|
-
}), s = c(n()), p = e({ exists: o() }), h = e({ id: t() }), d = e({
|
|
6
|
-
clean: o(),
|
|
7
|
-
violations: m(i(a(), n()))
|
|
8
|
-
});
|
|
9
|
-
export {
|
|
10
|
-
d as AllowlistValidationSchema,
|
|
11
|
-
h as CreatedTemplateSchema,
|
|
12
|
-
s as TemplateCategoryListSchema,
|
|
13
|
-
r as TemplateCategorySchema,
|
|
14
|
-
p as TemplateNameCheckSchema
|
|
15
|
-
};
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { useToaster as p } from "../../../composables/useToaster.js";
|
|
2
|
-
import { useTranslations as m } from "../../../composables/useTranslations.js";
|
|
3
|
-
import { EmailBeErrorCodes as o, EmailBeEndPoints as i, ALLOWLIST_TEMPLATE_TYPE as A } from "../../../enums/email-be.js";
|
|
4
|
-
import { ToasterTypeOptions as y } from "../../../enums/toaster.js";
|
|
5
|
-
import { ApiError as h, isValidationError as f } from "../errors/ApiError.js";
|
|
6
|
-
import { handleApiError as c } from "../errors/handleApiError.js";
|
|
7
|
-
import { TemplateCategoryListSchema as O, TemplateCategorySchema as T, TemplateNameCheckSchema as L, AllowlistValidationSchema as w, CreatedTemplateSchema as C } from "../../../@types/email-be/templates.js";
|
|
8
|
-
import { escapeHtml as _ } from "../../../utils/htmlEscape.js";
|
|
9
|
-
import { is as g, safeParse as N } from "../../../node_modules/valibot/dist/index.js";
|
|
10
|
-
const S = "[TEMPLATE_SERVICE]", u = null, P = [
|
|
11
|
-
400,
|
|
12
|
-
404,
|
|
13
|
-
409,
|
|
14
|
-
500,
|
|
15
|
-
503,
|
|
16
|
-
504,
|
|
17
|
-
o.INVALID_RESPONSE,
|
|
18
|
-
o.NETWORK,
|
|
19
|
-
o.TIMEOUT,
|
|
20
|
-
o.UNKNOWN
|
|
21
|
-
], d = () => m()("user-management.forbidden-action"), E = () => m()("newsletter.try-again-later"), k = () => m()("newsletter.template-category-name-exists");
|
|
22
|
-
function I(s) {
|
|
23
|
-
const e = Object.values(s).flatMap((t) => Array.isArray(t) ? t : []).filter((t) => typeof t == "string" && t !== "");
|
|
24
|
-
return [...new Set(e)];
|
|
25
|
-
}
|
|
26
|
-
function M(s, e) {
|
|
27
|
-
return f(s) ? Object.keys(s.errors).length ? s.firstMessage() : (!(s.cause instanceof Error) || s.message !== s.cause.message) && s.message ? s.message : e : e;
|
|
28
|
-
}
|
|
29
|
-
function R(s, e) {
|
|
30
|
-
return new h({ status: 200, code: o.INVALID_RESPONSE, message: s, cause: e });
|
|
31
|
-
}
|
|
32
|
-
function l(s, e, t) {
|
|
33
|
-
const r = N(s, e);
|
|
34
|
-
if (!r.success)
|
|
35
|
-
throw R(t, r.issues);
|
|
36
|
-
return r.output;
|
|
37
|
-
}
|
|
38
|
-
class K {
|
|
39
|
-
constructor(e) {
|
|
40
|
-
this.http = e;
|
|
41
|
-
}
|
|
42
|
-
errorOptions(e, t = "", r = {}) {
|
|
43
|
-
const a = t ? {
|
|
44
|
-
...Object.fromEntries(P.map((n) => [n, () => t])),
|
|
45
|
-
422: (n) => M(n, t)
|
|
46
|
-
} : {};
|
|
47
|
-
return {
|
|
48
|
-
context: `${S} ${e}`,
|
|
49
|
-
...r,
|
|
50
|
-
overrides: {
|
|
51
|
-
...a,
|
|
52
|
-
[o.FORBIDDEN]: d,
|
|
53
|
-
[o.PRODUCT_TYPE_DISABLED]: d,
|
|
54
|
-
[o.TEMPLATE_ALLOWLIST_UNAVAILABLE]: E,
|
|
55
|
-
[o.PRODUCT_TYPE_FETCH_FAILED]: E,
|
|
56
|
-
429: E,
|
|
57
|
-
502: E,
|
|
58
|
-
...r.overrides
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
async listCategories(e = "") {
|
|
63
|
-
try {
|
|
64
|
-
const t = await this.http.request({
|
|
65
|
-
method: "GET",
|
|
66
|
-
url: i.TEMPLATE_CATEGORIES
|
|
67
|
-
});
|
|
68
|
-
return { ok: !0, data: l(O, t, "Categories answered without a list").filter((a) => g(T, a)) };
|
|
69
|
-
} catch (t) {
|
|
70
|
-
return { ok: !1, error: c(t, this.errorOptions("listCategories", e)) };
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
async createCategory(e) {
|
|
74
|
-
try {
|
|
75
|
-
const t = await this.http.request({
|
|
76
|
-
method: "POST",
|
|
77
|
-
url: i.TEMPLATE_CATEGORIES,
|
|
78
|
-
body: { name: e },
|
|
79
|
-
retry: u
|
|
80
|
-
});
|
|
81
|
-
return { ok: !0, data: l(T, t, "Category create answered without a category") };
|
|
82
|
-
} catch (t) {
|
|
83
|
-
return {
|
|
84
|
-
ok: !1,
|
|
85
|
-
error: c(t, this.errorOptions("createCategory", "", {
|
|
86
|
-
overrides: { [o.TEMPLATE_CATEGORY_NAME_CONFLICT]: k }
|
|
87
|
-
}))
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
async isNameTaken(e) {
|
|
92
|
-
try {
|
|
93
|
-
const t = await this.http.request({
|
|
94
|
-
method: "POST",
|
|
95
|
-
url: i.TEMPLATE_NAME_CHECK,
|
|
96
|
-
body: { name: e }
|
|
97
|
-
}), { exists: r } = l(L, t, "Name check answered without a verdict");
|
|
98
|
-
return { ok: !0, data: r };
|
|
99
|
-
} catch (t) {
|
|
100
|
-
return { ok: !1, error: c(t, this.errorOptions("isNameTaken", "", { silent: !0 })) };
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
async checkAllowlist(e, t) {
|
|
104
|
-
try {
|
|
105
|
-
const r = await this.http.request({
|
|
106
|
-
method: "POST",
|
|
107
|
-
url: i.ALLOWLIST_VALIDATE,
|
|
108
|
-
body: { type: A, fields: { html: e.html, css: e.css } }
|
|
109
|
-
}), a = l(w, r, "Allowlist answered without a verdict");
|
|
110
|
-
if (a.clean)
|
|
111
|
-
return { ok: !0, data: !0 };
|
|
112
|
-
const n = _(I(a.violations ?? {}).join(", "));
|
|
113
|
-
return p().showToaster({
|
|
114
|
-
type: y.Error,
|
|
115
|
-
message: m()("newsletter.template-allowlist-blocked-domains", { domains: n })
|
|
116
|
-
}), {
|
|
117
|
-
ok: !1,
|
|
118
|
-
error: new h({
|
|
119
|
-
status: 422,
|
|
120
|
-
code: o.TEMPLATE_CONTENT_REJECTED,
|
|
121
|
-
message: "Content links domains that are not allowlisted"
|
|
122
|
-
})
|
|
123
|
-
};
|
|
124
|
-
} catch (r) {
|
|
125
|
-
return { ok: !1, error: c(r, this.errorOptions("checkAllowlist", t)) };
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
async create(e, t) {
|
|
129
|
-
try {
|
|
130
|
-
const r = await this.http.request({
|
|
131
|
-
method: "POST",
|
|
132
|
-
url: i.TEMPLATES,
|
|
133
|
-
body: e,
|
|
134
|
-
retry: u
|
|
135
|
-
});
|
|
136
|
-
return { ok: !0, data: l(C, r, "Create answered without a template").id };
|
|
137
|
-
} catch (r) {
|
|
138
|
-
return {
|
|
139
|
-
ok: !1,
|
|
140
|
-
error: c(r, this.errorOptions("create", t.fallback, {
|
|
141
|
-
overrides: { [o.TEMPLATE_NAME_CONFLICT]: () => t.nameTaken }
|
|
142
|
-
}))
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
export {
|
|
148
|
-
K as TemplateService
|
|
149
|
-
};
|