@bikdotai/bik-component-library 0.0.805-beta.27 → 0.0.805-beta.29

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),s=require("react"),r=require("../../../constants/Theme.js"),i=require("../../../hooks/useWindowSize.js"),n=require("../../button/Button.js"),l=require("../../TypographyStyle.js"),a=require("../Bubble/types.js"),o=require("./Day.js"),d=require("./messageHelpers.js"),u=require("./scrollHooks.js"),g=require("./types.js"),c=require("./utils.js");function v(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=v(s);const p=e=>{let{text:r,isExpanded:i,onToggle:a}=e;const o=s.useRef(null),[d,u]=s.useState(!1);return s.useEffect((()=>{const e=o.current;if(e){e.style.maxHeight="none";const t=e.scrollHeight>204;e.style.maxHeight=i?"none":"204px",u(t)}}),[r,i]),t.jsxs(t.Fragment,{children:[t.jsx("div",Object.assign({ref:o,style:{maxHeight:i?"none":204,overflow:"hidden"}},{children:t.jsx(l.BodySecondary,{children:r})})),d&&t.jsx(n.Button,{buttonType:"text",size:"xs",buttonText:i?"Show less":"Read more",onClick:a})]})},f=(n,l)=>{var v;const f=n||{},{messages:x=[],user:y,renderBubble:b,renderAvatar:j,renderDay:m,renderLoading:T,renderChatEmpty:A,listViewProps:O={},renderAvatarOnTop:S=!1,showUserAvatar:C=!1,showAvatarForEveryMessage:M=!1,inverted:R=!1,messageIdGenerator:w,topThreshold:_=c.TOP_THRESHOLD,appType:L=a.GiftedChatAppType.Bik,maxHeight:E,isActivityMessage:k,forceLeftAlign:H}=f,B=e.__rest(f,["messages","user","renderBubble","renderAvatar","renderDay","renderLoading","renderChatEmpty","listViewProps","renderAvatarOnTop","showUserAvatar","showAvatarForEveryMessage","inverted","messageIdGenerator","topThreshold","appType","maxHeight","isActivityMessage","forceLeftAlign"]),q=i.useWindowSize(),G=s.useRef(null),I=c.normalizeRef(O.ref||l,G),P=s.useRef({isInitialMount:!0,isUserScrolling:!1,isLoadingOldMessages:!1,isAtBottom:!0,hasTriggeredEndReached:!1,lastMessagesLength:null!==(v=null==x?void 0:x.length)&&void 0!==v?v:0,previousScrollHeight:0,previousScrollTop:0,scrollTimeout:null}),[D,F]=s.useState(new Set),N=s.useMemo((()=>x&&0!==x.length?[...x].reverse():[]),[x]),z=u.useScrollToBottom(I,P);s.useImperativeHandle(l,(()=>I.current)),u.useInitialMountScroll(I,P,N.length,z),u.useScrollCleanup(P),u.useRestoreScrollPosition(I,P,N.length),u.useAutoScrollOnNewMessages(I,P,x.length,z),u.useResizeObserverForFirstMessage(null==x?void 0:x[0],P,z,w);const W=u.useScrollHandler(P,O.onEndReached,O.onScroll,_),$=s.useCallback((e=>{var t;return Boolean(e&&y&&(null===(t=e.user)||void 0===t?void 0:t._id)===y._id)}),[y]),U=s.useCallback(((e,t)=>!!C&&(!!M||(!t||!!k&&k(e)||!!k&&k(t)||t.user._id!==e.user._id))),[C,M,k,H]),V=s.useCallback(((e,s,i)=>{var n,l,o,d,u;const g=$(e)?"right":"left",c=(null===(n=null==s?void 0:s.user)||void 0===n?void 0:n._id)!==(null===(l=null==e?void 0:e.user)||void 0===l?void 0:l._id),v=(null===(o=null==i?void 0:i.user)||void 0===o?void 0:o._id)!==(null===(d=null==e?void 0:e.user)||void 0===d?void 0:d._id),h=Object.assign({currentMessage:e,previousMessage:s,nextMessage:i,position:g,user:y},B);if(b)return b(h);const f=e._id,x=D.has(f);return t.jsx("div",Object.assign({style:Object.assign(Object.assign({maxWidth:L===a.GiftedChatAppType.Manifest?"50%":"70%",width:"fit-content"},L===a.GiftedChatAppType.Manifest?{minWidth:"130px"}:{}),{padding:"8px 12px",borderTopLeftRadius:"left"===g?c?12:2:12,borderTopRightRadius:"right"===g?c?12:2:12,borderBottomLeftRadius:"left"===g?v?12:2:12,borderBottomRightRadius:"right"===g?v?12:2:12,border:"left"===g&&L===a.GiftedChatAppType.Manifest?"1px solid rgb(224, 224, 224)":"none",backgroundColor:"right"===g?L===a.GiftedChatAppType.Manifest?r.COLORS.background.brandTint:r.COLORS.background.brandLight:L===a.GiftedChatAppType.Manifest?r.COLORS.background.pureWhite:r.COLORS.background.inactive,color:r.COLORS.content.primary,wordBreak:"break-word"})},{children:t.jsx(p,{text:null!==(u=e.text)&&void 0!==u?u:"",isExpanded:x,onToggle:()=>F((e=>{const t=new Set(e);return x?t.delete(f):t.add(f),t}))})}))}),[$,y,b,B,D]),Y=s.useCallback(((e,t,s)=>{if(!U(e,t))return null;const r=$(e)?"right":"left";return j?j({currentMessage:e,previousMessage:t,nextMessage:s,position:r,user:y,renderAvatarOnTop:S,showUserAvatar:C,showAvatarForEveryMessage:M}):null}),[U,$,y,S,C,M,j]);return x&&0!==x.length?t.jsxs("div",Object.assign({ref:I,style:Object.assign(Object.assign({flex:1,overflowY:"auto",overflowX:"hidden",display:"flex",flexDirection:"column"},E?{maxHeight:E,height:E}:{}),O.style),onScroll:W},{children:[t.jsx("div",{style:{flex:"1 0 auto"}}),t.jsx("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:"0 0 auto"}},{children:N.map(((e,s)=>{var r,i,n,l,u,v,p;const f=(null==H?void 0:H(e))?"left":$(e)?"right":"left",x=N[s-1],y=N[s+1],b=!c.isSameDay(e,x),j=(null==H?void 0:H(e))?"flex-start":d.getMessagePlacement(e,f),T=d.shouldCenterAlign(e),A=(null==e?void 0:e.channelId)===g.MESSAGE_CHANNELS.SMTP||(null==e?void 0:e.channelName)===g.MESSAGE_CHANNELS.SMTP,O=e.category===c.Constants.ChatActivity.Category.ACTIVITY&&e.activityType===c.Constants.ChatActivity.Type.PRIVATE_NOTE;return t.jsxs(h.default.Fragment,{children:[b&&(m?m({createdAt:e.createdAt}):t.jsx(o.Day,{createdAt:e.createdAt,appType:L})),t.jsxs("div",Object.assign({style:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},q?{margin:"0 4px"}:{}),T?{}:{display:"flex",alignItems:"flex-start"}),L!==a.GiftedChatAppType.Manifest?q||2!==(null===(r=null==e?void 0:e.user)||void 0===r?void 0:r._id)?{marginRight:8}:{marginLeft:8}:{}),A&&!O&&q?{marginLeft:8,marginRight:8}:{}),{justifyContent:j,marginBottom:y?(null===(i=null==y?void 0:y.user)||void 0===i?void 0:i._id)===(null===(n=null==e?void 0:e.user)||void 0===n?void 0:n._id)?4:20:0})},{children:[!q&&"left"===f&&t.jsx("div",Object.assign({style:{marginRight:"4px",width:"24px",flexShrink:0}},{children:Y(e,x,y)})),t.jsx("div",Object.assign({id:`message-bubble-${null!==(l=e._id)&&void 0!==l?l:`${s}-${null!==(u=null==w?void 0:w())&&void 0!==u?u:"id"}`}`,style:L===a.GiftedChatAppType.Manifest?{width:"100%"}:q&&A?{display:"flex",flexGrow:1}:{}},{children:V(e,x,y)})),!q&&"right"===f&&t.jsx("div",Object.assign({style:{marginLeft:"4px",width:"24px",flexShrink:0,alignSelf:"flex-start"}},{children:Y(e,x,y)}))]}))]},null!==(v=e._id)&&void 0!==v?v:`${s}-${null!==(p=null==w?void 0:w())&&void 0!==p?p:"id"}`)}))}))]})):A?t.jsx(t.Fragment,{children:A()}):null};var x=s.forwardRef(f);exports.default=x;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),s=require("react"),r=require("../../../constants/Theme.js"),i=require("../../../hooks/useWindowSize.js"),n=require("../../button/Button.js"),l=require("../../TypographyStyle.js"),a=require("../Bubble/types.js"),o=require("./Day.js"),d=require("./messageHelpers.js"),u=require("./scrollHooks.js"),g=require("./types.js"),c=require("./utils.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=h(s);const v=e=>{let{text:r,isExpanded:i,onToggle:a}=e;const o=s.useRef(null),[d,u]=s.useState(!1);return s.useEffect((()=>{const e=o.current;if(e){e.style.maxHeight="none";const t=e.scrollHeight>204;e.style.maxHeight=i?"none":"204px",u(t)}}),[r,i]),t.jsxs(t.Fragment,{children:[t.jsx("div",Object.assign({ref:o,style:{maxHeight:i?"none":204,overflow:"hidden"}},{children:t.jsx(l.BodySecondary,{children:r})})),d&&t.jsx(n.Button,{buttonType:"text",size:"xs",buttonText:i?"Show less":"Read more",onClick:a})]})},f=(n,l)=>{var h;const f=n||{},{messages:x=[],user:y,renderBubble:b,renderAvatar:j,renderDay:m,renderLoading:T,renderChatEmpty:O,listViewProps:S={},renderAvatarOnTop:A=!1,showUserAvatar:C=!1,showAvatarForEveryMessage:M=!1,inverted:R=!1,messageIdGenerator:w,topThreshold:_=c.TOP_THRESHOLD,appType:E=a.GiftedChatAppType.Bik,maxHeight:L,isActivityMessage:k}=f,H=e.__rest(f,["messages","user","renderBubble","renderAvatar","renderDay","renderLoading","renderChatEmpty","listViewProps","renderAvatarOnTop","showUserAvatar","showAvatarForEveryMessage","inverted","messageIdGenerator","topThreshold","appType","maxHeight","isActivityMessage"]),B=i.useWindowSize(),q=s.useRef(null),G=c.normalizeRef(S.ref||l,q),I=s.useRef({isInitialMount:!0,isUserScrolling:!1,isLoadingOldMessages:!1,isAtBottom:!0,hasTriggeredEndReached:!1,lastMessagesLength:null!==(h=null==x?void 0:x.length)&&void 0!==h?h:0,previousScrollHeight:0,previousScrollTop:0,scrollTimeout:null}),[P,D]=s.useState(new Set),F=s.useMemo((()=>x&&0!==x.length?[...x].reverse():[]),[x]),N=u.useScrollToBottom(G,I);s.useImperativeHandle(l,(()=>G.current)),u.useInitialMountScroll(G,I,F.length,N),u.useScrollCleanup(I),u.useRestoreScrollPosition(G,I,F.length),u.useAutoScrollOnNewMessages(G,I,x.length,N),u.useResizeObserverForFirstMessage(null==x?void 0:x[0],I,N,w);const z=u.useScrollHandler(I,S.onEndReached,S.onScroll,_),W=s.useCallback((e=>{var t;return Boolean(e&&y&&(null===(t=e.user)||void 0===t?void 0:t._id)===y._id)}),[y]),$=s.useCallback(((e,t)=>!!C&&(!!M||(!t||!!k&&k(e)||!!k&&k(t)||t.user._id!==e.user._id))),[C,M,k]),U=s.useCallback(((e,s,i)=>{var n,l,o,d,u;const g=W(e)?"right":"left",c=(null===(n=null==s?void 0:s.user)||void 0===n?void 0:n._id)!==(null===(l=null==e?void 0:e.user)||void 0===l?void 0:l._id),h=(null===(o=null==i?void 0:i.user)||void 0===o?void 0:o._id)!==(null===(d=null==e?void 0:e.user)||void 0===d?void 0:d._id),p=Object.assign({currentMessage:e,previousMessage:s,nextMessage:i,position:g,user:y},H);if(b)return b(p);const f=e._id,x=P.has(f);return t.jsx("div",Object.assign({style:Object.assign(Object.assign({maxWidth:E===a.GiftedChatAppType.Manifest?"50%":"70%",width:"fit-content"},E===a.GiftedChatAppType.Manifest?{minWidth:"130px"}:{}),{padding:"8px 12px",borderTopLeftRadius:"left"===g?c?12:2:12,borderTopRightRadius:"right"===g?c?12:2:12,borderBottomLeftRadius:"left"===g?h?12:2:12,borderBottomRightRadius:"right"===g?h?12:2:12,border:"left"===g&&E===a.GiftedChatAppType.Manifest?"1px solid rgb(224, 224, 224)":"none",backgroundColor:"right"===g?E===a.GiftedChatAppType.Manifest?r.COLORS.background.brandTint:r.COLORS.background.brandLight:E===a.GiftedChatAppType.Manifest?r.COLORS.background.pureWhite:r.COLORS.background.inactive,color:r.COLORS.content.primary,wordBreak:"break-word"})},{children:t.jsx(v,{text:null!==(u=e.text)&&void 0!==u?u:"",isExpanded:x,onToggle:()=>D((e=>{const t=new Set(e);return x?t.delete(f):t.add(f),t}))})}))}),[W,y,b,H,P]),V=s.useCallback(((e,t,s)=>{if(!$(e,t))return null;const r=W(e)?"right":"left";return j?j({currentMessage:e,previousMessage:t,nextMessage:s,position:r,user:y,renderAvatarOnTop:A,showUserAvatar:C,showAvatarForEveryMessage:M}):null}),[$,W,y,A,C,M,j]);return x&&0!==x.length?t.jsxs("div",Object.assign({ref:G,style:Object.assign(Object.assign({flex:1,overflowY:"auto",overflowX:"hidden",display:"flex",flexDirection:"column"},L?{maxHeight:L,height:L}:{}),S.style),onScroll:z},{children:[t.jsx("div",{style:{flex:"1 0 auto"}}),t.jsx("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:"0 0 auto"}},{children:F.map(((e,s)=>{var r,i,n,l,u,h;const v=(null==e?void 0:e.channelId)===g.MESSAGE_CHANNELS.SMTP||(null==e?void 0:e.channelName)===g.MESSAGE_CHANNELS.SMTP,f=v?"left":W(e)?"right":"left",x=F[s-1],y=F[s+1],b=!c.isSameDay(e,x),j=d.getMessagePlacement(e,f),T=d.shouldCenterAlign(e),O=e.category===c.Constants.ChatActivity.Category.ACTIVITY&&e.activityType===c.Constants.ChatActivity.Type.PRIVATE_NOTE;return t.jsxs(p.default.Fragment,{children:[b&&(m?m({createdAt:e.createdAt}):t.jsx(o.Day,{createdAt:e.createdAt,appType:E})),t.jsxs("div",Object.assign({style:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},B?{margin:"0 4px"}:{}),T?{}:{display:"flex",alignItems:"flex-start"}),E!==a.GiftedChatAppType.Manifest?B||"right"!==f?{marginRight:8}:{marginLeft:8}:{}),v&&!O&&B?{marginLeft:8,marginRight:8}:{}),{justifyContent:j,marginBottom:y?(null===(r=null==y?void 0:y.user)||void 0===r?void 0:r._id)===(null===(i=null==e?void 0:e.user)||void 0===i?void 0:i._id)?4:20:0})},{children:[!B&&"left"===f&&t.jsx("div",Object.assign({style:{marginRight:"4px",width:"24px",flexShrink:0}},{children:V(e,x,y)})),t.jsx("div",Object.assign({id:`message-bubble-${null!==(n=e._id)&&void 0!==n?n:`${s}-${null!==(l=null==w?void 0:w())&&void 0!==l?l:"id"}`}`,style:E===a.GiftedChatAppType.Manifest?{width:"100%"}:B&&v?{display:"flex",flexGrow:1}:{}},{children:U(e,x,y)})),!B&&"right"===f&&t.jsx("div",Object.assign({style:{marginLeft:"4px",width:"24px",flexShrink:0,alignSelf:"flex-start"}},{children:V(e,x,y)}))]}))]},null!==(u=e._id)&&void 0!==u?u:`${s}-${null!==(h=null==w?void 0:w())&&void 0!==h?h:"id"}`)}))}))]})):O?t.jsx(t.Fragment,{children:O()}):null};var x=s.forwardRef(f);exports.default=x;
2
2
  //# sourceMappingURL=GiftedChat.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GiftedChat.js","sources":["../../../../../src/components/BikGiftedChat/GiftedChat/GiftedChat.tsx"],"sourcesContent":["import React, {\n\tforwardRef,\n\tuseCallback,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { COLORS } from '../../../constants/Theme';\nimport { useWindowSize } from '../../../hooks/useWindowSize';\nimport { Button } from '../../button';\nimport { BodySecondary } from '../../TypographyStyle';\nimport { BubbleProps, GiftedChatAppType } from '../Bubble/types';\nimport { IMessage } from '../types';\nimport { Day } from './Day';\nimport { getMessagePlacement, shouldCenterAlign } from './messageHelpers';\nimport {\n\tuseAutoScrollOnNewMessages,\n\tuseInitialMountScroll,\n\tuseResizeObserverForFirstMessage,\n\tuseRestoreScrollPosition,\n\tuseScrollCleanup,\n\tuseScrollHandler,\n\tuseScrollToBottom,\n} from './scrollHooks';\nimport { AvatarProps, GiftedChatProps, MESSAGE_CHANNELS } from './types';\nimport { isSameDay, normalizeRef } from './utils';\nimport { Constants, TOP_THRESHOLD } from './utils';\n\nconst COLLAPSED_MAX_HEIGHT = 204;\n\nconst CollapsibleBubbleText: React.FC<{\n\ttext: string;\n\tisExpanded: boolean;\n\tonToggle: () => void;\n}> = ({ text, isExpanded, onToggle }) => {\n\tconst textRef = useRef<HTMLDivElement>(null);\n\tconst [isOverflowing, setIsOverflowing] = useState(false);\n\n\tuseEffect(() => {\n\t\tconst el = textRef.current;\n\t\tif (el) {\n\t\t\t// Temporarily remove max-height to measure true scroll height\n\t\t\tel.style.maxHeight = 'none';\n\t\t\tconst overflows = el.scrollHeight > COLLAPSED_MAX_HEIGHT;\n\t\t\tel.style.maxHeight = isExpanded ? 'none' : `${COLLAPSED_MAX_HEIGHT}px`;\n\t\t\tsetIsOverflowing(overflows);\n\t\t}\n\t}, [text, isExpanded]);\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tref={textRef}\n\t\t\t\tstyle={{\n\t\t\t\t\tmaxHeight: isExpanded ? 'none' : COLLAPSED_MAX_HEIGHT,\n\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<BodySecondary>{text}</BodySecondary>\n\t\t\t</div>\n\t\t\t{isOverflowing && (\n\t\t\t\t<Button\n\t\t\t\t\tbuttonType=\"text\"\n\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\tbuttonText={isExpanded ? 'Show less' : 'Read more'}\n\t\t\t\t\tonClick={onToggle}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t);\n};\n\nconst GiftedChatInner = (\n\tprops: Omit<GiftedChatProps<IMessage>, 'ref'>,\n\tforwardedRef: React.Ref<HTMLDivElement>,\n) => {\n\tconst {\n\t\tmessages = [],\n\t\tuser,\n\t\trenderBubble,\n\t\trenderAvatar,\n\t\trenderDay,\n\t\trenderLoading,\n\t\trenderChatEmpty,\n\t\tlistViewProps = {},\n\t\trenderAvatarOnTop = false,\n\t\tshowUserAvatar = false,\n\t\tshowAvatarForEveryMessage = false,\n\t\tinverted = false,\n\t\tmessageIdGenerator,\n\t\ttopThreshold = TOP_THRESHOLD,\n\t\tappType = GiftedChatAppType.Bik,\n\t\tmaxHeight,\n\t\tisActivityMessage,\n\t\tforceLeftAlign,\n\t\t...extraProps\n\t} = props || {};\n\n\tconst isMobile = useWindowSize();\n\n\tconst internalScrollRef = useRef<HTMLDivElement | null>(null);\n\tconst scrollRef = normalizeRef(\n\t\tlistViewProps.ref || forwardedRef,\n\t\tinternalScrollRef,\n\t);\n\n\tconst scrollState = useRef({\n\t\tisInitialMount: true,\n\t\tisUserScrolling: false,\n\t\tisLoadingOldMessages: false,\n\t\tisAtBottom: true,\n\t\thasTriggeredEndReached: false,\n\t\tlastMessagesLength: messages?.length ?? 0,\n\t\tpreviousScrollHeight: 0,\n\t\tpreviousScrollTop: 0,\n\t\tscrollTimeout: null,\n\t});\n\n\tconst [expandedMessages, setExpandedMessages] = useState<\n\t\tSet<string | number>\n\t>(new Set());\n\n\t// Reverse messages so newest appears last in DOM (natural reading order)\n\tconst reversedMessages = useMemo(() => {\n\t\tif (!messages || messages.length === 0) return [] as IMessage[];\n\t\treturn [...messages].reverse() as IMessage[];\n\t}, [messages]);\n\n\tconst scrollToBottom = useScrollToBottom(scrollRef, scrollState);\n\n\tuseImperativeHandle(forwardedRef, () => scrollRef.current!);\n\n\tuseInitialMountScroll(\n\t\tscrollRef,\n\t\tscrollState,\n\t\treversedMessages.length,\n\t\tscrollToBottom,\n\t);\n\n\tuseScrollCleanup(scrollState);\n\n\tuseRestoreScrollPosition(scrollRef, scrollState, reversedMessages.length);\n\n\tuseAutoScrollOnNewMessages(\n\t\tscrollRef,\n\t\tscrollState,\n\t\tmessages.length,\n\t\tscrollToBottom,\n\t);\n\n\tuseResizeObserverForFirstMessage(\n\t\tmessages?.[0],\n\t\tscrollState,\n\t\tscrollToBottom,\n\t\tmessageIdGenerator,\n\t);\n\n\tconst handleScroll = useScrollHandler(\n\t\tscrollState,\n\t\tlistViewProps.onEndReached,\n\t\tlistViewProps.onScroll,\n\t\ttopThreshold,\n\t);\n\n\t// Check if a message belongs to the current user\n\tconst isUserMessage = useCallback(\n\t\t(message: IMessage) => {\n\t\t\treturn Boolean(message && user && message.user?._id === user._id);\n\t\t},\n\t\t[user],\n\t);\n\n\t// Determine if avatar should be shown for this message\n\tconst shouldShowAvatar = useCallback(\n\t\t(message: IMessage, previousMessage?: IMessage) => {\n\t\t\tif (!showUserAvatar) return false;\n\t\t\tif (showAvatarForEveryMessage) return true;\n\n\t\t\t// Show avatar on the first message in a consecutive sender stack,\n\t\t\t// or when an activity interrupts the stack, or when the current message itself is an activity\n\t\t\treturn (\n\t\t\t\t!previousMessage ||\n\t\t\t\t(isActivityMessage ? isActivityMessage(message) : false) ||\n\t\t\t\t(isActivityMessage ? isActivityMessage(previousMessage) : false) ||\n\t\t\t\tpreviousMessage.user._id !== message.user._id\n\t\t\t);\n\t\t},\n\t\t[showUserAvatar, showAvatarForEveryMessage, isActivityMessage, forceLeftAlign],\n\t);\n\n\t// Render a message bubble (or call custom renderBubble)\n\tconst renderMessageBubble = useCallback(\n\t\t(message: IMessage, previousMessage?: IMessage, nextMessage?: IMessage) => {\n\t\t\tconst position = isUserMessage(message) ? 'right' : 'left';\n\t\t\tconst isTopOfStack = previousMessage?.user?._id !== message?.user?._id;\n\t\t\tconst isBottomOfStack = nextMessage?.user?._id !== message?.user?._id;\n\n\t\t\tconst bubbleProps: BubbleProps<IMessage> = {\n\t\t\t\tcurrentMessage: message,\n\t\t\t\tpreviousMessage,\n\t\t\t\tnextMessage,\n\t\t\t\tposition,\n\t\t\t\tuser,\n\t\t\t\t...extraProps,\n\t\t\t};\n\n\t\t\t// Use custom render function if provided\n\t\t\tif (renderBubble) {\n\t\t\t\treturn renderBubble(bubbleProps);\n\t\t\t}\n\n\t\t\t// Default bubble rendering\n\t\t\tconst messageId = message._id;\n\t\t\tconst isExpanded = expandedMessages.has(messageId);\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tmaxWidth: appType === GiftedChatAppType.Manifest ? '50%' : '70%',\n\t\t\t\t\t\twidth: 'fit-content',\n\t\t\t\t\t\t...(appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t? { minWidth: '130px' }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\tpadding: '8px 12px',\n\t\t\t\t\t\tborderTopLeftRadius:\n\t\t\t\t\t\t\tposition === 'left' ? (isTopOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\t\tposition === 'right' ? (isTopOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\t\tposition === 'left' ? (isBottomOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\t\tposition === 'right' ? (isBottomOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborder:\n\t\t\t\t\t\t\tposition === 'left' && appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t? '1px solid rgb(224, 224, 224)'\n\t\t\t\t\t\t\t\t: 'none',\n\t\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\t\tposition === 'right'\n\t\t\t\t\t\t\t\t? appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t\t? COLORS.background.brandTint\n\t\t\t\t\t\t\t\t\t: COLORS.background.brandLight\n\t\t\t\t\t\t\t\t: appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t? COLORS.background.pureWhite\n\t\t\t\t\t\t\t\t: COLORS.background.inactive,\n\t\t\t\t\t\tcolor: COLORS.content.primary,\n\t\t\t\t\t\twordBreak: 'break-word',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<CollapsibleBubbleText\n\t\t\t\t\t\ttext={message.text ?? ''}\n\t\t\t\t\t\tisExpanded={isExpanded}\n\t\t\t\t\t\tonToggle={() =>\n\t\t\t\t\t\t\tsetExpandedMessages((prev) => {\n\t\t\t\t\t\t\t\tconst next = new Set(prev);\n\t\t\t\t\t\t\t\tif (isExpanded) next.delete(messageId);\n\t\t\t\t\t\t\t\telse next.add(messageId);\n\t\t\t\t\t\t\t\treturn next;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t);\n\t\t},\n\t\t[isUserMessage, user, renderBubble, extraProps, expandedMessages],\n\t);\n\n\t// Render a message avatar (or call custom renderAvatar)\n\tconst renderMessageAvatar = useCallback(\n\t\t(message: IMessage, previousMessage?: IMessage, nextMessage?: IMessage) => {\n\t\t\tconst shouldShow = shouldShowAvatar(message, previousMessage);\n\n\t\t\tif (!shouldShow) return null;\n\n\t\t\tconst position = isUserMessage(message) ? 'right' : 'left';\n\n\t\t\tconst avatarProps: AvatarProps<IMessage> = {\n\t\t\t\tcurrentMessage: message,\n\t\t\t\tpreviousMessage,\n\t\t\t\tnextMessage,\n\t\t\t\tposition,\n\t\t\t\tuser,\n\t\t\t\trenderAvatarOnTop,\n\t\t\t\tshowUserAvatar,\n\t\t\t\tshowAvatarForEveryMessage,\n\t\t\t};\n\n\t\t\treturn renderAvatar ? renderAvatar(avatarProps) : null;\n\t\t},\n\t\t[\n\t\t\tshouldShowAvatar,\n\t\t\tisUserMessage,\n\t\t\tuser,\n\t\t\trenderAvatarOnTop,\n\t\t\tshowUserAvatar,\n\t\t\tshowAvatarForEveryMessage,\n\t\t\trenderAvatar,\n\t\t],\n\t);\n\n\t// Render: Empty State\n\tif (!messages || messages.length === 0) {\n\t\treturn renderChatEmpty ? <>{renderChatEmpty()}</> : null;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tref={scrollRef as React.RefObject<HTMLDivElement>}\n\t\t\tstyle={{\n\t\t\t\tflex: 1,\n\t\t\t\toverflowY: 'auto',\n\t\t\t\toverflowX: 'hidden',\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tflexDirection: 'column',\n\t\t\t\t...(maxHeight ? { maxHeight, height: maxHeight } : {}),\n\t\t\t\t...listViewProps.style,\n\t\t\t}}\n\t\t\tonScroll={handleScroll}\n\t\t>\n\t\t\t{/* Spacer to push messages to bottom (newest appears last in DOM) */}\n\t\t\t<div style={{ flex: '1 0 auto' }} />\n\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\tflex: '0 0 auto',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{reversedMessages.map((message, index) => {\n\t\t\t\t\tconst position = forceLeftAlign?.(message) ? 'left' : (isUserMessage(message) ? 'right' : 'left');\n\t\t\t\t\tconst previousMessage = reversedMessages[index - 1];\n\t\t\t\t\tconst nextMessage = reversedMessages[index + 1];\n\t\t\t\t\tconst shouldShowDay = !isSameDay(message, previousMessage);\n\t\t\t\t\tconst placement = forceLeftAlign?.(message) ? 'flex-start' : getMessagePlacement(message, position);\n\t\t\t\t\tconst isCentered = shouldCenterAlign(message);\n\t\t\t\t\tconst isSmtp =\n\t\t\t\t\t\tmessage?.['channelId'] === MESSAGE_CHANNELS.SMTP ||\n\t\t\t\t\t\tmessage?.['channelName'] === MESSAGE_CHANNELS.SMTP;\n\t\t\t\t\t// Check if message is a private note\n\t\t\t\t\tconst isPrivateNote =\n\t\t\t\t\t\tmessage['category'] === Constants.ChatActivity.Category.ACTIVITY &&\n\t\t\t\t\t\tmessage['activityType'] ===\n\t\t\t\t\t\t\tConstants.ChatActivity.Type.PRIVATE_NOTE;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<React.Fragment\n\t\t\t\t\t\t\tkey={message._id ?? `${index}-${messageIdGenerator?.() ?? 'id'}`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{/* Day separator */}\n\t\t\t\t\t\t\t{shouldShowDay &&\n\t\t\t\t\t\t\t\t(renderDay ? (\n\t\t\t\t\t\t\t\t\trenderDay({ createdAt: message.createdAt })\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<Day createdAt={message.createdAt} appType={appType} />\n\t\t\t\t\t\t\t\t))}\n\n\t\t\t\t\t\t\t{/* Message container */}\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t...(isMobile ? { margin: '0 4px' } : {}),\n\t\t\t\t\t\t\t\t\t...(isCentered\n\t\t\t\t\t\t\t\t\t\t? {}\n\t\t\t\t\t\t\t\t\t\t: { display: 'flex', alignItems: 'flex-start' }),\n\t\t\t\t\t\t\t\t\t...(appType !== GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t\t\t? !isMobile && message?.user?._id === 2\n\t\t\t\t\t\t\t\t\t\t\t? { marginLeft: 8 }\n\t\t\t\t\t\t\t\t\t\t\t: { marginRight: 8 }\n\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\t...(isSmtp && !isPrivateNote && isMobile\n\t\t\t\t\t\t\t\t\t\t? { marginLeft: 8, marginRight: 8 }\n\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\tjustifyContent: placement,\n\t\t\t\t\t\t\t\t\tmarginBottom: nextMessage\n\t\t\t\t\t\t\t\t\t\t? nextMessage?.user?._id === message?.user?._id\n\t\t\t\t\t\t\t\t\t\t\t? 4\n\t\t\t\t\t\t\t\t\t\t\t: 20\n\t\t\t\t\t\t\t\t\t\t: 0,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{/* Left avatar or placeholder (for mobile, avatar is hidden) */}\n\t\t\t\t\t\t\t\t{!isMobile && position === 'left' && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tstyle={{ marginRight: '4px', width: '24px', flexShrink: 0 }}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{renderMessageAvatar(message, previousMessage, nextMessage)}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t\t{/* Message bubble */}\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tid={`message-bubble-${\n\t\t\t\t\t\t\t\t\t\tmessage._id ?? `${index}-${messageIdGenerator?.() ?? 'id'}`\n\t\t\t\t\t\t\t\t\t}`}\n\t\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t\tappType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t\t\t\t? { width: '100%' }\n\t\t\t\t\t\t\t\t\t\t\t: isMobile && isSmtp\n\t\t\t\t\t\t\t\t\t\t\t? { display: 'flex', flexGrow: 1 }\n\t\t\t\t\t\t\t\t\t\t\t: {}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{renderMessageBubble(message, previousMessage, nextMessage)}\n\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t{/* Right avatar or placeholder (for mobile, avatar is hidden) */}\n\t\t\t\t\t\t\t\t{!isMobile && position === 'right' && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\tmarginLeft: '4px',\n\t\t\t\t\t\t\t\t\t\t\twidth: '24px',\n\t\t\t\t\t\t\t\t\t\t\tflexShrink: 0,\n\t\t\t\t\t\t\t\t\t\t\talignSelf: 'flex-start',\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{renderMessageAvatar(message, previousMessage, nextMessage)}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</React.Fragment>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default forwardRef<HTMLDivElement, GiftedChatProps<IMessage>>(\n\tGiftedChatInner,\n);\n"],"names":["CollapsibleBubbleText","_ref","text","isExpanded","onToggle","textRef","useRef","isOverflowing","setIsOverflowing","useState","useEffect","el","current","style","maxHeight","overflows","scrollHeight","_jsxs","_jsx","jsx","Object","assign","ref","overflow","children","BodySecondary","Button","buttonType","size","buttonText","onClick","GiftedChatInner","props","forwardedRef","_b","messages","user","renderBubble","renderAvatar","renderDay","renderLoading","renderChatEmpty","listViewProps","renderAvatarOnTop","showUserAvatar","showAvatarForEveryMessage","inverted","messageIdGenerator","topThreshold","TOP_THRESHOLD","appType","GiftedChatAppType","Bik","isActivityMessage","forceLeftAlign","extraProps","__rest","isMobile","useWindowSize","internalScrollRef","scrollRef","normalizeRef","scrollState","isInitialMount","isUserScrolling","isLoadingOldMessages","isAtBottom","hasTriggeredEndReached","lastMessagesLength","_a","length","previousScrollHeight","previousScrollTop","scrollTimeout","expandedMessages","setExpandedMessages","Set","reversedMessages","useMemo","reverse","scrollToBottom","useScrollToBottom","useImperativeHandle","useInitialMountScroll","useScrollCleanup","useRestoreScrollPosition","useAutoScrollOnNewMessages","useResizeObserverForFirstMessage","handleScroll","useScrollHandler","onEndReached","onScroll","isUserMessage","useCallback","message","Boolean","_id","shouldShowAvatar","previousMessage","renderMessageBubble","nextMessage","position","isTopOfStack","isBottomOfStack","_c","_d","bubbleProps","currentMessage","messageId","has","maxWidth","Manifest","width","minWidth","padding","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","border","backgroundColor","COLORS","background","brandTint","brandLight","pureWhite","inactive","color","content","primary","wordBreak","_e","prev","next","delete","add","renderMessageAvatar","flex","overflowY","overflowX","display","flexDirection","height","map","index","shouldShowDay","isSameDay","placement","getMessagePlacement","isCentered","shouldCenterAlign","isSmtp","MESSAGE_CHANNELS","SMTP","isPrivateNote","Constants","ChatActivity","Category","ACTIVITY","Type","PRIVATE_NOTE","jsxs","React","Fragment","createdAt","Day","margin","alignItems","marginRight","marginLeft","justifyContent","marginBottom","flexShrink","id","flexGrow","alignSelf","_f","_g","_Fragment","GiftedChat","forwardRef"],"mappings":"2jBA8BA,MAEMA,EAIDC,IAAmC,IAAlCC,KAAEA,EAAIC,WAAEA,EAAUC,SAAEA,GAAUH,EACnC,MAAMI,EAAUC,SAAuB,OAChCC,EAAeC,GAAoBC,EAAQA,UAAC,GAanD,OAXAC,EAAAA,WAAU,KACT,MAAMC,EAAKN,EAAQO,QACnB,GAAID,EAAI,CAEPA,EAAGE,MAAMC,UAAY,OACrB,MAAMC,EAAYJ,EAAGK,aAfK,IAgB1BL,EAAGE,MAAMC,UAAYX,EAAa,OAAY,QAC9CK,EAAiBO,E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E,WAAO,IAAAS,EAAAA,EAAA,GAAGuC,aAASb,EAAApF,aAAkB,EAAlBA,mBAA0B,SAEtDlC,MACCqC,IAAYC,EAAiBA,kBAAC4D,SAC3B,CAAEC,MAAO,QACTvD,GAAY8F,EACZ,CAAEX,QAAS,OAAQkC,SAAU,GAC7B,IAGH,CAAAtJ,SAAA2E,EAAoBL,EAASI,EAAiBE,OAI9C3C,GAAyB,UAAb4C,GACbnF,MACC,MAAAE,OAAAC,OAAA,CAAAR,MAAO,CACN4J,WAAY,MACZzD,MAAO,OACP4D,WAAY,EACZG,UAAW,eACX,CAAAvJ,SAEAgH,EAAoB1C,EAASI,EAAiBE,YApE9B,QAAf4E,EAAAlF,EAAQE,WAAO,IAAAgF,EAAAA,EAAA,GAAGhC,KAAmC,QAA1BiC,EAAAlI,aAAkB,EAAlBA,WAA0B,IAAAkI,EAAAA,EAAA,OAwE1C,WApHdxI,EAAkBvB,EAAGC,IAAA+J,WAAA,CAAA1J,SAAAiB,MAAwB,IAwH9C,EAIR,IAAA0I,EAAeC,EAAAA,WACdrJ"}
1
+ {"version":3,"file":"GiftedChat.js","sources":["../../../../../src/components/BikGiftedChat/GiftedChat/GiftedChat.tsx"],"sourcesContent":["import React, {\n\tforwardRef,\n\tuseCallback,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { COLORS } from '../../../constants/Theme';\nimport { useWindowSize } from '../../../hooks/useWindowSize';\nimport { Button } from '../../button';\nimport { BodySecondary } from '../../TypographyStyle';\nimport { BubbleProps, GiftedChatAppType } from '../Bubble/types';\nimport { IMessage } from '../types';\nimport { Day } from './Day';\nimport { getMessagePlacement, shouldCenterAlign } from './messageHelpers';\nimport {\n\tuseAutoScrollOnNewMessages,\n\tuseInitialMountScroll,\n\tuseResizeObserverForFirstMessage,\n\tuseRestoreScrollPosition,\n\tuseScrollCleanup,\n\tuseScrollHandler,\n\tuseScrollToBottom,\n} from './scrollHooks';\nimport { AvatarProps, GiftedChatProps, MESSAGE_CHANNELS } from './types';\nimport { isSameDay, normalizeRef } from './utils';\nimport { Constants, TOP_THRESHOLD } from './utils';\n\nconst COLLAPSED_MAX_HEIGHT = 204;\n\nconst CollapsibleBubbleText: React.FC<{\n\ttext: string;\n\tisExpanded: boolean;\n\tonToggle: () => void;\n}> = ({ text, isExpanded, onToggle }) => {\n\tconst textRef = useRef<HTMLDivElement>(null);\n\tconst [isOverflowing, setIsOverflowing] = useState(false);\n\n\tuseEffect(() => {\n\t\tconst el = textRef.current;\n\t\tif (el) {\n\t\t\t// Temporarily remove max-height to measure true scroll height\n\t\t\tel.style.maxHeight = 'none';\n\t\t\tconst overflows = el.scrollHeight > COLLAPSED_MAX_HEIGHT;\n\t\t\tel.style.maxHeight = isExpanded ? 'none' : `${COLLAPSED_MAX_HEIGHT}px`;\n\t\t\tsetIsOverflowing(overflows);\n\t\t}\n\t}, [text, isExpanded]);\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tref={textRef}\n\t\t\t\tstyle={{\n\t\t\t\t\tmaxHeight: isExpanded ? 'none' : COLLAPSED_MAX_HEIGHT,\n\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<BodySecondary>{text}</BodySecondary>\n\t\t\t</div>\n\t\t\t{isOverflowing && (\n\t\t\t\t<Button\n\t\t\t\t\tbuttonType=\"text\"\n\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\tbuttonText={isExpanded ? 'Show less' : 'Read more'}\n\t\t\t\t\tonClick={onToggle}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t);\n};\n\nconst GiftedChatInner = (\n\tprops: Omit<GiftedChatProps<IMessage>, 'ref'>,\n\tforwardedRef: React.Ref<HTMLDivElement>,\n) => {\n\tconst {\n\t\tmessages = [],\n\t\tuser,\n\t\trenderBubble,\n\t\trenderAvatar,\n\t\trenderDay,\n\t\trenderLoading,\n\t\trenderChatEmpty,\n\t\tlistViewProps = {},\n\t\trenderAvatarOnTop = false,\n\t\tshowUserAvatar = false,\n\t\tshowAvatarForEveryMessage = false,\n\t\tinverted = false,\n\t\tmessageIdGenerator,\n\t\ttopThreshold = TOP_THRESHOLD,\n\t\tappType = GiftedChatAppType.Bik,\n\t\tmaxHeight,\n\t\tisActivityMessage,\n\t\t...extraProps\n\t} = props || {};\n\n\tconst isMobile = useWindowSize();\n\n\tconst internalScrollRef = useRef<HTMLDivElement | null>(null);\n\tconst scrollRef = normalizeRef(\n\t\tlistViewProps.ref || forwardedRef,\n\t\tinternalScrollRef,\n\t);\n\n\tconst scrollState = useRef({\n\t\tisInitialMount: true,\n\t\tisUserScrolling: false,\n\t\tisLoadingOldMessages: false,\n\t\tisAtBottom: true,\n\t\thasTriggeredEndReached: false,\n\t\tlastMessagesLength: messages?.length ?? 0,\n\t\tpreviousScrollHeight: 0,\n\t\tpreviousScrollTop: 0,\n\t\tscrollTimeout: null,\n\t});\n\n\tconst [expandedMessages, setExpandedMessages] = useState<\n\t\tSet<string | number>\n\t>(new Set());\n\n\t// Reverse messages so newest appears last in DOM (natural reading order)\n\tconst reversedMessages = useMemo(() => {\n\t\tif (!messages || messages.length === 0) return [] as IMessage[];\n\t\treturn [...messages].reverse() as IMessage[];\n\t}, [messages]);\n\n\tconst scrollToBottom = useScrollToBottom(scrollRef, scrollState);\n\n\tuseImperativeHandle(forwardedRef, () => scrollRef.current!);\n\n\tuseInitialMountScroll(\n\t\tscrollRef,\n\t\tscrollState,\n\t\treversedMessages.length,\n\t\tscrollToBottom,\n\t);\n\n\tuseScrollCleanup(scrollState);\n\n\tuseRestoreScrollPosition(scrollRef, scrollState, reversedMessages.length);\n\n\tuseAutoScrollOnNewMessages(\n\t\tscrollRef,\n\t\tscrollState,\n\t\tmessages.length,\n\t\tscrollToBottom,\n\t);\n\n\tuseResizeObserverForFirstMessage(\n\t\tmessages?.[0],\n\t\tscrollState,\n\t\tscrollToBottom,\n\t\tmessageIdGenerator,\n\t);\n\n\tconst handleScroll = useScrollHandler(\n\t\tscrollState,\n\t\tlistViewProps.onEndReached,\n\t\tlistViewProps.onScroll,\n\t\ttopThreshold,\n\t);\n\n\t// Check if a message belongs to the current user\n\tconst isUserMessage = useCallback(\n\t\t(message: IMessage) => {\n\t\t\treturn Boolean(message && user && message.user?._id === user._id);\n\t\t},\n\t\t[user],\n\t);\n\n\t// Determine if avatar should be shown for this message\n\tconst shouldShowAvatar = useCallback(\n\t\t(message: IMessage, previousMessage?: IMessage) => {\n\t\t\tif (!showUserAvatar) return false;\n\t\t\tif (showAvatarForEveryMessage) return true;\n\n\t\t\t// Show avatar on the first message in a consecutive sender stack,\n\t\t\t// or when an activity interrupts the stack, or when the current message itself is an activity\n\t\t\treturn (\n\t\t\t\t!previousMessage ||\n\t\t\t\t(isActivityMessage ? isActivityMessage(message) : false) ||\n\t\t\t\t(isActivityMessage ? isActivityMessage(previousMessage) : false) ||\n\t\t\t\tpreviousMessage.user._id !== message.user._id\n\t\t\t);\n\t\t},\n\t\t[showUserAvatar, showAvatarForEveryMessage, isActivityMessage],\n\t);\n\n\t// Render a message bubble (or call custom renderBubble)\n\tconst renderMessageBubble = useCallback(\n\t\t(message: IMessage, previousMessage?: IMessage, nextMessage?: IMessage) => {\n\t\t\tconst position = isUserMessage(message) ? 'right' : 'left';\n\t\t\tconst isTopOfStack = previousMessage?.user?._id !== message?.user?._id;\n\t\t\tconst isBottomOfStack = nextMessage?.user?._id !== message?.user?._id;\n\n\t\t\tconst bubbleProps: BubbleProps<IMessage> = {\n\t\t\t\tcurrentMessage: message,\n\t\t\t\tpreviousMessage,\n\t\t\t\tnextMessage,\n\t\t\t\tposition,\n\t\t\t\tuser,\n\t\t\t\t...extraProps,\n\t\t\t};\n\n\t\t\t// Use custom render function if provided\n\t\t\tif (renderBubble) {\n\t\t\t\treturn renderBubble(bubbleProps);\n\t\t\t}\n\n\t\t\t// Default bubble rendering\n\t\t\tconst messageId = message._id;\n\t\t\tconst isExpanded = expandedMessages.has(messageId);\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tmaxWidth: appType === GiftedChatAppType.Manifest ? '50%' : '70%',\n\t\t\t\t\t\twidth: 'fit-content',\n\t\t\t\t\t\t...(appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t? { minWidth: '130px' }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\tpadding: '8px 12px',\n\t\t\t\t\t\tborderTopLeftRadius:\n\t\t\t\t\t\t\tposition === 'left' ? (isTopOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\t\tposition === 'right' ? (isTopOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\t\tposition === 'left' ? (isBottomOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\t\tposition === 'right' ? (isBottomOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborder:\n\t\t\t\t\t\t\tposition === 'left' && appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t? '1px solid rgb(224, 224, 224)'\n\t\t\t\t\t\t\t\t: 'none',\n\t\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\t\tposition === 'right'\n\t\t\t\t\t\t\t\t? appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t\t? COLORS.background.brandTint\n\t\t\t\t\t\t\t\t\t: COLORS.background.brandLight\n\t\t\t\t\t\t\t\t: appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t? COLORS.background.pureWhite\n\t\t\t\t\t\t\t\t: COLORS.background.inactive,\n\t\t\t\t\t\tcolor: COLORS.content.primary,\n\t\t\t\t\t\twordBreak: 'break-word',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<CollapsibleBubbleText\n\t\t\t\t\t\ttext={message.text ?? ''}\n\t\t\t\t\t\tisExpanded={isExpanded}\n\t\t\t\t\t\tonToggle={() =>\n\t\t\t\t\t\t\tsetExpandedMessages((prev) => {\n\t\t\t\t\t\t\t\tconst next = new Set(prev);\n\t\t\t\t\t\t\t\tif (isExpanded) next.delete(messageId);\n\t\t\t\t\t\t\t\telse next.add(messageId);\n\t\t\t\t\t\t\t\treturn next;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t);\n\t\t},\n\t\t[isUserMessage, user, renderBubble, extraProps, expandedMessages],\n\t);\n\n\t// Render a message avatar (or call custom renderAvatar)\n\tconst renderMessageAvatar = useCallback(\n\t\t(message: IMessage, previousMessage?: IMessage, nextMessage?: IMessage) => {\n\t\t\tconst shouldShow = shouldShowAvatar(message, previousMessage);\n\n\t\t\tif (!shouldShow) return null;\n\n\t\t\tconst position = isUserMessage(message) ? 'right' : 'left';\n\n\t\t\tconst avatarProps: AvatarProps<IMessage> = {\n\t\t\t\tcurrentMessage: message,\n\t\t\t\tpreviousMessage,\n\t\t\t\tnextMessage,\n\t\t\t\tposition,\n\t\t\t\tuser,\n\t\t\t\trenderAvatarOnTop,\n\t\t\t\tshowUserAvatar,\n\t\t\t\tshowAvatarForEveryMessage,\n\t\t\t};\n\n\t\t\treturn renderAvatar ? renderAvatar(avatarProps) : null;\n\t\t},\n\t\t[\n\t\t\tshouldShowAvatar,\n\t\t\tisUserMessage,\n\t\t\tuser,\n\t\t\trenderAvatarOnTop,\n\t\t\tshowUserAvatar,\n\t\t\tshowAvatarForEveryMessage,\n\t\t\trenderAvatar,\n\t\t],\n\t);\n\n\t// Render: Empty State\n\tif (!messages || messages.length === 0) {\n\t\treturn renderChatEmpty ? <>{renderChatEmpty()}</> : null;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tref={scrollRef as React.RefObject<HTMLDivElement>}\n\t\t\tstyle={{\n\t\t\t\tflex: 1,\n\t\t\t\toverflowY: 'auto',\n\t\t\t\toverflowX: 'hidden',\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tflexDirection: 'column',\n\t\t\t\t...(maxHeight ? { maxHeight, height: maxHeight } : {}),\n\t\t\t\t...listViewProps.style,\n\t\t\t}}\n\t\t\tonScroll={handleScroll}\n\t\t>\n\t\t\t{/* Spacer to push messages to bottom (newest appears last in DOM) */}\n\t\t\t<div style={{ flex: '1 0 auto' }} />\n\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\tflex: '0 0 auto',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{reversedMessages.map((message, index) => {\n\t\t\t\t\tconst isSmtp =\n\t\t\t\t\t\tmessage?.['channelId'] === MESSAGE_CHANNELS.SMTP ||\n\t\t\t\t\t\tmessage?.['channelName'] === MESSAGE_CHANNELS.SMTP;\n\t\t\t\t\tconst position = isSmtp ? 'left' : (isUserMessage(message) ? 'right' : 'left');\n\t\t\t\t\tconst previousMessage = reversedMessages[index - 1];\n\t\t\t\t\tconst nextMessage = reversedMessages[index + 1];\n\t\t\t\t\tconst shouldShowDay = !isSameDay(message, previousMessage);\n\t\t\t\t\tconst placement = getMessagePlacement(message, position);\n\t\t\t\t\tconst isCentered = shouldCenterAlign(message);\n\t\t\t\t\t// Check if message is a private note\n\t\t\t\t\tconst isPrivateNote =\n\t\t\t\t\t\tmessage['category'] === Constants.ChatActivity.Category.ACTIVITY &&\n\t\t\t\t\t\tmessage['activityType'] ===\n\t\t\t\t\t\t\tConstants.ChatActivity.Type.PRIVATE_NOTE;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<React.Fragment\n\t\t\t\t\t\t\tkey={message._id ?? `${index}-${messageIdGenerator?.() ?? 'id'}`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{/* Day separator */}\n\t\t\t\t\t\t\t{shouldShowDay &&\n\t\t\t\t\t\t\t\t(renderDay ? (\n\t\t\t\t\t\t\t\t\trenderDay({ createdAt: message.createdAt })\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<Day createdAt={message.createdAt} appType={appType} />\n\t\t\t\t\t\t\t\t))}\n\n\t\t\t\t\t\t\t{/* Message container */}\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t...(isMobile ? { margin: '0 4px' } : {}),\n\t\t\t\t\t\t\t\t\t...(isCentered\n\t\t\t\t\t\t\t\t\t\t? {}\n\t\t\t\t\t\t\t\t\t\t: { display: 'flex', alignItems: 'flex-start' }),\n\t\t\t\t\t\t\t\t\t...(appType !== GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t\t\t? !isMobile && position === 'right'\n\t\t\t\t\t\t\t\t\t\t\t? { marginLeft: 8 }\n\t\t\t\t\t\t\t\t\t\t\t: { marginRight: 8 }\n\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\t...(isSmtp && !isPrivateNote && isMobile\n\t\t\t\t\t\t\t\t\t\t? { marginLeft: 8, marginRight: 8 }\n\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\tjustifyContent: placement,\n\t\t\t\t\t\t\t\t\tmarginBottom: nextMessage\n\t\t\t\t\t\t\t\t\t\t? nextMessage?.user?._id === message?.user?._id\n\t\t\t\t\t\t\t\t\t\t\t? 4\n\t\t\t\t\t\t\t\t\t\t\t: 20\n\t\t\t\t\t\t\t\t\t\t: 0,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{/* Left avatar or placeholder (for mobile, avatar is hidden) */}\n\t\t\t\t\t\t\t\t{!isMobile && position === 'left' && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tstyle={{ marginRight: '4px', width: '24px', flexShrink: 0 }}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{renderMessageAvatar(message, previousMessage, nextMessage)}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t\t{/* Message bubble */}\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tid={`message-bubble-${\n\t\t\t\t\t\t\t\t\t\tmessage._id ?? `${index}-${messageIdGenerator?.() ?? 'id'}`\n\t\t\t\t\t\t\t\t\t}`}\n\t\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t\tappType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t\t\t\t? { width: '100%' }\n\t\t\t\t\t\t\t\t\t\t\t: isMobile && isSmtp\n\t\t\t\t\t\t\t\t\t\t\t? { display: 'flex', flexGrow: 1 }\n\t\t\t\t\t\t\t\t\t\t\t: {}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{renderMessageBubble(message, previousMessage, nextMessage)}\n\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t{/* Right avatar or placeholder (for mobile, avatar is hidden) */}\n\t\t\t\t\t\t\t\t{!isMobile && position === 'right' && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\tmarginLeft: '4px',\n\t\t\t\t\t\t\t\t\t\t\twidth: '24px',\n\t\t\t\t\t\t\t\t\t\t\tflexShrink: 0,\n\t\t\t\t\t\t\t\t\t\t\talignSelf: 'flex-start',\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{renderMessageAvatar(message, previousMessage, nextMessage)}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</React.Fragment>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default forwardRef<HTMLDivElement, GiftedChatProps<IMessage>>(\n\tGiftedChatInner,\n);\n"],"names":["CollapsibleBubbleText","_ref","text","isExpanded","onToggle","textRef","useRef","isOverflowing","setIsOverflowing","useState","useEffect","el","current","style","maxHeight","overflows","scrollHeight","_jsxs","_jsx","jsx","Object","assign","ref","overflow","children","BodySecondary","Button","buttonType","size","buttonText","onClick","GiftedChatInner","props","forwardedRef","_b","messages","user","renderBubble","renderAvatar","renderDay","renderLoading","renderChatEmpty","listViewProps","renderAvatarOnTop","showUserAvatar","showAvatarForEveryMessage","inverted","messageIdGenerator","topThreshold","TOP_THRESHOLD","appType","GiftedChatAppType","Bik","isActivityMessage","extraProps","__rest","isMobile","useWindowSize","internalScrollRef","scrollRef","normalizeRef","scrollState","isInitialMount","isUserScrolling","isLoadingOldMessages","isAtBottom","hasTriggeredEndReached","lastMessagesLength","_a","length","previousScrollHeight","previousScrollTop","scrollTimeout","expandedMessages","setExpandedMessages","Set","reversedMessages","useMemo","reverse","scrollToBottom","useScrollToBottom","useImperativeHandle","useInitialMountScroll","useScrollCleanup","useRestoreScrollPosition","useAutoScrollOnNewMessages","useResizeObserverForFirstMessage","handleScroll","useScrollHandler","onEndReached","onScroll","isUserMessage","useCallback","message","Boolean","_id","shouldShowAvatar","previousMessage","renderMessageBubble","nextMessage","position","isTopOfStack","isBottomOfStack","_c","_d","bubbleProps","currentMessage","messageId","has","maxWidth","Manifest","width","minWidth","padding","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","border","backgroundColor","COLORS","background","brandTint","brandLight","pureWhite","inactive","color","content","primary","wordBreak","_e","prev","next","delete","add","renderMessageAvatar","flex","overflowY","overflowX","display","flexDirection","height","map","index","isSmtp","MESSAGE_CHANNELS","SMTP","shouldShowDay","isSameDay","placement","getMessagePlacement","isCentered","shouldCenterAlign","isPrivateNote","Constants","ChatActivity","Category","ACTIVITY","Type","PRIVATE_NOTE","jsxs","React","Fragment","createdAt","Day","margin","alignItems","marginRight","marginLeft","justifyContent","marginBottom","flexShrink","id","flexGrow","alignSelf","_f","_Fragment","GiftedChat","forwardRef"],"mappings":"2jBA8BA,MAEMA,EAIDC,IAAmC,IAAlCC,KAAEA,EAAIC,WAAEA,EAAUC,SAAEA,GAAUH,EACnC,MAAMI,EAAUC,SAAuB,OAChCC,EAAeC,GAAoBC,EAAQA,UAAC,GAanD,OAXAC,EAAAA,WAAU,KACT,MAAMC,EAAKN,EAAQO,QACnB,GAAID,EAAI,CAEPA,EAAGE,MAAMC,UAAY,OACrB,MAAMC,EAAYJ,EAAGK,aAfK,IAgB1BL,EAAGE,MAAMC,UAAYX,EAAa,OAAY,QAC9CK,EAAiBO,EACjB,IACC,CAACb,EAAMC,IAGTc,EAAAA,2BACCC,EACCC,IAAA,MAAAC,OAAAC,OAAA,CAAAC,IAAKjB,EACLQ,MAAO,CACNC,UAAWX,EAAa,OA1BA,IA2BxBoB,SAAU,WACV,CAAAC,SAEDN,MAACO,gBAAa,CAAAD,SAAEtB,OAEhBK,GACAW,EAAAC,IAACO,SACA,CAAAC,WAAW,OACXC,KAAK,KACLC,WAAY1B,EAAa,YAAc,YACvC2B,QAAS1B,MAGT,EAIC2B,EAAkBA,CACvBC,EACAC,WAEA,MAAMC,EAmBFF,GAAS,CAAE,GAnBTG,SACLA,EAAW,GAAEC,KACbA,EAAIC,aACJA,EAAYC,aACZA,EAAYC,UACZA,EAASC,cACTA,EAAaC,gBACbA,EAAeC,cACfA,EAAgB,CAAE,EAAAC,kBAClBA,GAAoB,EAAKC,eACzBA,GAAiB,EAAKC,0BACtBA,GAA4B,EAAKC,SACjCA,GAAW,EAAKC,mBAChBA,EAAkBC,aAClBA,EAAeC,EAAaA,cAAAC,QAC5BA,EAAUC,EAAiBA,kBAACC,IAAGtC,UAC/BA,EAASuC,kBACTA,GAAiBnB,EACdoB,EAlBEC,EAAAA,OAAArB,EAAA,CAAA,WAAA,OAAA,eAAA,eAAA,YAAA,gBAAA,kBAAA,gBAAA,oBAAA,iBAAA,4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AIH,CAAAvE,SAAA,EAACgC,GAAyB,SAAb4C,GACblF,MACC,MAAAE,OAAAC,OAAA,CAAAR,MAAO,CAAE0J,YAAa,MAAOxD,MAAO,OAAQ4D,WAAY,IAEvD,CAAAnJ,SAAA+G,EAAoB1C,EAASI,EAAiBE,MAKjDjF,EAAAC,IAAA,MAAAC,OAAAC,OAAA,CACCuJ,GAAI,kBACY,QAAfrE,EAAAV,EAAQE,WAAO,IAAAQ,EAAAA,EAAA,GAAGwC,aAASvC,EAAAzD,aAAkB,EAAlBA,mBAA0B,SAEtDlC,MACCqC,IAAYC,EAAiBA,kBAAC2D,SAC3B,CAAEC,MAAO,QACTvD,GAAYwF,EACZ,CAAEL,QAAS,OAAQkC,SAAU,GAC7B,IAGH,CAAArJ,SAAA0E,EAAoBL,EAASI,EAAiBE,OAI9C3C,GAAyB,UAAb4C,GACblF,MACC,MAAAE,OAAAC,OAAA,CAAAR,MAAO,CACN2J,WAAY,MACZzD,MAAO,OACP4D,WAAY,EACZG,UAAW,eACX,CAAAtJ,SAEA+G,EAAoB1C,EAASI,EAAiBE,YApE9B,QAAf+B,EAAArC,EAAQE,WAAO,IAAAmC,EAAAA,EAAA,GAAGa,KAAmC,QAA1BgC,EAAAhI,aAAkB,EAAlBA,WAA0B,IAAAgI,EAAAA,EAAA,OAwE1C,WApHdtI,EAAkBvB,EAAGC,IAAA6J,WAAA,CAAAxJ,SAAAiB,MAAwB,IAwH9C,EAIR,IAAAwI,EAAeC,EAAAA,WACdnJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../../../src/components/BikGiftedChat/GiftedChat/types.ts"],"sourcesContent":["import React from 'react';\nimport { BubbleProps, GiftedChatAppType } from '../Bubble/types';\nimport { IMessage, LeftRightStyle, User } from '../types';\n\nexport interface ListViewProps {\n\t/** Custom styles for the container. */\n\tstyle?: React.CSSProperties;\n\t/** Callback when end of list is reached. */\n\tonEndReached?: () => void;\n\t/** Threshold for triggering end reached. */\n\tonEndReachedThreshold?: number;\n\t/** Scroll event handler. */\n\tonScroll?: (event: React.UIEvent<HTMLDivElement>) => void;\n\t/** Ref for the scrollable container. */\n\tref?:\n\t\t| React.RefObject<HTMLDivElement>\n\t\t| React.MutableRefObject<HTMLDivElement | null>;\n}\n\nexport interface AvatarProps<TMessage extends IMessage = IMessage> {\n\t/** The current message for the avatar. */\n\tcurrentMessage: TMessage;\n\t/** The previous message. */\n\tpreviousMessage?: TMessage;\n\t/** The next message. */\n\tnextMessage?: TMessage;\n\t/** Position of the avatar ('left' or 'right'). */\n\tposition: 'left' | 'right';\n\t/** The user object. */\n\tuser: User;\n\t/** Whether to render avatar on top. */\n\trenderAvatarOnTop?: boolean;\n\t/** Whether to show user avatar. */\n\tshowUserAvatar?: boolean;\n\t/** Show avatar for every message; when false, show only on the first message of each consecutive sender group. */\n\tshowAvatarForEveryMessage?: boolean;\n\t/** Custom styles for avatar image. */\n\timageStyle?: LeftRightStyle<React.CSSProperties>;\n\t/** Custom styles for avatar container. */\n\tcontainerStyle?: LeftRightStyle<React.CSSProperties>;\n\t[key: string]: any;\n}\n\nexport interface DayProps {\n\t/** Date/time for the separator. */\n\tcreatedAt?: Date | number | string;\n\t/** Format for displaying the date. */\n\tdateFormat?: string;\n\t/** Calendar format options. */\n\tdateFormatCalendar?: {\n\t\t/** Format for same day. */\n\t\tsameDay?: string;\n\t\t/** Format for next day. */\n\t\tnextDay?: string;\n\t\t/** Format for next week. */\n\t\tnextWeek?: string;\n\t\t/** Format for last day. */\n\t\tlastDay?: string;\n\t\t/** Format for last week. */\n\t\tlastWeek?: string;\n\t\t/** Format for other days. */\n\t\tsameElse?: string;\n\t};\n}\n\nexport interface GiftedChatProps<TMessage extends IMessage = IMessage> {\n\t/** Array of chat messages. */\n\tmessages: TMessage[];\n\t/** The current user object. */\n\tuser: User;\n\n\t/** Custom bubble renderer. */\n\trenderBubble?: (props: BubbleProps<TMessage>) => React.ReactNode;\n\t/** Custom avatar renderer. */\n\trenderAvatar?: (props: AvatarProps<TMessage>) => React.ReactNode;\n\t/** Custom day separator renderer. */\n\trenderDay?: (props: DayProps) => React.ReactNode;\n\t/** Custom loading renderer. */\n\trenderLoading?: () => React.ReactNode;\n\t/** Custom empty chat renderer. */\n\trenderChatEmpty?: () => React.ReactNode;\n\n\t/** Props for the scrollable list view. */\n\tlistViewProps?: ListViewProps;\n\n\t/** Scroll threshold for loading old messages. */\n\ttopThreshold?: number;\n\n\t/** Whether to render avatar on top. */\n\trenderAvatarOnTop?: boolean;\n\t/** Whether to show user avatar. */\n\tshowUserAvatar?: boolean;\n\t/** Show avatar for every message; when false, show only on the first message of each consecutive sender group. */\n\tshowAvatarForEveryMessage?: boolean;\n\t/** Whether to invert the message list. */\n\tinverted?: boolean;\n\n\t/** Handler for long press on message. */\n\tonLongPress?: (context?: any, message?: TMessage) => void;\n\t/** Handler for press on message. */\n\tonPress?: (context?: any, message?: TMessage) => void;\n\n\t/** Function to generate message IDs. */\n\tmessageIdGenerator?: (message?: TMessage) => string;\n\tappType?: GiftedChatAppType;\n\t/** Maximum height of the chat messages container in pixels. When set, the container clips overflow and scrolls within that height. */\n\tmaxHeight?: number;\n\t/** Returns true if a message is a non-chat activity (e.g. assignment, status change). Used to break sender stacks for avatar and border-radius logic. */\n\tisActivityMessage?: (message: TMessage) => boolean;\n\t/** Returns true if a message should always be aligned to the left with no avatar, regardless of sender. */\n\tforceLeftAlign?: (message: TMessage) => boolean;\n\n\t[key: string]: any;\n}\n\nexport interface ScrollState {\n\t/** Is initial mount of the component. */\n\tisInitialMount: boolean;\n\t/** Is user currently scrolling. */\n\tisUserScrolling: boolean;\n\t/** Is loading old messages. */\n\tisLoadingOldMessages: boolean;\n\n\t/** Is scroll at bottom. */\n\tisAtBottom: boolean;\n\t/** Has end reached been triggered. */\n\thasTriggeredEndReached: boolean;\n\n\t/** Last known messages length. */\n\tlastMessagesLength: number;\n\n\t/** Previous scroll height. */\n\tpreviousScrollHeight: number;\n\t/** Previous scroll top position. */\n\tpreviousScrollTop: number;\n\n\t/** Debounce timer for scroll events. */\n\tscrollTimeout: number | null;\n}\n\nexport enum CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE {\n\t/** User is calling another user. */\n\tCALLING_CALL = 'CALLING_CALL',\n\t/** Call is ringing for the recipient. */\n\tRINGING_CALL = 'RINGING_CALL',\n\t/** Call is ongoing between users. */\n\tONGOING_CALL = 'ONGOING_CALL',\n\t/** Call has been completed. */\n\tCOMPLETED_CALL = 'COMPLETED_CALL',\n\t/** Call was missed by the recipient. */\n\tMISSED_CALL = 'MISSED_CALL',\n\t/** Callback was requested. */\n\tREQUESTED_CALLBACK = 'REQUESTED_CALLBACK',\n\t/** Call was declined by the recipient. */\n\tDECLINED_CALL = 'DECLINED_CALL',\n\t/** Call was disconnected. */\n\tDISCONNECTED_CALL = 'DISCONNECTED_CALL',\n\t/** Call was unanswered. */\n\tUNANSWERED_CALL = 'UNANSWERED_CALL',\n}\n\nexport const enum MESSAGE_CHANNELS {\n\tINSTAGRAM = 'instagram',\n\tMESSENGER = 'messenger',\n\tWHATSAPP = 'whatsapp',\n\tGMAIL = 'gmail',\n\tLIVECHAT = 'livechat',\n\tGOOGLE_BUSINESS_CHAT = 'gbm',\n\tSHOPIFY = 'shopify',\n\tFACEBOOK = 'facebook',\n\tEMAIL = 'email',\n\tSMTP = 'smtp',\n\tFACEBOOK_CATALOG = 'facebook-catalog',\n\tWHATSAPP_VOICE_CALL = 'whatsapp-voice-call',\n\tCREATE_SIGNATURE = 'create-signature',\n\tEDIT_SIGNATURE = 'edit-signature',\n\tWEBPUSH = 'webpush',\n\tTASKS = 'tasks',\n\tRCS = 'rcs',\n}\n"],"names":["CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE","MESSAGE_CHANNELS"],"mappings":"aA4IA,IAAYA,EAqBMC,yDArBND,QAmBXA,yCAAA,GAnBWA,EAAAA,8CAAAA,QAAAA,oCAmBX,CAAA,IAjBA,aAAA,eAEAA,EAAA,aAAA,eAEAA,EAAA,aAAA,eAEAA,EAAA,eAAA,iBAEAA,EAAA,YAAA,cAEAA,EAAA,mBAAA,qBAEAA,EAAA,cAAA,gBAEAA,EAAA,kBAAA,oBAEAA,EAAA,gBAAA,kBAGiBC,QAkBjBA,sBAAA,GAlBiBA,EAAAA,QAAgBA,mBAAhBA,yBAkBjB,CAAA,IAjBA,UAAA,YACAA,EAAA,UAAA,YACAA,EAAA,SAAA,WACAA,EAAA,MAAA,QACAA,EAAA,SAAA,WACAA,EAAA,qBAAA,MACAA,EAAA,QAAA,UACAA,EAAA,SAAA,WACAA,EAAA,MAAA,QACAA,EAAA,KAAA,OACAA,EAAA,iBAAA,mBACAA,EAAA,oBAAA,sBACAA,EAAA,iBAAA,mBACAA,EAAA,eAAA,iBACAA,EAAA,QAAA,UACAA,EAAA,MAAA,QACAA,EAAA,IAAA"}
1
+ {"version":3,"file":"types.js","sources":["../../../../../src/components/BikGiftedChat/GiftedChat/types.ts"],"sourcesContent":["import React from 'react';\nimport { BubbleProps, GiftedChatAppType } from '../Bubble/types';\nimport { IMessage, LeftRightStyle, User } from '../types';\n\nexport interface ListViewProps {\n\t/** Custom styles for the container. */\n\tstyle?: React.CSSProperties;\n\t/** Callback when end of list is reached. */\n\tonEndReached?: () => void;\n\t/** Threshold for triggering end reached. */\n\tonEndReachedThreshold?: number;\n\t/** Scroll event handler. */\n\tonScroll?: (event: React.UIEvent<HTMLDivElement>) => void;\n\t/** Ref for the scrollable container. */\n\tref?:\n\t\t| React.RefObject<HTMLDivElement>\n\t\t| React.MutableRefObject<HTMLDivElement | null>;\n}\n\nexport interface AvatarProps<TMessage extends IMessage = IMessage> {\n\t/** The current message for the avatar. */\n\tcurrentMessage: TMessage;\n\t/** The previous message. */\n\tpreviousMessage?: TMessage;\n\t/** The next message. */\n\tnextMessage?: TMessage;\n\t/** Position of the avatar ('left' or 'right'). */\n\tposition: 'left' | 'right';\n\t/** The user object. */\n\tuser: User;\n\t/** Whether to render avatar on top. */\n\trenderAvatarOnTop?: boolean;\n\t/** Whether to show user avatar. */\n\tshowUserAvatar?: boolean;\n\t/** Show avatar for every message; when false, show only on the first message of each consecutive sender group. */\n\tshowAvatarForEveryMessage?: boolean;\n\t/** Custom styles for avatar image. */\n\timageStyle?: LeftRightStyle<React.CSSProperties>;\n\t/** Custom styles for avatar container. */\n\tcontainerStyle?: LeftRightStyle<React.CSSProperties>;\n\t[key: string]: any;\n}\n\nexport interface DayProps {\n\t/** Date/time for the separator. */\n\tcreatedAt?: Date | number | string;\n\t/** Format for displaying the date. */\n\tdateFormat?: string;\n\t/** Calendar format options. */\n\tdateFormatCalendar?: {\n\t\t/** Format for same day. */\n\t\tsameDay?: string;\n\t\t/** Format for next day. */\n\t\tnextDay?: string;\n\t\t/** Format for next week. */\n\t\tnextWeek?: string;\n\t\t/** Format for last day. */\n\t\tlastDay?: string;\n\t\t/** Format for last week. */\n\t\tlastWeek?: string;\n\t\t/** Format for other days. */\n\t\tsameElse?: string;\n\t};\n}\n\nexport interface GiftedChatProps<TMessage extends IMessage = IMessage> {\n\t/** Array of chat messages. */\n\tmessages: TMessage[];\n\t/** The current user object. */\n\tuser: User;\n\n\t/** Custom bubble renderer. */\n\trenderBubble?: (props: BubbleProps<TMessage>) => React.ReactNode;\n\t/** Custom avatar renderer. */\n\trenderAvatar?: (props: AvatarProps<TMessage>) => React.ReactNode;\n\t/** Custom day separator renderer. */\n\trenderDay?: (props: DayProps) => React.ReactNode;\n\t/** Custom loading renderer. */\n\trenderLoading?: () => React.ReactNode;\n\t/** Custom empty chat renderer. */\n\trenderChatEmpty?: () => React.ReactNode;\n\n\t/** Props for the scrollable list view. */\n\tlistViewProps?: ListViewProps;\n\n\t/** Scroll threshold for loading old messages. */\n\ttopThreshold?: number;\n\n\t/** Whether to render avatar on top. */\n\trenderAvatarOnTop?: boolean;\n\t/** Whether to show user avatar. */\n\tshowUserAvatar?: boolean;\n\t/** Show avatar for every message; when false, show only on the first message of each consecutive sender group. */\n\tshowAvatarForEveryMessage?: boolean;\n\t/** Whether to invert the message list. */\n\tinverted?: boolean;\n\n\t/** Handler for long press on message. */\n\tonLongPress?: (context?: any, message?: TMessage) => void;\n\t/** Handler for press on message. */\n\tonPress?: (context?: any, message?: TMessage) => void;\n\n\t/** Function to generate message IDs. */\n\tmessageIdGenerator?: (message?: TMessage) => string;\n\tappType?: GiftedChatAppType;\n\t/** Maximum height of the chat messages container in pixels. When set, the container clips overflow and scrolls within that height. */\n\tmaxHeight?: number;\n\t/** Returns true if a message is a non-chat activity (e.g. assignment, status change). Used to break sender stacks for avatar and border-radius logic. */\n\tisActivityMessage?: (message: TMessage) => boolean;\n\n\t[key: string]: any;\n}\n\nexport interface ScrollState {\n\t/** Is initial mount of the component. */\n\tisInitialMount: boolean;\n\t/** Is user currently scrolling. */\n\tisUserScrolling: boolean;\n\t/** Is loading old messages. */\n\tisLoadingOldMessages: boolean;\n\n\t/** Is scroll at bottom. */\n\tisAtBottom: boolean;\n\t/** Has end reached been triggered. */\n\thasTriggeredEndReached: boolean;\n\n\t/** Last known messages length. */\n\tlastMessagesLength: number;\n\n\t/** Previous scroll height. */\n\tpreviousScrollHeight: number;\n\t/** Previous scroll top position. */\n\tpreviousScrollTop: number;\n\n\t/** Debounce timer for scroll events. */\n\tscrollTimeout: number | null;\n}\n\nexport enum CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE {\n\t/** User is calling another user. */\n\tCALLING_CALL = 'CALLING_CALL',\n\t/** Call is ringing for the recipient. */\n\tRINGING_CALL = 'RINGING_CALL',\n\t/** Call is ongoing between users. */\n\tONGOING_CALL = 'ONGOING_CALL',\n\t/** Call has been completed. */\n\tCOMPLETED_CALL = 'COMPLETED_CALL',\n\t/** Call was missed by the recipient. */\n\tMISSED_CALL = 'MISSED_CALL',\n\t/** Callback was requested. */\n\tREQUESTED_CALLBACK = 'REQUESTED_CALLBACK',\n\t/** Call was declined by the recipient. */\n\tDECLINED_CALL = 'DECLINED_CALL',\n\t/** Call was disconnected. */\n\tDISCONNECTED_CALL = 'DISCONNECTED_CALL',\n\t/** Call was unanswered. */\n\tUNANSWERED_CALL = 'UNANSWERED_CALL',\n}\n\nexport const enum MESSAGE_CHANNELS {\n\tINSTAGRAM = 'instagram',\n\tMESSENGER = 'messenger',\n\tWHATSAPP = 'whatsapp',\n\tGMAIL = 'gmail',\n\tLIVECHAT = 'livechat',\n\tGOOGLE_BUSINESS_CHAT = 'gbm',\n\tSHOPIFY = 'shopify',\n\tFACEBOOK = 'facebook',\n\tEMAIL = 'email',\n\tSMTP = 'smtp',\n\tFACEBOOK_CATALOG = 'facebook-catalog',\n\tWHATSAPP_VOICE_CALL = 'whatsapp-voice-call',\n\tCREATE_SIGNATURE = 'create-signature',\n\tEDIT_SIGNATURE = 'edit-signature',\n\tWEBPUSH = 'webpush',\n\tTASKS = 'tasks',\n\tRCS = 'rcs',\n}\n"],"names":["CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE","MESSAGE_CHANNELS"],"mappings":"aA0IA,IAAYA,EAqBMC,yDArBND,QAmBXA,yCAAA,GAnBWA,EAAAA,8CAAAA,QAAAA,oCAmBX,CAAA,IAjBA,aAAA,eAEAA,EAAA,aAAA,eAEAA,EAAA,aAAA,eAEAA,EAAA,eAAA,iBAEAA,EAAA,YAAA,cAEAA,EAAA,mBAAA,qBAEAA,EAAA,cAAA,gBAEAA,EAAA,kBAAA,oBAEAA,EAAA,gBAAA,kBAGiBC,QAkBjBA,sBAAA,GAlBiBA,EAAAA,QAAgBA,mBAAhBA,yBAkBjB,CAAA,IAjBA,UAAA,YACAA,EAAA,UAAA,YACAA,EAAA,SAAA,WACAA,EAAA,MAAA,QACAA,EAAA,SAAA,WACAA,EAAA,qBAAA,MACAA,EAAA,QAAA,UACAA,EAAA,SAAA,WACAA,EAAA,MAAA,QACAA,EAAA,KAAA,OACAA,EAAA,iBAAA,mBACAA,EAAA,oBAAA,sBACAA,EAAA,iBAAA,mBACAA,EAAA,eAAA,iBACAA,EAAA,QAAA,UACAA,EAAA,MAAA,QACAA,EAAA,IAAA"}
@@ -95,8 +95,6 @@ export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
95
95
  maxHeight?: number;
96
96
  /** Returns true if a message is a non-chat activity (e.g. assignment, status change). Used to break sender stacks for avatar and border-radius logic. */
97
97
  isActivityMessage?: (message: TMessage) => boolean;
98
- /** Returns true if a message should always be aligned to the left with no avatar, regardless of sender. */
99
- forceLeftAlign?: (message: TMessage) => boolean;
100
98
  [key: string]: any;
101
99
  }
102
100
  export interface ScrollState {
@@ -1,2 +1,2 @@
1
- import{__rest as e}from"../../../_virtual/_tslib.js";import{jsx as t,Fragment as i,jsxs as r}from"react/jsx-runtime";import n,{forwardRef as s,useRef as o,useState as l,useMemo as a,useImperativeHandle as d,useCallback as g,useEffect as u}from"react";import{COLORS as c}from"../../../constants/Theme.js";import{useWindowSize as v}from"../../../hooks/useWindowSize.js";import{Button as h}from"../../button/Button.js";import{BodySecondary as p}from"../../TypographyStyle.js";import{GiftedChatAppType as f}from"../Bubble/types.js";import{Day as m}from"./Day.js";import{getMessagePlacement as b,shouldCenterAlign as x}from"./messageHelpers.js";import{useScrollToBottom as y,useInitialMountScroll as j,useScrollCleanup as T,useRestoreScrollPosition as A,useAutoScrollOnNewMessages as M,useResizeObserverForFirstMessage as O,useScrollHandler as w}from"./scrollHooks.js";import{MESSAGE_CHANNELS as _}from"./types.js";import{TOP_THRESHOLD as S,normalizeRef as k,isSameDay as R,Constants as L}from"./utils.js";const B=e=>{let{text:n,isExpanded:s,onToggle:a}=e;const d=o(null),[g,c]=l(!1);return u((()=>{const e=d.current;if(e){e.style.maxHeight="none";const t=e.scrollHeight>204;e.style.maxHeight=s?"none":"204px",c(t)}}),[n,s]),r(i,{children:[t("div",Object.assign({ref:d,style:{maxHeight:s?"none":204,overflow:"hidden"}},{children:t(p,{children:n})})),g&&t(h,{buttonType:"text",size:"xs",buttonText:s?"Show less":"Read more",onClick:a})]})};var E=s(((s,u)=>{var h;const p=s||{},{messages:E=[],user:H,renderBubble:C,renderAvatar:I,renderDay:D,renderLoading:P,renderChatEmpty:$,listViewProps:F={},renderAvatarOnTop:U=!1,showUserAvatar:V=!1,showAvatarForEveryMessage:W=!1,inverted:G=!1,messageIdGenerator:z,topThreshold:N=S,appType:Y=f.Bik,maxHeight:X,isActivityMessage:q,forceLeftAlign:J}=p,K=e(p,["messages","user","renderBubble","renderAvatar","renderDay","renderLoading","renderChatEmpty","listViewProps","renderAvatarOnTop","showUserAvatar","showAvatarForEveryMessage","inverted","messageIdGenerator","topThreshold","appType","maxHeight","isActivityMessage","forceLeftAlign"]),Q=v(),Z=o(null),ee=k(F.ref||u,Z),te=o({isInitialMount:!0,isUserScrolling:!1,isLoadingOldMessages:!1,isAtBottom:!0,hasTriggeredEndReached:!1,lastMessagesLength:null!==(h=null==E?void 0:E.length)&&void 0!==h?h:0,previousScrollHeight:0,previousScrollTop:0,scrollTimeout:null}),[ie,re]=l(new Set),ne=a((()=>E&&0!==E.length?[...E].reverse():[]),[E]),se=y(ee,te);d(u,(()=>ee.current)),j(ee,te,ne.length,se),T(te),A(ee,te,ne.length),M(ee,te,E.length,se),O(null==E?void 0:E[0],te,se,z);const oe=w(te,F.onEndReached,F.onScroll,N),le=g((e=>{var t;return Boolean(e&&H&&(null===(t=e.user)||void 0===t?void 0:t._id)===H._id)}),[H]),ae=g(((e,t)=>!!V&&(!!W||(!t||!!q&&q(e)||!!q&&q(t)||t.user._id!==e.user._id))),[V,W,q,J]),de=g(((e,i,r)=>{var n,s,o,l,a;const d=le(e)?"right":"left",g=(null===(n=null==i?void 0:i.user)||void 0===n?void 0:n._id)!==(null===(s=null==e?void 0:e.user)||void 0===s?void 0:s._id),u=(null===(o=null==r?void 0:r.user)||void 0===o?void 0:o._id)!==(null===(l=null==e?void 0:e.user)||void 0===l?void 0:l._id),v=Object.assign({currentMessage:e,previousMessage:i,nextMessage:r,position:d,user:H},K);if(C)return C(v);const h=e._id,p=ie.has(h);return t("div",Object.assign({style:Object.assign(Object.assign({maxWidth:Y===f.Manifest?"50%":"70%",width:"fit-content"},Y===f.Manifest?{minWidth:"130px"}:{}),{padding:"8px 12px",borderTopLeftRadius:"left"===d?g?12:2:12,borderTopRightRadius:"right"===d?g?12:2:12,borderBottomLeftRadius:"left"===d?u?12:2:12,borderBottomRightRadius:"right"===d?u?12:2:12,border:"left"===d&&Y===f.Manifest?"1px solid rgb(224, 224, 224)":"none",backgroundColor:"right"===d?Y===f.Manifest?c.background.brandTint:c.background.brandLight:Y===f.Manifest?c.background.pureWhite:c.background.inactive,color:c.content.primary,wordBreak:"break-word"})},{children:t(B,{text:null!==(a=e.text)&&void 0!==a?a:"",isExpanded:p,onToggle:()=>re((e=>{const t=new Set(e);return p?t.delete(h):t.add(h),t}))})}))}),[le,H,C,K,ie]),ge=g(((e,t,i)=>{if(!ae(e,t))return null;const r=le(e)?"right":"left";return I?I({currentMessage:e,previousMessage:t,nextMessage:i,position:r,user:H,renderAvatarOnTop:U,showUserAvatar:V,showAvatarForEveryMessage:W}):null}),[ae,le,H,U,V,W,I]);return E&&0!==E.length?r("div",Object.assign({ref:ee,style:Object.assign(Object.assign({flex:1,overflowY:"auto",overflowX:"hidden",display:"flex",flexDirection:"column"},X?{maxHeight:X,height:X}:{}),F.style),onScroll:oe},{children:[t("div",{style:{flex:"1 0 auto"}}),t("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:"0 0 auto"}},{children:ne.map(((e,i)=>{var s,o,l,a,d,g,u;const c=(null==J?void 0:J(e))?"left":le(e)?"right":"left",v=ne[i-1],h=ne[i+1],p=!R(e,v),y=(null==J?void 0:J(e))?"flex-start":b(e,c),j=x(e),T=(null==e?void 0:e.channelId)===_.SMTP||(null==e?void 0:e.channelName)===_.SMTP,A=e.category===L.ChatActivity.Category.ACTIVITY&&e.activityType===L.ChatActivity.Type.PRIVATE_NOTE;return r(n.Fragment,{children:[p&&(D?D({createdAt:e.createdAt}):t(m,{createdAt:e.createdAt,appType:Y})),r("div",Object.assign({style:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Q?{margin:"0 4px"}:{}),j?{}:{display:"flex",alignItems:"flex-start"}),Y!==f.Manifest?Q||2!==(null===(s=null==e?void 0:e.user)||void 0===s?void 0:s._id)?{marginRight:8}:{marginLeft:8}:{}),T&&!A&&Q?{marginLeft:8,marginRight:8}:{}),{justifyContent:y,marginBottom:h?(null===(o=null==h?void 0:h.user)||void 0===o?void 0:o._id)===(null===(l=null==e?void 0:e.user)||void 0===l?void 0:l._id)?4:20:0})},{children:[!Q&&"left"===c&&t("div",Object.assign({style:{marginRight:"4px",width:"24px",flexShrink:0}},{children:ge(e,v,h)})),t("div",Object.assign({id:`message-bubble-${null!==(a=e._id)&&void 0!==a?a:`${i}-${null!==(d=null==z?void 0:z())&&void 0!==d?d:"id"}`}`,style:Y===f.Manifest?{width:"100%"}:Q&&T?{display:"flex",flexGrow:1}:{}},{children:de(e,v,h)})),!Q&&"right"===c&&t("div",Object.assign({style:{marginLeft:"4px",width:"24px",flexShrink:0,alignSelf:"flex-start"}},{children:ge(e,v,h)}))]}))]},null!==(g=e._id)&&void 0!==g?g:`${i}-${null!==(u=null==z?void 0:z())&&void 0!==u?u:"id"}`)}))}))]})):$?t(i,{children:$()}):null}));export{E as default};
1
+ import{__rest as e}from"../../../_virtual/_tslib.js";import{jsx as t,Fragment as r,jsxs as i}from"react/jsx-runtime";import n,{forwardRef as s,useRef as o,useState as l,useMemo as a,useImperativeHandle as d,useCallback as g,useEffect as u}from"react";import{COLORS as c}from"../../../constants/Theme.js";import{useWindowSize as h}from"../../../hooks/useWindowSize.js";import{Button as v}from"../../button/Button.js";import{BodySecondary as p}from"../../TypographyStyle.js";import{GiftedChatAppType as m}from"../Bubble/types.js";import{Day as f}from"./Day.js";import{getMessagePlacement as b,shouldCenterAlign as y}from"./messageHelpers.js";import{useScrollToBottom as x,useInitialMountScroll as j,useScrollCleanup as T,useRestoreScrollPosition as M,useAutoScrollOnNewMessages as O,useResizeObserverForFirstMessage as w,useScrollHandler as A}from"./scrollHooks.js";import{MESSAGE_CHANNELS as _}from"./types.js";import{TOP_THRESHOLD as S,normalizeRef as k,isSameDay as R,Constants as B}from"./utils.js";const E=e=>{let{text:n,isExpanded:s,onToggle:a}=e;const d=o(null),[g,c]=l(!1);return u((()=>{const e=d.current;if(e){e.style.maxHeight="none";const t=e.scrollHeight>204;e.style.maxHeight=s?"none":"204px",c(t)}}),[n,s]),i(r,{children:[t("div",Object.assign({ref:d,style:{maxHeight:s?"none":204,overflow:"hidden"}},{children:t(p,{children:n})})),g&&t(v,{buttonType:"text",size:"xs",buttonText:s?"Show less":"Read more",onClick:a})]})};var H=s(((s,u)=>{var v;const p=s||{},{messages:H=[],user:L,renderBubble:C,renderAvatar:I,renderDay:D,renderLoading:P,renderChatEmpty:$,listViewProps:F={},renderAvatarOnTop:U=!1,showUserAvatar:V=!1,showAvatarForEveryMessage:W=!1,inverted:G=!1,messageIdGenerator:z,topThreshold:N=S,appType:Y=m.Bik,maxHeight:X,isActivityMessage:q}=p,J=e(p,["messages","user","renderBubble","renderAvatar","renderDay","renderLoading","renderChatEmpty","listViewProps","renderAvatarOnTop","showUserAvatar","showAvatarForEveryMessage","inverted","messageIdGenerator","topThreshold","appType","maxHeight","isActivityMessage"]),K=h(),Q=o(null),Z=k(F.ref||u,Q),ee=o({isInitialMount:!0,isUserScrolling:!1,isLoadingOldMessages:!1,isAtBottom:!0,hasTriggeredEndReached:!1,lastMessagesLength:null!==(v=null==H?void 0:H.length)&&void 0!==v?v:0,previousScrollHeight:0,previousScrollTop:0,scrollTimeout:null}),[te,re]=l(new Set),ie=a((()=>H&&0!==H.length?[...H].reverse():[]),[H]),ne=x(Z,ee);d(u,(()=>Z.current)),j(Z,ee,ie.length,ne),T(ee),M(Z,ee,ie.length),O(Z,ee,H.length,ne),w(null==H?void 0:H[0],ee,ne,z);const se=A(ee,F.onEndReached,F.onScroll,N),oe=g((e=>{var t;return Boolean(e&&L&&(null===(t=e.user)||void 0===t?void 0:t._id)===L._id)}),[L]),le=g(((e,t)=>!!V&&(!!W||(!t||!!q&&q(e)||!!q&&q(t)||t.user._id!==e.user._id))),[V,W,q]),ae=g(((e,r,i)=>{var n,s,o,l,a;const d=oe(e)?"right":"left",g=(null===(n=null==r?void 0:r.user)||void 0===n?void 0:n._id)!==(null===(s=null==e?void 0:e.user)||void 0===s?void 0:s._id),u=(null===(o=null==i?void 0:i.user)||void 0===o?void 0:o._id)!==(null===(l=null==e?void 0:e.user)||void 0===l?void 0:l._id),h=Object.assign({currentMessage:e,previousMessage:r,nextMessage:i,position:d,user:L},J);if(C)return C(h);const v=e._id,p=te.has(v);return t("div",Object.assign({style:Object.assign(Object.assign({maxWidth:Y===m.Manifest?"50%":"70%",width:"fit-content"},Y===m.Manifest?{minWidth:"130px"}:{}),{padding:"8px 12px",borderTopLeftRadius:"left"===d?g?12:2:12,borderTopRightRadius:"right"===d?g?12:2:12,borderBottomLeftRadius:"left"===d?u?12:2:12,borderBottomRightRadius:"right"===d?u?12:2:12,border:"left"===d&&Y===m.Manifest?"1px solid rgb(224, 224, 224)":"none",backgroundColor:"right"===d?Y===m.Manifest?c.background.brandTint:c.background.brandLight:Y===m.Manifest?c.background.pureWhite:c.background.inactive,color:c.content.primary,wordBreak:"break-word"})},{children:t(E,{text:null!==(a=e.text)&&void 0!==a?a:"",isExpanded:p,onToggle:()=>re((e=>{const t=new Set(e);return p?t.delete(v):t.add(v),t}))})}))}),[oe,L,C,J,te]),de=g(((e,t,r)=>{if(!le(e,t))return null;const i=oe(e)?"right":"left";return I?I({currentMessage:e,previousMessage:t,nextMessage:r,position:i,user:L,renderAvatarOnTop:U,showUserAvatar:V,showAvatarForEveryMessage:W}):null}),[le,oe,L,U,V,W,I]);return H&&0!==H.length?i("div",Object.assign({ref:Z,style:Object.assign(Object.assign({flex:1,overflowY:"auto",overflowX:"hidden",display:"flex",flexDirection:"column"},X?{maxHeight:X,height:X}:{}),F.style),onScroll:se},{children:[t("div",{style:{flex:"1 0 auto"}}),t("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:"0 0 auto"}},{children:ie.map(((e,r)=>{var s,o,l,a,d,g;const u=(null==e?void 0:e.channelId)===_.SMTP||(null==e?void 0:e.channelName)===_.SMTP,c=u?"left":oe(e)?"right":"left",h=ie[r-1],v=ie[r+1],p=!R(e,h),x=b(e,c),j=y(e),T=e.category===B.ChatActivity.Category.ACTIVITY&&e.activityType===B.ChatActivity.Type.PRIVATE_NOTE;return i(n.Fragment,{children:[p&&(D?D({createdAt:e.createdAt}):t(f,{createdAt:e.createdAt,appType:Y})),i("div",Object.assign({style:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},K?{margin:"0 4px"}:{}),j?{}:{display:"flex",alignItems:"flex-start"}),Y!==m.Manifest?K||"right"!==c?{marginRight:8}:{marginLeft:8}:{}),u&&!T&&K?{marginLeft:8,marginRight:8}:{}),{justifyContent:x,marginBottom:v?(null===(s=null==v?void 0:v.user)||void 0===s?void 0:s._id)===(null===(o=null==e?void 0:e.user)||void 0===o?void 0:o._id)?4:20:0})},{children:[!K&&"left"===c&&t("div",Object.assign({style:{marginRight:"4px",width:"24px",flexShrink:0}},{children:de(e,h,v)})),t("div",Object.assign({id:`message-bubble-${null!==(l=e._id)&&void 0!==l?l:`${r}-${null!==(a=null==z?void 0:z())&&void 0!==a?a:"id"}`}`,style:Y===m.Manifest?{width:"100%"}:K&&u?{display:"flex",flexGrow:1}:{}},{children:ae(e,h,v)})),!K&&"right"===c&&t("div",Object.assign({style:{marginLeft:"4px",width:"24px",flexShrink:0,alignSelf:"flex-start"}},{children:de(e,h,v)}))]}))]},null!==(d=e._id)&&void 0!==d?d:`${r}-${null!==(g=null==z?void 0:z())&&void 0!==g?g:"id"}`)}))}))]})):$?t(r,{children:$()}):null}));export{H as default};
2
2
  //# sourceMappingURL=GiftedChat.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GiftedChat.js","sources":["../../../../../src/components/BikGiftedChat/GiftedChat/GiftedChat.tsx"],"sourcesContent":["import React, {\n\tforwardRef,\n\tuseCallback,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { COLORS } from '../../../constants/Theme';\nimport { useWindowSize } from '../../../hooks/useWindowSize';\nimport { Button } from '../../button';\nimport { BodySecondary } from '../../TypographyStyle';\nimport { BubbleProps, GiftedChatAppType } from '../Bubble/types';\nimport { IMessage } from '../types';\nimport { Day } from './Day';\nimport { getMessagePlacement, shouldCenterAlign } from './messageHelpers';\nimport {\n\tuseAutoScrollOnNewMessages,\n\tuseInitialMountScroll,\n\tuseResizeObserverForFirstMessage,\n\tuseRestoreScrollPosition,\n\tuseScrollCleanup,\n\tuseScrollHandler,\n\tuseScrollToBottom,\n} from './scrollHooks';\nimport { AvatarProps, GiftedChatProps, MESSAGE_CHANNELS } from './types';\nimport { isSameDay, normalizeRef } from './utils';\nimport { Constants, TOP_THRESHOLD } from './utils';\n\nconst COLLAPSED_MAX_HEIGHT = 204;\n\nconst CollapsibleBubbleText: React.FC<{\n\ttext: string;\n\tisExpanded: boolean;\n\tonToggle: () => void;\n}> = ({ text, isExpanded, onToggle }) => {\n\tconst textRef = useRef<HTMLDivElement>(null);\n\tconst [isOverflowing, setIsOverflowing] = useState(false);\n\n\tuseEffect(() => {\n\t\tconst el = textRef.current;\n\t\tif (el) {\n\t\t\t// Temporarily remove max-height to measure true scroll height\n\t\t\tel.style.maxHeight = 'none';\n\t\t\tconst overflows = el.scrollHeight > COLLAPSED_MAX_HEIGHT;\n\t\t\tel.style.maxHeight = isExpanded ? 'none' : `${COLLAPSED_MAX_HEIGHT}px`;\n\t\t\tsetIsOverflowing(overflows);\n\t\t}\n\t}, [text, isExpanded]);\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tref={textRef}\n\t\t\t\tstyle={{\n\t\t\t\t\tmaxHeight: isExpanded ? 'none' : COLLAPSED_MAX_HEIGHT,\n\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<BodySecondary>{text}</BodySecondary>\n\t\t\t</div>\n\t\t\t{isOverflowing && (\n\t\t\t\t<Button\n\t\t\t\t\tbuttonType=\"text\"\n\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\tbuttonText={isExpanded ? 'Show less' : 'Read more'}\n\t\t\t\t\tonClick={onToggle}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t);\n};\n\nconst GiftedChatInner = (\n\tprops: Omit<GiftedChatProps<IMessage>, 'ref'>,\n\tforwardedRef: React.Ref<HTMLDivElement>,\n) => {\n\tconst {\n\t\tmessages = [],\n\t\tuser,\n\t\trenderBubble,\n\t\trenderAvatar,\n\t\trenderDay,\n\t\trenderLoading,\n\t\trenderChatEmpty,\n\t\tlistViewProps = {},\n\t\trenderAvatarOnTop = false,\n\t\tshowUserAvatar = false,\n\t\tshowAvatarForEveryMessage = false,\n\t\tinverted = false,\n\t\tmessageIdGenerator,\n\t\ttopThreshold = TOP_THRESHOLD,\n\t\tappType = GiftedChatAppType.Bik,\n\t\tmaxHeight,\n\t\tisActivityMessage,\n\t\tforceLeftAlign,\n\t\t...extraProps\n\t} = props || {};\n\n\tconst isMobile = useWindowSize();\n\n\tconst internalScrollRef = useRef<HTMLDivElement | null>(null);\n\tconst scrollRef = normalizeRef(\n\t\tlistViewProps.ref || forwardedRef,\n\t\tinternalScrollRef,\n\t);\n\n\tconst scrollState = useRef({\n\t\tisInitialMount: true,\n\t\tisUserScrolling: false,\n\t\tisLoadingOldMessages: false,\n\t\tisAtBottom: true,\n\t\thasTriggeredEndReached: false,\n\t\tlastMessagesLength: messages?.length ?? 0,\n\t\tpreviousScrollHeight: 0,\n\t\tpreviousScrollTop: 0,\n\t\tscrollTimeout: null,\n\t});\n\n\tconst [expandedMessages, setExpandedMessages] = useState<\n\t\tSet<string | number>\n\t>(new Set());\n\n\t// Reverse messages so newest appears last in DOM (natural reading order)\n\tconst reversedMessages = useMemo(() => {\n\t\tif (!messages || messages.length === 0) return [] as IMessage[];\n\t\treturn [...messages].reverse() as IMessage[];\n\t}, [messages]);\n\n\tconst scrollToBottom = useScrollToBottom(scrollRef, scrollState);\n\n\tuseImperativeHandle(forwardedRef, () => scrollRef.current!);\n\n\tuseInitialMountScroll(\n\t\tscrollRef,\n\t\tscrollState,\n\t\treversedMessages.length,\n\t\tscrollToBottom,\n\t);\n\n\tuseScrollCleanup(scrollState);\n\n\tuseRestoreScrollPosition(scrollRef, scrollState, reversedMessages.length);\n\n\tuseAutoScrollOnNewMessages(\n\t\tscrollRef,\n\t\tscrollState,\n\t\tmessages.length,\n\t\tscrollToBottom,\n\t);\n\n\tuseResizeObserverForFirstMessage(\n\t\tmessages?.[0],\n\t\tscrollState,\n\t\tscrollToBottom,\n\t\tmessageIdGenerator,\n\t);\n\n\tconst handleScroll = useScrollHandler(\n\t\tscrollState,\n\t\tlistViewProps.onEndReached,\n\t\tlistViewProps.onScroll,\n\t\ttopThreshold,\n\t);\n\n\t// Check if a message belongs to the current user\n\tconst isUserMessage = useCallback(\n\t\t(message: IMessage) => {\n\t\t\treturn Boolean(message && user && message.user?._id === user._id);\n\t\t},\n\t\t[user],\n\t);\n\n\t// Determine if avatar should be shown for this message\n\tconst shouldShowAvatar = useCallback(\n\t\t(message: IMessage, previousMessage?: IMessage) => {\n\t\t\tif (!showUserAvatar) return false;\n\t\t\tif (showAvatarForEveryMessage) return true;\n\n\t\t\t// Show avatar on the first message in a consecutive sender stack,\n\t\t\t// or when an activity interrupts the stack, or when the current message itself is an activity\n\t\t\treturn (\n\t\t\t\t!previousMessage ||\n\t\t\t\t(isActivityMessage ? isActivityMessage(message) : false) ||\n\t\t\t\t(isActivityMessage ? isActivityMessage(previousMessage) : false) ||\n\t\t\t\tpreviousMessage.user._id !== message.user._id\n\t\t\t);\n\t\t},\n\t\t[showUserAvatar, showAvatarForEveryMessage, isActivityMessage, forceLeftAlign],\n\t);\n\n\t// Render a message bubble (or call custom renderBubble)\n\tconst renderMessageBubble = useCallback(\n\t\t(message: IMessage, previousMessage?: IMessage, nextMessage?: IMessage) => {\n\t\t\tconst position = isUserMessage(message) ? 'right' : 'left';\n\t\t\tconst isTopOfStack = previousMessage?.user?._id !== message?.user?._id;\n\t\t\tconst isBottomOfStack = nextMessage?.user?._id !== message?.user?._id;\n\n\t\t\tconst bubbleProps: BubbleProps<IMessage> = {\n\t\t\t\tcurrentMessage: message,\n\t\t\t\tpreviousMessage,\n\t\t\t\tnextMessage,\n\t\t\t\tposition,\n\t\t\t\tuser,\n\t\t\t\t...extraProps,\n\t\t\t};\n\n\t\t\t// Use custom render function if provided\n\t\t\tif (renderBubble) {\n\t\t\t\treturn renderBubble(bubbleProps);\n\t\t\t}\n\n\t\t\t// Default bubble rendering\n\t\t\tconst messageId = message._id;\n\t\t\tconst isExpanded = expandedMessages.has(messageId);\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tmaxWidth: appType === GiftedChatAppType.Manifest ? '50%' : '70%',\n\t\t\t\t\t\twidth: 'fit-content',\n\t\t\t\t\t\t...(appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t? { minWidth: '130px' }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\tpadding: '8px 12px',\n\t\t\t\t\t\tborderTopLeftRadius:\n\t\t\t\t\t\t\tposition === 'left' ? (isTopOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\t\tposition === 'right' ? (isTopOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\t\tposition === 'left' ? (isBottomOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\t\tposition === 'right' ? (isBottomOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborder:\n\t\t\t\t\t\t\tposition === 'left' && appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t? '1px solid rgb(224, 224, 224)'\n\t\t\t\t\t\t\t\t: 'none',\n\t\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\t\tposition === 'right'\n\t\t\t\t\t\t\t\t? appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t\t? COLORS.background.brandTint\n\t\t\t\t\t\t\t\t\t: COLORS.background.brandLight\n\t\t\t\t\t\t\t\t: appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t? COLORS.background.pureWhite\n\t\t\t\t\t\t\t\t: COLORS.background.inactive,\n\t\t\t\t\t\tcolor: COLORS.content.primary,\n\t\t\t\t\t\twordBreak: 'break-word',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<CollapsibleBubbleText\n\t\t\t\t\t\ttext={message.text ?? ''}\n\t\t\t\t\t\tisExpanded={isExpanded}\n\t\t\t\t\t\tonToggle={() =>\n\t\t\t\t\t\t\tsetExpandedMessages((prev) => {\n\t\t\t\t\t\t\t\tconst next = new Set(prev);\n\t\t\t\t\t\t\t\tif (isExpanded) next.delete(messageId);\n\t\t\t\t\t\t\t\telse next.add(messageId);\n\t\t\t\t\t\t\t\treturn next;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t);\n\t\t},\n\t\t[isUserMessage, user, renderBubble, extraProps, expandedMessages],\n\t);\n\n\t// Render a message avatar (or call custom renderAvatar)\n\tconst renderMessageAvatar = useCallback(\n\t\t(message: IMessage, previousMessage?: IMessage, nextMessage?: IMessage) => {\n\t\t\tconst shouldShow = shouldShowAvatar(message, previousMessage);\n\n\t\t\tif (!shouldShow) return null;\n\n\t\t\tconst position = isUserMessage(message) ? 'right' : 'left';\n\n\t\t\tconst avatarProps: AvatarProps<IMessage> = {\n\t\t\t\tcurrentMessage: message,\n\t\t\t\tpreviousMessage,\n\t\t\t\tnextMessage,\n\t\t\t\tposition,\n\t\t\t\tuser,\n\t\t\t\trenderAvatarOnTop,\n\t\t\t\tshowUserAvatar,\n\t\t\t\tshowAvatarForEveryMessage,\n\t\t\t};\n\n\t\t\treturn renderAvatar ? renderAvatar(avatarProps) : null;\n\t\t},\n\t\t[\n\t\t\tshouldShowAvatar,\n\t\t\tisUserMessage,\n\t\t\tuser,\n\t\t\trenderAvatarOnTop,\n\t\t\tshowUserAvatar,\n\t\t\tshowAvatarForEveryMessage,\n\t\t\trenderAvatar,\n\t\t],\n\t);\n\n\t// Render: Empty State\n\tif (!messages || messages.length === 0) {\n\t\treturn renderChatEmpty ? <>{renderChatEmpty()}</> : null;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tref={scrollRef as React.RefObject<HTMLDivElement>}\n\t\t\tstyle={{\n\t\t\t\tflex: 1,\n\t\t\t\toverflowY: 'auto',\n\t\t\t\toverflowX: 'hidden',\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tflexDirection: 'column',\n\t\t\t\t...(maxHeight ? { maxHeight, height: maxHeight } : {}),\n\t\t\t\t...listViewProps.style,\n\t\t\t}}\n\t\t\tonScroll={handleScroll}\n\t\t>\n\t\t\t{/* Spacer to push messages to bottom (newest appears last in DOM) */}\n\t\t\t<div style={{ flex: '1 0 auto' }} />\n\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\tflex: '0 0 auto',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{reversedMessages.map((message, index) => {\n\t\t\t\t\tconst position = forceLeftAlign?.(message) ? 'left' : (isUserMessage(message) ? 'right' : 'left');\n\t\t\t\t\tconst previousMessage = reversedMessages[index - 1];\n\t\t\t\t\tconst nextMessage = reversedMessages[index + 1];\n\t\t\t\t\tconst shouldShowDay = !isSameDay(message, previousMessage);\n\t\t\t\t\tconst placement = forceLeftAlign?.(message) ? 'flex-start' : getMessagePlacement(message, position);\n\t\t\t\t\tconst isCentered = shouldCenterAlign(message);\n\t\t\t\t\tconst isSmtp =\n\t\t\t\t\t\tmessage?.['channelId'] === MESSAGE_CHANNELS.SMTP ||\n\t\t\t\t\t\tmessage?.['channelName'] === MESSAGE_CHANNELS.SMTP;\n\t\t\t\t\t// Check if message is a private note\n\t\t\t\t\tconst isPrivateNote =\n\t\t\t\t\t\tmessage['category'] === Constants.ChatActivity.Category.ACTIVITY &&\n\t\t\t\t\t\tmessage['activityType'] ===\n\t\t\t\t\t\t\tConstants.ChatActivity.Type.PRIVATE_NOTE;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<React.Fragment\n\t\t\t\t\t\t\tkey={message._id ?? `${index}-${messageIdGenerator?.() ?? 'id'}`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{/* Day separator */}\n\t\t\t\t\t\t\t{shouldShowDay &&\n\t\t\t\t\t\t\t\t(renderDay ? (\n\t\t\t\t\t\t\t\t\trenderDay({ createdAt: message.createdAt })\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<Day createdAt={message.createdAt} appType={appType} />\n\t\t\t\t\t\t\t\t))}\n\n\t\t\t\t\t\t\t{/* Message container */}\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t...(isMobile ? { margin: '0 4px' } : {}),\n\t\t\t\t\t\t\t\t\t...(isCentered\n\t\t\t\t\t\t\t\t\t\t? {}\n\t\t\t\t\t\t\t\t\t\t: { display: 'flex', alignItems: 'flex-start' }),\n\t\t\t\t\t\t\t\t\t...(appType !== GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t\t\t? !isMobile && message?.user?._id === 2\n\t\t\t\t\t\t\t\t\t\t\t? { marginLeft: 8 }\n\t\t\t\t\t\t\t\t\t\t\t: { marginRight: 8 }\n\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\t...(isSmtp && !isPrivateNote && isMobile\n\t\t\t\t\t\t\t\t\t\t? { marginLeft: 8, marginRight: 8 }\n\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\tjustifyContent: placement,\n\t\t\t\t\t\t\t\t\tmarginBottom: nextMessage\n\t\t\t\t\t\t\t\t\t\t? nextMessage?.user?._id === message?.user?._id\n\t\t\t\t\t\t\t\t\t\t\t? 4\n\t\t\t\t\t\t\t\t\t\t\t: 20\n\t\t\t\t\t\t\t\t\t\t: 0,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{/* Left avatar or placeholder (for mobile, avatar is hidden) */}\n\t\t\t\t\t\t\t\t{!isMobile && position === 'left' && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tstyle={{ marginRight: '4px', width: '24px', flexShrink: 0 }}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{renderMessageAvatar(message, previousMessage, nextMessage)}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t\t{/* Message bubble */}\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tid={`message-bubble-${\n\t\t\t\t\t\t\t\t\t\tmessage._id ?? `${index}-${messageIdGenerator?.() ?? 'id'}`\n\t\t\t\t\t\t\t\t\t}`}\n\t\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t\tappType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t\t\t\t? { width: '100%' }\n\t\t\t\t\t\t\t\t\t\t\t: isMobile && isSmtp\n\t\t\t\t\t\t\t\t\t\t\t? { display: 'flex', flexGrow: 1 }\n\t\t\t\t\t\t\t\t\t\t\t: {}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{renderMessageBubble(message, previousMessage, nextMessage)}\n\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t{/* Right avatar or placeholder (for mobile, avatar is hidden) */}\n\t\t\t\t\t\t\t\t{!isMobile && position === 'right' && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\tmarginLeft: '4px',\n\t\t\t\t\t\t\t\t\t\t\twidth: '24px',\n\t\t\t\t\t\t\t\t\t\t\tflexShrink: 0,\n\t\t\t\t\t\t\t\t\t\t\talignSelf: 'flex-start',\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{renderMessageAvatar(message, previousMessage, nextMessage)}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</React.Fragment>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default forwardRef<HTMLDivElement, GiftedChatProps<IMessage>>(\n\tGiftedChatInner,\n);\n"],"names":["CollapsibleBubbleText","_ref","text","isExpanded","onToggle","textRef","useRef","isOverflowing","setIsOverflowing","useState","useEffect","el","current","style","maxHeight","overflows","scrollHeight","_jsxs","_jsx","Object","assign","ref","overflow","children","BodySecondary","Button","buttonType","size","buttonText","onClick","GiftedChat","forwardRef","GiftedChatInner","props","forwardedRef","_b","messages","user","renderBubble","renderAvatar","renderDay","renderLoading","renderChatEmpty","listViewProps","renderAvatarOnTop","showUserAvatar","showAvatarForEveryMessage","inverted","messageIdGenerator","topThreshold","TOP_THRESHOLD","appType","GiftedChatAppType","Bik","isActivityMessage","forceLeftAlign","extraProps","__rest","isMobile","useWindowSize","internalScrollRef","scrollRef","normalizeRef","scrollState","isInitialMount","isUserScrolling","isLoadingOldMessages","isAtBottom","hasTriggeredEndReached","lastMessagesLength","_a","length","previousScrollHeight","previousScrollTop","scrollTimeout","expandedMessages","setExpandedMessages","Set","reversedMessages","useMemo","reverse","scrollToBottom","useScrollToBottom","useImperativeHandle","useInitialMountScroll","useScrollCleanup","useRestoreScrollPosition","useAutoScrollOnNewMessages","useResizeObserverForFirstMessage","handleScroll","useScrollHandler","onEndReached","onScroll","isUserMessage","useCallback","message","Boolean","_id","shouldShowAvatar","previousMessage","renderMessageBubble","nextMessage","position","isTopOfStack","isBottomOfStack","_c","_d","bubbleProps","currentMessage","messageId","has","maxWidth","Manifest","width","minWidth","padding","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","border","backgroundColor","COLORS","background","brandTint","brandLight","pureWhite","inactive","color","content","primary","wordBreak","_e","prev","next","delete","add","renderMessageAvatar","flex","overflowY","overflowX","display","flexDirection","height","map","index","shouldShowDay","isSameDay","placement","getMessagePlacement","isCentered","shouldCenterAlign","isSmtp","MESSAGE_CHANNELS","SMTP","isPrivateNote","Constants","ChatActivity","Category","ACTIVITY","Type","PRIVATE_NOTE","React","Fragment","createdAt","Day","margin","alignItems","marginRight","marginLeft","justifyContent","marginBottom","flexShrink","id","flexGrow","alignSelf","_f","_g","_Fragment"],"mappings":"y+BA8BA,MAEMA,EAIDC,IAAmC,IAAlCC,KAAEA,EAAIC,WAAEA,EAAUC,SAAEA,GAAUH,EACnC,MAAMI,EAAUC,EAAuB,OAChCC,EAAeC,GAAoBC,GAAS,GAanD,OAXAC,GAAU,KACT,MAAMC,EAAKN,EAAQO,QACnB,GAAID,EAAI,CAEPA,EAAGE,MAAMC,UAAY,OACrB,MAAMC,EAAYJ,EAAGK,aAfK,IAgB1BL,EAAGE,MAAMC,UAAYX,EAAa,OAAY,QAC9CK,EAAiBO,EACjB,IACC,CAACb,EAAMC,IAGTc,eACCC,EACC,MAAAC,OAAAC,OAAA,CAAAC,IAAKhB,EACLQ,MAAO,CACNC,UAAWX,EAAa,OA1BA,IA2BxBmB,SAAU,WACV,CAAAC,SAEDL,EAACM,EAAa,CAAAD,SAAErB,OAEhBK,GACAW,EAACO,EACA,CAAAC,WAAW,OACXC,KAAK,KACLC,WAAYzB,EAAa,YAAc,YACvC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,IAwH9C"}
1
+ {"version":3,"file":"GiftedChat.js","sources":["../../../../../src/components/BikGiftedChat/GiftedChat/GiftedChat.tsx"],"sourcesContent":["import React, {\n\tforwardRef,\n\tuseCallback,\n\tuseEffect,\n\tuseImperativeHandle,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { COLORS } from '../../../constants/Theme';\nimport { useWindowSize } from '../../../hooks/useWindowSize';\nimport { Button } from '../../button';\nimport { BodySecondary } from '../../TypographyStyle';\nimport { BubbleProps, GiftedChatAppType } from '../Bubble/types';\nimport { IMessage } from '../types';\nimport { Day } from './Day';\nimport { getMessagePlacement, shouldCenterAlign } from './messageHelpers';\nimport {\n\tuseAutoScrollOnNewMessages,\n\tuseInitialMountScroll,\n\tuseResizeObserverForFirstMessage,\n\tuseRestoreScrollPosition,\n\tuseScrollCleanup,\n\tuseScrollHandler,\n\tuseScrollToBottom,\n} from './scrollHooks';\nimport { AvatarProps, GiftedChatProps, MESSAGE_CHANNELS } from './types';\nimport { isSameDay, normalizeRef } from './utils';\nimport { Constants, TOP_THRESHOLD } from './utils';\n\nconst COLLAPSED_MAX_HEIGHT = 204;\n\nconst CollapsibleBubbleText: React.FC<{\n\ttext: string;\n\tisExpanded: boolean;\n\tonToggle: () => void;\n}> = ({ text, isExpanded, onToggle }) => {\n\tconst textRef = useRef<HTMLDivElement>(null);\n\tconst [isOverflowing, setIsOverflowing] = useState(false);\n\n\tuseEffect(() => {\n\t\tconst el = textRef.current;\n\t\tif (el) {\n\t\t\t// Temporarily remove max-height to measure true scroll height\n\t\t\tel.style.maxHeight = 'none';\n\t\t\tconst overflows = el.scrollHeight > COLLAPSED_MAX_HEIGHT;\n\t\t\tel.style.maxHeight = isExpanded ? 'none' : `${COLLAPSED_MAX_HEIGHT}px`;\n\t\t\tsetIsOverflowing(overflows);\n\t\t}\n\t}, [text, isExpanded]);\n\n\treturn (\n\t\t<>\n\t\t\t<div\n\t\t\t\tref={textRef}\n\t\t\t\tstyle={{\n\t\t\t\t\tmaxHeight: isExpanded ? 'none' : COLLAPSED_MAX_HEIGHT,\n\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<BodySecondary>{text}</BodySecondary>\n\t\t\t</div>\n\t\t\t{isOverflowing && (\n\t\t\t\t<Button\n\t\t\t\t\tbuttonType=\"text\"\n\t\t\t\t\tsize=\"xs\"\n\t\t\t\t\tbuttonText={isExpanded ? 'Show less' : 'Read more'}\n\t\t\t\t\tonClick={onToggle}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</>\n\t);\n};\n\nconst GiftedChatInner = (\n\tprops: Omit<GiftedChatProps<IMessage>, 'ref'>,\n\tforwardedRef: React.Ref<HTMLDivElement>,\n) => {\n\tconst {\n\t\tmessages = [],\n\t\tuser,\n\t\trenderBubble,\n\t\trenderAvatar,\n\t\trenderDay,\n\t\trenderLoading,\n\t\trenderChatEmpty,\n\t\tlistViewProps = {},\n\t\trenderAvatarOnTop = false,\n\t\tshowUserAvatar = false,\n\t\tshowAvatarForEveryMessage = false,\n\t\tinverted = false,\n\t\tmessageIdGenerator,\n\t\ttopThreshold = TOP_THRESHOLD,\n\t\tappType = GiftedChatAppType.Bik,\n\t\tmaxHeight,\n\t\tisActivityMessage,\n\t\t...extraProps\n\t} = props || {};\n\n\tconst isMobile = useWindowSize();\n\n\tconst internalScrollRef = useRef<HTMLDivElement | null>(null);\n\tconst scrollRef = normalizeRef(\n\t\tlistViewProps.ref || forwardedRef,\n\t\tinternalScrollRef,\n\t);\n\n\tconst scrollState = useRef({\n\t\tisInitialMount: true,\n\t\tisUserScrolling: false,\n\t\tisLoadingOldMessages: false,\n\t\tisAtBottom: true,\n\t\thasTriggeredEndReached: false,\n\t\tlastMessagesLength: messages?.length ?? 0,\n\t\tpreviousScrollHeight: 0,\n\t\tpreviousScrollTop: 0,\n\t\tscrollTimeout: null,\n\t});\n\n\tconst [expandedMessages, setExpandedMessages] = useState<\n\t\tSet<string | number>\n\t>(new Set());\n\n\t// Reverse messages so newest appears last in DOM (natural reading order)\n\tconst reversedMessages = useMemo(() => {\n\t\tif (!messages || messages.length === 0) return [] as IMessage[];\n\t\treturn [...messages].reverse() as IMessage[];\n\t}, [messages]);\n\n\tconst scrollToBottom = useScrollToBottom(scrollRef, scrollState);\n\n\tuseImperativeHandle(forwardedRef, () => scrollRef.current!);\n\n\tuseInitialMountScroll(\n\t\tscrollRef,\n\t\tscrollState,\n\t\treversedMessages.length,\n\t\tscrollToBottom,\n\t);\n\n\tuseScrollCleanup(scrollState);\n\n\tuseRestoreScrollPosition(scrollRef, scrollState, reversedMessages.length);\n\n\tuseAutoScrollOnNewMessages(\n\t\tscrollRef,\n\t\tscrollState,\n\t\tmessages.length,\n\t\tscrollToBottom,\n\t);\n\n\tuseResizeObserverForFirstMessage(\n\t\tmessages?.[0],\n\t\tscrollState,\n\t\tscrollToBottom,\n\t\tmessageIdGenerator,\n\t);\n\n\tconst handleScroll = useScrollHandler(\n\t\tscrollState,\n\t\tlistViewProps.onEndReached,\n\t\tlistViewProps.onScroll,\n\t\ttopThreshold,\n\t);\n\n\t// Check if a message belongs to the current user\n\tconst isUserMessage = useCallback(\n\t\t(message: IMessage) => {\n\t\t\treturn Boolean(message && user && message.user?._id === user._id);\n\t\t},\n\t\t[user],\n\t);\n\n\t// Determine if avatar should be shown for this message\n\tconst shouldShowAvatar = useCallback(\n\t\t(message: IMessage, previousMessage?: IMessage) => {\n\t\t\tif (!showUserAvatar) return false;\n\t\t\tif (showAvatarForEveryMessage) return true;\n\n\t\t\t// Show avatar on the first message in a consecutive sender stack,\n\t\t\t// or when an activity interrupts the stack, or when the current message itself is an activity\n\t\t\treturn (\n\t\t\t\t!previousMessage ||\n\t\t\t\t(isActivityMessage ? isActivityMessage(message) : false) ||\n\t\t\t\t(isActivityMessage ? isActivityMessage(previousMessage) : false) ||\n\t\t\t\tpreviousMessage.user._id !== message.user._id\n\t\t\t);\n\t\t},\n\t\t[showUserAvatar, showAvatarForEveryMessage, isActivityMessage],\n\t);\n\n\t// Render a message bubble (or call custom renderBubble)\n\tconst renderMessageBubble = useCallback(\n\t\t(message: IMessage, previousMessage?: IMessage, nextMessage?: IMessage) => {\n\t\t\tconst position = isUserMessage(message) ? 'right' : 'left';\n\t\t\tconst isTopOfStack = previousMessage?.user?._id !== message?.user?._id;\n\t\t\tconst isBottomOfStack = nextMessage?.user?._id !== message?.user?._id;\n\n\t\t\tconst bubbleProps: BubbleProps<IMessage> = {\n\t\t\t\tcurrentMessage: message,\n\t\t\t\tpreviousMessage,\n\t\t\t\tnextMessage,\n\t\t\t\tposition,\n\t\t\t\tuser,\n\t\t\t\t...extraProps,\n\t\t\t};\n\n\t\t\t// Use custom render function if provided\n\t\t\tif (renderBubble) {\n\t\t\t\treturn renderBubble(bubbleProps);\n\t\t\t}\n\n\t\t\t// Default bubble rendering\n\t\t\tconst messageId = message._id;\n\t\t\tconst isExpanded = expandedMessages.has(messageId);\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tmaxWidth: appType === GiftedChatAppType.Manifest ? '50%' : '70%',\n\t\t\t\t\t\twidth: 'fit-content',\n\t\t\t\t\t\t...(appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t? { minWidth: '130px' }\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\tpadding: '8px 12px',\n\t\t\t\t\t\tborderTopLeftRadius:\n\t\t\t\t\t\t\tposition === 'left' ? (isTopOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\t\tposition === 'right' ? (isTopOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\t\tposition === 'left' ? (isBottomOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\t\tposition === 'right' ? (isBottomOfStack ? 12 : 2) : 12,\n\t\t\t\t\t\tborder:\n\t\t\t\t\t\t\tposition === 'left' && appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t? '1px solid rgb(224, 224, 224)'\n\t\t\t\t\t\t\t\t: 'none',\n\t\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\t\tposition === 'right'\n\t\t\t\t\t\t\t\t? appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t\t? COLORS.background.brandTint\n\t\t\t\t\t\t\t\t\t: COLORS.background.brandLight\n\t\t\t\t\t\t\t\t: appType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t? COLORS.background.pureWhite\n\t\t\t\t\t\t\t\t: COLORS.background.inactive,\n\t\t\t\t\t\tcolor: COLORS.content.primary,\n\t\t\t\t\t\twordBreak: 'break-word',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<CollapsibleBubbleText\n\t\t\t\t\t\ttext={message.text ?? ''}\n\t\t\t\t\t\tisExpanded={isExpanded}\n\t\t\t\t\t\tonToggle={() =>\n\t\t\t\t\t\t\tsetExpandedMessages((prev) => {\n\t\t\t\t\t\t\t\tconst next = new Set(prev);\n\t\t\t\t\t\t\t\tif (isExpanded) next.delete(messageId);\n\t\t\t\t\t\t\t\telse next.add(messageId);\n\t\t\t\t\t\t\t\treturn next;\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t);\n\t\t},\n\t\t[isUserMessage, user, renderBubble, extraProps, expandedMessages],\n\t);\n\n\t// Render a message avatar (or call custom renderAvatar)\n\tconst renderMessageAvatar = useCallback(\n\t\t(message: IMessage, previousMessage?: IMessage, nextMessage?: IMessage) => {\n\t\t\tconst shouldShow = shouldShowAvatar(message, previousMessage);\n\n\t\t\tif (!shouldShow) return null;\n\n\t\t\tconst position = isUserMessage(message) ? 'right' : 'left';\n\n\t\t\tconst avatarProps: AvatarProps<IMessage> = {\n\t\t\t\tcurrentMessage: message,\n\t\t\t\tpreviousMessage,\n\t\t\t\tnextMessage,\n\t\t\t\tposition,\n\t\t\t\tuser,\n\t\t\t\trenderAvatarOnTop,\n\t\t\t\tshowUserAvatar,\n\t\t\t\tshowAvatarForEveryMessage,\n\t\t\t};\n\n\t\t\treturn renderAvatar ? renderAvatar(avatarProps) : null;\n\t\t},\n\t\t[\n\t\t\tshouldShowAvatar,\n\t\t\tisUserMessage,\n\t\t\tuser,\n\t\t\trenderAvatarOnTop,\n\t\t\tshowUserAvatar,\n\t\t\tshowAvatarForEveryMessage,\n\t\t\trenderAvatar,\n\t\t],\n\t);\n\n\t// Render: Empty State\n\tif (!messages || messages.length === 0) {\n\t\treturn renderChatEmpty ? <>{renderChatEmpty()}</> : null;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tref={scrollRef as React.RefObject<HTMLDivElement>}\n\t\t\tstyle={{\n\t\t\t\tflex: 1,\n\t\t\t\toverflowY: 'auto',\n\t\t\t\toverflowX: 'hidden',\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tflexDirection: 'column',\n\t\t\t\t...(maxHeight ? { maxHeight, height: maxHeight } : {}),\n\t\t\t\t...listViewProps.style,\n\t\t\t}}\n\t\t\tonScroll={handleScroll}\n\t\t>\n\t\t\t{/* Spacer to push messages to bottom (newest appears last in DOM) */}\n\t\t\t<div style={{ flex: '1 0 auto' }} />\n\n\t\t\t<div\n\t\t\t\tstyle={{\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\tflexDirection: 'column',\n\t\t\t\t\tflex: '0 0 auto',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{reversedMessages.map((message, index) => {\n\t\t\t\t\tconst isSmtp =\n\t\t\t\t\t\tmessage?.['channelId'] === MESSAGE_CHANNELS.SMTP ||\n\t\t\t\t\t\tmessage?.['channelName'] === MESSAGE_CHANNELS.SMTP;\n\t\t\t\t\tconst position = isSmtp ? 'left' : (isUserMessage(message) ? 'right' : 'left');\n\t\t\t\t\tconst previousMessage = reversedMessages[index - 1];\n\t\t\t\t\tconst nextMessage = reversedMessages[index + 1];\n\t\t\t\t\tconst shouldShowDay = !isSameDay(message, previousMessage);\n\t\t\t\t\tconst placement = getMessagePlacement(message, position);\n\t\t\t\t\tconst isCentered = shouldCenterAlign(message);\n\t\t\t\t\t// Check if message is a private note\n\t\t\t\t\tconst isPrivateNote =\n\t\t\t\t\t\tmessage['category'] === Constants.ChatActivity.Category.ACTIVITY &&\n\t\t\t\t\t\tmessage['activityType'] ===\n\t\t\t\t\t\t\tConstants.ChatActivity.Type.PRIVATE_NOTE;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<React.Fragment\n\t\t\t\t\t\t\tkey={message._id ?? `${index}-${messageIdGenerator?.() ?? 'id'}`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{/* Day separator */}\n\t\t\t\t\t\t\t{shouldShowDay &&\n\t\t\t\t\t\t\t\t(renderDay ? (\n\t\t\t\t\t\t\t\t\trenderDay({ createdAt: message.createdAt })\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<Day createdAt={message.createdAt} appType={appType} />\n\t\t\t\t\t\t\t\t))}\n\n\t\t\t\t\t\t\t{/* Message container */}\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t...(isMobile ? { margin: '0 4px' } : {}),\n\t\t\t\t\t\t\t\t\t...(isCentered\n\t\t\t\t\t\t\t\t\t\t? {}\n\t\t\t\t\t\t\t\t\t\t: { display: 'flex', alignItems: 'flex-start' }),\n\t\t\t\t\t\t\t\t\t...(appType !== GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t\t\t? !isMobile && position === 'right'\n\t\t\t\t\t\t\t\t\t\t\t? { marginLeft: 8 }\n\t\t\t\t\t\t\t\t\t\t\t: { marginRight: 8 }\n\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\t...(isSmtp && !isPrivateNote && isMobile\n\t\t\t\t\t\t\t\t\t\t? { marginLeft: 8, marginRight: 8 }\n\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t\tjustifyContent: placement,\n\t\t\t\t\t\t\t\t\tmarginBottom: nextMessage\n\t\t\t\t\t\t\t\t\t\t? nextMessage?.user?._id === message?.user?._id\n\t\t\t\t\t\t\t\t\t\t\t? 4\n\t\t\t\t\t\t\t\t\t\t\t: 20\n\t\t\t\t\t\t\t\t\t\t: 0,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{/* Left avatar or placeholder (for mobile, avatar is hidden) */}\n\t\t\t\t\t\t\t\t{!isMobile && position === 'left' && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tstyle={{ marginRight: '4px', width: '24px', flexShrink: 0 }}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{renderMessageAvatar(message, previousMessage, nextMessage)}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t\t{/* Message bubble */}\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\tid={`message-bubble-${\n\t\t\t\t\t\t\t\t\t\tmessage._id ?? `${index}-${messageIdGenerator?.() ?? 'id'}`\n\t\t\t\t\t\t\t\t\t}`}\n\t\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t\tappType === GiftedChatAppType.Manifest\n\t\t\t\t\t\t\t\t\t\t\t? { width: '100%' }\n\t\t\t\t\t\t\t\t\t\t\t: isMobile && isSmtp\n\t\t\t\t\t\t\t\t\t\t\t? { display: 'flex', flexGrow: 1 }\n\t\t\t\t\t\t\t\t\t\t\t: {}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{renderMessageBubble(message, previousMessage, nextMessage)}\n\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t{/* Right avatar or placeholder (for mobile, avatar is hidden) */}\n\t\t\t\t\t\t\t\t{!isMobile && position === 'right' && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\tmarginLeft: '4px',\n\t\t\t\t\t\t\t\t\t\t\twidth: '24px',\n\t\t\t\t\t\t\t\t\t\t\tflexShrink: 0,\n\t\t\t\t\t\t\t\t\t\t\talignSelf: 'flex-start',\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{renderMessageAvatar(message, previousMessage, nextMessage)}\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</React.Fragment>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nexport default forwardRef<HTMLDivElement, GiftedChatProps<IMessage>>(\n\tGiftedChatInner,\n);\n"],"names":["CollapsibleBubbleText","_ref","text","isExpanded","onToggle","textRef","useRef","isOverflowing","setIsOverflowing","useState","useEffect","el","current","style","maxHeight","overflows","scrollHeight","_jsxs","_jsx","Object","assign","ref","overflow","children","BodySecondary","Button","buttonType","size","buttonText","onClick","GiftedChat","forwardRef","GiftedChatInner","props","forwardedRef","_b","messages","user","renderBubble","renderAvatar","renderDay","renderLoading","renderChatEmpty","listViewProps","renderAvatarOnTop","showUserAvatar","showAvatarForEveryMessage","inverted","messageIdGenerator","topThreshold","TOP_THRESHOLD","appType","GiftedChatAppType","Bik","isActivityMessage","extraProps","__rest","isMobile","useWindowSize","internalScrollRef","scrollRef","normalizeRef","scrollState","isInitialMount","isUserScrolling","isLoadingOldMessages","isAtBottom","hasTriggeredEndReached","lastMessagesLength","_a","length","previousScrollHeight","previousScrollTop","scrollTimeout","expandedMessages","setExpandedMessages","Set","reversedMessages","useMemo","reverse","scrollToBottom","useScrollToBottom","useImperativeHandle","useInitialMountScroll","useScrollCleanup","useRestoreScrollPosition","useAutoScrollOnNewMessages","useResizeObserverForFirstMessage","handleScroll","useScrollHandler","onEndReached","onScroll","isUserMessage","useCallback","message","Boolean","_id","shouldShowAvatar","previousMessage","renderMessageBubble","nextMessage","position","isTopOfStack","isBottomOfStack","_c","_d","bubbleProps","currentMessage","messageId","has","maxWidth","Manifest","width","minWidth","padding","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","border","backgroundColor","COLORS","background","brandTint","brandLight","pureWhite","inactive","color","content","primary","wordBreak","_e","prev","next","delete","add","renderMessageAvatar","flex","overflowY","overflowX","display","flexDirection","height","map","index","isSmtp","MESSAGE_CHANNELS","SMTP","shouldShowDay","isSameDay","placement","getMessagePlacement","isCentered","shouldCenterAlign","isPrivateNote","Constants","ChatActivity","Category","ACTIVITY","Type","PRIVATE_NOTE","React","Fragment","createdAt","Day","margin","alignItems","marginRight","marginLeft","justifyContent","marginBottom","flexShrink","id","flexGrow","alignSelf","_f","_Fragment"],"mappings":"y+BA8BA,MAEMA,EAIDC,IAAmC,IAAlCC,KAAEA,EAAIC,WAAEA,EAAUC,SAAEA,GAAUH,EACnC,MAAMI,EAAUC,EAAuB,OAChCC,EAAeC,GAAoBC,GAAS,GAanD,OAXAC,GAAU,KACT,MAAMC,EAAKN,EAAQO,QACnB,GAAID,EAAI,CAEPA,EAAGE,MAAMC,UAAY,OACrB,MAAMC,EAAYJ,EAAGK,aAfK,IAgB1BL,EAAGE,MAAMC,UAAYX,EAAa,OAAY,QAC9CK,EAAiBO,EACjB,IACC,CAACb,EAAMC,IAGTc,eACCC,EACC,MAAAC,OAAAC,OAAA,CAAAC,IAAKhB,EACLQ,MAAO,CACNC,UAAWX,EAAa,OA1BA,IA2BxBmB,SAAU,WACV,CAAAC,SAEDL,EAACM,EAAa,CAAAD,SAAErB,OAEhBK,GACAW,EAACO,EACA,CAAAC,WAAW,OACXC,KAAK,KACLC,WAAYzB,EAAa,YAAc,YACvC0B,Q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AG,GACN,CAAAE,eAAgBnB,EAChBoB,aAActE,GACM,QAAjB/B,EAAA+B,aAAW,EAAXA,EAAa/D,YAAI,IAAAgC,OAAA,EAAAA,EAAE2B,QAAuB,QAAf7D,EAAA2D,aAAO,EAAPA,EAASzD,YAAM,IAAAF,OAAA,EAAAA,EAAA6D,KACzC,EACA,GACD,KAIH,CAAAzE,SAAA,EAACkC,GAAyB,SAAb4C,GACbnF,EACC,MAAAC,OAAAC,OAAA,CAAAP,MAAO,CAAE0J,YAAa,MAAOvD,MAAO,OAAQ2D,WAAY,IAEvD,CAAApJ,SAAAiH,GAAoB1C,EAASI,EAAiBE,MAKjDlF,EAAA,MAAAC,OAAAC,OAAA,CACCwJ,GAAI,kBACY,QAAfpE,EAAAV,EAAQE,WAAO,IAAAQ,EAAAA,EAAA,GAAGwC,aAASvC,EAAAzD,aAAkB,EAAlBA,mBAA0B,SAEtDnC,MACCsC,IAAYC,EAAkB2D,SAC3B,CAAEC,MAAO,QACTvD,GAAYwF,EACZ,CAAEL,QAAS,OAAQiC,SAAU,GAC7B,IAGH,CAAAtJ,SAAA4E,GAAoBL,EAASI,EAAiBE,OAI9C3C,GAAyB,UAAb4C,GACbnF,EACC,MAAAC,OAAAC,OAAA,CAAAP,MAAO,CACN2J,WAAY,MACZxD,MAAO,OACP2D,WAAY,EACZG,UAAW,eACX,CAAAvJ,SAEAiH,GAAoB1C,EAASI,EAAiBE,YApE9B,QAAf+B,EAAArC,EAAQE,WAAO,IAAAmC,EAAAA,EAAA,GAAGa,KAAmC,QAA1B+B,EAAA/H,aAAkB,EAAlBA,WAA0B,IAAA+H,EAAAA,EAAA,OAwE1C,WApHdrI,EAAkBxB,EAAG8J,EAAA,CAAAzJ,SAAAmB,MAAwB,IAwH9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sources":["../../../../../src/components/BikGiftedChat/GiftedChat/types.ts"],"sourcesContent":["import React from 'react';\nimport { BubbleProps, GiftedChatAppType } from '../Bubble/types';\nimport { IMessage, LeftRightStyle, User } from '../types';\n\nexport interface ListViewProps {\n\t/** Custom styles for the container. */\n\tstyle?: React.CSSProperties;\n\t/** Callback when end of list is reached. */\n\tonEndReached?: () => void;\n\t/** Threshold for triggering end reached. */\n\tonEndReachedThreshold?: number;\n\t/** Scroll event handler. */\n\tonScroll?: (event: React.UIEvent<HTMLDivElement>) => void;\n\t/** Ref for the scrollable container. */\n\tref?:\n\t\t| React.RefObject<HTMLDivElement>\n\t\t| React.MutableRefObject<HTMLDivElement | null>;\n}\n\nexport interface AvatarProps<TMessage extends IMessage = IMessage> {\n\t/** The current message for the avatar. */\n\tcurrentMessage: TMessage;\n\t/** The previous message. */\n\tpreviousMessage?: TMessage;\n\t/** The next message. */\n\tnextMessage?: TMessage;\n\t/** Position of the avatar ('left' or 'right'). */\n\tposition: 'left' | 'right';\n\t/** The user object. */\n\tuser: User;\n\t/** Whether to render avatar on top. */\n\trenderAvatarOnTop?: boolean;\n\t/** Whether to show user avatar. */\n\tshowUserAvatar?: boolean;\n\t/** Show avatar for every message; when false, show only on the first message of each consecutive sender group. */\n\tshowAvatarForEveryMessage?: boolean;\n\t/** Custom styles for avatar image. */\n\timageStyle?: LeftRightStyle<React.CSSProperties>;\n\t/** Custom styles for avatar container. */\n\tcontainerStyle?: LeftRightStyle<React.CSSProperties>;\n\t[key: string]: any;\n}\n\nexport interface DayProps {\n\t/** Date/time for the separator. */\n\tcreatedAt?: Date | number | string;\n\t/** Format for displaying the date. */\n\tdateFormat?: string;\n\t/** Calendar format options. */\n\tdateFormatCalendar?: {\n\t\t/** Format for same day. */\n\t\tsameDay?: string;\n\t\t/** Format for next day. */\n\t\tnextDay?: string;\n\t\t/** Format for next week. */\n\t\tnextWeek?: string;\n\t\t/** Format for last day. */\n\t\tlastDay?: string;\n\t\t/** Format for last week. */\n\t\tlastWeek?: string;\n\t\t/** Format for other days. */\n\t\tsameElse?: string;\n\t};\n}\n\nexport interface GiftedChatProps<TMessage extends IMessage = IMessage> {\n\t/** Array of chat messages. */\n\tmessages: TMessage[];\n\t/** The current user object. */\n\tuser: User;\n\n\t/** Custom bubble renderer. */\n\trenderBubble?: (props: BubbleProps<TMessage>) => React.ReactNode;\n\t/** Custom avatar renderer. */\n\trenderAvatar?: (props: AvatarProps<TMessage>) => React.ReactNode;\n\t/** Custom day separator renderer. */\n\trenderDay?: (props: DayProps) => React.ReactNode;\n\t/** Custom loading renderer. */\n\trenderLoading?: () => React.ReactNode;\n\t/** Custom empty chat renderer. */\n\trenderChatEmpty?: () => React.ReactNode;\n\n\t/** Props for the scrollable list view. */\n\tlistViewProps?: ListViewProps;\n\n\t/** Scroll threshold for loading old messages. */\n\ttopThreshold?: number;\n\n\t/** Whether to render avatar on top. */\n\trenderAvatarOnTop?: boolean;\n\t/** Whether to show user avatar. */\n\tshowUserAvatar?: boolean;\n\t/** Show avatar for every message; when false, show only on the first message of each consecutive sender group. */\n\tshowAvatarForEveryMessage?: boolean;\n\t/** Whether to invert the message list. */\n\tinverted?: boolean;\n\n\t/** Handler for long press on message. */\n\tonLongPress?: (context?: any, message?: TMessage) => void;\n\t/** Handler for press on message. */\n\tonPress?: (context?: any, message?: TMessage) => void;\n\n\t/** Function to generate message IDs. */\n\tmessageIdGenerator?: (message?: TMessage) => string;\n\tappType?: GiftedChatAppType;\n\t/** Maximum height of the chat messages container in pixels. When set, the container clips overflow and scrolls within that height. */\n\tmaxHeight?: number;\n\t/** Returns true if a message is a non-chat activity (e.g. assignment, status change). Used to break sender stacks for avatar and border-radius logic. */\n\tisActivityMessage?: (message: TMessage) => boolean;\n\t/** Returns true if a message should always be aligned to the left with no avatar, regardless of sender. */\n\tforceLeftAlign?: (message: TMessage) => boolean;\n\n\t[key: string]: any;\n}\n\nexport interface ScrollState {\n\t/** Is initial mount of the component. */\n\tisInitialMount: boolean;\n\t/** Is user currently scrolling. */\n\tisUserScrolling: boolean;\n\t/** Is loading old messages. */\n\tisLoadingOldMessages: boolean;\n\n\t/** Is scroll at bottom. */\n\tisAtBottom: boolean;\n\t/** Has end reached been triggered. */\n\thasTriggeredEndReached: boolean;\n\n\t/** Last known messages length. */\n\tlastMessagesLength: number;\n\n\t/** Previous scroll height. */\n\tpreviousScrollHeight: number;\n\t/** Previous scroll top position. */\n\tpreviousScrollTop: number;\n\n\t/** Debounce timer for scroll events. */\n\tscrollTimeout: number | null;\n}\n\nexport enum CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE {\n\t/** User is calling another user. */\n\tCALLING_CALL = 'CALLING_CALL',\n\t/** Call is ringing for the recipient. */\n\tRINGING_CALL = 'RINGING_CALL',\n\t/** Call is ongoing between users. */\n\tONGOING_CALL = 'ONGOING_CALL',\n\t/** Call has been completed. */\n\tCOMPLETED_CALL = 'COMPLETED_CALL',\n\t/** Call was missed by the recipient. */\n\tMISSED_CALL = 'MISSED_CALL',\n\t/** Callback was requested. */\n\tREQUESTED_CALLBACK = 'REQUESTED_CALLBACK',\n\t/** Call was declined by the recipient. */\n\tDECLINED_CALL = 'DECLINED_CALL',\n\t/** Call was disconnected. */\n\tDISCONNECTED_CALL = 'DISCONNECTED_CALL',\n\t/** Call was unanswered. */\n\tUNANSWERED_CALL = 'UNANSWERED_CALL',\n}\n\nexport const enum MESSAGE_CHANNELS {\n\tINSTAGRAM = 'instagram',\n\tMESSENGER = 'messenger',\n\tWHATSAPP = 'whatsapp',\n\tGMAIL = 'gmail',\n\tLIVECHAT = 'livechat',\n\tGOOGLE_BUSINESS_CHAT = 'gbm',\n\tSHOPIFY = 'shopify',\n\tFACEBOOK = 'facebook',\n\tEMAIL = 'email',\n\tSMTP = 'smtp',\n\tFACEBOOK_CATALOG = 'facebook-catalog',\n\tWHATSAPP_VOICE_CALL = 'whatsapp-voice-call',\n\tCREATE_SIGNATURE = 'create-signature',\n\tEDIT_SIGNATURE = 'edit-signature',\n\tWEBPUSH = 'webpush',\n\tTASKS = 'tasks',\n\tRCS = 'rcs',\n}\n"],"names":["CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE","MESSAGE_CHANNELS"],"mappings":"IA4IYA,EAqBMC,GArBlB,SAAYD,GAEXA,EAAA,aAAA,eAEAA,EAAA,aAAA,eAEAA,EAAA,aAAA,eAEAA,EAAA,eAAA,iBAEAA,EAAA,YAAA,cAEAA,EAAA,mBAAA,qBAEAA,EAAA,cAAA,gBAEAA,EAAA,kBAAA,oBAEAA,EAAA,gBAAA,iBACA,CAnBD,CAAYA,IAAAA,EAmBX,CAAA,IAED,SAAkBC,GACjBA,EAAA,UAAA,YACAA,EAAA,UAAA,YACAA,EAAA,SAAA,WACAA,EAAA,MAAA,QACAA,EAAA,SAAA,WACAA,EAAA,qBAAA,MACAA,EAAA,QAAA,UACAA,EAAA,SAAA,WACAA,EAAA,MAAA,QACAA,EAAA,KAAA,OACAA,EAAA,iBAAA,mBACAA,EAAA,oBAAA,sBACAA,EAAA,iBAAA,mBACAA,EAAA,eAAA,iBACAA,EAAA,QAAA,UACAA,EAAA,MAAA,QACAA,EAAA,IAAA,KACA,CAlBD,CAAkBA,IAAAA,EAkBjB,CAAA"}
1
+ {"version":3,"file":"types.js","sources":["../../../../../src/components/BikGiftedChat/GiftedChat/types.ts"],"sourcesContent":["import React from 'react';\nimport { BubbleProps, GiftedChatAppType } from '../Bubble/types';\nimport { IMessage, LeftRightStyle, User } from '../types';\n\nexport interface ListViewProps {\n\t/** Custom styles for the container. */\n\tstyle?: React.CSSProperties;\n\t/** Callback when end of list is reached. */\n\tonEndReached?: () => void;\n\t/** Threshold for triggering end reached. */\n\tonEndReachedThreshold?: number;\n\t/** Scroll event handler. */\n\tonScroll?: (event: React.UIEvent<HTMLDivElement>) => void;\n\t/** Ref for the scrollable container. */\n\tref?:\n\t\t| React.RefObject<HTMLDivElement>\n\t\t| React.MutableRefObject<HTMLDivElement | null>;\n}\n\nexport interface AvatarProps<TMessage extends IMessage = IMessage> {\n\t/** The current message for the avatar. */\n\tcurrentMessage: TMessage;\n\t/** The previous message. */\n\tpreviousMessage?: TMessage;\n\t/** The next message. */\n\tnextMessage?: TMessage;\n\t/** Position of the avatar ('left' or 'right'). */\n\tposition: 'left' | 'right';\n\t/** The user object. */\n\tuser: User;\n\t/** Whether to render avatar on top. */\n\trenderAvatarOnTop?: boolean;\n\t/** Whether to show user avatar. */\n\tshowUserAvatar?: boolean;\n\t/** Show avatar for every message; when false, show only on the first message of each consecutive sender group. */\n\tshowAvatarForEveryMessage?: boolean;\n\t/** Custom styles for avatar image. */\n\timageStyle?: LeftRightStyle<React.CSSProperties>;\n\t/** Custom styles for avatar container. */\n\tcontainerStyle?: LeftRightStyle<React.CSSProperties>;\n\t[key: string]: any;\n}\n\nexport interface DayProps {\n\t/** Date/time for the separator. */\n\tcreatedAt?: Date | number | string;\n\t/** Format for displaying the date. */\n\tdateFormat?: string;\n\t/** Calendar format options. */\n\tdateFormatCalendar?: {\n\t\t/** Format for same day. */\n\t\tsameDay?: string;\n\t\t/** Format for next day. */\n\t\tnextDay?: string;\n\t\t/** Format for next week. */\n\t\tnextWeek?: string;\n\t\t/** Format for last day. */\n\t\tlastDay?: string;\n\t\t/** Format for last week. */\n\t\tlastWeek?: string;\n\t\t/** Format for other days. */\n\t\tsameElse?: string;\n\t};\n}\n\nexport interface GiftedChatProps<TMessage extends IMessage = IMessage> {\n\t/** Array of chat messages. */\n\tmessages: TMessage[];\n\t/** The current user object. */\n\tuser: User;\n\n\t/** Custom bubble renderer. */\n\trenderBubble?: (props: BubbleProps<TMessage>) => React.ReactNode;\n\t/** Custom avatar renderer. */\n\trenderAvatar?: (props: AvatarProps<TMessage>) => React.ReactNode;\n\t/** Custom day separator renderer. */\n\trenderDay?: (props: DayProps) => React.ReactNode;\n\t/** Custom loading renderer. */\n\trenderLoading?: () => React.ReactNode;\n\t/** Custom empty chat renderer. */\n\trenderChatEmpty?: () => React.ReactNode;\n\n\t/** Props for the scrollable list view. */\n\tlistViewProps?: ListViewProps;\n\n\t/** Scroll threshold for loading old messages. */\n\ttopThreshold?: number;\n\n\t/** Whether to render avatar on top. */\n\trenderAvatarOnTop?: boolean;\n\t/** Whether to show user avatar. */\n\tshowUserAvatar?: boolean;\n\t/** Show avatar for every message; when false, show only on the first message of each consecutive sender group. */\n\tshowAvatarForEveryMessage?: boolean;\n\t/** Whether to invert the message list. */\n\tinverted?: boolean;\n\n\t/** Handler for long press on message. */\n\tonLongPress?: (context?: any, message?: TMessage) => void;\n\t/** Handler for press on message. */\n\tonPress?: (context?: any, message?: TMessage) => void;\n\n\t/** Function to generate message IDs. */\n\tmessageIdGenerator?: (message?: TMessage) => string;\n\tappType?: GiftedChatAppType;\n\t/** Maximum height of the chat messages container in pixels. When set, the container clips overflow and scrolls within that height. */\n\tmaxHeight?: number;\n\t/** Returns true if a message is a non-chat activity (e.g. assignment, status change). Used to break sender stacks for avatar and border-radius logic. */\n\tisActivityMessage?: (message: TMessage) => boolean;\n\n\t[key: string]: any;\n}\n\nexport interface ScrollState {\n\t/** Is initial mount of the component. */\n\tisInitialMount: boolean;\n\t/** Is user currently scrolling. */\n\tisUserScrolling: boolean;\n\t/** Is loading old messages. */\n\tisLoadingOldMessages: boolean;\n\n\t/** Is scroll at bottom. */\n\tisAtBottom: boolean;\n\t/** Has end reached been triggered. */\n\thasTriggeredEndReached: boolean;\n\n\t/** Last known messages length. */\n\tlastMessagesLength: number;\n\n\t/** Previous scroll height. */\n\tpreviousScrollHeight: number;\n\t/** Previous scroll top position. */\n\tpreviousScrollTop: number;\n\n\t/** Debounce timer for scroll events. */\n\tscrollTimeout: number | null;\n}\n\nexport enum CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE {\n\t/** User is calling another user. */\n\tCALLING_CALL = 'CALLING_CALL',\n\t/** Call is ringing for the recipient. */\n\tRINGING_CALL = 'RINGING_CALL',\n\t/** Call is ongoing between users. */\n\tONGOING_CALL = 'ONGOING_CALL',\n\t/** Call has been completed. */\n\tCOMPLETED_CALL = 'COMPLETED_CALL',\n\t/** Call was missed by the recipient. */\n\tMISSED_CALL = 'MISSED_CALL',\n\t/** Callback was requested. */\n\tREQUESTED_CALLBACK = 'REQUESTED_CALLBACK',\n\t/** Call was declined by the recipient. */\n\tDECLINED_CALL = 'DECLINED_CALL',\n\t/** Call was disconnected. */\n\tDISCONNECTED_CALL = 'DISCONNECTED_CALL',\n\t/** Call was unanswered. */\n\tUNANSWERED_CALL = 'UNANSWERED_CALL',\n}\n\nexport const enum MESSAGE_CHANNELS {\n\tINSTAGRAM = 'instagram',\n\tMESSENGER = 'messenger',\n\tWHATSAPP = 'whatsapp',\n\tGMAIL = 'gmail',\n\tLIVECHAT = 'livechat',\n\tGOOGLE_BUSINESS_CHAT = 'gbm',\n\tSHOPIFY = 'shopify',\n\tFACEBOOK = 'facebook',\n\tEMAIL = 'email',\n\tSMTP = 'smtp',\n\tFACEBOOK_CATALOG = 'facebook-catalog',\n\tWHATSAPP_VOICE_CALL = 'whatsapp-voice-call',\n\tCREATE_SIGNATURE = 'create-signature',\n\tEDIT_SIGNATURE = 'edit-signature',\n\tWEBPUSH = 'webpush',\n\tTASKS = 'tasks',\n\tRCS = 'rcs',\n}\n"],"names":["CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE","MESSAGE_CHANNELS"],"mappings":"IA0IYA,EAqBMC,GArBlB,SAAYD,GAEXA,EAAA,aAAA,eAEAA,EAAA,aAAA,eAEAA,EAAA,aAAA,eAEAA,EAAA,eAAA,iBAEAA,EAAA,YAAA,cAEAA,EAAA,mBAAA,qBAEAA,EAAA,cAAA,gBAEAA,EAAA,kBAAA,oBAEAA,EAAA,gBAAA,iBACA,CAnBD,CAAYA,IAAAA,EAmBX,CAAA,IAED,SAAkBC,GACjBA,EAAA,UAAA,YACAA,EAAA,UAAA,YACAA,EAAA,SAAA,WACAA,EAAA,MAAA,QACAA,EAAA,SAAA,WACAA,EAAA,qBAAA,MACAA,EAAA,QAAA,UACAA,EAAA,SAAA,WACAA,EAAA,MAAA,QACAA,EAAA,KAAA,OACAA,EAAA,iBAAA,mBACAA,EAAA,oBAAA,sBACAA,EAAA,iBAAA,mBACAA,EAAA,eAAA,iBACAA,EAAA,QAAA,UACAA,EAAA,MAAA,QACAA,EAAA,IAAA,KACA,CAlBD,CAAkBA,IAAAA,EAkBjB,CAAA"}
@@ -95,8 +95,6 @@ export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
95
95
  maxHeight?: number;
96
96
  /** Returns true if a message is a non-chat activity (e.g. assignment, status change). Used to break sender stacks for avatar and border-radius logic. */
97
97
  isActivityMessage?: (message: TMessage) => boolean;
98
- /** Returns true if a message should always be aligned to the left with no avatar, regardless of sender. */
99
- forceLeftAlign?: (message: TMessage) => boolean;
100
98
  [key: string]: any;
101
99
  }
102
100
  export interface ScrollState {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.805-beta.27",
3
+ "version": "0.0.805-beta.29",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",