@solidxai/core-ui 0.1.9-beta.0 → 0.1.9-beta.1
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/auth/SolidOTPVerify.d.ts +3 -0
- package/dist/components/auth/SolidOTPVerify.d.ts.map +1 -0
- package/dist/components/auth/SolidOTPVerify.js +67 -0
- package/dist/components/auth/SolidOTPVerify.js.map +1 -0
- package/dist/components/auth/SolidOTPVerify.tsx +133 -0
- package/dist/components/common/AuthBanner.js.map +1 -1
- package/dist/components/core/common/LoadDynamicJsxComponent.d.ts +2 -0
- package/dist/components/core/common/LoadDynamicJsxComponent.d.ts.map +1 -0
- package/dist/components/core/common/LoadDynamicJsxComponent.js +50 -0
- package/dist/components/core/common/LoadDynamicJsxComponent.js.map +1 -0
- package/dist/components/core/common/LoadDynamicJsxComponent.tsx +70 -0
- package/dist/components/core/form/SolidFormActionHeader.d.ts.map +1 -1
- package/dist/components/core/form/SolidFormActionHeader.js +4 -2
- package/dist/components/core/form/SolidFormActionHeader.js.map +1 -1
- package/dist/components/core/form/SolidFormActionHeader.tsx +4 -2
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +2 -2
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +2 -2
- package/dist/components/core/kanban/SolidManyToOneFilterElement.d.ts.map +1 -1
- package/dist/components/core/kanban/SolidManyToOneFilterElement.js.map +1 -1
- package/dist/components/core/kanban/SolidManyToOneFilterElement.tsx +2 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.d.ts.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.js +2 -2
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.js.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaMultipleKanbanField.tsx +10 -21
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.d.ts.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js +2 -2
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.js.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidMediaSingleKanbanField.tsx +10 -18
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.d.ts.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js +6 -3
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.js.map +1 -1
- package/dist/components/core/kanban/kanban-fields/SolidShortTextKanbanField.tsx +24 -30
- package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.js.map +1 -1
- package/dist/components/core/kanban/kanban-fields/relations/SolidRelationManyToOneKanbanField.tsx +2 -2
- package/dist/components/core/list/SolidListViewConfigure.d.ts.map +1 -1
- package/dist/components/core/list/SolidListViewConfigure.js +31 -2
- package/dist/components/core/list/SolidListViewConfigure.js.map +1 -1
- package/dist/components/core/list/SolidListViewConfigure.tsx +34 -2
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.d.ts +1 -1
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.d.ts.map +1 -1
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.js +7 -6
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.js.map +1 -1
- package/dist/components/core/list/SolidListViewRowButtonContextMenu.tsx +10 -9
- package/dist/components/layout/user-profile-menu.d.ts.map +1 -1
- package/dist/components/layout/user-profile-menu.js +2 -1
- package/dist/components/layout/user-profile-menu.js.map +1 -1
- package/dist/components/layout/user-profile-menu.tsx +22 -27
- package/dist/nextAuth/authProviders.d.ts +4 -0
- package/dist/nextAuth/authProviders.d.ts.map +1 -0
- package/dist/nextAuth/authProviders.js +198 -0
- package/dist/nextAuth/authProviders.js.map +1 -0
- package/dist/nextAuth/authProviders.tsx +232 -0
- package/dist/nextAuth/handleLogout.d.ts +2 -0
- package/dist/nextAuth/handleLogout.d.ts.map +1 -0
- package/dist/nextAuth/handleLogout.js +36 -0
- package/dist/nextAuth/handleLogout.js.map +1 -0
- package/dist/nextAuth/handleLogout.tsx +39 -0
- package/dist/nextAuth/refreshAccessToken.d.ts +2 -0
- package/dist/nextAuth/refreshAccessToken.d.ts.map +1 -0
- package/dist/nextAuth/refreshAccessToken.js +24 -0
- package/dist/nextAuth/refreshAccessToken.js.map +1 -0
- package/dist/nextAuth/refreshAccessToken.tsx +28 -0
- package/dist/redux/features/settingsSlice.d.ts +20 -0
- package/dist/redux/features/settingsSlice.d.ts.map +1 -0
- package/dist/redux/features/settingsSlice.js +39 -0
- package/dist/redux/features/settingsSlice.js.map +1 -0
- package/dist/redux/features/settingsSlice.ts +60 -0
- package/dist/resources/globals.css +7 -1
- package/dist/resources/shadcn-base.css +8 -0
- package/package.json +1 -1
- package/dist/components/core/list/SolidDataTablePagination.d.ts +0 -15
- package/dist/components/core/list/SolidDataTablePagination.d.ts.map +0 -1
- package/dist/components/core/list/SolidDataTablePagination.js +0 -22
- package/dist/components/core/list/SolidDataTablePagination.js.map +0 -1
- package/dist/components/core/list/SolidDataTablePagination.tsx +0 -71
- package/dist/components/solid-ui/SolidButton.d.ts +0 -14
- package/dist/components/solid-ui/SolidButton.d.ts.map +0 -1
- package/dist/components/solid-ui/SolidButton.js +0 -36
- package/dist/components/solid-ui/SolidButton.js.map +0 -1
- package/dist/components/solid-ui/SolidButton.tsx +0 -54
- package/dist/components/solid-ui/SolidTabs.d.ts +0 -18
- package/dist/components/solid-ui/SolidTabs.d.ts.map +0 -1
- package/dist/components/solid-ui/SolidTabs.js +0 -22
- package/dist/components/solid-ui/SolidTabs.js.map +0 -1
- package/dist/components/solid-ui/SolidTabs.tsx +0 -73
- package/dist/components/solid-ui/index.d.ts +0 -3
- package/dist/components/solid-ui/index.d.ts.map +0 -1
- package/dist/components/solid-ui/index.js +0 -3
- package/dist/components/solid-ui/index.js.map +0 -1
- package/dist/components/solid-ui/index.ts +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SolidOTPVerify.d.ts","sourceRoot":"./","sources":["components/auth/SolidOTPVerify.tsx"],"names":[],"mappings":"AAiBA,QAAA,MAAM,cAAc,+CAmHnB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Form, Formik } from "formik";
|
|
4
|
+
import { signIn } from "next-auth/react";
|
|
5
|
+
import Link from "next/link";
|
|
6
|
+
import { useRouter } from "next/navigation";
|
|
7
|
+
import { Button } from "primereact/button";
|
|
8
|
+
import { InputOtp } from "primereact/inputotp";
|
|
9
|
+
import { Message } from "primereact/message";
|
|
10
|
+
import { Toast } from "primereact/toast";
|
|
11
|
+
import { useRef, useState } from "react";
|
|
12
|
+
import * as Yup from "yup";
|
|
13
|
+
import { useSelector } from "react-redux";
|
|
14
|
+
import Image from "next/image";
|
|
15
|
+
import SolidLogo from '../../resources/images/SolidXLogo.svg';
|
|
16
|
+
import { ERROR_MESSAGES } from "../../constants/error-messages";
|
|
17
|
+
const SolidOTPVerify = () => {
|
|
18
|
+
// const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();
|
|
19
|
+
// useEffect(() => {
|
|
20
|
+
// trigger("") // Fetch settings on mount
|
|
21
|
+
// }, [trigger])
|
|
22
|
+
const solidSettingsData = useSelector((state) => state.settingsState?.solidSettings);
|
|
23
|
+
const [otp, setOTP] = useState();
|
|
24
|
+
const toast = useRef(null);
|
|
25
|
+
const router = useRouter();
|
|
26
|
+
const [password, setPassword] = useState('');
|
|
27
|
+
const [checked, setChecked] = useState(false);
|
|
28
|
+
const validationSchema = Yup.object({
|
|
29
|
+
email: Yup.string()
|
|
30
|
+
.email(ERROR_MESSAGES.FIELD_INVALID(' email address'))
|
|
31
|
+
.required(ERROR_MESSAGES.FIELD_REUQIRED('Email')),
|
|
32
|
+
});
|
|
33
|
+
const showToast = (severity, summary, detail) => {
|
|
34
|
+
toast.current?.show({
|
|
35
|
+
severity,
|
|
36
|
+
summary,
|
|
37
|
+
detail,
|
|
38
|
+
...(severity === "error"
|
|
39
|
+
? { sticky: true } // stays until user closes
|
|
40
|
+
: { life: 3000 }),
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
const isFormFieldValid = (formik, fieldName) => formik.touched[fieldName] && formik.errors[fieldName];
|
|
44
|
+
return (_jsxs(_Fragment, { children: [_jsx(Toast, { ref: toast }), _jsxs("div", { className: `auth-container ${solidSettingsData?.authPagesLayout === 'center' ? 'center' : 'side'}`, style: { minWidth: 480 }, children: [solidSettingsData?.authPagesLayout === 'center' &&
|
|
45
|
+
_jsx("div", { className: "flex justify-content-center", children: _jsx("div", { className: `solid-logo flex align-items-center ${solidSettingsData?.appLogoPosition}`, children: _jsx(Image, { alt: "solid logo", src: solidSettingsData?.appLogo || SolidLogo, className: "relative", fill: true }) }) }), _jsx("h2", { className: `solid-auth-title ${solidSettingsData?.authPagesLayout === 'center' ? 'text-center' : 'text-left'}`, children: "OTP Verification" }), _jsx("p", { className: "solid-auth-subtitle text-sm", children: "Please enter the OTP sent to your email to complete verification" }), _jsx(_Fragment, { children: _jsx(Formik, { initialValues: {
|
|
46
|
+
email: "",
|
|
47
|
+
password: "",
|
|
48
|
+
}, validationSchema: validationSchema, onSubmit: async (values) => {
|
|
49
|
+
// Handle form submission
|
|
50
|
+
const email = values.email;
|
|
51
|
+
const password = values.password;
|
|
52
|
+
const response = await signIn("credentials", {
|
|
53
|
+
redirect: false,
|
|
54
|
+
email,
|
|
55
|
+
password,
|
|
56
|
+
});
|
|
57
|
+
if (response?.error) {
|
|
58
|
+
showToast("error", ERROR_MESSAGES.LOGIN_ERROR, response.error);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
showToast("success", ERROR_MESSAGES.LOGIN_SUCCESS, ERROR_MESSAGES.DASHBOARD_REDIRECTING);
|
|
62
|
+
router.push(`${process.env.NEXT_PUBLIC_LOGIN_REDIRECT_URL}`);
|
|
63
|
+
}
|
|
64
|
+
}, children: (formik) => (_jsxs(Form, { children: [_jsxs("div", { className: "flex flex-column gap-2 px-3", children: [_jsx("label", { htmlFor: "email", className: "solid-auth-input-label", children: "Enter OTP" }), _jsx(InputOtp, { value: otp, onChange: (e) => setOTP(e.value), length: 6, style: { width: '100%' } }), isFormFieldValid(formik, "email") && _jsx(Message, { className: "text-red-500 text-sm", severity: "error", text: formik?.errors?.email?.toString() }), _jsxs("div", { className: "flex align-items-center justify-content-between", children: [_jsx(Button, { type: "button", icon: 'pi pi-refresh', iconPos: "left", link: true, label: "Resend Code", className: "px-0 text-sm font-normal" }), _jsx("p", { className: "m-0 text-sm text-color", children: "Time left: 00:28" })] })] }), _jsx("div", { className: "mt-4", children: _jsx(Button, { type: "submit", className: "w-full font-light auth-submit-button", label: "Verify", disabled: formik.isSubmitting, loading: formik.isSubmitting }) })] })) }) })] }), _jsx("div", { className: "text-center mt-5", children: _jsxs("div", { className: "text-sm text-400 secondary-dark-color", children: ['<', " Back to ", _jsx(Link, { className: "font-bold", href: "/auth/login", children: "Sign In" })] }) })] }));
|
|
65
|
+
};
|
|
66
|
+
export default SolidOTPVerify;
|
|
67
|
+
//# sourceMappingURL=SolidOTPVerify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SolidOTPVerify.js","sourceRoot":"./","sources":["components/auth/SolidOTPVerify.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MA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,EAAE,QAAQ,EAAE,GACzC,EACF,eAAK,SAAS,EAAC,iDAAiD,aAC5D,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,eAAe,EAAC,OAAO,EAAC,MAAM,EAAC,IAAI,QAAC,KAAK,EAAC,aAAa,EAAC,SAAS,EAAC,0BAA0B,GAAG,EAC1H,YAAG,SAAS,EAAC,wBAAwB,iCAEjC,IACF,IACJ,EACN,cAAK,SAAS,EAAC,MAAM,YACjB,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,sCAAsC,EAAC,KAAK,EAAC,QAAQ,EAAC,QAAQ,EAAE,MAAM,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,YAAY,GAAI,GACnJ,IACH,CACV,GACI,GACV,IACD,EACN,cAAK,SAAS,EAAC,kBAAkB,YAC7B,eAAK,SAAS,EAAC,uCAAuC,aACjD,GAAG,eAAU,KAAC,IAAI,IAAC,SAAS,EAAC,WAAW,EAAC,IAAI,EAAC,aAAa,wBAAe,IACzE,GACJ,IACP,CACN,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["\"use client\";\n\nimport { Form, Formik } from \"formik\";\nimport { signIn } from \"next-auth/react\";\nimport Link from \"next/link\";\nimport { useRouter } from \"next/navigation\";\nimport { Button } from \"primereact/button\";\nimport { InputOtp } from \"primereact/inputotp\";\nimport { Message } from \"primereact/message\";\nimport { Toast } from \"primereact/toast\";\nimport { useRef, useState } from \"react\";\nimport * as Yup from \"yup\";\nimport { useSelector } from \"react-redux\";\nimport Image from \"next/image\";\nimport SolidLogo from '../../resources/images/SolidXLogo.svg'\nimport { ERROR_MESSAGES } from \"../../constants/error-messages\";\n\nconst SolidOTPVerify = () => {\n\n // const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();\n // useEffect(() => {\n // trigger(\"\") // Fetch settings on mount\n // }, [trigger])\n\n const solidSettingsData = useSelector((state: any) => state.settingsState?.solidSettings);\n\n const [otp, setOTP] = useState<number | any>();\n\n const toast = useRef<Toast>(null);\n const router = useRouter();\n\n const [password, setPassword] = useState('');\n const [checked, setChecked] = useState<boolean>(false);\n\n const validationSchema = Yup.object({\n email: Yup.string()\n .email(ERROR_MESSAGES.FIELD_INVALID(' email address'))\n .required(ERROR_MESSAGES.FIELD_REUQIRED('Email')),\n });\n\n const showToast = (severity: \"success\" | \"error\", summary: string, detail: string) => {\n toast.current?.show({\n severity,\n summary,\n detail,\n ...(severity === \"error\"\n ? { sticky: true } // stays until user closes\n : { life: 3000 }),\n });\n };\n\n const isFormFieldValid = (formik: any, fieldName: string) =>\n formik.touched[fieldName] && formik.errors[fieldName];\n\n return (\n <>\n <Toast ref={toast} />\n <div className={`auth-container ${solidSettingsData?.authPagesLayout === 'center' ? 'center' : 'side'}`} style={{ minWidth: 480 }}>\n {solidSettingsData?.authPagesLayout === 'center' &&\n <div className=\"flex justify-content-center\">\n <div className={`solid-logo flex align-items-center ${solidSettingsData?.appLogoPosition}`}>\n <Image\n alt=\"solid logo\"\n src={solidSettingsData?.appLogo || SolidLogo}\n className=\"relative\"\n fill\n />\n </div>\n </div>\n }\n <h2 className={`solid-auth-title ${solidSettingsData?.authPagesLayout === 'center' ? 'text-center' : 'text-left'}`}>OTP Verification</h2>\n <p className=\"solid-auth-subtitle text-sm\">\n Please enter the OTP sent to your email to complete verification\n </p>\n <>\n <Formik\n initialValues={{\n email: \"\",\n password: \"\",\n }}\n validationSchema={validationSchema}\n onSubmit={async (values) => {\n // Handle form submission\n const email = values.email;\n const password = values.password;\n\n const response = await signIn(\"credentials\", {\n redirect: false,\n email,\n password,\n });\n if (response?.error) {\n showToast(\"error\", ERROR_MESSAGES.LOGIN_ERROR, response.error);\n } else {\n showToast(\"success\", ERROR_MESSAGES.LOGIN_SUCCESS, ERROR_MESSAGES.DASHBOARD_REDIRECTING);\n router.push(`${process.env.NEXT_PUBLIC_LOGIN_REDIRECT_URL}`);\n }\n\n }}\n >\n {(formik) => (\n <Form>\n <div className=\"flex flex-column gap-2 px-3\">\n <label htmlFor=\"email\" className=\"solid-auth-input-label\">Enter OTP</label>\n <InputOtp value={otp} onChange={(e) => setOTP(e.value)} length={6} style={{ width: '100%' }} />\n {isFormFieldValid(formik, \"email\") && <Message\n className=\"text-red-500 text-sm\"\n severity=\"error\"\n text={formik?.errors?.email?.toString()}\n />}\n <div className=\"flex align-items-center justify-content-between\">\n <Button type=\"button\" icon='pi pi-refresh' iconPos=\"left\" link label=\"Resend Code\" className=\"px-0 text-sm font-normal\" />\n <p className=\"m-0 text-sm text-color\">\n Time left: 00:28\n </p>\n </div>\n </div>\n <div className=\"mt-4\">\n <Button type=\"submit\" className=\"w-full font-light auth-submit-button\" label=\"Verify\" disabled={formik.isSubmitting} loading={formik.isSubmitting} />\n </div>\n </Form>\n )}\n </Formik>\n </>\n </div>\n <div className=\"text-center mt-5\">\n <div className=\"text-sm text-400 secondary-dark-color\">\n {'<'} Back to <Link className=\"font-bold\" href=\"/auth/login\">Sign In</Link>\n </div>\n </div>\n </>\n );\n};\n\nexport default SolidOTPVerify;"]}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Form, Formik } from "formik";
|
|
4
|
+
import { signIn } from "next-auth/react";
|
|
5
|
+
import Link from "next/link";
|
|
6
|
+
import { useRouter } from "next/navigation";
|
|
7
|
+
import { Button } from "primereact/button";
|
|
8
|
+
import { InputOtp } from "primereact/inputotp";
|
|
9
|
+
import { Message } from "primereact/message";
|
|
10
|
+
import { Toast } from "primereact/toast";
|
|
11
|
+
import { useEffect, useRef, useState } from "react";
|
|
12
|
+
import * as Yup from "yup";
|
|
13
|
+
import Image from "next/image";
|
|
14
|
+
import SolidLogo from '../../resources/images/SolidXLogo.svg'
|
|
15
|
+
import { ERROR_MESSAGES } from "../../constants/error-messages";
|
|
16
|
+
import { useLazyGetAuthSettingsQuery } from "../../redux/api/solidSettingsApi";
|
|
17
|
+
|
|
18
|
+
const SolidOTPVerify = () => {
|
|
19
|
+
|
|
20
|
+
const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
trigger("") // Fetch settings on mount
|
|
23
|
+
}, [trigger])
|
|
24
|
+
|
|
25
|
+
const [otp, setOTP] = useState<number | any>();
|
|
26
|
+
|
|
27
|
+
const toast = useRef<Toast>(null);
|
|
28
|
+
const router = useRouter();
|
|
29
|
+
|
|
30
|
+
const [password, setPassword] = useState('');
|
|
31
|
+
const [checked, setChecked] = useState<boolean>(false);
|
|
32
|
+
|
|
33
|
+
const validationSchema = Yup.object({
|
|
34
|
+
email: Yup.string()
|
|
35
|
+
.email(ERROR_MESSAGES.FIELD_INVALID(' email address'))
|
|
36
|
+
.required(ERROR_MESSAGES.FIELD_REUQIRED('Email')),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const showToast = (severity: "success" | "error", summary: string, detail: string) => {
|
|
40
|
+
toast.current?.show({
|
|
41
|
+
severity,
|
|
42
|
+
summary,
|
|
43
|
+
detail,
|
|
44
|
+
...(severity === "error"
|
|
45
|
+
? { sticky: true } // stays until user closes
|
|
46
|
+
: { life: 3000 }),
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const isFormFieldValid = (formik: any, fieldName: string) =>
|
|
51
|
+
formik.touched[fieldName] && formik.errors[fieldName];
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
<Toast ref={toast} />
|
|
56
|
+
<div className={`auth-container ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'center' : 'side'}`} style={{ minWidth: 480 }}>
|
|
57
|
+
{solidSettingsData?.data?.authPagesLayout === 'center' &&
|
|
58
|
+
<div className="flex justify-content-center">
|
|
59
|
+
<div className={`solid-logo flex align-items-center ${solidSettingsData?.data?.appLogoPosition}`}>
|
|
60
|
+
<Image
|
|
61
|
+
alt="solid logo"
|
|
62
|
+
src={solidSettingsData?.data?.appLogo || SolidLogo}
|
|
63
|
+
className="relative"
|
|
64
|
+
fill
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
}
|
|
69
|
+
<h2 className={`solid-auth-title ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'text-center' : 'text-left'}`}>OTP Verification</h2>
|
|
70
|
+
<p className="solid-auth-subtitle text-sm">
|
|
71
|
+
Please enter the OTP sent to your email to complete verification
|
|
72
|
+
</p>
|
|
73
|
+
<>
|
|
74
|
+
<Formik
|
|
75
|
+
initialValues={{
|
|
76
|
+
email: "",
|
|
77
|
+
password: "",
|
|
78
|
+
}}
|
|
79
|
+
validationSchema={validationSchema}
|
|
80
|
+
onSubmit={async (values) => {
|
|
81
|
+
// Handle form submission
|
|
82
|
+
const email = values.email;
|
|
83
|
+
const password = values.password;
|
|
84
|
+
|
|
85
|
+
const response = await signIn("credentials", {
|
|
86
|
+
redirect: false,
|
|
87
|
+
email,
|
|
88
|
+
password,
|
|
89
|
+
});
|
|
90
|
+
if (response?.error) {
|
|
91
|
+
showToast("error", ERROR_MESSAGES.LOGIN_ERROR, response.error);
|
|
92
|
+
} else {
|
|
93
|
+
showToast("success", ERROR_MESSAGES.LOGIN_SUCCESS, ERROR_MESSAGES.DASHBOARD_REDIRECTING);
|
|
94
|
+
router.push(`${process.env.NEXT_PUBLIC_LOGIN_REDIRECT_URL}`);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
{(formik) => (
|
|
100
|
+
<Form>
|
|
101
|
+
<div className="flex flex-column gap-2 px-3">
|
|
102
|
+
<label htmlFor="email" className="solid-auth-input-label">Enter OTP</label>
|
|
103
|
+
<InputOtp value={otp} onChange={(e) => setOTP(e.value)} length={6} style={{ width: '100%' }} />
|
|
104
|
+
{isFormFieldValid(formik, "email") && <Message
|
|
105
|
+
className="text-red-500 text-sm"
|
|
106
|
+
severity="error"
|
|
107
|
+
text={formik?.errors?.email?.toString()}
|
|
108
|
+
/>}
|
|
109
|
+
<div className="flex align-items-center justify-content-between">
|
|
110
|
+
<Button type="button" icon='pi pi-refresh' iconPos="left" link label="Resend Code" className="px-0 text-sm font-normal" />
|
|
111
|
+
<p className="m-0 text-sm text-color">
|
|
112
|
+
Time left: 00:28
|
|
113
|
+
</p>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
<div className="mt-4">
|
|
117
|
+
<Button type="submit" className="w-full font-light auth-submit-button" label="Verify" disabled={formik.isSubmitting} loading={formik.isSubmitting} />
|
|
118
|
+
</div>
|
|
119
|
+
</Form>
|
|
120
|
+
)}
|
|
121
|
+
</Formik>
|
|
122
|
+
</>
|
|
123
|
+
</div>
|
|
124
|
+
<div className="text-center mt-5">
|
|
125
|
+
<div className="text-sm text-400 secondary-dark-color">
|
|
126
|
+
{'<'} Back to <Link className="font-bold" href="/auth/login">Sign In</Link>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
</>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export default SolidOTPVerify;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthBanner.js","sourceRoot":"","sources":["../../../src/components/common/AuthBanner.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEzC,IAAM,UAAU,GAAG;IACjB,OAAO,CACL,cACE,KAAK,EAAE;YACL,QAAQ,EAAE,UAAU;YACpB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,aAAa;YACrB,UAAU,EAAE,4BAA4B;YACxC,8CAA8C;YAC9C,cAAc,EAAE,OAAO;YACvB,SAAS,EAAE,GAAG,CAAC,6BAA6B,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SAClE,EACD,SAAS,EAAC,yBAAyB,YAEnC,cAAK,SAAS,EAAC,UAAU,YACvB,eAAK,SAAS,EAAC,eAAe,aAC5B,cAAK,SAAS,EAAC,iDAAiD,YAC7D,GAAG,CAAC,iBAAiB,CAAC,GACnB,EACN,cAAK,SAAS,EAAC,kCAAkC,YAC9C,GAAG,CAAC,mCAAmC,CAAC,GACrC,EACN,cAAK,SAAS,EAAC,MAAM,GASf,IACF,GACF,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"
|
|
1
|
+
{"version":3,"file":"AuthBanner.js","sourceRoot":"","sources":["../../../src/components/common/AuthBanner.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEzC,IAAM,UAAU,GAAG;IACjB,OAAO,CACL,cACE,KAAK,EAAE;YACL,QAAQ,EAAE,UAAU;YACpB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,aAAa;YACrB,UAAU,EAAE,4BAA4B;YACxC,8CAA8C;YAC9C,cAAc,EAAE,OAAO;YACvB,SAAS,EAAE,GAAG,CAAC,6BAA6B,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;SAClE,EACD,SAAS,EAAC,yBAAyB,YAEnC,cAAK,SAAS,EAAC,UAAU,YACvB,eAAK,SAAS,EAAC,eAAe,aAC5B,cAAK,SAAS,EAAC,iDAAiD,YAC7D,GAAG,CAAC,iBAAiB,CAAC,GACnB,EACN,cAAK,SAAS,EAAC,kCAAkC,YAC9C,GAAG,CAAC,mCAAmC,CAAC,GACrC,EACN,cAAK,SAAS,EAAC,MAAM,GASf,IACF,GACF,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadDynamicJsxComponent.d.ts","sourceRoot":"./","sources":["components/core/common/LoadDynamicJsxComponent.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,uBAAuB,gBAAiB,GAAG,4CAoDvD,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ERROR_MESSAGES } from "../../../constants/error-messages";
|
|
4
|
+
import dynamic from "next/dynamic";
|
|
5
|
+
import { useState, useEffect } from "react";
|
|
6
|
+
// Fallback component for missing components
|
|
7
|
+
const FallbackComponent = ({ componentName }) => (_jsxs("div", { style: { color: "red" }, children: ["Could not load ", _jsx("strong", { children: componentName })] }));
|
|
8
|
+
export const LoadDynamicJsxComponent = ({ context }) => {
|
|
9
|
+
// const Component = dynamic<Props>(
|
|
10
|
+
// async () => {
|
|
11
|
+
// try {
|
|
12
|
+
// const componentName = context?.rowAction?.action?.customComponent.split('/').pop();
|
|
13
|
+
// const mod = await import();
|
|
14
|
+
// // Return the default export or a named export matching the componentName
|
|
15
|
+
// return mod.default || mod[componentName];
|
|
16
|
+
// } catch (error) {
|
|
17
|
+
// console.error(`Failed to load component "${context?.rowAction?.action?.customComponent}":`, error);
|
|
18
|
+
// // Return a fallback component if the import fails
|
|
19
|
+
// return () => <GenerateModelCodeRowAction context={context} />;
|
|
20
|
+
// }
|
|
21
|
+
// },
|
|
22
|
+
// { ssr: false } // Disable server-side rendering
|
|
23
|
+
// );
|
|
24
|
+
const [Component, setComponent] = useState(null);
|
|
25
|
+
const componentPath = context?.rowAction?.action?.customComponent;
|
|
26
|
+
const componentKey = componentPath?.split("/")?.pop();
|
|
27
|
+
const componentMap = {
|
|
28
|
+
"GenerateModelCodeRowAction": dynamic(() => import("../extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction"), { ssr: false }),
|
|
29
|
+
"GenerateModuleCodeRowAction": dynamic(() => import("../extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction"), { ssr: false }),
|
|
30
|
+
};
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!componentKey)
|
|
33
|
+
return;
|
|
34
|
+
if (componentMap[componentKey]) {
|
|
35
|
+
setComponent(() => () => setComponent(() => componentMap[componentKey]));
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
import(componentPath)
|
|
39
|
+
.then((mod) => setComponent(() => mod.default || mod))
|
|
40
|
+
.catch((err) => {
|
|
41
|
+
console.error(` ${ERROR_MESSAGES.LOADING_COMPONENT} ${componentPath}:`, err);
|
|
42
|
+
setComponent(() => () => _jsx(FallbackComponent, { componentName: componentKey }));
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}, [componentKey]);
|
|
46
|
+
if (!Component)
|
|
47
|
+
return _jsx("p", { children: "Loading..." });
|
|
48
|
+
return _jsx(Component, { context: context });
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=LoadDynamicJsxComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadDynamicJsxComponent.js","sourceRoot":"./","sources":["components/core/common/LoadDynamicJsxComponent.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,4CAA4C;AAC5C,MAAM,iBAAiB,GAAG,CAAC,EAAE,aAAa,EAAO,EAAE,EAAE,CAAC,CAClD,eAAK,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,gCACT,2BAAS,aAAa,GAAU,IAC7C,CACT,CAAC;AAMF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EAAE,OAAO,EAAO,EAAE,EAAE;IAGxD,oCAAoC;IACpC,oBAAoB;IACpB,gBAAgB;IAEhB,kGAAkG;IAClG,0CAA0C;IAC1C,wFAAwF;IACxF,wDAAwD;IACxD,4BAA4B;IAC5B,kHAAkH;IAClH,iEAAiE;IACjE,6EAA6E;IAC7E,YAAY;IACZ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AAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,IAAI,CAAC,SAAS;QAAE,OAAO,qCAAiB,CAAC;IAEzC,OAAO,KAAC,SAAS,IAAC,OAAO,EAAE,OAAO,GAAI,CAAC;AAC3C,CAAC,CAAA","sourcesContent":["'use client';\nimport { ERROR_MESSAGES } from \"../../../constants/error-messages\";\nimport dynamic from \"next/dynamic\";\nimport { useState, useEffect } from \"react\";\n// Fallback component for missing components\nconst FallbackComponent = ({ componentName }: any) => (\n <div style={{ color: \"red\" }}>\n Could not load <strong>{componentName}</strong>\n </div>\n);\n\ntype Props = {\n context: any;\n};\n\nexport const LoadDynamicJsxComponent = ({ context }: any) => {\n\n \n // const Component = dynamic<Props>(\n // async () => {\n // try {\n \n // const componentName = context?.rowAction?.action?.customComponent.split('/').pop();\n // const mod = await import();\n // // Return the default export or a named export matching the componentName\n // return mod.default || mod[componentName];\n // } catch (error) {\n // console.error(`Failed to load component \"${context?.rowAction?.action?.customComponent}\":`, error);\n // // Return a fallback component if the import fails\n // return () => <GenerateModelCodeRowAction context={context} />;\n // }\n // },\n // { ssr: false } // Disable server-side rendering\n // );\n const [Component, setComponent] = useState<any>(null);\n const componentPath = context?.rowAction?.action?.customComponent;\n const componentKey = componentPath?.split(\"/\")?.pop();\n\n const componentMap: Record<string, any> = {\n \"GenerateModelCodeRowAction\": dynamic(\n () => import(\"../extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction\"),\n { ssr: false }\n ),\n \"GenerateModuleCodeRowAction\": dynamic(\n () => import(\"../extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction\"),\n { ssr: false }\n ),\n };\n\n useEffect(() => {\n if (!componentKey) return;\n\n if (componentMap[componentKey]) {\n setComponent(() => () => setComponent(() => componentMap[componentKey]));\n } else {\n import(componentPath)\n .then((mod) => setComponent(() => mod.default || mod))\n .catch((err) => {\n console.error(` ${ERROR_MESSAGES.LOADING_COMPONENT} ${componentPath}:`, err);\n setComponent(() => () => <FallbackComponent componentName={componentKey} />);\n });\n }\n }, [componentKey]);\n\n if (!Component) return <p>Loading...</p>;\n\n return <Component context={context} />;\n}\n\n\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { ERROR_MESSAGES } from "../../../constants/error-messages";
|
|
3
|
+
import dynamic from "next/dynamic";
|
|
4
|
+
import { useState, useEffect } from "react";
|
|
5
|
+
// Fallback component for missing components
|
|
6
|
+
const FallbackComponent = ({ componentName }: any) => (
|
|
7
|
+
<div style={{ color: "red" }}>
|
|
8
|
+
Could not load <strong>{componentName}</strong>
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
context: any;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const LoadDynamicJsxComponent = ({ context }: any) => {
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
// const Component = dynamic<Props>(
|
|
20
|
+
// async () => {
|
|
21
|
+
// try {
|
|
22
|
+
|
|
23
|
+
// const componentName = context?.rowAction?.action?.customComponent.split('/').pop();
|
|
24
|
+
// const mod = await import();
|
|
25
|
+
// // Return the default export or a named export matching the componentName
|
|
26
|
+
// return mod.default || mod[componentName];
|
|
27
|
+
// } catch (error) {
|
|
28
|
+
// console.error(`Failed to load component "${context?.rowAction?.action?.customComponent}":`, error);
|
|
29
|
+
// // Return a fallback component if the import fails
|
|
30
|
+
// return () => <GenerateModelCodeRowAction context={context} />;
|
|
31
|
+
// }
|
|
32
|
+
// },
|
|
33
|
+
// { ssr: false } // Disable server-side rendering
|
|
34
|
+
// );
|
|
35
|
+
const [Component, setComponent] = useState<any>(null);
|
|
36
|
+
const componentPath = context?.rowAction?.action?.customComponent;
|
|
37
|
+
const componentKey = componentPath?.split("/")?.pop();
|
|
38
|
+
|
|
39
|
+
const componentMap: Record<string, any> = {
|
|
40
|
+
"GenerateModelCodeRowAction": dynamic(
|
|
41
|
+
() => import("../extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction"),
|
|
42
|
+
{ ssr: false }
|
|
43
|
+
),
|
|
44
|
+
"GenerateModuleCodeRowAction": dynamic(
|
|
45
|
+
() => import("../extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction"),
|
|
46
|
+
{ ssr: false }
|
|
47
|
+
),
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (!componentKey) return;
|
|
52
|
+
|
|
53
|
+
if (componentMap[componentKey]) {
|
|
54
|
+
setComponent(() => () => setComponent(() => componentMap[componentKey]));
|
|
55
|
+
} else {
|
|
56
|
+
import(componentPath)
|
|
57
|
+
.then((mod) => setComponent(() => mod.default || mod))
|
|
58
|
+
.catch((err) => {
|
|
59
|
+
console.error(` ${ERROR_MESSAGES.LOADING_COMPONENT} ${componentPath}:`, err);
|
|
60
|
+
setComponent(() => () => <FallbackComponent componentName={componentKey} />);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}, [componentKey]);
|
|
64
|
+
|
|
65
|
+
if (!Component) return <p>Loading...</p>;
|
|
66
|
+
|
|
67
|
+
return <Component context={context} />;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolidFormActionHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/core/form/SolidFormActionHeader.tsx"],"names":[],"mappings":"AAgBA,eAAO,MAAM,qBAAqB,0bAA2b,GAAG,
|
|
1
|
+
{"version":3,"file":"SolidFormActionHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/core/form/SolidFormActionHeader.tsx"],"names":[],"mappings":"AAgBA,eAAO,MAAM,qBAAqB,0bAA2b,GAAG,4CAijB/d,CAAA"}
|
|
@@ -31,6 +31,8 @@ export var SolidFormActionHeader = function (_a) {
|
|
|
31
31
|
var user = session === null || session === void 0 ? void 0 : session.user;
|
|
32
32
|
var isPublished = publish && publish !== 'null'; // record is published if publish has value
|
|
33
33
|
var activeHeaderRequestStatusLabel = headerRequestStatusLabel || (isNavigating ? "Loading..." : null);
|
|
34
|
+
var hasUserInteraction = Object.keys((formik === null || formik === void 0 ? void 0 : formik.touched) || {}).length > 0;
|
|
35
|
+
var shouldShowSaveForExistingRecord = viewMode === "edit" && formik.dirty && hasUserInteraction;
|
|
34
36
|
useEffect(function () {
|
|
35
37
|
var _a;
|
|
36
38
|
if (solidView) {
|
|
@@ -194,11 +196,11 @@ export var SolidFormActionHeader = function (_a) {
|
|
|
194
196
|
_jsxs(_Fragment, { children: [_jsx("div", { className: "hidden lg:flex", children: _jsx("div", { children: _jsx(SolidButton, { label: "Edit", size: "sm", onClick: function () { return updateViewMode("edit"); }, type: "button" }) }) }), _jsx("div", { className: "lg:hidden", children: _jsx(SolidButton, { icon: "si si-pencil", size: "sm", onClick: function () { return updateViewMode("edit"); }, type: "button", className: "solid-icon-button" }) })] }), params.embeded !== true &&
|
|
195
197
|
actionsAllowed.includes("".concat(permissionExpression(params.modelName, 'update'))) &&
|
|
196
198
|
!formViewLayout.attrs.readonly &&
|
|
197
|
-
|
|
199
|
+
shouldShowSaveForExistingRecord &&
|
|
198
200
|
_jsxs("div", { children: [_jsx(SolidButton, { label: "Save", size: "sm", type: "submit", className: "hidden lg:flex", loading: isSubmitting, disabled: isSubmitting }), _jsx(SolidButton, { size: "sm", type: "submit", className: "lg:hidden solid-icon-button", icon: "si si-check", loading: isSubmitting, disabled: isSubmitting })] }), params.embeded == true &&
|
|
199
201
|
actionsAllowed.includes("".concat(permissionExpression(params.modelName, 'update'))) &&
|
|
200
202
|
!formViewLayout.attrs.readonly &&
|
|
201
|
-
|
|
203
|
+
shouldShowSaveForExistingRecord &&
|
|
202
204
|
_jsxs("div", { children: [_jsx(SolidButton, { label: "Save", size: "sm", type: "submit", className: "hidden lg:flex", loading: isSubmitting, disabled: isSubmitting }), _jsx(SolidButton, { size: "sm", type: "submit", className: "lg:hidden solid-icon-button", icon: "si si-check", loading: isSubmitting, disabled: isSubmitting })] }), params.embeded == true &&
|
|
203
205
|
actionsAllowed.includes("".concat(permissionExpression(params.modelName, 'delete'))) &&
|
|
204
206
|
((_e = formViewLayout.attrs) === null || _e === void 0 ? void 0 : _e.showDeleteFormButton) !== false &&
|