@ahmedramez-org/chat 0.10.0 → 0.11.1

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.
@@ -106,6 +106,12 @@ export type ToChat = {
106
106
  } | {
107
107
  incortaChat: 'intent';
108
108
  intent: SurfaceIntent;
109
+ } | {
110
+ incortaChat: 'compose';
111
+ dictate?: true;
112
+ } | {
113
+ incortaChat: 'openSession';
114
+ sessionId: string;
109
115
  };
110
116
  export type BridgeMessage = ToHost | ToChat;
111
117
  /**
@@ -211,6 +211,12 @@ export function parse(data) {
211
211
  typeof raw.data === 'string'
212
212
  ? { incortaChat: 'file', name: raw.name, type: raw.type, data: raw.data }
213
213
  : undefined;
214
+ case 'compose':
215
+ return { incortaChat: 'compose', ...(raw.dictate === true ? { dictate: true } : {}) };
216
+ case 'openSession':
217
+ return text(raw.sessionId) && raw.sessionId.trim()
218
+ ? { incortaChat: 'openSession', sessionId: raw.sessionId }
219
+ : undefined;
214
220
  case 'intent': {
215
221
  const read = intent(raw.intent);
216
222
  return read ? { incortaChat: 'intent', intent: read } : undefined;
@@ -970,6 +970,16 @@ export interface ChatHandle {
970
970
  * While an unsent question is still being recovered nothing opens.
971
971
  */
972
972
  openSession(sessionId: string): void;
973
+ /**
974
+ * Puts the user in an empty new chat's composer (an app's shortcut: a link, a quick action,
975
+ * a widget). It starts a new chat unless the chat on screen is already an unsent one, and
976
+ * focuses its field once the chat is connected. `dictate`: dictation starts instead, as a tap
977
+ * on the mic, with its rules (no mic on offer: the field only takes the focus; a refused
978
+ * microphone: `events.onMicrophoneBlocked`). Absent on a chat older than it.
979
+ */
980
+ compose?(options?: {
981
+ dictate?: boolean;
982
+ }): void;
973
983
  /**
974
984
  * The state of the surfaces the host owns (`chat.surfaces`), and the user's actions on
975
985
  * them. Absent on a chat older than surfaces.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahmedramez-org/chat",
3
- "version": "0.10.0",
3
+ "version": "0.11.1",
4
4
  "description": "Incorta's chat for any app: a connector and React component that load the prebuilt chat from IncortaCopilot (or a pinned copy), and the host contract types and checks.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {