@useinsider/guido 2.0.0-beta.828ad6c → 2.0.0-beta.a3f32aa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/config/schemas.js +43 -29
- package/dist/components/organisms/header/RightSlot.vue2.js +10 -10
- package/dist/composables/useConfig.js +29 -27
- package/dist/composables/useSave.js +13 -11
- package/dist/extensions/Blocks/Unsubscribe/extension.js +9 -9
- package/dist/src/@types/config/index.d.ts +2 -2
- package/dist/src/@types/config/schemas.d.ts +26 -0
- package/dist/src/@types/config/types.d.ts +7 -1
- package/dist/src/composables/useConfig.d.ts +6 -0
- package/dist/src/stores/config.d.ts +145 -1
- package/dist/stores/config.js +7 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { object as o, number as
|
|
2
|
-
const
|
|
1
|
+
import { object as o, number as b, optional as e, string as t, pipe as u, picklist as n, custom as d, boolean as c, array as a, minLength as p, literal as r, variant as S } from "../../node_modules/valibot/dist/index.js";
|
|
2
|
+
const m = {
|
|
3
3
|
/** Promotional/marketing emails */
|
|
4
4
|
PROMOTIONAL: 1,
|
|
5
5
|
/** Transactional/system emails */
|
|
@@ -13,22 +13,22 @@ const i = {
|
|
|
13
13
|
UNSUBSCRIBE_PAGES: 97
|
|
14
14
|
}, h = o({
|
|
15
15
|
/** Unique identifier for the template being edited */
|
|
16
|
-
templateId:
|
|
16
|
+
templateId: u(
|
|
17
17
|
t(),
|
|
18
|
-
|
|
18
|
+
p(1, "templateId is required")
|
|
19
19
|
),
|
|
20
20
|
/** Unique identifier for the user editing the template */
|
|
21
|
-
userId:
|
|
21
|
+
userId: u(
|
|
22
22
|
t(),
|
|
23
|
-
|
|
23
|
+
p(1, "userId is required")
|
|
24
24
|
),
|
|
25
25
|
/** Optional variation ID for A/B testing */
|
|
26
26
|
variationId: e(t())
|
|
27
27
|
}), k = o({
|
|
28
28
|
/** Partner/organization name (required) */
|
|
29
|
-
name:
|
|
29
|
+
name: u(
|
|
30
30
|
t(),
|
|
31
|
-
|
|
31
|
+
p(1, "partner.name is required")
|
|
32
32
|
),
|
|
33
33
|
/** Product type identifier */
|
|
34
34
|
productType: e(
|
|
@@ -41,8 +41,8 @@ const i = {
|
|
|
41
41
|
),
|
|
42
42
|
/** Message type (promotional or transactional) */
|
|
43
43
|
messageType: e(
|
|
44
|
-
n([
|
|
45
|
-
|
|
44
|
+
n([m.PROMOTIONAL, m.TRANSACTIONAL]),
|
|
45
|
+
m.PROMOTIONAL
|
|
46
46
|
),
|
|
47
47
|
/** Display name for the current user */
|
|
48
48
|
username: e(t(), "Guido User")
|
|
@@ -60,7 +60,7 @@ const i = {
|
|
|
60
60
|
value: t()
|
|
61
61
|
})
|
|
62
62
|
)
|
|
63
|
-
}),
|
|
63
|
+
}), C = o({
|
|
64
64
|
/** Initial HTML content */
|
|
65
65
|
html: e(t(), ""),
|
|
66
66
|
/** Initial CSS content */
|
|
@@ -71,8 +71,8 @@ const i = {
|
|
|
71
71
|
[]
|
|
72
72
|
),
|
|
73
73
|
/** Selected unsubscribe page IDs */
|
|
74
|
-
selectedUnsubscribePages: e(a(
|
|
75
|
-
}),
|
|
74
|
+
selectedUnsubscribePages: e(a(b()), [])
|
|
75
|
+
}), R = o({
|
|
76
76
|
/** Sender display name */
|
|
77
77
|
senderName: e(t(), ""),
|
|
78
78
|
/** Email subject line */
|
|
@@ -83,9 +83,9 @@ const i = {
|
|
|
83
83
|
/** Path to translations object */
|
|
84
84
|
translationsPath: e(t(), "window.trans.en"),
|
|
85
85
|
/** Migration date for template compatibility */
|
|
86
|
-
migrationDate: e(
|
|
86
|
+
migrationDate: e(b(), 1759696858),
|
|
87
87
|
/** Email header settings */
|
|
88
|
-
emailHeader: e(
|
|
88
|
+
emailHeader: e(R, { senderName: "", subject: "" })
|
|
89
89
|
}), T = o({
|
|
90
90
|
/** Whether to show the header bar */
|
|
91
91
|
showHeader: e(c(), !0),
|
|
@@ -143,7 +143,7 @@ const i = {
|
|
|
143
143
|
/** Human-readable description */
|
|
144
144
|
description: e(t()),
|
|
145
145
|
/** Priority for rule ordering (lower = earlier) */
|
|
146
|
-
priority:
|
|
146
|
+
priority: b()
|
|
147
147
|
}), N = o({
|
|
148
148
|
...l.entries,
|
|
149
149
|
type: r("replace"),
|
|
@@ -172,20 +172,31 @@ const i = {
|
|
|
172
172
|
type: r("custom"),
|
|
173
173
|
/** Custom processor function */
|
|
174
174
|
processor: d(
|
|
175
|
-
(
|
|
175
|
+
(i) => typeof i == "function",
|
|
176
176
|
"processor must be a function"
|
|
177
177
|
)
|
|
178
|
-
}),
|
|
178
|
+
}), x = S("type", [
|
|
179
179
|
N,
|
|
180
180
|
O,
|
|
181
181
|
L,
|
|
182
182
|
v
|
|
183
|
-
]),
|
|
183
|
+
]), B = o({
|
|
184
184
|
/** Custom compiler rules to apply */
|
|
185
|
-
customRules: e(a(
|
|
185
|
+
customRules: e(a(x), []),
|
|
186
186
|
/** Skip default compiler rules */
|
|
187
187
|
ignoreDefaultRules: e(c(), !1)
|
|
188
|
-
}),
|
|
188
|
+
}), P = o({
|
|
189
|
+
/**
|
|
190
|
+
* External validation handler called before save completes.
|
|
191
|
+
* Return false to cancel the save operation.
|
|
192
|
+
*/
|
|
193
|
+
externalValidation: e(
|
|
194
|
+
d(
|
|
195
|
+
(i) => typeof i == "function",
|
|
196
|
+
"externalValidation must be a function"
|
|
197
|
+
)
|
|
198
|
+
)
|
|
199
|
+
}), U = o({
|
|
189
200
|
// Required sections
|
|
190
201
|
/** Identity configuration (required) */
|
|
191
202
|
identity: h,
|
|
@@ -193,7 +204,7 @@ const i = {
|
|
|
193
204
|
partner: k,
|
|
194
205
|
// Optional sections (with defaults)
|
|
195
206
|
/** Template content and presets */
|
|
196
|
-
template: e(
|
|
207
|
+
template: e(C, {}),
|
|
197
208
|
/** Editor settings */
|
|
198
209
|
editor: e(I, {}),
|
|
199
210
|
/** UI configuration */
|
|
@@ -203,27 +214,30 @@ const i = {
|
|
|
203
214
|
/** Block configuration */
|
|
204
215
|
blocks: e(E, {}),
|
|
205
216
|
/** Compiler configuration */
|
|
206
|
-
compiler: e(
|
|
217
|
+
compiler: e(B, {}),
|
|
218
|
+
/** Callbacks and event handlers */
|
|
219
|
+
callbacks: e(P, {})
|
|
207
220
|
});
|
|
208
221
|
export {
|
|
209
222
|
E as BlocksSchema,
|
|
210
|
-
|
|
211
|
-
|
|
223
|
+
P as CallbacksSchema,
|
|
224
|
+
x as CompilerRuleSchema,
|
|
225
|
+
B as CompilerSchema,
|
|
212
226
|
g as CustomBlockTypeSchema,
|
|
213
227
|
v as CustomRuleSchema,
|
|
214
228
|
f as DefaultBlockTypeSchema,
|
|
215
229
|
y as DynamicContentSchema,
|
|
216
230
|
I as EditorSchema,
|
|
217
|
-
|
|
231
|
+
R as EmailHeaderSchema,
|
|
218
232
|
A as FeaturesSchema,
|
|
219
|
-
|
|
233
|
+
U as GuidoConfigSchema,
|
|
220
234
|
h as IdentitySchema,
|
|
221
|
-
|
|
235
|
+
m as MessageType,
|
|
222
236
|
k as PartnerSchema,
|
|
223
237
|
s as ProductType,
|
|
224
238
|
O as RegexRuleSchema,
|
|
225
239
|
L as RemoveRuleSchema,
|
|
226
240
|
N as ReplaceRuleSchema,
|
|
227
|
-
|
|
241
|
+
C as TemplateSchema,
|
|
228
242
|
T as UISchema
|
|
229
243
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as H, ref as
|
|
1
|
+
import { defineComponent as H, ref as c, computed as _ } from "vue";
|
|
2
2
|
import { useConfig as h } from "../../../composables/useConfig.js";
|
|
3
3
|
import { useExport as V } from "../../../composables/useExport.js";
|
|
4
4
|
import { useTestEmailClick as x } from "../../../composables/useGuidoActions.js";
|
|
@@ -10,25 +10,25 @@ import { getTooltipOptions as O } from "../../../utils/tooltipUtils.js";
|
|
|
10
10
|
import { InButtonV2 as A } from "@useinsider/design-system-vue";
|
|
11
11
|
const J = /* @__PURE__ */ H({
|
|
12
12
|
__name: "RightSlot",
|
|
13
|
-
setup(k, { expose:
|
|
14
|
-
const { config:
|
|
13
|
+
setup(k, { expose: u }) {
|
|
14
|
+
const { config: f } = h(), { exportHtml: r } = V(), { save: n } = E(), { openVersionHistory: i, closeVersionHistory: a } = w(), o = C(), t = T(), e = c(!1), s = c(!1), v = x(), d = () => {
|
|
15
15
|
if (o.isVersionHistoryOpen) {
|
|
16
16
|
a();
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
i();
|
|
20
|
-
},
|
|
20
|
+
}, y = async () => {
|
|
21
21
|
e.value = !0, await r(), e.value = !1;
|
|
22
|
-
},
|
|
22
|
+
}, S = () => {
|
|
23
23
|
o.isSaveAsTemplateDrawerOpen = !0;
|
|
24
|
-
},
|
|
24
|
+
}, g = _(() => o.isVersionHistoryOpen ? t("newsletter.close-version-history") : t("newsletter.version-history")), l = async (p) => {
|
|
25
25
|
s.value = !0, o.loadingStatus = !0;
|
|
26
|
-
const
|
|
27
|
-
return s.value = !1, p && (o.loadingStatus = !1),
|
|
26
|
+
const m = await n(p);
|
|
27
|
+
return s.value = !1, (p || !m) && (o.loadingStatus = !1), m;
|
|
28
28
|
};
|
|
29
|
-
return
|
|
29
|
+
return u({
|
|
30
30
|
handleSave: l
|
|
31
|
-
}), { __sfc: !0, config:
|
|
31
|
+
}), { __sfc: !0, config: f, exportHtml: r, save: n, openVersionHistory: i, closeVersionHistory: a, editorStore: o, trans: t, isExporting: e, isSaving: s, testEmailClick: v, handleVersionHistory: d, handleExport: y, handleSaveAs: S, versionHistoryTooltipText: g, handleSave: l, getTooltipOptions: O, InButtonV2: A };
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
export {
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { useConfigStore as
|
|
2
|
-
import { storeToRefs as
|
|
3
|
-
const
|
|
4
|
-
const e =
|
|
1
|
+
import { useConfigStore as I } from "../stores/config.js";
|
|
2
|
+
import { storeToRefs as T } from "pinia";
|
|
3
|
+
const w = () => {
|
|
4
|
+
const e = I(), {
|
|
5
5
|
config: t,
|
|
6
6
|
initialized: o,
|
|
7
7
|
identity: r,
|
|
8
8
|
partner: i,
|
|
9
|
-
template:
|
|
10
|
-
editor:
|
|
9
|
+
template: a,
|
|
10
|
+
editor: n,
|
|
11
11
|
ui: s,
|
|
12
|
-
features:
|
|
13
|
-
blocks:
|
|
14
|
-
compiler:
|
|
15
|
-
|
|
12
|
+
features: c,
|
|
13
|
+
blocks: u,
|
|
14
|
+
compiler: d,
|
|
15
|
+
callbacks: l,
|
|
16
|
+
templateId: p,
|
|
16
17
|
userId: f,
|
|
17
18
|
variationId: m,
|
|
18
19
|
partnerName: g,
|
|
19
|
-
productType:
|
|
20
|
-
messageType:
|
|
21
|
-
username:
|
|
22
|
-
showHeader:
|
|
23
|
-
} =
|
|
20
|
+
productType: b,
|
|
21
|
+
messageType: C,
|
|
22
|
+
username: y,
|
|
23
|
+
showHeader: E
|
|
24
|
+
} = T(e);
|
|
24
25
|
return {
|
|
25
26
|
// State refs
|
|
26
27
|
config: t,
|
|
@@ -28,26 +29,27 @@ const k = () => {
|
|
|
28
29
|
// Section refs
|
|
29
30
|
identity: r,
|
|
30
31
|
partner: i,
|
|
31
|
-
template:
|
|
32
|
-
editor:
|
|
32
|
+
template: a,
|
|
33
|
+
editor: n,
|
|
33
34
|
ui: s,
|
|
34
|
-
features:
|
|
35
|
-
blocks:
|
|
36
|
-
compiler:
|
|
35
|
+
features: c,
|
|
36
|
+
blocks: u,
|
|
37
|
+
compiler: d,
|
|
38
|
+
callbacks: l,
|
|
37
39
|
// Convenience refs
|
|
38
|
-
templateId:
|
|
40
|
+
templateId: p,
|
|
39
41
|
userId: f,
|
|
40
42
|
variationId: m,
|
|
41
43
|
partnerName: g,
|
|
42
|
-
productType:
|
|
43
|
-
messageType:
|
|
44
|
-
username:
|
|
45
|
-
showHeader:
|
|
44
|
+
productType: b,
|
|
45
|
+
messageType: C,
|
|
46
|
+
username: y,
|
|
47
|
+
showHeader: E,
|
|
46
48
|
// Methods
|
|
47
49
|
getConfig: () => t.value,
|
|
48
|
-
isFeatureEnabled: (
|
|
50
|
+
isFeatureEnabled: (F) => e.isFeatureEnabled(F)
|
|
49
51
|
};
|
|
50
52
|
};
|
|
51
53
|
export {
|
|
52
|
-
|
|
54
|
+
w as useConfig
|
|
53
55
|
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { useConfig as l } from "./useConfig.js";
|
|
2
|
+
import { useSaveStart as m, useSaveComplete as c } from "./useGuidoActions.js";
|
|
3
|
+
import { useTemplatePreparation as d } from "../utils/templatePreparation.js";
|
|
4
|
+
import { useHtmlValidator as p } from "./useHtmlValidator.js";
|
|
5
|
+
const w = () => {
|
|
6
|
+
const i = m(), s = c(), { validateHtml: o } = p(), { callbacks: a } = l();
|
|
7
|
+
return { save: async (r = !1) => {
|
|
8
|
+
var e;
|
|
9
|
+
i();
|
|
10
|
+
const { prepareTemplateDetails: n } = d(), t = await n();
|
|
11
|
+
if (await o(t.compiledHtml, t.dynamicContentList, !0) && !((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)))
|
|
12
|
+
return r || s(t), t;
|
|
11
13
|
} };
|
|
12
14
|
};
|
|
13
15
|
export {
|
|
14
|
-
|
|
16
|
+
w as useSave
|
|
15
17
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { ExtensionBuilder as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { UnsubscribeBlock as i } from "./block.js";
|
|
3
3
|
import { UnsubscribeControl as t } from "./control.js";
|
|
4
|
-
import { PreviewUIElement as
|
|
5
|
-
import { UnsubscribeIconsRegistry as
|
|
6
|
-
import { SettingsPanel as
|
|
4
|
+
import { PreviewUIElement as s } from "./elements/preview.js";
|
|
5
|
+
import { UnsubscribeIconsRegistry as o } from "./iconsRegistry.js";
|
|
6
|
+
import { SettingsPanel as r } from "./settingsPanel.js";
|
|
7
7
|
import n from "./styles.css.js";
|
|
8
|
-
import { UnsubscribeTagRegistry as
|
|
9
|
-
const
|
|
8
|
+
import { UnsubscribeTagRegistry as c } from "./tagRegistry.js";
|
|
9
|
+
const g = new e().addBlock(i).withSettingsPanelRegistry(r).addControl(t).addUiElement(s).addStyles(n).withLocalization({
|
|
10
10
|
en: {
|
|
11
|
-
"Unsubscribe Block": "Unsubscribe
|
|
12
|
-
"Unsubscribe Block Description": "
|
|
11
|
+
"Unsubscribe Block": "Unsubscribe",
|
|
12
|
+
"Unsubscribe Block Description": "Unsubscribe lets you add an Unsubscribe Link to direct users to opt out of receiving your messages.",
|
|
13
13
|
"Select Template": "Select Template",
|
|
14
14
|
"Unsubscribe Template": "Unsubscribe Template",
|
|
15
15
|
Showing: "Showing",
|
|
16
16
|
of: "of"
|
|
17
17
|
}
|
|
18
|
-
}).withUiElementTagRegistry(
|
|
18
|
+
}).withUiElementTagRegistry(c).withIconsRegistry(o).build();
|
|
19
19
|
export {
|
|
20
|
-
|
|
20
|
+
g as default
|
|
21
21
|
};
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* - Default values for optional configuration
|
|
8
8
|
* - Validation utilities
|
|
9
9
|
*/
|
|
10
|
-
export { MessageType, ProductType, GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, DynamicContentSchema, EmailHeaderSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema, CompilerRuleSchema, CompilerRuleTypeSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, } from './schemas';
|
|
11
|
-
export type { GuidoConfig, GuidoConfigInput, IdentityConfig, IdentityConfigInput, PartnerConfig, PartnerConfigInput, TemplateConfig, TemplateConfigInput, EditorConfig, EditorConfigInput, UIConfig, UIConfigInput, FeaturesConfig, FeaturesConfigInput, BlocksConfig, BlocksConfigInput, CompilerConfig, CompilerConfigInput, EmailHeader, DynamicContent, DefaultBlockType, CustomBlockType, BlockType, FeatureName, CompilerRule, ReplaceRule, RegexRule, RemoveRule, CustomRule, DeepPartial, ConfigOverrides, } from './types';
|
|
10
|
+
export { MessageType, ProductType, GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, CallbacksSchema, DynamicContentSchema, EmailHeaderSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema, CompilerRuleSchema, CompilerRuleTypeSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, } from './schemas';
|
|
11
|
+
export type { GuidoConfig, GuidoConfigInput, IdentityConfig, IdentityConfigInput, PartnerConfig, PartnerConfigInput, TemplateConfig, TemplateConfigInput, EditorConfig, EditorConfigInput, UIConfig, UIConfigInput, FeaturesConfig, FeaturesConfigInput, BlocksConfig, BlocksConfigInput, CompilerConfig, CompilerConfigInput, CallbacksConfig, CallbacksConfigInput, ExternalValidationHandler, EmailHeader, DynamicContent, DefaultBlockType, CustomBlockType, BlockType, FeatureName, CompilerRule, ReplaceRule, RegexRule, RemoveRule, CustomRule, DeepPartial, ConfigOverrides, } from './types';
|
|
12
12
|
export { DEFAULT_EMAIL_HEADER, DEFAULT_TEMPLATE, DEFAULT_EDITOR, DEFAULT_UI, DEFAULT_FEATURES, DEFAULT_BLOCKS, DEFAULT_COMPILER, DEFAULT_PRODUCT_TYPE, DEFAULT_MESSAGE_TYPE, DEFAULT_USERNAME, EDITOR_TYPE, TEST_PARTNERS, isTestPartner, } from './defaults';
|
|
13
13
|
export { validateConfig, parseConfig, parseConfigSafe, getValidationErrors, isValidConfig, validateIdentity, validatePartner, } from './validator';
|
|
14
14
|
export type { ValidationResult, ValidationError, } from './validator';
|
|
@@ -5,7 +5,14 @@
|
|
|
5
5
|
* All types are inferred from these schemas to ensure single source of truth.
|
|
6
6
|
* @module @types/config/schemas
|
|
7
7
|
*/
|
|
8
|
+
import type { SavedTemplateDetails } from '../stripo';
|
|
8
9
|
import * as v from 'valibot';
|
|
10
|
+
/**
|
|
11
|
+
* Handler function for external validation before save
|
|
12
|
+
* @param data - The template details to validate
|
|
13
|
+
* @returns Promise<boolean> - true if valid, false to cancel save
|
|
14
|
+
*/
|
|
15
|
+
export type ExternalValidationHandler = (data: SavedTemplateDetails) => Promise<boolean>;
|
|
9
16
|
/**
|
|
10
17
|
* Message type constants for email templates
|
|
11
18
|
*/
|
|
@@ -342,6 +349,16 @@ export declare const CompilerSchema: v.ObjectSchema<{
|
|
|
342
349
|
/** Skip default compiler rules */
|
|
343
350
|
readonly ignoreDefaultRules: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
344
351
|
}, undefined>;
|
|
352
|
+
/**
|
|
353
|
+
* Callbacks configuration - event handlers and hooks
|
|
354
|
+
*/
|
|
355
|
+
export declare const CallbacksSchema: v.ObjectSchema<{
|
|
356
|
+
/**
|
|
357
|
+
* External validation handler called before save completes.
|
|
358
|
+
* Return false to cancel the save operation.
|
|
359
|
+
*/
|
|
360
|
+
readonly externalValidation: v.OptionalSchema<v.CustomSchema<ExternalValidationHandler, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
|
|
361
|
+
}, undefined>;
|
|
345
362
|
/**
|
|
346
363
|
* Complete Guido configuration schema
|
|
347
364
|
*
|
|
@@ -354,6 +371,7 @@ export declare const CompilerSchema: v.ObjectSchema<{
|
|
|
354
371
|
* - features: Feature toggles
|
|
355
372
|
* - blocks: Block configuration
|
|
356
373
|
* - compiler: HTML compilation
|
|
374
|
+
* - callbacks: Event handlers and hooks
|
|
357
375
|
*/
|
|
358
376
|
export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
359
377
|
/** Identity configuration (required) */
|
|
@@ -502,4 +520,12 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
502
520
|
/** Skip default compiler rules */
|
|
503
521
|
readonly ignoreDefaultRules: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
504
522
|
}, undefined>, {}>;
|
|
523
|
+
/** Callbacks and event handlers */
|
|
524
|
+
readonly callbacks: v.OptionalSchema<v.ObjectSchema<{
|
|
525
|
+
/**
|
|
526
|
+
* External validation handler called before save completes.
|
|
527
|
+
* Return false to cancel the save operation.
|
|
528
|
+
*/
|
|
529
|
+
readonly externalValidation: v.OptionalSchema<v.CustomSchema<ExternalValidationHandler, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
|
|
530
|
+
}, undefined>, {}>;
|
|
505
531
|
}, undefined>;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* This ensures type definitions are always in sync with validation.
|
|
6
6
|
* @module @types/config/types
|
|
7
7
|
*/
|
|
8
|
-
import type { GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, DynamicContentSchema, EmailHeaderSchema, CompilerRuleSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema } from './schemas';
|
|
8
|
+
import type { GuidoConfigSchema, IdentitySchema, PartnerSchema, TemplateSchema, EditorSchema, UISchema, FeaturesSchema, BlocksSchema, CompilerSchema, CallbacksSchema, DynamicContentSchema, EmailHeaderSchema, CompilerRuleSchema, ReplaceRuleSchema, RegexRuleSchema, RemoveRuleSchema, CustomRuleSchema, DefaultBlockTypeSchema, CustomBlockTypeSchema, ExternalValidationHandler } from './schemas';
|
|
9
9
|
import type * as v from 'valibot';
|
|
10
10
|
/**
|
|
11
11
|
* Complete validated Guido configuration.
|
|
@@ -41,6 +41,10 @@ export type FeaturesConfig = v.InferOutput<typeof FeaturesSchema>;
|
|
|
41
41
|
export type BlocksConfig = v.InferOutput<typeof BlocksSchema>;
|
|
42
42
|
/** Compiler configuration (custom rules, ignore defaults) */
|
|
43
43
|
export type CompilerConfig = v.InferOutput<typeof CompilerSchema>;
|
|
44
|
+
/** Callbacks configuration (event handlers and hooks) */
|
|
45
|
+
export type CallbacksConfig = v.InferOutput<typeof CallbacksSchema>;
|
|
46
|
+
/** Re-export ExternalValidationHandler for convenience */
|
|
47
|
+
export type { ExternalValidationHandler };
|
|
44
48
|
/** Email header configuration (senderName, subject) */
|
|
45
49
|
export type EmailHeader = v.InferOutput<typeof EmailHeaderSchema>;
|
|
46
50
|
/** Dynamic content item */
|
|
@@ -85,6 +89,8 @@ export type FeaturesConfigInput = v.InferInput<typeof FeaturesSchema>;
|
|
|
85
89
|
export type BlocksConfigInput = v.InferInput<typeof BlocksSchema>;
|
|
86
90
|
/** Input type for compiler configuration */
|
|
87
91
|
export type CompilerConfigInput = v.InferInput<typeof CompilerSchema>;
|
|
92
|
+
/** Input type for callbacks configuration */
|
|
93
|
+
export type CallbacksConfigInput = v.InferInput<typeof CallbacksSchema>;
|
|
88
94
|
/** Default Stripo block types */
|
|
89
95
|
export type DefaultBlockType = v.InferOutput<typeof DefaultBlockTypeSchema>;
|
|
90
96
|
/** Custom Guido block types */
|
|
@@ -89,6 +89,9 @@ export declare const useConfig: () => {
|
|
|
89
89
|
})[];
|
|
90
90
|
ignoreDefaultRules: boolean;
|
|
91
91
|
};
|
|
92
|
+
callbacks: {
|
|
93
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
94
|
+
};
|
|
92
95
|
} | null>;
|
|
93
96
|
initialized: import("vue").Ref<boolean>;
|
|
94
97
|
identity: import("vue").ComputedRef<{
|
|
@@ -173,6 +176,9 @@ export declare const useConfig: () => {
|
|
|
173
176
|
})[];
|
|
174
177
|
ignoreDefaultRules: boolean;
|
|
175
178
|
} | null>;
|
|
179
|
+
callbacks: import("vue").ComputedRef<{
|
|
180
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
181
|
+
} | null>;
|
|
176
182
|
templateId: import("vue").ComputedRef<string>;
|
|
177
183
|
userId: import("vue").ComputedRef<string>;
|
|
178
184
|
variationId: import("vue").ComputedRef<string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GuidoConfig, GuidoConfigInput, IdentityConfig, PartnerConfig, TemplateConfig, EditorConfig, UIConfig, FeaturesConfig, BlocksConfig, CompilerConfig } from '@@/Types/config';
|
|
1
|
+
import type { GuidoConfig, GuidoConfigInput, IdentityConfig, PartnerConfig, TemplateConfig, EditorConfig, UIConfig, FeaturesConfig, BlocksConfig, CompilerConfig, CallbacksConfig } from '@@/Types/config';
|
|
2
2
|
interface ConfigStoreState {
|
|
3
3
|
/** Whether the config has been initialized */
|
|
4
4
|
initialized: boolean;
|
|
@@ -94,6 +94,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
94
94
|
})[];
|
|
95
95
|
ignoreDefaultRules: boolean;
|
|
96
96
|
};
|
|
97
|
+
callbacks: {
|
|
98
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
99
|
+
};
|
|
97
100
|
} | null;
|
|
98
101
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => IdentityConfig | null;
|
|
99
102
|
/**
|
|
@@ -184,6 +187,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
184
187
|
})[];
|
|
185
188
|
ignoreDefaultRules: boolean;
|
|
186
189
|
};
|
|
190
|
+
callbacks: {
|
|
191
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
192
|
+
};
|
|
187
193
|
} | null;
|
|
188
194
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => PartnerConfig | null;
|
|
189
195
|
/**
|
|
@@ -274,6 +280,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
274
280
|
})[];
|
|
275
281
|
ignoreDefaultRules: boolean;
|
|
276
282
|
};
|
|
283
|
+
callbacks: {
|
|
284
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
285
|
+
};
|
|
277
286
|
} | null;
|
|
278
287
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => TemplateConfig | null;
|
|
279
288
|
/**
|
|
@@ -364,6 +373,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
364
373
|
})[];
|
|
365
374
|
ignoreDefaultRules: boolean;
|
|
366
375
|
};
|
|
376
|
+
callbacks: {
|
|
377
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
378
|
+
};
|
|
367
379
|
} | null;
|
|
368
380
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => EditorConfig | null;
|
|
369
381
|
/**
|
|
@@ -454,6 +466,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
454
466
|
})[];
|
|
455
467
|
ignoreDefaultRules: boolean;
|
|
456
468
|
};
|
|
469
|
+
callbacks: {
|
|
470
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
471
|
+
};
|
|
457
472
|
} | null;
|
|
458
473
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => UIConfig | null;
|
|
459
474
|
/**
|
|
@@ -544,6 +559,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
544
559
|
})[];
|
|
545
560
|
ignoreDefaultRules: boolean;
|
|
546
561
|
};
|
|
562
|
+
callbacks: {
|
|
563
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
564
|
+
};
|
|
547
565
|
} | null;
|
|
548
566
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => FeaturesConfig | null;
|
|
549
567
|
/**
|
|
@@ -634,6 +652,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
634
652
|
})[];
|
|
635
653
|
ignoreDefaultRules: boolean;
|
|
636
654
|
};
|
|
655
|
+
callbacks: {
|
|
656
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
657
|
+
};
|
|
637
658
|
} | null;
|
|
638
659
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => BlocksConfig | null;
|
|
639
660
|
/**
|
|
@@ -724,8 +745,104 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
724
745
|
})[];
|
|
725
746
|
ignoreDefaultRules: boolean;
|
|
726
747
|
};
|
|
748
|
+
callbacks: {
|
|
749
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
750
|
+
};
|
|
727
751
|
} | null;
|
|
728
752
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => CompilerConfig | null;
|
|
753
|
+
/**
|
|
754
|
+
* Get the callbacks configuration
|
|
755
|
+
*/
|
|
756
|
+
callbacks: (state: {
|
|
757
|
+
initialized: boolean;
|
|
758
|
+
config: {
|
|
759
|
+
identity: {
|
|
760
|
+
templateId: string;
|
|
761
|
+
userId: string;
|
|
762
|
+
variationId?: string | undefined;
|
|
763
|
+
};
|
|
764
|
+
partner: {
|
|
765
|
+
name: string;
|
|
766
|
+
productType: 60 | 49 | 97;
|
|
767
|
+
messageType: 1 | 2;
|
|
768
|
+
username: string;
|
|
769
|
+
};
|
|
770
|
+
template: {
|
|
771
|
+
html: string;
|
|
772
|
+
css: string;
|
|
773
|
+
preselectedDynamicContent: {
|
|
774
|
+
text: string;
|
|
775
|
+
value: string;
|
|
776
|
+
fallback?: string | undefined;
|
|
777
|
+
format?: {
|
|
778
|
+
key: string;
|
|
779
|
+
value: string;
|
|
780
|
+
} | undefined;
|
|
781
|
+
}[];
|
|
782
|
+
selectedUnsubscribePages: number[];
|
|
783
|
+
};
|
|
784
|
+
editor: {
|
|
785
|
+
locale: string;
|
|
786
|
+
translationsPath: string;
|
|
787
|
+
migrationDate: number;
|
|
788
|
+
emailHeader: {
|
|
789
|
+
senderName: string;
|
|
790
|
+
subject: string;
|
|
791
|
+
};
|
|
792
|
+
};
|
|
793
|
+
ui: {
|
|
794
|
+
showHeader: boolean;
|
|
795
|
+
backButtonLabel?: string | undefined;
|
|
796
|
+
};
|
|
797
|
+
features: {
|
|
798
|
+
dynamicContent: boolean;
|
|
799
|
+
saveAsTemplate: boolean;
|
|
800
|
+
versionHistory: boolean;
|
|
801
|
+
testMessage: boolean;
|
|
802
|
+
displayConditions: boolean;
|
|
803
|
+
unsubscribe: boolean;
|
|
804
|
+
};
|
|
805
|
+
blocks: {
|
|
806
|
+
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")[];
|
|
807
|
+
includeCustoms: ("dynamic-content" | "checkbox-block" | "radio-button-block" | "recommendation-block" | "unsubscribe-block" | "coupon-block" | "items-block")[];
|
|
808
|
+
};
|
|
809
|
+
compiler: {
|
|
810
|
+
customRules: ({
|
|
811
|
+
type: "replace";
|
|
812
|
+
search: string;
|
|
813
|
+
replacement: string;
|
|
814
|
+
replaceAll?: boolean | undefined;
|
|
815
|
+
id: string;
|
|
816
|
+
description?: string | undefined;
|
|
817
|
+
priority: number;
|
|
818
|
+
} | {
|
|
819
|
+
type: "regex";
|
|
820
|
+
pattern: string;
|
|
821
|
+
replacement: string;
|
|
822
|
+
flags?: string | undefined;
|
|
823
|
+
id: string;
|
|
824
|
+
description?: string | undefined;
|
|
825
|
+
priority: number;
|
|
826
|
+
} | {
|
|
827
|
+
type: "remove";
|
|
828
|
+
targets: string[];
|
|
829
|
+
id: string;
|
|
830
|
+
description?: string | undefined;
|
|
831
|
+
priority: number;
|
|
832
|
+
} | {
|
|
833
|
+
type: "custom";
|
|
834
|
+
processor: (html: string) => string;
|
|
835
|
+
id: string;
|
|
836
|
+
description?: string | undefined;
|
|
837
|
+
priority: number;
|
|
838
|
+
})[];
|
|
839
|
+
ignoreDefaultRules: boolean;
|
|
840
|
+
};
|
|
841
|
+
callbacks: {
|
|
842
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
843
|
+
};
|
|
844
|
+
} | null;
|
|
845
|
+
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => CallbacksConfig | null;
|
|
729
846
|
/**
|
|
730
847
|
* Get the template ID
|
|
731
848
|
*/
|
|
@@ -814,6 +931,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
814
931
|
})[];
|
|
815
932
|
ignoreDefaultRules: boolean;
|
|
816
933
|
};
|
|
934
|
+
callbacks: {
|
|
935
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
936
|
+
};
|
|
817
937
|
} | null;
|
|
818
938
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => string;
|
|
819
939
|
/**
|
|
@@ -904,6 +1024,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
904
1024
|
})[];
|
|
905
1025
|
ignoreDefaultRules: boolean;
|
|
906
1026
|
};
|
|
1027
|
+
callbacks: {
|
|
1028
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1029
|
+
};
|
|
907
1030
|
} | null;
|
|
908
1031
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => string;
|
|
909
1032
|
/**
|
|
@@ -994,6 +1117,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
994
1117
|
})[];
|
|
995
1118
|
ignoreDefaultRules: boolean;
|
|
996
1119
|
};
|
|
1120
|
+
callbacks: {
|
|
1121
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1122
|
+
};
|
|
997
1123
|
} | null;
|
|
998
1124
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => string;
|
|
999
1125
|
/**
|
|
@@ -1084,6 +1210,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1084
1210
|
})[];
|
|
1085
1211
|
ignoreDefaultRules: boolean;
|
|
1086
1212
|
};
|
|
1213
|
+
callbacks: {
|
|
1214
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1215
|
+
};
|
|
1087
1216
|
} | null;
|
|
1088
1217
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => string;
|
|
1089
1218
|
/**
|
|
@@ -1174,6 +1303,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1174
1303
|
})[];
|
|
1175
1304
|
ignoreDefaultRules: boolean;
|
|
1176
1305
|
};
|
|
1306
|
+
callbacks: {
|
|
1307
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1308
|
+
};
|
|
1177
1309
|
} | null;
|
|
1178
1310
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => number;
|
|
1179
1311
|
/**
|
|
@@ -1264,6 +1396,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1264
1396
|
})[];
|
|
1265
1397
|
ignoreDefaultRules: boolean;
|
|
1266
1398
|
};
|
|
1399
|
+
callbacks: {
|
|
1400
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1401
|
+
};
|
|
1267
1402
|
} | null;
|
|
1268
1403
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => number;
|
|
1269
1404
|
/**
|
|
@@ -1354,6 +1489,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1354
1489
|
})[];
|
|
1355
1490
|
ignoreDefaultRules: boolean;
|
|
1356
1491
|
};
|
|
1492
|
+
callbacks: {
|
|
1493
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1494
|
+
};
|
|
1357
1495
|
} | null;
|
|
1358
1496
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => string;
|
|
1359
1497
|
/**
|
|
@@ -1444,6 +1582,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1444
1582
|
})[];
|
|
1445
1583
|
ignoreDefaultRules: boolean;
|
|
1446
1584
|
};
|
|
1585
|
+
callbacks: {
|
|
1586
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1587
|
+
};
|
|
1447
1588
|
} | null;
|
|
1448
1589
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => boolean;
|
|
1449
1590
|
/**
|
|
@@ -1534,6 +1675,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1534
1675
|
})[];
|
|
1535
1676
|
ignoreDefaultRules: boolean;
|
|
1536
1677
|
};
|
|
1678
|
+
callbacks: {
|
|
1679
|
+
externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
|
|
1680
|
+
};
|
|
1537
1681
|
} | null;
|
|
1538
1682
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => (feature: keyof FeaturesConfig) => boolean;
|
|
1539
1683
|
}, {
|
package/dist/stores/config.js
CHANGED
|
@@ -64,6 +64,13 @@ const s = o("guido-config", {
|
|
|
64
64
|
var e;
|
|
65
65
|
return ((e = i.config) == null ? void 0 : e.compiler) ?? null;
|
|
66
66
|
},
|
|
67
|
+
/**
|
|
68
|
+
* Get the callbacks configuration
|
|
69
|
+
*/
|
|
70
|
+
callbacks: (i) => {
|
|
71
|
+
var e;
|
|
72
|
+
return ((e = i.config) == null ? void 0 : e.callbacks) ?? null;
|
|
73
|
+
},
|
|
67
74
|
/**
|
|
68
75
|
* Get the template ID
|
|
69
76
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.a3f32aa",
|
|
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",
|