@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,32 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { a as KivaAuthConfig, b as KivaAuthContextValue } from './types-DF2C4eb6.js';
4
+ import { RestApiClient } from '@kivacore/api-client';
5
+
6
+ interface KivaAuthProviderProps extends KivaAuthConfig {
7
+ children: ReactNode;
8
+ /** Render a custom screen for a blocking auth error. */
9
+ renderAuthError?: (error: Error) => ReactNode;
10
+ }
11
+ declare function KivaAuthProvider({ children, renderAuthError, ...config }: KivaAuthProviderProps): react.JSX.Element;
12
+
13
+ declare const KivaAuthContext: react.Context<KivaAuthContextValue | null>;
14
+
15
+ /**
16
+ * Hook to access Kiva auth state.
17
+ * Must be used within a <KivaAuthProvider>.
18
+ *
19
+ * Returns: { status, mode, tokens, signIn, signInWithTokens, signOut, client, error }
20
+ */
21
+ declare function useKivaAuth(): KivaAuthContextValue;
22
+
23
+ /**
24
+ * Hook to get the pre-configured RestApiClient.
25
+ * Returns null when not authenticated.
26
+ *
27
+ * Throws if used outside KivaAuthProvider.
28
+ */
29
+ declare function useKivaClient(): RestApiClient | null;
30
+
31
+ export { KivaAuthProvider as K, useKivaClient as b, KivaAuthContext as c, useKivaAuth as u };
32
+ export type { KivaAuthProviderProps as a };
@@ -0,0 +1,345 @@
1
+ import * as vue from 'vue';
2
+ import { PropType } from 'vue';
3
+ import { OAuth2TokenStorage, OAuth2Tokens, RestApiClient } from '@kivacore/api-client';
4
+ import { a as KivaAuthConfig, p as AuthMode, q as AuthStatus, i as KivaSharePayload, d as KivaEmailPayload, c as KivaCalendarEventPayload, S as MsGraphClient, h as KivaShareAdaptiveCardPayload, j as KivaShareTextPayload } from '../types-DF2C4eb6.js';
5
+ import { HostNavigationHandler, HostNotificationHandler, RouteChangePayload, HostNavigationRequestOptions } from '../core-index.js';
6
+ export { m as AdaptiveCard, R as MsGraphAccount, T as MsGraphRequest, V as MsGraphRequestOptions, W as MsGraphResponse, Y as MsGraphStatus } from '../types-DF2C4eb6.js';
7
+
8
+ interface KivaAuthState {
9
+ status: AuthStatus;
10
+ mode: AuthMode | null;
11
+ tokens: OAuth2Tokens | null;
12
+ client: RestApiClient | null;
13
+ error: Error | null;
14
+ signIn: () => void;
15
+ signInWithTokens: (tokens: OAuth2Tokens) => Promise<void>;
16
+ getAuthorizationUrl: () => Promise<string | null>;
17
+ signOut: () => Promise<void>;
18
+ onHostNavigation: (handler: HostNavigationHandler) => () => void;
19
+ onHostNotification: (handler: HostNotificationHandler) => () => void;
20
+ enableHostRouteSync: () => void;
21
+ notifyRouteChange: (payload?: RouteChangePayload) => void;
22
+ requestHostNavigation: (url: string, options?: HostNavigationRequestOptions) => void;
23
+ sendToDocy: (payload: KivaSharePayload) => Promise<void>;
24
+ sendToChat: (payload: KivaSharePayload) => Promise<void>;
25
+ sendToEmail: (payload: KivaEmailPayload) => Promise<void>;
26
+ sendToCalendar: (payload: KivaCalendarEventPayload) => Promise<void>;
27
+ msGraph: MsGraphClient | null;
28
+ }
29
+ /**
30
+ * Vue composable to access Kiva auth state.
31
+ * Must be used within a `<KivaAuthProvider>`.
32
+ *
33
+ * Returns: { status, mode, tokens, signIn, signInWithTokens, signOut, client, error }
34
+ */
35
+ declare function getKivaAuth(): KivaAuthState;
36
+ /** @deprecated Use `getKivaAuth()` instead. */
37
+ declare const useKivaAuth: typeof getKivaAuth;
38
+ /**
39
+ * Vue composable to get the pre-configured RestApiClient.
40
+ * Returns a computed ref that is null when not authenticated.
41
+ */
42
+ declare function getKivaClient(): vue.ComputedRef<RestApiClient | null>;
43
+ /** @deprecated Use `getKivaClient()` instead. */
44
+ declare const useKivaClient: typeof getKivaClient;
45
+ /**
46
+ * Vue provider component that wraps your app with Kiva auth context.
47
+ *
48
+ * Usage:
49
+ * ```vue
50
+ * <template>
51
+ * <KivaAuthProvider :apiUrl="apiUrl">
52
+ * <App />
53
+ * </KivaAuthProvider>
54
+ * </template>
55
+ *
56
+ * <script setup>
57
+ * import { KivaAuthProvider } from '@kivacore/signin/vue';
58
+ * </script>
59
+ * ```
60
+ */
61
+ declare const KivaAuthProvider: vue.DefineComponent<vue.ExtractPropTypes<{
62
+ clientId: {
63
+ type: StringConstructor;
64
+ default: undefined;
65
+ };
66
+ apiUrl: {
67
+ type: StringConstructor;
68
+ default: undefined;
69
+ };
70
+ scopes: {
71
+ type: PropType<string[]>;
72
+ default: undefined;
73
+ };
74
+ redirectUri: {
75
+ type: StringConstructor;
76
+ default: undefined;
77
+ };
78
+ callbackPath: {
79
+ type: StringConstructor;
80
+ default: undefined;
81
+ };
82
+ allowedHostOrigins: {
83
+ type: PropType<string[]>;
84
+ default: undefined;
85
+ };
86
+ storageKeyPrefix: {
87
+ type: StringConstructor;
88
+ default: undefined;
89
+ };
90
+ tokenStorage: {
91
+ type: PropType<OAuth2TokenStorage>;
92
+ default: undefined;
93
+ };
94
+ forceMode: {
95
+ type: PropType<AuthMode>;
96
+ default: undefined;
97
+ };
98
+ initialTokens: {
99
+ type: PropType<OAuth2Tokens>;
100
+ default: undefined;
101
+ };
102
+ syncRouteToHost: {
103
+ type: BooleanConstructor;
104
+ default: boolean;
105
+ };
106
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
107
+ [key: string]: any;
108
+ }> | vue.VNode<vue.RendererNode, vue.RendererElement, {
109
+ [key: string]: any;
110
+ }>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
111
+ clientId: {
112
+ type: StringConstructor;
113
+ default: undefined;
114
+ };
115
+ apiUrl: {
116
+ type: StringConstructor;
117
+ default: undefined;
118
+ };
119
+ scopes: {
120
+ type: PropType<string[]>;
121
+ default: undefined;
122
+ };
123
+ redirectUri: {
124
+ type: StringConstructor;
125
+ default: undefined;
126
+ };
127
+ callbackPath: {
128
+ type: StringConstructor;
129
+ default: undefined;
130
+ };
131
+ allowedHostOrigins: {
132
+ type: PropType<string[]>;
133
+ default: undefined;
134
+ };
135
+ storageKeyPrefix: {
136
+ type: StringConstructor;
137
+ default: undefined;
138
+ };
139
+ tokenStorage: {
140
+ type: PropType<OAuth2TokenStorage>;
141
+ default: undefined;
142
+ };
143
+ forceMode: {
144
+ type: PropType<AuthMode>;
145
+ default: undefined;
146
+ };
147
+ initialTokens: {
148
+ type: PropType<OAuth2Tokens>;
149
+ default: undefined;
150
+ };
151
+ syncRouteToHost: {
152
+ type: BooleanConstructor;
153
+ default: boolean;
154
+ };
155
+ }>> & Readonly<{}>, {
156
+ clientId: string;
157
+ apiUrl: string;
158
+ scopes: string[];
159
+ redirectUri: string;
160
+ callbackPath: string;
161
+ allowedHostOrigins: string[];
162
+ storageKeyPrefix: string;
163
+ tokenStorage: OAuth2TokenStorage;
164
+ forceMode: AuthMode;
165
+ initialTokens: OAuth2Tokens;
166
+ syncRouteToHost: boolean;
167
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
168
+ /**
169
+ * "Sign in with Kiva" button component.
170
+ *
171
+ * In iframe mode: renders nothing (auth is handled by the host).
172
+ * When authenticated: renders nothing.
173
+ *
174
+ * Default look: [Logo] label — or — [Spinner] label (when loading).
175
+ * Use class or the scoped slot for full customization.
176
+ *
177
+ * Usage:
178
+ * ```vue
179
+ * <SignInButton />
180
+ * <SignInButton label="Login" class="btn-primary" />
181
+ * <SignInButton v-slot="{ signIn, isLoading }">
182
+ * <MyCustomButton @click="signIn" :loading="isLoading" />
183
+ * </SignInButton>
184
+ * ```
185
+ */
186
+ declare const SignInButton: vue.DefineComponent<vue.ExtractPropTypes<{
187
+ label: {
188
+ type: StringConstructor;
189
+ default: string;
190
+ };
191
+ disabled: {
192
+ type: BooleanConstructor;
193
+ default: boolean;
194
+ };
195
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
196
+ [key: string]: any;
197
+ }> | vue.VNode<vue.RendererNode, vue.RendererElement, {
198
+ [key: string]: any;
199
+ }>[] | null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
200
+ label: {
201
+ type: StringConstructor;
202
+ default: string;
203
+ };
204
+ disabled: {
205
+ type: BooleanConstructor;
206
+ default: boolean;
207
+ };
208
+ }>> & Readonly<{}>, {
209
+ label: string;
210
+ disabled: boolean;
211
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
212
+
213
+ /** @deprecated Use `getKivaAuth` instead. */
214
+ declare const getDocyrusAuth: typeof getKivaAuth;
215
+ /** @deprecated Use `getKivaClient` instead. */
216
+ declare const getDocyrusClient: typeof getKivaClient;
217
+ /** @deprecated Use `useKivaAuth` instead. */
218
+ declare const useDocyrusAuth: typeof getKivaAuth;
219
+ /** @deprecated Use `useKivaClient` instead. */
220
+ declare const useDocyrusClient: typeof getKivaClient;
221
+ /** @deprecated Use `KivaAuthProvider` instead. */
222
+ declare const DocyrusAuthProvider: vue.DefineComponent<vue.ExtractPropTypes<{
223
+ clientId: {
224
+ type: StringConstructor;
225
+ default: undefined;
226
+ };
227
+ apiUrl: {
228
+ type: StringConstructor;
229
+ default: undefined;
230
+ };
231
+ scopes: {
232
+ type: PropType<string[]>;
233
+ default: undefined;
234
+ };
235
+ redirectUri: {
236
+ type: StringConstructor;
237
+ default: undefined;
238
+ };
239
+ callbackPath: {
240
+ type: StringConstructor;
241
+ default: undefined;
242
+ };
243
+ allowedHostOrigins: {
244
+ type: PropType<string[]>;
245
+ default: undefined;
246
+ };
247
+ storageKeyPrefix: {
248
+ type: StringConstructor;
249
+ default: undefined;
250
+ };
251
+ tokenStorage: {
252
+ type: PropType<OAuth2TokenStorage>;
253
+ default: undefined;
254
+ };
255
+ forceMode: {
256
+ type: PropType<AuthMode>;
257
+ default: undefined;
258
+ };
259
+ initialTokens: {
260
+ type: PropType<OAuth2Tokens>;
261
+ default: undefined;
262
+ };
263
+ syncRouteToHost: {
264
+ type: BooleanConstructor;
265
+ default: boolean;
266
+ };
267
+ }>, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
268
+ [key: string]: any;
269
+ }> | vue.VNode<vue.RendererNode, vue.RendererElement, {
270
+ [key: string]: any;
271
+ }>[] | undefined, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{
272
+ clientId: {
273
+ type: StringConstructor;
274
+ default: undefined;
275
+ };
276
+ apiUrl: {
277
+ type: StringConstructor;
278
+ default: undefined;
279
+ };
280
+ scopes: {
281
+ type: PropType<string[]>;
282
+ default: undefined;
283
+ };
284
+ redirectUri: {
285
+ type: StringConstructor;
286
+ default: undefined;
287
+ };
288
+ callbackPath: {
289
+ type: StringConstructor;
290
+ default: undefined;
291
+ };
292
+ allowedHostOrigins: {
293
+ type: PropType<string[]>;
294
+ default: undefined;
295
+ };
296
+ storageKeyPrefix: {
297
+ type: StringConstructor;
298
+ default: undefined;
299
+ };
300
+ tokenStorage: {
301
+ type: PropType<OAuth2TokenStorage>;
302
+ default: undefined;
303
+ };
304
+ forceMode: {
305
+ type: PropType<AuthMode>;
306
+ default: undefined;
307
+ };
308
+ initialTokens: {
309
+ type: PropType<OAuth2Tokens>;
310
+ default: undefined;
311
+ };
312
+ syncRouteToHost: {
313
+ type: BooleanConstructor;
314
+ default: boolean;
315
+ };
316
+ }>> & Readonly<{}>, {
317
+ clientId: string;
318
+ apiUrl: string;
319
+ scopes: string[];
320
+ redirectUri: string;
321
+ callbackPath: string;
322
+ allowedHostOrigins: string[];
323
+ storageKeyPrefix: string;
324
+ tokenStorage: OAuth2TokenStorage;
325
+ forceMode: AuthMode;
326
+ initialTokens: OAuth2Tokens;
327
+ syncRouteToHost: boolean;
328
+ }, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
329
+ /** @deprecated Use `KivaSharePayload` instead. */
330
+ type DocyrusSharePayload = KivaSharePayload;
331
+ /** @deprecated Use `KivaShareTextPayload` instead. */
332
+ type DocyrusShareTextPayload = KivaShareTextPayload;
333
+ /** @deprecated Use `KivaShareAdaptiveCardPayload` instead. */
334
+ type DocyrusShareAdaptiveCardPayload = KivaShareAdaptiveCardPayload;
335
+ /** @deprecated Use `KivaEmailPayload` instead. */
336
+ type DocyrusEmailPayload = KivaEmailPayload;
337
+ /** @deprecated Use `KivaCalendarEventPayload` instead. */
338
+ type DocyrusCalendarEventPayload = KivaCalendarEventPayload;
339
+ /** @deprecated Use `KivaAuthState` instead. */
340
+ type DocyrusAuthState = KivaAuthState;
341
+ /** @deprecated Use `KivaAuthConfig` instead. */
342
+ type DocyrusAuthConfig = KivaAuthConfig;
343
+
344
+ export { AuthMode, AuthStatus, DocyrusAuthProvider, KivaAuthConfig, KivaAuthProvider, KivaCalendarEventPayload, KivaEmailPayload, KivaShareAdaptiveCardPayload, KivaSharePayload, KivaShareTextPayload, MsGraphClient, SignInButton, getDocyrusAuth, getDocyrusClient, getKivaAuth, getKivaClient, useDocyrusAuth, useDocyrusClient, useKivaAuth, useKivaClient };
345
+ export type { DocyrusAuthConfig, DocyrusAuthState, DocyrusCalendarEventPayload, DocyrusEmailPayload, DocyrusShareAdaptiveCardPayload, DocyrusSharePayload, DocyrusShareTextPayload, KivaAuthState };