cozy-harvest-lib 9.12.2 → 9.14.0
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 +33 -0
- package/dist/components/InAppBrowser.js +19 -14
- package/dist/components/KonnectorConfiguration/ConfigurationTab/EditContract.js +2 -1
- package/dist/components/RedirectToAccountFormButton.js +2 -1
- package/dist/components/RedirectToAccountFormButton.spec.js +1 -1
- package/dist/locales/en.json +1 -1
- package/dist/locales/fr.json +1 -1
- package/package.json +2 -2
- package/src/components/InAppBrowser.jsx +6 -1
- package/src/components/KonnectorConfiguration/ConfigurationTab/EditContract.jsx +2 -1
- package/src/components/RedirectToAccountFormButton.jsx +1 -0
- package/src/components/RedirectToAccountFormButton.spec.jsx +1 -1
- package/src/locales/en.json +1 -1
- package/src/locales/fr.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,39 @@
|
|
|
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.14.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.13.0...cozy-harvest-lib@9.14.0) (2022-06-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **cozy-harvest-lib:** Change RedirectToAccountFormButton label & size ([7eca527](https://github.com/cozy/cozy-libs/commit/7eca527d3412fd86777f2e4c96327e3c8f8ca686))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [9.13.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.12.3...cozy-harvest-lib@9.13.0) (2022-06-21)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **cozy-harvest-lib:** Remove sync contract switch for BI webview ([fb1d46e](https://github.com/cozy/cozy-libs/commit/fb1d46ef327350b656ccbe43650fdbf35d7470fb))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [9.12.3](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.12.2...cozy-harvest-lib@9.12.3) (2022-06-21)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* Do not double encode url ([b44f843](https://github.com/cozy/cozy-libs/commit/b44f843a010514973b1fac8bcc5d980ab9af4d9e))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
6
39
|
## [9.12.2](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.12.1...cozy-harvest-lib@9.12.2) (2022-06-20)
|
|
7
40
|
|
|
8
41
|
|
|
@@ -32,54 +32,59 @@ var InAppBrowser = function InAppBrowser(_ref) {
|
|
|
32
32
|
|
|
33
33
|
function _insideEffect() {
|
|
34
34
|
_insideEffect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
35
|
-
var sessionCode, iabUrl, result;
|
|
35
|
+
var sessionCode, iabUrl, urlToOpen, result;
|
|
36
36
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
37
37
|
while (1) {
|
|
38
38
|
switch (_context.prev = _context.next) {
|
|
39
39
|
case 0:
|
|
40
40
|
if (!isReady) {
|
|
41
|
-
_context.next =
|
|
41
|
+
_context.next = 21;
|
|
42
42
|
break;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
_context.prev = 1;
|
|
46
|
-
|
|
46
|
+
logger.debug('url at the beginning: ', url);
|
|
47
|
+
_context.next = 5;
|
|
47
48
|
return fetchSessionCode();
|
|
48
49
|
|
|
49
|
-
case
|
|
50
|
+
case 5:
|
|
50
51
|
sessionCode = _context.sent;
|
|
51
52
|
logger.debug('got session code', sessionCode);
|
|
52
53
|
iabUrl = new URL(url);
|
|
53
|
-
iabUrl.searchParams.append(tokenParamName, sessionCode);
|
|
54
|
-
|
|
55
|
-
return showInAppBrowser(iabUrl.toString());
|
|
54
|
+
iabUrl.searchParams.append(tokenParamName, sessionCode); // we need to decodeURIComponent since toString() encodes URL
|
|
55
|
+
// but native browser will also encode them.
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
urlToOpen = decodeURIComponent(iabUrl.toString());
|
|
58
|
+
logger.debug('url to open: ', urlToOpen);
|
|
59
|
+
_context.next = 13;
|
|
60
|
+
return showInAppBrowser(urlToOpen);
|
|
61
|
+
|
|
62
|
+
case 13:
|
|
58
63
|
result = _context.sent;
|
|
59
64
|
|
|
60
65
|
if ((result === null || result === void 0 ? void 0 : result.type) !== 'dismiss' && (result === null || result === void 0 ? void 0 : result.type) !== 'cancel') {
|
|
61
66
|
logger.error('Unexpected InAppBrowser result', result);
|
|
62
67
|
}
|
|
63
68
|
|
|
64
|
-
_context.next =
|
|
69
|
+
_context.next = 20;
|
|
65
70
|
break;
|
|
66
71
|
|
|
67
|
-
case
|
|
68
|
-
_context.prev =
|
|
72
|
+
case 17:
|
|
73
|
+
_context.prev = 17;
|
|
69
74
|
_context.t0 = _context["catch"](1);
|
|
70
75
|
logger.error('unexpected fetchSessionCode result', _context.t0);
|
|
71
76
|
|
|
72
|
-
case
|
|
77
|
+
case 20:
|
|
73
78
|
if (onClose) {
|
|
74
79
|
onClose();
|
|
75
80
|
}
|
|
76
81
|
|
|
77
|
-
case
|
|
82
|
+
case 21:
|
|
78
83
|
case "end":
|
|
79
84
|
return _context.stop();
|
|
80
85
|
}
|
|
81
86
|
}
|
|
82
|
-
}, _callee, null, [[1,
|
|
87
|
+
}, _callee, null, [[1, 17]]);
|
|
83
88
|
}));
|
|
84
89
|
return _insideEffect.apply(this, arguments);
|
|
85
90
|
}
|
|
@@ -20,6 +20,7 @@ import Dialog, { DialogContent, DialogTitle } from 'cozy-ui/transpiled/react/Dia
|
|
|
20
20
|
import Divider from 'cozy-ui/transpiled/react/MuiCozyTheme/Divider';
|
|
21
21
|
import Icon from 'cozy-ui/transpiled/react/Icon';
|
|
22
22
|
import TrashIcon from 'cozy-ui/transpiled/react/Icons/Trash';
|
|
23
|
+
import flag from 'cozy-flags';
|
|
23
24
|
import { findKonnectorPolicy } from '../../../konnector-policies';
|
|
24
25
|
import { buildAppsByIdQuery } from '../../../helpers/queries';
|
|
25
26
|
import withLocales from '../../hoc/withLocales';
|
|
@@ -304,7 +305,7 @@ var EditContract = function EditContract(props) {
|
|
|
304
305
|
label: t('contractForm.apply'),
|
|
305
306
|
theme: "primary",
|
|
306
307
|
className: "u-ml-0"
|
|
307
|
-
})))), /*#__PURE__*/React.createElement(Divider, null), policy && policy.setSync ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(NonGrowingDialogContent, {
|
|
308
|
+
})))), /*#__PURE__*/React.createElement(Divider, null), policy && policy.setSync && !flag('harvest.bi.webview') ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(NonGrowingDialogContent, {
|
|
308
309
|
className: "u-pv-1"
|
|
309
310
|
}, /*#__PURE__*/React.createElement(SyncContractSwitch, {
|
|
310
311
|
fieldVariant: fieldVariant,
|
|
@@ -19,7 +19,7 @@ describe('redirect to account form button', function () {
|
|
|
19
19
|
}, /*#__PURE__*/React.createElement(RedirectToAccountFormButton, {
|
|
20
20
|
trigger: trigger
|
|
21
21
|
}))));
|
|
22
|
-
fireEvent.click(root.getByText('
|
|
22
|
+
fireEvent.click(root.getByText('Set the connection'));
|
|
23
23
|
expect(replaceHistory).toHaveBeenCalledWith('/accounts/account-id-1337/edit?reconnect');
|
|
24
24
|
});
|
|
25
25
|
});
|
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.
|
|
3
|
+
"version": "9.14.0",
|
|
4
4
|
"description": "Provides logic, modules and components for Cozy's harvest applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"react-router-dom": "^5.0.1"
|
|
88
88
|
},
|
|
89
89
|
"sideEffects": false,
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "fe064610d59906fa30bd32b0582abbaab0980f63"
|
|
91
91
|
}
|
|
@@ -31,11 +31,16 @@ const InAppBrowser = ({ url, onClose, intentsApi = {} }) => {
|
|
|
31
31
|
async function insideEffect() {
|
|
32
32
|
if (isReady) {
|
|
33
33
|
try {
|
|
34
|
+
logger.debug('url at the beginning: ', url)
|
|
34
35
|
const sessionCode = await fetchSessionCode()
|
|
35
36
|
logger.debug('got session code', sessionCode)
|
|
36
37
|
const iabUrl = new URL(url)
|
|
37
38
|
iabUrl.searchParams.append(tokenParamName, sessionCode)
|
|
38
|
-
|
|
39
|
+
// we need to decodeURIComponent since toString() encodes URL
|
|
40
|
+
// but native browser will also encode them.
|
|
41
|
+
const urlToOpen = decodeURIComponent(iabUrl.toString())
|
|
42
|
+
logger.debug('url to open: ', urlToOpen)
|
|
43
|
+
const result = await showInAppBrowser(urlToOpen)
|
|
39
44
|
if (result?.type !== 'dismiss' && result?.type !== 'cancel') {
|
|
40
45
|
logger.error('Unexpected InAppBrowser result', result)
|
|
41
46
|
}
|
|
@@ -30,6 +30,7 @@ import Dialog, {
|
|
|
30
30
|
import Divider from 'cozy-ui/transpiled/react/MuiCozyTheme/Divider'
|
|
31
31
|
import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
32
32
|
import TrashIcon from 'cozy-ui/transpiled/react/Icons/Trash'
|
|
33
|
+
import flag from 'cozy-flags'
|
|
33
34
|
|
|
34
35
|
import { findKonnectorPolicy } from '../../../konnector-policies'
|
|
35
36
|
import { buildAppsByIdQuery } from '../../../helpers/queries'
|
|
@@ -256,7 +257,7 @@ const EditContract = props => {
|
|
|
256
257
|
</NonGrowingDialogContent>
|
|
257
258
|
)}
|
|
258
259
|
<Divider />
|
|
259
|
-
{policy && policy.setSync ? (
|
|
260
|
+
{policy && policy.setSync && !flag('harvest.bi.webview') ? (
|
|
260
261
|
<>
|
|
261
262
|
<NonGrowingDialogContent className="u-pv-1">
|
|
262
263
|
<SyncContractSwitch
|
|
@@ -22,7 +22,7 @@ describe('redirect to account form button', () => {
|
|
|
22
22
|
</MountPointContext.Provider>
|
|
23
23
|
</AppLike>
|
|
24
24
|
)
|
|
25
|
-
fireEvent.click(root.getByText('
|
|
25
|
+
fireEvent.click(root.getByText('Set the connection'))
|
|
26
26
|
expect(replaceHistory).toHaveBeenCalledWith(
|
|
27
27
|
'/accounts/account-id-1337/edit?reconnect'
|
|
28
28
|
)
|
package/src/locales/en.json
CHANGED
package/src/locales/fr.json
CHANGED