@useinsider/guido 3.21.1-beta.9127957 → 3.21.1-beta.985017f
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/composables/useSave.js +68 -75
- package/dist/services/templateLibraryApi.js +31 -36
- package/dist/src/utils/templatePreparation.d.ts +1 -2
- package/dist/utils/templatePreparation.js +30 -30
- package/package.json +1 -1
- package/dist/composables/validators/useHtmlDocumentCountValidator.js +0 -22
- package/dist/src/composables/validators/useHtmlDocumentCountValidator.d.ts +0 -3
|
@@ -1,91 +1,84 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useEditorLock as
|
|
4
|
-
import { useSaveStart as
|
|
5
|
-
import { useSaveValidation as
|
|
6
|
-
import { useSaveValidationRollout as
|
|
7
|
-
import { useSyncModuleExtractor as
|
|
8
|
-
import { ToasterTypeOptions as
|
|
9
|
-
import { useStripoApi as
|
|
10
|
-
import { useConfigStore as
|
|
11
|
-
import { useDynamicContentStore as
|
|
12
|
-
import { useSaveValidationStore as
|
|
13
|
-
import { useTemplatePreparation as
|
|
14
|
-
import { useAllowlist as
|
|
15
|
-
import { useHtmlValidator as
|
|
16
|
-
import { useToaster as
|
|
17
|
-
import { useCouponBlockValidator as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
if (!v("allowlistEnabled"))
|
|
1
|
+
import { useActionsApi as R } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as q } from "./useConfig.js";
|
|
3
|
+
import { useEditorLock as O } from "./useEditorLock.js";
|
|
4
|
+
import { useSaveStart as D, useSaveComplete as F } from "./useGuidoActions.js";
|
|
5
|
+
import { useSaveValidation as j } from "./useSaveValidation.js";
|
|
6
|
+
import { useSaveValidationRollout as z } from "./useSaveValidationRollout.js";
|
|
7
|
+
import { useSyncModuleExtractor as G } from "./useSyncModuleExtractor.js";
|
|
8
|
+
import { ToasterTypeOptions as I } from "../enums/toaster.js";
|
|
9
|
+
import { useStripoApi as J } from "../services/stripoApi.js";
|
|
10
|
+
import { useConfigStore as K } from "../stores/config.js";
|
|
11
|
+
import { useDynamicContentStore as N } from "../stores/dynamic-content.js";
|
|
12
|
+
import { useSaveValidationStore as Q } from "../stores/save-validation.js";
|
|
13
|
+
import { useTemplatePreparation as X, getHtmlReferencedUnsubscribePages as Y } from "../utils/templatePreparation.js";
|
|
14
|
+
import { useAllowlist as Z } from "./useAllowlist.js";
|
|
15
|
+
import { useHtmlValidator as _ } from "./useHtmlValidator.js";
|
|
16
|
+
import { useToaster as $ } from "./useToaster.js";
|
|
17
|
+
import { useCouponBlockValidator as tt } from "./validators/useCouponBlockValidator.js";
|
|
18
|
+
import { useLiquidValidator as et } from "./validators/useLiquidValidator.js";
|
|
19
|
+
import { useSyncModuleBlockValidator as ot } from "./validators/useSyncModuleBlockValidator.js";
|
|
20
|
+
import { useUnsubscribeBlockValidator as st } from "./validators/useUnsubscribeBlockValidator.js";
|
|
21
|
+
const Bt = () => {
|
|
22
|
+
const a = D(), p = F(), { validateHtml: v } = _(), { validateLiquidSyntax: S } = et(), { validateCouponBlockTags: y } = tt(), { validateUnsubscribeBlockUniqueness: w, validateUnsubscribeBlockHasTemplate: E } = st(), { validateSyncModuleBlocks: n } = ot(), { callbacks: r, isFeatureEnabled: d } = q(), { extractSyncModuleData: b } = G(), { setSyncModuleUnsubscriptionPages: g } = J(), { editorSave: H, getTemplateData: V } = R(), { showToaster: x } = $(), { getBlockedDomains: k, resolveToast: C } = Z(), { prepareTemplateDetails: m } = X(), { collectSaveValidationErrors: B } = j(), { isEnabled: h } = z(), T = Q(), P = N(), f = K(), { runExclusive: l } = O(), c = async (t, e, o) => {
|
|
23
|
+
if (!d("allowlistEnabled"))
|
|
25
24
|
return !1;
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
25
|
+
const i = await k(t, e);
|
|
26
|
+
if (!i.length)
|
|
28
27
|
return !1;
|
|
29
|
-
if (!
|
|
30
|
-
const s = await
|
|
31
|
-
s != null && s.message &&
|
|
32
|
-
type:
|
|
28
|
+
if (!o) {
|
|
29
|
+
const s = await C(i);
|
|
30
|
+
s != null && s.message && x({
|
|
31
|
+
type: I.Warning,
|
|
33
32
|
message: s.message,
|
|
34
33
|
actionButton: s.actionButton
|
|
35
34
|
});
|
|
36
35
|
}
|
|
37
36
|
return !0;
|
|
38
|
-
},
|
|
39
|
-
if (!await
|
|
37
|
+
}, L = async (t) => !y(t.compiledHtml) || !w(t.compiledHtml) || !E(t.compiledHtml) ? !1 : d("liquidSyntax") ? S(t.compiledHtml) : v(t.compiledHtml, t.dynamicContentList, !0), u = async (t, e) => {
|
|
38
|
+
if (!await H())
|
|
40
39
|
return;
|
|
41
|
-
const { unsubscribePayload:
|
|
42
|
-
if (await
|
|
43
|
-
const
|
|
44
|
-
|
|
40
|
+
const { unsubscribePayload: i, stripoModules: s } = b(t.rawHtml);
|
|
41
|
+
if (await g(i), t.modules = s, !e.suppress) {
|
|
42
|
+
const W = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
|
|
43
|
+
p({ ...t, ...W, silent: e.silent });
|
|
45
44
|
}
|
|
46
45
|
return t;
|
|
47
|
-
},
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (l(o.rawHtml, e)) {
|
|
55
|
-
if (P.value && !e) {
|
|
56
|
-
const a = await T(
|
|
46
|
+
}, U = async (t, e) => {
|
|
47
|
+
var i;
|
|
48
|
+
a();
|
|
49
|
+
const o = await m();
|
|
50
|
+
if (n(o.rawHtml, e)) {
|
|
51
|
+
if (h.value && !e) {
|
|
52
|
+
const s = await B(
|
|
57
53
|
o.compiledHtml,
|
|
58
54
|
o.dynamicContentList
|
|
59
55
|
);
|
|
60
|
-
if (
|
|
61
|
-
|
|
56
|
+
if (s.length) {
|
|
57
|
+
T.open(s, "save");
|
|
62
58
|
return;
|
|
63
59
|
}
|
|
64
|
-
} else if (!await
|
|
60
|
+
} else if (!await L(o))
|
|
65
61
|
return;
|
|
66
|
-
if (!((
|
|
67
|
-
return
|
|
62
|
+
if (!((i = r.value) != null && i.externalValidation && !await r.value.externalValidation(o)) && !await c(o.compiledHtml, o.css, e))
|
|
63
|
+
return u(o, { silent: e, suppress: t });
|
|
68
64
|
}
|
|
69
|
-
},
|
|
70
|
-
var
|
|
71
|
-
if (!
|
|
72
|
-
return;
|
|
73
|
-
n();
|
|
74
|
-
const t = await u();
|
|
75
|
-
if (!c(t.html, !1))
|
|
65
|
+
}, A = async () => {
|
|
66
|
+
var e;
|
|
67
|
+
if (!f.allowSaveWithErrors)
|
|
76
68
|
return;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
69
|
+
a();
|
|
70
|
+
const t = await m();
|
|
71
|
+
if (n(t.rawHtml, !1) && !((e = r.value) != null && e.externalValidation && !await r.value.externalValidation(t)) && !await c(t.compiledHtml, t.css, !1))
|
|
72
|
+
return u(t, { silent: !1, blankCompiled: !0 });
|
|
73
|
+
}, M = async () => {
|
|
74
|
+
if (!f.allowSaveWithErrors)
|
|
82
75
|
return;
|
|
83
|
-
|
|
84
|
-
const { html: t, css: e } = await
|
|
85
|
-
if (!
|
|
76
|
+
a();
|
|
77
|
+
const { html: t, css: e } = await V();
|
|
78
|
+
if (!n(t, !0) || await c(t, e, !0))
|
|
86
79
|
return;
|
|
87
|
-
const
|
|
88
|
-
dynamicContentList:
|
|
80
|
+
const o = Y(t), i = {
|
|
81
|
+
dynamicContentList: P.getSelectedDynamicContentList,
|
|
89
82
|
compiledHtml: "",
|
|
90
83
|
rawHtml: t,
|
|
91
84
|
css: e,
|
|
@@ -95,16 +88,16 @@ const Pt = () => {
|
|
|
95
88
|
// No campaignUrls: hosts overwrite their stored map with any object, and raw HTML can't rebuild it.
|
|
96
89
|
recommendation: { configs: {} },
|
|
97
90
|
unsubscribe: {
|
|
98
|
-
status:
|
|
99
|
-
config:
|
|
91
|
+
status: o.length > 0,
|
|
92
|
+
config: o
|
|
100
93
|
}
|
|
101
94
|
};
|
|
102
|
-
return
|
|
95
|
+
return u(i, { silent: !0 });
|
|
103
96
|
};
|
|
104
|
-
return { save: (t = !1, e = !1) =>
|
|
105
|
-
() =>
|
|
106
|
-
), saveWithErrors: () =>
|
|
97
|
+
return { save: (t = !1, e = !1) => l(
|
|
98
|
+
() => U(t, e)
|
|
99
|
+
), saveWithErrors: () => l(A), saveRawOnly: () => l(M) };
|
|
107
100
|
};
|
|
108
101
|
export {
|
|
109
|
-
|
|
102
|
+
Bt as useSave
|
|
110
103
|
};
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { useRecommendationExtensionStore as D } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
11
|
-
import { useSaveAsTemplateStore as L } from "../stores/save-as-template.js";
|
|
1
|
+
import { useConfig as w } from "../composables/useConfig.js";
|
|
2
|
+
import { useHttp as b } from "../composables/useHttp.js";
|
|
3
|
+
import { useToaster as C } from "../composables/useToaster.js";
|
|
4
|
+
import { useTranslations as h } 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 { ToasterTypeOptions as x } from "../enums/toaster.js";
|
|
8
|
+
import { useRecommendationExtensionStore as E } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
|
+
import { useSaveAsTemplateStore as N } from "../stores/save-as-template.js";
|
|
12
10
|
import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
|
|
13
|
-
import { isPlainObject as
|
|
14
|
-
import { useTemplatePreparation as
|
|
15
|
-
const
|
|
16
|
-
const { get: n, post: m } =
|
|
11
|
+
import { isPlainObject as P } from "../utils/genericUtil.js";
|
|
12
|
+
import { useTemplatePreparation as A } from "../utils/templatePreparation.js";
|
|
13
|
+
const B = () => {
|
|
14
|
+
const { get: n, post: m } = b(), { handleError: o, showToaster: l } = C(), { config: c, isFeatureEnabled: p } = w(), { validateLiquidSyntax: f } = S(), u = h();
|
|
17
15
|
return {
|
|
18
16
|
getCategories: async () => {
|
|
19
17
|
try {
|
|
20
18
|
const { data: e = [] } = await n("/newsletter/template-library/get-template-categories");
|
|
21
19
|
return e;
|
|
22
20
|
} catch (e) {
|
|
23
|
-
return
|
|
21
|
+
return o(e, "Failed to fetch template categories"), [];
|
|
24
22
|
}
|
|
25
23
|
},
|
|
26
24
|
checkTemplateNameAvailability: async (e) => {
|
|
@@ -37,30 +35,27 @@ const Z = () => {
|
|
|
37
35
|
);
|
|
38
36
|
return t.toString();
|
|
39
37
|
} catch (t) {
|
|
40
|
-
return
|
|
38
|
+
return o(t, "Failed to create category"), "";
|
|
41
39
|
}
|
|
42
40
|
},
|
|
43
41
|
createTemplate: async () => {
|
|
44
42
|
var e, t, d, y;
|
|
45
43
|
try {
|
|
46
|
-
const { prepareTemplateDetails: i } =
|
|
47
|
-
if (!
|
|
44
|
+
const { prepareTemplateDetails: i } = A(), s = N(), a = await i();
|
|
45
|
+
if (p("liquidSyntax") && !await f(a.compiledHtml))
|
|
48
46
|
return !1;
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const C = {
|
|
53
|
-
name: o.getTemplateName,
|
|
54
|
-
categories: o.getSelectedCategoryIds,
|
|
47
|
+
const T = {
|
|
48
|
+
name: s.getTemplateName,
|
|
49
|
+
categories: s.getSelectedCategoryIds,
|
|
55
50
|
productId: ((t = (e = c.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
|
|
56
|
-
editorType:
|
|
51
|
+
editorType: v,
|
|
57
52
|
messageType: ((y = (d = c.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
|
|
58
53
|
content: r(a.compiledHtml),
|
|
59
54
|
css: r(a.css),
|
|
60
55
|
unsubscriptionPreferencePageStatus: !1,
|
|
61
56
|
unsubscriptionPreferencePages: [],
|
|
62
57
|
recommendationCampaignUrls: r(
|
|
63
|
-
|
|
58
|
+
E().recommendationCampaignUrls
|
|
64
59
|
),
|
|
65
60
|
recommendationConfigs: r({}),
|
|
66
61
|
isGuido: !0,
|
|
@@ -72,31 +67,31 @@ const Z = () => {
|
|
|
72
67
|
css: a.css,
|
|
73
68
|
dynamicContentList: a.dynamicContentList
|
|
74
69
|
})
|
|
75
|
-
}, { data:
|
|
70
|
+
}, { data: g } = await m(
|
|
76
71
|
"/newsletter/template-library/create-template",
|
|
77
|
-
|
|
72
|
+
T
|
|
78
73
|
);
|
|
79
|
-
if (!
|
|
74
|
+
if (!P(g))
|
|
80
75
|
throw new Error("Unexpected create-template response");
|
|
81
|
-
return
|
|
76
|
+
return g.type === "alert" ? (l({
|
|
82
77
|
message: u(
|
|
83
78
|
"newsletter.template-library-save-alert",
|
|
84
|
-
{ templateName:
|
|
79
|
+
{ templateName: s.getTemplateName }
|
|
85
80
|
),
|
|
86
|
-
type:
|
|
81
|
+
type: x.Error
|
|
87
82
|
}), !1) : (l({
|
|
88
83
|
message: u(
|
|
89
84
|
"newsletter.template-library-save-success",
|
|
90
|
-
{ templateName:
|
|
85
|
+
{ templateName: s.getTemplateName }
|
|
91
86
|
),
|
|
92
87
|
type: "success"
|
|
93
88
|
}), !0);
|
|
94
89
|
} catch (i) {
|
|
95
|
-
return
|
|
90
|
+
return o(i, "Failed to create template"), !1;
|
|
96
91
|
}
|
|
97
92
|
}
|
|
98
93
|
};
|
|
99
94
|
};
|
|
100
95
|
export {
|
|
101
|
-
|
|
96
|
+
B as useTemplateLibraryApi
|
|
102
97
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { TemplateData } from '@@/Types/actions-api';
|
|
2
1
|
import type { SavedTemplateDetails } from '@@/Types/stripo';
|
|
3
2
|
/**
|
|
4
3
|
* Collects every unsubscribe page id referenced by the unsubscribe blocks
|
|
@@ -45,7 +44,7 @@ export declare function getHtmlReferencedUnsubscribePages(html: string): number[
|
|
|
45
44
|
*/
|
|
46
45
|
declare function hydrateRecommendationStoreFromRawHtml(rawHtml: string): Promise<void>;
|
|
47
46
|
export declare const useTemplatePreparation: () => {
|
|
48
|
-
prepareTemplateDetails: (
|
|
47
|
+
prepareTemplateDetails: () => Promise<Omit<SavedTemplateDetails, "metadata">>;
|
|
49
48
|
hydrateRecommendationStore: typeof hydrateRecommendationStoreFromRawHtml;
|
|
50
49
|
};
|
|
51
50
|
export {};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useHtmlCompiler as
|
|
1
|
+
import { useActionsApi as D } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useConfig as E } from "../composables/useConfig.js";
|
|
3
|
+
import { useHtmlCompiler as F } from "../composables/useHtmlCompiler.js";
|
|
4
4
|
import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
-
import { toBlockUrlConfig as
|
|
5
|
+
import { toBlockUrlConfig as I } from "../extensions/Blocks/Recommendation/utils/blockUrlConfig.js";
|
|
6
6
|
import { DATA_ATTRIBUTES as g } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
7
|
-
import { parsePageList as
|
|
8
|
-
import { useDynamicContentStore as
|
|
9
|
-
import { useEditorStore as
|
|
10
|
-
import { useUnsubscribeStore as
|
|
11
|
-
import { isPlainObject as
|
|
12
|
-
import { assignTrackingIds as
|
|
13
|
-
function
|
|
7
|
+
import { parsePageList as R } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
8
|
+
import { useDynamicContentStore as U } from "../stores/dynamic-content.js";
|
|
9
|
+
import { useEditorStore as L } from "../stores/editor.js";
|
|
10
|
+
import { useUnsubscribeStore as N } from "../stores/unsubscribe.js";
|
|
11
|
+
import { isPlainObject as v } from "./genericUtil.js";
|
|
12
|
+
import { assignTrackingIds as z } from "./linkTrackingIds.js";
|
|
13
|
+
function M(n) {
|
|
14
14
|
const r = new DOMParser().parseFromString(n, "text/html").querySelectorAll(`[${g.PAGE_LIST}]`), e = [];
|
|
15
15
|
return r.forEach((i) => {
|
|
16
16
|
const t = i.getAttribute(g.PAGE_LIST);
|
|
17
|
-
t && e.push(...
|
|
17
|
+
t && e.push(...R(t));
|
|
18
18
|
}), [...new Set(e)];
|
|
19
19
|
}
|
|
20
20
|
async function S(n) {
|
|
@@ -35,7 +35,7 @@ async function S(n) {
|
|
|
35
35
|
} catch {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
v(a) && r.seedBlockUrlConfig(t, I(a));
|
|
39
39
|
});
|
|
40
40
|
try {
|
|
41
41
|
await r.fetchRecommendationCreateData();
|
|
@@ -46,40 +46,40 @@ async function S(n) {
|
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
const
|
|
50
|
-
const n =
|
|
49
|
+
const Y = () => {
|
|
50
|
+
const n = U(), c = L(), o = N(), { getCompiledEmail: r, getTemplateData: e, updateHtmlAndCss: i } = D(), { compileHtml: t, compileAmpHtml: m } = F(), { isFeatureEnabled: a } = E();
|
|
51
51
|
return {
|
|
52
|
-
prepareTemplateDetails: async (
|
|
53
|
-
let { html: s, css: u, syncModulesIds:
|
|
52
|
+
prepareTemplateDetails: async () => {
|
|
53
|
+
let { html: s, css: u, syncModulesIds: h = [] } = await e();
|
|
54
54
|
if (a("linkTrackingIds"))
|
|
55
55
|
try {
|
|
56
|
-
const { html: d, changed:
|
|
57
|
-
c.trackIdSessionFloor =
|
|
56
|
+
const { html: d, changed: P, nextSeq: x } = z(s, c.trackIdSessionFloor);
|
|
57
|
+
c.trackIdSessionFloor = x, P && (s = d, await i(d, u));
|
|
58
58
|
} catch (d) {
|
|
59
59
|
console.error("Tracking-id step failed, saving anyway:", d);
|
|
60
60
|
}
|
|
61
|
-
const { html:
|
|
61
|
+
const { html: y, ampHtml: p = "", ampErrors: T = [] } = await r({
|
|
62
62
|
minimize: !0,
|
|
63
63
|
resetDataSavedFlag: !1
|
|
64
64
|
});
|
|
65
65
|
o.selectedUnsubscribePages.length && await o.fetchTemplates(), await S(s);
|
|
66
|
-
const { compiledHtml:
|
|
66
|
+
const { compiledHtml: A, stats: l, appliedRules: w } = t(y), C = p && m(p).compiledHtml, H = n.getSelectedDynamicContentList, k = b(), f = M(s);
|
|
67
67
|
return console.debug("HTML Compilation Stats:", {
|
|
68
68
|
originalSize: l.originalSize,
|
|
69
69
|
compiledSize: l.compiledSize,
|
|
70
70
|
reduction: `${l.reductionPercentage.toFixed(2)}%`,
|
|
71
|
-
appliedRules:
|
|
71
|
+
appliedRules: w,
|
|
72
72
|
executionTime: `${l.executionTime.toFixed(2)}ms`
|
|
73
73
|
}), {
|
|
74
|
-
dynamicContentList:
|
|
75
|
-
compiledHtml:
|
|
74
|
+
dynamicContentList: H,
|
|
75
|
+
compiledHtml: A,
|
|
76
76
|
rawHtml: s,
|
|
77
77
|
css: u,
|
|
78
|
-
ampHtml:
|
|
79
|
-
ampErrors:
|
|
80
|
-
modules:
|
|
78
|
+
ampHtml: C,
|
|
79
|
+
ampErrors: T,
|
|
80
|
+
modules: h.map(Number),
|
|
81
81
|
recommendation: {
|
|
82
|
-
campaignUrls:
|
|
82
|
+
campaignUrls: k.recommendationCampaignUrls,
|
|
83
83
|
configs: {}
|
|
84
84
|
},
|
|
85
85
|
unsubscribe: {
|
|
@@ -94,6 +94,6 @@ const Z = () => {
|
|
|
94
94
|
};
|
|
95
95
|
};
|
|
96
96
|
export {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
M as getHtmlReferencedUnsubscribePages,
|
|
98
|
+
Y as useTemplatePreparation
|
|
99
99
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.21.1-beta.
|
|
3
|
+
"version": "3.21.1-beta.985017f",
|
|
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,22 +0,0 @@
|
|
|
1
|
-
import { useToaster as i } from "../useToaster.js";
|
|
2
|
-
import { useTranslations as m } from "../useTranslations.js";
|
|
3
|
-
import { ToasterTypeOptions as c } from "../../enums/toaster.js";
|
|
4
|
-
const u = "newsletter.multiple-html-designs-detected", r = `(?:[^>"']|"[^"]*"|'[^']*')*`, a = "style|script|noscript|xmp|iframe|noembed|noframes|textarea|title", T = /<html(?=[\s>/])/gi, A = new RegExp(
|
|
5
|
-
`<!--[\\s\\S]*?-->|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>|<(${a})(?=[\\s/>])${r}>[\\s\\S]*?</\\1\\s*>|<([a-zA-Z][\\w:-]*)${r}>`,
|
|
6
|
-
"gi"
|
|
7
|
-
), p = (e) => Array.from(e.matchAll(A)).filter(([, , t]) => (t == null ? void 0 : t.toLowerCase()) === "html").length, g = () => {
|
|
8
|
-
const { showToaster: e } = i(), t = m();
|
|
9
|
-
return { validateSingleHtmlDocument: (o, l = !1) => {
|
|
10
|
-
var n;
|
|
11
|
-
if ((((n = o.match(T)) == null ? void 0 : n.length) ?? 0) < 2)
|
|
12
|
-
return !0;
|
|
13
|
-
const s = p(o);
|
|
14
|
-
return s <= 1 ? !0 : (console.debug("guido:save:blocked", { reason: "multiple-html-documents", htmlRootCount: s }), l || e({
|
|
15
|
-
type: c.Warning,
|
|
16
|
-
message: t(u)
|
|
17
|
-
}), !1);
|
|
18
|
-
} };
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
g as useHtmlDocumentCountValidator
|
|
22
|
-
};
|