@docyrus/signin 0.13.0 → 0.14.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 +37 -1
- package/dist/{constants-BBGO2aU5.d.ts → constants-DtyJKJgJ.d.ts} +6 -1
- package/dist/core-index.d.ts +13 -8
- package/dist/core-index.js +26 -2
- package/dist/core-index.js.map +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.js +40 -3
- package/dist/index.js.map +1 -1
- package/dist/react-native/index.d.ts +4 -4
- package/dist/react-native/index.js +33 -2
- package/dist/react-native/index.js.map +1 -1
- package/dist/{types-WOgdg9b0.d.ts → types-D4ZAVj-B.d.ts} +36 -2
- package/dist/{use-docyrus-client-DqdJWKrF.d.ts → use-docyrus-client-o9nPwayd.d.ts} +1 -1
- package/dist/vue/index.d.ts +2 -2
- package/dist/vue/index.js +26 -2
- package/dist/vue/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -73,6 +73,14 @@ interface DocyrusAuthConfig {
|
|
|
73
73
|
* the host. No-op outside iframe mode. Default: false.
|
|
74
74
|
*/
|
|
75
75
|
enableGuidyBridge?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Iframe mode: routes the host assistant (Guidy) may navigate the user to
|
|
78
|
+
* inside this app. The host turns each into a deep link it can drive via the
|
|
79
|
+
* existing host→app `navigation` message. Update at runtime with
|
|
80
|
+
* `setGuidyRoutes` (e.g. when routes depend on permissions). Requires
|
|
81
|
+
* `enableGuidyBridge`. Default: none.
|
|
82
|
+
*/
|
|
83
|
+
guidyRoutes?: GuidyRoute[];
|
|
76
84
|
/** React Native: custom URI scheme redirect (e.g., 'myapp://auth/callback'). Required when forceMode is 'react-native' */
|
|
77
85
|
nativeRedirectUri?: string;
|
|
78
86
|
/** React Native: function to open an in-app browser auth session (e.g., WebBrowser.openAuthSessionAsync from expo-web-browser) */
|
|
@@ -130,6 +138,12 @@ interface DocyrusAuthContextValue {
|
|
|
130
138
|
* subscriptions). No-op in non-iframe modes.
|
|
131
139
|
*/
|
|
132
140
|
notifyRouteChange: (payload?: RouteChangePayload) => void;
|
|
141
|
+
/**
|
|
142
|
+
* Iframe mode (Guidy bridge): replace the routes the host assistant may
|
|
143
|
+
* navigate the user to inside this app. No-op unless `enableGuidyBridge`
|
|
144
|
+
* is set. Use for routes that depend on runtime state (e.g. permissions).
|
|
145
|
+
*/
|
|
146
|
+
setGuidyRoutes: (routes: GuidyRoute[]) => void;
|
|
133
147
|
/** Any error that occurred during auth */
|
|
134
148
|
error: Error | null;
|
|
135
149
|
}
|
|
@@ -220,6 +234,26 @@ interface GuidyElementsMessage {
|
|
|
220
234
|
path: string;
|
|
221
235
|
elements: GuidyElement[];
|
|
222
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* A navigable route the host assistant (Guidy) can send the user to. Unlike
|
|
239
|
+
* elements, routes cannot be auto-discovered from the DOM, so the app declares
|
|
240
|
+
* them (via `guidyRoutes` / `setGuidyRoutes`). The host turns these into deep
|
|
241
|
+
* links it can drive through the existing host→app `navigation` message.
|
|
242
|
+
*/
|
|
243
|
+
interface GuidyRoute {
|
|
244
|
+
/** App-internal path, e.g. `/leads` or `leads/new`. */
|
|
245
|
+
path: string;
|
|
246
|
+
/** Human-readable label, e.g. `Leads`. */
|
|
247
|
+
label: string;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* App → Host: the embedded app's declared navigable routes.
|
|
251
|
+
* Pushed on start and whenever the app updates its route catalog.
|
|
252
|
+
*/
|
|
253
|
+
interface GuidyRoutesMessage {
|
|
254
|
+
type: 'guidy:routes';
|
|
255
|
+
routes: GuidyRoute[];
|
|
256
|
+
}
|
|
223
257
|
/**
|
|
224
258
|
* Host → App: scroll to, highlight, and optionally annotate/click an element.
|
|
225
259
|
* The app renders the highlight/annotation itself — the host cannot draw into
|
|
@@ -254,7 +288,7 @@ interface GuidyPointAckMessage {
|
|
|
254
288
|
type GuidyCommandMessage = GuidyPointMessage | GuidyScanMessage;
|
|
255
289
|
/** Handler invoked when the host sends a Guidy command. */
|
|
256
290
|
type GuidyCommandHandler = (message: GuidyCommandMessage) => void;
|
|
257
|
-
type AppToHostMessage = TokenRefreshRequestMessage | AppRouteChangeMessage | GuidyElementsMessage | GuidyPointAckMessage;
|
|
291
|
+
type AppToHostMessage = TokenRefreshRequestMessage | AppRouteChangeMessage | GuidyElementsMessage | GuidyRoutesMessage | GuidyPointAckMessage;
|
|
258
292
|
/** Handler invoked when the host sends a navigation message */
|
|
259
293
|
type HostNavigationHandler = (message: HostNavigationMessage) => void;
|
|
260
294
|
/** Handler invoked when the host sends a notification message */
|
|
@@ -300,4 +334,4 @@ interface PermissionConfig {
|
|
|
300
334
|
alwaysPermittedDataSources?: Record<string, AclOperation[]>;
|
|
301
335
|
}
|
|
302
336
|
|
|
303
|
-
export type { AclOperation as A, DocyrusAuthConfig as D,
|
|
337
|
+
export type { AclOperation as A, DocyrusAuthConfig as D, GuidyRoute as G, HostNavigationHandler as H, OpenAuthSessionFn as O, PermissionConfig as P, RouteChangePayload as R, TokenRefreshRequestMessage as T, AuthMode as a, AuthSessionResult as b, AuthStatus as c, DocyrusAclRule as d, DocyrusAuthContextValue as e, DocyrusRole as f, DocyrusUser as g, HostNotificationHandler as h, AppRouteChangeMessage as i, DocyrusNotification as j, GuidyCommandHandler as k, GuidyCommandMessage as l, GuidyElement as m, GuidyElementsMessage as n, GuidyPointAckMessage as o, GuidyPointMessage as p, GuidyRoutesMessage as q, GuidyScanMessage as r, HostNavigationMessage as s, HostNotificationMessage as t, HostSignInMessage as u, AppToHostMessage as v };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { D as DocyrusAuthConfig, e as DocyrusAuthContextValue } from './types-
|
|
3
|
+
import { D as DocyrusAuthConfig, e as DocyrusAuthContextValue } from './types-D4ZAVj-B.js';
|
|
4
4
|
import { RestApiClient } from '@docyrus/api-client';
|
|
5
5
|
|
|
6
6
|
interface DocyrusAuthProviderProps extends DocyrusAuthConfig {
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { PropType } from 'vue';
|
|
3
3
|
import { OAuth2TokenStorage, OAuth2Tokens, RestApiClient } from '@docyrus/api-client';
|
|
4
|
-
import { a as AuthMode, c as AuthStatus, H as HostNavigationHandler, h as HostNotificationHandler, R as RouteChangePayload } from '../types-
|
|
5
|
-
export { D as DocyrusAuthConfig } from '../types-
|
|
4
|
+
import { a as AuthMode, c as AuthStatus, H as HostNavigationHandler, h as HostNotificationHandler, R as RouteChangePayload } from '../types-D4ZAVj-B.js';
|
|
5
|
+
export { D as DocyrusAuthConfig } from '../types-D4ZAVj-B.js';
|
|
6
6
|
|
|
7
7
|
interface DocyrusAuthState {
|
|
8
8
|
status: AuthStatus;
|
package/dist/vue/index.js
CHANGED
|
@@ -449,6 +449,7 @@ function isVisible(node) {
|
|
|
449
449
|
}
|
|
450
450
|
var GuidyBridge = class {
|
|
451
451
|
send;
|
|
452
|
+
routes;
|
|
452
453
|
started = false;
|
|
453
454
|
observer = null;
|
|
454
455
|
scanTimer = null;
|
|
@@ -456,8 +457,14 @@ var GuidyBridge = class {
|
|
|
456
457
|
highlightTimer = null;
|
|
457
458
|
clickTimer = null;
|
|
458
459
|
annotationTimer = null;
|
|
459
|
-
constructor(send) {
|
|
460
|
+
constructor(send, routes = []) {
|
|
460
461
|
this.send = send;
|
|
462
|
+
this.routes = routes;
|
|
463
|
+
}
|
|
464
|
+
/** Replace the declared navigable routes and re-post them to the host. */
|
|
465
|
+
setRoutes(routes) {
|
|
466
|
+
this.routes = routes;
|
|
467
|
+
this.postRoutes();
|
|
461
468
|
}
|
|
462
469
|
/**
|
|
463
470
|
* Begin reporting the element inventory and watching for changes.
|
|
@@ -468,6 +475,7 @@ var GuidyBridge = class {
|
|
|
468
475
|
this.started = true;
|
|
469
476
|
this.ensureStyle();
|
|
470
477
|
this.postElements();
|
|
478
|
+
this.postRoutes();
|
|
471
479
|
this.observer = new MutationObserver(() => this.scheduleScan());
|
|
472
480
|
this.observer.observe(document.body, {
|
|
473
481
|
childList: true,
|
|
@@ -507,6 +515,7 @@ var GuidyBridge = class {
|
|
|
507
515
|
handleCommand(message) {
|
|
508
516
|
if (message.type === "guidy:scan") {
|
|
509
517
|
this.postElements();
|
|
518
|
+
this.postRoutes();
|
|
510
519
|
return;
|
|
511
520
|
}
|
|
512
521
|
if (message.type === "guidy:point") {
|
|
@@ -543,6 +552,10 @@ var GuidyBridge = class {
|
|
|
543
552
|
elements: this.collectElements()
|
|
544
553
|
});
|
|
545
554
|
}
|
|
555
|
+
postRoutes() {
|
|
556
|
+
if (!this.started) return;
|
|
557
|
+
this.send({ type: "guidy:routes", routes: this.routes });
|
|
558
|
+
}
|
|
546
559
|
scheduleScan() {
|
|
547
560
|
if (this.scanTimer) return;
|
|
548
561
|
this.scanTimer = setTimeout(() => {
|
|
@@ -992,11 +1005,22 @@ var AuthManager = class {
|
|
|
992
1005
|
*/
|
|
993
1006
|
startGuidyBridge() {
|
|
994
1007
|
if (!this.iframeAuth || this.guidyBridge) return;
|
|
995
|
-
const bridge = new GuidyBridge(
|
|
1008
|
+
const bridge = new GuidyBridge(
|
|
1009
|
+
(message) => this.iframeAuth?.sendToHost(message),
|
|
1010
|
+
this.config.guidyRoutes ?? []
|
|
1011
|
+
);
|
|
996
1012
|
this.iframeAuth.onGuidyCommand((message) => bridge.handleCommand(message));
|
|
997
1013
|
bridge.start();
|
|
998
1014
|
this.guidyBridge = bridge;
|
|
999
1015
|
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Iframe mode: replace the routes the Guidy bridge advertises to the host.
|
|
1018
|
+
* No-op unless the bridge is running (`enableGuidyBridge`).
|
|
1019
|
+
*/
|
|
1020
|
+
setGuidyRoutes(routes) {
|
|
1021
|
+
this.config.guidyRoutes = routes;
|
|
1022
|
+
this.guidyBridge?.setRoutes(routes);
|
|
1023
|
+
}
|
|
1000
1024
|
/**
|
|
1001
1025
|
* Iframe/WebView mode: start auto-syncing the embedded app's route
|
|
1002
1026
|
* to the host. Patches history methods and listens for popstate /
|