@como/como-client 0.7.95 → 0.7.98
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/lib/como.js +69 -65
- package/lib/services/auth.service.js +11 -7
- package/package.json +1 -1
- package/src/como.js +13 -10
package/lib/como.js
CHANGED
|
@@ -201,7 +201,7 @@ var Como = function () {
|
|
|
201
201
|
refreshFailed = false;
|
|
202
202
|
|
|
203
203
|
if (!isExpired) {
|
|
204
|
-
_context2.next =
|
|
204
|
+
_context2.next = 29;
|
|
205
205
|
break;
|
|
206
206
|
}
|
|
207
207
|
|
|
@@ -213,7 +213,7 @@ var Como = function () {
|
|
|
213
213
|
data = _context2.sent;
|
|
214
214
|
|
|
215
215
|
updateCredentials(data, true);
|
|
216
|
-
_context2.next =
|
|
216
|
+
_context2.next = 29;
|
|
217
217
|
break;
|
|
218
218
|
|
|
219
219
|
case 24:
|
|
@@ -224,75 +224,74 @@ var Como = function () {
|
|
|
224
224
|
//refresh failed - need to revoke and signOn again
|
|
225
225
|
initService.logError({ method: 'refreshToken', installationId: installationId, locationId: locationId, source: source, refreshToken: refreshToken, error: _context2.t0.message });
|
|
226
226
|
refreshFailed = true;
|
|
227
|
-
credExist = false;
|
|
228
227
|
|
|
229
|
-
case
|
|
228
|
+
case 29:
|
|
230
229
|
interval = 0;
|
|
231
230
|
|
|
232
|
-
if (credExist) {
|
|
233
|
-
_context2.next =
|
|
231
|
+
if (!(refreshFailed || !credExist)) {
|
|
232
|
+
_context2.next = 51;
|
|
234
233
|
break;
|
|
235
234
|
}
|
|
236
235
|
|
|
237
|
-
case
|
|
236
|
+
case 31:
|
|
238
237
|
if (!(!credExist && interval < 3000)) {
|
|
239
|
-
_context2.next =
|
|
238
|
+
_context2.next = 49;
|
|
240
239
|
break;
|
|
241
240
|
}
|
|
242
241
|
|
|
243
|
-
_context2.prev =
|
|
244
|
-
_context2.next =
|
|
242
|
+
_context2.prev = 32;
|
|
243
|
+
_context2.next = 35;
|
|
245
244
|
return this.comoData.initApi.signOn(installationId, locationId, source);
|
|
246
245
|
|
|
247
|
-
case
|
|
246
|
+
case 35:
|
|
248
247
|
_data = _context2.sent;
|
|
249
248
|
|
|
250
249
|
updateCredentials(_data, true);
|
|
251
250
|
credExist = true;
|
|
252
|
-
_context2.next =
|
|
251
|
+
_context2.next = 47;
|
|
253
252
|
break;
|
|
254
253
|
|
|
255
|
-
case
|
|
256
|
-
_context2.prev =
|
|
257
|
-
_context2.t1 = _context2['catch'](
|
|
254
|
+
case 40:
|
|
255
|
+
_context2.prev = 40;
|
|
256
|
+
_context2.t1 = _context2['catch'](32);
|
|
258
257
|
|
|
259
258
|
console.error('Failed to signOn, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',interval:' + interval + ', error:' + _context2.t1);
|
|
260
259
|
interval += 1000;
|
|
261
260
|
initService.logError({ method: 'signOn no accessToken', accessToken: accessToken, isExpired: isExpired, refreshFailed: refreshFailed, credExist: credExist, installationId: installationId, locationId: locationId, source: source, refreshToken: refreshToken, interval: interval, error: _context2.t1.message });
|
|
262
|
-
_context2.next =
|
|
261
|
+
_context2.next = 47;
|
|
263
262
|
return new _promise2.default(function (r) {
|
|
264
263
|
return setTimeout(r, interval);
|
|
265
264
|
});
|
|
266
265
|
|
|
267
|
-
case
|
|
268
|
-
_context2.next =
|
|
266
|
+
case 47:
|
|
267
|
+
_context2.next = 31;
|
|
269
268
|
break;
|
|
270
269
|
|
|
271
|
-
case
|
|
272
|
-
_context2.next =
|
|
270
|
+
case 49:
|
|
271
|
+
_context2.next = 74;
|
|
273
272
|
break;
|
|
274
273
|
|
|
275
|
-
case
|
|
274
|
+
case 51:
|
|
276
275
|
if (isExpired) {
|
|
277
|
-
_context2.next =
|
|
276
|
+
_context2.next = 74;
|
|
278
277
|
break;
|
|
279
278
|
}
|
|
280
279
|
|
|
281
280
|
signOnSuccessfully = false;
|
|
282
281
|
|
|
283
|
-
case
|
|
282
|
+
case 53:
|
|
284
283
|
if (!(!signOnSuccessfully && interval < 3000)) {
|
|
285
|
-
_context2.next =
|
|
284
|
+
_context2.next = 74;
|
|
286
285
|
break;
|
|
287
286
|
}
|
|
288
287
|
|
|
289
|
-
_context2.prev =
|
|
288
|
+
_context2.prev = 54;
|
|
290
289
|
|
|
291
290
|
console.log('signOn with installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',accessToken:' + accessToken);
|
|
292
|
-
_context2.next =
|
|
291
|
+
_context2.next = 58;
|
|
293
292
|
return this.comoData.initApi.signOn(installationId, locationId, source, accessToken);
|
|
294
293
|
|
|
295
|
-
case
|
|
294
|
+
case 58:
|
|
296
295
|
_data2 = _context2.sent;
|
|
297
296
|
|
|
298
297
|
console.log('signOn with result " ' + (0, _stringify2.default)(_data2));
|
|
@@ -304,37 +303,37 @@ var Como = function () {
|
|
|
304
303
|
this.comoData.reCaptchaSiteKey = _data2.config.recaptchaSiteKey;
|
|
305
304
|
}
|
|
306
305
|
signOnSuccessfully = true;
|
|
307
|
-
_context2.next =
|
|
306
|
+
_context2.next = 72;
|
|
308
307
|
break;
|
|
309
308
|
|
|
310
|
-
case
|
|
311
|
-
_context2.prev =
|
|
312
|
-
_context2.t2 = _context2['catch'](
|
|
309
|
+
case 65:
|
|
310
|
+
_context2.prev = 65;
|
|
311
|
+
_context2.t2 = _context2['catch'](54);
|
|
313
312
|
|
|
314
313
|
console.error('Failed signOn with accessToken, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',accessToken:' + accessToken + ', error:' + _context2.t2.message);
|
|
315
314
|
interval += 1000;
|
|
316
315
|
initService.logError({ method: 'signOn with credentials', accessToken: accessToken, isExpired: isExpired, refreshFailed: refreshFailed, credExist: credExist, installationId: installationId, locationId: locationId, source: source, refreshToken: refreshToken, interval: interval, error: _context2.t2.message });
|
|
317
|
-
_context2.next =
|
|
316
|
+
_context2.next = 72;
|
|
318
317
|
return new _promise2.default(function (r) {
|
|
319
318
|
return setTimeout(r, interval);
|
|
320
319
|
});
|
|
321
320
|
|
|
322
|
-
case
|
|
323
|
-
_context2.next =
|
|
321
|
+
case 72:
|
|
322
|
+
_context2.next = 53;
|
|
324
323
|
break;
|
|
325
324
|
|
|
326
|
-
case
|
|
325
|
+
case 74:
|
|
327
326
|
if (!this.comoData.token) {
|
|
328
327
|
this.comoData.token = this.comoData.accessToken;
|
|
329
328
|
}
|
|
330
329
|
return _context2.abrupt('return', this.getCredentials());
|
|
331
330
|
|
|
332
|
-
case
|
|
331
|
+
case 76:
|
|
333
332
|
case 'end':
|
|
334
333
|
return _context2.stop();
|
|
335
334
|
}
|
|
336
335
|
}
|
|
337
|
-
}, _callee2, this, [[17, 24], [
|
|
336
|
+
}, _callee2, this, [[17, 24], [32, 40], [54, 65]]);
|
|
338
337
|
}));
|
|
339
338
|
|
|
340
339
|
function init(_x, _x2, _x3) {
|
|
@@ -805,12 +804,14 @@ var Como = function () {
|
|
|
805
804
|
* @param {Object} identifier an object which identifies the user by its credentials
|
|
806
805
|
* @param {string} type login type i.e PhoneNumber/Email/etc
|
|
807
806
|
* @param {reCaptchaToken} reCaptcha token for login chalenge
|
|
807
|
+
* @param {recaptchaTokenType} recaptcha token type - score/human
|
|
808
|
+
* @param {devicePlatform} device platform i.e. ios/android
|
|
808
809
|
*/
|
|
809
810
|
|
|
810
811
|
}, {
|
|
811
812
|
key: 'login',
|
|
812
813
|
value: function () {
|
|
813
|
-
var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(identifier, type, reCaptchaToken) {
|
|
814
|
+
var _ref11 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee11(identifier, type, reCaptchaToken, recaptchaTokenType, devicePlatform) {
|
|
814
815
|
var api, data, _error$response$data7, code, message;
|
|
815
816
|
|
|
816
817
|
return _regenerator2.default.wrap(function _callee11$(_context11) {
|
|
@@ -820,7 +821,7 @@ var Como = function () {
|
|
|
820
821
|
api = this.comoData.api;
|
|
821
822
|
_context11.prev = 1;
|
|
822
823
|
_context11.next = 4;
|
|
823
|
-
return api.logIn(type, identifier, reCaptchaToken);
|
|
824
|
+
return api.logIn(type, identifier, reCaptchaToken, recaptchaTokenType, devicePlatform);
|
|
824
825
|
|
|
825
826
|
case 4:
|
|
826
827
|
data = _context11.sent;
|
|
@@ -849,7 +850,7 @@ var Como = function () {
|
|
|
849
850
|
}, _callee11, this, [[1, 8]]);
|
|
850
851
|
}));
|
|
851
852
|
|
|
852
|
-
function login(_x30, _x31, _x32) {
|
|
853
|
+
function login(_x30, _x31, _x32, _x33, _x34) {
|
|
853
854
|
return _ref11.apply(this, arguments);
|
|
854
855
|
}
|
|
855
856
|
|
|
@@ -862,12 +863,14 @@ var Como = function () {
|
|
|
862
863
|
* @param {*} type login type i.e PhoneNumber/Email/etc
|
|
863
864
|
* @param {*} code a 2-factor verification code sent to the client
|
|
864
865
|
* @param {reCaptchaToken} reCaptcha token for login challenge
|
|
866
|
+
* @param {recaptchaTokenType} recaptcha token type - score/human
|
|
867
|
+
* @param {devicePlatform} device platform i.e. ios/android
|
|
865
868
|
*/
|
|
866
869
|
|
|
867
870
|
}, {
|
|
868
871
|
key: 'loginVerify',
|
|
869
872
|
value: function () {
|
|
870
|
-
var _ref12 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12(identifier, type, code, reCaptchaToken) {
|
|
873
|
+
var _ref12 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee12(identifier, type, code, reCaptchaToken, recaptchaTokenType, devicePlatform) {
|
|
871
874
|
var api, _ref13, consent, _error$response$data8, errCode, message;
|
|
872
875
|
|
|
873
876
|
return _regenerator2.default.wrap(function _callee12$(_context12) {
|
|
@@ -877,7 +880,7 @@ var Como = function () {
|
|
|
877
880
|
api = this.comoData.api;
|
|
878
881
|
_context12.prev = 1;
|
|
879
882
|
_context12.next = 4;
|
|
880
|
-
return api.logInVerify(code, type, identifier, reCaptchaToken);
|
|
883
|
+
return api.logInVerify(code, type, identifier, reCaptchaToken, recaptchaTokenType, devicePlatform);
|
|
881
884
|
|
|
882
885
|
case 4:
|
|
883
886
|
_ref13 = _context12.sent;
|
|
@@ -922,7 +925,7 @@ var Como = function () {
|
|
|
922
925
|
}, _callee12, this, [[1, 9]]);
|
|
923
926
|
}));
|
|
924
927
|
|
|
925
|
-
function loginVerify(
|
|
928
|
+
function loginVerify(_x35, _x36, _x37, _x38, _x39, _x40) {
|
|
926
929
|
return _ref12.apply(this, arguments);
|
|
927
930
|
}
|
|
928
931
|
|
|
@@ -997,7 +1000,7 @@ var Como = function () {
|
|
|
997
1000
|
}, _callee14, this);
|
|
998
1001
|
}));
|
|
999
1002
|
|
|
1000
|
-
function openApp(
|
|
1003
|
+
function openApp(_x42) {
|
|
1001
1004
|
return _ref15.apply(this, arguments);
|
|
1002
1005
|
}
|
|
1003
1006
|
|
|
@@ -1038,7 +1041,7 @@ var Como = function () {
|
|
|
1038
1041
|
}, _callee15, this, [[1, 5]]);
|
|
1039
1042
|
}));
|
|
1040
1043
|
|
|
1041
|
-
function clientUpdateMembership(
|
|
1044
|
+
function clientUpdateMembership(_x43, _x44) {
|
|
1042
1045
|
return _ref16.apply(this, arguments);
|
|
1043
1046
|
}
|
|
1044
1047
|
|
|
@@ -1099,7 +1102,7 @@ var Como = function () {
|
|
|
1099
1102
|
}, _callee16, this, [[0, 12]]);
|
|
1100
1103
|
}));
|
|
1101
1104
|
|
|
1102
|
-
function downloadMainResource(
|
|
1105
|
+
function downloadMainResource(_x45) {
|
|
1103
1106
|
return _ref17.apply(this, arguments);
|
|
1104
1107
|
}
|
|
1105
1108
|
|
|
@@ -1317,7 +1320,7 @@ var Como = function () {
|
|
|
1317
1320
|
}, _callee21, this);
|
|
1318
1321
|
}));
|
|
1319
1322
|
|
|
1320
|
-
function redeemAsset(
|
|
1323
|
+
function redeemAsset(_x46) {
|
|
1321
1324
|
return _ref22.apply(this, arguments);
|
|
1322
1325
|
}
|
|
1323
1326
|
|
|
@@ -1355,7 +1358,7 @@ var Como = function () {
|
|
|
1355
1358
|
}, _callee22, this);
|
|
1356
1359
|
}));
|
|
1357
1360
|
|
|
1358
|
-
function purchaseAsset(
|
|
1361
|
+
function purchaseAsset(_x47) {
|
|
1359
1362
|
return _ref23.apply(this, arguments);
|
|
1360
1363
|
}
|
|
1361
1364
|
|
|
@@ -1419,7 +1422,7 @@ var Como = function () {
|
|
|
1419
1422
|
}, _callee24, this);
|
|
1420
1423
|
}));
|
|
1421
1424
|
|
|
1422
|
-
function purchaseAssetAPI2(
|
|
1425
|
+
function purchaseAssetAPI2(_x48) {
|
|
1423
1426
|
return _ref25.apply(this, arguments);
|
|
1424
1427
|
}
|
|
1425
1428
|
|
|
@@ -1649,10 +1652,11 @@ var Como = function () {
|
|
|
1649
1652
|
refreshToken = _comoData22.refreshToken,
|
|
1650
1653
|
expiresIn = _comoData22.expiresIn,
|
|
1651
1654
|
consent = _comoData22.consent,
|
|
1652
|
-
locationId = _comoData22.locationId
|
|
1655
|
+
locationId = _comoData22.locationId,
|
|
1656
|
+
recaptchaConfig = _comoData22.recaptchaConfig;
|
|
1653
1657
|
|
|
1654
1658
|
return {
|
|
1655
|
-
accessToken: accessToken, refreshToken: refreshToken, expiresIn: expiresIn, consent: consent, locationId: locationId
|
|
1659
|
+
accessToken: accessToken, refreshToken: refreshToken, expiresIn: expiresIn, consent: consent, locationId: locationId, recaptchaConfig: recaptchaConfig
|
|
1656
1660
|
};
|
|
1657
1661
|
}
|
|
1658
1662
|
|
|
@@ -1706,7 +1710,7 @@ var Como = function () {
|
|
|
1706
1710
|
}, {
|
|
1707
1711
|
key: 'getRecaptchaConfig',
|
|
1708
1712
|
value: function getRecaptchaConfig() {
|
|
1709
|
-
return { reCaptchaSiteKey: this.comoData.reCaptchaSiteKey, baseUrl: this.comoData.env_params.gateway };
|
|
1713
|
+
return { reCaptchaSiteKey: this.comoData.reCaptchaSiteKey, baseUrl: this.comoData.env_params.gateway, recaptchaConfig: this.comoData.recaptchaConfig };
|
|
1710
1714
|
}
|
|
1711
1715
|
|
|
1712
1716
|
/**
|
|
@@ -1741,7 +1745,7 @@ var Como = function () {
|
|
|
1741
1745
|
}, _callee27, this);
|
|
1742
1746
|
}));
|
|
1743
1747
|
|
|
1744
|
-
function getRegistrationUrl(
|
|
1748
|
+
function getRegistrationUrl(_x49) {
|
|
1745
1749
|
return _ref28.apply(this, arguments);
|
|
1746
1750
|
}
|
|
1747
1751
|
|
|
@@ -1780,7 +1784,7 @@ var Como = function () {
|
|
|
1780
1784
|
}, _callee28, this);
|
|
1781
1785
|
}));
|
|
1782
1786
|
|
|
1783
|
-
function getProfileUrl(
|
|
1787
|
+
function getProfileUrl(_x50) {
|
|
1784
1788
|
return _ref29.apply(this, arguments);
|
|
1785
1789
|
}
|
|
1786
1790
|
|
|
@@ -1853,7 +1857,7 @@ var Como = function () {
|
|
|
1853
1857
|
}, _callee30, this);
|
|
1854
1858
|
}));
|
|
1855
1859
|
|
|
1856
|
-
function getDataPortabilityUrl(
|
|
1860
|
+
function getDataPortabilityUrl(_x51, _x52) {
|
|
1857
1861
|
return _ref31.apply(this, arguments);
|
|
1858
1862
|
}
|
|
1859
1863
|
|
|
@@ -2046,7 +2050,7 @@ var Como = function () {
|
|
|
2046
2050
|
}, _callee33, this);
|
|
2047
2051
|
}));
|
|
2048
2052
|
|
|
2049
|
-
function addPaymentMethod(
|
|
2053
|
+
function addPaymentMethod(_x54) {
|
|
2050
2054
|
return _ref34.apply(this, arguments);
|
|
2051
2055
|
}
|
|
2052
2056
|
|
|
@@ -2073,7 +2077,7 @@ var Como = function () {
|
|
|
2073
2077
|
}, _callee34, this);
|
|
2074
2078
|
}));
|
|
2075
2079
|
|
|
2076
|
-
function knowYourData(
|
|
2080
|
+
function knowYourData(_x55) {
|
|
2077
2081
|
return _ref35.apply(this, arguments);
|
|
2078
2082
|
}
|
|
2079
2083
|
|
|
@@ -2100,7 +2104,7 @@ var Como = function () {
|
|
|
2100
2104
|
}, _callee35, this);
|
|
2101
2105
|
}));
|
|
2102
2106
|
|
|
2103
|
-
function consentWithdraw(
|
|
2107
|
+
function consentWithdraw(_x56) {
|
|
2104
2108
|
return _ref36.apply(this, arguments);
|
|
2105
2109
|
}
|
|
2106
2110
|
|
|
@@ -2173,7 +2177,7 @@ var Como = function () {
|
|
|
2173
2177
|
}, _callee37, this);
|
|
2174
2178
|
}));
|
|
2175
2179
|
|
|
2176
|
-
function payInApp(
|
|
2180
|
+
function payInApp(_x57, _x58, _x59, _x60, _x61) {
|
|
2177
2181
|
return _ref38.apply(this, arguments);
|
|
2178
2182
|
}
|
|
2179
2183
|
|
|
@@ -2210,7 +2214,7 @@ var Como = function () {
|
|
|
2210
2214
|
}, _callee38, this);
|
|
2211
2215
|
}));
|
|
2212
2216
|
|
|
2213
|
-
function deletePayment(
|
|
2217
|
+
function deletePayment(_x62) {
|
|
2214
2218
|
return _ref39.apply(this, arguments);
|
|
2215
2219
|
}
|
|
2216
2220
|
|
|
@@ -2247,7 +2251,7 @@ var Como = function () {
|
|
|
2247
2251
|
}, _callee39, this);
|
|
2248
2252
|
}));
|
|
2249
2253
|
|
|
2250
|
-
function getMemberMessages(
|
|
2254
|
+
function getMemberMessages(_x63, _x64, _x65) {
|
|
2251
2255
|
return _ref40.apply(this, arguments);
|
|
2252
2256
|
}
|
|
2253
2257
|
|
|
@@ -2297,7 +2301,7 @@ var Como = function () {
|
|
|
2297
2301
|
}, _callee40, this);
|
|
2298
2302
|
}));
|
|
2299
2303
|
|
|
2300
|
-
function budgetTransfer(
|
|
2304
|
+
function budgetTransfer(_x67, _x68, _x69, _x70) {
|
|
2301
2305
|
return _ref41.apply(this, arguments);
|
|
2302
2306
|
}
|
|
2303
2307
|
|
|
@@ -2343,7 +2347,7 @@ var Como = function () {
|
|
|
2343
2347
|
}, _callee41, this);
|
|
2344
2348
|
}));
|
|
2345
2349
|
|
|
2346
|
-
function budgetTransferClaim(
|
|
2350
|
+
function budgetTransferClaim(_x71) {
|
|
2347
2351
|
return _ref42.apply(this, arguments);
|
|
2348
2352
|
}
|
|
2349
2353
|
|
|
@@ -2395,7 +2399,7 @@ var Como = function () {
|
|
|
2395
2399
|
}, _callee42, this);
|
|
2396
2400
|
}));
|
|
2397
2401
|
|
|
2398
|
-
function logUserAction(
|
|
2402
|
+
function logUserAction(_x72, _x73) {
|
|
2399
2403
|
return _ref43.apply(this, arguments);
|
|
2400
2404
|
}
|
|
2401
2405
|
|
|
@@ -2429,7 +2433,7 @@ var Como = function () {
|
|
|
2429
2433
|
}, _callee43, this);
|
|
2430
2434
|
}));
|
|
2431
2435
|
|
|
2432
|
-
function getPurchaseHistory(
|
|
2436
|
+
function getPurchaseHistory(_x74, _x75) {
|
|
2433
2437
|
return _ref44.apply(this, arguments);
|
|
2434
2438
|
}
|
|
2435
2439
|
|
|
@@ -267,14 +267,16 @@ exports.unsubscribeSms = function (service) {
|
|
|
267
267
|
|
|
268
268
|
exports.logIn = function (service) {
|
|
269
269
|
return function () {
|
|
270
|
-
var _ref15 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(type, identifier, reCaptchaToken) {
|
|
270
|
+
var _ref15 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee8(type, identifier, reCaptchaToken, recaptchaTokenType, devicePlatform) {
|
|
271
271
|
var params, headers, _ref16, data;
|
|
272
272
|
|
|
273
273
|
return _regenerator2.default.wrap(function _callee8$(_context8) {
|
|
274
274
|
while (1) {
|
|
275
275
|
switch (_context8.prev = _context8.next) {
|
|
276
276
|
case 0:
|
|
277
|
-
params = {
|
|
277
|
+
params = {
|
|
278
|
+
type: type, identifier: identifier, reCaptchaToken: reCaptchaToken, recaptchaTokenType: recaptchaTokenType, devicePlatform: devicePlatform
|
|
279
|
+
};
|
|
278
280
|
headers = getHashHeader(params);
|
|
279
281
|
_context8.next = 4;
|
|
280
282
|
return service.post('/auth/v2/auth/logIn', params, { headers: headers });
|
|
@@ -292,7 +294,7 @@ exports.logIn = function (service) {
|
|
|
292
294
|
}, _callee8, undefined);
|
|
293
295
|
}));
|
|
294
296
|
|
|
295
|
-
return function (_x25, _x26, _x27) {
|
|
297
|
+
return function (_x25, _x26, _x27, _x28, _x29) {
|
|
296
298
|
return _ref15.apply(this, arguments);
|
|
297
299
|
};
|
|
298
300
|
}();
|
|
@@ -300,7 +302,7 @@ exports.logIn = function (service) {
|
|
|
300
302
|
|
|
301
303
|
exports.logInVerify = function (service) {
|
|
302
304
|
return function () {
|
|
303
|
-
var _ref17 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(code, type, identifier, reCaptchaToken) {
|
|
305
|
+
var _ref17 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee9(code, type, identifier, reCaptchaToken, recaptchaTokenType, devicePlatform) {
|
|
304
306
|
var params, headers, _ref18, data;
|
|
305
307
|
|
|
306
308
|
return _regenerator2.default.wrap(function _callee9$(_context9) {
|
|
@@ -311,7 +313,9 @@ exports.logInVerify = function (service) {
|
|
|
311
313
|
identifier: identifier,
|
|
312
314
|
code: code,
|
|
313
315
|
type: type,
|
|
314
|
-
reCaptchaToken: reCaptchaToken
|
|
316
|
+
reCaptchaToken: reCaptchaToken,
|
|
317
|
+
recaptchaTokenType: recaptchaTokenType,
|
|
318
|
+
devicePlatform: devicePlatform
|
|
315
319
|
};
|
|
316
320
|
headers = getHashHeader(params);
|
|
317
321
|
_context9.next = 4;
|
|
@@ -330,7 +334,7 @@ exports.logInVerify = function (service) {
|
|
|
330
334
|
}, _callee9, undefined);
|
|
331
335
|
}));
|
|
332
336
|
|
|
333
|
-
return function (
|
|
337
|
+
return function (_x30, _x31, _x32, _x33, _x34, _x35) {
|
|
334
338
|
return _ref17.apply(this, arguments);
|
|
335
339
|
};
|
|
336
340
|
}();
|
|
@@ -388,7 +392,7 @@ exports.refreshToken = function (service) {
|
|
|
388
392
|
}, _callee11, undefined);
|
|
389
393
|
}));
|
|
390
394
|
|
|
391
|
-
return function (
|
|
395
|
+
return function (_x36, _x37, _x38, _x39) {
|
|
392
396
|
return _ref21.apply(this, arguments);
|
|
393
397
|
};
|
|
394
398
|
}();
|
package/package.json
CHANGED
package/src/como.js
CHANGED
|
@@ -115,11 +115,10 @@ class Como {
|
|
|
115
115
|
//refresh failed - need to revoke and signOn again
|
|
116
116
|
initService.logError({method: 'refreshToken', installationId, locationId, source, refreshToken, error : e.message});
|
|
117
117
|
refreshFailed = true;
|
|
118
|
-
credExist = false;
|
|
119
118
|
}
|
|
120
119
|
}
|
|
121
120
|
let interval = 0;
|
|
122
|
-
if(!credExist){
|
|
121
|
+
if(refreshFailed || !credExist){
|
|
123
122
|
while(!credExist && interval < 3000){
|
|
124
123
|
try{
|
|
125
124
|
const data = await this.comoData.initApi.signOn(installationId, locationId, source);
|
|
@@ -135,7 +134,7 @@ class Como {
|
|
|
135
134
|
}
|
|
136
135
|
else if(!isExpired){
|
|
137
136
|
let signOnSuccessfully = false;
|
|
138
|
-
while
|
|
137
|
+
while(!signOnSuccessfully && interval < 3000){
|
|
139
138
|
try{
|
|
140
139
|
console.log(`signOn with installationId:${installationId}, locationId:${locationId}, source:${source},accessToken:${accessToken}`);
|
|
141
140
|
const data = await this.comoData.initApi.signOn(installationId, locationId, source, accessToken);
|
|
@@ -349,11 +348,13 @@ class Como {
|
|
|
349
348
|
* @param {Object} identifier an object which identifies the user by its credentials
|
|
350
349
|
* @param {string} type login type i.e PhoneNumber/Email/etc
|
|
351
350
|
* @param {reCaptchaToken} reCaptcha token for login chalenge
|
|
351
|
+
* @param {recaptchaTokenType} recaptcha token type - score/human
|
|
352
|
+
* @param {devicePlatform} device platform i.e. ios/android
|
|
352
353
|
*/
|
|
353
|
-
async login(identifier, type, reCaptchaToken) {
|
|
354
|
+
async login(identifier, type, reCaptchaToken, recaptchaTokenType, devicePlatform) {
|
|
354
355
|
const { api } = this.comoData;
|
|
355
356
|
try {
|
|
356
|
-
const data = await api.logIn(type, identifier, reCaptchaToken);
|
|
357
|
+
const data = await api.logIn(type, identifier, reCaptchaToken, recaptchaTokenType, devicePlatform);
|
|
357
358
|
return data;
|
|
358
359
|
} catch (error) {
|
|
359
360
|
if (error.response && error.response.data) {
|
|
@@ -370,11 +371,13 @@ class Como {
|
|
|
370
371
|
* @param {*} type login type i.e PhoneNumber/Email/etc
|
|
371
372
|
* @param {*} code a 2-factor verification code sent to the client
|
|
372
373
|
* @param {reCaptchaToken} reCaptcha token for login challenge
|
|
374
|
+
* @param {recaptchaTokenType} recaptcha token type - score/human
|
|
375
|
+
* @param {devicePlatform} device platform i.e. ios/android
|
|
373
376
|
*/
|
|
374
|
-
async loginVerify(identifier, type, code, reCaptchaToken) {
|
|
377
|
+
async loginVerify(identifier, type, code, reCaptchaToken, recaptchaTokenType, devicePlatform) {
|
|
375
378
|
const { api } = this.comoData;
|
|
376
379
|
try {
|
|
377
|
-
const { consent } = await api.logInVerify(code, type, identifier, reCaptchaToken);
|
|
380
|
+
const { consent } = await api.logInVerify(code, type, identifier, reCaptchaToken, recaptchaTokenType, devicePlatform);
|
|
378
381
|
this.comoData.consent = consent;
|
|
379
382
|
} catch (error) {
|
|
380
383
|
if (error.response && error.response.data) {
|
|
@@ -687,10 +690,10 @@ class Como {
|
|
|
687
690
|
*/
|
|
688
691
|
getCredentials() {
|
|
689
692
|
const {
|
|
690
|
-
accessToken, refreshToken, expiresIn, consent, locationId
|
|
693
|
+
accessToken, refreshToken, expiresIn, consent, locationId, recaptchaConfig,
|
|
691
694
|
} = this.comoData;
|
|
692
695
|
return {
|
|
693
|
-
accessToken, refreshToken, expiresIn, consent, locationId
|
|
696
|
+
accessToken, refreshToken, expiresIn, consent, locationId, recaptchaConfig,
|
|
694
697
|
};
|
|
695
698
|
}
|
|
696
699
|
|
|
@@ -720,7 +723,7 @@ class Como {
|
|
|
720
723
|
/**
|
|
721
724
|
* Return service recaptch config
|
|
722
725
|
*/
|
|
723
|
-
getRecaptchaConfig() { return {reCaptchaSiteKey: this.comoData.reCaptchaSiteKey, baseUrl: this.comoData.env_params.gateway } }
|
|
726
|
+
getRecaptchaConfig() { return { reCaptchaSiteKey: this.comoData.reCaptchaSiteKey, baseUrl: this.comoData.env_params.gateway, recaptchaConfig: this.comoData.recaptchaConfig } }
|
|
724
727
|
|
|
725
728
|
/**
|
|
726
729
|
* Returns the location specific registration web url
|