qiscus-sdk-core 2.12.3 → 2.12.4

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/index.js CHANGED
@@ -166,6 +166,7 @@ var QiscusSDK = /*#__PURE__*/function () {
166
166
  this.lastReceiveMessages = [];
167
167
  this._hookAdapter = (0, _hook.hookAdapterFactory)();
168
168
  this._uploadURL = null;
169
+ this._autoRefreshToken = false;
169
170
  } // this.uploadURL = `${this.baseURL}/api/v2/sdk/upload`
170
171
 
171
172
 
@@ -333,6 +334,7 @@ var QiscusSDK = /*#__PURE__*/function () {
333
334
  _this2.extras = setterHelper(null, cfg.extras, configExtras);
334
335
  _this2.enableSync = setterHelper(null, cfg.enable_sync, _this2.enableSync);
335
336
  _this2.enableSyncEvent = setterHelper(null, cfg.enable_sync_event, _this2.enableSyncEvent);
337
+ _this2._autoRefreshToken = setterHelper(null, cfg.auto_refresh_token, false);
336
338
  })["catch"](function (err) {
337
339
  _this2.logger('got error when trying to get app config', err);
338
340
 
@@ -767,6 +769,7 @@ var QiscusSDK = /*#__PURE__*/function () {
767
769
 
768
770
  _this3.authAdapter.userId = _this3.userData.email;
769
771
  _this3.authAdapter.refreshToken = _this3.userData.refresh_token;
772
+ _this3.authAdapter.autoRefreshToken = _this3._autoRefreshToken;
770
773
  });
771
774
  /**
772
775
  * Called when there's something wrong when connecting to qiscus SDK
@@ -23,6 +23,7 @@ var AuthAdapter = /*#__PURE__*/function () {
23
23
  this.HTTPAdapter = HTTPAdapter;
24
24
  this.refreshToken = null;
25
25
  this.userId = null;
26
+ this.autoRefreshToken = false;
26
27
  }
27
28
 
28
29
  (0, _createClass2["default"])(AuthAdapter, [{
@@ -179,7 +179,9 @@ var HttpAdapter = /*#__PURE__*/function () {
179
179
  }
180
180
  }, {
181
181
  key: "setupHeaders",
182
- value: function setupHeaders(req, headers) {
182
+ value: function setupHeaders(req) {
183
+ var headers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
184
+
183
185
  // let's give this default Authorization Header
184
186
  if (this.AppId != null) {
185
187
  req.set("QISCUS-SDK-APP-ID", "".concat(this.AppId));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qiscus-sdk-core",
3
- "version": "2.12.3",
3
+ "version": "2.12.4",
4
4
  "description": "Qiscus Web SDK Core",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -54,7 +54,7 @@
54
54
  "eslint-plugin-standard": "^4.0.1",
55
55
  "http-server": "^0.12.3",
56
56
  "mocha": "^5.2.0",
57
- "np": "^7.6.2",
57
+ "np": "^8.0.4",
58
58
  "npm-run-all": "^4.1.5",
59
59
  "rimraf": "^2.7.1",
60
60
  "serve": "^12.0.0",
@@ -93,5 +93,8 @@
93
93
  "semi": false,
94
94
  "singleQuote": true,
95
95
  "trailingComma": "es5"
96
+ },
97
+ "engines": {
98
+ "node": "v18.16"
96
99
  }
97
100
  }