@nibssplc/cams-sdk-react 1.0.0-rc.85 → 1.0.0-rc.86
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.
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { MFAEndpoints } from "./MFAGate";
|
|
2
|
-
interface LoginPageProps {
|
|
2
|
+
export interface LoginPageProps {
|
|
3
3
|
usePassKey?: boolean;
|
|
4
4
|
CredentialsAuthEndpoint?: string;
|
|
5
5
|
useADLogin?: boolean;
|
|
6
6
|
MFAEndpoints: MFAEndpoints;
|
|
7
7
|
PassKeysRegisterProps?: Record<string, unknown>;
|
|
8
|
+
onADLoginSuccess?: () => void;
|
|
8
9
|
}
|
|
9
|
-
declare const DefaultLoginPage: ({ usePassKey, useADLogin, MFAEndpoints, CredentialsAuthEndpoint, PassKeysRegisterProps, }: LoginPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare const DefaultLoginPage: ({ usePassKey, useADLogin, MFAEndpoints, CredentialsAuthEndpoint, PassKeysRegisterProps, onADLoginSuccess, }: LoginPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export default DefaultLoginPage;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1722,12 +1722,12 @@ var ADLoginModal = function (_a) {
|
|
|
1722
1722
|
return (jsxRuntime.jsxs(FormItem, { children: [jsxRuntime.jsx(FormLabel, { children: "Username" }), jsxRuntime.jsx(FormControl, { children: jsxRuntime.jsx(Input, __assign({ className: "h-12", placeholder: "Enter your username" }, field)) }), jsxRuntime.jsx(FormMessage, {})] }));
|
|
1723
1723
|
} }), jsxRuntime.jsx(FormField, { control: form.control, name: "password", render: function (_a) {
|
|
1724
1724
|
var field = _a.field;
|
|
1725
|
-
return (jsxRuntime.jsxs(FormItem, { children: [jsxRuntime.jsx(FormLabel, { children: "Password" }), jsxRuntime.jsx(FormControl, { children: jsxRuntime.jsxs("div", { className: "relative", children: [jsxRuntime.jsx(Input, __assign({ className: "h-12 pr-10", type: "password", placeholder: "Enter your password" }, field)), jsxRuntime.jsx("button", { type: "button", onClick: function () { return setShowPassword(!showPassword); }, className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground", children: showPassword ? (jsxRuntime.jsx(lucideReact.EyeOff, { className: "w-5 h-5" })) : (jsxRuntime.jsx(lucideReact.Eye, { className: "w-5 h-5" })) })] }) }), jsxRuntime.jsx(FormMessage, {})] }));
|
|
1726
|
-
} }), jsxRuntime.jsx(Button, { type: "submit", className: "py-
|
|
1725
|
+
return (jsxRuntime.jsxs(FormItem, { children: [jsxRuntime.jsx(FormLabel, { children: "Password" }), jsxRuntime.jsx(FormControl, { children: jsxRuntime.jsxs("div", { className: "relative", children: [jsxRuntime.jsx(Input, __assign({ className: "h-12 pr-10", type: showPassword ? "text" : "password", placeholder: "Enter your password" }, field)), jsxRuntime.jsx("button", { type: "button", onClick: function () { return setShowPassword(!showPassword); }, className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground", children: showPassword ? (jsxRuntime.jsx(lucideReact.EyeOff, { className: "w-5 h-5" })) : (jsxRuntime.jsx(lucideReact.Eye, { className: "w-5 h-5" })) })] }) }), jsxRuntime.jsx(FormMessage, {})] }));
|
|
1726
|
+
} }), jsxRuntime.jsx(Button, { type: "submit", className: "py-4 w-full bg-[#506f4a] hover:bg-[#506f4a]/90", children: "Continue" })] }) }))) : (jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsx(GenericOTPVerifier, { value: MFACode, setValue: setMFACode, setLoading: setIsLoading, isDisabled: isLoading, onChangeOTP: handleMFASubmit, fieldName: "AuthenticatorCode" }), isLoading && (jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-2 text-sm text-muted-foreground", children: [jsxRuntime.jsx(lucideReact.Loader2, { className: "w-4 h-4 animate-spin" }), jsxRuntime.jsx("span", { children: "Verifying..." })] }))] }))] }) }));
|
|
1727
1727
|
};
|
|
1728
1728
|
|
|
1729
1729
|
var DefaultLoginPage = function (_a) {
|
|
1730
|
-
var usePassKey = _a.usePassKey, useADLogin = _a.useADLogin, MFAEndpoints = _a.MFAEndpoints, CredentialsAuthEndpoint = _a.CredentialsAuthEndpoint, PassKeysRegisterProps = _a.PassKeysRegisterProps;
|
|
1730
|
+
var usePassKey = _a.usePassKey, useADLogin = _a.useADLogin, MFAEndpoints = _a.MFAEndpoints, CredentialsAuthEndpoint = _a.CredentialsAuthEndpoint, PassKeysRegisterProps = _a.PassKeysRegisterProps, onADLoginSuccess = _a.onADLoginSuccess;
|
|
1731
1731
|
var cardVariants = {
|
|
1732
1732
|
hidden: { opacity: 0, scale: 0.8, y: 50 },
|
|
1733
1733
|
visible: {
|
|
@@ -1790,7 +1790,7 @@ var DefaultLoginPage = function (_a) {
|
|
|
1790
1790
|
};
|
|
1791
1791
|
if (showSuccessAnimation && useADLogin) {
|
|
1792
1792
|
return (jsxRuntime.jsx("div", { className: "flex justify-center items-center h-dvh", children: jsxRuntime.jsx(Card, { className: "mx-auto space-y-6 p-6 bg-white rounded-lg shadow-md", children: jsxRuntime.jsx(AuthSuccessAnimation, { onComplete: function () {
|
|
1793
|
-
|
|
1793
|
+
onADLoginSuccess === null || onADLoginSuccess === void 0 ? void 0 : onADLoginSuccess();
|
|
1794
1794
|
} }) }) }));
|
|
1795
1795
|
}
|
|
1796
1796
|
return (jsxRuntime.jsxs("main", { className: "cams-sdk min-h-screen bg-gray-50", children: [jsxRuntime.jsx(framerMotion.motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.5 }, children: jsxRuntime.jsx("div", { className: "flex h-screen items-center justify-center", children: jsxRuntime.jsxs(framerMotion.motion.div, { variants: cardVariants, initial: "hidden", animate: "visible", exit: "exit", className: "w-full max-w-md p-6 space-y-4 rounded-2xl shadow-2xl", children: [jsxRuntime.jsxs(CardHeader, { className: "text-center space-y-3", children: [jsxRuntime.jsx("div", { className: "w-full flex items-center justify-center", children: jsxRuntime.jsx("img", { src: NIBSSLogo, alt: "NIBSS Logo", width: 225, height: 225 }) }), jsxRuntime.jsx(CardTitle, { className: "text-3xl font-bold", children: "NIBSS CAMS" }), jsxRuntime.jsx(CardTitle, { className: "text-gray-500 dark:text-gray-400 font-bold text-lg", children: "Centralized Authentication" })] }), jsxRuntime.jsxs(CardAction, { className: "w-full flex flex-col items-center justify-center text-center text-gray-500 dark:text-gray-400 mb-8", children: [jsxRuntime.jsx("img", { src: AuthLogo, alt: "Auth Logo", width: 365, height: 365 }), "Use Below Identity Providers To Authenticate"] }), jsxRuntime.jsxs("div", { className: "space-y-4", children: [jsxRuntime.jsxs(Button
|
|
@@ -1802,7 +1802,7 @@ var DefaultLoginPage = function (_a) {
|
|
|
1802
1802
|
: "Sign in with ActiveDirectory" })] })), usePassKey && (jsxRuntime.jsxs(Button, { className: "w-full flex items-center justify-center cursor-pointer bg-[#506f4a] hover:bg-[#506f4a] rounded-lg border border-transparent px-5 py-8 text-base font-medium transition-colors duration-250", onClick: function () {
|
|
1803
1803
|
return authentication.HandleRegister(MFAEndpoints.RegisterNewChallenge, MFAEndpoints.RegisterVerify +
|
|
1804
1804
|
"?username=".concat(PassKeysRegisterProps.username), register, PassKeysRegisterProps);
|
|
1805
|
-
}, disabled: isLoading, children: [jsxRuntime.jsx(lucideReact.KeyIcon, { className: "text-[#506f4a]", size: 64 }), jsxRuntime.jsx("span", { children: "Create a Passkey" })] }))] }), jsxRuntime.jsxs(CardFooter, { className: "flex items-center justify-center mt-6 space-x-2 text-gray-400 text-sm", children: [jsxRuntime.jsx(lucideReact.ShieldCheck, { className: "w-4 h-4 text-[#506f4a] pulse-glow" }), jsxRuntime.jsx("span", { children: "Powered By NIBSS" })] })] }) }) }, "landing"), jsxRuntime.jsx(ADLoginModal, { open: showADModal, onOpenChange: setShowADModal, isLoading: isCredAuthLoading, setIsLoading: setIsCredAuthLoading, onLogin: function (_a) { return __awaiter$1(void 0, [_a], void 0, function (_b) {
|
|
1805
|
+
}, disabled: isLoading, children: [jsxRuntime.jsx(lucideReact.KeyIcon, { className: "text-[#506f4a]", size: 64 }), jsxRuntime.jsx("span", { children: "Create a Passkey" })] }))] }), jsxRuntime.jsxs(CardFooter, { className: "flex items-center justify-center mt-6 space-x-2 text-gray-400 text-sm", children: [jsxRuntime.jsx(lucideReact.ShieldCheck, { className: "w-4 h-4 text-[#506f4a] pulse-glow" }), jsxRuntime.jsx("span", { children: "Powered By NIBSS" })] })] }) }) }, "landing"), jsxRuntime.jsx(ADLoginModal, { open: showADModal, onOpenChange: setShowADModal, isLoading: context.isLoading || isCredAuthLoading, setIsLoading: setIsCredAuthLoading, onLogin: function (_a) { return __awaiter$1(void 0, [_a], void 0, function (_b) {
|
|
1806
1806
|
var username = _b.username, password = _b.password, MFACode = _b.MFACode;
|
|
1807
1807
|
return __generator$1(this, function (_c) {
|
|
1808
1808
|
// Implement your AD login logic here
|
|
@@ -1956,7 +1956,7 @@ var MFAGate = function (_a) {
|
|
|
1956
1956
|
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: children });
|
|
1957
1957
|
case "Unauthenticated":
|
|
1958
1958
|
default:
|
|
1959
|
-
return (jsxRuntime.jsx(DefaultLoginPage, { usePassKey: usePassKey, useADLogin: useADLogin, MFAEndpoints: ValidatedMFAEndpoints, PassKeysRegisterProps: PassKeysRegisterProps, CredentialsAuthEndpoint: CredentialsAuthEndpoint }));
|
|
1959
|
+
return (jsxRuntime.jsx(DefaultLoginPage, { usePassKey: usePassKey, useADLogin: useADLogin, MFAEndpoints: ValidatedMFAEndpoints, PassKeysRegisterProps: PassKeysRegisterProps, CredentialsAuthEndpoint: CredentialsAuthEndpoint, onADLoginSuccess: function () { return setAuthState("Authenticated"); } }));
|
|
1960
1960
|
}
|
|
1961
1961
|
};
|
|
1962
1962
|
|