@livechat/developer-studio-api 2.3.30 → 2.3.33

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/dist/index.js CHANGED
@@ -3381,6 +3381,7 @@ var platformAccountsTokenApi = {
3381
3381
  exchangeCode(code, clientId, clientSecret, redirectUrl) {
3382
3382
  return __async(this, null, function* () {
3383
3383
  const data = new URLSearchParams({
3384
+ grant_type: "authorization_code",
3384
3385
  code,
3385
3386
  client_id: clientId,
3386
3387
  client_secret: clientSecret,
@@ -4967,6 +4968,19 @@ var platformDpsApi = {
4967
4968
 
4968
4969
  // src/apis/platform/adapter/instance.ts
4969
4970
  var import_axios13 = __toESM(require("axios"));
4971
+ var REGION2 = {
4972
+ FRA: "fra",
4973
+ DAL: "dal",
4974
+ FRA_A: "fra-a",
4975
+ FRA_B: "fra-b"
4976
+ };
4977
+ var supportedRegions2 = Object.values(REGION2);
4978
+ var getRegion2 = (token) => {
4979
+ const region = token.split(":")[0];
4980
+ if (supportedRegions2.includes(region)) {
4981
+ return region;
4982
+ }
4983
+ };
4970
4984
  function getPlatformAdapterClientAuthorization(req) {
4971
4985
  return {
4972
4986
  platform: {
@@ -5058,15 +5072,19 @@ function initPlatformAdapterClientInstance(baseUrl, tokens) {
5058
5072
  }
5059
5073
  }
5060
5074
  function updatePlatformAdapterClientInstance(tokens) {
5061
- var _a, _b, _c;
5075
+ var _a, _b, _c, _d;
5062
5076
  const headers = platformAdapterClientInstance.defaults.headers;
5063
- if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.dps) {
5077
+ const region = ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.dps) ? getRegion2(tokens.platform.dps) : void 0;
5078
+ if (region) {
5079
+ headers["X-Region"] = region;
5080
+ }
5081
+ if ((_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.dps) {
5064
5082
  headers["platform-dps-token"] = tokens.platform.dps;
5065
5083
  }
5066
- if ((_b = tokens == null ? void 0 : tokens.github) == null ? void 0 : _b.app) {
5084
+ if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.app) {
5067
5085
  headers["github-app-token"] = tokens.github.app;
5068
5086
  }
5069
- if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.oauth) {
5087
+ if ((_d = tokens == null ? void 0 : tokens.github) == null ? void 0 : _d.oauth) {
5070
5088
  headers["github-oauth-token"] = tokens.github.oauth;
5071
5089
  }
5072
5090
  if (tokens == null ? void 0 : tokens.netlify) {
package/dist/index.mjs CHANGED
@@ -3290,6 +3290,7 @@ var platformAccountsTokenApi = {
3290
3290
  exchangeCode(code, clientId, clientSecret, redirectUrl) {
3291
3291
  return __async(this, null, function* () {
3292
3292
  const data = new URLSearchParams({
3293
+ grant_type: "authorization_code",
3293
3294
  code,
3294
3295
  client_id: clientId,
3295
3296
  client_secret: clientSecret,
@@ -4876,6 +4877,19 @@ var platformDpsApi = {
4876
4877
 
4877
4878
  // src/apis/platform/adapter/instance.ts
4878
4879
  import axios13 from "axios";
4880
+ var REGION2 = {
4881
+ FRA: "fra",
4882
+ DAL: "dal",
4883
+ FRA_A: "fra-a",
4884
+ FRA_B: "fra-b"
4885
+ };
4886
+ var supportedRegions2 = Object.values(REGION2);
4887
+ var getRegion2 = (token) => {
4888
+ const region = token.split(":")[0];
4889
+ if (supportedRegions2.includes(region)) {
4890
+ return region;
4891
+ }
4892
+ };
4879
4893
  function getPlatformAdapterClientAuthorization(req) {
4880
4894
  return {
4881
4895
  platform: {
@@ -4967,15 +4981,19 @@ function initPlatformAdapterClientInstance(baseUrl, tokens) {
4967
4981
  }
4968
4982
  }
4969
4983
  function updatePlatformAdapterClientInstance(tokens) {
4970
- var _a, _b, _c;
4984
+ var _a, _b, _c, _d;
4971
4985
  const headers = platformAdapterClientInstance.defaults.headers;
4972
- if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.dps) {
4986
+ const region = ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.dps) ? getRegion2(tokens.platform.dps) : void 0;
4987
+ if (region) {
4988
+ headers["X-Region"] = region;
4989
+ }
4990
+ if ((_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.dps) {
4973
4991
  headers["platform-dps-token"] = tokens.platform.dps;
4974
4992
  }
4975
- if ((_b = tokens == null ? void 0 : tokens.github) == null ? void 0 : _b.app) {
4993
+ if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.app) {
4976
4994
  headers["github-app-token"] = tokens.github.app;
4977
4995
  }
4978
- if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.oauth) {
4996
+ if ((_d = tokens == null ? void 0 : tokens.github) == null ? void 0 : _d.oauth) {
4979
4997
  headers["github-oauth-token"] = tokens.github.oauth;
4980
4998
  }
4981
4999
  if (tokens == null ? void 0 : tokens.netlify) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livechat/developer-studio-api",
3
- "version": "2.3.30",
3
+ "version": "2.3.33",
4
4
  "description": "This project is API for LiveChat Developer Studio.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -17,9 +17,9 @@
17
17
  "@types/node": "^17.0.12",
18
18
  "tsup": "^7.1.0",
19
19
  "typescript": "^5.1.6",
20
- "eslint-config-custom": "0.0.2",
21
20
  "config": "0.0.1",
22
- "tsconfig": "0.0.1"
21
+ "tsconfig": "0.0.1",
22
+ "eslint-config-custom": "0.0.2"
23
23
  },
24
24
  "scripts": {
25
25
  "build": "tsup src/index.ts --format esm,cjs --dts",