@useinsider/guido 3.24.0-beta.88c24c1 → 3.24.0-beta.b9ec78b
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 +6 -2
- package/dist/@types/config/schemas.js +9 -11
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +1 -1
- package/dist/composables/useHtmlCompiler.js +2 -0
- package/dist/composables/useSave.js +52 -57
- package/dist/composables/useSaveValidation.js +110 -118
- package/dist/composables/useStripo.js +70 -70
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +33 -48
- package/dist/config/compiler/htmlCompilerRules.js +14 -6
- package/dist/config/migrator/unsubscribeMigrator.js +94 -98
- package/dist/enums/save-validation.js +1 -1
- package/dist/extensions/Blocks/Unsubscribe/block.js +104 -96
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +4 -3
- package/dist/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.js +5 -0
- package/dist/guido.css +1 -1
- package/dist/package.json.js +2 -2
- 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/useStripo.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/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
- package/dist/src/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.d.ts +1 -0
- package/dist/src/stores/config.d.ts +0 -20
- package/dist/src/utils/trimHrefWhitespace.d.ts +5 -0
- package/dist/utils/trimHrefWhitespace.js +10 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -124,7 +124,12 @@ const config: GuidoConfigInput = {
|
|
|
124
124
|
// host-side). Omit it and the repair is a silent no-op. Default: {}.
|
|
125
125
|
dynamicContentList?: DynamicContentList,
|
|
126
126
|
selectedUnsubscribePages?: number[],
|
|
127
|
-
|
|
127
|
+
// Default: false. Stripo opens its stored copy for the templateId unless this is true;
|
|
128
|
+
// Guido sets it itself when a load-time migration rewrote the html. Set it to true
|
|
129
|
+
// whenever the host changed html under an existing templateId outside the editor.
|
|
130
|
+
// Behaviour change: releases up to v3.23.0 forced a recreate for any non-empty html and
|
|
131
|
+
// ignored this option, so a host that sends `false` now gets Stripo's stored copy.
|
|
132
|
+
forceRecreate?: boolean,
|
|
128
133
|
migration?: {
|
|
129
134
|
// Legacy block configs keyed by block ID. Consumed once by the migrator
|
|
130
135
|
// when upgrading templates authored with v1 block formats. See the
|
|
@@ -167,7 +172,6 @@ const config: GuidoConfigInput = {
|
|
|
167
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).
|
|
168
173
|
reusableRecommendationStrategy?: boolean, // Default: false - Assign an RRS strategy to recommendation blocks instead of per-block algorithm/filters/shuffle/product-count settings.
|
|
169
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.
|
|
170
|
-
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).
|
|
171
175
|
},
|
|
172
176
|
|
|
173
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,
|
|
@@ -151,7 +151,7 @@ const Ft = /* @__PURE__ */ le({
|
|
|
151
151
|
console.debug("guido:ready"), s("ready");
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
|
-
p = U(), await R(r, v(), de), g.selectedDynamicContentList = x;
|
|
154
|
+
p = U(), await R(r, v(), de, r.html !== i), g.selectedDynamicContentList = x;
|
|
155
155
|
} catch (e) {
|
|
156
156
|
console.error("Failed to initialize Stripo editor:", e), n.markFailed();
|
|
157
157
|
}
|
|
@@ -16,6 +16,8 @@ const x = /* @__PURE__ */ new Set([
|
|
|
16
16
|
"fix-tags-end",
|
|
17
17
|
// Unwrap translate-injected <font dir="auto"> tags — pure removal, never emits AMP-forbidden output.
|
|
18
18
|
"strip-font-tags",
|
|
19
|
+
// Trim whitespace inside href values — attribute-value edit only, emits nothing new.
|
|
20
|
+
"trim-href-whitespace",
|
|
19
21
|
// Image domain corrections — plain string replacement.
|
|
20
22
|
"replace-old-image-domain",
|
|
21
23
|
"replace-old-v2-image-domain",
|
|
@@ -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
|