@webority/mobile-chat 0.141.0 → 0.142.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/AgentByline.js +1 -1
- package/lib/commonjs/ChatComposer.js +1 -1
- package/lib/commonjs/ChatConversationActions.js +1 -1
- package/lib/commonjs/ChatLauncher.js +1 -1
- package/lib/commonjs/ChatMessageActions.js +1 -1
- package/lib/commonjs/ChatOpenTickets.js +1 -1
- package/lib/commonjs/ChatPastChats.js +1 -1
- package/lib/commonjs/ChatSheet.js +1 -1
- package/lib/commonjs/ChatStarters.js +1 -1
- package/lib/commonjs/ChatThread.js +1 -1
- package/lib/commonjs/chatShared.js +1 -1
- package/lib/commonjs/expoModules.js +1 -0
- package/lib/commonjs/iconName.js +1 -0
- package/lib/commonjs/loaders/ChatLoader.js +1 -1
- package/lib/commonjs/renderers/ActionPart.js +1 -1
- package/lib/commonjs/renderers/ChartPart.js +1 -1
- package/lib/commonjs/renderers/FigureText.js +1 -1
- package/lib/commonjs/renderers/FilePart.js +1 -1
- package/lib/commonjs/renderers/HandoffPart.js +1 -1
- package/lib/commonjs/renderers/InputRequestPart.js +1 -1
- package/lib/commonjs/renderers/NoticePart.js +1 -1
- package/lib/commonjs/renderers/QuickRepliesPart.js +1 -1
- package/lib/commonjs/renderers/SourcesPart.js +1 -1
- package/lib/commonjs/renderers/TextPart.js +1 -1
- package/lib/commonjs/renderers/VoiceClipPart.js +1 -1
- package/lib/commonjs/speech/azureSpeech.js +1 -1
- package/lib/commonjs/speech/expoAudio.js +1 -1
- package/lib/commonjs/speech/phoneSpeech.js +1 -1
- package/lib/commonjs/useChat.js +1 -1
- package/lib/commonjs/useChatSound.js +1 -1
- package/lib/commonjs/useTranscriptActions.js +1 -1
- package/lib/module/AgentByline.js +1 -1
- package/lib/module/ChatComposer.js +1 -1
- package/lib/module/ChatConversationActions.js +1 -1
- package/lib/module/ChatLauncher.js +1 -1
- package/lib/module/ChatMessageActions.js +1 -1
- package/lib/module/ChatOpenTickets.js +1 -1
- package/lib/module/ChatPastChats.js +1 -1
- package/lib/module/ChatSheet.js +1 -1
- package/lib/module/ChatStarters.js +1 -1
- package/lib/module/ChatThread.js +1 -1
- package/lib/module/chatShared.js +1 -1
- package/lib/module/expoModules.js +1 -0
- package/lib/module/iconName.js +1 -0
- package/lib/module/loaders/ChatLoader.js +1 -1
- package/lib/module/renderers/ActionPart.js +1 -1
- package/lib/module/renderers/ChartPart.js +1 -1
- package/lib/module/renderers/FigureText.js +1 -1
- package/lib/module/renderers/FilePart.js +1 -1
- package/lib/module/renderers/HandoffPart.js +1 -1
- package/lib/module/renderers/InputRequestPart.js +1 -1
- package/lib/module/renderers/NoticePart.js +1 -1
- package/lib/module/renderers/QuickRepliesPart.js +1 -1
- package/lib/module/renderers/SourcesPart.js +1 -1
- package/lib/module/renderers/TextPart.js +1 -1
- package/lib/module/renderers/VoiceClipPart.js +1 -1
- package/lib/module/speech/azureSpeech.js +1 -1
- package/lib/module/speech/expoAudio.js +1 -1
- package/lib/module/speech/phoneSpeech.js +1 -1
- package/lib/module/useChat.js +1 -1
- package/lib/module/useChatSound.js +1 -1
- package/lib/module/useTranscriptActions.js +1 -1
- package/lib/typescript/commonjs/ChatAppearanceScope.d.ts +1 -1
- package/lib/typescript/commonjs/ChatComposer.d.ts +6 -6
- package/lib/typescript/commonjs/ChatFrame.d.ts +17 -17
- package/lib/typescript/commonjs/ChatOpenTickets.d.ts +1 -1
- package/lib/typescript/commonjs/ChatSheet.d.ts +3 -3
- package/lib/typescript/commonjs/ChatStarters.d.ts +1 -1
- package/lib/typescript/commonjs/ChatThread.d.ts +13 -13
- package/lib/typescript/commonjs/chatShared.d.ts +2 -1
- package/lib/typescript/commonjs/expoModules.d.ts +58 -0
- package/lib/typescript/commonjs/iconName.d.ts +3 -0
- package/lib/typescript/commonjs/renderers/ActionPart.d.ts +6 -1
- package/lib/typescript/commonjs/renderers/FilePart.d.ts +4 -1
- package/lib/typescript/commonjs/renderers/InputRequestPart.d.ts +6 -1
- package/lib/typescript/commonjs/renderers/NoticePart.d.ts +1 -1
- package/lib/typescript/commonjs/renderers/index.d.ts +40 -2
- package/lib/typescript/commonjs/types.d.ts +1 -1
- package/lib/typescript/commonjs/useChat.d.ts +2 -2
- package/lib/typescript/commonjs/useChatSound.d.ts +1 -1
- package/lib/typescript/module/ChatAppearanceScope.d.ts +1 -1
- package/lib/typescript/module/ChatComposer.d.ts +6 -6
- package/lib/typescript/module/ChatFrame.d.ts +17 -17
- package/lib/typescript/module/ChatOpenTickets.d.ts +1 -1
- package/lib/typescript/module/ChatSheet.d.ts +3 -3
- package/lib/typescript/module/ChatStarters.d.ts +1 -1
- package/lib/typescript/module/ChatThread.d.ts +13 -13
- package/lib/typescript/module/chatShared.d.ts +2 -1
- package/lib/typescript/module/expoModules.d.ts +58 -0
- package/lib/typescript/module/iconName.d.ts +3 -0
- package/lib/typescript/module/renderers/ActionPart.d.ts +6 -1
- package/lib/typescript/module/renderers/FilePart.d.ts +4 -1
- package/lib/typescript/module/renderers/InputRequestPart.d.ts +6 -1
- package/lib/typescript/module/renderers/NoticePart.d.ts +1 -1
- package/lib/typescript/module/renderers/index.d.ts +40 -2
- package/lib/typescript/module/types.d.ts +1 -1
- package/lib/typescript/module/useChat.d.ts +2 -2
- package/lib/typescript/module/useChatSound.d.ts +1 -1
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{ChatSpeechError,createSpeechTokenSource}from"@webority/chat-core";import{Logger}from"@webority/mobile-core";import{Permissions}from"@webority/mobile-core/permissions";import{synthesizeSpeech,transcribeClip}from"./azureSpeech.js";import{playFile,startRecording}from"./expoAudio.js";import{clampSpeakText,DEFAULT_SPEECH_LANGUAGE,DEFAULT_SPEECH_VOICE,MAX_DICTATION_MS,MIN_DICTATION_MS}from"./speechText.js";export class PhoneSpeechError extends ChatSpeechError{constructor(e,r,t){super(e,t),this.name="PhoneSpeechError",this.phoneCode=r}}const expoFileSystem=()=>{try{return
|
|
1
|
+
"use strict";import{ChatSpeechError,createSpeechTokenSource}from"@webority/chat-core";import{Logger}from"@webority/mobile-core";import{Permissions}from"@webority/mobile-core/permissions";import{loadExpoFileSystem}from"../expoModules.js";import{synthesizeSpeech,transcribeClip}from"./azureSpeech.js";import{playFile,startRecording}from"./expoAudio.js";import{clampSpeakText,DEFAULT_SPEECH_LANGUAGE,DEFAULT_SPEECH_VOICE,MAX_DICTATION_MS,MIN_DICTATION_MS}from"./speechText.js";export class PhoneSpeechError extends ChatSpeechError{constructor(e,r,t){super(e,t),this.name="PhoneSpeechError",this.phoneCode=r}}const expoFileSystem=()=>{try{return loadExpoFileSystem()}catch{throw new PhoneSpeechError("Unavailable","Unavailable","Voice files are not available in this app.")}};export function discardFile(e){try{const{File:r}=expoFileSystem();new r(e).delete()}catch(e){Logger.warn("Removing a temporary audio file failed:",e)}}const failed=e=>e instanceof ChatSpeechError?e:(Logger.error("[chat] speech failed",e),new PhoneSpeechError("Failed","Failed")),waitForDictation=e=>new Promise(r=>{if(e?.aborted)return void r();const done=()=>{clearTimeout(t),e?.removeEventListener("abort",done),r()},t=setTimeout(done,MAX_DICTATION_MS);e?.addEventListener("abort",done)});export function createPhoneSpeech(e){const r=e.language??DEFAULT_SPEECH_LANGUAGE,t=e.voice??DEFAULT_SPEECH_VOICE,o=createSpeechTokenSource(e.getToken);let a=null,i=null,n=Promise.resolve();const token=async()=>{try{return await o.get()}catch(e){throw failed(e)}},dictate=async e=>{a?.abort(),i?.abort();const t=n,o=new AbortController,forward=()=>o.abort();e.signal?.aborted&&o.abort(),e.signal?.addEventListener("abort",forward),i=o;const c=t.then(()=>(async(e,t)=>{const o=await Permissions.ensure("microphone").catch(()=>{throw new PhoneSpeechError("Blocked","MicDenied","The microphone permission could not be checked.")});if("blocked"===o)throw new PhoneSpeechError("Blocked","MicBlocked");if("unavailable"===o)throw new PhoneSpeechError("NoMicrophone","MicUnavailable");if("granted"!==o)throw new PhoneSpeechError("Blocked","MicDenied");let a,i;try{a=await startRecording()}catch(e){throw failed(e)}e.onStarted?.(),await waitForDictation(t);try{i=await a.stop()}catch(r){throw e.onEnd?.(),failed(r)}if(e.shouldDiscard?.())return discardFile(i.uri),void e.onEnd?.();if(i.durationMs<MIN_DICTATION_MS)return discardFile(i.uri),void e.onEnd?.();try{const t=await transcribeClip({token:await token(),uri:i.uri,language:e.language??r});""!==t&&e.onText?.(t,!0),e.onEnd?.()}catch(r){throw e.onEnd?.(),failed(r)}finally{discardFile(i.uri)}})(e,o.signal));n=c.then(()=>{},()=>{});try{await c}finally{e.signal?.removeEventListener("abort",forward),i===o&&(i=null)}};return{dictation:!0,readAloud:!0,streamsText:!1,startDictation:e=>dictate(e),speak:(e,o)=>(async(e,o)=>{a?.abort();const i=new AbortController;a=i;const forward=()=>i.abort();o.signal?.aborted&&i.abort(),o.signal?.addEventListener("abort",forward);const n=i.signal;let c=null,s=null;const onAbort=()=>{s?.stop()};try{const a=clampSpeakText(e);if(""===a)return;const i=await synthesizeSpeech({token:await token(),text:a,language:o.language??r,voice:t,signal:n});if(n.aborted)return;const{File:l,Paths:d}=expoFileSystem();if(c=new l(d.cache,`wchat-read-${Date.now()}.mp3`),c.create({overwrite:!0}),c.write(i),n.aborted)return;s=playFile(c.uri),n.addEventListener("abort",onAbort),n.aborted&&s.stop(),await s.finished}catch(e){if(n.aborted)return;throw failed(e)}finally{n.removeEventListener("abort",onAbort),o.signal?.removeEventListener("abort",forward),a===i&&(a=null),null!==c&&discardFile(c.uri)}})(e,o)}}
|
package/lib/module/useChat.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{createChatSession,DEFAULT_CHAT_LABELS,
|
|
1
|
+
"use strict";import{CHAT_FEATURES,createChatSession,DEFAULT_CHAT_LABELS,IDLE_CHAT_SESSION}from"@webority/chat-core";import{useReducedMotion}from"@webority/mobile-ui";import{useCallback,useEffect,useMemo,useRef,useState,useSyncExternalStore}from"react";import{AppState}from"react-native";const requestFrame=e=>{const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)};function parseNarrow(e){const t=JSON.parse(e);if("object"!=typeof t||null===t||Array.isArray(t))throw new TypeError("The chat narrowing must be an object of feature switches.");const r={};for(const e of CHAT_FEATURES){const n=Reflect.get(t,e);if(void 0!==n){if("boolean"!=typeof n)throw new TypeError(`The chat narrowing for "${e}" must be true or false.`);r[e]=n}}const n=new Set(CHAT_FEATURES);for(const e of Object.keys(t))if(!n.has(e))throw new TypeError(`"${e}" is not a chat feature.`);return r}export function useChat(e){const{client:t,screen:r,layout:n,narrow:o,conversationId:s,pageContext:c,behaviour:a,attribution:u,prefs:i,getCaptchaToken:f,onEvent:l,onError:p,onNavigate:m}=e,E=JSON.stringify(o??{}),h=useRef(m);h.current=m;const S=useCallback(e=>h.current?.(e),[]),d=useRef(s);d.current=s;const v=useRef(c);v.current=c;const y=useRef(a);y.current=a;const A=useRef(u);A.current=u;const C=useRef(f);C.current=f;const w=useRef(l);w.current=l;const b=useRef(p);b.current=p;const R=useRef(i);R.current=i;const T=useReducedMotion(),g=useRef(T);g.current=T;const[L,_]=useState(null),[H,k]=useState(null);useEffect(()=>{const e=d.current??void 0,o=createChatSession(t,{...void 0===r?{}:{screen:r},...void 0===n?{}:{layout:n},pathname:()=>r||"/",narrow:parseNarrow(E),...void 0===e?{}:{conversationId:e},pageContext:()=>v.current,behaviour:()=>y.current?.()??null,attribution:()=>A.current?.()??null,prefs:R.current,getCaptchaToken:e=>C.current?.(e)??Promise.reject(new Error("No captcha handler.")),onEvent:(e,t)=>w.current?.(e,t),onError:e=>b.current?.(e),schedule:requestFrame,reducedMotion:()=>g.current});return _({client:t,screen:r,layout:n,narrowKey:E,session:o}),()=>o.dispose()},[t,r,n,E]);const I=null!==L&&L.client===t&&L.screen===r&&L.layout===n&&L.narrowKey===E?L.session:IDLE_CHAT_SESSION,N=useSyncExternalStore(I.subscribe,I.getState),F=useMemo(()=>({load:()=>I.load(),submit:e=>I.submit(e),chooseQuickReply:e=>I.chooseQuickReply(e),answerInput:(e,t)=>I.answerInput(e,t),confirmAction:e=>I.confirmAction(e),rejectAction:(e,t)=>I.rejectAction(e,t),stop:()=>I.stop(),retry:()=>I.retry(),regenerate:()=>I.regenerate(),startEdit:e=>I.startEdit(e),cancelEdit:()=>I.cancelEdit(),attach:e=>I.attach(e),removeAttachment:e=>I.removeAttachment(e),openConversation:e=>I.openConversation(e),resumeLast:()=>I.resumeLast(),newConversation:()=>I.newConversation(),rate:(e,t,r)=>I.rate(e,t,r),reset:()=>I.reset(),requestHandoff:async e=>{k(null);try{await I.requestHandoff(e)}catch(e){const t=e instanceof Error&&""!==e.message?e.message:DEFAULT_CHAT_LABELS.errorGeneric;throw k(t),e}},notifyTyping:()=>I.notifyTyping(),resumeLive:()=>I.resumeLive()}),[I]),j=useRef(s);useEffect(()=>{I!==IDLE_CHAT_SESSION&&s&&s!==j.current&&(j.current=s,I.openConversation(s))},[s,I]);const O=useRef("active"===AppState.currentState),q=useRef(!0),x=useCallback(()=>I.setLiveActive(O.current&&q.current),[I]),D=useCallback(e=>{q.current=e,x()},[x]);useEffect(()=>{x();const e=AppState.addEventListener("change",e=>{"active"===e?(O.current=!0,I.endHandoffPause()):O.current=!1,x()});return()=>e.remove()},[x,I]);const M=useCallback((e,t)=>{w.current?.(e,t)},[]);return{...N,...F,session:I,client:t,emit:M,setChatVisible:D,handoffError:H,onNavigate:m?S:void 0}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Logger}from"@webority/mobile-core";import{useEffect,useRef}from"react";export const CUES={open:{from:420,to:920,seconds:.16,peak:.16},reply:{from:680,to:540,seconds:.11,peak:.06},sent:{from:540,to:760,seconds:.09,peak:.05}};const SAMPLE_RATE=22050,ATTACK_SECONDS=.01,written=new Map;function cueBytes(e){const t=Math.round(22050*e.seconds),
|
|
1
|
+
"use strict";import{Logger}from"@webority/mobile-core";import{useEffect,useRef}from"react";import{loadExpoAudio,loadExpoFileSystem}from"./expoModules.js";export const CUES={open:{from:420,to:920,seconds:.16,peak:.16},reply:{from:680,to:540,seconds:.11,peak:.06},sent:{from:540,to:760,seconds:.09,peak:.05}};const SAMPLE_RATE=22050,ATTACK_SECONDS=.01,written=new Map;function cueBytes(e){const t=Math.round(22050*e.seconds),o=2*t,n=new Uint8Array(44+o),s=new DataView(n.buffer),text=(e,t)=>{for(let o=0;o<t.length;o+=1)s.setUint8(e+o,t.charCodeAt(o))};text(0,"RIFF"),s.setUint32(4,36+o,!0),text(8,"WAVE"),text(12,"fmt "),s.setUint32(16,16,!0),s.setUint16(20,1,!0),s.setUint16(22,1,!0),s.setUint32(24,22050,!0),s.setUint32(28,44100,!0),s.setUint16(32,2,!0),s.setUint16(34,16,!0),text(36,"data"),s.setUint32(40,o,!0);const r=Math.min(.01,e.seconds/2);let i=0;for(let o=0;o<t;o+=1){const t=o/22050,n=e.from+(e.to-e.from)*t/e.seconds;i+=2*Math.PI*n/22050;const a=t<r?t/r:(e.seconds-t)/(e.seconds-r);s.setInt16(44+2*o,Math.round(32767*e.peak*a*Math.sin(i)),!0)}return n}export function playCue(e,t=1){(async()=>{let o=written.get(e);if(void 0===o){const{File:t,Paths:n}=loadExpoFileSystem(),s=new t(n.cache,`wchat-cue-${e}.wav`);s.create({overwrite:!0}),s.write(cueBytes(CUES[e])),o=s.uri,written.set(e,o)}const{createAudioPlayer:n}=loadExpoAudio(),s=n({uri:o});s.volume=t,s.addListener("playbackStatusUpdate",e=>{e.didJustFinish&&s.remove()}),s.play()})().catch(e=>{Logger.warn("[chat] sound cue failed",e)})}function takeUnseen(e,t,o){if(t){e.wasLoading=!0;for(const t of o)e.seen.add(t.id);return[]}if(e.wasLoading||!e.seeded){e.wasLoading=!1,e.seeded=!0;for(const t of o)e.seen.add(t.id);return[]}const n=[];for(const t of o)e.seen.has(t.id)||(e.seen.add(t.id),n.push(t));return n}export function useChatSound(e){const t=e.features.Sounds?e.profile?.experience.sound??null:null,o=useRef(e);o.current=e;const n=useRef(e.open),s=useRef({seen:new Set,seeded:!1,wasLoading:!1}),{open:r,loading:i,messages:a}=e;useEffect(()=>{const e=n.current;n.current=r;const c=takeUnseen(s.current,i,a);if(null!==t&&!o.current.muted&&t.volume>0){r&&!e&&t.open&&playCue("open",t.volume);for(const e of c){if(e.restored||e.parts.some(e=>"Notice"===e.kind))continue;const o=e.author.kind;"Visitor"===o?!e.stored&&t.sent&&playCue("sent",t.volume):"Assistant"!==o&&"Script"!==o&&"Agent"!==o||!t.reply||playCue("reply",t.volume)}}},[r,i,a,t])}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{buildTranscript,transcriptToText}from"@webority/chat-core";import{Logger}from"@webority/mobile-core";import{useCallback,useEffect,useRef,useState}from"react";import{Share}from"react-native";const NOTICE_MS=3e3;async function shareMessages(e,t,r,s){const a=buildTranscript(e,t);if(0===a.entries.length)return;const i=transcriptToText(a,{heading:r,speakers:r});try{await Share.share({message:i,title:a.title})}catch(e){Logger.error("[chat] share failed",e),s()}}export default function useTranscriptActions(e,t){const[r,s]=useState(null),a=useRef(null),i=useRef(!1);useEffect(()=>(i.current=!0,()=>{i.current=!1,null!==a.current&&clearTimeout(a.current)}),[]);const n=useCallback(e=>{i.current&&(null!==a.current&&clearTimeout(a.current),s(e),a.current=setTimeout(()=>s(null),3e3))},[]),{messages:c,title:u}=e,l=e.features.FigureText,o=e.profile?.assistant.name,f=useCallback(e=>shareMessages([e],{labels:t,title:u,figureText:l
|
|
1
|
+
"use strict";import{buildTranscript,transcriptToText}from"@webority/chat-core";import{Logger}from"@webority/mobile-core";import{useCallback,useEffect,useRef,useState}from"react";import{Share}from"react-native";const NOTICE_MS=3e3;async function shareMessages(e,t,r,s){const a=buildTranscript(e,t);if(0===a.entries.length)return;const i=transcriptToText(a,{heading:r,speakers:r});try{await Share.share({message:i,title:a.title})}catch(e){Logger.error("[chat] share failed",e),s()}}export default function useTranscriptActions(e,t){const[r,s]=useState(null),a=useRef(null),i=useRef(!1);useEffect(()=>(i.current=!0,()=>{i.current=!1,null!==a.current&&clearTimeout(a.current)}),[]);const n=useCallback(e=>{i.current&&(null!==a.current&&clearTimeout(a.current),s(e),a.current=setTimeout(()=>s(null),3e3))},[]),{messages:c,title:u}=e,l=e.features.FigureText,o=e.profile?.assistant.name,f=useCallback(e=>shareMessages([e],{labels:t,title:u,figureText:l,...void 0===o?{}:{assistantName:o}},!1,()=>n(t.shareFailed)),[t,u,l,o,n]),h=useCallback(()=>shareMessages(c,{labels:t,title:u,figureText:l,...void 0===o?{}:{assistantName:o}},!0,()=>n(t.shareFailed)),[c,t,u,l,o,n]);return{canShare:e.features.Share,notice:r,shareReply:f,shareConversation:h}}
|
|
@@ -5,7 +5,7 @@ import type { ChatAppearance } from "./types";
|
|
|
5
5
|
* nested theme. With no appearance key set it draws its children as they are.
|
|
6
6
|
*/
|
|
7
7
|
export declare function ChatAppearanceScope({ appearance, children, }: {
|
|
8
|
-
appearance?: ChatAppearance;
|
|
8
|
+
appearance?: ChatAppearance | undefined;
|
|
9
9
|
children: React.ReactNode;
|
|
10
10
|
}): React.ReactElement;
|
|
11
11
|
//# sourceMappingURL=ChatAppearanceScope.d.ts.map
|
|
@@ -5,16 +5,16 @@ import type { UseChatResult } from "./useChat";
|
|
|
5
5
|
export interface ChatComposerProps {
|
|
6
6
|
chat: UseChatResult;
|
|
7
7
|
labels: ChatLabels;
|
|
8
|
-
pickAttachments?: PickAttachments;
|
|
9
|
-
keyboardOffset?: number;
|
|
10
|
-
keyboardAware?: boolean;
|
|
11
|
-
safeArea?: boolean;
|
|
8
|
+
pickAttachments?: PickAttachments | undefined;
|
|
9
|
+
keyboardOffset?: number | undefined;
|
|
10
|
+
keyboardAware?: boolean | undefined;
|
|
11
|
+
safeArea?: boolean | undefined;
|
|
12
12
|
testID?: string;
|
|
13
|
-
focusRef?: React.MutableRefObject<(() => void) | null
|
|
13
|
+
focusRef?: React.MutableRefObject<(() => void) | null> | undefined;
|
|
14
14
|
/** The resolved look: its input ring and send reveal draw the box and the send button. */
|
|
15
15
|
look?: ChatLook;
|
|
16
16
|
/** Icon name for the send button; the look's input.sendIcon. */
|
|
17
|
-
sendIcon?: string;
|
|
17
|
+
sendIcon?: string | undefined;
|
|
18
18
|
}
|
|
19
19
|
export declare function ChatComposer({ chat, labels, pickAttachments, keyboardOffset, keyboardAware, safeArea, testID, focusRef, look, sendIcon, }: ChatComposerProps): React.ReactElement;
|
|
20
20
|
//# sourceMappingURL=ChatComposer.d.ts.map
|
|
@@ -7,44 +7,44 @@ export type ChatLayout = "screen" | "sheet" | "embedded";
|
|
|
7
7
|
export interface ChatCommonProps {
|
|
8
8
|
chat: UseChatResult;
|
|
9
9
|
labels: ChatLabels;
|
|
10
|
-
renderers?: ChatRenderers;
|
|
11
|
-
layoutParts?: ChatLayoutParts;
|
|
10
|
+
renderers?: ChatRenderers | undefined;
|
|
11
|
+
layoutParts?: ChatLayoutParts | undefined;
|
|
12
12
|
loader?: ChatLoaderStyle;
|
|
13
13
|
/** The look: its input ring and send reveal, its panel motion and its motion switch. Unset values take the defaults. */
|
|
14
|
-
look?: ChatLookInput;
|
|
15
|
-
pickAttachments?: PickAttachments;
|
|
16
|
-
onOpenAttachment?: (part: Extract<ChatPart, {
|
|
14
|
+
look?: ChatLookInput | undefined;
|
|
15
|
+
pickAttachments?: PickAttachments | undefined;
|
|
16
|
+
onOpenAttachment?: ((part: Extract<ChatPart, {
|
|
17
17
|
kind: "File";
|
|
18
|
-
}>) => void;
|
|
19
|
-
onOpenTarget?: (target: string) => void;
|
|
20
|
-
onNavigate?: (path: string) => void;
|
|
18
|
+
}>) => void) | undefined;
|
|
19
|
+
onOpenTarget?: ((target: string) => void) | undefined;
|
|
20
|
+
onNavigate?: ((path: string) => void) | undefined;
|
|
21
21
|
/** Opens a ticket from a Ticket part or the open tickets list; the host shows the ticket. */
|
|
22
|
-
openTicket?: ChatOpenTicketHandler;
|
|
22
|
+
openTicket?: ChatOpenTicketHandler | undefined;
|
|
23
23
|
/** Hosts an absolute https link or Navigate chip may open; any other absolute target is not linked. */
|
|
24
|
-
handoffHosts?: readonly string[];
|
|
24
|
+
handoffHosts?: readonly string[] | undefined;
|
|
25
25
|
/** Resolves a link in a reply to a host route or address; null leaves the link as text. */
|
|
26
|
-
resolveLink?: (href: string) => string | null;
|
|
27
|
-
keyboardOffset?: number;
|
|
26
|
+
resolveLink?: ((href: string) => string | null) | undefined;
|
|
27
|
+
keyboardOffset?: number | undefined;
|
|
28
28
|
testID?: string;
|
|
29
29
|
}
|
|
30
30
|
export interface ChatFrameProps extends ChatCommonProps {
|
|
31
31
|
layout: ChatLayout;
|
|
32
|
-
title?: string;
|
|
32
|
+
title?: string | undefined;
|
|
33
33
|
headerActions?: React.ReactNode;
|
|
34
34
|
/** The host sheet closes through this callback. */
|
|
35
|
-
onClose?: () => void;
|
|
35
|
+
onClose?: (() => void) | undefined;
|
|
36
36
|
/** Changes each time the panel opens, so the panel motion plays again. Default 0. */
|
|
37
37
|
enterKey?: number;
|
|
38
38
|
}
|
|
39
39
|
/** The props of the three shells: the frame's, with labels as a partial merged over the defaults. */
|
|
40
40
|
export interface ChatShellProps extends Omit<ChatCommonProps, "labels"> {
|
|
41
41
|
labels?: Partial<ChatLabels>;
|
|
42
|
-
title?: string;
|
|
42
|
+
title?: string | undefined;
|
|
43
43
|
headerActions?: React.ReactNode;
|
|
44
44
|
/** The host sheet closes through this callback. */
|
|
45
|
-
onClose?: () => void;
|
|
45
|
+
onClose?: (() => void) | undefined;
|
|
46
46
|
/** The web's appearance keys the phone reads: accent, corner radius and font, and the launcher side and offsets for a sheet. */
|
|
47
|
-
appearance?: ChatAppearance;
|
|
47
|
+
appearance?: ChatAppearance | undefined;
|
|
48
48
|
}
|
|
49
49
|
export declare function ChatFrame({ chat, labels, renderers, layoutParts, loader, look, pickAttachments, onOpenAttachment, onOpenTarget, onNavigate, openTicket, handoffHosts, resolveLink, keyboardOffset, layout, title, headerActions, onClose, enterKey, testID, }: ChatFrameProps): React.ReactElement | null;
|
|
50
50
|
//# sourceMappingURL=ChatFrame.d.ts.map
|
|
@@ -5,7 +5,7 @@ import type { UseChatResult } from "./useChat";
|
|
|
5
5
|
export interface ChatOpenTicketsProps {
|
|
6
6
|
chat: UseChatResult;
|
|
7
7
|
labels: ChatLabels;
|
|
8
|
-
onOpenTicket?: (ticket: ChatTicketRef) => void;
|
|
8
|
+
onOpenTicket?: ((ticket: ChatTicketRef) => void) | undefined;
|
|
9
9
|
testID?: string;
|
|
10
10
|
}
|
|
11
11
|
export declare function ChatOpenTickets({ chat, labels, onOpenTicket, testID, }: ChatOpenTicketsProps): React.ReactElement | null;
|
|
@@ -3,13 +3,13 @@ import type React from "react";
|
|
|
3
3
|
import { type ChatShellProps } from "./ChatFrame";
|
|
4
4
|
export interface ChatSheetProps extends ChatShellProps {
|
|
5
5
|
/** Controls the sheet. When given, the sheet follows it. */
|
|
6
|
-
open?: boolean;
|
|
6
|
+
open?: boolean | undefined;
|
|
7
7
|
/** The starting state when `open` is not given. Default false. */
|
|
8
8
|
defaultOpen?: boolean;
|
|
9
|
-
onOpenChange?: (open: boolean) => void;
|
|
9
|
+
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
10
10
|
snapPoints?: BottomSheetProps["snapPoints"];
|
|
11
11
|
/** Opens the sheet on this conversation when it changes to a new id (a push tap); uncontrolled sheets only. */
|
|
12
|
-
conversationId?: string | null;
|
|
12
|
+
conversationId?: string | null | undefined;
|
|
13
13
|
}
|
|
14
14
|
/** The chat in a bottom sheet over the screen, opened from a floating launcher. */
|
|
15
15
|
export declare function ChatSheet({ chat, labels, renderers, layoutParts, loader, look, appearance, pickAttachments, onOpenAttachment, onOpenTarget, onNavigate, keyboardOffset, open, defaultOpen, onOpenChange, snapPoints, openTicket, handoffHosts, resolveLink, conversationId, onClose, testID, }: ChatSheetProps): React.ReactElement | null;
|
|
@@ -5,7 +5,7 @@ import type { UseChatResult } from "./useChat";
|
|
|
5
5
|
export interface ChatStartersProps {
|
|
6
6
|
chat: UseChatResult;
|
|
7
7
|
labels: ChatLabels;
|
|
8
|
-
openTicket?: ChatOpenTicketHandler;
|
|
8
|
+
openTicket?: ChatOpenTicketHandler | undefined;
|
|
9
9
|
avatar?: string | null;
|
|
10
10
|
motion?: "On" | "Reduced";
|
|
11
11
|
greetingLoaderMs?: number;
|
|
@@ -6,8 +6,8 @@ import type { UseChatResult } from "./useChat";
|
|
|
6
6
|
export interface ChatThreadProps {
|
|
7
7
|
chat: UseChatResult;
|
|
8
8
|
labels: ChatLabels;
|
|
9
|
-
renderers?: ChatRenderers;
|
|
10
|
-
layoutParts?: ChatLayoutParts;
|
|
9
|
+
renderers?: ChatRenderers | undefined;
|
|
10
|
+
layoutParts?: ChatLayoutParts | undefined;
|
|
11
11
|
loader?: ChatLoaderStyle;
|
|
12
12
|
motion?: ChatMotion;
|
|
13
13
|
/** The assistant's picture, drawn beside its replies. */
|
|
@@ -16,18 +16,18 @@ export interface ChatThreadProps {
|
|
|
16
16
|
replyAvatars?: boolean;
|
|
17
17
|
/** A ring turns around the thinking mark and the streaming reply's picture. Off unless the look sets it. */
|
|
18
18
|
expressive?: boolean;
|
|
19
|
-
pickAttachments?: PickAttachments;
|
|
20
|
-
onOpenAttachment?: (part: Extract<ChatPart, {
|
|
19
|
+
pickAttachments?: PickAttachments | undefined;
|
|
20
|
+
onOpenAttachment?: ((part: Extract<ChatPart, {
|
|
21
21
|
kind: "File";
|
|
22
|
-
}>) => void;
|
|
23
|
-
onOpenTarget?: (target: string) => void;
|
|
24
|
-
onNavigate?: (path: string) => void;
|
|
25
|
-
openTicket?: ChatOpenTicketHandler;
|
|
26
|
-
handoffHosts?: readonly string[];
|
|
27
|
-
resolveLink?: (href: string) => string | null;
|
|
28
|
-
focusComposer?: () => void;
|
|
29
|
-
keyboardAware?: boolean;
|
|
30
|
-
keyboardOffset?: number;
|
|
22
|
+
}>) => void) | undefined;
|
|
23
|
+
onOpenTarget?: ((target: string) => void) | undefined;
|
|
24
|
+
onNavigate?: ((path: string) => void) | undefined;
|
|
25
|
+
openTicket?: ChatOpenTicketHandler | undefined;
|
|
26
|
+
handoffHosts?: readonly string[] | undefined;
|
|
27
|
+
resolveLink?: ((href: string) => string | null) | undefined;
|
|
28
|
+
focusComposer?: (() => void) | undefined;
|
|
29
|
+
keyboardAware?: boolean | undefined;
|
|
30
|
+
keyboardOffset?: number | undefined;
|
|
31
31
|
/** Drawn before the first message. */
|
|
32
32
|
empty?: React.ReactNode;
|
|
33
33
|
style?: StyleProp<ViewStyle>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ChatLiveMessage } from "@webority/chat-core";
|
|
2
|
+
import { findNodeHandle } from "react-native";
|
|
2
3
|
/** Moves screen-reader focus to a view. findNodeHandle throws on react-native-web, so the browser focuses the element itself. */
|
|
3
|
-
export declare function focusForAccessibility(node:
|
|
4
|
+
export declare function focusForAccessibility(node: Parameters<typeof findNodeHandle>[0]): void;
|
|
4
5
|
export declare function messageSignature(message: ChatLiveMessage): string;
|
|
5
6
|
export declare function openExternalUrl(url: string): void;
|
|
6
7
|
export declare function defaultOpenTarget(target: string): void;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
interface PlaybackStatus {
|
|
2
|
+
currentTime: number;
|
|
3
|
+
duration: number;
|
|
4
|
+
playing: boolean;
|
|
5
|
+
didJustFinish: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface AudioRecorderLike {
|
|
8
|
+
readonly uri: string | null;
|
|
9
|
+
readonly isRecording: boolean;
|
|
10
|
+
prepareToRecordAsync(): Promise<void>;
|
|
11
|
+
record(): void;
|
|
12
|
+
stop(): Promise<void>;
|
|
13
|
+
getStatus(): {
|
|
14
|
+
durationMillis: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
interface AudioPlayerLike {
|
|
18
|
+
volume: number;
|
|
19
|
+
play(): void;
|
|
20
|
+
pause(): void;
|
|
21
|
+
remove(): void;
|
|
22
|
+
addListener(event: "playbackStatusUpdate", listener: (status: PlaybackStatus) => void): {
|
|
23
|
+
remove(): void;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
interface AudioModeLike {
|
|
27
|
+
allowsRecording?: boolean;
|
|
28
|
+
playsInSilentMode?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface ExpoAudioModule {
|
|
31
|
+
AudioModule: {
|
|
32
|
+
AudioRecorder: new (options: object) => AudioRecorderLike;
|
|
33
|
+
};
|
|
34
|
+
RecordingPresets: {
|
|
35
|
+
HIGH_QUALITY: object;
|
|
36
|
+
};
|
|
37
|
+
setAudioModeAsync(mode: AudioModeLike): Promise<void>;
|
|
38
|
+
createAudioPlayer(source: {
|
|
39
|
+
uri: string;
|
|
40
|
+
}): AudioPlayerLike;
|
|
41
|
+
}
|
|
42
|
+
export interface ExpoFileSystemModule {
|
|
43
|
+
File: new (...args: unknown[]) => {
|
|
44
|
+
readonly uri: string;
|
|
45
|
+
create(options?: {
|
|
46
|
+
overwrite?: boolean;
|
|
47
|
+
}): void;
|
|
48
|
+
write(content: Uint8Array): void;
|
|
49
|
+
delete(): void;
|
|
50
|
+
};
|
|
51
|
+
Paths: {
|
|
52
|
+
readonly cache: unknown;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export declare const loadExpoAudio: () => ExpoAudioModule;
|
|
56
|
+
export declare const loadExpoFileSystem: () => ExpoFileSystemModule;
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=expoModules.d.ts.map
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { type ChatPart } from "@webority/chat-core";
|
|
1
2
|
import type { ChatPartRendererProps } from "../types";
|
|
2
|
-
|
|
3
|
+
type ActionView = Extract<ChatPart, {
|
|
4
|
+
kind: "Action";
|
|
5
|
+
}>;
|
|
6
|
+
export declare function ActionPart({ part, turn }: ChatPartRendererProps<ActionView>): import("react").JSX.Element;
|
|
7
|
+
export {};
|
|
3
8
|
//# sourceMappingURL=ActionPart.d.ts.map
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { ChatPart } from "@webority/chat-core";
|
|
1
2
|
import type { ChatPartRendererProps } from "../types";
|
|
2
|
-
export declare function FilePart(
|
|
3
|
+
export declare function FilePart({ part, turn }: ChatPartRendererProps<Extract<ChatPart, {
|
|
4
|
+
kind: "File";
|
|
5
|
+
}>>): import("react").JSX.Element;
|
|
3
6
|
//# sourceMappingURL=FilePart.d.ts.map
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import type { ChatPart } from "@webority/chat-core";
|
|
1
2
|
import type { ChatPartRendererProps } from "../types";
|
|
2
|
-
|
|
3
|
+
type InputRequestView = Extract<ChatPart, {
|
|
4
|
+
kind: "InputRequest";
|
|
5
|
+
}>;
|
|
6
|
+
export declare function InputRequestPart({ part, turn, pickAttachments }: ChatPartRendererProps<InputRequestView>): import("react").JSX.Element;
|
|
7
|
+
export {};
|
|
3
8
|
//# sourceMappingURL=InputRequestPart.d.ts.map
|
|
@@ -3,6 +3,6 @@ import type { ChatPartRendererProps } from "../types";
|
|
|
3
3
|
type NoticePartProps = ChatPartRendererProps<Extract<ChatPart, {
|
|
4
4
|
kind: "Notice";
|
|
5
5
|
}>>;
|
|
6
|
-
export declare function NoticePart({ part }: NoticePartProps): import("react").JSX.Element;
|
|
6
|
+
export declare function NoticePart({ part, turn }: NoticePartProps): import("react").JSX.Element;
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=NoticePart.d.ts.map
|
|
@@ -1,3 +1,41 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { ChatPart, ChatPartKind } from "@webority/chat-core";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import type { ChatPartRendererProps } from "../types";
|
|
4
|
+
import { ActionPart } from "./ActionPart";
|
|
5
|
+
import { ChartPart } from "./ChartPart";
|
|
6
|
+
import { FiguresPart } from "./FiguresPart";
|
|
7
|
+
import { FilePart } from "./FilePart";
|
|
8
|
+
import { HandoffPart } from "./HandoffPart";
|
|
9
|
+
import { ImagePart } from "./ImagePart";
|
|
10
|
+
import { InputRequestPart } from "./InputRequestPart";
|
|
11
|
+
import { NoticePart } from "./NoticePart";
|
|
12
|
+
import { QuickRepliesPart } from "./QuickRepliesPart";
|
|
13
|
+
import { RecordCardPart } from "./RecordCardPart";
|
|
14
|
+
import { SourcesPart } from "./SourcesPart";
|
|
15
|
+
import { TablePart } from "./TablePart";
|
|
16
|
+
import { TextPart } from "./TextPart";
|
|
17
|
+
import { TicketPart } from "./TicketPart";
|
|
18
|
+
import { VoiceClipPart } from "./VoiceClipPart";
|
|
19
|
+
export type DefaultRenderers = {
|
|
20
|
+
[K in ChatPartKind]: React.ComponentType<ChatPartRendererProps<Extract<ChatPart, {
|
|
21
|
+
kind: K;
|
|
22
|
+
}>>>;
|
|
23
|
+
};
|
|
24
|
+
export declare const defaultRenderers: {
|
|
25
|
+
Text: typeof TextPart;
|
|
26
|
+
Sources: typeof SourcesPart;
|
|
27
|
+
QuickReplies: typeof QuickRepliesPart;
|
|
28
|
+
InputRequest: typeof InputRequestPart;
|
|
29
|
+
Action: typeof ActionPart;
|
|
30
|
+
Notice: typeof NoticePart;
|
|
31
|
+
Table: typeof TablePart;
|
|
32
|
+
Chart: typeof ChartPart;
|
|
33
|
+
Figures: typeof FiguresPart;
|
|
34
|
+
RecordCard: typeof RecordCardPart;
|
|
35
|
+
Image: typeof ImagePart;
|
|
36
|
+
File: typeof FilePart;
|
|
37
|
+
Ticket: typeof TicketPart;
|
|
38
|
+
Handoff: typeof HandoffPart;
|
|
39
|
+
VoiceClip: typeof VoiceClipPart;
|
|
40
|
+
};
|
|
3
41
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -36,7 +36,7 @@ export type ChatPartRendererProps<P extends ChatPart = ChatPart> = {
|
|
|
36
36
|
part: P;
|
|
37
37
|
message: ChatLiveMessage;
|
|
38
38
|
turn: ChatTurnApi & ChatTurnHostApi;
|
|
39
|
-
pickAttachments?: PickAttachments;
|
|
39
|
+
pickAttachments?: PickAttachments | undefined;
|
|
40
40
|
};
|
|
41
41
|
export type ChatRenderers = Partial<{
|
|
42
42
|
[K in ChatPartKind]: React.ComponentType<ChatPartRendererProps<Extract<ChatPart, {
|
|
@@ -23,7 +23,7 @@ export interface UseChatOptions {
|
|
|
23
23
|
/** Where the session keeps the mute choice (key wchat:muted). */
|
|
24
24
|
prefs: ChatPrefs;
|
|
25
25
|
getCaptchaToken?: (action: string) => Promise<string | null>;
|
|
26
|
-
onEvent?: (name: string, data: Record<string, unknown>) => void;
|
|
26
|
+
onEvent?: ((name: string, data: Record<string, unknown>) => void) | undefined;
|
|
27
27
|
onError?: (error: unknown) => void;
|
|
28
28
|
/** Receives the path of a relative link in a reply; the host decides how to navigate to it. */
|
|
29
29
|
onNavigate?: (path: string) => void;
|
|
@@ -38,7 +38,7 @@ export interface UseChatResult extends ChatSessionState, ChatActions {
|
|
|
38
38
|
/** The message of the last hand-off request that failed, cleared by the next request. */
|
|
39
39
|
handoffError: string | null;
|
|
40
40
|
/** Present only when the host passed `onNavigate`; the turn API of each message hands relative links to it. */
|
|
41
|
-
onNavigate?: (path: string) => void;
|
|
41
|
+
onNavigate?: ((path: string) => void) | undefined;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* The chat's state and actions. The session lives in the component that calls it: one per client,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { UseChatResult } from "./useChat";
|
|
2
2
|
/**
|
|
3
3
|
* Plays the open cue when the panel opens, and the sent and reply cues for each new message, as the web chat does
|
|
4
|
-
* (chat-elements/src/WuiChat.
|
|
4
|
+
* (chat-elements/src/WuiChat.ts _playSounds). A send, an edit and a retry each add a new visitor message; an assistant,
|
|
5
5
|
* script or agent message plays the reply cue. Restored messages, notices and a history load stay silent, and the
|
|
6
6
|
* visitor message the server's copy replaces after a turn is stored, so it does not play the sent cue again.
|
|
7
7
|
* The phone has no WebAudio, so each cue is a short 16-bit WAV written once to the cache and played from there.
|
|
@@ -5,7 +5,7 @@ import type { ChatAppearance } from "./types.js";
|
|
|
5
5
|
* nested theme. With no appearance key set it draws its children as they are.
|
|
6
6
|
*/
|
|
7
7
|
export declare function ChatAppearanceScope({ appearance, children, }: {
|
|
8
|
-
appearance?: ChatAppearance;
|
|
8
|
+
appearance?: ChatAppearance | undefined;
|
|
9
9
|
children: React.ReactNode;
|
|
10
10
|
}): React.ReactElement;
|
|
11
11
|
//# sourceMappingURL=ChatAppearanceScope.d.ts.map
|
|
@@ -5,16 +5,16 @@ import type { UseChatResult } from "./useChat.js";
|
|
|
5
5
|
export interface ChatComposerProps {
|
|
6
6
|
chat: UseChatResult;
|
|
7
7
|
labels: ChatLabels;
|
|
8
|
-
pickAttachments?: PickAttachments;
|
|
9
|
-
keyboardOffset?: number;
|
|
10
|
-
keyboardAware?: boolean;
|
|
11
|
-
safeArea?: boolean;
|
|
8
|
+
pickAttachments?: PickAttachments | undefined;
|
|
9
|
+
keyboardOffset?: number | undefined;
|
|
10
|
+
keyboardAware?: boolean | undefined;
|
|
11
|
+
safeArea?: boolean | undefined;
|
|
12
12
|
testID?: string;
|
|
13
|
-
focusRef?: React.MutableRefObject<(() => void) | null
|
|
13
|
+
focusRef?: React.MutableRefObject<(() => void) | null> | undefined;
|
|
14
14
|
/** The resolved look: its input ring and send reveal draw the box and the send button. */
|
|
15
15
|
look?: ChatLook;
|
|
16
16
|
/** Icon name for the send button; the look's input.sendIcon. */
|
|
17
|
-
sendIcon?: string;
|
|
17
|
+
sendIcon?: string | undefined;
|
|
18
18
|
}
|
|
19
19
|
export declare function ChatComposer({ chat, labels, pickAttachments, keyboardOffset, keyboardAware, safeArea, testID, focusRef, look, sendIcon, }: ChatComposerProps): React.ReactElement;
|
|
20
20
|
//# sourceMappingURL=ChatComposer.d.ts.map
|
|
@@ -7,44 +7,44 @@ export type ChatLayout = "screen" | "sheet" | "embedded";
|
|
|
7
7
|
export interface ChatCommonProps {
|
|
8
8
|
chat: UseChatResult;
|
|
9
9
|
labels: ChatLabels;
|
|
10
|
-
renderers?: ChatRenderers;
|
|
11
|
-
layoutParts?: ChatLayoutParts;
|
|
10
|
+
renderers?: ChatRenderers | undefined;
|
|
11
|
+
layoutParts?: ChatLayoutParts | undefined;
|
|
12
12
|
loader?: ChatLoaderStyle;
|
|
13
13
|
/** The look: its input ring and send reveal, its panel motion and its motion switch. Unset values take the defaults. */
|
|
14
|
-
look?: ChatLookInput;
|
|
15
|
-
pickAttachments?: PickAttachments;
|
|
16
|
-
onOpenAttachment?: (part: Extract<ChatPart, {
|
|
14
|
+
look?: ChatLookInput | undefined;
|
|
15
|
+
pickAttachments?: PickAttachments | undefined;
|
|
16
|
+
onOpenAttachment?: ((part: Extract<ChatPart, {
|
|
17
17
|
kind: "File";
|
|
18
|
-
}>) => void;
|
|
19
|
-
onOpenTarget?: (target: string) => void;
|
|
20
|
-
onNavigate?: (path: string) => void;
|
|
18
|
+
}>) => void) | undefined;
|
|
19
|
+
onOpenTarget?: ((target: string) => void) | undefined;
|
|
20
|
+
onNavigate?: ((path: string) => void) | undefined;
|
|
21
21
|
/** Opens a ticket from a Ticket part or the open tickets list; the host shows the ticket. */
|
|
22
|
-
openTicket?: ChatOpenTicketHandler;
|
|
22
|
+
openTicket?: ChatOpenTicketHandler | undefined;
|
|
23
23
|
/** Hosts an absolute https link or Navigate chip may open; any other absolute target is not linked. */
|
|
24
|
-
handoffHosts?: readonly string[];
|
|
24
|
+
handoffHosts?: readonly string[] | undefined;
|
|
25
25
|
/** Resolves a link in a reply to a host route or address; null leaves the link as text. */
|
|
26
|
-
resolveLink?: (href: string) => string | null;
|
|
27
|
-
keyboardOffset?: number;
|
|
26
|
+
resolveLink?: ((href: string) => string | null) | undefined;
|
|
27
|
+
keyboardOffset?: number | undefined;
|
|
28
28
|
testID?: string;
|
|
29
29
|
}
|
|
30
30
|
export interface ChatFrameProps extends ChatCommonProps {
|
|
31
31
|
layout: ChatLayout;
|
|
32
|
-
title?: string;
|
|
32
|
+
title?: string | undefined;
|
|
33
33
|
headerActions?: React.ReactNode;
|
|
34
34
|
/** The host sheet closes through this callback. */
|
|
35
|
-
onClose?: () => void;
|
|
35
|
+
onClose?: (() => void) | undefined;
|
|
36
36
|
/** Changes each time the panel opens, so the panel motion plays again. Default 0. */
|
|
37
37
|
enterKey?: number;
|
|
38
38
|
}
|
|
39
39
|
/** The props of the three shells: the frame's, with labels as a partial merged over the defaults. */
|
|
40
40
|
export interface ChatShellProps extends Omit<ChatCommonProps, "labels"> {
|
|
41
41
|
labels?: Partial<ChatLabels>;
|
|
42
|
-
title?: string;
|
|
42
|
+
title?: string | undefined;
|
|
43
43
|
headerActions?: React.ReactNode;
|
|
44
44
|
/** The host sheet closes through this callback. */
|
|
45
|
-
onClose?: () => void;
|
|
45
|
+
onClose?: (() => void) | undefined;
|
|
46
46
|
/** The web's appearance keys the phone reads: accent, corner radius and font, and the launcher side and offsets for a sheet. */
|
|
47
|
-
appearance?: ChatAppearance;
|
|
47
|
+
appearance?: ChatAppearance | undefined;
|
|
48
48
|
}
|
|
49
49
|
export declare function ChatFrame({ chat, labels, renderers, layoutParts, loader, look, pickAttachments, onOpenAttachment, onOpenTarget, onNavigate, openTicket, handoffHosts, resolveLink, keyboardOffset, layout, title, headerActions, onClose, enterKey, testID, }: ChatFrameProps): React.ReactElement | null;
|
|
50
50
|
//# sourceMappingURL=ChatFrame.d.ts.map
|
|
@@ -5,7 +5,7 @@ import type { UseChatResult } from "./useChat.js";
|
|
|
5
5
|
export interface ChatOpenTicketsProps {
|
|
6
6
|
chat: UseChatResult;
|
|
7
7
|
labels: ChatLabels;
|
|
8
|
-
onOpenTicket?: (ticket: ChatTicketRef) => void;
|
|
8
|
+
onOpenTicket?: ((ticket: ChatTicketRef) => void) | undefined;
|
|
9
9
|
testID?: string;
|
|
10
10
|
}
|
|
11
11
|
export declare function ChatOpenTickets({ chat, labels, onOpenTicket, testID, }: ChatOpenTicketsProps): React.ReactElement | null;
|
|
@@ -3,13 +3,13 @@ import type React from "react";
|
|
|
3
3
|
import { type ChatShellProps } from "./ChatFrame.js";
|
|
4
4
|
export interface ChatSheetProps extends ChatShellProps {
|
|
5
5
|
/** Controls the sheet. When given, the sheet follows it. */
|
|
6
|
-
open?: boolean;
|
|
6
|
+
open?: boolean | undefined;
|
|
7
7
|
/** The starting state when `open` is not given. Default false. */
|
|
8
8
|
defaultOpen?: boolean;
|
|
9
|
-
onOpenChange?: (open: boolean) => void;
|
|
9
|
+
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
10
10
|
snapPoints?: BottomSheetProps["snapPoints"];
|
|
11
11
|
/** Opens the sheet on this conversation when it changes to a new id (a push tap); uncontrolled sheets only. */
|
|
12
|
-
conversationId?: string | null;
|
|
12
|
+
conversationId?: string | null | undefined;
|
|
13
13
|
}
|
|
14
14
|
/** The chat in a bottom sheet over the screen, opened from a floating launcher. */
|
|
15
15
|
export declare function ChatSheet({ chat, labels, renderers, layoutParts, loader, look, appearance, pickAttachments, onOpenAttachment, onOpenTarget, onNavigate, keyboardOffset, open, defaultOpen, onOpenChange, snapPoints, openTicket, handoffHosts, resolveLink, conversationId, onClose, testID, }: ChatSheetProps): React.ReactElement | null;
|
|
@@ -5,7 +5,7 @@ import type { UseChatResult } from "./useChat.js";
|
|
|
5
5
|
export interface ChatStartersProps {
|
|
6
6
|
chat: UseChatResult;
|
|
7
7
|
labels: ChatLabels;
|
|
8
|
-
openTicket?: ChatOpenTicketHandler;
|
|
8
|
+
openTicket?: ChatOpenTicketHandler | undefined;
|
|
9
9
|
avatar?: string | null;
|
|
10
10
|
motion?: "On" | "Reduced";
|
|
11
11
|
greetingLoaderMs?: number;
|