@useinsider/guido 3.24.0-beta.2ad6e30 → 3.24.0-beta.3686ce3
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 +0 -1
- package/dist/@types/config/schemas.js +9 -11
- package/dist/composables/useActionsApi.js +2 -2
- package/dist/composables/useSave.js +52 -57
- package/dist/composables/useSaveValidation.js +110 -118
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +33 -48
- package/dist/enums/save-validation.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/@types/config/schemas.d.ts +0 -4
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useSaveValidation.d.ts +1 -1
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -4
- package/dist/src/enums/save-validation.d.ts +1 -2
- package/dist/src/stores/config.d.ts +0 -20
- package/dist/utils/templatePreparation.js +22 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -172,7 +172,6 @@ const config: GuidoConfigInput = {
|
|
|
172
172
|
allowSaveWithErrors?: boolean, // Default: true - Allow the validation drawer's "Save and Continue" soft-save. Set false to hard-block invalid saves (transactional + unsubscribe pages).
|
|
173
173
|
reusableRecommendationStrategy?: boolean, // Default: false - Assign an RRS strategy to recommendation blocks instead of per-block algorithm/filters/shuffle/product-count settings.
|
|
174
174
|
accessibilityTesting?: boolean, // Default: false - Show the Accessibility Test entry in the header kebab menu (Stripo's checker: contrast, image alternatives, colour-vision simulation) and the tab-bar onboarding tour that points at it.
|
|
175
|
-
blockUnsubscribeLinks?: boolean, // Default: false - Warn on save when the design carries an Insider unsubscribe link or code ({{ins-*-unsubscribe-link}}, <%asm_*_raw_url%>, <%unsub%>): the legacy save is rejected with a warning toaster; with the validation drawer on it is a warning row that "Save and Continue" can skip. Launch blocking is up to the host. Set true for accounts whose unsubscribes are managed outside Insider (SFMC).
|
|
176
175
|
},
|
|
177
176
|
|
|
178
177
|
// Optional: Callbacks
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModuleFolderDefaults as S } from "../../enums/defaults.js";
|
|
2
|
-
import { object as a, number as s, optional as e, string as t, picklist as m, pipe as i, minLength as
|
|
3
|
-
const
|
|
2
|
+
import { object as a, number as s, optional as e, string as t, picklist as m, pipe as i, minLength as b, custom as k, boolean as o, array as c, transform as y, unknown as r, record as g, fallback as R, literal as u, looseObject as C, variant as T, union as h, lazy as I } from "../../node_modules/valibot/dist/index.js";
|
|
3
|
+
const p = {
|
|
4
4
|
/** Promotional/marketing emails */
|
|
5
5
|
PROMOTIONAL: 1,
|
|
6
6
|
/** Transactional/system emails */
|
|
@@ -16,12 +16,12 @@ const b = {
|
|
|
16
16
|
/** Unique identifier for the template being edited */
|
|
17
17
|
templateId: i(
|
|
18
18
|
t(),
|
|
19
|
-
|
|
19
|
+
b(1, "templateId is required")
|
|
20
20
|
),
|
|
21
21
|
/** Unique identifier for the user editing the template */
|
|
22
22
|
userId: i(
|
|
23
23
|
t(),
|
|
24
|
-
|
|
24
|
+
b(1, "userId is required")
|
|
25
25
|
),
|
|
26
26
|
/** Optional variation ID for A/B testing */
|
|
27
27
|
variationId: e(t()),
|
|
@@ -42,7 +42,7 @@ const b = {
|
|
|
42
42
|
/** Partner/organization name (required) */
|
|
43
43
|
name: i(
|
|
44
44
|
t(),
|
|
45
|
-
|
|
45
|
+
b(1, "partner.name is required")
|
|
46
46
|
),
|
|
47
47
|
/** Product type identifier */
|
|
48
48
|
productType: e(
|
|
@@ -55,8 +55,8 @@ const b = {
|
|
|
55
55
|
),
|
|
56
56
|
/** Message type (promotional or transactional) */
|
|
57
57
|
messageType: e(
|
|
58
|
-
m([
|
|
59
|
-
|
|
58
|
+
m([p.PROMOTIONAL, p.TRANSACTIONAL]),
|
|
59
|
+
p.PROMOTIONAL
|
|
60
60
|
),
|
|
61
61
|
/** Display name for the current user */
|
|
62
62
|
username: e(t(), "Guido User"),
|
|
@@ -244,9 +244,7 @@ const b = {
|
|
|
244
244
|
linkTrackingIds: e(o(), !1),
|
|
245
245
|
/** Allow persisting a template that still has validation errors (drawer "Save and Continue" soft-save). Host sets false for transactional + unsubscribe. */
|
|
246
246
|
allowSaveWithErrors: e(o(), !0),
|
|
247
|
-
reusableRecommendationStrategy: e(o(), !1)
|
|
248
|
-
/** Warn on save when the design carries an Insider unsubscribe link or code (host sets true for SFMC accounts) */
|
|
249
|
-
blockUnsubscribeLinks: e(o(), !1)
|
|
247
|
+
reusableRecommendationStrategy: e(o(), !1)
|
|
250
248
|
}), w = m([
|
|
251
249
|
"amp-accordion",
|
|
252
250
|
"amp-carousel",
|
|
@@ -379,7 +377,7 @@ export {
|
|
|
379
377
|
K as GuidoConfigSchema,
|
|
380
378
|
A as IdentitySchema,
|
|
381
379
|
P as LegacyRecommendationConfigSchema,
|
|
382
|
-
|
|
380
|
+
p as MessageType,
|
|
383
381
|
E as PartnerSchema,
|
|
384
382
|
l as ProductType,
|
|
385
383
|
_ as RegexRuleSchema,
|
|
@@ -111,8 +111,8 @@ const H = 1e4, T = 3e4, m = (n, l, A) => new Promise((C, p) => {
|
|
|
111
111
|
}),
|
|
112
112
|
updateHtmlAndCss: (t, e) => {
|
|
113
113
|
const { actionsApi: i } = r();
|
|
114
|
-
return m("updateHtmlAndCss", H, (a) => {
|
|
115
|
-
i.updateHtmlAndCss(t, e, () => a());
|
|
114
|
+
return m("updateHtmlAndCss", H, (a, o) => {
|
|
115
|
+
i.updateHtmlAndCss(t, e, () => a(), o);
|
|
116
116
|
});
|
|
117
117
|
},
|
|
118
118
|
editorSave: () => m(
|
|
@@ -1,96 +1,91 @@
|
|
|
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
|
|
1
|
+
import { useActionsApi as q } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as O } from "./useConfig.js";
|
|
3
|
+
import { useEditorLock as D } from "./useEditorLock.js";
|
|
4
|
+
import { useSaveStart as F, useSaveComplete as j } from "./useGuidoActions.js";
|
|
5
|
+
import { useSaveValidation as z } from "./useSaveValidation.js";
|
|
6
|
+
import { useSaveValidationRollout as G } from "./useSaveValidationRollout.js";
|
|
7
|
+
import { useSyncModuleExtractor as I } from "./useSyncModuleExtractor.js";
|
|
8
8
|
import { ToasterTypeOptions as J } from "../enums/toaster.js";
|
|
9
9
|
import { useStripoApi as K } from "../services/stripoApi.js";
|
|
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 { useHtmlDocumentCountValidator as
|
|
19
|
-
import { useLiquidValidator as
|
|
20
|
-
import { useSyncModuleBlockValidator as
|
|
10
|
+
import { useConfigStore as N } from "../stores/config.js";
|
|
11
|
+
import { useDynamicContentStore as Q } from "../stores/dynamic-content.js";
|
|
12
|
+
import { useSaveValidationStore as X } from "../stores/save-validation.js";
|
|
13
|
+
import { useTemplatePreparation as Y, getHtmlReferencedUnsubscribePages as Z } from "../utils/templatePreparation.js";
|
|
14
|
+
import { useAllowlist as _ } from "./useAllowlist.js";
|
|
15
|
+
import { useHtmlValidator as $ } from "./useHtmlValidator.js";
|
|
16
|
+
import { useToaster as tt } from "./useToaster.js";
|
|
17
|
+
import { useCouponBlockValidator as et } from "./validators/useCouponBlockValidator.js";
|
|
18
|
+
import { useHtmlDocumentCountValidator as ot } from "./validators/useHtmlDocumentCountValidator.js";
|
|
19
|
+
import { useLiquidValidator as it } from "./validators/useLiquidValidator.js";
|
|
20
|
+
import { useSyncModuleBlockValidator as st } from "./validators/useSyncModuleBlockValidator.js";
|
|
21
21
|
import { useUnsubscribeBlockValidator as at } from "./validators/useUnsubscribeBlockValidator.js";
|
|
22
22
|
const Pt = () => {
|
|
23
|
-
const n =
|
|
24
|
-
|
|
25
|
-
validateUnsubscribeBlockHasTemplate: g,
|
|
26
|
-
validateNoInsiderUnsubscribeCode: V
|
|
27
|
-
} = at(), { validateSyncModuleBlocks: l } = rt(), { validateSingleHtmlDocument: c } = it(), { callbacks: a, isFeatureEnabled: u } = D(), { extractSyncModuleData: x } = G(), { setSyncModuleUnsubscriptionPages: k } = K(), { editorSave: C, getTemplateData: m } = O(), { showToaster: h } = et(), { getBlockedDomains: B, resolveToast: T } = $(), { prepareTemplateDetails: p } = Z(), { collectSaveValidationErrors: L } = j(), { isEnabled: P } = z(), U = Y(), A = X(), w = Q(), { runExclusive: d } = F(), f = async (t, e, i) => {
|
|
28
|
-
if (!u("allowlistEnabled"))
|
|
23
|
+
const n = F(), w = j(), { validateHtml: y } = $(), { validateLiquidSyntax: E } = it(), { validateCouponBlockTags: b } = et(), { validateUnsubscribeBlockUniqueness: g, validateUnsubscribeBlockHasTemplate: H } = at(), { validateSyncModuleBlocks: l } = st(), { validateSingleHtmlDocument: c } = ot(), { callbacks: r, isFeatureEnabled: v } = O(), { extractSyncModuleData: V } = I(), { setSyncModuleUnsubscriptionPages: x } = K(), { editorSave: C, getTemplateData: u } = q(), { showToaster: k } = tt(), { getBlockedDomains: h, resolveToast: B } = _(), { prepareTemplateDetails: p } = Y(), { collectSaveValidationErrors: T } = z(), { isEnabled: P } = G(), L = X(), U = Q(), S = N(), { runExclusive: m } = D(), d = async (t, e, i) => {
|
|
24
|
+
if (!v("allowlistEnabled"))
|
|
29
25
|
return !1;
|
|
30
|
-
const o = await
|
|
26
|
+
const o = await h(t, e);
|
|
31
27
|
if (!o.length)
|
|
32
28
|
return !1;
|
|
33
29
|
if (!i) {
|
|
34
|
-
const s = await
|
|
35
|
-
s != null && s.message &&
|
|
30
|
+
const s = await B(o);
|
|
31
|
+
s != null && s.message && k({
|
|
36
32
|
type: J.Warning,
|
|
37
33
|
message: s.message,
|
|
38
34
|
actionButton: s.actionButton
|
|
39
35
|
});
|
|
40
36
|
}
|
|
41
37
|
return !0;
|
|
42
|
-
},
|
|
38
|
+
}, A = async (t) => !b(t.compiledHtml) || !g(t.compiledHtml) || !H(t.compiledHtml) ? !1 : v("liquidSyntax") ? E(t.compiledHtml) : y(t.compiledHtml, t.dynamicContentList, !0), f = async (t, e) => {
|
|
43
39
|
if (!await C())
|
|
44
40
|
return;
|
|
45
|
-
const { unsubscribePayload: o, stripoModules: s } =
|
|
46
|
-
if (await
|
|
47
|
-
const
|
|
48
|
-
|
|
41
|
+
const { unsubscribePayload: o, stripoModules: s } = V(t.rawHtml);
|
|
42
|
+
if (await x(o), t.modules = s, !e.suppress) {
|
|
43
|
+
const a = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
|
|
44
|
+
w({ ...t, ...a, silent: e.silent });
|
|
49
45
|
}
|
|
50
46
|
return t;
|
|
51
|
-
},
|
|
47
|
+
}, M = async (t, e) => {
|
|
52
48
|
var s;
|
|
53
49
|
n();
|
|
54
|
-
const i = await
|
|
50
|
+
const i = await u();
|
|
55
51
|
if (!c(i.html, e))
|
|
56
52
|
return;
|
|
57
53
|
const o = await p(i);
|
|
58
54
|
if (l(o.rawHtml, e)) {
|
|
59
55
|
if (P.value && !e) {
|
|
60
|
-
const
|
|
56
|
+
const a = await T(
|
|
61
57
|
o.compiledHtml,
|
|
62
|
-
o.dynamicContentList
|
|
63
|
-
o.rawHtml
|
|
58
|
+
o.dynamicContentList
|
|
64
59
|
);
|
|
65
|
-
if (
|
|
66
|
-
|
|
60
|
+
if (a.length) {
|
|
61
|
+
L.open(a, "save");
|
|
67
62
|
return;
|
|
68
63
|
}
|
|
69
|
-
} else if (!await
|
|
64
|
+
} else if (!await A(o))
|
|
70
65
|
return;
|
|
71
|
-
if (!((s =
|
|
72
|
-
return
|
|
66
|
+
if (!((s = r.value) != null && s.externalValidation && !await r.value.externalValidation(o)) && !await d(o.compiledHtml, o.css, e))
|
|
67
|
+
return f(o, { silent: e, suppress: t });
|
|
73
68
|
}
|
|
74
|
-
},
|
|
69
|
+
}, W = async () => {
|
|
75
70
|
var i;
|
|
76
|
-
if (!
|
|
71
|
+
if (!S.allowSaveWithErrors)
|
|
77
72
|
return;
|
|
78
73
|
n();
|
|
79
|
-
const t = await
|
|
74
|
+
const t = await u();
|
|
80
75
|
if (!c(t.html, !1))
|
|
81
76
|
return;
|
|
82
77
|
const e = await p(t);
|
|
83
|
-
if (l(e.rawHtml, !1) && !((i =
|
|
84
|
-
return
|
|
85
|
-
},
|
|
86
|
-
if (!
|
|
78
|
+
if (l(e.rawHtml, !1) && !((i = r.value) != null && i.externalValidation && !await r.value.externalValidation(e)) && !await d(e.compiledHtml, e.css, !1))
|
|
79
|
+
return f(e, { silent: !1, blankCompiled: !0 });
|
|
80
|
+
}, R = async () => {
|
|
81
|
+
if (!S.allowSaveWithErrors)
|
|
87
82
|
return;
|
|
88
83
|
n();
|
|
89
|
-
const { html: t, css: e } = await
|
|
90
|
-
if (!c(t, !0) || !l(t, !0) || await
|
|
84
|
+
const { html: t, css: e } = await u();
|
|
85
|
+
if (!c(t, !0) || !l(t, !0) || await d(t, e, !0))
|
|
91
86
|
return;
|
|
92
|
-
const i =
|
|
93
|
-
dynamicContentList:
|
|
87
|
+
const i = Z(t), o = {
|
|
88
|
+
dynamicContentList: U.getSelectedDynamicContentList,
|
|
94
89
|
compiledHtml: "",
|
|
95
90
|
rawHtml: t,
|
|
96
91
|
css: e,
|
|
@@ -104,11 +99,11 @@ const Pt = () => {
|
|
|
104
99
|
config: i
|
|
105
100
|
}
|
|
106
101
|
};
|
|
107
|
-
return
|
|
102
|
+
return f(o, { silent: !0 });
|
|
108
103
|
};
|
|
109
|
-
return { save: (t = !1, e = !1) =>
|
|
110
|
-
() =>
|
|
111
|
-
), saveWithErrors: () =>
|
|
104
|
+
return { save: (t = !1, e = !1) => m(
|
|
105
|
+
() => M(t, e)
|
|
106
|
+
), saveWithErrors: () => m(W), saveRawOnly: () => m(R) };
|
|
112
107
|
};
|
|
113
108
|
export {
|
|
114
109
|
Pt as useSave
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { getIgnoredRecommendationBlockIds as Y } from "../config/compiler/utils/recommendationIgnoreUtils.js";
|
|
2
|
-
import { CanNotMakeAnyChangesForRunningKey as k, DISPLAY_CONDITIONS_REGEX as
|
|
2
|
+
import { CanNotMakeAnyChangesForRunningKey as k, DISPLAY_CONDITIONS_REGEX as x, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as M } from "../enums/html-validator.js";
|
|
3
3
|
import { SaveValidationRule as o } from "../enums/save-validation.js";
|
|
4
4
|
import { ToasterTypeOptions as r } from "../enums/toaster.js";
|
|
5
|
-
import { BLOCK_ROOT_SELECTOR as
|
|
6
|
-
import { itemsBlockDynamicVariables as
|
|
7
|
-
import { BLOCK_ROOT_SELECTOR as
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
5
|
+
import { BLOCK_ROOT_SELECTOR as U } from "../extensions/Blocks/Checkbox/constants/selectors.js";
|
|
6
|
+
import { itemsBlockDynamicVariables as P } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
7
|
+
import { BLOCK_ROOT_SELECTOR as W } from "../extensions/Blocks/RadioButton/constants/selectors.js";
|
|
8
|
+
import { useRecommendationExtensionStore as G } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
9
|
import { getInvalidFields as q, STRATEGY_FIELD_KEY as H, RecommendationAssignStrategyKey as V, RecommendationRequiredFieldsKey as X } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
10
10
|
import { useConfigStore as j } from "../stores/config.js";
|
|
11
11
|
import { useDynamicContentStore as z } from "../stores/dynamic-content.js";
|
|
@@ -20,9 +20,9 @@ import { buildPartnerAttributeNameSet as ne, getInvalidDynamicContentTags as ie,
|
|
|
20
20
|
import { useHttp as se } from "./useHttp.js";
|
|
21
21
|
import { useTranslations as ae } from "./useTranslations.js";
|
|
22
22
|
import { findInvalidCouponBlocks as ce, COUPON_TAG_MODIFIED_KEY as le } from "./validators/useCouponBlockValidator.js";
|
|
23
|
-
import {
|
|
24
|
-
const
|
|
25
|
-
function
|
|
23
|
+
import { findDuplicateUnsubPageTypes as me, countUnsubBlocksWithoutPage as ue, EMPTY_BLOCK_KEY as de } from "./validators/useUnsubscribeBlockValidator.js";
|
|
24
|
+
const pe = "newsletter.html-content-is-empty", ge = "custom-fields.missing-closing-braces", fe = "custom-fields.missing-opening-braces", S = "custom-fields.invalid-custom-fields", ye = "newsletter.display-conditions-invalid-syntax", Ee = "custom-conditions.wrong-equality-operators", Ie = "custom-conditions.missing-if-endif-tag", Se = "custom-conditions.no-space-after-braces", _e = "custom-conditions.no-braces-inside-if-tag", Ce = "newsletter.fill-all-necessary-fields", he = "newsletter.invalid-image-type", ke = "unsubscribe-templates.select-checkbox-groups", Te = "unsubscribe-templates.select-radio-button-groups", F = "newsletter.invalid-url-link-for-toaster", R = "journey-builder.liquid-validation-failed", Fe = "/newsletter/template-library/check-template-html-body", Re = /src="[^"]*\.(svg|pst)"/gm, L = /({%(.*?)%})/g, Oe = ["if", "endif", "else", "elif", "now"], Le = (t) => !Oe.includes(t.toLowerCase()), Ne = (t) => ["if", "endif"].includes(t.toLowerCase());
|
|
25
|
+
function be(t) {
|
|
26
26
|
return ce(t).map((i) => ({
|
|
27
27
|
rule: o.CouponTagModified,
|
|
28
28
|
type: r.Warning,
|
|
@@ -30,61 +30,54 @@ function De(t) {
|
|
|
30
30
|
detail: i
|
|
31
31
|
}));
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
33
|
+
function Ae(t) {
|
|
34
|
+
return me(t).map((i) => ({
|
|
35
35
|
rule: o.DuplicateUnsubBlock,
|
|
36
36
|
type: r.Error,
|
|
37
37
|
key: i.messageKey
|
|
38
38
|
}));
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
return Array.from({ length:
|
|
40
|
+
function ve(t) {
|
|
41
|
+
return Array.from({ length: ue(t) }, () => ({
|
|
42
42
|
rule: o.UnsubBlockMissingTemplate,
|
|
43
43
|
type: r.Warning,
|
|
44
|
-
key:
|
|
44
|
+
key: de
|
|
45
45
|
}));
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
return ue(t) ? [{
|
|
49
|
-
rule: o.ExternallyManagedUnsubscribe,
|
|
50
|
-
type: r.Warning,
|
|
51
|
-
key: me
|
|
52
|
-
}] : [];
|
|
53
|
-
}
|
|
54
|
-
function we(t, i) {
|
|
47
|
+
function De(t, i) {
|
|
55
48
|
const n = t.match(L);
|
|
56
49
|
if (!n)
|
|
57
50
|
return [];
|
|
58
|
-
const
|
|
59
|
-
return n.forEach((
|
|
60
|
-
const c =
|
|
51
|
+
const l = [];
|
|
52
|
+
return n.forEach((u) => {
|
|
53
|
+
const c = u.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
61
54
|
if (c && c.length > 0) {
|
|
62
55
|
const [d] = c;
|
|
63
|
-
|
|
56
|
+
Le(d) && !i.includes(d) && l.push({
|
|
64
57
|
rule: o.CustomFieldScript,
|
|
65
58
|
type: r.Warning,
|
|
66
59
|
key: S,
|
|
67
60
|
detail: d
|
|
68
61
|
});
|
|
69
62
|
}
|
|
70
|
-
}),
|
|
63
|
+
}), l;
|
|
71
64
|
}
|
|
72
|
-
function
|
|
73
|
-
return t.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key:
|
|
65
|
+
function Ke(t) {
|
|
66
|
+
return t.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: pe }];
|
|
74
67
|
}
|
|
75
|
-
function
|
|
68
|
+
function we(t) {
|
|
76
69
|
const i = (t.match(/{/gm) || []).length, n = (t.match(/}/gm) || []).length;
|
|
77
70
|
return i > n ? [{
|
|
78
71
|
rule: o.MismatchedBraces,
|
|
79
72
|
type: r.Warning,
|
|
80
|
-
key:
|
|
73
|
+
key: ge
|
|
81
74
|
}] : i < n ? [{
|
|
82
75
|
rule: o.MismatchedBraces,
|
|
83
76
|
type: r.Warning,
|
|
84
|
-
key:
|
|
77
|
+
key: fe
|
|
85
78
|
}] : [];
|
|
86
79
|
}
|
|
87
|
-
function
|
|
80
|
+
function Be(t) {
|
|
88
81
|
return ie(t).map((i) => ({
|
|
89
82
|
rule: o.InvalidDynamicTag,
|
|
90
83
|
type: r.Warning,
|
|
@@ -92,75 +85,75 @@ function Me(t) {
|
|
|
92
85
|
detail: i
|
|
93
86
|
}));
|
|
94
87
|
}
|
|
95
|
-
function
|
|
96
|
-
const
|
|
97
|
-
return re(t, i,
|
|
88
|
+
function Ye(t, i, n, l) {
|
|
89
|
+
const u = oe(t);
|
|
90
|
+
return re(t, i, u, n, l).map((c) => ({
|
|
98
91
|
rule: o.InvalidCustomField,
|
|
99
92
|
type: r.Error,
|
|
100
93
|
key: S,
|
|
101
94
|
detail: c
|
|
102
95
|
}));
|
|
103
96
|
}
|
|
104
|
-
function
|
|
105
|
-
const i = t.match(/{%(.*?)%}/g), n = [],
|
|
106
|
-
if (i && i.forEach((
|
|
107
|
-
const c =
|
|
108
|
-
(!c ||
|
|
97
|
+
function xe(t) {
|
|
98
|
+
const i = t.match(/{%(.*?)%}/g), n = [], l = [];
|
|
99
|
+
if (i && i.forEach((u) => {
|
|
100
|
+
const c = u.match(x), d = u.match(M), I = (c == null ? void 0 : c.join("")) || "";
|
|
101
|
+
(!c || u !== I) && !d && l.push({
|
|
109
102
|
rule: o.ConditionsSyntax,
|
|
110
103
|
type: r.Error,
|
|
111
|
-
key:
|
|
112
|
-
detail:
|
|
104
|
+
key: ye,
|
|
105
|
+
detail: u
|
|
113
106
|
}), c && c.forEach((g) => {
|
|
114
|
-
g.trim() === "=" &&
|
|
107
|
+
g.trim() === "=" && l.push({
|
|
115
108
|
rule: o.WrongEqualityOperator,
|
|
116
109
|
type: r.Error,
|
|
117
|
-
key:
|
|
110
|
+
key: Ee
|
|
118
111
|
}), (g.match(/^[a-zA-Z]*$/g) ?? []).forEach((f) => {
|
|
119
|
-
|
|
112
|
+
Ne(f) && n.push(f);
|
|
120
113
|
});
|
|
121
114
|
});
|
|
122
115
|
}), n.length) {
|
|
123
|
-
const
|
|
124
|
-
|
|
116
|
+
const u = n.filter((d) => d === "if").length, c = n.filter((d) => d === "endif").length;
|
|
117
|
+
u !== c && l.push({
|
|
125
118
|
rule: o.MissingIfEndif,
|
|
126
119
|
type: r.Error,
|
|
127
|
-
key:
|
|
120
|
+
key: Ie
|
|
128
121
|
});
|
|
129
122
|
}
|
|
130
|
-
return
|
|
123
|
+
return l;
|
|
131
124
|
}
|
|
132
|
-
function
|
|
125
|
+
function Me(t) {
|
|
133
126
|
const i = (t.match(/{% /gm) || []).length, n = (t.match(/ %}/gm) || []).length;
|
|
134
127
|
return i === n ? [] : [{
|
|
135
128
|
rule: o.ConditionTagSpacing,
|
|
136
129
|
type: r.Warning,
|
|
137
|
-
key:
|
|
130
|
+
key: Se
|
|
138
131
|
}];
|
|
139
132
|
}
|
|
140
|
-
function
|
|
141
|
-
return (t.match(L) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n,
|
|
133
|
+
function Ue(t) {
|
|
134
|
+
return (t.match(L) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, l) => n + l, 0) === 0 ? [] : [{
|
|
142
135
|
rule: o.BracesInsideIfTag,
|
|
143
136
|
type: r.Warning,
|
|
144
|
-
key:
|
|
137
|
+
key: _e
|
|
145
138
|
}];
|
|
146
139
|
}
|
|
147
|
-
function
|
|
148
|
-
return (t.match(
|
|
140
|
+
function Pe(t) {
|
|
141
|
+
return (t.match(Re) ?? []).map((i) => ({
|
|
149
142
|
rule: o.InvalidImageType,
|
|
150
143
|
type: r.Error,
|
|
151
|
-
key:
|
|
144
|
+
key: he,
|
|
152
145
|
detail: i
|
|
153
146
|
}));
|
|
154
147
|
}
|
|
155
|
-
function
|
|
156
|
-
const
|
|
157
|
-
return Array.from(
|
|
148
|
+
function O(t, i, n, l) {
|
|
149
|
+
const u = new DOMParser().parseFromString(t, "text/html");
|
|
150
|
+
return Array.from(u.querySelectorAll(i)).filter((c) => {
|
|
158
151
|
var d;
|
|
159
152
|
return !((d = c.id) != null && d.trim());
|
|
160
|
-
}).map(() => ({ rule: n, type: r.Error, key:
|
|
153
|
+
}).map(() => ({ rule: n, type: r.Error, key: l }));
|
|
161
154
|
}
|
|
162
|
-
const
|
|
163
|
-
const { config: t, isFeatureEnabled: i } = ee(), n = ae(), { post:
|
|
155
|
+
const dt = () => {
|
|
156
|
+
const { config: t, isFeatureEnabled: i } = ee(), n = ae(), { post: l } = se(), { getCompiledEmail: u, getTemplateData: c } = J(), { compileHtml: d } = te(), { hydrateRecommendationStore: I } = Z(), g = z(), f = $(), y = G(), N = j(), b = (e) => ({
|
|
164
157
|
rule: e.rule,
|
|
165
158
|
type: e.type,
|
|
166
159
|
detail: e.detail,
|
|
@@ -174,24 +167,24 @@ const ft = () => {
|
|
|
174
167
|
return null;
|
|
175
168
|
}
|
|
176
169
|
return ne(y.filterList);
|
|
177
|
-
},
|
|
170
|
+
}, v = async (e) => {
|
|
178
171
|
try {
|
|
179
|
-
const
|
|
180
|
-
return
|
|
172
|
+
const s = await l(Fe, { html: T(e) }), { status: a, message: m } = s.data, p = [], E = a === void 0 && !!m && m !== n(F);
|
|
173
|
+
return a || p.push({
|
|
181
174
|
rule: o.InvalidLinks,
|
|
182
175
|
type: r.Error,
|
|
183
|
-
...E ? { message:
|
|
184
|
-
}),
|
|
176
|
+
...E ? { message: m } : { key: F }
|
|
177
|
+
}), m === n(k) && p.push({
|
|
185
178
|
rule: o.LinkCheckInProgress,
|
|
186
179
|
type: r.Error,
|
|
187
180
|
key: k
|
|
188
181
|
}), p;
|
|
189
|
-
} catch (
|
|
190
|
-
return console.warn("Link-check collector failed; skipping the link rule.",
|
|
182
|
+
} catch (s) {
|
|
183
|
+
return console.warn("Link-check collector failed; skipping the link rule.", s), [];
|
|
191
184
|
}
|
|
192
|
-
},
|
|
185
|
+
}, D = async (e) => {
|
|
193
186
|
try {
|
|
194
|
-
const
|
|
187
|
+
const s = await l("/newsletter/contents/validate-syntax", [{
|
|
195
188
|
identifier: "default",
|
|
196
189
|
syntax: "liquid",
|
|
197
190
|
contents: {
|
|
@@ -201,89 +194,88 @@ const ft = () => {
|
|
|
201
194
|
ampHtml: null
|
|
202
195
|
}
|
|
203
196
|
}]);
|
|
204
|
-
if (!Array.isArray(
|
|
205
|
-
const
|
|
197
|
+
if (!Array.isArray(s.data)) {
|
|
198
|
+
const m = s.data;
|
|
206
199
|
return [{
|
|
207
200
|
rule: o.LiquidSyntax,
|
|
208
201
|
type: r.Warning,
|
|
209
|
-
message:
|
|
202
|
+
message: m.message ?? n(R)
|
|
210
203
|
}];
|
|
211
204
|
}
|
|
212
|
-
const [
|
|
213
|
-
return Object.values((
|
|
205
|
+
const [a] = s.data;
|
|
206
|
+
return Object.values((a == null ? void 0 : a.errors) ?? {}).map((m) => ({
|
|
214
207
|
rule: o.LiquidSyntax,
|
|
215
208
|
type: r.Warning,
|
|
216
|
-
message:
|
|
209
|
+
message: m.replace(/^line \d+:\s*/, "")
|
|
217
210
|
}));
|
|
218
|
-
} catch (
|
|
219
|
-
if (
|
|
220
|
-
throw
|
|
211
|
+
} catch (s) {
|
|
212
|
+
if (s != null && s.authReported)
|
|
213
|
+
throw s;
|
|
221
214
|
return [{
|
|
222
215
|
rule: o.LiquidSyntax,
|
|
223
216
|
type: r.Error,
|
|
224
|
-
message: n(
|
|
217
|
+
message: n(R)
|
|
225
218
|
}];
|
|
226
219
|
}
|
|
227
220
|
}, K = () => {
|
|
228
|
-
const e = Object.values(y.blockStates).map((
|
|
229
|
-
const
|
|
221
|
+
const e = Object.values(y.blockStates).map((a) => q(a.recommendationConfigs, y)).filter((a) => a.length > 0).map((a) => {
|
|
222
|
+
const m = a.every((p) => p === H);
|
|
230
223
|
return {
|
|
231
224
|
rule: o.RecommendationRequiredFields,
|
|
232
|
-
type:
|
|
233
|
-
key:
|
|
225
|
+
type: m ? r.Warning : r.Error,
|
|
226
|
+
key: m ? V : X
|
|
234
227
|
};
|
|
235
|
-
}),
|
|
228
|
+
}), s = (f.recommendationConfigs ?? []).filter((a) => a.filters.some((m) => m.value === "")).map(() => ({
|
|
236
229
|
rule: o.RecommendationFilters,
|
|
237
230
|
type: r.Error,
|
|
238
|
-
key:
|
|
231
|
+
key: Ce
|
|
239
232
|
}));
|
|
240
|
-
return [...e, ...
|
|
241
|
-
},
|
|
233
|
+
return [...e, ...s];
|
|
234
|
+
}, w = async (e, s) => {
|
|
242
235
|
var C, h;
|
|
243
|
-
const
|
|
244
|
-
...
|
|
245
|
-
...
|
|
236
|
+
const a = [
|
|
237
|
+
...s.map((B) => B.value),
|
|
238
|
+
...P,
|
|
246
239
|
...((h = (C = t.value) == null ? void 0 : C.template) == null ? void 0 : h.customFieldAttributes) ?? []
|
|
247
|
-
],
|
|
240
|
+
], m = Y(e), p = await A(m), { isTransactional: E } = N;
|
|
248
241
|
return [
|
|
249
|
-
...await
|
|
250
|
-
...E ? [] :
|
|
251
|
-
...
|
|
252
|
-
...
|
|
242
|
+
...await v(e),
|
|
243
|
+
...E ? [] : De(e, a),
|
|
244
|
+
...Ke(e),
|
|
245
|
+
...we(e),
|
|
246
|
+
...Be(e),
|
|
247
|
+
...E ? [] : Ye(e, a, m, p),
|
|
248
|
+
...xe(e),
|
|
253
249
|
...Me(e),
|
|
254
|
-
...
|
|
255
|
-
...We(e),
|
|
256
|
-
...Ge(e),
|
|
257
|
-
...Pe(e),
|
|
250
|
+
...Ue(e),
|
|
258
251
|
...K(),
|
|
259
|
-
...
|
|
260
|
-
...
|
|
252
|
+
...Pe(e),
|
|
253
|
+
...O(
|
|
261
254
|
e,
|
|
262
|
-
|
|
255
|
+
U,
|
|
263
256
|
o.CheckboxUnsubGroup,
|
|
264
|
-
|
|
257
|
+
ke
|
|
265
258
|
),
|
|
266
|
-
...
|
|
259
|
+
...O(
|
|
267
260
|
e,
|
|
268
|
-
|
|
261
|
+
W,
|
|
269
262
|
o.RadioButtonUnsubGroup,
|
|
270
|
-
|
|
263
|
+
Te
|
|
271
264
|
)
|
|
272
265
|
];
|
|
273
|
-
}, _ = async (e,
|
|
274
|
-
...
|
|
275
|
-
...
|
|
266
|
+
}, _ = async (e, s) => [
|
|
267
|
+
...be(e),
|
|
268
|
+
...Ae(e),
|
|
276
269
|
...ve(e),
|
|
277
|
-
...
|
|
278
|
-
|
|
279
|
-
].map(O);
|
|
270
|
+
...i("liquidSyntax") ? await D(e) : await w(e, s)
|
|
271
|
+
].map(b);
|
|
280
272
|
return { collectSaveValidationErrors: _, validateCurrentTemplate: async () => {
|
|
281
273
|
const { html: e } = await c();
|
|
282
274
|
await I(e);
|
|
283
|
-
const { html:
|
|
284
|
-
return _(
|
|
275
|
+
const { html: s } = await u({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: a } = d(s);
|
|
276
|
+
return _(a, g.getSelectedDynamicContentList);
|
|
285
277
|
} };
|
|
286
278
|
};
|
|
287
279
|
export {
|
|
288
|
-
|
|
280
|
+
dt as useSaveValidation
|
|
289
281
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ToasterTypeOptions as
|
|
2
|
-
import {
|
|
3
|
-
import { UNSUBSCRIBE_BLOCK_SELECTOR as
|
|
4
|
-
import { useToaster as
|
|
5
|
-
import { useTranslations as
|
|
1
|
+
import { ToasterTypeOptions as c } from "../../enums/toaster.js";
|
|
2
|
+
import { PAGE_TYPES as u } from "../../enums/unsubscribe.js";
|
|
3
|
+
import { UNSUBSCRIBE_BLOCK_SELECTOR as i, DATA_ATTRIBUTES as a } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
4
|
+
import { useToaster as p } from "../useToaster.js";
|
|
5
|
+
import { useTranslations as l } from "../useTranslations.js";
|
|
6
6
|
const T = [
|
|
7
7
|
{
|
|
8
8
|
pageType: u.GLOBAL_UNSUBSCRIBE,
|
|
@@ -12,52 +12,37 @@ const T = [
|
|
|
12
12
|
pageType: u.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
13
13
|
messageKey: "unsubscription-preference.duplicate-pref-center"
|
|
14
14
|
}
|
|
15
|
-
], g = "unsubscription-preference.duplicate-both",
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
], g = "unsubscription-preference.duplicate-both", E = "unsubscription-preference.select-page-to-continue";
|
|
16
|
+
function m(r) {
|
|
17
|
+
const s = new DOMParser().parseFromString(r, "text/html"), t = /* @__PURE__ */ new Map();
|
|
18
|
+
return s.querySelectorAll(i).forEach((n) => {
|
|
19
|
+
const e = Number(n.getAttribute(a.PAGE_TYPE));
|
|
20
|
+
t.set(e, (t.get(e) ?? 0) + 1);
|
|
21
|
+
}), T.filter((n) => (t.get(n.pageType) ?? 0) > 1);
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
const
|
|
24
|
-
return
|
|
25
|
-
const n =
|
|
26
|
-
|
|
27
|
-
}), T.filter((r) => (s.get(r.pageType) ?? 0) > 1);
|
|
28
|
-
}
|
|
29
|
-
function A(e) {
|
|
30
|
-
const t = new DOMParser().parseFromString(e, "text/html");
|
|
31
|
-
return Array.from(t.querySelectorAll(l)).filter((s) => {
|
|
32
|
-
const r = s.getAttribute(c.PAGE_TYPE), n = s.getAttribute(c.PAGE_LIST);
|
|
33
|
-
return !r || !n;
|
|
23
|
+
function b(r) {
|
|
24
|
+
const s = new DOMParser().parseFromString(r, "text/html");
|
|
25
|
+
return Array.from(s.querySelectorAll(i)).filter((t) => {
|
|
26
|
+
const n = t.getAttribute(a.PAGE_TYPE), e = t.getAttribute(a.PAGE_LIST);
|
|
27
|
+
return !n || !e;
|
|
34
28
|
}).length;
|
|
35
29
|
}
|
|
36
|
-
const
|
|
37
|
-
const { showToaster:
|
|
38
|
-
return {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
message: t(_)
|
|
49
|
-
}), !1),
|
|
50
|
-
validateNoInsiderUnsubscribeCode: (o, a = !1) => B(o) ? (a || e({
|
|
51
|
-
type: i.Warning,
|
|
52
|
-
message: t(m)
|
|
53
|
-
}), !1) : !0
|
|
54
|
-
};
|
|
30
|
+
const y = () => {
|
|
31
|
+
const { showToaster: r } = p(), s = l();
|
|
32
|
+
return { validateUnsubscribeBlockUniqueness: (e) => {
|
|
33
|
+
const o = m(e);
|
|
34
|
+
return o.length ? (r({
|
|
35
|
+
type: c.Error,
|
|
36
|
+
message: s(o.length > 1 ? g : o[0].messageKey)
|
|
37
|
+
}), !1) : !0;
|
|
38
|
+
}, validateUnsubscribeBlockHasTemplate: (e) => b(e) === 0 ? !0 : (r({
|
|
39
|
+
type: c.Warning,
|
|
40
|
+
message: s(E)
|
|
41
|
+
}), !1) };
|
|
55
42
|
};
|
|
56
43
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
B as hasInsiderUnsubscribeCode,
|
|
62
|
-
I as useUnsubscribeBlockValidator
|
|
44
|
+
E as EMPTY_BLOCK_KEY,
|
|
45
|
+
b as countUnsubBlocksWithoutPage,
|
|
46
|
+
m as findDuplicateUnsubPageTypes,
|
|
47
|
+
y as useUnsubscribeBlockValidator
|
|
63
48
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var n = /* @__PURE__ */ ((s) => (s.CouponTagModified = "coupon-tag-modified", s.DuplicateUnsubBlock = "duplicate-unsub-block", s.UnsubBlockMissingTemplate = "unsub-block-missing-template", s.LiquidSyntax = "liquid-syntax", s.InvalidLinks = "invalid-links", s.LinkCheckInProgress = "link-check-in-progress", s.CustomFieldScript = "custom-field-script", s.EmptyHtml = "empty-html", s.MismatchedBraces = "mismatched-braces", s.InvalidDynamicTag = "invalid-dynamic-tag", s.InvalidCustomField = "invalid-custom-field", s.ConditionsSyntax = "conditions-syntax", s.WrongEqualityOperator = "wrong-equality-operator", s.MissingIfEndif = "missing-if-endif", s.ConditionTagSpacing = "condition-tag-spacing", s.BracesInsideIfTag = "braces-inside-if-tag", s.RecommendationRequiredFields = "recommendation-required-fields", s.RecommendationFilters = "recommendation-filters", s.InvalidImageType = "invalid-image-type", s.CheckboxUnsubGroup = "checkbox-unsub-group", s.RadioButtonUnsubGroup = "radio-button-unsub-group", s
|
|
1
|
+
var n = /* @__PURE__ */ ((s) => (s.CouponTagModified = "coupon-tag-modified", s.DuplicateUnsubBlock = "duplicate-unsub-block", s.UnsubBlockMissingTemplate = "unsub-block-missing-template", s.LiquidSyntax = "liquid-syntax", s.InvalidLinks = "invalid-links", s.LinkCheckInProgress = "link-check-in-progress", s.CustomFieldScript = "custom-field-script", s.EmptyHtml = "empty-html", s.MismatchedBraces = "mismatched-braces", s.InvalidDynamicTag = "invalid-dynamic-tag", s.InvalidCustomField = "invalid-custom-field", s.ConditionsSyntax = "conditions-syntax", s.WrongEqualityOperator = "wrong-equality-operator", s.MissingIfEndif = "missing-if-endif", s.ConditionTagSpacing = "condition-tag-spacing", s.BracesInsideIfTag = "braces-inside-if-tag", s.RecommendationRequiredFields = "recommendation-required-fields", s.RecommendationFilters = "recommendation-filters", s.InvalidImageType = "invalid-image-type", s.CheckboxUnsubGroup = "checkbox-unsub-group", s.RadioButtonUnsubGroup = "radio-button-unsub-group", s))(n || {});
|
|
2
2
|
export {
|
|
3
3
|
n as SaveValidationRule
|
|
4
4
|
};
|
package/dist/package.json.js
CHANGED
|
@@ -415,8 +415,6 @@ export declare const FeaturesSchema: v.ObjectSchema<{
|
|
|
415
415
|
/** Allow persisting a template that still has validation errors (drawer "Save and Continue" soft-save). Host sets false for transactional + unsubscribe. */
|
|
416
416
|
readonly allowSaveWithErrors: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
417
417
|
readonly reusableRecommendationStrategy: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
418
|
-
/** Warn on save when the design carries an Insider unsubscribe link or code (host sets true for SFMC accounts) */
|
|
419
|
-
readonly blockUnsubscribeLinks: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
420
418
|
}, undefined>;
|
|
421
419
|
/**
|
|
422
420
|
* Default block types available in Stripo
|
|
@@ -836,8 +834,6 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
836
834
|
/** Allow persisting a template that still has validation errors (drawer "Save and Continue" soft-save). Host sets false for transactional + unsubscribe. */
|
|
837
835
|
readonly allowSaveWithErrors: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
838
836
|
readonly reusableRecommendationStrategy: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
839
|
-
/** Warn on save when the design carries an Insider unsubscribe link or code (host sets true for SFMC accounts) */
|
|
840
|
-
readonly blockUnsubscribeLinks: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
841
837
|
}, undefined>, {}>;
|
|
842
838
|
/** Block configuration */
|
|
843
839
|
readonly blocks: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -105,7 +105,6 @@ export declare const useConfig: () => {
|
|
|
105
105
|
linkTrackingIds: boolean;
|
|
106
106
|
allowSaveWithErrors: boolean;
|
|
107
107
|
reusableRecommendationStrategy: boolean;
|
|
108
|
-
blockUnsubscribeLinks: boolean;
|
|
109
108
|
};
|
|
110
109
|
blocks: {
|
|
111
110
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -246,7 +245,6 @@ export declare const useConfig: () => {
|
|
|
246
245
|
linkTrackingIds: boolean;
|
|
247
246
|
allowSaveWithErrors: boolean;
|
|
248
247
|
reusableRecommendationStrategy: boolean;
|
|
249
|
-
blockUnsubscribeLinks: boolean;
|
|
250
248
|
} | null>;
|
|
251
249
|
blocks: import("vue").ComputedRef<{
|
|
252
250
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DynamicContent } from '@@/Types/generic';
|
|
2
2
|
import type { SaveValidationError } from '@@/Types/save-validation';
|
|
3
3
|
export declare const useSaveValidation: () => {
|
|
4
|
-
collectSaveValidationErrors: (compiledHtml: string, dynamicContentList: DynamicContent[]
|
|
4
|
+
collectSaveValidationErrors: (compiledHtml: string, dynamicContentList: DynamicContent[]) => Promise<SaveValidationError[]>;
|
|
5
5
|
validateCurrentTemplate: () => Promise<SaveValidationError[]>;
|
|
6
6
|
};
|
|
@@ -3,9 +3,6 @@ declare const SINGLETON_BLOCK_RULES: {
|
|
|
3
3
|
messageKey: string;
|
|
4
4
|
}[];
|
|
5
5
|
export declare const EMPTY_BLOCK_KEY = "unsubscription-preference.select-page-to-continue";
|
|
6
|
-
export declare const EXTERNALLY_MANAGED_UNSUBSCRIBE_KEY = "newsletter.sfmc-remove-unsubscribe-link";
|
|
7
|
-
/** Pure core: whether the html carries an Insider unsubscribe merge tag or ASM unsubscribe code. */
|
|
8
|
-
export declare function hasInsiderUnsubscribeCode(html: string): boolean;
|
|
9
6
|
/** Pure core: the singleton rules whose page type appears more than once. */
|
|
10
7
|
export declare function findDuplicateUnsubPageTypes(html: string): typeof SINGLETON_BLOCK_RULES;
|
|
11
8
|
/** Pure core: count of unsubscribe blocks with no page type or page list chosen. */
|
|
@@ -13,6 +10,5 @@ export declare function countUnsubBlocksWithoutPage(html: string): number;
|
|
|
13
10
|
export declare const useUnsubscribeBlockValidator: () => {
|
|
14
11
|
validateUnsubscribeBlockUniqueness: (html: string) => boolean;
|
|
15
12
|
validateUnsubscribeBlockHasTemplate: (html: string) => boolean;
|
|
16
|
-
validateNoInsiderUnsubscribeCode: (html: string, silent?: boolean) => boolean;
|
|
17
13
|
};
|
|
18
14
|
export {};
|
|
@@ -23,6 +23,5 @@ export declare enum SaveValidationRule {
|
|
|
23
23
|
RecommendationFilters = "recommendation-filters",
|
|
24
24
|
InvalidImageType = "invalid-image-type",
|
|
25
25
|
CheckboxUnsubGroup = "checkbox-unsub-group",
|
|
26
|
-
RadioButtonUnsubGroup = "radio-button-unsub-group"
|
|
27
|
-
ExternallyManagedUnsubscribe = "externally-managed-unsubscribe"
|
|
26
|
+
RadioButtonUnsubGroup = "radio-button-unsub-group"
|
|
28
27
|
}
|
|
@@ -110,7 +110,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
110
110
|
linkTrackingIds: boolean;
|
|
111
111
|
allowSaveWithErrors: boolean;
|
|
112
112
|
reusableRecommendationStrategy: boolean;
|
|
113
|
-
blockUnsubscribeLinks: boolean;
|
|
114
113
|
};
|
|
115
114
|
blocks: {
|
|
116
115
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -257,7 +256,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
257
256
|
linkTrackingIds: boolean;
|
|
258
257
|
allowSaveWithErrors: boolean;
|
|
259
258
|
reusableRecommendationStrategy: boolean;
|
|
260
|
-
blockUnsubscribeLinks: boolean;
|
|
261
259
|
};
|
|
262
260
|
blocks: {
|
|
263
261
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -404,7 +402,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
404
402
|
linkTrackingIds: boolean;
|
|
405
403
|
allowSaveWithErrors: boolean;
|
|
406
404
|
reusableRecommendationStrategy: boolean;
|
|
407
|
-
blockUnsubscribeLinks: boolean;
|
|
408
405
|
};
|
|
409
406
|
blocks: {
|
|
410
407
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -551,7 +548,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
551
548
|
linkTrackingIds: boolean;
|
|
552
549
|
allowSaveWithErrors: boolean;
|
|
553
550
|
reusableRecommendationStrategy: boolean;
|
|
554
|
-
blockUnsubscribeLinks: boolean;
|
|
555
551
|
};
|
|
556
552
|
blocks: {
|
|
557
553
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -698,7 +694,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
698
694
|
linkTrackingIds: boolean;
|
|
699
695
|
allowSaveWithErrors: boolean;
|
|
700
696
|
reusableRecommendationStrategy: boolean;
|
|
701
|
-
blockUnsubscribeLinks: boolean;
|
|
702
697
|
};
|
|
703
698
|
blocks: {
|
|
704
699
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -845,7 +840,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
845
840
|
linkTrackingIds: boolean;
|
|
846
841
|
allowSaveWithErrors: boolean;
|
|
847
842
|
reusableRecommendationStrategy: boolean;
|
|
848
|
-
blockUnsubscribeLinks: boolean;
|
|
849
843
|
};
|
|
850
844
|
blocks: {
|
|
851
845
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -992,7 +986,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
992
986
|
linkTrackingIds: boolean;
|
|
993
987
|
allowSaveWithErrors: boolean;
|
|
994
988
|
reusableRecommendationStrategy: boolean;
|
|
995
|
-
blockUnsubscribeLinks: boolean;
|
|
996
989
|
};
|
|
997
990
|
blocks: {
|
|
998
991
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -1139,7 +1132,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1139
1132
|
linkTrackingIds: boolean;
|
|
1140
1133
|
allowSaveWithErrors: boolean;
|
|
1141
1134
|
reusableRecommendationStrategy: boolean;
|
|
1142
|
-
blockUnsubscribeLinks: boolean;
|
|
1143
1135
|
};
|
|
1144
1136
|
blocks: {
|
|
1145
1137
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -1286,7 +1278,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1286
1278
|
linkTrackingIds: boolean;
|
|
1287
1279
|
allowSaveWithErrors: boolean;
|
|
1288
1280
|
reusableRecommendationStrategy: boolean;
|
|
1289
|
-
blockUnsubscribeLinks: boolean;
|
|
1290
1281
|
};
|
|
1291
1282
|
blocks: {
|
|
1292
1283
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -1433,7 +1424,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1433
1424
|
linkTrackingIds: boolean;
|
|
1434
1425
|
allowSaveWithErrors: boolean;
|
|
1435
1426
|
reusableRecommendationStrategy: boolean;
|
|
1436
|
-
blockUnsubscribeLinks: boolean;
|
|
1437
1427
|
};
|
|
1438
1428
|
blocks: {
|
|
1439
1429
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -1580,7 +1570,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1580
1570
|
linkTrackingIds: boolean;
|
|
1581
1571
|
allowSaveWithErrors: boolean;
|
|
1582
1572
|
reusableRecommendationStrategy: boolean;
|
|
1583
|
-
blockUnsubscribeLinks: boolean;
|
|
1584
1573
|
};
|
|
1585
1574
|
blocks: {
|
|
1586
1575
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -1727,7 +1716,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1727
1716
|
linkTrackingIds: boolean;
|
|
1728
1717
|
allowSaveWithErrors: boolean;
|
|
1729
1718
|
reusableRecommendationStrategy: boolean;
|
|
1730
|
-
blockUnsubscribeLinks: boolean;
|
|
1731
1719
|
};
|
|
1732
1720
|
blocks: {
|
|
1733
1721
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -1874,7 +1862,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1874
1862
|
linkTrackingIds: boolean;
|
|
1875
1863
|
allowSaveWithErrors: boolean;
|
|
1876
1864
|
reusableRecommendationStrategy: boolean;
|
|
1877
|
-
blockUnsubscribeLinks: boolean;
|
|
1878
1865
|
};
|
|
1879
1866
|
blocks: {
|
|
1880
1867
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -2021,7 +2008,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2021
2008
|
linkTrackingIds: boolean;
|
|
2022
2009
|
allowSaveWithErrors: boolean;
|
|
2023
2010
|
reusableRecommendationStrategy: boolean;
|
|
2024
|
-
blockUnsubscribeLinks: boolean;
|
|
2025
2011
|
};
|
|
2026
2012
|
blocks: {
|
|
2027
2013
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -2168,7 +2154,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2168
2154
|
linkTrackingIds: boolean;
|
|
2169
2155
|
allowSaveWithErrors: boolean;
|
|
2170
2156
|
reusableRecommendationStrategy: boolean;
|
|
2171
|
-
blockUnsubscribeLinks: boolean;
|
|
2172
2157
|
};
|
|
2173
2158
|
blocks: {
|
|
2174
2159
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -2315,7 +2300,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2315
2300
|
linkTrackingIds: boolean;
|
|
2316
2301
|
allowSaveWithErrors: boolean;
|
|
2317
2302
|
reusableRecommendationStrategy: boolean;
|
|
2318
|
-
blockUnsubscribeLinks: boolean;
|
|
2319
2303
|
};
|
|
2320
2304
|
blocks: {
|
|
2321
2305
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -2462,7 +2446,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2462
2446
|
linkTrackingIds: boolean;
|
|
2463
2447
|
allowSaveWithErrors: boolean;
|
|
2464
2448
|
reusableRecommendationStrategy: boolean;
|
|
2465
|
-
blockUnsubscribeLinks: boolean;
|
|
2466
2449
|
};
|
|
2467
2450
|
blocks: {
|
|
2468
2451
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -2621,7 +2604,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2621
2604
|
linkTrackingIds: boolean;
|
|
2622
2605
|
allowSaveWithErrors: boolean;
|
|
2623
2606
|
reusableRecommendationStrategy: boolean;
|
|
2624
|
-
blockUnsubscribeLinks: boolean;
|
|
2625
2607
|
};
|
|
2626
2608
|
blocks: {
|
|
2627
2609
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -2768,7 +2750,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2768
2750
|
linkTrackingIds: boolean;
|
|
2769
2751
|
allowSaveWithErrors: boolean;
|
|
2770
2752
|
reusableRecommendationStrategy: boolean;
|
|
2771
|
-
blockUnsubscribeLinks: boolean;
|
|
2772
2753
|
};
|
|
2773
2754
|
blocks: {
|
|
2774
2755
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -2917,7 +2898,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2917
2898
|
linkTrackingIds: boolean;
|
|
2918
2899
|
allowSaveWithErrors: boolean;
|
|
2919
2900
|
reusableRecommendationStrategy: boolean;
|
|
2920
|
-
blockUnsubscribeLinks: boolean;
|
|
2921
2901
|
};
|
|
2922
2902
|
blocks: {
|
|
2923
2903
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -7,8 +7,8 @@ import { DATA_ATTRIBUTES as g } from "../extensions/Blocks/Unsubscribe/utils/con
|
|
|
7
7
|
import { parsePageList as U } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
8
8
|
import { useDynamicContentStore as L } from "../stores/dynamic-content.js";
|
|
9
9
|
import { useEditorStore as N } from "../stores/editor.js";
|
|
10
|
-
import { useUnsubscribeStore as
|
|
11
|
-
import { isPlainObject as
|
|
10
|
+
import { useUnsubscribeStore as z } from "../stores/unsubscribe.js";
|
|
11
|
+
import { isPlainObject as v } from "./genericUtil.js";
|
|
12
12
|
import { assignTrackingIds as M } from "./linkTrackingIds.js";
|
|
13
13
|
function O(n) {
|
|
14
14
|
const r = new DOMParser().parseFromString(n, "text/html").querySelectorAll(`[${g.PAGE_LIST}]`), e = [];
|
|
@@ -26,16 +26,16 @@ async function S(n) {
|
|
|
26
26
|
const i = e.getAttribute("recommendation-id"), t = i ? Number(i) : NaN;
|
|
27
27
|
if (!Number.isFinite(t))
|
|
28
28
|
return;
|
|
29
|
-
const
|
|
30
|
-
if (!
|
|
29
|
+
const c = e.getAttribute("esd-ext-config");
|
|
30
|
+
if (!c)
|
|
31
31
|
return;
|
|
32
32
|
let a;
|
|
33
33
|
try {
|
|
34
|
-
a = JSON.parse(
|
|
34
|
+
a = JSON.parse(c);
|
|
35
35
|
} catch {
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
v(a) && r.seedBlockUrlConfig(t, R(a));
|
|
39
39
|
});
|
|
40
40
|
try {
|
|
41
41
|
await r.fetchRecommendationCreateData();
|
|
@@ -47,23 +47,20 @@ async function S(n) {
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
const Z = () => {
|
|
50
|
-
const n = L(),
|
|
50
|
+
const n = L(), m = N(), o = z(), { getCompiledEmail: r, getTemplateData: e, updateHtmlAndCss: i } = E(), { compileHtml: t, compileAmpHtml: c } = I(), { isFeatureEnabled: a } = F();
|
|
51
51
|
return {
|
|
52
52
|
prepareTemplateDetails: async (h) => {
|
|
53
|
-
let { html: s, css:
|
|
54
|
-
if (a("linkTrackingIds"))
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
console.error("Tracking-id step failed, saving anyway:", d);
|
|
60
|
-
}
|
|
61
|
-
const { html: T, ampHtml: p = "", ampErrors: A = [] } = await r({
|
|
53
|
+
let { html: s, css: p, syncModulesIds: A = [] } = h ?? await e();
|
|
54
|
+
if (a("linkTrackingIds")) {
|
|
55
|
+
const { html: f, changed: x, nextSeq: D } = M(s, m.trackIdSessionFloor);
|
|
56
|
+
m.trackIdSessionFloor = D, x && (await i(f, p), s = f);
|
|
57
|
+
}
|
|
58
|
+
const { html: T, ampHtml: d = "", ampErrors: w = [] } = await r({
|
|
62
59
|
minimize: !0,
|
|
63
60
|
resetDataSavedFlag: !1
|
|
64
61
|
});
|
|
65
62
|
o.selectedUnsubscribePages.length && await o.fetchTemplates(), await S(s);
|
|
66
|
-
const { compiledHtml:
|
|
63
|
+
const { compiledHtml: y, stats: l, appliedRules: C } = t(T), H = d && c(d).compiledHtml, P = n.getSelectedDynamicContentList, k = b(), u = O(s);
|
|
67
64
|
return console.debug("HTML Compilation Stats:", {
|
|
68
65
|
originalSize: l.originalSize,
|
|
69
66
|
compiledSize: l.compiledSize,
|
|
@@ -71,20 +68,20 @@ const Z = () => {
|
|
|
71
68
|
appliedRules: C,
|
|
72
69
|
executionTime: `${l.executionTime.toFixed(2)}ms`
|
|
73
70
|
}), {
|
|
74
|
-
dynamicContentList:
|
|
75
|
-
compiledHtml:
|
|
71
|
+
dynamicContentList: P,
|
|
72
|
+
compiledHtml: y,
|
|
76
73
|
rawHtml: s,
|
|
77
|
-
css:
|
|
74
|
+
css: p,
|
|
78
75
|
ampHtml: H,
|
|
79
|
-
ampErrors:
|
|
80
|
-
modules:
|
|
76
|
+
ampErrors: w,
|
|
77
|
+
modules: A.map(Number),
|
|
81
78
|
recommendation: {
|
|
82
|
-
campaignUrls:
|
|
79
|
+
campaignUrls: k.recommendationCampaignUrls,
|
|
83
80
|
configs: {}
|
|
84
81
|
},
|
|
85
82
|
unsubscribe: {
|
|
86
|
-
status:
|
|
87
|
-
config:
|
|
83
|
+
status: u.length > 0,
|
|
84
|
+
config: u
|
|
88
85
|
}
|
|
89
86
|
};
|
|
90
87
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.24.0-beta.
|
|
3
|
+
"version": "3.24.0-beta.3686ce3",
|
|
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",
|