@bikdotai/bik-component-library 0.0.821-beta.2 → 0.0.821-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),c=require("react"),l=require("../../../constants/Theme.js"),R=require("../../../hooks/useWindowSize.js"),g=require("../GiftedChat/types.js"),S=require("../GiftedChat/utils.js"),A=require("./types.js"),P=n=>n&&typeof n=="object"&&"default"in n?n:{default:n},q=P(c),B=n=>{const{currentMessage:d,position:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),c=require("react"),l=require("../../../constants/Theme.js"),R=require("../../../hooks/useWindowSize.js"),g=require("../GiftedChat/types.js"),S=require("../GiftedChat/utils.js"),A=require("./types.js"),P=n=>n&&typeof n=="object"&&"default"in n?n:{default:n},q=P(c),B=n=>{const{currentMessage:d,position:r,renderMessageText:C,renderTicks:T,renderTime:v,renderCustomView:y,isCustomViewBottom:h,isUnsatisfactoryMessageFn:m,messagesGroupedByAiTraceId:x,onPress:j,containerStyle:t,bubbleStyles:i,appType:I=A.GiftedChatAppType.Bik}=n,u=R.useWindowSize(),e=d,s=I===A.GiftedChatAppType.Manifest,b=c.useMemo(()=>e.category===S.Constants.ChatActivity.Category.ACTIVITY&&e.activityType===S.Constants.ChatActivity.Type.PRIVATE_NOTE,[e.category,e.activityType]),M=c.useMemo(()=>{const[p,f]=S.isStringifiedArray(e?.message);return p&&f&&Array.isArray(f)},[e?.message]),k=e?.channelId===g.MESSAGE_CHANNELS.SMTP||e?.channelName===g.MESSAGE_CHANNELS.SMTP,E=c.useMemo(()=>{const p={borderRadius:8,minHeight:20,margin:0,flexGrow:u?1:0,width:"100%"},f=e?.channelId===g.MESSAGE_CHANNELS.GMAIL||e?.channelName===g.MESSAGE_CHANNELS.GMAIL;let a={};if(s)return r==="left"?a=i&&typeof i.left=="object"?i.left:{}:a=i&&typeof i.right=="object"?i.right:{},{...a};if(r==="left")a={...u||f||k?{maxWidth:"100%"}:{},...b?{background:l.COLORS.background.warning.light}:{backgroundColor:e?.isPrivateMail?l.COLORS.background.blue.light:l.COLORS.background.warning.light}};else{const N=m&&m({aiTraceId:e.eventProperties?.aiTraceId,messagesGroupedByAiTraceId:x});a={backgroundColor:e.status==="failed"||N?l.COLORS.background.negative.light:l.COLORS.background.brandUltraLight,...b?{background:l.COLORS.background.warning.light}:{},...!u&&M?{maxWidth:500}:{}}}const G=i&&typeof i=="object"?"left"in i||"right"in i?r==="left"?i.left??{}:i.right??{}:i:{};return{...p,...a,...G}},[e?.channelId,e?.channelName,e?.meta?.aiUsed,e?.status,e?.eventProperties?.aiTraceId,r,u,b,M,m,x,e?.isPrivateMail,i,s]),L=c.useCallback(()=>o.jsxs("div",{children:[!h&&y?.(n),C?.(n),h&&y?.(n)]}),[h,y,C,n]),O=c.useMemo(()=>!s||typeof t!="object"?{}:r==="left"&&"left"in t&&t.left&&typeof t.left=="object"?t.left:r==="right"&&"right"in t&&t.right&&typeof t.right=="object"?t.right:{},[s,t,r]),w=!s&&t&&typeof t=="object"?"left"in t||"right"in t?r==="left"?t.left??{}:t.right??{}:t:{};return o.jsx("div",{style:{display:"flex",marginTop:s?0:6,marginBottom:s?0:d?.messageInformation?.reactions?.length>0?24:6,flexGrow:u?1:0,...s?{alignItems:"flex-end",...r==="right"?{cursor:"pointer"}:{}}:{},...O,...w},...s?{onClick:j}:{},children:o.jsx("div",{style:E,children:o.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"flex-end",columnGap:6},children:[o.jsx("div",{id:d.chatActivityId||`message-${d.psqlId}`,children:L()}),o.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",flexShrink:0,marginLeft:"auto"},children:[v?.(n),T?.(d)]})]})})})},_=q.default.memo(B);exports.Bubble=_;
|
|
2
2
|
//# sourceMappingURL=Bubble.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bubble.js","sources":["../../../../../src/components/BikGiftedChat/Bubble/Bubble.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\nimport { COLORS } from '../../../constants/Theme';\nimport { useWindowSize } from '../../../hooks/useWindowSize';\nimport { MESSAGE_CHANNELS } from '../GiftedChat/types';\nimport { Constants, isStringifiedArray } from '../GiftedChat/utils';\nimport { IMessage } from '../types';\nimport { BubbleProps, GiftedChatAppType } from './types';\n\nconst BubbleComponent = <TMessage extends IMessage = IMessage>(\n\tprops: BubbleProps<TMessage>,\n): React.ReactElement => {\n\tconst {\n\t\tcurrentMessage,\n\t\tposition,\n\t\trenderMessageText,\n\t\trenderTicks,\n\t\trenderTime,\n\t\trenderCustomView,\n\t\tisCustomViewBottom,\n\t\tisUnsatisfactoryMessageFn,\n\t\tmessagesGroupedByAiTraceId,\n\t\tonPress,\n\t\tcontainerStyle,\n\t\tbubbleStyles,\n\t\tappType = GiftedChatAppType.Bik,\n\t} = props;\n\n\tconst isMobile = useWindowSize();\n\tconst message = currentMessage as any;\n\tconst isManifestApp = appType === GiftedChatAppType.Manifest;\n\n\t// Check if message is a private note\n\tconst isPrivateNote = useMemo(\n\t\t() =>\n\t\t\tmessage.category === Constants.ChatActivity.Category.ACTIVITY &&\n\t\t\tmessage.activityType === Constants.ChatActivity.Type.PRIVATE_NOTE,\n\t\t[message.category, message.activityType],\n\t);\n\n\t// Check if message is a carousel (array of items)\n\tconst isCarouselMessage = useMemo(() => {\n\t\tconst [parsedSuccessfully, parsedMessage] = isStringifiedArray(\n\t\t\tmessage?.message,\n\t\t);\n\t\treturn parsedSuccessfully && parsedMessage && Array.isArray(parsedMessage);\n\t}, [message?.message]);\n\tconst isSmtp =\n\t\tmessage?.channelId === MESSAGE_CHANNELS.SMTP ||\n\t\tmessage?.channelName === MESSAGE_CHANNELS.SMTP;\n\n\t// Generates wrapper styles for the message bubble\n\t// Handles position-based styling, channel-specific layouts, and message states\n\tconst wrapperStyles = useMemo((): React.CSSProperties => {\n\t\tconst baseStyles: React.CSSProperties = {\n\t\t\tborderRadius: 8,\n\t\t\tminHeight: 20,\n\t\t\tmargin: 0,\n\t\t\tflexGrow: isMobile ? 1 : 0,\n\t\t\twidth: '100%',\n\t\t};\n\n\t\t// Check if message is from email channels\n\t\tconst isGmail =\n\t\t\tmessage?.channelId === MESSAGE_CHANNELS.GMAIL ||\n\t\t\tmessage?.channelName === MESSAGE_CHANNELS.GMAIL;\n\n\t\tlet dynamicStyles: React.CSSProperties = {};\n\n\t\tif (isManifestApp) {\n\t\t\tif (position === 'left') {\n\t\t\t\tdynamicStyles =\n\t\t\t\t\tbubbleStyles && typeof bubbleStyles.left === 'object'\n\t\t\t\t\t\t? bubbleStyles.left\n\t\t\t\t\t\t: {};\n\t\t\t} else {\n\t\t\t\tdynamicStyles =\n\t\t\t\t\tbubbleStyles && typeof bubbleStyles.right === 'object'\n\t\t\t\t\t\t? bubbleStyles.right\n\t\t\t\t\t\t: {};\n\t\t\t}\n\t\t\treturn { ...dynamicStyles };\n\t\t} else {\n\t\t\tif (position === 'left') {\n\t\t\t\tdynamicStyles = {\n\t\t\t\t\t...(isMobile || isGmail || isSmtp ? { maxWidth: '100%' } : {}),\n\t\t\t\t\t...(isPrivateNote\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tbackground: COLORS.background.warning.light,\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tbackgroundColor: message?.isPrivateMail\n\t\t\t\t\t\t\t\t\t? COLORS.background.blue.light\n\t\t\t\t\t\t\t\t\t: COLORS.background.warning.light,\n\t\t\t\t\t\t }),\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tconst isUnsatisfactory =\n\t\t\t\t\tisUnsatisfactoryMessageFn &&\n\t\t\t\t\tisUnsatisfactoryMessageFn({\n\t\t\t\t\t\taiTraceId: message.eventProperties?.aiTraceId,\n\t\t\t\t\t\tmessagesGroupedByAiTraceId,\n\t\t\t\t\t});\n\n\t\t\t\tdynamicStyles = {\n\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\tmessage.status === 'failed' || isUnsatisfactory\n\t\t\t\t\t\t\t? COLORS.background.negative.light\n\t\t\t\t\t\t\t: COLORS.background.brandUltraLight,\n\t\t\t\t\t...(isPrivateNote\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tbackground: COLORS.background.warning.light,\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...(!isMobile && isCarouselMessage ? { maxWidth: 500 } : {}),\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tconst extraBubbleStyles: React.CSSProperties =\n\t\t\tbubbleStyles && typeof bubbleStyles === 'object'\n\t\t\t\t? 'left' in bubbleStyles || 'right' in bubbleStyles\n\t\t\t\t\t? position === 'left'\n\t\t\t\t\t\t? (bubbleStyles as { left?: React.CSSProperties }).left ?? {}\n\t\t\t\t\t\t: (bubbleStyles as { right?: React.CSSProperties }).right ?? {}\n\t\t\t\t\t: (bubbleStyles as React.CSSProperties)\n\t\t\t\t: {};\n\n\t\treturn { ...baseStyles, ...dynamicStyles, ...extraBubbleStyles };\n\t}, [\n\t\tmessage?.channelId,\n\t\tmessage?.channelName,\n\t\tmessage?.meta?.aiUsed,\n\t\tmessage?.status,\n\t\tmessage?.eventProperties?.aiTraceId,\n\t\tposition,\n\t\tisMobile,\n\t\tisPrivateNote,\n\t\tisCarouselMessage,\n\t\tisUnsatisfactoryMessageFn,\n\t\tmessagesGroupedByAiTraceId,\n\t\tmessage?.isPrivateMail,\n\t\tbubbleStyles,\n\t\tisManifestApp,\n\t]);\n\n\t// Renders the content of the message bubble\n\t// Handles custom views and message text in the correct order\n\tconst renderContent = useCallback(() => {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{!isCustomViewBottom && renderCustomView?.(props)}\n\n\t\t\t\t{renderMessageText?.(props)}\n\n\t\t\t\t{isCustomViewBottom && renderCustomView?.(props)}\n\t\t\t</div>\n\t\t);\n\t}, [isCustomViewBottom, renderCustomView, renderMessageText, props]);\n\n\tconst manifestContainerStyle = useMemo(() => {\n\t\tif (!isManifestApp || typeof containerStyle !== 'object') return {};\n\t\tif (\n\t\t\tposition === 'left' &&\n\t\t\t'left' in containerStyle &&\n\t\t\tcontainerStyle.left &&\n\t\t\ttypeof containerStyle.left === 'object'\n\t\t) {\n\t\t\treturn containerStyle.left;\n\t\t}\n\t\tif (\n\t\t\tposition === 'right' &&\n\t\t\t'right' in containerStyle &&\n\t\t\tcontainerStyle.right &&\n\t\t\ttypeof containerStyle.right === 'object'\n\t\t) {\n\t\t\treturn containerStyle.right;\n\t\t}\n\t\treturn {};\n\t}, [isManifestApp, containerStyle, position]);\n\n\tconst extraContainerStyle: React.CSSProperties =\n\t\t!isManifestApp && containerStyle && typeof containerStyle === 'object'\n\t\t\t? 'left' in containerStyle || 'right' in containerStyle\n\t\t\t\t? position === 'left'\n\t\t\t\t\t? (containerStyle as { left?: React.CSSProperties }).left ?? {}\n\t\t\t\t\t: (containerStyle as { right?: React.CSSProperties }).right ?? {}\n\t\t\t\t: (containerStyle as React.CSSProperties)\n\t\t\t: {};\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tmarginTop: isManifestApp ? 0 : 6,\n\t\t\t\tmarginBottom: isManifestApp\n\t\t\t\t\t? 0\n\t\t\t\t\t: currentMessage?.['messageInformation']?.reactions?.length > 0\n\t\t\t\t\t? 24\n\t\t\t\t\t: 6,\n\t\t\t\tflexGrow: isMobile ? 1 : 0,\n\t\t\t\t...(isManifestApp\n\t\t\t\t\t? {\n\t\t\t\t\t\t\talignItems: 'flex-end',\n\t\t\t\t\t\t\t...(position === 'right' ? { cursor: 'pointer' } : {}),\n\t\t\t\t\t }\n\t\t\t\t\t: {}),\n\t\t\t\t...manifestContainerStyle,\n\t\t\t\t...extraContainerStyle,\n\t\t\t}}\n\t\t\t{...(isManifestApp ? { onClick: onPress } : {})}\n\t\t>\n\t\t\t<div style={wrapperStyles}>\n\t\t\t\t<div\n\t\t\t\t\t// For sent (right) messages, lay the content and the time/ticks\n\t\t\t\t\t// in a wrapping row so a short message keeps the time beside it\n\t\t\t\t\t// (with a gap) like WhatsApp, while wide/long content pushes the\n\t\t\t\t\t// time onto its own line below.\n\t\t\t\t\tstyle={\n\t\t\t\t\t\tposition === 'right'\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\tflexWrap: 'wrap',\n\t\t\t\t\t\t\t\t\talignItems: 'flex-end',\n\t\t\t\t\t\t\t\t\tjustifyContent: 'flex-end',\n\t\t\t\t\t\t\t\t\tcolumnGap: 6,\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{/* Message content */}\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={\n\t\t\t\t\t\t\tcurrentMessage['chatActivityId'] ||\n\t\t\t\t\t\t\t`message-${currentMessage['psqlId']}`\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderContent()}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{/* Message metadata (time and status) */}\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tflexDirection: 'row',\n\t\t\t\t\t\t\tjustifyContent: 'flex-end',\n\t\t\t\t\t\t\tflexShrink: 0,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderTime?.(props)}\n\t\t\t\t\t\t{renderTicks?.(currentMessage)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\n// Export memoized version for performance\nexport const Bubble = React.memo(BubbleComponent) as typeof BubbleComponent;\n\nexport default Bubble;\n"],"names":["BubbleComponent","props","currentMessage","position","renderMessageText","renderTicks","renderTime","renderCustomView","isCustomViewBottom","isUnsatisfactoryMessageFn","messagesGroupedByAiTraceId","onPress","containerStyle","bubbleStyles","appType","GiftedChatAppType","isMobile","useWindowSize","message","isManifestApp","isPrivateNote","useMemo","Constants","isCarouselMessage","parsedSuccessfully","parsedMessage","isStringifiedArray","isSmtp","MESSAGE_CHANNELS","wrapperStyles","baseStyles","isGmail","dynamicStyles","COLORS","isUnsatisfactory","extraBubbleStyles","renderContent","useCallback","manifestContainerStyle","extraContainerStyle","jsx","jsxs","Bubble","React"],"mappings":"6XAQMA,EACLC,GACwB,CACxB,KAAM,CACL,eAAAC,EACA,SAAAC,EACA,kBAAAC,EACA,YAAAC,EACA,WAAAC,EACA,iBAAAC,EACA,mBAAAC,EACA,0BAAAC,EACA,2BAAAC,EACA,QAAAC,EACA,eAAAC,EACA,aAAAC,EACA,QAAAC,EAAUC,EAAAA,kBAAkB,GAAA,EACzBd,EAEEe,EAAWC,EAAAA,cAAA,EACXC,EAAUhB,EACViB,EAAgBL,IAAYC,EAAAA,kBAAkB,SAG9CK,EAAgBC,EAAAA,QACrB,IACCH,EAAQ,WAAaI,EAAAA,UAAU,aAAa,SAAS,UACrDJ,EAAQ,eAAiBI,EAAAA,UAAU,aAAa,KAAK,aACtD,CAACJ,EAAQ,SAAUA,EAAQ,YAAY,CAAA,EAIlCK,EAAoBF,EAAAA,QAAQ,IAAM,CACvC,KAAM,CAACG,EAAoBC,CAAa,EAAIC,EAAAA,mBAC3CR,GAAS,OAAA,EAEV,OAAOM,GAAsBC,GAAiB,MAAM,QAAQA,CAAa,CAC1E,EAAG,CAACP,GAAS,OAAO,CAAC,EACfS,EACLT,GAAS,YAAcU,EAAAA,iBAAiB,MACxCV,GAAS,cAAgBU,EAAAA,iBAAiB,KAIrCC,EAAgBR,EAAAA,QAAQ,IAA2B,CACxD,MAAMS,EAAkC,CACvC,aAAc,EACd,U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CtC,IAAa,QACV,CACA,QAAS,OACT,SAAU,OACV,WAAY,WACZ,eAAgB,WAChB,UAAW,CAAA,EAEX,OAIJ,SAAA,CAAAqC,EAAAA,IAAC,MAAA,CACA,GACCtC,EAAe,gBACf,WAAWA,EAAe,MAAS,GAGnC,SAAAkC,EAAA,CAAc,CAAA,EAIhBK,EAAAA,KAAC,MAAA,CACA,MAAO,CACN,QAAS,OACT,cAAe,MACf,eAAgB,WAChB,WAAY,CAAA,EAGZ,SAAA,CAAAnC,IAAaL,CAAK,EAClBI,IAAcH,CAAc,CAAA,CAAA,CAAA,CAC9B,CAAA,CAAA,CACD,CACD,CAAA,CAAA,CAGH,EAGawC,EAASC,EAAAA,QAAM,KAAK3C,CAAe"}
|
|
1
|
+
{"version":3,"file":"Bubble.js","sources":["../../../../../src/components/BikGiftedChat/Bubble/Bubble.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\nimport { COLORS } from '../../../constants/Theme';\nimport { useWindowSize } from '../../../hooks/useWindowSize';\nimport { MESSAGE_CHANNELS } from '../GiftedChat/types';\nimport { Constants, isStringifiedArray } from '../GiftedChat/utils';\nimport { IMessage } from '../types';\nimport { BubbleProps, GiftedChatAppType } from './types';\n\nconst BubbleComponent = <TMessage extends IMessage = IMessage>(\n\tprops: BubbleProps<TMessage>,\n): React.ReactElement => {\n\tconst {\n\t\tcurrentMessage,\n\t\tposition,\n\t\trenderMessageText,\n\t\trenderTicks,\n\t\trenderTime,\n\t\trenderCustomView,\n\t\tisCustomViewBottom,\n\t\tisUnsatisfactoryMessageFn,\n\t\tmessagesGroupedByAiTraceId,\n\t\tonPress,\n\t\tcontainerStyle,\n\t\tbubbleStyles,\n\t\tappType = GiftedChatAppType.Bik,\n\t} = props;\n\n\tconst isMobile = useWindowSize();\n\tconst message = currentMessage as any;\n\tconst isManifestApp = appType === GiftedChatAppType.Manifest;\n\n\t// Check if message is a private note\n\tconst isPrivateNote = useMemo(\n\t\t() =>\n\t\t\tmessage.category === Constants.ChatActivity.Category.ACTIVITY &&\n\t\t\tmessage.activityType === Constants.ChatActivity.Type.PRIVATE_NOTE,\n\t\t[message.category, message.activityType],\n\t);\n\n\t// Check if message is a carousel (array of items)\n\tconst isCarouselMessage = useMemo(() => {\n\t\tconst [parsedSuccessfully, parsedMessage] = isStringifiedArray(\n\t\t\tmessage?.message,\n\t\t);\n\t\treturn parsedSuccessfully && parsedMessage && Array.isArray(parsedMessage);\n\t}, [message?.message]);\n\tconst isSmtp =\n\t\tmessage?.channelId === MESSAGE_CHANNELS.SMTP ||\n\t\tmessage?.channelName === MESSAGE_CHANNELS.SMTP;\n\n\t// Generates wrapper styles for the message bubble\n\t// Handles position-based styling, channel-specific layouts, and message states\n\tconst wrapperStyles = useMemo((): React.CSSProperties => {\n\t\tconst baseStyles: React.CSSProperties = {\n\t\t\tborderRadius: 8,\n\t\t\tminHeight: 20,\n\t\t\tmargin: 0,\n\t\t\tflexGrow: isMobile ? 1 : 0,\n\t\t\twidth: '100%',\n\t\t};\n\n\t\t// Check if message is from email channels\n\t\tconst isGmail =\n\t\t\tmessage?.channelId === MESSAGE_CHANNELS.GMAIL ||\n\t\t\tmessage?.channelName === MESSAGE_CHANNELS.GMAIL;\n\n\t\tlet dynamicStyles: React.CSSProperties = {};\n\n\t\tif (isManifestApp) {\n\t\t\tif (position === 'left') {\n\t\t\t\tdynamicStyles =\n\t\t\t\t\tbubbleStyles && typeof bubbleStyles.left === 'object'\n\t\t\t\t\t\t? bubbleStyles.left\n\t\t\t\t\t\t: {};\n\t\t\t} else {\n\t\t\t\tdynamicStyles =\n\t\t\t\t\tbubbleStyles && typeof bubbleStyles.right === 'object'\n\t\t\t\t\t\t? bubbleStyles.right\n\t\t\t\t\t\t: {};\n\t\t\t}\n\t\t\treturn { ...dynamicStyles };\n\t\t} else {\n\t\t\tif (position === 'left') {\n\t\t\t\tdynamicStyles = {\n\t\t\t\t\t...(isMobile || isGmail || isSmtp ? { maxWidth: '100%' } : {}),\n\t\t\t\t\t...(isPrivateNote\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tbackground: COLORS.background.warning.light,\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tbackgroundColor: message?.isPrivateMail\n\t\t\t\t\t\t\t\t\t? COLORS.background.blue.light\n\t\t\t\t\t\t\t\t\t: COLORS.background.warning.light,\n\t\t\t\t\t\t }),\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tconst isUnsatisfactory =\n\t\t\t\t\tisUnsatisfactoryMessageFn &&\n\t\t\t\t\tisUnsatisfactoryMessageFn({\n\t\t\t\t\t\taiTraceId: message.eventProperties?.aiTraceId,\n\t\t\t\t\t\tmessagesGroupedByAiTraceId,\n\t\t\t\t\t});\n\n\t\t\t\tdynamicStyles = {\n\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\tmessage.status === 'failed' || isUnsatisfactory\n\t\t\t\t\t\t\t? COLORS.background.negative.light\n\t\t\t\t\t\t\t: COLORS.background.brandUltraLight,\n\t\t\t\t\t...(isPrivateNote\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tbackground: COLORS.background.warning.light,\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...(!isMobile && isCarouselMessage ? { maxWidth: 500 } : {}),\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tconst extraBubbleStyles: React.CSSProperties =\n\t\t\tbubbleStyles && typeof bubbleStyles === 'object'\n\t\t\t\t? 'left' in bubbleStyles || 'right' in bubbleStyles\n\t\t\t\t\t? position === 'left'\n\t\t\t\t\t\t? (bubbleStyles as { left?: React.CSSProperties }).left ?? {}\n\t\t\t\t\t\t: (bubbleStyles as { right?: React.CSSProperties }).right ?? {}\n\t\t\t\t\t: (bubbleStyles as React.CSSProperties)\n\t\t\t\t: {};\n\n\t\treturn { ...baseStyles, ...dynamicStyles, ...extraBubbleStyles };\n\t}, [\n\t\tmessage?.channelId,\n\t\tmessage?.channelName,\n\t\tmessage?.meta?.aiUsed,\n\t\tmessage?.status,\n\t\tmessage?.eventProperties?.aiTraceId,\n\t\tposition,\n\t\tisMobile,\n\t\tisPrivateNote,\n\t\tisCarouselMessage,\n\t\tisUnsatisfactoryMessageFn,\n\t\tmessagesGroupedByAiTraceId,\n\t\tmessage?.isPrivateMail,\n\t\tbubbleStyles,\n\t\tisManifestApp,\n\t]);\n\n\t// Renders the content of the message bubble\n\t// Handles custom views and message text in the correct order\n\tconst renderContent = useCallback(() => {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{!isCustomViewBottom && renderCustomView?.(props)}\n\n\t\t\t\t{renderMessageText?.(props)}\n\n\t\t\t\t{isCustomViewBottom && renderCustomView?.(props)}\n\t\t\t</div>\n\t\t);\n\t}, [isCustomViewBottom, renderCustomView, renderMessageText, props]);\n\n\tconst manifestContainerStyle = useMemo(() => {\n\t\tif (!isManifestApp || typeof containerStyle !== 'object') return {};\n\t\tif (\n\t\t\tposition === 'left' &&\n\t\t\t'left' in containerStyle &&\n\t\t\tcontainerStyle.left &&\n\t\t\ttypeof containerStyle.left === 'object'\n\t\t) {\n\t\t\treturn containerStyle.left;\n\t\t}\n\t\tif (\n\t\t\tposition === 'right' &&\n\t\t\t'right' in containerStyle &&\n\t\t\tcontainerStyle.right &&\n\t\t\ttypeof containerStyle.right === 'object'\n\t\t) {\n\t\t\treturn containerStyle.right;\n\t\t}\n\t\treturn {};\n\t}, [isManifestApp, containerStyle, position]);\n\n\tconst extraContainerStyle: React.CSSProperties =\n\t\t!isManifestApp && containerStyle && typeof containerStyle === 'object'\n\t\t\t? 'left' in containerStyle || 'right' in containerStyle\n\t\t\t\t? position === 'left'\n\t\t\t\t\t? (containerStyle as { left?: React.CSSProperties }).left ?? {}\n\t\t\t\t\t: (containerStyle as { right?: React.CSSProperties }).right ?? {}\n\t\t\t\t: (containerStyle as React.CSSProperties)\n\t\t\t: {};\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tmarginTop: isManifestApp ? 0 : 6,\n\t\t\t\tmarginBottom: isManifestApp\n\t\t\t\t\t? 0\n\t\t\t\t\t: currentMessage?.['messageInformation']?.reactions?.length > 0\n\t\t\t\t\t? 24\n\t\t\t\t\t: 6,\n\t\t\t\tflexGrow: isMobile ? 1 : 0,\n\t\t\t\t...(isManifestApp\n\t\t\t\t\t? {\n\t\t\t\t\t\t\talignItems: 'flex-end',\n\t\t\t\t\t\t\t...(position === 'right' ? { cursor: 'pointer' } : {}),\n\t\t\t\t\t }\n\t\t\t\t\t: {}),\n\t\t\t\t...manifestContainerStyle,\n\t\t\t\t...extraContainerStyle,\n\t\t\t}}\n\t\t\t{...(isManifestApp ? { onClick: onPress } : {})}\n\t\t>\n\t\t\t<div style={wrapperStyles}>\n\t\t\t\t<div\n\t\t\t\t\t// Lay the content and the time/ticks in a wrapping row so a short\n\t\t\t\t\t// message keeps the time beside it (with a gap) like WhatsApp, while\n\t\t\t\t\t// wide/long content pushes the time onto its own line below. The\n\t\t\t\t\t// time's `margin-left: auto` keeps it right-aligned on either side.\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\tflexWrap: 'wrap',\n\t\t\t\t\t\talignItems: 'flex-end',\n\t\t\t\t\t\tcolumnGap: 6,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{/* Message content */}\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={\n\t\t\t\t\t\t\tcurrentMessage['chatActivityId'] ||\n\t\t\t\t\t\t\t`message-${currentMessage['psqlId']}`\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderContent()}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{/* Message metadata (time and status) */}\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tflexDirection: 'row',\n\t\t\t\t\t\t\tjustifyContent: 'flex-end',\n\t\t\t\t\t\t\tflexShrink: 0,\n\t\t\t\t\t\t\tmarginLeft: 'auto',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderTime?.(props)}\n\t\t\t\t\t\t{renderTicks?.(currentMessage)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\n// Export memoized version for performance\nexport const Bubble = React.memo(BubbleComponent) as typeof BubbleComponent;\n\nexport default Bubble;\n"],"names":["BubbleComponent","props","currentMessage","position","renderMessageText","renderTicks","renderTime","renderCustomView","isCustomViewBottom","isUnsatisfactoryMessageFn","messagesGroupedByAiTraceId","onPress","containerStyle","bubbleStyles","appType","GiftedChatAppType","isMobile","useWindowSize","message","isManifestApp","isPrivateNote","useMemo","Constants","isCarouselMessage","parsedSuccessfully","parsedMessage","isStringifiedArray","isSmtp","MESSAGE_CHANNELS","wrapperStyles","baseStyles","isGmail","dynamicStyles","COLORS","isUnsatisfactory","extraBubbleStyles","renderContent","useCallback","manifestContainerStyle","extraContainerStyle","jsx","jsxs","Bubble","React"],"mappings":"6XAQMA,EACLC,GACwB,CACxB,KAAM,CACL,eAAAC,EACA,SAAAC,EACA,kBAAAC,EACA,YAAAC,EACA,WAAAC,EACA,iBAAAC,EACA,mBAAAC,EACA,0BAAAC,EACA,2BAAAC,EACA,QAAAC,EACA,eAAAC,EACA,aAAAC,EACA,QAAAC,EAAUC,EAAAA,kBAAkB,GAAA,EACzBd,EAEEe,EAAWC,EAAAA,cAAA,EACXC,EAAUhB,EACViB,EAAgBL,IAAYC,EAAAA,kBAAkB,SAG9CK,EAAgBC,EAAAA,QACrB,IACCH,EAAQ,WAAaI,EAAAA,UAAU,aAAa,SAAS,UACrDJ,EAAQ,eAAiBI,EAAAA,UAAU,aAAa,KAAK,aACtD,CAACJ,EAAQ,SAAUA,EAAQ,YAAY,CAAA,EAIlCK,EAAoBF,EAAAA,QAAQ,IAAM,CACvC,KAAM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H,SAAUc,EAAW,EAAI,EACzB,GAAIG,EACD,CACA,WAAY,WACZ,GAAIhB,IAAa,QAAU,CAAE,OAAQ,SAAA,EAAc,CAAA,CAAC,EAEpD,CAAA,EACH,GAAGmC,EACH,GAAGC,CAAA,EAEH,GAAIpB,EAAgB,CAAE,QAASR,CAAA,EAAY,CAAA,EAE5C,SAAA6B,EAAAA,IAAC,MAAA,CAAI,MAAOX,EACX,SAAAY,EAAAA,KAAC,MAAA,CAKA,MAAO,CACN,QAAS,OACT,SAAU,OACV,WAAY,WACZ,UAAW,CAAA,EAIZ,SAAA,CAAAD,EAAAA,IAAC,MAAA,CACA,GACCtC,EAAe,gBACf,WAAWA,EAAe,MAAS,GAGnC,SAAAkC,EAAA,CAAc,CAAA,EAIhBK,EAAAA,KAAC,MAAA,CACA,MAAO,CACN,QAAS,OACT,cAAe,MACf,eAAgB,WAChB,WAAY,EACZ,WAAY,MAAA,EAGZ,SAAA,CAAAnC,IAAaL,CAAK,EAClBI,IAAcH,CAAc,CAAA,CAAA,CAAA,CAC9B,CAAA,CAAA,CACD,CACD,CAAA,CAAA,CAGH,EAGawC,EAASC,EAAAA,QAAM,KAAK3C,CAAe"}
|
|
@@ -49,20 +49,20 @@ const _ = (a) => {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
else {
|
|
52
|
-
const
|
|
52
|
+
const E = u && u({
|
|
53
53
|
aiTraceId: e.eventProperties?.aiTraceId,
|
|
54
54
|
messagesGroupedByAiTraceId: S
|
|
55
55
|
});
|
|
56
56
|
s = {
|
|
57
|
-
backgroundColor: e.status === "failed" ||
|
|
57
|
+
backgroundColor: e.status === "failed" || E ? o.background.negative.light : o.background.brandUltraLight,
|
|
58
58
|
...h ? {
|
|
59
59
|
background: o.background.warning.light
|
|
60
60
|
} : {},
|
|
61
61
|
...!c && T ? { maxWidth: 500 } : {}
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
const
|
|
65
|
-
return { ...p, ...s, ...
|
|
64
|
+
const L = i && typeof i == "object" ? "left" in i || "right" in i ? r === "left" ? i.left ?? {} : i.right ?? {} : i : {};
|
|
65
|
+
return { ...p, ...s, ...L };
|
|
66
66
|
}, [
|
|
67
67
|
e?.channelId,
|
|
68
68
|
e?.channelName,
|
|
@@ -102,13 +102,12 @@ const _ = (a) => {
|
|
|
102
102
|
children: /* @__PURE__ */ C("div", { style: G, children: /* @__PURE__ */ b(
|
|
103
103
|
"div",
|
|
104
104
|
{
|
|
105
|
-
style:
|
|
105
|
+
style: {
|
|
106
106
|
display: "flex",
|
|
107
107
|
flexWrap: "wrap",
|
|
108
108
|
alignItems: "flex-end",
|
|
109
|
-
justifyContent: "flex-end",
|
|
110
109
|
columnGap: 6
|
|
111
|
-
}
|
|
110
|
+
},
|
|
112
111
|
children: [
|
|
113
112
|
/* @__PURE__ */ C(
|
|
114
113
|
"div",
|
|
@@ -124,7 +123,8 @@ const _ = (a) => {
|
|
|
124
123
|
display: "flex",
|
|
125
124
|
flexDirection: "row",
|
|
126
125
|
justifyContent: "flex-end",
|
|
127
|
-
flexShrink: 0
|
|
126
|
+
flexShrink: 0,
|
|
127
|
+
marginLeft: "auto"
|
|
128
128
|
},
|
|
129
129
|
children: [
|
|
130
130
|
k?.(a),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bubble.js","sources":["../../../../../src/components/BikGiftedChat/Bubble/Bubble.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\nimport { COLORS } from '../../../constants/Theme';\nimport { useWindowSize } from '../../../hooks/useWindowSize';\nimport { MESSAGE_CHANNELS } from '../GiftedChat/types';\nimport { Constants, isStringifiedArray } from '../GiftedChat/utils';\nimport { IMessage } from '../types';\nimport { BubbleProps, GiftedChatAppType } from './types';\n\nconst BubbleComponent = <TMessage extends IMessage = IMessage>(\n\tprops: BubbleProps<TMessage>,\n): React.ReactElement => {\n\tconst {\n\t\tcurrentMessage,\n\t\tposition,\n\t\trenderMessageText,\n\t\trenderTicks,\n\t\trenderTime,\n\t\trenderCustomView,\n\t\tisCustomViewBottom,\n\t\tisUnsatisfactoryMessageFn,\n\t\tmessagesGroupedByAiTraceId,\n\t\tonPress,\n\t\tcontainerStyle,\n\t\tbubbleStyles,\n\t\tappType = GiftedChatAppType.Bik,\n\t} = props;\n\n\tconst isMobile = useWindowSize();\n\tconst message = currentMessage as any;\n\tconst isManifestApp = appType === GiftedChatAppType.Manifest;\n\n\t// Check if message is a private note\n\tconst isPrivateNote = useMemo(\n\t\t() =>\n\t\t\tmessage.category === Constants.ChatActivity.Category.ACTIVITY &&\n\t\t\tmessage.activityType === Constants.ChatActivity.Type.PRIVATE_NOTE,\n\t\t[message.category, message.activityType],\n\t);\n\n\t// Check if message is a carousel (array of items)\n\tconst isCarouselMessage = useMemo(() => {\n\t\tconst [parsedSuccessfully, parsedMessage] = isStringifiedArray(\n\t\t\tmessage?.message,\n\t\t);\n\t\treturn parsedSuccessfully && parsedMessage && Array.isArray(parsedMessage);\n\t}, [message?.message]);\n\tconst isSmtp =\n\t\tmessage?.channelId === MESSAGE_CHANNELS.SMTP ||\n\t\tmessage?.channelName === MESSAGE_CHANNELS.SMTP;\n\n\t// Generates wrapper styles for the message bubble\n\t// Handles position-based styling, channel-specific layouts, and message states\n\tconst wrapperStyles = useMemo((): React.CSSProperties => {\n\t\tconst baseStyles: React.CSSProperties = {\n\t\t\tborderRadius: 8,\n\t\t\tminHeight: 20,\n\t\t\tmargin: 0,\n\t\t\tflexGrow: isMobile ? 1 : 0,\n\t\t\twidth: '100%',\n\t\t};\n\n\t\t// Check if message is from email channels\n\t\tconst isGmail =\n\t\t\tmessage?.channelId === MESSAGE_CHANNELS.GMAIL ||\n\t\t\tmessage?.channelName === MESSAGE_CHANNELS.GMAIL;\n\n\t\tlet dynamicStyles: React.CSSProperties = {};\n\n\t\tif (isManifestApp) {\n\t\t\tif (position === 'left') {\n\t\t\t\tdynamicStyles =\n\t\t\t\t\tbubbleStyles && typeof bubbleStyles.left === 'object'\n\t\t\t\t\t\t? bubbleStyles.left\n\t\t\t\t\t\t: {};\n\t\t\t} else {\n\t\t\t\tdynamicStyles =\n\t\t\t\t\tbubbleStyles && typeof bubbleStyles.right === 'object'\n\t\t\t\t\t\t? bubbleStyles.right\n\t\t\t\t\t\t: {};\n\t\t\t}\n\t\t\treturn { ...dynamicStyles };\n\t\t} else {\n\t\t\tif (position === 'left') {\n\t\t\t\tdynamicStyles = {\n\t\t\t\t\t...(isMobile || isGmail || isSmtp ? { maxWidth: '100%' } : {}),\n\t\t\t\t\t...(isPrivateNote\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tbackground: COLORS.background.warning.light,\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tbackgroundColor: message?.isPrivateMail\n\t\t\t\t\t\t\t\t\t? COLORS.background.blue.light\n\t\t\t\t\t\t\t\t\t: COLORS.background.warning.light,\n\t\t\t\t\t\t }),\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tconst isUnsatisfactory =\n\t\t\t\t\tisUnsatisfactoryMessageFn &&\n\t\t\t\t\tisUnsatisfactoryMessageFn({\n\t\t\t\t\t\taiTraceId: message.eventProperties?.aiTraceId,\n\t\t\t\t\t\tmessagesGroupedByAiTraceId,\n\t\t\t\t\t});\n\n\t\t\t\tdynamicStyles = {\n\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\tmessage.status === 'failed' || isUnsatisfactory\n\t\t\t\t\t\t\t? COLORS.background.negative.light\n\t\t\t\t\t\t\t: COLORS.background.brandUltraLight,\n\t\t\t\t\t...(isPrivateNote\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tbackground: COLORS.background.warning.light,\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...(!isMobile && isCarouselMessage ? { maxWidth: 500 } : {}),\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tconst extraBubbleStyles: React.CSSProperties =\n\t\t\tbubbleStyles && typeof bubbleStyles === 'object'\n\t\t\t\t? 'left' in bubbleStyles || 'right' in bubbleStyles\n\t\t\t\t\t? position === 'left'\n\t\t\t\t\t\t? (bubbleStyles as { left?: React.CSSProperties }).left ?? {}\n\t\t\t\t\t\t: (bubbleStyles as { right?: React.CSSProperties }).right ?? {}\n\t\t\t\t\t: (bubbleStyles as React.CSSProperties)\n\t\t\t\t: {};\n\n\t\treturn { ...baseStyles, ...dynamicStyles, ...extraBubbleStyles };\n\t}, [\n\t\tmessage?.channelId,\n\t\tmessage?.channelName,\n\t\tmessage?.meta?.aiUsed,\n\t\tmessage?.status,\n\t\tmessage?.eventProperties?.aiTraceId,\n\t\tposition,\n\t\tisMobile,\n\t\tisPrivateNote,\n\t\tisCarouselMessage,\n\t\tisUnsatisfactoryMessageFn,\n\t\tmessagesGroupedByAiTraceId,\n\t\tmessage?.isPrivateMail,\n\t\tbubbleStyles,\n\t\tisManifestApp,\n\t]);\n\n\t// Renders the content of the message bubble\n\t// Handles custom views and message text in the correct order\n\tconst renderContent = useCallback(() => {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{!isCustomViewBottom && renderCustomView?.(props)}\n\n\t\t\t\t{renderMessageText?.(props)}\n\n\t\t\t\t{isCustomViewBottom && renderCustomView?.(props)}\n\t\t\t</div>\n\t\t);\n\t}, [isCustomViewBottom, renderCustomView, renderMessageText, props]);\n\n\tconst manifestContainerStyle = useMemo(() => {\n\t\tif (!isManifestApp || typeof containerStyle !== 'object') return {};\n\t\tif (\n\t\t\tposition === 'left' &&\n\t\t\t'left' in containerStyle &&\n\t\t\tcontainerStyle.left &&\n\t\t\ttypeof containerStyle.left === 'object'\n\t\t) {\n\t\t\treturn containerStyle.left;\n\t\t}\n\t\tif (\n\t\t\tposition === 'right' &&\n\t\t\t'right' in containerStyle &&\n\t\t\tcontainerStyle.right &&\n\t\t\ttypeof containerStyle.right === 'object'\n\t\t) {\n\t\t\treturn containerStyle.right;\n\t\t}\n\t\treturn {};\n\t}, [isManifestApp, containerStyle, position]);\n\n\tconst extraContainerStyle: React.CSSProperties =\n\t\t!isManifestApp && containerStyle && typeof containerStyle === 'object'\n\t\t\t? 'left' in containerStyle || 'right' in containerStyle\n\t\t\t\t? position === 'left'\n\t\t\t\t\t? (containerStyle as { left?: React.CSSProperties }).left ?? {}\n\t\t\t\t\t: (containerStyle as { right?: React.CSSProperties }).right ?? {}\n\t\t\t\t: (containerStyle as React.CSSProperties)\n\t\t\t: {};\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tmarginTop: isManifestApp ? 0 : 6,\n\t\t\t\tmarginBottom: isManifestApp\n\t\t\t\t\t? 0\n\t\t\t\t\t: currentMessage?.['messageInformation']?.reactions?.length > 0\n\t\t\t\t\t? 24\n\t\t\t\t\t: 6,\n\t\t\t\tflexGrow: isMobile ? 1 : 0,\n\t\t\t\t...(isManifestApp\n\t\t\t\t\t? {\n\t\t\t\t\t\t\talignItems: 'flex-end',\n\t\t\t\t\t\t\t...(position === 'right' ? { cursor: 'pointer' } : {}),\n\t\t\t\t\t }\n\t\t\t\t\t: {}),\n\t\t\t\t...manifestContainerStyle,\n\t\t\t\t...extraContainerStyle,\n\t\t\t}}\n\t\t\t{...(isManifestApp ? { onClick: onPress } : {})}\n\t\t>\n\t\t\t<div style={wrapperStyles}>\n\t\t\t\t<div\n\t\t\t\t\t// For sent (right) messages, lay the content and the time/ticks\n\t\t\t\t\t// in a wrapping row so a short message keeps the time beside it\n\t\t\t\t\t// (with a gap) like WhatsApp, while wide/long content pushes the\n\t\t\t\t\t// time onto its own line below.\n\t\t\t\t\tstyle={\n\t\t\t\t\t\tposition === 'right'\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\tflexWrap: 'wrap',\n\t\t\t\t\t\t\t\t\talignItems: 'flex-end',\n\t\t\t\t\t\t\t\t\tjustifyContent: 'flex-end',\n\t\t\t\t\t\t\t\t\tcolumnGap: 6,\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{/* Message content */}\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={\n\t\t\t\t\t\t\tcurrentMessage['chatActivityId'] ||\n\t\t\t\t\t\t\t`message-${currentMessage['psqlId']}`\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderContent()}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{/* Message metadata (time and status) */}\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tflexDirection: 'row',\n\t\t\t\t\t\t\tjustifyContent: 'flex-end',\n\t\t\t\t\t\t\tflexShrink: 0,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderTime?.(props)}\n\t\t\t\t\t\t{renderTicks?.(currentMessage)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\n// Export memoized version for performance\nexport const Bubble = React.memo(BubbleComponent) as typeof BubbleComponent;\n\nexport default Bubble;\n"],"names":["BubbleComponent","props","currentMessage","position","renderMessageText","renderTicks","renderTime","renderCustomView","isCustomViewBottom","isUnsatisfactoryMessageFn","messagesGroupedByAiTraceId","onPress","containerStyle","bubbleStyles","appType","GiftedChatAppType","isMobile","useWindowSize","message","isManifestApp","isPrivateNote","useMemo","Constants","isCarouselMessage","parsedSuccessfully","parsedMessage","isStringifiedArray","isSmtp","MESSAGE_CHANNELS","wrapperStyles","baseStyles","isGmail","dynamicStyles","COLORS","isUnsatisfactory","extraBubbleStyles","renderContent","useCallback","manifestContainerStyle","extraContainerStyle","jsx","jsxs","Bubble","React"],"mappings":";;;;;;;AAQA,MAAMA,IAAkB,CACvBC,MACwB;AACxB,QAAM;AAAA,IACL,gBAAAC;AAAA,IACA,UAA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;AAAA,UAAA,IAEX;AAAA,UAIJ,UAAA;AAAA,YAAA,gBAAAqC;AAAA,cAAC;AAAA,cAAA;AAAA,gBACA,IACCtC,EAAe,kBACf,WAAWA,EAAe,MAAS;AAAA,gBAGnC,UAAAkC,EAAA;AAAA,cAAc;AAAA,YAAA;AAAA,YAIhB,gBAAAK;AAAA,cAAC;AAAA,cAAA;AAAA,gBACA,OAAO;AAAA,kBACN,SAAS;AAAA,kBACT,eAAe;AAAA,kBACf,gBAAgB;AAAA,kBAChB,YAAY;AAAA,gBAAA;AAAA,gBAGZ,UAAA;AAAA,kBAAAnC,IAAaL,CAAK;AAAA,kBAClBI,IAAcH,CAAc;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UAC9B;AAAA,QAAA;AAAA,MAAA,EACD,CACD;AAAA,IAAA;AAAA,EAAA;AAGH,GAGawC,IAASC,EAAM,KAAK3C,CAAe;"}
|
|
1
|
+
{"version":3,"file":"Bubble.js","sources":["../../../../../src/components/BikGiftedChat/Bubble/Bubble.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from 'react';\nimport { COLORS } from '../../../constants/Theme';\nimport { useWindowSize } from '../../../hooks/useWindowSize';\nimport { MESSAGE_CHANNELS } from '../GiftedChat/types';\nimport { Constants, isStringifiedArray } from '../GiftedChat/utils';\nimport { IMessage } from '../types';\nimport { BubbleProps, GiftedChatAppType } from './types';\n\nconst BubbleComponent = <TMessage extends IMessage = IMessage>(\n\tprops: BubbleProps<TMessage>,\n): React.ReactElement => {\n\tconst {\n\t\tcurrentMessage,\n\t\tposition,\n\t\trenderMessageText,\n\t\trenderTicks,\n\t\trenderTime,\n\t\trenderCustomView,\n\t\tisCustomViewBottom,\n\t\tisUnsatisfactoryMessageFn,\n\t\tmessagesGroupedByAiTraceId,\n\t\tonPress,\n\t\tcontainerStyle,\n\t\tbubbleStyles,\n\t\tappType = GiftedChatAppType.Bik,\n\t} = props;\n\n\tconst isMobile = useWindowSize();\n\tconst message = currentMessage as any;\n\tconst isManifestApp = appType === GiftedChatAppType.Manifest;\n\n\t// Check if message is a private note\n\tconst isPrivateNote = useMemo(\n\t\t() =>\n\t\t\tmessage.category === Constants.ChatActivity.Category.ACTIVITY &&\n\t\t\tmessage.activityType === Constants.ChatActivity.Type.PRIVATE_NOTE,\n\t\t[message.category, message.activityType],\n\t);\n\n\t// Check if message is a carousel (array of items)\n\tconst isCarouselMessage = useMemo(() => {\n\t\tconst [parsedSuccessfully, parsedMessage] = isStringifiedArray(\n\t\t\tmessage?.message,\n\t\t);\n\t\treturn parsedSuccessfully && parsedMessage && Array.isArray(parsedMessage);\n\t}, [message?.message]);\n\tconst isSmtp =\n\t\tmessage?.channelId === MESSAGE_CHANNELS.SMTP ||\n\t\tmessage?.channelName === MESSAGE_CHANNELS.SMTP;\n\n\t// Generates wrapper styles for the message bubble\n\t// Handles position-based styling, channel-specific layouts, and message states\n\tconst wrapperStyles = useMemo((): React.CSSProperties => {\n\t\tconst baseStyles: React.CSSProperties = {\n\t\t\tborderRadius: 8,\n\t\t\tminHeight: 20,\n\t\t\tmargin: 0,\n\t\t\tflexGrow: isMobile ? 1 : 0,\n\t\t\twidth: '100%',\n\t\t};\n\n\t\t// Check if message is from email channels\n\t\tconst isGmail =\n\t\t\tmessage?.channelId === MESSAGE_CHANNELS.GMAIL ||\n\t\t\tmessage?.channelName === MESSAGE_CHANNELS.GMAIL;\n\n\t\tlet dynamicStyles: React.CSSProperties = {};\n\n\t\tif (isManifestApp) {\n\t\t\tif (position === 'left') {\n\t\t\t\tdynamicStyles =\n\t\t\t\t\tbubbleStyles && typeof bubbleStyles.left === 'object'\n\t\t\t\t\t\t? bubbleStyles.left\n\t\t\t\t\t\t: {};\n\t\t\t} else {\n\t\t\t\tdynamicStyles =\n\t\t\t\t\tbubbleStyles && typeof bubbleStyles.right === 'object'\n\t\t\t\t\t\t? bubbleStyles.right\n\t\t\t\t\t\t: {};\n\t\t\t}\n\t\t\treturn { ...dynamicStyles };\n\t\t} else {\n\t\t\tif (position === 'left') {\n\t\t\t\tdynamicStyles = {\n\t\t\t\t\t...(isMobile || isGmail || isSmtp ? { maxWidth: '100%' } : {}),\n\t\t\t\t\t...(isPrivateNote\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tbackground: COLORS.background.warning.light,\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tbackgroundColor: message?.isPrivateMail\n\t\t\t\t\t\t\t\t\t? COLORS.background.blue.light\n\t\t\t\t\t\t\t\t\t: COLORS.background.warning.light,\n\t\t\t\t\t\t }),\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tconst isUnsatisfactory =\n\t\t\t\t\tisUnsatisfactoryMessageFn &&\n\t\t\t\t\tisUnsatisfactoryMessageFn({\n\t\t\t\t\t\taiTraceId: message.eventProperties?.aiTraceId,\n\t\t\t\t\t\tmessagesGroupedByAiTraceId,\n\t\t\t\t\t});\n\n\t\t\t\tdynamicStyles = {\n\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\tmessage.status === 'failed' || isUnsatisfactory\n\t\t\t\t\t\t\t? COLORS.background.negative.light\n\t\t\t\t\t\t\t: COLORS.background.brandUltraLight,\n\t\t\t\t\t...(isPrivateNote\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tbackground: COLORS.background.warning.light,\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: {}),\n\t\t\t\t\t...(!isMobile && isCarouselMessage ? { maxWidth: 500 } : {}),\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tconst extraBubbleStyles: React.CSSProperties =\n\t\t\tbubbleStyles && typeof bubbleStyles === 'object'\n\t\t\t\t? 'left' in bubbleStyles || 'right' in bubbleStyles\n\t\t\t\t\t? position === 'left'\n\t\t\t\t\t\t? (bubbleStyles as { left?: React.CSSProperties }).left ?? {}\n\t\t\t\t\t\t: (bubbleStyles as { right?: React.CSSProperties }).right ?? {}\n\t\t\t\t\t: (bubbleStyles as React.CSSProperties)\n\t\t\t\t: {};\n\n\t\treturn { ...baseStyles, ...dynamicStyles, ...extraBubbleStyles };\n\t}, [\n\t\tmessage?.channelId,\n\t\tmessage?.channelName,\n\t\tmessage?.meta?.aiUsed,\n\t\tmessage?.status,\n\t\tmessage?.eventProperties?.aiTraceId,\n\t\tposition,\n\t\tisMobile,\n\t\tisPrivateNote,\n\t\tisCarouselMessage,\n\t\tisUnsatisfactoryMessageFn,\n\t\tmessagesGroupedByAiTraceId,\n\t\tmessage?.isPrivateMail,\n\t\tbubbleStyles,\n\t\tisManifestApp,\n\t]);\n\n\t// Renders the content of the message bubble\n\t// Handles custom views and message text in the correct order\n\tconst renderContent = useCallback(() => {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t{!isCustomViewBottom && renderCustomView?.(props)}\n\n\t\t\t\t{renderMessageText?.(props)}\n\n\t\t\t\t{isCustomViewBottom && renderCustomView?.(props)}\n\t\t\t</div>\n\t\t);\n\t}, [isCustomViewBottom, renderCustomView, renderMessageText, props]);\n\n\tconst manifestContainerStyle = useMemo(() => {\n\t\tif (!isManifestApp || typeof containerStyle !== 'object') return {};\n\t\tif (\n\t\t\tposition === 'left' &&\n\t\t\t'left' in containerStyle &&\n\t\t\tcontainerStyle.left &&\n\t\t\ttypeof containerStyle.left === 'object'\n\t\t) {\n\t\t\treturn containerStyle.left;\n\t\t}\n\t\tif (\n\t\t\tposition === 'right' &&\n\t\t\t'right' in containerStyle &&\n\t\t\tcontainerStyle.right &&\n\t\t\ttypeof containerStyle.right === 'object'\n\t\t) {\n\t\t\treturn containerStyle.right;\n\t\t}\n\t\treturn {};\n\t}, [isManifestApp, containerStyle, position]);\n\n\tconst extraContainerStyle: React.CSSProperties =\n\t\t!isManifestApp && containerStyle && typeof containerStyle === 'object'\n\t\t\t? 'left' in containerStyle || 'right' in containerStyle\n\t\t\t\t? position === 'left'\n\t\t\t\t\t? (containerStyle as { left?: React.CSSProperties }).left ?? {}\n\t\t\t\t\t: (containerStyle as { right?: React.CSSProperties }).right ?? {}\n\t\t\t\t: (containerStyle as React.CSSProperties)\n\t\t\t: {};\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tmarginTop: isManifestApp ? 0 : 6,\n\t\t\t\tmarginBottom: isManifestApp\n\t\t\t\t\t? 0\n\t\t\t\t\t: currentMessage?.['messageInformation']?.reactions?.length > 0\n\t\t\t\t\t? 24\n\t\t\t\t\t: 6,\n\t\t\t\tflexGrow: isMobile ? 1 : 0,\n\t\t\t\t...(isManifestApp\n\t\t\t\t\t? {\n\t\t\t\t\t\t\talignItems: 'flex-end',\n\t\t\t\t\t\t\t...(position === 'right' ? { cursor: 'pointer' } : {}),\n\t\t\t\t\t }\n\t\t\t\t\t: {}),\n\t\t\t\t...manifestContainerStyle,\n\t\t\t\t...extraContainerStyle,\n\t\t\t}}\n\t\t\t{...(isManifestApp ? { onClick: onPress } : {})}\n\t\t>\n\t\t\t<div style={wrapperStyles}>\n\t\t\t\t<div\n\t\t\t\t\t// Lay the content and the time/ticks in a wrapping row so a short\n\t\t\t\t\t// message keeps the time beside it (with a gap) like WhatsApp, while\n\t\t\t\t\t// wide/long content pushes the time onto its own line below. The\n\t\t\t\t\t// time's `margin-left: auto` keeps it right-aligned on either side.\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\tflexWrap: 'wrap',\n\t\t\t\t\t\talignItems: 'flex-end',\n\t\t\t\t\t\tcolumnGap: 6,\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t{/* Message content */}\n\t\t\t\t\t<div\n\t\t\t\t\t\tid={\n\t\t\t\t\t\t\tcurrentMessage['chatActivityId'] ||\n\t\t\t\t\t\t\t`message-${currentMessage['psqlId']}`\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderContent()}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{/* Message metadata (time and status) */}\n\t\t\t\t\t<div\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tflexDirection: 'row',\n\t\t\t\t\t\t\tjustifyContent: 'flex-end',\n\t\t\t\t\t\t\tflexShrink: 0,\n\t\t\t\t\t\t\tmarginLeft: 'auto',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t{renderTime?.(props)}\n\t\t\t\t\t\t{renderTicks?.(currentMessage)}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\n// Export memoized version for performance\nexport const Bubble = React.memo(BubbleComponent) as typeof BubbleComponent;\n\nexport default Bubble;\n"],"names":["BubbleComponent","props","currentMessage","position","renderMessageText","renderTicks","renderTime","renderCustomView","isCustomViewBottom","isUnsatisfactoryMessageFn","messagesGroupedByAiTraceId","onPress","containerStyle","bubbleStyles","appType","GiftedChatAppType","isMobile","useWindowSize","message","isManifestApp","isPrivateNote","useMemo","Constants","isCarouselMessage","parsedSuccessfully","parsedMessage","isStringifiedArray","isSmtp","MESSAGE_CHANNELS","wrapperStyles","baseStyles","isGmail","dynamicStyles","COLORS","isUnsatisfactory","extraBubbleStyles","renderContent","useCallback","manifestContainerStyle","extraContainerStyle","jsx","jsxs","Bubble","React"],"mappings":";;;;;;;AAQA,MAAMA,IAAkB,CACvBC,MACwB;AACxB,QAAM;AAAA,IACL,gBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,4BAAAC;AAAA,IACA,SAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,SAAAC,IAAUC,EAAkB;AAAA,EAAA,IACzBd,GAEEe,IAAWC,EAAA,GACXC,IAAUhB,GACViB,IAAgBL,MAAYC,EAAkB,UAG9CK,IAAgBC;AAAA,IAC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