@ateam-ai-mobile/ui 0.1.9 → 0.1.11

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/dist/index.d.mts CHANGED
@@ -184,12 +184,6 @@ declare function WorkspaceBanner({ topInset }: WorkspaceBannerProps): react_jsx_
184
184
  interface HandoffScreenProps {
185
185
  /** The one-time handoff code the host captured from the deep link (null = nothing pending). */
186
186
  code: string | null;
187
- /**
188
- * Adopt the handed-off tenant. AWAITED before onSignedIn so the host's active
189
- * tenant is set before the session reads it (the exchange result carries the
190
- * tenant the code was bound to). No-op is fine when the result has no tenant.
191
- */
192
- onAdoptTenant: (tenant: string) => void | Promise<void>;
193
187
  /** Adopt the session JWT (host wires its authStore.login → core session + tenantConfirmed). */
194
188
  onSignedIn: (jwt: string) => void | Promise<void>;
195
189
  /** Clear the consumed single-use code so a relaunch never retries it. Called after success. */
@@ -197,32 +191,30 @@ interface HandoffScreenProps {
197
191
  /** Back to sign in — the host toggles the pre-auth phase (not a router). */
198
192
  onCancel: () => void;
199
193
  }
200
- declare function HandoffScreen({ code, onAdoptTenant, onSignedIn, onDone, onCancel }: HandoffScreenProps): react_jsx_runtime.JSX.Element;
194
+ declare function HandoffScreen({ code, onSignedIn, onDone, onCancel }: HandoffScreenProps): react_jsx_runtime.JSX.Element;
201
195
 
202
196
  /**
203
197
  * Handoff exchange — the pure, testable half of HandoffScreen (R9B).
204
198
  *
205
199
  * Kept JSX-free in its own module (like R6's runLogoutTeardown) so the
206
- * security-sensitive error mapper and the adopt-before-sign-in ORDERING can be
200
+ * security-sensitive error mapper and the sign-in-before-clear ORDERING can be
207
201
  * node-tested directly, without rendering the RN component.
208
202
  */
209
203
 
210
204
  interface HandoffExchangeDeps {
211
205
  /** Trade the one-time code for a session JWT (host injects core.exchangeHandoff). */
212
206
  exchange: (code: string) => Promise<HandoffExchangeResult>;
213
- /** Adopt the handed-off tenant (host's single tenant writer). */
214
- onAdoptTenant: (tenant: string) => void | Promise<void>;
215
207
  /** Adopt the session JWT. */
216
208
  onSignedIn: (jwt: string) => void | Promise<void>;
217
209
  /** Clear the consumed single-use code. */
218
210
  onDone: () => void;
219
211
  }
220
212
  /**
221
- * Run the handoff: exchange → (adopt tenant) → sign in → clear the code, in that
222
- * exact order. The tenant adoption is AWAITED BEFORE onSignedIn so the host's
223
- * active tenant is set before the session reads it — a cross-tenant handoff must
224
- * never sign in under the wrong tenant. Throws on any failure (the caller maps it
225
- * to a user-facing message); onSignedIn / onDone never run on the error path.
213
+ * Run the handoff: exchange → sign in → clear the code, in that exact order. The
214
+ * handed-off tenant is the JWT's own `tenant` claim (getTenant() reads it), so a
215
+ * cross-tenant handoff is scoped correctly with nothing for the host to store.
216
+ * Throws on any failure (the caller maps it to a user-facing message);
217
+ * onSignedIn / onDone never run on the error path.
226
218
  */
227
219
  declare function runHandoffExchange(code: string, deps: HandoffExchangeDeps): Promise<void>;
228
220
  /**
@@ -236,19 +228,17 @@ declare function runHandoffExchange(code: string, deps: HandoffExchangeDeps): Pr
236
228
  declare function handoffErrorMessage(msg?: string): string;
237
229
 
238
230
  interface OpenJoinScreenProps {
239
- /** Adopt the joined tenant (host's single ACTIVE_TENANT writer), awaited before sign-in. */
240
- onAdoptTenant: (tenant: string) => void | Promise<void>;
241
231
  /** Adopt the session JWT (host: authStore.login → core session + tenantConfirmed). */
242
232
  onSignedIn: (jwt: string) => void | Promise<void>;
243
233
  /** Back to sign in — the host toggles the pre-auth phase (not a router). */
244
234
  onBack: () => void;
245
235
  }
246
- declare function OpenJoinScreen({ onAdoptTenant, onSignedIn, onBack }: OpenJoinScreenProps): react_jsx_runtime.JSX.Element;
236
+ declare function OpenJoinScreen({ onSignedIn, onBack }: OpenJoinScreenProps): react_jsx_runtime.JSX.Element;
247
237
 
248
238
  /**
249
239
  * Open self-signup — the pure, testable half of OpenJoinScreen (R9B).
250
240
  *
251
- * JSX-free so the join ORDERING (join → adopt tenant → sign in) and the error
241
+ * JSX-free so the join ORDERING (join → sign in) and the error
252
242
  * mapper are node-testable without rendering. The native id_token acquisition
253
243
  * happens in the component via getOAuthProvider(); the acquired token is passed
254
244
  * in here, so this module stays pure and provider-free.
@@ -257,8 +247,6 @@ declare function OpenJoinScreen({ onAdoptTenant, onSignedIn, onBack }: OpenJoinS
257
247
  interface OpenJoinDeps {
258
248
  /** Exchange { tenant, id_token } for a session JWT (host injects core.openJoinWith*). */
259
249
  join: (slug: string, idToken: string) => Promise<ConsumerSignInResult>;
260
- /** Adopt the joined tenant (host's single ACTIVE_TENANT writer). */
261
- onAdoptTenant: (tenant: string) => void | Promise<void>;
262
250
  /** Adopt the session JWT. */
263
251
  onSignedIn: (jwt: string) => void | Promise<void>;
264
252
  }
@@ -267,10 +255,10 @@ interface OpenJoinDeps {
267
255
  *
268
256
  * Returns false WITHOUT side effects when idToken is null — the caller acquired
269
257
  * no token (the user cancelled the native sheet, or it returned none), which is
270
- * a silent no-op, never an error. Otherwise: join → adopt the joined tenant →
271
- * sign in, in that order (the tenant is adopted only AFTER the server confirms
272
- * the join, and BEFORE sign-in so the session reads the right tenant). Throws on
273
- * a join failure (the caller maps it to a message); sign-in never runs then.
258
+ * a silent no-op, never an error. Otherwise: join → sign in. The joined tenant
259
+ * is the returned JWT's own `tenant` claim (getTenant() reads it), so there is
260
+ * nothing for the host to store. Throws on a join failure (the caller maps it to
261
+ * a message); sign-in never runs then.
274
262
  */
275
263
  declare function completeOpenJoin(slug: string, idToken: string | null, deps: OpenJoinDeps): Promise<boolean>;
276
264
  /**
@@ -322,18 +310,19 @@ declare function completeInviteJoin(code: string, idToken: string | null, deps:
322
310
  declare function inviteHeadline(preview: InvitePreview | null): string;
323
311
 
324
312
  interface LoginScreenProps {
325
- /** The reactive pre-auth tenant pick (host: useSession().tenant). Re-fetches config on change. */
313
+ /** The reactive pre-auth team (host: useSession().tenant). Re-fetches config on change.
314
+ * '' → the screen asks for the team. */
326
315
  activeTenant: string;
327
- /** The fallback tenant for the consumer-disabled self-heal guard (host: DEFAULT_TENANT). */
328
- defaultTenant: string;
329
- /** Reset to the default tenant + persist + bump activeTenant so this screen refetches. */
316
+ /** The user named a team to sign in to: the host stores it as its signed-out pick. */
317
+ onPickTenant: (tenant: string) => void | Promise<void>;
318
+ /** The team has no consumer sign-in: the host clears its pick (the screen asks for another). */
330
319
  onConsumerDisabled: () => void | Promise<void>;
331
320
  /** Adopt the session JWT (host: authStore.login → core session + tenantConfirmed). */
332
321
  onSignedIn: (jwt: string) => void | Promise<void>;
333
322
  /** Open the host's "join a team by name" (OpenJoin) sub-view. Link hidden when omitted. */
334
323
  onJoinTeam?: () => void;
335
324
  }
336
- declare function LoginScreen({ activeTenant, defaultTenant, onConsumerDisabled, onSignedIn, onJoinTeam }: LoginScreenProps): react_jsx_runtime.JSX.Element;
325
+ declare function LoginScreen({ activeTenant, onPickTenant, onConsumerDisabled, onSignedIn, onJoinTeam }: LoginScreenProps): react_jsx_runtime.JSX.Element;
337
326
 
338
327
  /**
339
328
  * Login — the pure, testable half of LoginScreen (R9B).
@@ -353,12 +342,11 @@ declare function googleClientIds(config: ConsumerCapabilityConfig): {
353
342
  iosClientId: string;
354
343
  };
355
344
  /**
356
- * Whether a failed config fetch should self-heal by falling back to the default
357
- * tenant. A consumer-DISABLED tenant 404s with "capability not enabled"; rather
358
- * than dead-end the user on red text we coerce back to the default and refetch.
359
- * Guarded by currentTenant !== defaultTenant so we never loop on the default.
345
+ * Whether a failed config fetch means the picked tenant has no consumer sign-in
346
+ * ("capability not enabled" 404). The host then clears its pick and shows its
347
+ * team picker — it never falls back to a default tenant.
360
348
  */
361
- declare function shouldRecoverToDefaultTenant(errorMsg: string | undefined, currentTenant: string, defaultTenant: string): boolean;
349
+ declare function isConsumerDisabled(errorMsg: string | undefined): boolean;
362
350
  interface ProviderSignInDeps {
363
351
  /** Trade the provider id_token for a session JWT (host injects core.signInWith*). */
364
352
  exchange: (idToken: string) => Promise<ConsumerSignInResult>;
@@ -545,6 +533,7 @@ declare class VoiceSessionManager implements VoiceSessionProvider {
545
533
  /** Run an authorized device tool. Never throws: every failure is an answer. */
546
534
  private runDeviceTool;
547
535
  private setState;
536
+ private setCallAudio;
548
537
  private appendTranscript;
549
538
  private emit;
550
539
  private waitForConnect;
@@ -606,6 +595,12 @@ interface OAuthProvider {
606
595
  }
607
596
  /** Register a native OAuth implementation (e.g. via @ateam-ai-mobile/expo). */
608
597
  declare function setOAuthProvider(oauth: OAuthProvider | null): void;
598
+ interface CallAudioProvider {
599
+ beginCall(): void;
600
+ endCall(): void;
601
+ }
602
+ /** Register the device's call audio mode (e.g. via @ateam-ai-mobile/expo). */
603
+ declare function setCallAudioProvider(callAudio: CallAudioProvider | null): void;
609
604
  interface ClipboardProvider {
610
605
  setString(text: string): Promise<void>;
611
606
  }
@@ -622,4 +617,4 @@ declare function setUIActionNavigator(navigate: UIActionNavigator | null): void;
622
617
  type ExtraHostsGetter = () => string[];
623
618
  declare function setPluginWebViewExtraHosts(getter: ExtraHostsGetter | null): void;
624
619
 
625
- export { AdasChatScreen, type AdasChatScreenProps, type CallState, ChatInput, type ClipboardProvider, DaySeparator, EmbeddedPluginWebView, type HandoffExchangeDeps, HandoffScreen, type HandoffScreenProps, type InviteJoinDeps, JobProgressBar, JoinScreen, type JoinScreenProps, Lightbox, LoginScreen, type LoginScreenProps, MessageBubble, type OAuthGoogleConfig, type OAuthProvider, type OpenJoinDeps, OpenJoinScreen, type OpenJoinScreenProps, Plugin, PluginSurface, type ProviderSignInDeps, TableCardBlock, TenantPicker, type TenantPickerProps, type TranscriptEntry, TypingIndicator, type UIActionRoute, UIActionsRow, VoiceCallSheet, VoiceMicIndicator, VoiceSessionHost, WidgetHost, WidgetWebView, WorkspaceBanner, type WorkspaceBannerProps, buildPluginBridgeJS, completeInviteJoin, completeOpenJoin, completeProviderSignIn, googleClientIds, handoffErrorMessage, inviteHeadline, openJoinErrorMessage, openWidget, runHandoffExchange, setClipboardProvider, setOAuthProvider, setPluginWebViewExtraHosts, setUIActionNavigator, shouldRecoverToDefaultTenant, useLightboxStore, usePluginBridge, useVoiceCall, useWidgetHostStore, voiceSession };
620
+ export { AdasChatScreen, type AdasChatScreenProps, type CallAudioProvider, type CallState, ChatInput, type ClipboardProvider, DaySeparator, EmbeddedPluginWebView, type HandoffExchangeDeps, HandoffScreen, type HandoffScreenProps, type InviteJoinDeps, JobProgressBar, JoinScreen, type JoinScreenProps, Lightbox, LoginScreen, type LoginScreenProps, MessageBubble, type OAuthGoogleConfig, type OAuthProvider, type OpenJoinDeps, OpenJoinScreen, type OpenJoinScreenProps, Plugin, PluginSurface, type ProviderSignInDeps, TableCardBlock, TenantPicker, type TenantPickerProps, type TranscriptEntry, TypingIndicator, type UIActionRoute, UIActionsRow, VoiceCallSheet, VoiceMicIndicator, VoiceSessionHost, WidgetHost, WidgetWebView, WorkspaceBanner, type WorkspaceBannerProps, buildPluginBridgeJS, completeInviteJoin, completeOpenJoin, completeProviderSignIn, googleClientIds, handoffErrorMessage, inviteHeadline, isConsumerDisabled, openJoinErrorMessage, openWidget, runHandoffExchange, setCallAudioProvider, setClipboardProvider, setOAuthProvider, setPluginWebViewExtraHosts, setUIActionNavigator, useLightboxStore, usePluginBridge, useVoiceCall, useWidgetHostStore, voiceSession };
package/dist/index.d.ts CHANGED
@@ -184,12 +184,6 @@ declare function WorkspaceBanner({ topInset }: WorkspaceBannerProps): react_jsx_
184
184
  interface HandoffScreenProps {
185
185
  /** The one-time handoff code the host captured from the deep link (null = nothing pending). */
186
186
  code: string | null;
187
- /**
188
- * Adopt the handed-off tenant. AWAITED before onSignedIn so the host's active
189
- * tenant is set before the session reads it (the exchange result carries the
190
- * tenant the code was bound to). No-op is fine when the result has no tenant.
191
- */
192
- onAdoptTenant: (tenant: string) => void | Promise<void>;
193
187
  /** Adopt the session JWT (host wires its authStore.login → core session + tenantConfirmed). */
194
188
  onSignedIn: (jwt: string) => void | Promise<void>;
195
189
  /** Clear the consumed single-use code so a relaunch never retries it. Called after success. */
@@ -197,32 +191,30 @@ interface HandoffScreenProps {
197
191
  /** Back to sign in — the host toggles the pre-auth phase (not a router). */
198
192
  onCancel: () => void;
199
193
  }
200
- declare function HandoffScreen({ code, onAdoptTenant, onSignedIn, onDone, onCancel }: HandoffScreenProps): react_jsx_runtime.JSX.Element;
194
+ declare function HandoffScreen({ code, onSignedIn, onDone, onCancel }: HandoffScreenProps): react_jsx_runtime.JSX.Element;
201
195
 
202
196
  /**
203
197
  * Handoff exchange — the pure, testable half of HandoffScreen (R9B).
204
198
  *
205
199
  * Kept JSX-free in its own module (like R6's runLogoutTeardown) so the
206
- * security-sensitive error mapper and the adopt-before-sign-in ORDERING can be
200
+ * security-sensitive error mapper and the sign-in-before-clear ORDERING can be
207
201
  * node-tested directly, without rendering the RN component.
208
202
  */
209
203
 
210
204
  interface HandoffExchangeDeps {
211
205
  /** Trade the one-time code for a session JWT (host injects core.exchangeHandoff). */
212
206
  exchange: (code: string) => Promise<HandoffExchangeResult>;
213
- /** Adopt the handed-off tenant (host's single tenant writer). */
214
- onAdoptTenant: (tenant: string) => void | Promise<void>;
215
207
  /** Adopt the session JWT. */
216
208
  onSignedIn: (jwt: string) => void | Promise<void>;
217
209
  /** Clear the consumed single-use code. */
218
210
  onDone: () => void;
219
211
  }
220
212
  /**
221
- * Run the handoff: exchange → (adopt tenant) → sign in → clear the code, in that
222
- * exact order. The tenant adoption is AWAITED BEFORE onSignedIn so the host's
223
- * active tenant is set before the session reads it — a cross-tenant handoff must
224
- * never sign in under the wrong tenant. Throws on any failure (the caller maps it
225
- * to a user-facing message); onSignedIn / onDone never run on the error path.
213
+ * Run the handoff: exchange → sign in → clear the code, in that exact order. The
214
+ * handed-off tenant is the JWT's own `tenant` claim (getTenant() reads it), so a
215
+ * cross-tenant handoff is scoped correctly with nothing for the host to store.
216
+ * Throws on any failure (the caller maps it to a user-facing message);
217
+ * onSignedIn / onDone never run on the error path.
226
218
  */
227
219
  declare function runHandoffExchange(code: string, deps: HandoffExchangeDeps): Promise<void>;
228
220
  /**
@@ -236,19 +228,17 @@ declare function runHandoffExchange(code: string, deps: HandoffExchangeDeps): Pr
236
228
  declare function handoffErrorMessage(msg?: string): string;
237
229
 
238
230
  interface OpenJoinScreenProps {
239
- /** Adopt the joined tenant (host's single ACTIVE_TENANT writer), awaited before sign-in. */
240
- onAdoptTenant: (tenant: string) => void | Promise<void>;
241
231
  /** Adopt the session JWT (host: authStore.login → core session + tenantConfirmed). */
242
232
  onSignedIn: (jwt: string) => void | Promise<void>;
243
233
  /** Back to sign in — the host toggles the pre-auth phase (not a router). */
244
234
  onBack: () => void;
245
235
  }
246
- declare function OpenJoinScreen({ onAdoptTenant, onSignedIn, onBack }: OpenJoinScreenProps): react_jsx_runtime.JSX.Element;
236
+ declare function OpenJoinScreen({ onSignedIn, onBack }: OpenJoinScreenProps): react_jsx_runtime.JSX.Element;
247
237
 
248
238
  /**
249
239
  * Open self-signup — the pure, testable half of OpenJoinScreen (R9B).
250
240
  *
251
- * JSX-free so the join ORDERING (join → adopt tenant → sign in) and the error
241
+ * JSX-free so the join ORDERING (join → sign in) and the error
252
242
  * mapper are node-testable without rendering. The native id_token acquisition
253
243
  * happens in the component via getOAuthProvider(); the acquired token is passed
254
244
  * in here, so this module stays pure and provider-free.
@@ -257,8 +247,6 @@ declare function OpenJoinScreen({ onAdoptTenant, onSignedIn, onBack }: OpenJoinS
257
247
  interface OpenJoinDeps {
258
248
  /** Exchange { tenant, id_token } for a session JWT (host injects core.openJoinWith*). */
259
249
  join: (slug: string, idToken: string) => Promise<ConsumerSignInResult>;
260
- /** Adopt the joined tenant (host's single ACTIVE_TENANT writer). */
261
- onAdoptTenant: (tenant: string) => void | Promise<void>;
262
250
  /** Adopt the session JWT. */
263
251
  onSignedIn: (jwt: string) => void | Promise<void>;
264
252
  }
@@ -267,10 +255,10 @@ interface OpenJoinDeps {
267
255
  *
268
256
  * Returns false WITHOUT side effects when idToken is null — the caller acquired
269
257
  * no token (the user cancelled the native sheet, or it returned none), which is
270
- * a silent no-op, never an error. Otherwise: join → adopt the joined tenant →
271
- * sign in, in that order (the tenant is adopted only AFTER the server confirms
272
- * the join, and BEFORE sign-in so the session reads the right tenant). Throws on
273
- * a join failure (the caller maps it to a message); sign-in never runs then.
258
+ * a silent no-op, never an error. Otherwise: join → sign in. The joined tenant
259
+ * is the returned JWT's own `tenant` claim (getTenant() reads it), so there is
260
+ * nothing for the host to store. Throws on a join failure (the caller maps it to
261
+ * a message); sign-in never runs then.
274
262
  */
275
263
  declare function completeOpenJoin(slug: string, idToken: string | null, deps: OpenJoinDeps): Promise<boolean>;
276
264
  /**
@@ -322,18 +310,19 @@ declare function completeInviteJoin(code: string, idToken: string | null, deps:
322
310
  declare function inviteHeadline(preview: InvitePreview | null): string;
323
311
 
324
312
  interface LoginScreenProps {
325
- /** The reactive pre-auth tenant pick (host: useSession().tenant). Re-fetches config on change. */
313
+ /** The reactive pre-auth team (host: useSession().tenant). Re-fetches config on change.
314
+ * '' → the screen asks for the team. */
326
315
  activeTenant: string;
327
- /** The fallback tenant for the consumer-disabled self-heal guard (host: DEFAULT_TENANT). */
328
- defaultTenant: string;
329
- /** Reset to the default tenant + persist + bump activeTenant so this screen refetches. */
316
+ /** The user named a team to sign in to: the host stores it as its signed-out pick. */
317
+ onPickTenant: (tenant: string) => void | Promise<void>;
318
+ /** The team has no consumer sign-in: the host clears its pick (the screen asks for another). */
330
319
  onConsumerDisabled: () => void | Promise<void>;
331
320
  /** Adopt the session JWT (host: authStore.login → core session + tenantConfirmed). */
332
321
  onSignedIn: (jwt: string) => void | Promise<void>;
333
322
  /** Open the host's "join a team by name" (OpenJoin) sub-view. Link hidden when omitted. */
334
323
  onJoinTeam?: () => void;
335
324
  }
336
- declare function LoginScreen({ activeTenant, defaultTenant, onConsumerDisabled, onSignedIn, onJoinTeam }: LoginScreenProps): react_jsx_runtime.JSX.Element;
325
+ declare function LoginScreen({ activeTenant, onPickTenant, onConsumerDisabled, onSignedIn, onJoinTeam }: LoginScreenProps): react_jsx_runtime.JSX.Element;
337
326
 
338
327
  /**
339
328
  * Login — the pure, testable half of LoginScreen (R9B).
@@ -353,12 +342,11 @@ declare function googleClientIds(config: ConsumerCapabilityConfig): {
353
342
  iosClientId: string;
354
343
  };
355
344
  /**
356
- * Whether a failed config fetch should self-heal by falling back to the default
357
- * tenant. A consumer-DISABLED tenant 404s with "capability not enabled"; rather
358
- * than dead-end the user on red text we coerce back to the default and refetch.
359
- * Guarded by currentTenant !== defaultTenant so we never loop on the default.
345
+ * Whether a failed config fetch means the picked tenant has no consumer sign-in
346
+ * ("capability not enabled" 404). The host then clears its pick and shows its
347
+ * team picker — it never falls back to a default tenant.
360
348
  */
361
- declare function shouldRecoverToDefaultTenant(errorMsg: string | undefined, currentTenant: string, defaultTenant: string): boolean;
349
+ declare function isConsumerDisabled(errorMsg: string | undefined): boolean;
362
350
  interface ProviderSignInDeps {
363
351
  /** Trade the provider id_token for a session JWT (host injects core.signInWith*). */
364
352
  exchange: (idToken: string) => Promise<ConsumerSignInResult>;
@@ -545,6 +533,7 @@ declare class VoiceSessionManager implements VoiceSessionProvider {
545
533
  /** Run an authorized device tool. Never throws: every failure is an answer. */
546
534
  private runDeviceTool;
547
535
  private setState;
536
+ private setCallAudio;
548
537
  private appendTranscript;
549
538
  private emit;
550
539
  private waitForConnect;
@@ -606,6 +595,12 @@ interface OAuthProvider {
606
595
  }
607
596
  /** Register a native OAuth implementation (e.g. via @ateam-ai-mobile/expo). */
608
597
  declare function setOAuthProvider(oauth: OAuthProvider | null): void;
598
+ interface CallAudioProvider {
599
+ beginCall(): void;
600
+ endCall(): void;
601
+ }
602
+ /** Register the device's call audio mode (e.g. via @ateam-ai-mobile/expo). */
603
+ declare function setCallAudioProvider(callAudio: CallAudioProvider | null): void;
609
604
  interface ClipboardProvider {
610
605
  setString(text: string): Promise<void>;
611
606
  }
@@ -622,4 +617,4 @@ declare function setUIActionNavigator(navigate: UIActionNavigator | null): void;
622
617
  type ExtraHostsGetter = () => string[];
623
618
  declare function setPluginWebViewExtraHosts(getter: ExtraHostsGetter | null): void;
624
619
 
625
- export { AdasChatScreen, type AdasChatScreenProps, type CallState, ChatInput, type ClipboardProvider, DaySeparator, EmbeddedPluginWebView, type HandoffExchangeDeps, HandoffScreen, type HandoffScreenProps, type InviteJoinDeps, JobProgressBar, JoinScreen, type JoinScreenProps, Lightbox, LoginScreen, type LoginScreenProps, MessageBubble, type OAuthGoogleConfig, type OAuthProvider, type OpenJoinDeps, OpenJoinScreen, type OpenJoinScreenProps, Plugin, PluginSurface, type ProviderSignInDeps, TableCardBlock, TenantPicker, type TenantPickerProps, type TranscriptEntry, TypingIndicator, type UIActionRoute, UIActionsRow, VoiceCallSheet, VoiceMicIndicator, VoiceSessionHost, WidgetHost, WidgetWebView, WorkspaceBanner, type WorkspaceBannerProps, buildPluginBridgeJS, completeInviteJoin, completeOpenJoin, completeProviderSignIn, googleClientIds, handoffErrorMessage, inviteHeadline, openJoinErrorMessage, openWidget, runHandoffExchange, setClipboardProvider, setOAuthProvider, setPluginWebViewExtraHosts, setUIActionNavigator, shouldRecoverToDefaultTenant, useLightboxStore, usePluginBridge, useVoiceCall, useWidgetHostStore, voiceSession };
620
+ export { AdasChatScreen, type AdasChatScreenProps, type CallAudioProvider, type CallState, ChatInput, type ClipboardProvider, DaySeparator, EmbeddedPluginWebView, type HandoffExchangeDeps, HandoffScreen, type HandoffScreenProps, type InviteJoinDeps, JobProgressBar, JoinScreen, type JoinScreenProps, Lightbox, LoginScreen, type LoginScreenProps, MessageBubble, type OAuthGoogleConfig, type OAuthProvider, type OpenJoinDeps, OpenJoinScreen, type OpenJoinScreenProps, Plugin, PluginSurface, type ProviderSignInDeps, TableCardBlock, TenantPicker, type TenantPickerProps, type TranscriptEntry, TypingIndicator, type UIActionRoute, UIActionsRow, VoiceCallSheet, VoiceMicIndicator, VoiceSessionHost, WidgetHost, WidgetWebView, WorkspaceBanner, type WorkspaceBannerProps, buildPluginBridgeJS, completeInviteJoin, completeOpenJoin, completeProviderSignIn, googleClientIds, handoffErrorMessage, inviteHeadline, isConsumerDisabled, openJoinErrorMessage, openWidget, runHandoffExchange, setCallAudioProvider, setClipboardProvider, setOAuthProvider, setPluginWebViewExtraHosts, setUIActionNavigator, useLightboxStore, usePluginBridge, useVoiceCall, useWidgetHostStore, voiceSession };
package/dist/index.js CHANGED
@@ -60,14 +60,15 @@ __export(index_exports, {
60
60
  googleClientIds: () => googleClientIds,
61
61
  handoffErrorMessage: () => handoffErrorMessage,
62
62
  inviteHeadline: () => inviteHeadline,
63
+ isConsumerDisabled: () => isConsumerDisabled,
63
64
  openJoinErrorMessage: () => openJoinErrorMessage,
64
65
  openWidget: () => openWidget,
65
66
  runHandoffExchange: () => runHandoffExchange,
67
+ setCallAudioProvider: () => setCallAudioProvider,
66
68
  setClipboardProvider: () => setClipboardProvider,
67
69
  setOAuthProvider: () => setOAuthProvider,
68
70
  setPluginWebViewExtraHosts: () => setPluginWebViewExtraHosts,
69
71
  setUIActionNavigator: () => setUIActionNavigator,
70
- shouldRecoverToDefaultTenant: () => shouldRecoverToDefaultTenant,
71
72
  useLightboxStore: () => useLightboxStore,
72
73
  usePluginBridge: () => usePluginBridge,
73
74
  useVoiceCall: () => useVoiceCall,
@@ -286,6 +287,13 @@ function setOAuthProvider(oauth) {
286
287
  function getOAuthProvider() {
287
288
  return _oauth;
288
289
  }
290
+ var _callAudio = null;
291
+ function setCallAudioProvider(callAudio) {
292
+ _callAudio = callAudio;
293
+ }
294
+ function getCallAudioProvider() {
295
+ return _callAudio;
296
+ }
289
297
  var _clipboard = null;
290
298
  function setClipboardProvider(clipboard) {
291
299
  _clipboard = clipboard;
@@ -651,6 +659,9 @@ function EmbeddedPluginWebView({ pluginId, manifest, commandBufferRef }) {
651
659
  const tenant = (0, import_core3.getTenant)();
652
660
  const { webViewRef, sendInit, handleMessage } = usePluginBridge(pluginId, manifest._connectorId, commandBufferRef);
653
661
  const url = (0, import_plugin_runtime.resolvePluginUrl)(manifest, tenant || void 0);
662
+ (0, import_react3.useEffect)(() => {
663
+ setError(null);
664
+ }, [url]);
654
665
  const bridgeJS = buildPluginBridgeJS(token || "", tenant || "");
655
666
  const computeAllowedHosts = (0, import_react3.useCallback)(() => {
656
667
  const hosts = /* @__PURE__ */ new Set();
@@ -2234,7 +2245,6 @@ var import_plugin_runtime9 = require("@ateam-ai-mobile/plugin-runtime");
2234
2245
  // src/auth/handoffExchange.ts
2235
2246
  async function runHandoffExchange(code, deps) {
2236
2247
  const res = await deps.exchange(code);
2237
- if (res.tenant) await deps.onAdoptTenant(res.tenant);
2238
2248
  await deps.onSignedIn(res.jwt);
2239
2249
  deps.onDone();
2240
2250
  }
@@ -2249,14 +2259,14 @@ function handoffErrorMessage(msg) {
2249
2259
  // src/auth/HandoffScreen.tsx
2250
2260
  var import_jsx_runtime17 = require("react/jsx-runtime");
2251
2261
  var fontFam7 = import_react_native16.Platform.OS === "ios" ? "SF Pro Rounded" : void 0;
2252
- function HandoffScreen({ code, onAdoptTenant, onSignedIn, onDone, onCancel }) {
2262
+ function HandoffScreen({ code, onSignedIn, onDone, onCancel }) {
2253
2263
  const [err, setErr] = (0, import_react12.useState)(null);
2254
2264
  const startedForRef = (0, import_react12.useRef)(null);
2255
2265
  (0, import_react12.useEffect)(() => {
2256
2266
  if (!code || startedForRef.current === code) return;
2257
2267
  startedForRef.current = code;
2258
- runHandoffExchange(code, { exchange: import_core18.exchangeHandoff, onAdoptTenant, onSignedIn, onDone }).catch((e) => setErr(handoffErrorMessage(e?.message)));
2259
- }, [code, onAdoptTenant, onSignedIn, onDone]);
2268
+ runHandoffExchange(code, { exchange: import_core18.exchangeHandoff, onSignedIn, onDone }).catch((e) => setErr(handoffErrorMessage(e?.message)));
2269
+ }, [code, onSignedIn, onDone]);
2260
2270
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native16.View, { style: styles15.container, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native16.View, { style: styles15.center, children: [
2261
2271
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_plugin_runtime9.AdaOrb, { size: 72, state: err ? "idle" : "thinking" }),
2262
2272
  !err ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
@@ -2288,7 +2298,6 @@ var import_plugin_runtime10 = require("@ateam-ai-mobile/plugin-runtime");
2288
2298
  async function completeOpenJoin(slug, idToken, deps) {
2289
2299
  if (!idToken) return false;
2290
2300
  const consumer = await deps.join(slug, idToken);
2291
- await deps.onAdoptTenant(slug);
2292
2301
  await deps.onSignedIn(consumer.jwt);
2293
2302
  return true;
2294
2303
  }
@@ -2306,7 +2315,7 @@ function openJoinErrorMessage(msg) {
2306
2315
  // src/auth/OpenJoinScreen.tsx
2307
2316
  var import_jsx_runtime18 = require("react/jsx-runtime");
2308
2317
  var fontFam8 = import_react_native17.Platform.OS === "ios" ? "SF Pro Rounded" : void 0;
2309
- function OpenJoinScreen({ onAdoptTenant, onSignedIn, onBack }) {
2318
+ function OpenJoinScreen({ onSignedIn, onBack }) {
2310
2319
  const [team, setTeam] = (0, import_react13.useState)("");
2311
2320
  const [busy, setBusy] = (0, import_react13.useState)(false);
2312
2321
  const [err, setErr] = (0, import_react13.useState)(null);
@@ -2327,7 +2336,7 @@ function OpenJoinScreen({ onAdoptTenant, onSignedIn, onBack }) {
2327
2336
  setBusy(true);
2328
2337
  try {
2329
2338
  const idToken = await acquire(oauth);
2330
- await completeOpenJoin(slug, idToken, { join, onAdoptTenant, onSignedIn });
2339
+ await completeOpenJoin(slug, idToken, { join, onSignedIn });
2331
2340
  } catch (e) {
2332
2341
  setErr(openJoinErrorMessage(e?.message));
2333
2342
  } finally {
@@ -2535,8 +2544,8 @@ function googleClientIds(config) {
2535
2544
  iosClientId: g.ios_client_id || ""
2536
2545
  };
2537
2546
  }
2538
- function shouldRecoverToDefaultTenant(errorMsg, currentTenant, defaultTenant) {
2539
- return /capability not enabled/i.test(errorMsg || "") && currentTenant !== defaultTenant;
2547
+ function isConsumerDisabled(errorMsg) {
2548
+ return /capability not enabled/i.test(errorMsg || "");
2540
2549
  }
2541
2550
  async function completeProviderSignIn(idToken, deps) {
2542
2551
  if (!idToken) return false;
@@ -2548,21 +2557,32 @@ async function completeProviderSignIn(idToken, deps) {
2548
2557
  // src/auth/LoginScreen.tsx
2549
2558
  var import_jsx_runtime20 = require("react/jsx-runtime");
2550
2559
  var fontFam10 = import_react_native19.Platform.OS === "ios" ? "SF Pro Rounded" : void 0;
2551
- function LoginScreen({ activeTenant, defaultTenant, onConsumerDisabled, onSignedIn, onJoinTeam }) {
2560
+ function LoginScreen({ activeTenant, onPickTenant, onConsumerDisabled, onSignedIn, onJoinTeam }) {
2552
2561
  const [config, setConfig] = (0, import_react15.useState)(null);
2553
2562
  const [error, setError] = (0, import_react15.useState)(null);
2563
+ const [disabledTeam, setDisabledTeam] = (0, import_react15.useState)(null);
2564
+ const [askTeam, setAskTeam] = (0, import_react15.useState)(false);
2565
+ const askingTeam = !activeTenant || askTeam;
2566
+ const pick = async (tenant) => {
2567
+ setAskTeam(false);
2568
+ setDisabledTeam(null);
2569
+ await onPickTenant(tenant);
2570
+ };
2554
2571
  (0, import_react15.useEffect)(() => {
2555
2572
  setConfig(null);
2556
2573
  setError(null);
2574
+ if (!activeTenant) return;
2557
2575
  (0, import_core21.fetchConsumerConfig)().then(setConfig).catch(async (err) => {
2558
2576
  const msg = err?.message || "Failed to load sign-in config";
2559
- if (shouldRecoverToDefaultTenant(msg, activeTenant, defaultTenant)) {
2577
+ if (isConsumerDisabled(msg)) {
2578
+ setDisabledTeam(activeTenant);
2579
+ setAskTeam(true);
2560
2580
  await onConsumerDisabled();
2561
2581
  return;
2562
2582
  }
2563
2583
  setError(msg);
2564
2584
  });
2565
- }, [activeTenant, defaultTenant, onConsumerDisabled]);
2585
+ }, [activeTenant, onConsumerDisabled]);
2566
2586
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_native19.View, { style: styles18.container, children: [
2567
2587
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_native19.View, { style: styles18.hero, children: [
2568
2588
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_plugin_runtime12.AdaOrb, { size: 140 }),
@@ -2570,14 +2590,45 @@ function LoginScreen({ activeTenant, defaultTenant, onConsumerDisabled, onSigned
2570
2590
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native19.Text, { style: styles18.tagline, children: "Your private personal AI-Team" })
2571
2591
  ] }),
2572
2592
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_native19.View, { style: styles18.buttonSection, children: [
2573
- !config && !error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native19.ActivityIndicator, { color: import_core21.ada.ink }),
2574
- !!error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native19.Text, { style: styles18.errorText, children: error }),
2575
- !!config && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SignInButtons, { config, onSignedIn }),
2593
+ askingTeam && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TeamField, { notice: disabledTeam, onPick: pick }),
2594
+ !askingTeam && !config && !error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native19.ActivityIndicator, { color: import_core21.ada.ink }),
2595
+ !askingTeam && !!error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native19.Text, { style: styles18.errorText, children: error }),
2596
+ !askingTeam && !!config && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SignInButtons, { config, onSignedIn }),
2597
+ !askingTeam && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native19.Pressable, { onPress: () => setAskTeam(true), hitSlop: 8, style: { paddingVertical: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native19.Text, { style: styles18.joinLink, children: "Use a different team" }) }),
2576
2598
  onJoinTeam && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native19.Pressable, { onPress: onJoinTeam, hitSlop: 8, style: { paddingVertical: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native19.Text, { style: styles18.joinLink, children: "Join a team by name" }) }),
2577
2599
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native19.Text, { style: styles18.disclaimer, children: "By continuing you agree to Ada's Terms and Privacy Policy." })
2578
2600
  ] })
2579
2601
  ] });
2580
2602
  }
2603
+ function TeamField({ notice, onPick }) {
2604
+ const [team, setTeam] = (0, import_react15.useState)("");
2605
+ const slug = team.trim().toLowerCase();
2606
+ const submit = () => {
2607
+ if (slug) void onPick(slug);
2608
+ };
2609
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
2610
+ !!notice && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_native19.Text, { style: styles18.errorText, children: [
2611
+ "\u201C",
2612
+ notice,
2613
+ "\u201D doesn't have app sign-in. Try another team."
2614
+ ] }),
2615
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2616
+ import_react_native19.TextInput,
2617
+ {
2618
+ style: styles18.teamInput,
2619
+ value: team,
2620
+ onChangeText: setTeam,
2621
+ placeholder: "your team (e.g. acme)",
2622
+ placeholderTextColor: import_core21.ada.inkMuted,
2623
+ autoCapitalize: "none",
2624
+ autoCorrect: false,
2625
+ returnKeyType: "go",
2626
+ onSubmitEditing: submit
2627
+ }
2628
+ ),
2629
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native19.Pressable, { style: [styles18.signInBtn, !slug && styles18.signInBtnDisabled], onPress: submit, disabled: !slug, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native19.Text, { style: styles18.signInText, children: "Continue" }) })
2630
+ ] });
2631
+ }
2581
2632
  function SignInButtons({ config, onSignedIn }) {
2582
2633
  const [busy, setBusy] = (0, import_react15.useState)(false);
2583
2634
  const [error, setError] = (0, import_react15.useState)(null);
@@ -2671,6 +2722,17 @@ var styles18 = import_react_native19.StyleSheet.create({
2671
2722
  signInGlyph: { fontSize: 18, fontWeight: "700", color: import_core21.ada.paper, fontFamily: fontFam10 },
2672
2723
  signInText: { fontSize: 16, fontWeight: "600", color: import_core21.ada.paper, letterSpacing: -0.2, fontFamily: fontFam10 },
2673
2724
  appleBtn: { width: "100%", height: 52 },
2725
+ teamInput: {
2726
+ width: "100%",
2727
+ backgroundColor: import_core21.ada.paperSoft,
2728
+ borderWidth: 1,
2729
+ borderColor: import_core21.ada.border,
2730
+ borderRadius: 14,
2731
+ paddingHorizontal: 16,
2732
+ paddingVertical: 14,
2733
+ fontSize: 16,
2734
+ color: import_core21.ada.ink
2735
+ },
2674
2736
  errorText: { fontSize: 13, color: "#c43d3d", textAlign: "center", paddingHorizontal: 16 },
2675
2737
  disclaimer: { fontSize: 12, color: import_core21.ada.inkMuted, textAlign: "center", marginTop: 8, lineHeight: 18, fontFamily: fontFam10 },
2676
2738
  joinLink: { fontSize: 14, fontWeight: "600", color: import_core21.ada.orangeDeep, textAlign: "center", fontFamily: fontFam10 }
@@ -2832,6 +2894,9 @@ function originOf(url) {
2832
2894
  const m = /^([a-z][a-z0-9+.-]*:\/\/[^/?#]+)/i.exec(url);
2833
2895
  return m ? m[1].toLowerCase() : null;
2834
2896
  }
2897
+ function isLiveCall(state) {
2898
+ return state === "connecting" || state === "connected";
2899
+ }
2835
2900
  var IDLE = {
2836
2901
  callState: "idle",
2837
2902
  sessionId: null,
@@ -3286,9 +3351,22 @@ var VoiceSessionManager = class {
3286
3351
  }
3287
3352
  // ── internals ────────────────────────────────────────────────
3288
3353
  setState(partial) {
3354
+ const wasLive = isLiveCall(this.state.callState);
3289
3355
  this.state = { ...this.state, ...partial };
3356
+ const isLive = isLiveCall(this.state.callState);
3357
+ if (wasLive !== isLive) this.setCallAudio(isLive);
3290
3358
  this.emit({ type: "state" });
3291
3359
  }
3360
+ setCallAudio(on) {
3361
+ const audio = getCallAudioProvider();
3362
+ if (!audio) return;
3363
+ try {
3364
+ if (on) audio.beginCall();
3365
+ else audio.endCall();
3366
+ } catch (e) {
3367
+ console.warn("[voiceSession] call audio mode failed:", e?.message || String(e));
3368
+ }
3369
+ }
3292
3370
  appendTranscript(entry) {
3293
3371
  this.state = { ...this.state, transcript: [...this.state.transcript, entry] };
3294
3372
  this.emit({ type: "transcript" });
@@ -3785,14 +3863,15 @@ var styles21 = import_react_native22.StyleSheet.create({
3785
3863
  googleClientIds,
3786
3864
  handoffErrorMessage,
3787
3865
  inviteHeadline,
3866
+ isConsumerDisabled,
3788
3867
  openJoinErrorMessage,
3789
3868
  openWidget,
3790
3869
  runHandoffExchange,
3870
+ setCallAudioProvider,
3791
3871
  setClipboardProvider,
3792
3872
  setOAuthProvider,
3793
3873
  setPluginWebViewExtraHosts,
3794
3874
  setUIActionNavigator,
3795
- shouldRecoverToDefaultTenant,
3796
3875
  useLightboxStore,
3797
3876
  usePluginBridge,
3798
3877
  useVoiceCall,