@docyrus/signin 0.14.1 → 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 +250 -0
- package/dist/{constants-DDOgvbL5.d.ts → constants-BhPyFHNf.d.ts} +33 -1
- package/dist/core-index.d.ts +4 -95
- package/dist/core-index.js +305 -1
- package/dist/core-index.js.map +1 -1
- package/dist/index.d.ts +47 -6
- package/dist/index.js +369 -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 +344 -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-o9nPwayd.d.ts → use-docyrus-client-BfbEowBC.d.ts} +1 -1
- package/dist/vue/index.d.ts +9 -3
- package/dist/vue/index.js +328 -1
- package/dist/vue/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/types-D4ZAVj-B.d.ts +0 -337
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()
|
|
@@ -350,10 +529,21 @@ const {
|
|
|
350
529
|
onHostNotification, // (handler) => () => void — subscribe to host notification messages (iframe mode)
|
|
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)
|
|
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)
|
|
353
538
|
error // Error | null
|
|
354
539
|
} = useDocyrusAuth();
|
|
355
540
|
```
|
|
356
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
|
+
|
|
357
547
|
### useDocyrusHostNavigation() / useDocyrusHostNotification()
|
|
358
548
|
|
|
359
549
|
React-only convenience hooks for subscribing to host postMessage events
|
|
@@ -512,6 +702,10 @@ that the embedded app can subscribe to:
|
|
|
512
702
|
| `{ type: 'navigation', url }` | `url: string` | Host asks the app to navigate (e.g. deep-link from a host menu) |
|
|
513
703
|
| `{ type: 'notification', notification }` | `DocyrusNotification` | Host pushes a notification to the embedded app |
|
|
514
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
|
+
|
|
515
709
|
**React** — register handlers with the provided hooks (latest closure is
|
|
516
710
|
always invoked, no need to memoize):
|
|
517
711
|
|
|
@@ -626,6 +820,62 @@ function RouteReporter() {
|
|
|
626
820
|
|
|
627
821
|
All three are no-ops outside iframe/WebView mode.
|
|
628
822
|
|
|
823
|
+
#### App → Host navigation request
|
|
824
|
+
|
|
825
|
+
The host can ask the app to navigate (`{ type: 'navigation' }`, above). The
|
|
826
|
+
reverse direction lets the embedded app ask the **host shell** to navigate —
|
|
827
|
+
for example, a button inside the app that should deep-link the host, switch the
|
|
828
|
+
host view, or open a sibling app. The app posts:
|
|
829
|
+
|
|
830
|
+
```
|
|
831
|
+
App → Host: { type: 'navigation-request', url, replace?, newTab? }
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
The host decides how to honour the request (push/replace its own router, open a
|
|
835
|
+
new tab, etc.). Unlike `route-change` — which passively reports where the app
|
|
836
|
+
already is — this is an explicit request to move the host.
|
|
837
|
+
|
|
838
|
+
**React** — call `requestHostNavigation` from `useDocyrusAuth()`, or use the
|
|
839
|
+
`useDocyrusRequestHostNavigation` convenience hook:
|
|
840
|
+
|
|
841
|
+
```tsx
|
|
842
|
+
import { useDocyrusRequestHostNavigation } from '@docyrus/signin';
|
|
843
|
+
|
|
844
|
+
function OpenSettingsButton() {
|
|
845
|
+
const requestHostNavigation = useDocyrusRequestHostNavigation();
|
|
846
|
+
|
|
847
|
+
return (
|
|
848
|
+
<button onClick={() => requestHostNavigation('/settings/billing')}>
|
|
849
|
+
Go to billing
|
|
850
|
+
</button>
|
|
851
|
+
);
|
|
852
|
+
}
|
|
853
|
+
```
|
|
854
|
+
|
|
855
|
+
```tsx
|
|
856
|
+
// With options
|
|
857
|
+
const { requestHostNavigation } = useDocyrusAuth();
|
|
858
|
+
|
|
859
|
+
requestHostNavigation('/reports/q3', { replace: true });
|
|
860
|
+
requestHostNavigation('https://docs.docyrus.com', { newTab: true });
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
**Vue** — call `requestHostNavigation` from the composable:
|
|
864
|
+
|
|
865
|
+
```vue
|
|
866
|
+
<script setup lang="ts">
|
|
867
|
+
import { getDocyrusAuth } from '@docyrus/signin/vue';
|
|
868
|
+
|
|
869
|
+
const auth = getDocyrusAuth();
|
|
870
|
+
|
|
871
|
+
function goToBilling() {
|
|
872
|
+
auth.requestHostNavigation('/settings/billing');
|
|
873
|
+
}
|
|
874
|
+
</script>
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
No-op outside iframe/WebView mode.
|
|
878
|
+
|
|
629
879
|
## SSR Support (Next.js)
|
|
630
880
|
|
|
631
881
|
Enable `ssr` on the client-side provider to sync the access token to a cookie. The cookie is written with `max-age` (matching the token lifetime) and `Secure` flag (on HTTPS origins) automatically.
|
|
@@ -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. */
|
|
@@ -82,6 +83,37 @@ declare class AuthManager {
|
|
|
82
83
|
* iframe mode.
|
|
83
84
|
*/
|
|
84
85
|
notifyHostRouteChange(payload?: RouteChangePayload): void;
|
|
86
|
+
/**
|
|
87
|
+
* Iframe/WebView mode: ask the host shell to navigate to a path/URL.
|
|
88
|
+
* Posts a `navigation-request` message; the host decides how to honour it.
|
|
89
|
+
* No-op outside iframe mode.
|
|
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;
|
|
85
117
|
/**
|
|
86
118
|
* Subscribe to host `navigation` messages. Returns an unsubscribe function.
|
|
87
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,97 +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
|
-
*
|
|
72
|
-
* Every incoming message's event.origin is validated against
|
|
73
|
-
* the allowed host pattern before processing.
|
|
74
|
-
* In WebView mode, origin validation is skipped (ReactNativeWebView bridge).
|
|
75
|
-
*/
|
|
76
|
-
declare class IframeAuth {
|
|
77
|
-
private allowedOrigins;
|
|
78
|
-
private allowedPattern;
|
|
79
|
-
private isWebView;
|
|
80
|
-
private onTokensReceived;
|
|
81
|
-
private navigationHandlers;
|
|
82
|
-
private notificationHandlers;
|
|
83
|
-
private guidyHandlers;
|
|
84
|
-
private routeSyncEnabled;
|
|
85
|
-
private originalPushState;
|
|
86
|
-
private originalReplaceState;
|
|
87
|
-
private routeChangeListener;
|
|
88
|
-
private stopped;
|
|
89
|
-
private refreshPromise;
|
|
90
|
-
private messageHandler;
|
|
91
|
-
constructor(allowedOrigins?: string[], allowedPattern?: RegExp);
|
|
92
|
-
/**
|
|
93
|
-
* Start listening for postMessage events from the host.
|
|
94
|
-
* The callback is invoked every time valid tokens are received.
|
|
95
|
-
*/
|
|
96
|
-
start(onTokensReceived: IframeAuthCallback): void;
|
|
97
|
-
/** Stop listening for postMessage events. */
|
|
98
|
-
stop(): void;
|
|
99
|
-
/**
|
|
100
|
-
* Patch history methods + listen for popstate/hashchange so every
|
|
101
|
-
* route change posts a `route-change` message to the host.
|
|
102
|
-
* Idempotent. Fires an immediate message with the current route.
|
|
103
|
-
*/
|
|
104
|
-
enableRouteSync(): void;
|
|
105
|
-
/**
|
|
106
|
-
* Post a single `route-change` message. With no argument, reads
|
|
107
|
-
* `window.location`. Pass a payload from a router subscription to
|
|
108
|
-
* report a known route instead.
|
|
109
|
-
*/
|
|
110
|
-
notifyRouteChange(payload?: RouteChangePayload): void;
|
|
111
|
-
private teardownRouteSync;
|
|
112
|
-
/**
|
|
113
|
-
* Subscribe to host navigation messages.
|
|
114
|
-
* Returns an unsubscribe function.
|
|
115
|
-
*/
|
|
116
|
-
onNavigation(handler: HostNavigationHandler): () => void;
|
|
117
|
-
/**
|
|
118
|
-
* Subscribe to host notification messages.
|
|
119
|
-
* Returns an unsubscribe function.
|
|
120
|
-
*/
|
|
121
|
-
onNotification(handler: HostNotificationHandler): () => void;
|
|
122
|
-
/**
|
|
123
|
-
* Subscribe to host `guidy:*` command messages (point/scan).
|
|
124
|
-
* Returns an unsubscribe function. Used by the Guidy bridge runtime.
|
|
125
|
-
*/
|
|
126
|
-
onGuidyCommand(handler: GuidyCommandHandler): () => void;
|
|
127
|
-
/**
|
|
128
|
-
* Post an app → host message over the same validated channel used for
|
|
129
|
-
* route-change and token-refresh. Used by the Guidy bridge to push its
|
|
130
|
-
* element inventory and point acknowledgements.
|
|
131
|
-
*/
|
|
132
|
-
sendToHost(message: AppToHostMessage): void;
|
|
133
|
-
/**
|
|
134
|
-
* Request fresh tokens from the host.
|
|
135
|
-
* Posts a "token-refresh-request" to the host, then waits for
|
|
136
|
-
* a "signin" response.
|
|
137
|
-
*
|
|
138
|
-
* Only one refresh request can be in-flight at a time.
|
|
139
|
-
* Additional callers share the same promise.
|
|
140
|
-
*/
|
|
141
|
-
requestTokenRefresh(): Promise<OAuth2Tokens>;
|
|
142
|
-
private isOriginAllowed;
|
|
143
|
-
private handleMessage;
|
|
144
|
-
private handleGuidyCommand;
|
|
145
|
-
private handleSignin;
|
|
146
|
-
private handleNavigation;
|
|
147
|
-
private handleNotification;
|
|
148
|
-
private rejectPendingRefresh;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
60
|
/** Post an app → host message (elements, routes, or a point ack). */
|
|
152
61
|
type GuidyBridgeSender = (message: GuidyElementsMessage | GuidyRoutesMessage | GuidyPointAckMessage) => void;
|
|
153
62
|
/**
|
|
@@ -212,4 +121,4 @@ declare class GuidyBridge {
|
|
|
212
121
|
*/
|
|
213
122
|
declare function detectAuthMode(allowedOrigins?: string[], allowedPattern?: RegExp): AuthMode;
|
|
214
123
|
|
|
215
|
-
export { AuthMode, DocyrusAuthConfig, GuidyBridge,
|
|
124
|
+
export { AuthMode, DocyrusAuthConfig, GuidyBridge, GuidyCommandMessage, GuidyElementsMessage, GuidyPointAckMessage, GuidyRoute, GuidyRoutesMessage, StandaloneOAuth2Auth, detectAuthMode };
|