@como/como-client 0.7.65 → 0.7.67

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
@@ -50,6 +50,7 @@ var INITIAL_COMO_DATA = {
50
50
  installationId: null,
51
51
  membership: null,
52
52
  assets: null,
53
+ reCaptchaSiteKey: null,
53
54
  mainResources: {}
54
55
  };
55
56
 
@@ -357,6 +358,7 @@ var Como = function () {
357
358
  this.comoData.token = credentials.accessToken;
358
359
  this.comoData.refreshToken = credentials.refreshToken;
359
360
  this.comoData.expiresIn = credentials.expiresIn;
361
+ this.comoData.reCaptchaSiteKey = credentials.reCaptchaSiteKey;
360
362
  }
361
363
  }, {
362
364
  key: 'getExternalUrlByID',
@@ -729,12 +731,13 @@ var Como = function () {
729
731
  *
730
732
  * @param {Object} identifier an object which identifies the user by its credentials
731
733
  * @param {string} type login type i.e PhoneNumber/Email/etc
734
+ * @param {reCaptchaToken} reCaptcha token for login chalenge
732
735
  */
733
736
 
734
737
  }, {
735
738
  key: 'login',
736
739
  value: function () {
737
- var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(identifier, type) {
740
+ var _ref10 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee10(identifier, type, reCaptchaToken) {
738
741
  var api, data, _error$response$data6, code, message;
739
742
 
740
743
  return _regenerator2.default.wrap(function _callee10$(_context10) {
@@ -744,7 +747,7 @@ var Como = function () {
744
747
  api = this.comoData.api;
745
748
  _context10.prev = 1;
746
749
  _context10.next = 4;
747
- return api.logIn(type, identifier);
750
+ return api.logIn(type, identifier, reCaptchaToken);
748
751
 
749
752
  case 4:
750
753
  data = _context10.sent;
@@ -773,7 +776,7 @@ var Como = function () {
773
776
  }, _callee10, this, [[1, 8]]);
774
777
  }));
775
778
 
776
- function login(_x28, _x29) {
779
+ function login(_x28, _x29, _x30) {
777
780
  return _ref10.apply(this, arguments);
778
781
  }
779
782
 
@@ -845,7 +848,7 @@ var Como = function () {
845
848
  }, _callee11, this, [[1, 9]]);
846
849
  }));
847
850
 
848
- function loginVerify(_x30, _x31, _x32) {
851
+ function loginVerify(_x31, _x32, _x33) {
849
852
  return _ref11.apply(this, arguments);
850
853
  }
851
854
 
@@ -920,7 +923,7 @@ var Como = function () {
920
923
  }, _callee13, this);
921
924
  }));
922
925
 
923
- function openApp(_x34) {
926
+ function openApp(_x35) {
924
927
  return _ref14.apply(this, arguments);
925
928
  }
926
929
 
@@ -961,7 +964,7 @@ var Como = function () {
961
964
  }, _callee14, this, [[1, 5]]);
962
965
  }));
963
966
 
964
- function clientUpdateMembership(_x35, _x36) {
967
+ function clientUpdateMembership(_x36, _x37) {
965
968
  return _ref15.apply(this, arguments);
966
969
  }
967
970
 
@@ -1012,7 +1015,7 @@ var Como = function () {
1012
1015
  }, _callee15, this);
1013
1016
  }));
1014
1017
 
1015
- function downloadMainResource(_x37) {
1018
+ function downloadMainResource(_x38) {
1016
1019
  return _ref16.apply(this, arguments);
1017
1020
  }
1018
1021
 
@@ -1230,7 +1233,7 @@ var Como = function () {
1230
1233
  }, _callee20, this);
1231
1234
  }));
1232
1235
 
1233
- function redeemAsset(_x38) {
1236
+ function redeemAsset(_x39) {
1234
1237
  return _ref21.apply(this, arguments);
1235
1238
  }
1236
1239
 
@@ -1268,7 +1271,7 @@ var Como = function () {
1268
1271
  }, _callee21, this);
1269
1272
  }));
1270
1273
 
1271
- function purchaseAsset(_x39) {
1274
+ function purchaseAsset(_x40) {
1272
1275
  return _ref22.apply(this, arguments);
1273
1276
  }
1274
1277
 
@@ -1332,7 +1335,7 @@ var Como = function () {
1332
1335
  }, _callee23, this);
1333
1336
  }));
1334
1337
 
1335
- function purchaseAssetAPI2(_x40) {
1338
+ function purchaseAssetAPI2(_x41) {
1336
1339
  return _ref24.apply(this, arguments);
1337
1340
  }
1338
1341
 
@@ -1614,6 +1617,16 @@ var Como = function () {
1614
1617
  return this.comoData.assets;
1615
1618
  }
1616
1619
 
1620
+ /**
1621
+ * Return service recaptch site key
1622
+ */
1623
+
1624
+ }, {
1625
+ key: 'getRecaptchaSiteKey',
1626
+ value: function getRecaptchaSiteKey() {
1627
+ return this.comoData.reCaptchaSiteKey;
1628
+ }
1629
+
1617
1630
  /**
1618
1631
  * Returns the location specific registration web url
1619
1632
  */
@@ -1646,7 +1659,7 @@ var Como = function () {
1646
1659
  }, _callee26, this);
1647
1660
  }));
1648
1661
 
1649
- function getRegistrationUrl(_x41) {
1662
+ function getRegistrationUrl(_x42) {
1650
1663
  return _ref27.apply(this, arguments);
1651
1664
  }
1652
1665
 
@@ -1685,7 +1698,7 @@ var Como = function () {
1685
1698
  }, _callee27, this);
1686
1699
  }));
1687
1700
 
1688
- function getProfileUrl(_x42) {
1701
+ function getProfileUrl(_x43) {
1689
1702
  return _ref28.apply(this, arguments);
1690
1703
  }
1691
1704
 
@@ -1758,7 +1771,7 @@ var Como = function () {
1758
1771
  }, _callee29, this);
1759
1772
  }));
1760
1773
 
1761
- function getDataPortabilityUrl(_x43, _x44) {
1774
+ function getDataPortabilityUrl(_x44, _x45) {
1762
1775
  return _ref30.apply(this, arguments);
1763
1776
  }
1764
1777
 
@@ -1945,7 +1958,7 @@ var Como = function () {
1945
1958
  }, _callee32, this);
1946
1959
  }));
1947
1960
 
1948
- function addPaymentMethod(_x46) {
1961
+ function addPaymentMethod(_x47) {
1949
1962
  return _ref33.apply(this, arguments);
1950
1963
  }
1951
1964
 
@@ -1972,7 +1985,7 @@ var Como = function () {
1972
1985
  }, _callee33, this);
1973
1986
  }));
1974
1987
 
1975
- function knowYourData(_x47) {
1988
+ function knowYourData(_x48) {
1976
1989
  return _ref34.apply(this, arguments);
1977
1990
  }
1978
1991
 
@@ -1999,7 +2012,7 @@ var Como = function () {
1999
2012
  }, _callee34, this);
2000
2013
  }));
2001
2014
 
2002
- function consentWithdraw(_x48) {
2015
+ function consentWithdraw(_x49) {
2003
2016
  return _ref35.apply(this, arguments);
2004
2017
  }
2005
2018
 
@@ -2072,7 +2085,7 @@ var Como = function () {
2072
2085
  }, _callee36, this);
2073
2086
  }));
2074
2087
 
2075
- function payInApp(_x49, _x50, _x51, _x52, _x53) {
2088
+ function payInApp(_x50, _x51, _x52, _x53, _x54) {
2076
2089
  return _ref37.apply(this, arguments);
2077
2090
  }
2078
2091
 
@@ -2109,7 +2122,7 @@ var Como = function () {
2109
2122
  }, _callee37, this);
2110
2123
  }));
2111
2124
 
2112
- function deletePayment(_x54) {
2125
+ function deletePayment(_x55) {
2113
2126
  return _ref38.apply(this, arguments);
2114
2127
  }
2115
2128
 
@@ -2144,7 +2157,7 @@ var Como = function () {
2144
2157
  }, _callee38, this);
2145
2158
  }));
2146
2159
 
2147
- function getMemberMessages(_x55, _x56, _x57) {
2160
+ function getMemberMessages(_x56, _x57, _x58) {
2148
2161
  return _ref39.apply(this, arguments);
2149
2162
  }
2150
2163
 
@@ -2194,7 +2207,7 @@ var Como = function () {
2194
2207
  }, _callee39, this);
2195
2208
  }));
2196
2209
 
2197
- function budgetTransfer(_x58, _x59, _x60, _x61) {
2210
+ function budgetTransfer(_x59, _x60, _x61, _x62) {
2198
2211
  return _ref40.apply(this, arguments);
2199
2212
  }
2200
2213
 
@@ -2240,7 +2253,7 @@ var Como = function () {
2240
2253
  }, _callee40, this);
2241
2254
  }));
2242
2255
 
2243
- function budgetTransferClaim(_x62) {
2256
+ function budgetTransferClaim(_x63) {
2244
2257
  return _ref41.apply(this, arguments);
2245
2258
  }
2246
2259
 
@@ -2293,7 +2306,7 @@ var Como = function () {
2293
2306
  }, _callee41, this);
2294
2307
  }));
2295
2308
 
2296
- function logUserAction(_x63, _x64) {
2309
+ function logUserAction(_x64, _x65) {
2297
2310
  return _ref42.apply(this, arguments);
2298
2311
  }
2299
2312
 
@@ -2327,7 +2340,7 @@ var Como = function () {
2327
2340
  }, _callee42, this);
2328
2341
  }));
2329
2342
 
2330
- function getPurchaseHistory(_x65, _x66) {
2343
+ function getPurchaseHistory(_x66, _x67) {
2331
2344
  return _ref43.apply(this, arguments);
2332
2345
  }
2333
2346
 
@@ -228,14 +228,14 @@ exports.unsubscribeSms = function (service) {
228
228
 
229
229
  exports.logIn = function (service) {
230
230
  return function () {
231
- var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(type, identifier) {
231
+ var _ref13 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee7(type, identifier, reCaptchaToken) {
232
232
  var params, headers, _ref14, data;
233
233
 
234
234
  return _regenerator2.default.wrap(function _callee7$(_context7) {
235
235
  while (1) {
236
236
  switch (_context7.prev = _context7.next) {
237
237
  case 0:
238
- params = { type: type, identifier: identifier };
238
+ params = { type: type, identifier: identifier, reCaptchaToken: reCaptchaToken };
239
239
  headers = getHashHeader(params);
240
240
  _context7.next = 4;
241
241
  return service.post('/auth/v2/auth/logIn', params, { headers: headers });
@@ -253,7 +253,7 @@ exports.logIn = function (service) {
253
253
  }, _callee7, undefined);
254
254
  }));
255
255
 
256
- return function (_x23, _x24) {
256
+ return function (_x23, _x24, _x25) {
257
257
  return _ref13.apply(this, arguments);
258
258
  };
259
259
  }();
@@ -290,7 +290,7 @@ exports.logInVerify = function (service) {
290
290
  }, _callee8, undefined);
291
291
  }));
292
292
 
293
- return function (_x25, _x26, _x27) {
293
+ return function (_x26, _x27, _x28) {
294
294
  return _ref15.apply(this, arguments);
295
295
  };
296
296
  }();
@@ -348,7 +348,7 @@ exports.refreshToken = function (service) {
348
348
  }, _callee10, undefined);
349
349
  }));
350
350
 
351
- return function (_x28, _x29, _x30, _x31) {
351
+ return function (_x29, _x30, _x31, _x32) {
352
352
  return _ref19.apply(this, arguments);
353
353
  };
354
354
  }();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@como/como-client",
3
- "version": "0.7.65",
3
+ "version": "0.7.67",
4
4
  "description": "Client module for Como's loaylty API",
5
5
  "main": "src/como.js",
6
6
  "scripts": {
package/src/como.js CHANGED
@@ -14,6 +14,7 @@ const INITIAL_COMO_DATA = {
14
14
  installationId: null,
15
15
  membership: null,
16
16
  assets: null,
17
+ reCaptchaSiteKey: null,
17
18
  mainResources: {},
18
19
  };
19
20
 
@@ -170,6 +171,7 @@ class Como {
170
171
  this.comoData.token = credentials.accessToken;
171
172
  this.comoData.refreshToken = credentials.refreshToken;
172
173
  this.comoData.expiresIn = credentials.expiresIn;
174
+ this.comoData.reCaptchaSiteKey = credentials.reCaptchaSiteKey;
173
175
  }
174
176
 
175
177
  getExternalUrlByID(itemID, gpsData, assetID, accessibilityData) {
@@ -314,11 +316,12 @@ class Como {
314
316
  *
315
317
  * @param {Object} identifier an object which identifies the user by its credentials
316
318
  * @param {string} type login type i.e PhoneNumber/Email/etc
319
+ * @param {reCaptchaToken} reCaptcha token for login chalenge
317
320
  */
318
- async login(identifier, type) {
321
+ async login(identifier, type, reCaptchaToken) {
319
322
  const { api } = this.comoData;
320
323
  try {
321
- const data = await api.logIn(type, identifier);
324
+ const data = await api.logIn(type, identifier, reCaptchaToken);
322
325
  return data;
323
326
  } catch (error) {
324
327
  if (error.response && error.response.data) {
@@ -675,6 +678,11 @@ class Como {
675
678
  */
676
679
  getAssets() { return this.comoData.assets; }
677
680
 
681
+ /**
682
+ * Return service recaptch site key
683
+ */
684
+ getRecaptchaSiteKey() { return this.comoData.reCaptchaSiteKey; }
685
+
678
686
  /**
679
687
  * Returns the location specific registration web url
680
688
  */