@bikdotai/bik-component-library 0.0.742-beta.70 → 0.0.742-beta.80

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 (69) hide show
  1. package/dist/cjs/components/TypographyStyle.d.ts +0 -8
  2. package/dist/cjs/components/TypographyStyle.js +13 -14
  3. package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
  4. package/dist/cjs/components/carousel-preview/CarouselPreview.js +1 -1
  5. package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
  6. package/dist/cjs/components/list-item/themes.d.ts +1 -1
  7. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  8. package/dist/cjs/components/toaster/Toaster.d.ts +0 -2
  9. package/dist/cjs/components/toaster/Toaster.js +1 -1
  10. package/dist/cjs/components/toaster/Toaster.styled.js +1 -1
  11. package/dist/cjs/constants/Theme.d.ts +0 -9
  12. package/dist/cjs/constants/Theme.js +1 -1
  13. package/dist/cjs/index.d.ts +0 -1
  14. package/dist/cjs/index.js +1 -1
  15. package/dist/esm/components/TypographyStyle.d.ts +0 -8
  16. package/dist/esm/components/TypographyStyle.js +12 -13
  17. package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
  18. package/dist/esm/components/carousel-preview/CarouselPreview.js +1 -1
  19. package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
  20. package/dist/esm/components/list-item/themes.d.ts +1 -1
  21. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  22. package/dist/esm/components/toaster/Toaster.d.ts +0 -2
  23. package/dist/esm/components/toaster/Toaster.js +1 -1
  24. package/dist/esm/components/toaster/Toaster.styled.js +1 -1
  25. package/dist/esm/constants/Theme.d.ts +0 -9
  26. package/dist/esm/constants/Theme.js +1 -1
  27. package/dist/esm/index.d.ts +0 -1
  28. package/dist/esm/index.js +1 -1
  29. package/package.json +1 -1
  30. package/dist/cjs/components/BikGiftedChat/Bubble/Bubble.d.ts +0 -5
  31. package/dist/cjs/components/BikGiftedChat/Bubble/Bubble.js +0 -1
  32. package/dist/cjs/components/BikGiftedChat/Bubble/types.d.ts +0 -38
  33. package/dist/cjs/components/BikGiftedChat/Bubble/types.js +0 -1
  34. package/dist/cjs/components/BikGiftedChat/GiftedChat/Day.d.ts +0 -17
  35. package/dist/cjs/components/BikGiftedChat/GiftedChat/Day.js +0 -1
  36. package/dist/cjs/components/BikGiftedChat/GiftedChat/GiftedChat.d.ts +0 -5
  37. package/dist/cjs/components/BikGiftedChat/GiftedChat/GiftedChat.js +0 -1
  38. package/dist/cjs/components/BikGiftedChat/GiftedChat/messageHelpers.d.ts +0 -6
  39. package/dist/cjs/components/BikGiftedChat/GiftedChat/messageHelpers.js +0 -1
  40. package/dist/cjs/components/BikGiftedChat/GiftedChat/scrollHooks.d.ts +0 -10
  41. package/dist/cjs/components/BikGiftedChat/GiftedChat/scrollHooks.js +0 -1
  42. package/dist/cjs/components/BikGiftedChat/GiftedChat/types.d.ts +0 -154
  43. package/dist/cjs/components/BikGiftedChat/GiftedChat/types.js +0 -1
  44. package/dist/cjs/components/BikGiftedChat/GiftedChat/utils.d.ts +0 -22
  45. package/dist/cjs/components/BikGiftedChat/GiftedChat/utils.js +0 -1
  46. package/dist/cjs/components/BikGiftedChat/index.d.ts +0 -5
  47. package/dist/cjs/components/BikGiftedChat/types.d.ts +0 -24
  48. package/dist/cjs/hooks/useWindowSize.d.ts +0 -2
  49. package/dist/cjs/hooks/useWindowSize.js +0 -1
  50. package/dist/esm/components/BikGiftedChat/Bubble/Bubble.d.ts +0 -5
  51. package/dist/esm/components/BikGiftedChat/Bubble/Bubble.js +0 -1
  52. package/dist/esm/components/BikGiftedChat/Bubble/types.d.ts +0 -38
  53. package/dist/esm/components/BikGiftedChat/Bubble/types.js +0 -1
  54. package/dist/esm/components/BikGiftedChat/GiftedChat/Day.d.ts +0 -17
  55. package/dist/esm/components/BikGiftedChat/GiftedChat/Day.js +0 -1
  56. package/dist/esm/components/BikGiftedChat/GiftedChat/GiftedChat.d.ts +0 -5
  57. package/dist/esm/components/BikGiftedChat/GiftedChat/GiftedChat.js +0 -1
  58. package/dist/esm/components/BikGiftedChat/GiftedChat/messageHelpers.d.ts +0 -6
  59. package/dist/esm/components/BikGiftedChat/GiftedChat/messageHelpers.js +0 -1
  60. package/dist/esm/components/BikGiftedChat/GiftedChat/scrollHooks.d.ts +0 -10
  61. package/dist/esm/components/BikGiftedChat/GiftedChat/scrollHooks.js +0 -1
  62. package/dist/esm/components/BikGiftedChat/GiftedChat/types.d.ts +0 -154
  63. package/dist/esm/components/BikGiftedChat/GiftedChat/types.js +0 -1
  64. package/dist/esm/components/BikGiftedChat/GiftedChat/utils.d.ts +0 -22
  65. package/dist/esm/components/BikGiftedChat/GiftedChat/utils.js +0 -1
  66. package/dist/esm/components/BikGiftedChat/index.d.ts +0 -5
  67. package/dist/esm/components/BikGiftedChat/types.d.ts +0 -24
  68. package/dist/esm/hooks/useWindowSize.d.ts +0 -2
  69. 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,154 +0,0 @@
1
- import React from 'react';
2
- import { BubbleProps, GiftedChatAppType } 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
- appType?: GiftedChatAppType;
94
- [key: string]: any;
95
- }
96
- export interface ScrollState {
97
- /** Is initial mount of the component. */
98
- isInitialMount: boolean;
99
- /** Is user currently scrolling. */
100
- isUserScrolling: boolean;
101
- /** Is loading old messages. */
102
- isLoadingOldMessages: boolean;
103
- /** Is scroll at bottom. */
104
- isAtBottom: boolean;
105
- /** Has end reached been triggered. */
106
- hasTriggeredEndReached: boolean;
107
- /** Last known messages length. */
108
- lastMessagesLength: number;
109
- /** Previous scroll height. */
110
- previousScrollHeight: number;
111
- /** Previous scroll top position. */
112
- previousScrollTop: number;
113
- /** Debounce timer for scroll events. */
114
- scrollTimeout: number | null;
115
- }
116
- export declare enum CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE {
117
- /** User is calling another user. */
118
- CALLING_CALL = "CALLING_CALL",
119
- /** Call is ringing for the recipient. */
120
- RINGING_CALL = "RINGING_CALL",
121
- /** Call is ongoing between users. */
122
- ONGOING_CALL = "ONGOING_CALL",
123
- /** Call has been completed. */
124
- COMPLETED_CALL = "COMPLETED_CALL",
125
- /** Call was missed by the recipient. */
126
- MISSED_CALL = "MISSED_CALL",
127
- /** Callback was requested. */
128
- REQUESTED_CALLBACK = "REQUESTED_CALLBACK",
129
- /** Call was declined by the recipient. */
130
- DECLINED_CALL = "DECLINED_CALL",
131
- /** Call was disconnected. */
132
- DISCONNECTED_CALL = "DISCONNECTED_CALL",
133
- /** Call was unanswered. */
134
- UNANSWERED_CALL = "UNANSWERED_CALL"
135
- }
136
- export declare const enum MESSAGE_CHANNELS {
137
- INSTAGRAM = "instagram",
138
- MESSENGER = "messenger",
139
- WHATSAPP = "whatsapp",
140
- GMAIL = "gmail",
141
- LIVECHAT = "livechat",
142
- GOOGLE_BUSINESS_CHAT = "gbm",
143
- SHOPIFY = "shopify",
144
- FACEBOOK = "facebook",
145
- EMAIL = "email",
146
- SMTP = "smtp",
147
- FACEBOOK_CATALOG = "facebook-catalog",
148
- WHATSAPP_VOICE_CALL = "whatsapp-voice-call",
149
- CREATE_SIGNATURE = "create-signature",
150
- EDIT_SIGNATURE = "edit-signature",
151
- WEBPUSH = "webpush",
152
- TASKS = "tasks",
153
- RCS = "rcs"
154
- }
@@ -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 t,{useMemo as n,useCallback as o}from"react";import{COLORS as a}from"../../../constants/Theme.js";import{useWindowSize as l}from"../../../hooks/useWindowSize.js";import{MESSAGE_CHANNELS as s}from"../GiftedChat/types.js";import{Constants as r,isStringifiedArray as d}from"../GiftedChat/utils.js";import{GiftedChatAppType as c}from"./types.js";const g=t=>{var g,f,u,v;const{currentMessage:m,position:h,renderMessageText:b,renderTicks:y,renderTime:p,renderCustomView:j,isCustomViewBottom:T,isUnsatisfactoryMessageFn:I,messagesGroupedByAiTraceId:M,onPress:O,containerStyle:k,bubbleStyles:x,appType:C=c.Bik}=t,A=l(),w=m,G=n((()=>w.category===r.ChatActivity.Category.ACTIVITY&&w.activityType===r.ChatActivity.Type.PRIVATE_NOTE),[w.category,w.activityType]),P=n((()=>{const[e,i]=d(null==w?void 0:w.message);return e&&i&&Array.isArray(i)}),[null==w?void 0:w.message]),B=n((()=>{var e,i,t;const n={borderRadius:8,minHeight:20,margin:0,flexGrow:A?1:0},o=(null==w?void 0:w.channelId)===s.GMAIL||(null==w?void 0:w.channelName)===s.GMAIL,l=(null==w?void 0:w.channelId)===s.SMTP||(null==w?void 0:w.channelName)===s.SMTP;let r={};if("left"===h)r=C===c.Manifest?x&&"object"==typeof x.left?x.left:{}:Object.assign(Object.assign({},A||o||l?{maxWidth:"100%"}:{}),G?{background:(null===(e=null==w?void 0:w.meta)||void 0===e?void 0:e.aiUsed)?"linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)":a.background.warning.light}:{backgroundColor:(null==w?void 0:w.isPrivateMail)?a.background.blue.light:a.surface.hovered});else if("right"===h)if(C===c.Manifest)r=x&&"object"==typeof x.right?x.right:{};else{const e=I&&I({aiTraceId:null===(i=w.eventProperties)||void 0===i?void 0:i.aiTraceId,messagesGroupedByAiTraceId:M});r=Object.assign(Object.assign({backgroundColor:"failed"===w.status||e?a.background.negative.light:a.background.brandVeryLight},G?{background:(null===(t=null==w?void 0:w.meta)||void 0===t?void 0:t.aiUsed)?"linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)":a.background.warning.light}:{}),!A&&P?{maxWidth:500}:{})}return C===c.Manifest?Object.assign({},r):Object.assign(Object.assign({},n),r)}),[null==w?void 0:w.channelId,null==w?void 0:w.channelName,null===(g=null==w?void 0:w.meta)||void 0===g?void 0:g.aiUsed,null==w?void 0:w.status,null===(f=null==w?void 0:w.eventProperties)||void 0===f?void 0:f.aiTraceId,h,A,G,P,I,M,null==w?void 0:w.isPrivateMail,x,C]),S=o((()=>e("div",{children:[!T&&(null==j?void 0:j(t)),null==b?void 0:b(t),T&&(null==j?void 0:j(t))]})),[T,j,b,t]);return i("div",Object.assign({style:Object.assign(Object.assign({display:"flex",marginTop:C===c.Manifest?0:6,marginBottom:C===c.Manifest?0:(null===(v=null===(u=null==m?void 0:m.messageInformation)||void 0===u?void 0:u.reactions)||void 0===v?void 0:v.length)>0?24:6,flexGrow:A?1:0},C===c.Manifest?Object.assign({alignItems:"flex-end"},"right"===h?{cursor:"pointer"}:{}):{}),C!==c.Manifest||"object"!=typeof k?{}:"left"===h&&"left"in k&&k.left&&"object"==typeof k.left?k.left:"right"===h&&"right"in k&&k.right&&"object"==typeof k.right?k.right:{})},C===c.Manifest?{onClick:O}:{},{children:i("div",Object.assign({style:B},{children:e("div",{children:[i("div",Object.assign({id:m.chatActivityId||`message-${m.psqlId}`},{children:S()})),e("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",marginLeft:"32px"}},{children:[null==p?void 0:p(t),null==y?void 0:y(m)]}))]})}))}))},f=t.memo(g);export{f as Bubble,f as default};
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
- import { IMessage, User } from '../types';
3
- export declare enum GiftedChatAppType {
4
- Bik = "bik",
5
- Manifest = "manifest"
6
- }
7
- export interface BubbleProps<TMessage extends IMessage = IMessage> {
8
- currentMessage: TMessage;
9
- previousMessage?: TMessage;
10
- nextMessage?: TMessage;
11
- position: 'left' | 'right';
12
- user: User;
13
- tickStyle?: React.CSSProperties;
14
- usernameStyle?: React.CSSProperties;
15
- renderMessageText?: (props: BubbleProps<TMessage>) => React.ReactNode;
16
- renderTicks?: (currentMessage: TMessage) => React.ReactNode;
17
- renderTime?: (props: BubbleProps<TMessage>) => React.ReactNode;
18
- renderCustomView?: (props: BubbleProps<TMessage>) => React.ReactNode;
19
- renderUsername?: (props: BubbleProps<TMessage>) => React.ReactNode;
20
- onPress?: (context?: any, message?: TMessage) => void;
21
- onLongPress?: (context?: any, message?: TMessage) => void;
22
- isCustomViewBottom?: boolean;
23
- renderUsernameOnMessage?: boolean;
24
- isUnsatisfactoryMessageFn?: (params: {
25
- aiTraceId?: string;
26
- messagesGroupedByAiTraceId?: any;
27
- }) => boolean;
28
- messagesGroupedByAiTraceId?: any;
29
- containerStyle?: {
30
- left?: React.CSSProperties;
31
- right?: React.CSSProperties;
32
- } | React.CSSProperties;
33
- bubbleStyles?: {
34
- left?: React.CSSProperties;
35
- right?: React.CSSProperties;
36
- } | React.CSSProperties;
37
- appType?: GiftedChatAppType;
38
- }
@@ -1 +0,0 @@
1
- var i;!function(i){i.Bik="bik",i.Manifest="manifest"}(i||(i={}));export{i as GiftedChatAppType};
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import { GiftedChatAppType } from '../Bubble/types';
3
- export interface DayProps {
4
- createdAt?: Date | number | string;
5
- dateFormat?: string;
6
- dateFormatCalendar?: {
7
- sameDay?: string;
8
- nextDay?: string;
9
- nextWeek?: string;
10
- lastDay?: string;
11
- lastWeek?: string;
12
- sameElse?: string;
13
- };
14
- appType?: GiftedChatAppType;
15
- }
16
- export declare const Day: React.NamedExoticComponent<DayProps>;
17
- export default Day;
@@ -1 +0,0 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import{startOfDay as r,format as n,isSameYear as a,differenceInDays as i}from"date-fns";import o,{useMemo as s}from"react";import{COLORS as l}from"../../../constants/Theme.js";import{BodyCaption as p}from"../../TypographyStyle.js";import{GiftedChatAppType as d}from"../Bubble/types.js";const y=o=>{let{createdAt:y,dateFormat:c="D MMMM YY",dateFormatCalendar:m,appType:f=d.Bik}=o;const g=s((()=>{if(null==y)return null;let e;if("number"==typeof y)e=r(new Date(y));else if(y instanceof Date)e=r(y);else{if("string"!=typeof y)return null;e=r(new Date(y))}if(f===d.Manifest)return n(e,"MMM d, yyyy");const t=r(new Date);if(!a(t,e))return n(e,"EEEE, d MMMM yy");const o=i(t,e);return o<1?(null==m?void 0:m.sameDay)?m.sameDay.replace(/\[|\]/g,""):"Today":1===o?"Yesterday":n(e,"EEEE, d MMMM yy")}),[y,c,m,f]);return g?f===d.Manifest?e("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",marginTop:5,marginBottom:10}},{children:e("span",Object.assign({style:{background:"transparent",color:"#b2b2b2",fontSize:12,fontWeight:600,padding:"2px 8px"}},{children:g}))})):t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"center",margin:"12px 0px 12px 8px"}},{children:[e("div",{style:{flex:1,height:"1px",backgroundColor:l.stroke.primary}}),e("div",Object.assign({style:{border:`1px solid ${l.stroke.primary}`,borderRadius:"16px",padding:"4px 12px"}},{children:e(p,Object.assign({style:{color:l.content.secondary}},{children:g}))})),e("div",{style:{flex:1,height:"1px",backgroundColor:l.stroke.primary}})]})):null},c=o.memo(y);export{c as Day,c 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 i}from"react/jsx-runtime";import s,{forwardRef as n,useRef as a,useMemo as o,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{GiftedChatAppType as p}from"../Bubble/types.js";import{Day as v}from"./Day.js";import{getMessagePlacement as h,shouldCenterAlign as m}from"./messageHelpers.js";import{useScrollToBottom as f,useInitialMountScroll as y,useScrollCleanup as b,useRestoreScrollPosition as j,useAutoScrollOnNewMessages as x,useResizeObserverForFirstMessage as M,useScrollHandler as T}from"./scrollHooks.js";import{MESSAGE_CHANNELS as O}from"./types.js";import{TOP_THRESHOLD as A,normalizeRef as w,isSameDay as k,Constants as _}from"./utils.js";var E=n(((n,E)=>{var S;const B=n||{},{messages:C=[],user:I,renderBubble:L,renderAvatar:R,renderDay:D,renderLoading:P,renderChatEmpty:$,listViewProps:F={},renderAvatarOnTop:U=!1,showUserAvatar:V=!1,showAvatarForEveryMessage:W=!1,inverted:G=!1,messageIdGenerator:H,topThreshold:N=A,appType:Y=p.Bik}=B,z=e(B,["messages","user","renderBubble","renderAvatar","renderDay","renderLoading","renderChatEmpty","listViewProps","renderAvatarOnTop","showUserAvatar","showAvatarForEveryMessage","inverted","messageIdGenerator","topThreshold","appType"]),X=c(),q=a(null),J=w(F.ref||E,q),K=a({isInitialMount:!0,isUserScrolling:!1,isLoadingOldMessages:!1,isAtBottom:!0,hasTriggeredEndReached:!1,lastMessagesLength:null!==(S=null==C?void 0:C.length)&&void 0!==S?S:0,previousScrollHeight:0,previousScrollTop:0,scrollTimeout:null}),Q=o((()=>C&&0!==C.length?[...C].reverse():[]),[C]),Z=f(J,K);l(E,(()=>J.current)),y(J,K,Q.length,Z),b(K),j(J,K,Q.length),x(J,K,C.length,Z),M(null==C?void 0:C[0],K,Z,H);const ee=T(K,F.onEndReached,F.onScroll,N),re=d((e=>{var r;return Boolean(e&&I&&(null===(r=e.user)||void 0===r?void 0:r._id)===I._id)}),[I]),te=d(((e,r)=>!!V&&(!!W||(!r||r.user._id!==e.user._id))),[V,W]),ie=d(((e,t,i)=>{const s=re(e)?"right":"left",n=Object.assign({currentMessage:e,previousMessage:t,nextMessage:i,position:s,user:I},z);return L?L(n):r("div",Object.assign({style:Object.assign(Object.assign({maxWidth:Y===p.Manifest?"50%":"70%",width:"fit-content"},Y===p.Manifest?{minWidth:"130px"}:{}),{padding:"8px 12px",borderRadius:Y===p.Manifest?16:4,border:"left"===s&&Y===p.Manifest?"1px solid rgb(224, 224, 224)":"none",backgroundColor:"right"===s?Y===p.Manifest?g.background.brandTint:g.background.brandLight:Y===p.Manifest?g.background.pureWhite:g.background.inactive,color:g.content.primary,wordBreak:"break-word"})},{children:r(u,{children:e.text})}))}),[re,I,L,z]),se=d(((e,r,t)=>{if(!te(e,t))return null;const i=re(e)?"right":"left";return R?R({currentMessage:e,previousMessage:r,nextMessage:t,position:i,user:I,renderAvatarOnTop:U,showUserAvatar:V,showAvatarForEveryMessage:W}):null}),[te,re,I,U,V,W,R]);return C&&0!==C.length?i("div",Object.assign({ref:J,style:Object.assign({flex:1,overflowY:"auto",overflowX:"hidden",display:"flex",flexDirection:"column"},F.style),onScroll:ee},{children:[r("div",{style:{flex:"1 0 auto"}}),r("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:"0 0 auto"}},{children:Q.map(((e,t)=>{var n,a,o,l,d;const g=re(e)?"right":"left",c=Q[t-1],u=Q[t+1],f=!k(e,c),y=h(e,g),b=m(e),j=(null==e?void 0:e.channelId)===O.SMTP||(null==e?void 0:e.channelName)===O.SMTP,x=e.category===_.ChatActivity.Category.ACTIVITY&&e.activityType===_.ChatActivity.Type.PRIVATE_NOTE;return i(s.Fragment,{children:[f&&(D?D({createdAt:e.createdAt}):r(v,{createdAt:e.createdAt,appType:Y})),i("div",Object.assign({style:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},X?{margin:"0 4px"}:{}),b?{}:{display:"flex"}),Y!==p.Manifest?X||2!==(null===(n=null==e?void 0:e.user)||void 0===n?void 0:n._id)?{marginRight:8}:{marginLeft:8}:{}),j&&!x&&X?{marginLeft:8,marginRight:8}:{}),{justifyContent:y,marginBottom:8})},{children:[!X&&"left"===g&&r("div",Object.assign({style:{margin:"0 8px"}},{children:se(e,c,u)})),r("div",Object.assign({id:`message-bubble-${null!==(a=e._id)&&void 0!==a?a:`${t}-${null!==(o=null==H?void 0:H())&&void 0!==o?o:"id"}`}`,style:Y===p.Manifest?{width:"100%"}:X&&j?{display:"flex",flexGrow:1}:{}},{children:ie(e,c,u)})),!X&&"right"===g&&r("div",Object.assign({style:{margin:"0 8px"}},{children:se(e,c,u)}))]}))]},null!==(l=e._id)&&void 0!==l?l:`${t}-${null!==(d=null==H?void 0:H())&&void 0!==d?d:"id"}`)}))}))]})):$?r(t,{children:$()}):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,154 +0,0 @@
1
- import React from 'react';
2
- import { BubbleProps, GiftedChatAppType } 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
- appType?: GiftedChatAppType;
94
- [key: string]: any;
95
- }
96
- export interface ScrollState {
97
- /** Is initial mount of the component. */
98
- isInitialMount: boolean;
99
- /** Is user currently scrolling. */
100
- isUserScrolling: boolean;
101
- /** Is loading old messages. */
102
- isLoadingOldMessages: boolean;
103
- /** Is scroll at bottom. */
104
- isAtBottom: boolean;
105
- /** Has end reached been triggered. */
106
- hasTriggeredEndReached: boolean;
107
- /** Last known messages length. */
108
- lastMessagesLength: number;
109
- /** Previous scroll height. */
110
- previousScrollHeight: number;
111
- /** Previous scroll top position. */
112
- previousScrollTop: number;
113
- /** Debounce timer for scroll events. */
114
- scrollTimeout: number | null;
115
- }
116
- export declare enum CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE {
117
- /** User is calling another user. */
118
- CALLING_CALL = "CALLING_CALL",
119
- /** Call is ringing for the recipient. */
120
- RINGING_CALL = "RINGING_CALL",
121
- /** Call is ongoing between users. */
122
- ONGOING_CALL = "ONGOING_CALL",
123
- /** Call has been completed. */
124
- COMPLETED_CALL = "COMPLETED_CALL",
125
- /** Call was missed by the recipient. */
126
- MISSED_CALL = "MISSED_CALL",
127
- /** Callback was requested. */
128
- REQUESTED_CALLBACK = "REQUESTED_CALLBACK",
129
- /** Call was declined by the recipient. */
130
- DECLINED_CALL = "DECLINED_CALL",
131
- /** Call was disconnected. */
132
- DISCONNECTED_CALL = "DISCONNECTED_CALL",
133
- /** Call was unanswered. */
134
- UNANSWERED_CALL = "UNANSWERED_CALL"
135
- }
136
- export declare const enum MESSAGE_CHANNELS {
137
- INSTAGRAM = "instagram",
138
- MESSENGER = "messenger",
139
- WHATSAPP = "whatsapp",
140
- GMAIL = "gmail",
141
- LIVECHAT = "livechat",
142
- GOOGLE_BUSINESS_CHAT = "gbm",
143
- SHOPIFY = "shopify",
144
- FACEBOOK = "facebook",
145
- EMAIL = "email",
146
- SMTP = "smtp",
147
- FACEBOOK_CATALOG = "facebook-catalog",
148
- WHATSAPP_VOICE_CALL = "whatsapp-voice-call",
149
- CREATE_SIGNATURE = "create-signature",
150
- EDIT_SIGNATURE = "edit-signature",
151
- WEBPUSH = "webpush",
152
- TASKS = "tasks",
153
- RCS = "rcs"
154
- }
@@ -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};