@como/como-client 0.8.5 → 0.8.7

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 +36 -0
  2. package/package.json +4 -4
  3. package/src/como.js +10 -0
package/lib/como.js CHANGED
@@ -2483,6 +2483,42 @@ var Como = function () {
2483
2483
 
2484
2484
  return api.getAllTranslations(locationId);
2485
2485
  }
2486
+
2487
+ /**
2488
+ * Generate a temporary token for the location
2489
+ * @param {number} timeToLive time to live in seconds
2490
+ * @returns {string} temporary token
2491
+ */
2492
+
2493
+ }, {
2494
+ key: 'generateTemporaryToken',
2495
+ value: function () {
2496
+ var _ref46 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee45() {
2497
+ var timeToLive = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 60;
2498
+
2499
+ var _comoData45, api, locationId, env;
2500
+
2501
+ return _regenerator2.default.wrap(function _callee45$(_context45) {
2502
+ while (1) {
2503
+ switch (_context45.prev = _context45.next) {
2504
+ case 0:
2505
+ _comoData45 = this.comoData, api = _comoData45.api, locationId = _comoData45.locationId, env = _comoData45.env_params;
2506
+ return _context45.abrupt('return', api.generateTemporaryToken(env.services_root, locationId, timeToLive));
2507
+
2508
+ case 2:
2509
+ case 'end':
2510
+ return _context45.stop();
2511
+ }
2512
+ }
2513
+ }, _callee45, this);
2514
+ }));
2515
+
2516
+ function generateTemporaryToken() {
2517
+ return _ref46.apply(this, arguments);
2518
+ }
2519
+
2520
+ return generateTemporaryToken;
2521
+ }()
2486
2522
  }]);
2487
2523
  return Como;
2488
2524
  }();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@como/como-client",
3
- "version": "0.8.5",
3
+ "version": "0.8.7",
4
4
  "description": "Client module for Como's loaylty API",
5
5
  "main": "src/como.js",
6
6
  "scripts": {
@@ -26,12 +26,12 @@
26
26
  },
27
27
  "homepage": "https://github.com/ConduitMobileRND/como-client-lib#readme",
28
28
  "dependencies": {
29
- "axios": "^0.18.0",
29
+ "axios": "^0.30.2",
30
30
  "chai": "^4.1.2",
31
31
  "json-stable-stringify": "1.0.1",
32
32
  "jssha": "^3.2.0",
33
33
  "mocha": "^5.2.0",
34
- "moment-timezone": "^0.5.17",
34
+ "moment-timezone": "^0.5.35",
35
35
  "ramda": "^0.25.0"
36
36
  },
37
37
  "devDependencies": {
@@ -50,4 +50,4 @@
50
50
  "webpack": "^4.8.3",
51
51
  "webpack-cli": "^2.1.4"
52
52
  }
53
- }
53
+ }
package/src/como.js CHANGED
@@ -1033,6 +1033,16 @@ class Como {
1033
1033
  const { api, locationId } = this.comoData;
1034
1034
  return api.getAllTranslations(locationId);
1035
1035
  }
1036
+
1037
+ /**
1038
+ * Generate a temporary token for the location
1039
+ * @param {number} timeToLive time to live in seconds
1040
+ * @returns {string} temporary token
1041
+ */
1042
+ async generateTemporaryToken(timeToLive = 60) {
1043
+ const { api, locationId, env_params: env } = this.comoData;
1044
+ return api.generateTemporaryToken(env.services_root, locationId, timeToLive);
1045
+ }
1036
1046
  }
1037
1047
 
1038
1048
  module.exports = Como;