@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
|
@@ -138,6 +138,13 @@ interface DocyrusAuthContextValue {
|
|
|
138
138
|
* subscriptions). No-op in non-iframe modes.
|
|
139
139
|
*/
|
|
140
140
|
notifyRouteChange: (payload?: RouteChangePayload) => void;
|
|
141
|
+
/**
|
|
142
|
+
* Iframe/WebView mode: ask the host shell to navigate to a path/URL.
|
|
143
|
+
* The reverse of `onHostNavigation` — lets an in-app action drive the
|
|
144
|
+
* host's own routing (deep link, switch view, open a sibling app). The
|
|
145
|
+
* host decides how to honour the request. No-op in non-iframe modes.
|
|
146
|
+
*/
|
|
147
|
+
requestHostNavigation: (url: string, options?: HostNavigationRequestOptions) => void;
|
|
141
148
|
/**
|
|
142
149
|
* Iframe mode (Guidy bridge): replace the routes the host assistant may
|
|
143
150
|
* navigate the user to inside this app. No-op unless `enableGuidyBridge`
|
|
@@ -184,6 +191,29 @@ interface HostNavigationMessage {
|
|
|
184
191
|
type: 'navigation';
|
|
185
192
|
url: string;
|
|
186
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* PostMessage payload: the embedded app asks the host shell to navigate to a
|
|
196
|
+
* path/URL. The reverse of `HostNavigationMessage` — used when an in-app action
|
|
197
|
+
* needs to drive the host's own routing (deep link, switch view, open a
|
|
198
|
+
* sibling app). The host decides how to honour it. Unlike `route-change`, which
|
|
199
|
+
* passively reports the app's current route, this is an explicit request.
|
|
200
|
+
*/
|
|
201
|
+
interface AppNavigationRequestMessage {
|
|
202
|
+
type: 'navigation-request';
|
|
203
|
+
/** Target path or absolute URL for the host shell to navigate to. */
|
|
204
|
+
url: string;
|
|
205
|
+
/** Hint the host to replace the current history entry instead of pushing. */
|
|
206
|
+
replace?: boolean;
|
|
207
|
+
/** Hint the host to open the target in a new tab/window instead of in place. */
|
|
208
|
+
newTab?: boolean;
|
|
209
|
+
}
|
|
210
|
+
/** Options for `requestHostNavigation` (app → host navigation request). */
|
|
211
|
+
interface HostNavigationRequestOptions {
|
|
212
|
+
/** Hint the host to replace the current history entry instead of pushing. */
|
|
213
|
+
replace?: boolean;
|
|
214
|
+
/** Hint the host to open the target in a new tab/window instead of in place. */
|
|
215
|
+
newTab?: boolean;
|
|
216
|
+
}
|
|
187
217
|
/**
|
|
188
218
|
* Notification payload pushed from the host into the embedded app.
|
|
189
219
|
* Mirrors the NotificationEntity API contract.
|
|
@@ -288,7 +318,7 @@ interface GuidyPointAckMessage {
|
|
|
288
318
|
type GuidyCommandMessage = GuidyPointMessage | GuidyScanMessage;
|
|
289
319
|
/** Handler invoked when the host sends a Guidy command. */
|
|
290
320
|
type GuidyCommandHandler = (message: GuidyCommandMessage) => void;
|
|
291
|
-
type AppToHostMessage = TokenRefreshRequestMessage | AppRouteChangeMessage | GuidyElementsMessage | GuidyRoutesMessage | GuidyPointAckMessage;
|
|
321
|
+
type AppToHostMessage = TokenRefreshRequestMessage | AppRouteChangeMessage | AppNavigationRequestMessage | GuidyElementsMessage | GuidyRoutesMessage | GuidyPointAckMessage;
|
|
292
322
|
/** Handler invoked when the host sends a navigation message */
|
|
293
323
|
type HostNavigationHandler = (message: HostNavigationMessage) => void;
|
|
294
324
|
/** Handler invoked when the host sends a notification message */
|
|
@@ -334,4 +364,4 @@ interface PermissionConfig {
|
|
|
334
364
|
alwaysPermittedDataSources?: Record<string, AclOperation[]>;
|
|
335
365
|
}
|
|
336
366
|
|
|
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,
|
|
367
|
+
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, HostNavigationRequestOptions as i, AppNavigationRequestMessage as j, AppRouteChangeMessage as k, DocyrusNotification as l, GuidyCommandHandler as m, GuidyCommandMessage as n, GuidyElement as o, GuidyElementsMessage as p, GuidyPointAckMessage as q, GuidyPointMessage as r, GuidyRoutesMessage as s, GuidyScanMessage as t, HostNavigationMessage as u, HostNotificationMessage as v, HostSignInMessage as w, AppToHostMessage as x };
|
|
@@ -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-DzwC4Dk7.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, i as HostNavigationRequestOptions } from '../types-DzwC4Dk7.js';
|
|
5
|
+
export { D as DocyrusAuthConfig } from '../types-DzwC4Dk7.js';
|
|
6
6
|
|
|
7
7
|
interface DocyrusAuthState {
|
|
8
8
|
status: AuthStatus;
|
|
@@ -18,6 +18,7 @@ interface DocyrusAuthState {
|
|
|
18
18
|
onHostNotification: (handler: HostNotificationHandler) => () => void;
|
|
19
19
|
enableHostRouteSync: () => void;
|
|
20
20
|
notifyRouteChange: (payload?: RouteChangePayload) => void;
|
|
21
|
+
requestHostNavigation: (url: string, options?: HostNavigationRequestOptions) => void;
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
23
24
|
* Vue composable to access Docyrus auth state.
|
package/dist/vue/index.js
CHANGED
|
@@ -271,6 +271,19 @@ var IframeAuth = class {
|
|
|
271
271
|
url: `${path}${search}${hash}`
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Ask the host shell to navigate to a path/URL. The reverse of the
|
|
276
|
+
* host → app `navigation` message: posts a `navigation-request` over the
|
|
277
|
+
* same validated channel. The host decides how to honour it.
|
|
278
|
+
*/
|
|
279
|
+
requestHostNavigation(url, options) {
|
|
280
|
+
if (this.stopped) return;
|
|
281
|
+
if (typeof url !== "string" || url.length === 0) return;
|
|
282
|
+
const message = { type: "navigation-request", url };
|
|
283
|
+
if (options?.replace) message.replace = true;
|
|
284
|
+
if (options?.newTab) message.newTab = true;
|
|
285
|
+
this.sendToHost(message);
|
|
286
|
+
}
|
|
274
287
|
teardownRouteSync() {
|
|
275
288
|
if (!this.routeSyncEnabled) return;
|
|
276
289
|
if (typeof window !== "undefined") {
|
|
@@ -1055,6 +1068,14 @@ var AuthManager = class {
|
|
|
1055
1068
|
notifyHostRouteChange(payload) {
|
|
1056
1069
|
this.iframeAuth?.notifyRouteChange(payload);
|
|
1057
1070
|
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Iframe/WebView mode: ask the host shell to navigate to a path/URL.
|
|
1073
|
+
* Posts a `navigation-request` message; the host decides how to honour it.
|
|
1074
|
+
* No-op outside iframe mode.
|
|
1075
|
+
*/
|
|
1076
|
+
requestHostNavigation(url, options) {
|
|
1077
|
+
this.iframeAuth?.requestHostNavigation(url, options);
|
|
1078
|
+
}
|
|
1058
1079
|
/**
|
|
1059
1080
|
* Subscribe to host `navigation` messages. Returns an unsubscribe function.
|
|
1060
1081
|
* Handlers registered before iframe mode is initialized are retained and
|
|
@@ -1426,6 +1447,9 @@ var DocyrusAuthProvider = defineComponent({
|
|
|
1426
1447
|
const notifyRouteChange = (payload) => {
|
|
1427
1448
|
manager?.notifyHostRouteChange(payload);
|
|
1428
1449
|
};
|
|
1450
|
+
const requestHostNavigation = (url, options) => {
|
|
1451
|
+
manager?.requestHostNavigation(url, options);
|
|
1452
|
+
};
|
|
1429
1453
|
const authState = {
|
|
1430
1454
|
get status() {
|
|
1431
1455
|
return status.value;
|
|
@@ -1449,7 +1473,8 @@ var DocyrusAuthProvider = defineComponent({
|
|
|
1449
1473
|
onHostNavigation,
|
|
1450
1474
|
onHostNotification,
|
|
1451
1475
|
enableHostRouteSync,
|
|
1452
|
-
notifyRouteChange
|
|
1476
|
+
notifyRouteChange,
|
|
1477
|
+
requestHostNavigation
|
|
1453
1478
|
};
|
|
1454
1479
|
provide(DOCYRUS_AUTH_KEY, authState);
|
|
1455
1480
|
onMounted(() => {
|