@kivacore/signin 0.20.0 → 0.21.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.
@@ -19,6 +19,7 @@ declare class ElectronTokenStorage implements OAuth2TokenStorage {
19
19
  private readonly tokensKey;
20
20
  private readonly pkceKey;
21
21
  private readonly electronAPI;
22
+ private readonly migrateLegacyKeys;
22
23
  constructor(electronAPI?: ElectronStoreAPI, keyPrefix?: string);
23
24
  getTokens(): Promise<OAuth2Tokens | null>;
24
25
  setTokens(tokens: OAuth2Tokens): Promise<void>;
@@ -26,6 +27,8 @@ declare class ElectronTokenStorage implements OAuth2TokenStorage {
26
27
  getPKCEState(): Promise<PKCEState | null>;
27
28
  setPKCEState(state: PKCEState): Promise<void>;
28
29
  clearPKCEState(): Promise<void>;
30
+ /** Read a key, moving the value stored under the legacy prefix so users stay signed in after upgrading */
31
+ private read;
29
32
  private storeGet;
30
33
  private storeSet;
31
34
  private storeDelete;
@@ -1,15 +1,19 @@
1
1
  // src/electron/index.ts
2
+ var DEFAULT_KEY_PREFIX = "kiva_oauth2";
3
+ var LEGACY_KEY_PREFIX = "docyrus_oauth2";
2
4
  var ElectronTokenStorage = class {
3
5
  tokensKey;
4
6
  pkceKey;
5
7
  electronAPI;
6
- constructor(electronAPI, keyPrefix = "docyrus_oauth2") {
8
+ migrateLegacyKeys;
9
+ constructor(electronAPI, keyPrefix = DEFAULT_KEY_PREFIX) {
10
+ this.migrateLegacyKeys = keyPrefix === DEFAULT_KEY_PREFIX;
7
11
  this.electronAPI = electronAPI ?? (typeof window !== "undefined" ? window.electronAPI : void 0) ?? null;
8
12
  this.tokensKey = `${keyPrefix}_tokens`;
9
13
  this.pkceKey = `${keyPrefix}_pkce`;
10
14
  }
11
15
  async getTokens() {
12
- const data = await this.storeGet(this.tokensKey);
16
+ const data = await this.read(this.tokensKey, "tokens");
13
17
  return data ? JSON.parse(data) : null;
14
18
  }
15
19
  async setTokens(tokens) {
@@ -17,9 +21,12 @@ var ElectronTokenStorage = class {
17
21
  }
18
22
  async clearTokens() {
19
23
  await this.storeDelete(this.tokensKey);
24
+ if (this.migrateLegacyKeys) {
25
+ await this.storeDelete(`${LEGACY_KEY_PREFIX}_tokens`);
26
+ }
20
27
  }
21
28
  async getPKCEState() {
22
- const data = await this.storeGet(this.pkceKey);
29
+ const data = await this.read(this.pkceKey, "pkce");
23
30
  return data ? JSON.parse(data) : null;
24
31
  }
25
32
  async setPKCEState(state) {
@@ -28,6 +35,18 @@ var ElectronTokenStorage = class {
28
35
  async clearPKCEState() {
29
36
  await this.storeDelete(this.pkceKey);
30
37
  }
38
+ /** Read a key, moving the value stored under the legacy prefix so users stay signed in after upgrading */
39
+ async read(key, suffix) {
40
+ const data = await this.storeGet(key);
41
+ if (data !== null || !this.migrateLegacyKeys) return data;
42
+ const legacyKey = `${LEGACY_KEY_PREFIX}_${suffix}`;
43
+ const legacy = await this.storeGet(legacyKey);
44
+ if (legacy !== null) {
45
+ await this.storeSet(key, legacy);
46
+ await this.storeDelete(legacyKey);
47
+ }
48
+ return legacy;
49
+ }
31
50
  async storeGet(key) {
32
51
  if (this.electronAPI) {
33
52
  return this.electronAPI.storeGet(key);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/electron/index.ts"],"names":[],"mappings":";AAqBO,IAAM,uBAAN,MAAyD;AAAA,EAC7C,SAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACjB,WAAA,CACE,WAAA,EACA,SAAA,GAAoB,gBAAA,EACpB;AACA,IAAA,IAAA,CAAK,cAAc,WAAA,KACb,OAAO,WAAW,WAAA,GAAe,MAAA,CAA8C,cAA8C,MAAA,CAAA,IAC9H,IAAA;AACL,IAAA,IAAA,CAAK,SAAA,GAAY,GAAG,SAAS,CAAA,OAAA,CAAA;AAC7B,IAAA,IAAA,CAAK,OAAA,GAAU,GAAG,SAAS,CAAA,KAAA,CAAA;AAAA,EAC7B;AAAA,EACA,MAAM,SAAA,GAA0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,EAAa;AACpB,MAAA,MAAM,IAAA,CAAK,WAAA,CAAY,QAAA,CAAS,GAAA,EAAK,KAAK,CAAA;AAE1C,MAAA;AAAA,IACF;AAEA,IAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACjC,MAAA,MAAA,CAAO,YAAA,CAAa,OAAA,CAAQ,GAAA,EAAK,KAAK,CAAA;AAAA,IACxC;AAAA,EACF;AAAA,EACA,MAAc,YAAY,GAAA,EAA4B;AACpD,IAAA,IAAI,KAAK,WAAA,EAAa;AACpB,MAAA,MAAM,IAAA,CAAK,WAAA,CAAY,WAAA,CAAY,GAAG,CAAA;AAEtC,MAAA;AAAA,IACF;AAEA,IAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACjC,MAAA,MAAA,CAAO,YAAA,CAAa,WAAW,GAAG,CAAA;AAAA,IACpC;AAAA,EACF;AACF","file":"index.js","sourcesContent":["import {\n type OAuth2Tokens,\n type OAuth2TokenStorage,\n type PKCEState\n} from '@kivacore/api-client';\n\n/**\n * ElectronAPI interface matching the preload bridge.\n * The Electron template exposes these IPC methods via contextBridge.\n */\nexport interface ElectronStoreAPI {\n storeGet: (key: string) => Promise<string | null>;\n storeSet: (key: string, value: string) => Promise<void>;\n storeDelete: (key: string) => Promise<void>;\n}\n\n/**\n * OAuth2TokenStorage implementation for Electron apps.\n * Stores tokens via IPC bridge to the main process (electron-store).\n * Falls back to localStorage if electronAPI is not available.\n */\nexport class ElectronTokenStorage implements OAuth2TokenStorage {\n private readonly tokensKey: string;\n private readonly pkceKey: string;\n private readonly electronAPI: ElectronStoreAPI | null;\n constructor(\n electronAPI?: ElectronStoreAPI,\n keyPrefix: string = 'docyrus_oauth2'\n ) {\n this.electronAPI = electronAPI\n ?? (typeof window !== 'undefined' ? (window as unknown as Record<string, unknown>).electronAPI as ElectronStoreAPI | undefined : undefined)\n ?? null;\n this.tokensKey = `${keyPrefix}_tokens`;\n this.pkceKey = `${keyPrefix}_pkce`;\n }\n async getTokens(): Promise<OAuth2Tokens | null> {\n const data = await this.storeGet(this.tokensKey);\n\n return data ? JSON.parse(data) : null;\n }\n async setTokens(tokens: OAuth2Tokens): Promise<void> {\n await this.storeSet(this.tokensKey, JSON.stringify(tokens));\n }\n async clearTokens(): Promise<void> {\n await this.storeDelete(this.tokensKey);\n }\n async getPKCEState(): Promise<PKCEState | null> {\n const data = await this.storeGet(this.pkceKey);\n\n return data ? JSON.parse(data) : null;\n }\n async setPKCEState(state: PKCEState): Promise<void> {\n await this.storeSet(this.pkceKey, JSON.stringify(state));\n }\n async clearPKCEState(): Promise<void> {\n await this.storeDelete(this.pkceKey);\n }\n private async storeGet(key: string): Promise<string | null> {\n if (this.electronAPI) {\n return this.electronAPI.storeGet(key);\n }\n\n return typeof window !== 'undefined' ? window.localStorage.getItem(key) : null;\n }\n private async storeSet(key: string, value: string): Promise<void> {\n if (this.electronAPI) {\n await this.electronAPI.storeSet(key, value);\n\n return;\n }\n\n if (typeof window !== 'undefined') {\n window.localStorage.setItem(key, value);\n }\n }\n private async storeDelete(key: string): Promise<void> {\n if (this.electronAPI) {\n await this.electronAPI.storeDelete(key);\n\n return;\n }\n\n if (typeof window !== 'undefined') {\n window.localStorage.removeItem(key);\n }\n }\n}\n\nexport type { OAuth2TokenStorage };\n"]}
1
+ {"version":3,"sources":["../../src/electron/index.ts"],"names":[],"mappings":";AAgBA,IAAM,kBAAA,GAAqB,aAAA;AAE3B,IAAM,iBAAA,GAAoB,gBAAA;AAOnB,IAAM,uBAAN,MAAyD;AAAA,EAC7C,SAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA,iBAAA;AAAA,EACjB,WAAA,CACE,WAAA,EACA,SAAA,GAAoB,kBAAA,EACpB;AACA,IAAA,IAAA,CAAK,oBAAoB,SAAA,KAAc,kBAAA;AACvC,IAAA,IAAA,CAAK,cAAc,WAAA,KACb,OAAO,WAAW,WAAA,GAAe,MAAA,CAA8C,cAA8C,MAAA,CAAA,IAC9H,IAAA;AACL,IAAA,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AAK,WAAA,CAAY,WAAA,CAAY,GAAG,CAAA;AAEtC,MAAA;AAAA,IACF;AAEA,IAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACjC,MAAA,MAAA,CAAO,YAAA,CAAa,WAAW,GAAG,CAAA;AAAA,IACpC;AAAA,EACF;AACF","file":"index.js","sourcesContent":["import {\n type OAuth2Tokens,\n type OAuth2TokenStorage,\n type PKCEState\n} from '@kivacore/api-client';\n\n/**\n * ElectronAPI interface matching the preload bridge.\n * The Electron template exposes these IPC methods via contextBridge.\n */\nexport interface ElectronStoreAPI {\n storeGet: (key: string) => Promise<string | null>;\n storeSet: (key: string, value: string) => Promise<void>;\n storeDelete: (key: string) => Promise<void>;\n}\n\nconst DEFAULT_KEY_PREFIX = 'kiva_oauth2';\n/** Key prefix used before the Kiva rename. Values stored under it move to the default prefix on first read. */\nconst LEGACY_KEY_PREFIX = 'docyrus_oauth2';\n\n/**\n * OAuth2TokenStorage implementation for Electron apps.\n * Stores tokens via IPC bridge to the main process (electron-store).\n * Falls back to localStorage if electronAPI is not available.\n */\nexport class ElectronTokenStorage implements OAuth2TokenStorage {\n private readonly tokensKey: string;\n private readonly pkceKey: string;\n private readonly electronAPI: ElectronStoreAPI | null;\n private readonly migrateLegacyKeys: boolean;\n constructor(\n electronAPI?: ElectronStoreAPI,\n keyPrefix: string = DEFAULT_KEY_PREFIX\n ) {\n this.migrateLegacyKeys = keyPrefix === DEFAULT_KEY_PREFIX;\n this.electronAPI = electronAPI\n ?? (typeof window !== 'undefined' ? (window as unknown as Record<string, unknown>).electronAPI as ElectronStoreAPI | undefined : undefined)\n ?? null;\n this.tokensKey = `${keyPrefix}_tokens`;\n this.pkceKey = `${keyPrefix}_pkce`;\n }\n async getTokens(): Promise<OAuth2Tokens | null> {\n const data = await this.read(this.tokensKey, 'tokens');\n\n return data ? JSON.parse(data) : null;\n }\n async setTokens(tokens: OAuth2Tokens): Promise<void> {\n await this.storeSet(this.tokensKey, JSON.stringify(tokens));\n }\n async clearTokens(): Promise<void> {\n await this.storeDelete(this.tokensKey);\n if (this.migrateLegacyKeys) {\n await this.storeDelete(`${LEGACY_KEY_PREFIX}_tokens`);\n }\n }\n async getPKCEState(): Promise<PKCEState | null> {\n const data = await this.read(this.pkceKey, 'pkce');\n\n return data ? JSON.parse(data) : null;\n }\n async setPKCEState(state: PKCEState): Promise<void> {\n await this.storeSet(this.pkceKey, JSON.stringify(state));\n }\n async clearPKCEState(): Promise<void> {\n await this.storeDelete(this.pkceKey);\n }\n /** Read a key, moving the value stored under the legacy prefix so users stay signed in after upgrading */\n private async read(key: string, suffix: 'tokens' | 'pkce'): Promise<string | null> {\n const data = await this.storeGet(key);\n\n if (data !== null || !this.migrateLegacyKeys) return data;\n const legacyKey = `${LEGACY_KEY_PREFIX}_${suffix}`;\n const legacy = await this.storeGet(legacyKey);\n\n if (legacy !== null) {\n await this.storeSet(key, legacy);\n await this.storeDelete(legacyKey);\n }\n\n return legacy;\n }\n private async storeGet(key: string): Promise<string | null> {\n if (this.electronAPI) {\n return this.electronAPI.storeGet(key);\n }\n\n return typeof window !== 'undefined' ? window.localStorage.getItem(key) : null;\n }\n private async storeSet(key: string, value: string): Promise<void> {\n if (this.electronAPI) {\n await this.electronAPI.storeSet(key, value);\n\n return;\n }\n\n if (typeof window !== 'undefined') {\n window.localStorage.setItem(key, value);\n }\n }\n private async storeDelete(key: string): Promise<void> {\n if (this.electronAPI) {\n await this.electronAPI.storeDelete(key);\n\n return;\n }\n\n if (typeof window !== 'undefined') {\n window.localStorage.removeItem(key);\n }\n }\n}\n\nexport type { OAuth2TokenStorage };\n"]}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- export { D as DocyrusAuthContext, a as DocyrusAuthProvider, b as DocyrusAuthProviderProps, u as useDocyrusAuth, c as useDocyrusClient } from './use-docyrus-client-QqgMT3b9.js';
2
- import { G as GuidyRoute, H as HostNavigationHandler, v as HostNotificationHandler, p as MsGraphClient, w as HostNavigationRequestOptions, h as DocyrusCalendarEventPayload, m as DocyrusSharePayload, i as DocyrusEmailPayload, e as AuthStatus } from './types-DmIgZa_v.js';
3
- export { A as AclOperation, a as AclTargetType, b as AdaptiveCard, x as AppNavigationRequestMessage, y as AppRouteChangeMessage, c as AuthMode, C as CalendarSendAckMessage, z as CalendarSendMessage, B as ChatSendAckMessage, E as ChatSendMessage, F as DocySendAckMessage, I as DocySendMessage, f as DocyrusAclRule, D as DocyrusAuthConfig, g as DocyrusAuthContextValue, J as DocyrusNotification, j as DocyrusPermission, k as DocyrusRole, l as DocyrusShareAdaptiveCardPayload, n as DocyrusShareTextPayload, o as DocyrusUser, K as EmailSendAckMessage, L as EmailSendMessage, N as GuidyCommandHandler, Q as GuidyCommandMessage, S as GuidyElement, T as GuidyElementsMessage, U as GuidyPointAckMessage, V as GuidyPointMessage, W as GuidyRoutesMessage, X as GuidyScanMessage, Y as HostNavigationMessage, Z as HostNotificationMessage, _ as HostSignInMessage, $ as IframeAuth, M as MsGraphAccount, q as MsGraphRequest, a0 as MsGraphRequestMessage, r as MsGraphRequestOptions, s as MsGraphResponse, a1 as MsGraphResponseMessage, t as MsGraphStatus, a2 as MsGraphStatusRequestMessage, a3 as MsGraphStatusResponseMessage, P as PermissionConfig, u as PermissionScope, R as RouteChangePayload, a4 as TokenRefreshRequestMessage } from './types-DmIgZa_v.js';
1
+ import { K as KivaAuthProvider, a as KivaAuthProviderProps, u as useKivaAuth, b as useKivaClient } from './use-kiva-client-JxGnfblw.js';
2
+ export { c as KivaAuthContext } from './use-kiva-client-JxGnfblw.js';
3
+ import { F as GuidyRoute, J as HostNavigationHandler, N as HostNotificationHandler, S as MsGraphClient, M as HostNavigationRequestOptions, c as KivaCalendarEventPayload, i as KivaSharePayload, d as KivaEmailPayload, q as AuthStatus, K as KivaAclRule, a as KivaAuthConfig, b as KivaAuthContextValue, e as KivaNotification, f as KivaPermission, g as KivaRole, h as KivaShareAdaptiveCardPayload, j as KivaShareTextPayload, k as KivaUser } from './types-DF2C4eb6.js';
4
+ export { A as AclOperation, l as AclTargetType, m as AdaptiveCard, n as AppNavigationRequestMessage, o as AppRouteChangeMessage, p as AuthMode, C as CalendarSendAckMessage, r as CalendarSendMessage, s as ChatSendAckMessage, t as ChatSendMessage, D as DocySendAckMessage, u as DocySendMessage, E as EmailSendAckMessage, v as EmailSendMessage, G as GuidyCommandHandler, w as GuidyCommandMessage, x as GuidyElement, y as GuidyElementsMessage, z as GuidyPointAckMessage, B as GuidyPointMessage, H as GuidyRoutesMessage, I as GuidyScanMessage, L as HostNavigationMessage, O as HostNotificationMessage, P as HostSignInMessage, Q as IframeAuth, R as MsGraphAccount, T as MsGraphRequest, U as MsGraphRequestMessage, V as MsGraphRequestOptions, W as MsGraphResponse, X as MsGraphResponseMessage, Y as MsGraphStatus, Z as MsGraphStatusRequestMessage, _ as MsGraphStatusResponseMessage, $ as PermissionConfig, a0 as PermissionScope, a1 as RouteChangePayload, a2 as TokenRefreshRequestMessage } from './types-DF2C4eb6.js';
4
5
  import * as react from 'react';
5
6
  import { CSSProperties, ReactNode } from 'react';
6
- export { A as AuthManager, D as DEFAULT_API_URL, d as DEFAULT_CALLBACK_PATH, a as DEFAULT_OAUTH_SCOPES, e as DEFAULT_SSR_COOKIE_KEY, g as getAllRoles, b as getAllowedOperations, h as hasPermission, c as hasRole } from './constants-jx2_MXlr.js';
7
- export { GuidyBridge, StandaloneOAuth2Auth, detectAuthMode } from './core-index.js';
7
+ export { A as AuthManager, D as DEFAULT_API_URL, b as DEFAULT_CALLBACK_PATH, c as DEFAULT_OAUTH_SCOPES, f as DEFAULT_SSR_COOKIE_KEY, g as getAllRoles, d as getAllowedOperations, h as hasPermission, e as hasRole } from './constants-DbICcNnA.js';
8
+ export { G as GuidyBridge, S as StandaloneOAuth2Auth, d as detectAuthMode } from './auth-detector-CRKg56LT.js';
8
9
  import '@kivacore/api-client';
9
10
 
10
11
  /**
@@ -13,52 +14,52 @@ import '@kivacore/api-client';
13
14
  * scoped to wherever this hook is mounted (typically the app shell).
14
15
  * Safe to call once per app. No-op outside iframe mode.
15
16
  */
16
- declare function useDocyrusHostRouteSync(): void;
17
+ declare function useKivaHostRouteSync(): void;
17
18
  /**
18
19
  * Subscribe to host `navigation` messages from within an embedded iframe/WebView.
19
20
  * The latest handler closure is always invoked — no need to memoize.
20
21
  * No-op in non-iframe modes.
21
22
  */
22
- declare function useDocyrusHostNavigation(handler: HostNavigationHandler): void;
23
+ declare function useKivaHostNavigation(handler: HostNavigationHandler): void;
23
24
  /**
24
25
  * Subscribe to host `notification` messages from within an embedded iframe/WebView.
25
26
  * The latest handler closure is always invoked — no need to memoize.
26
27
  * No-op in non-iframe modes.
27
28
  */
28
- declare function useDocyrusHostNotification(handler: HostNotificationHandler): void;
29
+ declare function useKivaHostNotification(handler: HostNotificationHandler): void;
29
30
  /**
30
31
  * Get a stable function that asks the host shell to navigate to a path/URL
31
32
  * from within an embedded iframe/WebView. The reverse of
32
- * `useDocyrusHostNavigation`. No-op in non-iframe modes.
33
+ * `useKivaHostNavigation`. No-op in non-iframe modes.
33
34
  */
34
- declare function useDocyrusRequestHostNavigation(): (url: string, options?: HostNavigationRequestOptions) => void;
35
+ declare function useKivaRequestHostNavigation(): (url: string, options?: HostNavigationRequestOptions) => void;
35
36
  /**
36
37
  * Declare the routes the host assistant (Guidy) may navigate the user to
37
38
  * inside this embedded app. Re-syncs whenever `routes` changes. Requires
38
39
  * `enableGuidyBridge` on the provider; no-op in non-iframe modes.
39
40
  */
40
- declare function useDocyrusGuidyRoutes(routes: GuidyRoute[]): void;
41
+ declare function useKivaGuidyRoutes(routes: GuidyRoute[]): void;
41
42
  /**
42
43
  * Get a stable function that hands a payload to the host AI assistant (Docy)
43
44
  * from within an embedded iframe/WebView. Resolves when the host acknowledges
44
45
  * delivery; rejects on host error or timeout (and immediately outside iframe
45
46
  * mode). Use for "Send to Docy" buttons/menu items.
46
47
  */
47
- declare function useDocyrusSendToDocy(): (payload: DocyrusSharePayload) => Promise<void>;
48
+ declare function useKivaSendToDocy(): (payload: KivaSharePayload) => Promise<void>;
48
49
  /**
49
50
  * Get a stable function that hands a payload to the host team-chat app from
50
51
  * within an embedded iframe/WebView. Resolves when the host acknowledges
51
52
  * delivery; rejects on host error or timeout (and immediately outside iframe
52
53
  * mode). Use for "Send to Chat" buttons/menu items.
53
54
  */
54
- declare function useDocyrusSendToChat(): (payload: DocyrusSharePayload) => Promise<void>;
55
+ declare function useKivaSendToChat(): (payload: KivaSharePayload) => Promise<void>;
55
56
  /**
56
57
  * Get a stable function that hands a draft email (to/subject/body/cc) to the
57
58
  * host from within an embedded iframe/WebView. Resolves when the host
58
59
  * acknowledges; rejects on host error or timeout (and immediately outside
59
60
  * iframe mode). Use for "Send to Email" buttons/menu items.
60
61
  */
61
- declare function useDocyrusSendToEmail(): (payload: DocyrusEmailPayload) => Promise<void>;
62
+ declare function useKivaSendToEmail(): (payload: KivaEmailPayload) => Promise<void>;
62
63
  /**
63
64
  * Get a stable function that hands a calendar event (subject/description/
64
65
  * participants/start/end) to the host from within an embedded iframe/WebView.
@@ -66,16 +67,16 @@ declare function useDocyrusSendToEmail(): (payload: DocyrusEmailPayload) => Prom
66
67
  * immediately outside iframe mode). Use for "Send to Calendar" buttons/menu
67
68
  * items.
68
69
  */
69
- declare function useDocyrusSendToCalendar(): (payload: DocyrusCalendarEventPayload) => Promise<void>;
70
+ declare function useKivaSendToCalendar(): (payload: KivaCalendarEventPayload) => Promise<void>;
70
71
  /**
71
72
  * Get the client for the host's Microsoft Graph (MSAL) session. Check
72
73
  * `isSignedIn()` and make host-proxied Graph requests. Returns `null` outside
73
74
  * iframe/WebView mode.
74
75
  */
75
- declare function useDocyrusMsGraph(): MsGraphClient | null;
76
+ declare function useKivaMsGraph(): MsGraphClient | null;
76
77
 
77
78
  interface SignInButtonProps {
78
- /** Custom label. Defaults to "Sign in with Docyrus" */
79
+ /** Custom label. Defaults to "Sign in with Kiva" */
79
80
  label?: string;
80
81
  /** CSS class name for the button */
81
82
  className?: string;
@@ -91,7 +92,7 @@ interface SignInButtonProps {
91
92
  disabled?: boolean;
92
93
  }
93
94
  /**
94
- * "Sign in with Docyrus" button.
95
+ * "Sign in with Kiva" button.
95
96
  *
96
97
  * In iframe mode: renders nothing (auth is handled by the host).
97
98
  * When authenticated: renders nothing.
@@ -122,5 +123,60 @@ declare function clearTokenCookie(cookieKey?: string): void;
122
123
  */
123
124
  declare function getTokenFromCookie(cookieKey?: string): string | null;
124
125
 
125
- export { AuthStatus, DocyrusCalendarEventPayload, DocyrusEmailPayload, DocyrusSharePayload, GuidyRoute, HostNavigationHandler, HostNavigationRequestOptions, HostNotificationHandler, MsGraphClient, SignInButton, clearTokenCookie, getTokenFromCookie, syncTokenToCookie, useDocyrusGuidyRoutes, useDocyrusHostNavigation, useDocyrusHostNotification, useDocyrusHostRouteSync, useDocyrusMsGraph, useDocyrusRequestHostNavigation, useDocyrusSendToCalendar, useDocyrusSendToChat, useDocyrusSendToDocy, useDocyrusSendToEmail };
126
- export type { SignInButtonProps };
126
+ /** @deprecated Use `KivaAuthProvider` instead. */
127
+ declare const DocyrusAuthProvider: typeof KivaAuthProvider;
128
+ /** @deprecated Use `KivaAuthContext` instead. */
129
+ declare const DocyrusAuthContext: react.Context<KivaAuthContextValue | null>;
130
+ /** @deprecated Use `KivaAuthProviderProps` instead. */
131
+ type DocyrusAuthProviderProps = KivaAuthProviderProps;
132
+ /** @deprecated Use `useKivaAuth` instead. */
133
+ declare const useDocyrusAuth: typeof useKivaAuth;
134
+ /** @deprecated Use `useKivaClient` instead. */
135
+ declare const useDocyrusClient: typeof useKivaClient;
136
+ /** @deprecated Use `useKivaGuidyRoutes` instead. */
137
+ declare const useDocyrusGuidyRoutes: typeof useKivaGuidyRoutes;
138
+ /** @deprecated Use `useKivaHostNavigation` instead. */
139
+ declare const useDocyrusHostNavigation: typeof useKivaHostNavigation;
140
+ /** @deprecated Use `useKivaHostNotification` instead. */
141
+ declare const useDocyrusHostNotification: typeof useKivaHostNotification;
142
+ /** @deprecated Use `useKivaHostRouteSync` instead. */
143
+ declare const useDocyrusHostRouteSync: typeof useKivaHostRouteSync;
144
+ /** @deprecated Use `useKivaMsGraph` instead. */
145
+ declare const useDocyrusMsGraph: typeof useKivaMsGraph;
146
+ /** @deprecated Use `useKivaRequestHostNavigation` instead. */
147
+ declare const useDocyrusRequestHostNavigation: typeof useKivaRequestHostNavigation;
148
+ /** @deprecated Use `useKivaSendToCalendar` instead. */
149
+ declare const useDocyrusSendToCalendar: typeof useKivaSendToCalendar;
150
+ /** @deprecated Use `useKivaSendToChat` instead. */
151
+ declare const useDocyrusSendToChat: typeof useKivaSendToChat;
152
+ /** @deprecated Use `useKivaSendToDocy` instead. */
153
+ declare const useDocyrusSendToDocy: typeof useKivaSendToDocy;
154
+ /** @deprecated Use `useKivaSendToEmail` instead. */
155
+ declare const useDocyrusSendToEmail: typeof useKivaSendToEmail;
156
+ /** @deprecated Use `KivaAuthContextValue` instead. */
157
+ type DocyrusAuthContextValue = KivaAuthContextValue;
158
+ /** @deprecated Use `KivaAuthConfig` instead. */
159
+ type DocyrusAuthConfig = KivaAuthConfig;
160
+ /** @deprecated Use `KivaUser` instead. */
161
+ type DocyrusUser = KivaUser;
162
+ /** @deprecated Use `KivaRole` instead. */
163
+ type DocyrusRole = KivaRole;
164
+ /** @deprecated Use `KivaAclRule` instead. */
165
+ type DocyrusAclRule = KivaAclRule;
166
+ /** @deprecated Use `KivaPermission` instead. */
167
+ type DocyrusPermission = KivaPermission;
168
+ /** @deprecated Use `KivaNotification` instead. */
169
+ type DocyrusNotification = KivaNotification;
170
+ /** @deprecated Use `KivaSharePayload` instead. */
171
+ type DocyrusSharePayload = KivaSharePayload;
172
+ /** @deprecated Use `KivaShareTextPayload` instead. */
173
+ type DocyrusShareTextPayload = KivaShareTextPayload;
174
+ /** @deprecated Use `KivaShareAdaptiveCardPayload` instead. */
175
+ type DocyrusShareAdaptiveCardPayload = KivaShareAdaptiveCardPayload;
176
+ /** @deprecated Use `KivaEmailPayload` instead. */
177
+ type DocyrusEmailPayload = KivaEmailPayload;
178
+ /** @deprecated Use `KivaCalendarEventPayload` instead. */
179
+ type DocyrusCalendarEventPayload = KivaCalendarEventPayload;
180
+
181
+ export { AuthStatus, DocyrusAuthContext, DocyrusAuthProvider, GuidyRoute, HostNavigationHandler, HostNavigationRequestOptions, HostNotificationHandler, KivaAclRule, KivaAuthConfig, KivaAuthContextValue, KivaAuthProvider, KivaAuthProviderProps, KivaCalendarEventPayload, KivaEmailPayload, KivaNotification, KivaPermission, KivaRole, KivaShareAdaptiveCardPayload, KivaSharePayload, KivaShareTextPayload, KivaUser, MsGraphClient, SignInButton, clearTokenCookie, getTokenFromCookie, syncTokenToCookie, useDocyrusAuth, useDocyrusClient, useDocyrusGuidyRoutes, useDocyrusHostNavigation, useDocyrusHostNotification, useDocyrusHostRouteSync, useDocyrusMsGraph, useDocyrusRequestHostNavigation, useDocyrusSendToCalendar, useDocyrusSendToChat, useDocyrusSendToDocy, useDocyrusSendToEmail, useKivaAuth, useKivaClient, useKivaGuidyRoutes, useKivaHostNavigation, useKivaHostNotification, useKivaHostRouteSync, useKivaMsGraph, useKivaRequestHostNavigation, useKivaSendToCalendar, useKivaSendToChat, useKivaSendToDocy, useKivaSendToEmail };
182
+ export type { DocyrusAclRule, DocyrusAuthConfig, DocyrusAuthContextValue, DocyrusAuthProviderProps, DocyrusCalendarEventPayload, DocyrusEmailPayload, DocyrusNotification, DocyrusPermission, DocyrusRole, DocyrusShareAdaptiveCardPayload, DocyrusSharePayload, DocyrusShareTextPayload, DocyrusUser, SignInButtonProps };