academe-kit 0.1.0 → 0.1.2

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/dist/index.d.ts CHANGED
@@ -1,11 +1,76 @@
1
- import React from 'react';
1
+ import React$1 from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { KeycloakLoginOptions, KeycloakPromise } from 'keycloak-js';
4
+ import { ClassValue } from 'clsx';
2
5
 
3
- interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
6
+ interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement> {
4
7
  variant?: 'primary' | 'secondary' | 'outline';
5
8
  size?: 'sm' | 'md' | 'lg';
6
- children: React.ReactNode;
9
+ children: React$1.ReactNode;
7
10
  }
8
- declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
11
+ declare const Button: React$1.ForwardRefExoticComponent<ButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
9
12
 
10
- export { Button };
11
- export type { ButtonProps };
13
+ type ProtectedAppProps = {
14
+ children: React.ReactElement;
15
+ requiredClientRoles?: string[];
16
+ unauthorizedMessage?: string;
17
+ };
18
+ declare const ProtectedApp: React.FC<ProtectedAppProps>;
19
+
20
+ type ProtectedRouterProps$1 = {
21
+ children: React.ReactElement;
22
+ requiredClientRoles: string[];
23
+ };
24
+ declare const ProtectedComponent: React.FC<ProtectedRouterProps$1>;
25
+
26
+ type ProtectedRouterProps = {
27
+ children: React.ReactElement;
28
+ requiredClientRoles?: string[];
29
+ unauthorizedMessage?: string;
30
+ };
31
+ declare const ProtectedRouter: React.FC<ProtectedRouterProps>;
32
+
33
+ declare function Spinner({ className, ...props }: React.ComponentProps<"svg">): react_jsx_runtime.JSX.Element;
34
+
35
+ type AcademeKeycloakContextProps = {
36
+ realm: string;
37
+ hubUrl: string;
38
+ clientId: string;
39
+ keycloakUrl: string;
40
+ children: React.ReactElement;
41
+ };
42
+ type SecurityProviderProps = {
43
+ hubUrl: string;
44
+ children: React.ReactElement;
45
+ };
46
+ type KeycloakUser = {
47
+ name: string;
48
+ lastName: string;
49
+ email: string;
50
+ attributes: {
51
+ school_ids: Array<string>;
52
+ };
53
+ };
54
+ type SecurityContextType = {
55
+ isInitialized: boolean;
56
+ isAuthenticated: () => boolean;
57
+ signOut: () => void | null;
58
+ redirectToHub: (errorMessage: string) => void | null;
59
+ goToLogin: (options?: KeycloakLoginOptions | undefined) => KeycloakPromise<void, void> | null;
60
+ getUser: () => KeycloakUser;
61
+ hasRealmRole: (role: string) => boolean;
62
+ hasClientRole: (role: string, resource?: string) => boolean;
63
+ };
64
+
65
+ declare const AcademeAuthProvider: React.FC<AcademeKeycloakContextProps>;
66
+ declare global {
67
+ interface Window {
68
+ accessToken?: string;
69
+ }
70
+ }
71
+ declare const useAcademeAuth: () => SecurityContextType;
72
+
73
+ declare function cn(...inputs: ClassValue[]): string;
74
+
75
+ export { AcademeAuthProvider, Button, ProtectedApp, ProtectedComponent, ProtectedRouter, Spinner, cn, useAcademeAuth };
76
+ export type { AcademeKeycloakContextProps, ButtonProps, KeycloakUser, SecurityContextType, SecurityProviderProps };