@axelor/aos-mobile-core 7.0.2 → 7.0.4
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/lib/api/metafile-api.d.ts +3 -1
- package/lib/api/metafile-api.js +10 -2
- package/lib/api/metafile-api.js.map +1 -1
- package/lib/apiProviders/utils.d.ts +7 -7
- package/lib/apiProviders/utils.js +18 -22
- package/lib/apiProviders/utils.js.map +1 -1
- package/lib/app/Module.d.ts +15 -2
- package/lib/auth/api/user-api.js +5 -3
- package/lib/auth/api/user-api.js.map +1 -1
- package/lib/auth/features/userSlice.js +7 -1
- package/lib/auth/features/userSlice.js.map +1 -1
- package/lib/auth/i18n/en.json +0 -16
- package/lib/auth/i18n/fr.json +0 -16
- package/lib/auth/index.js +1 -0
- package/lib/auth/index.js.map +1 -1
- package/lib/auth/models/objectFields.js +14 -0
- package/lib/auth/models/objectFields.js.map +1 -1
- package/lib/auth/screens/UserScreen.js +6 -6
- package/lib/auth/screens/UserScreen.js.map +1 -1
- package/lib/components/molecules/UploadFileInput/UploadFileInput.d.ts +11 -2
- package/lib/components/molecules/UploadFileInput/UploadFileInput.js +128 -19
- package/lib/components/molecules/UploadFileInput/UploadFileInput.js.map +1 -1
- package/lib/components/molecules/index.d.ts +0 -3
- package/lib/components/molecules/index.js +0 -3
- package/lib/components/molecules/index.js.map +1 -1
- package/lib/components/organisms/DateInput/DateInput.d.ts +2 -1
- package/lib/components/organisms/DateInput/DateInput.js +10 -12
- package/lib/components/organisms/DateInput/DateInput.js.map +1 -1
- package/lib/components/organisms/index.d.ts +1 -6
- package/lib/components/organisms/index.js +1 -6
- package/lib/components/organisms/index.js.map +1 -1
- package/lib/components/templates/index.d.ts +0 -3
- package/lib/components/templates/index.js +0 -3
- package/lib/components/templates/index.js.map +1 -1
- package/lib/header/HeaderActionsProvider.d.ts +3 -4
- package/lib/header/HeaderActionsProvider.js +16 -10
- package/lib/header/HeaderActionsProvider.js.map +1 -1
- package/lib/header/index.d.ts +2 -1
- package/lib/header/index.js +2 -1
- package/lib/header/index.js.map +1 -1
- package/lib/i18n/hooks/use-translator.d.ts +1 -1
- package/lib/i18n/translations/en.json +34 -4
- package/lib/i18n/translations/fr.json +34 -4
- package/lib/navigator/Navigator.js +19 -7
- package/lib/navigator/Navigator.js.map +1 -1
- package/lib/navigator/drawer/DrawerContent.js +42 -31
- package/lib/navigator/drawer/DrawerContent.js.map +1 -1
- package/lib/navigator/drawer/Header.js +26 -6
- package/lib/navigator/drawer/Header.js.map +1 -1
- package/lib/navigator/drawer/Menu.d.ts +2 -1
- package/lib/navigator/drawer/Menu.js +42 -17
- package/lib/navigator/drawer/Menu.js.map +1 -1
- package/lib/navigator/drawer/MenuItem.d.ts +8 -5
- package/lib/navigator/drawer/MenuItem.js +11 -51
- package/lib/navigator/drawer/MenuItem.js.map +1 -1
- package/lib/navigator/drawer/MenuItemEntry.d.ts +12 -0
- package/lib/navigator/drawer/MenuItemEntry.js +89 -0
- package/lib/navigator/drawer/MenuItemEntry.js.map +1 -0
- package/lib/navigator/drawer/SubMenuItem.d.ts +7 -0
- package/lib/navigator/drawer/SubMenuItem.js +34 -0
- package/lib/navigator/drawer/SubMenuItem.js.map +1 -0
- package/lib/navigator/drawer/SubMenuItemList.d.ts +10 -0
- package/lib/navigator/drawer/SubMenuItemList.js +46 -0
- package/lib/navigator/drawer/SubMenuItemList.js.map +1 -0
- package/lib/navigator/menu.helper.d.ts +9 -0
- package/lib/navigator/menu.helper.js +96 -3
- package/lib/navigator/menu.helper.js.map +1 -1
- package/lib/navigator/module.helper.d.ts +5 -0
- package/lib/navigator/module.helper.js +37 -1
- package/lib/navigator/module.helper.js.map +1 -1
- package/lib/screens/LoginScreen.js +47 -73
- package/lib/screens/LoginScreen.js.map +1 -1
- package/lib/screens/SessionManagementScreen.js +41 -21
- package/lib/screens/SessionManagementScreen.js.map +1 -1
- package/lib/sessions/SessionStorage.d.ts +4 -5
- package/lib/sessions/SessionStorage.js +30 -22
- package/lib/sessions/SessionStorage.js.map +1 -1
- package/lib/{components/templates/PopupCreateSession → sessions/components/alerts}/PopupCreateSession.d.ts +2 -2
- package/lib/sessions/components/alerts/PopupCreateSession.js +128 -0
- package/lib/sessions/components/alerts/PopupCreateSession.js.map +1 -0
- package/lib/sessions/components/alerts/PopupEditSession.d.ts +8 -0
- package/lib/sessions/components/alerts/PopupEditSession.js +83 -0
- package/lib/sessions/components/alerts/PopupEditSession.js.map +1 -0
- package/lib/sessions/components/alerts/PopupSession.d.ts +9 -0
- package/lib/sessions/components/alerts/PopupSession.js +84 -0
- package/lib/sessions/components/alerts/PopupSession.js.map +1 -0
- package/lib/sessions/components/alerts/index.d.ts +3 -0
- package/lib/sessions/components/alerts/index.js +21 -0
- package/lib/sessions/components/alerts/index.js.map +1 -0
- package/lib/sessions/components/buttons/DisabledButton.d.ts +7 -0
- package/lib/{components/molecules/LoginButton/LoginButton.js → sessions/components/buttons/DisabledButton.js} +5 -5
- package/lib/sessions/components/buttons/DisabledButton.js.map +1 -0
- package/lib/sessions/components/buttons/LoginButton.js +24 -0
- package/lib/sessions/components/buttons/LoginButton.js.map +1 -0
- package/lib/sessions/components/buttons/UpdateButton.d.ts +6 -0
- package/lib/sessions/components/buttons/UpdateButton.js +24 -0
- package/lib/sessions/components/buttons/UpdateButton.js.map +1 -0
- package/lib/sessions/components/buttons/index.d.ts +3 -0
- package/lib/sessions/components/buttons/index.js +21 -0
- package/lib/sessions/components/buttons/index.js.map +1 -0
- package/lib/sessions/components/display/LogoImage.js.map +1 -0
- package/lib/sessions/components/display/SessionCard.d.ts +9 -0
- package/lib/sessions/components/display/SessionCard.js +185 -0
- package/lib/sessions/components/display/SessionCard.js.map +1 -0
- package/lib/sessions/components/display/SessionListCard.d.ts +10 -0
- package/lib/sessions/components/display/SessionListCard.js +78 -0
- package/lib/sessions/components/display/SessionListCard.js.map +1 -0
- package/lib/sessions/components/display/index.d.ts +3 -0
- package/lib/sessions/components/display/index.js +21 -0
- package/lib/sessions/components/display/index.js.map +1 -0
- package/lib/{components/molecules/ErrorText → sessions/components/error}/ErrorText.js +2 -2
- package/lib/sessions/components/error/ErrorText.js.map +1 -0
- package/lib/sessions/components/error/index.d.ts +1 -0
- package/lib/sessions/components/error/index.js +19 -0
- package/lib/sessions/components/error/index.js.map +1 -0
- package/lib/sessions/components/index.d.ts +5 -0
- package/lib/sessions/components/index.js +23 -0
- package/lib/sessions/components/index.js.map +1 -0
- package/lib/sessions/components/inputs/DefaultCheckbox.d.ts +8 -0
- package/lib/sessions/components/inputs/DefaultCheckbox.js +36 -0
- package/lib/sessions/components/inputs/DefaultCheckbox.js.map +1 -0
- package/lib/{components/organisms/PasswordInput → sessions/components/inputs}/PasswordInput.d.ts +2 -1
- package/lib/{components/organisms/PasswordInput → sessions/components/inputs}/PasswordInput.js +5 -2
- package/lib/sessions/components/inputs/PasswordInput.js.map +1 -0
- package/lib/sessions/components/inputs/SessionInputs.d.ts +12 -0
- package/lib/sessions/components/inputs/SessionInputs.js +177 -0
- package/lib/sessions/components/inputs/SessionInputs.js.map +1 -0
- package/lib/{components/organisms/SessionNameInput → sessions/components/inputs}/SessionNameInput.d.ts +2 -1
- package/lib/{components/organisms/SessionNameInput → sessions/components/inputs}/SessionNameInput.js +5 -2
- package/lib/sessions/components/inputs/SessionNameInput.js.map +1 -0
- package/lib/{components/organisms/UrlInput → sessions/components/inputs}/UrlInput.d.ts +2 -1
- package/lib/{components/organisms/UrlInput → sessions/components/inputs}/UrlInput.js +14 -3
- package/lib/sessions/components/inputs/UrlInput.js.map +1 -0
- package/lib/{components/organisms/UsernameInput → sessions/components/inputs}/UsernameInput.js +10 -2
- package/lib/sessions/components/inputs/UsernameInput.js.map +1 -0
- package/lib/sessions/components/inputs/index.d.ts +6 -0
- package/lib/sessions/components/inputs/index.js +24 -0
- package/lib/sessions/components/inputs/index.js.map +1 -0
- package/lib/sessions/hook.d.ts +1 -1
- package/lib/sessions/hook.js +5 -5
- package/lib/sessions/hook.js.map +1 -1
- package/lib/sessions/index.d.ts +2 -1
- package/lib/sessions/index.js +2 -1
- package/lib/sessions/index.js.map +1 -1
- package/lib/sessions/type.d.ts +2 -1
- package/lib/sessions/type.js.map +1 -1
- package/lib/sessions/utils.d.ts +2 -1
- package/lib/sessions/utils.js +26 -7
- package/lib/sessions/utils.js.map +1 -1
- package/lib/tools/ContactProvider.d.ts +9 -0
- package/lib/tools/ContactProvider.js +98 -0
- package/lib/tools/ContactProvider.js.map +1 -0
- package/lib/tools/contact.helper.d.ts +21 -0
- package/lib/tools/contact.helper.js +136 -0
- package/lib/tools/contact.helper.js.map +1 -0
- package/lib/tools/index.d.ts +1 -0
- package/lib/tools/index.js +1 -0
- package/lib/tools/index.js.map +1 -1
- package/lib/utils/date.d.ts +16 -0
- package/lib/utils/date.js +41 -0
- package/lib/utils/date.js.map +1 -1
- package/lib/utils/image.d.ts +3 -0
- package/lib/utils/image.js +11 -3
- package/lib/utils/image.js.map +1 -1
- package/lib/utils/index.d.ts +2 -2
- package/lib/utils/index.js +2 -2
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/string.d.ts +1 -0
- package/lib/utils/string.js +20 -0
- package/lib/utils/string.js.map +1 -1
- package/package.json +8 -5
- package/lib/components/molecules/ErrorText/ErrorText.js.map +0 -1
- package/lib/components/molecules/LoginButton/LoginButton.js.map +0 -1
- package/lib/components/molecules/SessionNumberIndicator/SessionNumberIndicator.d.ts +0 -4
- package/lib/components/molecules/SessionNumberIndicator/SessionNumberIndicator.js +0 -44
- package/lib/components/molecules/SessionNumberIndicator/SessionNumberIndicator.js.map +0 -1
- package/lib/components/organisms/LogoImage/LogoImage.js.map +0 -1
- package/lib/components/organisms/PasswordInput/PasswordInput.js.map +0 -1
- package/lib/components/organisms/SessionButtons/SessionButtons.d.ts +0 -17
- package/lib/components/organisms/SessionButtons/SessionButtons.js +0 -93
- package/lib/components/organisms/SessionButtons/SessionButtons.js.map +0 -1
- package/lib/components/organisms/SessionNameInput/SessionNameInput.js.map +0 -1
- package/lib/components/organisms/UrlInput/UrlInput.js.map +0 -1
- package/lib/components/organisms/UsernameInput/UsernameInput.js.map +0 -1
- package/lib/components/templates/PopupCreateSession/PopupCreateSession.js +0 -171
- package/lib/components/templates/PopupCreateSession/PopupCreateSession.js.map +0 -1
- package/lib/components/templates/PopupSession/PopupSession.d.ts +0 -8
- package/lib/components/templates/PopupSession/PopupSession.js +0 -135
- package/lib/components/templates/PopupSession/PopupSession.js.map +0 -1
- package/lib/components/templates/PopupSessionList/PopupSessionList.d.ts +0 -7
- package/lib/components/templates/PopupSessionList/PopupSessionList.js +0 -107
- package/lib/components/templates/PopupSessionList/PopupSessionList.js.map +0 -1
- /package/lib/{components/molecules/LoginButton → sessions/components/buttons}/LoginButton.d.ts +0 -0
- /package/lib/{components/organisms/LogoImage → sessions/components/display}/LogoImage.d.ts +0 -0
- /package/lib/{components/organisms/LogoImage → sessions/components/display}/LogoImage.js +0 -0
- /package/lib/{components/molecules/ErrorText → sessions/components/error}/ErrorText.d.ts +0 -0
- /package/lib/{components/organisms/UsernameInput → sessions/components/inputs}/UsernameInput.d.ts +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as DefaultCheckbox } from './DefaultCheckbox';
|
|
2
|
+
export { default as PasswordInput } from './PasswordInput';
|
|
3
|
+
export { default as SessionInputs } from './SessionInputs';
|
|
4
|
+
export { default as SessionNameInput } from './SessionNameInput';
|
|
5
|
+
export { default as UrlInput } from './UrlInput';
|
|
6
|
+
export { default as UsernameInput } from './UsernameInput';
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { default as DefaultCheckbox } from './DefaultCheckbox';
|
|
19
|
+
export { default as PasswordInput } from './PasswordInput';
|
|
20
|
+
export { default as SessionInputs } from './SessionInputs';
|
|
21
|
+
export { default as SessionNameInput } from './SessionNameInput';
|
|
22
|
+
export { default as UrlInput } from './UrlInput';
|
|
23
|
+
export { default as UsernameInput } from './UsernameInput';
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/sessions/components/inputs/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAC,OAAO,IAAI,aAAa,EAAC,MAAM,iBAAiB,CAAC"}
|
package/lib/sessions/hook.d.ts
CHANGED
package/lib/sessions/hook.js
CHANGED
|
@@ -19,10 +19,10 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
19
19
|
import { sessionStorage } from './SessionStorage';
|
|
20
20
|
export const useSessions = () => {
|
|
21
21
|
const [sessionList, setSessionList] = useState(sessionStorage.getSessionList());
|
|
22
|
-
const [
|
|
23
|
-
const refreshData = useCallback(({ sessionList: sessions,
|
|
24
|
-
setSessionActive(activeSession);
|
|
22
|
+
const [sessionDefault, setSessionDefault] = useState(sessionStorage.getDefaultSession());
|
|
23
|
+
const refreshData = useCallback(({ sessionList: sessions, defaultSession }) => {
|
|
25
24
|
setSessionList(sessions);
|
|
25
|
+
setSessionDefault(defaultSession);
|
|
26
26
|
}, []);
|
|
27
27
|
useEffect(() => {
|
|
28
28
|
sessionStorage.register(refreshData);
|
|
@@ -30,8 +30,8 @@ export const useSessions = () => {
|
|
|
30
30
|
return useMemo(() => {
|
|
31
31
|
return {
|
|
32
32
|
sessionList: sessionList,
|
|
33
|
-
|
|
33
|
+
sessionDefault: sessionDefault,
|
|
34
34
|
};
|
|
35
|
-
}, [
|
|
35
|
+
}, [sessionList, sessionDefault]);
|
|
36
36
|
};
|
|
37
37
|
//# sourceMappingURL=hook.js.map
|
package/lib/sessions/hook.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook.js","sourceRoot":"","sources":["../../src/sessions/hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAChE,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAGhD,MAAM,CAAC,MAAM,WAAW,GAAG,GAGzB,EAAE;IACF,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAC5C,cAAc,CAAC,cAAc,EAAE,CAChC,CAAC;IAEF,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"hook.js","sourceRoot":"","sources":["../../src/sessions/hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAChE,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAGhD,MAAM,CAAC,MAAM,WAAW,GAAG,GAGzB,EAAE;IACF,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAC5C,cAAc,CAAC,cAAc,EAAE,CAChC,CAAC;IAEF,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAClD,cAAc,CAAC,iBAAiB,EAAE,CACnC,CAAC;IAEF,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,EAAC,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAC,EAAE,EAAE;QAC1E,cAAc,CAAC,QAAQ,CAAC,CAAC;QACzB,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACpC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,OAAO;YACL,WAAW,EAAE,WAAW;YACxB,cAAc,EAAE,cAAc;SAC/B,CAAC;IACJ,CAAC,EAAE,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;AACpC,CAAC,CAAC"}
|
package/lib/sessions/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { useSessions } from './hook';
|
|
2
2
|
export { Session, URL_STORAGE_KEY } from './type';
|
|
3
3
|
export { sessionStorage } from './SessionStorage';
|
|
4
|
-
export {
|
|
4
|
+
export { getStorageUrl, saveUrlInStorage } from './utils';
|
|
5
|
+
export * from './components';
|
package/lib/sessions/index.js
CHANGED
|
@@ -18,5 +18,6 @@
|
|
|
18
18
|
export { useSessions } from './hook';
|
|
19
19
|
export { URL_STORAGE_KEY } from './type';
|
|
20
20
|
export { sessionStorage } from './SessionStorage';
|
|
21
|
-
export {
|
|
21
|
+
export { getStorageUrl, saveUrlInStorage } from './utils';
|
|
22
|
+
export * from './components';
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sessions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAU,eAAe,EAAC,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sessions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAU,eAAe,EAAC,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,SAAS,CAAC;AACxD,cAAc,cAAc,CAAC"}
|
package/lib/sessions/type.d.ts
CHANGED
package/lib/sessions/type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/sessions/type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/sessions/type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC"}
|
package/lib/sessions/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Session } from './type';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const manageDefaultSession: (sessionList: Session[], session: Session) => Session[];
|
|
3
3
|
export declare const getStorageUrl: () => string;
|
|
4
4
|
export declare const saveUrlInStorage: (url: string) => void;
|
|
5
|
+
export declare const migrateOldSessionToNewSystem: (data: any[]) => Session[];
|
package/lib/sessions/utils.js
CHANGED
|
@@ -17,13 +17,16 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { storage } from '../storage/Storage';
|
|
19
19
|
import { URL_STORAGE_KEY } from './type';
|
|
20
|
-
export const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
export const manageDefaultSession = (sessionList, session) => {
|
|
21
|
+
if (session.isDefault) {
|
|
22
|
+
return sessionList.map(_session => {
|
|
23
|
+
if (_session.id === session.id) {
|
|
24
|
+
return { ..._session, isDefault: true };
|
|
25
|
+
}
|
|
26
|
+
return { ..._session, isDefault: false };
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return sessionList;
|
|
27
30
|
};
|
|
28
31
|
export const getStorageUrl = () => {
|
|
29
32
|
return storage.getItem(URL_STORAGE_KEY);
|
|
@@ -31,4 +34,20 @@ export const getStorageUrl = () => {
|
|
|
31
34
|
export const saveUrlInStorage = (url) => {
|
|
32
35
|
storage.setItem(URL_STORAGE_KEY, url);
|
|
33
36
|
};
|
|
37
|
+
export const migrateOldSessionToNewSystem = (data) => {
|
|
38
|
+
return data.map((_item, index) => {
|
|
39
|
+
if (_item?.name == null) {
|
|
40
|
+
return {
|
|
41
|
+
id: `session-${Date.now()}-${index}`,
|
|
42
|
+
name: _item.id,
|
|
43
|
+
url: _item.url,
|
|
44
|
+
username: _item.username,
|
|
45
|
+
isDefault: _item.isActive,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return _item;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
};
|
|
34
53
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/sessions/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAC,eAAe,EAAC,MAAM,QAAQ,CAAC;AAGvC,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/sessions/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAC,eAAe,EAAC,MAAM,QAAQ,CAAC;AAGvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,WAAsB,EACtB,OAAgB,EACL,EAAE;IACb,IAAI,OAAO,CAAC,SAAS,EAAE;QACrB,OAAO,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAChC,IAAI,QAAQ,CAAC,EAAE,KAAK,OAAO,CAAC,EAAE,EAAE;gBAC9B,OAAO,EAAC,GAAG,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAC,CAAC;aACvC;YAED,OAAO,EAAC,GAAG,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAC,CAAC;QACzC,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAW,EAAE;IACxC,OAAO,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAAQ,EAAE;IACpD,OAAO,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,IAAW,EAAa,EAAE;IACrE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC/B,IAAI,KAAK,EAAE,IAAI,IAAI,IAAI,EAAE;YACvB,OAAO;gBACL,EAAE,EAAE,WAAW,IAAI,CAAC,GAAG,EAAE,IAAI,KAAK,EAAE;gBACpC,IAAI,EAAE,KAAK,CAAC,EAAE;gBACd,GAAG,EAAE,KAAK,CAAC,GAAG;gBACd,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,SAAS,EAAE,KAAK,CAAC,QAAQ;aAC1B,CAAC;SACH;aAAM;YACL,OAAO,KAAgB,CAAC;SACzB;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ContactData } from './contact.helper';
|
|
2
|
+
declare class ContactProvider {
|
|
3
|
+
constructor();
|
|
4
|
+
private _getContactsPermission;
|
|
5
|
+
private _showToast;
|
|
6
|
+
saveContact: (contactData: ContactData) => Promise<boolean>;
|
|
7
|
+
}
|
|
8
|
+
export declare const contactProvider: ContactProvider;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
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 { PermissionsAndroid, Platform } from 'react-native';
|
|
19
|
+
import Toast from 'react-native-toast-message';
|
|
20
|
+
import * as Contacts from 'react-native-contacts';
|
|
21
|
+
import { PermissionResult, parseContactData, } from './contact.helper';
|
|
22
|
+
class ContactProvider {
|
|
23
|
+
constructor() { }
|
|
24
|
+
_getContactsPermission = async () => {
|
|
25
|
+
try {
|
|
26
|
+
switch (Platform.OS) {
|
|
27
|
+
case 'ios':
|
|
28
|
+
const _permIOS = await Contacts.requestPermission();
|
|
29
|
+
switch (_permIOS) {
|
|
30
|
+
case 'authorized':
|
|
31
|
+
return PermissionResult.GRANTED;
|
|
32
|
+
default:
|
|
33
|
+
return PermissionResult.DENIED;
|
|
34
|
+
}
|
|
35
|
+
case 'android':
|
|
36
|
+
const _permAndroid = await PermissionsAndroid.requestMultiple([
|
|
37
|
+
PermissionsAndroid.PERMISSIONS.READ_CONTACTS,
|
|
38
|
+
PermissionsAndroid.PERMISSIONS.WRITE_CONTACTS,
|
|
39
|
+
]);
|
|
40
|
+
if (Object.values(_permAndroid).every(_perm => _perm === PermissionsAndroid.RESULTS.GRANTED)) {
|
|
41
|
+
return PermissionResult.GRANTED;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return PermissionResult.DENIED;
|
|
45
|
+
}
|
|
46
|
+
default:
|
|
47
|
+
throw new Error('Unsupported device.');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error('Error requesting contacts permission:', error);
|
|
52
|
+
return PermissionResult.DENIED;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
_showToast = (type, message) => {
|
|
56
|
+
Toast.show({
|
|
57
|
+
type,
|
|
58
|
+
position: 'bottom',
|
|
59
|
+
bottomOffset: 20,
|
|
60
|
+
text1: type === 'success' ? 'Success' : 'Error',
|
|
61
|
+
text2: message,
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
saveContact = async (contactData) => {
|
|
65
|
+
try {
|
|
66
|
+
if (!contactData.firstName) {
|
|
67
|
+
throw new Error('Required contact data is missing.');
|
|
68
|
+
}
|
|
69
|
+
const permissionResult = await this._getContactsPermission();
|
|
70
|
+
switch (permissionResult) {
|
|
71
|
+
case PermissionResult.GRANTED:
|
|
72
|
+
const contactAdded = await Contacts.openContactForm(parseContactData(contactData)).then(_contact => {
|
|
73
|
+
if (_contact != null) {
|
|
74
|
+
this._showToast('success', `Contact ${_contact.givenName} added successfully.`);
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this._showToast('error', 'Contact addition was canceled.');
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return contactAdded;
|
|
83
|
+
case PermissionResult.DENIED:
|
|
84
|
+
this._showToast('error', 'Contacts permission denied.');
|
|
85
|
+
return false;
|
|
86
|
+
default:
|
|
87
|
+
this._showToast('error', 'Unknown permission result.');
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
this._showToast('error', `Error adding contact: ${error}`);
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export const contactProvider = new ContactProvider();
|
|
98
|
+
//# sourceMappingURL=ContactProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContactProvider.js","sourceRoot":"","sources":["../../src/tools/ContactProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,kBAAkB,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,MAAM,4BAA4B,CAAC;AAC/C,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAEL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,eAAe;IACnB,gBAAe,CAAC;IAER,sBAAsB,GAAG,KA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ContactData {
|
|
3
|
+
firstName: string;
|
|
4
|
+
lastName?: string;
|
|
5
|
+
company?: string;
|
|
6
|
+
mobilePhone?: string;
|
|
7
|
+
fixedPhone?: string;
|
|
8
|
+
email?: string;
|
|
9
|
+
address?: {
|
|
10
|
+
street?: string;
|
|
11
|
+
postCode?: string;
|
|
12
|
+
city?: string;
|
|
13
|
+
country?: string;
|
|
14
|
+
};
|
|
15
|
+
notes?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare enum PermissionResult {
|
|
18
|
+
DENIED = "denied",
|
|
19
|
+
GRANTED = "granted"
|
|
20
|
+
}
|
|
21
|
+
export declare const parseContactData: (contact: ContactData) => Partial<Contacts.Contact>;
|
|
@@ -0,0 +1,136 @@
|
|
|
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 { isEmpty } from '../utils';
|
|
19
|
+
import { Platform } from 'react-native';
|
|
20
|
+
export var PermissionResult;
|
|
21
|
+
(function (PermissionResult) {
|
|
22
|
+
PermissionResult["DENIED"] = "denied";
|
|
23
|
+
PermissionResult["GRANTED"] = "granted";
|
|
24
|
+
})(PermissionResult || (PermissionResult = {}));
|
|
25
|
+
const CONTACT_MAPPER = {
|
|
26
|
+
firstName: {
|
|
27
|
+
key: 'givenName',
|
|
28
|
+
type: 'info',
|
|
29
|
+
},
|
|
30
|
+
lastName: {
|
|
31
|
+
key: 'familyName',
|
|
32
|
+
type: 'info',
|
|
33
|
+
},
|
|
34
|
+
company: {
|
|
35
|
+
key: 'company',
|
|
36
|
+
type: 'info',
|
|
37
|
+
},
|
|
38
|
+
notes: {
|
|
39
|
+
key: 'note',
|
|
40
|
+
type: 'info',
|
|
41
|
+
},
|
|
42
|
+
mobilePhone: {
|
|
43
|
+
key: 'phoneNumbers',
|
|
44
|
+
type: 'phone',
|
|
45
|
+
label: 'mobile',
|
|
46
|
+
},
|
|
47
|
+
fixedPhone: {
|
|
48
|
+
key: 'phoneNumbers',
|
|
49
|
+
type: 'phone',
|
|
50
|
+
label: 'fixed',
|
|
51
|
+
},
|
|
52
|
+
email: {
|
|
53
|
+
key: 'emailAddresses',
|
|
54
|
+
type: 'email',
|
|
55
|
+
label: 'work',
|
|
56
|
+
},
|
|
57
|
+
address: {
|
|
58
|
+
key: 'postalAddresses',
|
|
59
|
+
type: 'address',
|
|
60
|
+
label: 'main address',
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
const manageAndroidName = (data) => {
|
|
64
|
+
let result = '';
|
|
65
|
+
if (data.firstName != null) {
|
|
66
|
+
result = result.concat(data.firstName);
|
|
67
|
+
}
|
|
68
|
+
if (data.lastName != null) {
|
|
69
|
+
result = result.concat(' ').concat(data.lastName);
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
};
|
|
73
|
+
const manageArrayField = (array, value) => {
|
|
74
|
+
const _array = Array.isArray(array) ? [...array] : [];
|
|
75
|
+
_array.push(value);
|
|
76
|
+
return _array;
|
|
77
|
+
};
|
|
78
|
+
const managePhoneField = (value, label) => ({
|
|
79
|
+
label: label,
|
|
80
|
+
number: value,
|
|
81
|
+
});
|
|
82
|
+
const manageEmailField = (value, label) => ({
|
|
83
|
+
label: label,
|
|
84
|
+
email: value,
|
|
85
|
+
});
|
|
86
|
+
const manageAddressField = (value, label) => {
|
|
87
|
+
const DEFAULT = '';
|
|
88
|
+
const street = value?.street || DEFAULT;
|
|
89
|
+
const postCode = value?.postCode || DEFAULT;
|
|
90
|
+
const city = value?.city || DEFAULT;
|
|
91
|
+
const country = value?.country || DEFAULT;
|
|
92
|
+
return {
|
|
93
|
+
label: label,
|
|
94
|
+
formattedAddress: `${street} ${postCode} ${city} ${country}`,
|
|
95
|
+
street,
|
|
96
|
+
pobox: DEFAULT,
|
|
97
|
+
neighborhood: DEFAULT,
|
|
98
|
+
city,
|
|
99
|
+
region: DEFAULT,
|
|
100
|
+
state: DEFAULT,
|
|
101
|
+
postCode,
|
|
102
|
+
country,
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export const parseContactData = (contact) => {
|
|
106
|
+
if (isEmpty(contact)) {
|
|
107
|
+
return {};
|
|
108
|
+
}
|
|
109
|
+
const result = {};
|
|
110
|
+
Object.entries(CONTACT_MAPPER).forEach(([key, config]) => {
|
|
111
|
+
const value = contact[key];
|
|
112
|
+
if (value != null) {
|
|
113
|
+
switch (config.type) {
|
|
114
|
+
case 'info':
|
|
115
|
+
result[config.key] = value;
|
|
116
|
+
break;
|
|
117
|
+
case 'phone':
|
|
118
|
+
result[config.key] = manageArrayField(result[config.key], managePhoneField(value, config.label));
|
|
119
|
+
break;
|
|
120
|
+
case 'email':
|
|
121
|
+
result[config.key] = manageArrayField(result[config.key], manageEmailField(value, config.label));
|
|
122
|
+
break;
|
|
123
|
+
case 'address':
|
|
124
|
+
result[config.key] = manageArrayField(result[config.key], manageAddressField(value, config.label));
|
|
125
|
+
break;
|
|
126
|
+
default:
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
if (Platform.OS === 'android') {
|
|
132
|
+
result.displayName = manageAndroidName(contact);
|
|
133
|
+
}
|
|
134
|
+
return result;
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=contact.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact.helper.js","sourceRoot":"","sources":["../../src/tools/contact.helper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AACjC,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAkBtC,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;AACrB,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAED,MAAM,cAAc,GAMhB;IACF,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,IAAI,EAAE,MAAM;KACb;IACD,QAAQ,EAAE;QACR,GAAG,EAAE,YAAY;QACjB,IAAI,EAAE,MAAM;KACb;IACD,OAAO,EAAE;QACP,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,MAAM;KACb;IACD,KAAK,EAAE;QACL,GAAG,EAAE,MAAM;QACX,IAAI,EAAE,MAAM;KACb;IACD,WAAW,EAAE;QACX,GAAG,EAAE,cAAc;QACnB,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,QAAQ;KAChB;IACD,UAAU,EAAE;QACV,GAAG,EAAE,cAAc;QACnB,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;KACf;IACD,KAAK,EAAE;QACL,GAAG,EAAE,gBAAgB;QACrB,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,MAAM;KACd;IACD,OAAO,EAAE;QACP,GAAG,EAAE,iBAAiB;QACtB,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,cAAc;KACtB;CACF,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,IAAiB,EAAE,EAAE;IAC9C,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE;QAC1B,MAAM,GAA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G,CAAC,EAClB,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CACxC,CAAC;oBACF,MAAM;gBACR;oBACE,MAAM;aACT;SACF;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE;QAC7B,MAAM,CAAC,WAAW,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;KACjD;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
package/lib/tools/index.d.ts
CHANGED
package/lib/tools/index.js
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
export { clipboardProvider } from './ClipboardProvider';
|
|
19
|
+
export { contactProvider } from './ContactProvider';
|
|
19
20
|
export { openFileInExternalApp } from './FileViewer';
|
|
20
21
|
export { linkingProvider } from './LinkingProvider';
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/lib/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,qBAAqB,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,qBAAqB,EAAC,MAAM,cAAc,CAAC;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC"}
|
package/lib/utils/date.d.ts
CHANGED
|
@@ -5,3 +5,19 @@ export declare const getPreviousMonth: (date: Date) => Date;
|
|
|
5
5
|
export declare const sameDate: (date1: Date, date2: Date) => boolean;
|
|
6
6
|
export declare const diffDate: (start: Date, end: Date) => number;
|
|
7
7
|
export declare const incrementDate: (date: Date, days: number) => Date;
|
|
8
|
+
declare const month: string[];
|
|
9
|
+
export declare const getDay: (date: Date, I18n: {
|
|
10
|
+
t: (key: string) => string;
|
|
11
|
+
}) => string;
|
|
12
|
+
export declare const getMonth: (date: Date, I18n: {
|
|
13
|
+
t: (key: string) => string;
|
|
14
|
+
}) => string;
|
|
15
|
+
export declare const getFullDateItems: (date: string, I18n: {
|
|
16
|
+
t: (key: string) => string;
|
|
17
|
+
}) => {
|
|
18
|
+
day: string;
|
|
19
|
+
date: number;
|
|
20
|
+
month: string;
|
|
21
|
+
year: number;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
package/lib/utils/date.js
CHANGED
|
@@ -54,4 +54,45 @@ export const diffDate = (start, end) => {
|
|
|
54
54
|
export const incrementDate = (date, days) => {
|
|
55
55
|
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + days);
|
|
56
56
|
};
|
|
57
|
+
const dayOfWeek = [
|
|
58
|
+
'Base_Day_Sun',
|
|
59
|
+
'Base_Day_Mon',
|
|
60
|
+
'Base_Day_Tue',
|
|
61
|
+
'Base_Day_Wed',
|
|
62
|
+
'Base_Day_Thu',
|
|
63
|
+
'Base_Day_Fri',
|
|
64
|
+
'Base_Day_Sat',
|
|
65
|
+
];
|
|
66
|
+
const month = [
|
|
67
|
+
'Base_Month_Jan',
|
|
68
|
+
'Base_Month_Feb',
|
|
69
|
+
'Base_Month_Mar',
|
|
70
|
+
'Base_Month_Apr',
|
|
71
|
+
'Base_Month_May',
|
|
72
|
+
'Base_Month_Jun',
|
|
73
|
+
'Base_Month_Jul',
|
|
74
|
+
'Base_Month_Aug',
|
|
75
|
+
'Base_Month_Sep',
|
|
76
|
+
'Base_Month_Oct',
|
|
77
|
+
'Base_Month_Nov',
|
|
78
|
+
'Base_Month_Dec',
|
|
79
|
+
];
|
|
80
|
+
export const getDay = (date, I18n) => {
|
|
81
|
+
return I18n.t(dayOfWeek[date.getDay()]);
|
|
82
|
+
};
|
|
83
|
+
export const getMonth = (date, I18n) => {
|
|
84
|
+
return I18n.t(month[date.getMonth()]);
|
|
85
|
+
};
|
|
86
|
+
export const getFullDateItems = (date, I18n) => {
|
|
87
|
+
if (date == null) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const _date = new Date(date);
|
|
91
|
+
return {
|
|
92
|
+
day: getDay(_date, I18n),
|
|
93
|
+
date: _date.getDate(),
|
|
94
|
+
month: getMonth(_date, I18n),
|
|
95
|
+
year: _date.getFullYear(),
|
|
96
|
+
};
|
|
97
|
+
};
|
|
57
98
|
//# 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;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAY,EAAW,EAAE;IAC9C,OAAO,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;AACvD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAW,EAAE;IAClD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,MAAM,GAAG,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAU,EAAQ,EAAE;IAC/C,IAAI,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;QAC1B,OAAO,IAAI,IAAI,CAAC,IAAI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AAc;IACd,cAAc;CACf,CAAC;AAEF,MAAM,KAAK,GAAG;IACZ,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,IAAU,EACV,IAAkC,EAC1B,EAAE;IACV,OAAO,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,IAAU,EACV,IAAkC,EAC1B,EAAE;IACV,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,IAAY,EACZ,IAAkC,EACwB,EAAE;IAC5D,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,OAAO,IAAI,CAAC;KACb;IAED,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IAE7B,OAAO;QACL,GAAG,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC;QACxB,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE;QACrB,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;QAC5B,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE;KAC1B,CAAC;AACJ,CAAC,CAAC"}
|
package/lib/utils/image.d.ts
CHANGED
|
@@ -4,3 +4,6 @@ export declare const useMetafileUri: () => (metafileId: number) => {
|
|
|
4
4
|
export declare const useBinaryImageUri: () => (id: number, version: number, model: string) => {
|
|
5
5
|
uri: string;
|
|
6
6
|
};
|
|
7
|
+
export declare const useBinaryPictureUri: () => (id: number, version: number, model: string) => {
|
|
8
|
+
uri: string;
|
|
9
|
+
};
|
package/lib/utils/image.js
CHANGED
|
@@ -19,7 +19,7 @@ import { useCallback } from 'react';
|
|
|
19
19
|
import { useSelector } from 'react-redux';
|
|
20
20
|
export const useMetafileUri = () => {
|
|
21
21
|
const { baseUrl } = useSelector((state) => state.auth);
|
|
22
|
-
return useCallback((metafileId) => metafileId
|
|
22
|
+
return useCallback((metafileId) => metafileId != null
|
|
23
23
|
? {
|
|
24
24
|
uri: `${baseUrl}ws/rest/com.axelor.meta.db.MetaFile/${metafileId}/content/download`,
|
|
25
25
|
}
|
|
@@ -27,9 +27,17 @@ export const useMetafileUri = () => {
|
|
|
27
27
|
};
|
|
28
28
|
export const useBinaryImageUri = () => {
|
|
29
29
|
const { baseUrl } = useSelector((state) => state.auth);
|
|
30
|
-
return useCallback((id, version, model) => id && version && model
|
|
30
|
+
return useCallback((id, version, model) => id != null && version != null && model != null
|
|
31
31
|
? {
|
|
32
|
-
uri: `${baseUrl}ws/${model}/${id}/image/download?v=${version}&parentId=${id}&parentModel=${model}&image=true`,
|
|
32
|
+
uri: `${baseUrl}ws/rest/${model}/${id}/image/download?v=${version}&parentId=${id}&parentModel=${model}&image=true`,
|
|
33
|
+
}
|
|
34
|
+
: null, [baseUrl]);
|
|
35
|
+
};
|
|
36
|
+
export const useBinaryPictureUri = () => {
|
|
37
|
+
const { baseUrl } = useSelector((state) => state.auth);
|
|
38
|
+
return useCallback((id, version, model) => id != null && version != null && model != null
|
|
39
|
+
? {
|
|
40
|
+
uri: `${baseUrl}ws/rest/${model}/${id}/picture/download?v=${version}&parentId=${id}&parentModel=${model}&image=true`,
|
|
33
41
|
}
|
|
34
42
|
: null, [baseUrl]);
|
|
35
43
|
};
|
package/lib/utils/image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../src/utils/image.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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,CAAC;YACE,GAAG,EAAE,GAAG,OAAO,WAAW,KAAK,IAAI,EAAE,qBAAqB,OAAO,aAAa,EAAE,gBAAgB,KAAK,aAAa;SACnH;QACH,CAAC,CAAC,IAAI,EACV,CAAC,OAAO,CAAC,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,MAAM,EAAC,OAAO,EAAC,GAAG,WAAW,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE1D,OAAO,WAAW,CAChB,CAAC,EAAU,EAAE,OAAe,EAAE,KAAa,EAAE,EAAE,CAC7C,EAAE,IAAI,IAAI,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI;QAC5C,CAAC,CAAC;YACE,GAAG,EAAE,GAAG,OAAO,WAAW,KAAK,IAAI,EAAE,uBAAuB,OAAO,aAAa,EAAE,gBAAgB,KAAK,aAAa;SACrH;QACH,CAAC,CAAC,IAAI,EACV,CAAC,OAAO,CAAC,CACV,CAAC;AACJ,CAAC,CAAC"}
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { updateAgendaItems } from './agenda';
|
|
2
|
-
export { isDate, isDateTime, getNextMonth, getPreviousMonth, diffDate, sameDate, incrementDate, } from './date';
|
|
2
|
+
export { isDate, isDateTime, getNextMonth, getPreviousMonth, diffDate, sameDate, incrementDate, getDay, getMonth, getFullDateItems, } from './date';
|
|
3
3
|
export { displayItemName } from './displayers';
|
|
4
4
|
export { formatDate, formatDateTime, formatTime, formatScan, formatURL, } from './formatters';
|
|
5
|
-
export { useBinaryImageUri, useMetafileUri } from './image';
|
|
5
|
+
export { useBinaryImageUri, useBinaryPictureUri, useMetafileUri } from './image';
|
|
6
6
|
export { filterList, filterListContain } from './list';
|
|
7
7
|
export { calculateDiff, formatDuration, formatTwoNumber, getIntegerPart, } from './time';
|
|
8
8
|
export { areObjectsEquals, isEmpty, fetchJsonField, filterObjectsFields, pickFieldsOfObject, isPlainObject, } from './object';
|
package/lib/utils/index.js
CHANGED
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
export { updateAgendaItems } from './agenda';
|
|
19
|
-
export { isDate, isDateTime, getNextMonth, getPreviousMonth, diffDate, sameDate, incrementDate, } from './date';
|
|
19
|
+
export { isDate, isDateTime, getNextMonth, getPreviousMonth, diffDate, sameDate, incrementDate, getDay, getMonth, getFullDateItems, } from './date';
|
|
20
20
|
export { displayItemName } from './displayers';
|
|
21
21
|
export { formatDate, formatDateTime, formatTime, formatScan, formatURL, } from './formatters';
|
|
22
|
-
export { useBinaryImageUri, useMetafileUri } from './image';
|
|
22
|
+
export { useBinaryImageUri, useBinaryPictureUri, useMetafileUri } from './image';
|
|
23
23
|
export { filterList, filterListContain } from './list';
|
|
24
24
|
export { calculateDiff, formatDuration, formatTwoNumber, getIntegerPart, } from './time';
|
|
25
25
|
export { areObjectsEquals, isEmpty, fetchJsonField, filterObjectsFields, pickFieldsOfObject, isPlainObject, } from './object';
|