@erpsquad/common 1.8.98 → 1.8.100
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/_virtual/index/index.esm10.js +3 -3
- package/dist/_virtual/index/index.esm11.js +3 -3
- package/dist/_virtual/index/index.esm4.js +1 -1
- package/dist/_virtual/index/index.esm5.js +3 -3
- package/dist/_virtual/index/index.esm6.js +3 -3
- package/dist/_virtual/index/index.esm7.js +3 -3
- package/dist/_virtual/index/index.esm8.js +3 -3
- package/dist/_virtual/index/index.esm9.js +3 -3
- package/dist/_virtual/index/index10.js +1 -1
- package/dist/_virtual/index/index11.js +1 -1
- package/dist/_virtual/index/index4.js +1 -1
- package/dist/_virtual/index/index5.js +1 -1
- package/dist/_virtual/index/index6.js +1 -1
- package/dist/_virtual/index/index7.js +1 -1
- package/dist/_virtual/index/index8.js +1 -1
- package/dist/_virtual/index/index9.js +1 -1
- package/dist/api-client/api.hrms/api/index.esm.js +12 -1
- package/dist/api-client/api.hrms/api/index.esm.js.map +1 -1
- package/dist/api-client/api.hrms/api/index.js +1 -1
- package/dist/api-client/api.hrms/api/index.js.map +1 -1
- package/dist/api-client/api.inventory/api/index.esm.js +30 -95
- package/dist/api-client/api.inventory/api/index.esm.js.map +1 -1
- package/dist/api-client/api.inventory/api/index.js +1 -1
- package/dist/api-client/api.inventory/api/index.js.map +1 -1
- package/dist/api-client/api.inventory/api-types.d.ts +425 -930
- package/dist/api-client/api.inventory/api.d.ts +10 -14
- package/dist/api-client/api.rbac/api/index.esm2.js +0 -218
- package/dist/api-client/api.rbac/api/index.esm2.js.map +1 -1
- package/dist/api-client/api.rbac/api/index2.js +1 -1
- package/dist/api-client/api.rbac/api/index2.js.map +1 -1
- package/dist/components/action-bar/action-bar/index.esm.js +1 -2
- package/dist/components/action-bar/action-bar/index.esm.js.map +1 -1
- package/dist/components/action-bar/action-bar/index.js +5 -5
- package/dist/components/action-bar/action-bar/index.js.map +1 -1
- package/dist/components/editor/custom-editor/index.esm.js +3 -1
- package/dist/components/editor/custom-editor/index.esm.js.map +1 -1
- package/dist/components/editor/custom-editor/index.js +2 -2
- package/dist/components/editor/custom-editor/index.js.map +1 -1
- package/dist/components/filter/components/delete-group/index.esm.js +0 -1
- package/dist/components/filter/components/delete-group/index.esm.js.map +1 -1
- package/dist/components/filter/components/delete-group/index.js +1 -1
- package/dist/components/filter/components/delete-group/index.js.map +1 -1
- package/dist/components/filter/filter/index.esm.js +1 -2
- package/dist/components/filter/filter/index.esm.js.map +1 -1
- package/dist/components/filter/filter/index.js +12 -12
- package/dist/components/filter/filter/index.js.map +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.esm.js +5 -3
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.esm.js.map +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.js +6 -6
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.js.map +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-select.d.ts +1 -0
- package/dist/components/header/header/index.esm.js +3 -1
- package/dist/components/header/header/index.esm.js.map +1 -1
- package/dist/components/header/header/index.js +21 -21
- package/dist/components/header/header/index.js.map +1 -1
- package/dist/components/header/redux/actionCreator/index.esm.js +2 -1
- package/dist/components/header/redux/actionCreator/index.esm.js.map +1 -1
- package/dist/components/header/redux/actionCreator/index.js +1 -1
- package/dist/components/header/redux/actionCreator/index.js.map +1 -1
- package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.esm.js +1 -2
- package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.esm.js.map +1 -1
- package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.js +1 -1
- package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.js.map +1 -1
- package/dist/components/material-table/components/inline-edit-fields/index.esm.js.map +1 -1
- package/dist/components/material-table/components/inline-edit-fields/index.js.map +1 -1
- package/dist/components/providers/ERPUIProvider/index.esm.js +15 -1
- package/dist/components/providers/ERPUIProvider/index.esm.js.map +1 -1
- package/dist/components/providers/ERPUIProvider/index.js +1 -1
- package/dist/components/providers/ERPUIProvider/index.js.map +1 -1
- package/dist/components/providers/ERPUIProvider.d.ts +2 -0
- package/dist/components/reports-title-bar/redux/actionCreator/index.esm.js +1 -2
- package/dist/components/reports-title-bar/redux/actionCreator/index.esm.js.map +1 -1
- package/dist/components/reports-title-bar/redux/actionCreator/index.js +1 -1
- package/dist/components/reports-title-bar/redux/actionCreator/index.js.map +1 -1
- package/dist/components/share-modal/redux/actionCreator/index.esm.js +2 -1
- package/dist/components/share-modal/redux/actionCreator/index.esm.js.map +1 -1
- package/dist/components/share-modal/redux/actionCreator/index.js +1 -1
- package/dist/components/share-modal/redux/actionCreator/index.js.map +1 -1
- package/dist/components/uom-field-wrapper/uom-field-wrapper/index.esm.js +1 -1
- package/dist/components/uom-field-wrapper/uom-field-wrapper/index.esm.js.map +1 -1
- package/dist/components/uom-field-wrapper/uom-field-wrapper/index.js +1 -1
- package/dist/components/uom-field-wrapper/uom-field-wrapper/index.js.map +1 -1
- package/dist/components/upload/upload/index.esm.js +3 -2
- package/dist/components/upload/upload/index.esm.js.map +1 -1
- package/dist/components/upload/upload/index.js +29 -29
- package/dist/components/upload/upload/index.js.map +1 -1
- package/dist/constants/defaultColumns/index.esm.js +1 -1
- package/dist/constants/defaultColumns/index.esm.js.map +1 -1
- package/dist/constants/defaultColumns/index.js +1 -1
- package/dist/constants/defaultColumns/index.js.map +1 -1
- package/dist/contexts/AuthContext/index.esm.js +4 -3
- package/dist/contexts/AuthContext/index.esm.js.map +1 -1
- package/dist/contexts/AuthContext/index.js +2 -2
- package/dist/contexts/AuthContext/index.js.map +1 -1
- package/dist/contexts/languageContext/index.esm.js +2 -1
- package/dist/contexts/languageContext/index.esm.js.map +1 -1
- package/dist/contexts/languageContext/index.js +2 -2
- package/dist/contexts/languageContext/index.js.map +1 -1
- package/dist/hooks/use-material-calculations/index.esm.js +1 -2
- package/dist/hooks/use-material-calculations/index.esm.js.map +1 -1
- package/dist/hooks/use-material-calculations/index.js +1 -1
- package/dist/hooks/use-material-calculations/index.js.map +1 -1
- package/dist/hooks/useLangauge/index.esm.js +1 -2
- package/dist/hooks/useLangauge/index.esm.js.map +1 -1
- package/dist/hooks/useLangauge/index.js +1 -1
- package/dist/hooks/useLangauge/index.js.map +1 -1
- package/dist/index.esm.js +9 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/node_modules/@hookform/resolvers/yup/dist/yup/index.esm.js +14 -15
- package/dist/node_modules/@hookform/resolvers/yup/dist/yup/index.esm.js.map +1 -1
- package/dist/node_modules/@hookform/resolvers/yup/dist/yup/index.js +1 -1
- package/dist/node_modules/@hookform/resolvers/yup/dist/yup/index.js.map +1 -1
- package/dist/node_modules/@mui/base/TextareaAutosize/TextareaAutosize/index.esm.js +2 -3
- package/dist/node_modules/@mui/base/TextareaAutosize/TextareaAutosize/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/base/TextareaAutosize/TextareaAutosize/index.js +1 -1
- package/dist/node_modules/@mui/base/TextareaAutosize/TextareaAutosize/index.js.map +1 -1
- package/dist/node_modules/@mui/lab/TabContext/TabContext/index.esm.js +2 -3
- package/dist/node_modules/@mui/lab/TabContext/TabContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/lab/TabContext/TabContext/index.js +2 -2
- package/dist/node_modules/@mui/lab/TabContext/TabContext/index.js.map +1 -1
- package/dist/node_modules/@mui/lab/TabList/TabList/index.esm.js +1 -2
- package/dist/node_modules/@mui/lab/TabList/TabList/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/lab/TabList/TabList/index.js +1 -1
- package/dist/node_modules/@mui/lab/TabList/TabList/index.js.map +1 -1
- package/dist/node_modules/@mui/lab/TabPanel/TabPanel/index.esm.js +1 -2
- package/dist/node_modules/@mui/lab/TabPanel/TabPanel/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/lab/TabPanel/TabPanel/index.js +2 -2
- package/dist/node_modules/@mui/lab/TabPanel/TabPanel/index.js.map +1 -1
- package/dist/node_modules/@mui/lab/Timeline/Timeline/index.esm.js +1 -2
- package/dist/node_modules/@mui/lab/Timeline/Timeline/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/lab/Timeline/Timeline/index.js +2 -2
- package/dist/node_modules/@mui/lab/Timeline/Timeline/index.js.map +1 -1
- package/dist/node_modules/@mui/lab/Timeline/TimelineContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/lab/Timeline/TimelineContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/lab/Timeline/TimelineContext/index.js +1 -1
- package/dist/node_modules/@mui/lab/Timeline/TimelineContext/index.js.map +1 -1
- package/dist/node_modules/@mui/lab/TimelineConnector/TimelineConnector/index.esm.js +1 -2
- package/dist/node_modules/@mui/lab/TimelineConnector/TimelineConnector/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/lab/TimelineConnector/TimelineConnector/index.js +2 -2
- package/dist/node_modules/@mui/lab/TimelineConnector/TimelineConnector/index.js.map +1 -1
- package/dist/node_modules/@mui/lab/TimelineContent/TimelineContent/index.esm.js +1 -2
- package/dist/node_modules/@mui/lab/TimelineContent/TimelineContent/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/lab/TimelineContent/TimelineContent/index.js +1 -1
- package/dist/node_modules/@mui/lab/TimelineContent/TimelineContent/index.js.map +1 -1
- package/dist/node_modules/@mui/lab/TimelineDot/TimelineDot/index.esm.js +1 -2
- package/dist/node_modules/@mui/lab/TimelineDot/TimelineDot/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/lab/TimelineDot/TimelineDot/index.js +2 -2
- package/dist/node_modules/@mui/lab/TimelineDot/TimelineDot/index.js.map +1 -1
- package/dist/node_modules/@mui/lab/TimelineItem/TimelineItem/index.esm.js +1 -2
- package/dist/node_modules/@mui/lab/TimelineItem/TimelineItem/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/lab/TimelineItem/TimelineItem/index.js +2 -2
- package/dist/node_modules/@mui/lab/TimelineItem/TimelineItem/index.js.map +1 -1
- package/dist/node_modules/@mui/lab/TimelineSeparator/TimelineSeparator/index.esm.js +1 -2
- package/dist/node_modules/@mui/lab/TimelineSeparator/TimelineSeparator/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/lab/TimelineSeparator/TimelineSeparator/index.js +2 -2
- package/dist/node_modules/@mui/lab/TimelineSeparator/TimelineSeparator/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Accordion/Accordion/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Accordion/Accordion/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Accordion/Accordion/index.js +2 -2
- package/dist/node_modules/@mui/material/Accordion/Accordion/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Accordion/AccordionContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Accordion/AccordionContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Accordion/AccordionContext/index.js +1 -1
- package/dist/node_modules/@mui/material/Accordion/AccordionContext/index.js.map +1 -1
- package/dist/node_modules/@mui/material/AccordionActions/AccordionActions/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/AccordionActions/AccordionActions/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/AccordionActions/AccordionActions/index.js +1 -1
- package/dist/node_modules/@mui/material/AccordionActions/AccordionActions/index.js.map +1 -1
- package/dist/node_modules/@mui/material/AccordionDetails/AccordionDetails/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/AccordionDetails/AccordionDetails/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/AccordionDetails/AccordionDetails/index.js +2 -2
- package/dist/node_modules/@mui/material/AccordionDetails/AccordionDetails/index.js.map +1 -1
- package/dist/node_modules/@mui/material/AccordionSummary/AccordionSummary/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/AccordionSummary/AccordionSummary/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/AccordionSummary/AccordionSummary/index.js +2 -2
- package/dist/node_modules/@mui/material/AccordionSummary/AccordionSummary/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Alert/Alert/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Alert/Alert/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Alert/Alert/index.js +1 -1
- package/dist/node_modules/@mui/material/Alert/Alert/index.js.map +1 -1
- package/dist/node_modules/@mui/material/AlertTitle/AlertTitle/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/AlertTitle/AlertTitle/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/AlertTitle/AlertTitle/index.js +1 -1
- package/dist/node_modules/@mui/material/AlertTitle/AlertTitle/index.js.map +1 -1
- package/dist/node_modules/@mui/material/AppBar/AppBar/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/AppBar/AppBar/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/AppBar/AppBar/index.js +1 -1
- package/dist/node_modules/@mui/material/AppBar/AppBar/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Autocomplete/Autocomplete/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Autocomplete/Autocomplete/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Autocomplete/Autocomplete/index.js +1 -1
- package/dist/node_modules/@mui/material/Autocomplete/Autocomplete/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Avatar/Avatar/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Avatar/Avatar/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Avatar/Avatar/index.js +1 -1
- package/dist/node_modules/@mui/material/Avatar/Avatar/index.js.map +1 -1
- package/dist/node_modules/@mui/material/AvatarGroup/AvatarGroup/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/AvatarGroup/AvatarGroup/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/AvatarGroup/AvatarGroup/index.js +2 -2
- package/dist/node_modules/@mui/material/AvatarGroup/AvatarGroup/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Backdrop/Backdrop/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Backdrop/Backdrop/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Backdrop/Backdrop/index.js +1 -1
- package/dist/node_modules/@mui/material/Backdrop/Backdrop/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Badge/Badge/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Badge/Badge/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Badge/Badge/index.js +1 -1
- package/dist/node_modules/@mui/material/Badge/Badge/index.js.map +1 -1
- package/dist/node_modules/@mui/material/BottomNavigation/BottomNavigation/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/BottomNavigation/BottomNavigation/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/BottomNavigation/BottomNavigation/index.js +3 -3
- package/dist/node_modules/@mui/material/BottomNavigation/BottomNavigation/index.js.map +1 -1
- package/dist/node_modules/@mui/material/BottomNavigationAction/BottomNavigationAction/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/BottomNavigationAction/BottomNavigationAction/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/BottomNavigationAction/BottomNavigationAction/index.js +2 -2
- package/dist/node_modules/@mui/material/BottomNavigationAction/BottomNavigationAction/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Box/Box/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Box/Box/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Box/Box/index.js +1 -1
- package/dist/node_modules/@mui/material/Box/Box/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Breadcrumbs/BreadcrumbCollapsed/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Breadcrumbs/BreadcrumbCollapsed/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Breadcrumbs/BreadcrumbCollapsed/index.js +2 -2
- package/dist/node_modules/@mui/material/Breadcrumbs/BreadcrumbCollapsed/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Breadcrumbs/Breadcrumbs/index.esm.js +3 -4
- package/dist/node_modules/@mui/material/Breadcrumbs/Breadcrumbs/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Breadcrumbs/Breadcrumbs/index.js +2 -2
- package/dist/node_modules/@mui/material/Breadcrumbs/Breadcrumbs/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Button/Button/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Button/Button/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Button/Button/index.js +1 -1
- package/dist/node_modules/@mui/material/Button/Button/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ButtonBase/ButtonBase/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/ButtonBase/ButtonBase/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ButtonBase/ButtonBase/index.js +3 -3
- package/dist/node_modules/@mui/material/ButtonBase/ButtonBase/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ButtonBase/Ripple/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ButtonBase/Ripple/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ButtonBase/Ripple/index.js +1 -1
- package/dist/node_modules/@mui/material/ButtonBase/Ripple/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ButtonBase/TouchRipple/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ButtonBase/TouchRipple/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ButtonBase/TouchRipple/index.js +1 -1
- package/dist/node_modules/@mui/material/ButtonBase/TouchRipple/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroup/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroup/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroup/index.js +1 -1
- package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroup/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupButtonContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupButtonContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupButtonContext/index.js +1 -1
- package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupButtonContext/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupContext/index.js +1 -1
- package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupContext/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Card/Card/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Card/Card/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Card/Card/index.js +1 -1
- package/dist/node_modules/@mui/material/Card/Card/index.js.map +1 -1
- package/dist/node_modules/@mui/material/CardActionArea/CardActionArea/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/CardActionArea/CardActionArea/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/CardActionArea/CardActionArea/index.js +2 -2
- package/dist/node_modules/@mui/material/CardActionArea/CardActionArea/index.js.map +1 -1
- package/dist/node_modules/@mui/material/CardActions/CardActions/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/CardActions/CardActions/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/CardActions/CardActions/index.js +2 -2
- package/dist/node_modules/@mui/material/CardActions/CardActions/index.js.map +1 -1
- package/dist/node_modules/@mui/material/CardContent/CardContent/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/CardContent/CardContent/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/CardContent/CardContent/index.js +1 -1
- package/dist/node_modules/@mui/material/CardContent/CardContent/index.js.map +1 -1
- package/dist/node_modules/@mui/material/CardHeader/CardHeader/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/CardHeader/CardHeader/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/CardHeader/CardHeader/index.js +1 -1
- package/dist/node_modules/@mui/material/CardHeader/CardHeader/index.js.map +1 -1
- package/dist/node_modules/@mui/material/CardMedia/CardMedia/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/CardMedia/CardMedia/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/CardMedia/CardMedia/index.js +2 -2
- package/dist/node_modules/@mui/material/CardMedia/CardMedia/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Checkbox/Checkbox/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Checkbox/Checkbox/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Checkbox/Checkbox/index.js +1 -1
- package/dist/node_modules/@mui/material/Checkbox/Checkbox/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Chip/Chip/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/Chip/Chip/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Chip/Chip/index.js +1 -1
- package/dist/node_modules/@mui/material/Chip/Chip/index.js.map +1 -1
- package/dist/node_modules/@mui/material/CircularProgress/CircularProgress/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/CircularProgress/CircularProgress/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/CircularProgress/CircularProgress/index.js +6 -6
- package/dist/node_modules/@mui/material/CircularProgress/CircularProgress/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ClickAwayListener/ClickAwayListener/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/ClickAwayListener/ClickAwayListener/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ClickAwayListener/ClickAwayListener/index.js +1 -1
- package/dist/node_modules/@mui/material/ClickAwayListener/ClickAwayListener/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Collapse/Collapse/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Collapse/Collapse/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Collapse/Collapse/index.js +1 -1
- package/dist/node_modules/@mui/material/Collapse/Collapse/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Container/Container/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Container/Container/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Container/Container/index.js +1 -1
- package/dist/node_modules/@mui/material/Container/Container/index.js.map +1 -1
- package/dist/node_modules/@mui/material/CssBaseline/CssBaseline/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/CssBaseline/CssBaseline/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/CssBaseline/CssBaseline/index.js +2 -2
- package/dist/node_modules/@mui/material/CssBaseline/CssBaseline/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Dialog/Dialog/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Dialog/Dialog/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Dialog/Dialog/index.js +1 -1
- package/dist/node_modules/@mui/material/Dialog/Dialog/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Dialog/DialogContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Dialog/DialogContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Dialog/DialogContext/index.js +1 -1
- package/dist/node_modules/@mui/material/Dialog/DialogContext/index.js.map +1 -1
- package/dist/node_modules/@mui/material/DialogActions/DialogActions/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/DialogActions/DialogActions/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/DialogActions/DialogActions/index.js +1 -1
- package/dist/node_modules/@mui/material/DialogActions/DialogActions/index.js.map +1 -1
- package/dist/node_modules/@mui/material/DialogContent/DialogContent/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/DialogContent/DialogContent/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/DialogContent/DialogContent/index.js +2 -2
- package/dist/node_modules/@mui/material/DialogContent/DialogContent/index.js.map +1 -1
- package/dist/node_modules/@mui/material/DialogContentText/DialogContentText/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/DialogContentText/DialogContentText/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/DialogContentText/DialogContentText/index.js +1 -1
- package/dist/node_modules/@mui/material/DialogContentText/DialogContentText/index.js.map +1 -1
- package/dist/node_modules/@mui/material/DialogTitle/DialogTitle/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/DialogTitle/DialogTitle/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/DialogTitle/DialogTitle/index.js +1 -1
- package/dist/node_modules/@mui/material/DialogTitle/DialogTitle/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Divider/Divider/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Divider/Divider/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Divider/Divider/index.js +1 -1
- package/dist/node_modules/@mui/material/Divider/Divider/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Drawer/Drawer/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Drawer/Drawer/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Drawer/Drawer/index.js +1 -1
- package/dist/node_modules/@mui/material/Drawer/Drawer/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Fab/Fab/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Fab/Fab/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Fab/Fab/index.js +2 -2
- package/dist/node_modules/@mui/material/Fab/Fab/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Fade/Fade/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Fade/Fade/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Fade/Fade/index.js +1 -1
- package/dist/node_modules/@mui/material/Fade/Fade/index.js.map +1 -1
- package/dist/node_modules/@mui/material/FilledInput/FilledInput/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/FilledInput/FilledInput/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/FilledInput/FilledInput/index.js +1 -1
- package/dist/node_modules/@mui/material/FilledInput/FilledInput/index.js.map +1 -1
- package/dist/node_modules/@mui/material/FormControl/FormControl/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/FormControl/FormControl/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/FormControl/FormControl/index.js +2 -2
- package/dist/node_modules/@mui/material/FormControl/FormControl/index.js.map +1 -1
- package/dist/node_modules/@mui/material/FormControl/FormControlContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/FormControl/FormControlContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/FormControl/FormControlContext/index.js +1 -1
- package/dist/node_modules/@mui/material/FormControl/FormControlContext/index.js.map +1 -1
- package/dist/node_modules/@mui/material/FormControlLabel/FormControlLabel/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/FormControlLabel/FormControlLabel/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/FormControlLabel/FormControlLabel/index.js +1 -1
- package/dist/node_modules/@mui/material/FormControlLabel/FormControlLabel/index.js.map +1 -1
- package/dist/node_modules/@mui/material/FormGroup/FormGroup/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/FormGroup/FormGroup/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/FormGroup/FormGroup/index.js +1 -1
- package/dist/node_modules/@mui/material/FormGroup/FormGroup/index.js.map +1 -1
- package/dist/node_modules/@mui/material/FormHelperText/FormHelperText/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/FormHelperText/FormHelperText/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/FormHelperText/FormHelperText/index.js +2 -2
- package/dist/node_modules/@mui/material/FormHelperText/FormHelperText/index.js.map +1 -1
- package/dist/node_modules/@mui/material/FormLabel/FormLabel/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/FormLabel/FormLabel/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/FormLabel/FormLabel/index.js +1 -1
- package/dist/node_modules/@mui/material/FormLabel/FormLabel/index.js.map +1 -1
- package/dist/node_modules/@mui/material/GlobalStyles/GlobalStyles/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/GlobalStyles/GlobalStyles/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/GlobalStyles/GlobalStyles/index.js +2 -2
- package/dist/node_modules/@mui/material/GlobalStyles/GlobalStyles/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Grid/Grid/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/Grid/Grid/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Grid/Grid/index.js +2 -2
- package/dist/node_modules/@mui/material/Grid/Grid/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Grid/GridContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Grid/GridContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Grid/GridContext/index.js +1 -1
- package/dist/node_modules/@mui/material/Grid/GridContext/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Grow/Grow/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Grow/Grow/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Grow/Grow/index.js +2 -2
- package/dist/node_modules/@mui/material/Grow/Grow/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Hidden/Hidden/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Hidden/Hidden/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Hidden/Hidden/index.js +1 -1
- package/dist/node_modules/@mui/material/Hidden/Hidden/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Hidden/HiddenCss/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/Hidden/HiddenCss/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Hidden/HiddenCss/index.js +2 -2
- package/dist/node_modules/@mui/material/Hidden/HiddenCss/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Hidden/HiddenJs/index.esm.js +3 -4
- package/dist/node_modules/@mui/material/Hidden/HiddenJs/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Hidden/HiddenJs/index.js +1 -1
- package/dist/node_modules/@mui/material/Hidden/HiddenJs/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Hidden/withWidth/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/Hidden/withWidth/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Hidden/withWidth/index.js +1 -1
- package/dist/node_modules/@mui/material/Hidden/withWidth/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Icon/Icon/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Icon/Icon/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Icon/Icon/index.js +2 -2
- package/dist/node_modules/@mui/material/Icon/Icon/index.js.map +1 -1
- package/dist/node_modules/@mui/material/IconButton/IconButton/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/IconButton/IconButton/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/IconButton/IconButton/index.js +1 -1
- package/dist/node_modules/@mui/material/IconButton/IconButton/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ImageList/ImageList/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/ImageList/ImageList/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ImageList/ImageList/index.js +2 -2
- package/dist/node_modules/@mui/material/ImageList/ImageList/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ImageList/ImageListContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ImageList/ImageListContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ImageList/ImageListContext/index.js +1 -1
- package/dist/node_modules/@mui/material/ImageList/ImageListContext/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ImageListItem/ImageListItem/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/ImageListItem/ImageListItem/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ImageListItem/ImageListItem/index.js +2 -2
- package/dist/node_modules/@mui/material/ImageListItem/ImageListItem/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ImageListItemBar/ImageListItemBar/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ImageListItemBar/ImageListItemBar/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ImageListItemBar/ImageListItemBar/index.js +1 -1
- package/dist/node_modules/@mui/material/ImageListItemBar/ImageListItemBar/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Input/Input/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Input/Input/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Input/Input/index.js +2 -2
- package/dist/node_modules/@mui/material/Input/Input/index.js.map +1 -1
- package/dist/node_modules/@mui/material/InputAdornment/InputAdornment/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/InputAdornment/InputAdornment/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/InputAdornment/InputAdornment/index.js +2 -2
- package/dist/node_modules/@mui/material/InputAdornment/InputAdornment/index.js.map +1 -1
- package/dist/node_modules/@mui/material/InputBase/InputBase/index.esm.js +5 -6
- package/dist/node_modules/@mui/material/InputBase/InputBase/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/InputBase/InputBase/index.js +1 -1
- package/dist/node_modules/@mui/material/InputBase/InputBase/index.js.map +1 -1
- package/dist/node_modules/@mui/material/InputLabel/InputLabel/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/InputLabel/InputLabel/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/InputLabel/InputLabel/index.js +1 -1
- package/dist/node_modules/@mui/material/InputLabel/InputLabel/index.js.map +1 -1
- package/dist/node_modules/@mui/material/LinearProgress/LinearProgress/index.esm.js +3 -4
- package/dist/node_modules/@mui/material/LinearProgress/LinearProgress/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/LinearProgress/LinearProgress/index.js +5 -5
- package/dist/node_modules/@mui/material/LinearProgress/LinearProgress/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Link/Link/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Link/Link/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Link/Link/index.js +1 -1
- package/dist/node_modules/@mui/material/Link/Link/index.js.map +1 -1
- package/dist/node_modules/@mui/material/List/List/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/List/List/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/List/List/index.js +2 -2
- package/dist/node_modules/@mui/material/List/List/index.js.map +1 -1
- package/dist/node_modules/@mui/material/List/ListContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/List/ListContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/List/ListContext/index.js +1 -1
- package/dist/node_modules/@mui/material/List/ListContext/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ListItem/ListItem/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/ListItem/ListItem/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ListItem/ListItem/index.js +1 -1
- package/dist/node_modules/@mui/material/ListItem/ListItem/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ListItemAvatar/ListItemAvatar/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ListItemAvatar/ListItemAvatar/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ListItemAvatar/ListItemAvatar/index.js +1 -1
- package/dist/node_modules/@mui/material/ListItemAvatar/ListItemAvatar/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ListItemButton/ListItemButton/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/ListItemButton/ListItemButton/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ListItemButton/ListItemButton/index.js +2 -2
- package/dist/node_modules/@mui/material/ListItemButton/ListItemButton/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ListItemIcon/ListItemIcon/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ListItemIcon/ListItemIcon/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ListItemIcon/ListItemIcon/index.js +2 -2
- package/dist/node_modules/@mui/material/ListItemIcon/ListItemIcon/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ListItemSecondaryAction/ListItemSecondaryAction/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ListItemSecondaryAction/ListItemSecondaryAction/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ListItemSecondaryAction/ListItemSecondaryAction/index.js +2 -2
- package/dist/node_modules/@mui/material/ListItemSecondaryAction/ListItemSecondaryAction/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ListItemText/ListItemText/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ListItemText/ListItemText/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ListItemText/ListItemText/index.js +1 -1
- package/dist/node_modules/@mui/material/ListItemText/ListItemText/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ListSubheader/ListSubheader/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ListSubheader/ListSubheader/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ListSubheader/ListSubheader/index.js +2 -2
- package/dist/node_modules/@mui/material/ListSubheader/ListSubheader/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Menu/Menu/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/Menu/Menu/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Menu/Menu/index.js +2 -2
- package/dist/node_modules/@mui/material/Menu/Menu/index.js.map +1 -1
- package/dist/node_modules/@mui/material/MenuItem/MenuItem/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/MenuItem/MenuItem/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/MenuItem/MenuItem/index.js +1 -1
- package/dist/node_modules/@mui/material/MenuItem/MenuItem/index.js.map +1 -1
- package/dist/node_modules/@mui/material/MenuList/MenuList/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/MenuList/MenuList/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/MenuList/MenuList/index.js +2 -2
- package/dist/node_modules/@mui/material/MenuList/MenuList/index.js.map +1 -1
- package/dist/node_modules/@mui/material/MobileStepper/MobileStepper/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/MobileStepper/MobileStepper/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/MobileStepper/MobileStepper/index.js +1 -1
- package/dist/node_modules/@mui/material/MobileStepper/MobileStepper/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Modal/Modal/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Modal/Modal/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Modal/Modal/index.js +1 -1
- package/dist/node_modules/@mui/material/Modal/Modal/index.js.map +1 -1
- package/dist/node_modules/@mui/material/NativeSelect/NativeSelect/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/NativeSelect/NativeSelect/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/NativeSelect/NativeSelect/index.js +2 -2
- package/dist/node_modules/@mui/material/NativeSelect/NativeSelect/index.js.map +1 -1
- package/dist/node_modules/@mui/material/NativeSelect/NativeSelectInput/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/NativeSelect/NativeSelectInput/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/NativeSelect/NativeSelectInput/index.js +1 -1
- package/dist/node_modules/@mui/material/NativeSelect/NativeSelectInput/index.js.map +1 -1
- package/dist/node_modules/@mui/material/NoSsr/NoSsr/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/NoSsr/NoSsr/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/NoSsr/NoSsr/index.js +1 -1
- package/dist/node_modules/@mui/material/NoSsr/NoSsr/index.js.map +1 -1
- package/dist/node_modules/@mui/material/OutlinedInput/NotchedOutline/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/OutlinedInput/NotchedOutline/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/OutlinedInput/NotchedOutline/index.js +1 -1
- package/dist/node_modules/@mui/material/OutlinedInput/NotchedOutline/index.js.map +1 -1
- package/dist/node_modules/@mui/material/OutlinedInput/OutlinedInput/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/OutlinedInput/OutlinedInput/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/OutlinedInput/OutlinedInput/index.js +2 -2
- package/dist/node_modules/@mui/material/OutlinedInput/OutlinedInput/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Pagination/Pagination/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Pagination/Pagination/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Pagination/Pagination/index.js +1 -1
- package/dist/node_modules/@mui/material/Pagination/Pagination/index.js.map +1 -1
- package/dist/node_modules/@mui/material/PaginationItem/PaginationItem/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/PaginationItem/PaginationItem/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/PaginationItem/PaginationItem/index.js +1 -1
- package/dist/node_modules/@mui/material/PaginationItem/PaginationItem/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Paper/Paper/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/Paper/Paper/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Paper/Paper/index.js +1 -1
- package/dist/node_modules/@mui/material/Paper/Paper/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Popover/Popover/index.esm.js +6 -7
- package/dist/node_modules/@mui/material/Popover/Popover/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Popover/Popover/index.js +2 -2
- package/dist/node_modules/@mui/material/Popover/Popover/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Popper/BasePopper/index.esm.js +4 -5
- package/dist/node_modules/@mui/material/Popper/BasePopper/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Popper/BasePopper/index.js +3 -3
- package/dist/node_modules/@mui/material/Popper/BasePopper/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Popper/Popper/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Popper/Popper/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Popper/Popper/index.js +1 -1
- package/dist/node_modules/@mui/material/Popper/Popper/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Portal/Portal/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/Portal/Portal/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Portal/Portal/index.js +4 -4
- package/dist/node_modules/@mui/material/Portal/Portal/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Radio/Radio/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Radio/Radio/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Radio/Radio/index.js +1 -1
- package/dist/node_modules/@mui/material/Radio/Radio/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Radio/RadioButtonIcon/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Radio/RadioButtonIcon/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Radio/RadioButtonIcon/index.js +2 -2
- package/dist/node_modules/@mui/material/Radio/RadioButtonIcon/index.js.map +1 -1
- package/dist/node_modules/@mui/material/RadioGroup/RadioGroup/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/RadioGroup/RadioGroup/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/RadioGroup/RadioGroup/index.js +2 -2
- package/dist/node_modules/@mui/material/RadioGroup/RadioGroup/index.js.map +1 -1
- package/dist/node_modules/@mui/material/RadioGroup/RadioGroupContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/RadioGroup/RadioGroupContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/RadioGroup/RadioGroupContext/index.js +1 -1
- package/dist/node_modules/@mui/material/RadioGroup/RadioGroupContext/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Rating/Rating/index.esm.js +3 -4
- package/dist/node_modules/@mui/material/Rating/Rating/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Rating/Rating/index.js +6 -6
- package/dist/node_modules/@mui/material/Rating/Rating/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ScopedCssBaseline/ScopedCssBaseline/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ScopedCssBaseline/ScopedCssBaseline/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ScopedCssBaseline/ScopedCssBaseline/index.js +2 -2
- package/dist/node_modules/@mui/material/ScopedCssBaseline/ScopedCssBaseline/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Select/Select/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Select/Select/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Select/Select/index.js +1 -1
- package/dist/node_modules/@mui/material/Select/Select/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Select/SelectInput/index.esm.js +4 -5
- package/dist/node_modules/@mui/material/Select/SelectInput/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Select/SelectInput/index.js +2 -2
- package/dist/node_modules/@mui/material/Select/SelectInput/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Skeleton/Skeleton/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Skeleton/Skeleton/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Skeleton/Skeleton/index.js +1 -1
- package/dist/node_modules/@mui/material/Skeleton/Skeleton/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Slide/Slide/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/Slide/Slide/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Slide/Slide/index.js +1 -1
- package/dist/node_modules/@mui/material/Slide/Slide/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Slider/Slider/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Slider/Slider/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Slider/Slider/index.js +1 -1
- package/dist/node_modules/@mui/material/Slider/Slider/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Slider/SliderValueLabel/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Slider/SliderValueLabel/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Slider/SliderValueLabel/index.js +1 -1
- package/dist/node_modules/@mui/material/Slider/SliderValueLabel/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Snackbar/Snackbar/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Snackbar/Snackbar/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Snackbar/Snackbar/index.js +1 -1
- package/dist/node_modules/@mui/material/Snackbar/Snackbar/index.js.map +1 -1
- package/dist/node_modules/@mui/material/SnackbarContent/SnackbarContent/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/SnackbarContent/SnackbarContent/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/SnackbarContent/SnackbarContent/index.js +1 -1
- package/dist/node_modules/@mui/material/SnackbarContent/SnackbarContent/index.js.map +1 -1
- package/dist/node_modules/@mui/material/SpeedDial/SpeedDial/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/SpeedDial/SpeedDial/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/SpeedDial/SpeedDial/index.js +3 -3
- package/dist/node_modules/@mui/material/SpeedDial/SpeedDial/index.js.map +1 -1
- package/dist/node_modules/@mui/material/SpeedDialAction/SpeedDialAction/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/SpeedDialAction/SpeedDialAction/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/SpeedDialAction/SpeedDialAction/index.js +1 -1
- package/dist/node_modules/@mui/material/SpeedDialAction/SpeedDialAction/index.js.map +1 -1
- package/dist/node_modules/@mui/material/SpeedDialIcon/SpeedDialIcon/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/SpeedDialIcon/SpeedDialIcon/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/SpeedDialIcon/SpeedDialIcon/index.js +2 -2
- package/dist/node_modules/@mui/material/SpeedDialIcon/SpeedDialIcon/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Stack/Stack/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Stack/Stack/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Stack/Stack/index.js +1 -1
- package/dist/node_modules/@mui/material/Stack/Stack/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Step/Step/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Step/Step/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Step/Step/index.js +1 -1
- package/dist/node_modules/@mui/material/Step/Step/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Step/StepContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Step/StepContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Step/StepContext/index.js +1 -1
- package/dist/node_modules/@mui/material/Step/StepContext/index.js.map +1 -1
- package/dist/node_modules/@mui/material/StepButton/StepButton/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/StepButton/StepButton/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/StepButton/StepButton/index.js +1 -1
- package/dist/node_modules/@mui/material/StepButton/StepButton/index.js.map +1 -1
- package/dist/node_modules/@mui/material/StepConnector/StepConnector/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/StepConnector/StepConnector/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/StepConnector/StepConnector/index.js +1 -1
- package/dist/node_modules/@mui/material/StepConnector/StepConnector/index.js.map +1 -1
- package/dist/node_modules/@mui/material/StepContent/StepContent/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/StepContent/StepContent/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/StepContent/StepContent/index.js +1 -1
- package/dist/node_modules/@mui/material/StepContent/StepContent/index.js.map +1 -1
- package/dist/node_modules/@mui/material/StepIcon/StepIcon/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/StepIcon/StepIcon/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/StepIcon/StepIcon/index.js +1 -1
- package/dist/node_modules/@mui/material/StepIcon/StepIcon/index.js.map +1 -1
- package/dist/node_modules/@mui/material/StepLabel/StepLabel/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/StepLabel/StepLabel/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/StepLabel/StepLabel/index.js +2 -2
- package/dist/node_modules/@mui/material/StepLabel/StepLabel/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Stepper/Stepper/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Stepper/Stepper/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Stepper/Stepper/index.js +2 -2
- package/dist/node_modules/@mui/material/Stepper/Stepper/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Stepper/StepperContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Stepper/StepperContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Stepper/StepperContext/index.js +1 -1
- package/dist/node_modules/@mui/material/Stepper/StepperContext/index.js.map +1 -1
- package/dist/node_modules/@mui/material/SvgIcon/SvgIcon/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/SvgIcon/SvgIcon/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/SvgIcon/SvgIcon/index.js +2 -2
- package/dist/node_modules/@mui/material/SvgIcon/SvgIcon/index.js.map +1 -1
- package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeArea/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeArea/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeArea/index.js +2 -2
- package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeArea/index.js.map +1 -1
- package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeableDrawer/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeableDrawer/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeableDrawer/index.js +1 -1
- package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeableDrawer/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Switch/Switch/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Switch/Switch/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Switch/Switch/index.js +2 -2
- package/dist/node_modules/@mui/material/Switch/Switch/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Tab/Tab/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Tab/Tab/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Tab/Tab/index.js +1 -1
- package/dist/node_modules/@mui/material/Tab/Tab/index.js.map +1 -1
- package/dist/node_modules/@mui/material/TabScrollButton/TabScrollButton/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/TabScrollButton/TabScrollButton/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/TabScrollButton/TabScrollButton/index.js +2 -2
- package/dist/node_modules/@mui/material/TabScrollButton/TabScrollButton/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Table/Table/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Table/Table/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Table/Table/index.js +2 -2
- package/dist/node_modules/@mui/material/Table/Table/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Table/TableContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Table/TableContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Table/TableContext/index.js +1 -1
- package/dist/node_modules/@mui/material/Table/TableContext/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Table/Tablelvl2Context/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Table/Tablelvl2Context/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Table/Tablelvl2Context/index.js +1 -1
- package/dist/node_modules/@mui/material/Table/Tablelvl2Context/index.js.map +1 -1
- package/dist/node_modules/@mui/material/TableBody/TableBody/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/TableBody/TableBody/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/TableBody/TableBody/index.js +1 -1
- package/dist/node_modules/@mui/material/TableBody/TableBody/index.js.map +1 -1
- package/dist/node_modules/@mui/material/TableCell/TableCell/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/TableCell/TableCell/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/TableCell/TableCell/index.js +1 -1
- package/dist/node_modules/@mui/material/TableCell/TableCell/index.js.map +1 -1
- package/dist/node_modules/@mui/material/TableContainer/TableContainer/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/TableContainer/TableContainer/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/TableContainer/TableContainer/index.js +2 -2
- package/dist/node_modules/@mui/material/TableContainer/TableContainer/index.js.map +1 -1
- package/dist/node_modules/@mui/material/TableFooter/TableFooter/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/TableFooter/TableFooter/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/TableFooter/TableFooter/index.js +1 -1
- package/dist/node_modules/@mui/material/TableFooter/TableFooter/index.js.map +1 -1
- package/dist/node_modules/@mui/material/TableHead/TableHead/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/TableHead/TableHead/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/TableHead/TableHead/index.js +1 -1
- package/dist/node_modules/@mui/material/TableHead/TableHead/index.js.map +1 -1
- package/dist/node_modules/@mui/material/TablePagination/TablePagination/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/TablePagination/TablePagination/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/TablePagination/TablePagination/index.js +2 -2
- package/dist/node_modules/@mui/material/TablePagination/TablePagination/index.js.map +1 -1
- package/dist/node_modules/@mui/material/TablePagination/TablePaginationActions/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/TablePagination/TablePaginationActions/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/TablePagination/TablePaginationActions/index.js +2 -2
- package/dist/node_modules/@mui/material/TablePagination/TablePaginationActions/index.js.map +1 -1
- package/dist/node_modules/@mui/material/TableRow/TableRow/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/TableRow/TableRow/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/TableRow/TableRow/index.js +1 -1
- package/dist/node_modules/@mui/material/TableRow/TableRow/index.js.map +1 -1
- package/dist/node_modules/@mui/material/TableSortLabel/TableSortLabel/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/TableSortLabel/TableSortLabel/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/TableSortLabel/TableSortLabel/index.js +1 -1
- package/dist/node_modules/@mui/material/TableSortLabel/TableSortLabel/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Tabs/ScrollbarSize/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Tabs/ScrollbarSize/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Tabs/ScrollbarSize/index.js +1 -1
- package/dist/node_modules/@mui/material/Tabs/ScrollbarSize/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Tabs/Tabs/index.esm.js +6 -7
- package/dist/node_modules/@mui/material/Tabs/Tabs/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Tabs/Tabs/index.js +2 -2
- package/dist/node_modules/@mui/material/Tabs/Tabs/index.js.map +1 -1
- package/dist/node_modules/@mui/material/TextField/TextField/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/TextField/TextField/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/TextField/TextField/index.js +2 -2
- package/dist/node_modules/@mui/material/TextField/TextField/index.js.map +1 -1
- package/dist/node_modules/@mui/material/TextareaAutosize/TextareaAutosize/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/TextareaAutosize/TextareaAutosize/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/TextareaAutosize/TextareaAutosize/index.js +1 -1
- package/dist/node_modules/@mui/material/TextareaAutosize/TextareaAutosize/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ToggleButton/ToggleButton/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ToggleButton/ToggleButton/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ToggleButton/ToggleButton/index.js +1 -1
- package/dist/node_modules/@mui/material/ToggleButton/ToggleButton/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroup/index.esm.js +2 -3
- package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroup/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroup/index.js +2 -2
- package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroup/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupButtonContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupButtonContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupButtonContext/index.js +1 -1
- package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupButtonContext/index.js.map +1 -1
- package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupContext/index.js +1 -1
- package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupContext/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Toolbar/Toolbar/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Toolbar/Toolbar/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Toolbar/Toolbar/index.js +2 -2
- package/dist/node_modules/@mui/material/Toolbar/Toolbar/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Tooltip/Tooltip/index.esm.js +4 -5
- package/dist/node_modules/@mui/material/Tooltip/Tooltip/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Tooltip/Tooltip/index.js +2 -2
- package/dist/node_modules/@mui/material/Tooltip/Tooltip/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Typography/Typography/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Typography/Typography/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Typography/Typography/index.js +2 -2
- package/dist/node_modules/@mui/material/Typography/Typography/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Unstable_TrapFocus/FocusTrap/index.esm.js +3 -4
- package/dist/node_modules/@mui/material/Unstable_TrapFocus/FocusTrap/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Unstable_TrapFocus/FocusTrap/index.js +2 -2
- package/dist/node_modules/@mui/material/Unstable_TrapFocus/FocusTrap/index.js.map +1 -1
- package/dist/node_modules/@mui/material/Zoom/Zoom/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/Zoom/Zoom/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/Zoom/Zoom/index.js +1 -1
- package/dist/node_modules/@mui/material/Zoom/Zoom/index.js.map +1 -1
- package/dist/node_modules/@mui/material/internal/SwitchBase/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/internal/SwitchBase/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/internal/SwitchBase/index.js +2 -2
- package/dist/node_modules/@mui/material/internal/SwitchBase/index.js.map +1 -1
- package/dist/node_modules/@mui/material/styles/ThemeProvider/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/styles/ThemeProvider/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/styles/ThemeProvider/index.js +1 -1
- package/dist/node_modules/@mui/material/styles/ThemeProvider/index.js.map +1 -1
- package/dist/node_modules/@mui/material/styles/createPalette/index.esm.js +4 -5
- package/dist/node_modules/@mui/material/styles/createPalette/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/styles/createPalette/index.js +1 -1
- package/dist/node_modules/@mui/material/styles/createPalette/index.js.map +1 -1
- package/dist/node_modules/@mui/material/styles/createTheme/index.esm.js +3 -4
- package/dist/node_modules/@mui/material/styles/createTheme/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/styles/createTheme/index.js +1 -1
- package/dist/node_modules/@mui/material/styles/createTheme/index.js.map +1 -1
- package/dist/node_modules/@mui/material/styles/createTransitions/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/styles/createTransitions/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/styles/createTransitions/index.js +1 -1
- package/dist/node_modules/@mui/material/styles/createTransitions/index.js.map +1 -1
- package/dist/node_modules/@mui/material/styles/createTypography/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/styles/createTypography/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/styles/createTypography/index.js +1 -1
- package/dist/node_modules/@mui/material/styles/createTypography/index.js.map +1 -1
- package/dist/node_modules/@mui/material/styles/useTheme/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/styles/useTheme/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/styles/useTheme/index.js +1 -1
- package/dist/node_modules/@mui/material/styles/useTheme/index.js.map +1 -1
- package/dist/node_modules/@mui/material/useAutocomplete/useAutocomplete/index.esm.js +5 -6
- package/dist/node_modules/@mui/material/useAutocomplete/useAutocomplete/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/useAutocomplete/useAutocomplete/index.js +1 -1
- package/dist/node_modules/@mui/material/useAutocomplete/useAutocomplete/index.js.map +1 -1
- package/dist/node_modules/@mui/material/utils/createSvgIcon/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/utils/createSvgIcon/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/utils/createSvgIcon/index.js +2 -2
- package/dist/node_modules/@mui/material/utils/createSvgIcon/index.js.map +1 -1
- package/dist/node_modules/@mui/material/utils/index/index.esm.js +1 -2
- package/dist/node_modules/@mui/material/utils/index/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/material/utils/index/index.js +1 -1
- package/dist/node_modules/@mui/material/utils/index/index.js.map +1 -1
- package/dist/node_modules/@mui/private-theming/ThemeProvider/ThemeProvider/index.esm.js +5 -6
- package/dist/node_modules/@mui/private-theming/ThemeProvider/ThemeProvider/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/private-theming/ThemeProvider/ThemeProvider/index.js +2 -2
- package/dist/node_modules/@mui/private-theming/ThemeProvider/ThemeProvider/index.js.map +1 -1
- package/dist/node_modules/@mui/private-theming/useTheme/ThemeContext/index.esm.js +1 -2
- package/dist/node_modules/@mui/private-theming/useTheme/ThemeContext/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/private-theming/useTheme/ThemeContext/index.js +1 -1
- package/dist/node_modules/@mui/private-theming/useTheme/ThemeContext/index.js.map +1 -1
- package/dist/node_modules/@mui/private-theming/useTheme/useTheme/index.esm.js +1 -2
- package/dist/node_modules/@mui/private-theming/useTheme/useTheme/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/private-theming/useTheme/useTheme/index.js +1 -1
- package/dist/node_modules/@mui/private-theming/useTheme/useTheme/index.js.map +1 -1
- package/dist/node_modules/@mui/styled-engine/GlobalStyles/GlobalStyles/index.esm.js +1 -2
- package/dist/node_modules/@mui/styled-engine/GlobalStyles/GlobalStyles/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/styled-engine/GlobalStyles/GlobalStyles/index.js +1 -1
- package/dist/node_modules/@mui/styled-engine/GlobalStyles/GlobalStyles/index.js.map +1 -1
- package/dist/node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider/index.esm.js +1 -2
- package/dist/node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider/index.js +1 -1
- package/dist/node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider/index.js.map +1 -1
- package/dist/node_modules/@mui/styled-engine/index/index.esm.js +8 -2
- package/dist/node_modules/@mui/styled-engine/index/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/styled-engine/index/index.js +1 -1
- package/dist/node_modules/@mui/styled-engine/index/index.js.map +1 -1
- package/dist/node_modules/@mui/system/colorManipulator/index.esm.js +10 -11
- package/dist/node_modules/@mui/system/colorManipulator/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/colorManipulator/index.js +1 -1
- package/dist/node_modules/@mui/system/colorManipulator/index.js.map +1 -1
- package/dist/node_modules/@mui/system/createStyled/index.esm.js +8 -9
- package/dist/node_modules/@mui/system/createStyled/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/createStyled/index.js +1 -1
- package/dist/node_modules/@mui/system/createStyled/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/Container/createContainer/index.esm.js +1 -2
- package/dist/node_modules/@mui/system/esm/Container/createContainer/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/Container/createContainer/index.js +2 -2
- package/dist/node_modules/@mui/system/esm/Container/createContainer/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/DefaultPropsProvider/DefaultPropsProvider/index.esm.js +1 -2
- package/dist/node_modules/@mui/system/esm/DefaultPropsProvider/DefaultPropsProvider/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/DefaultPropsProvider/DefaultPropsProvider/index.js +2 -2
- package/dist/node_modules/@mui/system/esm/DefaultPropsProvider/DefaultPropsProvider/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/GlobalStyles/GlobalStyles/index.esm.js +1 -2
- package/dist/node_modules/@mui/system/esm/GlobalStyles/GlobalStyles/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/GlobalStyles/GlobalStyles/index.js +1 -1
- package/dist/node_modules/@mui/system/esm/GlobalStyles/GlobalStyles/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/RtlProvider/index/index.esm.js +1 -2
- package/dist/node_modules/@mui/system/esm/RtlProvider/index/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/RtlProvider/index/index.js +1 -1
- package/dist/node_modules/@mui/system/esm/RtlProvider/index/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/Stack/createStack/index.esm.js +1 -2
- package/dist/node_modules/@mui/system/esm/Stack/createStack/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/Stack/createStack/index.js +2 -2
- package/dist/node_modules/@mui/system/esm/Stack/createStack/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/ThemeProvider/ThemeProvider/index.esm.js +4 -5
- package/dist/node_modules/@mui/system/esm/ThemeProvider/ThemeProvider/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/ThemeProvider/ThemeProvider/index.js +2 -2
- package/dist/node_modules/@mui/system/esm/ThemeProvider/ThemeProvider/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/borders/index.esm.js +1 -2
- package/dist/node_modules/@mui/system/esm/borders/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/borders/index.js +1 -1
- package/dist/node_modules/@mui/system/esm/borders/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/breakpoints/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/breakpoints/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/colorManipulator/index.esm.js +3 -4
- package/dist/node_modules/@mui/system/esm/colorManipulator/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/colorManipulator/index.js +1 -1
- package/dist/node_modules/@mui/system/esm/colorManipulator/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/compose/index.esm.js +1 -2
- package/dist/node_modules/@mui/system/esm/compose/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/compose/index.js +1 -1
- package/dist/node_modules/@mui/system/esm/compose/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/createStyled/index.esm.js +2 -3
- package/dist/node_modules/@mui/system/esm/createStyled/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/createStyled/index.js +1 -1
- package/dist/node_modules/@mui/system/esm/createStyled/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/createTheme/createSpacing/index.esm.js +1 -2
- package/dist/node_modules/@mui/system/esm/createTheme/createSpacing/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/createTheme/createSpacing/index.js +1 -1
- package/dist/node_modules/@mui/system/esm/createTheme/createSpacing/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/cssGrid/index.esm.js +3 -4
- package/dist/node_modules/@mui/system/esm/cssGrid/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/cssGrid/index.js +1 -1
- package/dist/node_modules/@mui/system/esm/cssGrid/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/responsivePropType/index.esm.js +1 -2
- package/dist/node_modules/@mui/system/esm/responsivePropType/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/responsivePropType/index.js +1 -1
- package/dist/node_modules/@mui/system/esm/responsivePropType/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/spacing/index.esm.js +6 -7
- package/dist/node_modules/@mui/system/esm/spacing/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/spacing/index.js +1 -1
- package/dist/node_modules/@mui/system/esm/spacing/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/style/index.esm.js +1 -2
- package/dist/node_modules/@mui/system/esm/style/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/style/index.js +1 -1
- package/dist/node_modules/@mui/system/esm/style/index.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/useMediaQuery/useMediaQuery/index.esm.js +2 -3
- package/dist/node_modules/@mui/system/esm/useMediaQuery/useMediaQuery/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/system/esm/useMediaQuery/useMediaQuery/index.js +1 -1
- package/dist/node_modules/@mui/system/esm/useMediaQuery/useMediaQuery/index.js.map +1 -1
- package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.esm.js +1 -1
- package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.js +1 -1
- package/dist/node_modules/@mui/utils/esm/HTMLElementType/HTMLElementType/index.esm.js +1 -2
- package/dist/node_modules/@mui/utils/esm/HTMLElementType/HTMLElementType/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/HTMLElementType/HTMLElementType/index.js +1 -1
- package/dist/node_modules/@mui/utils/esm/HTMLElementType/HTMLElementType/index.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/capitalize/capitalize/index.esm.js +1 -2
- package/dist/node_modules/@mui/utils/esm/capitalize/capitalize/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/capitalize/capitalize/index.js +1 -1
- package/dist/node_modules/@mui/utils/esm/capitalize/capitalize/index.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/chainPropTypes/chainPropTypes/index.esm.js +1 -2
- package/dist/node_modules/@mui/utils/esm/chainPropTypes/chainPropTypes/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/chainPropTypes/chainPropTypes/index.js +1 -1
- package/dist/node_modules/@mui/utils/esm/chainPropTypes/chainPropTypes/index.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/deprecatedPropType/deprecatedPropType/index.esm.js +1 -2
- package/dist/node_modules/@mui/utils/esm/deprecatedPropType/deprecatedPropType/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/deprecatedPropType/deprecatedPropType/index.js +1 -1
- package/dist/node_modules/@mui/utils/esm/deprecatedPropType/deprecatedPropType/index.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/exactProp/exactProp/index.esm.js +1 -2
- package/dist/node_modules/@mui/utils/esm/exactProp/exactProp/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/exactProp/exactProp/index.js +1 -1
- package/dist/node_modules/@mui/utils/esm/exactProp/exactProp/index.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/integerPropType/integerPropType/index.esm.js +1 -2
- package/dist/node_modules/@mui/utils/esm/integerPropType/integerPropType/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/integerPropType/integerPropType/index.js +1 -1
- package/dist/node_modules/@mui/utils/esm/integerPropType/integerPropType/index.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/requirePropFactory/requirePropFactory/index.esm.js +1 -2
- package/dist/node_modules/@mui/utils/esm/requirePropFactory/requirePropFactory/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/requirePropFactory/requirePropFactory/index.js +1 -1
- package/dist/node_modules/@mui/utils/esm/requirePropFactory/requirePropFactory/index.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/unsupportedProp/unsupportedProp/index.esm.js +1 -2
- package/dist/node_modules/@mui/utils/esm/unsupportedProp/unsupportedProp/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/unsupportedProp/unsupportedProp/index.js +1 -1
- package/dist/node_modules/@mui/utils/esm/unsupportedProp/unsupportedProp/index.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/useControlled/useControlled/index.esm.js +1 -2
- package/dist/node_modules/@mui/utils/esm/useControlled/useControlled/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/utils/esm/useControlled/useControlled/index.js +1 -1
- package/dist/node_modules/@mui/utils/esm/useControlled/useControlled/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateField/DateField/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/DateField/DateField/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateField/DateField/index.js +2 -2
- package/dist/node_modules/@mui/x-date-pickers/DateField/DateField/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePicker/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePicker/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePicker/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePicker/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePickerToolbar/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePickerToolbar/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePickerToolbar/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePickerToolbar/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField/index.js +2 -2
- package/dist/node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerTabs/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerTabs/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerTabs/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerTabs/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerToolbar/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerToolbar/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerToolbar/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerToolbar/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DigitalClock/DigitalClock/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/DigitalClock/DigitalClock/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DigitalClock/DigitalClock/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/DigitalClock/DigitalClock/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/LocalizationProvider/LocalizationProvider/index.esm.js +2 -3
- package/dist/node_modules/@mui/x-date-pickers/LocalizationProvider/LocalizationProvider/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/LocalizationProvider/LocalizationProvider/index.js +2 -2
- package/dist/node_modules/@mui/x-date-pickers/LocalizationProvider/LocalizationProvider/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/MonthCalendar/MonthCalendar/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/MonthCalendar/MonthCalendar/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/MonthCalendar/MonthCalendar/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/MonthCalendar/MonthCalendar/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/MultiSectionDigitalClock/MultiSectionDigitalClock/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/MultiSectionDigitalClock/MultiSectionDigitalClock/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/MultiSectionDigitalClock/MultiSectionDigitalClock/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/MultiSectionDigitalClock/MultiSectionDigitalClock/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/PickersActionBar/PickersActionBar/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/PickersActionBar/PickersActionBar/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/PickersActionBar/PickersActionBar/index.js +4 -4
- package/dist/node_modules/@mui/x-date-pickers/PickersActionBar/PickersActionBar/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/PickersCalendarHeader/PickersCalendarHeader/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/PickersCalendarHeader/PickersCalendarHeader/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/PickersCalendarHeader/PickersCalendarHeader/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/PickersCalendarHeader/PickersCalendarHeader/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/PickersDay/PickersDay/index.esm.js +4 -5
- package/dist/node_modules/@mui/x-date-pickers/PickersDay/PickersDay/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/PickersDay/PickersDay/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/PickersDay/PickersDay/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/PickersShortcuts/PickersShortcuts/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/PickersShortcuts/PickersShortcuts/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/PickersShortcuts/PickersShortcuts/index.js +2 -2
- package/dist/node_modules/@mui/x-date-pickers/PickersShortcuts/PickersShortcuts/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/TimeClock/TimeClock/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/TimeClock/TimeClock/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/TimeClock/TimeClock/index.js +2 -2
- package/dist/node_modules/@mui/x-date-pickers/TimeClock/TimeClock/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/TimeField/TimeField/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/TimeField/TimeField/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/TimeField/TimeField/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/TimeField/TimeField/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePicker/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePicker/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePicker/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePicker/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePickerToolbar/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePickerToolbar/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePickerToolbar/index.js +2 -2
- package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePickerToolbar/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/YearCalendar/YearCalendar/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/YearCalendar/YearCalendar/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/YearCalendar/YearCalendar/index.js +2 -2
- package/dist/node_modules/@mui/x-date-pickers/YearCalendar/YearCalendar/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useField/useField.utils/index.esm.js +3 -4
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useField/useField.utils/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useField/useField.utils/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useField/useField.utils/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePicker/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePicker/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePicker/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePicker/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePickerValue/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePickerValue/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePickerValue/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePickerValue/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useViews/index.esm.js +1 -2
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useViews/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useViews/index.js +1 -1
- package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useViews/index.js.map +1 -1
- package/dist/node_modules/@mui/x-date-pickers/internals/utils/warning/index.esm.js.map +1 -1
- package/dist/node_modules/@react-querybuilder/material/dist/react-querybuilder_material/index.esm.js.map +1 -1
- package/dist/node_modules/@react-querybuilder/material/dist/react-querybuilder_material/index.js.map +1 -1
- package/dist/node_modules/@tanstack/table-core/build/lib/index/index.esm.js +20 -11
- package/dist/node_modules/@tanstack/table-core/build/lib/index/index.esm.js.map +1 -1
- package/dist/node_modules/@tanstack/table-core/build/lib/index/index.js +1 -1
- package/dist/node_modules/@tanstack/table-core/build/lib/index/index.js.map +1 -1
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index/index.esm.js +6 -7
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index/index.esm.js.map +1 -1
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index/index.js +1 -1
- package/dist/node_modules/@tanstack/virtual-core/dist/esm/index/index.js.map +1 -1
- package/dist/node_modules/notistack/notistack.esm/index.esm.js +2 -3
- package/dist/node_modules/notistack/notistack.esm/index.esm.js.map +1 -1
- package/dist/node_modules/notistack/notistack.esm/index.js +1 -1
- package/dist/node_modules/notistack/notistack.esm/index.js.map +1 -1
- package/dist/node_modules/prop-types/checkPropTypes/index.esm.js +3 -4
- package/dist/node_modules/prop-types/checkPropTypes/index.esm.js.map +1 -1
- package/dist/node_modules/prop-types/checkPropTypes/index.js +1 -1
- package/dist/node_modules/prop-types/checkPropTypes/index.js.map +1 -1
- package/dist/node_modules/prop-types/factoryWithTypeCheckers/index.esm.js +5 -6
- package/dist/node_modules/prop-types/factoryWithTypeCheckers/index.esm.js.map +1 -1
- package/dist/node_modules/prop-types/factoryWithTypeCheckers/index.js +1 -1
- package/dist/node_modules/prop-types/factoryWithTypeCheckers/index.js.map +1 -1
- package/dist/node_modules/prop-types/index/index.esm.js +1 -2
- package/dist/node_modules/prop-types/index/index.esm.js.map +1 -1
- package/dist/node_modules/prop-types/index/index.js +1 -1
- package/dist/node_modules/prop-types/index/index.js.map +1 -1
- package/dist/src/api-client/api.inventory/api.d.ts +10 -14
- package/dist/src/components/form-control/form-builder/form-builder-element/dynamic-select.d.ts +1 -0
- package/dist/src/components/providers/ERPUIProvider.d.ts +2 -0
- package/dist/src/utils/api-config.d.ts +24 -0
- package/dist/src/utils/api.d.ts +9 -18
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/style.css +71 -71
- package/dist/utils/api/index.esm.js +41 -41
- package/dist/utils/api/index.esm.js.map +1 -1
- package/dist/utils/api/index.js +1 -1
- package/dist/utils/api/index.js.map +1 -1
- package/dist/utils/api-config/index.esm.js +56 -0
- package/dist/utils/api-config/index.esm.js.map +1 -0
- package/dist/utils/api-config/index.js +2 -0
- package/dist/utils/api-config/index.js.map +1 -0
- package/dist/utils/api-config.d.ts +24 -0
- package/dist/utils/api.d.ts +9 -18
- package/dist/utils/common/index.esm.js +12 -8
- package/dist/utils/common/index.esm.js.map +1 -1
- package/dist/utils/common/index.js +1 -1
- package/dist/utils/common/index.js.map +1 -1
- package/dist/utils/common-utility/index.esm.js +7 -13
- package/dist/utils/common-utility/index.esm.js.map +1 -1
- package/dist/utils/common-utility/index.js +5 -5
- package/dist/utils/common-utility/index.js.map +1 -1
- package/dist/utils/index.esm.js +9 -1
- package/dist/utils/index.esm.js.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/views/form-builder/redux/actionCreator/index.esm.js +1 -2
- package/dist/views/form-builder/redux/actionCreator/index.esm.js.map +1 -1
- package/dist/views/form-builder/redux/actionCreator/index.js +1 -1
- package/dist/views/form-builder/redux/actionCreator/index.js.map +1 -1
- package/dist/views/template-editor/components/EditorSidebar/index.esm.js +4 -3
- package/dist/views/template-editor/components/EditorSidebar/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/EditorSidebar/index.js +14 -14
- package/dist/views/template-editor/components/EditorSidebar/index.js.map +1 -1
- package/dist/views/template-editor/templates/index.esm.js +0 -2
- package/dist/views/template-editor/templates/index.esm.js.map +1 -1
- package/dist/views/template-editor/templates/index.js +5 -5
- package/dist/views/template-editor/templates/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useState, useRef, useEffect } from "react";
|
|
3
|
-
import { postV1AuthChangeUserPasswordByAdmin, postV1AuthChangeUserPassword, postV1AuthChangePassword, postV1AuthResetPassword, postV1AuthForgotPassword, postV1AuthLogin
|
|
3
|
+
import { postV1AuthChangeUserPasswordByAdmin, postV1AuthChangeUserPassword, postV1AuthChangePassword, postV1AuthResetPassword, postV1AuthForgotPassword, postV1AuthLogin } from "../../api-client/api.rbac/api/index.esm.js";
|
|
4
4
|
import { auth } from "../../constants/auth/index.esm.js";
|
|
5
5
|
import { useNavigate } from "react-router-dom";
|
|
6
6
|
import { Pathname } from "../../constants/pathnames/pathname/index.esm.js";
|
|
@@ -8,6 +8,7 @@ import { getToken } from "../../utils/common/index.esm.js";
|
|
|
8
8
|
import { enqueueSnackbar } from "../../node_modules/notistack/notistack.esm/index.esm.js";
|
|
9
9
|
import { io } from "socket.io-client";
|
|
10
10
|
import { generateRouteWithId } from "../../utils/route-utils/index.esm.js";
|
|
11
|
+
import { getApiConfig } from "../../utils/api-config/index.esm.js";
|
|
11
12
|
import { PathnameGenerator as PathnameGenerator$5, PathnameAccounting } from "../../constants/pathnames/pathname.accounting/index.esm.js";
|
|
12
13
|
import { PathnameGenerator as PathnameGenerator$4, PathnameInventory } from "../../constants/pathnames/pathname.inventory/index.esm.js";
|
|
13
14
|
import { PathnameGenerator as PathnameGenerator$3, PathnameManufacturing } from "../../constants/pathnames/pathname.manufacturing/index.esm.js";
|
|
@@ -29,7 +30,6 @@ const defaultProvider = {
|
|
|
29
30
|
changeUserPassword: () => Promise.resolve()
|
|
30
31
|
};
|
|
31
32
|
const AuthContext = createContext(defaultProvider);
|
|
32
|
-
setBaseUrl(`${"https://apidev.erpforce.co"}/rbac`);
|
|
33
33
|
const AuthProvider = ({ children }) => {
|
|
34
34
|
const [user, setUser] = useState(defaultProvider.user);
|
|
35
35
|
const [authToken, setAuthToken] = useState("");
|
|
@@ -105,7 +105,8 @@ const AuthProvider = ({ children }) => {
|
|
|
105
105
|
console.warn("No auth token found, not connecting to socket.");
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
-
const
|
|
108
|
+
const config = getApiConfig();
|
|
109
|
+
const socket = io(config.socketBaseUrl, {
|
|
109
110
|
transports: ["websocket"],
|
|
110
111
|
auth: { token: authToken },
|
|
111
112
|
path: "/socket.io/"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../src/contexts/AuthContext.tsx"],"sourcesContent":["import React, { createContext, useEffect, useRef, useState } from 'react';\nimport {\n\tpostV1AuthChangePassword,\n\tpostV1AuthForgotPassword,\n\tpostV1AuthChangeUserPassword,\n\t// getV1UserId,\n\tpostV1AuthLogin,\n\tpostV1AuthResetPassword,\n\tsetBaseUrl,\n\tpostV1AuthChangeUserPasswordByAdmin\n} from '../api-client/api.rbac/api';\nimport { auth } from '../constants/auth';\nimport { /* useLocation, */ useNavigate } from 'react-router-dom';\nimport { Pathname } from '../constants/pathnames/pathname'; // Removed - should be passed as props or configured by consuming app\nimport { getToken } from '../utils/common';\nimport { enqueueSnackbar } from 'notistack';\nimport { Socket, io } from 'socket.io-client';\nimport { generateRouteWithId } from '../utils/route-utils';\nimport {\n\tPathnameAccounting,\n\tPathnameGenerator\n} from '../constants/pathnames/pathname.accounting';\n\nimport {\n\tPathnameInventory,\n\tPathnameGenerator as PathnameGeneratorInventory\n} from '../constants/pathnames/pathname.inventory';\n\nimport {\n\tPathnameManufacturing,\n\tPathnameGenerator as PathnameGeneratorManufacuring\n} from '../constants/pathnames/pathname.manufacturing';\n\nimport {\n\tPathnamePurchase,\n\tPathnameGenerator as PathnameGeneratorPurchase\n} from '../constants/pathnames/pathname.procurement';\n\nimport {\n\tPathnameCrm,\n\tPathnameGenerator as PathnameGeneratorCrm\n} from '../constants/pathnames/pathname.crm';\n\nimport {\n\tPathnameRental,\n\tPathnameGenerator as PathnameGeneratorRental\n} from '../constants/pathnames/pathname.rental';\n\nimport { ROUTES as RENTALROUTES } from '../constants/pathnames/pathname.rental';\n\nimport CustomSnackbar from '../components/custom-snackbar/custom-snackbar.tsx';\nexport interface LoginFormValues {\n\temail: string;\n\tpassword: string;\n}\n\nexport interface resetFormValues {\n\temail: string;\n}\n\nexport interface resetPasswordValues {\n\ttoken: string;\n}\n\nexport interface changePasswordValues {\n\tpassword: string;\n}\n\nexport interface changeUserPasswordValues {\n\tpassword: string;\n}\n\ninterface ERPApiUser {\n\tid: string | number;\n\tfirst_name: string;\n\tlast_name: string;\n\tmiddle_name: string;\n\tcountry_code: string;\n\temail: string;\n\tcreated_by: any;\n\tupdated_by: any;\n\tcreated_at: string;\n\tupdated_at: string;\n\trole_id: string;\n\tdepartment_id: number;\n\tis_deleted: number;\n\tdeleted_at: string | null;\n\tdeleted_by: any;\n\ttoken: string;\n\tprofile_image: string;\n\tcurrency_data?: {\n\t\tid: number;\n\t\tsymbol: string;\n\t\tcurrency_name: string;\n\t\tnumber_format:string;\n\t\tposition: string | null;\n\t\tfraction_unit: string | null\n\t};\n\taccessCompanies?: any[]\n}\ninterface ERPUser extends Omit<ERPApiUser, 'token'> {\n\tfull_name: string;\n\tcompany_id: string;\n}\n\ninterface DefaultProviderProps {\n\tuser: ERPUser | null;\n\tloading: boolean;\n\tauthToken: string;\n\tsetUser: React.Dispatch<React.SetStateAction<ERPUser | null>>;\n\tsetLoading: React.Dispatch<React.SetStateAction<boolean>>;\n\tlogin: (\n\t\tparams: LoginFormValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tlogout: () => Promise<void>;\n\tforgotPassword: (\n\t\tparams: resetFormValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tresetPassword: (\n\t\tparams: resetPasswordValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tchangePassword: (\n\t\tparams: changePasswordValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tchangeUserPassword: (\n\t\tparams: changeUserPasswordValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n}\n\nconst defaultProvider: DefaultProviderProps = {\n\tuser: null,\n\tloading: true,\n\tauthToken: '',\n\tsetUser: () => null,\n\tsetLoading: () => Boolean,\n\tlogin: () => Promise.resolve(),\n\tlogout: () => Promise.resolve(),\n\tforgotPassword: () => Promise.resolve(),\n\tresetPassword: () => Promise.resolve(),\n\tchangePassword: () => Promise.resolve(),\n\tchangeUserPassword: () => Promise.resolve()\n};\n\nconst AuthContext = createContext(defaultProvider);\n\ninterface AuthProviderProps {\n\tchildren: React.ReactNode;\n}\n\nsetBaseUrl(`${import.meta.env.VITE_BACKEND_BASE_URL}/rbac`);\n\nconst AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {\n\t// ** States\n\tconst [user, setUser] = useState(defaultProvider.user);\n\tconst [authToken, setAuthToken] = useState<string>('');\n\tconst [loading, setLoading] = useState(defaultProvider.loading);\n\tconst socketRef = useRef<Socket | null>(null);\n\n\t// ** Hooks\n\tconst navigate = useNavigate();\n\t// const location = useLocation();\n\tconst isJsonParse = (string?: string | null) => {\n\t\tif (!string) return false;\n\n\t\ttry {\n\t\t\treturn JSON.parse(string);\n\t\t} catch (error) {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tconst getNotificationUrl = (data: any) => {\n\t\tconst { moduleName = '', moduleId = '', notificationData = {} } = data;\n\t\tconst key = moduleName.toLowerCase();\n\n\t\tconst routeMap: Record<string, () => string> = {\n\t\t\t'sales invoice': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_SALES_INVOICES), moduleId.toString()),\n\n\t\t\t'asset transfers': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_ASSET_TRANSFER), moduleId.toString()),\n\n\t\t\t'budgets': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_BUDGET), moduleId.toString()),\n\n\t\t\t'cash expense': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_CASH_EXPENSE), moduleId.toString()),\n\n\t\t\t'credit notes': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_CREDIT_NOTE), moduleId.toString()),\n\n\t\t\t'debit notes': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_DEBIT_NOTE), moduleId.toString()),\n\n\t\t\t'expense reimbursement': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_EXPENSE_REIMBURSEMENT), moduleId.toString()),\n\n\t\t\t'journal entries': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_JOURNAL_ENTRY), moduleId.toString()),\n\n\t\t\t'payment entries': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_PAYMENT_ENTRY), moduleId.toString()),\n\n\t\t\t'purchase invoice': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_PURCHASE_INVOICE), moduleId.toString()),\n\n\t\t\t'stock transfer': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorInventory(PathnameInventory.VIEW_STOCK_TRANSFER), moduleId.toString()),\n\n\t\t\t'bills of materials': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorManufacuring(PathnameManufacturing.VIEW_BILL_OF_MATERIAL), moduleId.toString()),\n\n\t\t\t'purchase agreement': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorPurchase(PathnamePurchase.VIEW_PURCHASE_AGREEMENT), moduleId.toString()),\n\n\t\t\t'purchase orders': () =>\n\t\t\tgenerateRouteWithId(notificationData?.data?.is_rental == 1 ? RENTALROUTES.VIEW : PathnameGeneratorPurchase(PathnamePurchase.VIEW_PURCHASE_ORDER) , moduleId.toString()),\n\n\t\t\t'purchase request': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorPurchase(PathnamePurchase.VIEW_PURCHASE_ORDER), moduleId.toString()),\n\n\t\t\t'vra': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorPurchase(PathnamePurchase.VIEW_VENDOR_RETURNS), moduleId.toString()),\n\n\t\t\t'sl customer returns': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorCrm(PathnameCrm.VIEW_CUSTOMER_RETURNS), moduleId.toString()),\n\n\t\t\t'sales order': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorCrm(PathnameCrm.VIEW_SALES_ORDER), moduleId.toString()),\n\n\t\t\t'rental order': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_RENTAL_ORDER), moduleId.toString()),\n\n\t\t\t'replacement order': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_RENTAL_ORDER), moduleId.toString()),\n\n\t\t\t'rental agreement': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_AGREEMENT), moduleId.toString()),\n\n\t\t\t'cross hire order': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_CROSS_HIRE_ORDER), moduleId.toString()),\n\n\t\t\t'cross hire request': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_CROSS_HIRE_REQUEST), moduleId.toString()),\n\t\t};\n\n\t\treturn routeMap[key]?.() || '/dashboard';\n\t};\n\n\n\t// const initAuth = async () => {\n\t// \tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t// \tconst storedUser: ERPUser =\n\t// \t\tisJsonParse(window.localStorage.getItem(auth.storageUserKeyName)) || null;\n\t// \tif (storedToken && storedUser) {\n\t// \t\ttry {\n\t// \t\t\tconst userData = await getV1UserId({\n\t// \t\t\t\t'x-token': storedToken,\n\t// \t\t\t\tid: String(storedUser.id)\n\t// \t\t\t});\n\t// \t\t} catch (error) {\n\t// \t\t}\n\t// \t} else {\n\t// \t\tsetLoading(false);\n\t// \t}\n\t// \tif (storedToken && storedUser) {\n\t// \t\tsetUser(storedUser);\n\t// setLoading(false);\n\t// \t} else {\n\t// \t\thandleLogout();\n\t// setLoading(false);\n\t// \t}\n\t// };\n\n\t// useEffect(() => {\n\t// setLoading(true)\n\t// \tinitAuth();\n\t// \tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t// \tif (!storedToken) {\n\t// \t\tsetUser(null);\n\t// \t} else {\n\t// \t\tsetLoading(false);\n\t// \t}\n\t// \teslint-disable-next-line react-hooks/exhaustive-deps\n\t// }, [location.pathname]);\n\n\t// useEffect(() => {\n\t// \tsetLoading(true);\n\t// \tinitAuth();\n\t// \tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t// \tif (!storedToken) {\n\t// \t\tsetLoading(false);\n\t// \t\tnavigate(Pathname.LOGIN);\n\t// \t}\n\t// \t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t// }, []);\n\n\tuseEffect(() => {\n\t\tsetLoading(true);\n\t\t// initAuth()\n\t\tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t\tconst storedUser =\n\t\t\tisJsonParse(window.localStorage.getItem(auth.storageUserKeyName)) ?? null;\n\t\tconst publicRoutes = [Pathname.LOGIN, Pathname.FORGOT_PASSWORD, Pathname.RESET_PASSWORD, Pathname.CHANGE_PASSWORD];\n\t\tconst currentPath = window.location.pathname;\n\t\tif (!storedToken && !storedUser) {\n\t\t\tif (!publicRoutes.includes(currentPath)) {\n\t\t\t\tnavigate(Pathname.LOGIN);\n\t\t\t}\n\t\t\tsetLoading(false);\n\t\t} else {\n\t\t\tsetUser(storedUser);\n\t\t\tsetAuthToken(storedToken || '');\n\t\t\tsetLoading(false);\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (!authToken) {\n\t\t\tif (socketRef.current) {\n\t\t\t\tsocketRef.current?.disconnect();\n\t\t\t\tsocketRef.current = null\n\t\t\t}\n\t\t\tconsole.warn(\"No auth token found, not connecting to socket.\");\n\t\t\treturn;\n\t\t}\n\n\t\tconst socket = io(import.meta.env.VITE_SOCKET_BASE_URL, {\n\t\t\ttransports: [\"websocket\"],\n\t\t\tauth: { token: authToken },\n\t\t\tpath: \"/socket.io/\",\n\t\t\t\n\t\t});\n\t\tsocketRef.current = socket;\n\n\t\tsocket.on(\"connect\", () => {\n\t\t\tconsole.log(\"Socket connected:\", socket.id);\n\t\t\tsocket.onAny((event, ...args) => {\n\t\t\t\tconsole.log(`Received event: ${event}`, args);\n\t\t\t});\n\t\t});\n\t\t\n\t\t// socket event handler\n\t\tsocket.on('notification', (data) => {\n\t\tconst { message, notificationData } = data || {};\n\t\tlet notificationContent: React.ReactNode = message;\n\t\tconst url = getNotificationUrl(data);\n\n\t\tif (notificationData) {\n\t\t\tconst { notification_type } = notificationData;\n\n\t\t\tswitch (notification_type) {\n\t\t\t\tcase 'addApprovers': {\n\t\t\t\t\t\n\t\t\t\t\tnotificationContent = message;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'change_approval_status': {\n\t\t\t\t\tnotificationContent = message;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tnotificationContent = message;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tenqueueSnackbar(String(message), {\n\t\t\tvariant: 'default',\n\t\t\tanchorOrigin: { vertical: 'top', horizontal: 'center' },\n\t\t\tautoHideDuration: 5000,\n\t\t\tcontent: (key) => (\n\t\t\t<CustomSnackbar snackbarKey={key} message={notificationContent} data={notificationData} variant=\"default\" linkUrl={url}/>\n\t\t\t),\n\t\t});\n\t\t});\n\n\n\t\tsocket.on(\"sales_invoice_viewed\", (data) => {\n\t\t\tconsole.log(\"Invoice viewed:\", data.invoiceId, \"by user:\", data.userId);\n\t\t});\n\n\t\tsocket.on(\"error\", (errMsg) => {\n\t\t\tenqueueSnackbar(`Socket error: ${errMsg}`, { variant: \"error\" });\n\t\t\tconsole.error(\"Socket error:\", errMsg);\n\t\t});\n\n\t\t// Clean up on unmount\n\t\treturn () => {\n\t\t\tif (socketRef.current) {\n\t\t\t\tsocketRef.current.disconnect();\n\t\t\t\tsocketRef.current = null\n\t\t\t}\n\t\t};\n\t}, [authToken]);\n\n\tconst handleLogin = async (\n\t\tparams: LoginFormValues,\n\t\tcallback: (err: string) => void\n\t) => {\n\t\tsetLoading(true);\n\t\tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t\tif (storedToken && user) {\n\t\t\treturn navigate(Pathname.DASHBOARD);\n\t\t}\n\n\t\ttry {\n\t\t\tconst loginUser = await postV1AuthLogin({ ...params, ...getToken() });\n\t\t\tif (loginUser.success) {\n\t\t\t\tconst data: ERPApiUser | null = loginUser?.data?.login || null;\n\t\t\t\tif (data) {\n\t\t\t\t\twindow.localStorage.setItem(auth.storageTokenKeyName, data.token);\n\t\t\t\t\tconst userData: ERPUser = {\n\t\t\t\t\t\t...data,\n\t\t\t\t\t\tfull_name: `${data.first_name} ${data.last_name}`\n\t\t\t\t\t};\n\t\t\t\t\twindow.localStorage.setItem(\n\t\t\t\t\t\tauth.storageUserKeyName,\n\t\t\t\t\t\tJSON.stringify(userData)\n\t\t\t\t\t);\n\t\t\t\t\tsetUser(userData);\n\t\t\t\t\tsetAuthToken(data.token);\n\t\t\t\t\tnavigate(Pathname.DASHBOARD);\n\t\t\t\t\tsetLoading(false);\n\t\t\t\t\tdelete data.token;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t}\n\n\t\t\tcallback(message);\n\t\t}\n\t};\n\n\tconst handleLogout = async () => {\n\t\twindow.localStorage.removeItem(auth.storageTokenKeyName);\n\t\twindow.localStorage.removeItem(auth.storageUserKeyName);\n\t\twindow.localStorage.removeItem(auth.storageAccessKeyName);\n\t\tsetUser(null);\n\t\tsetAuthToken('');\n\t\tnavigate(Pathname.LOGIN);\n\t};\n\n\tconst handleForgotPassword = async (params: resetFormValues,\n\t\tcallback: (type: boolean, err: string) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthForgotPassword({ ...params, ...getToken() });\n\t\t\tcallback(true, \"Reset Link sent to your email\");\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t}\n\n\t\t\tcallback(false, message);\n\t\t}\n\t};\n\n\tconst handleResetPassword = async (params: resetPasswordValues,\n\t\tcallback: (err: string) => void) => {\n\t\ttry {\n\t\t\tconst response = await postV1AuthResetPassword({ ...params, ...getToken() });\n\t\t\tcallback(response);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tconsole.log(\"Error \", error)\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst handleChangePassword = async (params: resetPasswordValues,\n\t\tcallback: (err: string) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthChangePassword({ ...params, ...getToken() });\n\t\t\tcallback(null);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tconsole.log(\"Error \", error)\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message);\n\t\t\t}\n\t\t}\n\t\tcallback(\"reset\");\n\t}\n\n\tconst handleChangeUserPassword = async (params: resetPasswordValues,\n\t\tcallback: (err: string, resType: boolean) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthChangeUserPassword({ ...params, ...getToken() });\n\t\t\tcallback('Password Changed Successfully', true);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message, false);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst handleChangeUserPasswordByAdmin = async (params: changePasswordValues,\n\t\tcallback: (err: string, resType: boolean) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthChangeUserPasswordByAdmin({ ...params, ...getToken() });\n\t\t\tcallback('Password Changed Successfully', true);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message, false);\n\t\t\t}\n\t\t}\n\t}\n\n\n\tconst values = {\n\t\tuser,\n\t\tauthToken,\n\t\tloading,\n\t\tsetUser,\n\t\tsetLoading,\n\t\tlogin: handleLogin,\n\t\tlogout: handleLogout,\n\t\tforgotPassword: handleForgotPassword,\n\t\tresetPassword: handleResetPassword,\n\t\tchangePassword: handleChangePassword,\n\t\tchangeUserPassword: handleChangeUserPassword,\n\t\tchangeUserPasswordByAdmin: handleChangeUserPasswordByAdmin\n\t};\n\n\treturn <AuthContext.Provider value={values}>{children}</AuthContext.Provider>;\n};\n\nexport { AuthContext, AuthProvider };\n"],"names":["PathnameGenerator","PathnameGeneratorInventory","PathnameGeneratorManufacuring","PathnameGeneratorPurchase","_a","RENTALROUTES","PathnameGeneratorCrm","PathnameGeneratorRental"],"mappings":";;;;;;;;;;;;;;;;;AAsIA,MAAM,kBAAwC;AAAA,EAC7C,MAAM;AAAA,EACN,SAAS;AAAA,EACT,WAAW;AAAA,EACX,SAAS,MAAM;AAAA,EACf,YAAY,MAAM;AAAA,EAClB,OAAO,MAAM,QAAQ,QAAA;AAAA,EACrB,QAAQ,MAAM,QAAQ,QAAA;AAAA,EACtB,gBAAgB,MAAM,QAAQ,QAAA;AAAA,EAC9B,eAAe,MAAM,QAAQ,QAAA;AAAA,EAC7B,gBAAgB,MAAM,QAAQ,QAAA;AAAA,EAC9B,oBAAoB,MAAM,QAAQ,QAAA;AACnC;AAEA,MAAM,cAAc,cAAc,eAAe;AAMjD,WAAW,GAAG,4BAAqC,OAAO;AAE1D,MAAM,eAA4C,CAAC,EAAE,eAAe;AAEnE,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,gBAAgB,IAAI;AACrD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAiB,EAAE;AACrD,QAAM,CAAC,SAAS,UAAU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,EAAA;AAG5B,6BAAQ,YAAY,UAAZ,EAAqB,OAAO,QAAS,UAAS;AACvD;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../src/contexts/AuthContext.tsx"],"sourcesContent":["import React, { createContext, useEffect, useRef, useState } from 'react';\nimport {\n\tpostV1AuthChangePassword,\n\tpostV1AuthForgotPassword,\n\tpostV1AuthChangeUserPassword,\n\t// getV1UserId,\n\tpostV1AuthLogin,\n\tpostV1AuthResetPassword,\n\tsetBaseUrl,\n\tpostV1AuthChangeUserPasswordByAdmin\n} from '../api-client/api.rbac/api';\nimport { auth } from '../constants/auth';\nimport { /* useLocation, */ useNavigate } from 'react-router-dom';\nimport { Pathname } from '../constants/pathnames/pathname'; // Removed - should be passed as props or configured by consuming app\nimport { getToken } from '../utils/common';\nimport { enqueueSnackbar } from 'notistack';\nimport { Socket, io } from 'socket.io-client';\nimport { generateRouteWithId } from '../utils/route-utils';\nimport { getApiConfig } from '../utils/api-config';\nimport {\n\tPathnameAccounting,\n\tPathnameGenerator\n} from '../constants/pathnames/pathname.accounting';\n\nimport {\n\tPathnameInventory,\n\tPathnameGenerator as PathnameGeneratorInventory\n} from '../constants/pathnames/pathname.inventory';\n\nimport {\n\tPathnameManufacturing,\n\tPathnameGenerator as PathnameGeneratorManufacuring\n} from '../constants/pathnames/pathname.manufacturing';\n\nimport {\n\tPathnamePurchase,\n\tPathnameGenerator as PathnameGeneratorPurchase\n} from '../constants/pathnames/pathname.procurement';\n\nimport {\n\tPathnameCrm,\n\tPathnameGenerator as PathnameGeneratorCrm\n} from '../constants/pathnames/pathname.crm';\n\nimport {\n\tPathnameRental,\n\tPathnameGenerator as PathnameGeneratorRental\n} from '../constants/pathnames/pathname.rental';\n\nimport { ROUTES as RENTALROUTES } from '../constants/pathnames/pathname.rental';\n\nimport CustomSnackbar from '../components/custom-snackbar/custom-snackbar.tsx';\nexport interface LoginFormValues {\n\temail: string;\n\tpassword: string;\n}\n\nexport interface resetFormValues {\n\temail: string;\n}\n\nexport interface resetPasswordValues {\n\ttoken: string;\n}\n\nexport interface changePasswordValues {\n\tpassword: string;\n}\n\nexport interface changeUserPasswordValues {\n\tpassword: string;\n}\n\ninterface ERPApiUser {\n\tid: string | number;\n\tfirst_name: string;\n\tlast_name: string;\n\tmiddle_name: string;\n\tcountry_code: string;\n\temail: string;\n\tcreated_by: any;\n\tupdated_by: any;\n\tcreated_at: string;\n\tupdated_at: string;\n\trole_id: string;\n\tdepartment_id: number;\n\tis_deleted: number;\n\tdeleted_at: string | null;\n\tdeleted_by: any;\n\ttoken: string;\n\tprofile_image: string;\n\tcurrency_data?: {\n\t\tid: number;\n\t\tsymbol: string;\n\t\tcurrency_name: string;\n\t\tnumber_format: string;\n\t\tposition: string | null;\n\t\tfraction_unit: string | null\n\t};\n\taccessCompanies?: any[]\n}\ninterface ERPUser extends Omit<ERPApiUser, 'token'> {\n\tfull_name: string;\n\tcompany_id: string;\n}\n\ninterface DefaultProviderProps {\n\tuser: ERPUser | null;\n\tloading: boolean;\n\tauthToken: string;\n\tsetUser: React.Dispatch<React.SetStateAction<ERPUser | null>>;\n\tsetLoading: React.Dispatch<React.SetStateAction<boolean>>;\n\tlogin: (\n\t\tparams: LoginFormValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tlogout: () => Promise<void>;\n\tforgotPassword: (\n\t\tparams: resetFormValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tresetPassword: (\n\t\tparams: resetPasswordValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tchangePassword: (\n\t\tparams: changePasswordValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tchangeUserPassword: (\n\t\tparams: changeUserPasswordValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n}\n\nconst defaultProvider: DefaultProviderProps = {\n\tuser: null,\n\tloading: true,\n\tauthToken: '',\n\tsetUser: () => null,\n\tsetLoading: () => Boolean,\n\tlogin: () => Promise.resolve(),\n\tlogout: () => Promise.resolve(),\n\tforgotPassword: () => Promise.resolve(),\n\tresetPassword: () => Promise.resolve(),\n\tchangePassword: () => Promise.resolve(),\n\tchangeUserPassword: () => Promise.resolve()\n};\n\nconst AuthContext = createContext(defaultProvider);\n\ninterface AuthProviderProps {\n\tchildren: React.ReactNode;\n}\n\n// Base URL will be set at runtime via ERPUIProvider\n\nconst AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {\n\t// ** States\n\tconst [user, setUser] = useState(defaultProvider.user);\n\tconst [authToken, setAuthToken] = useState<string>('');\n\tconst [loading, setLoading] = useState(defaultProvider.loading);\n\tconst socketRef = useRef<Socket | null>(null);\n\n\t// ** Hooks\n\tconst navigate = useNavigate();\n\t// const location = useLocation();\n\tconst isJsonParse = (string?: string | null) => {\n\t\tif (!string) return false;\n\n\t\ttry {\n\t\t\treturn JSON.parse(string);\n\t\t} catch (error) {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tconst getNotificationUrl = (data: any) => {\n\t\tconst { moduleName = '', moduleId = '', notificationData = {} } = data;\n\t\tconst key = moduleName.toLowerCase();\n\n\t\tconst routeMap: Record<string, () => string> = {\n\t\t\t'sales invoice': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_SALES_INVOICES), moduleId.toString()),\n\n\t\t\t'asset transfers': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_ASSET_TRANSFER), moduleId.toString()),\n\n\t\t\t'budgets': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_BUDGET), moduleId.toString()),\n\n\t\t\t'cash expense': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_CASH_EXPENSE), moduleId.toString()),\n\n\t\t\t'credit notes': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_CREDIT_NOTE), moduleId.toString()),\n\n\t\t\t'debit notes': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_DEBIT_NOTE), moduleId.toString()),\n\n\t\t\t'expense reimbursement': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_EXPENSE_REIMBURSEMENT), moduleId.toString()),\n\n\t\t\t'journal entries': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_JOURNAL_ENTRY), moduleId.toString()),\n\n\t\t\t'payment entries': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_PAYMENT_ENTRY), moduleId.toString()),\n\n\t\t\t'purchase invoice': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_PURCHASE_INVOICE), moduleId.toString()),\n\n\t\t\t'stock transfer': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorInventory(PathnameInventory.VIEW_STOCK_TRANSFER), moduleId.toString()),\n\n\t\t\t'bills of materials': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorManufacuring(PathnameManufacturing.VIEW_BILL_OF_MATERIAL), moduleId.toString()),\n\n\t\t\t'purchase agreement': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorPurchase(PathnamePurchase.VIEW_PURCHASE_AGREEMENT), moduleId.toString()),\n\n\t\t\t'purchase orders': () =>\n\t\t\t\tgenerateRouteWithId(notificationData?.data?.is_rental == 1 ? RENTALROUTES.VIEW : PathnameGeneratorPurchase(PathnamePurchase.VIEW_PURCHASE_ORDER), moduleId.toString()),\n\n\t\t\t'purchase request': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorPurchase(PathnamePurchase.VIEW_PURCHASE_ORDER), moduleId.toString()),\n\n\t\t\t'vra': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorPurchase(PathnamePurchase.VIEW_VENDOR_RETURNS), moduleId.toString()),\n\n\t\t\t'sl customer returns': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorCrm(PathnameCrm.VIEW_CUSTOMER_RETURNS), moduleId.toString()),\n\n\t\t\t'sales order': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorCrm(PathnameCrm.VIEW_SALES_ORDER), moduleId.toString()),\n\n\t\t\t'rental order': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_RENTAL_ORDER), moduleId.toString()),\n\n\t\t\t'replacement order': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_RENTAL_ORDER), moduleId.toString()),\n\n\t\t\t'rental agreement': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_AGREEMENT), moduleId.toString()),\n\n\t\t\t'cross hire order': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_CROSS_HIRE_ORDER), moduleId.toString()),\n\n\t\t\t'cross hire request': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_CROSS_HIRE_REQUEST), moduleId.toString()),\n\t\t};\n\n\t\treturn routeMap[key]?.() || '/dashboard';\n\t};\n\n\n\t// const initAuth = async () => {\n\t// \tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t// \tconst storedUser: ERPUser =\n\t// \t\tisJsonParse(window.localStorage.getItem(auth.storageUserKeyName)) || null;\n\t// \tif (storedToken && storedUser) {\n\t// \t\ttry {\n\t// \t\t\tconst userData = await getV1UserId({\n\t// \t\t\t\t'x-token': storedToken,\n\t// \t\t\t\tid: String(storedUser.id)\n\t// \t\t\t});\n\t// \t\t} catch (error) {\n\t// \t\t}\n\t// \t} else {\n\t// \t\tsetLoading(false);\n\t// \t}\n\t// \tif (storedToken && storedUser) {\n\t// \t\tsetUser(storedUser);\n\t// setLoading(false);\n\t// \t} else {\n\t// \t\thandleLogout();\n\t// setLoading(false);\n\t// \t}\n\t// };\n\n\t// useEffect(() => {\n\t// setLoading(true)\n\t// \tinitAuth();\n\t// \tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t// \tif (!storedToken) {\n\t// \t\tsetUser(null);\n\t// \t} else {\n\t// \t\tsetLoading(false);\n\t// \t}\n\t// \teslint-disable-next-line react-hooks/exhaustive-deps\n\t// }, [location.pathname]);\n\n\t// useEffect(() => {\n\t// \tsetLoading(true);\n\t// \tinitAuth();\n\t// \tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t// \tif (!storedToken) {\n\t// \t\tsetLoading(false);\n\t// \t\tnavigate(Pathname.LOGIN);\n\t// \t}\n\t// \t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t// }, []);\n\n\tuseEffect(() => {\n\t\tsetLoading(true);\n\t\t// initAuth()\n\t\tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t\tconst storedUser =\n\t\t\tisJsonParse(window.localStorage.getItem(auth.storageUserKeyName)) ?? null;\n\t\tconst publicRoutes = [Pathname.LOGIN, Pathname.FORGOT_PASSWORD, Pathname.RESET_PASSWORD, Pathname.CHANGE_PASSWORD];\n\t\tconst currentPath = window.location.pathname;\n\t\tif (!storedToken && !storedUser) {\n\t\t\tif (!publicRoutes.includes(currentPath)) {\n\t\t\t\tnavigate(Pathname.LOGIN);\n\t\t\t}\n\t\t\tsetLoading(false);\n\t\t} else {\n\t\t\tsetUser(storedUser);\n\t\t\tsetAuthToken(storedToken || '');\n\t\t\tsetLoading(false);\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (!authToken) {\n\t\t\tif (socketRef.current) {\n\t\t\t\tsocketRef.current?.disconnect();\n\t\t\t\tsocketRef.current = null\n\t\t\t}\n\t\t\tconsole.warn(\"No auth token found, not connecting to socket.\");\n\t\t\treturn;\n\t\t}\n\n\t\tconst config = getApiConfig();\n\t\tconst socket = io(config.socketBaseUrl, {\n\t\t\ttransports: [\"websocket\"],\n\t\t\tauth: { token: authToken },\n\t\t\tpath: \"/socket.io/\",\n\n\t\t});\n\t\tsocketRef.current = socket;\n\n\t\tsocket.on(\"connect\", () => {\n\t\t\tconsole.log(\"Socket connected:\", socket.id);\n\t\t\tsocket.onAny((event, ...args) => {\n\t\t\t\tconsole.log(`Received event: ${event}`, args);\n\t\t\t});\n\t\t});\n\n\t\t// socket event handler\n\t\tsocket.on('notification', (data) => {\n\t\t\tconst { message, notificationData } = data || {};\n\t\t\tlet notificationContent: React.ReactNode = message;\n\t\t\tconst url = getNotificationUrl(data);\n\n\t\t\tif (notificationData) {\n\t\t\t\tconst { notification_type } = notificationData;\n\n\t\t\t\tswitch (notification_type) {\n\t\t\t\t\tcase 'addApprovers': {\n\n\t\t\t\t\t\tnotificationContent = message;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'change_approval_status': {\n\t\t\t\t\t\tnotificationContent = message;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tnotificationContent = message;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tenqueueSnackbar(String(message), {\n\t\t\t\tvariant: 'default',\n\t\t\t\tanchorOrigin: { vertical: 'top', horizontal: 'center' },\n\t\t\t\tautoHideDuration: 5000,\n\t\t\t\tcontent: (key) => (\n\t\t\t\t\t<CustomSnackbar snackbarKey={key} message={notificationContent} data={notificationData} variant=\"default\" linkUrl={url} />\n\t\t\t\t),\n\t\t\t});\n\t\t});\n\n\n\t\tsocket.on(\"sales_invoice_viewed\", (data) => {\n\t\t\tconsole.log(\"Invoice viewed:\", data.invoiceId, \"by user:\", data.userId);\n\t\t});\n\n\t\tsocket.on(\"error\", (errMsg) => {\n\t\t\tenqueueSnackbar(`Socket error: ${errMsg}`, { variant: \"error\" });\n\t\t\tconsole.error(\"Socket error:\", errMsg);\n\t\t});\n\n\t\t// Clean up on unmount\n\t\treturn () => {\n\t\t\tif (socketRef.current) {\n\t\t\t\tsocketRef.current.disconnect();\n\t\t\t\tsocketRef.current = null\n\t\t\t}\n\t\t};\n\t}, [authToken]);\n\n\tconst handleLogin = async (\n\t\tparams: LoginFormValues,\n\t\tcallback: (err: string) => void\n\t) => {\n\t\tsetLoading(true);\n\t\tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t\tif (storedToken && user) {\n\t\t\treturn navigate(Pathname.DASHBOARD);\n\t\t}\n\n\t\ttry {\n\t\t\tconst loginUser = await postV1AuthLogin({ ...params, ...getToken() });\n\t\t\tif (loginUser.success) {\n\t\t\t\tconst data: ERPApiUser | null = loginUser?.data?.login || null;\n\t\t\t\tif (data) {\n\t\t\t\t\twindow.localStorage.setItem(auth.storageTokenKeyName, data.token);\n\t\t\t\t\tconst userData: ERPUser = {\n\t\t\t\t\t\t...data,\n\t\t\t\t\t\tfull_name: `${data.first_name} ${data.last_name}`\n\t\t\t\t\t};\n\t\t\t\t\twindow.localStorage.setItem(\n\t\t\t\t\t\tauth.storageUserKeyName,\n\t\t\t\t\t\tJSON.stringify(userData)\n\t\t\t\t\t);\n\t\t\t\t\tsetUser(userData);\n\t\t\t\t\tsetAuthToken(data.token);\n\t\t\t\t\tnavigate(Pathname.DASHBOARD);\n\t\t\t\t\tsetLoading(false);\n\t\t\t\t\tdelete data.token;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t}\n\n\t\t\tcallback(message);\n\t\t}\n\t};\n\n\tconst handleLogout = async () => {\n\t\twindow.localStorage.removeItem(auth.storageTokenKeyName);\n\t\twindow.localStorage.removeItem(auth.storageUserKeyName);\n\t\twindow.localStorage.removeItem(auth.storageAccessKeyName);\n\t\tsetUser(null);\n\t\tsetAuthToken('');\n\t\tnavigate(Pathname.LOGIN);\n\t};\n\n\tconst handleForgotPassword = async (params: resetFormValues,\n\t\tcallback: (type: boolean, err: string) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthForgotPassword({ ...params, ...getToken() });\n\t\t\tcallback(true, \"Reset Link sent to your email\");\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t}\n\n\t\t\tcallback(false, message);\n\t\t}\n\t};\n\n\tconst handleResetPassword = async (params: resetPasswordValues,\n\t\tcallback: (err: string) => void) => {\n\t\ttry {\n\t\t\tconst response = await postV1AuthResetPassword({ ...params, ...getToken() });\n\t\t\tcallback(response);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tconsole.log(\"Error \", error)\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst handleChangePassword = async (params: resetPasswordValues,\n\t\tcallback: (err: string) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthChangePassword({ ...params, ...getToken() });\n\t\t\tcallback(null);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tconsole.log(\"Error \", error)\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message);\n\t\t\t}\n\t\t}\n\t\tcallback(\"reset\");\n\t}\n\n\tconst handleChangeUserPassword = async (params: resetPasswordValues,\n\t\tcallback: (err: string, resType: boolean) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthChangeUserPassword({ ...params, ...getToken() });\n\t\t\tcallback('Password Changed Successfully', true);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message, false);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst handleChangeUserPasswordByAdmin = async (params: changePasswordValues,\n\t\tcallback: (err: string, resType: boolean) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthChangeUserPasswordByAdmin({ ...params, ...getToken() });\n\t\t\tcallback('Password Changed Successfully', true);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message, false);\n\t\t\t}\n\t\t}\n\t}\n\n\n\tconst values = {\n\t\tuser,\n\t\tauthToken,\n\t\tloading,\n\t\tsetUser,\n\t\tsetLoading,\n\t\tlogin: handleLogin,\n\t\tlogout: handleLogout,\n\t\tforgotPassword: handleForgotPassword,\n\t\tresetPassword: handleResetPassword,\n\t\tchangePassword: handleChangePassword,\n\t\tchangeUserPassword: handleChangeUserPassword,\n\t\tchangeUserPasswordByAdmin: handleChangeUserPasswordByAdmin\n\t};\n\n\treturn <AuthContext.Provider value={values}>{children}</AuthContext.Provider>;\n};\n\nexport { AuthContext, AuthProvider };\n"],"names":["PathnameGenerator","PathnameGeneratorInventory","PathnameGeneratorManufacuring","PathnameGeneratorPurchase","_a","RENTALROUTES","PathnameGeneratorCrm","PathnameGeneratorRental"],"mappings":";;;;;;;;;;;;;;;;;;AAuIA,MAAM,kBAAwC;AAAA,EAC7C,MAAM;AAAA,EACN,SAAS;AAAA,EACT,WAAW;AAAA,EACX,SAAS,MAAM;AAAA,EACf,YAAY,MAAM;AAAA,EAClB,OAAO,MAAM,QAAQ,QAAA;AAAA,EACrB,QAAQ,MAAM,QAAQ,QAAA;AAAA,EACtB,gBAAgB,MAAM,QAAQ,QAAA;AAAA,EAC9B,eAAe,MAAM,QAAQ,QAAA;AAAA,EAC7B,gBAAgB,MAAM,QAAQ,QAAA;AAAA,EAC9B,oBAAoB,MAAM,QAAQ,QAAA;AACnC;AAEA,MAAM,cAAc,cAAc,eAAe;AAQjD,MAAM,eAA4C,CAAC,EAAE,eAAe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;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,oBAAoB;AAAA,IACpB,2BAA2B;AAAA,EAAA;AAG5B,6BAAQ,YAAY,UAAZ,EAAqB,OAAO,QAAS,UAAS;AACvD;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("../../api-client/api.rbac/api/index.js"),n=require("../../constants/auth/index.js"),r=require("react-router-dom"),o=require("../../constants/pathnames/pathname/index.js"),s=require("../../utils/common/index.js"),i=require("../../node_modules/notistack/notistack.esm/index.js"),
|
|
2
|
-
return e.jsx(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("../../api-client/api.rbac/api/index.js"),n=require("../../constants/auth/index.js"),r=require("react-router-dom"),o=require("../../constants/pathnames/pathname/index.js"),s=require("../../utils/common/index.js"),i=require("../../node_modules/notistack/notistack.esm/index.js"),u=require("socket.io-client"),c=require("../../utils/route-utils/index.js"),h=require("../../utils/api-config/index.js"),m=require("../../constants/pathnames/pathname.accounting/index.js"),g=require("../../constants/pathnames/pathname.inventory/index.js"),l=require("../../constants/pathnames/pathname.manufacturing/index.js"),d=require("../../constants/pathnames/pathname.procurement/index.js"),P=require("../../constants/pathnames/pathname.crm/index.js"),E=require("../../constants/pathnames/pathname.rental/index.js"),S=require("../../components/custom-snackbar/custom-snackbar/index.js");const R={user:null,loading:!0,authToken:"",setUser:()=>null,setLoading:()=>Boolean,login:()=>Promise.resolve(),logout:()=>Promise.resolve(),forgotPassword:()=>Promise.resolve(),resetPassword:()=>Promise.resolve(),changePassword:()=>Promise.resolve(),changeUserPassword:()=>Promise.resolve()},I=t.createContext(R);exports.AuthContext=I,exports.AuthProvider=({children:_})=>{const[w,W]=t.useState(R.user),[A,p]=t.useState(""),[f,T]=t.useState(R.loading),v=t.useRef(null),N=r.useNavigate(),y=e=>{if(!e)return!1;try{return JSON.parse(e)}catch(t){return!1}};t.useEffect(()=>{T(!0);const e=window.localStorage.getItem(n.auth.storageTokenKeyName),t=y(window.localStorage.getItem(n.auth.storageUserKeyName))??null,a=[o.Pathname.LOGIN,o.Pathname.FORGOT_PASSWORD,o.Pathname.RESET_PASSWORD,o.Pathname.CHANGE_PASSWORD],r=window.location.pathname;e||t?(W(t),p(e||""),T(!1)):(a.includes(r)||N(o.Pathname.LOGIN),T(!1))},[]),t.useEffect(()=>{var t;if(!A)return void(v.current&&(null==(t=v.current)||t.disconnect(),v.current=null));const a=h.getApiConfig(),n=u.io(a.socketBaseUrl,{transports:["websocket"],auth:{token:A},path:"/socket.io/"});return v.current=n,n.on("connect",()=>{n.onAny((e,...t)=>{})}),n.on("notification",t=>{const{message:a,notificationData:n}=t||{};let r=a;const o=(e=>{var t;const{moduleName:a="",moduleId:n="",notificationData:r={}}=e,o={"sales invoice":()=>c.generateRouteWithId(m.PathnameGenerator(m.PathnameAccounting.VIEW_SALES_INVOICES),n.toString()),"asset transfers":()=>c.generateRouteWithId(m.PathnameGenerator(m.PathnameAccounting.VIEW_ASSET_TRANSFER),n.toString()),budgets:()=>c.generateRouteWithId(m.PathnameGenerator(m.PathnameAccounting.VIEW_BUDGET),n.toString()),"cash expense":()=>c.generateRouteWithId(m.PathnameGenerator(m.PathnameAccounting.VIEW_CASH_EXPENSE),n.toString()),"credit notes":()=>c.generateRouteWithId(m.PathnameGenerator(m.PathnameAccounting.VIEW_CREDIT_NOTE),n.toString()),"debit notes":()=>c.generateRouteWithId(m.PathnameGenerator(m.PathnameAccounting.VIEW_DEBIT_NOTE),n.toString()),"expense reimbursement":()=>c.generateRouteWithId(m.PathnameGenerator(m.PathnameAccounting.VIEW_EXPENSE_REIMBURSEMENT),n.toString()),"journal entries":()=>c.generateRouteWithId(m.PathnameGenerator(m.PathnameAccounting.VIEW_JOURNAL_ENTRY),n.toString()),"payment entries":()=>c.generateRouteWithId(m.PathnameGenerator(m.PathnameAccounting.VIEW_PAYMENT_ENTRY),n.toString()),"purchase invoice":()=>c.generateRouteWithId(m.PathnameGenerator(m.PathnameAccounting.VIEW_PURCHASE_INVOICE),n.toString()),"stock transfer":()=>c.generateRouteWithId(g.PathnameGenerator(g.PathnameInventory.VIEW_STOCK_TRANSFER),n.toString()),"bills of materials":()=>c.generateRouteWithId(l.PathnameGenerator(l.PathnameManufacturing.VIEW_BILL_OF_MATERIAL),n.toString()),"purchase agreement":()=>c.generateRouteWithId(d.PathnameGenerator(d.PathnamePurchase.VIEW_PURCHASE_AGREEMENT),n.toString()),"purchase orders":()=>{var e;return c.generateRouteWithId(1==(null==(e=null==r?void 0:r.data)?void 0:e.is_rental)?E.ROUTES.VIEW:d.PathnameGenerator(d.PathnamePurchase.VIEW_PURCHASE_ORDER),n.toString())},"purchase request":()=>c.generateRouteWithId(d.PathnameGenerator(d.PathnamePurchase.VIEW_PURCHASE_ORDER),n.toString()),vra:()=>c.generateRouteWithId(d.PathnameGenerator(d.PathnamePurchase.VIEW_VENDOR_RETURNS),n.toString()),"sl customer returns":()=>c.generateRouteWithId(P.PathnameGenerator(P.PathnameCrm.VIEW_CUSTOMER_RETURNS),n.toString()),"sales order":()=>c.generateRouteWithId(P.PathnameGenerator(P.PathnameCrm.VIEW_SALES_ORDER),n.toString()),"rental order":()=>c.generateRouteWithId(E.PathnameGenerator(E.PathnameRental.VIEW_RENTAL_ORDER),n.toString()),"replacement order":()=>c.generateRouteWithId(E.PathnameGenerator(E.PathnameRental.VIEW_RENTAL_ORDER),n.toString()),"rental agreement":()=>c.generateRouteWithId(E.PathnameGenerator(E.PathnameRental.VIEW_AGREEMENT),n.toString()),"cross hire order":()=>c.generateRouteWithId(E.PathnameGenerator(E.PathnameRental.VIEW_CROSS_HIRE_ORDER),n.toString()),"cross hire request":()=>c.generateRouteWithId(E.PathnameGenerator(E.PathnameRental.VIEW_CROSS_HIRE_REQUEST),n.toString())};return(null==(t=o[a.toLowerCase()])?void 0:t.call(o))||"/dashboard"})(t);if(n){const{notification_type:e}=n;r=a}i.enqueueSnackbar(String(a),{variant:"default",anchorOrigin:{vertical:"top",horizontal:"center"},autoHideDuration:5e3,content:t=>/* @__PURE__ */e.jsx(S.CustomSnackbar,{snackbarKey:t,message:r,data:n,variant:"default",linkUrl:o})})}),n.on("sales_invoice_viewed",e=>{}),n.on("error",e=>{i.enqueueSnackbar(`Socket error: ${e}`,{variant:"error"})}),()=>{v.current&&(v.current.disconnect(),v.current=null)}},[A]);const V={user:w,authToken:A,loading:f,setUser:W,setLoading:T,login:async(e,t)=>{var r;if(T(!0),window.localStorage.getItem(n.auth.storageTokenKeyName)&&w)return N(o.Pathname.DASHBOARD);try{const t=await a.postV1AuthLogin({...e,...s.getToken()});if(t.success){const e=(null==(r=null==t?void 0:t.data)?void 0:r.login)||null;if(e){window.localStorage.setItem(n.auth.storageTokenKeyName,e.token);const t={...e,full_name:`${e.first_name} ${e.last_name}`};window.localStorage.setItem(n.auth.storageUserKeyName,JSON.stringify(t)),W(t),p(e.token),N(o.Pathname.DASHBOARD),T(!1),delete e.token}}}catch(i){let e="Something went wrong";i instanceof Error&&(e=y(i.message).message||i.message),t(e)}},logout:async()=>{window.localStorage.removeItem(n.auth.storageTokenKeyName),window.localStorage.removeItem(n.auth.storageUserKeyName),window.localStorage.removeItem(n.auth.storageAccessKeyName),W(null),p(""),N(o.Pathname.LOGIN)},forgotPassword:async(e,t)=>{try{await a.postV1AuthForgotPassword({...e,...s.getToken()}),t(!0,"Reset Link sent to your email")}catch(n){let e="Something went wrong";n instanceof Error&&(e=y(n.message).message||n.message),t(!1,e)}},resetPassword:async(e,t)=>{try{t(await a.postV1AuthResetPassword({...e,...s.getToken()}))}catch(n){let e="Something went wrong";n instanceof Error&&(e=y(n.message).message||n.message,t(e))}},changePassword:async(e,t)=>{try{await a.postV1AuthChangePassword({...e,...s.getToken()}),t(null)}catch(n){let e="Something went wrong";n instanceof Error&&(e=y(n.message).message||n.message,t(e))}t("reset")},changeUserPassword:async(e,t)=>{try{await a.postV1AuthChangeUserPassword({...e,...s.getToken()}),t("Password Changed Successfully",!0)}catch(n){let e="Something went wrong";n instanceof Error&&(e=y(n.message).message||n.message,t(e,!1))}},changeUserPasswordByAdmin:async(e,t)=>{try{await a.postV1AuthChangeUserPasswordByAdmin({...e,...s.getToken()}),t("Password Changed Successfully",!0)}catch(n){let e="Something went wrong";n instanceof Error&&(e=y(n.message).message||n.message,t(e,!1))}}};/* @__PURE__ */
|
|
2
|
+
return e.jsx(I.Provider,{value:V,children:_})};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/contexts/AuthContext.tsx"],"sourcesContent":["import React, { createContext, useEffect, useRef, useState } from 'react';\nimport {\n\tpostV1AuthChangePassword,\n\tpostV1AuthForgotPassword,\n\tpostV1AuthChangeUserPassword,\n\t// getV1UserId,\n\tpostV1AuthLogin,\n\tpostV1AuthResetPassword,\n\tsetBaseUrl,\n\tpostV1AuthChangeUserPasswordByAdmin\n} from '../api-client/api.rbac/api';\nimport { auth } from '../constants/auth';\nimport { /* useLocation, */ useNavigate } from 'react-router-dom';\nimport { Pathname } from '../constants/pathnames/pathname'; // Removed - should be passed as props or configured by consuming app\nimport { getToken } from '../utils/common';\nimport { enqueueSnackbar } from 'notistack';\nimport { Socket, io } from 'socket.io-client';\nimport { generateRouteWithId } from '../utils/route-utils';\nimport {\n\tPathnameAccounting,\n\tPathnameGenerator\n} from '../constants/pathnames/pathname.accounting';\n\nimport {\n\tPathnameInventory,\n\tPathnameGenerator as PathnameGeneratorInventory\n} from '../constants/pathnames/pathname.inventory';\n\nimport {\n\tPathnameManufacturing,\n\tPathnameGenerator as PathnameGeneratorManufacuring\n} from '../constants/pathnames/pathname.manufacturing';\n\nimport {\n\tPathnamePurchase,\n\tPathnameGenerator as PathnameGeneratorPurchase\n} from '../constants/pathnames/pathname.procurement';\n\nimport {\n\tPathnameCrm,\n\tPathnameGenerator as PathnameGeneratorCrm\n} from '../constants/pathnames/pathname.crm';\n\nimport {\n\tPathnameRental,\n\tPathnameGenerator as PathnameGeneratorRental\n} from '../constants/pathnames/pathname.rental';\n\nimport { ROUTES as RENTALROUTES } from '../constants/pathnames/pathname.rental';\n\nimport CustomSnackbar from '../components/custom-snackbar/custom-snackbar.tsx';\nexport interface LoginFormValues {\n\temail: string;\n\tpassword: string;\n}\n\nexport interface resetFormValues {\n\temail: string;\n}\n\nexport interface resetPasswordValues {\n\ttoken: string;\n}\n\nexport interface changePasswordValues {\n\tpassword: string;\n}\n\nexport interface changeUserPasswordValues {\n\tpassword: string;\n}\n\ninterface ERPApiUser {\n\tid: string | number;\n\tfirst_name: string;\n\tlast_name: string;\n\tmiddle_name: string;\n\tcountry_code: string;\n\temail: string;\n\tcreated_by: any;\n\tupdated_by: any;\n\tcreated_at: string;\n\tupdated_at: string;\n\trole_id: string;\n\tdepartment_id: number;\n\tis_deleted: number;\n\tdeleted_at: string | null;\n\tdeleted_by: any;\n\ttoken: string;\n\tprofile_image: string;\n\tcurrency_data?: {\n\t\tid: number;\n\t\tsymbol: string;\n\t\tcurrency_name: string;\n\t\tnumber_format:string;\n\t\tposition: string | null;\n\t\tfraction_unit: string | null\n\t};\n\taccessCompanies?: any[]\n}\ninterface ERPUser extends Omit<ERPApiUser, 'token'> {\n\tfull_name: string;\n\tcompany_id: string;\n}\n\ninterface DefaultProviderProps {\n\tuser: ERPUser | null;\n\tloading: boolean;\n\tauthToken: string;\n\tsetUser: React.Dispatch<React.SetStateAction<ERPUser | null>>;\n\tsetLoading: React.Dispatch<React.SetStateAction<boolean>>;\n\tlogin: (\n\t\tparams: LoginFormValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tlogout: () => Promise<void>;\n\tforgotPassword: (\n\t\tparams: resetFormValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tresetPassword: (\n\t\tparams: resetPasswordValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tchangePassword: (\n\t\tparams: changePasswordValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tchangeUserPassword: (\n\t\tparams: changeUserPasswordValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n}\n\nconst defaultProvider: DefaultProviderProps = {\n\tuser: null,\n\tloading: true,\n\tauthToken: '',\n\tsetUser: () => null,\n\tsetLoading: () => Boolean,\n\tlogin: () => Promise.resolve(),\n\tlogout: () => Promise.resolve(),\n\tforgotPassword: () => Promise.resolve(),\n\tresetPassword: () => Promise.resolve(),\n\tchangePassword: () => Promise.resolve(),\n\tchangeUserPassword: () => Promise.resolve()\n};\n\nconst AuthContext = createContext(defaultProvider);\n\ninterface AuthProviderProps {\n\tchildren: React.ReactNode;\n}\n\nsetBaseUrl(`${import.meta.env.VITE_BACKEND_BASE_URL}/rbac`);\n\nconst AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {\n\t// ** States\n\tconst [user, setUser] = useState(defaultProvider.user);\n\tconst [authToken, setAuthToken] = useState<string>('');\n\tconst [loading, setLoading] = useState(defaultProvider.loading);\n\tconst socketRef = useRef<Socket | null>(null);\n\n\t// ** Hooks\n\tconst navigate = useNavigate();\n\t// const location = useLocation();\n\tconst isJsonParse = (string?: string | null) => {\n\t\tif (!string) return false;\n\n\t\ttry {\n\t\t\treturn JSON.parse(string);\n\t\t} catch (error) {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tconst getNotificationUrl = (data: any) => {\n\t\tconst { moduleName = '', moduleId = '', notificationData = {} } = data;\n\t\tconst key = moduleName.toLowerCase();\n\n\t\tconst routeMap: Record<string, () => string> = {\n\t\t\t'sales invoice': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_SALES_INVOICES), moduleId.toString()),\n\n\t\t\t'asset transfers': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_ASSET_TRANSFER), moduleId.toString()),\n\n\t\t\t'budgets': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_BUDGET), moduleId.toString()),\n\n\t\t\t'cash expense': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_CASH_EXPENSE), moduleId.toString()),\n\n\t\t\t'credit notes': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_CREDIT_NOTE), moduleId.toString()),\n\n\t\t\t'debit notes': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_DEBIT_NOTE), moduleId.toString()),\n\n\t\t\t'expense reimbursement': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_EXPENSE_REIMBURSEMENT), moduleId.toString()),\n\n\t\t\t'journal entries': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_JOURNAL_ENTRY), moduleId.toString()),\n\n\t\t\t'payment entries': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_PAYMENT_ENTRY), moduleId.toString()),\n\n\t\t\t'purchase invoice': () =>\n\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_PURCHASE_INVOICE), moduleId.toString()),\n\n\t\t\t'stock transfer': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorInventory(PathnameInventory.VIEW_STOCK_TRANSFER), moduleId.toString()),\n\n\t\t\t'bills of materials': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorManufacuring(PathnameManufacturing.VIEW_BILL_OF_MATERIAL), moduleId.toString()),\n\n\t\t\t'purchase agreement': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorPurchase(PathnamePurchase.VIEW_PURCHASE_AGREEMENT), moduleId.toString()),\n\n\t\t\t'purchase orders': () =>\n\t\t\tgenerateRouteWithId(notificationData?.data?.is_rental == 1 ? RENTALROUTES.VIEW : PathnameGeneratorPurchase(PathnamePurchase.VIEW_PURCHASE_ORDER) , moduleId.toString()),\n\n\t\t\t'purchase request': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorPurchase(PathnamePurchase.VIEW_PURCHASE_ORDER), moduleId.toString()),\n\n\t\t\t'vra': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorPurchase(PathnamePurchase.VIEW_VENDOR_RETURNS), moduleId.toString()),\n\n\t\t\t'sl customer returns': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorCrm(PathnameCrm.VIEW_CUSTOMER_RETURNS), moduleId.toString()),\n\n\t\t\t'sales order': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorCrm(PathnameCrm.VIEW_SALES_ORDER), moduleId.toString()),\n\n\t\t\t'rental order': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_RENTAL_ORDER), moduleId.toString()),\n\n\t\t\t'replacement order': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_RENTAL_ORDER), moduleId.toString()),\n\n\t\t\t'rental agreement': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_AGREEMENT), moduleId.toString()),\n\n\t\t\t'cross hire order': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_CROSS_HIRE_ORDER), moduleId.toString()),\n\n\t\t\t'cross hire request': () =>\n\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_CROSS_HIRE_REQUEST), moduleId.toString()),\n\t\t};\n\n\t\treturn routeMap[key]?.() || '/dashboard';\n\t};\n\n\n\t// const initAuth = async () => {\n\t// \tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t// \tconst storedUser: ERPUser =\n\t// \t\tisJsonParse(window.localStorage.getItem(auth.storageUserKeyName)) || null;\n\t// \tif (storedToken && storedUser) {\n\t// \t\ttry {\n\t// \t\t\tconst userData = await getV1UserId({\n\t// \t\t\t\t'x-token': storedToken,\n\t// \t\t\t\tid: String(storedUser.id)\n\t// \t\t\t});\n\t// \t\t} catch (error) {\n\t// \t\t}\n\t// \t} else {\n\t// \t\tsetLoading(false);\n\t// \t}\n\t// \tif (storedToken && storedUser) {\n\t// \t\tsetUser(storedUser);\n\t// setLoading(false);\n\t// \t} else {\n\t// \t\thandleLogout();\n\t// setLoading(false);\n\t// \t}\n\t// };\n\n\t// useEffect(() => {\n\t// setLoading(true)\n\t// \tinitAuth();\n\t// \tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t// \tif (!storedToken) {\n\t// \t\tsetUser(null);\n\t// \t} else {\n\t// \t\tsetLoading(false);\n\t// \t}\n\t// \teslint-disable-next-line react-hooks/exhaustive-deps\n\t// }, [location.pathname]);\n\n\t// useEffect(() => {\n\t// \tsetLoading(true);\n\t// \tinitAuth();\n\t// \tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t// \tif (!storedToken) {\n\t// \t\tsetLoading(false);\n\t// \t\tnavigate(Pathname.LOGIN);\n\t// \t}\n\t// \t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t// }, []);\n\n\tuseEffect(() => {\n\t\tsetLoading(true);\n\t\t// initAuth()\n\t\tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t\tconst storedUser =\n\t\t\tisJsonParse(window.localStorage.getItem(auth.storageUserKeyName)) ?? null;\n\t\tconst publicRoutes = [Pathname.LOGIN, Pathname.FORGOT_PASSWORD, Pathname.RESET_PASSWORD, Pathname.CHANGE_PASSWORD];\n\t\tconst currentPath = window.location.pathname;\n\t\tif (!storedToken && !storedUser) {\n\t\t\tif (!publicRoutes.includes(currentPath)) {\n\t\t\t\tnavigate(Pathname.LOGIN);\n\t\t\t}\n\t\t\tsetLoading(false);\n\t\t} else {\n\t\t\tsetUser(storedUser);\n\t\t\tsetAuthToken(storedToken || '');\n\t\t\tsetLoading(false);\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (!authToken) {\n\t\t\tif (socketRef.current) {\n\t\t\t\tsocketRef.current?.disconnect();\n\t\t\t\tsocketRef.current = null\n\t\t\t}\n\t\t\tconsole.warn(\"No auth token found, not connecting to socket.\");\n\t\t\treturn;\n\t\t}\n\n\t\tconst socket = io(import.meta.env.VITE_SOCKET_BASE_URL, {\n\t\t\ttransports: [\"websocket\"],\n\t\t\tauth: { token: authToken },\n\t\t\tpath: \"/socket.io/\",\n\t\t\t\n\t\t});\n\t\tsocketRef.current = socket;\n\n\t\tsocket.on(\"connect\", () => {\n\t\t\tconsole.log(\"Socket connected:\", socket.id);\n\t\t\tsocket.onAny((event, ...args) => {\n\t\t\t\tconsole.log(`Received event: ${event}`, args);\n\t\t\t});\n\t\t});\n\t\t\n\t\t// socket event handler\n\t\tsocket.on('notification', (data) => {\n\t\tconst { message, notificationData } = data || {};\n\t\tlet notificationContent: React.ReactNode = message;\n\t\tconst url = getNotificationUrl(data);\n\n\t\tif (notificationData) {\n\t\t\tconst { notification_type } = notificationData;\n\n\t\t\tswitch (notification_type) {\n\t\t\t\tcase 'addApprovers': {\n\t\t\t\t\t\n\t\t\t\t\tnotificationContent = message;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 'change_approval_status': {\n\t\t\t\t\tnotificationContent = message;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tnotificationContent = message;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tenqueueSnackbar(String(message), {\n\t\t\tvariant: 'default',\n\t\t\tanchorOrigin: { vertical: 'top', horizontal: 'center' },\n\t\t\tautoHideDuration: 5000,\n\t\t\tcontent: (key) => (\n\t\t\t<CustomSnackbar snackbarKey={key} message={notificationContent} data={notificationData} variant=\"default\" linkUrl={url}/>\n\t\t\t),\n\t\t});\n\t\t});\n\n\n\t\tsocket.on(\"sales_invoice_viewed\", (data) => {\n\t\t\tconsole.log(\"Invoice viewed:\", data.invoiceId, \"by user:\", data.userId);\n\t\t});\n\n\t\tsocket.on(\"error\", (errMsg) => {\n\t\t\tenqueueSnackbar(`Socket error: ${errMsg}`, { variant: \"error\" });\n\t\t\tconsole.error(\"Socket error:\", errMsg);\n\t\t});\n\n\t\t// Clean up on unmount\n\t\treturn () => {\n\t\t\tif (socketRef.current) {\n\t\t\t\tsocketRef.current.disconnect();\n\t\t\t\tsocketRef.current = null\n\t\t\t}\n\t\t};\n\t}, [authToken]);\n\n\tconst handleLogin = async (\n\t\tparams: LoginFormValues,\n\t\tcallback: (err: string) => void\n\t) => {\n\t\tsetLoading(true);\n\t\tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t\tif (storedToken && user) {\n\t\t\treturn navigate(Pathname.DASHBOARD);\n\t\t}\n\n\t\ttry {\n\t\t\tconst loginUser = await postV1AuthLogin({ ...params, ...getToken() });\n\t\t\tif (loginUser.success) {\n\t\t\t\tconst data: ERPApiUser | null = loginUser?.data?.login || null;\n\t\t\t\tif (data) {\n\t\t\t\t\twindow.localStorage.setItem(auth.storageTokenKeyName, data.token);\n\t\t\t\t\tconst userData: ERPUser = {\n\t\t\t\t\t\t...data,\n\t\t\t\t\t\tfull_name: `${data.first_name} ${data.last_name}`\n\t\t\t\t\t};\n\t\t\t\t\twindow.localStorage.setItem(\n\t\t\t\t\t\tauth.storageUserKeyName,\n\t\t\t\t\t\tJSON.stringify(userData)\n\t\t\t\t\t);\n\t\t\t\t\tsetUser(userData);\n\t\t\t\t\tsetAuthToken(data.token);\n\t\t\t\t\tnavigate(Pathname.DASHBOARD);\n\t\t\t\t\tsetLoading(false);\n\t\t\t\t\tdelete data.token;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t}\n\n\t\t\tcallback(message);\n\t\t}\n\t};\n\n\tconst handleLogout = async () => {\n\t\twindow.localStorage.removeItem(auth.storageTokenKeyName);\n\t\twindow.localStorage.removeItem(auth.storageUserKeyName);\n\t\twindow.localStorage.removeItem(auth.storageAccessKeyName);\n\t\tsetUser(null);\n\t\tsetAuthToken('');\n\t\tnavigate(Pathname.LOGIN);\n\t};\n\n\tconst handleForgotPassword = async (params: resetFormValues,\n\t\tcallback: (type: boolean, err: string) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthForgotPassword({ ...params, ...getToken() });\n\t\t\tcallback(true, \"Reset Link sent to your email\");\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t}\n\n\t\t\tcallback(false, message);\n\t\t}\n\t};\n\n\tconst handleResetPassword = async (params: resetPasswordValues,\n\t\tcallback: (err: string) => void) => {\n\t\ttry {\n\t\t\tconst response = await postV1AuthResetPassword({ ...params, ...getToken() });\n\t\t\tcallback(response);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tconsole.log(\"Error \", error)\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst handleChangePassword = async (params: resetPasswordValues,\n\t\tcallback: (err: string) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthChangePassword({ ...params, ...getToken() });\n\t\t\tcallback(null);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tconsole.log(\"Error \", error)\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message);\n\t\t\t}\n\t\t}\n\t\tcallback(\"reset\");\n\t}\n\n\tconst handleChangeUserPassword = async (params: resetPasswordValues,\n\t\tcallback: (err: string, resType: boolean) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthChangeUserPassword({ ...params, ...getToken() });\n\t\t\tcallback('Password Changed Successfully', true);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message, false);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst handleChangeUserPasswordByAdmin = async (params: changePasswordValues,\n\t\tcallback: (err: string, resType: boolean) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthChangeUserPasswordByAdmin({ ...params, ...getToken() });\n\t\t\tcallback('Password Changed Successfully', true);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message, false);\n\t\t\t}\n\t\t}\n\t}\n\n\n\tconst values = {\n\t\tuser,\n\t\tauthToken,\n\t\tloading,\n\t\tsetUser,\n\t\tsetLoading,\n\t\tlogin: handleLogin,\n\t\tlogout: handleLogout,\n\t\tforgotPassword: handleForgotPassword,\n\t\tresetPassword: handleResetPassword,\n\t\tchangePassword: handleChangePassword,\n\t\tchangeUserPassword: handleChangeUserPassword,\n\t\tchangeUserPasswordByAdmin: handleChangeUserPasswordByAdmin\n\t};\n\n\treturn <AuthContext.Provider value={values}>{children}</AuthContext.Provider>;\n};\n\nexport { AuthContext, AuthProvider };\n"],"names":["defaultProvider","user","loading","authToken","setUser","setLoading","Boolean","login","Promise","resolve","logout","forgotPassword","resetPassword","changePassword","changeUserPassword","AuthContext","createContext","setBaseUrl","children","useState","setAuthToken","socketRef","useRef","navigate","useNavigate","isJsonParse","string","JSON","parse","error","useEffect","storedToken","window","localStorage","getItem","auth","storageTokenKeyName","storedUser","storageUserKeyName","publicRoutes","Pathname","LOGIN","FORGOT_PASSWORD","RESET_PASSWORD","CHANGE_PASSWORD","currentPath","location","pathname","includes","current","_a","disconnect","socket","io","transports","token","path","on","onAny","event","args","data","message","notificationData","notificationContent","url","moduleName","moduleId","routeMap","generateRouteWithId","PathnameGenerator","PathnameAccounting","VIEW_SALES_INVOICES","toString","VIEW_ASSET_TRANSFER","budgets","VIEW_BUDGET","VIEW_CASH_EXPENSE","VIEW_CREDIT_NOTE","VIEW_DEBIT_NOTE","VIEW_EXPENSE_REIMBURSEMENT","VIEW_JOURNAL_ENTRY","VIEW_PAYMENT_ENTRY","VIEW_PURCHASE_INVOICE","PathnameGeneratorInventory","PathnameInventory","VIEW_STOCK_TRANSFER","PathnameGeneratorManufacuring","PathnameManufacturing","VIEW_BILL_OF_MATERIAL","PathnameGeneratorPurchase","PathnamePurchase","VIEW_PURCHASE_AGREEMENT","is_rental","RENTALROUTES","VIEW","VIEW_PURCHASE_ORDER","vra","VIEW_VENDOR_RETURNS","PathnameGeneratorCrm","PathnameCrm","VIEW_CUSTOMER_RETURNS","VIEW_SALES_ORDER","PathnameGeneratorRental","PathnameRental","VIEW_RENTAL_ORDER","VIEW_AGREEMENT","VIEW_CROSS_HIRE_ORDER","VIEW_CROSS_HIRE_REQUEST","toLowerCase","call","getNotificationUrl","notification_type","enqueueSnackbar","String","variant","anchorOrigin","vertical","horizontal","autoHideDuration","content","key","jsx","CustomSnackbar","snackbarKey","linkUrl","errMsg","values","async","params","callback","DASHBOARD","loginUser","postV1AuthLogin","getToken","success","setItem","userData","full_name","first_name","last_name","stringify","Error","removeItem","storageAccessKeyName","postV1AuthForgotPassword","postV1AuthResetPassword","postV1AuthChangePassword","postV1AuthChangeUserPassword","changeUserPasswordByAdmin","postV1AuthChangeUserPasswordByAdmin","Provider","value"],"mappings":"67BAsIA,MAAMA,EAAwC,CAC7CC,KAAM,KACNC,SAAS,EACTC,UAAW,GACXC,QAAS,IAAM,KACfC,WAAY,IAAMC,QAClBC,MAAO,IAAMC,QAAQC,UACrBC,OAAQ,IAAMF,QAA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AAA,oCAAoC,IAAKrB,KAAWK,EAAAA,aAC1DJ,EAAS,iCAAiC,EAC3C,OAASrG,GACR,IAAIiC,EAAkB,uBAClBjC,aAAiBiH,QACpBhF,EAAUrC,EAAYI,EAAMiC,SAASA,SAAWjC,EAAMiC,QACtDoE,EAASpE,GAAS,GAEpB;AAmBD,aAAQ/C,EAAYwI,SAAZ,CAAqBC,MAAOzB,EAAS7G"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/contexts/AuthContext.tsx"],"sourcesContent":["import React, { createContext, useEffect, useRef, useState } from 'react';\nimport {\n\tpostV1AuthChangePassword,\n\tpostV1AuthForgotPassword,\n\tpostV1AuthChangeUserPassword,\n\t// getV1UserId,\n\tpostV1AuthLogin,\n\tpostV1AuthResetPassword,\n\tsetBaseUrl,\n\tpostV1AuthChangeUserPasswordByAdmin\n} from '../api-client/api.rbac/api';\nimport { auth } from '../constants/auth';\nimport { /* useLocation, */ useNavigate } from 'react-router-dom';\nimport { Pathname } from '../constants/pathnames/pathname'; // Removed - should be passed as props or configured by consuming app\nimport { getToken } from '../utils/common';\nimport { enqueueSnackbar } from 'notistack';\nimport { Socket, io } from 'socket.io-client';\nimport { generateRouteWithId } from '../utils/route-utils';\nimport { getApiConfig } from '../utils/api-config';\nimport {\n\tPathnameAccounting,\n\tPathnameGenerator\n} from '../constants/pathnames/pathname.accounting';\n\nimport {\n\tPathnameInventory,\n\tPathnameGenerator as PathnameGeneratorInventory\n} from '../constants/pathnames/pathname.inventory';\n\nimport {\n\tPathnameManufacturing,\n\tPathnameGenerator as PathnameGeneratorManufacuring\n} from '../constants/pathnames/pathname.manufacturing';\n\nimport {\n\tPathnamePurchase,\n\tPathnameGenerator as PathnameGeneratorPurchase\n} from '../constants/pathnames/pathname.procurement';\n\nimport {\n\tPathnameCrm,\n\tPathnameGenerator as PathnameGeneratorCrm\n} from '../constants/pathnames/pathname.crm';\n\nimport {\n\tPathnameRental,\n\tPathnameGenerator as PathnameGeneratorRental\n} from '../constants/pathnames/pathname.rental';\n\nimport { ROUTES as RENTALROUTES } from '../constants/pathnames/pathname.rental';\n\nimport CustomSnackbar from '../components/custom-snackbar/custom-snackbar.tsx';\nexport interface LoginFormValues {\n\temail: string;\n\tpassword: string;\n}\n\nexport interface resetFormValues {\n\temail: string;\n}\n\nexport interface resetPasswordValues {\n\ttoken: string;\n}\n\nexport interface changePasswordValues {\n\tpassword: string;\n}\n\nexport interface changeUserPasswordValues {\n\tpassword: string;\n}\n\ninterface ERPApiUser {\n\tid: string | number;\n\tfirst_name: string;\n\tlast_name: string;\n\tmiddle_name: string;\n\tcountry_code: string;\n\temail: string;\n\tcreated_by: any;\n\tupdated_by: any;\n\tcreated_at: string;\n\tupdated_at: string;\n\trole_id: string;\n\tdepartment_id: number;\n\tis_deleted: number;\n\tdeleted_at: string | null;\n\tdeleted_by: any;\n\ttoken: string;\n\tprofile_image: string;\n\tcurrency_data?: {\n\t\tid: number;\n\t\tsymbol: string;\n\t\tcurrency_name: string;\n\t\tnumber_format: string;\n\t\tposition: string | null;\n\t\tfraction_unit: string | null\n\t};\n\taccessCompanies?: any[]\n}\ninterface ERPUser extends Omit<ERPApiUser, 'token'> {\n\tfull_name: string;\n\tcompany_id: string;\n}\n\ninterface DefaultProviderProps {\n\tuser: ERPUser | null;\n\tloading: boolean;\n\tauthToken: string;\n\tsetUser: React.Dispatch<React.SetStateAction<ERPUser | null>>;\n\tsetLoading: React.Dispatch<React.SetStateAction<boolean>>;\n\tlogin: (\n\t\tparams: LoginFormValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tlogout: () => Promise<void>;\n\tforgotPassword: (\n\t\tparams: resetFormValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tresetPassword: (\n\t\tparams: resetPasswordValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tchangePassword: (\n\t\tparams: changePasswordValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n\tchangeUserPassword: (\n\t\tparams: changeUserPasswordValues,\n\t\tcallback: (err: string) => void\n\t) => Promise<void>;\n}\n\nconst defaultProvider: DefaultProviderProps = {\n\tuser: null,\n\tloading: true,\n\tauthToken: '',\n\tsetUser: () => null,\n\tsetLoading: () => Boolean,\n\tlogin: () => Promise.resolve(),\n\tlogout: () => Promise.resolve(),\n\tforgotPassword: () => Promise.resolve(),\n\tresetPassword: () => Promise.resolve(),\n\tchangePassword: () => Promise.resolve(),\n\tchangeUserPassword: () => Promise.resolve()\n};\n\nconst AuthContext = createContext(defaultProvider);\n\ninterface AuthProviderProps {\n\tchildren: React.ReactNode;\n}\n\n// Base URL will be set at runtime via ERPUIProvider\n\nconst AuthProvider: React.FC<AuthProviderProps> = ({ children }) => {\n\t// ** States\n\tconst [user, setUser] = useState(defaultProvider.user);\n\tconst [authToken, setAuthToken] = useState<string>('');\n\tconst [loading, setLoading] = useState(defaultProvider.loading);\n\tconst socketRef = useRef<Socket | null>(null);\n\n\t// ** Hooks\n\tconst navigate = useNavigate();\n\t// const location = useLocation();\n\tconst isJsonParse = (string?: string | null) => {\n\t\tif (!string) return false;\n\n\t\ttry {\n\t\t\treturn JSON.parse(string);\n\t\t} catch (error) {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tconst getNotificationUrl = (data: any) => {\n\t\tconst { moduleName = '', moduleId = '', notificationData = {} } = data;\n\t\tconst key = moduleName.toLowerCase();\n\n\t\tconst routeMap: Record<string, () => string> = {\n\t\t\t'sales invoice': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_SALES_INVOICES), moduleId.toString()),\n\n\t\t\t'asset transfers': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_ASSET_TRANSFER), moduleId.toString()),\n\n\t\t\t'budgets': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_BUDGET), moduleId.toString()),\n\n\t\t\t'cash expense': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_CASH_EXPENSE), moduleId.toString()),\n\n\t\t\t'credit notes': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_CREDIT_NOTE), moduleId.toString()),\n\n\t\t\t'debit notes': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_DEBIT_NOTE), moduleId.toString()),\n\n\t\t\t'expense reimbursement': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_EXPENSE_REIMBURSEMENT), moduleId.toString()),\n\n\t\t\t'journal entries': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_JOURNAL_ENTRY), moduleId.toString()),\n\n\t\t\t'payment entries': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_PAYMENT_ENTRY), moduleId.toString()),\n\n\t\t\t'purchase invoice': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGenerator(PathnameAccounting.VIEW_PURCHASE_INVOICE), moduleId.toString()),\n\n\t\t\t'stock transfer': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorInventory(PathnameInventory.VIEW_STOCK_TRANSFER), moduleId.toString()),\n\n\t\t\t'bills of materials': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorManufacuring(PathnameManufacturing.VIEW_BILL_OF_MATERIAL), moduleId.toString()),\n\n\t\t\t'purchase agreement': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorPurchase(PathnamePurchase.VIEW_PURCHASE_AGREEMENT), moduleId.toString()),\n\n\t\t\t'purchase orders': () =>\n\t\t\t\tgenerateRouteWithId(notificationData?.data?.is_rental == 1 ? RENTALROUTES.VIEW : PathnameGeneratorPurchase(PathnamePurchase.VIEW_PURCHASE_ORDER), moduleId.toString()),\n\n\t\t\t'purchase request': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorPurchase(PathnamePurchase.VIEW_PURCHASE_ORDER), moduleId.toString()),\n\n\t\t\t'vra': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorPurchase(PathnamePurchase.VIEW_VENDOR_RETURNS), moduleId.toString()),\n\n\t\t\t'sl customer returns': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorCrm(PathnameCrm.VIEW_CUSTOMER_RETURNS), moduleId.toString()),\n\n\t\t\t'sales order': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorCrm(PathnameCrm.VIEW_SALES_ORDER), moduleId.toString()),\n\n\t\t\t'rental order': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_RENTAL_ORDER), moduleId.toString()),\n\n\t\t\t'replacement order': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_RENTAL_ORDER), moduleId.toString()),\n\n\t\t\t'rental agreement': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_AGREEMENT), moduleId.toString()),\n\n\t\t\t'cross hire order': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_CROSS_HIRE_ORDER), moduleId.toString()),\n\n\t\t\t'cross hire request': () =>\n\t\t\t\tgenerateRouteWithId(PathnameGeneratorRental(PathnameRental.VIEW_CROSS_HIRE_REQUEST), moduleId.toString()),\n\t\t};\n\n\t\treturn routeMap[key]?.() || '/dashboard';\n\t};\n\n\n\t// const initAuth = async () => {\n\t// \tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t// \tconst storedUser: ERPUser =\n\t// \t\tisJsonParse(window.localStorage.getItem(auth.storageUserKeyName)) || null;\n\t// \tif (storedToken && storedUser) {\n\t// \t\ttry {\n\t// \t\t\tconst userData = await getV1UserId({\n\t// \t\t\t\t'x-token': storedToken,\n\t// \t\t\t\tid: String(storedUser.id)\n\t// \t\t\t});\n\t// \t\t} catch (error) {\n\t// \t\t}\n\t// \t} else {\n\t// \t\tsetLoading(false);\n\t// \t}\n\t// \tif (storedToken && storedUser) {\n\t// \t\tsetUser(storedUser);\n\t// setLoading(false);\n\t// \t} else {\n\t// \t\thandleLogout();\n\t// setLoading(false);\n\t// \t}\n\t// };\n\n\t// useEffect(() => {\n\t// setLoading(true)\n\t// \tinitAuth();\n\t// \tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t// \tif (!storedToken) {\n\t// \t\tsetUser(null);\n\t// \t} else {\n\t// \t\tsetLoading(false);\n\t// \t}\n\t// \teslint-disable-next-line react-hooks/exhaustive-deps\n\t// }, [location.pathname]);\n\n\t// useEffect(() => {\n\t// \tsetLoading(true);\n\t// \tinitAuth();\n\t// \tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t// \tif (!storedToken) {\n\t// \t\tsetLoading(false);\n\t// \t\tnavigate(Pathname.LOGIN);\n\t// \t}\n\t// \t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t// }, []);\n\n\tuseEffect(() => {\n\t\tsetLoading(true);\n\t\t// initAuth()\n\t\tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t\tconst storedUser =\n\t\t\tisJsonParse(window.localStorage.getItem(auth.storageUserKeyName)) ?? null;\n\t\tconst publicRoutes = [Pathname.LOGIN, Pathname.FORGOT_PASSWORD, Pathname.RESET_PASSWORD, Pathname.CHANGE_PASSWORD];\n\t\tconst currentPath = window.location.pathname;\n\t\tif (!storedToken && !storedUser) {\n\t\t\tif (!publicRoutes.includes(currentPath)) {\n\t\t\t\tnavigate(Pathname.LOGIN);\n\t\t\t}\n\t\t\tsetLoading(false);\n\t\t} else {\n\t\t\tsetUser(storedUser);\n\t\t\tsetAuthToken(storedToken || '');\n\t\t\tsetLoading(false);\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (!authToken) {\n\t\t\tif (socketRef.current) {\n\t\t\t\tsocketRef.current?.disconnect();\n\t\t\t\tsocketRef.current = null\n\t\t\t}\n\t\t\tconsole.warn(\"No auth token found, not connecting to socket.\");\n\t\t\treturn;\n\t\t}\n\n\t\tconst config = getApiConfig();\n\t\tconst socket = io(config.socketBaseUrl, {\n\t\t\ttransports: [\"websocket\"],\n\t\t\tauth: { token: authToken },\n\t\t\tpath: \"/socket.io/\",\n\n\t\t});\n\t\tsocketRef.current = socket;\n\n\t\tsocket.on(\"connect\", () => {\n\t\t\tconsole.log(\"Socket connected:\", socket.id);\n\t\t\tsocket.onAny((event, ...args) => {\n\t\t\t\tconsole.log(`Received event: ${event}`, args);\n\t\t\t});\n\t\t});\n\n\t\t// socket event handler\n\t\tsocket.on('notification', (data) => {\n\t\t\tconst { message, notificationData } = data || {};\n\t\t\tlet notificationContent: React.ReactNode = message;\n\t\t\tconst url = getNotificationUrl(data);\n\n\t\t\tif (notificationData) {\n\t\t\t\tconst { notification_type } = notificationData;\n\n\t\t\t\tswitch (notification_type) {\n\t\t\t\t\tcase 'addApprovers': {\n\n\t\t\t\t\t\tnotificationContent = message;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcase 'change_approval_status': {\n\t\t\t\t\t\tnotificationContent = message;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tnotificationContent = message;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tenqueueSnackbar(String(message), {\n\t\t\t\tvariant: 'default',\n\t\t\t\tanchorOrigin: { vertical: 'top', horizontal: 'center' },\n\t\t\t\tautoHideDuration: 5000,\n\t\t\t\tcontent: (key) => (\n\t\t\t\t\t<CustomSnackbar snackbarKey={key} message={notificationContent} data={notificationData} variant=\"default\" linkUrl={url} />\n\t\t\t\t),\n\t\t\t});\n\t\t});\n\n\n\t\tsocket.on(\"sales_invoice_viewed\", (data) => {\n\t\t\tconsole.log(\"Invoice viewed:\", data.invoiceId, \"by user:\", data.userId);\n\t\t});\n\n\t\tsocket.on(\"error\", (errMsg) => {\n\t\t\tenqueueSnackbar(`Socket error: ${errMsg}`, { variant: \"error\" });\n\t\t\tconsole.error(\"Socket error:\", errMsg);\n\t\t});\n\n\t\t// Clean up on unmount\n\t\treturn () => {\n\t\t\tif (socketRef.current) {\n\t\t\t\tsocketRef.current.disconnect();\n\t\t\t\tsocketRef.current = null\n\t\t\t}\n\t\t};\n\t}, [authToken]);\n\n\tconst handleLogin = async (\n\t\tparams: LoginFormValues,\n\t\tcallback: (err: string) => void\n\t) => {\n\t\tsetLoading(true);\n\t\tconst storedToken = window.localStorage.getItem(auth.storageTokenKeyName);\n\t\tif (storedToken && user) {\n\t\t\treturn navigate(Pathname.DASHBOARD);\n\t\t}\n\n\t\ttry {\n\t\t\tconst loginUser = await postV1AuthLogin({ ...params, ...getToken() });\n\t\t\tif (loginUser.success) {\n\t\t\t\tconst data: ERPApiUser | null = loginUser?.data?.login || null;\n\t\t\t\tif (data) {\n\t\t\t\t\twindow.localStorage.setItem(auth.storageTokenKeyName, data.token);\n\t\t\t\t\tconst userData: ERPUser = {\n\t\t\t\t\t\t...data,\n\t\t\t\t\t\tfull_name: `${data.first_name} ${data.last_name}`\n\t\t\t\t\t};\n\t\t\t\t\twindow.localStorage.setItem(\n\t\t\t\t\t\tauth.storageUserKeyName,\n\t\t\t\t\t\tJSON.stringify(userData)\n\t\t\t\t\t);\n\t\t\t\t\tsetUser(userData);\n\t\t\t\t\tsetAuthToken(data.token);\n\t\t\t\t\tnavigate(Pathname.DASHBOARD);\n\t\t\t\t\tsetLoading(false);\n\t\t\t\t\tdelete data.token;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t}\n\n\t\t\tcallback(message);\n\t\t}\n\t};\n\n\tconst handleLogout = async () => {\n\t\twindow.localStorage.removeItem(auth.storageTokenKeyName);\n\t\twindow.localStorage.removeItem(auth.storageUserKeyName);\n\t\twindow.localStorage.removeItem(auth.storageAccessKeyName);\n\t\tsetUser(null);\n\t\tsetAuthToken('');\n\t\tnavigate(Pathname.LOGIN);\n\t};\n\n\tconst handleForgotPassword = async (params: resetFormValues,\n\t\tcallback: (type: boolean, err: string) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthForgotPassword({ ...params, ...getToken() });\n\t\t\tcallback(true, \"Reset Link sent to your email\");\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t}\n\n\t\t\tcallback(false, message);\n\t\t}\n\t};\n\n\tconst handleResetPassword = async (params: resetPasswordValues,\n\t\tcallback: (err: string) => void) => {\n\t\ttry {\n\t\t\tconst response = await postV1AuthResetPassword({ ...params, ...getToken() });\n\t\t\tcallback(response);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tconsole.log(\"Error \", error)\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst handleChangePassword = async (params: resetPasswordValues,\n\t\tcallback: (err: string) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthChangePassword({ ...params, ...getToken() });\n\t\t\tcallback(null);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tconsole.log(\"Error \", error)\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message);\n\t\t\t}\n\t\t}\n\t\tcallback(\"reset\");\n\t}\n\n\tconst handleChangeUserPassword = async (params: resetPasswordValues,\n\t\tcallback: (err: string, resType: boolean) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthChangeUserPassword({ ...params, ...getToken() });\n\t\t\tcallback('Password Changed Successfully', true);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message, false);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst handleChangeUserPasswordByAdmin = async (params: changePasswordValues,\n\t\tcallback: (err: string, resType: boolean) => void) => {\n\t\ttry {\n\t\t\tawait postV1AuthChangeUserPasswordByAdmin({ ...params, ...getToken() });\n\t\t\tcallback('Password Changed Successfully', true);\n\t\t} catch (error) {\n\t\t\tlet message: string = 'Something went wrong';\n\t\t\tif (error instanceof Error) {\n\t\t\t\tmessage = isJsonParse(error.message).message || error.message;\n\t\t\t\tcallback(message, false);\n\t\t\t}\n\t\t}\n\t}\n\n\n\tconst values = {\n\t\tuser,\n\t\tauthToken,\n\t\tloading,\n\t\tsetUser,\n\t\tsetLoading,\n\t\tlogin: handleLogin,\n\t\tlogout: handleLogout,\n\t\tforgotPassword: handleForgotPassword,\n\t\tresetPassword: handleResetPassword,\n\t\tchangePassword: handleChangePassword,\n\t\tchangeUserPassword: handleChangeUserPassword,\n\t\tchangeUserPasswordByAdmin: handleChangeUserPasswordByAdmin\n\t};\n\n\treturn <AuthContext.Provider value={values}>{children}</AuthContext.Provider>;\n};\n\nexport { AuthContext, AuthProvider };\n"],"names":["defaultProvider","user","loading","authToken","setUser","setLoading","Boolean","login","Promise","resolve","logout","forgotPassword","resetPassword","changePassword","changeUserPassword","AuthContext","createContext","children","useState","setAuthToken","socketRef","useRef","navigate","useNavigate","isJsonParse","string","JSON","parse","error","useEffect","storedToken","window","localStorage","getItem","auth","storageTokenKeyName","storedUser","storageUserKeyName","publicRoutes","Pathname","LOGIN","FORGOT_PASSWORD","RESET_PASSWORD","CHANGE_PASSWORD","currentPath","location","pathname","includes","current","_a","disconnect","config","getApiConfig","socket","io","socketBaseUrl","transports","token","path","on","onAny","event","args","data","message","notificationData","notificationContent","url","moduleName","moduleId","routeMap","generateRouteWithId","PathnameGenerator","PathnameAccounting","VIEW_SALES_INVOICES","toString","VIEW_ASSET_TRANSFER","budgets","VIEW_BUDGET","VIEW_CASH_EXPENSE","VIEW_CREDIT_NOTE","VIEW_DEBIT_NOTE","VIEW_EXPENSE_REIMBURSEMENT","VIEW_JOURNAL_ENTRY","VIEW_PAYMENT_ENTRY","VIEW_PURCHASE_INVOICE","PathnameGeneratorInventory","PathnameInventory","VIEW_STOCK_TRANSFER","PathnameGeneratorManufacuring","PathnameManufacturing","VIEW_BILL_OF_MATERIAL","PathnameGeneratorPurchase","PathnamePurchase","VIEW_PURCHASE_AGREEMENT","is_rental","RENTALROUTES","VIEW","VIEW_PURCHASE_ORDER","vra","VIEW_VENDOR_RETURNS","PathnameGeneratorCrm","PathnameCrm","VIEW_CUSTOMER_RETURNS","VIEW_SALES_ORDER","PathnameGeneratorRental","PathnameRental","VIEW_RENTAL_ORDER","VIEW_AGREEMENT","VIEW_CROSS_HIRE_ORDER","VIEW_CROSS_HIRE_REQUEST","toLowerCase","call","getNotificationUrl","notification_type","enqueueSnackbar","String","variant","anchorOrigin","vertical","horizontal","autoHideDuration","content","key","jsx","CustomSnackbar","snackbarKey","linkUrl","errMsg","values","async","params","callback","DASHBOARD","loginUser","postV1AuthLogin","getToken","success","setItem","userData","full_name","first_name","last_name","stringify","Error","removeItem","storageAccessKeyName","postV1AuthForgotPassword","postV1AuthResetPassword","postV1AuthChangePassword","postV1AuthChangeUserPassword","changeUserPasswordByAdmin","postV1AuthChangeUserPasswordByAdmin","Provider","value"],"mappings":"0+BAuIA,MAAMA,EAAwC,CAC7CC,KAAM,KACNC,SAAS,EACTC,UAAW,GACXC,QAAS,IAAM,KACfC,WAAY,IAAMC,QAClBC,MAAO,IAAMC,QAAQC,UACrBC,OAAQ,IAAMF,QAAQC,UACtBE,eAAgB,IAAMH,QAAQC,UAC9BG,cAAe,IAAMJ,QAAQC,UAC7BI,eAAgB,IAAML,QAAQC,UAC9BK,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B,uBAClBpC,aAAiBoH,QACpBhF,EAAUxC,EAAYI,EAAMoC,SAASA,SAAWpC,EAAMoC,QACtDoE,EAASpE,GAAS,GAEpB;AAmBD,aAAQjD,EAAY0I,SAAZ,CAAqBC,MAAOzB,EAAShH"}
|
|
@@ -5,6 +5,7 @@ import { DEFAULT_LANG } from "../../constants/all-language/index.esm.js";
|
|
|
5
5
|
import { getToken } from "../../utils/common/index.esm.js";
|
|
6
6
|
import { setBaseUrl } from "../../api-client/api.rbac/api/index.esm.js";
|
|
7
7
|
import { getV1Languages } from "../../api-client/api.system-feature/api/index.esm.js";
|
|
8
|
+
import { getApiConfig } from "../../utils/api-config/index.esm.js";
|
|
8
9
|
const FALLBACK_LANGUAGES = [
|
|
9
10
|
"en",
|
|
10
11
|
// English as primary fallback
|
|
@@ -80,7 +81,7 @@ const LanguageProvider = ({ children }) => {
|
|
|
80
81
|
const [state, dispatch] = useReducer(languageReducer, initialState);
|
|
81
82
|
const { i18n } = useTranslation();
|
|
82
83
|
useEffect(() => {
|
|
83
|
-
setBaseUrl(`${
|
|
84
|
+
setBaseUrl(`${getApiConfig().backendBaseUrl}/rbac`);
|
|
84
85
|
}, []);
|
|
85
86
|
const safeChangeLanguage = async (langCode) => {
|
|
86
87
|
if (i18n && typeof i18n.changeLanguage === "function") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../src/contexts/languageContext.tsx"],"sourcesContent":["// contexts/LanguageContext.tsx\nimport React, { createContext, useEffect, useReducer, ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { DEFAULT_LANG } from '../constants/all-language';\nimport { getToken } from '../utils/common';\nimport { setRoleURL } from '../utils/server';\nimport { getV1Languages } from '../api-client/api.system-feature/api';\n// import ErpLoader from '../components/loader/erp-loader';\n\n// Types\ninterface ILanguage {\n label: string;\n code: string;\n direction: string;\n}\n\ninterface LanguageState {\n languages: ILanguage[];\n currentLanguage: ILanguage | null;\n isLoading: boolean;\n error: string | null;\n isFallbackActive: boolean; // Track if we're using fallback\n}\n\ninterface LanguageContextType extends LanguageState {\n changeLanguage: (langCode: string) => void;\n fetchLanguages: () => Promise<void>;\n}\n\n// Define fallback languages in order of preference - English first\nconst FALLBACK_LANGUAGES = [\n 'en', // English as primary fallback\n 'en-US', // US English as secondary\n DEFAULT_LANG, // Then default language\n];\n\n// Create English fallback language object\nconst createEnglishFallback = (): ILanguage => ({\n code: 'en',\n label: 'English',\n direction: 'ltr'\n});\n\n// Action types\ntype LanguageAction =\n | { type: 'FETCH_LANGUAGES_START' }\n | { type: 'FETCH_LANGUAGES_SUCCESS'; payload: ILanguage[] }\n | { type: 'FETCH_LANGUAGES_ERROR'; payload: string }\n | { type: 'SET_CURRENT_LANGUAGE'; payload: ILanguage; isFallback?: boolean }\n | { type: 'SET_FALLBACK_ACTIVE'; payload: boolean };\n\n// Initial state\nconst initialState: LanguageState = {\n languages: [],\n currentLanguage: null,\n isLoading: false,\n error: null,\n isFallbackActive: false,\n};\n\n// Helper function to find the best available language\nconst findBestAvailableLanguage = (\n languages: ILanguage[], \n preferredCode?: string\n): ILanguage | null => {\n if (!languages || languages.length === 0) return null;\n\n // First try the preferred language if provided\n if (preferredCode) {\n const preferred = languages.find(lang => lang.code === preferredCode);\n if (preferred) return preferred;\n }\n\n // Try fallback languages in order (English first)\n for (const fallbackCode of FALLBACK_LANGUAGES) {\n const fallback = languages.find(lang => lang.code === fallbackCode);\n if (fallback) return fallback;\n }\n\n // If no fallbacks found, return the first available language\n return languages[0] || null;\n};\n\n// Reducer\nconst languageReducer = (state: LanguageState, action: LanguageAction): LanguageState => {\n switch (action.type) {\n case 'FETCH_LANGUAGES_START':\n return {\n ...state,\n isLoading: true,\n error: null,\n };\n case 'FETCH_LANGUAGES_SUCCESS':\n return {\n ...state,\n languages: action.payload,\n isLoading: false,\n error: null,\n isFallbackActive: false,\n };\n case 'FETCH_LANGUAGES_ERROR':\n return {\n ...state,\n isLoading: false,\n error: action.payload,\n isFallbackActive: true, \n };\n case 'SET_CURRENT_LANGUAGE':\n return {\n ...state,\n currentLanguage: action.payload,\n isFallbackActive: action.isFallback || false,\n };\n case 'SET_FALLBACK_ACTIVE':\n return {\n ...state,\n isFallbackActive: action.payload,\n };\n default:\n return state;\n }\n};\n\n// Create context\nconst LanguageContext = createContext<LanguageContextType | undefined>(undefined);\n\n// Provider component\ninterface LanguageProviderProps {\n children: ReactNode;\n}\n\nexport const LanguageProvider: React.FC<LanguageProviderProps> = ({ children }) => {\n const [state, dispatch] = useReducer(languageReducer, initialState);\n const { i18n } = useTranslation();\n\n // Initialize role URL\n useEffect(() => {\n setRoleURL(`${import.meta.env.VITE_BACKEND_BASE_URL}/rbac`);\n }, []);\n\n // Guarded i18n changeLanguage call\n const safeChangeLanguage = async (langCode: string) => {\n if (i18n && typeof i18n.changeLanguage === 'function') {\n try {\n await i18n.changeLanguage(langCode);\n } catch (error) {\n console.warn(`Failed to change language to \"${langCode}\"`, error);\n }\n } else {\n console.warn(\n 'i18n.changeLanguage is unavailable. Ensure I18nextProvider is configured in the host application.'\n );\n }\n };\n\n // Apply language settings\n const applyLanguageSettings = (language: ILanguage) => {\n document.body.dir = language.direction || 'ltr';\n safeChangeLanguage(language.code);\n localStorage.setItem('_language', language.code);\n };\n\n // Fetch languages from API\n const fetchLanguages = async (): Promise<void> => {\n try {\n dispatch({ type: 'FETCH_LANGUAGES_START' });\n \n const response = await getV1Languages({\n order: `id:1`,\n filters: `(is_active.in=[1])`,\n ...getToken(),\n });\n \n const data = response?.data?.languages || [];\n const languages = data\n ?.filter((d: any) => d?.is_active)\n ?.map((d: any) => ({\n label: d?.name,\n code: d?.code,\n direction: d?.direction,\n }));\n\n // Always ensure English is available in the languages list\n const hasEnglish = languages.some((lang: ILanguage) => lang.code === 'en');\n if (!hasEnglish) {\n languages.unshift(createEnglishFallback());\n }\n\n dispatch({ type: 'FETCH_LANGUAGES_SUCCESS', payload: languages });\n \n // Get saved language or use fallback\n const savedLangCode = localStorage.getItem('_language');\n const bestLanguage = findBestAvailableLanguage(languages, savedLangCode || undefined);\n \n if (bestLanguage) {\n const isFallback = savedLangCode && savedLangCode !== bestLanguage.code;\n dispatch({ \n type: 'SET_CURRENT_LANGUAGE', \n payload: bestLanguage,\n isFallback \n });\n applyLanguageSettings(bestLanguage);\n \n // Log if we're using a fallback\n if (isFallback) {\n console.warn(`Saved language \"${savedLangCode}\" not available. Using fallback: \"${bestLanguage.code}\"`);\n }\n } else {\n console.error('No languages available');\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Failed to fetch languages';\n dispatch({ type: 'FETCH_LANGUAGES_ERROR', payload: errorMessage });\n \n // On error, always fall back to English\n const englishFallback = createEnglishFallback();\n \n // Create languages array with English fallback for dropdown\n const fallbackLanguages = [englishFallback];\n \n dispatch({ type: 'FETCH_LANGUAGES_SUCCESS', payload: fallbackLanguages });\n dispatch({ \n type: 'SET_CURRENT_LANGUAGE', \n payload: englishFallback,\n isFallback: true \n });\n \n document.body.dir = 'ltr';\n safeChangeLanguage('en');\n localStorage.setItem('_language', 'en');\n \n console.warn('Language fetch failed, using English fallback');\n }\n };\n\n // Change language function\n const changeLanguage = (langCode: string): void => {\n const selectedLanguage = state.languages.find((lang) => lang.code === langCode);\n \n if (selectedLanguage) {\n dispatch({ type: 'SET_CURRENT_LANGUAGE', payload: selectedLanguage });\n dispatch({ type: 'SET_FALLBACK_ACTIVE', payload: false });\n applyLanguageSettings(selectedLanguage);\n } else {\n console.error(`Language \"${langCode}\" not found in available languages`);\n \n // If language not found, fall back to English\n const englishFallback = createEnglishFallback();\n dispatch({ \n type: 'SET_CURRENT_LANGUAGE', \n payload: englishFallback,\n isFallback: true \n });\n applyLanguageSettings(englishFallback);\n }\n };\n\n // Initialize on mount\n useEffect(() => {\n fetchLanguages();\n //eslint-disable-next-line \n }, []);\n\n const contextValue: LanguageContextType = {\n ...state,\n changeLanguage,\n fetchLanguages,\n };\n\n return (\n <LanguageContext.Provider value={contextValue}>\n {/* {state.isLoading } */}\n {children}\n </LanguageContext.Provider>\n );\n};\n\nexport { LanguageContext };\nexport default LanguageContext;"],"names":["setRoleURL"],"mappings":";;;;;;;AA8BA,MAAM,qBAAqB;AAAA,EACzB;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF;AAGA,MAAM,wBAAwB,OAAkB;AAAA,EAC9C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,WAAW;AACb;AAWA,MAAM,eAA8B;AAAA,EAClC,WAAW,CAAA;AAAA,EACX,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,OAAO;AAAA,EACP,kBAAkB;AACpB;AAGA,MAAM,4BAA4B,CAChC,WACA,kBACqB;AACrB,MAAI,CAAC,aAAa,UAAU,WAAW,EAAG,QAAO;AAGjD,MAAI,eAAe;AACjB,UAAM,YAAY,UAAU,KAAK,CAAA,SAAQ,KAAK,SAAS,aAAa;AACpE,QAAI,UAAW,QAAO;AAAA,EACxB;AAGA,aAAW,gBAAgB,oBAAoB;AAC7C,UAAM,WAAW,UAAU,KAAK,CAAA,SAAQ,KAAK,SAAS,YAAY;AAClE,QAAI,SAAU,QAAO;AAAA,EACvB;AAGA,SAAO,UAAU,CAAC,KAAK;AACzB;AAGA,MAAM,kBAAkB,CAAC,OAAsB,WAA0C;AACvF,UAAQ,OAAO,MAAA;AAAA,IACb,KAAK;AACH,aAAO;AAAA,QACL,GAAG;AAAA,QACH,WAAW;AAAA,QACX,OAAO;AAAA,MAAA;AAAA,IAEX,KAAK;AACH,aAAO;AAAA,QACL,GAAG;AAAA,QACH,WAAW,OAAO;AAAA,QAClB,WAAW;AAAA,QACX,OAAO;AAAA,QACP,kBAAkB;AAAA,MAAA;AAAA,IAEtB,KAAK;AACH,aAAO;AAAA,QACL,GAAG;AAAA,QACH,WAAW;AAAA,QACX,OAAO,OAAO;AAAA,QACd,kBAAkB;AAAA,MAAA;AAAA,IAEtB,KAAK;AACH,aAAO;AAAA,QACL,GAAG;AAAA,QACH,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AAO;AACxD,4BAAsB,gBAAgB;AAAA,IACxC,OAAO;AACL,cAAQ,MAAM,aAAa,QAAQ,oCAAoC;AAGvE,YAAM,kBAAkB,sBAAA;AACxB,eAAS;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,QACT,YAAY;AAAA,MAAA,CACb;AACD,4BAAsB,eAAe;AAAA,IACvC;AAAA,EACF;AAGA,YAAU,MAAM;AACd,mBAAA;AAAA,EAEF,GAAG,CAAA,CAAE;AAEL,QAAM,eAAoC;AAAA,IACxC,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EAAA;AAGF,6BACG,gBAAgB,UAAhB,EAAyB,OAAO,cAE9B,UACH;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../src/contexts/languageContext.tsx"],"sourcesContent":["// contexts/LanguageContext.tsx\nimport React, { createContext, useEffect, useReducer, ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { DEFAULT_LANG } from '../constants/all-language';\nimport { getToken } from '../utils/common';\nimport { setRoleURL } from '../utils/server';\nimport { getV1Languages } from '../api-client/api.system-feature/api';\nimport { getApiConfig } from '@/utils';\n// import ErpLoader from '../components/loader/erp-loader';\n\n// Types\ninterface ILanguage {\n label: string;\n code: string;\n direction: string;\n}\n\ninterface LanguageState {\n languages: ILanguage[];\n currentLanguage: ILanguage | null;\n isLoading: boolean;\n error: string | null;\n isFallbackActive: boolean; // Track if we're using fallback\n}\n\ninterface LanguageContextType extends LanguageState {\n changeLanguage: (langCode: string) => void;\n fetchLanguages: () => Promise<void>;\n}\n\n// Define fallback languages in order of preference - English first\nconst FALLBACK_LANGUAGES = [\n 'en', // English as primary fallback\n 'en-US', // US English as secondary\n DEFAULT_LANG, // Then default language\n];\n\n// Create English fallback language object\nconst createEnglishFallback = (): ILanguage => ({\n code: 'en',\n label: 'English',\n direction: 'ltr'\n});\n\n// Action types\ntype LanguageAction =\n | { type: 'FETCH_LANGUAGES_START' }\n | { type: 'FETCH_LANGUAGES_SUCCESS'; payload: ILanguage[] }\n | { type: 'FETCH_LANGUAGES_ERROR'; payload: string }\n | { type: 'SET_CURRENT_LANGUAGE'; payload: ILanguage; isFallback?: boolean }\n | { type: 'SET_FALLBACK_ACTIVE'; payload: boolean };\n\n// Initial state\nconst initialState: LanguageState = {\n languages: [],\n currentLanguage: null,\n isLoading: false,\n error: null,\n isFallbackActive: false,\n};\n\n// Helper function to find the best available language\nconst findBestAvailableLanguage = (\n languages: ILanguage[],\n preferredCode?: string\n): ILanguage | null => {\n if (!languages || languages.length === 0) return null;\n\n // First try the preferred language if provided\n if (preferredCode) {\n const preferred = languages.find(lang => lang.code === preferredCode);\n if (preferred) return preferred;\n }\n\n // Try fallback languages in order (English first)\n for (const fallbackCode of FALLBACK_LANGUAGES) {\n const fallback = languages.find(lang => lang.code === fallbackCode);\n if (fallback) return fallback;\n }\n\n // If no fallbacks found, return the first available language\n return languages[0] || null;\n};\n\n// Reducer\nconst languageReducer = (state: LanguageState, action: LanguageAction): LanguageState => {\n switch (action.type) {\n case 'FETCH_LANGUAGES_START':\n return {\n ...state,\n isLoading: true,\n error: null,\n };\n case 'FETCH_LANGUAGES_SUCCESS':\n return {\n ...state,\n languages: action.payload,\n isLoading: false,\n error: null,\n isFallbackActive: false,\n };\n case 'FETCH_LANGUAGES_ERROR':\n return {\n ...state,\n isLoading: false,\n error: action.payload,\n isFallbackActive: true,\n };\n case 'SET_CURRENT_LANGUAGE':\n return {\n ...state,\n currentLanguage: action.payload,\n isFallbackActive: action.isFallback || false,\n };\n case 'SET_FALLBACK_ACTIVE':\n return {\n ...state,\n isFallbackActive: action.payload,\n };\n default:\n return state;\n }\n};\n\n// Create context\nconst LanguageContext = createContext<LanguageContextType | undefined>(undefined);\n\n// Provider component\ninterface LanguageProviderProps {\n children: ReactNode;\n}\n\nexport const LanguageProvider: React.FC<LanguageProviderProps> = ({ children }) => {\n const [state, dispatch] = useReducer(languageReducer, initialState);\n const { i18n } = useTranslation();\n\n // Initialize role URL\n useEffect(() => {\n setRoleURL(`${getApiConfig().backendBaseUrl}/rbac`);\n }, []);\n\n // Guarded i18n changeLanguage call\n const safeChangeLanguage = async (langCode: string) => {\n if (i18n && typeof i18n.changeLanguage === 'function') {\n try {\n await i18n.changeLanguage(langCode);\n } catch (error) {\n console.warn(`Failed to change language to \"${langCode}\"`, error);\n }\n } else {\n console.warn(\n 'i18n.changeLanguage is unavailable. Ensure I18nextProvider is configured in the host application.'\n );\n }\n };\n\n // Apply language settings\n const applyLanguageSettings = (language: ILanguage) => {\n document.body.dir = language.direction || 'ltr';\n safeChangeLanguage(language.code);\n localStorage.setItem('_language', language.code);\n };\n\n // Fetch languages from API\n const fetchLanguages = async (): Promise<void> => {\n try {\n dispatch({ type: 'FETCH_LANGUAGES_START' });\n\n const response = await getV1Languages({\n order: `id:1`,\n filters: `(is_active.in=[1])`,\n ...getToken(),\n });\n\n const data = response?.data?.languages || [];\n const languages = data\n ?.filter((d: any) => d?.is_active)\n ?.map((d: any) => ({\n label: d?.name,\n code: d?.code,\n direction: d?.direction,\n }));\n\n // Always ensure English is available in the languages list\n const hasEnglish = languages.some((lang: ILanguage) => lang.code === 'en');\n if (!hasEnglish) {\n languages.unshift(createEnglishFallback());\n }\n\n dispatch({ type: 'FETCH_LANGUAGES_SUCCESS', payload: languages });\n\n // Get saved language or use fallback\n const savedLangCode = localStorage.getItem('_language');\n const bestLanguage = findBestAvailableLanguage(languages, savedLangCode || undefined);\n\n if (bestLanguage) {\n const isFallback = savedLangCode && savedLangCode !== bestLanguage.code;\n dispatch({\n type: 'SET_CURRENT_LANGUAGE',\n payload: bestLanguage,\n isFallback\n });\n applyLanguageSettings(bestLanguage);\n\n // Log if we're using a fallback\n if (isFallback) {\n console.warn(`Saved language \"${savedLangCode}\" not available. Using fallback: \"${bestLanguage.code}\"`);\n }\n } else {\n console.error('No languages available');\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Failed to fetch languages';\n dispatch({ type: 'FETCH_LANGUAGES_ERROR', payload: errorMessage });\n\n // On error, always fall back to English\n const englishFallback = createEnglishFallback();\n\n // Create languages array with English fallback for dropdown\n const fallbackLanguages = [englishFallback];\n\n dispatch({ type: 'FETCH_LANGUAGES_SUCCESS', payload: fallbackLanguages });\n dispatch({\n type: 'SET_CURRENT_LANGUAGE',\n payload: englishFallback,\n isFallback: true\n });\n\n document.body.dir = 'ltr';\n safeChangeLanguage('en');\n localStorage.setItem('_language', 'en');\n\n console.warn('Language fetch failed, using English fallback');\n }\n };\n\n // Change language function\n const changeLanguage = (langCode: string): void => {\n const selectedLanguage = state.languages.find((lang) => lang.code === langCode);\n\n if (selectedLanguage) {\n dispatch({ type: 'SET_CURRENT_LANGUAGE', payload: selectedLanguage });\n dispatch({ type: 'SET_FALLBACK_ACTIVE', payload: false });\n applyLanguageSettings(selectedLanguage);\n } else {\n console.error(`Language \"${langCode}\" not found in available languages`);\n\n // If language not found, fall back to English\n const englishFallback = createEnglishFallback();\n dispatch({\n type: 'SET_CURRENT_LANGUAGE',\n payload: englishFallback,\n isFallback: true\n });\n applyLanguageSettings(englishFallback);\n }\n };\n\n // Initialize on mount\n useEffect(() => {\n fetchLanguages();\n //eslint-disable-next-line \n }, []);\n\n const contextValue: LanguageContextType = {\n ...state,\n changeLanguage,\n fetchLanguages,\n };\n\n return (\n <LanguageContext.Provider value={contextValue}>\n {/* {state.isLoading } */}\n {children}\n </LanguageContext.Provider>\n );\n};\n\nexport { LanguageContext };\nexport default LanguageContext;"],"names":["setRoleURL"],"mappings":";;;;;;;;AA+BA,MAAM,qBAAqB;AAAA,EACzB;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF;AAGA,MAAM,wBAAwB,OAAkB;AAAA,EAC9C,MAAM;AAAA,EACN,OAAO;AAAA,EACP,WAAW;AACb;AAWA,MAAM,eAA8B;AAAA,EAClC,WAAW,CAAA;AAAA,EACX,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,OAAO;AAAA,EACP,kBAAk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AAgB,UAAhB,EAAyB,OAAO,cAE9B,UACH;AAEJ;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("react"),
|
|
2
|
-
return e.jsx(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("react"),n=require("react-i18next"),t=require("../../constants/all-language/index.js"),i=require("../../utils/common/index.js"),l=require("../../api-client/api.rbac/api/index.js"),r=require("../../api-client/api.system-feature/api/index.js"),o=require("../../utils/api-config/index.js");const c=["en","en-US",t.DEFAULT_LANG],s={languages:[],currentLanguage:null,isLoading:!1,error:null,isFallbackActive:!1},d=(e,a)=>{switch(a.type){case"FETCH_LANGUAGES_START":return{...e,isLoading:!0,error:null};case"FETCH_LANGUAGES_SUCCESS":return{...e,languages:a.payload,isLoading:!1,error:null,isFallbackActive:!1};case"FETCH_LANGUAGES_ERROR":return{...e,isLoading:!1,error:a.payload,isFallbackActive:!0};case"SET_CURRENT_LANGUAGE":return{...e,currentLanguage:a.payload,isFallbackActive:a.isFallback||!1};case"SET_FALLBACK_ACTIVE":return{...e,isFallbackActive:a.payload};default:return e}},u=a.createContext(void 0);exports.LanguageContext=u,exports.LanguageProvider=({children:t})=>{const[g,E]=a.useReducer(d,s),{i18n:A}=n.useTranslation();a.useEffect(()=>{l.setBaseUrl(`${o.getApiConfig().backendBaseUrl}/rbac`)},[]);const p=async e=>{if(A&&"function"==typeof A.changeLanguage)try{await A.changeLanguage(e)}catch(a){}},_=e=>{document.body.dir=e.direction||"ltr",p(e.code),localStorage.setItem("_language",e.code)},y=async()=>{var e,a;try{E({type:"FETCH_LANGUAGES_START"});const n=await r.getV1Languages({order:"id:1",filters:"(is_active.in=[1])",...i.getToken()}),t=(null==(e=null==n?void 0:n.data)?void 0:e.languages)||[],l=null==(a=null==t?void 0:t.filter(e=>null==e?void 0:e.is_active))?void 0:a.map(e=>({label:null==e?void 0:e.name,code:null==e?void 0:e.code,direction:null==e?void 0:e.direction}));l.some(e=>"en"===e.code)||l.unshift({code:"en",label:"English",direction:"ltr"}),E({type:"FETCH_LANGUAGES_SUCCESS",payload:l});const o=localStorage.getItem("_language"),s=((e,a)=>{if(!e||0===e.length)return null;if(a){const n=e.find(e=>e.code===a);if(n)return n}for(const n of c){const a=e.find(e=>e.code===n);if(a)return a}return e[0]||null})(l,o||void 0);if(s){const e=o&&o!==s.code;E({type:"SET_CURRENT_LANGUAGE",payload:s,isFallback:e}),_(s)}}catch(n){const e=n instanceof Error?n.message:"Failed to fetch languages";E({type:"FETCH_LANGUAGES_ERROR",payload:e});const a={code:"en",label:"English",direction:"ltr"};E({type:"FETCH_LANGUAGES_SUCCESS",payload:[a]}),E({type:"SET_CURRENT_LANGUAGE",payload:a,isFallback:!0}),document.body.dir="ltr",p("en"),localStorage.setItem("_language","en")}};a.useEffect(()=>{y()},[]);const L={...g,changeLanguage:e=>{const a=g.languages.find(a=>a.code===e);if(a)E({type:"SET_CURRENT_LANGUAGE",payload:a}),E({type:"SET_FALLBACK_ACTIVE",payload:!1}),_(a);else{const e={code:"en",label:"English",direction:"ltr"};E({type:"SET_CURRENT_LANGUAGE",payload:e,isFallback:!0}),_(e)}},fetchLanguages:y};/* @__PURE__ */
|
|
2
|
+
return e.jsx(u.Provider,{value:L,children:t})},exports.default=u;
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/contexts/languageContext.tsx"],"sourcesContent":["// contexts/LanguageContext.tsx\nimport React, { createContext, useEffect, useReducer, ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { DEFAULT_LANG } from '../constants/all-language';\nimport { getToken } from '../utils/common';\nimport { setRoleURL } from '../utils/server';\nimport { getV1Languages } from '../api-client/api.system-feature/api';\n// import ErpLoader from '../components/loader/erp-loader';\n\n// Types\ninterface ILanguage {\n label: string;\n code: string;\n direction: string;\n}\n\ninterface LanguageState {\n languages: ILanguage[];\n currentLanguage: ILanguage | null;\n isLoading: boolean;\n error: string | null;\n isFallbackActive: boolean; // Track if we're using fallback\n}\n\ninterface LanguageContextType extends LanguageState {\n changeLanguage: (langCode: string) => void;\n fetchLanguages: () => Promise<void>;\n}\n\n// Define fallback languages in order of preference - English first\nconst FALLBACK_LANGUAGES = [\n 'en', // English as primary fallback\n 'en-US', // US English as secondary\n DEFAULT_LANG, // Then default language\n];\n\n// Create English fallback language object\nconst createEnglishFallback = (): ILanguage => ({\n code: 'en',\n label: 'English',\n direction: 'ltr'\n});\n\n// Action types\ntype LanguageAction =\n | { type: 'FETCH_LANGUAGES_START' }\n | { type: 'FETCH_LANGUAGES_SUCCESS'; payload: ILanguage[] }\n | { type: 'FETCH_LANGUAGES_ERROR'; payload: string }\n | { type: 'SET_CURRENT_LANGUAGE'; payload: ILanguage; isFallback?: boolean }\n | { type: 'SET_FALLBACK_ACTIVE'; payload: boolean };\n\n// Initial state\nconst initialState: LanguageState = {\n languages: [],\n currentLanguage: null,\n isLoading: false,\n error: null,\n isFallbackActive: false,\n};\n\n// Helper function to find the best available language\nconst findBestAvailableLanguage = (\n languages: ILanguage[], \n preferredCode?: string\n): ILanguage | null => {\n if (!languages || languages.length === 0) return null;\n\n // First try the preferred language if provided\n if (preferredCode) {\n const preferred = languages.find(lang => lang.code === preferredCode);\n if (preferred) return preferred;\n }\n\n // Try fallback languages in order (English first)\n for (const fallbackCode of FALLBACK_LANGUAGES) {\n const fallback = languages.find(lang => lang.code === fallbackCode);\n if (fallback) return fallback;\n }\n\n // If no fallbacks found, return the first available language\n return languages[0] || null;\n};\n\n// Reducer\nconst languageReducer = (state: LanguageState, action: LanguageAction): LanguageState => {\n switch (action.type) {\n case 'FETCH_LANGUAGES_START':\n return {\n ...state,\n isLoading: true,\n error: null,\n };\n case 'FETCH_LANGUAGES_SUCCESS':\n return {\n ...state,\n languages: action.payload,\n isLoading: false,\n error: null,\n isFallbackActive: false,\n };\n case 'FETCH_LANGUAGES_ERROR':\n return {\n ...state,\n isLoading: false,\n error: action.payload,\n isFallbackActive: true, \n };\n case 'SET_CURRENT_LANGUAGE':\n return {\n ...state,\n currentLanguage: action.payload,\n isFallbackActive: action.isFallback || false,\n };\n case 'SET_FALLBACK_ACTIVE':\n return {\n ...state,\n isFallbackActive: action.payload,\n };\n default:\n return state;\n }\n};\n\n// Create context\nconst LanguageContext = createContext<LanguageContextType | undefined>(undefined);\n\n// Provider component\ninterface LanguageProviderProps {\n children: ReactNode;\n}\n\nexport const LanguageProvider: React.FC<LanguageProviderProps> = ({ children }) => {\n const [state, dispatch] = useReducer(languageReducer, initialState);\n const { i18n } = useTranslation();\n\n // Initialize role URL\n useEffect(() => {\n setRoleURL(`${import.meta.env.VITE_BACKEND_BASE_URL}/rbac`);\n }, []);\n\n // Guarded i18n changeLanguage call\n const safeChangeLanguage = async (langCode: string) => {\n if (i18n && typeof i18n.changeLanguage === 'function') {\n try {\n await i18n.changeLanguage(langCode);\n } catch (error) {\n console.warn(`Failed to change language to \"${langCode}\"`, error);\n }\n } else {\n console.warn(\n 'i18n.changeLanguage is unavailable. Ensure I18nextProvider is configured in the host application.'\n );\n }\n };\n\n // Apply language settings\n const applyLanguageSettings = (language: ILanguage) => {\n document.body.dir = language.direction || 'ltr';\n safeChangeLanguage(language.code);\n localStorage.setItem('_language', language.code);\n };\n\n // Fetch languages from API\n const fetchLanguages = async (): Promise<void> => {\n try {\n dispatch({ type: 'FETCH_LANGUAGES_START' });\n \n const response = await getV1Languages({\n order: `id:1`,\n filters: `(is_active.in=[1])`,\n ...getToken(),\n });\n \n const data = response?.data?.languages || [];\n const languages = data\n ?.filter((d: any) => d?.is_active)\n ?.map((d: any) => ({\n label: d?.name,\n code: d?.code,\n direction: d?.direction,\n }));\n\n // Always ensure English is available in the languages list\n const hasEnglish = languages.some((lang: ILanguage) => lang.code === 'en');\n if (!hasEnglish) {\n languages.unshift(createEnglishFallback());\n }\n\n dispatch({ type: 'FETCH_LANGUAGES_SUCCESS', payload: languages });\n \n // Get saved language or use fallback\n const savedLangCode = localStorage.getItem('_language');\n const bestLanguage = findBestAvailableLanguage(languages, savedLangCode || undefined);\n \n if (bestLanguage) {\n const isFallback = savedLangCode && savedLangCode !== bestLanguage.code;\n dispatch({ \n type: 'SET_CURRENT_LANGUAGE', \n payload: bestLanguage,\n isFallback \n });\n applyLanguageSettings(bestLanguage);\n \n // Log if we're using a fallback\n if (isFallback) {\n console.warn(`Saved language \"${savedLangCode}\" not available. Using fallback: \"${bestLanguage.code}\"`);\n }\n } else {\n console.error('No languages available');\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Failed to fetch languages';\n dispatch({ type: 'FETCH_LANGUAGES_ERROR', payload: errorMessage });\n \n // On error, always fall back to English\n const englishFallback = createEnglishFallback();\n \n // Create languages array with English fallback for dropdown\n const fallbackLanguages = [englishFallback];\n \n dispatch({ type: 'FETCH_LANGUAGES_SUCCESS', payload: fallbackLanguages });\n dispatch({ \n type: 'SET_CURRENT_LANGUAGE', \n payload: englishFallback,\n isFallback: true \n });\n \n document.body.dir = 'ltr';\n safeChangeLanguage('en');\n localStorage.setItem('_language', 'en');\n \n console.warn('Language fetch failed, using English fallback');\n }\n };\n\n // Change language function\n const changeLanguage = (langCode: string): void => {\n const selectedLanguage = state.languages.find((lang) => lang.code === langCode);\n \n if (selectedLanguage) {\n dispatch({ type: 'SET_CURRENT_LANGUAGE', payload: selectedLanguage });\n dispatch({ type: 'SET_FALLBACK_ACTIVE', payload: false });\n applyLanguageSettings(selectedLanguage);\n } else {\n console.error(`Language \"${langCode}\" not found in available languages`);\n \n // If language not found, fall back to English\n const englishFallback = createEnglishFallback();\n dispatch({ \n type: 'SET_CURRENT_LANGUAGE', \n payload: englishFallback,\n isFallback: true \n });\n applyLanguageSettings(englishFallback);\n }\n };\n\n // Initialize on mount\n useEffect(() => {\n fetchLanguages();\n //eslint-disable-next-line \n }, []);\n\n const contextValue: LanguageContextType = {\n ...state,\n changeLanguage,\n fetchLanguages,\n };\n\n return (\n <LanguageContext.Provider value={contextValue}>\n {/* {state.isLoading } */}\n {children}\n </LanguageContext.Provider>\n );\n};\n\nexport { LanguageContext };\nexport default LanguageContext;"],"names":["FALLBACK_LANGUAGES","DEFAULT_LANG","initialState","languages","currentLanguage","isLoading","error","isFallbackActive","languageReducer","state","action","type","payload","isFallback","LanguageContext","createContext","children","dispatch","useReducer","i18n","useTranslation","useEffect","setRoleURL","safeChangeLanguage","async","langCode","changeLanguage","applyLanguageSettings","language","document","body","dir","direction","code","localStorage","setItem","fetchLanguages","response","getV1Languages","order","filters","getToken","data","_a","_b","filter","d","is_active","map","label","name","some","lang","unshift","savedLangCode","getItem","bestLanguage","preferredCode","length","preferred","find","fallbackCode","fallback","findBestAvailableLanguage","errorMessage","Error","message","englishFallback","contextValue","selectedLanguage","Provider","value"],"mappings":"mWA8BA,MAAMA,EAAqB,CACzB,KACA,QACAC,EAAAA,cAmBIC,EAA8B,CAClCC,UAAW,GACXC,gBAAiB,KACjBC,WAAW,EACXC,MAAO,KACPC,kBAAkB,GA2BdC,EAAkB,CAACC,EAAsBC,KAC7C,OAAQA,EAAOC,MACb,IAAK,wBACH,MAAO,IACFF,EACHJ,WAAW,EACXC,MAAO,MAEX,IAAK,0BACH,MAAO,IACFG,EACHN,UAAWO,EAAOE,QAClBP,WAAW,EACXC,MAAO,KACPC,kBAAkB,GAEtB,IAAK,wBACH,MAAO,IACFE,EACHJ,WAAW,EACXC,MAAOI,EAAOE,QACdL,kBAAkB,GAEtB,IAAK,uBACH,MAAO,IACFE,EACHL,gBAAiBM,EAAOE,QACxBL,iBAAkBG,EAAOG,aAAc,GAE3C,IAAK,sBACH,MAAO,IACFJ,EACHF,iBAAkBG,EAAOE,SAE7B,QACE,OAAOH,IAKPK,EAAkBC,EAAAA,mBAA+C,sDAON,EAAGC,eAClE,MAAOP,EAAOQ,GAAYC,EAAAA,WAAWV,EAAiBN,IAChDi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U,OAAOA,CACvB,CAGA,OAAO3D,EAAU,IAAM,MAgHE4D,CAA0B5D,EAAWmD,QAAiB,GAE3E,GAAIE,EAAc,CAChB,MAAM3C,EAAayC,GAAiBA,IAAkBE,EAAavB,KACnEhB,EAAS,CACPN,KAAM,uBACNC,QAAS4C,EACT3C,eAEFc,EAAsB6B,EAMxB,CAGF,OAASlD,GACP,MAAM0D,EAAe1D,aAAiB2D,MAAQ3D,EAAM4D,QAAU,4BAC9DjD,EAAS,CAAEN,KAAM,wBAAyBC,QAASoD,IAGnD,MAAMG,EAlLkB,CAC5BlC,KAAM,KACNgB,MAAO,UACPjB,UAAW,OAoLPf,EAAS,CAAEN,KAAM,0BAA2BC,QAFlB,CAACuD,KAG3BlD,EAAS,CACPN,KAAM,uBACNC,QAASuD,EACTtD,YAAY,IAGdgB,SAASC,KAAKC,IAAM,MACpBR,EAAmB,MACnBW,aAAaC,QAAQ,YAAa,KAGpC,GA0BFd,EAAAA,UAAU,KACRe,KAEC,IAEH,MAAMgC,EAAoC,IACrC3D,EACHiB,eA7BsBD,IACtB,MAAM4C,EAAmB5D,EAAMN,UAAUyD,KAAMR,GAASA,EAAKnB,OAASR,GAEtE,GAAI4C,EACFpD,EAAS,CAAEN,KAAM,uBAAwBC,QAASyD,IAClDpD,EAAS,CAAEN,KAAM,sBAAuBC,SAAS,IACjDe,EAAsB0C,OACjB,CAIL,MAAMF,EAlNkB,CAC5BlC,KAAM,KACNgB,MAAO,UACPjB,UAAW,OAgNPf,EAAS,CACPN,KAAM,uBACNC,QAASuD,EACTtD,YAAY,IAEdc,EAAsBwC,EACxB,GAYA/B;AAGF,aACGtB,EAAgBwD,SAAhB,CAAyBC,MAAOH,EAE9BpD"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/contexts/languageContext.tsx"],"sourcesContent":["// contexts/LanguageContext.tsx\nimport React, { createContext, useEffect, useReducer, ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { DEFAULT_LANG } from '../constants/all-language';\nimport { getToken } from '../utils/common';\nimport { setRoleURL } from '../utils/server';\nimport { getV1Languages } from '../api-client/api.system-feature/api';\nimport { getApiConfig } from '@/utils';\n// import ErpLoader from '../components/loader/erp-loader';\n\n// Types\ninterface ILanguage {\n label: string;\n code: string;\n direction: string;\n}\n\ninterface LanguageState {\n languages: ILanguage[];\n currentLanguage: ILanguage | null;\n isLoading: boolean;\n error: string | null;\n isFallbackActive: boolean; // Track if we're using fallback\n}\n\ninterface LanguageContextType extends LanguageState {\n changeLanguage: (langCode: string) => void;\n fetchLanguages: () => Promise<void>;\n}\n\n// Define fallback languages in order of preference - English first\nconst FALLBACK_LANGUAGES = [\n 'en', // English as primary fallback\n 'en-US', // US English as secondary\n DEFAULT_LANG, // Then default language\n];\n\n// Create English fallback language object\nconst createEnglishFallback = (): ILanguage => ({\n code: 'en',\n label: 'English',\n direction: 'ltr'\n});\n\n// Action types\ntype LanguageAction =\n | { type: 'FETCH_LANGUAGES_START' }\n | { type: 'FETCH_LANGUAGES_SUCCESS'; payload: ILanguage[] }\n | { type: 'FETCH_LANGUAGES_ERROR'; payload: string }\n | { type: 'SET_CURRENT_LANGUAGE'; payload: ILanguage; isFallback?: boolean }\n | { type: 'SET_FALLBACK_ACTIVE'; payload: boolean };\n\n// Initial state\nconst initialState: LanguageState = {\n languages: [],\n currentLanguage: null,\n isLoading: false,\n error: null,\n isFallbackActive: false,\n};\n\n// Helper function to find the best available language\nconst findBestAvailableLanguage = (\n languages: ILanguage[],\n preferredCode?: string\n): ILanguage | null => {\n if (!languages || languages.length === 0) return null;\n\n // First try the preferred language if provided\n if (preferredCode) {\n const preferred = languages.find(lang => lang.code === preferredCode);\n if (preferred) return preferred;\n }\n\n // Try fallback languages in order (English first)\n for (const fallbackCode of FALLBACK_LANGUAGES) {\n const fallback = languages.find(lang => lang.code === fallbackCode);\n if (fallback) return fallback;\n }\n\n // If no fallbacks found, return the first available language\n return languages[0] || null;\n};\n\n// Reducer\nconst languageReducer = (state: LanguageState, action: LanguageAction): LanguageState => {\n switch (action.type) {\n case 'FETCH_LANGUAGES_START':\n return {\n ...state,\n isLoading: true,\n error: null,\n };\n case 'FETCH_LANGUAGES_SUCCESS':\n return {\n ...state,\n languages: action.payload,\n isLoading: false,\n error: null,\n isFallbackActive: false,\n };\n case 'FETCH_LANGUAGES_ERROR':\n return {\n ...state,\n isLoading: false,\n error: action.payload,\n isFallbackActive: true,\n };\n case 'SET_CURRENT_LANGUAGE':\n return {\n ...state,\n currentLanguage: action.payload,\n isFallbackActive: action.isFallback || false,\n };\n case 'SET_FALLBACK_ACTIVE':\n return {\n ...state,\n isFallbackActive: action.payload,\n };\n default:\n return state;\n }\n};\n\n// Create context\nconst LanguageContext = createContext<LanguageContextType | undefined>(undefined);\n\n// Provider component\ninterface LanguageProviderProps {\n children: ReactNode;\n}\n\nexport const LanguageProvider: React.FC<LanguageProviderProps> = ({ children }) => {\n const [state, dispatch] = useReducer(languageReducer, initialState);\n const { i18n } = useTranslation();\n\n // Initialize role URL\n useEffect(() => {\n setRoleURL(`${getApiConfig().backendBaseUrl}/rbac`);\n }, []);\n\n // Guarded i18n changeLanguage call\n const safeChangeLanguage = async (langCode: string) => {\n if (i18n && typeof i18n.changeLanguage === 'function') {\n try {\n await i18n.changeLanguage(langCode);\n } catch (error) {\n console.warn(`Failed to change language to \"${langCode}\"`, error);\n }\n } else {\n console.warn(\n 'i18n.changeLanguage is unavailable. Ensure I18nextProvider is configured in the host application.'\n );\n }\n };\n\n // Apply language settings\n const applyLanguageSettings = (language: ILanguage) => {\n document.body.dir = language.direction || 'ltr';\n safeChangeLanguage(language.code);\n localStorage.setItem('_language', language.code);\n };\n\n // Fetch languages from API\n const fetchLanguages = async (): Promise<void> => {\n try {\n dispatch({ type: 'FETCH_LANGUAGES_START' });\n\n const response = await getV1Languages({\n order: `id:1`,\n filters: `(is_active.in=[1])`,\n ...getToken(),\n });\n\n const data = response?.data?.languages || [];\n const languages = data\n ?.filter((d: any) => d?.is_active)\n ?.map((d: any) => ({\n label: d?.name,\n code: d?.code,\n direction: d?.direction,\n }));\n\n // Always ensure English is available in the languages list\n const hasEnglish = languages.some((lang: ILanguage) => lang.code === 'en');\n if (!hasEnglish) {\n languages.unshift(createEnglishFallback());\n }\n\n dispatch({ type: 'FETCH_LANGUAGES_SUCCESS', payload: languages });\n\n // Get saved language or use fallback\n const savedLangCode = localStorage.getItem('_language');\n const bestLanguage = findBestAvailableLanguage(languages, savedLangCode || undefined);\n\n if (bestLanguage) {\n const isFallback = savedLangCode && savedLangCode !== bestLanguage.code;\n dispatch({\n type: 'SET_CURRENT_LANGUAGE',\n payload: bestLanguage,\n isFallback\n });\n applyLanguageSettings(bestLanguage);\n\n // Log if we're using a fallback\n if (isFallback) {\n console.warn(`Saved language \"${savedLangCode}\" not available. Using fallback: \"${bestLanguage.code}\"`);\n }\n } else {\n console.error('No languages available');\n }\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : 'Failed to fetch languages';\n dispatch({ type: 'FETCH_LANGUAGES_ERROR', payload: errorMessage });\n\n // On error, always fall back to English\n const englishFallback = createEnglishFallback();\n\n // Create languages array with English fallback for dropdown\n const fallbackLanguages = [englishFallback];\n\n dispatch({ type: 'FETCH_LANGUAGES_SUCCESS', payload: fallbackLanguages });\n dispatch({\n type: 'SET_CURRENT_LANGUAGE',\n payload: englishFallback,\n isFallback: true\n });\n\n document.body.dir = 'ltr';\n safeChangeLanguage('en');\n localStorage.setItem('_language', 'en');\n\n console.warn('Language fetch failed, using English fallback');\n }\n };\n\n // Change language function\n const changeLanguage = (langCode: string): void => {\n const selectedLanguage = state.languages.find((lang) => lang.code === langCode);\n\n if (selectedLanguage) {\n dispatch({ type: 'SET_CURRENT_LANGUAGE', payload: selectedLanguage });\n dispatch({ type: 'SET_FALLBACK_ACTIVE', payload: false });\n applyLanguageSettings(selectedLanguage);\n } else {\n console.error(`Language \"${langCode}\" not found in available languages`);\n\n // If language not found, fall back to English\n const englishFallback = createEnglishFallback();\n dispatch({\n type: 'SET_CURRENT_LANGUAGE',\n payload: englishFallback,\n isFallback: true\n });\n applyLanguageSettings(englishFallback);\n }\n };\n\n // Initialize on mount\n useEffect(() => {\n fetchLanguages();\n //eslint-disable-next-line \n }, []);\n\n const contextValue: LanguageContextType = {\n ...state,\n changeLanguage,\n fetchLanguages,\n };\n\n return (\n <LanguageContext.Provider value={contextValue}>\n {/* {state.isLoading } */}\n {children}\n </LanguageContext.Provider>\n );\n};\n\nexport { LanguageContext };\nexport default LanguageContext;"],"names":["FALLBACK_LANGUAGES","DEFAULT_LANG","initialState","languages","currentLanguage","isLoading","error","isFallbackActive","languageReducer","state","action","type","payload","isFallback","LanguageContext","createContext","children","dispatch","useReducer","i18n","useTranslation","useEffect","setRoleURL","getApiConfig","backendBaseUrl","safeChangeLanguage","async","langCode","changeLanguage","applyLanguageSettings","language","document","body","dir","direction","code","localStorage","setItem","fetchLanguages","response","getV1Languages","order","filters","getToken","data","_a","_b","filter","d","is_active","map","label","name","some","lang","unshift","savedLangCode","getItem","bestLanguage","preferredCode","length","preferred","find","fallbackCode","fallback","findBestAvailableLanguage","errorMessage","Error","message","englishFallback","contextValue","selectedLanguage","Provider","value"],"mappings":"gZA+BA,MAAMA,EAAqB,CACzB,KACA,QACAC,EAAAA,cAmBIC,EAA8B,CAClCC,UAAW,GACXC,gBAAiB,KACjBC,WAAW,EACXC,MAAO,KACPC,kBAAkB,GA2BdC,EAAkB,CAACC,EAAsBC,KAC7C,OAAQA,EAAOC,MACb,IAAK,wBACH,MAAO,IACFF,EACHJ,WAAW,EACXC,MAAO,MAEX,IAAK,0BACH,MAAO,IACFG,EACHN,UAAWO,EAAOE,QAClBP,WAAW,EACXC,MAAO,KACPC,kBAAkB,GAEtB,IAAK,wBACH,MAAO,IACFE,EACHJ,WAAW,EACXC,MAAOI,EAAOE,QACdL,kBAAkB,GAEtB,IAAK,uBACH,MAAO,IACFE,EACHL,gBAAiBM,EAAOE,QACxBL,iBAAkBG,EAAOG,aAAc,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B0D,SAAhB,CAAyBC,MAAOH,EAE9BtD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
|
-
var define_process_env_default = {};
|
|
3
2
|
const MATERIAL_CONSTANTS = {
|
|
4
3
|
STEEL_DENSITY: 7.85,
|
|
5
4
|
LENGTH_CONVERSION_FACTOR: 1e3,
|
|
@@ -155,7 +154,7 @@ const useMaterialCalculations = (formValues) => {
|
|
|
155
154
|
const boardsWeightResult = calculateBoardsWeight(formValues);
|
|
156
155
|
const steelWeightResult = calculateSteelWeight(formValues);
|
|
157
156
|
const materialWeightResult = calculateTubeMaterialWeight(formValues);
|
|
158
|
-
if (
|
|
157
|
+
if (process.env.NODE_ENV === "development") {
|
|
159
158
|
[totalWidthResult, materialUnitResult, boardsWeightResult, steelWeightResult, materialWeightResult].filter((result) => !result.isValid && result.error).forEach((result) => console.warn("Calculation warning:", result.error));
|
|
160
159
|
}
|
|
161
160
|
return {
|