@solidstarters/solid-core-ui 1.1.8 → 1.1.10

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 (80) 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/common/LoadDynamicJsxComponent.d.ts.map +1 -1
  28. package/dist/components/core/common/LoadDynamicJsxComponent.js +42 -62
  29. package/dist/components/core/common/LoadDynamicJsxComponent.js.map +1 -1
  30. package/dist/components/core/extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction.d.ts.map +1 -1
  31. package/dist/components/core/extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction.js +24 -4
  32. package/dist/components/core/extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction.js.map +1 -1
  33. package/dist/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.d.ts +2 -1
  34. package/dist/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.d.ts.map +1 -1
  35. package/dist/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.js +10 -8
  36. package/dist/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.js.map +1 -1
  37. package/dist/components/core/filter/fields/SolidIntField.js +2 -2
  38. package/dist/components/core/filter/fields/SolidIntField.js.map +1 -1
  39. package/dist/components/core/model/CreateModel.d.ts.map +1 -1
  40. package/dist/components/core/model/CreateModel.js +1 -1
  41. package/dist/components/core/model/CreateModel.js.map +1 -1
  42. package/dist/components/core/model/FieldMetaData.d.ts +1 -1
  43. package/dist/components/core/model/FieldMetaData.d.ts.map +1 -1
  44. package/dist/components/core/model/FieldMetaData.js +5 -4
  45. package/dist/components/core/model/FieldMetaData.js.map +1 -1
  46. package/dist/components/core/model/FieldMetaDataForm.d.ts +1 -1
  47. package/dist/components/core/model/FieldMetaDataForm.d.ts.map +1 -1
  48. package/dist/components/core/model/FieldMetaDataForm.js +18 -15
  49. package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
  50. package/dist/index.d.ts +5 -1
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +5 -1
  53. package/dist/index.js.map +1 -1
  54. package/dist/redux/api/authApi.d.ts +5 -1
  55. package/dist/redux/api/authApi.d.ts.map +1 -1
  56. package/dist/redux/api/authApi.js +37 -1
  57. package/dist/redux/api/authApi.js.map +1 -1
  58. package/dist/redux/api/testApi.d.ts +5 -0
  59. package/dist/redux/api/testApi.d.ts.map +1 -0
  60. package/dist/redux/api/testApi.js +19 -0
  61. package/dist/redux/api/testApi.js.map +1 -0
  62. package/package.json +1 -1
  63. package/src/components/auth/SolidForgotPassword.tsx +0 -2
  64. package/src/components/auth/SolidInitialLoginOtp.tsx +134 -0
  65. package/src/components/auth/SolidInitiateRegisterOtp.tsx +134 -0
  66. package/src/components/auth/SolidLogin.tsx +72 -17
  67. package/src/components/auth/SolidOTPVerify.tsx +9 -6
  68. package/src/components/auth/SolidRegister.tsx +205 -154
  69. package/src/components/auth/SolidResetPassword.tsx +9 -7
  70. package/src/components/common/SocialMediaLogin.tsx +6 -1
  71. package/src/components/core/common/LoadDynamicJsxComponent.tsx +49 -25
  72. package/src/components/core/extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction.tsx +14 -2
  73. package/src/components/core/extension/solid-core/moduleMetadata/list/GenerateModuleCodeRowAction.tsx +5 -4
  74. package/src/components/core/filter/fields/SolidIntField.tsx +2 -2
  75. package/src/components/core/model/CreateModel.tsx +1 -0
  76. package/src/components/core/model/FieldMetaData.tsx +22 -3
  77. package/src/components/core/model/FieldMetaDataForm.tsx +18 -15
  78. package/src/index.ts +8 -2
  79. package/src/redux/api/authApi.ts +48 -8
  80. package/src/redux/api/testApi.ts +21 -0
@@ -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">
@@ -1,8 +1,12 @@
1
+ "use client"
1
2
  import { signIn } from 'next-auth/react'
3
+ import { useRouter } from 'next/navigation';
2
4
  import { Button } from 'primereact/button'
3
5
  import React from 'react'
4
6
 
5
7
  export const SocialMediaLogin = () => {
8
+ const router = useRouter();
9
+
6
10
  return (
7
11
  <div className="flex justify-content-center mt-4 gap-3">
8
12
  <Button icon={() => (
@@ -26,7 +30,8 @@ export const SocialMediaLogin = () => {
26
30
  outlined
27
31
  severity="secondary"
28
32
  label='Sign In with Google'
29
- onClick={()=>signIn('google', {callbackUrl :'/admin/core/solid-core/user/list'})}
33
+ onClick={() => router.push(`${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/iam/google/connect`)}
34
+ // onClick={()=>signIn('google', {callbackUrl :'https://uat-api.lm.solidxai.com/api/iam/google/connect'})}
30
35
  >
31
36
  </Button>
32
37
  {/* <Button icon={() => (
@@ -1,7 +1,6 @@
1
1
  'use client';
2
2
  import dynamic from "next/dynamic";
3
- import path from "path";
4
- import GenerateModelCodeRowAction from "../extension/solid-core/modelMetadata/list/GenerateModelCodeRowAction";
3
+ import { useState, useEffect } from "react";
5
4
 
6
5
  // Fallback component for missing components
7
6
  const FallbackComponent = ({ componentName }: any) => (
@@ -14,33 +13,58 @@ type Props = {
14
13
  context: any;
15
14
  };
16
15
 
17
-
18
16
  export const LoadDynamicJsxComponent = ({ context }: any) => {
19
17
 
20
18
 
21
-
22
- const Component = dynamic<Props>(
23
- async () => {
24
- try {
19
+ // const Component = dynamic<Props>(
20
+ // async () => {
21
+ // try {
25
22
 
26
- const componentName = context?.rowAction?.action?.customComponent.split('/').pop();
27
- const mod = await import(
28
- path.resolve(__dirname, 'src/components', context?.rowAction?.action?.customComponent)
29
- );
30
- // Return the default export or a named export matching the componentName
31
- return mod.default || mod[componentName];
32
- } catch (error) {
33
- console.error(`Failed to load component "${context?.rowAction?.action?.customComponent}":`, error);
34
- // Return a fallback component if the import fails
35
- return () => <GenerateModelCodeRowAction context={context} />;
36
- }
37
- },
38
- { ssr: false } // Disable server-side rendering
39
- );
40
- return (
41
-
42
- <Component context={context} />
43
- );
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 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} />;
44
68
  }
45
69
 
46
70
 
@@ -1,22 +1,34 @@
1
1
  'use client';
2
2
  import { useGenerateCodeForModelMutation } from "@/redux/api/modelApi";
3
+ import { useSeederMutation } from "@/redux/api/testApi";
3
4
  import { Button } from "primereact/button";
5
+ import { useEffect } from "react";
4
6
 
5
7
 
6
8
  const GenerateModelCodeRowAction = ({ context }: any) => {
7
-
8
9
  const [
9
10
  generateCode,
10
11
  { isLoading: isGenerateCodeUpdating, isSuccess: isGenerateCodeSuceess, isError: isGenerateCodeError, error: generateCodeError, data: generateCodeData },
11
12
  ] = useGenerateCodeForModelMutation();
12
13
 
14
+ const [triggerSeeder, {data}] = useSeederMutation();
15
+
13
16
 
14
17
  const generateCodeHandler = async () => {
15
- const response = await generateCode({ id: context.rowData.id })
18
+ const response = await generateCode({ id: context?.rowData?.id });
16
19
  context.closeListViewRowActionPopup();
17
20
  console.log("response", response);
18
21
  }
19
22
 
23
+ useEffect(() => {
24
+ const seeder = async () => {
25
+ if(isGenerateCodeSuceess) {
26
+ await triggerSeeder("ModuleMetadataSeederService");
27
+ }
28
+ }
29
+ seeder();
30
+ }, [isGenerateCodeSuceess])
31
+
20
32
  return (
21
33
  <div>
22
34
  <p className="">Click Ok to proceed with model code generation, please note that if the file already exists and <br></br>you have made custom changes to this file we will create a .bkp file as a backup of the existing file.</p>
@@ -3,15 +3,15 @@ import { useGenerateCodeFormoduleMutation } from "@/redux/api/moduleApi";
3
3
  import { Button } from "primereact/button";
4
4
 
5
5
 
6
- export const GenerateModuleCodeRowAction = ({ context, closeCustomRowActionPopup }: any) => {
6
+ const GenerateModuleCodeRowAction = ({ context }: any) => {
7
7
  const [
8
8
  generateCode,
9
9
  { isLoading: isGenerateCodeUpdating, isSuccess: isGenerateCodeSuceess, isError: isGenerateCodeError, error: generateCodeError, data: generateCodeData },
10
10
  ] = useGenerateCodeFormoduleMutation();
11
11
 
12
12
  const generateCodeHandler = async () => {
13
- const response = await generateCode({ id: context.rowData.id })
14
- closeCustomRowActionPopup()
13
+ const response = await generateCode({ id: context?.rowData?.id })
14
+ context.closeListViewRowActionPopup();
15
15
 
16
16
  }
17
17
 
@@ -20,9 +20,10 @@ export const GenerateModuleCodeRowAction = ({ context, closeCustomRowActionPopup
20
20
  <p className="text-center">Click Ok to proceed with module code generation, please note that if the file already exists and <br></br>you have made custom changes to this file we will create a .bkp file as a backup of the existing file.</p>
21
21
  <div className="flex gap-5 justify-content-center">
22
22
  <Button label="Ok" icon="pi pi-check" className='small-button' severity="danger" autoFocus onClick={generateCodeHandler} />
23
- <Button label="Cancel" icon="pi pi-times" className='small-button' onClick={closeCustomRowActionPopup} />
23
+ <Button label="Cancel" icon="pi pi-times" className='small-button' onClick={() => context.closeListViewRowActionPopup()} />
24
24
  </div>
25
25
  </div >
26
26
  )
27
27
  }
28
28
 
29
+ export default GenerateModuleCodeRowAction;