cozy-harvest-lib 22.3.0 → 22.4.1

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,30 @@
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
+ ## [22.4.1](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@22.4.0...cozy-harvest-lib@22.4.1) (2024-02-19)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Get sourceAccountIdentifier with getAccountName ([9b8a446](https://github.com/cozy/cozy-libs/commit/9b8a446275ff3e733ea65ce9f958b6375f4b5009))
12
+
13
+
14
+
15
+
16
+
17
+ # [22.4.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@22.3.0...cozy-harvest-lib@22.4.0) (2024-02-15)
18
+
19
+
20
+ ### Features
21
+
22
+ * **harvest:** Remove useless Spinner during the connection ([19f3216](https://github.com/cozy/cozy-libs/commit/19f32167dfa469459b6fffe94c633435229118c8))
23
+ * **harvest:** Upgrade cozy deps ([af60567](https://github.com/cozy/cozy-libs/commit/af605676e89727b403b73cf898ce4ad7973f4db6))
24
+ * **harvest:** Upgrade cozy-ui from 95.9.0 to 103.2.0 ([adc3937](https://github.com/cozy/cozy-libs/commit/adc393742f022615415c8c4461248100db63ac53))
25
+
26
+
27
+
28
+
29
+
6
30
  # [22.3.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@22.2.0...cozy-harvest-lib@22.3.0) (2024-01-31)
7
31
 
8
32
 
@@ -3,9 +3,9 @@ import { createPortal } from 'react-dom';
3
3
  import { useWebviewIntent } from 'cozy-intent';
4
4
  import Backdrop from 'cozy-ui/transpiled/react/Backdrop';
5
5
  import LinearProgress from 'cozy-ui/transpiled/react/LinearProgress';
6
- import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme';
7
6
  import Typography from 'cozy-ui/transpiled/react/Typography';
8
7
  import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
8
+ import CozyTheme from 'cozy-ui/transpiled/react/providers/CozyTheme';
9
9
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
10
10
  import { makeStyles } from 'cozy-ui/transpiled/react/styles';
11
11
  var useStyles = makeStyles({
@@ -25,7 +25,7 @@ export var ConnectionBackdrop = function ConnectionBackdrop(_ref) {
25
25
  var _useI18n = useI18n(),
26
26
  t = _useI18n.t;
27
27
 
28
- return /*#__PURE__*/React.createElement(MuiCozyTheme, {
28
+ return /*#__PURE__*/React.createElement(CozyTheme, {
29
29
  variant: "inverted"
30
30
  }, /*#__PURE__*/React.createElement("div", {
31
31
  className: styles.container
@@ -30,7 +30,7 @@ var Datacards = function Datacards(_ref2) {
30
30
  konnector: konnector,
31
31
  trigger: trigger,
32
32
  accountId: trigger.message.account,
33
- sourceAccountIdentifier: models.account.getAccountLogin(account)
33
+ sourceAccountIdentifier: models.account.getAccountName(account)
34
34
  });
35
35
  }));
36
36
  };
@@ -524,7 +524,6 @@ export var DumbTriggerManager = /*#__PURE__*/function (_Component) {
524
524
  t = _this$props5.t,
525
525
  fieldOptions = _this$props5.fieldOptions,
526
526
  flow = _this$props5.flow,
527
- flowState = _this$props5.flowState,
528
527
  client = _this$props5.client,
529
528
  OAuthFormWrapperComp = _this$props5.OAuthFormWrapperComp,
530
529
  _this$props5$OAuthFor = _this$props5.OAuthFormWrapperCompProps,
@@ -532,7 +531,6 @@ export var DumbTriggerManager = /*#__PURE__*/function (_Component) {
532
531
  reconnect = _this$props5.reconnect,
533
532
  intentsApi = _this$props5.intentsApi,
534
533
  _onClose = _this$props5.onClose;
535
- var submitting = flowState.running;
536
534
  var _this$state = this.state,
537
535
  account = _this$state.account,
538
536
  step = _this$state.step,
@@ -543,16 +541,15 @@ export var DumbTriggerManager = /*#__PURE__*/function (_Component) {
543
541
  isWaitingPaywallCheck = _this$state.isWaitingPaywallCheck;
544
542
  var oauth = konnector.oauth;
545
543
  var showCiphersList = step === 'ciphersList';
546
- var isSubmittingSelectedCipher = submitting && selectedCipher && showCiphersList;
547
544
  var showAccountForm = step === 'accountForm';
548
545
  var konnectorPolicy = findKonnectorPolicy(konnector);
549
546
 
550
- if (isWaitingPaywallCheck || isSubmittingSelectedCipher) {
547
+ if (isWaitingPaywallCheck) {
551
548
  return /*#__PURE__*/React.createElement("div", {
552
549
  className: "u-flex u-flex-column u-flex-items-center u-pv-2"
553
550
  }, /*#__PURE__*/React.createElement(Spinner, {
554
551
  size: "xxlarge"
555
- }), isSubmittingSelectedCipher ? /*#__PURE__*/React.createElement("p", null, t('triggerManager.connecting')) : null);
552
+ }));
556
553
  }
557
554
 
558
555
  if (showPaywall) {
@@ -653,7 +650,6 @@ DumbTriggerManager.propTypes = {
653
650
  */
654
651
  fieldOptions: PropTypes.object,
655
652
  flow: PropTypes.object,
656
- flowState: PropTypes.object,
657
653
 
658
654
  /** Used to inject a component around OAuthForm, and so customize the UI from the app */
659
655
  OAuthFormWrapperComp: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
@@ -3,8 +3,8 @@ import compose from 'lodash/flowRight';
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
5
  import CozyClient, { Q, queryConnect, RealTimeQueries } from 'cozy-client';
6
- import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme';
7
6
  import NavigationList, { NavigationListSection, NavigationListHeader } from 'cozy-ui/transpiled/react/NavigationList';
7
+ import CozyTheme from 'cozy-ui/transpiled/react/providers/CozyTheme';
8
8
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
9
9
  import BIContractActivationWindow from './BiContractActivationWindow';
10
10
  import ContractItem from './ContractItem';
@@ -44,7 +44,7 @@ var DumbContracts = function DumbContracts(_ref2) {
44
44
  if (contractData.length === 0) return null;
45
45
  var doctype = contractData[0] ? contractData[0]._type : null;
46
46
  var headerKey = customHeaderPerDoctype[doctype] || 'default';
47
- return /*#__PURE__*/React.createElement(MuiCozyTheme, null, /*#__PURE__*/React.createElement(RealTimeQueries, {
47
+ return /*#__PURE__*/React.createElement(CozyTheme, null, /*#__PURE__*/React.createElement(RealTimeQueries, {
48
48
  doctype: "io.cozy.bank.accounts"
49
49
  }), /*#__PURE__*/React.createElement(NavigationList, null, /*#__PURE__*/React.createElement(NavigationListHeader, null, t("contracts.headers.".concat(headerKey))), /*#__PURE__*/React.createElement(NavigationListSection, null, contractData && contractData.map(function (contract, i) {
50
50
  return /*#__PURE__*/React.createElement(ContractItem, {
@@ -50,4 +50,16 @@ jest.mock('cozy-ui/transpiled/react/Icons/CloudSync2', function () {
50
50
  };
51
51
  }, {
52
52
  virtual: true
53
+ });
54
+ /* Fix error: "TypeError: (0 , _color.createNodeWithThemeCssVars) is not a function" */
55
+
56
+ jest.mock('cozy-ui/transpiled/react/utils/color', function () {
57
+ return {
58
+ createNodeWithThemeCssVars: function createNodeWithThemeCssVars() {
59
+ return null;
60
+ },
61
+ getCssVariableValue: function getCssVariableValue() {
62
+ return '#fff';
63
+ }
64
+ };
53
65
  });
@@ -543,7 +543,6 @@
543
543
  "otherAccount": "From another account…"
544
544
  },
545
545
  "triggerManager": {
546
- "connecting": "Connecting your account...",
547
546
  "confirmationModal": {
548
547
  "title": "Update credentials?",
549
548
  "description": "Your previous credentials will be definitively lost. Add a new account to keep them.",
@@ -543,7 +543,6 @@
543
543
  "otherAccount": "Depuis un autre compte…"
544
544
  },
545
545
  "triggerManager": {
546
- "connecting": "Connexion du compte…",
547
546
  "confirmationModal": {
548
547
  "title": "Mettre à jour les identifiants ?",
549
548
  "description": "Vos identifiants précédents seront perdus. Ajoutez un nouveau compte pour les conserver.",
@@ -535,7 +535,6 @@
535
535
  "otherAccount": "Uit ander account…"
536
536
  },
537
537
  "triggerManager": {
538
- "connecting": "Bezig met koppelen…",
539
538
  "confirmationModal": {
540
539
  "title": "Inloggegevens bijwerken?",
541
540
  "description": "Je vorige inloggegevens worden gewist - voeg een nieuw account toe om ze te bewaren.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-harvest-lib",
3
- "version": "22.3.0",
3
+ "version": "22.4.1",
4
4
  "description": "Provides logic, modules and components for Cozy's harvest applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -20,7 +20,7 @@
20
20
  "deploy:doc": "(cd ../.. && yarn deploy:doc)",
21
21
  "prepublishOnly": "yarn check-locales && yarn build",
22
22
  "check-locales": "./scripts/check-locales.sh",
23
- "test": "jest --runInBand",
23
+ "test": "env NODE_ENV=test jest --runInBand",
24
24
  "lint": "cd .. && yarn eslint --ext js,jsx packages/cozy-harvest-lib",
25
25
  "start": "yarn build:watch",
26
26
  "cli": "env BABEL_ENV=es5 node src/cli/index.js",
@@ -65,15 +65,15 @@
65
65
  "babel-jest": "26.6.3",
66
66
  "babel-plugin-inline-react-svg": "1.1.2",
67
67
  "babel-preset-cozy-app": "^2.1.0",
68
- "cozy-client": "^45.1.0",
68
+ "cozy-client": "^45.8.1",
69
69
  "cozy-device-helper": "^3.0.0",
70
70
  "cozy-flags": "^3.2.2",
71
71
  "cozy-intent": "^2.19.2",
72
- "cozy-interapp": ">=0.8.1",
72
+ "cozy-interapp": "^0.9.0",
73
73
  "cozy-keys-lib": "^6.0.0",
74
74
  "cozy-realtime": "^5.0.0",
75
- "cozy-tsconfig": "^1.0.0",
76
- "cozy-ui": "^95.9.0",
75
+ "cozy-tsconfig": "^1.2.0",
76
+ "cozy-ui": "^103.2.0",
77
77
  "enzyme": "3.11.0",
78
78
  "enzyme-adapter-react-16": "1.15.6",
79
79
  "form-data": "4.0.0",
@@ -94,18 +94,18 @@
94
94
  },
95
95
  "peerDependencies": {
96
96
  "@babel/runtime": ">=7.12.5",
97
- "cozy-client": ">=45.1.0",
97
+ "cozy-client": ">=45.8.1",
98
98
  "cozy-device-helper": ">=2.6.0",
99
99
  "cozy-flags": ">=2.3.5",
100
100
  "cozy-intent": ">=1.14.1",
101
- "cozy-interapp": ">=0.8.1",
101
+ "cozy-interapp": ">=0.9.0",
102
102
  "cozy-keys-lib": ">=6.0.0",
103
103
  "cozy-realtime": ">=4.2.8",
104
- "cozy-ui": ">=95.9.0",
104
+ "cozy-ui": ">=103.2.0",
105
105
  "leaflet": "^1.7.1",
106
106
  "react-router": "3.2.6",
107
107
  "react-router-dom": ">=4.3.1"
108
108
  },
109
109
  "sideEffects": false,
110
- "gitHead": "c71fea1c06805d3a37ff6b6a7837d4d7eacfb9f7"
110
+ "gitHead": "8b9a74a136e5cf7f926cb35351a3d01ce4b25a84"
111
111
  }
@@ -4,9 +4,9 @@ import { createPortal } from 'react-dom'
4
4
  import { useWebviewIntent } from 'cozy-intent'
5
5
  import Backdrop from 'cozy-ui/transpiled/react/Backdrop'
6
6
  import LinearProgress from 'cozy-ui/transpiled/react/LinearProgress'
7
- import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme'
8
7
  import Typography from 'cozy-ui/transpiled/react/Typography'
9
8
  import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
9
+ import CozyTheme from 'cozy-ui/transpiled/react/providers/CozyTheme'
10
10
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
11
11
  import { makeStyles } from 'cozy-ui/transpiled/react/styles'
12
12
 
@@ -24,7 +24,7 @@ export const ConnectionBackdrop = ({ name }) => {
24
24
  const { t } = useI18n()
25
25
 
26
26
  return (
27
- <MuiCozyTheme variant="inverted">
27
+ <CozyTheme variant="inverted">
28
28
  <div className={styles.container}>
29
29
  <Backdrop
30
30
  open
@@ -53,7 +53,7 @@ export const ConnectionBackdrop = ({ name }) => {
53
53
  </div>
54
54
  </Backdrop>
55
55
  </div>
56
- </MuiCozyTheme>
56
+ </CozyTheme>
57
57
  )
58
58
  }
59
59
 
@@ -26,7 +26,7 @@ const Datacards = ({ konnector, account, trigger }) => {
26
26
  konnector={konnector}
27
27
  trigger={trigger}
28
28
  accountId={trigger.message.account}
29
- sourceAccountIdentifier={models.account.getAccountLogin(account)}
29
+ sourceAccountIdentifier={models.account.getAccountName(account)}
30
30
  />
31
31
  ))}
32
32
  </>
@@ -309,7 +309,6 @@ export class DumbTriggerManager extends Component {
309
309
  t,
310
310
  fieldOptions,
311
311
  flow,
312
- flowState,
313
312
  client,
314
313
  OAuthFormWrapperComp,
315
314
  OAuthFormWrapperCompProps = {},
@@ -318,8 +317,6 @@ export class DumbTriggerManager extends Component {
318
317
  onClose
319
318
  } = this.props
320
319
 
321
- const submitting = flowState.running
322
-
323
320
  const {
324
321
  account,
325
322
  step,
@@ -333,18 +330,13 @@ export class DumbTriggerManager extends Component {
333
330
  const { oauth } = konnector
334
331
 
335
332
  const showCiphersList = step === 'ciphersList'
336
- const isSubmittingSelectedCipher =
337
- submitting && selectedCipher && showCiphersList
338
333
  const showAccountForm = step === 'accountForm'
339
334
  const konnectorPolicy = findKonnectorPolicy(konnector)
340
335
 
341
- if (isWaitingPaywallCheck || isSubmittingSelectedCipher) {
336
+ if (isWaitingPaywallCheck) {
342
337
  return (
343
338
  <div className="u-flex u-flex-column u-flex-items-center u-pv-2">
344
339
  <Spinner size="xxlarge" />
345
- {isSubmittingSelectedCipher ? (
346
- <p>{t('triggerManager.connecting')}</p>
347
- ) : null}
348
340
  </div>
349
341
  )
350
342
  }
@@ -459,7 +451,6 @@ DumbTriggerManager.propTypes = {
459
451
  */
460
452
  fieldOptions: PropTypes.object,
461
453
  flow: PropTypes.object,
462
- flowState: PropTypes.object,
463
454
  /** Used to inject a component around OAuthForm, and so customize the UI from the app */
464
455
  OAuthFormWrapperComp: PropTypes.oneOfType([
465
456
  PropTypes.element,
@@ -4,11 +4,11 @@ import PropTypes from 'prop-types'
4
4
  import React from 'react'
5
5
 
6
6
  import CozyClient, { Q, queryConnect, RealTimeQueries } from 'cozy-client'
7
- import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme'
8
7
  import NavigationList, {
9
8
  NavigationListSection,
10
9
  NavigationListHeader
11
10
  } from 'cozy-ui/transpiled/react/NavigationList'
11
+ import CozyTheme from 'cozy-ui/transpiled/react/providers/CozyTheme'
12
12
  import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
13
13
 
14
14
  import BIContractActivationWindow from './BiContractActivationWindow'
@@ -53,7 +53,7 @@ const DumbContracts = ({
53
53
  const headerKey = customHeaderPerDoctype[doctype] || 'default'
54
54
 
55
55
  return (
56
- <MuiCozyTheme>
56
+ <CozyTheme>
57
57
  <RealTimeQueries doctype="io.cozy.bank.accounts" />
58
58
  <NavigationList>
59
59
  <NavigationListHeader>
@@ -81,7 +81,7 @@ const DumbContracts = ({
81
81
  />
82
82
  </NavigationListSection>
83
83
  </NavigationList>
84
- </MuiCozyTheme>
84
+ </CozyTheme>
85
85
  )
86
86
  }
87
87
 
package/src/jest.setup.js CHANGED
@@ -59,3 +59,9 @@ jest.mock(
59
59
  virtual: true
60
60
  }
61
61
  )
62
+
63
+ /* Fix error: "TypeError: (0 , _color.createNodeWithThemeCssVars) is not a function" */
64
+ jest.mock('cozy-ui/transpiled/react/utils/color', () => ({
65
+ createNodeWithThemeCssVars: () => null,
66
+ getCssVariableValue: () => '#fff'
67
+ }))
@@ -543,7 +543,6 @@
543
543
  "otherAccount": "From another account…"
544
544
  },
545
545
  "triggerManager": {
546
- "connecting": "Connecting your account...",
547
546
  "confirmationModal": {
548
547
  "title": "Update credentials?",
549
548
  "description": "Your previous credentials will be definitively lost. Add a new account to keep them.",
@@ -543,7 +543,6 @@
543
543
  "otherAccount": "Depuis un autre compte…"
544
544
  },
545
545
  "triggerManager": {
546
- "connecting": "Connexion du compte…",
547
546
  "confirmationModal": {
548
547
  "title": "Mettre à jour les identifiants ?",
549
548
  "description": "Vos identifiants précédents seront perdus. Ajoutez un nouveau compte pour les conserver.",
@@ -535,7 +535,6 @@
535
535
  "otherAccount": "Uit ander account…"
536
536
  },
537
537
  "triggerManager": {
538
- "connecting": "Bezig met koppelen…",
539
538
  "confirmationModal": {
540
539
  "title": "Inloggegevens bijwerken?",
541
540
  "description": "Je vorige inloggegevens worden gewist - voeg een nieuw account toe om ze te bewaren.",