-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ComposerAttachment and MessageAttachment (#777)
- Loading branch information
Showing
16 changed files
with
135 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,24 @@ | ||
export type Attachment = { | ||
import { CoreUserContentPart } from "../../types"; | ||
|
||
export type BaseAttachment = { | ||
id: string; | ||
type: "image" | "document" | "file"; | ||
name: string; | ||
}; | ||
|
||
export type ComposerAttachment = BaseAttachment & { | ||
file: File; | ||
}; | ||
|
||
export type MessageAttachment = BaseAttachment & { | ||
file?: File; | ||
content: CoreUserContentPart[]; | ||
}; | ||
|
||
export type AttachmentState = Readonly<{ | ||
attachment: Attachment; | ||
export type ComposerAttachmentState = Readonly<{ | ||
attachment: ComposerAttachment; | ||
}>; | ||
|
||
export type MessageAttachmentState = Readonly<{ | ||
attachment: MessageAttachment; | ||
}>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
packages/react/src/runtimes/attachment/AttachmentAdapter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { Attachment } from "../../context/stores/Attachment"; | ||
import { CoreUserContentPart } from "../../types"; | ||
import { | ||
ComposerAttachment, | ||
MessageAttachment, | ||
} from "../../context/stores/Attachment"; | ||
|
||
export type AttachmentAdapter = { | ||
add(state: { file: File }): Promise<Attachment>; | ||
send(attachment: Attachment): Promise<{ | ||
content: CoreUserContentPart[]; | ||
}>; | ||
remove(attachment: Attachment): Promise<void>; | ||
add(state: { file: File }): Promise<ComposerAttachment>; | ||
remove(attachment: ComposerAttachment): Promise<void>; | ||
send(attachment: ComposerAttachment): Promise<MessageAttachment>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.