@nibssplc/cams-sdk-react 0.0.1-beta.92 → 0.0.1-beta.93
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.
|
@@ -2,6 +2,7 @@ import { MFAEndpoints } from "./MFAGate";
|
|
|
2
2
|
interface LoginPageProps {
|
|
3
3
|
usePassKey?: boolean;
|
|
4
4
|
MFAEndpoints: MFAEndpoints;
|
|
5
|
+
PassKeysRegisterProps?: Record<string, unknown>;
|
|
5
6
|
}
|
|
6
|
-
declare const DefaultLoginPage: ({ usePassKey, MFAEndpoints }: LoginPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare const DefaultLoginPage: ({ usePassKey, MFAEndpoints, PassKeysRegisterProps, }: LoginPageProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export default DefaultLoginPage;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1871,7 +1871,7 @@ var MFAOptions = function (_a) {
|
|
|
1871
1871
|
_a.trys.push([0, 4, , 5]);
|
|
1872
1872
|
// 1. Fetch authentication challenge from your server
|
|
1873
1873
|
console.log("Requesting authentication challenge from server...");
|
|
1874
|
-
return [4 /*yield*/, axios.
|
|
1874
|
+
return [4 /*yield*/, axios.post(MFAEndpoints.RetrieveAuthChallenge)];
|
|
1875
1875
|
case 1:
|
|
1876
1876
|
options = (_a.sent()).data;
|
|
1877
1877
|
console.log("Received challenge:", options);
|
|
@@ -1883,7 +1883,7 @@ var MFAOptions = function (_a) {
|
|
|
1883
1883
|
console.log("Authentication assertion received from client:", assertionResponse);
|
|
1884
1884
|
// 3. Send the assertion back to the server for verification
|
|
1885
1885
|
console.log("Sending assertion to server for verification...");
|
|
1886
|
-
return [4 /*yield*/, axios.post(
|
|
1886
|
+
return [4 /*yield*/, axios.post(MFAEndpoints.AuthChallengeVerify, assertionResponse)];
|
|
1887
1887
|
case 3:
|
|
1888
1888
|
_a.sent();
|
|
1889
1889
|
sonner.toast.success("🔑 Sign-in successful!");
|
|
@@ -2075,7 +2075,7 @@ var ADLoginModal = function (_a) {
|
|
|
2075
2075
|
};
|
|
2076
2076
|
|
|
2077
2077
|
var DefaultLoginPage = function (_a) {
|
|
2078
|
-
var usePassKey = _a.usePassKey, MFAEndpoints = _a.MFAEndpoints;
|
|
2078
|
+
var usePassKey = _a.usePassKey, MFAEndpoints = _a.MFAEndpoints, PassKeysRegisterProps = _a.PassKeysRegisterProps;
|
|
2079
2079
|
var context = useCAMSContext();
|
|
2080
2080
|
var login = context.login, isLoading = context.isLoading, authMode = context.authMode;
|
|
2081
2081
|
var _b = React.useState(false), showADModal = _b[0], setShowADModal = _b[1];
|
|
@@ -2099,7 +2099,7 @@ var DefaultLoginPage = function (_a) {
|
|
|
2099
2099
|
},
|
|
2100
2100
|
exit: { opacity: 0, scale: 0.8, y: -50, transition: { duration: 0.3 } },
|
|
2101
2101
|
};
|
|
2102
|
-
var handleRegister = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2102
|
+
var handleRegister = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2103
2103
|
var options, attestationResponse, error_1;
|
|
2104
2104
|
return __generator(this, function (_a) {
|
|
2105
2105
|
switch (_a.label) {
|
|
@@ -2107,7 +2107,7 @@ var DefaultLoginPage = function (_a) {
|
|
|
2107
2107
|
_a.trys.push([0, 4, , 5]);
|
|
2108
2108
|
// 1. Fetch challenge from your server
|
|
2109
2109
|
console.log("Requesting registration challenge from server...");
|
|
2110
|
-
return [4 /*yield*/, axios.
|
|
2110
|
+
return [4 /*yield*/, axios.post(MFAEndpoints.RegisterNewChallenge, __assign({}, data))];
|
|
2111
2111
|
case 1:
|
|
2112
2112
|
options = (_a.sent()).data;
|
|
2113
2113
|
console.log("Received challenge:", options);
|
|
@@ -2140,7 +2140,7 @@ var DefaultLoginPage = function (_a) {
|
|
|
2140
2140
|
// variant="outline"
|
|
2141
2141
|
, {
|
|
2142
2142
|
// variant="outline"
|
|
2143
|
-
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: handleMSALLogin, disabled: isLoading, children: [jsxRuntimeExports.jsx("img", { src: MicrosoftLogo, alt: "Microsoft Logo", width: 35, height: 35 }), jsxRuntimeExports.jsx("span", { className: "ml-2", children: isLoading ? "Logging in..." : "Sign in with Microsoft" })] }), jsxRuntimeExports.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 () { return setShowADModal(true); }, disabled: isLoading, children: [jsxRuntimeExports.jsx(lucideReact.KeyIcon, { className: "w-8 h-8 text-[#506f4a]" }), jsxRuntimeExports.jsx("span", { children: isLoading ? "Logging in..." : "Sign in with ActiveDirectory" })] }), usePassKey && (jsxRuntimeExports.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: handleRegister, disabled: isLoading, children: [jsxRuntimeExports.jsx(lucideReact.KeyIcon, { className: "w-12 h-12 text-[#506f4a]" }), jsxRuntimeExports.jsx("span", { children: "Create a Passkey" })] }))] }), jsxRuntimeExports.jsxs(CardFooter, { className: "flex items-center justify-center mt-6 space-x-2 text-gray-400 text-sm", children: [jsxRuntimeExports.jsx(lucideReact.ShieldCheck, { className: "w-4 h-4 text-[#506f4a] pulse-glow" }), jsxRuntimeExports.jsx("span", { children: "Powered By NIBSS" })] })] }) }) }, "landing"), jsxRuntimeExports.jsx(ADLoginModal, { open: showADModal, onOpenChange: setShowADModal, onLogin: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
2143
|
+
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: handleMSALLogin, disabled: isLoading, children: [jsxRuntimeExports.jsx("img", { src: MicrosoftLogo, alt: "Microsoft Logo", width: 35, height: 35 }), jsxRuntimeExports.jsx("span", { className: "ml-2", children: isLoading ? "Logging in..." : "Sign in with Microsoft" })] }), jsxRuntimeExports.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 () { return setShowADModal(true); }, disabled: isLoading, children: [jsxRuntimeExports.jsx(lucideReact.KeyIcon, { className: "w-8 h-8 text-[#506f4a]" }), jsxRuntimeExports.jsx("span", { children: isLoading ? "Logging in..." : "Sign in with ActiveDirectory" })] }), usePassKey && (jsxRuntimeExports.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 () { return handleRegister(PassKeysRegisterProps); }, disabled: isLoading, children: [jsxRuntimeExports.jsx(lucideReact.KeyIcon, { className: "w-12 h-12 text-[#506f4a]" }), jsxRuntimeExports.jsx("span", { children: "Create a Passkey" })] }))] }), jsxRuntimeExports.jsxs(CardFooter, { className: "flex items-center justify-center mt-6 space-x-2 text-gray-400 text-sm", children: [jsxRuntimeExports.jsx(lucideReact.ShieldCheck, { className: "w-4 h-4 text-[#506f4a] pulse-glow" }), jsxRuntimeExports.jsx("span", { children: "Powered By NIBSS" })] })] }) }) }, "landing"), jsxRuntimeExports.jsx(ADLoginModal, { open: showADModal, onOpenChange: setShowADModal, onLogin: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
2144
2144
|
var username = _b.username, password = _b.password, MFACode = _b.MFACode;
|
|
2145
2145
|
return __generator(this, function (_c) {
|
|
2146
2146
|
// Implement your AD login logic here
|