@acuteinfo/common-screens 1.0.22 → 1.0.23

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.d.ts CHANGED
@@ -3,4 +3,5 @@ import "buffer";
3
3
  export * from "./pages/auth/authController";
4
4
  export * from "./pages/auth/forgotPassword";
5
5
  export * from "./pages/branchSelection/branchSelectionGrid";
6
+ export { AppbarWrapper } from "./pages/appbar";
6
7
  export * from "./pages/types";
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { useState, useRef, useEffect, Fragment, useMemo, useReducer, useCallback
5
5
  import { makeStyles } from '@mui/styles';
6
6
  import Visibility from '@mui/icons-material/Visibility';
7
7
  import VisibilityOff from '@mui/icons-material/VisibilityOff';
8
- import { Container, Grid, InputAdornment, IconButton, CircularProgress, FormHelperText, Typography, Tooltip, tooltipClasses, Stack, Box, Avatar, Button } from '@mui/material';
8
+ import { Container, Grid, InputAdornment, IconButton, CircularProgress, FormHelperText, Typography, Tooltip, tooltipClasses, Stack, Box, Avatar, Button, alpha, AppBar, Toolbar } from '@mui/material';
9
9
  import { useTranslation } from 'react-i18next';
10
10
  import OTPInput, { ResendOTP } from 'otp-input-react';
11
11
  import IconButton$1 from '@mui/material/IconButton';
@@ -17,8 +17,12 @@ import { useQuery, useMutation } from 'react-query';
17
17
  import bank_logo_default from 'assets/images/BecomePartnerImg.svg';
18
18
  import { styled } from '@mui/material/styles';
19
19
  import USER_PROFILE_DEFAULT from 'assets/images/USER_PROFILE_DEFAULT.png';
20
+ import Waving_hand$1 from 'assets/images/Waving_Hand_header.png';
21
+ import LogoutIcon from '@mui/icons-material/Logout';
22
+ import MenuOutlinedIcon from '@mui/icons-material/MenuOutlined';
23
+ import { format } from 'date-fns';
20
24
 
21
- const useStyles$1 = makeStyles((theme) => ({
25
+ const useStyles$2 = makeStyles((theme) => ({
22
26
  wrapper: {
23
27
  minHeight: "100vh",
24
28
  boxShadow: "0 3px 6px rgba(0,0,0,0.03)",
@@ -816,7 +820,7 @@ const isBase64 = (str = "") => {
816
820
  const BankDetails = ({ bannerDetails }) => {
817
821
  const [loginImageURL, setLoginImageURL] = useState(null);
818
822
  const urlObj = useRef(null);
819
- const classes = useStyles$1();
823
+ const classes = useStyles$2();
820
824
  const banner = useMemo(() => bannerDetails, []);
821
825
  useEffect(() => {
822
826
  if (Boolean(banner?.bannerImg)) {
@@ -1208,7 +1212,7 @@ const reducer$1 = (state, action) => {
1208
1212
  }
1209
1213
  };
1210
1214
  const AuthControllerWrapper = ({ bannerDetails, logoUrl, logoTitle, loginFn, veirfyUsernameandPassword, verifyOTP, OTPResendRequest, ResetPassword, LanguageComponent, forgotPasswordEndpoint, }) => {
1211
- const classes = useStyles$1();
1215
+ const classes = useStyles$2();
1212
1216
  const [loginState, dispath] = useReducer(reducer$1, inititalState$1);
1213
1217
  const [openpwdreset, setOpenPwdReset] = useState(false);
1214
1218
  const failureCount = useRef(0);
@@ -1724,7 +1728,7 @@ const reducer = (state, action) => {
1724
1728
  }
1725
1729
  };
1726
1730
  const ForgotPasswordControllerWrapper = ({ screenFlag, updatenewPassword, veirfyUsernameandMobileNo, verifyOTPForPWDReset, logoUrl, logoTitle, LanguageComponent, bannerDetails, navigate, loginPageEndpoint, }) => {
1727
- const classes = useStyles$1();
1731
+ const classes = useStyles$2();
1728
1732
  const [loginState, dispath] = useReducer(reducer, inititalState);
1729
1733
  const [open, setOpen] = useState(false);
1730
1734
  const { enqueueSnackbar } = useSnackbar();
@@ -2048,7 +2052,7 @@ styleInject(css_248z);
2048
2052
 
2049
2053
  var Waving_hand = "waving-hand.png";
2050
2054
 
2051
- const useStyles = makeStyles((theme) => ({
2055
+ const useStyles$1 = makeStyles((theme) => ({
2052
2056
  heading_user_img: {
2053
2057
  width: "40px",
2054
2058
  height: "40px",
@@ -2089,7 +2093,7 @@ const actions = [
2089
2093
  },
2090
2094
  ];
2091
2095
  const BranchSelectionGrid = ({ selectionMode, authState, isBranchSelectedFn, isLoggedInFn, logoutFn, logos, logo, navigate, BranchSelectionGridDataApiFn, GetMenuDataApiFn, sideImage, branchSelectFn, dashboardUrl, loginUrl, appTranCd, }) => {
2092
- const classes = useStyles();
2096
+ const classes = useStyles$1();
2093
2097
  const { enqueueSnackbar } = useSnackbar();
2094
2098
  const { data, isLoading, isFetching, refetch, error, isError } = useQuery(["BranchSelectionGridData"], () => BranchSelectionGridDataApiFn());
2095
2099
  useEffect(() => {
@@ -2264,5 +2268,277 @@ const BranchSelectionGridWrapper = (props) => {
2264
2268
  return (jsx(ClearCacheProvider, { children: jsx(BranchSelectionGrid, { ...props }) }));
2265
2269
  };
2266
2270
 
2267
- export { AuthControllerWrapper, BranchSelectionGridWrapper, ForgotPasswordControllerWrapper, ValidatePassword };
2271
+ const useStyles = makeStyles((theme) => ({
2272
+ appBar: {
2273
+ // zIndex: theme.zIndex.drawer + 1,
2274
+ transition: theme.transitions.create(["width", "margin"], {
2275
+ easing: theme.transitions.easing.sharp,
2276
+ duration: theme.transitions.duration.leavingScreen,
2277
+ }),
2278
+ color: "#0063A3",
2279
+ height: "80px",
2280
+ background: "var(--theme-color2)",
2281
+ boxShadow: "0px 1px 0px -0.5px #DEE0E2",
2282
+ },
2283
+ searchBar: {
2284
+ width: 290,
2285
+ border: "none",
2286
+ color: "rgba(0, 0, 0, 0.87) !important",
2287
+ backgroundColor: "rgb(235 237 238 / 26%)!important",
2288
+ "& input": {
2289
+ width: "100% !important",
2290
+ },
2291
+ },
2292
+ searchList: {
2293
+ position: "absolute",
2294
+ background: "#fff",
2295
+ width: "100%",
2296
+ borderRadius: "6px",
2297
+ boxShadow: "0 12px 25px rgba(0,0,0,.3)",
2298
+ top: "120%",
2299
+ height: "auto",
2300
+ maxHeight: "325px",
2301
+ overflowY: "auto",
2302
+ "& .list-links": {
2303
+ background: "none",
2304
+ border: "none",
2305
+ outline: "none",
2306
+ cursor: "pointer",
2307
+ textDecoration: "none",
2308
+ padding: "0.7rem 1rem",
2309
+ fontSize: "0.90rem",
2310
+ textAlign: "left",
2311
+ borderBottom: "1px solid #ddd",
2312
+ color: "#222 !important",
2313
+ fontWeight: 500,
2314
+ "&:hover, &.active": {
2315
+ backgroundColor: "#f4f4f4",
2316
+ },
2317
+ },
2318
+ },
2319
+ appBarShift: {
2320
+ paddingLeft: "0px",
2321
+ // width: `calc(100% - ${drawerWidth}px)`,
2322
+ transition: theme.transitions.create(["width", "margin"], {
2323
+ easing: theme.transitions.easing.sharp,
2324
+ duration: theme.transitions.duration.enteringScreen,
2325
+ background: "rgba(250, 251, 255, 0.9)",
2326
+ }),
2327
+ },
2328
+ heading_user_dtl: {
2329
+ width: "458px",
2330
+ height: "73px",
2331
+ left: "37px",
2332
+ top: "calc(50% - 73px/2)",
2333
+ },
2334
+ heading_user_img: {
2335
+ width: "40px",
2336
+ height: "40px",
2337
+ // cursor: "pointer",
2338
+ },
2339
+ heading_user_img_border: {
2340
+ border: "2px dashed var(--theme-color3)",
2341
+ borderRadius: "50%",
2342
+ padding: "4px",
2343
+ },
2344
+ toolbar: {
2345
+ minHeight: "80px",
2346
+ paddingLeft: "0px",
2347
+ height: "80px",
2348
+ },
2349
+ title: {
2350
+ flexGrow: 1,
2351
+ padding: theme.spacing(0.5, 0),
2352
+ color: "var(--theme-color1)",
2353
+ },
2354
+ searchRoot: {
2355
+ fontFamily: theme.typography.fontFamily,
2356
+ position: "relative",
2357
+ boxShadow: "0px 2px 4px -1px rgba(0,0,0,0.2), 0px 4px 5px 0px rgba(0,0,0,0.14), 0px 1px 10px 0px rgba(0,0,0,0.12)",
2358
+ marginRight: theme.spacing(2),
2359
+ marginLeft: theme.spacing(1),
2360
+ marginBottom: theme.spacing(0.25),
2361
+ marginTop: theme.spacing(0.25),
2362
+ borderRadius: 40,
2363
+ backgroundColor: alpha(theme.palette.common.white, 0.15),
2364
+ "&:hover": {
2365
+ backgroundColor: alpha(theme.palette.common.white, 0.25),
2366
+ },
2367
+ "& $inputInput": {
2368
+ transition: theme.transitions.create("width"),
2369
+ width: 120,
2370
+ "&:focus": {
2371
+ width: 170,
2372
+ },
2373
+ },
2374
+ },
2375
+ search: {
2376
+ width: theme.spacing(6),
2377
+ height: "100%",
2378
+ position: "absolute",
2379
+ pointerEvents: "none",
2380
+ display: "flex",
2381
+ alignItems: "center",
2382
+ justifyContent: "center",
2383
+ },
2384
+ inputRoot: {
2385
+ color: "inherit",
2386
+ marginTop: 0,
2387
+ borderRadius: "40px",
2388
+ },
2389
+ inputInput: {
2390
+ padding: theme.spacing(1, 1, 1, 6),
2391
+ },
2392
+ loggedInUser: {
2393
+ marginLeft: theme.spacing(2),
2394
+ },
2395
+ nameClass: {
2396
+ color: "#0063A3",
2397
+ fontWeight: 600,
2398
+ textTransform: "capitalize",
2399
+ lineHeight: "1.4",
2400
+ textAlign: "left",
2401
+ },
2402
+ dropDown: {
2403
+ fontSize: "2rem",
2404
+ },
2405
+ vTop: {
2406
+ verticalAlign: "top",
2407
+ paddingLeft: "4px",
2408
+ color: "var(--theme-color1)",
2409
+ },
2410
+ userDesignation: {
2411
+ margin: "0px",
2412
+ fontWeight: 500,
2413
+ fontSize: "0.875rem",
2414
+ lineHeight: 1.57,
2415
+ color: "var(--theme-color1)",
2416
+ },
2417
+ userName: {
2418
+ margin: "0px",
2419
+ fontWeight: 500,
2420
+ fontSize: "0.875rem",
2421
+ lineHeight: 1.57,
2422
+ color: "var(--theme-color3)",
2423
+ },
2424
+ userprofilehover: {
2425
+ "&:hover": {
2426
+ backgroundColor: "var(--theme-color2)",
2427
+ },
2428
+ },
2429
+ lang_svg: {
2430
+ marginRight: "10px",
2431
+ width: "22px",
2432
+ height: "22px",
2433
+ },
2434
+ logo: {
2435
+ height: "38px",
2436
+ },
2437
+ version01: {
2438
+ margin: "0",
2439
+ textAlign: "center",
2440
+ color: "var(--theme-color3)",
2441
+ fontSize: "9px",
2442
+ },
2443
+ DrawerClose_icon: {
2444
+ color: "var(--theme-color3)",
2445
+ position: "static",
2446
+ background: "transperant",
2447
+ "&:hover": {
2448
+ background: "var(--theme-color4)",
2449
+ },
2450
+ width: "46px",
2451
+ height: "46px",
2452
+ },
2453
+ marquee: {
2454
+ animation: "$marquee 10s linear infinite",
2455
+ animationDelay: "3s",
2456
+ },
2457
+ "@keyframes marquee": {
2458
+ "0%": { transform: "translateX(100%)" },
2459
+ "100%": { transform: "translateX(-100%)" },
2460
+ },
2461
+ popover: {
2462
+ popover: {
2463
+ maxWidth: "100%",
2464
+ width: "fit-content",
2465
+ "& .MuiPopover-paper": {
2466
+ maxWidth: "100%",
2467
+ },
2468
+ },
2469
+ },
2470
+ }));
2471
+
2472
+ const AppbarWrapper = ({ handleDrawerOpen, handleDrawerClose, open, authState, LanguageComponent, SearchComponent, dashboardUrl, logos, bankLogo, profilePic, handleLogout, handleProfile, navigate, hideGreetings }) => {
2473
+ const classes = useStyles();
2474
+ const { t } = useTranslation();
2475
+ const LightTooltip = styled(({ className, ...props }) => (jsx(Tooltip, { ...props, classes: { popper: className } })))(({ theme }) => ({
2476
+ [`& .${tooltipClasses.tooltip}`]: {
2477
+ backgroundColor: theme.palette.common.white,
2478
+ color: "rgba(0, 0, 0, 0.87)",
2479
+ boxShadow: theme.shadows[1],
2480
+ fontSize: 13,
2481
+ },
2482
+ }));
2483
+ const Greetings = () => {
2484
+ let hours = new Date().getHours();
2485
+ let greet;
2486
+ if (hours < 12)
2487
+ greet = "morning";
2488
+ else if (hours >= 12 && hours <= 16)
2489
+ greet = "afternoon";
2490
+ else if (hours >= 16 && hours <= 24)
2491
+ greet = "evening";
2492
+ return jsxs("span", { children: ["Good ", greet, ","] });
2493
+ };
2494
+ return (jsx(AppBar, { position: "fixed", elevation: 0, className: clsx(classes.appBar, open && classes.appBarShift), children: jsxs(Toolbar, { className: classes.toolbar, children: [jsxs(Box, { sx: {
2495
+ display: "flex",
2496
+ justifyContent: "space-evenly",
2497
+ alignItems: "center",
2498
+ height: "80px",
2499
+ width: "227px",
2500
+ }, children: [open ? (jsx(IconButton$1, { disableRipple: true, onClick: () => handleDrawerClose(), className: classes.DrawerClose_icon, children: jsx(MenuOutlinedIcon, { fontSize: "large" }) })) : (jsx(IconButton$1, { disableRipple: true, "aria-label": "open drawer", onClick: () => handleDrawerOpen(), className: classes.DrawerClose_icon, children: jsx(MenuOutlinedIcon, { fontSize: "large" }) })), jsxs("div", { children: [jsx("img", { src: Boolean(logos?.logo) ? logos?.logo : bankLogo, alt: "CbsEnfinity", className: classes.logo, onClick: (e) => {
2501
+ e.preventDefault();
2502
+ navigate(dashboardUrl ?? "");
2503
+ } }), jsx("p", { className: classes.version01, children: logos?.version })] })] }), jsx(Stack, { direction: "row", spacing: 4, mx: 2, children: jsx(Box, { className: classes.heading_user_img_border, children: jsx(Avatar, { className: classes.heading_user_img, alt: "Remy Sharp", src: Boolean(logos?.bank) ? logos?.bank : bank_logo_default }) }) }), jsxs(Typography, { component: "h1", variant: "h6", color: "inherit", noWrap: true, className: classes.title, children: [jsx(Box, { style: {
2504
+ marginBottom: "8px",
2505
+ fontSize: "17px",
2506
+ color: "var(--theme-color1)",
2507
+ width: "555px",
2508
+ }, className: clsx({
2509
+ [classes.marquee]: authState?.companyName.length > 55,
2510
+ }), children: authState?.companyName || "" }), jsx("div", { style: { display: "flex", gap: "8px" }, children: jsxs("div", { style: { color: "var(--theme-color6)" }, children: [jsxs(Typography, { variant: "caption", display: "block", lineHeight: 0, fontSize: "11px", children: [t("appBar.Branch"), ":", authState?.user?.branchCode ?? "001 ", "-", authState?.user?.branch ?? ""] }), jsxs(Typography, { variant: "caption", display: "inline", fontSize: "11px", children: [t("appBar.WorkingDate"), ":", " ", Boolean(authState?.workingDate)
2511
+ ? checkDateAndDisplay(format(new Date(authState?.workingDate), "dd/MM/yyyy"))
2512
+ : "not found"] }), jsxs(Typography, { marginLeft: 1, variant: "caption", display: "inline", fontSize: "11px", children: [t("appBar.LastLoginDate"), " :", " ", checkDateAndDisplay(authState?.user?.lastLogin ?? "Vastrapur")] })] }) })] }), jsxs(Box, { children: [hideGreetings ? (jsx(Box, { sx: { marginBottom: "3px", paddingRight: "15px" }, children: jsxs(Stack, { direction: "row", spacing: 2, justifyContent: "flex-end", alignItems: "center", children: [jsxs(Typography, { fontSize: "17px", color: "#1C1C1C", children: [Greetings(), " ", authState?.user?.id ?? ""] }), jsx("img", { src: Waving_hand$1, alt: "", style: { height: "18px" } })] }) })) : null, jsxs(Box, { display: "flex", justifyContent: "space-evenly", alignItems: "center", children: [SearchComponent ? jsx(SearchComponent, {}) : null, LanguageComponent ? jsx(LanguageComponent, {}) : null, jsx(Box, { maxWidth: 170, display: "flex", justifyContent: "end", children: jsx(Tooltip, { title: "Logout", placement: "bottom", arrow: true, children: jsx(IconButton$1, { onClick: () => typeof handleLogout === "function" ? handleLogout() : null, color: "error", sx: {
2513
+ backgroundColor: "rgba(235, 237, 238, 0.45)",
2514
+ borderRadius: "10px",
2515
+ height: "30px",
2516
+ width: "30px",
2517
+ "&:hover": {
2518
+ background: "var(--theme-color2)",
2519
+ borderRadius: "10px",
2520
+ transition: "all 0.2s ease 0s",
2521
+ boxShadow: "rgba(0, 0, 0, 0.16) 0px 3px 6px, rgba(0, 0, 0, 0.23) 0px 3px 6px",
2522
+ "& .MuiSvgIcon-root": {
2523
+ height: "32px",
2524
+ width: "32px",
2525
+ transition: "all 0.2s ease 0s",
2526
+ padding: "4px",
2527
+ },
2528
+ },
2529
+ }, "aria-label": "show 4 new mails", children: jsx(LogoutIcon, {}) }) }) })] })] }), jsx(Stack, { direction: "row", spacing: 4, ml: 1, children: jsx(Box, { className: classes.heading_user_img_border, sx: { cursor: "pointer" }, children: jsx(LightTooltip, { title: jsxs(Fragment$1, { children: [jsxs("div", { children: [" ", t("appBar.UserID"), ": ", authState?.user?.id] }), jsxs("div", { children: [t("appBar.Role"), " : ", authState?.roleName] }), jsxs("div", { children: [t("appBar.LastUnsuccessfulLogin"), " : \"\""] })] }), placement: "bottom-start", children: jsx(Avatar, { className: classes.heading_user_img, onClick: () => typeof handleProfile === "function" ? handleProfile() : null, alt: "Remy Sharp", src: profilePic ?? "" }) }) }) })] }) }));
2530
+ };
2531
+ const checkDateAndDisplay = (dateStr) => {
2532
+ // const dt = new Date(dateStr);
2533
+ // //@ts-ignore
2534
+ // if (dt instanceof Date && !isNaN(dt)) {
2535
+ // return dt.toDateString();
2536
+ // }
2537
+ if (Boolean(dateStr)) {
2538
+ return dateStr;
2539
+ }
2540
+ return "N/A";
2541
+ };
2542
+
2543
+ export { AppbarWrapper, AuthControllerWrapper, BranchSelectionGridWrapper, ForgotPasswordControllerWrapper, ValidatePassword };
2268
2544
  //# sourceMappingURL=index.js.map