@axelor/aos-mobile-core 9.0.10 → 9.0.12

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 (87) hide show
  1. package/lib/api/axios-init.d.ts +10 -0
  2. package/lib/api/axios-init.js +43 -0
  3. package/lib/api/axios-init.js.map +1 -0
  4. package/lib/api/index.d.ts +2 -1
  5. package/lib/api/index.js +2 -1
  6. package/lib/api/index.js.map +1 -1
  7. package/lib/api/login-api.d.ts +2 -16
  8. package/lib/api/login-api.js +13 -27
  9. package/lib/api/login-api.js.map +1 -1
  10. package/lib/apiProviders/Standard/ObjectFieldsProvider.d.ts +2 -0
  11. package/lib/apiProviders/Standard/ObjectFieldsProvider.js +17 -2
  12. package/lib/apiProviders/Standard/ObjectFieldsProvider.js.map +1 -1
  13. package/lib/apiProviders/Standard/index.d.ts +1 -1
  14. package/lib/apiProviders/Standard/index.js +1 -1
  15. package/lib/apiProviders/Standard/index.js.map +1 -1
  16. package/lib/apiProviders/Standard/requests.helper.d.ts +2 -1
  17. package/lib/apiProviders/Standard/requests.helper.js +7 -4
  18. package/lib/apiProviders/Standard/requests.helper.js.map +1 -1
  19. package/lib/components/organisms/ScannerAutocompleteSearch/ScannerAutocompleteSearch.js +8 -5
  20. package/lib/components/organisms/ScannerAutocompleteSearch/ScannerAutocompleteSearch.js.map +1 -1
  21. package/lib/features/authSlice.d.ts +51 -4
  22. package/lib/features/authSlice.js +108 -13
  23. package/lib/features/authSlice.js.map +1 -1
  24. package/lib/features/scannerSlice.d.ts +2 -0
  25. package/lib/features/scannerSlice.js +8 -2
  26. package/lib/features/scannerSlice.js.map +1 -1
  27. package/lib/hooks/use-mass-scanner.js +6 -4
  28. package/lib/hooks/use-mass-scanner.js.map +1 -1
  29. package/lib/hooks/use-scan-activator.d.ts +1 -1
  30. package/lib/hooks/use-scan-activator.js +4 -4
  31. package/lib/hooks/use-scan-activator.js.map +1 -1
  32. package/lib/i18n/translations/en.json +17 -0
  33. package/lib/i18n/translations/fr.json +17 -0
  34. package/lib/navigator/components/DrawerContent.d.ts +1 -1
  35. package/lib/navigator/components/DrawerContent.js +16 -7
  36. package/lib/navigator/components/DrawerContent.js.map +1 -1
  37. package/lib/navigator/components/menu/Menu.d.ts +4 -2
  38. package/lib/navigator/components/menu/Menu.js +8 -2
  39. package/lib/navigator/components/menu/Menu.js.map +1 -1
  40. package/lib/navigator/helpers/index.d.ts +1 -1
  41. package/lib/navigator/helpers/index.js +1 -1
  42. package/lib/navigator/helpers/index.js.map +1 -1
  43. package/lib/navigator/helpers/menu.helper.d.ts +5 -4
  44. package/lib/navigator/helpers/menu.helper.js +17 -6
  45. package/lib/navigator/helpers/menu.helper.js.map +1 -1
  46. package/lib/screens/LoginScreen.js +2 -1
  47. package/lib/screens/LoginScreen.js.map +1 -1
  48. package/lib/screens/SessionManagementScreen.js +2 -1
  49. package/lib/screens/SessionManagementScreen.js.map +1 -1
  50. package/lib/sessions/components/alerts/MfaVerificationPopup.d.ts +3 -0
  51. package/lib/sessions/components/alerts/MfaVerificationPopup.js +136 -0
  52. package/lib/sessions/components/alerts/MfaVerificationPopup.js.map +1 -0
  53. package/lib/sessions/components/alerts/index.d.ts +1 -0
  54. package/lib/sessions/components/alerts/index.js +1 -0
  55. package/lib/sessions/components/alerts/index.js.map +1 -1
  56. package/lib/sessions/components/inputs/MfaCodeInput.d.ts +10 -0
  57. package/lib/sessions/components/inputs/MfaCodeInput.js +38 -0
  58. package/lib/sessions/components/inputs/MfaCodeInput.js.map +1 -0
  59. package/lib/sessions/components/inputs/index.d.ts +1 -0
  60. package/lib/sessions/components/inputs/index.js +1 -0
  61. package/lib/sessions/components/inputs/index.js.map +1 -1
  62. package/lib/sessions/index.d.ts +1 -0
  63. package/lib/sessions/index.js +1 -0
  64. package/lib/sessions/index.js.map +1 -1
  65. package/lib/sessions/mfa/api.d.ts +7 -0
  66. package/lib/sessions/mfa/api.js +71 -0
  67. package/lib/sessions/mfa/api.js.map +1 -0
  68. package/lib/sessions/mfa/errors.d.ts +14 -0
  69. package/lib/sessions/mfa/errors.js +36 -0
  70. package/lib/sessions/mfa/errors.js.map +1 -0
  71. package/lib/sessions/mfa/index.d.ts +6 -0
  72. package/lib/sessions/mfa/index.js +23 -0
  73. package/lib/sessions/mfa/index.js.map +1 -0
  74. package/lib/sessions/mfa/type.d.ts +34 -0
  75. package/lib/sessions/mfa/type.js +35 -0
  76. package/lib/sessions/mfa/type.js.map +1 -0
  77. package/lib/sessions/mfa/use-email-code.d.ts +14 -0
  78. package/lib/sessions/mfa/use-email-code.js +74 -0
  79. package/lib/sessions/mfa/use-email-code.js.map +1 -0
  80. package/lib/sessions/mfa/utils.d.ts +7 -0
  81. package/lib/sessions/mfa/utils.js +60 -0
  82. package/lib/sessions/mfa/utils.js.map +1 -0
  83. package/lib/utils/object.d.ts +1 -1
  84. package/lib/utils/string.d.ts +3 -3
  85. package/lib/utils/string.js +5 -7
  86. package/lib/utils/string.js.map +1 -1
  87. package/package.json +8 -8
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2026 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 class MfaVerifyError extends Error {
19
+ code;
20
+ constructor(code, message) {
21
+ super(message ?? code);
22
+ this.code = code;
23
+ }
24
+ }
25
+ export class MfaEmailError extends Error {
26
+ code;
27
+ emailRetryAfter;
28
+ serverMessage;
29
+ constructor(code, { emailRetryAfter, serverMessage, } = {}) {
30
+ super(serverMessage ?? code);
31
+ this.code = code;
32
+ this.emailRetryAfter = emailRetryAfter;
33
+ this.serverMessage = serverMessage;
34
+ }
35
+ }
36
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/sessions/mfa/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,IAAI,CAAqB;IAEzB,YAAY,IAAwB,EAAE,OAAgB;QACpD,KAAK,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,IAAI,CAAoB;IACxB,eAAe,CAAU;IACzB,aAAa,CAAU;IAEvB,YACE,IAAuB,EACvB,EACE,eAAe,EACf,aAAa,MACyC,EAAE;QAE1D,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ export * from './api';
2
+ export * from './errors';
3
+ export * from './type';
4
+ export * from './utils';
5
+ export { useEmailCode } from './use-email-code';
6
+ export type { EmailAlert } from './use-email-code';
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2026 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 * from './api';
19
+ export * from './errors';
20
+ export * from './type';
21
+ export * from './utils';
22
+ export { useEmailCode } from './use-email-code';
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sessions/mfa/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,34 @@
1
+ export declare enum MfaMethod {
2
+ TOTP = "TOTP",
3
+ EMAIL = "EMAIL",
4
+ RECOVERY = "RECOVERY"
5
+ }
6
+ export declare enum MfaVerifyErrorCode {
7
+ INVALID_CODE = "MFA_INVALID_CODE",
8
+ SESSION_LOST = "MFA_SESSION_LOST"
9
+ }
10
+ export declare enum MfaEmailErrorCode {
11
+ TOO_MANY_REQUESTS = "MFA_EMAIL_TOO_MANY_REQUESTS",
12
+ FORBIDDEN = "MFA_EMAIL_FORBIDDEN",
13
+ FAILED = "MFA_EMAIL_FAILED"
14
+ }
15
+ export interface MfaChallenge {
16
+ methods: MfaMethod[];
17
+ username: string;
18
+ emailRetryAfter?: string;
19
+ }
20
+ export interface SessionResult {
21
+ kind: 'session';
22
+ token: string;
23
+ jsessionId: string | undefined;
24
+ requestInterceptorId: number;
25
+ responseInterceptorId: number;
26
+ }
27
+ export interface MfaResult extends MfaChallenge {
28
+ kind: 'mfa';
29
+ }
30
+ export type LoginResult = SessionResult | MfaResult;
31
+ export interface EmailCodeResponse {
32
+ message?: string;
33
+ emailRetryAfter?: string;
34
+ }
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2026 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 var MfaMethod;
19
+ (function (MfaMethod) {
20
+ MfaMethod["TOTP"] = "TOTP";
21
+ MfaMethod["EMAIL"] = "EMAIL";
22
+ MfaMethod["RECOVERY"] = "RECOVERY";
23
+ })(MfaMethod || (MfaMethod = {}));
24
+ export var MfaVerifyErrorCode;
25
+ (function (MfaVerifyErrorCode) {
26
+ MfaVerifyErrorCode["INVALID_CODE"] = "MFA_INVALID_CODE";
27
+ MfaVerifyErrorCode["SESSION_LOST"] = "MFA_SESSION_LOST";
28
+ })(MfaVerifyErrorCode || (MfaVerifyErrorCode = {}));
29
+ export var MfaEmailErrorCode;
30
+ (function (MfaEmailErrorCode) {
31
+ MfaEmailErrorCode["TOO_MANY_REQUESTS"] = "MFA_EMAIL_TOO_MANY_REQUESTS";
32
+ MfaEmailErrorCode["FORBIDDEN"] = "MFA_EMAIL_FORBIDDEN";
33
+ MfaEmailErrorCode["FAILED"] = "MFA_EMAIL_FAILED";
34
+ })(MfaEmailErrorCode || (MfaEmailErrorCode = {}));
35
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../../src/sessions/mfa/type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,0BAAa,CAAA;IACb,4BAAe,CAAA;IACf,kCAAqB,CAAA;AACvB,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAED,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,uDAAiC,CAAA;IACjC,uDAAiC,CAAA;AACnC,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B;AAED,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,sEAAiD,CAAA;IACjD,sDAAiC,CAAA;IACjC,gDAA2B,CAAA;AAC7B,CAAC,EAJW,iBAAiB,KAAjB,iBAAiB,QAI5B"}
@@ -0,0 +1,14 @@
1
+ export type EmailAlert = {
2
+ type: 'success' | 'danger';
3
+ message: string;
4
+ };
5
+ export declare function useEmailCode({ baseUrl, username, initialRetryAfter, }: {
6
+ baseUrl?: string;
7
+ username: string;
8
+ initialRetryAfter?: string;
9
+ }): {
10
+ retryCount: number;
11
+ alert: EmailAlert;
12
+ send: () => Promise<void>;
13
+ reset: () => void;
14
+ };
@@ -0,0 +1,74 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2026 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 { useCallback, useEffect, useMemo, useState } from 'react';
19
+ import { cancelMfa } from '../../features/authSlice';
20
+ import { useDispatch } from '../../redux/hooks';
21
+ import { useTranslator } from '../../i18n';
22
+ import { sendEmailVerificationCode } from './api';
23
+ import { computeRetryCount } from './utils';
24
+ import { MfaEmailErrorCode } from './type';
25
+ import { MfaEmailError } from './errors';
26
+ export function useEmailCode({ baseUrl, username, initialRetryAfter, }) {
27
+ const dispatch = useDispatch();
28
+ const I18n = useTranslator();
29
+ const [alert, setAlert] = useState(null);
30
+ const [retryCount, setRetryCount] = useState(() => computeRetryCount(initialRetryAfter));
31
+ useEffect(() => {
32
+ setRetryCount(computeRetryCount(initialRetryAfter));
33
+ }, [initialRetryAfter]);
34
+ useEffect(() => {
35
+ if (retryCount <= 0)
36
+ return;
37
+ const timer = setTimeout(() => setRetryCount(c => Math.max(0, c - 1)), 1000);
38
+ return () => clearTimeout(timer);
39
+ }, [retryCount]);
40
+ const send = useCallback(async () => {
41
+ if (!baseUrl || !username || retryCount > 0)
42
+ return;
43
+ try {
44
+ const result = await sendEmailVerificationCode(baseUrl, username);
45
+ if (result.emailRetryAfter) {
46
+ setRetryCount(computeRetryCount(result.emailRetryAfter));
47
+ }
48
+ setAlert({
49
+ type: 'success',
50
+ message: result.message ?? I18n.t('Auth_MFA_EmailSent'),
51
+ });
52
+ }
53
+ catch (e) {
54
+ if (!(e instanceof MfaEmailError)) {
55
+ setAlert({ type: 'danger', message: I18n.t('Auth_MFA_GenericError') });
56
+ return;
57
+ }
58
+ if (e.code === MfaEmailErrorCode.FORBIDDEN) {
59
+ dispatch(cancelMfa());
60
+ return;
61
+ }
62
+ if (e.code === MfaEmailErrorCode.TOO_MANY_REQUESTS && e.emailRetryAfter) {
63
+ setRetryCount(computeRetryCount(e.emailRetryAfter));
64
+ }
65
+ setAlert({
66
+ type: 'danger',
67
+ message: e.serverMessage ?? I18n.t('Auth_MFA_GenericError'),
68
+ });
69
+ }
70
+ }, [I18n, baseUrl, dispatch, retryCount, username]);
71
+ const reset = useCallback(() => setAlert(null), []);
72
+ return useMemo(() => ({ retryCount, alert, send, reset }), [alert, reset, retryCount, send]);
73
+ }
74
+ //# sourceMappingURL=use-email-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-email-code.js","sour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P,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,CAAC,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,uBAAuB,CAAC;aAC5D,CAAC,CAAC;QACL,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEpD,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAEpD,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC,EAAC,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAC,CAAC,EACxC,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,CACjC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { MfaMethod } from './type';
2
+ export declare const MFA_SUPPORTED_METHODS: MfaMethod[];
3
+ export declare const isMfaRouteResponse: (data: any) => boolean;
4
+ export declare const computeRetryCount: (retryAfter?: string | null) => number;
5
+ export declare const getMfaDescriptionKey: (method?: MfaMethod) => string;
6
+ export declare const getMfaMethodLabelKey: (method: MfaMethod) => string;
7
+ export declare const getMfaPlaceholderKey: (method?: MfaMethod) => string;
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Axelor Business Solutions
3
+ *
4
+ * Copyright (C) 2026 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 { MfaMethod } from './type';
19
+ export const MFA_SUPPORTED_METHODS = [
20
+ MfaMethod.TOTP,
21
+ MfaMethod.EMAIL,
22
+ ];
23
+ export const isMfaRouteResponse = (data) => data?.route?.path === '/mfa';
24
+ export const computeRetryCount = (retryAfter) => {
25
+ if (!retryAfter)
26
+ return -1;
27
+ const diff = Math.floor((new Date(retryAfter).getTime() - Date.now()) / 1000);
28
+ return diff > 0 ? diff : 0;
29
+ };
30
+ export const getMfaDescriptionKey = (method) => {
31
+ switch (method) {
32
+ case MfaMethod.TOTP:
33
+ return 'Auth_MFA_TOTP_Description';
34
+ case MfaMethod.EMAIL:
35
+ return 'Auth_MFA_EMAIL_Description';
36
+ default:
37
+ return '';
38
+ }
39
+ };
40
+ export const getMfaMethodLabelKey = (method) => {
41
+ switch (method) {
42
+ case MfaMethod.TOTP:
43
+ return 'Auth_MFA_TOTP_Method';
44
+ case MfaMethod.EMAIL:
45
+ return 'Auth_MFA_EMAIL_Method';
46
+ default:
47
+ return '';
48
+ }
49
+ };
50
+ export const getMfaPlaceholderKey = (method) => {
51
+ switch (method) {
52
+ case MfaMethod.TOTP:
53
+ return 'Auth_MFA_TOTP_Placeholder';
54
+ case MfaMethod.EMAIL:
55
+ return 'Auth_MFA_EMAIL_Placeholder';
56
+ default:
57
+ return 'Auth_MFA_VerificationCode';
58
+ }
59
+ };
60
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/sessions/mfa/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AAEjC,MAAM,CAAC,MAAM,qBAAqB,GAAgB;IAChD,SAAS,CAAC,IAAI;IACd,SAAS,CAAC,KAAK;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAS,EAAW,EAAE,CACvD,IAAI,EAAE,KAAK,EA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
- export declare function areObjectsEquals(object1: any, object2: any): any;
1
+ export declare function areObjectsEquals(object1: any, object2: any): boolean;
2
2
  export declare const isEmpty: (obj: any) => boolean;
3
3
  export declare function fetchJsonField(object: any, fieldName: string): any;
4
4
  export declare function pickFieldsOfObject(object: any, fields: any): any;
@@ -1,5 +1,5 @@
1
- export declare function splitInTwo(value: String, spacer?: string): Array<String>;
1
+ export declare function splitInTwo(value: String, spacer?: string): Array<String> | undefined;
2
2
  export declare function isHtml(value: string): boolean;
3
- export declare function stringNoAccent(message: any): any;
3
+ export declare function stringNoAccent(message?: string): string;
4
4
  export declare function checkNullString(message: any): boolean;
5
- export declare function formatVersionString(version: string): number;
5
+ export declare function formatVersionString(version?: string): number | undefined;
@@ -16,16 +16,14 @@
16
16
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
18
  export function splitInTwo(value, spacer = '.') {
19
- if (value == null) {
20
- return null;
21
- }
19
+ if (value == null)
20
+ return undefined;
22
21
  return value.toString().split(spacer);
23
22
  }
24
23
  export function isHtml(value) {
25
24
  const regex = /<\/?[a-z][\s\S]*>/i;
26
- if (value == null) {
27
- return null;
28
- }
25
+ if (value == null)
26
+ return false;
29
27
  return regex.test(value);
30
28
  }
31
29
  export function stringNoAccent(message) {
@@ -53,7 +51,7 @@ export function checkNullString(message) {
53
51
  }
54
52
  export function formatVersionString(version) {
55
53
  if (typeof version !== 'string') {
56
- return null;
54
+ return undefined;
57
55
  }
58
56
  const vparts = version.split('.');
59
57
  let result = '';
@@ -1 +1 @@
1
- {"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/utils/string.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,MAAM,GAAG,GAAG;IACpD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,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AC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,oBAAoB,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;IAE/C,IAAI,oBAAoB,GAAG,CAAC,EAAE,CAAC;QAC7B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,oBAAoB,EAAE,KAAK,EAAE,EAAE,CAAC;YAC1D,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;AAC5B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axelor/aos-mobile-core",
3
- "version": "9.0.10",
3
+ "version": "9.0.12",
4
4
  "author": "Axelor",
5
5
  "license": "AGPL-3.0-only",
6
6
  "publishConfig": {
@@ -24,8 +24,8 @@
24
24
  "license:add": "npx add-copyright-header --generate --dir 'src'"
25
25
  },
26
26
  "dependencies": {
27
- "@axelor/aos-mobile-error": "9.0.10",
28
- "@axelor/aos-mobile-ui": "9.0.10",
27
+ "@axelor/aos-mobile-error": "9.0.12",
28
+ "@axelor/aos-mobile-ui": "9.0.12",
29
29
  "@react-navigation/drawer": "7.7.13",
30
30
  "@react-navigation/native": "7.1.28",
31
31
  "@react-navigation/native-stack": "7.10.1",
@@ -47,7 +47,7 @@
47
47
  "@react-native-clipboard/clipboard": "1.16.3",
48
48
  "@react-native-documents/picker": "12.0.0",
49
49
  "react": "19.2.0",
50
- "react-native": "0.83.1",
50
+ "react-native": "0.83.9",
51
51
  "react-native-blob-util": "0.24.6",
52
52
  "react-native-contacts": "8.0.7",
53
53
  "react-native-datawedge-intents": "^0.1.8",
@@ -69,15 +69,15 @@
69
69
  "@babel/runtime": "^7.25.0",
70
70
  "@react-native-clipboard/clipboard": "1.16.3",
71
71
  "@react-native-documents/picker": "12.0.0",
72
- "@react-native/babel-preset": "0.83.1",
73
- "@react-native/eslint-config": "0.83.1",
74
- "@react-native/typescript-config": "0.83.1",
72
+ "@react-native/babel-preset": "0.83.9",
73
+ "@react-native/eslint-config": "0.83.9",
74
+ "@react-native/typescript-config": "0.83.9",
75
75
  "@types/react": "^19.2.0",
76
76
  "cpx2": "^4.2.0",
77
77
  "eslint": "8.57.0",
78
78
  "prettier": "^3.3.3",
79
79
  "react": "19.2.0",
80
- "react-native": "0.83.1",
80
+ "react-native": "0.83.9",
81
81
  "react-native-blob-util": "0.24.6",
82
82
  "react-native-datawedge-intents": "^0.1.8",
83
83
  "react-native-date-picker": "5.0.13",