cozy-harvest-lib 9.12.2 → 9.12.3
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 +11 -0
- package/dist/components/InAppBrowser.js +19 -14
- package/package.json +2 -2
- package/src/components/InAppBrowser.jsx +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.3](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.12.2...cozy-harvest-lib@9.12.3) (2022-06-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Do not double encode url ([b44f843](https://github.com/cozy/cozy-libs/commit/b44f843a010514973b1fac8bcc5d980ab9af4d9e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [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
18
|
|
|
8
19
|
|
|
@@ -32,54 +32,59 @@ var InAppBrowser = function InAppBrowser(_ref) {
|
|
|
32
32
|
|
|
33
33
|
function _insideEffect() {
|
|
34
34
|
_insideEffect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
35
|
-
var sessionCode, iabUrl, result;
|
|
35
|
+
var sessionCode, iabUrl, urlToOpen, result;
|
|
36
36
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
37
37
|
while (1) {
|
|
38
38
|
switch (_context.prev = _context.next) {
|
|
39
39
|
case 0:
|
|
40
40
|
if (!isReady) {
|
|
41
|
-
_context.next =
|
|
41
|
+
_context.next = 21;
|
|
42
42
|
break;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
_context.prev = 1;
|
|
46
|
-
|
|
46
|
+
logger.debug('url at the beginning: ', url);
|
|
47
|
+
_context.next = 5;
|
|
47
48
|
return fetchSessionCode();
|
|
48
49
|
|
|
49
|
-
case
|
|
50
|
+
case 5:
|
|
50
51
|
sessionCode = _context.sent;
|
|
51
52
|
logger.debug('got session code', sessionCode);
|
|
52
53
|
iabUrl = new URL(url);
|
|
53
|
-
iabUrl.searchParams.append(tokenParamName, sessionCode);
|
|
54
|
-
|
|
55
|
-
return showInAppBrowser(iabUrl.toString());
|
|
54
|
+
iabUrl.searchParams.append(tokenParamName, sessionCode); // we need to decodeURIComponent since toString() encodes URL
|
|
55
|
+
// but native browser will also encode them.
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
urlToOpen = decodeURIComponent(iabUrl.toString());
|
|
58
|
+
logger.debug('url to open: ', urlToOpen);
|
|
59
|
+
_context.next = 13;
|
|
60
|
+
return showInAppBrowser(urlToOpen);
|
|
61
|
+
|
|
62
|
+
case 13:
|
|
58
63
|
result = _context.sent;
|
|
59
64
|
|
|
60
65
|
if ((result === null || result === void 0 ? void 0 : result.type) !== 'dismiss' && (result === null || result === void 0 ? void 0 : result.type) !== 'cancel') {
|
|
61
66
|
logger.error('Unexpected InAppBrowser result', result);
|
|
62
67
|
}
|
|
63
68
|
|
|
64
|
-
_context.next =
|
|
69
|
+
_context.next = 20;
|
|
65
70
|
break;
|
|
66
71
|
|
|
67
|
-
case
|
|
68
|
-
_context.prev =
|
|
72
|
+
case 17:
|
|
73
|
+
_context.prev = 17;
|
|
69
74
|
_context.t0 = _context["catch"](1);
|
|
70
75
|
logger.error('unexpected fetchSessionCode result', _context.t0);
|
|
71
76
|
|
|
72
|
-
case
|
|
77
|
+
case 20:
|
|
73
78
|
if (onClose) {
|
|
74
79
|
onClose();
|
|
75
80
|
}
|
|
76
81
|
|
|
77
|
-
case
|
|
82
|
+
case 21:
|
|
78
83
|
case "end":
|
|
79
84
|
return _context.stop();
|
|
80
85
|
}
|
|
81
86
|
}
|
|
82
|
-
}, _callee, null, [[1,
|
|
87
|
+
}, _callee, null, [[1, 17]]);
|
|
83
88
|
}));
|
|
84
89
|
return _insideEffect.apply(this, arguments);
|
|
85
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-harvest-lib",
|
|
3
|
-
"version": "9.12.
|
|
3
|
+
"version": "9.12.3",
|
|
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": "
|
|
90
|
+
"gitHead": "d30a54bd88f19c084bc06abee965039f4fe02742"
|
|
91
91
|
}
|
|
@@ -31,11 +31,16 @@ const InAppBrowser = ({ url, onClose, intentsApi = {} }) => {
|
|
|
31
31
|
async function insideEffect() {
|
|
32
32
|
if (isReady) {
|
|
33
33
|
try {
|
|
34
|
+
logger.debug('url at the beginning: ', url)
|
|
34
35
|
const sessionCode = await fetchSessionCode()
|
|
35
36
|
logger.debug('got session code', sessionCode)
|
|
36
37
|
const iabUrl = new URL(url)
|
|
37
38
|
iabUrl.searchParams.append(tokenParamName, sessionCode)
|
|
38
|
-
|
|
39
|
+
// we need to decodeURIComponent since toString() encodes URL
|
|
40
|
+
// but native browser will also encode them.
|
|
41
|
+
const urlToOpen = decodeURIComponent(iabUrl.toString())
|
|
42
|
+
logger.debug('url to open: ', urlToOpen)
|
|
43
|
+
const result = await showInAppBrowser(urlToOpen)
|
|
39
44
|
if (result?.type !== 'dismiss' && result?.type !== 'cancel') {
|
|
40
45
|
logger.error('Unexpected InAppBrowser result', result)
|
|
41
46
|
}
|