cozy-harvest-lib 20.1.0 → 20.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,28 @@
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
+ ## [20.1.2](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@20.1.1...cozy-harvest-lib@20.1.2) (2023-10-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Wrap offers into json flag instead an array ([560c1bf](https://github.com/cozy/cozy-libs/commit/560c1bf0d905736182784db51eba93406077a466))
12
+
13
+
14
+
15
+
16
+
17
+ ## [20.1.1](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@20.1.0...cozy-harvest-lib@20.1.1) (2023-10-27)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **harvest:** Set FlagshipUI on connectionBackdrop ([b7aa9e6](https://github.com/cozy/cozy-libs/commit/b7aa9e69b77dbdd8a1f43f0a3800a08eadd2dd66))
23
+
24
+
25
+
26
+
27
+
6
28
  # [20.1.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@20.0.0...cozy-harvest-lib@20.1.0) (2023-10-26)
7
29
 
8
30
 
@@ -1,4 +1,6 @@
1
- import React from 'react';
1
+ import React, { useEffect } from 'react';
2
+ import { createPortal } from 'react-dom';
3
+ import { useWebviewIntent } from 'cozy-intent';
2
4
  import Backdrop from 'cozy-ui/transpiled/react/Backdrop';
3
5
  import LinearProgress from 'cozy-ui/transpiled/react/LinearProgress';
4
6
  import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme';
@@ -51,4 +53,33 @@ var ConnectionBackdrop = function ConnectionBackdrop(_ref) {
51
53
  }))))));
52
54
  };
53
55
 
54
- export default ConnectionBackdrop;
56
+ var ConnectionBackdropWrapper = function ConnectionBackdropWrapper(_ref2) {
57
+ var name = _ref2.name;
58
+ var webviewIntent = useWebviewIntent();
59
+ useEffect(function () {
60
+ if (webviewIntent) {
61
+ // On mounting, we want to ensure the UI displays white icone because the backdrop is dark
62
+ // The WorkerView is then responsible to change back the icons to dark on white theme
63
+ webviewIntent.call('setFlagshipUI', {
64
+ bottomTheme: 'light',
65
+ topTheme: 'light'
66
+ }, 'ConnectionBackdrop Start');
67
+ } // As a precaution, we set the icons back to dark on white theme when unmounting
68
+ // This is to ensure the icons are not stuck in white on white theme in unhappy paths
69
+
70
+
71
+ return function () {
72
+ if (webviewIntent) {
73
+ webviewIntent.call('setFlagshipUI', {
74
+ bottomTheme: 'dark',
75
+ topTheme: 'dark'
76
+ }, 'ConnectionBackdrop End');
77
+ }
78
+ };
79
+ }, [webviewIntent]);
80
+ return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(ConnectionBackdrop, {
81
+ name: name
82
+ }), document.body);
83
+ };
84
+
85
+ export default ConnectionBackdropWrapper;
@@ -101,7 +101,7 @@ export function computeNbAccounts(accounts) {
101
101
  */
102
102
 
103
103
  export function hasReachMaxAccounts(accounts) {
104
- var offers = flag('harvest.accounts.offers') || [];
104
+ var offers = flag('harvest.accounts.offers.list') || [];
105
105
  var nbAccounts = computeNbAccounts(accounts, offers);
106
106
  var maxAccounts = computeMaxAccounts();
107
107
 
@@ -16,7 +16,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
16
16
 
17
17
  import PropTypes from 'prop-types';
18
18
  import React, { Component } from 'react';
19
- import { createPortal } from 'react-dom';
20
19
  import { withClient } from 'cozy-client';
21
20
  import { translate } from 'cozy-ui/transpiled/react/providers/I18n';
22
21
  import ConnectionBackdrop from './AccountForm/ConnectionBackdrop';
@@ -204,9 +203,9 @@ export var FlowProvider = /*#__PURE__*/function (_Component) {
204
203
  flow: flow,
205
204
  dismissAction: this.dismissTwoFAModal,
206
205
  into: "coz-harvest-modal-place"
207
- }), showConnectionBackdrop && /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(ConnectionBackdrop, {
206
+ }), showConnectionBackdrop && /*#__PURE__*/React.createElement(ConnectionBackdrop, {
208
207
  name: flow.konnector.name
209
- }), document.body));
208
+ }));
210
209
  }
211
210
  }]);
212
211
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-harvest-lib",
3
- "version": "20.1.0",
3
+ "version": "20.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",
@@ -112,5 +112,5 @@
112
112
  "react-router-dom": ">=4.3.1"
113
113
  },
114
114
  "sideEffects": false,
115
- "gitHead": "0f7ae07a012040097fd495eaeed55f2bc01a09a2"
115
+ "gitHead": "6da69c3efe784f0d6a3dd71c0bf28b79ed7c03a6"
116
116
  }
@@ -1,5 +1,7 @@
1
- import React from 'react'
1
+ import React, { useEffect } from 'react'
2
+ import { createPortal } from 'react-dom'
2
3
 
4
+ import { useWebviewIntent } from 'cozy-intent'
3
5
  import Backdrop from 'cozy-ui/transpiled/react/Backdrop'
4
6
  import LinearProgress from 'cozy-ui/transpiled/react/LinearProgress'
5
7
  import MuiCozyTheme from 'cozy-ui/transpiled/react/MuiCozyTheme'
@@ -55,4 +57,40 @@ const ConnectionBackdrop = ({ name }) => {
55
57
  )
56
58
  }
57
59
 
58
- export default ConnectionBackdrop
60
+ const ConnectionBackdropWrapper = ({ name }) => {
61
+ const webviewIntent = useWebviewIntent()
62
+
63
+ useEffect(() => {
64
+ if (webviewIntent) {
65
+ // On mounting, we want to ensure the UI displays white icone because the backdrop is dark
66
+ // The WorkerView is then responsible to change back the icons to dark on white theme
67
+ webviewIntent.call(
68
+ 'setFlagshipUI',
69
+ {
70
+ bottomTheme: 'light',
71
+ topTheme: 'light'
72
+ },
73
+ 'ConnectionBackdrop Start'
74
+ )
75
+ }
76
+
77
+ // As a precaution, we set the icons back to dark on white theme when unmounting
78
+ // This is to ensure the icons are not stuck in white on white theme in unhappy paths
79
+ return () => {
80
+ if (webviewIntent) {
81
+ webviewIntent.call(
82
+ 'setFlagshipUI',
83
+ {
84
+ bottomTheme: 'dark',
85
+ topTheme: 'dark'
86
+ },
87
+ 'ConnectionBackdrop End'
88
+ )
89
+ }
90
+ }
91
+ }, [webviewIntent])
92
+
93
+ return createPortal(<ConnectionBackdrop name={name} />, document.body)
94
+ }
95
+
96
+ export default ConnectionBackdropWrapper
@@ -96,7 +96,7 @@ export function computeNbAccounts(accounts, offers = []) {
96
96
  * @returns {boolean} whether the number of accounts allowed for all konnectors has been reached
97
97
  */
98
98
  export function hasReachMaxAccounts(accounts) {
99
- const offers = flag('harvest.accounts.offers') || []
99
+ const offers = flag('harvest.accounts.offers.list') || []
100
100
 
101
101
  const nbAccounts = computeNbAccounts(accounts, offers)
102
102
 
@@ -1,6 +1,5 @@
1
1
  import PropTypes from 'prop-types'
2
2
  import React, { Component } from 'react'
3
- import { createPortal } from 'react-dom'
4
3
 
5
4
  import { withClient } from 'cozy-client'
6
5
  import { translate } from 'cozy-ui/transpiled/react/providers/I18n'
@@ -176,11 +175,9 @@ export class FlowProvider extends Component {
176
175
  />
177
176
  )}
178
177
 
179
- {showConnectionBackdrop &&
180
- createPortal(
181
- <ConnectionBackdrop name={flow.konnector.name} />,
182
- document.body
183
- )}
178
+ {showConnectionBackdrop && (
179
+ <ConnectionBackdrop name={flow.konnector.name} />
180
+ )}
184
181
  </>
185
182
  )
186
183
  }