@kivacore/signin 0.0.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.
@@ -0,0 +1,182 @@
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';
5
+ import * as react from 'react';
6
+ import { CSSProperties, ReactNode } from 'react';
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';
9
+ import '@kivacore/api-client';
10
+
11
+ /**
12
+ * Auto-sync the embedded app's route to the host on every history change.
13
+ * Equivalent to setting `syncRouteToHost: true` on the provider, but
14
+ * scoped to wherever this hook is mounted (typically the app shell).
15
+ * Safe to call once per app. No-op outside iframe mode.
16
+ */
17
+ declare function useKivaHostRouteSync(): void;
18
+ /**
19
+ * Subscribe to host `navigation` messages from within an embedded iframe/WebView.
20
+ * The latest handler closure is always invoked — no need to memoize.
21
+ * No-op in non-iframe modes.
22
+ */
23
+ declare function useKivaHostNavigation(handler: HostNavigationHandler): void;
24
+ /**
25
+ * Subscribe to host `notification` messages from within an embedded iframe/WebView.
26
+ * The latest handler closure is always invoked — no need to memoize.
27
+ * No-op in non-iframe modes.
28
+ */
29
+ declare function useKivaHostNotification(handler: HostNotificationHandler): void;
30
+ /**
31
+ * Get a stable function that asks the host shell to navigate to a path/URL
32
+ * from within an embedded iframe/WebView. The reverse of
33
+ * `useKivaHostNavigation`. No-op in non-iframe modes.
34
+ */
35
+ declare function useKivaRequestHostNavigation(): (url: string, options?: HostNavigationRequestOptions) => void;
36
+ /**
37
+ * Declare the routes the host assistant (Guidy) may navigate the user to
38
+ * inside this embedded app. Re-syncs whenever `routes` changes. Requires
39
+ * `enableGuidyBridge` on the provider; no-op in non-iframe modes.
40
+ */
41
+ declare function useKivaGuidyRoutes(routes: GuidyRoute[]): void;
42
+ /**
43
+ * Get a stable function that hands a payload to the host AI assistant (Docy)
44
+ * from within an embedded iframe/WebView. Resolves when the host acknowledges
45
+ * delivery; rejects on host error or timeout (and immediately outside iframe
46
+ * mode). Use for "Send to Docy" buttons/menu items.
47
+ */
48
+ declare function useKivaSendToDocy(): (payload: KivaSharePayload) => Promise<void>;
49
+ /**
50
+ * Get a stable function that hands a payload to the host team-chat app from
51
+ * within an embedded iframe/WebView. Resolves when the host acknowledges
52
+ * delivery; rejects on host error or timeout (and immediately outside iframe
53
+ * mode). Use for "Send to Chat" buttons/menu items.
54
+ */
55
+ declare function useKivaSendToChat(): (payload: KivaSharePayload) => Promise<void>;
56
+ /**
57
+ * Get a stable function that hands a draft email (to/subject/body/cc) to the
58
+ * host from within an embedded iframe/WebView. Resolves when the host
59
+ * acknowledges; rejects on host error or timeout (and immediately outside
60
+ * iframe mode). Use for "Send to Email" buttons/menu items.
61
+ */
62
+ declare function useKivaSendToEmail(): (payload: KivaEmailPayload) => Promise<void>;
63
+ /**
64
+ * Get a stable function that hands a calendar event (subject/description/
65
+ * participants/start/end) to the host from within an embedded iframe/WebView.
66
+ * Resolves when the host acknowledges; rejects on host error or timeout (and
67
+ * immediately outside iframe mode). Use for "Send to Calendar" buttons/menu
68
+ * items.
69
+ */
70
+ declare function useKivaSendToCalendar(): (payload: KivaCalendarEventPayload) => Promise<void>;
71
+ /**
72
+ * Get the client for the host's Microsoft Graph (MSAL) session. Check
73
+ * `isSignedIn()` and make host-proxied Graph requests. Returns `null` outside
74
+ * iframe/WebView mode.
75
+ */
76
+ declare function useKivaMsGraph(): MsGraphClient | null;
77
+
78
+ interface SignInButtonProps {
79
+ /** Custom label. Defaults to "Sign in with Kiva" */
80
+ label?: string;
81
+ /** CSS class name for the button */
82
+ className?: string;
83
+ /** Inline styles */
84
+ style?: CSSProperties;
85
+ /** Custom render function. Receives signIn, isLoading and status. */
86
+ children?: (props: {
87
+ signIn: () => void;
88
+ isLoading: boolean;
89
+ status: AuthStatus;
90
+ }) => ReactNode;
91
+ /** Disable the button */
92
+ disabled?: boolean;
93
+ }
94
+ /**
95
+ * "Sign in with Kiva" button.
96
+ *
97
+ * In iframe mode: renders nothing (auth is handled by the host).
98
+ * When authenticated: renders nothing.
99
+ *
100
+ * Default look: [Logo] label — or — [Spinner] label (when loading).
101
+ * Use className, style, or the render-prop children for full customization.
102
+ */
103
+ declare function SignInButton({ label, className, style, children, disabled }: SignInButtonProps): react.JSX.Element | null;
104
+
105
+ /**
106
+ * Write the access token to a non-httpOnly cookie so that
107
+ * server components (e.g. Next.js `cookies()`) can read it.
108
+ *
109
+ * When `expiresAt` is provided the cookie gets a `max-age` that matches
110
+ * the token lifetime so it survives browser restarts and is automatically
111
+ * removed by the browser once the token expires.
112
+ *
113
+ * On HTTPS origins the `Secure` flag is added automatically.
114
+ */
115
+ declare function syncTokenToCookie(accessToken: string, cookieKey?: string, expiresAt?: number): void;
116
+ /**
117
+ * Remove the SSR token cookie (e.g. on logout).
118
+ */
119
+ declare function clearTokenCookie(cookieKey?: string): void;
120
+ /**
121
+ * Read the access token from the SSR cookie.
122
+ * Useful in client-side code; server components should use `cookies()` instead.
123
+ */
124
+ declare function getTokenFromCookie(cookieKey?: string): string | null;
125
+
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 };