@bikdotai/bik-component-library 0.0.744-beta.14 → 0.0.744-beta.2

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.
Files changed (51) hide show
  1. package/dist/cjs/components/feature-announcements/styles/majorPopup.styles.js +1 -1
  2. package/dist/cjs/components/feature-announcements/types/feature.types.d.ts +0 -5
  3. package/dist/cjs/components/whats-new/WhatsNew.types.d.ts +0 -8
  4. package/dist/cjs/components/whats-new/WhatsNewPanel.js +1 -1
  5. package/dist/cjs/index.d.ts +0 -1
  6. package/dist/cjs/index.js +1 -1
  7. package/dist/esm/components/feature-announcements/styles/majorPopup.styles.js +1 -1
  8. package/dist/esm/components/feature-announcements/types/feature.types.d.ts +0 -5
  9. package/dist/esm/components/whats-new/WhatsNew.types.d.ts +0 -8
  10. package/dist/esm/components/whats-new/WhatsNewPanel.js +1 -1
  11. package/dist/esm/index.d.ts +0 -1
  12. package/dist/esm/index.js +1 -1
  13. package/package.json +1 -1
  14. package/dist/cjs/components/BikGiftedChat/Bubble/Bubble.d.ts +0 -5
  15. package/dist/cjs/components/BikGiftedChat/Bubble/Bubble.js +0 -1
  16. package/dist/cjs/components/BikGiftedChat/Bubble/types.d.ts +0 -25
  17. package/dist/cjs/components/BikGiftedChat/GiftedChat/Day.d.ts +0 -15
  18. package/dist/cjs/components/BikGiftedChat/GiftedChat/Day.js +0 -1
  19. package/dist/cjs/components/BikGiftedChat/GiftedChat/GiftedChat.d.ts +0 -5
  20. package/dist/cjs/components/BikGiftedChat/GiftedChat/GiftedChat.js +0 -1
  21. package/dist/cjs/components/BikGiftedChat/GiftedChat/messageHelpers.d.ts +0 -6
  22. package/dist/cjs/components/BikGiftedChat/GiftedChat/messageHelpers.js +0 -1
  23. package/dist/cjs/components/BikGiftedChat/GiftedChat/scrollHooks.d.ts +0 -10
  24. package/dist/cjs/components/BikGiftedChat/GiftedChat/scrollHooks.js +0 -1
  25. package/dist/cjs/components/BikGiftedChat/GiftedChat/types.d.ts +0 -153
  26. package/dist/cjs/components/BikGiftedChat/GiftedChat/types.js +0 -1
  27. package/dist/cjs/components/BikGiftedChat/GiftedChat/utils.d.ts +0 -22
  28. package/dist/cjs/components/BikGiftedChat/GiftedChat/utils.js +0 -1
  29. package/dist/cjs/components/BikGiftedChat/index.d.ts +0 -5
  30. package/dist/cjs/components/BikGiftedChat/types.d.ts +0 -24
  31. package/dist/cjs/hooks/useWindowSize.d.ts +0 -2
  32. package/dist/cjs/hooks/useWindowSize.js +0 -1
  33. package/dist/esm/components/BikGiftedChat/Bubble/Bubble.d.ts +0 -5
  34. package/dist/esm/components/BikGiftedChat/Bubble/Bubble.js +0 -1
  35. package/dist/esm/components/BikGiftedChat/Bubble/types.d.ts +0 -25
  36. package/dist/esm/components/BikGiftedChat/GiftedChat/Day.d.ts +0 -15
  37. package/dist/esm/components/BikGiftedChat/GiftedChat/Day.js +0 -1
  38. package/dist/esm/components/BikGiftedChat/GiftedChat/GiftedChat.d.ts +0 -5
  39. package/dist/esm/components/BikGiftedChat/GiftedChat/GiftedChat.js +0 -1
  40. package/dist/esm/components/BikGiftedChat/GiftedChat/messageHelpers.d.ts +0 -6
  41. package/dist/esm/components/BikGiftedChat/GiftedChat/messageHelpers.js +0 -1
  42. package/dist/esm/components/BikGiftedChat/GiftedChat/scrollHooks.d.ts +0 -10
  43. package/dist/esm/components/BikGiftedChat/GiftedChat/scrollHooks.js +0 -1
  44. package/dist/esm/components/BikGiftedChat/GiftedChat/types.d.ts +0 -153
  45. package/dist/esm/components/BikGiftedChat/GiftedChat/types.js +0 -1
  46. package/dist/esm/components/BikGiftedChat/GiftedChat/utils.d.ts +0 -22
  47. package/dist/esm/components/BikGiftedChat/GiftedChat/utils.js +0 -1
  48. package/dist/esm/components/BikGiftedChat/index.d.ts +0 -5
  49. package/dist/esm/components/BikGiftedChat/types.d.ts +0 -24
  50. package/dist/esm/hooks/useWindowSize.d.ts +0 -2
  51. package/dist/esm/hooks/useWindowSize.js +0 -1
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./types.js");const t=e=>"ACTIVITY"===(null==e?void 0:e.category),r=e=>"PRIVATE_NOTE"===(null==e?void 0:e.activityType),i=t=>{const r=null==t?void 0:t.activityType;return Object.values(e.CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE).includes(r)},l=e=>t(e)&&!r(e)&&!i(e);exports.getMessagePlacement=(e,r)=>{var s;if(l(e))return"center";if(t(e)&&i(e)){return"INCOMING"===(null===(s=null==e?void 0:e.meta)||void 0===s?void 0:s.callType)?"left":"right"}return r},exports.isCallBubble=i,exports.isChatActivity=t,exports.isPrivateNote=r,exports.shouldCenterAlign=l;
@@ -1,10 +0,0 @@
1
- import { IMessage } from '../types';
2
- import { ScrollState } from './types';
3
- export declare const useScrollToBottom: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>) => () => void;
4
- export declare const useInitialMountScroll: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>, messagesLength: number, scrollToBottom: () => void) => void;
5
- export declare const useScrollCleanup: (scrollState: React.MutableRefObject<ScrollState>) => void;
6
- export declare const useRestoreScrollPosition: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>, messagesLength: number) => void;
7
- export declare const useAutoScrollOnNewMessages: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>, messagesLength: number, scrollToBottom: () => void) => void;
8
- export declare const useResizeObserverForFirstMessage: (firstMessage: IMessage | undefined, scrollState: React.MutableRefObject<ScrollState>, scrollToBottom: () => void, messageIdGenerator?: ((message?: IMessage) => string) | undefined) => void;
9
- export declare const handleInfiniteScroll: (scrollTop: number, scrollHeight: number, state: ScrollState, onEndReached?: () => void, topThreshold?: number) => void;
10
- export declare const useScrollHandler: (scrollState: React.MutableRefObject<ScrollState>, onEndReached?: () => void, onScroll?: ((event: React.UIEvent<HTMLDivElement>) => void) | undefined, topThreshold?: number) => (event: React.UIEvent<HTMLDivElement>) => void;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./utils.js");const t=function(e,t,o,s){let l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:r.TOP_THRESHOLD;if(!s)return;const i=e<=l;if(i&&!o.hasTriggeredEndReached){o.previousScrollHeight=t,o.previousScrollTop=e,o.hasTriggeredEndReached=!0,o.isLoadingOldMessages=!0;try{s()}catch(e){}}else!i&&o.hasTriggeredEndReached&&(o.hasTriggeredEndReached=!1)};exports.handleInfiniteScroll=t,exports.useAutoScrollOnNewMessages=(t,o,s,l)=>{e.useEffect((()=>{const e=!o.current.isInitialMount,s=r.isScrollAtBottom(t.current);e&&s&&l()}),[s])},exports.useInitialMountScroll=(r,t,o,s)=>{e.useLayoutEffect((()=>{r.current&&0!==o&&t.current.isInitialMount&&requestAnimationFrame((()=>{requestAnimationFrame((()=>{s(),t.current.isInitialMount=!1}))}))}),[o])},exports.useResizeObserverForFirstMessage=(r,t,o,s)=>{e.useEffect((()=>{var e,l;if(!r)return;const i=`message-bubble-${null!==(e=r._id)&&void 0!==e?e:`0-${null!==(l=null==s?void 0:s(r))&&void 0!==l?l:"id"}`}`,n=document.getElementById(i);if(!n)return;const c=new ResizeObserver((()=>{t.current.isAtBottom&&o()}));return c.observe(n),()=>{c.disconnect()}}),[null==r?void 0:r._id])},exports.useRestoreScrollPosition=(r,t,o)=>{e.useEffect((()=>{const e=t.current,s=o,l=r.current,i=s>e.lastMessagesLength;if(e.isLoadingOldMessages&&i&&l){const r=l.scrollHeight-e.previousScrollHeight;r>0&&(l.scrollTop=e.previousScrollTop+r),e.isLoadingOldMessages=!1}e.lastMessagesLength=s}),[o])},exports.useScrollCleanup=r=>{e.useEffect((()=>{const e=r.current;return()=>{e.scrollTimeout&&(window.clearTimeout(e.scrollTimeout),e.scrollTimeout=null)}}),[])},exports.useScrollHandler=function(o,s,l){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r.TOP_THRESHOLD;return e.useCallback((e=>{const n=e.currentTarget,{scrollTop:c,scrollHeight:u}=n,a=o.current;a.isUserScrolling=!0,a.scrollTimeout&&window.clearTimeout(a.scrollTimeout),a.scrollTimeout=window.setTimeout((()=>{a.isUserScrolling=!1,a.scrollTimeout=null}),r.SCROLL_IDLE_MS),a.previousScrollTop=c,a.previousScrollHeight=u,a.isAtBottom=r.isScrollAtBottom(n),t(c,u,a,s,i),l&&l(e)}),[o,s,l,i])},exports.useScrollToBottom=(r,t)=>e.useCallback((()=>{const e=r.current;e&&(e.scrollTop=e.scrollHeight,t.current.isAtBottom=!0)}),[]);
@@ -1,153 +0,0 @@
1
- import React from 'react';
2
- import { BubbleProps } from '../Bubble/types';
3
- import { IMessage, LeftRightStyle, User } from '../types';
4
- export interface ListViewProps {
5
- /** Custom styles for the container. */
6
- style?: React.CSSProperties;
7
- /** Callback when end of list is reached. */
8
- onEndReached?: () => void;
9
- /** Threshold for triggering end reached. */
10
- onEndReachedThreshold?: number;
11
- /** Scroll event handler. */
12
- onScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
13
- /** Ref for the scrollable container. */
14
- ref?: React.RefObject<HTMLDivElement> | React.MutableRefObject<HTMLDivElement | null>;
15
- }
16
- export interface AvatarProps<TMessage extends IMessage = IMessage> {
17
- /** The current message for the avatar. */
18
- currentMessage: TMessage;
19
- /** The previous message. */
20
- previousMessage?: TMessage;
21
- /** The next message. */
22
- nextMessage?: TMessage;
23
- /** Position of the avatar ('left' or 'right'). */
24
- position: 'left' | 'right';
25
- /** The user object. */
26
- user: User;
27
- /** Whether to render avatar on top. */
28
- renderAvatarOnTop?: boolean;
29
- /** Whether to show user avatar. */
30
- showUserAvatar?: boolean;
31
- /** Show avatar for every message. */
32
- showAvatarForEveryMessage?: boolean;
33
- /** Custom styles for avatar image. */
34
- imageStyle?: LeftRightStyle<React.CSSProperties>;
35
- /** Custom styles for avatar container. */
36
- containerStyle?: LeftRightStyle<React.CSSProperties>;
37
- [key: string]: any;
38
- }
39
- export interface DayProps {
40
- /** Date/time for the separator. */
41
- createdAt?: Date | number | string;
42
- /** Format for displaying the date. */
43
- dateFormat?: string;
44
- /** Calendar format options. */
45
- dateFormatCalendar?: {
46
- /** Format for same day. */
47
- sameDay?: string;
48
- /** Format for next day. */
49
- nextDay?: string;
50
- /** Format for next week. */
51
- nextWeek?: string;
52
- /** Format for last day. */
53
- lastDay?: string;
54
- /** Format for last week. */
55
- lastWeek?: string;
56
- /** Format for other days. */
57
- sameElse?: string;
58
- };
59
- }
60
- export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
61
- /** Array of chat messages. */
62
- messages: TMessage[];
63
- /** The current user object. */
64
- user: User;
65
- /** Custom bubble renderer. */
66
- renderBubble?: (props: BubbleProps<TMessage>) => React.ReactNode;
67
- /** Custom avatar renderer. */
68
- renderAvatar?: (props: AvatarProps<TMessage>) => React.ReactNode;
69
- /** Custom day separator renderer. */
70
- renderDay?: (props: DayProps) => React.ReactNode;
71
- /** Custom loading renderer. */
72
- renderLoading?: () => React.ReactNode;
73
- /** Custom empty chat renderer. */
74
- renderChatEmpty?: () => React.ReactNode;
75
- /** Props for the scrollable list view. */
76
- listViewProps?: ListViewProps;
77
- /** Scroll threshold for loading old messages. */
78
- topThreshold?: number;
79
- /** Whether to render avatar on top. */
80
- renderAvatarOnTop?: boolean;
81
- /** Whether to show user avatar. */
82
- showUserAvatar?: boolean;
83
- /** Show avatar for every message. */
84
- showAvatarForEveryMessage?: boolean;
85
- /** Whether to invert the message list. */
86
- inverted?: boolean;
87
- /** Handler for long press on message. */
88
- onLongPress?: (context?: any, message?: TMessage) => void;
89
- /** Handler for press on message. */
90
- onPress?: (context?: any, message?: TMessage) => void;
91
- /** Function to generate message IDs. */
92
- messageIdGenerator?: (message?: TMessage) => string;
93
- [key: string]: any;
94
- }
95
- export interface ScrollState {
96
- /** Is initial mount of the component. */
97
- isInitialMount: boolean;
98
- /** Is user currently scrolling. */
99
- isUserScrolling: boolean;
100
- /** Is loading old messages. */
101
- isLoadingOldMessages: boolean;
102
- /** Is scroll at bottom. */
103
- isAtBottom: boolean;
104
- /** Has end reached been triggered. */
105
- hasTriggeredEndReached: boolean;
106
- /** Last known messages length. */
107
- lastMessagesLength: number;
108
- /** Previous scroll height. */
109
- previousScrollHeight: number;
110
- /** Previous scroll top position. */
111
- previousScrollTop: number;
112
- /** Debounce timer for scroll events. */
113
- scrollTimeout: number | null;
114
- }
115
- export declare enum CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE {
116
- /** User is calling another user. */
117
- CALLING_CALL = "CALLING_CALL",
118
- /** Call is ringing for the recipient. */
119
- RINGING_CALL = "RINGING_CALL",
120
- /** Call is ongoing between users. */
121
- ONGOING_CALL = "ONGOING_CALL",
122
- /** Call has been completed. */
123
- COMPLETED_CALL = "COMPLETED_CALL",
124
- /** Call was missed by the recipient. */
125
- MISSED_CALL = "MISSED_CALL",
126
- /** Callback was requested. */
127
- REQUESTED_CALLBACK = "REQUESTED_CALLBACK",
128
- /** Call was declined by the recipient. */
129
- DECLINED_CALL = "DECLINED_CALL",
130
- /** Call was disconnected. */
131
- DISCONNECTED_CALL = "DISCONNECTED_CALL",
132
- /** Call was unanswered. */
133
- UNANSWERED_CALL = "UNANSWERED_CALL"
134
- }
135
- export declare const enum MESSAGE_CHANNELS {
136
- INSTAGRAM = "instagram",
137
- MESSENGER = "messenger",
138
- WHATSAPP = "whatsapp",
139
- GMAIL = "gmail",
140
- LIVECHAT = "livechat",
141
- GOOGLE_BUSINESS_CHAT = "gbm",
142
- SHOPIFY = "shopify",
143
- FACEBOOK = "facebook",
144
- EMAIL = "email",
145
- SMTP = "smtp",
146
- FACEBOOK_CATALOG = "facebook-catalog",
147
- WHATSAPP_VOICE_CALL = "whatsapp-voice-call",
148
- CREATE_SIGNATURE = "create-signature",
149
- EDIT_SIGNATURE = "edit-signature",
150
- WEBPUSH = "webpush",
151
- TASKS = "tasks",
152
- RCS = "rcs"
153
- }
@@ -1 +0,0 @@
1
- "use strict";var L,A;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE=void 0,(L=exports.CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE||(exports.CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE={})).CALLING_CALL="CALLING_CALL",L.RINGING_CALL="RINGING_CALL",L.ONGOING_CALL="ONGOING_CALL",L.COMPLETED_CALL="COMPLETED_CALL",L.MISSED_CALL="MISSED_CALL",L.REQUESTED_CALLBACK="REQUESTED_CALLBACK",L.DECLINED_CALL="DECLINED_CALL",L.DISCONNECTED_CALL="DISCONNECTED_CALL",L.UNANSWERED_CALL="UNANSWERED_CALL",exports.MESSAGE_CHANNELS=void 0,(A=exports.MESSAGE_CHANNELS||(exports.MESSAGE_CHANNELS={})).INSTAGRAM="instagram",A.MESSENGER="messenger",A.WHATSAPP="whatsapp",A.GMAIL="gmail",A.LIVECHAT="livechat",A.GOOGLE_BUSINESS_CHAT="gbm",A.SHOPIFY="shopify",A.FACEBOOK="facebook",A.EMAIL="email",A.SMTP="smtp",A.FACEBOOK_CATALOG="facebook-catalog",A.WHATSAPP_VOICE_CALL="whatsapp-voice-call",A.CREATE_SIGNATURE="create-signature",A.EDIT_SIGNATURE="edit-signature",A.WEBPUSH="webpush",A.TASKS="tasks",A.RCS="rcs";
@@ -1,22 +0,0 @@
1
- /// <reference types="react" />
2
- import { IMessage } from '../types';
3
- export declare const BOTTOM_THRESHOLD = 100;
4
- export declare const TOP_THRESHOLD = 600;
5
- export declare const SCROLL_IDLE_MS = 300;
6
- export declare const Constants: {
7
- readonly ChatActivity: {
8
- readonly Category: {
9
- readonly ACTIVITY: "ACTIVITY";
10
- readonly MESSAGE: "MESSAGE";
11
- };
12
- readonly Type: {
13
- readonly PRIVATE_NOTE: "PRIVATE_NOTE";
14
- readonly CALL: "CALL";
15
- readonly AUTOMATION: "AUTOMATION";
16
- };
17
- };
18
- };
19
- export declare const isSameDay: (a?: IMessage, b?: IMessage) => boolean;
20
- export declare const normalizeRef: <T>(ref: import("react").Ref<T> | undefined, fallback: import("react").RefObject<T>) => import("react").MutableRefObject<T | null>;
21
- export declare const isScrollAtBottom: (el: HTMLDivElement | null) => boolean;
22
- export declare const isStringifiedArray: (value: any) => [boolean, [] | null];
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("date-fns");exports.BOTTOM_THRESHOLD=100,exports.Constants={ChatActivity:{Category:{ACTIVITY:"ACTIVITY",MESSAGE:"MESSAGE"},Type:{PRIVATE_NOTE:"PRIVATE_NOTE",CALL:"CALL",AUTOMATION:"AUTOMATION"}}},exports.SCROLL_IDLE_MS=300,exports.TOP_THRESHOLD=600,exports.isSameDay=(e,r)=>!(!(null==e?void 0:e.createdAt)||!(null==r?void 0:r.createdAt))&&t.isSameDay(new Date(e.createdAt),new Date(r.createdAt)),exports.isScrollAtBottom=t=>{if(!t)return!1;const{scrollTop:e,scrollHeight:r,clientHeight:n}=t;return e+n>=r-100},exports.isStringifiedArray=t=>{try{const e="string"==typeof t?JSON.parse(t):t;return[Array.isArray(e),e]}catch(t){return[!1,null]}},exports.normalizeRef=(t,e)=>{if(!t)return e;if("object"==typeof t&&null!==t&&"current"in t)return t;if("function"==typeof t){const r={current:e.current};return t(e.current),r}return e};
@@ -1,5 +0,0 @@
1
- export type { IMessage, User, LeftRightStyle } from './types';
2
- export { default as BikGiftedChat } from './GiftedChat/GiftedChat';
3
- export { Bubble } from './Bubble/Bubble';
4
- export type { BubbleProps } from './Bubble/types';
5
- export type { GiftedChatProps, DayProps, AvatarProps as GiftedChatAvatarProps, ListViewProps, ScrollState, } from './GiftedChat/types';
@@ -1,24 +0,0 @@
1
- export interface User {
2
- _id: string | number;
3
- name?: string;
4
- avatar?: string | number;
5
- [key: string]: any;
6
- }
7
- export interface IMessage<TUser extends User = User> {
8
- _id: string | number;
9
- text: string;
10
- createdAt: Date | number | string;
11
- user: TUser;
12
- image?: string;
13
- video?: string;
14
- audio?: string;
15
- system?: boolean;
16
- sent?: boolean;
17
- received?: boolean;
18
- pending?: boolean;
19
- [key: string]: any;
20
- }
21
- export interface LeftRightStyle<T> {
22
- left?: T;
23
- right?: T;
24
- }
@@ -1,2 +0,0 @@
1
- export declare const useWindowSize: () => boolean;
2
- export declare const useWindowWidth: () => number;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");exports.useWindowSize=()=>{var n;const[t,i]=e.useState("undefined"!=typeof window&&(null===(n=null===window||void 0===window?void 0:window.document)||void 0===n?void 0:n.body.clientWidth)<767||!1);let d;return d="undefined"==typeof window?e.useEffect:e.useLayoutEffect,d((()=>{function e(){i(window.document.body.clientWidth<767)}return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)}),[]),t};
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { IMessage } from '../types';
3
- import { BubbleProps } from './types';
4
- export declare const Bubble: <TMessage extends IMessage<import("../types").User> = IMessage<import("../types").User>>(props: BubbleProps<TMessage>) => React.ReactElement;
5
- export default Bubble;
@@ -1 +0,0 @@
1
- import{jsxs as e,jsx as i}from"react/jsx-runtime";import n,{useMemo as t,useCallback as a}from"react";import{COLORS as l}from"../../../constants/Theme.js";import{useWindowSize as o}from"../../../hooks/useWindowSize.js";import{MESSAGE_CHANNELS as r}from"../GiftedChat/types.js";import{Constants as d,isStringifiedArray as s}from"../GiftedChat/utils.js";const c=n=>{var c,u,v,g;const{currentMessage:m,position:f,renderMessageText:h,renderTicks:y,renderTime:b,renderCustomView:p,isCustomViewBottom:T,isUnsatisfactoryMessageFn:j,messagesGroupedByAiTraceId:I}=n,x=o(),k=m,A=t((()=>k.category===d.ChatActivity.Category.ACTIVITY&&k.activityType===d.ChatActivity.Type.PRIVATE_NOTE),[k.category,k.activityType]),C=t((()=>{const[e,i]=s(null==k?void 0:k.message);return e&&i&&Array.isArray(i)}),[null==k?void 0:k.message]),O=t((()=>{var e,i,n;const t={borderRadius:8,minHeight:20,margin:0,flexGrow:x?1:0},a=(null==k?void 0:k.channelId)===r.GMAIL||(null==k?void 0:k.channelName)===r.GMAIL,o=(null==k?void 0:k.channelId)===r.SMTP||(null==k?void 0:k.channelName)===r.SMTP;let d={};if("left"===f)d=Object.assign(Object.assign({},x||a||o?{maxWidth:"100%"}:{}),A?{background:(null===(e=null==k?void 0:k.meta)||void 0===e?void 0:e.aiUsed)?"linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)":l.background.warning.light}:{backgroundColor:(null==k?void 0:k.isPrivateMail)?l.background.blue.light:l.surface.hovered});else if("right"===f){const e=j&&j({aiTraceId:null===(i=k.eventProperties)||void 0===i?void 0:i.aiTraceId,messagesGroupedByAiTraceId:I});d=Object.assign(Object.assign({backgroundColor:"failed"===k.status||e?l.background.negative.light:l.background.brandVeryLight},A?{background:(null===(n=null==k?void 0:k.meta)||void 0===n?void 0:n.aiUsed)?"linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)":l.background.warning.light}:{}),!x&&C?{maxWidth:500}:{})}return Object.assign(Object.assign({},t),d)}),[null==k?void 0:k.channelId,null==k?void 0:k.channelName,null===(c=null==k?void 0:k.meta)||void 0===c?void 0:c.aiUsed,null==k?void 0:k.status,null===(u=null==k?void 0:k.eventProperties)||void 0===u?void 0:u.aiTraceId,f,x,A,C,j,I,null==k?void 0:k.isPrivateMail]),M=a((()=>e("div",{children:[!T&&(null==p?void 0:p(n)),null==h?void 0:h(n),T&&(null==p?void 0:p(n))]})),[T,p,h,n]);return i("div",Object.assign({style:{display:"flex",marginTop:6,marginBottom:(null===(g=null===(v=null==m?void 0:m.messageInformation)||void 0===v?void 0:v.reactions)||void 0===g?void 0:g.length)>0?24:6,flexGrow:x?1:0}},{children:i("div",Object.assign({style:O},{children:e("div",{children:[i("div",Object.assign({id:m.chatActivityId||`message-${m.psqlId}`},{children:M()})),e("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",marginLeft:"32px"}},{children:[null==b?void 0:b(n),null==y?void 0:y(m)]}))]})}))}))},u=n.memo(c);export{u as Bubble,u as default};
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import { IMessage, User } from '../types';
3
- export interface BubbleProps<TMessage extends IMessage = IMessage> {
4
- currentMessage: TMessage;
5
- previousMessage?: TMessage;
6
- nextMessage?: TMessage;
7
- position: 'left' | 'right';
8
- user: User;
9
- tickStyle?: React.CSSProperties;
10
- usernameStyle?: React.CSSProperties;
11
- renderMessageText?: (props: BubbleProps<TMessage>) => React.ReactNode;
12
- renderTicks?: (currentMessage: TMessage) => React.ReactNode;
13
- renderTime?: (props: BubbleProps<TMessage>) => React.ReactNode;
14
- renderCustomView?: (props: BubbleProps<TMessage>) => React.ReactNode;
15
- renderUsername?: (props: BubbleProps<TMessage>) => React.ReactNode;
16
- onPress?: (context?: any, message?: TMessage) => void;
17
- onLongPress?: (context?: any, message?: TMessage) => void;
18
- isCustomViewBottom?: boolean;
19
- renderUsernameOnMessage?: boolean;
20
- isUnsatisfactoryMessageFn?: (params: {
21
- aiTraceId?: string;
22
- messagesGroupedByAiTraceId?: any;
23
- }) => boolean;
24
- messagesGroupedByAiTraceId?: any;
25
- }
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- export interface DayProps {
3
- createdAt?: Date | number | string;
4
- dateFormat?: string;
5
- dateFormatCalendar?: {
6
- sameDay?: string;
7
- nextDay?: string;
8
- nextWeek?: string;
9
- lastDay?: string;
10
- lastWeek?: string;
11
- sameElse?: string;
12
- };
13
- }
14
- export declare const Day: React.NamedExoticComponent<DayProps>;
15
- export default Day;
@@ -1 +0,0 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{startOfDay as r,isSameYear as n,format as o,differenceInDays as a}from"date-fns";import s,{useMemo as i}from"react";import{COLORS as l}from"../../../constants/Theme.js";import{BodyCaption as d}from"../../TypographyStyle.js";const p=s=>{let{createdAt:p,dateFormat:m="D MMMM YY",dateFormatCalendar:y}=s;const c=i((()=>{if(null==p)return null;const e=r(new Date);let t;if("number"==typeof p)t=r(new Date(p));else if(p instanceof Date)t=r(p);else{if("string"!=typeof p)return null;t=r(new Date(p))}if(!n(e,t))return o(t,"EEEE, d MMMM yy");const s=a(e,t);return s<1?(null==y?void 0:y.sameDay)?y.sameDay.replace(/\[|\]/g,""):"Today":1===s?"Yesterday":o(t,"EEEE, d MMMM yy")}),[p,m,y]);return c?e("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",margin:"12px 0px 12px 8px"}},{children:[t("div",{style:{flex:1,height:"1px",backgroundColor:l.stroke.primary}}),t("div",Object.assign({style:{border:`1px solid ${l.stroke.primary}`,borderRadius:"16px",padding:"4px 12px"}},{children:t(d,Object.assign({style:{color:l.content.secondary}},{children:c}))})),t("div",{style:{flex:1,height:"1px",backgroundColor:l.stroke.primary}})]})):null},m=s.memo(p);export{m as Day,m as default};
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { IMessage } from '../types';
3
- import { GiftedChatProps } from './types';
4
- declare const _default: React.ForwardRefExoticComponent<Omit<GiftedChatProps<IMessage<import("../types").User>>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
- export default _default;
@@ -1 +0,0 @@
1
- import{__rest as e}from"../../../_virtual/_tslib.js";import{jsx as r,Fragment as t,jsxs as s}from"react/jsx-runtime";import i,{forwardRef as n,useRef as o,useMemo as a,useImperativeHandle as l,useCallback as d}from"react";import{COLORS as g}from"../../../constants/Theme.js";import{useWindowSize as c}from"../../../hooks/useWindowSize.js";import{BodySecondary as u}from"../../TypographyStyle.js";import{Day as v}from"./Day.js";import{getMessagePlacement as h,shouldCenterAlign as m}from"./messageHelpers.js";import{useScrollToBottom as p,useInitialMountScroll as f,useScrollCleanup as y,useRestoreScrollPosition as b,useAutoScrollOnNewMessages as j,useResizeObserverForFirstMessage as x,useScrollHandler as A}from"./scrollHooks.js";import{MESSAGE_CHANNELS as O}from"./types.js";import{normalizeRef as T,isSameDay as w,Constants as M,TOP_THRESHOLD as _}from"./utils.js";var E=n(((n,E)=>{var S;const C=n||{},{messages:k=[],user:I,renderBubble:L,renderAvatar:B,renderDay:R,renderLoading:D,renderChatEmpty:P,listViewProps:$={},renderAvatarOnTop:F=!1,showUserAvatar:U=!1,showAvatarForEveryMessage:V=!1,inverted:G=!1,messageIdGenerator:H,topThreshold:N=_}=C,W=e(C,["messages","user","renderBubble","renderAvatar","renderDay","renderLoading","renderChatEmpty","listViewProps","renderAvatarOnTop","showUserAvatar","showAvatarForEveryMessage","inverted","messageIdGenerator","topThreshold"]),Y=c(),z=o(null),X=T($.ref||E,z),q=o({isInitialMount:!0,isUserScrolling:!1,isLoadingOldMessages:!1,isAtBottom:!0,hasTriggeredEndReached:!1,lastMessagesLength:null!==(S=null==k?void 0:k.length)&&void 0!==S?S:0,previousScrollHeight:0,previousScrollTop:0,scrollTimeout:null}),J=a((()=>k&&0!==k.length?[...k].reverse():[]),[k]),K=p(X,q);l(E,(()=>X.current)),f(X,q,J.length,K),y(q),b(X,q,J.length),j(X,q,k.length,K),x(null==k?void 0:k[0],q,K,H);const Q=A(q,$.onEndReached,$.onScroll,N),Z=d((e=>{var r;return Boolean(e&&I&&(null===(r=e.user)||void 0===r?void 0:r._id)===I._id)}),[I]),ee=d(((e,r)=>!!U&&(!!V||(!r||r.user._id!==e.user._id))),[U,V]),re=d(((e,t,s)=>{const i=Z(e)?"right":"left",n=Object.assign({currentMessage:e,previousMessage:t,nextMessage:s,position:i,user:I},W);return L?L(n):r("div",Object.assign({style:{maxWidth:"70%",width:"fit-content",padding:"8px 12px",borderRadius:4,backgroundColor:"right"===i?g.background.brandLight:g.background.inactive,color:g.content.primary,wordBreak:"break-word"}},{children:r(u,{children:e.text})}))}),[Z,I,L,W]),te=d(((e,r,t)=>{if(!ee(e,t))return null;const s=Z(e)?"right":"left";return B?B({currentMessage:e,previousMessage:r,nextMessage:t,position:s,user:I,renderAvatarOnTop:F,showUserAvatar:U,showAvatarForEveryMessage:V}):null}),[ee,Z,I,F,U,V,B]);return k&&0!==k.length?s("div",Object.assign({ref:X,style:Object.assign({flex:1,overflowY:"auto",overflowX:"hidden",display:"flex",flexDirection:"column"},$.style),onScroll:Q},{children:[r("div",{style:{flex:"1 0 auto"}}),r("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:"0 0 auto"}},{children:J.map(((e,t)=>{var n,o,a,l,d;const g=Z(e)?"right":"left",c=J[t-1],u=J[t+1],p=!w(e,c),f=h(e,g),y=m(e),b=(null==e?void 0:e.channelId)===O.SMTP||(null==e?void 0:e.channelName)===O.SMTP,j=e.category===M.ChatActivity.Category.ACTIVITY&&e.activityType===M.ChatActivity.Type.PRIVATE_NOTE;return s(i.Fragment,{children:[p&&(R?R({createdAt:e.createdAt}):r(v,{createdAt:e.createdAt})),s("div",Object.assign({style:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Y?{margin:"0 4px"}:{}),y?{}:{display:"flex"}),Y||2!==(null===(n=null==e?void 0:e.user)||void 0===n?void 0:n._id)?{marginRight:8}:{marginLeft:8}),b&&!j&&Y?{marginLeft:8,marginRight:8}:{}),{justifyContent:f,marginBottom:8})},{children:[!Y&&"left"===g&&r("div",Object.assign({style:{margin:"0 8px"}},{children:te(e,c,u)})),r("div",Object.assign({id:`message-bubble-${null!==(o=e._id)&&void 0!==o?o:`${t}-${null!==(a=null==H?void 0:H())&&void 0!==a?a:"id"}`}`,style:Y&&b?{display:"flex",flexGrow:1}:{}},{children:re(e,c,u)})),!Y&&"right"===g&&r("div",Object.assign({style:{margin:"0 8px"}},{children:te(e,c,u)}))]}))]},null!==(l=e._id)&&void 0!==l?l:`${t}-${null!==(d=null==H?void 0:H())&&void 0!==d?d:"id"}`)}))}))]})):P?r(t,{children:P()}):null}));export{E as default};
@@ -1,6 +0,0 @@
1
- import { IMessage } from '../types';
2
- export declare const isChatActivity: (message: IMessage) => boolean;
3
- export declare const isPrivateNote: (message: IMessage) => boolean;
4
- export declare const isCallBubble: (message: IMessage) => boolean;
5
- export declare const shouldCenterAlign: (message: IMessage) => boolean;
6
- export declare const getMessagePlacement: (message: IMessage, defaultPosition: 'left' | 'right') => 'left' | 'right' | 'center';
@@ -1 +0,0 @@
1
- import{CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE as t}from"./types.js";const e=t=>"ACTIVITY"===(null==t?void 0:t.category),i=t=>"PRIVATE_NOTE"===(null==t?void 0:t.activityType),l=e=>{const i=null==e?void 0:e.activityType;return Object.values(t).includes(i)},r=t=>e(t)&&!i(t)&&!l(t),n=(t,i)=>{var n;if(r(t))return"center";if(e(t)&&l(t)){return"INCOMING"===(null===(n=null==t?void 0:t.meta)||void 0===n?void 0:n.callType)?"left":"right"}return i};export{n as getMessagePlacement,l as isCallBubble,e as isChatActivity,i as isPrivateNote,r as shouldCenterAlign};
@@ -1,10 +0,0 @@
1
- import { IMessage } from '../types';
2
- import { ScrollState } from './types';
3
- export declare const useScrollToBottom: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>) => () => void;
4
- export declare const useInitialMountScroll: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>, messagesLength: number, scrollToBottom: () => void) => void;
5
- export declare const useScrollCleanup: (scrollState: React.MutableRefObject<ScrollState>) => void;
6
- export declare const useRestoreScrollPosition: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>, messagesLength: number) => void;
7
- export declare const useAutoScrollOnNewMessages: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>, messagesLength: number, scrollToBottom: () => void) => void;
8
- export declare const useResizeObserverForFirstMessage: (firstMessage: IMessage | undefined, scrollState: React.MutableRefObject<ScrollState>, scrollToBottom: () => void, messageIdGenerator?: ((message?: IMessage) => string) | undefined) => void;
9
- export declare const handleInfiniteScroll: (scrollTop: number, scrollHeight: number, state: ScrollState, onEndReached?: () => void, topThreshold?: number) => void;
10
- export declare const useScrollHandler: (scrollState: React.MutableRefObject<ScrollState>, onEndReached?: () => void, onScroll?: ((event: React.UIEvent<HTMLDivElement>) => void) | undefined, topThreshold?: number) => (event: React.UIEvent<HTMLDivElement>) => void;
@@ -1 +0,0 @@
1
- import{useCallback as e,useLayoutEffect as r,useEffect as o}from"react";import{isScrollAtBottom as t,SCROLL_IDLE_MS as i,TOP_THRESHOLD as s}from"./utils.js";const l=(r,o)=>e((()=>{const e=r.current;e&&(e.scrollTop=e.scrollHeight,o.current.isAtBottom=!0)}),[]),n=(e,o,t,i)=>{r((()=>{e.current&&0!==t&&o.current.isInitialMount&&requestAnimationFrame((()=>{requestAnimationFrame((()=>{i(),o.current.isInitialMount=!1}))}))}),[t])},c=e=>{o((()=>{const r=e.current;return()=>{r.scrollTimeout&&(window.clearTimeout(r.scrollTimeout),r.scrollTimeout=null)}}),[])},u=(e,r,t)=>{o((()=>{const o=r.current,i=t,s=e.current,l=i>o.lastMessagesLength;if(o.isLoadingOldMessages&&l&&s){const e=s.scrollHeight-o.previousScrollHeight;e>0&&(s.scrollTop=o.previousScrollTop+e),o.isLoadingOldMessages=!1}o.lastMessagesLength=i}),[t])},d=(e,r,i,s)=>{o((()=>{const o=!r.current.isInitialMount,i=t(e.current);o&&i&&s()}),[i])},a=(e,r,t,i)=>{o((()=>{var o,s;if(!e)return;const l=`message-bubble-${null!==(o=e._id)&&void 0!==o?o:`0-${null!==(s=null==i?void 0:i(e))&&void 0!==s?s:"id"}`}`,n=document.getElementById(l);if(!n)return;const c=new ResizeObserver((()=>{r.current.isAtBottom&&t()}));return c.observe(n),()=>{c.disconnect()}}),[null==e?void 0:e._id])},g=function(e,r,o,t){if(!t)return;const i=e<=(arguments.length>4&&void 0!==arguments[4]?arguments[4]:s);if(i&&!o.hasTriggeredEndReached){o.previousScrollHeight=r,o.previousScrollTop=e,o.hasTriggeredEndReached=!0,o.isLoadingOldMessages=!0;try{t()}catch(e){}}else!i&&o.hasTriggeredEndReached&&(o.hasTriggeredEndReached=!1)},m=function(r,o,l){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s;return e((e=>{const s=e.currentTarget,{scrollTop:c,scrollHeight:u}=s,d=r.current;d.isUserScrolling=!0,d.scrollTimeout&&window.clearTimeout(d.scrollTimeout),d.scrollTimeout=window.setTimeout((()=>{d.isUserScrolling=!1,d.scrollTimeout=null}),i),d.previousScrollTop=c,d.previousScrollHeight=u,d.isAtBottom=t(s),g(c,u,d,o,n),l&&l(e)}),[r,o,l,n])};export{g as handleInfiniteScroll,d as useAutoScrollOnNewMessages,n as useInitialMountScroll,a as useResizeObserverForFirstMessage,u as useRestoreScrollPosition,c as useScrollCleanup,m as useScrollHandler,l as useScrollToBottom};
@@ -1,153 +0,0 @@
1
- import React from 'react';
2
- import { BubbleProps } from '../Bubble/types';
3
- import { IMessage, LeftRightStyle, User } from '../types';
4
- export interface ListViewProps {
5
- /** Custom styles for the container. */
6
- style?: React.CSSProperties;
7
- /** Callback when end of list is reached. */
8
- onEndReached?: () => void;
9
- /** Threshold for triggering end reached. */
10
- onEndReachedThreshold?: number;
11
- /** Scroll event handler. */
12
- onScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
13
- /** Ref for the scrollable container. */
14
- ref?: React.RefObject<HTMLDivElement> | React.MutableRefObject<HTMLDivElement | null>;
15
- }
16
- export interface AvatarProps<TMessage extends IMessage = IMessage> {
17
- /** The current message for the avatar. */
18
- currentMessage: TMessage;
19
- /** The previous message. */
20
- previousMessage?: TMessage;
21
- /** The next message. */
22
- nextMessage?: TMessage;
23
- /** Position of the avatar ('left' or 'right'). */
24
- position: 'left' | 'right';
25
- /** The user object. */
26
- user: User;
27
- /** Whether to render avatar on top. */
28
- renderAvatarOnTop?: boolean;
29
- /** Whether to show user avatar. */
30
- showUserAvatar?: boolean;
31
- /** Show avatar for every message. */
32
- showAvatarForEveryMessage?: boolean;
33
- /** Custom styles for avatar image. */
34
- imageStyle?: LeftRightStyle<React.CSSProperties>;
35
- /** Custom styles for avatar container. */
36
- containerStyle?: LeftRightStyle<React.CSSProperties>;
37
- [key: string]: any;
38
- }
39
- export interface DayProps {
40
- /** Date/time for the separator. */
41
- createdAt?: Date | number | string;
42
- /** Format for displaying the date. */
43
- dateFormat?: string;
44
- /** Calendar format options. */
45
- dateFormatCalendar?: {
46
- /** Format for same day. */
47
- sameDay?: string;
48
- /** Format for next day. */
49
- nextDay?: string;
50
- /** Format for next week. */
51
- nextWeek?: string;
52
- /** Format for last day. */
53
- lastDay?: string;
54
- /** Format for last week. */
55
- lastWeek?: string;
56
- /** Format for other days. */
57
- sameElse?: string;
58
- };
59
- }
60
- export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
61
- /** Array of chat messages. */
62
- messages: TMessage[];
63
- /** The current user object. */
64
- user: User;
65
- /** Custom bubble renderer. */
66
- renderBubble?: (props: BubbleProps<TMessage>) => React.ReactNode;
67
- /** Custom avatar renderer. */
68
- renderAvatar?: (props: AvatarProps<TMessage>) => React.ReactNode;
69
- /** Custom day separator renderer. */
70
- renderDay?: (props: DayProps) => React.ReactNode;
71
- /** Custom loading renderer. */
72
- renderLoading?: () => React.ReactNode;
73
- /** Custom empty chat renderer. */
74
- renderChatEmpty?: () => React.ReactNode;
75
- /** Props for the scrollable list view. */
76
- listViewProps?: ListViewProps;
77
- /** Scroll threshold for loading old messages. */
78
- topThreshold?: number;
79
- /** Whether to render avatar on top. */
80
- renderAvatarOnTop?: boolean;
81
- /** Whether to show user avatar. */
82
- showUserAvatar?: boolean;
83
- /** Show avatar for every message. */
84
- showAvatarForEveryMessage?: boolean;
85
- /** Whether to invert the message list. */
86
- inverted?: boolean;
87
- /** Handler for long press on message. */
88
- onLongPress?: (context?: any, message?: TMessage) => void;
89
- /** Handler for press on message. */
90
- onPress?: (context?: any, message?: TMessage) => void;
91
- /** Function to generate message IDs. */
92
- messageIdGenerator?: (message?: TMessage) => string;
93
- [key: string]: any;
94
- }
95
- export interface ScrollState {
96
- /** Is initial mount of the component. */
97
- isInitialMount: boolean;
98
- /** Is user currently scrolling. */
99
- isUserScrolling: boolean;
100
- /** Is loading old messages. */
101
- isLoadingOldMessages: boolean;
102
- /** Is scroll at bottom. */
103
- isAtBottom: boolean;
104
- /** Has end reached been triggered. */
105
- hasTriggeredEndReached: boolean;
106
- /** Last known messages length. */
107
- lastMessagesLength: number;
108
- /** Previous scroll height. */
109
- previousScrollHeight: number;
110
- /** Previous scroll top position. */
111
- previousScrollTop: number;
112
- /** Debounce timer for scroll events. */
113
- scrollTimeout: number | null;
114
- }
115
- export declare enum CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE {
116
- /** User is calling another user. */
117
- CALLING_CALL = "CALLING_CALL",
118
- /** Call is ringing for the recipient. */
119
- RINGING_CALL = "RINGING_CALL",
120
- /** Call is ongoing between users. */
121
- ONGOING_CALL = "ONGOING_CALL",
122
- /** Call has been completed. */
123
- COMPLETED_CALL = "COMPLETED_CALL",
124
- /** Call was missed by the recipient. */
125
- MISSED_CALL = "MISSED_CALL",
126
- /** Callback was requested. */
127
- REQUESTED_CALLBACK = "REQUESTED_CALLBACK",
128
- /** Call was declined by the recipient. */
129
- DECLINED_CALL = "DECLINED_CALL",
130
- /** Call was disconnected. */
131
- DISCONNECTED_CALL = "DISCONNECTED_CALL",
132
- /** Call was unanswered. */
133
- UNANSWERED_CALL = "UNANSWERED_CALL"
134
- }
135
- export declare const enum MESSAGE_CHANNELS {
136
- INSTAGRAM = "instagram",
137
- MESSENGER = "messenger",
138
- WHATSAPP = "whatsapp",
139
- GMAIL = "gmail",
140
- LIVECHAT = "livechat",
141
- GOOGLE_BUSINESS_CHAT = "gbm",
142
- SHOPIFY = "shopify",
143
- FACEBOOK = "facebook",
144
- EMAIL = "email",
145
- SMTP = "smtp",
146
- FACEBOOK_CATALOG = "facebook-catalog",
147
- WHATSAPP_VOICE_CALL = "whatsapp-voice-call",
148
- CREATE_SIGNATURE = "create-signature",
149
- EDIT_SIGNATURE = "edit-signature",
150
- WEBPUSH = "webpush",
151
- TASKS = "tasks",
152
- RCS = "rcs"
153
- }
@@ -1 +0,0 @@
1
- var L,A;!function(L){L.CALLING_CALL="CALLING_CALL",L.RINGING_CALL="RINGING_CALL",L.ONGOING_CALL="ONGOING_CALL",L.COMPLETED_CALL="COMPLETED_CALL",L.MISSED_CALL="MISSED_CALL",L.REQUESTED_CALLBACK="REQUESTED_CALLBACK",L.DECLINED_CALL="DECLINED_CALL",L.DISCONNECTED_CALL="DISCONNECTED_CALL",L.UNANSWERED_CALL="UNANSWERED_CALL"}(L||(L={})),function(L){L.INSTAGRAM="instagram",L.MESSENGER="messenger",L.WHATSAPP="whatsapp",L.GMAIL="gmail",L.LIVECHAT="livechat",L.GOOGLE_BUSINESS_CHAT="gbm",L.SHOPIFY="shopify",L.FACEBOOK="facebook",L.EMAIL="email",L.SMTP="smtp",L.FACEBOOK_CATALOG="facebook-catalog",L.WHATSAPP_VOICE_CALL="whatsapp-voice-call",L.CREATE_SIGNATURE="create-signature",L.EDIT_SIGNATURE="edit-signature",L.WEBPUSH="webpush",L.TASKS="tasks",L.RCS="rcs"}(A||(A={}));export{L as CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE,A as MESSAGE_CHANNELS};
@@ -1,22 +0,0 @@
1
- /// <reference types="react" />
2
- import { IMessage } from '../types';
3
- export declare const BOTTOM_THRESHOLD = 100;
4
- export declare const TOP_THRESHOLD = 600;
5
- export declare const SCROLL_IDLE_MS = 300;
6
- export declare const Constants: {
7
- readonly ChatActivity: {
8
- readonly Category: {
9
- readonly ACTIVITY: "ACTIVITY";
10
- readonly MESSAGE: "MESSAGE";
11
- };
12
- readonly Type: {
13
- readonly PRIVATE_NOTE: "PRIVATE_NOTE";
14
- readonly CALL: "CALL";
15
- readonly AUTOMATION: "AUTOMATION";
16
- };
17
- };
18
- };
19
- export declare const isSameDay: (a?: IMessage, b?: IMessage) => boolean;
20
- export declare const normalizeRef: <T>(ref: import("react").Ref<T> | undefined, fallback: import("react").RefObject<T>) => import("react").MutableRefObject<T | null>;
21
- export declare const isScrollAtBottom: (el: HTMLDivElement | null) => boolean;
22
- export declare const isStringifiedArray: (value: any) => [boolean, [] | null];
@@ -1 +0,0 @@
1
- import{isSameDay as t}from"date-fns";const r=100,e=600,n=300,c={ChatActivity:{Category:{ACTIVITY:"ACTIVITY",MESSAGE:"MESSAGE"},Type:{PRIVATE_NOTE:"PRIVATE_NOTE",CALL:"CALL",AUTOMATION:"AUTOMATION"}}},A=(r,e)=>!(!(null==r?void 0:r.createdAt)||!(null==e?void 0:e.createdAt))&&t(new Date(r.createdAt),new Date(e.createdAt)),o=(t,r)=>{if(!t)return r;if("object"==typeof t&&null!==t&&"current"in t)return t;if("function"==typeof t){const e={current:r.current};return t(r.current),e}return r},i=t=>{if(!t)return!1;const{scrollTop:r,scrollHeight:e,clientHeight:n}=t;return r+n>=e-100},u=t=>{try{const r="string"==typeof t?JSON.parse(t):t;return[Array.isArray(r),r]}catch(t){return[!1,null]}};export{r as BOTTOM_THRESHOLD,c as Constants,n as SCROLL_IDLE_MS,e as TOP_THRESHOLD,A as isSameDay,i as isScrollAtBottom,u as isStringifiedArray,o as normalizeRef};
@@ -1,5 +0,0 @@
1
- export type { IMessage, User, LeftRightStyle } from './types';
2
- export { default as BikGiftedChat } from './GiftedChat/GiftedChat';
3
- export { Bubble } from './Bubble/Bubble';
4
- export type { BubbleProps } from './Bubble/types';
5
- export type { GiftedChatProps, DayProps, AvatarProps as GiftedChatAvatarProps, ListViewProps, ScrollState, } from './GiftedChat/types';
@@ -1,24 +0,0 @@
1
- export interface User {
2
- _id: string | number;
3
- name?: string;
4
- avatar?: string | number;
5
- [key: string]: any;
6
- }
7
- export interface IMessage<TUser extends User = User> {
8
- _id: string | number;
9
- text: string;
10
- createdAt: Date | number | string;
11
- user: TUser;
12
- image?: string;
13
- video?: string;
14
- audio?: string;
15
- system?: boolean;
16
- sent?: boolean;
17
- received?: boolean;
18
- pending?: boolean;
19
- [key: string]: any;
20
- }
21
- export interface LeftRightStyle<T> {
22
- left?: T;
23
- right?: T;
24
- }
@@ -1,2 +0,0 @@
1
- export declare const useWindowSize: () => boolean;
2
- export declare const useWindowWidth: () => number;
@@ -1 +0,0 @@
1
- import{useState as n,useEffect as e,useLayoutEffect as o}from"react";const d=()=>{var d;const[i,t]=n("undefined"!=typeof window&&(null===(d=null===window||void 0===window?void 0:window.document)||void 0===d?void 0:d.body.clientWidth)<767||!1);let w;return w="undefined"==typeof window?e:o,w((()=>{function n(){t(window.document.body.clientWidth<767)}return window.addEventListener("resize",n),n(),()=>window.removeEventListener("resize",n)}),[]),i};export{d as useWindowSize};