cozy-harvest-lib 9.26.2 → 9.26.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/CHANGELOG.md +11 -0
- package/dist/components/Routes.js +15 -2
- package/dist/helpers/useKonnectorWithTriggers.js +2 -1
- package/dist/locales/en.json +1 -0
- package/dist/locales/fr.json +1 -0
- package/package.json +2 -2
- package/src/components/Routes.jsx +13 -5
- package/src/helpers/useKonnectorWithTriggers.js +5 -1
- package/src/locales/en.json +1 -0
- package/src/locales/fr.json +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [9.26.3](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.26.2...cozy-harvest-lib@9.26.3) (2022-08-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **harvest:** Handle not existing applications ([2e6c7f6](https://github.com/cozy/cozy-libs/commit/2e6c7f6f3558019f3d6ce915a91afd2c4870773e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [9.26.2](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.26.1...cozy-harvest-lib@9.26.2) (2022-08-26)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package cozy-harvest-lib
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
3
|
import { Switch, Route, Redirect } from 'react-router';
|
|
4
4
|
import { withStyles } from '@material-ui/core/styles';
|
|
5
|
+
import Alerter from 'cozy-ui/transpiled/react/Alerter';
|
|
5
6
|
import Dialog from 'cozy-ui/transpiled/react/Dialog';
|
|
6
7
|
import { DialogCloseButton, useCozyDialog } from 'cozy-ui/transpiled/react/CozyDialogs';
|
|
8
|
+
import { useI18n } from 'cozy-ui/transpiled/react/I18n';
|
|
7
9
|
import Spinner from 'cozy-ui/transpiled/react/Spinner';
|
|
8
10
|
import { useVaultUnlockContext, VaultUnlockProvider, VaultUnlockPlaceholder } from 'cozy-keys-lib';
|
|
9
11
|
import KonnectorAccounts from './KonnectorAccounts';
|
|
@@ -50,6 +52,10 @@ var Routes = function Routes(_ref) {
|
|
|
50
52
|
konnectorSlug = _ref.konnectorSlug,
|
|
51
53
|
onDismiss = _ref.onDismiss,
|
|
52
54
|
datacardOptions = _ref.datacardOptions;
|
|
55
|
+
|
|
56
|
+
var _useI18n = useI18n(),
|
|
57
|
+
t = _useI18n.t;
|
|
58
|
+
|
|
53
59
|
var dialogContext = useCozyDialog({
|
|
54
60
|
size: 'l',
|
|
55
61
|
open: true,
|
|
@@ -58,8 +64,15 @@ var Routes = function Routes(_ref) {
|
|
|
58
64
|
|
|
59
65
|
var _useKonnectorWithTrig = useKonnectorWithTriggers(konnectorSlug, konnector),
|
|
60
66
|
konnectorWithTriggers = _useKonnectorWithTrig.konnectorWithTriggers,
|
|
61
|
-
fetching = _useKonnectorWithTrig.fetching
|
|
67
|
+
fetching = _useKonnectorWithTrig.fetching,
|
|
68
|
+
notFoundError = _useKonnectorWithTrig.notFoundError;
|
|
62
69
|
|
|
70
|
+
useEffect(function () {
|
|
71
|
+
if (notFoundError) {
|
|
72
|
+
onDismiss();
|
|
73
|
+
Alerter.error(t('error.application-not-found'));
|
|
74
|
+
}
|
|
75
|
+
}, [notFoundError, onDismiss, t]);
|
|
63
76
|
return /*#__PURE__*/React.createElement(DatacardOptions, {
|
|
64
77
|
options: datacardOptions
|
|
65
78
|
}, /*#__PURE__*/React.createElement(MountPointProvider, {
|
|
@@ -109,7 +109,8 @@ export var useKonnectorWithTriggers = function useKonnectorWithTriggers(slug, in
|
|
|
109
109
|
|
|
110
110
|
return {
|
|
111
111
|
konnectorWithTriggers: konnectorWithTriggers,
|
|
112
|
-
fetching: isFetching
|
|
112
|
+
fetching: isFetching,
|
|
113
|
+
notFoundError: !isFetching && !konnector
|
|
113
114
|
};
|
|
114
115
|
};
|
|
115
116
|
|
package/dist/locales/en.json
CHANGED
package/dist/locales/fr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-harvest-lib",
|
|
3
|
-
"version": "9.26.
|
|
3
|
+
"version": "9.26.3",
|
|
4
4
|
"description": "Provides logic, modules and components for Cozy's harvest applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"react-router-dom": "^5.0.1"
|
|
91
91
|
},
|
|
92
92
|
"sideEffects": false,
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "fd469b64e78f720485736bf258d703e990cc11ed"
|
|
94
94
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
2
|
import { Switch, Route, Redirect } from 'react-router'
|
|
3
3
|
import { withStyles } from '@material-ui/core/styles'
|
|
4
4
|
|
|
5
|
+
import Alerter from 'cozy-ui/transpiled/react/Alerter'
|
|
5
6
|
import Dialog from 'cozy-ui/transpiled/react/Dialog'
|
|
6
7
|
import {
|
|
7
8
|
DialogCloseButton,
|
|
8
9
|
useCozyDialog
|
|
9
10
|
} from 'cozy-ui/transpiled/react/CozyDialogs'
|
|
11
|
+
import { useI18n } from 'cozy-ui/transpiled/react/I18n'
|
|
10
12
|
import Spinner from 'cozy-ui/transpiled/react/Spinner'
|
|
11
13
|
import {
|
|
12
14
|
useVaultUnlockContext,
|
|
@@ -57,16 +59,22 @@ const Routes = ({
|
|
|
57
59
|
onDismiss,
|
|
58
60
|
datacardOptions
|
|
59
61
|
}) => {
|
|
62
|
+
const { t } = useI18n()
|
|
60
63
|
const dialogContext = useCozyDialog({
|
|
61
64
|
size: 'l',
|
|
62
65
|
open: true,
|
|
63
66
|
onClose: onDismiss
|
|
64
67
|
})
|
|
65
68
|
|
|
66
|
-
const { konnectorWithTriggers, fetching } =
|
|
67
|
-
konnectorSlug,
|
|
68
|
-
|
|
69
|
-
)
|
|
69
|
+
const { konnectorWithTriggers, fetching, notFoundError } =
|
|
70
|
+
useKonnectorWithTriggers(konnectorSlug, konnector)
|
|
71
|
+
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (notFoundError) {
|
|
74
|
+
onDismiss()
|
|
75
|
+
Alerter.error(t('error.application-not-found'))
|
|
76
|
+
}
|
|
77
|
+
}, [notFoundError, onDismiss, t])
|
|
70
78
|
|
|
71
79
|
return (
|
|
72
80
|
<DatacardOptions options={datacardOptions}>
|
|
@@ -50,7 +50,11 @@ export const useKonnectorWithTriggers = (slug, injectedKonnector) => {
|
|
|
50
50
|
...konnector,
|
|
51
51
|
triggers
|
|
52
52
|
}
|
|
53
|
-
return {
|
|
53
|
+
return {
|
|
54
|
+
konnectorWithTriggers,
|
|
55
|
+
fetching: isFetching,
|
|
56
|
+
notFoundError: !isFetching && !konnector
|
|
57
|
+
}
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
function isKonnectorTrigger(doc) {
|
package/src/locales/en.json
CHANGED