@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.
package/dist/index.js CHANGED
@@ -4933,42 +4933,41 @@ const AssignEkycModal = _ref => {
4933
4933
  }),
4934
4934
  applicationData = _Digit$Hooks$ekyc$use.data,
4935
4935
  isLoading = _Digit$Hooks$ekyc$use.isFetching;
4936
+ const handleAssignmentError = (errMsg, variables) => {
4937
+ 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");
4938
+ if (isAlreadyAssigned) {
4939
+ const isMrKeyType = (variables === null || variables === void 0 ? void 0 : variables.assignmentType) === "MRKEY";
4940
+ if (isMrKeyType) {
4941
+ setToastData({
4942
+ error: true,
4943
+ label: t("EKYC_MR_KEY_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "mr key is already assign with another surveyor"
4944
+ });
4945
+ } else {
4946
+ setToastData({
4947
+ error: true,
4948
+ label: t("EKYC_KNO_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "kno is already assign with another surveyor"
4949
+ });
4950
+ }
4951
+ } else {
4952
+ setToastData({
4953
+ error: true,
4954
+ label: t(errMsg) || errMsg || t("EKYC_SOMETHING_WENT_WRONG") || "Something went wrong"
4955
+ });
4956
+ }
4957
+ setShowToast(true);
4958
+ };
4936
4959
  const assignmentMutation = Digit.Hooks.ekyc.useEkycAssignmentCreate({
4937
- onSuccess: response => {
4960
+ onSuccess: (response, variables) => {
4938
4961
  if (response !== null && response !== void 0 && response.error) {
4939
4962
  var _response$data;
4940
4963
  const errMsg = (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.message) || "";
4941
- const isMrKeyAlreadyAssigned = errMsg.toLowerCase().includes("already assigned") || errMsg.toLowerCase().includes("already assign") || errMsg.toLowerCase().includes("mrkey") || errMsg.toLowerCase().includes("mr key");
4942
- if (isMrKeyAlreadyAssigned) {
4943
- setToastData({
4944
- error: true,
4945
- label: t("EKYC_MR_KEY_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "mr key is already assign with another surveyor"
4946
- });
4947
- } else {
4948
- setToastData({
4949
- error: true,
4950
- label: t(errMsg) || errMsg || t("EKYC_SOMETHING_WENT_WRONG") || "Something went wrong"
4951
- });
4952
- }
4953
- setShowToast(true);
4964
+ handleAssignmentError(errMsg, variables);
4954
4965
  return;
4955
4966
  }
4956
4967
  if (response !== null && response !== void 0 && response.skipped && response.skipped.length > 0) {
4957
4968
  var _response$skipped$;
4958
4969
  const reason = ((_response$skipped$ = response.skipped[0]) === null || _response$skipped$ === void 0 ? void 0 : _response$skipped$.reason) || "";
4959
- 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");
4960
- if (isMrKeyAlreadyAssigned) {
4961
- setToastData({
4962
- error: true,
4963
- label: t("EKYC_MR_KEY_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "mr key is already assign with another surveyor"
4964
- });
4965
- } else {
4966
- setToastData({
4967
- error: true,
4968
- label: t(reason) || reason || t("EKYC_ASSIGNMENT_SKIPPED") || "Assignment skipped"
4969
- });
4970
- }
4971
- setShowToast(true);
4970
+ handleAssignmentError(reason, variables);
4972
4971
  return;
4973
4972
  }
4974
4973
  setToastData({
@@ -4986,22 +4985,10 @@ const AssignEkycModal = _ref => {
4986
4985
  }
4987
4986
  }, 1000);
4988
4987
  },
4989
- onError: error => {
4988
+ onError: (error, variables) => {
4990
4989
  var _error$data, _error$response, _error$response$data;
4991
4990
  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) || "";
4992
- const isMrKeyAlreadyAssigned = errMsg.toLowerCase().includes("already assigned") || errMsg.toLowerCase().includes("already assign") || errMsg.toLowerCase().includes("mrkey") || errMsg.toLowerCase().includes("mr key");
4993
- if (isMrKeyAlreadyAssigned) {
4994
- setToastData({
4995
- error: true,
4996
- label: t("EKYC_MR_KEY_ALREADY_ASSIGNED_WITH_ANOTHER_SURVEYOR") || "mr key is already assign with another surveyor"
4997
- });
4998
- } else {
4999
- setToastData({
5000
- error: true,
5001
- label: t(errMsg) || errMsg || t("EKYC_SOMETHING_WENT_WRONG") || "Something went wrong"
5002
- });
5003
- }
5004
- setShowToast(true);
4991
+ handleAssignmentError(errMsg, variables);
5005
4992
  }
5006
4993
  });
5007
4994
  const tableData = (applicationData === null || applicationData === void 0 ? void 0 : applicationData.consumerList) || [];
@@ -5158,7 +5145,7 @@ const AssignEkycModal = _ref => {
5158
5145
  }, isZroLoading ? "Loading ZRO Locations..." : "Select ZRO Location"), mappedZROLocation.map(loc => /*#__PURE__*/React__default.createElement("option", {
5159
5146
  key: loc.code,
5160
5147
  value: loc.name
5161
- }, loc.name)), "http://localhost:3000/digit-ui/employee/ekyc/assign"), /*#__PURE__*/React__default.createElement("select", {
5148
+ }, loc.name))), /*#__PURE__*/React__default.createElement("select", {
5162
5149
  className: "form-control",
5163
5150
  value: filters.ward,
5164
5151
  onChange: e => handleFilterChange("ward", e.target.value)
@@ -5181,19 +5168,11 @@ const AssignEkycModal = _ref => {
5181
5168
  placeholder: "MR Key",
5182
5169
  value: filters.mrkey,
5183
5170
  onChange: e => handleFilterChange("mrkey", e.target.value)
5184
- }), /*#__PURE__*/React__default.createElement("select", {
5185
- className: "form-control",
5186
- value: filters.ekycStatus,
5187
- onChange: e => handleFilterChange("ekycStatus", e.target.value)
5188
- }, /*#__PURE__*/React__default.createElement("option", {
5189
- value: ""
5190
- }, "All eKYC Status"), /*#__PURE__*/React__default.createElement("option", {
5191
- value: "PENDING"
5192
- }, "Pending"), /*#__PURE__*/React__default.createElement("option", {
5193
- value: "APPROVED"
5194
- }, "Approved"), /*#__PURE__*/React__default.createElement("option", {
5195
- value: "REJECTED"
5196
- }, "Rejected"))), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Table, {
5171
+ }), selectedKnos.length > 0 && /*#__PURE__*/React__default.createElement("button", {
5172
+ className: "clear-selected-btn",
5173
+ type: "button",
5174
+ onClick: () => setSelectedKnos([])
5175
+ }, t("EKYC_CLEAR_SELECTION") || "Clear Selected (" + selectedKnos.length + ")")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.Table, {
5197
5176
  tableTitle: "eKYC Applications",
5198
5177
  tableClass: "ekycTable",
5199
5178
  data: tableData,
@@ -7486,14 +7465,35 @@ const Home = () => {
7486
7465
  link: "/digit-ui/citizen/ekyc/supervisor-dashboard"
7487
7466
  });
7488
7467
  }
7468
+ if (roles.includes("EKYC_SUPERVISOR") || roles.includes("EKYC_VENDOR")) {
7469
+ propsForModuleCard.links.push({
7470
+ label: t("TITLE_VENDOR_MANAGEMENT"),
7471
+ link: "/digit-ui/citizen/vendor/search-vendor"
7472
+ });
7473
+ }
7489
7474
  if (roles.length === 1 && roles.includes("CITIZEN")) {
7490
7475
  propsForModuleCard.links.push({
7476
+ label: t("EKYC_CREATE_KYC"),
7477
+ link: "/digit-ui/citizen/ekyc/create-kyc"
7478
+ }, {
7479
+ label: t("EKYC_UPDATE_KYC"),
7480
+ link: "/digit-ui/citizen/ekyc/update-kyc"
7481
+ }, {
7491
7482
  label: t("EKYC_STATUS"),
7492
7483
  link: "/digit-ui/citizen/ekyc/:id"
7493
7484
  });
7494
7485
  }
7495
- return /*#__PURE__*/React__default.createElement(digitUiReactComponents.ModuleLinksView, {
7496
- links: propsForModuleCard.links
7486
+ const formattedLinks = propsForModuleCard.links.map(l => ({
7487
+ i18nKey: l.label,
7488
+ link: l.link,
7489
+ count: l.count
7490
+ }));
7491
+ return /*#__PURE__*/React__default.createElement(digitUiReactComponents.CitizenHomeCard, {
7492
+ header: t("EKYC_MODULE_NAME"),
7493
+ links: formattedLinks,
7494
+ Icon: () => /*#__PURE__*/React__default.createElement(digitUiReactComponents.DocumentIcon, {
7495
+ className: "fill-path-primary-main"
7496
+ })
7497
7497
  });
7498
7498
  };
7499
7499
 
@@ -8603,6 +8603,10 @@ const CitizenApp = () => {
8603
8603
  const location = reactRouterDom.useLocation();
8604
8604
  const _useRouteMatch = reactRouterDom.useRouteMatch(),
8605
8605
  path = _useRouteMatch.path;
8606
+ const _Digit$Hooks$useStore = Digit.Hooks.useStore.getInitData(),
8607
+ _Digit$Hooks$useStore2 = _Digit$Hooks$useStore.data,
8608
+ _Digit$Hooks$useStore3 = _Digit$Hooks$useStore2 === void 0 ? {} : _Digit$Hooks$useStore2,
8609
+ stateInfo = _Digit$Hooks$useStore3.stateInfo;
8606
8610
  sessionStorage.removeItem("revalidateddone");
8607
8611
  const getDynamicBreadcrumbs = () => {
8608
8612
  const pathname = location.pathname;
@@ -8677,6 +8681,29 @@ const CitizenApp = () => {
8677
8681
  }
8678
8682
  return crumbs;
8679
8683
  };
8684
+ const isEkycHome = location.pathname === "/digit-ui/citizen/ekyc" || location.pathname === "/digit-ui/citizen/ekyc/";
8685
+ if (isEkycHome) {
8686
+ const isMobile = window.Digit.Utils.browser.isMobile();
8687
+ return (
8688
+ /*#__PURE__*/
8689
+ React__default.createElement("div", {
8690
+ className: "moduleLinkHomePage"
8691
+ }, /*#__PURE__*/React__default.createElement("div", {
8692
+ style: {
8693
+ position: "relative"
8694
+ }
8695
+ }, /*#__PURE__*/React__default.createElement("img", {
8696
+ src: stateInfo === null || stateInfo === void 0 ? void 0 : stateInfo.bannerUrl,
8697
+ alt: "noimagefound"
8698
+ }), /*#__PURE__*/React__default.createElement(digitUiReactComponents.BackButton, {
8699
+ className: "moduleLinkHomePageBackButton"
8700
+ }), /*#__PURE__*/React__default.createElement("div", {
8701
+ className: "moduleTitle"
8702
+ }, isMobile ? /*#__PURE__*/React__default.createElement("h4", null, t("MODULE_EKYC")) : /*#__PURE__*/React__default.createElement("h1", null, t("MODULE_EKYC")))), /*#__PURE__*/React__default.createElement("div", {
8703
+ className: "moduleLinkHomePageModuleLinks"
8704
+ }, /*#__PURE__*/React__default.createElement(Home, null)))
8705
+ );
8706
+ }
8680
8707
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
8681
8708
  className: "ground-container form-container"
8682
8709
  }, /*#__PURE__*/React__default.createElement(digitUiReactComponents.ModuleHeader, {