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