@planningcenter/topbar 12.2.3 → 12.2.4

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/topbar.js CHANGED
@@ -5704,10 +5704,10 @@ const useChatConfig = ({
5704
5704
  userId
5705
5705
  }) => {
5706
5706
  const [displayChatIcon, setDisplayChatIcon] = React.useState(false);
5707
- const [unreadMessages, setUnreadMessages] = React.useState(false);
5707
+ const [hasUnread, setHasUnread] = React.useState(false);
5708
5708
  const fetchChatPerson = async () => {
5709
5709
  const url = `${window.location.origin}/~api/chat/v2/me`;
5710
- const personFields = ["can_chat_pending_age_check", "unread_messages"].join(",");
5710
+ const personFields = ["can_chat_pending_age_check", "unread_messages", "unread_reactions"].join(",");
5711
5711
  const query = `?fields[Person]=${personFields}`;
5712
5712
  const {
5713
5713
  json
@@ -5719,9 +5719,10 @@ const useChatConfig = ({
5719
5719
  }) => {
5720
5720
  const {
5721
5721
  can_chat_pending_age_check,
5722
- unread_messages
5722
+ unread_messages,
5723
+ unread_reactions
5723
5724
  } = data.attributes;
5724
- setUnreadMessages(unread_messages);
5725
+ setHasUnread(unread_messages || unread_reactions);
5725
5726
  setDisplayChatIcon(can_chat_pending_age_check);
5726
5727
  }).catch(noop);
5727
5728
  const chatJoltChannel = useJoltChannelSubscription({
@@ -5753,7 +5754,7 @@ const useChatConfig = ({
5753
5754
  }, [isEnabled]);
5754
5755
  return {
5755
5756
  displayChatIcon,
5756
- unreadIndicator: unreadMessages
5757
+ unreadIndicator: hasUnread
5757
5758
  };
5758
5759
  };
5759
5760