@webority/mobile-chat 0.124.0 → 0.125.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.
- package/lib/commonjs/components/ActionCard.js +1 -1
- package/lib/commonjs/components/ChatComposer.js +1 -1
- package/lib/commonjs/components/ChatConversationList.js +1 -1
- package/lib/commonjs/components/ChatLauncher.js +1 -1
- package/lib/commonjs/components/ChatMessage.js +1 -1
- package/lib/commonjs/components/ChatScreen.js +1 -1
- package/lib/commonjs/components/ChatThread.js +1 -1
- package/lib/commonjs/components/ComposerAttachments.js +1 -1
- package/lib/commonjs/components/ReplyRating.js +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/useChat.js +1 -1
- package/lib/module/components/ActionCard.js +1 -1
- package/lib/module/components/ChatComposer.js +1 -1
- package/lib/module/components/ChatConversationList.js +1 -1
- package/lib/module/components/ChatLauncher.js +1 -1
- package/lib/module/components/ChatMessage.js +1 -1
- package/lib/module/components/ChatScreen.js +1 -1
- package/lib/module/components/ChatThread.js +1 -1
- package/lib/module/components/ComposerAttachments.js +1 -1
- package/lib/module/components/ReplyRating.js +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/useChat.js +1 -1
- package/lib/typescript/commonjs/components/ActionCard.d.ts +2 -2
- package/lib/typescript/commonjs/components/ChatComposer.d.ts +1 -1
- package/lib/typescript/commonjs/components/ChatConversationList.d.ts +2 -2
- package/lib/typescript/commonjs/components/ChatLauncher.d.ts +1 -1
- package/lib/typescript/commonjs/components/ChatMessage.d.ts +2 -2
- package/lib/typescript/commonjs/components/ChatScreen.d.ts +1 -1
- package/lib/typescript/commonjs/components/ChatThread.d.ts +1 -1
- package/lib/typescript/commonjs/components/ComposerAttachments.d.ts +1 -1
- package/lib/typescript/commonjs/components/ReplyRating.d.ts +2 -2
- package/lib/typescript/commonjs/index.d.ts +2 -2
- package/lib/typescript/commonjs/useChat.d.ts +2 -2
- package/lib/typescript/module/components/ActionCard.d.ts +2 -2
- package/lib/typescript/module/components/ChatComposer.d.ts +1 -1
- package/lib/typescript/module/components/ChatConversationList.d.ts +2 -2
- package/lib/typescript/module/components/ChatLauncher.d.ts +1 -1
- package/lib/typescript/module/components/ChatMessage.d.ts +2 -2
- package/lib/typescript/module/components/ChatScreen.d.ts +1 -1
- package/lib/typescript/module/components/ChatThread.d.ts +1 -1
- package/lib/typescript/module/components/ComposerAttachments.d.ts +1 -1
- package/lib/typescript/module/components/ReplyRating.d.ts +2 -2
- package/lib/typescript/module/index.d.ts +2 -2
- package/lib/typescript/module/useChat.d.ts +2 -2
- package/package.json +6 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ActionCard=void 0;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ActionCard=void 0;var _chat=require("@webority/markdown-core/chat"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_jsxRuntime=require("react/jsx-runtime");const titleOf=(e,i)=>"Reply"===e.kind?i.actionReply(e.ticketNumber??""):"Reopen"===e.kind?i.actionReopen(e.ticketNumber??""):i.actionRaiseTicket,doneText=(e,i,t)=>"Reply"===e.kind?t.actionDoneReply(i):"Reopen"===e.kind?t.actionDoneReopen(i):t.actionDoneRaiseTicket(i),ActionCard=({action:e,confirmAction:i,onViewTicket:t,labels:n,testID:s="chat-action"})=>{const a=(0,_chat.mergeLabels)(n),o=(0,_mobileUi.useTheme)(),[r,c]=(0,_react.useState)("ready"),[l,d]=(0,_react.useState)(null),[m,x]=(0,_react.useState)("");if("dismissed"===r)return(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"bodySmall",color:"secondary",testID:s,children:a.actionDismissed});if("done"===r&&l)return(0,_jsxRuntime.jsx)(_mobileUi.Banner,{tone:"success",message:doneText(e,l.number,a),actions:t?[{label:a.viewTicket,onPress:()=>t(l)}]:void 0,testID:s});const u="sending"===r,_=new Date(e.expiresDateTimeUtc).getTime()<=Date.now(),b="RaiseTicket"===e.kind?[e.category,e.subject].filter(Boolean).join(", "):"";return(0,_jsxRuntime.jsx)(_mobileUi.Card,{variant:"outline",padding:"sm",testID:s,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{gap:o.space.sm},children:[(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"label",children:titleOf(e,a)}),""!==b&&(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"bodySmall",color:"secondary",children:b}),"Reopen"!==e.kind&&e.body?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"bodySmall",children:e.body}):null,_?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"bodySmall",color:"secondary",children:a.actionExpired}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",children:a.actionNote}),""!==m&&(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"bodySmall",color:"danger",accessibilityLiveRegion:"polite",children:m}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flexDirection:"row",flexWrap:"wrap",gap:o.space.sm},children:[(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:a.actionConfirm,size:"sm",loading:u,disabled:u,onPress:()=>{(async()=>{c("sending"),x("");try{d(await i(e.token)),c("done")}catch(e){const i=e?.message;x("string"==typeof i&&i?i:a.actionFailed),c("ready")}})()},testID:`${s}-confirm`}),(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:a.actionDismiss,size:"sm",variant:"outline",disabled:u,onPress:()=>c("dismissed"),testID:`${s}-dismiss`})]})]})]})})};exports.ActionCard=ActionCard;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatComposer=void 0;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatComposer=void 0;var _chat=require("@webority/markdown-core/chat"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_ComposerAttachments=require("./ComposerAttachments.js"),_jsxRuntime=require("react/jsx-runtime");const ChatComposer=({onSubmit:e,busy:t=!1,onStop:s,disabled:a=!1,maxLength:o=4e3,above:n,below:i,keyboardAware:r,keyboardOffset:c,safeArea:l,attachments:m=[],onAttach:d,onRemoveAttachment:b,editing:u,onCancelEdit:h,labels:p,testID:x="chat-composer"})=>{const _=(0,_chat.mergeLabels)(p),j=m.some(e=>"Uploading"===e.status),C=m.some(e=>"Ready"===e.status),[g,v]=(0,_react.useState)("");(0,_react.useEffect)(()=>{v(u?u.text:"")},[u]);const y=u?(0,_jsxRuntime.jsx)(_mobileUi.Banner,{message:_.editing,accessibilityRole:"summary",actions:h?[{label:_.cancel,onPress:h,testID:`${x}-cancel-edit`}]:void 0,testID:`${x}-editing`}):null,R=m.length>0?(0,_jsxRuntime.jsx)(_ComposerAttachments.ComposerAttachments,{attachments:m,onRemove:b,labels:p,testID:`${x}-attachments`}):null,A=y||R||n?(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[y,R,n]}):void 0,f=d?(0,_jsxRuntime.jsx)(_mobileUi.IconButton,{icon:"paperclip",accessibilityLabel:_.attach,variant:"ghost",tone:"neutral",disabled:a||t,onPress:d,testID:`${x}-attach`}):void 0;return(0,_jsxRuntime.jsx)(_mobileUi.Composer,{onSend:e,value:g,onChangeText:v,loading:t,onStop:s,stopLabel:_.stop,disabled:a,maxLength:o,canSend:!j&&(!!C||void 0),placeholder:_.placeholder,accessibilityLabel:_.composer,labels:{send:_.send},leading:f,above:A,below:i,keyboardAware:r,keyboardOffset:c,safeArea:l,testID:x})};exports.ChatComposer=ChatComposer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatConversationList=void 0;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatConversationList=void 0;var _chat=require("@webority/markdown-core/chat"),_mobileCore=require("@webority/mobile-core"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_jsxRuntime=require("react/jsx-runtime");const messageOf=(e,t)=>{const i=e?.message;return"string"==typeof i&&i?i:t},IDLE_STATE={items:[],totalCount:null,loading:!0,error:null,hasMore:!1},IDLE={getState:()=>IDLE_STATE,subscribe:()=>()=>{}},ChatConversationList=({client:e,onOpen:t,onDeleted:i,pageSize:s=20,labels:n,style:a,testID:r="chat-conversations"})=>{const l=(0,_chat.mergeLabels)(n),o=(0,_mobileUi.useTheme)(),[c,m]=(0,_react.useState)(null),u=c??IDLE,{items:d,loading:_,error:b,hasMore:x}=(0,_react.useSyncExternalStore)(u.subscribe,u.getState),[g,j]=(0,_react.useState)(!1),[h,p]=(0,_react.useState)(null),[v,y]=(0,_react.useState)(!1),[S,f]=(0,_react.useState)(""),[I,C]=(0,_react.useState)(null),[R,D]=(0,_react.useState)(""),[U,L]=(0,_react.useState)(!1),[T,w]=(0,_react.useState)(""),[E,$]=(0,_react.useState)(void 0),[P,O]=(0,_react.useState)("");(0,_react.useEffect)(()=>{const t=(0,_chat.createConversationList)({client:e,pageSize:s});return m(t),t.load(),()=>t.dispose()},[e,s]),(0,_react.useEffect)(()=>{let t=!0;return e.getSettings().then(e=>{t&&$(e.titleMaxLength)},e=>{t&&O(messageOf(e,l.renameFailed))}),()=>{t=!1}},[e,l.renameFailed]);const M=R.trim(),save=async()=>{if(I&&""!==M){L(!0),w("");try{await(c?.rename(I.publicId,M)),C(null)}catch(e){w(messageOf(e,l.renameFailed))}finally{L(!1)}}},q=!_&&!b&&0===d.length;return(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:a,contentContainerStyle:{padding:o.space.md,gap:o.space.sm,flexGrow:1},refreshControl:(0,_jsxRuntime.jsx)(_reactNative.RefreshControl,{refreshing:g,onRefresh:()=>{(async()=>{j(!0),await(c?.load()),j(!1)})()}}),accessibilityLabel:l.conversations,testID:r,children:[b&&(0,_jsxRuntime.jsx)(_mobileUi.Banner,{tone:"danger",message:b.message||l.loadFailed,actions:[{label:l.retry,onPress:()=>{c?.load()}}],testID:`${r}-error`}),q&&(0,_jsxRuntime.jsx)(_mobileUi.EmptyState,{size:"sm",title:l.conversationsEmptyTitle,description:l.conversationsEmptyText,testID:`${r}-empty`}),d.map(e=>(0,_jsxRuntime.jsx)(_mobileUi.Card,{variant:"outline",padding:"sm",onPress:()=>t(e),accessibilityLabel:e.title||l.untitled,testID:`${r}-item-${e.publicId}`,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flexDirection:"row",alignItems:"center",gap:o.space.sm},children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1,minWidth:0},children:[(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"label",numberOfLines:1,children:e.title||l.untitled}),(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",children:(0,_mobileCore.formatDateTime)(e.lastMessageDateTimeUtc)})]}),(0,_jsxRuntime.jsx)(_mobileUi.IconButton,{icon:"edit",variant:"ghost",accessibilityLabel:l.renameConversation,onPress:()=>{w(""),D(e.title??""),C(e)},testID:`${r}-rename-${e.publicId}`}),(0,_jsxRuntime.jsx)(_mobileUi.IconButton,{icon:"trash",tone:"danger",variant:"ghost",accessibilityLabel:l.deleteConversation,onPress:()=>{f(""),p(e)},testID:`${r}-delete-${e.publicId}`})]})},e.publicId)),_&&!g&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{gap:o.space.sm},accessibilityElementsHidden:!0,children:[(0,_jsxRuntime.jsx)(_mobileUi.Skeleton,{height:56}),(0,_jsxRuntime.jsx)(_mobileUi.Skeleton,{height:56}),(0,_jsxRuntime.jsx)(_mobileUi.Skeleton,{height:56})]}),!_&&x&&(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:l.loadMore,variant:"outline",onPress:()=>{c?.loadMore()},testID:`${r}-more`}),(0,_jsxRuntime.jsxs)(_mobileUi.Dialog,{visible:null!==I,onClose:()=>{U||C(null)},title:l.renameConversation,dismissOnAction:!1,actions:[{label:l.cancel,tone:"neutral",disabled:U,onPress:()=>C(null)},{label:l.renameSave,disabled:""===M||U,loading:U,onPress:()=>{save()}}],testID:`${r}-rename`,children:[(0,_jsxRuntime.jsx)(_mobileUi.Input,{label:l.conversationTitle,value:R,onChangeText:D,maxLength:E,returnKeyType:"done",onSubmitEditing:()=>{save()},testID:`${r}-rename-input`}),""!==(T||P)&&(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"danger",testID:`${r}-rename-error`,children:T||P})]}),(0,_jsxRuntime.jsx)(_mobileUi.Dialog,{visible:null!==h,onClose:()=>{v||p(null)},tone:"warning",title:l.deleteConfirmTitle,message:S||l.deleteConfirmMessage,dismissOnAction:!1,actions:[{label:l.cancel,tone:"neutral",disabled:v,onPress:()=>p(null)},{label:l.deleteConfirm,tone:"danger",loading:v,onPress:()=>{(async()=>{if(h){y(!0),f("");try{await(c?.remove(h.publicId)),i?.(h.publicId),p(null)}catch(e){f(messageOf(e,l.deleteFailed))}finally{y(!1)}}})()}}],testID:`${r}-confirm`})]})};exports.ChatConversationList=ChatConversationList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatLauncher=void 0;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatLauncher=void 0;var _chat=require("@webority/markdown-core/chat"),_mobileUi=require("@webority/mobile-ui"),_jsxRuntime=require("react/jsx-runtime");const ChatLauncher=({onPress:e,position:t="end",bottomOffset:o,compact:r=!1,labels:i,testID:s="chat-launcher"})=>{const a=(0,_chat.mergeLabels)(i);return(0,_jsxRuntime.jsx)(_mobileUi.FloatingActionButton,{icon:"messages",label:r?void 0:a.launcher,accessibilityLabel:a.launcher,position:"end"===t?"bottomRight":"bottomLeft",bottomOffset:o,onPress:e,testID:s})};exports.ChatLauncher=ChatLauncher;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatMessage=void 0;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatMessage=void 0;var _markdownCore=require("@webority/markdown-core"),_chat=require("@webority/markdown-core/chat"),_clipboard=require("@webority/mobile-core/clipboard"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_ActionCard=require("./ActionCard.js"),_ChatMarkdown=require("./ChatMarkdown.js"),_ReplyRating=require("./ReplyRating.js"),_jsxRuntime=require("react/jsx-runtime");function ChatMessageView({turn:e,canRegenerate:t=!1,onRetry:i,onRegenerate:s,onEdit:n,onOpenAttachment:a,onRate:r,resolveLink:o,onLinkPress:l,isCitation:c,onOpenCitation:m,onAskSuggestion:u,confirmAction:x,onViewTicket:_,renderReply:p,labels:g,testID:d="chat-message"}){const b=(0,_chat.mergeLabels)(g),j=(0,_mobileUi.useTheme)(),[w,R]=(0,_react.useState)(!1),h=(0,_react.useRef)(null);(0,_react.useEffect)(()=>()=>{null!==h.current&&clearTimeout(h.current)},[]);const y=e.streaming&&!e.answer,k=(0,_react.useMemo)(()=>e.streaming?e.answer:(0,_markdownCore.markdownToPlainText)(e.answer),[e.streaming,e.answer]),C=(0,_react.useMemo)(()=>({you:b.you}),[b.you]),v=!e.streaming&&(e.stopped||null!==e.error),I=!e.streaming&&null!==e.questionId,T=e.attachments.length>0||e.stopped||i&&v||n&&I?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{gap:j.space.xs},children:[e.attachments.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flexDirection:"row",flexWrap:"wrap",gap:j.space.xs},children:e.attachments.map(e=>(0,_jsxRuntime.jsx)(_mobileUi.Chip,{label:e.fileName,onPress:a?()=>a(e):void 0,testID:`${d}-attachment-${e.publicId}`},e.publicId))}):null,e.stopped?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"bodySmall",color:"secondary",accessibilityLiveRegion:"polite",testID:`${d}-stopped`,children:b.stopped}):null,i&&v||n&&I?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flexDirection:"row",flexWrap:"wrap",gap:j.space.xs},children:[i&&v?(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:b.retry,variant:"link",size:"sm",onPress:()=>i(e.id),testID:`${d}-retry`}):null,n&&I?(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:b.edit,variant:"link",size:"sm",onPress:()=>n(e.id),testID:`${d}-edit`}):null]}):null]}):null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{gap:j.space.sm},testID:d,children:[""!==e.question&&(0,_jsxRuntime.jsx)(_mobileUi.MessageBubble,{side:"mine",text:e.question,labels:C,footer:T,testID:`${d}-question`}),y?(0,_jsxRuntime.jsx)(_mobileUi.TypingIndicator,{label:b.thinking,testID:`${d}-thinking`}):null,""!==e.answer?(0,_jsxRuntime.jsx)(_mobileUi.MessageBubble,{side:"theirs",author:b.assistant,text:k,streaming:e.streaming,onCopy:()=>{(0,_clipboard.copyText)((0,_markdownCore.markdownToPlainText)(e.answer))},testID:`${d}-answer`,children:p?p(e,{streaming:e.streaming}):(0,_jsxRuntime.jsx)(_ChatMarkdown.ChatMarkdown,{text:e.answer,resolveLink:o,onLinkPress:l,isCitation:c,onOpenCitation:m})}):null,e.streaming&&e.step?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",accessibilityLiveRegion:"polite",testID:`${d}-step`,children:b.toolStep(e.step)}):null,e.streaming||""===e.answer?null:(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:w?b.copied:b.copy,variant:"link",size:"sm",onPress:()=>{(async()=>{await(0,_clipboard.copyText)((0,_markdownCore.markdownToPlainText)(e.answer))&&(R(!0),null!==h.current&&clearTimeout(h.current),h.current=setTimeout(()=>R(!1),2e3))})()},testID:`${d}-copy`}),u&&!e.streaming&&e.suggestions.length>0?(0,_jsxRuntime.jsx)(_reactNative.View,{accessibilityRole:"list",accessibilityLabel:b.suggestions,style:{flexDirection:"row",flexWrap:"wrap",gap:j.space.xs},children:e.suggestions.map((e,t)=>(0,_jsxRuntime.jsx)(_mobileUi.Chip,{label:e,onPress:()=>u(e),testID:`${d}-suggestion-${t}`},e))}):null,t&&s&&!e.streaming&&""!==e.answer?(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:b.regenerate,variant:"link",size:"sm",onPress:()=>s(e.id),testID:`${d}-regenerate`}):null,e.error&&(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"bodySmall",color:"danger",accessibilityLiveRegion:"polite",children:e.error.message}),x&&!e.streaming&&e.actions.map(e=>(0,_jsxRuntime.jsx)(_ActionCard.ActionCard,{action:e,confirmAction:x,onViewTicket:_,labels:g},e.token)),r&&e.messageId&&!e.streaming&&(0,_jsxRuntime.jsx)(_ReplyRating.ReplyRating,{rating:e.rating,onRate:(t,i)=>r(e.id,t,i),labels:g})]})}const ChatMessage=exports.ChatMessage=(0,_react.memo)(ChatMessageView);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatScreen=ChatScreen;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatScreen=ChatScreen;var _chat=require("@webority/markdown-core/chat"),_mobileUi=require("@webority/mobile-ui"),_reactNative=require("react-native"),_ChatComposer=require("./ChatComposer.js"),_ChatThread=require("./ChatThread.js"),_jsxRuntime=require("react/jsx-runtime");function ChatScreen({chat:e,pickAttachments:t,onOpenAttachment:s,title:i,headerActions:a,empty:n,disclaimer:r,maxLength:o=4e3,allowanceThreshold:l=10,rating:m=!0,keyboardOffset:c,testID:d="chat-screen",...h}){const u=(0,_chat.mergeLabels)(h.labels),x=(0,_mobileUi.useTheme)(),b=e.messagesLeftToday,g=void 0===r?u.disclaimer:r,_=t&&e.settings?.attachments?async()=>e.attach(await t()):void 0;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flex:1,backgroundColor:x.colors.bg},testID:d,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flexDirection:"row",alignItems:"center",gap:x.space.sm,paddingHorizontal:x.space.md,paddingVertical:x.space.sm,borderBottomWidth:1,borderBottomColor:x.colors["border-subtle"]},children:[(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"title",accessibilityRole:"header",style:{flex:1},numberOfLines:1,children:i??u.panelTitle}),a,(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:u.newChat,size:"sm",variant:"soft",leftIcon:"add",disabled:0===e.turns.length&&!e.loading,onPress:e.newConversation,testID:`${d}-new`})]}),e.loading?(0,_jsxRuntime.jsx)(_reactNative.View,{style:{flex:1,alignItems:"center",justifyContent:"center"},children:(0,_jsxRuntime.jsx)(_mobileUi.Spinner,{message:u.loadingConversation,testID:`${d}-loading`})}):(0,_jsxRuntime.jsx)(_ChatThread.ChatThread,{turns:e.turns,style:{flex:1},keyboardOffset:c,onRate:m?e.rate:void 0,onRetry:e.retry,onRegenerate:e.regenerate,onEdit:e.startEdit,onOpenAttachment:s,empty:n??(0,_jsxRuntime.jsx)(_mobileUi.EmptyState,{fill:!0,size:"sm",title:u.emptyTitle,description:u.emptyText,testID:`${d}-empty`}),testID:`${d}-thread`,...h,onAskSuggestion:e.submit}),(0,_jsxRuntime.jsx)(_ChatComposer.ChatComposer,{onSubmit:t=>{e.submit(t)},busy:e.streaming,onStop:e.stop,disabled:0===b||e.loading,maxLength:o,keyboardOffset:c,labels:h.labels,onAttach:_,attachments:e.attachments,onRemoveAttachment:t=>{e.removeAttachment(t)},editing:e.editing,onCancelEdit:e.cancelEdit,testID:`${d}-composer`,above:(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[e.loadError&&(0,_jsxRuntime.jsx)(_mobileUi.Banner,{tone:"danger",message:e.loadError.message,testID:`${d}-load-error`}),e.settingsError&&(0,_jsxRuntime.jsx)(_mobileUi.Banner,{tone:"danger",message:e.settingsError.message,testID:`${d}-settings-error`}),null!==b&&b<=l&&(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:0===b?"danger":"secondary",accessibilityLiveRegion:"polite",testID:`${d}-allowance`,children:u.allowance(b)})]}),below:g?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"tertiary",testID:`${d}-disclaimer`,children:g}):null})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatThread=ChatThread;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ChatThread=ChatThread;var _chat=require("@webority/markdown-core/chat"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_ChatMessage=require("./ChatMessage.js"),_jsxRuntime=require("react/jsx-runtime");const turnKey=e=>e.id,followTurn=()=>!0,TurnGap=()=>{const e=(0,_mobileUi.useTheme)();return(0,_jsxRuntime.jsx)(_reactNative.View,{style:{height:e.space.lg}})};function ChatThread({turns:e,empty:t,keyboardAware:r,keyboardOffset:a,onRetry:s,onRegenerate:n,onEdit:i,onOpenAttachment:o,onAskSuggestion:u,style:c,testID:l="chat-thread",...d}){const m=(0,_chat.mergeLabels)(d.labels),h=(0,_react.useMemo)(()=>[...e].reverse(),[e]),g=(0,_react.useMemo)(()=>{const t=e[e.length-1];return t&&null!==t.messageId&&!t.streaming?t.id:null},[e]),y=e[e.length-1]?.id;return(0,_jsxRuntime.jsx)(_mobileUi.MessageList,{messages:h,keyExtractor:turnKey,renderMessage:({item:e})=>(0,_jsxRuntime.jsx)(_ChatMessage.ChatMessage,{turn:e,onRetry:s,canRegenerate:e.id===g,onRegenerate:e.id===g?n:void 0,onEdit:i,onOpenAttachment:o,testID:`${l}-${e.id}`,...d,onAskSuggestion:e.id===y?u:void 0}),followNew:followTurn,empty:t,ItemSeparatorComponent:TurnGap,keyboardAware:r,keyboardOffset:a,accessibilityLabel:m.thread,style:c,testID:l})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ComposerAttachments=void 0;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ComposerAttachments=void 0;var _chat=require("@webority/markdown-core/chat"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_jsxRuntime=require("react/jsx-runtime");const ComposerAttachments=({attachments:e,onRemove:t,labels:r,testID:s="composer-attachments"})=>{const a=(0,_mobileUi.useTheme)(),i=(0,_react.useMemo)(()=>buildStyles(a),[a]),o=(0,_chat.mergeLabels)(r),m=(0,_react.useMemo)(()=>({remove:o.removeAttachment}),[o.removeAttachment]);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:i.root,testID:s,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:i.row,children:e.map(e=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:i.item,children:[(0,_jsxRuntime.jsx)(_mobileUi.Chip,{label:e.fileName,variant:"soft",onRemove:t?()=>t(e.key):void 0,labels:m,removeTestID:`chat-attachment-remove-${e.key}`,testID:`${s}-${e.key}`}),"Uploading"===e.status?(0,_jsxRuntime.jsx)(_mobileUi.ProgressBar,{progress:e.progress??void 0,label:o.attachmentUploading,height:4,containerStyle:i.progress}):null,"Failed"===e.status?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"danger",accessibilityLiveRegion:"polite",children:o.attachmentFailed}):null]},e.key))})})};exports.ComposerAttachments=ComposerAttachments;const buildStyles=e=>_reactNative.StyleSheet.create({root:{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.ReplyRating=void 0;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReplyRating=void 0;var _chat=require("@webority/markdown-core/chat"),_mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_jsxRuntime=require("react/jsx-runtime");const ReplyRating=({rating:e=null,onRate:t,noteMaxLength:i=1e3,labels:a,testID:s="chat-rating"})=>{const n=(0,_chat.mergeLabels)(a),r=(0,_mobileUi.useTheme)(),[l,o]=(0,_react.useState)(!1),[c,d]=(0,_react.useState)(!1),[u,m]=(0,_react.useState)(""),[x,_]=(0,_react.useState)(""),[b,p]=(0,_react.useState)(!1),save=async(e,i)=>{o(!0),_("");try{await t(e,i),d("Down"===e&&void 0===i),p("Up"===e||void 0!==i),void 0!==i&&m("")}catch{_(n.ratingFailed)}finally{o(!1)}};return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{gap:r.space.sm},testID:s,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:r.space.xs},children:[(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:n.rateUp,size:"sm",leftIcon:"like",variant:"Up"===e?"soft":"ghost",accessibilityState:{selected:"Up"===e,disabled:l},"aria-selected":"Up"===e,"aria-disabled":l,disabled:l,onPress:()=>{save("Up")},testID:`${s}-up`}),(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:n.rateDown,size:"sm",leftIcon:"dislike",variant:"Down"===e?"soft":"ghost",accessibilityState:{selected:"Down"===e,disabled:l},"aria-selected":"Down"===e,"aria-disabled":l,disabled:l,onPress:()=>{save("Down")},testID:`${s}-down`}),b&&!c&&(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"caption",color:"secondary",accessibilityLiveRegion:"polite",children:n.rated})]}),""!==x&&(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"bodySmall",color:"danger",accessibilityLiveRegion:"polite",children:x}),c&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{gap:r.space.sm},children:[(0,_jsxRuntime.jsx)(_mobileUi.Input,{label:n.ratingNote,helperText:n.ratingNoteHint,multiline:!0,maxLength:i,value:u,onChangeText:m,testID:`${s}-note`}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{flexDirection:"row",gap:r.space.sm},children:[(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:n.ratingNoteSend,size:"sm",loading:l,disabled:l,onPress:()=>{save("Down",u)},testID:`${s}-note-send`}),(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:n.ratingNoteSkip,size:"sm",variant:"outline",disabled:l,onPress:()=>{d(!1),p(!0)},testID:`${s}-note-skip`})]})]})]})};exports.ReplyRating=ReplyRating;
|
package/lib/commonjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ActionCard",{enumerable:!0,get:function(){return _ActionCard.ActionCard}}),Object.defineProperty(exports,"ChatApiError",{enumerable:!0,get:function(){return
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ActionCard",{enumerable:!0,get:function(){return _ActionCard.ActionCard}}),Object.defineProperty(exports,"ChatApiError",{enumerable:!0,get:function(){return _chat.ChatApiError}}),Object.defineProperty(exports,"ChatComposer",{enumerable:!0,get:function(){return _ChatComposer.ChatComposer}}),Object.defineProperty(exports,"ChatConversationList",{enumerable:!0,get:function(){return _ChatConversationList.ChatConversationList}}),Object.defineProperty(exports,"ChatLauncher",{enumerable:!0,get:function(){return _ChatLauncher.ChatLauncher}}),Object.defineProperty(exports,"ChatMarkdown",{enumerable:!0,get:function(){return _ChatMarkdown.ChatMarkdown}}),Object.defineProperty(exports,"ChatMessage",{enumerable:!0,get:function(){return _ChatMessage.ChatMessage}}),Object.defineProperty(exports,"ChatScreen",{enumerable:!0,get:function(){return _ChatScreen.ChatScreen}}),Object.defineProperty(exports,"ChatThread",{enumerable:!0,get:function(){return _ChatThread.ChatThread}}),Object.defineProperty(exports,"DEFAULT_CHAT_LABELS",{enumerable:!0,get:function(){return _chat.DEFAULT_CHAT_LABELS}}),Object.defineProperty(exports,"ReplyRating",{enumerable:!0,get:function(){return _ReplyRating.ReplyRating}}),Object.defineProperty(exports,"createChatClient",{enumerable:!0,get:function(){return _chat.createChatClient}}),Object.defineProperty(exports,"createChatSession",{enumerable:!0,get:function(){return _chat.createChatSession}}),Object.defineProperty(exports,"createConversationList",{enumerable:!0,get:function(){return _chat.createConversationList}}),Object.defineProperty(exports,"createSseParser",{enumerable:!0,get:function(){return _chat.createSseParser}}),Object.defineProperty(exports,"useChat",{enumerable:!0,get:function(){return _useChat.useChat}});var _chat=require("@webority/markdown-core/chat"),_ActionCard=require("./components/ActionCard.js"),_ChatComposer=require("./components/ChatComposer.js"),_ChatConversationList=require("./components/ChatConversationList.js"),_ChatLauncher=require("./components/ChatLauncher.js"),_ChatMarkdown=require("./components/ChatMarkdown.js"),_ChatMessage=require("./components/ChatMessage.js"),_ChatScreen=require("./components/ChatScreen.js"),_ChatThread=require("./components/ChatThread.js"),_ReplyRating=require("./components/ReplyRating.js"),_useChat=require("./useChat.js");
|
package/lib/commonjs/useChat.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useChat=void 0;var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useChat=void 0;var _chat=require("@webority/markdown-core/chat"),_react=require("react");const requestFrame=e=>{const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)},useChat=({client:e,pageContext:t})=>{const r=(0,_react.useRef)(t);r.current=t;const a=(0,_react.useMemo)(()=>(0,_chat.createChatSession)({client:e,pageContext:()=>r.current,schedule:requestFrame}),[e]);(0,_react.useEffect)(()=>()=>a.dispose(),[a]);return{...(0,_react.useSyncExternalStore)(a.subscribe,a.getState),...(0,_react.useMemo)(()=>({submit:e=>a.submit(e),stop:()=>a.stop(),retry:e=>a.retry(e),regenerate:e=>a.regenerate(e),startEdit:e=>a.startEdit(e),cancelEdit:()=>a.cancelEdit(),attach:e=>a.attach(e),removeAttachment:e=>a.removeAttachment(e),openConversation:e=>a.openConversation(e),newConversation:()=>a.newConversation(),rate:(e,t,r)=>a.rate(e,t,r),refreshAllowance:()=>a.refreshAllowance(),reset:()=>a.reset()}),[a]),client:a.client}};exports.useChat=useChat;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{mergeLabels}from"@webority/
|
|
1
|
+
"use strict";import{mergeLabels}from"@webority/markdown-core/chat";import{Banner,Button,Card,Text,useTheme}from"@webority/mobile-ui";import{useState}from"react";import{View}from"react-native";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const titleOf=(e,t)=>"Reply"===e.kind?t.actionReply(e.ticketNumber??""):"Reopen"===e.kind?t.actionReopen(e.ticketNumber??""):t.actionRaiseTicket,doneText=(e,t,i)=>"Reply"===e.kind?i.actionDoneReply(t):"Reopen"===e.kind?i.actionDoneReopen(t):i.actionDoneRaiseTicket(t);export const ActionCard=({action:e,confirmAction:t,onViewTicket:i,labels:n,testID:s="chat-action"})=>{const a=mergeLabels(n),o=useTheme(),[r,c]=useState("ready"),[l,d]=useState(null),[m,x]=useState("");if("dismissed"===r)return _jsx(Text,{variant:"bodySmall",color:"secondary",testID:s,children:a.actionDismissed});if("done"===r&&l)return _jsx(Banner,{tone:"success",message:doneText(e,l.number,a),actions:i?[{label:a.viewTicket,onPress:()=>i(l)}]:void 0,testID:s});const p="sending"===r,y=new Date(e.expiresDateTimeUtc).getTime()<=Date.now(),b="RaiseTicket"===e.kind?[e.category,e.subject].filter(Boolean).join(", "):"";return _jsx(Card,{variant:"outline",padding:"sm",testID:s,children:_jsxs(View,{style:{gap:o.space.sm},children:[_jsx(Text,{variant:"label",children:titleOf(e,a)}),""!==b&&_jsx(Text,{variant:"bodySmall",color:"secondary",children:b}),"Reopen"!==e.kind&&e.body?_jsx(Text,{variant:"bodySmall",children:e.body}):null,y?_jsx(Text,{variant:"bodySmall",color:"secondary",children:a.actionExpired}):_jsxs(_Fragment,{children:[_jsx(Text,{variant:"caption",color:"secondary",children:a.actionNote}),""!==m&&_jsx(Text,{variant:"bodySmall",color:"danger",accessibilityLiveRegion:"polite",children:m}),_jsxs(View,{style:{flexDirection:"row",flexWrap:"wrap",gap:o.space.sm},children:[_jsx(Button,{label:a.actionConfirm,size:"sm",loading:p,disabled:p,onPress:()=>{(async()=>{c("sending"),x("");try{d(await t(e.token)),c("done")}catch(e){const t=e?.message;x("string"==typeof t&&t?t:a.actionFailed),c("ready")}})()},testID:`${s}-confirm`}),_jsx(Button,{label:a.actionDismiss,size:"sm",variant:"outline",disabled:p,onPress:()=>c("dismissed"),testID:`${s}-dismiss`})]})]})]})})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{mergeLabels}from"@webority/
|
|
1
|
+
"use strict";import{mergeLabels}from"@webority/markdown-core/chat";import{Banner,Composer,IconButton}from"@webority/mobile-ui";import{useEffect,useState}from"react";import{ComposerAttachments}from"./ComposerAttachments.js";import{jsx as _jsx,Fragment as _Fragment,jsxs as _jsxs}from"react/jsx-runtime";export const ChatComposer=({onSubmit:e,busy:t=!1,onStop:s,disabled:a=!1,maxLength:o=4e3,above:n,below:r,keyboardAware:i,keyboardOffset:c,safeArea:m,attachments:l=[],onAttach:d,onRemoveAttachment:b,editing:p,onCancelEdit:h,labels:u,testID:g="chat-composer"})=>{const f=mergeLabels(u),x=l.some(e=>"Uploading"===e.status),y=l.some(e=>"Ready"===e.status),[j,v]=useState("");useEffect(()=>{v(p?p.text:"")},[p]);const A=p?_jsx(Banner,{message:f.editing,accessibilityRole:"summary",actions:h?[{label:f.cancel,onPress:h,testID:`${g}-cancel-edit`}]:void 0,testID:`${g}-editing`}):null,C=l.length>0?_jsx(ComposerAttachments,{attachments:l,onRemove:b,labels:u,testID:`${g}-attachments`}):null,_=A||C||n?_jsxs(_Fragment,{children:[A,C,n]}):void 0,I=d?_jsx(IconButton,{icon:"paperclip",accessibilityLabel:f.attach,variant:"ghost",tone:"neutral",disabled:a||t,onPress:d,testID:`${g}-attach`}):void 0;return _jsx(Composer,{onSend:e,value:j,onChangeText:v,loading:t,onStop:s,stopLabel:f.stop,disabled:a,maxLength:o,canSend:!x&&(!!y||void 0),placeholder:f.placeholder,accessibilityLabel:f.composer,labels:{send:f.send},leading:I,above:_,below:r,keyboardAware:i,keyboardOffset:c,safeArea:m,testID:g})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{createConversationList,mergeLabels}from"@webority/
|
|
1
|
+
"use strict";import{createConversationList,mergeLabels}from"@webority/markdown-core/chat";import{formatDateTime}from"@webority/mobile-core";import{Banner,Button,Card,Dialog,EmptyState,IconButton,Input,Skeleton,Text,useTheme}from"@webority/mobile-ui";import{useEffect,useState,useSyncExternalStore}from"react";import{RefreshControl,ScrollView,View}from"react-native";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const messageOf=(e,t)=>{const s=e?.message;return"string"==typeof s&&s?s:t},IDLE_STATE={items:[],totalCount:null,loading:!0,error:null,hasMore:!1},IDLE={getState:()=>IDLE_STATE,subscribe:()=>()=>{}};export const ChatConversationList=({client:e,onOpen:t,onDeleted:s,pageSize:n=20,labels:a,style:i,testID:l="chat-conversations"})=>{const r=mergeLabels(a),o=useTheme(),[c,m]=useState(null),d=c??IDLE,{items:u,loading:g,error:b,hasMore:p}=useSyncExternalStore(d.subscribe,d.getState),[x,h]=useState(!1),[f,S]=useState(null),[y,I]=useState(!1),[j,v]=useState(""),[D,_]=useState(null),[C,T]=useState(""),[E,w]=useState(!1),[L,$]=useState(""),[P,O]=useState(void 0),[B,M]=useState("");useEffect(()=>{const t=createConversationList({client:e,pageSize:n});return m(t),t.load(),()=>t.dispose()},[e,n]),useEffect(()=>{let t=!0;return e.getSettings().then(e=>{t&&O(e.titleMaxLength)},e=>{t&&M(messageOf(e,r.renameFailed))}),()=>{t=!1}},[e,r.renameFailed]);const V=C.trim(),save=async()=>{if(D&&""!==V){w(!0),$("");try{await(c?.rename(D.publicId,V)),_(null)}catch(e){$(messageOf(e,r.renameFailed))}finally{w(!1)}}},k=!g&&!b&&0===u.length;return _jsxs(ScrollView,{style:i,contentContainerStyle:{padding:o.space.md,gap:o.space.sm,flexGrow:1},refreshControl:_jsx(RefreshControl,{refreshing:x,onRefresh:()=>{(async()=>{h(!0),await(c?.load()),h(!1)})()}}),accessibilityLabel:r.conversations,testID:l,children:[b&&_jsx(Banner,{tone:"danger",message:b.message||r.loadFailed,actions:[{label:r.retry,onPress:()=>{c?.load()}}],testID:`${l}-error`}),k&&_jsx(EmptyState,{size:"sm",title:r.conversationsEmptyTitle,description:r.conversationsEmptyText,testID:`${l}-empty`}),u.map(e=>_jsx(Card,{variant:"outline",padding:"sm",onPress:()=>t(e),accessibilityLabel:e.title||r.untitled,testID:`${l}-item-${e.publicId}`,children:_jsxs(View,{style:{flexDirection:"row",alignItems:"center",gap:o.space.sm},children:[_jsxs(View,{style:{flex:1,minWidth:0},children:[_jsx(Text,{variant:"label",numberOfLines:1,children:e.title||r.untitled}),_jsx(Text,{variant:"caption",color:"secondary",children:formatDateTime(e.lastMessageDateTimeUtc)})]}),_jsx(IconButton,{icon:"edit",variant:"ghost",accessibilityLabel:r.renameConversation,onPress:()=>{$(""),T(e.title??""),_(e)},testID:`${l}-rename-${e.publicId}`}),_jsx(IconButton,{icon:"trash",tone:"danger",variant:"ghost",accessibilityLabel:r.deleteConversation,onPress:()=>{v(""),S(e)},testID:`${l}-delete-${e.publicId}`})]})},e.publicId)),g&&!x&&_jsxs(View,{style:{gap:o.space.sm},accessibilityElementsHidden:!0,children:[_jsx(Skeleton,{height:56}),_jsx(Skeleton,{height:56}),_jsx(Skeleton,{height:56})]}),!g&&p&&_jsx(Button,{label:r.loadMore,variant:"outline",onPress:()=>{c?.loadMore()},testID:`${l}-more`}),_jsxs(Dialog,{visible:null!==D,onClose:()=>{E||_(null)},title:r.renameConversation,dismissOnAction:!1,actions:[{label:r.cancel,tone:"neutral",disabled:E,onPress:()=>_(null)},{label:r.renameSave,disabled:""===V||E,loading:E,onPress:()=>{save()}}],testID:`${l}-rename`,children:[_jsx(Input,{label:r.conversationTitle,value:C,onChangeText:T,maxLength:P,returnKeyType:"done",onSubmitEditing:()=>{save()},testID:`${l}-rename-input`}),""!==(L||B)&&_jsx(Text,{variant:"caption",color:"danger",testID:`${l}-rename-error`,children:L||B})]}),_jsx(Dialog,{visible:null!==f,onClose:()=>{y||S(null)},tone:"warning",title:r.deleteConfirmTitle,message:j||r.deleteConfirmMessage,dismissOnAction:!1,actions:[{label:r.cancel,tone:"neutral",disabled:y,onPress:()=>S(null)},{label:r.deleteConfirm,tone:"danger",loading:y,onPress:()=>{(async()=>{if(f){I(!0),v("");try{await(c?.remove(f.publicId)),s?.(f.publicId),S(null)}catch(e){v(messageOf(e,r.deleteFailed))}finally{I(!1)}}})()}}],testID:`${l}-confirm`})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{mergeLabels}from"@webority/
|
|
1
|
+
"use strict";import{mergeLabels}from"@webority/markdown-core/chat";import{FloatingActionButton}from"@webority/mobile-ui";import{jsx as _jsx}from"react/jsx-runtime";export const ChatLauncher=({onPress:t,position:o="end",bottomOffset:e,compact:s=!1,labels:r,testID:i="chat-launcher"})=>{const n=mergeLabels(r);return _jsx(FloatingActionButton,{icon:"messages",label:s?void 0:n.launcher,accessibilityLabel:n.launcher,position:"end"===o?"bottomRight":"bottomLeft",bottomOffset:e,onPress:t,testID:i})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{
|
|
1
|
+
"use strict";import{markdownToPlainText}from"@webority/markdown-core";import{mergeLabels}from"@webority/markdown-core/chat";import{copyText}from"@webority/mobile-core/clipboard";import{Button,Chip,MessageBubble,Text,TypingIndicator,useTheme}from"@webority/mobile-ui";import{memo,useEffect,useMemo,useRef,useState}from"react";import{View}from"react-native";import{ActionCard}from"./ActionCard.js";import{ChatMarkdown}from"./ChatMarkdown.js";import{ReplyRating}from"./ReplyRating.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";function ChatMessageView({turn:e,canRegenerate:t=!1,onRetry:s,onRegenerate:n,onEdit:i,onOpenAttachment:a,onRate:r,resolveLink:o,onLinkPress:l,isCitation:c,onOpenCitation:m,onAskSuggestion:p,confirmAction:u,onViewTicket:g,renderReply:d,labels:x,testID:w="chat-message"}){const y=mergeLabels(x),b=useTheme(),[h,j]=useState(!1),f=useRef(null);useEffect(()=>()=>{null!==f.current&&clearTimeout(f.current)},[]);const T=e.streaming&&!e.answer,k=useMemo(()=>e.streaming?e.answer:markdownToPlainText(e.answer),[e.streaming,e.answer]),_=useMemo(()=>({you:y.you}),[y.you]),I=!e.streaming&&(e.stopped||null!==e.error),R=!e.streaming&&null!==e.questionId,C=e.attachments.length>0||e.stopped||s&&I||i&&R?_jsxs(View,{style:{gap:b.space.xs},children:[e.attachments.length>0?_jsx(View,{style:{flexDirection:"row",flexWrap:"wrap",gap:b.space.xs},children:e.attachments.map(e=>_jsx(Chip,{label:e.fileName,onPress:a?()=>a(e):void 0,testID:`${w}-attachment-${e.publicId}`},e.publicId))}):null,e.stopped?_jsx(Text,{variant:"bodySmall",color:"secondary",accessibilityLiveRegion:"polite",testID:`${w}-stopped`,children:y.stopped}):null,s&&I||i&&R?_jsxs(View,{style:{flexDirection:"row",flexWrap:"wrap",gap:b.space.xs},children:[s&&I?_jsx(Button,{label:y.retry,variant:"link",size:"sm",onPress:()=>s(e.id),testID:`${w}-retry`}):null,i&&R?_jsx(Button,{label:y.edit,variant:"link",size:"sm",onPress:()=>i(e.id),testID:`${w}-edit`}):null]}):null]}):null;return _jsxs(View,{style:{gap:b.space.sm},testID:w,children:[""!==e.question&&_jsx(MessageBubble,{side:"mine",text:e.question,labels:_,footer:C,testID:`${w}-question`}),T?_jsx(TypingIndicator,{label:y.thinking,testID:`${w}-thinking`}):null,""!==e.answer?_jsx(MessageBubble,{side:"theirs",author:y.assistant,text:k,streaming:e.streaming,onCopy:()=>{copyText(markdownToPlainText(e.answer))},testID:`${w}-answer`,children:d?d(e,{streaming:e.streaming}):_jsx(ChatMarkdown,{text:e.answer,resolveLink:o,onLinkPress:l,isCitation:c,onOpenCitation:m})}):null,e.streaming&&e.step?_jsx(Text,{variant:"caption",color:"secondary",accessibilityLiveRegion:"polite",testID:`${w}-step`,children:y.toolStep(e.step)}):null,e.streaming||""===e.answer?null:_jsx(Button,{label:h?y.copied:y.copy,variant:"link",size:"sm",onPress:()=>{(async()=>{await copyText(markdownToPlainText(e.answer))&&(j(!0),null!==f.current&&clearTimeout(f.current),f.current=setTimeout(()=>j(!1),2e3))})()},testID:`${w}-copy`}),p&&!e.streaming&&e.suggestions.length>0?_jsx(View,{accessibilityRole:"list",accessibilityLabel:y.suggestions,style:{flexDirection:"row",flexWrap:"wrap",gap:b.space.xs},children:e.suggestions.map((e,t)=>_jsx(Chip,{label:e,onPress:()=>p(e),testID:`${w}-suggestion-${t}`},e))}):null,t&&n&&!e.streaming&&""!==e.answer?_jsx(Button,{label:y.regenerate,variant:"link",size:"sm",onPress:()=>n(e.id),testID:`${w}-regenerate`}):null,e.error&&_jsx(Text,{variant:"bodySmall",color:"danger",accessibilityLiveRegion:"polite",children:e.error.message}),u&&!e.streaming&&e.actions.map(e=>_jsx(ActionCard,{action:e,confirmAction:u,onViewTicket:g,labels:x},e.token)),r&&e.messageId&&!e.streaming&&_jsx(ReplyRating,{rating:e.rating,onRate:(t,s)=>r(e.id,t,s),labels:x})]})}export const ChatMessage=memo(ChatMessageView);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{mergeLabels}from"@webority/
|
|
1
|
+
"use strict";import{mergeLabels}from"@webority/markdown-core/chat";import{Banner,Button,EmptyState,Spinner,Text,useTheme}from"@webority/mobile-ui";import{View}from"react-native";import{ChatComposer}from"./ChatComposer.js";import{ChatThread}from"./ChatThread.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";export function ChatScreen({chat:e,pickAttachments:t,onOpenAttachment:s,title:a,headerActions:r,empty:n,disclaimer:o,maxLength:i=4e3,allowanceThreshold:l=10,rating:m=!0,keyboardOffset:c,testID:d="chat-screen",...g}){const h=mergeLabels(g.labels),p=useTheme(),x=e.messagesLeftToday,b=void 0===o?h.disclaimer:o,y=t&&e.settings?.attachments?async()=>e.attach(await t()):void 0;return _jsxs(View,{style:{flex:1,backgroundColor:p.colors.bg},testID:d,children:[_jsxs(View,{style:{flexDirection:"row",alignItems:"center",gap:p.space.sm,paddingHorizontal:p.space.md,paddingVertical:p.space.sm,borderBottomWidth:1,borderBottomColor:p.colors["border-subtle"]},children:[_jsx(Text,{variant:"title",accessibilityRole:"header",style:{flex:1},numberOfLines:1,children:a??h.panelTitle}),r,_jsx(Button,{label:h.newChat,size:"sm",variant:"soft",leftIcon:"add",disabled:0===e.turns.length&&!e.loading,onPress:e.newConversation,testID:`${d}-new`})]}),e.loading?_jsx(View,{style:{flex:1,alignItems:"center",justifyContent:"center"},children:_jsx(Spinner,{message:h.loadingConversation,testID:`${d}-loading`})}):_jsx(ChatThread,{turns:e.turns,style:{flex:1},keyboardOffset:c,onRate:m?e.rate:void 0,onRetry:e.retry,onRegenerate:e.regenerate,onEdit:e.startEdit,onOpenAttachment:s,empty:n??_jsx(EmptyState,{fill:!0,size:"sm",title:h.emptyTitle,description:h.emptyText,testID:`${d}-empty`}),testID:`${d}-thread`,...g,onAskSuggestion:e.submit}),_jsx(ChatComposer,{onSubmit:t=>{e.submit(t)},busy:e.streaming,onStop:e.stop,disabled:0===x||e.loading,maxLength:i,keyboardOffset:c,labels:g.labels,onAttach:y,attachments:e.attachments,onRemoveAttachment:t=>{e.removeAttachment(t)},editing:e.editing,onCancelEdit:e.cancelEdit,testID:`${d}-composer`,above:_jsxs(_Fragment,{children:[e.loadError&&_jsx(Banner,{tone:"danger",message:e.loadError.message,testID:`${d}-load-error`}),e.settingsError&&_jsx(Banner,{tone:"danger",message:e.settingsError.message,testID:`${d}-settings-error`}),null!==x&&x<=l&&_jsx(Text,{variant:"caption",color:0===x?"danger":"secondary",accessibilityLiveRegion:"polite",testID:`${d}-allowance`,children:h.allowance(x)})]}),below:b?_jsx(Text,{variant:"caption",color:"tertiary",testID:`${d}-disclaimer`,children:b}):null})]})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{mergeLabels}from"@webority/
|
|
1
|
+
"use strict";import{mergeLabels}from"@webority/markdown-core/chat";import{MessageList,useTheme}from"@webority/mobile-ui";import{useMemo}from"react";import{View}from"react-native";import{ChatMessage}from"./ChatMessage.js";import{jsx as _jsx}from"react/jsx-runtime";const turnKey=e=>e.id,followTurn=()=>!0,TurnGap=()=>{const e=useTheme();return _jsx(View,{style:{height:e.space.lg}})};export function ChatThread({turns:e,empty:t,keyboardAware:r,keyboardOffset:s,onRetry:o,onRegenerate:n,onEdit:a,onOpenAttachment:i,onAskSuggestion:m,style:u,testID:l="chat-thread",...g}){const d=mergeLabels(g.labels),c=useMemo(()=>[...e].reverse(),[e]),h=useMemo(()=>{const t=e[e.length-1];return t&&null!==t.messageId&&!t.streaming?t.id:null},[e]),y=e[e.length-1]?.id;return _jsx(MessageList,{messages:c,keyExtractor:turnKey,renderMessage:({item:e})=>_jsx(ChatMessage,{turn:e,onRetry:o,canRegenerate:e.id===h,onRegenerate:e.id===h?n:void 0,onEdit:a,onOpenAttachment:i,testID:`${l}-${e.id}`,...g,onAskSuggestion:e.id===y?m:void 0}),followNew:followTurn,empty:t,ItemSeparatorComponent:TurnGap,keyboardAware:r,keyboardOffset:s,accessibilityLabel:d.thread,style:u,testID:l})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{mergeLabels}from"@webority/
|
|
1
|
+
"use strict";import{mergeLabels}from"@webority/markdown-core/chat";import{Chip,ProgressBar,Text,useTheme}from"@webority/mobile-ui";import{useMemo}from"react";import{StyleSheet,View}from"react-native";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const ComposerAttachments=({attachments:e,onRemove:t,labels:s,testID:r="composer-attachments"})=>{const o=useTheme(),a=useMemo(()=>buildStyles(o),[o]),i=mergeLabels(s),m=useMemo(()=>({remove:i.removeAttachment}),[i.removeAttachment]);return _jsx(View,{style:a.root,testID:r,children:_jsx(View,{style:a.row,children:e.map(e=>_jsxs(View,{style:a.item,children:[_jsx(Chip,{label:e.fileName,variant:"soft",onRemove:t?()=>t(e.key):void 0,labels:m,removeTestID:`chat-attachment-remove-${e.key}`,testID:`${r}-${e.key}`}),"Uploading"===e.status?_jsx(ProgressBar,{progress:e.progress??void 0,label:i.attachmentUploading,height:4,containerStyle:a.progress}):null,"Failed"===e.status?_jsx(Text,{variant:"caption",color:"danger",accessibilityLiveRegion:"polite",children:i.attachmentFailed}):null]},e.key))})})};const buildStyles=e=>StyleSheet.create({root:{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{mergeLabels}from"@webority/
|
|
1
|
+
"use strict";import{mergeLabels}from"@webority/markdown-core/chat";import{Button,Input,Text,useTheme}from"@webority/mobile-ui";import{useState}from"react";import{View}from"react-native";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const ReplyRating=({rating:e=null,onRate:t,noteMaxLength:s=1e3,labels:a,testID:i="chat-rating"})=>{const n=mergeLabels(a),o=useTheme(),[l,r]=useState(!1),[c,d]=useState(!1),[p,m]=useState(""),[x,b]=useState(""),[g,u]=useState(!1),save=async(e,s)=>{r(!0),b("");try{await t(e,s),d("Down"===e&&void 0===s),u("Up"===e||void 0!==s),void 0!==s&&m("")}catch{b(n.ratingFailed)}finally{r(!1)}};return _jsxs(View,{style:{gap:o.space.sm},testID:i,children:[_jsxs(View,{style:{flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:o.space.xs},children:[_jsx(Button,{label:n.rateUp,size:"sm",leftIcon:"like",variant:"Up"===e?"soft":"ghost",accessibilityState:{selected:"Up"===e,disabled:l},"aria-selected":"Up"===e,"aria-disabled":l,disabled:l,onPress:()=>{save("Up")},testID:`${i}-up`}),_jsx(Button,{label:n.rateDown,size:"sm",leftIcon:"dislike",variant:"Down"===e?"soft":"ghost",accessibilityState:{selected:"Down"===e,disabled:l},"aria-selected":"Down"===e,"aria-disabled":l,disabled:l,onPress:()=>{save("Down")},testID:`${i}-down`}),g&&!c&&_jsx(Text,{variant:"caption",color:"secondary",accessibilityLiveRegion:"polite",children:n.rated})]}),""!==x&&_jsx(Text,{variant:"bodySmall",color:"danger",accessibilityLiveRegion:"polite",children:x}),c&&_jsxs(View,{style:{gap:o.space.sm},children:[_jsx(Input,{label:n.ratingNote,helperText:n.ratingNoteHint,multiline:!0,maxLength:s,value:p,onChangeText:m,testID:`${i}-note`}),_jsxs(View,{style:{flexDirection:"row",gap:o.space.sm},children:[_jsx(Button,{label:n.ratingNoteSend,size:"sm",loading:l,disabled:l,onPress:()=>{save("Down",p)},testID:`${i}-note-send`}),_jsx(Button,{label:n.ratingNoteSkip,size:"sm",variant:"outline",disabled:l,onPress:()=>{d(!1),u(!0)},testID:`${i}-note-skip`})]})]})]})};
|
package/lib/module/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{ChatApiError,createChatClient,createChatSession,createConversationList,createSseParser,DEFAULT_CHAT_LABELS}from"@webority/
|
|
1
|
+
"use strict";export{ChatApiError,createChatClient,createChatSession,createConversationList,createSseParser,DEFAULT_CHAT_LABELS}from"@webority/markdown-core/chat";export{ActionCard}from"./components/ActionCard.js";export{ChatComposer}from"./components/ChatComposer.js";export{ChatConversationList}from"./components/ChatConversationList.js";export{ChatLauncher}from"./components/ChatLauncher.js";export{ChatMarkdown}from"./components/ChatMarkdown.js";export{ChatMessage}from"./components/ChatMessage.js";export{ChatScreen}from"./components/ChatScreen.js";export{ChatThread}from"./components/ChatThread.js";export{ReplyRating}from"./components/ReplyRating.js";export{useChat}from"./useChat.js";
|
package/lib/module/useChat.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{createChatSession}from"@webority/
|
|
1
|
+
"use strict";import{createChatSession}from"@webority/markdown-core/chat";import{useEffect,useMemo,useRef,useSyncExternalStore}from"react";const requestFrame=e=>{const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)};export const useChat=({client:e,pageContext:t})=>{const r=useRef(t);r.current=t;const n=useMemo(()=>createChatSession({client:e,pageContext:()=>r.current,schedule:requestFrame}),[e]);useEffect(()=>()=>n.dispose(),[n]);return{...useSyncExternalStore(n.subscribe,n.getState),...useMemo(()=>({submit:e=>n.submit(e),stop:()=>n.stop(),retry:e=>n.retry(e),regenerate:e=>n.regenerate(e),startEdit:e=>n.startEdit(e),cancelEdit:()=>n.cancelEdit(),attach:e=>n.attach(e),removeAttachment:e=>n.removeAttachment(e),openConversation:e=>n.openConversation(e),newConversation:()=>n.newConversation(),rate:(e,t,r)=>n.rate(e,t,r),refreshAllowance:()=>n.refreshAllowance(),reset:()=>n.reset()}),[n]),client:n.client}};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SupportAction, SupportActionTicket } from "@webority/
|
|
2
|
-
import { type ChatLabels } from "@webority/
|
|
1
|
+
import type { SupportAction, SupportActionTicket } from "@webority/markdown-core/chat";
|
|
2
|
+
import { type ChatLabels } from "@webority/markdown-core/chat";
|
|
3
3
|
import type React from "react";
|
|
4
4
|
export interface ActionCardProps {
|
|
5
5
|
action: SupportAction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChatEditing, type ChatLabels, type ComposerAttachment } from "@webority/
|
|
1
|
+
import { type ChatEditing, type ChatLabels, type ComposerAttachment } from "@webority/markdown-core/chat";
|
|
2
2
|
import type React from "react";
|
|
3
3
|
export interface ChatComposerProps {
|
|
4
4
|
/** Called with the trimmed question; the box clears once it is handed over. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ConversationSummary } from "@webority/
|
|
2
|
-
import { type ChatClient, type ChatLabels } from "@webority/
|
|
1
|
+
import type { ConversationSummary } from "@webority/markdown-core/chat";
|
|
2
|
+
import { type ChatClient, type ChatLabels } from "@webority/markdown-core/chat";
|
|
3
3
|
import type React from "react";
|
|
4
4
|
import { type StyleProp, type ViewStyle } from "react-native";
|
|
5
5
|
export interface ChatConversationListProps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ChatAttachment, ChatRating, SupportActionTicket } from "@webority/
|
|
2
|
-
import { type ChatLabels } from "@webority/
|
|
1
|
+
import type { ChatAttachment, ChatRating, SupportActionTicket } from "@webority/markdown-core/chat";
|
|
2
|
+
import { type ChatLabels } from "@webority/markdown-core/chat";
|
|
3
3
|
import type React from "react";
|
|
4
4
|
import type { ChatTurn } from "../useChat";
|
|
5
5
|
/** The props a thread passes to each of its turns. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChatAttachment, type ChatUploadFile } from "@webority/
|
|
1
|
+
import { type ChatAttachment, type ChatUploadFile } from "@webority/markdown-core/chat";
|
|
2
2
|
import type React from "react";
|
|
3
3
|
import type { UseChatResult } from "../useChat";
|
|
4
4
|
import type { ChatReplyProps } from "./ChatMessage";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChatAttachment } from "@webority/
|
|
1
|
+
import { type ChatAttachment } from "@webority/markdown-core/chat";
|
|
2
2
|
import type React from "react";
|
|
3
3
|
import { type StyleProp, type ViewStyle } from "react-native";
|
|
4
4
|
import type { ChatTurn } from "../useChat";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChatLabels, type ComposerAttachment } from "@webority/
|
|
1
|
+
import { type ChatLabels, type ComposerAttachment } from "@webority/markdown-core/chat";
|
|
2
2
|
import type React from "react";
|
|
3
3
|
export interface ComposerAttachmentsProps {
|
|
4
4
|
attachments: ComposerAttachment[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ChatRating } from "@webority/
|
|
2
|
-
import { type ChatLabels } from "@webority/
|
|
1
|
+
import type { ChatRating } from "@webority/markdown-core/chat";
|
|
2
|
+
import { type ChatLabels } from "@webority/markdown-core/chat";
|
|
3
3
|
import type React from "react";
|
|
4
4
|
export interface ReplyRatingProps {
|
|
5
5
|
/** The rating already saved. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { ChatAbortSignal, ChatAttachment, ChatAttachmentLimits, ChatBlob, ChatClient, ChatEditing, ChatHttpClient, ChatHttpRequestConfig, ChatLabels, ChatRating, ChatRatingInput, ChatSession, ChatSessionOptions, ChatSessionState, ChatSettings, ChatStreamEventName, ChatStreamOptions, ChatTurnInput, ChatTurnResult, ChatUploadFile, ComposerAttachment, ComposerAttachmentStatus, Conversation, ConversationList, ConversationListOptions, ConversationListState, ConversationMessage, ConversationSummary, FrameScheduler, PagedDataObject, SseEvent, SseParser, SupportAction, SupportActionTicket, } from "@webority/
|
|
2
|
-
export { ChatApiError, createChatClient, createChatSession, createConversationList, createSseParser, DEFAULT_CHAT_LABELS, } from "@webority/
|
|
1
|
+
export type { ChatAbortSignal, ChatAttachment, ChatAttachmentLimits, ChatBlob, ChatClient, ChatEditing, ChatHttpClient, ChatHttpRequestConfig, ChatLabels, ChatRating, ChatRatingInput, ChatSession, ChatSessionOptions, ChatSessionState, ChatSettings, ChatStreamEventName, ChatStreamOptions, ChatTurnInput, ChatTurnResult, ChatUploadFile, ComposerAttachment, ComposerAttachmentStatus, Conversation, ConversationList, ConversationListOptions, ConversationListState, ConversationMessage, ConversationSummary, FrameScheduler, PagedDataObject, SseEvent, SseParser, SupportAction, SupportActionTicket, } from "@webority/markdown-core/chat";
|
|
2
|
+
export { ChatApiError, createChatClient, createChatSession, createConversationList, createSseParser, DEFAULT_CHAT_LABELS, } from "@webority/markdown-core/chat";
|
|
3
3
|
export type { ActionCardProps } from "./components/ActionCard";
|
|
4
4
|
export { ActionCard } from "./components/ActionCard";
|
|
5
5
|
export type { ChatComposerProps } from "./components/ChatComposer";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ChatClient, ChatSession, ChatSessionState } from "@webority/
|
|
2
|
-
export type { ChatTurn, ChatTurnError } from "@webority/
|
|
1
|
+
import type { ChatClient, ChatSession, ChatSessionState } from "@webority/markdown-core/chat";
|
|
2
|
+
export type { ChatTurn, ChatTurnError } from "@webority/markdown-core/chat";
|
|
3
3
|
export interface UseChatOptions {
|
|
4
4
|
/** From `createChatClient`. */
|
|
5
5
|
client: ChatClient;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SupportAction, SupportActionTicket } from "@webority/
|
|
2
|
-
import { type ChatLabels } from "@webority/
|
|
1
|
+
import type { SupportAction, SupportActionTicket } from "@webority/markdown-core/chat";
|
|
2
|
+
import { type ChatLabels } from "@webority/markdown-core/chat";
|
|
3
3
|
import type React from "react";
|
|
4
4
|
export interface ActionCardProps {
|
|
5
5
|
action: SupportAction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChatEditing, type ChatLabels, type ComposerAttachment } from "@webority/
|
|
1
|
+
import { type ChatEditing, type ChatLabels, type ComposerAttachment } from "@webority/markdown-core/chat";
|
|
2
2
|
import type React from "react";
|
|
3
3
|
export interface ChatComposerProps {
|
|
4
4
|
/** Called with the trimmed question; the box clears once it is handed over. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ConversationSummary } from "@webority/
|
|
2
|
-
import { type ChatClient, type ChatLabels } from "@webority/
|
|
1
|
+
import type { ConversationSummary } from "@webority/markdown-core/chat";
|
|
2
|
+
import { type ChatClient, type ChatLabels } from "@webority/markdown-core/chat";
|
|
3
3
|
import type React from "react";
|
|
4
4
|
import { type StyleProp, type ViewStyle } from "react-native";
|
|
5
5
|
export interface ChatConversationListProps {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ChatAttachment, ChatRating, SupportActionTicket } from "@webority/
|
|
2
|
-
import { type ChatLabels } from "@webority/
|
|
1
|
+
import type { ChatAttachment, ChatRating, SupportActionTicket } from "@webority/markdown-core/chat";
|
|
2
|
+
import { type ChatLabels } from "@webority/markdown-core/chat";
|
|
3
3
|
import type React from "react";
|
|
4
4
|
import type { ChatTurn } from "../useChat.js";
|
|
5
5
|
/** The props a thread passes to each of its turns. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChatAttachment, type ChatUploadFile } from "@webority/
|
|
1
|
+
import { type ChatAttachment, type ChatUploadFile } from "@webority/markdown-core/chat";
|
|
2
2
|
import type React from "react";
|
|
3
3
|
import type { UseChatResult } from "../useChat.js";
|
|
4
4
|
import type { ChatReplyProps } from "./ChatMessage.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChatAttachment } from "@webority/
|
|
1
|
+
import { type ChatAttachment } from "@webority/markdown-core/chat";
|
|
2
2
|
import type React from "react";
|
|
3
3
|
import { type StyleProp, type ViewStyle } from "react-native";
|
|
4
4
|
import type { ChatTurn } from "../useChat.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChatLabels, type ComposerAttachment } from "@webority/
|
|
1
|
+
import { type ChatLabels, type ComposerAttachment } from "@webority/markdown-core/chat";
|
|
2
2
|
import type React from "react";
|
|
3
3
|
export interface ComposerAttachmentsProps {
|
|
4
4
|
attachments: ComposerAttachment[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ChatRating } from "@webority/
|
|
2
|
-
import { type ChatLabels } from "@webority/
|
|
1
|
+
import type { ChatRating } from "@webority/markdown-core/chat";
|
|
2
|
+
import { type ChatLabels } from "@webority/markdown-core/chat";
|
|
3
3
|
import type React from "react";
|
|
4
4
|
export interface ReplyRatingProps {
|
|
5
5
|
/** The rating already saved. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { ChatAbortSignal, ChatAttachment, ChatAttachmentLimits, ChatBlob, ChatClient, ChatEditing, ChatHttpClient, ChatHttpRequestConfig, ChatLabels, ChatRating, ChatRatingInput, ChatSession, ChatSessionOptions, ChatSessionState, ChatSettings, ChatStreamEventName, ChatStreamOptions, ChatTurnInput, ChatTurnResult, ChatUploadFile, ComposerAttachment, ComposerAttachmentStatus, Conversation, ConversationList, ConversationListOptions, ConversationListState, ConversationMessage, ConversationSummary, FrameScheduler, PagedDataObject, SseEvent, SseParser, SupportAction, SupportActionTicket, } from "@webority/
|
|
2
|
-
export { ChatApiError, createChatClient, createChatSession, createConversationList, createSseParser, DEFAULT_CHAT_LABELS, } from "@webority/
|
|
1
|
+
export type { ChatAbortSignal, ChatAttachment, ChatAttachmentLimits, ChatBlob, ChatClient, ChatEditing, ChatHttpClient, ChatHttpRequestConfig, ChatLabels, ChatRating, ChatRatingInput, ChatSession, ChatSessionOptions, ChatSessionState, ChatSettings, ChatStreamEventName, ChatStreamOptions, ChatTurnInput, ChatTurnResult, ChatUploadFile, ComposerAttachment, ComposerAttachmentStatus, Conversation, ConversationList, ConversationListOptions, ConversationListState, ConversationMessage, ConversationSummary, FrameScheduler, PagedDataObject, SseEvent, SseParser, SupportAction, SupportActionTicket, } from "@webority/markdown-core/chat";
|
|
2
|
+
export { ChatApiError, createChatClient, createChatSession, createConversationList, createSseParser, DEFAULT_CHAT_LABELS, } from "@webority/markdown-core/chat";
|
|
3
3
|
export type { ActionCardProps } from "./components/ActionCard.js";
|
|
4
4
|
export { ActionCard } from "./components/ActionCard.js";
|
|
5
5
|
export type { ChatComposerProps } from "./components/ChatComposer.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ChatClient, ChatSession, ChatSessionState } from "@webority/
|
|
2
|
-
export type { ChatTurn, ChatTurnError } from "@webority/
|
|
1
|
+
import type { ChatClient, ChatSession, ChatSessionState } from "@webority/markdown-core/chat";
|
|
2
|
+
export type { ChatTurn, ChatTurnError } from "@webority/markdown-core/chat";
|
|
3
3
|
export interface UseChatOptions {
|
|
4
4
|
/** From `createChatClient`. */
|
|
5
5
|
client: ChatClient;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/mobile-chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.125.0",
|
|
4
4
|
"description": "AI assistant chat for Webority React Native apps: a streaming chat client, a store-agnostic chat hook, and the chat screen, thread, composer, past chats, reply rating and support action cards, built on @webority/mobile-ui.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -42,12 +42,11 @@
|
|
|
42
42
|
"!**/*.map"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@webority/
|
|
46
|
-
"@webority/markdown-core": "0.124.0"
|
|
45
|
+
"@webority/markdown-core": "0.125.0"
|
|
47
46
|
},
|
|
48
47
|
"peerDependencies": {
|
|
49
|
-
"@webority/mobile-core": "0.
|
|
50
|
-
"@webority/mobile-ui": "0.
|
|
48
|
+
"@webority/mobile-core": "0.125.0",
|
|
49
|
+
"@webority/mobile-ui": "0.125.0",
|
|
51
50
|
"expo-clipboard": ">=57.0.0",
|
|
52
51
|
"react": "^19.1.0",
|
|
53
52
|
"react-native": ">=0.81.0",
|
|
@@ -89,9 +88,9 @@
|
|
|
89
88
|
"@react-native/metro-config": "0.86.3",
|
|
90
89
|
"@testing-library/react-native": "12.9.0",
|
|
91
90
|
"@types/react": "19.2.18",
|
|
92
|
-
"@webority/mobile-core": "0.
|
|
91
|
+
"@webority/mobile-core": "0.125.0",
|
|
93
92
|
"@webority/mobile-dev": "0.0.0",
|
|
94
|
-
"@webority/mobile-ui": "0.
|
|
93
|
+
"@webority/mobile-ui": "0.125.0",
|
|
95
94
|
"jest": "29.7.0",
|
|
96
95
|
"react": "19.2.8",
|
|
97
96
|
"react-native": "0.86.3",
|