@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.
@@ -140,13 +140,14 @@ const StatusCards = _ref => {
140
140
  }
141
141
  const loggedInUser = (_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : _Digit$SessionStorage.info;
142
142
  const fullName = (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.name) || "Admin";
143
+ const hasExternalData = countData && typeof countData.total === "number" && typeof countData.submittedCount === "number";
143
144
  const _Digit$Hooks$ekyc$use = Digit.Hooks.ekyc.useEkycSurveyorDashboard({}, {
144
145
  tenantId,
145
146
  offset: 0,
146
147
  limit: 10,
147
148
  ekycStatus: "submitted"
148
149
  }, {
149
- enabled: !!tenantId
150
+ enabled: !!tenantId && !hasExternalData
150
151
  }),
151
152
  dashboardData = _Digit$Hooks$ekyc$use.data;
152
153
  const apiCountData = React.useMemo(() => {
@@ -243,12 +244,12 @@ const StatusCards = _ref => {
243
244
  };
244
245
  const chartRef1 = useRef(null);
245
246
  const chartInstance1 = useRef(null);
246
- 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;
247
- const pending = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.pending) || (countData === null || countData === void 0 ? void 0 : countData.pending) || 0;
248
- const active = (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.active) || (countData === null || countData === void 0 ? void 0 : countData.active) || 0;
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;
247
+ 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;
248
+ const pending = hasExternalData ? countData.pending : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.pending) || (countData === null || countData === void 0 ? void 0 : countData.pending) || 0;
249
+ const active = hasExternalData ? countData.active : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.active) || (countData === null || countData === void 0 ? void 0 : countData.active) || 0;
250
+ const completed = hasExternalData ? countData.completed : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.completed) || (countData === null || countData === void 0 ? void 0 : countData.completed) || 0;
251
+ const inprocess = hasExternalData ? countData.inProgressCount : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.inProgressCount) || (countData === null || countData === void 0 ? void 0 : countData.inProgressCount) || 0;
252
+ const submitted = hasExternalData ? countData.submittedCount : (apiCountData === null || apiCountData === void 0 ? void 0 : apiCountData.submittedCount) || (countData === null || countData === void 0 ? void 0 : countData.submittedCount) || 0;
252
253
  const actualCompleted = completed;
253
254
  const approved = actualCompleted;
254
255
  const efficiency = total > 0 ? Math.round((submitted + completed) / total * 100) : 0;
@@ -436,7 +437,9 @@ const Dashboard = () => {
436
437
  completed: info.completed || 0,
437
438
  pending: info.pending || 0,
438
439
  rejected: info.rejected || 0,
439
- active: info.active || 0
440
+ active: info.active || 0,
441
+ submittedCount: info.submittedCount || 0,
442
+ inProgressCount: info.inProgressCount || 0
440
443
  };
441
444
  }, [dashboardData]);
442
445
  return isLoading ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Card, {
@@ -2139,14 +2142,16 @@ const VendorDetailsCard = () => {
2139
2142
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
2140
2143
  status: "ACTIVE"
2141
2144
  }, {
2142
- enabled: !!tenantId
2145
+ enabled: !!tenantId,
2146
+ staleTime: 300000
2143
2147
  }),
2144
2148
  vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
2145
2149
  isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
2146
2150
  const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
2147
2151
  status: "ACTIVE"
2148
2152
  }, {
2149
- enabled: !!tenantId
2153
+ enabled: !!tenantId,
2154
+ staleTime: 300000
2150
2155
  }),
2151
2156
  supervisorSearchResponse = _Digit$Hooks$fsm$useS.data,
2152
2157
  isSupervisorSearchLoading = _Digit$Hooks$fsm$useS.isLoading;
@@ -2234,7 +2239,7 @@ const VendorDetailsCard = () => {
2234
2239
  }, [vendor]);
2235
2240
  const zoneIds = useMemo(() => {
2236
2241
  var _vendor$zoneIds;
2237
- 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";
2242
+ 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";
2238
2243
  }, [vendor]);
2239
2244
  const cards = useMemo(() => {
2240
2245
  const hasRealData = vendorSupervisors.some(s => s.totalKnos > 0);
@@ -6330,21 +6335,24 @@ const SupervisorDetailsCard = () => {
6330
6335
  const _Digit$Hooks$fsm$useS = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
6331
6336
  status: "ACTIVE"
6332
6337
  }, {
6333
- enabled: !!tenantId
6338
+ enabled: !!tenantId,
6339
+ staleTime: 300000
6334
6340
  }),
6335
6341
  supervisorSearchResponse = _Digit$Hooks$fsm$useS.data,
6336
6342
  isSupervisorSearchLoading = _Digit$Hooks$fsm$useS.isLoading;
6337
6343
  const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorSearch(tenantId, {
6338
6344
  status: "ACTIVE"
6339
6345
  }, {
6340
- enabled: !!tenantId
6346
+ enabled: !!tenantId,
6347
+ staleTime: 300000
6341
6348
  }),
6342
6349
  surveyorSearchResponse = _Digit$Hooks$fsm$useS2.data,
6343
6350
  isSurveyorSearchLoading = _Digit$Hooks$fsm$useS2.isLoading;
6344
6351
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
6345
6352
  status: "ACTIVE"
6346
6353
  }, {
6347
- enabled: !!tenantId
6354
+ enabled: !!tenantId,
6355
+ staleTime: 300000
6348
6356
  }),
6349
6357
  vendorSearchResponse = _Digit$Hooks$fsm$useD.data,
6350
6358
  isVendorSearchLoading = _Digit$Hooks$fsm$useD.isLoading;
@@ -7380,7 +7388,7 @@ const AssignEkycModal = _ref => {
7380
7388
  };
7381
7389
 
7382
7390
  const SurveyorDetailsDashboard = () => {
7383
- 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;
7391
+ 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;
7384
7392
  const tenantId = Digit.ULBService.getCurrentTenantId();
7385
7393
  const _useState = useState(false),
7386
7394
  showModal = _useState[0],
@@ -7404,24 +7412,24 @@ const SurveyorDetailsDashboard = () => {
7404
7412
  }),
7405
7413
  surveyorSearchById = _Digit$Hooks$fsm$useS.data,
7406
7414
  isLoadingId = _Digit$Hooks$fsm$useS.isLoading;
7415
+ const hasFoundById = !!(surveyorSearchById !== null && surveyorSearchById !== void 0 && (_surveyorSearchById$s = surveyorSearchById.surveyors) !== null && _surveyorSearchById$s !== void 0 && _surveyorSearchById$s.length);
7407
7416
  const _Digit$Hooks$fsm$useS2 = Digit.Hooks.fsm.useSurveyorSearch(tenantId, surveyorId ? {
7408
7417
  ownerIds: surveyorId
7409
7418
  } : {
7410
7419
  ownerIds
7411
7420
  }, {
7412
- enabled: true,
7421
+ enabled: !surveyorId || !isLoadingId && !hasFoundById,
7413
7422
  staleTime: Infinity
7414
7423
  }),
7415
7424
  surveyorSearchByOwner = _Digit$Hooks$fsm$useS2.data,
7416
7425
  isLoadingOwner = _Digit$Hooks$fsm$useS2.isLoading;
7417
7426
  const surveyorSearchResponse = useMemo(() => {
7418
- if (surveyorId) {
7419
- var _surveyorSearchById$s;
7420
- return surveyorSearchById !== null && surveyorSearchById !== void 0 && (_surveyorSearchById$s = surveyorSearchById.surveyors) !== null && _surveyorSearchById$s !== void 0 && _surveyorSearchById$s.length ? surveyorSearchById : surveyorSearchByOwner;
7427
+ if (surveyorId && hasFoundById) {
7428
+ return surveyorSearchById;
7421
7429
  }
7422
7430
  return surveyorSearchByOwner;
7423
- }, [surveyorId, surveyorSearchById, surveyorSearchByOwner]);
7424
- const isLoading = surveyorId ? isLoadingId || isLoadingOwner : isLoadingOwner;
7431
+ }, [surveyorId, hasFoundById, surveyorSearchById, surveyorSearchByOwner]);
7432
+ const isLoading = surveyorId ? isLoadingId || isLoadingOwner && !hasFoundById : isLoadingOwner;
7425
7433
  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);
7426
7434
  const surveyor = useMemo(() => {
7427
7435
  var _surveyorSearchRespon;
@@ -7430,14 +7438,16 @@ const SurveyorDetailsDashboard = () => {
7430
7438
  const _Digit$Hooks$fsm$useD = Digit.Hooks.fsm.useDsoSearch(tenantId, {
7431
7439
  status: "ACTIVE"
7432
7440
  }, {
7433
- enabled: !!tenantId
7441
+ enabled: !!tenantId,
7442
+ staleTime: 300000
7434
7443
  }),
7435
7444
  vendorData = _Digit$Hooks$fsm$useD.data,
7436
7445
  isVendorLoading = _Digit$Hooks$fsm$useD.isLoading;
7437
7446
  const _Digit$Hooks$fsm$useS3 = Digit.Hooks.fsm.useSupervisorSearch(tenantId, {
7438
7447
  status: "ACTIVE"
7439
7448
  }, {
7440
- enabled: !!tenantId
7449
+ enabled: !!tenantId,
7450
+ staleTime: 300000
7441
7451
  }),
7442
7452
  supervisorSearchResponse = _Digit$Hooks$fsm$useS3.data,
7443
7453
  isSupervisorSearchLoading = _Digit$Hooks$fsm$useS3.isLoading;