@como/como-client 0.7.54 → 0.7.58

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
@@ -148,7 +148,7 @@ var Como = function () {
148
148
 
149
149
  var enableSignon = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
150
150
 
151
- var isExists, environmentId, locationId, installationId, source, updateCredentials, getCredentials, gateway, _APIService$getServic, service, refresher, initService, accessToken, refreshToken, expiresIn, credExist, isExpired, refreshFailed, data, interval, _data, signOnSuccessfully, _data2;
151
+ var isExists, environmentId, locationId, installationId, source, binaryVersion, phoenixVersion, updateCredentials, getCredentials, gateway, _APIService$getServic, service, refresher, initService, accessToken, refreshToken, expiresIn, credExist, isExpired, refreshFailed, data, interval, _data, signOnSuccessfully, _data2;
152
152
 
153
153
  return _regenerator2.default.wrap(function _callee2$(_context2) {
154
154
  while (1) {
@@ -158,7 +158,7 @@ var Como = function () {
158
158
  return !ramda.isNil(x) && !ramda.isEmpty(x);
159
159
  };
160
160
 
161
- environmentId = environment.id, locationId = environment.locationId, installationId = environment.installationId, source = environment.source;
161
+ environmentId = environment.id, locationId = environment.locationId, installationId = environment.installationId, source = environment.source, binaryVersion = environment.binaryVersion, phoenixVersion = environment.phoenixVersion;
162
162
 
163
163
  if (!(!isExists(environmentId) || !isExists(locationId) || !isExists(installationId))) {
164
164
  _context2.next = 4;
@@ -187,7 +187,7 @@ var Como = function () {
187
187
 
188
188
  getCredentials = this.getCredentials.bind(this);
189
189
  gateway = this.comoData.env_params.gateway;
190
- _APIService$getServic = APIService.getService(gateway, installationId, getCredentials, updateCredentials, source), service = _APIService$getServic.service, refresher = _APIService$getServic.refresher, initService = _APIService$getServic.initService;
190
+ _APIService$getServic = APIService.getService(gateway, installationId, getCredentials, updateCredentials, source, binaryVersion, phoenixVersion), service = _APIService$getServic.service, refresher = _APIService$getServic.refresher, initService = _APIService$getServic.initService;
191
191
 
192
192
  this.comoData.api = service;
193
193
  this.comoData.initApi = initService;
@@ -33,7 +33,10 @@ var ssr = require('./ssr.service');
33
33
  var log = require('./log.service');
34
34
 
35
35
  exports.getService = function (baseURL, uid, getCredentials, credentialsRefresh, source) {
36
- var httpClient = axios.create({ baseURL: baseURL, headers: { 'x-phoenix-version': version } });
36
+ var binaryVersion = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'not-defined';
37
+ var phoenixVersion = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 'not-defined';
38
+
39
+ var httpClient = axios.create({ baseURL: baseURL, headers: { 'x-comojs-version': version, 'x-binary-version': binaryVersion, 'x-phoenix-version': phoenixVersion } });
37
40
 
38
41
  /**
39
42
  * TODO: Make refresher prettier.
@@ -70,13 +73,13 @@ exports.getService = function (baseURL, uid, getCredentials, credentialsRefresh,
70
73
  prev[curr] = apiCalls[curr](httpClient); // eslint-disable-line no-param-reassign
71
74
  return prev;
72
75
  }, {});
73
- var initService = getInitApiCalles(baseURL);
76
+ var initService = getInitApiCalles(baseURL, binaryVersion, phoenixVersion);
74
77
 
75
78
  return { initService: initService, service: service, refresher: refresher };
76
79
  };
77
80
 
78
- function getInitApiCalles(baseURL) {
79
- var httpInitClient = axios.create({ baseURL: baseURL });
81
+ function getInitApiCalles(baseURL, binaryVersion, phoenixVersion) {
82
+ var httpInitClient = axios.create({ baseURL: baseURL, headers: { 'x-comojs-version': version, 'x-binary-version': binaryVersion, 'x-phoenix-version': phoenixVersion } });
80
83
  var initApiCalls = { signOn: auth.signOn, refreshToken: auth.refreshToken, logError: log.logError };
81
84
  return (0, _keys2.default)(initApiCalls).reduce(function (prev, curr) {
82
85
  prev[curr] = initApiCalls[curr](httpInitClient); // eslint-disable-line no-param-reassign
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@como/como-client",
3
- "version": "0.7.54",
3
+ "version": "0.7.58",
4
4
  "description": "Client module for Como's loaylty API",
5
5
  "main": "src/como.js",
6
6
  "scripts": {
package/src/como.js CHANGED
@@ -69,7 +69,7 @@ class Como {
69
69
  */
70
70
  async init(environment, credentials, refreshCallback, enableSignon = true) {
71
71
  const isExists = (x => !ramda.isNil(x) && !ramda.isEmpty(x));
72
- const { id: environmentId, locationId, installationId, source } = environment;
72
+ const { id: environmentId, locationId, installationId, source, binaryVersion, phoenixVersion } = environment;
73
73
  if (!isExists(environmentId) || !isExists(locationId) || !isExists(installationId)) {
74
74
  throw new Error(`missing parameters: ${environment}`);
75
75
  }
@@ -95,7 +95,7 @@ class Como {
95
95
  const getCredentials = this.getCredentials.bind(this);
96
96
  const { gateway } = this.comoData.env_params;
97
97
  const { service, refresher, initService } = APIService
98
- .getService(gateway, installationId, getCredentials, updateCredentials, source);
98
+ .getService(gateway, installationId, getCredentials, updateCredentials, source, binaryVersion, phoenixVersion);
99
99
  this.comoData.api = service;
100
100
  this.comoData.initApi = initService;
101
101
  this.comoData.refresher = refresher;