@getdraft/plugin 1.17.5 → 1.19.0-alpha.0
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/.turbo/turbo-build.log +0 -0
- package/.turbo/turbo-dev-tsc.log +5 -0
- package/.turbo/turbo-eslint.log +9 -0
- package/.turbo/turbo-prettify.log +11 -0
- package/README.md +53 -18
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +82 -34
- package/dist/index.es.js.map +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/types/index.d.ts +54 -0
- package/package.json +11 -11
- package/src/plugin.ts +80 -4
- package/src/types.ts +60 -0
- package/tsconfig.tsbuildinfo +1 -1
package/src/types.ts
CHANGED
|
@@ -23,6 +23,56 @@ type PersonalizationDictionaryEntry =
|
|
|
23
23
|
|
|
24
24
|
export type PersonalizationDictionaryItems = PersonalizationDictionaryEntry[];
|
|
25
25
|
|
|
26
|
+
export type SectionPersonalizationValue = string | number | boolean | null;
|
|
27
|
+
|
|
28
|
+
export interface SectionPersonalizationField {
|
|
29
|
+
id: string;
|
|
30
|
+
operatorId: 'equals';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface SectionPersonalizationCatalogOption {
|
|
34
|
+
label: string;
|
|
35
|
+
value: Exclude<SectionPersonalizationValue, null>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface SectionPersonalizationCatalogGroup {
|
|
39
|
+
type: 'group';
|
|
40
|
+
id: string;
|
|
41
|
+
label: string;
|
|
42
|
+
children: SectionPersonalizationCatalogNode[];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface SectionPersonalizationCatalogField {
|
|
46
|
+
type: 'field';
|
|
47
|
+
id: string;
|
|
48
|
+
label: string;
|
|
49
|
+
valueType?: 'string' | 'number' | 'boolean' | 'date';
|
|
50
|
+
options?: SectionPersonalizationCatalogOption[];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type SectionPersonalizationCatalogNode =
|
|
54
|
+
| SectionPersonalizationCatalogGroup
|
|
55
|
+
| SectionPersonalizationCatalogField;
|
|
56
|
+
|
|
57
|
+
export interface SectionPersonalizationConfig {
|
|
58
|
+
enabled: boolean;
|
|
59
|
+
aboutUrl?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface RenderSectionPersonalizationGroupInput {
|
|
63
|
+
groupId: string;
|
|
64
|
+
fields: SectionPersonalizationField[];
|
|
65
|
+
variants: Array<{
|
|
66
|
+
id: string;
|
|
67
|
+
values: Record<string, SectionPersonalizationValue>;
|
|
68
|
+
html: string;
|
|
69
|
+
}>;
|
|
70
|
+
fallback?: {
|
|
71
|
+
id: string;
|
|
72
|
+
html: string;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
26
76
|
export interface SerializedTemplate {
|
|
27
77
|
[key: string]: unknown;
|
|
28
78
|
parentId: string | null;
|
|
@@ -55,6 +105,7 @@ export type MessageData = {
|
|
|
55
105
|
code?: string;
|
|
56
106
|
message?: string;
|
|
57
107
|
action?: string;
|
|
108
|
+
requestId?: string;
|
|
58
109
|
};
|
|
59
110
|
|
|
60
111
|
export interface ExportAsFileParams {
|
|
@@ -266,6 +317,14 @@ export interface Handlers {
|
|
|
266
317
|
openGallery: EventHandler<(url?: string) => Promise<void>>;
|
|
267
318
|
uploadImage: AsyncEventHandler<UploadImageParams, string>;
|
|
268
319
|
loadPersonalization: AsyncEventHandler<void, PersonalizationDictionary>;
|
|
320
|
+
loadSectionPersonalizationCatalog: AsyncEventHandler<
|
|
321
|
+
void,
|
|
322
|
+
SectionPersonalizationCatalogNode[]
|
|
323
|
+
>;
|
|
324
|
+
renderSectionPersonalizationGroup: AsyncEventHandler<
|
|
325
|
+
RenderSectionPersonalizationGroupInput,
|
|
326
|
+
string
|
|
327
|
+
>;
|
|
269
328
|
}
|
|
270
329
|
|
|
271
330
|
export type HandlerParams<H> = H extends
|
|
@@ -290,6 +349,7 @@ export interface PluginConfig {
|
|
|
290
349
|
pluginId: string;
|
|
291
350
|
apiUrl: string;
|
|
292
351
|
disableHotkeysPassing?: boolean;
|
|
352
|
+
sectionPersonalization?: SectionPersonalizationConfig;
|
|
293
353
|
__config?: object;
|
|
294
354
|
on: Partial<Handlers>;
|
|
295
355
|
}
|