cozy-harvest-lib 9.32.7 → 10.0.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/components/AccountForm/CannotConnectModal.js +43 -0
  3. package/dist/components/AccountForm/__snapshots__/index.spec.jsx.snap +22 -16
  4. package/dist/components/AccountForm/index.js +63 -22
  5. package/dist/components/AccountForm/index.spec.js +22 -22
  6. package/dist/components/AccountsList/__snapshots__/AccountsListItem.spec.jsx.snap +6 -6
  7. package/dist/components/KonnectorConfiguration/ConfigurationTab/BIContractActivationWindow.spec.js +10 -2
  8. package/dist/components/KonnectorConfiguration/ConfigurationTab/EditContract.js +1 -1
  9. package/dist/components/KonnectorConfiguration/DataTab/index.js +16 -3
  10. package/dist/components/KonnectorConfiguration/KonnectorAccountTabs.js +1 -1
  11. package/dist/components/Maintenance/__snapshots__/index.spec.jsx.snap +1 -1
  12. package/dist/components/Providers/ComponentsPropsProvider.js +35 -0
  13. package/dist/components/Routes.js +8 -4
  14. package/dist/components/TriggerManager.js +1 -2
  15. package/dist/components/__snapshots__/OAuthForm.spec.js.snap +4 -4
  16. package/dist/components/cards/LaunchTriggerAlert.js +59 -0
  17. package/dist/components/cards/LaunchTriggerCard.js +5 -2
  18. package/dist/components/cards/__snapshots__/LaunchTriggerCard.spec.jsx.snap +2 -2
  19. package/dist/components/cards/helpers.js +8 -0
  20. package/dist/components/cards/helpers.spec.js +78 -0
  21. package/dist/datacards/FileDataCard.js +1 -1
  22. package/dist/datacards/GeoDataCard.js +5 -3
  23. package/dist/index.js +3 -1
  24. package/dist/locales/en.json +5 -0
  25. package/dist/locales/fr.json +5 -0
  26. package/package.json +10 -12
  27. package/src/components/AccountForm/CannotConnectModal.jsx +43 -0
  28. package/src/components/AccountForm/__snapshots__/index.spec.jsx.snap +22 -16
  29. package/src/components/AccountForm/index.jsx +54 -16
  30. package/src/components/AccountForm/index.spec.jsx +10 -10
  31. package/src/components/AccountsList/__snapshots__/AccountsListItem.spec.jsx.snap +6 -6
  32. package/src/components/KonnectorConfiguration/ConfigurationTab/BIContractActivationWindow.spec.jsx +17 -5
  33. package/src/components/KonnectorConfiguration/ConfigurationTab/EditContract.jsx +1 -1
  34. package/src/components/KonnectorConfiguration/DataTab/index.jsx +44 -20
  35. package/src/components/KonnectorConfiguration/KonnectorAccountTabs.jsx +1 -1
  36. package/src/components/Maintenance/__snapshots__/index.spec.jsx.snap +1 -1
  37. package/src/components/Providers/ComponentsPropsProvider.jsx +36 -0
  38. package/src/components/Routes.jsx +93 -89
  39. package/src/components/TriggerManager.jsx +5 -6
  40. package/src/components/__snapshots__/OAuthForm.spec.js.snap +4 -4
  41. package/src/components/cards/LaunchTriggerAlert.jsx +58 -0
  42. package/src/components/cards/LaunchTriggerCard.jsx +9 -2
  43. package/src/components/cards/__snapshots__/LaunchTriggerCard.spec.jsx.snap +2 -2
  44. package/src/components/cards/helpers.js +13 -0
  45. package/src/components/cards/helpers.spec.js +85 -0
  46. package/src/datacards/FileDataCard.jsx +1 -1
  47. package/src/datacards/GeoDataCard.jsx +3 -3
  48. package/src/index.js +2 -0
  49. package/src/locales/en.json +5 -0
  50. package/src/locales/fr.json +5 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,37 @@
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
+ # [10.0.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.32.8...cozy-harvest-lib@10.0.0) (2022-12-15)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add a modal to help the user to connect ([1f2aab2](https://github.com/cozy/cozy-libs/commit/1f2aab25d525d6e7816850bac8c3de7d2d04273e))
12
+ * Add CannotConnectModal feature behind a flag ([b6f6669](https://github.com/cozy/cozy-libs/commit/b6f6669c4d625dc9ca1d1f64b961232a5e729533))
13
+ * **harvest:** Add LaunchTriggerAlert ([4bca6bc](https://github.com/cozy/cozy-libs/commit/4bca6bc90d7590896a688f1ca40b677c298e811a))
14
+ * **harvest:** Add OverloadComponentsProvider component ([76648f2](https://github.com/cozy/cozy-libs/commit/76648f20849ed6a7fc5520f15881cf997551fb56))
15
+ * **harvest:** Expose LaunchTriggerCard ([1f85c89](https://github.com/cozy/cozy-libs/commit/1f85c89475c30a989f61f83f0225827a1f835e94))
16
+ * **harvest:** Simply add a div around DataTab ([72b7635](https://github.com/cozy/cozy-libs/commit/72b76350658b3bc04cbec56d171fbf55b7fe582c))
17
+ * **harvest:** Update cozy-ui 60.6.0 to 77.9.0 + cozy-client to 34.2.0 ([d48e7d7](https://github.com/cozy/cozy-libs/commit/d48e7d736e706bcae9b4c9a5cc47e9f91c97fafd))
18
+ * **harvest:** Use new LaunchTriggerAlert (behind flag) ([48c869a](https://github.com/cozy/cozy-libs/commit/48c869a94a6e76d6c8408ede043de096ca440a30))
19
+
20
+
21
+ ### BREAKING CHANGES
22
+
23
+ * **harvest:** You must have `cozy-ui >= 77.9.0`,  `cozy-client >= 34.2.0`, `cozy-device-helper >= 2.6.0` and `@material-u/core >= 4.12.4` when using cozy-harvest-lib. `@material-ui/lab` can be removed, it is no longer required.
24
+
25
+
26
+
27
+
28
+
29
+ ## [9.32.8](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.32.7...cozy-harvest-lib@9.32.8) (2022-12-09)
30
+
31
+ **Note:** Version bump only for package cozy-harvest-lib
32
+
33
+
34
+
35
+
36
+
6
37
  ## [9.32.7](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.32.6...cozy-harvest-lib@9.32.7) (2022-12-09)
7
38
 
8
39
 
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Typography from 'cozy-ui/transpiled/react/Typography';
4
+ import Link from 'cozy-ui/transpiled/react/Link';
5
+ import { ConfirmDialog } from 'cozy-ui/transpiled/react/CozyDialogs';
6
+ import { useI18n } from 'cozy-ui/transpiled/react/I18n';
7
+ import { useComponentsProps } from '../Providers/ComponentsPropsProvider';
8
+
9
+ var CannotConnectModal = function CannotConnectModal(_ref) {
10
+ var _ComponentsProps$Cann;
11
+
12
+ var vendorName = _ref.vendorName,
13
+ vendorLink = _ref.vendorLink,
14
+ onClose = _ref.onClose;
15
+
16
+ var _useI18n = useI18n(),
17
+ t = _useI18n.t;
18
+
19
+ var _useComponentsProps = useComponentsProps(),
20
+ ComponentsProps = _useComponentsProps.ComponentsProps;
21
+
22
+ return /*#__PURE__*/React.createElement(ConfirmDialog, {
23
+ open: true,
24
+ content: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
25
+ variant: "h4",
26
+ className: "u-mb-1"
27
+ }, t('accountForm.cannotConnectModal.title')), /*#__PURE__*/React.createElement(Typography, {
28
+ className: "u-mb-1"
29
+ }, t('accountForm.cannotConnectModal.content'), /*#__PURE__*/React.createElement(Link, {
30
+ href: vendorLink,
31
+ target: "_blank",
32
+ rel: "noopener noreferrer"
33
+ }, vendorName)), ComponentsProps === null || ComponentsProps === void 0 ? void 0 : (_ComponentsProps$Cann = ComponentsProps.CannotConnectModal) === null || _ComponentsProps$Cann === void 0 ? void 0 : _ComponentsProps$Cann.extraContent),
34
+ onClose: onClose
35
+ });
36
+ };
37
+
38
+ CannotConnectModal.propTypes = {
39
+ vendorName: PropTypes.string,
40
+ vendorLink: PropTypes.string,
41
+ onClose: PropTypes.func
42
+ };
43
+ export default CannotConnectModal;
@@ -27,12 +27,14 @@ exports[`AccountForm should not render error 1`] = `
27
27
  inputRefByName={[Function]}
28
28
  t={[Function]}
29
29
  />
30
- <DefaultButton
30
+ <ForwardRef
31
31
  className="u-mt-2 u-mb-1-half"
32
+ data-testid="submit-btn"
32
33
  disabled={false}
33
- extension="full"
34
+ fullWidth={true}
34
35
  label="Connect"
35
36
  onClick={[Function]}
37
+ variant="primary"
36
38
  />
37
39
  </React.Fragment>
38
40
  </div>
@@ -64,12 +66,14 @@ exports[`AccountForm should render 1`] = `
64
66
  inputRefByName={[Function]}
65
67
  t={[Function]}
66
68
  />
67
- <DefaultButton
69
+ <ForwardRef
68
70
  className="u-mt-2 u-mb-1-half"
71
+ data-testid="submit-btn"
69
72
  disabled={true}
70
- extension="full"
73
+ fullWidth={true}
71
74
  label="Connect"
72
75
  onClick={[Function]}
76
+ variant="primary"
73
77
  />
74
78
  </React.Fragment>
75
79
  </div>
@@ -118,12 +122,14 @@ exports[`AccountForm should render error 1`] = `
118
122
  inputRefByName={[Function]}
119
123
  t={[Function]}
120
124
  />
121
- <DefaultButton
125
+ <ForwardRef
122
126
  className="u-mt-2 u-mb-1-half"
127
+ data-testid="submit-btn"
123
128
  disabled={false}
124
- extension="full"
129
+ fullWidth={true}
125
130
  label="Connect"
126
131
  onClick={[Function]}
132
+ variant="primary"
127
133
  />
128
134
  </React.Fragment>
129
135
  </div>
@@ -141,12 +147,14 @@ exports[`AccountForm should render normally when client side konnector with laun
141
147
  inputRefByName={[Function]}
142
148
  t={[Function]}
143
149
  />
144
- <DefaultButton
150
+ <ForwardRef
145
151
  className="u-mt-2 u-mb-1-half"
152
+ data-testid="submit-btn"
146
153
  disabled={false}
147
- extension="full"
154
+ fullWidth={true}
148
155
  label="Connect"
149
156
  onClick={[Function]}
157
+ variant="primary"
150
158
  />
151
159
  </React.Fragment>
152
160
  </div>
@@ -172,19 +180,17 @@ exports[`AccountForm should render with specific message when client side konnec
172
180
  <Bd
173
181
  className="u-m-1"
174
182
  >
175
- <ForwardRef(WithStyles)
176
- variant="body1"
177
- >
183
+ <ForwardRef>
178
184
  The testkonnector application uses a brand-new and efficient system for retrieving your data from your Cozy. This action is only accessible from the Cozy mobile app.
179
- </ForwardRef(WithStyles)>
185
+ </ForwardRef>
180
186
  </Bd>
181
187
  </Media>
182
- <ButtonLink
188
+ <ForwardRef
183
189
  className="u-mt-2 u-mb-1-half"
184
- extension="full"
185
- href="#"
190
+ fullWidth={true}
186
191
  label="Install Cozy on mobile"
187
- tag="a"
192
+ onClick={[Function]}
193
+ variant="primary"
188
194
  />
189
195
  </React.Fragment>
190
196
  </div>
@@ -6,32 +6,39 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
8
 
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+
11
+ 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; }
12
+
9
13
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
14
 
11
15
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
16
 
13
17
  import React, { PureComponent } from 'react';
18
+ import { withRouter } from 'react-router';
14
19
  import { Form } from 'react-final-form';
15
20
  import PropTypes from 'prop-types';
16
21
  import get from 'lodash/get';
17
22
  import compose from 'lodash/flowRight';
23
+ import flag from 'cozy-flags';
18
24
  import { isMobile } from 'cozy-device-helper';
19
- import Button, { ButtonLink } from 'cozy-ui/transpiled/react/Button';
25
+ import Button from 'cozy-ui/transpiled/react/Buttons';
26
+ import Link from 'cozy-ui/transpiled/react/Link';
20
27
  import Icon from 'cozy-ui/transpiled/react/Icon';
21
28
  import Info from 'cozy-ui/transpiled/react/Icons/Info';
22
29
  import { Media, Img, Bd } from 'cozy-ui/transpiled/react/Media';
23
30
  import Typography from 'cozy-ui/transpiled/react/Typography';
31
+ import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs';
24
32
  import withLocales from '../hoc/withLocales';
25
33
  import AccountFields from './AccountFields';
26
34
  import ReadOnlyIdentifier from './ReadOnlyIdentifier';
27
35
  import TriggerErrorInfo from '../infos/TriggerErrorInfo';
28
- import { getEncryptedFieldName } from '../../helpers/fields';
36
+ import fieldHelpers, { getEncryptedFieldName, SECRET } from '../../helpers/fields';
29
37
  import { KonnectorJobError, isRunnable } from '../../helpers/konnectors';
30
38
  import manifest from '../../helpers/manifest';
31
- import fieldHelpers, { SECRET } from '../../helpers/fields';
32
39
  import withKonnectorLocales from '../hoc/withKonnectorLocales';
33
40
  import withConnectionFlow from '../../models/withConnectionFlow';
34
- import { Dialog } from 'cozy-ui/transpiled/react/CozyDialogs';
41
+ import CannotConnectModal from './CannotConnectModal';
35
42
  var VALIDATION_ERROR_REQUIRED_FIELD = 'VALIDATION_ERROR_REQUIRED_FIELD';
36
43
  /**
37
44
  * AccountForm is reponsible of generating a form which will allow user to
@@ -79,7 +86,8 @@ export var AccountForm = /*#__PURE__*/function (_PureComponent) {
79
86
  });
80
87
 
81
88
  _this.state = {
82
- showConfirmationModal: false
89
+ showConfirmationModal: false,
90
+ showCannotConnectModal: false
83
91
  };
84
92
  _this.inputs = {};
85
93
  _this.inputFocused = null;
@@ -89,6 +97,8 @@ export var AccountForm = /*#__PURE__*/function (_PureComponent) {
89
97
  _this.focusNext = _this.focusNext.bind(_assertThisInitialized(_this));
90
98
  _this.showConfirmationModal = _this.showConfirmationModal.bind(_assertThisInitialized(_this));
91
99
  _this.hideConfirmationModal = _this.hideConfirmationModal.bind(_assertThisInitialized(_this));
100
+ _this.showCannotConnectModal = _this.showCannotConnectModal.bind(_assertThisInitialized(_this));
101
+ _this.hideCannotConnectModal = _this.hideCannotConnectModal.bind(_assertThisInitialized(_this));
92
102
  return _this;
93
103
  }
94
104
  /**
@@ -231,15 +241,37 @@ export var AccountForm = /*#__PURE__*/function (_PureComponent) {
231
241
  }, {
232
242
  key: "showConfirmationModal",
233
243
  value: function showConfirmationModal() {
234
- this.setState({
235
- showConfirmationModal: true
244
+ this.setState(function (prev) {
245
+ return _objectSpread(_objectSpread({}, prev), {}, {
246
+ showConfirmationModal: true
247
+ });
236
248
  });
237
249
  }
238
250
  }, {
239
251
  key: "hideConfirmationModal",
240
252
  value: function hideConfirmationModal() {
241
- this.setState({
242
- showConfirmationModal: false
253
+ this.setState(function (prev) {
254
+ return _objectSpread(_objectSpread({}, prev), {}, {
255
+ showConfirmationModal: false
256
+ });
257
+ });
258
+ }
259
+ }, {
260
+ key: "showCannotConnectModal",
261
+ value: function showCannotConnectModal() {
262
+ this.setState(function (prev) {
263
+ return _objectSpread(_objectSpread({}, prev), {}, {
264
+ showCannotConnectModal: true
265
+ });
266
+ });
267
+ }
268
+ }, {
269
+ key: "hideCannotConnectModal",
270
+ value: function hideCannotConnectModal() {
271
+ this.setState(function (prev) {
272
+ return _objectSpread(_objectSpread({}, prev), {}, {
273
+ showCannotConnectModal: false
274
+ });
243
275
  });
244
276
  }
245
277
  }, {
@@ -264,7 +296,8 @@ export var AccountForm = /*#__PURE__*/function (_PureComponent) {
264
296
  var submitting = flowState.running;
265
297
  var error = flowState.error;
266
298
  var fields = konnector.fields,
267
- name = konnector.name;
299
+ name = konnector.name,
300
+ vendor_link = konnector.vendor_link;
268
301
  var sanitizedFields = manifest.sanitizeFields(fields);
269
302
  fieldHelpers.addForceEncryptedPlaceholder(sanitizedFields, fieldOptions);
270
303
  var initialValues = account && account.auth;
@@ -319,7 +352,11 @@ export var AccountForm = /*#__PURE__*/function (_PureComponent) {
319
352
  initialValues: values,
320
353
  inputRefByName: _this3.inputRefByName,
321
354
  t: t
322
- }), /*#__PURE__*/React.createElement(Button, {
355
+ }), flag('harvest.inappconnectors.enabled') && /*#__PURE__*/React.createElement(Typography, null, /*#__PURE__*/React.createElement(Link, {
356
+ className: "u-mt-1",
357
+ component: "button",
358
+ onClick: _this3.showCannotConnectModal
359
+ }, t('accountForm.cannotConnectLink'))), /*#__PURE__*/React.createElement(Button, {
323
360
  busy: submitting,
324
361
  className: "u-mt-2 u-mb-1-half",
325
362
  disabled: submitting || !_this3.isSubmittable({
@@ -328,11 +365,12 @@ export var AccountForm = /*#__PURE__*/function (_PureComponent) {
328
365
  initialValues: initialValues,
329
366
  valid: valid
330
367
  }),
331
- extension: "full",
368
+ fullWidth: true,
332
369
  label: t('accountForm.submit.label'),
333
370
  onClick: function onClick() {
334
371
  return _this3.handleSubmit(values, form);
335
- }
372
+ },
373
+ "data-testid": "submit-btn"
336
374
  })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Media, {
337
375
  align: "top"
338
376
  }, /*#__PURE__*/React.createElement(Img, {
@@ -341,15 +379,15 @@ export var AccountForm = /*#__PURE__*/function (_PureComponent) {
341
379
  icon: Info
342
380
  })), /*#__PURE__*/React.createElement(Bd, {
343
381
  className: "u-m-1"
344
- }, /*#__PURE__*/React.createElement(Typography, {
345
- variant: "body1"
346
- }, t('accountForm.notClientSide', {
382
+ }, /*#__PURE__*/React.createElement(Typography, null, t('accountForm.notClientSide', {
347
383
  name: name
348
- })))), /*#__PURE__*/React.createElement(ButtonLink, {
384
+ })))), /*#__PURE__*/React.createElement(Button, {
349
385
  className: "u-mt-2 u-mb-1-half",
350
- extension: "full",
386
+ fullWidth: true,
351
387
  label: t('accountForm.installFlagship.label'),
352
- href: "#"
388
+ onClick: function onClick() {
389
+ return _this3.props.history.push('/');
390
+ }
353
391
  })), _this3.state.showConfirmationModal && /*#__PURE__*/React.createElement(Dialog, {
354
392
  title: t('triggerManager.confirmationModal.title'),
355
393
  description: t('triggerManager.confirmationModal.description'),
@@ -359,12 +397,15 @@ export var AccountForm = /*#__PURE__*/function (_PureComponent) {
359
397
  label: t('triggerManager.confirmationModal.primaryText'),
360
398
  onClick: function onClick() {
361
399
  return _this3.doSubmit(values, form);
362
- },
363
- variant: "primary"
400
+ }
364
401
  }), /*#__PURE__*/React.createElement(Button, {
365
402
  label: t('triggerManager.confirmationModal.secondaryText'),
366
403
  onClick: _this3.hideConfirmationModal
367
404
  }))
405
+ }), _this3.state.showCannotConnectModal && /*#__PURE__*/React.createElement(CannotConnectModal, {
406
+ onClose: _this3.hideCannotConnectModal,
407
+ vendorName: name,
408
+ vendorLink: vendor_link
368
409
  }));
369
410
  }
370
411
  })
@@ -423,4 +464,4 @@ AccountForm.defaultProps = {
423
464
  showError: true,
424
465
  fieldOptions: {}
425
466
  };
426
- export default compose(withConnectionFlow(), withLocales, withKonnectorLocales)(AccountForm);
467
+ export default compose(withRouter, withConnectionFlow(), withLocales, withKonnectorLocales)(AccountForm);
@@ -199,7 +199,7 @@ describe('AccountForm', function () {
199
199
  });
200
200
  describe('Submit Button', function () {
201
201
  var getButtonDisabledValue = function getButtonDisabledValue(wrapper) {
202
- return wrapper.dive().find('DefaultButton').props().disabled;
202
+ return wrapper.dive().find('[data-testid="submit-btn"]').props().disabled;
203
203
  };
204
204
 
205
205
  var assertButtonDisabled = function assertButtonDisabled(wrapper) {
@@ -210,6 +210,15 @@ describe('AccountForm', function () {
210
210
  return expect(getButtonDisabledValue(wrapper)).toBe(false);
211
211
  };
212
212
 
213
+ it('should call onSubmit on click', function () {
214
+ var _setup8 = setup({
215
+ konnector: fixtures.konnectorWithOptionalFields
216
+ }),
217
+ wrapper = _setup8.wrapper;
218
+
219
+ wrapper.dive().find('[data-testid="submit-btn"]').simulate('click');
220
+ expect(onSubmit).toHaveBeenCalled();
221
+ });
213
222
  it('should be disabled if there is required field empty', function () {
214
223
  var konnector = {
215
224
  fields: {
@@ -219,10 +228,10 @@ describe('AccountForm', function () {
219
228
  }
220
229
  };
221
230
 
222
- var _setup8 = setup({
231
+ var _setup9 = setup({
223
232
  konnector: konnector
224
233
  }),
225
- wrapper = _setup8.wrapper;
234
+ wrapper = _setup9.wrapper;
226
235
 
227
236
  assertButtonDisabled(wrapper);
228
237
  });
@@ -236,18 +245,18 @@ describe('AccountForm', function () {
236
245
  }
237
246
  };
238
247
 
239
- var _setup9 = setup({
248
+ var _setup10 = setup({
240
249
  konnector: konnector
241
250
  }),
242
- wrapper = _setup9.wrapper;
251
+ wrapper = _setup10.wrapper;
243
252
 
244
253
  assertButtonEnabled(wrapper);
245
254
  });
246
255
  it("should be enabled if fields isn't required", function () {
247
- var _setup10 = setup({
256
+ var _setup11 = setup({
248
257
  konnector: fixtures.konnectorWithOptionalFields
249
258
  }),
250
- wrapper = _setup10.wrapper;
259
+ wrapper = _setup11.wrapper;
251
260
 
252
261
  assertButtonEnabled(wrapper);
253
262
  });
@@ -259,10 +268,10 @@ describe('AccountForm', function () {
259
268
  }
260
269
  };
261
270
 
262
- var _setup11 = setup({
271
+ var _setup12 = setup({
263
272
  account: account
264
273
  }),
265
- wrapper = _setup11.wrapper;
274
+ wrapper = _setup12.wrapper;
266
275
 
267
276
  assertButtonDisabled(wrapper);
268
277
  });
@@ -280,11 +289,11 @@ describe('AccountForm', function () {
280
289
  };
281
290
  var error = new Error('Existing trigger error');
282
291
 
283
- var _setup12 = setup({
292
+ var _setup13 = setup({
284
293
  account: account,
285
294
  error: error
286
295
  }),
287
- wrapper = _setup12.wrapper;
296
+ wrapper = _setup13.wrapper;
288
297
 
289
298
  assertButtonDisabled(wrapper);
290
299
  });
@@ -292,24 +301,15 @@ describe('AccountForm', function () {
292
301
  var account = {};
293
302
  var error = new Error('Test error');
294
303
 
295
- var _setup13 = setup({
304
+ var _setup14 = setup({
296
305
  account: account,
297
306
  error: error
298
307
  }),
299
- wrapper = _setup13.wrapper;
308
+ wrapper = _setup14.wrapper;
300
309
 
301
310
  assertButtonEnabled(wrapper);
302
311
  });
303
312
  });
304
- it('should call onSubmit on click', function () {
305
- var _setup14 = setup({
306
- konnector: fixtures.konnectorWithOptionalFields
307
- }),
308
- wrapper = _setup14.wrapper;
309
-
310
- wrapper.dive().find('DefaultButton').simulate('click');
311
- expect(onSubmit).toHaveBeenCalled();
312
- });
313
313
  describe('focusNext', function () {
314
314
  var loginInput = document.createElement('input');
315
315
  var passwordInput = document.createElement('input');
@@ -8,12 +8,12 @@ exports[`AccountsListItem should not render the caption since accountLogin is un
8
8
  <div
9
9
  className="u-flex-grow-1 u-flex-shrink-1 u-ov-hidden u-mr-1"
10
10
  >
11
- <ForwardRef(WithStyles)
11
+ <ForwardRef
12
12
  className="u-ellipsis"
13
13
  variant="body1"
14
14
  >
15
15
  account-1
16
- </ForwardRef(WithStyles)>
16
+ </ForwardRef>
17
17
  </div>
18
18
  <withI18n(Status)
19
19
  konnector={
@@ -35,20 +35,20 @@ exports[`AccountsListItem should render the caption since accountName !== login
35
35
  <div
36
36
  className="u-flex-grow-1 u-flex-shrink-1 u-ov-hidden u-mr-1"
37
37
  >
38
- <ForwardRef(WithStyles)
38
+ <ForwardRef
39
39
  className="u-ellipsis"
40
40
  gutterBottom={true}
41
41
  variant="body1"
42
42
  >
43
43
  myAccountName
44
- </ForwardRef(WithStyles)>
45
- <ForwardRef(WithStyles)
44
+ </ForwardRef>
45
+ <ForwardRef
46
46
  className="u-ellipsis"
47
47
  color="textSecondary"
48
48
  variant="caption"
49
49
  >
50
50
  mylogin
51
- </ForwardRef(WithStyles)>
51
+ </ForwardRef>
52
52
  </div>
53
53
  <withI18n(Status)
54
54
  konnector={
@@ -3,6 +3,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import React from 'react';
4
4
  import CozyClient from 'cozy-client';
5
5
  import { render, fireEvent, act, waitFor } from '@testing-library/react';
6
+ import { WebviewIntentProvider } from 'cozy-intent';
6
7
  import AppLike from '../../../../test/AppLike';
7
8
  var fetchExtraOAuthUrlParams = jest.fn();
8
9
  var refreshContracts = jest.fn();
@@ -32,13 +33,20 @@ var onAccountDeleted = jest.fn();
32
33
 
33
34
  var setup = function setup() {
34
35
  var client = new CozyClient({});
36
+ var webviewService = {
37
+ call: jest.fn().mockResolvedValueOnce('sessioncode').mockResolvedValueOnce({
38
+ type: 'dismiss'
39
+ })
40
+ };
35
41
  return render( /*#__PURE__*/React.createElement(AppLike, {
36
42
  client: client
37
- }, /*#__PURE__*/React.createElement(CozyConfirmDialogProvider, null, /*#__PURE__*/React.createElement(BIContractActivationWindow, {
43
+ }, /*#__PURE__*/React.createElement(CozyConfirmDialogProvider, null, /*#__PURE__*/React.createElement(WebviewIntentProvider, {
44
+ webviewService: webviewService
45
+ }, /*#__PURE__*/React.createElement(BIContractActivationWindow, {
38
46
  konnector: mockKonnector,
39
47
  account: mockAccount,
40
48
  onAccountDeleted: onAccountDeleted
41
- }))));
49
+ })))));
42
50
  };
43
51
 
44
52
  describe('BIContractActivationWindow', function () {
@@ -14,7 +14,7 @@ import CollectionField from 'cozy-ui/transpiled/react/Labs/CollectionField';
14
14
  import Stack from 'cozy-ui/transpiled/react/Stack';
15
15
  import BaseContactPicker from 'cozy-ui/transpiled/react/ContactPicker';
16
16
  import useBreakpoints from 'cozy-ui/transpiled/react/hooks/useBreakpoints';
17
- import { withStyles } from '@material-ui/core/styles';
17
+ import { withStyles } from 'cozy-ui/transpiled/react/styles';
18
18
  import { DialogCloseButton, DialogBackButton, ConfirmDialog, useCozyDialog } from 'cozy-ui/transpiled/react/CozyDialogs';
19
19
  import Dialog, { DialogContent, DialogTitle } from 'cozy-ui/transpiled/react/Dialog';
20
20
  import Divider from 'cozy-ui/transpiled/react/MuiCozyTheme/Divider';
@@ -3,9 +3,11 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
3
3
  var _excluded = ["slug"];
4
4
  import React from 'react';
5
5
  import PropTypes from 'prop-types';
6
+ import flag from 'cozy-flags';
6
7
  import { withClient } from 'cozy-client';
7
8
  import Stack from 'cozy-ui/transpiled/react/Stack';
8
9
  import useBreakpoints from 'cozy-ui/transpiled/react/hooks/useBreakpoints';
10
+ import Divider from 'cozy-ui/transpiled/react/MuiCozyTheme/Divider';
9
11
  import * as konnectorsModel from '../../../helpers/konnectors';
10
12
  import KonnectorUpdateInfos from '../../../components/infos/KonnectorUpdateInfos';
11
13
  import LaunchTriggerCard from '../../../components/cards/LaunchTriggerCard';
@@ -17,6 +19,12 @@ import getRelatedAppsSlugs from '../../../models/getRelatedAppsSlugs';
17
19
  import appLinksProps from '../../../components/KonnectorConfiguration/DataTab/appLinksProps';
18
20
  import { useTrackPage } from '../../../components/hoc/tracking';
19
21
  import Datacards from '../../Datacards';
22
+ var styles = {
23
+ divider: {
24
+ height: '12px',
25
+ backgroundColor: 'var(--defaultBackgroundColor)'
26
+ }
27
+ };
20
28
  export var DataTab = function DataTab(_ref) {
21
29
  var konnector = _ref.konnector,
22
30
  trigger = _ref.trigger,
@@ -47,7 +55,12 @@ export var DataTab = function DataTab(_ref) {
47
55
  isInMaintenance = _useMaintenanceStatus2.isInMaintenance,
48
56
  maintenanceMessages = _useMaintenanceStatus2.messages;
49
57
 
50
- return /*#__PURE__*/React.createElement("div", {
58
+ return /*#__PURE__*/React.createElement("div", null, flag('harvest.inappconnectors.enabled') && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LaunchTriggerCard, {
59
+ flow: flow,
60
+ disabled: isInMaintenance
61
+ }), isMobile && /*#__PURE__*/React.createElement(Divider, {
62
+ style: styles.divider
63
+ })), /*#__PURE__*/React.createElement("div", {
51
64
  className: isMobile ? 'u-p-1' : 'u-pt-1 u-pb-1-half'
52
65
  }, /*#__PURE__*/React.createElement(Stack, null, isInMaintenance && /*#__PURE__*/React.createElement("div", {
53
66
  className: "u-bg-paleGrey u-p-1"
@@ -56,7 +69,7 @@ export var DataTab = function DataTab(_ref) {
56
69
  })), konnectorsModel.hasNewVersionAvailable(konnector) && /*#__PURE__*/React.createElement(KonnectorUpdateInfos, {
57
70
  konnector: konnector,
58
71
  isBlocking: hasTermsVersionMismatchError
59
- }), /*#__PURE__*/React.createElement(LaunchTriggerCard, {
72
+ }), !flag('harvest.inappconnectors.enabled') && /*#__PURE__*/React.createElement(LaunchTriggerCard, {
60
73
  flow: flow,
61
74
  disabled: isInMaintenance
62
75
  }), appLinks.map(function (_ref2) {
@@ -73,7 +86,7 @@ export var DataTab = function DataTab(_ref) {
73
86
  konnector: konnector
74
87
  }), konnector.vendor_link && /*#__PURE__*/React.createElement(WebsiteLinkCard, {
75
88
  link: konnector.vendor_link
76
- })));
89
+ }))));
77
90
  };
78
91
  DataTab.propTypes = {
79
92
  konnector: PropTypes.object.isRequired,
@@ -6,7 +6,7 @@ import React, { useState, useRef, useCallback } from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import { useClient } from 'cozy-client';
8
8
  import flag from 'cozy-flags';
9
- import { makeStyles } from '@material-ui/core/styles';
9
+ import { makeStyles } from 'cozy-ui/transpiled/react/styles';
10
10
  import { Tab as UITab, Tabs } from 'cozy-ui/transpiled/react/MuiTabs';
11
11
  import Divider from 'cozy-ui/transpiled/react/MuiCozyTheme/Divider';
12
12
  import { useI18n } from 'cozy-ui/transpiled/react/I18n';
@@ -1,3 +1,3 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`KonnectorMaintenance should match the snapshot 1`] = `"<div><div class=\\"u-flex u-flex-row u-flex-justify-center u-flex-items-center u-mb-1\\"><svg class=\\"u-w-4 u-h-4 u-mb-1-s u-mr-1\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 96 96\\"><defs><style>.cls-1{fill:#ff9300}.cls-4{fill:#ffd799}</style></defs><g id=\\"Layer_1\\"><path class=\\"cls-1\\" d=\\"M84 85.5h3v-48a7.5 7.5 0 0 0-7.5-7.5h-63A7.5 7.5 0 0 0 9 37.5v48z\\"></path><path d=\\"M16.5 36.75A1.48 1.48 0 0 0 15 38.2v42.1a1.48 1.48 0 0 0 1.5 1.45h63A1.48 1.48 0 0 0 81 80.3V38.2a1.48 1.48 0 0 0-1.5-1.45z\\" fill=\\"#fff\\"></path><path d=\\"M91.5 85.5h-87A1.5 1.5 0 0 0 3 87v1.5a7.5 7.5 0 0 0 7.5 7.5h75a7.5 7.5 0 0 0 7.5-7.5V87a1.5 1.5 0 0 0-1.5-1.5z\\" fill=\\"#ff7f1b\\"></path><path class=\\"cls-4\\" d=\\"M36 30v-9h10.5v15h3V21H84a1.5 1.5 0 0 0 1.06-2.56l-12-12a1.4 1.4 0 0 0-.44-.29.39.39 0 0 0-.14-.05 1.23 1.23 0 0 0-.39-.1H36V1.5A1.5 1.5 0 0 0 34.5 0h-12A1.5 1.5 0 0 0 21 1.5V6h-3a1.5 1.5 0 0 0-1.06.44l-12 12A1.5 1.5 0 0 0 6 21h15v9zm37.5-18.88L80.38 18H73.5zM70.5 9v6.88L63.62 9zm-9 2.12L68.38 18H61.5zM58.5 9v6.88L51.62 9zm-9 2.12L56.38 18H49.5zM46.5 9v6.88L39.62 9zM36 9.62L44.38 18H36zM21 18H9.62l9-9H21zm29.53 29.59l3-3-2.12-2.12L48 45.88l-2.38-2.38 3.44-3.44A1.5 1.5 0 0 0 49.5 39v-3h-3v2.38l-4.06 4.06a1.49 1.49 0 0 0 0 2.12l3 3-6.71 11h4.39l4.88-8.9 5.69 8.84h3.7z\\"></path><path class=\\"cls-1\\" d=\\"M48 78.6a13.5 13.5 0 1 0-13.5-13.5A13.49 13.49 0 0 0 48 78.6z\\"></path><circle class=\\"cls-4\\" cx=\\"48\\" cy=\\"60.95\\" r=\\"5.19\\"></circle><path class=\\"cls-4\\" d=\\"M38.23 71a11.43 11.43 0 0 0 19.54 0 .54.54 0 0 0-.11-.26 7.36 7.36 0 0 0-6-2.55h-7.29a7.36 7.36 0 0 0-6 2.55.54.54 0 0 0-.11.26z\\"></path><path class=\\"cls-1\\" d=\\"M27 13.5h3v3h-3z\\"></path></g></svg><div class=\\"styles__Stack--xs___2R5lW\\"><h5 class=\\"MuiTypography-root u-ta-center-s u-error MuiTypography-h5\\">Service interrupted</h5><p class=\\"MuiTypography-root u-error MuiTypography-body1\\">A shorter message</p></div></div><div class=\\"styles__Stack--xs___2R5lW\\"><h5 class=\\"MuiTypography-root MuiTypography-h5\\">What is going on?</h5><div class=\\"MuiTypography-root MuiTypography-body1\\"><span class=\\"u-db u-mv-0\\">A long message</span></div></div></div>"`;
3
+ exports[`KonnectorMaintenance should match the snapshot 1`] = `"<div><div class=\\"u-flex u-flex-row u-flex-justify-center u-flex-items-center u-mb-1\\"><svg class=\\"u-w-4 u-h-4 u-mb-1-s u-mr-1\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 96 96\\"><defs><style>.cls-1{fill:#ff9300}.cls-4{fill:#ffd799}</style></defs><g id=\\"Layer_1\\"><path class=\\"cls-1\\" d=\\"M84 85.5h3v-48a7.5 7.5 0 0 0-7.5-7.5h-63A7.5 7.5 0 0 0 9 37.5v48z\\"></path><path d=\\"M16.5 36.75A1.48 1.48 0 0 0 15 38.2v42.1a1.48 1.48 0 0 0 1.5 1.45h63A1.48 1.48 0 0 0 81 80.3V38.2a1.48 1.48 0 0 0-1.5-1.45z\\" fill=\\"#fff\\"></path><path d=\\"M91.5 85.5h-87A1.5 1.5 0 0 0 3 87v1.5a7.5 7.5 0 0 0 7.5 7.5h75a7.5 7.5 0 0 0 7.5-7.5V87a1.5 1.5 0 0 0-1.5-1.5z\\" fill=\\"#ff7f1b\\"></path><path class=\\"cls-4\\" d=\\"M36 30v-9h10.5v15h3V21H84a1.5 1.5 0 0 0 1.06-2.56l-12-12a1.4 1.4 0 0 0-.44-.29.39.39 0 0 0-.14-.05 1.23 1.23 0 0 0-.39-.1H36V1.5A1.5 1.5 0 0 0 34.5 0h-12A1.5 1.5 0 0 0 21 1.5V6h-3a1.5 1.5 0 0 0-1.06.44l-12 12A1.5 1.5 0 0 0 6 21h15v9zm37.5-18.88L80.38 18H73.5zM70.5 9v6.88L63.62 9zm-9 2.12L68.38 18H61.5zM58.5 9v6.88L51.62 9zm-9 2.12L56.38 18H49.5zM46.5 9v6.88L39.62 9zM36 9.62L44.38 18H36zM21 18H9.62l9-9H21zm29.53 29.59l3-3-2.12-2.12L48 45.88l-2.38-2.38 3.44-3.44A1.5 1.5 0 0 0 49.5 39v-3h-3v2.38l-4.06 4.06a1.49 1.49 0 0 0 0 2.12l3 3-6.71 11h4.39l4.88-8.9 5.69 8.84h3.7z\\"></path><path class=\\"cls-1\\" d=\\"M48 78.6a13.5 13.5 0 1 0-13.5-13.5A13.49 13.49 0 0 0 48 78.6z\\"></path><circle class=\\"cls-4\\" cx=\\"48\\" cy=\\"60.95\\" r=\\"5.19\\"></circle><path class=\\"cls-4\\" d=\\"M38.23 71a11.43 11.43 0 0 0 19.54 0 .54.54 0 0 0-.11-.26 7.36 7.36 0 0 0-6-2.55h-7.29a7.36 7.36 0 0 0-6 2.55.54.54 0 0 0-.11.26z\\"></path><path class=\\"cls-1\\" d=\\"M27 13.5h3v3h-3z\\"></path></g></svg><div class=\\"styles__Stack--xs___2R5lW\\"><h5 class=\\"MuiTypography-root u-ta-center-s u-error MuiTypography-h5 MuiTypography-colorTextPrimary\\">Service interrupted</h5><p class=\\"MuiTypography-root u-error MuiTypography-body1 MuiTypography-colorTextPrimary\\">A shorter message</p></div></div><div class=\\"styles__Stack--xs___2R5lW\\"><h5 class=\\"MuiTypography-root MuiTypography-h5 MuiTypography-colorTextPrimary\\">What is going on?</h5><div class=\\"MuiTypography-root MuiTypography-body1 MuiTypography-colorTextPrimary\\"><span class=\\"u-db u-mv-0\\">A long message</span></div></div></div>"`;