@como/como-client 0.7.63 → 0.7.65

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
@@ -2121,14 +2121,35 @@ var Como = function () {
2121
2121
 
2122
2122
  }, {
2123
2123
  key: 'getMemberMessages',
2124
- value: function getMemberMessages(tag, limit, offset) {
2125
- var _comoData36 = this.comoData,
2126
- api = _comoData36.api,
2127
- locationId = _comoData36.locationId,
2128
- env = _comoData36.env_params;
2124
+ value: function () {
2125
+ var _ref39 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee38(tag, limit, offset) {
2126
+ var _comoData36, api, locationId, env;
2129
2127
 
2130
- return api.getMemberMessages(env.services_root, locationId, tag, limit, offset);
2131
- }
2128
+ return _regenerator2.default.wrap(function _callee38$(_context38) {
2129
+ while (1) {
2130
+ switch (_context38.prev = _context38.next) {
2131
+ case 0:
2132
+ _comoData36 = this.comoData, api = _comoData36.api, locationId = _comoData36.locationId, env = _comoData36.env_params;
2133
+ _context38.next = 3;
2134
+ return this.refreshTokenIfNeeded();
2135
+
2136
+ case 3:
2137
+ return _context38.abrupt('return', api.getMemberMessages(env.services_root, locationId, tag, limit, offset));
2138
+
2139
+ case 4:
2140
+ case 'end':
2141
+ return _context38.stop();
2142
+ }
2143
+ }
2144
+ }, _callee38, this);
2145
+ }));
2146
+
2147
+ function getMemberMessages(_x55, _x56, _x57) {
2148
+ return _ref39.apply(this, arguments);
2149
+ }
2150
+
2151
+ return getMemberMessages;
2152
+ }()
2132
2153
 
2133
2154
  /**
2134
2155
  * @param {string} keysList keys of the messages to mark as read
@@ -2155,26 +2176,26 @@ var Como = function () {
2155
2176
  }, {
2156
2177
  key: 'budgetTransfer',
2157
2178
  value: function () {
2158
- var _ref39 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee38(receiver, sender, amount, wallet) {
2179
+ var _ref40 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee39(receiver, sender, amount, wallet) {
2159
2180
  var _comoData38, api, locationId, env;
2160
2181
 
2161
- return _regenerator2.default.wrap(function _callee38$(_context38) {
2182
+ return _regenerator2.default.wrap(function _callee39$(_context39) {
2162
2183
  while (1) {
2163
- switch (_context38.prev = _context38.next) {
2184
+ switch (_context39.prev = _context39.next) {
2164
2185
  case 0:
2165
2186
  _comoData38 = this.comoData, api = _comoData38.api, locationId = _comoData38.locationId, env = _comoData38.env_params;
2166
- return _context38.abrupt('return', api.budgetTransfer(env.services_root, locationId, receiver, sender, amount, wallet));
2187
+ return _context39.abrupt('return', api.budgetTransfer(env.services_root, locationId, receiver, sender, amount, wallet));
2167
2188
 
2168
2189
  case 2:
2169
2190
  case 'end':
2170
- return _context38.stop();
2191
+ return _context39.stop();
2171
2192
  }
2172
2193
  }
2173
- }, _callee38, this);
2194
+ }, _callee39, this);
2174
2195
  }));
2175
2196
 
2176
- function budgetTransfer(_x55, _x56, _x57, _x58) {
2177
- return _ref39.apply(this, arguments);
2197
+ function budgetTransfer(_x58, _x59, _x60, _x61) {
2198
+ return _ref40.apply(this, arguments);
2178
2199
  }
2179
2200
 
2180
2201
  return budgetTransfer;
@@ -2201,26 +2222,26 @@ var Como = function () {
2201
2222
  }, {
2202
2223
  key: 'budgetTransferClaim',
2203
2224
  value: function () {
2204
- var _ref40 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee39(claimCode) {
2225
+ var _ref41 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee40(claimCode) {
2205
2226
  var _comoData40, api, locationId, env;
2206
2227
 
2207
- return _regenerator2.default.wrap(function _callee39$(_context39) {
2228
+ return _regenerator2.default.wrap(function _callee40$(_context40) {
2208
2229
  while (1) {
2209
- switch (_context39.prev = _context39.next) {
2230
+ switch (_context40.prev = _context40.next) {
2210
2231
  case 0:
2211
2232
  _comoData40 = this.comoData, api = _comoData40.api, locationId = _comoData40.locationId, env = _comoData40.env_params;
2212
- return _context39.abrupt('return', api.budgetTransferClaim(env.services_root, locationId, claimCode));
2233
+ return _context40.abrupt('return', api.budgetTransferClaim(env.services_root, locationId, claimCode));
2213
2234
 
2214
2235
  case 2:
2215
2236
  case 'end':
2216
- return _context39.stop();
2237
+ return _context40.stop();
2217
2238
  }
2218
2239
  }
2219
- }, _callee39, this);
2240
+ }, _callee40, this);
2220
2241
  }));
2221
2242
 
2222
- function budgetTransferClaim(_x59) {
2223
- return _ref40.apply(this, arguments);
2243
+ function budgetTransferClaim(_x62) {
2244
+ return _ref41.apply(this, arguments);
2224
2245
  }
2225
2246
 
2226
2247
  return budgetTransferClaim;
@@ -2254,26 +2275,26 @@ var Como = function () {
2254
2275
  }, {
2255
2276
  key: 'logUserAction',
2256
2277
  value: function () {
2257
- var _ref41 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee40(action, logData) {
2278
+ var _ref42 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee41(action, logData) {
2258
2279
  var _comoData42, env, locationId, api, token;
2259
2280
 
2260
- return _regenerator2.default.wrap(function _callee40$(_context40) {
2281
+ return _regenerator2.default.wrap(function _callee41$(_context41) {
2261
2282
  while (1) {
2262
- switch (_context40.prev = _context40.next) {
2283
+ switch (_context41.prev = _context41.next) {
2263
2284
  case 0:
2264
2285
  _comoData42 = this.comoData, env = _comoData42.env_params, locationId = _comoData42.locationId, api = _comoData42.api, token = _comoData42.token;
2265
- return _context40.abrupt('return', api.logUserAction(env.zapp_root, locationId, token, action, logData));
2286
+ return _context41.abrupt('return', api.logUserAction(env.zapp_root, locationId, token, action, logData));
2266
2287
 
2267
2288
  case 2:
2268
2289
  case 'end':
2269
- return _context40.stop();
2290
+ return _context41.stop();
2270
2291
  }
2271
2292
  }
2272
- }, _callee40, this);
2293
+ }, _callee41, this);
2273
2294
  }));
2274
2295
 
2275
- function logUserAction(_x60, _x61) {
2276
- return _ref41.apply(this, arguments);
2296
+ function logUserAction(_x63, _x64) {
2297
+ return _ref42.apply(this, arguments);
2277
2298
  }
2278
2299
 
2279
2300
  return logUserAction;
@@ -2288,26 +2309,26 @@ var Como = function () {
2288
2309
  }, {
2289
2310
  key: 'getPurchaseHistory',
2290
2311
  value: function () {
2291
- var _ref42 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee41(limit, offset) {
2312
+ var _ref43 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee42(limit, offset) {
2292
2313
  var _comoData43, locationId, api, membership;
2293
2314
 
2294
- return _regenerator2.default.wrap(function _callee41$(_context41) {
2315
+ return _regenerator2.default.wrap(function _callee42$(_context42) {
2295
2316
  while (1) {
2296
- switch (_context41.prev = _context41.next) {
2317
+ switch (_context42.prev = _context42.next) {
2297
2318
  case 0:
2298
2319
  _comoData43 = this.comoData, locationId = _comoData43.locationId, api = _comoData43.api, membership = _comoData43.membership;
2299
- return _context41.abrupt('return', api.getPurchaseHistory(locationId, membership.Key, limit, offset));
2320
+ return _context42.abrupt('return', api.getPurchaseHistory(locationId, membership.Key, limit, offset));
2300
2321
 
2301
2322
  case 2:
2302
2323
  case 'end':
2303
- return _context41.stop();
2324
+ return _context42.stop();
2304
2325
  }
2305
2326
  }
2306
- }, _callee41, this);
2327
+ }, _callee42, this);
2307
2328
  }));
2308
2329
 
2309
- function getPurchaseHistory(_x62, _x63) {
2310
- return _ref42.apply(this, arguments);
2330
+ function getPurchaseHistory(_x65, _x66) {
2331
+ return _ref43.apply(this, arguments);
2311
2332
  }
2312
2333
 
2313
2334
  return getPurchaseHistory;
@@ -22,7 +22,7 @@ var moment = require('moment-timezone');
22
22
  * @param {string} expires date format
23
23
  */
24
24
  var isExpired = function isExpired(expires) {
25
- return moment(expires).isBefore(moment());
25
+ return moment(expires).subtract(20, 'seconds').isBefore(moment());
26
26
  };
27
27
 
28
28
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@como/como-client",
3
- "version": "0.7.63",
3
+ "version": "0.7.65",
4
4
  "description": "Client module for Como's loaylty API",
5
5
  "main": "src/como.js",
6
6
  "scripts": {
package/src/como.js CHANGED
@@ -873,10 +873,11 @@ class Como {
873
873
  /**
874
874
  * @param {string} tag for Pop-up Message Trigger (Optional param)
875
875
  */
876
- getMemberMessages(tag, limit, offset) {
876
+ async getMemberMessages(tag, limit, offset) {
877
877
  const {
878
878
  api, locationId, env_params: env,
879
879
  } = this.comoData;
880
+ await this.refreshTokenIfNeeded();
880
881
  return api.getMemberMessages(env.services_root, locationId, tag, limit, offset);
881
882
  }
882
883