@livechat/developer-studio-api 2.2.1 → 2.3.1

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
@@ -68,7 +68,6 @@ var __async = (__this, __arguments, generator) => {
68
68
  var src_exports = {};
69
69
  __export(src_exports, {
70
70
  API_NOTIFICATIONS: () => API_NOTIFICATIONS,
71
- ErrorType: () => ErrorType,
72
71
  UnauthorizeApiError: () => UnauthorizeApiError,
73
72
  api: () => api,
74
73
  getAppAutoReviewPayload: () => getAppAutoReviewPayload,
@@ -129,70 +128,6 @@ module.exports = __toCommonJS(src_exports);
129
128
  // src/apis/integrations/github/api.ts
130
129
  var import_axios2 = __toESM(require("axios"));
131
130
 
132
- // src/apis/integrations/github/instance.ts
133
- var import_axios = __toESM(require("axios"));
134
-
135
- // src/types/errors/api.ts
136
- var UnauthorizeApiError = class extends Error {
137
- constructor(source) {
138
- super("Unauthorized API call");
139
- this.source = source;
140
- }
141
- };
142
-
143
- // src/apis/integrations/github/instance.ts
144
- var githubClientInstance = import_axios.default.create({
145
- baseURL: "https://api.github.com",
146
- headers: {
147
- ["Accept"]: "application/vnd.github+json",
148
- ["Content-Type"]: "application/json"
149
- }
150
- });
151
- githubClientInstance.interceptors.response.use(
152
- (r) => r,
153
- (error) => {
154
- var _a;
155
- if (import_axios.default.isAxiosError(error)) {
156
- if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
157
- error = new UnauthorizeApiError("github");
158
- }
159
- }
160
- throw error;
161
- }
162
- );
163
- function getGitHubClientAuthorization(req) {
164
- return {
165
- tokens: {
166
- app: req.headers["github-app-token"],
167
- oauth: req.headers["github-oauth-token"]
168
- }
169
- };
170
- }
171
- function getGithubClientRequestConfig(options = {}) {
172
- const defaultAuthorization = githubClientInstance.defaults.headers["Authorization"];
173
- const headers = {
174
- authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
175
- };
176
- if (options.ensureAuthorizationToken && !headers.authorization) {
177
- throw new UnauthorizeApiError("github");
178
- }
179
- return {
180
- headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
181
- };
182
- }
183
- function initGithubClientInstance(token) {
184
- if (token) {
185
- updateGithubClientInstance(token);
186
- }
187
- }
188
- function updateGithubClientInstance(token) {
189
- if (token) {
190
- githubClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
191
- } else {
192
- delete githubClientInstance.defaults.headers["Authorization"];
193
- }
194
- }
195
-
196
131
  // ../../private/config/src/integrations/github.ts
197
132
  var GITHUB_CONFIG = {
198
133
  url: "https://github.com/login/oauth/authorize",
@@ -288,6 +223,72 @@ var VERCEL_CONFIG = {
288
223
  }
289
224
  };
290
225
 
226
+ // src/apis/integrations/github/instance.ts
227
+ var import_axios = __toESM(require("axios"));
228
+
229
+ // src/types/errors/api.ts
230
+ var UnauthorizeApiError = class extends Error {
231
+ constructor(source) {
232
+ super("Unauthorized API call");
233
+ this.source = source;
234
+ }
235
+ };
236
+
237
+ // src/apis/integrations/github/instance.ts
238
+ var githubClientInstance = import_axios.default.create({
239
+ baseURL: "https://api.github.com",
240
+ headers: {
241
+ Accept: "application/vnd.github+json",
242
+ "Content-Type": "application/json"
243
+ }
244
+ });
245
+ githubClientInstance.interceptors.response.use(
246
+ (r) => r,
247
+ (error) => {
248
+ var _a;
249
+ if (import_axios.default.isAxiosError(error)) {
250
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
251
+ throw new UnauthorizeApiError("github");
252
+ }
253
+ }
254
+ throw error;
255
+ }
256
+ );
257
+ function getGitHubClientAuthorization(req) {
258
+ return {
259
+ tokens: {
260
+ app: req.headers["github-app-token"],
261
+ oauth: req.headers["github-oauth-token"]
262
+ }
263
+ };
264
+ }
265
+ function getGithubClientRequestConfig(options = {}) {
266
+ const currentHeaders = githubClientInstance.defaults.headers;
267
+ const defaultAuthorization = currentHeaders.Authorization;
268
+ const headers = {
269
+ authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
270
+ };
271
+ if (options.ensureAuthorizationToken && !headers.authorization) {
272
+ throw new UnauthorizeApiError("github");
273
+ }
274
+ return {
275
+ headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
276
+ };
277
+ }
278
+ function initGithubClientInstance(token) {
279
+ if (token) {
280
+ updateGithubClientInstance(token);
281
+ }
282
+ }
283
+ function updateGithubClientInstance(token) {
284
+ const headers = githubClientInstance.defaults.headers;
285
+ if (token) {
286
+ headers.Authorization = `Bearer ${token}`;
287
+ } else {
288
+ delete headers.Authorization;
289
+ }
290
+ }
291
+
291
292
  // src/apis/integrations/github/installation/api.ts
292
293
  var gitHubInstallationApi = {
293
294
  getInstallation(account, authorization) {
@@ -365,7 +366,7 @@ var gitHubRepositoryApi = {
365
366
  })
366
367
  );
367
368
  const branch = response.data.find(
368
- (branch2) => branch2.name === repositoryBranch
369
+ (innerBranch) => innerBranch.name === repositoryBranch
369
370
  );
370
371
  if (!branch) {
371
372
  throw new Error("Branch not found");
@@ -481,18 +482,18 @@ var gitHubRepositoryApi = {
481
482
  );
482
483
  return response.data.content;
483
484
  });
484
- let seed = void 0;
485
+ let seed;
485
486
  try {
486
487
  seed = yield this.getRepositorySeed(repositoryName, authorization);
487
488
  } catch (e) {
488
489
  }
489
- return yield upsert(seed == null ? void 0 : seed.sha);
490
+ return upsert(seed == null ? void 0 : seed.sha);
490
491
  });
491
492
  },
492
493
  deleteRepository(repositoryName, authorization) {
493
494
  return __async(this, null, function* () {
494
495
  var _a;
495
- return yield githubClientInstance.delete(
496
+ return githubClientInstance.delete(
496
497
  `/repos/${repositoryName}`,
497
498
  getGithubClientRequestConfig({
498
499
  token: (_a = authorization == null ? void 0 : authorization.tokens) == null ? void 0 : _a.app,
@@ -668,7 +669,7 @@ var gitHubApi = {
668
669
  }
669
670
  }
670
671
  );
671
- let params = new URLSearchParams(response.data);
672
+ const params = new URLSearchParams(response.data);
672
673
  return (_a = params.get("access_token")) != null ? _a : "";
673
674
  });
674
675
  }
@@ -679,7 +680,7 @@ var import_axios3 = __toESM(require("axios"));
679
680
  var netlifyClientInstance = import_axios3.default.create({
680
681
  baseURL: "https://api.netlify.com/api/v1",
681
682
  headers: {
682
- ["Content-Type"]: "application/json"
683
+ "Content-Type": "application/json"
683
684
  }
684
685
  });
685
686
  netlifyClientInstance.interceptors.response.use(
@@ -688,7 +689,7 @@ netlifyClientInstance.interceptors.response.use(
688
689
  var _a;
689
690
  if (import_axios3.default.isAxiosError(error)) {
690
691
  if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
691
- error = new UnauthorizeApiError("netlify");
692
+ throw new UnauthorizeApiError("netlify");
692
693
  }
693
694
  }
694
695
  throw error;
@@ -700,7 +701,8 @@ function getNetlifyClientAuthorization(req) {
700
701
  };
701
702
  }
702
703
  function getNetlifyClientConfig(options = {}) {
703
- const defaultAuthorization = netlifyClientInstance.defaults.headers["Authorization"];
704
+ const currentHeaders = netlifyClientInstance.defaults.headers;
705
+ const defaultAuthorization = currentHeaders.Authorization;
704
706
  const headers = {
705
707
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
706
708
  };
@@ -717,10 +719,11 @@ function initNetlifyClientInstance(token) {
717
719
  }
718
720
  }
719
721
  function updateNetlifyClientInstance(token) {
722
+ const headers = netlifyClientInstance.defaults.headers;
720
723
  if (token) {
721
- netlifyClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
724
+ headers.Authorization = `Bearer ${token}`;
722
725
  } else {
723
- delete netlifyClientInstance.defaults.headers["Authorization"];
726
+ delete headers.Authorization;
724
727
  }
725
728
  }
726
729
 
@@ -739,14 +742,15 @@ var netlifyAccountApi = {
739
742
  },
740
743
  getAccountEnvs(accountId, siteId, authorization) {
741
744
  return __async(this, null, function* () {
742
- if (!accountId) {
743
- accountId = yield this.getAccount(authorization);
745
+ let targetAccountId = accountId;
746
+ if (!targetAccountId) {
747
+ targetAccountId = yield this.getAccount(authorization);
744
748
  }
745
- if (!accountId) {
749
+ if (!targetAccountId) {
746
750
  throw new Error("No account");
747
751
  }
748
752
  const { data: envs } = yield netlifyClientInstance.get(
749
- `/accounts/${accountId}/env?site_id=${siteId}&scope=all&context=all&level=all`,
753
+ `/accounts/${targetAccountId}/env?site_id=${siteId}&scope=all&context=all&level=all`,
750
754
  getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
751
755
  ensureAuthorizationToken: true
752
756
  }))
@@ -756,14 +760,15 @@ var netlifyAccountApi = {
756
760
  },
757
761
  getAccountEnv(accountId, siteId, envKey, authorization) {
758
762
  return __async(this, null, function* () {
759
- if (!accountId) {
760
- accountId = yield this.getAccount(authorization);
763
+ let targetAccountId = accountId;
764
+ if (!targetAccountId) {
765
+ targetAccountId = yield this.getAccount(authorization);
761
766
  }
762
- if (!accountId) {
767
+ if (!targetAccountId) {
763
768
  throw new Error("No account");
764
769
  }
765
770
  const { data: envs } = yield netlifyClientInstance.get(
766
- `/accounts/${accountId}/env/${envKey}?site_id=${siteId}`,
771
+ `/accounts/${targetAccountId}/env/${envKey}?site_id=${siteId}`,
767
772
  getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
768
773
  ensureAuthorizationToken: true
769
774
  }))
@@ -773,25 +778,27 @@ var netlifyAccountApi = {
773
778
  },
774
779
  createAccountEnv(accountId, siteId, envName, envValue, envs, authorization) {
775
780
  return __async(this, null, function* () {
776
- if (!accountId) {
777
- accountId = yield this.getAccount(authorization);
781
+ let targetAccountId = accountId;
782
+ let targetEnvs = envs;
783
+ if (!targetAccountId) {
784
+ targetAccountId = yield this.getAccount(authorization);
778
785
  }
779
- if (!accountId) {
786
+ if (!targetAccountId) {
780
787
  throw new Error("No account");
781
788
  }
782
- if (!envs) {
789
+ if (!targetEnvs) {
783
790
  const response = yield netlifyClientInstance.get(
784
- `/accounts/${accountId}/env?site_id=${siteId}&scope=all&context=all&level=all`,
791
+ `/accounts/${targetAccountId}/env?site_id=${siteId}&scope=all&context=all&level=all`,
785
792
  getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
786
793
  ensureAuthorizationToken: true
787
794
  }))
788
795
  );
789
- envs = response.data;
796
+ targetEnvs = response.data;
790
797
  }
791
- const existingEnv = envs.find((env) => env.key === envName);
798
+ const existingEnv = targetEnvs.find((env) => env.key === envName);
792
799
  if (existingEnv) {
793
800
  yield netlifyClientInstance.put(
794
- `/accounts/${accountId}/env/${existingEnv.key}?site_id=${siteId}`,
801
+ `/accounts/${targetAccountId}/env/${existingEnv.key}?site_id=${siteId}`,
795
802
  {
796
803
  key: existingEnv.key,
797
804
  scopes: ["builds", "functions", "runtime", "post_processing"],
@@ -803,7 +810,7 @@ var netlifyAccountApi = {
803
810
  );
804
811
  } else {
805
812
  yield netlifyClientInstance.post(
806
- `/accounts/${accountId}/env?site_id=${siteId}`,
813
+ `/accounts/${targetAccountId}/env?site_id=${siteId}`,
807
814
  [
808
815
  {
809
816
  key: envName,
@@ -839,19 +846,19 @@ var netlifyAccountApi = {
839
846
  },
840
847
  removeAccountEnv(accountId, siteId, envKey, authorization) {
841
848
  return __async(this, null, function* () {
842
- if (!accountId) {
843
- accountId = yield this.getAccount(authorization);
849
+ let targetAccountId = accountId;
850
+ if (!targetAccountId) {
851
+ targetAccountId = yield this.getAccount(authorization);
844
852
  }
845
853
  if (!accountId) {
846
854
  throw new Error("No account");
847
855
  }
848
- const response = yield netlifyClientInstance.delete(
849
- `/accounts/${accountId}/env/${envKey}?site_id=${siteId}`,
856
+ yield netlifyClientInstance.delete(
857
+ `/accounts/${targetAccountId}/env/${envKey}?site_id=${siteId}`,
850
858
  getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
851
859
  ensureAuthorizationToken: true
852
860
  }))
853
861
  );
854
- return response.data;
855
862
  });
856
863
  }
857
864
  };
@@ -861,7 +868,7 @@ var netlifyHookApi = {
861
868
  addBuildHooks(siteId, authorization) {
862
869
  return __async(this, null, function* () {
863
870
  try {
864
- netlifyClientInstance.post(
871
+ yield netlifyClientInstance.post(
865
872
  "/hooks",
866
873
  {
867
874
  site_id: siteId,
@@ -878,7 +885,7 @@ var netlifyHookApi = {
878
885
  } catch (e) {
879
886
  }
880
887
  try {
881
- netlifyClientInstance.post(
888
+ yield netlifyClientInstance.post(
882
889
  "/hooks",
883
890
  {
884
891
  site_id: siteId,
@@ -895,7 +902,7 @@ var netlifyHookApi = {
895
902
  } catch (e) {
896
903
  }
897
904
  try {
898
- netlifyClientInstance.post(
905
+ yield netlifyClientInstance.post(
899
906
  "/hooks",
900
907
  {
901
908
  site_id: siteId,
@@ -964,7 +971,7 @@ var netlifySiteApi = {
964
971
  }))
965
972
  );
966
973
  const deploy = deploys.filter(
967
- (deploy2) => deploy2.context === "production"
974
+ (innerDeploy) => innerDeploy.context === "production"
968
975
  )[0];
969
976
  const { data: pluginRuns } = yield netlifyClientInstance.get(
970
977
  `/deploys/${deploy.id}/plugin_runs`,
@@ -1000,20 +1007,23 @@ var netlifySiteApi = {
1000
1007
  },
1001
1008
  createSiteByInstallationId(name, repositoryFullName, target, installationId, branch, authorization) {
1002
1009
  return __async(this, null, function* () {
1003
- const config = target === "nextjs" ? {
1004
- plugins: ["@netlify/plugin-nextjs"],
1005
- packages: [{ package: "@netlify/plugin-nextjs" }],
1006
- dir: ".next",
1007
- cmd: "npm run build"
1008
- } : target === "node" ? {
1009
- plugins: [],
1010
- dir: "dist",
1011
- cmd: "npm run build"
1012
- } : {
1013
- plugin: [],
1014
- dir: ".",
1015
- cmd: ""
1016
- };
1010
+ const config = (
1011
+ // eslint-disable-next-line no-nested-ternary -- fix me
1012
+ target === "nextjs" ? {
1013
+ plugins: ["@netlify/plugin-nextjs"],
1014
+ packages: [{ package: "@netlify/plugin-nextjs" }],
1015
+ dir: ".next",
1016
+ cmd: "npm run build"
1017
+ } : target === "node" ? {
1018
+ plugins: [],
1019
+ dir: "dist",
1020
+ cmd: "npm run build"
1021
+ } : {
1022
+ plugin: [],
1023
+ dir: ".",
1024
+ cmd: ""
1025
+ }
1026
+ );
1017
1027
  const response = yield netlifyClientInstance.post(
1018
1028
  `/sites`,
1019
1029
  {
@@ -1044,19 +1054,22 @@ var netlifySiteApi = {
1044
1054
  },
1045
1055
  createSiteByDeployKey(name, repositoryFullName, target, deployKeyId, branch, authorization) {
1046
1056
  return __async(this, null, function* () {
1047
- const config = target === "nextjs" ? {
1048
- packages: [{ package: "@netlify/plugin-nextjs" }],
1049
- dir: ".next",
1050
- cmd: "npm run build"
1051
- } : target === "node" ? {
1052
- packages: [],
1053
- dir: "dist",
1054
- cmd: "npm run build"
1055
- } : {
1056
- packages: [],
1057
- dir: ".",
1058
- cmd: ""
1059
- };
1057
+ const config = (
1058
+ // eslint-disable-next-line no-nested-ternary -- fix me
1059
+ target === "nextjs" ? {
1060
+ packages: [{ package: "@netlify/plugin-nextjs" }],
1061
+ dir: ".next",
1062
+ cmd: "npm run build"
1063
+ } : target === "node" ? {
1064
+ packages: [],
1065
+ dir: "dist",
1066
+ cmd: "npm run build"
1067
+ } : {
1068
+ packages: [],
1069
+ dir: ".",
1070
+ cmd: ""
1071
+ }
1072
+ );
1060
1073
  const response = yield netlifyClientInstance.post(
1061
1074
  `/sites`,
1062
1075
  {
@@ -1085,13 +1098,12 @@ var netlifySiteApi = {
1085
1098
  },
1086
1099
  removeSite(siteId, authorization) {
1087
1100
  return __async(this, null, function* () {
1088
- const response = yield netlifyClientInstance.delete(
1101
+ yield netlifyClientInstance.delete(
1089
1102
  `/sites/${siteId}`,
1090
1103
  getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
1091
1104
  ensureAuthorizationToken: true
1092
1105
  }))
1093
1106
  );
1094
- return response.data;
1095
1107
  });
1096
1108
  },
1097
1109
  triggerSiteBuild(siteId, authorization) {
@@ -1204,14 +1216,12 @@ var netlifySiteApi = {
1204
1216
  {
1205
1217
  general_position: "footer",
1206
1218
  title: "sentry",
1207
- // eslint-disable-next-line no-useless-escape
1208
1219
  general: `<script src='https://js.sentry-cdn.com/${projectKey}.min.js' crossorigin="anonymous"></script>`
1209
1220
  },
1210
1221
  getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
1211
1222
  ensureAuthorizationToken: true
1212
1223
  }))
1213
1224
  );
1214
- return;
1215
1225
  });
1216
1226
  }
1217
1227
  };
@@ -1238,7 +1248,7 @@ planetScaleClientInstance.interceptors.response.use(
1238
1248
  var _a;
1239
1249
  if (import_axios4.default.isAxiosError(error)) {
1240
1250
  if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
1241
- error = new UnauthorizeApiError("planetscale");
1251
+ throw new UnauthorizeApiError("planetscale");
1242
1252
  }
1243
1253
  }
1244
1254
  throw error;
@@ -1250,7 +1260,8 @@ function getPlanetScaleClientAuthorization(req) {
1250
1260
  };
1251
1261
  }
1252
1262
  function getPlanetScaleClientConfig(options = {}) {
1253
- const defaultAuthorization = planetScaleClientInstance.defaults.headers["Authorization"];
1263
+ const currentHeaders = planetScaleClientInstance.defaults.headers;
1264
+ const defaultAuthorization = currentHeaders.Authorization;
1254
1265
  const headers = {
1255
1266
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `${options.token}` : void 0
1256
1267
  };
@@ -1267,10 +1278,11 @@ function initPlanetScaleClientInstance(token) {
1267
1278
  }
1268
1279
  }
1269
1280
  function updatePlanetScaleClientInstance(token) {
1281
+ const headers = planetScaleClientInstance.defaults.headers;
1270
1282
  if (token) {
1271
- planetScaleClientInstance.defaults.headers["Authorization"] = `${token}`;
1283
+ headers.Authorization = `${token}`;
1272
1284
  } else {
1273
- delete planetScaleClientInstance.defaults.headers["Authorization"];
1285
+ delete headers.Authorization;
1274
1286
  }
1275
1287
  }
1276
1288
 
@@ -1454,7 +1466,7 @@ var import_axios6 = __toESM(require("axios"));
1454
1466
  var sentryClientInstance = import_axios6.default.create({
1455
1467
  baseURL: "https://sentry.io/api/0/",
1456
1468
  headers: {
1457
- ["Content-Type"]: "application/json"
1469
+ "Content-Type": "application/json"
1458
1470
  }
1459
1471
  });
1460
1472
  sentryClientInstance.interceptors.response.use(
@@ -1463,7 +1475,7 @@ sentryClientInstance.interceptors.response.use(
1463
1475
  var _a;
1464
1476
  if (import_axios6.default.isAxiosError(error)) {
1465
1477
  if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
1466
- error = new UnauthorizeApiError("sentry");
1478
+ throw new UnauthorizeApiError("sentry");
1467
1479
  }
1468
1480
  }
1469
1481
  throw error;
@@ -1475,7 +1487,8 @@ function getSentryClientAuthorization(req) {
1475
1487
  };
1476
1488
  }
1477
1489
  function getSentryClientConfig(options = {}) {
1478
- const defaultAuthorization = sentryClientInstance.defaults.headers["Authorization"];
1490
+ const currentHeaders = sentryClientInstance.defaults.headers;
1491
+ const defaultAuthorization = currentHeaders.Authorization;
1479
1492
  const headers = {
1480
1493
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
1481
1494
  };
@@ -1493,10 +1506,11 @@ function initSentryClientInstance(token) {
1493
1506
  }
1494
1507
  }
1495
1508
  function updateSentryClientInstance(token) {
1509
+ const headers = sentryClientInstance.defaults.headers;
1496
1510
  if (token) {
1497
- sentryClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
1511
+ headers.Authorization = `Bearer ${token}`;
1498
1512
  } else {
1499
- delete sentryClientInstance.defaults.headers["Authorization"];
1513
+ delete headers.Authorization;
1500
1514
  }
1501
1515
  }
1502
1516
 
@@ -1629,7 +1643,7 @@ var sentryApi = {
1629
1643
  },
1630
1644
  createRepo(organizationSlug, projectId, repositoryFullName, repositoryBranch, githubIntegrationId, authorization) {
1631
1645
  return __async(this, null, function* () {
1632
- var _a, _b, _c, _d;
1646
+ var _a, _b;
1633
1647
  let repository;
1634
1648
  try {
1635
1649
  const response = yield sentryClientInstance.post(
@@ -1646,7 +1660,7 @@ var sentryApi = {
1646
1660
  repository = response.data;
1647
1661
  } catch (err) {
1648
1662
  const error = err;
1649
- if (((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.error_type) === "validation" || ((_d = (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.data) == null ? void 0 : _d.error_type) === "unknown") {
1663
+ if (((_a = error.response) == null ? void 0 : _a.data.error_type) === "validation" || ((_b = error.response) == null ? void 0 : _b.data.error_type) === "unknown") {
1650
1664
  throw error;
1651
1665
  }
1652
1666
  const response = yield sentryClientInstance.get(
@@ -1706,10 +1720,7 @@ var sentryApi = {
1706
1720
  );
1707
1721
  } catch (error) {
1708
1722
  if (((_a = error.response) == null ? void 0 : _a.status) === 409) {
1709
- return yield this.getProject(
1710
- `${organizationSlug}/${name}`,
1711
- authorization
1712
- );
1723
+ return this.getProject(`${organizationSlug}/${name}`, authorization);
1713
1724
  }
1714
1725
  throw error;
1715
1726
  }
@@ -1717,13 +1728,12 @@ var sentryApi = {
1717
1728
  },
1718
1729
  deleteProject(projectFullName, authorization) {
1719
1730
  return __async(this, null, function* () {
1720
- const response = yield sentryClientInstance.delete(
1731
+ yield sentryClientInstance.delete(
1721
1732
  `/projects/${projectFullName}/`,
1722
1733
  getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1723
1734
  ensureAuthorizationToken: true
1724
1735
  }))
1725
1736
  );
1726
- return response.data;
1727
1737
  });
1728
1738
  }
1729
1739
  };
@@ -1740,7 +1750,8 @@ function getTextClientAuthorization(req) {
1740
1750
  };
1741
1751
  }
1742
1752
  function getTextClientConfig(option = {}) {
1743
- const defaultAuthorization = textClientInstance.defaults.headers["Authorization"];
1753
+ const currentHeaders = textClientInstance.defaults.headers;
1754
+ const defaultAuthorization = currentHeaders.Authorization;
1744
1755
  const headers = {
1745
1756
  authorization: defaultAuthorization != null ? defaultAuthorization : option.token ? `Bearer ${option.token}` : void 0
1746
1757
  };
@@ -1749,29 +1760,145 @@ function getTextClientConfig(option = {}) {
1749
1760
  };
1750
1761
  }
1751
1762
  function initTextClientInstance(baseUrl, token) {
1763
+ const headers = textClientInstance.defaults.headers;
1752
1764
  if (baseUrl) {
1753
1765
  textClientInstance.interceptors.request.use(
1754
- (config) => __async(this, null, function* () {
1766
+ (config) => {
1755
1767
  config.baseURL = baseUrl;
1756
1768
  return config;
1757
- }),
1769
+ },
1758
1770
  (error) => Promise.reject(error)
1759
1771
  );
1760
1772
  }
1761
1773
  if (token) {
1762
- textClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
1774
+ headers.Authorization = `Bearer ${token}`;
1763
1775
  } else {
1764
- delete textClientInstance.defaults.headers["Authorization"];
1776
+ delete headers.Authorization;
1765
1777
  }
1766
1778
  }
1767
1779
 
1768
- // src/apis/integrations/text/uptime/api.ts
1769
- var textUptimeApi = {
1770
- getAppUptimeReports(appId, payload, authorization) {
1780
+ // src/apis/integrations/text/app/monitoring/events/api.ts
1781
+ var textAppMonitoringEventsApi = {
1782
+ getEvent(appId, eventKey, authorization) {
1783
+ return __async(this, null, function* () {
1784
+ try {
1785
+ const response = yield textClientInstance.get(
1786
+ `/app_monitoring/${appId}/events/${eventKey}`,
1787
+ getTextClientConfig(authorization)
1788
+ );
1789
+ return response.data;
1790
+ } catch (error) {
1791
+ if (error instanceof Error) {
1792
+ throw new Error(`Couldn't load event. [${error.message}]`);
1793
+ }
1794
+ throw error;
1795
+ }
1796
+ });
1797
+ },
1798
+ getEvents(appId, authorization) {
1799
+ return __async(this, null, function* () {
1800
+ try {
1801
+ const response = yield textClientInstance.get(
1802
+ `/app_monitoring/${appId}/events`,
1803
+ getTextClientConfig(authorization)
1804
+ );
1805
+ return response.data;
1806
+ } catch (error) {
1807
+ if (error instanceof Error) {
1808
+ throw new Error(`Couldn't load events. [${error.message}]`);
1809
+ }
1810
+ throw error;
1811
+ }
1812
+ });
1813
+ },
1814
+ upsertEvent(appId, event, authorization) {
1815
+ return __async(this, null, function* () {
1816
+ try {
1817
+ yield textClientInstance.post(
1818
+ `/app_monitoring/${appId}/events/${event.key}`,
1819
+ event,
1820
+ getTextClientConfig(authorization)
1821
+ );
1822
+ } catch (error) {
1823
+ if (error instanceof Error) {
1824
+ throw new Error(`Couldn't upsert event. [${error.message}]`);
1825
+ }
1826
+ throw error;
1827
+ }
1828
+ });
1829
+ },
1830
+ deleteEvent(appId, eventKey, authorization) {
1831
+ return __async(this, null, function* () {
1832
+ try {
1833
+ yield textClientInstance.delete(
1834
+ `/app_monitoring/${appId}/events/${eventKey}`,
1835
+ getTextClientConfig(authorization)
1836
+ );
1837
+ } catch (error) {
1838
+ if (error instanceof Error) {
1839
+ throw new Error(`Couldn't delete event. [${error.message}]`);
1840
+ }
1841
+ throw error;
1842
+ }
1843
+ });
1844
+ },
1845
+ sendEvent(appId, data, authorization) {
1846
+ return __async(this, null, function* () {
1847
+ try {
1848
+ yield textClientInstance.post(
1849
+ `/app_monitoring/${appId}/events`,
1850
+ data,
1851
+ getTextClientConfig(authorization)
1852
+ );
1853
+ } catch (error) {
1854
+ if (error instanceof Error) {
1855
+ throw new Error(`Couldn't send events. [${error.message}]`);
1856
+ }
1857
+ throw error;
1858
+ }
1859
+ });
1860
+ },
1861
+ getEventsLog(appId, payload, authorization) {
1862
+ return __async(this, null, function* () {
1863
+ var _a, _b;
1864
+ try {
1865
+ const searchParams = new URLSearchParams({
1866
+ from: (_a = payload.from) != null ? _a : "",
1867
+ search: (_b = payload.search) != null ? _b : ""
1868
+ });
1869
+ if (payload.type) {
1870
+ payload.type.forEach((type) => {
1871
+ searchParams.append("type[]", type);
1872
+ });
1873
+ }
1874
+ const response = yield textClientInstance.get(
1875
+ `/app_monitoring/${appId}/events?${searchParams.toString()}`,
1876
+ // v1
1877
+ // `/app_monitoring/${appId}/events/logs?${searchParams.toString()}`, // v2
1878
+ getTextClientConfig(authorization)
1879
+ );
1880
+ return response.data;
1881
+ } catch (error) {
1882
+ if (error instanceof Error) {
1883
+ throw new Error(`Couldn't load events log. [${error.message}]`);
1884
+ }
1885
+ throw error;
1886
+ }
1887
+ });
1888
+ }
1889
+ };
1890
+
1891
+ // src/apis/integrations/text/app/monitoring/reports/api.ts
1892
+ var textAppMonitoringReportsApi = {
1893
+ getUptimeReports(appId, payload, authorization) {
1771
1894
  return __async(this, null, function* () {
1772
1895
  try {
1773
1896
  const response = yield textClientInstance.get(
1774
- `/app_monitoring/${appId}/reports/uptime?from=${payload.from}&to=${payload.to}&resolution=${payload.resolution}`,
1897
+ `/app_monitoring/${appId}/reports/uptime?${new URLSearchParams({
1898
+ from: payload.from,
1899
+ to: payload.to,
1900
+ resolution: payload.resolution
1901
+ }).toString()}`,
1775
1902
  getTextClientConfig(authorization)
1776
1903
  );
1777
1904
  return response.data;
@@ -1782,12 +1909,138 @@ var textUptimeApi = {
1782
1909
  throw error;
1783
1910
  }
1784
1911
  });
1912
+ },
1913
+ getEventReports(appId, payload, authorization) {
1914
+ return __async(this, null, function* () {
1915
+ try {
1916
+ const response = yield textClientInstance.get(
1917
+ `/app_monitoring/${appId}/reports/events?${new URLSearchParams({
1918
+ from: payload.from,
1919
+ to: payload.to,
1920
+ resolution: payload.resolution
1921
+ }).toString()}`,
1922
+ getTextClientConfig(authorization)
1923
+ );
1924
+ return response.data;
1925
+ } catch (error) {
1926
+ if (error instanceof Error) {
1927
+ throw new Error(`Couldn't load event reports. [${error.message}]`);
1928
+ }
1929
+ throw error;
1930
+ }
1931
+ });
1932
+ },
1933
+ getCustomReport(appId, customReportId, authorization) {
1934
+ return __async(this, null, function* () {
1935
+ try {
1936
+ const response = yield textClientInstance.get(
1937
+ `/app_monitoring/${appId}/reports/custom/${customReportId}`,
1938
+ getTextClientConfig(authorization)
1939
+ );
1940
+ return response.data;
1941
+ } catch (error) {
1942
+ if (error instanceof Error) {
1943
+ throw new Error(`Couldn't load custom report. [${error.message}]`);
1944
+ }
1945
+ throw error;
1946
+ }
1947
+ });
1948
+ },
1949
+ getCustomReportData(appId, customReportId, authorization) {
1950
+ return __async(this, null, function* () {
1951
+ try {
1952
+ const response = yield textClientInstance.get(
1953
+ `/app_monitoring/${appId}/reports/custom/${customReportId}/data`,
1954
+ getTextClientConfig(authorization)
1955
+ );
1956
+ return response.data;
1957
+ } catch (error) {
1958
+ if (error instanceof Error) {
1959
+ throw new Error(`Couldn't load custom report data. [${error.message}]`);
1960
+ }
1961
+ throw error;
1962
+ }
1963
+ });
1964
+ },
1965
+ getCustomReports(appId, authorization) {
1966
+ return __async(this, null, function* () {
1967
+ try {
1968
+ const response = yield textClientInstance.get(
1969
+ `/app_monitoring/${appId}/reports/custom`,
1970
+ getTextClientConfig(authorization)
1971
+ );
1972
+ return response.data;
1973
+ } catch (error) {
1974
+ if (error instanceof Error) {
1975
+ throw new Error(`Couldn't load custom reports. [${error.message}]`);
1976
+ }
1977
+ throw error;
1978
+ }
1979
+ });
1980
+ },
1981
+ createCustomReport(appId, customReport, authorization) {
1982
+ return __async(this, null, function* () {
1983
+ try {
1984
+ yield textClientInstance.post(
1985
+ `/app_monitoring/${appId}/reports/custom`,
1986
+ customReport,
1987
+ getTextClientConfig(authorization)
1988
+ );
1989
+ } catch (error) {
1990
+ if (error instanceof Error) {
1991
+ throw new Error(`Couldn't create custom report. [${error.message}]`);
1992
+ }
1993
+ throw error;
1994
+ }
1995
+ });
1996
+ },
1997
+ updateCustomReport(appId, customReport, authorization) {
1998
+ return __async(this, null, function* () {
1999
+ try {
2000
+ yield textClientInstance.post(
2001
+ `/app_monitoring/${appId}/reports/custom/${customReport.id}`,
2002
+ customReport,
2003
+ getTextClientConfig(authorization)
2004
+ );
2005
+ } catch (error) {
2006
+ if (error instanceof Error) {
2007
+ throw new Error(`Couldn't update custom report. [${error.message}]`);
2008
+ }
2009
+ throw error;
2010
+ }
2011
+ });
2012
+ },
2013
+ deleteCustomReport(appId, customReportId, authorization) {
2014
+ return __async(this, null, function* () {
2015
+ try {
2016
+ yield textClientInstance.delete(
2017
+ `/app_monitoring/${appId}/reports/custom/${customReportId}`,
2018
+ getTextClientConfig(authorization)
2019
+ );
2020
+ } catch (error) {
2021
+ if (error instanceof Error) {
2022
+ throw new Error(`Couldn't delete custom report. [${error.message}]`);
2023
+ }
2024
+ throw error;
2025
+ }
2026
+ });
1785
2027
  }
1786
2028
  };
1787
2029
 
2030
+ // src/apis/integrations/text/app/monitoring/api.ts
2031
+ var textAppMonitoringApi = {
2032
+ events: textAppMonitoringEventsApi,
2033
+ reports: textAppMonitoringReportsApi
2034
+ };
2035
+
2036
+ // src/apis/integrations/text/app/api.ts
2037
+ var textAppApi = {
2038
+ monitoring: textAppMonitoringApi
2039
+ };
2040
+
1788
2041
  // src/apis/integrations/text/api.ts
1789
2042
  var textApi = {
1790
- uptime: textUptimeApi
2043
+ app: textAppApi
1791
2044
  };
1792
2045
 
1793
2046
  // src/apis/integrations/vercel/api.ts
@@ -1804,7 +2057,7 @@ vercelClientInstance.interceptors.response.use(
1804
2057
  var _a;
1805
2058
  if (import_axios8.default.isAxiosError(error)) {
1806
2059
  if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
1807
- error = new UnauthorizeApiError("vercel");
2060
+ throw new UnauthorizeApiError("vercel");
1808
2061
  }
1809
2062
  }
1810
2063
  throw error;
@@ -1816,7 +2069,8 @@ function getVercelClientAuthorization(req) {
1816
2069
  };
1817
2070
  }
1818
2071
  function getVercelClientConfig(options = {}) {
1819
- const defaultAuthorization = vercelClientInstance.defaults.headers["Authorization"];
2072
+ const currentHeaders = vercelClientInstance.defaults.headers;
2073
+ const defaultAuthorization = currentHeaders.Authorization;
1820
2074
  const headers = {
1821
2075
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
1822
2076
  };
@@ -1833,10 +2087,11 @@ function initVercelClientInstance(token) {
1833
2087
  }
1834
2088
  }
1835
2089
  function updateVercelClientInstance(token) {
2090
+ const headers = vercelClientInstance.defaults.headers;
1836
2091
  if (token) {
1837
- vercelClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
2092
+ headers.Authorization = `Bearer ${token}`;
1838
2093
  } else {
1839
- delete vercelClientInstance.defaults.headers["Authorization"];
2094
+ delete headers.Authorization;
1840
2095
  }
1841
2096
  }
1842
2097
 
@@ -1879,7 +2134,7 @@ var vercelIntegrationApi = {
1879
2134
  var _a;
1880
2135
  try {
1881
2136
  const response = yield vercelClientInstance.get(
1882
- `/v1/integrations/search-repo?provider=github${repositoryName ? "&query=" + repositoryName : ""}${namespaceId ? "&namespaceId=" + namespaceId : ""}`,
2137
+ `/v1/integrations/search-repo?provider=github${repositoryName ? `&query=${repositoryName}` : ""}${namespaceId ? `&namespaceId=${namespaceId}` : ""}`,
1883
2138
  getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
1884
2139
  ensureAuthorizationToken: true
1885
2140
  }))
@@ -1902,7 +2157,6 @@ var vercelIntegrationApi = {
1902
2157
  },
1903
2158
  isRepositoryAccessible(repositoryName, authorization) {
1904
2159
  return __async(this, null, function* () {
1905
- var _a;
1906
2160
  try {
1907
2161
  const namespaces = yield this.getGitNamespaces(authorization);
1908
2162
  const accessibleNamespaceId = namespaces.length > 0 ? (yield Promise.all(
@@ -1911,9 +2165,9 @@ var vercelIntegrationApi = {
1911
2165
  )
1912
2166
  )).map(
1913
2167
  (repositories) => repositories.repos.length > 0 ? repositories.namespaceId : void 0
1914
- )[0] : (_a = yield this.getGitRepos(repositoryName, void 0, authorization)) == null ? void 0 : _a.namespaceId;
2168
+ )[0] : (yield this.getGitRepos(repositoryName, void 0, authorization)).namespaceId;
1915
2169
  return {
1916
- isAccessible: !!accessibleNamespaceId,
2170
+ isAccessible: Boolean(accessibleNamespaceId),
1917
2171
  installationId: accessibleNamespaceId
1918
2172
  };
1919
2173
  } catch (err) {
@@ -2020,15 +2274,16 @@ var vercelProjectApi = {
2020
2274
  getProjectEnvByKey(projectId, envKey, authorization) {
2021
2275
  return __async(this, null, function* () {
2022
2276
  const envs = yield this.getProjectEnvs(projectId, authorization);
2023
- const env = envs.find((env2) => envKey === env2.key);
2277
+ const env = envs.find((innerEnv) => envKey === innerEnv.key);
2024
2278
  if (!env) {
2025
2279
  return;
2026
2280
  }
2027
- return yield this.getProjectEnv(projectId, env.id, authorization);
2281
+ return this.getProjectEnv(projectId, env.id, authorization);
2028
2282
  });
2029
2283
  },
2030
- createProjectEnv(projectId, key, value, envs, authorization) {
2284
+ createProjectEnv(projectId, key, value, projectEnvs, authorization) {
2031
2285
  return __async(this, null, function* () {
2286
+ let envs = projectEnvs;
2032
2287
  if (!envs) {
2033
2288
  const response = yield vercelClientInstance.get(`/v9/projects/${projectId}/env`, getVercelClientConfig(authorization));
2034
2289
  envs = response.data.envs;
@@ -2036,7 +2291,7 @@ var vercelProjectApi = {
2036
2291
  const existingEnv = envs.find((env) => env.key === key);
2037
2292
  if (existingEnv) {
2038
2293
  const { data: editedEnv } = yield vercelClientInstance.patch(
2039
- `/v9/projects/${projectId}/env/${existingEnv == null ? void 0 : existingEnv.id}`,
2294
+ `/v9/projects/${projectId}/env/${existingEnv.id}`,
2040
2295
  {
2041
2296
  key,
2042
2297
  value,
@@ -2048,32 +2303,30 @@ var vercelProjectApi = {
2048
2303
  }))
2049
2304
  );
2050
2305
  return editedEnv;
2051
- } else {
2052
- const { data: createdEnv } = yield vercelClientInstance.post(
2053
- `/v9/projects/${projectId}/env`,
2054
- {
2055
- key,
2056
- value,
2057
- type: "encrypted",
2058
- target: ["production", "preview", "development"]
2059
- },
2060
- getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
2061
- ensureAuthorizationToken: true
2062
- }))
2063
- );
2064
- return createdEnv;
2065
2306
  }
2307
+ const { data: createdEnv } = yield vercelClientInstance.post(
2308
+ `/v9/projects/${projectId}/env`,
2309
+ {
2310
+ key,
2311
+ value,
2312
+ type: "encrypted",
2313
+ target: ["production", "preview", "development"]
2314
+ },
2315
+ getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
2316
+ ensureAuthorizationToken: true
2317
+ }))
2318
+ );
2319
+ return createdEnv;
2066
2320
  });
2067
2321
  },
2068
2322
  removeProjectEnv(projectId, envId, authorization) {
2069
2323
  return __async(this, null, function* () {
2070
- const response = yield vercelClientInstance.delete(
2324
+ yield vercelClientInstance.delete(
2071
2325
  `/v9/projects/${projectId}/env/${envId}`,
2072
2326
  getVercelClientConfig(__spreadProps(__spreadValues({}, authorization), {
2073
2327
  ensureAuthorizationToken: true
2074
2328
  }))
2075
2329
  );
2076
- return response.data;
2077
2330
  });
2078
2331
  }
2079
2332
  };
@@ -2091,15 +2344,11 @@ var vercelApi = {
2091
2344
  client_secret: clientSecret,
2092
2345
  redirect_uri: redirectUrl
2093
2346
  });
2094
- const response = yield import_axios9.default.post(
2095
- "https://api.vercel.com/v2/oauth/access_token",
2096
- data,
2097
- {
2098
- headers: {
2099
- "Content-Type": "application/x-www-form-urlencoded"
2100
- }
2347
+ const response = yield import_axios9.default.post("https://api.vercel.com/v2/oauth/access_token", data, {
2348
+ headers: {
2349
+ "Content-Type": "application/x-www-form-urlencoded"
2101
2350
  }
2102
- );
2351
+ });
2103
2352
  return {
2104
2353
  token: response.data.access_token,
2105
2354
  installationId: response.data.installation_id,
@@ -2134,7 +2383,6 @@ var getRegion = (token) => {
2134
2383
  if (supportedRegions.includes(region)) {
2135
2384
  return region;
2136
2385
  }
2137
- return void 0;
2138
2386
  };
2139
2387
  var livechatClientInstance = import_axios10.default.create({
2140
2388
  baseURL: "https://api.labs.livechatinc.com"
@@ -2145,7 +2393,8 @@ function getLiveChatClientAuthorization(req) {
2145
2393
  };
2146
2394
  }
2147
2395
  function getLiveChatClientConfig(options = {}) {
2148
- const defaultAuthorization = livechatClientInstance.defaults.headers["Authorization"];
2396
+ const currentHeaders = livechatClientInstance.defaults.headers;
2397
+ const defaultAuthorization = currentHeaders.Authorization;
2149
2398
  const headers = {
2150
2399
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
2151
2400
  };
@@ -2155,22 +2404,23 @@ function getLiveChatClientConfig(options = {}) {
2155
2404
  }
2156
2405
  function initLiveChatClientInstance(baseUrl, token) {
2157
2406
  const region = token ? getRegion(token) : void 0;
2407
+ const headers = livechatClientInstance.defaults.headers;
2158
2408
  if (baseUrl) {
2159
2409
  livechatClientInstance.interceptors.request.use(
2160
- (config) => __async(this, null, function* () {
2410
+ (config) => {
2161
2411
  config.baseURL = baseUrl;
2162
2412
  return config;
2163
- }),
2413
+ },
2164
2414
  (error) => Promise.reject(error)
2165
2415
  );
2166
2416
  }
2167
2417
  if (region) {
2168
- livechatClientInstance.defaults.headers["X-Region"] = region;
2418
+ headers["X-Region"] = region;
2169
2419
  }
2170
2420
  if (token) {
2171
- livechatClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
2421
+ headers.Authorization = `Bearer ${token}`;
2172
2422
  } else {
2173
- delete livechatClientInstance.defaults.headers["Authorization"];
2423
+ delete headers.Authorization;
2174
2424
  }
2175
2425
  }
2176
2426
 
@@ -2318,7 +2568,7 @@ var livechatPropertyApi = {
2318
2568
  try {
2319
2569
  const response = yield Promise.all(
2320
2570
  properties.filter((property) => property.public_access).map((property) => __async(this, null, function* () {
2321
- return yield livechatClientInstance.post(
2571
+ return livechatClientInstance.post(
2322
2572
  `/v3.3/configuration/action/publish_property`,
2323
2573
  {
2324
2574
  name: property.name,
@@ -2343,7 +2593,7 @@ var livechatPropertyApi = {
2343
2593
  try {
2344
2594
  const response = yield Promise.all(
2345
2595
  properties.map((property) => __async(this, null, function* () {
2346
- return yield livechatClientInstance.post(
2596
+ return livechatClientInstance.post(
2347
2597
  `/v3.3/configuration/action/register_property`,
2348
2598
  {
2349
2599
  name: property.name,
@@ -2374,7 +2624,7 @@ var livechatPropertyApi = {
2374
2624
  yield Promise.all(
2375
2625
  Object.keys(properties).map((property) => __async(this, null, function* () {
2376
2626
  if (Object.keys(properties[property]).indexOf("public_access") <= 0) {
2377
- return yield livechatClientInstance.post(
2627
+ return livechatClientInstance.post(
2378
2628
  `/v3.3/configuration/action/unregister_property`,
2379
2629
  {
2380
2630
  name: property,
@@ -2451,7 +2701,7 @@ var livechatWebhookApi = {
2451
2701
  const { data: webhooks } = yield this.getWebhooks(clientId);
2452
2702
  yield Promise.all(
2453
2703
  webhooks.map((webhook) => __async(this, null, function* () {
2454
- return yield livechatClientInstance.post(
2704
+ return livechatClientInstance.post(
2455
2705
  `/v3.5/configuration/action/unregister_webhook`,
2456
2706
  {
2457
2707
  id: webhook.id,
@@ -2474,10 +2724,10 @@ var livechatWebhookApi = {
2474
2724
  registerWebhooks(webhooks) {
2475
2725
  return __async(this, null, function* () {
2476
2726
  try {
2477
- yield this.unregisterWebhooks(webhooks[0]["owner_client_id"]);
2727
+ yield this.unregisterWebhooks(webhooks[0].owner_client_id);
2478
2728
  yield Promise.all(
2479
2729
  webhooks.map((webhook) => __async(this, null, function* () {
2480
- return yield livechatClientInstance.post(
2730
+ return livechatClientInstance.post(
2481
2731
  `/v${webhook.api_version || "3.5"}/configuration/action/register_webhook`,
2482
2732
  {
2483
2733
  url: webhook.url,
@@ -2512,10 +2762,9 @@ var livechatWebhookApi = {
2512
2762
  filters: webhook.filters
2513
2763
  };
2514
2764
  });
2515
- const { data: verifiedWebhooks } = yield livechatClientInstance.post(
2516
- `/v3.3/configuration/action/check_webhooks_migration`,
2517
- [...webhooksToCheck]
2518
- );
2765
+ const { data: verifiedWebhooks } = yield livechatClientInstance.post(`/v3.3/configuration/action/check_webhooks_migration`, [
2766
+ ...webhooksToCheck
2767
+ ]);
2519
2768
  const updatedWebhooks = webhooks.map((webhook, index) => {
2520
2769
  return __spreadProps(__spreadValues({}, webhook), {
2521
2770
  action: verifiedWebhooks[index].action
@@ -2945,14 +3194,16 @@ function getPlatformDpsClientAuthorization(req) {
2945
3194
  };
2946
3195
  }
2947
3196
  function getPlatformDpsAdminClientAuthorization() {
2948
- const token = process.env.NEXT_PUBLIC_PLATFORM_ENV === "prod" ? process.env.PLATFORM_DPS_TOKEN_FOR_GITHUB : process.env.PLATFORM_DPS_TOKEN_FOR_GITHUB_LABS;
3197
+ var _a, _b;
3198
+ const token = process.env.NEXT_PUBLIC_PLATFORM_ENV === "prod" ? (_a = process.env.PLATFORM_DPS_TOKEN_FOR_GITHUB) != null ? _a : "" : (_b = process.env.PLATFORM_DPS_TOKEN_FOR_GITHUB_LABS) != null ? _b : "";
2949
3199
  return {
2950
- token: btoa("apps@livechatinc.com:" + token),
3200
+ token: btoa(`apps@livechatinc.com:${token}`),
2951
3201
  tokenType: "Basic"
2952
3202
  };
2953
3203
  }
2954
3204
  function getPlatformDpsClientConfig(options = {}) {
2955
- const defaultAuthorization = platformDpsClientInstance.defaults.headers["Authorization"];
3205
+ const currentHeaders = platformDpsClientInstance.defaults.headers;
3206
+ const defaultAuthorization = currentHeaders.Authorization;
2956
3207
  const headers = {
2957
3208
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
2958
3209
  };
@@ -2961,19 +3212,20 @@ function getPlatformDpsClientConfig(options = {}) {
2961
3212
  };
2962
3213
  }
2963
3214
  function initPlatformDpsClientInstance(baseUrl, token) {
3215
+ const headers = platformDpsClientInstance.defaults.headers;
2964
3216
  if (baseUrl) {
2965
3217
  platformDpsClientInstance.interceptors.request.use(
2966
- (config) => __async(this, null, function* () {
3218
+ (config) => {
2967
3219
  config.baseURL = baseUrl;
2968
3220
  return config;
2969
- }),
3221
+ },
2970
3222
  (error) => Promise.reject(error)
2971
3223
  );
2972
3224
  }
2973
3225
  if (token) {
2974
- platformDpsClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
3226
+ headers.Authorization = `Bearer ${token}`;
2975
3227
  } else {
2976
- delete platformDpsClientInstance.defaults.headers["Authorization"];
3228
+ delete headers.Authorization;
2977
3229
  }
2978
3230
  }
2979
3231
 
@@ -3378,17 +3630,16 @@ var platformDpsApplicationInfrastructureBlocksApi = {
3378
3630
  },
3379
3631
  updateBlocks(appId, payload, authorization) {
3380
3632
  return __async(this, null, function* () {
3381
- const response = yield platformDpsClientInstance.patch(
3633
+ yield platformDpsClientInstance.patch(
3382
3634
  `/v2/applications/${appId}/infrastructure/blocks`,
3383
3635
  payload,
3384
3636
  getPlatformDpsClientConfig(authorization)
3385
3637
  );
3386
- return response.data;
3387
3638
  });
3388
3639
  },
3389
3640
  updateRepository(appId, payload, authorization) {
3390
3641
  return __async(this, null, function* () {
3391
- const response = yield platformDpsClientInstance.patch(
3642
+ yield platformDpsClientInstance.patch(
3392
3643
  `/v2/applications/${appId}/infrastructure/blocks`,
3393
3644
  {
3394
3645
  appId,
@@ -3398,13 +3649,12 @@ var platformDpsApplicationInfrastructureBlocksApi = {
3398
3649
  },
3399
3650
  getPlatformDpsClientConfig(authorization)
3400
3651
  );
3401
- return response.data;
3402
3652
  });
3403
3653
  },
3404
3654
  updateDeployment(appId, payload, authorization) {
3405
3655
  return __async(this, null, function* () {
3406
3656
  const config = payload.customUrl ? { custom: { url: payload.customUrl } } : { custom: null };
3407
- const response = yield platformDpsClientInstance.patch(
3657
+ yield platformDpsClientInstance.patch(
3408
3658
  `/v2/applications/${appId}/infrastructure/blocks`,
3409
3659
  {
3410
3660
  appId,
@@ -3416,12 +3666,11 @@ var platformDpsApplicationInfrastructureBlocksApi = {
3416
3666
  },
3417
3667
  getPlatformDpsClientConfig(authorization)
3418
3668
  );
3419
- return response.data;
3420
3669
  });
3421
3670
  },
3422
3671
  updateStorage(appId, payload, authorization) {
3423
3672
  return __async(this, null, function* () {
3424
- const response = yield platformDpsClientInstance.patch(
3673
+ yield platformDpsClientInstance.patch(
3425
3674
  `/v2/applications/${appId}/infrastructure/blocks`,
3426
3675
  {
3427
3676
  appId,
@@ -3431,12 +3680,11 @@ var platformDpsApplicationInfrastructureBlocksApi = {
3431
3680
  },
3432
3681
  getPlatformDpsClientConfig(authorization)
3433
3682
  );
3434
- return response.data;
3435
3683
  });
3436
3684
  },
3437
3685
  updateLogger(appId, payload, authorization) {
3438
3686
  return __async(this, null, function* () {
3439
- const response = yield platformDpsClientInstance.post(
3687
+ yield platformDpsClientInstance.post(
3440
3688
  `/v2/applications/${appId}/infrastructure/blocks`,
3441
3689
  {
3442
3690
  appId,
@@ -3446,7 +3694,6 @@ var platformDpsApplicationInfrastructureBlocksApi = {
3446
3694
  },
3447
3695
  getPlatformDpsClientConfig(authorization)
3448
3696
  );
3449
- return response.data;
3450
3697
  });
3451
3698
  }
3452
3699
  };
@@ -3638,19 +3885,6 @@ var platformDpsApplicationCustomPropsApi = {
3638
3885
  }
3639
3886
  };
3640
3887
 
3641
- // src/apis/platform/dps/applications/application/reporting/api.ts
3642
- var platformDpsApplicationReportingApi = {
3643
- sendEvent(appId, event, authorization) {
3644
- return __async(this, null, function* () {
3645
- yield platformDpsClientInstance.post(
3646
- `/apps/${appId}/events`,
3647
- event,
3648
- getPlatformDpsClientConfig(authorization)
3649
- );
3650
- });
3651
- }
3652
- };
3653
-
3654
3888
  // src/apis/platform/dps/applications/application/resources/api.ts
3655
3889
  var platformDpsApplicationResourcesApi = {
3656
3890
  getAppUpgrades(appId, authorization) {
@@ -3918,7 +4152,6 @@ var platformDpsApplicationApi = {
3918
4152
  onboarding: platformDpsApplicationOnboardingApi,
3919
4153
  payment: platformDpsApplicationPaymentApi,
3920
4154
  product: platformDpsApplicationProductApi,
3921
- reporting: platformDpsApplicationReportingApi,
3922
4155
  resource: platformDpsApplicationResourcesApi,
3923
4156
  review: platformDpsApplicationReviewApi,
3924
4157
  webhooks: platformDpsApplicationWebhooksApi,
@@ -4168,8 +4401,8 @@ var platformDpsDeveloperApi = {
4168
4401
  return __async(this, null, function* () {
4169
4402
  try {
4170
4403
  const { startAt, endAt, size, page } = options;
4171
- const withRange = !!(startAt && endAt);
4172
- const withPagination = !!(size && typeof page === "number");
4404
+ const withRange = Boolean(startAt && endAt);
4405
+ const withPagination = Boolean(size && typeof page === "number");
4173
4406
  let params = withRange || withPagination ? `?` : "";
4174
4407
  if (withRange) {
4175
4408
  params += `from=${startAt}&to=${endAt}`;
@@ -4349,7 +4582,7 @@ var dpsResearchDictionaryApi = {
4349
4582
  try {
4350
4583
  const params = new URLSearchParams(options);
4351
4584
  const response = yield platformDpsClientInstance.get(
4352
- `/v2/research/dictionary?${params}`,
4585
+ `/v2/research/dictionary?${params.toString()}`,
4353
4586
  getPlatformDpsClientConfig(authorization)
4354
4587
  );
4355
4588
  return response.data;
@@ -4372,7 +4605,7 @@ var dpsResearchMarketplaceApi = {
4372
4605
  try {
4373
4606
  const params = new URLSearchParams(options);
4374
4607
  const response = yield platformDpsClientInstance.get(
4375
- `/v2/research/marketplace/apps?${params}`,
4608
+ `/v2/research/marketplace/apps?${params.toString()}`,
4376
4609
  getPlatformDpsClientConfig(authorization)
4377
4610
  );
4378
4611
  return response.data;
@@ -4391,7 +4624,7 @@ var dpsResearchMarketplaceApi = {
4391
4624
  try {
4392
4625
  const params = new URLSearchParams(options);
4393
4626
  const response = yield platformDpsClientInstance.get(
4394
- `/v2/research/marketplace/views?${params}`,
4627
+ `/v2/research/marketplace/views?${params.toString()}`,
4395
4628
  getPlatformDpsClientConfig(authorization)
4396
4629
  );
4397
4630
  return response.data;
@@ -4414,7 +4647,7 @@ var dpsResearchTrafficApi = {
4414
4647
  try {
4415
4648
  const params = new URLSearchParams(options);
4416
4649
  const response = yield platformDpsClientInstance.get(
4417
- `/v2/research/traffic/agents?${params}`,
4650
+ `/v2/research/traffic/agents?${params.toString()}`,
4418
4651
  getPlatformDpsClientConfig(authorization)
4419
4652
  );
4420
4653
  return response.data;
@@ -4433,7 +4666,7 @@ var dpsResearchTrafficApi = {
4433
4666
  try {
4434
4667
  const params = new URLSearchParams(options);
4435
4668
  const response = yield platformDpsClientInstance.get(
4436
- `/v2/research/traffic/chats?${params}`,
4669
+ `/v2/research/traffic/chats?${params.toString()}`,
4437
4670
  getPlatformDpsClientConfig(authorization)
4438
4671
  );
4439
4672
  return response.data;
@@ -4489,35 +4722,29 @@ var platformDpsUserApi = {
4489
4722
  },
4490
4723
  updateUserIntegrations(payload, authorization) {
4491
4724
  return __async(this, null, function* () {
4492
- const response = yield platformDpsClientInstance.patch(
4725
+ yield platformDpsClientInstance.patch(
4493
4726
  `/v2/me/integrations`,
4494
4727
  payload,
4495
4728
  getPlatformDpsClientConfig(authorization)
4496
4729
  );
4497
- return response.data;
4498
4730
  });
4499
4731
  },
4500
4732
  updateUserFeatures(payload, authorization) {
4501
4733
  return __async(this, null, function* () {
4502
- const response = yield platformDpsClientInstance.put(
4734
+ yield platformDpsClientInstance.put(
4503
4735
  "/v2/features",
4504
4736
  payload,
4505
4737
  getPlatformDpsClientConfig(authorization)
4506
4738
  );
4507
- return response.data;
4508
4739
  });
4509
4740
  },
4510
4741
  removeUserGitHubIntegrationByInstallationId(installationId, authorization) {
4511
4742
  return __async(this, null, function* () {
4512
- const response = yield platformDpsClientInstance.delete(
4513
- `/v2/me/integrations/github`,
4514
- __spreadProps(__spreadValues({}, getPlatformDpsClientConfig(authorization)), {
4515
- data: {
4516
- githubInstallationId: installationId
4517
- }
4518
- })
4519
- );
4520
- return response.data;
4743
+ yield platformDpsClientInstance.delete(`/v2/me/integrations/github`, __spreadProps(__spreadValues({}, getPlatformDpsClientConfig(authorization)), {
4744
+ data: {
4745
+ githubInstallationId: installationId
4746
+ }
4747
+ }));
4521
4748
  });
4522
4749
  },
4523
4750
  updateUserNetlifyIntegration(userNetlifyIntegration, authorization) {
@@ -4571,8 +4798,11 @@ platformAdapterClientInstance.interceptors.response.use(
4571
4798
  (error) => {
4572
4799
  var _a;
4573
4800
  if (import_axios13.default.isAxiosError(error)) {
4574
- if (((_a = error.response) == null ? void 0 : _a.status) === 401 && error.response.data.error.source) {
4575
- error = new UnauthorizeApiError(error.response.data.error.source);
4801
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
4802
+ const source = error.response.data.error.source;
4803
+ if (source) {
4804
+ throw new UnauthorizeApiError(source);
4805
+ }
4576
4806
  }
4577
4807
  }
4578
4808
  throw error;
@@ -4580,19 +4810,20 @@ platformAdapterClientInstance.interceptors.response.use(
4580
4810
  );
4581
4811
  function getPlatformAdapterClientConfig(options = {}) {
4582
4812
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
4813
+ const currentHeaders = platformAdapterClientInstance.defaults.headers;
4583
4814
  const headers = {
4584
4815
  platform: {
4585
- dps: (_b = platformAdapterClientInstance.defaults.headers["platform-dps-token"]) != null ? _b : (_a = options.platform) == null ? void 0 : _a.dps
4816
+ dps: (_b = currentHeaders["platform-dps-token"]) != null ? _b : (_a = options.platform) == null ? void 0 : _a.dps
4586
4817
  },
4587
4818
  integrations: {
4588
4819
  github: {
4589
- app: (_d = platformAdapterClientInstance.defaults.headers["github-app-token"]) != null ? _d : (_c = options.github) == null ? void 0 : _c.app,
4590
- oauth: (_f = platformAdapterClientInstance.defaults.headers["github-oauth-token"]) != null ? _f : (_e = options.github) == null ? void 0 : _e.oauth
4820
+ app: (_d = currentHeaders["github-app-token"]) != null ? _d : (_c = options.github) == null ? void 0 : _c.app,
4821
+ oauth: (_f = currentHeaders["github-oauth-token"]) != null ? _f : (_e = options.github) == null ? void 0 : _e.oauth
4591
4822
  },
4592
- netlify: (_g = platformAdapterClientInstance.defaults.headers["netlify-token"]) != null ? _g : options.netlify,
4593
- vercel: (_h = platformAdapterClientInstance.defaults.headers["vercel-token"]) != null ? _h : options.vercel,
4594
- planetscale: (_i = platformAdapterClientInstance.defaults.headers["planetscale-token"]) != null ? _i : options.planetscale,
4595
- sentry: (_j = platformAdapterClientInstance.defaults.headers["sentry-token"]) != null ? _j : options.sentry
4823
+ netlify: (_g = currentHeaders["netlify-token"]) != null ? _g : options.netlify,
4824
+ vercel: (_h = currentHeaders["vercel-token"]) != null ? _h : options.vercel,
4825
+ planetscale: (_i = currentHeaders["planetscale-token"]) != null ? _i : options.planetscale,
4826
+ sentry: (_j = currentHeaders["sentry-token"]) != null ? _j : options.sentry
4596
4827
  }
4597
4828
  };
4598
4829
  if (((_l = (_k = options.ensureAuthorizationToken) == null ? void 0 : _k.platform) == null ? void 0 : _l.dps) && !headers.platform.dps) {
@@ -4620,10 +4851,10 @@ function getPlatformAdapterClientConfig(options = {}) {
4620
4851
  function initPlatformAdapterClientInstance(baseUrl, tokens) {
4621
4852
  if (baseUrl) {
4622
4853
  platformAdapterClientInstance.interceptors.request.use(
4623
- (config) => __async(this, null, function* () {
4854
+ (config) => {
4624
4855
  config.baseURL = baseUrl;
4625
4856
  return config;
4626
- }),
4857
+ },
4627
4858
  (error) => Promise.reject(error)
4628
4859
  );
4629
4860
  }
@@ -4633,26 +4864,27 @@ function initPlatformAdapterClientInstance(baseUrl, tokens) {
4633
4864
  }
4634
4865
  function updatePlatformAdapterClientInstance(tokens) {
4635
4866
  var _a;
4867
+ const headers = platformAdapterClientInstance.defaults.headers;
4636
4868
  if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.dps) {
4637
- platformAdapterClientInstance.defaults.headers["platform-dps-token"] = tokens.platform.dps;
4869
+ headers["platform-dps-token"] = tokens.platform.dps;
4638
4870
  }
4639
4871
  if (tokens == null ? void 0 : tokens.github.app) {
4640
- platformAdapterClientInstance.defaults.headers["github-app-token"] = tokens.github.app;
4872
+ headers["github-app-token"] = tokens.github.app;
4641
4873
  }
4642
4874
  if (tokens == null ? void 0 : tokens.github.oauth) {
4643
- platformAdapterClientInstance.defaults.headers["github-oauth-token"] = tokens.github.oauth;
4875
+ headers["github-oauth-token"] = tokens.github.oauth;
4644
4876
  }
4645
4877
  if (tokens == null ? void 0 : tokens.netlify) {
4646
- platformAdapterClientInstance.defaults.headers["netlify-token"] = tokens.netlify;
4878
+ headers["netlify-token"] = tokens.netlify;
4647
4879
  }
4648
4880
  if (tokens == null ? void 0 : tokens.vercel) {
4649
- platformAdapterClientInstance.defaults.headers["vercel-token"] = tokens.vercel;
4881
+ headers["vercel-token"] = tokens.vercel;
4650
4882
  }
4651
4883
  if (tokens == null ? void 0 : tokens.planetscale) {
4652
- platformAdapterClientInstance.defaults.headers["planetscale-token"] = tokens.planetscale;
4884
+ headers["planetscale-token"] = tokens.planetscale;
4653
4885
  }
4654
4886
  if (tokens == null ? void 0 : tokens.sentry) {
4655
- platformAdapterClientInstance.defaults.headers["sentry-token"] = tokens.sentry;
4887
+ headers["sentry-token"] = tokens.sentry;
4656
4888
  }
4657
4889
  }
4658
4890
 
@@ -4691,7 +4923,7 @@ var platformAdapterAppDeploymentApi = {
4691
4923
  },
4692
4924
  unlink(payload, authorization) {
4693
4925
  return __async(this, null, function* () {
4694
- const response = yield platformAdapterClientInstance.post(
4926
+ yield platformAdapterClientInstance.post(
4695
4927
  `/console/app/${payload.appId}/blocks/deployment/unlink`,
4696
4928
  payload,
4697
4929
  getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -4702,12 +4934,11 @@ var platformAdapterAppDeploymentApi = {
4702
4934
  }
4703
4935
  }))
4704
4936
  );
4705
- return response.data;
4706
4937
  });
4707
4938
  },
4708
4939
  installSentry(appId, authorization) {
4709
4940
  return __async(this, null, function* () {
4710
- const response = yield platformAdapterClientInstance.post(
4941
+ yield platformAdapterClientInstance.post(
4711
4942
  `/console/app/${appId}/blocks/deployment/install/sentry`,
4712
4943
  {},
4713
4944
  getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -4718,7 +4949,6 @@ var platformAdapterAppDeploymentApi = {
4718
4949
  }
4719
4950
  }))
4720
4951
  );
4721
- return response.data;
4722
4952
  });
4723
4953
  }
4724
4954
  };
@@ -4736,22 +4966,20 @@ var platformAdapterAppSentryLoggerApi = {
4736
4966
  },
4737
4967
  link(payload, authorization) {
4738
4968
  return __async(this, null, function* () {
4739
- const response = yield platformAdapterClientInstance.post(
4969
+ yield platformAdapterClientInstance.post(
4740
4970
  "/console/app/blocks/logger/providers/sentry/link",
4741
4971
  payload,
4742
4972
  getPlatformAdapterClientConfig(authorization)
4743
4973
  );
4744
- return response.data;
4745
4974
  });
4746
4975
  },
4747
4976
  unlink(payload, authorization) {
4748
4977
  return __async(this, null, function* () {
4749
- const response = yield platformAdapterClientInstance.post(
4978
+ yield platformAdapterClientInstance.post(
4750
4979
  "/console/app/blocks/logger/providers/sentry/unlink",
4751
4980
  payload,
4752
4981
  getPlatformAdapterClientConfig(authorization)
4753
4982
  );
4754
- return response.data;
4755
4983
  });
4756
4984
  },
4757
4985
  reauthorizeSentryApp(userId, sentryInstallationId, sentryRefreshToken, authorization) {
@@ -4824,7 +5052,7 @@ var platformAdapterAppRepositoryApi = {
4824
5052
  },
4825
5053
  unlink(payload, authorization) {
4826
5054
  return __async(this, null, function* () {
4827
- const response = yield platformAdapterClientInstance.post(
5055
+ yield platformAdapterClientInstance.post(
4828
5056
  `/console/app/${payload.appId}/blocks/repository/unlink`,
4829
5057
  payload,
4830
5058
  getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -4835,7 +5063,6 @@ var platformAdapterAppRepositoryApi = {
4835
5063
  }
4836
5064
  }))
4837
5065
  );
4838
- return response.data;
4839
5066
  });
4840
5067
  },
4841
5068
  seed(payload, authorization) {
@@ -4890,7 +5117,7 @@ var platformAdapterAppStorageApi = {
4890
5117
  },
4891
5118
  unlink(payload, authorization) {
4892
5119
  return __async(this, null, function* () {
4893
- const response = yield platformAdapterClientInstance.post(
5120
+ yield platformAdapterClientInstance.post(
4894
5121
  `/console/app/${payload.appId}/blocks/storage/unlink`,
4895
5122
  payload,
4896
5123
  getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -4901,7 +5128,6 @@ var platformAdapterAppStorageApi = {
4901
5128
  }
4902
5129
  }))
4903
5130
  );
4904
- return response.data;
4905
5131
  });
4906
5132
  }
4907
5133
  };
@@ -4940,40 +5166,36 @@ var platformAdapterAppVariablesApi = {
4940
5166
  },
4941
5167
  syncVariable(appId, key, payload, authorization) {
4942
5168
  return __async(this, null, function* () {
4943
- const response = yield platformAdapterClientInstance.post(
5169
+ yield platformAdapterClientInstance.post(
4944
5170
  `/console/app/${appId}/variables/${key}/sync`,
4945
5171
  payload,
4946
5172
  getPlatformAdapterClientConfig(authorization)
4947
5173
  );
4948
- return response.data;
4949
5174
  });
4950
5175
  },
4951
5176
  createVariable(appId, data, authorization) {
4952
5177
  return __async(this, null, function* () {
4953
- const response = yield platformAdapterClientInstance.post(
5178
+ yield platformAdapterClientInstance.post(
4954
5179
  `/console/app/${appId}/variables/${data.key}`,
4955
5180
  data,
4956
5181
  getPlatformAdapterClientConfig(authorization)
4957
5182
  );
4958
- return response.data;
4959
5183
  });
4960
5184
  },
4961
5185
  editVariable(appId, data, authorization) {
4962
5186
  return __async(this, null, function* () {
4963
- const response = yield platformAdapterClientInstance.post(
5187
+ yield platformAdapterClientInstance.post(
4964
5188
  `/console/app/${appId}/variables/${data.key}/edit`,
4965
5189
  data,
4966
5190
  getPlatformAdapterClientConfig(authorization)
4967
5191
  );
4968
- return response.data;
4969
5192
  });
4970
5193
  },
4971
5194
  deleteVariable(data) {
4972
5195
  return __async(this, null, function* () {
4973
- const response = yield platformAdapterClientInstance.delete(
5196
+ yield platformAdapterClientInstance.delete(
4974
5197
  `/console/app/${data.appId}/variables/${data.key}`
4975
5198
  );
4976
- return response.data;
4977
5199
  });
4978
5200
  }
4979
5201
  };
@@ -5019,13 +5241,6 @@ var platformApi = {
5019
5241
  dps: platformDpsApi
5020
5242
  };
5021
5243
 
5022
- // src/apis/platform/dps/applications/application/reporting/_contracts/dtos/events/error.ts
5023
- var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
5024
- ErrorType2["4xx"] = "4xx";
5025
- ErrorType2["5xx"] = "5xx";
5026
- return ErrorType2;
5027
- })(ErrorType || {});
5028
-
5029
5244
  // src/apis/api.ts
5030
5245
  var api = {
5031
5246
  platform: platformApi,
@@ -5059,14 +5274,11 @@ function initApi(config, tokens) {
5059
5274
  sentry: (_l = tokens.sentry) == null ? void 0 : _l.token
5060
5275
  } : void 0
5061
5276
  );
5062
- initTextClientInstance(
5063
- (_m = config.urls.platform) == null ? void 0 : _m.text,
5064
- (_n = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _n.dps
5065
- );
5066
5277
  initLiveChatClientInstance(
5067
- (_o = config.urls.products) == null ? void 0 : _o.livechat,
5068
- (_p = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _p.dps
5278
+ (_m = config.urls.products) == null ? void 0 : _m.livechat,
5279
+ (_n = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _n.dps
5069
5280
  );
5281
+ initTextClientInstance((_o = config.urls.integrations) == null ? void 0 : _o.text, (_p = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _p.dps);
5070
5282
  initGithubClientInstance((_q = tokens == null ? void 0 : tokens.github) == null ? void 0 : _q.apps);
5071
5283
  initNetlifyClientInstance((_r = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _r.token);
5072
5284
  initVercelClientInstance((_s = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _s.token);
@@ -5090,7 +5302,6 @@ var serializerBase64 = {
5090
5302
  // Annotate the CommonJS export names for ESM import in node:
5091
5303
  0 && (module.exports = {
5092
5304
  API_NOTIFICATIONS,
5093
- ErrorType,
5094
5305
  UnauthorizeApiError,
5095
5306
  api,
5096
5307
  getAppAutoReviewPayload,