@natoe/colab 0.1.10 → 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 +48 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -569,7 +569,11 @@ function buildChannelName(patientData) {
|
|
|
569
569
|
const patientPart = patientData.patientName?.trim() || "Unknown";
|
|
570
570
|
const labPart = patientData.labName?.trim()?.slice(0, 24) || "";
|
|
571
571
|
const last4 = (patientData.displayOrderId ?? "").trim().slice(-4) || "0000";
|
|
572
|
-
return `${patientPart} - ${labPart} - ${last4}`;
|
|
572
|
+
return labPart ? `${patientPart} - ${labPart} - ${last4}` : `${patientPart} - ${last4}`;
|
|
573
|
+
}
|
|
574
|
+
function cleanChannelName(name) {
|
|
575
|
+
if (!name) return "";
|
|
576
|
+
return name.replace(/\s+-\s+-\s+/g, " - ").trim();
|
|
573
577
|
}
|
|
574
578
|
|
|
575
579
|
// src/hooks/useConversation.ts
|
|
@@ -604,8 +608,11 @@ function useConversation({
|
|
|
604
608
|
const ensureConversationInFlight = useRef(null);
|
|
605
609
|
const markedReadIdsRef = useRef(/* @__PURE__ */ new Set());
|
|
606
610
|
const buildName = useCallback(
|
|
607
|
-
() =>
|
|
608
|
-
|
|
611
|
+
() => {
|
|
612
|
+
const labName = patientData.labName ?? (config.userRole === "lab" ? config.userName : void 0);
|
|
613
|
+
return buildChannelName({ ...patientData, labName });
|
|
614
|
+
},
|
|
615
|
+
[patientData, config.userRole, config.userName]
|
|
609
616
|
);
|
|
610
617
|
const joinChannel = useCallback(
|
|
611
618
|
(conv) => {
|
|
@@ -1292,6 +1299,11 @@ var Z_INDEX = {
|
|
|
1292
1299
|
/** Portaled message-actions menu — must sit above the dialog. */
|
|
1293
1300
|
menu: 1e4
|
|
1294
1301
|
};
|
|
1302
|
+
function resolveDisplayName(patientData, displayName) {
|
|
1303
|
+
const localComplete = !!patientData.labName && !!patientData.displayOrderId;
|
|
1304
|
+
if (localComplete) return buildChannelName(patientData);
|
|
1305
|
+
return cleanChannelName(displayName) || buildChannelName(patientData);
|
|
1306
|
+
}
|
|
1295
1307
|
function PatientHeader({
|
|
1296
1308
|
patientData,
|
|
1297
1309
|
onOpenDicom,
|
|
@@ -1325,7 +1337,7 @@ function PatientHeader({
|
|
|
1325
1337
|
children: /* @__PURE__ */ jsx(BackIcon, { size: 22, color: COLOR.neutral800 })
|
|
1326
1338
|
}
|
|
1327
1339
|
),
|
|
1328
|
-
/* @__PURE__ */ jsx("span", { style: styles.nameText, children:
|
|
1340
|
+
/* @__PURE__ */ jsx("span", { style: styles.nameText, children: resolveDisplayName(patientData, displayName) })
|
|
1329
1341
|
] }),
|
|
1330
1342
|
meta.length > 0 && /* @__PURE__ */ jsx("div", { style: styles.metaRow, children: meta.map((item) => /* @__PURE__ */ jsxs("span", { style: styles.metaItem, children: [
|
|
1331
1343
|
/* @__PURE__ */ jsxs("span", { style: styles.metaLabel, children: [
|
|
@@ -3755,6 +3767,7 @@ function CollabPanel({
|
|
|
3755
3767
|
showSeenBy = true,
|
|
3756
3768
|
onBack,
|
|
3757
3769
|
hidePatientName = false,
|
|
3770
|
+
onConversationChange,
|
|
3758
3771
|
className,
|
|
3759
3772
|
style
|
|
3760
3773
|
}) {
|
|
@@ -3783,6 +3796,9 @@ function CollabPanel({
|
|
|
3783
3796
|
pinMessage,
|
|
3784
3797
|
unpinMessage
|
|
3785
3798
|
} = useConversation({ orderId, patientData, participantIds });
|
|
3799
|
+
useEffect(() => {
|
|
3800
|
+
onConversationChange?.(conversation);
|
|
3801
|
+
}, [conversation, onConversationChange]);
|
|
3786
3802
|
const channelSettings = useChannelSettings({
|
|
3787
3803
|
conversationId: conversation?.id ?? null
|
|
3788
3804
|
});
|
|
@@ -4004,10 +4020,12 @@ function CollabPopup({
|
|
|
4004
4020
|
);
|
|
4005
4021
|
const [isDragging, setIsDragging] = useState(false);
|
|
4006
4022
|
const [isMinimized, setIsMinimized] = useState(false);
|
|
4023
|
+
const [loadedConversation, setLoadedConversation] = useState(null);
|
|
4007
4024
|
const dragOffset = useRef({ x: 0, y: 0 });
|
|
4008
4025
|
const containerRef = useRef(null);
|
|
4009
4026
|
const previouslyFocused = useRef(null);
|
|
4010
4027
|
const titleId = useId();
|
|
4028
|
+
const titleText = cleanChannelName(loadedConversation?.name) || buildChannelName(patientData);
|
|
4011
4029
|
const handleMouseDown = useCallback(
|
|
4012
4030
|
(e) => {
|
|
4013
4031
|
if (!e.target.closest("[data-drag-handle]")) return;
|
|
@@ -4111,7 +4129,7 @@ function CollabPopup({
|
|
|
4111
4129
|
children: "\u2190"
|
|
4112
4130
|
}
|
|
4113
4131
|
),
|
|
4114
|
-
/* @__PURE__ */ jsx("span", { id: titleId, style: { ...styles13.titleText, flex: 1 }, children:
|
|
4132
|
+
/* @__PURE__ */ jsx("span", { id: titleId, style: { ...styles13.titleText, flex: 1 }, children: titleText }),
|
|
4115
4133
|
/* @__PURE__ */ jsxs("div", { style: styles13.titleActions, children: [
|
|
4116
4134
|
/* @__PURE__ */ jsx(
|
|
4117
4135
|
"button",
|
|
@@ -4137,7 +4155,16 @@ function CollabPopup({
|
|
|
4137
4155
|
)
|
|
4138
4156
|
] })
|
|
4139
4157
|
] }),
|
|
4140
|
-
!isMinimized && /* @__PURE__ */ jsx("div", { style: styles13.panelWrapper, children: /* @__PURE__ */ jsx(
|
|
4158
|
+
!isMinimized && /* @__PURE__ */ jsx("div", { style: styles13.panelWrapper, children: /* @__PURE__ */ jsx(
|
|
4159
|
+
CollabPanel,
|
|
4160
|
+
{
|
|
4161
|
+
orderId,
|
|
4162
|
+
patientData,
|
|
4163
|
+
participantIds,
|
|
4164
|
+
hidePatientName: true,
|
|
4165
|
+
onConversationChange: setLoadedConversation
|
|
4166
|
+
}
|
|
4167
|
+
) })
|
|
4141
4168
|
]
|
|
4142
4169
|
}
|
|
4143
4170
|
);
|
|
@@ -5359,8 +5386,18 @@ function CollabInbox({
|
|
|
5359
5386
|
);
|
|
5360
5387
|
}
|
|
5361
5388
|
function buildPatientData(item) {
|
|
5362
|
-
|
|
5363
|
-
|
|
5389
|
+
const parsed = parseChannelName(item.name, item.orderId);
|
|
5390
|
+
if (item.patientSnapshot) {
|
|
5391
|
+
return {
|
|
5392
|
+
...item.patientSnapshot,
|
|
5393
|
+
labName: item.patientSnapshot.labName ?? parsed.labName,
|
|
5394
|
+
displayOrderId: item.patientSnapshot.displayOrderId ?? parsed.displayOrderId
|
|
5395
|
+
};
|
|
5396
|
+
}
|
|
5397
|
+
return parsed;
|
|
5398
|
+
}
|
|
5399
|
+
function parseChannelName(name, orderId) {
|
|
5400
|
+
const parts = name.split(" - ");
|
|
5364
5401
|
if (parts.length >= 3) {
|
|
5365
5402
|
const last4 = parts[parts.length - 1];
|
|
5366
5403
|
const labName = parts[parts.length - 2];
|
|
@@ -5368,13 +5405,13 @@ function buildPatientData(item) {
|
|
|
5368
5405
|
return {
|
|
5369
5406
|
patientName,
|
|
5370
5407
|
labName: labName || void 0,
|
|
5371
|
-
orderId
|
|
5408
|
+
orderId,
|
|
5372
5409
|
displayOrderId: last4
|
|
5373
5410
|
};
|
|
5374
5411
|
}
|
|
5375
5412
|
return {
|
|
5376
|
-
patientName:
|
|
5377
|
-
orderId
|
|
5413
|
+
patientName: name,
|
|
5414
|
+
orderId
|
|
5378
5415
|
};
|
|
5379
5416
|
}
|
|
5380
5417
|
function EmptyState({ hasAny }) {
|