@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
package/dist/index.js
CHANGED
|
@@ -451,6 +451,7 @@ function isVisible(node) {
|
|
|
451
451
|
}
|
|
452
452
|
var GuidyBridge = class {
|
|
453
453
|
send;
|
|
454
|
+
routes;
|
|
454
455
|
started = false;
|
|
455
456
|
observer = null;
|
|
456
457
|
scanTimer = null;
|
|
@@ -458,8 +459,14 @@ var GuidyBridge = class {
|
|
|
458
459
|
highlightTimer = null;
|
|
459
460
|
clickTimer = null;
|
|
460
461
|
annotationTimer = null;
|
|
461
|
-
constructor(send) {
|
|
462
|
+
constructor(send, routes = []) {
|
|
462
463
|
this.send = send;
|
|
464
|
+
this.routes = routes;
|
|
465
|
+
}
|
|
466
|
+
/** Replace the declared navigable routes and re-post them to the host. */
|
|
467
|
+
setRoutes(routes) {
|
|
468
|
+
this.routes = routes;
|
|
469
|
+
this.postRoutes();
|
|
463
470
|
}
|
|
464
471
|
/**
|
|
465
472
|
* Begin reporting the element inventory and watching for changes.
|
|
@@ -470,6 +477,7 @@ var GuidyBridge = class {
|
|
|
470
477
|
this.started = true;
|
|
471
478
|
this.ensureStyle();
|
|
472
479
|
this.postElements();
|
|
480
|
+
this.postRoutes();
|
|
473
481
|
this.observer = new MutationObserver(() => this.scheduleScan());
|
|
474
482
|
this.observer.observe(document.body, {
|
|
475
483
|
childList: true,
|
|
@@ -509,6 +517,7 @@ var GuidyBridge = class {
|
|
|
509
517
|
handleCommand(message) {
|
|
510
518
|
if (message.type === "guidy:scan") {
|
|
511
519
|
this.postElements();
|
|
520
|
+
this.postRoutes();
|
|
512
521
|
return;
|
|
513
522
|
}
|
|
514
523
|
if (message.type === "guidy:point") {
|
|
@@ -545,6 +554,10 @@ var GuidyBridge = class {
|
|
|
545
554
|
elements: this.collectElements()
|
|
546
555
|
});
|
|
547
556
|
}
|
|
557
|
+
postRoutes() {
|
|
558
|
+
if (!this.started) return;
|
|
559
|
+
this.send({ type: "guidy:routes", routes: this.routes });
|
|
560
|
+
}
|
|
548
561
|
scheduleScan() {
|
|
549
562
|
if (this.scanTimer) return;
|
|
550
563
|
this.scanTimer = setTimeout(() => {
|
|
@@ -1000,11 +1013,22 @@ var AuthManager = class {
|
|
|
1000
1013
|
*/
|
|
1001
1014
|
startGuidyBridge() {
|
|
1002
1015
|
if (!this.iframeAuth || this.guidyBridge) return;
|
|
1003
|
-
const bridge = new GuidyBridge(
|
|
1016
|
+
const bridge = new GuidyBridge(
|
|
1017
|
+
(message) => this.iframeAuth?.sendToHost(message),
|
|
1018
|
+
this.config.guidyRoutes ?? []
|
|
1019
|
+
);
|
|
1004
1020
|
this.iframeAuth.onGuidyCommand((message) => bridge.handleCommand(message));
|
|
1005
1021
|
bridge.start();
|
|
1006
1022
|
this.guidyBridge = bridge;
|
|
1007
1023
|
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Iframe mode: replace the routes the Guidy bridge advertises to the host.
|
|
1026
|
+
* No-op unless the bridge is running (`enableGuidyBridge`).
|
|
1027
|
+
*/
|
|
1028
|
+
setGuidyRoutes(routes) {
|
|
1029
|
+
this.config.guidyRoutes = routes;
|
|
1030
|
+
this.guidyBridge?.setRoutes(routes);
|
|
1031
|
+
}
|
|
1008
1032
|
/**
|
|
1009
1033
|
* Iframe/WebView mode: start auto-syncing the embedded app's route
|
|
1010
1034
|
* to the host. Patches history methods and listens for popstate /
|
|
@@ -1507,6 +1531,11 @@ function DocyrusAuthProvider({
|
|
|
1507
1531
|
managerRef.current?.notifyHostRouteChange(payload);
|
|
1508
1532
|
};
|
|
1509
1533
|
}, []);
|
|
1534
|
+
const setGuidyRoutes = useMemo(() => {
|
|
1535
|
+
return (routes) => {
|
|
1536
|
+
managerRef.current?.setGuidyRoutes(routes);
|
|
1537
|
+
};
|
|
1538
|
+
}, []);
|
|
1510
1539
|
const value = useMemo(() => ({
|
|
1511
1540
|
status,
|
|
1512
1541
|
mode,
|
|
@@ -1524,6 +1553,7 @@ function DocyrusAuthProvider({
|
|
|
1524
1553
|
onHostNotification,
|
|
1525
1554
|
enableHostRouteSync,
|
|
1526
1555
|
notifyRouteChange,
|
|
1556
|
+
setGuidyRoutes,
|
|
1527
1557
|
error
|
|
1528
1558
|
}), [
|
|
1529
1559
|
status,
|
|
@@ -1542,6 +1572,7 @@ function DocyrusAuthProvider({
|
|
|
1542
1572
|
onHostNotification,
|
|
1543
1573
|
enableHostRouteSync,
|
|
1544
1574
|
notifyRouteChange,
|
|
1575
|
+
setGuidyRoutes,
|
|
1545
1576
|
error
|
|
1546
1577
|
]);
|
|
1547
1578
|
return /* @__PURE__ */ jsx(DocyrusAuthContext, { value, children });
|
|
@@ -1587,6 +1618,12 @@ function useDocyrusHostNotification(handler) {
|
|
|
1587
1618
|
});
|
|
1588
1619
|
}, [onHostNotification]);
|
|
1589
1620
|
}
|
|
1621
|
+
function useDocyrusGuidyRoutes(routes) {
|
|
1622
|
+
const { setGuidyRoutes } = useDocyrusAuth();
|
|
1623
|
+
useEffect(() => {
|
|
1624
|
+
setGuidyRoutes(routes);
|
|
1625
|
+
}, [setGuidyRoutes, routes]);
|
|
1626
|
+
}
|
|
1590
1627
|
var ICON_SIZE = 20;
|
|
1591
1628
|
function DocyrusLogo({ size = ICON_SIZE }) {
|
|
1592
1629
|
return /* @__PURE__ */ jsx(
|
|
@@ -1671,6 +1708,6 @@ function SignInButton({
|
|
|
1671
1708
|
);
|
|
1672
1709
|
}
|
|
1673
1710
|
|
|
1674
|
-
export { AuthManager, DEFAULT_API_URL, DEFAULT_CALLBACK_PATH, DEFAULT_OAUTH_SCOPES, DEFAULT_SSR_COOKIE_KEY, DocyrusAuthContext, DocyrusAuthProvider, GuidyBridge, IframeAuth, SignInButton, StandaloneOAuth2Auth, clearTokenCookie, detectAuthMode, getAllRoles, getTokenFromCookie, hasPermission, hasRole, syncTokenToCookie, useDocyrusAuth, useDocyrusClient, useDocyrusHostNavigation, useDocyrusHostNotification, useDocyrusHostRouteSync };
|
|
1711
|
+
export { AuthManager, DEFAULT_API_URL, DEFAULT_CALLBACK_PATH, DEFAULT_OAUTH_SCOPES, DEFAULT_SSR_COOKIE_KEY, DocyrusAuthContext, DocyrusAuthProvider, GuidyBridge, IframeAuth, SignInButton, StandaloneOAuth2Auth, clearTokenCookie, detectAuthMode, getAllRoles, getTokenFromCookie, hasPermission, hasRole, syncTokenToCookie, useDocyrusAuth, useDocyrusClient, useDocyrusGuidyRoutes, useDocyrusHostNavigation, useDocyrusHostNotification, useDocyrusHostRouteSync };
|
|
1675
1712
|
//# sourceMappingURL=index.js.map
|
|
1676
1713
|
//# sourceMappingURL=index.js.map
|