@axelor/aos-mobile-core 6.4.1 → 6.4.3
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.
- package/README.md +24 -18
- package/lib/api/login-api.d.ts +2 -0
- package/lib/api/login-api.js +4 -2
- package/lib/api/login-api.js.map +1 -1
- package/lib/api/metafile-api.d.ts +6 -0
- package/lib/api/metafile-api.js +33 -0
- package/lib/api/metafile-api.js.map +1 -1
- package/lib/api/utils.js +9 -10
- package/lib/api/utils.js.map +1 -1
- package/lib/app/Application.d.ts +17 -2
- package/lib/app/Application.js +6 -3
- package/lib/app/Application.js.map +1 -1
- package/lib/app/ContextedApplication.d.ts +15 -1
- package/lib/app/ContextedApplication.js +2 -2
- package/lib/app/ContextedApplication.js.map +1 -1
- package/lib/app/ContextsProvider.d.ts +2 -1
- package/lib/app/ContextsProvider.js +9 -4
- package/lib/app/ContextsProvider.js.map +1 -1
- package/lib/app/Module.d.ts +9 -6
- package/lib/app/RootNavigator.d.ts +2 -1
- package/lib/app/RootNavigator.js +6 -2
- package/lib/app/RootNavigator.js.map +1 -1
- package/lib/auth/features/companySlice.js +1 -1
- package/lib/auth/features/companySlice.js.map +1 -1
- package/lib/auth/features/configSlice.js +2 -2
- package/lib/auth/features/configSlice.js.map +1 -1
- package/lib/auth/features/languageSlice.js +1 -1
- package/lib/auth/features/languageSlice.js.map +1 -1
- package/lib/auth/features/userSlice.js +2 -2
- package/lib/auth/features/userSlice.js.map +1 -1
- package/lib/auth/i18n/en.json +7 -1
- package/lib/auth/i18n/fr.json +7 -1
- package/lib/auth/screens/SettingsScreen.d.ts +2 -1
- package/lib/auth/screens/SettingsScreen.js +19 -5
- package/lib/auth/screens/SettingsScreen.js.map +1 -1
- package/lib/components/external/CodeHighlighter/CodeHighlighter.d.ts +9 -0
- package/lib/components/external/CodeHighlighter/CodeHighlighter.js +30 -0
- package/lib/components/external/CodeHighlighter/CodeHighlighter.js.map +1 -0
- package/lib/components/external/CodeHighlighter/code-highlighter.helper.d.ts +39 -0
- package/lib/components/external/CodeHighlighter/code-highlighter.helper.js +60 -0
- package/lib/components/external/CodeHighlighter/code-highlighter.helper.js.map +1 -0
- package/lib/components/external/PlanningView/PlanningView.d.ts +5 -4
- package/lib/components/external/PlanningView/PlanningView.js +58 -12
- package/lib/components/external/PlanningView/PlanningView.js.map +1 -1
- package/lib/components/external/PlanningView/agenda.helpers.d.ts +15 -2
- package/lib/components/external/PlanningView/agenda.helpers.js +69 -9
- package/lib/components/external/PlanningView/agenda.helpers.js.map +1 -1
- package/lib/components/external/Scanner/Scanner.js +10 -6
- package/lib/components/external/Scanner/Scanner.js.map +1 -1
- package/lib/components/external/index.d.ts +2 -0
- package/lib/components/external/index.js +2 -0
- package/lib/components/external/index.js.map +1 -1
- package/lib/components/molecules/DatePicker/DatePicker.d.ts +8 -0
- package/lib/components/molecules/DatePicker/DatePicker.js +33 -0
- package/lib/components/molecules/DatePicker/DatePicker.js.map +1 -0
- package/lib/components/molecules/ErrorText/ErrorText.d.ts +2 -2
- package/lib/components/molecules/ErrorText/ErrorText.js +53 -7
- package/lib/components/molecules/ErrorText/ErrorText.js.map +1 -1
- package/lib/components/molecules/InputBarCodeCard/InputBarCodeCard.d.ts +3 -1
- package/lib/components/molecules/InputBarCodeCard/InputBarCodeCard.js +18 -33
- package/lib/components/molecules/InputBarCodeCard/InputBarCodeCard.js.map +1 -1
- package/lib/components/molecules/LoginButton/LoginButton.d.ts +2 -1
- package/lib/components/molecules/LoginButton/LoginButton.js +4 -3
- package/lib/components/molecules/LoginButton/LoginButton.js.map +1 -1
- package/lib/components/molecules/UploadFileInput/UploadFileInput.d.ts +6 -0
- package/lib/components/molecules/UploadFileInput/UploadFileInput.js +71 -0
- package/lib/components/molecules/UploadFileInput/UploadFileInput.js.map +1 -0
- package/lib/components/molecules/index.d.ts +2 -0
- package/lib/components/molecules/index.js +2 -0
- package/lib/components/molecules/index.js.map +1 -1
- package/lib/components/organisms/AutoCompleteSearchInput/AutoCompleteSearchInput.d.ts +17 -0
- package/lib/components/organisms/AutoCompleteSearchInput/AutoCompleteSearchInput.js +61 -0
- package/lib/components/organisms/AutoCompleteSearchInput/AutoCompleteSearchInput.js.map +1 -0
- package/lib/components/organisms/DateInput/DateInput.d.ts +11 -0
- package/lib/components/organisms/DateInput/DateInput.js +137 -0
- package/lib/components/organisms/DateInput/DateInput.js.map +1 -0
- package/lib/components/organisms/DateInput/date-input.helper.d.ts +17 -0
- package/lib/components/organisms/DateInput/date-input.helper.js +63 -0
- package/lib/components/organisms/DateInput/date-input.helper.js.map +1 -0
- package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.js +6 -9
- package/lib/components/organisms/MailMessageCommentCard/MailMessageCommentCard.js.map +1 -1
- package/lib/components/organisms/PasswordInput/PasswordInput.js +1 -1
- package/lib/components/organisms/PasswordInput/PasswordInput.js.map +1 -1
- package/lib/components/organisms/ScannerAutocompleteSearch/ScannerAutocompleteSearch.d.ts +2 -1
- package/lib/components/organisms/ScannerAutocompleteSearch/ScannerAutocompleteSearch.js +13 -13
- package/lib/components/organisms/ScannerAutocompleteSearch/ScannerAutocompleteSearch.js.map +1 -1
- package/lib/components/organisms/UrlInput/UrlInput.js +1 -1
- package/lib/components/organisms/UrlInput/UrlInput.js.map +1 -1
- package/lib/components/organisms/UsernameInput/UsernameInput.d.ts +5 -1
- package/lib/components/organisms/UsernameInput/UsernameInput.js +10 -3
- package/lib/components/organisms/UsernameInput/UsernameInput.js.map +1 -1
- package/lib/components/organisms/index.d.ts +2 -0
- package/lib/components/organisms/index.js +2 -0
- package/lib/components/organisms/index.js.map +1 -1
- package/lib/components/templates/AttachedFilesView/AttachedFilesView.js +14 -20
- package/lib/components/templates/AttachedFilesView/AttachedFilesView.js.map +1 -1
- package/lib/components/templates/MailMessageView/MailMessageView.js +2 -2
- package/lib/components/templates/MailMessageView/MailMessageView.js.map +1 -1
- package/lib/features/attachedFilesSlice.js +3 -3
- package/lib/features/attachedFilesSlice.js.map +1 -1
- package/lib/features/authSlice.d.ts +28 -13
- package/lib/features/authSlice.js +38 -10
- package/lib/features/authSlice.js.map +1 -1
- package/lib/features/mailMessageSlice.js +10 -10
- package/lib/features/mailMessageSlice.js.map +1 -1
- package/lib/features/menuConfigSlice.js +1 -1
- package/lib/features/menuConfigSlice.js.map +1 -1
- package/lib/features/metafileSlice.js +1 -1
- package/lib/features/metafileSlice.js.map +1 -1
- package/lib/features/mobileConfigSlice.js +1 -1
- package/lib/features/mobileConfigSlice.js.map +1 -1
- package/lib/hooks/use-scan-activator.d.ts +9 -0
- package/lib/hooks/use-scan-activator.js +60 -0
- package/lib/hooks/use-scan-activator.js.map +1 -0
- package/lib/i18n/component/Translator.d.ts +3 -1
- package/lib/i18n/helpers/langages.d.ts +7 -3
- package/lib/i18n/helpers/langages.js.map +1 -1
- package/lib/i18n/i18n.d.ts +4 -3
- package/lib/i18n/i18n.js +5 -5
- package/lib/i18n/i18n.js.map +1 -1
- package/lib/i18n/translations/en.json +26 -1
- package/lib/i18n/translations/fr.json +26 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/middlewares/index.d.ts +1 -0
- package/lib/middlewares/index.js +19 -0
- package/lib/middlewares/index.js.map +1 -0
- package/lib/middlewares/translation.d.ts +2 -0
- package/lib/middlewares/translation.js +48 -0
- package/lib/middlewares/translation.js.map +1 -0
- package/lib/screens/LoginScreen.js +53 -13
- package/lib/screens/LoginScreen.js.map +1 -1
- package/lib/storage/Storage.d.ts +5 -1
- package/lib/storage/Storage.js +7 -1
- package/lib/storage/Storage.js.map +1 -1
- package/lib/tools/FilePicker.d.ts +1 -0
- package/lib/tools/FilePicker.js +42 -0
- package/lib/tools/FilePicker.js.map +1 -0
- package/lib/utils/api.d.ts +2 -0
- package/lib/utils/api.js +47 -0
- package/lib/utils/api.js.map +1 -0
- package/lib/utils/date.d.ts +3 -0
- package/lib/utils/date.js +16 -0
- package/lib/utils/date.js.map +1 -1
- package/lib/utils/filter.d.ts +9 -0
- package/lib/utils/filter.js +31 -0
- package/lib/utils/filter.js.map +1 -0
- package/lib/utils/formatters.d.ts +1 -0
- package/lib/utils/formatters.js +24 -0
- package/lib/utils/formatters.js.map +1 -1
- package/lib/utils/index.d.ts +6 -5
- package/lib/utils/index.js +6 -5
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/object.d.ts +4 -0
- package/lib/utils/object.js +26 -2
- package/lib/utils/object.js.map +1 -1
- package/lib/utils/storage-keys.d.ts +1 -0
- package/lib/utils/storage-keys.js +19 -0
- package/lib/utils/storage-keys.js.map +1 -0
- package/lib/utils/string.d.ts +1 -1
- package/lib/utils/string.js +1 -1
- package/lib/utils/string.js.map +1 -1
- package/package.json +12 -5
|
@@ -23,11 +23,16 @@
|
|
|
23
23
|
"Base_Add": "Add",
|
|
24
24
|
"Base_Check": "Check",
|
|
25
25
|
"Base_Start": "Start",
|
|
26
|
+
"Base_Pause": "Pause",
|
|
27
|
+
"Base_Finish": "Finish",
|
|
28
|
+
"Base_Continue": "Continue",
|
|
26
29
|
"Base_Complete": "Complete",
|
|
27
30
|
"Base_Confirm": "Confirm",
|
|
31
|
+
"Base_Declare": "Declare",
|
|
28
32
|
"Base_Cancel": "Cancel",
|
|
29
33
|
"Base_Content": "Content",
|
|
30
34
|
"Base_ViewAll": "View all",
|
|
35
|
+
"Base_ChooseFile": "Choose a file",
|
|
31
36
|
"Base_NoAppConfigured": "No module configured on your application, please contact an administrator.",
|
|
32
37
|
"Base_Unknown": "Unknown",
|
|
33
38
|
"Base_Next": "Next",
|
|
@@ -51,5 +56,25 @@
|
|
|
51
56
|
"Stopwatch_TimerFormat": "mm:ss",
|
|
52
57
|
"Base_Information": "Information",
|
|
53
58
|
"Base_Refresh": "Refresh application",
|
|
54
|
-
"Base_Logout": "Log out"
|
|
59
|
+
"Base_Logout": "Log out",
|
|
60
|
+
"Base_TimeFormat": "HH:mm",
|
|
61
|
+
"Base_ConnectedOn": "Connected on",
|
|
62
|
+
"Base_Error": "Error",
|
|
63
|
+
"Base_Success": "Success",
|
|
64
|
+
"Base_Failed_To": "Failed to",
|
|
65
|
+
"Auth_WrongPasswordOrUserName": "Wrong username or password",
|
|
66
|
+
"Auth_InvalidUrl": "Invalid url",
|
|
67
|
+
"Base_SliceAction_FetchAttachedFiles": "fetch attached files",
|
|
68
|
+
"Base_SliceAction_FetchFilesDetails": "fetch file details",
|
|
69
|
+
"Base_SliceAction_CountAttachedFiles": "count attachment files",
|
|
70
|
+
"Base_SliceAction_FetchMailMessages": "fetch mail messages",
|
|
71
|
+
"Base_SliceAction_PostMailMessageComment": "post mail message comment",
|
|
72
|
+
"Base_SliceAction_FetchModelSubscribers": "fetch model subscribers",
|
|
73
|
+
"Base_SliceAction_SubscribeToModel": "subscribe to model",
|
|
74
|
+
"Base_SliceAction_UnsubscribeFromModel": "unsubscribe from model",
|
|
75
|
+
"Base_SliceAction_CountUnreadMailMessages": "count unread mail messages",
|
|
76
|
+
"Base_SliceAction_MarkMailMessageAsRead": "mark mail message as read",
|
|
77
|
+
"Base_SliceAction_MarkAllMailMessageAsRead": "mark all mail messages as read",
|
|
78
|
+
"Base_SliceAction_FetchMenuConfig": "fetch menu config",
|
|
79
|
+
"Base_SliceAction_FetchMobileConfig": "fetch mobile config"
|
|
55
80
|
}
|
|
@@ -23,11 +23,16 @@
|
|
|
23
23
|
"Base_Add": "Ajouter",
|
|
24
24
|
"Base_Check": "Vérifier",
|
|
25
25
|
"Base_Start": "Commencer",
|
|
26
|
+
"Base_Pause": "Mettre en pause",
|
|
27
|
+
"Base_Finish": "Terminer",
|
|
28
|
+
"Base_Continue": "Continuer",
|
|
26
29
|
"Base_Complete": "Terminer",
|
|
27
30
|
"Base_Confirm": "Confirmer",
|
|
31
|
+
"Base_Declare": "Déclarer",
|
|
28
32
|
"Base_Cancel": "Annuler",
|
|
29
33
|
"Base_Content": "Contenu",
|
|
30
34
|
"Base_ViewAll": "Tout voir",
|
|
35
|
+
"Base_ChooseFile": "Choisir un fichier",
|
|
31
36
|
"Base_NoAppConfigured": "Votre application n'est pas configurée, merci de contacter un administrateur.",
|
|
32
37
|
"Base_Unknown": "Inconnue",
|
|
33
38
|
"Base_Next": "Suivant",
|
|
@@ -51,5 +56,25 @@
|
|
|
51
56
|
"Stopwatch_TimerFormat": "mm:ss",
|
|
52
57
|
"Base_Information": "Information",
|
|
53
58
|
"Base_Refresh": "Actualiser l'application",
|
|
54
|
-
"Base_Logout": "Déconnexion"
|
|
59
|
+
"Base_Logout": "Déconnexion",
|
|
60
|
+
"Base_TimeFormat": "HH:mm",
|
|
61
|
+
"Base_ConnectedOn": "Connecté à",
|
|
62
|
+
"Base_Error": "Erreur",
|
|
63
|
+
"Base_Success": "Succès",
|
|
64
|
+
"Base_Failed_To": "N'a pas réussi à effectuer l'action :",
|
|
65
|
+
"Auth_WrongPasswordOrUserName": "Mauvais nom d'utilisateur ou mot de passe",
|
|
66
|
+
"Auth_InvalidUrl": "Url non valide",
|
|
67
|
+
"Base_SliceAction_FetchAttachedFiles": "récupération des fichiers joints",
|
|
68
|
+
"Base_SliceAction_FetchFilesDetails": "récupération des détails du fichier",
|
|
69
|
+
"Base_SliceAction_CountAttachedFiles": "comptage des fichiers joints",
|
|
70
|
+
"Base_SliceAction_FetchMailMessages": "récupération des mail messages",
|
|
71
|
+
"Base_SliceAction_PostMailMessageComment": "ajout d'un mail message",
|
|
72
|
+
"Base_SliceAction_FetchModelSubscribers": "récupération des abonnés du modèle",
|
|
73
|
+
"Base_SliceAction_SubscribeToModel": "abonnement au modèle",
|
|
74
|
+
"Base_SliceAction_UnsubscribeFromModel": "désabonnement au modèle",
|
|
75
|
+
"Base_SliceAction_CountUnreadMailMessages": "comptage des mail messages non lus",
|
|
76
|
+
"Base_SliceAction_MarkMailMessageAsRead": "marquer le message comme lu",
|
|
77
|
+
"Base_SliceAction_MarkAllMailMessageAsRead": "marquer tous les messages comme lus",
|
|
78
|
+
"Base_SliceAction_FetchMenuConfig": "récupération des configs de menus",
|
|
79
|
+
"Base_SliceAction_FetchMobileConfig": "récupération des configs mobile"
|
|
55
80
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './app';
|
|
2
2
|
export { default as Navigator } from './navigator/Navigator';
|
|
3
3
|
export { configGlobalStore } from './redux/store';
|
|
4
|
-
export { storage, useStorage } from './storage/Storage';
|
|
4
|
+
export { storage, Storage, useStorage } from './storage/Storage';
|
|
5
5
|
export { traceError } from './api/traceback-api';
|
|
6
6
|
export { useEffectDebugger } from './hooks/use-effect-debugger';
|
|
7
7
|
export { logout } from './features/authSlice';
|
|
@@ -9,6 +9,7 @@ export { axiosApiProvider } from './axios/AxiosApi';
|
|
|
9
9
|
export { getApiResponseData, getFirstData, handlerApiCall, handlerError, } from './api/utils';
|
|
10
10
|
export { useScannedValueByKey, useScannerSelector, enableScan, scanValue, disableScan, default as scannerReducer, } from './features/scannerSlice';
|
|
11
11
|
export { useCameraSelector, useCameraValueByKey, enableCamera, takePhoto, disableCamera, default as cameraReducer, } from './features/cameraSlice';
|
|
12
|
+
export { uploadFile } from './api/metafile-api';
|
|
12
13
|
export { useDispatch, useSelector } from './redux/hooks';
|
|
13
14
|
export * from './components';
|
|
14
15
|
export * from './tools';
|
package/lib/index.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
export * from './app';
|
|
19
19
|
export { default as Navigator } from './navigator/Navigator';
|
|
20
20
|
export { configGlobalStore } from './redux/store';
|
|
21
|
-
export { storage, useStorage } from './storage/Storage';
|
|
21
|
+
export { storage, Storage, useStorage } from './storage/Storage';
|
|
22
22
|
export { traceError } from './api/traceback-api';
|
|
23
23
|
export { useEffectDebugger } from './hooks/use-effect-debugger';
|
|
24
24
|
export { logout } from './features/authSlice';
|
|
@@ -26,6 +26,7 @@ export { axiosApiProvider } from './axios/AxiosApi';
|
|
|
26
26
|
export { getApiResponseData, getFirstData, handlerApiCall, handlerError, } from './api/utils';
|
|
27
27
|
export { useScannedValueByKey, useScannerSelector, enableScan, scanValue, disableScan, default as scannerReducer, } from './features/scannerSlice';
|
|
28
28
|
export { useCameraSelector, useCameraValueByKey, enableCamera, takePhoto, disableCamera, default as cameraReducer, } from './features/cameraSlice';
|
|
29
|
+
export { uploadFile } from './api/metafile-api';
|
|
29
30
|
export { useDispatch, useSelector } from './redux/hooks';
|
|
30
31
|
export * from './components';
|
|
31
32
|
export * from './tools';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,OAAO,CAAC;AACtB,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,OAAO,EAAE,UAAU,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,OAAO,CAAC;AACtB,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAC,MAAM,EAAC,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,WAAW,EACX,OAAO,IAAI,cAAc,GAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,aAAa,EACb,OAAO,IAAI,aAAa,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACvD,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './translation';
|
|
@@ -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 * from './translation';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/middlewares/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 { isPlainObject } from '../utils';
|
|
19
|
+
export const translationMiddleware = (response) => {
|
|
20
|
+
if (response?.data?.data) {
|
|
21
|
+
response.data.data = parseTranslation(response.data.data);
|
|
22
|
+
}
|
|
23
|
+
return response;
|
|
24
|
+
};
|
|
25
|
+
const parseTranslation = (data, cache = new Map()) => {
|
|
26
|
+
if (Array.isArray(data)) {
|
|
27
|
+
return data.map(value => parseTranslation(value, cache));
|
|
28
|
+
}
|
|
29
|
+
if (isPlainObject(data)) {
|
|
30
|
+
if (cache.has(data)) {
|
|
31
|
+
return cache.get(data);
|
|
32
|
+
}
|
|
33
|
+
const updatedItem = {};
|
|
34
|
+
for (const [key, value] of Object.entries(data)) {
|
|
35
|
+
if (key.startsWith('$t:')) {
|
|
36
|
+
const translationKey = key.slice(3);
|
|
37
|
+
updatedItem[translationKey] = value;
|
|
38
|
+
}
|
|
39
|
+
else if (!(key in updatedItem)) {
|
|
40
|
+
updatedItem[key] = parseTranslation(value, cache);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
cache.set(data, updatedItem);
|
|
44
|
+
return updatedItem;
|
|
45
|
+
}
|
|
46
|
+
return data;
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=translation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translation.js","sourceRoot":"","sources":["../../src/middlewares/translation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,QAAuB,EACR,EAAE;IACjB,IAAI,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE;QACxB,QAAQ,CAAC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAC3D;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,CAAC,IAAS,EAAE,KAAK,GAAG,IAAI,GAAG,EAAE,EAAO,EAAE;IAC7D,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACvB,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;KAC1D;IAED,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE;QACvB,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACnB,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACxB;QAED,MAAM,WAAW,GAAG,EAAE,CAAC;QACvB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC/C,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;gBACzB,MAAM,cAAc,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACpC,WAAW,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC;aACrC;iBAAM,IAAI,CAAC,CAAC,GAAG,IAAI,WAAW,CAAC,EAAE;gBAChC,WAAW,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;aACnD;SACF;QAED,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC7B,OAAO,WAAW,CAAC;KACpB;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -15,26 +15,66 @@
|
|
|
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 React, { useEffect, useState } from 'react';
|
|
18
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
19
19
|
import { ActivityIndicator, StyleSheet, View, Dimensions, KeyboardAvoidingView, Platform, ScrollView, } from 'react-native';
|
|
20
20
|
import { useThemeColor, Text, Screen } from '@axelor/aos-mobile-ui';
|
|
21
21
|
import { ErrorText, LoginButton, LogoImage, PasswordInput, UrlInput, UsernameInput, } from '../components';
|
|
22
22
|
import { useDispatch, useSelector } from 'react-redux';
|
|
23
23
|
import { login } from '../features/authSlice';
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
24
|
+
import { useScannedValueByKey, useScannerSelector, } from '../features/scannerSlice';
|
|
25
|
+
import { useCameraScannerValueByKey } from '../features/cameraScannerSlice';
|
|
26
|
+
import { useScanActivator, useScannerDeviceActivator, } from '../hooks/use-scan-activator';
|
|
27
|
+
import { checkNullString } from '../utils';
|
|
28
|
+
import { storage } from '../storage/Storage';
|
|
29
|
+
import { URL_STORAGE_KEY } from '../utils/storage-keys';
|
|
26
30
|
const urlScanKey = 'login_url';
|
|
27
31
|
const LoginScreen = ({ route }) => {
|
|
28
|
-
const { loading, error } = useSelector(state => state.auth);
|
|
32
|
+
const { loading, error, baseUrl } = useSelector(state => state.auth);
|
|
29
33
|
const { isEnabled, scanKey } = useScannerSelector();
|
|
30
34
|
const scannedValue = useScannedValueByKey(urlScanKey);
|
|
31
35
|
const scanData = useCameraScannerValueByKey(urlScanKey);
|
|
36
|
+
const { enable: onScanPress } = useScanActivator(urlScanKey);
|
|
37
|
+
const { enable: enableScanner } = useScannerDeviceActivator(urlScanKey);
|
|
32
38
|
const appVersion = route?.params?.version;
|
|
39
|
+
const testInstanceConfig = route?.params?.testInstanceConfig;
|
|
40
|
+
const releaseInstanceConfig = route?.params?.releaseInstanceConfig;
|
|
41
|
+
const urlStorage = storage.getItem(URL_STORAGE_KEY);
|
|
33
42
|
const Colors = useThemeColor();
|
|
34
43
|
const dispatch = useDispatch();
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
44
|
+
const modeDebug = useMemo(() => __DEV__, []);
|
|
45
|
+
const showUrlInput = useMemo(() => {
|
|
46
|
+
if (modeDebug) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return releaseInstanceConfig?.showUrlInput || true;
|
|
51
|
+
}
|
|
52
|
+
}, [modeDebug, releaseInstanceConfig?.showUrlInput]);
|
|
53
|
+
const defaultUrl = useMemo(() => {
|
|
54
|
+
if (urlStorage != null) {
|
|
55
|
+
return urlStorage;
|
|
56
|
+
}
|
|
57
|
+
if (baseUrl != null) {
|
|
58
|
+
return baseUrl;
|
|
59
|
+
}
|
|
60
|
+
if (modeDebug) {
|
|
61
|
+
return testInstanceConfig?.defaultUrl;
|
|
62
|
+
}
|
|
63
|
+
return releaseInstanceConfig?.url;
|
|
64
|
+
}, [
|
|
65
|
+
urlStorage,
|
|
66
|
+
baseUrl,
|
|
67
|
+
modeDebug,
|
|
68
|
+
releaseInstanceConfig?.url,
|
|
69
|
+
testInstanceConfig?.defaultUrl,
|
|
70
|
+
]);
|
|
71
|
+
const [url, setUrl] = useState(defaultUrl || '');
|
|
72
|
+
const [username, setUsername] = useState(modeDebug ? testInstanceConfig?.defaultUsername : '');
|
|
73
|
+
const [password, setPassword] = useState(modeDebug ? testInstanceConfig?.defaultPassword : '');
|
|
74
|
+
const disabledLogin = useMemo(() => checkNullString(url) ||
|
|
75
|
+
checkNullString(username) ||
|
|
76
|
+
checkNullString(password) ||
|
|
77
|
+
loading, [loading, password, url, username]);
|
|
38
78
|
useEffect(() => {
|
|
39
79
|
if (scannedValue) {
|
|
40
80
|
if (scannedValue.includes('username') === true) {
|
|
@@ -64,17 +104,17 @@ const LoginScreen = ({ route }) => {
|
|
|
64
104
|
<View style={styles.imageContainer}>
|
|
65
105
|
<LogoImage url={url}/>
|
|
66
106
|
</View>
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
107
|
+
<ErrorText error={error}/>
|
|
108
|
+
{showUrlInput && (<UrlInput value={url} onChange={setUrl} readOnly={loading} onScanPress={onScanPress} onSelection={enableScanner} scanIconColor={isEnabled && scanKey === urlScanKey
|
|
109
|
+
? Colors.primaryColor.background
|
|
110
|
+
: Colors.secondaryColor_dark.background}/>)}
|
|
111
|
+
<UsernameInput value={username} onChange={setUsername} readOnly={loading} showScanIcon={!showUrlInput} onScanPress={onScanPress} onSelection={enableScanner} scanIconColor={isEnabled && scanKey === urlScanKey
|
|
70
112
|
? Colors.primaryColor.background
|
|
71
113
|
: Colors.secondaryColor_dark.background}/>
|
|
72
|
-
<UsernameInput value={username} onChange={setUsername} readOnly={loading}/>
|
|
73
114
|
<PasswordInput value={password} onChange={setPassword} readOnly={loading}/>
|
|
74
115
|
<View>
|
|
75
|
-
{loading ? (<ActivityIndicator size="large"/>) : (<LoginButton onPress={() => dispatch(login({ url, username, password }))} disabled={
|
|
116
|
+
{loading ? (<ActivityIndicator size="large"/>) : (<LoginButton onPress={() => dispatch(login({ url, username, password }))} disabled={disabledLogin}/>)}
|
|
76
117
|
</View>
|
|
77
|
-
<View>{error && <ErrorText message={error.message}/>}</View>
|
|
78
118
|
<View style={styles.copyright}>
|
|
79
119
|
<Text>{`© 2005 - ${new Date().getFullYear()} Axelor. All rights reserved.`}</Text>
|
|
80
120
|
<Text>{`Version ${appVersion}`}</Text>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoginScreen.js","sourceRoot":"","sources":["../../src/screens/LoginScreen.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LoginScreen.js","sourceRoot":"","sources":["../../src/screens/LoginScreen.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,EAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC1D,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,IAAI,EACJ,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACR,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,aAAa,EAAE,IAAI,EAAE,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAClE,OAAO,EACL,SAAS,EACT,WAAW,EACX,SAAS,EACT,aAAa,EACb,QAAQ,EACR,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AACrD,OAAO,EAAC,KAAK,EAAC,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EACL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAC,0BAA0B,EAAC,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EACL,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AACzC,OAAO,EAAC,O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CACN;YAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAC5B;cAAA,CAAC,IAAI,CAAC,CAAC,YAAY,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,+BAA+B,CAAC,EAAE,IAAI,CACjF;cAAA,CAAC,IAAI,CAAC,CAAC,WAAW,UAAU,EAAE,CAAC,EAAE,IAAI,CACvC;YAAA,EAAE,IAAI,CACR;UAAA,EAAE,IAAI,CACR;QAAA,EAAE,UAAU,CACd;MAAA,EAAE,oBAAoB,CACxB;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,SAAS,EAAE,KAAK;QAChB,UAAU,EAAE,QAAQ;QACpB,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,IAAI;KAC/C;IACD,cAAc,EAAE;QACd,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK;QAChE,YAAY,EAAE,KAAK;KACpB;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,UAAU;QACpB,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,CAAC;KACV;CACF,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC"}
|
package/lib/storage/Storage.d.ts
CHANGED
|
@@ -3,14 +3,18 @@ interface InternalStorage {
|
|
|
3
3
|
getString(key: string): string | undefined;
|
|
4
4
|
contains(key: string): boolean;
|
|
5
5
|
clearAll(): void;
|
|
6
|
+
getAllKeys(): string[];
|
|
7
|
+
delete(key: string): void;
|
|
6
8
|
}
|
|
7
|
-
declare class Storage {
|
|
9
|
+
export declare class Storage {
|
|
8
10
|
private storage;
|
|
9
11
|
constructor(storage: InternalStorage);
|
|
10
12
|
contains(key: string): boolean;
|
|
11
13
|
setItem(key: string, value: any): void;
|
|
12
14
|
getItem(key: string): any;
|
|
15
|
+
getAllKeys(): string[];
|
|
13
16
|
clearAll(): void;
|
|
17
|
+
deleteItem(key: string): void;
|
|
14
18
|
}
|
|
15
19
|
export declare const storage: Storage;
|
|
16
20
|
export declare function useStorage(): Storage;
|
package/lib/storage/Storage.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
import { MMKV } from 'react-native-mmkv';
|
|
19
|
-
class Storage {
|
|
19
|
+
export class Storage {
|
|
20
20
|
storage;
|
|
21
21
|
constructor(storage) {
|
|
22
22
|
this.storage = storage;
|
|
@@ -42,9 +42,15 @@ class Storage {
|
|
|
42
42
|
return strItem;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
getAllKeys() {
|
|
46
|
+
return this.storage.getAllKeys();
|
|
47
|
+
}
|
|
45
48
|
clearAll() {
|
|
46
49
|
this.storage.clearAll();
|
|
47
50
|
}
|
|
51
|
+
deleteItem(key) {
|
|
52
|
+
this.storage.delete(key);
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
55
|
export const storage = new Storage(new MMKV());
|
|
50
56
|
export function useStorage() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Storage.js","sourceRoot":"","sources":["../../src/storage/Storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Storage.js","sourceRoot":"","sources":["../../src/storage/Storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,IAAI,EAAC,MAAM,m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Selection: (onChange: any) => Promise<any>;
|
|
@@ -0,0 +1,42 @@
|
|
|
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 DocumentPicker from 'react-native-document-picker';
|
|
19
|
+
import RNFS from 'react-native-fs';
|
|
20
|
+
export const handleDocumentSelection = async (onChange) => {
|
|
21
|
+
try {
|
|
22
|
+
const document = await DocumentPicker.pick({
|
|
23
|
+
presentationStyle: 'fullScreen',
|
|
24
|
+
allowMultiSelection: false,
|
|
25
|
+
type: 'image/*',
|
|
26
|
+
}).then(documentList => {
|
|
27
|
+
if (documentList == null || documentList.length === 0) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return documentList[0];
|
|
31
|
+
});
|
|
32
|
+
if (document == null) {
|
|
33
|
+
return onChange(null);
|
|
34
|
+
}
|
|
35
|
+
const fileData = await RNFS.readFile(document.uri, 'base64');
|
|
36
|
+
onChange(`data:${document.type};base64,${fileData}`);
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
console.warn(err);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=FilePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilePicker.js","sourceRoot":"","sources":["../../src/tools/FilePicker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAC1D,OAAO,IAAI,MAAM,iBAAiB,CAAC;AAEnC,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,EAAC,QAAQ,EAAC,EAAE;IACtD,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC;YACzC,iBAAiB,EAAE,YAAY;YAC/B,mBAAmB,EAAE,KAAK;YAC1B,IAAI,EAAE,SAAS;SAChB,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE;YACrB,IAAI,YAAY,IAAI,IAAI,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;gBACrD,OAAO,IAAI,CAAC;aACb;YACD,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,IAAI,QAAQ,IAAI,IAAI,EAAE;YACpB,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;SACvB;QACD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC7D,QAAQ,CAAC,QAAQ,QAAQ,CAAC,IAAI,WAAW,QAAQ,EAAE,CAAC,CAAC;KACtD;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACnB;AACH,CAAC,CAAC"}
|
package/lib/utils/api.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
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 { formatURL as _formatURL } from './formatters';
|
|
19
|
+
const PREFIX_REGEX = /^https?:\/\//;
|
|
20
|
+
const INVALID_URL_CODE = 999;
|
|
21
|
+
export function testUrl(url) {
|
|
22
|
+
return new Promise(async (resolve, reject) => {
|
|
23
|
+
if (!url || typeof url !== 'string') {
|
|
24
|
+
reject(new Error(`Invalid URL: "${url}" ${INVALID_URL_CODE}`));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const formatUrl = _formatURL(isHttpUrl(url) ? url.replace(PREFIX_REGEX, '') : url);
|
|
28
|
+
const urlsWithProtocol = ['https', 'http'].map(protocol => `${protocol}://${formatUrl}`);
|
|
29
|
+
for (const urlWithProtocol of urlsWithProtocol) {
|
|
30
|
+
try {
|
|
31
|
+
const response = await fetch(urlWithProtocol);
|
|
32
|
+
if (response.ok) {
|
|
33
|
+
resolve(urlWithProtocol);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.log(`Error fetching ${urlWithProtocol}: ${error}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
reject(new Error(`Could not fetch URL: "${url}" ${INVALID_URL_CODE}`));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export function isHttpUrl(url) {
|
|
45
|
+
return PREFIX_REGEX.test(url);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @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AC,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChC,CAAC"}
|
package/lib/utils/date.d.ts
CHANGED
|
@@ -2,3 +2,6 @@ export declare const isDate: (date: string) => boolean;
|
|
|
2
2
|
export declare const isDateTime: (date: string) => boolean;
|
|
3
3
|
export declare const getNextMonth: (date: Date) => Date;
|
|
4
4
|
export declare const getPreviousMonth: (date: Date) => Date;
|
|
5
|
+
export declare const sameDate: (date1: Date, date2: Date) => boolean;
|
|
6
|
+
export declare const diffDate: (start: Date, end: Date) => number;
|
|
7
|
+
export declare const incrementDate: (date: Date, days: number) => Date;
|
package/lib/utils/date.js
CHANGED
|
@@ -38,4 +38,20 @@ export const getPreviousMonth = (date) => {
|
|
|
38
38
|
return new Date(date.getFullYear(), date.getMonth() - 1, 1);
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
+
export const sameDate = (date1, date2) => {
|
|
42
|
+
if (date1.getDate() === date2.getDate() &&
|
|
43
|
+
date1.getMonth() === date2.getMonth() &&
|
|
44
|
+
date1.getFullYear() === date2.getFullYear()) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
};
|
|
49
|
+
export const diffDate = (start, end) => {
|
|
50
|
+
const _start = moment(start.toISOString());
|
|
51
|
+
const _end = moment(end.toISOString());
|
|
52
|
+
return _end.diff(_start, 'days') + 1;
|
|
53
|
+
};
|
|
54
|
+
export const incrementDate = (date, days) => {
|
|
55
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + days);
|
|
56
|
+
};
|
|
41
57
|
//# sourceMappingURL=date.js.map
|
package/lib/utils/date.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;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AAK,CAAC,OAAO,EAAE,KAAK,KAAK,CAAC,OAAO,EAAE;QACnC,KAAK,CAAC,QAAQ,EAAE,KAAK,KAAK,CAAC,QAAQ,EAAE;QACrC,KAAK,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,WAAW,EAAE,EAC3C;QACA,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAW,EAAE,GAAS,EAAU,EAAE;IACzD,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IACvC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAU,EAAE,IAAY,EAAQ,EAAE;IAC9D,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;AAC9E,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Color } from '@axelor/aos-mobile-ui';
|
|
2
|
+
interface Chip {
|
|
3
|
+
isActive?: boolean;
|
|
4
|
+
color: Color;
|
|
5
|
+
title: string;
|
|
6
|
+
key: string | number;
|
|
7
|
+
}
|
|
8
|
+
export declare function filterChip(listToFilter: any[], listSelectedChip: Chip[], objectParam: string): any[];
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
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 function filterChip(listToFilter, listSelectedChip, objectParam) {
|
|
19
|
+
if (listToFilter == null) {
|
|
20
|
+
return listToFilter;
|
|
21
|
+
}
|
|
22
|
+
else if (listSelectedChip !== null && listSelectedChip.length > 0) {
|
|
23
|
+
return listToFilter.filter(item => {
|
|
24
|
+
return listSelectedChip.find(chip => chip?.key === item[objectParam]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return listToFilter;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../src/utils/filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAWH,MAAM,UAAU,UAAU,CACxB,YAAmB,EACnB,gBAAwB,EACxB,WAAmB;IAEnB,IAAI,YAAY,IAAI,IAAI,EAAE;QACxB,OAAO,YAAY,CAAC;KACrB;SAAM,IAAI,gBAAgB,KAAK,IAAI,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE;QACnE,OAAO,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAChC,OAAO,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;KACJ;SAAM;QACL,OAAO,YAAY,CAAC;KACrB;AACH,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare function formatDate(inputDate: any, format: any): any;
|
|
2
2
|
export declare const formatDateTime: (dateTime: any, format: any) => any;
|
|
3
|
+
export declare function formatTime(dateInput: string, format: string): string;
|
|
3
4
|
export declare function formatDuration(duration: number, format: string): string;
|
|
4
5
|
export declare function formatScan(barcodeValue: any, barcodeType: any, config?: boolean): any;
|
|
5
6
|
export declare function formatURL(url: String): String;
|