@ahmedramez-org/nexus-chat 1.0.0-beta.12 → 1.0.0-beta.13
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/contract/index.d.ts +6 -0
- package/package.json +1 -1
- package/react.d.ts +2 -0
- package/react.js +15 -3
- package/window.js +3 -1
package/contract/index.d.ts
CHANGED
|
@@ -404,6 +404,12 @@ export interface NexusChatWindowState {
|
|
|
404
404
|
mode?: NexusChatWindowMode;
|
|
405
405
|
/** The modes the host can switch to now, the current one included. */
|
|
406
406
|
modes?: readonly NexusChatWindowMode[];
|
|
407
|
+
/**
|
|
408
|
+
* The window is out of sight but the chat stays mounted (minimized, so the
|
|
409
|
+
* conversation stays). Anything that should not go on unseen stops: a
|
|
410
|
+
* dictation in progress ends and releases the microphone. Omitted means shown.
|
|
411
|
+
*/
|
|
412
|
+
hidden?: boolean;
|
|
407
413
|
}
|
|
408
414
|
export interface NexusChatWindow {
|
|
409
415
|
/** May return a fresh object on every call: the chat compares the fields. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ahmedramez-org/nexus-chat",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.13",
|
|
4
4
|
"description": "NexusChat 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": {
|
package/react.d.ts
CHANGED
|
@@ -45,6 +45,8 @@ export interface DirectNexusChatProps extends DirectChatProps {
|
|
|
45
45
|
canDock: boolean;
|
|
46
46
|
mode?: NexusChatMode;
|
|
47
47
|
modes?: readonly NexusChatMode[];
|
|
48
|
+
/** Minimized but still mounted: a dictation in progress ends. */
|
|
49
|
+
hidden?: boolean;
|
|
48
50
|
setDocked(docked: boolean): void;
|
|
49
51
|
setMode?(mode: NexusChatMode): void;
|
|
50
52
|
close(): void;
|
package/react.js
CHANGED
|
@@ -61,7 +61,13 @@ function DirectChat({
|
|
|
61
61
|
);
|
|
62
62
|
useEffect(
|
|
63
63
|
() => windowState.current.notify(),
|
|
64
|
-
[
|
|
64
|
+
[
|
|
65
|
+
hostWindow?.docked,
|
|
66
|
+
hostWindow?.canDock,
|
|
67
|
+
hostWindow?.mode,
|
|
68
|
+
hostWindow?.modes?.join(),
|
|
69
|
+
hostWindow?.hidden,
|
|
70
|
+
],
|
|
65
71
|
);
|
|
66
72
|
|
|
67
73
|
// Mounts once per element (and again only if `window` appears or goes):
|
|
@@ -116,8 +122,14 @@ function DirectChat({
|
|
|
116
122
|
canDock = false,
|
|
117
123
|
mode,
|
|
118
124
|
modes,
|
|
125
|
+
hidden,
|
|
119
126
|
} = current().hostWindow ?? {};
|
|
120
|
-
return {
|
|
127
|
+
return {
|
|
128
|
+
docked,
|
|
129
|
+
canDock,
|
|
130
|
+
...(mode && modes ? { mode, modes } : {}),
|
|
131
|
+
...(hidden ? { hidden: true } : {}),
|
|
132
|
+
};
|
|
121
133
|
},
|
|
122
134
|
subscribe: windowState.current.subscribe,
|
|
123
135
|
setDocked: (docked) => current().hostWindow?.setDocked(docked),
|
|
@@ -292,7 +304,7 @@ function EmbeddedChat({ embedUrl, modes, defaultMode, theme = 'light', locale })
|
|
|
292
304
|
ref: frame,
|
|
293
305
|
title: NAME,
|
|
294
306
|
src,
|
|
295
|
-
allow: 'storage-access',
|
|
307
|
+
allow: 'storage-access; microphone',
|
|
296
308
|
style: { display: 'block', width: '100%', height: '100%', border: 0 },
|
|
297
309
|
}),
|
|
298
310
|
),
|
package/window.js
CHANGED
|
@@ -148,6 +148,8 @@ export function createChatWindow({ into, panel, modes = MODES, defaultMode, them
|
|
|
148
148
|
mode: shown() ?? 'floating',
|
|
149
149
|
// None while the viewport is too narrow for anything but full screen.
|
|
150
150
|
modes: narrow ? [] : allowed,
|
|
151
|
+
// Minimized keeps the chat mounted; it still has to know it is out of sight.
|
|
152
|
+
...(opened && shown() ? {} : { hidden: true }),
|
|
151
153
|
});
|
|
152
154
|
|
|
153
155
|
function draw() {
|
|
@@ -355,7 +357,7 @@ export function createEmbeddedChat({
|
|
|
355
357
|
if (embedded || !win.opened) return;
|
|
356
358
|
const iframe = document.createElement('iframe');
|
|
357
359
|
iframe.title = NAME;
|
|
358
|
-
iframe.allow = 'storage-access';
|
|
360
|
+
iframe.allow = 'storage-access; microphone';
|
|
359
361
|
iframe.src = embedSrc(embedUrl, theme, locale);
|
|
360
362
|
iframe.style.cssText = 'display:block;width:100%;height:100%;border:0';
|
|
361
363
|
win.panel.prepend(iframe);
|