@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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { OAuth2Tokens } from '@docyrus/api-client';
|
|
2
|
-
import { D as DocyrusAuthConfig } from '../types-
|
|
3
|
-
export { A as AclOperation, a as AuthMode, b as AuthSessionResult, c as AuthStatus, d as DocyrusAclRule, e as DocyrusAuthContextValue, f as DocyrusRole, g as DocyrusUser, O as OpenAuthSessionFn, P as PermissionConfig } from '../types-
|
|
4
|
-
export { D as DocyrusAuthContext, a as DocyrusAuthProvider, b as DocyrusAuthProviderProps, u as useDocyrusAuth, c as useDocyrusClient } from '../use-docyrus-client-
|
|
5
|
-
export { A as AuthManager, D as DEFAULT_API_URL, a as DEFAULT_OAUTH_SCOPES, g as getAllRoles, h as hasPermission, b as hasRole } from '../constants-
|
|
2
|
+
import { D as DocyrusAuthConfig } from '../types-D4ZAVj-B.js';
|
|
3
|
+
export { A as AclOperation, a as AuthMode, b as AuthSessionResult, c as AuthStatus, d as DocyrusAclRule, e as DocyrusAuthContextValue, f as DocyrusRole, g as DocyrusUser, O as OpenAuthSessionFn, P as PermissionConfig } from '../types-D4ZAVj-B.js';
|
|
4
|
+
export { D as DocyrusAuthContext, a as DocyrusAuthProvider, b as DocyrusAuthProviderProps, u as useDocyrusAuth, c as useDocyrusClient } from '../use-docyrus-client-o9nPwayd.js';
|
|
5
|
+
export { A as AuthManager, D as DEFAULT_API_URL, a as DEFAULT_OAUTH_SCOPES, g as getAllRoles, h as hasPermission, b as hasRole } from '../constants-DtyJKJgJ.js';
|
|
6
6
|
import 'react';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -528,6 +528,7 @@ function isVisible(node) {
|
|
|
528
528
|
}
|
|
529
529
|
var GuidyBridge = class {
|
|
530
530
|
send;
|
|
531
|
+
routes;
|
|
531
532
|
started = false;
|
|
532
533
|
observer = null;
|
|
533
534
|
scanTimer = null;
|
|
@@ -535,8 +536,14 @@ var GuidyBridge = class {
|
|
|
535
536
|
highlightTimer = null;
|
|
536
537
|
clickTimer = null;
|
|
537
538
|
annotationTimer = null;
|
|
538
|
-
constructor(send) {
|
|
539
|
+
constructor(send, routes = []) {
|
|
539
540
|
this.send = send;
|
|
541
|
+
this.routes = routes;
|
|
542
|
+
}
|
|
543
|
+
/** Replace the declared navigable routes and re-post them to the host. */
|
|
544
|
+
setRoutes(routes) {
|
|
545
|
+
this.routes = routes;
|
|
546
|
+
this.postRoutes();
|
|
540
547
|
}
|
|
541
548
|
/**
|
|
542
549
|
* Begin reporting the element inventory and watching for changes.
|
|
@@ -547,6 +554,7 @@ var GuidyBridge = class {
|
|
|
547
554
|
this.started = true;
|
|
548
555
|
this.ensureStyle();
|
|
549
556
|
this.postElements();
|
|
557
|
+
this.postRoutes();
|
|
550
558
|
this.observer = new MutationObserver(() => this.scheduleScan());
|
|
551
559
|
this.observer.observe(document.body, {
|
|
552
560
|
childList: true,
|
|
@@ -586,6 +594,7 @@ var GuidyBridge = class {
|
|
|
586
594
|
handleCommand(message) {
|
|
587
595
|
if (message.type === "guidy:scan") {
|
|
588
596
|
this.postElements();
|
|
597
|
+
this.postRoutes();
|
|
589
598
|
return;
|
|
590
599
|
}
|
|
591
600
|
if (message.type === "guidy:point") {
|
|
@@ -622,6 +631,10 @@ var GuidyBridge = class {
|
|
|
622
631
|
elements: this.collectElements()
|
|
623
632
|
});
|
|
624
633
|
}
|
|
634
|
+
postRoutes() {
|
|
635
|
+
if (!this.started) return;
|
|
636
|
+
this.send({ type: "guidy:routes", routes: this.routes });
|
|
637
|
+
}
|
|
625
638
|
scheduleScan() {
|
|
626
639
|
if (this.scanTimer) return;
|
|
627
640
|
this.scanTimer = setTimeout(() => {
|
|
@@ -995,11 +1008,22 @@ var AuthManager = class {
|
|
|
995
1008
|
*/
|
|
996
1009
|
startGuidyBridge() {
|
|
997
1010
|
if (!this.iframeAuth || this.guidyBridge) return;
|
|
998
|
-
const bridge = new GuidyBridge(
|
|
1011
|
+
const bridge = new GuidyBridge(
|
|
1012
|
+
(message) => this.iframeAuth?.sendToHost(message),
|
|
1013
|
+
this.config.guidyRoutes ?? []
|
|
1014
|
+
);
|
|
999
1015
|
this.iframeAuth.onGuidyCommand((message) => bridge.handleCommand(message));
|
|
1000
1016
|
bridge.start();
|
|
1001
1017
|
this.guidyBridge = bridge;
|
|
1002
1018
|
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Iframe mode: replace the routes the Guidy bridge advertises to the host.
|
|
1021
|
+
* No-op unless the bridge is running (`enableGuidyBridge`).
|
|
1022
|
+
*/
|
|
1023
|
+
setGuidyRoutes(routes) {
|
|
1024
|
+
this.config.guidyRoutes = routes;
|
|
1025
|
+
this.guidyBridge?.setRoutes(routes);
|
|
1026
|
+
}
|
|
1003
1027
|
/**
|
|
1004
1028
|
* Iframe/WebView mode: start auto-syncing the embedded app's route
|
|
1005
1029
|
* to the host. Patches history methods and listens for popstate /
|
|
@@ -1502,6 +1526,11 @@ function DocyrusAuthProvider({
|
|
|
1502
1526
|
managerRef.current?.notifyHostRouteChange(payload);
|
|
1503
1527
|
};
|
|
1504
1528
|
}, []);
|
|
1529
|
+
const setGuidyRoutes = useMemo(() => {
|
|
1530
|
+
return (routes) => {
|
|
1531
|
+
managerRef.current?.setGuidyRoutes(routes);
|
|
1532
|
+
};
|
|
1533
|
+
}, []);
|
|
1505
1534
|
const value = useMemo(() => ({
|
|
1506
1535
|
status,
|
|
1507
1536
|
mode,
|
|
@@ -1519,6 +1548,7 @@ function DocyrusAuthProvider({
|
|
|
1519
1548
|
onHostNotification,
|
|
1520
1549
|
enableHostRouteSync,
|
|
1521
1550
|
notifyRouteChange,
|
|
1551
|
+
setGuidyRoutes,
|
|
1522
1552
|
error
|
|
1523
1553
|
}), [
|
|
1524
1554
|
status,
|
|
@@ -1537,6 +1567,7 @@ function DocyrusAuthProvider({
|
|
|
1537
1567
|
onHostNotification,
|
|
1538
1568
|
enableHostRouteSync,
|
|
1539
1569
|
notifyRouteChange,
|
|
1570
|
+
setGuidyRoutes,
|
|
1540
1571
|
error
|
|
1541
1572
|
]);
|
|
1542
1573
|
return /* @__PURE__ */ jsx(DocyrusAuthContext, { value, children });
|