@axelor/aos-mobile-core 9.0.17 → 9.0.18

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.
@@ -2,4 +2,4 @@ export { AosActionApi } from './AosActionApi';
2
2
  export { GatewayActionApi } from './GatewayActionApi';
3
3
  export { ActionApi } from './ActionApiProvider';
4
4
  export { getActionApi, actionProvider, registerActionApi, useActionApi, } from './ActionProvider';
5
- export { ActionRequest, MatcherConfig, FieldMatcher } from './utils';
5
+ export { ActionMessageType, ActionRequest, FieldMatcher, MatcherConfig, getActionMessage, } from './utils';
@@ -18,4 +18,5 @@
18
18
  export { AosActionApi } from './AosActionApi';
19
19
  export { GatewayActionApi } from './GatewayActionApi';
20
20
  export { getActionApi, actionProvider, registerActionApi, useActionApi, } from './ActionProvider';
21
+ export { getActionMessage, } from './utils';
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/apiProviders/Action/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,YAAY,GACb,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/apiProviders/Action/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EACL,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAKL,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
@@ -15,4 +15,9 @@ export type MatcherConfig = {
15
15
  export type FieldMatcher = {
16
16
  [requestFieldName: string]: string;
17
17
  };
18
+ export type ActionMessageType = 'error' | 'alert' | 'info' | 'notify';
19
+ export declare const getActionMessage: (response: any) => {
20
+ type: ActionMessageType;
21
+ message: string;
22
+ } | null;
18
23
  export {};
@@ -15,5 +15,20 @@
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
- export {};
18
+ import { checkNullString } from '@axelor/aos-mobile-ui';
19
+ const ACTION_MESSAGE_TYPES_BY_SEVERITY = [
20
+ 'error',
21
+ 'alert',
22
+ 'info',
23
+ 'notify',
24
+ ];
25
+ export const getActionMessage = (response) => {
26
+ const actionResult = response?.data?.data?.[0];
27
+ for (const type of ACTION_MESSAGE_TYPES_BY_SEVERITY) {
28
+ const message = actionResult?.[type]?.message;
29
+ if (!checkNullString(message))
30
+ return { type, message };
31
+ }
32
+ return null;
33
+ };
19
34
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/apiProviders/Action/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/apiProviders/Action/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAyBtD,MAAM,gCAAgC,GAAwB;IAC5D,OAAO;IACP,OAAO;IACP,MAAM;IACN,QAAQ;CACT,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,QAAa,EACsC,EAAE;IACrD,MAAM,YAAY,GAAG,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAE/C,KAAK,MAAM,IAAI,IAAI,gCAAgC,EAAE,CAAC;QACpD,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;QAE9C,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;YAAE,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;IACxD,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axelor/aos-mobile-core",
3
- "version": "9.0.17",
3
+ "version": "9.0.18",
4
4
  "author": "Axelor",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -29,8 +29,8 @@
29
29
  "license:add": "npx add-copyright-header --generate --dir 'src'"
30
30
  },
31
31
  "dependencies": {
32
- "@axelor/aos-mobile-error": "9.0.17",
33
- "@axelor/aos-mobile-ui": "9.0.17",
32
+ "@axelor/aos-mobile-error": "9.0.18",
33
+ "@axelor/aos-mobile-ui": "9.0.18",
34
34
  "@react-navigation/drawer": "7.7.13",
35
35
  "@react-navigation/native": "7.1.28",
36
36
  "@react-navigation/native-stack": "7.10.1",