@djb25/digit-ui-module-ekyc 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1969 -737
- package/dist/index.modern.js.map +1 -1
- package/package.json +4 -2
- package/src/Module.js +17 -1
- package/src/components/ConnectionDetailsView.js +180 -59
- package/src/components/DesktopInbox.js +153 -7
- package/src/components/EKYCCard.js +4 -0
- package/src/components/SearchConsumer.js +104 -94
- package/src/components/StatusCards.js +145 -16
- package/src/pages/citizen/index.js +90 -0
- package/src/pages/employee/AadhaarVerification.js +324 -281
- package/src/pages/employee/AddressDetails.js +127 -102
- package/src/pages/employee/Create.js +10 -0
- package/src/pages/employee/Inbox.js +11 -4
- package/src/pages/employee/Mapping.js +11 -0
- package/src/pages/employee/MeterDetails.js +486 -0
- package/src/pages/employee/PropertyInfo.js +387 -323
- package/src/pages/employee/Review.js +371 -227
- package/src/pages/employee/index.js +14 -1
- package/src/utils/index.js +46 -0
|
@@ -3,10 +3,12 @@ import React from "react";
|
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
4
|
import { Switch, useLocation } from "react-router-dom";
|
|
5
5
|
import Inbox from "./Inbox";
|
|
6
|
+
//import Mapping from "./Mapping";
|
|
6
7
|
import Create from "./Create";
|
|
7
8
|
import AadhaarVerification from "./AadhaarVerification";
|
|
8
9
|
import AddressDetails from "./AddressDetails";
|
|
9
10
|
import PropertyInfo from "./PropertyInfo";
|
|
11
|
+
import MeterDetails from "./MeterDetails";
|
|
10
12
|
import Review from "./Review";
|
|
11
13
|
|
|
12
14
|
const EmployeeApp = ({ path }) => {
|
|
@@ -23,6 +25,7 @@ const EmployeeApp = ({ path }) => {
|
|
|
23
25
|
if (pathname.includes("/aadhaar-verification")) return "EKYC_AADHAAR_VERIFICATION";
|
|
24
26
|
if (pathname.includes("/address-details")) return "EKYC_ADDRESS_DETAILS";
|
|
25
27
|
if (pathname.includes("/property-info")) return "EKYC_PROPERTY_INFO";
|
|
28
|
+
if (pathname.includes("/meter-details")) return "EKYC_METER_DETAILS";
|
|
26
29
|
if (pathname.includes("/review")) return "EKYC_REVIEW";
|
|
27
30
|
return "ES_COMMON_INBOX";
|
|
28
31
|
};
|
|
@@ -34,7 +37,7 @@ const EmployeeApp = ({ path }) => {
|
|
|
34
37
|
|
|
35
38
|
return (
|
|
36
39
|
<AppContainer>
|
|
37
|
-
<div className="ground-container employee-app-container">
|
|
40
|
+
<div className="ground-container employee-app-container employee-app-homepage-container">
|
|
38
41
|
<ModuleHeader
|
|
39
42
|
leftContent={
|
|
40
43
|
<React.Fragment>
|
|
@@ -64,6 +67,11 @@ const EmployeeApp = ({ path }) => {
|
|
|
64
67
|
component={() => <Create />}
|
|
65
68
|
/>
|
|
66
69
|
|
|
70
|
+
{/* <PrivateRoute
|
|
71
|
+
path={`${path}/mapping`}
|
|
72
|
+
component={() => <Mapping />}
|
|
73
|
+
/> */}
|
|
74
|
+
|
|
67
75
|
<PrivateRoute
|
|
68
76
|
path={`${path}/aadhaar-verification`}
|
|
69
77
|
component={() => <AadhaarVerification />}
|
|
@@ -78,6 +86,11 @@ const EmployeeApp = ({ path }) => {
|
|
|
78
86
|
path={`${path}/property-info`}
|
|
79
87
|
component={() => <PropertyInfo />}
|
|
80
88
|
/>
|
|
89
|
+
|
|
90
|
+
<PrivateRoute
|
|
91
|
+
path={`${path}/meter-details`}
|
|
92
|
+
component={() => <MeterDetails />}
|
|
93
|
+
/>
|
|
81
94
|
|
|
82
95
|
<PrivateRoute
|
|
83
96
|
path={`${path}/review`}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compares initial and current objects and returns an object containing only the differences.
|
|
3
|
+
* Highly optimized for partial updates (PATCH-like behavior).
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} initial - The original data from the backend.
|
|
6
|
+
* @param {Object} current - The current form state.
|
|
7
|
+
* @returns {Object} - An object with only the changed fields.
|
|
8
|
+
*/
|
|
9
|
+
export const getPayloadDiff = (initial, current) => {
|
|
10
|
+
const diff = {};
|
|
11
|
+
|
|
12
|
+
Object.keys(current).forEach(key => {
|
|
13
|
+
const initialVal = initial?.[key];
|
|
14
|
+
const currentVal = current[key];
|
|
15
|
+
|
|
16
|
+
// Handle nested objects (like addressDetails or aadhaarDetails)
|
|
17
|
+
if (currentVal && typeof currentVal === 'object' && !Array.isArray(currentVal) && !(currentVal instanceof File)) {
|
|
18
|
+
const nestedDiff = getPayloadDiff(initialVal || {}, currentVal);
|
|
19
|
+
if (Object.keys(nestedDiff).length > 0) {
|
|
20
|
+
diff[key] = nestedDiff;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// Handle primitive types or arrays/files
|
|
24
|
+
else if (JSON.stringify(initialVal) !== JSON.stringify(currentVal)) {
|
|
25
|
+
diff[key] = currentVal;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return diff;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Safely retrieves and parses JSON data from sessionStorage.
|
|
34
|
+
* @param {string} key - The storage key.
|
|
35
|
+
* @param {*} fallback - Default value if no data is found.
|
|
36
|
+
* @returns {*} The parsed data or fallback.
|
|
37
|
+
*/
|
|
38
|
+
export const getSavedData = (key, fallback) => {
|
|
39
|
+
const saved = sessionStorage.getItem(key);
|
|
40
|
+
try {
|
|
41
|
+
return saved ? JSON.parse(saved) : fallback;
|
|
42
|
+
} catch (e) {
|
|
43
|
+
console.warn(`Error parsing sessionStorage key "${key}":`, e);
|
|
44
|
+
return fallback;
|
|
45
|
+
}
|
|
46
|
+
};
|