@axelor/aos-mobile-core 6.4.1 → 6.5.0

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 (234) hide show
  1. package/README.md +89 -28
  2. package/lib/api/attached-files-api.js +1 -1
  3. package/lib/api/attached-files-api.js.map +1 -1
  4. package/lib/api/login-api.js +2 -0
  5. package/lib/api/login-api.js.map +1 -1
  6. package/lib/api/mail-message-api.js +1 -1
  7. package/lib/api/mail-message-api.js.map +1 -1
  8. package/lib/api/menu-config-api.js +24 -29
  9. package/lib/api/menu-config-api.js.map +1 -1
  10. package/lib/api/metafile-api.d.ts +4 -6
  11. package/lib/api/metafile-api.js +24 -25
  12. package/lib/api/metafile-api.js.map +1 -1
  13. package/lib/api/mobile-config-api.js +1 -1
  14. package/lib/api/mobile-config-api.js.map +1 -1
  15. package/lib/api/net-info-utils.js +1 -1
  16. package/lib/api/net-info-utils.js.map +1 -1
  17. package/lib/apiProviders/Action/ActionApiProvider.d.ts +5 -0
  18. package/lib/apiProviders/Action/ActionApiProvider.js +19 -0
  19. package/lib/apiProviders/Action/ActionApiProvider.js.map +1 -0
  20. package/lib/apiProviders/Action/ActionProvider.d.ts +12 -0
  21. package/lib/apiProviders/Action/ActionProvider.js +43 -0
  22. package/lib/apiProviders/Action/ActionProvider.js.map +1 -0
  23. package/lib/apiProviders/Action/AosActionApi.d.ts +8 -0
  24. package/lib/apiProviders/Action/AosActionApi.js +34 -0
  25. package/lib/apiProviders/Action/AosActionApi.js.map +1 -0
  26. package/lib/apiProviders/Action/GatewayActionApi.d.ts +8 -0
  27. package/lib/apiProviders/Action/GatewayActionApi.js +43 -0
  28. package/lib/apiProviders/Action/GatewayActionApi.js.map +1 -0
  29. package/lib/apiProviders/Action/index.d.ts +5 -0
  30. package/lib/apiProviders/Action/index.js +21 -0
  31. package/lib/apiProviders/Action/index.js.map +1 -0
  32. package/lib/apiProviders/Action/utils.d.ts +8 -0
  33. package/lib/apiProviders/Action/utils.js +19 -0
  34. package/lib/apiProviders/Action/utils.js.map +1 -0
  35. package/lib/apiProviders/Model/AopModelApi.d.ts +20 -0
  36. package/lib/apiProviders/Model/AopModelApi.js +42 -0
  37. package/lib/apiProviders/Model/AopModelApi.js.map +1 -0
  38. package/lib/apiProviders/Model/GatewayModelApi.d.ts +20 -0
  39. package/lib/apiProviders/Model/GatewayModelApi.js +52 -0
  40. package/lib/apiProviders/Model/GatewayModelApi.js.map +1 -0
  41. package/lib/apiProviders/Model/ModelApiProvider.d.ts +22 -0
  42. package/lib/apiProviders/Model/ModelApiProvider.js +19 -0
  43. package/lib/apiProviders/Model/ModelApiProvider.js.map +1 -0
  44. package/lib/apiProviders/Model/Provider.d.ts +12 -0
  45. package/lib/apiProviders/Model/Provider.js +43 -0
  46. package/lib/apiProviders/Model/Provider.js.map +1 -0
  47. package/lib/apiProviders/Model/index.d.ts +5 -0
  48. package/lib/apiProviders/Model/index.js +22 -0
  49. package/lib/apiProviders/Model/index.js.map +1 -0
  50. package/lib/apiProviders/Model/utils.d.ts +28 -0
  51. package/lib/apiProviders/Model/utils.js +19 -0
  52. package/lib/apiProviders/Model/utils.js.map +1 -0
  53. package/lib/apiProviders/Standard/AxiosProvider.d.ts +29 -0
  54. package/lib/{axios/AxiosApi.js → apiProviders/Standard/AxiosProvider.js} +4 -1
  55. package/lib/apiProviders/Standard/AxiosProvider.js.map +1 -0
  56. package/lib/apiProviders/Standard/ObjectFieldsProvider.d.ts +20 -0
  57. package/lib/apiProviders/Standard/ObjectFieldsProvider.js +84 -0
  58. package/lib/apiProviders/Standard/ObjectFieldsProvider.js.map +1 -0
  59. package/lib/apiProviders/Standard/index.d.ts +3 -0
  60. package/lib/apiProviders/Standard/index.js +21 -0
  61. package/lib/apiProviders/Standard/index.js.map +1 -0
  62. package/lib/apiProviders/Standard/requests.helper.d.ts +28 -0
  63. package/lib/apiProviders/Standard/requests.helper.js +80 -0
  64. package/lib/apiProviders/Standard/requests.helper.js.map +1 -0
  65. package/lib/apiProviders/index.d.ts +4 -0
  66. package/lib/apiProviders/index.js +22 -0
  67. package/lib/apiProviders/index.js.map +1 -0
  68. package/lib/{api → apiProviders}/utils.js +1 -1
  69. package/lib/apiProviders/utils.js.map +1 -0
  70. package/lib/app/Application.d.ts +18 -2
  71. package/lib/app/Application.js +6 -3
  72. package/lib/app/Application.js.map +1 -1
  73. package/lib/app/ContextedApplication.d.ts +15 -1
  74. package/lib/app/ContextedApplication.js +4 -4
  75. package/lib/app/ContextedApplication.js.map +1 -1
  76. package/lib/app/ContextsProvider.d.ts +3 -1
  77. package/lib/app/ContextsProvider.js +31 -4
  78. package/lib/app/ContextsProvider.js.map +1 -1
  79. package/lib/app/Module.d.ts +44 -16
  80. package/lib/app/RootNavigator.d.ts +2 -1
  81. package/lib/app/RootNavigator.js +6 -2
  82. package/lib/app/RootNavigator.js.map +1 -1
  83. package/lib/app/context.helper.d.ts +5 -0
  84. package/lib/app/context.helper.js +69 -0
  85. package/lib/app/context.helper.js.map +1 -0
  86. package/lib/app/index.d.ts +2 -1
  87. package/lib/app/index.js +1 -0
  88. package/lib/app/index.js.map +1 -1
  89. package/lib/app/module-generation.helper.d.ts +14 -0
  90. package/lib/app/module-generation.helper.js +56 -0
  91. package/lib/app/module-generation.helper.js.map +1 -0
  92. package/lib/auth/api/company-api.js +7 -10
  93. package/lib/auth/api/company-api.js.map +1 -1
  94. package/lib/auth/api/config-api.d.ts +5 -1
  95. package/lib/auth/api/config-api.js +12 -2
  96. package/lib/auth/api/config-api.js.map +1 -1
  97. package/lib/auth/api/language-api.js +1 -1
  98. package/lib/auth/api/language-api.js.map +1 -1
  99. package/lib/auth/api/user-api.js +1 -1
  100. package/lib/auth/api/user-api.js.map +1 -1
  101. package/lib/auth/features/companySlice.js +1 -1
  102. package/lib/auth/features/companySlice.js.map +1 -1
  103. package/lib/auth/features/configSlice.js +2 -1
  104. package/lib/auth/features/configSlice.js.map +1 -1
  105. package/lib/auth/features/languageSlice.js +1 -1
  106. package/lib/auth/features/languageSlice.js.map +1 -1
  107. package/lib/auth/features/userSlice.js +1 -1
  108. package/lib/auth/features/userSlice.js.map +1 -1
  109. package/lib/auth/index.js +4 -0
  110. package/lib/auth/index.js.map +1 -1
  111. package/lib/auth/models/index.d.ts +1 -0
  112. package/lib/auth/models/index.js +19 -0
  113. package/lib/auth/models/index.js.map +1 -0
  114. package/lib/auth/models/objectFields.d.ts +2 -0
  115. package/lib/auth/models/objectFields.js +25 -0
  116. package/lib/auth/models/objectFields.js.map +1 -0
  117. package/lib/auth/screens/SettingsScreen.d.ts +2 -1
  118. package/lib/auth/screens/SettingsScreen.js +18 -3
  119. package/lib/auth/screens/SettingsScreen.js.map +1 -1
  120. package/lib/components/external/CodeHighlighter/CodeHighlighter.d.ts +9 -0
  121. package/lib/components/external/CodeHighlighter/CodeHighlighter.js +30 -0
  122. package/lib/components/external/CodeHighlighter/CodeHighlighter.js.map +1 -0
  123. package/lib/components/external/CodeHighlighter/code-highlighter.helper.d.ts +39 -0
  124. package/lib/components/external/CodeHighlighter/code-highlighter.helper.js +60 -0
  125. package/lib/components/external/CodeHighlighter/code-highlighter.helper.js.map +1 -0
  126. package/lib/components/external/PlanningView/PlanningView.d.ts +5 -4
  127. package/lib/components/external/PlanningView/PlanningView.js +58 -12
  128. package/lib/components/external/PlanningView/PlanningView.js.map +1 -1
  129. package/lib/components/external/PlanningView/agenda.helpers.d.ts +15 -2
  130. package/lib/components/external/PlanningView/agenda.helpers.js +69 -9
  131. package/lib/components/external/PlanningView/agenda.helpers.js.map +1 -1
  132. package/lib/components/external/index.d.ts +2 -0
  133. package/lib/components/external/index.js +2 -0
  134. package/lib/components/external/index.js.map +1 -1
  135. package/lib/components/molecules/DatePicker/DatePicker.d.ts +8 -0
  136. package/lib/components/molecules/DatePicker/DatePicker.js +33 -0
  137. package/lib/components/molecules/DatePicker/DatePicker.js.map +1 -0
  138. package/lib/components/molecules/index.d.ts +1 -0
  139. package/lib/components/molecules/index.js +1 -0
  140. package/lib/components/molecules/index.js.map +1 -1
  141. package/lib/components/organisms/AutoCompleteSearchInput/AutoCompleteSearchInput.d.ts +19 -0
  142. package/lib/components/organisms/AutoCompleteSearchInput/AutoCompleteSearchInput.js +58 -0
  143. package/lib/components/organisms/AutoCompleteSearchInput/AutoCompleteSearchInput.js.map +1 -0
  144. package/lib/components/organisms/DateInput/DateInput.d.ts +11 -0
  145. package/lib/components/organisms/DateInput/DateInput.js +133 -0
  146. package/lib/components/organisms/DateInput/DateInput.js.map +1 -0
  147. package/lib/components/organisms/DateInput/date-input.helper.d.ts +17 -0
  148. package/lib/components/organisms/DateInput/date-input.helper.js +63 -0
  149. package/lib/components/organisms/DateInput/date-input.helper.js.map +1 -0
  150. package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.js +6 -9
  151. package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.js.map +1 -1
  152. package/lib/components/organisms/UsernameInput/UsernameInput.d.ts +5 -1
  153. package/lib/components/organisms/UsernameInput/UsernameInput.js +10 -3
  154. package/lib/components/organisms/UsernameInput/UsernameInput.js.map +1 -1
  155. package/lib/components/organisms/index.d.ts +2 -0
  156. package/lib/components/organisms/index.js +2 -0
  157. package/lib/components/organisms/index.js.map +1 -1
  158. package/lib/components/templates/AttachedFilesView/AttachedFilesView.js +14 -20
  159. package/lib/components/templates/AttachedFilesView/AttachedFilesView.js.map +1 -1
  160. package/lib/components/templates/MailMessageView/MailMessageView.js +2 -2
  161. package/lib/components/templates/MailMessageView/MailMessageView.js.map +1 -1
  162. package/lib/features/attachedFilesSlice.js +1 -1
  163. package/lib/features/attachedFilesSlice.js.map +1 -1
  164. package/lib/features/authSlice.d.ts +13 -5
  165. package/lib/features/authSlice.js +1 -1
  166. package/lib/features/authSlice.js.map +1 -1
  167. package/lib/features/index.d.ts +1 -0
  168. package/lib/features/index.js +1 -0
  169. package/lib/features/index.js.map +1 -1
  170. package/lib/features/mailMessageSlice.js +1 -1
  171. package/lib/features/mailMessageSlice.js.map +1 -1
  172. package/lib/features/menuConfigSlice.js +1 -1
  173. package/lib/features/menuConfigSlice.js.map +1 -1
  174. package/lib/features/metafileSlice.js +1 -1
  175. package/lib/features/metafileSlice.js.map +1 -1
  176. package/lib/features/mobileConfigSlice.js +1 -1
  177. package/lib/features/mobileConfigSlice.js.map +1 -1
  178. package/lib/features/onlineSlice.d.ts +11 -0
  179. package/lib/features/onlineSlice.js +49 -0
  180. package/lib/features/onlineSlice.js.map +1 -0
  181. package/lib/hooks/use-background-function.d.ts +1 -0
  182. package/lib/hooks/use-background-function.js +35 -0
  183. package/lib/hooks/use-background-function.js.map +1 -0
  184. package/lib/i18n/helpers/langages.d.ts +7 -3
  185. package/lib/i18n/helpers/langages.js.map +1 -1
  186. package/lib/i18n/i18n.d.ts +4 -3
  187. package/lib/i18n/i18n.js +5 -5
  188. package/lib/i18n/i18n.js.map +1 -1
  189. package/lib/i18n/translations/en.json +7 -1
  190. package/lib/i18n/translations/fr.json +7 -1
  191. package/lib/index.d.ts +3 -4
  192. package/lib/index.js +3 -4
  193. package/lib/index.js.map +1 -1
  194. package/lib/models/index.d.ts +1 -0
  195. package/lib/models/index.js +19 -0
  196. package/lib/models/index.js.map +1 -0
  197. package/lib/models/objectFields.d.ts +2 -0
  198. package/lib/models/objectFields.js +30 -0
  199. package/lib/models/objectFields.js.map +1 -0
  200. package/lib/navigator/Navigator.js +5 -5
  201. package/lib/navigator/Navigator.js.map +1 -1
  202. package/lib/navigator/drawer/DrawerContent.js +24 -4
  203. package/lib/navigator/drawer/DrawerContent.js.map +1 -1
  204. package/lib/navigator/module.helper.d.ts +14 -8
  205. package/lib/navigator/module.helper.js +47 -3
  206. package/lib/navigator/module.helper.js.map +1 -1
  207. package/lib/screens/LoginScreen.js +36 -7
  208. package/lib/screens/LoginScreen.js.map +1 -1
  209. package/lib/storage/Storage.d.ts +5 -1
  210. package/lib/storage/Storage.js +7 -1
  211. package/lib/storage/Storage.js.map +1 -1
  212. package/lib/tools/FilePicker.d.ts +1 -0
  213. package/lib/tools/FilePicker.js +42 -0
  214. package/lib/tools/FilePicker.js.map +1 -0
  215. package/lib/utils/date.d.ts +3 -0
  216. package/lib/utils/date.js +16 -0
  217. package/lib/utils/date.js.map +1 -1
  218. package/lib/utils/filter.d.ts +9 -0
  219. package/lib/utils/filter.js +31 -0
  220. package/lib/utils/filter.js.map +1 -0
  221. package/lib/utils/formatters.d.ts +1 -0
  222. package/lib/utils/formatters.js +8 -0
  223. package/lib/utils/formatters.js.map +1 -1
  224. package/lib/utils/index.d.ts +6 -5
  225. package/lib/utils/index.js +6 -5
  226. package/lib/utils/index.js.map +1 -1
  227. package/lib/utils/object.d.ts +3 -0
  228. package/lib/utils/object.js +22 -0
  229. package/lib/utils/object.js.map +1 -1
  230. package/package.json +12 -6
  231. package/lib/api/utils.js.map +0 -1
  232. package/lib/axios/AxiosApi.d.ts +0 -12
  233. package/lib/axios/AxiosApi.js.map +0 -1
  234. /package/lib/{api → apiProviders}/utils.d.ts +0 -0
package/README.md CHANGED
@@ -1,3 +1,8 @@
1
+ ---
2
+ title: Core
3
+ tags: Readme
4
+ ---
5
+
1
6
  <h1 align="center">@axelor/aos-mobile-core</h1>
2
7
 
3
8
  <div align="center">
@@ -6,17 +11,18 @@
6
11
 
7
12
  ## Presentation
8
13
 
9
- This package was developed for the [Axelor Open Mobile](https://github.com/axelor/axelor-mobile) application.
14
+ This package was developed for the [Axelor Open Mobile](https://github.com/axelor/axelor-mobile) application.
10
15
 
11
16
  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
17
+
18
+ - API providers
19
+ - Auth module with login and user screens
20
+ - Translations management system
21
+ - Various helper tools : clipboard, file viewer, external app management
22
+ - Management of MailMessages and attaches files on objects
23
+ - AOS linked components or using external libraries : Camera, Scanner, PlanningView, Stopwatch, ...
24
+ - Menu management
25
+ - Storage management
20
26
 
21
27
  ## Usage
22
28
 
@@ -29,12 +35,15 @@ yarn add @axelor/aos-mobile-core
29
35
  Compatibility with React v18.2.x and React Native v0.68.x.
30
36
 
31
37
  This package has a few required libraries as peer dependencies:
38
+
32
39
  - [@react-native-clipboard/clipboard](https://www.npmjs.com/package/@react-native-clipboard/clipboard)
33
40
  - [axios](https://www.npmjs.com/package/axios)
34
41
  - [i18next](https://www.npmjs.com/package/i18next)
35
42
  - [react-i18next](https://www.npmjs.com/package/react-i18next)
43
+ - [react-native-date-picker](https://www.npmjs.com/package/react-native-date-picker)
36
44
  - [react-native-datawedge-intents](https://www.npmjs.com/package/react-native-datawedge-intents)
37
45
  - [react-native-device-info](https://www.npmjs.com/package/react-native-device-info)
46
+ - [react-native-document-picker](https://www.npmjs.com/package/react-native-document-picker)
38
47
  - [react-native-file-viewer](https://www.npmjs.com/package/react-native-file-viewer)
39
48
  - [react-native-fs](https://www.npmjs.com/package/react-native-fs)
40
49
  - [react-native-gesture-handler](https://www.npmjs.com/package/react-native-gesture-handler)
@@ -46,7 +55,7 @@ This package has a few required libraries as peer dependencies:
46
55
  - [react-native-vision-camera](https://www.npmjs.com/package/react-native-vision-camera)
47
56
  - [vision-camera-code-scanner](https://www.npmjs.com/package/vision-camera-code-scanner)
48
57
 
49
- ### Create an application
58
+ ### Create an application
50
59
 
51
60
  The component Application enables you to create an application really simply :
52
61
 
@@ -61,6 +70,7 @@ interface Application {
61
70
  writingThemes?: Writing[]; // Additionnals writing themes
62
71
  defaultWritingTheme?: Writing; // Default writing theme for all users
63
72
  showModulesSubtitle: boolean; // Option to show subtitles of modules in the drawer menu
73
+ configuration?: appConfig; // Configuration to customize application
64
74
  }
65
75
  ```
66
76
 
@@ -69,37 +79,44 @@ Each module is based on the same interface and has the following attributes :
69
79
  ```typescript
70
80
  interface Module {
71
81
  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
82
+ title?: string; // Module title in the drawer
83
+ subtitle?: string; // Module subtitle in the drawer
84
+ icon?: string; // Module icon in the drawer
75
85
  disabled?: boolean;
76
86
  menus: {
77
87
  // List of menus of the module
78
88
  [screenKey: string]: {
79
89
  title: string;
80
90
  icon: string;
81
- screen: string;
91
+ screen: string; // Name of the main screen of this menu
82
92
  disabled?: boolean;
93
+ parent?: string; // Option to add menu in another module
94
+ order?: number; // Option to change order of menu (default: index * 10)
83
95
  };
84
96
  };
85
97
  screens: {
86
98
  // List of screens of the module
87
- [screenKey: string]:
88
- | React.FC<any>
89
- | {
90
- component: React.FC<any>;
91
- title: string;
92
- };
99
+ [screenKey: string]: {
100
+ component: React.FC<any>;
101
+ title: string;
102
+ options?: ScreenOptions; // screen options to activate or not shadedHeader
103
+ };
93
104
  };
94
105
  translations?: {
95
106
  // All translations of the module
96
107
  [languageKey: string]: any;
97
108
  };
98
109
  reducers?: any; // Reducers of the module
110
+ backgroundFunctions?: Function[]; // List of function that should be executed in the background, interval is 5 minutes
111
+ models?: {
112
+ objectFields?: ObjectFields; // Fields of object for API calls structured on YUP schemas
113
+ sortFields?: SortFields; // Sort rules for API calls
114
+ searchFields?: SearchFields; // List of fields of object for searchs
115
+ };
99
116
  }
100
117
  ```
101
118
 
102
- ### Perform request
119
+ ### Perform request
103
120
 
104
121
  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
122
 
@@ -111,6 +128,28 @@ import {axiosApiProvider} from '@axelor/aos-mobile-core';
111
128
  axiosApiProvider.post({url: '...', data: {...}});
112
129
  ```
113
130
 
131
+ You can also create standard requests with the functions createStandardSearch and createStandardFetch.
132
+
133
+ ```typescript
134
+ createStandardSearch = ({
135
+ model: string; // Full name of the model
136
+ criteria?: Criteria[]; // List of criterias
137
+ domain?: string;
138
+ domainContext?: any;
139
+ fieldKey: string; // Key of the API fields configuration given in models props of module
140
+ sortKey?: string; // Key of the sort rules configuration given in models props of module
141
+ page: number; // Current page in search
142
+ numberElementsByPage?: number; // Number of elements that should be fetched, default is 10 and can be adjusted in app configuration file
143
+ }): Promise<any>;
144
+
145
+ createStandardFetch = ({
146
+ model: string; // Full name of the model
147
+ fieldKey: string; // Key of the API fields configuration given in models props of module
148
+ id: number; // Id of the object that should be fetched
149
+ relatedFields?: any; // Additional fields of the relational objects
150
+ }): Promise<any>;
151
+ ```
152
+
114
153
  ### Translations system
115
154
 
116
155
  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:
@@ -176,10 +215,13 @@ const updateLanguage = useCallback(
176
215
  );
177
216
  ```
178
217
 
218
+ Default language of the application is 'en' but this can be modified in the application configuration file under defaultLanguage props.
219
+
179
220
  ### Helper tools
180
221
 
181
222
  This package provides several helpers such as:
182
- * Clipboard provider
223
+
224
+ - Clipboard provider
183
225
 
184
226
  To copy something to the user's clipboard, just call the clipboardProvider.copyToClipboard with the string value of what you want to copy:
185
227
 
@@ -206,7 +248,7 @@ const Colors = useThemeColor();
206
248
  )}
207
249
  ```
208
250
 
209
- * Open a file in an external app
251
+ - Open a file in an external app
210
252
 
211
253
  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
254
 
@@ -214,7 +256,7 @@ To do this, simply use the openFileInExternalApp function of the package with th
214
256
 
215
257
  ```typescript
216
258
  import {openFileInExternalApp, useSelector, useTranslator} from '@axelor/aos-mobile-core';
217
-
259
+
218
260
  ...
219
261
 
220
262
  const {baseUrl, token, jsessionId} = useSelector(state => state.auth);
@@ -231,9 +273,26 @@ const handleShowFile = async item => {
231
273
  };
232
274
  ```
233
275
 
234
- * Open an external app with contact informations
276
+ - Pick a file for phone data
277
+
278
+ This package provides a tool to pick an image from phone storage.
279
+
280
+ To do this, simply use the handleDocumentSelection function of the package with the necessary information:
281
+
282
+ ```typescript
283
+ import {handleDocumentSelection} from '@axelor/aos-mobile-core';
284
+
285
+ ...
286
+
287
+ const handlePickFile = async () => {
288
+ await handleDocumentSelection(console.log);
289
+ };
290
+ ```
291
+
292
+ - Open an external app with contact informations
235
293
 
236
294
  To have the contact applications (call, email, maps, ...), just use the linkingProvider with the dedicated method:
295
+
237
296
  1. URL management: `openURL(url: string, error: {title: string; message: string})`
238
297
  2. Browser management: `openBrowser(url: string)`
239
298
  3. Call management: `openCallApp(tel: string)`
@@ -241,8 +300,8 @@ To have the contact applications (call, email, maps, ...), just use the linkingP
241
300
  5. Email management: `openMailApp(email: string, subject?: string, body?: string, to?: string, cc?: string, bcc?: string)`
242
301
  6. Maps management: `openMapApp(address?: string, destination?: string, latitude?: number, longitude?: number, transportType: string)`
243
302
 
244
-
245
303
  An example with maps app:
304
+
246
305
  ```typescript
247
306
  import {linkingProvider} from '@axelor/aos-mobile-core';
248
307
  import {Icon, useThemeColor} from '@axelor/aos-mobile-ui';
@@ -267,11 +326,13 @@ const Colors = useThemeColor();
267
326
  ```
268
327
 
269
328
  ### Add MailMessages and attached files
270
- * Management of MailMessages and attaches files on objects
329
+
330
+ - Management of MailMessages and attaches files on objects
271
331
 
272
332
  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
333
 
274
334
  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:
335
+
275
336
  ```typescript
276
337
  import {HeaderOptionsMenu} from '@axelor/aos-mobile-core';
277
338
  import {DropdownMenuItem} from '@axelor/aos-mobile-ui';
@@ -303,7 +364,7 @@ An example of rendering:
303
364
 
304
365
  ### Components
305
366
 
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.
367
+ 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
368
 
308
369
  ## Developpment
309
370
 
@@ -15,7 +15,7 @@
15
15
  * You should have received a copy of the GNU Affero General Public License
16
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
- import { axiosApiProvider } from '../axios/AxiosApi';
18
+ import { axiosApiProvider } from '../apiProviders';
19
19
  import { fetchFileDetails } from './metafile-api';
20
20
  export async function fetchAttachedFiles({ model, modelId, }) {
21
21
  return axiosApiProvider
@@ -1 +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"}
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,iBAAiB,CAAC;AACjD,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"}
@@ -16,6 +16,7 @@
16
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
18
  import axios from 'axios';
19
+ import { provider } from '../apiProviders';
19
20
  const loginPath = '/callback';
20
21
  export async function loginApi(url, username, password) {
21
22
  return axios
@@ -31,6 +32,7 @@ export async function loginApi(url, username, password) {
31
32
  config.headers['x-csrf-token'] = token;
32
33
  return config;
33
34
  });
35
+ provider.getModelApi()?.init();
34
36
  return { token, jsessionId };
35
37
  });
36
38
  }
@@ -1 +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,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AAC,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"}
@@ -15,7 +15,7 @@
15
15
  * You should have received a copy of the GNU Affero General Public License
16
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
- import { axiosApiProvider } from '../axios/AxiosApi';
18
+ import { axiosApiProvider } from '../apiProviders';
19
19
  export async function fetchMailMessages({ model, modelId, limit = 10, page, }) {
20
20
  return axiosApiProvider.get({
21
21
  url: `/ws/rest/com.axelor.mail.db.MailMessage/messages?relatedId=${modelId}&relatedModel=${model}&limit=${limit}&offset=${limit * page}`,
@@ -1 +1 @@
1
- {"version":3,"file":"mail-message-api.js","sourceRoot":"","sources":["../../src/api/mail-message-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAenD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EACtC,KAAK,EACL,OAAO,EACP,KAAK,GAAG,EAAE,EACV,IAAI,GACkB;IACtB,OAAO,gBAAgB,CAAC,GAAG,CAAC;QAC1B,GAAG,EAAE,8DAA8D,OAAO,iBAAiB,KAAK,UAAU,KAAK,WAC7G,KAAK,GAAG,IACV,EAAE;KACH,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,EAC3C,KAAK,EACL,OAAO,EACP,OAAO,GACqB;IAC5B,OAAO,gBAAgB,CAAC,IAAI,CAAC;QAC3B,GAAG,EAAE,YAAY,KAAK,IAAI,OAAO,UAAU;QAC3C,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,IAAI,EAAE,GAAG,OAAO,EAAE;gBAClB,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,EAAE;aACV;SACF;KAC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B,IAAI,CAAC;QACJ,GAAG,EAAE,wCAAwC;QAC7C,IAAI,EAAE;YACJ,OAAO,EAAE,QAAQ;SAClB;KACF,CAAC;SACD,IAAI,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC,CAAC,CAAC;AACvD,CAAC"}
@@ -15,42 +15,37 @@
15
15
  * You should have received a copy of the GNU Affero General Public License
16
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
- import { axiosApiProvider } from '../axios/AxiosApi';
18
+ import { createStandardSearch } from '../apiProviders';
19
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;
20
+ const createCriteria = (listMenus) => {
21
+ if (Array.isArray(listMenus)) {
22
+ return [
23
+ {
24
+ operator: 'or',
25
+ criteria: listMenus.map(item => {
26
+ const criteria = {
27
+ fieldName: 'id',
28
+ operator: '=',
29
+ value: item.id,
30
+ };
31
+ return criteria;
32
+ }),
33
+ },
34
+ ];
28
35
  }
36
+ return [];
29
37
  };
30
38
  async function searchMenu({ listMenus }) {
31
39
  if (listMenus == null || listMenus?.length === 0) {
32
40
  return [];
33
41
  }
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
- }
42
+ return createStandardSearch({
43
+ model: 'com.axelor.apps.mobilesettings.db.MobileMenu',
44
+ criteria: createCriteria(listMenus),
45
+ fieldKey: 'core_mobileMenu',
46
+ numberElementsByPage: null,
47
+ page: 0,
48
+ }).then(res => res?.data?.data);
54
49
  }
55
50
  export async function getModulesConfig() {
56
51
  const modulesConfig = await getMobileConfigs().then(res => res?.data?.data);
@@ -1 +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;g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AED,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IACvC,OAAO,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,eAAe,EAAC,EAAC,CAAC;AACzC,CAAC"}
@@ -1,6 +1,4 @@
1
- interface fetchFileDetailsProps {
2
- listFiles: [any];
3
- isMetaFile?: boolean;
4
- }
5
- export declare function fetchFileDetails({ listFiles, isMetaFile, }: fetchFileDetailsProps): Promise<any>;
6
- export {};
1
+ export declare function fetchFileDetails({ listFiles, isMetaFile }: {
2
+ listFiles: any;
3
+ isMetaFile: any;
4
+ }): Promise<any>;
@@ -15,36 +15,35 @@
15
15
  * You should have received a copy of the GNU Affero General Public License
16
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
- import { axiosApiProvider } from '../axios/AxiosApi';
19
- const MetaFileFields = ['id', 'fileName', 'createdOn'];
20
- const createCriteria = listFiles => {
21
- if (listFiles != null) {
22
- let criterias = [];
23
- listFiles.forEach(item => {
24
- criterias.push({ fieldName: 'id', operator: '=', value: item.id });
25
- });
26
- return criterias;
18
+ import { createStandardSearch } from '../apiProviders';
19
+ const createCriteria = (listFiles) => {
20
+ if (Array.isArray(listFiles)) {
21
+ return [
22
+ {
23
+ operator: 'or',
24
+ criteria: listFiles.map(item => {
25
+ const criteria = {
26
+ fieldName: 'id',
27
+ operator: '=',
28
+ value: item.id,
29
+ };
30
+ return criteria;
31
+ }),
32
+ },
33
+ ];
27
34
  }
35
+ return [];
28
36
  };
29
- export async function fetchFileDetails({ listFiles, isMetaFile, }) {
37
+ export async function fetchFileDetails({ listFiles, isMetaFile }) {
30
38
  const model = isMetaFile
31
39
  ? 'com.axelor.meta.db.MetaFile'
32
40
  : 'com.axelor.dms.db.DMSFile';
33
- return axiosApiProvider.post({
34
- url: `/ws/rest/${model}/search`,
35
- data: {
36
- data: {
37
- criteria: [
38
- {
39
- operator: 'or',
40
- criteria: createCriteria(listFiles),
41
- },
42
- ],
43
- },
44
- fields: MetaFileFields,
45
- limit: null,
46
- offset: 0,
47
- },
41
+ return createStandardSearch({
42
+ model: model,
43
+ criteria: createCriteria(listFiles),
44
+ fieldKey: 'core_metaFile',
45
+ numberElementsByPage: null,
46
+ page: 0,
48
47
  });
49
48
  }
50
49
  //# sourceMappingURL=metafile-api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"metafile-api.js","sourceRoot":"","sources":["../../src/api/metafile-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAEnD,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;AAEvD,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;AAOF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EACrC,SAAS,EACT,UAAU,GACY;IACtB,MAAM,KAAK,GAAG,UAAU;QACtB,CAAC,CAAC,6BAA6B;QAC/B,CAAC,CAAC,2BAA2B,CAAC;IAChC,OAAO,gBAAgB,CAAC,IAAI,CAAC;QAC3B,GAAG,EAAE,YAAY,KAAK,SAAS;QAC/B,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,QAAQ,EAAE;oBACR;wBACE,QAAQ,EAAE,IAAI;wBACd,QAAQ,EAAE,cAAc,CAAC,SAAS,CAAC;qBACpC;iBACF;aACF;YACD,MAAM,EAAE,cAAc;YACtB,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,CAAC;SACV;KACF,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"metafile-api.js","sourceRoot":"","sources":["../../src/api/metafile-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,oBAAoB,EAAW,MAAM,iBAAiB,CAAC;AAE/D,MAAM,cAAc,GAAG,CAAC,SAAS,EAAc,EAAE;IAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;QAC5B,OAAO;YACL;gBACE,QAAQ,EAAE,IAAI;gBACd,QAAQ,EAAE,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;oBAC7B,MAAM,QAAQ,GAAa;wBACzB,SAAS,EAAE,IAAI;wBACf,QAAQ,EAAE,GAAG;wBACb,KAAK,EAAE,IAAI,CAAC,EAAE;qBACf,CAAC;oBAEF,OAAO,QAAQ,CAAC;gBAClB,CAAC,CAAC;aACH;SACF,CAAC;KACH;IAED,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EAAC,SAAS,EAAE,UAAU,EAAC;IAC5D,MAAM,KAAK,GAAG,UAAU;QACtB,CAAC,CAAC,6BAA6B;QAC/B,CAAC,CAAC,2BAA2B,CAAC;IAEhC,OAAO,oBAAoB,CAAC;QAC1B,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,cAAc,CAAC,SAAS,CAAC;QACnC,QAAQ,EAAE,eAAe;QACzB,oBAAoB,EAAE,IAAI;QAC1B,IAAI,EAAE,CAAC;KACR,CAAC,CAAC;AACL,CAAC"}
@@ -15,7 +15,7 @@
15
15
  * You should have received a copy of the GNU Affero General Public License
16
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
- import { axiosApiProvider } from '../axios/AxiosApi';
18
+ import { axiosApiProvider } from '../apiProviders';
19
19
  function emptyResponse() {
20
20
  return { data: { data: [] } };
21
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mobile-config-api.js","sourceRoot":"","sources":["../../src/api/mobile-config-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAEnD,SAAS,aAAa;IACpB,OAAO,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,EAAE,EAAC,EAAC,CAAC;AAC5B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,OAAO,gBAAgB;SACpB,IAAI,CAAC;QACJ,GAAG,EAAE,6CAA6C;QAClD,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,QAAQ,EAAE;oBACR;wBACE,SAAS,EAAE,MAAM;wBACjB,QAAQ,EAAE,GAAG;wBACb,KAAK,EAAE,iBAAiB;qBACzB;iBACF;aACF;YACD,MAAM,EAAE,CAAC,QAAQ,CAAC;SACnB;KACF,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,EAAE;QACV,IACE,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC,IAAI,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;YAC1C,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,EAC3B;YACA,OAAO,gBAAgB;iBACpB,GAAG,CAAC;gBACH,GAAG,EAAE,yDAAyD;aAC/D,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC,EAAE;gBACX,IAAI,IAAI,EAAE,MAAM,KAAK,CAAC,IAAI,IAAI,EAAE,MAAM,KAAK,GAAG,EAAE;oBAC9C,OAAO,IAAI,CAAC;iBACb;gBACD,OAAO,aAAa,EAAE,CAAC;YACzB,CAAC,CAAC,CAAC;SACN;QACD,OAAO,aAAa,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;AACP,CAAC"}
1
+ {"version":3,"file":"mobile-config-api.js","sourceRoot":"","sources":["../../src/api/mobile-config-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAEjD,SAAS,aAAa;IACpB,OAAO,EAAC,IAAI,EAAE,EAAC,IAAI,EAAE,EAAE,EAAC,EAAC,CAAC;AAC5B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,OAAO,gBAAgB;SACpB,IAAI,CAAC;QACJ,GAAG,EAAE,6CAA6C;QAClD,IAAI,EAAE;YACJ,IAAI,EAAE;gBACJ,QAAQ,EAAE;oBACR;wBACE,SAAS,EAAE,MAAM;wBACjB,QAAQ,EAAE,GAAG;wBACb,KAAK,EAAE,iBAAiB;qBACzB;iBACF;aACF;YACD,MAAM,EAAE,CAAC,QAAQ,CAAC;SACnB;KACF,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,EAAE;QACV,IACE,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC,IAAI,GAAG,EAAE,MAAM,KAAK,GAAG,CAAC;YAC1C,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,EAC3B;YACA,OAAO,gBAAgB;iBACpB,GAAG,CAAC;gBACH,GAAG,EAAE,yDAAyD;aAC/D,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC,EAAE;gBACX,IAAI,IAAI,EAAE,MAAM,KAAK,CAAC,IAAI,IAAI,EAAE,MAAM,KAAK,GAAG,EAAE;oBAC9C,OAAO,IAAI,CAAC;iBACb;gBACD,OAAO,aAAa,EAAE,CAAC;YACzB,CAAC,CAAC,CAAC;SACN;QACD,OAAO,aAAa,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -15,7 +15,7 @@
15
15
  * You should have received a copy of the GNU Affero General Public License
16
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
- import { axiosApiProvider } from '../axios/AxiosApi';
18
+ import { axiosApiProvider } from '../apiProviders';
19
19
  export async function getNetInfo() {
20
20
  return axiosApiProvider
21
21
  .get({
@@ -1 +1 @@
1
- {"version":3,"file":"net-info-utils.js","sourceRoot":"","sources":["../../src/api/net-info-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAMnD,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,OAAO,gBAAgB;SACpB,GAAG,CAAC;QACH,GAAG,EAAE,yBAAyB;KAC/B,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAC,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,GAAG,EAAC,CAAC,CAAC;SACjD,KAAK,CAAC,GAAG,EAAE;QACV,OAAO,EAAC,WAAW,EAAE,KAAK,EAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACP,CAAC"}
1
+ {"version":3,"file":"net-info-utils.js","sourceRoot":"","sources":["../../src/api/net-info-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAMjD,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,OAAO,gBAAgB;SACpB,GAAG,CAAC;QACH,GAAG,EAAE,yBAAyB;KAC/B,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAC,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,GAAG,EAAC,CAAC,CAAC;SACjD,KAAK,CAAC,GAAG,EAAE;QACV,OAAO,EAAC,WAAW,EAAE,KAAK,EAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ActionRequest } from './utils';
2
+ export interface ActionApi {
3
+ isAvailable(): Promise<boolean>;
4
+ send(request: ActionRequest): Promise<void>;
5
+ }
@@ -0,0 +1,19 @@
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
+ export {};
19
+ //# sourceMappingURL=ActionApiProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionApiProvider.js","sourceRoot":"","sources":["../../../src/apiProviders/Action/ActionApiProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
@@ -0,0 +1,12 @@
1
+ import { ActionApi } from './ActionApiProvider';
2
+ declare class ActionProvider {
3
+ private actionApi;
4
+ constructor(actionApi: ActionApi);
5
+ setActionApi(newActionApi: ActionApi): void;
6
+ getActionApi(): ActionApi;
7
+ }
8
+ export declare function useActionApi(): ActionApi;
9
+ export declare function getActionApi(): ActionApi;
10
+ export declare function registerActionApi(actionApi: ActionApi): void;
11
+ export declare const actionProvider: ActionProvider;
12
+ export {};
@@ -0,0 +1,43 @@
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 { useMemo } from 'react';
19
+ import { AosActionApi } from './AosActionApi';
20
+ class ActionProvider {
21
+ actionApi;
22
+ constructor(actionApi) {
23
+ this.actionApi = actionApi;
24
+ this.actionApi = actionApi;
25
+ }
26
+ setActionApi(newActionApi) {
27
+ this.actionApi = newActionApi;
28
+ }
29
+ getActionApi() {
30
+ return this.actionApi;
31
+ }
32
+ }
33
+ export function useActionApi() {
34
+ return useMemo(() => actionProvider.getActionApi(), []);
35
+ }
36
+ export function getActionApi() {
37
+ return actionProvider.getActionApi();
38
+ }
39
+ export function registerActionApi(actionApi) {
40
+ actionProvider.setActionApi(actionApi);
41
+ }
42
+ export const actionProvider = new ActionProvider(new AosActionApi());
43
+ //# sourceMappingURL=ActionProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionProvider.js","sourceRoot":"","sources":["../../../src/apiProviders/Action/ActionProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,MAAM,cAAc;IACE;IAApB,YAAoB,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;QACtC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,YAAY,CAAC,YAAuB;QAClC,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC;IAChC,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,cAAc,CAAC,YAAY,EAAE,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,SAAoB;IACpD,cAAc,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { ActionApi } from './ActionApiProvider';
2
+ import { ActionRequest } from './utils';
3
+ export declare class AosActionApi implements ActionApi {
4
+ constructor();
5
+ static isOnlineAvailable: boolean;
6
+ isAvailable(): Promise<boolean>;
7
+ send(request: ActionRequest): Promise<void>;
8
+ }