@nibssplc/cams-sdk-react 0.0.1-beta.52 → 0.0.1-beta.54
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/components/UnifiedCAMSProvider.d.ts +36 -0
- package/dist/index.cjs.js +1802 -88
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1802 -89
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PublicClientApplication, Configuration } from "@azure/msal-browser";
|
|
3
|
+
import { Profile } from "@nibssplc/cams-sdk";
|
|
4
|
+
import { UseCAMSAuthReturn, UseCAMSAuthOptions } from "../hooks/useCAMSAuth";
|
|
5
|
+
import { UseCAMSMSALAuthReturn, UseCAMSMSALAuthOptions } from "../hooks/useCAMSMSALAuth";
|
|
6
|
+
type AuthMode = "REGULAR" | "MSAL";
|
|
7
|
+
interface BaseCAMSContextValue {
|
|
8
|
+
userProfile: Profile | null;
|
|
9
|
+
setUserProfile: (profile: Profile | null) => void;
|
|
10
|
+
authMode: AuthMode;
|
|
11
|
+
}
|
|
12
|
+
interface RegularCAMSContextValue extends BaseCAMSContextValue, UseCAMSAuthReturn {
|
|
13
|
+
authMode: "REGULAR";
|
|
14
|
+
}
|
|
15
|
+
interface MSALCAMSContextValue extends BaseCAMSContextValue, UseCAMSMSALAuthReturn {
|
|
16
|
+
authMode: "MSAL";
|
|
17
|
+
}
|
|
18
|
+
type CAMSContextValue = RegularCAMSContextValue | MSALCAMSContextValue;
|
|
19
|
+
interface BaseProviderProps {
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
appCode: string;
|
|
22
|
+
}
|
|
23
|
+
interface RegularProviderProps extends BaseProviderProps, Omit<UseCAMSAuthOptions, "appCode"> {
|
|
24
|
+
mode: "REGULAR";
|
|
25
|
+
}
|
|
26
|
+
interface MSALProviderProps extends BaseProviderProps, UseCAMSMSALAuthOptions {
|
|
27
|
+
mode: "MSAL";
|
|
28
|
+
msalConfig: Configuration;
|
|
29
|
+
msalInstance?: PublicClientApplication;
|
|
30
|
+
}
|
|
31
|
+
type UnifiedCAMSProviderProps = RegularProviderProps | MSALProviderProps;
|
|
32
|
+
export declare function UnifiedCAMSProvider(props: UnifiedCAMSProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare function useCAMSContext(): CAMSContextValue;
|
|
34
|
+
export declare const CAMSProvider: (props: Omit<RegularProviderProps, "mode">) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export declare const CAMSMSALProvider: (props: Omit<MSALProviderProps, "mode">) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export {};
|