@natoe/colab 0.1.30 → 0.1.34

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.mjs CHANGED
@@ -1639,7 +1639,7 @@ function PatientHeader({
1639
1639
  }
1640
1640
  )
1641
1641
  ] }) : null;
1642
- const settingsButton = onOpenSettings ? /* @__PURE__ */ jsxs(
1642
+ const settingsButton = onOpenSettings && !isSupportChannel ? /* @__PURE__ */ jsxs(
1643
1643
  "button",
1644
1644
  {
1645
1645
  onClick: onOpenSettings,
@@ -3931,6 +3931,7 @@ function fallbackName(role) {
3931
3931
  return "User";
3932
3932
  }
3933
3933
  }
3934
+ var FALLBACK_ROLE_COLOR = { bg: "#f1f5f9", text: "#64748b" };
3934
3935
  function RoleBadge({ role }) {
3935
3936
  const colors = {
3936
3937
  radiologist: { bg: "#eef2ff", text: "#4f46e5" },
@@ -3942,8 +3943,8 @@ function RoleBadge({ role }) {
3942
3943
  admin: { bg: "#f1f5f9", text: "#64748b" }
3943
3944
  // slate
3944
3945
  };
3945
- const color = colors[role];
3946
- return /* @__PURE__ */ jsx("span", { style: { ...styles9.roleBadge, backgroundColor: color.bg, color: color.text }, children: role });
3946
+ const color = colors[role] ?? FALLBACK_ROLE_COLOR;
3947
+ return /* @__PURE__ */ jsx("span", { style: { ...styles9.roleBadge, backgroundColor: color.bg, color: color.text }, children: fallbackName(role) });
3947
3948
  }
3948
3949
  var styles9 = {
3949
3950
  list: {
@@ -4829,6 +4830,7 @@ ensureGlobalStyles();
4829
4830
  var FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
4830
4831
  function CollabPopup({
4831
4832
  orderId,
4833
+ conversation: providedConversation,
4832
4834
  patientData,
4833
4835
  participantIds,
4834
4836
  kind,
@@ -4855,7 +4857,8 @@ function CollabPopup({
4855
4857
  const containerRef = useRef(null);
4856
4858
  const previouslyFocused = useRef(null);
4857
4859
  const titleId = useId();
4858
- const titleText = cleanChannelName(loadedConversation?.name) || buildChannelName(patientData);
4860
+ const titleText = cleanChannelName(loadedConversation?.name) || (patientData ? buildChannelName(patientData) : "Natoe Support");
4861
+ const isSupportChannel = !patientData;
4859
4862
  const handleMouseDown = useCallback(
4860
4863
  (e) => {
4861
4864
  if (!e.target.closest("[data-drag-handle]")) return;
@@ -4960,8 +4963,9 @@ function CollabPopup({
4960
4963
  }
4961
4964
  ),
4962
4965
  /* @__PURE__ */ jsxs("div", { style: styles13.titleCenter, children: [
4963
- /* @__PURE__ */ jsx("h2", { id: titleId, style: styles13.patientName, children: patientData.patientName || titleText }),
4966
+ /* @__PURE__ */ jsx("h2", { id: titleId, style: styles13.patientName, children: patientData?.patientName || titleText }),
4964
4967
  (() => {
4968
+ if (!patientData) return /* @__PURE__ */ jsx("div", { style: styles13.subRow, children: /* @__PURE__ */ jsx("span", { style: styles13.metaText, children: "Help and support" }) });
4965
4969
  const parts = [];
4966
4970
  if (patientData.patientAge) parts.push(String(patientData.patientAge));
4967
4971
  if (patientData.patientSex) parts.push(String(patientData.patientSex));
@@ -4973,7 +4977,7 @@ function CollabPopup({
4973
4977
  })()
4974
4978
  ] }),
4975
4979
  /* @__PURE__ */ jsxs("div", { style: styles13.titleActions, children: [
4976
- loadedConversation && /* @__PURE__ */ jsxs(
4980
+ loadedConversation && !isSupportChannel && /* @__PURE__ */ jsxs(
4977
4981
  "button",
4978
4982
  {
4979
4983
  type: "button",
@@ -5018,6 +5022,7 @@ function CollabPopup({
5018
5022
  CollabPanel,
5019
5023
  {
5020
5024
  orderId,
5025
+ conversation: providedConversation,
5021
5026
  patientData,
5022
5027
  participantIds,
5023
5028
  kind,
@@ -6678,6 +6683,143 @@ var styles17 = {
6678
6683
  maxWidth: "320px"
6679
6684
  }
6680
6685
  };
6686
+ ensureGlobalStyles();
6687
+ function HelpPanel({
6688
+ conversation,
6689
+ showSeenBy = true,
6690
+ composerAccessory,
6691
+ className,
6692
+ style
6693
+ }) {
6694
+ const { config } = useCollab();
6695
+ const { handleDeepLink } = useDeepLinks();
6696
+ const messageListRef = useRef(null);
6697
+ const {
6698
+ messages,
6699
+ typingUsers,
6700
+ isLoading,
6701
+ hasMore,
6702
+ error,
6703
+ replyTo,
6704
+ setReplyTo,
6705
+ sendMessage,
6706
+ retryMessage,
6707
+ sendAudioMessage,
6708
+ sendFileMessage,
6709
+ sendTyping,
6710
+ markAsRead,
6711
+ loadMoreMessages
6712
+ } = useConversation({ conversation, kind: "help_lab" });
6713
+ return /* @__PURE__ */ jsxs(
6714
+ "div",
6715
+ {
6716
+ className: [ROOT_CLASS, className].filter(Boolean).join(" "),
6717
+ style: { ...styles18.container, ...style },
6718
+ children: [
6719
+ /* @__PURE__ */ jsxs("header", { style: styles18.header, children: [
6720
+ /* @__PURE__ */ jsx("span", { style: styles18.avatar, "aria-hidden": "true", children: "N" }),
6721
+ /* @__PURE__ */ jsxs("span", { style: styles18.headerText, children: [
6722
+ /* @__PURE__ */ jsx("span", { style: styles18.title, children: "Natoe Support" }),
6723
+ /* @__PURE__ */ jsx("span", { style: styles18.subtitle, children: "Questions about your account, billing or a case" })
6724
+ ] })
6725
+ ] }),
6726
+ error && /* @__PURE__ */ jsx("div", { style: styles18.error, role: "alert", children: error }),
6727
+ isLoading && messages.length === 0 ? /* @__PURE__ */ jsx("div", { style: styles18.loading, children: /* @__PURE__ */ jsx(Spinner, {}) }) : /* @__PURE__ */ jsx(
6728
+ MessageList,
6729
+ {
6730
+ ref: messageListRef,
6731
+ messages,
6732
+ currentUserId: config.userId,
6733
+ showSeenBy,
6734
+ typingUsers,
6735
+ hasMore,
6736
+ isLoading,
6737
+ onLoadMore: loadMoreMessages,
6738
+ onDeepLinkClick: handleDeepLink,
6739
+ onMessageVisible: markAsRead,
6740
+ onReply: setReplyTo,
6741
+ onRetry: retryMessage,
6742
+ pinDisabled: true
6743
+ }
6744
+ ),
6745
+ composerAccessory,
6746
+ /* @__PURE__ */ jsx(
6747
+ MessageInput,
6748
+ {
6749
+ onSendText: sendMessage,
6750
+ onSendAudio: sendAudioMessage,
6751
+ onSendFile: sendFileMessage,
6752
+ onTyping: sendTyping,
6753
+ replyTo,
6754
+ onCancelReply: () => setReplyTo(null),
6755
+ placeholder: "Ask Natoe support\u2026"
6756
+ }
6757
+ )
6758
+ ]
6759
+ }
6760
+ );
6761
+ }
6762
+ var styles18 = {
6763
+ container: {
6764
+ display: "flex",
6765
+ flexDirection: "column",
6766
+ height: "100%",
6767
+ minHeight: 0,
6768
+ fontFamily: FONT_STACK,
6769
+ background: COLOR.white
6770
+ },
6771
+ header: {
6772
+ display: "flex",
6773
+ alignItems: "center",
6774
+ gap: SPACE.S3,
6775
+ padding: `${SPACE.S3} ${SPACE.S4}`,
6776
+ borderBottom: `1px solid ${COLOR.neutral200}`,
6777
+ flex: "0 0 auto"
6778
+ },
6779
+ avatar: {
6780
+ flex: "0 0 auto",
6781
+ width: 32,
6782
+ height: 32,
6783
+ borderRadius: RADIUS.full,
6784
+ background: COLOR.primary,
6785
+ color: COLOR.white,
6786
+ display: "flex",
6787
+ alignItems: "center",
6788
+ justifyContent: "center",
6789
+ fontSize: FONT_SIZE.md,
6790
+ fontWeight: FONT_WEIGHT.semibold
6791
+ },
6792
+ headerText: {
6793
+ display: "flex",
6794
+ flexDirection: "column",
6795
+ minWidth: 0
6796
+ },
6797
+ title: {
6798
+ fontSize: FONT_SIZE.md,
6799
+ fontWeight: FONT_WEIGHT.semibold,
6800
+ color: COLOR.neutral900
6801
+ },
6802
+ subtitle: {
6803
+ fontSize: FONT_SIZE.sm,
6804
+ color: COLOR.neutral500,
6805
+ overflow: "hidden",
6806
+ textOverflow: "ellipsis",
6807
+ whiteSpace: "nowrap"
6808
+ },
6809
+ error: {
6810
+ padding: `${SPACE.S2} ${SPACE.S4}`,
6811
+ fontSize: FONT_SIZE.sm,
6812
+ color: COLOR.danger,
6813
+ background: COLOR.dangerBg,
6814
+ flex: "0 0 auto"
6815
+ },
6816
+ loading: {
6817
+ flex: "1 1 auto",
6818
+ display: "flex",
6819
+ alignItems: "center",
6820
+ justifyContent: "center"
6821
+ }
6822
+ };
6681
6823
  function useMessages({
6682
6824
  conversationId,
6683
6825
  initialLimit = MESSAGES_PAGE_SIZE
@@ -6883,6 +7025,6 @@ function usePinnedMessages({
6883
7025
  };
6884
7026
  }
6885
7027
 
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 };
7028
+ export { AUDIO_MIME_TYPE, ChannelSettings, CollabInbox, CollabInline, CollabPanel, CollabPopup, CollabProvider, CollabSocket, ConversationList, ConversationListItem, DEEP_LINK_PREFIX, EVENTS, HelpPanel, 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 };
6887
7029
  //# sourceMappingURL=index.mjs.map
6888
7030
  //# sourceMappingURL=index.mjs.map