@useinsider/guido 3.25.0 → 3.26.0-beta.19d84af
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 +1 -0
- package/dist/@types/config/schemas.js +11 -9
- package/dist/composables/useSave.js +57 -52
- package/dist/composables/useSaveValidation.js +118 -110
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +48 -33
- package/dist/enums/save-validation.js +1 -1
- package/dist/package.json.js +2 -2
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useSaveValidation.d.ts +1 -1
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +4 -0
- package/dist/src/enums/save-validation.d.ts +2 -1
- package/dist/src/stores/config.d.ts +20 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -173,6 +173,7 @@ const config: GuidoConfigInput = {
|
|
|
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
175
|
itemsPriceFormatting?: boolean, // Default: false - Items block price formatting: thousand/decimal separator + decimal count on the block root, raw price tags in the export (formatted at send time).
|
|
176
|
+
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
177
|
},
|
|
177
178
|
|
|
178
179
|
// 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 p, 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 b = {
|
|
4
4
|
/** Promotional/marketing emails */
|
|
5
5
|
PROMOTIONAL: 1,
|
|
6
6
|
/** Transactional/system emails */
|
|
@@ -16,12 +16,12 @@ const p = {
|
|
|
16
16
|
/** Unique identifier for the template being edited */
|
|
17
17
|
templateId: i(
|
|
18
18
|
t(),
|
|
19
|
-
|
|
19
|
+
p(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
|
+
p(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 p = {
|
|
|
42
42
|
/** Partner/organization name (required) */
|
|
43
43
|
name: i(
|
|
44
44
|
t(),
|
|
45
|
-
|
|
45
|
+
p(1, "partner.name is required")
|
|
46
46
|
),
|
|
47
47
|
/** Product type identifier */
|
|
48
48
|
productType: e(
|
|
@@ -55,8 +55,8 @@ const p = {
|
|
|
55
55
|
),
|
|
56
56
|
/** Message type (promotional or transactional) */
|
|
57
57
|
messageType: e(
|
|
58
|
-
m([
|
|
59
|
-
|
|
58
|
+
m([b.PROMOTIONAL, b.TRANSACTIONAL]),
|
|
59
|
+
b.PROMOTIONAL
|
|
60
60
|
),
|
|
61
61
|
/** Display name for the current user */
|
|
62
62
|
username: e(t(), "Guido User"),
|
|
@@ -246,7 +246,9 @@ const p = {
|
|
|
246
246
|
allowSaveWithErrors: e(o(), !0),
|
|
247
247
|
reusableRecommendationStrategy: e(o(), !1),
|
|
248
248
|
/** Items block: Recommendation-style price formatting (root currency-* attrs, raw price tags). Released dark. */
|
|
249
|
-
itemsPriceFormatting: e(o(), !1)
|
|
249
|
+
itemsPriceFormatting: e(o(), !1),
|
|
250
|
+
/** Warn on save when the design carries an Insider unsubscribe link or code (host sets true for SFMC accounts) */
|
|
251
|
+
blockUnsubscribeLinks: e(o(), !1)
|
|
250
252
|
}), w = m([
|
|
251
253
|
"amp-accordion",
|
|
252
254
|
"amp-carousel",
|
|
@@ -379,7 +381,7 @@ export {
|
|
|
379
381
|
K as GuidoConfigSchema,
|
|
380
382
|
A as IdentitySchema,
|
|
381
383
|
N as LegacyRecommendationConfigSchema,
|
|
382
|
-
|
|
384
|
+
b as MessageType,
|
|
383
385
|
E as PartnerSchema,
|
|
384
386
|
l as ProductType,
|
|
385
387
|
_ as RegexRuleSchema,
|
|
@@ -1,91 +1,96 @@
|
|
|
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 O } from "./useActionsApi.js";
|
|
2
|
+
import { useConfig as D } from "./useConfig.js";
|
|
3
|
+
import { useEditorLock as F } from "./useEditorLock.js";
|
|
4
|
+
import { useSaveStart as I, useSaveComplete as N } 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
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 Q } from "../stores/config.js";
|
|
11
|
+
import { useDynamicContentStore as X } from "../stores/dynamic-content.js";
|
|
12
|
+
import { useSaveValidationStore as Y } from "../stores/save-validation.js";
|
|
13
|
+
import { useTemplatePreparation as Z, getHtmlReferencedUnsubscribePages as _ } from "../utils/templatePreparation.js";
|
|
14
|
+
import { useAllowlist as $ } from "./useAllowlist.js";
|
|
15
|
+
import { useHtmlValidator as tt } from "./useHtmlValidator.js";
|
|
16
|
+
import { useToaster as et } from "./useToaster.js";
|
|
17
|
+
import { useCouponBlockValidator as ot } from "./validators/useCouponBlockValidator.js";
|
|
18
|
+
import { useHtmlDocumentCountValidator as it } from "./validators/useHtmlDocumentCountValidator.js";
|
|
19
|
+
import { useLiquidValidator as st } from "./validators/useLiquidValidator.js";
|
|
20
|
+
import { useSyncModuleBlockValidator as rt } from "./validators/useSyncModuleBlockValidator.js";
|
|
21
21
|
import { useUnsubscribeBlockValidator as at } from "./validators/useUnsubscribeBlockValidator.js";
|
|
22
22
|
const Pt = () => {
|
|
23
|
-
const n =
|
|
24
|
-
|
|
23
|
+
const n = I(), S = N(), { validateHtml: y } = tt(), { validateLiquidSyntax: b } = st(), { validateCouponBlockTags: H } = ot(), {
|
|
24
|
+
validateUnsubscribeBlockUniqueness: E,
|
|
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"))
|
|
25
29
|
return !1;
|
|
26
|
-
const o = await
|
|
30
|
+
const o = await B(t, e);
|
|
27
31
|
if (!o.length)
|
|
28
32
|
return !1;
|
|
29
33
|
if (!i) {
|
|
30
|
-
const s = await
|
|
31
|
-
s != null && s.message &&
|
|
34
|
+
const s = await T(o);
|
|
35
|
+
s != null && s.message && h({
|
|
32
36
|
type: J.Warning,
|
|
33
37
|
message: s.message,
|
|
34
38
|
actionButton: s.actionButton
|
|
35
39
|
});
|
|
36
40
|
}
|
|
37
41
|
return !0;
|
|
38
|
-
},
|
|
42
|
+
}, M = async (t, e) => !H(t.compiledHtml) || u("blockUnsubscribeLinks") && !V(t.rawHtml, e) || !E(t.compiledHtml) || !g(t.compiledHtml) ? !1 : u("liquidSyntax") ? b(t.compiledHtml) : y(t.compiledHtml, t.dynamicContentList, !0), v = async (t, e) => {
|
|
39
43
|
if (!await C())
|
|
40
44
|
return;
|
|
41
|
-
const { unsubscribePayload: o, stripoModules: s } =
|
|
42
|
-
if (await
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
+
const { unsubscribePayload: o, stripoModules: s } = x(t.rawHtml);
|
|
46
|
+
if (await k(o), t.modules = s, !e.suppress) {
|
|
47
|
+
const r = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
|
|
48
|
+
S({ ...t, ...r, silent: e.silent });
|
|
45
49
|
}
|
|
46
50
|
return t;
|
|
47
|
-
},
|
|
51
|
+
}, W = async (t, e) => {
|
|
48
52
|
var s;
|
|
49
53
|
n();
|
|
50
|
-
const i = await
|
|
54
|
+
const i = await m();
|
|
51
55
|
if (!c(i.html, e))
|
|
52
56
|
return;
|
|
53
57
|
const o = await p(i);
|
|
54
58
|
if (l(o.rawHtml, e)) {
|
|
55
59
|
if (P.value && !e) {
|
|
56
|
-
const
|
|
60
|
+
const r = await L(
|
|
57
61
|
o.compiledHtml,
|
|
58
|
-
o.dynamicContentList
|
|
62
|
+
o.dynamicContentList,
|
|
63
|
+
o.rawHtml
|
|
59
64
|
);
|
|
60
|
-
if (
|
|
61
|
-
|
|
65
|
+
if (r.length) {
|
|
66
|
+
U.open(r, "save");
|
|
62
67
|
return;
|
|
63
68
|
}
|
|
64
|
-
} else if (!await
|
|
69
|
+
} else if (!await M(o, e))
|
|
65
70
|
return;
|
|
66
|
-
if (!((s =
|
|
67
|
-
return
|
|
71
|
+
if (!((s = a.value) != null && s.externalValidation && !await a.value.externalValidation(o)) && !await f(o.compiledHtml, o.css, e))
|
|
72
|
+
return v(o, { silent: e, suppress: t });
|
|
68
73
|
}
|
|
69
|
-
},
|
|
74
|
+
}, R = async () => {
|
|
70
75
|
var i;
|
|
71
|
-
if (!
|
|
76
|
+
if (!w.allowSaveWithErrors)
|
|
72
77
|
return;
|
|
73
78
|
n();
|
|
74
|
-
const t = await
|
|
79
|
+
const t = await m();
|
|
75
80
|
if (!c(t.html, !1))
|
|
76
81
|
return;
|
|
77
82
|
const e = await p(t);
|
|
78
|
-
if (l(e.rawHtml, !1) && !((i =
|
|
79
|
-
return
|
|
80
|
-
},
|
|
81
|
-
if (!
|
|
83
|
+
if (l(e.rawHtml, !1) && !((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(e)) && !await f(e.compiledHtml, e.css, !1))
|
|
84
|
+
return v(e, { silent: !1, blankCompiled: !0 });
|
|
85
|
+
}, q = async () => {
|
|
86
|
+
if (!w.allowSaveWithErrors)
|
|
82
87
|
return;
|
|
83
88
|
n();
|
|
84
|
-
const { html: t, css: e } = await
|
|
85
|
-
if (!c(t, !0) || !l(t, !0) || await
|
|
89
|
+
const { html: t, css: e } = await m();
|
|
90
|
+
if (!c(t, !0) || !l(t, !0) || await f(t, e, !0))
|
|
86
91
|
return;
|
|
87
|
-
const i =
|
|
88
|
-
dynamicContentList:
|
|
92
|
+
const i = _(t), o = {
|
|
93
|
+
dynamicContentList: A.getSelectedDynamicContentList,
|
|
89
94
|
compiledHtml: "",
|
|
90
95
|
rawHtml: t,
|
|
91
96
|
css: e,
|
|
@@ -99,11 +104,11 @@ const Pt = () => {
|
|
|
99
104
|
config: i
|
|
100
105
|
}
|
|
101
106
|
};
|
|
102
|
-
return
|
|
107
|
+
return v(o, { silent: !0 });
|
|
103
108
|
};
|
|
104
|
-
return { save: (t = !1, e = !1) =>
|
|
105
|
-
() =>
|
|
106
|
-
), saveWithErrors: () =>
|
|
109
|
+
return { save: (t = !1, e = !1) => d(
|
|
110
|
+
() => W(t, e)
|
|
111
|
+
), saveWithErrors: () => d(R), saveRawOnly: () => d(q) };
|
|
107
112
|
};
|
|
108
113
|
export {
|
|
109
114
|
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 U, 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 x } from "../extensions/Blocks/Checkbox/constants/selectors.js";
|
|
6
|
+
import { itemsBlockDynamicVariables as W } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
7
|
+
import { BLOCK_ROOT_SELECTOR as G } from "../extensions/Blocks/RadioButton/constants/selectors.js";
|
|
8
|
+
import { useRecommendationExtensionStore as P } 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 { hasInsiderUnsubscribeCode as ue, EXTERNALLY_MANAGED_UNSUBSCRIBE_KEY as me, findDuplicateUnsubPageTypes as de, countUnsubBlocksWithoutPage as pe, EMPTY_BLOCK_KEY as ge } from "./validators/useUnsubscribeBlockValidator.js";
|
|
24
|
+
const fe = "newsletter.html-content-is-empty", ye = "custom-fields.missing-closing-braces", Ee = "custom-fields.missing-opening-braces", S = "custom-fields.invalid-custom-fields", Ie = "newsletter.display-conditions-invalid-syntax", Se = "custom-conditions.wrong-equality-operators", _e = "custom-conditions.missing-if-endif-tag", Ce = "custom-conditions.no-space-after-braces", he = "custom-conditions.no-braces-inside-if-tag", ke = "newsletter.fill-all-necessary-fields", Te = "newsletter.invalid-image-type", Fe = "unsubscribe-templates.select-checkbox-groups", be = "unsubscribe-templates.select-radio-button-groups", F = "newsletter.invalid-url-link-for-toaster", b = "journey-builder.liquid-validation-failed", Re = "/newsletter/template-library/check-template-html-body", Le = /src="[^"]*\.(svg|pst)"/gm, L = /({%(.*?)%})/g, Ne = ["if", "endif", "else", "elif", "now"], Oe = (t) => !Ne.includes(t.toLowerCase()), Ae = (t) => ["if", "endif"].includes(t.toLowerCase());
|
|
25
|
+
function De(t) {
|
|
26
26
|
return ce(t).map((i) => ({
|
|
27
27
|
rule: o.CouponTagModified,
|
|
28
28
|
type: r.Warning,
|
|
@@ -30,54 +30,61 @@ function be(t) {
|
|
|
30
30
|
detail: i
|
|
31
31
|
}));
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
33
|
+
function ve(t) {
|
|
34
|
+
return de(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 Ke(t) {
|
|
41
|
+
return Array.from({ length: pe(t) }, () => ({
|
|
42
42
|
rule: o.UnsubBlockMissingTemplate,
|
|
43
43
|
type: r.Warning,
|
|
44
|
-
key:
|
|
44
|
+
key: ge
|
|
45
45
|
}));
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Be(t) {
|
|
48
|
+
return ue(t) ? [{
|
|
49
|
+
rule: o.ExternallyManagedUnsubscribe,
|
|
50
|
+
type: r.Warning,
|
|
51
|
+
key: me
|
|
52
|
+
}] : [];
|
|
53
|
+
}
|
|
54
|
+
function we(t, i) {
|
|
48
55
|
const n = t.match(L);
|
|
49
56
|
if (!n)
|
|
50
57
|
return [];
|
|
51
|
-
const
|
|
52
|
-
return n.forEach((
|
|
53
|
-
const c =
|
|
58
|
+
const u = [];
|
|
59
|
+
return n.forEach((m) => {
|
|
60
|
+
const c = m.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
54
61
|
if (c && c.length > 0) {
|
|
55
62
|
const [d] = c;
|
|
56
|
-
|
|
63
|
+
Oe(d) && !i.includes(d) && u.push({
|
|
57
64
|
rule: o.CustomFieldScript,
|
|
58
65
|
type: r.Warning,
|
|
59
66
|
key: S,
|
|
60
67
|
detail: d
|
|
61
68
|
});
|
|
62
69
|
}
|
|
63
|
-
}),
|
|
70
|
+
}), u;
|
|
64
71
|
}
|
|
65
|
-
function
|
|
66
|
-
return t.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key:
|
|
72
|
+
function Ye(t) {
|
|
73
|
+
return t.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: fe }];
|
|
67
74
|
}
|
|
68
|
-
function
|
|
75
|
+
function Ue(t) {
|
|
69
76
|
const i = (t.match(/{/gm) || []).length, n = (t.match(/}/gm) || []).length;
|
|
70
77
|
return i > n ? [{
|
|
71
78
|
rule: o.MismatchedBraces,
|
|
72
79
|
type: r.Warning,
|
|
73
|
-
key:
|
|
80
|
+
key: ye
|
|
74
81
|
}] : i < n ? [{
|
|
75
82
|
rule: o.MismatchedBraces,
|
|
76
83
|
type: r.Warning,
|
|
77
|
-
key:
|
|
84
|
+
key: Ee
|
|
78
85
|
}] : [];
|
|
79
86
|
}
|
|
80
|
-
function
|
|
87
|
+
function Me(t) {
|
|
81
88
|
return ie(t).map((i) => ({
|
|
82
89
|
rule: o.InvalidDynamicTag,
|
|
83
90
|
type: r.Warning,
|
|
@@ -85,75 +92,75 @@ function Be(t) {
|
|
|
85
92
|
detail: i
|
|
86
93
|
}));
|
|
87
94
|
}
|
|
88
|
-
function
|
|
89
|
-
const
|
|
90
|
-
return re(t, i,
|
|
95
|
+
function xe(t, i, n, u) {
|
|
96
|
+
const m = oe(t);
|
|
97
|
+
return re(t, i, m, n, u).map((c) => ({
|
|
91
98
|
rule: o.InvalidCustomField,
|
|
92
99
|
type: r.Error,
|
|
93
100
|
key: S,
|
|
94
101
|
detail: c
|
|
95
102
|
}));
|
|
96
103
|
}
|
|
97
|
-
function
|
|
98
|
-
const i = t.match(/{%(.*?)%}/g), n = [],
|
|
99
|
-
if (i && i.forEach((
|
|
100
|
-
const c =
|
|
101
|
-
(!c ||
|
|
104
|
+
function We(t) {
|
|
105
|
+
const i = t.match(/{%(.*?)%}/g), n = [], u = [];
|
|
106
|
+
if (i && i.forEach((m) => {
|
|
107
|
+
const c = m.match(U), d = m.match(M), I = (c == null ? void 0 : c.join("")) || "";
|
|
108
|
+
(!c || m !== I) && !d && u.push({
|
|
102
109
|
rule: o.ConditionsSyntax,
|
|
103
110
|
type: r.Error,
|
|
104
|
-
key:
|
|
105
|
-
detail:
|
|
111
|
+
key: Ie,
|
|
112
|
+
detail: m
|
|
106
113
|
}), c && c.forEach((g) => {
|
|
107
|
-
g.trim() === "=" &&
|
|
114
|
+
g.trim() === "=" && u.push({
|
|
108
115
|
rule: o.WrongEqualityOperator,
|
|
109
116
|
type: r.Error,
|
|
110
|
-
key:
|
|
117
|
+
key: Se
|
|
111
118
|
}), (g.match(/^[a-zA-Z]*$/g) ?? []).forEach((f) => {
|
|
112
|
-
|
|
119
|
+
Ae(f) && n.push(f);
|
|
113
120
|
});
|
|
114
121
|
});
|
|
115
122
|
}), n.length) {
|
|
116
|
-
const
|
|
117
|
-
|
|
123
|
+
const m = n.filter((d) => d === "if").length, c = n.filter((d) => d === "endif").length;
|
|
124
|
+
m !== c && u.push({
|
|
118
125
|
rule: o.MissingIfEndif,
|
|
119
126
|
type: r.Error,
|
|
120
|
-
key:
|
|
127
|
+
key: _e
|
|
121
128
|
});
|
|
122
129
|
}
|
|
123
|
-
return
|
|
130
|
+
return u;
|
|
124
131
|
}
|
|
125
|
-
function
|
|
132
|
+
function Ge(t) {
|
|
126
133
|
const i = (t.match(/{% /gm) || []).length, n = (t.match(/ %}/gm) || []).length;
|
|
127
134
|
return i === n ? [] : [{
|
|
128
135
|
rule: o.ConditionTagSpacing,
|
|
129
136
|
type: r.Warning,
|
|
130
|
-
key:
|
|
137
|
+
key: Ce
|
|
131
138
|
}];
|
|
132
139
|
}
|
|
133
|
-
function
|
|
134
|
-
return (t.match(L) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n,
|
|
140
|
+
function Pe(t) {
|
|
141
|
+
return (t.match(L) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, u) => n + u, 0) === 0 ? [] : [{
|
|
135
142
|
rule: o.BracesInsideIfTag,
|
|
136
143
|
type: r.Warning,
|
|
137
|
-
key:
|
|
144
|
+
key: he
|
|
138
145
|
}];
|
|
139
146
|
}
|
|
140
|
-
function
|
|
141
|
-
return (t.match(
|
|
147
|
+
function qe(t) {
|
|
148
|
+
return (t.match(Le) ?? []).map((i) => ({
|
|
142
149
|
rule: o.InvalidImageType,
|
|
143
150
|
type: r.Error,
|
|
144
|
-
key:
|
|
151
|
+
key: Te,
|
|
145
152
|
detail: i
|
|
146
153
|
}));
|
|
147
154
|
}
|
|
148
|
-
function
|
|
149
|
-
const
|
|
150
|
-
return Array.from(
|
|
155
|
+
function R(t, i, n, u) {
|
|
156
|
+
const m = new DOMParser().parseFromString(t, "text/html");
|
|
157
|
+
return Array.from(m.querySelectorAll(i)).filter((c) => {
|
|
151
158
|
var d;
|
|
152
159
|
return !((d = c.id) != null && d.trim());
|
|
153
|
-
}).map(() => ({ rule: n, type: r.Error, key:
|
|
160
|
+
}).map(() => ({ rule: n, type: r.Error, key: u }));
|
|
154
161
|
}
|
|
155
|
-
const
|
|
156
|
-
const { config: t, isFeatureEnabled: i } = ee(), n = ae(), { post:
|
|
162
|
+
const ft = () => {
|
|
163
|
+
const { config: t, isFeatureEnabled: i } = ee(), n = ae(), { post: u } = se(), { getCompiledEmail: m, getTemplateData: c } = J(), { compileHtml: d } = te(), { hydrateRecommendationStore: I } = Z(), g = z(), f = $(), y = P(), N = j(), O = (e) => ({
|
|
157
164
|
rule: e.rule,
|
|
158
165
|
type: e.type,
|
|
159
166
|
detail: e.detail,
|
|
@@ -167,24 +174,24 @@ const dt = () => {
|
|
|
167
174
|
return null;
|
|
168
175
|
}
|
|
169
176
|
return ne(y.filterList);
|
|
170
|
-
},
|
|
177
|
+
}, D = async (e) => {
|
|
171
178
|
try {
|
|
172
|
-
const
|
|
173
|
-
return
|
|
179
|
+
const a = await u(Re, { html: T(e) }), { status: s, message: l } = a.data, p = [], E = s === void 0 && !!l && l !== n(F);
|
|
180
|
+
return s || p.push({
|
|
174
181
|
rule: o.InvalidLinks,
|
|
175
182
|
type: r.Error,
|
|
176
|
-
...E ? { message:
|
|
177
|
-
}),
|
|
183
|
+
...E ? { message: l } : { key: F }
|
|
184
|
+
}), l === n(k) && p.push({
|
|
178
185
|
rule: o.LinkCheckInProgress,
|
|
179
186
|
type: r.Error,
|
|
180
187
|
key: k
|
|
181
188
|
}), p;
|
|
182
|
-
} catch (
|
|
183
|
-
return console.warn("Link-check collector failed; skipping the link rule.",
|
|
189
|
+
} catch (a) {
|
|
190
|
+
return console.warn("Link-check collector failed; skipping the link rule.", a), [];
|
|
184
191
|
}
|
|
185
|
-
},
|
|
192
|
+
}, v = async (e) => {
|
|
186
193
|
try {
|
|
187
|
-
const
|
|
194
|
+
const a = await u("/newsletter/contents/validate-syntax", [{
|
|
188
195
|
identifier: "default",
|
|
189
196
|
syntax: "liquid",
|
|
190
197
|
contents: {
|
|
@@ -194,88 +201,89 @@ const dt = () => {
|
|
|
194
201
|
ampHtml: null
|
|
195
202
|
}
|
|
196
203
|
}]);
|
|
197
|
-
if (!Array.isArray(
|
|
198
|
-
const
|
|
204
|
+
if (!Array.isArray(a.data)) {
|
|
205
|
+
const l = a.data;
|
|
199
206
|
return [{
|
|
200
207
|
rule: o.LiquidSyntax,
|
|
201
208
|
type: r.Warning,
|
|
202
|
-
message:
|
|
209
|
+
message: l.message ?? n(b)
|
|
203
210
|
}];
|
|
204
211
|
}
|
|
205
|
-
const [
|
|
206
|
-
return Object.values((
|
|
212
|
+
const [s] = a.data;
|
|
213
|
+
return Object.values((s == null ? void 0 : s.errors) ?? {}).map((l) => ({
|
|
207
214
|
rule: o.LiquidSyntax,
|
|
208
215
|
type: r.Warning,
|
|
209
|
-
message:
|
|
216
|
+
message: l.replace(/^line \d+:\s*/, "")
|
|
210
217
|
}));
|
|
211
|
-
} catch (
|
|
212
|
-
if (
|
|
213
|
-
throw
|
|
218
|
+
} catch (a) {
|
|
219
|
+
if (a != null && a.authReported)
|
|
220
|
+
throw a;
|
|
214
221
|
return [{
|
|
215
222
|
rule: o.LiquidSyntax,
|
|
216
223
|
type: r.Error,
|
|
217
|
-
message: n(
|
|
224
|
+
message: n(b)
|
|
218
225
|
}];
|
|
219
226
|
}
|
|
220
227
|
}, K = () => {
|
|
221
|
-
const e = Object.values(y.blockStates).map((
|
|
222
|
-
const
|
|
228
|
+
const e = Object.values(y.blockStates).map((s) => q(s.recommendationConfigs, y)).filter((s) => s.length > 0).map((s) => {
|
|
229
|
+
const l = s.every((p) => p === H);
|
|
223
230
|
return {
|
|
224
231
|
rule: o.RecommendationRequiredFields,
|
|
225
|
-
type:
|
|
226
|
-
key:
|
|
232
|
+
type: l ? r.Warning : r.Error,
|
|
233
|
+
key: l ? V : X
|
|
227
234
|
};
|
|
228
|
-
}),
|
|
235
|
+
}), a = (f.recommendationConfigs ?? []).filter((s) => s.filters.some((l) => l.value === "")).map(() => ({
|
|
229
236
|
rule: o.RecommendationFilters,
|
|
230
237
|
type: r.Error,
|
|
231
|
-
key:
|
|
238
|
+
key: ke
|
|
232
239
|
}));
|
|
233
|
-
return [...e, ...
|
|
234
|
-
},
|
|
240
|
+
return [...e, ...a];
|
|
241
|
+
}, B = async (e, a) => {
|
|
235
242
|
var C, h;
|
|
236
|
-
const
|
|
237
|
-
...
|
|
238
|
-
...
|
|
243
|
+
const s = [
|
|
244
|
+
...a.map((w) => w.value),
|
|
245
|
+
...W,
|
|
239
246
|
...((h = (C = t.value) == null ? void 0 : C.template) == null ? void 0 : h.customFieldAttributes) ?? []
|
|
240
|
-
],
|
|
247
|
+
], l = Y(e), p = await A(l), { isTransactional: E } = N;
|
|
241
248
|
return [
|
|
242
|
-
...await
|
|
243
|
-
...E ? [] :
|
|
244
|
-
...
|
|
245
|
-
...we(e),
|
|
246
|
-
...Be(e),
|
|
247
|
-
...E ? [] : Ye(e, a, m, p),
|
|
248
|
-
...xe(e),
|
|
249
|
-
...Me(e),
|
|
249
|
+
...await D(e),
|
|
250
|
+
...E ? [] : we(e, s),
|
|
251
|
+
...Ye(e),
|
|
250
252
|
...Ue(e),
|
|
251
|
-
...
|
|
253
|
+
...Me(e),
|
|
254
|
+
...E ? [] : xe(e, s, l, p),
|
|
255
|
+
...We(e),
|
|
256
|
+
...Ge(e),
|
|
252
257
|
...Pe(e),
|
|
253
|
-
...
|
|
258
|
+
...K(),
|
|
259
|
+
...qe(e),
|
|
260
|
+
...R(
|
|
254
261
|
e,
|
|
255
|
-
|
|
262
|
+
x,
|
|
256
263
|
o.CheckboxUnsubGroup,
|
|
257
|
-
|
|
264
|
+
Fe
|
|
258
265
|
),
|
|
259
|
-
...
|
|
266
|
+
...R(
|
|
260
267
|
e,
|
|
261
|
-
|
|
268
|
+
G,
|
|
262
269
|
o.RadioButtonUnsubGroup,
|
|
263
|
-
|
|
270
|
+
be
|
|
264
271
|
)
|
|
265
272
|
];
|
|
266
|
-
}, _ = async (e, s) => [
|
|
267
|
-
...
|
|
268
|
-
...
|
|
273
|
+
}, _ = async (e, a, s) => [
|
|
274
|
+
...De(e),
|
|
275
|
+
...i("blockUnsubscribeLinks") ? Be(s) : [],
|
|
269
276
|
...ve(e),
|
|
270
|
-
...
|
|
271
|
-
|
|
277
|
+
...Ke(e),
|
|
278
|
+
...i("liquidSyntax") ? await v(e) : await B(e, a)
|
|
279
|
+
].map(O);
|
|
272
280
|
return { collectSaveValidationErrors: _, validateCurrentTemplate: async () => {
|
|
273
281
|
const { html: e } = await c();
|
|
274
282
|
await I(e);
|
|
275
|
-
const { html:
|
|
276
|
-
return _(
|
|
283
|
+
const { html: a } = await m({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: s } = d(a);
|
|
284
|
+
return _(s, g.getSelectedDynamicContentList, e);
|
|
277
285
|
} };
|
|
278
286
|
};
|
|
279
287
|
export {
|
|
280
|
-
|
|
288
|
+
ft as useSaveValidation
|
|
281
289
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ToasterTypeOptions as
|
|
2
|
-
import { PAGE_TYPES as u } from "../../enums/unsubscribe.js";
|
|
3
|
-
import { UNSUBSCRIBE_BLOCK_SELECTOR as
|
|
4
|
-
import { useToaster as
|
|
5
|
-
import { useTranslations as
|
|
1
|
+
import { ToasterTypeOptions as i } from "../../enums/toaster.js";
|
|
2
|
+
import { MERGE_TAGS as p, PAGE_TYPES as u } from "../../enums/unsubscribe.js";
|
|
3
|
+
import { UNSUBSCRIBE_BLOCK_SELECTOR as l, DATA_ATTRIBUTES as c } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
4
|
+
import { useToaster as E } from "../useToaster.js";
|
|
5
|
+
import { useTranslations as b } from "../useTranslations.js";
|
|
6
6
|
const T = [
|
|
7
7
|
{
|
|
8
8
|
pageType: u.GLOBAL_UNSUBSCRIBE,
|
|
@@ -12,37 +12,52 @@ 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
|
-
|
|
21
|
-
}), T.filter((n) => (t.get(n.pageType) ?? 0) > 1);
|
|
15
|
+
], g = "unsubscription-preference.duplicate-both", _ = "unsubscription-preference.select-page-to-continue", m = "newsletter.sfmc-remove-unsubscribe-link", f = Object.values(p).map((e) => e.slice(2, -2).replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), U = new RegExp(
|
|
16
|
+
`(?:{{|%7B%7B)(?:\\s|%20)*(?:${f})(?:\\s|%20)*(?:}}|%7D%7D)|(?:%|%25)(?:asm_[a-z_]+_raw_url|unsub)(?:%|%25)`,
|
|
17
|
+
"i"
|
|
18
|
+
);
|
|
19
|
+
function B(e) {
|
|
20
|
+
return U.test(e);
|
|
22
21
|
}
|
|
23
|
-
function
|
|
24
|
-
const
|
|
25
|
-
return
|
|
26
|
-
const n =
|
|
27
|
-
|
|
22
|
+
function S(e) {
|
|
23
|
+
const t = new DOMParser().parseFromString(e, "text/html"), s = /* @__PURE__ */ new Map();
|
|
24
|
+
return t.querySelectorAll(l).forEach((r) => {
|
|
25
|
+
const n = Number(r.getAttribute(c.PAGE_TYPE));
|
|
26
|
+
s.set(n, (s.get(n) ?? 0) + 1);
|
|
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;
|
|
28
34
|
}).length;
|
|
29
35
|
}
|
|
30
|
-
const
|
|
31
|
-
const { showToaster:
|
|
32
|
-
return {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
const I = () => {
|
|
37
|
+
const { showToaster: e } = E(), t = b();
|
|
38
|
+
return {
|
|
39
|
+
validateUnsubscribeBlockUniqueness: (o) => {
|
|
40
|
+
const a = S(o);
|
|
41
|
+
return a.length ? (e({
|
|
42
|
+
type: i.Error,
|
|
43
|
+
message: t(a.length > 1 ? g : a[0].messageKey)
|
|
44
|
+
}), !1) : !0;
|
|
45
|
+
},
|
|
46
|
+
validateUnsubscribeBlockHasTemplate: (o) => A(o) === 0 ? !0 : (e({
|
|
47
|
+
type: i.Warning,
|
|
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
|
+
};
|
|
42
55
|
};
|
|
43
56
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
_ as EMPTY_BLOCK_KEY,
|
|
58
|
+
m as EXTERNALLY_MANAGED_UNSUBSCRIBE_KEY,
|
|
59
|
+
A as countUnsubBlocksWithoutPage,
|
|
60
|
+
S as findDuplicateUnsubPageTypes,
|
|
61
|
+
B as hasInsiderUnsubscribeCode,
|
|
62
|
+
I as useUnsubscribeBlockValidator
|
|
48
63
|
};
|
|
@@ -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))(n || {});
|
|
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.ExternallyManagedUnsubscribe = "externally-managed-unsubscribe", s))(n || {});
|
|
2
2
|
export {
|
|
3
3
|
n as SaveValidationRule
|
|
4
4
|
};
|
package/dist/package.json.js
CHANGED
|
@@ -417,6 +417,8 @@ export declare const FeaturesSchema: v.ObjectSchema<{
|
|
|
417
417
|
readonly reusableRecommendationStrategy: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
418
418
|
/** Items block: Recommendation-style price formatting (root currency-* attrs, raw price tags). Released dark. */
|
|
419
419
|
readonly itemsPriceFormatting: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
420
|
+
/** Warn on save when the design carries an Insider unsubscribe link or code (host sets true for SFMC accounts) */
|
|
421
|
+
readonly blockUnsubscribeLinks: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
420
422
|
}, undefined>;
|
|
421
423
|
/**
|
|
422
424
|
* Default block types available in Stripo
|
|
@@ -838,6 +840,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
838
840
|
readonly reusableRecommendationStrategy: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
839
841
|
/** Items block: Recommendation-style price formatting (root currency-* attrs, raw price tags). Released dark. */
|
|
840
842
|
readonly itemsPriceFormatting: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
843
|
+
/** Warn on save when the design carries an Insider unsubscribe link or code (host sets true for SFMC accounts) */
|
|
844
|
+
readonly blockUnsubscribeLinks: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
841
845
|
}, undefined>, {}>;
|
|
842
846
|
/** Block configuration */
|
|
843
847
|
readonly blocks: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -106,6 +106,7 @@ export declare const useConfig: () => {
|
|
|
106
106
|
allowSaveWithErrors: boolean;
|
|
107
107
|
reusableRecommendationStrategy: boolean;
|
|
108
108
|
itemsPriceFormatting: boolean;
|
|
109
|
+
blockUnsubscribeLinks: boolean;
|
|
109
110
|
};
|
|
110
111
|
blocks: {
|
|
111
112
|
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")[];
|
|
@@ -247,6 +248,7 @@ export declare const useConfig: () => {
|
|
|
247
248
|
allowSaveWithErrors: boolean;
|
|
248
249
|
reusableRecommendationStrategy: boolean;
|
|
249
250
|
itemsPriceFormatting: boolean;
|
|
251
|
+
blockUnsubscribeLinks: boolean;
|
|
250
252
|
} | null>;
|
|
251
253
|
blocks: import("vue").ComputedRef<{
|
|
252
254
|
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[]) => Promise<SaveValidationError[]>;
|
|
4
|
+
collectSaveValidationErrors: (compiledHtml: string, dynamicContentList: DynamicContent[], rawHtml: string) => Promise<SaveValidationError[]>;
|
|
5
5
|
validateCurrentTemplate: () => Promise<SaveValidationError[]>;
|
|
6
6
|
};
|
|
@@ -3,6 +3,9 @@ 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;
|
|
6
9
|
/** Pure core: the singleton rules whose page type appears more than once. */
|
|
7
10
|
export declare function findDuplicateUnsubPageTypes(html: string): typeof SINGLETON_BLOCK_RULES;
|
|
8
11
|
/** Pure core: count of unsubscribe blocks with no page type or page list chosen. */
|
|
@@ -10,5 +13,6 @@ export declare function countUnsubBlocksWithoutPage(html: string): number;
|
|
|
10
13
|
export declare const useUnsubscribeBlockValidator: () => {
|
|
11
14
|
validateUnsubscribeBlockUniqueness: (html: string) => boolean;
|
|
12
15
|
validateUnsubscribeBlockHasTemplate: (html: string) => boolean;
|
|
16
|
+
validateNoInsiderUnsubscribeCode: (html: string, silent?: boolean) => boolean;
|
|
13
17
|
};
|
|
14
18
|
export {};
|
|
@@ -23,5 +23,6 @@ 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"
|
|
26
|
+
RadioButtonUnsubGroup = "radio-button-unsub-group",
|
|
27
|
+
ExternallyManagedUnsubscribe = "externally-managed-unsubscribe"
|
|
27
28
|
}
|
|
@@ -111,6 +111,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
111
111
|
allowSaveWithErrors: boolean;
|
|
112
112
|
reusableRecommendationStrategy: boolean;
|
|
113
113
|
itemsPriceFormatting: boolean;
|
|
114
|
+
blockUnsubscribeLinks: boolean;
|
|
114
115
|
};
|
|
115
116
|
blocks: {
|
|
116
117
|
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")[];
|
|
@@ -258,6 +259,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
258
259
|
allowSaveWithErrors: boolean;
|
|
259
260
|
reusableRecommendationStrategy: boolean;
|
|
260
261
|
itemsPriceFormatting: boolean;
|
|
262
|
+
blockUnsubscribeLinks: boolean;
|
|
261
263
|
};
|
|
262
264
|
blocks: {
|
|
263
265
|
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")[];
|
|
@@ -405,6 +407,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
405
407
|
allowSaveWithErrors: boolean;
|
|
406
408
|
reusableRecommendationStrategy: boolean;
|
|
407
409
|
itemsPriceFormatting: boolean;
|
|
410
|
+
blockUnsubscribeLinks: boolean;
|
|
408
411
|
};
|
|
409
412
|
blocks: {
|
|
410
413
|
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")[];
|
|
@@ -552,6 +555,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
552
555
|
allowSaveWithErrors: boolean;
|
|
553
556
|
reusableRecommendationStrategy: boolean;
|
|
554
557
|
itemsPriceFormatting: boolean;
|
|
558
|
+
blockUnsubscribeLinks: boolean;
|
|
555
559
|
};
|
|
556
560
|
blocks: {
|
|
557
561
|
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")[];
|
|
@@ -699,6 +703,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
699
703
|
allowSaveWithErrors: boolean;
|
|
700
704
|
reusableRecommendationStrategy: boolean;
|
|
701
705
|
itemsPriceFormatting: boolean;
|
|
706
|
+
blockUnsubscribeLinks: boolean;
|
|
702
707
|
};
|
|
703
708
|
blocks: {
|
|
704
709
|
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")[];
|
|
@@ -846,6 +851,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
846
851
|
allowSaveWithErrors: boolean;
|
|
847
852
|
reusableRecommendationStrategy: boolean;
|
|
848
853
|
itemsPriceFormatting: boolean;
|
|
854
|
+
blockUnsubscribeLinks: boolean;
|
|
849
855
|
};
|
|
850
856
|
blocks: {
|
|
851
857
|
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")[];
|
|
@@ -993,6 +999,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
993
999
|
allowSaveWithErrors: boolean;
|
|
994
1000
|
reusableRecommendationStrategy: boolean;
|
|
995
1001
|
itemsPriceFormatting: boolean;
|
|
1002
|
+
blockUnsubscribeLinks: boolean;
|
|
996
1003
|
};
|
|
997
1004
|
blocks: {
|
|
998
1005
|
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")[];
|
|
@@ -1140,6 +1147,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1140
1147
|
allowSaveWithErrors: boolean;
|
|
1141
1148
|
reusableRecommendationStrategy: boolean;
|
|
1142
1149
|
itemsPriceFormatting: boolean;
|
|
1150
|
+
blockUnsubscribeLinks: boolean;
|
|
1143
1151
|
};
|
|
1144
1152
|
blocks: {
|
|
1145
1153
|
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")[];
|
|
@@ -1287,6 +1295,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1287
1295
|
allowSaveWithErrors: boolean;
|
|
1288
1296
|
reusableRecommendationStrategy: boolean;
|
|
1289
1297
|
itemsPriceFormatting: boolean;
|
|
1298
|
+
blockUnsubscribeLinks: boolean;
|
|
1290
1299
|
};
|
|
1291
1300
|
blocks: {
|
|
1292
1301
|
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")[];
|
|
@@ -1434,6 +1443,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1434
1443
|
allowSaveWithErrors: boolean;
|
|
1435
1444
|
reusableRecommendationStrategy: boolean;
|
|
1436
1445
|
itemsPriceFormatting: boolean;
|
|
1446
|
+
blockUnsubscribeLinks: boolean;
|
|
1437
1447
|
};
|
|
1438
1448
|
blocks: {
|
|
1439
1449
|
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")[];
|
|
@@ -1581,6 +1591,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1581
1591
|
allowSaveWithErrors: boolean;
|
|
1582
1592
|
reusableRecommendationStrategy: boolean;
|
|
1583
1593
|
itemsPriceFormatting: boolean;
|
|
1594
|
+
blockUnsubscribeLinks: boolean;
|
|
1584
1595
|
};
|
|
1585
1596
|
blocks: {
|
|
1586
1597
|
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")[];
|
|
@@ -1728,6 +1739,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1728
1739
|
allowSaveWithErrors: boolean;
|
|
1729
1740
|
reusableRecommendationStrategy: boolean;
|
|
1730
1741
|
itemsPriceFormatting: boolean;
|
|
1742
|
+
blockUnsubscribeLinks: boolean;
|
|
1731
1743
|
};
|
|
1732
1744
|
blocks: {
|
|
1733
1745
|
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")[];
|
|
@@ -1875,6 +1887,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1875
1887
|
allowSaveWithErrors: boolean;
|
|
1876
1888
|
reusableRecommendationStrategy: boolean;
|
|
1877
1889
|
itemsPriceFormatting: boolean;
|
|
1890
|
+
blockUnsubscribeLinks: boolean;
|
|
1878
1891
|
};
|
|
1879
1892
|
blocks: {
|
|
1880
1893
|
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")[];
|
|
@@ -2022,6 +2035,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2022
2035
|
allowSaveWithErrors: boolean;
|
|
2023
2036
|
reusableRecommendationStrategy: boolean;
|
|
2024
2037
|
itemsPriceFormatting: boolean;
|
|
2038
|
+
blockUnsubscribeLinks: boolean;
|
|
2025
2039
|
};
|
|
2026
2040
|
blocks: {
|
|
2027
2041
|
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")[];
|
|
@@ -2169,6 +2183,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2169
2183
|
allowSaveWithErrors: boolean;
|
|
2170
2184
|
reusableRecommendationStrategy: boolean;
|
|
2171
2185
|
itemsPriceFormatting: boolean;
|
|
2186
|
+
blockUnsubscribeLinks: boolean;
|
|
2172
2187
|
};
|
|
2173
2188
|
blocks: {
|
|
2174
2189
|
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")[];
|
|
@@ -2316,6 +2331,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2316
2331
|
allowSaveWithErrors: boolean;
|
|
2317
2332
|
reusableRecommendationStrategy: boolean;
|
|
2318
2333
|
itemsPriceFormatting: boolean;
|
|
2334
|
+
blockUnsubscribeLinks: boolean;
|
|
2319
2335
|
};
|
|
2320
2336
|
blocks: {
|
|
2321
2337
|
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")[];
|
|
@@ -2463,6 +2479,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2463
2479
|
allowSaveWithErrors: boolean;
|
|
2464
2480
|
reusableRecommendationStrategy: boolean;
|
|
2465
2481
|
itemsPriceFormatting: boolean;
|
|
2482
|
+
blockUnsubscribeLinks: boolean;
|
|
2466
2483
|
};
|
|
2467
2484
|
blocks: {
|
|
2468
2485
|
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")[];
|
|
@@ -2622,6 +2639,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2622
2639
|
allowSaveWithErrors: boolean;
|
|
2623
2640
|
reusableRecommendationStrategy: boolean;
|
|
2624
2641
|
itemsPriceFormatting: boolean;
|
|
2642
|
+
blockUnsubscribeLinks: boolean;
|
|
2625
2643
|
};
|
|
2626
2644
|
blocks: {
|
|
2627
2645
|
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")[];
|
|
@@ -2769,6 +2787,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2769
2787
|
allowSaveWithErrors: boolean;
|
|
2770
2788
|
reusableRecommendationStrategy: boolean;
|
|
2771
2789
|
itemsPriceFormatting: boolean;
|
|
2790
|
+
blockUnsubscribeLinks: boolean;
|
|
2772
2791
|
};
|
|
2773
2792
|
blocks: {
|
|
2774
2793
|
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")[];
|
|
@@ -2918,6 +2937,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2918
2937
|
allowSaveWithErrors: boolean;
|
|
2919
2938
|
reusableRecommendationStrategy: boolean;
|
|
2920
2939
|
itemsPriceFormatting: boolean;
|
|
2940
|
+
blockUnsubscribeLinks: boolean;
|
|
2921
2941
|
};
|
|
2922
2942
|
blocks: {
|
|
2923
2943
|
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")[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.26.0-beta.19d84af",
|
|
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",
|