@ateam-ai-mobile/ui 0.1.9 → 0.1.10
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 +24 -36
- package/dist/index.d.ts +24 -36
- package/dist/index.js +71 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +103 -49
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/auth/HandoffScreen.tsx +3 -11
- package/src/auth/LoginScreen.tsx +68 -17
- package/src/auth/OpenJoinScreen.tsx +4 -6
- package/src/auth/handoffExchange.ts +6 -9
- package/src/auth/login.ts +5 -10
- package/src/auth/openJoin.ts +5 -8
- package/src/index.ts +1 -1
- package/src/plugin/EmbeddedPluginWebView.tsx +4 -1
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,
|
|
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
|
|
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 →
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
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({
|
|
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 →
|
|
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 →
|
|
271
|
-
*
|
|
272
|
-
* the
|
|
273
|
-
* a
|
|
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
|
|
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
|
|
328
|
-
|
|
329
|
-
/**
|
|
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,
|
|
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
|
|
357
|
-
*
|
|
358
|
-
*
|
|
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
|
|
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>;
|
|
@@ -622,4 +610,4 @@ declare function setUIActionNavigator(navigate: UIActionNavigator | null): void;
|
|
|
622
610
|
type ExtraHostsGetter = () => string[];
|
|
623
611
|
declare function setPluginWebViewExtraHosts(getter: ExtraHostsGetter | null): void;
|
|
624
612
|
|
|
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,
|
|
613
|
+
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, isConsumerDisabled, openJoinErrorMessage, openWidget, runHandoffExchange, 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,
|
|
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
|
|
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 →
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
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({
|
|
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 →
|
|
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 →
|
|
271
|
-
*
|
|
272
|
-
* the
|
|
273
|
-
* a
|
|
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
|
|
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
|
|
328
|
-
|
|
329
|
-
/**
|
|
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,
|
|
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
|
|
357
|
-
*
|
|
358
|
-
*
|
|
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
|
|
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>;
|
|
@@ -622,4 +610,4 @@ declare function setUIActionNavigator(navigate: UIActionNavigator | null): void;
|
|
|
622
610
|
type ExtraHostsGetter = () => string[];
|
|
623
611
|
declare function setPluginWebViewExtraHosts(getter: ExtraHostsGetter | null): void;
|
|
624
612
|
|
|
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,
|
|
613
|
+
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, isConsumerDisabled, openJoinErrorMessage, openWidget, runHandoffExchange, setClipboardProvider, setOAuthProvider, setPluginWebViewExtraHosts, setUIActionNavigator, useLightboxStore, usePluginBridge, useVoiceCall, useWidgetHostStore, voiceSession };
|
package/dist/index.js
CHANGED
|
@@ -60,6 +60,7 @@ __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,7 +68,6 @@ __export(index_exports, {
|
|
|
67
68
|
setOAuthProvider: () => setOAuthProvider,
|
|
68
69
|
setPluginWebViewExtraHosts: () => setPluginWebViewExtraHosts,
|
|
69
70
|
setUIActionNavigator: () => setUIActionNavigator,
|
|
70
|
-
shouldRecoverToDefaultTenant: () => shouldRecoverToDefaultTenant,
|
|
71
71
|
useLightboxStore: () => useLightboxStore,
|
|
72
72
|
usePluginBridge: () => usePluginBridge,
|
|
73
73
|
useVoiceCall: () => useVoiceCall,
|
|
@@ -651,6 +651,9 @@ function EmbeddedPluginWebView({ pluginId, manifest, commandBufferRef }) {
|
|
|
651
651
|
const tenant = (0, import_core3.getTenant)();
|
|
652
652
|
const { webViewRef, sendInit, handleMessage } = usePluginBridge(pluginId, manifest._connectorId, commandBufferRef);
|
|
653
653
|
const url = (0, import_plugin_runtime.resolvePluginUrl)(manifest, tenant || void 0);
|
|
654
|
+
(0, import_react3.useEffect)(() => {
|
|
655
|
+
setError(null);
|
|
656
|
+
}, [url]);
|
|
654
657
|
const bridgeJS = buildPluginBridgeJS(token || "", tenant || "");
|
|
655
658
|
const computeAllowedHosts = (0, import_react3.useCallback)(() => {
|
|
656
659
|
const hosts = /* @__PURE__ */ new Set();
|
|
@@ -2234,7 +2237,6 @@ var import_plugin_runtime9 = require("@ateam-ai-mobile/plugin-runtime");
|
|
|
2234
2237
|
// src/auth/handoffExchange.ts
|
|
2235
2238
|
async function runHandoffExchange(code, deps) {
|
|
2236
2239
|
const res = await deps.exchange(code);
|
|
2237
|
-
if (res.tenant) await deps.onAdoptTenant(res.tenant);
|
|
2238
2240
|
await deps.onSignedIn(res.jwt);
|
|
2239
2241
|
deps.onDone();
|
|
2240
2242
|
}
|
|
@@ -2249,14 +2251,14 @@ function handoffErrorMessage(msg) {
|
|
|
2249
2251
|
// src/auth/HandoffScreen.tsx
|
|
2250
2252
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2251
2253
|
var fontFam7 = import_react_native16.Platform.OS === "ios" ? "SF Pro Rounded" : void 0;
|
|
2252
|
-
function HandoffScreen({ code,
|
|
2254
|
+
function HandoffScreen({ code, onSignedIn, onDone, onCancel }) {
|
|
2253
2255
|
const [err, setErr] = (0, import_react12.useState)(null);
|
|
2254
2256
|
const startedForRef = (0, import_react12.useRef)(null);
|
|
2255
2257
|
(0, import_react12.useEffect)(() => {
|
|
2256
2258
|
if (!code || startedForRef.current === code) return;
|
|
2257
2259
|
startedForRef.current = code;
|
|
2258
|
-
runHandoffExchange(code, { exchange: import_core18.exchangeHandoff,
|
|
2259
|
-
}, [code,
|
|
2260
|
+
runHandoffExchange(code, { exchange: import_core18.exchangeHandoff, onSignedIn, onDone }).catch((e) => setErr(handoffErrorMessage(e?.message)));
|
|
2261
|
+
}, [code, onSignedIn, onDone]);
|
|
2260
2262
|
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
2263
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_plugin_runtime9.AdaOrb, { size: 72, state: err ? "idle" : "thinking" }),
|
|
2262
2264
|
!err ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
@@ -2288,7 +2290,6 @@ var import_plugin_runtime10 = require("@ateam-ai-mobile/plugin-runtime");
|
|
|
2288
2290
|
async function completeOpenJoin(slug, idToken, deps) {
|
|
2289
2291
|
if (!idToken) return false;
|
|
2290
2292
|
const consumer = await deps.join(slug, idToken);
|
|
2291
|
-
await deps.onAdoptTenant(slug);
|
|
2292
2293
|
await deps.onSignedIn(consumer.jwt);
|
|
2293
2294
|
return true;
|
|
2294
2295
|
}
|
|
@@ -2306,7 +2307,7 @@ function openJoinErrorMessage(msg) {
|
|
|
2306
2307
|
// src/auth/OpenJoinScreen.tsx
|
|
2307
2308
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2308
2309
|
var fontFam8 = import_react_native17.Platform.OS === "ios" ? "SF Pro Rounded" : void 0;
|
|
2309
|
-
function OpenJoinScreen({
|
|
2310
|
+
function OpenJoinScreen({ onSignedIn, onBack }) {
|
|
2310
2311
|
const [team, setTeam] = (0, import_react13.useState)("");
|
|
2311
2312
|
const [busy, setBusy] = (0, import_react13.useState)(false);
|
|
2312
2313
|
const [err, setErr] = (0, import_react13.useState)(null);
|
|
@@ -2327,7 +2328,7 @@ function OpenJoinScreen({ onAdoptTenant, onSignedIn, onBack }) {
|
|
|
2327
2328
|
setBusy(true);
|
|
2328
2329
|
try {
|
|
2329
2330
|
const idToken = await acquire(oauth);
|
|
2330
|
-
await completeOpenJoin(slug, idToken, { join,
|
|
2331
|
+
await completeOpenJoin(slug, idToken, { join, onSignedIn });
|
|
2331
2332
|
} catch (e) {
|
|
2332
2333
|
setErr(openJoinErrorMessage(e?.message));
|
|
2333
2334
|
} finally {
|
|
@@ -2535,8 +2536,8 @@ function googleClientIds(config) {
|
|
|
2535
2536
|
iosClientId: g.ios_client_id || ""
|
|
2536
2537
|
};
|
|
2537
2538
|
}
|
|
2538
|
-
function
|
|
2539
|
-
return /capability not enabled/i.test(errorMsg || "")
|
|
2539
|
+
function isConsumerDisabled(errorMsg) {
|
|
2540
|
+
return /capability not enabled/i.test(errorMsg || "");
|
|
2540
2541
|
}
|
|
2541
2542
|
async function completeProviderSignIn(idToken, deps) {
|
|
2542
2543
|
if (!idToken) return false;
|
|
@@ -2548,21 +2549,32 @@ async function completeProviderSignIn(idToken, deps) {
|
|
|
2548
2549
|
// src/auth/LoginScreen.tsx
|
|
2549
2550
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2550
2551
|
var fontFam10 = import_react_native19.Platform.OS === "ios" ? "SF Pro Rounded" : void 0;
|
|
2551
|
-
function LoginScreen({ activeTenant,
|
|
2552
|
+
function LoginScreen({ activeTenant, onPickTenant, onConsumerDisabled, onSignedIn, onJoinTeam }) {
|
|
2552
2553
|
const [config, setConfig] = (0, import_react15.useState)(null);
|
|
2553
2554
|
const [error, setError] = (0, import_react15.useState)(null);
|
|
2555
|
+
const [disabledTeam, setDisabledTeam] = (0, import_react15.useState)(null);
|
|
2556
|
+
const [askTeam, setAskTeam] = (0, import_react15.useState)(false);
|
|
2557
|
+
const askingTeam = !activeTenant || askTeam;
|
|
2558
|
+
const pick = async (tenant) => {
|
|
2559
|
+
setAskTeam(false);
|
|
2560
|
+
setDisabledTeam(null);
|
|
2561
|
+
await onPickTenant(tenant);
|
|
2562
|
+
};
|
|
2554
2563
|
(0, import_react15.useEffect)(() => {
|
|
2555
2564
|
setConfig(null);
|
|
2556
2565
|
setError(null);
|
|
2566
|
+
if (!activeTenant) return;
|
|
2557
2567
|
(0, import_core21.fetchConsumerConfig)().then(setConfig).catch(async (err) => {
|
|
2558
2568
|
const msg = err?.message || "Failed to load sign-in config";
|
|
2559
|
-
if (
|
|
2569
|
+
if (isConsumerDisabled(msg)) {
|
|
2570
|
+
setDisabledTeam(activeTenant);
|
|
2571
|
+
setAskTeam(true);
|
|
2560
2572
|
await onConsumerDisabled();
|
|
2561
2573
|
return;
|
|
2562
2574
|
}
|
|
2563
2575
|
setError(msg);
|
|
2564
2576
|
});
|
|
2565
|
-
}, [activeTenant,
|
|
2577
|
+
}, [activeTenant, onConsumerDisabled]);
|
|
2566
2578
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_native19.View, { style: styles18.container, children: [
|
|
2567
2579
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_native19.View, { style: styles18.hero, children: [
|
|
2568
2580
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_plugin_runtime12.AdaOrb, { size: 140 }),
|
|
@@ -2570,14 +2582,45 @@ function LoginScreen({ activeTenant, defaultTenant, onConsumerDisabled, onSigned
|
|
|
2570
2582
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native19.Text, { style: styles18.tagline, children: "Your private personal AI-Team" })
|
|
2571
2583
|
] }),
|
|
2572
2584
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_native19.View, { style: styles18.buttonSection, children: [
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
!!
|
|
2585
|
+
askingTeam && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TeamField, { notice: disabledTeam, onPick: pick }),
|
|
2586
|
+
!askingTeam && !config && !error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native19.ActivityIndicator, { color: import_core21.ada.ink }),
|
|
2587
|
+
!askingTeam && !!error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native19.Text, { style: styles18.errorText, children: error }),
|
|
2588
|
+
!askingTeam && !!config && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SignInButtons, { config, onSignedIn }),
|
|
2589
|
+
!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
2590
|
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
2591
|
/* @__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
2592
|
] })
|
|
2579
2593
|
] });
|
|
2580
2594
|
}
|
|
2595
|
+
function TeamField({ notice, onPick }) {
|
|
2596
|
+
const [team, setTeam] = (0, import_react15.useState)("");
|
|
2597
|
+
const slug = team.trim().toLowerCase();
|
|
2598
|
+
const submit = () => {
|
|
2599
|
+
if (slug) void onPick(slug);
|
|
2600
|
+
};
|
|
2601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2602
|
+
!!notice && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_native19.Text, { style: styles18.errorText, children: [
|
|
2603
|
+
"\u201C",
|
|
2604
|
+
notice,
|
|
2605
|
+
"\u201D doesn't have app sign-in. Try another team."
|
|
2606
|
+
] }),
|
|
2607
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2608
|
+
import_react_native19.TextInput,
|
|
2609
|
+
{
|
|
2610
|
+
style: styles18.teamInput,
|
|
2611
|
+
value: team,
|
|
2612
|
+
onChangeText: setTeam,
|
|
2613
|
+
placeholder: "your team (e.g. acme)",
|
|
2614
|
+
placeholderTextColor: import_core21.ada.inkMuted,
|
|
2615
|
+
autoCapitalize: "none",
|
|
2616
|
+
autoCorrect: false,
|
|
2617
|
+
returnKeyType: "go",
|
|
2618
|
+
onSubmitEditing: submit
|
|
2619
|
+
}
|
|
2620
|
+
),
|
|
2621
|
+
/* @__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" }) })
|
|
2622
|
+
] });
|
|
2623
|
+
}
|
|
2581
2624
|
function SignInButtons({ config, onSignedIn }) {
|
|
2582
2625
|
const [busy, setBusy] = (0, import_react15.useState)(false);
|
|
2583
2626
|
const [error, setError] = (0, import_react15.useState)(null);
|
|
@@ -2671,6 +2714,17 @@ var styles18 = import_react_native19.StyleSheet.create({
|
|
|
2671
2714
|
signInGlyph: { fontSize: 18, fontWeight: "700", color: import_core21.ada.paper, fontFamily: fontFam10 },
|
|
2672
2715
|
signInText: { fontSize: 16, fontWeight: "600", color: import_core21.ada.paper, letterSpacing: -0.2, fontFamily: fontFam10 },
|
|
2673
2716
|
appleBtn: { width: "100%", height: 52 },
|
|
2717
|
+
teamInput: {
|
|
2718
|
+
width: "100%",
|
|
2719
|
+
backgroundColor: import_core21.ada.paperSoft,
|
|
2720
|
+
borderWidth: 1,
|
|
2721
|
+
borderColor: import_core21.ada.border,
|
|
2722
|
+
borderRadius: 14,
|
|
2723
|
+
paddingHorizontal: 16,
|
|
2724
|
+
paddingVertical: 14,
|
|
2725
|
+
fontSize: 16,
|
|
2726
|
+
color: import_core21.ada.ink
|
|
2727
|
+
},
|
|
2674
2728
|
errorText: { fontSize: 13, color: "#c43d3d", textAlign: "center", paddingHorizontal: 16 },
|
|
2675
2729
|
disclaimer: { fontSize: 12, color: import_core21.ada.inkMuted, textAlign: "center", marginTop: 8, lineHeight: 18, fontFamily: fontFam10 },
|
|
2676
2730
|
joinLink: { fontSize: 14, fontWeight: "600", color: import_core21.ada.orangeDeep, textAlign: "center", fontFamily: fontFam10 }
|
|
@@ -3785,6 +3839,7 @@ var styles21 = import_react_native22.StyleSheet.create({
|
|
|
3785
3839
|
googleClientIds,
|
|
3786
3840
|
handoffErrorMessage,
|
|
3787
3841
|
inviteHeadline,
|
|
3842
|
+
isConsumerDisabled,
|
|
3788
3843
|
openJoinErrorMessage,
|
|
3789
3844
|
openWidget,
|
|
3790
3845
|
runHandoffExchange,
|
|
@@ -3792,7 +3847,6 @@ var styles21 = import_react_native22.StyleSheet.create({
|
|
|
3792
3847
|
setOAuthProvider,
|
|
3793
3848
|
setPluginWebViewExtraHosts,
|
|
3794
3849
|
setUIActionNavigator,
|
|
3795
|
-
shouldRecoverToDefaultTenant,
|
|
3796
3850
|
useLightboxStore,
|
|
3797
3851
|
usePluginBridge,
|
|
3798
3852
|
useVoiceCall,
|