@touchcastllc/napster-companion-api-dev 2.0.0-alpha.0 → 2.0.0-alpha.2
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/constants/events.d.ts +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +8 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.js +1 -1
- package/lib/index.standalone.js +1 -1
- package/lib/services/micGate.d.ts +13 -3
- package/lib/types/index.d.ts +24 -3
- package/package.json +1 -1
|
@@ -10,6 +10,14 @@ export interface MicGateController {
|
|
|
10
10
|
export interface MicGateOptions {
|
|
11
11
|
/** Element the recovery card mounts into on denial. */
|
|
12
12
|
root: HTMLElement;
|
|
13
|
+
/**
|
|
14
|
+
* True when the SDK's own click-to-start button is in play. Gates the
|
|
15
|
+
* 30s dismiss-timer below: with no button for an ignored prompt to fall
|
|
16
|
+
* back to, there's nothing useful for the attempt to collapse into, so
|
|
17
|
+
* this waits on the browser's own prompt indefinitely instead of forcing
|
|
18
|
+
* "entry" and firing onDismissed.
|
|
19
|
+
*/
|
|
20
|
+
buttonMode: boolean;
|
|
13
21
|
/**
|
|
14
22
|
* The microphone is available. Fires once for an immediate grant, and
|
|
15
23
|
* again after each successful "Check again" retry. May return a promise —
|
|
@@ -21,9 +29,11 @@ export interface MicGateOptions {
|
|
|
21
29
|
onError?: (error: Error) => void;
|
|
22
30
|
/**
|
|
23
31
|
* Fires when a native permission prompt is ignored for 30s and the attempt
|
|
24
|
-
* collapses back to the entry point — first attempt or retry.
|
|
25
|
-
*
|
|
26
|
-
*
|
|
32
|
+
* collapses back to the entry point — first attempt or retry. Only possible
|
|
33
|
+
* when buttonMode is true (see its own comment); without a button there is
|
|
34
|
+
* no 30s timer and this never fires. Distinct from onError: a dismiss is
|
|
35
|
+
* not a failure, it is a clean, silent return to idle, so nothing on this
|
|
36
|
+
* channel may reach the host's own onError.
|
|
27
37
|
*
|
|
28
38
|
* Exists because gateOnMicrophone()'s own promise resolves identically for
|
|
29
39
|
* every outcome (it returns a bare { dismiss } handle), so a caller awaiting
|
package/lib/types/index.d.ts
CHANGED
|
@@ -107,8 +107,10 @@ export type StopVideoCommand = {
|
|
|
107
107
|
export interface FunctionCallOutputData {
|
|
108
108
|
/** Identifier the server uses to pair the call with its output. */
|
|
109
109
|
call_id: string;
|
|
110
|
-
/** JSON
|
|
111
|
-
output:
|
|
110
|
+
/** Function result. Any JSON value; the server accepts `Any`. */
|
|
111
|
+
output: unknown;
|
|
112
|
+
/** Wait for the avatar to finish its current speech before handling this. */
|
|
113
|
+
delay?: boolean;
|
|
112
114
|
}
|
|
113
115
|
export type FunctionCallOutputCommand = {
|
|
114
116
|
type: DataChannelMessageType.FUNCTION_CALL_OUTPUT;
|
|
@@ -227,6 +229,18 @@ export interface FeatureConfig {
|
|
|
227
229
|
/** Mouth opening ratio threshold. Default 0.015. */
|
|
228
230
|
talkingThreshold?: number;
|
|
229
231
|
};
|
|
232
|
+
/** The "big card" placeholder (blurred companion photo + spinner) shown
|
|
233
|
+
* behind the entry/loading/permission-pending/permission-blocked states,
|
|
234
|
+
* and the zoom-in grow animation played when the session becomes ready.
|
|
235
|
+
* Disable when the embedding app renders its own start/loading screen
|
|
236
|
+
* and would otherwise have to fight this with CSS. Defaults to
|
|
237
|
+
* `enabled: true`. The MicPermission recovery card itself (the actual
|
|
238
|
+
* "Allow microphone access" / "Check again" UI) and the ready video/
|
|
239
|
+
* canvas are unaffected — this only controls the decorative chrome
|
|
240
|
+
* behind/around them. */
|
|
241
|
+
loadingIndicator?: {
|
|
242
|
+
enabled: boolean;
|
|
243
|
+
};
|
|
230
244
|
}
|
|
231
245
|
/**
|
|
232
246
|
* Configuration for the face tracking service.
|
|
@@ -701,7 +715,14 @@ export interface NapsterCompanionApiSDK {
|
|
|
701
715
|
};
|
|
702
716
|
}): Promise<NapsterCompanionApiController>;
|
|
703
717
|
/**
|
|
704
|
-
* Initialize the SDK and connect immediately
|
|
718
|
+
* Initialize the SDK and connect immediately.
|
|
719
|
+
*
|
|
720
|
+
* The returned promise resolves as soon as the widget has mounted and
|
|
721
|
+
* rendered — before the microphone prompt, before `getToken()`, before any
|
|
722
|
+
* connection exists. Sending a command (`sendCommand`, `enableFeature`,
|
|
723
|
+
* etc.) right after `await init()` can silently drop it if the session
|
|
724
|
+
* isn't actually connected yet. Use {@link NapsterCompanionApiConfig.onAvatarReady}
|
|
725
|
+
* (or `onSessionStatusChange`) to know when the session itself is up.
|
|
705
726
|
*
|
|
706
727
|
* `getToken` is called by the SDK itself once the microphone permission has
|
|
707
728
|
* settled, so the connection token is always fresh when signaling starts. A
|