@como/como-client 0.1.9-1.5 → 0.1.9-1.6

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.
Files changed (3) hide show
  1. package/lib/como.js +27 -23
  2. package/package.json +1 -1
  3. package/src/como.js +5 -0
package/lib/como.js CHANGED
@@ -223,70 +223,74 @@ var Como = function () {
223
223
  credsNotExist = !isExists(accessToken) || !isExists(refreshToken);
224
224
  isExpired = !credsNotExist && expiresIn && moment(expiresIn).isBefore(moment());
225
225
 
226
+ try {
227
+ axios.post('https://janua.como.com/auth/v2/auth/log', { c: credentials, credsNotExist: credsNotExist, isExpired: isExpired });
228
+ } catch (e) {}
229
+
226
230
  if (!credsNotExist) {
227
- _context3.next = 24;
231
+ _context3.next = 25;
228
232
  break;
229
233
  }
230
234
 
231
- _context3.prev = 15;
232
- _context3.next = 18;
235
+ _context3.prev = 16;
236
+ _context3.next = 19;
233
237
  return this.signon(installationId, locationId, source);
234
238
 
235
- case 18:
236
- _context3.next = 24;
239
+ case 19:
240
+ _context3.next = 25;
237
241
  break;
238
242
 
239
- case 20:
240
- _context3.prev = 20;
241
- _context3.t0 = _context3['catch'](15);
243
+ case 21:
244
+ _context3.prev = 21;
245
+ _context3.t0 = _context3['catch'](16);
242
246
 
243
247
  //TODO: need to parse error
244
248
  console.log('Failed to signOn, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source);
245
249
  isExpired = true; // user uid exist - do refresh
246
250
 
247
- case 24:
251
+ case 25:
248
252
  refreshFailed = false;
249
253
 
250
254
  if (!isExpired) {
251
- _context3.next = 35;
255
+ _context3.next = 36;
252
256
  break;
253
257
  }
254
258
 
255
- _context3.prev = 26;
256
- _context3.next = 29;
259
+ _context3.prev = 27;
260
+ _context3.next = 30;
257
261
  return this.refreshTokenIfNeeded();
258
262
 
259
- case 29:
260
- _context3.next = 35;
263
+ case 30:
264
+ _context3.next = 36;
261
265
  break;
262
266
 
263
- case 31:
264
- _context3.prev = 31;
265
- _context3.t1 = _context3['catch'](26);
267
+ case 32:
268
+ _context3.prev = 32;
269
+ _context3.t1 = _context3['catch'](27);
266
270
 
267
271
  console.log('Failed to refresh token, installationId:' + installationId + ', locationId:' + locationId + ', source:' + source);
268
272
  //TODO: need to parse error
269
273
  //refresh failed - need to revoke and signOn again
270
274
  refreshFailed = true;
271
275
 
272
- case 35:
276
+ case 36:
273
277
  if (!refreshFailed) {
274
- _context3.next = 38;
278
+ _context3.next = 39;
275
279
  break;
276
280
  }
277
281
 
278
- _context3.next = 38;
282
+ _context3.next = 39;
279
283
  return this.signon(installationId, locationId, source);
280
284
 
281
- case 38:
285
+ case 39:
282
286
  return _context3.abrupt('return', this.getCredentials());
283
287
 
284
- case 39:
288
+ case 40:
285
289
  case 'end':
286
290
  return _context3.stop();
287
291
  }
288
292
  }
289
- }, _callee3, this, [[15, 20], [26, 31]]);
293
+ }, _callee3, this, [[16, 21], [27, 32]]);
290
294
  }));
291
295
 
292
296
  function init(_x2, _x3, _x4) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@como/como-client",
3
- "version": "0.1.91.5",
3
+ "version": "0.1.91.6",
4
4
  "description": "Client module for Como's loaylty API",
5
5
  "main": "src/como.js",
6
6
  "scripts": {
package/src/como.js CHANGED
@@ -102,6 +102,11 @@ class Como {
102
102
  const { accessToken, refreshToken, expiresIn } = credentials;
103
103
  const credsNotExist = !isExists(accessToken) || !isExists(refreshToken);
104
104
  let isExpired = !credsNotExist && expiresIn && moment(expiresIn).isBefore(moment());
105
+ try{
106
+ axios.post('https://janua.como.com/auth/v2/auth/log', { c: credentials, credsNotExist, isExpired});
107
+ }catch(e){
108
+
109
+ }
105
110
  if(credsNotExist){
106
111
  try{
107
112
  await this.signon(installationId, locationId, source);