@axelor/aos-mobile-core 6.4.2 → 6.5.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 (225) hide show
  1. package/README.md +65 -10
  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 +2 -2
  69. package/lib/apiProviders/utils.js.map +1 -0
  70. package/lib/app/Application.d.ts +1 -0
  71. package/lib/app/Application.js +1 -1
  72. package/lib/app/Application.js.map +1 -1
  73. package/lib/app/ContextedApplication.js +2 -2
  74. package/lib/app/ContextedApplication.js.map +1 -1
  75. package/lib/app/ContextsProvider.d.ts +2 -1
  76. package/lib/app/ContextsProvider.js +23 -1
  77. package/lib/app/ContextsProvider.js.map +1 -1
  78. package/lib/app/Module.d.ts +37 -10
  79. package/lib/app/RootNavigator.js +8 -1
  80. package/lib/app/RootNavigator.js.map +1 -1
  81. package/lib/app/context.helper.d.ts +5 -0
  82. package/lib/app/context.helper.js +69 -0
  83. package/lib/app/context.helper.js.map +1 -0
  84. package/lib/app/index.d.ts +2 -1
  85. package/lib/app/index.js +1 -0
  86. package/lib/app/index.js.map +1 -1
  87. package/lib/app/module-generation.helper.d.ts +14 -0
  88. package/lib/app/module-generation.helper.js +56 -0
  89. package/lib/app/module-generation.helper.js.map +1 -0
  90. package/lib/auth/api/company-api.js +7 -10
  91. package/lib/auth/api/company-api.js.map +1 -1
  92. package/lib/auth/api/config-api.js +2 -1
  93. package/lib/auth/api/config-api.js.map +1 -1
  94. package/lib/auth/api/language-api.js +1 -1
  95. package/lib/auth/api/language-api.js.map +1 -1
  96. package/lib/auth/api/user-api.js +1 -1
  97. package/lib/auth/api/user-api.js.map +1 -1
  98. package/lib/auth/features/companySlice.js +1 -1
  99. package/lib/auth/features/companySlice.js.map +1 -1
  100. package/lib/auth/features/configSlice.js +2 -1
  101. package/lib/auth/features/configSlice.js.map +1 -1
  102. package/lib/auth/features/languageSlice.js +1 -1
  103. package/lib/auth/features/languageSlice.js.map +1 -1
  104. package/lib/auth/features/userSlice.js +1 -1
  105. package/lib/auth/features/userSlice.js.map +1 -1
  106. package/lib/auth/hooks/use-auth-headers.d.ts +1 -0
  107. package/lib/auth/hooks/use-auth-headers.js +48 -0
  108. package/lib/auth/hooks/use-auth-headers.js.map +1 -0
  109. package/lib/auth/index.js +7 -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/{components/molecules/IconSettings/IconSettings.js → auth/models/objectFields.js} +7 -13
  116. package/lib/auth/models/objectFields.js.map +1 -0
  117. package/lib/auth/screens/SettingsScreen.js +13 -1
  118. package/lib/auth/screens/SettingsScreen.js.map +1 -1
  119. package/lib/auth/screens/UserScreen.js +0 -6
  120. package/lib/auth/screens/UserScreen.js.map +1 -1
  121. package/lib/components/molecules/ErrorText/ErrorText.js +2 -31
  122. package/lib/components/molecules/ErrorText/ErrorText.js.map +1 -1
  123. package/lib/components/molecules/HeaderOptionsMenuItem/HeaderOptionMenuItem.d.ts +2 -1
  124. package/lib/components/molecules/HeaderOptionsMenuItem/HeaderOptionMenuItem.js +9 -9
  125. package/lib/components/molecules/HeaderOptionsMenuItem/HeaderOptionMenuItem.js.map +1 -1
  126. package/lib/components/molecules/MailMessageReadIcon/MailMessageReadIcon.d.ts +4 -0
  127. package/lib/components/molecules/MailMessageReadIcon/MailMessageReadIcon.js +10 -6
  128. package/lib/components/molecules/MailMessageReadIcon/MailMessageReadIcon.js.map +1 -1
  129. package/lib/components/molecules/index.d.ts +0 -1
  130. package/lib/components/molecules/index.js +0 -1
  131. package/lib/components/molecules/index.js.map +1 -1
  132. package/lib/components/organisms/AutoCompleteSearchInput/AutoCompleteSearchInput.d.ts +3 -1
  133. package/lib/components/organisms/AutoCompleteSearchInput/AutoCompleteSearchInput.js +5 -8
  134. package/lib/components/organisms/AutoCompleteSearchInput/AutoCompleteSearchInput.js.map +1 -1
  135. package/lib/components/organisms/DateInput/DateInput.js +1 -1
  136. package/lib/components/organisms/DateInput/DateInput.js.map +1 -1
  137. package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.d.ts +2 -3
  138. package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js +31 -36
  139. package/lib/components/organisms/HeaderOptionsMenu/HeaderOptionsMenu.js.map +1 -1
  140. package/lib/components/organisms/MailMessageCard/MailMessageCard.d.ts +1 -2
  141. package/lib/components/organisms/MailMessageCard/MailMessageCard.js +2 -2
  142. package/lib/components/organisms/MailMessageCard/MailMessageCard.js.map +1 -1
  143. package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.d.ts +1 -1
  144. package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.js +3 -1
  145. package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.js.map +1 -1
  146. package/lib/components/templates/AttachedFilesView/AttachedFilesView.d.ts +1 -2
  147. package/lib/components/templates/AttachedFilesView/AttachedFilesView.js +4 -2
  148. package/lib/components/templates/AttachedFilesView/AttachedFilesView.js.map +1 -1
  149. package/lib/components/templates/MailMessageView/MailMessageView.d.ts +1 -2
  150. package/lib/components/templates/MailMessageView/MailMessageView.js +38 -24
  151. package/lib/components/templates/MailMessageView/MailMessageView.js.map +1 -1
  152. package/lib/features/attachedFilesSlice.js +1 -1
  153. package/lib/features/attachedFilesSlice.js.map +1 -1
  154. package/lib/features/index.d.ts +1 -0
  155. package/lib/features/index.js +1 -0
  156. package/lib/features/index.js.map +1 -1
  157. package/lib/features/mailMessageSlice.js +1 -1
  158. package/lib/features/mailMessageSlice.js.map +1 -1
  159. package/lib/features/menuConfigSlice.js +1 -1
  160. package/lib/features/menuConfigSlice.js.map +1 -1
  161. package/lib/features/metafileSlice.js +1 -1
  162. package/lib/features/metafileSlice.js.map +1 -1
  163. package/lib/features/mobileConfigSlice.js +1 -1
  164. package/lib/features/mobileConfigSlice.js.map +1 -1
  165. package/lib/features/onlineSlice.d.ts +11 -0
  166. package/lib/features/onlineSlice.js +49 -0
  167. package/lib/features/onlineSlice.js.map +1 -0
  168. package/lib/header/HeaderActionsProvider.d.ts +15 -0
  169. package/lib/header/HeaderActionsProvider.js +60 -0
  170. package/lib/header/HeaderActionsProvider.js.map +1 -0
  171. package/lib/header/hooks.d.ts +37 -0
  172. package/lib/header/hooks.js +105 -0
  173. package/lib/header/hooks.js.map +1 -0
  174. package/lib/header/index.d.ts +3 -0
  175. package/lib/header/index.js +20 -0
  176. package/lib/header/index.js.map +1 -0
  177. package/lib/header/types.d.ts +22 -0
  178. package/lib/header/types.js +19 -0
  179. package/lib/header/types.js.map +1 -0
  180. package/lib/header/utils.d.ts +3 -0
  181. package/lib/header/utils.js +51 -0
  182. package/lib/header/utils.js.map +1 -0
  183. package/lib/hooks/use-background-function.d.ts +1 -0
  184. package/lib/hooks/use-background-function.js +35 -0
  185. package/lib/hooks/use-background-function.js.map +1 -0
  186. package/lib/hooks/use-header-registers.d.ts +1 -0
  187. package/lib/hooks/use-header-registers.js +21 -0
  188. package/lib/hooks/use-header-registers.js.map +1 -0
  189. package/lib/hooks/use-navigation.d.ts +1 -0
  190. package/lib/hooks/use-navigation.js +22 -0
  191. package/lib/hooks/use-navigation.js.map +1 -0
  192. package/lib/i18n/translations/en.json +5 -0
  193. package/lib/i18n/translations/fr.json +5 -0
  194. package/lib/index.d.ts +4 -3
  195. package/lib/index.js +4 -3
  196. package/lib/index.js.map +1 -1
  197. package/lib/models/index.d.ts +1 -0
  198. package/lib/models/index.js +19 -0
  199. package/lib/models/index.js.map +1 -0
  200. package/lib/models/objectFields.d.ts +2 -0
  201. package/lib/models/objectFields.js +30 -0
  202. package/lib/models/objectFields.js.map +1 -0
  203. package/lib/navigator/Navigator.js +17 -40
  204. package/lib/navigator/Navigator.js.map +1 -1
  205. package/lib/navigator/drawer/DrawerContent.js +24 -4
  206. package/lib/navigator/drawer/DrawerContent.js.map +1 -1
  207. package/lib/navigator/drawer/Header.d.ts +7 -0
  208. package/lib/navigator/drawer/Header.js +71 -0
  209. package/lib/navigator/drawer/Header.js.map +1 -0
  210. package/lib/navigator/module.helper.d.ts +14 -8
  211. package/lib/navigator/module.helper.js +47 -3
  212. package/lib/navigator/module.helper.js.map +1 -1
  213. package/lib/screens/AttachedFilesScreen.d.ts +1 -2
  214. package/lib/screens/AttachedFilesScreen.js +2 -2
  215. package/lib/screens/AttachedFilesScreen.js.map +1 -1
  216. package/lib/screens/MailMessageScreen.d.ts +1 -2
  217. package/lib/screens/MailMessageScreen.js +2 -2
  218. package/lib/screens/MailMessageScreen.js.map +1 -1
  219. package/package.json +5 -4
  220. package/lib/api/utils.js.map +0 -1
  221. package/lib/axios/AxiosApi.d.ts +0 -12
  222. package/lib/axios/AxiosApi.js.map +0 -1
  223. package/lib/components/molecules/IconSettings/IconSettings.d.ts +0 -4
  224. package/lib/components/molecules/IconSettings/IconSettings.js.map +0 -1
  225. /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">
@@ -35,8 +40,10 @@ This package has a few required libraries as peer dependencies:
35
40
  - [axios](https://www.npmjs.com/package/axios)
36
41
  - [i18next](https://www.npmjs.com/package/i18next)
37
42
  - [react-i18next](https://www.npmjs.com/package/react-i18next)
43
+ - [react-native-date-picker](https://www.npmjs.com/package/react-native-date-picker)
38
44
  - [react-native-datawedge-intents](https://www.npmjs.com/package/react-native-datawedge-intents)
39
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)
40
47
  - [react-native-file-viewer](https://www.npmjs.com/package/react-native-file-viewer)
41
48
  - [react-native-fs](https://www.npmjs.com/package/react-native-fs)
42
49
  - [react-native-gesture-handler](https://www.npmjs.com/package/react-native-gesture-handler)
@@ -63,6 +70,7 @@ interface Application {
63
70
  writingThemes?: Writing[]; // Additionnals writing themes
64
71
  defaultWritingTheme?: Writing; // Default writing theme for all users
65
72
  showModulesSubtitle: boolean; // Option to show subtitles of modules in the drawer menu
73
+ configuration?: appConfig; // Configuration to customize application
66
74
  }
67
75
  ```
68
76
 
@@ -71,33 +79,40 @@ Each module is based on the same interface and has the following attributes :
71
79
  ```typescript
72
80
  interface Module {
73
81
  name: string; // Module name
74
- title: string; // Module title in the drawer
75
- subtitle: string; // Module subtitle in the drawer
76
- 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
77
85
  disabled?: boolean;
78
86
  menus: {
79
87
  // List of menus of the module
80
88
  [screenKey: string]: {
81
89
  title: string;
82
90
  icon: string;
83
- screen: string;
91
+ screen: string; // Name of the main screen of this menu
84
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)
85
95
  };
86
96
  };
87
97
  screens: {
88
98
  // List of screens of the module
89
- [screenKey: string]:
90
- | React.FC<any>
91
- | {
92
- component: React.FC<any>;
93
- title: string;
94
- };
99
+ [screenKey: string]: {
100
+ component: React.FC<any>;
101
+ title: string;
102
+ options?: ScreenOptions; // screen options to activate or not shadedHeader
103
+ };
95
104
  };
96
105
  translations?: {
97
106
  // All translations of the module
98
107
  [languageKey: string]: any;
99
108
  };
100
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
+ };
101
116
  }
102
117
  ```
103
118
 
@@ -113,6 +128,28 @@ import {axiosApiProvider} from '@axelor/aos-mobile-core';
113
128
  axiosApiProvider.post({url: '...', data: {...}});
114
129
  ```
115
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
+
116
153
  ### Translations system
117
154
 
118
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:
@@ -178,6 +215,8 @@ const updateLanguage = useCallback(
178
215
  );
179
216
  ```
180
217
 
218
+ Default language of the application is 'en' but this can be modified in the application configuration file under defaultLanguage props.
219
+
181
220
  ### Helper tools
182
221
 
183
222
  This package provides several helpers such as:
@@ -234,6 +273,22 @@ const handleShowFile = async item => {
234
273
  };
235
274
  ```
236
275
 
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
+
237
292
  - Open an external app with contact informations
238
293
 
239
294
  To have the contact applications (call, email, maps, ...), just use the linkingProvider with the dedicated method:
@@ -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, interceptorId };
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;QAED,MAAM,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;YAC5D,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC;YACrB,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC;YACvC,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;QAEH,OAAO,EAAC,KAAK,EAAE,UAAU,EAAE,aAAa,EAAC,CAAC;IAC5C,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,SA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AM,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;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UA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AI,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;gBACX,MAAM,EAAE,CAAC;aACV;SACF,CAAC;aACD,IAAI,C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;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
+ }
@@ -0,0 +1,34 @@
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
+ import { getNetInfo } from '../../api/net-info-utils';
20
+ export class AosActionApi {
21
+ constructor() { }
22
+ static isOnlineAvailable = true;
23
+ async isAvailable() {
24
+ if (AosActionApi.isOnlineAvailable) {
25
+ const { isConnected } = await getNetInfo();
26
+ return isConnected;
27
+ }
28
+ return AosActionApi.isOnlineAvailable;
29
+ }
30
+ send(request) {
31
+ return axios[request.method](request.url, request.body);
32
+ }
33
+ }
34
+ //# sourceMappingURL=AosActionApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AosActionApi.js","sourceRoot":"","sources":["../../../src/apiProviders/Action/AosActionApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAIpD,MAAM,OAAO,YAAY;IACvB,gBAAe,CAAC;IAEhB,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAEhC,KAAK,CAAC,WAAW;QACf,IAAI,YAAY,CAAC,iBAAiB,EAAE;YAClC,MAAM,EAAC,WAAW,EAAC,GAAG,MAAM,UAAU,EAAE,CAAC;YACzC,OAAO,WAAW,CAAC;SACpB;QACD,OAAO,YAAY,CAAC,iBAAiB,CAAC;IACxC,CAAC;IAED,IAAI,CAAC,OAAsB;QACzB,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { ActionApi } from './ActionApiProvider';
2
+ import { ActionRequest } from './utils';
3
+ export declare class GatewayActionApi implements ActionApi {
4
+ private actionsApi;
5
+ constructor(...actionsApi: ActionApi[]);
6
+ isAvailable(): Promise<boolean>;
7
+ send(request: ActionRequest): Promise<void>;
8
+ }
@@ -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
+ function getAvailableActionApi(actionsApi) {
19
+ const actionApi = actionsApi.find(item => {
20
+ return item.isAvailable();
21
+ });
22
+ if (actionApi == null) {
23
+ throw new Error('No provider available, please check your configuration.');
24
+ }
25
+ return actionApi;
26
+ }
27
+ export class GatewayActionApi {
28
+ actionsApi;
29
+ constructor(...actionsApi) {
30
+ this.actionsApi = actionsApi;
31
+ }
32
+ isAvailable() {
33
+ const actionApi = getAvailableActionApi(this.actionsApi);
34
+ if (actionApi == null) {
35
+ throw new Error('No provider available, please check your configuration.');
36
+ }
37
+ return actionApi.isAvailable();
38
+ }
39
+ send(request) {
40
+ return getAvailableActionApi(this.actionsApi).send(request);
41
+ }
42
+ }
43
+ //# sourceMappingURL=GatewayActionApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GatewayActionApi.js","sourceRoot":"","sources":["../../../src/apiProviders/Action/GatewayActionApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,SAAS,qBAAqB,CAAC,UAAuB;IACpD,MAAM,SAAS,GAAc,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAClD,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC,CAAC,CAAC;IACH,IAAI,SAAS,IAAI,IAAI,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;KAC5E;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,OAAO,gBAAgB;IACnB,UAAU,CAAc;IAEhC,YAAY,GAAG,UAAuB;QACpC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,WAAW;QACT,MAAM,SAAS,GAAc,qBAAqB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACpE,IAAI,SAAS,IAAI,IAAI,EAAE;YACrB,MAAM,IAAI,KAAK,CACb,yDAAyD,CAC1D,CAAC;SACH;QACD,OAAO,SAAS,CAAC,WAAW,EAAE,CAAC;IACjC,CAAC;IAED,IAAI,CAAC,OAAsB;QACzB,OAAO,qBAAqB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ export { AosActionApi } from './AosActionApi';
2
+ export { GatewayActionApi } from './GatewayActionApi';
3
+ export { ActionApi } from './ActionApiProvider';
4
+ export { getActionApi, actionProvider, registerActionApi, useActionApi, } from './ActionProvider';
5
+ export { ActionRequest } from './utils';
@@ -0,0 +1,21 @@
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 { AosActionApi } from './AosActionApi';
19
+ export { GatewayActionApi } from './GatewayActionApi';
20
+ export { getActionApi, actionProvider, registerActionApi, useActionApi, } from './ActionProvider';
21
+ //# sourceMappingURL=index.js.map