@djb25/digit-ui-module-ekyc 1.0.44 → 1.0.46

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.
@@ -155,6 +155,8 @@ const StatusCards = _ref => {
155
155
  total: info.total || 0,
156
156
  completed: info.completed || 0,
157
157
  pending: info.pending || 0,
158
+ submittedCount: info.submittedCount || 0,
159
+ inProgressCount: info.inProgressCount || 0,
158
160
  rejected: info.rejected || 0,
159
161
  active: info.active || 0
160
162
  };
@@ -245,10 +247,12 @@ const StatusCards = _ref => {
245
247
  const pending = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.pending) || (countData === null || countData === void 0 ? void 0 : countData.pending) || 0;
246
248
  const active = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.active) || (countData === null || countData === void 0 ? void 0 : countData.active) || 0;
247
249
  const completed = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.completed) || (countData === null || countData === void 0 ? void 0 : countData.completed) || 0;
250
+ const inprocess = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.inProgressCount) || (countData === null || countData === void 0 ? void 0 : countData.inProgressCount) || 0;
251
+ const submitted = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.submittedCount) || (countData === null || countData === void 0 ? void 0 : countData.submittedCount) || 0;
248
252
  const actualCompleted = completed;
249
253
  const approved = actualCompleted;
250
- const efficiency = total > 0 ? Math.round(actualCompleted / total * 100) : 0;
251
- const healthPct = total > 0 ? Math.round(approved / total * 100) : 0;
254
+ const efficiency = total > 0 ? Math.round((submitted + completed) / total * 100) : 0;
255
+ const healthPct = submitted > 0 ? Math.round(approved / submitted * 100) : 0;
252
256
  const formatNumber = num => new Intl.NumberFormat("en-IN").format(num || 0);
253
257
  useEffect(() => {
254
258
  if (chartRef1.current) {
@@ -258,11 +262,11 @@ const StatusCards = _ref => {
258
262
  chartInstance1.current = new ChartConstructor(ctx1, {
259
263
  type: "doughnut",
260
264
  data: {
261
- labels: [t("EKYC_ACTIVE"), t("EKYC_PENDING"), t("EKYC_COMPLETED")],
265
+ labels: [t("EKYC_PENDING"), t("EKYC_COMPLETED"), t("EKYC_SUBMITTED"), t("EKYC_INPROCESS")],
262
266
  datasets: [{
263
- data: [active, pending, completed],
264
- backgroundColor: ["#0c2a52", "#77B6EA", "#c8ddf5"],
265
- borderColor: ["#ffffff", "#ffffff", "#ffffff"],
267
+ data: [pending, completed, submitted, inprocess],
268
+ backgroundColor: ["#0c2a52", "#77B6EA", "#c8ddf5", "#49a3fb"],
269
+ borderColor: ["#ffffff", "#ffffff", "#ffffff", "#ffffff"],
266
270
  borderWidth: 2,
267
271
  hoverOffset: 4
268
272
  }]
@@ -284,17 +288,21 @@ const StatusCards = _ref => {
284
288
  };
285
289
  }, [pending, completed, active, t]);
286
290
  const legendItems = [{
287
- color: "#0c2a52",
288
- label: t("EKYC_ACTIVE"),
289
- value: active
290
- }, {
291
291
  color: "#77B6EA",
292
+ label: t("EKYC_COMPLETED"),
293
+ value: completed
294
+ }, {
295
+ color: "#0c2a52",
292
296
  label: t("EKYC_PENDING"),
293
297
  value: pending
294
298
  }, {
295
299
  color: "#c8ddf5",
296
- label: t("EKYC_COMPLETED"),
297
- value: completed
300
+ label: t("EKYC_SUBMITTED"),
301
+ value: submitted
302
+ }, {
303
+ color: "#49a3fb",
304
+ label: t("EKYC_INPROCESS"),
305
+ value: inprocess
298
306
  }];
299
307
  return /*#__PURE__*/React.createElement("div", {
300
308
  className: "ekyc-employee-container"
@@ -316,9 +324,7 @@ const StatusCards = _ref => {
316
324
  className: "total-label"
317
325
  }, t("EKYC_TOTAL_APPLICATIONS") || "Total Applications Processed"), /*#__PURE__*/React.createElement("div", {
318
326
  className: "total-number"
319
- }, formatNumber(total)), /*#__PURE__*/React.createElement("div", {
320
- className: "total-badge"
321
- }, "\u2197 +12.4% ", t("EKYC_FROM_LAST_QUARTER") || "from last quarter"), /*#__PURE__*/React.createElement("button", {
327
+ }, formatNumber(total)), /*#__PURE__*/React.createElement("button", {
322
328
  className: "download-excel-btn",
323
329
  disabled: ekycDownloadLoading,
324
330
  onClick: handleDownloadEkycData
@@ -382,17 +388,13 @@ const StatusCards = _ref => {
382
388
  className: "status-panel"
383
389
  }, /*#__PURE__*/React.createElement("div", {
384
390
  className: "panel-title"
385
- }, t("EKYC_SUBMISSION_HEALTH") || "Submission Health", /*#__PURE__*/React.createElement("span", {
386
- className: "optimal-badge"
387
- }, t("EKYC_OPTIMAL") || "Optimal")), /*#__PURE__*/React.createElement("div", {
391
+ }, t("EKYC_SUBMISSION_HEALTH") || "Submission Health"), /*#__PURE__*/React.createElement("div", {
388
392
  className: "panel-subtitle"
389
393
  }, t("EKYC_PLATFORM_EFFICIENCY") || "Platform operational efficiency"), /*#__PURE__*/React.createElement("div", {
390
394
  className: "health-metrics-row"
391
395
  }, /*#__PURE__*/React.createElement("div", {
392
396
  className: "health-percentage"
393
- }, healthPct, "%"), /*#__PURE__*/React.createElement("div", {
394
- className: "health-trend"
395
- }, "\u2197 +2.1%")), /*#__PURE__*/React.createElement("div", {
397
+ }, healthPct, "%")), /*#__PURE__*/React.createElement("div", {
396
398
  className: "status-progress-bar"
397
399
  }, /*#__PURE__*/React.createElement("div", {
398
400
  className: "progress-fill",
@@ -407,13 +409,13 @@ const StatusCards = _ref => {
407
409
  className: "metric-label"
408
410
  }, t("EKYC_AVG_LATENCY") || "Avg Latency"), /*#__PURE__*/React.createElement("div", {
409
411
  className: "metric-value"
410
- }, "1.2s")), /*#__PURE__*/React.createElement("div", {
412
+ }, "0s")), /*#__PURE__*/React.createElement("div", {
411
413
  className: "metric-box"
412
414
  }, /*#__PURE__*/React.createElement("div", {
413
415
  className: "metric-label"
414
416
  }, t("EKYC_ERROR_RATE") || "Error Rate"), /*#__PURE__*/React.createElement("div", {
415
417
  className: "metric-value"
416
- }, "0.04%")))))));
418
+ }, "0.0%")))))));
417
419
  };
418
420
 
419
421
  const Dashboard = () => {
@@ -6179,6 +6181,16 @@ const AssignEkyc = () => {
6179
6181
  })));
6180
6182
  };
6181
6183
 
6184
+ const parseAdditionalDetails = additionalDetails => {
6185
+ if (!additionalDetails) return {};
6186
+ if (typeof additionalDetails === "object") return additionalDetails;
6187
+ if (typeof additionalDetails !== "string") return {};
6188
+ try {
6189
+ return JSON.parse(additionalDetails);
6190
+ } catch (error) {
6191
+ return {};
6192
+ }
6193
+ };
6182
6194
  const AdminDashboard = () => {
6183
6195
  var _Digit$SessionStorage;
6184
6196
  const _useTranslation = useTranslation(),
@@ -6204,7 +6216,13 @@ const AdminDashboard = () => {
6204
6216
  isProgressLoading = _Digit$Hooks$ekyc$use.isLoading;
6205
6217
  const vendorsList = useMemo(() => {
6206
6218
  if (vendorSearchResponse && vendorSearchResponse.length > 0) {
6207
- return vendorSearchResponse.map(v => {
6219
+ const filteredVendors = vendorSearchResponse.filter(v => {
6220
+ var _additionalDetails$se;
6221
+ const dso = v.dsoDetails || v;
6222
+ const additionalDetails = parseAdditionalDetails(dso.additionalDetails || v.additionalDetails);
6223
+ return (additionalDetails === null || additionalDetails === void 0 ? void 0 : (_additionalDetails$se = additionalDetails.serviceType) === null || _additionalDetails$se === void 0 ? void 0 : _additionalDetails$se.toLowerCase()) === "ekyc";
6224
+ });
6225
+ return filteredVendors.map(v => {
6208
6226
  var _progressData$supervi, _dso$owner, _v$owner, _dso$owner2;
6209
6227
  const dso = v.dsoDetails || v;
6210
6228
  const supervisorsList = dso.supervisors || [];
@@ -6593,20 +6611,13 @@ const SupervisorDetailsCard = () => {
6593
6611
  setEkycDownloadLoading(true);
6594
6612
  return Promise.resolve(_finallyRethrows(function () {
6595
6613
  return _catch(function () {
6596
- const fetchPromises = surveyors.map(s => Digit.EkycService.application_list({
6614
+ return Promise.resolve(Digit.EkycService.application_list({
6597
6615
  tenantId: tenantId || "dl.djb",
6598
6616
  offset: 0,
6599
- limit: 5000,
6600
- surveyorId: s.surveyorId || s.id,
6617
+ limit: 10000,
6601
6618
  reportDownload: true
6602
- }).catch(err => {
6603
- console.error("Error fetching applications for surveyor " + s.surveyorName + ":", err);
6604
- return {
6605
- consumerList: []
6606
- };
6607
- }));
6608
- return Promise.resolve(Promise.all(fetchPromises)).then(function (results) {
6609
- const consumerList = results.flatMap(res => (res === null || res === void 0 ? void 0 : res.consumerList) || []);
6619
+ })).then(function (response) {
6620
+ const consumerList = (response === null || response === void 0 ? void 0 : response.consumerList) || [];
6610
6621
  if (consumerList.length === 0) {
6611
6622
  alert(t("NO_DATA_FOUND") || "No data found for download.");
6612
6623
  return;
@@ -6897,9 +6908,11 @@ const SupervisorDetailsCard = () => {
6897
6908
  const AssignEkycModal = _ref => {
6898
6909
  let surveyor = _ref.surveyor,
6899
6910
  closeModal = _ref.closeModal,
6900
- refetchDashboard = _ref.refetchDashboard;
6911
+ refetchDashboard = _ref.refetchDashboard,
6912
+ propsTenantId = _ref.tenantId;
6901
6913
  const _useTranslation = useTranslation(),
6902
6914
  t = _useTranslation.t;
6915
+ const tenantId = propsTenantId || Digit.ULBService.getCurrentTenantId();
6903
6916
  const _useState = useState([]),
6904
6917
  selectedKnos = _useState[0],
6905
6918
  setSelectedKnos = _useState[1];
@@ -6936,16 +6949,15 @@ const AssignEkycModal = _ref => {
6936
6949
  const _useState8 = useState(filters),
6937
6950
  debouncedFilters = _useState8[0],
6938
6951
  setDebouncedFilters = _useState8[1];
6939
- const _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSConfigMDMS.ZROLocation("dl.djb"),
6940
- zroLocationsData = _Digit$Hooks$ws$useWS.data,
6941
- isZroLoading = _Digit$Hooks$ws$useWS.isLoading;
6952
+ const _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSConfigMDMS.ZROLocation(tenantId),
6953
+ zroLocationsData = _Digit$Hooks$ws$useWS.data;
6942
6954
  const mappedZROLocation = useMemo(() => {
6943
6955
  return (zroLocationsData || []).map(item => ({
6944
6956
  code: item.code,
6945
6957
  name: item.name
6946
6958
  }));
6947
6959
  }, [zroLocationsData]);
6948
- const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS("dl.djb", "egov-location", ["TenantBoundary"]),
6960
+ const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
6949
6961
  egovLocationData = _Digit$Hooks$useCommo.data;
6950
6962
  const boundaryData = useMemo(() => {
6951
6963
  var _egovLocationData$ego;
@@ -7023,6 +7035,27 @@ const AssignEkycModal = _ref => {
7023
7035
  });
7024
7036
  return Array.from(pinSet).sort();
7025
7037
  }, [structuredLocalityData]);
7038
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList({
7039
+ unassignedOnly: true,
7040
+ fetchFilterOptions: true
7041
+ }, {
7042
+ tenantId: tenantId,
7043
+ offset: 0,
7044
+ limit: 1000
7045
+ }, {
7046
+ staleTime: Infinity
7047
+ }),
7048
+ filterOptionsData = _Digit$Hooks$ekyc$use.data;
7049
+ const pincodeOptions = useMemo(() => {
7050
+ if (!filterOptionsData) return fetchedPincodes || [];
7051
+ const pins = filterOptionsData.pincodeOptions || [];
7052
+ return Array.isArray(pins) ? pins.filter(Boolean).map(String).sort() : [];
7053
+ }, [filterOptionsData, fetchedPincodes]);
7054
+ const mrkeyOptions = useMemo(() => {
7055
+ if (!filterOptionsData) return [];
7056
+ const keys = filterOptionsData.mrkeyOptions || [];
7057
+ return Array.isArray(keys) ? keys.filter(Boolean).map(String).sort() : [];
7058
+ }, [filterOptionsData]);
7026
7059
  useEffect(() => {
7027
7060
  const timer = setTimeout(() => {
7028
7061
  setDebouncedFilters(filters);
@@ -7032,7 +7065,7 @@ const AssignEkycModal = _ref => {
7032
7065
  useEffect(() => {
7033
7066
  setCurrentPage(0);
7034
7067
  }, [debouncedFilters, filters.kno]);
7035
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList(_extends({
7068
+ const _Digit$Hooks$ekyc$use2 = Digit.Hooks.ekyc.useEkycApplicationList(_extends({
7036
7069
  unassignedOnly: true
7037
7070
  }, filters.kno && {
7038
7071
  kno: filters.kno
@@ -7049,14 +7082,15 @@ const AssignEkycModal = _ref => {
7049
7082
  }, debouncedFilters.pincode && {
7050
7083
  pincode: debouncedFilters.pincode
7051
7084
  }), {
7052
- tenantId: "dl.djb",
7085
+ tenantId: tenantId,
7053
7086
  offset: currentPage * pageSize,
7054
7087
  limit: pageSize
7055
7088
  }, {
7056
7089
  keepPreviousData: true
7057
7090
  }),
7058
- applicationData = _Digit$Hooks$ekyc$use.data,
7059
- isLoading = _Digit$Hooks$ekyc$use.isFetching;
7091
+ applicationData = _Digit$Hooks$ekyc$use2.data,
7092
+ isLoading = _Digit$Hooks$ekyc$use2.isFetching,
7093
+ refetchApplicationList = _Digit$Hooks$ekyc$use2.refetch;
7060
7094
  const handleAssignmentError = (errMsg, variables) => {
7061
7095
  const isAlreadyAssigned = errMsg.toLowerCase().includes("already assigned") || errMsg.toLowerCase().includes("already assign") || errMsg.toLowerCase().includes("active assignment") || errMsg.toLowerCase().includes("mrkey") || errMsg.toLowerCase().includes("mr key") || errMsg.toLowerCase().includes("kno") || errMsg.toLowerCase().includes("already exists");
7062
7096
  if (isAlreadyAssigned) {
@@ -7101,9 +7135,23 @@ const AssignEkycModal = _ref => {
7101
7135
  setShowToast(true);
7102
7136
  setTimeout(function () {
7103
7137
  try {
7104
- return Promise.resolve(refetchDashboard()).then(function () {
7105
- closeModal();
7106
- });
7138
+ function _temp4() {
7139
+ function _temp2() {
7140
+ closeModal();
7141
+ }
7142
+ const _temp = function () {
7143
+ if (refetchApplicationList) {
7144
+ return Promise.resolve(refetchApplicationList()).then(function () {});
7145
+ }
7146
+ }();
7147
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
7148
+ }
7149
+ const _temp3 = function () {
7150
+ if (refetchDashboard) {
7151
+ return Promise.resolve(refetchDashboard()).then(function () {});
7152
+ }
7153
+ }();
7154
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
7107
7155
  } catch (e) {
7108
7156
  return Promise.reject(e);
7109
7157
  }
@@ -7159,7 +7207,7 @@ const AssignEkycModal = _ref => {
7159
7207
  assignmentType = _getAssignmentPayload.assignmentType,
7160
7208
  assignmentValue = _getAssignmentPayload.assignmentValue;
7161
7209
  assignmentMutation.mutate({
7162
- tenantId: "dl.djb",
7210
+ tenantId: tenantId,
7163
7211
  surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.uuid,
7164
7212
  assignmentType,
7165
7213
  assignmentValue
@@ -7235,7 +7283,7 @@ const AssignEkycModal = _ref => {
7235
7283
  }),
7236
7284
  actionCancelLabel: "Cancel",
7237
7285
  actionCancelOnSubmit: closeModal,
7238
- actionSaveLabel: "Assign " + selectedKnos.length + " KNOs",
7286
+ actionSaveLabel: t("EKYC_ASSIGN_KNOS") || "Assign KNOs",
7239
7287
  actionSaveOnSubmit: handleAssign,
7240
7288
  isDisabled: !(selectedKnos !== null && selectedKnos !== void 0 && selectedKnos.length)
7241
7289
  }, /*#__PURE__*/React.createElement("div", {
@@ -7253,26 +7301,10 @@ const AssignEkycModal = _ref => {
7253
7301
  onChange: e => handleFilterChange("pincode", e.target.value)
7254
7302
  }, /*#__PURE__*/React.createElement("option", {
7255
7303
  value: ""
7256
- }, "Select Pincode"), fetchedPincodes.map(pin => /*#__PURE__*/React.createElement("option", {
7304
+ }, "Select Pincode"), pincodeOptions.map(pin => /*#__PURE__*/React.createElement("option", {
7257
7305
  key: pin,
7258
7306
  value: pin
7259
7307
  }, pin))), /*#__PURE__*/React.createElement("select", {
7260
- className: "form-control",
7261
- value: filters.zoneName,
7262
- onChange: e => {
7263
- const val = e.target.value;
7264
- setFilters(prev => _extends({}, prev, {
7265
- zoneCode: val,
7266
- zoneName: val
7267
- }));
7268
- },
7269
- disabled: isZroLoading
7270
- }, /*#__PURE__*/React.createElement("option", {
7271
- value: ""
7272
- }, isZroLoading ? "Loading ZRO Locations..." : "Select ZRO Location"), mappedZROLocation.map(loc => /*#__PURE__*/React.createElement("option", {
7273
- key: loc.code,
7274
- value: loc.name
7275
- }, loc.name))), /*#__PURE__*/React.createElement("select", {
7276
7308
  className: "form-control",
7277
7309
  value: filters.ward,
7278
7310
  onChange: e => handleFilterChange("ward", e.target.value)
@@ -7296,16 +7328,20 @@ const AssignEkycModal = _ref => {
7296
7328
  }, "Select Assembly"), assemblyOptions.map(assembly => /*#__PURE__*/React.createElement("option", {
7297
7329
  key: assembly.code,
7298
7330
  value: assembly.name
7299
- }, assembly.name))), /*#__PURE__*/React.createElement("input", {
7331
+ }, assembly.name))), /*#__PURE__*/React.createElement("select", {
7300
7332
  className: "form-control",
7301
- placeholder: "MR Key",
7302
7333
  value: filters.mrkey,
7303
7334
  onChange: e => handleFilterChange("mrkey", e.target.value)
7304
- }), selectedKnos.length > 0 && /*#__PURE__*/React.createElement("button", {
7335
+ }, /*#__PURE__*/React.createElement("option", {
7336
+ value: ""
7337
+ }, "Select MR Key"), mrkeyOptions.map(key => /*#__PURE__*/React.createElement("option", {
7338
+ key: key,
7339
+ value: key
7340
+ }, key))), selectedKnos.length > 0 && /*#__PURE__*/React.createElement("button", {
7305
7341
  className: "clear-selected-btn",
7306
7342
  type: "button",
7307
7343
  onClick: () => setSelectedKnos([])
7308
- }, t("EKYC_CLEAR_SELECTION") || "Clear Selected (" + selectedKnos.length + ")")), /*#__PURE__*/React.createElement(Table, {
7344
+ }, t("EKYC_CLEAR_SELECTION") || "Clear Selected")), /*#__PURE__*/React.createElement(Table, {
7309
7345
  tableTitle: "eKYC Applications",
7310
7346
  tableClass: "ekycTable",
7311
7347
  data: tableData,