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

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) || [];
@@ -5155,7 +5142,7 @@ const AssignEkycModal = _ref => {
5155
5142
  }, isZroLoading ? "Loading ZRO Locations..." : "Select ZRO Location"), mappedZROLocation.map(loc => /*#__PURE__*/React.createElement("option", {
5156
5143
  key: loc.code,
5157
5144
  value: loc.name
5158
- }, loc.name)), "http://localhost:3000/digit-ui/employee/ekyc/assign"), /*#__PURE__*/React.createElement("select", {
5145
+ }, loc.name))), /*#__PURE__*/React.createElement("select", {
5159
5146
  className: "form-control",
5160
5147
  value: filters.ward,
5161
5148
  onChange: e => handleFilterChange("ward", e.target.value)
@@ -5178,19 +5165,11 @@ const AssignEkycModal = _ref => {
5178
5165
  placeholder: "MR Key",
5179
5166
  value: filters.mrkey,
5180
5167
  onChange: e => handleFilterChange("mrkey", e.target.value)
5181
- }), /*#__PURE__*/React.createElement("select", {
5182
- className: "form-control",
5183
- value: filters.ekycStatus,
5184
- onChange: e => handleFilterChange("ekycStatus", e.target.value)
5185
- }, /*#__PURE__*/React.createElement("option", {
5186
- value: ""
5187
- }, "All eKYC Status"), /*#__PURE__*/React.createElement("option", {
5188
- value: "PENDING"
5189
- }, "Pending"), /*#__PURE__*/React.createElement("option", {
5190
- value: "APPROVED"
5191
- }, "Approved"), /*#__PURE__*/React.createElement("option", {
5192
- value: "REJECTED"
5193
- }, "Rejected"))), /*#__PURE__*/React.createElement(Table, {
5168
+ }), selectedKnos.length > 0 && /*#__PURE__*/React.createElement("button", {
5169
+ className: "clear-selected-btn",
5170
+ type: "button",
5171
+ onClick: () => setSelectedKnos([])
5172
+ }, t("EKYC_CLEAR_SELECTION") || "Clear Selected (" + selectedKnos.length + ")")), /*#__PURE__*/React.createElement(Table, {
5194
5173
  tableTitle: "eKYC Applications",
5195
5174
  tableClass: "ekycTable",
5196
5175
  data: tableData,
@@ -7483,14 +7462,35 @@ const Home = () => {
7483
7462
  link: "/digit-ui/citizen/ekyc/supervisor-dashboard"
7484
7463
  });
7485
7464
  }
7465
+ if (roles.includes("EKYC_SUPERVISOR") || roles.includes("EKYC_VENDOR")) {
7466
+ propsForModuleCard.links.push({
7467
+ label: t("TITLE_VENDOR_MANAGEMENT"),
7468
+ link: "/digit-ui/citizen/vendor/search-vendor"
7469
+ });
7470
+ }
7486
7471
  if (roles.length === 1 && roles.includes("CITIZEN")) {
7487
7472
  propsForModuleCard.links.push({
7473
+ label: t("EKYC_CREATE_KYC"),
7474
+ link: "/digit-ui/citizen/ekyc/create-kyc"
7475
+ }, {
7476
+ label: t("EKYC_UPDATE_KYC"),
7477
+ link: "/digit-ui/citizen/ekyc/update-kyc"
7478
+ }, {
7488
7479
  label: t("EKYC_STATUS"),
7489
7480
  link: "/digit-ui/citizen/ekyc/:id"
7490
7481
  });
7491
7482
  }
7492
- return /*#__PURE__*/React.createElement(ModuleLinksView, {
7493
- links: propsForModuleCard.links
7483
+ const formattedLinks = propsForModuleCard.links.map(l => ({
7484
+ i18nKey: l.label,
7485
+ link: l.link,
7486
+ count: l.count
7487
+ }));
7488
+ return /*#__PURE__*/React.createElement(CitizenHomeCard, {
7489
+ header: t("EKYC_MODULE_NAME"),
7490
+ links: formattedLinks,
7491
+ Icon: () => /*#__PURE__*/React.createElement(DocumentIcon, {
7492
+ className: "fill-path-primary-main"
7493
+ })
7494
7494
  });
7495
7495
  };
7496
7496
 
@@ -8600,6 +8600,10 @@ const CitizenApp = () => {
8600
8600
  const location = useLocation();
8601
8601
  const _useRouteMatch = useRouteMatch(),
8602
8602
  path = _useRouteMatch.path;
8603
+ const _Digit$Hooks$useStore = Digit.Hooks.useStore.getInitData(),
8604
+ _Digit$Hooks$useStore2 = _Digit$Hooks$useStore.data,
8605
+ _Digit$Hooks$useStore3 = _Digit$Hooks$useStore2 === void 0 ? {} : _Digit$Hooks$useStore2,
8606
+ stateInfo = _Digit$Hooks$useStore3.stateInfo;
8603
8607
  sessionStorage.removeItem("revalidateddone");
8604
8608
  const getDynamicBreadcrumbs = () => {
8605
8609
  const pathname = location.pathname;
@@ -8674,6 +8678,29 @@ const CitizenApp = () => {
8674
8678
  }
8675
8679
  return crumbs;
8676
8680
  };
8681
+ const isEkycHome = location.pathname === "/digit-ui/citizen/ekyc" || location.pathname === "/digit-ui/citizen/ekyc/";
8682
+ if (isEkycHome) {
8683
+ const isMobile = window.Digit.Utils.browser.isMobile();
8684
+ return (
8685
+ /*#__PURE__*/
8686
+ React.createElement("div", {
8687
+ className: "moduleLinkHomePage"
8688
+ }, /*#__PURE__*/React.createElement("div", {
8689
+ style: {
8690
+ position: "relative"
8691
+ }
8692
+ }, /*#__PURE__*/React.createElement("img", {
8693
+ src: stateInfo === null || stateInfo === void 0 ? void 0 : stateInfo.bannerUrl,
8694
+ alt: "noimagefound"
8695
+ }), /*#__PURE__*/React.createElement(BackButton, {
8696
+ className: "moduleLinkHomePageBackButton"
8697
+ }), /*#__PURE__*/React.createElement("div", {
8698
+ className: "moduleTitle"
8699
+ }, isMobile ? /*#__PURE__*/React.createElement("h4", null, t("MODULE_EKYC")) : /*#__PURE__*/React.createElement("h1", null, t("MODULE_EKYC")))), /*#__PURE__*/React.createElement("div", {
8700
+ className: "moduleLinkHomePageModuleLinks"
8701
+ }, /*#__PURE__*/React.createElement(Home, null)))
8702
+ );
8703
+ }
8677
8704
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
8678
8705
  className: "ground-container form-container"
8679
8706
  }, /*#__PURE__*/React.createElement(ModuleHeader, {