@djb25/digit-ui-module-ekyc 1.0.55 → 1.0.57

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
@@ -226,7 +226,7 @@ const StatusCards = _ref => {
226
226
  alert(t("NO_DATA_FOUND") || "No data found for download.");
227
227
  return;
228
228
  }
229
- const excludedKeys = ["status", "source", "submittedAt", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile", "doorPhotoFilestoreId", "panFilestoreId", "documentProofFilestoreId", "buildingImageFileStoreId", "propertyDocumentFileStoreId", "meterPhotoFileStoreId", "modifiedBy", "zoneCode", "propertyType", "subPropertyCategory"];
229
+ const excludedKeys = ["status", "source", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile", "doorPhotoFilestoreId", "panFilestoreId", "documentProofFilestoreId", "buildingImageFileStoreId", "propertyDocumentFileStoreId", "meterPhotoFileStoreId", "modifiedBy", "zoneCode", "propertyType", "subPropertyCategory"];
230
230
  const headerMapping = {
231
231
  kno: t("KNO"),
232
232
  firstName: t("FIRST_NAME"),
@@ -355,9 +355,16 @@ const StatusCards = _ref => {
355
355
  if (name) {
356
356
  cleanObj[t("CONSUMER_NAME") || "Consumer Name"] = toTitleCase(name);
357
357
  }
358
- Object.keys(item).forEach(key => {
358
+ const keys = Object.keys(item);
359
+ const orderedKeys = [...keys.filter(key => key !== "submittedAt"), ...(keys.includes("submittedAt") ? ["submittedAt"] : [])];
360
+ orderedKeys.forEach(key => {
359
361
  if (excludedKeys.includes(key)) return;
360
362
  let val = item[key];
363
+ if (key === "submittedAt" && val) {
364
+ const date = new Date(Number(val));
365
+ const pad = n => String(n).padStart(2, "0");
366
+ val = pad(date.getDate()) + "/" + pad(date.getMonth() + 1) + "/" + date.getFullYear() + " " + pad(date.getHours()) + ":" + pad(date.getMinutes()) + ":" + pad(date.getSeconds());
367
+ }
361
368
  if (typeof val === "object" && val !== null) {
362
369
  return;
363
370
  }
@@ -2108,7 +2115,7 @@ const VendorDetailsCard = () => {
2108
2115
  alert(t("NO_EKYC_DATA_FOUND") || "No eKYC data found to download.");
2109
2116
  return;
2110
2117
  }
2111
- const excludedKeys = ["status", "source", "submittedAt", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile", "doorPhotoFilestoreId", "panFilestoreId", "documentProofFilestoreId", "buildingImageFileStoreId", "propertyDocumentFileStoreId", "meterPhotoFileStoreId", "modifiedBy", "zoneCode", "propertyType", "subPropertyCategory"];
2118
+ const excludedKeys = ["status", "source", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile", "doorPhotoFilestoreId", "panFilestoreId", "documentProofFilestoreId", "buildingImageFileStoreId", "propertyDocumentFileStoreId", "meterPhotoFileStoreId", "modifiedBy", "zoneCode", "propertyType", "subPropertyCategory"];
2112
2119
  const headerMapping = {
2113
2120
  kno: t("KNO"),
2114
2121
  firstName: t("FIRST_NAME"),
@@ -3785,7 +3792,7 @@ const ReviewSection = _ref2 => {
3785
3792
  })))));
3786
3793
  };
3787
3794
  const Review = () => {
3788
- var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _newDataRaw$connectio, _newDataRaw$connectio2, _newDataRaw$connectio3, _newDataRaw$address, _newDataRaw$address2, _newDataRaw$address3, _newDataRaw$address4, _newDataRaw$address5, _newDataRaw$address6, _newDataRaw$address7, _newDataRaw$address8, _newDataRaw$address9, _newDataRaw$address0, _newDataRaw$address1, _newDataRaw$address10, _newDataRaw$address11, _newDataRaw$address12, _newDataRaw$address13, _newDataRaw$address14, _newDataRaw$property, _newDataRaw$property2, _editedProperty$conne, _newDataRaw$property3, _editedProperty$conne2, _newDataRaw$property4, _editedProperty$userT, _newDataRaw$property5, _editedProperty$noOfF, _newDataRaw$property6, _newDataRaw$property7, _newDataRaw$meter, _editedMeter$meterSta, _newDataRaw$meter2, _newDataRaw$meter3, _newDataRaw$meter4, _newDataRaw$meter5, _editedMeter$workingS, _newDataRaw$meter6, _editedMeter$lastBill, _newDataRaw$meter7, _newDataRaw$meter8;
3795
+ var _Digit$SessionStorage, _Digit$SessionStorage2, _Digit$SessionStorage3, _newDataRaw$connectio, _newDataRaw$connectio2, _newDataRaw$connectio3, _newDataRaw$address, _newDataRaw$address2, _newDataRaw$address3, _newDataRaw$address4, _newDataRaw$address5, _newDataRaw$address6, _newDataRaw$address7, _newDataRaw$address8, _newDataRaw$address9, _newDataRaw$address0, _newDataRaw$address1, _newDataRaw$address10, _newDataRaw$address11, _newDataRaw$address12, _newDataRaw$address13, _newDataRaw$address14, _newDataRaw$property, _newDataRaw$property2, _editedProperty$conne, _newDataRaw$property3, _editedProperty$conne2, _newDataRaw$property4, _editedProperty$userT, _newDataRaw$property5, _editedProperty$noOfF, _newDataRaw$property6, _newDataRaw$property7, _newDataRaw$meter, _editedMeter$meterSta, _newDataRaw$meter2, _newDataRaw$meter3, _newDataRaw$meter4, _newDataRaw$meter5, _editedMeter$workingS, _newDataRaw$meter6, _editedMeter$lastBill, _newDataRaw$meter7, _newDataRaw$meter8, _Digit$UserService$ge;
3789
3796
  const _useTranslation = reactI18next.useTranslation(),
3790
3797
  t = _useTranslation.t;
3791
3798
  const history = reactRouterDom.useHistory();
@@ -3846,7 +3853,9 @@ const Review = () => {
3846
3853
  isSearchLoading = _Digit$Hooks$ekyc$use.isLoading;
3847
3854
  const userRoles = ((_Digit$SessionStorage = Digit.SessionStorage.get("User")) === null || _Digit$SessionStorage === void 0 ? void 0 : (_Digit$SessionStorage2 = _Digit$SessionStorage.info) === null || _Digit$SessionStorage2 === void 0 ? void 0 : (_Digit$SessionStorage3 = _Digit$SessionStorage2.roles) === null || _Digit$SessionStorage3 === void 0 ? void 0 : _Digit$SessionStorage3.map(ele => ele.code)) || [];
3848
3855
  const isZRO = userRoles.includes("EKYC_ZRO") || userRoles.includes("ZRO");
3849
- const isSupervisorOrSurveyorOrVendor = userRoles.includes("EKYC_SUPERVISOR") || userRoles.includes("EKYC_SURVEYOR") || userRoles.includes("EKYC_VENDOR");
3856
+ const isSupervisorOrSurveyorOrVendor = userRoles.includes("EKYC_SURVEYOR") || userRoles.includes("EKYC_VENDOR");
3857
+ const EKYC_ROLE_PRIORITY = ["EKYC_ZRO", "ZRO", "EKYC_SUPERVISOR", "EKYC_SURVEYOR", "EKYC_VENDOR"];
3858
+ const currentUserRole = EKYC_ROLE_PRIORITY.find(r => userRoles.includes(r)) || userRoles[0] || "EMPLOYEE";
3850
3859
  const isStatusView = location.pathname.includes("/status/");
3851
3860
  const hideEditButton = isSupervisorOrSurveyorOrVendor && !isZRO || isStatusView;
3852
3861
  const _extractReviewData = extractReviewData(searchData, flowState),
@@ -4280,34 +4289,55 @@ const Review = () => {
4280
4289
  label: "EKYC_METER_LONGITUDE1"
4281
4290
  }];
4282
4291
  const handleDeclaration = () => setAgree(!agree);
4292
+ const loggedInUserInfo = (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.info;
4293
+ const _Digit$Hooks$useUserS = Digit.Hooks.useUserSearch(tenantId, {
4294
+ uuid: [loggedInUserInfo === null || loggedInUserInfo === void 0 ? void 0 : loggedInUserInfo.uuid]
4295
+ }, {}, {
4296
+ enabled: !!(loggedInUserInfo !== null && loggedInUserInfo !== void 0 && loggedInUserInfo.uuid)
4297
+ }),
4298
+ userData = _Digit$Hooks$useUserS.data;
4299
+ const supervisorData = (userData === null || userData === void 0 ? void 0 : userData.user) || [];
4300
+ const matchedSupervisor = supervisorData === null || supervisorData === void 0 ? void 0 : supervisorData.find(s => (s === null || s === void 0 ? void 0 : s.uuid) === (loggedInUserInfo === null || loggedInUserInfo === void 0 ? void 0 : loggedInUserInfo.uuid) || (s === null || s === void 0 ? void 0 : s.userName) === (loggedInUserInfo === null || loggedInUserInfo === void 0 ? void 0 : loggedInUserInfo.userName));
4301
+ const supervisorId = (matchedSupervisor === null || matchedSupervisor === void 0 ? void 0 : matchedSupervisor.uuid) || (loggedInUserInfo === null || loggedInUserInfo === void 0 ? void 0 : loggedInUserInfo.uuid);
4283
4302
  const handleReject = function () {
4284
4303
  try {
4285
- var _Digit$UserService$ge, _Digit$UserService$ge2, _Digit$UserService$ge3;
4304
+ var _Digit$UserService$ge2;
4286
4305
  const payload = {
4287
4306
  RequestInfo: {
4288
4307
  apiId: "Rainmaker",
4289
4308
  ver: "1.0",
4290
4309
  msgId: "message-id",
4291
4310
  tenantId: tenantId,
4292
- authToken: (_Digit$UserService$ge = Digit.UserService.getUser()) === null || _Digit$UserService$ge === void 0 ? void 0 : _Digit$UserService$ge.access_token
4311
+ authToken: (_Digit$UserService$ge2 = Digit.UserService.getUser()) === null || _Digit$UserService$ge2 === void 0 ? void 0 : _Digit$UserService$ge2.access_token
4293
4312
  },
4294
4313
  kno: activeKno,
4295
4314
  action: "REJECTED",
4296
4315
  remarks: "Application rejected by reviewer",
4297
- reviewedBy: (_Digit$UserService$ge2 = Digit.UserService.getUser()) === null || _Digit$UserService$ge2 === void 0 ? void 0 : (_Digit$UserService$ge3 = _Digit$UserService$ge2.info) === null || _Digit$UserService$ge3 === void 0 ? void 0 : _Digit$UserService$ge3.userName,
4298
- role: "ZRO"
4316
+ reviewedBy: supervisorId,
4317
+ role: currentUserRole
4299
4318
  };
4300
4319
  const _temp = _catch(function () {
4301
4320
  return Promise.resolve(workflowMutation.mutateAsync(payload)).then(function (result) {
4302
4321
  if (result) {
4303
- history.push("/digit-ui/employee/ekyc/response", {
4304
- success: true,
4305
- result
4322
+ setToastData({
4323
+ error: true,
4324
+ label: t("EKYC_APPLICATION_REJECT_SUCCESSFUL") || "Application Rejected Successfully"
4306
4325
  });
4326
+ setShowToast(true);
4327
+ setTimeout(() => {
4328
+ history.push("/digit-ui/employee/ekyc/inbox");
4329
+ }, 2000);
4307
4330
  }
4308
4331
  });
4309
4332
  }, function (err) {
4333
+ var _err$response, _err$response$data, _err$response2, _err$response2$data, _err$response2$data$E, _err$response2$data$E2, _err$Errors, _err$Errors$;
4310
4334
  console.error("Reject Error:", err);
4335
+ const errMsg = (err === null || err === void 0 ? void 0 : err.message) || (err === null || err === void 0 ? void 0 : (_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.message) || (err === null || err === void 0 ? void 0 : (_err$response2 = err.response) === null || _err$response2 === void 0 ? void 0 : (_err$response2$data = _err$response2.data) === null || _err$response2$data === void 0 ? void 0 : (_err$response2$data$E = _err$response2$data.Errors) === null || _err$response2$data$E === void 0 ? void 0 : (_err$response2$data$E2 = _err$response2$data$E[0]) === null || _err$response2$data$E2 === void 0 ? void 0 : _err$response2$data$E2.message) || (err === null || err === void 0 ? void 0 : (_err$Errors = err.Errors) === null || _err$Errors === void 0 ? void 0 : (_err$Errors$ = _err$Errors[0]) === null || _err$Errors$ === void 0 ? void 0 : _err$Errors$.message) || t("EKYC_REJECT_ERROR") || "Reject failed. Please try again.";
4336
+ setToastData({
4337
+ error: true,
4338
+ label: errMsg
4339
+ });
4340
+ setShowToast(true);
4311
4341
  });
4312
4342
  return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
4313
4343
  } catch (e) {
@@ -4316,20 +4346,20 @@ const Review = () => {
4316
4346
  };
4317
4347
  const handleApprove = function () {
4318
4348
  try {
4319
- var _Digit$UserService$ge4, _Digit$UserService$ge5, _Digit$UserService$ge6;
4349
+ var _Digit$UserService$ge3;
4320
4350
  const payload = {
4321
4351
  RequestInfo: {
4322
4352
  apiId: "Rainmaker",
4323
4353
  ver: "1.0",
4324
4354
  msgId: "message-id",
4325
4355
  tenantId: tenantId,
4326
- authToken: (_Digit$UserService$ge4 = Digit.UserService.getUser()) === null || _Digit$UserService$ge4 === void 0 ? void 0 : _Digit$UserService$ge4.access_token
4356
+ authToken: (_Digit$UserService$ge3 = Digit.UserService.getUser()) === null || _Digit$UserService$ge3 === void 0 ? void 0 : _Digit$UserService$ge3.access_token
4327
4357
  },
4328
4358
  kno: activeKno,
4329
4359
  action: "APPROVED",
4330
4360
  remarks: "All documents verified",
4331
- reviewedBy: (_Digit$UserService$ge5 = Digit.UserService.getUser()) === null || _Digit$UserService$ge5 === void 0 ? void 0 : (_Digit$UserService$ge6 = _Digit$UserService$ge5.info) === null || _Digit$UserService$ge6 === void 0 ? void 0 : _Digit$UserService$ge6.userName,
4332
- role: "ZRO"
4361
+ reviewedBy: supervisorId,
4362
+ role: currentUserRole
4333
4363
  };
4334
4364
  const _temp2 = _catch(function () {
4335
4365
  return Promise.resolve(workflowMutation.mutateAsync(payload)).then(function (result) {
@@ -4345,11 +4375,12 @@ const Review = () => {
4345
4375
  }
4346
4376
  });
4347
4377
  }, function (err) {
4348
- var _err$response, _err$response$data;
4378
+ var _err$response3, _err$response3$data, _err$response3$data$E, _err$response3$data$E2, _err$Errors2, _err$Errors2$;
4349
4379
  console.error("Approve Error:", err);
4380
+ const errMsg = (err === null || err === void 0 ? void 0 : (_err$response3 = err.response) === null || _err$response3 === void 0 ? void 0 : (_err$response3$data = _err$response3.data) === null || _err$response3$data === void 0 ? void 0 : (_err$response3$data$E = _err$response3$data.Errors) === null || _err$response3$data$E === void 0 ? void 0 : (_err$response3$data$E2 = _err$response3$data$E[0]) === null || _err$response3$data$E2 === void 0 ? void 0 : _err$response3$data$E2.message) || (err === null || err === void 0 ? void 0 : (_err$Errors2 = err.Errors) === null || _err$Errors2 === void 0 ? void 0 : (_err$Errors2$ = _err$Errors2[0]) === null || _err$Errors2$ === void 0 ? void 0 : _err$Errors2$.message) || (err === null || err === void 0 ? void 0 : err.message) || t("EKYC_APPROVE_ERROR") || "Approve failed. Please try again.";
4350
4381
  setToastData({
4351
4382
  error: true,
4352
- label: (err === null || err === void 0 ? void 0 : err.message) || (err === null || err === void 0 ? void 0 : (_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.message) || "Approve Error"
4383
+ label: errMsg
4353
4384
  });
4354
4385
  setShowToast(true);
4355
4386
  });
@@ -4379,9 +4410,9 @@ const Review = () => {
4379
4410
  };
4380
4411
  const handleMenuSelect = option => {
4381
4412
  setShowOptions(false);
4382
- if (option.action === t("Approve")) {
4413
+ if (option.action === t("APPROVE")) {
4383
4414
  handleApprove();
4384
- } else if (option.action === t("Reject")) {
4415
+ } else if (option.action === t("REJECT")) {
4385
4416
  handleReject();
4386
4417
  }
4387
4418
  };
@@ -5911,7 +5942,7 @@ const SupervisorDetailsCard = () => {
5911
5942
  alert(t("NO_DATA_FOUND") || "No data found for download.");
5912
5943
  return;
5913
5944
  }
5914
- const excludedKeys = ["status", "source", "submittedAt", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile", "doorPhotoFilestoreId", "panFilestoreId", "documentProofFilestoreId", "buildingImageFileStoreId", "propertyDocumentFileStoreId", "meterPhotoFileStoreId", "modifiedBy", "zoneCode", "propertyType", "subPropertyCategory"];
5945
+ const excludedKeys = ["status", "source", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile", "doorPhotoFilestoreId", "panFilestoreId", "documentProofFilestoreId", "buildingImageFileStoreId", "propertyDocumentFileStoreId", "meterPhotoFileStoreId", "modifiedBy", "zoneCode", "propertyType", "subPropertyCategory"];
5915
5946
  const headerMapping = {
5916
5947
  kno: t("KNO"),
5917
5948
  firstName: t("FIRST_NAME"),
@@ -7175,7 +7206,7 @@ const SurveyorDetailsDashboard = () => {
7175
7206
  alert(t("NO_DATA_FOUND") || "No data found for download.");
7176
7207
  return;
7177
7208
  }
7178
- const excludedKeys = ["status", "source", "submittedAt", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile", "doorPhotoFilestoreId", "panFilestoreId", "documentProofFilestoreId", "buildingImageFileStoreId", "propertyDocumentFileStoreId", "meterPhotoFileStoreId", "modifiedBy", "zoneCode", "propertyType", "subPropertyCategory"];
7209
+ const excludedKeys = ["status", "source", "assignedAt", "connectionType", "approvedAt", "alternateMobileNo", "city", "state", "addressType", "addressProofType", "mrcode", "areacode", "verificationStatus", "surveyorId", "supervisorId", "vendorId", "assignmentType", "assignmentValue", "assignedTime", "isSelfAssigned", "userType", "tenantName", "tenantMobile", "doorPhotoFilestoreId", "panFilestoreId", "documentProofFilestoreId", "buildingImageFileStoreId", "propertyDocumentFileStoreId", "meterPhotoFileStoreId", "modifiedBy", "zoneCode", "propertyType", "subPropertyCategory"];
7179
7210
  const headerMapping = {
7180
7211
  kno: t("KNO"),
7181
7212
  firstName: t("FIRST_NAME"),
@@ -9992,7 +10023,7 @@ const CitizenApp = () => {
9992
10023
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
9993
10024
  path: path + "/review",
9994
10025
  component: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.LayoutWrapper, {
9995
- layoutClass: "normal"
10026
+ layoutClass: "action"
9996
10027
  }, /*#__PURE__*/React__default.createElement(Review, null))
9997
10028
  }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.PrivateRoute, {
9998
10029
  path: path + "/assign",