@axelor/aos-mobile-core 0.0.1

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 (361) hide show
  1. package/README.md +310 -0
  2. package/lib/api/attached-files-api.d.ts +8 -0
  3. package/lib/api/attached-files-api.js +51 -0
  4. package/lib/api/attached-files-api.js.map +1 -0
  5. package/lib/api/login-api.d.ts +5 -0
  6. package/lib/api/login-api.js +41 -0
  7. package/lib/api/login-api.js.map +1 -0
  8. package/lib/api/mail-message-api.d.ts +43 -0
  9. package/lib/api/mail-message-api.js +114 -0
  10. package/lib/api/mail-message-api.js.map +1 -0
  11. package/lib/api/menu-config-api.d.ts +5 -0
  12. package/lib/api/menu-config-api.js +68 -0
  13. package/lib/api/menu-config-api.js.map +1 -0
  14. package/lib/api/metafile-api.d.ts +6 -0
  15. package/lib/api/metafile-api.js +50 -0
  16. package/lib/api/metafile-api.js.map +1 -0
  17. package/lib/api/mobile-config-api.d.ts +1 -0
  18. package/lib/api/mobile-config-api.js +31 -0
  19. package/lib/api/mobile-config-api.js.map +1 -0
  20. package/lib/api/net-info-utils.d.ts +5 -0
  21. package/lib/api/net-info-utils.js +29 -0
  22. package/lib/api/net-info-utils.js.map +1 -0
  23. package/lib/api/traceback-api.d.ts +7 -0
  24. package/lib/api/traceback-api.js +35 -0
  25. package/lib/api/traceback-api.js.map +1 -0
  26. package/lib/api/utils.d.ts +25 -0
  27. package/lib/api/utils.js +92 -0
  28. package/lib/api/utils.js.map +1 -0
  29. package/lib/app/Application.d.ts +15 -0
  30. package/lib/app/Application.js +29 -0
  31. package/lib/app/Application.js.map +1 -0
  32. package/lib/app/ContextedApplication.d.ts +9 -0
  33. package/lib/app/ContextedApplication.js +80 -0
  34. package/lib/app/ContextedApplication.js.map +1 -0
  35. package/lib/app/ContextsProvider.d.ts +14 -0
  36. package/lib/app/ContextsProvider.js +63 -0
  37. package/lib/app/ContextsProvider.js.map +1 -0
  38. package/lib/app/Module.d.ts +26 -0
  39. package/lib/app/Module.js +19 -0
  40. package/lib/app/Module.js.map +1 -0
  41. package/lib/app/RootNavigator.d.ts +7 -0
  42. package/lib/app/RootNavigator.js +69 -0
  43. package/lib/app/RootNavigator.js.map +1 -0
  44. package/lib/app/index.d.ts +5 -0
  45. package/lib/app/index.js +22 -0
  46. package/lib/app/index.js.map +1 -0
  47. package/lib/assets/Logo_Axelor.png +0 -0
  48. package/lib/auth/api/company-api.d.ts +1 -0
  49. package/lib/auth/api/company-api.js +31 -0
  50. package/lib/auth/api/company-api.js.map +1 -0
  51. package/lib/auth/api/config-api.d.ts +2 -0
  52. package/lib/auth/api/config-api.js +45 -0
  53. package/lib/auth/api/config-api.js.map +1 -0
  54. package/lib/auth/api/index.d.ts +4 -0
  55. package/lib/auth/api/index.js +22 -0
  56. package/lib/auth/api/index.js.map +1 -0
  57. package/lib/auth/api/language-api.d.ts +1 -0
  58. package/lib/auth/api/language-api.js +24 -0
  59. package/lib/auth/api/language-api.js.map +1 -0
  60. package/lib/auth/api/user-api.d.ts +2 -0
  61. package/lib/auth/api/user-api.js +30 -0
  62. package/lib/auth/api/user-api.js.map +1 -0
  63. package/lib/auth/features/asyncFunctionsIndex.d.ts +4 -0
  64. package/lib/auth/features/asyncFunctionsIndex.js +22 -0
  65. package/lib/auth/features/asyncFunctionsIndex.js.map +1 -0
  66. package/lib/auth/features/companySlice.d.ts +14 -0
  67. package/lib/auth/features/companySlice.js +48 -0
  68. package/lib/auth/features/companySlice.js.map +1 -0
  69. package/lib/auth/features/configSlice.d.ts +37 -0
  70. package/lib/auth/features/configSlice.js +82 -0
  71. package/lib/auth/features/configSlice.js.map +1 -0
  72. package/lib/auth/features/index.d.ts +4 -0
  73. package/lib/auth/features/index.js +22 -0
  74. package/lib/auth/features/index.js.map +1 -0
  75. package/lib/auth/features/languageSlice.d.ts +14 -0
  76. package/lib/auth/features/languageSlice.js +48 -0
  77. package/lib/auth/features/languageSlice.js.map +1 -0
  78. package/lib/auth/features/userSlice.d.ts +27 -0
  79. package/lib/auth/features/userSlice.js +83 -0
  80. package/lib/auth/features/userSlice.js.map +1 -0
  81. package/lib/auth/i18n/en.json +23 -0
  82. package/lib/auth/i18n/fr.json +23 -0
  83. package/lib/auth/index.d.ts +5 -0
  84. package/lib/auth/index.js +55 -0
  85. package/lib/auth/index.js.map +1 -0
  86. package/lib/auth/screens/SettingsScreen.d.ts +4 -0
  87. package/lib/auth/screens/SettingsScreen.js +79 -0
  88. package/lib/auth/screens/SettingsScreen.js.map +1 -0
  89. package/lib/auth/screens/UserScreen.d.ts +5 -0
  90. package/lib/auth/screens/UserScreen.js +116 -0
  91. package/lib/auth/screens/UserScreen.js.map +1 -0
  92. package/lib/auth/screens/index.d.ts +2 -0
  93. package/lib/auth/screens/index.js +20 -0
  94. package/lib/auth/screens/index.js.map +1 -0
  95. package/lib/axios/AxiosApi.d.ts +12 -0
  96. package/lib/axios/AxiosApi.js +32 -0
  97. package/lib/axios/AxiosApi.js.map +1 -0
  98. package/lib/components/external/Camera/Camera.d.ts +2 -0
  99. package/lib/components/external/Camera/Camera.js +148 -0
  100. package/lib/components/external/Camera/Camera.js.map +1 -0
  101. package/lib/components/external/Camera/CaptureButton.d.ts +10 -0
  102. package/lib/components/external/Camera/CaptureButton.js +118 -0
  103. package/lib/components/external/Camera/CaptureButton.js.map +1 -0
  104. package/lib/components/external/CameraScanner/CameraScanner.d.ts +10 -0
  105. package/lib/components/external/CameraScanner/CameraScanner.js +87 -0
  106. package/lib/components/external/CameraScanner/CameraScanner.js.map +1 -0
  107. package/lib/components/external/PlanningView/PlanningView.d.ts +11 -0
  108. package/lib/components/external/PlanningView/PlanningView.js +123 -0
  109. package/lib/components/external/PlanningView/PlanningView.js.map +1 -0
  110. package/lib/components/external/PlanningView/agenda.helpers.d.ts +10 -0
  111. package/lib/components/external/PlanningView/agenda.helpers.js +90 -0
  112. package/lib/components/external/PlanningView/agenda.helpers.js.map +1 -0
  113. package/lib/components/external/Scanner/Scanner.d.ts +2 -0
  114. package/lib/components/external/Scanner/Scanner.js +67 -0
  115. package/lib/components/external/Scanner/Scanner.js.map +1 -0
  116. package/lib/components/external/Stopwatch/Stopwatch.d.ts +18 -0
  117. package/lib/components/external/Stopwatch/Stopwatch.js +114 -0
  118. package/lib/components/external/Stopwatch/Stopwatch.js.map +1 -0
  119. package/lib/components/external/Timer/Timer.d.ts +9 -0
  120. package/lib/components/external/Timer/Timer.js +60 -0
  121. package/lib/components/external/Timer/Timer.js.map +1 -0
  122. package/lib/components/external/index.d.ts +6 -0
  123. package/lib/components/external/index.js +24 -0
  124. package/lib/components/external/index.js.map +1 -0
  125. package/lib/components/index.d.ts +4 -0
  126. package/lib/components/index.js +22 -0
  127. package/lib/components/index.js.map +1 -0
  128. package/lib/components/molecules/ErrorText/ErrorText.d.ts +4 -0
  129. package/lib/components/molecules/ErrorText/ErrorText.js +31 -0
  130. package/lib/components/molecules/ErrorText/ErrorText.js.map +1 -0
  131. package/lib/components/molecules/HeaderOptionsMenuItem/HeaderOptionMenuItem.d.ts +9 -0
  132. package/lib/components/molecules/HeaderOptionsMenuItem/HeaderOptionMenuItem.js +56 -0
  133. package/lib/components/molecules/HeaderOptionsMenuItem/HeaderOptionMenuItem.js.map +1 -0
  134. package/lib/components/molecules/IconSettings/IconSettings.d.ts +4 -0
  135. package/lib/components/molecules/IconSettings/IconSettings.js +31 -0
  136. package/lib/components/molecules/IconSettings/IconSettings.js.map +1 -0
  137. package/lib/components/molecules/InputBarCodeCard/InputBarCodeCard.d.ts +7 -0
  138. package/lib/components/molecules/InputBarCodeCard/InputBarCodeCard.js +84 -0
  139. package/lib/components/molecules/InputBarCodeCard/InputBarCodeCard.js.map +1 -0
  140. package/lib/components/molecules/LoginButton/LoginButton.d.ts +4 -0
  141. package/lib/components/molecules/LoginButton/LoginButton.js +40 -0
  142. package/lib/components/molecules/LoginButton/LoginButton.js.map +1 -0
  143. package/lib/components/molecules/MailMessageReadIcon/MailMessageReadIcon.d.ts +7 -0
  144. package/lib/components/molecules/MailMessageReadIcon/MailMessageReadIcon.js +55 -0
  145. package/lib/components/molecules/MailMessageReadIcon/MailMessageReadIcon.js.map +1 -0
  146. package/lib/components/molecules/TrackItem/TrackItem.d.ts +9 -0
  147. package/lib/components/molecules/TrackItem/TrackItem.js +65 -0
  148. package/lib/components/molecules/TrackItem/TrackItem.js.map +1 -0
  149. package/lib/components/molecules/index.d.ts +7 -0
  150. package/lib/components/molecules/index.js +25 -0
  151. package/lib/components/molecules/index.js.map +1 -0
  152. package/lib/components/organisms/AOSImage/AOSImage.d.ts +15 -0
  153. package/lib/components/organisms/AOSImage/AOSImage.js +37 -0
  154. package/lib/components/organisms/AOSImage/AOSImage.js.map +1 -0
  155. package/lib/components/organisms/AOSImageBubble/AOSImageBubble.d.ts +9 -0
  156. package/lib/components/organisms/AOSImageBubble/AOSImageBubble.js +30 -0
  157. package/lib/components/organisms/AOSImageBubble/AOSImageBubble.js.map +1 -0
  158. package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.d.ts +9 -0
  159. package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js +68 -0
  160. package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js.map +1 -0
  161. package/lib/components/organisms/LogoImage/LogoImage.d.ts +4 -0
  162. package/lib/components/organisms/LogoImage/LogoImage.js +52 -0
  163. package/lib/components/organisms/LogoImage/LogoImage.js.map +1 -0
  164. package/lib/components/organisms/MailMessageCard/MailMessageCard.d.ts +17 -0
  165. package/lib/components/organisms/MailMessageCard/MailMessageCard.js +79 -0
  166. package/lib/components/organisms/MailMessageCard/MailMessageCard.js.map +1 -0
  167. package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.d.ts +12 -0
  168. package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.js +139 -0
  169. package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.js.map +1 -0
  170. package/lib/components/organisms/MailMessageNotificationCard/MailMessageNotificationCard.d.ts +15 -0
  171. package/lib/components/organisms/MailMessageNotificationCard/MailMessageNotificationCard.js +79 -0
  172. package/lib/components/organisms/MailMessageNotificationCard/MailMessageNotificationCard.js.map +1 -0
  173. package/lib/components/organisms/PasswordInput/PasswordInput.d.ts +7 -0
  174. package/lib/components/organisms/PasswordInput/PasswordInput.js +36 -0
  175. package/lib/components/organisms/PasswordInput/PasswordInput.js.map +1 -0
  176. package/lib/components/organisms/ScannerAutocompleteSearch/ScannerAutocompleteSearch.d.ts +17 -0
  177. package/lib/components/organisms/ScannerAutocompleteSearch/ScannerAutocompleteSearch.js +68 -0
  178. package/lib/components/organisms/ScannerAutocompleteSearch/ScannerAutocompleteSearch.js.map +1 -0
  179. package/lib/components/organisms/UrlInput/UrlInput.d.ts +10 -0
  180. package/lib/components/organisms/UrlInput/UrlInput.js +38 -0
  181. package/lib/components/organisms/UrlInput/UrlInput.js.map +1 -0
  182. package/lib/components/organisms/UsernameInput/UsernameInput.d.ts +6 -0
  183. package/lib/components/organisms/UsernameInput/UsernameInput.js +33 -0
  184. package/lib/components/organisms/UsernameInput/UsernameInput.js.map +1 -0
  185. package/lib/components/organisms/index.d.ts +11 -0
  186. package/lib/components/organisms/index.js +29 -0
  187. package/lib/components/organisms/index.js.map +1 -0
  188. package/lib/components/templates/AttachedFilesView/AttachedFilesView.d.ts +10 -0
  189. package/lib/components/templates/AttachedFilesView/AttachedFilesView.js +87 -0
  190. package/lib/components/templates/AttachedFilesView/AttachedFilesView.js.map +1 -0
  191. package/lib/components/templates/MailMessageView/MailMessageView.d.ts +6 -0
  192. package/lib/components/templates/MailMessageView/MailMessageView.js +140 -0
  193. package/lib/components/templates/MailMessageView/MailMessageView.js.map +1 -0
  194. package/lib/components/templates/index.d.ts +2 -0
  195. package/lib/components/templates/index.js +20 -0
  196. package/lib/components/templates/index.js.map +1 -0
  197. package/lib/features/attachedFilesSlice.d.ts +35 -0
  198. package/lib/features/attachedFilesSlice.js +82 -0
  199. package/lib/features/attachedFilesSlice.js.map +1 -0
  200. package/lib/features/authSlice.d.ts +44 -0
  201. package/lib/features/authSlice.js +67 -0
  202. package/lib/features/authSlice.js.map +1 -0
  203. package/lib/features/cameraSlice.d.ts +14 -0
  204. package/lib/features/cameraSlice.js +52 -0
  205. package/lib/features/cameraSlice.js.map +1 -0
  206. package/lib/features/index.d.ts +8 -0
  207. package/lib/features/index.js +26 -0
  208. package/lib/features/index.js.map +1 -0
  209. package/lib/features/mailMessageSlice.d.ts +97 -0
  210. package/lib/features/mailMessageSlice.js +219 -0
  211. package/lib/features/mailMessageSlice.js.map +1 -0
  212. package/lib/features/menuConfigSlice.d.ts +14 -0
  213. package/lib/features/menuConfigSlice.js +48 -0
  214. package/lib/features/menuConfigSlice.js.map +1 -0
  215. package/lib/features/metafileSlice.d.ts +14 -0
  216. package/lib/features/metafileSlice.js +48 -0
  217. package/lib/features/metafileSlice.js.map +1 -0
  218. package/lib/features/mobileConfigSlice.d.ts +14 -0
  219. package/lib/features/mobileConfigSlice.js +52 -0
  220. package/lib/features/mobileConfigSlice.js.map +1 -0
  221. package/lib/features/scannerSlice.d.ts +14 -0
  222. package/lib/features/scannerSlice.js +52 -0
  223. package/lib/features/scannerSlice.js.map +1 -0
  224. package/lib/hooks/use-effect-debugger.d.ts +1 -0
  225. package/lib/hooks/use-effect-debugger.js +47 -0
  226. package/lib/hooks/use-effect-debugger.js.map +1 -0
  227. package/lib/i18n/api/translation.d.ts +2 -0
  228. package/lib/i18n/api/translation.js +38 -0
  229. package/lib/i18n/api/translation.js.map +1 -0
  230. package/lib/i18n/component/Translator.d.ts +6 -0
  231. package/lib/i18n/component/Translator.js +74 -0
  232. package/lib/i18n/component/Translator.js.map +1 -0
  233. package/lib/i18n/helpers/langages.d.ts +3 -0
  234. package/lib/i18n/helpers/langages.js +34 -0
  235. package/lib/i18n/helpers/langages.js.map +1 -0
  236. package/lib/i18n/helpers/translations.d.ts +1 -0
  237. package/lib/i18n/helpers/translations.js +24 -0
  238. package/lib/i18n/helpers/translations.js.map +1 -0
  239. package/lib/i18n/hooks/use-translator.d.ts +5 -0
  240. package/lib/i18n/hooks/use-translator.js +24 -0
  241. package/lib/i18n/hooks/use-translator.js.map +1 -0
  242. package/lib/i18n/i18n.d.ts +20 -0
  243. package/lib/i18n/i18n.js +53 -0
  244. package/lib/i18n/i18n.js.map +1 -0
  245. package/lib/i18n/index.d.ts +4 -0
  246. package/lib/i18n/index.js +22 -0
  247. package/lib/i18n/index.js.map +1 -0
  248. package/lib/i18n/translations/en.json +52 -0
  249. package/lib/i18n/translations/fr.json +52 -0
  250. package/lib/index.d.ts +18 -0
  251. package/lib/index.js +36 -0
  252. package/lib/index.js.map +1 -0
  253. package/lib/navigator/Navigator.d.ts +12 -0
  254. package/lib/navigator/Navigator.js +118 -0
  255. package/lib/navigator/Navigator.js.map +1 -0
  256. package/lib/navigator/drawer/AuthMenuIconButton.d.ts +6 -0
  257. package/lib/navigator/drawer/AuthMenuIconButton.js +29 -0
  258. package/lib/navigator/drawer/AuthMenuIconButton.js.map +1 -0
  259. package/lib/navigator/drawer/BackIcon.d.ts +4 -0
  260. package/lib/navigator/drawer/BackIcon.js +32 -0
  261. package/lib/navigator/drawer/BackIcon.js.map +1 -0
  262. package/lib/navigator/drawer/DrawerContent.d.ts +8 -0
  263. package/lib/navigator/drawer/DrawerContent.js +177 -0
  264. package/lib/navigator/drawer/DrawerContent.js.map +1 -0
  265. package/lib/navigator/drawer/DrawerToggleButton.d.ts +4 -0
  266. package/lib/navigator/drawer/DrawerToggleButton.js +32 -0
  267. package/lib/navigator/drawer/DrawerToggleButton.js.map +1 -0
  268. package/lib/navigator/drawer/Menu.d.ts +8 -0
  269. package/lib/navigator/drawer/Menu.js +91 -0
  270. package/lib/navigator/drawer/Menu.js.map +1 -0
  271. package/lib/navigator/drawer/MenuIconButton.d.ts +10 -0
  272. package/lib/navigator/drawer/MenuIconButton.js +64 -0
  273. package/lib/navigator/drawer/MenuIconButton.js.map +1 -0
  274. package/lib/navigator/drawer/MenuItem.d.ts +8 -0
  275. package/lib/navigator/drawer/MenuItem.js +71 -0
  276. package/lib/navigator/drawer/MenuItem.js.map +1 -0
  277. package/lib/navigator/menu.helper.d.ts +8 -0
  278. package/lib/navigator/menu.helper.js +50 -0
  279. package/lib/navigator/menu.helper.js.map +1 -0
  280. package/lib/navigator/module.helper.d.ts +7 -0
  281. package/lib/navigator/module.helper.js +95 -0
  282. package/lib/navigator/module.helper.js.map +1 -0
  283. package/lib/navigator/roles.helper.d.ts +4 -0
  284. package/lib/navigator/roles.helper.js +33 -0
  285. package/lib/navigator/roles.helper.js.map +1 -0
  286. package/lib/redux/hooks.d.ts +5 -0
  287. package/lib/redux/hooks.js +25 -0
  288. package/lib/redux/hooks.js.map +1 -0
  289. package/lib/redux/store.d.ts +1 -0
  290. package/lib/redux/store.js +28 -0
  291. package/lib/redux/store.js.map +1 -0
  292. package/lib/screens/AttachedFilesScreen.d.ts +5 -0
  293. package/lib/screens/AttachedFilesScreen.js +26 -0
  294. package/lib/screens/AttachedFilesScreen.js.map +1 -0
  295. package/lib/screens/ErrorScreen.d.ts +5 -0
  296. package/lib/screens/ErrorScreen.js +46 -0
  297. package/lib/screens/ErrorScreen.js.map +1 -0
  298. package/lib/screens/LoginScreen.d.ts +4 -0
  299. package/lib/screens/LoginScreen.js +115 -0
  300. package/lib/screens/LoginScreen.js.map +1 -0
  301. package/lib/screens/MailMessageScreen.d.ts +5 -0
  302. package/lib/screens/MailMessageScreen.js +25 -0
  303. package/lib/screens/MailMessageScreen.js.map +1 -0
  304. package/lib/storage/Storage.d.ts +17 -0
  305. package/lib/storage/Storage.js +53 -0
  306. package/lib/storage/Storage.js.map +1 -0
  307. package/lib/tools/ClipboardProvider.d.ts +7 -0
  308. package/lib/tools/ClipboardProvider.js +59 -0
  309. package/lib/tools/ClipboardProvider.js.map +1 -0
  310. package/lib/tools/FileViewer.d.ts +13 -0
  311. package/lib/tools/FileViewer.js +48 -0
  312. package/lib/tools/FileViewer.js.map +1 -0
  313. package/lib/tools/LinkingProvider.d.ts +17 -0
  314. package/lib/tools/LinkingProvider.js +94 -0
  315. package/lib/tools/LinkingProvider.js.map +1 -0
  316. package/lib/tools/index.d.ts +3 -0
  317. package/lib/tools/index.js +21 -0
  318. package/lib/tools/index.js.map +1 -0
  319. package/lib/tools/linking.helper.d.ts +25 -0
  320. package/lib/tools/linking.helper.js +70 -0
  321. package/lib/tools/linking.helper.js.map +1 -0
  322. package/lib/types/index.d.ts +2 -0
  323. package/lib/types/index.js +20 -0
  324. package/lib/types/index.js.map +1 -0
  325. package/lib/types/mail-message-notification-type.d.ts +12 -0
  326. package/lib/types/mail-message-notification-type.js +48 -0
  327. package/lib/types/mail-message-notification-type.js.map +1 -0
  328. package/lib/types/stopwatch-type.d.ts +14 -0
  329. package/lib/types/stopwatch-type.js +64 -0
  330. package/lib/types/stopwatch-type.js.map +1 -0
  331. package/lib/utils/agenda.d.ts +1 -0
  332. package/lib/utils/agenda.js +28 -0
  333. package/lib/utils/agenda.js.map +1 -0
  334. package/lib/utils/date.d.ts +4 -0
  335. package/lib/utils/date.js +41 -0
  336. package/lib/utils/date.js.map +1 -0
  337. package/lib/utils/displayers.d.ts +1 -0
  338. package/lib/utils/displayers.js +19 -0
  339. package/lib/utils/displayers.js.map +1 -0
  340. package/lib/utils/formatters.d.ts +5 -0
  341. package/lib/utils/formatters.js +74 -0
  342. package/lib/utils/formatters.js.map +1 -0
  343. package/lib/utils/index.d.ts +9 -0
  344. package/lib/utils/index.js +27 -0
  345. package/lib/utils/index.js.map +1 -0
  346. package/lib/utils/list.d.ts +3 -0
  347. package/lib/utils/list.js +101 -0
  348. package/lib/utils/list.js.map +1 -0
  349. package/lib/utils/object.d.ts +2 -0
  350. package/lib/utils/object.js +36 -0
  351. package/lib/utils/object.js.map +1 -0
  352. package/lib/utils/show-toast-message.d.ts +2 -0
  353. package/lib/utils/show-toast-message.js +22 -0
  354. package/lib/utils/show-toast-message.js.map +1 -0
  355. package/lib/utils/string.d.ts +4 -0
  356. package/lib/utils/string.js +54 -0
  357. package/lib/utils/string.js.map +1 -0
  358. package/lib/utils/time.d.ts +4 -0
  359. package/lib/utils/time.js +78 -0
  360. package/lib/utils/time.js.map +1 -0
  361. package/package.json +95 -0
package/README.md ADDED
@@ -0,0 +1,310 @@
1
+ <h1 align="center">@axelor/aos-mobile-core</h1>
2
+
3
+ <div align="center">
4
+ <img src="https://i.imgur.com/KJAAFlT.png" width="30%"/>
5
+ </div>
6
+
7
+ ## Presentation
8
+
9
+ This package was developed for the [Axelor Open Mobile](https://github.com/axelor/axelor-mobile) application.
10
+
11
+ It contains:
12
+ * API providers
13
+ * Auth module with login and user screens
14
+ * Translations management system
15
+ * Various helper tools : clipboard, file viewer, external app management
16
+ * Management of MailMessages and attaches files on objects
17
+ * AOS linked components or using external libraries : Camera, Scanner, PlanningView, Stopwatch, ...
18
+ * Menu management
19
+ * Storage management
20
+
21
+ ## Usage
22
+
23
+ Install the library :
24
+
25
+ ```bash
26
+ yarn add @axelor/aos-mobile-core
27
+ ```
28
+
29
+ Compatibility with React v18.2.x and React Native v0.68.x.
30
+
31
+ This package has a few required libraries as peer dependencies:
32
+ - [@react-native-clipboard/clipboard](https://www.npmjs.com/package/@react-native-clipboard/clipboard)
33
+ - [axios](https://www.npmjs.com/package/axios)
34
+ - [i18next](https://www.npmjs.com/package/i18next)
35
+ - [react-i18next](https://www.npmjs.com/package/react-i18next)
36
+ - [react-native-datawedge-intents](https://www.npmjs.com/package/react-native-datawedge-intents)
37
+ - [react-native-device-info](https://www.npmjs.com/package/react-native-device-info)
38
+ - [react-native-file-viewer](https://www.npmjs.com/package/react-native-file-viewer)
39
+ - [react-native-fs](https://www.npmjs.com/package/react-native-fs)
40
+ - [react-native-gesture-handler](https://www.npmjs.com/package/react-native-gesture-handler)
41
+ - [react-native-mmkv](https://www.npmjs.com/package/react-native-mmkv)
42
+ - [react-native-safe-area-context](https://www.npmjs.com/package/react-native-safe-area-context)
43
+ - [react-native-screens](https://www.npmjs.com/package/react-native-screens)
44
+ - [react-native-static-safe-area-insets](https://www.npmjs.com/package/react-native-static-safe-area-insets)
45
+ - [react-native-toast-message](https://www.npmjs.com/package/react-native-toast-message)
46
+ - [react-native-vision-camera](https://www.npmjs.com/package/react-native-vision-camera)
47
+ - [vision-camera-code-scanner](https://www.npmjs.com/package/vision-camera-code-scanner)
48
+
49
+ ### Create an application
50
+
51
+ The component Application enables you to create an application really simply :
52
+
53
+ ```typescript
54
+ interface Application {
55
+ modules: Module[]; // Functionnal packages
56
+ mainMenu?: string; // Main menu when openning app
57
+ additionalsReducers?: any;
58
+ version: string; // App version to be display on login screen
59
+ themes?: Theme[]; // Additionnals themes
60
+ defaultTheme?: Theme; // Default theme for all users
61
+ writingThemes?: Writing[]; // Additionnals writing themes
62
+ defaultWritingTheme?: Writing; // Default writing theme for all users
63
+ showModulesSubtitle: boolean; // Option to show subtitles of modules in the drawer menu
64
+ }
65
+ ```
66
+
67
+ Each module is based on the same interface and has the following attributes :
68
+
69
+ ```typescript
70
+ interface Module {
71
+ name: string; // Module name
72
+ title: string; // Module title in the drawer
73
+ subtitle: string; // Module subtitle in the drawer
74
+ icon: string; // Module icon in the drawer
75
+ disabled?: boolean;
76
+ menus: {
77
+ // List of menus of the module
78
+ [screenKey: string]: {
79
+ title: string;
80
+ icon: string;
81
+ screen: string;
82
+ disabled?: boolean;
83
+ };
84
+ };
85
+ screens: {
86
+ // List of screens of the module
87
+ [screenKey: string]:
88
+ | React.FC<any>
89
+ | {
90
+ component: React.FC<any>;
91
+ title: string;
92
+ };
93
+ };
94
+ translations?: {
95
+ // All translations of the module
96
+ [languageKey: string]: any;
97
+ };
98
+ reducers?: any; // Reducers of the module
99
+ }
100
+ ```
101
+
102
+ ### Perform request
103
+
104
+ This package provides a tool for making HTTP requests. This tool is based on axios. To use it, simply import the provider and use the appropriate method:
105
+
106
+ ```typescript
107
+ import {axiosApiProvider} from '@axelor/aos-mobile-core';
108
+
109
+ ...
110
+
111
+ axiosApiProvider.post({url: '...', data: {...}});
112
+ ```
113
+
114
+ ### Translations system
115
+
116
+ This package is also responsible for managing translations. To add translations in the database, you just have to indicate them as an JSON format in the export of the module:
117
+
118
+ ```typescript
119
+ const myModule : Module {
120
+ name: "my-module-key";
121
+ title: "MyModule_Name";
122
+ subtitle: "MyModule_SubName";
123
+ icon: ...;
124
+ menus: {...};
125
+ screens: {...};
126
+ translations: {
127
+ en: {
128
+ MyModule_Name: "My module name",
129
+ MyModule_SubName: "My module",
130
+ HelloWorld: "Hello world"
131
+ },
132
+ fr: {
133
+ MyModule_Name: "Le nom de mon module",
134
+ MyModule_SubName: "Mon module",
135
+ HelloWorld: "Bonjour"
136
+ }
137
+ };
138
+ }
139
+ ```
140
+
141
+ Then, to translate an element and thus retrieve its translation, the translation function must be retrieved from the `useTranslator` hook:
142
+
143
+ ```typescript
144
+ import {useTranslator} from '@axelor/aos-mobile-core';
145
+ import {Text} from '@axelor/aos-mobile-ui';
146
+
147
+ ...
148
+
149
+ const I18n = useTranslator();
150
+
151
+ ...
152
+
153
+ <Text>{I18n.t('HelloWorld')}</Text>
154
+
155
+ ```
156
+
157
+ The auth module, present in this package, allows the user's language to be modified directly from his profile. However, the package also provides the reducer to perform this action in the case of an overload or the addition on another screen. To change the language, simply update the user on the server:
158
+
159
+ ```typescript
160
+ import {updateActiveUser, useDispatch, useSelector} from '@axelor/aos-mobile-core';
161
+
162
+ ...
163
+
164
+ const {user} = useSelector(state => state.user);
165
+ const dispatch = useDispatch();
166
+
167
+ ...
168
+
169
+ const updateLanguage = useCallback(
170
+ language => {
171
+ dispatch(
172
+ updateActiveUser({id: user.id, language, version: user.version}),
173
+ );
174
+ },
175
+ [dispatch, user],
176
+ );
177
+ ```
178
+
179
+ ### Helper tools
180
+
181
+ This package provides several helpers such as:
182
+ * Clipboard provider
183
+
184
+ To copy something to the user's clipboard, just call the clipboardProvider.copyToClipboard with the string value of what you want to copy:
185
+
186
+ ```typescript
187
+ import {clipboardProvider} from '@axelor/aos-mobile-core';
188
+ import {Icon, useThemeColor} from '@axelor/aos-mobile-ui';
189
+
190
+ ...
191
+
192
+ const Colors = useThemeColor();
193
+
194
+ ...
195
+
196
+ {address?.fullName && (
197
+ <Icon
198
+ name="copy"
199
+ color={Colors.secondaryColor.foreground}
200
+ size={20}
201
+ touchable={true}
202
+ onPress={() =>
203
+ clipboardProvider.copyToClipboard(address?.fullName)
204
+ }
205
+ />
206
+ )}
207
+ ```
208
+
209
+ * Open a file in an external app
210
+
211
+ This package provides a tool to open files from the server, either MetaFile or DMSFile, in the application dedicated to the latter type on the phone.
212
+
213
+ To do this, simply use the openFileInExternalApp function of the package with the necessary information:
214
+
215
+ ```typescript
216
+ import {openFileInExternalApp, useSelector, useTranslator} from '@axelor/aos-mobile-core';
217
+
218
+ ...
219
+
220
+ const {baseUrl, token, jsessionId} = useSelector(state => state.auth);
221
+ const I18n = useTranslator();
222
+
223
+ ...
224
+
225
+ const handleShowFile = async item => {
226
+ await openFileInExternalApp(
227
+ {fileName: item.fileName, id: item.id, isMetaFile: isMetaFile},
228
+ {baseUrl: baseUrl, token: token, jsessionId: jsessionId},
229
+ I18n,
230
+ );
231
+ };
232
+ ```
233
+
234
+ * Open an external app with contact informations
235
+
236
+ To have the contact applications (call, email, maps, ...), just use the linkingProvider with the dedicated method:
237
+ 1. URL management: `openURL(url: string, error: {title: string; message: string})`
238
+ 2. Browser management: `openBrowser(url: string)`
239
+ 3. Call management: `openCallApp(tel: string)`
240
+ 4. Message management: `openSMSApp(tel: string)`
241
+ 5. Email management: `openMailApp(email: string, subject?: string, body?: string, to?: string, cc?: string, bcc?: string)`
242
+ 6. Maps management: `openMapApp(address?: string, destination?: string, latitude?: number, longitude?: number, transportType: string)`
243
+
244
+
245
+ An example with maps app:
246
+ ```typescript
247
+ import {linkingProvider} from '@axelor/aos-mobile-core';
248
+ import {Icon, useThemeColor} from '@axelor/aos-mobile-ui';
249
+
250
+ ...
251
+
252
+ const Colors = useThemeColor();
253
+
254
+ ...
255
+
256
+ {address?.fullName && (
257
+ <Icon
258
+ name="map-marked-alt"
259
+ color={Colors.secondaryColor.foreground}
260
+ size={20}
261
+ touchable={true}
262
+ onPress={() =>
263
+ linkingProvider.openMapApp(address?.fullName)
264
+ }
265
+ />
266
+ )}
267
+ ```
268
+
269
+ ### Add MailMessages and attached files
270
+ * Management of MailMessages and attaches files on objects
271
+
272
+ This package provides a component to add MailMessages and file attachments functionality to the header. This component also allows to display its children if there are any as a dropdown menu.
273
+
274
+ For the first two functionalities of this component, it is necessary to provide in props the name of the object model ("com.axelor.apps.stock.db.StockCorrection" for the stock corrections for example), the id of the current object, and the navigation attribute to go on the dedicated screens:
275
+ ```typescript
276
+ import {HeaderOptionsMenu} from '@axelor/aos-mobile-core';
277
+ import {DropdownMenuItem} from '@axelor/aos-mobile-ui';
278
+
279
+ ...
280
+
281
+ React.useLayoutEffect(() => {
282
+ navigation.setOptions({
283
+ headerRight: () => (
284
+ <HeaderOptionsMenu
285
+ model={...}
286
+ modelId={...}
287
+ navigation={navigation}
288
+ disableMailMessages={...}>
289
+ <DropdownMenuItem
290
+ icon="..."
291
+ placeholder={...}
292
+ onPress={...}
293
+ />
294
+ </HeaderOptionsMenu>
295
+ ),
296
+ });
297
+ }, [navigation, ...]);
298
+ ```
299
+
300
+ An example of rendering:
301
+
302
+ ![](https://i.imgur.com/pCuV2jM.jpg)
303
+
304
+ ### Components
305
+
306
+ This package also provides a number of components linked to Axelor Open Suite (AOS) or requiring external libraries such as the camera, the calendar view or the stopwatch.
307
+
308
+ ## Developpment
309
+
310
+ This package is developed as part of the Axelor Open Mobile application. To contribute, please go to the [Github project](https://github.com/axelor/axelor-mobile) and follow the guidelines. You will also find an installation guide to help you configure your environment.
@@ -0,0 +1,8 @@
1
+ export declare function fetchAttachedFiles({ model, modelId, }: {
2
+ model: string;
3
+ modelId: number;
4
+ }): Promise<any>;
5
+ export declare function countAttachments({ model, modelId, }: {
6
+ model: string;
7
+ modelId: number;
8
+ }): Promise<any>;
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2023 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { axiosApiProvider } from '../axios/AxiosApi';
19
+ import { fetchFileDetails } from './metafile-api';
20
+ export async function fetchAttachedFiles({ model, modelId, }) {
21
+ return axiosApiProvider
22
+ .get({ url: `/ws/dms/attachments/${model}/${modelId}` })
23
+ .then(response => {
24
+ if (response?.data?.data == null) {
25
+ return response;
26
+ }
27
+ else {
28
+ return fetchFileDetails({
29
+ listFiles: response?.data?.data,
30
+ isMetaFile: false,
31
+ });
32
+ }
33
+ });
34
+ }
35
+ export async function countAttachments({ model, modelId, }) {
36
+ return axiosApiProvider.post({
37
+ url: '/ws/rest/com.axelor.dms.db.DMSFile/search',
38
+ data: {
39
+ data: {
40
+ _domain: 'self.relatedModel = :name AND self.relatedId = :id ' +
41
+ 'AND COALESCE(self.isDirectory, FALSE) = FALSE',
42
+ _domainContext: {
43
+ name: model,
44
+ id: modelId,
45
+ },
46
+ },
47
+ fields: ['id'],
48
+ },
49
+ });
50
+ }
51
+ //# sourceMappingURL=attached-files-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attached-files-api.js","sourceRoot":"","sources":["../../src/api/attached-files-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAC,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AAEhD,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,EACvC,KAAK,EACL,OAAO,GAIR;IACC,OAAO,gBAAgB;SACpB,GAAG,CAAC,EAAC,GAAG,EAAE,uBAAuB,KAAK,IAAI,OAAO,EAAE,EAAC,CAAC;SACrD,IAAI,CAAC,QAAQ,CAAC,EAAE;QACf,IAAI,QAAQ,EAAE,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE;YAChC,OAAO,QAAQ,CAAC;SACjB;aAAM;YACL,OAAO,gBAAgB,CAAC;gBACtB,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI;gBAC/B,UAAU,EAAE,KAAK;aAClB,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EACrC,KAAK,EACL,OAAO,GAIR;IACC,OAAO,gBAAgB,CAAC,IAAI,CAAC;QAC3B,GAAG,EAAE,2CAA2C;QAChD,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,OAAO,EACL,qDAAqD;oBACrD,+CAA+C;gBACjD,cAAc,EAAE;oBACd,IAAI,EAAE,KAAK;oBACX,EAAE,EAAE,OAAO;iBACZ;aACF;YACD,MAAM,EAAE,CAAC,IAAI,CAAC;SACf;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare function loginApi(url: string, username: string, password: string): Promise<{
2
+ token: string;
3
+ jsessionId: string;
4
+ }>;
5
+ export declare function getActiveUserId(): Promise<any>;
@@ -0,0 +1,41 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2023 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import axios from 'axios';
19
+ const loginPath = '/callback';
20
+ export async function loginApi(url, username, password) {
21
+ return axios
22
+ .post(`${url}${loginPath}`, { username, password })
23
+ .then(response => {
24
+ const token = response.headers['x-csrf-token'];
25
+ const jsessionId = response.headers['set-cookie'][0].split(';')[0];
26
+ if (token == null) {
27
+ throw new Error('X-CSRF-Token is not exposed in remote header');
28
+ }
29
+ axios.interceptors.request.use(config => {
30
+ config.baseURL = url;
31
+ config.headers['x-csrf-token'] = token;
32
+ return config;
33
+ });
34
+ return { token, jsessionId };
35
+ });
36
+ }
37
+ export async function getActiveUserId() {
38
+ const response = await axios.get('/ws/app/info');
39
+ return response.data['user.id'];
40
+ }
41
+ //# sourceMappingURL=login-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login-api.js","sourceRoot":"","sources":["../../src/api/login-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,SAAS,GAAG,WAAW,CAAC;AAE9B,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,GAAW,EACX,QAAgB,EAChB,QAAgB;IAEhB,OAAO,KAAK;SACT,IAAI,CAAC,GAAG,GAAG,GAAG,SAAS,EAAE,EAAE,EAAC,QAAQ,EAAE,QAAQ,EAAC,CAAC;SAChD,IAAI,CAAC,QAAQ,CAAC,EAAE;QACf,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACnE,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;SACjE;QACD,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YACtC,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC;YACrB,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC;YACvC,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;QACH,OAAO,EAAC,KAAK,EAAE,UAAU,EAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACjD,OAAO,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,43 @@
1
+ interface fetchMailMessageProps {
2
+ model: string;
3
+ modelId: number;
4
+ limit?: number;
5
+ page?: number;
6
+ }
7
+ interface postMailMessageCommentProps {
8
+ model: string;
9
+ modelId: number;
10
+ comment: string;
11
+ }
12
+ export declare function fetchMailMessages({ model, modelId, limit, page, }: fetchMailMessageProps): Promise<any>;
13
+ export declare function postMailMessageComment({ model, modelId, comment, }: postMailMessageCommentProps): Promise<any>;
14
+ export declare function fetchModelSubscribers({ model, modelId, }: {
15
+ model: string;
16
+ modelId: number;
17
+ }): Promise<any>;
18
+ export declare function subscribeRequest({ model, modelId, }: {
19
+ model: string;
20
+ modelId: number;
21
+ }): Promise<any>;
22
+ export declare function unsubscribeRequest({ model, modelId, }: {
23
+ model: string;
24
+ modelId: number;
25
+ }): Promise<any>;
26
+ export declare function countUnreadMessages({ model, modelId, }: {
27
+ model: string;
28
+ modelId: number;
29
+ }): Promise<any>;
30
+ export declare function getAllUnReadFlagsOfMailMessage({ model, modelId, }: {
31
+ model: string;
32
+ modelId: number;
33
+ }): Promise<any>;
34
+ export declare function realAllMailMessages({ model, modelId, }: {
35
+ model: string;
36
+ modelId: number;
37
+ }): Promise<any>;
38
+ export declare function readMailMessage({ mailFlagList, model, modelId, }: {
39
+ mailFlagList: any[];
40
+ model: string;
41
+ modelId: number;
42
+ }): Promise<any>;
43
+ export {};
@@ -0,0 +1,114 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2023 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { axiosApiProvider } from '../axios/AxiosApi';
19
+ export async function fetchMailMessages({ model, modelId, limit = 10, page, }) {
20
+ return axiosApiProvider.get({
21
+ url: `/ws/rest/com.axelor.mail.db.MailMessage/messages?relatedId=${modelId}&relatedModel=${model}&limit=${limit}&offset=${limit * page}`,
22
+ });
23
+ }
24
+ export async function postMailMessageComment({ model, modelId, comment, }) {
25
+ return axiosApiProvider.post({
26
+ url: `/ws/rest/${model}/${modelId}/message`,
27
+ data: {
28
+ data: {
29
+ body: `${comment}`,
30
+ type: 'comment',
31
+ files: [],
32
+ },
33
+ },
34
+ });
35
+ }
36
+ export async function fetchModelSubscribers({ model, modelId, }) {
37
+ return axiosApiProvider.get({ url: `/ws/rest/${model}/${modelId}/followers` });
38
+ }
39
+ export async function subscribeRequest({ model, modelId, }) {
40
+ return axiosApiProvider.post({
41
+ url: `/ws/rest/${model}/${modelId}/follow`,
42
+ data: {},
43
+ });
44
+ }
45
+ export async function unsubscribeRequest({ model, modelId, }) {
46
+ return axiosApiProvider.post({
47
+ url: `/ws/rest/${model}/${modelId}/unfollow`,
48
+ data: {},
49
+ });
50
+ }
51
+ export async function countUnreadMessages({ model, modelId, }) {
52
+ return axiosApiProvider.post({
53
+ url: '/ws/rest/com.axelor.mail.db.MailMessage/search',
54
+ data: {
55
+ data: {
56
+ criteria: [
57
+ {
58
+ operator: 'and',
59
+ criteria: [
60
+ { fieldName: 'relatedModel', operator: '=', value: model },
61
+ { fieldName: 'relatedId', operator: '=', value: modelId },
62
+ { fieldName: 'flags.isRead', operator: '=', value: false },
63
+ ],
64
+ },
65
+ ],
66
+ },
67
+ fields: ['id'],
68
+ },
69
+ });
70
+ }
71
+ export async function getAllUnReadFlagsOfMailMessage({ model, modelId, }) {
72
+ return axiosApiProvider.post({
73
+ url: '/ws/rest/com.axelor.mail.db.MailFlags/search',
74
+ data: {
75
+ data: {
76
+ criteria: [
77
+ {
78
+ operator: 'and',
79
+ criteria: [
80
+ { fieldName: 'message.relatedModel', operator: '=', value: model },
81
+ { fieldName: 'message.relatedId', operator: '=', value: modelId },
82
+ { fieldName: 'isRead', operator: '=', value: false },
83
+ ],
84
+ },
85
+ ],
86
+ },
87
+ limit: null,
88
+ offset: 0,
89
+ },
90
+ });
91
+ }
92
+ export async function realAllMailMessages({ model, modelId, }) {
93
+ return getAllUnReadFlagsOfMailMessage({ model, modelId }).then(res => {
94
+ const mailFlagList = res?.data?.data;
95
+ return readMailMessage({ mailFlagList, model, modelId });
96
+ });
97
+ }
98
+ export async function readMailMessage({ mailFlagList, model, modelId, }) {
99
+ if (mailFlagList == null || mailFlagList?.length === 0) {
100
+ return null;
101
+ }
102
+ const criteria = mailFlagList.map(item => {
103
+ return { id: item.id, isRead: true, version: item.version };
104
+ });
105
+ return axiosApiProvider
106
+ .post({
107
+ url: '/ws/rest/com.axelor.mail.db.MailFlags/',
108
+ data: {
109
+ records: criteria,
110
+ },
111
+ })
112
+ .then(() => countUnreadMessages({ model, modelId }));
113
+ }
114
+ //# sourceMappingURL=mail-message-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mail-message-api.js","sourceRoot":"","sources":["../../src/api/mail-message-api.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,5 @@
1
+ export declare function getModulesConfig(): Promise<{
2
+ data: {
3
+ data: any[];
4
+ };
5
+ }>;
@@ -0,0 +1,68 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2023 Axelor (<http://axelor.com>).
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License, version 3,
8
+ * as published by the Free Software Foundation.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU Affero General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Affero General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ */
18
+ import { axiosApiProvider } from '../axios/AxiosApi';
19
+ import { getMobileConfigs } from './mobile-config-api';
20
+ const MobileMenuFields = ['name', 'technicalName', 'authorizedRoles'];
21
+ const createCriteria = listMenus => {
22
+ if (listMenus != null) {
23
+ let criterias = [];
24
+ listMenus.forEach(item => {
25
+ criterias.push({ fieldName: 'id', operator: '=', value: item.id });
26
+ });
27
+ return criterias;
28
+ }
29
+ };
30
+ async function searchMenu({ listMenus }) {
31
+ if (listMenus == null || listMenus?.length === 0) {
32
+ return [];
33
+ }
34
+ else {
35
+ return axiosApiProvider
36
+ .post({
37
+ url: '/ws/rest/com.axelor.apps.mobilesettings.db.MobileMenu/search',
38
+ data: {
39
+ data: {
40
+ criteria: [
41
+ {
42
+ operator: 'or',
43
+ criteria: createCriteria(listMenus),
44
+ },
45
+ ],
46
+ },
47
+ fields: MobileMenuFields,
48
+ limit: null,
49
+ offset: 0,
50
+ },
51
+ })
52
+ .then(res => res?.data?.data);
53
+ }
54
+ }
55
+ export async function getModulesConfig() {
56
+ const modulesConfig = await getMobileConfigs().then(res => res?.data?.data);
57
+ let results = [];
58
+ for (let index = 0; index < modulesConfig.length; index++) {
59
+ const element = modulesConfig[index];
60
+ if (element.customizeMenu) {
61
+ const menuConfig = await searchMenu({ listMenus: element.menus });
62
+ results.push(menuConfig);
63
+ }
64
+ }
65
+ const restrictedMenus = results.flat();
66
+ return { data: { data: restrictedMenus } };
67
+ }
68
+ //# sourceMappingURL=menu-config-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu-config-api.js","sourceRoot":"","sources":["../../src/api/menu-config-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAErD,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC;AAEtE,MAAM,cAAc,GAAG,SAAS,CAAC,EAAE;IACjC,IAAI,SAAS,IAAI,IAAI,EAAE;QACrB,IAAI,SAAS,GAAG,EAAE,CAAC;QACnB,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACvB,SAAS,CAAC,IAAI,CAAC,EAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,EAAC,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;KAClB;AACH,CAAC,CAAC;AAEF,KAAK,UAAU,UAAU,CAAC,EAAC,SAAS,EAAC;IACnC,IAAI,SAAS,IAAI,IAAI,IAAI,SAAS,EAAE,MAAM,KAAK,CAAC,EAAE;QAChD,OAAO,EAAE,CAAC;KACX;SAAM;QACL,OAAO,gBAAgB;aACpB,IAAI,CAAC;YACJ,GAAG,EAAE,8DAA8D;YACnE,IAAI,EAAE;gBACJ,IAAI,EAAE;oBACJ,QAAQ,EAAE;wBACR;4BACE,QAAQ,EAAE,IAAI;4BACd,QAAQ,EAAE,cAAc,CAAC,SAAS,CAAC;yBACpC;qBACF;iBACF;gBACD,MAAM,EAAE,gBAAgB;gBACxB,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,CAAC;aACV;SACF,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KACjC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,MAAM,aAAa,GAAG,MAAM,gBAAgB,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5E,IAAI,OAAO,GAAG,EAAE,CAAC;IAEjB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACzD,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,OAAO,CAAC,aAAa,EAAE;YACzB,MAAM,UAAU,GAAG,MAAM,UAAU,CAAC,EAAC,SAAS,EAAE,OAAO,CAAC,KAAK,EAAC,CAAC,CAAC;YAChE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC1B;KACF;IAED,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IACvC,OAAO,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,eAAe,EAAC,EAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,6 @@
1
+ interface fetchFileDetailsProps {
2
+ listFiles: [any];
3
+ isMetaFile?: boolean;
4
+ }
5
+ export declare function fetchFileDetails({ listFiles, isMetaFile, }: fetchFileDetailsProps): Promise<any>;
6
+ export {};