@djb25/digit-ui-module-ekyc 1.0.7 → 1.0.9

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.
@@ -0,0 +1,512 @@
1
+ // import React, { useState, Fragment, useEffect, useRef } from "react";
2
+ // import {
3
+ // Card,
4
+ // CardLabel,
5
+ // TextInput,
6
+ // SubmitBar,
7
+ // CardHeader,
8
+ // RadioButtons,
9
+ // ActionBar,
10
+ // Loader,
11
+ // FormStep,
12
+ // } from "@djb25/digit-ui-react-components";
13
+ // import { useTranslation } from "react-i18next";
14
+ // import { useLocation, useHistory } from "react-router-dom";
15
+ // import { getSavedData } from "../../utils";
16
+ // import AddressDetails from "./AddressDetails";
17
+
18
+ // const AadhaarVerification = ({ config, onSelect, formData, t: tProps }) => {
19
+ // const { t } = useTranslation();
20
+ // const location = useLocation();
21
+ // const history = useHistory();
22
+ // const addressSectionRef = useRef(null);
23
+
24
+ // const flowState = location.state || {};
25
+ // const { isEditing, kNumber } = flowState;
26
+
27
+ // // Robust data extraction from formData
28
+ // const activeEdits = formData || {};
29
+ // const rawReviewData = formData?.reviewData || formData?.connectionDetails || {};
30
+ // const reviewWrapper = rawReviewData?.applicationReview || rawReviewData;
31
+ // const applicationData = (Array.isArray(reviewWrapper) ? reviewWrapper[0] : reviewWrapper) || {};
32
+ // const apiData = applicationData?.newData || applicationData;
33
+ // const apiConn = apiData?.connectionDetails || apiData || {};
34
+
35
+ // const initialData = {
36
+ // userName: apiConn.consumerName || "",
37
+ // mobileNumber: apiConn.phoneNumber || apiConn.mobileNo || "",
38
+ // whatsappNumber: apiConn.phoneNumber || apiConn.mobileNo || "",
39
+ // email: apiConn.email || "",
40
+ // noOfPersons: apiConn.noOfPerson || apiConn.noOfPersons || "",
41
+ // };
42
+
43
+ // const aadhaarData = activeEdits?.aadhaarData || {};
44
+
45
+ // const [aadhaarNumber, setAadhaarNumber] = useState(aadhaarData.aadhaarNumber || "");
46
+ // const [isAadhaarVerified, setIsAadhaarVerified] = useState(aadhaarData.isAadhaarVerified === true || isEditing); // Auto-verify if editing
47
+ // const [showOtpField, setShowOtpField] = useState(false);
48
+ // const [otp, setOtp] = useState("");
49
+ // const [otpError, setOtpError] = useState(false);
50
+ // const [nameCorrect, setNameCorrect] = useState(aadhaarData.nameCorrect || { code: "YES", name: "CORE_COMMON_YES" });
51
+ // const [userName, setUserName] = useState(aadhaarData.name || initialData.userName);
52
+ // const [mobileChange, setMobileChange] = useState(aadhaarData.mobileChange || { code: "YES", name: "CORE_COMMON_YES" });
53
+ // const [mobileNumber, setMobileNumber] = useState(aadhaarData.mobileNumber || initialData.mobileNumber);
54
+ // const [whatsappNumber, setWhatsappNumber] = useState(aadhaarData.whatsappNumber || initialData.whatsappNumber);
55
+ // const [email, setEmail] = useState(aadhaarData.email || initialData.email);
56
+ // const [noOfPersons, setNoOfPersons] = useState(aadhaarData.noOfPersons || initialData.noOfPersons);
57
+ // const [showAddressSection, setShowAddressSection] = useState(false);
58
+
59
+ // const getUpdatedData = () => ({
60
+ // aadhaarNumber,
61
+ // isAadhaarVerified,
62
+ // name: userName,
63
+ // nameCorrect,
64
+ // mobileChange,
65
+ // mobileNumber,
66
+ // whatsappNumber,
67
+ // email,
68
+ // noOfPersons,
69
+ // gender: "Male",
70
+ // dob: "01/01/1990",
71
+ // });
72
+
73
+ // const handleVerifyAadhaar = () => {
74
+ // if (aadhaarNumber.length === 12) setShowOtpField(true);
75
+ // };
76
+
77
+ // const handleVerifyOtp = () => {
78
+ // if (otp === "123456") {
79
+ // setIsAadhaarVerified(true);
80
+ // setShowOtpField(false);
81
+ // setShowAddressSection(true);
82
+ // if (onSelect) {
83
+ // onSelect(config.key, { ...getUpdatedData(), isAadhaarVerified: true });
84
+ // }
85
+ // } else {
86
+ // setOtpError(true);
87
+ // }
88
+ // };
89
+
90
+ // const onStepSelect = () => {
91
+ // const updatedData = getUpdatedData();
92
+ // if (onSelect) {
93
+ // onSelect(config.key, updatedData);
94
+ // } else {
95
+ // if (isEditing) {
96
+ // history.push("/digit-ui/employee/ekyc/review", { ...location.state, edits: { ...edits, aadhaarData: updatedData } });
97
+ // } else {
98
+ // history.push("/digit-ui/employee/ekyc/address-details", {
99
+ // ...location.state,
100
+ // edits: { ...edits, aadhaarData: updatedData }
101
+ // });
102
+ // }
103
+ // }
104
+ // };
105
+
106
+ // const handleUpdateAndReturn = () => {
107
+ // history.push("/digit-ui/employee/ekyc/review", { ...location.state, edits: { ...edits, aadhaarData: getUpdatedData() } });
108
+ // };
109
+
110
+ // const yesNoOptions = [
111
+ // { code: "YES", name: "CORE_COMMON_YES" },
112
+ // { code: "NO", name: "CORE_COMMON_NO" },
113
+ // ];
114
+
115
+ // return (
116
+ // <Fragment>
117
+ // <FormStep
118
+ // t={t}
119
+ // config={config || {}}
120
+ // onSelect={onStepSelect}
121
+ // isDisabled={!isAadhaarVerified || !userName || !mobileNumber}
122
+ // label={t(config?.texts?.submitBarLabel) || (isEditing ? t("EKYC_UPDATE_AND_RETURN") : t("ES_COMMON_CONTINUE"))}
123
+ // >
124
+ // <CardLabel>{t("EKYC_AADHAAR_NUMBER")} <span className="astericColor">*</span></CardLabel>
125
+ // <TextInput
126
+ // id="aadhaarNumber"
127
+ // name="aadhaarNumber"
128
+ // value={aadhaarNumber}
129
+ // onChange={(e) => setAadhaarNumber(e.target.value)}
130
+ // placeholder={t("EKYC_ENTER_AADHAAR_NUMBER")}
131
+ // maxLength={12}
132
+ // disabled={isAadhaarVerified}
133
+ // />
134
+ // {!isAadhaarVerified && !showOtpField && (
135
+ // <SubmitBar label={t("EKYC_VERIFY")} onSubmit={handleVerifyAadhaar} disabled={aadhaarNumber.length !== 12} />
136
+ // )}
137
+
138
+ // {showOtpField && (
139
+ // <Fragment>
140
+ // <CardLabel>{t("EKYC_ENTER_OTP")} <span className="astericColor">*</span></CardLabel>
141
+ // <TextInput
142
+ // id="otp"
143
+ // name="otp"
144
+ // value={otp}
145
+ // onChange={(e) => setOtp(e.target.value)}
146
+ // placeholder="123456"
147
+ // maxLength={6}
148
+ // />
149
+ // {otpError && <div style={{ color: "red", fontSize: "12px" }}>{t("EKYC_INVALID_OTP")}</div>}
150
+ // <SubmitBar label={t("EKYC_VERIFY_OTP")} onSubmit={handleVerifyOtp} disabled={otp.length !== 6} />
151
+ // </Fragment>
152
+ // )}
153
+
154
+ // {isAadhaarVerified && (
155
+ // <Fragment>
156
+ // <CardLabel>{t("EKYC_IS_NAME_CORRECT")}</CardLabel>
157
+ // <RadioButtons
158
+ // options={yesNoOptions}
159
+ // optionsKey="name"
160
+ // selectedOption={nameCorrect}
161
+ // onSelect={setNameCorrect}
162
+ // />
163
+ // <CardLabel>{t("EKYC_USER_NAME")} <span className="astericColor">*</span></CardLabel>
164
+ // <TextInput
165
+ // id="userName"
166
+ // name="userName"
167
+ // value={userName}
168
+ // onChange={(e) => setUserName(e.target.value)}
169
+ // disabled={nameCorrect.code === "NO"}
170
+ // />
171
+
172
+ // <CardLabel>{t("EKYC_CHANGE_MOBILE")}</CardLabel>
173
+ // <RadioButtons
174
+ // options={yesNoOptions}
175
+ // optionsKey="name"
176
+ // selectedOption={mobileChange}
177
+ // onSelect={setMobileChange}
178
+ // />
179
+ // <CardLabel>{t("EKYC_MOBILE_NUMBER")} <span className="astericColor">*</span></CardLabel>
180
+ // <TextInput
181
+ // id="mobileNumber"
182
+ // name="mobileNumber"
183
+ // value={mobileNumber}
184
+ // onChange={(e) => setMobileNumber(e.target.value)}
185
+ // disabled={mobileChange.code === "NO"}
186
+ // />
187
+
188
+ // <CardLabel>{t("EKYC_WHATSAPP_NUMBER")}</CardLabel>
189
+ // <TextInput
190
+ // id="whatsappNumber"
191
+ // name="whatsappNumber"
192
+ // value={whatsappNumber}
193
+ // onChange={(e) => setWhatsappNumber(e.target.value)}
194
+ // />
195
+
196
+ // <CardLabel>{t("EKYC_EMAIL_ID")}</CardLabel>
197
+ // <TextInput
198
+ // id="email"
199
+ // name="email"
200
+ // value={email}
201
+ // onChange={(e) => setEmail(e.target.value)}
202
+ // />
203
+
204
+ // <CardLabel>{t("EKYC_NO_OF_PERSONS")}</CardLabel>
205
+ // <TextInput
206
+ // id="noOfPersons"
207
+ // name="noOfPersons"
208
+ // value={noOfPersons}
209
+ // onChange={(e) => setNoOfPersons(e.target.value)}
210
+ // />
211
+ // </Fragment>
212
+ // )}
213
+ // </FormStep>
214
+ // {isEditing && !onSelect && (
215
+ // <ActionBar style={{ position: "static", marginTop: "20px" }}>
216
+ // <SubmitBar label={t("EKYC_UPDATE_AND_RETURN")} onSubmit={handleUpdateAndReturn} />
217
+ // </ActionBar>
218
+ // )}
219
+ // </Fragment>
220
+ // );
221
+ // };
222
+
223
+ // export default AadhaarVerification;
224
+
225
+
226
+
227
+ import React, { useState, Fragment } from "react";
228
+ import {
229
+ CardLabel,
230
+ TextInput,
231
+ Dropdown,
232
+ UploadFile,
233
+ RadioButtons,
234
+ Toast,
235
+ FormStep,
236
+ } from "@djb25/digit-ui-react-components";
237
+
238
+ const ConsumerDetails = ({ config, onSelect }) => {
239
+
240
+ // 🔹 STATES
241
+ const [kno, setKno] = useState("");
242
+ const [consumerType, setConsumerType] = useState(null);
243
+ const [occupantType, setOccupantType] = useState(null);
244
+ const [categoryType, setCategoryType] = useState(null);
245
+
246
+ const [consumerName, setConsumerName] = useState("");
247
+ const [firstName, setFirstName] = useState("");
248
+ const [middleName, setMiddleName] = useState("");
249
+ const [lastName, setLastName] = useState("");
250
+
251
+ const [gender, setGender] = useState(null);
252
+ const [relation, setRelation] = useState("");
253
+
254
+ const [mobile, setMobile] = useState("");
255
+ const [whatsapp, setWhatsapp] = useState("");
256
+ const [email, setEmail] = useState("");
257
+ const [residents, setResidents] = useState("");
258
+
259
+ // Tenant
260
+ const [documentProof, setDocumentProof] = useState(null);
261
+ const [documentId, setDocumentId] = useState(null);
262
+ const [ownerMobile, setOwnerMobile] = useState("");
263
+ const [tenantVerification, setTenantVerification] = useState("");
264
+
265
+ // Govt
266
+ const [designation, setDesignation] = useState("");
267
+ const [department, setDepartment] = useState("");
268
+ const [employeeId, setEmployeeId] = useState("");
269
+ const [landline, setLandline] = useState("");
270
+
271
+ // Other Entity
272
+ const [entityRelation, setEntityRelation] = useState("");
273
+ const [contactPerson, setContactPerson] = useState("");
274
+ const [entityName, setEntityName] = useState("");
275
+
276
+ // Identity
277
+ const [idProof, setIdProof] = useState(null);
278
+ const [idNumber, setIdNumber] = useState("");
279
+ const [idFile, setIdFile] = useState(null);
280
+
281
+
282
+ const [toast, setToast] = useState(null);
283
+
284
+ // 🔹 OPTIONS
285
+ const consumerTypeOptions = [
286
+ { name: "Individual" },
287
+ { name: "Govt" },
288
+ { name: "Company_Society_Org" },
289
+ ];
290
+
291
+ const occupantOptions = [
292
+ { name: "Self" },
293
+ { name: "Tenanted" },
294
+ ];
295
+
296
+ const genderOptions = [
297
+ { name: "Male" },
298
+ { name: "Female" },
299
+ { name: "Others" },
300
+ { name: "Not prefer to say" },
301
+ ];
302
+
303
+ const yesNo = [{ name: "Yes" }, { name: "No" }];
304
+
305
+ // 🔹 FILE UPLOAD
306
+ const uploadFile = async (e, setter, idSetter) => {
307
+ const file = e.target.files[0];
308
+ if (!file) return;
309
+
310
+ try {
311
+ const res = await Digit.UploadServices.Filestorage("EKYC", file);
312
+ const id = res?.data?.files?.[0]?.fileStoreId;
313
+ if (id) {
314
+ setter(file.name);
315
+ idSetter(id);
316
+ }
317
+ } catch {
318
+ setToast({ type: "error", message: "Upload failed" });
319
+ }
320
+ };
321
+
322
+ // 🔹 VALIDATION
323
+ const isValid = () => {
324
+ if (!kno) return false;
325
+ if (!consumerType) return false;
326
+ if (!occupantType) return false;
327
+ if (!categoryType) return false;
328
+ if (!firstName) return false;
329
+ if (!mobile) return false;
330
+ if (!residents || Number(residents) <= 0) return false;
331
+
332
+ if (occupantType?.name === "Tenanted" && !documentId && !ownerMobile)
333
+ return false;
334
+
335
+ return consent;
336
+ };
337
+
338
+ // 🔹 SUBMIT
339
+ const onStepSelect = () => {
340
+ if (!isValid()) {
341
+ setToast({ type: "error", message: "Fill required fields" });
342
+ return;
343
+ }
344
+
345
+ const data = {
346
+ kno,
347
+ consumerType: consumerType?.name,
348
+ occupantType: occupantType?.name,
349
+ categoryType: categoryType?.name,
350
+ consumerName,
351
+ firstName,
352
+ middleName,
353
+ lastName,
354
+ gender: gender?.name,
355
+ relation,
356
+ mobile,
357
+ whatsapp,
358
+ email,
359
+ residents,
360
+ documentId,
361
+ ownerMobile,
362
+ tenantVerification,
363
+ designation,
364
+ department,
365
+ employeeId,
366
+ landline,
367
+ entityRelation,
368
+ contactPerson,
369
+ entityName,
370
+ idProof: idProof?.name,
371
+ idNumber,
372
+ consent,
373
+ informantIsConsumer,
374
+ informantName,
375
+ informantRelation,
376
+ };
377
+
378
+ onSelect(config.key, data);
379
+ };
380
+
381
+ return (
382
+ <Fragment>
383
+ <FormStep onSelect={onStepSelect} config={config}>
384
+ <div>
385
+ <CardLabel>K Number *</CardLabel>
386
+ <TextInput value={kno} onChange={(e) => setKno(e.target.value)} />
387
+ </div>
388
+
389
+ <div>
390
+ <CardLabel>Consumer Type *</CardLabel>
391
+ <Dropdown option={consumerTypeOptions} selected={consumerType} select={setConsumerType} />
392
+ </div>
393
+
394
+ <div>
395
+ <CardLabel>Occupant Type *</CardLabel>
396
+ <Dropdown option={occupantOptions} selected={occupantType} select={setOccupantType} />
397
+ </div>
398
+
399
+ <div>
400
+ <CardLabel>Category Type *</CardLabel>
401
+ <Dropdown option={[]} selected={categoryType} select={setCategoryType} />
402
+ </div>
403
+
404
+ <div>
405
+ <CardLabel>First Name *</CardLabel>
406
+ <TextInput value={firstName} onChange={(e) => setFirstName(e.target.value)} />
407
+ </div>
408
+
409
+ <div>
410
+ <CardLabel>Middle Name</CardLabel>
411
+ <TextInput value={middleName} onChange={(e) => setMiddleName(e.target.value)} />
412
+ </div>
413
+
414
+ <div>
415
+ <CardLabel>Last Name</CardLabel>
416
+ <TextInput value={lastName} onChange={(e) => setLastName(e.target.value)} />
417
+ </div>
418
+
419
+ <div>
420
+ <CardLabel>Gender</CardLabel>
421
+ <Dropdown option={genderOptions} selected={gender} select={setGender} />
422
+ </div>
423
+
424
+ <div>
425
+ <CardLabel>Mobile *</CardLabel>
426
+ <TextInput value={mobile} onChange={(e) => setMobile(e.target.value)} />
427
+ </div>
428
+
429
+ <div>
430
+ <CardLabel>WhatsApp</CardLabel>
431
+ <TextInput value={whatsapp} onChange={(e) => setWhatsapp(e.target.value)} />
432
+ </div>
433
+
434
+ <div>
435
+ <CardLabel>Email</CardLabel>
436
+ <TextInput value={email} onChange={(e) => setEmail(e.target.value)} />
437
+ </div>
438
+
439
+ <div>
440
+ <CardLabel>No. of Residents *</CardLabel>
441
+ <TextInput value={residents} onChange={(e) => setResidents(e.target.value)} />
442
+ </div>
443
+
444
+ {/* TENANT LOGIC */}
445
+ {occupantType?.name === "Tenanted" && (
446
+ <Fragment>
447
+ <div>
448
+ <CardLabel>Document Proof</CardLabel>
449
+ <UploadFile onUpload={(e) => uploadFile(e, setDocumentProof, setDocumentId)} />
450
+ </div>
451
+
452
+ {!documentId && (
453
+ <Fragment>
454
+ <div>
455
+ <CardLabel>Owner Mobile *</CardLabel>
456
+ <TextInput value={ownerMobile} onChange={(e) => setOwnerMobile(e.target.value)} />
457
+ </div>
458
+
459
+ <div>
460
+ <CardLabel>Tenant Verification</CardLabel>
461
+ <TextInput value={tenantVerification} onChange={(e) => setTenantVerification(e.target.value)} />
462
+ </div>
463
+ </Fragment>
464
+ )}
465
+ </Fragment>
466
+ )}
467
+
468
+ {/* GOVT */}
469
+ {consumerType?.name === "Govt" && (
470
+ <Fragment>
471
+ <div>
472
+ <CardLabel>Designation</CardLabel>
473
+ <TextInput value={designation} onChange={(e) => setDesignation(e.target.value)} />
474
+ </div>
475
+
476
+ <div>
477
+ <CardLabel>Department</CardLabel>
478
+ <TextInput value={department} onChange={(e) => setDepartment(e.target.value)} />
479
+ </div>
480
+
481
+ <div>
482
+ <CardLabel>Employee ID</CardLabel>
483
+ <TextInput value={employeeId} onChange={(e) => setEmployeeId(e.target.value)} />
484
+ </div>
485
+ </Fragment>
486
+ )}
487
+
488
+ {/* OTHER ENTITY */}
489
+ {consumerType?.name === "Company_Society_Org" && (
490
+ <Fragment>
491
+ <div>
492
+ <CardLabel>Entity Name</CardLabel>
493
+ <TextInput value={entityName} onChange={(e) => setEntityName(e.target.value)} />
494
+ </div>
495
+
496
+ <div>
497
+ <CardLabel>Contact Person</CardLabel>
498
+ <TextInput value={contactPerson} onChange={(e) => setContactPerson(e.target.value)} />
499
+ </div>
500
+ </Fragment>
501
+ )}
502
+
503
+
504
+
505
+ {toast && <Toast label={toast.message} error={toast.type === "error"} onClose={() => setToast(null)} />}
506
+
507
+ </FormStep>
508
+ </Fragment>
509
+ );
510
+ };
511
+
512
+ export default ConsumerDetails;
@@ -14,6 +14,7 @@ const Create = () => {
14
14
  return sessionStorage.getItem("EKYC_CREATE_SEARCH_PERFORMED") === "true";
15
15
  });
16
16
  const [showToast, setShowToast] = useState(null);
17
+ const [formParams, setFormParams, clearParams] = Digit.Hooks.useSessionStorage("EKYC_CREATE", {});
17
18
 
18
19
  const tenantId = Digit.ULBService.getCurrentTenantId();
19
20
 
@@ -36,6 +37,7 @@ const Create = () => {
36
37
  setSearchPerformed(false);
37
38
  sessionStorage.removeItem("EKYC_CREATE_SEARCH_PARAMS");
38
39
  sessionStorage.removeItem("EKYC_CREATE_SEARCH_PERFORMED");
40
+ clearParams(); // Clear consolidated EKYC data
39
41
  return;
40
42
  }
41
43
 
@@ -49,8 +51,10 @@ const Create = () => {
49
51
  // Clear previous EKYC session data if K-number changes
50
52
  const currentKno = sessionStorage.getItem("EKYC_K_NUMBER");
51
53
  if (currentKno !== params.kNumber) {
54
+ clearParams();
55
+ // Clear any other EKYC keys if they exist
52
56
  Object.keys(sessionStorage).forEach(key => {
53
- if (key.startsWith("EKYC_")) sessionStorage.removeItem(key);
57
+ if (key.startsWith("EKYC_") && key !== "EKYC_CREATE") sessionStorage.removeItem(key);
54
58
  });
55
59
  }
56
60
 
@@ -64,28 +68,26 @@ const Create = () => {
64
68
  };
65
69
 
66
70
  return (
67
- <div class="ground-container employee-app-container form-container">
68
- <SearchConsumer
69
- onSearch={handleSearch}
70
- searchParams={searchParams}
71
- >
72
- {searchPerformed && (
73
- <ConnectionDetailsView
74
- kNumber={searchParams.kNumber}
75
- kName={searchParams.kName}
76
- connectionDetails={connectionDetails}
77
- isLoading={isSearching}
78
- />
79
- )}
71
+ <SearchConsumer
72
+ onSearch={handleSearch}
73
+ searchParams={searchParams}
74
+ >
75
+ {searchPerformed && (
76
+ <ConnectionDetailsView
77
+ kNumber={searchParams.kNumber}
78
+ kName={searchParams.kName}
79
+ connectionDetails={connectionDetails}
80
+ isLoading={isSearching}
81
+ />
82
+ )}
80
83
 
81
- {!searchPerformed && !isSearching && (
82
- <Card style={{ textAlign: "center", padding: "40px" }}>
83
- <div style={{ color: "#667085" }}>{t("EKYC_SEARCH_TO_VIEW_DETAILS")}</div>
84
- </Card>
85
- )}
86
- {showToast && <Toast error={showToast.error} label={showToast.label} onClose={closeToast} isDsc={true} />}
87
- </SearchConsumer>
88
- </div>
84
+ {!searchPerformed && !isSearching && (
85
+ <Card style={{ textAlign: "center", padding: "40px" }}>
86
+ <div style={{ color: "#667085" }}>{t("EKYC_SEARCH_TO_VIEW_DETAILS")}</div>
87
+ </Card>
88
+ )}
89
+ {showToast && <Toast error={showToast.error} label={showToast.label} onClose={closeToast} isDsc={true} />}
90
+ </SearchConsumer>
89
91
  );
90
92
  };
91
93
 
@@ -0,0 +1,43 @@
1
+ import React, { useMemo } from "react";
2
+ import StatusCards from "../../components/StatusCards";
3
+ import { Card, Loader } from "@djb25/digit-ui-react-components";
4
+
5
+ // Mock data removed in favor of API integration
6
+
7
+ const Dashboard = ({ parentRoute, businessService = "EKYC", initialStates = {}, filterComponent, isInbox }) => {
8
+ const tenantId = Digit.ULBService.getCurrentTenantId();
9
+
10
+ // 2. API Data Fetching
11
+ const { isLoading, data: dashboardData } = Digit.Hooks.ekyc.useEkycSurveyorDashboard(
12
+ {},
13
+ {
14
+ tenantId,
15
+ offset: 0,
16
+ limit: 10,
17
+ },
18
+ {
19
+ enabled: !!tenantId,
20
+ }
21
+ );
22
+
23
+ const countData = useMemo(() => {
24
+ const info = dashboardData?.dashboardInfo || {};
25
+ return {
26
+ total: info.total || 0,
27
+ completed: info.completed || 0,
28
+ pending: info.pending || 0,
29
+ rejected: info.rejected || 0,
30
+ active: info.active || 0,
31
+ };
32
+ }, [dashboardData]);
33
+
34
+ return isLoading ? (
35
+ <Loader />
36
+ ) : (
37
+ <Card>
38
+ <StatusCards countData={countData} />
39
+ </Card>
40
+ );
41
+ };
42
+
43
+ export default Dashboard;