@useinsider/guido 3.1.1-beta.e00a22b → 3.1.1-beta.e4aa789
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/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +91 -81
- package/dist/components/organisms/header/EditorActions.vue.js +1 -1
- package/dist/components/organisms/header/EditorActions.vue2.js +20 -15
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
- package/dist/composables/useRecommendation.js +2 -2
- package/dist/composables/useStripo.js +6 -6
- package/dist/config/compiler/recommendationCompilerRules.js +158 -44
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +49 -46
- package/dist/enums/displayConditions.js +82 -78
- package/dist/enums/extensions/recommendationBlock.js +96 -39
- package/dist/enums/recommendation.js +2 -2
- package/dist/enums/unsubscribe.js +17 -16
- package/dist/extensions/Blocks/Checkbox/control.js +23 -23
- package/dist/extensions/Blocks/RadioButton/control.js +15 -15
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -3
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +12 -14
- package/dist/services/templateLibraryApi.js +48 -46
- package/dist/src/@types/save-as-template.d.ts +1 -0
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
- package/dist/src/enums/displayConditions.d.ts +5 -1
- package/dist/src/enums/extensions/recommendationBlock.d.ts +8 -1
- package/dist/src/enums/unsubscribe.d.ts +8 -3
- package/dist/src/services/templateLibraryApi.d.ts +1 -1
- package/dist/static/styles/base.css.js +7 -2
- package/dist/utils/templatePreparation.js +34 -25
- package/package.json +1 -2
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useHttp as
|
|
3
|
-
import { useToaster as
|
|
4
|
-
import { useTranslations as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { useConfig as w } from "../composables/useConfig.js";
|
|
2
|
+
import { useHttp as b } from "../composables/useHttp.js";
|
|
3
|
+
import { useToaster as h } from "../composables/useToaster.js";
|
|
4
|
+
import { useTranslations as C } from "../composables/useTranslations.js";
|
|
5
|
+
import { useLiquidValidator as S } from "../composables/validators/useLiquidValidator.js";
|
|
6
|
+
import { EditorType as v } from "../enums/defaults.js";
|
|
7
|
+
import { useRecommendationExtensionStore as N } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
8
|
+
import { useSaveAsTemplateStore as x } from "../stores/save-as-template.js";
|
|
9
|
+
import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
|
|
10
|
+
import { useTemplatePreparation as A } from "../utils/templatePreparation.js";
|
|
11
|
+
const $ = () => {
|
|
12
|
+
const { get: n, post: m } = b(), { handleError: o, showToaster: l } = h(), { config: c, isFeatureEnabled: p } = w(), { validateLiquidSyntax: g } = S(), u = C();
|
|
12
13
|
return {
|
|
13
14
|
getCategories: async () => {
|
|
14
15
|
try {
|
|
@@ -26,7 +27,7 @@ const R = () => {
|
|
|
26
27
|
},
|
|
27
28
|
createCategory: async (e) => {
|
|
28
29
|
try {
|
|
29
|
-
const { data: { id: t } } = await
|
|
30
|
+
const { data: { id: t } } = await m(
|
|
30
31
|
"/newsletter/template-library/create-category",
|
|
31
32
|
{ name: e }
|
|
32
33
|
);
|
|
@@ -36,55 +37,56 @@ const R = () => {
|
|
|
36
37
|
}
|
|
37
38
|
},
|
|
38
39
|
createTemplate: async () => {
|
|
39
|
-
var e, t,
|
|
40
|
+
var e, t, d, y;
|
|
40
41
|
try {
|
|
41
|
-
const { prepareTemplateDetails:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
const { prepareTemplateDetails: i } = A(), s = x(), a = await i();
|
|
43
|
+
if (p("liquidSyntax") && !await g(a.compiledHtml))
|
|
44
|
+
return !1;
|
|
45
|
+
const f = {
|
|
46
|
+
name: s.getTemplateName,
|
|
47
|
+
categories: s.getSelectedCategoryIds,
|
|
48
|
+
productId: ((t = (e = c.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
|
|
49
|
+
editorType: v,
|
|
50
|
+
messageType: ((y = (d = c.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
|
|
51
|
+
content: r(a.compiledHtml),
|
|
52
|
+
css: r(a.css),
|
|
49
53
|
unsubscriptionPreferencePageStatus: !1,
|
|
50
54
|
unsubscriptionPreferencePages: [],
|
|
51
|
-
recommendationCampaignUrls:
|
|
52
|
-
|
|
55
|
+
recommendationCampaignUrls: r(
|
|
56
|
+
N().recommendationCampaignUrls
|
|
53
57
|
),
|
|
54
|
-
recommendationConfigs:
|
|
58
|
+
recommendationConfigs: r({}),
|
|
55
59
|
isGuido: !0,
|
|
56
|
-
|
|
60
|
+
// eslint-disable-next-line camelcase
|
|
61
|
+
template_engine: p("liquidSyntax") ? 1 : 0,
|
|
62
|
+
stripoConfig: r({
|
|
57
63
|
editor: "stripo",
|
|
58
|
-
html:
|
|
59
|
-
css:
|
|
64
|
+
html: a.rawHtml,
|
|
65
|
+
css: a.css
|
|
60
66
|
})
|
|
61
|
-
}, { data: { type:
|
|
67
|
+
}, { data: { type: T } } = await m(
|
|
62
68
|
"/newsletter/template-library/create-template",
|
|
63
|
-
|
|
69
|
+
f
|
|
64
70
|
);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
i({
|
|
76
|
-
message: p(
|
|
71
|
+
return T === "alert" ? (l({
|
|
72
|
+
message: u(
|
|
73
|
+
"newsletter.template-library-save-alert",
|
|
74
|
+
{ templateName: s.getTemplateName }
|
|
75
|
+
),
|
|
76
|
+
type: "alert"
|
|
77
|
+
}), !1) : (l({
|
|
78
|
+
message: u(
|
|
77
79
|
"newsletter.template-library-save-success",
|
|
78
|
-
{ templateName:
|
|
80
|
+
{ templateName: s.getTemplateName }
|
|
79
81
|
),
|
|
80
82
|
type: "success"
|
|
81
|
-
});
|
|
82
|
-
} catch (
|
|
83
|
-
o(
|
|
83
|
+
}), !0);
|
|
84
|
+
} catch (i) {
|
|
85
|
+
return o(i, "Failed to create template"), !1;
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
};
|
|
87
89
|
};
|
|
88
90
|
export {
|
|
89
|
-
|
|
91
|
+
$ as useTemplateLibraryApi
|
|
90
92
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @param alignment - Currency alignment from block config: 'before' or 'after'
|
|
7
7
|
* @returns Formatted price string with currency variable in correct position
|
|
8
8
|
*/
|
|
9
|
-
export declare function formatPriceVariable(campaignId: string, productIndex: number, attribute: string, alignment: string): string;
|
|
9
|
+
export declare function formatPriceVariable(campaignId: string, productIndex: number, attribute: string, alignment: string, prefix?: string): string;
|
|
10
10
|
/**
|
|
11
11
|
* Transforms recommendation block HTML by replacing product data with
|
|
12
12
|
* template variables.
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { ConditionCategories } from '@@/Types/condition-categories';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Get display conditions lazily so translations resolve at access time.
|
|
4
|
+
* Must be called within a Vue component context or after Pinia is initialized.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getDisplayConditions: () => ConditionCategories;
|
|
@@ -3,7 +3,14 @@ import type { RecommendationFeedItem } from '@@/Types/recommendation';
|
|
|
3
3
|
export declare const URLS: {
|
|
4
4
|
RECOMMENDATION_API_URL: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const QUERY_PARAMS: {
|
|
7
|
+
CLIENT_ID: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Get recommendation feed source maps lazily so translated names resolve at access time.
|
|
11
|
+
* Must be called within a Vue component context or after Pinia is initialized.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getRecommendationFeedSourceMaps: () => RecommendationFeedItem[];
|
|
7
14
|
export declare const PriceAttributes: string[];
|
|
8
15
|
export declare const currencyLocationMaps: TextValueObject[];
|
|
9
16
|
export declare const currencyOperators: TextValueObject[];
|
|
@@ -13,9 +13,14 @@ export declare const URLS: {
|
|
|
13
13
|
PREFERENCES_URL: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const INSIDER_ID = "iid";
|
|
16
|
-
export declare const
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
export declare const DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID = "G";
|
|
17
|
+
/**
|
|
18
|
+
* Get the default unsubscribe group lazily so the translated name resolves at access time.
|
|
19
|
+
* Must be called within a Vue component context or after Pinia is initialized.
|
|
20
|
+
*/
|
|
21
|
+
export declare const getDefaultUnsubscribeGroup: () => {
|
|
22
|
+
name: string;
|
|
23
|
+
sendGridId: string;
|
|
19
24
|
};
|
|
20
25
|
export declare const UNSUBSCRIBE_PAGES_LINK = "/email/unsubscribe-pages";
|
|
21
26
|
export declare const PAGE_TYPES: {
|
|
@@ -3,5 +3,5 @@ export declare const useTemplateLibraryApi: () => {
|
|
|
3
3
|
getCategories: () => Promise<Category[]>;
|
|
4
4
|
checkTemplateNameAvailability: (value: string) => Promise<boolean>;
|
|
5
5
|
createCategory: (category: string) => Promise<string>;
|
|
6
|
-
createTemplate: () => Promise<
|
|
6
|
+
createTemplate: () => Promise<boolean>;
|
|
7
7
|
};
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
const
|
|
1
|
+
const n = `.amp-input-list,
|
|
2
2
|
.button,
|
|
3
3
|
.base-input,
|
|
4
4
|
ue-stripe-thumb,
|
|
5
5
|
.ue-stripe-thumb {
|
|
6
6
|
transition: all .5s ease;
|
|
7
7
|
}
|
|
8
|
+
|
|
9
|
+
:host {
|
|
10
|
+
height: 100% !important;
|
|
11
|
+
min-height: 0 !important;
|
|
12
|
+
}
|
|
8
13
|
`;
|
|
9
14
|
export {
|
|
10
|
-
|
|
15
|
+
n as default
|
|
11
16
|
};
|
|
@@ -1,44 +1,53 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useHtmlCompiler as
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useActionsApi as T } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useHtmlCompiler as P } from "../composables/useHtmlCompiler.js";
|
|
3
|
+
import { useRecommendationExtensionStore as A } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
|
+
import { DATA_ATTRIBUTES as l } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
5
|
+
import { parsePageList as h } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
6
|
+
import { useDynamicContentStore as C } from "../stores/dynamic-content.js";
|
|
7
|
+
import { useUnsubscribeStore as D } from "../stores/unsubscribe.js";
|
|
8
|
+
function x(i, e) {
|
|
9
|
+
const r = new DOMParser().parseFromString(i, "text/html").querySelectorAll(`[${l.PAGE_LIST}]`), n = [];
|
|
10
|
+
return r.forEach((t) => {
|
|
11
|
+
const o = t.getAttribute(l.PAGE_LIST);
|
|
12
|
+
o && n.push(...h(o));
|
|
13
|
+
}), e.filter((t) => n.includes(t));
|
|
14
|
+
}
|
|
15
|
+
const I = () => {
|
|
16
|
+
const i = C(), e = D(), { getCompiledEmail: a, getTemplateData: m } = T(), { compileHtml: r } = P();
|
|
8
17
|
return {
|
|
9
18
|
prepareTemplateDetails: async () => {
|
|
10
|
-
const { html:
|
|
19
|
+
const { html: t, ampHtml: o = "", ampErrors: p = [] } = await a({
|
|
11
20
|
minimize: !0,
|
|
12
21
|
resetDataSavedFlag: !1
|
|
13
|
-
}), { html:
|
|
22
|
+
}), { html: u, css: d, syncModulesIds: g = [] } = await m();
|
|
14
23
|
e.selectedUnsubscribePages.length && await e.fetchTemplates();
|
|
15
|
-
const { compiledHtml:
|
|
24
|
+
const { compiledHtml: c, stats: s, appliedRules: S } = r(t), b = i.getSelectedDynamicContentList, f = A();
|
|
16
25
|
return console.debug("HTML Compilation Stats:", {
|
|
17
|
-
originalSize:
|
|
18
|
-
compiledSize:
|
|
19
|
-
reduction: `${
|
|
20
|
-
appliedRules:
|
|
21
|
-
executionTime: `${
|
|
26
|
+
originalSize: s.originalSize,
|
|
27
|
+
compiledSize: s.compiledSize,
|
|
28
|
+
reduction: `${s.reductionPercentage.toFixed(2)}%`,
|
|
29
|
+
appliedRules: S,
|
|
30
|
+
executionTime: `${s.executionTime.toFixed(2)}ms`
|
|
22
31
|
}), {
|
|
23
|
-
dynamicContentList:
|
|
24
|
-
compiledHtml:
|
|
25
|
-
rawHtml:
|
|
26
|
-
css:
|
|
27
|
-
ampHtml:
|
|
28
|
-
ampErrors:
|
|
29
|
-
modules:
|
|
32
|
+
dynamicContentList: b,
|
|
33
|
+
compiledHtml: c,
|
|
34
|
+
rawHtml: u,
|
|
35
|
+
css: d,
|
|
36
|
+
ampHtml: o,
|
|
37
|
+
ampErrors: p,
|
|
38
|
+
modules: g.map(Number),
|
|
30
39
|
recommendation: {
|
|
31
|
-
campaignUrls:
|
|
40
|
+
campaignUrls: f.recommendationCampaignUrls,
|
|
32
41
|
configs: {}
|
|
33
42
|
},
|
|
34
43
|
unsubscribe: {
|
|
35
44
|
status: e.unsubscribePagesStatus,
|
|
36
|
-
config: e.selectedUnsubscribePages
|
|
45
|
+
config: x(c, e.selectedUnsubscribePages)
|
|
37
46
|
}
|
|
38
47
|
};
|
|
39
48
|
}
|
|
40
49
|
};
|
|
41
50
|
};
|
|
42
51
|
export {
|
|
43
|
-
|
|
52
|
+
I as useTemplatePreparation
|
|
44
53
|
};
|
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.e4aa789",
|
|
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",
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@stripoinc/ui-editor-extensions": "3.5.0",
|
|
36
36
|
"@useinsider/design-system-vue": "1.1.0-beta.73ec2fa",
|
|
37
|
-
"@useinsider/guido": "3.1.1-beta.22d798c",
|
|
38
37
|
"@vueuse/core": "11.3.0",
|
|
39
38
|
"lodash-es": "4.17.21",
|
|
40
39
|
"pinia": "2.3.1",
|