cozy-harvest-lib 29.1.0 → 29.1.2

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 CHANGED
@@ -3,6 +3,16 @@
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.2](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@29.1.1...cozy-harvest-lib@29.1.2) (2024-09-04)
7
+
8
+ **Note:** Version bump only for package cozy-harvest-lib
9
+
10
+ ## [29.1.1](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@29.1.0...cozy-harvest-lib@29.1.1) (2024-09-04)
11
+
12
+ ### Bug Fixes
13
+
14
+ - **ConnectionFlow:** Error wasn't set to false if `status === SUCCESS` ([7dcab26](https://github.com/cozy/cozy-libs/commit/7dcab268de8c8cf46ca25fe1872df57f46b0b3a1))
15
+
6
16
  # [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
17
 
8
18
  ### Features
@@ -92,7 +92,7 @@ function ErrorAlert(_ref) {
92
92
 
93
93
  ErrorAlert.propTypes = {
94
94
  label: PropTypes.string.isRequired,
95
- error: PropTypes.object.isRequired,
95
+ error: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]).isRequired,
96
96
  konnectorRoot: PropTypes.string,
97
97
  trigger: PropTypes.object.isRequired,
98
98
  isRunning: PropTypes.bool.isRequired,
@@ -101,7 +101,7 @@ RunnableAlert.propTypes = {
101
101
  konnectorSlug: PropTypes.string.isRequired,
102
102
  konnectorRoot: PropTypes.string,
103
103
  trigger: PropTypes.object.isRequired,
104
- error: PropTypes.object,
104
+ error: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
105
105
  historyAction: PropTypes.func.isRequired,
106
106
  flow: PropTypes.object,
107
107
  account: PropTypes.object,
@@ -1412,7 +1412,7 @@ export var ConnectionFlow = /*#__PURE__*/function () {
1412
1412
  var running = (trigger === null || trigger === void 0 ? void 0 : (_trigger$current_stat = trigger.current_state) === null || _trigger$current_stat === void 0 ? void 0 : _trigger$current_stat.status) === 'running' || ![ERRORED, IDLE, SUCCESS].includes(status);
1413
1413
  var konnectorPolicy = this.getKonnectorPolicy();
1414
1414
  var expectingTriggerLaunch = status === EXPECTING_TRIGGER_LAUNCH;
1415
- var error = !running && !expectingTriggerLaunch && (this.getMockError() || accountError || triggerError);
1415
+ var error = status !== SUCCESS && !running && !expectingTriggerLaunch && (this.getMockError() || accountError || triggerError);
1416
1416
  var userNeeded = running && !this.state[LOGIN_SUCCESS_EVENT] && (konnectorPolicy.name === 'clisk' || firstRun);
1417
1417
  return {
1418
1418
  running: running,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-harvest-lib",
3
- "version": "29.1.0",
3
+ "version": "29.1.2",
4
4
  "description": "Provides logic, modules and components for Cozy's harvest applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -108,5 +108,5 @@
108
108
  "react-router-dom": ">=4.3.1"
109
109
  },
110
110
  "sideEffects": false,
111
- "gitHead": "abcbff2c15896acda8853b875b5123303936e09f"
111
+ "gitHead": "c7e6a2e886244c8ecf1cd794c423710fb5325091"
112
112
  }
@@ -106,7 +106,7 @@ function ErrorAlert({
106
106
 
107
107
  ErrorAlert.propTypes = {
108
108
  label: PropTypes.string.isRequired,
109
- error: PropTypes.object.isRequired,
109
+ error: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]).isRequired,
110
110
  konnectorRoot: PropTypes.string,
111
111
  trigger: PropTypes.object.isRequired,
112
112
  isRunning: PropTypes.bool.isRequired,
@@ -111,7 +111,7 @@ RunnableAlert.propTypes = {
111
111
  konnectorSlug: PropTypes.string.isRequired,
112
112
  konnectorRoot: PropTypes.string,
113
113
  trigger: PropTypes.object.isRequired,
114
- error: PropTypes.object,
114
+ error: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
115
115
  historyAction: PropTypes.func.isRequired,
116
116
  flow: PropTypes.object,
117
117
  account: PropTypes.object,
@@ -986,6 +986,7 @@ export class ConnectionFlow {
986
986
  const konnectorPolicy = this.getKonnectorPolicy()
987
987
  const expectingTriggerLaunch = status === EXPECTING_TRIGGER_LAUNCH
988
988
  const error =
989
+ status !== SUCCESS &&
989
990
  !running &&
990
991
  !expectingTriggerLaunch &&
991
992
  (this.getMockError() || accountError || triggerError)
@@ -1,67 +0,0 @@
1
- import LaunchTriggerCard from 'components/cards/LaunchTriggerCard';
2
- import { mount } from 'enzyme';
3
- import React from 'react';
4
- import CozyClient, { CozyProvider } from 'cozy-client';
5
- import I18n from 'cozy-ui/transpiled/react/providers/I18n';
6
- import enLocale from '../../locales/en.json';
7
- import ConnectionFlow from '../../models/ConnectionFlow';
8
- jest.mock('../../models/ConnectionFlow', function () {
9
- // Require the original module to not be mocked...
10
- var _jest$requireActual = jest.requireActual('../../models/ConnectionFlow'),
11
- mockConnectionFlow = _jest$requireActual.default;
12
-
13
- mockConnectionFlow.prototype.watchJob = jest.fn();
14
- return mockConnectionFlow;
15
- });
16
- var triggerFixture = {
17
- _id: 'd861818b62204988bf0bb78c182a9149',
18
- arguments: '0 0 0 * * 0'
19
- };
20
- var konnectorFixture = {
21
- slug: 'boursorama83',
22
- parameters: {
23
- bankId: '100000'
24
- },
25
- partnership: {
26
- domain: 'https://budget-insight.com'
27
- }
28
- };
29
- describe('LaunchTriggerCard', function () {
30
- var client = new CozyClient({});
31
- client.plugins = {
32
- realtime: {
33
- sendNotification: jest.fn(),
34
- subscribe: jest.fn()
35
- }
36
- };
37
-
38
- var setup = function setup(_ref) {
39
- var props = _ref.props;
40
- var root = mount( /*#__PURE__*/React.createElement(CozyProvider, {
41
- client: client
42
- }, /*#__PURE__*/React.createElement(I18n, {
43
- dictRequire: function dictRequire() {
44
- return enLocale;
45
- },
46
- lang: "en"
47
- }, /*#__PURE__*/React.createElement(LaunchTriggerCard, props))));
48
- return {
49
- root: root
50
- };
51
- };
52
-
53
- it('should render impossible to run message when konnector is clientSide without an accessible launcher', function () {
54
- var _setup = setup({
55
- props: {
56
- flow: new ConnectionFlow(client, triggerFixture, {
57
- slug: 'test',
58
- name: 'testname',
59
- clientSide: true
60
- }, konnectorFixture)
61
- }
62
- }),
63
- root = _setup.root;
64
-
65
- expect(root.html()).toMatchSnapshot();
66
- });
67
- });
@@ -1,3 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`LaunchTriggerCard should render impossible to run message when konnector is clientSide without an accessible launcher 1`] = `""`;
@@ -1,73 +0,0 @@
1
- import LaunchTriggerCard from 'components/cards/LaunchTriggerCard'
2
- import { mount } from 'enzyme'
3
- import React from 'react'
4
-
5
- import CozyClient, { CozyProvider } from 'cozy-client'
6
- import I18n from 'cozy-ui/transpiled/react/providers/I18n'
7
-
8
- import enLocale from '../../locales/en.json'
9
- import ConnectionFlow from '../../models/ConnectionFlow'
10
-
11
- jest.mock('../../models/ConnectionFlow', () => {
12
- // Require the original module to not be mocked...
13
- const { default: mockConnectionFlow } = jest.requireActual(
14
- '../../models/ConnectionFlow'
15
- )
16
-
17
- mockConnectionFlow.prototype.watchJob = jest.fn()
18
-
19
- return mockConnectionFlow
20
- })
21
-
22
- const triggerFixture = {
23
- _id: 'd861818b62204988bf0bb78c182a9149',
24
- arguments: '0 0 0 * * 0'
25
- }
26
- const konnectorFixture = {
27
- slug: 'boursorama83',
28
- parameters: {
29
- bankId: '100000'
30
- },
31
- partnership: {
32
- domain: 'https://budget-insight.com'
33
- }
34
- }
35
-
36
- describe('LaunchTriggerCard', () => {
37
- const client = new CozyClient({})
38
- client.plugins = {
39
- realtime: {
40
- sendNotification: jest.fn(),
41
- subscribe: jest.fn()
42
- }
43
- }
44
-
45
- const setup = ({ props }) => {
46
- const root = mount(
47
- <CozyProvider client={client}>
48
- <I18n dictRequire={() => enLocale} lang="en">
49
- <LaunchTriggerCard {...props} />
50
- </I18n>
51
- </CozyProvider>
52
- )
53
- return { root }
54
- }
55
-
56
- it('should render impossible to run message when konnector is clientSide without an accessible launcher', () => {
57
- const { root } = setup({
58
- props: {
59
- flow: new ConnectionFlow(
60
- client,
61
- triggerFixture,
62
- {
63
- slug: 'test',
64
- name: 'testname',
65
- clientSide: true
66
- },
67
- konnectorFixture
68
- )
69
- }
70
- })
71
- expect(root.html()).toMatchSnapshot()
72
- })
73
- })
@@ -1,3 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`LaunchTriggerCard should render impossible to run message when konnector is clientSide without an accessible launcher 1`] = `""`;