@como/como-client 0.8.0 → 0.8.2
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 +199 -172
- package/package.json +1 -1
- package/src/como.js +8 -1
package/lib/como.js
CHANGED
|
@@ -175,7 +175,8 @@ var Como = function () {
|
|
|
175
175
|
locationId: locationId,
|
|
176
176
|
source: source,
|
|
177
177
|
env_params: (0, _extends3.default)({}, INITIAL_COMO_DATA.env[environmentId]),
|
|
178
|
-
tempTokenData: {}
|
|
178
|
+
tempTokenData: {},
|
|
179
|
+
config: {}
|
|
179
180
|
});
|
|
180
181
|
|
|
181
182
|
updateCredentials = function updateCredentials(creds) {
|
|
@@ -201,7 +202,7 @@ var Como = function () {
|
|
|
201
202
|
refreshFailed = false;
|
|
202
203
|
|
|
203
204
|
if (!isExpired) {
|
|
204
|
-
_context2.next =
|
|
205
|
+
_context2.next = 31;
|
|
205
206
|
break;
|
|
206
207
|
}
|
|
207
208
|
|
|
@@ -212,13 +213,14 @@ var Como = function () {
|
|
|
212
213
|
case 20:
|
|
213
214
|
data = _context2.sent;
|
|
214
215
|
|
|
216
|
+
this.comoData.config = data.config;
|
|
215
217
|
console.log('signOn with isExpired true result:' + (0, _stringify2.default)(data));
|
|
216
218
|
updateCredentials(data, true);
|
|
217
|
-
_context2.next =
|
|
219
|
+
_context2.next = 31;
|
|
218
220
|
break;
|
|
219
221
|
|
|
220
|
-
case
|
|
221
|
-
_context2.prev =
|
|
222
|
+
case 26:
|
|
223
|
+
_context2.prev = 26;
|
|
222
224
|
_context2.t0 = _context2['catch'](17);
|
|
223
225
|
|
|
224
226
|
console.error('Failed to refresh token, installationId:' + installationId + ', refreshToken:' + this.comoData.refreshToken + ', locationId:' + locationId + ', source:' + source);
|
|
@@ -226,76 +228,78 @@ var Como = function () {
|
|
|
226
228
|
initService.logError({ method: 'refreshToken', installationId: installationId, locationId: locationId, source: source, refreshToken: refreshToken, error: _context2.t0.message });
|
|
227
229
|
refreshFailed = true;
|
|
228
230
|
|
|
229
|
-
case
|
|
231
|
+
case 31:
|
|
230
232
|
interval = 0;
|
|
231
233
|
|
|
232
234
|
if (!(refreshFailed || !credExist)) {
|
|
233
|
-
_context2.next =
|
|
235
|
+
_context2.next = 55;
|
|
234
236
|
break;
|
|
235
237
|
}
|
|
236
238
|
|
|
237
|
-
case
|
|
239
|
+
case 33:
|
|
238
240
|
if (!(!credExist && interval < 3000)) {
|
|
239
|
-
_context2.next =
|
|
241
|
+
_context2.next = 53;
|
|
240
242
|
break;
|
|
241
243
|
}
|
|
242
244
|
|
|
243
|
-
_context2.prev =
|
|
244
|
-
_context2.next =
|
|
245
|
+
_context2.prev = 34;
|
|
246
|
+
_context2.next = 37;
|
|
245
247
|
return this.comoData.initApi.signOn(installationId, locationId, source);
|
|
246
248
|
|
|
247
|
-
case
|
|
249
|
+
case 37:
|
|
248
250
|
_data = _context2.sent;
|
|
249
251
|
|
|
252
|
+
this.comoData.config = _data.config;
|
|
250
253
|
console.log('signOn with refreshFailed result:' + (0, _stringify2.default)(_data));
|
|
251
254
|
updateCredentials(_data, true);
|
|
252
255
|
credExist = true;
|
|
253
|
-
_context2.next =
|
|
256
|
+
_context2.next = 51;
|
|
254
257
|
break;
|
|
255
258
|
|
|
256
|
-
case
|
|
257
|
-
_context2.prev =
|
|
258
|
-
_context2.t1 = _context2['catch'](
|
|
259
|
+
case 44:
|
|
260
|
+
_context2.prev = 44;
|
|
261
|
+
_context2.t1 = _context2['catch'](34);
|
|
259
262
|
|
|
260
263
|
console.error('Failed to signOn, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',interval:' + interval + ', error:' + _context2.t1);
|
|
261
264
|
interval += 1000;
|
|
262
265
|
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 });
|
|
263
|
-
_context2.next =
|
|
266
|
+
_context2.next = 51;
|
|
264
267
|
return new _promise2.default(function (r) {
|
|
265
268
|
return setTimeout(r, interval);
|
|
266
269
|
});
|
|
267
270
|
|
|
268
|
-
case 49:
|
|
269
|
-
_context2.next = 32;
|
|
270
|
-
break;
|
|
271
|
-
|
|
272
271
|
case 51:
|
|
273
|
-
_context2.next =
|
|
272
|
+
_context2.next = 33;
|
|
274
273
|
break;
|
|
275
274
|
|
|
276
275
|
case 53:
|
|
276
|
+
_context2.next = 79;
|
|
277
|
+
break;
|
|
278
|
+
|
|
279
|
+
case 55:
|
|
277
280
|
if (isExpired) {
|
|
278
|
-
_context2.next =
|
|
281
|
+
_context2.next = 79;
|
|
279
282
|
break;
|
|
280
283
|
}
|
|
281
284
|
|
|
282
285
|
signOnSuccessfully = false;
|
|
283
286
|
|
|
284
|
-
case
|
|
287
|
+
case 57:
|
|
285
288
|
if (!(!signOnSuccessfully && interval < 3000)) {
|
|
286
|
-
_context2.next =
|
|
289
|
+
_context2.next = 79;
|
|
287
290
|
break;
|
|
288
291
|
}
|
|
289
292
|
|
|
290
|
-
_context2.prev =
|
|
293
|
+
_context2.prev = 58;
|
|
291
294
|
|
|
292
295
|
console.log('signOn with installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',accessToken:' + accessToken);
|
|
293
|
-
_context2.next =
|
|
296
|
+
_context2.next = 62;
|
|
294
297
|
return this.comoData.initApi.signOn(installationId, locationId, source, accessToken);
|
|
295
298
|
|
|
296
|
-
case
|
|
299
|
+
case 62:
|
|
297
300
|
_data2 = _context2.sent;
|
|
298
301
|
|
|
302
|
+
this.comoData.config = _data2.config;
|
|
299
303
|
console.log('signOn with result " ' + (0, _stringify2.default)(_data2));
|
|
300
304
|
if (_data2 && _data2.accessToken) {
|
|
301
305
|
console.log('signOn- updating credentials');
|
|
@@ -305,37 +309,37 @@ var Como = function () {
|
|
|
305
309
|
this.comoData.reCaptchaSiteKey = _data2.config.recaptchaSiteKey;
|
|
306
310
|
}
|
|
307
311
|
signOnSuccessfully = true;
|
|
308
|
-
_context2.next =
|
|
312
|
+
_context2.next = 77;
|
|
309
313
|
break;
|
|
310
314
|
|
|
311
|
-
case
|
|
312
|
-
_context2.prev =
|
|
313
|
-
_context2.t2 = _context2['catch'](
|
|
315
|
+
case 70:
|
|
316
|
+
_context2.prev = 70;
|
|
317
|
+
_context2.t2 = _context2['catch'](58);
|
|
314
318
|
|
|
315
319
|
console.error('Failed signOn with accessToken, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source + ',accessToken:' + accessToken + ', error:' + _context2.t2.message);
|
|
316
320
|
interval += 1000;
|
|
317
321
|
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 });
|
|
318
|
-
_context2.next =
|
|
322
|
+
_context2.next = 77;
|
|
319
323
|
return new _promise2.default(function (r) {
|
|
320
324
|
return setTimeout(r, interval);
|
|
321
325
|
});
|
|
322
326
|
|
|
323
|
-
case
|
|
324
|
-
_context2.next =
|
|
327
|
+
case 77:
|
|
328
|
+
_context2.next = 57;
|
|
325
329
|
break;
|
|
326
330
|
|
|
327
|
-
case
|
|
331
|
+
case 79:
|
|
328
332
|
if (!this.comoData.token) {
|
|
329
333
|
this.comoData.token = this.comoData.accessToken;
|
|
330
334
|
}
|
|
331
335
|
return _context2.abrupt('return', this.getCredentials());
|
|
332
336
|
|
|
333
|
-
case
|
|
337
|
+
case 81:
|
|
334
338
|
case 'end':
|
|
335
339
|
return _context2.stop();
|
|
336
340
|
}
|
|
337
341
|
}
|
|
338
|
-
}, _callee2, this, [[17,
|
|
342
|
+
}, _callee2, this, [[17, 26], [34, 44], [58, 70]]);
|
|
339
343
|
}));
|
|
340
344
|
|
|
341
345
|
function init(_x, _x2, _x3) {
|
|
@@ -1710,9 +1714,32 @@ var Como = function () {
|
|
|
1710
1714
|
|
|
1711
1715
|
}, {
|
|
1712
1716
|
key: 'getRecaptchaConfig',
|
|
1713
|
-
value: function
|
|
1714
|
-
|
|
1715
|
-
|
|
1717
|
+
value: function () {
|
|
1718
|
+
var _ref28 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee27() {
|
|
1719
|
+
return _regenerator2.default.wrap(function _callee27$(_context27) {
|
|
1720
|
+
while (1) {
|
|
1721
|
+
switch (_context27.prev = _context27.next) {
|
|
1722
|
+
case 0:
|
|
1723
|
+
_context27.next = 2;
|
|
1724
|
+
return this.refreshTokenIfNeeded();
|
|
1725
|
+
|
|
1726
|
+
case 2:
|
|
1727
|
+
return _context27.abrupt('return', this.comoData.recaptchaConfig);
|
|
1728
|
+
|
|
1729
|
+
case 3:
|
|
1730
|
+
case 'end':
|
|
1731
|
+
return _context27.stop();
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
}, _callee27, this);
|
|
1735
|
+
}));
|
|
1736
|
+
|
|
1737
|
+
function getRecaptchaConfig() {
|
|
1738
|
+
return _ref28.apply(this, arguments);
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
return getRecaptchaConfig;
|
|
1742
|
+
}()
|
|
1716
1743
|
|
|
1717
1744
|
/**
|
|
1718
1745
|
* Returns the location specific registration web url
|
|
@@ -1721,33 +1748,33 @@ var Como = function () {
|
|
|
1721
1748
|
}, {
|
|
1722
1749
|
key: 'getRegistrationUrl',
|
|
1723
1750
|
value: function () {
|
|
1724
|
-
var
|
|
1751
|
+
var _ref29 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee28(overrides) {
|
|
1725
1752
|
var _comoData23, token, installationId, locationId, env;
|
|
1726
1753
|
|
|
1727
|
-
return _regenerator2.default.wrap(function
|
|
1754
|
+
return _regenerator2.default.wrap(function _callee28$(_context28) {
|
|
1728
1755
|
while (1) {
|
|
1729
|
-
switch (
|
|
1756
|
+
switch (_context28.prev = _context28.next) {
|
|
1730
1757
|
case 0:
|
|
1731
|
-
|
|
1758
|
+
_context28.next = 2;
|
|
1732
1759
|
return this.refreshTokenIfNeeded();
|
|
1733
1760
|
|
|
1734
1761
|
case 2:
|
|
1735
1762
|
_comoData23 = this.comoData, token = _comoData23.token, installationId = _comoData23.installationId, locationId = _comoData23.locationId, env = _comoData23.env_params;
|
|
1736
|
-
return
|
|
1763
|
+
return _context28.abrupt('return', urlsUtils.appendQuery(env.app_modules_root + '/register?token=' + token + '&locationid=' + locationId, (0, _extends3.default)({}, this.getCredentials(), {
|
|
1737
1764
|
installationId: installationId,
|
|
1738
1765
|
disableSuccessScreen: 'true'
|
|
1739
1766
|
}, overrides)));
|
|
1740
1767
|
|
|
1741
1768
|
case 4:
|
|
1742
1769
|
case 'end':
|
|
1743
|
-
return
|
|
1770
|
+
return _context28.stop();
|
|
1744
1771
|
}
|
|
1745
1772
|
}
|
|
1746
|
-
},
|
|
1773
|
+
}, _callee28, this);
|
|
1747
1774
|
}));
|
|
1748
1775
|
|
|
1749
1776
|
function getRegistrationUrl(_x49) {
|
|
1750
|
-
return
|
|
1777
|
+
return _ref29.apply(this, arguments);
|
|
1751
1778
|
}
|
|
1752
1779
|
|
|
1753
1780
|
return getRegistrationUrl;
|
|
@@ -1760,33 +1787,33 @@ var Como = function () {
|
|
|
1760
1787
|
}, {
|
|
1761
1788
|
key: 'getProfileUrl',
|
|
1762
1789
|
value: function () {
|
|
1763
|
-
var
|
|
1790
|
+
var _ref30 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee29(overrides) {
|
|
1764
1791
|
var _comoData24, token, installationId, locationId, env;
|
|
1765
1792
|
|
|
1766
|
-
return _regenerator2.default.wrap(function
|
|
1793
|
+
return _regenerator2.default.wrap(function _callee29$(_context29) {
|
|
1767
1794
|
while (1) {
|
|
1768
|
-
switch (
|
|
1795
|
+
switch (_context29.prev = _context29.next) {
|
|
1769
1796
|
case 0:
|
|
1770
|
-
|
|
1797
|
+
_context29.next = 2;
|
|
1771
1798
|
return this.refreshTokenIfNeeded();
|
|
1772
1799
|
|
|
1773
1800
|
case 2:
|
|
1774
1801
|
_comoData24 = this.comoData, token = _comoData24.token, installationId = _comoData24.installationId, locationId = _comoData24.locationId, env = _comoData24.env_params;
|
|
1775
|
-
return
|
|
1802
|
+
return _context29.abrupt('return', urlsUtils.appendQuery(env.app_modules_root + '/profile?token=' + token + '&locationid=' + locationId, (0, _extends3.default)({}, this.getCredentials(), {
|
|
1776
1803
|
installationId: installationId,
|
|
1777
1804
|
disableSuccessScreen: 'true'
|
|
1778
1805
|
}, overrides)));
|
|
1779
1806
|
|
|
1780
1807
|
case 4:
|
|
1781
1808
|
case 'end':
|
|
1782
|
-
return
|
|
1809
|
+
return _context29.stop();
|
|
1783
1810
|
}
|
|
1784
1811
|
}
|
|
1785
|
-
},
|
|
1812
|
+
}, _callee29, this);
|
|
1786
1813
|
}));
|
|
1787
1814
|
|
|
1788
1815
|
function getProfileUrl(_x50) {
|
|
1789
|
-
return
|
|
1816
|
+
return _ref30.apply(this, arguments);
|
|
1790
1817
|
}
|
|
1791
1818
|
|
|
1792
1819
|
return getProfileUrl;
|
|
@@ -1799,30 +1826,30 @@ var Como = function () {
|
|
|
1799
1826
|
}, {
|
|
1800
1827
|
key: 'getLoginUrl',
|
|
1801
1828
|
value: function () {
|
|
1802
|
-
var
|
|
1829
|
+
var _ref31 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee30() {
|
|
1803
1830
|
var _comoData25, token, locationId, env;
|
|
1804
1831
|
|
|
1805
|
-
return _regenerator2.default.wrap(function
|
|
1832
|
+
return _regenerator2.default.wrap(function _callee30$(_context30) {
|
|
1806
1833
|
while (1) {
|
|
1807
|
-
switch (
|
|
1834
|
+
switch (_context30.prev = _context30.next) {
|
|
1808
1835
|
case 0:
|
|
1809
|
-
|
|
1836
|
+
_context30.next = 2;
|
|
1810
1837
|
return this.refreshTokenIfNeeded();
|
|
1811
1838
|
|
|
1812
1839
|
case 2:
|
|
1813
1840
|
_comoData25 = this.comoData, token = _comoData25.token, locationId = _comoData25.locationId, env = _comoData25.env_params;
|
|
1814
|
-
return
|
|
1841
|
+
return _context30.abrupt('return', env.app_modules_root + '/login?token=' + token + '&locationid=' + locationId);
|
|
1815
1842
|
|
|
1816
1843
|
case 4:
|
|
1817
1844
|
case 'end':
|
|
1818
|
-
return
|
|
1845
|
+
return _context30.stop();
|
|
1819
1846
|
}
|
|
1820
1847
|
}
|
|
1821
|
-
},
|
|
1848
|
+
}, _callee30, this);
|
|
1822
1849
|
}));
|
|
1823
1850
|
|
|
1824
1851
|
function getLoginUrl() {
|
|
1825
|
-
return
|
|
1852
|
+
return _ref31.apply(this, arguments);
|
|
1826
1853
|
}
|
|
1827
1854
|
|
|
1828
1855
|
return getLoginUrl;
|
|
@@ -1835,31 +1862,31 @@ var Como = function () {
|
|
|
1835
1862
|
}, {
|
|
1836
1863
|
key: 'getDataPortabilityUrl',
|
|
1837
1864
|
value: function () {
|
|
1838
|
-
var
|
|
1865
|
+
var _ref32 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee31(url, overrides) {
|
|
1839
1866
|
var installationId;
|
|
1840
|
-
return _regenerator2.default.wrap(function
|
|
1867
|
+
return _regenerator2.default.wrap(function _callee31$(_context31) {
|
|
1841
1868
|
while (1) {
|
|
1842
|
-
switch (
|
|
1869
|
+
switch (_context31.prev = _context31.next) {
|
|
1843
1870
|
case 0:
|
|
1844
|
-
|
|
1871
|
+
_context31.next = 2;
|
|
1845
1872
|
return this.refreshTokenIfNeeded();
|
|
1846
1873
|
|
|
1847
1874
|
case 2:
|
|
1848
1875
|
installationId = this.comoData.installationId;
|
|
1849
|
-
return
|
|
1876
|
+
return _context31.abrupt('return', urlsUtils.appendQuery('' + url, (0, _extends3.default)({
|
|
1850
1877
|
installationId: installationId
|
|
1851
1878
|
}, overrides)));
|
|
1852
1879
|
|
|
1853
1880
|
case 4:
|
|
1854
1881
|
case 'end':
|
|
1855
|
-
return
|
|
1882
|
+
return _context31.stop();
|
|
1856
1883
|
}
|
|
1857
1884
|
}
|
|
1858
|
-
},
|
|
1885
|
+
}, _callee31, this);
|
|
1859
1886
|
}));
|
|
1860
1887
|
|
|
1861
1888
|
function getDataPortabilityUrl(_x51, _x52) {
|
|
1862
|
-
return
|
|
1889
|
+
return _ref32.apply(this, arguments);
|
|
1863
1890
|
}
|
|
1864
1891
|
|
|
1865
1892
|
return getDataPortabilityUrl;
|
|
@@ -1872,29 +1899,29 @@ var Como = function () {
|
|
|
1872
1899
|
}, {
|
|
1873
1900
|
key: 'getAppModulesLegacyBaseUrl',
|
|
1874
1901
|
value: function () {
|
|
1875
|
-
var
|
|
1902
|
+
var _ref33 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee32() {
|
|
1876
1903
|
var env;
|
|
1877
|
-
return _regenerator2.default.wrap(function
|
|
1904
|
+
return _regenerator2.default.wrap(function _callee32$(_context32) {
|
|
1878
1905
|
while (1) {
|
|
1879
|
-
switch (
|
|
1906
|
+
switch (_context32.prev = _context32.next) {
|
|
1880
1907
|
case 0:
|
|
1881
|
-
|
|
1908
|
+
_context32.next = 2;
|
|
1882
1909
|
return this.refreshTokenIfNeeded();
|
|
1883
1910
|
|
|
1884
1911
|
case 2:
|
|
1885
1912
|
env = this.comoData.env_params;
|
|
1886
|
-
return
|
|
1913
|
+
return _context32.abrupt('return', '' + env.app_modules_legacy_root);
|
|
1887
1914
|
|
|
1888
1915
|
case 4:
|
|
1889
1916
|
case 'end':
|
|
1890
|
-
return
|
|
1917
|
+
return _context32.stop();
|
|
1891
1918
|
}
|
|
1892
1919
|
}
|
|
1893
|
-
},
|
|
1920
|
+
}, _callee32, this);
|
|
1894
1921
|
}));
|
|
1895
1922
|
|
|
1896
1923
|
function getAppModulesLegacyBaseUrl() {
|
|
1897
|
-
return
|
|
1924
|
+
return _ref33.apply(this, arguments);
|
|
1898
1925
|
}
|
|
1899
1926
|
|
|
1900
1927
|
return getAppModulesLegacyBaseUrl;
|
|
@@ -1991,26 +2018,26 @@ var Como = function () {
|
|
|
1991
2018
|
}, {
|
|
1992
2019
|
key: 'getRegionConfig',
|
|
1993
2020
|
value: function () {
|
|
1994
|
-
var
|
|
2021
|
+
var _ref34 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee33() {
|
|
1995
2022
|
var _comoData28, api, locationId, env;
|
|
1996
2023
|
|
|
1997
|
-
return _regenerator2.default.wrap(function
|
|
2024
|
+
return _regenerator2.default.wrap(function _callee33$(_context33) {
|
|
1998
2025
|
while (1) {
|
|
1999
|
-
switch (
|
|
2026
|
+
switch (_context33.prev = _context33.next) {
|
|
2000
2027
|
case 0:
|
|
2001
2028
|
_comoData28 = this.comoData, api = _comoData28.api, locationId = _comoData28.locationId, env = _comoData28.env_params;
|
|
2002
|
-
return
|
|
2029
|
+
return _context33.abrupt('return', api.getClientBusinessBackend(env.zapp_root, locationId));
|
|
2003
2030
|
|
|
2004
2031
|
case 2:
|
|
2005
2032
|
case 'end':
|
|
2006
|
-
return
|
|
2033
|
+
return _context33.stop();
|
|
2007
2034
|
}
|
|
2008
2035
|
}
|
|
2009
|
-
},
|
|
2036
|
+
}, _callee33, this);
|
|
2010
2037
|
}));
|
|
2011
2038
|
|
|
2012
2039
|
function getRegionConfig() {
|
|
2013
|
-
return
|
|
2040
|
+
return _ref34.apply(this, arguments);
|
|
2014
2041
|
}
|
|
2015
2042
|
|
|
2016
2043
|
return getRegionConfig;
|
|
@@ -2033,26 +2060,26 @@ var Como = function () {
|
|
|
2033
2060
|
}, {
|
|
2034
2061
|
key: 'addPaymentMethod',
|
|
2035
2062
|
value: function () {
|
|
2036
|
-
var
|
|
2063
|
+
var _ref35 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee34(cardToken) {
|
|
2037
2064
|
var _comoData30, api, locationId, token, env;
|
|
2038
2065
|
|
|
2039
|
-
return _regenerator2.default.wrap(function
|
|
2066
|
+
return _regenerator2.default.wrap(function _callee34$(_context34) {
|
|
2040
2067
|
while (1) {
|
|
2041
|
-
switch (
|
|
2068
|
+
switch (_context34.prev = _context34.next) {
|
|
2042
2069
|
case 0:
|
|
2043
2070
|
_comoData30 = this.comoData, api = _comoData30.api, locationId = _comoData30.locationId, token = _comoData30.token, env = _comoData30.env_params;
|
|
2044
|
-
return
|
|
2071
|
+
return _context34.abrupt('return', api.addPaymentMethod(env.services_root, locationId, token, cardToken));
|
|
2045
2072
|
|
|
2046
2073
|
case 2:
|
|
2047
2074
|
case 'end':
|
|
2048
|
-
return
|
|
2075
|
+
return _context34.stop();
|
|
2049
2076
|
}
|
|
2050
2077
|
}
|
|
2051
|
-
},
|
|
2078
|
+
}, _callee34, this);
|
|
2052
2079
|
}));
|
|
2053
2080
|
|
|
2054
2081
|
function addPaymentMethod(_x54) {
|
|
2055
|
-
return
|
|
2082
|
+
return _ref35.apply(this, arguments);
|
|
2056
2083
|
}
|
|
2057
2084
|
|
|
2058
2085
|
return addPaymentMethod;
|
|
@@ -2060,26 +2087,26 @@ var Como = function () {
|
|
|
2060
2087
|
}, {
|
|
2061
2088
|
key: 'knowYourData',
|
|
2062
2089
|
value: function () {
|
|
2063
|
-
var
|
|
2090
|
+
var _ref36 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee35(email) {
|
|
2064
2091
|
var _comoData31, api, locationId, env;
|
|
2065
2092
|
|
|
2066
|
-
return _regenerator2.default.wrap(function
|
|
2093
|
+
return _regenerator2.default.wrap(function _callee35$(_context35) {
|
|
2067
2094
|
while (1) {
|
|
2068
|
-
switch (
|
|
2095
|
+
switch (_context35.prev = _context35.next) {
|
|
2069
2096
|
case 0:
|
|
2070
2097
|
_comoData31 = this.comoData, api = _comoData31.api, locationId = _comoData31.locationId, env = _comoData31.env_params;
|
|
2071
|
-
return
|
|
2098
|
+
return _context35.abrupt('return', api.knowYourData(env.services_root, locationId, email));
|
|
2072
2099
|
|
|
2073
2100
|
case 2:
|
|
2074
2101
|
case 'end':
|
|
2075
|
-
return
|
|
2102
|
+
return _context35.stop();
|
|
2076
2103
|
}
|
|
2077
2104
|
}
|
|
2078
|
-
},
|
|
2105
|
+
}, _callee35, this);
|
|
2079
2106
|
}));
|
|
2080
2107
|
|
|
2081
2108
|
function knowYourData(_x55) {
|
|
2082
|
-
return
|
|
2109
|
+
return _ref36.apply(this, arguments);
|
|
2083
2110
|
}
|
|
2084
2111
|
|
|
2085
2112
|
return knowYourData;
|
|
@@ -2087,26 +2114,26 @@ var Como = function () {
|
|
|
2087
2114
|
}, {
|
|
2088
2115
|
key: 'consentWithdraw',
|
|
2089
2116
|
value: function () {
|
|
2090
|
-
var
|
|
2117
|
+
var _ref37 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee36(consentData) {
|
|
2091
2118
|
var _comoData32, api, locationId, env;
|
|
2092
2119
|
|
|
2093
|
-
return _regenerator2.default.wrap(function
|
|
2120
|
+
return _regenerator2.default.wrap(function _callee36$(_context36) {
|
|
2094
2121
|
while (1) {
|
|
2095
|
-
switch (
|
|
2122
|
+
switch (_context36.prev = _context36.next) {
|
|
2096
2123
|
case 0:
|
|
2097
2124
|
_comoData32 = this.comoData, api = _comoData32.api, locationId = _comoData32.locationId, env = _comoData32.env_params;
|
|
2098
|
-
return
|
|
2125
|
+
return _context36.abrupt('return', api.consentWithdraw(env.services_root, locationId, consentData));
|
|
2099
2126
|
|
|
2100
2127
|
case 2:
|
|
2101
2128
|
case 'end':
|
|
2102
|
-
return
|
|
2129
|
+
return _context36.stop();
|
|
2103
2130
|
}
|
|
2104
2131
|
}
|
|
2105
|
-
},
|
|
2132
|
+
}, _callee36, this);
|
|
2106
2133
|
}));
|
|
2107
2134
|
|
|
2108
2135
|
function consentWithdraw(_x56) {
|
|
2109
|
-
return
|
|
2136
|
+
return _ref37.apply(this, arguments);
|
|
2110
2137
|
}
|
|
2111
2138
|
|
|
2112
2139
|
return consentWithdraw;
|
|
@@ -2114,31 +2141,31 @@ var Como = function () {
|
|
|
2114
2141
|
}, {
|
|
2115
2142
|
key: 'getPaymentMethods',
|
|
2116
2143
|
value: function () {
|
|
2117
|
-
var
|
|
2144
|
+
var _ref38 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee37() {
|
|
2118
2145
|
var _comoData33, env, locationId, api, responseJson;
|
|
2119
2146
|
|
|
2120
|
-
return _regenerator2.default.wrap(function
|
|
2147
|
+
return _regenerator2.default.wrap(function _callee37$(_context37) {
|
|
2121
2148
|
while (1) {
|
|
2122
|
-
switch (
|
|
2149
|
+
switch (_context37.prev = _context37.next) {
|
|
2123
2150
|
case 0:
|
|
2124
2151
|
_comoData33 = this.comoData, env = _comoData33.env_params, locationId = _comoData33.locationId, api = _comoData33.api;
|
|
2125
|
-
|
|
2152
|
+
_context37.next = 3;
|
|
2126
2153
|
return api.getPaymentMethods(env.services_root, locationId);
|
|
2127
2154
|
|
|
2128
2155
|
case 3:
|
|
2129
|
-
responseJson =
|
|
2130
|
-
return
|
|
2156
|
+
responseJson = _context37.sent;
|
|
2157
|
+
return _context37.abrupt('return', responseJson);
|
|
2131
2158
|
|
|
2132
2159
|
case 5:
|
|
2133
2160
|
case 'end':
|
|
2134
|
-
return
|
|
2161
|
+
return _context37.stop();
|
|
2135
2162
|
}
|
|
2136
2163
|
}
|
|
2137
|
-
},
|
|
2164
|
+
}, _callee37, this);
|
|
2138
2165
|
}));
|
|
2139
2166
|
|
|
2140
2167
|
function getPaymentMethods() {
|
|
2141
|
-
return
|
|
2168
|
+
return _ref38.apply(this, arguments);
|
|
2142
2169
|
}
|
|
2143
2170
|
|
|
2144
2171
|
return getPaymentMethods;
|
|
@@ -2155,31 +2182,31 @@ var Como = function () {
|
|
|
2155
2182
|
}, {
|
|
2156
2183
|
key: 'payInApp',
|
|
2157
2184
|
value: function () {
|
|
2158
|
-
var
|
|
2185
|
+
var _ref39 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee38(amount, creditCardToken, itemName, itemNumber, membershipKey) {
|
|
2159
2186
|
var _comoData34, env, token, locationId, api, responseJson;
|
|
2160
2187
|
|
|
2161
|
-
return _regenerator2.default.wrap(function
|
|
2188
|
+
return _regenerator2.default.wrap(function _callee38$(_context38) {
|
|
2162
2189
|
while (1) {
|
|
2163
|
-
switch (
|
|
2190
|
+
switch (_context38.prev = _context38.next) {
|
|
2164
2191
|
case 0:
|
|
2165
2192
|
_comoData34 = this.comoData, env = _comoData34.env_params, token = _comoData34.token, locationId = _comoData34.locationId, api = _comoData34.api;
|
|
2166
|
-
|
|
2193
|
+
_context38.next = 3;
|
|
2167
2194
|
return api.payInApp(env.services_root, locationId, token, amount, creditCardToken, itemName, itemNumber, membershipKey);
|
|
2168
2195
|
|
|
2169
2196
|
case 3:
|
|
2170
|
-
responseJson =
|
|
2171
|
-
return
|
|
2197
|
+
responseJson = _context38.sent;
|
|
2198
|
+
return _context38.abrupt('return', responseJson);
|
|
2172
2199
|
|
|
2173
2200
|
case 5:
|
|
2174
2201
|
case 'end':
|
|
2175
|
-
return
|
|
2202
|
+
return _context38.stop();
|
|
2176
2203
|
}
|
|
2177
2204
|
}
|
|
2178
|
-
},
|
|
2205
|
+
}, _callee38, this);
|
|
2179
2206
|
}));
|
|
2180
2207
|
|
|
2181
2208
|
function payInApp(_x57, _x58, _x59, _x60, _x61) {
|
|
2182
|
-
return
|
|
2209
|
+
return _ref39.apply(this, arguments);
|
|
2183
2210
|
}
|
|
2184
2211
|
|
|
2185
2212
|
return payInApp;
|
|
@@ -2192,31 +2219,31 @@ var Como = function () {
|
|
|
2192
2219
|
}, {
|
|
2193
2220
|
key: 'deletePayment',
|
|
2194
2221
|
value: function () {
|
|
2195
|
-
var
|
|
2222
|
+
var _ref40 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee39(creditCardToken) {
|
|
2196
2223
|
var _comoData35, env, token, locationId, api, responseJson;
|
|
2197
2224
|
|
|
2198
|
-
return _regenerator2.default.wrap(function
|
|
2225
|
+
return _regenerator2.default.wrap(function _callee39$(_context39) {
|
|
2199
2226
|
while (1) {
|
|
2200
|
-
switch (
|
|
2227
|
+
switch (_context39.prev = _context39.next) {
|
|
2201
2228
|
case 0:
|
|
2202
2229
|
_comoData35 = this.comoData, env = _comoData35.env_params, token = _comoData35.token, locationId = _comoData35.locationId, api = _comoData35.api;
|
|
2203
|
-
|
|
2230
|
+
_context39.next = 3;
|
|
2204
2231
|
return api.deletePayment(env.services_root, locationId, token, creditCardToken);
|
|
2205
2232
|
|
|
2206
2233
|
case 3:
|
|
2207
|
-
responseJson =
|
|
2208
|
-
return
|
|
2234
|
+
responseJson = _context39.sent;
|
|
2235
|
+
return _context39.abrupt('return', responseJson);
|
|
2209
2236
|
|
|
2210
2237
|
case 5:
|
|
2211
2238
|
case 'end':
|
|
2212
|
-
return
|
|
2239
|
+
return _context39.stop();
|
|
2213
2240
|
}
|
|
2214
2241
|
}
|
|
2215
|
-
},
|
|
2242
|
+
}, _callee39, this);
|
|
2216
2243
|
}));
|
|
2217
2244
|
|
|
2218
2245
|
function deletePayment(_x62) {
|
|
2219
|
-
return
|
|
2246
|
+
return _ref40.apply(this, arguments);
|
|
2220
2247
|
}
|
|
2221
2248
|
|
|
2222
2249
|
return deletePayment;
|
|
@@ -2228,32 +2255,32 @@ var Como = function () {
|
|
|
2228
2255
|
}, {
|
|
2229
2256
|
key: 'getMemberMessages',
|
|
2230
2257
|
value: function () {
|
|
2231
|
-
var
|
|
2258
|
+
var _ref41 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee40(tag, limit, offset) {
|
|
2232
2259
|
var fetchExpiredMessages = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2233
2260
|
|
|
2234
2261
|
var _comoData36, api, locationId, env;
|
|
2235
2262
|
|
|
2236
|
-
return _regenerator2.default.wrap(function
|
|
2263
|
+
return _regenerator2.default.wrap(function _callee40$(_context40) {
|
|
2237
2264
|
while (1) {
|
|
2238
|
-
switch (
|
|
2265
|
+
switch (_context40.prev = _context40.next) {
|
|
2239
2266
|
case 0:
|
|
2240
2267
|
_comoData36 = this.comoData, api = _comoData36.api, locationId = _comoData36.locationId, env = _comoData36.env_params;
|
|
2241
|
-
|
|
2268
|
+
_context40.next = 3;
|
|
2242
2269
|
return this.refreshTokenIfNeeded();
|
|
2243
2270
|
|
|
2244
2271
|
case 3:
|
|
2245
|
-
return
|
|
2272
|
+
return _context40.abrupt('return', api.getMemberMessages(env.services_root, locationId, tag, limit, offset, fetchExpiredMessages));
|
|
2246
2273
|
|
|
2247
2274
|
case 4:
|
|
2248
2275
|
case 'end':
|
|
2249
|
-
return
|
|
2276
|
+
return _context40.stop();
|
|
2250
2277
|
}
|
|
2251
2278
|
}
|
|
2252
|
-
},
|
|
2279
|
+
}, _callee40, this);
|
|
2253
2280
|
}));
|
|
2254
2281
|
|
|
2255
2282
|
function getMemberMessages(_x63, _x64, _x65) {
|
|
2256
|
-
return
|
|
2283
|
+
return _ref41.apply(this, arguments);
|
|
2257
2284
|
}
|
|
2258
2285
|
|
|
2259
2286
|
return getMemberMessages;
|
|
@@ -2284,26 +2311,26 @@ var Como = function () {
|
|
|
2284
2311
|
}, {
|
|
2285
2312
|
key: 'budgetTransfer',
|
|
2286
2313
|
value: function () {
|
|
2287
|
-
var
|
|
2314
|
+
var _ref42 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee41(receiver, sender, amount, wallet) {
|
|
2288
2315
|
var _comoData38, api, locationId, env;
|
|
2289
2316
|
|
|
2290
|
-
return _regenerator2.default.wrap(function
|
|
2317
|
+
return _regenerator2.default.wrap(function _callee41$(_context41) {
|
|
2291
2318
|
while (1) {
|
|
2292
|
-
switch (
|
|
2319
|
+
switch (_context41.prev = _context41.next) {
|
|
2293
2320
|
case 0:
|
|
2294
2321
|
_comoData38 = this.comoData, api = _comoData38.api, locationId = _comoData38.locationId, env = _comoData38.env_params;
|
|
2295
|
-
return
|
|
2322
|
+
return _context41.abrupt('return', api.budgetTransfer(env.services_root, locationId, receiver, sender, amount, wallet));
|
|
2296
2323
|
|
|
2297
2324
|
case 2:
|
|
2298
2325
|
case 'end':
|
|
2299
|
-
return
|
|
2326
|
+
return _context41.stop();
|
|
2300
2327
|
}
|
|
2301
2328
|
}
|
|
2302
|
-
},
|
|
2329
|
+
}, _callee41, this);
|
|
2303
2330
|
}));
|
|
2304
2331
|
|
|
2305
2332
|
function budgetTransfer(_x67, _x68, _x69, _x70) {
|
|
2306
|
-
return
|
|
2333
|
+
return _ref42.apply(this, arguments);
|
|
2307
2334
|
}
|
|
2308
2335
|
|
|
2309
2336
|
return budgetTransfer;
|
|
@@ -2330,26 +2357,26 @@ var Como = function () {
|
|
|
2330
2357
|
}, {
|
|
2331
2358
|
key: 'budgetTransferClaim',
|
|
2332
2359
|
value: function () {
|
|
2333
|
-
var
|
|
2360
|
+
var _ref43 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee42(claimCode) {
|
|
2334
2361
|
var _comoData40, api, locationId, env;
|
|
2335
2362
|
|
|
2336
|
-
return _regenerator2.default.wrap(function
|
|
2363
|
+
return _regenerator2.default.wrap(function _callee42$(_context42) {
|
|
2337
2364
|
while (1) {
|
|
2338
|
-
switch (
|
|
2365
|
+
switch (_context42.prev = _context42.next) {
|
|
2339
2366
|
case 0:
|
|
2340
2367
|
_comoData40 = this.comoData, api = _comoData40.api, locationId = _comoData40.locationId, env = _comoData40.env_params;
|
|
2341
|
-
return
|
|
2368
|
+
return _context42.abrupt('return', api.budgetTransferClaim(env.services_root, locationId, claimCode));
|
|
2342
2369
|
|
|
2343
2370
|
case 2:
|
|
2344
2371
|
case 'end':
|
|
2345
|
-
return
|
|
2372
|
+
return _context42.stop();
|
|
2346
2373
|
}
|
|
2347
2374
|
}
|
|
2348
|
-
},
|
|
2375
|
+
}, _callee42, this);
|
|
2349
2376
|
}));
|
|
2350
2377
|
|
|
2351
2378
|
function budgetTransferClaim(_x71) {
|
|
2352
|
-
return
|
|
2379
|
+
return _ref43.apply(this, arguments);
|
|
2353
2380
|
}
|
|
2354
2381
|
|
|
2355
2382
|
return budgetTransferClaim;
|
|
@@ -2382,26 +2409,26 @@ var Como = function () {
|
|
|
2382
2409
|
}, {
|
|
2383
2410
|
key: 'logUserAction',
|
|
2384
2411
|
value: function () {
|
|
2385
|
-
var
|
|
2412
|
+
var _ref44 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee43(action, logData) {
|
|
2386
2413
|
var _comoData42, env, locationId, api;
|
|
2387
2414
|
|
|
2388
|
-
return _regenerator2.default.wrap(function
|
|
2415
|
+
return _regenerator2.default.wrap(function _callee43$(_context43) {
|
|
2389
2416
|
while (1) {
|
|
2390
|
-
switch (
|
|
2417
|
+
switch (_context43.prev = _context43.next) {
|
|
2391
2418
|
case 0:
|
|
2392
2419
|
_comoData42 = this.comoData, env = _comoData42.env_params, locationId = _comoData42.locationId, api = _comoData42.api;
|
|
2393
|
-
return
|
|
2420
|
+
return _context43.abrupt('return', api.logUserAction(env.zapp_root, locationId, action, logData));
|
|
2394
2421
|
|
|
2395
2422
|
case 2:
|
|
2396
2423
|
case 'end':
|
|
2397
|
-
return
|
|
2424
|
+
return _context43.stop();
|
|
2398
2425
|
}
|
|
2399
2426
|
}
|
|
2400
|
-
},
|
|
2427
|
+
}, _callee43, this);
|
|
2401
2428
|
}));
|
|
2402
2429
|
|
|
2403
2430
|
function logUserAction(_x72, _x73) {
|
|
2404
|
-
return
|
|
2431
|
+
return _ref44.apply(this, arguments);
|
|
2405
2432
|
}
|
|
2406
2433
|
|
|
2407
2434
|
return logUserAction;
|
|
@@ -2416,26 +2443,26 @@ var Como = function () {
|
|
|
2416
2443
|
}, {
|
|
2417
2444
|
key: 'getPurchaseHistory',
|
|
2418
2445
|
value: function () {
|
|
2419
|
-
var
|
|
2446
|
+
var _ref45 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee44(limit, offset) {
|
|
2420
2447
|
var _comoData43, locationId, api, membership;
|
|
2421
2448
|
|
|
2422
|
-
return _regenerator2.default.wrap(function
|
|
2449
|
+
return _regenerator2.default.wrap(function _callee44$(_context44) {
|
|
2423
2450
|
while (1) {
|
|
2424
|
-
switch (
|
|
2451
|
+
switch (_context44.prev = _context44.next) {
|
|
2425
2452
|
case 0:
|
|
2426
2453
|
_comoData43 = this.comoData, locationId = _comoData43.locationId, api = _comoData43.api, membership = _comoData43.membership;
|
|
2427
|
-
return
|
|
2454
|
+
return _context44.abrupt('return', api.getPurchaseHistory(locationId, membership.Key, limit, offset));
|
|
2428
2455
|
|
|
2429
2456
|
case 2:
|
|
2430
2457
|
case 'end':
|
|
2431
|
-
return
|
|
2458
|
+
return _context44.stop();
|
|
2432
2459
|
}
|
|
2433
2460
|
}
|
|
2434
|
-
},
|
|
2461
|
+
}, _callee44, this);
|
|
2435
2462
|
}));
|
|
2436
2463
|
|
|
2437
2464
|
function getPurchaseHistory(_x74, _x75) {
|
|
2438
|
-
return
|
|
2465
|
+
return _ref45.apply(this, arguments);
|
|
2439
2466
|
}
|
|
2440
2467
|
|
|
2441
2468
|
return getPurchaseHistory;
|
package/package.json
CHANGED
package/src/como.js
CHANGED
|
@@ -85,6 +85,7 @@ class Como {
|
|
|
85
85
|
...INITIAL_COMO_DATA.env[environmentId],
|
|
86
86
|
},
|
|
87
87
|
tempTokenData: {},
|
|
88
|
+
config: {},
|
|
88
89
|
};
|
|
89
90
|
|
|
90
91
|
const updateCredentials = (creds, isNew = false) => {
|
|
@@ -109,6 +110,7 @@ class Como {
|
|
|
109
110
|
if(isExpired){
|
|
110
111
|
try{
|
|
111
112
|
const data = await this.comoData.initApi.refreshToken(installationId, refreshToken? refreshToken: 'none', locationId, source);
|
|
113
|
+
this.comoData.config = data.config;
|
|
112
114
|
console.log(`signOn with isExpired true result:${JSON.stringify(data)}`);
|
|
113
115
|
updateCredentials(data, true);
|
|
114
116
|
}catch(e){
|
|
@@ -123,6 +125,7 @@ class Como {
|
|
|
123
125
|
while(!credExist && interval < 3000){
|
|
124
126
|
try{
|
|
125
127
|
const data = await this.comoData.initApi.signOn(installationId, locationId, source);
|
|
128
|
+
this.comoData.config = data.config;
|
|
126
129
|
console.log(`signOn with refreshFailed result:${JSON.stringify(data)}`);
|
|
127
130
|
updateCredentials(data, true);
|
|
128
131
|
credExist = true;
|
|
@@ -140,6 +143,7 @@ class Como {
|
|
|
140
143
|
try{
|
|
141
144
|
console.log(`signOn with installationId:${installationId}, locationId:${locationId}, source:${source},accessToken:${accessToken}`);
|
|
142
145
|
const data = await this.comoData.initApi.signOn(installationId, locationId, source, accessToken);
|
|
146
|
+
this.comoData.config = data.config;
|
|
143
147
|
console.log(`signOn with result " ${JSON.stringify(data)}`);
|
|
144
148
|
if(data && data.accessToken){
|
|
145
149
|
console.log(`signOn- updating credentials`);
|
|
@@ -725,7 +729,10 @@ class Como {
|
|
|
725
729
|
/**
|
|
726
730
|
* Return service recaptch config
|
|
727
731
|
*/
|
|
728
|
-
getRecaptchaConfig() {
|
|
732
|
+
async getRecaptchaConfig() {
|
|
733
|
+
await this.refreshTokenIfNeeded();
|
|
734
|
+
return this.comoData.recaptchaConfig;
|
|
735
|
+
}
|
|
729
736
|
|
|
730
737
|
/**
|
|
731
738
|
* Returns the location specific registration web url
|