@trycourier/react-designer 0.0.4 → 0.0.6

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.
@@ -1,8 +1,15 @@
1
1
  import type { ReactNode } from "react";
2
2
  export interface BasicProviderProps {
3
3
  apiUrl?: string;
4
- uploadImageUrl?: string;
5
4
  children: ReactNode;
6
5
  tenantId: string;
7
6
  token: string;
8
7
  }
8
+ export interface ImageUploadConfig {
9
+ file: File;
10
+ onProgress?: (progress: number) => void;
11
+ }
12
+ export interface ImageUploadResponse {
13
+ url: string;
14
+ }
15
+ export type UploadImageFunction = (config: ImageUploadConfig) => Promise<ImageUploadResponse>;
@@ -1,13 +1,15 @@
1
- import type { BasicProviderProps } from "./Providers.types";
1
+ import type { BasicProviderProps, UploadImageFunction } from "./Providers.types";
2
2
  import { type TemplateActions, type MessageRouting } from "./store";
3
3
  type TemplateProviderProps = BasicProviderProps & {
4
4
  templateId: string;
5
5
  getTemplate?: (actions: TemplateActions) => Promise<void>;
6
6
  saveTemplate?: (actions: TemplateActions, options?: MessageRouting) => Promise<void>;
7
+ uploadImage?: UploadImageFunction;
7
8
  };
8
9
  export declare const overrideFunctions: {
9
10
  getTemplate: TemplateProviderProps["getTemplate"] | null;
10
11
  saveTemplate: TemplateProviderProps["saveTemplate"] | null;
12
+ uploadImage: TemplateProviderProps["uploadImage"] | null;
11
13
  };
12
14
  export declare const TemplateProvider: import("react").NamedExoticComponent<TemplateProviderProps>;
13
15
  export {};
@@ -3,3 +3,5 @@ export * from "./store";
3
3
  export { TemplateProvider } from "./TemplateProvider";
4
4
  export { useBrandActions } from "./useBrandActions";
5
5
  export { useTemplateActions } from "./useTemplateActions";
6
+ export { useImageUpload } from "./useImageUpload";
7
+ export type { ImageUploadConfig, ImageUploadResponse, UploadImageFunction, } from "./Providers.types";
@@ -84,9 +84,6 @@ export declare const editorStore: {
84
84
  export declare const apiUrlAtom: import("jotai").PrimitiveAtom<string> & {
85
85
  init: string;
86
86
  };
87
- export declare const uploadImageUrlAtom: import("jotai").PrimitiveAtom<string> & {
88
- init: string;
89
- };
90
87
  export declare const tokenAtom: import("jotai").PrimitiveAtom<string> & {
91
88
  init: string;
92
89
  };
@@ -0,0 +1,10 @@
1
+ import type { ImageUploadConfig, ImageUploadResponse } from "./Providers.types";
2
+ /**
3
+ * Hook for handling image uploads with customizable upload mechanism.
4
+ *
5
+ * - If uploadImage prop is provided to TemplateProvider: uses custom upload function
6
+ * - If uploadImage prop is NOT provided: falls back to default GraphQL upload using apiUrl
7
+ */
8
+ export declare function useImageUpload(): {
9
+ uploadImage: (config: ImageUploadConfig) => Promise<ImageUploadResponse>;
10
+ };
@@ -1,6 +1,7 @@
1
1
  import { type Channel, type ChannelType } from "@/store";
2
2
  import type { TemplateEditorProps } from "../TemplateEditor";
3
3
  export declare const useChannels: ({ channels, routing, }: {
4
+ /** @deprecated Use routing.channels instead. Will be removed in a future version. */
4
5
  channels?: ChannelType[];
5
6
  routing?: TemplateEditorProps["routing"];
6
7
  }) => {
@@ -13,6 +13,7 @@ export interface TemplateEditorProps {
13
13
  autoSaveDebounce?: number;
14
14
  brandEditor?: boolean;
15
15
  brandProps?: BrandEditorProps;
16
+ /** @deprecated Use routing.channels instead. Will be removed in a future version. */
16
17
  channels?: ChannelType[];
17
18
  routing?: MessageRouting;
18
19
  }
@@ -13,6 +13,7 @@ export declare const SMSChannel: import("react").MemoExoticComponent<import("rea
13
13
  export declare const PushChannel: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./Channels").PushProps & import("react").RefAttributes<HTMLDivElement>>>;
14
14
  export declare const InboxChannel: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<import("./Channels").InboxProps & import("react").RefAttributes<HTMLDivElement>>>;
15
15
  export { EmailEditorContainer, EmailEditorMain, type EmailEditorProps, type InboxEditorProps, type PushEditorProps, type SMSEditorProps, } from "./Channels";
16
+ export type { ChannelType } from "@/store";
16
17
  export type { ElementalContent } from "@/types";
17
18
  export { ChannelRootContainer, EditorSidebar } from "./Layout";
18
19
  export { InboxEditor, PushEditor, SMSEditor } from "./Channels";