cozy-harvest-lib 9.11.3 → 9.12.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,39 @@
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.12.2](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.12.1...cozy-harvest-lib@9.12.2) (2022-06-20)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Do not encode oauth url ([263e119](https://github.com/cozy/cozy-libs/commit/263e1192dc1d123585936119386acb8426d2676b))
12
+
13
+
14
+
15
+
16
+
17
+ ## [9.12.1](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.12.0...cozy-harvest-lib@9.12.1) (2022-06-20)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * Do not show popup when intentsApi is given ([2b39abe](https://github.com/cozy/cozy-libs/commit/2b39abe6c808ea5ec12c5404c43ee698c4d49fd3))
23
+
24
+
25
+
26
+
27
+
28
+ # [9.12.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.11.3...cozy-harvest-lib@9.12.0) (2022-06-17)
29
+
30
+
31
+ ### Features
32
+
33
+ * Do not show Popup when intentsApi parameter is given ([6790272](https://github.com/cozy/cozy-libs/commit/67902727394c9ef3400e32bc3cbddf5468ef332c))
34
+
35
+
36
+
37
+
38
+
6
39
  ## [9.11.3](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.11.2...cozy-harvest-lib@9.11.3) (2022-06-17)
7
40
 
8
41
 
@@ -124,7 +124,7 @@ var BIContractActivationWindow = function BIContractActivationWindow(_ref) {
124
124
  onClick: function onClick() {
125
125
  return setWindowVisible(true);
126
126
  }
127
- }, t('contracts.handle-synchronization'))), isWindowVisible && (isFlagshipApp() ? /*#__PURE__*/React.createElement(InAppBrowser, {
127
+ }, t('contracts.handle-synchronization'))), isWindowVisible && (isFlagshipApp() || intentsApi ? /*#__PURE__*/React.createElement(InAppBrowser, {
128
128
  url: initialUrl,
129
129
  onClose: onPopupClosed,
130
130
  intentsApi: intentsApi
@@ -184,7 +184,7 @@ export var OAuthWindow = /*#__PURE__*/function (_PureComponent) {
184
184
  var _this$state = this.state,
185
185
  oAuthUrl = _this$state.oAuthUrl,
186
186
  succeed = _this$state.succeed;
187
- return oAuthUrl && !succeed && (!isFlagshipApp() ? /*#__PURE__*/React.createElement(Popup, {
187
+ return oAuthUrl && !succeed && (!isFlagshipApp() && !intentsApi ? /*#__PURE__*/React.createElement(Popup, {
188
188
  url: oAuthUrl,
189
189
  height: OAUTH_POPUP_HEIGHT,
190
190
  width: OAUTH_POPUP_WIDTH,
@@ -136,7 +136,7 @@ export var getOAuthUrl = function getOAuthUrl(_ref) {
136
136
  });
137
137
  }
138
138
 
139
- return oAuthUrl.toString();
139
+ return decodeURIComponent(oAuthUrl.toString());
140
140
  };
141
141
 
142
142
  var getAppSlug = function getAppSlug(client) {
@@ -53,7 +53,7 @@ describe('Oauth helper', function () {
53
53
  scope: ['thescope', 'thescope2']
54
54
  }
55
55
  }));
56
- expect(url).toEqual('https://cozyurl/accounts/testslug/start?state=statekey&nonce=1234&scope=thescope%2Bthescope2');
56
+ expect(url).toEqual('https://cozyurl/accounts/testslug/start?state=statekey&nonce=1234&scope=thescope+thescope2');
57
57
  });
58
58
  it('should use redirectSlug if present', function () {
59
59
  var url = getOAuthUrl(_objectSpread(_objectSpread({}, defaultConf), {}, {
@@ -86,6 +86,20 @@ describe('Oauth helper', function () {
86
86
  }));
87
87
  expect(url).toEqual('https://cozyurl/accounts/testslug/accountid/reconnect?state=statekey&nonce=1234&code=thecode&connection_id=12345');
88
88
  });
89
+ it('should not encode url params', function () {
90
+ var url = getOAuthUrl(_objectSpread(_objectSpread({}, defaultConf), {}, {
91
+ oAuthConf: {},
92
+ account: {
93
+ _id: 'accountid'
94
+ },
95
+ reconnect: true,
96
+ extraParams: {
97
+ code: 'e/b',
98
+ connection_id: 12345
99
+ }
100
+ }));
101
+ expect(url).toEqual('https://cozyurl/accounts/testslug/accountid/reconnect?state=statekey&nonce=1234&code=e/b&connection_id=12345');
102
+ });
89
103
  });
90
104
  describe('handleOAuthResponse', function () {
91
105
  var originalLocation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-harvest-lib",
3
- "version": "9.11.3",
3
+ "version": "9.12.2",
4
4
  "description": "Provides logic, modules and components for Cozy's harvest applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -87,5 +87,5 @@
87
87
  "react-router-dom": "^5.0.1"
88
88
  },
89
89
  "sideEffects": false,
90
- "gitHead": "fc5f1b0d6ad0119af2833becb7d02bcfb3f2540c"
90
+ "gitHead": "975fde8ef02bab7329149c5bc813eeea8e971cfe"
91
91
  }
@@ -75,7 +75,7 @@ const BIContractActivationWindow = ({
75
75
  </Button>
76
76
  </ButtonWrapper>
77
77
  {isWindowVisible &&
78
- (isFlagshipApp() ? (
78
+ (isFlagshipApp() || intentsApi ? (
79
79
  <InAppBrowser
80
80
  url={initialUrl}
81
81
  onClose={onPopupClosed}
@@ -148,7 +148,7 @@ export class OAuthWindow extends PureComponent {
148
148
  return (
149
149
  oAuthUrl &&
150
150
  !succeed &&
151
- (!isFlagshipApp() ? (
151
+ (!isFlagshipApp() && !intentsApi ? (
152
152
  <Popup
153
153
  url={oAuthUrl}
154
154
  height={OAUTH_POPUP_HEIGHT}
@@ -143,7 +143,7 @@ export const getOAuthUrl = ({
143
143
  )
144
144
  }
145
145
 
146
- return oAuthUrl.toString()
146
+ return decodeURIComponent(oAuthUrl.toString())
147
147
  }
148
148
 
149
149
  const getAppSlug = client => {
@@ -50,7 +50,7 @@ describe('Oauth helper', () => {
50
50
  oAuthConf: { scope: ['thescope', 'thescope2'] }
51
51
  })
52
52
  expect(url).toEqual(
53
- 'https://cozyurl/accounts/testslug/start?state=statekey&nonce=1234&scope=thescope%2Bthescope2'
53
+ 'https://cozyurl/accounts/testslug/start?state=statekey&nonce=1234&scope=thescope+thescope2'
54
54
  )
55
55
  })
56
56
  it('should use redirectSlug if present', () => {
@@ -91,6 +91,21 @@ describe('Oauth helper', () => {
91
91
  'https://cozyurl/accounts/testslug/accountid/reconnect?state=statekey&nonce=1234&code=thecode&connection_id=12345'
92
92
  )
93
93
  })
94
+ it('should not encode url params', () => {
95
+ const url = getOAuthUrl({
96
+ ...defaultConf,
97
+ oAuthConf: {},
98
+ account: { _id: 'accountid' },
99
+ reconnect: true,
100
+ extraParams: {
101
+ code: 'e/b',
102
+ connection_id: 12345
103
+ }
104
+ })
105
+ expect(url).toEqual(
106
+ 'https://cozyurl/accounts/testslug/accountid/reconnect?state=statekey&nonce=1234&code=e/b&connection_id=12345'
107
+ )
108
+ })
94
109
  })
95
110
  describe('handleOAuthResponse', () => {
96
111
  let originalLocation