cozy-harvest-lib 29.0.0 → 29.1.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 +6 -0
- package/dist/components/AccountForm/__snapshots__/index.spec.jsx.snap +4 -1
- package/dist/components/AccountForm/index.js +3 -4
- package/dist/components/AccountModal.js +3 -20
- package/dist/components/AccountModal.spec.js +1 -34
- package/dist/components/EditAccountModal.js +1 -2
- package/dist/components/KonnectorConfiguration/DataTab/index.js +4 -15
- package/dist/components/KonnectorConfiguration/DataTab.spec.js +0 -7
- package/dist/components/KonnectorConfiguration/KonnectorAccountWrapper.js +2 -11
- package/dist/components/KonnectorConfiguration/KonnectorAccountWrapper.spec.js +2 -8
- package/dist/components/NewAccountModal.js +0 -6
- package/dist/components/NewAccountModal.spec.js +0 -34
- package/dist/components/Routes/RoutesV4.js +1 -29
- package/dist/components/Routes/RoutesV6.js +1 -14
- package/dist/components/Routes.js +4 -37
- package/dist/components/__snapshots__/AccountModal.spec.jsx.snap +86 -101
- package/dist/components/cards/LaunchTriggerCard.js +4 -95
- package/dist/components/cards/LaunchTriggerCard.spec.js +3 -88
- package/dist/components/cards/__snapshots__/LaunchTriggerCard.spec.jsx.snap +1 -3
- package/package.json +2 -2
- package/src/components/AccountForm/__snapshots__/index.spec.jsx.snap +4 -1
- package/src/components/AccountForm/index.jsx +12 -18
- package/src/components/AccountModal.jsx +8 -33
- package/src/components/AccountModal.spec.jsx +2 -22
- package/src/components/EditAccountModal.jsx +1 -4
- package/src/components/KonnectorConfiguration/DataTab/index.jsx +9 -23
- package/src/components/KonnectorConfiguration/DataTab.spec.jsx +0 -6
- package/src/components/KonnectorConfiguration/KonnectorAccountWrapper.jsx +1 -9
- package/src/components/KonnectorConfiguration/KonnectorAccountWrapper.spec.jsx +2 -9
- package/src/components/NewAccountModal.jsx +0 -7
- package/src/components/NewAccountModal.spec.jsx +1 -36
- package/src/components/Routes/RoutesV4.jsx +28 -67
- package/src/components/Routes/RoutesV6.jsx +38 -60
- package/src/components/Routes.jsx +4 -34
- package/src/components/__snapshots__/AccountModal.spec.jsx.snap +86 -101
- package/src/components/cards/LaunchTriggerCard.jsx +2 -106
- package/src/components/cards/LaunchTriggerCard.spec.jsx +1 -72
- package/src/components/cards/__snapshots__/LaunchTriggerCard.spec.jsx.snap +1 -3
- package/dist/components/KonnectorConfiguration/KonnectorAccountTabs.js +0 -208
- package/dist/components/KonnectorConfiguration/KonnectorAccountTabs.spec.js +0 -335
- package/src/components/KonnectorConfiguration/KonnectorAccountTabs.jsx +0 -202
- package/src/components/KonnectorConfiguration/KonnectorAccountTabs.spec.jsx +0 -169
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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
|
+
# [29.1.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@29.0.0...cozy-harvest-lib@29.1.0) (2024-09-03)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- Remove `harvest.inappconnectors.enabled` flag ([d145900](https://github.com/cozy/cozy-libs/commit/d145900f2ce80ed4124a52917a3aa37c7ade4043))
|
|
11
|
+
|
|
6
12
|
# [29.0.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@28.0.0...cozy-harvest-lib@29.0.0) (2024-08-29)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
@@ -28,6 +28,7 @@ exports[`AccountForm should not render error 1`] = `
|
|
|
28
28
|
t={[Function]}
|
|
29
29
|
/>
|
|
30
30
|
<ForwardRef
|
|
31
|
+
busy={false}
|
|
31
32
|
className="u-mt-2 u-mb-1-half"
|
|
32
33
|
data-testid="submit-btn"
|
|
33
34
|
disabled={false}
|
|
@@ -67,6 +68,7 @@ exports[`AccountForm should render 1`] = `
|
|
|
67
68
|
t={[Function]}
|
|
68
69
|
/>
|
|
69
70
|
<ForwardRef
|
|
71
|
+
busy={false}
|
|
70
72
|
className="u-mt-2 u-mb-1-half"
|
|
71
73
|
data-testid="submit-btn"
|
|
72
74
|
disabled={true}
|
|
@@ -123,6 +125,7 @@ exports[`AccountForm should render error 1`] = `
|
|
|
123
125
|
t={[Function]}
|
|
124
126
|
/>
|
|
125
127
|
<ForwardRef
|
|
128
|
+
busy={false}
|
|
126
129
|
className="u-mt-2 u-mb-1-half"
|
|
127
130
|
data-testid="submit-btn"
|
|
128
131
|
disabled={false}
|
|
@@ -150,7 +153,7 @@ exports[`AccountForm should render normally when client side konnector with laun
|
|
|
150
153
|
<ConnectCard
|
|
151
154
|
buttonProps={
|
|
152
155
|
Object {
|
|
153
|
-
"busy":
|
|
156
|
+
"busy": false,
|
|
154
157
|
"data-testid": "submit-btn",
|
|
155
158
|
"disabled": false,
|
|
156
159
|
"label": "Connect",
|
|
@@ -20,7 +20,6 @@ import PropTypes from 'prop-types';
|
|
|
20
20
|
import React, { PureComponent } from 'react';
|
|
21
21
|
import { Form } from 'react-final-form';
|
|
22
22
|
import { isMobile } from 'cozy-device-helper';
|
|
23
|
-
import flag from 'cozy-flags';
|
|
24
23
|
import Button from 'cozy-ui/transpiled/react/Buttons';
|
|
25
24
|
import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs';
|
|
26
25
|
import Icon from 'cozy-ui/transpiled/react/Icon';
|
|
@@ -340,7 +339,7 @@ export var AccountForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
340
339
|
initialValues: values,
|
|
341
340
|
inputRefByName: _this3.inputRefByName,
|
|
342
341
|
t: t
|
|
343
|
-
}),
|
|
342
|
+
}), !konnector.clientSide && konnector.vendor_link && /*#__PURE__*/React.createElement(Link, {
|
|
344
343
|
className: "u-mt-1",
|
|
345
344
|
variant: "body1",
|
|
346
345
|
component: "button",
|
|
@@ -351,7 +350,7 @@ export var AccountForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
351
350
|
name: konnector.name
|
|
352
351
|
}),
|
|
353
352
|
buttonProps: _defineProperty({
|
|
354
|
-
busy:
|
|
353
|
+
busy: false,
|
|
355
354
|
disabled: submitting || !_this3.isSubmittable({
|
|
356
355
|
error: error,
|
|
357
356
|
valid: valid
|
|
@@ -362,7 +361,7 @@ export var AccountForm = /*#__PURE__*/function (_PureComponent) {
|
|
|
362
361
|
}
|
|
363
362
|
}, 'data-testid', 'submit-btn')
|
|
364
363
|
}) : /*#__PURE__*/React.createElement(Button, {
|
|
365
|
-
busy:
|
|
364
|
+
busy: false,
|
|
366
365
|
className: "u-mt-2 u-mb-1-half",
|
|
367
366
|
disabled: submitting || !_this3.isSubmittable({
|
|
368
367
|
error: error,
|
|
@@ -16,19 +16,15 @@ import flow from 'lodash/flow';
|
|
|
16
16
|
import get from 'lodash/get';
|
|
17
17
|
import PropTypes from 'prop-types';
|
|
18
18
|
import React, { Component } from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { withClient } from 'cozy-client';
|
|
20
20
|
import { triggers as triggersModel } from 'cozy-client/dist/models/trigger';
|
|
21
|
-
import flag from 'cozy-flags';
|
|
22
21
|
import Button from 'cozy-ui/transpiled/react/Buttons';
|
|
23
22
|
import DialogContent from 'cozy-ui/transpiled/react/DialogContent';
|
|
24
23
|
import Spinner from 'cozy-ui/transpiled/react/Spinner';
|
|
25
|
-
import Typography from 'cozy-ui/transpiled/react/Typography';
|
|
26
24
|
import Infos from 'cozy-ui/transpiled/react/deprecated/Infos';
|
|
27
25
|
import withBreakpoints from 'cozy-ui/transpiled/react/helpers/withBreakpoints';
|
|
28
26
|
import AccountModalHeader from './AccountModalWithoutTabs/AccountModalHeader';
|
|
29
|
-
import AccountSelectBox from './AccountSelectBox/AccountSelectBox';
|
|
30
27
|
import KonnectorAccountWrapper from './KonnectorConfiguration/KonnectorAccountWrapper';
|
|
31
|
-
import KonnectorModalHeader from './KonnectorModalHeader';
|
|
32
28
|
import { withMountPointProps } from './MountPointContext';
|
|
33
29
|
import withLocales from './hoc/withLocales';
|
|
34
30
|
import { fetchAccount as _fetchAccount } from '../connections/accounts';
|
|
@@ -250,7 +246,6 @@ export var AccountModal = /*#__PURE__*/function (_Component) {
|
|
|
250
246
|
onDismiss = _this$props2.onDismiss,
|
|
251
247
|
accountsAndTriggers = _this$props2.accountsAndTriggers,
|
|
252
248
|
t = _this$props2.t,
|
|
253
|
-
pushHistory = _this$props2.pushHistory,
|
|
254
249
|
replaceHistory = _this$props2.replaceHistory,
|
|
255
250
|
initialActiveTab = _this$props2.initialActiveTab,
|
|
256
251
|
isMobile = _this$props2.breakpoints.isMobile,
|
|
@@ -264,24 +259,12 @@ export var AccountModal = /*#__PURE__*/function (_Component) {
|
|
|
264
259
|
account = _this$state.account,
|
|
265
260
|
fetching = _this$state.fetching,
|
|
266
261
|
error = _this$state.error;
|
|
267
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
262
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AccountModalHeader, {
|
|
268
263
|
konnector: konnector,
|
|
269
264
|
account: account,
|
|
270
265
|
accountsAndTriggers: accountsAndTriggers,
|
|
271
266
|
showAccountSelection: showAccountSelection
|
|
272
|
-
})
|
|
273
|
-
konnector: konnector
|
|
274
|
-
}, showAccountSelection ? /*#__PURE__*/React.createElement(AccountSelectBox, {
|
|
275
|
-
loading: !account,
|
|
276
|
-
selectedAccount: account,
|
|
277
|
-
accountsAndTriggers: accountsAndTriggers,
|
|
278
|
-
onChange: function onChange(option) {
|
|
279
|
-
pushHistory("/accounts/".concat(option.account._id));
|
|
280
|
-
},
|
|
281
|
-
onCreate: function onCreate() {
|
|
282
|
-
pushHistory('/new');
|
|
283
|
-
}
|
|
284
|
-
}) : /*#__PURE__*/React.createElement(Typography, null, models.account.getAccountName(account))), (error || fetching) && /*#__PURE__*/React.createElement(DialogContent, {
|
|
267
|
+
}), (error || fetching) && /*#__PURE__*/React.createElement(DialogContent, {
|
|
285
268
|
className: "u-pb-2"
|
|
286
269
|
}, error && /*#__PURE__*/React.createElement(Infos, {
|
|
287
270
|
actionButton: /*#__PURE__*/React.createElement(Button, {
|
|
@@ -37,7 +37,6 @@ var accountsAndTriggersMock = [{
|
|
|
37
37
|
var accountIdMock = '123';
|
|
38
38
|
describe('AccountModal', function () {
|
|
39
39
|
var setup = function setup() {
|
|
40
|
-
var mockHistoryPush = jest.fn();
|
|
41
40
|
var mockHistoryReplace = jest.fn();
|
|
42
41
|
var component = shallow( /*#__PURE__*/React.createElement(AccountModal, {
|
|
43
42
|
konnector: {},
|
|
@@ -46,7 +45,6 @@ describe('AccountModal', function () {
|
|
|
46
45
|
},
|
|
47
46
|
accountId: accountIdMock,
|
|
48
47
|
accountsAndTriggers: accountsAndTriggersMock,
|
|
49
|
-
pushHistory: mockHistoryPush,
|
|
50
48
|
replaceHistory: mockHistoryReplace,
|
|
51
49
|
breakpoints: {
|
|
52
50
|
isMobile: true
|
|
@@ -55,7 +53,6 @@ describe('AccountModal', function () {
|
|
|
55
53
|
}));
|
|
56
54
|
return {
|
|
57
55
|
component: component,
|
|
58
|
-
mockHistoryPush: mockHistoryPush,
|
|
59
56
|
mockHistoryReplace: mockHistoryReplace
|
|
60
57
|
};
|
|
61
58
|
};
|
|
@@ -75,8 +72,7 @@ describe('AccountModal', function () {
|
|
|
75
72
|
var _setup2 = setup({
|
|
76
73
|
fetchAccount: fetchAccount
|
|
77
74
|
}),
|
|
78
|
-
component = _setup2.component
|
|
79
|
-
mockHistoryPush = _setup2.mockHistoryPush;
|
|
75
|
+
component = _setup2.component;
|
|
80
76
|
|
|
81
77
|
it('should display the AccountSelect & Content if an account is there and we can change the selectedAccount', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
82
78
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -110,34 +106,5 @@ describe('AccountModal', function () {
|
|
|
110
106
|
}
|
|
111
107
|
}, _callee);
|
|
112
108
|
})));
|
|
113
|
-
it('should redirect to the correct locations', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
114
|
-
var accountTabs;
|
|
115
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
116
|
-
while (1) {
|
|
117
|
-
switch (_context2.prev = _context2.next) {
|
|
118
|
-
case 0:
|
|
119
|
-
_context2.next = 2;
|
|
120
|
-
return component.instance().componentDidMount();
|
|
121
|
-
|
|
122
|
-
case 2:
|
|
123
|
-
component.find('AccountSelectBox').prop('onChange')({
|
|
124
|
-
account: {
|
|
125
|
-
_id: '123'
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
expect(mockHistoryPush).toHaveBeenCalledWith('/accounts/123');
|
|
129
|
-
component.find('AccountSelectBox').prop('onCreate')();
|
|
130
|
-
expect(mockHistoryPush).toHaveBeenCalledWith('/new');
|
|
131
|
-
accountTabs = component.find('KonnectorAccountWrapper');
|
|
132
|
-
accountTabs.prop('addAccount')();
|
|
133
|
-
expect(mockHistoryPush).toHaveBeenCalledWith('/new');
|
|
134
|
-
|
|
135
|
-
case 9:
|
|
136
|
-
case "end":
|
|
137
|
-
return _context2.stop();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}, _callee2);
|
|
141
|
-
})));
|
|
142
109
|
});
|
|
143
110
|
});
|
|
@@ -17,7 +17,6 @@ import PropTypes from 'prop-types';
|
|
|
17
17
|
import React, { Component } from 'react';
|
|
18
18
|
import { withClient } from 'cozy-client';
|
|
19
19
|
import { triggers as triggersModel } from 'cozy-client/dist/models/trigger';
|
|
20
|
-
import flag from 'cozy-flags';
|
|
21
20
|
import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs';
|
|
22
21
|
import Spinner from 'cozy-ui/transpiled/react/Spinner';
|
|
23
22
|
import { withMountPointProps } from './MountPointContext';
|
|
@@ -195,7 +194,7 @@ export var EditAccountModal = /*#__PURE__*/function (_Component) {
|
|
|
195
194
|
var account = this.state.account;
|
|
196
195
|
|
|
197
196
|
if (account) {
|
|
198
|
-
|
|
197
|
+
this.props.replaceHistory("/accounts/".concat(account._id, "/config"));
|
|
199
198
|
} else {
|
|
200
199
|
this.props.pushHistory("/accounts");
|
|
201
200
|
}
|
|
@@ -4,12 +4,10 @@ var _excluded = ["slug"];
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { withClient } from 'cozy-client';
|
|
7
|
-
import flag from 'cozy-flags';
|
|
8
7
|
import Divider from 'cozy-ui/transpiled/react/Divider';
|
|
9
8
|
import Stack from 'cozy-ui/transpiled/react/Stack';
|
|
10
9
|
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
|
|
11
10
|
import appLinksProps from '../../../components/KonnectorConfiguration/DataTab/appLinksProps';
|
|
12
|
-
import KonnectorMaintenance from '../../../components/Maintenance';
|
|
13
11
|
import AppLinkCard from '../../../components/cards/AppLinkCard';
|
|
14
12
|
import { InformationsCard } from '../../../components/cards/InformationsCard';
|
|
15
13
|
import LaunchTriggerCard from '../../../components/cards/LaunchTriggerCard';
|
|
@@ -54,11 +52,9 @@ export var DataTab = function DataTab(_ref) {
|
|
|
54
52
|
});
|
|
55
53
|
|
|
56
54
|
var _useMaintenanceStatus = useMaintenanceStatus(konnector.slug),
|
|
57
|
-
|
|
58
|
-
isInMaintenance = _useMaintenanceStatus2.isInMaintenance,
|
|
59
|
-
maintenanceMessages = _useMaintenanceStatus2.messages;
|
|
55
|
+
isInMaintenance = _useMaintenanceStatus.data.isInMaintenance;
|
|
60
56
|
|
|
61
|
-
return /*#__PURE__*/React.createElement("div", null,
|
|
57
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(LaunchTriggerCard, {
|
|
62
58
|
konnectorRoot: konnectorRoot,
|
|
63
59
|
flow: flow,
|
|
64
60
|
intentsApi: intentsApi,
|
|
@@ -66,18 +62,11 @@ export var DataTab = function DataTab(_ref) {
|
|
|
66
62
|
withMaintenanceDescription: true
|
|
67
63
|
}), isMobile && /*#__PURE__*/React.createElement(Divider, {
|
|
68
64
|
style: styles.divider
|
|
69
|
-
})
|
|
65
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
70
66
|
className: isMobile ? 'u-p-1' : 'u-pt-1 u-pb-1-half'
|
|
71
|
-
}, /*#__PURE__*/React.createElement(Stack, null, !
|
|
72
|
-
className: "u-bg-paleGrey u-p-1"
|
|
73
|
-
}, /*#__PURE__*/React.createElement(KonnectorMaintenance, {
|
|
74
|
-
maintenanceMessages: maintenanceMessages
|
|
75
|
-
})), !isInMaintenance && konnectorsModel.hasNewVersionAvailable(konnector) && /*#__PURE__*/React.createElement(KonnectorUpdateInfos, {
|
|
67
|
+
}, /*#__PURE__*/React.createElement(Stack, null, !isInMaintenance && konnectorsModel.hasNewVersionAvailable(konnector) && /*#__PURE__*/React.createElement(KonnectorUpdateInfos, {
|
|
76
68
|
konnector: konnector,
|
|
77
69
|
isBlocking: hasTermsVersionMismatchError
|
|
78
|
-
}), !flag('harvest.inappconnectors.enabled') && /*#__PURE__*/React.createElement(LaunchTriggerCard, {
|
|
79
|
-
flow: flow,
|
|
80
|
-
disabled: isInMaintenance
|
|
81
70
|
}), appLinks.map(function (_ref2) {
|
|
82
71
|
var slug = _ref2.slug,
|
|
83
72
|
otherProps = _objectWithoutProperties(_ref2, _excluded);
|
|
@@ -5,7 +5,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
|
|
7
7
|
import { DataTab } from 'components/KonnectorConfiguration/DataTab';
|
|
8
|
-
import KonnectorMaintenance from 'components/Maintenance';
|
|
9
8
|
import AppLinkCard from 'components/cards/AppLinkCard';
|
|
10
9
|
import LaunchTriggerCard from 'components/cards/LaunchTriggerCard';
|
|
11
10
|
import useMaintenanceStatus from 'components/hooks/useMaintenanceStatus';
|
|
@@ -69,12 +68,6 @@ describe('DataTab', function () {
|
|
|
69
68
|
var component = setup();
|
|
70
69
|
expect(component.find(LaunchTriggerCard).length).toEqual(1);
|
|
71
70
|
});
|
|
72
|
-
it('should show maintenance info', function () {
|
|
73
|
-
var component = setup({}, {
|
|
74
|
-
isInMaintenance: true
|
|
75
|
-
});
|
|
76
|
-
expect(component.find(KonnectorMaintenance).length).toEqual(1);
|
|
77
|
-
});
|
|
78
71
|
describe('links to other apps', function () {
|
|
79
72
|
it('should show the link to banks', function () {
|
|
80
73
|
var withoutAccounts = setup({
|
|
@@ -3,8 +3,6 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
var _excluded = ["Component"];
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import flag from 'cozy-flags';
|
|
7
|
-
import KonnectorAccountTabs from './KonnectorAccountTabs';
|
|
8
6
|
import { intentsApiProptype, innerAccountModalOverridesProptype } from '../../helpers/proptypes';
|
|
9
7
|
import FlowProvider from '../FlowProvider';
|
|
10
8
|
export var KonnectorAccountWrapper = function KonnectorAccountWrapper(props) {
|
|
@@ -16,15 +14,8 @@ export var KonnectorAccountWrapper = function KonnectorAccountWrapper(props) {
|
|
|
16
14
|
konnector: props.konnector
|
|
17
15
|
}, function (_ref) {
|
|
18
16
|
var flow = _ref.flow;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
22
|
-
trigger: rest.initialTrigger,
|
|
23
|
-
flow: flow
|
|
24
|
-
}));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return /*#__PURE__*/React.createElement(KonnectorAccountTabs, _extends({}, rest, {
|
|
17
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
|
|
18
|
+
trigger: rest.initialTrigger,
|
|
28
19
|
flow: flow
|
|
29
20
|
}));
|
|
30
21
|
});
|
|
@@ -39,12 +39,6 @@ jest.mock('react-router-dom', function () {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
});
|
|
42
|
-
jest.mock('cozy-flags', function () {
|
|
43
|
-
return function (flag) {
|
|
44
|
-
if (flag === 'harvest.inappconnectors.enabled') return true;
|
|
45
|
-
return false;
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
42
|
describe('KonnectorAccountWrapper', function () {
|
|
49
43
|
var setup = function setup() {
|
|
50
44
|
var mockClient = {
|
|
@@ -102,7 +96,7 @@ describe('KonnectorAccountWrapper', function () {
|
|
|
102
96
|
};
|
|
103
97
|
};
|
|
104
98
|
|
|
105
|
-
it('should render a configuration modal when
|
|
99
|
+
it('should render a configuration modal when allow account disconnect', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
106
100
|
var _setup, root, onAccountDeleted;
|
|
107
101
|
|
|
108
102
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
@@ -158,7 +152,7 @@ describe('KonnectorAccountWrapper', function () {
|
|
|
158
152
|
}
|
|
159
153
|
}, _callee3);
|
|
160
154
|
})));
|
|
161
|
-
it('should render a configuration modal when
|
|
155
|
+
it('should render a configuration modal when allow account creation', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
162
156
|
var _setup2, root, addAccount, button;
|
|
163
157
|
|
|
164
158
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
@@ -3,7 +3,6 @@ import cx from 'classnames';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React, { useContext } from 'react';
|
|
5
5
|
import { triggers as triggersModel } from 'cozy-client/dist/models/trigger';
|
|
6
|
-
import flag from 'cozy-flags';
|
|
7
6
|
import { DialogTitle } from 'cozy-ui/transpiled/react/Dialog';
|
|
8
7
|
import DialogContent from 'cozy-ui/transpiled/react/DialogContent';
|
|
9
8
|
import Spinner from 'cozy-ui/transpiled/react/Spinner';
|
|
@@ -57,11 +56,6 @@ var NewAccountModal = function NewAccountModal(_ref) {
|
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
var accountId = triggersModel.getAccountId(trigger);
|
|
60
|
-
|
|
61
|
-
if (!flag('harvest.inappconnectors.enabled') && trigger.worker !== 'client') {
|
|
62
|
-
replaceHistory("/accounts/".concat(accountId, "/success"));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
59
|
replaceHistory("/accounts/".concat(accountId));
|
|
66
60
|
};
|
|
67
61
|
|
|
@@ -31,12 +31,6 @@ describe('NewAccountModal', function () {
|
|
|
31
31
|
var mountPointContextValue = {
|
|
32
32
|
replaceHistory: replaceHistory
|
|
33
33
|
};
|
|
34
|
-
var konnectorTrigger = {
|
|
35
|
-
worker: 'konnector',
|
|
36
|
-
message: {
|
|
37
|
-
account: 'accountNumber'
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
34
|
var clientTrigger = {
|
|
41
35
|
worker: 'client',
|
|
42
36
|
message: {
|
|
@@ -46,20 +40,6 @@ describe('NewAccountModal', function () {
|
|
|
46
40
|
afterEach(function () {
|
|
47
41
|
jest.clearAllMocks();
|
|
48
42
|
});
|
|
49
|
-
it('should redirect to success route on login success for non client triggers', function () {
|
|
50
|
-
render( /*#__PURE__*/React.createElement(AppLike, {
|
|
51
|
-
client: {}
|
|
52
|
-
}, /*#__PURE__*/React.createElement(MountPointContext.Provider, {
|
|
53
|
-
value: mountPointContextValue
|
|
54
|
-
}, /*#__PURE__*/React.createElement(NewAccountModal, {
|
|
55
|
-
konnector: {
|
|
56
|
-
slug: 'konnectorslug',
|
|
57
|
-
name: 'konnector slug'
|
|
58
|
-
}
|
|
59
|
-
}))));
|
|
60
|
-
onLoginSuccessFn(konnectorTrigger);
|
|
61
|
-
expect(replaceHistory).toHaveBeenCalledWith('/accounts/accountNumber/success');
|
|
62
|
-
});
|
|
63
43
|
it('should redirect to route without success on login success for client triggers', function () {
|
|
64
44
|
render( /*#__PURE__*/React.createElement(AppLike, {
|
|
65
45
|
client: {}
|
|
@@ -74,20 +54,6 @@ describe('NewAccountModal', function () {
|
|
|
74
54
|
onLoginSuccessFn(clientTrigger);
|
|
75
55
|
expect(replaceHistory).toHaveBeenCalledWith('/accounts/accountNumberClient');
|
|
76
56
|
});
|
|
77
|
-
it('should redirect to success route on success for non client triggers', function () {
|
|
78
|
-
render( /*#__PURE__*/React.createElement(AppLike, {
|
|
79
|
-
client: {}
|
|
80
|
-
}, /*#__PURE__*/React.createElement(MountPointContext.Provider, {
|
|
81
|
-
value: mountPointContextValue
|
|
82
|
-
}, /*#__PURE__*/React.createElement(NewAccountModal, {
|
|
83
|
-
konnector: {
|
|
84
|
-
slug: 'konnectorslug',
|
|
85
|
-
name: 'konnector slug'
|
|
86
|
-
}
|
|
87
|
-
}))));
|
|
88
|
-
onSuccessFn(konnectorTrigger);
|
|
89
|
-
expect(replaceHistory).toHaveBeenCalledWith('/accounts/accountNumber/success');
|
|
90
|
-
});
|
|
91
57
|
it('should redirect to route without success on success for client triggers', function () {
|
|
92
58
|
render( /*#__PURE__*/React.createElement(AppLike, {
|
|
93
59
|
client: {}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Switch, Route, Redirect } from 'react-router-dom';
|
|
3
|
-
import flag from 'cozy-flags';
|
|
4
3
|
import AccountModal from '../AccountModal';
|
|
5
4
|
import EditAccountModal from '../EditAccountModal';
|
|
6
5
|
import HarvestModalRoot from '../HarvestModalRoot';
|
|
7
6
|
import ConfigurationTab from '../KonnectorConfiguration/ConfigurationTab';
|
|
8
7
|
import DataTab from '../KonnectorConfiguration/DataTab';
|
|
9
|
-
import KonnectorSuccess from '../KonnectorSuccess';
|
|
10
8
|
import NewAccountModal from '../NewAccountModal';
|
|
11
9
|
import withAdaptiveRouter from '../hoc/withRouter';
|
|
12
10
|
|
|
@@ -46,7 +44,7 @@ var RoutesV4 = function RoutesV4(_ref) {
|
|
|
46
44
|
onDismiss: onDismiss
|
|
47
45
|
});
|
|
48
46
|
}
|
|
49
|
-
}),
|
|
47
|
+
}), /*#__PURE__*/React.createElement(Route, {
|
|
50
48
|
path: "".concat(konnectorRoot, "/accounts/:accountId"),
|
|
51
49
|
exact: true,
|
|
52
50
|
render: function render(_ref3) {
|
|
@@ -76,32 +74,6 @@ var RoutesV4 = function RoutesV4(_ref) {
|
|
|
76
74
|
Component: ConfigurationTab
|
|
77
75
|
});
|
|
78
76
|
}
|
|
79
|
-
})) : /*#__PURE__*/React.createElement(Route, {
|
|
80
|
-
path: "".concat(konnectorRoot, "/accounts/:accountId"),
|
|
81
|
-
exact: true,
|
|
82
|
-
render: function render(_ref5) {
|
|
83
|
-
var match = _ref5.match;
|
|
84
|
-
return /*#__PURE__*/React.createElement(AccountModal, {
|
|
85
|
-
konnector: konnectorWithTriggers,
|
|
86
|
-
accountId: match.params.accountId,
|
|
87
|
-
accountsAndTriggers: accountsAndTriggers,
|
|
88
|
-
onDismiss: onDismiss,
|
|
89
|
-
showNewAccountButton: !konnectorWithTriggers.clientSide,
|
|
90
|
-
showAccountSelection: !konnectorWithTriggers.clientSide
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
}), !flag('harvest.inappconnectors.enabled') && /*#__PURE__*/React.createElement(Route, {
|
|
94
|
-
path: "".concat(konnectorRoot, "/accounts/:accountId/success"),
|
|
95
|
-
exact: true,
|
|
96
|
-
render: function render(_ref6) {
|
|
97
|
-
var match = _ref6.match;
|
|
98
|
-
return /*#__PURE__*/React.createElement(KonnectorSuccess, {
|
|
99
|
-
konnector: konnectorWithTriggers,
|
|
100
|
-
accountId: match.params.accountId,
|
|
101
|
-
accounts: accountsAndTriggers,
|
|
102
|
-
onDismiss: onDismiss
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
77
|
}), /*#__PURE__*/React.createElement(Redirect, {
|
|
106
78
|
from: "".concat(konnectorRoot, "/*"),
|
|
107
79
|
to: "".concat(konnectorRoot, "/")
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Routes, Route, Navigate, useParams } from 'react-router-dom';
|
|
3
|
-
import flag from 'cozy-flags';
|
|
4
3
|
import { ViewerModal } from '../../datacards/ViewerModal';
|
|
5
4
|
import AccountModal from '../AccountModal';
|
|
6
5
|
import EditAccountModal from '../EditAccountModal';
|
|
@@ -33,7 +32,7 @@ var RoutesV6 = function RoutesV6(_ref) {
|
|
|
33
32
|
onSuccess: onSuccess,
|
|
34
33
|
onDismiss: onDismiss
|
|
35
34
|
})
|
|
36
|
-
}),
|
|
35
|
+
}), /*#__PURE__*/React.createElement(Route, {
|
|
37
36
|
path: "accounts/:accountId",
|
|
38
37
|
element: /*#__PURE__*/React.createElement(HarvestParamsWrapper, null, function (params) {
|
|
39
38
|
return /*#__PURE__*/React.createElement(AccountModal, {
|
|
@@ -59,18 +58,6 @@ var RoutesV6 = function RoutesV6(_ref) {
|
|
|
59
58
|
Component: ConfigurationTab
|
|
60
59
|
});
|
|
61
60
|
})
|
|
62
|
-
})) : /*#__PURE__*/React.createElement(Route, {
|
|
63
|
-
path: "accounts/:accountId",
|
|
64
|
-
element: /*#__PURE__*/React.createElement(HarvestParamsWrapper, null, function (params) {
|
|
65
|
-
return /*#__PURE__*/React.createElement(AccountModal, {
|
|
66
|
-
konnector: konnectorWithTriggers,
|
|
67
|
-
accountId: params.accountId,
|
|
68
|
-
accountsAndTriggers: accountsAndTriggers,
|
|
69
|
-
onDismiss: onDismiss,
|
|
70
|
-
showNewAccountButton: !konnectorWithTriggers.clientSide,
|
|
71
|
-
showAccountSelection: !konnectorWithTriggers.clientSide
|
|
72
|
-
});
|
|
73
|
-
})
|
|
74
61
|
}), /*#__PURE__*/React.createElement(Route, {
|
|
75
62
|
path: "accounts/:accountId/edit",
|
|
76
63
|
element: /*#__PURE__*/React.createElement(HarvestParamsWrapper, null, function (params) {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React, { useEffect } from 'react';
|
|
4
|
-
import flag from 'cozy-flags';
|
|
5
4
|
import { useVaultUnlockContext, VaultUnlockPlaceholder } from 'cozy-keys-lib';
|
|
6
5
|
import { DialogCloseButton, useCozyDialog } from 'cozy-ui/transpiled/react/CozyDialogs';
|
|
7
6
|
import Dialog from 'cozy-ui/transpiled/react/Dialog';
|
|
8
7
|
import Spinner from 'cozy-ui/transpiled/react/Spinner';
|
|
9
8
|
import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert';
|
|
10
9
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
11
|
-
import { withStyles } from 'cozy-ui/transpiled/react/styles';
|
|
12
10
|
import { DatacardOptions } from './Datacards/DatacardOptionsContext';
|
|
13
11
|
import DialogContext from './DialogContext';
|
|
14
12
|
import HarvestWrapper from './HarvestWrapper';
|
|
@@ -18,38 +16,7 @@ import RoutesV6 from './Routes/RoutesV6';
|
|
|
18
16
|
import { isRouterV6 } from './hoc/withRouter';
|
|
19
17
|
import { useKonnectorWithTriggers } from '../helpers/useKonnectorWithTriggers';
|
|
20
18
|
|
|
21
|
-
var
|
|
22
|
-
/**
|
|
23
|
-
* When this flag is enabled, tabs are removed, and the layout shift between
|
|
24
|
-
* data and configuration screens is not as disturbing as with tabs. So we do
|
|
25
|
-
* not need to customize styles to align the dialog at the top anymore and we
|
|
26
|
-
* can just return the identity function. This whole HOC should be able to be
|
|
27
|
-
* removed at the same time as the flag. See the next comment for the former
|
|
28
|
-
* behavior.
|
|
29
|
-
*/
|
|
30
|
-
if (flag('harvest.inappconnectors.enabled')) {
|
|
31
|
-
return function (component) {
|
|
32
|
-
return component;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Dialog will not be centered vertically since we need the modal to "stay in
|
|
37
|
-
* place" when changing tabs. Since tabs content's height is not the same
|
|
38
|
-
* between the data tab and the configuration, having the modal vertically
|
|
39
|
-
* centered makes it "jump" when changing tabs.
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return withStyles({
|
|
44
|
-
scrollPaper: {
|
|
45
|
-
alignItems: 'start'
|
|
46
|
-
},
|
|
47
|
-
// Necessary to prevent warnings at runtime
|
|
48
|
-
paper: {}
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
var HarvestDialog = withHarvestDialogStyles()(function (props) {
|
|
19
|
+
var HarvestDialog = function HarvestDialog(props) {
|
|
53
20
|
var _useVaultUnlockContex = useVaultUnlockContext(),
|
|
54
21
|
showingUnlockForm = _useVaultUnlockContex.showingUnlockForm;
|
|
55
22
|
|
|
@@ -60,7 +27,7 @@ var HarvestDialog = withHarvestDialogStyles()(function (props) {
|
|
|
60
27
|
return /*#__PURE__*/React.createElement(Dialog, _extends({
|
|
61
28
|
disableRestoreFocus: true
|
|
62
29
|
}, props));
|
|
63
|
-
}
|
|
30
|
+
};
|
|
64
31
|
|
|
65
32
|
var Routes = function Routes(_ref) {
|
|
66
33
|
var konnectorRoot = _ref.konnectorRoot,
|
|
@@ -138,10 +105,10 @@ var Routes = function Routes(_ref) {
|
|
|
138
105
|
|
|
139
106
|
Routes.propTypes = {
|
|
140
107
|
/** The root URL of the konnector */
|
|
141
|
-
konnectorRoot: PropTypes.string
|
|
108
|
+
konnectorRoot: PropTypes.string,
|
|
142
109
|
|
|
143
110
|
/** The konnector object */
|
|
144
|
-
konnector: PropTypes.object
|
|
111
|
+
konnector: PropTypes.object,
|
|
145
112
|
|
|
146
113
|
/** The slug of the konnector */
|
|
147
114
|
konnectorSlug: PropTypes.string.isRequired,
|