@sub-zero/cocoa 0.0.0-stage → 0.1.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.
- package/README.md +164 -2
- package/dist/cocoa.js +337 -0
- package/dist/index.cjs +319 -0
- package/dist/index.d.cts +34 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +317 -0
- package/package.json +55 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface CocoaOptions {
|
|
2
|
+
/** Public deployment UUID from SubZero → Agents → Chatbots. */
|
|
3
|
+
chatbotId: string;
|
|
4
|
+
/** Defaults to https://api.sub-zero.dev. HTTPS required except on loopback. */
|
|
5
|
+
apiUrl?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
/** Accessible name and hover tooltip for the circular Cocoa portrait button. */
|
|
8
|
+
launcherLabel?: string;
|
|
9
|
+
welcomeMessage?: string;
|
|
10
|
+
/** Unverified display name, never an authentication credential. */
|
|
11
|
+
visitorLabel?: string;
|
|
12
|
+
/** Six-digit hex color, e.g. #385b50. */
|
|
13
|
+
accentColor?: string;
|
|
14
|
+
zIndex?: number;
|
|
15
|
+
/** Defaults to true. Stores the visitor credential in this tab's sessionStorage. */
|
|
16
|
+
persistSession?: boolean;
|
|
17
|
+
/** CSP nonce for the widget's isolated stylesheet. */
|
|
18
|
+
nonce?: string;
|
|
19
|
+
/** Minimum 2500ms; defaults to 2500. Only polls while visible. */
|
|
20
|
+
pollInterval?: number;
|
|
21
|
+
/** Receives sanitized errors; no visitor credentials or transcript. */
|
|
22
|
+
onError?: (error: Error) => void;
|
|
23
|
+
}
|
|
24
|
+
export interface CocoaWidget {
|
|
25
|
+
open(): void;
|
|
26
|
+
close(): void;
|
|
27
|
+
toggle(): void;
|
|
28
|
+
/** Forget this tab's session; does not delete its server transcript. */
|
|
29
|
+
reset(): void;
|
|
30
|
+
/** Remove UI, timers, listeners and abort in-flight requests. */
|
|
31
|
+
destroy(): void;
|
|
32
|
+
}
|
|
33
|
+
/** Call after the document body exists. Importing is safe during SSR. */
|
|
34
|
+
export function createCocoa(options: CocoaOptions): CocoaWidget;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface CocoaOptions {
|
|
2
|
+
/** Public deployment UUID from SubZero → Agents → Chatbots. */
|
|
3
|
+
chatbotId: string;
|
|
4
|
+
/** Defaults to https://api.sub-zero.dev. HTTPS required except on loopback. */
|
|
5
|
+
apiUrl?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
/** Accessible name and hover tooltip for the circular Cocoa portrait button. */
|
|
8
|
+
launcherLabel?: string;
|
|
9
|
+
welcomeMessage?: string;
|
|
10
|
+
/** Unverified display name, never an authentication credential. */
|
|
11
|
+
visitorLabel?: string;
|
|
12
|
+
/** Six-digit hex color, e.g. #385b50. */
|
|
13
|
+
accentColor?: string;
|
|
14
|
+
zIndex?: number;
|
|
15
|
+
/** Defaults to true. Stores the visitor credential in this tab's sessionStorage. */
|
|
16
|
+
persistSession?: boolean;
|
|
17
|
+
/** CSP nonce for the widget's isolated stylesheet. */
|
|
18
|
+
nonce?: string;
|
|
19
|
+
/** Minimum 2500ms; defaults to 2500. Only polls while visible. */
|
|
20
|
+
pollInterval?: number;
|
|
21
|
+
/** Receives sanitized errors; no visitor credentials or transcript. */
|
|
22
|
+
onError?: (error: Error) => void;
|
|
23
|
+
}
|
|
24
|
+
export interface CocoaWidget {
|
|
25
|
+
open(): void;
|
|
26
|
+
close(): void;
|
|
27
|
+
toggle(): void;
|
|
28
|
+
/** Forget this tab's session; does not delete its server transcript. */
|
|
29
|
+
reset(): void;
|
|
30
|
+
/** Remove UI, timers, listeners and abort in-flight requests. */
|
|
31
|
+
destroy(): void;
|
|
32
|
+
}
|
|
33
|
+
/** Call after the document body exists. Importing is safe during SSR. */
|
|
34
|
+
export function createCocoa(options: CocoaOptions): CocoaWidget;
|