@djb25/digit-ui-module-ekyc 1.0.22 → 1.0.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djb25/digit-ui-module-ekyc",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "Digit UI Module for Ekyc",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.modern.js",
@@ -7,7 +7,10 @@ import SearchFormFieldsComponents from "./SearchFormFieldsComponent";
7
7
  // Mock data removed in favor of API integration
8
8
 
9
9
  const AssignEkyc = () => {
10
- const tenantId = Digit.ULBService.getCurrentTenantId();
10
+ let tenantId = Digit.ULBService.getCurrentTenantId();
11
+ if (!tenantId || tenantId === "dl") {
12
+ tenantId = "dl.djb"; // Force tenantId to dl.djb for EKYC APIs in citizen portal
13
+ }
11
14
  const location = useLocation();
12
15
  const formInitValue = {
13
16
  filterForm: {},
@@ -30,48 +33,32 @@ const AssignEkyc = () => {
30
33
  sortOrder: formState?.tableForm?.sortOrder || "DESC",
31
34
  };
32
35
 
36
+ const mobileNumber = formState?.searchForm?.mobileNumber || "";
37
+ const isSearchActive = !!mobileNumber;
38
+
39
+ const filters = {
40
+ ...paginationParms,
41
+ status: "ACTIVE,DISABLED",
42
+ };
43
+
44
+ if (isSearchActive) {
45
+ filters.mobileNumber = mobileNumber;
46
+ }
47
+
33
48
  const { data: dashboardData, isLoading } = Digit.Hooks.fsm.useSurveyorSearch(
34
49
  tenantId,
35
- { ...paginationParms, status: "ACTIVE,DISABLED", vendorId: userDetails?.info?.uuid },
50
+ filters,
36
51
  { enabled: !!tenantId, keepPreviousData: true }
37
52
  );
38
53
 
39
- const searchDetails = useMemo(
40
- () => ({
41
- kno: formState?.searchForm?.kNumber || "",
42
- name: formState?.searchForm?.kName || "",
43
- }),
44
- [formState?.searchForm?.kNumber, formState?.searchForm?.kName]
45
- );
46
-
47
- const isSearchActive = !!(searchDetails.kno || searchDetails.name);
48
-
49
- const { isLoading: isSearchLoading, data: searchData } = Digit.Hooks.ekyc.useSearchConnection(
50
- {
51
- tenantId,
52
- details: searchDetails,
53
- },
54
- {
55
- enabled: !!tenantId && !!searchDetails.kno, // 🔥 important
56
- keepPreviousData: true,
57
- }
58
- );
59
- const { isLoading: isDataSearchLoading, data } = Digit.Hooks.ekyc.useEkycAssignmentProgress(
60
- {},
61
- {
62
- enabled: !!tenantId && !!searchDetails.kno, // 🔥 important
63
- keepPreviousData: true,
64
- }
65
- );
54
+ const { isLoading: isDataSearchLoading, data } = Digit.Hooks.ekyc.useEkycAssignmentProgress({
55
+ enabled: !!tenantId,
56
+ keepPreviousData: true,
57
+ });
66
58
 
67
59
  const sourceData = useMemo(() => {
68
- if (isSearchActive) {
69
- if (!searchData) return [];
70
- return [searchData];
71
- }
72
-
73
60
  return dashboardData?.surveyors || [];
74
- }, [isSearchActive, searchData, dashboardData]);
61
+ }, [dashboardData]);
75
62
 
76
63
  const filteredData = useMemo(() => {
77
64
  return (sourceData || []).map((item) => {
@@ -246,7 +233,7 @@ const AssignEkyc = () => {
246
233
  },
247
234
  });
248
235
 
249
- const isInboxLoading = isLoading || isSearchLoading;
236
+ const isInboxLoading = isLoading;
250
237
 
251
238
  const cards = [
252
239
  {
@@ -9,7 +9,7 @@ const SearchFormFieldsComponents = ({ searchFormState, controlSearchForm }) => {
9
9
 
10
10
  return (
11
11
  <React.Fragment>
12
- {/* K NUMBER */}
12
+ {/* MOBILE NUMBER */}
13
13
  <span className="mobile-input">
14
14
  <Label className="flex-roww flex-gap-2">
15
15
  {t("EKYC_MOBILE_NUMBER") || "Mobile Number"}
@@ -17,19 +17,19 @@ const SearchFormFieldsComponents = ({ searchFormState, controlSearchForm }) => {
17
17
  </Label>
18
18
 
19
19
  <Controller
20
- name="kNumber"
20
+ name="mobileNumber"
21
21
  control={controlSearchForm}
22
22
  defaultValue=""
23
23
  rules={{
24
24
  pattern: {
25
- value: /^[a-zA-Z0-9-_/]*$/,
26
- message: t("ERR_INVALID_APPLICATION_NO"),
25
+ value: /^[0-9]{10}$/,
26
+ message: t("ERR_INVALID_MOBILE_NO"),
27
27
  },
28
28
  }}
29
29
  render={({ onChange, value }) => <TextInput value={value || ""} onChange={(e) => onChange(e.target.value)} />}
30
30
  />
31
31
 
32
- {errors?.kNumber && <CardLabelError>{errors.kNumber.message}</CardLabelError>}
32
+ {errors?.mobileNumber && <CardLabelError>{errors.mobileNumber.message}</CardLabelError>}
33
33
  </span>
34
34
 
35
35
  {/* K NAME */}
@@ -0,0 +1,71 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import { CardLabel, LabelFieldPair, MultiSelectDropdown, Loader } from "@djb25/digit-ui-react-components";
3
+
4
+ const SelectEkycZones = ({ config, onSelect, t, formData, isMultiSelect = true, placeHolder }) => {
5
+ const tenantId = Digit.ULBService.getCurrentTenantId();
6
+
7
+ const [zones, setZones] = useState([]);
8
+
9
+ const [selectedZones, setSelectedZones] = useState(Array.isArray(formData?.zoneIds) ? formData.zoneIds : []);
10
+
11
+ const { data: boundaryData, isLoading } = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]);
12
+
13
+ useEffect(() => {
14
+ const tenantBoundary = boundaryData?.["egov-location"]?.TenantBoundary?.[0] || boundaryData?.MdmsRes?.["egov-location"]?.TenantBoundary?.[0];
15
+
16
+ const boundaries = tenantBoundary?.boundary || tenantBoundary?.children || [];
17
+
18
+ if (Array.isArray(boundaries?.children) && boundaries?.children.length > 0) {
19
+ const allZones = boundaries.children.flatMap((assembly) =>
20
+ (assembly?.children || []).map((zone) => ({
21
+ code: zone.code,
22
+ name: zone.name,
23
+ }))
24
+ );
25
+
26
+ const zonesList = [...new Map(allZones.map((zone) => [zone.code, zone])).values()];
27
+
28
+ setZones(zonesList);
29
+ }
30
+ }, [boundaryData]);
31
+
32
+ const handleSelect = (value) => {
33
+ if (isMultiSelect) {
34
+ const extractedValue = Array.isArray(value) ? value.map((v) => (Array.isArray(v) ? v[1] : v)).filter(Boolean) : [];
35
+
36
+ setSelectedZones(extractedValue);
37
+ onSelect(config.key, extractedValue);
38
+ } else {
39
+ const selectedZone = Array.isArray(value) ? (Array.isArray(value[0]) ? value[0][1] : value[0]) : value;
40
+
41
+ setSelectedZones(selectedZone ? [selectedZone] : []);
42
+
43
+ onSelect(config.key, selectedZone?.code || "");
44
+ }
45
+ };
46
+
47
+ if (isLoading) return <Loader />;
48
+
49
+ return (
50
+ <LabelFieldPair>
51
+ <CardLabel>{t(config.label) + (config.isMandatory ? " *" : "")}</CardLabel>
52
+
53
+ <div className="field" style={{ position: "relative", zIndex: 10 }}>
54
+ <MultiSelectDropdown
55
+ options={zones}
56
+ selected={selectedZones}
57
+ onSelect={handleSelect}
58
+ optionsKey="name"
59
+ t={t}
60
+ multiple={isMultiSelect}
61
+ ServerStyle={{ backgroundColor: "#fff" }}
62
+ isMultiSelect={isMultiSelect}
63
+ placeHolder={placeHolder}
64
+ showSelectedLabels={true}
65
+ />
66
+ </div>
67
+ </LabelFieldPair>
68
+ );
69
+ };
70
+
71
+ export default SelectEkycZones;
@@ -38,10 +38,14 @@ const SurveyorDetailsDashboard = () => {
38
38
  surveyorId: surveyor?.owner?.uuid,
39
39
  };
40
40
 
41
- const { isFetching: isDashboardLoading, data: dashboardData = {} } = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, queryParams, {
42
- enabled: !!queryParams.tenantId && !!queryParams.surveyorId,
43
- keepPreviousData: true,
44
- });
41
+ const { isFetching: isDashboardLoading, data: dashboardData = {}, refetch: refetchDashboard } = Digit.Hooks.ekyc.useEkycSurveyorDashboard(
42
+ {},
43
+ queryParams,
44
+ {
45
+ enabled: !!queryParams.tenantId && !!queryParams.surveyorId,
46
+ keepPreviousData: true,
47
+ }
48
+ );
45
49
 
46
50
  const knoColumns = useMemo(
47
51
  () => [
@@ -145,6 +149,11 @@ const SurveyorDetailsDashboard = () => {
145
149
  setShowModal(true);
146
150
  };
147
151
 
152
+ const closeModal = async () => {
153
+ await refetchDashboard();
154
+ setShowModal(false);
155
+ };
156
+
148
157
  return (
149
158
  <Card className="surveyor-dashboard">
150
159
  {/* Header */}
@@ -301,7 +310,7 @@ const SurveyorDetailsDashboard = () => {
301
310
  </ActionBar>
302
311
  )}
303
312
 
304
- {showModal && <AssignEkycModal surveyor={surveyor} closeModal={() => setShowModal(false)} />}
313
+ {showModal && <AssignEkycModal surveyor={surveyor} closeModal={closeModal} />}
305
314
  </Card>
306
315
  );
307
316
  };