@realtimexsco/live-chat 1.4.1 → 1.4.3
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.cjs +97 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +98 -98
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { clsx } from 'clsx';
|
|
|
9
9
|
import { twMerge } from 'tailwind-merge';
|
|
10
10
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
11
|
import { flushSync } from 'react-dom';
|
|
12
|
-
import { Sun, Moon, Search, X, Loader2, UserPlus, ChevronDown, ArrowLeft, Users, WifiOff, Wifi, Sparkles, MessageSquareText, ChevronRight, Pin, Star,
|
|
12
|
+
import { Sun, Moon, Search, X, Loader2, UserPlus, ChevronDown, ArrowLeft, Users, WifiOff, Wifi, Sparkles, MessageSquareText, ChevronRight, Pin, Star, MoreVertical, Info, UserKey, ShieldUser, Paperclip, Clock, MessageSquareX, Trash2, LogOut, Ban, CheckCheck, Check, Camera, Save, Pencil, Mail, CornerUpLeft, CheckSquare, Smile, ChevronLeftIcon, ChevronRightIcon, ChevronDownIcon, MessageCircleMore, History, Shield, Send, AlertCircle, ShieldCheck, UserMinus, MessageCircle, Phone, Video, ExternalLink, Download, ChevronLeft, ZoomOut, ZoomIn, RotateCcw, Music, ArrowRight, MoreHorizontal, PinOff, StarOff, XIcon, ImageIcon, Film, Play, Pause, FileText, FileSpreadsheet, FileIcon, Eye, Captions } from 'lucide-react';
|
|
13
13
|
import { cva } from 'class-variance-authority';
|
|
14
14
|
import EmojiPicker, { Theme } from 'emoji-picker-react';
|
|
15
15
|
import { getDefaultClassNames, DayPicker } from 'react-day-picker';
|
|
@@ -7620,6 +7620,76 @@ var HeaderSearchPopover = ({
|
|
|
7620
7620
|
] });
|
|
7621
7621
|
};
|
|
7622
7622
|
var HeaderSearchPopover_default = HeaderSearchPopover;
|
|
7623
|
+
var actionBtnClass = "size-8 rounded-lg text-(--chat-muted) transition-colors hover:bg-(--chat-surface) hover:text-(--chat-text)";
|
|
7624
|
+
var DefaultHeaderCallActions = ({
|
|
7625
|
+
activeChannel,
|
|
7626
|
+
conversationId,
|
|
7627
|
+
showPhoneCall = true,
|
|
7628
|
+
showVideoCall = true,
|
|
7629
|
+
onPhoneCall,
|
|
7630
|
+
onVideoCall,
|
|
7631
|
+
className
|
|
7632
|
+
}) => {
|
|
7633
|
+
const { components, slotClassName, features } = useChatCustomizationOptional();
|
|
7634
|
+
const PhoneSlot = components.PhoneCallButton;
|
|
7635
|
+
const VideoSlot = components.VideoCallButton;
|
|
7636
|
+
const hideInGroups = features.hideCallActionsInGroupChats ?? false;
|
|
7637
|
+
if (hideInGroups && activeChannel.isGroup) return null;
|
|
7638
|
+
if (!showPhoneCall && !showVideoCall) return null;
|
|
7639
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7640
|
+
showPhoneCall && (PhoneSlot ? /* @__PURE__ */ jsx(
|
|
7641
|
+
PhoneSlot,
|
|
7642
|
+
{
|
|
7643
|
+
activeChannel,
|
|
7644
|
+
conversationId,
|
|
7645
|
+
onPhoneCall,
|
|
7646
|
+
className: cn(className, slotClassName("phoneCallButton"))
|
|
7647
|
+
}
|
|
7648
|
+
) : /* @__PURE__ */ jsx(
|
|
7649
|
+
Button,
|
|
7650
|
+
{
|
|
7651
|
+
variant: "ghost",
|
|
7652
|
+
size: "icon",
|
|
7653
|
+
className: cn(actionBtnClass, className, slotClassName("phoneCallButton")),
|
|
7654
|
+
"aria-label": "Voice call",
|
|
7655
|
+
onClick: onPhoneCall,
|
|
7656
|
+
children: /* @__PURE__ */ jsx(Phone, { size: 15 })
|
|
7657
|
+
}
|
|
7658
|
+
)),
|
|
7659
|
+
showVideoCall && (VideoSlot ? /* @__PURE__ */ jsx(
|
|
7660
|
+
VideoSlot,
|
|
7661
|
+
{
|
|
7662
|
+
activeChannel,
|
|
7663
|
+
conversationId,
|
|
7664
|
+
onVideoCall,
|
|
7665
|
+
className: cn(className, slotClassName("videoCallButton"))
|
|
7666
|
+
}
|
|
7667
|
+
) : /* @__PURE__ */ jsx(
|
|
7668
|
+
Button,
|
|
7669
|
+
{
|
|
7670
|
+
variant: "ghost",
|
|
7671
|
+
size: "icon",
|
|
7672
|
+
className: cn(actionBtnClass, className, slotClassName("videoCallButton")),
|
|
7673
|
+
"aria-label": "Video call",
|
|
7674
|
+
onClick: onVideoCall,
|
|
7675
|
+
children: /* @__PURE__ */ jsx(Video, { size: 15 })
|
|
7676
|
+
}
|
|
7677
|
+
))
|
|
7678
|
+
] });
|
|
7679
|
+
};
|
|
7680
|
+
var HeaderCallActions = (props) => {
|
|
7681
|
+
const { components, slotClassName, features } = useChatCustomizationOptional();
|
|
7682
|
+
const Custom = components.HeaderCallActions;
|
|
7683
|
+
if (!Custom) {
|
|
7684
|
+
const hideInGroups = features.hideCallActionsInGroupChats ?? false;
|
|
7685
|
+
const showPhoneCall = props.showPhoneCall ?? true;
|
|
7686
|
+
const showVideoCall = props.showVideoCall ?? true;
|
|
7687
|
+
if (hideInGroups && props.activeChannel.isGroup) return null;
|
|
7688
|
+
if (!showPhoneCall && !showVideoCall) return null;
|
|
7689
|
+
}
|
|
7690
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex items-center gap-0.5", slotClassName("headerCallActions")), children: Custom ? /* @__PURE__ */ jsx(Custom, { ...props }) : /* @__PURE__ */ jsx(DefaultHeaderCallActions, { ...props }) });
|
|
7691
|
+
};
|
|
7692
|
+
var HeaderCallActions_default = HeaderCallActions;
|
|
7623
7693
|
function OptionsMenuItem({
|
|
7624
7694
|
icon: Icon,
|
|
7625
7695
|
label,
|
|
@@ -7640,6 +7710,7 @@ function OptionsMenuItem({
|
|
|
7640
7710
|
}
|
|
7641
7711
|
var HeaderRightSide = ({
|
|
7642
7712
|
activeChannel,
|
|
7713
|
+
conversationId,
|
|
7643
7714
|
isAdmin,
|
|
7644
7715
|
canViewMembers,
|
|
7645
7716
|
pinnedCount,
|
|
@@ -7669,6 +7740,15 @@ var HeaderRightSide = ({
|
|
|
7669
7740
|
}) => {
|
|
7670
7741
|
const { scopeClassName, themeStyles, showColorModeToggle } = useChatTheme();
|
|
7671
7742
|
const { showDateTimeSettings } = useChatLocale();
|
|
7743
|
+
const features = useChatFeaturesOptional();
|
|
7744
|
+
const showPhoneCall = features.showPhoneCall ?? defaultChatFeatures.showPhoneCall;
|
|
7745
|
+
const showVideoCall = features.showVideoCall ?? defaultChatFeatures.showVideoCall;
|
|
7746
|
+
const handlePhoneCall = () => {
|
|
7747
|
+
features.onPhoneCall?.({ activeChannel, conversationId });
|
|
7748
|
+
};
|
|
7749
|
+
const handleVideoCall = () => {
|
|
7750
|
+
features.onVideoCall?.({ activeChannel, conversationId });
|
|
7751
|
+
};
|
|
7672
7752
|
const headerItemGapClass = "gap-0.5";
|
|
7673
7753
|
const headerIconBtnClass = "inline-flex size-6 shrink-0 items-center justify-center rounded-lg p-0 text-(--chat-muted) transition-colors hover:bg-(--chat-hover) hover:text-(--chat-text) has-[>svg]:p-0";
|
|
7674
7754
|
const headerCountBtnClass = "inline-flex h-7 shrink-0 items-center justify-center gap-0.5 rounded-lg px-1.5 text-(--chat-muted) transition-colors hover:bg-(--chat-hover) hover:text-(--chat-text)";
|
|
@@ -7726,26 +7806,18 @@ var HeaderRightSide = ({
|
|
|
7726
7806
|
triggerClassName: headerIconBtnClass
|
|
7727
7807
|
}
|
|
7728
7808
|
),
|
|
7729
|
-
/* @__PURE__ */ jsx(
|
|
7730
|
-
|
|
7731
|
-
{
|
|
7732
|
-
variant: "ghost",
|
|
7733
|
-
size: "icon-xs",
|
|
7734
|
-
className: cn(headerIconBtnClass, "hidden sm:inline-flex"),
|
|
7735
|
-
"aria-label": "Voice call",
|
|
7736
|
-
children: /* @__PURE__ */ jsx(Phone, { size: 15 })
|
|
7737
|
-
}
|
|
7738
|
-
),
|
|
7739
|
-
/* @__PURE__ */ jsx(
|
|
7740
|
-
Button,
|
|
7809
|
+
/* @__PURE__ */ jsx("div", { className: "hidden sm:contents", children: /* @__PURE__ */ jsx(
|
|
7810
|
+
HeaderCallActions_default,
|
|
7741
7811
|
{
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7812
|
+
activeChannel,
|
|
7813
|
+
conversationId,
|
|
7814
|
+
showPhoneCall,
|
|
7815
|
+
showVideoCall,
|
|
7816
|
+
onPhoneCall: handlePhoneCall,
|
|
7817
|
+
onVideoCall: handleVideoCall,
|
|
7818
|
+
className: headerIconBtnClass
|
|
7747
7819
|
}
|
|
7748
|
-
),
|
|
7820
|
+
) }),
|
|
7749
7821
|
/* @__PURE__ */ jsx("span", { className: headerDividerClass, "aria-hidden": true }),
|
|
7750
7822
|
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
7751
7823
|
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon-xs", className: headerIconBtnClass, "aria-label": "More options", children: /* @__PURE__ */ jsx(MoreVertical, { size: 15 }) }) }),
|
|
@@ -12883,6 +12955,7 @@ var ChannelHeaderView = (props) => {
|
|
|
12883
12955
|
HeaderRightSideSlot,
|
|
12884
12956
|
{
|
|
12885
12957
|
activeChannel,
|
|
12958
|
+
conversationId,
|
|
12886
12959
|
isAdmin,
|
|
12887
12960
|
canViewMembers,
|
|
12888
12961
|
pinnedCount,
|
|
@@ -17644,76 +17717,6 @@ var ChannelListItem2 = (props) => {
|
|
|
17644
17717
|
return /* @__PURE__ */ jsx(ItemSlot, { ...props });
|
|
17645
17718
|
};
|
|
17646
17719
|
var ChannelListItem_default = ChannelListItem2;
|
|
17647
|
-
var actionBtnClass = "size-8 rounded-lg text-(--chat-muted) transition-colors hover:bg-(--chat-surface) hover:text-(--chat-text)";
|
|
17648
|
-
var DefaultHeaderCallActions = ({
|
|
17649
|
-
activeChannel,
|
|
17650
|
-
conversationId,
|
|
17651
|
-
showPhoneCall = true,
|
|
17652
|
-
showVideoCall = true,
|
|
17653
|
-
onPhoneCall,
|
|
17654
|
-
onVideoCall,
|
|
17655
|
-
className
|
|
17656
|
-
}) => {
|
|
17657
|
-
const { components, slotClassName, features } = useChatCustomizationOptional();
|
|
17658
|
-
const PhoneSlot = components.PhoneCallButton;
|
|
17659
|
-
const VideoSlot = components.VideoCallButton;
|
|
17660
|
-
const hideInGroups = features.hideCallActionsInGroupChats ?? false;
|
|
17661
|
-
if (hideInGroups && activeChannel.isGroup) return null;
|
|
17662
|
-
if (!showPhoneCall && !showVideoCall) return null;
|
|
17663
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17664
|
-
showPhoneCall && (PhoneSlot ? /* @__PURE__ */ jsx(
|
|
17665
|
-
PhoneSlot,
|
|
17666
|
-
{
|
|
17667
|
-
activeChannel,
|
|
17668
|
-
conversationId,
|
|
17669
|
-
onPhoneCall,
|
|
17670
|
-
className: cn(className, slotClassName("phoneCallButton"))
|
|
17671
|
-
}
|
|
17672
|
-
) : /* @__PURE__ */ jsx(
|
|
17673
|
-
Button,
|
|
17674
|
-
{
|
|
17675
|
-
variant: "ghost",
|
|
17676
|
-
size: "icon",
|
|
17677
|
-
className: cn(actionBtnClass, className, slotClassName("phoneCallButton")),
|
|
17678
|
-
"aria-label": "Voice call",
|
|
17679
|
-
onClick: onPhoneCall,
|
|
17680
|
-
children: /* @__PURE__ */ jsx(Phone, { size: 15 })
|
|
17681
|
-
}
|
|
17682
|
-
)),
|
|
17683
|
-
showVideoCall && (VideoSlot ? /* @__PURE__ */ jsx(
|
|
17684
|
-
VideoSlot,
|
|
17685
|
-
{
|
|
17686
|
-
activeChannel,
|
|
17687
|
-
conversationId,
|
|
17688
|
-
onVideoCall,
|
|
17689
|
-
className: cn(className, slotClassName("videoCallButton"))
|
|
17690
|
-
}
|
|
17691
|
-
) : /* @__PURE__ */ jsx(
|
|
17692
|
-
Button,
|
|
17693
|
-
{
|
|
17694
|
-
variant: "ghost",
|
|
17695
|
-
size: "icon",
|
|
17696
|
-
className: cn(actionBtnClass, className, slotClassName("videoCallButton")),
|
|
17697
|
-
"aria-label": "Video call",
|
|
17698
|
-
onClick: onVideoCall,
|
|
17699
|
-
children: /* @__PURE__ */ jsx(Video, { size: 15 })
|
|
17700
|
-
}
|
|
17701
|
-
))
|
|
17702
|
-
] });
|
|
17703
|
-
};
|
|
17704
|
-
var HeaderCallActions = (props) => {
|
|
17705
|
-
const { components, slotClassName, features } = useChatCustomizationOptional();
|
|
17706
|
-
const Custom = components.HeaderCallActions;
|
|
17707
|
-
if (!Custom) {
|
|
17708
|
-
const hideInGroups = features.hideCallActionsInGroupChats ?? false;
|
|
17709
|
-
const showPhoneCall = props.showPhoneCall ?? true;
|
|
17710
|
-
const showVideoCall = props.showVideoCall ?? true;
|
|
17711
|
-
if (hideInGroups && props.activeChannel.isGroup) return null;
|
|
17712
|
-
if (!showPhoneCall && !showVideoCall) return null;
|
|
17713
|
-
}
|
|
17714
|
-
return /* @__PURE__ */ jsx("div", { className: slotClassName("headerCallActions"), children: Custom ? /* @__PURE__ */ jsx(Custom, { ...props }) : /* @__PURE__ */ jsx(DefaultHeaderCallActions, { ...props }) });
|
|
17715
|
-
};
|
|
17716
|
-
var HeaderCallActions_default = HeaderCallActions;
|
|
17717
17720
|
|
|
17718
17721
|
// src/chat/packageDefaultComponents.ts
|
|
17719
17722
|
var packageDefaultComponents = {
|
|
@@ -17754,36 +17757,33 @@ var packageDefaultComponents = {
|
|
|
17754
17757
|
init_client();
|
|
17755
17758
|
var PUSH_TOKEN_STORAGE_KEY = "realtimex-push-token";
|
|
17756
17759
|
var SERVICE_WORKER_PATH = "/firebase-messaging-sw.js";
|
|
17757
|
-
var v2Url =
|
|
17758
|
-
const base = (getChatBaseUrl() || String(apiClient.defaults.baseURL || "")).replace(/\/$/, "").replace(/\/v1$/, "/v2");
|
|
17759
|
-
return `${base}${path}`;
|
|
17760
|
-
};
|
|
17760
|
+
var v2Url = "https://realtimex.softwareco.com/api/v2";
|
|
17761
17761
|
var apiGetPushConfig = async () => {
|
|
17762
|
-
const { data } = await apiClient.get(v2Url
|
|
17762
|
+
const { data } = await apiClient.get(`${v2Url}/notifications/push/config`);
|
|
17763
17763
|
return data?.data;
|
|
17764
17764
|
};
|
|
17765
17765
|
var apiRegisterPushToken = async (token, deviceLabel) => {
|
|
17766
|
-
const { data } = await apiClient.post(v2Url
|
|
17766
|
+
const { data } = await apiClient.post(`${v2Url}/notifications/push/token`, {
|
|
17767
17767
|
token,
|
|
17768
17768
|
deviceLabel
|
|
17769
17769
|
});
|
|
17770
17770
|
return data?.data;
|
|
17771
17771
|
};
|
|
17772
17772
|
var apiRemovePushToken = async (token) => {
|
|
17773
|
-
const { data } = await apiClient.delete(v2Url
|
|
17773
|
+
const { data } = await apiClient.delete(`${v2Url}/notifications/push/token`, {
|
|
17774
17774
|
data: { token }
|
|
17775
17775
|
});
|
|
17776
17776
|
return data;
|
|
17777
17777
|
};
|
|
17778
17778
|
var apiGetPushPreference = async () => {
|
|
17779
17779
|
const { data } = await apiClient.get(
|
|
17780
|
-
v2Url
|
|
17780
|
+
`${v2Url}/notifications/push/preference`
|
|
17781
17781
|
);
|
|
17782
17782
|
return data?.data;
|
|
17783
17783
|
};
|
|
17784
17784
|
var apiUpdatePushPreference = async (enabled) => {
|
|
17785
17785
|
const { data } = await apiClient.patch(
|
|
17786
|
-
v2Url
|
|
17786
|
+
`${v2Url}/notifications/push/preference`,
|
|
17787
17787
|
{ enabled }
|
|
17788
17788
|
);
|
|
17789
17789
|
return data?.data;
|