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

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 CHANGED
@@ -7,6 +7,7 @@ var reactRouterDom = require('react-router-dom');
7
7
  var digitUiReactComponents = require('@djb25/digit-ui-react-components');
8
8
  var Chartjs = require('chart.js/auto');
9
9
  var Chartjs__default = _interopDefault(Chartjs);
10
+ require('three/tsl');
10
11
  var fa = require('react-icons/fa');
11
12
  var recharts = require('recharts');
12
13
 
@@ -158,6 +159,8 @@ const StatusCards = _ref => {
158
159
  total: info.total || 0,
159
160
  completed: info.completed || 0,
160
161
  pending: info.pending || 0,
162
+ submittedCount: info.submittedCount || 0,
163
+ inProgressCount: info.inProgressCount || 0,
161
164
  rejected: info.rejected || 0,
162
165
  active: info.active || 0
163
166
  };
@@ -248,10 +251,12 @@ const StatusCards = _ref => {
248
251
  const pending = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.pending) || (countData === null || countData === void 0 ? void 0 : countData.pending) || 0;
249
252
  const active = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.active) || (countData === null || countData === void 0 ? void 0 : countData.active) || 0;
250
253
  const completed = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.completed) || (countData === null || countData === void 0 ? void 0 : countData.completed) || 0;
254
+ const inprocess = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.inProgressCount) || (countData === null || countData === void 0 ? void 0 : countData.inProgressCount) || 0;
255
+ const submitted = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.submittedCount) || (countData === null || countData === void 0 ? void 0 : countData.submittedCount) || 0;
251
256
  const actualCompleted = completed;
252
257
  const approved = actualCompleted;
253
- const efficiency = total > 0 ? Math.round(actualCompleted / total * 100) : 0;
254
- const healthPct = total > 0 ? Math.round(approved / total * 100) : 0;
258
+ const efficiency = total > 0 ? Math.round((submitted + completed) / total * 100) : 0;
259
+ const healthPct = submitted > 0 ? Math.round(approved / submitted * 100) : 0;
255
260
  const formatNumber = num => new Intl.NumberFormat("en-IN").format(num || 0);
256
261
  React.useEffect(() => {
257
262
  if (chartRef1.current) {
@@ -261,11 +266,11 @@ const StatusCards = _ref => {
261
266
  chartInstance1.current = new ChartConstructor(ctx1, {
262
267
  type: "doughnut",
263
268
  data: {
264
- labels: [t("EKYC_ACTIVE"), t("EKYC_PENDING"), t("EKYC_COMPLETED")],
269
+ labels: [t("EKYC_PENDING"), t("EKYC_COMPLETED"), t("EKYC_SUBMITTED"), t("EKYC_INPROCESS")],
265
270
  datasets: [{
266
- data: [active, pending, completed],
267
- backgroundColor: ["#0c2a52", "#77B6EA", "#c8ddf5"],
268
- borderColor: ["#ffffff", "#ffffff", "#ffffff"],
271
+ data: [pending, completed, submitted, inprocess],
272
+ backgroundColor: ["#0c2a52", "#77B6EA", "#c8ddf5", "#49a3fb"],
273
+ borderColor: ["#ffffff", "#ffffff", "#ffffff", "#ffffff"],
269
274
  borderWidth: 2,
270
275
  hoverOffset: 4
271
276
  }]
@@ -287,17 +292,21 @@ const StatusCards = _ref => {
287
292
  };
288
293
  }, [pending, completed, active, t]);
289
294
  const legendItems = [{
290
- color: "#0c2a52",
291
- label: t("EKYC_ACTIVE"),
292
- value: active
293
- }, {
294
295
  color: "#77B6EA",
296
+ label: t("EKYC_COMPLETED"),
297
+ value: completed
298
+ }, {
299
+ color: "#0c2a52",
295
300
  label: t("EKYC_PENDING"),
296
301
  value: pending
297
302
  }, {
298
303
  color: "#c8ddf5",
299
- label: t("EKYC_COMPLETED"),
300
- value: completed
304
+ label: t("EKYC_SUBMITTED"),
305
+ value: submitted
306
+ }, {
307
+ color: "#49a3fb",
308
+ label: t("EKYC_INPROCESS"),
309
+ value: inprocess
301
310
  }];
302
311
  return /*#__PURE__*/React__default.createElement("div", {
303
312
  className: "ekyc-employee-container"
@@ -319,9 +328,7 @@ const StatusCards = _ref => {
319
328
  className: "total-label"
320
329
  }, t("EKYC_TOTAL_APPLICATIONS") || "Total Applications Processed"), /*#__PURE__*/React__default.createElement("div", {
321
330
  className: "total-number"
322
- }, formatNumber(total)), /*#__PURE__*/React__default.createElement("div", {
323
- className: "total-badge"
324
- }, "\u2197 +12.4% ", t("EKYC_FROM_LAST_QUARTER") || "from last quarter"), /*#__PURE__*/React__default.createElement("button", {
331
+ }, formatNumber(total)), /*#__PURE__*/React__default.createElement("button", {
325
332
  className: "download-excel-btn",
326
333
  disabled: ekycDownloadLoading,
327
334
  onClick: handleDownloadEkycData
@@ -385,17 +392,13 @@ const StatusCards = _ref => {
385
392
  className: "status-panel"
386
393
  }, /*#__PURE__*/React__default.createElement("div", {
387
394
  className: "panel-title"
388
- }, t("EKYC_SUBMISSION_HEALTH") || "Submission Health", /*#__PURE__*/React__default.createElement("span", {
389
- className: "optimal-badge"
390
- }, t("EKYC_OPTIMAL") || "Optimal")), /*#__PURE__*/React__default.createElement("div", {
395
+ }, t("EKYC_SUBMISSION_HEALTH") || "Submission Health"), /*#__PURE__*/React__default.createElement("div", {
391
396
  className: "panel-subtitle"
392
397
  }, t("EKYC_PLATFORM_EFFICIENCY") || "Platform operational efficiency"), /*#__PURE__*/React__default.createElement("div", {
393
398
  className: "health-metrics-row"
394
399
  }, /*#__PURE__*/React__default.createElement("div", {
395
400
  className: "health-percentage"
396
- }, healthPct, "%"), /*#__PURE__*/React__default.createElement("div", {
397
- className: "health-trend"
398
- }, "\u2197 +2.1%")), /*#__PURE__*/React__default.createElement("div", {
401
+ }, healthPct, "%")), /*#__PURE__*/React__default.createElement("div", {
399
402
  className: "status-progress-bar"
400
403
  }, /*#__PURE__*/React__default.createElement("div", {
401
404
  className: "progress-fill",
@@ -410,13 +413,13 @@ const StatusCards = _ref => {
410
413
  className: "metric-label"
411
414
  }, t("EKYC_AVG_LATENCY") || "Avg Latency"), /*#__PURE__*/React__default.createElement("div", {
412
415
  className: "metric-value"
413
- }, "1.2s")), /*#__PURE__*/React__default.createElement("div", {
416
+ }, "0s")), /*#__PURE__*/React__default.createElement("div", {
414
417
  className: "metric-box"
415
418
  }, /*#__PURE__*/React__default.createElement("div", {
416
419
  className: "metric-label"
417
420
  }, t("EKYC_ERROR_RATE") || "Error Rate"), /*#__PURE__*/React__default.createElement("div", {
418
421
  className: "metric-value"
419
- }, "0.04%")))))));
422
+ }, "0.0%")))))));
420
423
  };
421
424
 
422
425
  const Dashboard = () => {
@@ -6182,6 +6185,16 @@ const AssignEkyc = () => {
6182
6185
  })));
6183
6186
  };
6184
6187
 
6188
+ const parseAdditionalDetails = additionalDetails => {
6189
+ if (!additionalDetails) return {};
6190
+ if (typeof additionalDetails === "object") return additionalDetails;
6191
+ if (typeof additionalDetails !== "string") return {};
6192
+ try {
6193
+ return JSON.parse(additionalDetails);
6194
+ } catch (error) {
6195
+ return {};
6196
+ }
6197
+ };
6185
6198
  const AdminDashboard = () => {
6186
6199
  var _Digit$SessionStorage;
6187
6200
  const _useTranslation = reactI18next.useTranslation(),
@@ -6207,7 +6220,13 @@ const AdminDashboard = () => {
6207
6220
  isProgressLoading = _Digit$Hooks$ekyc$use.isLoading;
6208
6221
  const vendorsList = React.useMemo(() => {
6209
6222
  if (vendorSearchResponse && vendorSearchResponse.length > 0) {
6210
- return vendorSearchResponse.map(v => {
6223
+ const filteredVendors = vendorSearchResponse.filter(v => {
6224
+ var _additionalDetails$se;
6225
+ const dso = v.dsoDetails || v;
6226
+ const additionalDetails = parseAdditionalDetails(dso.additionalDetails || v.additionalDetails);
6227
+ return (additionalDetails === null || additionalDetails === void 0 ? void 0 : (_additionalDetails$se = additionalDetails.serviceType) === null || _additionalDetails$se === void 0 ? void 0 : _additionalDetails$se.toLowerCase()) === "ekyc";
6228
+ });
6229
+ return filteredVendors.map(v => {
6211
6230
  var _progressData$supervi, _dso$owner, _v$owner, _dso$owner2;
6212
6231
  const dso = v.dsoDetails || v;
6213
6232
  const supervisorsList = dso.supervisors || [];
@@ -6596,20 +6615,13 @@ const SupervisorDetailsCard = () => {
6596
6615
  setEkycDownloadLoading(true);
6597
6616
  return Promise.resolve(_finallyRethrows(function () {
6598
6617
  return _catch(function () {
6599
- const fetchPromises = surveyors.map(s => Digit.EkycService.application_list({
6618
+ return Promise.resolve(Digit.EkycService.application_list({
6600
6619
  tenantId: tenantId || "dl.djb",
6601
6620
  offset: 0,
6602
- limit: 5000,
6603
- surveyorId: s.surveyorId || s.id,
6621
+ limit: 10000,
6604
6622
  reportDownload: true
6605
- }).catch(err => {
6606
- console.error("Error fetching applications for surveyor " + s.surveyorName + ":", err);
6607
- return {
6608
- consumerList: []
6609
- };
6610
- }));
6611
- return Promise.resolve(Promise.all(fetchPromises)).then(function (results) {
6612
- const consumerList = results.flatMap(res => (res === null || res === void 0 ? void 0 : res.consumerList) || []);
6623
+ })).then(function (response) {
6624
+ const consumerList = (response === null || response === void 0 ? void 0 : response.consumerList) || [];
6613
6625
  if (consumerList.length === 0) {
6614
6626
  alert(t("NO_DATA_FOUND") || "No data found for download.");
6615
6627
  return;
@@ -6900,9 +6912,11 @@ const SupervisorDetailsCard = () => {
6900
6912
  const AssignEkycModal = _ref => {
6901
6913
  let surveyor = _ref.surveyor,
6902
6914
  closeModal = _ref.closeModal,
6903
- refetchDashboard = _ref.refetchDashboard;
6915
+ refetchDashboard = _ref.refetchDashboard,
6916
+ propsTenantId = _ref.tenantId;
6904
6917
  const _useTranslation = reactI18next.useTranslation(),
6905
6918
  t = _useTranslation.t;
6919
+ const tenantId = propsTenantId || Digit.ULBService.getCurrentTenantId();
6906
6920
  const _useState = React.useState([]),
6907
6921
  selectedKnos = _useState[0],
6908
6922
  setSelectedKnos = _useState[1];
@@ -6939,16 +6953,15 @@ const AssignEkycModal = _ref => {
6939
6953
  const _useState8 = React.useState(filters),
6940
6954
  debouncedFilters = _useState8[0],
6941
6955
  setDebouncedFilters = _useState8[1];
6942
- const _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSConfigMDMS.ZROLocation("dl.djb"),
6943
- zroLocationsData = _Digit$Hooks$ws$useWS.data,
6944
- isZroLoading = _Digit$Hooks$ws$useWS.isLoading;
6956
+ const _Digit$Hooks$ws$useWS = Digit.Hooks.ws.useWSConfigMDMS.ZROLocation(tenantId),
6957
+ zroLocationsData = _Digit$Hooks$ws$useWS.data;
6945
6958
  const mappedZROLocation = React.useMemo(() => {
6946
6959
  return (zroLocationsData || []).map(item => ({
6947
6960
  code: item.code,
6948
6961
  name: item.name
6949
6962
  }));
6950
6963
  }, [zroLocationsData]);
6951
- const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS("dl.djb", "egov-location", ["TenantBoundary"]),
6964
+ const _Digit$Hooks$useCommo = Digit.Hooks.useCommonMDMS(tenantId, "egov-location", ["TenantBoundary"]),
6952
6965
  egovLocationData = _Digit$Hooks$useCommo.data;
6953
6966
  const boundaryData = React.useMemo(() => {
6954
6967
  var _egovLocationData$ego;
@@ -7026,6 +7039,27 @@ const AssignEkycModal = _ref => {
7026
7039
  });
7027
7040
  return Array.from(pinSet).sort();
7028
7041
  }, [structuredLocalityData]);
7042
+ const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList({
7043
+ unassignedOnly: true,
7044
+ fetchFilterOptions: true
7045
+ }, {
7046
+ tenantId: tenantId,
7047
+ offset: 0,
7048
+ limit: 1000
7049
+ }, {
7050
+ staleTime: Infinity
7051
+ }),
7052
+ filterOptionsData = _Digit$Hooks$ekyc$use.data;
7053
+ const pincodeOptions = React.useMemo(() => {
7054
+ if (!filterOptionsData) return fetchedPincodes || [];
7055
+ const pins = filterOptionsData.pincodeOptions || [];
7056
+ return Array.isArray(pins) ? pins.filter(Boolean).map(String).sort() : [];
7057
+ }, [filterOptionsData, fetchedPincodes]);
7058
+ const mrkeyOptions = React.useMemo(() => {
7059
+ if (!filterOptionsData) return [];
7060
+ const keys = filterOptionsData.mrkeyOptions || [];
7061
+ return Array.isArray(keys) ? keys.filter(Boolean).map(String).sort() : [];
7062
+ }, [filterOptionsData]);
7029
7063
  React.useEffect(() => {
7030
7064
  const timer = setTimeout(() => {
7031
7065
  setDebouncedFilters(filters);
@@ -7035,7 +7069,7 @@ const AssignEkycModal = _ref => {
7035
7069
  React.useEffect(() => {
7036
7070
  setCurrentPage(0);
7037
7071
  }, [debouncedFilters, filters.kno]);
7038
- const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycApplicationList(_extends({
7072
+ const _Digit$Hooks$ekyc$use2 = Digit.Hooks.ekyc.useEkycApplicationList(_extends({
7039
7073
  unassignedOnly: true
7040
7074
  }, filters.kno && {
7041
7075
  kno: filters.kno
@@ -7052,14 +7086,15 @@ const AssignEkycModal = _ref => {
7052
7086
  }, debouncedFilters.pincode && {
7053
7087
  pincode: debouncedFilters.pincode
7054
7088
  }), {
7055
- tenantId: "dl.djb",
7089
+ tenantId: tenantId,
7056
7090
  offset: currentPage * pageSize,
7057
7091
  limit: pageSize
7058
7092
  }, {
7059
7093
  keepPreviousData: true
7060
7094
  }),
7061
- applicationData = _Digit$Hooks$ekyc$use.data,
7062
- isLoading = _Digit$Hooks$ekyc$use.isFetching;
7095
+ applicationData = _Digit$Hooks$ekyc$use2.data,
7096
+ isLoading = _Digit$Hooks$ekyc$use2.isFetching,
7097
+ refetchApplicationList = _Digit$Hooks$ekyc$use2.refetch;
7063
7098
  const handleAssignmentError = (errMsg, variables) => {
7064
7099
  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");
7065
7100
  if (isAlreadyAssigned) {
@@ -7104,9 +7139,23 @@ const AssignEkycModal = _ref => {
7104
7139
  setShowToast(true);
7105
7140
  setTimeout(function () {
7106
7141
  try {
7107
- return Promise.resolve(refetchDashboard()).then(function () {
7108
- closeModal();
7109
- });
7142
+ function _temp4() {
7143
+ function _temp2() {
7144
+ closeModal();
7145
+ }
7146
+ const _temp = function () {
7147
+ if (refetchApplicationList) {
7148
+ return Promise.resolve(refetchApplicationList()).then(function () {});
7149
+ }
7150
+ }();
7151
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
7152
+ }
7153
+ const _temp3 = function () {
7154
+ if (refetchDashboard) {
7155
+ return Promise.resolve(refetchDashboard()).then(function () {});
7156
+ }
7157
+ }();
7158
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
7110
7159
  } catch (e) {
7111
7160
  return Promise.reject(e);
7112
7161
  }
@@ -7162,7 +7211,7 @@ const AssignEkycModal = _ref => {
7162
7211
  assignmentType = _getAssignmentPayload.assignmentType,
7163
7212
  assignmentValue = _getAssignmentPayload.assignmentValue;
7164
7213
  assignmentMutation.mutate({
7165
- tenantId: "dl.djb",
7214
+ tenantId: tenantId,
7166
7215
  surveyorId: surveyor === null || surveyor === void 0 ? void 0 : (_surveyor$owner = surveyor.owner) === null || _surveyor$owner === void 0 ? void 0 : _surveyor$owner.uuid,
7167
7216
  assignmentType,
7168
7217
  assignmentValue
@@ -7238,7 +7287,7 @@ const AssignEkycModal = _ref => {
7238
7287
  }),
7239
7288
  actionCancelLabel: "Cancel",
7240
7289
  actionCancelOnSubmit: closeModal,
7241
- actionSaveLabel: "Assign " + selectedKnos.length + " KNOs",
7290
+ actionSaveLabel: t("EKYC_ASSIGN_KNOS") || "Assign KNOs",
7242
7291
  actionSaveOnSubmit: handleAssign,
7243
7292
  isDisabled: !(selectedKnos !== null && selectedKnos !== void 0 && selectedKnos.length)
7244
7293
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -7256,26 +7305,10 @@ const AssignEkycModal = _ref => {
7256
7305
  onChange: e => handleFilterChange("pincode", e.target.value)
7257
7306
  }, /*#__PURE__*/React__default.createElement("option", {
7258
7307
  value: ""
7259
- }, "Select Pincode"), fetchedPincodes.map(pin => /*#__PURE__*/React__default.createElement("option", {
7308
+ }, "Select Pincode"), pincodeOptions.map(pin => /*#__PURE__*/React__default.createElement("option", {
7260
7309
  key: pin,
7261
7310
  value: pin
7262
7311
  }, pin))), /*#__PURE__*/React__default.createElement("select", {
7263
- className: "form-control",
7264
- value: filters.zoneName,
7265
- onChange: e => {
7266
- const val = e.target.value;
7267
- setFilters(prev => _extends({}, prev, {
7268
- zoneCode: val,
7269
- zoneName: val
7270
- }));
7271
- },
7272
- disabled: isZroLoading
7273
- }, /*#__PURE__*/React__default.createElement("option", {
7274
- value: ""
7275
- }, isZroLoading ? "Loading ZRO Locations..." : "Select ZRO Location"), mappedZROLocation.map(loc => /*#__PURE__*/React__default.createElement("option", {
7276
- key: loc.code,
7277
- value: loc.name
7278
- }, loc.name))), /*#__PURE__*/React__default.createElement("select", {
7279
7312
  className: "form-control",
7280
7313
  value: filters.ward,
7281
7314
  onChange: e => handleFilterChange("ward", e.target.value)
@@ -7299,16 +7332,20 @@ const AssignEkycModal = _ref => {
7299
7332
  }, "Select Assembly"), assemblyOptions.map(assembly => /*#__PURE__*/React__default.createElement("option", {
7300
7333
  key: assembly.code,
7301
7334
  value: assembly.name
7302
- }, assembly.name))), /*#__PURE__*/React__default.createElement("input", {
7335
+ }, assembly.name))), /*#__PURE__*/React__default.createElement("select", {
7303
7336
  className: "form-control",
7304
- placeholder: "MR Key",
7305
7337
  value: filters.mrkey,
7306
7338
  onChange: e => handleFilterChange("mrkey", e.target.value)
7307
- }), selectedKnos.length > 0 && /*#__PURE__*/React__default.createElement("button", {
7339
+ }, /*#__PURE__*/React__default.createElement("option", {
7340
+ value: ""
7341
+ }, "Select MR Key"), mrkeyOptions.map(key => /*#__PURE__*/React__default.createElement("option", {
7342
+ key: key,
7343
+ value: key
7344
+ }, key))), selectedKnos.length > 0 && /*#__PURE__*/React__default.createElement("button", {
7308
7345
  className: "clear-selected-btn",
7309
7346
  type: "button",
7310
7347
  onClick: () => setSelectedKnos([])
7311
- }, t("EKYC_CLEAR_SELECTION") || "Clear Selected (" + selectedKnos.length + ")")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Table, {
7348
+ }, t("EKYC_CLEAR_SELECTION") || "Clear Selected")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Table, {
7312
7349
  tableTitle: "eKYC Applications",
7313
7350
  tableClass: "ekycTable",
7314
7351
  data: tableData,