@poolse/react-native 3.1.0 → 3.2.0-dev.1
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 +12 -0
- package/dist/index.cjs +67 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +68 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useUser, useMe, useConversations, formatCallLogPreview, useAttachmentUpload, useConversation, useMembers, usePresence, receiptsOf, useMessages, useTyping, useRealtimeStatus, isMessageVisibleTo, computeGroupPosition, canEditOwnMessage, formatDayLabel, callLogDisplayFor, useLiveCall, sameDay, useReactions, useThread, useAttachmentUrl, usePoolse } from '@poolse/react';
|
|
1
|
+
import { useUser, useMe, useConversations, formatCallLogPreview, useAttachmentUpload, useConversation, useMembers, usePresence, receiptsOf, useMessages, useTyping, useMessageStreams, useRealtimeStatus, isMessageVisibleTo, computeGroupPosition, canEditOwnMessage, formatDayLabel, callLogDisplayFor, useLiveCall, sameDay, useReactions, useThread, useAttachmentUrl, usePoolse } from '@poolse/react';
|
|
2
2
|
import { createContext, forwardRef, useRef, useState, useImperativeHandle, useEffect, useMemo, useCallback, useContext, createElement } from 'react';
|
|
3
3
|
import { StyleSheet, View, Pressable, TextInput, Text, useWindowDimensions, Animated, Easing, PanResponder, Image, Keyboard, Platform, ScrollView, ActivityIndicator, FlatList, AppState, KeyboardAvoidingView, Modal, Linking } from 'react-native';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
@@ -4252,7 +4252,16 @@ function ConversationView({
|
|
|
4252
4252
|
markReadUpTo,
|
|
4253
4253
|
refetch
|
|
4254
4254
|
} = useMessages(conversationId);
|
|
4255
|
-
const { typing, signalTyping } = useTyping(conversationId);
|
|
4255
|
+
const { typing: typingPeople, signalTyping } = useTyping(conversationId);
|
|
4256
|
+
const streams = useMessageStreams(conversationId);
|
|
4257
|
+
const typing = useMemo(() => {
|
|
4258
|
+
const thinking = streams.filter((s) => s.status === "streaming" && !s.text);
|
|
4259
|
+
if (thinking.length === 0) return typingPeople;
|
|
4260
|
+
const next = new Set(typingPeople);
|
|
4261
|
+
for (const s of thinking) if (s.sender_external_id) next.add(s.sender_external_id);
|
|
4262
|
+
return next;
|
|
4263
|
+
}, [typingPeople, streams]);
|
|
4264
|
+
const visibleStreams = streams.filter((s) => s.text || s.status === "failed");
|
|
4256
4265
|
const realtimeStatus = useRealtimeStatus();
|
|
4257
4266
|
useEffect(() => {
|
|
4258
4267
|
const sub = AppState.addEventListener("change", (next) => {
|
|
@@ -4476,7 +4485,37 @@ function ConversationView({
|
|
|
4476
4485
|
hasMore,
|
|
4477
4486
|
onLoadMore: loadMore,
|
|
4478
4487
|
renderItem,
|
|
4479
|
-
ListHeader: /* @__PURE__ */
|
|
4488
|
+
ListHeader: /* @__PURE__ */ jsxs(View, { children: [
|
|
4489
|
+
visibleStreams.map(
|
|
4490
|
+
(stream) => stream.status === "failed" ? /* @__PURE__ */ jsx(
|
|
4491
|
+
Text,
|
|
4492
|
+
{
|
|
4493
|
+
style: [styles22.streamFailed, { color: theme.colors.ink3 }],
|
|
4494
|
+
accessibilityRole: "alert",
|
|
4495
|
+
children: stream.error ? `The agent couldn't reply: ${stream.error}` : "The agent couldn't reply."
|
|
4496
|
+
},
|
|
4497
|
+
stream.id
|
|
4498
|
+
) : /* @__PURE__ */ jsx(
|
|
4499
|
+
MessageRow,
|
|
4500
|
+
{
|
|
4501
|
+
msg: streamingMessage(stream),
|
|
4502
|
+
meId,
|
|
4503
|
+
reactions: false,
|
|
4504
|
+
attachments: false,
|
|
4505
|
+
actions: false,
|
|
4506
|
+
threads: false,
|
|
4507
|
+
quotations: false,
|
|
4508
|
+
...labelFor ? { labelFor } : {},
|
|
4509
|
+
...avatarFor ? { avatarFor } : {},
|
|
4510
|
+
showSenderName: showSenderLabels,
|
|
4511
|
+
showAvatar: showAvatars,
|
|
4512
|
+
markdown
|
|
4513
|
+
},
|
|
4514
|
+
stream.id
|
|
4515
|
+
)
|
|
4516
|
+
),
|
|
4517
|
+
/* @__PURE__ */ jsx(TypingIndicator, { typing, ...labelFor ? { labelFor } : {} })
|
|
4518
|
+
] }),
|
|
4480
4519
|
...emptyState !== void 0 ? { emptyState } : {}
|
|
4481
4520
|
}
|
|
4482
4521
|
),
|
|
@@ -4533,6 +4572,11 @@ var styles22 = StyleSheet.create({
|
|
|
4533
4572
|
root: {
|
|
4534
4573
|
flex: 1
|
|
4535
4574
|
},
|
|
4575
|
+
streamFailed: {
|
|
4576
|
+
fontSize: 12,
|
|
4577
|
+
marginHorizontal: 16,
|
|
4578
|
+
marginVertical: 4
|
|
4579
|
+
},
|
|
4536
4580
|
listWrap: {
|
|
4537
4581
|
flex: 1
|
|
4538
4582
|
},
|
|
@@ -4545,6 +4589,27 @@ var styles22 = StyleSheet.create({
|
|
|
4545
4589
|
zIndex: 5
|
|
4546
4590
|
}
|
|
4547
4591
|
});
|
|
4592
|
+
function streamingMessage(stream) {
|
|
4593
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
4594
|
+
return {
|
|
4595
|
+
id: stream.id,
|
|
4596
|
+
tenant_id: "",
|
|
4597
|
+
conversation_id: stream.conversation_id,
|
|
4598
|
+
sender_id: stream.sender_id,
|
|
4599
|
+
sender_external_id: stream.sender_external_id,
|
|
4600
|
+
type: "text",
|
|
4601
|
+
body: `${stream.text} \u258D`,
|
|
4602
|
+
reply_to_id: null,
|
|
4603
|
+
thread_root_id: null,
|
|
4604
|
+
mentions: [],
|
|
4605
|
+
reactions: {},
|
|
4606
|
+
edited_at: null,
|
|
4607
|
+
deleted_at: null,
|
|
4608
|
+
sequence: Number.MAX_SAFE_INTEGER,
|
|
4609
|
+
inserted_at: now,
|
|
4610
|
+
updated_at: now
|
|
4611
|
+
};
|
|
4612
|
+
}
|
|
4548
4613
|
function UserPickerSheet({
|
|
4549
4614
|
visible,
|
|
4550
4615
|
onClose,
|