@kontakto/email-template-editor 1.6.0 → 2.0.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/README.md +60 -4
- package/dist/index.cjs +1346 -727
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +152 -14
- package/dist/index.d.ts +152 -14
- package/dist/index.js +1244 -626
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -2324,6 +2324,17 @@ declare const ReaderBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
2324
2324
|
textColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2325
2325
|
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodEnum<["MODERN_SANS", "BOOK_SANS", "ORGANIC_SANS", "GEOMETRIC_SANS", "HEAVY_SANS", "ROUNDED_SANS", "MODERN_SERIF", "BOOK_SERIF", "MONOSPACE"]>>>;
|
|
2326
2326
|
childrenIds: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
2327
|
+
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
2328
|
+
variables: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2329
|
+
name: z.ZodString;
|
|
2330
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
2331
|
+
}, "strip", z.ZodTypeAny, {
|
|
2332
|
+
name: string;
|
|
2333
|
+
description?: string | null | undefined;
|
|
2334
|
+
}, {
|
|
2335
|
+
name: string;
|
|
2336
|
+
description?: string | null | undefined;
|
|
2337
|
+
}>, "many">>>;
|
|
2327
2338
|
}, "strip", z.ZodTypeAny, {
|
|
2328
2339
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
2329
2340
|
borderColor?: string | null | undefined;
|
|
@@ -2333,6 +2344,11 @@ declare const ReaderBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
2333
2344
|
backdropColor?: string | null | undefined;
|
|
2334
2345
|
backdropDisabled?: boolean | null | undefined;
|
|
2335
2346
|
canvasColor?: string | null | undefined;
|
|
2347
|
+
subject?: string | null | undefined;
|
|
2348
|
+
variables?: {
|
|
2349
|
+
name: string;
|
|
2350
|
+
description?: string | null | undefined;
|
|
2351
|
+
}[] | null | undefined;
|
|
2336
2352
|
}, {
|
|
2337
2353
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
2338
2354
|
borderColor?: string | null | undefined;
|
|
@@ -2342,6 +2358,11 @@ declare const ReaderBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
2342
2358
|
backdropColor?: string | null | undefined;
|
|
2343
2359
|
backdropDisabled?: boolean | null | undefined;
|
|
2344
2360
|
canvasColor?: string | null | undefined;
|
|
2361
|
+
subject?: string | null | undefined;
|
|
2362
|
+
variables?: {
|
|
2363
|
+
name: string;
|
|
2364
|
+
description?: string | null | undefined;
|
|
2365
|
+
}[] | null | undefined;
|
|
2345
2366
|
}>;
|
|
2346
2367
|
Avatar: z.ZodObject<{
|
|
2347
2368
|
style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -3394,6 +3415,17 @@ declare const ReaderDocumentSchema: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodD
|
|
|
3394
3415
|
textColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
3395
3416
|
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodEnum<["MODERN_SANS", "BOOK_SANS", "ORGANIC_SANS", "GEOMETRIC_SANS", "HEAVY_SANS", "ROUNDED_SANS", "MODERN_SERIF", "BOOK_SERIF", "MONOSPACE"]>>>;
|
|
3396
3417
|
childrenIds: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
3418
|
+
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
3419
|
+
variables: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
3420
|
+
name: z.ZodString;
|
|
3421
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
3422
|
+
}, "strip", z.ZodTypeAny, {
|
|
3423
|
+
name: string;
|
|
3424
|
+
description?: string | null | undefined;
|
|
3425
|
+
}, {
|
|
3426
|
+
name: string;
|
|
3427
|
+
description?: string | null | undefined;
|
|
3428
|
+
}>, "many">>>;
|
|
3397
3429
|
}, "strip", z.ZodTypeAny, {
|
|
3398
3430
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
3399
3431
|
borderColor?: string | null | undefined;
|
|
@@ -3403,6 +3435,11 @@ declare const ReaderDocumentSchema: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodD
|
|
|
3403
3435
|
backdropColor?: string | null | undefined;
|
|
3404
3436
|
backdropDisabled?: boolean | null | undefined;
|
|
3405
3437
|
canvasColor?: string | null | undefined;
|
|
3438
|
+
subject?: string | null | undefined;
|
|
3439
|
+
variables?: {
|
|
3440
|
+
name: string;
|
|
3441
|
+
description?: string | null | undefined;
|
|
3442
|
+
}[] | null | undefined;
|
|
3406
3443
|
}, {
|
|
3407
3444
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
3408
3445
|
borderColor?: string | null | undefined;
|
|
@@ -3412,6 +3449,11 @@ declare const ReaderDocumentSchema: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodD
|
|
|
3412
3449
|
backdropColor?: string | null | undefined;
|
|
3413
3450
|
backdropDisabled?: boolean | null | undefined;
|
|
3414
3451
|
canvasColor?: string | null | undefined;
|
|
3452
|
+
subject?: string | null | undefined;
|
|
3453
|
+
variables?: {
|
|
3454
|
+
name: string;
|
|
3455
|
+
description?: string | null | undefined;
|
|
3456
|
+
}[] | null | undefined;
|
|
3415
3457
|
}>;
|
|
3416
3458
|
Avatar: z.ZodObject<{
|
|
3417
3459
|
style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -4509,6 +4551,16 @@ type ContainerProps = z.infer<typeof ContainerPropsSchema>;
|
|
|
4509
4551
|
*/
|
|
4510
4552
|
declare function ContainerReader({ style, props }: ContainerProps): React.JSX.Element;
|
|
4511
4553
|
|
|
4554
|
+
declare const TemplateVariableSchema: z.ZodObject<{
|
|
4555
|
+
name: z.ZodString;
|
|
4556
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
4557
|
+
}, "strip", z.ZodTypeAny, {
|
|
4558
|
+
name: string;
|
|
4559
|
+
description?: string | null | undefined;
|
|
4560
|
+
}, {
|
|
4561
|
+
name: string;
|
|
4562
|
+
description?: string | null | undefined;
|
|
4563
|
+
}>;
|
|
4512
4564
|
declare const EmailLayoutPropsSchema: z.ZodObject<{
|
|
4513
4565
|
backdropColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4514
4566
|
backdropDisabled: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -4518,6 +4570,17 @@ declare const EmailLayoutPropsSchema: z.ZodObject<{
|
|
|
4518
4570
|
textColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4519
4571
|
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodEnum<["MODERN_SANS", "BOOK_SANS", "ORGANIC_SANS", "GEOMETRIC_SANS", "HEAVY_SANS", "ROUNDED_SANS", "MODERN_SERIF", "BOOK_SERIF", "MONOSPACE"]>>>;
|
|
4520
4572
|
childrenIds: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
4573
|
+
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
4574
|
+
variables: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4575
|
+
name: z.ZodString;
|
|
4576
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
4577
|
+
}, "strip", z.ZodTypeAny, {
|
|
4578
|
+
name: string;
|
|
4579
|
+
description?: string | null | undefined;
|
|
4580
|
+
}, {
|
|
4581
|
+
name: string;
|
|
4582
|
+
description?: string | null | undefined;
|
|
4583
|
+
}>, "many">>>;
|
|
4521
4584
|
}, "strip", z.ZodTypeAny, {
|
|
4522
4585
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
4523
4586
|
borderColor?: string | null | undefined;
|
|
@@ -4527,6 +4590,11 @@ declare const EmailLayoutPropsSchema: z.ZodObject<{
|
|
|
4527
4590
|
backdropColor?: string | null | undefined;
|
|
4528
4591
|
backdropDisabled?: boolean | null | undefined;
|
|
4529
4592
|
canvasColor?: string | null | undefined;
|
|
4593
|
+
subject?: string | null | undefined;
|
|
4594
|
+
variables?: {
|
|
4595
|
+
name: string;
|
|
4596
|
+
description?: string | null | undefined;
|
|
4597
|
+
}[] | null | undefined;
|
|
4530
4598
|
}, {
|
|
4531
4599
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
4532
4600
|
borderColor?: string | null | undefined;
|
|
@@ -4536,6 +4604,11 @@ declare const EmailLayoutPropsSchema: z.ZodObject<{
|
|
|
4536
4604
|
backdropColor?: string | null | undefined;
|
|
4537
4605
|
backdropDisabled?: boolean | null | undefined;
|
|
4538
4606
|
canvasColor?: string | null | undefined;
|
|
4607
|
+
subject?: string | null | undefined;
|
|
4608
|
+
variables?: {
|
|
4609
|
+
name: string;
|
|
4610
|
+
description?: string | null | undefined;
|
|
4611
|
+
}[] | null | undefined;
|
|
4539
4612
|
}>;
|
|
4540
4613
|
type EmailLayoutProps = z.infer<typeof EmailLayoutPropsSchema>;
|
|
4541
4614
|
|
|
@@ -5355,6 +5428,17 @@ declare const EditorBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
5355
5428
|
textColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5356
5429
|
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodEnum<["MODERN_SANS", "BOOK_SANS", "ORGANIC_SANS", "GEOMETRIC_SANS", "HEAVY_SANS", "ROUNDED_SANS", "MODERN_SERIF", "BOOK_SERIF", "MONOSPACE"]>>>;
|
|
5357
5430
|
childrenIds: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
5431
|
+
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
5432
|
+
variables: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
5433
|
+
name: z.ZodString;
|
|
5434
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
5435
|
+
}, "strip", z.ZodTypeAny, {
|
|
5436
|
+
name: string;
|
|
5437
|
+
description?: string | null | undefined;
|
|
5438
|
+
}, {
|
|
5439
|
+
name: string;
|
|
5440
|
+
description?: string | null | undefined;
|
|
5441
|
+
}>, "many">>>;
|
|
5358
5442
|
}, "strip", z.ZodTypeAny, {
|
|
5359
5443
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
5360
5444
|
borderColor?: string | null | undefined;
|
|
@@ -5364,6 +5448,11 @@ declare const EditorBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
5364
5448
|
backdropColor?: string | null | undefined;
|
|
5365
5449
|
backdropDisabled?: boolean | null | undefined;
|
|
5366
5450
|
canvasColor?: string | null | undefined;
|
|
5451
|
+
subject?: string | null | undefined;
|
|
5452
|
+
variables?: {
|
|
5453
|
+
name: string;
|
|
5454
|
+
description?: string | null | undefined;
|
|
5455
|
+
}[] | null | undefined;
|
|
5367
5456
|
}, {
|
|
5368
5457
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
5369
5458
|
borderColor?: string | null | undefined;
|
|
@@ -5373,6 +5462,11 @@ declare const EditorBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
5373
5462
|
backdropColor?: string | null | undefined;
|
|
5374
5463
|
backdropDisabled?: boolean | null | undefined;
|
|
5375
5464
|
canvasColor?: string | null | undefined;
|
|
5465
|
+
subject?: string | null | undefined;
|
|
5466
|
+
variables?: {
|
|
5467
|
+
name: string;
|
|
5468
|
+
description?: string | null | undefined;
|
|
5469
|
+
}[] | null | undefined;
|
|
5376
5470
|
}>;
|
|
5377
5471
|
Spacer: z.ZodObject<{
|
|
5378
5472
|
props: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -5615,20 +5709,40 @@ declare const EditorBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
5615
5709
|
type TEditorBlock = z.infer<typeof EditorBlockSchema>;
|
|
5616
5710
|
type TEditorConfiguration = Record<string, TEditorBlock>;
|
|
5617
5711
|
|
|
5712
|
+
type TemplateVariable = {
|
|
5713
|
+
name: string;
|
|
5714
|
+
description?: string;
|
|
5715
|
+
};
|
|
5716
|
+
/**
|
|
5717
|
+
* Payload passed to `onSave` / `saveAs`. The editor renders body HTML and
|
|
5718
|
+
* plain text on every save so consumers don't have to call the renderers
|
|
5719
|
+
* themselves — keeps the consumer's bundle decoupled from a specific
|
|
5720
|
+
* renderer version.
|
|
5721
|
+
*/
|
|
5722
|
+
type SavePayload = {
|
|
5723
|
+
editorConfig: TEditorConfiguration;
|
|
5724
|
+
subject?: string;
|
|
5725
|
+
variables?: TemplateVariable[];
|
|
5726
|
+
bodyHtml: string;
|
|
5727
|
+
bodyText: string;
|
|
5728
|
+
};
|
|
5729
|
+
|
|
5730
|
+
type TemplateKind$1 = 'template' | 'sample';
|
|
5618
5731
|
interface EmailEditorContextType {
|
|
5619
5732
|
currentTemplateId: string | null;
|
|
5620
5733
|
currentTemplateName: string | null;
|
|
5734
|
+
currentTemplateKind: TemplateKind$1 | null;
|
|
5621
5735
|
saveTemplate: () => TEditorConfiguration;
|
|
5622
|
-
loadTemplate: (template: TEditorConfiguration, templateId?: string, templateName?: string) => void;
|
|
5736
|
+
loadTemplate: (template: TEditorConfiguration, templateId?: string, templateName?: string, kind?: TemplateKind$1 | null) => void;
|
|
5623
5737
|
registerSaveListener: (callback: (template: TEditorConfiguration) => void) => () => void;
|
|
5624
|
-
setCurrentTemplate: (templateId: string | null, templateName: string | null) => void;
|
|
5738
|
+
setCurrentTemplate: (templateId: string | null, templateName: string | null, kind?: TemplateKind$1 | null) => void;
|
|
5625
5739
|
}
|
|
5626
5740
|
interface EmailEditorProviderProps {
|
|
5627
5741
|
children: React.ReactNode;
|
|
5628
5742
|
initialTemplate?: TEditorConfiguration;
|
|
5629
5743
|
initialTemplateId?: string;
|
|
5630
5744
|
initialTemplateName?: string;
|
|
5631
|
-
onSave?: (
|
|
5745
|
+
onSave?: (payload: SavePayload) => void | Promise<void>;
|
|
5632
5746
|
onChange?: (template: TEditorConfiguration) => void;
|
|
5633
5747
|
}
|
|
5634
5748
|
declare const EmailEditorProvider: React.FC<EmailEditorProviderProps>;
|
|
@@ -5638,12 +5752,21 @@ declare const useEmailEditor: () => EmailEditorContextType;
|
|
|
5638
5752
|
* Wraps a raw HTML string in an editor config with an EmailLayout root + one Html block.
|
|
5639
5753
|
*/
|
|
5640
5754
|
declare function htmlToEditorConfig(html: string): TEditorConfiguration;
|
|
5641
|
-
|
|
5755
|
+
type TemplateKind = 'template' | 'sample';
|
|
5756
|
+
interface TemplateListItem {
|
|
5642
5757
|
id: string;
|
|
5643
|
-
|
|
5758
|
+
slug: string;
|
|
5759
|
+
kind: TemplateKind;
|
|
5644
5760
|
description?: string;
|
|
5645
|
-
|
|
5646
|
-
|
|
5761
|
+
subject?: string;
|
|
5762
|
+
variables?: Array<{
|
|
5763
|
+
name: string;
|
|
5764
|
+
description?: string;
|
|
5765
|
+
}>;
|
|
5766
|
+
tags?: string[];
|
|
5767
|
+
thumbnailUrl?: string;
|
|
5768
|
+
createdAt?: string;
|
|
5769
|
+
updatedAt?: string;
|
|
5647
5770
|
}
|
|
5648
5771
|
interface EmailEditorRef {
|
|
5649
5772
|
saveTemplate: () => TEditorConfiguration;
|
|
@@ -5659,7 +5782,12 @@ interface EmailEditorProps {
|
|
|
5659
5782
|
initialTemplate?: TEditorConfiguration | string;
|
|
5660
5783
|
initialTemplateId?: string;
|
|
5661
5784
|
initialTemplateName?: string;
|
|
5662
|
-
|
|
5785
|
+
/**
|
|
5786
|
+
* Called when the user saves the current template. Receives a `SavePayload`
|
|
5787
|
+
* containing the source `editorConfig` plus pre-rendered `bodyHtml` /
|
|
5788
|
+
* `bodyText` and the editor-managed `subject` / `variables` metadata.
|
|
5789
|
+
*/
|
|
5790
|
+
onSave?: (payload: SavePayload) => void | Promise<void>;
|
|
5663
5791
|
onChange?: (template: TEditorConfiguration) => void;
|
|
5664
5792
|
/**
|
|
5665
5793
|
* Duration for drawer enter transition in milliseconds. Set to 0 for instant.
|
|
@@ -5696,12 +5824,12 @@ interface EmailEditorProps {
|
|
|
5696
5824
|
* Callback to load samples dynamically.
|
|
5697
5825
|
* This will be called when the samples drawer is opened.
|
|
5698
5826
|
*/
|
|
5699
|
-
loadSamples?: () => Promise<
|
|
5827
|
+
loadSamples?: () => Promise<TemplateListItem[]>;
|
|
5700
5828
|
/**
|
|
5701
5829
|
* Callback to load existing templates dynamically.
|
|
5702
5830
|
* This will be called when the samples drawer is opened.
|
|
5703
5831
|
*/
|
|
5704
|
-
loadTemplates?: () => Promise<
|
|
5832
|
+
loadTemplates?: () => Promise<TemplateListItem[]>;
|
|
5705
5833
|
/**
|
|
5706
5834
|
* Callback to load a specific template by ID.
|
|
5707
5835
|
* This will be called when a sample is selected from the drawer.
|
|
@@ -5716,11 +5844,21 @@ interface EmailEditorProps {
|
|
|
5716
5844
|
*/
|
|
5717
5845
|
copyTemplate?: (templateName: string, content: any) => void;
|
|
5718
5846
|
/**
|
|
5719
|
-
* Callback to
|
|
5847
|
+
* Callback to rename a template by ID. Receives the new slug.
|
|
5848
|
+
*/
|
|
5849
|
+
renameTemplate?: (templateId: string, newSlug: string) => void | Promise<void>;
|
|
5850
|
+
/**
|
|
5851
|
+
* Callback to promote/demote a row between `template` and `sample`.
|
|
5852
|
+
* When omitted, promote/demote menu items are hidden.
|
|
5853
|
+
*/
|
|
5854
|
+
setTemplateKind?: (templateId: string, kind: TemplateKind) => void | Promise<void>;
|
|
5855
|
+
/**
|
|
5856
|
+
* Callback to save a template with a new name. Receives the same
|
|
5857
|
+
* `SavePayload` shape as `onSave`. Returns the new row's `id` and `slug`.
|
|
5720
5858
|
*/
|
|
5721
|
-
saveAs?: (templateName: string,
|
|
5859
|
+
saveAs?: (templateName: string, payload: SavePayload) => Promise<{
|
|
5722
5860
|
id: string;
|
|
5723
|
-
|
|
5861
|
+
slug: string;
|
|
5724
5862
|
}>;
|
|
5725
5863
|
/**
|
|
5726
5864
|
* Optional theme override. If not provided, the default theme will be used.
|
|
@@ -5730,4 +5868,4 @@ interface EmailEditorProps {
|
|
|
5730
5868
|
}
|
|
5731
5869
|
declare const EmailEditor: React.ForwardRefExoticComponent<EmailEditorProps & React.RefAttributes<EmailEditorRef>>;
|
|
5732
5870
|
|
|
5733
|
-
export { Avatar, AvatarProps, AvatarPropsDefaults, AvatarPropsSchema, BlockConfiguration, Button, ButtonProps, ButtonPropsDefaults, ButtonPropsSchema, ColumnsContainer, ColumnsContainerProps$1 as ColumnsContainerProps, ColumnsContainerPropsSchema$1 as ColumnsContainerPropsSchema, ColumnsContainerReader, Container, ContainerProps$1 as ContainerProps, ContainerPropsSchema$1 as ContainerPropsSchema, ContainerReader, Divider, DividerProps, DividerPropsDefaults, DividerPropsSchema, DocumentBlocksDictionary, EmailEditor, type EmailEditorContextType, type EmailEditorProps, EmailEditorProvider, type EmailEditorProviderProps, type EmailEditorRef, EmailLayoutPropsSchema, EmailLayoutReader, EmailMarkdown, Heading, HeadingProps, HeadingPropsDefaults, HeadingPropsSchema, Html, HtmlProps, HtmlPropsSchema, Image, ImageProps, ImagePropsSchema, Reader, ReaderBlock, ReaderBlockSchema, ReaderDocumentSchema, Signature, SignatureProps, SignaturePropsDefaults, SignaturePropsSchema, Spacer, SpacerProps, SpacerPropsDefaults, SpacerPropsSchema, type TReaderBlock, type TReaderBlockProps, type TReaderDocument, type TReaderProps, Text, TextProps, TextPropsDefaults, TextPropsSchema, buildBlockComponent, buildBlockConfigurationDictionary, buildBlockConfigurationSchema, htmlToEditorConfig, renderToStaticMarkup, renderToText, THEME as theme, useEmailEditor };
|
|
5871
|
+
export { Avatar, AvatarProps, AvatarPropsDefaults, AvatarPropsSchema, BlockConfiguration, Button, ButtonProps, ButtonPropsDefaults, ButtonPropsSchema, ColumnsContainer, ColumnsContainerProps$1 as ColumnsContainerProps, ColumnsContainerPropsSchema$1 as ColumnsContainerPropsSchema, ColumnsContainerReader, Container, ContainerProps$1 as ContainerProps, ContainerPropsSchema$1 as ContainerPropsSchema, ContainerReader, Divider, DividerProps, DividerPropsDefaults, DividerPropsSchema, DocumentBlocksDictionary, EmailEditor, type EmailEditorContextType, type EmailEditorProps, EmailEditorProvider, type EmailEditorProviderProps, type EmailEditorRef, EmailLayoutPropsSchema, EmailLayoutReader, EmailMarkdown, Heading, HeadingProps, HeadingPropsDefaults, HeadingPropsSchema, Html, HtmlProps, HtmlPropsSchema, Image, ImageProps, ImagePropsSchema, Reader, ReaderBlock, ReaderBlockSchema, ReaderDocumentSchema, type SavePayload, Signature, SignatureProps, SignaturePropsDefaults, SignaturePropsSchema, Spacer, SpacerProps, SpacerPropsDefaults, SpacerPropsSchema, type TReaderBlock, type TReaderBlockProps, type TReaderDocument, type TReaderProps, type TemplateKind, type TemplateListItem, TemplateVariableSchema, Text, TextProps, TextPropsDefaults, TextPropsSchema, buildBlockComponent, buildBlockConfigurationDictionary, buildBlockConfigurationSchema, htmlToEditorConfig, renderToStaticMarkup, renderToText, THEME as theme, useEmailEditor };
|
package/dist/index.d.ts
CHANGED
|
@@ -2324,6 +2324,17 @@ declare const ReaderBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
2324
2324
|
textColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2325
2325
|
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodEnum<["MODERN_SANS", "BOOK_SANS", "ORGANIC_SANS", "GEOMETRIC_SANS", "HEAVY_SANS", "ROUNDED_SANS", "MODERN_SERIF", "BOOK_SERIF", "MONOSPACE"]>>>;
|
|
2326
2326
|
childrenIds: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
2327
|
+
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
2328
|
+
variables: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2329
|
+
name: z.ZodString;
|
|
2330
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
2331
|
+
}, "strip", z.ZodTypeAny, {
|
|
2332
|
+
name: string;
|
|
2333
|
+
description?: string | null | undefined;
|
|
2334
|
+
}, {
|
|
2335
|
+
name: string;
|
|
2336
|
+
description?: string | null | undefined;
|
|
2337
|
+
}>, "many">>>;
|
|
2327
2338
|
}, "strip", z.ZodTypeAny, {
|
|
2328
2339
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
2329
2340
|
borderColor?: string | null | undefined;
|
|
@@ -2333,6 +2344,11 @@ declare const ReaderBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
2333
2344
|
backdropColor?: string | null | undefined;
|
|
2334
2345
|
backdropDisabled?: boolean | null | undefined;
|
|
2335
2346
|
canvasColor?: string | null | undefined;
|
|
2347
|
+
subject?: string | null | undefined;
|
|
2348
|
+
variables?: {
|
|
2349
|
+
name: string;
|
|
2350
|
+
description?: string | null | undefined;
|
|
2351
|
+
}[] | null | undefined;
|
|
2336
2352
|
}, {
|
|
2337
2353
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
2338
2354
|
borderColor?: string | null | undefined;
|
|
@@ -2342,6 +2358,11 @@ declare const ReaderBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
2342
2358
|
backdropColor?: string | null | undefined;
|
|
2343
2359
|
backdropDisabled?: boolean | null | undefined;
|
|
2344
2360
|
canvasColor?: string | null | undefined;
|
|
2361
|
+
subject?: string | null | undefined;
|
|
2362
|
+
variables?: {
|
|
2363
|
+
name: string;
|
|
2364
|
+
description?: string | null | undefined;
|
|
2365
|
+
}[] | null | undefined;
|
|
2345
2366
|
}>;
|
|
2346
2367
|
Avatar: z.ZodObject<{
|
|
2347
2368
|
style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -3394,6 +3415,17 @@ declare const ReaderDocumentSchema: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodD
|
|
|
3394
3415
|
textColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
3395
3416
|
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodEnum<["MODERN_SANS", "BOOK_SANS", "ORGANIC_SANS", "GEOMETRIC_SANS", "HEAVY_SANS", "ROUNDED_SANS", "MODERN_SERIF", "BOOK_SERIF", "MONOSPACE"]>>>;
|
|
3396
3417
|
childrenIds: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
3418
|
+
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
3419
|
+
variables: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
3420
|
+
name: z.ZodString;
|
|
3421
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
3422
|
+
}, "strip", z.ZodTypeAny, {
|
|
3423
|
+
name: string;
|
|
3424
|
+
description?: string | null | undefined;
|
|
3425
|
+
}, {
|
|
3426
|
+
name: string;
|
|
3427
|
+
description?: string | null | undefined;
|
|
3428
|
+
}>, "many">>>;
|
|
3397
3429
|
}, "strip", z.ZodTypeAny, {
|
|
3398
3430
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
3399
3431
|
borderColor?: string | null | undefined;
|
|
@@ -3403,6 +3435,11 @@ declare const ReaderDocumentSchema: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodD
|
|
|
3403
3435
|
backdropColor?: string | null | undefined;
|
|
3404
3436
|
backdropDisabled?: boolean | null | undefined;
|
|
3405
3437
|
canvasColor?: string | null | undefined;
|
|
3438
|
+
subject?: string | null | undefined;
|
|
3439
|
+
variables?: {
|
|
3440
|
+
name: string;
|
|
3441
|
+
description?: string | null | undefined;
|
|
3442
|
+
}[] | null | undefined;
|
|
3406
3443
|
}, {
|
|
3407
3444
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
3408
3445
|
borderColor?: string | null | undefined;
|
|
@@ -3412,6 +3449,11 @@ declare const ReaderDocumentSchema: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodD
|
|
|
3412
3449
|
backdropColor?: string | null | undefined;
|
|
3413
3450
|
backdropDisabled?: boolean | null | undefined;
|
|
3414
3451
|
canvasColor?: string | null | undefined;
|
|
3452
|
+
subject?: string | null | undefined;
|
|
3453
|
+
variables?: {
|
|
3454
|
+
name: string;
|
|
3455
|
+
description?: string | null | undefined;
|
|
3456
|
+
}[] | null | undefined;
|
|
3415
3457
|
}>;
|
|
3416
3458
|
Avatar: z.ZodObject<{
|
|
3417
3459
|
style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -4509,6 +4551,16 @@ type ContainerProps = z.infer<typeof ContainerPropsSchema>;
|
|
|
4509
4551
|
*/
|
|
4510
4552
|
declare function ContainerReader({ style, props }: ContainerProps): React.JSX.Element;
|
|
4511
4553
|
|
|
4554
|
+
declare const TemplateVariableSchema: z.ZodObject<{
|
|
4555
|
+
name: z.ZodString;
|
|
4556
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
4557
|
+
}, "strip", z.ZodTypeAny, {
|
|
4558
|
+
name: string;
|
|
4559
|
+
description?: string | null | undefined;
|
|
4560
|
+
}, {
|
|
4561
|
+
name: string;
|
|
4562
|
+
description?: string | null | undefined;
|
|
4563
|
+
}>;
|
|
4512
4564
|
declare const EmailLayoutPropsSchema: z.ZodObject<{
|
|
4513
4565
|
backdropColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4514
4566
|
backdropDisabled: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -4518,6 +4570,17 @@ declare const EmailLayoutPropsSchema: z.ZodObject<{
|
|
|
4518
4570
|
textColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4519
4571
|
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodEnum<["MODERN_SANS", "BOOK_SANS", "ORGANIC_SANS", "GEOMETRIC_SANS", "HEAVY_SANS", "ROUNDED_SANS", "MODERN_SERIF", "BOOK_SERIF", "MONOSPACE"]>>>;
|
|
4520
4572
|
childrenIds: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
4573
|
+
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
4574
|
+
variables: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4575
|
+
name: z.ZodString;
|
|
4576
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
4577
|
+
}, "strip", z.ZodTypeAny, {
|
|
4578
|
+
name: string;
|
|
4579
|
+
description?: string | null | undefined;
|
|
4580
|
+
}, {
|
|
4581
|
+
name: string;
|
|
4582
|
+
description?: string | null | undefined;
|
|
4583
|
+
}>, "many">>>;
|
|
4521
4584
|
}, "strip", z.ZodTypeAny, {
|
|
4522
4585
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
4523
4586
|
borderColor?: string | null | undefined;
|
|
@@ -4527,6 +4590,11 @@ declare const EmailLayoutPropsSchema: z.ZodObject<{
|
|
|
4527
4590
|
backdropColor?: string | null | undefined;
|
|
4528
4591
|
backdropDisabled?: boolean | null | undefined;
|
|
4529
4592
|
canvasColor?: string | null | undefined;
|
|
4593
|
+
subject?: string | null | undefined;
|
|
4594
|
+
variables?: {
|
|
4595
|
+
name: string;
|
|
4596
|
+
description?: string | null | undefined;
|
|
4597
|
+
}[] | null | undefined;
|
|
4530
4598
|
}, {
|
|
4531
4599
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
4532
4600
|
borderColor?: string | null | undefined;
|
|
@@ -4536,6 +4604,11 @@ declare const EmailLayoutPropsSchema: z.ZodObject<{
|
|
|
4536
4604
|
backdropColor?: string | null | undefined;
|
|
4537
4605
|
backdropDisabled?: boolean | null | undefined;
|
|
4538
4606
|
canvasColor?: string | null | undefined;
|
|
4607
|
+
subject?: string | null | undefined;
|
|
4608
|
+
variables?: {
|
|
4609
|
+
name: string;
|
|
4610
|
+
description?: string | null | undefined;
|
|
4611
|
+
}[] | null | undefined;
|
|
4539
4612
|
}>;
|
|
4540
4613
|
type EmailLayoutProps = z.infer<typeof EmailLayoutPropsSchema>;
|
|
4541
4614
|
|
|
@@ -5355,6 +5428,17 @@ declare const EditorBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
5355
5428
|
textColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5356
5429
|
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodEnum<["MODERN_SANS", "BOOK_SANS", "ORGANIC_SANS", "GEOMETRIC_SANS", "HEAVY_SANS", "ROUNDED_SANS", "MODERN_SERIF", "BOOK_SERIF", "MONOSPACE"]>>>;
|
|
5357
5430
|
childrenIds: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
5431
|
+
subject: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
5432
|
+
variables: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
5433
|
+
name: z.ZodString;
|
|
5434
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
5435
|
+
}, "strip", z.ZodTypeAny, {
|
|
5436
|
+
name: string;
|
|
5437
|
+
description?: string | null | undefined;
|
|
5438
|
+
}, {
|
|
5439
|
+
name: string;
|
|
5440
|
+
description?: string | null | undefined;
|
|
5441
|
+
}>, "many">>>;
|
|
5358
5442
|
}, "strip", z.ZodTypeAny, {
|
|
5359
5443
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
5360
5444
|
borderColor?: string | null | undefined;
|
|
@@ -5364,6 +5448,11 @@ declare const EditorBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
5364
5448
|
backdropColor?: string | null | undefined;
|
|
5365
5449
|
backdropDisabled?: boolean | null | undefined;
|
|
5366
5450
|
canvasColor?: string | null | undefined;
|
|
5451
|
+
subject?: string | null | undefined;
|
|
5452
|
+
variables?: {
|
|
5453
|
+
name: string;
|
|
5454
|
+
description?: string | null | undefined;
|
|
5455
|
+
}[] | null | undefined;
|
|
5367
5456
|
}, {
|
|
5368
5457
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
5369
5458
|
borderColor?: string | null | undefined;
|
|
@@ -5373,6 +5462,11 @@ declare const EditorBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
5373
5462
|
backdropColor?: string | null | undefined;
|
|
5374
5463
|
backdropDisabled?: boolean | null | undefined;
|
|
5375
5464
|
canvasColor?: string | null | undefined;
|
|
5465
|
+
subject?: string | null | undefined;
|
|
5466
|
+
variables?: {
|
|
5467
|
+
name: string;
|
|
5468
|
+
description?: string | null | undefined;
|
|
5469
|
+
}[] | null | undefined;
|
|
5376
5470
|
}>;
|
|
5377
5471
|
Spacer: z.ZodObject<{
|
|
5378
5472
|
props: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -5615,20 +5709,40 @@ declare const EditorBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
5615
5709
|
type TEditorBlock = z.infer<typeof EditorBlockSchema>;
|
|
5616
5710
|
type TEditorConfiguration = Record<string, TEditorBlock>;
|
|
5617
5711
|
|
|
5712
|
+
type TemplateVariable = {
|
|
5713
|
+
name: string;
|
|
5714
|
+
description?: string;
|
|
5715
|
+
};
|
|
5716
|
+
/**
|
|
5717
|
+
* Payload passed to `onSave` / `saveAs`. The editor renders body HTML and
|
|
5718
|
+
* plain text on every save so consumers don't have to call the renderers
|
|
5719
|
+
* themselves — keeps the consumer's bundle decoupled from a specific
|
|
5720
|
+
* renderer version.
|
|
5721
|
+
*/
|
|
5722
|
+
type SavePayload = {
|
|
5723
|
+
editorConfig: TEditorConfiguration;
|
|
5724
|
+
subject?: string;
|
|
5725
|
+
variables?: TemplateVariable[];
|
|
5726
|
+
bodyHtml: string;
|
|
5727
|
+
bodyText: string;
|
|
5728
|
+
};
|
|
5729
|
+
|
|
5730
|
+
type TemplateKind$1 = 'template' | 'sample';
|
|
5618
5731
|
interface EmailEditorContextType {
|
|
5619
5732
|
currentTemplateId: string | null;
|
|
5620
5733
|
currentTemplateName: string | null;
|
|
5734
|
+
currentTemplateKind: TemplateKind$1 | null;
|
|
5621
5735
|
saveTemplate: () => TEditorConfiguration;
|
|
5622
|
-
loadTemplate: (template: TEditorConfiguration, templateId?: string, templateName?: string) => void;
|
|
5736
|
+
loadTemplate: (template: TEditorConfiguration, templateId?: string, templateName?: string, kind?: TemplateKind$1 | null) => void;
|
|
5623
5737
|
registerSaveListener: (callback: (template: TEditorConfiguration) => void) => () => void;
|
|
5624
|
-
setCurrentTemplate: (templateId: string | null, templateName: string | null) => void;
|
|
5738
|
+
setCurrentTemplate: (templateId: string | null, templateName: string | null, kind?: TemplateKind$1 | null) => void;
|
|
5625
5739
|
}
|
|
5626
5740
|
interface EmailEditorProviderProps {
|
|
5627
5741
|
children: React.ReactNode;
|
|
5628
5742
|
initialTemplate?: TEditorConfiguration;
|
|
5629
5743
|
initialTemplateId?: string;
|
|
5630
5744
|
initialTemplateName?: string;
|
|
5631
|
-
onSave?: (
|
|
5745
|
+
onSave?: (payload: SavePayload) => void | Promise<void>;
|
|
5632
5746
|
onChange?: (template: TEditorConfiguration) => void;
|
|
5633
5747
|
}
|
|
5634
5748
|
declare const EmailEditorProvider: React.FC<EmailEditorProviderProps>;
|
|
@@ -5638,12 +5752,21 @@ declare const useEmailEditor: () => EmailEditorContextType;
|
|
|
5638
5752
|
* Wraps a raw HTML string in an editor config with an EmailLayout root + one Html block.
|
|
5639
5753
|
*/
|
|
5640
5754
|
declare function htmlToEditorConfig(html: string): TEditorConfiguration;
|
|
5641
|
-
|
|
5755
|
+
type TemplateKind = 'template' | 'sample';
|
|
5756
|
+
interface TemplateListItem {
|
|
5642
5757
|
id: string;
|
|
5643
|
-
|
|
5758
|
+
slug: string;
|
|
5759
|
+
kind: TemplateKind;
|
|
5644
5760
|
description?: string;
|
|
5645
|
-
|
|
5646
|
-
|
|
5761
|
+
subject?: string;
|
|
5762
|
+
variables?: Array<{
|
|
5763
|
+
name: string;
|
|
5764
|
+
description?: string;
|
|
5765
|
+
}>;
|
|
5766
|
+
tags?: string[];
|
|
5767
|
+
thumbnailUrl?: string;
|
|
5768
|
+
createdAt?: string;
|
|
5769
|
+
updatedAt?: string;
|
|
5647
5770
|
}
|
|
5648
5771
|
interface EmailEditorRef {
|
|
5649
5772
|
saveTemplate: () => TEditorConfiguration;
|
|
@@ -5659,7 +5782,12 @@ interface EmailEditorProps {
|
|
|
5659
5782
|
initialTemplate?: TEditorConfiguration | string;
|
|
5660
5783
|
initialTemplateId?: string;
|
|
5661
5784
|
initialTemplateName?: string;
|
|
5662
|
-
|
|
5785
|
+
/**
|
|
5786
|
+
* Called when the user saves the current template. Receives a `SavePayload`
|
|
5787
|
+
* containing the source `editorConfig` plus pre-rendered `bodyHtml` /
|
|
5788
|
+
* `bodyText` and the editor-managed `subject` / `variables` metadata.
|
|
5789
|
+
*/
|
|
5790
|
+
onSave?: (payload: SavePayload) => void | Promise<void>;
|
|
5663
5791
|
onChange?: (template: TEditorConfiguration) => void;
|
|
5664
5792
|
/**
|
|
5665
5793
|
* Duration for drawer enter transition in milliseconds. Set to 0 for instant.
|
|
@@ -5696,12 +5824,12 @@ interface EmailEditorProps {
|
|
|
5696
5824
|
* Callback to load samples dynamically.
|
|
5697
5825
|
* This will be called when the samples drawer is opened.
|
|
5698
5826
|
*/
|
|
5699
|
-
loadSamples?: () => Promise<
|
|
5827
|
+
loadSamples?: () => Promise<TemplateListItem[]>;
|
|
5700
5828
|
/**
|
|
5701
5829
|
* Callback to load existing templates dynamically.
|
|
5702
5830
|
* This will be called when the samples drawer is opened.
|
|
5703
5831
|
*/
|
|
5704
|
-
loadTemplates?: () => Promise<
|
|
5832
|
+
loadTemplates?: () => Promise<TemplateListItem[]>;
|
|
5705
5833
|
/**
|
|
5706
5834
|
* Callback to load a specific template by ID.
|
|
5707
5835
|
* This will be called when a sample is selected from the drawer.
|
|
@@ -5716,11 +5844,21 @@ interface EmailEditorProps {
|
|
|
5716
5844
|
*/
|
|
5717
5845
|
copyTemplate?: (templateName: string, content: any) => void;
|
|
5718
5846
|
/**
|
|
5719
|
-
* Callback to
|
|
5847
|
+
* Callback to rename a template by ID. Receives the new slug.
|
|
5848
|
+
*/
|
|
5849
|
+
renameTemplate?: (templateId: string, newSlug: string) => void | Promise<void>;
|
|
5850
|
+
/**
|
|
5851
|
+
* Callback to promote/demote a row between `template` and `sample`.
|
|
5852
|
+
* When omitted, promote/demote menu items are hidden.
|
|
5853
|
+
*/
|
|
5854
|
+
setTemplateKind?: (templateId: string, kind: TemplateKind) => void | Promise<void>;
|
|
5855
|
+
/**
|
|
5856
|
+
* Callback to save a template with a new name. Receives the same
|
|
5857
|
+
* `SavePayload` shape as `onSave`. Returns the new row's `id` and `slug`.
|
|
5720
5858
|
*/
|
|
5721
|
-
saveAs?: (templateName: string,
|
|
5859
|
+
saveAs?: (templateName: string, payload: SavePayload) => Promise<{
|
|
5722
5860
|
id: string;
|
|
5723
|
-
|
|
5861
|
+
slug: string;
|
|
5724
5862
|
}>;
|
|
5725
5863
|
/**
|
|
5726
5864
|
* Optional theme override. If not provided, the default theme will be used.
|
|
@@ -5730,4 +5868,4 @@ interface EmailEditorProps {
|
|
|
5730
5868
|
}
|
|
5731
5869
|
declare const EmailEditor: React.ForwardRefExoticComponent<EmailEditorProps & React.RefAttributes<EmailEditorRef>>;
|
|
5732
5870
|
|
|
5733
|
-
export { Avatar, AvatarProps, AvatarPropsDefaults, AvatarPropsSchema, BlockConfiguration, Button, ButtonProps, ButtonPropsDefaults, ButtonPropsSchema, ColumnsContainer, ColumnsContainerProps$1 as ColumnsContainerProps, ColumnsContainerPropsSchema$1 as ColumnsContainerPropsSchema, ColumnsContainerReader, Container, ContainerProps$1 as ContainerProps, ContainerPropsSchema$1 as ContainerPropsSchema, ContainerReader, Divider, DividerProps, DividerPropsDefaults, DividerPropsSchema, DocumentBlocksDictionary, EmailEditor, type EmailEditorContextType, type EmailEditorProps, EmailEditorProvider, type EmailEditorProviderProps, type EmailEditorRef, EmailLayoutPropsSchema, EmailLayoutReader, EmailMarkdown, Heading, HeadingProps, HeadingPropsDefaults, HeadingPropsSchema, Html, HtmlProps, HtmlPropsSchema, Image, ImageProps, ImagePropsSchema, Reader, ReaderBlock, ReaderBlockSchema, ReaderDocumentSchema, Signature, SignatureProps, SignaturePropsDefaults, SignaturePropsSchema, Spacer, SpacerProps, SpacerPropsDefaults, SpacerPropsSchema, type TReaderBlock, type TReaderBlockProps, type TReaderDocument, type TReaderProps, Text, TextProps, TextPropsDefaults, TextPropsSchema, buildBlockComponent, buildBlockConfigurationDictionary, buildBlockConfigurationSchema, htmlToEditorConfig, renderToStaticMarkup, renderToText, THEME as theme, useEmailEditor };
|
|
5871
|
+
export { Avatar, AvatarProps, AvatarPropsDefaults, AvatarPropsSchema, BlockConfiguration, Button, ButtonProps, ButtonPropsDefaults, ButtonPropsSchema, ColumnsContainer, ColumnsContainerProps$1 as ColumnsContainerProps, ColumnsContainerPropsSchema$1 as ColumnsContainerPropsSchema, ColumnsContainerReader, Container, ContainerProps$1 as ContainerProps, ContainerPropsSchema$1 as ContainerPropsSchema, ContainerReader, Divider, DividerProps, DividerPropsDefaults, DividerPropsSchema, DocumentBlocksDictionary, EmailEditor, type EmailEditorContextType, type EmailEditorProps, EmailEditorProvider, type EmailEditorProviderProps, type EmailEditorRef, EmailLayoutPropsSchema, EmailLayoutReader, EmailMarkdown, Heading, HeadingProps, HeadingPropsDefaults, HeadingPropsSchema, Html, HtmlProps, HtmlPropsSchema, Image, ImageProps, ImagePropsSchema, Reader, ReaderBlock, ReaderBlockSchema, ReaderDocumentSchema, type SavePayload, Signature, SignatureProps, SignaturePropsDefaults, SignaturePropsSchema, Spacer, SpacerProps, SpacerPropsDefaults, SpacerPropsSchema, type TReaderBlock, type TReaderBlockProps, type TReaderDocument, type TReaderProps, type TemplateKind, type TemplateListItem, TemplateVariableSchema, Text, TextProps, TextPropsDefaults, TextPropsSchema, buildBlockComponent, buildBlockConfigurationDictionary, buildBlockConfigurationSchema, htmlToEditorConfig, renderToStaticMarkup, renderToText, THEME as theme, useEmailEditor };
|