@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.
Files changed (1141) hide show
  1. package/dist/_virtual/index/index.esm10.js +3 -3
  2. package/dist/_virtual/index/index.esm11.js +3 -3
  3. package/dist/_virtual/index/index.esm4.js +1 -1
  4. package/dist/_virtual/index/index.esm5.js +3 -3
  5. package/dist/_virtual/index/index.esm6.js +3 -3
  6. package/dist/_virtual/index/index.esm7.js +3 -3
  7. package/dist/_virtual/index/index.esm8.js +3 -3
  8. package/dist/_virtual/index/index.esm9.js +3 -3
  9. package/dist/_virtual/index/index10.js +1 -1
  10. package/dist/_virtual/index/index11.js +1 -1
  11. package/dist/_virtual/index/index4.js +1 -1
  12. package/dist/_virtual/index/index5.js +1 -1
  13. package/dist/_virtual/index/index6.js +1 -1
  14. package/dist/_virtual/index/index7.js +1 -1
  15. package/dist/_virtual/index/index8.js +1 -1
  16. package/dist/_virtual/index/index9.js +1 -1
  17. package/dist/api-client/api.hrms/api/index.esm.js +12 -1
  18. package/dist/api-client/api.hrms/api/index.esm.js.map +1 -1
  19. package/dist/api-client/api.hrms/api/index.js +1 -1
  20. package/dist/api-client/api.hrms/api/index.js.map +1 -1
  21. package/dist/api-client/api.inventory/api/index.esm.js +30 -95
  22. package/dist/api-client/api.inventory/api/index.esm.js.map +1 -1
  23. package/dist/api-client/api.inventory/api/index.js +1 -1
  24. package/dist/api-client/api.inventory/api/index.js.map +1 -1
  25. package/dist/api-client/api.inventory/api-types.d.ts +425 -930
  26. package/dist/api-client/api.inventory/api.d.ts +10 -14
  27. package/dist/api-client/api.rbac/api/index.esm2.js +0 -218
  28. package/dist/api-client/api.rbac/api/index.esm2.js.map +1 -1
  29. package/dist/api-client/api.rbac/api/index2.js +1 -1
  30. package/dist/api-client/api.rbac/api/index2.js.map +1 -1
  31. package/dist/components/action-bar/action-bar/index.esm.js +1 -2
  32. package/dist/components/action-bar/action-bar/index.esm.js.map +1 -1
  33. package/dist/components/action-bar/action-bar/index.js +5 -5
  34. package/dist/components/action-bar/action-bar/index.js.map +1 -1
  35. package/dist/components/editor/custom-editor/index.esm.js +3 -1
  36. package/dist/components/editor/custom-editor/index.esm.js.map +1 -1
  37. package/dist/components/editor/custom-editor/index.js +2 -2
  38. package/dist/components/editor/custom-editor/index.js.map +1 -1
  39. package/dist/components/filter/components/delete-group/index.esm.js +0 -1
  40. package/dist/components/filter/components/delete-group/index.esm.js.map +1 -1
  41. package/dist/components/filter/components/delete-group/index.js +1 -1
  42. package/dist/components/filter/components/delete-group/index.js.map +1 -1
  43. package/dist/components/filter/filter/index.esm.js +1 -2
  44. package/dist/components/filter/filter/index.esm.js.map +1 -1
  45. package/dist/components/filter/filter/index.js +12 -12
  46. package/dist/components/filter/filter/index.js.map +1 -1
  47. package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.esm.js +5 -3
  48. package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.esm.js.map +1 -1
  49. package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.js +6 -6
  50. package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.js.map +1 -1
  51. package/dist/components/form-control/form-builder/form-builder-element/dynamic-select.d.ts +1 -0
  52. package/dist/components/header/header/index.esm.js +3 -1
  53. package/dist/components/header/header/index.esm.js.map +1 -1
  54. package/dist/components/header/header/index.js +21 -21
  55. package/dist/components/header/header/index.js.map +1 -1
  56. package/dist/components/header/redux/actionCreator/index.esm.js +2 -1
  57. package/dist/components/header/redux/actionCreator/index.esm.js.map +1 -1
  58. package/dist/components/header/redux/actionCreator/index.js +1 -1
  59. package/dist/components/header/redux/actionCreator/index.js.map +1 -1
  60. package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.esm.js +1 -2
  61. package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.esm.js.map +1 -1
  62. package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.js +1 -1
  63. package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.js.map +1 -1
  64. package/dist/components/material-table/components/inline-edit-fields/index.esm.js.map +1 -1
  65. package/dist/components/material-table/components/inline-edit-fields/index.js.map +1 -1
  66. package/dist/components/providers/ERPUIProvider/index.esm.js +15 -1
  67. package/dist/components/providers/ERPUIProvider/index.esm.js.map +1 -1
  68. package/dist/components/providers/ERPUIProvider/index.js +1 -1
  69. package/dist/components/providers/ERPUIProvider/index.js.map +1 -1
  70. package/dist/components/providers/ERPUIProvider.d.ts +2 -0
  71. package/dist/components/reports-title-bar/redux/actionCreator/index.esm.js +1 -2
  72. package/dist/components/reports-title-bar/redux/actionCreator/index.esm.js.map +1 -1
  73. package/dist/components/reports-title-bar/redux/actionCreator/index.js +1 -1
  74. package/dist/components/reports-title-bar/redux/actionCreator/index.js.map +1 -1
  75. package/dist/components/share-modal/redux/actionCreator/index.esm.js +2 -1
  76. package/dist/components/share-modal/redux/actionCreator/index.esm.js.map +1 -1
  77. package/dist/components/share-modal/redux/actionCreator/index.js +1 -1
  78. package/dist/components/share-modal/redux/actionCreator/index.js.map +1 -1
  79. package/dist/components/uom-field-wrapper/uom-field-wrapper/index.esm.js +1 -1
  80. package/dist/components/uom-field-wrapper/uom-field-wrapper/index.esm.js.map +1 -1
  81. package/dist/components/uom-field-wrapper/uom-field-wrapper/index.js +1 -1
  82. package/dist/components/uom-field-wrapper/uom-field-wrapper/index.js.map +1 -1
  83. package/dist/components/upload/upload/index.esm.js +3 -2
  84. package/dist/components/upload/upload/index.esm.js.map +1 -1
  85. package/dist/components/upload/upload/index.js +29 -29
  86. package/dist/components/upload/upload/index.js.map +1 -1
  87. package/dist/constants/defaultColumns/index.esm.js +1 -1
  88. package/dist/constants/defaultColumns/index.esm.js.map +1 -1
  89. package/dist/constants/defaultColumns/index.js +1 -1
  90. package/dist/constants/defaultColumns/index.js.map +1 -1
  91. package/dist/contexts/AuthContext/index.esm.js +4 -3
  92. package/dist/contexts/AuthContext/index.esm.js.map +1 -1
  93. package/dist/contexts/AuthContext/index.js +2 -2
  94. package/dist/contexts/AuthContext/index.js.map +1 -1
  95. package/dist/contexts/languageContext/index.esm.js +2 -1
  96. package/dist/contexts/languageContext/index.esm.js.map +1 -1
  97. package/dist/contexts/languageContext/index.js +2 -2
  98. package/dist/contexts/languageContext/index.js.map +1 -1
  99. package/dist/hooks/use-material-calculations/index.esm.js +1 -2
  100. package/dist/hooks/use-material-calculations/index.esm.js.map +1 -1
  101. package/dist/hooks/use-material-calculations/index.js +1 -1
  102. package/dist/hooks/use-material-calculations/index.js.map +1 -1
  103. package/dist/hooks/useLangauge/index.esm.js +1 -2
  104. package/dist/hooks/useLangauge/index.esm.js.map +1 -1
  105. package/dist/hooks/useLangauge/index.js +1 -1
  106. package/dist/hooks/useLangauge/index.js.map +1 -1
  107. package/dist/index.esm.js +9 -1
  108. package/dist/index.esm.js.map +1 -1
  109. package/dist/index.js +1 -1
  110. package/dist/node_modules/@hookform/resolvers/yup/dist/yup/index.esm.js +14 -15
  111. package/dist/node_modules/@hookform/resolvers/yup/dist/yup/index.esm.js.map +1 -1
  112. package/dist/node_modules/@hookform/resolvers/yup/dist/yup/index.js +1 -1
  113. package/dist/node_modules/@hookform/resolvers/yup/dist/yup/index.js.map +1 -1
  114. package/dist/node_modules/@mui/base/TextareaAutosize/TextareaAutosize/index.esm.js +2 -3
  115. package/dist/node_modules/@mui/base/TextareaAutosize/TextareaAutosize/index.esm.js.map +1 -1
  116. package/dist/node_modules/@mui/base/TextareaAutosize/TextareaAutosize/index.js +1 -1
  117. package/dist/node_modules/@mui/base/TextareaAutosize/TextareaAutosize/index.js.map +1 -1
  118. package/dist/node_modules/@mui/lab/TabContext/TabContext/index.esm.js +2 -3
  119. package/dist/node_modules/@mui/lab/TabContext/TabContext/index.esm.js.map +1 -1
  120. package/dist/node_modules/@mui/lab/TabContext/TabContext/index.js +2 -2
  121. package/dist/node_modules/@mui/lab/TabContext/TabContext/index.js.map +1 -1
  122. package/dist/node_modules/@mui/lab/TabList/TabList/index.esm.js +1 -2
  123. package/dist/node_modules/@mui/lab/TabList/TabList/index.esm.js.map +1 -1
  124. package/dist/node_modules/@mui/lab/TabList/TabList/index.js +1 -1
  125. package/dist/node_modules/@mui/lab/TabList/TabList/index.js.map +1 -1
  126. package/dist/node_modules/@mui/lab/TabPanel/TabPanel/index.esm.js +1 -2
  127. package/dist/node_modules/@mui/lab/TabPanel/TabPanel/index.esm.js.map +1 -1
  128. package/dist/node_modules/@mui/lab/TabPanel/TabPanel/index.js +2 -2
  129. package/dist/node_modules/@mui/lab/TabPanel/TabPanel/index.js.map +1 -1
  130. package/dist/node_modules/@mui/lab/Timeline/Timeline/index.esm.js +1 -2
  131. package/dist/node_modules/@mui/lab/Timeline/Timeline/index.esm.js.map +1 -1
  132. package/dist/node_modules/@mui/lab/Timeline/Timeline/index.js +2 -2
  133. package/dist/node_modules/@mui/lab/Timeline/Timeline/index.js.map +1 -1
  134. package/dist/node_modules/@mui/lab/Timeline/TimelineContext/index.esm.js +1 -2
  135. package/dist/node_modules/@mui/lab/Timeline/TimelineContext/index.esm.js.map +1 -1
  136. package/dist/node_modules/@mui/lab/Timeline/TimelineContext/index.js +1 -1
  137. package/dist/node_modules/@mui/lab/Timeline/TimelineContext/index.js.map +1 -1
  138. package/dist/node_modules/@mui/lab/TimelineConnector/TimelineConnector/index.esm.js +1 -2
  139. package/dist/node_modules/@mui/lab/TimelineConnector/TimelineConnector/index.esm.js.map +1 -1
  140. package/dist/node_modules/@mui/lab/TimelineConnector/TimelineConnector/index.js +2 -2
  141. package/dist/node_modules/@mui/lab/TimelineConnector/TimelineConnector/index.js.map +1 -1
  142. package/dist/node_modules/@mui/lab/TimelineContent/TimelineContent/index.esm.js +1 -2
  143. package/dist/node_modules/@mui/lab/TimelineContent/TimelineContent/index.esm.js.map +1 -1
  144. package/dist/node_modules/@mui/lab/TimelineContent/TimelineContent/index.js +1 -1
  145. package/dist/node_modules/@mui/lab/TimelineContent/TimelineContent/index.js.map +1 -1
  146. package/dist/node_modules/@mui/lab/TimelineDot/TimelineDot/index.esm.js +1 -2
  147. package/dist/node_modules/@mui/lab/TimelineDot/TimelineDot/index.esm.js.map +1 -1
  148. package/dist/node_modules/@mui/lab/TimelineDot/TimelineDot/index.js +2 -2
  149. package/dist/node_modules/@mui/lab/TimelineDot/TimelineDot/index.js.map +1 -1
  150. package/dist/node_modules/@mui/lab/TimelineItem/TimelineItem/index.esm.js +1 -2
  151. package/dist/node_modules/@mui/lab/TimelineItem/TimelineItem/index.esm.js.map +1 -1
  152. package/dist/node_modules/@mui/lab/TimelineItem/TimelineItem/index.js +2 -2
  153. package/dist/node_modules/@mui/lab/TimelineItem/TimelineItem/index.js.map +1 -1
  154. package/dist/node_modules/@mui/lab/TimelineSeparator/TimelineSeparator/index.esm.js +1 -2
  155. package/dist/node_modules/@mui/lab/TimelineSeparator/TimelineSeparator/index.esm.js.map +1 -1
  156. package/dist/node_modules/@mui/lab/TimelineSeparator/TimelineSeparator/index.js +2 -2
  157. package/dist/node_modules/@mui/lab/TimelineSeparator/TimelineSeparator/index.js.map +1 -1
  158. package/dist/node_modules/@mui/material/Accordion/Accordion/index.esm.js +1 -2
  159. package/dist/node_modules/@mui/material/Accordion/Accordion/index.esm.js.map +1 -1
  160. package/dist/node_modules/@mui/material/Accordion/Accordion/index.js +2 -2
  161. package/dist/node_modules/@mui/material/Accordion/Accordion/index.js.map +1 -1
  162. package/dist/node_modules/@mui/material/Accordion/AccordionContext/index.esm.js +1 -2
  163. package/dist/node_modules/@mui/material/Accordion/AccordionContext/index.esm.js.map +1 -1
  164. package/dist/node_modules/@mui/material/Accordion/AccordionContext/index.js +1 -1
  165. package/dist/node_modules/@mui/material/Accordion/AccordionContext/index.js.map +1 -1
  166. package/dist/node_modules/@mui/material/AccordionActions/AccordionActions/index.esm.js +1 -2
  167. package/dist/node_modules/@mui/material/AccordionActions/AccordionActions/index.esm.js.map +1 -1
  168. package/dist/node_modules/@mui/material/AccordionActions/AccordionActions/index.js +1 -1
  169. package/dist/node_modules/@mui/material/AccordionActions/AccordionActions/index.js.map +1 -1
  170. package/dist/node_modules/@mui/material/AccordionDetails/AccordionDetails/index.esm.js +1 -2
  171. package/dist/node_modules/@mui/material/AccordionDetails/AccordionDetails/index.esm.js.map +1 -1
  172. package/dist/node_modules/@mui/material/AccordionDetails/AccordionDetails/index.js +2 -2
  173. package/dist/node_modules/@mui/material/AccordionDetails/AccordionDetails/index.js.map +1 -1
  174. package/dist/node_modules/@mui/material/AccordionSummary/AccordionSummary/index.esm.js +1 -2
  175. package/dist/node_modules/@mui/material/AccordionSummary/AccordionSummary/index.esm.js.map +1 -1
  176. package/dist/node_modules/@mui/material/AccordionSummary/AccordionSummary/index.js +2 -2
  177. package/dist/node_modules/@mui/material/AccordionSummary/AccordionSummary/index.js.map +1 -1
  178. package/dist/node_modules/@mui/material/Alert/Alert/index.esm.js +1 -2
  179. package/dist/node_modules/@mui/material/Alert/Alert/index.esm.js.map +1 -1
  180. package/dist/node_modules/@mui/material/Alert/Alert/index.js +1 -1
  181. package/dist/node_modules/@mui/material/Alert/Alert/index.js.map +1 -1
  182. package/dist/node_modules/@mui/material/AlertTitle/AlertTitle/index.esm.js +1 -2
  183. package/dist/node_modules/@mui/material/AlertTitle/AlertTitle/index.esm.js.map +1 -1
  184. package/dist/node_modules/@mui/material/AlertTitle/AlertTitle/index.js +1 -1
  185. package/dist/node_modules/@mui/material/AlertTitle/AlertTitle/index.js.map +1 -1
  186. package/dist/node_modules/@mui/material/AppBar/AppBar/index.esm.js +1 -2
  187. package/dist/node_modules/@mui/material/AppBar/AppBar/index.esm.js.map +1 -1
  188. package/dist/node_modules/@mui/material/AppBar/AppBar/index.js +1 -1
  189. package/dist/node_modules/@mui/material/AppBar/AppBar/index.js.map +1 -1
  190. package/dist/node_modules/@mui/material/Autocomplete/Autocomplete/index.esm.js +1 -2
  191. package/dist/node_modules/@mui/material/Autocomplete/Autocomplete/index.esm.js.map +1 -1
  192. package/dist/node_modules/@mui/material/Autocomplete/Autocomplete/index.js +1 -1
  193. package/dist/node_modules/@mui/material/Autocomplete/Autocomplete/index.js.map +1 -1
  194. package/dist/node_modules/@mui/material/Avatar/Avatar/index.esm.js +1 -2
  195. package/dist/node_modules/@mui/material/Avatar/Avatar/index.esm.js.map +1 -1
  196. package/dist/node_modules/@mui/material/Avatar/Avatar/index.js +1 -1
  197. package/dist/node_modules/@mui/material/Avatar/Avatar/index.js.map +1 -1
  198. package/dist/node_modules/@mui/material/AvatarGroup/AvatarGroup/index.esm.js +2 -3
  199. package/dist/node_modules/@mui/material/AvatarGroup/AvatarGroup/index.esm.js.map +1 -1
  200. package/dist/node_modules/@mui/material/AvatarGroup/AvatarGroup/index.js +2 -2
  201. package/dist/node_modules/@mui/material/AvatarGroup/AvatarGroup/index.js.map +1 -1
  202. package/dist/node_modules/@mui/material/Backdrop/Backdrop/index.esm.js +1 -2
  203. package/dist/node_modules/@mui/material/Backdrop/Backdrop/index.esm.js.map +1 -1
  204. package/dist/node_modules/@mui/material/Backdrop/Backdrop/index.js +1 -1
  205. package/dist/node_modules/@mui/material/Backdrop/Backdrop/index.js.map +1 -1
  206. package/dist/node_modules/@mui/material/Badge/Badge/index.esm.js +1 -2
  207. package/dist/node_modules/@mui/material/Badge/Badge/index.esm.js.map +1 -1
  208. package/dist/node_modules/@mui/material/Badge/Badge/index.js +1 -1
  209. package/dist/node_modules/@mui/material/Badge/Badge/index.js.map +1 -1
  210. package/dist/node_modules/@mui/material/BottomNavigation/BottomNavigation/index.esm.js +2 -3
  211. package/dist/node_modules/@mui/material/BottomNavigation/BottomNavigation/index.esm.js.map +1 -1
  212. package/dist/node_modules/@mui/material/BottomNavigation/BottomNavigation/index.js +3 -3
  213. package/dist/node_modules/@mui/material/BottomNavigation/BottomNavigation/index.js.map +1 -1
  214. package/dist/node_modules/@mui/material/BottomNavigationAction/BottomNavigationAction/index.esm.js +1 -2
  215. package/dist/node_modules/@mui/material/BottomNavigationAction/BottomNavigationAction/index.esm.js.map +1 -1
  216. package/dist/node_modules/@mui/material/BottomNavigationAction/BottomNavigationAction/index.js +2 -2
  217. package/dist/node_modules/@mui/material/BottomNavigationAction/BottomNavigationAction/index.js.map +1 -1
  218. package/dist/node_modules/@mui/material/Box/Box/index.esm.js +1 -2
  219. package/dist/node_modules/@mui/material/Box/Box/index.esm.js.map +1 -1
  220. package/dist/node_modules/@mui/material/Box/Box/index.js +1 -1
  221. package/dist/node_modules/@mui/material/Box/Box/index.js.map +1 -1
  222. package/dist/node_modules/@mui/material/Breadcrumbs/BreadcrumbCollapsed/index.esm.js +1 -2
  223. package/dist/node_modules/@mui/material/Breadcrumbs/BreadcrumbCollapsed/index.esm.js.map +1 -1
  224. package/dist/node_modules/@mui/material/Breadcrumbs/BreadcrumbCollapsed/index.js +2 -2
  225. package/dist/node_modules/@mui/material/Breadcrumbs/BreadcrumbCollapsed/index.js.map +1 -1
  226. package/dist/node_modules/@mui/material/Breadcrumbs/Breadcrumbs/index.esm.js +3 -4
  227. package/dist/node_modules/@mui/material/Breadcrumbs/Breadcrumbs/index.esm.js.map +1 -1
  228. package/dist/node_modules/@mui/material/Breadcrumbs/Breadcrumbs/index.js +2 -2
  229. package/dist/node_modules/@mui/material/Breadcrumbs/Breadcrumbs/index.js.map +1 -1
  230. package/dist/node_modules/@mui/material/Button/Button/index.esm.js +1 -2
  231. package/dist/node_modules/@mui/material/Button/Button/index.esm.js.map +1 -1
  232. package/dist/node_modules/@mui/material/Button/Button/index.js +1 -1
  233. package/dist/node_modules/@mui/material/Button/Button/index.js.map +1 -1
  234. package/dist/node_modules/@mui/material/ButtonBase/ButtonBase/index.esm.js +2 -3
  235. package/dist/node_modules/@mui/material/ButtonBase/ButtonBase/index.esm.js.map +1 -1
  236. package/dist/node_modules/@mui/material/ButtonBase/ButtonBase/index.js +3 -3
  237. package/dist/node_modules/@mui/material/ButtonBase/ButtonBase/index.js.map +1 -1
  238. package/dist/node_modules/@mui/material/ButtonBase/Ripple/index.esm.js +1 -2
  239. package/dist/node_modules/@mui/material/ButtonBase/Ripple/index.esm.js.map +1 -1
  240. package/dist/node_modules/@mui/material/ButtonBase/Ripple/index.js +1 -1
  241. package/dist/node_modules/@mui/material/ButtonBase/Ripple/index.js.map +1 -1
  242. package/dist/node_modules/@mui/material/ButtonBase/TouchRipple/index.esm.js +1 -2
  243. package/dist/node_modules/@mui/material/ButtonBase/TouchRipple/index.esm.js.map +1 -1
  244. package/dist/node_modules/@mui/material/ButtonBase/TouchRipple/index.js +1 -1
  245. package/dist/node_modules/@mui/material/ButtonBase/TouchRipple/index.js.map +1 -1
  246. package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroup/index.esm.js +1 -2
  247. package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroup/index.esm.js.map +1 -1
  248. package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroup/index.js +1 -1
  249. package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroup/index.js.map +1 -1
  250. package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupButtonContext/index.esm.js +1 -2
  251. package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupButtonContext/index.esm.js.map +1 -1
  252. package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupButtonContext/index.js +1 -1
  253. package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupButtonContext/index.js.map +1 -1
  254. package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupContext/index.esm.js +1 -2
  255. package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupContext/index.esm.js.map +1 -1
  256. package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupContext/index.js +1 -1
  257. package/dist/node_modules/@mui/material/ButtonGroup/ButtonGroupContext/index.js.map +1 -1
  258. package/dist/node_modules/@mui/material/Card/Card/index.esm.js +1 -2
  259. package/dist/node_modules/@mui/material/Card/Card/index.esm.js.map +1 -1
  260. package/dist/node_modules/@mui/material/Card/Card/index.js +1 -1
  261. package/dist/node_modules/@mui/material/Card/Card/index.js.map +1 -1
  262. package/dist/node_modules/@mui/material/CardActionArea/CardActionArea/index.esm.js +1 -2
  263. package/dist/node_modules/@mui/material/CardActionArea/CardActionArea/index.esm.js.map +1 -1
  264. package/dist/node_modules/@mui/material/CardActionArea/CardActionArea/index.js +2 -2
  265. package/dist/node_modules/@mui/material/CardActionArea/CardActionArea/index.js.map +1 -1
  266. package/dist/node_modules/@mui/material/CardActions/CardActions/index.esm.js +1 -2
  267. package/dist/node_modules/@mui/material/CardActions/CardActions/index.esm.js.map +1 -1
  268. package/dist/node_modules/@mui/material/CardActions/CardActions/index.js +2 -2
  269. package/dist/node_modules/@mui/material/CardActions/CardActions/index.js.map +1 -1
  270. package/dist/node_modules/@mui/material/CardContent/CardContent/index.esm.js +1 -2
  271. package/dist/node_modules/@mui/material/CardContent/CardContent/index.esm.js.map +1 -1
  272. package/dist/node_modules/@mui/material/CardContent/CardContent/index.js +1 -1
  273. package/dist/node_modules/@mui/material/CardContent/CardContent/index.js.map +1 -1
  274. package/dist/node_modules/@mui/material/CardHeader/CardHeader/index.esm.js +1 -2
  275. package/dist/node_modules/@mui/material/CardHeader/CardHeader/index.esm.js.map +1 -1
  276. package/dist/node_modules/@mui/material/CardHeader/CardHeader/index.js +1 -1
  277. package/dist/node_modules/@mui/material/CardHeader/CardHeader/index.js.map +1 -1
  278. package/dist/node_modules/@mui/material/CardMedia/CardMedia/index.esm.js +1 -2
  279. package/dist/node_modules/@mui/material/CardMedia/CardMedia/index.esm.js.map +1 -1
  280. package/dist/node_modules/@mui/material/CardMedia/CardMedia/index.js +2 -2
  281. package/dist/node_modules/@mui/material/CardMedia/CardMedia/index.js.map +1 -1
  282. package/dist/node_modules/@mui/material/Checkbox/Checkbox/index.esm.js +1 -2
  283. package/dist/node_modules/@mui/material/Checkbox/Checkbox/index.esm.js.map +1 -1
  284. package/dist/node_modules/@mui/material/Checkbox/Checkbox/index.js +1 -1
  285. package/dist/node_modules/@mui/material/Checkbox/Checkbox/index.js.map +1 -1
  286. package/dist/node_modules/@mui/material/Chip/Chip/index.esm.js +2 -3
  287. package/dist/node_modules/@mui/material/Chip/Chip/index.esm.js.map +1 -1
  288. package/dist/node_modules/@mui/material/Chip/Chip/index.js +1 -1
  289. package/dist/node_modules/@mui/material/Chip/Chip/index.js.map +1 -1
  290. package/dist/node_modules/@mui/material/CircularProgress/CircularProgress/index.esm.js +1 -2
  291. package/dist/node_modules/@mui/material/CircularProgress/CircularProgress/index.esm.js.map +1 -1
  292. package/dist/node_modules/@mui/material/CircularProgress/CircularProgress/index.js +6 -6
  293. package/dist/node_modules/@mui/material/CircularProgress/CircularProgress/index.js.map +1 -1
  294. package/dist/node_modules/@mui/material/ClickAwayListener/ClickAwayListener/index.esm.js +2 -3
  295. package/dist/node_modules/@mui/material/ClickAwayListener/ClickAwayListener/index.esm.js.map +1 -1
  296. package/dist/node_modules/@mui/material/ClickAwayListener/ClickAwayListener/index.js +1 -1
  297. package/dist/node_modules/@mui/material/ClickAwayListener/ClickAwayListener/index.js.map +1 -1
  298. package/dist/node_modules/@mui/material/Collapse/Collapse/index.esm.js +1 -2
  299. package/dist/node_modules/@mui/material/Collapse/Collapse/index.esm.js.map +1 -1
  300. package/dist/node_modules/@mui/material/Collapse/Collapse/index.js +1 -1
  301. package/dist/node_modules/@mui/material/Collapse/Collapse/index.js.map +1 -1
  302. package/dist/node_modules/@mui/material/Container/Container/index.esm.js +1 -2
  303. package/dist/node_modules/@mui/material/Container/Container/index.esm.js.map +1 -1
  304. package/dist/node_modules/@mui/material/Container/Container/index.js +1 -1
  305. package/dist/node_modules/@mui/material/Container/Container/index.js.map +1 -1
  306. package/dist/node_modules/@mui/material/CssBaseline/CssBaseline/index.esm.js +1 -2
  307. package/dist/node_modules/@mui/material/CssBaseline/CssBaseline/index.esm.js.map +1 -1
  308. package/dist/node_modules/@mui/material/CssBaseline/CssBaseline/index.js +2 -2
  309. package/dist/node_modules/@mui/material/CssBaseline/CssBaseline/index.js.map +1 -1
  310. package/dist/node_modules/@mui/material/Dialog/Dialog/index.esm.js +1 -2
  311. package/dist/node_modules/@mui/material/Dialog/Dialog/index.esm.js.map +1 -1
  312. package/dist/node_modules/@mui/material/Dialog/Dialog/index.js +1 -1
  313. package/dist/node_modules/@mui/material/Dialog/Dialog/index.js.map +1 -1
  314. package/dist/node_modules/@mui/material/Dialog/DialogContext/index.esm.js +1 -2
  315. package/dist/node_modules/@mui/material/Dialog/DialogContext/index.esm.js.map +1 -1
  316. package/dist/node_modules/@mui/material/Dialog/DialogContext/index.js +1 -1
  317. package/dist/node_modules/@mui/material/Dialog/DialogContext/index.js.map +1 -1
  318. package/dist/node_modules/@mui/material/DialogActions/DialogActions/index.esm.js +1 -2
  319. package/dist/node_modules/@mui/material/DialogActions/DialogActions/index.esm.js.map +1 -1
  320. package/dist/node_modules/@mui/material/DialogActions/DialogActions/index.js +1 -1
  321. package/dist/node_modules/@mui/material/DialogActions/DialogActions/index.js.map +1 -1
  322. package/dist/node_modules/@mui/material/DialogContent/DialogContent/index.esm.js +1 -2
  323. package/dist/node_modules/@mui/material/DialogContent/DialogContent/index.esm.js.map +1 -1
  324. package/dist/node_modules/@mui/material/DialogContent/DialogContent/index.js +2 -2
  325. package/dist/node_modules/@mui/material/DialogContent/DialogContent/index.js.map +1 -1
  326. package/dist/node_modules/@mui/material/DialogContentText/DialogContentText/index.esm.js +1 -2
  327. package/dist/node_modules/@mui/material/DialogContentText/DialogContentText/index.esm.js.map +1 -1
  328. package/dist/node_modules/@mui/material/DialogContentText/DialogContentText/index.js +1 -1
  329. package/dist/node_modules/@mui/material/DialogContentText/DialogContentText/index.js.map +1 -1
  330. package/dist/node_modules/@mui/material/DialogTitle/DialogTitle/index.esm.js +1 -2
  331. package/dist/node_modules/@mui/material/DialogTitle/DialogTitle/index.esm.js.map +1 -1
  332. package/dist/node_modules/@mui/material/DialogTitle/DialogTitle/index.js +1 -1
  333. package/dist/node_modules/@mui/material/DialogTitle/DialogTitle/index.js.map +1 -1
  334. package/dist/node_modules/@mui/material/Divider/Divider/index.esm.js +1 -2
  335. package/dist/node_modules/@mui/material/Divider/Divider/index.esm.js.map +1 -1
  336. package/dist/node_modules/@mui/material/Divider/Divider/index.js +1 -1
  337. package/dist/node_modules/@mui/material/Divider/Divider/index.js.map +1 -1
  338. package/dist/node_modules/@mui/material/Drawer/Drawer/index.esm.js +1 -2
  339. package/dist/node_modules/@mui/material/Drawer/Drawer/index.esm.js.map +1 -1
  340. package/dist/node_modules/@mui/material/Drawer/Drawer/index.js +1 -1
  341. package/dist/node_modules/@mui/material/Drawer/Drawer/index.js.map +1 -1
  342. package/dist/node_modules/@mui/material/Fab/Fab/index.esm.js +1 -2
  343. package/dist/node_modules/@mui/material/Fab/Fab/index.esm.js.map +1 -1
  344. package/dist/node_modules/@mui/material/Fab/Fab/index.js +2 -2
  345. package/dist/node_modules/@mui/material/Fab/Fab/index.js.map +1 -1
  346. package/dist/node_modules/@mui/material/Fade/Fade/index.esm.js +1 -2
  347. package/dist/node_modules/@mui/material/Fade/Fade/index.esm.js.map +1 -1
  348. package/dist/node_modules/@mui/material/Fade/Fade/index.js +1 -1
  349. package/dist/node_modules/@mui/material/Fade/Fade/index.js.map +1 -1
  350. package/dist/node_modules/@mui/material/FilledInput/FilledInput/index.esm.js +1 -2
  351. package/dist/node_modules/@mui/material/FilledInput/FilledInput/index.esm.js.map +1 -1
  352. package/dist/node_modules/@mui/material/FilledInput/FilledInput/index.js +1 -1
  353. package/dist/node_modules/@mui/material/FilledInput/FilledInput/index.js.map +1 -1
  354. package/dist/node_modules/@mui/material/FormControl/FormControl/index.esm.js +2 -3
  355. package/dist/node_modules/@mui/material/FormControl/FormControl/index.esm.js.map +1 -1
  356. package/dist/node_modules/@mui/material/FormControl/FormControl/index.js +2 -2
  357. package/dist/node_modules/@mui/material/FormControl/FormControl/index.js.map +1 -1
  358. package/dist/node_modules/@mui/material/FormControl/FormControlContext/index.esm.js +1 -2
  359. package/dist/node_modules/@mui/material/FormControl/FormControlContext/index.esm.js.map +1 -1
  360. package/dist/node_modules/@mui/material/FormControl/FormControlContext/index.js +1 -1
  361. package/dist/node_modules/@mui/material/FormControl/FormControlContext/index.js.map +1 -1
  362. package/dist/node_modules/@mui/material/FormControlLabel/FormControlLabel/index.esm.js +1 -2
  363. package/dist/node_modules/@mui/material/FormControlLabel/FormControlLabel/index.esm.js.map +1 -1
  364. package/dist/node_modules/@mui/material/FormControlLabel/FormControlLabel/index.js +1 -1
  365. package/dist/node_modules/@mui/material/FormControlLabel/FormControlLabel/index.js.map +1 -1
  366. package/dist/node_modules/@mui/material/FormGroup/FormGroup/index.esm.js +1 -2
  367. package/dist/node_modules/@mui/material/FormGroup/FormGroup/index.esm.js.map +1 -1
  368. package/dist/node_modules/@mui/material/FormGroup/FormGroup/index.js +1 -1
  369. package/dist/node_modules/@mui/material/FormGroup/FormGroup/index.js.map +1 -1
  370. package/dist/node_modules/@mui/material/FormHelperText/FormHelperText/index.esm.js +1 -2
  371. package/dist/node_modules/@mui/material/FormHelperText/FormHelperText/index.esm.js.map +1 -1
  372. package/dist/node_modules/@mui/material/FormHelperText/FormHelperText/index.js +2 -2
  373. package/dist/node_modules/@mui/material/FormHelperText/FormHelperText/index.js.map +1 -1
  374. package/dist/node_modules/@mui/material/FormLabel/FormLabel/index.esm.js +1 -2
  375. package/dist/node_modules/@mui/material/FormLabel/FormLabel/index.esm.js.map +1 -1
  376. package/dist/node_modules/@mui/material/FormLabel/FormLabel/index.js +1 -1
  377. package/dist/node_modules/@mui/material/FormLabel/FormLabel/index.js.map +1 -1
  378. package/dist/node_modules/@mui/material/GlobalStyles/GlobalStyles/index.esm.js +1 -2
  379. package/dist/node_modules/@mui/material/GlobalStyles/GlobalStyles/index.esm.js.map +1 -1
  380. package/dist/node_modules/@mui/material/GlobalStyles/GlobalStyles/index.js +2 -2
  381. package/dist/node_modules/@mui/material/GlobalStyles/GlobalStyles/index.js.map +1 -1
  382. package/dist/node_modules/@mui/material/Grid/Grid/index.esm.js +2 -3
  383. package/dist/node_modules/@mui/material/Grid/Grid/index.esm.js.map +1 -1
  384. package/dist/node_modules/@mui/material/Grid/Grid/index.js +2 -2
  385. package/dist/node_modules/@mui/material/Grid/Grid/index.js.map +1 -1
  386. package/dist/node_modules/@mui/material/Grid/GridContext/index.esm.js +1 -2
  387. package/dist/node_modules/@mui/material/Grid/GridContext/index.esm.js.map +1 -1
  388. package/dist/node_modules/@mui/material/Grid/GridContext/index.js +1 -1
  389. package/dist/node_modules/@mui/material/Grid/GridContext/index.js.map +1 -1
  390. package/dist/node_modules/@mui/material/Grow/Grow/index.esm.js +1 -2
  391. package/dist/node_modules/@mui/material/Grow/Grow/index.esm.js.map +1 -1
  392. package/dist/node_modules/@mui/material/Grow/Grow/index.js +2 -2
  393. package/dist/node_modules/@mui/material/Grow/Grow/index.js.map +1 -1
  394. package/dist/node_modules/@mui/material/Hidden/Hidden/index.esm.js +1 -2
  395. package/dist/node_modules/@mui/material/Hidden/Hidden/index.esm.js.map +1 -1
  396. package/dist/node_modules/@mui/material/Hidden/Hidden/index.js +1 -1
  397. package/dist/node_modules/@mui/material/Hidden/Hidden/index.js.map +1 -1
  398. package/dist/node_modules/@mui/material/Hidden/HiddenCss/index.esm.js +2 -3
  399. package/dist/node_modules/@mui/material/Hidden/HiddenCss/index.esm.js.map +1 -1
  400. package/dist/node_modules/@mui/material/Hidden/HiddenCss/index.js +2 -2
  401. package/dist/node_modules/@mui/material/Hidden/HiddenCss/index.js.map +1 -1
  402. package/dist/node_modules/@mui/material/Hidden/HiddenJs/index.esm.js +3 -4
  403. package/dist/node_modules/@mui/material/Hidden/HiddenJs/index.esm.js.map +1 -1
  404. package/dist/node_modules/@mui/material/Hidden/HiddenJs/index.js +1 -1
  405. package/dist/node_modules/@mui/material/Hidden/HiddenJs/index.js.map +1 -1
  406. package/dist/node_modules/@mui/material/Hidden/withWidth/index.esm.js +2 -3
  407. package/dist/node_modules/@mui/material/Hidden/withWidth/index.esm.js.map +1 -1
  408. package/dist/node_modules/@mui/material/Hidden/withWidth/index.js +1 -1
  409. package/dist/node_modules/@mui/material/Hidden/withWidth/index.js.map +1 -1
  410. package/dist/node_modules/@mui/material/Icon/Icon/index.esm.js +1 -2
  411. package/dist/node_modules/@mui/material/Icon/Icon/index.esm.js.map +1 -1
  412. package/dist/node_modules/@mui/material/Icon/Icon/index.js +2 -2
  413. package/dist/node_modules/@mui/material/Icon/Icon/index.js.map +1 -1
  414. package/dist/node_modules/@mui/material/IconButton/IconButton/index.esm.js +1 -2
  415. package/dist/node_modules/@mui/material/IconButton/IconButton/index.esm.js.map +1 -1
  416. package/dist/node_modules/@mui/material/IconButton/IconButton/index.js +1 -1
  417. package/dist/node_modules/@mui/material/IconButton/IconButton/index.js.map +1 -1
  418. package/dist/node_modules/@mui/material/ImageList/ImageList/index.esm.js +2 -3
  419. package/dist/node_modules/@mui/material/ImageList/ImageList/index.esm.js.map +1 -1
  420. package/dist/node_modules/@mui/material/ImageList/ImageList/index.js +2 -2
  421. package/dist/node_modules/@mui/material/ImageList/ImageList/index.js.map +1 -1
  422. package/dist/node_modules/@mui/material/ImageList/ImageListContext/index.esm.js +1 -2
  423. package/dist/node_modules/@mui/material/ImageList/ImageListContext/index.esm.js.map +1 -1
  424. package/dist/node_modules/@mui/material/ImageList/ImageListContext/index.js +1 -1
  425. package/dist/node_modules/@mui/material/ImageList/ImageListContext/index.js.map +1 -1
  426. package/dist/node_modules/@mui/material/ImageListItem/ImageListItem/index.esm.js +2 -3
  427. package/dist/node_modules/@mui/material/ImageListItem/ImageListItem/index.esm.js.map +1 -1
  428. package/dist/node_modules/@mui/material/ImageListItem/ImageListItem/index.js +2 -2
  429. package/dist/node_modules/@mui/material/ImageListItem/ImageListItem/index.js.map +1 -1
  430. package/dist/node_modules/@mui/material/ImageListItemBar/ImageListItemBar/index.esm.js +1 -2
  431. package/dist/node_modules/@mui/material/ImageListItemBar/ImageListItemBar/index.esm.js.map +1 -1
  432. package/dist/node_modules/@mui/material/ImageListItemBar/ImageListItemBar/index.js +1 -1
  433. package/dist/node_modules/@mui/material/ImageListItemBar/ImageListItemBar/index.js.map +1 -1
  434. package/dist/node_modules/@mui/material/Input/Input/index.esm.js +1 -2
  435. package/dist/node_modules/@mui/material/Input/Input/index.esm.js.map +1 -1
  436. package/dist/node_modules/@mui/material/Input/Input/index.js +2 -2
  437. package/dist/node_modules/@mui/material/Input/Input/index.js.map +1 -1
  438. package/dist/node_modules/@mui/material/InputAdornment/InputAdornment/index.esm.js +2 -3
  439. package/dist/node_modules/@mui/material/InputAdornment/InputAdornment/index.esm.js.map +1 -1
  440. package/dist/node_modules/@mui/material/InputAdornment/InputAdornment/index.js +2 -2
  441. package/dist/node_modules/@mui/material/InputAdornment/InputAdornment/index.js.map +1 -1
  442. package/dist/node_modules/@mui/material/InputBase/InputBase/index.esm.js +5 -6
  443. package/dist/node_modules/@mui/material/InputBase/InputBase/index.esm.js.map +1 -1
  444. package/dist/node_modules/@mui/material/InputBase/InputBase/index.js +1 -1
  445. package/dist/node_modules/@mui/material/InputBase/InputBase/index.js.map +1 -1
  446. package/dist/node_modules/@mui/material/InputLabel/InputLabel/index.esm.js +1 -2
  447. package/dist/node_modules/@mui/material/InputLabel/InputLabel/index.esm.js.map +1 -1
  448. package/dist/node_modules/@mui/material/InputLabel/InputLabel/index.js +1 -1
  449. package/dist/node_modules/@mui/material/InputLabel/InputLabel/index.js.map +1 -1
  450. package/dist/node_modules/@mui/material/LinearProgress/LinearProgress/index.esm.js +3 -4
  451. package/dist/node_modules/@mui/material/LinearProgress/LinearProgress/index.esm.js.map +1 -1
  452. package/dist/node_modules/@mui/material/LinearProgress/LinearProgress/index.js +5 -5
  453. package/dist/node_modules/@mui/material/LinearProgress/LinearProgress/index.js.map +1 -1
  454. package/dist/node_modules/@mui/material/Link/Link/index.esm.js +1 -2
  455. package/dist/node_modules/@mui/material/Link/Link/index.esm.js.map +1 -1
  456. package/dist/node_modules/@mui/material/Link/Link/index.js +1 -1
  457. package/dist/node_modules/@mui/material/Link/Link/index.js.map +1 -1
  458. package/dist/node_modules/@mui/material/List/List/index.esm.js +1 -2
  459. package/dist/node_modules/@mui/material/List/List/index.esm.js.map +1 -1
  460. package/dist/node_modules/@mui/material/List/List/index.js +2 -2
  461. package/dist/node_modules/@mui/material/List/List/index.js.map +1 -1
  462. package/dist/node_modules/@mui/material/List/ListContext/index.esm.js +1 -2
  463. package/dist/node_modules/@mui/material/List/ListContext/index.esm.js.map +1 -1
  464. package/dist/node_modules/@mui/material/List/ListContext/index.js +1 -1
  465. package/dist/node_modules/@mui/material/List/ListContext/index.js.map +1 -1
  466. package/dist/node_modules/@mui/material/ListItem/ListItem/index.esm.js +2 -3
  467. package/dist/node_modules/@mui/material/ListItem/ListItem/index.esm.js.map +1 -1
  468. package/dist/node_modules/@mui/material/ListItem/ListItem/index.js +1 -1
  469. package/dist/node_modules/@mui/material/ListItem/ListItem/index.js.map +1 -1
  470. package/dist/node_modules/@mui/material/ListItemAvatar/ListItemAvatar/index.esm.js +1 -2
  471. package/dist/node_modules/@mui/material/ListItemAvatar/ListItemAvatar/index.esm.js.map +1 -1
  472. package/dist/node_modules/@mui/material/ListItemAvatar/ListItemAvatar/index.js +1 -1
  473. package/dist/node_modules/@mui/material/ListItemAvatar/ListItemAvatar/index.js.map +1 -1
  474. package/dist/node_modules/@mui/material/ListItemButton/ListItemButton/index.esm.js +2 -3
  475. package/dist/node_modules/@mui/material/ListItemButton/ListItemButton/index.esm.js.map +1 -1
  476. package/dist/node_modules/@mui/material/ListItemButton/ListItemButton/index.js +2 -2
  477. package/dist/node_modules/@mui/material/ListItemButton/ListItemButton/index.js.map +1 -1
  478. package/dist/node_modules/@mui/material/ListItemIcon/ListItemIcon/index.esm.js +1 -2
  479. package/dist/node_modules/@mui/material/ListItemIcon/ListItemIcon/index.esm.js.map +1 -1
  480. package/dist/node_modules/@mui/material/ListItemIcon/ListItemIcon/index.js +2 -2
  481. package/dist/node_modules/@mui/material/ListItemIcon/ListItemIcon/index.js.map +1 -1
  482. package/dist/node_modules/@mui/material/ListItemSecondaryAction/ListItemSecondaryAction/index.esm.js +1 -2
  483. package/dist/node_modules/@mui/material/ListItemSecondaryAction/ListItemSecondaryAction/index.esm.js.map +1 -1
  484. package/dist/node_modules/@mui/material/ListItemSecondaryAction/ListItemSecondaryAction/index.js +2 -2
  485. package/dist/node_modules/@mui/material/ListItemSecondaryAction/ListItemSecondaryAction/index.js.map +1 -1
  486. package/dist/node_modules/@mui/material/ListItemText/ListItemText/index.esm.js +1 -2
  487. package/dist/node_modules/@mui/material/ListItemText/ListItemText/index.esm.js.map +1 -1
  488. package/dist/node_modules/@mui/material/ListItemText/ListItemText/index.js +1 -1
  489. package/dist/node_modules/@mui/material/ListItemText/ListItemText/index.js.map +1 -1
  490. package/dist/node_modules/@mui/material/ListSubheader/ListSubheader/index.esm.js +1 -2
  491. package/dist/node_modules/@mui/material/ListSubheader/ListSubheader/index.esm.js.map +1 -1
  492. package/dist/node_modules/@mui/material/ListSubheader/ListSubheader/index.js +2 -2
  493. package/dist/node_modules/@mui/material/ListSubheader/ListSubheader/index.js.map +1 -1
  494. package/dist/node_modules/@mui/material/Menu/Menu/index.esm.js +2 -3
  495. package/dist/node_modules/@mui/material/Menu/Menu/index.esm.js.map +1 -1
  496. package/dist/node_modules/@mui/material/Menu/Menu/index.js +2 -2
  497. package/dist/node_modules/@mui/material/Menu/Menu/index.js.map +1 -1
  498. package/dist/node_modules/@mui/material/MenuItem/MenuItem/index.esm.js +2 -3
  499. package/dist/node_modules/@mui/material/MenuItem/MenuItem/index.esm.js.map +1 -1
  500. package/dist/node_modules/@mui/material/MenuItem/MenuItem/index.js +1 -1
  501. package/dist/node_modules/@mui/material/MenuItem/MenuItem/index.js.map +1 -1
  502. package/dist/node_modules/@mui/material/MenuList/MenuList/index.esm.js +2 -3
  503. package/dist/node_modules/@mui/material/MenuList/MenuList/index.esm.js.map +1 -1
  504. package/dist/node_modules/@mui/material/MenuList/MenuList/index.js +2 -2
  505. package/dist/node_modules/@mui/material/MenuList/MenuList/index.js.map +1 -1
  506. package/dist/node_modules/@mui/material/MobileStepper/MobileStepper/index.esm.js +1 -2
  507. package/dist/node_modules/@mui/material/MobileStepper/MobileStepper/index.esm.js.map +1 -1
  508. package/dist/node_modules/@mui/material/MobileStepper/MobileStepper/index.js +1 -1
  509. package/dist/node_modules/@mui/material/MobileStepper/MobileStepper/index.js.map +1 -1
  510. package/dist/node_modules/@mui/material/Modal/Modal/index.esm.js +1 -2
  511. package/dist/node_modules/@mui/material/Modal/Modal/index.esm.js.map +1 -1
  512. package/dist/node_modules/@mui/material/Modal/Modal/index.js +1 -1
  513. package/dist/node_modules/@mui/material/Modal/Modal/index.js.map +1 -1
  514. package/dist/node_modules/@mui/material/NativeSelect/NativeSelect/index.esm.js +1 -2
  515. package/dist/node_modules/@mui/material/NativeSelect/NativeSelect/index.esm.js.map +1 -1
  516. package/dist/node_modules/@mui/material/NativeSelect/NativeSelect/index.js +2 -2
  517. package/dist/node_modules/@mui/material/NativeSelect/NativeSelect/index.js.map +1 -1
  518. package/dist/node_modules/@mui/material/NativeSelect/NativeSelectInput/index.esm.js +1 -2
  519. package/dist/node_modules/@mui/material/NativeSelect/NativeSelectInput/index.esm.js.map +1 -1
  520. package/dist/node_modules/@mui/material/NativeSelect/NativeSelectInput/index.js +1 -1
  521. package/dist/node_modules/@mui/material/NativeSelect/NativeSelectInput/index.js.map +1 -1
  522. package/dist/node_modules/@mui/material/NoSsr/NoSsr/index.esm.js +2 -3
  523. package/dist/node_modules/@mui/material/NoSsr/NoSsr/index.esm.js.map +1 -1
  524. package/dist/node_modules/@mui/material/NoSsr/NoSsr/index.js +1 -1
  525. package/dist/node_modules/@mui/material/NoSsr/NoSsr/index.js.map +1 -1
  526. package/dist/node_modules/@mui/material/OutlinedInput/NotchedOutline/index.esm.js +1 -2
  527. package/dist/node_modules/@mui/material/OutlinedInput/NotchedOutline/index.esm.js.map +1 -1
  528. package/dist/node_modules/@mui/material/OutlinedInput/NotchedOutline/index.js +1 -1
  529. package/dist/node_modules/@mui/material/OutlinedInput/NotchedOutline/index.js.map +1 -1
  530. package/dist/node_modules/@mui/material/OutlinedInput/OutlinedInput/index.esm.js +1 -2
  531. package/dist/node_modules/@mui/material/OutlinedInput/OutlinedInput/index.esm.js.map +1 -1
  532. package/dist/node_modules/@mui/material/OutlinedInput/OutlinedInput/index.js +2 -2
  533. package/dist/node_modules/@mui/material/OutlinedInput/OutlinedInput/index.js.map +1 -1
  534. package/dist/node_modules/@mui/material/Pagination/Pagination/index.esm.js +1 -2
  535. package/dist/node_modules/@mui/material/Pagination/Pagination/index.esm.js.map +1 -1
  536. package/dist/node_modules/@mui/material/Pagination/Pagination/index.js +1 -1
  537. package/dist/node_modules/@mui/material/Pagination/Pagination/index.js.map +1 -1
  538. package/dist/node_modules/@mui/material/PaginationItem/PaginationItem/index.esm.js +1 -2
  539. package/dist/node_modules/@mui/material/PaginationItem/PaginationItem/index.esm.js.map +1 -1
  540. package/dist/node_modules/@mui/material/PaginationItem/PaginationItem/index.js +1 -1
  541. package/dist/node_modules/@mui/material/PaginationItem/PaginationItem/index.js.map +1 -1
  542. package/dist/node_modules/@mui/material/Paper/Paper/index.esm.js +2 -3
  543. package/dist/node_modules/@mui/material/Paper/Paper/index.esm.js.map +1 -1
  544. package/dist/node_modules/@mui/material/Paper/Paper/index.js +1 -1
  545. package/dist/node_modules/@mui/material/Paper/Paper/index.js.map +1 -1
  546. package/dist/node_modules/@mui/material/Popover/Popover/index.esm.js +6 -7
  547. package/dist/node_modules/@mui/material/Popover/Popover/index.esm.js.map +1 -1
  548. package/dist/node_modules/@mui/material/Popover/Popover/index.js +2 -2
  549. package/dist/node_modules/@mui/material/Popover/Popover/index.js.map +1 -1
  550. package/dist/node_modules/@mui/material/Popper/BasePopper/index.esm.js +4 -5
  551. package/dist/node_modules/@mui/material/Popper/BasePopper/index.esm.js.map +1 -1
  552. package/dist/node_modules/@mui/material/Popper/BasePopper/index.js +3 -3
  553. package/dist/node_modules/@mui/material/Popper/BasePopper/index.js.map +1 -1
  554. package/dist/node_modules/@mui/material/Popper/Popper/index.esm.js +1 -2
  555. package/dist/node_modules/@mui/material/Popper/Popper/index.esm.js.map +1 -1
  556. package/dist/node_modules/@mui/material/Popper/Popper/index.js +1 -1
  557. package/dist/node_modules/@mui/material/Popper/Popper/index.js.map +1 -1
  558. package/dist/node_modules/@mui/material/Portal/Portal/index.esm.js +2 -3
  559. package/dist/node_modules/@mui/material/Portal/Portal/index.esm.js.map +1 -1
  560. package/dist/node_modules/@mui/material/Portal/Portal/index.js +4 -4
  561. package/dist/node_modules/@mui/material/Portal/Portal/index.js.map +1 -1
  562. package/dist/node_modules/@mui/material/Radio/Radio/index.esm.js +1 -2
  563. package/dist/node_modules/@mui/material/Radio/Radio/index.esm.js.map +1 -1
  564. package/dist/node_modules/@mui/material/Radio/Radio/index.js +1 -1
  565. package/dist/node_modules/@mui/material/Radio/Radio/index.js.map +1 -1
  566. package/dist/node_modules/@mui/material/Radio/RadioButtonIcon/index.esm.js +1 -2
  567. package/dist/node_modules/@mui/material/Radio/RadioButtonIcon/index.esm.js.map +1 -1
  568. package/dist/node_modules/@mui/material/Radio/RadioButtonIcon/index.js +2 -2
  569. package/dist/node_modules/@mui/material/Radio/RadioButtonIcon/index.js.map +1 -1
  570. package/dist/node_modules/@mui/material/RadioGroup/RadioGroup/index.esm.js +1 -2
  571. package/dist/node_modules/@mui/material/RadioGroup/RadioGroup/index.esm.js.map +1 -1
  572. package/dist/node_modules/@mui/material/RadioGroup/RadioGroup/index.js +2 -2
  573. package/dist/node_modules/@mui/material/RadioGroup/RadioGroup/index.js.map +1 -1
  574. package/dist/node_modules/@mui/material/RadioGroup/RadioGroupContext/index.esm.js +1 -2
  575. package/dist/node_modules/@mui/material/RadioGroup/RadioGroupContext/index.esm.js.map +1 -1
  576. package/dist/node_modules/@mui/material/RadioGroup/RadioGroupContext/index.js +1 -1
  577. package/dist/node_modules/@mui/material/RadioGroup/RadioGroupContext/index.js.map +1 -1
  578. package/dist/node_modules/@mui/material/Rating/Rating/index.esm.js +3 -4
  579. package/dist/node_modules/@mui/material/Rating/Rating/index.esm.js.map +1 -1
  580. package/dist/node_modules/@mui/material/Rating/Rating/index.js +6 -6
  581. package/dist/node_modules/@mui/material/Rating/Rating/index.js.map +1 -1
  582. package/dist/node_modules/@mui/material/ScopedCssBaseline/ScopedCssBaseline/index.esm.js +1 -2
  583. package/dist/node_modules/@mui/material/ScopedCssBaseline/ScopedCssBaseline/index.esm.js.map +1 -1
  584. package/dist/node_modules/@mui/material/ScopedCssBaseline/ScopedCssBaseline/index.js +2 -2
  585. package/dist/node_modules/@mui/material/ScopedCssBaseline/ScopedCssBaseline/index.js.map +1 -1
  586. package/dist/node_modules/@mui/material/Select/Select/index.esm.js +1 -2
  587. package/dist/node_modules/@mui/material/Select/Select/index.esm.js.map +1 -1
  588. package/dist/node_modules/@mui/material/Select/Select/index.js +1 -1
  589. package/dist/node_modules/@mui/material/Select/Select/index.js.map +1 -1
  590. package/dist/node_modules/@mui/material/Select/SelectInput/index.esm.js +4 -5
  591. package/dist/node_modules/@mui/material/Select/SelectInput/index.esm.js.map +1 -1
  592. package/dist/node_modules/@mui/material/Select/SelectInput/index.js +2 -2
  593. package/dist/node_modules/@mui/material/Select/SelectInput/index.js.map +1 -1
  594. package/dist/node_modules/@mui/material/Skeleton/Skeleton/index.esm.js +1 -2
  595. package/dist/node_modules/@mui/material/Skeleton/Skeleton/index.esm.js.map +1 -1
  596. package/dist/node_modules/@mui/material/Skeleton/Skeleton/index.js +1 -1
  597. package/dist/node_modules/@mui/material/Skeleton/Skeleton/index.js.map +1 -1
  598. package/dist/node_modules/@mui/material/Slide/Slide/index.esm.js +2 -3
  599. package/dist/node_modules/@mui/material/Slide/Slide/index.esm.js.map +1 -1
  600. package/dist/node_modules/@mui/material/Slide/Slide/index.js +1 -1
  601. package/dist/node_modules/@mui/material/Slide/Slide/index.js.map +1 -1
  602. package/dist/node_modules/@mui/material/Slider/Slider/index.esm.js +1 -2
  603. package/dist/node_modules/@mui/material/Slider/Slider/index.esm.js.map +1 -1
  604. package/dist/node_modules/@mui/material/Slider/Slider/index.js +1 -1
  605. package/dist/node_modules/@mui/material/Slider/Slider/index.js.map +1 -1
  606. package/dist/node_modules/@mui/material/Slider/SliderValueLabel/index.esm.js +1 -2
  607. package/dist/node_modules/@mui/material/Slider/SliderValueLabel/index.esm.js.map +1 -1
  608. package/dist/node_modules/@mui/material/Slider/SliderValueLabel/index.js +1 -1
  609. package/dist/node_modules/@mui/material/Slider/SliderValueLabel/index.js.map +1 -1
  610. package/dist/node_modules/@mui/material/Snackbar/Snackbar/index.esm.js +1 -2
  611. package/dist/node_modules/@mui/material/Snackbar/Snackbar/index.esm.js.map +1 -1
  612. package/dist/node_modules/@mui/material/Snackbar/Snackbar/index.js +1 -1
  613. package/dist/node_modules/@mui/material/Snackbar/Snackbar/index.js.map +1 -1
  614. package/dist/node_modules/@mui/material/SnackbarContent/SnackbarContent/index.esm.js +1 -2
  615. package/dist/node_modules/@mui/material/SnackbarContent/SnackbarContent/index.esm.js.map +1 -1
  616. package/dist/node_modules/@mui/material/SnackbarContent/SnackbarContent/index.js +1 -1
  617. package/dist/node_modules/@mui/material/SnackbarContent/SnackbarContent/index.js.map +1 -1
  618. package/dist/node_modules/@mui/material/SpeedDial/SpeedDial/index.esm.js +2 -3
  619. package/dist/node_modules/@mui/material/SpeedDial/SpeedDial/index.esm.js.map +1 -1
  620. package/dist/node_modules/@mui/material/SpeedDial/SpeedDial/index.js +3 -3
  621. package/dist/node_modules/@mui/material/SpeedDial/SpeedDial/index.js.map +1 -1
  622. package/dist/node_modules/@mui/material/SpeedDialAction/SpeedDialAction/index.esm.js +1 -2
  623. package/dist/node_modules/@mui/material/SpeedDialAction/SpeedDialAction/index.esm.js.map +1 -1
  624. package/dist/node_modules/@mui/material/SpeedDialAction/SpeedDialAction/index.js +1 -1
  625. package/dist/node_modules/@mui/material/SpeedDialAction/SpeedDialAction/index.js.map +1 -1
  626. package/dist/node_modules/@mui/material/SpeedDialIcon/SpeedDialIcon/index.esm.js +1 -2
  627. package/dist/node_modules/@mui/material/SpeedDialIcon/SpeedDialIcon/index.esm.js.map +1 -1
  628. package/dist/node_modules/@mui/material/SpeedDialIcon/SpeedDialIcon/index.js +2 -2
  629. package/dist/node_modules/@mui/material/SpeedDialIcon/SpeedDialIcon/index.js.map +1 -1
  630. package/dist/node_modules/@mui/material/Stack/Stack/index.esm.js +1 -2
  631. package/dist/node_modules/@mui/material/Stack/Stack/index.esm.js.map +1 -1
  632. package/dist/node_modules/@mui/material/Stack/Stack/index.js +1 -1
  633. package/dist/node_modules/@mui/material/Stack/Stack/index.js.map +1 -1
  634. package/dist/node_modules/@mui/material/Step/Step/index.esm.js +1 -2
  635. package/dist/node_modules/@mui/material/Step/Step/index.esm.js.map +1 -1
  636. package/dist/node_modules/@mui/material/Step/Step/index.js +1 -1
  637. package/dist/node_modules/@mui/material/Step/Step/index.js.map +1 -1
  638. package/dist/node_modules/@mui/material/Step/StepContext/index.esm.js +1 -2
  639. package/dist/node_modules/@mui/material/Step/StepContext/index.esm.js.map +1 -1
  640. package/dist/node_modules/@mui/material/Step/StepContext/index.js +1 -1
  641. package/dist/node_modules/@mui/material/Step/StepContext/index.js.map +1 -1
  642. package/dist/node_modules/@mui/material/StepButton/StepButton/index.esm.js +1 -2
  643. package/dist/node_modules/@mui/material/StepButton/StepButton/index.esm.js.map +1 -1
  644. package/dist/node_modules/@mui/material/StepButton/StepButton/index.js +1 -1
  645. package/dist/node_modules/@mui/material/StepButton/StepButton/index.js.map +1 -1
  646. package/dist/node_modules/@mui/material/StepConnector/StepConnector/index.esm.js +1 -2
  647. package/dist/node_modules/@mui/material/StepConnector/StepConnector/index.esm.js.map +1 -1
  648. package/dist/node_modules/@mui/material/StepConnector/StepConnector/index.js +1 -1
  649. package/dist/node_modules/@mui/material/StepConnector/StepConnector/index.js.map +1 -1
  650. package/dist/node_modules/@mui/material/StepContent/StepContent/index.esm.js +2 -3
  651. package/dist/node_modules/@mui/material/StepContent/StepContent/index.esm.js.map +1 -1
  652. package/dist/node_modules/@mui/material/StepContent/StepContent/index.js +1 -1
  653. package/dist/node_modules/@mui/material/StepContent/StepContent/index.js.map +1 -1
  654. package/dist/node_modules/@mui/material/StepIcon/StepIcon/index.esm.js +1 -2
  655. package/dist/node_modules/@mui/material/StepIcon/StepIcon/index.esm.js.map +1 -1
  656. package/dist/node_modules/@mui/material/StepIcon/StepIcon/index.js +1 -1
  657. package/dist/node_modules/@mui/material/StepIcon/StepIcon/index.js.map +1 -1
  658. package/dist/node_modules/@mui/material/StepLabel/StepLabel/index.esm.js +1 -2
  659. package/dist/node_modules/@mui/material/StepLabel/StepLabel/index.esm.js.map +1 -1
  660. package/dist/node_modules/@mui/material/StepLabel/StepLabel/index.js +2 -2
  661. package/dist/node_modules/@mui/material/StepLabel/StepLabel/index.js.map +1 -1
  662. package/dist/node_modules/@mui/material/Stepper/Stepper/index.esm.js +1 -2
  663. package/dist/node_modules/@mui/material/Stepper/Stepper/index.esm.js.map +1 -1
  664. package/dist/node_modules/@mui/material/Stepper/Stepper/index.js +2 -2
  665. package/dist/node_modules/@mui/material/Stepper/Stepper/index.js.map +1 -1
  666. package/dist/node_modules/@mui/material/Stepper/StepperContext/index.esm.js +1 -2
  667. package/dist/node_modules/@mui/material/Stepper/StepperContext/index.esm.js.map +1 -1
  668. package/dist/node_modules/@mui/material/Stepper/StepperContext/index.js +1 -1
  669. package/dist/node_modules/@mui/material/Stepper/StepperContext/index.js.map +1 -1
  670. package/dist/node_modules/@mui/material/SvgIcon/SvgIcon/index.esm.js +1 -2
  671. package/dist/node_modules/@mui/material/SvgIcon/SvgIcon/index.esm.js.map +1 -1
  672. package/dist/node_modules/@mui/material/SvgIcon/SvgIcon/index.js +2 -2
  673. package/dist/node_modules/@mui/material/SvgIcon/SvgIcon/index.js.map +1 -1
  674. package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeArea/index.esm.js +1 -2
  675. package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeArea/index.esm.js.map +1 -1
  676. package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeArea/index.js +2 -2
  677. package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeArea/index.js.map +1 -1
  678. package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeableDrawer/index.esm.js +1 -2
  679. package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeableDrawer/index.esm.js.map +1 -1
  680. package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeableDrawer/index.js +1 -1
  681. package/dist/node_modules/@mui/material/SwipeableDrawer/SwipeableDrawer/index.js.map +1 -1
  682. package/dist/node_modules/@mui/material/Switch/Switch/index.esm.js +1 -2
  683. package/dist/node_modules/@mui/material/Switch/Switch/index.esm.js.map +1 -1
  684. package/dist/node_modules/@mui/material/Switch/Switch/index.js +2 -2
  685. package/dist/node_modules/@mui/material/Switch/Switch/index.js.map +1 -1
  686. package/dist/node_modules/@mui/material/Tab/Tab/index.esm.js +1 -2
  687. package/dist/node_modules/@mui/material/Tab/Tab/index.esm.js.map +1 -1
  688. package/dist/node_modules/@mui/material/Tab/Tab/index.js +1 -1
  689. package/dist/node_modules/@mui/material/Tab/Tab/index.js.map +1 -1
  690. package/dist/node_modules/@mui/material/TabScrollButton/TabScrollButton/index.esm.js +1 -2
  691. package/dist/node_modules/@mui/material/TabScrollButton/TabScrollButton/index.esm.js.map +1 -1
  692. package/dist/node_modules/@mui/material/TabScrollButton/TabScrollButton/index.js +2 -2
  693. package/dist/node_modules/@mui/material/TabScrollButton/TabScrollButton/index.js.map +1 -1
  694. package/dist/node_modules/@mui/material/Table/Table/index.esm.js +1 -2
  695. package/dist/node_modules/@mui/material/Table/Table/index.esm.js.map +1 -1
  696. package/dist/node_modules/@mui/material/Table/Table/index.js +2 -2
  697. package/dist/node_modules/@mui/material/Table/Table/index.js.map +1 -1
  698. package/dist/node_modules/@mui/material/Table/TableContext/index.esm.js +1 -2
  699. package/dist/node_modules/@mui/material/Table/TableContext/index.esm.js.map +1 -1
  700. package/dist/node_modules/@mui/material/Table/TableContext/index.js +1 -1
  701. package/dist/node_modules/@mui/material/Table/TableContext/index.js.map +1 -1
  702. package/dist/node_modules/@mui/material/Table/Tablelvl2Context/index.esm.js +1 -2
  703. package/dist/node_modules/@mui/material/Table/Tablelvl2Context/index.esm.js.map +1 -1
  704. package/dist/node_modules/@mui/material/Table/Tablelvl2Context/index.js +1 -1
  705. package/dist/node_modules/@mui/material/Table/Tablelvl2Context/index.js.map +1 -1
  706. package/dist/node_modules/@mui/material/TableBody/TableBody/index.esm.js +1 -2
  707. package/dist/node_modules/@mui/material/TableBody/TableBody/index.esm.js.map +1 -1
  708. package/dist/node_modules/@mui/material/TableBody/TableBody/index.js +1 -1
  709. package/dist/node_modules/@mui/material/TableBody/TableBody/index.js.map +1 -1
  710. package/dist/node_modules/@mui/material/TableCell/TableCell/index.esm.js +1 -2
  711. package/dist/node_modules/@mui/material/TableCell/TableCell/index.esm.js.map +1 -1
  712. package/dist/node_modules/@mui/material/TableCell/TableCell/index.js +1 -1
  713. package/dist/node_modules/@mui/material/TableCell/TableCell/index.js.map +1 -1
  714. package/dist/node_modules/@mui/material/TableContainer/TableContainer/index.esm.js +1 -2
  715. package/dist/node_modules/@mui/material/TableContainer/TableContainer/index.esm.js.map +1 -1
  716. package/dist/node_modules/@mui/material/TableContainer/TableContainer/index.js +2 -2
  717. package/dist/node_modules/@mui/material/TableContainer/TableContainer/index.js.map +1 -1
  718. package/dist/node_modules/@mui/material/TableFooter/TableFooter/index.esm.js +1 -2
  719. package/dist/node_modules/@mui/material/TableFooter/TableFooter/index.esm.js.map +1 -1
  720. package/dist/node_modules/@mui/material/TableFooter/TableFooter/index.js +1 -1
  721. package/dist/node_modules/@mui/material/TableFooter/TableFooter/index.js.map +1 -1
  722. package/dist/node_modules/@mui/material/TableHead/TableHead/index.esm.js +1 -2
  723. package/dist/node_modules/@mui/material/TableHead/TableHead/index.esm.js.map +1 -1
  724. package/dist/node_modules/@mui/material/TableHead/TableHead/index.js +1 -1
  725. package/dist/node_modules/@mui/material/TableHead/TableHead/index.js.map +1 -1
  726. package/dist/node_modules/@mui/material/TablePagination/TablePagination/index.esm.js +1 -2
  727. package/dist/node_modules/@mui/material/TablePagination/TablePagination/index.esm.js.map +1 -1
  728. package/dist/node_modules/@mui/material/TablePagination/TablePagination/index.js +2 -2
  729. package/dist/node_modules/@mui/material/TablePagination/TablePagination/index.js.map +1 -1
  730. package/dist/node_modules/@mui/material/TablePagination/TablePaginationActions/index.esm.js +1 -2
  731. package/dist/node_modules/@mui/material/TablePagination/TablePaginationActions/index.esm.js.map +1 -1
  732. package/dist/node_modules/@mui/material/TablePagination/TablePaginationActions/index.js +2 -2
  733. package/dist/node_modules/@mui/material/TablePagination/TablePaginationActions/index.js.map +1 -1
  734. package/dist/node_modules/@mui/material/TableRow/TableRow/index.esm.js +1 -2
  735. package/dist/node_modules/@mui/material/TableRow/TableRow/index.esm.js.map +1 -1
  736. package/dist/node_modules/@mui/material/TableRow/TableRow/index.js +1 -1
  737. package/dist/node_modules/@mui/material/TableRow/TableRow/index.js.map +1 -1
  738. package/dist/node_modules/@mui/material/TableSortLabel/TableSortLabel/index.esm.js +1 -2
  739. package/dist/node_modules/@mui/material/TableSortLabel/TableSortLabel/index.esm.js.map +1 -1
  740. package/dist/node_modules/@mui/material/TableSortLabel/TableSortLabel/index.js +1 -1
  741. package/dist/node_modules/@mui/material/TableSortLabel/TableSortLabel/index.js.map +1 -1
  742. package/dist/node_modules/@mui/material/Tabs/ScrollbarSize/index.esm.js +1 -2
  743. package/dist/node_modules/@mui/material/Tabs/ScrollbarSize/index.esm.js.map +1 -1
  744. package/dist/node_modules/@mui/material/Tabs/ScrollbarSize/index.js +1 -1
  745. package/dist/node_modules/@mui/material/Tabs/ScrollbarSize/index.js.map +1 -1
  746. package/dist/node_modules/@mui/material/Tabs/Tabs/index.esm.js +6 -7
  747. package/dist/node_modules/@mui/material/Tabs/Tabs/index.esm.js.map +1 -1
  748. package/dist/node_modules/@mui/material/Tabs/Tabs/index.js +2 -2
  749. package/dist/node_modules/@mui/material/Tabs/Tabs/index.js.map +1 -1
  750. package/dist/node_modules/@mui/material/TextField/TextField/index.esm.js +2 -3
  751. package/dist/node_modules/@mui/material/TextField/TextField/index.esm.js.map +1 -1
  752. package/dist/node_modules/@mui/material/TextField/TextField/index.js +2 -2
  753. package/dist/node_modules/@mui/material/TextField/TextField/index.js.map +1 -1
  754. package/dist/node_modules/@mui/material/TextareaAutosize/TextareaAutosize/index.esm.js +1 -2
  755. package/dist/node_modules/@mui/material/TextareaAutosize/TextareaAutosize/index.esm.js.map +1 -1
  756. package/dist/node_modules/@mui/material/TextareaAutosize/TextareaAutosize/index.js +1 -1
  757. package/dist/node_modules/@mui/material/TextareaAutosize/TextareaAutosize/index.js.map +1 -1
  758. package/dist/node_modules/@mui/material/ToggleButton/ToggleButton/index.esm.js +1 -2
  759. package/dist/node_modules/@mui/material/ToggleButton/ToggleButton/index.esm.js.map +1 -1
  760. package/dist/node_modules/@mui/material/ToggleButton/ToggleButton/index.js +1 -1
  761. package/dist/node_modules/@mui/material/ToggleButton/ToggleButton/index.js.map +1 -1
  762. package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroup/index.esm.js +2 -3
  763. package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroup/index.esm.js.map +1 -1
  764. package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroup/index.js +2 -2
  765. package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroup/index.js.map +1 -1
  766. package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupButtonContext/index.esm.js +1 -2
  767. package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupButtonContext/index.esm.js.map +1 -1
  768. package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupButtonContext/index.js +1 -1
  769. package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupButtonContext/index.js.map +1 -1
  770. package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupContext/index.esm.js +1 -2
  771. package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupContext/index.esm.js.map +1 -1
  772. package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupContext/index.js +1 -1
  773. package/dist/node_modules/@mui/material/ToggleButtonGroup/ToggleButtonGroupContext/index.js.map +1 -1
  774. package/dist/node_modules/@mui/material/Toolbar/Toolbar/index.esm.js +1 -2
  775. package/dist/node_modules/@mui/material/Toolbar/Toolbar/index.esm.js.map +1 -1
  776. package/dist/node_modules/@mui/material/Toolbar/Toolbar/index.js +2 -2
  777. package/dist/node_modules/@mui/material/Toolbar/Toolbar/index.js.map +1 -1
  778. package/dist/node_modules/@mui/material/Tooltip/Tooltip/index.esm.js +4 -5
  779. package/dist/node_modules/@mui/material/Tooltip/Tooltip/index.esm.js.map +1 -1
  780. package/dist/node_modules/@mui/material/Tooltip/Tooltip/index.js +2 -2
  781. package/dist/node_modules/@mui/material/Tooltip/Tooltip/index.js.map +1 -1
  782. package/dist/node_modules/@mui/material/Typography/Typography/index.esm.js +1 -2
  783. package/dist/node_modules/@mui/material/Typography/Typography/index.esm.js.map +1 -1
  784. package/dist/node_modules/@mui/material/Typography/Typography/index.js +2 -2
  785. package/dist/node_modules/@mui/material/Typography/Typography/index.js.map +1 -1
  786. package/dist/node_modules/@mui/material/Unstable_TrapFocus/FocusTrap/index.esm.js +3 -4
  787. package/dist/node_modules/@mui/material/Unstable_TrapFocus/FocusTrap/index.esm.js.map +1 -1
  788. package/dist/node_modules/@mui/material/Unstable_TrapFocus/FocusTrap/index.js +2 -2
  789. package/dist/node_modules/@mui/material/Unstable_TrapFocus/FocusTrap/index.js.map +1 -1
  790. package/dist/node_modules/@mui/material/Zoom/Zoom/index.esm.js +1 -2
  791. package/dist/node_modules/@mui/material/Zoom/Zoom/index.esm.js.map +1 -1
  792. package/dist/node_modules/@mui/material/Zoom/Zoom/index.js +1 -1
  793. package/dist/node_modules/@mui/material/Zoom/Zoom/index.js.map +1 -1
  794. package/dist/node_modules/@mui/material/internal/SwitchBase/index.esm.js +1 -2
  795. package/dist/node_modules/@mui/material/internal/SwitchBase/index.esm.js.map +1 -1
  796. package/dist/node_modules/@mui/material/internal/SwitchBase/index.js +2 -2
  797. package/dist/node_modules/@mui/material/internal/SwitchBase/index.js.map +1 -1
  798. package/dist/node_modules/@mui/material/styles/ThemeProvider/index.esm.js +1 -2
  799. package/dist/node_modules/@mui/material/styles/ThemeProvider/index.esm.js.map +1 -1
  800. package/dist/node_modules/@mui/material/styles/ThemeProvider/index.js +1 -1
  801. package/dist/node_modules/@mui/material/styles/ThemeProvider/index.js.map +1 -1
  802. package/dist/node_modules/@mui/material/styles/createPalette/index.esm.js +4 -5
  803. package/dist/node_modules/@mui/material/styles/createPalette/index.esm.js.map +1 -1
  804. package/dist/node_modules/@mui/material/styles/createPalette/index.js +1 -1
  805. package/dist/node_modules/@mui/material/styles/createPalette/index.js.map +1 -1
  806. package/dist/node_modules/@mui/material/styles/createTheme/index.esm.js +3 -4
  807. package/dist/node_modules/@mui/material/styles/createTheme/index.esm.js.map +1 -1
  808. package/dist/node_modules/@mui/material/styles/createTheme/index.js +1 -1
  809. package/dist/node_modules/@mui/material/styles/createTheme/index.js.map +1 -1
  810. package/dist/node_modules/@mui/material/styles/createTransitions/index.esm.js +1 -2
  811. package/dist/node_modules/@mui/material/styles/createTransitions/index.esm.js.map +1 -1
  812. package/dist/node_modules/@mui/material/styles/createTransitions/index.js +1 -1
  813. package/dist/node_modules/@mui/material/styles/createTransitions/index.js.map +1 -1
  814. package/dist/node_modules/@mui/material/styles/createTypography/index.esm.js +1 -2
  815. package/dist/node_modules/@mui/material/styles/createTypography/index.esm.js.map +1 -1
  816. package/dist/node_modules/@mui/material/styles/createTypography/index.js +1 -1
  817. package/dist/node_modules/@mui/material/styles/createTypography/index.js.map +1 -1
  818. package/dist/node_modules/@mui/material/styles/useTheme/index.esm.js +1 -2
  819. package/dist/node_modules/@mui/material/styles/useTheme/index.esm.js.map +1 -1
  820. package/dist/node_modules/@mui/material/styles/useTheme/index.js +1 -1
  821. package/dist/node_modules/@mui/material/styles/useTheme/index.js.map +1 -1
  822. package/dist/node_modules/@mui/material/useAutocomplete/useAutocomplete/index.esm.js +5 -6
  823. package/dist/node_modules/@mui/material/useAutocomplete/useAutocomplete/index.esm.js.map +1 -1
  824. package/dist/node_modules/@mui/material/useAutocomplete/useAutocomplete/index.js +1 -1
  825. package/dist/node_modules/@mui/material/useAutocomplete/useAutocomplete/index.js.map +1 -1
  826. package/dist/node_modules/@mui/material/utils/createSvgIcon/index.esm.js +1 -2
  827. package/dist/node_modules/@mui/material/utils/createSvgIcon/index.esm.js.map +1 -1
  828. package/dist/node_modules/@mui/material/utils/createSvgIcon/index.js +2 -2
  829. package/dist/node_modules/@mui/material/utils/createSvgIcon/index.js.map +1 -1
  830. package/dist/node_modules/@mui/material/utils/index/index.esm.js +1 -2
  831. package/dist/node_modules/@mui/material/utils/index/index.esm.js.map +1 -1
  832. package/dist/node_modules/@mui/material/utils/index/index.js +1 -1
  833. package/dist/node_modules/@mui/material/utils/index/index.js.map +1 -1
  834. package/dist/node_modules/@mui/private-theming/ThemeProvider/ThemeProvider/index.esm.js +5 -6
  835. package/dist/node_modules/@mui/private-theming/ThemeProvider/ThemeProvider/index.esm.js.map +1 -1
  836. package/dist/node_modules/@mui/private-theming/ThemeProvider/ThemeProvider/index.js +2 -2
  837. package/dist/node_modules/@mui/private-theming/ThemeProvider/ThemeProvider/index.js.map +1 -1
  838. package/dist/node_modules/@mui/private-theming/useTheme/ThemeContext/index.esm.js +1 -2
  839. package/dist/node_modules/@mui/private-theming/useTheme/ThemeContext/index.esm.js.map +1 -1
  840. package/dist/node_modules/@mui/private-theming/useTheme/ThemeContext/index.js +1 -1
  841. package/dist/node_modules/@mui/private-theming/useTheme/ThemeContext/index.js.map +1 -1
  842. package/dist/node_modules/@mui/private-theming/useTheme/useTheme/index.esm.js +1 -2
  843. package/dist/node_modules/@mui/private-theming/useTheme/useTheme/index.esm.js.map +1 -1
  844. package/dist/node_modules/@mui/private-theming/useTheme/useTheme/index.js +1 -1
  845. package/dist/node_modules/@mui/private-theming/useTheme/useTheme/index.js.map +1 -1
  846. package/dist/node_modules/@mui/styled-engine/GlobalStyles/GlobalStyles/index.esm.js +1 -2
  847. package/dist/node_modules/@mui/styled-engine/GlobalStyles/GlobalStyles/index.esm.js.map +1 -1
  848. package/dist/node_modules/@mui/styled-engine/GlobalStyles/GlobalStyles/index.js +1 -1
  849. package/dist/node_modules/@mui/styled-engine/GlobalStyles/GlobalStyles/index.js.map +1 -1
  850. package/dist/node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider/index.esm.js +1 -2
  851. package/dist/node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider/index.esm.js.map +1 -1
  852. package/dist/node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider/index.js +1 -1
  853. package/dist/node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider/index.js.map +1 -1
  854. package/dist/node_modules/@mui/styled-engine/index/index.esm.js +8 -2
  855. package/dist/node_modules/@mui/styled-engine/index/index.esm.js.map +1 -1
  856. package/dist/node_modules/@mui/styled-engine/index/index.js +1 -1
  857. package/dist/node_modules/@mui/styled-engine/index/index.js.map +1 -1
  858. package/dist/node_modules/@mui/system/colorManipulator/index.esm.js +10 -11
  859. package/dist/node_modules/@mui/system/colorManipulator/index.esm.js.map +1 -1
  860. package/dist/node_modules/@mui/system/colorManipulator/index.js +1 -1
  861. package/dist/node_modules/@mui/system/colorManipulator/index.js.map +1 -1
  862. package/dist/node_modules/@mui/system/createStyled/index.esm.js +8 -9
  863. package/dist/node_modules/@mui/system/createStyled/index.esm.js.map +1 -1
  864. package/dist/node_modules/@mui/system/createStyled/index.js +1 -1
  865. package/dist/node_modules/@mui/system/createStyled/index.js.map +1 -1
  866. package/dist/node_modules/@mui/system/esm/Container/createContainer/index.esm.js +1 -2
  867. package/dist/node_modules/@mui/system/esm/Container/createContainer/index.esm.js.map +1 -1
  868. package/dist/node_modules/@mui/system/esm/Container/createContainer/index.js +2 -2
  869. package/dist/node_modules/@mui/system/esm/Container/createContainer/index.js.map +1 -1
  870. package/dist/node_modules/@mui/system/esm/DefaultPropsProvider/DefaultPropsProvider/index.esm.js +1 -2
  871. package/dist/node_modules/@mui/system/esm/DefaultPropsProvider/DefaultPropsProvider/index.esm.js.map +1 -1
  872. package/dist/node_modules/@mui/system/esm/DefaultPropsProvider/DefaultPropsProvider/index.js +2 -2
  873. package/dist/node_modules/@mui/system/esm/DefaultPropsProvider/DefaultPropsProvider/index.js.map +1 -1
  874. package/dist/node_modules/@mui/system/esm/GlobalStyles/GlobalStyles/index.esm.js +1 -2
  875. package/dist/node_modules/@mui/system/esm/GlobalStyles/GlobalStyles/index.esm.js.map +1 -1
  876. package/dist/node_modules/@mui/system/esm/GlobalStyles/GlobalStyles/index.js +1 -1
  877. package/dist/node_modules/@mui/system/esm/GlobalStyles/GlobalStyles/index.js.map +1 -1
  878. package/dist/node_modules/@mui/system/esm/RtlProvider/index/index.esm.js +1 -2
  879. package/dist/node_modules/@mui/system/esm/RtlProvider/index/index.esm.js.map +1 -1
  880. package/dist/node_modules/@mui/system/esm/RtlProvider/index/index.js +1 -1
  881. package/dist/node_modules/@mui/system/esm/RtlProvider/index/index.js.map +1 -1
  882. package/dist/node_modules/@mui/system/esm/Stack/createStack/index.esm.js +1 -2
  883. package/dist/node_modules/@mui/system/esm/Stack/createStack/index.esm.js.map +1 -1
  884. package/dist/node_modules/@mui/system/esm/Stack/createStack/index.js +2 -2
  885. package/dist/node_modules/@mui/system/esm/Stack/createStack/index.js.map +1 -1
  886. package/dist/node_modules/@mui/system/esm/ThemeProvider/ThemeProvider/index.esm.js +4 -5
  887. package/dist/node_modules/@mui/system/esm/ThemeProvider/ThemeProvider/index.esm.js.map +1 -1
  888. package/dist/node_modules/@mui/system/esm/ThemeProvider/ThemeProvider/index.js +2 -2
  889. package/dist/node_modules/@mui/system/esm/ThemeProvider/ThemeProvider/index.js.map +1 -1
  890. package/dist/node_modules/@mui/system/esm/borders/index.esm.js +1 -2
  891. package/dist/node_modules/@mui/system/esm/borders/index.esm.js.map +1 -1
  892. package/dist/node_modules/@mui/system/esm/borders/index.js +1 -1
  893. package/dist/node_modules/@mui/system/esm/borders/index.js.map +1 -1
  894. package/dist/node_modules/@mui/system/esm/breakpoints/index.esm.js.map +1 -1
  895. package/dist/node_modules/@mui/system/esm/breakpoints/index.js.map +1 -1
  896. package/dist/node_modules/@mui/system/esm/colorManipulator/index.esm.js +3 -4
  897. package/dist/node_modules/@mui/system/esm/colorManipulator/index.esm.js.map +1 -1
  898. package/dist/node_modules/@mui/system/esm/colorManipulator/index.js +1 -1
  899. package/dist/node_modules/@mui/system/esm/colorManipulator/index.js.map +1 -1
  900. package/dist/node_modules/@mui/system/esm/compose/index.esm.js +1 -2
  901. package/dist/node_modules/@mui/system/esm/compose/index.esm.js.map +1 -1
  902. package/dist/node_modules/@mui/system/esm/compose/index.js +1 -1
  903. package/dist/node_modules/@mui/system/esm/compose/index.js.map +1 -1
  904. package/dist/node_modules/@mui/system/esm/createStyled/index.esm.js +2 -3
  905. package/dist/node_modules/@mui/system/esm/createStyled/index.esm.js.map +1 -1
  906. package/dist/node_modules/@mui/system/esm/createStyled/index.js +1 -1
  907. package/dist/node_modules/@mui/system/esm/createStyled/index.js.map +1 -1
  908. package/dist/node_modules/@mui/system/esm/createTheme/createSpacing/index.esm.js +1 -2
  909. package/dist/node_modules/@mui/system/esm/createTheme/createSpacing/index.esm.js.map +1 -1
  910. package/dist/node_modules/@mui/system/esm/createTheme/createSpacing/index.js +1 -1
  911. package/dist/node_modules/@mui/system/esm/createTheme/createSpacing/index.js.map +1 -1
  912. package/dist/node_modules/@mui/system/esm/cssGrid/index.esm.js +3 -4
  913. package/dist/node_modules/@mui/system/esm/cssGrid/index.esm.js.map +1 -1
  914. package/dist/node_modules/@mui/system/esm/cssGrid/index.js +1 -1
  915. package/dist/node_modules/@mui/system/esm/cssGrid/index.js.map +1 -1
  916. package/dist/node_modules/@mui/system/esm/responsivePropType/index.esm.js +1 -2
  917. package/dist/node_modules/@mui/system/esm/responsivePropType/index.esm.js.map +1 -1
  918. package/dist/node_modules/@mui/system/esm/responsivePropType/index.js +1 -1
  919. package/dist/node_modules/@mui/system/esm/responsivePropType/index.js.map +1 -1
  920. package/dist/node_modules/@mui/system/esm/spacing/index.esm.js +6 -7
  921. package/dist/node_modules/@mui/system/esm/spacing/index.esm.js.map +1 -1
  922. package/dist/node_modules/@mui/system/esm/spacing/index.js +1 -1
  923. package/dist/node_modules/@mui/system/esm/spacing/index.js.map +1 -1
  924. package/dist/node_modules/@mui/system/esm/style/index.esm.js +1 -2
  925. package/dist/node_modules/@mui/system/esm/style/index.esm.js.map +1 -1
  926. package/dist/node_modules/@mui/system/esm/style/index.js +1 -1
  927. package/dist/node_modules/@mui/system/esm/style/index.js.map +1 -1
  928. package/dist/node_modules/@mui/system/esm/useMediaQuery/useMediaQuery/index.esm.js +2 -3
  929. package/dist/node_modules/@mui/system/esm/useMediaQuery/useMediaQuery/index.esm.js.map +1 -1
  930. package/dist/node_modules/@mui/system/esm/useMediaQuery/useMediaQuery/index.js +1 -1
  931. package/dist/node_modules/@mui/system/esm/useMediaQuery/useMediaQuery/index.js.map +1 -1
  932. package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.esm.js +1 -1
  933. package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.js +1 -1
  934. package/dist/node_modules/@mui/utils/esm/HTMLElementType/HTMLElementType/index.esm.js +1 -2
  935. package/dist/node_modules/@mui/utils/esm/HTMLElementType/HTMLElementType/index.esm.js.map +1 -1
  936. package/dist/node_modules/@mui/utils/esm/HTMLElementType/HTMLElementType/index.js +1 -1
  937. package/dist/node_modules/@mui/utils/esm/HTMLElementType/HTMLElementType/index.js.map +1 -1
  938. package/dist/node_modules/@mui/utils/esm/capitalize/capitalize/index.esm.js +1 -2
  939. package/dist/node_modules/@mui/utils/esm/capitalize/capitalize/index.esm.js.map +1 -1
  940. package/dist/node_modules/@mui/utils/esm/capitalize/capitalize/index.js +1 -1
  941. package/dist/node_modules/@mui/utils/esm/capitalize/capitalize/index.js.map +1 -1
  942. package/dist/node_modules/@mui/utils/esm/chainPropTypes/chainPropTypes/index.esm.js +1 -2
  943. package/dist/node_modules/@mui/utils/esm/chainPropTypes/chainPropTypes/index.esm.js.map +1 -1
  944. package/dist/node_modules/@mui/utils/esm/chainPropTypes/chainPropTypes/index.js +1 -1
  945. package/dist/node_modules/@mui/utils/esm/chainPropTypes/chainPropTypes/index.js.map +1 -1
  946. package/dist/node_modules/@mui/utils/esm/deprecatedPropType/deprecatedPropType/index.esm.js +1 -2
  947. package/dist/node_modules/@mui/utils/esm/deprecatedPropType/deprecatedPropType/index.esm.js.map +1 -1
  948. package/dist/node_modules/@mui/utils/esm/deprecatedPropType/deprecatedPropType/index.js +1 -1
  949. package/dist/node_modules/@mui/utils/esm/deprecatedPropType/deprecatedPropType/index.js.map +1 -1
  950. package/dist/node_modules/@mui/utils/esm/exactProp/exactProp/index.esm.js +1 -2
  951. package/dist/node_modules/@mui/utils/esm/exactProp/exactProp/index.esm.js.map +1 -1
  952. package/dist/node_modules/@mui/utils/esm/exactProp/exactProp/index.js +1 -1
  953. package/dist/node_modules/@mui/utils/esm/exactProp/exactProp/index.js.map +1 -1
  954. package/dist/node_modules/@mui/utils/esm/integerPropType/integerPropType/index.esm.js +1 -2
  955. package/dist/node_modules/@mui/utils/esm/integerPropType/integerPropType/index.esm.js.map +1 -1
  956. package/dist/node_modules/@mui/utils/esm/integerPropType/integerPropType/index.js +1 -1
  957. package/dist/node_modules/@mui/utils/esm/integerPropType/integerPropType/index.js.map +1 -1
  958. package/dist/node_modules/@mui/utils/esm/requirePropFactory/requirePropFactory/index.esm.js +1 -2
  959. package/dist/node_modules/@mui/utils/esm/requirePropFactory/requirePropFactory/index.esm.js.map +1 -1
  960. package/dist/node_modules/@mui/utils/esm/requirePropFactory/requirePropFactory/index.js +1 -1
  961. package/dist/node_modules/@mui/utils/esm/requirePropFactory/requirePropFactory/index.js.map +1 -1
  962. package/dist/node_modules/@mui/utils/esm/unsupportedProp/unsupportedProp/index.esm.js +1 -2
  963. package/dist/node_modules/@mui/utils/esm/unsupportedProp/unsupportedProp/index.esm.js.map +1 -1
  964. package/dist/node_modules/@mui/utils/esm/unsupportedProp/unsupportedProp/index.js +1 -1
  965. package/dist/node_modules/@mui/utils/esm/unsupportedProp/unsupportedProp/index.js.map +1 -1
  966. package/dist/node_modules/@mui/utils/esm/useControlled/useControlled/index.esm.js +1 -2
  967. package/dist/node_modules/@mui/utils/esm/useControlled/useControlled/index.esm.js.map +1 -1
  968. package/dist/node_modules/@mui/utils/esm/useControlled/useControlled/index.js +1 -1
  969. package/dist/node_modules/@mui/utils/esm/useControlled/useControlled/index.js.map +1 -1
  970. package/dist/node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar/index.esm.js +1 -2
  971. package/dist/node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar/index.esm.js.map +1 -1
  972. package/dist/node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar/index.js +1 -1
  973. package/dist/node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar/index.js.map +1 -1
  974. package/dist/node_modules/@mui/x-date-pickers/DateField/DateField/index.esm.js +1 -2
  975. package/dist/node_modules/@mui/x-date-pickers/DateField/DateField/index.esm.js.map +1 -1
  976. package/dist/node_modules/@mui/x-date-pickers/DateField/DateField/index.js +2 -2
  977. package/dist/node_modules/@mui/x-date-pickers/DateField/DateField/index.js.map +1 -1
  978. package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePicker/index.esm.js +1 -2
  979. package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePicker/index.esm.js.map +1 -1
  980. package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePicker/index.js +1 -1
  981. package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePicker/index.js.map +1 -1
  982. package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePickerToolbar/index.esm.js +1 -2
  983. package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePickerToolbar/index.esm.js.map +1 -1
  984. package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePickerToolbar/index.js +1 -1
  985. package/dist/node_modules/@mui/x-date-pickers/DatePicker/DatePickerToolbar/index.js.map +1 -1
  986. package/dist/node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField/index.esm.js +1 -2
  987. package/dist/node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField/index.esm.js.map +1 -1
  988. package/dist/node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField/index.js +2 -2
  989. package/dist/node_modules/@mui/x-date-pickers/DateTimeField/DateTimeField/index.js.map +1 -1
  990. package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker/index.esm.js +1 -2
  991. package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker/index.esm.js.map +1 -1
  992. package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker/index.js +1 -1
  993. package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePicker/index.js.map +1 -1
  994. package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerTabs/index.esm.js +1 -2
  995. package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerTabs/index.esm.js.map +1 -1
  996. package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerTabs/index.js +1 -1
  997. package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerTabs/index.js.map +1 -1
  998. package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerToolbar/index.esm.js +1 -2
  999. package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerToolbar/index.esm.js.map +1 -1
  1000. package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerToolbar/index.js +1 -1
  1001. package/dist/node_modules/@mui/x-date-pickers/DateTimePicker/DateTimePickerToolbar/index.js.map +1 -1
  1002. package/dist/node_modules/@mui/x-date-pickers/DigitalClock/DigitalClock/index.esm.js +1 -2
  1003. package/dist/node_modules/@mui/x-date-pickers/DigitalClock/DigitalClock/index.esm.js.map +1 -1
  1004. package/dist/node_modules/@mui/x-date-pickers/DigitalClock/DigitalClock/index.js +1 -1
  1005. package/dist/node_modules/@mui/x-date-pickers/DigitalClock/DigitalClock/index.js.map +1 -1
  1006. package/dist/node_modules/@mui/x-date-pickers/LocalizationProvider/LocalizationProvider/index.esm.js +2 -3
  1007. package/dist/node_modules/@mui/x-date-pickers/LocalizationProvider/LocalizationProvider/index.esm.js.map +1 -1
  1008. package/dist/node_modules/@mui/x-date-pickers/LocalizationProvider/LocalizationProvider/index.js +2 -2
  1009. package/dist/node_modules/@mui/x-date-pickers/LocalizationProvider/LocalizationProvider/index.js.map +1 -1
  1010. package/dist/node_modules/@mui/x-date-pickers/MonthCalendar/MonthCalendar/index.esm.js +1 -2
  1011. package/dist/node_modules/@mui/x-date-pickers/MonthCalendar/MonthCalendar/index.esm.js.map +1 -1
  1012. package/dist/node_modules/@mui/x-date-pickers/MonthCalendar/MonthCalendar/index.js +1 -1
  1013. package/dist/node_modules/@mui/x-date-pickers/MonthCalendar/MonthCalendar/index.js.map +1 -1
  1014. package/dist/node_modules/@mui/x-date-pickers/MultiSectionDigitalClock/MultiSectionDigitalClock/index.esm.js +1 -2
  1015. package/dist/node_modules/@mui/x-date-pickers/MultiSectionDigitalClock/MultiSectionDigitalClock/index.esm.js.map +1 -1
  1016. package/dist/node_modules/@mui/x-date-pickers/MultiSectionDigitalClock/MultiSectionDigitalClock/index.js +1 -1
  1017. package/dist/node_modules/@mui/x-date-pickers/MultiSectionDigitalClock/MultiSectionDigitalClock/index.js.map +1 -1
  1018. package/dist/node_modules/@mui/x-date-pickers/PickersActionBar/PickersActionBar/index.esm.js +1 -2
  1019. package/dist/node_modules/@mui/x-date-pickers/PickersActionBar/PickersActionBar/index.esm.js.map +1 -1
  1020. package/dist/node_modules/@mui/x-date-pickers/PickersActionBar/PickersActionBar/index.js +4 -4
  1021. package/dist/node_modules/@mui/x-date-pickers/PickersActionBar/PickersActionBar/index.js.map +1 -1
  1022. package/dist/node_modules/@mui/x-date-pickers/PickersCalendarHeader/PickersCalendarHeader/index.esm.js +1 -2
  1023. package/dist/node_modules/@mui/x-date-pickers/PickersCalendarHeader/PickersCalendarHeader/index.esm.js.map +1 -1
  1024. package/dist/node_modules/@mui/x-date-pickers/PickersCalendarHeader/PickersCalendarHeader/index.js +1 -1
  1025. package/dist/node_modules/@mui/x-date-pickers/PickersCalendarHeader/PickersCalendarHeader/index.js.map +1 -1
  1026. package/dist/node_modules/@mui/x-date-pickers/PickersDay/PickersDay/index.esm.js +4 -5
  1027. package/dist/node_modules/@mui/x-date-pickers/PickersDay/PickersDay/index.esm.js.map +1 -1
  1028. package/dist/node_modules/@mui/x-date-pickers/PickersDay/PickersDay/index.js +1 -1
  1029. package/dist/node_modules/@mui/x-date-pickers/PickersDay/PickersDay/index.js.map +1 -1
  1030. package/dist/node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout/index.esm.js +1 -2
  1031. package/dist/node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout/index.esm.js.map +1 -1
  1032. package/dist/node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout/index.js +1 -1
  1033. package/dist/node_modules/@mui/x-date-pickers/PickersLayout/PickersLayout/index.js.map +1 -1
  1034. package/dist/node_modules/@mui/x-date-pickers/PickersShortcuts/PickersShortcuts/index.esm.js +1 -2
  1035. package/dist/node_modules/@mui/x-date-pickers/PickersShortcuts/PickersShortcuts/index.esm.js.map +1 -1
  1036. package/dist/node_modules/@mui/x-date-pickers/PickersShortcuts/PickersShortcuts/index.js +2 -2
  1037. package/dist/node_modules/@mui/x-date-pickers/PickersShortcuts/PickersShortcuts/index.js.map +1 -1
  1038. package/dist/node_modules/@mui/x-date-pickers/TimeClock/TimeClock/index.esm.js +1 -2
  1039. package/dist/node_modules/@mui/x-date-pickers/TimeClock/TimeClock/index.esm.js.map +1 -1
  1040. package/dist/node_modules/@mui/x-date-pickers/TimeClock/TimeClock/index.js +2 -2
  1041. package/dist/node_modules/@mui/x-date-pickers/TimeClock/TimeClock/index.js.map +1 -1
  1042. package/dist/node_modules/@mui/x-date-pickers/TimeField/TimeField/index.esm.js +1 -2
  1043. package/dist/node_modules/@mui/x-date-pickers/TimeField/TimeField/index.esm.js.map +1 -1
  1044. package/dist/node_modules/@mui/x-date-pickers/TimeField/TimeField/index.js +1 -1
  1045. package/dist/node_modules/@mui/x-date-pickers/TimeField/TimeField/index.js.map +1 -1
  1046. package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePicker/index.esm.js +1 -2
  1047. package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePicker/index.esm.js.map +1 -1
  1048. package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePicker/index.js +1 -1
  1049. package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePicker/index.js.map +1 -1
  1050. package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePickerToolbar/index.esm.js +1 -2
  1051. package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePickerToolbar/index.esm.js.map +1 -1
  1052. package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePickerToolbar/index.js +2 -2
  1053. package/dist/node_modules/@mui/x-date-pickers/TimePicker/TimePickerToolbar/index.js.map +1 -1
  1054. package/dist/node_modules/@mui/x-date-pickers/YearCalendar/YearCalendar/index.esm.js +1 -2
  1055. package/dist/node_modules/@mui/x-date-pickers/YearCalendar/YearCalendar/index.esm.js.map +1 -1
  1056. package/dist/node_modules/@mui/x-date-pickers/YearCalendar/YearCalendar/index.js +2 -2
  1057. package/dist/node_modules/@mui/x-date-pickers/YearCalendar/YearCalendar/index.js.map +1 -1
  1058. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useField/useField.utils/index.esm.js +3 -4
  1059. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useField/useField.utils/index.esm.js.map +1 -1
  1060. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useField/useField.utils/index.js +1 -1
  1061. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useField/useField.utils/index.js.map +1 -1
  1062. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePicker/index.esm.js +1 -2
  1063. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePicker/index.esm.js.map +1 -1
  1064. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePicker/index.js +1 -1
  1065. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePicker/index.js.map +1 -1
  1066. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePickerValue/index.esm.js +1 -2
  1067. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePickerValue/index.esm.js.map +1 -1
  1068. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePickerValue/index.js +1 -1
  1069. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/usePicker/usePickerValue/index.js.map +1 -1
  1070. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useViews/index.esm.js +1 -2
  1071. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useViews/index.esm.js.map +1 -1
  1072. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useViews/index.js +1 -1
  1073. package/dist/node_modules/@mui/x-date-pickers/internals/hooks/useViews/index.js.map +1 -1
  1074. package/dist/node_modules/@mui/x-date-pickers/internals/utils/warning/index.esm.js.map +1 -1
  1075. package/dist/node_modules/@react-querybuilder/material/dist/react-querybuilder_material/index.esm.js.map +1 -1
  1076. package/dist/node_modules/@react-querybuilder/material/dist/react-querybuilder_material/index.js.map +1 -1
  1077. package/dist/node_modules/@tanstack/table-core/build/lib/index/index.esm.js +20 -11
  1078. package/dist/node_modules/@tanstack/table-core/build/lib/index/index.esm.js.map +1 -1
  1079. package/dist/node_modules/@tanstack/table-core/build/lib/index/index.js +1 -1
  1080. package/dist/node_modules/@tanstack/table-core/build/lib/index/index.js.map +1 -1
  1081. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index/index.esm.js +6 -7
  1082. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index/index.esm.js.map +1 -1
  1083. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index/index.js +1 -1
  1084. package/dist/node_modules/@tanstack/virtual-core/dist/esm/index/index.js.map +1 -1
  1085. package/dist/node_modules/notistack/notistack.esm/index.esm.js +2 -3
  1086. package/dist/node_modules/notistack/notistack.esm/index.esm.js.map +1 -1
  1087. package/dist/node_modules/notistack/notistack.esm/index.js +1 -1
  1088. package/dist/node_modules/notistack/notistack.esm/index.js.map +1 -1
  1089. package/dist/node_modules/prop-types/checkPropTypes/index.esm.js +3 -4
  1090. package/dist/node_modules/prop-types/checkPropTypes/index.esm.js.map +1 -1
  1091. package/dist/node_modules/prop-types/checkPropTypes/index.js +1 -1
  1092. package/dist/node_modules/prop-types/checkPropTypes/index.js.map +1 -1
  1093. package/dist/node_modules/prop-types/factoryWithTypeCheckers/index.esm.js +5 -6
  1094. package/dist/node_modules/prop-types/factoryWithTypeCheckers/index.esm.js.map +1 -1
  1095. package/dist/node_modules/prop-types/factoryWithTypeCheckers/index.js +1 -1
  1096. package/dist/node_modules/prop-types/factoryWithTypeCheckers/index.js.map +1 -1
  1097. package/dist/node_modules/prop-types/index/index.esm.js +1 -2
  1098. package/dist/node_modules/prop-types/index/index.esm.js.map +1 -1
  1099. package/dist/node_modules/prop-types/index/index.js +1 -1
  1100. package/dist/node_modules/prop-types/index/index.js.map +1 -1
  1101. package/dist/src/api-client/api.inventory/api.d.ts +10 -14
  1102. package/dist/src/components/form-control/form-builder/form-builder-element/dynamic-select.d.ts +1 -0
  1103. package/dist/src/components/providers/ERPUIProvider.d.ts +2 -0
  1104. package/dist/src/utils/api-config.d.ts +24 -0
  1105. package/dist/src/utils/api.d.ts +9 -18
  1106. package/dist/src/utils/index.d.ts +1 -0
  1107. package/dist/style.css +71 -71
  1108. package/dist/utils/api/index.esm.js +41 -41
  1109. package/dist/utils/api/index.esm.js.map +1 -1
  1110. package/dist/utils/api/index.js +1 -1
  1111. package/dist/utils/api/index.js.map +1 -1
  1112. package/dist/utils/api-config/index.esm.js +56 -0
  1113. package/dist/utils/api-config/index.esm.js.map +1 -0
  1114. package/dist/utils/api-config/index.js +2 -0
  1115. package/dist/utils/api-config/index.js.map +1 -0
  1116. package/dist/utils/api-config.d.ts +24 -0
  1117. package/dist/utils/api.d.ts +9 -18
  1118. package/dist/utils/common/index.esm.js +12 -8
  1119. package/dist/utils/common/index.esm.js.map +1 -1
  1120. package/dist/utils/common/index.js +1 -1
  1121. package/dist/utils/common/index.js.map +1 -1
  1122. package/dist/utils/common-utility/index.esm.js +7 -13
  1123. package/dist/utils/common-utility/index.esm.js.map +1 -1
  1124. package/dist/utils/common-utility/index.js +5 -5
  1125. package/dist/utils/common-utility/index.js.map +1 -1
  1126. package/dist/utils/index.esm.js +9 -1
  1127. package/dist/utils/index.esm.js.map +1 -1
  1128. package/dist/utils/index.js +1 -1
  1129. package/dist/views/form-builder/redux/actionCreator/index.esm.js +1 -2
  1130. package/dist/views/form-builder/redux/actionCreator/index.esm.js.map +1 -1
  1131. package/dist/views/form-builder/redux/actionCreator/index.js +1 -1
  1132. package/dist/views/form-builder/redux/actionCreator/index.js.map +1 -1
  1133. package/dist/views/template-editor/components/EditorSidebar/index.esm.js +4 -3
  1134. package/dist/views/template-editor/components/EditorSidebar/index.esm.js.map +1 -1
  1135. package/dist/views/template-editor/components/EditorSidebar/index.js +14 -14
  1136. package/dist/views/template-editor/components/EditorSidebar/index.js.map +1 -1
  1137. package/dist/views/template-editor/templates/index.esm.js +0 -2
  1138. package/dist/views/template-editor/templates/index.esm.js.map +1 -1
  1139. package/dist/views/template-editor/templates/index.js +5 -5
  1140. package/dist/views/template-editor/templates/index.js.map +1 -1
  1141. 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, setBaseUrl } from "../../api-client/api.rbac/api/index.esm.js";
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 socket = io("https://apidev.erpforce.co", {
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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,OAAO,EAAE,WAAW,MAAM;AACtD,iBAAS,SAAS,KAAK;AAAA,MACxB;AAAA,IACD;AAAA,EACD;AAGA,QAAM,SAAS;AAAA,IACd;AAAA,IACA;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
+ {"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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AoC,EAAE,GAAG,QAAQ,GAAG,SAAA,GAAY;AACtE,eAAS,iCAAiC,IAAI;AAAA,IAC/C,SAAS,OAAO;AACf,UAAI,UAAkB;AACtB,UAAI,iBAAiB,OAAO;AAC3B,kBAAU,YAAY,MAAM,OAAO,EAAE,WAAW,MAAM;AACtD,iBAAS,SAAS,KAAK;AAAA,MACxB;AAAA,IACD;AAAA,EACD;AAGA,QAAM,SAAS;AAAA,IACd;AAAA,IACA;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"),c=require("socket.io-client"),u=require("../../utils/route-utils/index.js"),h=require("../../constants/pathnames/pathname.accounting/index.js"),m=require("../../constants/pathnames/pathname.inventory/index.js"),g=require("../../constants/pathnames/pathname.manufacturing/index.js"),l=require("../../constants/pathnames/pathname.procurement/index.js"),d=require("../../constants/pathnames/pathname.crm/index.js"),P=require("../../constants/pathnames/pathname.rental/index.js"),E=require("../../components/custom-snackbar/custom-snackbar/index.js");const S={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()},R=t.createContext(S);a.setBaseUrl("https://apidev.erpforce.co/rbac"),exports.AuthContext=R,exports.AuthProvider=({children:I})=>{const[_,w]=t.useState(S.user),[W,p]=t.useState(""),[A,f]=t.useState(S.loading),v=t.useRef(null),T=r.useNavigate(),N=e=>{if(!e)return!1;try{return JSON.parse(e)}catch(t){return!1}};t.useEffect(()=>{f(!0);const e=window.localStorage.getItem(n.auth.storageTokenKeyName),t=N(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||""),f(!1)):(a.includes(r)||T(o.Pathname.LOGIN),f(!1))},[]),t.useEffect(()=>{var t;if(!W)return void(v.current&&(null==(t=v.current)||t.disconnect(),v.current=null));const a=c.io("https://apidev.erpforce.co",{transports:["websocket"],auth:{token:W},path:"/socket.io/"});return v.current=a,a.on("connect",()=>{a.onAny((e,...t)=>{})}),a.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":()=>u.generateRouteWithId(h.PathnameGenerator(h.PathnameAccounting.VIEW_SALES_INVOICES),n.toString()),"asset transfers":()=>u.generateRouteWithId(h.PathnameGenerator(h.PathnameAccounting.VIEW_ASSET_TRANSFER),n.toString()),budgets:()=>u.generateRouteWithId(h.PathnameGenerator(h.PathnameAccounting.VIEW_BUDGET),n.toString()),"cash expense":()=>u.generateRouteWithId(h.PathnameGenerator(h.PathnameAccounting.VIEW_CASH_EXPENSE),n.toString()),"credit notes":()=>u.generateRouteWithId(h.PathnameGenerator(h.PathnameAccounting.VIEW_CREDIT_NOTE),n.toString()),"debit notes":()=>u.generateRouteWithId(h.PathnameGenerator(h.PathnameAccounting.VIEW_DEBIT_NOTE),n.toString()),"expense reimbursement":()=>u.generateRouteWithId(h.PathnameGenerator(h.PathnameAccounting.VIEW_EXPENSE_REIMBURSEMENT),n.toString()),"journal entries":()=>u.generateRouteWithId(h.PathnameGenerator(h.PathnameAccounting.VIEW_JOURNAL_ENTRY),n.toString()),"payment entries":()=>u.generateRouteWithId(h.PathnameGenerator(h.PathnameAccounting.VIEW_PAYMENT_ENTRY),n.toString()),"purchase invoice":()=>u.generateRouteWithId(h.PathnameGenerator(h.PathnameAccounting.VIEW_PURCHASE_INVOICE),n.toString()),"stock transfer":()=>u.generateRouteWithId(m.PathnameGenerator(m.PathnameInventory.VIEW_STOCK_TRANSFER),n.toString()),"bills of materials":()=>u.generateRouteWithId(g.PathnameGenerator(g.PathnameManufacturing.VIEW_BILL_OF_MATERIAL),n.toString()),"purchase agreement":()=>u.generateRouteWithId(l.PathnameGenerator(l.PathnamePurchase.VIEW_PURCHASE_AGREEMENT),n.toString()),"purchase orders":()=>{var e;return u.generateRouteWithId(1==(null==(e=null==r?void 0:r.data)?void 0:e.is_rental)?P.ROUTES.VIEW:l.PathnameGenerator(l.PathnamePurchase.VIEW_PURCHASE_ORDER),n.toString())},"purchase request":()=>u.generateRouteWithId(l.PathnameGenerator(l.PathnamePurchase.VIEW_PURCHASE_ORDER),n.toString()),vra:()=>u.generateRouteWithId(l.PathnameGenerator(l.PathnamePurchase.VIEW_VENDOR_RETURNS),n.toString()),"sl customer returns":()=>u.generateRouteWithId(d.PathnameGenerator(d.PathnameCrm.VIEW_CUSTOMER_RETURNS),n.toString()),"sales order":()=>u.generateRouteWithId(d.PathnameGenerator(d.PathnameCrm.VIEW_SALES_ORDER),n.toString()),"rental order":()=>u.generateRouteWithId(P.PathnameGenerator(P.PathnameRental.VIEW_RENTAL_ORDER),n.toString()),"replacement order":()=>u.generateRouteWithId(P.PathnameGenerator(P.PathnameRental.VIEW_RENTAL_ORDER),n.toString()),"rental agreement":()=>u.generateRouteWithId(P.PathnameGenerator(P.PathnameRental.VIEW_AGREEMENT),n.toString()),"cross hire order":()=>u.generateRouteWithId(P.PathnameGenerator(P.PathnameRental.VIEW_CROSS_HIRE_ORDER),n.toString()),"cross hire request":()=>u.generateRouteWithId(P.PathnameGenerator(P.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(E.CustomSnackbar,{snackbarKey:t,message:r,data:n,variant:"default",linkUrl:o})})}),a.on("sales_invoice_viewed",e=>{}),a.on("error",e=>{i.enqueueSnackbar(`Socket error: ${e}`,{variant:"error"})}),()=>{v.current&&(v.current.disconnect(),v.current=null)}},[W]);const y={user:_,authToken:W,loading:A,setUser:w,setLoading:f,login:async(e,t)=>{var r;if(f(!0),window.localStorage.getItem(n.auth.storageTokenKeyName)&&_)return T(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),T(o.Pathname.DASHBOARD),f(!1),delete e.token}}}catch(i){let e="Something went wrong";i instanceof Error&&(e=N(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(""),T(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=N(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=N(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=N(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=N(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=N(n.message).message||n.message,t(e,!1))}}};/* @__PURE__ */
2
- return e.jsx(R.Provider,{value:y,children:I})};
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,QAAQC,UACtBE,eAAgB,IAAMH,QAAQC,UAC9BG,cAAe,IAAMJ,QAAQC,UAC7BI,eAAgB,IAAML,QAAQC,UAC9B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AClBjC,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,mBAAoB,IAAMN,QAAQC,WAG7BM,EAAcC,EAAAA,cAAchB,8CAQgB,EAAGiB,eAEpD,MAAOhB,EAAMG,GAAWc,EAAA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;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(`${"https://apidev.erpforce.co"}/rbac`);
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,wB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B,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,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;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,IACF,SAAS,OAAO;AACd,YAAM,eAAe,iBAAiB,QAAQ,MAAM,UAAU;AAC9D,eAAS,EAAE,MAAM,yBAAyB,SAAS,cAAc;AAGjE,YAAM,kBAAkB,sBAAA;AAGxB,YAAM,oBAAoB,CAAC,eAAe;AAE1C,eAAS,EAAE,MAAM,2BAA2B,SAAS,mBAAmB;AACxE,eAAS;AAAA,QACP,MAAM;AAAA,QACN,SAAS;AAAA,QACT,YAAY;AAAA,MAAA,CACb;AAED,eAAS,KAAK,MAAM;AACpB,yBAAmB,IAAI;AACvB,mBAAa,QAAQ,aAAa,IAAI;AAEtC,cAAQ,KAAK,+CAA+C;AAAA,IAC9D;AAAA,EACF;AAGA,QAAM,iBAAiB,CAAC,aAA2B;AACjD,UAAM,mBAAmB,MAAM,UAAU,KAAK,CAAC,SAAS,KAAK,SAAS,QAAQ;AAE9E,QAAI,kBAAkB;AACpB,eAAS,EAAE,MAAM,wBAAwB,SAAS,kBAAkB;AACpE,eAAS,EAAE,MAAM,uBAAuB,SAAS,OAAO;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,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("react"),t=require("react-i18next"),n=require("../../constants/all-language/index.js"),l=require("../../utils/common/index.js"),r=require("../../api-client/api.rbac/api/index.js"),i=require("../../api-client/api.system-feature/api/index.js");const o=["en","en-US",n.DEFAULT_LANG],c={languages:[],currentLanguage:null,isLoading:!1,error:null,isFallbackActive:!1},s=(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}},d=a.createContext(void 0);exports.LanguageContext=d,exports.LanguageProvider=({children:n})=>{const[u,g]=a.useReducer(s,c),{i18n:E}=t.useTranslation();a.useEffect(()=>{r.setBaseUrl("https://apidev.erpforce.co/rbac")},[]);const A=async e=>{if(E&&"function"==typeof E.changeLanguage)try{await E.changeLanguage(e)}catch(a){}},p=e=>{document.body.dir=e.direction||"ltr",A(e.code),localStorage.setItem("_language",e.code)},_=async()=>{var e,a;try{g({type:"FETCH_LANGUAGES_START"});const t=await i.getV1Languages({order:"id:1",filters:"(is_active.in=[1])",...l.getToken()}),n=(null==(e=null==t?void 0:t.data)?void 0:e.languages)||[],r=null==(a=null==n?void 0:n.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}));r.some(e=>"en"===e.code)||r.unshift({code:"en",label:"English",direction:"ltr"}),g({type:"FETCH_LANGUAGES_SUCCESS",payload:r});const c=localStorage.getItem("_language"),s=((e,a)=>{if(!e||0===e.length)return null;if(a){const t=e.find(e=>e.code===a);if(t)return t}for(const t of o){const a=e.find(e=>e.code===t);if(a)return a}return e[0]||null})(r,c||void 0);if(s){const e=c&&c!==s.code;g({type:"SET_CURRENT_LANGUAGE",payload:s,isFallback:e}),p(s)}}catch(t){const e=t instanceof Error?t.message:"Failed to fetch languages";g({type:"FETCH_LANGUAGES_ERROR",payload:e});const a={code:"en",label:"English",direction:"ltr"};g({type:"FETCH_LANGUAGES_SUCCESS",payload:[a]}),g({type:"SET_CURRENT_LANGUAGE",payload:a,isFallback:!0}),document.body.dir="ltr",A("en"),localStorage.setItem("_language","en")}};a.useEffect(()=>{_()},[]);const y={...u,changeLanguage:e=>{const a=u.languages.find(a=>a.code===e);if(a)g({type:"SET_CURRENT_LANGUAGE",payload:a}),g({type:"SET_FALLBACK_ACTIVE",payload:!1}),p(a);else{const e={code:"en",label:"English",direction:"ltr"};g({type:"SET_CURRENT_LANGUAGE",payload:e,isFallback:!0}),p(e)}},fetchLanguages:_};/* @__PURE__ */
2
- return e.jsx(d.Provider,{value:y,children:n})},exports.default=d;
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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NC,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,EAC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D,EAAS,CAAEN,KAAM,uBAAwBC,QAAS2D,IAClDtD,EAAS,CAAEN,KAAM,sBAAuBC,SAAS,IACjDiB,EAAsB0C,OACjB,CAIL,MAAMF,EAlNkB,CAC5BlC,KAAM,KACNgB,MAAO,UACPjB,UAAW,OAgNPjB,EAAS,CACPN,KAAM,uBACNC,QAASyD,EACTxD,YAAY,IAEdgB,EAAsBwC,EACxB,GAYA/B;AAGF,aACGxB,EAAgB0D,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 (define_process_env_default.NODE_ENV === "development") {
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 {