@nibssplc/cams-sdk-react 1.0.0-rc.63 → 1.0.0-rc.64
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.esm.js
CHANGED
|
@@ -578,7 +578,7 @@ function useCAMSMSALAuth(options) {
|
|
|
578
578
|
switch (_a.label) {
|
|
579
579
|
case 0:
|
|
580
580
|
authenticator = new CAMSMFAAuthenticator();
|
|
581
|
-
return [4 /*yield*/, authenticator.LoginADCredentials(credentials,
|
|
581
|
+
return [4 /*yield*/, authenticator.LoginADCredentials(credentials, CredentialsAuthEndpoint)];
|
|
582
582
|
case 1: return [2 /*return*/, _a.sent()];
|
|
583
583
|
}
|
|
584
584
|
});
|
|
@@ -1451,7 +1451,7 @@ var useCredentialsHandler = function (onAuthComplete) {
|
|
|
1451
1451
|
var _b = useState(0), attemptCount = _b[0], setAttemptCount = _b[1];
|
|
1452
1452
|
var _c = useState(false), isMaxAttemptsReached = _c[0], setIsMaxAttemptsReached = _c[1];
|
|
1453
1453
|
var handleSubmitCredentials = useMemo(function () {
|
|
1454
|
-
return function (CredentialsAuthEndpoint, credentials
|
|
1454
|
+
return function (CredentialsAuthEndpoint, credentials) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
1455
1455
|
var currentAttempt, authenticator, response, error_2, currentAttempt;
|
|
1456
1456
|
return __generator$1(this, function (_a) {
|
|
1457
1457
|
switch (_a.label) {
|
|
@@ -1461,7 +1461,7 @@ var useCredentialsHandler = function (onAuthComplete) {
|
|
|
1461
1461
|
currentAttempt = attemptCount + 1;
|
|
1462
1462
|
setAttemptCount(currentAttempt);
|
|
1463
1463
|
authenticator = new CAMSMFAAuthenticator();
|
|
1464
|
-
return [4 /*yield*/, authenticator.LoginADCredentials(credentials,
|
|
1464
|
+
return [4 /*yield*/, authenticator.LoginADCredentials(credentials, CredentialsAuthEndpoint)];
|
|
1465
1465
|
case 1:
|
|
1466
1466
|
response = _a.sent();
|
|
1467
1467
|
// .then((data) => {
|
|
@@ -1693,6 +1693,7 @@ var ADLoginModal = function (_a) {
|
|
|
1693
1693
|
username: credentials.username,
|
|
1694
1694
|
password: credentials.password,
|
|
1695
1695
|
MFACode: code,
|
|
1696
|
+
appCode: "",
|
|
1696
1697
|
})];
|
|
1697
1698
|
case 2:
|
|
1698
1699
|
_a.sent();
|
|
@@ -1718,13 +1719,13 @@ var ADLoginModal = function (_a) {
|
|
|
1718
1719
|
form.reset();
|
|
1719
1720
|
setMfaCode("");
|
|
1720
1721
|
};
|
|
1721
|
-
return (jsx(Dialog, { open: open, onOpenChange: handleClose, children: jsxs(DialogContent, { className: "min-w-[50vw] max-w-[70vw]", children: [jsx(DialogHeader, { children: jsxs("div", { className: "flex items-center gap-
|
|
1722
|
+
return (jsx(Dialog, { open: open, onOpenChange: handleClose, children: jsxs(DialogContent, { className: "min-w-[50vw] max-w-[70vw]", children: [jsx(DialogHeader, { children: jsxs("div", { className: "flex items-center gap-4", children: [jsx(KeyIcon, { className: "w-8 h-8 text-[#506f4a]" }), jsx(DialogTitle, { className: "text-xl", children: "Sign in with AD Credentials" })] }) }), step === "credentials" ? (jsx(Form, __assign({}, form, { children: jsxs("form", { onSubmit: form.handleSubmit(handleCredentialsSubmit), className: "space-y-6", children: [jsx(FormField, { control: form.control, name: "username", render: function (_a) {
|
|
1722
1723
|
var field = _a.field;
|
|
1723
1724
|
return (jsxs(FormItem, { children: [jsx(FormLabel, { children: "Username" }), jsx(FormControl, { children: jsx(Input, __assign({ className: "h-12", placeholder: "Enter your username" }, field)) }), jsx(FormMessage, {})] }));
|
|
1724
1725
|
} }), jsx(FormField, { control: form.control, name: "password", render: function (_a) {
|
|
1725
1726
|
var field = _a.field;
|
|
1726
1727
|
return (jsxs(FormItem, { children: [jsx(FormLabel, { children: "Password" }), jsx(FormControl, { children: jsx(Input, __assign({ className: "h-12", type: "password", placeholder: "Enter your password" }, field)) }), jsx(FormMessage, {})] }));
|
|
1727
|
-
} }), jsx(Button, { type: "submit", className: "w-full bg-[#506f4a] hover:bg-[#506f4a]/90", children: "Continue" })] }) }))) : (jsxs("div", { className: "space-y-4", children: [jsx(GenericOTPVerifier, { value: mfaCode, setValue: setMfaCode, setLoading: setIsLoading, isDisabled: isLoading, onChangeOTP: handleMFASubmit, fieldName: "AuthenticatorCode" }), isLoading && (jsxs("div", { className: "flex items-center justify-center gap-2 text-sm text-muted-foreground", children: [jsx(Loader2, { className: "w-4 h-4 animate-spin" }), jsx("span", { children: "Verifying..." })] }))] }))] }) }));
|
|
1728
|
+
} }), jsx(Button, { type: "submit", className: "py-3 w-full bg-[#506f4a] hover:bg-[#506f4a]/90", children: "Continue" })] }) }))) : (jsxs("div", { className: "space-y-4", children: [jsx(GenericOTPVerifier, { value: mfaCode, setValue: setMfaCode, setLoading: setIsLoading, isDisabled: isLoading, onChangeOTP: handleMFASubmit, fieldName: "AuthenticatorCode" }), isLoading && (jsxs("div", { className: "flex items-center justify-center gap-2 text-sm text-muted-foreground", children: [jsx(Loader2, { className: "w-4 h-4 animate-spin" }), jsx("span", { children: "Verifying..." })] }))] }))] }) }));
|
|
1728
1729
|
};
|
|
1729
1730
|
|
|
1730
1731
|
var DefaultLoginPage = function (_a) {
|
|
@@ -1779,7 +1780,7 @@ var DefaultLoginPage = function (_a) {
|
|
|
1779
1780
|
console.warn("Regular CAMS login requires configuration");
|
|
1780
1781
|
}
|
|
1781
1782
|
};
|
|
1782
|
-
return (jsxs("main", { className: "cams-sdk min-h-screen bg-gray-50", children: [jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.5 }, children: jsx("div", { className: "flex h-screen items-center justify-center", children: jsxs(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: [jsxs(CardHeader, { className: "text-center space-y-3", children: [jsx("div", { className: "w-full flex items-center justify-center", children: jsx("img", { src: NIBSSLogo, alt: "NIBSS Logo", width:
|
|
1783
|
+
return (jsxs("main", { className: "cams-sdk min-h-screen bg-gray-50", children: [jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.5 }, children: jsx("div", { className: "flex h-screen items-center justify-center", children: jsxs(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: [jsxs(CardHeader, { className: "text-center space-y-3", children: [jsx("div", { className: "w-full flex items-center justify-center", children: jsx("img", { src: NIBSSLogo, alt: "NIBSS Logo", width: 225, height: 225 }) }), jsx(CardTitle, { className: "text-3xl font-bold", children: "NIBSS CAMS" }), jsx(CardTitle, { className: "text-gray-500 dark:text-gray-400 font-bold text-lg", children: "Centralized Authentication" })] }), jsxs(CardAction, { className: "w-full flex flex-col items-center justify-center text-center text-gray-500 dark:text-gray-400 mb-8", children: [jsx("img", { src: AuthLogo, alt: "Auth Logo", width: 365, height: 365 }), "Use Below Identity Providers To Authenticate"] }), jsxs("div", { className: "space-y-4", children: [jsxs(Button
|
|
1783
1784
|
// variant="outline"
|
|
1784
1785
|
, {
|
|
1785
1786
|
// variant="outline"
|
|
@@ -1793,7 +1794,7 @@ var DefaultLoginPage = function (_a) {
|
|
|
1793
1794
|
return __generator$1(this, function (_c) {
|
|
1794
1795
|
// Implement your AD login logic here
|
|
1795
1796
|
console.log("AD Login:", { username: username, MFACode: MFACode });
|
|
1796
|
-
handleSubmitCredentials(CredentialsAuthEndpoint
|
|
1797
|
+
handleSubmitCredentials(CredentialsAuthEndpoint, { username: username, password: password, MFACode: MFACode, appCode: context.appCode });
|
|
1797
1798
|
return [2 /*return*/];
|
|
1798
1799
|
});
|
|
1799
1800
|
}); } })] }));
|