@poolse/react-ui 3.10.1 → 3.10.2
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/CHANGELOG.md +26 -0
- package/README.md +6 -0
- package/dist/index.cjs +101 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +162 -114
- package/dist/index.d.ts +162 -114
- package/dist/index.js +102 -27
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { CallParticipant, CallAgent, CallDevice, CallDeviceKind, Message, Poolse, Uuid, MessageCreateRequest, LiveCall, Citation, MeetingMoment, Conversation, RecordingMode, ConsentDecision, AgentEscalation, EscalationReply, AgentApproval, Attachment, CallSummary, CallBackground, CallConnectionQuality, GuestLobbyStatus, CallQualityReport, CallNetworkIssue, CallReaction, RoomPresenceEntry, MeetingCard as MeetingCard$1, RsvpResponse, WhiteboardItem, WhiteboardShapeKind, PresenceState, Presence, Membership, LinkPreview, Block, BlockActionRequest, CatchUp, Poll } from '@poolse/sdk';
|
|
3
3
|
import * as react from 'react';
|
|
4
|
-
import { SVGProps, ReactElement, ReactNode, CSSProperties } from 'react';
|
|
5
|
-
import { GroupPosition, UseRoom, UseCallAgents, UseWhisper, UseAgenda, UseBreakouts, UseCaptions, UseLiveTranscript, UseLobby, UseMoments, UseQuestions, UseCallReactions, UseStage, CallAgent as CallAgent$1, UseScreenAnnotations, UseWhiteboard,
|
|
4
|
+
import { SVGProps, ReactElement, ReactNode, Ref, CSSProperties } from 'react';
|
|
5
|
+
import { GroupPosition, FormatKind, SlashCommand, UseRoom, UseCallAgents, UseWhisper, UseAgenda, UseBreakouts, UseCaptions, UseLiveTranscript, UseLobby, UseMoments, UseQuestions, UseCallReactions, UseStage, CallAgent as CallAgent$1, UseScreenAnnotations, UseWhiteboard, DlpOutcome, CustomEmoji, UploadItem, ReactionMap, MentionGroup } from '@poolse/react';
|
|
6
6
|
import { ThemeInput, ColorSchemePreference, ResolvedTheme, ColorScheme } from '@poolse/theme';
|
|
7
7
|
export { BUILT_IN_THEME_IDS, BuiltInThemeId, ColorScheme, ColorSchemePreference, DEFAULT_THEME_ID, FlatThemeTokens, Theme, ThemeInput, createTheme, decodeTheme, encodeTheme, tokensFromFlat } from '@poolse/theme';
|
|
8
8
|
|
|
@@ -619,6 +619,132 @@ interface RenderMessageContext {
|
|
|
619
619
|
renderDefault: () => ReactNode;
|
|
620
620
|
}
|
|
621
621
|
|
|
622
|
+
interface MessageComposerProps {
|
|
623
|
+
/**
|
|
624
|
+
* Called when the user submits a message. Second arg carries
|
|
625
|
+
* optional metadata: `quoted_message_id` when replying, and
|
|
626
|
+
* `attachment_ids` (resolved from the composer's upload queue) when
|
|
627
|
+
* files were attached. Return value is awaited so the composer can
|
|
628
|
+
* stay disabled until send completes. Resolve to `false` to keep the
|
|
629
|
+
* draft (text and attachments) in the composer, e.g. a cancelled
|
|
630
|
+
* `beforeSend`.
|
|
631
|
+
*/
|
|
632
|
+
onSend: (body: string, opts?: ComposerSendOptions) => Promise<unknown> | void;
|
|
633
|
+
/** Called on every keystroke. Hook this to `useTyping().signalTyping`. */
|
|
634
|
+
onTyping?: () => void;
|
|
635
|
+
placeholder?: string;
|
|
636
|
+
disabled?: boolean;
|
|
637
|
+
/**
|
|
638
|
+
* When set, renders a small quote chip above the input — the
|
|
639
|
+
* caller-owned "I'm about to quote-reply to this message" state.
|
|
640
|
+
* On submit, the message's id is forwarded as `quoted_message_id`.
|
|
641
|
+
* The composer does NOT clear this prop itself; the caller should
|
|
642
|
+
* clear `replyingTo` inside `onSend` after a successful send.
|
|
643
|
+
*/
|
|
644
|
+
replyingTo?: Message | null;
|
|
645
|
+
/** User clicked the (x) on the reply chip. Caller clears `replyingTo`. */
|
|
646
|
+
onCancelReply?: () => void;
|
|
647
|
+
/** Friendly display label for the quoted sender, keyed by `external_id`. */
|
|
648
|
+
labelFor?: (externalId: string) => string;
|
|
649
|
+
/**
|
|
650
|
+
* Show the paperclip + queue strip + accept dropped files via
|
|
651
|
+
* `ref.current.addFiles(files)`. Default `true`. Set `false` to
|
|
652
|
+
* disable attachments entirely (text-only composer).
|
|
653
|
+
*/
|
|
654
|
+
attachments?: boolean;
|
|
655
|
+
/** An emoji button that opens `<EmojiPicker>` and inserts at the caret. Default `true`. */
|
|
656
|
+
emojiPicker?: boolean;
|
|
657
|
+
/**
|
|
658
|
+
* The text changed (typing, an emoji, a restored draft, the reset after
|
|
659
|
+
* a send). Not called for the initial empty value.
|
|
660
|
+
*/
|
|
661
|
+
onValueChange?: (value: string) => void;
|
|
662
|
+
/** Largest attachment accepted, in bytes; bigger files show an error chip instead. */
|
|
663
|
+
maxFileSize?: number;
|
|
664
|
+
/**
|
|
665
|
+
* Accepted attachment types — MIME types, wildcards (`'image/*'`) or
|
|
666
|
+
* extensions (`'.pdf'`). Other files show an error chip instead.
|
|
667
|
+
*/
|
|
668
|
+
acceptFileTypes?: string[];
|
|
669
|
+
/**
|
|
670
|
+
* Composer shortcuts (send, new line, edit last, cancel) — see
|
|
671
|
+
* `ComposerKeymap`. Defaults: Enter / Cmd+Enter send, Shift+Enter new
|
|
672
|
+
* line, ↑ in an empty composer edits your last message, Esc cancels
|
|
673
|
+
* the reply.
|
|
674
|
+
*/
|
|
675
|
+
keymap?: ComposerKeymap;
|
|
676
|
+
/**
|
|
677
|
+
* ↑ in an empty composer: edit your last message. Return `false`
|
|
678
|
+
* when there's none to edit (the caret then moves as usual).
|
|
679
|
+
*/
|
|
680
|
+
onEditLast?: () => boolean | void;
|
|
681
|
+
/**
|
|
682
|
+
* Show the Markdown formatting toolbar (bold, italic, strike, code,
|
|
683
|
+
* link, quote, lists, checklist, code block, table) above the input.
|
|
684
|
+
* The Mod+B / I / E / K and Mod+Shift+X shortcuts work either way.
|
|
685
|
+
* Default `false`. Pass an array to choose the buttons and their order.
|
|
686
|
+
*/
|
|
687
|
+
formattingToolbar?: boolean | readonly FormatKind[];
|
|
688
|
+
/**
|
|
689
|
+
* Slash commands to suggest when the message starts with `/` (IN3):
|
|
690
|
+
* the apps' commands from the Workspace API. Picking one inserts
|
|
691
|
+
* `/name `; the message is sent as typed (`parseSlashCommand` splits it).
|
|
692
|
+
*/
|
|
693
|
+
commands?: readonly SlashCommand[];
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* `ConversationView` / `ThreadView`'s `beforeSend`: sees the message about
|
|
697
|
+
* to go out and returns it (changed or not), or `false` to cancel — the
|
|
698
|
+
* text and files then stay in the composer.
|
|
699
|
+
*/
|
|
700
|
+
type BeforeSend = (draft: MessageCreateRequest) => MessageCreateRequest | false | Promise<MessageCreateRequest | false>;
|
|
701
|
+
/**
|
|
702
|
+
* `ConversationView` / `ThreadView`'s `composerProps`: passed through to the
|
|
703
|
+
* composer. The view keeps sending, quoting and editing-last to itself;
|
|
704
|
+
* `onValueChange` and `onTyping` are called alongside its own.
|
|
705
|
+
*/
|
|
706
|
+
type ComposerPassThroughProps = Partial<Omit<MessageComposerProps, 'onSend' | 'replyingTo' | 'onCancelReply' | 'onEditLast'>>;
|
|
707
|
+
/** The second argument of `onSend`. */
|
|
708
|
+
interface ComposerSendOptions {
|
|
709
|
+
quoted_message_id?: Uuid;
|
|
710
|
+
attachment_ids?: Uuid[];
|
|
711
|
+
/**
|
|
712
|
+
* Set when the sender chose "Send anyway" on a data-loss-prevention
|
|
713
|
+
* warning (AD6): pass it on to `messages.send`.
|
|
714
|
+
*/
|
|
715
|
+
dlp_acknowledged?: true;
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Imperative handle exposed via `ref` for parents that want to forward
|
|
719
|
+
* dropped files (drag-and-drop on the conversation pane, paste from
|
|
720
|
+
* clipboard, etc.) into the composer's upload queue.
|
|
721
|
+
*/
|
|
722
|
+
interface MessageComposerHandle {
|
|
723
|
+
/** Enqueue files to upload + attach to the next send. No-op when `attachments={false}`. */
|
|
724
|
+
addFiles: (files: File[]) => void;
|
|
725
|
+
/** The text in the input right now. */
|
|
726
|
+
getText: () => string;
|
|
727
|
+
/** Replace the text in the input (e.g. to restore a draft or a failed send). */
|
|
728
|
+
setText: (text: string) => void;
|
|
729
|
+
/** Insert text at the caret (replacing a selection), as the emoji button does. */
|
|
730
|
+
insertText: (text: string) => void;
|
|
731
|
+
/** Empty the input. Queued attachments stay. */
|
|
732
|
+
clear: () => void;
|
|
733
|
+
/** Focus the input. */
|
|
734
|
+
focus: () => void;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Composer with Enter-to-send (Shift+Enter = newline), smart list
|
|
738
|
+
* continuation, optional reply chip, and built-in attachment support:
|
|
739
|
+
* a paperclip picker, a queue strip of in-flight uploads with progress
|
|
740
|
+
* and cancel, and "send body + attachments together" semantics.
|
|
741
|
+
*
|
|
742
|
+
* Disables submit while sends are in flight OR while any attachment is
|
|
743
|
+
* still uploading — the server-side `Idempotency-Key` handles the rare
|
|
744
|
+
* race the UI doesn't catch.
|
|
745
|
+
*/
|
|
746
|
+
declare const MessageComposer: react.ForwardRefExoticComponent<MessageComposerProps & react.RefAttributes<MessageComposerHandle>>;
|
|
747
|
+
|
|
622
748
|
interface ConversationViewProps {
|
|
623
749
|
conversationId: Uuid;
|
|
624
750
|
/**
|
|
@@ -867,8 +993,29 @@ interface ConversationViewProps {
|
|
|
867
993
|
* async `get` / `set` / `remove` with string values.
|
|
868
994
|
*/
|
|
869
995
|
draftStorage?: DraftStorage;
|
|
996
|
+
/**
|
|
997
|
+
* Passed through to the composer (`MessageComposer`, or `MentionInput`
|
|
998
|
+
* with `mentionComposer`): `placeholder`, `disabled`,
|
|
999
|
+
* `formattingToolbar`, `commands`… Sending, quoting and ↑-to-edit stay
|
|
1000
|
+
* the view's; `onValueChange` / `onTyping` run alongside its own. Also
|
|
1001
|
+
* used by the thread pane's composer.
|
|
1002
|
+
*/
|
|
1003
|
+
composerProps?: ComposerPassThroughProps;
|
|
1004
|
+
/** Rendered above the composer (a toolbar, a "scheduled" chip…). */
|
|
1005
|
+
composerAccessory?: ReactNode;
|
|
1006
|
+
/**
|
|
1007
|
+
* The composer's handle: `focus`, `insertText` (at the caret),
|
|
1008
|
+
* `setText`, `getText`, `clear`, `addFiles`.
|
|
1009
|
+
*/
|
|
1010
|
+
composerHandle?: Ref<MessageComposerHandle>;
|
|
1011
|
+
/**
|
|
1012
|
+
* Runs before every send here and in the thread pane: return the
|
|
1013
|
+
* message (changed or not), or `false` to cancel — the text and files
|
|
1014
|
+
* stay in the composer. Await anything (a confirm dialog, a lookup).
|
|
1015
|
+
*/
|
|
1016
|
+
beforeSend?: BeforeSend;
|
|
870
1017
|
}
|
|
871
|
-
declare function ConversationView({ conversationId, sendDefaults, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, maxFileSize, acceptFileTypes, emojiPicker, actions, threads, quotations, readReceipts, linkPreviews, markdown, maxBodyLength, grouping, groupingWindowMs, groupWindowMinutes, layout, density, showAvatars, showPresence, timeFormat, slots, daySeparators, senderLabels, avatars, onMarkedRead, focusMessageId, onFocusMessageNotFound, onSenderPress, onAvatarPress, composer, readOnly, onCallBack, onJoinCall, currentCallId, onOpenCitation, onOpenMoment, persistDrafts, draftStorage, keymap: keymapOverrides, sendOn, keyboardShortcuts, confirmDelete, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
|
|
1018
|
+
declare function ConversationView({ conversationId, sendDefaults, emptyState, renderMessage, labelFor, loadFonts, reactions, mentions, attachments, maxFileSize, acceptFileTypes, emojiPicker, actions, threads, quotations, readReceipts, linkPreviews, markdown, maxBodyLength, grouping, groupingWindowMs, groupWindowMinutes, layout, density, showAvatars, showPresence, timeFormat, slots, daySeparators, senderLabels, avatars, onMarkedRead, focusMessageId, onFocusMessageNotFound, onSenderPress, onAvatarPress, composer, readOnly, onCallBack, onJoinCall, currentCallId, onOpenCitation, onOpenMoment, persistDrafts, draftStorage, keymap: keymapOverrides, sendOn, keyboardShortcuts, confirmDelete, composerProps, composerAccessory, composerHandle, beforeSend, }: ConversationViewProps): react_jsx_runtime.JSX.Element;
|
|
872
1019
|
|
|
873
1020
|
interface ChatHeaderProps {
|
|
874
1021
|
/** Conversation id — used to fetch the row + members for the title / presence dot. */
|
|
@@ -1751,114 +1898,6 @@ interface EditableMessageBubbleProps {
|
|
|
1751
1898
|
}
|
|
1752
1899
|
declare function EditableMessageBubble({ message, currentUserId, readState, editing, onSave, onCancel, }: EditableMessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
1753
1900
|
|
|
1754
|
-
interface MessageComposerProps {
|
|
1755
|
-
/**
|
|
1756
|
-
* Called when the user submits a message. Second arg carries
|
|
1757
|
-
* optional metadata: `quoted_message_id` when replying, and
|
|
1758
|
-
* `attachment_ids` (resolved from the composer's upload queue) when
|
|
1759
|
-
* files were attached. Return value is awaited so the composer can
|
|
1760
|
-
* stay disabled until send completes.
|
|
1761
|
-
*/
|
|
1762
|
-
onSend: (body: string, opts?: ComposerSendOptions) => Promise<unknown> | void;
|
|
1763
|
-
/** Called on every keystroke. Hook this to `useTyping().signalTyping`. */
|
|
1764
|
-
onTyping?: () => void;
|
|
1765
|
-
placeholder?: string;
|
|
1766
|
-
disabled?: boolean;
|
|
1767
|
-
/**
|
|
1768
|
-
* When set, renders a small quote chip above the input — the
|
|
1769
|
-
* caller-owned "I'm about to quote-reply to this message" state.
|
|
1770
|
-
* On submit, the message's id is forwarded as `quoted_message_id`.
|
|
1771
|
-
* The composer does NOT clear this prop itself; the caller should
|
|
1772
|
-
* clear `replyingTo` inside `onSend` after a successful send.
|
|
1773
|
-
*/
|
|
1774
|
-
replyingTo?: Message | null;
|
|
1775
|
-
/** User clicked the (x) on the reply chip. Caller clears `replyingTo`. */
|
|
1776
|
-
onCancelReply?: () => void;
|
|
1777
|
-
/** Friendly display label for the quoted sender, keyed by `external_id`. */
|
|
1778
|
-
labelFor?: (externalId: string) => string;
|
|
1779
|
-
/**
|
|
1780
|
-
* Show the paperclip + queue strip + accept dropped files via
|
|
1781
|
-
* `ref.current.addFiles(files)`. Default `true`. Set `false` to
|
|
1782
|
-
* disable attachments entirely (text-only composer).
|
|
1783
|
-
*/
|
|
1784
|
-
attachments?: boolean;
|
|
1785
|
-
/** An emoji button that opens `<EmojiPicker>` and inserts at the caret. Default `true`. */
|
|
1786
|
-
emojiPicker?: boolean;
|
|
1787
|
-
/**
|
|
1788
|
-
* The text changed (typing, an emoji, a restored draft, the reset after
|
|
1789
|
-
* a send). Not called for the initial empty value.
|
|
1790
|
-
*/
|
|
1791
|
-
onValueChange?: (value: string) => void;
|
|
1792
|
-
/** Largest attachment accepted, in bytes; bigger files show an error chip instead. */
|
|
1793
|
-
maxFileSize?: number;
|
|
1794
|
-
/**
|
|
1795
|
-
* Accepted attachment types — MIME types, wildcards (`'image/*'`) or
|
|
1796
|
-
* extensions (`'.pdf'`). Other files show an error chip instead.
|
|
1797
|
-
*/
|
|
1798
|
-
acceptFileTypes?: string[];
|
|
1799
|
-
/**
|
|
1800
|
-
* Composer shortcuts (send, new line, edit last, cancel) — see
|
|
1801
|
-
* `ComposerKeymap`. Defaults: Enter / Cmd+Enter send, Shift+Enter new
|
|
1802
|
-
* line, ↑ in an empty composer edits your last message, Esc cancels
|
|
1803
|
-
* the reply.
|
|
1804
|
-
*/
|
|
1805
|
-
keymap?: ComposerKeymap;
|
|
1806
|
-
/**
|
|
1807
|
-
* ↑ in an empty composer: edit your last message. Return `false`
|
|
1808
|
-
* when there's none to edit (the caret then moves as usual).
|
|
1809
|
-
*/
|
|
1810
|
-
onEditLast?: () => boolean | void;
|
|
1811
|
-
/**
|
|
1812
|
-
* Show the Markdown formatting toolbar (bold, italic, strike, code,
|
|
1813
|
-
* link, quote, lists, checklist, code block, table) above the input.
|
|
1814
|
-
* The Mod+B / I / E / K and Mod+Shift+X shortcuts work either way.
|
|
1815
|
-
* Default `false`. Pass an array to choose the buttons and their order.
|
|
1816
|
-
*/
|
|
1817
|
-
formattingToolbar?: boolean | readonly FormatKind[];
|
|
1818
|
-
/**
|
|
1819
|
-
* Slash commands to suggest when the message starts with `/` (IN3):
|
|
1820
|
-
* the apps' commands from the Workspace API. Picking one inserts
|
|
1821
|
-
* `/name `; the message is sent as typed (`parseSlashCommand` splits it).
|
|
1822
|
-
*/
|
|
1823
|
-
commands?: readonly SlashCommand[];
|
|
1824
|
-
}
|
|
1825
|
-
/** The second argument of `onSend`. */
|
|
1826
|
-
interface ComposerSendOptions {
|
|
1827
|
-
quoted_message_id?: Uuid;
|
|
1828
|
-
attachment_ids?: Uuid[];
|
|
1829
|
-
/**
|
|
1830
|
-
* Set when the sender chose "Send anyway" on a data-loss-prevention
|
|
1831
|
-
* warning (AD6): pass it on to `messages.send`.
|
|
1832
|
-
*/
|
|
1833
|
-
dlp_acknowledged?: true;
|
|
1834
|
-
}
|
|
1835
|
-
/**
|
|
1836
|
-
* Imperative handle exposed via `ref` for parents that want to forward
|
|
1837
|
-
* dropped files (drag-and-drop on the conversation pane, paste from
|
|
1838
|
-
* clipboard, etc.) into the composer's upload queue.
|
|
1839
|
-
*/
|
|
1840
|
-
interface MessageComposerHandle {
|
|
1841
|
-
/** Enqueue files to upload + attach to the next send. No-op when `attachments={false}`. */
|
|
1842
|
-
addFiles: (files: File[]) => void;
|
|
1843
|
-
/** The text in the input right now. */
|
|
1844
|
-
getText: () => string;
|
|
1845
|
-
/** Replace the text in the input (e.g. to restore a draft or a failed send). */
|
|
1846
|
-
setText: (text: string) => void;
|
|
1847
|
-
/** Focus the input. */
|
|
1848
|
-
focus: () => void;
|
|
1849
|
-
}
|
|
1850
|
-
/**
|
|
1851
|
-
* Composer with Enter-to-send (Shift+Enter = newline), smart list
|
|
1852
|
-
* continuation, optional reply chip, and built-in attachment support:
|
|
1853
|
-
* a paperclip picker, a queue strip of in-flight uploads with progress
|
|
1854
|
-
* and cancel, and "send body + attachments together" semantics.
|
|
1855
|
-
*
|
|
1856
|
-
* Disables submit while sends are in flight OR while any attachment is
|
|
1857
|
-
* still uploading — the server-side `Idempotency-Key` handles the rare
|
|
1858
|
-
* race the UI doesn't catch.
|
|
1859
|
-
*/
|
|
1860
|
-
declare const MessageComposer: react.ForwardRefExoticComponent<MessageComposerProps & react.RefAttributes<MessageComposerHandle>>;
|
|
1861
|
-
|
|
1862
1901
|
/** A row of Markdown formatting buttons above the input. */
|
|
1863
1902
|
declare function FormattingToolbar({ onFormat, disabled, actions, }: {
|
|
1864
1903
|
onFormat: (kind: FormatKind) => void;
|
|
@@ -1979,8 +2018,16 @@ interface ThreadViewProps {
|
|
|
1979
2018
|
* `true`; turn it off in a direct message.
|
|
1980
2019
|
*/
|
|
1981
2020
|
alsoSendToChannel?: boolean;
|
|
1982
|
-
|
|
1983
|
-
|
|
2021
|
+
/** Passed through to the composer, as `ConversationView`'s `composerProps`. */
|
|
2022
|
+
composerProps?: ComposerPassThroughProps;
|
|
2023
|
+
/** Rendered above the composer. */
|
|
2024
|
+
composerAccessory?: ReactNode;
|
|
2025
|
+
/** The composer's handle: `focus`, `insertText`, `setText`, `getText`, `clear`, `addFiles`. */
|
|
2026
|
+
composerHandle?: Ref<MessageComposerHandle>;
|
|
2027
|
+
/** Runs before every reply: return it (changed or not), or `false` to cancel. */
|
|
2028
|
+
beforeSend?: BeforeSend;
|
|
2029
|
+
}
|
|
2030
|
+
declare function ThreadView({ conversationId, rootMessage, onClose, renderMessage, layout, timeFormat, density, showAvatars, showPresence, linkPreviews, maxFileSize, acceptFileTypes, follow, alsoSendToChannel, composerProps, composerAccessory, composerHandle, beforeSend, }: ThreadViewProps): react_jsx_runtime.JSX.Element;
|
|
1984
2031
|
|
|
1985
2032
|
interface ThreadSummaryProps {
|
|
1986
2033
|
/** The thread's root message. Renders nothing without replies. */
|
|
@@ -2312,6 +2359,7 @@ interface MentionInputProps {
|
|
|
2312
2359
|
* `MessageCreateRequest` shape (so `mentions` is wired correctly),
|
|
2313
2360
|
* not just `body`. Typically:
|
|
2314
2361
|
* `onSend={(req) => send(req)}` // from useMessages
|
|
2362
|
+
* Resolve to `false` to keep the draft in the composer.
|
|
2315
2363
|
*/
|
|
2316
2364
|
onSend: (req: MessageCreateRequest) => Promise<unknown> | void;
|
|
2317
2365
|
onTyping?: () => void;
|
|
@@ -2589,4 +2637,4 @@ interface VoiceRecorderProps {
|
|
|
2589
2637
|
/** Press to record, press again to send; Cancel throws it away. MediaRecorder-based. */
|
|
2590
2638
|
declare function VoiceRecorder({ onRecorded, maxMs, video, disabled, onError, }: VoiceRecorderProps): react_jsx_runtime.JSX.Element;
|
|
2591
2639
|
|
|
2592
|
-
export { AgendaPanel, type AgendaPanelProps, AgentBadge, type AgentBadgeProps, AnnotationOverlay, type AnnotationOverlayProps, ApprovalCard, type ApprovalCardProps, ApprovalList, type ApprovalListProps, AskMeetings, type AskMeetingsProps, AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, BackgroundMenu, type BackgroundMenuProps, BlockRenderer, type BlockRendererProps, BreakoutBanner, type BreakoutBannerProps, BreakoutHostPanel, type BreakoutHostPanelProps, CallAgentTag, type CallAgentTagProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, CallLogRow, type CallLogRowProps, CallPictureInPicture, type CallPictureInPictureProps, CallVideoGrid, type CallVideoGridProps, CaptionsButton, type CaptionsButtonProps, CaptionsOverlay, type CaptionsOverlayProps, CatchUpCard, type CatchUpCardProps, type ChatDensity, ChatHeader, type ChatHeaderProps, type ChatLayout, ClipPlayer, type ClipPlayerProps, type ComposerKeymap, type ComposerSendOptions, ConnectionIndicator, type ConnectionIndicatorProps, ConsentPrompt, type ConsentPromptProps, type ConversationDraft, ConversationList, type ConversationListProps, type ConversationListSection, ConversationView, type ConversationViewProps, DEFAULT_KEYMAP, DlpWarningDialog, type DlpWarningDialogProps, DraftScope, type DraftStorage, EditableMessageBubble, type EditableMessageBubbleProps, EditedLabel, type EditedLabelProps, EmojiGlyph, EmojiPicker, type EmojiPickerProps, EmptyState, type EmptyStateProps, EscalationCard, type EscalationCardProps, EscalationList, type EscalationListProps, FilesList, type FilesListProps, FormattingToolbar, type ForumPost, ForumPostList, type ForumPostListProps, ForwardDialog, type ForwardDialogProps, type ForwardTarget, ForwardedLabel, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, InCallChatPanel, type InCallChatPanelProps, type InboxUser, InviteAgentMenu, type InviteAgentMenuProps, type KeyBinding, LinkPreviewCard, type LinkPreviewCardProps, LiveCallBanner, type LiveCallBannerProps, LiveTranscriptPanel, type LiveTranscriptPanelProps, LobbyAdmitList, type LobbyAdmitListProps, LobbyWaiting, type LobbyWaitingProps, MOD_ENTER_COMPOSER, MarkMomentButton, type MarkMomentButtonProps, MeetingCard, type MeetingCardProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageApproval, type MessageApprovalProps, MessageBubble, type MessageBubbleProps, MessageCitations, type MessageCitationsProps, MessageComposer, type MessageComposerProps, type MessageExtrasHandlers, MessageExtrasProvider, type MessageListKeymap, type MessageSlot, type MessageSlotProps, type MessageSlots, type MessageUser, MoveCallHereBar, type MoveCallHereBarProps, type NameFor, NetworkBanner, type NetworkBannerProps, NoteCard, type NoteCardProps, type PictureInPictureKind, PinsList, type PinsListProps, PollCard, type PollCardProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, type PoolseKeymap, type PoolseKeymapOverrides, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, PoolseTheme, type PoolseThemeProps, type PoolseThemeValue, PresenceBadge, type PresenceBadgeProps, QuestionsPanel, type QuestionsPanelProps, ReactionBar, type ReactionBarProps, ReactionPicker, ReactionStrip, type ReactionStripProps, ReactionsOverlay, type ReactionsOverlayProps, RecordingBanner, type RecordingBannerProps, RecordingIndicator, type RecordingIndicatorProps, RecordingNoticeRow, type RecordingNoticeRowProps, RecordingPlayer, type RecordingPlayerHandle, type RecordingPlayerProps, type RenderMessageContext, RoomJoinBar, type RoomJoinBarProps, RoomPresence, type RoomPresenceProps, RoomStage, type RoomStageProps, SendStatus, type SendStatusProps, StagePanel, type StagePanelProps, SummaryCard, type SummaryCardProps, SummaryMessageRow, type SummaryMessageRowProps, ThreadSummary, type ThreadSummaryProps, ThreadView, type ThreadViewProps, type TimeFormat, TranscriptViewer, type TranscriptViewerProps, TranslatedText, type TranslatedTextProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, type UploadQueueStripProps, type UsePictureInPicture, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, VideoMessagePlayer, type VideoMessagePlayerProps, VoiceMessagePlayer, type VoiceMessagePlayerProps, VoiceRecorder, type VoiceRecorderProps, WHITEBOARD_COLORS, WhisperPanel, type WhisperPanelProps, Whiteboard, WhiteboardItemSvg, type WhiteboardProps, type WhiteboardTool, draftsOf, formatBytes, formatMeetingTime, formatRelativeTime, loadEmojiData, localDraftStorage, matchesAny, matchesKey, noteIdFromLink, pictureInPictureSupport, presenceStateLabel, presenceText, resolveKeymap, useDisplayName, useEditHistory, useMessageExtras, usePictureInPicture, usePoolseFonts, useSystemColorScheme, useTheme };
|
|
2640
|
+
export { AgendaPanel, type AgendaPanelProps, AgentBadge, type AgentBadgeProps, AnnotationOverlay, type AnnotationOverlayProps, ApprovalCard, type ApprovalCardProps, ApprovalList, type ApprovalListProps, AskMeetings, type AskMeetingsProps, AttachmentPreview, type AttachmentPreviewProps, Avatar, type AvatarProps, BackgroundMenu, type BackgroundMenuProps, type BeforeSend, BlockRenderer, type BlockRendererProps, BreakoutBanner, type BreakoutBannerProps, BreakoutHostPanel, type BreakoutHostPanelProps, CallAgentTag, type CallAgentTagProps, CallControlButton, type CallControlButtonProps, CallDeviceMenu, type CallDeviceMenuProps, CallLogRow, type CallLogRowProps, CallPictureInPicture, type CallPictureInPictureProps, CallVideoGrid, type CallVideoGridProps, CaptionsButton, type CaptionsButtonProps, CaptionsOverlay, type CaptionsOverlayProps, CatchUpCard, type CatchUpCardProps, type ChatDensity, ChatHeader, type ChatHeaderProps, type ChatLayout, ClipPlayer, type ClipPlayerProps, type ComposerKeymap, type ComposerPassThroughProps, type ComposerSendOptions, ConnectionIndicator, type ConnectionIndicatorProps, ConsentPrompt, type ConsentPromptProps, type ConversationDraft, ConversationList, type ConversationListProps, type ConversationListSection, ConversationView, type ConversationViewProps, DEFAULT_KEYMAP, DlpWarningDialog, type DlpWarningDialogProps, DraftScope, type DraftStorage, EditableMessageBubble, type EditableMessageBubbleProps, EditedLabel, type EditedLabelProps, EmojiGlyph, EmojiPicker, type EmojiPickerProps, EmptyState, type EmptyStateProps, EscalationCard, type EscalationCardProps, EscalationList, type EscalationListProps, FilesList, type FilesListProps, FormattingToolbar, type ForumPost, ForumPostList, type ForumPostListProps, ForwardDialog, type ForwardDialogProps, type ForwardTarget, ForwardedLabel, GroupDetailsSheet, type GroupDetailsSheetProps, type IconName, InCallChatPanel, type InCallChatPanelProps, type InboxUser, InviteAgentMenu, type InviteAgentMenuProps, type KeyBinding, LinkPreviewCard, type LinkPreviewCardProps, LiveCallBanner, type LiveCallBannerProps, LiveTranscriptPanel, type LiveTranscriptPanelProps, LobbyAdmitList, type LobbyAdmitListProps, LobbyWaiting, type LobbyWaitingProps, MOD_ENTER_COMPOSER, MarkMomentButton, type MarkMomentButtonProps, MeetingCard, type MeetingCardProps, MemberList, type MemberListProps, MentionInput, type MentionInputProps, MessageActions, type MessageActionsProps, MessageApproval, type MessageApprovalProps, MessageBubble, type MessageBubbleProps, MessageCitations, type MessageCitationsProps, MessageComposer, type MessageComposerHandle, type MessageComposerProps, type MessageExtrasHandlers, MessageExtrasProvider, type MessageListKeymap, type MessageSlot, type MessageSlotProps, type MessageSlots, type MessageUser, MoveCallHereBar, type MoveCallHereBarProps, type NameFor, NetworkBanner, type NetworkBannerProps, NoteCard, type NoteCardProps, type PictureInPictureKind, PinsList, type PinsListProps, PollCard, type PollCardProps, PoolseFonts, PoolseIcon, type PoolseIconProps, PoolseInbox, type PoolseInboxHandle, type PoolseInboxProps, type PoolseKeymap, type PoolseKeymapOverrides, PoolseLogo, type PoolseLogoProps, type PoolseLogoVariant, PoolseTheme, type PoolseThemeProps, type PoolseThemeValue, PresenceBadge, type PresenceBadgeProps, QuestionsPanel, type QuestionsPanelProps, ReactionBar, type ReactionBarProps, ReactionPicker, ReactionStrip, type ReactionStripProps, ReactionsOverlay, type ReactionsOverlayProps, RecordingBanner, type RecordingBannerProps, RecordingIndicator, type RecordingIndicatorProps, RecordingNoticeRow, type RecordingNoticeRowProps, RecordingPlayer, type RecordingPlayerHandle, type RecordingPlayerProps, type RenderMessageContext, RoomJoinBar, type RoomJoinBarProps, RoomPresence, type RoomPresenceProps, RoomStage, type RoomStageProps, SendStatus, type SendStatusProps, StagePanel, type StagePanelProps, SummaryCard, type SummaryCardProps, SummaryMessageRow, type SummaryMessageRowProps, ThreadSummary, type ThreadSummaryProps, ThreadView, type ThreadViewProps, type TimeFormat, TranscriptViewer, type TranscriptViewerProps, TranslatedText, type TranslatedTextProps, TypingIndicator, type TypingIndicatorProps, UploadQueueStrip, type UploadQueueStripProps, type UsePictureInPicture, UserName, type UserNameProps, UserPickerSheet, type UserPickerSheetProps, VideoMessagePlayer, type VideoMessagePlayerProps, VoiceMessagePlayer, type VoiceMessagePlayerProps, VoiceRecorder, type VoiceRecorderProps, WHITEBOARD_COLORS, WhisperPanel, type WhisperPanelProps, Whiteboard, WhiteboardItemSvg, type WhiteboardProps, type WhiteboardTool, draftsOf, formatBytes, formatMeetingTime, formatRelativeTime, loadEmojiData, localDraftStorage, matchesAny, matchesKey, noteIdFromLink, pictureInPictureSupport, presenceStateLabel, presenceText, resolveKeymap, useDisplayName, useEditHistory, useMessageExtras, usePictureInPicture, usePoolseFonts, useSystemColorScheme, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { safeUuid, MessageQueuedError, callAgentOfParticipant, identityKindOf, QUESTION_MAX, planBreakouts, connectionQualityLabel, DEFAULT_CALL_REACTIONS, rsvpOf, meetingJoinable, WHITEBOARD_SIZE, isPollClosed, pollPercentages, initialBlockValues, missingInputs, formatClock as formatClock$1, VIDEO_MESSAGE_MAX_MS, meetingNameOf } from '@poolse/sdk';
|
|
3
3
|
import { forwardRef, useState, useId, useReducer, useRef, useEffect, useImperativeHandle, createContext, useMemo, useCallback, Fragment as Fragment$1, useLayoutEffect, useContext } from 'react';
|
|
4
|
-
import { usePoolse, useMembers, rankMentionGroups, useUser, agentFromWire, mentionGroupMeta, useRecordingPlayback, silencesOf, silencesFromSegments, activeSegmentIndex, chapterIndexAt, meetingsErrorMessage, PLAYBACK_RATES, formatClock, speakerName, useMe, useConversations, slashQuery, filterSlashCommands, useAttachmentUpload, FORMAT_ACTIONS, skipSilenceTarget, filterConversations, useConversation, usePresence, useUserPresence, useAgent, useMessages, useTyping, useMessageStreams, useRealtimeStatus, isMessageVisibleTo, receiptsOf, computeGroupPosition, sameDay, formatDayLabel, applySlashCommand, formatForShortcut, applyFormat, readDlpError, useCustomEmoji, searchCustomEmoji, customEmojiToken, canEditOwnMessage, useLiveCall, recordingNoticeDisplayFor, callLogDisplayFor, parseCallSummary, useThreadFollow, useThread, usePresenceMany, findCustomEmoji, parseCustomEmojiToken, formatCallLogPreview, formatRecordingNoticePreview, formatCallSummaryPreview, ApiError, messageAgent, useReactions, clipOf, citationsOf, approvalIdOf, useCallSummary, summaryStyleLabel, summaryStatusText, formatDue, momentOf, useAttachmentUrl, useClip, useRecordingUrl, formatTimeRange, citationLabel, useApproval, approvalStatusLabel, APPROVAL_REASON_MAX, approvalErrorMessage, callAgentStateOf, callAgentStateLabel, callAgentModeLabel, whisperHintKindLabel, whisperErrorMessage, escalationStatusLabel, ESCALATION_ANSWER_MAX, escalationErrorMessage, useEscalations, useAskMeetings, ASK_QUESTION_MAX, captureLabel, useApprovals, useRecording, captureErrorMessage, useLiveTranscript, groupTranscript, formatCallDuration, useTranscript, findInText,
|
|
4
|
+
import { usePoolse, useMembers, rankMentionGroups, useUser, agentFromWire, mentionGroupMeta, useRecordingPlayback, silencesOf, silencesFromSegments, activeSegmentIndex, chapterIndexAt, meetingsErrorMessage, PLAYBACK_RATES, formatClock, speakerName, useMe, useConversations, slashQuery, filterSlashCommands, useAttachmentUpload, FORMAT_ACTIONS, skipSilenceTarget, filterConversations, useConversation, usePresence, useUserPresence, useAgent, useMessages, useTyping, useMessageStreams, useRealtimeStatus, isMessageVisibleTo, receiptsOf, computeGroupPosition, sameDay, formatDayLabel, applySlashCommand, formatForShortcut, applyFormat, readDlpError, useCustomEmoji, searchCustomEmoji, customEmojiToken, useOptionalPoolse, canEditOwnMessage, useLiveCall, recordingNoticeDisplayFor, callLogDisplayFor, parseCallSummary, useThreadFollow, useThread, usePresenceMany, findCustomEmoji, parseCustomEmojiToken, formatCallLogPreview, formatRecordingNoticePreview, formatCallSummaryPreview, ApiError, messageAgent, useReactions, clipOf, citationsOf, approvalIdOf, useCallSummary, summaryStyleLabel, summaryStatusText, formatDue, momentOf, useAttachmentUrl, useClip, useRecordingUrl, formatTimeRange, citationLabel, useApproval, approvalStatusLabel, APPROVAL_REASON_MAX, approvalErrorMessage, callAgentStateOf, callAgentStateLabel, callAgentModeLabel, whisperHintKindLabel, whisperErrorMessage, escalationStatusLabel, ESCALATION_ANSWER_MAX, escalationErrorMessage, useEscalations, useAskMeetings, ASK_QUESTION_MAX, captureLabel, useApprovals, useRecording, captureErrorMessage, useLiveTranscript, groupTranscript, formatCallDuration, useTranscript, findInText, waveformBars, playbackRateLabel, nextPlaybackRate } from '@poolse/react';
|
|
5
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
import ReactMarkdown3 from 'react-markdown';
|
|
7
7
|
import remarkGfm3 from 'remark-gfm';
|
|
@@ -1502,6 +1502,8 @@ function Avatar({
|
|
|
1502
1502
|
className
|
|
1503
1503
|
}) {
|
|
1504
1504
|
const initials = computeInitials(name);
|
|
1505
|
+
const [failedSrc, setFailedSrc] = useState(null);
|
|
1506
|
+
const showImage = !!src && failedSrc !== src;
|
|
1505
1507
|
const classes = [
|
|
1506
1508
|
"poolse-avatar",
|
|
1507
1509
|
size !== "md" ? `poolse-avatar--${size}` : null,
|
|
@@ -1509,7 +1511,7 @@ function Avatar({
|
|
|
1509
1511
|
className
|
|
1510
1512
|
].filter(Boolean).join(" ");
|
|
1511
1513
|
const label = agent ? `${name ?? "Agent"} (agent)` : name ?? "avatar";
|
|
1512
|
-
const badge = presence === true ? userId ? /* @__PURE__ */ jsx(
|
|
1514
|
+
const badge = presence === true ? userId ? /* @__PURE__ */ jsx(OptionalLivePresenceBadge, { userId, size }) : null : presence ? typeof presence === "string" ? /* @__PURE__ */ jsx(PresenceBadge, { state: presence, size, className: "poolse-avatar__badge" }) : /* @__PURE__ */ jsx(
|
|
1513
1515
|
PresenceBadge,
|
|
1514
1516
|
{
|
|
1515
1517
|
state: presence.state,
|
|
@@ -1519,11 +1521,14 @@ function Avatar({
|
|
|
1519
1521
|
}
|
|
1520
1522
|
) : online ? /* @__PURE__ */ jsx("span", { className: "poolse-avatar__presence", "aria-hidden": "true" }) : null;
|
|
1521
1523
|
return /* @__PURE__ */ jsxs("span", { className: classes, "aria-label": label, role: "img", children: [
|
|
1522
|
-
|
|
1524
|
+
showImage ? /* @__PURE__ */ jsx("img", { src, alt: name ?? "", onError: () => setFailedSrc(src) }) : /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: initials }),
|
|
1523
1525
|
agent && size !== "xs" ? /* @__PURE__ */ jsx("span", { className: "poolse-avatar__agent", "aria-hidden": "true" }) : null,
|
|
1524
1526
|
badge
|
|
1525
1527
|
] });
|
|
1526
1528
|
}
|
|
1529
|
+
function OptionalLivePresenceBadge(props) {
|
|
1530
|
+
return useOptionalPoolse() ? /* @__PURE__ */ jsx(LivePresenceBadge, { ...props }) : null;
|
|
1531
|
+
}
|
|
1527
1532
|
function LivePresenceBadge({ userId, size }) {
|
|
1528
1533
|
const presence = useUserPresence(userId);
|
|
1529
1534
|
if (!presence) return null;
|
|
@@ -2294,6 +2299,8 @@ var MentionInput = forwardRef(
|
|
|
2294
2299
|
addFiles,
|
|
2295
2300
|
getText: () => valueRef.current,
|
|
2296
2301
|
setText: (text) => setValue(text),
|
|
2302
|
+
insertText: (text) => setValue((v) => insertAtCaret(v, text, taRef)),
|
|
2303
|
+
clear: () => setValue(""),
|
|
2297
2304
|
focus: () => taRef.current?.focus()
|
|
2298
2305
|
}),
|
|
2299
2306
|
[addFiles]
|
|
@@ -2341,11 +2348,11 @@ var MentionInput = forwardRef(
|
|
|
2341
2348
|
...replyingTo ? { quoted_message_id: replyingTo.id } : {},
|
|
2342
2349
|
...hasReady ? { attachment_ids: ready.map((it) => it.attachment.id) } : {}
|
|
2343
2350
|
};
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
(
|
|
2347
|
-
);
|
|
2348
|
-
if (!sent) return;
|
|
2351
|
+
let kept = false;
|
|
2352
|
+
const sent = await dlp.guard(trimmed, async (ack) => {
|
|
2353
|
+
if (await onSend(ack ? { ...req, dlp_acknowledged: true } : req) === false) kept = true;
|
|
2354
|
+
});
|
|
2355
|
+
if (!sent || kept) return;
|
|
2349
2356
|
setValue("");
|
|
2350
2357
|
selectedMentions.current = /* @__PURE__ */ new Map();
|
|
2351
2358
|
for (const it of ready) uploads.remove(it.localId);
|
|
@@ -2725,6 +2732,8 @@ var MessageComposer = forwardRef(
|
|
|
2725
2732
|
addFiles,
|
|
2726
2733
|
getText: () => valueRef.current,
|
|
2727
2734
|
setText: (text) => setValue(text),
|
|
2735
|
+
insertText: (text) => setValue((v) => insertAtCaret(v, text, taRef)),
|
|
2736
|
+
clear: () => setValue(""),
|
|
2728
2737
|
focus: () => taRef.current?.focus()
|
|
2729
2738
|
}),
|
|
2730
2739
|
[addFiles]
|
|
@@ -2739,15 +2748,21 @@ var MessageComposer = forwardRef(
|
|
|
2739
2748
|
...hasReady ? { attachment_ids: ready.map((it) => it.attachment.id) } : {}
|
|
2740
2749
|
};
|
|
2741
2750
|
setValue("");
|
|
2742
|
-
for (const it of ready) uploads.remove(it.localId);
|
|
2743
|
-
uploads.clearRejected();
|
|
2744
2751
|
setSending(true);
|
|
2745
2752
|
try {
|
|
2746
|
-
|
|
2753
|
+
let kept = false;
|
|
2754
|
+
const sent = await dlp.guard(trimmed, async (ack) => {
|
|
2747
2755
|
const o = ack ? { ...opts, dlp_acknowledged: true } : opts;
|
|
2748
|
-
|
|
2756
|
+
if (await onSend(trimmed, Object.keys(o).length > 0 ? o : void 0) === false) {
|
|
2757
|
+
kept = true;
|
|
2758
|
+
}
|
|
2749
2759
|
});
|
|
2750
|
-
if (
|
|
2760
|
+
if (sent && !kept) {
|
|
2761
|
+
for (const it of ready) uploads.remove(it.localId);
|
|
2762
|
+
uploads.clearRejected();
|
|
2763
|
+
} else {
|
|
2764
|
+
setValue((now) => now ? now : trimmed);
|
|
2765
|
+
}
|
|
2751
2766
|
} finally {
|
|
2752
2767
|
setSending(false);
|
|
2753
2768
|
}
|
|
@@ -5670,7 +5685,11 @@ function ThreadView({
|
|
|
5670
5685
|
maxFileSize,
|
|
5671
5686
|
acceptFileTypes,
|
|
5672
5687
|
follow = true,
|
|
5673
|
-
alsoSendToChannel = true
|
|
5688
|
+
alsoSendToChannel = true,
|
|
5689
|
+
composerProps,
|
|
5690
|
+
composerAccessory,
|
|
5691
|
+
composerHandle,
|
|
5692
|
+
beforeSend
|
|
5674
5693
|
}) {
|
|
5675
5694
|
const { me } = useMe();
|
|
5676
5695
|
const followState = useThreadFollow(follow ? rootMessage.id : null);
|
|
@@ -5693,6 +5712,18 @@ function ThreadView({
|
|
|
5693
5712
|
const closeBtnRef = useRef(null);
|
|
5694
5713
|
const lastReplyIdRef = useRef(null);
|
|
5695
5714
|
const composerRef = useRef(null);
|
|
5715
|
+
useImperativeHandle(
|
|
5716
|
+
composerHandle,
|
|
5717
|
+
() => ({
|
|
5718
|
+
addFiles: (files) => composerRef.current?.addFiles(files),
|
|
5719
|
+
getText: () => composerRef.current?.getText() ?? "",
|
|
5720
|
+
setText: (text) => composerRef.current?.setText(text),
|
|
5721
|
+
insertText: (text) => composerRef.current?.insertText(text),
|
|
5722
|
+
clear: () => composerRef.current?.clear(),
|
|
5723
|
+
focus: () => composerRef.current?.focus()
|
|
5724
|
+
}),
|
|
5725
|
+
[]
|
|
5726
|
+
);
|
|
5696
5727
|
const [dragActive, setDragActive] = useState(false);
|
|
5697
5728
|
const dragDepthRef = useRef(0);
|
|
5698
5729
|
const isFileDrag = (e) => Array.from(e.dataTransfer?.types ?? []).includes("Files");
|
|
@@ -5816,22 +5847,31 @@ function ThreadView({
|
|
|
5816
5847
|
error.message
|
|
5817
5848
|
] })
|
|
5818
5849
|
] }),
|
|
5850
|
+
composerAccessory,
|
|
5819
5851
|
/* @__PURE__ */ jsx(
|
|
5820
5852
|
MessageComposer,
|
|
5821
5853
|
{
|
|
5822
5854
|
ref: composerRef,
|
|
5823
5855
|
onSend: async (body, opts) => {
|
|
5824
|
-
|
|
5856
|
+
let draft = {
|
|
5825
5857
|
body,
|
|
5826
5858
|
...opts?.attachment_ids && opts.attachment_ids.length > 0 ? { attachment_ids: opts.attachment_ids } : {},
|
|
5827
5859
|
...opts?.dlp_acknowledged ? { dlp_acknowledged: true } : {},
|
|
5828
5860
|
...alsoSendToChannel && alsoToChannel ? { also_send_to_channel: true } : {}
|
|
5829
|
-
}
|
|
5861
|
+
};
|
|
5862
|
+
if (beforeSend) {
|
|
5863
|
+
const changed = await beforeSend(draft);
|
|
5864
|
+
if (changed === false) return false;
|
|
5865
|
+
draft = changed;
|
|
5866
|
+
}
|
|
5867
|
+
await sendReply(draft);
|
|
5830
5868
|
setAlsoToChannel(false);
|
|
5869
|
+
return void 0;
|
|
5831
5870
|
},
|
|
5832
5871
|
placeholder: "Reply in thread\u2026",
|
|
5833
5872
|
...maxFileSize !== void 0 ? { maxFileSize } : {},
|
|
5834
|
-
...acceptFileTypes ? { acceptFileTypes } : {}
|
|
5873
|
+
...acceptFileTypes ? { acceptFileTypes } : {},
|
|
5874
|
+
...composerProps
|
|
5835
5875
|
}
|
|
5836
5876
|
),
|
|
5837
5877
|
alsoSendToChannel && /* @__PURE__ */ jsxs("label", { className: "poolse-thread__also", children: [
|
|
@@ -5941,7 +5981,11 @@ function ConversationView({
|
|
|
5941
5981
|
keymap: keymapOverrides,
|
|
5942
5982
|
sendOn = "enter",
|
|
5943
5983
|
keyboardShortcuts = TRUE,
|
|
5944
|
-
confirmDelete
|
|
5984
|
+
confirmDelete,
|
|
5985
|
+
composerProps,
|
|
5986
|
+
composerAccessory,
|
|
5987
|
+
composerHandle,
|
|
5988
|
+
beforeSend
|
|
5945
5989
|
}) {
|
|
5946
5990
|
usePoolseFonts(loadFonts);
|
|
5947
5991
|
const showComposer = composer && !readOnly;
|
|
@@ -6344,6 +6388,18 @@ function ConversationView({
|
|
|
6344
6388
|
highlightRow(el);
|
|
6345
6389
|
};
|
|
6346
6390
|
const composerRef = useRef(null);
|
|
6391
|
+
useImperativeHandle(
|
|
6392
|
+
composerHandle,
|
|
6393
|
+
() => ({
|
|
6394
|
+
addFiles: (files) => composerRef.current?.addFiles(files),
|
|
6395
|
+
getText: () => composerRef.current?.getText() ?? "",
|
|
6396
|
+
setText: (text) => composerRef.current?.setText(text),
|
|
6397
|
+
insertText: (text) => composerRef.current?.insertText(text),
|
|
6398
|
+
clear: () => composerRef.current?.clear(),
|
|
6399
|
+
focus: () => composerRef.current?.focus()
|
|
6400
|
+
}),
|
|
6401
|
+
[]
|
|
6402
|
+
);
|
|
6347
6403
|
const [dragActive, setDragActive] = useState(false);
|
|
6348
6404
|
const dragDepthRef = useRef(0);
|
|
6349
6405
|
const isFileDrag = (e) => Array.from(e.dataTransfer?.types ?? []).includes("Files");
|
|
@@ -6373,7 +6429,13 @@ function ConversationView({
|
|
|
6373
6429
|
if (files.length > 0) composerRef.current?.addFiles(files);
|
|
6374
6430
|
};
|
|
6375
6431
|
const sendRequest = async (input) => {
|
|
6376
|
-
|
|
6432
|
+
let draft = { ...sendDefaults, ...input };
|
|
6433
|
+
if (beforeSend) {
|
|
6434
|
+
const changed = await beforeSend(draft);
|
|
6435
|
+
if (changed === false) return false;
|
|
6436
|
+
draft = changed;
|
|
6437
|
+
}
|
|
6438
|
+
const req = { ...draft, id: draft.id ?? safeUuid() };
|
|
6377
6439
|
try {
|
|
6378
6440
|
await send(req);
|
|
6379
6441
|
} catch (err) {
|
|
@@ -6486,20 +6548,30 @@ function ConversationView({
|
|
|
6486
6548
|
...maxFileSize !== void 0 ? { maxFileSize } : {},
|
|
6487
6549
|
...acceptFileTypes ? { acceptFileTypes } : {}
|
|
6488
6550
|
};
|
|
6551
|
+
const passThrough = {
|
|
6552
|
+
...composerProps,
|
|
6553
|
+
onValueChange: (text) => {
|
|
6554
|
+
onComposerChange(text);
|
|
6555
|
+
composerProps?.onValueChange?.(text);
|
|
6556
|
+
},
|
|
6557
|
+
onTyping: () => {
|
|
6558
|
+
signalTyping();
|
|
6559
|
+
composerProps?.onTyping?.();
|
|
6560
|
+
},
|
|
6561
|
+
onEditLast: editLast
|
|
6562
|
+
};
|
|
6489
6563
|
const Composer = mentionComposer ? /* @__PURE__ */ jsx(
|
|
6490
6564
|
MentionInput,
|
|
6491
6565
|
{
|
|
6492
6566
|
ref: composerRef,
|
|
6493
|
-
onValueChange: onComposerChange,
|
|
6494
6567
|
conversationId,
|
|
6495
6568
|
onSend: onSendWithMentions,
|
|
6496
|
-
onTyping: signalTyping,
|
|
6497
6569
|
keymap: keymap.composer,
|
|
6498
|
-
onEditLast: editLast,
|
|
6499
6570
|
attachments,
|
|
6500
6571
|
emojiPicker,
|
|
6501
6572
|
...attachmentRules,
|
|
6502
6573
|
...labelFor ? { labelFor } : {},
|
|
6574
|
+
...passThrough,
|
|
6503
6575
|
...canQuote ? { replyingTo, onCancelReply: () => setReplyingTo(null) } : {}
|
|
6504
6576
|
},
|
|
6505
6577
|
conversationId
|
|
@@ -6507,15 +6579,13 @@ function ConversationView({
|
|
|
6507
6579
|
MessageComposer,
|
|
6508
6580
|
{
|
|
6509
6581
|
ref: composerRef,
|
|
6510
|
-
onValueChange: onComposerChange,
|
|
6511
6582
|
onSend: onSendBody,
|
|
6512
|
-
onTyping: signalTyping,
|
|
6513
6583
|
keymap: keymap.composer,
|
|
6514
|
-
onEditLast: editLast,
|
|
6515
6584
|
attachments,
|
|
6516
6585
|
emojiPicker,
|
|
6517
6586
|
...attachmentRules,
|
|
6518
6587
|
...labelFor ? { labelFor } : {},
|
|
6588
|
+
...passThrough,
|
|
6519
6589
|
...canQuote ? { replyingTo, onCancelReply: () => setReplyingTo(null) } : {}
|
|
6520
6590
|
},
|
|
6521
6591
|
conversationId
|
|
@@ -6748,7 +6818,10 @@ function ConversationView({
|
|
|
6748
6818
|
}
|
|
6749
6819
|
),
|
|
6750
6820
|
/* @__PURE__ */ jsx(TypingIndicator, { typing, ...labelFor ? { labelFor } : {} }),
|
|
6751
|
-
showComposer && /* @__PURE__ */ jsx("div", { className: "poolse-conversation__composer-row", children: /* @__PURE__ */
|
|
6821
|
+
showComposer && /* @__PURE__ */ jsx("div", { className: "poolse-conversation__composer-row", children: /* @__PURE__ */ jsxs("div", { className: "poolse-conversation__composer-flex", children: [
|
|
6822
|
+
composerAccessory,
|
|
6823
|
+
Composer
|
|
6824
|
+
] }) }),
|
|
6752
6825
|
dragActive && /* @__PURE__ */ jsx("div", { className: "poolse-conversation__drop-overlay", "aria-hidden": "true", children: /* @__PURE__ */ jsxs("div", { className: "poolse-conversation__drop-overlay-inner", children: [
|
|
6753
6826
|
/* @__PURE__ */ jsx(PoolseIcon, { name: "attachment", size: 40, label: null }),
|
|
6754
6827
|
/* @__PURE__ */ jsx("div", { className: "poolse-conversation__drop-overlay-title", children: "Drop files to upload" }),
|
|
@@ -6768,7 +6841,9 @@ function ConversationView({
|
|
|
6768
6841
|
showAvatars: showAvatarsResolved,
|
|
6769
6842
|
showPresence,
|
|
6770
6843
|
linkPreviews,
|
|
6771
|
-
...attachmentRules
|
|
6844
|
+
...attachmentRules,
|
|
6845
|
+
...composerProps ? { composerProps } : {},
|
|
6846
|
+
...beforeSend ? { beforeSend } : {}
|
|
6772
6847
|
}
|
|
6773
6848
|
) })
|
|
6774
6849
|
] }) });
|