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

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,7 +7,6 @@ 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');
11
10
  var fa = require('react-icons/fa');
12
11
  var recharts = require('recharts');
13
12
 
@@ -144,13 +143,14 @@ const StatusCards = _ref => {
144
143
  }
145
144
  const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
146
145
  const fullName = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.name) || "Admin";
146
+ const hasExternalData = countData && typeof countData.total === "number" && typeof countData.submittedCount === "number";
147
147
  const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, {
148
148
  tenantId,
149
149
  offset: 0,
150
150
  limit: 10,
151
151
  ekycStatus: "submitted"
152
152
  }, {
153
- enabled: !!tenantId
153
+ enabled: !!tenantId && !hasExternalData
154
154
  }),
155
155
  dashboardData = _Digit$Hooks$ekyc$use.data;
156
156
  const apiCountData = React__default.useMemo(() => {
@@ -247,12 +247,12 @@ const StatusCards = _ref => {
247
247
  };
248
248
  const chartRef1 = React.useRef(null);
249
249
  const chartInstance1 = React.useRef(null);
250
- const total = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.total) || (countData === null || countData === void 0 ? void 0 : countData.total) || (countData === null || countData === void 0 ? void 0 : countData.totalCount) || 0;
251
- const pending = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.pending) || (countData === null || countData === void 0 ? void 0 : countData.pending) || 0;
252
- const active = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.active) || (countData === null || countData === void 0 ? void 0 : countData.active) || 0;
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;
250
+ const total = hasExternalData ? countData.total : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.total) || (countData === null || countData === void 0 ? void 0 : countData.total) || (countData === null || countData === void 0 ? void 0 : countData.totalCount) || 0;
251
+ const pending = hasExternalData ? countData.pending : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.pending) || (countData === null || countData === void 0 ? void 0 : countData.pending) || 0;
252
+ const active = hasExternalData ? countData.active : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.active) || (countData === null || countData === void 0 ? void 0 : countData.active) || 0;
253
+ const completed = hasExternalData ? countData.completed : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.completed) || (countData === null || countData === void 0 ? void 0 : countData.completed) || 0;
254
+ const inprocess = hasExternalData ? countData.inProgressCount : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.inProgressCount) || (countData === null || countData === void 0 ? void 0 : countData.inProgressCount) || 0;
255
+ const submitted = hasExternalData ? countData.submittedCount : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.submittedCount) || (countData === null || countData === void 0 ? void 0 : countData.submittedCount) || 0;
256
256
  const actualCompleted = completed;
257
257
  const approved = actualCompleted;
258
258
  const efficiency = total > 0 ? Math.round((submitted + completed) / total * 100) : 0;
@@ -440,7 +440,9 @@ const Dashboard = () => {
440
440
  completed: info.completed || 0,
441
441
  pending: info.pending || 0,
442
442
  rejected: info.rejected || 0,
443
- active: info.active || 0
443
+ active: info.active || 0,
444
+ submittedCount: info.submittedCount || 0,
445
+ inProgressCount: info.inProgressCount || 0
444
446
  };
445
447
  }, [dashboardData]);
446
448
  return isLoading ? /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null) : /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, {
@@ -2143,14 +2145,16 @@ const VendorDetailsCard = () => {
2143
2145
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
2144
2146
  status: "ACTIVE"
2145
2147
  }, {
2146
- enabled: !!tenantId
2148
+ enabled: !!tenantId,
2149
+ staleTime: 300000
2147
2150
  }),
2148
2151
  vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
2149
2152
  isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
2150
2153
  const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
2151
2154
  status: "ACTIVE"
2152
2155
  }, {
2153
- enabled: !!tenantId
2156
+ enabled: !!tenantId,
2157
+ staleTime: 300000
2154
2158
  }),
2155
2159
  supervisorSearchResponse = _Digit$Hooks$fsm$useS.data,
2156
2160
  isSupervisorSearchLoading = _Digit$Hooks$fsm$useS.isLoading;
@@ -2238,7 +2242,7 @@ const VendorDetailsCard = () => {
2238
2242
  }, [vendor]);
2239
2243
  const zoneIds = React.useMemo(() => {
2240
2244
  var _vendor$zoneIds;
2241
- return vendor !== null && vendor !== void 0 && (_vendor$zoneIds = vendor.zoneIds) !== null && _vendor$zoneIds !== void 0 && _vendor$zoneIds.length ? vendor.zoneIds.map(zone => zone.toUpperCase().replace("", " ")).join(", ") : "N/A";
2245
+ return vendor !== null && vendor !== void 0 && (_vendor$zoneIds = vendor.zoneIds) !== null && _vendor$zoneIds !== void 0 && _vendor$zoneIds.length ? vendor.zoneIds.filter(Boolean).map(zone => String(zone).toUpperCase().replace("", " ")).join(", ") : "N/A";
2242
2246
  }, [vendor]);
2243
2247
  const cards = React.useMemo(() => {
2244
2248
  const hasRealData = vendorSupervisors.some(s => s.totalKnos > 0);
@@ -6334,21 +6338,24 @@ const SupervisorDetailsCard = () => {
6334
6338
  const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
6335
6339
  status: "ACTIVE"
6336
6340
  }, {
6337
- enabled: !!tenantId
6341
+ enabled: !!tenantId,
6342
+ staleTime: 300000
6338
6343
  }),
6339
6344
  supervisorSearchResponse = _Digit$Hooks$fsm$useS.data,
6340
6345
  isSupervisorSearchLoading = _Digit$Hooks$fsm$useS.isLoading;
6341
6346
  const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorSearch(tenantId, {
6342
6347
  status: "ACTIVE"
6343
6348
  }, {
6344
- enabled: !!tenantId
6349
+ enabled: !!tenantId,
6350
+ staleTime: 300000
6345
6351
  }),
6346
6352
  surveyorSearchResponse = _Digit$Hooks$fsm$useS2.data,
6347
6353
  isSurveyorSearchLoading = _Digit$Hooks$fsm$useS2.isLoading;
6348
6354
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
6349
6355
  status: "ACTIVE"
6350
6356
  }, {
6351
- enabled: !!tenantId
6357
+ enabled: !!tenantId,
6358
+ staleTime: 300000
6352
6359
  }),
6353
6360
  vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
6354
6361
  isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
@@ -7384,7 +7391,7 @@ const AssignEkycModal = _ref => {
7384
7391
  };
7385
7392
 
7386
7393
  const SurveyorDetailsDashboard = () => {
7387
- var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _Digit$SessionStorage4, _surveyor$owner, _surveyor$owner2, _surveyor$owner3, _surveyor$owner4, _fullName$charAt, _dashboardData$dashbo, _dashboardData$dashbo2, _dashboardData$dashbo3, _dashboardData$dashbo4, _surveyor$owner8, _surveyor$owner9, _surveyor$owner0, _dashboardData$dashbo5, _dashboardData$dashbo6;
7394
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _surveyorSearchById$s, _Digit$SessionStorage3, _Digit$SessionStorage4, _surveyor$owner, _surveyor$owner2, _surveyor$owner3, _surveyor$owner4, _fullName$charAt, _dashboardData$dashbo, _dashboardData$dashbo2, _dashboardData$dashbo3, _dashboardData$dashbo4, _surveyor$owner8, _surveyor$owner9, _surveyor$owner0, _dashboardData$dashbo5, _dashboardData$dashbo6;
7388
7395
  const tenantId = Digit.ULBService.getCurrentTenantId();
7389
7396
  const _useState = React.useState(false),
7390
7397
  showModal = _useState[0],
@@ -7408,24 +7415,24 @@ const SurveyorDetailsDashboard = () => {
7408
7415
  }),
7409
7416
  surveyorSearchById = _Digit$Hooks$fsm$useS.data,
7410
7417
  isLoadingId = _Digit$Hooks$fsm$useS.isLoading;
7418
+ const hasFoundById = !!(surveyorSearchById !== null && surveyorSearchById !== void 0 && (_surveyorSearchById$s = surveyorSearchById.surveyors) !== null && _surveyorSearchById$s !== void 0 && _surveyorSearchById$s.length);
7411
7419
  const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorSearch(tenantId, surveyorId ? {
7412
7420
  ownerIds: surveyorId
7413
7421
  } : {
7414
7422
  ownerIds
7415
7423
  }, {
7416
- enabled: true,
7424
+ enabled: !surveyorId || !isLoadingId && !hasFoundById,
7417
7425
  staleTime: Infinity
7418
7426
  }),
7419
7427
  surveyorSearchByOwner = _Digit$Hooks$fsm$useS2.data,
7420
7428
  isLoadingOwner = _Digit$Hooks$fsm$useS2.isLoading;
7421
7429
  const surveyorSearchResponse = React.useMemo(() => {
7422
- if (surveyorId) {
7423
- var _surveyorSearchById$s;
7424
- return surveyorSearchById !== null && surveyorSearchById !== void 0 && (_surveyorSearchById$s = surveyorSearchById.surveyors) !== null && _surveyorSearchById$s !== void 0 && _surveyorSearchById$s.length ? surveyorSearchById : surveyorSearchByOwner;
7430
+ if (surveyorId && hasFoundById) {
7431
+ return surveyorSearchById;
7425
7432
  }
7426
7433
  return surveyorSearchByOwner;
7427
- }, [surveyorId, surveyorSearchById, surveyorSearchByOwner]);
7428
- const isLoading = surveyorId ? isLoadingId || isLoadingOwner : isLoadingOwner;
7434
+ }, [surveyorId, hasFoundById, surveyorSearchById, surveyorSearchByOwner]);
7435
+ const isLoading = surveyorId ? isLoadingId || isLoadingOwner && !hasFoundById : isLoadingOwner;
7429
7436
  const roles = (_Digit$SessionStorage3 = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage3 === void 0 ? void 0 : (_Digit$SessionStorage4 = _Digit$SessionStorage3.info) === null || _Digit$SessionStorage4 === void 0 ? void 0 : _Digit$SessionStorage4.roles.map(ele => ele.code);
7430
7437
  const surveyor = React.useMemo(() => {
7431
7438
  var _surveyorSearchRespon;
@@ -7434,14 +7441,16 @@ const SurveyorDetailsDashboard = () => {
7434
7441
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
7435
7442
  status: "ACTIVE"
7436
7443
  }, {
7437
- enabled: !!tenantId
7444
+ enabled: !!tenantId,
7445
+ staleTime: 300000
7438
7446
  }),
7439
7447
  vendorData = _Digit$Hooks$fsm$useD.data,
7440
7448
  isVendorLoading = _Digit$Hooks$fsm$useD.isLoading;
7441
7449
  const _Digit$Hooks$fsm$useS3 = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
7442
7450
  status: "ACTIVE"
7443
7451
  }, {
7444
- enabled: !!tenantId
7452
+ enabled: !!tenantId,
7453
+ staleTime: 300000
7445
7454
  }),
7446
7455
  supervisorSearchResponse = _Digit$Hooks$fsm$useS3.data,
7447
7456
  isSupervisorSearchLoading = _Digit$Hooks$fsm$useS3.isLoading;