@kontakto/email-template-editor 1.5.1 → 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 +1513 -859
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +164 -14
- package/dist/index.d.ts +164 -14
- package/dist/index.js +1420 -767
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -2317,12 +2317,24 @@ declare const ReaderBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
2317
2317
|
}>;
|
|
2318
2318
|
EmailLayout: z.ZodObject<{
|
|
2319
2319
|
backdropColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2320
|
+
backdropDisabled: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
|
|
2320
2321
|
borderColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2321
2322
|
borderRadius: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
2322
2323
|
canvasColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2323
2324
|
textColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2324
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"]>>>;
|
|
2325
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">>>;
|
|
2326
2338
|
}, "strip", z.ZodTypeAny, {
|
|
2327
2339
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
2328
2340
|
borderColor?: string | null | undefined;
|
|
@@ -2330,7 +2342,13 @@ declare const ReaderBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
2330
2342
|
textColor?: string | null | undefined;
|
|
2331
2343
|
childrenIds?: string[] | null | undefined;
|
|
2332
2344
|
backdropColor?: string | null | undefined;
|
|
2345
|
+
backdropDisabled?: boolean | null | undefined;
|
|
2333
2346
|
canvasColor?: string | null | undefined;
|
|
2347
|
+
subject?: string | null | undefined;
|
|
2348
|
+
variables?: {
|
|
2349
|
+
name: string;
|
|
2350
|
+
description?: string | null | undefined;
|
|
2351
|
+
}[] | null | undefined;
|
|
2334
2352
|
}, {
|
|
2335
2353
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
2336
2354
|
borderColor?: string | null | undefined;
|
|
@@ -2338,7 +2356,13 @@ declare const ReaderBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
2338
2356
|
textColor?: string | null | undefined;
|
|
2339
2357
|
childrenIds?: string[] | null | undefined;
|
|
2340
2358
|
backdropColor?: string | null | undefined;
|
|
2359
|
+
backdropDisabled?: boolean | null | undefined;
|
|
2341
2360
|
canvasColor?: string | null | undefined;
|
|
2361
|
+
subject?: string | null | undefined;
|
|
2362
|
+
variables?: {
|
|
2363
|
+
name: string;
|
|
2364
|
+
description?: string | null | undefined;
|
|
2365
|
+
}[] | null | undefined;
|
|
2342
2366
|
}>;
|
|
2343
2367
|
Avatar: z.ZodObject<{
|
|
2344
2368
|
style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -3384,12 +3408,24 @@ declare const ReaderDocumentSchema: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodD
|
|
|
3384
3408
|
}>;
|
|
3385
3409
|
EmailLayout: z.ZodObject<{
|
|
3386
3410
|
backdropColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
3411
|
+
backdropDisabled: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
|
|
3387
3412
|
borderColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
3388
3413
|
borderRadius: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
3389
3414
|
canvasColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
3390
3415
|
textColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
3391
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"]>>>;
|
|
3392
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">>>;
|
|
3393
3429
|
}, "strip", z.ZodTypeAny, {
|
|
3394
3430
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
3395
3431
|
borderColor?: string | null | undefined;
|
|
@@ -3397,7 +3433,13 @@ declare const ReaderDocumentSchema: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodD
|
|
|
3397
3433
|
textColor?: string | null | undefined;
|
|
3398
3434
|
childrenIds?: string[] | null | undefined;
|
|
3399
3435
|
backdropColor?: string | null | undefined;
|
|
3436
|
+
backdropDisabled?: boolean | null | undefined;
|
|
3400
3437
|
canvasColor?: string | null | undefined;
|
|
3438
|
+
subject?: string | null | undefined;
|
|
3439
|
+
variables?: {
|
|
3440
|
+
name: string;
|
|
3441
|
+
description?: string | null | undefined;
|
|
3442
|
+
}[] | null | undefined;
|
|
3401
3443
|
}, {
|
|
3402
3444
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
3403
3445
|
borderColor?: string | null | undefined;
|
|
@@ -3405,7 +3447,13 @@ declare const ReaderDocumentSchema: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodD
|
|
|
3405
3447
|
textColor?: string | null | undefined;
|
|
3406
3448
|
childrenIds?: string[] | null | undefined;
|
|
3407
3449
|
backdropColor?: string | null | undefined;
|
|
3450
|
+
backdropDisabled?: boolean | null | undefined;
|
|
3408
3451
|
canvasColor?: string | null | undefined;
|
|
3452
|
+
subject?: string | null | undefined;
|
|
3453
|
+
variables?: {
|
|
3454
|
+
name: string;
|
|
3455
|
+
description?: string | null | undefined;
|
|
3456
|
+
}[] | null | undefined;
|
|
3409
3457
|
}>;
|
|
3410
3458
|
Avatar: z.ZodObject<{
|
|
3411
3459
|
style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -4503,14 +4551,36 @@ type ContainerProps = z.infer<typeof ContainerPropsSchema>;
|
|
|
4503
4551
|
*/
|
|
4504
4552
|
declare function ContainerReader({ style, props }: ContainerProps): React.JSX.Element;
|
|
4505
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
|
+
}>;
|
|
4506
4564
|
declare const EmailLayoutPropsSchema: z.ZodObject<{
|
|
4507
4565
|
backdropColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4566
|
+
backdropDisabled: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
|
|
4508
4567
|
borderColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4509
4568
|
borderRadius: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
4510
4569
|
canvasColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4511
4570
|
textColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4512
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"]>>>;
|
|
4513
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">>>;
|
|
4514
4584
|
}, "strip", z.ZodTypeAny, {
|
|
4515
4585
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
4516
4586
|
borderColor?: string | null | undefined;
|
|
@@ -4518,7 +4588,13 @@ declare const EmailLayoutPropsSchema: z.ZodObject<{
|
|
|
4518
4588
|
textColor?: string | null | undefined;
|
|
4519
4589
|
childrenIds?: string[] | null | undefined;
|
|
4520
4590
|
backdropColor?: string | null | undefined;
|
|
4591
|
+
backdropDisabled?: boolean | null | undefined;
|
|
4521
4592
|
canvasColor?: string | null | undefined;
|
|
4593
|
+
subject?: string | null | undefined;
|
|
4594
|
+
variables?: {
|
|
4595
|
+
name: string;
|
|
4596
|
+
description?: string | null | undefined;
|
|
4597
|
+
}[] | null | undefined;
|
|
4522
4598
|
}, {
|
|
4523
4599
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
4524
4600
|
borderColor?: string | null | undefined;
|
|
@@ -4526,7 +4602,13 @@ declare const EmailLayoutPropsSchema: z.ZodObject<{
|
|
|
4526
4602
|
textColor?: string | null | undefined;
|
|
4527
4603
|
childrenIds?: string[] | null | undefined;
|
|
4528
4604
|
backdropColor?: string | null | undefined;
|
|
4605
|
+
backdropDisabled?: boolean | null | undefined;
|
|
4529
4606
|
canvasColor?: string | null | undefined;
|
|
4607
|
+
subject?: string | null | undefined;
|
|
4608
|
+
variables?: {
|
|
4609
|
+
name: string;
|
|
4610
|
+
description?: string | null | undefined;
|
|
4611
|
+
}[] | null | undefined;
|
|
4530
4612
|
}>;
|
|
4531
4613
|
type EmailLayoutProps = z.infer<typeof EmailLayoutPropsSchema>;
|
|
4532
4614
|
|
|
@@ -5339,12 +5421,24 @@ declare const EditorBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
5339
5421
|
}>;
|
|
5340
5422
|
EmailLayout: z.ZodObject<{
|
|
5341
5423
|
backdropColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5424
|
+
backdropDisabled: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
|
|
5342
5425
|
borderColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5343
5426
|
borderRadius: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
5344
5427
|
canvasColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5345
5428
|
textColor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5346
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"]>>>;
|
|
5347
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">>>;
|
|
5348
5442
|
}, "strip", z.ZodTypeAny, {
|
|
5349
5443
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
5350
5444
|
borderColor?: string | null | undefined;
|
|
@@ -5352,7 +5446,13 @@ declare const EditorBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
5352
5446
|
textColor?: string | null | undefined;
|
|
5353
5447
|
childrenIds?: string[] | null | undefined;
|
|
5354
5448
|
backdropColor?: string | null | undefined;
|
|
5449
|
+
backdropDisabled?: boolean | null | undefined;
|
|
5355
5450
|
canvasColor?: string | null | undefined;
|
|
5451
|
+
subject?: string | null | undefined;
|
|
5452
|
+
variables?: {
|
|
5453
|
+
name: string;
|
|
5454
|
+
description?: string | null | undefined;
|
|
5455
|
+
}[] | null | undefined;
|
|
5356
5456
|
}, {
|
|
5357
5457
|
fontFamily?: "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
5358
5458
|
borderColor?: string | null | undefined;
|
|
@@ -5360,7 +5460,13 @@ declare const EditorBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
5360
5460
|
textColor?: string | null | undefined;
|
|
5361
5461
|
childrenIds?: string[] | null | undefined;
|
|
5362
5462
|
backdropColor?: string | null | undefined;
|
|
5463
|
+
backdropDisabled?: boolean | null | undefined;
|
|
5363
5464
|
canvasColor?: string | null | undefined;
|
|
5465
|
+
subject?: string | null | undefined;
|
|
5466
|
+
variables?: {
|
|
5467
|
+
name: string;
|
|
5468
|
+
description?: string | null | undefined;
|
|
5469
|
+
}[] | null | undefined;
|
|
5364
5470
|
}>;
|
|
5365
5471
|
Spacer: z.ZodObject<{
|
|
5366
5472
|
props: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -5603,20 +5709,40 @@ declare const EditorBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
5603
5709
|
type TEditorBlock = z.infer<typeof EditorBlockSchema>;
|
|
5604
5710
|
type TEditorConfiguration = Record<string, TEditorBlock>;
|
|
5605
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';
|
|
5606
5731
|
interface EmailEditorContextType {
|
|
5607
5732
|
currentTemplateId: string | null;
|
|
5608
5733
|
currentTemplateName: string | null;
|
|
5734
|
+
currentTemplateKind: TemplateKind$1 | null;
|
|
5609
5735
|
saveTemplate: () => TEditorConfiguration;
|
|
5610
|
-
loadTemplate: (template: TEditorConfiguration, templateId?: string, templateName?: string) => void;
|
|
5736
|
+
loadTemplate: (template: TEditorConfiguration, templateId?: string, templateName?: string, kind?: TemplateKind$1 | null) => void;
|
|
5611
5737
|
registerSaveListener: (callback: (template: TEditorConfiguration) => void) => () => void;
|
|
5612
|
-
setCurrentTemplate: (templateId: string | null, templateName: string | null) => void;
|
|
5738
|
+
setCurrentTemplate: (templateId: string | null, templateName: string | null, kind?: TemplateKind$1 | null) => void;
|
|
5613
5739
|
}
|
|
5614
5740
|
interface EmailEditorProviderProps {
|
|
5615
5741
|
children: React.ReactNode;
|
|
5616
5742
|
initialTemplate?: TEditorConfiguration;
|
|
5617
5743
|
initialTemplateId?: string;
|
|
5618
5744
|
initialTemplateName?: string;
|
|
5619
|
-
onSave?: (
|
|
5745
|
+
onSave?: (payload: SavePayload) => void | Promise<void>;
|
|
5620
5746
|
onChange?: (template: TEditorConfiguration) => void;
|
|
5621
5747
|
}
|
|
5622
5748
|
declare const EmailEditorProvider: React.FC<EmailEditorProviderProps>;
|
|
@@ -5626,12 +5752,21 @@ declare const useEmailEditor: () => EmailEditorContextType;
|
|
|
5626
5752
|
* Wraps a raw HTML string in an editor config with an EmailLayout root + one Html block.
|
|
5627
5753
|
*/
|
|
5628
5754
|
declare function htmlToEditorConfig(html: string): TEditorConfiguration;
|
|
5629
|
-
|
|
5755
|
+
type TemplateKind = 'template' | 'sample';
|
|
5756
|
+
interface TemplateListItem {
|
|
5630
5757
|
id: string;
|
|
5631
|
-
|
|
5758
|
+
slug: string;
|
|
5759
|
+
kind: TemplateKind;
|
|
5632
5760
|
description?: string;
|
|
5633
|
-
|
|
5634
|
-
|
|
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;
|
|
5635
5770
|
}
|
|
5636
5771
|
interface EmailEditorRef {
|
|
5637
5772
|
saveTemplate: () => TEditorConfiguration;
|
|
@@ -5647,7 +5782,12 @@ interface EmailEditorProps {
|
|
|
5647
5782
|
initialTemplate?: TEditorConfiguration | string;
|
|
5648
5783
|
initialTemplateId?: string;
|
|
5649
5784
|
initialTemplateName?: string;
|
|
5650
|
-
|
|
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>;
|
|
5651
5791
|
onChange?: (template: TEditorConfiguration) => void;
|
|
5652
5792
|
/**
|
|
5653
5793
|
* Duration for drawer enter transition in milliseconds. Set to 0 for instant.
|
|
@@ -5684,12 +5824,12 @@ interface EmailEditorProps {
|
|
|
5684
5824
|
* Callback to load samples dynamically.
|
|
5685
5825
|
* This will be called when the samples drawer is opened.
|
|
5686
5826
|
*/
|
|
5687
|
-
loadSamples?: () => Promise<
|
|
5827
|
+
loadSamples?: () => Promise<TemplateListItem[]>;
|
|
5688
5828
|
/**
|
|
5689
5829
|
* Callback to load existing templates dynamically.
|
|
5690
5830
|
* This will be called when the samples drawer is opened.
|
|
5691
5831
|
*/
|
|
5692
|
-
loadTemplates?: () => Promise<
|
|
5832
|
+
loadTemplates?: () => Promise<TemplateListItem[]>;
|
|
5693
5833
|
/**
|
|
5694
5834
|
* Callback to load a specific template by ID.
|
|
5695
5835
|
* This will be called when a sample is selected from the drawer.
|
|
@@ -5704,11 +5844,21 @@ interface EmailEditorProps {
|
|
|
5704
5844
|
*/
|
|
5705
5845
|
copyTemplate?: (templateName: string, content: any) => void;
|
|
5706
5846
|
/**
|
|
5707
|
-
* 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`.
|
|
5708
5858
|
*/
|
|
5709
|
-
saveAs?: (templateName: string,
|
|
5859
|
+
saveAs?: (templateName: string, payload: SavePayload) => Promise<{
|
|
5710
5860
|
id: string;
|
|
5711
|
-
|
|
5861
|
+
slug: string;
|
|
5712
5862
|
}>;
|
|
5713
5863
|
/**
|
|
5714
5864
|
* Optional theme override. If not provided, the default theme will be used.
|
|
@@ -5718,4 +5868,4 @@ interface EmailEditorProps {
|
|
|
5718
5868
|
}
|
|
5719
5869
|
declare const EmailEditor: React.ForwardRefExoticComponent<EmailEditorProps & React.RefAttributes<EmailEditorRef>>;
|
|
5720
5870
|
|
|
5721
|
-
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 };
|