@como/como-client 0.7.94 → 0.7.97

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 CHANGED
@@ -364,6 +364,9 @@ var Como = function () {
364
364
  this.comoData.expiresIn = credentials.expiresIn;
365
365
  if (credentials.config) {
366
366
  this.comoData.reCaptchaSiteKey = credentials.config.recaptchaSiteKey;
367
+ if (credentials.config.recaptcha) {
368
+ this.comoData.recaptchaConfig = credentials.config.recaptcha;
369
+ }
367
370
  }
368
371
  }
369
372
  }, {
@@ -801,12 +804,14 @@ var Como = function () {
801
804
  * @param {Object} identifier an object which identifies the user by its credentials
802
805
  * @param {string} type login type i.e PhoneNumber/Email/etc
803
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
804
809
  */
805
810
 
806
811
  }, {
807
812
  key: 'login',
808
813
  value: function () {
809
- 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) {
810
815
  var api, data, _error$response$data7, code, message;
811
816
 
812
817
  return _regenerator2.default.wrap(function _callee11$(_context11) {
@@ -816,7 +821,7 @@ var Como = function () {
816
821
  api = this.comoData.api;
817
822
  _context11.prev = 1;
818
823
  _context11.next = 4;
819
- return api.logIn(type, identifier, reCaptchaToken);
824
+ return api.logIn(type, identifier, reCaptchaToken, recaptchaTokenType, devicePlatform);
820
825
 
821
826
  case 4:
822
827
  data = _context11.sent;
@@ -845,7 +850,7 @@ var Como = function () {
845
850
  }, _callee11, this, [[1, 8]]);
846
851
  }));
847
852
 
848
- function login(_x30, _x31, _x32) {
853
+ function login(_x30, _x31, _x32, _x33, _x34) {
849
854
  return _ref11.apply(this, arguments);
850
855
  }
851
856
 
@@ -858,12 +863,14 @@ var Como = function () {
858
863
  * @param {*} type login type i.e PhoneNumber/Email/etc
859
864
  * @param {*} code a 2-factor verification code sent to the client
860
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
861
868
  */
862
869
 
863
870
  }, {
864
871
  key: 'loginVerify',
865
872
  value: function () {
866
- 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) {
867
874
  var api, _ref13, consent, _error$response$data8, errCode, message;
868
875
 
869
876
  return _regenerator2.default.wrap(function _callee12$(_context12) {
@@ -873,7 +880,7 @@ var Como = function () {
873
880
  api = this.comoData.api;
874
881
  _context12.prev = 1;
875
882
  _context12.next = 4;
876
- return api.logInVerify(code, type, identifier, reCaptchaToken);
883
+ return api.logInVerify(code, type, identifier, reCaptchaToken, recaptchaTokenType, devicePlatform);
877
884
 
878
885
  case 4:
879
886
  _ref13 = _context12.sent;
@@ -918,7 +925,7 @@ var Como = function () {
918
925
  }, _callee12, this, [[1, 9]]);
919
926
  }));
920
927
 
921
- function loginVerify(_x33, _x34, _x35, _x36) {
928
+ function loginVerify(_x35, _x36, _x37, _x38, _x39, _x40) {
922
929
  return _ref12.apply(this, arguments);
923
930
  }
924
931
 
@@ -993,7 +1000,7 @@ var Como = function () {
993
1000
  }, _callee14, this);
994
1001
  }));
995
1002
 
996
- function openApp(_x38) {
1003
+ function openApp(_x42) {
997
1004
  return _ref15.apply(this, arguments);
998
1005
  }
999
1006
 
@@ -1034,7 +1041,7 @@ var Como = function () {
1034
1041
  }, _callee15, this, [[1, 5]]);
1035
1042
  }));
1036
1043
 
1037
- function clientUpdateMembership(_x39, _x40) {
1044
+ function clientUpdateMembership(_x43, _x44) {
1038
1045
  return _ref16.apply(this, arguments);
1039
1046
  }
1040
1047
 
@@ -1095,7 +1102,7 @@ var Como = function () {
1095
1102
  }, _callee16, this, [[0, 12]]);
1096
1103
  }));
1097
1104
 
1098
- function downloadMainResource(_x41) {
1105
+ function downloadMainResource(_x45) {
1099
1106
  return _ref17.apply(this, arguments);
1100
1107
  }
1101
1108
 
@@ -1313,7 +1320,7 @@ var Como = function () {
1313
1320
  }, _callee21, this);
1314
1321
  }));
1315
1322
 
1316
- function redeemAsset(_x42) {
1323
+ function redeemAsset(_x46) {
1317
1324
  return _ref22.apply(this, arguments);
1318
1325
  }
1319
1326
 
@@ -1351,7 +1358,7 @@ var Como = function () {
1351
1358
  }, _callee22, this);
1352
1359
  }));
1353
1360
 
1354
- function purchaseAsset(_x43) {
1361
+ function purchaseAsset(_x47) {
1355
1362
  return _ref23.apply(this, arguments);
1356
1363
  }
1357
1364
 
@@ -1415,7 +1422,7 @@ var Como = function () {
1415
1422
  }, _callee24, this);
1416
1423
  }));
1417
1424
 
1418
- function purchaseAssetAPI2(_x44) {
1425
+ function purchaseAssetAPI2(_x48) {
1419
1426
  return _ref25.apply(this, arguments);
1420
1427
  }
1421
1428
 
@@ -1702,7 +1709,7 @@ var Como = function () {
1702
1709
  }, {
1703
1710
  key: 'getRecaptchaConfig',
1704
1711
  value: function getRecaptchaConfig() {
1705
- return { reCaptchaSiteKey: this.comoData.reCaptchaSiteKey, baseUrl: this.comoData.env_params.gateway };
1712
+ return { reCaptchaSiteKey: this.comoData.reCaptchaSiteKey, baseUrl: this.comoData.env_params.gateway, recaptchaConfig: this.comoData.recaptchaConfig };
1706
1713
  }
1707
1714
 
1708
1715
  /**
@@ -1737,7 +1744,7 @@ var Como = function () {
1737
1744
  }, _callee27, this);
1738
1745
  }));
1739
1746
 
1740
- function getRegistrationUrl(_x45) {
1747
+ function getRegistrationUrl(_x49) {
1741
1748
  return _ref28.apply(this, arguments);
1742
1749
  }
1743
1750
 
@@ -1776,7 +1783,7 @@ var Como = function () {
1776
1783
  }, _callee28, this);
1777
1784
  }));
1778
1785
 
1779
- function getProfileUrl(_x46) {
1786
+ function getProfileUrl(_x50) {
1780
1787
  return _ref29.apply(this, arguments);
1781
1788
  }
1782
1789
 
@@ -1849,7 +1856,7 @@ var Como = function () {
1849
1856
  }, _callee30, this);
1850
1857
  }));
1851
1858
 
1852
- function getDataPortabilityUrl(_x47, _x48) {
1859
+ function getDataPortabilityUrl(_x51, _x52) {
1853
1860
  return _ref31.apply(this, arguments);
1854
1861
  }
1855
1862
 
@@ -2042,7 +2049,7 @@ var Como = function () {
2042
2049
  }, _callee33, this);
2043
2050
  }));
2044
2051
 
2045
- function addPaymentMethod(_x50) {
2052
+ function addPaymentMethod(_x54) {
2046
2053
  return _ref34.apply(this, arguments);
2047
2054
  }
2048
2055
 
@@ -2069,7 +2076,7 @@ var Como = function () {
2069
2076
  }, _callee34, this);
2070
2077
  }));
2071
2078
 
2072
- function knowYourData(_x51) {
2079
+ function knowYourData(_x55) {
2073
2080
  return _ref35.apply(this, arguments);
2074
2081
  }
2075
2082
 
@@ -2096,7 +2103,7 @@ var Como = function () {
2096
2103
  }, _callee35, this);
2097
2104
  }));
2098
2105
 
2099
- function consentWithdraw(_x52) {
2106
+ function consentWithdraw(_x56) {
2100
2107
  return _ref36.apply(this, arguments);
2101
2108
  }
2102
2109
 
@@ -2169,7 +2176,7 @@ var Como = function () {
2169
2176
  }, _callee37, this);
2170
2177
  }));
2171
2178
 
2172
- function payInApp(_x53, _x54, _x55, _x56, _x57) {
2179
+ function payInApp(_x57, _x58, _x59, _x60, _x61) {
2173
2180
  return _ref38.apply(this, arguments);
2174
2181
  }
2175
2182
 
@@ -2206,7 +2213,7 @@ var Como = function () {
2206
2213
  }, _callee38, this);
2207
2214
  }));
2208
2215
 
2209
- function deletePayment(_x58) {
2216
+ function deletePayment(_x62) {
2210
2217
  return _ref39.apply(this, arguments);
2211
2218
  }
2212
2219
 
@@ -2243,7 +2250,7 @@ var Como = function () {
2243
2250
  }, _callee39, this);
2244
2251
  }));
2245
2252
 
2246
- function getMemberMessages(_x59, _x60, _x61) {
2253
+ function getMemberMessages(_x63, _x64, _x65) {
2247
2254
  return _ref40.apply(this, arguments);
2248
2255
  }
2249
2256
 
@@ -2293,7 +2300,7 @@ var Como = function () {
2293
2300
  }, _callee40, this);
2294
2301
  }));
2295
2302
 
2296
- function budgetTransfer(_x63, _x64, _x65, _x66) {
2303
+ function budgetTransfer(_x67, _x68, _x69, _x70) {
2297
2304
  return _ref41.apply(this, arguments);
2298
2305
  }
2299
2306
 
@@ -2339,7 +2346,7 @@ var Como = function () {
2339
2346
  }, _callee41, this);
2340
2347
  }));
2341
2348
 
2342
- function budgetTransferClaim(_x67) {
2349
+ function budgetTransferClaim(_x71) {
2343
2350
  return _ref42.apply(this, arguments);
2344
2351
  }
2345
2352
 
@@ -2391,7 +2398,7 @@ var Como = function () {
2391
2398
  }, _callee42, this);
2392
2399
  }));
2393
2400
 
2394
- function logUserAction(_x68, _x69) {
2401
+ function logUserAction(_x72, _x73) {
2395
2402
  return _ref43.apply(this, arguments);
2396
2403
  }
2397
2404
 
@@ -2425,7 +2432,7 @@ var Como = function () {
2425
2432
  }, _callee43, this);
2426
2433
  }));
2427
2434
 
2428
- function getPurchaseHistory(_x70, _x71) {
2435
+ function getPurchaseHistory(_x74, _x75) {
2429
2436
  return _ref44.apply(this, arguments);
2430
2437
  }
2431
2438
 
@@ -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 = { type: type, identifier: identifier, reCaptchaToken: reCaptchaToken };
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 (_x28, _x29, _x30, _x31) {
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 (_x32, _x33, _x34, _x35) {
395
+ return function (_x36, _x37, _x38, _x39) {
392
396
  return _ref21.apply(this, arguments);
393
397
  };
394
398
  }();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@como/como-client",
3
- "version": "0.7.94",
3
+ "version": "0.7.97",
4
4
  "description": "Client module for Como's loaylty API",
5
5
  "main": "src/como.js",
6
6
  "scripts": {
package/src/como.js CHANGED
@@ -177,6 +177,9 @@ class Como {
177
177
  this.comoData.expiresIn = credentials.expiresIn;
178
178
  if(credentials.config){
179
179
  this.comoData.reCaptchaSiteKey = credentials.config.recaptchaSiteKey;
180
+ if (credentials.config.recaptcha) {
181
+ this.comoData.recaptchaConfig = credentials.config.recaptcha;
182
+ }
180
183
  }
181
184
  }
182
185
 
@@ -345,11 +348,13 @@ class Como {
345
348
  * @param {Object} identifier an object which identifies the user by its credentials
346
349
  * @param {string} type login type i.e PhoneNumber/Email/etc
347
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
348
353
  */
349
- async login(identifier, type, reCaptchaToken) {
354
+ async login(identifier, type, reCaptchaToken, recaptchaTokenType, devicePlatform) {
350
355
  const { api } = this.comoData;
351
356
  try {
352
- const data = await api.logIn(type, identifier, reCaptchaToken);
357
+ const data = await api.logIn(type, identifier, reCaptchaToken, recaptchaTokenType, devicePlatform);
353
358
  return data;
354
359
  } catch (error) {
355
360
  if (error.response && error.response.data) {
@@ -366,11 +371,13 @@ class Como {
366
371
  * @param {*} type login type i.e PhoneNumber/Email/etc
367
372
  * @param {*} code a 2-factor verification code sent to the client
368
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
369
376
  */
370
- async loginVerify(identifier, type, code, reCaptchaToken) {
377
+ async loginVerify(identifier, type, code, reCaptchaToken, recaptchaTokenType, devicePlatform) {
371
378
  const { api } = this.comoData;
372
379
  try {
373
- const { consent } = await api.logInVerify(code, type, identifier, reCaptchaToken);
380
+ const { consent } = await api.logInVerify(code, type, identifier, reCaptchaToken, recaptchaTokenType, devicePlatform);
374
381
  this.comoData.consent = consent;
375
382
  } catch (error) {
376
383
  if (error.response && error.response.data) {
@@ -716,7 +723,7 @@ class Como {
716
723
  /**
717
724
  * Return service recaptch config
718
725
  */
719
- 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 } }
720
727
 
721
728
  /**
722
729
  * Returns the location specific registration web url