@webority/mobile-chat 0.135.0 → 0.136.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/lib/commonjs/AgentByline.js +1 -1
  2. package/lib/commonjs/ChatComposer.js +1 -1
  3. package/lib/commonjs/ChatFrame.js +1 -1
  4. package/lib/commonjs/ChatLauncher.js +1 -1
  5. package/lib/commonjs/ChatSheet.js +1 -1
  6. package/lib/commonjs/ChatStarters.js +1 -1
  7. package/lib/commonjs/ChatThread.js +1 -1
  8. package/lib/commonjs/renderers/QuickRepliesPart.js +1 -1
  9. package/lib/commonjs/renderers/chipLook.js +1 -0
  10. package/lib/module/AgentByline.js +1 -1
  11. package/lib/module/ChatComposer.js +1 -1
  12. package/lib/module/ChatFrame.js +1 -1
  13. package/lib/module/ChatLauncher.js +1 -1
  14. package/lib/module/ChatSheet.js +1 -1
  15. package/lib/module/ChatStarters.js +1 -1
  16. package/lib/module/ChatThread.js +1 -1
  17. package/lib/module/renderers/QuickRepliesPart.js +1 -1
  18. package/lib/module/renderers/chipLook.js +1 -0
  19. package/lib/typescript/commonjs/AgentByline.d.ts +2 -1
  20. package/lib/typescript/commonjs/ChatComposer.d.ts +3 -1
  21. package/lib/typescript/commonjs/ChatLauncher.d.ts +4 -2
  22. package/lib/typescript/commonjs/ChatStarters.d.ts +4 -1
  23. package/lib/typescript/commonjs/ChatThread.d.ts +5 -1
  24. package/lib/typescript/commonjs/renderers/chipLook.d.ts +7 -0
  25. package/lib/typescript/module/AgentByline.d.ts +2 -1
  26. package/lib/typescript/module/ChatComposer.d.ts +3 -1
  27. package/lib/typescript/module/ChatLauncher.d.ts +4 -2
  28. package/lib/typescript/module/ChatStarters.d.ts +4 -1
  29. package/lib/typescript/module/ChatThread.d.ts +5 -1
  30. package/lib/typescript/module/renderers/chipLook.d.ts +7 -0
  31. package/package.json +10 -10
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AgentByline=AgentByline;var _mobileUi=require("@webority/mobile-ui"),_reactNative=require("react-native"),_jsxRuntime=require("react/jsx-runtime");function AgentByline({author:e,labels:i}){const t=(0,_mobileUi.useTheme)(),r=e.displayName||i.agent,a=e.avatarUrl?{uri:e.avatarUrl}:void 0;return(0,_jsxRuntime.jsxs)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{flexDirection:"row",alignItems:"center",gap:t.space.xs},children:[(0,_jsxRuntime.jsx)(_mobileUi.Avatar,{size:"xs",name:r,source:a}),(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",children:r}),(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"tertiary",children:i.agent})]})}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AgentByline=AgentByline;var _mobileUi=require("@webority/mobile-ui"),_reactNative=require("react-native"),_jsxRuntime=require("react/jsx-runtime");function AgentByline({author:e,labels:i,showAvatar:t=!0}){const r=(0,_mobileUi.useTheme)(),a=e.displayName||i.agent,n=e.avatarUrl?{uri:e.avatarUrl}:void 0;return(0,_jsxRuntime.jsxs)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{flexDirection:"row",alignItems:"center",gap:r.space.xs},children:[t?(0,_jsxRuntime.jsx)(_mobileUi.Avatar,{size:"xs",name:a,source:n}):null,(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",children:a}),(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"tertiary",children:i.agent})]})}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatComposer=ChatComposer;var _chatCore=require("@webority/chat-core"),_permissions=require("@webority/mobile-core/permissions"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_ChatDictationButton=require("./ChatDictationButton.js"),_ChatFooter=require("./ChatFooter.js"),_speechText=require("./speech/speechText.js"),_jsxRuntime=require("react/jsx-runtime");const ALLOWANCE_SHOWN_AT=10,COUNTER_AT=.9,DEFAULT_MAX_LENGTH=4e3,openQuestion=e=>{for(let t=e.length-1;t>=0;t-=1){const s=e[t];for(const e of[...s?.parts??[]].reverse())if("InputRequest"===e.kind&&"Open"===e.state)return e.fields[0]?.label||e.title||null}return null};function ChatComposer({chat:e,labels:t,pickAttachments:s,keyboardOffset:a,keyboardAware:i,safeArea:n,testID:o="chat-composer",focusRef:r,look:l=_chatCore.defaultChatLook}){const c=(0,_mobileUi.useTheme)(),u=(0,_react.useMemo)(()=>buildStyles(c),[c]),[m,h]=(0,_react.useState)(""),[p,d]=(0,_react.useState)(null),_=e.editing,x=(0,_react.useRef)(null),f=(0,_react.useRef)(null);(0,_react.useEffect)(()=>{if(r)return r.current=()=>f.current?.focus(),()=>{r.current=null}},[r]),(0,_react.useEffect)(()=>{_&&x.current?.(),h(_?_.text:"")},[_]);const g=e.attachments,b=g.some(e=>"Uploading"===e.status),j=g.some(e=>"Ready"===e.status),v=e.messagesLeftToday,y=e.profile?.limits.maxMessageLength??DEFAULT_MAX_LENGTH,R=void 0!==s&&e.features.Attachments&&(e.profile?.limits.maxAttachments??0)>0,C=e.features.HumanHandoff&&("WaitingForAgent"===e.conversationState||"WithAgent"===e.conversationState),A=R&&!e.handoffPause?(0,_jsxRuntime.jsx)(_mobileUi.IconButton,{icon:"paperclip",accessibilityLabel:t.attach,variant:"ghost",tone:"neutral",onPress:()=>{s&&s().then(t=>e.attach(t))},testID:`${o}-attach`}):void 0,T=_?(0,_jsxRuntime.jsx)(_mobileUi.Banner,{message:t.editing,accessibilityRole:"summary",actions:[{label:t.cancel,onPress:()=>e.cancelEdit()}],testID:`${o}-editing`}):null,S=g.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:u.tray,testID:`${o}-attachments`,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:u.row,children:g.map(s=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:u.item,children:[(0,_jsxRuntime.jsx)(_mobileUi.Chip,{label:s.fileName,variant:"soft",onRemove:()=>{e.removeAttachment(s.key)},labels:{remove:t.removeAttachment},removeTestID:`${o}-remove-${s.key}`,testID:`${o}-chip-${s.key}`}),"Uploading"===s.status?(0,_jsxRuntime.jsx)(_mobileUi.ProgressBar,{progress:s.progress??void 0,label:t.attachmentUploading,height:4,containerStyle:u.progress}):null,"Failed"===s.status?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"danger",accessibilityLiveRegion:"polite",children:s.error??t.attachmentFailed}):null]},s.key))})}):null,D=null!==v&&v<=ALLOWANCE_SHOWN_AT?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:0===v?"danger":"secondary",accessibilityLiveRegion:"polite",testID:`${o}-allowance`,children:t.allowance(v)}):null,U=p?(0,_jsxRuntime.jsx)(_mobileUi.Banner,{message:p.message,tone:p.tone,dismissible:!0,onClose:()=>d(null),actions:p.openSettings?[{label:t.dictateOpenSettings,onPress:()=>{_permissions.Permissions.openSettings()}}]:void 0,testID:`${o}-voice-notice`}):null,w=m.length>0,L=m.length>y*COUNTER_AT?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",testID:`${o}-counter`,children:t.counter(m.length,y)}):null,N=T||S||D||L||U?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[T,S,D,L,U]}):void 0,k=!b&&(!!j||void 0);return(0,_jsxRuntime.jsx)(_mobileUi.Composer,{ref:f,onSend:t=>{x.current?.(),e.submit(t)},value:m,onChangeText:t=>{x.current?.(),h(t),C&&t.length>0&&e.notifyTyping()},loading:e.streaming&&e.features.Stop,ring:l.input.ring&&(w||e.streaming),sendReveal:"Always"===l.input.sendReveal?"always":"onText",onStop:e.features.Stop?()=>e.stop():void 0,stopLabel:t.stop,disabled:0===v||e.handoffPause,maxLength:y,canSend:k,placeholder:e.handoffPause?t.handoffMoment:openQuestion(e.messages)??t.placeholder,accessibilityLabel:t.composer,labels:{send:t.send},leading:A,trailing:(0,_jsxRuntime.jsx)(_ChatDictationButton.ChatDictationButton,{chat:e,labels:t,disabled:0===v||e.handoffPause,onText:e=>h(t=>(0,_speechText.joinDictation)(t,e,y)),onNotice:d,stopRef:x}),above:N,below:(0,_jsxRuntime.jsx)(_ChatFooter.ChatFooter,{chat:e,labels:t}),keyboardAware:i,keyboardOffset:a,safeArea:n,testID:o})}const buildStyles=e=>_reactNative.StyleSheet.create({tray:{gap:e.space.xs},row:{flexDirection:"row",flexWrap:"wrap",gap:e.space.xs},item:{gap:e.space.xxs,maxWidth:"100%"},progress:{minWidth:120}});
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatComposer=ChatComposer;var _chatCore=require("@webority/chat-core"),_permissions=require("@webority/mobile-core/permissions"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_ChatDictationButton=require("./ChatDictationButton.js"),_ChatFooter=require("./ChatFooter.js"),_speechText=require("./speech/speechText.js"),_jsxRuntime=require("react/jsx-runtime");const ALLOWANCE_SHOWN_AT=10,COUNTER_AT=.9,DEFAULT_MAX_LENGTH=4e3,openQuestion=e=>{for(let t=e.length-1;t>=0;t-=1){const s=e[t];for(const e of[...s?.parts??[]].reverse())if("InputRequest"===e.kind&&"Open"===e.state)return e.fields[0]?.label||e.title||null}return null};function ChatComposer({chat:e,labels:t,pickAttachments:s,keyboardOffset:a,keyboardAware:i,safeArea:n,testID:o="chat-composer",focusRef:r,look:l=_chatCore.defaultChatLook,sendIcon:c}){const u=(0,_mobileUi.useTheme)(),m=(0,_react.useMemo)(()=>buildStyles(u),[u]),[h,d]=(0,_react.useState)(""),[p,_]=(0,_react.useState)(null),x=e.editing,f=(0,_react.useRef)(null),g=(0,_react.useRef)(null);(0,_react.useEffect)(()=>{if(r)return r.current=()=>g.current?.focus(),()=>{r.current=null}},[r]),(0,_react.useEffect)(()=>{x&&f.current?.(),d(x?x.text:"")},[x]);const b=e.attachments,j=b.some(e=>"Uploading"===e.status),v=b.some(e=>"Ready"===e.status),y=e.messagesLeftToday,R=e.profile?.limits.maxMessageLength??DEFAULT_MAX_LENGTH,C=void 0!==s&&e.features.Attachments&&(e.profile?.limits.maxAttachments??0)>0,A=e.features.HumanHandoff&&("WaitingForAgent"===e.conversationState||"WithAgent"===e.conversationState),T=C&&!e.handoffPause?(0,_jsxRuntime.jsx)(_mobileUi.IconButton,{icon:"paperclip",accessibilityLabel:t.attach,variant:"ghost",tone:"neutral",onPress:()=>{s&&s().then(t=>e.attach(t))},testID:`${o}-attach`}):void 0,S=x?(0,_jsxRuntime.jsx)(_mobileUi.Banner,{message:t.editing,accessibilityRole:"summary",actions:[{label:t.cancel,onPress:()=>e.cancelEdit()}],testID:`${o}-editing`}):null,D=b.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:m.tray,testID:`${o}-attachments`,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:m.row,children:b.map(s=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:m.item,children:[(0,_jsxRuntime.jsx)(_mobileUi.Chip,{label:s.fileName,variant:"soft",onRemove:()=>{e.removeAttachment(s.key)},labels:{remove:t.removeAttachment},removeTestID:`${o}-remove-${s.key}`,testID:`${o}-chip-${s.key}`}),"Uploading"===s.status?(0,_jsxRuntime.jsx)(_mobileUi.ProgressBar,{progress:s.progress??void 0,label:t.attachmentUploading,height:4,containerStyle:m.progress}):null,"Failed"===s.status?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"danger",accessibilityLiveRegion:"polite",children:s.error??t.attachmentFailed}):null]},s.key))})}):null,U=null!==y&&y<=ALLOWANCE_SHOWN_AT?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:0===y?"danger":"secondary",accessibilityLiveRegion:"polite",testID:`${o}-allowance`,children:t.allowance(y)}):null,w=p?(0,_jsxRuntime.jsx)(_mobileUi.Banner,{message:p.message,tone:p.tone,dismissible:!0,onClose:()=>_(null),actions:p.openSettings?[{label:t.dictateOpenSettings,onPress:()=>{_permissions.Permissions.openSettings()}}]:void 0,testID:`${o}-voice-notice`}):null,L=h.length>0,N=h.length>R*COUNTER_AT?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",testID:`${o}-counter`,children:t.counter(h.length,R)}):null,I=S||D||U||N||w?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[S,D,U,N,w]}):void 0,k=!j&&(!!v||void 0);return(0,_jsxRuntime.jsx)(_mobileUi.Composer,{ref:g,onSend:t=>{f.current?.(),e.submit(t)},value:h,onChangeText:t=>{f.current?.(),d(t),A&&t.length>0&&e.notifyTyping()},loading:e.streaming&&e.features.Stop,ring:l.input.ring&&(L||e.streaming),sendReveal:"Always"===l.input.sendReveal?"always":"onText",sendIcon:c||void 0,onStop:e.features.Stop?()=>e.stop():void 0,stopLabel:t.stop,disabled:0===y||e.handoffPause,maxLength:R,canSend:k,placeholder:e.handoffPause?t.handoffMoment:openQuestion(e.messages)??t.placeholder,accessibilityLabel:t.composer,labels:{send:t.send},leading:T,trailing:(0,_jsxRuntime.jsx)(_ChatDictationButton.ChatDictationButton,{chat:e,labels:t,disabled:0===y||e.handoffPause,onText:e=>d(t=>(0,_speechText.joinDictation)(t,e,R)),onNotice:_,stopRef:f}),above:I,below:(0,_jsxRuntime.jsx)(_ChatFooter.ChatFooter,{chat:e,labels:t}),keyboardAware:i,keyboardOffset:a,safeArea:n,testID:o})}const buildStyles=e=>_reactNative.StyleSheet.create({tray:{gap:e.space.xs},row:{flexDirection:"row",flexWrap:"wrap",gap:e.space.xs},item:{gap:e.space.xxs,maxWidth:"100%"},progress:{minWidth:120}});
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatFrame=ChatFrame;var _chatCore=require("@webority/chat-core"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_ChatComposer=require("./ChatComposer.js"),_ChatConversationActions=require("./ChatConversationActions.js"),_ChatHistory=require("./ChatHistory.js"),_ChatLiveBar=require("./ChatLiveBar.js"),_ChatPanel=require("./ChatPanel.js"),_ChatStarters=require("./ChatStarters.js"),_ChatThread=require("./ChatThread.js"),_useChatHaptics=require("./useChatHaptics.js"),_useChatSound=require("./useChatSound.js"),_jsxRuntime=require("react/jsx-runtime");function ChatFrame({chat:e,labels:t,renderers:s,layoutParts:a,loader:r="Steps",look:i,pickAttachments:o,onOpenAttachment:n,onOpenTarget:l,onNavigate:u,openTicket:c,handoffHosts:h,resolveLink:m,keyboardOffset:d,layout:_,title:C,headerActions:x,onClose:j,enterKey:b=0,testID:p="chat-frame"}){const v=(0,_mobileUi.useTheme)(),f=(0,_react.useMemo)(()=>(0,_chatCore.mergeLook)(i),[i]),y=(0,_mobileUi.useReducedMotion)(),R="Reduced"===f.motion||y,g="embedded"===_?"None":f.panel.motion,I="sheet"===_?"sheet":"screen",k=(0,_react.useMemo)(()=>(0,_ChatPanel.panelRun)({motion:g,reduced:R,mode:I,run:b}),[g,R,I,b]),[w,D]=(0,_react.useState)(!1),P=w&&!0===e.features.History;(0,_useChatHaptics.useChatHaptics)(e),(0,_useChatSound.useChatSound)(e);const S="sheet"!==_,q=null!==e.profile,T=(0,_react.useRef)(null);if(q&&!e.features.VisitorChat)return null;const H=e.messages.length>0,$=e.messages.some(e=>"Visitor"===e.author.kind||"Customer"===e.author.kind),A="screen"===_||$,B=!0===e.profile?.experience.sound.muteControl&&e.features.Sounds,L=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flexDirection:"row",alignItems:"center",gap:v.space.sm,paddingHorizontal:v.space.md,paddingVertical:v.space.sm,borderBottomWidth:1,borderBottomColor:v.colors["border-subtle"]},children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1,minWidth:0},children:[(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"title",accessibilityRole:"header",numberOfLines:1,children:C??e.profile?.assistant.name??t.panelTitle}),(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",children:t.headerStatus})]}),x,P?null:(0,_jsxRuntime.jsx)(_ChatConversationActions.ChatConversationActions,{chat:e,labels:t,testID:`${p}-conversation-actions`}),e.features.History?(0,_jsxRuntime.jsx)(_mobileUi.IconButton,{icon:P?"arrow-left":"history",variant:"ghost",tone:"neutral",accessibilityLabel:P?t.backToChat:t.history,onPress:()=>D(e=>!e),testID:`${p}-history`}):null,B?(0,_jsxRuntime.jsx)(_mobileUi.IconButton,{icon:e.muted?"volume-mute":"volume-high",variant:"ghost",tone:"neutral",accessibilityLabel:e.muted?t.unmuteSounds:t.muteSounds,onPress:()=>e.session.setMuted(!e.muted),testID:`${p}-mute`}):null,P||!A?null:(0,_jsxRuntime.jsx)(_mobileUi.IconButton,{icon:"plus",variant:"ghost",tone:"neutral",accessibilityLabel:t.newChat,disabled:e.streaming||e.thinking,onPress:()=>e.newConversation(),testID:`${p}-new`}),j?(0,_jsxRuntime.jsx)(_mobileUi.IconButton,{icon:"x",variant:"ghost",tone:"neutral",accessibilityLabel:t.close,onPress:j,testID:`${p}-close`}):null]});let U;return U=P?(0,_jsxRuntime.jsx)(_ChatHistory.ChatHistory,{chat:e,labels:t,onOpen:()=>D(!1),testID:`${p}-history-list`}):e.profileError?(0,_jsxRuntime.jsx)(_mobileUi.Banner,{tone:"danger",message:e.profileError.message,accessibilityRole:"alert",testID:`${p}-profile-error`}):!q||e.loading?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flex:1,alignItems:"center",justifyContent:"center"},children:(0,_jsxRuntime.jsx)(_mobileUi.Spinner,{message:t.loadingConversation,testID:`${p}-loading`})}):e.loadError?(0,_jsxRuntime.jsx)(_mobileUi.Banner,{tone:"danger",message:e.loadError.message,accessibilityRole:"alert",testID:`${p}-load-error`}):H?(0,_jsxRuntime.jsx)(_ChatThread.ChatThread,{chat:e,labels:t,renderers:s,layoutParts:a,loader:r,motion:f.motion,pickAttachments:o,onOpenAttachment:n,onOpenTarget:l,onNavigate:u,openTicket:c,handoffHosts:h,resolveLink:m,focusComposer:()=>T.current?.(),keyboardAware:S,keyboardOffset:d,style:{flex:1},testID:`${p}-thread`}):(0,_jsxRuntime.jsx)(_ChatStarters.ChatStarters,{chat:e,labels:t,openTicket:c,testID:`${p}-starters`}),(0,_jsxRuntime.jsx)(_ChatPanel.ChatPanelGrow,{grow:k.grow,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1},testID:p,children:[(0,_jsxRuntime.jsx)(_ChatPanel.ChatReveal,{plan:k.reveal.header,children:L}),P?null:(0,_jsxRuntime.jsx)(_ChatLiveBar.ChatLiveBar,{chat:e,labels:t,testID:`${p}-live`}),(0,_jsxRuntime.jsx)(_ChatPanel.ChatReveal,{plan:k.reveal.body,flex:!0,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flex:1},children:U})}),P?null:(0,_jsxRuntime.jsx)(_ChatPanel.ChatReveal,{plan:k.reveal.composer,children:(0,_jsxRuntime.jsx)(_ChatComposer.ChatComposer,{chat:e,labels:t,look:f,pickAttachments:o,keyboardOffset:d,keyboardAware:S,focusRef:T,testID:`${p}-composer`})})]})})}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatFrame=ChatFrame;var _chatCore=require("@webority/chat-core"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_ChatComposer=require("./ChatComposer.js"),_ChatConversationActions=require("./ChatConversationActions.js"),_ChatHistory=require("./ChatHistory.js"),_ChatLiveBar=require("./ChatLiveBar.js"),_ChatPanel=require("./ChatPanel.js"),_ChatStarters=require("./ChatStarters.js"),_ChatThread=require("./ChatThread.js"),_useChatHaptics=require("./useChatHaptics.js"),_useChatSound=require("./useChatSound.js"),_jsxRuntime=require("react/jsx-runtime");function ChatFrame({chat:e,labels:t,renderers:a,layoutParts:s,loader:r="Steps",look:i,pickAttachments:n,onOpenAttachment:o,onOpenTarget:l,onNavigate:u,openTicket:c,handoffHosts:h,resolveLink:m,keyboardOffset:d,layout:_,title:x,headerActions:C,onClose:j,enterKey:p=0,testID:b="chat-frame"}){const v=(0,_mobileUi.useTheme)(),y=(0,_react.useMemo)(()=>(0,_chatCore.mergeLook)(i),[i]),f=(0,_mobileUi.useReducedMotion)(),R="Reduced"===y.motion||f,g="embedded"===_?"None":y.panel.motion,I="sheet"===_?"sheet":"screen",k=(0,_react.useMemo)(()=>(0,_ChatPanel.panelRun)({motion:g,reduced:R,mode:I,run:p}),[g,R,I,p]),[w,A]=(0,_react.useState)(!1),D=w&&!0===e.features.History;(0,_useChatHaptics.useChatHaptics)(e),(0,_useChatSound.useChatSound)(e);const P="sheet"!==_,S=null!==e.profile,T=(0,_react.useRef)(null);if(S&&!e.features.VisitorChat)return null;const q=e.messages.length>0,H=e.messages.some(e=>"Visitor"===e.author.kind||"Customer"===e.author.kind),L="screen"===_||H,U=!0===e.profile?.experience.sound.muteControl&&e.features.Sounds,$=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flexDirection:"row",alignItems:"center",gap:v.space.sm,paddingHorizontal:v.space.md,paddingVertical:v.space.sm,borderBottomWidth:1,borderBottomColor:v.colors["border-subtle"]},children:[y.avatar?(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:(0,_jsxRuntime.jsx)(_mobileUi.Avatar,{size:"sm",name:e.profile?.assistant.name??t.panelTitle,source:{uri:y.avatar}})}):null,(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1,minWidth:0},children:[(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"title",accessibilityRole:"header",numberOfLines:1,children:x??e.profile?.assistant.name??t.panelTitle}),(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",children:t.headerStatus})]}),C,D?null:(0,_jsxRuntime.jsx)(_ChatConversationActions.ChatConversationActions,{chat:e,labels:t,testID:`${b}-conversation-actions`}),e.features.History?(0,_jsxRuntime.jsx)(_mobileUi.IconButton,{icon:D?"arrow-left":"history",variant:"ghost",tone:"neutral",accessibilityLabel:D?t.backToChat:t.history,onPress:()=>A(e=>!e),testID:`${b}-history`}):null,U?(0,_jsxRuntime.jsx)(_mobileUi.IconButton,{icon:e.muted?"volume-mute":"volume-high",variant:"ghost",tone:"neutral",accessibilityLabel:e.muted?t.unmuteSounds:t.muteSounds,onPress:()=>e.session.setMuted(!e.muted),testID:`${b}-mute`}):null,D||!L?null:(0,_jsxRuntime.jsx)(_mobileUi.IconButton,{icon:"plus",variant:"ghost",tone:"neutral",accessibilityLabel:t.newChat,disabled:e.streaming||e.thinking,onPress:()=>e.newConversation(),testID:`${b}-new`}),j?(0,_jsxRuntime.jsx)(_mobileUi.IconButton,{icon:"x",variant:"ghost",tone:"neutral",accessibilityLabel:t.close,onPress:j,testID:`${b}-close`}):null]});let B;return B=D?(0,_jsxRuntime.jsx)(_ChatHistory.ChatHistory,{chat:e,labels:t,onOpen:()=>A(!1),testID:`${b}-history-list`}):e.profileError?(0,_jsxRuntime.jsx)(_mobileUi.Banner,{tone:"danger",message:e.profileError.message,accessibilityRole:"alert",testID:`${b}-profile-error`}):!S||e.loading?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flex:1,alignItems:"center",justifyContent:"center"},children:(0,_jsxRuntime.jsx)(_mobileUi.Spinner,{message:t.loadingConversation,testID:`${b}-loading`})}):e.loadError?(0,_jsxRuntime.jsx)(_mobileUi.Banner,{tone:"danger",message:e.loadError.message,accessibilityRole:"alert",testID:`${b}-load-error`}):q?(0,_jsxRuntime.jsx)(_ChatThread.ChatThread,{chat:e,labels:t,renderers:a,layoutParts:s,loader:r,motion:y.motion,avatar:y.avatar,replyAvatars:y.panel.replyAvatars,pickAttachments:n,onOpenAttachment:o,onOpenTarget:l,onNavigate:u,openTicket:c,handoffHosts:h,resolveLink:m,focusComposer:()=>T.current?.(),keyboardAware:P,keyboardOffset:d,style:{flex:1},testID:`${b}-thread`}):(0,_jsxRuntime.jsx)(_ChatStarters.ChatStarters,{chat:e,labels:t,openTicket:c,avatar:y.avatar,motion:y.motion,greetingLoaderMs:R?0:y.panel.greetingLoaderMs,testID:`${b}-starters`}),(0,_jsxRuntime.jsx)(_ChatPanel.ChatPanelGrow,{grow:k.grow,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1},testID:b,children:[(0,_jsxRuntime.jsx)(_ChatPanel.ChatReveal,{plan:k.reveal.header,children:$}),D?null:(0,_jsxRuntime.jsx)(_ChatLiveBar.ChatLiveBar,{chat:e,labels:t,testID:`${b}-live`}),(0,_jsxRuntime.jsx)(_ChatPanel.ChatReveal,{plan:k.reveal.body,flex:!0,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flex:1},children:B})}),D?null:(0,_jsxRuntime.jsx)(_ChatPanel.ChatReveal,{plan:k.reveal.composer,children:(0,_jsxRuntime.jsx)(_ChatComposer.ChatComposer,{chat:e,labels:t,look:y,sendIcon:i?.input?.sendIcon,pickAttachments:n,keyboardOffset:d,keyboardAware:P,focusRef:T,testID:`${b}-composer`})})]})})}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatLauncher=ChatLauncher;var _mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_jsxRuntime=require("react/jsx-runtime");const RISE_MS=900,RISE_DELAY_MS=400,ENTRANCE_MS=800,ENTRANCE_DELAY_MS=1e3,FLOAT_HALF_MS=1600,FLOAT_PX=4,RISE_FROM_PX=116;function entranceStyle(e,t){const range=(e,a)=>t.interpolate({inputRange:e,outputRange:a,extrapolate:"clamp"});switch(e){case"Rise":return{opacity:range([0,.4,1],[0,1,1]),transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[116,0]})}]};case"SlideUp":return{opacity:range([0,1],[0,1]),transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[100,0]})},{scale:t.interpolate({inputRange:[0,1],outputRange:[.8,1]})}]};case"BounceIn":return{transform:[{scale:range([0,.5,.7,1],[.3,1.05,.9,1])}]};case"FadeInPulse":return{opacity:range([0,.5,1],[0,1,1]),transform:[{scale:range([0,.5,1],[1,1.1,1])}]};case"SpinScale":return{transform:[{rotate:t.interpolate({inputRange:[0,1],outputRange:["-180deg","0deg"]})},{scale:t.interpolate({inputRange:[0,1],outputRange:[0,1]})}]};case"WiggleIn":return{transform:[{translateY:range([0,.4,1],[100,0,0])},{rotate:range([0,.4,.6,.8,1],["-10deg","5deg","-3deg","1deg","0deg"])}]};case"ElasticIn":return{transform:[{scale:range([0,.55,.75,1],[0,1.1,.95,1])}]};default:return{transform:[]}}}const OVERSHOOT=new Set(["Rise","SlideUp","SpinScale"]);function ChatLauncher({look:e,label:t,side:a,offsetX:n,offsetY:r,enter:i,reduced:s,buttonRef:o,onPress:c,testID:u}){const l=(0,_mobileUi.useTheme)(),_=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),p=e.launcher.entrance,[g]=(0,_react.useState)(()=>i&&!s&&"None"!==p),d=!s&&"FloatAndPulse"===e.launcher.idle,[m]=(0,_react.useState)(()=>new _reactNative.Animated.Value(g?0:1)),[S]=(0,_react.useState)(()=>new _reactNative.Animated.Value(0));(0,_react.useEffect)(()=>{if(!g)return void m.setValue(1);const e="Rise"===p,t=_reactNative.Animated.timing(m,{toValue:1,duration:e?RISE_MS:ENTRANCE_MS,delay:e?RISE_DELAY_MS:ENTRANCE_DELAY_MS,easing:OVERSHOOT.has(p)?_reactNative.Easing.bezier(.34,e?1.4:1.56,.64,1):_reactNative.Easing.linear,useNativeDriver:!0});return t.start(),()=>t.stop()},[g,p,m]),(0,_react.useEffect)(()=>{if(!d)return void S.setValue(0);const e=_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(S,{toValue:1,duration:FLOAT_HALF_MS,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:!0}),_reactNative.Animated.timing(S,{toValue:0,duration:FLOAT_HALF_MS,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:!0})]));return e.start(),()=>e.stop()},[d,S]);const f="Pill"===e.launcher.style&&!e.launcher.compact,R=l.space[l.components["floating-action-button"]["edge-offset"]]+n,v={position:"absolute",bottom:r+_.bottom,..."start"===a?{left:R}:{right:R}},N=entranceStyle(p,m);return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"box-none",style:_reactNative.StyleSheet.absoluteFill,children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[v,{opacity:N.opacity??1,transform:[...N.transform,{translateY:S.interpolate({inputRange:[0,1],outputRange:[0,-FLOAT_PX]})}]}],children:(0,_jsxRuntime.jsx)(_mobileUi.FloatingActionButton,{ref:o,icon:"messages",label:f?t:void 0,collapsed:!f,accessibilityLabel:t,onPress:c,testID:u})})})}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatLauncher=ChatLauncher;var _mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_reactNativeSafeAreaContext=require("react-native-safe-area-context"),_jsxRuntime=require("react/jsx-runtime");const RISE_MS=900,RISE_DELAY_MS=400,ENTRANCE_MS=800,ENTRANCE_DELAY_MS=1e3,FLOAT_HALF_MS=1600,FLOAT_PX=4,RISE_FROM_PX=116;function entranceStyle(e,t){const range=(e,a)=>t.interpolate({inputRange:e,outputRange:a,extrapolate:"clamp"});switch(e){case"Rise":return{opacity:range([0,.4,1],[0,1,1]),transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[116,0]})}]};case"SlideUp":return{opacity:range([0,1],[0,1]),transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[100,0]})},{scale:t.interpolate({inputRange:[0,1],outputRange:[.8,1]})}]};case"BounceIn":return{transform:[{scale:range([0,.5,.7,1],[.3,1.05,.9,1])}]};case"FadeInPulse":return{opacity:range([0,.5,1],[0,1,1]),transform:[{scale:range([0,.5,1],[1,1.1,1])}]};case"SpinScale":return{transform:[{rotate:t.interpolate({inputRange:[0,1],outputRange:["-180deg","0deg"]})},{scale:t.interpolate({inputRange:[0,1],outputRange:[0,1]})}]};case"WiggleIn":return{transform:[{translateY:range([0,.4,1],[100,0,0])},{rotate:range([0,.4,.6,.8,1],["-10deg","5deg","-3deg","1deg","0deg"])}]};case"ElasticIn":return{transform:[{scale:range([0,.55,.75,1],[0,1.1,.95,1])}]};default:return{transform:[]}}}const OVERSHOOT=new Set(["Rise","SlideUp","SpinScale"]);function ChatLauncher({look:e,label:t,side:a,offsetX:n,offsetY:r,enter:i,reduced:s,mark:o="Icon",avatar:u=null,buttonRef:c,onPress:l,testID:_}){const m=(0,_mobileUi.useTheme)(),p=(0,_reactNativeSafeAreaContext.useSafeAreaInsets)(),d=e.launcher.entrance,g="Avatar"===o&&u?u:null,v=m.components["floating-action-button"].md.diameter,[f]=(0,_react.useState)(()=>i&&!s&&"None"!==d),R=!s&&"FloatAndPulse"===e.launcher.idle,[S]=(0,_react.useState)(()=>new _reactNative.Animated.Value(f?0:1)),[A]=(0,_react.useState)(()=>new _reactNative.Animated.Value(0));(0,_react.useEffect)(()=>{if(!f)return void S.setValue(1);const e="Rise"===d,t=_reactNative.Animated.timing(S,{toValue:1,duration:e?RISE_MS:ENTRANCE_MS,delay:e?RISE_DELAY_MS:ENTRANCE_DELAY_MS,easing:OVERSHOOT.has(d)?_reactNative.Easing.bezier(.34,e?1.4:1.56,.64,1):_reactNative.Easing.linear,useNativeDriver:!0});return t.start(),()=>t.stop()},[f,d,S]),(0,_react.useEffect)(()=>{if(!R)return void A.setValue(0);const e=_reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(A,{toValue:1,duration:FLOAT_HALF_MS,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:!0}),_reactNative.Animated.timing(A,{toValue:0,duration:FLOAT_HALF_MS,easing:_reactNative.Easing.inOut(_reactNative.Easing.ease),useNativeDriver:!0})]));return e.start(),()=>e.stop()},[R,A]);const N="Pill"===e.launcher.style&&!e.launcher.compact,E=m.space[m.components["floating-action-button"]["edge-offset"]]+n,b={position:"absolute",bottom:r+p.bottom,..."start"===a?{left:E}:{right:E}},h=entranceStyle(d,S);return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"box-none",style:_reactNative.StyleSheet.absoluteFill,children:(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{style:[b,{opacity:h.opacity??1,transform:[...h.transform,{translateY:A.interpolate({inputRange:[0,1],outputRange:[0,-FLOAT_PX]})}]}],children:(0,_jsxRuntime.jsx)(_mobileUi.FloatingActionButton,{ref:c,icon:g?(0,_jsxRuntime.jsx)(_mobileUi.Avatar,{dimension:v,name:t,source:{uri:g}}):"messages",label:N?t:void 0,collapsed:!N,accessibilityLabel:t,onPress:l,testID:_})})})}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatSheet=ChatSheet;var _chatCore=require("@webority/chat-core"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_ChatAppearanceScope=require("./ChatAppearanceScope.js"),_ChatFrame=require("./ChatFrame.js"),_ChatLauncher=require("./ChatLauncher.js"),_ChatNudge=require("./ChatNudge.js"),_chatShared=require("./chatShared.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_SNAP_POINTS=["92%"],DEFAULT_BOTTOM_OFFSET=16;function ChatSheet({chat:e,labels:t,renderers:r,layoutParts:a,loader:s="Steps",look:n,appearance:o,pickAttachments:c,onOpenAttachment:i,onOpenTarget:u,onNavigate:l,keyboardOffset:h,open:p,defaultOpen:_=!1,onOpenChange:f,snapPoints:d=DEFAULT_SNAP_POINTS,openTicket:m,handoffHosts:b,resolveLink:C,conversationId:g,onClose:j,testID:S="chat-sheet"}){const x=(0,_mobileUi.useTheme)(),T=(0,_chatCore.mergeLabels)(t),O=(0,_react.useMemo)(()=>(0,_chatCore.mergeLook)(n),[n]),R=(0,_mobileUi.useReducedMotion)(),v="Reduced"===O.motion||R,y=o?.position??"end",A=void 0!==p,k=A?p:e.open,N=(0,_react.useRef)(null),E=(0,_react.useRef)(!1),F=(0,_react.useRef)(g??null),L=e.setChatVisible,P=(0,_react.useRef)(!1),q=!P.current,[D,I]=(0,_react.useState)(0),U=(0,_react.useRef)(k);(0,_react.useEffect)(()=>{k&&(P.current=!0)},[k]),(0,_react.useEffect)(()=>{k&&!U.current&&I(e=>e+1),U.current=k},[k]),(0,_react.useEffect)(()=>{E.current||(E.current=!0,A||!_||null===e.profile||e.open||e.session.open({trigger:"manual"}))},[A,_,e.profile,e.open,e.session]),(0,_react.useEffect)(()=>{A&&(p&&!e.open&&e.session.open({trigger:"manual"}),!p&&e.open&&e.session.close("button"))},[A,p,e.open,e.session]);const w=(0,_react.useRef)(k);if((0,_react.useEffect)(()=>{w.current&&!k&&(0,_chatShared.focusForAccessibility)(N.current),w.current=k},[k]),(0,_react.useEffect)(()=>{L(k)},[L,k]),(0,_react.useEffect)(()=>{!A&&g&&g!==F.current&&null!==e.profile&&(F.current=g,e.open||(e.session.open({trigger:"manual"}),f?.(!0)))},[A,g,e.profile,e.open,e.session,f]),null===e.profile||!e.features.VisitorChat)return null;const setOpen=t=>{t?e.session.open({trigger:"manual"}):e.session.close("button"),f?.(t)},closeSheet=()=>{setOpen(!1),j?.()},M=o?.offsetY??DEFAULT_BOTTOM_OFFSET;return(0,_jsxRuntime.jsx)(_reactNative.View,{testID:S,style:_reactNative.StyleSheet.absoluteFill,pointerEvents:"box-none",children:(0,_jsxRuntime.jsxs)(_ChatAppearanceScope.ChatAppearanceScope,{appearance:o,children:[k?null:(0,_jsxRuntime.jsx)(_ChatLauncher.ChatLauncher,{look:O,label:T.launcher,side:y,offsetX:o?.offsetX??0,offsetY:M,enter:q,reduced:v,buttonRef:N,onPress:()=>setOpen(!0),testID:`${S}-launcher`}),(0,_jsxRuntime.jsx)(_ChatNudge.ChatNudge,{chat:e,labels:T,enabled:!k&&e.features.Nudges,onActivate:()=>setOpen(!0),bottomOffset:M,position:y,testID:`${S}-nudge`}),(0,_jsxRuntime.jsx)(_mobileUi.BottomSheet,{open:k,onClose:closeSheet,snapPoints:d,keyboardBehavior:"shift",scrollable:!1,enablePanDownToClose:!0,enableBackdropPress:!0,accessibilityViewIsModal:!0,accessibilityLabel:T.panelTitle,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flex:1,backgroundColor:x.colors.bg},children:(0,_jsxRuntime.jsx)(_ChatFrame.ChatFrame,{chat:e,labels:T,renderers:r,layoutParts:a,loader:s,look:n,pickAttachments:c,onOpenAttachment:i,onOpenTarget:u,onNavigate:l,openTicket:m,handoffHosts:b,resolveLink:C,keyboardOffset:h,onClose:closeSheet,layout:"sheet",enterKey:D,testID:`${S}-frame`})})})]})})}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatSheet=ChatSheet;var _chatCore=require("@webority/chat-core"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_ChatAppearanceScope=require("./ChatAppearanceScope.js"),_ChatFrame=require("./ChatFrame.js"),_ChatLauncher=require("./ChatLauncher.js"),_ChatNudge=require("./ChatNudge.js"),_chatShared=require("./chatShared.js"),_jsxRuntime=require("react/jsx-runtime");const DEFAULT_SNAP_POINTS=["92%"],DEFAULT_BOTTOM_OFFSET=16;function ChatSheet({chat:e,labels:t,renderers:r,layoutParts:a,loader:s="Steps",look:n,appearance:o,pickAttachments:c,onOpenAttachment:i,onOpenTarget:u,onNavigate:l,keyboardOffset:h,open:p,defaultOpen:f=!1,onOpenChange:_,snapPoints:d=DEFAULT_SNAP_POINTS,openTicket:m,handoffHosts:b,resolveLink:C,conversationId:g,onClose:j,testID:x="chat-sheet"}){const S=(0,_mobileUi.useTheme)(),v=(0,_chatCore.mergeLabels)(t),T=(0,_react.useMemo)(()=>(0,_chatCore.mergeLook)(n),[n]),O=(0,_mobileUi.useReducedMotion)(),k="Reduced"===T.motion||O,R=o?.position??"end",y=void 0!==p,A=y?p:e.open,N=(0,_react.useRef)(null),E=(0,_react.useRef)(!1),F=(0,_react.useRef)(g??null),L=e.setChatVisible,P=(0,_react.useRef)(!1),q=!P.current,[D,I]=(0,_react.useState)(0),U=(0,_react.useRef)(A);(0,_react.useEffect)(()=>{A&&(P.current=!0)},[A]),(0,_react.useEffect)(()=>{A&&!U.current&&I(e=>e+1),U.current=A},[A]),(0,_react.useEffect)(()=>{E.current||(E.current=!0,y||!f||null===e.profile||e.open||e.session.open({trigger:"manual"}))},[y,f,e.profile,e.open,e.session]),(0,_react.useEffect)(()=>{y&&(p&&!e.open&&e.session.open({trigger:"manual"}),!p&&e.open&&e.session.close("button"))},[y,p,e.open,e.session]);const w=(0,_react.useRef)(A);if((0,_react.useEffect)(()=>{w.current&&!A&&(0,_chatShared.focusForAccessibility)(N.current),w.current=A},[A]),(0,_react.useEffect)(()=>{L(A)},[L,A]),(0,_react.useEffect)(()=>{!y&&g&&g!==F.current&&null!==e.profile&&(F.current=g,e.open||(e.session.open({trigger:"manual"}),_?.(!0)))},[y,g,e.profile,e.open,e.session,_]),null===e.profile||!e.features.VisitorChat)return null;const setOpen=t=>{t?e.session.open({trigger:"manual"}):e.session.close("button"),_?.(t)},closeSheet=()=>{setOpen(!1),j?.()},M=o?.offsetY??DEFAULT_BOTTOM_OFFSET;return(0,_jsxRuntime.jsx)(_reactNative.View,{testID:x,style:_reactNative.StyleSheet.absoluteFill,pointerEvents:"box-none",children:(0,_jsxRuntime.jsxs)(_ChatAppearanceScope.ChatAppearanceScope,{appearance:o,children:[A?null:(0,_jsxRuntime.jsx)(_ChatLauncher.ChatLauncher,{look:T,label:e.profile?.experience.launcher?.hoverLabel||v.launcher,side:R,offsetX:o?.offsetX??0,offsetY:M,enter:q,reduced:k,mark:T.launcher.mark,avatar:T.avatar,buttonRef:N,onPress:()=>setOpen(!0),testID:`${x}-launcher`}),(0,_jsxRuntime.jsx)(_ChatNudge.ChatNudge,{chat:e,labels:v,enabled:!A&&e.features.Nudges,onActivate:()=>setOpen(!0),bottomOffset:M,position:R,testID:`${x}-nudge`}),(0,_jsxRuntime.jsx)(_mobileUi.BottomSheet,{open:A,onClose:closeSheet,snapPoints:d,keyboardBehavior:"shift",scrollable:!1,enablePanDownToClose:!0,enableBackdropPress:!0,accessibilityViewIsModal:!0,accessibilityLabel:v.panelTitle,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flex:1,backgroundColor:S.colors.bg},children:(0,_jsxRuntime.jsx)(_ChatFrame.ChatFrame,{chat:e,labels:v,renderers:r,layoutParts:a,loader:s,look:n,pickAttachments:c,onOpenAttachment:i,onOpenTarget:u,onNavigate:l,openTicket:m,handoffHosts:b,resolveLink:C,keyboardOffset:h,onClose:closeSheet,layout:"sheet",enterKey:D,testID:`${x}-frame`})})})]})})}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatStarters=ChatStarters;var _mobileCore=require("@webority/mobile-core"),_mobileUi=require("@webority/mobile-ui"),_reactNative=require("react-native"),_ChatEntrance=require("./ChatEntrance.js"),_ChatOpenTickets=require("./ChatOpenTickets.js"),_ChatPastChats=require("./ChatPastChats.js"),_jsxRuntime=require("react/jsx-runtime");function ChatStarters({chat:e,labels:t,openTicket:s,testID:i="chat-starters"}){const a=(0,_mobileUi.useTheme)(),r=e.profile,n=e.greeting??"";if(!r)return null;const l=e.features.Starters&&e.starters.length>0,c=e.lastConversation,o=e.features.ResumeLast&&!e.features.History&&null!==c;return(0,_jsxRuntime.jsxs)(_reactNative.View,{accessibilityLabel:t.emptyTitle,style:{flex:1,justifyContent:"center",alignItems:"center",gap:a.space.md,padding:a.space.md},testID:i,children:[(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"h2",align:"center",children:n}),l?(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityRole:"none",accessibilityLabel:t.starters,style:{flexDirection:"row",flexWrap:"wrap",justifyContent:"center",gap:a.space.xs},children:e.starters.map((t,s)=>(0,_jsxRuntime.jsx)(_ChatEntrance.ChatEntrance,{index:s,children:(0,_jsxRuntime.jsx)(_mobileUi.Chip,{label:t.label,leftIcon:t.icon?t.icon:void 0,onPress:()=>{e.submit(t.message)},testID:`${i}-${t.id}`})},t.id))}):null,o&&c?(0,_jsxRuntime.jsxs)(_mobileUi.Card,{variant:"outline",padding:"sm",onPress:()=>{e.resumeLast()},testID:`${i}-resume`,children:[(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",children:t.resumeLast}),(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"label",numberOfLines:1,children:c.title||t.untitled}),(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",children:(0,_mobileCore.formatDate)(c.lastActivityDateTimeUtc)})]}):null,e.features.History?(0,_jsxRuntime.jsx)(_ChatPastChats.ChatPastChats,{chat:e,labels:t,testID:`${i}-past-chats`}):null,(0,_jsxRuntime.jsx)(_ChatOpenTickets.ChatOpenTickets,{chat:e,labels:t,onOpenTicket:s})]})}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatStarters=ChatStarters;var _mobileCore=require("@webority/mobile-core"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_ChatEntrance=require("./ChatEntrance.js"),_ChatOpenTickets=require("./ChatOpenTickets.js"),_ChatPastChats=require("./ChatPastChats.js"),_TypingPill=require("./loaders/TypingPill.js"),_chipLook=require("./renderers/chipLook.js"),_jsxRuntime=require("react/jsx-runtime");function ChatStarters({chat:e,labels:t,openTicket:i,avatar:s,motion:a="On",greetingLoaderMs:r=0,testID:n="chat-starters"}){const l=(0,_mobileUi.useTheme)(),[c,o]=(0,_react.useState)(!(r>0));(0,_react.useEffect)(()=>{if(c)return;const e=setTimeout(()=>o(!0),r);return()=>clearTimeout(e)},[c,r]);const u=e.profile,m=e.greeting??"";if(!u)return null;const _=u.assistant.intro,x=e.features.Starters&&e.starters.length>0,j=e.lastConversation,h=e.features.ResumeLast&&!e.features.History&&null!==j;return(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityLabel:t.emptyTitle,style:{flex:1,justifyContent:"center",alignItems:"center",gap:l.space.md,padding:l.space.md},testID:n,children:c?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[s?(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:(0,_jsxRuntime.jsx)(_mobileUi.Avatar,{size:"lg",name:e.profile?.assistant.name??t.panelTitle,source:{uri:s}})}):null,(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"h2",align:"center",children:m}),_?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"body",color:"secondary",align:"center",children:_}):null,x?(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityRole:"none",accessibilityLabel:t.starters,style:{flexDirection:"row",flexWrap:"wrap",justifyContent:"center",gap:l.space.xs},children:e.starters.map((t,i)=>(0,_jsxRuntime.jsx)(_ChatEntrance.ChatEntrance,{index:i,children:(0,_jsxRuntime.jsx)(_mobileUi.Chip,{...t.variant?(0,_chipLook.chipLook)(t.variant):null,label:t.label,leftIcon:t.icon?t.icon:void 0,onPress:()=>{e.submit(t.message)},testID:`${n}-${t.id}`})},t.id))}):null,h&&j?(0,_jsxRuntime.jsxs)(_mobileUi.Card,{variant:"outline",padding:"sm",onPress:()=>{e.resumeLast()},testID:`${n}-resume`,children:[(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",children:t.resumeLast}),(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"label",numberOfLines:1,children:j.title||t.untitled}),(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",children:(0,_mobileCore.formatDate)(j.lastActivityDateTimeUtc)})]}):null,e.features.History?(0,_jsxRuntime.jsx)(_ChatPastChats.ChatPastChats,{chat:e,labels:t,testID:`${n}-past-chats`}):null,(0,_jsxRuntime.jsx)(_ChatOpenTickets.ChatOpenTickets,{chat:e,labels:t,onOpenTicket:i})]}):(0,_jsxRuntime.jsx)(_reactNative.View,{children:(0,_jsxRuntime.jsx)(_TypingPill.TypingPill,{motion:a,mark:s?(0,_jsxRuntime.jsx)(_mobileUi.Avatar,{size:"xs",name:e.profile?.assistant.name??t.panelTitle,source:{uri:s}}):null})})})}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatThread=ChatThread;var _chatCore=require("@webority/chat-core"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_AgentByline=require("./AgentByline.js"),_ChatEntrance=require("./ChatEntrance.js"),_ChatMessageActions=require("./ChatMessageActions.js"),_chatShared=require("./chatShared.js"),_ChatLoader=require("./loaders/ChatLoader.js"),_TypingPill=require("./loaders/TypingPill.js"),_index=require("./renderers/index.js"),_NoticePart=require("./renderers/NoticePart.js"),_jsxRuntime=require("react/jsx-runtime");const MINE=new Set(["Visitor","Customer"]),joinedText=e=>e.filter(e=>"Text"===e.kind).map(e=>e.text).join("\n\n"),renderPart=(e,t,s,a,i,r)=>{const n=e[t.kind];if(n)return(0,_react.createElement)(n,{key:r,part:t,message:s,turn:a,pickAttachments:i});const o={kind:"Notice",code:"NeedsNewerApp",text:a.labels.needsNewerApp};return(0,_react.createElement)(_NoticePart.NoticePart,{key:r,part:o,message:s,turn:a})},sameMessage=(e,t)=>e.signature===t.signature&&e.message.id===t.message.id&&e.message.rating===t.message.rating&&e.message.stored===t.message.stored&&e.groupPosition===t.groupPosition&&e.isLast===t.isLast&&e.handoffSettled===t.handoffSettled&&e.isLastVisitor===t.isLastVisitor&&e.thinking===t.thinking&&e.streaming===t.streaming&&e.pickAttachments===t.pickAttachments&&e.labels===t.labels&&e.all===t.all&&e.layoutParts===t.layoutParts&&e.chat.session===t.chat.session&&e.chat.features===t.chat.features&&e.chat.onNavigate===t.chat.onNavigate&&e.onNavigate===t.onNavigate&&e.onOpenAttachment===t.onOpenAttachment&&e.onOpenTarget===t.onOpenTarget&&e.openTicket===t.openTicket&&e.resolveLink===t.resolveLink&&e.focusComposer===t.focusComposer&&e.byline===t.byline&&e.handoffHosts===t.handoffHosts;function ThreadMessageView({chat:e,message:t,labels:s,all:a,layoutParts:i,groupPosition:r,isLast:n,isLastVisitor:o,pickAttachments:l,onOpenAttachment:c,onOpenTarget:u,onNavigate:g,openTicket:m,handoffHosts:d,resolveLink:h,focusComposer:p,byline:_,sourceRows:x,testID:y}){const f=(0,_mobileUi.useTheme)(),j=Object.assign((0,_chatCore.createTurnApi)(e.session,{messageId:t.id,labels:s,openAttachment:c,openTarget:u??_chatShared.defaultOpenTarget,onNavigate:g??e.onNavigate,openTicket:m,handoffHosts:d,openCitation:e=>{return t=String(e),void(0,_chatShared.focusForAccessibility)(x.current.get(t));var t}}),{resolveLink:h,focusComposer:p,registerSourceRow:(e,t)=>{t?x.current.set(e,t):x.current.delete(e)}});let T=0;const nextSlot=()=>(T+=1,T),b=(0,_jsxRuntime.jsx)(_ChatMessageActions.ChatMessageActions,{chat:e,message:t,labels:s,isLast:n,isLastVisitor:o,testID:`${y}-actions`});if(MINE.has(t.author.kind)){const e=t.parts.filter(e=>"File"===e.kind),i=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{gap:f.space.xs},children:[e.map(e=>renderPart(a,e,t,j,l,`${t.id}-file-${nextSlot()}`)),b]});return(0,_jsxRuntime.jsx)(_mobileUi.MessageBubble,{side:"mine",text:joinedText(t.parts),labels:{you:s.you},groupPosition:r,footer:i,testID:y})}const k="Agent"===t.author.kind,N=t.author.displayName||s.agent,v=(i?i(t):t.parts).map(e=>Array.isArray(e)?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row",flexWrap:"wrap",gap:f.space.xs},children:e.map(e=>renderPart(a,e,t,j,l,`${t.id}-part-${nextSlot()}`))},`${t.id}-group-${nextSlot()}`):renderPart(a,e,t,j,l,`${t.id}-item-${nextSlot()}`)),A=k&&_?[(0,_jsxRuntime.jsx)(_AgentByline.AgentByline,{author:t.author,labels:s},`${t.id}-byline`),...v]:v,R=(0,_chatCore.messagePlainText)(t.parts);return(0,_jsxRuntime.jsx)(_mobileUi.MessageBubble,{side:"theirs",author:k?void 0:t.author.displayName||s.assistant,text:k?`${s.agentSays(N)} ${R}`:R,streaming:t.streaming,groupPosition:r,footer:b,testID:y,children:A})}const ThreadMessage=(0,_react.memo)(ThreadMessageView,sameMessage),TYPING_ORB_MARK=14,TYPING_ASSISTANT_MARK=8,TypingMark=({size:e})=>{const t=(0,_mobileUi.useTheme)();return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:e,height:e,borderRadius:t.radius.pill,backgroundColor:t.colors.primary}})},TYPING_DOT=6,TypingDots=()=>{const e=(0,_mobileUi.useTheme)();return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row",alignItems:"center",gap:e.space.xxs},children:[0,1,2].map(t=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:6,height:6,borderRadius:3,backgroundColor:e.colors["text-muted"]}},t))})},TurnGap=()=>{const e=(0,_mobileUi.useTheme)();return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:e.space.lg}})},followNew=()=>!0;function ChatThread({chat:e,labels:t,renderers:s,layoutParts:a,loader:i="Steps",motion:r="On",pickAttachments:n,onOpenAttachment:o,onOpenTarget:l,onNavigate:c,openTicket:u,handoffHosts:g,resolveLink:m,focusComposer:d,keyboardAware:h,keyboardOffset:p,empty:_,style:x,testID:y="chat-thread"}){const f=(0,_mobileUi.useTheme)(),j=(0,_react.useMemo)(()=>({..._index.defaultRenderers,...s}),[s]),T=e.messages[0],b=e.greeting??"",k=(0,_react.useMemo)(()=>""!==b&&void 0!==T&&MINE.has(T.author.kind)?{...T,id:"greeting",author:{...T.author,kind:"Assistant",displayName:null,avatarUrl:null},parts:[{kind:"Text",text:b}],stored:!1,streaming:!1,restored:!1,rating:null}:null,[b,T]),N=(0,_react.useMemo)(()=>{const t=e.messages.filter(e=>!(e.streaming&&0===e.parts.length)).reverse();return k?[...t,k]:t},[e.messages,k]),v=e.messages[e.messages.length-1]?.id,A=(0,_react.useRef)(new Map),R=(0,_react.useRef)(null);(0,_react.useEffect)(()=>{if(null!==R.current)for(const s of e.messages){if(MINE.has(s.author.kind)||s.streaming||s.restored||R.current.has(s.id))continue;if("Agent"===s.author.kind&&!s.stored)continue;R.current.add(s.id);const e=(0,_chatCore.messagePlainText)(s.parts);""!==e&&_reactNative.AccessibilityInfo.announceForAccessibility("Agent"===s.author.kind?`${t.agentSays(s.author.displayName||t.agent)} ${e}`:e)}else R.current=new Set(e.messages.map(e=>e.id))},[e.messages,t]);const w=(0,_react.useMemo)(()=>{for(let t=e.messages.length-1;t>=0;t-=1){const s=e.messages[t];if(s?.stored&&"Visitor"===s.author.kind)return s.id}},[e.messages]),P=(0,_react.useMemo)(()=>{const t=new Set;return e.messages.forEach((s,a)=>{if("Agent"!==s.author.kind)return;const i=e.messages[a-1];"Agent"===i?.author.kind&&(i.author.displayName||"")===(s.author.displayName||"")||t.add(s.id)}),t},[e.messages]),M=(0,_react.useMemo)(()=>(0,_chatCore.handoffSettledIds)(e.messages),[e.messages]),C=e.turnError,S="daily_limit"===C?.code,I=null!==C&&/feature_off$/.test(C.code),L=S&&C?.resetsDateTimeUtc?` ${t.dailyLimitRefresh((0,_chatCore.formatChatDateTime)(C.resetsDateTimeUtc))}`:"",$=e.streaming||null===C&&!e.stopped?null:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{gap:f.space.xs},testID:`${y}-error`,children:[null!==C?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"bodySmall",color:"danger",accessibilityRole:S?void 0:"alert",accessibilityLiveRegion:S?"polite":void 0,children:`${C.message}${L}`}):(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"bodySmall",color:"danger",accessibilityLiveRegion:"polite",children:t.stopped}),!e.features.Retry||S||I?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row"},children:(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:t.retry,variant:"link",size:"sm",onPress:()=>{e.retry()},testID:`${y}-retry`})})]}),D=e.thinking&&null!==e.profile?(0,_jsxRuntime.jsx)(_ChatLoader.ChatLoader,{style:i,steps:e.steps,phrases:e.profile.experience.pacing.thinkingPhrases,intervalMs:e.profile.experience.pacing.phraseIntervalMs,announce:t.preparingAnswer(e.profile.assistant.name),motion:r}):null,O=!0===e.pending?.typing?(0,_jsxRuntime.jsx)(_TypingPill.TypingPill,{motion:r,mark:(0,_jsxRuntime.jsx)(TypingMark,{size:"Orb"===i?TYPING_ORB_MARK:TYPING_ASSISTANT_MARK})}):null,V=null!==e.agentTyping&&"WithAgent"===e.conversationState?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{gap:f.space.xs,alignSelf:"flex-start"},children:[(0,_jsxRuntime.jsx)(_TypingPill.TypingPill,{motion:r,mark:(0,_jsxRuntime.jsx)(TypingDots,{})}),(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",accessibilityLiveRegion:"polite",children:t.agentTyping(e.agentTyping.displayName||t.agent)})]}):null,U=O||D||$||V?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{gap:f.space.sm},children:[O,D,V,$]}):void 0;return(0,_jsxRuntime.jsx)(_mobileUi.MessageList,{messages:N,keyExtractor:e=>e.id,renderMessage:({item:s,groupPosition:i})=>(0,_jsxRuntime.jsx)(_ChatEntrance.ChatEntrance,{animate:!s.restored,children:(0,_jsxRuntime.jsx)(ThreadMessage,{chat:e,message:s,signature:(0,_chatShared.messageSignature)(s),labels:t,all:j,layoutParts:a,groupPosition:i,isLast:s.id===v,isLastVisitor:s.id===w,handoffSettled:M.has(s.id),thinking:e.thinking,streaming:e.streaming,pickAttachments:n,onOpenAttachment:o,onOpenTarget:l,onNavigate:c,openTicket:u,handoffHosts:g,resolveLink:m,focusComposer:d,byline:P.has(s.id),sourceRows:A,testID:`${y}-${s.id}`})}),getAuthorKey:e=>e.author.kind,getDate:e=>e.createdDateTimeUtc,followNew:followNew,typing:U,empty:_,ItemSeparatorComponent:TurnGap,keyboardAware:h,keyboardOffset:p,accessibilityLabel:t.thread,style:x,testID:y})}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatThread=ChatThread;var _chatCore=require("@webority/chat-core"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_AgentByline=require("./AgentByline.js"),_ChatEntrance=require("./ChatEntrance.js"),_ChatMessageActions=require("./ChatMessageActions.js"),_chatShared=require("./chatShared.js"),_ChatLoader=require("./loaders/ChatLoader.js"),_TypingPill=require("./loaders/TypingPill.js"),_index=require("./renderers/index.js"),_NoticePart=require("./renderers/NoticePart.js"),_jsxRuntime=require("react/jsx-runtime");const MINE=new Set(["Visitor","Customer"]),joinedText=e=>e.filter(e=>"Text"===e.kind).map(e=>e.text).join("\n\n"),renderPart=(e,t,s,a,i,r)=>{const n=e[t.kind];if(n)return(0,_react.createElement)(n,{key:r,part:t,message:s,turn:a,pickAttachments:i});const o={kind:"Notice",code:"NeedsNewerApp",text:a.labels.needsNewerApp};return(0,_react.createElement)(_NoticePart.NoticePart,{key:r,part:o,message:s,turn:a})},sameMessage=(e,t)=>e.signature===t.signature&&e.message.id===t.message.id&&e.message.rating===t.message.rating&&e.message.stored===t.message.stored&&e.groupPosition===t.groupPosition&&e.isLast===t.isLast&&e.handoffSettled===t.handoffSettled&&e.isLastVisitor===t.isLastVisitor&&e.thinking===t.thinking&&e.streaming===t.streaming&&e.pickAttachments===t.pickAttachments&&e.labels===t.labels&&e.all===t.all&&e.layoutParts===t.layoutParts&&e.chat.session===t.chat.session&&e.chat.features===t.chat.features&&e.chat.onNavigate===t.chat.onNavigate&&e.onNavigate===t.onNavigate&&e.onOpenAttachment===t.onOpenAttachment&&e.onOpenTarget===t.onOpenTarget&&e.openTicket===t.openTicket&&e.resolveLink===t.resolveLink&&e.focusComposer===t.focusComposer&&e.byline===t.byline&&e.avatar===t.avatar&&e.replyAvatars===t.replyAvatars&&e.avatarStart===t.avatarStart&&e.handoffHosts===t.handoffHosts;function ThreadMessageView({chat:e,message:t,labels:s,all:a,layoutParts:i,groupPosition:r,isLast:n,isLastVisitor:o,pickAttachments:l,onOpenAttachment:c,onOpenTarget:u,onNavigate:d,openTicket:m,handoffHosts:g,resolveLink:h,focusComposer:p,byline:_,avatar:x,replyAvatars:y,avatarStart:f,sourceRows:j,testID:v}){const T=(0,_mobileUi.useTheme)(),b=Object.assign((0,_chatCore.createTurnApi)(e.session,{messageId:t.id,labels:s,openAttachment:c,openTarget:u??_chatShared.defaultOpenTarget,onNavigate:d??e.onNavigate,openTicket:m,handoffHosts:g,openCitation:e=>{return t=String(e),void(0,_chatShared.focusForAccessibility)(j.current.get(t));var t}}),{resolveLink:h,focusComposer:p,registerSourceRow:(e,t)=>{t?j.current.set(e,t):j.current.delete(e)}});let A=0;const nextSlot=()=>(A+=1,A),k=(0,_jsxRuntime.jsx)(_ChatMessageActions.ChatMessageActions,{chat:e,message:t,labels:s,isLast:n,isLastVisitor:o,testID:`${v}-actions`});if(MINE.has(t.author.kind)){const e=t.parts.filter(e=>"File"===e.kind),i=(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{gap:T.space.xs},children:[e.map(e=>renderPart(a,e,t,b,l,`${t.id}-file-${nextSlot()}`)),k]});return(0,_jsxRuntime.jsx)(_mobileUi.MessageBubble,{side:"mine",text:joinedText(t.parts),labels:{you:s.you},groupPosition:r,footer:i,testID:v})}const N="Agent"===t.author.kind,R=t.author.displayName||s.agent,w=(i?i(t):t.parts).map(e=>Array.isArray(e)?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row",flexWrap:"wrap",gap:T.space.xs},children:e.map(e=>renderPart(a,e,t,b,l,`${t.id}-part-${nextSlot()}`))},`${t.id}-group-${nextSlot()}`):renderPart(a,e,t,b,l,`${t.id}-item-${nextSlot()}`)),P=N&&_?(0,_jsxRuntime.jsx)(_AgentByline.AgentByline,{author:t.author,labels:s,showAvatar:y},`${t.id}-byline`):null,M=P?[P,...w]:w,S=(0,_chatCore.messagePlainText)(t.parts),C=(0,_jsxRuntime.jsx)(_mobileUi.MessageBubble,{side:"theirs",author:N?void 0:t.author.displayName||s.assistant,text:N?`${s.agentSays(R)} ${S}`:S,streaming:t.streaming,groupPosition:r,footer:k,testID:v,children:M});if(!y||!x||"Assistant"!==t.author.kind)return C;const I=t.author.displayName||s.assistant;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flexDirection:"row",alignItems:"flex-end",gap:T.space.xs},children:[(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:f?void 0:{opacity:0},children:(0,_jsxRuntime.jsx)(_mobileUi.Avatar,{size:"xs",name:I,source:f?{uri:x}:void 0})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flex:1,minWidth:0},children:C})]})}const ThreadMessage=(0,_react.memo)(ThreadMessageView,sameMessage),TYPING_ORB_MARK=14,TYPING_ASSISTANT_MARK=8,TypingMark=({size:e})=>{const t=(0,_mobileUi.useTheme)();return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:e,height:e,borderRadius:t.radius.pill,backgroundColor:t.colors.primary}})},TYPING_DOT=6,TypingDots=()=>{const e=(0,_mobileUi.useTheme)();return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row",alignItems:"center",gap:e.space.xxs},children:[0,1,2].map(t=>(0,_jsxRuntime.jsx)(_reactNative.View,{style:{width:6,height:6,borderRadius:3,backgroundColor:e.colors["text-muted"]}},t))})},TurnGap=()=>{const e=(0,_mobileUi.useTheme)();return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:e.space.lg}})},followNew=()=>!0;function ChatThread({chat:e,labels:t,renderers:s,layoutParts:a,loader:i="Steps",motion:r="On",avatar:n,replyAvatars:o=!0,pickAttachments:l,onOpenAttachment:c,onOpenTarget:u,onNavigate:d,openTicket:m,handoffHosts:g,resolveLink:h,focusComposer:p,keyboardAware:_,keyboardOffset:x,empty:y,style:f,testID:j="chat-thread"}){const v=(0,_mobileUi.useTheme)(),T=(0,_react.useMemo)(()=>({..._index.defaultRenderers,...s}),[s]),b=e.messages[0],A=e.greeting??"",k=(0,_react.useMemo)(()=>""!==A&&void 0!==b&&MINE.has(b.author.kind)?{...b,id:"greeting",author:{...b.author,kind:"Assistant",displayName:null,avatarUrl:null},parts:[{kind:"Text",text:A}],stored:!1,streaming:!1,restored:!1,rating:null}:null,[A,b]),N=(0,_react.useMemo)(()=>{const t=e.messages.filter(e=>!(e.streaming&&0===e.parts.length)).reverse();return k?[...t,k]:t},[e.messages,k]),R=e.messages[e.messages.length-1]?.id,w=(0,_react.useRef)(new Map),P=(0,_react.useRef)(null);(0,_react.useEffect)(()=>{if(null!==P.current)for(const s of e.messages){if(MINE.has(s.author.kind)||s.streaming||s.restored||P.current.has(s.id))continue;if("Agent"===s.author.kind&&!s.stored)continue;P.current.add(s.id);const e=(0,_chatCore.messagePlainText)(s.parts);""!==e&&_reactNative.AccessibilityInfo.announceForAccessibility("Agent"===s.author.kind?`${t.agentSays(s.author.displayName||t.agent)} ${e}`:e)}else P.current=new Set(e.messages.map(e=>e.id))},[e.messages,t]);const M=(0,_react.useMemo)(()=>{for(let t=e.messages.length-1;t>=0;t-=1){const s=e.messages[t];if(s?.stored&&"Visitor"===s.author.kind)return s.id}},[e.messages]),S=(0,_react.useMemo)(()=>{const t=new Set;return e.messages.forEach((s,a)=>{if("Agent"!==s.author.kind)return;const i=e.messages[a-1];"Agent"===i?.author.kind&&(i.author.displayName||"")===(s.author.displayName||"")||t.add(s.id)}),t},[e.messages]),C=(0,_react.useMemo)(()=>{const t=new Set,s=e.messages.filter(e=>!(e.streaming&&0===e.parts.length));return k&&t.add(k.id),s.forEach((e,a)=>{"Assistant"===e.author.kind&&"Assistant"!==s[a-1]?.author.kind&&t.add(e.id)}),t},[e.messages,k]),I=(0,_react.useMemo)(()=>(0,_chatCore.handoffSettledIds)(e.messages),[e.messages]),L=e.turnError,V="daily_limit"===L?.code,$=null!==L&&/feature_off$/.test(L.code),D=V&&L?.resetsDateTimeUtc?` ${t.dailyLimitRefresh((0,_chatCore.formatChatDateTime)(L.resetsDateTimeUtc))}`:"",O=e.streaming||null===L&&!e.stopped?null:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{gap:v.space.xs},testID:`${j}-error`,children:[null!==L?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"bodySmall",color:"danger",accessibilityRole:V?void 0:"alert",accessibilityLiveRegion:V?"polite":void 0,children:`${L.message}${D}`}):(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"bodySmall",color:"danger",accessibilityLiveRegion:"polite",children:t.stopped}),!e.features.Retry||V||$?null:(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row"},children:(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:t.retry,variant:"link",size:"sm",onPress:()=>{e.retry()},testID:`${j}-retry`})})]}),U=e.thinking&&null!==e.profile?(0,_jsxRuntime.jsx)(_ChatLoader.ChatLoader,{style:i,steps:e.steps,phrases:e.profile.experience.pacing.thinkingPhrases,intervalMs:e.profile.experience.pacing.phraseIntervalMs,announce:t.preparingAnswer(e.profile.assistant.name),motion:r}):null,E=!0===e.pending?.typing?(0,_jsxRuntime.jsx)(_TypingPill.TypingPill,{motion:r,mark:(0,_jsxRuntime.jsx)(TypingMark,{size:"Orb"===i?TYPING_ORB_MARK:TYPING_ASSISTANT_MARK})}):null,q=null!==e.agentTyping&&"WithAgent"===e.conversationState?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{gap:v.space.xs,alignSelf:"flex-start"},children:[(0,_jsxRuntime.jsx)(_TypingPill.TypingPill,{motion:r,mark:(0,_jsxRuntime.jsx)(TypingDots,{})}),(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",accessibilityLiveRegion:"polite",children:t.agentTyping(e.agentTyping.displayName||t.agent)})]}):null,B=E||U||O||q?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{gap:v.space.sm},children:[E,U,q,O]}):void 0;return(0,_jsxRuntime.jsx)(_mobileUi.MessageList,{messages:N,keyExtractor:e=>e.id,renderMessage:({item:s,groupPosition:i})=>(0,_jsxRuntime.jsx)(_ChatEntrance.ChatEntrance,{animate:!s.restored,children:(0,_jsxRuntime.jsx)(ThreadMessage,{chat:e,message:s,signature:(0,_chatShared.messageSignature)(s),labels:t,all:T,layoutParts:a,groupPosition:i,isLast:s.id===R,isLastVisitor:s.id===M,handoffSettled:I.has(s.id),thinking:e.thinking,streaming:e.streaming,pickAttachments:l,onOpenAttachment:c,onOpenTarget:u,onNavigate:d,openTicket:m,handoffHosts:g,resolveLink:h,focusComposer:p,byline:S.has(s.id),avatar:n,replyAvatars:o,avatarStart:C.has(s.id),sourceRows:w,testID:`${j}-${s.id}`})}),getAuthorKey:e=>e.author.kind,getDate:e=>e.createdDateTimeUtc,followNew:followNew,typing:B,empty:y,ItemSeparatorComponent:TurnGap,keyboardAware:_,keyboardOffset:x,accessibilityLabel:t.thread,style:f,testID:j})}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.QuickRepliesPart=QuickRepliesPart;var _chatCore=require("@webority/chat-core"),_mobileUi=require("@webority/mobile-ui"),_reactNative=require("react-native"),_ChatEntrance=require("../ChatEntrance.js"),_chatShared=require("../chatShared.js"),_jsxRuntime=require("react/jsx-runtime");const QUIET_LOOK={variant:"outline"};function lookOf(e){switch(e){case"Primary":case"Cta":return{variant:"solid",tone:"primary"};default:return QUIET_LOOK}}function QuickRepliesPart({part:e,turn:i}){const t=(0,_mobileUi.useTheme)();if(!i.features.SuggestedReplies||!i.isLast||i.busy||0===e.replies.length)return null;const n=i.openTarget,a=i.onNavigate,r=void 0!==n&&n!==_chatShared.defaultOpenTarget,s="Composer"===e.placement,o=e.replies.filter(e=>"Send"===e.action||"Open"===e.action&&e.target&&n||"Navigate"===e.action&&i.features.LinkHandoff);if(0===o.length)return null;const l=s?void 0:o.find(e=>e.id===_chatCore.CHAT_HANDOFF_REQUEST_ID&&"Send"===e.action),c=l?o.filter(e=>e!==l):o,u=l?1:0,sendChip=(e,t)=>(0,_jsxRuntime.jsx)(_mobileUi.Chip,{label:e.label,variant:t.variant,tone:t.tone,leftIcon:e.icon?e.icon:void 0,onPress:()=>{i.chooseQuickReply(e),i.focusComposer?.()}});return(0,_jsxRuntime.jsxs)(_reactNative.View,{accessibilityRole:"summary",accessibilityLabel:i.labels.quickReplies,accessibilityLiveRegion:i.handoffPause?"polite":void 0,style:{flexDirection:"row",flexWrap:"wrap",gap:t.space.xs,...s?{paddingHorizontal:t.space.md}:null},children:[l?(0,_jsxRuntime.jsx)(_ChatEntrance.ChatEntrance,{index:0,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flexBasis:"100%",alignItems:"flex-start",gap:t.space.xs},children:[(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"label",children:l.label}),sendChip(l,lookOf("Primary"))]})},l.id):null,c.map((e,t)=>{const s=t+u,o=l?QUIET_LOOK:lookOf(e.variant),c=e.icon?e.icon:void 0;if("Send"===e.action)return(0,_jsxRuntime.jsx)(_ChatEntrance.ChatEntrance,{index:s,children:sendChip(e,o)},e.id);const d=e.target;if("Open"===e.action&&d&&n)return(0,_jsxRuntime.jsx)(_ChatEntrance.ChatEntrance,{index:s,children:(0,_jsxRuntime.jsx)(_mobileUi.Chip,{label:e.label,variant:o.variant,tone:o.tone,leftIcon:c,onPress:()=>n(d)})},e.id);if("Navigate"===e.action){const t=(e=>{if(!e)return null;if((0,_chatCore.isHandoffTarget)(e,i.handoffHosts))return e;const t=i.resolveLink?.(e);return"string"==typeof t&&""!==t?t:null})(d),l=null===t?void 0:(e=>e.startsWith("/")?n&&r?()=>n(e):a?()=>a(e):void 0:n?()=>n(e):void 0)(t);return null===t||void 0===l?(0,_jsxRuntime.jsx)(_ChatEntrance.ChatEntrance,{index:s,children:(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"bodySmall",color:"primary",children:e.label})},e.id):(0,_jsxRuntime.jsx)(_ChatEntrance.ChatEntrance,{index:s,children:(0,_jsxRuntime.jsx)(_mobileUi.Chip,{label:i.handoffPause?i.labels.handoffMoment:e.label,variant:i.handoffPause?QUIET_LOOK.variant:o.variant,tone:i.handoffPause?void 0:o.tone,leftIcon:c,disabled:i.handoffPause,onPress:()=>i.beginHandoff(e,l)})},e.id)}return null})]})}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.QuickRepliesPart=QuickRepliesPart;var _chatCore=require("@webority/chat-core"),_mobileUi=require("@webority/mobile-ui"),_reactNative=require("react-native"),_ChatEntrance=require("../ChatEntrance.js"),_chatShared=require("../chatShared.js"),_chipLook=require("./chipLook.js"),_jsxRuntime=require("react/jsx-runtime");const QUIET_LOOK={variant:"outline"};function QuickRepliesPart({part:e,turn:i}){const t=(0,_mobileUi.useTheme)();if(!i.features.SuggestedReplies||!i.isLast||i.busy||0===e.replies.length)return null;const n=i.openTarget,a=i.onNavigate,r=void 0!==n&&n!==_chatShared.defaultOpenTarget,o="Composer"===e.placement,s=e.replies.filter(e=>"Send"===e.action||"Open"===e.action&&e.target&&n||"Navigate"===e.action&&i.features.LinkHandoff);if(0===s.length)return null;const l=o?void 0:s.find(e=>e.id===_chatCore.CHAT_HANDOFF_REQUEST_ID&&"Send"===e.action),c=l?s.filter(e=>e!==l):s,u=l?1:0,sendChip=(e,t)=>(0,_jsxRuntime.jsx)(_mobileUi.Chip,{label:e.label,variant:t.variant,tone:t.tone,leftIcon:e.icon?e.icon:void 0,onPress:()=>{i.chooseQuickReply(e),i.focusComposer?.()}});return(0,_jsxRuntime.jsxs)(_reactNative.View,{accessibilityRole:"summary",accessibilityLabel:i.labels.quickReplies,accessibilityLiveRegion:i.handoffPause?"polite":void 0,style:{flexDirection:"row",flexWrap:"wrap",gap:t.space.xs,...o?{paddingHorizontal:t.space.md}:null},children:[l?(0,_jsxRuntime.jsx)(_ChatEntrance.ChatEntrance,{index:0,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flexBasis:"100%",alignItems:"flex-start",gap:t.space.xs},children:[(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"label",children:l.label}),sendChip(l,(0,_chipLook.chipLook)("Primary"))]})},l.id):null,c.map((e,t)=>{const o=t+u,s=l?QUIET_LOOK:(0,_chipLook.chipLook)(e.variant),c=e.icon?e.icon:void 0;if("Send"===e.action)return(0,_jsxRuntime.jsx)(_ChatEntrance.ChatEntrance,{index:o,children:sendChip(e,s)},e.id);const d=e.target;if("Open"===e.action&&d&&n)return(0,_jsxRuntime.jsx)(_ChatEntrance.ChatEntrance,{index:o,children:(0,_jsxRuntime.jsx)(_mobileUi.Chip,{label:e.label,variant:s.variant,tone:s.tone,leftIcon:c,onPress:()=>n(d)})},e.id);if("Navigate"===e.action){const t=(e=>{if(!e)return null;if((0,_chatCore.isHandoffTarget)(e,i.handoffHosts))return e;const t=i.resolveLink?.(e);return"string"==typeof t&&""!==t?t:null})(d),l=null===t?void 0:(e=>e.startsWith("/")?n&&r?()=>n(e):a?()=>a(e):void 0:n?()=>n(e):void 0)(t);return null===t||void 0===l?(0,_jsxRuntime.jsx)(_ChatEntrance.ChatEntrance,{index:o,children:(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"bodySmall",color:"primary",children:e.label})},e.id):(0,_jsxRuntime.jsx)(_ChatEntrance.ChatEntrance,{index:o,children:(0,_jsxRuntime.jsx)(_mobileUi.Chip,{label:i.handoffPause?i.labels.handoffMoment:e.label,variant:i.handoffPause?QUIET_LOOK.variant:s.variant,tone:i.handoffPause?void 0:s.tone,leftIcon:c,disabled:i.handoffPause,onPress:()=>i.beginHandoff(e,l)})},e.id)}return null})]})}
@@ -0,0 +1 @@
1
+ "use strict";function chipLook(e){switch(e){case"Primary":case"Cta":return{variant:"solid",tone:"primary"};default:return{variant:"outline"}}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.chipLook=chipLook;
@@ -1 +1 @@
1
- "use strict";import{Avatar,Text,useTheme}from"@webority/mobile-ui";import{View}from"react-native";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export function AgentByline({author:e,labels:t}){const r=useTheme(),i=e.displayName||t.agent,a=e.avatarUrl?{uri:e.avatarUrl}:void 0;return _jsxs(View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{flexDirection:"row",alignItems:"center",gap:r.space.xs},children:[_jsx(Avatar,{size:"xs",name:i,source:a}),_jsx(Text,{variant:"caption",color:"secondary",children:i}),_jsx(Text,{variant:"caption",color:"tertiary",children:t.agent})]})}
1
+ "use strict";import{Avatar,Text,useTheme}from"@webority/mobile-ui";import{View}from"react-native";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export function AgentByline({author:e,labels:t,showAvatar:r=!0}){const a=useTheme(),i=e.displayName||t.agent,s=e.avatarUrl?{uri:e.avatarUrl}:void 0;return _jsxs(View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:{flexDirection:"row",alignItems:"center",gap:a.space.xs},children:[r?_jsx(Avatar,{size:"xs",name:i,source:s}):null,_jsx(Text,{variant:"caption",color:"secondary",children:i}),_jsx(Text,{variant:"caption",color:"tertiary",children:t.agent})]})}
@@ -1 +1 @@
1
- "use strict";import{defaultChatLook}from"@webority/chat-core";import{Permissions}from"@webority/mobile-core/permissions";import{Banner,Chip,Composer,IconButton,ProgressBar,Text,useTheme}from"@webority/mobile-ui";import{useEffect,useMemo,useRef,useState}from"react";import{StyleSheet,View}from"react-native";import{ChatDictationButton}from"./ChatDictationButton.js";import{ChatFooter}from"./ChatFooter.js";import{joinDictation}from"./speech/speechText.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const ALLOWANCE_SHOWN_AT=10,COUNTER_AT=.9,DEFAULT_MAX_LENGTH=4e3,openQuestion=e=>{for(let t=e.length-1;t>=0;t-=1){const s=e[t];for(const e of[...s?.parts??[]].reverse())if("InputRequest"===e.kind&&"Open"===e.state)return e.fields[0]?.label||e.title||null}return null};export function ChatComposer({chat:e,labels:t,pickAttachments:s,keyboardOffset:a,keyboardAware:o,safeArea:n,testID:i="chat-composer",focusRef:r,look:l=defaultChatLook}){const c=useTheme(),u=useMemo(()=>buildStyles(c),[c]),[m,p]=useState(""),[h,d]=useState(null),f=e.editing,g=useRef(null),x=useRef(null);useEffect(()=>{if(r)return r.current=()=>x.current?.focus(),()=>{r.current=null}},[r]),useEffect(()=>{f&&g.current?.(),p(f?f.text:"")},[f]);const b=e.attachments,y=b.some(e=>"Uploading"===e.status),v=b.some(e=>"Ready"===e.status),j=e.messagesLeftToday,_=e.profile?.limits.maxMessageLength??4e3,S=void 0!==s&&e.features.Attachments&&(e.profile?.limits.maxAttachments??0)>0,w=e.features.HumanHandoff&&("WaitingForAgent"===e.conversationState||"WithAgent"===e.conversationState),A=S&&!e.handoffPause?_jsx(IconButton,{icon:"paperclip",accessibilityLabel:t.attach,variant:"ghost",tone:"neutral",onPress:()=>{s&&s().then(t=>e.attach(t))},testID:`${i}-attach`}):void 0,C=f?_jsx(Banner,{message:t.editing,accessibilityRole:"summary",actions:[{label:t.cancel,onPress:()=>e.cancelEdit()}],testID:`${i}-editing`}):null,T=b.length>0?_jsx(View,{style:u.tray,testID:`${i}-attachments`,children:_jsx(View,{style:u.row,children:b.map(s=>_jsxs(View,{style:u.item,children:[_jsx(Chip,{label:s.fileName,variant:"soft",onRemove:()=>{e.removeAttachment(s.key)},labels:{remove:t.removeAttachment},removeTestID:`${i}-remove-${s.key}`,testID:`${i}-chip-${s.key}`}),"Uploading"===s.status?_jsx(ProgressBar,{progress:s.progress??void 0,label:t.attachmentUploading,height:4,containerStyle:u.progress}):null,"Failed"===s.status?_jsx(Text,{variant:"caption",color:"danger",accessibilityLiveRegion:"polite",children:s.error??t.attachmentFailed}):null]},s.key))})}):null,D=null!==j&&j<=10?_jsx(Text,{variant:"caption",color:0===j?"danger":"secondary",accessibilityLiveRegion:"polite",testID:`${i}-allowance`,children:t.allowance(j)}):null,L=h?_jsx(Banner,{message:h.message,tone:h.tone,dismissible:!0,onClose:()=>d(null),actions:h.openSettings?[{label:t.dictateOpenSettings,onPress:()=>{Permissions.openSettings()}}]:void 0,testID:`${i}-voice-notice`}):null,R=m.length>0,k=m.length>.9*_?_jsx(Text,{variant:"caption",color:"secondary",testID:`${i}-counter`,children:t.counter(m.length,_)}):null,I=C||T||D||k||L?_jsxs(_Fragment,{children:[C,T,D,k,L]}):void 0,P=!y&&(!!v||void 0);return _jsx(Composer,{ref:x,onSend:t=>{g.current?.(),e.submit(t)},value:m,onChangeText:t=>{g.current?.(),p(t),w&&t.length>0&&e.notifyTyping()},loading:e.streaming&&e.features.Stop,ring:l.input.ring&&(R||e.streaming),sendReveal:"Always"===l.input.sendReveal?"always":"onText",onStop:e.features.Stop?()=>e.stop():void 0,stopLabel:t.stop,disabled:0===j||e.handoffPause,maxLength:_,canSend:P,placeholder:e.handoffPause?t.handoffMoment:openQuestion(e.messages)??t.placeholder,accessibilityLabel:t.composer,labels:{send:t.send},leading:A,trailing:_jsx(ChatDictationButton,{chat:e,labels:t,disabled:0===j||e.handoffPause,onText:e=>p(t=>joinDictation(t,e,_)),onNotice:d,stopRef:g}),above:I,below:_jsx(ChatFooter,{chat:e,labels:t}),keyboardAware:o,keyboardOffset:a,safeArea:n,testID:i})}const buildStyles=e=>StyleSheet.create({tray:{gap:e.space.xs},row:{flexDirection:"row",flexWrap:"wrap",gap:e.space.xs},item:{gap:e.space.xxs,maxWidth:"100%"},progress:{minWidth:120}});
1
+ "use strict";import{defaultChatLook}from"@webority/chat-core";import{Permissions}from"@webority/mobile-core/permissions";import{Banner,Chip,Composer,IconButton,ProgressBar,Text,useTheme}from"@webority/mobile-ui";import{useEffect,useMemo,useRef,useState}from"react";import{StyleSheet,View}from"react-native";import{ChatDictationButton}from"./ChatDictationButton.js";import{ChatFooter}from"./ChatFooter.js";import{joinDictation}from"./speech/speechText.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const ALLOWANCE_SHOWN_AT=10,COUNTER_AT=.9,DEFAULT_MAX_LENGTH=4e3,openQuestion=e=>{for(let t=e.length-1;t>=0;t-=1){const s=e[t];for(const e of[...s?.parts??[]].reverse())if("InputRequest"===e.kind&&"Open"===e.state)return e.fields[0]?.label||e.title||null}return null};export function ChatComposer({chat:e,labels:t,pickAttachments:s,keyboardOffset:o,keyboardAware:a,safeArea:n,testID:i="chat-composer",focusRef:r,look:l=defaultChatLook,sendIcon:c}){const u=useTheme(),m=useMemo(()=>buildStyles(u),[u]),[p,d]=useState(""),[h,f]=useState(null),g=e.editing,x=useRef(null),b=useRef(null);useEffect(()=>{if(r)return r.current=()=>b.current?.focus(),()=>{r.current=null}},[r]),useEffect(()=>{g&&x.current?.(),d(g?g.text:"")},[g]);const y=e.attachments,v=y.some(e=>"Uploading"===e.status),j=y.some(e=>"Ready"===e.status),_=e.messagesLeftToday,S=e.profile?.limits.maxMessageLength??4e3,w=void 0!==s&&e.features.Attachments&&(e.profile?.limits.maxAttachments??0)>0,A=e.features.HumanHandoff&&("WaitingForAgent"===e.conversationState||"WithAgent"===e.conversationState),C=w&&!e.handoffPause?_jsx(IconButton,{icon:"paperclip",accessibilityLabel:t.attach,variant:"ghost",tone:"neutral",onPress:()=>{s&&s().then(t=>e.attach(t))},testID:`${i}-attach`}):void 0,T=g?_jsx(Banner,{message:t.editing,accessibilityRole:"summary",actions:[{label:t.cancel,onPress:()=>e.cancelEdit()}],testID:`${i}-editing`}):null,D=y.length>0?_jsx(View,{style:m.tray,testID:`${i}-attachments`,children:_jsx(View,{style:m.row,children:y.map(s=>_jsxs(View,{style:m.item,children:[_jsx(Chip,{label:s.fileName,variant:"soft",onRemove:()=>{e.removeAttachment(s.key)},labels:{remove:t.removeAttachment},removeTestID:`${i}-remove-${s.key}`,testID:`${i}-chip-${s.key}`}),"Uploading"===s.status?_jsx(ProgressBar,{progress:s.progress??void 0,label:t.attachmentUploading,height:4,containerStyle:m.progress}):null,"Failed"===s.status?_jsx(Text,{variant:"caption",color:"danger",accessibilityLiveRegion:"polite",children:s.error??t.attachmentFailed}):null]},s.key))})}):null,I=null!==_&&_<=10?_jsx(Text,{variant:"caption",color:0===_?"danger":"secondary",accessibilityLiveRegion:"polite",testID:`${i}-allowance`,children:t.allowance(_)}):null,L=h?_jsx(Banner,{message:h.message,tone:h.tone,dismissible:!0,onClose:()=>f(null),actions:h.openSettings?[{label:t.dictateOpenSettings,onPress:()=>{Permissions.openSettings()}}]:void 0,testID:`${i}-voice-notice`}):null,R=p.length>0,k=p.length>.9*S?_jsx(Text,{variant:"caption",color:"secondary",testID:`${i}-counter`,children:t.counter(p.length,S)}):null,P=T||D||I||k||L?_jsxs(_Fragment,{children:[T,D,I,k,L]}):void 0,B=!v&&(!!j||void 0);return _jsx(Composer,{ref:b,onSend:t=>{x.current?.(),e.submit(t)},value:p,onChangeText:t=>{x.current?.(),d(t),A&&t.length>0&&e.notifyTyping()},loading:e.streaming&&e.features.Stop,ring:l.input.ring&&(R||e.streaming),sendReveal:"Always"===l.input.sendReveal?"always":"onText",sendIcon:c||void 0,onStop:e.features.Stop?()=>e.stop():void 0,stopLabel:t.stop,disabled:0===_||e.handoffPause,maxLength:S,canSend:B,placeholder:e.handoffPause?t.handoffMoment:openQuestion(e.messages)??t.placeholder,accessibilityLabel:t.composer,labels:{send:t.send},leading:C,trailing:_jsx(ChatDictationButton,{chat:e,labels:t,disabled:0===_||e.handoffPause,onText:e=>d(t=>joinDictation(t,e,S)),onNotice:f,stopRef:x}),above:P,below:_jsx(ChatFooter,{chat:e,labels:t}),keyboardAware:a,keyboardOffset:o,safeArea:n,testID:i})}const buildStyles=e=>StyleSheet.create({tray:{gap:e.space.xs},row:{flexDirection:"row",flexWrap:"wrap",gap:e.space.xs},item:{gap:e.space.xxs,maxWidth:"100%"},progress:{minWidth:120}});
@@ -1 +1 @@
1
- "use strict";import{mergeLook}from"@webority/chat-core";import{Banner,IconButton,Spinner,Text,useReducedMotion,useTheme}from"@webority/mobile-ui";import{useMemo,useRef,useState}from"react";import{View}from"react-native";import{ChatComposer}from"./ChatComposer.js";import{ChatConversationActions}from"./ChatConversationActions.js";import{ChatHistory}from"./ChatHistory.js";import{ChatLiveBar}from"./ChatLiveBar.js";import{ChatPanelGrow,ChatReveal,panelRun}from"./ChatPanel.js";import{ChatStarters}from"./ChatStarters.js";import{ChatThread}from"./ChatThread.js";import{useChatHaptics}from"./useChatHaptics.js";import{useChatSound}from"./useChatSound.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export function ChatFrame({chat:e,labels:t,renderers:s,layoutParts:o,loader:r="Steps",look:a,pickAttachments:n,onOpenAttachment:i,onOpenTarget:l,onNavigate:c,openTicket:h,handoffHosts:m,resolveLink:u,keyboardOffset:d,layout:p,title:f,headerActions:C,onClose:x,enterKey:j=0,testID:y="chat-frame"}){const b=useTheme(),g=useMemo(()=>mergeLook(a),[a]),v=useReducedMotion(),_="Reduced"===g.motion||v,I="embedded"===p?"None":g.panel.motion,k="sheet"===p?"sheet":"screen",w=useMemo(()=>panelRun({motion:I,reduced:_,mode:k,run:j}),[I,_,k,j]),[D,R]=useState(!1),S=D&&!0===e.features.History;useChatHaptics(e),useChatSound(e);const T="sheet"!==p,B=null!==e.profile,$=useRef(null);if(B&&!e.features.VisitorChat)return null;const L=e.messages.length>0,A=e.messages.some(e=>"Visitor"===e.author.kind||"Customer"===e.author.kind),H="screen"===p||A,O=!0===e.profile?.experience.sound.muteControl&&e.features.Sounds,P=_jsxs(View,{style:{flexDirection:"row",alignItems:"center",gap:b.space.sm,paddingHorizontal:b.space.md,paddingVertical:b.space.sm,borderBottomWidth:1,borderBottomColor:b.colors["border-subtle"]},children:[_jsxs(View,{style:{flex:1,minWidth:0},children:[_jsx(Text,{variant:"title",accessibilityRole:"header",numberOfLines:1,children:f??e.profile?.assistant.name??t.panelTitle}),_jsx(Text,{variant:"caption",color:"secondary",children:t.headerStatus})]}),C,S?null:_jsx(ChatConversationActions,{chat:e,labels:t,testID:`${y}-conversation-actions`}),e.features.History?_jsx(IconButton,{icon:S?"arrow-left":"history",variant:"ghost",tone:"neutral",accessibilityLabel:S?t.backToChat:t.history,onPress:()=>R(e=>!e),testID:`${y}-history`}):null,O?_jsx(IconButton,{icon:e.muted?"volume-mute":"volume-high",variant:"ghost",tone:"neutral",accessibilityLabel:e.muted?t.unmuteSounds:t.muteSounds,onPress:()=>e.session.setMuted(!e.muted),testID:`${y}-mute`}):null,S||!H?null:_jsx(IconButton,{icon:"plus",variant:"ghost",tone:"neutral",accessibilityLabel:t.newChat,disabled:e.streaming||e.thinking,onPress:()=>e.newConversation(),testID:`${y}-new`}),x?_jsx(IconButton,{icon:"x",variant:"ghost",tone:"neutral",accessibilityLabel:t.close,onPress:x,testID:`${y}-close`}):null]});let V;return V=S?_jsx(ChatHistory,{chat:e,labels:t,onOpen:()=>R(!1),testID:`${y}-history-list`}):e.profileError?_jsx(Banner,{tone:"danger",message:e.profileError.message,accessibilityRole:"alert",testID:`${y}-profile-error`}):!B||e.loading?_jsx(View,{style:{flex:1,alignItems:"center",justifyContent:"center"},children:_jsx(Spinner,{message:t.loadingConversation,testID:`${y}-loading`})}):e.loadError?_jsx(Banner,{tone:"danger",message:e.loadError.message,accessibilityRole:"alert",testID:`${y}-load-error`}):L?_jsx(ChatThread,{chat:e,labels:t,renderers:s,layoutParts:o,loader:r,motion:g.motion,pickAttachments:n,onOpenAttachment:i,onOpenTarget:l,onNavigate:c,openTicket:h,handoffHosts:m,resolveLink:u,focusComposer:()=>$.current?.(),keyboardAware:T,keyboardOffset:d,style:{flex:1},testID:`${y}-thread`}):_jsx(ChatStarters,{chat:e,labels:t,openTicket:h,testID:`${y}-starters`}),_jsx(ChatPanelGrow,{grow:w.grow,children:_jsxs(View,{style:{flex:1},testID:y,children:[_jsx(ChatReveal,{plan:w.reveal.header,children:P}),S?null:_jsx(ChatLiveBar,{chat:e,labels:t,testID:`${y}-live`}),_jsx(ChatReveal,{plan:w.reveal.body,flex:!0,children:_jsx(View,{style:{flex:1},children:V})}),S?null:_jsx(ChatReveal,{plan:w.reveal.composer,children:_jsx(ChatComposer,{chat:e,labels:t,look:g,pickAttachments:n,keyboardOffset:d,keyboardAware:T,focusRef:$,testID:`${y}-composer`})})]})})}
1
+ "use strict";import{mergeLook}from"@webority/chat-core";import{Avatar,Banner,IconButton,Spinner,Text,useReducedMotion,useTheme}from"@webority/mobile-ui";import{useMemo,useRef,useState}from"react";import{View}from"react-native";import{ChatComposer}from"./ChatComposer.js";import{ChatConversationActions}from"./ChatConversationActions.js";import{ChatHistory}from"./ChatHistory.js";import{ChatLiveBar}from"./ChatLiveBar.js";import{ChatPanelGrow,ChatReveal,panelRun}from"./ChatPanel.js";import{ChatStarters}from"./ChatStarters.js";import{ChatThread}from"./ChatThread.js";import{useChatHaptics}from"./useChatHaptics.js";import{useChatSound}from"./useChatSound.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export function ChatFrame({chat:e,labels:t,renderers:s,layoutParts:a,loader:o="Steps",look:r,pickAttachments:n,onOpenAttachment:i,onOpenTarget:l,onNavigate:c,openTicket:m,handoffHosts:h,resolveLink:u,keyboardOffset:d,layout:p,title:f,headerActions:C,onClose:x,enterKey:j=0,testID:v="chat-frame"}){const y=useTheme(),b=useMemo(()=>mergeLook(r),[r]),g=useReducedMotion(),_="Reduced"===b.motion||g,I="embedded"===p?"None":b.panel.motion,k="sheet"===p?"sheet":"screen",w=useMemo(()=>panelRun({motion:I,reduced:_,mode:k,run:j}),[I,_,k,j]),[A,D]=useState(!1),T=A&&!0===e.features.History;useChatHaptics(e),useChatSound(e);const R="sheet"!==p,S=null!==e.profile,L=useRef(null);if(S&&!e.features.VisitorChat)return null;const B=e.messages.length>0,$=e.messages.some(e=>"Visitor"===e.author.kind||"Customer"===e.author.kind),H="screen"===p||$,V=!0===e.profile?.experience.sound.muteControl&&e.features.Sounds,O=_jsxs(View,{style:{flexDirection:"row",alignItems:"center",gap:y.space.sm,paddingHorizontal:y.space.md,paddingVertical:y.space.sm,borderBottomWidth:1,borderBottomColor:y.colors["border-subtle"]},children:[b.avatar?_jsx(View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:_jsx(Avatar,{size:"sm",name:e.profile?.assistant.name??t.panelTitle,source:{uri:b.avatar}})}):null,_jsxs(View,{style:{flex:1,minWidth:0},children:[_jsx(Text,{variant:"title",accessibilityRole:"header",numberOfLines:1,children:f??e.profile?.assistant.name??t.panelTitle}),_jsx(Text,{variant:"caption",color:"secondary",children:t.headerStatus})]}),C,T?null:_jsx(ChatConversationActions,{chat:e,labels:t,testID:`${v}-conversation-actions`}),e.features.History?_jsx(IconButton,{icon:T?"arrow-left":"history",variant:"ghost",tone:"neutral",accessibilityLabel:T?t.backToChat:t.history,onPress:()=>D(e=>!e),testID:`${v}-history`}):null,V?_jsx(IconButton,{icon:e.muted?"volume-mute":"volume-high",variant:"ghost",tone:"neutral",accessibilityLabel:e.muted?t.unmuteSounds:t.muteSounds,onPress:()=>e.session.setMuted(!e.muted),testID:`${v}-mute`}):null,T||!H?null:_jsx(IconButton,{icon:"plus",variant:"ghost",tone:"neutral",accessibilityLabel:t.newChat,disabled:e.streaming||e.thinking,onPress:()=>e.newConversation(),testID:`${v}-new`}),x?_jsx(IconButton,{icon:"x",variant:"ghost",tone:"neutral",accessibilityLabel:t.close,onPress:x,testID:`${v}-close`}):null]});let P;return P=T?_jsx(ChatHistory,{chat:e,labels:t,onOpen:()=>D(!1),testID:`${v}-history-list`}):e.profileError?_jsx(Banner,{tone:"danger",message:e.profileError.message,accessibilityRole:"alert",testID:`${v}-profile-error`}):!S||e.loading?_jsx(View,{style:{flex:1,alignItems:"center",justifyContent:"center"},children:_jsx(Spinner,{message:t.loadingConversation,testID:`${v}-loading`})}):e.loadError?_jsx(Banner,{tone:"danger",message:e.loadError.message,accessibilityRole:"alert",testID:`${v}-load-error`}):B?_jsx(ChatThread,{chat:e,labels:t,renderers:s,layoutParts:a,loader:o,motion:b.motion,avatar:b.avatar,replyAvatars:b.panel.replyAvatars,pickAttachments:n,onOpenAttachment:i,onOpenTarget:l,onNavigate:c,openTicket:m,handoffHosts:h,resolveLink:u,focusComposer:()=>L.current?.(),keyboardAware:R,keyboardOffset:d,style:{flex:1},testID:`${v}-thread`}):_jsx(ChatStarters,{chat:e,labels:t,openTicket:m,avatar:b.avatar,motion:b.motion,greetingLoaderMs:_?0:b.panel.greetingLoaderMs,testID:`${v}-starters`}),_jsx(ChatPanelGrow,{grow:w.grow,children:_jsxs(View,{style:{flex:1},testID:v,children:[_jsx(ChatReveal,{plan:w.reveal.header,children:O}),T?null:_jsx(ChatLiveBar,{chat:e,labels:t,testID:`${v}-live`}),_jsx(ChatReveal,{plan:w.reveal.body,flex:!0,children:_jsx(View,{style:{flex:1},children:P})}),T?null:_jsx(ChatReveal,{plan:w.reveal.composer,children:_jsx(ChatComposer,{chat:e,labels:t,look:b,sendIcon:r?.input?.sendIcon,pickAttachments:n,keyboardOffset:d,keyboardAware:R,focusRef:L,testID:`${v}-composer`})})]})})}
@@ -1 +1 @@
1
- "use strict";import{FloatingActionButton,useTheme}from"@webority/mobile-ui";import{useEffect,useState}from"react";import{Animated,Easing,StyleSheet}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{jsx as _jsx}from"react/jsx-runtime";const RISE_MS=900,RISE_DELAY_MS=400,ENTRANCE_MS=800,ENTRANCE_DELAY_MS=1e3,FLOAT_HALF_MS=1600,FLOAT_PX=4,RISE_FROM_PX=116;function entranceStyle(e,t){const range=(e,a)=>t.interpolate({inputRange:e,outputRange:a,extrapolate:"clamp"});switch(e){case"Rise":return{opacity:range([0,.4,1],[0,1,1]),transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[116,0]})}]};case"SlideUp":return{opacity:range([0,1],[0,1]),transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[100,0]})},{scale:t.interpolate({inputRange:[0,1],outputRange:[.8,1]})}]};case"BounceIn":return{transform:[{scale:range([0,.5,.7,1],[.3,1.05,.9,1])}]};case"FadeInPulse":return{opacity:range([0,.5,1],[0,1,1]),transform:[{scale:range([0,.5,1],[1,1.1,1])}]};case"SpinScale":return{transform:[{rotate:t.interpolate({inputRange:[0,1],outputRange:["-180deg","0deg"]})},{scale:t.interpolate({inputRange:[0,1],outputRange:[0,1]})}]};case"WiggleIn":return{transform:[{translateY:range([0,.4,1],[100,0,0])},{rotate:range([0,.4,.6,.8,1],["-10deg","5deg","-3deg","1deg","0deg"])}]};case"ElasticIn":return{transform:[{scale:range([0,.55,.75,1],[0,1.1,.95,1])}]};default:return{transform:[]}}}const OVERSHOOT=new Set(["Rise","SlideUp","SpinScale"]);export function ChatLauncher({look:e,label:t,side:a,offsetX:n,offsetY:s,enter:r,reduced:i,buttonRef:o,onPress:u,testID:l}){const c=useTheme(),p=useSafeAreaInsets(),m=e.launcher.entrance,[g]=useState(()=>r&&!i&&"None"!==m),f=!i&&"FloatAndPulse"===e.launcher.idle,[d]=useState(()=>new Animated.Value(g?0:1)),[S]=useState(()=>new Animated.Value(0));useEffect(()=>{if(!g)return void d.setValue(1);const e="Rise"===m,t=Animated.timing(d,{toValue:1,duration:e?900:800,delay:e?400:1e3,easing:OVERSHOOT.has(m)?Easing.bezier(.34,e?1.4:1.56,.64,1):Easing.linear,useNativeDriver:!0});return t.start(),()=>t.stop()},[g,m,d]),useEffect(()=>{if(!f)return void S.setValue(0);const e=Animated.loop(Animated.sequence([Animated.timing(S,{toValue:1,duration:1600,easing:Easing.inOut(Easing.ease),useNativeDriver:!0}),Animated.timing(S,{toValue:0,duration:1600,easing:Easing.inOut(Easing.ease),useNativeDriver:!0})]));return e.start(),()=>e.stop()},[f,S]);const R="Pill"===e.launcher.style&&!e.launcher.compact,E=c.space[c.components["floating-action-button"]["edge-offset"]]+n,A={position:"absolute",bottom:s+p.bottom,..."start"===a?{left:E}:{right:E}},h=entranceStyle(m,d);return _jsx(Animated.View,{pointerEvents:"box-none",style:StyleSheet.absoluteFill,children:_jsx(Animated.View,{style:[A,{opacity:h.opacity??1,transform:[...h.transform,{translateY:S.interpolate({inputRange:[0,1],outputRange:[0,-4]})}]}],children:_jsx(FloatingActionButton,{ref:o,icon:"messages",label:R?t:void 0,collapsed:!R,accessibilityLabel:t,onPress:u,testID:l})})})}
1
+ "use strict";import{Avatar,FloatingActionButton,useTheme}from"@webority/mobile-ui";import{useEffect,useState}from"react";import{Animated,Easing,StyleSheet}from"react-native";import{useSafeAreaInsets}from"react-native-safe-area-context";import{jsx as _jsx}from"react/jsx-runtime";const RISE_MS=900,RISE_DELAY_MS=400,ENTRANCE_MS=800,ENTRANCE_DELAY_MS=1e3,FLOAT_HALF_MS=1600,FLOAT_PX=4,RISE_FROM_PX=116;function entranceStyle(e,t){const range=(e,a)=>t.interpolate({inputRange:e,outputRange:a,extrapolate:"clamp"});switch(e){case"Rise":return{opacity:range([0,.4,1],[0,1,1]),transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[116,0]})}]};case"SlideUp":return{opacity:range([0,1],[0,1]),transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[100,0]})},{scale:t.interpolate({inputRange:[0,1],outputRange:[.8,1]})}]};case"BounceIn":return{transform:[{scale:range([0,.5,.7,1],[.3,1.05,.9,1])}]};case"FadeInPulse":return{opacity:range([0,.5,1],[0,1,1]),transform:[{scale:range([0,.5,1],[1,1.1,1])}]};case"SpinScale":return{transform:[{rotate:t.interpolate({inputRange:[0,1],outputRange:["-180deg","0deg"]})},{scale:t.interpolate({inputRange:[0,1],outputRange:[0,1]})}]};case"WiggleIn":return{transform:[{translateY:range([0,.4,1],[100,0,0])},{rotate:range([0,.4,.6,.8,1],["-10deg","5deg","-3deg","1deg","0deg"])}]};case"ElasticIn":return{transform:[{scale:range([0,.55,.75,1],[0,1.1,.95,1])}]};default:return{transform:[]}}}const OVERSHOOT=new Set(["Rise","SlideUp","SpinScale"]);export function ChatLauncher({look:e,label:t,side:a,offsetX:n,offsetY:r,enter:s,reduced:i,mark:o="Icon",avatar:u=null,buttonRef:l,onPress:c,testID:m}){const p=useTheme(),g=useSafeAreaInsets(),d=e.launcher.entrance,f="Avatar"===o&&u?u:null,S=p.components["floating-action-button"].md.diameter,[R]=useState(()=>s&&!i&&"None"!==d),A=!i&&"FloatAndPulse"===e.launcher.idle,[E]=useState(()=>new Animated.Value(R?0:1)),[v]=useState(()=>new Animated.Value(0));useEffect(()=>{if(!R)return void E.setValue(1);const e="Rise"===d,t=Animated.timing(E,{toValue:1,duration:e?900:800,delay:e?400:1e3,easing:OVERSHOOT.has(d)?Easing.bezier(.34,e?1.4:1.56,.64,1):Easing.linear,useNativeDriver:!0});return t.start(),()=>t.stop()},[R,d,E]),useEffect(()=>{if(!A)return void v.setValue(0);const e=Animated.loop(Animated.sequence([Animated.timing(v,{toValue:1,duration:1600,easing:Easing.inOut(Easing.ease),useNativeDriver:!0}),Animated.timing(v,{toValue:0,duration:1600,easing:Easing.inOut(Easing.ease),useNativeDriver:!0})]));return e.start(),()=>e.stop()},[A,v]);const _="Pill"===e.launcher.style&&!e.launcher.compact,b=p.space[p.components["floating-action-button"]["edge-offset"]]+n,h={position:"absolute",bottom:r+g.bottom,..."start"===a?{left:b}:{right:b}},y=entranceStyle(d,E);return _jsx(Animated.View,{pointerEvents:"box-none",style:StyleSheet.absoluteFill,children:_jsx(Animated.View,{style:[h,{opacity:y.opacity??1,transform:[...y.transform,{translateY:v.interpolate({inputRange:[0,1],outputRange:[0,-4]})}]}],children:_jsx(FloatingActionButton,{ref:l,icon:f?_jsx(Avatar,{dimension:S,name:t,source:{uri:f}}):"messages",label:_?t:void 0,collapsed:!_,accessibilityLabel:t,onPress:c,testID:m})})})}
@@ -1 +1 @@
1
- "use strict";import{mergeLabels,mergeLook}from"@webority/chat-core";import{BottomSheet,useReducedMotion,useTheme}from"@webority/mobile-ui";import{useEffect,useMemo,useRef,useState}from"react";import{StyleSheet,View}from"react-native";import{ChatAppearanceScope}from"./ChatAppearanceScope.js";import{ChatFrame}from"./ChatFrame.js";import{ChatLauncher}from"./ChatLauncher.js";import{ChatNudge}from"./ChatNudge.js";import{focusForAccessibility}from"./chatShared.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const DEFAULT_SNAP_POINTS=["92%"],DEFAULT_BOTTOM_OFFSET=16;export function ChatSheet({chat:e,labels:t,renderers:o,layoutParts:s,loader:n="Steps",look:r,appearance:a,pickAttachments:i,onOpenAttachment:c,onOpenTarget:l,onNavigate:u,keyboardOffset:f,open:p,defaultOpen:h=!1,onOpenChange:m,snapPoints:d=DEFAULT_SNAP_POINTS,openTicket:b,handoffHosts:g,resolveLink:C,conversationId:S,onClose:j,testID:y="chat-sheet"}){const k=useTheme(),T=mergeLabels(t),x=useMemo(()=>mergeLook(r),[r]),A=useReducedMotion(),_="Reduced"===x.motion||A,O=a?.position??"end",E=void 0!==p,L=E?p:e.open,F=useRef(null),P=useRef(!1),R=useRef(S??null),v=e.setChatVisible,N=useRef(!1),D=!N.current,[I,w]=useState(0),M=useRef(L);useEffect(()=>{L&&(N.current=!0)},[L]),useEffect(()=>{L&&!M.current&&w(e=>e+1),M.current=L},[L]),useEffect(()=>{P.current||(P.current=!0,E||!h||null===e.profile||e.open||e.session.open({trigger:"manual"}))},[E,h,e.profile,e.open,e.session]),useEffect(()=>{E&&(p&&!e.open&&e.session.open({trigger:"manual"}),!p&&e.open&&e.session.close("button"))},[E,p,e.open,e.session]);const V=useRef(L);if(useEffect(()=>{V.current&&!L&&focusForAccessibility(F.current),V.current=L},[L]),useEffect(()=>{v(L)},[v,L]),useEffect(()=>{!E&&S&&S!==R.current&&null!==e.profile&&(R.current=S,e.open||(e.session.open({trigger:"manual"}),m?.(!0)))},[E,S,e.profile,e.open,e.session,m]),null===e.profile||!e.features.VisitorChat)return null;const setOpen=t=>{t?e.session.open({trigger:"manual"}):e.session.close("button"),m?.(t)},closeSheet=()=>{setOpen(!1),j?.()},B=a?.offsetY??16;return _jsx(View,{testID:y,style:StyleSheet.absoluteFill,pointerEvents:"box-none",children:_jsxs(ChatAppearanceScope,{appearance:a,children:[L?null:_jsx(ChatLauncher,{look:x,label:T.launcher,side:O,offsetX:a?.offsetX??0,offsetY:B,enter:D,reduced:_,buttonRef:F,onPress:()=>setOpen(!0),testID:`${y}-launcher`}),_jsx(ChatNudge,{chat:e,labels:T,enabled:!L&&e.features.Nudges,onActivate:()=>setOpen(!0),bottomOffset:B,position:O,testID:`${y}-nudge`}),_jsx(BottomSheet,{open:L,onClose:closeSheet,snapPoints:d,keyboardBehavior:"shift",scrollable:!1,enablePanDownToClose:!0,enableBackdropPress:!0,accessibilityViewIsModal:!0,accessibilityLabel:T.panelTitle,children:_jsx(View,{style:{flex:1,backgroundColor:k.colors.bg},children:_jsx(ChatFrame,{chat:e,labels:T,renderers:o,layoutParts:s,loader:n,look:r,pickAttachments:i,onOpenAttachment:c,onOpenTarget:l,onNavigate:u,openTicket:b,handoffHosts:g,resolveLink:C,keyboardOffset:f,onClose:closeSheet,layout:"sheet",enterKey:I,testID:`${y}-frame`})})})]})})}
1
+ "use strict";import{mergeLabels,mergeLook}from"@webority/chat-core";import{BottomSheet,useReducedMotion,useTheme}from"@webority/mobile-ui";import{useEffect,useMemo,useRef,useState}from"react";import{StyleSheet,View}from"react-native";import{ChatAppearanceScope}from"./ChatAppearanceScope.js";import{ChatFrame}from"./ChatFrame.js";import{ChatLauncher}from"./ChatLauncher.js";import{ChatNudge}from"./ChatNudge.js";import{focusForAccessibility}from"./chatShared.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const DEFAULT_SNAP_POINTS=["92%"],DEFAULT_BOTTOM_OFFSET=16;export function ChatSheet({chat:e,labels:t,renderers:o,layoutParts:s,loader:r="Steps",look:n,appearance:a,pickAttachments:i,onOpenAttachment:l,onOpenTarget:c,onNavigate:u,keyboardOffset:f,open:p,defaultOpen:h=!1,onOpenChange:m,snapPoints:d=DEFAULT_SNAP_POINTS,openTicket:b,handoffHosts:g,resolveLink:C,conversationId:S,onClose:k,testID:j="chat-sheet"}){const y=useTheme(),x=mergeLabels(t),T=useMemo(()=>mergeLook(n),[n]),A=useReducedMotion(),_="Reduced"===T.motion||A,L=a?.position??"end",O=void 0!==p,v=O?p:e.open,E=useRef(null),F=useRef(!1),P=useRef(S??null),R=e.setChatVisible,N=useRef(!1),D=!N.current,[I,w]=useState(0),M=useRef(v);useEffect(()=>{v&&(N.current=!0)},[v]),useEffect(()=>{v&&!M.current&&w(e=>e+1),M.current=v},[v]),useEffect(()=>{F.current||(F.current=!0,O||!h||null===e.profile||e.open||e.session.open({trigger:"manual"}))},[O,h,e.profile,e.open,e.session]),useEffect(()=>{O&&(p&&!e.open&&e.session.open({trigger:"manual"}),!p&&e.open&&e.session.close("button"))},[O,p,e.open,e.session]);const V=useRef(v);if(useEffect(()=>{V.current&&!v&&focusForAccessibility(E.current),V.current=v},[v]),useEffect(()=>{R(v)},[R,v]),useEffect(()=>{!O&&S&&S!==P.current&&null!==e.profile&&(P.current=S,e.open||(e.session.open({trigger:"manual"}),m?.(!0)))},[O,S,e.profile,e.open,e.session,m]),null===e.profile||!e.features.VisitorChat)return null;const setOpen=t=>{t?e.session.open({trigger:"manual"}):e.session.close("button"),m?.(t)},closeSheet=()=>{setOpen(!1),k?.()},B=a?.offsetY??16;return _jsx(View,{testID:j,style:StyleSheet.absoluteFill,pointerEvents:"box-none",children:_jsxs(ChatAppearanceScope,{appearance:a,children:[v?null:_jsx(ChatLauncher,{look:T,label:e.profile?.experience.launcher?.hoverLabel||x.launcher,side:L,offsetX:a?.offsetX??0,offsetY:B,enter:D,reduced:_,mark:T.launcher.mark,avatar:T.avatar,buttonRef:E,onPress:()=>setOpen(!0),testID:`${j}-launcher`}),_jsx(ChatNudge,{chat:e,labels:x,enabled:!v&&e.features.Nudges,onActivate:()=>setOpen(!0),bottomOffset:B,position:L,testID:`${j}-nudge`}),_jsx(BottomSheet,{open:v,onClose:closeSheet,snapPoints:d,keyboardBehavior:"shift",scrollable:!1,enablePanDownToClose:!0,enableBackdropPress:!0,accessibilityViewIsModal:!0,accessibilityLabel:x.panelTitle,children:_jsx(View,{style:{flex:1,backgroundColor:y.colors.bg},children:_jsx(ChatFrame,{chat:e,labels:x,renderers:o,layoutParts:s,loader:r,look:n,pickAttachments:i,onOpenAttachment:l,onOpenTarget:c,onNavigate:u,openTicket:b,handoffHosts:g,resolveLink:C,keyboardOffset:f,onClose:closeSheet,layout:"sheet",enterKey:I,testID:`${j}-frame`})})})]})})}
@@ -1 +1 @@
1
- "use strict";import{formatDate}from"@webority/mobile-core";import{Card,Chip,Text,useTheme}from"@webority/mobile-ui";import{View}from"react-native";import{ChatEntrance}from"./ChatEntrance.js";import{ChatOpenTickets}from"./ChatOpenTickets.js";import{ChatPastChats}from"./ChatPastChats.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export function ChatStarters({chat:t,labels:e,openTicket:s,testID:a="chat-starters"}){const r=useTheme(),i=t.profile,n=t.greeting??"";if(!i)return null;const l=t.features.Starters&&t.starters.length>0,c=t.lastConversation,o=t.features.ResumeLast&&!t.features.History&&null!==c;return _jsxs(View,{accessibilityLabel:e.emptyTitle,style:{flex:1,justifyContent:"center",alignItems:"center",gap:r.space.md,padding:r.space.md},testID:a,children:[_jsx(Text,{variant:"h2",align:"center",children:n}),l?_jsx(View,{accessibilityRole:"none",accessibilityLabel:e.starters,style:{flexDirection:"row",flexWrap:"wrap",justifyContent:"center",gap:r.space.xs},children:t.starters.map((e,s)=>_jsx(ChatEntrance,{index:s,children:_jsx(Chip,{label:e.label,leftIcon:e.icon?e.icon:void 0,onPress:()=>{t.submit(e.message)},testID:`${a}-${e.id}`})},e.id))}):null,o&&c?_jsxs(Card,{variant:"outline",padding:"sm",onPress:()=>{t.resumeLast()},testID:`${a}-resume`,children:[_jsx(Text,{variant:"caption",color:"secondary",children:e.resumeLast}),_jsx(Text,{variant:"label",numberOfLines:1,children:c.title||e.untitled}),_jsx(Text,{variant:"caption",color:"secondary",children:formatDate(c.lastActivityDateTimeUtc)})]}):null,t.features.History?_jsx(ChatPastChats,{chat:t,labels:e,testID:`${a}-past-chats`}):null,_jsx(ChatOpenTickets,{chat:t,labels:e,onOpenTicket:s})]})}
1
+ "use strict";import{formatDate}from"@webority/mobile-core";import{Avatar,Card,Chip,Text,useTheme}from"@webority/mobile-ui";import{useEffect,useState}from"react";import{View}from"react-native";import{ChatEntrance}from"./ChatEntrance.js";import{ChatOpenTickets}from"./ChatOpenTickets.js";import{ChatPastChats}from"./ChatPastChats.js";import{TypingPill}from"./loaders/TypingPill.js";import{chipLook}from"./renderers/chipLook.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";export function ChatStarters({chat:e,labels:t,openTicket:s,avatar:a,motion:r="On",greetingLoaderMs:i=0,testID:n="chat-starters"}){const l=useTheme(),[o,c]=useState(!(i>0));useEffect(()=>{if(o)return;const e=setTimeout(()=>c(!0),i);return()=>clearTimeout(e)},[o,i]);const m=e.profile,p=e.greeting??"";if(!m)return null;const u=m.assistant.intro,h=e.features.Starters&&e.starters.length>0,d=e.lastConversation,x=e.features.ResumeLast&&!e.features.History&&null!==d;return _jsx(View,{accessibilityLabel:t.emptyTitle,style:{flex:1,justifyContent:"center",alignItems:"center",gap:l.space.md,padding:l.space.md},testID:n,children:o?_jsxs(_Fragment,{children:[a?_jsx(View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:_jsx(Avatar,{size:"lg",name:e.profile?.assistant.name??t.panelTitle,source:{uri:a}})}):null,_jsx(Text,{variant:"h2",align:"center",children:p}),u?_jsx(Text,{variant:"body",color:"secondary",align:"center",children:u}):null,h?_jsx(View,{accessibilityRole:"none",accessibilityLabel:t.starters,style:{flexDirection:"row",flexWrap:"wrap",justifyContent:"center",gap:l.space.xs},children:e.starters.map((t,s)=>_jsx(ChatEntrance,{index:s,children:_jsx(Chip,{...t.variant?chipLook(t.variant):null,label:t.label,leftIcon:t.icon?t.icon:void 0,onPress:()=>{e.submit(t.message)},testID:`${n}-${t.id}`})},t.id))}):null,x&&d?_jsxs(Card,{variant:"outline",padding:"sm",onPress:()=>{e.resumeLast()},testID:`${n}-resume`,children:[_jsx(Text,{variant:"caption",color:"secondary",children:t.resumeLast}),_jsx(Text,{variant:"label",numberOfLines:1,children:d.title||t.untitled}),_jsx(Text,{variant:"caption",color:"secondary",children:formatDate(d.lastActivityDateTimeUtc)})]}):null,e.features.History?_jsx(ChatPastChats,{chat:e,labels:t,testID:`${n}-past-chats`}):null,_jsx(ChatOpenTickets,{chat:e,labels:t,onOpenTicket:s})]}):_jsx(View,{children:_jsx(TypingPill,{motion:r,mark:a?_jsx(Avatar,{size:"xs",name:e.profile?.assistant.name??t.panelTitle,source:{uri:a}}):null})})})}
@@ -1 +1 @@
1
- "use strict";import{createTurnApi,formatChatDateTime,handoffSettledIds,messagePlainText}from"@webority/chat-core";import{Button,MessageBubble,MessageList,Text,useTheme}from"@webority/mobile-ui";import{createElement,memo,useEffect,useMemo,useRef}from"react";import{AccessibilityInfo,View}from"react-native";import{AgentByline}from"./AgentByline.js";import{ChatEntrance}from"./ChatEntrance.js";import{ChatMessageActions}from"./ChatMessageActions.js";import{defaultOpenTarget,focusForAccessibility,messageSignature}from"./chatShared.js";import{ChatLoader}from"./loaders/ChatLoader.js";import{TypingPill}from"./loaders/TypingPill.js";import{defaultRenderers}from"./renderers/index.js";import{NoticePart}from"./renderers/NoticePart.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const MINE=new Set(["Visitor","Customer"]),joinedText=e=>e.filter(e=>"Text"===e.kind).map(e=>e.text).join("\n\n"),renderPart=(e,t,s,a,r,i)=>{const n=e[t.kind];if(n)return createElement(n,{key:i,part:t,message:s,turn:a,pickAttachments:r});const o={kind:"Notice",code:"NeedsNewerApp",text:a.labels.needsNewerApp};return createElement(NoticePart,{key:i,part:o,message:s,turn:a})},sameMessage=(e,t)=>e.signature===t.signature&&e.message.id===t.message.id&&e.message.rating===t.message.rating&&e.message.stored===t.message.stored&&e.groupPosition===t.groupPosition&&e.isLast===t.isLast&&e.handoffSettled===t.handoffSettled&&e.isLastVisitor===t.isLastVisitor&&e.thinking===t.thinking&&e.streaming===t.streaming&&e.pickAttachments===t.pickAttachments&&e.labels===t.labels&&e.all===t.all&&e.layoutParts===t.layoutParts&&e.chat.session===t.chat.session&&e.chat.features===t.chat.features&&e.chat.onNavigate===t.chat.onNavigate&&e.onNavigate===t.onNavigate&&e.onOpenAttachment===t.onOpenAttachment&&e.onOpenTarget===t.onOpenTarget&&e.openTicket===t.openTicket&&e.resolveLink===t.resolveLink&&e.focusComposer===t.focusComposer&&e.byline===t.byline&&e.handoffHosts===t.handoffHosts;function ThreadMessageView({chat:e,message:t,labels:s,all:a,layoutParts:r,groupPosition:i,isLast:n,isLastVisitor:o,pickAttachments:l,onOpenAttachment:c,onOpenTarget:g,onNavigate:m,openTicket:d,handoffHosts:p,resolveLink:u,focusComposer:h,byline:f,sourceRows:y,testID:x}){const T=useTheme(),k=Object.assign(createTurnApi(e.session,{messageId:t.id,labels:s,openAttachment:c,openTarget:g??defaultOpenTarget,onNavigate:m??e.onNavigate,openTicket:d,handoffHosts:p,openCitation:e=>{return t=String(e),void focusForAccessibility(y.current.get(t));var t}}),{resolveLink:u,focusComposer:h,registerSourceRow:(e,t)=>{t?y.current.set(e,t):y.current.delete(e)}});let b=0;const nextSlot=()=>(b+=1,b),A=_jsx(ChatMessageActions,{chat:e,message:t,labels:s,isLast:n,isLastVisitor:o,testID:`${x}-actions`});if(MINE.has(t.author.kind)){const e=t.parts.filter(e=>"File"===e.kind),r=_jsxs(View,{style:{gap:T.space.xs},children:[e.map(e=>renderPart(a,e,t,k,l,`${t.id}-file-${nextSlot()}`)),A]});return _jsx(MessageBubble,{side:"mine",text:joinedText(t.parts),labels:{you:s.you},groupPosition:i,footer:r,testID:x})}const j="Agent"===t.author.kind,w=t.author.displayName||s.agent,v=(r?r(t):t.parts).map(e=>Array.isArray(e)?_jsx(View,{style:{flexDirection:"row",flexWrap:"wrap",gap:T.space.xs},children:e.map(e=>renderPart(a,e,t,k,l,`${t.id}-part-${nextSlot()}`))},`${t.id}-group-${nextSlot()}`):renderPart(a,e,t,k,l,`${t.id}-item-${nextSlot()}`)),N=j&&f?[_jsx(AgentByline,{author:t.author,labels:s},`${t.id}-byline`),...v]:v,_=messagePlainText(t.parts);return _jsx(MessageBubble,{side:"theirs",author:j?void 0:t.author.displayName||s.assistant,text:j?`${s.agentSays(w)} ${_}`:_,streaming:t.streaming,groupPosition:i,footer:A,testID:x,children:N})}const ThreadMessage=memo(ThreadMessageView,sameMessage),TYPING_ORB_MARK=14,TYPING_ASSISTANT_MARK=8,TypingMark=({size:e})=>{const t=useTheme();return _jsx(View,{style:{width:e,height:e,borderRadius:t.radius.pill,backgroundColor:t.colors.primary}})},TYPING_DOT=6,TypingDots=()=>{const e=useTheme();return _jsx(View,{style:{flexDirection:"row",alignItems:"center",gap:e.space.xxs},children:[0,1,2].map(t=>_jsx(View,{style:{width:6,height:6,borderRadius:3,backgroundColor:e.colors["text-muted"]}},t))})},TurnGap=()=>{const e=useTheme();return _jsx(View,{style:{height:e.space.lg}})},followNew=()=>!0;export function ChatThread({chat:e,labels:t,renderers:s,layoutParts:a,loader:r="Steps",motion:i="On",pickAttachments:n,onOpenAttachment:o,onOpenTarget:l,onNavigate:c,openTicket:g,handoffHosts:m,resolveLink:d,focusComposer:p,keyboardAware:u,keyboardOffset:h,empty:f,style:y,testID:x="chat-thread"}){const T=useTheme(),k=useMemo(()=>({...defaultRenderers,...s}),[s]),b=e.messages[0],A=e.greeting??"",j=useMemo(()=>""!==A&&void 0!==b&&MINE.has(b.author.kind)?{...b,id:"greeting",author:{...b.author,kind:"Assistant",displayName:null,avatarUrl:null},parts:[{kind:"Text",text:A}],stored:!1,streaming:!1,restored:!1,rating:null}:null,[A,b]),w=useMemo(()=>{const t=e.messages.filter(e=>!(e.streaming&&0===e.parts.length)).reverse();return j?[...t,j]:t},[e.messages,j]),v=e.messages[e.messages.length-1]?.id,N=useRef(new Map),_=useRef(null);useEffect(()=>{if(null!==_.current)for(const s of e.messages){if(MINE.has(s.author.kind)||s.streaming||s.restored||_.current.has(s.id))continue;if("Agent"===s.author.kind&&!s.stored)continue;_.current.add(s.id);const e=messagePlainText(s.parts);""!==e&&AccessibilityInfo.announceForAccessibility("Agent"===s.author.kind?`${t.agentSays(s.author.displayName||t.agent)} ${e}`:e)}else _.current=new Set(e.messages.map(e=>e.id))},[e.messages,t]);const M=useMemo(()=>{for(let t=e.messages.length-1;t>=0;t-=1){const s=e.messages[t];if(s?.stored&&"Visitor"===s.author.kind)return s.id}},[e.messages]),P=useMemo(()=>{const t=new Set;return e.messages.forEach((s,a)=>{if("Agent"!==s.author.kind)return;const r=e.messages[a-1];"Agent"===r?.author.kind&&(r.author.displayName||"")===(s.author.displayName||"")||t.add(s.id)}),t},[e.messages]),L=useMemo(()=>handoffSettledIds(e.messages),[e.messages]),I=e.turnError,S="daily_limit"===I?.code,C=null!==I&&/feature_off$/.test(I.code),$=S&&I?.resetsDateTimeUtc?` ${t.dailyLimitRefresh(formatChatDateTime(I.resetsDateTimeUtc))}`:"",D=e.streaming||null===I&&!e.stopped?null:_jsxs(View,{style:{gap:T.space.xs},testID:`${x}-error`,children:[_jsx(Text,null!==I?{variant:"bodySmall",color:"danger",accessibilityRole:S?void 0:"alert",accessibilityLiveRegion:S?"polite":void 0,children:`${I.message}${$}`}:{variant:"bodySmall",color:"danger",accessibilityLiveRegion:"polite",children:t.stopped}),!e.features.Retry||S||C?null:_jsx(View,{style:{flexDirection:"row"},children:_jsx(Button,{label:t.retry,variant:"link",size:"sm",onPress:()=>{e.retry()},testID:`${x}-retry`})})]}),V=e.thinking&&null!==e.profile?_jsx(ChatLoader,{style:r,steps:e.steps,phrases:e.profile.experience.pacing.thinkingPhrases,intervalMs:e.profile.experience.pacing.phraseIntervalMs,announce:t.preparingAnswer(e.profile.assistant.name),motion:i}):null,O=!0===e.pending?.typing?_jsx(TypingPill,{motion:i,mark:_jsx(TypingMark,{size:"Orb"===r?14:8})}):null,R=null!==e.agentTyping&&"WithAgent"===e.conversationState?_jsxs(View,{style:{gap:T.space.xs,alignSelf:"flex-start"},children:[_jsx(TypingPill,{motion:i,mark:_jsx(TypingDots,{})}),_jsx(Text,{variant:"caption",color:"secondary",accessibilityLiveRegion:"polite",children:t.agentTyping(e.agentTyping.displayName||t.agent)})]}):null,E=O||V||D||R?_jsxs(View,{style:{gap:T.space.sm},children:[O,V,R,D]}):void 0;return _jsx(MessageList,{messages:w,keyExtractor:e=>e.id,renderMessage:({item:s,groupPosition:r})=>_jsx(ChatEntrance,{animate:!s.restored,children:_jsx(ThreadMessage,{chat:e,message:s,signature:messageSignature(s),labels:t,all:k,layoutParts:a,groupPosition:r,isLast:s.id===v,isLastVisitor:s.id===M,handoffSettled:L.has(s.id),thinking:e.thinking,streaming:e.streaming,pickAttachments:n,onOpenAttachment:o,onOpenTarget:l,onNavigate:c,openTicket:g,handoffHosts:m,resolveLink:d,focusComposer:p,byline:P.has(s.id),sourceRows:N,testID:`${x}-${s.id}`})}),getAuthorKey:e=>e.author.kind,getDate:e=>e.createdDateTimeUtc,followNew:followNew,typing:E,empty:f,ItemSeparatorComponent:TurnGap,keyboardAware:u,keyboardOffset:h,accessibilityLabel:t.thread,style:y,testID:x})}
1
+ "use strict";import{createTurnApi,formatChatDateTime,handoffSettledIds,messagePlainText}from"@webority/chat-core";import{Avatar,Button,MessageBubble,MessageList,Text,useTheme}from"@webority/mobile-ui";import{createElement,memo,useEffect,useMemo,useRef}from"react";import{AccessibilityInfo,View}from"react-native";import{AgentByline}from"./AgentByline.js";import{ChatEntrance}from"./ChatEntrance.js";import{ChatMessageActions}from"./ChatMessageActions.js";import{defaultOpenTarget,focusForAccessibility,messageSignature}from"./chatShared.js";import{ChatLoader}from"./loaders/ChatLoader.js";import{TypingPill}from"./loaders/TypingPill.js";import{defaultRenderers}from"./renderers/index.js";import{NoticePart}from"./renderers/NoticePart.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const MINE=new Set(["Visitor","Customer"]),joinedText=e=>e.filter(e=>"Text"===e.kind).map(e=>e.text).join("\n\n"),renderPart=(e,t,s,a,r,i)=>{const n=e[t.kind];if(n)return createElement(n,{key:i,part:t,message:s,turn:a,pickAttachments:r});const o={kind:"Notice",code:"NeedsNewerApp",text:a.labels.needsNewerApp};return createElement(NoticePart,{key:i,part:o,message:s,turn:a})},sameMessage=(e,t)=>e.signature===t.signature&&e.message.id===t.message.id&&e.message.rating===t.message.rating&&e.message.stored===t.message.stored&&e.groupPosition===t.groupPosition&&e.isLast===t.isLast&&e.handoffSettled===t.handoffSettled&&e.isLastVisitor===t.isLastVisitor&&e.thinking===t.thinking&&e.streaming===t.streaming&&e.pickAttachments===t.pickAttachments&&e.labels===t.labels&&e.all===t.all&&e.layoutParts===t.layoutParts&&e.chat.session===t.chat.session&&e.chat.features===t.chat.features&&e.chat.onNavigate===t.chat.onNavigate&&e.onNavigate===t.onNavigate&&e.onOpenAttachment===t.onOpenAttachment&&e.onOpenTarget===t.onOpenTarget&&e.openTicket===t.openTicket&&e.resolveLink===t.resolveLink&&e.focusComposer===t.focusComposer&&e.byline===t.byline&&e.avatar===t.avatar&&e.replyAvatars===t.replyAvatars&&e.avatarStart===t.avatarStart&&e.handoffHosts===t.handoffHosts;function ThreadMessageView({chat:e,message:t,labels:s,all:a,layoutParts:r,groupPosition:i,isLast:n,isLastVisitor:o,pickAttachments:l,onOpenAttachment:c,onOpenTarget:d,onNavigate:g,openTicket:m,handoffHosts:p,resolveLink:u,focusComposer:h,byline:f,avatar:y,replyAvatars:x,avatarStart:T,sourceRows:k,testID:A}){const v=useTheme(),b=Object.assign(createTurnApi(e.session,{messageId:t.id,labels:s,openAttachment:c,openTarget:d??defaultOpenTarget,onNavigate:g??e.onNavigate,openTicket:m,handoffHosts:p,openCitation:e=>{return t=String(e),void focusForAccessibility(k.current.get(t));var t}}),{resolveLink:u,focusComposer:h,registerSourceRow:(e,t)=>{t?k.current.set(e,t):k.current.delete(e)}});let j=0;const nextSlot=()=>(j+=1,j),w=_jsx(ChatMessageActions,{chat:e,message:t,labels:s,isLast:n,isLastVisitor:o,testID:`${A}-actions`});if(MINE.has(t.author.kind)){const e=t.parts.filter(e=>"File"===e.kind),r=_jsxs(View,{style:{gap:v.space.xs},children:[e.map(e=>renderPart(a,e,t,b,l,`${t.id}-file-${nextSlot()}`)),w]});return _jsx(MessageBubble,{side:"mine",text:joinedText(t.parts),labels:{you:s.you},groupPosition:i,footer:r,testID:A})}const _="Agent"===t.author.kind,N=t.author.displayName||s.agent,M=(r?r(t):t.parts).map(e=>Array.isArray(e)?_jsx(View,{style:{flexDirection:"row",flexWrap:"wrap",gap:v.space.xs},children:e.map(e=>renderPart(a,e,t,b,l,`${t.id}-part-${nextSlot()}`))},`${t.id}-group-${nextSlot()}`):renderPart(a,e,t,b,l,`${t.id}-item-${nextSlot()}`)),P=_&&f?_jsx(AgentByline,{author:t.author,labels:s,showAvatar:x},`${t.id}-byline`):null,S=P?[P,...M]:M,I=messagePlainText(t.parts),L=_jsx(MessageBubble,{side:"theirs",author:_?void 0:t.author.displayName||s.assistant,text:_?`${s.agentSays(N)} ${I}`:I,streaming:t.streaming,groupPosition:i,footer:w,testID:A,children:S});if(!x||!y||"Assistant"!==t.author.kind)return L;const C=t.author.displayName||s.assistant;return _jsxs(View,{style:{flexDirection:"row",alignItems:"flex-end",gap:v.space.xs},children:[_jsx(View,{accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",style:T?void 0:{opacity:0},children:_jsx(Avatar,{size:"xs",name:C,source:T?{uri:y}:void 0})}),_jsx(View,{style:{flex:1,minWidth:0},children:L})]})}const ThreadMessage=memo(ThreadMessageView,sameMessage),TYPING_ORB_MARK=14,TYPING_ASSISTANT_MARK=8,TypingMark=({size:e})=>{const t=useTheme();return _jsx(View,{style:{width:e,height:e,borderRadius:t.radius.pill,backgroundColor:t.colors.primary}})},TYPING_DOT=6,TypingDots=()=>{const e=useTheme();return _jsx(View,{style:{flexDirection:"row",alignItems:"center",gap:e.space.xxs},children:[0,1,2].map(t=>_jsx(View,{style:{width:6,height:6,borderRadius:3,backgroundColor:e.colors["text-muted"]}},t))})},TurnGap=()=>{const e=useTheme();return _jsx(View,{style:{height:e.space.lg}})},followNew=()=>!0;export function ChatThread({chat:e,labels:t,renderers:s,layoutParts:a,loader:r="Steps",motion:i="On",avatar:n,replyAvatars:o=!0,pickAttachments:l,onOpenAttachment:c,onOpenTarget:d,onNavigate:g,openTicket:m,handoffHosts:p,resolveLink:u,focusComposer:h,keyboardAware:f,keyboardOffset:y,empty:x,style:T,testID:k="chat-thread"}){const A=useTheme(),v=useMemo(()=>({...defaultRenderers,...s}),[s]),b=e.messages[0],j=e.greeting??"",w=useMemo(()=>""!==j&&void 0!==b&&MINE.has(b.author.kind)?{...b,id:"greeting",author:{...b.author,kind:"Assistant",displayName:null,avatarUrl:null},parts:[{kind:"Text",text:j}],stored:!1,streaming:!1,restored:!1,rating:null}:null,[j,b]),_=useMemo(()=>{const t=e.messages.filter(e=>!(e.streaming&&0===e.parts.length)).reverse();return w?[...t,w]:t},[e.messages,w]),N=e.messages[e.messages.length-1]?.id,M=useRef(new Map),P=useRef(null);useEffect(()=>{if(null!==P.current)for(const s of e.messages){if(MINE.has(s.author.kind)||s.streaming||s.restored||P.current.has(s.id))continue;if("Agent"===s.author.kind&&!s.stored)continue;P.current.add(s.id);const e=messagePlainText(s.parts);""!==e&&AccessibilityInfo.announceForAccessibility("Agent"===s.author.kind?`${t.agentSays(s.author.displayName||t.agent)} ${e}`:e)}else P.current=new Set(e.messages.map(e=>e.id))},[e.messages,t]);const S=useMemo(()=>{for(let t=e.messages.length-1;t>=0;t-=1){const s=e.messages[t];if(s?.stored&&"Visitor"===s.author.kind)return s.id}},[e.messages]),I=useMemo(()=>{const t=new Set;return e.messages.forEach((s,a)=>{if("Agent"!==s.author.kind)return;const r=e.messages[a-1];"Agent"===r?.author.kind&&(r.author.displayName||"")===(s.author.displayName||"")||t.add(s.id)}),t},[e.messages]),L=useMemo(()=>{const t=new Set,s=e.messages.filter(e=>!(e.streaming&&0===e.parts.length));return w&&t.add(w.id),s.forEach((e,a)=>{"Assistant"===e.author.kind&&"Assistant"!==s[a-1]?.author.kind&&t.add(e.id)}),t},[e.messages,w]),C=useMemo(()=>handoffSettledIds(e.messages),[e.messages]),V=e.turnError,D="daily_limit"===V?.code,$=null!==V&&/feature_off$/.test(V.code),O=D&&V?.resetsDateTimeUtc?` ${t.dailyLimitRefresh(formatChatDateTime(V.resetsDateTimeUtc))}`:"",R=e.streaming||null===V&&!e.stopped?null:_jsxs(View,{style:{gap:A.space.xs},testID:`${k}-error`,children:[_jsx(Text,null!==V?{variant:"bodySmall",color:"danger",accessibilityRole:D?void 0:"alert",accessibilityLiveRegion:D?"polite":void 0,children:`${V.message}${O}`}:{variant:"bodySmall",color:"danger",accessibilityLiveRegion:"polite",children:t.stopped}),!e.features.Retry||D||$?null:_jsx(View,{style:{flexDirection:"row"},children:_jsx(Button,{label:t.retry,variant:"link",size:"sm",onPress:()=>{e.retry()},testID:`${k}-retry`})})]}),E=e.thinking&&null!==e.profile?_jsx(ChatLoader,{style:r,steps:e.steps,phrases:e.profile.experience.pacing.thinkingPhrases,intervalMs:e.profile.experience.pacing.phraseIntervalMs,announce:t.preparingAnswer(e.profile.assistant.name),motion:i}):null,B=!0===e.pending?.typing?_jsx(TypingPill,{motion:i,mark:_jsx(TypingMark,{size:"Orb"===r?14:8})}):null,H=null!==e.agentTyping&&"WithAgent"===e.conversationState?_jsxs(View,{style:{gap:A.space.xs,alignSelf:"flex-start"},children:[_jsx(TypingPill,{motion:i,mark:_jsx(TypingDots,{})}),_jsx(Text,{variant:"caption",color:"secondary",accessibilityLiveRegion:"polite",children:t.agentTyping(e.agentTyping.displayName||t.agent)})]}):null,F=B||E||R||H?_jsxs(View,{style:{gap:A.space.sm},children:[B,E,H,R]}):void 0;return _jsx(MessageList,{messages:_,keyExtractor:e=>e.id,renderMessage:({item:s,groupPosition:r})=>_jsx(ChatEntrance,{animate:!s.restored,children:_jsx(ThreadMessage,{chat:e,message:s,signature:messageSignature(s),labels:t,all:v,layoutParts:a,groupPosition:r,isLast:s.id===N,isLastVisitor:s.id===S,handoffSettled:C.has(s.id),thinking:e.thinking,streaming:e.streaming,pickAttachments:l,onOpenAttachment:c,onOpenTarget:d,onNavigate:g,openTicket:m,handoffHosts:p,resolveLink:u,focusComposer:h,byline:I.has(s.id),avatar:n,replyAvatars:o,avatarStart:L.has(s.id),sourceRows:M,testID:`${k}-${s.id}`})}),getAuthorKey:e=>e.author.kind,getDate:e=>e.createdDateTimeUtc,followNew:followNew,typing:F,empty:x,ItemSeparatorComponent:TurnGap,keyboardAware:f,keyboardOffset:y,accessibilityLabel:t.thread,style:T,testID:k})}
@@ -1 +1 @@
1
- "use strict";import{CHAT_HANDOFF_REQUEST_ID,isHandoffTarget}from"@webority/chat-core";import{Chip,Text,useTheme}from"@webority/mobile-ui";import{View}from"react-native";import{ChatEntrance}from"../ChatEntrance.js";import{defaultOpenTarget}from"../chatShared.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const QUIET_LOOK={variant:"outline"};function lookOf(e){switch(e){case"Primary":case"Cta":return{variant:"solid",tone:"primary"};default:return QUIET_LOOK}}export function QuickRepliesPart({part:e,turn:n}){const t=useTheme();if(!n.features.SuggestedReplies||!n.isLast||n.busy||0===e.replies.length)return null;const i=n.openTarget,a=n.onNavigate,r=void 0!==i&&i!==defaultOpenTarget,o="Composer"===e.placement,s=e.replies.filter(e=>"Send"===e.action||"Open"===e.action&&e.target&&i||"Navigate"===e.action&&n.features.LinkHandoff);if(0===s.length)return null;const l=o?void 0:s.find(e=>e.id===CHAT_HANDOFF_REQUEST_ID&&"Send"===e.action),c=l?s.filter(e=>e!==l):s,f=l?1:0,sendChip=(e,t)=>_jsx(Chip,{label:e.label,variant:t.variant,tone:t.tone,leftIcon:e.icon?e.icon:void 0,onPress:()=>{n.chooseQuickReply(e),n.focusComposer?.()}});return _jsxs(View,{accessibilityRole:"summary",accessibilityLabel:n.labels.quickReplies,accessibilityLiveRegion:n.handoffPause?"polite":void 0,style:{flexDirection:"row",flexWrap:"wrap",gap:t.space.xs,...o?{paddingHorizontal:t.space.md}:null},children:[l?_jsx(ChatEntrance,{index:0,children:_jsxs(View,{style:{flexBasis:"100%",alignItems:"flex-start",gap:t.space.xs},children:[_jsx(Text,{variant:"label",children:l.label}),sendChip(l,lookOf("Primary"))]})},l.id):null,c.map((e,t)=>{const o=t+f,s=l?QUIET_LOOK:lookOf(e.variant),c=e.icon?e.icon:void 0;if("Send"===e.action)return _jsx(ChatEntrance,{index:o,children:sendChip(e,s)},e.id);const d=e.target;if("Open"===e.action&&d&&i)return _jsx(ChatEntrance,{index:o,children:_jsx(Chip,{label:e.label,variant:s.variant,tone:s.tone,leftIcon:c,onPress:()=>i(d)})},e.id);if("Navigate"===e.action){const t=(e=>{if(!e)return null;if(isHandoffTarget(e,n.handoffHosts))return e;const t=n.resolveLink?.(e);return"string"==typeof t&&""!==t?t:null})(d),l=null===t?void 0:(e=>e.startsWith("/")?i&&r?()=>i(e):a?()=>a(e):void 0:i?()=>i(e):void 0)(t);return _jsx(ChatEntrance,null===t||void 0===l?{index:o,children:_jsx(Text,{variant:"bodySmall",color:"primary",children:e.label})}:{index:o,children:_jsx(Chip,{label:n.handoffPause?n.labels.handoffMoment:e.label,variant:n.handoffPause?QUIET_LOOK.variant:s.variant,tone:n.handoffPause?void 0:s.tone,leftIcon:c,disabled:n.handoffPause,onPress:()=>n.beginHandoff(e,l)})},e.id)}return null})]})}
1
+ "use strict";import{CHAT_HANDOFF_REQUEST_ID,isHandoffTarget}from"@webority/chat-core";import{Chip,Text,useTheme}from"@webority/mobile-ui";import{View}from"react-native";import{ChatEntrance}from"../ChatEntrance.js";import{defaultOpenTarget}from"../chatShared.js";import{chipLook}from"./chipLook.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const QUIET_LOOK={variant:"outline"};export function QuickRepliesPart({part:e,turn:i}){const n=useTheme();if(!i.features.SuggestedReplies||!i.isLast||i.busy||0===e.replies.length)return null;const t=i.openTarget,a=i.onNavigate,r=void 0!==t&&t!==defaultOpenTarget,o="Composer"===e.placement,s=e.replies.filter(e=>"Send"===e.action||"Open"===e.action&&e.target&&t||"Navigate"===e.action&&i.features.LinkHandoff);if(0===s.length)return null;const l=o?void 0:s.find(e=>e.id===CHAT_HANDOFF_REQUEST_ID&&"Send"===e.action),c=l?s.filter(e=>e!==l):s,d=l?1:0,sendChip=(e,n)=>_jsx(Chip,{label:e.label,variant:n.variant,tone:n.tone,leftIcon:e.icon?e.icon:void 0,onPress:()=>{i.chooseQuickReply(e),i.focusComposer?.()}});return _jsxs(View,{accessibilityRole:"summary",accessibilityLabel:i.labels.quickReplies,accessibilityLiveRegion:i.handoffPause?"polite":void 0,style:{flexDirection:"row",flexWrap:"wrap",gap:n.space.xs,...o?{paddingHorizontal:n.space.md}:null},children:[l?_jsx(ChatEntrance,{index:0,children:_jsxs(View,{style:{flexBasis:"100%",alignItems:"flex-start",gap:n.space.xs},children:[_jsx(Text,{variant:"label",children:l.label}),sendChip(l,chipLook("Primary"))]})},l.id):null,c.map((e,n)=>{const o=n+d,s=l?QUIET_LOOK:chipLook(e.variant),c=e.icon?e.icon:void 0;if("Send"===e.action)return _jsx(ChatEntrance,{index:o,children:sendChip(e,s)},e.id);const f=e.target;if("Open"===e.action&&f&&t)return _jsx(ChatEntrance,{index:o,children:_jsx(Chip,{label:e.label,variant:s.variant,tone:s.tone,leftIcon:c,onPress:()=>t(f)})},e.id);if("Navigate"===e.action){const n=(e=>{if(!e)return null;if(isHandoffTarget(e,i.handoffHosts))return e;const n=i.resolveLink?.(e);return"string"==typeof n&&""!==n?n:null})(f),l=null===n?void 0:(e=>e.startsWith("/")?t&&r?()=>t(e):a?()=>a(e):void 0:t?()=>t(e):void 0)(n);return _jsx(ChatEntrance,null===n||void 0===l?{index:o,children:_jsx(Text,{variant:"bodySmall",color:"primary",children:e.label})}:{index:o,children:_jsx(Chip,{label:i.handoffPause?i.labels.handoffMoment:e.label,variant:i.handoffPause?QUIET_LOOK.variant:s.variant,tone:i.handoffPause?void 0:s.tone,leftIcon:c,disabled:i.handoffPause,onPress:()=>i.beginHandoff(e,l)})},e.id)}return null})]})}
@@ -0,0 +1 @@
1
+ "use strict";export function chipLook(t){switch(t){case"Primary":case"Cta":return{variant:"solid",tone:"primary"};default:return{variant:"outline"}}}
@@ -3,7 +3,8 @@ import type React from "react";
3
3
  export interface AgentBylineProps {
4
4
  author: ChatAuthor;
5
5
  labels: ChatLabels;
6
+ showAvatar?: boolean;
6
7
  }
7
8
  /** The name and picture of the person who wrote an agent message. The spoken text carries the name instead. */
8
- export declare function AgentByline({ author, labels }: AgentBylineProps): React.ReactElement;
9
+ export declare function AgentByline({ author, labels, showAvatar }: AgentBylineProps): React.ReactElement;
9
10
  //# sourceMappingURL=AgentByline.d.ts.map
@@ -12,6 +12,8 @@ export interface ChatComposerProps {
12
12
  focusRef?: React.MutableRefObject<(() => void) | null>;
13
13
  /** The resolved look: its input ring and send reveal draw the box and the send button. */
14
14
  look?: ChatLook;
15
+ /** Icon name for the send button; the look's input.sendIcon. */
16
+ sendIcon?: string;
15
17
  }
16
- export declare function ChatComposer({ chat, labels, pickAttachments, keyboardOffset, keyboardAware, safeArea, testID, focusRef, look, }: ChatComposerProps): React.ReactElement;
18
+ export declare function ChatComposer({ chat, labels, pickAttachments, keyboardOffset, keyboardAware, safeArea, testID, focusRef, look, sendIcon, }: ChatComposerProps): React.ReactElement;
17
19
  //# sourceMappingURL=ChatComposer.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { ChatLook } from "@webority/chat-core";
1
+ import type { ChatLauncherMark, ChatLook } from "@webority/chat-core";
2
2
  import type React from "react";
3
3
  import { type View } from "react-native";
4
4
  export interface ChatLauncherProps {
@@ -10,6 +10,8 @@ export interface ChatLauncherProps {
10
10
  /** Plays the entrance once, on the first show of the launcher. */
11
11
  enter: boolean;
12
12
  reduced: boolean;
13
+ mark?: ChatLauncherMark;
14
+ avatar?: string | null;
13
15
  buttonRef: React.RefObject<View | null>;
14
16
  onPress: () => void;
15
17
  testID: string;
@@ -18,5 +20,5 @@ export interface ChatLauncherProps {
18
20
  * The floating launcher as the look draws it: round or pill, with its label, the chosen entrance and the
19
21
  * float idle. The entrance moves the button's own wrapper, so a scale or a turn happens around the button.
20
22
  */
21
- export declare function ChatLauncher({ look, label, side, offsetX, offsetY, enter, reduced, buttonRef, onPress, testID, }: ChatLauncherProps): React.ReactElement;
23
+ export declare function ChatLauncher({ look, label, side, offsetX, offsetY, enter, reduced, mark, avatar, buttonRef, onPress, testID, }: ChatLauncherProps): React.ReactElement;
22
24
  //# sourceMappingURL=ChatLauncher.d.ts.map
@@ -6,7 +6,10 @@ export interface ChatStartersProps {
6
6
  chat: UseChatResult;
7
7
  labels: ChatLabels;
8
8
  openTicket?: ChatOpenTicketHandler;
9
+ avatar?: string | null;
10
+ motion?: "On" | "Reduced";
11
+ greetingLoaderMs?: number;
9
12
  testID?: string;
10
13
  }
11
- export declare function ChatStarters({ chat, labels, openTicket, testID }: ChatStartersProps): React.ReactElement | null;
14
+ export declare function ChatStarters({ chat, labels, openTicket, avatar, motion, greetingLoaderMs, testID, }: ChatStartersProps): React.ReactElement | null;
12
15
  //# sourceMappingURL=ChatStarters.d.ts.map
@@ -10,6 +10,10 @@ export interface ChatThreadProps {
10
10
  layoutParts?: ChatLayoutParts;
11
11
  loader?: ChatLoaderStyle;
12
12
  motion?: ChatMotion;
13
+ /** The assistant's picture, drawn beside its replies. */
14
+ avatar?: string | null;
15
+ /** False hides the pictures beside replies. */
16
+ replyAvatars?: boolean;
13
17
  pickAttachments?: () => Promise<ChatUploadFile[]>;
14
18
  onOpenAttachment?: (part: Extract<ChatPart, {
15
19
  kind: "File";
@@ -32,5 +36,5 @@ export interface ChatThreadProps {
32
36
  * pill while a paced reply is held, the loader while a reply is awaited and the error row after a
33
37
  * failed or stopped turn.
34
38
  */
35
- export declare function ChatThread({ chat, labels, renderers, layoutParts, loader, motion, pickAttachments, onOpenAttachment, onOpenTarget, onNavigate, openTicket, handoffHosts, resolveLink, focusComposer, keyboardAware, keyboardOffset, empty, style, testID, }: ChatThreadProps): React.ReactElement;
39
+ export declare function ChatThread({ chat, labels, renderers, layoutParts, loader, motion, avatar, replyAvatars, pickAttachments, onOpenAttachment, onOpenTarget, onNavigate, openTicket, handoffHosts, resolveLink, focusComposer, keyboardAware, keyboardOffset, empty, style, testID, }: ChatThreadProps): React.ReactElement;
36
40
  //# sourceMappingURL=ChatThread.d.ts.map
@@ -0,0 +1,7 @@
1
+ import type { ChatQuickReplyVariant } from "@webority/chat-core";
2
+ import type { ChipTone, ChipVariant } from "@webority/mobile-ui";
3
+ export declare function chipLook(variant: ChatQuickReplyVariant | null): {
4
+ variant: ChipVariant;
5
+ tone?: ChipTone;
6
+ };
7
+ //# sourceMappingURL=chipLook.d.ts.map
@@ -3,7 +3,8 @@ import type React from "react";
3
3
  export interface AgentBylineProps {
4
4
  author: ChatAuthor;
5
5
  labels: ChatLabels;
6
+ showAvatar?: boolean;
6
7
  }
7
8
  /** The name and picture of the person who wrote an agent message. The spoken text carries the name instead. */
8
- export declare function AgentByline({ author, labels }: AgentBylineProps): React.ReactElement;
9
+ export declare function AgentByline({ author, labels, showAvatar }: AgentBylineProps): React.ReactElement;
9
10
  //# sourceMappingURL=AgentByline.d.ts.map
@@ -12,6 +12,8 @@ export interface ChatComposerProps {
12
12
  focusRef?: React.MutableRefObject<(() => void) | null>;
13
13
  /** The resolved look: its input ring and send reveal draw the box and the send button. */
14
14
  look?: ChatLook;
15
+ /** Icon name for the send button; the look's input.sendIcon. */
16
+ sendIcon?: string;
15
17
  }
16
- export declare function ChatComposer({ chat, labels, pickAttachments, keyboardOffset, keyboardAware, safeArea, testID, focusRef, look, }: ChatComposerProps): React.ReactElement;
18
+ export declare function ChatComposer({ chat, labels, pickAttachments, keyboardOffset, keyboardAware, safeArea, testID, focusRef, look, sendIcon, }: ChatComposerProps): React.ReactElement;
17
19
  //# sourceMappingURL=ChatComposer.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { ChatLook } from "@webority/chat-core";
1
+ import type { ChatLauncherMark, ChatLook } from "@webority/chat-core";
2
2
  import type React from "react";
3
3
  import { type View } from "react-native";
4
4
  export interface ChatLauncherProps {
@@ -10,6 +10,8 @@ export interface ChatLauncherProps {
10
10
  /** Plays the entrance once, on the first show of the launcher. */
11
11
  enter: boolean;
12
12
  reduced: boolean;
13
+ mark?: ChatLauncherMark;
14
+ avatar?: string | null;
13
15
  buttonRef: React.RefObject<View | null>;
14
16
  onPress: () => void;
15
17
  testID: string;
@@ -18,5 +20,5 @@ export interface ChatLauncherProps {
18
20
  * The floating launcher as the look draws it: round or pill, with its label, the chosen entrance and the
19
21
  * float idle. The entrance moves the button's own wrapper, so a scale or a turn happens around the button.
20
22
  */
21
- export declare function ChatLauncher({ look, label, side, offsetX, offsetY, enter, reduced, buttonRef, onPress, testID, }: ChatLauncherProps): React.ReactElement;
23
+ export declare function ChatLauncher({ look, label, side, offsetX, offsetY, enter, reduced, mark, avatar, buttonRef, onPress, testID, }: ChatLauncherProps): React.ReactElement;
22
24
  //# sourceMappingURL=ChatLauncher.d.ts.map
@@ -6,7 +6,10 @@ export interface ChatStartersProps {
6
6
  chat: UseChatResult;
7
7
  labels: ChatLabels;
8
8
  openTicket?: ChatOpenTicketHandler;
9
+ avatar?: string | null;
10
+ motion?: "On" | "Reduced";
11
+ greetingLoaderMs?: number;
9
12
  testID?: string;
10
13
  }
11
- export declare function ChatStarters({ chat, labels, openTicket, testID }: ChatStartersProps): React.ReactElement | null;
14
+ export declare function ChatStarters({ chat, labels, openTicket, avatar, motion, greetingLoaderMs, testID, }: ChatStartersProps): React.ReactElement | null;
12
15
  //# sourceMappingURL=ChatStarters.d.ts.map
@@ -10,6 +10,10 @@ export interface ChatThreadProps {
10
10
  layoutParts?: ChatLayoutParts;
11
11
  loader?: ChatLoaderStyle;
12
12
  motion?: ChatMotion;
13
+ /** The assistant's picture, drawn beside its replies. */
14
+ avatar?: string | null;
15
+ /** False hides the pictures beside replies. */
16
+ replyAvatars?: boolean;
13
17
  pickAttachments?: () => Promise<ChatUploadFile[]>;
14
18
  onOpenAttachment?: (part: Extract<ChatPart, {
15
19
  kind: "File";
@@ -32,5 +36,5 @@ export interface ChatThreadProps {
32
36
  * pill while a paced reply is held, the loader while a reply is awaited and the error row after a
33
37
  * failed or stopped turn.
34
38
  */
35
- export declare function ChatThread({ chat, labels, renderers, layoutParts, loader, motion, pickAttachments, onOpenAttachment, onOpenTarget, onNavigate, openTicket, handoffHosts, resolveLink, focusComposer, keyboardAware, keyboardOffset, empty, style, testID, }: ChatThreadProps): React.ReactElement;
39
+ export declare function ChatThread({ chat, labels, renderers, layoutParts, loader, motion, avatar, replyAvatars, pickAttachments, onOpenAttachment, onOpenTarget, onNavigate, openTicket, handoffHosts, resolveLink, focusComposer, keyboardAware, keyboardOffset, empty, style, testID, }: ChatThreadProps): React.ReactElement;
36
40
  //# sourceMappingURL=ChatThread.d.ts.map
@@ -0,0 +1,7 @@
1
+ import type { ChatQuickReplyVariant } from "@webority/chat-core";
2
+ import type { ChipTone, ChipVariant } from "@webority/mobile-ui";
3
+ export declare function chipLook(variant: ChatQuickReplyVariant | null): {
4
+ variant: ChipVariant;
5
+ tone?: ChipTone;
6
+ };
7
+ //# sourceMappingURL=chipLook.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/mobile-chat",
3
- "version": "0.135.0",
3
+ "version": "0.136.0",
4
4
  "description": "Webority Chat for React Native apps: the chat screen, sheet and embedded shells, thread, composer, one renderer per message part kind and the useChat hook, built on @webority/chat-core and @webority/mobile-ui.",
5
5
  "keywords": [
6
6
  "react-native",
@@ -42,10 +42,10 @@
42
42
  "!**/*.map"
43
43
  ],
44
44
  "peerDependencies": {
45
- "@webority/chat-core": "0.135.0",
46
- "@webority/markdown-core": "^0.131.0",
47
- "@webority/mobile-core": "^0.131.0",
48
- "@webority/mobile-ui": "^0.131.0",
45
+ "@webority/chat-core": "0.136.0",
46
+ "@webority/markdown-core": "^0.133.0",
47
+ "@webority/mobile-core": "^0.133.0",
48
+ "@webority/mobile-ui": "^0.133.0",
49
49
  "expo-audio": ">=57.0.0",
50
50
  "expo-file-system": ">=57.0.0",
51
51
  "react": "^19.1.0",
@@ -97,11 +97,11 @@
97
97
  "@react-native/metro-config": "0.86.3",
98
98
  "@testing-library/react-native": "12.9.0",
99
99
  "@types/react": "19.2.18",
100
- "@webority/canvas-kit": "0.131.0",
101
- "@webority/chat-core": "0.135.0",
102
- "@webority/markdown-core": "0.131.0",
103
- "@webority/mobile-core": "0.131.0",
104
- "@webority/mobile-ui": "0.131.0",
100
+ "@webority/canvas-kit": "0.133.0",
101
+ "@webority/chat-core": "0.136.0",
102
+ "@webority/markdown-core": "0.133.0",
103
+ "@webority/mobile-core": "0.133.0",
104
+ "@webority/mobile-ui": "0.133.0",
105
105
  "babel-jest": "29.7.0",
106
106
  "expo": "57.0.31",
107
107
  "expo-application": "57.0.3",