hylid-bridge 6.0.0 → 6.1.0
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.
|
@@ -12,6 +12,7 @@ var getAuthCode = function getAuthCode(options) {
|
|
|
12
12
|
scopes = _a.scopes,
|
|
13
13
|
rest = __rest(_a, ["scopes"]);
|
|
14
14
|
var getAuthCode = function getAuthCode(scopes) {
|
|
15
|
+
console.log('getAuthCode-start');
|
|
15
16
|
return new Promise(function (resolve, reject) {
|
|
16
17
|
var _a, _b, _c;
|
|
17
18
|
// 生成一次性回调 id,防止并发冲突
|
|
@@ -20,6 +21,7 @@ var getAuthCode = function getAuthCode(options) {
|
|
|
20
21
|
// 挂载临时全局回调
|
|
21
22
|
window[cbName] = function (code, scopesArr, errCode, errMsg) {
|
|
22
23
|
delete window[cbName];
|
|
24
|
+
console.log('test-code', code, scopesArr, errCode, errMsg);
|
|
23
25
|
if (code) {
|
|
24
26
|
resolve({
|
|
25
27
|
authCode: code,
|
|
@@ -46,6 +48,7 @@ var getAuthCode = function getAuthCode(options) {
|
|
|
46
48
|
}
|
|
47
49
|
// iOS:通过 messageHandler
|
|
48
50
|
else if ((window === null || window === void 0 ? void 0 : window.webkit) && ((_b = window === null || window === void 0 ? void 0 : window.webkit) === null || _b === void 0 ? void 0 : _b.messageHandlers.AlipayPlusRewardsBridge)) {
|
|
51
|
+
console.log('getAuthCode-end-ios');
|
|
49
52
|
(_c = window === null || window === void 0 ? void 0 : window.webkit) === null || _c === void 0 ? void 0 : _c.messageHandlers.AlipayPlusRewardsBridge.postMessage({
|
|
50
53
|
action: 'getAuthCode',
|
|
51
54
|
scopes: scopes,
|
|
@@ -151,6 +151,7 @@ export default (function (options) {
|
|
|
151
151
|
};
|
|
152
152
|
var convertResponse = function convertResponse(response) {
|
|
153
153
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
154
|
+
var e_1;
|
|
154
155
|
return __generator(this, function (_a) {
|
|
155
156
|
switch (_a.label) {
|
|
156
157
|
case 0:
|
|
@@ -159,9 +160,15 @@ export default (function (options) {
|
|
|
159
160
|
case 1:
|
|
160
161
|
return [2 /*return*/, _a.sent()];
|
|
161
162
|
case 2:
|
|
163
|
+
_a.trys.push([2, 4,, 5]);
|
|
162
164
|
return [4 /*yield*/, response.json()];
|
|
163
165
|
case 3:
|
|
164
166
|
return [2 /*return*/, _a.sent()];
|
|
167
|
+
case 4:
|
|
168
|
+
e_1 = _a.sent();
|
|
169
|
+
return [2 /*return*/, {}];
|
|
170
|
+
case 5:
|
|
171
|
+
return [2 /*return*/];
|
|
165
172
|
}
|
|
166
173
|
});
|
|
167
174
|
});
|