@livechat/developer-studio-api 2.3.31 → 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
@@ -4968,6 +4968,19 @@ var platformDpsApi = {
4968
4968
 
4969
4969
  // src/apis/platform/adapter/instance.ts
4970
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
+ };
4971
4984
  function getPlatformAdapterClientAuthorization(req) {
4972
4985
  return {
4973
4986
  platform: {
@@ -5059,15 +5072,19 @@ function initPlatformAdapterClientInstance(baseUrl, tokens) {
5059
5072
  }
5060
5073
  }
5061
5074
  function updatePlatformAdapterClientInstance(tokens) {
5062
- var _a, _b, _c;
5075
+ var _a, _b, _c, _d;
5063
5076
  const headers = platformAdapterClientInstance.defaults.headers;
5064
- 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) {
5065
5082
  headers["platform-dps-token"] = tokens.platform.dps;
5066
5083
  }
5067
- 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) {
5068
5085
  headers["github-app-token"] = tokens.github.app;
5069
5086
  }
5070
- 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) {
5071
5088
  headers["github-oauth-token"] = tokens.github.oauth;
5072
5089
  }
5073
5090
  if (tokens == null ? void 0 : tokens.netlify) {
package/dist/index.mjs CHANGED
@@ -4877,6 +4877,19 @@ var platformDpsApi = {
4877
4877
 
4878
4878
  // src/apis/platform/adapter/instance.ts
4879
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
+ };
4880
4893
  function getPlatformAdapterClientAuthorization(req) {
4881
4894
  return {
4882
4895
  platform: {
@@ -4968,15 +4981,19 @@ function initPlatformAdapterClientInstance(baseUrl, tokens) {
4968
4981
  }
4969
4982
  }
4970
4983
  function updatePlatformAdapterClientInstance(tokens) {
4971
- var _a, _b, _c;
4984
+ var _a, _b, _c, _d;
4972
4985
  const headers = platformAdapterClientInstance.defaults.headers;
4973
- 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) {
4974
4991
  headers["platform-dps-token"] = tokens.platform.dps;
4975
4992
  }
4976
- 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) {
4977
4994
  headers["github-app-token"] = tokens.github.app;
4978
4995
  }
4979
- 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) {
4980
4997
  headers["github-oauth-token"] = tokens.github.oauth;
4981
4998
  }
4982
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.31",
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",
20
+ "config": "0.0.1",
21
21
  "tsconfig": "0.0.1",
22
- "config": "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",