@docyrus/signin 0.14.1 → 0.15.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 +57 -0
- package/dist/{constants-DDOgvbL5.d.ts → constants-BoAqIz2O.d.ts} +7 -1
- package/dist/core-index.d.ts +11 -4
- package/dist/core-index.js +21 -0
- package/dist/core-index.js.map +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.js +33 -1
- package/dist/index.js.map +1 -1
- package/dist/react-native/index.d.ts +4 -4
- package/dist/react-native/index.js +28 -0
- package/dist/react-native/index.js.map +1 -1
- package/dist/{types-D4ZAVj-B.d.ts → types-DzwC4Dk7.d.ts} +32 -2
- package/dist/{use-docyrus-client-o9nPwayd.d.ts → use-docyrus-client-pU5z5ZHe.d.ts} +1 -1
- package/dist/vue/index.d.ts +3 -2
- package/dist/vue/index.js +26 -1
- package/dist/vue/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -273,6 +273,19 @@ var IframeAuth = class {
|
|
|
273
273
|
url: `${path}${search}${hash}`
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* Ask the host shell to navigate to a path/URL. The reverse of the
|
|
278
|
+
* host → app `navigation` message: posts a `navigation-request` over the
|
|
279
|
+
* same validated channel. The host decides how to honour it.
|
|
280
|
+
*/
|
|
281
|
+
requestHostNavigation(url, options) {
|
|
282
|
+
if (this.stopped) return;
|
|
283
|
+
if (typeof url !== "string" || url.length === 0) return;
|
|
284
|
+
const message = { type: "navigation-request", url };
|
|
285
|
+
if (options?.replace) message.replace = true;
|
|
286
|
+
if (options?.newTab) message.newTab = true;
|
|
287
|
+
this.sendToHost(message);
|
|
288
|
+
}
|
|
276
289
|
teardownRouteSync() {
|
|
277
290
|
if (!this.routeSyncEnabled) return;
|
|
278
291
|
if (typeof window !== "undefined") {
|
|
@@ -1063,6 +1076,14 @@ var AuthManager = class {
|
|
|
1063
1076
|
notifyHostRouteChange(payload) {
|
|
1064
1077
|
this.iframeAuth?.notifyRouteChange(payload);
|
|
1065
1078
|
}
|
|
1079
|
+
/**
|
|
1080
|
+
* Iframe/WebView mode: ask the host shell to navigate to a path/URL.
|
|
1081
|
+
* Posts a `navigation-request` message; the host decides how to honour it.
|
|
1082
|
+
* No-op outside iframe mode.
|
|
1083
|
+
*/
|
|
1084
|
+
requestHostNavigation(url, options) {
|
|
1085
|
+
this.iframeAuth?.requestHostNavigation(url, options);
|
|
1086
|
+
}
|
|
1066
1087
|
/**
|
|
1067
1088
|
* Subscribe to host `navigation` messages. Returns an unsubscribe function.
|
|
1068
1089
|
* Handlers registered before iframe mode is initialized are retained and
|
|
@@ -1553,6 +1574,11 @@ function DocyrusAuthProvider({
|
|
|
1553
1574
|
managerRef.current?.notifyHostRouteChange(payload);
|
|
1554
1575
|
};
|
|
1555
1576
|
}, []);
|
|
1577
|
+
const requestHostNavigation = useMemo(() => {
|
|
1578
|
+
return (url, options) => {
|
|
1579
|
+
managerRef.current?.requestHostNavigation(url, options);
|
|
1580
|
+
};
|
|
1581
|
+
}, []);
|
|
1556
1582
|
const setGuidyRoutes = useMemo(() => {
|
|
1557
1583
|
return (routes) => {
|
|
1558
1584
|
managerRef.current?.setGuidyRoutes(routes);
|
|
@@ -1575,6 +1601,7 @@ function DocyrusAuthProvider({
|
|
|
1575
1601
|
onHostNotification,
|
|
1576
1602
|
enableHostRouteSync,
|
|
1577
1603
|
notifyRouteChange,
|
|
1604
|
+
requestHostNavigation,
|
|
1578
1605
|
setGuidyRoutes,
|
|
1579
1606
|
error
|
|
1580
1607
|
}), [
|
|
@@ -1594,6 +1621,7 @@ function DocyrusAuthProvider({
|
|
|
1594
1621
|
onHostNotification,
|
|
1595
1622
|
enableHostRouteSync,
|
|
1596
1623
|
notifyRouteChange,
|
|
1624
|
+
requestHostNavigation,
|
|
1597
1625
|
setGuidyRoutes,
|
|
1598
1626
|
error
|
|
1599
1627
|
]);
|
|
@@ -1640,6 +1668,10 @@ function useDocyrusHostNotification(handler) {
|
|
|
1640
1668
|
});
|
|
1641
1669
|
}, [onHostNotification]);
|
|
1642
1670
|
}
|
|
1671
|
+
function useDocyrusRequestHostNavigation() {
|
|
1672
|
+
const { requestHostNavigation } = useDocyrusAuth();
|
|
1673
|
+
return requestHostNavigation;
|
|
1674
|
+
}
|
|
1643
1675
|
function useDocyrusGuidyRoutes(routes) {
|
|
1644
1676
|
const { setGuidyRoutes } = useDocyrusAuth();
|
|
1645
1677
|
useEffect(() => {
|
|
@@ -1730,6 +1762,6 @@ function SignInButton({
|
|
|
1730
1762
|
);
|
|
1731
1763
|
}
|
|
1732
1764
|
|
|
1733
|
-
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 };
|
|
1765
|
+
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, useDocyrusRequestHostNavigation };
|
|
1734
1766
|
//# sourceMappingURL=index.js.map
|
|
1735
1767
|
//# sourceMappingURL=index.js.map
|