@trycourier/react-designer 0.2.0 → 0.4.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.
Files changed (118) hide show
  1. package/README.md +254 -41
  2. package/dist/cjs/index.js +70 -47
  3. package/dist/cjs/index.js.map +4 -4
  4. package/dist/cjs/styles.css +1609 -480
  5. package/dist/components/BrandEditor/BrandEditor.d.ts +1 -0
  6. package/dist/components/BrandEditor/Editor/BrandFooter/BrandFooter.d.ts +1 -1
  7. package/dist/components/BrandEditor/Editor/Editor.d.ts +16 -0
  8. package/dist/components/Providers/api/template.d.ts +33 -1
  9. package/dist/components/Providers/store.d.ts +6 -0
  10. package/dist/components/Providers/useBrandActions.d.ts +1 -1
  11. package/dist/components/Providers/useTemplateActions.d.ts +4 -2
  12. package/dist/components/TemplateEditor/Channels/Email/Email.d.ts +5 -6
  13. package/dist/components/TemplateEditor/Channels/Email/EmailEditor.d.ts +2 -1
  14. package/dist/components/TemplateEditor/Channels/Email/EmailLayout.d.ts +1 -1
  15. package/dist/components/TemplateEditor/Channels/Email/SideBar/SideBar.d.ts +9 -3
  16. package/dist/components/TemplateEditor/Channels/Email/SideBar/SideBarSortableItemWrapper/SideBarSortableItemWrapper.d.ts +4 -18
  17. package/dist/components/TemplateEditor/Channels/Inbox/Inbox.d.ts +1 -1
  18. package/dist/components/TemplateEditor/Channels/Inbox/InboxLayout.d.ts +1 -1
  19. package/dist/components/TemplateEditor/Channels/MSTeams/MSTeams.d.ts +5 -3
  20. package/dist/components/TemplateEditor/Channels/MSTeams/MSTeamsEditor.d.ts +1 -1
  21. package/dist/components/TemplateEditor/Channels/MSTeams/MSTeamsLayout.d.ts +1 -1
  22. package/dist/components/TemplateEditor/Channels/MSTeams/SideBar/SideBar.d.ts +5 -3
  23. package/dist/components/TemplateEditor/Channels/Push/Push.d.ts +1 -1
  24. package/dist/components/TemplateEditor/Channels/Push/PushLayout.d.ts +1 -1
  25. package/dist/components/TemplateEditor/Channels/SMS/SMS.d.ts +1 -1
  26. package/dist/components/TemplateEditor/Channels/SMS/SMSLayout.d.ts +1 -1
  27. package/dist/components/TemplateEditor/Channels/Slack/SideBar/SideBar.d.ts +5 -3
  28. package/dist/components/TemplateEditor/Channels/Slack/Slack.d.ts +5 -3
  29. package/dist/components/TemplateEditor/Channels/Slack/SlackEditor.d.ts +1 -1
  30. package/dist/components/TemplateEditor/Channels/Slack/SlackLayout.d.ts +1 -1
  31. package/dist/components/TemplateEditor/Channels/useChannels.d.ts +9 -1
  32. package/dist/components/TemplateEditor/TemplateEditor.d.ts +17 -1
  33. package/dist/components/TemplateEditor/hooks/index.d.ts +1 -0
  34. package/dist/components/TemplateEditor/hooks/useDebouncedFlush.d.ts +10 -0
  35. package/dist/components/TemplateEditor/hooks/useDndRef.d.ts +18 -0
  36. package/dist/components/TemplateEditor/hooks/useEditorDnd.d.ts +12 -16
  37. package/dist/components/TemplateEditor/hooks/usePragmaticDnd.d.ts +22 -0
  38. package/dist/components/TemplateEditor/hooks/useSyncEditorItems.d.ts +3 -2
  39. package/dist/components/TemplateEditor/index.d.ts +5 -2
  40. package/dist/components/TemplateEditor/store.d.ts +150 -0
  41. package/dist/components/extensions/Blockquote/Blockquote.types.d.ts +2 -2
  42. package/dist/components/extensions/Button/Button.types.d.ts +18 -24
  43. package/dist/components/extensions/Button/ButtonComponent.d.ts +1 -0
  44. package/dist/components/extensions/ButtonRow/ButtonRowComponent.d.ts +5 -1
  45. package/dist/components/extensions/Column/Column.d.ts +11 -0
  46. package/dist/components/extensions/Column/Column.types.d.ts +44 -0
  47. package/dist/components/extensions/Column/ColumnComponent.d.ts +9 -0
  48. package/dist/components/extensions/Column/ColumnForm.d.ts +8 -0
  49. package/dist/components/extensions/Column/index.d.ts +5 -0
  50. package/dist/components/extensions/ColumnCell/ColumnCell.d.ts +10 -0
  51. package/dist/components/extensions/ColumnCell/ColumnCellComponent.d.ts +2 -0
  52. package/dist/components/extensions/ColumnCell/index.d.ts +2 -0
  53. package/dist/components/extensions/ColumnRow/ColumnRow.d.ts +10 -0
  54. package/dist/components/extensions/ColumnRow/ColumnRowComponent.d.ts +2 -0
  55. package/dist/components/extensions/ColumnRow/index.d.ts +2 -0
  56. package/dist/components/extensions/ImageBlock/ImageBlock.types.d.ts +2 -6
  57. package/dist/components/extensions/Selection/Selection.d.ts +1 -0
  58. package/dist/components/extensions/TextBlock/TextBlock.types.d.ts +4 -12
  59. package/dist/components/extensions/Variable/Variable.d.ts +16 -0
  60. package/dist/components/extensions/Variable/Variable.types.d.ts +22 -18
  61. package/dist/components/extensions/Variable/VariableIcon.d.ts +5 -1
  62. package/dist/components/extensions/Variable/index.d.ts +1 -0
  63. package/dist/components/extensions/extension-kit.d.ts +8 -3
  64. package/dist/components/extensions/index.d.ts +4 -1
  65. package/dist/components/hooks/index.d.ts +2 -0
  66. package/dist/components/hooks/useBlockConfig.d.ts +110 -0
  67. package/dist/components/hooks/useVariables.d.ts +40 -0
  68. package/dist/components/ui/Blocks/ColumnBlock/ColumnBlock.d.ts +3 -0
  69. package/dist/components/ui/Blocks/ColumnBlock/index.d.ts +1 -0
  70. package/dist/components/ui/Blocks/CustomCodeBlock/index.d.ts +1 -1
  71. package/dist/components/ui/Blocks/index.d.ts +1 -0
  72. package/dist/components/ui/ContentIcon/ContentIcon.d.ts +1 -0
  73. package/dist/components/ui/DraggableItem/DraggableItem.d.ts +16 -0
  74. package/dist/components/ui/DraggableItem/index.d.ts +1 -0
  75. package/dist/components/ui/DropIndicatorPlaceholder/DropIndicatorPlaceholder.d.ts +5 -0
  76. package/dist/components/ui/DropIndicatorPlaceholder/index.d.ts +1 -0
  77. package/dist/components/ui/FormHeader/FormHeader.d.ts +2 -1
  78. package/dist/components/ui/MainLayout/MainLayout.d.ts +1 -1
  79. package/dist/components/ui/SortableItemWrapper/SortableItemWrapper.d.ts +11 -8
  80. package/dist/components/ui/TextInput/TextInput.d.ts +0 -1
  81. package/dist/components/ui/TextMenu/config.d.ts +16 -0
  82. package/dist/components/ui/TextMenu/hooks/useConditionalRules.d.ts +18 -0
  83. package/dist/components/ui/TextMenu/hooks/useTextmenuCommands.d.ts +15 -1
  84. package/dist/components/ui/VariableEditor/VariableAutocomplete.d.ts +16 -0
  85. package/dist/components/ui/VariableEditor/VariableChipBase.d.ts +35 -0
  86. package/dist/components/ui/VariableEditor/VariableEditorToolbar.d.ts +15 -0
  87. package/dist/components/ui/VariableEditor/VariableInput.d.ts +13 -0
  88. package/dist/components/ui/VariableEditor/VariableTextarea.d.ts +11 -0
  89. package/dist/components/ui/VariableEditor/index.d.ts +8 -0
  90. package/dist/components/ui/VariableEditor/shared.d.ts +47 -0
  91. package/dist/components/ui-kit/Icon/EmailIcon.d.ts +3 -0
  92. package/dist/components/ui-kit/Icon/MSTeamsIcon.d.ts +1 -1
  93. package/dist/components/ui-kit/Icon/PushIcon.d.ts +1 -1
  94. package/dist/components/ui-kit/Icon/VariableIcon.d.ts +1 -1
  95. package/dist/components/ui-kit/Icon/index.d.ts +1 -0
  96. package/dist/components/ui-kit/ThemeProvider/ThemeProvider.d.ts +1 -1
  97. package/dist/components/ui-kit/Toggle/Toggle.d.ts +2 -2
  98. package/dist/components/ui-kit/ToggleGroup/ToggleGroup.d.ts +2 -2
  99. package/dist/components/utils/extractVariablesFromContent.d.ts +13 -0
  100. package/dist/components/utils/index.d.ts +1 -0
  101. package/dist/components/utils/multipleContainersKeyboardCoordinates.d.ts +1 -2
  102. package/dist/components/utils/validateVariableName.d.ts +9 -0
  103. package/dist/esm/index.js +70 -47
  104. package/dist/esm/index.js.map +4 -4
  105. package/dist/esm/styles.css +1609 -480
  106. package/dist/hooks/useAutoSave.d.ts +2 -1
  107. package/dist/index.d.ts +2 -1
  108. package/dist/lib/utils/image.d.ts +5 -0
  109. package/dist/styles.css +1609 -480
  110. package/dist/types/elemental.schema.d.ts +3 -3
  111. package/dist/types/elemental.types.d.ts +48 -4
  112. package/dist/types/index.d.ts +1 -0
  113. package/dist/types/validation.types.d.ts +53 -0
  114. package/package.json +7 -6
  115. package/dist/cjs/index.css +0 -2
  116. package/dist/cjs/index.css.map +0 -7
  117. package/dist/esm/index.css +0 -2
  118. package/dist/esm/index.css.map +0 -7
package/README.md CHANGED
@@ -283,40 +283,176 @@ const { requestId } = await courier.send({
283
283
 
284
284
  Variables are placeholders in your template that get replaced with actual data when the email is sent. For example, instead of writing "**Hello customer,**" you can write "**Hello `{{user.firstName}}`,**" which will display the recipient's actual name.
285
285
 
286
- The Courier Editor supports nested variable structures:
286
+ The Courier Editor supports any valid variable name, including nested structures like `{{user.firstName}}` or `{{company.address.city}}`.
287
+
288
+ **How to Insert Variables**
289
+
290
+ Type `{{variableName}}` directly in the editor. The variable will be automatically converted to a variable node when you finish typing. Variable names must follow valid JSON property naming conventions (e.g., `user.firstName`, `company.name`).
291
+
292
+ ### Variable Autocomplete
293
+
294
+ When you provide a `variables` prop, the editor shows an autocomplete dropdown when users type `{{`. This guides users to select from available variables and helps prevent typos.
287
295
 
288
296
  ```tsx
289
297
  import "@trycourier/react-designer/styles.css";
290
298
  import { TemplateEditor, TemplateProvider } from "@trycourier/react-designer";
291
299
 
292
300
  function App() {
301
+ // Define available variables (can be nested objects)
302
+ const variables = {
303
+ user: {
304
+ firstName: "",
305
+ lastName: "",
306
+ email: "",
307
+ },
308
+ order: {
309
+ id: "",
310
+ total: "",
311
+ date: "",
312
+ },
313
+ company: {
314
+ name: "",
315
+ },
316
+ };
317
+
293
318
  return (
294
319
  <TemplateProvider templateId="template-123" tenantId="tenant-123" token="jwt">
295
- <TemplateEditor
296
- variables={{
297
- user: {
298
- firstName: "John",
299
- lastName: "Doe",
300
- email: "john@example.com",
301
- },
302
- company: {
303
- name: "Acme Inc",
304
- address: {
305
- street: "123 Main St",
306
- city: "San Francisco",
307
- },
308
- },
309
- }}
310
- />
320
+ <TemplateEditor variables={variables} />
311
321
  </TemplateProvider>
312
322
  );
313
323
  }
314
324
  ```
315
325
 
316
- **How to Insert Variables**
326
+ When users type `{{` in the editor, they'll see a dropdown with:
327
+ - `user.firstName`
328
+ - `user.lastName`
329
+ - `user.email`
330
+ - `order.id`
331
+ - `order.total`
332
+ - `order.date`
333
+ - `company.name`
334
+
335
+ The dropdown filters as the user types, making it easy to find the right variable.
336
+
337
+ **Disabling Autocomplete:**
338
+
339
+ If you want to allow users to type any variable name without suggestions, use the `disableVariablesAutocomplete` prop:
340
+
341
+ ```tsx
342
+ <TemplateEditor disableVariablesAutocomplete />
343
+ ```
344
+
345
+ This is useful when you don't have a predefined list of variables and want to allow any variable name.
346
+
347
+ ### Variable Validation
348
+
349
+ The editor supports custom variable validation, allowing you to restrict which variable names users can enter. This is useful when you have a specific set of allowed replacement variables and want to prevent users from entering arbitrary names that could cause errors downstream.
350
+
351
+ ```tsx
352
+ import "@trycourier/react-designer/styles.css";
353
+ import { TemplateEditor, TemplateProvider } from "@trycourier/react-designer";
354
+ import type { VariableValidationConfig } from "@trycourier/react-designer";
355
+
356
+ const ALLOWED_VARIABLES = [
357
+ "user.firstName",
358
+ "user.lastName",
359
+ "user.email",
360
+ "order.id",
361
+ "order.total",
362
+ ];
363
+
364
+ function App() {
365
+ const variableValidation: VariableValidationConfig = {
366
+ // Custom validator - return true if variable is allowed
367
+ validate: (name) => ALLOWED_VARIABLES.includes(name),
368
+
369
+ // Behavior when validation fails: "mark" (default) or "remove"
370
+ onInvalid: "mark",
371
+
372
+ // Toast message shown on invalid variable
373
+ invalidMessage: (name) =>
374
+ `Variable "${name}" is not allowed. Available: ${ALLOWED_VARIABLES.join(", ")}`,
375
+ };
376
+
377
+ return (
378
+ <TemplateProvider templateId="template-123" tenantId="tenant-123" token="jwt">
379
+ <TemplateEditor variableValidation={variableValidation} />
380
+ </TemplateProvider>
381
+ );
382
+ }
383
+ ```
384
+
385
+ **VariableValidationConfig Options:**
386
+
387
+ | Option | Type | Default | Description |
388
+ |--------|------|---------|-------------|
389
+ | `validate` | `(name: string) => boolean` | - | Custom validator function. Returns `true` if the variable is allowed. Runs after built-in format validation. |
390
+ | `onInvalid` | `"mark" \| "remove"` | `"mark"` | Behavior when validation fails. `"mark"` keeps the chip with invalid styling (red). `"remove"` deletes the chip. |
391
+ | `invalidMessage` | `string \| ((name: string) => string)` | - | Message to show as a toast when validation fails. Can be a static string or a function for dynamic messages. |
392
+ | `overrideFormatValidation` | `boolean` | `false` | If `true`, bypasses built-in format validation entirely. Only the custom `validate` function is used. Use with caution. |
393
+
394
+ **Validation Flow:**
395
+
396
+ 1. **Built-in format validation** runs first (unless `overrideFormatValidation` is `true`), ensuring the variable name follows valid JSON property conventions.
397
+ 2. **Custom validation** runs second (if `validate` is provided), checking against your allowed list or custom rules.
398
+ 3. If validation fails, the `onInvalid` behavior is applied and a toast is shown if `invalidMessage` is configured.
399
+
400
+ ### Block Library Customization
317
401
 
318
- 1. When editing text, type `{{` to open the variable suggestions dropdown. Select the variable you want to insert from the list.
319
- 2. Via curly braces `{}` icon in top toolbar (if the variables are available for selected element).
402
+ The `useBlockConfig` hook allows you to customize the blocks available in the sidebar, set default attributes, and create pre-configured block presets.
403
+
404
+ _Note: `useBlockConfig` must be used inside of the `<TemplateProvider />` context_
405
+
406
+ ```tsx
407
+ import { useBlockConfig, TemplateEditor, TemplateProvider } from "@trycourier/react-designer";
408
+
409
+ function CustomBlocksEditor() {
410
+ const { setVisibleBlocks, setDefaults, registerPreset } = useBlockConfig();
411
+
412
+ useEffect(() => {
413
+ // Register a preset (pre-configured block variant)
414
+ registerPreset({
415
+ type: "button",
416
+ key: "console",
417
+ label: "Go to Console",
418
+ icon: <ExternalLinkIcon />, // Optional custom icon
419
+ attributes: { link: "https://console.example.com", backgroundColor: "#007bff" },
420
+ });
421
+
422
+ // Set default attributes for all new buttons (borderRadius is a number in pixels)
423
+ setDefaults("button", { borderRadius: 4 });
424
+
425
+ // Control which blocks appear in sidebar (and their order)
426
+ setVisibleBlocks([
427
+ "heading",
428
+ "text",
429
+ { type: "button", preset: "console" }, // Preset between built-in blocks
430
+ "image",
431
+ "button",
432
+ ]);
433
+ }, []);
434
+
435
+ return <TemplateEditor />;
436
+ }
437
+ ```
438
+
439
+ **API Reference:**
440
+
441
+ | Function | Description |
442
+ |----------|-------------|
443
+ | `visibleBlocks` | Current visible blocks array |
444
+ | `setVisibleBlocks(blocks)` | Set which blocks appear in sidebar |
445
+ | `resetVisibleBlocks()` | Reset to default blocks |
446
+ | `setDefaults(type, attrs)` | Set default attributes for a block type |
447
+ | `getDefaults(type)` | Get defaults for a block type |
448
+ | `clearDefaults(type)` | Clear defaults for a block type |
449
+ | `registerPreset(preset)` | Register a pre-configured block variant |
450
+ | `unregisterPreset(type, key)` | Remove a preset |
451
+ | `presets` | All registered presets |
452
+ | `getPresetsForType(type)` | Get presets for a specific block type |
453
+ | `insertBlock(type, presetKey?)` | Programmatically insert a block |
454
+
455
+ **Block Types:** `heading`, `text`, `image`, `button`, `divider`, `spacer`, `customCode`, `column`, `blockquote`
320
456
 
321
457
  ## Error Handling
322
458
 
@@ -489,6 +625,79 @@ function App() {
489
625
  }
490
626
  ```
491
627
 
628
+ ## Template Duplication
629
+
630
+ The `useTemplateActions` hook provides a `duplicateTemplate` function that allows you to create a copy of the current template with a new ID. This is useful for creating variations of existing templates or providing users with a "Save As" functionality.
631
+
632
+ _Note: `useTemplateActions` must be used inside of the `<TemplateProvider />` context_
633
+
634
+ ```tsx
635
+ import { useTemplateActions, TemplateEditor, TemplateProvider } from "@trycourier/react-designer";
636
+ import { useState } from "react";
637
+
638
+ function DuplicateTemplateExample() {
639
+ const { duplicateTemplate } = useTemplateActions();
640
+
641
+ // Simple duplicate with auto-generated name (adds "-copy" suffix)
642
+ const handleQuickDuplicate = async () => {
643
+ const result = await duplicateTemplate();
644
+ if (result?.success) {
645
+ console.log(`Template duplicated to: ${result.templateId}`);
646
+ }
647
+ };
648
+
649
+ // Duplicate with custom ID
650
+ const handleCustomDuplicate = async () => {
651
+ const result = await duplicateTemplate({
652
+ targetTemplateId: "my-custom-template-id",
653
+ // Optionally provide a custom display name:
654
+ // name: "My Duplicated Template",
655
+ });
656
+ if (result?.success) {
657
+ console.log(`Template duplicated! New ID: ${result.templateId}, Version: ${result.version}`);
658
+ }
659
+ };
660
+
661
+ return (
662
+ <div>
663
+ <TemplateEditor />
664
+ <button onClick={handleQuickDuplicate}>Quick Duplicate</button>
665
+ <button onClick={handleCustomDuplicate}>Duplicate with Custom ID</button>
666
+ </div>
667
+ );
668
+ }
669
+
670
+ function App() {
671
+ return (
672
+ <TemplateProvider templateId="original-template" tenantId="tenant-123" token="jwt">
673
+ <DuplicateTemplateExample />
674
+ </TemplateProvider>
675
+ );
676
+ }
677
+ ```
678
+
679
+ ### Duplicate Template Options
680
+
681
+ All options are optional. If called with no arguments, the function will create a duplicate with ID `{currentTemplateId}-copy`.
682
+
683
+ | Option | Type | Required | Description |
684
+ |--------|------|----------|-------------|
685
+ | `targetTemplateId` | `string` | No | The ID for the new duplicated template. Defaults to `{currentTemplateId}-copy` |
686
+ | `content` | `ElementalContent` | No | Override the content to duplicate (defaults to current editor content) |
687
+ | `name` | `string` | No | Custom display name for the new template (defaults to targetTemplateId) |
688
+
689
+ ### Duplicate Template Result
690
+
691
+ The `duplicateTemplate` function returns a promise that resolves to:
692
+
693
+ ```tsx
694
+ interface DuplicateTemplateResult {
695
+ success: boolean; // Whether the duplication succeeded
696
+ templateId: string; // The ID of the new template
697
+ version?: string; // The version of the newly created template
698
+ }
699
+ ```
700
+
492
701
  ## Brand Editor
493
702
 
494
703
  The Brand Editor component allows you to customize and manage a tenant's brand settings directly within your application. This specialized editor provides an interface for modifying brand colors, logos, and other visual elements that will be applied to your templates.
@@ -568,18 +777,20 @@ The Properties section details the configuration options available for both the
568
777
 
569
778
  The Editor component is the core element that provides the template editing interface. If you are using the Template Editor with the Template provider, required properties will be provided.
570
779
 
571
- | Property | Type | Default | Description |
572
- | ---------------- | -------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
573
- | autoSave | boolean | true | Enables automatic saving of changes to the template. When true, changes are automatically persisted. |
574
- | autoSaveDebounce | number | 200ms | Time in milliseconds to wait after changes before triggering an auto-save operation. Controls save frequency. |
575
- | brandEditor | boolean | false | When enabled, shows the brand editor interface alongside the template editor. Allows editing brand settings. |
576
- | brandProps | BrandEditorProps | | Configuration options for the brand editor when enabled. Passed directly to the BrandEditor component. |
577
- | hidePublish | boolean | false | When true, hides the "Publish Changes" button in the editor interface. |
578
- | onChange | (value: ElementalContent) => void | | Callback function that fires whenever the editor content changes, providing the updated ElementalContent structure. |
579
- | routing | { method: string; channels: string[] } | | Configures multi-channel routing and delivery behavior. The `method` property determines delivery strategy: "single" (deliver via first available channel) or "all" (deliver via all configured channels). The `channels` array defines which delivery channels are available in the editor. |
580
- | theme | ThemeObj | cssClass | | Controls the visual appearance of the editor. Can be a Theme object with styling properties or a CSS class name. |
581
- | value | ElementalContent | | Initial content for the editor in ElementalContent format. Used as the starting template when the editor loads. |
582
- | variables | Record<string, any | | Custom variables available for template personalization. These can be referenced within the template content. |
780
+ | Property | Type | Default | Description |
781
+ | ---------------- | -------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
782
+ | autoSave | boolean | true | Enables automatic saving of changes to the template. When true, changes are automatically persisted. |
783
+ | autoSaveDebounce | number | 2000ms | Time in milliseconds to wait after changes before triggering an auto-save operation. Controls save frequency. |
784
+ | brandEditor | boolean | false | When enabled, shows the brand editor interface alongside the template editor. Allows editing brand settings. |
785
+ | brandProps | BrandEditorProps | | Configuration options for the brand editor when enabled. Passed directly to the BrandEditor component. |
786
+ | hidePublish | boolean | false | When true, hides the "Publish Changes" button in the editor interface. |
787
+ | onChange | (value: ElementalContent) => void | | Callback function that fires whenever the editor content changes, providing the updated ElementalContent structure. |
788
+ | routing | { method: string; channels: string[] } | | Configures multi-channel routing and delivery behavior. The `method` property determines delivery strategy: "single" (deliver via first available channel) or "all" (deliver via all configured channels). The `channels` array defines which delivery channels are available in the editor. |
789
+ | theme | ThemeObj \| cssClass | | Controls the visual appearance of the editor. Can be a Theme object with styling properties or a CSS class name. |
790
+ | value | ElementalContent | | Initial content for the editor in ElementalContent format. Used as the starting template when the editor loads. |
791
+ | variableValidation | VariableValidationConfig | | Configuration for custom variable validation. Allows restricting which variable names are allowed and defining behavior on validation failure. See [Variable Validation](#variable-validation) section for details. |
792
+ | variables | Record<string, any> | | Variables available for autocomplete suggestions. When provided, typing `{{` shows a dropdown with matching variables. See [Variable Autocomplete](#variable-autocomplete) section for details. |
793
+ | disableVariablesAutocomplete | boolean | false | When `true`, disables variable autocomplete and allows users to type any variable name directly. When `false` (default), shows autocomplete dropdown with variables from the `variables` prop. |
583
794
 
584
795
  ### Multi-Channel Routing
585
796
 
@@ -627,15 +838,17 @@ The TemplateProvider component wraps the Editor component and manages the templa
627
838
 
628
839
  The Brand Editor component accepts properties that allow you to customize its behavior and appearance. These properties provide control over the editing interface and functionality specific to brand management.
629
840
 
630
- | Property | Type | Default | Description |
631
- | ---------------- | ------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
632
- | autoSave | boolean | true | Enables automatic saving of changes to the template. When true, changes are automatically persisted. |
633
- | autoSaveDebounce | number | 200ms | Time in milliseconds to wait after changes before triggering an auto-save operation. Controls save frequency. |
634
- | hidePublish | boolean | false | When true, hides the "Publish Changes" button in the editor interface. |
635
- | onChange | (value: BrandSettings) => void | | Callback function that fires whenever brand settings are modified, providing the updated brand configuration values. |
636
- | theme | ThemeObj | cssClass | | Controls the visual appearance of the editor. Can be a Theme object with styling properties or a CSS class name. |
637
- | value | BrandSettings | | Initial brand settings values to populate the editor with, including colors, logo, social links, and header style preferences. |
638
- | variables | Record<string, any | | Custom variables available for brand personalization. These can be referenced within the brand footer content. |
841
+ | Property | Type | Default | Description |
842
+ | ---------------- | ------------------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------ |
843
+ | autoSave | boolean | true | Enables automatic saving of changes to the template. When true, changes are automatically persisted. |
844
+ | autoSaveDebounce | number | 2000ms | Time in milliseconds to wait after changes before triggering an auto-save operation. Controls save frequency. |
845
+ | hidePublish | boolean | false | When true, hides the "Publish Changes" button in the editor interface. |
846
+ | onChange | (value: BrandSettings) => void | | Callback function that fires whenever brand settings are modified, providing the updated brand configuration values. |
847
+ | theme | ThemeObj \| cssClass | | Controls the visual appearance of the editor. Can be a Theme object with styling properties or a CSS class name. |
848
+ | value | BrandSettings | | Initial brand settings values to populate the editor with, including colors, logo, social links, and header style preferences. |
849
+ | variableValidation | VariableValidationConfig | | Configuration for custom variable validation. See [Variable Validation](#variable-validation) section for details. |
850
+ | variables | Record<string, any> | | Variables available for autocomplete suggestions. When provided, typing `{{` shows a dropdown with matching variables. |
851
+ | disableVariablesAutocomplete | boolean | false | When `true`, disables variable autocomplete and allows users to type any variable name directly. |
639
852
 
640
853
  ### Brand Provider
641
854