@djb25/digit-ui-module-ekyc 1.0.35 → 1.0.36

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.
@@ -1,7 +1,7 @@
1
1
  import React, { useRef, useEffect, useMemo, useState, createContext, isValidElement, cloneElement, createElement, useContext, useCallback, useReducer, Fragment } from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { useHistory, Link, useLocation, useParams, useRouteMatch, Switch, Route, Redirect } from 'react-router-dom';
4
- import { PersonIcon, EmployeeModuleCard, Loader, Card, InboxLinks, Table, HomeIcon, TextInput, Header, SubmitBar, DetailsCard, FilterForm, FilterFormField, Dropdown, Label, CustomTooltip, CardLabelError, InboxComposer, EditIcon, DeleteIcon, CardHeader, CardText, LabelFieldPair, CardLabel, ActionBar, Modal, Toast, RadioButtons, CardSubHeader, StatusTable, Row, GenericFileIcon, CheckBox, Menu, LinkButton, UploadFile, FormComposer, VerticalTimeline, Close, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, ModuleLinksView, CitizenHomeCard, DocumentIcon } from '@djb25/digit-ui-react-components';
4
+ import { PersonIcon, EmployeeModuleCard, Loader, Card, InboxLinks, Table, HomeIcon, TextInput, Header, SubmitBar, DetailsCard, FilterForm, FilterFormField, Dropdown, Label, CustomTooltip, CardLabelError, InboxComposer, EditIcon, DeleteIcon, CardHeader, CardText, LabelFieldPair, CardLabel, ActionBar, Modal, Toast, RadioButtons, CardSubHeader, StatusTable, Row, GenericFileIcon, CheckBox, Menu, LinkButton, UploadFile, FormComposer, VerticalTimeline, Close, AppContainer, ModuleHeader, ArrowLeft, PrivateRoute, LayoutWrapper, CitizenHomeCard, DocumentIcon, BackButton } from '@djb25/digit-ui-react-components';
5
5
  import * as Chartjs from 'chart.js/auto';
6
6
  import Chartjs__default, { Chart } from 'chart.js/auto';
7
7
  import { FaUsers, FaCheckCircle, FaClock, FaExclamationTriangle, FaUserTie, FaChartLine, FaSearch, FaArrowRight, FaMapMarkedAlt, FaArrowLeft } from 'react-icons/fa';
@@ -4930,42 +4930,41 @@ const AssignEkycModal = _ref => {
4930
4930
  }),
4931
4931
  applicationData = _Digit$Hooks$ekyc$use.data,
4932
4932
  isLoading = _Digit$Hooks$ekyc$use.isFetching;
4933
+ const handleAssignmentError = (errMsg, variables) => {
4934
+ 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");
4935
+ if (isAlreadyAssigned) {
4936
+ const isMrKeyType = (variables === null || variables === void 0 ? void 0 : variables.assignmentType) === "MRKEY";
4937
+ if (isMrKeyType) {
4938
+ setToastData({
4939
+ error: true,
4940
+ label: t("EKYC_MR_KEY_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "mr key is already assign with another surveyor"
4941
+ });
4942
+ } else {
4943
+ setToastData({
4944
+ error: true,
4945
+ label: t("EKYC_KNO_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "kno is already assign with another surveyor"
4946
+ });
4947
+ }
4948
+ } else {
4949
+ setToastData({
4950
+ error: true,
4951
+ label: t(errMsg) || errMsg || t("EKYC_SOMETHING_WENT_WRONG") || "Something went wrong"
4952
+ });
4953
+ }
4954
+ setShowToast(true);
4955
+ };
4933
4956
  const assignmentMutation = Digit.Hooks.ekyc.useEkycAssignmentCreate({
4934
- onSuccess: response => {
4957
+ onSuccess: (response, variables) => {
4935
4958
  if (response !== null && response !== void 0 && response.error) {
4936
4959
  var _response$data;
4937
4960
  const errMsg = (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.message) || "";
4938
- const isMrKeyAlreadyAssigned = errMsg.toLowerCase().includes("already assigned") || errMsg.toLowerCase().includes("already assign") || errMsg.toLowerCase().includes("mrkey") || errMsg.toLowerCase().includes("mr key");
4939
- if (isMrKeyAlreadyAssigned) {
4940
- setToastData({
4941
- error: true,
4942
- label: t("EKYC_MR_KEY_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "mr key is already assign with another surveyor"
4943
- });
4944
- } else {
4945
- setToastData({
4946
- error: true,
4947
- label: t(errMsg) || errMsg || t("EKYC_SOMETHING_WENT_WRONG") || "Something went wrong"
4948
- });
4949
- }
4950
- setShowToast(true);
4961
+ handleAssignmentError(errMsg, variables);
4951
4962
  return;
4952
4963
  }
4953
4964
  if (response !== null && response !== void 0 && response.skipped && response.skipped.length > 0) {
4954
4965
  var _response$skipped$;
4955
4966
  const reason = ((_response$skipped$ = response.skipped[0]) === null || _response$skipped$ === void 0 ? void 0 : _response$skipped$.reason) || "";
4956
- const isMrKeyAlreadyAssigned = reason.toLowerCase().includes("already exists") || reason.toLowerCase().includes("already assign") || reason.toLowerCase().includes("active assignment") || reason.toLowerCase().includes("mrkey") || reason.toLowerCase().includes("mr key");
4957
- if (isMrKeyAlreadyAssigned) {
4958
- setToastData({
4959
- error: true,
4960
- label: t("EKYC_MR_KEY_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "mr key is already assign with another surveyor"
4961
- });
4962
- } else {
4963
- setToastData({
4964
- error: true,
4965
- label: t(reason) || reason || t("EKYC_ASSIGNMENT_SKIPPED") || "Assignment skipped"
4966
- });
4967
- }
4968
- setShowToast(true);
4967
+ handleAssignmentError(reason, variables);
4969
4968
  return;
4970
4969
  }
4971
4970
  setToastData({
@@ -4983,22 +4982,10 @@ const AssignEkycModal = _ref => {
4983
4982
  }
4984
4983
  }, 1000);
4985
4984
  },
4986
- onError: error => {
4985
+ onError: (error, variables) => {
4987
4986
  var _error$data, _error$response, _error$response$data;
4988
4987
  const errMsg = (error === null || error === void 0 ? void 0 : (_error$data = error.data) === null || _error$data === void 0 ? void 0 : _error$data.message) || (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.message) || "";
4989
- const isMrKeyAlreadyAssigned = errMsg.toLowerCase().includes("already assigned") || errMsg.toLowerCase().includes("already assign") || errMsg.toLowerCase().includes("mrkey") || errMsg.toLowerCase().includes("mr key");
4990
- if (isMrKeyAlreadyAssigned) {
4991
- setToastData({
4992
- error: true,
4993
- label: t("EKYC_MR_KEY_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "mr key is already assign with another surveyor"
4994
- });
4995
- } else {
4996
- setToastData({
4997
- error: true,
4998
- label: t(errMsg) || errMsg || t("EKYC_SOMETHING_WENT_WRONG") || "Something went wrong"
4999
- });
5000
- }
5001
- setShowToast(true);
4988
+ handleAssignmentError(errMsg, variables);
5002
4989
  }
5003
4990
  });
5004
4991
  const tableData = (applicationData === null || applicationData === void 0 ? void 0 : applicationData.consumerList) || [];
@@ -7483,14 +7470,35 @@ const Home = () => {
7483
7470
  link: "/digit-ui/citizen/ekyc/supervisor-dashboard"
7484
7471
  });
7485
7472
  }
7473
+ if (roles.includes("EKYC_SUPERVISOR") || roles.includes("EKYC_VENDOR")) {
7474
+ propsForModuleCard.links.push({
7475
+ label: t("TITLE_VENDOR_MANAGEMENT"),
7476
+ link: "/digit-ui/citizen/vendor/search-vendor"
7477
+ });
7478
+ }
7486
7479
  if (roles.length === 1 && roles.includes("CITIZEN")) {
7487
7480
  propsForModuleCard.links.push({
7481
+ label: t("EKYC_CREATE_KYC"),
7482
+ link: "/digit-ui/citizen/ekyc/create-kyc"
7483
+ }, {
7484
+ label: t("EKYC_UPDATE_KYC"),
7485
+ link: "/digit-ui/citizen/ekyc/update-kyc"
7486
+ }, {
7488
7487
  label: t("EKYC_STATUS"),
7489
7488
  link: "/digit-ui/citizen/ekyc/:id"
7490
7489
  });
7491
7490
  }
7492
- return /*#__PURE__*/React.createElement(ModuleLinksView, {
7493
- links: propsForModuleCard.links
7491
+ const formattedLinks = propsForModuleCard.links.map(l => ({
7492
+ i18nKey: l.label,
7493
+ link: l.link,
7494
+ count: l.count
7495
+ }));
7496
+ return /*#__PURE__*/React.createElement(CitizenHomeCard, {
7497
+ header: t("EKYC_MODULE_NAME"),
7498
+ links: formattedLinks,
7499
+ Icon: () => /*#__PURE__*/React.createElement(DocumentIcon, {
7500
+ className: "fill-path-primary-main"
7501
+ })
7494
7502
  });
7495
7503
  };
7496
7504
 
@@ -8600,6 +8608,10 @@ const CitizenApp = () => {
8600
8608
  const location = useLocation();
8601
8609
  const _useRouteMatch = useRouteMatch(),
8602
8610
  path = _useRouteMatch.path;
8611
+ const _Digit$Hooks$useStore = Digit.Hooks.useStore.getInitData(),
8612
+ _Digit$Hooks$useStore2 = _Digit$Hooks$useStore.data,
8613
+ _Digit$Hooks$useStore3 = _Digit$Hooks$useStore2 === void 0 ? {} : _Digit$Hooks$useStore2,
8614
+ stateInfo = _Digit$Hooks$useStore3.stateInfo;
8603
8615
  sessionStorage.removeItem("revalidateddone");
8604
8616
  const getDynamicBreadcrumbs = () => {
8605
8617
  const pathname = location.pathname;
@@ -8674,6 +8686,29 @@ const CitizenApp = () => {
8674
8686
  }
8675
8687
  return crumbs;
8676
8688
  };
8689
+ const isEkycHome = location.pathname === "/digit-ui/citizen/ekyc" || location.pathname === "/digit-ui/citizen/ekyc/";
8690
+ if (isEkycHome) {
8691
+ const isMobile = window.Digit.Utils.browser.isMobile();
8692
+ return (
8693
+ /*#__PURE__*/
8694
+ React.createElement("div", {
8695
+ className: "moduleLinkHomePage"
8696
+ }, /*#__PURE__*/React.createElement("div", {
8697
+ style: {
8698
+ position: "relative"
8699
+ }
8700
+ }, /*#__PURE__*/React.createElement("img", {
8701
+ src: stateInfo === null || stateInfo === void 0 ? void 0 : stateInfo.bannerUrl,
8702
+ alt: "noimagefound"
8703
+ }), /*#__PURE__*/React.createElement(BackButton, {
8704
+ className: "moduleLinkHomePageBackButton"
8705
+ }), /*#__PURE__*/React.createElement("div", {
8706
+ className: "moduleTitle"
8707
+ }, isMobile ? /*#__PURE__*/React.createElement("h4", null, t("MODULE_EKYC")) : /*#__PURE__*/React.createElement("h1", null, t("MODULE_EKYC")))), /*#__PURE__*/React.createElement("div", {
8708
+ className: "moduleLinkHomePageModuleLinks"
8709
+ }, /*#__PURE__*/React.createElement(Home, null)))
8710
+ );
8711
+ }
8677
8712
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
8678
8713
  className: "ground-container form-container"
8679
8714
  }, /*#__PURE__*/React.createElement(ModuleHeader, {