@livechat/developer-studio-api 2.3.70 → 3.0.0-beta.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,8 +68,18 @@ var __async = (__this, __arguments, generator) => {
68
68
  var src_exports = {};
69
69
  __export(src_exports, {
70
70
  API_NOTIFICATIONS: () => API_NOTIFICATIONS,
71
+ AccountsApiError: () => AccountsApiError,
72
+ AdapterApiError: () => AdapterApiError,
73
+ ApiErrorBase: () => ApiErrorBase,
74
+ DpsApiError: () => DpsApiError,
71
75
  UnauthorizeApiError: () => UnauthorizeApiError,
76
+ allAppTemplates: () => allAppTemplates,
72
77
  api: () => api,
78
+ appBaseTemplates: () => appBaseTemplates,
79
+ appRepositoryTemplates: () => appRepositoryTemplates,
80
+ appRepositoryTemplatesMap: () => appRepositoryTemplatesMap,
81
+ appTemplates: () => appTemplates,
82
+ appTemplatesMap: () => appTemplatesMap,
73
83
  getAppAutoReviewPayload: () => getAppAutoReviewPayload,
74
84
  getEmptyAppAutoReview: () => getEmptyAppAutoReview,
75
85
  getGitHubClientAuthorization: () => getGitHubClientAuthorization,
@@ -86,14 +96,13 @@ __export(src_exports, {
86
96
  getPlatformAccountsClientConfig: () => getPlatformAccountsClientConfig,
87
97
  getPlatformAdapterClientAuthorization: () => getPlatformAdapterClientAuthorization,
88
98
  getPlatformAdapterClientConfig: () => getPlatformAdapterClientConfig,
99
+ getPlatformAdapterClientDefaultConfig: () => getPlatformAdapterClientDefaultConfig,
89
100
  getPlatformBillingClientAuthorization: () => getPlatformBillingClientAuthorization,
90
101
  getPlatformBillingClientConfig: () => getPlatformBillingClientConfig,
91
102
  getPlatformDpsAdminClientAuthorization: () => getPlatformDpsAdminClientAuthorization,
92
103
  getPlatformDpsClientAuthorization: () => getPlatformDpsClientAuthorization,
93
104
  getPlatformDpsClientConfig: () => getPlatformDpsClientConfig,
94
105
  getRegion: () => getRegion,
95
- getSentryClientAuthorization: () => getSentryClientAuthorization,
96
- getSentryClientConfig: () => getSentryClientConfig,
97
106
  getTextClientAuthorization: () => getTextClientAuthorization,
98
107
  getTextClientConfig: () => getTextClientConfig,
99
108
  getVercelClientAuthorization: () => getVercelClientAuthorization,
@@ -109,7 +118,6 @@ __export(src_exports, {
109
118
  initPlatformAdapterClientInstance: () => initPlatformAdapterClientInstance,
110
119
  initPlatformBillingClientInstance: () => initPlatformBillingClientInstance,
111
120
  initPlatformDpsClientInstance: () => initPlatformDpsClientInstance,
112
- initSentryClientInstance: () => initSentryClientInstance,
113
121
  initTextClientInstance: () => initTextClientInstance,
114
122
  initVercelClientInstance: () => initVercelClientInstance,
115
123
  livechatClientInstance: () => livechatClientInstance,
@@ -120,14 +128,12 @@ __export(src_exports, {
120
128
  platformAdapterClientInstance: () => platformAdapterClientInstance,
121
129
  platformBillingClientInstance: () => platformBillingClientInstance,
122
130
  platformDpsClientInstance: () => platformDpsClientInstance,
123
- sentryClientInstance: () => sentryClientInstance,
124
131
  textClientInstance: () => textClientInstance,
125
132
  updateGithubClientInstance: () => updateGithubClientInstance,
126
133
  updateNeonClientInstance: () => updateNeonClientInstance,
127
134
  updateNetlifyClientInstance: () => updateNetlifyClientInstance,
128
135
  updatePlanetScaleClientInstance: () => updatePlanetScaleClientInstance,
129
136
  updatePlatformAdapterClientInstance: () => updatePlatformAdapterClientInstance,
130
- updateSentryClientInstance: () => updateSentryClientInstance,
131
137
  updateVercelClientInstance: () => updateVercelClientInstance,
132
138
  vercelClientInstance: () => vercelClientInstance
133
139
  });
@@ -201,20 +207,6 @@ var PLANETSCALE_CONFIG = {
201
207
  }
202
208
  };
203
209
 
204
- // ../../private/config/src/integrations/sentry.ts
205
- var SENTRY_CONFIG = {
206
- github_app_client_name: "sentry-io",
207
- app: process.env.NEXT_PUBLIC_PLATFORM_ENV === "prod" ? {
208
- client_id: "8c8296fe87cb446e9ded22f8b6f4b078363500062155476490d4583b5406d30a",
209
- client_secret: process.env.SENTRY_CLIENT_SECRET,
210
- redirect_uri: "https://platform.text.com/console-adapter/integrations/sentry/callbacks/oauth"
211
- } : {
212
- client_id: "d35803a39bab43b3b6dbe0b89cb99dc54689c35a74dd442baaef0f5b9b0d70bc",
213
- client_secret: process.env.SENTRY_CLIENT_SECRET_LABS,
214
- redirect_uri: "https://platform.labs.text.com/console-adapter/integrations/sentry/callbacks/oauth"
215
- }
216
- };
217
-
218
210
  // ../../private/config/src/integrations/vercel.ts
219
211
  var VERCEL_CONFIG = {
220
212
  github_app_client_name: "vercel",
@@ -235,10 +227,25 @@ var VERCEL_CONFIG = {
235
227
  var import_axios = __toESM(require("axios"));
236
228
 
237
229
  // src/types/errors/api.ts
230
+ var ApiErrorBase = class extends Error {
231
+ constructor(message, data, code) {
232
+ super(message);
233
+ this.message = message;
234
+ this.data = data;
235
+ this.code = code;
236
+ this.kind = "error";
237
+ }
238
+ withCustomMessage(message) {
239
+ return new this.constructor(message, this.data, this.code);
240
+ }
241
+ };
238
242
  var UnauthorizeApiError = class extends Error {
239
- constructor(source) {
240
- super("Unauthorized API call");
243
+ constructor(source, message = "Unauthorized API call") {
244
+ super(message);
241
245
  this.source = source;
246
+ this.message = message;
247
+ this.kind = "unauthorized";
248
+ this.code = 401;
242
249
  }
243
250
  };
244
251
 
@@ -373,13 +380,9 @@ var gitHubRepositoryApi = {
373
380
  ensureAuthorizationToken: true
374
381
  })
375
382
  );
376
- const branch = response.data.find(
383
+ return response.data.find(
377
384
  (innerBranch) => innerBranch.name === repositoryBranch
378
385
  );
379
- if (!branch) {
380
- throw new Error("Branch not found");
381
- }
382
- return branch;
383
386
  });
384
387
  },
385
388
  getRepositorySeed(repositoryName, authorization) {
@@ -835,25 +838,6 @@ var netlifyAccountApi = {
835
838
  }
836
839
  });
837
840
  },
838
- addAccountSentryTokenEnv(siteId, token, authorization) {
839
- return __async(this, null, function* () {
840
- const accounts = yield netlifyClientInstance.get(
841
- `/accounts`,
842
- getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
843
- ensureAuthorizationToken: true
844
- }))
845
- );
846
- const accountId = accounts.data[0].id;
847
- yield this.createAccountEnv(
848
- accountId,
849
- siteId,
850
- "SENTRY_AUTH_TOKEN",
851
- token,
852
- void 0,
853
- authorization
854
- );
855
- });
856
- },
857
841
  removeAccountEnv(accountId, siteId, envKey, authorization) {
858
842
  return __async(this, null, function* () {
859
843
  let targetAccountId = accountId;
@@ -1017,23 +1001,20 @@ var netlifySiteApi = {
1017
1001
  },
1018
1002
  createSiteByInstallationId(name, repositoryFullName, target, installationId, branch, authorization) {
1019
1003
  return __async(this, null, function* () {
1020
- const config = (
1021
- // eslint-disable-next-line no-nested-ternary -- fix me
1022
- target === "nextjs" ? {
1023
- plugins: ["@netlify/plugin-nextjs"],
1024
- packages: [{ package: "@netlify/plugin-nextjs" }],
1025
- dir: ".next",
1026
- cmd: "npm run build"
1027
- } : target === "node" ? {
1028
- plugins: [],
1029
- dir: "dist",
1030
- cmd: "npm run build"
1031
- } : {
1032
- plugin: [],
1033
- dir: ".",
1034
- cmd: ""
1035
- }
1036
- );
1004
+ const config = target === "nextjs" ? {
1005
+ plugins: ["@netlify/plugin-nextjs"],
1006
+ packages: [{ package: "@netlify/plugin-nextjs" }],
1007
+ dir: ".next",
1008
+ cmd: "npm run build"
1009
+ } : target === "node" ? {
1010
+ plugins: [],
1011
+ dir: "dist",
1012
+ cmd: "npm run build"
1013
+ } : {
1014
+ plugin: [],
1015
+ dir: ".",
1016
+ cmd: ""
1017
+ };
1037
1018
  const response = yield netlifyClientInstance.post(
1038
1019
  `/sites`,
1039
1020
  {
@@ -1064,22 +1045,19 @@ var netlifySiteApi = {
1064
1045
  },
1065
1046
  createSiteByDeployKey(name, repositoryFullName, target, deployKeyId, branch, authorization) {
1066
1047
  return __async(this, null, function* () {
1067
- const config = (
1068
- // eslint-disable-next-line no-nested-ternary -- fix me
1069
- target === "nextjs" ? {
1070
- packages: [{ package: "@netlify/plugin-nextjs" }],
1071
- dir: ".next",
1072
- cmd: "npm run build"
1073
- } : target === "node" ? {
1074
- packages: [],
1075
- dir: "dist",
1076
- cmd: "npm run build"
1077
- } : {
1078
- packages: [],
1079
- dir: ".",
1080
- cmd: ""
1081
- }
1082
- );
1048
+ const config = target === "nextjs" ? {
1049
+ packages: [{ package: "@netlify/plugin-nextjs" }],
1050
+ dir: ".next",
1051
+ cmd: "npm run build"
1052
+ } : target === "node" ? {
1053
+ packages: [],
1054
+ dir: "dist",
1055
+ cmd: "npm run build"
1056
+ } : {
1057
+ packages: [],
1058
+ dir: ".",
1059
+ cmd: ""
1060
+ };
1083
1061
  const response = yield netlifyClientInstance.post(
1084
1062
  `/sites`,
1085
1063
  {
@@ -1155,84 +1133,6 @@ var netlifySiteApi = {
1155
1133
  }))
1156
1134
  );
1157
1135
  });
1158
- },
1159
- addSentryPluginToSite(siteId, projectOrg, projectName, projectKey, token, authorization) {
1160
- return __async(this, null, function* () {
1161
- yield netlifyClientInstance.put(
1162
- `/sites/${siteId}`,
1163
- {
1164
- plugins: [
1165
- {
1166
- package: "@netlify/plugin-nextjs"
1167
- },
1168
- {
1169
- package: "@sentry/netlify-build-plugin"
1170
- }
1171
- ]
1172
- },
1173
- getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
1174
- ensureAuthorizationToken: true
1175
- }))
1176
- );
1177
- const accountId = yield netlifyAccountApi.getAccount(authorization);
1178
- if (!accountId) {
1179
- throw new Error("Account is missing");
1180
- }
1181
- const snippets = yield this.getSiteSnippets(siteId, authorization);
1182
- const envs = yield netlifyAccountApi.getAccountEnvs(
1183
- accountId,
1184
- siteId,
1185
- authorization
1186
- );
1187
- if (token) {
1188
- yield netlifyAccountApi.createAccountEnv(
1189
- accountId,
1190
- siteId,
1191
- "SENTRY_AUTH_TOKEN",
1192
- token,
1193
- envs,
1194
- authorization
1195
- );
1196
- }
1197
- yield netlifyAccountApi.createAccountEnv(
1198
- accountId,
1199
- siteId,
1200
- "SENTRY_ORG",
1201
- projectOrg,
1202
- envs,
1203
- authorization
1204
- );
1205
- yield netlifyAccountApi.createAccountEnv(
1206
- accountId,
1207
- siteId,
1208
- "SENTRY_PROJECT",
1209
- projectName,
1210
- envs,
1211
- authorization
1212
- );
1213
- const currentSnippet = snippets.find(
1214
- (snippet) => snippet.title === "sentry"
1215
- );
1216
- if (currentSnippet) {
1217
- yield netlifyClientInstance.delete(
1218
- `sites/${siteId}/snippets/${currentSnippet.id}`,
1219
- getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
1220
- ensureAuthorizationToken: true
1221
- }))
1222
- );
1223
- }
1224
- yield netlifyClientInstance.post(
1225
- `sites/${siteId}/snippets`,
1226
- {
1227
- general_position: "footer",
1228
- title: "sentry",
1229
- general: `<script src='https://js.sentry-cdn.com/${projectKey}.min.js' crossorigin="anonymous"></script>`
1230
- },
1231
- getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
1232
- ensureAuthorizationToken: true
1233
- }))
1234
- );
1235
- });
1236
1136
  }
1237
1137
  };
1238
1138
 
@@ -1471,286 +1371,9 @@ var planetscaleApi = {
1471
1371
  }
1472
1372
  };
1473
1373
 
1474
- // src/apis/integrations/sentry/instance.ts
1475
- var import_axios6 = __toESM(require("axios"));
1476
- var sentryClientInstance = import_axios6.default.create({
1477
- baseURL: "https://sentry.io/api/0/",
1478
- headers: {
1479
- "Content-Type": "application/json"
1480
- }
1481
- });
1482
- sentryClientInstance.interceptors.response.use(
1483
- (r) => r,
1484
- (error) => {
1485
- var _a;
1486
- if (import_axios6.default.isAxiosError(error)) {
1487
- if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
1488
- throw new UnauthorizeApiError("sentry");
1489
- }
1490
- }
1491
- throw error;
1492
- }
1493
- );
1494
- function getSentryClientAuthorization(req) {
1495
- return {
1496
- token: req.headers["sentry-token"]
1497
- };
1498
- }
1499
- function getSentryClientConfig(options = {}) {
1500
- const currentHeaders = sentryClientInstance.defaults.headers;
1501
- const defaultAuthorization = currentHeaders.Authorization;
1502
- const headers = {
1503
- authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
1504
- };
1505
- if (options.ensureAuthorizationToken && !headers.authorization) {
1506
- throw new UnauthorizeApiError("sentry");
1507
- }
1508
- return {
1509
- headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
1510
- };
1511
- }
1512
- function initSentryClientInstance(token) {
1513
- updateSentryClientInstance(token);
1514
- if (token) {
1515
- updateSentryClientInstance(token);
1516
- }
1517
- }
1518
- function updateSentryClientInstance(token) {
1519
- const headers = sentryClientInstance.defaults.headers;
1520
- if (token) {
1521
- headers.Authorization = `Bearer ${token}`;
1522
- } else {
1523
- delete headers.Authorization;
1524
- }
1525
- }
1526
-
1527
- // src/apis/integrations/sentry/api.ts
1528
- var sentryApi = {
1529
- getTeam(teamSlug, authorization) {
1530
- return __async(this, null, function* () {
1531
- const response = yield sentryClientInstance.get(
1532
- `/teams/${teamSlug}/`,
1533
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1534
- ensureAuthorizationToken: true
1535
- }))
1536
- );
1537
- return response.data;
1538
- });
1539
- },
1540
- getOrganizations(authorization) {
1541
- return __async(this, null, function* () {
1542
- const response = yield sentryClientInstance.get(
1543
- "/organizations/",
1544
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1545
- ensureAuthorizationToken: true
1546
- }))
1547
- );
1548
- return response.data;
1549
- });
1550
- },
1551
- getOrganization(organizationSlug, authorization) {
1552
- return __async(this, null, function* () {
1553
- const response = yield sentryClientInstance.get(
1554
- `/organizations/${organizationSlug}/`,
1555
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1556
- ensureAuthorizationToken: true
1557
- }))
1558
- );
1559
- return response.data;
1560
- });
1561
- },
1562
- getOrganizationRepos(organizationSlug, authorization) {
1563
- return __async(this, null, function* () {
1564
- const response = yield sentryClientInstance.get(
1565
- `/organizations/${organizationSlug}/repos/`,
1566
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1567
- ensureAuthorizationToken: true
1568
- }))
1569
- );
1570
- return response.data;
1571
- });
1572
- },
1573
- getOrganizationIntegrations(organizationSlug, authorization) {
1574
- return __async(this, null, function* () {
1575
- const response = yield sentryClientInstance.get(
1576
- `/organizations/${organizationSlug}/integrations/`,
1577
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1578
- ensureAuthorizationToken: true
1579
- }))
1580
- );
1581
- return response.data;
1582
- });
1583
- },
1584
- getProjects(authorization) {
1585
- return __async(this, null, function* () {
1586
- const response = yield sentryClientInstance.get(
1587
- "/projects/",
1588
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1589
- ensureAuthorizationToken: true
1590
- }))
1591
- );
1592
- return response.data;
1593
- });
1594
- },
1595
- getProject(projectFullName, authorization) {
1596
- return __async(this, null, function* () {
1597
- const response = yield sentryClientInstance.get(
1598
- `/projects/${projectFullName}/`,
1599
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1600
- ensureAuthorizationToken: true
1601
- }))
1602
- );
1603
- return response.data;
1604
- });
1605
- },
1606
- getProjectIssues(projectFullName, authorization) {
1607
- return __async(this, null, function* () {
1608
- const response = yield sentryClientInstance.get(
1609
- `/projects/${projectFullName}/issues/`,
1610
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1611
- ensureAuthorizationToken: true
1612
- }))
1613
- );
1614
- return response.data;
1615
- });
1616
- },
1617
- getProjectIssueLatestEvent(issueId, authorization) {
1618
- return __async(this, null, function* () {
1619
- const response = yield sentryClientInstance.get(
1620
- `/issues/${issueId}/events/latest/`,
1621
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1622
- ensureAuthorizationToken: true
1623
- }))
1624
- );
1625
- return response.data;
1626
- });
1627
- },
1628
- getProjectKeys(projectFullName, authorization) {
1629
- return __async(this, null, function* () {
1630
- const response = yield sentryClientInstance.get(
1631
- `/projects/${projectFullName}/keys/`,
1632
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1633
- ensureAuthorizationToken: true
1634
- }))
1635
- );
1636
- return response.data;
1637
- });
1638
- },
1639
- createTeam(organizationSlug, teamName, authorization) {
1640
- return __async(this, null, function* () {
1641
- const { data: team } = yield sentryClientInstance.post(
1642
- `/organizations/${organizationSlug}/teams/`,
1643
- {
1644
- name: teamName,
1645
- slug: teamName
1646
- },
1647
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1648
- ensureAuthorizationToken: true
1649
- }))
1650
- );
1651
- return team;
1652
- });
1653
- },
1654
- createRepo(organizationSlug, projectId, repositoryFullName, repositoryBranch, githubIntegrationId, authorization) {
1655
- return __async(this, null, function* () {
1656
- var _a, _b;
1657
- let repository;
1658
- try {
1659
- const response = yield sentryClientInstance.post(
1660
- `/organizations/${organizationSlug}/repos/`,
1661
- {
1662
- installation: githubIntegrationId,
1663
- identifier: repositoryFullName,
1664
- provider: "integrations:github"
1665
- },
1666
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1667
- ensureAuthorizationToken: true
1668
- }))
1669
- );
1670
- repository = response.data;
1671
- } catch (err) {
1672
- const error = err;
1673
- if (((_a = error.response) == null ? void 0 : _a.data.error_type) === "validation" || ((_b = error.response) == null ? void 0 : _b.data.error_type) === "unknown") {
1674
- throw error;
1675
- }
1676
- const response = yield sentryClientInstance.get(
1677
- `/organizations/${organizationSlug}/repos/`,
1678
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1679
- ensureAuthorizationToken: true
1680
- }))
1681
- );
1682
- repository = response.data.find(
1683
- (repo) => repo.externalSlug === repositoryFullName
1684
- );
1685
- }
1686
- if (!repository) {
1687
- throw new Error("Couldn't get repository");
1688
- }
1689
- try {
1690
- yield sentryClientInstance.post(
1691
- `/organizations/${organizationSlug}/code-mappings/`,
1692
- {
1693
- defaultBranch: repositoryBranch,
1694
- stackRoot: "",
1695
- sourceRoot: "",
1696
- repositoryId: repository.id,
1697
- integrationId: githubIntegrationId,
1698
- projectId
1699
- },
1700
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1701
- ensureAuthorizationToken: true
1702
- }))
1703
- );
1704
- } catch (e) {
1705
- }
1706
- });
1707
- },
1708
- createProject(organizationSlug, appName, authorization) {
1709
- return __async(this, null, function* () {
1710
- var _a;
1711
- const name = appName.toLowerCase();
1712
- try {
1713
- yield this.createTeam(organizationSlug, name, authorization);
1714
- } catch (e) {
1715
- }
1716
- try {
1717
- const response = yield sentryClientInstance.post(
1718
- `/teams/${organizationSlug}/${name}/projects/`,
1719
- {
1720
- name,
1721
- slug: name
1722
- },
1723
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1724
- ensureAuthorizationToken: true
1725
- }))
1726
- );
1727
- return yield this.getProject(
1728
- `${organizationSlug}/${response.data.slug}`,
1729
- authorization
1730
- );
1731
- } catch (error) {
1732
- if (((_a = error.response) == null ? void 0 : _a.status) === 409) {
1733
- return this.getProject(`${organizationSlug}/${name}`, authorization);
1734
- }
1735
- throw error;
1736
- }
1737
- });
1738
- },
1739
- deleteProject(projectFullName, authorization) {
1740
- return __async(this, null, function* () {
1741
- yield sentryClientInstance.delete(
1742
- `/projects/${projectFullName}/`,
1743
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1744
- ensureAuthorizationToken: true
1745
- }))
1746
- );
1747
- });
1748
- }
1749
- };
1750
-
1751
1374
  // src/apis/integrations/text/instance.ts
1752
- var import_axios7 = __toESM(require("axios"));
1753
- var textClientInstance = import_axios7.default.create({
1375
+ var import_axios6 = __toESM(require("axios"));
1376
+ var textClientInstance = import_axios6.default.create({
1754
1377
  baseURL: "https://api.labs.text.com"
1755
1378
  });
1756
1379
  function getTextClientAuthorization(req) {
@@ -2064,6 +1687,12 @@ var textPlatformDashboardApi = {
2064
1687
  value.forEach((innerValue) => {
2065
1688
  searchParams.append(key, innerValue);
2066
1689
  });
1690
+ } else if (key === "is_source_private") {
1691
+ const value = params[key];
1692
+ if (typeof value !== "boolean") {
1693
+ return;
1694
+ }
1695
+ searchParams.append(key, value.toString());
2067
1696
  } else {
2068
1697
  const value = params[key];
2069
1698
  if (!value) {
@@ -2147,18 +1776,18 @@ var textApi = {
2147
1776
  };
2148
1777
 
2149
1778
  // src/apis/integrations/vercel/api.ts
2150
- var import_axios9 = __toESM(require("axios"));
1779
+ var import_axios8 = __toESM(require("axios"));
2151
1780
 
2152
1781
  // src/apis/integrations/vercel/instance.ts
2153
- var import_axios8 = __toESM(require("axios"));
2154
- var vercelClientInstance = import_axios8.default.create({
1782
+ var import_axios7 = __toESM(require("axios"));
1783
+ var vercelClientInstance = import_axios7.default.create({
2155
1784
  baseURL: "https://api.vercel.com"
2156
1785
  });
2157
1786
  vercelClientInstance.interceptors.response.use(
2158
1787
  (r) => r,
2159
1788
  (error) => {
2160
1789
  var _a, _b;
2161
- if (import_axios8.default.isAxiosError(error)) {
1790
+ if (import_axios7.default.isAxiosError(error)) {
2162
1791
  if (((_a = error.response) == null ? void 0 : _a.status) === 401 || ((_b = error.response) == null ? void 0 : _b.status) === 403) {
2163
1792
  throw new UnauthorizeApiError("vercel");
2164
1793
  }
@@ -2447,7 +2076,7 @@ var vercelApi = {
2447
2076
  client_secret: clientSecret,
2448
2077
  redirect_uri: redirectUrl
2449
2078
  });
2450
- const response = yield import_axios9.default.post("https://api.vercel.com/v2/oauth/access_token", data, {
2079
+ const response = yield import_axios8.default.post("https://api.vercel.com/v2/oauth/access_token", data, {
2451
2080
  headers: {
2452
2081
  "Content-Type": "application/x-www-form-urlencoded"
2453
2082
  }
@@ -2463,18 +2092,18 @@ var vercelApi = {
2463
2092
  };
2464
2093
 
2465
2094
  // src/apis/integrations/neon/api.ts
2466
- var import_axios11 = __toESM(require("axios"));
2095
+ var import_axios10 = __toESM(require("axios"));
2467
2096
 
2468
2097
  // src/apis/integrations/neon/instance.ts
2469
- var import_axios10 = __toESM(require("axios"));
2470
- var neonClientInstance = import_axios10.default.create({
2098
+ var import_axios9 = __toESM(require("axios"));
2099
+ var neonClientInstance = import_axios9.default.create({
2471
2100
  baseURL: "https://console.neon.tech/api/v2/"
2472
2101
  });
2473
2102
  neonClientInstance.interceptors.response.use(
2474
2103
  (r) => r,
2475
2104
  (error) => {
2476
2105
  var _a;
2477
- if (import_axios10.default.isAxiosError(error)) {
2106
+ if (import_axios9.default.isAxiosError(error)) {
2478
2107
  if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2479
2108
  throw new UnauthorizeApiError("neon");
2480
2109
  }
@@ -2687,7 +2316,7 @@ var neonApi = {
2687
2316
  redirect_uri: redirectUri,
2688
2317
  grant_type: "authorization_code"
2689
2318
  });
2690
- const response = yield import_axios11.default.post(
2319
+ const response = yield import_axios10.default.post(
2691
2320
  "https://oauth2.neon.tech/oauth2/token",
2692
2321
  data,
2693
2322
  {
@@ -2712,7 +2341,7 @@ var neonApi = {
2712
2341
  client_secret: clientSecret,
2713
2342
  grant_type: "refresh_token"
2714
2343
  });
2715
- const response = yield import_axios11.default.post("https://oauth2.neon.tech/oauth2/token", data, {
2344
+ const response = yield import_axios10.default.post("https://oauth2.neon.tech/oauth2/token", data, {
2716
2345
  headers: {
2717
2346
  "Content-Type": "application/x-www-form-urlencoded"
2718
2347
  }
@@ -2733,12 +2362,11 @@ var integrationsApi = {
2733
2362
  vercel: vercelApi,
2734
2363
  neon: neonApi,
2735
2364
  planetscale: planetscaleApi,
2736
- sentry: sentryApi,
2737
2365
  text: textApi
2738
2366
  };
2739
2367
 
2740
2368
  // src/apis/products/livechat/instance.ts
2741
- var import_axios12 = __toESM(require("axios"));
2369
+ var import_axios11 = __toESM(require("axios"));
2742
2370
  var REGION = {
2743
2371
  FRA: "fra",
2744
2372
  DAL: "dal",
@@ -2752,7 +2380,7 @@ var getRegion = (token) => {
2752
2380
  return region;
2753
2381
  }
2754
2382
  };
2755
- var livechatClientInstance = import_axios12.default.create({
2383
+ var livechatClientInstance = import_axios11.default.create({
2756
2384
  baseURL: "https://api.labs.livechatinc.com"
2757
2385
  });
2758
2386
  function getLiveChatClientAuthorization(req) {
@@ -3250,17 +2878,39 @@ var productsApi = {
3250
2878
  };
3251
2879
 
3252
2880
  // src/apis/platform/accounts/instance.ts
3253
- var import_axios13 = __toESM(require("axios"));
3254
- var platformAccountsClientInstance = import_axios13.default.create({
2881
+ var import_axios12 = __toESM(require("axios"));
2882
+ var AccountsApiError = class extends ApiErrorBase {
2883
+ constructor() {
2884
+ super(...arguments);
2885
+ this.name = "accounts";
2886
+ }
2887
+ };
2888
+ var platformAccountsClientInstance = import_axios12.default.create({
3255
2889
  baseURL: "https://accounts.labs.livechatinc.com"
3256
2890
  });
2891
+ platformAccountsClientInstance.interceptors.response.use(
2892
+ (response) => response,
2893
+ (error) => {
2894
+ var _a, _b, _c, _d;
2895
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2896
+ return Promise.reject(new UnauthorizeApiError("accounts"));
2897
+ }
2898
+ return Promise.reject(
2899
+ new AccountsApiError(
2900
+ error.message,
2901
+ (_b = error.response) == null ? void 0 : _b.data,
2902
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
2903
+ )
2904
+ );
2905
+ }
2906
+ );
3257
2907
  function getPlatformAccountsClientAuthorization(req) {
3258
2908
  return {
3259
2909
  token: req.headers["platform-accounts-token"]
3260
2910
  };
3261
2911
  }
3262
2912
  function getPlatformAccountsClientConfig(options = {}) {
3263
- const defaultAuthorization = platformAccountsClientInstance.defaults.headers["Authorization"];
2913
+ const defaultAuthorization = platformAccountsClientInstance.defaults.headers.Authorization;
3264
2914
  const headers = {
3265
2915
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
3266
2916
  };
@@ -3271,17 +2921,17 @@ function getPlatformAccountsClientConfig(options = {}) {
3271
2921
  function initPlatformAccountsClientInstance(baseUrl, token) {
3272
2922
  if (baseUrl) {
3273
2923
  platformAccountsClientInstance.interceptors.request.use(
3274
- (config) => __async(this, null, function* () {
2924
+ (config) => {
3275
2925
  config.baseURL = baseUrl;
3276
2926
  return config;
3277
- }),
2927
+ },
3278
2928
  (error) => Promise.reject(error)
3279
2929
  );
3280
2930
  }
3281
2931
  if (token) {
3282
- platformAccountsClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
2932
+ platformAccountsClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
3283
2933
  } else {
3284
- delete platformAccountsClientInstance.defaults.headers["Authorization"];
2934
+ delete platformAccountsClientInstance.defaults.headers.Authorization;
3285
2935
  }
3286
2936
  }
3287
2937
 
@@ -3289,50 +2939,32 @@ function initPlatformAccountsClientInstance(baseUrl, token) {
3289
2939
  var platformAccountsAccountApi = {
3290
2940
  getAccounts(authorization) {
3291
2941
  return __async(this, null, function* () {
3292
- try {
3293
- return yield platformAccountsClientInstance.get(
3294
- `/v2/accounts`,
3295
- getPlatformAccountsClientConfig(authorization)
3296
- );
3297
- } catch (error) {
3298
- if (error instanceof Error) {
3299
- throw new Error(`Accounts couldn't be fetched. [${error.message}]`);
3300
- } else {
3301
- throw error;
3302
- }
3303
- }
2942
+ return platformAccountsClientInstance.get(
2943
+ `/v2/accounts`,
2944
+ getPlatformAccountsClientConfig(authorization)
2945
+ ).catch((error) => {
2946
+ throw error.withCustomMessage("Accounts couldn't be fetched.");
2947
+ });
3304
2948
  });
3305
2949
  },
3306
2950
  getAccount(accountId, authorization) {
3307
2951
  return __async(this, null, function* () {
3308
- try {
3309
- return yield platformAccountsClientInstance.get(
3310
- `/v2/accounts/${accountId}`,
3311
- getPlatformAccountsClientConfig(authorization)
3312
- );
3313
- } catch (error) {
3314
- if (error instanceof Error) {
3315
- throw new Error(`Account couldn't be fetched. [${error.message}]`);
3316
- } else {
3317
- throw error;
3318
- }
3319
- }
2952
+ return platformAccountsClientInstance.get(
2953
+ `/v2/accounts/${accountId}`,
2954
+ getPlatformAccountsClientConfig(authorization)
2955
+ ).catch((error) => {
2956
+ throw error.withCustomMessage("Account couldn't be fetched.");
2957
+ });
3320
2958
  });
3321
2959
  },
3322
2960
  getMeAccount(authorization) {
3323
2961
  return __async(this, null, function* () {
3324
- try {
3325
- return yield platformAccountsClientInstance.get(
3326
- `/v2/accounts/me`,
3327
- getPlatformAccountsClientConfig(authorization)
3328
- );
3329
- } catch (error) {
3330
- if (error instanceof Error) {
3331
- throw new Error(`Account couldn't be fetched. [${error.message}]`);
3332
- } else {
3333
- throw error;
3334
- }
3335
- }
2962
+ return platformAccountsClientInstance.get(
2963
+ `/v2/accounts/me`,
2964
+ getPlatformAccountsClientConfig(authorization)
2965
+ ).catch((error) => {
2966
+ throw error.withCustomMessage("Account couldn't be fetched.");
2967
+ });
3336
2968
  });
3337
2969
  }
3338
2970
  };
@@ -3341,141 +2973,90 @@ var platformAccountsAccountApi = {
3341
2973
  var platformAccountsClientApi = {
3342
2974
  getClients(authorization) {
3343
2975
  return __async(this, null, function* () {
3344
- try {
3345
- return yield platformAccountsClientInstance.get(
3346
- `/v2/clients`,
3347
- getPlatformAccountsClientConfig(authorization)
3348
- );
3349
- } catch (error) {
3350
- if (error instanceof Error) {
3351
- throw new Error(`Clients couldn't be fetched. [${error.message}]`);
3352
- } else {
3353
- throw error;
3354
- }
3355
- }
2976
+ return platformAccountsClientInstance.get(
2977
+ `/v2/clients`,
2978
+ getPlatformAccountsClientConfig(authorization)
2979
+ ).catch((error) => {
2980
+ throw error.withCustomMessage("Clients couldn't be fetched.");
2981
+ });
3356
2982
  });
3357
2983
  },
3358
2984
  getClient(clientId, authorization) {
3359
2985
  return __async(this, null, function* () {
3360
- try {
3361
- return yield platformAccountsClientInstance.get(
3362
- `/v2/clients/${clientId}`,
3363
- getPlatformAccountsClientConfig(authorization)
3364
- );
3365
- } catch (error) {
3366
- if (error instanceof Error) {
3367
- throw new Error(`Client couldn't be fetched. [${error.message}]`);
3368
- } else {
3369
- throw error;
3370
- }
3371
- }
2986
+ return platformAccountsClientInstance.get(
2987
+ `/v2/clients/${clientId}`,
2988
+ getPlatformAccountsClientConfig(authorization)
2989
+ ).catch((error) => {
2990
+ throw error.withCustomMessage("Client couldn't be fetched.");
2991
+ });
3372
2992
  });
3373
2993
  },
3374
2994
  createClient(payload, authorization) {
3375
2995
  return __async(this, null, function* () {
3376
- try {
3377
- return yield platformAccountsClientInstance.post(
3378
- `/v2/clients`,
3379
- payload,
3380
- getPlatformAccountsClientConfig(authorization)
3381
- );
3382
- } catch (error) {
3383
- if (error instanceof Error) {
3384
- throw new Error(`Client couldn't be created. [${error.message}]`);
3385
- } else {
3386
- throw error;
3387
- }
3388
- }
2996
+ return platformAccountsClientInstance.post(
2997
+ `/v2/clients`,
2998
+ payload,
2999
+ getPlatformAccountsClientConfig(authorization)
3000
+ ).catch((error) => {
3001
+ throw error.withCustomMessage("Client couldn't be created.");
3002
+ });
3389
3003
  });
3390
3004
  },
3391
3005
  updateClient(clientId, payload, authorization) {
3392
3006
  return __async(this, null, function* () {
3393
- try {
3394
- return yield platformAccountsClientInstance.patch(
3395
- `/v2/clients/${clientId}`,
3396
- payload,
3397
- getPlatformAccountsClientConfig(authorization)
3398
- );
3399
- } catch (error) {
3400
- if (error instanceof Error) {
3401
- throw new Error(`Client couldn't be updated. [${error.message}]`);
3402
- } else {
3403
- throw error;
3404
- }
3405
- }
3007
+ return platformAccountsClientInstance.patch(
3008
+ `/v2/clients/${clientId}`,
3009
+ payload,
3010
+ getPlatformAccountsClientConfig(authorization)
3011
+ ).catch((error) => {
3012
+ throw error.withCustomMessage("Client couldn't be updated.");
3013
+ });
3406
3014
  });
3407
3015
  },
3408
3016
  deleteClient(clientId, authorization) {
3409
3017
  return __async(this, null, function* () {
3410
- try {
3411
- return yield platformAccountsClientInstance.delete(
3412
- `/v2/clients/${clientId}`,
3413
- getPlatformAccountsClientConfig(authorization)
3414
- );
3415
- } catch (error) {
3416
- if (error instanceof Error) {
3417
- throw new Error(`Client couldn't be deleted. [${error.message}]`);
3418
- } else {
3419
- throw error;
3420
- }
3421
- }
3018
+ return platformAccountsClientInstance.delete(
3019
+ `/v2/clients/${clientId}`,
3020
+ getPlatformAccountsClientConfig(authorization)
3021
+ ).catch((error) => {
3022
+ throw error.withCustomMessage("Clients couldn't be deleted.");
3023
+ });
3422
3024
  });
3423
3025
  },
3424
3026
  updateClientScopes(clientId, scopes, authorization) {
3425
3027
  return __async(this, null, function* () {
3426
- try {
3427
- return yield platformAccountsClientInstance.put(
3428
- `/v2/clients/${clientId}/scopes`,
3429
- scopes.map((scope) => ({
3430
- scope: scope.scope,
3431
- required: scope.required
3432
- })),
3433
- getPlatformAccountsClientConfig(authorization)
3434
- );
3435
- } catch (error) {
3436
- if (error instanceof Error) {
3437
- throw new Error(`Scopes couldn't be updated. [${error.message}]`);
3438
- } else {
3439
- throw error;
3440
- }
3441
- }
3028
+ return platformAccountsClientInstance.put(
3029
+ `/v2/clients/${clientId}/scopes`,
3030
+ scopes.map((scope) => ({
3031
+ scope: scope.scope,
3032
+ required: scope.required
3033
+ })),
3034
+ getPlatformAccountsClientConfig(authorization)
3035
+ ).catch((error) => {
3036
+ throw error.withCustomMessage("Client scopes couldn't be updated.");
3037
+ });
3442
3038
  });
3443
3039
  },
3444
3040
  deleteClientScopes(clientId, scopes, authorization) {
3445
3041
  return __async(this, null, function* () {
3446
- try {
3447
- return yield platformAccountsClientInstance.delete(
3448
- `/v2/clients/${clientId}/scopes`,
3449
- __spreadValues({
3450
- data: scopes.map((scope) => ({
3451
- scope: scope.scope,
3452
- required: scope.required
3453
- }))
3454
- }, getPlatformAccountsClientConfig(authorization))
3455
- );
3456
- } catch (error) {
3457
- if (error instanceof Error) {
3458
- throw new Error(`Scopes couldn't be updated. [${error.message}]`);
3459
- } else {
3460
- throw error;
3461
- }
3462
- }
3042
+ return platformAccountsClientInstance.delete(`/v2/clients/${clientId}/scopes`, __spreadValues({
3043
+ data: scopes.map((scope) => ({
3044
+ scope: scope.scope,
3045
+ required: scope.required
3046
+ }))
3047
+ }, getPlatformAccountsClientConfig(authorization))).catch((error) => {
3048
+ throw error.withCustomMessage("Client scopes couldn't be deleted.");
3049
+ });
3463
3050
  });
3464
3051
  },
3465
3052
  getInfo(authorization) {
3466
3053
  return __async(this, null, function* () {
3467
- try {
3468
- return yield platformAccountsClientInstance.get(
3469
- `/v2/info`,
3470
- getPlatformAccountsClientConfig(authorization)
3471
- );
3472
- } catch (error) {
3473
- if (error instanceof Error) {
3474
- throw new Error(`Info couldn't be fetched. [${error.message}]`);
3475
- } else {
3476
- throw error;
3477
- }
3478
- }
3054
+ return platformAccountsClientInstance.get(
3055
+ `/v2/info`,
3056
+ getPlatformAccountsClientConfig(authorization)
3057
+ ).catch((error) => {
3058
+ throw error.withCustomMessage("Client info couldn't be fetched.");
3059
+ });
3479
3060
  });
3480
3061
  }
3481
3062
  };
@@ -3484,34 +3065,22 @@ var platformAccountsClientApi = {
3484
3065
  var platformAccountsOrganizationApi = {
3485
3066
  getOrganizations(authorization) {
3486
3067
  return __async(this, null, function* () {
3487
- try {
3488
- const response = yield platformAccountsClientInstance.get(`/v2/organizations`, getPlatformAccountsClientConfig(authorization));
3489
- return response.data || [];
3490
- } catch (error) {
3491
- if (error instanceof Error) {
3492
- throw new Error(
3493
- `Organizations couldn't be fetched. [${error.message}]`
3494
- );
3495
- } else {
3496
- throw error;
3497
- }
3498
- }
3068
+ return platformAccountsClientInstance.get(
3069
+ `/v2/organizations`,
3070
+ getPlatformAccountsClientConfig(authorization)
3071
+ ).catch((error) => {
3072
+ throw error.withCustomMessage("Organizations couldn't be fetched.");
3073
+ });
3499
3074
  });
3500
3075
  },
3501
3076
  getMyOrganization(authorization) {
3502
3077
  return __async(this, null, function* () {
3503
- try {
3504
- return yield platformAccountsClientInstance.get(
3505
- `/v2/organizations/my`,
3506
- getPlatformAccountsClientConfig(authorization)
3507
- );
3508
- } catch (error) {
3509
- if (error instanceof Error) {
3510
- throw new Error(`Organization couldn't be fetched. [${error.message}]`);
3511
- } else {
3512
- throw error;
3513
- }
3514
- }
3078
+ return platformAccountsClientInstance.get(
3079
+ `/v2/organizations/my`,
3080
+ getPlatformAccountsClientConfig(authorization)
3081
+ ).catch((error) => {
3082
+ throw error.withCustomMessage("Organization couldn't be fetched.");
3083
+ });
3515
3084
  });
3516
3085
  }
3517
3086
  };
@@ -3520,62 +3089,39 @@ var platformAccountsOrganizationApi = {
3520
3089
  var platformAccountsPersonalAccessTokenApi = {
3521
3090
  getPersonalAccessTokens(authorization) {
3522
3091
  return __async(this, null, function* () {
3523
- try {
3524
- const response = yield platformAccountsClientInstance.get(
3525
- `/v2/personal_token`,
3526
- __spreadValues({}, getPlatformAccountsClientConfig(authorization))
3092
+ return platformAccountsClientInstance.get(`/v2/personal_token`, __spreadValues({}, getPlatformAccountsClientConfig(authorization))).catch((error) => {
3093
+ throw error.withCustomMessage(
3094
+ "Personal Access Tokens couldn't be fetched."
3527
3095
  );
3528
- return response.data;
3529
- } catch (error) {
3530
- if (error instanceof Error) {
3531
- throw new Error(
3532
- `Personal Access Token couldn't be fetched. [${error.message}]`
3533
- );
3534
- } else {
3535
- throw error;
3536
- }
3537
- }
3096
+ });
3538
3097
  });
3539
3098
  },
3540
3099
  createPersonalAccessToken(name, scopes, authorization) {
3541
3100
  return __async(this, null, function* () {
3542
- try {
3543
- const response = yield platformAccountsClientInstance.post(
3544
- `/v2/personal_token`,
3545
- {
3546
- name,
3547
- scope: scopes && scopes.map((item) => item.name).filter((el) => el).join(",")
3548
- },
3549
- getPlatformAccountsClientConfig(authorization)
3101
+ return platformAccountsClientInstance.post(
3102
+ `/v2/personal_token`,
3103
+ {
3104
+ name,
3105
+ scope: scopes.map((item) => item.name).filter((el) => el).join(",")
3106
+ },
3107
+ getPlatformAccountsClientConfig(authorization)
3108
+ ).catch((error) => {
3109
+ throw error.withCustomMessage(
3110
+ "Personal Access Tokens couldn't be created."
3550
3111
  );
3551
- return response.data;
3552
- } catch (error) {
3553
- if (error instanceof Error) {
3554
- throw new Error(
3555
- `Personal Access Token couldn't be created. [${error.message}]`
3556
- );
3557
- } else {
3558
- throw error;
3559
- }
3560
- }
3112
+ });
3561
3113
  });
3562
3114
  },
3563
3115
  deletePersonalAccessToken(id, authorization) {
3564
3116
  return __async(this, null, function* () {
3565
- try {
3566
- yield platformAccountsClientInstance.delete(
3567
- `/v2/personal_token/${id}`,
3568
- getPlatformAccountsClientConfig(authorization)
3117
+ return platformAccountsClientInstance.delete(
3118
+ `/v2/personal_token/${id}`,
3119
+ getPlatformAccountsClientConfig(authorization)
3120
+ ).catch((error) => {
3121
+ throw error.withCustomMessage(
3122
+ "Personal Access Tokens couldn't be deleted."
3569
3123
  );
3570
- } catch (error) {
3571
- if (error instanceof Error) {
3572
- throw new Error(
3573
- `Personal Access Token couldn't be deleted. [${error.message}]`
3574
- );
3575
- } else {
3576
- throw error;
3577
- }
3578
- }
3124
+ });
3579
3125
  });
3580
3126
  }
3581
3127
  };
@@ -3584,37 +3130,23 @@ var platformAccountsPersonalAccessTokenApi = {
3584
3130
  var platformAccountsProductsApi = {
3585
3131
  getOrganizationProducts(authorization) {
3586
3132
  return __async(this, null, function* () {
3587
- try {
3588
- const response = yield platformAccountsClientInstance.get(
3589
- `/v2/organizations/my/products`,
3590
- getPlatformAccountsClientConfig(authorization)
3591
- );
3592
- return response.data;
3593
- } catch (error) {
3594
- if (error instanceof Error) {
3595
- throw new Error(`Products couldn't be fetched. [${error.message}]`);
3596
- } else {
3597
- throw error;
3598
- }
3599
- }
3133
+ return platformAccountsClientInstance.get(
3134
+ `/v2/organizations/my/products`,
3135
+ getPlatformAccountsClientConfig(authorization)
3136
+ ).catch((error) => {
3137
+ throw error.withCustomMessage("Products couldn't be fetched.");
3138
+ });
3600
3139
  });
3601
3140
  },
3602
3141
  updateOrganizationProducts(payload, authorization) {
3603
3142
  return __async(this, null, function* () {
3604
- try {
3605
- const response = yield platformAccountsClientInstance.post(
3606
- `/v2/organizations/my/products`,
3607
- payload,
3608
- getPlatformAccountsClientConfig(authorization)
3609
- );
3610
- return response.data;
3611
- } catch (error) {
3612
- if (error instanceof Error) {
3613
- throw new Error(`Products couldn't be updated. [${error.message}]`);
3614
- } else {
3615
- throw error;
3616
- }
3617
- }
3143
+ return platformAccountsClientInstance.post(
3144
+ `/v2/organizations/my/products`,
3145
+ payload,
3146
+ getPlatformAccountsClientConfig(authorization)
3147
+ ).catch((error) => {
3148
+ throw error.withCustomMessage("Products couldn't be updated.");
3149
+ });
3618
3150
  });
3619
3151
  }
3620
3152
  };
@@ -3623,19 +3155,12 @@ var platformAccountsProductsApi = {
3623
3155
  var platformAccountsScopesApi = {
3624
3156
  getScopes(authorization) {
3625
3157
  return __async(this, null, function* () {
3626
- try {
3627
- const response = yield platformAccountsClientInstance.get(
3628
- `/v2/scopes`,
3629
- getPlatformAccountsClientConfig(authorization)
3630
- );
3631
- return response.data || [];
3632
- } catch (error) {
3633
- if (error instanceof Error) {
3634
- throw new Error(`Scopes couldn't be fetched. [${error.message}]`);
3635
- } else {
3636
- throw error;
3637
- }
3638
- }
3158
+ return platformAccountsClientInstance.get(
3159
+ `/v2/scopes`,
3160
+ getPlatformAccountsClientConfig(authorization)
3161
+ ).catch((error) => {
3162
+ throw error.withCustomMessage("Scopes couldn't be fetched.");
3163
+ });
3639
3164
  });
3640
3165
  }
3641
3166
  };
@@ -3644,18 +3169,12 @@ var platformAccountsScopesApi = {
3644
3169
  var platformAccountsSessionsApi = {
3645
3170
  deleteSessions(authorization) {
3646
3171
  return __async(this, null, function* () {
3647
- try {
3648
- return yield platformAccountsClientInstance.delete(
3649
- `/v2/sessions`,
3650
- getPlatformAccountsClientConfig(authorization)
3651
- );
3652
- } catch (error) {
3653
- if (error instanceof Error) {
3654
- throw new Error(`Sessions couldn't be deleted. [${error.message}]`);
3655
- } else {
3656
- throw error;
3657
- }
3658
- }
3172
+ return platformAccountsClientInstance.delete(
3173
+ `/v2/sessions`,
3174
+ getPlatformAccountsClientConfig(authorization)
3175
+ ).catch((error) => {
3176
+ throw error.withCustomMessage("Sessions couldn't be fetched.");
3177
+ });
3659
3178
  });
3660
3179
  }
3661
3180
  };
@@ -3671,23 +3190,13 @@ var platformAccountsTokenApi = {
3671
3190
  client_secret: clientSecret,
3672
3191
  redirect_uri: redirectUrl
3673
3192
  });
3674
- try {
3675
- return yield platformAccountsClientInstance.post(
3676
- `/v2/token`,
3677
- data,
3678
- {
3679
- headers: {
3680
- "Content-Type": "application/x-www-form-urlencoded"
3681
- }
3682
- }
3683
- );
3684
- } catch (error) {
3685
- if (error instanceof Error) {
3686
- throw new Error(`Couldn't exchange code for token. [${error.message}]`);
3687
- } else {
3688
- throw error;
3193
+ return platformAccountsClientInstance.post(`/v2/token`, data, {
3194
+ headers: {
3195
+ "Content-Type": "application/x-www-form-urlencoded"
3689
3196
  }
3690
- }
3197
+ }).catch((error) => {
3198
+ throw error.withCustomMessage("Couldn't exchange code for token.");
3199
+ });
3691
3200
  });
3692
3201
  }
3693
3202
  };
@@ -3705,10 +3214,32 @@ var platformAccountsApi = {
3705
3214
  };
3706
3215
 
3707
3216
  // src/apis/platform/dps/instance.ts
3708
- var import_axios14 = __toESM(require("axios"));
3709
- var platformDpsClientInstance = import_axios14.default.create({
3217
+ var import_axios13 = __toESM(require("axios"));
3218
+ var DpsApiError = class extends ApiErrorBase {
3219
+ constructor() {
3220
+ super(...arguments);
3221
+ this.name = "dps";
3222
+ }
3223
+ };
3224
+ var platformDpsClientInstance = import_axios13.default.create({
3710
3225
  baseURL: "https://dev-platform.labs.livechatinc.com"
3711
3226
  });
3227
+ platformDpsClientInstance.interceptors.response.use(
3228
+ (response) => response,
3229
+ (error) => {
3230
+ var _a, _b, _c, _d;
3231
+ if (((_a = error.response) == null ? void 0 : _a.status) === 403) {
3232
+ return Promise.reject(new UnauthorizeApiError("accounts"));
3233
+ }
3234
+ return Promise.reject(
3235
+ new DpsApiError(
3236
+ error.message,
3237
+ (_b = error.response) == null ? void 0 : _b.data,
3238
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
3239
+ )
3240
+ );
3241
+ }
3242
+ );
3712
3243
  function getPlatformDpsClientAuthorization(req) {
3713
3244
  var _a;
3714
3245
  return {
@@ -3771,6 +3302,23 @@ var platformDpsApplicationAuthorizationApi = {
3771
3302
  throw error;
3772
3303
  }
3773
3304
  });
3305
+ },
3306
+ deleteAuth(appId, authorization) {
3307
+ return __async(this, null, function* () {
3308
+ try {
3309
+ yield platformDpsClientInstance.delete(
3310
+ `/v2/applications/${appId}/authorization`,
3311
+ getPlatformDpsClientConfig(authorization)
3312
+ );
3313
+ } catch (error) {
3314
+ if (error instanceof Error) {
3315
+ throw new Error(
3316
+ `Authorization couldn't be created. [${error.message}]`
3317
+ );
3318
+ }
3319
+ throw error;
3320
+ }
3321
+ });
3774
3322
  }
3775
3323
  };
3776
3324
 
@@ -3880,21 +3428,224 @@ var platformDpsApplicationAutoReviewApi = {
3880
3428
  }
3881
3429
  };
3882
3430
 
3883
- // src/apis/platform/dps/applications/application/chatActions/api.ts
3884
- var platformDpsApplicationChatActionsApi = {
3885
- createChatAction(appId, payload, authorization) {
3886
- return __async(this, null, function* () {
3887
- try {
3888
- yield platformDpsClientInstance.put(
3889
- `/v2/applications/${appId}/chat-actions/${payload.id}`,
3890
- payload,
3891
- getPlatformDpsClientConfig(authorization)
3892
- );
3893
- } catch (error) {
3894
- if (error instanceof Error) {
3895
- throw new Error(
3896
- `${API_NOTIFICATIONS.BUILDING_BLOCKS.FAILURE.CREATED} [${error.message}]`
3897
- );
3431
+ // src/constants/app/templates/repository.ts
3432
+ var appRepositoryTemplatesMap = {
3433
+ "livechat/developer-app-template-nextjs": "nextjs",
3434
+ "livechat/developer-app-template-vite": "vite",
3435
+ "livechat/developer-app-template-saas": "saas"
3436
+ };
3437
+ var appRepositoryTemplates = {
3438
+ nextjs: {
3439
+ id: "nextjs",
3440
+ description: "Uses the most popular and versatile features from our SDKs:",
3441
+ tags: ["Auth", "Webhooks", "Agent App SDK", "Moments"],
3442
+ name: "Fullstack Next.js template",
3443
+ repository: {
3444
+ name: "livechat/developer-app-template-nextjs",
3445
+ target: "nextjs"
3446
+ }
3447
+ },
3448
+ vite: {
3449
+ id: "vite",
3450
+ name: "Vite template",
3451
+ description: "Implements the same base functionalities as the Next.js template except for webhooks:",
3452
+ tags: ["Auth", "Agent App SDK", "Moments"],
3453
+ repository: {
3454
+ name: "livechat/developer-app-template-vite",
3455
+ target: "node"
3456
+ }
3457
+ },
3458
+ saas: {
3459
+ id: "saas",
3460
+ name: "saas",
3461
+ description: "saas",
3462
+ tags: [],
3463
+ repository: {
3464
+ name: "livechat/developer-app-template-saas",
3465
+ target: "nextjs"
3466
+ }
3467
+ }
3468
+ };
3469
+
3470
+ // src/constants/app/templates/app.ts
3471
+ var appTemplatesMap = {
3472
+ "livechat/developer-app-template-saas": "saas"
3473
+ };
3474
+ var appBaseTemplates = {
3475
+ "tag-master": {
3476
+ id: "tag-master",
3477
+ name: "Tag Master",
3478
+ category: { name: "Agent App Widget" },
3479
+ description: "Create, view, and delete tags and canned responses in an easy and predictable way.",
3480
+ tags: ["Accounts SDK", "NextJS", "Configuration API"],
3481
+ link: "https://github.com/bstopyra/tag-master-template",
3482
+ icons: {},
3483
+ repository: {
3484
+ name: "bstopyra/tag-master-template",
3485
+ target: "node"
3486
+ }
3487
+ },
3488
+ progress: {
3489
+ id: "progress",
3490
+ name: "Progress",
3491
+ category: { name: "Agent App Widget" },
3492
+ description: "Creates reports based on data from chats: ratings, chatting time, response time.",
3493
+ tags: ["Accounts SDK", "NextJS", "Reports API"],
3494
+ link: "https://github.com/livechat/progress-app",
3495
+ icons: {},
3496
+ repository: {
3497
+ name: "livechat/progress-app",
3498
+ target: "node"
3499
+ }
3500
+ },
3501
+ supervisor: {
3502
+ id: "supervisor",
3503
+ name: "Supervisor",
3504
+ category: { name: "Agent App Widget" },
3505
+ description: "Monitor statistics of your team, such as chat ratings, response times, and chatting times.",
3506
+ tags: ["Accounts SDK", "NextJS", "Reports API"],
3507
+ link: "https://github.com/livechat/supervisor-app",
3508
+ icons: {},
3509
+ repository: {
3510
+ name: "livechat/supervisor-app",
3511
+ target: "node"
3512
+ }
3513
+ },
3514
+ popup: {
3515
+ id: "popup",
3516
+ name: "Popup app",
3517
+ category: { name: "Agent App Widget" },
3518
+ description: "Learn the ropes of the popup authorization flow from the Accounts SDK.",
3519
+ tags: ["Accounts SDK", "Popup flow", "Widget"],
3520
+ link: "https://github.com/livechat/sample-app-popup-auth",
3521
+ icons: {},
3522
+ repository: {
3523
+ name: "livechat/sample-app-popup-auth",
3524
+ target: "node"
3525
+ }
3526
+ },
3527
+ redirect: {
3528
+ id: "redirect",
3529
+ name: "Redirect app",
3530
+ category: { name: "Agent App Widget" },
3531
+ description: "See how to implement the redirect authorization flow from the Accounts SDK.",
3532
+ tags: ["Accounts SDK", "Redirect flow", "Widget"],
3533
+ link: "https://github.com/livechat/sample-app-redirect-auth",
3534
+ icons: {},
3535
+ repository: {
3536
+ name: "livechat/sample-app-redirect-auth",
3537
+ target: "node"
3538
+ }
3539
+ }
3540
+ };
3541
+ var appTemplates = {
3542
+ saas: {
3543
+ id: "saas",
3544
+ name: "Nextjs SaaS boilerplate",
3545
+ category: { name: "Agent App Widget" },
3546
+ description: "CRM-like app with key-value storage and simple UI. Authorization and payments fully set up.",
3547
+ tags: ["UI", "Auth", "Storage", "Payments", "Analytics"],
3548
+ template: true,
3549
+ manifest: {
3550
+ name: "Nextjs SaaS boilerplate",
3551
+ product: "livechat",
3552
+ blocks: {
3553
+ repository: {
3554
+ provider: "github",
3555
+ name: "livechat/developer-app-template-saas",
3556
+ branch: "main",
3557
+ target: "nextjs"
3558
+ },
3559
+ deployment: {
3560
+ provider: "netlify",
3561
+ url: ""
3562
+ },
3563
+ // storage: {
3564
+ // provider: "neon",
3565
+ // databaseName: "",
3566
+ // isSeeded: false,
3567
+ // },
3568
+ authorization: {
3569
+ scopes: [
3570
+ { scope: "properties.configuration:rw", required: true },
3571
+ {
3572
+ scope: "properties.license.value--all:rw",
3573
+ required: true
3574
+ }
3575
+ ],
3576
+ type: "javascript_app",
3577
+ redirectUri: "/"
3578
+ },
3579
+ widgets: {
3580
+ "chat-details": {
3581
+ placement: "plugin",
3582
+ url: "/livechat/chat-details"
3583
+ },
3584
+ fullscreen: {
3585
+ placement: "fullscreen",
3586
+ url: "/livechat/fullscreen"
3587
+ }
3588
+ },
3589
+ properties: {
3590
+ "123-456-789": {
3591
+ type: "string",
3592
+ default_value: "Mike;mike@yahoo.com",
3593
+ description: "123-456-789",
3594
+ access: {
3595
+ license: {
3596
+ agent: ["read"]
3597
+ }
3598
+ }
3599
+ },
3600
+ "111-222-333": {
3601
+ type: "string",
3602
+ default_value: "Dwight;dwight@yahoo.com",
3603
+ description: "111-222-333",
3604
+ access: {
3605
+ license: {
3606
+ agent: ["read"]
3607
+ }
3608
+ }
3609
+ },
3610
+ "333-555-777": {
3611
+ type: "string",
3612
+ default_value: "Pam;pam@yahoo.com",
3613
+ description: "333-555-777",
3614
+ access: {
3615
+ license: {
3616
+ agent: ["read"]
3617
+ }
3618
+ }
3619
+ }
3620
+ },
3621
+ monetization: {
3622
+ frequency: "monthly",
3623
+ charge: "organization",
3624
+ creditCardRequired: true,
3625
+ price: 500,
3626
+ trialDays: 7
3627
+ }
3628
+ }
3629
+ }
3630
+ }
3631
+ };
3632
+ var allAppTemplates = __spreadValues(__spreadValues(__spreadValues({}, appRepositoryTemplates), appBaseTemplates), appTemplates);
3633
+
3634
+ // src/apis/platform/dps/applications/application/chatActions/api.ts
3635
+ var platformDpsApplicationChatActionsApi = {
3636
+ createChatAction(appId, payload, authorization) {
3637
+ return __async(this, null, function* () {
3638
+ try {
3639
+ yield platformDpsClientInstance.put(
3640
+ `/v2/applications/${appId}/chat-actions/${payload.id}`,
3641
+ payload,
3642
+ getPlatformDpsClientConfig(authorization)
3643
+ );
3644
+ } catch (error) {
3645
+ if (error instanceof Error) {
3646
+ throw new Error(
3647
+ `${API_NOTIFICATIONS.BUILDING_BLOCKS.FAILURE.CREATED} [${error.message}]`
3648
+ );
3898
3649
  }
3899
3650
  throw error;
3900
3651
  }
@@ -4025,6 +3776,24 @@ var platformDpsApplicationDisplayApi = {
4025
3776
  }
4026
3777
  });
4027
3778
  },
3779
+ patchBasicDetails(appId, basicDetails, authorization) {
3780
+ return __async(this, null, function* () {
3781
+ try {
3782
+ yield platformDpsClientInstance.patch(
3783
+ `/v2/applications/${appId}/display`,
3784
+ basicDetails,
3785
+ getPlatformDpsClientConfig(authorization)
3786
+ );
3787
+ } catch (error) {
3788
+ if (error instanceof Error) {
3789
+ throw new Error(
3790
+ `Listing details couldn't be updated. [${error.message}]`
3791
+ );
3792
+ }
3793
+ throw error;
3794
+ }
3795
+ });
3796
+ },
4028
3797
  updateOverview(appId, data, authorization) {
4029
3798
  return __async(this, null, function* () {
4030
3799
  try {
@@ -4163,6 +3932,7 @@ var platformDpsApplicationInfrastructureBlocksApi = {
4163
3932
  `/v2/applications/${appId}/infrastructure/blocks`,
4164
3933
  getPlatformDpsClientConfig(authorization)
4165
3934
  );
3935
+ delete response.data.appId;
4166
3936
  return response.data;
4167
3937
  });
4168
3938
  },
@@ -4227,20 +3997,6 @@ var platformDpsApplicationInfrastructureBlocksApi = {
4227
3997
  getPlatformDpsClientConfig(authorization)
4228
3998
  );
4229
3999
  });
4230
- },
4231
- updateLogger(appId, payload, authorization) {
4232
- return __async(this, null, function* () {
4233
- yield platformDpsClientInstance.post(
4234
- `/v2/applications/${appId}/infrastructure/blocks`,
4235
- {
4236
- appId,
4237
- logger: {
4238
- provider: payload.provider
4239
- }
4240
- },
4241
- getPlatformDpsClientConfig(authorization)
4242
- );
4243
- });
4244
4000
  }
4245
4001
  };
4246
4002
 
@@ -4627,6 +4383,23 @@ var platformDpsApplicationWebhooksApi = {
4627
4383
  }
4628
4384
  });
4629
4385
  },
4386
+ deleteAppWebhooks(appId, authorization) {
4387
+ return __async(this, null, function* () {
4388
+ try {
4389
+ yield platformDpsClientInstance.delete(
4390
+ `/v2/applications/${appId}/webhook`,
4391
+ getPlatformDpsClientConfig(authorization)
4392
+ );
4393
+ } catch (error) {
4394
+ if (error instanceof Error) {
4395
+ throw new Error(
4396
+ `${API_NOTIFICATIONS.BUILDING_BLOCKS.FAILURE.DELETED} [${error.message}]`
4397
+ );
4398
+ }
4399
+ throw error;
4400
+ }
4401
+ });
4402
+ },
4630
4403
  getChatWebhook(appId, authorization) {
4631
4404
  return __async(this, null, function* () {
4632
4405
  try {
@@ -4764,8 +4537,10 @@ var platformDpsApplicationApi = {
4764
4537
  );
4765
4538
  return response.data;
4766
4539
  } catch (error) {
4767
- if (error instanceof Error) {
4768
- throw new Error(`App couldn't be fetched. [${error.message}]`);
4540
+ if (error instanceof DpsApiError) {
4541
+ throw error.withCustomMessage(
4542
+ `App couldn't be fetched. [${error.message}]`
4543
+ );
4769
4544
  }
4770
4545
  throw error;
4771
4546
  }
@@ -5344,7 +5119,7 @@ var platformDpsApi = {
5344
5119
  };
5345
5120
 
5346
5121
  // src/apis/platform/adapter/instance.ts
5347
- var import_axios15 = __toESM(require("axios"));
5122
+ var import_axios14 = __toESM(require("axios"));
5348
5123
  var REGION2 = {
5349
5124
  FRA: "fra",
5350
5125
  DAL: "dal",
@@ -5358,6 +5133,12 @@ var getRegion2 = (token) => {
5358
5133
  return region;
5359
5134
  }
5360
5135
  };
5136
+ var AdapterApiError = class extends ApiErrorBase {
5137
+ constructor() {
5138
+ super(...arguments);
5139
+ this.name = "adapter";
5140
+ }
5141
+ };
5361
5142
  function getPlatformAdapterClientAuthorization(req) {
5362
5143
  return {
5363
5144
  platform: {
@@ -5371,33 +5152,33 @@ function getPlatformAdapterClientAuthorization(req) {
5371
5152
  vercel: req.headers["vercel-token"],
5372
5153
  planetscale: req.headers["planetscale-token"],
5373
5154
  neon: req.headers["neon-token"],
5374
- sentry: req.headers["sentry-token"],
5375
5155
  openai: req.headers["openai-token"]
5376
5156
  };
5377
5157
  }
5378
- var platformAdapterClientInstance = import_axios15.default.create({
5158
+ var platformAdapterClientInstance = import_axios14.default.create({
5379
5159
  baseURL: "https://platform.labs.text.com/console-adapter/api",
5380
5160
  headers: {
5381
5161
  "Content-Type": "application/json"
5382
5162
  }
5383
5163
  });
5384
5164
  platformAdapterClientInstance.interceptors.response.use(
5385
- (r) => r,
5165
+ (response) => response,
5386
5166
  (error) => {
5387
- var _a;
5388
- if (import_axios15.default.isAxiosError(error)) {
5389
- if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
5390
- const source = error.response.data.error.source;
5391
- if (source) {
5392
- throw new UnauthorizeApiError(source);
5393
- }
5394
- }
5167
+ var _a, _b;
5168
+ const apiError = (_a = error.response) == null ? void 0 : _a.data;
5169
+ if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
5170
+ return Promise.reject(new UnauthorizeApiError(apiError.source));
5171
+ } else if ((apiError == null ? void 0 : apiError.kind) === "error") {
5172
+ const data = (_b = error.response) == null ? void 0 : _b.data;
5173
+ return Promise.reject(
5174
+ new AdapterApiError(data.message, data.data, data.code)
5175
+ );
5395
5176
  }
5396
- throw error;
5177
+ return Promise.reject(error);
5397
5178
  }
5398
5179
  );
5399
5180
  function getPlatformAdapterClientConfig(options = {}) {
5400
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
5181
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
5401
5182
  const currentHeaders = platformAdapterClientInstance.defaults.headers;
5402
5183
  const headers = {
5403
5184
  platform: {
@@ -5412,41 +5193,44 @@ function getPlatformAdapterClientConfig(options = {}) {
5412
5193
  vercel: (_h = currentHeaders["vercel-token"]) != null ? _h : options.vercel,
5413
5194
  planetscale: (_i = currentHeaders["planetscale-token"]) != null ? _i : options.planetscale,
5414
5195
  neon: (_j = currentHeaders["neon-token"]) != null ? _j : options.neon,
5415
- sentry: (_k = currentHeaders["sentry-token"]) != null ? _k : options.sentry,
5416
- openai: (_l = currentHeaders["openai-token"]) != null ? _l : options.openai
5196
+ openai: (_k = currentHeaders["openai-token"]) != null ? _k : options.openai
5417
5197
  }
5418
5198
  };
5419
5199
  if (currentHeaders["platform-dps-token"]) {
5420
- currentHeaders["X-Region"] = (_m = getRegion2(currentHeaders["platform-dps-token"])) != null ? _m : void 0;
5200
+ currentHeaders["X-Region"] = (_l = getRegion2(currentHeaders["platform-dps-token"])) != null ? _l : void 0;
5421
5201
  }
5422
- if (((_o = (_n = options.ensureAuthorizationToken) == null ? void 0 : _n.platform) == null ? void 0 : _o.dps) && !headers.platform.dps) {
5423
- throw new UnauthorizeApiError("dps");
5202
+ if (((_n = (_m = options.ensureAuthorizationToken) == null ? void 0 : _m.platform) == null ? void 0 : _n.dps) && !headers.platform.dps) {
5203
+ throw new UnauthorizeApiError("accounts");
5424
5204
  }
5425
- if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
5205
+ if (((_o = options.ensureAuthorizationToken) == null ? void 0 : _o.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
5426
5206
  throw new UnauthorizeApiError("github");
5427
5207
  }
5428
- if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.vercel) && !headers.integrations.vercel) {
5208
+ if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.vercel) && !headers.integrations.vercel) {
5429
5209
  throw new UnauthorizeApiError("vercel");
5430
5210
  }
5431
- if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.netlify) && !headers.integrations.netlify) {
5211
+ if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.netlify) && !headers.integrations.netlify) {
5432
5212
  throw new UnauthorizeApiError("netlify");
5433
5213
  }
5434
- if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.planetscale) && !headers.integrations.planetscale) {
5214
+ if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.planetscale) && !headers.integrations.planetscale) {
5435
5215
  throw new UnauthorizeApiError("planetscale");
5436
5216
  }
5437
- if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.neon) && !headers.integrations.neon) {
5217
+ if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.neon) && !headers.integrations.neon) {
5438
5218
  throw new UnauthorizeApiError("neon");
5439
5219
  }
5440
- if (((_u = options.ensureAuthorizationToken) == null ? void 0 : _u.sentry) && !headers.integrations.sentry) {
5441
- throw new UnauthorizeApiError("sentry");
5442
- }
5443
- if (((_v = options.ensureAuthorizationToken) == null ? void 0 : _v.openai) && !headers.integrations.openai) {
5220
+ if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.openai) && !headers.integrations.openai) {
5444
5221
  throw new UnauthorizeApiError("openai");
5445
5222
  }
5446
5223
  return {
5447
- headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.dps ? { "platform-dps-token": headers.platform.dps } : {}), headers.integrations.github.app ? { "github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.neon ? { "neon-token": headers.integrations.neon } : {}), headers.integrations.sentry ? { "sentry-token": headers.integrations.sentry } : {}), headers.integrations.openai ? { "openai-token": headers.integrations.openai } : {})
5224
+ headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.dps ? { "platform-dps-token": headers.platform.dps } : {}), headers.integrations.github.app ? { "github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.neon ? { "neon-token": headers.integrations.neon } : {}), headers.integrations.openai ? { "openai-token": headers.integrations.openai } : {})
5448
5225
  };
5449
5226
  }
5227
+ var getPlatformAdapterClientDefaultConfig = (authorization) => getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5228
+ ensureAuthorizationToken: {
5229
+ platform: {
5230
+ dps: true
5231
+ }
5232
+ }
5233
+ }));
5450
5234
  function initPlatformAdapterClientInstance(baseUrl, tokens) {
5451
5235
  if (baseUrl) {
5452
5236
  platformAdapterClientInstance.interceptors.request.use(
@@ -5485,253 +5269,344 @@ function updatePlatformAdapterClientInstance(tokens) {
5485
5269
  if (tokens == null ? void 0 : tokens.neon) {
5486
5270
  headers["neon-token"] = tokens.neon;
5487
5271
  }
5488
- if (tokens == null ? void 0 : tokens.sentry) {
5489
- headers["sentry-token"] = tokens.sentry;
5490
- }
5491
5272
  if (tokens == null ? void 0 : tokens.openai) {
5492
5273
  headers["openai-token"] = tokens.openai;
5493
5274
  }
5494
5275
  }
5495
5276
 
5277
+ // src/apis/platform/adapter/app/blocks/authorization/api.ts
5278
+ var platformAdapterAppAuthorizationApi = {
5279
+ get(appId, authorization) {
5280
+ return __async(this, null, function* () {
5281
+ return platformAdapterClientInstance.get(
5282
+ `/console/app/${appId}/blocks/authorization`,
5283
+ getPlatformAdapterClientDefaultConfig(authorization)
5284
+ );
5285
+ });
5286
+ },
5287
+ add(payload, authorization) {
5288
+ return __async(this, null, function* () {
5289
+ return platformAdapterClientInstance.post(
5290
+ `/console/app/${payload.appId}/blocks/authorization`,
5291
+ payload,
5292
+ getPlatformAdapterClientDefaultConfig(authorization)
5293
+ );
5294
+ });
5295
+ },
5296
+ update(payload, authorization) {
5297
+ return __async(this, null, function* () {
5298
+ return platformAdapterClientInstance.put(
5299
+ `/console/app/${payload.appId}/blocks/authorization`,
5300
+ payload,
5301
+ getPlatformAdapterClientDefaultConfig(authorization)
5302
+ );
5303
+ });
5304
+ },
5305
+ remove(payload, authorization) {
5306
+ return __async(this, null, function* () {
5307
+ return platformAdapterClientInstance.delete(
5308
+ `/console/app/${payload.appId}/blocks/authorization`,
5309
+ getPlatformAdapterClientDefaultConfig(authorization)
5310
+ );
5311
+ });
5312
+ }
5313
+ };
5314
+
5496
5315
  // src/apis/platform/adapter/app/blocks/deployment/api.ts
5497
5316
  var platformAdapterAppDeploymentApi = {
5317
+ getAggregate(appId, authorization) {
5318
+ return __async(this, null, function* () {
5319
+ return platformAdapterClientInstance.get(
5320
+ `/console/app/${appId}/blocks/deployment/aggregate`,
5321
+ getPlatformAdapterClientDefaultConfig(authorization)
5322
+ );
5323
+ });
5324
+ },
5498
5325
  get(appId, authorization) {
5499
5326
  return __async(this, null, function* () {
5500
- const response = yield platformAdapterClientInstance.get(
5327
+ return platformAdapterClientInstance.get(
5501
5328
  `/console/app/${appId}/blocks/deployment`,
5502
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5503
- ensureAuthorizationToken: {
5504
- platform: {
5505
- dps: true
5506
- }
5507
- }
5508
- }))
5329
+ getPlatformAdapterClientDefaultConfig(authorization)
5509
5330
  );
5510
- return response.data;
5511
5331
  });
5512
5332
  },
5513
5333
  link(payload, authorization) {
5514
5334
  return __async(this, null, function* () {
5515
- const response = yield platformAdapterClientInstance.post(
5516
- `/console/app/${payload.appId}/blocks/deployment/link`,
5335
+ return platformAdapterClientInstance.put(
5336
+ `/console/app/${payload.appId}/blocks/deployment`,
5517
5337
  payload,
5518
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5519
- ensureAuthorizationToken: {
5520
- platform: {
5521
- dps: true
5522
- }
5523
- }
5524
- }))
5338
+ getPlatformAdapterClientDefaultConfig(authorization)
5525
5339
  );
5526
- return response.data;
5527
5340
  });
5528
5341
  },
5529
5342
  unlink(payload, authorization) {
5530
5343
  return __async(this, null, function* () {
5531
- yield platformAdapterClientInstance.post(
5532
- `/console/app/${payload.appId}/blocks/deployment/unlink`,
5533
- payload,
5534
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5535
- ensureAuthorizationToken: {
5536
- platform: {
5537
- dps: true
5538
- }
5539
- }
5540
- }))
5344
+ return platformAdapterClientInstance.delete(
5345
+ `/console/app/${payload.appId}/blocks/deployment?${new URLSearchParams(
5346
+ payload
5347
+ ).toString()}`,
5348
+ getPlatformAdapterClientDefaultConfig(authorization)
5541
5349
  );
5542
5350
  });
5543
5351
  },
5544
- installSentry(appId, authorization) {
5352
+ upsert(payload, authorization) {
5545
5353
  return __async(this, null, function* () {
5546
- yield platformAdapterClientInstance.post(
5547
- `/console/app/${appId}/blocks/deployment/install/sentry`,
5548
- {},
5549
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5550
- ensureAuthorizationToken: {
5551
- platform: {
5552
- dps: true
5553
- }
5554
- }
5555
- }))
5354
+ return platformAdapterClientInstance.patch(
5355
+ `/console/app/${payload.appId}/blocks/deployment`,
5356
+ payload,
5357
+ getPlatformAdapterClientDefaultConfig(authorization)
5556
5358
  );
5557
5359
  });
5558
5360
  }
5559
5361
  };
5560
5362
 
5561
- // src/apis/platform/adapter/app/blocks/logger/providers/sentry/api.ts
5562
- var platformAdapterAppSentryLoggerApi = {
5563
- get(projectSlug, authorization) {
5363
+ // src/apis/platform/adapter/app/blocks/monetization/api.ts
5364
+ var platformAdapterAppMonetizationApi = {
5365
+ get(appId, authorization) {
5564
5366
  return __async(this, null, function* () {
5565
- const response = yield platformAdapterClientInstance.get(
5566
- `/console/app/blocks/logger/providers/sentry/get?projectSlug=${projectSlug}`,
5567
- getPlatformAdapterClientConfig(authorization)
5367
+ return platformAdapterClientInstance.get(
5368
+ `/console/app/${appId}/blocks/monetization`,
5369
+ getPlatformAdapterClientDefaultConfig(authorization)
5568
5370
  );
5569
- return response.data;
5570
5371
  });
5571
5372
  },
5572
- link(payload, authorization) {
5373
+ upsert(payload, authorization) {
5573
5374
  return __async(this, null, function* () {
5574
- yield platformAdapterClientInstance.post(
5575
- "/console/app/blocks/logger/providers/sentry/link",
5375
+ return platformAdapterClientInstance.post(
5376
+ `/console/app/${payload.appId}/blocks/monetization`,
5576
5377
  payload,
5577
- getPlatformAdapterClientConfig(authorization)
5378
+ getPlatformAdapterClientDefaultConfig(authorization)
5578
5379
  );
5579
5380
  });
5580
5381
  },
5581
- unlink(payload, authorization) {
5382
+ remove(payload, authorization) {
5582
5383
  return __async(this, null, function* () {
5583
- yield platformAdapterClientInstance.post(
5584
- "/console/app/blocks/logger/providers/sentry/unlink",
5585
- payload,
5586
- getPlatformAdapterClientConfig(authorization)
5384
+ return platformAdapterClientInstance.delete(
5385
+ `/console/app/${payload.appId}/blocks/monetization`,
5386
+ getPlatformAdapterClientDefaultConfig(authorization)
5387
+ );
5388
+ });
5389
+ }
5390
+ };
5391
+
5392
+ // src/apis/platform/adapter/app/blocks/properties/property/api.ts
5393
+ var platformAdapterAppPropertyApi = {
5394
+ get(appId, propertyId, authorization) {
5395
+ return __async(this, null, function* () {
5396
+ return platformAdapterClientInstance.get(
5397
+ `/console/app/${appId}/blocks/properties/${propertyId}`,
5398
+ getPlatformAdapterClientDefaultConfig(authorization)
5587
5399
  );
5588
5400
  });
5589
5401
  },
5590
- reauthorizeSentryApp(userId, sentryInstallationId, sentryRefreshToken, authorization) {
5402
+ upsert(payload, authorization) {
5591
5403
  return __async(this, null, function* () {
5592
- const response = yield platformAdapterClientInstance.post(
5593
- "/integrations/sentry/refresh",
5594
- {
5595
- userId,
5596
- sentryInstallationId,
5597
- sentryRefreshToken
5598
- },
5599
- getPlatformAdapterClientConfig(authorization)
5404
+ return platformAdapterClientInstance.post(
5405
+ `/console/app/${payload.appId}/blocks/properties/${payload.propertyId}`,
5406
+ payload,
5407
+ getPlatformAdapterClientDefaultConfig(authorization)
5600
5408
  );
5601
- return response.data;
5602
5409
  });
5603
5410
  },
5604
- requestSentryIssueSolution(stacktrace, authorization) {
5411
+ remove(payload, authorization) {
5605
5412
  return __async(this, null, function* () {
5606
- const response = yield platformAdapterClientInstance.post(
5607
- "/integrations/openai/issues/solution",
5608
- {
5609
- stacktrace
5610
- },
5611
- getPlatformAdapterClientConfig(authorization)
5413
+ return platformAdapterClientInstance.delete(
5414
+ `/console/app/${payload.appId}/blocks/properties/${payload.propertyId}`,
5415
+ getPlatformAdapterClientDefaultConfig(authorization)
5612
5416
  );
5613
- return response.data;
5614
5417
  });
5615
5418
  }
5616
5419
  };
5617
5420
 
5618
- // src/apis/platform/adapter/app/blocks/logger/api.ts
5619
- var platformAdapterAppLoggerApi = {
5620
- providers: {
5621
- sentry: platformAdapterAppSentryLoggerApi
5421
+ // src/apis/platform/adapter/app/blocks/properties/api.ts
5422
+ var platformAdapterAppPropertiesApi = {
5423
+ property: platformAdapterAppPropertyApi,
5424
+ get(appId, authorization) {
5425
+ return __async(this, null, function* () {
5426
+ return platformAdapterClientInstance.get(
5427
+ `/console/app/${appId}/blocks/properties`,
5428
+ getPlatformAdapterClientDefaultConfig(authorization)
5429
+ );
5430
+ });
5431
+ },
5432
+ upsert(payload, authorization) {
5433
+ return __async(this, null, function* () {
5434
+ return platformAdapterClientInstance.post(
5435
+ `/console/app/${payload.appId}/blocks/properties`,
5436
+ payload,
5437
+ getPlatformAdapterClientDefaultConfig(authorization)
5438
+ );
5439
+ });
5440
+ },
5441
+ remove(payload, authorization) {
5442
+ return __async(this, null, function* () {
5443
+ return platformAdapterClientInstance.delete(
5444
+ `/console/app/${payload.appId}/blocks/properties`,
5445
+ getPlatformAdapterClientDefaultConfig(authorization)
5446
+ );
5447
+ });
5622
5448
  }
5623
5449
  };
5624
5450
 
5625
5451
  // src/apis/platform/adapter/app/blocks/repository/api.ts
5626
5452
  var platformAdapterAppRepositoryApi = {
5453
+ getAggregate(appId, authorization) {
5454
+ return __async(this, null, function* () {
5455
+ return platformAdapterClientInstance.get(
5456
+ `/console/app/${appId}/blocks/repository/aggregate`,
5457
+ getPlatformAdapterClientDefaultConfig(authorization)
5458
+ );
5459
+ });
5460
+ },
5627
5461
  get(appId, authorization) {
5628
5462
  return __async(this, null, function* () {
5629
- const response = yield platformAdapterClientInstance.get(
5463
+ return platformAdapterClientInstance.get(
5630
5464
  `/console/app/${appId}/blocks/repository`,
5631
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5632
- ensureAuthorizationToken: {
5633
- platform: {
5634
- dps: true
5635
- }
5636
- }
5637
- }))
5465
+ getPlatformAdapterClientDefaultConfig(authorization)
5638
5466
  );
5639
- return response.data;
5640
5467
  });
5641
5468
  },
5642
5469
  link(payload, authorization) {
5643
5470
  return __async(this, null, function* () {
5644
- const response = yield platformAdapterClientInstance.post(
5645
- `/console/app/${payload.appId}/blocks/repository/link`,
5471
+ return platformAdapterClientInstance.put(
5472
+ `/console/app/${payload.appId}/blocks/repository`,
5646
5473
  payload,
5647
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5648
- ensureAuthorizationToken: {
5649
- platform: {
5650
- dps: true
5651
- }
5652
- }
5653
- }))
5474
+ getPlatformAdapterClientDefaultConfig(authorization)
5654
5475
  );
5655
- return response.data;
5656
5476
  });
5657
5477
  },
5658
5478
  unlink(payload, authorization) {
5659
5479
  return __async(this, null, function* () {
5660
- yield platformAdapterClientInstance.post(
5661
- `/console/app/${payload.appId}/blocks/repository/unlink`,
5480
+ return platformAdapterClientInstance.delete(
5481
+ `/console/app/${payload.appId}/blocks/repository?${new URLSearchParams(
5482
+ payload
5483
+ ).toString()}`,
5484
+ getPlatformAdapterClientDefaultConfig(authorization)
5485
+ );
5486
+ });
5487
+ },
5488
+ upsert(payload, authorization) {
5489
+ return __async(this, null, function* () {
5490
+ return platformAdapterClientInstance.patch(
5491
+ `/console/app/${payload.appId}/blocks/repository`,
5662
5492
  payload,
5663
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5664
- ensureAuthorizationToken: {
5665
- platform: {
5666
- dps: true
5667
- }
5668
- }
5669
- }))
5493
+ getPlatformAdapterClientDefaultConfig(authorization)
5670
5494
  );
5671
5495
  });
5672
5496
  },
5673
5497
  seed(payload, authorization) {
5674
5498
  return __async(this, null, function* () {
5675
- const response = yield platformAdapterClientInstance.post(
5499
+ return platformAdapterClientInstance.post(
5676
5500
  `/console/app/${payload.appId}/blocks/repository/seed`,
5677
5501
  payload,
5678
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5679
- ensureAuthorizationToken: {
5680
- platform: {
5681
- dps: true
5682
- }
5683
- }
5684
- }))
5502
+ getPlatformAdapterClientDefaultConfig(authorization)
5685
5503
  );
5686
- return response.data;
5687
5504
  });
5688
5505
  }
5689
5506
  };
5690
5507
 
5691
5508
  // src/apis/platform/adapter/app/blocks/storage/api.ts
5692
5509
  var platformAdapterAppStorageApi = {
5510
+ getAggregate(appId, authorization) {
5511
+ return __async(this, null, function* () {
5512
+ return platformAdapterClientInstance.get(
5513
+ `/console/app/${appId}/blocks/storage/aggregate`,
5514
+ getPlatformAdapterClientDefaultConfig(authorization)
5515
+ );
5516
+ });
5517
+ },
5693
5518
  get(appId, authorization) {
5694
5519
  return __async(this, null, function* () {
5695
- const response = yield platformAdapterClientInstance.get(
5520
+ return platformAdapterClientInstance.get(
5696
5521
  `/console/app/${appId}/blocks/storage`,
5697
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5698
- ensureAuthorizationToken: {
5699
- platform: {
5700
- dps: true
5701
- }
5702
- }
5703
- }))
5522
+ getPlatformAdapterClientDefaultConfig(authorization)
5704
5523
  );
5705
- return response.data;
5706
5524
  });
5707
5525
  },
5708
5526
  link(payload, authorization) {
5709
5527
  return __async(this, null, function* () {
5710
- yield platformAdapterClientInstance.post(
5711
- `/console/app/${payload.appId}/blocks/storage/link`,
5528
+ return platformAdapterClientInstance.put(
5529
+ `/console/app/${payload.appId}/blocks/storage`,
5712
5530
  payload,
5713
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5714
- ensureAuthorizationToken: {
5715
- platform: {
5716
- dps: true
5717
- }
5718
- }
5719
- }))
5531
+ getPlatformAdapterClientDefaultConfig(authorization)
5720
5532
  );
5721
5533
  });
5722
5534
  },
5723
5535
  unlink(payload, authorization) {
5724
5536
  return __async(this, null, function* () {
5725
- yield platformAdapterClientInstance.post(
5726
- `/console/app/${payload.appId}/blocks/storage/unlink`,
5537
+ return platformAdapterClientInstance.delete(
5538
+ `/console/app/${payload.appId}/blocks/storage?${new URLSearchParams(
5539
+ payload
5540
+ ).toString()}`,
5541
+ getPlatformAdapterClientDefaultConfig(authorization)
5542
+ );
5543
+ });
5544
+ },
5545
+ upsert(payload, authorization) {
5546
+ return __async(this, null, function* () {
5547
+ return platformAdapterClientInstance.patch(
5548
+ `/console/app/${payload.appId}/blocks/storage`,
5727
5549
  payload,
5728
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5729
- ensureAuthorizationToken: {
5730
- platform: {
5731
- dps: true
5732
- }
5733
- }
5734
- }))
5550
+ getPlatformAdapterClientDefaultConfig(authorization)
5551
+ );
5552
+ });
5553
+ }
5554
+ };
5555
+
5556
+ // src/apis/platform/adapter/app/blocks/widgets/widget/api.ts
5557
+ var platformAdapterAppWidgetApi = {
5558
+ get(appId, widgetId, authorization) {
5559
+ return __async(this, null, function* () {
5560
+ return platformAdapterClientInstance.get(
5561
+ `/console/app/${appId}/blocks/widgets/${widgetId}`,
5562
+ getPlatformAdapterClientDefaultConfig(authorization)
5563
+ );
5564
+ });
5565
+ },
5566
+ upsert(payload, authorization) {
5567
+ return __async(this, null, function* () {
5568
+ return platformAdapterClientInstance.post(
5569
+ `/console/app/${payload.appId}/blocks/widgets/${payload.widgetId}`,
5570
+ payload,
5571
+ getPlatformAdapterClientDefaultConfig(authorization)
5572
+ );
5573
+ });
5574
+ },
5575
+ remove(payload, authorization) {
5576
+ return __async(this, null, function* () {
5577
+ return platformAdapterClientInstance.delete(
5578
+ `/console/app/${payload.appId}/blocks/widgets/${payload.widgetId}`,
5579
+ getPlatformAdapterClientDefaultConfig(authorization)
5580
+ );
5581
+ });
5582
+ }
5583
+ };
5584
+
5585
+ // src/apis/platform/adapter/app/blocks/widgets/api.ts
5586
+ var platformAdapterAppWidgetsApi = {
5587
+ widget: platformAdapterAppWidgetApi,
5588
+ get(appId, authorization) {
5589
+ return __async(this, null, function* () {
5590
+ return platformAdapterClientInstance.get(
5591
+ `/console/app/${appId}/blocks/widgets`,
5592
+ getPlatformAdapterClientDefaultConfig(authorization)
5593
+ );
5594
+ });
5595
+ },
5596
+ upsert(payload, authorization) {
5597
+ return __async(this, null, function* () {
5598
+ return platformAdapterClientInstance.post(
5599
+ `/console/app/${payload.appId}/blocks/widgets`,
5600
+ payload,
5601
+ getPlatformAdapterClientDefaultConfig(authorization)
5602
+ );
5603
+ });
5604
+ },
5605
+ remove(payload, authorization) {
5606
+ return __async(this, null, function* () {
5607
+ return platformAdapterClientInstance.delete(
5608
+ `/console/app/${payload.appId}/blocks/widgets`,
5609
+ getPlatformAdapterClientDefaultConfig(authorization)
5735
5610
  );
5736
5611
  });
5737
5612
  }
@@ -5739,10 +5614,13 @@ var platformAdapterAppStorageApi = {
5739
5614
 
5740
5615
  // src/apis/platform/adapter/app/blocks/api.ts
5741
5616
  var platformAdapterAppBlocksApi = {
5617
+ authorization: platformAdapterAppAuthorizationApi,
5618
+ monetization: platformAdapterAppMonetizationApi,
5742
5619
  repository: platformAdapterAppRepositoryApi,
5743
5620
  deployment: platformAdapterAppDeploymentApi,
5744
5621
  storage: platformAdapterAppStorageApi,
5745
- logger: platformAdapterAppLoggerApi
5622
+ properties: platformAdapterAppPropertiesApi,
5623
+ widgets: platformAdapterAppWidgetsApi
5746
5624
  };
5747
5625
 
5748
5626
  // src/apis/platform/adapter/app/variables/api.ts
@@ -5755,7 +5633,7 @@ var platformAdapterAppVariablesApi = {
5755
5633
  params: {
5756
5634
  decrypted
5757
5635
  }
5758
- }, getPlatformAdapterClientConfig(authorization))
5636
+ }, getPlatformAdapterClientDefaultConfig(authorization))
5759
5637
  );
5760
5638
  return response.data;
5761
5639
  });
@@ -5764,7 +5642,7 @@ var platformAdapterAppVariablesApi = {
5764
5642
  return __async(this, null, function* () {
5765
5643
  const response = yield platformAdapterClientInstance.get(
5766
5644
  `/console/app/${appId}/variables/${key}`,
5767
- getPlatformAdapterClientConfig(authorization)
5645
+ getPlatformAdapterClientDefaultConfig(authorization)
5768
5646
  );
5769
5647
  return response.data;
5770
5648
  });
@@ -5774,7 +5652,7 @@ var platformAdapterAppVariablesApi = {
5774
5652
  yield platformAdapterClientInstance.post(
5775
5653
  `/console/app/${appId}/variables/${key}/sync`,
5776
5654
  payload,
5777
- getPlatformAdapterClientConfig(authorization)
5655
+ getPlatformAdapterClientDefaultConfig(authorization)
5778
5656
  );
5779
5657
  });
5780
5658
  },
@@ -5783,7 +5661,7 @@ var platformAdapterAppVariablesApi = {
5783
5661
  yield platformAdapterClientInstance.post(
5784
5662
  `/console/app/${appId}/variables/${data.key}`,
5785
5663
  data,
5786
- getPlatformAdapterClientConfig(authorization)
5664
+ getPlatformAdapterClientDefaultConfig(authorization)
5787
5665
  );
5788
5666
  });
5789
5667
  },
@@ -5792,7 +5670,7 @@ var platformAdapterAppVariablesApi = {
5792
5670
  yield platformAdapterClientInstance.post(
5793
5671
  `/console/app/${appId}/variables/${data.key}/edit`,
5794
5672
  data,
5795
- getPlatformAdapterClientConfig(authorization)
5673
+ getPlatformAdapterClientDefaultConfig(authorization)
5796
5674
  );
5797
5675
  });
5798
5676
  },
@@ -5805,284 +5683,87 @@ var platformAdapterAppVariablesApi = {
5805
5683
  }
5806
5684
  };
5807
5685
 
5808
- // src/apis/platform/adapter/app/creator/api.ts
5809
- var platformAdapterAppCreatorApi = {
5810
- app(payload, authorization) {
5811
- return __async(this, null, function* () {
5812
- try {
5813
- const response = yield platformAdapterClientInstance.post(
5814
- `/console/app/new/app`,
5815
- payload,
5816
- getPlatformAdapterClientConfig(authorization)
5817
- );
5818
- return response.data;
5819
- } catch (error) {
5820
- if (error instanceof Error) {
5821
- throw new Error(`App couldn't be created. [${error.message}]`);
5822
- }
5823
- throw error;
5824
- }
5825
- });
5826
- },
5827
- repository(payload, authorization) {
5828
- return __async(this, null, function* () {
5829
- try {
5830
- const response = yield platformAdapterClientInstance.post(
5831
- `/console/app/new/repository`,
5832
- payload,
5833
- getPlatformAdapterClientConfig(authorization)
5834
- );
5835
- return response.data;
5836
- } catch (error) {
5837
- if (error instanceof Error) {
5838
- throw new Error(`Repository couldn't be created. [${error.message}]`);
5839
- }
5840
- throw error;
5841
- }
5842
- });
5843
- },
5844
- seed(payload, authorization) {
5845
- return __async(this, null, function* () {
5846
- try {
5847
- const response = yield platformAdapterClientInstance.post(
5848
- `/console/app/new/seed`,
5849
- payload,
5850
- getPlatformAdapterClientConfig(authorization)
5851
- );
5852
- return response.data;
5853
- } catch (error) {
5854
- if (error instanceof Error) {
5855
- throw new Error(`Seed couldn't be created. [${error.message}]`);
5856
- }
5857
- throw error;
5858
- }
5859
- });
5860
- },
5861
- deployment(payload, authorization) {
5862
- return __async(this, null, function* () {
5863
- try {
5864
- const response = yield platformAdapterClientInstance.post(
5865
- `/console/app/new/deployment`,
5866
- payload,
5867
- getPlatformAdapterClientConfig(authorization)
5868
- );
5869
- return response.data;
5870
- } catch (error) {
5871
- if (error instanceof Error) {
5872
- throw new Error(`Deployment couldn't be created. [${error.message}]`);
5873
- }
5874
- throw error;
5875
- }
5876
- });
5877
- },
5878
- deployment_accessible(payload, authorization) {
5686
+ // src/apis/platform/adapter/app/templates/api.ts
5687
+ var platformAdapterAppTemplatesApi = {
5688
+ getTemplates(authorization) {
5879
5689
  return __async(this, null, function* () {
5880
5690
  try {
5881
- const response = yield platformAdapterClientInstance.post(
5882
- `/console/app/new/deployment_accessible`,
5883
- payload,
5884
- getPlatformAdapterClientConfig(authorization)
5691
+ const response = yield platformAdapterClientInstance.get(
5692
+ `/console/app/templates`,
5693
+ getPlatformAdapterClientDefaultConfig(authorization)
5885
5694
  );
5886
5695
  return response.data;
5887
5696
  } catch (error) {
5888
5697
  if (error instanceof Error) {
5889
5698
  throw new Error(
5890
- `Deployment accessibility couldn't be checked. [${error.message}]`
5699
+ `App templates couldn't be fetched. [${error.message}]`
5891
5700
  );
5892
5701
  }
5893
5702
  throw error;
5894
5703
  }
5895
5704
  });
5896
5705
  },
5897
- storage(payload, authorization) {
5706
+ getRepositoryTemplates(authorization) {
5898
5707
  return __async(this, null, function* () {
5899
5708
  try {
5900
- const response = yield platformAdapterClientInstance.post(
5901
- `/console/app/new/storage`,
5902
- payload,
5903
- getPlatformAdapterClientConfig(authorization)
5904
- );
5905
- return response.data;
5906
- } catch (error) {
5907
- if (error instanceof Error) {
5908
- throw new Error(`Storage couldn't be created. [${error.message}]`);
5909
- }
5910
- throw error;
5911
- }
5912
- });
5913
- },
5914
- authorization(payload, authorization) {
5915
- return __async(this, null, function* () {
5916
- try {
5917
- const response = yield platformAdapterClientInstance.post(
5918
- `/console/app/new/authorization`,
5919
- payload,
5920
- getPlatformAdapterClientConfig(authorization)
5709
+ const response = yield platformAdapterClientInstance.get(
5710
+ `/console/app/templates/repository`,
5711
+ getPlatformAdapterClientDefaultConfig(authorization)
5921
5712
  );
5922
5713
  return response.data;
5923
5714
  } catch (error) {
5924
5715
  if (error instanceof Error) {
5925
5716
  throw new Error(
5926
- `Authorization couldn't be created. [${error.message}]`
5717
+ `App repository templates couldn't be fetched. [${error.message}]`
5927
5718
  );
5928
5719
  }
5929
5720
  throw error;
5930
5721
  }
5931
5722
  });
5932
- },
5933
- widgets(payload, authorization) {
5934
- return __async(this, null, function* () {
5935
- try {
5936
- const response = yield platformAdapterClientInstance.post(
5937
- `/console/app/new/widgets`,
5938
- payload,
5939
- getPlatformAdapterClientConfig(authorization)
5940
- );
5941
- return response.data;
5942
- } catch (error) {
5943
- if (error instanceof Error) {
5944
- throw new Error(`Widgets couldn't be created. [${error.message}]`);
5945
- }
5946
- throw error;
5947
- }
5948
- });
5949
- },
5950
- properties(payload, authorization) {
5951
- return __async(this, null, function* () {
5952
- try {
5953
- const response = yield platformAdapterClientInstance.post(
5954
- `/console/app/new/properties`,
5955
- payload,
5956
- getPlatformAdapterClientConfig(authorization)
5957
- );
5958
- return response.data;
5959
- } catch (error) {
5960
- if (error instanceof Error) {
5961
- throw new Error(`Properties couldn't be created. [${error.message}]`);
5962
- }
5963
- throw error;
5964
- }
5965
- });
5966
- },
5967
- monetization(payload, authorization) {
5968
- return __async(this, null, function* () {
5969
- try {
5970
- const response = yield platformAdapterClientInstance.post(
5971
- `/console/app/new/monetization`,
5972
- payload,
5973
- getPlatformAdapterClientConfig(authorization)
5974
- );
5975
- return response.data;
5976
- } catch (error) {
5977
- if (error instanceof Error) {
5978
- throw new Error(`Monetization couldn't be created. [${error.message}]`);
5979
- }
5980
- throw error;
5981
- }
5982
- });
5983
5723
  }
5984
5724
  };
5985
5725
 
5986
- // src/apis/platform/adapter/app/manifest/api.ts
5987
- var platformAdapterAppManifestApi = {
5988
- getManifest(appId, authorization) {
5726
+ // src/apis/platform/adapter/app/api.ts
5727
+ var platformAdapterAppApi = {
5728
+ blocks: platformAdapterAppBlocksApi,
5729
+ variables: platformAdapterAppVariablesApi,
5730
+ templates: platformAdapterAppTemplatesApi,
5731
+ push(payload, authorization) {
5989
5732
  return __async(this, null, function* () {
5990
- try {
5991
- const response = yield platformAdapterClientInstance.get(
5992
- `/console/app/${appId}/manifest`,
5993
- getPlatformAdapterClientConfig(authorization)
5994
- );
5995
- return response.data;
5996
- } catch (error) {
5997
- if (error instanceof Error) {
5998
- throw new Error(`App manifest couldn't be created. [${error.message}]`);
5999
- }
6000
- throw error;
6001
- }
5733
+ return platformAdapterClientInstance.post(
5734
+ `/console/app${payload.manifest.id ? `/${payload.manifest.id}` : ""}`,
5735
+ payload,
5736
+ getPlatformAdapterClientDefaultConfig(authorization)
5737
+ );
6002
5738
  });
6003
5739
  },
6004
- pushManifest(manifest, authorization) {
5740
+ pull(appId, authorization) {
6005
5741
  return __async(this, null, function* () {
6006
- try {
6007
- yield platformAdapterClientInstance.post(
6008
- `/console/app/${manifest.id}/manifest`,
6009
- manifest,
6010
- getPlatformAdapterClientConfig(authorization)
6011
- );
6012
- } catch (error) {
6013
- if (error instanceof Error) {
6014
- throw new Error(`App manifest couldn't be pushed. [${error.message}]`);
6015
- }
6016
- throw error;
6017
- }
5742
+ return platformAdapterClientInstance.get(
5743
+ `/console/app/${appId}`,
5744
+ getPlatformAdapterClientDefaultConfig(authorization)
5745
+ );
6018
5746
  });
6019
5747
  },
6020
- verifyManifest(manifest, authorization) {
5748
+ verify(payload, authorization) {
6021
5749
  return __async(this, null, function* () {
6022
- try {
6023
- const response = yield platformAdapterClientInstance.post(
6024
- `/console/app/${manifest.id}/manifest/verify`,
6025
- manifest,
6026
- getPlatformAdapterClientConfig(authorization)
6027
- );
6028
- return response.data;
6029
- } catch (error) {
6030
- if (error instanceof Error) {
6031
- throw new Error(
6032
- `App manifest couldn't be verified. [${error.message}]`
6033
- );
6034
- }
6035
- throw error;
6036
- }
6037
- });
6038
- }
6039
- };
6040
-
6041
- // src/apis/platform/adapter/app/api.ts
6042
- var platformAdapterAppApi = {
6043
- creator: platformAdapterAppCreatorApi,
6044
- blocks: platformAdapterAppBlocksApi,
6045
- variables: platformAdapterAppVariablesApi,
6046
- manifest: platformAdapterAppManifestApi,
6047
- create(payload, authorization) {
6048
- return __async(this, null, function* () {
6049
- const response = yield platformAdapterClientInstance.post(
6050
- `/console/app/new`,
5750
+ return platformAdapterClientInstance.post(
5751
+ `/console/app/${payload.appId}/verify`,
6051
5752
  payload,
6052
- getPlatformAdapterClientConfig(authorization)
5753
+ getPlatformAdapterClientDefaultConfig(authorization)
6053
5754
  );
6054
- return response.data;
6055
5755
  });
6056
5756
  },
6057
- createStatus(sagaId, authorization) {
5757
+ status(sagaId, authorization) {
6058
5758
  return __async(this, null, function* () {
6059
- const response = yield platformAdapterClientInstance.get(
6060
- `/console/app/new/status`,
5759
+ return platformAdapterClientInstance.get(
5760
+ `/console/app/status`,
6061
5761
  __spreadValues({
6062
5762
  params: {
6063
5763
  sagaId
6064
5764
  }
6065
- }, getPlatformAdapterClientConfig(authorization))
5765
+ }, getPlatformAdapterClientDefaultConfig(authorization))
6066
5766
  );
6067
- return response.data;
6068
- });
6069
- },
6070
- getTemplates(authorization) {
6071
- return __async(this, null, function* () {
6072
- try {
6073
- const response = yield platformAdapterClientInstance.get(
6074
- `/console/app/templates`,
6075
- getPlatformAdapterClientConfig(authorization)
6076
- );
6077
- return response.data;
6078
- } catch (error) {
6079
- if (error instanceof Error) {
6080
- throw new Error(
6081
- `App templates couldn't be created. [${error.message}]`
6082
- );
6083
- }
6084
- throw error;
6085
- }
6086
5767
  });
6087
5768
  }
6088
5769
  };
@@ -6102,8 +5783,8 @@ var platformAdapterConductorApi = {
6102
5783
  };
6103
5784
 
6104
5785
  // src/apis/platform/billing/instance.ts
6105
- var import_axios16 = __toESM(require("axios"));
6106
- var platformBillingClientInstance = import_axios16.default.create({
5786
+ var import_axios15 = __toESM(require("axios"));
5787
+ var platformBillingClientInstance = import_axios15.default.create({
6107
5788
  baseURL: "https://billing.labs.livechatinc.com"
6108
5789
  });
6109
5790
  function getPlatformBillingClientAuthorization(req) {
@@ -6123,10 +5804,10 @@ function getPlatformBillingClientConfig(options = {}) {
6123
5804
  function initPlatformBillingClientInstance(baseUrl, token) {
6124
5805
  if (baseUrl) {
6125
5806
  platformBillingClientInstance.interceptors.request.use(
6126
- (config) => __async(this, null, function* () {
5807
+ (config) => {
6127
5808
  config.baseURL = baseUrl;
6128
5809
  return config;
6129
- }),
5810
+ },
6130
5811
  (error) => Promise.reject(error)
6131
5812
  );
6132
5813
  }
@@ -6292,7 +5973,7 @@ var api = {
6292
5973
  isInitialized: false
6293
5974
  };
6294
5975
  function initApi(config, tokens) {
6295
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
5976
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
6296
5977
  initPlatformAccountsClientInstance(
6297
5978
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
6298
5979
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.dps
@@ -6318,28 +5999,36 @@ function initApi(config, tokens) {
6318
5999
  netlify: (_k = tokens.netlify) == null ? void 0 : _k.token,
6319
6000
  vercel: (_l = tokens.vercel) == null ? void 0 : _l.token,
6320
6001
  neon: (_m = tokens.neon) == null ? void 0 : _m.token,
6321
- planetscale: (_n = tokens.planetscale) == null ? void 0 : _n.token,
6322
- sentry: (_o = tokens.sentry) == null ? void 0 : _o.token
6002
+ planetscale: (_n = tokens.planetscale) == null ? void 0 : _n.token
6323
6003
  } : void 0
6324
6004
  );
6325
6005
  initLiveChatClientInstance(
6326
- (_p = config.urls.products) == null ? void 0 : _p.livechat,
6327
- (_q = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _q.dps
6006
+ (_o = config.urls.products) == null ? void 0 : _o.livechat,
6007
+ (_p = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _p.dps
6328
6008
  );
6329
- initTextClientInstance((_r = config.urls.integrations) == null ? void 0 : _r.text, (_s = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _s.dps);
6330
- initGithubClientInstance((_t = tokens == null ? void 0 : tokens.github) == null ? void 0 : _t.apps);
6331
- initNetlifyClientInstance((_u = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _u.token);
6332
- initVercelClientInstance((_v = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _v.token);
6333
- initNeonClientInstance((_w = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _w.token);
6334
- initPlanetScaleClientInstance((_x = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _x.token);
6335
- initSentryClientInstance((_y = tokens == null ? void 0 : tokens.sentry) == null ? void 0 : _y.token);
6009
+ initTextClientInstance((_q = config.urls.integrations) == null ? void 0 : _q.text, (_r = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _r.dps);
6010
+ initGithubClientInstance((_s = tokens == null ? void 0 : tokens.github) == null ? void 0 : _s.apps);
6011
+ initNetlifyClientInstance((_t = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _t.token);
6012
+ initVercelClientInstance((_u = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _u.token);
6013
+ initNeonClientInstance((_v = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _v.token);
6014
+ initPlanetScaleClientInstance((_w = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _w.token);
6336
6015
  api.isInitialized = true;
6337
6016
  }
6338
6017
  // Annotate the CommonJS export names for ESM import in node:
6339
6018
  0 && (module.exports = {
6340
6019
  API_NOTIFICATIONS,
6020
+ AccountsApiError,
6021
+ AdapterApiError,
6022
+ ApiErrorBase,
6023
+ DpsApiError,
6341
6024
  UnauthorizeApiError,
6025
+ allAppTemplates,
6342
6026
  api,
6027
+ appBaseTemplates,
6028
+ appRepositoryTemplates,
6029
+ appRepositoryTemplatesMap,
6030
+ appTemplates,
6031
+ appTemplatesMap,
6343
6032
  getAppAutoReviewPayload,
6344
6033
  getEmptyAppAutoReview,
6345
6034
  getGitHubClientAuthorization,
@@ -6356,14 +6045,13 @@ function initApi(config, tokens) {
6356
6045
  getPlatformAccountsClientConfig,
6357
6046
  getPlatformAdapterClientAuthorization,
6358
6047
  getPlatformAdapterClientConfig,
6048
+ getPlatformAdapterClientDefaultConfig,
6359
6049
  getPlatformBillingClientAuthorization,
6360
6050
  getPlatformBillingClientConfig,
6361
6051
  getPlatformDpsAdminClientAuthorization,
6362
6052
  getPlatformDpsClientAuthorization,
6363
6053
  getPlatformDpsClientConfig,
6364
6054
  getRegion,
6365
- getSentryClientAuthorization,
6366
- getSentryClientConfig,
6367
6055
  getTextClientAuthorization,
6368
6056
  getTextClientConfig,
6369
6057
  getVercelClientAuthorization,
@@ -6379,7 +6067,6 @@ function initApi(config, tokens) {
6379
6067
  initPlatformAdapterClientInstance,
6380
6068
  initPlatformBillingClientInstance,
6381
6069
  initPlatformDpsClientInstance,
6382
- initSentryClientInstance,
6383
6070
  initTextClientInstance,
6384
6071
  initVercelClientInstance,
6385
6072
  livechatClientInstance,
@@ -6390,14 +6077,12 @@ function initApi(config, tokens) {
6390
6077
  platformAdapterClientInstance,
6391
6078
  platformBillingClientInstance,
6392
6079
  platformDpsClientInstance,
6393
- sentryClientInstance,
6394
6080
  textClientInstance,
6395
6081
  updateGithubClientInstance,
6396
6082
  updateNeonClientInstance,
6397
6083
  updateNetlifyClientInstance,
6398
6084
  updatePlanetScaleClientInstance,
6399
6085
  updatePlatformAdapterClientInstance,
6400
- updateSentryClientInstance,
6401
6086
  updateVercelClientInstance,
6402
6087
  vercelClientInstance
6403
6088
  });