@docyrus/signin 0.15.0 → 0.17.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 +193 -0
- package/dist/{constants-BoAqIz2O.d.ts → constants-CB5mfHCf.d.ts} +27 -1
- package/dist/core-index.d.ts +4 -102
- package/dist/core-index.js +284 -1
- package/dist/core-index.js.map +1 -1
- package/dist/index.d.ts +41 -6
- package/dist/index.js +337 -1
- package/dist/index.js.map +1 -1
- package/dist/nextjs/index.js.map +1 -1
- package/dist/react-native/index.d.ts +4 -4
- package/dist/react-native/index.js +316 -0
- package/dist/react-native/index.js.map +1 -1
- package/dist/types-CFnKr6T_.d.ts +774 -0
- package/dist/{use-docyrus-client-pU5z5ZHe.d.ts → use-docyrus-client-BYQdgvz1.d.ts} +1 -1
- package/dist/vue/index.d.ts +8 -3
- package/dist/vue/index.js +303 -1
- package/dist/vue/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/types-DzwC4Dk7.d.ts +0 -367
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { D as DocyrusAuthConfig,
|
|
3
|
+
import { D as DocyrusAuthConfig, f as DocyrusAuthContextValue } from './types-CFnKr6T_.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 {
|
|
5
|
-
export { D as DocyrusAuthConfig } from '../types-
|
|
4
|
+
import { b as AuthMode, d as AuthStatus, H as HostNavigationHandler, s as HostNotificationHandler, R as RouteChangePayload, t as HostNavigationRequestOptions, k as DocyrusSharePayload, h as DocyrusEmailPayload, g as DocyrusCalendarEventPayload, n as MsGraphClient } from '../types-CFnKr6T_.js';
|
|
5
|
+
export { a as AdaptiveCard, D as DocyrusAuthConfig, j as DocyrusShareAdaptiveCardPayload, l as DocyrusShareTextPayload, M as MsGraphAccount, o as MsGraphRequest, p as MsGraphRequestOptions, q as MsGraphResponse, r as MsGraphStatus } from '../types-CFnKr6T_.js';
|
|
6
6
|
|
|
7
7
|
interface DocyrusAuthState {
|
|
8
8
|
status: AuthStatus;
|
|
@@ -19,6 +19,11 @@ interface DocyrusAuthState {
|
|
|
19
19
|
enableHostRouteSync: () => void;
|
|
20
20
|
notifyRouteChange: (payload?: RouteChangePayload) => void;
|
|
21
21
|
requestHostNavigation: (url: string, options?: HostNavigationRequestOptions) => void;
|
|
22
|
+
sendToDocy: (payload: DocyrusSharePayload) => Promise<void>;
|
|
23
|
+
sendToChat: (payload: DocyrusSharePayload) => Promise<void>;
|
|
24
|
+
sendToEmail: (payload: DocyrusEmailPayload) => Promise<void>;
|
|
25
|
+
sendToCalendar: (payload: DocyrusCalendarEventPayload) => Promise<void>;
|
|
26
|
+
msGraph: MsGraphClient | null;
|
|
22
27
|
}
|
|
23
28
|
/**
|
|
24
29
|
* Vue composable to access Docyrus auth state.
|
|
@@ -202,4 +207,4 @@ declare const SignInButton: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
202
207
|
disabled: boolean;
|
|
203
208
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
204
209
|
|
|
205
|
-
export { AuthMode, AuthStatus, DocyrusAuthProvider, type DocyrusAuthState, SignInButton, getDocyrusAuth, getDocyrusClient, useDocyrusAuth, useDocyrusClient };
|
|
210
|
+
export { AuthMode, AuthStatus, DocyrusAuthProvider, type DocyrusAuthState, DocyrusCalendarEventPayload, DocyrusEmailPayload, DocyrusSharePayload, MsGraphClient, SignInButton, getDocyrusAuth, getDocyrusClient, useDocyrusAuth, useDocyrusClient };
|
package/dist/vue/index.js
CHANGED
|
@@ -17,6 +17,8 @@ var DEFAULT_ALLOWED_HOST_PATTERN = /^https:\/\/[^/]+\.docyrus\.app$/;
|
|
|
17
17
|
var REDIRECT_RETURN_KEY = "docyrus_auth_return_url";
|
|
18
18
|
var TOKEN_EXPIRY_BUFFER_SECONDS = 60;
|
|
19
19
|
var IFRAME_TOKEN_REFRESH_TIMEOUT_MS = 1e4;
|
|
20
|
+
var HOST_ACTION_TIMEOUT_MS = 15e3;
|
|
21
|
+
var MSGRAPH_REQUEST_TIMEOUT_MS = 3e4;
|
|
20
22
|
var SSO_TOKEN_PARAM = "sso_token";
|
|
21
23
|
|
|
22
24
|
// src/core/auth-detector.ts
|
|
@@ -190,6 +192,13 @@ var IframeAuth = class {
|
|
|
190
192
|
stopped = false;
|
|
191
193
|
refreshPromise = null;
|
|
192
194
|
messageHandler = null;
|
|
195
|
+
/**
|
|
196
|
+
* In-flight app→host requests awaiting a correlated host reply, keyed by
|
|
197
|
+
* requestId. Powers Send to Docy / Send to Chat / the MS Graph bridge.
|
|
198
|
+
*/
|
|
199
|
+
pendingRequests = /* @__PURE__ */ new Map();
|
|
200
|
+
/** Fallback monotonic counter for request ids when crypto.randomUUID is absent. */
|
|
201
|
+
requestCounter = 0;
|
|
193
202
|
constructor(allowedOrigins, allowedPattern) {
|
|
194
203
|
this.allowedOrigins = allowedOrigins ?? [];
|
|
195
204
|
this.allowedPattern = allowedPattern ?? DEFAULT_ALLOWED_HOST_PATTERN;
|
|
@@ -213,6 +222,7 @@ var IframeAuth = class {
|
|
|
213
222
|
this.messageHandler = null;
|
|
214
223
|
}
|
|
215
224
|
this.rejectPendingRefresh("IframeAuth stopped");
|
|
225
|
+
this.rejectAllPendingRequests("IframeAuth stopped");
|
|
216
226
|
this.navigationHandlers.clear();
|
|
217
227
|
this.notificationHandlers.clear();
|
|
218
228
|
this.guidyHandlers.clear();
|
|
@@ -339,6 +349,119 @@ var IframeAuth = class {
|
|
|
339
349
|
if (this.stopped) return;
|
|
340
350
|
postToHost(message);
|
|
341
351
|
}
|
|
352
|
+
/**
|
|
353
|
+
* Hand a payload to the host AI assistant (Docy). Resolves when the host
|
|
354
|
+
* acknowledges delivery, rejects on host error or timeout.
|
|
355
|
+
*/
|
|
356
|
+
sendToDocy(payload) {
|
|
357
|
+
const requestId = this.nextRequestId();
|
|
358
|
+
return this.request(
|
|
359
|
+
{ type: "docy:send", requestId, payload },
|
|
360
|
+
HOST_ACTION_TIMEOUT_MS
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Hand a payload to the host team-chat app. Resolves when the host
|
|
365
|
+
* acknowledges delivery, rejects on host error or timeout.
|
|
366
|
+
*/
|
|
367
|
+
sendToChat(payload) {
|
|
368
|
+
const requestId = this.nextRequestId();
|
|
369
|
+
return this.request(
|
|
370
|
+
{ type: "chat:send", requestId, payload },
|
|
371
|
+
HOST_ACTION_TIMEOUT_MS
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Hand a draft email to the host. Resolves when the host acknowledges,
|
|
376
|
+
* rejects on host error or timeout.
|
|
377
|
+
*/
|
|
378
|
+
sendToEmail(payload) {
|
|
379
|
+
const requestId = this.nextRequestId();
|
|
380
|
+
return this.request(
|
|
381
|
+
{ type: "email:send", requestId, payload },
|
|
382
|
+
HOST_ACTION_TIMEOUT_MS
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Hand a calendar event to the host. Resolves when the host acknowledges,
|
|
387
|
+
* rejects on host error or timeout.
|
|
388
|
+
*/
|
|
389
|
+
sendToCalendar(payload) {
|
|
390
|
+
const requestId = this.nextRequestId();
|
|
391
|
+
return this.request(
|
|
392
|
+
{ type: "calendar:send", requestId, payload },
|
|
393
|
+
HOST_ACTION_TIMEOUT_MS
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
/** Ask the host whether its MSAL session is signed in. */
|
|
397
|
+
requestMsGraphStatus() {
|
|
398
|
+
const requestId = this.nextRequestId();
|
|
399
|
+
return this.request(
|
|
400
|
+
{ type: "msgraph:status-request", requestId },
|
|
401
|
+
HOST_ACTION_TIMEOUT_MS
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
/** Perform a Microsoft Graph request through the host's MSAL session. */
|
|
405
|
+
requestMsGraph(request) {
|
|
406
|
+
const requestId = this.nextRequestId();
|
|
407
|
+
return this.request(
|
|
408
|
+
{ type: "msgraph:request", requestId, request },
|
|
409
|
+
MSGRAPH_REQUEST_TIMEOUT_MS
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Post a correlated app→host request and await the matching host reply.
|
|
414
|
+
* The reply is matched by `requestId` in `handleMessage`. Rejects on timeout
|
|
415
|
+
* or when the bridge is stopped.
|
|
416
|
+
*/
|
|
417
|
+
request(message, timeoutMs) {
|
|
418
|
+
if (this.stopped) {
|
|
419
|
+
return Promise.reject(new Error("Cannot send host request: iframe bridge stopped"));
|
|
420
|
+
}
|
|
421
|
+
const { requestId } = message;
|
|
422
|
+
return new Promise((resolve, reject) => {
|
|
423
|
+
const timeoutId = setTimeout(() => {
|
|
424
|
+
this.pendingRequests.delete(requestId);
|
|
425
|
+
reject(new Error(`Host request "${message.type}" timed out`));
|
|
426
|
+
}, timeoutMs);
|
|
427
|
+
this.pendingRequests.set(requestId, {
|
|
428
|
+
resolve,
|
|
429
|
+
reject,
|
|
430
|
+
timeoutId
|
|
431
|
+
});
|
|
432
|
+
this.sendToHost(message);
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
/** Generate a correlation id, preferring crypto.randomUUID when available. */
|
|
436
|
+
nextRequestId() {
|
|
437
|
+
const cryptoObj = typeof crypto !== "undefined" ? crypto : void 0;
|
|
438
|
+
if (cryptoObj && typeof cryptoObj.randomUUID === "function") {
|
|
439
|
+
return cryptoObj.randomUUID();
|
|
440
|
+
}
|
|
441
|
+
this.requestCounter += 1;
|
|
442
|
+
return `req-${Date.now().toString(36)}-${this.requestCounter}-${Math.random().toString(36).slice(2, 10)}`;
|
|
443
|
+
}
|
|
444
|
+
resolvePendingRequest(requestId, value) {
|
|
445
|
+
const pending = this.pendingRequests.get(requestId);
|
|
446
|
+
if (!pending) return;
|
|
447
|
+
clearTimeout(pending.timeoutId);
|
|
448
|
+
this.pendingRequests.delete(requestId);
|
|
449
|
+
pending.resolve(value);
|
|
450
|
+
}
|
|
451
|
+
rejectPendingRequest(requestId, error) {
|
|
452
|
+
const pending = this.pendingRequests.get(requestId);
|
|
453
|
+
if (!pending) return;
|
|
454
|
+
clearTimeout(pending.timeoutId);
|
|
455
|
+
this.pendingRequests.delete(requestId);
|
|
456
|
+
pending.reject(error);
|
|
457
|
+
}
|
|
458
|
+
rejectAllPendingRequests(reason) {
|
|
459
|
+
for (const pending of this.pendingRequests.values()) {
|
|
460
|
+
clearTimeout(pending.timeoutId);
|
|
461
|
+
pending.reject(new Error(reason));
|
|
462
|
+
}
|
|
463
|
+
this.pendingRequests.clear();
|
|
464
|
+
}
|
|
342
465
|
/**
|
|
343
466
|
* Request fresh tokens from the host.
|
|
344
467
|
* Posts a "token-refresh-request" to the host, then waits for
|
|
@@ -395,8 +518,57 @@ var IframeAuth = class {
|
|
|
395
518
|
}
|
|
396
519
|
if (data.type === "guidy:point" || data.type === "guidy:scan") {
|
|
397
520
|
this.handleGuidyCommand(data);
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
if (data.type === "docy:send-ack" || data.type === "chat:send-ack" || data.type === "email:send-ack" || data.type === "calendar:send-ack") {
|
|
524
|
+
this.handleActionAck(data);
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
if (data.type === "msgraph:status-response") {
|
|
528
|
+
this.handleMsGraphStatusResponse(data);
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
if (data.type === "msgraph:response") {
|
|
532
|
+
this.handleMsGraphResponse(data);
|
|
398
533
|
}
|
|
399
534
|
}
|
|
535
|
+
handleActionAck(message) {
|
|
536
|
+
if (typeof message.requestId !== "string") return;
|
|
537
|
+
if (message.ok) {
|
|
538
|
+
this.resolvePendingRequest(message.requestId, void 0);
|
|
539
|
+
} else {
|
|
540
|
+
this.rejectPendingRequest(
|
|
541
|
+
message.requestId,
|
|
542
|
+
new Error(message.error || `Host rejected ${message.type}`)
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
handleMsGraphStatusResponse(message) {
|
|
547
|
+
if (typeof message.requestId !== "string") return;
|
|
548
|
+
if (message.error) {
|
|
549
|
+
this.rejectPendingRequest(message.requestId, new Error(message.error));
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
const status = {
|
|
553
|
+
signedIn: !!message.signedIn,
|
|
554
|
+
account: message.account ?? null
|
|
555
|
+
};
|
|
556
|
+
this.resolvePendingRequest(message.requestId, status);
|
|
557
|
+
}
|
|
558
|
+
handleMsGraphResponse(message) {
|
|
559
|
+
if (typeof message.requestId !== "string") return;
|
|
560
|
+
if (message.error && typeof message.status !== "number") {
|
|
561
|
+
this.rejectPendingRequest(message.requestId, new Error(message.error));
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
const response = {
|
|
565
|
+
ok: !!message.ok,
|
|
566
|
+
status: typeof message.status === "number" ? message.status : 0,
|
|
567
|
+
data: message.data,
|
|
568
|
+
error: message.error
|
|
569
|
+
};
|
|
570
|
+
this.resolvePendingRequest(message.requestId, response);
|
|
571
|
+
}
|
|
400
572
|
handleGuidyCommand(message) {
|
|
401
573
|
for (const handler of this.guidyHandlers) {
|
|
402
574
|
try {
|
|
@@ -698,6 +870,66 @@ var GuidyBridge = class {
|
|
|
698
870
|
}
|
|
699
871
|
};
|
|
700
872
|
|
|
873
|
+
// src/core/ms-graph-client.ts
|
|
874
|
+
var MsGraphClient = class {
|
|
875
|
+
iframeAuth;
|
|
876
|
+
constructor(iframeAuth) {
|
|
877
|
+
this.iframeAuth = iframeAuth;
|
|
878
|
+
}
|
|
879
|
+
/** Whether the host's MSAL session is signed in, plus optional account info. */
|
|
880
|
+
status() {
|
|
881
|
+
return this.iframeAuth.requestMsGraphStatus();
|
|
882
|
+
}
|
|
883
|
+
/** Convenience: resolves to whether the host's MSAL session is signed in. */
|
|
884
|
+
async isSignedIn() {
|
|
885
|
+
const status = await this.iframeAuth.requestMsGraphStatus();
|
|
886
|
+
return status.signedIn;
|
|
887
|
+
}
|
|
888
|
+
/** Perform an arbitrary Microsoft Graph request via the host's MSAL session. */
|
|
889
|
+
request(request) {
|
|
890
|
+
return this.iframeAuth.requestMsGraph(request);
|
|
891
|
+
}
|
|
892
|
+
/** GET a Graph resource, e.g. `get('/me/messages?$top=5')`. */
|
|
893
|
+
get(path, options) {
|
|
894
|
+
return this.iframeAuth.requestMsGraph({ method: "GET", path, ...options });
|
|
895
|
+
}
|
|
896
|
+
/** POST a JSON body to a Graph resource. */
|
|
897
|
+
post(path, body, options) {
|
|
898
|
+
return this.iframeAuth.requestMsGraph({
|
|
899
|
+
method: "POST",
|
|
900
|
+
path,
|
|
901
|
+
body,
|
|
902
|
+
...options
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
/** PATCH a JSON body to a Graph resource. */
|
|
906
|
+
patch(path, body, options) {
|
|
907
|
+
return this.iframeAuth.requestMsGraph({
|
|
908
|
+
method: "PATCH",
|
|
909
|
+
path,
|
|
910
|
+
body,
|
|
911
|
+
...options
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
/** PUT a JSON body to a Graph resource. */
|
|
915
|
+
put(path, body, options) {
|
|
916
|
+
return this.iframeAuth.requestMsGraph({
|
|
917
|
+
method: "PUT",
|
|
918
|
+
path,
|
|
919
|
+
body,
|
|
920
|
+
...options
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
/** DELETE a Graph resource. */
|
|
924
|
+
delete(path, options) {
|
|
925
|
+
return this.iframeAuth.requestMsGraph({ method: "DELETE", path, ...options });
|
|
926
|
+
}
|
|
927
|
+
/** Convenience: GET `/me` — the signed-in user's profile. */
|
|
928
|
+
getMe() {
|
|
929
|
+
return this.iframeAuth.requestMsGraph({ method: "GET", path: "/me" });
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
|
|
701
933
|
// src/core/sso-auth.ts
|
|
702
934
|
var SsoAuth = class {
|
|
703
935
|
config;
|
|
@@ -859,6 +1091,7 @@ var AuthManager = class {
|
|
|
859
1091
|
standaloneAuth = null;
|
|
860
1092
|
iframeAuth = null;
|
|
861
1093
|
guidyBridge = null;
|
|
1094
|
+
msGraphClient = null;
|
|
862
1095
|
reactNativeAuth = null;
|
|
863
1096
|
tokenRefreshTimer = null;
|
|
864
1097
|
/** Shared in-flight refresh, so concurrent requests don't trigger parallel refreshes. */
|
|
@@ -1001,6 +1234,7 @@ var AuthManager = class {
|
|
|
1001
1234
|
*/
|
|
1002
1235
|
initializeIframeMode() {
|
|
1003
1236
|
this.iframeAuth = new IframeAuth(this.config.allowedHostOrigins);
|
|
1237
|
+
this.msGraphClient = new MsGraphClient(this.iframeAuth);
|
|
1004
1238
|
this.iframeAuth.start((tokens) => {
|
|
1005
1239
|
this.setAuthenticated(tokens);
|
|
1006
1240
|
});
|
|
@@ -1076,6 +1310,53 @@ var AuthManager = class {
|
|
|
1076
1310
|
requestHostNavigation(url, options) {
|
|
1077
1311
|
this.iframeAuth?.requestHostNavigation(url, options);
|
|
1078
1312
|
}
|
|
1313
|
+
/**
|
|
1314
|
+
* Iframe/WebView mode: hand a payload to the host AI assistant (Docy).
|
|
1315
|
+
* Resolves when the host acknowledges delivery. Rejects outside iframe mode.
|
|
1316
|
+
*/
|
|
1317
|
+
sendToDocy(payload) {
|
|
1318
|
+
if (!this.iframeAuth) {
|
|
1319
|
+
return Promise.reject(new Error("sendToDocy() is only available in iframe/WebView mode"));
|
|
1320
|
+
}
|
|
1321
|
+
return this.iframeAuth.sendToDocy(payload);
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Iframe/WebView mode: hand a payload to the host team-chat app.
|
|
1325
|
+
* Resolves when the host acknowledges delivery. Rejects outside iframe mode.
|
|
1326
|
+
*/
|
|
1327
|
+
sendToChat(payload) {
|
|
1328
|
+
if (!this.iframeAuth) {
|
|
1329
|
+
return Promise.reject(new Error("sendToChat() is only available in iframe/WebView mode"));
|
|
1330
|
+
}
|
|
1331
|
+
return this.iframeAuth.sendToChat(payload);
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Iframe/WebView mode: hand a draft email to the host. Resolves when the
|
|
1335
|
+
* host acknowledges. Rejects outside iframe mode.
|
|
1336
|
+
*/
|
|
1337
|
+
sendToEmail(payload) {
|
|
1338
|
+
if (!this.iframeAuth) {
|
|
1339
|
+
return Promise.reject(new Error("sendToEmail() is only available in iframe/WebView mode"));
|
|
1340
|
+
}
|
|
1341
|
+
return this.iframeAuth.sendToEmail(payload);
|
|
1342
|
+
}
|
|
1343
|
+
/**
|
|
1344
|
+
* Iframe/WebView mode: hand a calendar event to the host. Resolves when the
|
|
1345
|
+
* host acknowledges. Rejects outside iframe mode.
|
|
1346
|
+
*/
|
|
1347
|
+
sendToCalendar(payload) {
|
|
1348
|
+
if (!this.iframeAuth) {
|
|
1349
|
+
return Promise.reject(new Error("sendToCalendar() is only available in iframe/WebView mode"));
|
|
1350
|
+
}
|
|
1351
|
+
return this.iframeAuth.sendToCalendar(payload);
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* Iframe/WebView mode: get the client for the host's Microsoft Graph (MSAL)
|
|
1355
|
+
* session. Returns `null` outside iframe mode.
|
|
1356
|
+
*/
|
|
1357
|
+
getMsGraphClient() {
|
|
1358
|
+
return this.msGraphClient;
|
|
1359
|
+
}
|
|
1079
1360
|
/**
|
|
1080
1361
|
* Subscribe to host `navigation` messages. Returns an unsubscribe function.
|
|
1081
1362
|
* Handlers registered before iframe mode is initialized are retained and
|
|
@@ -1197,6 +1478,7 @@ var AuthManager = class {
|
|
|
1197
1478
|
this.guidyBridge = null;
|
|
1198
1479
|
}
|
|
1199
1480
|
this.iframeAuth.stop();
|
|
1481
|
+
this.msGraphClient = null;
|
|
1200
1482
|
}
|
|
1201
1483
|
if (this.config.ssr) {
|
|
1202
1484
|
clearTokenCookie(this.config.ssrCookieKey);
|
|
@@ -1376,6 +1658,7 @@ var AuthManager = class {
|
|
|
1376
1658
|
this.guidyBridge = null;
|
|
1377
1659
|
}
|
|
1378
1660
|
if (this.iframeAuth) this.iframeAuth.stop();
|
|
1661
|
+
this.msGraphClient = null;
|
|
1379
1662
|
this.listeners.clear();
|
|
1380
1663
|
this.navigationHandlers.clear();
|
|
1381
1664
|
this.notificationHandlers.clear();
|
|
@@ -1450,6 +1733,18 @@ var DocyrusAuthProvider = defineComponent({
|
|
|
1450
1733
|
const requestHostNavigation = (url, options) => {
|
|
1451
1734
|
manager?.requestHostNavigation(url, options);
|
|
1452
1735
|
};
|
|
1736
|
+
const sendToDocy = (payload) => {
|
|
1737
|
+
return manager?.sendToDocy(payload) ?? Promise.reject(new Error("Auth manager not initialized"));
|
|
1738
|
+
};
|
|
1739
|
+
const sendToChat = (payload) => {
|
|
1740
|
+
return manager?.sendToChat(payload) ?? Promise.reject(new Error("Auth manager not initialized"));
|
|
1741
|
+
};
|
|
1742
|
+
const sendToEmail = (payload) => {
|
|
1743
|
+
return manager?.sendToEmail(payload) ?? Promise.reject(new Error("Auth manager not initialized"));
|
|
1744
|
+
};
|
|
1745
|
+
const sendToCalendar = (payload) => {
|
|
1746
|
+
return manager?.sendToCalendar(payload) ?? Promise.reject(new Error("Auth manager not initialized"));
|
|
1747
|
+
};
|
|
1453
1748
|
const authState = {
|
|
1454
1749
|
get status() {
|
|
1455
1750
|
return status.value;
|
|
@@ -1466,6 +1761,9 @@ var DocyrusAuthProvider = defineComponent({
|
|
|
1466
1761
|
get error() {
|
|
1467
1762
|
return error.value;
|
|
1468
1763
|
},
|
|
1764
|
+
get msGraph() {
|
|
1765
|
+
return manager?.getMsGraphClient() ?? null;
|
|
1766
|
+
},
|
|
1469
1767
|
signIn,
|
|
1470
1768
|
signInWithTokens,
|
|
1471
1769
|
getAuthorizationUrl,
|
|
@@ -1474,7 +1772,11 @@ var DocyrusAuthProvider = defineComponent({
|
|
|
1474
1772
|
onHostNotification,
|
|
1475
1773
|
enableHostRouteSync,
|
|
1476
1774
|
notifyRouteChange,
|
|
1477
|
-
requestHostNavigation
|
|
1775
|
+
requestHostNavigation,
|
|
1776
|
+
sendToDocy,
|
|
1777
|
+
sendToChat,
|
|
1778
|
+
sendToEmail,
|
|
1779
|
+
sendToCalendar
|
|
1478
1780
|
};
|
|
1479
1781
|
provide(DOCYRUS_AUTH_KEY, authState);
|
|
1480
1782
|
onMounted(() => {
|