@nibssplc/cams-sdk-react 1.0.0-rc.107 → 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 -3
- 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 +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -17,6 +17,7 @@ import { Slot } from '@radix-ui/react-slot';
|
|
|
17
17
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
18
18
|
import { cva } from 'class-variance-authority';
|
|
19
19
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
20
|
+
import { newtonsCradle } from 'ldrs';
|
|
20
21
|
import { motion } from 'framer-motion';
|
|
21
22
|
|
|
22
23
|
/******************************************************************************
|
|
@@ -1195,7 +1196,7 @@ const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
|
1195
1196
|
};
|
|
1196
1197
|
const parseAsync = /* @__PURE__*/ _parseAsync($ZodRealError);
|
|
1197
1198
|
|
|
1198
|
-
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]=appendErrors(a,e,n,s,f?[].concat(f,t.message):t.message);}r.shift();}return n}function i
|
|
1199
|
+
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]=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]=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&&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: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&&validateFieldsNatively({},f),{errors:{},values:u.raw?Object.assign({},s):e}})},function(r){if(function(r){return r instanceof $ZodError}(r))return {values:{},errors: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")}
|
|
1199
1200
|
|
|
1200
1201
|
function cn() {
|
|
1201
1202
|
var inputs = [];
|
|
@@ -1311,7 +1312,7 @@ var GenericOTPVerifier = function (_a) {
|
|
|
1311
1312
|
}),
|
|
1312
1313
|
_b));
|
|
1313
1314
|
var form = useForm({
|
|
1314
|
-
resolver: a
|
|
1315
|
+
resolver: a(Schema),
|
|
1315
1316
|
defaultValues: (_c = {}, _c[fieldName] = "", _c),
|
|
1316
1317
|
});
|
|
1317
1318
|
return (jsxs(Card, { className: "relative rounded space-y-4 p-0 m-0 py-8 space-x-6", children: [jsxs(CardHeader, { className: "flex items-center justify-center flex-col gap-2 mt-2 text-center mb-8", children: [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: jsx(RectangleEllipsis, {}) }), jsx(CardTitle, { className: "font-bold text-emerald-700 text-2xl", children: "One-Time-Password (OTP)" }), attemptCount > 0 && (jsx("div", { className: "text-sm mt-2 ".concat(isMaxAttemptsReached ? "text-red-600" : "text-orange-600"), children: isMaxAttemptsReached
|
|
@@ -1385,11 +1386,12 @@ function DialogTitle(_a) {
|
|
|
1385
1386
|
return (jsx(DialogPrimitive.Title, __assign({ "data-slot": "dialog-title", className: cn("text-lg leading-none font-semibold", className) }, props)));
|
|
1386
1387
|
}
|
|
1387
1388
|
|
|
1388
|
-
var
|
|
1389
|
-
|
|
1390
|
-
var LoadingSpinner = function (_a) {
|
|
1389
|
+
var LoadingScreen = function (_a) {
|
|
1391
1390
|
var loadingText = _a.loadingText;
|
|
1392
|
-
|
|
1391
|
+
useEffect(function () {
|
|
1392
|
+
newtonsCradle.register();
|
|
1393
|
+
}, []);
|
|
1394
|
+
return (jsxs("div", { className: "flex flex-col justify-center items-center h-full w-full py-10", children: [jsx("l-newtons-cradle", { size: "35", speed: "1", color: "green" }), loadingText ? (jsx("p", { className: "text-center font-semibold mt-3", children: loadingText })) : (jsx("p", { className: "text-center font-semibold mt-3", children: "Loading..." }))] }));
|
|
1393
1395
|
};
|
|
1394
1396
|
|
|
1395
1397
|
var AuthSuccessAnimation = function (_a) {
|
|
@@ -1630,7 +1632,7 @@ var MFAOptions = function (_a) {
|
|
|
1630
1632
|
}, children: jsxs(DialogContent, { className: "space-y-2 w-[425px] max-w-[80%]", children: [jsx("div", { className: "absolute top-0 left-0 right-0 h-1 bg-gradient-to-r from-lime-400 to-emerald-600" }), jsx(DialogHeader, { className: "w-full", children: jsx(DialogTitle, { className: "text-center", children: "Email OTP" }) }), jsxs("div", { className: "space-y-6", children: [jsx(GenericOTPVerifier, { value: value, setValue: setValue, isDisabled: loading || isMaxAttemptsReached, onChangeOTP: function (code) { return handleSubmitOTP(code); }, fieldName: "EmailOTP", attemptCount: attemptCount, remainingAttempts: remainingAttempts, isMaxAttemptsReached: isMaxAttemptsReached }), jsx(Button, { variant: "ghost", className: "w-full text-sm", onClick: handleGoBack, children: "\u2190 Choose different method" })] })] }) }));
|
|
1631
1633
|
}
|
|
1632
1634
|
else if (authType === "AuthenticatorCode") {
|
|
1633
|
-
content = (jsx(Dialog, { open: otpVisible, onOpenChange: handleGoBack, children: jsxs(DialogContent, { className: "space-y-2 w-[425px] max-w-[80%]", children: [jsx("div", { className: "absolute top-0 left-0 right-0 h-1 bg-gradient-to-r from-lime-400 to-emerald-600" }), jsx(DialogHeader, { className: "w-full", children: jsx(DialogTitle, { className: "text-center", children: "Authenticator App" }) }), loading ? (jsx("div", { className: "p-3 h-full flex justify-center items-center", children: jsx(
|
|
1635
|
+
content = (jsx(Dialog, { open: otpVisible, onOpenChange: handleGoBack, children: jsxs(DialogContent, { className: "space-y-2 w-[425px] max-w-[80%]", children: [jsx("div", { className: "absolute top-0 left-0 right-0 h-1 bg-gradient-to-r from-lime-400 to-emerald-600" }), jsx(DialogHeader, { className: "w-full", children: jsx(DialogTitle, { className: "text-center", children: "Authenticator App" }) }), loading ? (jsx("div", { className: "p-3 h-full flex justify-center items-center", children: jsx(LoadingScreen, {}) })) : (jsxs("div", { className: "space-y-6", children: [jsx(CardDescription, { className: "text-sm text-gray-600 text-center", children: "Enter the 6-digit Code from your Authenticator app" }), jsx(GenericOTPVerifier, { value: value, setValue: setValue, isDisabled: loading || isMaxAttemptsReached, onChangeOTP: function (code) { return handleSubmitOTP(code); }, fieldName: "AuthenticatorCode", attemptCount: attemptCount, remainingAttempts: remainingAttempts, isMaxAttemptsReached: isMaxAttemptsReached }), jsx(Button, { variant: "ghost", className: "w-full text-sm", onClick: handleGoBack, children: "\u2190 Choose different method" })] }))] }) }));
|
|
1634
1636
|
}
|
|
1635
1637
|
return (jsx("div", { className: "cams-sdk flex justify-center items-center h-dvh", children: jsxs(Card, { className: "space-y-6 p-6 rounded-lg shadow-md", children: [jsxs(CardHeader, { children: [jsx("div", { className: "flex justify-center items", children: jsx("img", { src: OTPAuthenticationImg, alt: "NIBSS Logo", width: 265, height: 265 }) }), jsx(CardTitle, { className: "text-3xl font-bold mb-6 text-center", children: "Two-Factor Authentication" }), 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." })] }), jsx(CardContent, { children: content }), jsxs(CardFooter, { className: "flex items-center justify-center mt-6 space-x-2 text-gray-400 text-sm", children: [jsx(ShieldCheck, { className: "w-4 h-4 text-[#506f4a] pulse-glow" }), jsx("span", { children: "Powered By NIBSS" })] })] }) }));
|
|
1636
1638
|
};
|
|
@@ -1661,7 +1663,7 @@ var ADLoginModal = function (_a) {
|
|
|
1661
1663
|
}), credentials = _d[0], setCredentials = _d[1];
|
|
1662
1664
|
var _e = useState(""), MFACode = _e[0], setMFACode = _e[1];
|
|
1663
1665
|
var form = useForm({
|
|
1664
|
-
resolver: a
|
|
1666
|
+
resolver: a(credentialsSchema),
|
|
1665
1667
|
defaultValues: { username: "", password: "" },
|
|
1666
1668
|
});
|
|
1667
1669
|
var handleCredentialsSubmit = function (values) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
@@ -1824,7 +1826,7 @@ var MFAEndpointsSchema = z$1.object({
|
|
|
1824
1826
|
AuthChallengeVerify: z$1.url("MFA AuthChallengeVerify must be a valid URL"),
|
|
1825
1827
|
});
|
|
1826
1828
|
var MFAGate = function (_a) {
|
|
1827
|
-
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? (jsx("div", { className: "h-screen flex items-center justify-center", children: jsx(
|
|
1829
|
+
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? (jsx("div", { className: "h-screen flex items-center justify-center", children: 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;
|
|
1828
1830
|
var context = useCAMSContext();
|
|
1829
1831
|
var _e = useState("Loading"), authState = _e[0], setAuthState = _e[1];
|
|
1830
1832
|
var ValidatedMFAEndpoints = useMemo(function () {
|