@natoe/colab 0.1.11 → 0.1.12
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 +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +28 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -185,6 +185,13 @@ interface CollabPanelProps {
|
|
|
185
185
|
onBack?: () => void;
|
|
186
186
|
/** Hide the patient name row in the header — set when a parent already shows it (e.g. CollabPopup title bar) */
|
|
187
187
|
hidePatientName?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Notified whenever the underlying conversation state changes (initial
|
|
190
|
+
* preview load, create, channel deletion). Lets a parent like CollabPopup
|
|
191
|
+
* render its title bar from the authoritative conversation.name instead of
|
|
192
|
+
* relying on potentially-incomplete patientData.
|
|
193
|
+
*/
|
|
194
|
+
onConversationChange?: (conversation: Conversation | null) => void;
|
|
188
195
|
/** Custom class name for the outer container */
|
|
189
196
|
className?: string;
|
|
190
197
|
/** Custom inline styles for the outer container */
|
|
@@ -194,7 +201,7 @@ interface CollabPanelProps {
|
|
|
194
201
|
* Full collaboration panel: patient header + pinned bar + message thread + input.
|
|
195
202
|
* Supports reply, pin/unpin, and (optionally) seen-by indicators.
|
|
196
203
|
*/
|
|
197
|
-
declare function CollabPanel({ orderId, patientData, participantIds, showSeenBy, onBack, hidePatientName, className, style, }: CollabPanelProps): react_jsx_runtime.JSX.Element;
|
|
204
|
+
declare function CollabPanel({ orderId, patientData, participantIds, showSeenBy, onBack, hidePatientName, onConversationChange, className, style, }: CollabPanelProps): react_jsx_runtime.JSX.Element;
|
|
198
205
|
|
|
199
206
|
interface CollabPopupProps {
|
|
200
207
|
/** Order ID for this conversation */
|
package/dist/index.d.ts
CHANGED
|
@@ -185,6 +185,13 @@ interface CollabPanelProps {
|
|
|
185
185
|
onBack?: () => void;
|
|
186
186
|
/** Hide the patient name row in the header — set when a parent already shows it (e.g. CollabPopup title bar) */
|
|
187
187
|
hidePatientName?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Notified whenever the underlying conversation state changes (initial
|
|
190
|
+
* preview load, create, channel deletion). Lets a parent like CollabPopup
|
|
191
|
+
* render its title bar from the authoritative conversation.name instead of
|
|
192
|
+
* relying on potentially-incomplete patientData.
|
|
193
|
+
*/
|
|
194
|
+
onConversationChange?: (conversation: Conversation | null) => void;
|
|
188
195
|
/** Custom class name for the outer container */
|
|
189
196
|
className?: string;
|
|
190
197
|
/** Custom inline styles for the outer container */
|
|
@@ -194,7 +201,7 @@ interface CollabPanelProps {
|
|
|
194
201
|
* Full collaboration panel: patient header + pinned bar + message thread + input.
|
|
195
202
|
* Supports reply, pin/unpin, and (optionally) seen-by indicators.
|
|
196
203
|
*/
|
|
197
|
-
declare function CollabPanel({ orderId, patientData, participantIds, showSeenBy, onBack, hidePatientName, className, style, }: CollabPanelProps): react_jsx_runtime.JSX.Element;
|
|
204
|
+
declare function CollabPanel({ orderId, patientData, participantIds, showSeenBy, onBack, hidePatientName, onConversationChange, className, style, }: CollabPanelProps): react_jsx_runtime.JSX.Element;
|
|
198
205
|
|
|
199
206
|
interface CollabPopupProps {
|
|
200
207
|
/** Order ID for this conversation */
|
package/dist/index.js
CHANGED
|
@@ -575,7 +575,11 @@ function buildChannelName(patientData) {
|
|
|
575
575
|
const patientPart = patientData.patientName?.trim() || "Unknown";
|
|
576
576
|
const labPart = patientData.labName?.trim()?.slice(0, 24) || "";
|
|
577
577
|
const last4 = (patientData.displayOrderId ?? "").trim().slice(-4) || "0000";
|
|
578
|
-
return `${patientPart} - ${labPart} - ${last4}`;
|
|
578
|
+
return labPart ? `${patientPart} - ${labPart} - ${last4}` : `${patientPart} - ${last4}`;
|
|
579
|
+
}
|
|
580
|
+
function cleanChannelName(name) {
|
|
581
|
+
if (!name) return "";
|
|
582
|
+
return name.replace(/\s+-\s+-\s+/g, " - ").trim();
|
|
579
583
|
}
|
|
580
584
|
|
|
581
585
|
// src/hooks/useConversation.ts
|
|
@@ -610,8 +614,11 @@ function useConversation({
|
|
|
610
614
|
const ensureConversationInFlight = React4.useRef(null);
|
|
611
615
|
const markedReadIdsRef = React4.useRef(/* @__PURE__ */ new Set());
|
|
612
616
|
const buildName = React4.useCallback(
|
|
613
|
-
() =>
|
|
614
|
-
|
|
617
|
+
() => {
|
|
618
|
+
const labName = patientData.labName ?? (config.userRole === "lab" ? config.userName : void 0);
|
|
619
|
+
return buildChannelName({ ...patientData, labName });
|
|
620
|
+
},
|
|
621
|
+
[patientData, config.userRole, config.userName]
|
|
615
622
|
);
|
|
616
623
|
const joinChannel = React4.useCallback(
|
|
617
624
|
(conv) => {
|
|
@@ -1301,7 +1308,7 @@ var Z_INDEX = {
|
|
|
1301
1308
|
function resolveDisplayName(patientData, displayName) {
|
|
1302
1309
|
const localComplete = !!patientData.labName && !!patientData.displayOrderId;
|
|
1303
1310
|
if (localComplete) return buildChannelName(patientData);
|
|
1304
|
-
return displayName
|
|
1311
|
+
return cleanChannelName(displayName) || buildChannelName(patientData);
|
|
1305
1312
|
}
|
|
1306
1313
|
function PatientHeader({
|
|
1307
1314
|
patientData,
|
|
@@ -3766,6 +3773,7 @@ function CollabPanel({
|
|
|
3766
3773
|
showSeenBy = true,
|
|
3767
3774
|
onBack,
|
|
3768
3775
|
hidePatientName = false,
|
|
3776
|
+
onConversationChange,
|
|
3769
3777
|
className,
|
|
3770
3778
|
style
|
|
3771
3779
|
}) {
|
|
@@ -3794,6 +3802,9 @@ function CollabPanel({
|
|
|
3794
3802
|
pinMessage,
|
|
3795
3803
|
unpinMessage
|
|
3796
3804
|
} = useConversation({ orderId, patientData, participantIds });
|
|
3805
|
+
React4.useEffect(() => {
|
|
3806
|
+
onConversationChange?.(conversation);
|
|
3807
|
+
}, [conversation, onConversationChange]);
|
|
3797
3808
|
const channelSettings = useChannelSettings({
|
|
3798
3809
|
conversationId: conversation?.id ?? null
|
|
3799
3810
|
});
|
|
@@ -4015,10 +4026,12 @@ function CollabPopup({
|
|
|
4015
4026
|
);
|
|
4016
4027
|
const [isDragging, setIsDragging] = React4.useState(false);
|
|
4017
4028
|
const [isMinimized, setIsMinimized] = React4.useState(false);
|
|
4029
|
+
const [loadedConversation, setLoadedConversation] = React4.useState(null);
|
|
4018
4030
|
const dragOffset = React4.useRef({ x: 0, y: 0 });
|
|
4019
4031
|
const containerRef = React4.useRef(null);
|
|
4020
4032
|
const previouslyFocused = React4.useRef(null);
|
|
4021
4033
|
const titleId = React4.useId();
|
|
4034
|
+
const titleText = cleanChannelName(loadedConversation?.name) || buildChannelName(patientData);
|
|
4022
4035
|
const handleMouseDown = React4.useCallback(
|
|
4023
4036
|
(e) => {
|
|
4024
4037
|
if (!e.target.closest("[data-drag-handle]")) return;
|
|
@@ -4122,7 +4135,7 @@ function CollabPopup({
|
|
|
4122
4135
|
children: "\u2190"
|
|
4123
4136
|
}
|
|
4124
4137
|
),
|
|
4125
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { id: titleId, style: { ...styles13.titleText, flex: 1 }, children:
|
|
4138
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { id: titleId, style: { ...styles13.titleText, flex: 1 }, children: titleText }),
|
|
4126
4139
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles13.titleActions, children: [
|
|
4127
4140
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4128
4141
|
"button",
|
|
@@ -4148,7 +4161,16 @@ function CollabPopup({
|
|
|
4148
4161
|
)
|
|
4149
4162
|
] })
|
|
4150
4163
|
] }),
|
|
4151
|
-
!isMinimized && /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles13.panelWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4164
|
+
!isMinimized && /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles13.panelWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4165
|
+
CollabPanel,
|
|
4166
|
+
{
|
|
4167
|
+
orderId,
|
|
4168
|
+
patientData,
|
|
4169
|
+
participantIds,
|
|
4170
|
+
hidePatientName: true,
|
|
4171
|
+
onConversationChange: setLoadedConversation
|
|
4172
|
+
}
|
|
4173
|
+
) })
|
|
4152
4174
|
]
|
|
4153
4175
|
}
|
|
4154
4176
|
);
|