@poolse/react-native 3.10.0 → 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/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { applySlashCommand, useUser, useRecordingPlayback, silencesOf, silencesFromSegments, activeSegmentIndex, chapterIndexAt, meetingsErrorMessage, skipSilenceTarget, formatClock, PLAYBACK_RATES, speakerName, useMe, useConversations, useUserPresence, formatCallLogPreview, formatRecordingNoticePreview, formatCallSummaryPreview, useAttachmentUpload, slashQuery, filterSlashCommands, FORMAT_ACTIONS, applyFormat, readDlpError, usePoolse, filterConversations, useConversation, useMembers, usePresence, receiptsOf, useMessages, useTyping, useMessageStreams, useRealtimeStatus, isMessageVisibleTo, computeGroupPosition, canEditOwnMessage, isTombstone, formatDayLabel, useCustomEmoji, customEmojiToken, searchCustomEmoji, recordingNoticeDisplayFor, callLogDisplayFor, parseCallSummary, useLiveCall, sameDay, rankMentionGroups, useReactions, messageAgent, clipOf, citationsOf, approvalIdOf, mentionGroupMeta, useThreadFollow, useThread, findCustomEmoji, useCallSummary, summaryStyleLabel, summaryStatusText, formatDue, momentOf, useAttachmentUrl, useClip, useRecordingUrl, formatTimeRange, citationLabel, useApproval, useAgent, approvalStatusLabel, APPROVAL_REASON_MAX, approvalErrorMessage, useAskMeetings, ASK_QUESTION_MAX, captureLabel, useApprovals, useLiveTranscript, groupTranscript, formatCallDuration, useTranscript, findInText, ApiError, captureErrorMessage, callAgentStateOf, callAgentStateLabel, callAgentModeLabel, whisperHintKindLabel, whisperErrorMessage, escalationStatusLabel, ESCALATION_ANSWER_MAX, escalationErrorMessage, useEscalations, useOptionalPoolse, waveformBars, playbackRateLabel, nextPlaybackRate } from '@poolse/react';
1
+ import { applySlashCommand, useUser, usePoolse, useMe, useMembers, rankMentionGroups, mentionGroupMeta, useRecordingPlayback, silencesOf, silencesFromSegments, activeSegmentIndex, chapterIndexAt, meetingsErrorMessage, skipSilenceTarget, formatClock, PLAYBACK_RATES, speakerName, useConversations, useUserPresence, formatCallLogPreview, formatRecordingNoticePreview, formatCallSummaryPreview, useAttachmentUpload, slashQuery, filterSlashCommands, FORMAT_ACTIONS, applyFormat, readDlpError, filterConversations, useConversation, usePresence, receiptsOf, useMessages, useTyping, useMessageStreams, useRealtimeStatus, isMessageVisibleTo, computeGroupPosition, canEditOwnMessage, isTombstone, formatDayLabel, useCustomEmoji, customEmojiToken, searchCustomEmoji, useOptionalPoolse, recordingNoticeDisplayFor, callLogDisplayFor, parseCallSummary, useLiveCall, sameDay, useReactions, messageAgent, clipOf, citationsOf, approvalIdOf, useThreadFollow, useThread, findCustomEmoji, useCallSummary, summaryStyleLabel, summaryStatusText, formatDue, momentOf, useAttachmentUrl, useClip, useRecordingUrl, formatTimeRange, citationLabel, useApproval, useAgent, approvalStatusLabel, APPROVAL_REASON_MAX, approvalErrorMessage, useAskMeetings, ASK_QUESTION_MAX, captureLabel, useApprovals, useLiveTranscript, groupTranscript, formatCallDuration, useTranscript, findInText, ApiError, captureErrorMessage, callAgentStateOf, callAgentStateLabel, callAgentModeLabel, whisperHintKindLabel, whisperErrorMessage, escalationStatusLabel, ESCALATION_ANSWER_MAX, escalationErrorMessage, useEscalations, useBreakouts, waveformBars, playbackRateLabel, nextPlaybackRate } from '@poolse/react';
2
2
  import { createContext, forwardRef, useRef, useState, useImperativeHandle, useEffect, useMemo, useCallback, useContext, createElement } from 'react';
3
- import { StyleSheet, View, Pressable, TextInput, Text, Switch, ScrollView, useWindowDimensions, Animated, Easing, PanResponder, Keyboard, Platform, Modal, AppState, ActivityIndicator, SectionList, FlatList, KeyboardAvoidingView, Image, AccessibilityInfo, Linking, useColorScheme } from 'react-native';
3
+ import { StyleSheet, View, Pressable, TextInput, Text, ScrollView, Switch, useWindowDimensions, Animated, Easing, PanResponder, Keyboard, Platform, Modal, Image, AppState, ActivityIndicator, SectionList, FlatList, KeyboardAvoidingView, Alert, AccessibilityInfo, Linking, useColorScheme } from 'react-native';
4
4
  import { toNativeTheme, isBuiltInThemeId } from '@poolse/theme';
5
5
  export { BUILT_IN_THEME_IDS, DEFAULT_THEME_ID, createTheme, decodeTheme, encodeTheme, tokensFromFlat } from '@poolse/theme';
6
6
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
@@ -825,6 +825,7 @@ function Avatar({
825
825
  const theme = useTheme();
826
826
  const dim = SIZES[size];
827
827
  const initials = computeInitials(name);
828
+ const [failedSrc, setFailedSrc] = useState(null);
828
829
  const tint = seed ? userColor(seed) : theme.colors.accent;
829
830
  const fontSize = size === "xs" ? 9 : size === "sm" ? 11 : size === "lg" ? 22 : 15;
830
831
  const badgeSize = Math.max(8, Math.round(dim * 0.32));
@@ -846,10 +847,11 @@ function Avatar({
846
847
  accessibilityRole: "image",
847
848
  accessibilityLabel: agent ? `${name ?? "Agent"} (agent)` : name ?? "avatar",
848
849
  children: [
849
- src ? /* @__PURE__ */ jsx(
850
+ src && failedSrc !== src ? /* @__PURE__ */ jsx(
850
851
  Image,
851
852
  {
852
853
  source: { uri: src },
854
+ onError: () => setFailedSrc(src),
853
855
  style: { width: dim, height: dim, borderRadius: radius },
854
856
  accessible: false
855
857
  }
@@ -879,7 +881,7 @@ function Avatar({
879
881
  ]
880
882
  }
881
883
  ) : null,
882
- lookupId ? /* @__PURE__ */ jsx(LivePresenceBadge, { id: lookupId, size: badgeSize, style: badgeStyle }) : presence && presence !== true ? /* @__PURE__ */ jsx(
884
+ lookupId ? /* @__PURE__ */ jsx(OptionalLivePresenceBadge, { id: lookupId, size: badgeSize, style: badgeStyle }) : presence && presence !== true ? /* @__PURE__ */ jsx(
883
885
  PresenceBadge,
884
886
  {
885
887
  state: presence,
@@ -906,6 +908,9 @@ function Avatar({
906
908
  }
907
909
  );
908
910
  }
911
+ function OptionalLivePresenceBadge(props) {
912
+ return useOptionalPoolse() ? /* @__PURE__ */ jsx(LivePresenceBadge, { ...props }) : null;
913
+ }
909
914
  function LivePresenceBadge({
910
915
  id,
911
916
  size,
@@ -3269,6 +3274,17 @@ var MessageComposer = forwardRef(
3269
3274
  if (!controlled) setInnerValue("");
3270
3275
  onChangeTextRef.current?.("");
3271
3276
  },
3277
+ getText: () => valueRef.current,
3278
+ setText: (text) => setValueRef.current(text),
3279
+ insertText: (text) => {
3280
+ const now = valueRef.current;
3281
+ const sel = selectionRef.current ?? { start: now.length, end: now.length };
3282
+ const caret = sel.start + text.length;
3283
+ applyTextRef.current(now.slice(0, sel.start) + text + now.slice(sel.end), {
3284
+ start: caret,
3285
+ end: caret
3286
+ });
3287
+ },
3272
3288
  setSelection: (start, end) => {
3273
3289
  selectionRef.current = { start, end };
3274
3290
  inputRef.current?.setSelection?.(start, end);
@@ -3303,14 +3319,19 @@ var MessageComposer = forwardRef(
3303
3319
  const replyId = replyingTo?.id;
3304
3320
  const attachmentIds = readyAttachmentIds;
3305
3321
  setDraft("");
3306
- upload.reset();
3307
3322
  const opts = {
3308
3323
  ...replyId ? { quoted_message_id: replyId } : {},
3309
3324
  ...attachmentIds.length > 0 ? { attachment_ids: attachmentIds } : {}
3310
3325
  };
3311
3326
  try {
3312
- await onSend(body, opts);
3327
+ if (await onSend(body, opts) === false) {
3328
+ if (!controlled) setInnerValue((now) => now ? now : body);
3329
+ else onChangeTextRef.current?.(body);
3330
+ return;
3331
+ }
3332
+ upload.reset();
3313
3333
  } catch (err) {
3334
+ upload.reset();
3314
3335
  const outcome = readDlpError(err);
3315
3336
  if (outcome) setDlp({ outcome, body, opts });
3316
3337
  if (!controlled) setInnerValue((now) => now ? now : body);
@@ -3331,6 +3352,12 @@ var MessageComposer = forwardRef(
3331
3352
  setCursor(sel.end);
3332
3353
  setTimeout(() => inputRef.current?.setSelection?.(sel.start, sel.end), 0);
3333
3354
  };
3355
+ const valueRef = useRef(value);
3356
+ valueRef.current = value;
3357
+ const setValueRef = useRef(setValue);
3358
+ setValueRef.current = setValue;
3359
+ const applyTextRef = useRef(applyText);
3360
+ applyTextRef.current = applyText;
3334
3361
  const format2 = (kind) => {
3335
3362
  const sel = selectionRef.current ?? { start: value.length, end: value.length };
3336
3363
  const r = applyFormat(value, sel, kind);
@@ -3619,129 +3646,146 @@ var styles15 = StyleSheet.create({
3619
3646
  padding: 6
3620
3647
  }
3621
3648
  });
3622
- function MentionInput({
3623
- conversationId,
3624
- onSend,
3625
- maxSuggestions = 6,
3626
- labelFor,
3627
- value: valueProp,
3628
- onChangeText,
3629
- onSelectionChange,
3630
- groups,
3631
- ...composerProps
3632
- }) {
3633
- const theme = useTheme();
3634
- const chat = usePoolse();
3635
- const { me } = useMe();
3636
- const { members } = useMembers(conversationId);
3637
- const composerRef = useRef(null);
3638
- const [innerText, setInnerText] = useState("");
3639
- const text = valueProp ?? innerText;
3640
- const [cursor, setCursor] = useState(0);
3641
- const [dismissedAt, setDismissedAt] = useState(null);
3642
- const pickedRef = useRef([]);
3643
- const setText = (next) => {
3644
- if (valueProp === void 0) setInnerText(next);
3645
- onChangeText?.(next);
3646
- };
3647
- const query = useMemo(() => {
3648
- const q = activeMentionQuery(text, cursor);
3649
- return q && q.start !== dismissedAt ? q : null;
3650
- }, [text, cursor, dismissedAt]);
3651
- const candidates = useMemo(() => {
3652
- if (!query) return [];
3653
- const all = members.filter((m) => m.user_id !== me?.id).map((m) => ({
3654
- member: m,
3655
- externalId: m.external_id,
3656
- label: labelFor?.(m.external_id) ?? chat.users.peek(m.external_id)?.displayName ?? m.external_id
3657
- }));
3658
- return filterMentionCandidates(all, query.query, maxSuggestions);
3659
- }, [query, members, me?.id, labelFor, chat, maxSuggestions]);
3660
- const groupMatches = useMemo(
3661
- () => query && groups ? rankMentionGroups(groups, query.query, Math.max(0, maxSuggestions - candidates.length)) : [],
3662
- [query, groups, maxSuggestions, candidates.length]
3663
- );
3664
- const pickGroup = (g) => {
3665
- if (!query) return;
3666
- const next = insertMention(text, query.start, cursor, g.handle);
3667
- setText(next.text);
3668
- setCursor(next.cursor);
3669
- setTimeout(() => composerRef.current?.setSelection(next.cursor, next.cursor), 0);
3670
- };
3671
- const pick = (c) => {
3672
- if (!query) return;
3673
- const next = insertMention(text, query.start, cursor, c.label);
3674
- pickedRef.current = [...pickedRef.current, { userId: c.member.user_id, label: c.label }];
3675
- setText(next.text);
3676
- setCursor(next.cursor);
3677
- setTimeout(() => composerRef.current?.setSelection(next.cursor, next.cursor), 0);
3678
- };
3679
- const handleSend = async (body, opts) => {
3680
- const mentions = mentionedUserIds(body, pickedRef.current);
3681
- await onSend(body, { ...opts, ...mentions.length > 0 ? { mentions } : {} });
3682
- pickedRef.current = [];
3683
- };
3684
- const suggestions = query && candidates.length + groupMatches.length > 0 ? /* @__PURE__ */ jsxs(
3685
- View,
3686
- {
3687
- style: [
3688
- styles16.suggestions,
3689
- {
3690
- backgroundColor: theme.colors.surface,
3691
- borderColor: theme.colors.border,
3692
- borderRadius: theme.radii.md
3693
- },
3694
- theme.shadows.md
3695
- ],
3696
- accessibilityRole: "menu",
3697
- accessibilityLabel: "Mention suggestions",
3698
- children: [
3699
- /* @__PURE__ */ jsxs(ScrollView, { keyboardShouldPersistTaps: "always", style: styles16.suggestionScroll, children: [
3700
- candidates.map((c) => /* @__PURE__ */ jsx(
3701
- MentionRow,
3702
- {
3703
- externalId: c.externalId,
3704
- label: c.label,
3705
- onPress: () => pick(c)
3706
- },
3707
- c.member.user_id
3708
- )),
3709
- groupMatches.map((g) => /* @__PURE__ */ jsx(GroupRow, { group: g, onPress: () => pickGroup(g) }, `group:${g.handle}`))
3710
- ] }),
3711
- /* @__PURE__ */ jsx(
3712
- Pressable,
3649
+ var MentionInput = forwardRef(
3650
+ function MentionInput2({
3651
+ conversationId,
3652
+ onSend,
3653
+ maxSuggestions = 6,
3654
+ labelFor,
3655
+ value: valueProp,
3656
+ onChangeText,
3657
+ onSelectionChange,
3658
+ groups,
3659
+ ...composerProps
3660
+ }, ref) {
3661
+ const theme = useTheme();
3662
+ const chat = usePoolse();
3663
+ const { me } = useMe();
3664
+ const { members } = useMembers(conversationId);
3665
+ const composerRef = useRef(null);
3666
+ useImperativeHandle(
3667
+ ref,
3668
+ () => ({
3669
+ addFiles: (inputs) => composerRef.current?.addFiles(inputs),
3670
+ focus: () => composerRef.current?.focus(),
3671
+ clear: () => composerRef.current?.clear(),
3672
+ getText: () => composerRef.current?.getText() ?? "",
3673
+ setText: (t) => composerRef.current?.setText(t),
3674
+ insertText: (t) => composerRef.current?.insertText(t),
3675
+ setSelection: (start, end) => composerRef.current?.setSelection(start, end)
3676
+ }),
3677
+ []
3678
+ );
3679
+ const [innerText, setInnerText] = useState("");
3680
+ const text = valueProp ?? innerText;
3681
+ const [cursor, setCursor] = useState(0);
3682
+ const [dismissedAt, setDismissedAt] = useState(null);
3683
+ const pickedRef = useRef([]);
3684
+ const setText = (next) => {
3685
+ if (valueProp === void 0) setInnerText(next);
3686
+ onChangeText?.(next);
3687
+ };
3688
+ const query = useMemo(() => {
3689
+ const q = activeMentionQuery(text, cursor);
3690
+ return q && q.start !== dismissedAt ? q : null;
3691
+ }, [text, cursor, dismissedAt]);
3692
+ const candidates = useMemo(() => {
3693
+ if (!query) return [];
3694
+ const all = members.filter((m) => m.user_id !== me?.id).map((m) => ({
3695
+ member: m,
3696
+ externalId: m.external_id,
3697
+ label: labelFor?.(m.external_id) ?? chat.users.peek(m.external_id)?.displayName ?? m.external_id
3698
+ }));
3699
+ return filterMentionCandidates(all, query.query, maxSuggestions);
3700
+ }, [query, members, me?.id, labelFor, chat, maxSuggestions]);
3701
+ const groupMatches = useMemo(
3702
+ () => query && groups ? rankMentionGroups(groups, query.query, Math.max(0, maxSuggestions - candidates.length)) : [],
3703
+ [query, groups, maxSuggestions, candidates.length]
3704
+ );
3705
+ const pickGroup = (g) => {
3706
+ if (!query) return;
3707
+ const next = insertMention(text, query.start, cursor, g.handle);
3708
+ setText(next.text);
3709
+ setCursor(next.cursor);
3710
+ setTimeout(() => composerRef.current?.setSelection(next.cursor, next.cursor), 0);
3711
+ };
3712
+ const pick = (c) => {
3713
+ if (!query) return;
3714
+ const next = insertMention(text, query.start, cursor, c.label);
3715
+ pickedRef.current = [...pickedRef.current, { userId: c.member.user_id, label: c.label }];
3716
+ setText(next.text);
3717
+ setCursor(next.cursor);
3718
+ setTimeout(() => composerRef.current?.setSelection(next.cursor, next.cursor), 0);
3719
+ };
3720
+ const handleSend = async (body, opts) => {
3721
+ const mentions = mentionedUserIds(body, pickedRef.current);
3722
+ const result = await onSend(body, { ...opts, ...mentions.length > 0 ? { mentions } : {} });
3723
+ if (result === false) return false;
3724
+ pickedRef.current = [];
3725
+ return void 0;
3726
+ };
3727
+ const suggestions = query && candidates.length + groupMatches.length > 0 ? /* @__PURE__ */ jsxs(
3728
+ View,
3729
+ {
3730
+ style: [
3731
+ styles16.suggestions,
3713
3732
  {
3714
- onPress: () => setDismissedAt(query.start),
3715
- style: styles16.dismiss,
3716
- accessibilityRole: "button",
3717
- accessibilityLabel: "Dismiss suggestions",
3718
- hitSlop: 6,
3719
- children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 14, color: theme.colors.textSubtle, label: null })
3720
- }
3721
- )
3722
- ]
3723
- }
3724
- ) : null;
3725
- return /* @__PURE__ */ jsx(
3726
- MessageComposer,
3727
- {
3728
- ref: composerRef,
3729
- ...composerProps,
3730
- ...labelFor ? { labelFor } : {},
3731
- value: text,
3732
- onChangeText: (next) => {
3733
- setText(next);
3734
- if (dismissedAt !== null && !next.includes("@", dismissedAt)) setDismissedAt(null);
3735
- },
3736
- onSelectionChange: (sel) => {
3737
- setCursor(sel.end);
3738
- onSelectionChange?.(sel);
3739
- },
3740
- onSend: handleSend,
3741
- accessory: suggestions
3742
- }
3743
- );
3744
- }
3733
+ backgroundColor: theme.colors.surface,
3734
+ borderColor: theme.colors.border,
3735
+ borderRadius: theme.radii.md
3736
+ },
3737
+ theme.shadows.md
3738
+ ],
3739
+ accessibilityRole: "menu",
3740
+ accessibilityLabel: "Mention suggestions",
3741
+ children: [
3742
+ /* @__PURE__ */ jsxs(ScrollView, { keyboardShouldPersistTaps: "always", style: styles16.suggestionScroll, children: [
3743
+ candidates.map((c) => /* @__PURE__ */ jsx(
3744
+ MentionRow,
3745
+ {
3746
+ externalId: c.externalId,
3747
+ label: c.label,
3748
+ onPress: () => pick(c)
3749
+ },
3750
+ c.member.user_id
3751
+ )),
3752
+ groupMatches.map((g) => /* @__PURE__ */ jsx(GroupRow, { group: g, onPress: () => pickGroup(g) }, `group:${g.handle}`))
3753
+ ] }),
3754
+ /* @__PURE__ */ jsx(
3755
+ Pressable,
3756
+ {
3757
+ onPress: () => setDismissedAt(query.start),
3758
+ style: styles16.dismiss,
3759
+ accessibilityRole: "button",
3760
+ accessibilityLabel: "Dismiss suggestions",
3761
+ hitSlop: 6,
3762
+ children: /* @__PURE__ */ jsx(PoolseIcon, { name: "close", size: 14, color: theme.colors.textSubtle, label: null })
3763
+ }
3764
+ )
3765
+ ]
3766
+ }
3767
+ ) : null;
3768
+ return /* @__PURE__ */ jsx(
3769
+ MessageComposer,
3770
+ {
3771
+ ref: composerRef,
3772
+ ...composerProps,
3773
+ ...labelFor ? { labelFor } : {},
3774
+ value: text,
3775
+ onChangeText: (next) => {
3776
+ setText(next);
3777
+ if (dismissedAt !== null && !next.includes("@", dismissedAt)) setDismissedAt(null);
3778
+ },
3779
+ onSelectionChange: (sel) => {
3780
+ setCursor(sel.end);
3781
+ onSelectionChange?.(sel);
3782
+ },
3783
+ onSend: handleSend,
3784
+ accessory: suggestions
3785
+ }
3786
+ );
3787
+ }
3788
+ );
3745
3789
  function MentionRow({
3746
3790
  externalId,
3747
3791
  label,
@@ -3858,6 +3902,23 @@ var styles16 = StyleSheet.create({
3858
3902
  right: 8
3859
3903
  }
3860
3904
  });
3905
+ var alertConfirmDelete = () => new Promise((resolve) => {
3906
+ Alert.alert(
3907
+ "Delete message?",
3908
+ "It will be deleted for everyone.",
3909
+ [
3910
+ { text: "Cancel", style: "cancel", onPress: () => resolve(false) },
3911
+ { text: "Delete", style: "destructive", onPress: () => resolve(true) }
3912
+ ],
3913
+ { cancelable: true, onDismiss: () => resolve(false) }
3914
+ );
3915
+ });
3916
+
3917
+ // src/internal/confirmDelete.ts
3918
+ async function confirmThenDelete(msg, confirm, remove) {
3919
+ if (!await confirm(msg)) return;
3920
+ await remove(msg.id).catch(() => void 0);
3921
+ }
3861
3922
 
3862
3923
  // src/internal/messageFocus.ts
3863
3924
  function latestMarkableId(messages) {
@@ -7286,6 +7347,7 @@ function FlatMessageRow({
7286
7347
  isEditing = false,
7287
7348
  onStartEdit,
7288
7349
  onDelete,
7350
+ extraActions,
7289
7351
  onOpenThread,
7290
7352
  onQuote,
7291
7353
  labelFor,
@@ -7547,7 +7609,8 @@ function FlatMessageRow({
7547
7609
  onQuote,
7548
7610
  onMarkUnread,
7549
7611
  onRemoveLinkPreview,
7550
- linkPreviews
7612
+ linkPreviews,
7613
+ extraActions
7551
7614
  }
7552
7615
  ) : null;
7553
7616
  return /* @__PURE__ */ jsxs(
@@ -7724,7 +7787,8 @@ function MessageActions({
7724
7787
  pinned = false,
7725
7788
  onForward,
7726
7789
  onTranslate,
7727
- translated = false
7790
+ translated = false,
7791
+ extraActions = []
7728
7792
  }) {
7729
7793
  const theme = useTheme();
7730
7794
  const insets = useSafeInsets();
@@ -7754,6 +7818,14 @@ function MessageActions({
7754
7818
  });
7755
7819
  }
7756
7820
  }
7821
+ for (const a of extraActions) {
7822
+ items.push({
7823
+ label: a.label,
7824
+ icon: a.icon ?? "more-h",
7825
+ onPress: a.onPress,
7826
+ ...a.danger ? { danger: true } : {}
7827
+ });
7828
+ }
7757
7829
  if (isSelf && onEdit) items.push({ label: "Edit", icon: "edit", onPress: onEdit });
7758
7830
  if (isSelf && onDelete)
7759
7831
  items.push({ label: "Delete", icon: "trash", onPress: onDelete, danger: true });
@@ -7913,7 +7985,8 @@ function RowActionsSheet({
7913
7985
  onQuote,
7914
7986
  onMarkUnread,
7915
7987
  onRemoveLinkPreview,
7916
- linkPreviews
7988
+ linkPreviews,
7989
+ extraActions
7917
7990
  }) {
7918
7991
  const then = (fn) => () => {
7919
7992
  close();
@@ -7933,6 +8006,7 @@ function RowActionsSheet({
7933
8006
  ...threads && onOpenThread ? { onReplyInThread: then(onOpenThread) } : {},
7934
8007
  ...quotations && onQuote ? { onQuote: then(onQuote) } : {},
7935
8008
  ...onMarkUnread ? { onMarkUnread: then(onMarkUnread) } : {},
8009
+ ...extraActions && extraActions.length > 0 ? { extraActions: extraActions.map((a) => ({ ...a, onPress: then(a.onPress) })) } : {},
7936
8010
  ...onRemoveLinkPreview && previewUrls.length > 0 ? {
7937
8011
  previewUrls,
7938
8012
  onRemovePreview: (url) => {
@@ -8034,7 +8108,8 @@ function BubbleMessageRow({
8034
8108
  onMarkUnread,
8035
8109
  editHistory = true,
8036
8110
  onRetrySend,
8037
- onDiscardSend
8111
+ onDiscardSend,
8112
+ extraActions
8038
8113
  }) {
8039
8114
  const theme = useTheme();
8040
8115
  const isSelf = meId !== null && msg.sender_id === meId;
@@ -8291,7 +8366,8 @@ function BubbleMessageRow({
8291
8366
  onQuote,
8292
8367
  onMarkUnread,
8293
8368
  onRemoveLinkPreview,
8294
- linkPreviews
8369
+ linkPreviews,
8370
+ extraActions
8295
8371
  }
8296
8372
  ) : null
8297
8373
  ),
@@ -8417,7 +8493,8 @@ function ThreadView({
8417
8493
  showPresence = false,
8418
8494
  linkPreviews = true,
8419
8495
  follow = true,
8420
- alsoSendToChannel = true
8496
+ alsoSendToChannel = true,
8497
+ ...hooks
8421
8498
  }) {
8422
8499
  return /* @__PURE__ */ jsx(
8423
8500
  Modal,
@@ -8441,7 +8518,8 @@ function ThreadView({
8441
8518
  showPresence,
8442
8519
  linkPreviews,
8443
8520
  follow,
8444
- alsoSendToChannel
8521
+ alsoSendToChannel,
8522
+ hooks
8445
8523
  }
8446
8524
  ) })
8447
8525
  }
@@ -8459,7 +8537,8 @@ function ThreadSheet({
8459
8537
  showPresence,
8460
8538
  linkPreviews,
8461
8539
  follow,
8462
- alsoSendToChannel
8540
+ alsoSendToChannel,
8541
+ hooks
8463
8542
  }) {
8464
8543
  const theme = useTheme();
8465
8544
  const followState = useThreadFollow(follow ? rootMessage.id : null);
@@ -8503,9 +8582,8 @@ function ThreadSheet({
8503
8582
  quotations: false,
8504
8583
  isEditing: editingId === msg.id,
8505
8584
  ...canEdit ? { onStartEdit: () => setEditingId(msg.id) } : {},
8506
- onDelete: () => {
8507
- void deleteReply(msg.id);
8508
- },
8585
+ onDelete: () => void confirmThenDelete(msg, hooks.confirmDelete ?? alertConfirmDelete, deleteReply),
8586
+ ...hooks.extraActions ? { extraActions: hooks.extraActions(msg) } : {},
8509
8587
  ...labelFor ? { labelFor } : {},
8510
8588
  ...avatarFor ? { avatarFor } : {},
8511
8589
  ...layout ? { layout } : {},
@@ -8523,6 +8601,7 @@ function ThreadSheet({
8523
8601
  meId,
8524
8602
  editingId,
8525
8603
  deleteReply,
8604
+ hooks,
8526
8605
  labelFor,
8527
8606
  avatarFor,
8528
8607
  layout,
@@ -8668,20 +8747,30 @@ function ThreadSheet({
8668
8747
  }
8669
8748
  )
8670
8749
  ] }) : null,
8750
+ hooks.composerAccessory,
8671
8751
  /* @__PURE__ */ jsx(
8672
8752
  MessageComposer,
8673
8753
  {
8754
+ ref: hooks.composerHandle ?? null,
8674
8755
  onSend: async (body, opts) => {
8675
- await sendReply({
8756
+ let draft = {
8676
8757
  body,
8677
8758
  ...opts,
8678
8759
  ...alsoSendToChannel && alsoToChannel ? { also_send_to_channel: true } : {}
8679
- });
8760
+ };
8761
+ if (hooks.beforeSend) {
8762
+ const changed = await hooks.beforeSend(draft);
8763
+ if (changed === false) return false;
8764
+ draft = changed;
8765
+ }
8766
+ await sendReply(draft);
8680
8767
  setAlsoToChannel(false);
8768
+ return void 0;
8681
8769
  },
8682
8770
  placeholder: "Reply to thread\u2026",
8683
8771
  attachments: true,
8684
8772
  onAttachPress: () => setPickerOpen(true),
8773
+ ...hooks.composerProps,
8685
8774
  editingMessage,
8686
8775
  onCancelEdit: () => setEditingId(null),
8687
8776
  onSaveEdit: async (body) => {
@@ -9102,7 +9191,13 @@ function ConversationView({
9102
9191
  maxFileSize,
9103
9192
  acceptedFileTypes,
9104
9193
  markUnread = true,
9105
- onMarkedUnread
9194
+ onMarkedUnread,
9195
+ composerProps: appComposerProps,
9196
+ composerAccessory,
9197
+ composerHandle,
9198
+ beforeSend,
9199
+ extraActions,
9200
+ confirmDelete = alertConfirmDelete
9106
9201
  }) {
9107
9202
  const theme = useTheme();
9108
9203
  const chat = usePoolse();
@@ -9178,6 +9273,20 @@ function ConversationView({
9178
9273
  );
9179
9274
  const [draftFor, setDraftFor] = useState(conversationId);
9180
9275
  const [draftText, setDraftText] = useState(() => drafts.peek(conversationId)?.text ?? "");
9276
+ const composerRef = useRef(null);
9277
+ useImperativeHandle(
9278
+ composerHandle,
9279
+ () => ({
9280
+ addFiles: (inputs) => composerRef.current?.addFiles(inputs),
9281
+ focus: () => composerRef.current?.focus(),
9282
+ clear: () => composerRef.current?.clear(),
9283
+ getText: () => composerRef.current?.getText() ?? "",
9284
+ setText: (t) => composerRef.current?.setText(t),
9285
+ insertText: (t) => composerRef.current?.insertText(t),
9286
+ setSelection: (start, end) => composerRef.current?.setSelection(start, end)
9287
+ }),
9288
+ []
9289
+ );
9181
9290
  const [replyingTo, setReplyingTo] = useState(
9182
9291
  () => drafts.peek(conversationId)?.quote ?? null
9183
9292
  );
@@ -9440,7 +9549,8 @@ function ConversationView({
9440
9549
  ...readState ? { readState } : {},
9441
9550
  isEditing: editingId === msg.id,
9442
9551
  ...canEdit ? { onStartEdit: () => setEditingId(msg.id) } : {},
9443
- onDelete: () => deleteMsg(msg.id),
9552
+ onDelete: () => void confirmThenDelete(msg, confirmDelete, deleteMsg),
9553
+ ...extraActions ? { extraActions: extraActions(msg) } : {},
9444
9554
  ...threads ? { onOpenThread: () => setThreadRoot(msg) } : {},
9445
9555
  ...canQuote && !tombstone ? { onQuote: () => setReplyingTo(msg) } : {},
9446
9556
  onQuotedClick,
@@ -9482,6 +9592,8 @@ function ConversationView({
9482
9592
  threads,
9483
9593
  editingId,
9484
9594
  deleteMsg,
9595
+ confirmDelete,
9596
+ extraActions,
9485
9597
  labelFor,
9486
9598
  avatarFor,
9487
9599
  showSenderLabels,
@@ -9541,9 +9653,15 @@ function ConversationView({
9541
9653
  const composerProps = useMemo(
9542
9654
  () => ({
9543
9655
  onSend: async (body, opts) => {
9544
- const id = safeUuid();
9656
+ let draft = { body, ...opts };
9657
+ if (beforeSend) {
9658
+ const changed = await beforeSend(draft);
9659
+ if (changed === false) return false;
9660
+ draft = changed;
9661
+ }
9662
+ const id = draft.id ?? safeUuid();
9545
9663
  try {
9546
- await send({ body, ...opts, id });
9664
+ await send({ ...draft, id });
9547
9665
  } catch (err) {
9548
9666
  const kept = err instanceof MessageQueuedError || chat.outboxEnabled && !isQuoteGone(err);
9549
9667
  if (kept) {
@@ -9560,6 +9678,7 @@ function ConversationView({
9560
9678
  setReplyingTo(null);
9561
9679
  setAutoReadPaused(false);
9562
9680
  onSent?.(conversationId);
9681
+ return void 0;
9563
9682
  },
9564
9683
  value: draftText,
9565
9684
  onChangeText: (text) => {
@@ -9567,7 +9686,11 @@ function ConversationView({
9567
9686
  setDraftText(text);
9568
9687
  },
9569
9688
  emojiPicker,
9570
- onTyping: signalTyping,
9689
+ ...appComposerProps,
9690
+ onTyping: () => {
9691
+ signalTyping();
9692
+ appComposerProps?.onTyping?.();
9693
+ },
9571
9694
  ...attachments ? { onAttachPress: () => setPickerOpen(true) } : {},
9572
9695
  ...replyingTo ? { replyingTo } : {},
9573
9696
  onCancelReply: () => setReplyingTo(null),
@@ -9597,7 +9720,9 @@ function ConversationView({
9597
9720
  editingId,
9598
9721
  edit,
9599
9722
  draftText,
9600
- emojiPicker
9723
+ emojiPicker,
9724
+ beforeSend,
9725
+ appComposerProps
9601
9726
  ]
9602
9727
  );
9603
9728
  const headerNode = header === false ? null : header === true ? /* @__PURE__ */ jsx(
@@ -9737,7 +9862,8 @@ function ConversationView({
9737
9862
  }
9738
9863
  ) : null
9739
9864
  ] }),
9740
- !showComposer ? null : mentions ? /* @__PURE__ */ jsx(MentionInput, { conversationId, ...composerProps }) : /* @__PURE__ */ jsx(MessageComposer, { ...composerProps }),
9865
+ showComposer ? composerAccessory : null,
9866
+ !showComposer ? null : mentions ? /* @__PURE__ */ jsx(MentionInput, { ref: composerRef, conversationId, ...composerProps }) : /* @__PURE__ */ jsx(MessageComposer, { ref: composerRef, ...composerProps }),
9741
9867
  canAttach ? /* @__PURE__ */ jsx(
9742
9868
  AttachmentPicker,
9743
9869
  {
@@ -9761,7 +9887,11 @@ function ConversationView({
9761
9887
  ...timeFormat ? { timeFormat } : {},
9762
9888
  density,
9763
9889
  showPresence,
9764
- linkPreviews
9890
+ linkPreviews,
9891
+ confirmDelete,
9892
+ ...appComposerProps ? { composerProps: appComposerProps } : {},
9893
+ ...beforeSend ? { beforeSend } : {},
9894
+ ...extraActions ? { extraActions } : {}
9765
9895
  }
9766
9896
  ) : null
9767
9897
  ]
@@ -11969,11 +12099,13 @@ function QuestionsPanel({
11969
12099
  }
11970
12100
  function BreakoutBanner({
11971
12101
  breakouts,
11972
- inBreakout = false,
12102
+ inBreakout: inBreakoutProp,
11973
12103
  onJoined,
11974
12104
  onReturned,
11975
12105
  style
11976
12106
  }) {
12107
+ const native = "joinRoom" in breakouts ? breakouts : null;
12108
+ const inBreakout = inBreakoutProp ?? native?.inBreakout ?? false;
11977
12109
  const { theme, text, muted, card } = useText2();
11978
12110
  const s2 = breakouts.session;
11979
12111
  const room = breakouts.myRoom;
@@ -12005,6 +12137,7 @@ function BreakoutBanner({
12005
12137
  primary: true,
12006
12138
  disabled: breakouts.pending,
12007
12139
  onPress: async () => {
12140
+ if (native) return void await native.joinRoom(room.id);
12008
12141
  const session = await breakouts.join(room.id);
12009
12142
  if (session) onJoined?.(session);
12010
12143
  }
@@ -12016,6 +12149,7 @@ function BreakoutBanner({
12016
12149
  label: "Return to main",
12017
12150
  disabled: breakouts.pending,
12018
12151
  onPress: async () => {
12152
+ if (native) return void await native.returnToMainRoom();
12019
12153
  const session = await breakouts.returnToMain();
12020
12154
  if (session) onReturned?.(session);
12021
12155
  }
@@ -12025,6 +12159,39 @@ function BreakoutBanner({
12025
12159
  }
12026
12160
  );
12027
12161
  }
12162
+ function useNativeBreakouts(conversationId, callId, opts) {
12163
+ const optsRef = useRef(opts);
12164
+ optsRef.current = opts;
12165
+ const [inBreakout, setInBreakout] = useState(false);
12166
+ const move = useCallback(async (session, into) => {
12167
+ if (!session) return false;
12168
+ const ok = await optsRef.current.moveToRoom(session).catch(() => false);
12169
+ if (ok) setInBreakout(into);
12170
+ return ok;
12171
+ }, []);
12172
+ const breakouts = useBreakouts(conversationId, callId, {
12173
+ auto: opts.auto ?? true,
12174
+ onJoinRoom: (session, room) => {
12175
+ void move(session, true);
12176
+ optsRef.current.onJoinRoom?.(session, room);
12177
+ },
12178
+ onReturn: (session) => {
12179
+ void move(session, false);
12180
+ optsRef.current.onReturn?.(session);
12181
+ }
12182
+ });
12183
+ useEffect(() => setInBreakout(false), [callId]);
12184
+ const { join, returnToMain } = breakouts;
12185
+ const joinRoom = useCallback(
12186
+ async (roomId) => move(await join(roomId), true),
12187
+ [join, move]
12188
+ );
12189
+ const returnToMainRoom = useCallback(
12190
+ async () => move(await returnToMain(), false),
12191
+ [returnToMain, move]
12192
+ );
12193
+ return { ...breakouts, inBreakout, joinRoom, returnToMainRoom };
12194
+ }
12028
12195
  function LobbyWaiting({ name, status, title, onLeave, style }) {
12029
12196
  const { theme, text, muted } = useText2();
12030
12197
  const headline = status === "denied" ? "The host didn\u2019t let you in" : status === "ended" ? "This meeting has ended" : status === "admitted" ? "You\u2019re in \u2014 joining\u2026" : "Waiting for the host to let you in";
@@ -12719,14 +12886,56 @@ function WhiteboardView({
12719
12886
  }
12720
12887
  );
12721
12888
  }
12722
- function AnnotationOverlay({ state, style }) {
12889
+ function AnnotationOverlay({
12890
+ state,
12891
+ annotations,
12892
+ drawing = false,
12893
+ color = "#e5484d",
12894
+ style
12895
+ }) {
12723
12896
  const [box, setBox] = useState({ w: 0, h: 0 });
12897
+ const stroke = useRef(null);
12898
+ const canDraw = drawing && !!annotations && box.w > 0 && box.h > 0;
12899
+ const pan = useMemo(
12900
+ () => PanResponder.create({
12901
+ onStartShouldSetPanResponder: () => canDraw,
12902
+ onMoveShouldSetPanResponder: () => canDraw,
12903
+ onPanResponderGrant: (e) => {
12904
+ if (!annotations) return;
12905
+ const id = annotations.begin({ color });
12906
+ stroke.current = id;
12907
+ annotations.extend(id, e.nativeEvent.locationX / box.w, e.nativeEvent.locationY / box.h);
12908
+ },
12909
+ onPanResponderMove: (e) => {
12910
+ if (!annotations || !stroke.current) return;
12911
+ annotations.extend(
12912
+ stroke.current,
12913
+ e.nativeEvent.locationX / box.w,
12914
+ e.nativeEvent.locationY / box.h
12915
+ );
12916
+ },
12917
+ onPanResponderRelease: () => {
12918
+ if (annotations && stroke.current) annotations.end(stroke.current);
12919
+ stroke.current = null;
12920
+ },
12921
+ onPanResponderTerminate: () => {
12922
+ if (annotations && stroke.current) annotations.end(stroke.current);
12923
+ stroke.current = null;
12924
+ }
12925
+ }),
12926
+ [canDraw, annotations, color, box.w, box.h]
12927
+ );
12724
12928
  return /* @__PURE__ */ jsx(
12725
12929
  View,
12726
12930
  {
12727
12931
  style: [StyleSheet.absoluteFill, style],
12728
- pointerEvents: "none",
12932
+ pointerEvents: canDraw ? "auto" : "none",
12729
12933
  onLayout: (e) => setBox({ w: e.nativeEvent.layout.width, h: e.nativeEvent.layout.height }),
12934
+ ...canDraw ? {
12935
+ ...pan.panHandlers,
12936
+ accessible: true,
12937
+ accessibilityLabel: "Shared screen. Draw with one finger"
12938
+ } : {},
12730
12939
  children: state && box.w > 0 ? /* @__PURE__ */ jsxs(Svg, { width: box.w, height: box.h, children: [
12731
12940
  state.strokes.map((s2) => /* @__PURE__ */ jsx(
12732
12941
  Path,
@@ -14053,6 +14262,6 @@ var s = StyleSheet.create({
14053
14262
  empty: { padding: 16, textAlign: "center" }
14054
14263
  });
14055
14264
 
14056
- export { AgendaPanel, AgentBadge, AgentBadgeInline, AnnotationOverlay, ApprovalCard, ApprovalList, AskMeetings, AttachmentPicker, AttachmentPreview, AudioRouteSheet, Avatar, BlockRenderer, BreakoutBanner, CallAgentTag, CallAvatar, CallControlButton, CallLogRow, CaptionsOverlay, CatchUpCard, ChatHeader, ClipPlayer, CommandSuggestions, ConnectionIndicator, ConsentPrompt, ConversationList, ConversationView, DaySeparator, DlpWarningSheet, EditHistorySheet, EmojiGlyph, EmojiPicker, EmptyState, EscalationCard, EscalationList, FilesList, FormattingToolbar, ForumPostList, ForwardSheet, GroupDetailsSheet, ImageMosaic, InviteAgentMenu, LinkPreviewCard, LiveCallBanner, LiveTranscriptPanel, LobbyAdmitList, LobbyWaiting, MarkMomentButton, MeetingCard, MeetingCardMessageRow, MemberList, MentionInput, MessageActions, MessageApproval, MessageBubble, MessageCitations, MessageComposer, MessageExtrasProvider, MessageList, MessageRow, NetworkBanner, NewMessagesDivider, NoteCard, PinsList, PollCard, PoolseIcon, PoolseInbox, PoolseLogo, PoolseTheme, PresenceBadge, primitives as Primitives, QuestionsPanel, ReactionPicker, ReactionPickerBar, ReactionStrip, ReactionsOverlay, RecordingBanner, RecordingIndicator, RecordingNoticeRow, RecordingPlayer, RoomPresence, SendStatus, StagePanel, SummaryCard, SummaryMessageRow, ThreadSummary, ThreadView, TranscriptViewer, TranslatedText, TypingIndicator, UploadQueueStrip, UserName, VideoMessagePlayer, VoiceMessagePlayer, VoiceRecorder, WhisperPanel, WhiteboardView, applyBackground, avatarOverflow, callColors, captionLines, defaultDarkTheme, defaultLightTheme, formatBytes4 as formatBytes, formatCountdown, meetingTimeText, noteIdFromLink, overrunText, rsvpSummary, stripMarkdown, useAppStateLifecycle, useAppStatePresence, useBackgroundClients, useCallDuration, useDisplayName, useMessageExtras, usePoolseTheme, useTheme };
14265
+ export { AgendaPanel, AgentBadge, AgentBadgeInline, AnnotationOverlay, ApprovalCard, ApprovalList, AskMeetings, AttachmentPicker, AttachmentPreview, AudioRouteSheet, Avatar, BlockRenderer, BreakoutBanner, CallAgentTag, CallAvatar, CallControlButton, CallLogRow, CaptionsOverlay, CatchUpCard, ChatHeader, ClipPlayer, CommandSuggestions, ConnectionIndicator, ConsentPrompt, ConversationList, ConversationView, DaySeparator, DlpWarningSheet, EditHistorySheet, EmojiGlyph, EmojiPicker, EmptyState, EscalationCard, EscalationList, FilesList, FormattingToolbar, ForumPostList, ForwardSheet, GroupDetailsSheet, ImageMosaic, InviteAgentMenu, LinkPreviewCard, LiveCallBanner, LiveTranscriptPanel, LobbyAdmitList, LobbyWaiting, MarkMomentButton, MeetingCard, MeetingCardMessageRow, MemberList, MentionInput, MessageActions, MessageApproval, MessageBubble, MessageCitations, MessageComposer, MessageExtrasProvider, MessageList, MessageRow, NetworkBanner, NewMessagesDivider, NoteCard, PinsList, PollCard, PoolseIcon, PoolseInbox, PoolseLogo, PoolseTheme, PresenceBadge, primitives as Primitives, QuestionsPanel, ReactionPicker, ReactionPickerBar, ReactionStrip, ReactionsOverlay, RecordingBanner, RecordingIndicator, RecordingNoticeRow, RecordingPlayer, RoomPresence, SendStatus, StagePanel, SummaryCard, SummaryMessageRow, ThreadSummary, ThreadView, TranscriptViewer, TranslatedText, TypingIndicator, UploadQueueStrip, UserName, VideoMessagePlayer, VoiceMessagePlayer, VoiceRecorder, WhisperPanel, WhiteboardView, applyBackground, avatarOverflow, callColors, captionLines, defaultDarkTheme, defaultLightTheme, formatBytes4 as formatBytes, formatCountdown, meetingTimeText, noteIdFromLink, overrunText, rsvpSummary, stripMarkdown, useAppStateLifecycle, useAppStatePresence, useBackgroundClients, useCallDuration, useDisplayName, useMessageExtras, useNativeBreakouts, usePoolseTheme, useTheme };
14057
14266
  //# sourceMappingURL=index.js.map
14058
14267
  //# sourceMappingURL=index.js.map