@nibssplc/cams-sdk-react 0.0.1-beta.8 → 0.0.1-beta.9

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,8 @@
1
+ import { ReactNode } from 'react';
2
+ import { PublicClientApplication, Configuration } from '@azure/msal-browser';
3
+ export interface CAMSMSALProviderProps {
4
+ children: ReactNode;
5
+ msalConfig: Configuration;
6
+ msalInstance?: PublicClientApplication;
7
+ }
8
+ export declare function CAMSMSALProvider({ children, msalConfig, msalInstance }: CAMSMSALProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ import { CAMSConfig } from '@nibssplc/cams-sdk';
3
+ import { UseCAMSAuthReturn, UseCAMSAuthOptions } from '../hooks/useCAMSAuth';
4
+ interface CAMSContextValue extends UseCAMSAuthReturn {
5
+ defaultConfig?: Partial<CAMSConfig>;
6
+ }
7
+ export interface CAMSProviderProps extends UseCAMSAuthOptions {
8
+ children: ReactNode;
9
+ defaultConfig?: Partial<CAMSConfig>;
10
+ }
11
+ export declare function CAMSProvider({ children, defaultConfig, ...authOptions }: CAMSProviderProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function useCAMSContext(): CAMSContextValue;
13
+ export {};
@@ -0,0 +1,7 @@
1
+ import React, { ReactNode } from 'react';
2
+ export interface ProtectedRouteProps {
3
+ children: ReactNode;
4
+ fallback?: ReactNode;
5
+ redirectTo?: string;
6
+ }
7
+ export declare function ProtectedRoute({ children, fallback, redirectTo }: ProtectedRouteProps): string | number | true | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ import { CAMSConfig, CAMSError, Profile } from '@nibssplc/cams-sdk';
2
+ export interface UseCAMSAuthOptions {
3
+ storageKey?: string;
4
+ onAuthSuccess?: (token: string) => void;
5
+ onAuthError?: (error: CAMSError) => void;
6
+ onTokenExpired?: () => void;
7
+ }
8
+ export interface UseCAMSAuthReturn {
9
+ login: (config: CAMSConfig) => Promise<void>;
10
+ logout: () => Promise<void>;
11
+ isAuthenticated: boolean;
12
+ isLoading: boolean;
13
+ error: CAMSError | null;
14
+ token: string | null;
15
+ profile: Profile | null;
16
+ }
17
+ export declare function useCAMSAuth(options?: UseCAMSAuthOptions): UseCAMSAuthReturn;
@@ -0,0 +1,23 @@
1
+ import { AccountInfo } from "@azure/msal-browser";
2
+ import { CAMSError, Profile } from "@nibssplc/cams-sdk";
3
+ export interface UseCAMSMSALAuthOptions {
4
+ onAuthSuccess?: (token: string) => void;
5
+ onAuthError?: (error: CAMSError) => void;
6
+ onTokenExpired?: () => void;
7
+ onMFARequired?: (msalToken: string, account: AccountInfo) => void;
8
+ scopes?: string[];
9
+ mfaUrl?: string;
10
+ }
11
+ export interface UseCAMSMSALAuthReturn {
12
+ login: () => Promise<void>;
13
+ logout: () => Promise<void>;
14
+ completeMFA: (mfaToken: string) => void;
15
+ isAuthenticated: boolean;
16
+ isLoading: boolean;
17
+ isMFAPending: boolean;
18
+ error: CAMSError | null;
19
+ token: string | null;
20
+ profile: Profile | null;
21
+ account: AccountInfo | null;
22
+ }
23
+ export declare function useCAMSMSALAuth(options?: UseCAMSMSALAuthOptions): UseCAMSMSALAuthReturn;