@solidstarters/solid-core-ui 1.1.9 → 1.1.11

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.
Files changed (210) hide show
  1. package/dist/components/auth/SolidForgotPassword.d.ts.map +1 -1
  2. package/dist/components/auth/SolidForgotPassword.js +1 -4
  3. package/dist/components/auth/SolidForgotPassword.js.map +1 -1
  4. package/dist/components/auth/SolidInitialLoginOtp.d.ts +5 -0
  5. package/dist/components/auth/SolidInitialLoginOtp.d.ts.map +1 -0
  6. package/dist/components/auth/SolidInitialLoginOtp.js +122 -0
  7. package/dist/components/auth/SolidInitialLoginOtp.js.map +1 -0
  8. package/dist/components/auth/SolidInitiateRegisterOtp.d.ts +5 -0
  9. package/dist/components/auth/SolidInitiateRegisterOtp.d.ts.map +1 -0
  10. package/dist/components/auth/SolidInitiateRegisterOtp.js +122 -0
  11. package/dist/components/auth/SolidInitiateRegisterOtp.js.map +1 -0
  12. package/dist/components/auth/SolidLogin.d.ts.map +1 -1
  13. package/dist/components/auth/SolidLogin.js +62 -19
  14. package/dist/components/auth/SolidLogin.js.map +1 -1
  15. package/dist/components/auth/SolidOTPVerify.d.ts.map +1 -1
  16. package/dist/components/auth/SolidOTPVerify.js +12 -9
  17. package/dist/components/auth/SolidOTPVerify.js.map +1 -1
  18. package/dist/components/auth/SolidRegister.d.ts.map +1 -1
  19. package/dist/components/auth/SolidRegister.js +123 -75
  20. package/dist/components/auth/SolidRegister.js.map +1 -1
  21. package/dist/components/auth/SolidResetPassword.d.ts.map +1 -1
  22. package/dist/components/auth/SolidResetPassword.js +11 -9
  23. package/dist/components/auth/SolidResetPassword.js.map +1 -1
  24. package/dist/components/common/SocialMediaLogin.d.ts.map +1 -1
  25. package/dist/components/common/SocialMediaLogin.js +4 -2
  26. package/dist/components/common/SocialMediaLogin.js.map +1 -1
  27. package/dist/components/core/extension/dynamicComponentMap.d.ts +3 -0
  28. package/dist/components/core/extension/dynamicComponentMap.d.ts.map +1 -0
  29. package/dist/components/core/extension/dynamicComponentMap.js +6 -0
  30. package/dist/components/core/extension/dynamicComponentMap.js.map +1 -0
  31. package/dist/components/core/filter/SolidManyToOneFilterElement.js +7 -5
  32. package/dist/components/core/filter/SolidManyToOneFilterElement.js.map +1 -1
  33. package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
  34. package/dist/components/core/form/SolidFormView.js +31 -5
  35. package/dist/components/core/form/SolidFormView.js.map +1 -1
  36. package/dist/components/core/form/fields/SolidBooleanField.d.ts.map +1 -1
  37. package/dist/components/core/form/fields/SolidBooleanField.js +5 -1
  38. package/dist/components/core/form/fields/SolidBooleanField.js.map +1 -1
  39. package/dist/components/core/form/fields/SolidDateField.d.ts.map +1 -1
  40. package/dist/components/core/form/fields/SolidDateField.js +5 -1
  41. package/dist/components/core/form/fields/SolidDateField.js.map +1 -1
  42. package/dist/components/core/form/fields/SolidDateTimeField.d.ts.map +1 -1
  43. package/dist/components/core/form/fields/SolidDateTimeField.js +5 -1
  44. package/dist/components/core/form/fields/SolidDateTimeField.js.map +1 -1
  45. package/dist/components/core/form/fields/SolidDecimalField.d.ts.map +1 -1
  46. package/dist/components/core/form/fields/SolidDecimalField.js +5 -1
  47. package/dist/components/core/form/fields/SolidDecimalField.js.map +1 -1
  48. package/dist/components/core/form/fields/SolidIntegerField.d.ts.map +1 -1
  49. package/dist/components/core/form/fields/SolidIntegerField.js +5 -1
  50. package/dist/components/core/form/fields/SolidIntegerField.js.map +1 -1
  51. package/dist/components/core/form/fields/SolidLongTextField.d.ts.map +1 -1
  52. package/dist/components/core/form/fields/SolidLongTextField.js +5 -1
  53. package/dist/components/core/form/fields/SolidLongTextField.js.map +1 -1
  54. package/dist/components/core/form/fields/SolidSelectionStaticField.d.ts.map +1 -1
  55. package/dist/components/core/form/fields/SolidSelectionStaticField.js +14 -5
  56. package/dist/components/core/form/fields/SolidSelectionStaticField.js.map +1 -1
  57. package/dist/components/core/form/fields/SolidShortTextField.d.ts.map +1 -1
  58. package/dist/components/core/form/fields/SolidShortTextField.js +5 -1
  59. package/dist/components/core/form/fields/SolidShortTextField.js.map +1 -1
  60. package/dist/components/core/form/fields/SolidTimeField.d.ts.map +1 -1
  61. package/dist/components/core/form/fields/SolidTimeField.js +5 -1
  62. package/dist/components/core/form/fields/SolidTimeField.js.map +1 -1
  63. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +20 -13
  64. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
  65. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +9 -6
  66. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
  67. package/dist/components/core/hooks/GlobalStateContext.d.ts +11 -0
  68. package/dist/components/core/hooks/GlobalStateContext.d.ts.map +1 -0
  69. package/dist/components/core/hooks/GlobalStateContext.js +17 -0
  70. package/dist/components/core/hooks/GlobalStateContext.js.map +1 -0
  71. package/dist/components/core/list/SolidListView.d.ts.map +1 -1
  72. package/dist/components/core/list/SolidListView.js +31 -9
  73. package/dist/components/core/list/SolidListView.js.map +1 -1
  74. package/dist/components/core/list/SolidManyToOneFilterElement.js +7 -5
  75. package/dist/components/core/list/SolidManyToOneFilterElement.js.map +1 -1
  76. package/dist/components/core/list/columns/SolidBooleanColumn.js +3 -1
  77. package/dist/components/core/list/columns/SolidBooleanColumn.js.map +1 -1
  78. package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js +2 -1
  79. package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js.map +1 -1
  80. package/dist/components/core/model/FieldMetaDataForm.d.ts.map +1 -1
  81. package/dist/components/core/model/FieldMetaDataForm.js +67 -54
  82. package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
  83. package/dist/components/core/model/FieldSelector.js +1 -1
  84. package/dist/components/core/model/FieldSelector.js.map +1 -1
  85. package/dist/components/core/model/ModelMetaData.d.ts.map +1 -1
  86. package/dist/components/core/model/ModelMetaData.js +12 -17
  87. package/dist/components/core/model/ModelMetaData.js.map +1 -1
  88. package/dist/index.d.ts +4 -1
  89. package/dist/index.d.ts.map +1 -1
  90. package/dist/index.js +4 -1
  91. package/dist/index.js.map +1 -1
  92. package/dist/redux/api/authApi.d.ts +5 -1
  93. package/dist/redux/api/authApi.d.ts.map +1 -1
  94. package/dist/redux/api/authApi.js +37 -1
  95. package/dist/redux/api/authApi.js.map +1 -1
  96. package/package.json +1 -1
  97. package/src/components/auth/SolidForgotPassword.tsx +0 -2
  98. package/src/components/auth/SolidInitialLoginOtp.tsx +134 -0
  99. package/src/components/auth/SolidInitiateRegisterOtp.tsx +134 -0
  100. package/src/components/auth/SolidLogin.tsx +72 -17
  101. package/src/components/auth/SolidOTPVerify.tsx +9 -6
  102. package/src/components/auth/SolidRegister.tsx +205 -154
  103. package/src/components/auth/SolidResetPassword.tsx +9 -7
  104. package/src/components/common/SocialMediaLogin.tsx +6 -1
  105. package/src/components/core/filter/SolidManyToOneFilterElement.tsx +2 -2
  106. package/src/components/core/form/SolidFormView.tsx +33 -5
  107. package/src/components/core/form/fields/SolidBooleanField.tsx +6 -1
  108. package/src/components/core/form/fields/SolidDateField.tsx +6 -1
  109. package/src/components/core/form/fields/SolidDateTimeField.tsx +6 -1
  110. package/src/components/core/form/fields/SolidDecimalField.tsx +6 -1
  111. package/src/components/core/form/fields/SolidIntegerField.tsx +6 -1
  112. package/src/components/core/form/fields/SolidLongTextField.tsx +6 -1
  113. package/src/components/core/form/fields/SolidSelectionStaticField.tsx +19 -9
  114. package/src/components/core/form/fields/SolidShortTextField.tsx +7 -2
  115. package/src/components/core/form/fields/SolidTimeField.tsx +6 -1
  116. package/src/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +7 -7
  117. package/src/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +3 -3
  118. package/src/components/core/list/SolidListView.tsx +32 -7
  119. package/src/components/core/list/SolidManyToOneFilterElement.tsx +2 -2
  120. package/src/components/core/list/columns/SolidBooleanColumn.tsx +2 -2
  121. package/src/components/core/list/columns/relations/SolidRelationManyToOneColumn.tsx +1 -1
  122. package/src/components/core/model/FieldMetaDataForm.tsx +166 -87
  123. package/src/components/core/model/FieldSelector.tsx +1 -1
  124. package/src/components/core/model/ModelMetaData.tsx +8 -7
  125. package/src/index.ts +7 -2
  126. package/src/redux/api/authApi.ts +48 -8
  127. package/dist/components/core/filter/columns/SolidBigintField.d.ts +0 -4
  128. package/dist/components/core/filter/columns/SolidBigintField.d.ts.map +0 -1
  129. package/dist/components/core/filter/columns/SolidBigintField.js +0 -8
  130. package/dist/components/core/filter/columns/SolidBigintField.js.map +0 -1
  131. package/dist/components/core/filter/columns/SolidBooleanField.d.ts +0 -4
  132. package/dist/components/core/filter/columns/SolidBooleanField.d.ts.map +0 -1
  133. package/dist/components/core/filter/columns/SolidBooleanField.js +0 -27
  134. package/dist/components/core/filter/columns/SolidBooleanField.js.map +0 -1
  135. package/dist/components/core/filter/columns/SolidComputedField.d.ts +0 -4
  136. package/dist/components/core/filter/columns/SolidComputedField.d.ts.map +0 -1
  137. package/dist/components/core/filter/columns/SolidComputedField.js +0 -22
  138. package/dist/components/core/filter/columns/SolidComputedField.js.map +0 -1
  139. package/dist/components/core/filter/columns/SolidDateField.d.ts +0 -9
  140. package/dist/components/core/filter/columns/SolidDateField.d.ts.map +0 -1
  141. package/dist/components/core/filter/columns/SolidDateField.js +0 -35
  142. package/dist/components/core/filter/columns/SolidDateField.js.map +0 -1
  143. package/dist/components/core/filter/columns/SolidDatetimeField.d.ts +0 -4
  144. package/dist/components/core/filter/columns/SolidDatetimeField.d.ts.map +0 -1
  145. package/dist/components/core/filter/columns/SolidDatetimeField.js +0 -24
  146. package/dist/components/core/filter/columns/SolidDatetimeField.js.map +0 -1
  147. package/dist/components/core/filter/columns/SolidDecimalField.d.ts +0 -4
  148. package/dist/components/core/filter/columns/SolidDecimalField.d.ts.map +0 -1
  149. package/dist/components/core/filter/columns/SolidDecimalField.js +0 -8
  150. package/dist/components/core/filter/columns/SolidDecimalField.js.map +0 -1
  151. package/dist/components/core/filter/columns/SolidExternalIdField.d.ts +0 -4
  152. package/dist/components/core/filter/columns/SolidExternalIdField.d.ts.map +0 -1
  153. package/dist/components/core/filter/columns/SolidExternalIdField.js +0 -25
  154. package/dist/components/core/filter/columns/SolidExternalIdField.js.map +0 -1
  155. package/dist/components/core/filter/columns/SolidFloatField.d.ts +0 -4
  156. package/dist/components/core/filter/columns/SolidFloatField.d.ts.map +0 -1
  157. package/dist/components/core/filter/columns/SolidFloatField.js +0 -8
  158. package/dist/components/core/filter/columns/SolidFloatField.js.map +0 -1
  159. package/dist/components/core/filter/columns/SolidIdField.d.ts +0 -4
  160. package/dist/components/core/filter/columns/SolidIdField.d.ts.map +0 -1
  161. package/dist/components/core/filter/columns/SolidIdField.js +0 -25
  162. package/dist/components/core/filter/columns/SolidIdField.js.map +0 -1
  163. package/dist/components/core/filter/columns/SolidIntField.d.ts +0 -4
  164. package/dist/components/core/filter/columns/SolidIntField.d.ts.map +0 -1
  165. package/dist/components/core/filter/columns/SolidIntField.js +0 -34
  166. package/dist/components/core/filter/columns/SolidIntField.js.map +0 -1
  167. package/dist/components/core/filter/columns/SolidLongTextField.d.ts +0 -4
  168. package/dist/components/core/filter/columns/SolidLongTextField.d.ts.map +0 -1
  169. package/dist/components/core/filter/columns/SolidLongTextField.js +0 -8
  170. package/dist/components/core/filter/columns/SolidLongTextField.js.map +0 -1
  171. package/dist/components/core/filter/columns/SolidMediaMultipleField.d.ts +0 -4
  172. package/dist/components/core/filter/columns/SolidMediaMultipleField.d.ts.map +0 -1
  173. package/dist/components/core/filter/columns/SolidMediaMultipleField.js +0 -35
  174. package/dist/components/core/filter/columns/SolidMediaMultipleField.js.map +0 -1
  175. package/dist/components/core/filter/columns/SolidMediaSingleField.d.ts +0 -4
  176. package/dist/components/core/filter/columns/SolidMediaSingleField.d.ts.map +0 -1
  177. package/dist/components/core/filter/columns/SolidMediaSingleField.js +0 -35
  178. package/dist/components/core/filter/columns/SolidMediaSingleField.js.map +0 -1
  179. package/dist/components/core/filter/columns/SolidRelationField.d.ts +0 -4
  180. package/dist/components/core/filter/columns/SolidRelationField.d.ts.map +0 -1
  181. package/dist/components/core/filter/columns/SolidRelationField.js +0 -12
  182. package/dist/components/core/filter/columns/SolidRelationField.js.map +0 -1
  183. package/dist/components/core/filter/columns/SolidRichTextField.d.ts +0 -4
  184. package/dist/components/core/filter/columns/SolidRichTextField.d.ts.map +0 -1
  185. package/dist/components/core/filter/columns/SolidRichTextField.js +0 -8
  186. package/dist/components/core/filter/columns/SolidRichTextField.js.map +0 -1
  187. package/dist/components/core/filter/columns/SolidSelectionDynamicField.d.ts +0 -4
  188. package/dist/components/core/filter/columns/SolidSelectionDynamicField.d.ts.map +0 -1
  189. package/dist/components/core/filter/columns/SolidSelectionDynamicField.js +0 -25
  190. package/dist/components/core/filter/columns/SolidSelectionDynamicField.js.map +0 -1
  191. package/dist/components/core/filter/columns/SolidSelectionStaticField.d.ts +0 -4
  192. package/dist/components/core/filter/columns/SolidSelectionStaticField.d.ts.map +0 -1
  193. package/dist/components/core/filter/columns/SolidSelectionStaticField.js +0 -26
  194. package/dist/components/core/filter/columns/SolidSelectionStaticField.js.map +0 -1
  195. package/dist/components/core/filter/columns/SolidShortTextField.d.ts +0 -4
  196. package/dist/components/core/filter/columns/SolidShortTextField.d.ts.map +0 -1
  197. package/dist/components/core/filter/columns/SolidShortTextField.js +0 -33
  198. package/dist/components/core/filter/columns/SolidShortTextField.js.map +0 -1
  199. package/dist/components/core/filter/columns/SolidTimeField.d.ts +0 -4
  200. package/dist/components/core/filter/columns/SolidTimeField.d.ts.map +0 -1
  201. package/dist/components/core/filter/columns/SolidTimeField.js +0 -24
  202. package/dist/components/core/filter/columns/SolidTimeField.js.map +0 -1
  203. package/dist/components/core/filter/columns/SolidUuidField.d.ts +0 -4
  204. package/dist/components/core/filter/columns/SolidUuidField.d.ts.map +0 -1
  205. package/dist/components/core/filter/columns/SolidUuidField.js +0 -25
  206. package/dist/components/core/filter/columns/SolidUuidField.js.map +0 -1
  207. package/dist/components/core/filter/columns/relations/SolidRelationManyToOneField.d.ts +0 -4
  208. package/dist/components/core/filter/columns/relations/SolidRelationManyToOneField.d.ts.map +0 -1
  209. package/dist/components/core/filter/columns/relations/SolidRelationManyToOneField.js +0 -54
  210. package/dist/components/core/filter/columns/relations/SolidRelationManyToOneField.js.map +0 -1
@@ -17,27 +17,20 @@ import * as Yup from "yup";
17
17
  import { SocialMediaLogin } from "../common/SocialMediaLogin";
18
18
  import { LayoutContext } from "../layout/context/layoutcontext";
19
19
  import { useLazyGetAuthSettingsQuery } from "@/redux/api/solidSettingsApi";
20
-
20
+ import { useInitateLoginMutation } from "@/redux/api/authApi";
21
21
 
22
22
  const SolidLogin = () => {
23
- const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery()
23
+ const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();
24
+ const [initiateLogin] = useInitateLoginMutation();
25
+
24
26
  useEffect(() => {
25
27
  trigger("") // Fetch settings on mount
26
28
  }, [trigger])
27
- const { layoutConfig } = useContext(LayoutContext);
28
- const { authLayout } = layoutConfig;
29
29
  const toast = useRef<Toast>(null);
30
30
  const router = useRouter();
31
31
 
32
32
  const [password, setPassword] = useState('');
33
33
 
34
- const validationSchema = Yup.object({
35
- email: Yup.string()
36
- .email("Invalid email address")
37
- .required("Email is required"),
38
- password: Yup.string().required("Password is required"),
39
- });
40
-
41
34
  const showToast = (severity: "success" | "error", summary: string, detail: string) => {
42
35
  toast.current?.show({
43
36
  severity,
@@ -73,14 +66,19 @@ const SolidLogin = () => {
73
66
  <h2 className={`solid-auth-title ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'text-center' : 'text-left'}`}>Sign In To Your Account</h2>
74
67
  {/* <p className="solid-auth-subtitle text-sm">By continuing, you agree to the <Link href={'#'}>Terms of Service</Link> and acknowledge you’ve read our <Link href={'#'}>Privacy Policy.</Link> </p> */}
75
68
 
76
- <TabView>
77
- <TabPanel header="Login With Password">
69
+ <TabView className="solid-auth-tabview">
70
+ <TabPanel header="With Password">
78
71
  <Formik
79
72
  initialValues={{
80
73
  email: "",
81
74
  password: "",
82
75
  }}
83
- validationSchema={validationSchema}
76
+ validationSchema={Yup.object({
77
+ email: Yup.string()
78
+ .email("Invalid email address")
79
+ .required("Email is required"),
80
+ password: Yup.string().required("Password is required"),
81
+ })}
84
82
  onSubmit={async (values, { setSubmitting }) => {
85
83
  try {
86
84
  const response = await signIn("credentials", {
@@ -95,8 +93,8 @@ const SolidLogin = () => {
95
93
  showToast("success", "Login Success", "Redirecting to dashboard...");
96
94
  router.push("/admin/core/solid-core/user/list");
97
95
  }
98
- } catch (error) {
99
- showToast("error", "Login Failed", "Something went wrong");
96
+ } catch (error: any) {
97
+ showToast("error", "Login Error", error?.data ? error?.data?.message : "Something Went Wrong");
100
98
  } finally {
101
99
  setSubmitting(false); // Re-enable the button after submission
102
100
  }
@@ -156,7 +154,64 @@ const SolidLogin = () => {
156
154
  )}
157
155
  </Formik>
158
156
  </TabPanel>
159
- <TabPanel header="Login Without Password">
157
+ <TabPanel header="Without Password">
158
+ <Formik
159
+ initialValues={{
160
+ email: "",
161
+ }}
162
+ validationSchema={Yup.object({
163
+ email: Yup.string()
164
+ .email("Invalid email address")
165
+ })}
166
+ onSubmit={async (values, { setSubmitting }) => {
167
+ try {
168
+ const payload = {
169
+ type: "email",
170
+ identifier: values.email,
171
+ };
172
+
173
+ const response = await initiateLogin(payload).unwrap(); // Call mutation trigger
174
+
175
+ if (response?.statusCode === 200) {
176
+ showToast("success", "OTP sent Successfully", response?.data?.message);
177
+ const email = values.email;
178
+ router.push(`/auth/initiate-login?email=${email}`);
179
+ } else {
180
+ showToast("error", "Login Error", response.error);
181
+ }
182
+ } catch (err: any) {
183
+ showToast("error", "Login Error", err?.data ? err?.data?.message : "Something Went Wrong");
184
+ } finally {
185
+ setSubmitting(false);
186
+ }
187
+ }}
188
+ >
189
+ {(formik) => (
190
+ <Form>
191
+ <div className="flex flex-column gap-2">
192
+ <label htmlFor="email" className="solid-auth-input-label">Email</label>
193
+ <InputText
194
+ id="email"
195
+ name="email"
196
+ placeholder="Email ID"
197
+ onChange={formik.handleChange}
198
+ value={formik.values.email}
199
+ />
200
+ {isFormFieldValid(formik, "email") && <Message
201
+ className="text-red-500 text-sm"
202
+ severity="error"
203
+ text={formik?.errors?.email?.toString()}
204
+ />}
205
+ </div>
206
+ <div className="mt-4 text-right">
207
+ <Link href={"/auth/initiate-forgot-password"} className="solid-auth-input-label">Forgot Password?</Link>
208
+ </div>
209
+ <div className="mt-4">
210
+ <Button className="w-full font-light auth-submit-button" label="Sign In" disabled={formik.isSubmitting} loading={formik.isSubmitting} />
211
+ </div>
212
+ </Form>
213
+ )}
214
+ </Formik>
160
215
  </TabPanel>
161
216
  </TabView>
162
217
  {solidSettingsData?.data?.iamGoogleOAuthEnabled &&
@@ -8,14 +8,17 @@ import { Button } from "primereact/button";
8
8
  import { InputOtp } from "primereact/inputotp";
9
9
  import { Message } from "primereact/message";
10
10
  import { Toast } from "primereact/toast";
11
- import { useContext, useRef, useState } from "react";
11
+ import { useContext, useEffect, useRef, useState } from "react";
12
12
  import * as Yup from "yup";
13
13
  import { LayoutContext } from "../layout/context/layoutcontext";
14
+ import { useLazyGetAuthSettingsQuery } from "@/redux/api/solidSettingsApi";
14
15
 
15
16
 
16
17
  const SolidOTPVerify = () => {
17
- const { layoutConfig } = useContext(LayoutContext);
18
- const { authLayout } = layoutConfig;
18
+ const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();
19
+ useEffect(() => {
20
+ trigger("")
21
+ }, [trigger])
19
22
  const [otp, setOTP] = useState<number | any>();
20
23
 
21
24
  const toast = useRef<Toast>(null);
@@ -45,8 +48,8 @@ const SolidOTPVerify = () => {
45
48
  return (
46
49
  <>
47
50
  <Toast ref={toast} />
48
- <div className={`auth-container ${authLayout === 'Center' ? 'center' : 'side'}`} style={{ minWidth: 480 }}>
49
- {authLayout === 'Center' &&
51
+ <div className={`auth-container ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'center' : 'side'}`} style={{ minWidth: 480 }}>
52
+ {solidSettingsData?.data?.authPagesLayout === 'center' &&
50
53
  <div className="flex justify-content-center">
51
54
  <div className="solid-logo flex align-items-center gap-3">
52
55
  <img
@@ -62,7 +65,7 @@ const SolidOTPVerify = () => {
62
65
  </div>
63
66
  </div>
64
67
  }
65
- <h2 className={`solid-auth-title ${authLayout === 'Center' ? 'text-center' : 'text-left'}`}>OTP Verification</h2>
68
+ <h2 className={`solid-auth-title ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'text-center' : 'text-left'}`}>OTP Verification</h2>
66
69
  <p className="solid-auth-subtitle text-sm">
67
70
  Please enter the OTP sent to your email to complete verification
68
71
  </p>
@@ -1,8 +1,9 @@
1
1
  "use client";
2
2
 
3
- import { useRegisterMutation } from "@/redux/api/authApi";
3
+ import { useInitateRegisterMutation, useRegisterMutation } from "@/redux/api/authApi";
4
+ import { useLazyGetAuthSettingsQuery } from "@/redux/api/solidSettingsApi";
4
5
  import { FetchBaseQueryError } from "@reduxjs/toolkit/query/react";
5
- import { useFormik } from "formik";
6
+ import { Form, Formik } from "formik";
6
7
  import Link from "next/link";
7
8
  import { useRouter } from "next/navigation";
8
9
  import { Button } from "primereact/button";
@@ -10,33 +11,19 @@ import { Divider } from "primereact/divider";
10
11
  import { InputText } from "primereact/inputtext";
11
12
  import { Message } from "primereact/message";
12
13
  import { Password } from "primereact/password";
14
+ import { TabPanel, TabView } from "primereact/tabview";
13
15
  import { Toast } from "primereact/toast";
14
16
  import { classNames } from "primereact/utils";
15
- import { ChangeEventHandler, useContext, useEffect, useRef, useState } from "react";
17
+ import { useEffect, useRef } from "react";
16
18
  import * as Yup from "yup";
17
19
  import { SocialMediaLogin } from "../common/SocialMediaLogin";
18
- import { LayoutContext } from "../layout/context/layoutcontext";
19
20
 
20
21
  const SolidRegister = () => {
21
- const { layoutConfig } = useContext(LayoutContext);
22
- const { authLayout } = layoutConfig;
22
+ const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();
23
+ useEffect(() => {
24
+ trigger("")
25
+ }, [trigger])
23
26
  const toast = useRef<Toast>(null);
24
- const [password, setPassword] = useState("");
25
- const [checked, setChecked] = useState<boolean>(false);
26
- const [showPassword, setShowPassword] = useState(false);
27
- const [user, setUser] = useState({
28
- name: "",
29
- email: "",
30
- password: "",
31
- });
32
-
33
- const validationSchema = Yup.object({
34
- username: Yup.string().required("User Name is required"),
35
- email: Yup.string()
36
- .email("Invalid email address")
37
- .required("Email is required"),
38
- password: Yup.string().required("Password is required"),
39
- });
40
27
 
41
28
  const router = useRouter();
42
29
 
@@ -45,34 +32,7 @@ const SolidRegister = () => {
45
32
 
46
33
  const [register, { isLoading, error, isSuccess, data }] = useRegisterMutation();
47
34
 
48
- const onChange: ChangeEventHandler<HTMLInputElement> = (e) => {
49
- setUser({ ...user, [e.target.name]: e.target.value });
50
- };
51
-
52
- const initialValues = {
53
- username: "",
54
- email: "",
55
- password: "",
56
- }
57
-
58
- const formik = useFormik({
59
- initialValues,
60
- validationSchema,
61
- enableReinitialize: true,
62
- onSubmit: async (values) => {
63
- try {
64
- const userData = {
65
- username: values.username,
66
- email: values.email,
67
- password: values.password,
68
- };
69
-
70
- await register(userData);
71
- } catch (err) {
72
- console.log('inside', err);
73
- }
74
- }
75
- });
35
+ const [initiateOtpRegister] = useInitateRegisterMutation();
76
36
 
77
37
  const showError = () => {
78
38
  if (error) {
@@ -111,11 +71,19 @@ const SolidRegister = () => {
111
71
  router.replace("/auth/login");
112
72
  }
113
73
  }, [isSuccess])
74
+ const showToast = (severity: "success" | "error", summary: string, detail: string) => {
75
+ toast.current?.show({
76
+ severity,
77
+ summary,
78
+ detail,
79
+ life: 3000,
80
+ });
81
+ };
114
82
  return (
115
- <>
83
+ <div className="">
116
84
  <Toast ref={toast} />
117
- <div className={`auth-container ${authLayout === 'Center' ? 'center' : 'side'}`}>
118
- {authLayout === 'Center' &&
85
+ <div className={`auth-container ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'center' : 'side'}`}>
86
+ {solidSettingsData?.data?.authPagesLayout === 'center' &&
119
87
  <div className="flex justify-content-center">
120
88
  <div className="solid-logo flex align-items-center gap-3">
121
89
  <img
@@ -131,115 +99,198 @@ const SolidRegister = () => {
131
99
  </div>
132
100
  </div>
133
101
  }
134
- <h2 className={`solid-auth-title ${authLayout === 'Center' ? 'text-center' : 'text-left'}`}>Sign Up To Your Account</h2>
102
+ <h2 className={`solid-auth-title ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'text-center' : 'text-left'}`}>Sign Up To Your Account</h2>
135
103
  {/* <p className="solid-auth-subtitle text-sm">By continuing, you agree to the <Link href={'#'}>Terms of Service</Link> and acknowledge you’ve read our <Link href={'#'}>Privacy Policy.</Link> </p> */}
136
- <>
137
- <form onSubmit={formik.handleSubmit}>
138
- {/* <div className="grid">
139
- <div className="col-6">
140
- <div className="flex flex-column gap-2">
141
- <label htmlFor="email" className="solid-auth-input-label">First Name</label>
142
- <InputText
143
- id="username"
144
- name="username"
145
- placeholder="username"
146
- onChange={formik.handleChange}
147
- value={formik.values.username}
148
- />
149
- {isFormFieldValid(formik, "username") && <Message
150
- className="text-red-500 text-sm"
151
- severity="error"
152
- text={formik?.errors?.username?.toString()}
153
- />}
154
- </div>
155
- </div>
156
- <div className="col-6">
157
- <div className="flex flex-column gap-2">
158
- <label htmlFor="email" className="solid-auth-input-label">Last Name</label>
159
- <InputText
160
- id="email"
161
- name="email"
162
- placeholder="Yourgmail@123.com"
163
- onChange={formik.handleChange}
164
- value={formik.values.email}
165
- />
166
- {isFormFieldValid(formik, "email") && <Message
167
- className="text-red-500 text-sm"
168
- severity="error"
169
- text={formik?.errors?.email?.toString()}
170
- />}
171
- </div>
104
+ <TabView className="solid-auth-tabview">
105
+ <TabPanel header="With Password">
106
+ <Formik
107
+ initialValues={{
108
+ username: "",
109
+ email: "",
110
+ password: "",
111
+ }}
112
+ validationSchema={Yup.object({
113
+ username: Yup.string().required("User Name is required"),
114
+ email: Yup.string()
115
+ .email("Invalid email address")
116
+ .required("Email is required"),
117
+ password: Yup.string().required("Password is required"),
118
+ })}
119
+ onSubmit={async (values, { setSubmitting }) => {
120
+ try {
121
+ const userData = {
122
+ username: values.username,
123
+ email: values.email,
124
+ password: values.password,
125
+ };
126
+
127
+ const response = await register(userData).unwrap();
128
+ if (response?.statusCode === 200) {
129
+ showToast("success", "User Registered", response?.data?.message);
130
+ router.push(`/auth/login`);
131
+ } else {
132
+ showToast("error", "Login Error", response.error);
133
+ }
134
+ } catch (err: any) {
135
+ showToast("error", "Login Error", err?.data ? err?.data?.message : "Something Went Wrong");
136
+ } finally {
137
+ setSubmitting(false);
138
+ }
139
+ }}
140
+ >
141
+ {(formik) => (
142
+ <Form>
143
+ <div className="flex flex-column gap-2 mt-3">
144
+ <label htmlFor="email" className="solid-auth-input-label">Username</label>
145
+ <InputText
146
+ id="username"
147
+ name="username"
148
+ placeholder="username"
149
+ onChange={formik.handleChange}
150
+ value={formik.values.username}
151
+ />
152
+ {isFormFieldValid(formik, "username") && <Message
153
+ className="text-red-500 text-sm"
154
+ severity="error"
155
+ text={formik?.errors?.username?.toString()}
156
+ />}
157
+ </div>
158
+ <div className="flex flex-column gap-2 mt-3">
159
+ <label htmlFor="email" className="solid-auth-input-label">Email</label>
160
+ <InputText
161
+ id="email"
162
+ name="email"
163
+ placeholder="Yourgmail@123.com"
164
+ onChange={formik.handleChange}
165
+ value={formik.values.email}
166
+ />
167
+ {isFormFieldValid(formik, "email") && <Message
168
+ className="text-red-500 text-sm"
169
+ severity="error"
170
+ text={formik?.errors?.email?.toString()}
171
+ />}
172
+ </div>
173
+ <div className="flex flex-column gap-2 mt-3">
174
+ <label htmlFor="password" className="solid-auth-input-label">Password</label>
175
+ <Password
176
+ id="password"
177
+ name="password"
178
+ value={formik.values.password}
179
+ onChange={formik.handleChange}
180
+ placeholder="***************"
181
+ toggleMask
182
+ className={classNames("", {
183
+ "p-invalid": isFormFieldValid(formik, "password"),
184
+ })}
185
+ inputClassName="w-full"
186
+ feedback={false}
187
+ />
188
+ {isFormFieldValid(formik, "password") && <Message
189
+ className="text-red-500 text-sm"
190
+ severity="error"
191
+ text={formik?.errors?.password?.toString()}
192
+ />}
193
+ </div>
194
+ <div className="mt-4">
195
+ <Button className="w-full font-light auth-submit-button" label="Sign Up" disabled={formik.isSubmitting} loading={formik.isSubmitting} />
196
+ </div>
197
+ </Form>
198
+ )}
199
+ </Formik>
200
+ </TabPanel>
201
+ <TabPanel header="Without Password">
202
+ <Formik
203
+ initialValues={{
204
+ username: "",
205
+ email: "",
206
+ }}
207
+ validationSchema={Yup.object({
208
+ username: Yup.string().required("User Name is required"),
209
+ email: Yup.string()
210
+ .email("Invalid email address")
211
+ .required("Email is required"),
212
+ })}
213
+ onSubmit={async (values, { setSubmitting }) => {
214
+ try {
215
+ const payload = {
216
+ username: values.username,
217
+ email: values.email,
218
+ validationSources: ["email"]
219
+ };
220
+
221
+ const response = await initiateOtpRegister(payload).unwrap(); // Call mutation trigger
222
+
223
+ if (response?.statusCode === 200) {
224
+ showToast("success", "OTP sent Successfully", response?.data?.message);
225
+ const email = values.email;
226
+ router.push(`/auth/initiate-register?email=${email}`);
227
+ } else {
228
+ showToast("error", "Login Error", response.error);
229
+ }
230
+ } catch (err: any) {
231
+ showToast("error", "Login Error", err?.data ? err?.data?.message : "Something Went Wrong");
232
+ } finally {
233
+ setSubmitting(false);
234
+ }
235
+ }}
236
+ >
237
+ {(formik) => (
238
+ <Form>
239
+ <div className="flex flex-column gap-2 mt-3">
240
+ <label htmlFor="email" className="solid-auth-input-label">Username</label>
241
+ <InputText
242
+ id="username"
243
+ name="username"
244
+ placeholder="username"
245
+ onChange={formik.handleChange}
246
+ value={formik.values.username}
247
+ />
248
+ {isFormFieldValid(formik, "username") && <Message
249
+ className="text-red-500 text-sm"
250
+ severity="error"
251
+ text={formik?.errors?.username?.toString()}
252
+ />}
253
+ </div>
254
+ <div className="flex flex-column gap-2 mt-3">
255
+ <label htmlFor="email" className="solid-auth-input-label">Email</label>
256
+ <InputText
257
+ id="email"
258
+ name="email"
259
+ placeholder="Yourgmail@123.com"
260
+ onChange={formik.handleChange}
261
+ value={formik.values.email}
262
+ />
263
+ {isFormFieldValid(formik, "email") && <Message
264
+ className="text-red-500 text-sm"
265
+ severity="error"
266
+ text={formik?.errors?.email?.toString()}
267
+ />}
268
+ </div>
269
+ <div className="mt-4">
270
+ <Button className="w-full font-light auth-submit-button" label="Sign Up" disabled={formik.isSubmitting} loading={formik.isSubmitting} />
271
+ </div>
272
+ </Form>
273
+ )}
274
+ </Formik>
275
+ </TabPanel>
276
+ </TabView>
277
+ {solidSettingsData?.data?.iamGoogleOAuthEnabled &&
278
+ <>
279
+ <Divider align="center">
280
+ <div className="inline-flex align-items-center">
281
+ or
172
282
  </div>
173
- </div> */}
174
- <div className="flex flex-column gap-2 mt-3">
175
- <label htmlFor="email" className="solid-auth-input-label">Username</label>
176
- <InputText
177
- id="username"
178
- name="username"
179
- placeholder="username"
180
- onChange={formik.handleChange}
181
- value={formik.values.username}
182
- />
183
- {isFormFieldValid(formik, "username") && <Message
184
- className="text-red-500 text-sm"
185
- severity="error"
186
- text={formik?.errors?.username?.toString()}
187
- />}
188
- </div>
189
- <div className="flex flex-column gap-2 mt-3">
190
- <label htmlFor="email" className="solid-auth-input-label">Email</label>
191
- <InputText
192
- id="email"
193
- name="email"
194
- placeholder="Yourgmail@123.com"
195
- onChange={formik.handleChange}
196
- value={formik.values.email}
197
- />
198
- {isFormFieldValid(formik, "email") && <Message
199
- className="text-red-500 text-sm"
200
- severity="error"
201
- text={formik?.errors?.email?.toString()}
202
- />}
203
- </div>
204
- <div className="flex flex-column gap-2 mt-3">
205
- <label htmlFor="password" className="solid-auth-input-label">Password</label>
206
- <Password
207
- id="password"
208
- name="password"
209
- value={formik.values.password}
210
- onChange={formik.handleChange}
211
- placeholder="***************"
212
- toggleMask
213
- className={classNames("", {
214
- "p-invalid": isFormFieldValid(formik, "password"),
215
- })}
216
- inputClassName="w-full"
217
- feedback={false}
218
- />
219
- {isFormFieldValid(formik, "password") && <Message
220
- className="text-red-500 text-sm"
221
- severity="error"
222
- text={formik?.errors?.password?.toString()}
223
- />}
224
- </div>
225
- <div className="mt-4">
226
- <Button className="w-full font-light auth-submit-button" label="Sign Up" disabled={formik.isSubmitting} loading={formik.isSubmitting} />
227
- </div>
228
- </form>
229
- </>
230
- <Divider align="center">
231
- <div className="inline-flex align-items-center">
232
- or
233
- </div>
234
- </Divider>
235
- <SocialMediaLogin />
283
+ </Divider>
284
+ <SocialMediaLogin />
285
+ </>
286
+ }
236
287
  </div>
237
288
  <div className="text-center mt-5">
238
289
  <div className="text-sm text-400 secondary-dark-color">
239
290
  Already have an account ? <Link className="font-bold" href="/auth/login">Sign In</Link>
240
291
  </div>
241
292
  </div>
242
- </>
293
+ </div>
243
294
  );
244
295
  };
245
296
 
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  import { useConfirmForgotPasswordMutation } from "@/redux/api/authApi";
4
+ import { useLazyGetAuthSettingsQuery } from "@/redux/api/solidSettingsApi";
4
5
  import { useFormik } from "formik";
5
6
  import Link from "next/link";
6
7
  import { useRouter } from "next/navigation";
@@ -9,14 +10,15 @@ import { Message } from "primereact/message";
9
10
  import { Password } from "primereact/password";
10
11
  import { Toast } from "primereact/toast";
11
12
  import { classNames } from "primereact/utils";
12
- import { useContext, useRef } from "react";
13
+ import { useEffect, useRef } from "react";
13
14
  import * as Yup from "yup";
14
- import { LayoutContext } from "../layout/context/layoutcontext";
15
15
 
16
16
 
17
17
  const SolidResetPassword = ({ verificationToken, username }: { verificationToken?: any, username?: any }) => {
18
- const { layoutConfig } = useContext(LayoutContext);
19
- const { authLayout } = layoutConfig;
18
+ const [trigger, { data: solidSettingsData }] = useLazyGetAuthSettingsQuery();
19
+ useEffect(() => {
20
+ trigger("")
21
+ }, [trigger])
20
22
  const toast = useRef<Toast>(null);
21
23
  const router = useRouter();
22
24
 
@@ -71,8 +73,8 @@ const SolidResetPassword = ({ verificationToken, username }: { verificationToken
71
73
  return (
72
74
  <>
73
75
  <Toast ref={toast} />
74
- <div className={`auth-container ${authLayout === 'Center' ? 'center' : 'side'}`}>
75
- {authLayout === 'Center' &&
76
+ <div className={`auth-container ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'center' : 'side'}`}>
77
+ {solidSettingsData?.data?.authPagesLayout === 'center' &&
76
78
  <div className="flex justify-content-center">
77
79
  <div className="solid-logo flex align-items-center gap-3">
78
80
  <img
@@ -88,7 +90,7 @@ const SolidResetPassword = ({ verificationToken, username }: { verificationToken
88
90
  </div>
89
91
  </div>
90
92
  }
91
- <h2 className={`solid-auth-title ${authLayout === 'Center' ? 'text-center' : 'text-left'}`}>Create New Password</h2>
93
+ <h2 className={`solid-auth-title ${solidSettingsData?.data?.authPagesLayout === 'center' ? 'text-center' : 'text-left'}`}>Create New Password</h2>
92
94
  {/* <p className="solid-auth-subtitle text-sm">By continuing, you agree to the <Link href={'#'}>Terms of Service</Link> and acknowledge you’ve read our <Link href={'#'}>Privacy Policy.</Link> </p> */}
93
95
  <form onSubmit={formik.handleSubmit}>
94
96
  <div className="flex flex-column gap-2">