@nibssplc/cams-sdk-react 1.0.0-rc.113 → 1.0.0-rc.115
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.cjs.js +17 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +18 -6
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -17,7 +17,6 @@ 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');
|
|
21
20
|
var framerMotion = require('framer-motion');
|
|
22
21
|
|
|
23
22
|
function _interopNamespaceDefault(e) {
|
|
@@ -1410,7 +1409,12 @@ function DialogTitle(_a) {
|
|
|
1410
1409
|
var LoadingScreen = function (_a) {
|
|
1411
1410
|
var loadingText = _a.loadingText;
|
|
1412
1411
|
React.useEffect(function () {
|
|
1413
|
-
|
|
1412
|
+
if (typeof window !== "undefined") {
|
|
1413
|
+
import('ldrs').then(function (_a) {
|
|
1414
|
+
var newtonsCradle = _a.newtonsCradle;
|
|
1415
|
+
newtonsCradle.register();
|
|
1416
|
+
});
|
|
1417
|
+
}
|
|
1414
1418
|
}, []);
|
|
1415
1419
|
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: 124, speed: 1.5, 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..." }))] }));
|
|
1416
1420
|
};
|
|
@@ -1687,6 +1691,7 @@ var ADLoginModal = function (_a) {
|
|
|
1687
1691
|
password: "",
|
|
1688
1692
|
}), credentials = _d[0], setCredentials = _d[1];
|
|
1689
1693
|
var _e = React.useState(""), MFACode = _e[0], setMFACode = _e[1];
|
|
1694
|
+
var storageKey = useCAMSContext().storageKey;
|
|
1690
1695
|
var form = reactHookForm.useForm({
|
|
1691
1696
|
resolver: a(credentialsSchema),
|
|
1692
1697
|
defaultValues: { username: "", password: "" },
|
|
@@ -1712,6 +1717,13 @@ var ADLoginModal = function (_a) {
|
|
|
1712
1717
|
password: credentials.password,
|
|
1713
1718
|
MFACode: code,
|
|
1714
1719
|
appCode: "",
|
|
1720
|
+
}).then(function () {
|
|
1721
|
+
localStorage.setItem(storageKey, JSON.stringify({
|
|
1722
|
+
isAuthenticated: true,
|
|
1723
|
+
requiresMFA: false,
|
|
1724
|
+
accessToken: "",
|
|
1725
|
+
idToken: "",
|
|
1726
|
+
}));
|
|
1715
1727
|
})];
|
|
1716
1728
|
case 2:
|
|
1717
1729
|
_a.sent();
|
|
@@ -1722,7 +1734,7 @@ var ADLoginModal = function (_a) {
|
|
|
1722
1734
|
return [3 /*break*/, 5];
|
|
1723
1735
|
case 3:
|
|
1724
1736
|
error_1 = _a.sent();
|
|
1725
|
-
console.error("AD
|
|
1737
|
+
console.error("AD Login Failed:", error_1);
|
|
1726
1738
|
return [3 /*break*/, 5];
|
|
1727
1739
|
case 4:
|
|
1728
1740
|
setIsLoading(false);
|
|
@@ -1743,8 +1755,8 @@ var ADLoginModal = function (_a) {
|
|
|
1743
1755
|
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, {})] }));
|
|
1744
1756
|
} }), jsxRuntime.jsx(FormField, { control: form.control, name: "password", render: function (_a) {
|
|
1745
1757
|
var field = _a.field;
|
|
1746
|
-
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-
|
|
1747
|
-
} }), 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 &&
|
|
1758
|
+
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-4 h-4" })) : (jsxRuntime.jsx(lucideReact.Eye, { className: "w-4 h-4" })) })] }) }), jsxRuntime.jsx(FormMessage, {})] }));
|
|
1759
|
+
} }), 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.jsx(LoadingScreen, {})] }))] }) }));
|
|
1748
1760
|
};
|
|
1749
1761
|
|
|
1750
1762
|
var DefaultLoginPage = function (_a) {
|