cozy-harvest-lib 9.27.0 → 9.27.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
+ ## [9.27.2](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.27.1...cozy-harvest-lib@9.27.2) (2022-10-19)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Reapply useVaultClient hook call in LegacyTriggerManager ([bbfb20b](https://github.com/cozy/cozy-libs/commit/bbfb20b559660d04f8a4e1c21ebc3c11cc2cc88b))
12
+
13
+
14
+
15
+
16
+
17
+ ## [9.27.1](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.27.0...cozy-harvest-lib@9.27.1) (2022-10-11)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * Add explicit blocked popup message ([5e6f93c](https://github.com/cozy/cozy-libs/commit/5e6f93cbe43cecc51089304ad3808fbc07793f8f))
23
+
24
+
25
+
26
+
27
+
6
28
  # [9.27.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.26.18...cozy-harvest-lib@9.27.0) (2022-10-04)
7
29
 
8
30
 
@@ -120,7 +120,12 @@ export var Popup = /*#__PURE__*/function (_PureComponent) {
120
120
  */
121
121
 
122
122
 
123
- var popup = window.open(url, title, "scrollbars=yes, width=".concat(w, ", height=").concat(h, ", top=").concat(top, ", left=").concat(left)); // Puts focus on the newWindow
123
+ var popup = window.open(url, title, "scrollbars=yes, width=".concat(w, ", height=").concat(h, ", top=").concat(top, ", left=").concat(left));
124
+
125
+ if (!popup) {
126
+ throw new Error('Popup was blocked by browser. Be sure to not call showPopup asynchronously');
127
+ } // Puts focus on the newWindow
128
+
124
129
 
125
130
  if (popup.focus) {
126
131
  popup.focus();
@@ -21,6 +21,7 @@ import get from 'lodash/get';
21
21
  import compose from 'lodash/flowRight';
22
22
  import { withClient } from 'cozy-client';
23
23
  import { Account } from 'cozy-doctypes';
24
+ import { useVaultClient } from 'cozy-keys-lib';
24
25
  import { translate } from 'cozy-ui/transpiled/react/I18n';
25
26
  import Spinner from 'cozy-ui/transpiled/react/Spinner';
26
27
  import { ModalBackButton } from 'cozy-ui/transpiled/react/Modal';
@@ -658,8 +659,17 @@ var LegacyTriggerManager = function LegacyTriggerManager(props) {
658
659
  onLoginSuccess = props.onLoginSuccess,
659
660
  onError = props.onError,
660
661
  initialTrigger = props.initialTrigger,
661
- otherProps = _objectWithoutProperties(props, _excluded);
662
+ otherProps = _objectWithoutProperties(props, _excluded); // Since the 4.1.0 of cozy-keys-lib, we
663
+ // render children even if vaultClient is
664
+ // not defined yet. In that case we we were
665
+ // displaying TriggerManager without vaultClient.
666
+ // It was raising an error.
667
+ // The current fix, is to not display the
668
+ // TriggerManager when vaultClient is null.
662
669
 
670
+
671
+ var vaultClient = useVaultClient();
672
+ if (!vaultClient) return null;
663
673
  return /*#__PURE__*/React.createElement(FlowProvider, {
664
674
  onLaunch: onLaunch,
665
675
  onSuccess: onSuccess,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-harvest-lib",
3
- "version": "9.27.0",
3
+ "version": "9.27.2",
4
4
  "description": "Provides logic, modules and components for Cozy's harvest applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -90,5 +90,5 @@
90
90
  "react-router-dom": "^5.0.1"
91
91
  },
92
92
  "sideEffects": false,
93
- "gitHead": "72899c24a587b57b330c793f48892b2ab276e22b"
93
+ "gitHead": "4709feb25b56c4af02ab2426bb84fb5a771902f5"
94
94
  }
@@ -100,6 +100,12 @@ export class Popup extends PureComponent {
100
100
  `scrollbars=yes, width=${w}, height=${h}, top=${top}, left=${left}`
101
101
  )
102
102
 
103
+ if (!popup) {
104
+ throw new Error(
105
+ 'Popup was blocked by browser. Be sure to not call showPopup asynchronously'
106
+ )
107
+ }
108
+
103
109
  // Puts focus on the newWindow
104
110
  if (popup.focus) {
105
111
  popup.focus()
@@ -5,6 +5,7 @@ import compose from 'lodash/flowRight'
5
5
 
6
6
  import { withClient } from 'cozy-client'
7
7
  import { Account } from 'cozy-doctypes'
8
+ import { useVaultClient } from 'cozy-keys-lib'
8
9
 
9
10
  import { translate } from 'cozy-ui/transpiled/react/I18n'
10
11
  import Spinner from 'cozy-ui/transpiled/react/Spinner'
@@ -482,6 +483,17 @@ const LegacyTriggerManager = props => {
482
483
  initialTrigger,
483
484
  ...otherProps
484
485
  } = props
486
+
487
+ // Since the 4.1.0 of cozy-keys-lib, we
488
+ // render children even if vaultClient is
489
+ // not defined yet. In that case we we were
490
+ // displaying TriggerManager without vaultClient.
491
+ // It was raising an error.
492
+ // The current fix, is to not display the
493
+ // TriggerManager when vaultClient is null.
494
+ const vaultClient = useVaultClient()
495
+ if (!vaultClient) return null
496
+
485
497
  return (
486
498
  <FlowProvider
487
499
  onLaunch={onLaunch}