@mseva/digit-ui-module-core 1.0.66-dev.1.0 → 1.0.66-dev.1.2

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,4 +1,4 @@
1
- import React, { useState, useRef, useEffect, Fragment as Fragment$1, createContext, useCallback, useMemo, isValidElement, cloneElement, createElement, useContext, forwardRef, useReducer, StrictMode as StrictMode$1 } from 'react';
1
+ import React, { useState, useEffect, useRef, Fragment as Fragment$1, createContext, useCallback, useMemo, isValidElement, cloneElement, createElement, useContext, forwardRef, useReducer, StrictMode as StrictMode$1 } from 'react';
2
2
  import { useQueryClient, QueryClient, QueryClientProvider } from 'react-query';
3
3
  import { Provider } from 'react-redux';
4
4
  import { Link, useLocation, useRouteMatch, useHistory, Switch, Route, Redirect, BrowserRouter } from 'react-router-dom';
@@ -6117,7 +6117,23 @@ const EmployeeQuickServicesCard = ({
6117
6117
  const {
6118
6118
  t
6119
6119
  } = useTranslation();
6120
- const userRoles = Digit.UserService.getUser().info.roles;
6120
+ const [userInfoData, setUserInfoData] = useState(() => JSON.parse(sessionStorage.getItem("userInfoData") || "{}"));
6121
+ const userRoles = (userInfoData === null || userInfoData === void 0 ? void 0 : userInfoData.roles) || [];
6122
+ useEffect(() => {
6123
+ if (userInfoData !== null && userInfoData !== void 0 && userInfoData.roles) return;
6124
+ const interval = setInterval(() => {
6125
+ const stored = JSON.parse(sessionStorage.getItem("userInfoData") || "{}");
6126
+ if (stored !== null && stored !== void 0 && stored.roles) {
6127
+ setUserInfoData(stored);
6128
+ clearInterval(interval);
6129
+ }
6130
+ }, 500);
6131
+ const timeout = setTimeout(() => clearInterval(interval), 3000);
6132
+ return () => {
6133
+ clearInterval(interval);
6134
+ clearTimeout(timeout);
6135
+ };
6136
+ }, []);
6121
6137
  const [isHovered, setIsHovered] = useState(false);
6122
6138
  const updatedModuleData = quickServiceModules.modules.filter(item => item.moduleCode === moduleData.code).map(item => ({
6123
6139
  ...item,
@@ -11864,9 +11880,19 @@ const Login = ({
11864
11880
  isMandatory: true
11865
11881
  }]
11866
11882
  }];
11883
+ useEffect(() => {
11884
+ const script = document.createElement("script");
11885
+ script.src = "https://translation-plugin.bhashini.co.in/v3/website_translation_utility.js ";
11886
+ script.async = true;
11887
+ document.body.appendChild(script);
11888
+ }, []);
11867
11889
  return isLoading || isStoreLoading ? /*#__PURE__*/React.createElement(Loader, null) :
11868
11890
  /*#__PURE__*/
11869
11891
  React.createElement(Background, null, /*#__PURE__*/React.createElement("div", {
11892
+ className: "language-plugin"
11893
+ }, /*#__PURE__*/React.createElement("div", {
11894
+ className: "bhashini-plugin-container"
11895
+ })), /*#__PURE__*/React.createElement("div", {
11870
11896
  className: "employee-login-container"
11871
11897
  }, /*#__PURE__*/React.createElement("div", {
11872
11898
  className: "employee-login-content"
@@ -12830,52 +12856,6 @@ const ChangeCity = prop => {
12830
12856
  }));
12831
12857
  };
12832
12858
 
12833
- const ChangeLanguage = prop => {
12834
- const isDropdown = prop.dropdown || false;
12835
- const {
12836
- data: storeData,
12837
- isLoading
12838
- } = Digit.Hooks.useStore.getInitData();
12839
- const {
12840
- languages,
12841
- stateInfo
12842
- } = storeData || {};
12843
- const selectedLanguage = Digit.StoreData.getCurrentLanguage();
12844
- const [selected, setselected] = useState(selectedLanguage);
12845
- const handleChangeLanguage = language => {
12846
- setselected(language.value);
12847
- Digit.LocalizationService.changeLanguage(language.value, stateInfo.code);
12848
- };
12849
- if (isLoading) return null;
12850
- if (isDropdown) {
12851
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Dropdown, {
12852
- option: languages,
12853
- selected: languages.find(language => language.value === selectedLanguage),
12854
- optionKey: "label",
12855
- select: handleChangeLanguage,
12856
- freeze: true,
12857
- customSelector: /*#__PURE__*/React.createElement("label", {
12858
- className: "cp"
12859
- }, languages.find(language => language.value === selected).label)
12860
- }));
12861
- } else {
12862
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
12863
- style: {
12864
- marginBottom: "5px"
12865
- }
12866
- }, "Language"), /*#__PURE__*/React.createElement("div", {
12867
- className: "language-selector"
12868
- }, languages.map((language, index) => /*#__PURE__*/React.createElement("div", {
12869
- className: "language-button-container",
12870
- key: index
12871
- }, /*#__PURE__*/React.createElement(CustomButton, {
12872
- selected: language.value === selected,
12873
- text: language.label,
12874
- onClick: () => handleChangeLanguage(language)
12875
- })))));
12876
- }
12877
- };
12878
-
12879
12859
  const TextToImg = props => {
12880
12860
  var _props$name, _props$name$;
12881
12861
  return /*#__PURE__*/React.createElement("span", {
@@ -13029,9 +13009,7 @@ const TopBar = ({
13029
13009
  style: {
13030
13010
  marginTop: "20px"
13031
13011
  }
13032
- }, /*#__PURE__*/React.createElement(ChangeLanguage, {
13033
- dropdown: true
13034
- })), !urlsToDisableNotificationIcon(pathname) && /*#__PURE__*/React.createElement("div", {
13012
+ }), !urlsToDisableNotificationIcon(pathname) && /*#__PURE__*/React.createElement("div", {
13035
13013
  className: "notification-wrapper",
13036
13014
  onClick: onNotificationIconClick
13037
13015
  }, notificationCountLoaded && unreadNotificationCount ? /*#__PURE__*/React.createElement("span", {
@@ -13071,7 +13049,7 @@ const TopBar = ({
13071
13049
  display: "inline-block"
13072
13050
  } : {}
13073
13051
  }, t(`MYCITY_${stateInfo === null || stateInfo === void 0 ? void 0 : (_stateInfo$code = stateInfo.code) === null || _stateInfo$code === void 0 ? void 0 : _stateInfo$code.toUpperCase()}_LABEL`), " ", t(`MYCITY_STATECODE_LABEL`)), !mobileView && /*#__PURE__*/React.createElement("div", {
13074
- className: mobileView ? "right" : "flex-right right w-80 column-gap-15",
13052
+ className: mobileView ? "right" : "flex-right right w-80 column-gap-15 margin-right-50",
13075
13053
  style: !loggedin ? {
13076
13054
  width: "80%"
13077
13055
  } : {}
@@ -13080,10 +13058,6 @@ const TopBar = ({
13080
13058
  }, !window.location.href.includes("employee/user/login") && !window.location.href.includes("employee/user/language-selection") && /*#__PURE__*/React.createElement(ChangeCity, {
13081
13059
  dropdown: true,
13082
13060
  t: t
13083
- })), /*#__PURE__*/React.createElement("div", {
13084
- className: "left"
13085
- }, _showLanguageChange && /*#__PURE__*/React.createElement(ChangeLanguage, {
13086
- dropdown: true
13087
13061
  })), (userDetails === null || userDetails === void 0 ? void 0 : userDetails.access_token) && /*#__PURE__*/React.createElement("div", {
13088
13062
  className: "left"
13089
13063
  }, /*#__PURE__*/React.createElement(Dropdown, {
@@ -13109,7 +13083,9 @@ const TopBar = ({
13109
13083
  borderRadius: "50%"
13110
13084
  }
13111
13085
  })
13112
- })))));
13086
+ })), /*#__PURE__*/React.createElement("div", {
13087
+ className: "left"
13088
+ }))));
13113
13089
  };
13114
13090
 
13115
13091
  const SideBarMenu = (t, closeSidebar, redirectToLoginPage, redirectToScrutinyPage, isEmployee, storeData, tenantId) => {
@@ -13124,11 +13100,6 @@ const SideBarMenu = (t, closeSidebar, redirectToLoginPage, redirectToScrutinyPag
13124
13100
  populators: {
13125
13101
  onClick: closeSidebar
13126
13102
  }
13127
- }, {
13128
- type: "component",
13129
- element: "LANGUAGE",
13130
- action: /*#__PURE__*/React.createElement(ChangeLanguage, null),
13131
- icon: "LanguageIcon"
13132
13103
  }, {
13133
13104
  id: "login-btn",
13134
13105
  element: "LOGIN",
@@ -14551,6 +14522,7 @@ const UserProfile = ({
14551
14522
  const {
14552
14523
  t
14553
14524
  } = useTranslation();
14525
+ const location = useLocation();
14554
14526
  const url = window.location.href;
14555
14527
  const stateId = Digit.ULBService.getStateId();
14556
14528
  const tenant = Digit.ULBService.getCurrentTenantId();
@@ -14587,6 +14559,7 @@ const UserProfile = ({
14587
14559
  const [selectedCorrespondentDistrict, setSelectedCorrespondentDistrict] = useState();
14588
14560
  const [pinCodeCorrespondent, setPinCodeCorrespondent] = useState();
14589
14561
  const isUserArchitect = window.location.href.includes("citizen") && (userInfo === null || userInfo === void 0 ? void 0 : (_userInfo$roles = userInfo.roles) === null || _userInfo$roles === void 0 ? void 0 : _userInfo$roles.some(role => role.code.includes("BPA_ARCHITECT")));
14562
+ console.log("location", location);
14590
14563
  const getUserInfo = async () => {
14591
14564
  const uuid = userInfo === null || userInfo === void 0 ? void 0 : userInfo.uuid;
14592
14565
  if (uuid) {
@@ -15025,7 +14998,18 @@ const UserProfile = ({
15025
14998
  });
15026
14999
  }
15027
15000
  } else if (responseInfo !== null && responseInfo !== void 0 && responseInfo.status && responseInfo.status === "200") {
15001
+ var _location$state;
15028
15002
  showToast("success", t("CORE_COMMON_PROFILE_UPDATE_SUCCESS"), 5000);
15003
+ if (location !== null && location !== void 0 && (_location$state = location.state) !== null && _location$state !== void 0 && _location$state.from.includes("/engagement/surveys")) {
15004
+ history.push({
15005
+ pathname: location.state.from,
15006
+ state: {
15007
+ surveyDetails: location.state.surveyDetails,
15008
+ userInfo: location.state.userInfo,
15009
+ userType: location.state.userType
15010
+ }
15011
+ });
15012
+ }
15029
15013
  }
15030
15014
  } catch (error) {
15031
15015
  const errorObj = JSON.parse(error);
@@ -15097,7 +15081,16 @@ const UserProfile = ({
15097
15081
  className: "user-profile"
15098
15082
  }, /*#__PURE__*/React.createElement("section", {
15099
15083
  className: `user-profile-section-wrapper ${userType === "employee" ? "employee" : ""}`
15100
- }, userType === "citizen" ? /*#__PURE__*/React.createElement(BackButton, null) : /*#__PURE__*/React.createElement(BreadCrumb, {
15084
+ }, userType === "citizen" ? /*#__PURE__*/React.createElement("h6", {
15085
+ onClick: () => history.push("/digit-ui/citizen"),
15086
+ style: {
15087
+ marginTop: "60px",
15088
+ paddingLeft: "13px",
15089
+ fontSize: "16px",
15090
+ fontWeight: "bolder",
15091
+ cursor: "pointer"
15092
+ }
15093
+ }, "Home") : /*#__PURE__*/React.createElement(BreadCrumb, {
15101
15094
  crumbs: [{
15102
15095
  path: "/digit-ui/employee",
15103
15096
  content: t("ES_COMMON_HOME"),
@@ -16087,9 +16080,19 @@ const EmployeeApp = ({
16087
16080
  }, []);
16088
16081
  sourceUrl = "https://s3.ap-south-1.amazonaws.com/egov-qa-assets";
16089
16082
  const displayHeader = !window.location.href.includes("/user/language-selection");
16083
+ useEffect(() => {
16084
+ const script = document.createElement("script");
16085
+ script.src = "https://translation-plugin.bhashini.co.in/v3/website_translation_utility.js ";
16086
+ script.async = true;
16087
+ document.body.appendChild(script);
16088
+ }, []);
16090
16089
  return /*#__PURE__*/React.createElement("div", {
16091
16090
  className: "employee"
16092
- }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
16091
+ }, /*#__PURE__*/React.createElement("div", {
16092
+ className: "language-plugin"
16093
+ }, /*#__PURE__*/React.createElement("div", {
16094
+ className: "bhashini-plugin-container"
16095
+ })), /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
16093
16096
  path: `${path}/user`
16094
16097
  }, isUserProfile ? /*#__PURE__*/React.createElement(TopBarSideBar, {
16095
16098
  t: t,
@@ -16540,6 +16543,7 @@ const Home = () => {
16540
16543
  sessionStorage.removeItem("propertyid");
16541
16544
  }, [UserType]);
16542
16545
  const toDigitUrl = url => {
16546
+ console.log("url", url);
16543
16547
  if (!url) return url;
16544
16548
  if (url.startsWith("/digit-ui")) {
16545
16549
  history.push(url);
@@ -16733,54 +16737,6 @@ const Home = () => {
16733
16737
  }, /*#__PURE__*/React.createElement(CardBasedOptions, allInfoAndUpdatesProps)))));
16734
16738
  };
16735
16739
 
16736
- const LanguageSelect = ({
16737
- onLanguageChange
16738
- }) => {
16739
- const {
16740
- t
16741
- } = useTranslation();
16742
- const {
16743
- data: {
16744
- languages,
16745
- stateInfo
16746
- } = {},
16747
- isLoading
16748
- } = Digit.Hooks.useStore.getInitData();
16749
- const selectedLanguage = Digit.StoreData.getCurrentLanguage();
16750
- const languagesProps = useMemo(() => ({
16751
- options: languages,
16752
- optionsKey: "label",
16753
- onSelect: language => {
16754
- Digit.LocalizationService.changeLanguage(language.value, stateInfo.code);
16755
- onLanguageChange && onLanguageChange(language.value);
16756
- },
16757
- selectedOption: languages === null || languages === void 0 ? void 0 : languages.find(i => i.value === selectedLanguage)
16758
- }), [languages, selectedLanguage, onLanguageChange]);
16759
- const handleLanguageSelect = language => {
16760
- Digit.LocalizationService.changeLanguage(language.value, stateInfo.code);
16761
- onLanguageChange && onLanguageChange(language.value);
16762
- };
16763
- return (
16764
- /*#__PURE__*/
16765
- React.createElement("div", {
16766
- className: "newLoginlanguageWrapper"
16767
- }, /*#__PURE__*/React.createElement("div", {
16768
- className: "newLoginlabel"
16769
- }, t("CS_COMMON_CHOOSE_LANGUAGE"), /*#__PURE__*/React.createElement("span", {
16770
- className: "newLoginrequired"
16771
- }, " *")), !isLoading && /*#__PURE__*/React.createElement("div", {
16772
- className: "newLoginlanguageButtonContainer"
16773
- }, languages === null || languages === void 0 ? void 0 : languages.map(language => {
16774
- const isSelected = selectedLanguage === language.value;
16775
- return /*#__PURE__*/React.createElement("button", {
16776
- key: language.value,
16777
- onClick: () => handleLanguageSelect(language),
16778
- className: `newLoginlanguageButton ${isSelected ? "selected" : ""}`
16779
- }, language.label);
16780
- })))
16781
- );
16782
- };
16783
-
16784
16740
  const LocationSelect = ({
16785
16741
  onLocationChange,
16786
16742
  selectedCity
@@ -17192,9 +17148,7 @@ const NewLogin = ({
17192
17148
  className: "login-title"
17193
17149
  }, t("CORE_COMMON_LOGIN")), /*#__PURE__*/React.createElement("p", {
17194
17150
  className: "login-subtitle"
17195
- }, "Enter your details to access your account")), /*#__PURE__*/React.createElement(LanguageSelect, {
17196
- onLanguageChange: setSelectedLanguage
17197
- }), /*#__PURE__*/React.createElement(LocationSelect, {
17151
+ }, "Enter your details to access your account")), /*#__PURE__*/React.createElement(LocationSelect, {
17198
17152
  onLocationChange: setSelectedCity,
17199
17153
  selectedCity: selectedCity
17200
17154
  }), /*#__PURE__*/React.createElement(MobileInput, {
@@ -17366,6 +17320,16 @@ const RegistrationForm = ({
17366
17320
  };
17367
17321
 
17368
17322
  const DEFAULT_REDIRECT_URL$1 = "/digit-ui/citizen";
17323
+ const genders = [{
17324
+ name: "Male",
17325
+ code: "MALE"
17326
+ }, {
17327
+ name: "Female",
17328
+ code: "FEMALE"
17329
+ }, {
17330
+ name: "Transgender",
17331
+ code: "TRANSGENDER"
17332
+ }];
17369
17333
  const NewRegistration = ({
17370
17334
  stateCode
17371
17335
  }) => {
@@ -17388,6 +17352,7 @@ const NewRegistration = ({
17388
17352
  });
17389
17353
  const [selectedCity, setSelectedCity] = useState(((_location$state2 = location.state) === null || _location$state2 === void 0 ? void 0 : _location$state2.selectedCity) || null);
17390
17354
  const [dob, setDob] = useState("");
17355
+ const [getGender, setGender] = useState();
17391
17356
  useEffect(() => {
17392
17357
  let to;
17393
17358
  if (error) {
@@ -17437,7 +17402,8 @@ const NewRegistration = ({
17437
17402
  dob: formData === null || formData === void 0 ? void 0 : formData.dob,
17438
17403
  tenantId: stateCode,
17439
17404
  userType: getUserType(),
17440
- type: "register"
17405
+ type: "register",
17406
+ gender: getGender === null || getGender === void 0 ? void 0 : getGender.code
17441
17407
  };
17442
17408
  const [res, err] = await sendOtp({
17443
17409
  otp: data
@@ -17475,7 +17441,8 @@ const NewRegistration = ({
17475
17441
  username: registrationData === null || registrationData === void 0 ? void 0 : registrationData.mobileNumber,
17476
17442
  otpReference: otp,
17477
17443
  dob: dob,
17478
- tenantId: stateCode
17444
+ tenantId: stateCode,
17445
+ gender: getGender === null || getGender === void 0 ? void 0 : getGender.code
17479
17446
  };
17480
17447
  const {
17481
17448
  ResponseInfo,
@@ -17522,6 +17489,9 @@ const NewRegistration = ({
17522
17489
  selectedCity: selectedCity
17523
17490
  });
17524
17491
  };
17492
+ useEffect(() => {
17493
+ console.log("getGender", getGender);
17494
+ }, [getGender]);
17525
17495
  return /*#__PURE__*/React.createElement("div", {
17526
17496
  className: "login-page-cover"
17527
17497
  }, /*#__PURE__*/React.createElement("div", {
@@ -17599,12 +17569,21 @@ const NewRegistration = ({
17599
17569
  className: "login-title"
17600
17570
  }, t("CS_COMMON_REGISTER")), /*#__PURE__*/React.createElement("p", {
17601
17571
  className: "login-subtitle"
17602
- }, "Create your account to get started")), /*#__PURE__*/React.createElement(LanguageSelect, {
17603
- onLanguageChange: setSelectedLanguage
17604
- }), /*#__PURE__*/React.createElement(LocationSelect, {
17572
+ }, "Create your account to get started")), /*#__PURE__*/React.createElement(LocationSelect, {
17605
17573
  onLocationChange: setSelectedCity,
17606
17574
  selectedCity: selectedCity
17607
- }), step === "FORM" && /*#__PURE__*/React.createElement(RegistrationForm, {
17575
+ }), /*#__PURE__*/React.createElement("div", {
17576
+ className: "location-wrapper"
17577
+ }, /*#__PURE__*/React.createElement("div", {
17578
+ className: "label"
17579
+ }, t("CORE_COMMON_GENDER"), /*#__PURE__*/React.createElement("span", null, " *")), /*#__PURE__*/React.createElement(Dropdown, {
17580
+ option: genders,
17581
+ optionKey: "name",
17582
+ id: "name",
17583
+ selected: getGender,
17584
+ select: setGender,
17585
+ placeholder: t("COMMON_TABLE_SEARCH")
17586
+ })), step === "FORM" && /*#__PURE__*/React.createElement(RegistrationForm, {
17608
17587
  onRegisterSubmit: onRegisterSubmit,
17609
17588
  onAgeError: onAgeError,
17610
17589
  selectedLanguage: selectedLanguage,
@@ -21159,6 +21138,12 @@ const Home$1 = ({
21159
21138
  module: code === null || code === void 0 ? void 0 : code.toUpperCase()
21160
21139
  })));
21161
21140
  });
21141
+ useEffect(() => {
21142
+ const script = document.createElement("script");
21143
+ script.src = "https://translation-plugin.bhashini.co.in/v3/website_translation_utility.js ";
21144
+ script.async = true;
21145
+ document.body.appendChild(script);
21146
+ }, []);
21162
21147
  return /*#__PURE__*/React.createElement("div", {
21163
21148
  className: classname
21164
21149
  }, hideTopSidebar ? null : /*#__PURE__*/React.createElement(TopBarSideBar, {
@@ -21174,6 +21159,10 @@ const Home$1 = ({
21174
21159
  linkData: linkData,
21175
21160
  islinkDataLoading: islinkDataLoading
21176
21161
  }), /*#__PURE__*/React.createElement("div", {
21162
+ className: "language-plugin"
21163
+ }, /*#__PURE__*/React.createElement("div", {
21164
+ className: "bhashini-plugin-container"
21165
+ })), /*#__PURE__*/React.createElement("div", {
21177
21166
  className: `main center-container citizen-home-container mb-25`
21178
21167
  }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
21179
21168
  exact: true,
@@ -21460,9 +21449,19 @@ const LandingPage = () => {
21460
21449
  const navigateToCitizenApp = () => {
21461
21450
  history.push('/digit-ui/citizen');
21462
21451
  };
21452
+ useEffect(() => {
21453
+ const script = document.createElement("script");
21454
+ script.src = "https://translation-plugin.bhashini.co.in/v3/website_translation_utility.js ";
21455
+ script.async = true;
21456
+ document.body.appendChild(script);
21457
+ }, []);
21463
21458
  return /*#__PURE__*/React.createElement("div", {
21464
21459
  className: "landing-page"
21465
- }, /*#__PURE__*/React.createElement("section", {
21460
+ }, /*#__PURE__*/React.createElement("div", {
21461
+ className: "language-plugin-landing"
21462
+ }, /*#__PURE__*/React.createElement("div", {
21463
+ className: "bhashini-plugin-container"
21464
+ })), /*#__PURE__*/React.createElement("section", {
21466
21465
  className: "landing-hero"
21467
21466
  }, /*#__PURE__*/React.createElement("div", {
21468
21467
  className: "landing-hero-overlay"