@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.
@@ -1,8 +1,8 @@
1
1
  import { OAuth2Tokens } from '@docyrus/api-client';
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-DDOgvbL5.js';
2
+ import { D as DocyrusAuthConfig } from '../types-DzwC4Dk7.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-DzwC4Dk7.js';
4
+ export { D as DocyrusAuthContext, a as DocyrusAuthProvider, b as DocyrusAuthProviderProps, u as useDocyrusAuth, c as useDocyrusClient } from '../use-docyrus-client-pU5z5ZHe.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-BoAqIz2O.js';
6
6
  import 'react';
7
7
 
8
8
  /**
@@ -350,6 +350,19 @@ var IframeAuth = class {
350
350
  url: `${path}${search}${hash}`
351
351
  });
352
352
  }
353
+ /**
354
+ * Ask the host shell to navigate to a path/URL. The reverse of the
355
+ * host → app `navigation` message: posts a `navigation-request` over the
356
+ * same validated channel. The host decides how to honour it.
357
+ */
358
+ requestHostNavigation(url, options) {
359
+ if (this.stopped) return;
360
+ if (typeof url !== "string" || url.length === 0) return;
361
+ const message = { type: "navigation-request", url };
362
+ if (options?.replace) message.replace = true;
363
+ if (options?.newTab) message.newTab = true;
364
+ this.sendToHost(message);
365
+ }
353
366
  teardownRouteSync() {
354
367
  if (!this.routeSyncEnabled) return;
355
368
  if (typeof window !== "undefined") {
@@ -1058,6 +1071,14 @@ var AuthManager = class {
1058
1071
  notifyHostRouteChange(payload) {
1059
1072
  this.iframeAuth?.notifyRouteChange(payload);
1060
1073
  }
1074
+ /**
1075
+ * Iframe/WebView mode: ask the host shell to navigate to a path/URL.
1076
+ * Posts a `navigation-request` message; the host decides how to honour it.
1077
+ * No-op outside iframe mode.
1078
+ */
1079
+ requestHostNavigation(url, options) {
1080
+ this.iframeAuth?.requestHostNavigation(url, options);
1081
+ }
1061
1082
  /**
1062
1083
  * Subscribe to host `navigation` messages. Returns an unsubscribe function.
1063
1084
  * Handlers registered before iframe mode is initialized are retained and
@@ -1548,6 +1569,11 @@ function DocyrusAuthProvider({
1548
1569
  managerRef.current?.notifyHostRouteChange(payload);
1549
1570
  };
1550
1571
  }, []);
1572
+ const requestHostNavigation = useMemo(() => {
1573
+ return (url, options) => {
1574
+ managerRef.current?.requestHostNavigation(url, options);
1575
+ };
1576
+ }, []);
1551
1577
  const setGuidyRoutes = useMemo(() => {
1552
1578
  return (routes) => {
1553
1579
  managerRef.current?.setGuidyRoutes(routes);
@@ -1570,6 +1596,7 @@ function DocyrusAuthProvider({
1570
1596
  onHostNotification,
1571
1597
  enableHostRouteSync,
1572
1598
  notifyRouteChange,
1599
+ requestHostNavigation,
1573
1600
  setGuidyRoutes,
1574
1601
  error
1575
1602
  }), [
@@ -1589,6 +1616,7 @@ function DocyrusAuthProvider({
1589
1616
  onHostNotification,
1590
1617
  enableHostRouteSync,
1591
1618
  notifyRouteChange,
1619
+ requestHostNavigation,
1592
1620
  setGuidyRoutes,
1593
1621
  error
1594
1622
  ]);