@nibssplc/cams-sdk-react 1.0.0-rc.106 → 1.0.0-rc.108
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/Loading.d.ts +2 -4
- package/dist/index.cjs.js +11 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +11 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import "ldrs/react/Waveform.css";
|
|
3
|
-
declare const LoadingSpinner: ({ loadingText }: {
|
|
1
|
+
declare const LoadingScreen: ({ loadingText }: {
|
|
4
2
|
loadingText?: string;
|
|
5
3
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export default
|
|
4
|
+
export default LoadingScreen;
|
package/dist/index.cjs.js
CHANGED
|
@@ -17,6 +17,7 @@ var reactSlot = require('@radix-ui/react-slot');
|
|
|
17
17
|
var LabelPrimitive = require('@radix-ui/react-label');
|
|
18
18
|
var classVarianceAuthority = require('class-variance-authority');
|
|
19
19
|
var DialogPrimitive = require('@radix-ui/react-dialog');
|
|
20
|
+
var ldrs = require('ldrs');
|
|
20
21
|
var framerMotion = require('framer-motion');
|
|
21
22
|
|
|
22
23
|
function _interopNamespaceDefault(e) {
|
|
@@ -1216,7 +1217,7 @@ const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
|
1216
1217
|
};
|
|
1217
1218
|
const parseAsync = /* @__PURE__*/ _parseAsync($ZodRealError);
|
|
1218
1219
|
|
|
1219
|
-
function t(r,e){try{var o=r();}catch(r){return e(r)}return o&&o.then?o.then(void 0,e):o}function s(r,e){for(var n={};r.length;){var t=r[0],s=t.code,i=t.message,a=t.path.join(".");if(!n[a])if("unionErrors"in t){var u=t.unionErrors[0].errors[0];n[a]={message:u.message,type:u.code};}else n[a]={message:i,type:s};if("unionErrors"in t&&t.unionErrors.forEach(function(e){return e.errors.forEach(function(e){return r.push(e)})}),e){var c=n[a].types,f=c&&c[t.code];n[a]=reactHookForm.appendErrors(a,e,n,s,f?[].concat(f,t.message):t.message);}r.shift();}return n}function i
|
|
1220
|
+
function t(r,e){try{var o=r();}catch(r){return e(r)}return o&&o.then?o.then(void 0,e):o}function s(r,e){for(var n={};r.length;){var t=r[0],s=t.code,i=t.message,a=t.path.join(".");if(!n[a])if("unionErrors"in t){var u=t.unionErrors[0].errors[0];n[a]={message:u.message,type:u.code};}else n[a]={message:i,type:s};if("unionErrors"in t&&t.unionErrors.forEach(function(e){return e.errors.forEach(function(e){return r.push(e)})}),e){var c=n[a].types,f=c&&c[t.code];n[a]=reactHookForm.appendErrors(a,e,n,s,f?[].concat(f,t.message):t.message);}r.shift();}return n}function i(r,e){for(var n={};r.length;){var t=r[0],s=t.code,i=t.message,a=t.path.join(".");if(!n[a])if("invalid_union"===t.code&&t.errors.length>0){var u=t.errors[0][0];n[a]={message:u.message,type:u.code};}else n[a]={message:i,type:s};if("invalid_union"===t.code&&t.errors.forEach(function(e){return e.forEach(function(e){return r.push(e)})}),e){var c=n[a].types,f=c&&c[t.code];n[a]=reactHookForm.appendErrors(a,e,n,s,f?[].concat(f,t.message):t.message);}r.shift();}return n}function a(o,a,u){if(void 0===u&&(u={}),function(r){return "_def"in r&&"object"==typeof r._def&&"typeName"in r._def}(o))return function(n,i,c){try{return Promise.resolve(t(function(){return Promise.resolve(o["sync"===u.mode?"parse":"parseAsync"](n,a)).then(function(e){return c.shouldUseNativeValidation&&resolvers.validateFieldsNatively({},c),{errors:{},values:u.raw?Object.assign({},n):e}})},function(r){if(function(r){return Array.isArray(null==r?void 0:r.issues)}(r))return {values:{},errors:resolvers.toNestErrors(s(r.errors,!c.shouldUseNativeValidation&&"all"===c.criteriaMode),c)};throw r}))}catch(r){return Promise.reject(r)}};if(function(r){return "_zod"in r&&"object"==typeof r._zod}(o))return function(s,c,f){try{return Promise.resolve(t(function(){return Promise.resolve(("sync"===u.mode?parse:parseAsync)(o,s,a)).then(function(e){return f.shouldUseNativeValidation&&resolvers.validateFieldsNatively({},f),{errors:{},values:u.raw?Object.assign({},s):e}})},function(r){if(function(r){return r instanceof $ZodError}(r))return {values:{},errors:resolvers.toNestErrors(i(r.issues,!f.shouldUseNativeValidation&&"all"===f.criteriaMode),f)};throw r}))}catch(r){return Promise.reject(r)}};throw new Error("Invalid input: not a Zod schema")}
|
|
1220
1221
|
|
|
1221
1222
|
function cn() {
|
|
1222
1223
|
var inputs = [];
|
|
@@ -1332,7 +1333,7 @@ var GenericOTPVerifier = function (_a) {
|
|
|
1332
1333
|
}),
|
|
1333
1334
|
_b));
|
|
1334
1335
|
var form = reactHookForm.useForm({
|
|
1335
|
-
resolver: a
|
|
1336
|
+
resolver: a(Schema),
|
|
1336
1337
|
defaultValues: (_c = {}, _c[fieldName] = "", _c),
|
|
1337
1338
|
});
|
|
1338
1339
|
return (jsxRuntime.jsxs(Card, { className: "relative rounded space-y-4 p-0 m-0 py-8 space-x-6", children: [jsxRuntime.jsxs(CardHeader, { className: "flex items-center justify-center flex-col gap-2 mt-2 text-center mb-8", children: [jsxRuntime.jsx("div", { className: "w-16 h-16 bg-gradient-to-br from-lime-400 via-green-500 to-emerald-600 rounded-xl flex items-center justify-center text-white text-2xl mb-6 group-hover:scale-110 transition-transform duration-300", children: jsxRuntime.jsx(lucideReact.RectangleEllipsis, {}) }), jsxRuntime.jsx(CardTitle, { className: "font-bold text-emerald-700 text-2xl", children: "One-Time-Password (OTP)" }), attemptCount > 0 && (jsxRuntime.jsx("div", { className: "text-sm mt-2 ".concat(isMaxAttemptsReached ? "text-red-600" : "text-orange-600"), children: isMaxAttemptsReached
|
|
@@ -1406,11 +1407,12 @@ function DialogTitle(_a) {
|
|
|
1406
1407
|
return (jsxRuntime.jsx(DialogPrimitive__namespace.Title, __assign({ "data-slot": "dialog-title", className: cn("text-lg leading-none font-semibold", className) }, props)));
|
|
1407
1408
|
}
|
|
1408
1409
|
|
|
1409
|
-
var
|
|
1410
|
-
|
|
1411
|
-
var LoadingSpinner = function (_a) {
|
|
1410
|
+
var LoadingScreen = function (_a) {
|
|
1412
1411
|
var loadingText = _a.loadingText;
|
|
1413
|
-
|
|
1412
|
+
React.useEffect(function () {
|
|
1413
|
+
ldrs.newtonsCradle.register();
|
|
1414
|
+
}, []);
|
|
1415
|
+
return (jsxRuntime.jsxs("div", { className: "flex flex-col justify-center items-center h-full w-full py-10", children: [jsxRuntime.jsx("l-newtons-cradle", { size: "35", speed: "1", color: "green" }), loadingText ? (jsxRuntime.jsx("p", { className: "text-center font-semibold mt-3", children: loadingText })) : (jsxRuntime.jsx("p", { className: "text-center font-semibold mt-3", children: "Loading..." }))] }));
|
|
1414
1416
|
};
|
|
1415
1417
|
|
|
1416
1418
|
var AuthSuccessAnimation = function (_a) {
|
|
@@ -1651,7 +1653,7 @@ var MFAOptions = function (_a) {
|
|
|
1651
1653
|
}, children: jsxRuntime.jsxs(DialogContent, { className: "space-y-2 w-[425px] max-w-[80%]", children: [jsxRuntime.jsx("div", { className: "absolute top-0 left-0 right-0 h-1 bg-gradient-to-r from-lime-400 to-emerald-600" }), jsxRuntime.jsx(DialogHeader, { className: "w-full", children: jsxRuntime.jsx(DialogTitle, { className: "text-center", children: "Email OTP" }) }), jsxRuntime.jsxs("div", { className: "space-y-6", children: [jsxRuntime.jsx(GenericOTPVerifier, { value: value, setValue: setValue, isDisabled: loading || isMaxAttemptsReached, onChangeOTP: function (code) { return handleSubmitOTP(code); }, fieldName: "EmailOTP", attemptCount: attemptCount, remainingAttempts: remainingAttempts, isMaxAttemptsReached: isMaxAttemptsReached }), jsxRuntime.jsx(Button, { variant: "ghost", className: "w-full text-sm", onClick: handleGoBack, children: "\u2190 Choose different method" })] })] }) }));
|
|
1652
1654
|
}
|
|
1653
1655
|
else if (authType === "AuthenticatorCode") {
|
|
1654
|
-
content = (jsxRuntime.jsx(Dialog, { open: otpVisible, onOpenChange: handleGoBack, children: jsxRuntime.jsxs(DialogContent, { className: "space-y-2 w-[425px] max-w-[80%]", children: [jsxRuntime.jsx("div", { className: "absolute top-0 left-0 right-0 h-1 bg-gradient-to-r from-lime-400 to-emerald-600" }), jsxRuntime.jsx(DialogHeader, { className: "w-full", children: jsxRuntime.jsx(DialogTitle, { className: "text-center", children: "Authenticator App" }) }), loading ? (jsxRuntime.jsx("div", { className: "p-3 h-full flex justify-center items-center", children: jsxRuntime.jsx(
|
|
1656
|
+
content = (jsxRuntime.jsx(Dialog, { open: otpVisible, onOpenChange: handleGoBack, children: jsxRuntime.jsxs(DialogContent, { className: "space-y-2 w-[425px] max-w-[80%]", children: [jsxRuntime.jsx("div", { className: "absolute top-0 left-0 right-0 h-1 bg-gradient-to-r from-lime-400 to-emerald-600" }), jsxRuntime.jsx(DialogHeader, { className: "w-full", children: jsxRuntime.jsx(DialogTitle, { className: "text-center", children: "Authenticator App" }) }), loading ? (jsxRuntime.jsx("div", { className: "p-3 h-full flex justify-center items-center", children: jsxRuntime.jsx(LoadingScreen, {}) })) : (jsxRuntime.jsxs("div", { className: "space-y-6", children: [jsxRuntime.jsx(CardDescription, { className: "text-sm text-gray-600 text-center", children: "Enter the 6-digit Code from your Authenticator app" }), jsxRuntime.jsx(GenericOTPVerifier, { value: value, setValue: setValue, isDisabled: loading || isMaxAttemptsReached, onChangeOTP: function (code) { return handleSubmitOTP(code); }, fieldName: "AuthenticatorCode", attemptCount: attemptCount, remainingAttempts: remainingAttempts, isMaxAttemptsReached: isMaxAttemptsReached }), jsxRuntime.jsx(Button, { variant: "ghost", className: "w-full text-sm", onClick: handleGoBack, children: "\u2190 Choose different method" })] }))] }) }));
|
|
1655
1657
|
}
|
|
1656
1658
|
return (jsxRuntime.jsx("div", { className: "cams-sdk flex justify-center items-center h-dvh", children: jsxRuntime.jsxs(Card, { className: "space-y-6 p-6 rounded-lg shadow-md", children: [jsxRuntime.jsxs(CardHeader, { children: [jsxRuntime.jsx("div", { className: "flex justify-center items", children: jsxRuntime.jsx("img", { src: OTPAuthenticationImg, alt: "NIBSS Logo", width: 265, height: 265 }) }), jsxRuntime.jsx(CardTitle, { className: "text-3xl font-bold mb-6 text-center", children: "Two-Factor Authentication" }), jsxRuntime.jsx(CardTitle, { className: "text-gray-300 text-base -tracking-wide text-center", children: "Your Microsoft account has been validated. Please complete two-factor authentication to continue." })] }), jsxRuntime.jsx(CardContent, { children: content }), 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" })] })] }) }));
|
|
1657
1659
|
};
|
|
@@ -1682,7 +1684,7 @@ var ADLoginModal = function (_a) {
|
|
|
1682
1684
|
}), credentials = _d[0], setCredentials = _d[1];
|
|
1683
1685
|
var _e = React.useState(""), MFACode = _e[0], setMFACode = _e[1];
|
|
1684
1686
|
var form = reactHookForm.useForm({
|
|
1685
|
-
resolver: a
|
|
1687
|
+
resolver: a(credentialsSchema),
|
|
1686
1688
|
defaultValues: { username: "", password: "" },
|
|
1687
1689
|
});
|
|
1688
1690
|
var handleCredentialsSubmit = function (values) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
@@ -1845,7 +1847,7 @@ var MFAEndpointsSchema = z.object({
|
|
|
1845
1847
|
AuthChallengeVerify: z.url("MFA AuthChallengeVerify must be a valid URL"),
|
|
1846
1848
|
});
|
|
1847
1849
|
var MFAGate = function (_a) {
|
|
1848
|
-
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? (jsxRuntime.jsx("div", { className: "h-screen flex items-center justify-center", children: jsxRuntime.jsx(
|
|
1850
|
+
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? (jsxRuntime.jsx("div", { className: "h-screen flex items-center justify-center", children: jsxRuntime.jsx(LoadingScreen, {}) })) : _b, _c = _a.usePassKey, usePassKey = _c === void 0 ? false : _c, _d = _a.useADLogin, useADLogin = _d === void 0 ? false : _d, CredentialsAuthEndpoint = _a.CredentialsAuthEndpoint, PassKeysRegisterProps = _a.PassKeysRegisterProps, MFAEndpoints = _a.MFAEndpoints, requiresMFA = _a.requiresMFA, onAuthSuccess = _a.onAuthSuccess, onAuthError = _a.onAuthError;
|
|
1849
1851
|
var context = useCAMSContext();
|
|
1850
1852
|
var _e = React.useState("Loading"), authState = _e[0], setAuthState = _e[1];
|
|
1851
1853
|
var ValidatedMFAEndpoints = React.useMemo(function () {
|