@natoe/colab 0.1.28 → 0.1.30
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.d.mts +77 -30
- package/dist/index.d.ts +77 -30
- package/dist/index.js +58 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -885,6 +885,7 @@ function cleanChannelName(name) {
|
|
|
885
885
|
// src/hooks/useConversation.ts
|
|
886
886
|
function useConversation({
|
|
887
887
|
orderId,
|
|
888
|
+
conversation: providedConversation,
|
|
888
889
|
patientData,
|
|
889
890
|
participantIds = [],
|
|
890
891
|
loadHistory = true,
|
|
@@ -917,6 +918,7 @@ function useConversation({
|
|
|
917
918
|
const markedReadIdsRef = useRef(/* @__PURE__ */ new Set());
|
|
918
919
|
const buildName = useCallback(
|
|
919
920
|
() => {
|
|
921
|
+
if (!patientData) return "";
|
|
920
922
|
const labName = patientData.labName ?? (config.userRole === "lab" ? config.userName : void 0);
|
|
921
923
|
return buildChannelName({ ...patientData, labName });
|
|
922
924
|
},
|
|
@@ -1016,6 +1018,28 @@ function useConversation({
|
|
|
1016
1018
|
setIsLoading(true);
|
|
1017
1019
|
setError(null);
|
|
1018
1020
|
try {
|
|
1021
|
+
if (providedConversation) {
|
|
1022
|
+
setConversation(providedConversation);
|
|
1023
|
+
setParticipants(providedConversation.participants ?? []);
|
|
1024
|
+
joinChannel(providedConversation);
|
|
1025
|
+
if (loadHistory) {
|
|
1026
|
+
const history = await fetchMessages(providedConversation.id);
|
|
1027
|
+
if (cancelled) return;
|
|
1028
|
+
setMessages(history);
|
|
1029
|
+
setHasMore(history.length >= MESSAGES_PAGE_SIZE);
|
|
1030
|
+
setPinnedMessages(history.filter((m) => m.isPinned));
|
|
1031
|
+
}
|
|
1032
|
+
if (!cancelled) setIsLoading(false);
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
if (!orderId) {
|
|
1036
|
+
setConversation(null);
|
|
1037
|
+
setMessages([]);
|
|
1038
|
+
setParticipants([]);
|
|
1039
|
+
setHasMore(false);
|
|
1040
|
+
setIsLoading(false);
|
|
1041
|
+
return;
|
|
1042
|
+
}
|
|
1019
1043
|
const preview = await requestPreview(orderId, kind);
|
|
1020
1044
|
if (cancelled) return;
|
|
1021
1045
|
if (!preview) {
|
|
@@ -1077,6 +1101,12 @@ function useConversation({
|
|
|
1077
1101
|
const ensureConversation = useCallback(
|
|
1078
1102
|
async (payload) => {
|
|
1079
1103
|
if (conversation) return { conv: conversation, persistedByCreate: false };
|
|
1104
|
+
if (!orderId) {
|
|
1105
|
+
throw {
|
|
1106
|
+
code: "NO_CONVERSATION",
|
|
1107
|
+
message: "This conversation is not available yet. Please reopen it and try again."
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1080
1110
|
if (ensureConversationInFlight.current) {
|
|
1081
1111
|
const conv = await ensureConversationInFlight.current;
|
|
1082
1112
|
return { conv, persistedByCreate: false };
|
|
@@ -1564,15 +1594,19 @@ function PatientHeader({
|
|
|
1564
1594
|
onBack,
|
|
1565
1595
|
hideName = false,
|
|
1566
1596
|
displayName,
|
|
1597
|
+
isSupportChannel = false,
|
|
1567
1598
|
className
|
|
1568
1599
|
}) {
|
|
1569
|
-
const hasDicom = !!(patientData.studyId && patientData.storageId);
|
|
1570
|
-
const resolvedName = resolveDisplayName(patientData, displayName);
|
|
1600
|
+
const hasDicom = !isSupportChannel && !!(patientData.studyId && patientData.storageId);
|
|
1601
|
+
const resolvedName = isSupportChannel ? displayName || patientData.patientName || "Natoe Support" : resolveDisplayName(patientData, displayName);
|
|
1571
1602
|
const metaParts = [];
|
|
1572
|
-
if (
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
if (
|
|
1603
|
+
if (isSupportChannel) {
|
|
1604
|
+
metaParts.push("Help and support");
|
|
1605
|
+
}
|
|
1606
|
+
if (!isSupportChannel && patientData.patientAge) metaParts.push(String(patientData.patientAge));
|
|
1607
|
+
if (!isSupportChannel && patientData.patientSex) metaParts.push(String(patientData.patientSex));
|
|
1608
|
+
if (!isSupportChannel && patientData.studyType) metaParts.push(patientData.studyType);
|
|
1609
|
+
if (!isSupportChannel && patientData.bodyParts && patientData.bodyParts.length > 0) {
|
|
1576
1610
|
metaParts.push(patientData.bodyParts.join(", "));
|
|
1577
1611
|
}
|
|
1578
1612
|
const hasPrimaryActions = hasDicom && onOpenDicom || onOpenCase;
|
|
@@ -4529,6 +4563,7 @@ var DARK_THEME_OVERRIDES = {
|
|
|
4529
4563
|
};
|
|
4530
4564
|
function CollabPanel({
|
|
4531
4565
|
orderId,
|
|
4566
|
+
conversation: providedConversation,
|
|
4532
4567
|
patientData,
|
|
4533
4568
|
participantIds,
|
|
4534
4569
|
kind,
|
|
@@ -4570,7 +4605,13 @@ function CollabPanel({
|
|
|
4570
4605
|
loadMoreMessages,
|
|
4571
4606
|
pinMessage,
|
|
4572
4607
|
unpinMessage
|
|
4573
|
-
} = useConversation({
|
|
4608
|
+
} = useConversation({
|
|
4609
|
+
orderId,
|
|
4610
|
+
conversation: providedConversation,
|
|
4611
|
+
patientData,
|
|
4612
|
+
participantIds,
|
|
4613
|
+
kind
|
|
4614
|
+
});
|
|
4574
4615
|
useEffect(() => {
|
|
4575
4616
|
onConversationChange?.(conversation);
|
|
4576
4617
|
}, [conversation, onConversationChange]);
|
|
@@ -4579,11 +4620,11 @@ function CollabPanel({
|
|
|
4579
4620
|
});
|
|
4580
4621
|
const { handleDeepLink } = useDeepLinks();
|
|
4581
4622
|
const handleOpenDicom = () => {
|
|
4582
|
-
if (patientData
|
|
4623
|
+
if (patientData?.studyId && patientData.storageId && config.onOpenDicom) {
|
|
4583
4624
|
config.onOpenDicom(patientData.studyId, patientData.storageId);
|
|
4584
4625
|
}
|
|
4585
4626
|
};
|
|
4586
|
-
const handleOpenCase = !hideOpenCase && config.onOpenCase ? () => config.onOpenCase?.(patientData.orderId, patientData.displayOrderId) : void 0;
|
|
4627
|
+
const handleOpenCase = !hideOpenCase && config.onOpenCase && patientData?.orderId ? () => config.onOpenCase?.(patientData.orderId, patientData.displayOrderId) : void 0;
|
|
4587
4628
|
const handleJumpToMessage = (messageId) => {
|
|
4588
4629
|
messageListRef.current?.scrollToMessage(messageId);
|
|
4589
4630
|
};
|
|
@@ -4656,7 +4697,8 @@ function CollabPanel({
|
|
|
4656
4697
|
/* @__PURE__ */ jsx(
|
|
4657
4698
|
PatientHeader,
|
|
4658
4699
|
{
|
|
4659
|
-
patientData,
|
|
4700
|
+
patientData: patientData ?? { orderId: "", patientName: conversation?.name ?? "Natoe Support" },
|
|
4701
|
+
isSupportChannel: !patientData,
|
|
4660
4702
|
participants,
|
|
4661
4703
|
onOpenDicom: handleOpenDicom,
|
|
4662
4704
|
onOpenCase: handleOpenCase,
|
|
@@ -5895,7 +5937,10 @@ function useConversationList(options) {
|
|
|
5895
5937
|
|
|
5896
5938
|
// src/core/types.ts
|
|
5897
5939
|
function isHelpKind(kind) {
|
|
5898
|
-
return kind === "help_lab"
|
|
5940
|
+
return kind === "help_lab";
|
|
5941
|
+
}
|
|
5942
|
+
function isCaseKind(kind) {
|
|
5943
|
+
return kind === void 0 || kind === "case";
|
|
5899
5944
|
}
|
|
5900
5945
|
function ConversationListItem({
|
|
5901
5946
|
item,
|
|
@@ -6531,6 +6576,7 @@ function CollabInbox({
|
|
|
6531
6576
|
);
|
|
6532
6577
|
}
|
|
6533
6578
|
function buildPatientData(item) {
|
|
6579
|
+
if (isHelpKind(item.kind) || !item.orderId) return void 0;
|
|
6534
6580
|
const parsed = parseChannelName(item.name, item.orderId);
|
|
6535
6581
|
if (item.patientSnapshot) {
|
|
6536
6582
|
return {
|
|
@@ -6837,6 +6883,6 @@ function usePinnedMessages({
|
|
|
6837
6883
|
};
|
|
6838
6884
|
}
|
|
6839
6885
|
|
|
6840
|
-
export { AUDIO_MIME_TYPE, ChannelSettings, CollabInbox, CollabInline, CollabPanel, CollabPopup, CollabProvider, CollabSocket, ConversationList, ConversationListItem, DEEP_LINK_PREFIX, EVENTS, MAX_FILE_SIZE, MAX_PINNED_MESSAGES, MESSAGES_PAGE_SIZE, MESSAGE_TYPES, MessageActionsMenu, MessageBubble, MessageInput, MessageList, ParticipantsList, PatientHeader, PinnedMessagesBar, ReplyPreview, ReplyQuoteBlock, SUPPORTED_IMAGE_TYPES, SeenByIndicator, THEME_DEFAULTS, THEME_VAR, TYPING_DEBOUNCE_MS, applyThemeOverrides, isHelpKind, useAudioRecorder, useChannelSettings, useCollab, useConversation, useConversationList, useDeepLinks, useInlineCollab, useMessages, usePinnedMessages, useUnreadCount };
|
|
6886
|
+
export { AUDIO_MIME_TYPE, ChannelSettings, CollabInbox, CollabInline, CollabPanel, CollabPopup, CollabProvider, CollabSocket, ConversationList, ConversationListItem, DEEP_LINK_PREFIX, EVENTS, MAX_FILE_SIZE, MAX_PINNED_MESSAGES, MESSAGES_PAGE_SIZE, MESSAGE_TYPES, MessageActionsMenu, MessageBubble, MessageInput, MessageList, ParticipantsList, PatientHeader, PinnedMessagesBar, ReplyPreview, ReplyQuoteBlock, SUPPORTED_IMAGE_TYPES, SeenByIndicator, THEME_DEFAULTS, THEME_VAR, TYPING_DEBOUNCE_MS, applyThemeOverrides, isCaseKind, isHelpKind, useAudioRecorder, useChannelSettings, useCollab, useConversation, useConversationList, useDeepLinks, useInlineCollab, useMessages, usePinnedMessages, useUnreadCount };
|
|
6841
6887
|
//# sourceMappingURL=index.mjs.map
|
|
6842
6888
|
//# sourceMappingURL=index.mjs.map
|