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