@trycourier/react-designer 0.0.2 → 0.0.4

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 (166) hide show
  1. package/README.md +143 -22
  2. package/dist/channels.d.ts +7 -0
  3. package/dist/cjs/index.css +1 -1
  4. package/dist/cjs/index.css.map +2 -2
  5. package/dist/cjs/index.js +50 -30
  6. package/dist/cjs/index.js.map +4 -4
  7. package/dist/cjs/styles.css +505 -31
  8. package/dist/components/BrandEditor/BrandEditor.types.d.ts +36 -0
  9. package/dist/components/BrandEditor/Editor/BrandFooter/BrandFooter.d.ts +8 -3
  10. package/dist/components/BrandEditor/Editor/Editor.d.ts +2 -40
  11. package/dist/components/BrandEditor/Editor/SideBar/SideBar.d.ts +2 -7
  12. package/dist/components/Providers/BrandProvider.d.ts +0 -12
  13. package/dist/components/Providers/Providers.types.d.ts +1 -0
  14. package/dist/components/Providers/TemplateProvider.d.ts +7 -12
  15. package/dist/components/Providers/api/common.d.ts +1 -1
  16. package/dist/components/Providers/api/template.d.ts +2 -1
  17. package/dist/components/Providers/index.d.ts +4 -2
  18. package/dist/components/Providers/store.d.ts +48 -14
  19. package/dist/components/Providers/useBrandActions.d.ts +22 -0
  20. package/dist/components/Providers/useTemplateActions.d.ts +23 -0
  21. package/dist/components/TemplateEditor/Channels/Channels.d.ts +6 -0
  22. package/dist/components/TemplateEditor/Channels/Email/Email.d.ts +55 -0
  23. package/dist/components/TemplateEditor/Channels/Email/Email.test.d.ts +1 -0
  24. package/dist/components/TemplateEditor/Channels/Email/EmailEditor.d.ts +17 -0
  25. package/dist/components/TemplateEditor/Channels/Email/EmailEditor.test.d.ts +1 -0
  26. package/dist/components/TemplateEditor/Channels/Email/EmailLayout.d.ts +9 -0
  27. package/dist/components/TemplateEditor/Channels/Email/SideBar/SideBar.d.ts +7 -0
  28. package/dist/components/TemplateEditor/{Editor → Channels/Email}/SideBar/SideBarItemDetails/SideBarItemDetails.d.ts +1 -2
  29. package/dist/components/TemplateEditor/Channels/Email/SideBar/index.d.ts +2 -0
  30. package/dist/components/TemplateEditor/Channels/Email/index.d.ts +3 -0
  31. package/dist/components/TemplateEditor/Channels/Inbox/Inbox.d.ts +33 -0
  32. package/dist/components/TemplateEditor/Channels/Inbox/Inbox.test.d.ts +1 -0
  33. package/dist/components/TemplateEditor/Channels/Inbox/InboxEditor.d.ts +4 -0
  34. package/dist/components/TemplateEditor/Channels/Inbox/InboxEditor.test.d.ts +1 -0
  35. package/dist/components/TemplateEditor/Channels/Inbox/InboxLayout.d.ts +4 -0
  36. package/dist/components/TemplateEditor/Channels/Inbox/SideBar/SideBar.d.ts +1 -0
  37. package/dist/components/TemplateEditor/Channels/Inbox/index.d.ts +3 -0
  38. package/dist/components/TemplateEditor/Channels/Push/Push.d.ts +35 -0
  39. package/dist/components/TemplateEditor/Channels/Push/Push.test.d.ts +1 -0
  40. package/dist/components/TemplateEditor/Channels/Push/PushEditor.d.ts +5 -0
  41. package/dist/components/TemplateEditor/Channels/Push/PushEditor.test.d.ts +1 -0
  42. package/dist/components/TemplateEditor/Channels/Push/PushLayout.d.ts +4 -0
  43. package/dist/components/TemplateEditor/Channels/Push/index.d.ts +3 -0
  44. package/dist/components/TemplateEditor/Channels/SMS/SMS.d.ts +34 -0
  45. package/dist/components/TemplateEditor/Channels/SMS/SMS.test.d.ts +1 -0
  46. package/dist/components/TemplateEditor/Channels/SMS/SMSEditor.d.ts +5 -0
  47. package/dist/components/TemplateEditor/Channels/SMS/SMSEditor.test.d.ts +1 -0
  48. package/dist/components/TemplateEditor/Channels/SMS/SMSLayout.d.ts +4 -0
  49. package/dist/components/TemplateEditor/Channels/SMS/index.d.ts +3 -0
  50. package/dist/components/TemplateEditor/Channels/index.d.ts +6 -0
  51. package/dist/components/TemplateEditor/Channels/useChannels.d.ts +14 -0
  52. package/dist/components/TemplateEditor/Channels/useChannels.test.d.ts +1 -0
  53. package/dist/components/TemplateEditor/IPhoneFrame/IPhoneFrame.d.ts +4 -0
  54. package/dist/components/TemplateEditor/IPhoneFrame/index.d.ts +1 -0
  55. package/dist/components/TemplateEditor/Layout/Layout.d.ts +8 -0
  56. package/dist/components/TemplateEditor/Layout/index.d.ts +1 -0
  57. package/dist/components/TemplateEditor/TemplateEditor.d.ts +5 -1
  58. package/dist/components/TemplateEditor/index.d.ts +19 -0
  59. package/dist/components/TemplateEditor/store.d.ts +16 -0
  60. package/dist/components/extensions/Blockquote/Blockquote.test.d.ts +1 -0
  61. package/dist/components/extensions/Blockquote/Blockquote.types.d.ts +2 -2
  62. package/dist/components/extensions/Button/Button.test.d.ts +1 -0
  63. package/dist/components/extensions/Button/Button.types.d.ts +6 -6
  64. package/dist/components/extensions/ButtonRow/ButtonRow.d.ts +11 -0
  65. package/dist/components/extensions/ButtonRow/ButtonRow.test.d.ts +1 -0
  66. package/dist/components/extensions/ButtonRow/ButtonRow.types.d.ts +45 -0
  67. package/dist/components/extensions/ButtonRow/ButtonRowComponent.d.ts +5 -0
  68. package/dist/components/extensions/ButtonRow/index.d.ts +4 -0
  69. package/dist/components/extensions/Divider/Divider.test.d.ts +1 -0
  70. package/dist/components/extensions/Divider/Divider.types.d.ts +2 -2
  71. package/dist/components/extensions/DragPlaceholder/DragPlaceholder.test.d.ts +1 -0
  72. package/dist/components/extensions/FileHandler/FileHandler.test.d.ts +1 -0
  73. package/dist/components/extensions/FixedChannelPaste/FixedChannelPaste.d.ts +11 -0
  74. package/dist/components/extensions/FixedChannelPaste/FixedChannelPaste.test.d.ts +1 -0
  75. package/dist/components/extensions/FixedChannelPaste/index.d.ts +2 -0
  76. package/dist/components/extensions/FixedChannelSelection/FixedChannelSelection.d.ts +14 -0
  77. package/dist/components/extensions/FixedChannelSelection/FixedChannelSelection.test.d.ts +1 -0
  78. package/dist/components/extensions/FixedChannelSelection/index.d.ts +1 -0
  79. package/dist/components/extensions/Heading/Heading.test.d.ts +1 -0
  80. package/dist/components/extensions/Image/Image.test.d.ts +1 -0
  81. package/dist/components/extensions/ImageBlock/ImageBlock.test.d.ts +1 -0
  82. package/dist/components/extensions/Link/Link.test.d.ts +1 -0
  83. package/dist/components/extensions/Paragraph/Paragraph.test.d.ts +1 -0
  84. package/dist/components/extensions/Selection/Selection.test.d.ts +1 -0
  85. package/dist/components/extensions/TextBlock/TextBlock.test.d.ts +1 -0
  86. package/dist/components/extensions/TextBlock/TextBlock.types.d.ts +4 -4
  87. package/dist/components/extensions/UniqueId/UniqueId.test.d.ts +1 -0
  88. package/dist/components/extensions/Variable/Variable.test.d.ts +1 -0
  89. package/dist/components/extensions/Variable/VariablePaste.d.ts +2 -0
  90. package/dist/components/extensions/Variable/VariablePaste.test.d.ts +1 -0
  91. package/dist/components/extensions/Variable/index.d.ts +1 -0
  92. package/dist/components/extensions/extension-kit.d.ts +1 -4
  93. package/dist/components/extensions/index.d.ts +4 -1
  94. package/dist/components/ui/MainLayout/MainLayout.d.ts +9 -0
  95. package/dist/components/ui/MainLayout/index.d.ts +1 -0
  96. package/dist/components/ui/PreviewPanel/PreviewPanel.d.ts +3 -2
  97. package/dist/components/ui/Status/Status.d.ts +5 -2
  98. package/dist/components/ui/TextMenu/BubbleTextMenu.d.ts +6 -0
  99. package/dist/components/ui/TextMenu/TextMenu.d.ts +3 -1
  100. package/dist/components/ui/TextMenu/config.d.ts +1 -1
  101. package/dist/components/ui/TextMenu/hooks/useTextmenuStates.d.ts +3 -5
  102. package/dist/components/ui/TextMenu/store.d.ts +1 -16
  103. package/dist/components/ui/index.d.ts +1 -1
  104. package/dist/components/ui-kit/AlertDialog/AlertDialog.d.ts +20 -0
  105. package/dist/components/ui-kit/AlertDialog/index.d.ts +1 -0
  106. package/dist/components/ui-kit/Button/Button.d.ts +2 -3
  107. package/dist/components/ui-kit/ErrorBoundary/ErrorBoundary.d.ts +22 -0
  108. package/dist/components/ui-kit/ErrorBoundary/index.d.ts +1 -0
  109. package/dist/components/ui-kit/Icon/BatteryIcon.d.ts +3 -0
  110. package/dist/components/ui-kit/Icon/ExpandIcon.d.ts +3 -0
  111. package/dist/components/ui-kit/Icon/HamburgerMenuIcon.d.ts +3 -0
  112. package/dist/components/ui-kit/Icon/InAppIcon.d.ts +3 -0
  113. package/dist/components/ui-kit/Icon/InboxIcon.d.ts +3 -0
  114. package/dist/components/ui-kit/Icon/MoreMenuIcon.d.ts +3 -0
  115. package/dist/components/ui-kit/Icon/PushIcon.d.ts +3 -0
  116. package/dist/components/ui-kit/Icon/SMSIcon.d.ts +3 -0
  117. package/dist/components/ui-kit/Icon/SignalIcon.d.ts +3 -0
  118. package/dist/components/ui-kit/Icon/WiFiIcon.d.ts +3 -0
  119. package/dist/components/ui-kit/Icon/index.d.ts +10 -0
  120. package/dist/components/ui-kit/Separator/Separator.d.ts +4 -0
  121. package/dist/components/ui-kit/Separator/index.d.ts +1 -0
  122. package/dist/components/ui-kit/ThemeProvider/ThemeProvider.d.ts +1 -1
  123. package/dist/components/ui-kit/index.d.ts +3 -0
  124. package/dist/components/utils/index.d.ts +1 -0
  125. package/dist/components/utils/safeGetPos.d.ts +13 -0
  126. package/dist/esm/index.css +1 -1
  127. package/dist/esm/index.css.map +2 -2
  128. package/dist/esm/index.js +50 -30
  129. package/dist/esm/index.js.map +4 -4
  130. package/dist/esm/styles.css +505 -31
  131. package/dist/index.d.ts +2 -0
  132. package/dist/lib/api/uploadImage.d.ts +0 -1
  133. package/dist/lib/utils/convertElementalToTiptap/convertElementalToTiptap.d.ts +5 -1
  134. package/dist/lib/utils/convertElementalToTiptap/convertElementalToTiptap.test.d.ts +1 -0
  135. package/dist/lib/utils/convertMarkdownToTiptap/convertMarkdownToTiptap.test.d.ts +1 -0
  136. package/dist/lib/utils/convertTiptapToElemental/convertTiptapToElemental.d.ts +2 -2
  137. package/dist/lib/utils/convertTiptapToElemental/convertTiptapToElemental.test.d.ts +1 -0
  138. package/dist/lib/utils/convertTiptapToMarkdown/convertTiptapToMarkdown.test.d.ts +1 -0
  139. package/dist/lib/utils/errors.d.ts +26 -0
  140. package/dist/lib/utils/getTitle/demo.d.ts +1 -0
  141. package/dist/lib/utils/getTitle/getTitle.d.ts +18 -0
  142. package/dist/lib/utils/getTitle/getTitle.test.d.ts +1 -0
  143. package/dist/lib/utils/getTitle/index.d.ts +2 -0
  144. package/dist/lib/utils/getTitle/preserveStorageFormat.d.ts +30 -0
  145. package/dist/lib/utils/getTitle/preserveStorageFormat.test.d.ts +1 -0
  146. package/dist/lib/utils/index.d.ts +3 -1
  147. package/dist/lib/utils/updateElemental/index.d.ts +1 -0
  148. package/dist/lib/utils/updateElemental/updateElemental.d.ts +11 -0
  149. package/dist/lib/utils/updateElemental/updateElemental.test.d.ts +1 -0
  150. package/dist/store.d.ts +7 -2
  151. package/dist/styles.css +505 -31
  152. package/dist/types/elemental.schema.d.ts +3 -3
  153. package/package.json +14 -11
  154. package/dist/components/BrandEditor/Editor/useBlockEditor.d.ts +0 -23
  155. package/dist/components/TemplateEditor/Editor/Editor.d.ts +0 -11
  156. package/dist/components/TemplateEditor/Editor/SideBar/SideBar.d.ts +0 -7
  157. package/dist/components/TemplateEditor/Editor/index.d.ts +0 -1
  158. package/dist/components/TemplateEditor/Editor/useBlockEditor.d.ts +0 -23
  159. package/dist/components/ui/EditorLayout/EditorLayout.d.ts +0 -6
  160. package/dist/components/ui/EditorLayout/index.d.ts +0 -1
  161. /package/dist/components/TemplateEditor/{Editor → Channels/Email}/SideBar/SideBarItem/SideBarItem.d.ts +0 -0
  162. /package/dist/components/TemplateEditor/{Editor → Channels/Email}/SideBar/SideBarItem/index.d.ts +0 -0
  163. /package/dist/components/TemplateEditor/{Editor → Channels/Email}/SideBar/SideBarItemDetails/index.d.ts +0 -0
  164. /package/dist/components/TemplateEditor/{Editor → Channels/Email}/SideBar/SideBarSortableItemWrapper/SideBarSortableItemWrapper.d.ts +0 -0
  165. /package/dist/components/TemplateEditor/{Editor → Channels/Email}/SideBar/SideBarSortableItemWrapper/index.d.ts +0 -0
  166. /package/dist/components/TemplateEditor/{Editor → Channels/Inbox}/SideBar/index.d.ts +0 -0
@@ -44,3 +44,39 @@ export declare const brandEditorSchema: z.ZodObject<{
44
44
  }>;
45
45
  export type BrandEditorFormValues = z.infer<typeof brandEditorSchema>;
46
46
  export declare const defaultBrandEditorFormValues: BrandEditorFormValues;
47
+ export interface BrandSettings {
48
+ colors?: {
49
+ primary?: string;
50
+ secondary?: string;
51
+ tertiary?: string;
52
+ };
53
+ email?: {
54
+ header?: {
55
+ barColor?: string;
56
+ logo?: {
57
+ href?: string;
58
+ image?: string;
59
+ };
60
+ };
61
+ footer?: {
62
+ markdown?: string;
63
+ social?: {
64
+ facebook?: {
65
+ url?: string;
66
+ };
67
+ instagram?: {
68
+ url?: string;
69
+ };
70
+ linkedin?: {
71
+ url?: string;
72
+ };
73
+ medium?: {
74
+ url?: string;
75
+ };
76
+ twitter?: {
77
+ url?: string;
78
+ };
79
+ };
80
+ };
81
+ };
82
+ }
@@ -1,13 +1,18 @@
1
- import type { Editor as TiptapEditor } from "@tiptap/react";
1
+ import type { Transaction } from "@tiptap/pm/state";
2
+ import type { Editor } from "@tiptap/react";
2
3
  interface BrandFooterProps {
4
+ value?: string | null;
3
5
  variables?: Record<string, unknown>;
4
- setEditor?: (editor: TiptapEditor | null) => void;
5
6
  readOnly?: boolean;
6
7
  facebookLink?: string;
7
8
  linkedinLink?: string;
8
9
  instagramLink?: string;
9
10
  mediumLink?: string;
10
11
  xLink?: string;
12
+ onUpdate?: (props: {
13
+ editor: Editor;
14
+ transaction: Transaction;
15
+ }) => void;
11
16
  }
12
- export declare const BrandFooter: import("react").MemoExoticComponent<({ variables, facebookLink, linkedinLink, instagramLink, mediumLink, xLink, readOnly, setEditor, }: BrandFooterProps) => import("react/jsx-runtime").JSX.Element>;
17
+ export declare const BrandFooter: import("react").MemoExoticComponent<({ variables, facebookLink, linkedinLink, instagramLink, mediumLink, xLink, readOnly, value, onUpdate, }: BrandFooterProps) => import("react/jsx-runtime").JSX.Element>;
13
18
  export {};
@@ -1,48 +1,10 @@
1
- interface BrandSettings {
2
- colors?: {
3
- primary?: string;
4
- secondary?: string;
5
- tertiary?: string;
6
- };
7
- email?: {
8
- header?: {
9
- barColor?: string;
10
- logo?: {
11
- href?: string;
12
- image?: string;
13
- };
14
- };
15
- footer?: {
16
- markdown?: string;
17
- social?: {
18
- facebook?: {
19
- url?: string;
20
- };
21
- instagram?: {
22
- url?: string;
23
- };
24
- linkedin?: {
25
- url?: string;
26
- };
27
- medium?: {
28
- url?: string;
29
- };
30
- twitter?: {
31
- url?: string;
32
- };
33
- };
34
- };
35
- };
36
- }
1
+ import type { BrandEditorFormValues } from "../BrandEditor.types";
37
2
  export interface EditorProps {
38
3
  hidePublish?: boolean;
39
4
  autoSaveDebounce?: number;
40
5
  autoSave?: boolean;
41
6
  templateEditor?: boolean;
42
- isVisible?: boolean;
43
7
  variables?: Record<string, unknown>;
44
- value?: BrandSettings;
45
- onChange?: (value: BrandSettings) => void;
8
+ value?: BrandEditorFormValues;
46
9
  }
47
10
  export declare const Editor: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<EditorProps & import("react").RefAttributes<HTMLDivElement>>>;
48
- export {};
@@ -1,7 +1,2 @@
1
- import type { Editor } from "@tiptap/react";
2
- import type { BrandEditorFormValues } from "../../BrandEditor.types";
3
- export declare const SideBar: ({ editor, setForm, currentForm, }: {
4
- editor: Editor;
5
- setForm: (form: BrandEditorFormValues) => void;
6
- currentForm?: BrandEditorFormValues;
7
- }) => import("react/jsx-runtime").JSX.Element;
1
+ export declare const SideBarComponent: () => import("react/jsx-runtime").JSX.Element;
2
+ export declare const SideBar: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
@@ -1,14 +1,2 @@
1
1
  import type { BasicProviderProps } from "./Providers.types";
2
- export declare function useBrandActions(): {
3
- getTenant: (options?: {
4
- includeBrand?: boolean;
5
- } | undefined) => Promise<void>;
6
- saveBrand: (settings?: Record<string, unknown> | undefined) => Promise<any>;
7
- publishBrand: () => Promise<any>;
8
- isTenantLoading: boolean | null;
9
- isTenantSaving: boolean | null;
10
- isTenantPublishing: boolean | null;
11
- tenantError: string | null;
12
- tenantData: import("./store").TenantData | null;
13
- };
14
2
  export declare const BrandProvider: import("react").NamedExoticComponent<BasicProviderProps>;
@@ -1,6 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
2
  export interface BasicProviderProps {
3
3
  apiUrl?: string;
4
+ uploadImageUrl?: string;
4
5
  children: ReactNode;
5
6
  tenantId: string;
6
7
  token: string;
@@ -1,18 +1,13 @@
1
1
  import type { BasicProviderProps } from "./Providers.types";
2
- export declare function useTemplateActions(): {
3
- getTenant: (options?: {
4
- includeBrand?: boolean;
5
- } | undefined) => Promise<void>;
6
- saveTemplate: () => Promise<any>;
7
- publishTemplate: () => Promise<any>;
8
- isTenantLoading: boolean | null;
9
- isTenantSaving: boolean | null;
10
- isTenantPublishing: boolean | null;
11
- tenantError: string | null;
12
- tenantData: import("./store").TenantData | null;
13
- };
2
+ import { type TemplateActions, type MessageRouting } from "./store";
14
3
  type TemplateProviderProps = BasicProviderProps & {
15
4
  templateId: string;
5
+ getTemplate?: (actions: TemplateActions) => Promise<void>;
6
+ saveTemplate?: (actions: TemplateActions, options?: MessageRouting) => Promise<void>;
7
+ };
8
+ export declare const overrideFunctions: {
9
+ getTemplate: TemplateProviderProps["getTemplate"] | null;
10
+ saveTemplate: TemplateProviderProps["saveTemplate"] | null;
16
11
  };
17
12
  export declare const TemplateProvider: import("react").NamedExoticComponent<TemplateProviderProps>;
18
13
  export {};
@@ -1,4 +1,4 @@
1
- export declare const getTenantAtom: import("jotai").WritableAtom<null, [options?: {
1
+ export declare const getTemplateAtom: import("jotai").WritableAtom<null, [options?: {
2
2
  includeBrand?: boolean;
3
3
  } | undefined], Promise<void>> & {
4
4
  init: null;
@@ -1,4 +1,5 @@
1
- export declare const saveTemplateAtom: import("jotai").WritableAtom<null, [], Promise<any>> & {
1
+ import { type MessageRouting } from "../store";
2
+ export declare const saveTemplateAtom: import("jotai").WritableAtom<null, [routing?: MessageRouting | undefined], Promise<any>> & {
2
3
  init: null;
3
4
  };
4
5
  export declare const publishTemplateAtom: import("jotai").WritableAtom<null, [], Promise<any>> & {
@@ -1,3 +1,5 @@
1
- export { TemplateProvider, useTemplateActions } from "./TemplateProvider";
2
- export { BrandProvider, useBrandActions } from "./BrandProvider";
1
+ export { BrandProvider } from "./BrandProvider";
3
2
  export * from "./store";
3
+ export { TemplateProvider } from "./TemplateProvider";
4
+ export { useBrandActions } from "./useBrandActions";
5
+ export { useTemplateActions } from "./useTemplateActions";
@@ -1,5 +1,11 @@
1
- import type { Editor } from "@tiptap/react";
2
1
  import type { ElementalContent } from "@/types/elemental.types";
2
+ import type { TemplateError } from "@/lib/utils/errors";
3
+ export type MessageRoutingMethod = "all" | "single";
4
+ export type MessageRoutingChannel = string | MessageRouting;
5
+ export interface MessageRouting {
6
+ method: MessageRoutingMethod;
7
+ channels: MessageRoutingChannel[];
8
+ }
3
9
  export interface TenantData {
4
10
  data?: {
5
11
  tenant?: {
@@ -7,15 +13,12 @@ export interface TenantData {
7
13
  name?: string;
8
14
  notification?: {
9
15
  createdAt?: string;
16
+ publishedAt?: string | null;
10
17
  notificationId?: string;
11
18
  version?: string;
12
19
  data?: {
13
20
  content?: ElementalContent;
14
- routing?: {
15
- method?: string;
16
- channels?: string[];
17
- [key: string]: unknown;
18
- };
21
+ routing?: MessageRouting;
19
22
  [key: string]: unknown;
20
23
  };
21
24
  [key: string]: unknown;
@@ -81,6 +84,9 @@ export declare const editorStore: {
81
84
  export declare const apiUrlAtom: import("jotai").PrimitiveAtom<string> & {
82
85
  init: string;
83
86
  };
87
+ export declare const uploadImageUrlAtom: import("jotai").PrimitiveAtom<string> & {
88
+ init: string;
89
+ };
84
90
  export declare const tokenAtom: import("jotai").PrimitiveAtom<string> & {
85
91
  init: string;
86
92
  };
@@ -90,24 +96,52 @@ export declare const tenantIdAtom: import("jotai").PrimitiveAtom<string> & {
90
96
  export declare const templateIdAtom: import("jotai").PrimitiveAtom<string> & {
91
97
  init: string;
92
98
  };
93
- export declare const tenantDataAtom: import("jotai").PrimitiveAtom<TenantData | null> & {
99
+ export declare const templateDataAtom: import("jotai").PrimitiveAtom<TenantData | null> & {
94
100
  init: TenantData | null;
95
101
  };
96
- export declare const isTenantLoadingAtom: import("jotai").PrimitiveAtom<boolean | null> & {
102
+ export declare const isTemplateLoadingAtom: import("jotai").PrimitiveAtom<boolean | null> & {
97
103
  init: boolean | null;
98
104
  };
99
- export declare const isTenantSavingAtom: import("jotai").PrimitiveAtom<boolean | null> & {
105
+ export declare const isTemplateSavingAtom: import("jotai").PrimitiveAtom<boolean | null> & {
100
106
  init: boolean | null;
101
107
  };
102
- export declare const isTenantPublishingAtom: import("jotai").PrimitiveAtom<boolean | null> & {
108
+ export declare const isTemplatePublishingAtom: import("jotai").PrimitiveAtom<boolean | null> & {
103
109
  init: boolean | null;
104
110
  };
105
- export declare const tenantErrorAtom: import("jotai").PrimitiveAtom<string | null> & {
106
- init: string | null;
111
+ export declare const templateErrorAtom: import("jotai").PrimitiveAtom<TemplateError | null> & {
112
+ init: TemplateError | null;
107
113
  };
108
114
  export declare const brandApplyAtom: import("jotai").PrimitiveAtom<boolean> & {
109
115
  init: boolean;
110
116
  };
111
- export declare const tenantEditorAtom: import("jotai").PrimitiveAtom<Editor | null> & {
112
- init: Editor | null;
117
+ export interface TemplateActions {
118
+ getTemplate: (options?: {
119
+ includeBrand?: boolean;
120
+ }) => Promise<void>;
121
+ saveTemplate: (options?: MessageRouting) => Promise<void>;
122
+ publishTemplate: () => Promise<unknown>;
123
+ isTemplateLoading: boolean | null;
124
+ setIsTemplateLoading: (loading: boolean | null) => void;
125
+ isTemplateSaving: boolean | null;
126
+ setIsTemplateSaving: (saving: boolean | null) => void;
127
+ isTemplatePublishing: boolean | null;
128
+ setIsTemplatePublishing: (publishing: boolean | null) => void;
129
+ templateError: TemplateError | null;
130
+ setTemplateError: (error: string | TemplateError | null) => void;
131
+ templateData: TenantData | null;
132
+ setTemplateData: (data: TenantData | null) => void;
133
+ templateEditorContent: ElementalContent | null | undefined;
134
+ setTemplateEditorContent: (content: ElementalContent | null) => void;
135
+ createCustomError: (message: string, details?: Record<string, unknown>) => TemplateError;
136
+ convertLegacyError: (error: string | TemplateError) => TemplateError;
137
+ }
138
+ export declare const getTemplateOverrideAtom: import("jotai").PrimitiveAtom<((options?: {
139
+ includeBrand?: boolean;
140
+ }) => Promise<void>) | null> & {
141
+ init: ((options?: {
142
+ includeBrand?: boolean;
143
+ }) => Promise<void>) | null;
144
+ };
145
+ export declare const saveTemplateOverrideAtom: import("jotai").PrimitiveAtom<((actions: TemplateActions, options?: MessageRouting) => Promise<void>) | null> & {
146
+ init: ((actions: TemplateActions, options?: MessageRouting) => Promise<void>) | null;
113
147
  };
@@ -0,0 +1,22 @@
1
+ import { type TemplateError } from "@/lib/utils/errors";
2
+ import { type MessageRouting } from "./store";
3
+ export declare function useBrandActions(): {
4
+ getTemplate: (options?: {
5
+ includeBrand?: boolean;
6
+ }) => Promise<void>;
7
+ saveTemplate: (options?: MessageRouting) => Promise<void>;
8
+ saveBrand: (settings?: Record<string, unknown> | undefined) => Promise<any>;
9
+ publishBrand: () => Promise<any>;
10
+ isTemplateLoading: boolean | null;
11
+ setIsTemplateLoading: (args_0: boolean | ((prev: boolean | null) => boolean | null) | null) => void;
12
+ isTemplateSaving: boolean | null;
13
+ setIsTemplateSaving: (args_0: boolean | ((prev: boolean | null) => boolean | null) | null) => void;
14
+ isTemplatePublishing: boolean | null;
15
+ setIsTemplatePublishing: (args_0: boolean | ((prev: boolean | null) => boolean | null) | null) => void;
16
+ templateError: TemplateError | null;
17
+ setTemplateError: (error: string | TemplateError | null) => void;
18
+ templateData: import("./store").TenantData | null;
19
+ setTemplateData: (args_0: import("./store").TenantData | ((prev: import("./store").TenantData | null) => import("./store").TenantData | null) | null) => void;
20
+ createCustomError: (message: string, toastProps?: import("sonner").ExternalToast) => TemplateError;
21
+ convertLegacyError: (error: string | TemplateError) => TemplateError;
22
+ };
@@ -0,0 +1,23 @@
1
+ import { type TemplateError } from "@/lib/utils/errors";
2
+ import { type MessageRouting } from "./store";
3
+ export declare function useTemplateActions(): {
4
+ getTemplate: (options?: {
5
+ includeBrand?: boolean;
6
+ }) => Promise<void>;
7
+ saveTemplate: (options?: MessageRouting) => Promise<void>;
8
+ publishTemplate: () => Promise<any>;
9
+ isTemplateLoading: boolean | null;
10
+ setIsTemplateLoading: (args_0: boolean | ((prev: boolean | null) => boolean | null) | null) => void;
11
+ isTemplateSaving: boolean | null;
12
+ setIsTemplateSaving: (args_0: boolean | ((prev: boolean | null) => boolean | null) | null) => void;
13
+ isTemplatePublishing: boolean | null;
14
+ setIsTemplatePublishing: (args_0: boolean | ((prev: boolean | null) => boolean | null) | null) => void;
15
+ templateError: TemplateError | null;
16
+ setTemplateError: (error: string | TemplateError | null) => void;
17
+ templateData: import("./store").TenantData | null;
18
+ setTemplateData: (args_0: import("./store").TenantData | ((prev: import("./store").TenantData | null) => import("./store").TenantData | null) | null) => void;
19
+ templateEditorContent: import("../TemplateEditor").ElementalContent | null | undefined;
20
+ setTemplateEditorContent: (args_0: import("../TemplateEditor").ElementalContent | ((prev: import("../TemplateEditor").ElementalContent | null | undefined) => import("../TemplateEditor").ElementalContent | null | undefined) | null | undefined) => void;
21
+ createCustomError: (message: string, toastProps?: import("sonner").ExternalToast) => TemplateError;
22
+ convertLegacyError: (error: string | TemplateError) => TemplateError;
23
+ };
@@ -0,0 +1,6 @@
1
+ import type { TemplateEditorProps } from "../TemplateEditor";
2
+ interface ChannelsProps extends Pick<TemplateEditorProps, "hidePublish" | "channels"> {
3
+ routing?: TemplateEditorProps["routing"];
4
+ }
5
+ export declare const Channels: ({ hidePublish, channels: channelsProp, routing, }: ChannelsProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,55 @@
1
+ import type { TiptapDoc } from "@/lib/utils";
2
+ import type { ChannelType } from "@/store";
3
+ import type { ElementalNode } from "@/types/elemental.types";
4
+ import type { UniqueIdentifier } from "@dnd-kit/core";
5
+ import type { SortingStrategy } from "@dnd-kit/sortable";
6
+ import type { Node } from "@tiptap/pm/model";
7
+ import type { Editor } from "@tiptap/react";
8
+ import type { MessageRouting, TenantData } from "../../../Providers/store";
9
+ import type { TemplateEditorProps } from "../../TemplateEditor";
10
+ interface BrandSettingsData {
11
+ brandColor?: string;
12
+ textColor?: string;
13
+ subtleColor?: string;
14
+ headerStyle: "border" | "plain";
15
+ logo?: string;
16
+ link?: string;
17
+ facebookLink?: string;
18
+ linkedinLink?: string;
19
+ instagramLink?: string;
20
+ mediumLink?: string;
21
+ xLink?: string;
22
+ }
23
+ export interface EmailProps extends Pick<TemplateEditorProps, "hidePublish" | "brandEditor" | "channels" | "variables" | "theme" | "routing" | "value"> {
24
+ isLoading?: boolean;
25
+ headerRenderer?: ({ hidePublish, channels, routing, }: {
26
+ hidePublish?: boolean;
27
+ channels?: ChannelType[];
28
+ routing?: MessageRouting;
29
+ }) => React.ReactNode;
30
+ render?: ({ subject, handleSubjectChange, selectedNode, setSelectedNode, previewMode, emailEditor, ref, isBrandApply, brandSettings, items, content, strategy, syncEditorItems, brandEditorContent, templateData, togglePreviewMode, }: {
31
+ subject: string | null;
32
+ handleSubjectChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
33
+ selectedNode: Node | null;
34
+ setSelectedNode: (node: Node | null) => void;
35
+ previewMode: "desktop" | "mobile" | undefined;
36
+ emailEditor: Editor | null;
37
+ ref: React.RefObject<HTMLDivElement> | null;
38
+ isBrandApply: boolean;
39
+ brandSettings: BrandSettingsData | null;
40
+ items: Items;
41
+ content: TiptapDoc | null;
42
+ strategy: SortingStrategy;
43
+ syncEditorItems: (editor: Editor) => void;
44
+ brandEditorContent: string | null;
45
+ templateData: TenantData | null;
46
+ togglePreviewMode: (mode: "desktop" | "mobile" | undefined) => void;
47
+ }) => React.ReactNode;
48
+ }
49
+ interface Items {
50
+ Editor: UniqueIdentifier[];
51
+ Sidebar: UniqueIdentifier[];
52
+ }
53
+ export declare const defaultEmailContent: ElementalNode[];
54
+ export declare const Email: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<EmailProps & import("react").RefAttributes<HTMLDivElement>>>;
55
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { TiptapDoc } from "@/types";
2
+ import type { Editor } from "@tiptap/core";
3
+ declare global {
4
+ interface Window {
5
+ editor: Editor | null;
6
+ }
7
+ }
8
+ export interface EmailEditorProps {
9
+ value?: TiptapDoc;
10
+ readOnly?: boolean;
11
+ subject?: string | null;
12
+ variables?: Record<string, unknown>;
13
+ onDestroy?: () => void;
14
+ onUpdate?: (editor: Editor) => void;
15
+ }
16
+ declare const EmailEditor: ({ value, readOnly, variables, onDestroy, onUpdate, subject: propSubject, }: EmailEditorProps) => import("react/jsx-runtime").JSX.Element;
17
+ export default EmailEditor;
@@ -0,0 +1,9 @@
1
+ import { type HTMLAttributes } from "react";
2
+ import { type EmailProps } from "./Email";
3
+ export declare const EmailEditorContainer: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
4
+ export declare const EmailEditorMain: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
5
+ previewMode: "desktop" | "mobile" | undefined;
6
+ } & import("react").RefAttributes<HTMLDivElement>>;
7
+ export interface EmailLayoutProps extends EmailProps {
8
+ }
9
+ export declare const EmailLayout: ({ variables, theme, isLoading, hidePublish, channels, brandEditor, routing, }: EmailLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type { UniqueIdentifier } from "@dnd-kit/core";
2
+ export interface SideBarProps {
3
+ items: UniqueIdentifier[];
4
+ brandEditor?: boolean;
5
+ label?: string;
6
+ }
7
+ export declare const SideBar: ({ items, brandEditor, label }: SideBarProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,7 @@
1
1
  import type { Node as ProseMirrorNode } from "@tiptap/pm/model";
2
2
  import type { Editor } from "@tiptap/react";
3
- interface SideBarItemDetailsProps {
3
+ export interface SideBarItemDetailsProps {
4
4
  element?: ProseMirrorNode;
5
5
  editor: Editor | null;
6
6
  }
7
7
  export declare const SideBarItemDetails: ({ element, editor }: SideBarItemDetailsProps) => import("react/jsx-runtime").JSX.Element | null;
8
- export {};
@@ -0,0 +1,2 @@
1
+ export * from "./SideBar";
2
+ export * from "./SideBarItemDetails";
@@ -0,0 +1,3 @@
1
+ export * from "./Email";
2
+ export * from "./EmailLayout";
3
+ export * from "./EmailEditor";
@@ -0,0 +1,33 @@
1
+ import type { MessageRouting } from "@/components/Providers/store";
2
+ import type { TextMenuConfig } from "@/components/ui/TextMenu/config";
3
+ import type { TiptapDoc } from "@/lib/utils";
4
+ import type { ChannelType } from "@/store";
5
+ import type { ElementalNode } from "@/types/elemental.types";
6
+ import type { AnyExtension, Editor } from "@tiptap/react";
7
+ import type { TemplateEditorProps } from "../../TemplateEditor";
8
+ export declare const defaultInboxContent: ElementalNode[];
9
+ export declare const InboxConfig: TextMenuConfig;
10
+ interface InboxEditorContentProps {
11
+ value?: TiptapDoc;
12
+ }
13
+ export declare const InboxEditorContent: ({ value }: InboxEditorContentProps) => null;
14
+ export interface InboxRenderProps {
15
+ content: TiptapDoc;
16
+ extensions: AnyExtension[];
17
+ editable: boolean;
18
+ autofocus: boolean;
19
+ onUpdate: ({ editor }: {
20
+ editor: Editor;
21
+ }) => void;
22
+ }
23
+ export interface InboxProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "channels" | "routing" | "value"> {
24
+ readOnly?: boolean;
25
+ headerRenderer?: ({ hidePublish, channels, routing, }: {
26
+ hidePublish?: boolean;
27
+ channels?: ChannelType[];
28
+ routing?: MessageRouting;
29
+ }) => React.ReactNode;
30
+ render?: (props: InboxRenderProps) => React.ReactNode;
31
+ }
32
+ export declare const Inbox: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<InboxProps & import("react").RefAttributes<HTMLDivElement>>>;
33
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { InboxRenderProps } from "./Inbox";
2
+ export interface InboxEditorProps extends InboxRenderProps {
3
+ }
4
+ export declare const InboxEditor: ({ content, extensions, editable, autofocus, onUpdate, }: InboxEditorProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ import type { InboxProps } from "./Inbox";
2
+ export interface InboxLayoutProps extends InboxProps {
3
+ }
4
+ export declare const InboxLayout: ({ hidePublish, theme, variables, channels, routing, }: InboxLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const SideBar: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,3 @@
1
+ export * from "./Inbox";
2
+ export * from "./InboxEditor";
3
+ export * from "./InboxLayout";
@@ -0,0 +1,35 @@
1
+ import type { MessageRouting } from "@/components/Providers/store";
2
+ import type { TextMenuConfig } from "@/components/ui/TextMenu/config";
3
+ import type { TiptapDoc } from "@/lib/utils";
4
+ import type { ChannelType } from "@/store";
5
+ import type { AnyExtension, Editor } from "@tiptap/react";
6
+ import type { TemplateEditorProps } from "../../TemplateEditor";
7
+ export declare const PushEditorContent: ({ value }: {
8
+ value?: TiptapDoc | null;
9
+ }) => null;
10
+ export interface PushRenderProps {
11
+ content: TiptapDoc | null;
12
+ extensions: AnyExtension[];
13
+ editable: boolean;
14
+ autofocus: boolean;
15
+ onUpdate: ({ editor }: {
16
+ editor: Editor;
17
+ }) => void;
18
+ }
19
+ export interface PushProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "channels" | "routing" | "value"> {
20
+ readOnly?: boolean;
21
+ headerRenderer?: ({ hidePublish, channels, routing, }: {
22
+ hidePublish?: boolean;
23
+ channels?: ChannelType[];
24
+ routing?: MessageRouting;
25
+ }) => React.ReactNode;
26
+ render?: (props: PushRenderProps) => React.ReactNode;
27
+ }
28
+ export declare const defaultPushContent: {
29
+ raw: {
30
+ title: string;
31
+ text: string;
32
+ };
33
+ };
34
+ export declare const PushConfig: TextMenuConfig;
35
+ export declare const Push: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<PushProps & import("react").RefAttributes<HTMLDivElement>>>;
@@ -0,0 +1,5 @@
1
+ import type { HTMLAttributes } from "react";
2
+ import { type PushRenderProps } from "./Push";
3
+ export interface PushEditorProps extends PushRenderProps, Omit<HTMLAttributes<HTMLDivElement>, "content"> {
4
+ }
5
+ export declare const PushEditor: ({ content, extensions, editable, autofocus, onUpdate, className, }: PushEditorProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ import type { PushProps } from "./Push";
2
+ export interface PushLayoutProps extends PushProps {
3
+ }
4
+ export declare const PushLayout: ({ hidePublish, theme, variables, channels, routing, }: PushLayoutProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export * from "./Push";
2
+ export * from "./PushEditor";
3
+ export * from "./PushLayout";
@@ -0,0 +1,34 @@
1
+ import type { TextMenuConfig } from "@/components/ui/TextMenu/config";
2
+ import type { TiptapDoc } from "@/lib/utils";
3
+ import type { AnyExtension, Editor } from "@tiptap/react";
4
+ import type { MessageRouting } from "../../../Providers/store";
5
+ import type { ChannelType } from "@/store";
6
+ import type { TemplateEditorProps } from "../../TemplateEditor";
7
+ export declare const defaultSMSContent: {
8
+ raw: {
9
+ text: string;
10
+ };
11
+ };
12
+ export declare const SMSEditorContent: ({ value }: {
13
+ value?: TiptapDoc | null;
14
+ }) => import("react/jsx-runtime").JSX.Element;
15
+ export interface SMSRenderProps {
16
+ content: TiptapDoc | null;
17
+ extensions: AnyExtension[];
18
+ editable: boolean;
19
+ autofocus: boolean;
20
+ onUpdate: ({ editor }: {
21
+ editor: Editor;
22
+ }) => void;
23
+ }
24
+ export interface SMSProps extends Pick<TemplateEditorProps, "hidePublish" | "theme" | "variables" | "channels" | "routing" | "value"> {
25
+ readOnly?: boolean;
26
+ headerRenderer?: ({ hidePublish, channels, routing, }: {
27
+ hidePublish?: boolean;
28
+ channels?: ChannelType[];
29
+ routing?: MessageRouting;
30
+ }) => React.ReactNode;
31
+ render?: (props: SMSRenderProps) => React.ReactNode;
32
+ }
33
+ export declare const SMSConfig: TextMenuConfig;
34
+ export declare const SMS: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<SMSProps & import("react").RefAttributes<HTMLDivElement>>>;