@bikdotai/bik-component-library 0.0.805-beta.13 → 0.0.805-beta.14
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("react/jsx-runtime"),i=require("react"),t=require("../../../constants/Theme.js"),n=require("../../../hooks/useWindowSize.js"),s=require("../GiftedChat/types.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),t=require("../../../constants/Theme.js"),n=require("../../../hooks/useWindowSize.js"),s=require("../GiftedChat/types.js"),l=require("../GiftedChat/utils.js"),r=require("./types.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const a=o=>{var a,d,u,c;const{currentMessage:g,position:v,renderMessageText:f,renderTicks:b,renderTime:h,renderCustomView:y,isCustomViewBottom:j,isUnsatisfactoryMessageFn:p,messagesGroupedByAiTraceId:m,onPress:O,containerStyle:C,bubbleStyles:S,appType:A=r.GiftedChatAppType.Bik}=o,T=n.useWindowSize(),x=g,M=A===r.GiftedChatAppType.Manifest,I=i.useMemo((()=>x.category===l.Constants.ChatActivity.Category.ACTIVITY&&x.activityType===l.Constants.ChatActivity.Type.PRIVATE_NOTE),[x.category,x.activityType]),k=i.useMemo((()=>{const[e,i]=l.isStringifiedArray(null==x?void 0:x.message);return e&&i&&Array.isArray(i)}),[null==x?void 0:x.message]),E=i.useMemo((()=>{var e,i,n,l,r;const o={borderRadius:8,minHeight:20,margin:0,flexGrow:T?1:0},a=(null==x?void 0:x.channelId)===s.MESSAGE_CHANNELS.GMAIL||(null==x?void 0:x.channelName)===s.MESSAGE_CHANNELS.GMAIL,d=(null==x?void 0:x.channelId)===s.MESSAGE_CHANNELS.SMTP||(null==x?void 0:x.channelName)===s.MESSAGE_CHANNELS.SMTP;let u={};if(M)return u="left"===v?S&&"object"==typeof S.left?S.left:{}:S&&"object"==typeof S.right?S.right:{},Object.assign({},u);if("left"===v)u=Object.assign(Object.assign({},T||a||d?{maxWidth:"100%"}:{}),I?{background:(null===(e=null==x?void 0:x.meta)||void 0===e?void 0:e.aiUsed)?"linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)":t.COLORS.background.warning.light}:{backgroundColor:(null==x?void 0:x.isPrivateMail)?t.COLORS.background.blue.light:t.COLORS.surface.hovered});else{const e=p&&p({aiTraceId:null===(i=x.eventProperties)||void 0===i?void 0:i.aiTraceId,messagesGroupedByAiTraceId:m});u=Object.assign(Object.assign({backgroundColor:"failed"===x.status||e?t.COLORS.background.negative.light:t.COLORS.background.brandVeryLight},I?{background:(null===(n=null==x?void 0:x.meta)||void 0===n?void 0:n.aiUsed)?"linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)":t.COLORS.background.warning.light}:{}),!T&&k?{maxWidth:500}:{})}const c=S&&"object"==typeof S?"left"in S||"right"in S?"left"===v?null!==(l=S.left)&&void 0!==l?l:{}:null!==(r=S.right)&&void 0!==r?r:{}:S:{};return Object.assign(Object.assign(Object.assign({},o),u),c)}),[null==x?void 0:x.channelId,null==x?void 0:x.channelName,null===(a=null==x?void 0:x.meta)||void 0===a?void 0:a.aiUsed,null==x?void 0:x.status,null===(d=null==x?void 0:x.eventProperties)||void 0===d?void 0:d.aiTraceId,v,T,I,k,p,m,null==x?void 0:x.isPrivateMail,S,M]),G=i.useCallback((()=>e.jsxs("div",{children:[!j&&(null==y?void 0:y(o)),null==f?void 0:f(o),j&&(null==y?void 0:y(o))]})),[j,y,f,o]),L=i.useMemo((()=>M&&"object"==typeof C?"left"===v&&"left"in C&&C.left&&"object"==typeof C.left?C.left:"right"===v&&"right"in C&&C.right&&"object"==typeof C.right?C.right:{}:{}),[M,C,v]);return e.jsx("div",Object.assign({style:Object.assign(Object.assign({display:"flex",marginTop:M?0:6,marginBottom:M?0:(null===(c=null===(u=null==g?void 0:g.messageInformation)||void 0===u?void 0:u.reactions)||void 0===c?void 0:c.length)>0?24:6,flexGrow:T?1:0},M?Object.assign({alignItems:"flex-end"},"right"===v?{cursor:"pointer"}:{}):{}),L)},M?{onClick:O}:{},{children:e.jsx("div",Object.assign({style:E},{children:e.jsxs("div",{children:[e.jsx("div",Object.assign({id:g.chatActivityId||`message-${g.psqlId}`},{children:G()})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",marginLeft:"32px"}},{children:[null==h?void 0:h(o),null==b?void 0:b(g)]}))]})}))}))},d=o(i).default.memo(a);exports.Bubble=d,exports.default=d;
|
|
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\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};\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\t\tconst isSmtp =\n\t\t\tmessage?.channelId === MESSAGE_CHANNELS.SMTP ||\n\t\t\tmessage?.channelName === MESSAGE_CHANNELS.SMTP;\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: message?.meta?.aiUsed\n\t\t\t\t\t\t\t\t\t? 'linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)'\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\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.surface.hovered,\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.brandVeryLight,\n\t\t\t\t\t...(isPrivateNote\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tbackground: message?.meta?.aiUsed\n\t\t\t\t\t\t\t\t\t? 'linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)'\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\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\treturn { ...baseStyles, ...dynamicStyles };\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\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}}\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{/* 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\tmarginLeft: '32px',\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","Bik","isMobile","useWindowSize","message","isManifestApp","Manifest","isPrivateNote","useMemo","category","Constants","ChatActivity","Category","ACTIVITY","activityType","Type","PRIVATE_NOTE","isCarouselMessage","parsedSuccessfully","parsedMessage","isStringifiedArray","Array","isArray","wrapperStyles","baseStyles","borderRadius","minHeight","margin","flexGrow","isGmail","channelId","MESSAGE_CHANNELS","GMAIL","channelName","isSmtp","SMTP","dynamicStyles","left","right","Object","assign","maxWidth","background","_a","meta","aiUsed","COLORS","warning","light","backgroundColor","isPrivateMail","blue","surface","hovered","isUnsatisfactory","aiTraceId","_b","eventProperties","status","negative","brandVeryLight","_c","renderContent","useCallback","_jsxs","children","manifestContainerStyle","_jsx","style","display","marginTop","marginBottom","_d","reactions","length","alignItems","cursor","onClick","jsx","jsxs","id","flexDirection","justifyContent","marginLeft","Bubble","React","memo"],"mappings":"wXAQA,MAAMA,EACLC,gBAEA,MAAMC,eACLA,EAAcC,SACdA,EAAQC,kBACRA,EAAiBC,YACjBA,EAAWC,WACXA,EAAUC,iBACVA,EAAgBC,mBAChBA,EAAkBC,0BAClBA,EAAyBC,2BACzBA,EAA0BC,QAC1BA,EAAOC,eACPA,EAAcC,aACdA,EAAYC,QACZA,EAAUC,EAAiBA,kBAACC,KACzBf,EAEEgB,EAAWC,EAAAA,gBACXC,EAAUjB,EACVkB,EAAgBN,IAAYC,EAAiBA,kBAACM,SAG9CC,EAAgBC,WACrB,IACCJ,EAAQK,WAAaC,EAAAA,UAAUC,aAAaC,SAASC,UACrDT,EAAQU,eAAiBJ,YAAUC,aAAaI,KAAKC,cACtD,CAACZ,EAAQK,SAAUL,EAAQU,eAItBG,EAAoBT,EAAAA,SAAQ,KACjC,MAAOU,EAAoBC,GAAiBC,EAAAA,mBAC3ChB,aAAA,EAAAA,EAASA,SAEV,OAAOc,GAAsBC,GAAiBE,MAAMC,QAAQH,EAAc,GACxE,CAACf,aAAA,EAAAA,EAASA,UAGPmB,EAAgBf,EAAAA,SAAQ,eAC7B,MAAMgB,EAAkC,CACvCC,aAAc,EACdC,UAAW,GACXC,OAAQ,EACRC,SAAU1B,EAAW,EAAI,GAIpB2B,GACLzB,aAAA,EAAAA,EAAS0B,aAAcC,EAAgBA,iBAACC,QACxC5B,aAAA,EAAAA,EAAS6B,eAAgBF,EAAgBA,iBAACC,MACrCE,GACL9B,aAAA,EAAAA,EAAS0B,aAAcC,EAAgBA,iBAACI,OACxC/B,aAAA,EAAAA,EAAS6B,eAAgBF,EAAgBA,iBAACI,KAE3C,IAAIC,EAAqC,CAAA,EAEzC,GAAI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,CAAA8E,SAGrCH,OAIFE,EACCe,KAAA,MAAAxC,OAAAC,OAAA,CAAA4B,MAAO,CACNC,QAAS,OACTY,cAAe,MACfC,eAAgB,WAChBC,WAAY,SAGZ,CAAAlB,SAAA,CAAA1E,aAAU,EAAVA,EAAaL,GACbI,aAAA,EAAAA,EAAcH,eAIb,EAKKiG,OAASC,QAAMC,KAAKrG"}
|
|
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\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};\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\t\tconst isSmtp =\n\t\t\tmessage?.channelId === MESSAGE_CHANNELS.SMTP ||\n\t\t\tmessage?.channelName === MESSAGE_CHANNELS.SMTP;\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: message?.meta?.aiUsed\n\t\t\t\t\t\t\t\t\t? 'linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)'\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\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.surface.hovered,\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.brandVeryLight,\n\t\t\t\t\t...(isPrivateNote\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tbackground: message?.meta?.aiUsed\n\t\t\t\t\t\t\t\t\t? 'linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)'\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\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\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}}\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{/* 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\tmarginLeft: '32px',\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","Bik","isMobile","useWindowSize","message","isManifestApp","Manifest","isPrivateNote","useMemo","category","Constants","ChatActivity","Category","ACTIVITY","activityType","Type","PRIVATE_NOTE","isCarouselMessage","parsedSuccessfully","parsedMessage","isStringifiedArray","Array","isArray","wrapperStyles","baseStyles","borderRadius","minHeight","margin","flexGrow","isGmail","channelId","MESSAGE_CHANNELS","GMAIL","channelName","isSmtp","SMTP","dynamicStyles","left","right","Object","assign","maxWidth","background","_a","meta","aiUsed","COLORS","warning","light","backgroundColor","isPrivateMail","blue","surface","hovered","isUnsatisfactory","aiTraceId","_b","eventProperties","status","negative","brandVeryLight","_c","extraBubbleStyles","_d","_e","renderContent","useCallback","_jsxs","children","manifestContainerStyle","_jsx","style","display","marginTop","marginBottom","reactions","length","alignItems","cursor","onClick","jsx","jsxs","id","flexDirection","justifyContent","marginLeft","Bubble","React","memo"],"mappings":"wXAQA,MAAMA,EACLC,gBAEA,MAAMC,eACLA,EAAcC,SACdA,EAAQC,kBACRA,EAAiBC,YACjBA,EAAWC,WACXA,EAAUC,iBACVA,EAAgBC,mBAChBA,EAAkBC,0BAClBA,EAAyBC,2BACzBA,EAA0BC,QAC1BA,EAAOC,eACPA,EAAcC,aACdA,EAAYC,QACZA,EAAUC,EAAiBA,kBAACC,KACzBf,EAEEgB,EAAWC,EAAAA,gBACXC,EAAUjB,EACVkB,EAAgBN,IAAYC,EAAiBA,kBAACM,SAG9CC,EAAgBC,WACrB,IACCJ,EAAQK,WAAaC,EAAAA,UAAUC,aAAaC,SAASC,UACrDT,EAAQU,eAAiBJ,YAAUC,aAAaI,KAAKC,cACtD,CAACZ,EAAQK,SAAUL,EAAQU,eAItBG,EAAoBT,EAAAA,SAAQ,KACjC,MAAOU,EAAoBC,GAAiBC,EAAAA,mBAC3ChB,aAAA,EAAAA,EAASA,SAEV,OAAOc,GAAsBC,GAAiBE,MAAMC,QAAQH,EAAc,GACxE,CAACf,aAAA,EAAAA,EAASA,UAGPmB,EAAgBf,EAAAA,SAAQ,mBAC7B,MAAMgB,EAAkC,CACvCC,aAAc,EACdC,UAAW,GACXC,OAAQ,EACRC,SAAU1B,EAAW,EAAI,GAIpB2B,GACLzB,aAAA,EAAAA,EAAS0B,aAAcC,EAAgBA,iBAACC,QACxC5B,aAAA,EAAAA,EAAS6B,eAAgBF,EAAgBA,iBAACC,MACrCE,G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Aa,QAAS,EAC5D,GACA,EACHhD,SAAU1B,EAAW,EAAI,GACrBG,EACFkC,OAAAC,OAAA,CACCqC,WAAY,YACK,UAAbzF,EAAuB,CAAE0F,OAAQ,WAAc,IAEnD,IACAT,IAEChE,EAAgB,CAAE0E,QAASnF,GAAY,GAAG,CAAAwE,SAE/CE,EAAKU,IAAA,MAAAzC,OAAAC,OAAA,CAAA+B,MAAOhD,GACX,CAAA6C,SAAAD,EAAAc,KAAA,MAAA,CAAAb,SAAA,CAECE,EACCU,IAAA,MAAAzC,OAAAC,OAAA,CAAA0C,GACC/F,EAA+B,gBAC/B,WAAWA,EAAuB,UAAG,CAAAiF,SAGrCH,OAIFE,EACCc,KAAA,MAAA1C,OAAAC,OAAA,CAAA+B,MAAO,CACNC,QAAS,OACTW,cAAe,MACfC,eAAgB,WAChBC,WAAY,SAGZ,CAAAjB,SAAA,CAAA7E,aAAU,EAAVA,EAAaL,GACbI,aAAA,EAAAA,EAAcH,eAIb,EAKKmG,OAASC,QAAMC,KAAKvG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,jsx as i}from"react/jsx-runtime";import t,{useMemo as n,useCallback as o}from"react";import{COLORS as l}from"../../../constants/Theme.js";import{useWindowSize as r}from"../../../hooks/useWindowSize.js";import{MESSAGE_CHANNELS as a}from"../GiftedChat/types.js";import{Constants as s,isStringifiedArray as d}from"../GiftedChat/utils.js";import{GiftedChatAppType as c}from"./types.js";const g=t=>{var g,u,v,f;const{currentMessage:m,position:h,renderMessageText:b,renderTicks:y,renderTime:p,renderCustomView:j,isCustomViewBottom:T,isUnsatisfactoryMessageFn:I,messagesGroupedByAiTraceId:O,onPress:k,containerStyle:x,bubbleStyles:C,appType:A=c.Bik}=t,M=r(),w=m,G=A===c.Manifest,P=n((()=>w.category===s.ChatActivity.Category.ACTIVITY&&w.activityType===s.ChatActivity.Type.PRIVATE_NOTE),[w.category,w.activityType]),B=n((()=>{const[e,i]=d(null==w?void 0:w.message);return e&&i&&Array.isArray(i)}),[null==w?void 0:w.message]),S=n((()=>{var e,i,t;const
|
|
1
|
+
import{jsxs as e,jsx as i}from"react/jsx-runtime";import t,{useMemo as n,useCallback as o}from"react";import{COLORS as l}from"../../../constants/Theme.js";import{useWindowSize as r}from"../../../hooks/useWindowSize.js";import{MESSAGE_CHANNELS as a}from"../GiftedChat/types.js";import{Constants as s,isStringifiedArray as d}from"../GiftedChat/utils.js";import{GiftedChatAppType as c}from"./types.js";const g=t=>{var g,u,v,f;const{currentMessage:m,position:h,renderMessageText:b,renderTicks:y,renderTime:p,renderCustomView:j,isCustomViewBottom:T,isUnsatisfactoryMessageFn:I,messagesGroupedByAiTraceId:O,onPress:k,containerStyle:x,bubbleStyles:C,appType:A=c.Bik}=t,M=r(),w=m,G=A===c.Manifest,P=n((()=>w.category===s.ChatActivity.Category.ACTIVITY&&w.activityType===s.ChatActivity.Type.PRIVATE_NOTE),[w.category,w.activityType]),B=n((()=>{const[e,i]=d(null==w?void 0:w.message);return e&&i&&Array.isArray(i)}),[null==w?void 0:w.message]),S=n((()=>{var e,i,t,n,o;const r={borderRadius:8,minHeight:20,margin:0,flexGrow:M?1:0},s=(null==w?void 0:w.channelId)===a.GMAIL||(null==w?void 0:w.channelName)===a.GMAIL,d=(null==w?void 0:w.channelId)===a.SMTP||(null==w?void 0:w.channelName)===a.SMTP;let c={};if(G)return c="left"===h?C&&"object"==typeof C.left?C.left:{}:C&&"object"==typeof C.right?C.right:{},Object.assign({},c);if("left"===h)c=Object.assign(Object.assign({},M||s||d?{maxWidth:"100%"}:{}),P?{background:(null===(e=null==w?void 0:w.meta)||void 0===e?void 0:e.aiUsed)?"linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)":l.background.warning.light}:{backgroundColor:(null==w?void 0:w.isPrivateMail)?l.background.blue.light:l.surface.hovered});else{const e=I&&I({aiTraceId:null===(i=w.eventProperties)||void 0===i?void 0:i.aiTraceId,messagesGroupedByAiTraceId:O});c=Object.assign(Object.assign({backgroundColor:"failed"===w.status||e?l.background.negative.light:l.background.brandVeryLight},P?{background:(null===(t=null==w?void 0:w.meta)||void 0===t?void 0:t.aiUsed)?"linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)":l.background.warning.light}:{}),!M&&B?{maxWidth:500}:{})}const g=C&&"object"==typeof C?"left"in C||"right"in C?"left"===h?null!==(n=C.left)&&void 0!==n?n:{}:null!==(o=C.right)&&void 0!==o?o:{}:C:{};return Object.assign(Object.assign(Object.assign({},r),c),g)}),[null==w?void 0:w.channelId,null==w?void 0:w.channelName,null===(g=null==w?void 0:w.meta)||void 0===g?void 0:g.aiUsed,null==w?void 0:w.status,null===(u=null==w?void 0:w.eventProperties)||void 0===u?void 0:u.aiTraceId,h,M,P,B,I,O,null==w?void 0:w.isPrivateMail,C,G]),V=o((()=>e("div",{children:[!T&&(null==j?void 0:j(t)),null==b?void 0:b(t),T&&(null==j?void 0:j(t))]})),[T,j,b,t]),L=n((()=>G&&"object"==typeof x?"left"===h&&"left"in x&&x.left&&"object"==typeof x.left?x.left:"right"===h&&"right"in x&&x.right&&"object"==typeof x.right?x.right:{}:{}),[G,x,h]);return i("div",Object.assign({style:Object.assign(Object.assign({display:"flex",marginTop:G?0:6,marginBottom:G?0:(null===(f=null===(v=null==m?void 0:m.messageInformation)||void 0===v?void 0:v.reactions)||void 0===f?void 0:f.length)>0?24:6,flexGrow:M?1:0},G?Object.assign({alignItems:"flex-end"},"right"===h?{cursor:"pointer"}:{}):{}),L)},G?{onClick:k}:{},{children:i("div",Object.assign({style:S},{children:e("div",{children:[i("div",Object.assign({id:m.chatActivityId||`message-${m.psqlId}`},{children:V()})),e("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"flex-end",marginLeft:"32px"}},{children:[null==p?void 0:p(t),null==y?void 0:y(m)]}))]})}))}))},u=t.memo(g);export{u as Bubble,u as default};
|
|
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\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};\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\t\tconst isSmtp =\n\t\t\tmessage?.channelId === MESSAGE_CHANNELS.SMTP ||\n\t\t\tmessage?.channelName === MESSAGE_CHANNELS.SMTP;\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: message?.meta?.aiUsed\n\t\t\t\t\t\t\t\t\t? 'linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)'\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\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.surface.hovered,\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.brandVeryLight,\n\t\t\t\t\t...(isPrivateNote\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tbackground: message?.meta?.aiUsed\n\t\t\t\t\t\t\t\t\t? 'linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)'\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\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\treturn { ...baseStyles, ...dynamicStyles };\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\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}}\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{/* 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\tmarginLeft: '32px',\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","Bik","isMobile","useWindowSize","message","isManifestApp","Manifest","isPrivateNote","useMemo","category","Constants","ChatActivity","Category","ACTIVITY","activityType","Type","PRIVATE_NOTE","isCarouselMessage","parsedSuccessfully","parsedMessage","isStringifiedArray","Array","isArray","wrapperStyles","baseStyles","borderRadius","minHeight","margin","flexGrow","isGmail","channelId","MESSAGE_CHANNELS","GMAIL","channelName","isSmtp","SMTP","dynamicStyles","left","right","Object","assign","maxWidth","background","_a","meta","aiUsed","COLORS","warning","light","backgroundColor","isPrivateMail","blue","surface","hovered","isUnsatisfactory","aiTraceId","_b","eventProperties","status","negative","brandVeryLight","_c","renderContent","useCallback","_jsxs","children","manifestContainerStyle","_jsx","style","display","marginTop","marginBottom","_d","reactions","length","alignItems","cursor","onClick","id","flexDirection","justifyContent","marginLeft","Bubble","React","memo"],"mappings":"+YAQA,MAAMA,EACLC,gBAEA,MAAMC,eACLA,EAAcC,SACdA,EAAQC,kBACRA,EAAiBC,YACjBA,EAAWC,WACXA,EAAUC,iBACVA,EAAgBC,mBAChBA,EAAkBC,0BAClBA,EAAyBC,2BACzBA,EAA0BC,QAC1BA,EAAOC,eACPA,EAAcC,aACdA,EAAYC,QACZA,EAAUC,EAAkBC,KACzBf,EAEEgB,EAAWC,IACXC,EA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E,uBACCC,MAAK7B,OAAAC,OAAAD,OAAAC,OAAA,CACJ6B,QAAS,OACTC,UAAWjE,EAAgB,EAAI,EAC/BkE,aAAclE,EACX,GACmD,QAAnDmE,EAAsC,QAAtCX,EAAA1E,aAAc,EAAdA,EAAqC,0BAAC,IAAA0E,OAAA,EAAAA,EAAEY,iBAAW,IAAAD,OAAA,EAAAA,EAAAE,QAAS,EAC5D,GACA,EACH9C,SAAU1B,EAAW,EAAI,GACrBG,EACFkC,OAAAC,OAAA,CACCmC,WAAY,YACK,UAAbvF,EAAuB,CAAEwF,OAAQ,WAAc,IAEnD,IACAV,IAEC7D,EAAgB,CAAEwE,QAASjF,GAAY,GAAG,CAAAqE,SAE/CE,EAAK,MAAA5B,OAAAC,OAAA,CAAA4B,MAAO7C,GACX,CAAA0C,SAAAD,EAAA,MAAA,CAAAC,SAAA,CAECE,EACC,MAAA5B,OAAAC,OAAA,CAAAsC,GACC3F,EAA+B,gBAC/B,WAAWA,EAAuB,UAAG,CAAA8E,SAGrCH,OAIFE,EACC,MAAAzB,OAAAC,OAAA,CAAA4B,MAAO,CACNC,QAAS,OACTU,cAAe,MACfC,eAAgB,WAChBC,WAAY,SAGZ,CAAAhB,SAAA,CAAA1E,aAAU,EAAVA,EAAaL,GACbI,aAAA,EAAAA,EAAcH,eAIb,EAKK+F,EAASC,EAAMC,KAAKnG"}
|
|
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\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};\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\t\tconst isSmtp =\n\t\t\tmessage?.channelId === MESSAGE_CHANNELS.SMTP ||\n\t\t\tmessage?.channelName === MESSAGE_CHANNELS.SMTP;\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: message?.meta?.aiUsed\n\t\t\t\t\t\t\t\t\t? 'linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)'\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\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.surface.hovered,\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.brandVeryLight,\n\t\t\t\t\t...(isPrivateNote\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tbackground: message?.meta?.aiUsed\n\t\t\t\t\t\t\t\t\t? 'linear-gradient(90deg, #ffe6ee 0%, #fff0e7 100%)'\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\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\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}}\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{/* 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\tmarginLeft: '32px',\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","Bik","isMobile","useWindowSize","message","isManifestApp","Manifest","isPrivateNote","useMemo","category","Constants","ChatActivity","Category","ACTIVITY","activityType","Type","PRIVATE_NOTE","isCarouselMessage","parsedSuccessfully","parsedMessage","isStringifiedArray","Array","isArray","wrapperStyles","baseStyles","borderRadius","minHeight","margin","flexGrow","isGmail","channelId","MESSAGE_CHANNELS","GMAIL","channelName","isSmtp","SMTP","dynamicStyles","left","right","Object","assign","maxWidth","background","_a","meta","aiUsed","COLORS","warning","light","backgroundColor","isPrivateMail","blue","surface","hovered","isUnsatisfactory","aiTraceId","_b","eventProperties","status","negative","brandVeryLight","_c","extraBubbleStyles","_d","_e","renderContent","useCallback","_jsxs","children","manifestContainerStyle","_jsx","style","display","marginTop","marginBottom","reactions","length","alignItems","cursor","onClick","id","flexDirection","justifyContent","marginLeft","Bubble","React","memo"],"mappings":"+YAQA,MAAMA,EACLC,gBAEA,MAAMC,eACLA,EAAcC,SACdA,EAAQC,kBACRA,EAAiBC,YACjBA,EAAWC,WACXA,EAAUC,iBACVA,EAAgBC,mBAChBA,EAAkBC,0BAClBA,EAAyBC,2BACzBA,EAA0BC,QAC1BA,EAAOC,eACPA,EAAcC,aACdA,EAAYC,QACZA,EAAUC,EAAkBC,KACzBf,EAEEgB,EAAWC,IACXC,EAAUjB,EACVkB,EAAgBN,IAAYC,EAAkBM,S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