@docyrus/signin 0.15.0 → 0.16.0
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 +193 -0
- package/dist/{constants-BoAqIz2O.d.ts → constants-BhPyFHNf.d.ts} +27 -1
- package/dist/core-index.d.ts +4 -102
- package/dist/core-index.js +284 -1
- package/dist/core-index.js.map +1 -1
- package/dist/index.d.ts +41 -6
- package/dist/index.js +337 -1
- package/dist/index.js.map +1 -1
- package/dist/nextjs/index.js.map +1 -1
- package/dist/react-native/index.d.ts +4 -4
- package/dist/react-native/index.js +316 -0
- package/dist/react-native/index.js.map +1 -1
- package/dist/types-C_i-KhUS.d.ts +773 -0
- package/dist/{use-docyrus-client-pU5z5ZHe.d.ts → use-docyrus-client-BfbEowBC.d.ts} +1 -1
- package/dist/vue/index.d.ts +8 -3
- package/dist/vue/index.js +303 -1
- package/dist/vue/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/types-DzwC4Dk7.d.ts +0 -367
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@ Supports **React**, **Vue**, **React Native**, **Electron**, and **Next.js SSR**
|
|
|
10
10
|
- **OAuth2 PKCE**: Full Authorization Code flow with PKCE (S256) for standalone apps
|
|
11
11
|
- **Iframe Auth**: Receives tokens via `postMessage` from `*.docyrus.app` hosts
|
|
12
12
|
- **Host Message Hooks**: Subscribe to `navigation` and `notification` messages pushed by the host into the embedded app
|
|
13
|
+
- **App → Host Actions**: Send to Docy, Send to Chat, Send to Email, and Send to Calendar — hand `text`/`adaptiveCard`/email/event payloads to host surfaces, with a `Promise` that resolves on the host's delivery acknowledgement
|
|
14
|
+
- **Microsoft Graph Bridge**: Make **proxy-only** Microsoft Graph calls through the host's logged-in MSAL session (the access token never crosses the frame boundary)
|
|
13
15
|
- **Route Sync**: Mirror the embedded app's route to the host so the host can reflect it in its address bar
|
|
14
16
|
- **Token Auto-Refresh**: Proactive token refresh before expiry in both modes (opt out with `autoRefresh: false` when an external system owns the token lifecycle)
|
|
15
17
|
- **Token Bootstrap**: Start a session from existing access/refresh tokens (e.g. device flow handoff)
|
|
@@ -326,6 +328,183 @@ Driving a route requires the app to handle inbound host navigation — wire
|
|
|
326
328
|
router. `path` is app-internal (e.g. `/leads`); the host prefixes it with the
|
|
327
329
|
app's mount path.
|
|
328
330
|
|
|
331
|
+
## App → Host actions
|
|
332
|
+
|
|
333
|
+
Embedded apps can also **initiate** actions against host surfaces — Send to Docy,
|
|
334
|
+
Send to Chat, Send to Email, Send to Calendar, and host-proxied Microsoft Graph.
|
|
335
|
+
Unlike the Guidy bridge (host-driven, opt-in consent), these are app-driven — no
|
|
336
|
+
config flag is needed; the host decides whether to honour each request. They all
|
|
337
|
+
ride the same origin-validated postMessage channel and use a request/response
|
|
338
|
+
correlation (a `requestId` the host echoes back), so the calls are `Promise`s
|
|
339
|
+
that resolve on the host's reply and reject on error or timeout. Available in
|
|
340
|
+
iframe/WebView mode only (outside it, the `sendTo*` methods reject and `msGraph`
|
|
341
|
+
is `null`).
|
|
342
|
+
|
|
343
|
+
### Send to Docy / Send to Chat
|
|
344
|
+
|
|
345
|
+
Hand a payload to the host AI assistant (**Docy**) or the host **team-chat** app —
|
|
346
|
+
for "Send to Docy" / "Send to Chat" buttons and menu items. Two payload kinds:
|
|
347
|
+
`text` and `adaptiveCard`.
|
|
348
|
+
|
|
349
|
+
```tsx
|
|
350
|
+
import { useDocyrusSendToDocy, useDocyrusSendToChat } from '@docyrus/signin';
|
|
351
|
+
|
|
352
|
+
function ShareButtons({ record }) {
|
|
353
|
+
const sendToDocy = useDocyrusSendToDocy();
|
|
354
|
+
const sendToChat = useDocyrusSendToChat();
|
|
355
|
+
|
|
356
|
+
return (
|
|
357
|
+
<>
|
|
358
|
+
<button onClick={() => sendToDocy({ kind: 'text', text: `Summarize ${record.name}` })}>
|
|
359
|
+
Send to Docy
|
|
360
|
+
</button>
|
|
361
|
+
<button
|
|
362
|
+
onClick={() =>
|
|
363
|
+
sendToChat({
|
|
364
|
+
kind: 'adaptiveCard',
|
|
365
|
+
card: { type: 'AdaptiveCard', version: '1.5', body: [/* … */] },
|
|
366
|
+
fallbackText: record.name
|
|
367
|
+
})
|
|
368
|
+
}
|
|
369
|
+
>
|
|
370
|
+
Send to Chat
|
|
371
|
+
</button>
|
|
372
|
+
</>
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Both resolve when the host acknowledges delivery, so you can show loading /
|
|
378
|
+
success / error UI:
|
|
379
|
+
|
|
380
|
+
```tsx
|
|
381
|
+
try {
|
|
382
|
+
await sendToDocy({ kind: 'text', text, title });
|
|
383
|
+
toast.success('Sent to Docy');
|
|
384
|
+
} catch (err) {
|
|
385
|
+
toast.error(err.message); // host rejected or timed out
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
```text
|
|
390
|
+
App → Host: { type: 'docy:send', requestId, payload } // payload: { kind: 'text' | 'adaptiveCard', … }
|
|
391
|
+
Host → App: { type: 'docy:send-ack', requestId, ok, error? }
|
|
392
|
+
App → Host: { type: 'chat:send', requestId, payload }
|
|
393
|
+
Host → App: { type: 'chat:send-ack', requestId, ok, error? }
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Send to Email / Send to Calendar
|
|
397
|
+
|
|
398
|
+
Hand a draft **email** or a **calendar event** to the host — for "Send to Email" /
|
|
399
|
+
"Send to Calendar" buttons and menu items. Both resolve when the host
|
|
400
|
+
acknowledges, so you can show loading / success / error UI.
|
|
401
|
+
|
|
402
|
+
```tsx
|
|
403
|
+
import { useDocyrusSendToEmail, useDocyrusSendToCalendar } from '@docyrus/signin';
|
|
404
|
+
|
|
405
|
+
function RecordActions({ record }) {
|
|
406
|
+
const sendToEmail = useDocyrusSendToEmail();
|
|
407
|
+
const sendToCalendar = useDocyrusSendToCalendar();
|
|
408
|
+
|
|
409
|
+
return (
|
|
410
|
+
<>
|
|
411
|
+
<button
|
|
412
|
+
onClick={() =>
|
|
413
|
+
sendToEmail({
|
|
414
|
+
to: record.ownerEmail, // string | string[]
|
|
415
|
+
cc: ['team@acme.com'],
|
|
416
|
+
subject: `Re: ${record.name}`,
|
|
417
|
+
body: 'Following up on this record.'
|
|
418
|
+
})
|
|
419
|
+
}
|
|
420
|
+
>
|
|
421
|
+
Send to Email
|
|
422
|
+
</button>
|
|
423
|
+
<button
|
|
424
|
+
onClick={() =>
|
|
425
|
+
sendToCalendar({
|
|
426
|
+
subject: `Review: ${record.name}`,
|
|
427
|
+
description: 'Kickoff review',
|
|
428
|
+
participants: record.ownerEmail, // string | string[]
|
|
429
|
+
start: '2026-07-20T09:00:00Z', // ISO 8601
|
|
430
|
+
end: '2026-07-20T09:30:00Z'
|
|
431
|
+
})
|
|
432
|
+
}
|
|
433
|
+
>
|
|
434
|
+
Send to Calendar
|
|
435
|
+
</button>
|
|
436
|
+
</>
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
`sendToEmail` payload: `{ to, subject, body, cc? }` (`to`/`cc` accept a string
|
|
442
|
+
or string array). `sendToCalendar` payload: `{ subject, start, end,
|
|
443
|
+
description?, participants? }` — `start`/`end` are ISO 8601 datetime strings.
|
|
444
|
+
|
|
445
|
+
```text
|
|
446
|
+
App → Host: { type: 'email:send', requestId, payload } // { to, subject, body, cc? }
|
|
447
|
+
Host → App: { type: 'email:send-ack', requestId, ok, error? }
|
|
448
|
+
App → Host: { type: 'calendar:send', requestId, payload } // { subject, description?, participants?, start, end }
|
|
449
|
+
Host → App: { type: 'calendar:send-ack', requestId, ok, error? }
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### Microsoft Graph (host MSAL) bridge
|
|
453
|
+
|
|
454
|
+
If the host is signed into Microsoft via MSAL, an embedded app can make Graph
|
|
455
|
+
calls **through the host**. This is **proxy-only**: the app sends
|
|
456
|
+
`{ method, path, body }`, the host acquires the token via MSAL, performs the
|
|
457
|
+
`graph.microsoft.com` request, and returns only `{ ok, status, data }`. **The
|
|
458
|
+
MSAL access token never crosses the frame boundary** — the app cannot read it.
|
|
459
|
+
|
|
460
|
+
```tsx
|
|
461
|
+
import { useDocyrusMsGraph } from '@docyrus/signin';
|
|
462
|
+
|
|
463
|
+
function GraphPanel() {
|
|
464
|
+
const graph = useDocyrusMsGraph(); // MsGraphClient | null (null outside iframe mode)
|
|
465
|
+
|
|
466
|
+
async function load() {
|
|
467
|
+
if (!graph) return;
|
|
468
|
+
|
|
469
|
+
if (!(await graph.isSignedIn())) {
|
|
470
|
+
// host has no MSAL session — prompt the user in the host, or hide the feature
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
const me = await graph.getMe(); // GET /me
|
|
475
|
+
const msgs = await graph.get('/me/messages?$top=5');
|
|
476
|
+
|
|
477
|
+
if (me.ok) console.log(me.data);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
return <button onClick={load} disabled={!graph}>Load from Microsoft</button>;
|
|
481
|
+
}
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
`MsGraphClient` methods: `status()`, `isSignedIn()`, `request(req)`,
|
|
485
|
+
`get(path, opts?)`, `post(path, body?, opts?)`, `patch(...)`, `put(...)`,
|
|
486
|
+
`delete(...)`, `getMe()`. A completed Graph call resolves even on a non-2xx —
|
|
487
|
+
inspect `ok` / `status` / `data`; the Promise only rejects when the host could
|
|
488
|
+
not perform the request at all (e.g. no MSAL session, timeout).
|
|
489
|
+
|
|
490
|
+
```text
|
|
491
|
+
App → Host: { type: 'msgraph:status-request', requestId }
|
|
492
|
+
Host → App: { type: 'msgraph:status-response', requestId, signedIn, account?, error? }
|
|
493
|
+
App → Host: { type: 'msgraph:request', requestId, request: { method?, path, headers?, body?, scopes? } }
|
|
494
|
+
Host → App: { type: 'msgraph:response', requestId, ok, status, data?, error? }
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
> The host implements the listeners for these messages (in its
|
|
498
|
+
> `ExternalAppManager`), importing the exported message/payload types from
|
|
499
|
+
> `@docyrus/signin` to stay in lockstep. It should allowlist which Graph paths
|
|
500
|
+
> embedded apps may reach. See the
|
|
501
|
+
> **[Host App Integration Guide](../../docs/signin-host-app-integration.md)**
|
|
502
|
+
> for the full host-side contract, a reference `ExternalAppManager`, and the
|
|
503
|
+
> MSAL proxy implementation.
|
|
504
|
+
|
|
505
|
+
**Vue** — the same capabilities are on `getDocyrusAuth()`:
|
|
506
|
+
`sendToDocy`, `sendToChat`, `sendToEmail`, `sendToCalendar`, and `msGraph`.
|
|
507
|
+
|
|
329
508
|
## Hooks / Composables
|
|
330
509
|
|
|
331
510
|
### useDocyrusAuth()
|
|
@@ -351,10 +530,20 @@ const {
|
|
|
351
530
|
enableHostRouteSync, // () => void — patch history + fire `route-change` on every change (iframe mode)
|
|
352
531
|
notifyRouteChange, // (payload?) => void — post a single `route-change` to the host (iframe mode)
|
|
353
532
|
requestHostNavigation, // (url, options?) => void — ask the host shell to navigate (iframe mode)
|
|
533
|
+
sendToDocy, // (payload) => Promise<void> — hand a payload to the host AI assistant (iframe mode)
|
|
534
|
+
sendToChat, // (payload) => Promise<void> — hand a payload to the host team-chat app (iframe mode)
|
|
535
|
+
sendToEmail, // (payload) => Promise<void> — hand a draft email to the host (iframe mode)
|
|
536
|
+
sendToCalendar, // (payload) => Promise<void> — hand a calendar event to the host (iframe mode)
|
|
537
|
+
msGraph, // MsGraphClient | null — host-proxied Microsoft Graph client (iframe mode)
|
|
354
538
|
error // Error | null
|
|
355
539
|
} = useDocyrusAuth();
|
|
356
540
|
```
|
|
357
541
|
|
|
542
|
+
### useDocyrusSendToDocy() / useDocyrusSendToChat() / useDocyrusSendToEmail() / useDocyrusSendToCalendar() / useDocyrusMsGraph()
|
|
543
|
+
|
|
544
|
+
React-only convenience hooks for the app→host actions above. See
|
|
545
|
+
[App → Host actions](#app--host-actions).
|
|
546
|
+
|
|
358
547
|
### useDocyrusHostNavigation() / useDocyrusHostNotification()
|
|
359
548
|
|
|
360
549
|
React-only convenience hooks for subscribing to host postMessage events
|
|
@@ -513,6 +702,10 @@ that the embedded app can subscribe to:
|
|
|
513
702
|
| `{ type: 'navigation', url }` | `url: string` | Host asks the app to navigate (e.g. deep-link from a host menu) |
|
|
514
703
|
| `{ type: 'notification', notification }` | `DocyrusNotification` | Host pushes a notification to the embedded app |
|
|
515
704
|
|
|
705
|
+
The embedded app can also **initiate** app→host actions over the same channel —
|
|
706
|
+
Send to Docy, Send to Chat, and host-proxied Microsoft Graph calls. See
|
|
707
|
+
[App → Host actions](#app--host-actions).
|
|
708
|
+
|
|
516
709
|
**React** — register handlers with the provided hooks (latest closure is
|
|
517
710
|
always invoked, no need to memoize):
|
|
518
711
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, RestApiClient } from '@docyrus/api-client';
|
|
2
|
-
import { D as DocyrusAuthConfig,
|
|
2
|
+
import { D as DocyrusAuthConfig, b as AuthMode, d as AuthStatus, m as DocyrusUser, G as GuidyRoute, R as RouteChangePayload, t as HostNavigationRequestOptions, k as DocyrusSharePayload, h as DocyrusEmailPayload, g as DocyrusCalendarEventPayload, n as MsGraphClient, H as HostNavigationHandler, s as HostNotificationHandler, i as DocyrusRole, P as PermissionConfig } from './types-C_i-KhUS.js';
|
|
3
3
|
|
|
4
4
|
type AuthStateListener = (state: {
|
|
5
5
|
status: AuthStatus;
|
|
@@ -22,6 +22,7 @@ declare class AuthManager {
|
|
|
22
22
|
private standaloneAuth;
|
|
23
23
|
private iframeAuth;
|
|
24
24
|
private guidyBridge;
|
|
25
|
+
private msGraphClient;
|
|
25
26
|
private reactNativeAuth;
|
|
26
27
|
private tokenRefreshTimer;
|
|
27
28
|
/** Shared in-flight refresh, so concurrent requests don't trigger parallel refreshes. */
|
|
@@ -88,6 +89,31 @@ declare class AuthManager {
|
|
|
88
89
|
* No-op outside iframe mode.
|
|
89
90
|
*/
|
|
90
91
|
requestHostNavigation(url: string, options?: HostNavigationRequestOptions): void;
|
|
92
|
+
/**
|
|
93
|
+
* Iframe/WebView mode: hand a payload to the host AI assistant (Docy).
|
|
94
|
+
* Resolves when the host acknowledges delivery. Rejects outside iframe mode.
|
|
95
|
+
*/
|
|
96
|
+
sendToDocy(payload: DocyrusSharePayload): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Iframe/WebView mode: hand a payload to the host team-chat app.
|
|
99
|
+
* Resolves when the host acknowledges delivery. Rejects outside iframe mode.
|
|
100
|
+
*/
|
|
101
|
+
sendToChat(payload: DocyrusSharePayload): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Iframe/WebView mode: hand a draft email to the host. Resolves when the
|
|
104
|
+
* host acknowledges. Rejects outside iframe mode.
|
|
105
|
+
*/
|
|
106
|
+
sendToEmail(payload: DocyrusEmailPayload): Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Iframe/WebView mode: hand a calendar event to the host. Resolves when the
|
|
109
|
+
* host acknowledges. Rejects outside iframe mode.
|
|
110
|
+
*/
|
|
111
|
+
sendToCalendar(payload: DocyrusCalendarEventPayload): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Iframe/WebView mode: get the client for the host's Microsoft Graph (MSAL)
|
|
114
|
+
* session. Returns `null` outside iframe mode.
|
|
115
|
+
*/
|
|
116
|
+
getMsGraphClient(): MsGraphClient | null;
|
|
91
117
|
/**
|
|
92
118
|
* Subscribe to host `navigation` messages. Returns an unsubscribe function.
|
|
93
119
|
* Handlers registered before iframe mode is initialized are retained and
|
package/dist/core-index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { A as AuthManager, e as AuthStateListener, D as DEFAULT_API_URL, c as DEFAULT_CALLBACK_PATH, a as DEFAULT_OAUTH_SCOPES, g as getAllRoles, h as hasPermission, b as hasRole } from './constants-
|
|
1
|
+
export { A as AuthManager, e as AuthStateListener, D as DEFAULT_API_URL, c as DEFAULT_CALLBACK_PATH, a as DEFAULT_OAUTH_SCOPES, g as getAllRoles, h as hasPermission, b as hasRole } from './constants-BhPyFHNf.js';
|
|
2
2
|
import { OAuth2Tokens } from '@docyrus/api-client';
|
|
3
|
-
import { D as DocyrusAuthConfig,
|
|
4
|
-
export { A as AclOperation,
|
|
3
|
+
import { D as DocyrusAuthConfig, N as GuidyElementsMessage, T as GuidyRoutesMessage, Q as GuidyPointAckMessage, G as GuidyRoute, K as GuidyCommandMessage, b as AuthMode } from './types-C_i-KhUS.js';
|
|
4
|
+
export { A as AclOperation, a as AdaptiveCard, u as AppNavigationRequestMessage, v as AppRouteChangeMessage, d as AuthStatus, C as CalendarSendAckMessage, w as CalendarSendMessage, x as ChatSendAckMessage, y as ChatSendMessage, z as DocySendAckMessage, B as DocySendMessage, e as DocyrusAclRule, f as DocyrusAuthContextValue, g as DocyrusCalendarEventPayload, h as DocyrusEmailPayload, E as DocyrusNotification, i as DocyrusRole, j as DocyrusShareAdaptiveCardPayload, k as DocyrusSharePayload, l as DocyrusShareTextPayload, m as DocyrusUser, F as EmailSendAckMessage, I as EmailSendMessage, J as GuidyCommandHandler, L as GuidyElement, S as GuidyPointMessage, U as GuidyScanMessage, H as HostNavigationHandler, V as HostNavigationMessage, t as HostNavigationRequestOptions, s as HostNotificationHandler, W as HostNotificationMessage, X as HostSignInMessage, Y as IframeAuth, M as MsGraphAccount, n as MsGraphClient, o as MsGraphRequest, Z as MsGraphRequestMessage, p as MsGraphRequestOptions, q as MsGraphResponse, _ as MsGraphResponseMessage, r as MsGraphStatus, $ as MsGraphStatusRequestMessage, a0 as MsGraphStatusResponseMessage, P as PermissionConfig, R as RouteChangePayload, a1 as TokenRefreshRequestMessage } from './types-C_i-KhUS.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Standalone OAuth2 authorization code flow with PKCE via page redirect.
|
|
@@ -57,104 +57,6 @@ declare class StandaloneOAuth2Auth {
|
|
|
57
57
|
logout(): Promise<void>;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
type IframeAuthCallback = (tokens: OAuth2Tokens) => void;
|
|
61
|
-
/**
|
|
62
|
-
* Iframe / WebView authentication via postMessage.
|
|
63
|
-
*
|
|
64
|
-
* Protocol:
|
|
65
|
-
* - App → Host: { type: "signin-ready" } (on start)
|
|
66
|
-
* - Host → App: { type: "signin", accessToken, refreshToken }
|
|
67
|
-
* - App → Host: { type: "token-refresh-request" }
|
|
68
|
-
* - Host → App: { type: "navigation", url }
|
|
69
|
-
* - Host → App: { type: "notification", notification }
|
|
70
|
-
* - App → Host: { type: "route-change", path, search, hash, url }
|
|
71
|
-
* - App → Host: { type: "navigation-request", url, replace?, newTab? }
|
|
72
|
-
*
|
|
73
|
-
* Every incoming message's event.origin is validated against
|
|
74
|
-
* the allowed host pattern before processing.
|
|
75
|
-
* In WebView mode, origin validation is skipped (ReactNativeWebView bridge).
|
|
76
|
-
*/
|
|
77
|
-
declare class IframeAuth {
|
|
78
|
-
private allowedOrigins;
|
|
79
|
-
private allowedPattern;
|
|
80
|
-
private isWebView;
|
|
81
|
-
private onTokensReceived;
|
|
82
|
-
private navigationHandlers;
|
|
83
|
-
private notificationHandlers;
|
|
84
|
-
private guidyHandlers;
|
|
85
|
-
private routeSyncEnabled;
|
|
86
|
-
private originalPushState;
|
|
87
|
-
private originalReplaceState;
|
|
88
|
-
private routeChangeListener;
|
|
89
|
-
private stopped;
|
|
90
|
-
private refreshPromise;
|
|
91
|
-
private messageHandler;
|
|
92
|
-
constructor(allowedOrigins?: string[], allowedPattern?: RegExp);
|
|
93
|
-
/**
|
|
94
|
-
* Start listening for postMessage events from the host.
|
|
95
|
-
* The callback is invoked every time valid tokens are received.
|
|
96
|
-
*/
|
|
97
|
-
start(onTokensReceived: IframeAuthCallback): void;
|
|
98
|
-
/** Stop listening for postMessage events. */
|
|
99
|
-
stop(): void;
|
|
100
|
-
/**
|
|
101
|
-
* Patch history methods + listen for popstate/hashchange so every
|
|
102
|
-
* route change posts a `route-change` message to the host.
|
|
103
|
-
* Idempotent. Fires an immediate message with the current route.
|
|
104
|
-
*/
|
|
105
|
-
enableRouteSync(): void;
|
|
106
|
-
/**
|
|
107
|
-
* Post a single `route-change` message. With no argument, reads
|
|
108
|
-
* `window.location`. Pass a payload from a router subscription to
|
|
109
|
-
* report a known route instead.
|
|
110
|
-
*/
|
|
111
|
-
notifyRouteChange(payload?: RouteChangePayload): void;
|
|
112
|
-
/**
|
|
113
|
-
* Ask the host shell to navigate to a path/URL. The reverse of the
|
|
114
|
-
* host → app `navigation` message: posts a `navigation-request` over the
|
|
115
|
-
* same validated channel. The host decides how to honour it.
|
|
116
|
-
*/
|
|
117
|
-
requestHostNavigation(url: string, options?: HostNavigationRequestOptions): void;
|
|
118
|
-
private teardownRouteSync;
|
|
119
|
-
/**
|
|
120
|
-
* Subscribe to host navigation messages.
|
|
121
|
-
* Returns an unsubscribe function.
|
|
122
|
-
*/
|
|
123
|
-
onNavigation(handler: HostNavigationHandler): () => void;
|
|
124
|
-
/**
|
|
125
|
-
* Subscribe to host notification messages.
|
|
126
|
-
* Returns an unsubscribe function.
|
|
127
|
-
*/
|
|
128
|
-
onNotification(handler: HostNotificationHandler): () => void;
|
|
129
|
-
/**
|
|
130
|
-
* Subscribe to host `guidy:*` command messages (point/scan).
|
|
131
|
-
* Returns an unsubscribe function. Used by the Guidy bridge runtime.
|
|
132
|
-
*/
|
|
133
|
-
onGuidyCommand(handler: GuidyCommandHandler): () => void;
|
|
134
|
-
/**
|
|
135
|
-
* Post an app → host message over the same validated channel used for
|
|
136
|
-
* route-change and token-refresh. Used by the Guidy bridge to push its
|
|
137
|
-
* element inventory and point acknowledgements.
|
|
138
|
-
*/
|
|
139
|
-
sendToHost(message: AppToHostMessage): void;
|
|
140
|
-
/**
|
|
141
|
-
* Request fresh tokens from the host.
|
|
142
|
-
* Posts a "token-refresh-request" to the host, then waits for
|
|
143
|
-
* a "signin" response.
|
|
144
|
-
*
|
|
145
|
-
* Only one refresh request can be in-flight at a time.
|
|
146
|
-
* Additional callers share the same promise.
|
|
147
|
-
*/
|
|
148
|
-
requestTokenRefresh(): Promise<OAuth2Tokens>;
|
|
149
|
-
private isOriginAllowed;
|
|
150
|
-
private handleMessage;
|
|
151
|
-
private handleGuidyCommand;
|
|
152
|
-
private handleSignin;
|
|
153
|
-
private handleNavigation;
|
|
154
|
-
private handleNotification;
|
|
155
|
-
private rejectPendingRefresh;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
60
|
/** Post an app → host message (elements, routes, or a point ack). */
|
|
159
61
|
type GuidyBridgeSender = (message: GuidyElementsMessage | GuidyRoutesMessage | GuidyPointAckMessage) => void;
|
|
160
62
|
/**
|
|
@@ -219,4 +121,4 @@ declare class GuidyBridge {
|
|
|
219
121
|
*/
|
|
220
122
|
declare function detectAuthMode(allowedOrigins?: string[], allowedPattern?: RegExp): AuthMode;
|
|
221
123
|
|
|
222
|
-
export { AuthMode, DocyrusAuthConfig, GuidyBridge,
|
|
124
|
+
export { AuthMode, DocyrusAuthConfig, GuidyBridge, GuidyCommandMessage, GuidyElementsMessage, GuidyPointAckMessage, GuidyRoute, GuidyRoutesMessage, StandaloneOAuth2Auth, detectAuthMode };
|