@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.mjs CHANGED
@@ -106,20 +106,6 @@ var PLANETSCALE_CONFIG = {
106
106
  }
107
107
  };
108
108
 
109
- // ../../private/config/src/integrations/sentry.ts
110
- var SENTRY_CONFIG = {
111
- github_app_client_name: "sentry-io",
112
- app: process.env.NEXT_PUBLIC_PLATFORM_ENV === "prod" ? {
113
- client_id: "8c8296fe87cb446e9ded22f8b6f4b078363500062155476490d4583b5406d30a",
114
- client_secret: process.env.SENTRY_CLIENT_SECRET,
115
- redirect_uri: "https://platform.text.com/console-adapter/integrations/sentry/callbacks/oauth"
116
- } : {
117
- client_id: "d35803a39bab43b3b6dbe0b89cb99dc54689c35a74dd442baaef0f5b9b0d70bc",
118
- client_secret: process.env.SENTRY_CLIENT_SECRET_LABS,
119
- redirect_uri: "https://platform.labs.text.com/console-adapter/integrations/sentry/callbacks/oauth"
120
- }
121
- };
122
-
123
109
  // ../../private/config/src/integrations/vercel.ts
124
110
  var VERCEL_CONFIG = {
125
111
  github_app_client_name: "vercel",
@@ -140,10 +126,25 @@ var VERCEL_CONFIG = {
140
126
  import axios from "axios";
141
127
 
142
128
  // src/types/errors/api.ts
129
+ var ApiErrorBase = class extends Error {
130
+ constructor(message, data, code) {
131
+ super(message);
132
+ this.message = message;
133
+ this.data = data;
134
+ this.code = code;
135
+ this.kind = "error";
136
+ }
137
+ withCustomMessage(message) {
138
+ return new this.constructor(message, this.data, this.code);
139
+ }
140
+ };
143
141
  var UnauthorizeApiError = class extends Error {
144
- constructor(source) {
145
- super("Unauthorized API call");
142
+ constructor(source, message = "Unauthorized API call") {
143
+ super(message);
146
144
  this.source = source;
145
+ this.message = message;
146
+ this.kind = "unauthorized";
147
+ this.code = 401;
147
148
  }
148
149
  };
149
150
 
@@ -278,13 +279,9 @@ var gitHubRepositoryApi = {
278
279
  ensureAuthorizationToken: true
279
280
  })
280
281
  );
281
- const branch = response.data.find(
282
+ return response.data.find(
282
283
  (innerBranch) => innerBranch.name === repositoryBranch
283
284
  );
284
- if (!branch) {
285
- throw new Error("Branch not found");
286
- }
287
- return branch;
288
285
  });
289
286
  },
290
287
  getRepositorySeed(repositoryName, authorization) {
@@ -740,25 +737,6 @@ var netlifyAccountApi = {
740
737
  }
741
738
  });
742
739
  },
743
- addAccountSentryTokenEnv(siteId, token, authorization) {
744
- return __async(this, null, function* () {
745
- const accounts = yield netlifyClientInstance.get(
746
- `/accounts`,
747
- getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
748
- ensureAuthorizationToken: true
749
- }))
750
- );
751
- const accountId = accounts.data[0].id;
752
- yield this.createAccountEnv(
753
- accountId,
754
- siteId,
755
- "SENTRY_AUTH_TOKEN",
756
- token,
757
- void 0,
758
- authorization
759
- );
760
- });
761
- },
762
740
  removeAccountEnv(accountId, siteId, envKey, authorization) {
763
741
  return __async(this, null, function* () {
764
742
  let targetAccountId = accountId;
@@ -922,23 +900,20 @@ var netlifySiteApi = {
922
900
  },
923
901
  createSiteByInstallationId(name, repositoryFullName, target, installationId, branch, authorization) {
924
902
  return __async(this, null, function* () {
925
- const config = (
926
- // eslint-disable-next-line no-nested-ternary -- fix me
927
- target === "nextjs" ? {
928
- plugins: ["@netlify/plugin-nextjs"],
929
- packages: [{ package: "@netlify/plugin-nextjs" }],
930
- dir: ".next",
931
- cmd: "npm run build"
932
- } : target === "node" ? {
933
- plugins: [],
934
- dir: "dist",
935
- cmd: "npm run build"
936
- } : {
937
- plugin: [],
938
- dir: ".",
939
- cmd: ""
940
- }
941
- );
903
+ const config = target === "nextjs" ? {
904
+ plugins: ["@netlify/plugin-nextjs"],
905
+ packages: [{ package: "@netlify/plugin-nextjs" }],
906
+ dir: ".next",
907
+ cmd: "npm run build"
908
+ } : target === "node" ? {
909
+ plugins: [],
910
+ dir: "dist",
911
+ cmd: "npm run build"
912
+ } : {
913
+ plugin: [],
914
+ dir: ".",
915
+ cmd: ""
916
+ };
942
917
  const response = yield netlifyClientInstance.post(
943
918
  `/sites`,
944
919
  {
@@ -969,22 +944,19 @@ var netlifySiteApi = {
969
944
  },
970
945
  createSiteByDeployKey(name, repositoryFullName, target, deployKeyId, branch, authorization) {
971
946
  return __async(this, null, function* () {
972
- const config = (
973
- // eslint-disable-next-line no-nested-ternary -- fix me
974
- target === "nextjs" ? {
975
- packages: [{ package: "@netlify/plugin-nextjs" }],
976
- dir: ".next",
977
- cmd: "npm run build"
978
- } : target === "node" ? {
979
- packages: [],
980
- dir: "dist",
981
- cmd: "npm run build"
982
- } : {
983
- packages: [],
984
- dir: ".",
985
- cmd: ""
986
- }
987
- );
947
+ const config = target === "nextjs" ? {
948
+ packages: [{ package: "@netlify/plugin-nextjs" }],
949
+ dir: ".next",
950
+ cmd: "npm run build"
951
+ } : target === "node" ? {
952
+ packages: [],
953
+ dir: "dist",
954
+ cmd: "npm run build"
955
+ } : {
956
+ packages: [],
957
+ dir: ".",
958
+ cmd: ""
959
+ };
988
960
  const response = yield netlifyClientInstance.post(
989
961
  `/sites`,
990
962
  {
@@ -1060,84 +1032,6 @@ var netlifySiteApi = {
1060
1032
  }))
1061
1033
  );
1062
1034
  });
1063
- },
1064
- addSentryPluginToSite(siteId, projectOrg, projectName, projectKey, token, authorization) {
1065
- return __async(this, null, function* () {
1066
- yield netlifyClientInstance.put(
1067
- `/sites/${siteId}`,
1068
- {
1069
- plugins: [
1070
- {
1071
- package: "@netlify/plugin-nextjs"
1072
- },
1073
- {
1074
- package: "@sentry/netlify-build-plugin"
1075
- }
1076
- ]
1077
- },
1078
- getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
1079
- ensureAuthorizationToken: true
1080
- }))
1081
- );
1082
- const accountId = yield netlifyAccountApi.getAccount(authorization);
1083
- if (!accountId) {
1084
- throw new Error("Account is missing");
1085
- }
1086
- const snippets = yield this.getSiteSnippets(siteId, authorization);
1087
- const envs = yield netlifyAccountApi.getAccountEnvs(
1088
- accountId,
1089
- siteId,
1090
- authorization
1091
- );
1092
- if (token) {
1093
- yield netlifyAccountApi.createAccountEnv(
1094
- accountId,
1095
- siteId,
1096
- "SENTRY_AUTH_TOKEN",
1097
- token,
1098
- envs,
1099
- authorization
1100
- );
1101
- }
1102
- yield netlifyAccountApi.createAccountEnv(
1103
- accountId,
1104
- siteId,
1105
- "SENTRY_ORG",
1106
- projectOrg,
1107
- envs,
1108
- authorization
1109
- );
1110
- yield netlifyAccountApi.createAccountEnv(
1111
- accountId,
1112
- siteId,
1113
- "SENTRY_PROJECT",
1114
- projectName,
1115
- envs,
1116
- authorization
1117
- );
1118
- const currentSnippet = snippets.find(
1119
- (snippet) => snippet.title === "sentry"
1120
- );
1121
- if (currentSnippet) {
1122
- yield netlifyClientInstance.delete(
1123
- `sites/${siteId}/snippets/${currentSnippet.id}`,
1124
- getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
1125
- ensureAuthorizationToken: true
1126
- }))
1127
- );
1128
- }
1129
- yield netlifyClientInstance.post(
1130
- `sites/${siteId}/snippets`,
1131
- {
1132
- general_position: "footer",
1133
- title: "sentry",
1134
- general: `<script src='https://js.sentry-cdn.com/${projectKey}.min.js' crossorigin="anonymous"></script>`
1135
- },
1136
- getNetlifyClientConfig(__spreadProps(__spreadValues({}, authorization), {
1137
- ensureAuthorizationToken: true
1138
- }))
1139
- );
1140
- });
1141
1035
  }
1142
1036
  };
1143
1037
 
@@ -1376,286 +1270,9 @@ var planetscaleApi = {
1376
1270
  }
1377
1271
  };
1378
1272
 
1379
- // src/apis/integrations/sentry/instance.ts
1380
- import axios6 from "axios";
1381
- var sentryClientInstance = axios6.create({
1382
- baseURL: "https://sentry.io/api/0/",
1383
- headers: {
1384
- "Content-Type": "application/json"
1385
- }
1386
- });
1387
- sentryClientInstance.interceptors.response.use(
1388
- (r) => r,
1389
- (error) => {
1390
- var _a;
1391
- if (axios6.isAxiosError(error)) {
1392
- if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
1393
- throw new UnauthorizeApiError("sentry");
1394
- }
1395
- }
1396
- throw error;
1397
- }
1398
- );
1399
- function getSentryClientAuthorization(req) {
1400
- return {
1401
- token: req.headers["sentry-token"]
1402
- };
1403
- }
1404
- function getSentryClientConfig(options = {}) {
1405
- const currentHeaders = sentryClientInstance.defaults.headers;
1406
- const defaultAuthorization = currentHeaders.Authorization;
1407
- const headers = {
1408
- authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
1409
- };
1410
- if (options.ensureAuthorizationToken && !headers.authorization) {
1411
- throw new UnauthorizeApiError("sentry");
1412
- }
1413
- return {
1414
- headers: __spreadValues({}, headers.authorization ? { Authorization: headers.authorization } : {})
1415
- };
1416
- }
1417
- function initSentryClientInstance(token) {
1418
- updateSentryClientInstance(token);
1419
- if (token) {
1420
- updateSentryClientInstance(token);
1421
- }
1422
- }
1423
- function updateSentryClientInstance(token) {
1424
- const headers = sentryClientInstance.defaults.headers;
1425
- if (token) {
1426
- headers.Authorization = `Bearer ${token}`;
1427
- } else {
1428
- delete headers.Authorization;
1429
- }
1430
- }
1431
-
1432
- // src/apis/integrations/sentry/api.ts
1433
- var sentryApi = {
1434
- getTeam(teamSlug, authorization) {
1435
- return __async(this, null, function* () {
1436
- const response = yield sentryClientInstance.get(
1437
- `/teams/${teamSlug}/`,
1438
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1439
- ensureAuthorizationToken: true
1440
- }))
1441
- );
1442
- return response.data;
1443
- });
1444
- },
1445
- getOrganizations(authorization) {
1446
- return __async(this, null, function* () {
1447
- const response = yield sentryClientInstance.get(
1448
- "/organizations/",
1449
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1450
- ensureAuthorizationToken: true
1451
- }))
1452
- );
1453
- return response.data;
1454
- });
1455
- },
1456
- getOrganization(organizationSlug, authorization) {
1457
- return __async(this, null, function* () {
1458
- const response = yield sentryClientInstance.get(
1459
- `/organizations/${organizationSlug}/`,
1460
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1461
- ensureAuthorizationToken: true
1462
- }))
1463
- );
1464
- return response.data;
1465
- });
1466
- },
1467
- getOrganizationRepos(organizationSlug, authorization) {
1468
- return __async(this, null, function* () {
1469
- const response = yield sentryClientInstance.get(
1470
- `/organizations/${organizationSlug}/repos/`,
1471
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1472
- ensureAuthorizationToken: true
1473
- }))
1474
- );
1475
- return response.data;
1476
- });
1477
- },
1478
- getOrganizationIntegrations(organizationSlug, authorization) {
1479
- return __async(this, null, function* () {
1480
- const response = yield sentryClientInstance.get(
1481
- `/organizations/${organizationSlug}/integrations/`,
1482
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1483
- ensureAuthorizationToken: true
1484
- }))
1485
- );
1486
- return response.data;
1487
- });
1488
- },
1489
- getProjects(authorization) {
1490
- return __async(this, null, function* () {
1491
- const response = yield sentryClientInstance.get(
1492
- "/projects/",
1493
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1494
- ensureAuthorizationToken: true
1495
- }))
1496
- );
1497
- return response.data;
1498
- });
1499
- },
1500
- getProject(projectFullName, authorization) {
1501
- return __async(this, null, function* () {
1502
- const response = yield sentryClientInstance.get(
1503
- `/projects/${projectFullName}/`,
1504
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1505
- ensureAuthorizationToken: true
1506
- }))
1507
- );
1508
- return response.data;
1509
- });
1510
- },
1511
- getProjectIssues(projectFullName, authorization) {
1512
- return __async(this, null, function* () {
1513
- const response = yield sentryClientInstance.get(
1514
- `/projects/${projectFullName}/issues/`,
1515
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1516
- ensureAuthorizationToken: true
1517
- }))
1518
- );
1519
- return response.data;
1520
- });
1521
- },
1522
- getProjectIssueLatestEvent(issueId, authorization) {
1523
- return __async(this, null, function* () {
1524
- const response = yield sentryClientInstance.get(
1525
- `/issues/${issueId}/events/latest/`,
1526
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1527
- ensureAuthorizationToken: true
1528
- }))
1529
- );
1530
- return response.data;
1531
- });
1532
- },
1533
- getProjectKeys(projectFullName, authorization) {
1534
- return __async(this, null, function* () {
1535
- const response = yield sentryClientInstance.get(
1536
- `/projects/${projectFullName}/keys/`,
1537
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1538
- ensureAuthorizationToken: true
1539
- }))
1540
- );
1541
- return response.data;
1542
- });
1543
- },
1544
- createTeam(organizationSlug, teamName, authorization) {
1545
- return __async(this, null, function* () {
1546
- const { data: team } = yield sentryClientInstance.post(
1547
- `/organizations/${organizationSlug}/teams/`,
1548
- {
1549
- name: teamName,
1550
- slug: teamName
1551
- },
1552
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1553
- ensureAuthorizationToken: true
1554
- }))
1555
- );
1556
- return team;
1557
- });
1558
- },
1559
- createRepo(organizationSlug, projectId, repositoryFullName, repositoryBranch, githubIntegrationId, authorization) {
1560
- return __async(this, null, function* () {
1561
- var _a, _b;
1562
- let repository;
1563
- try {
1564
- const response = yield sentryClientInstance.post(
1565
- `/organizations/${organizationSlug}/repos/`,
1566
- {
1567
- installation: githubIntegrationId,
1568
- identifier: repositoryFullName,
1569
- provider: "integrations:github"
1570
- },
1571
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1572
- ensureAuthorizationToken: true
1573
- }))
1574
- );
1575
- repository = response.data;
1576
- } catch (err) {
1577
- const error = err;
1578
- if (((_a = error.response) == null ? void 0 : _a.data.error_type) === "validation" || ((_b = error.response) == null ? void 0 : _b.data.error_type) === "unknown") {
1579
- throw error;
1580
- }
1581
- const response = yield sentryClientInstance.get(
1582
- `/organizations/${organizationSlug}/repos/`,
1583
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1584
- ensureAuthorizationToken: true
1585
- }))
1586
- );
1587
- repository = response.data.find(
1588
- (repo) => repo.externalSlug === repositoryFullName
1589
- );
1590
- }
1591
- if (!repository) {
1592
- throw new Error("Couldn't get repository");
1593
- }
1594
- try {
1595
- yield sentryClientInstance.post(
1596
- `/organizations/${organizationSlug}/code-mappings/`,
1597
- {
1598
- defaultBranch: repositoryBranch,
1599
- stackRoot: "",
1600
- sourceRoot: "",
1601
- repositoryId: repository.id,
1602
- integrationId: githubIntegrationId,
1603
- projectId
1604
- },
1605
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1606
- ensureAuthorizationToken: true
1607
- }))
1608
- );
1609
- } catch (e) {
1610
- }
1611
- });
1612
- },
1613
- createProject(organizationSlug, appName, authorization) {
1614
- return __async(this, null, function* () {
1615
- var _a;
1616
- const name = appName.toLowerCase();
1617
- try {
1618
- yield this.createTeam(organizationSlug, name, authorization);
1619
- } catch (e) {
1620
- }
1621
- try {
1622
- const response = yield sentryClientInstance.post(
1623
- `/teams/${organizationSlug}/${name}/projects/`,
1624
- {
1625
- name,
1626
- slug: name
1627
- },
1628
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1629
- ensureAuthorizationToken: true
1630
- }))
1631
- );
1632
- return yield this.getProject(
1633
- `${organizationSlug}/${response.data.slug}`,
1634
- authorization
1635
- );
1636
- } catch (error) {
1637
- if (((_a = error.response) == null ? void 0 : _a.status) === 409) {
1638
- return this.getProject(`${organizationSlug}/${name}`, authorization);
1639
- }
1640
- throw error;
1641
- }
1642
- });
1643
- },
1644
- deleteProject(projectFullName, authorization) {
1645
- return __async(this, null, function* () {
1646
- yield sentryClientInstance.delete(
1647
- `/projects/${projectFullName}/`,
1648
- getSentryClientConfig(__spreadProps(__spreadValues({}, authorization), {
1649
- ensureAuthorizationToken: true
1650
- }))
1651
- );
1652
- });
1653
- }
1654
- };
1655
-
1656
1273
  // src/apis/integrations/text/instance.ts
1657
- import axios7 from "axios";
1658
- var textClientInstance = axios7.create({
1274
+ import axios6 from "axios";
1275
+ var textClientInstance = axios6.create({
1659
1276
  baseURL: "https://api.labs.text.com"
1660
1277
  });
1661
1278
  function getTextClientAuthorization(req) {
@@ -1969,6 +1586,12 @@ var textPlatformDashboardApi = {
1969
1586
  value.forEach((innerValue) => {
1970
1587
  searchParams.append(key, innerValue);
1971
1588
  });
1589
+ } else if (key === "is_source_private") {
1590
+ const value = params[key];
1591
+ if (typeof value !== "boolean") {
1592
+ return;
1593
+ }
1594
+ searchParams.append(key, value.toString());
1972
1595
  } else {
1973
1596
  const value = params[key];
1974
1597
  if (!value) {
@@ -2052,18 +1675,18 @@ var textApi = {
2052
1675
  };
2053
1676
 
2054
1677
  // src/apis/integrations/vercel/api.ts
2055
- import axios9 from "axios";
1678
+ import axios8 from "axios";
2056
1679
 
2057
1680
  // src/apis/integrations/vercel/instance.ts
2058
- import axios8 from "axios";
2059
- var vercelClientInstance = axios8.create({
1681
+ import axios7 from "axios";
1682
+ var vercelClientInstance = axios7.create({
2060
1683
  baseURL: "https://api.vercel.com"
2061
1684
  });
2062
1685
  vercelClientInstance.interceptors.response.use(
2063
1686
  (r) => r,
2064
1687
  (error) => {
2065
1688
  var _a, _b;
2066
- if (axios8.isAxiosError(error)) {
1689
+ if (axios7.isAxiosError(error)) {
2067
1690
  if (((_a = error.response) == null ? void 0 : _a.status) === 401 || ((_b = error.response) == null ? void 0 : _b.status) === 403) {
2068
1691
  throw new UnauthorizeApiError("vercel");
2069
1692
  }
@@ -2352,7 +1975,7 @@ var vercelApi = {
2352
1975
  client_secret: clientSecret,
2353
1976
  redirect_uri: redirectUrl
2354
1977
  });
2355
- const response = yield axios9.post("https://api.vercel.com/v2/oauth/access_token", data, {
1978
+ const response = yield axios8.post("https://api.vercel.com/v2/oauth/access_token", data, {
2356
1979
  headers: {
2357
1980
  "Content-Type": "application/x-www-form-urlencoded"
2358
1981
  }
@@ -2368,18 +1991,18 @@ var vercelApi = {
2368
1991
  };
2369
1992
 
2370
1993
  // src/apis/integrations/neon/api.ts
2371
- import axios11 from "axios";
1994
+ import axios10 from "axios";
2372
1995
 
2373
1996
  // src/apis/integrations/neon/instance.ts
2374
- import axios10 from "axios";
2375
- var neonClientInstance = axios10.create({
1997
+ import axios9 from "axios";
1998
+ var neonClientInstance = axios9.create({
2376
1999
  baseURL: "https://console.neon.tech/api/v2/"
2377
2000
  });
2378
2001
  neonClientInstance.interceptors.response.use(
2379
2002
  (r) => r,
2380
2003
  (error) => {
2381
2004
  var _a;
2382
- if (axios10.isAxiosError(error)) {
2005
+ if (axios9.isAxiosError(error)) {
2383
2006
  if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2384
2007
  throw new UnauthorizeApiError("neon");
2385
2008
  }
@@ -2592,7 +2215,7 @@ var neonApi = {
2592
2215
  redirect_uri: redirectUri,
2593
2216
  grant_type: "authorization_code"
2594
2217
  });
2595
- const response = yield axios11.post(
2218
+ const response = yield axios10.post(
2596
2219
  "https://oauth2.neon.tech/oauth2/token",
2597
2220
  data,
2598
2221
  {
@@ -2617,7 +2240,7 @@ var neonApi = {
2617
2240
  client_secret: clientSecret,
2618
2241
  grant_type: "refresh_token"
2619
2242
  });
2620
- const response = yield axios11.post("https://oauth2.neon.tech/oauth2/token", data, {
2243
+ const response = yield axios10.post("https://oauth2.neon.tech/oauth2/token", data, {
2621
2244
  headers: {
2622
2245
  "Content-Type": "application/x-www-form-urlencoded"
2623
2246
  }
@@ -2638,12 +2261,11 @@ var integrationsApi = {
2638
2261
  vercel: vercelApi,
2639
2262
  neon: neonApi,
2640
2263
  planetscale: planetscaleApi,
2641
- sentry: sentryApi,
2642
2264
  text: textApi
2643
2265
  };
2644
2266
 
2645
2267
  // src/apis/products/livechat/instance.ts
2646
- import axios12 from "axios";
2268
+ import axios11 from "axios";
2647
2269
  var REGION = {
2648
2270
  FRA: "fra",
2649
2271
  DAL: "dal",
@@ -2657,7 +2279,7 @@ var getRegion = (token) => {
2657
2279
  return region;
2658
2280
  }
2659
2281
  };
2660
- var livechatClientInstance = axios12.create({
2282
+ var livechatClientInstance = axios11.create({
2661
2283
  baseURL: "https://api.labs.livechatinc.com"
2662
2284
  });
2663
2285
  function getLiveChatClientAuthorization(req) {
@@ -3155,17 +2777,39 @@ var productsApi = {
3155
2777
  };
3156
2778
 
3157
2779
  // src/apis/platform/accounts/instance.ts
3158
- import axios13 from "axios";
3159
- var platformAccountsClientInstance = axios13.create({
2780
+ import axios12 from "axios";
2781
+ var AccountsApiError = class extends ApiErrorBase {
2782
+ constructor() {
2783
+ super(...arguments);
2784
+ this.name = "accounts";
2785
+ }
2786
+ };
2787
+ var platformAccountsClientInstance = axios12.create({
3160
2788
  baseURL: "https://accounts.labs.livechatinc.com"
3161
2789
  });
2790
+ platformAccountsClientInstance.interceptors.response.use(
2791
+ (response) => response,
2792
+ (error) => {
2793
+ var _a, _b, _c, _d;
2794
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2795
+ return Promise.reject(new UnauthorizeApiError("accounts"));
2796
+ }
2797
+ return Promise.reject(
2798
+ new AccountsApiError(
2799
+ error.message,
2800
+ (_b = error.response) == null ? void 0 : _b.data,
2801
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
2802
+ )
2803
+ );
2804
+ }
2805
+ );
3162
2806
  function getPlatformAccountsClientAuthorization(req) {
3163
2807
  return {
3164
2808
  token: req.headers["platform-accounts-token"]
3165
2809
  };
3166
2810
  }
3167
2811
  function getPlatformAccountsClientConfig(options = {}) {
3168
- const defaultAuthorization = platformAccountsClientInstance.defaults.headers["Authorization"];
2812
+ const defaultAuthorization = platformAccountsClientInstance.defaults.headers.Authorization;
3169
2813
  const headers = {
3170
2814
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
3171
2815
  };
@@ -3176,17 +2820,17 @@ function getPlatformAccountsClientConfig(options = {}) {
3176
2820
  function initPlatformAccountsClientInstance(baseUrl, token) {
3177
2821
  if (baseUrl) {
3178
2822
  platformAccountsClientInstance.interceptors.request.use(
3179
- (config) => __async(this, null, function* () {
2823
+ (config) => {
3180
2824
  config.baseURL = baseUrl;
3181
2825
  return config;
3182
- }),
2826
+ },
3183
2827
  (error) => Promise.reject(error)
3184
2828
  );
3185
2829
  }
3186
2830
  if (token) {
3187
- platformAccountsClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
2831
+ platformAccountsClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
3188
2832
  } else {
3189
- delete platformAccountsClientInstance.defaults.headers["Authorization"];
2833
+ delete platformAccountsClientInstance.defaults.headers.Authorization;
3190
2834
  }
3191
2835
  }
3192
2836
 
@@ -3194,50 +2838,32 @@ function initPlatformAccountsClientInstance(baseUrl, token) {
3194
2838
  var platformAccountsAccountApi = {
3195
2839
  getAccounts(authorization) {
3196
2840
  return __async(this, null, function* () {
3197
- try {
3198
- return yield platformAccountsClientInstance.get(
3199
- `/v2/accounts`,
3200
- getPlatformAccountsClientConfig(authorization)
3201
- );
3202
- } catch (error) {
3203
- if (error instanceof Error) {
3204
- throw new Error(`Accounts couldn't be fetched. [${error.message}]`);
3205
- } else {
3206
- throw error;
3207
- }
3208
- }
2841
+ return platformAccountsClientInstance.get(
2842
+ `/v2/accounts`,
2843
+ getPlatformAccountsClientConfig(authorization)
2844
+ ).catch((error) => {
2845
+ throw error.withCustomMessage("Accounts couldn't be fetched.");
2846
+ });
3209
2847
  });
3210
2848
  },
3211
2849
  getAccount(accountId, authorization) {
3212
2850
  return __async(this, null, function* () {
3213
- try {
3214
- return yield platformAccountsClientInstance.get(
3215
- `/v2/accounts/${accountId}`,
3216
- getPlatformAccountsClientConfig(authorization)
3217
- );
3218
- } catch (error) {
3219
- if (error instanceof Error) {
3220
- throw new Error(`Account couldn't be fetched. [${error.message}]`);
3221
- } else {
3222
- throw error;
3223
- }
3224
- }
2851
+ return platformAccountsClientInstance.get(
2852
+ `/v2/accounts/${accountId}`,
2853
+ getPlatformAccountsClientConfig(authorization)
2854
+ ).catch((error) => {
2855
+ throw error.withCustomMessage("Account couldn't be fetched.");
2856
+ });
3225
2857
  });
3226
2858
  },
3227
2859
  getMeAccount(authorization) {
3228
2860
  return __async(this, null, function* () {
3229
- try {
3230
- return yield platformAccountsClientInstance.get(
3231
- `/v2/accounts/me`,
3232
- getPlatformAccountsClientConfig(authorization)
3233
- );
3234
- } catch (error) {
3235
- if (error instanceof Error) {
3236
- throw new Error(`Account couldn't be fetched. [${error.message}]`);
3237
- } else {
3238
- throw error;
3239
- }
3240
- }
2861
+ return platformAccountsClientInstance.get(
2862
+ `/v2/accounts/me`,
2863
+ getPlatformAccountsClientConfig(authorization)
2864
+ ).catch((error) => {
2865
+ throw error.withCustomMessage("Account couldn't be fetched.");
2866
+ });
3241
2867
  });
3242
2868
  }
3243
2869
  };
@@ -3246,141 +2872,90 @@ var platformAccountsAccountApi = {
3246
2872
  var platformAccountsClientApi = {
3247
2873
  getClients(authorization) {
3248
2874
  return __async(this, null, function* () {
3249
- try {
3250
- return yield platformAccountsClientInstance.get(
3251
- `/v2/clients`,
3252
- getPlatformAccountsClientConfig(authorization)
3253
- );
3254
- } catch (error) {
3255
- if (error instanceof Error) {
3256
- throw new Error(`Clients couldn't be fetched. [${error.message}]`);
3257
- } else {
3258
- throw error;
3259
- }
3260
- }
2875
+ return platformAccountsClientInstance.get(
2876
+ `/v2/clients`,
2877
+ getPlatformAccountsClientConfig(authorization)
2878
+ ).catch((error) => {
2879
+ throw error.withCustomMessage("Clients couldn't be fetched.");
2880
+ });
3261
2881
  });
3262
2882
  },
3263
2883
  getClient(clientId, authorization) {
3264
2884
  return __async(this, null, function* () {
3265
- try {
3266
- return yield platformAccountsClientInstance.get(
3267
- `/v2/clients/${clientId}`,
3268
- getPlatformAccountsClientConfig(authorization)
3269
- );
3270
- } catch (error) {
3271
- if (error instanceof Error) {
3272
- throw new Error(`Client couldn't be fetched. [${error.message}]`);
3273
- } else {
3274
- throw error;
3275
- }
3276
- }
2885
+ return platformAccountsClientInstance.get(
2886
+ `/v2/clients/${clientId}`,
2887
+ getPlatformAccountsClientConfig(authorization)
2888
+ ).catch((error) => {
2889
+ throw error.withCustomMessage("Client couldn't be fetched.");
2890
+ });
3277
2891
  });
3278
2892
  },
3279
2893
  createClient(payload, authorization) {
3280
2894
  return __async(this, null, function* () {
3281
- try {
3282
- return yield platformAccountsClientInstance.post(
3283
- `/v2/clients`,
3284
- payload,
3285
- getPlatformAccountsClientConfig(authorization)
3286
- );
3287
- } catch (error) {
3288
- if (error instanceof Error) {
3289
- throw new Error(`Client couldn't be created. [${error.message}]`);
3290
- } else {
3291
- throw error;
3292
- }
3293
- }
2895
+ return platformAccountsClientInstance.post(
2896
+ `/v2/clients`,
2897
+ payload,
2898
+ getPlatformAccountsClientConfig(authorization)
2899
+ ).catch((error) => {
2900
+ throw error.withCustomMessage("Client couldn't be created.");
2901
+ });
3294
2902
  });
3295
2903
  },
3296
2904
  updateClient(clientId, payload, authorization) {
3297
2905
  return __async(this, null, function* () {
3298
- try {
3299
- return yield platformAccountsClientInstance.patch(
3300
- `/v2/clients/${clientId}`,
3301
- payload,
3302
- getPlatformAccountsClientConfig(authorization)
3303
- );
3304
- } catch (error) {
3305
- if (error instanceof Error) {
3306
- throw new Error(`Client couldn't be updated. [${error.message}]`);
3307
- } else {
3308
- throw error;
3309
- }
3310
- }
2906
+ return platformAccountsClientInstance.patch(
2907
+ `/v2/clients/${clientId}`,
2908
+ payload,
2909
+ getPlatformAccountsClientConfig(authorization)
2910
+ ).catch((error) => {
2911
+ throw error.withCustomMessage("Client couldn't be updated.");
2912
+ });
3311
2913
  });
3312
2914
  },
3313
2915
  deleteClient(clientId, authorization) {
3314
2916
  return __async(this, null, function* () {
3315
- try {
3316
- return yield platformAccountsClientInstance.delete(
3317
- `/v2/clients/${clientId}`,
3318
- getPlatformAccountsClientConfig(authorization)
3319
- );
3320
- } catch (error) {
3321
- if (error instanceof Error) {
3322
- throw new Error(`Client couldn't be deleted. [${error.message}]`);
3323
- } else {
3324
- throw error;
3325
- }
3326
- }
2917
+ return platformAccountsClientInstance.delete(
2918
+ `/v2/clients/${clientId}`,
2919
+ getPlatformAccountsClientConfig(authorization)
2920
+ ).catch((error) => {
2921
+ throw error.withCustomMessage("Clients couldn't be deleted.");
2922
+ });
3327
2923
  });
3328
2924
  },
3329
2925
  updateClientScopes(clientId, scopes, authorization) {
3330
2926
  return __async(this, null, function* () {
3331
- try {
3332
- return yield platformAccountsClientInstance.put(
3333
- `/v2/clients/${clientId}/scopes`,
3334
- scopes.map((scope) => ({
3335
- scope: scope.scope,
3336
- required: scope.required
3337
- })),
3338
- getPlatformAccountsClientConfig(authorization)
3339
- );
3340
- } catch (error) {
3341
- if (error instanceof Error) {
3342
- throw new Error(`Scopes couldn't be updated. [${error.message}]`);
3343
- } else {
3344
- throw error;
3345
- }
3346
- }
2927
+ return platformAccountsClientInstance.put(
2928
+ `/v2/clients/${clientId}/scopes`,
2929
+ scopes.map((scope) => ({
2930
+ scope: scope.scope,
2931
+ required: scope.required
2932
+ })),
2933
+ getPlatformAccountsClientConfig(authorization)
2934
+ ).catch((error) => {
2935
+ throw error.withCustomMessage("Client scopes couldn't be updated.");
2936
+ });
3347
2937
  });
3348
2938
  },
3349
2939
  deleteClientScopes(clientId, scopes, authorization) {
3350
2940
  return __async(this, null, function* () {
3351
- try {
3352
- return yield platformAccountsClientInstance.delete(
3353
- `/v2/clients/${clientId}/scopes`,
3354
- __spreadValues({
3355
- data: scopes.map((scope) => ({
3356
- scope: scope.scope,
3357
- required: scope.required
3358
- }))
3359
- }, getPlatformAccountsClientConfig(authorization))
3360
- );
3361
- } catch (error) {
3362
- if (error instanceof Error) {
3363
- throw new Error(`Scopes couldn't be updated. [${error.message}]`);
3364
- } else {
3365
- throw error;
3366
- }
3367
- }
2941
+ return platformAccountsClientInstance.delete(`/v2/clients/${clientId}/scopes`, __spreadValues({
2942
+ data: scopes.map((scope) => ({
2943
+ scope: scope.scope,
2944
+ required: scope.required
2945
+ }))
2946
+ }, getPlatformAccountsClientConfig(authorization))).catch((error) => {
2947
+ throw error.withCustomMessage("Client scopes couldn't be deleted.");
2948
+ });
3368
2949
  });
3369
2950
  },
3370
2951
  getInfo(authorization) {
3371
2952
  return __async(this, null, function* () {
3372
- try {
3373
- return yield platformAccountsClientInstance.get(
3374
- `/v2/info`,
3375
- getPlatformAccountsClientConfig(authorization)
3376
- );
3377
- } catch (error) {
3378
- if (error instanceof Error) {
3379
- throw new Error(`Info couldn't be fetched. [${error.message}]`);
3380
- } else {
3381
- throw error;
3382
- }
3383
- }
2953
+ return platformAccountsClientInstance.get(
2954
+ `/v2/info`,
2955
+ getPlatformAccountsClientConfig(authorization)
2956
+ ).catch((error) => {
2957
+ throw error.withCustomMessage("Client info couldn't be fetched.");
2958
+ });
3384
2959
  });
3385
2960
  }
3386
2961
  };
@@ -3389,34 +2964,22 @@ var platformAccountsClientApi = {
3389
2964
  var platformAccountsOrganizationApi = {
3390
2965
  getOrganizations(authorization) {
3391
2966
  return __async(this, null, function* () {
3392
- try {
3393
- const response = yield platformAccountsClientInstance.get(`/v2/organizations`, getPlatformAccountsClientConfig(authorization));
3394
- return response.data || [];
3395
- } catch (error) {
3396
- if (error instanceof Error) {
3397
- throw new Error(
3398
- `Organizations couldn't be fetched. [${error.message}]`
3399
- );
3400
- } else {
3401
- throw error;
3402
- }
3403
- }
2967
+ return platformAccountsClientInstance.get(
2968
+ `/v2/organizations`,
2969
+ getPlatformAccountsClientConfig(authorization)
2970
+ ).catch((error) => {
2971
+ throw error.withCustomMessage("Organizations couldn't be fetched.");
2972
+ });
3404
2973
  });
3405
2974
  },
3406
2975
  getMyOrganization(authorization) {
3407
2976
  return __async(this, null, function* () {
3408
- try {
3409
- return yield platformAccountsClientInstance.get(
3410
- `/v2/organizations/my`,
3411
- getPlatformAccountsClientConfig(authorization)
3412
- );
3413
- } catch (error) {
3414
- if (error instanceof Error) {
3415
- throw new Error(`Organization couldn't be fetched. [${error.message}]`);
3416
- } else {
3417
- throw error;
3418
- }
3419
- }
2977
+ return platformAccountsClientInstance.get(
2978
+ `/v2/organizations/my`,
2979
+ getPlatformAccountsClientConfig(authorization)
2980
+ ).catch((error) => {
2981
+ throw error.withCustomMessage("Organization couldn't be fetched.");
2982
+ });
3420
2983
  });
3421
2984
  }
3422
2985
  };
@@ -3425,62 +2988,39 @@ var platformAccountsOrganizationApi = {
3425
2988
  var platformAccountsPersonalAccessTokenApi = {
3426
2989
  getPersonalAccessTokens(authorization) {
3427
2990
  return __async(this, null, function* () {
3428
- try {
3429
- const response = yield platformAccountsClientInstance.get(
3430
- `/v2/personal_token`,
3431
- __spreadValues({}, getPlatformAccountsClientConfig(authorization))
2991
+ return platformAccountsClientInstance.get(`/v2/personal_token`, __spreadValues({}, getPlatformAccountsClientConfig(authorization))).catch((error) => {
2992
+ throw error.withCustomMessage(
2993
+ "Personal Access Tokens couldn't be fetched."
3432
2994
  );
3433
- return response.data;
3434
- } catch (error) {
3435
- if (error instanceof Error) {
3436
- throw new Error(
3437
- `Personal Access Token couldn't be fetched. [${error.message}]`
3438
- );
3439
- } else {
3440
- throw error;
3441
- }
3442
- }
2995
+ });
3443
2996
  });
3444
2997
  },
3445
2998
  createPersonalAccessToken(name, scopes, authorization) {
3446
2999
  return __async(this, null, function* () {
3447
- try {
3448
- const response = yield platformAccountsClientInstance.post(
3449
- `/v2/personal_token`,
3450
- {
3451
- name,
3452
- scope: scopes && scopes.map((item) => item.name).filter((el) => el).join(",")
3453
- },
3454
- getPlatformAccountsClientConfig(authorization)
3000
+ return platformAccountsClientInstance.post(
3001
+ `/v2/personal_token`,
3002
+ {
3003
+ name,
3004
+ scope: scopes.map((item) => item.name).filter((el) => el).join(",")
3005
+ },
3006
+ getPlatformAccountsClientConfig(authorization)
3007
+ ).catch((error) => {
3008
+ throw error.withCustomMessage(
3009
+ "Personal Access Tokens couldn't be created."
3455
3010
  );
3456
- return response.data;
3457
- } catch (error) {
3458
- if (error instanceof Error) {
3459
- throw new Error(
3460
- `Personal Access Token couldn't be created. [${error.message}]`
3461
- );
3462
- } else {
3463
- throw error;
3464
- }
3465
- }
3011
+ });
3466
3012
  });
3467
3013
  },
3468
3014
  deletePersonalAccessToken(id, authorization) {
3469
3015
  return __async(this, null, function* () {
3470
- try {
3471
- yield platformAccountsClientInstance.delete(
3472
- `/v2/personal_token/${id}`,
3473
- getPlatformAccountsClientConfig(authorization)
3016
+ return platformAccountsClientInstance.delete(
3017
+ `/v2/personal_token/${id}`,
3018
+ getPlatformAccountsClientConfig(authorization)
3019
+ ).catch((error) => {
3020
+ throw error.withCustomMessage(
3021
+ "Personal Access Tokens couldn't be deleted."
3474
3022
  );
3475
- } catch (error) {
3476
- if (error instanceof Error) {
3477
- throw new Error(
3478
- `Personal Access Token couldn't be deleted. [${error.message}]`
3479
- );
3480
- } else {
3481
- throw error;
3482
- }
3483
- }
3023
+ });
3484
3024
  });
3485
3025
  }
3486
3026
  };
@@ -3489,37 +3029,23 @@ var platformAccountsPersonalAccessTokenApi = {
3489
3029
  var platformAccountsProductsApi = {
3490
3030
  getOrganizationProducts(authorization) {
3491
3031
  return __async(this, null, function* () {
3492
- try {
3493
- const response = yield platformAccountsClientInstance.get(
3494
- `/v2/organizations/my/products`,
3495
- getPlatformAccountsClientConfig(authorization)
3496
- );
3497
- return response.data;
3498
- } catch (error) {
3499
- if (error instanceof Error) {
3500
- throw new Error(`Products couldn't be fetched. [${error.message}]`);
3501
- } else {
3502
- throw error;
3503
- }
3504
- }
3032
+ return platformAccountsClientInstance.get(
3033
+ `/v2/organizations/my/products`,
3034
+ getPlatformAccountsClientConfig(authorization)
3035
+ ).catch((error) => {
3036
+ throw error.withCustomMessage("Products couldn't be fetched.");
3037
+ });
3505
3038
  });
3506
3039
  },
3507
3040
  updateOrganizationProducts(payload, authorization) {
3508
3041
  return __async(this, null, function* () {
3509
- try {
3510
- const response = yield platformAccountsClientInstance.post(
3511
- `/v2/organizations/my/products`,
3512
- payload,
3513
- getPlatformAccountsClientConfig(authorization)
3514
- );
3515
- return response.data;
3516
- } catch (error) {
3517
- if (error instanceof Error) {
3518
- throw new Error(`Products couldn't be updated. [${error.message}]`);
3519
- } else {
3520
- throw error;
3521
- }
3522
- }
3042
+ return platformAccountsClientInstance.post(
3043
+ `/v2/organizations/my/products`,
3044
+ payload,
3045
+ getPlatformAccountsClientConfig(authorization)
3046
+ ).catch((error) => {
3047
+ throw error.withCustomMessage("Products couldn't be updated.");
3048
+ });
3523
3049
  });
3524
3050
  }
3525
3051
  };
@@ -3528,19 +3054,12 @@ var platformAccountsProductsApi = {
3528
3054
  var platformAccountsScopesApi = {
3529
3055
  getScopes(authorization) {
3530
3056
  return __async(this, null, function* () {
3531
- try {
3532
- const response = yield platformAccountsClientInstance.get(
3533
- `/v2/scopes`,
3534
- getPlatformAccountsClientConfig(authorization)
3535
- );
3536
- return response.data || [];
3537
- } catch (error) {
3538
- if (error instanceof Error) {
3539
- throw new Error(`Scopes couldn't be fetched. [${error.message}]`);
3540
- } else {
3541
- throw error;
3542
- }
3543
- }
3057
+ return platformAccountsClientInstance.get(
3058
+ `/v2/scopes`,
3059
+ getPlatformAccountsClientConfig(authorization)
3060
+ ).catch((error) => {
3061
+ throw error.withCustomMessage("Scopes couldn't be fetched.");
3062
+ });
3544
3063
  });
3545
3064
  }
3546
3065
  };
@@ -3549,18 +3068,12 @@ var platformAccountsScopesApi = {
3549
3068
  var platformAccountsSessionsApi = {
3550
3069
  deleteSessions(authorization) {
3551
3070
  return __async(this, null, function* () {
3552
- try {
3553
- return yield platformAccountsClientInstance.delete(
3554
- `/v2/sessions`,
3555
- getPlatformAccountsClientConfig(authorization)
3556
- );
3557
- } catch (error) {
3558
- if (error instanceof Error) {
3559
- throw new Error(`Sessions couldn't be deleted. [${error.message}]`);
3560
- } else {
3561
- throw error;
3562
- }
3563
- }
3071
+ return platformAccountsClientInstance.delete(
3072
+ `/v2/sessions`,
3073
+ getPlatformAccountsClientConfig(authorization)
3074
+ ).catch((error) => {
3075
+ throw error.withCustomMessage("Sessions couldn't be fetched.");
3076
+ });
3564
3077
  });
3565
3078
  }
3566
3079
  };
@@ -3576,23 +3089,13 @@ var platformAccountsTokenApi = {
3576
3089
  client_secret: clientSecret,
3577
3090
  redirect_uri: redirectUrl
3578
3091
  });
3579
- try {
3580
- return yield platformAccountsClientInstance.post(
3581
- `/v2/token`,
3582
- data,
3583
- {
3584
- headers: {
3585
- "Content-Type": "application/x-www-form-urlencoded"
3586
- }
3587
- }
3588
- );
3589
- } catch (error) {
3590
- if (error instanceof Error) {
3591
- throw new Error(`Couldn't exchange code for token. [${error.message}]`);
3592
- } else {
3593
- throw error;
3092
+ return platformAccountsClientInstance.post(`/v2/token`, data, {
3093
+ headers: {
3094
+ "Content-Type": "application/x-www-form-urlencoded"
3594
3095
  }
3595
- }
3096
+ }).catch((error) => {
3097
+ throw error.withCustomMessage("Couldn't exchange code for token.");
3098
+ });
3596
3099
  });
3597
3100
  }
3598
3101
  };
@@ -3610,10 +3113,32 @@ var platformAccountsApi = {
3610
3113
  };
3611
3114
 
3612
3115
  // src/apis/platform/dps/instance.ts
3613
- import axios14 from "axios";
3614
- var platformDpsClientInstance = axios14.create({
3116
+ import axios13 from "axios";
3117
+ var DpsApiError = class extends ApiErrorBase {
3118
+ constructor() {
3119
+ super(...arguments);
3120
+ this.name = "dps";
3121
+ }
3122
+ };
3123
+ var platformDpsClientInstance = axios13.create({
3615
3124
  baseURL: "https://dev-platform.labs.livechatinc.com"
3616
3125
  });
3126
+ platformDpsClientInstance.interceptors.response.use(
3127
+ (response) => response,
3128
+ (error) => {
3129
+ var _a, _b, _c, _d;
3130
+ if (((_a = error.response) == null ? void 0 : _a.status) === 403) {
3131
+ return Promise.reject(new UnauthorizeApiError("accounts"));
3132
+ }
3133
+ return Promise.reject(
3134
+ new DpsApiError(
3135
+ error.message,
3136
+ (_b = error.response) == null ? void 0 : _b.data,
3137
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
3138
+ )
3139
+ );
3140
+ }
3141
+ );
3617
3142
  function getPlatformDpsClientAuthorization(req) {
3618
3143
  var _a;
3619
3144
  return {
@@ -3676,6 +3201,23 @@ var platformDpsApplicationAuthorizationApi = {
3676
3201
  throw error;
3677
3202
  }
3678
3203
  });
3204
+ },
3205
+ deleteAuth(appId, authorization) {
3206
+ return __async(this, null, function* () {
3207
+ try {
3208
+ yield platformDpsClientInstance.delete(
3209
+ `/v2/applications/${appId}/authorization`,
3210
+ getPlatformDpsClientConfig(authorization)
3211
+ );
3212
+ } catch (error) {
3213
+ if (error instanceof Error) {
3214
+ throw new Error(
3215
+ `Authorization couldn't be created. [${error.message}]`
3216
+ );
3217
+ }
3218
+ throw error;
3219
+ }
3220
+ });
3679
3221
  }
3680
3222
  };
3681
3223
 
@@ -3785,21 +3327,224 @@ var platformDpsApplicationAutoReviewApi = {
3785
3327
  }
3786
3328
  };
3787
3329
 
3788
- // src/apis/platform/dps/applications/application/chatActions/api.ts
3789
- var platformDpsApplicationChatActionsApi = {
3790
- createChatAction(appId, payload, authorization) {
3791
- return __async(this, null, function* () {
3792
- try {
3793
- yield platformDpsClientInstance.put(
3794
- `/v2/applications/${appId}/chat-actions/${payload.id}`,
3795
- payload,
3796
- getPlatformDpsClientConfig(authorization)
3797
- );
3798
- } catch (error) {
3799
- if (error instanceof Error) {
3800
- throw new Error(
3801
- `${API_NOTIFICATIONS.BUILDING_BLOCKS.FAILURE.CREATED} [${error.message}]`
3802
- );
3330
+ // src/constants/app/templates/repository.ts
3331
+ var appRepositoryTemplatesMap = {
3332
+ "livechat/developer-app-template-nextjs": "nextjs",
3333
+ "livechat/developer-app-template-vite": "vite",
3334
+ "livechat/developer-app-template-saas": "saas"
3335
+ };
3336
+ var appRepositoryTemplates = {
3337
+ nextjs: {
3338
+ id: "nextjs",
3339
+ description: "Uses the most popular and versatile features from our SDKs:",
3340
+ tags: ["Auth", "Webhooks", "Agent App SDK", "Moments"],
3341
+ name: "Fullstack Next.js template",
3342
+ repository: {
3343
+ name: "livechat/developer-app-template-nextjs",
3344
+ target: "nextjs"
3345
+ }
3346
+ },
3347
+ vite: {
3348
+ id: "vite",
3349
+ name: "Vite template",
3350
+ description: "Implements the same base functionalities as the Next.js template except for webhooks:",
3351
+ tags: ["Auth", "Agent App SDK", "Moments"],
3352
+ repository: {
3353
+ name: "livechat/developer-app-template-vite",
3354
+ target: "node"
3355
+ }
3356
+ },
3357
+ saas: {
3358
+ id: "saas",
3359
+ name: "saas",
3360
+ description: "saas",
3361
+ tags: [],
3362
+ repository: {
3363
+ name: "livechat/developer-app-template-saas",
3364
+ target: "nextjs"
3365
+ }
3366
+ }
3367
+ };
3368
+
3369
+ // src/constants/app/templates/app.ts
3370
+ var appTemplatesMap = {
3371
+ "livechat/developer-app-template-saas": "saas"
3372
+ };
3373
+ var appBaseTemplates = {
3374
+ "tag-master": {
3375
+ id: "tag-master",
3376
+ name: "Tag Master",
3377
+ category: { name: "Agent App Widget" },
3378
+ description: "Create, view, and delete tags and canned responses in an easy and predictable way.",
3379
+ tags: ["Accounts SDK", "NextJS", "Configuration API"],
3380
+ link: "https://github.com/bstopyra/tag-master-template",
3381
+ icons: {},
3382
+ repository: {
3383
+ name: "bstopyra/tag-master-template",
3384
+ target: "node"
3385
+ }
3386
+ },
3387
+ progress: {
3388
+ id: "progress",
3389
+ name: "Progress",
3390
+ category: { name: "Agent App Widget" },
3391
+ description: "Creates reports based on data from chats: ratings, chatting time, response time.",
3392
+ tags: ["Accounts SDK", "NextJS", "Reports API"],
3393
+ link: "https://github.com/livechat/progress-app",
3394
+ icons: {},
3395
+ repository: {
3396
+ name: "livechat/progress-app",
3397
+ target: "node"
3398
+ }
3399
+ },
3400
+ supervisor: {
3401
+ id: "supervisor",
3402
+ name: "Supervisor",
3403
+ category: { name: "Agent App Widget" },
3404
+ description: "Monitor statistics of your team, such as chat ratings, response times, and chatting times.",
3405
+ tags: ["Accounts SDK", "NextJS", "Reports API"],
3406
+ link: "https://github.com/livechat/supervisor-app",
3407
+ icons: {},
3408
+ repository: {
3409
+ name: "livechat/supervisor-app",
3410
+ target: "node"
3411
+ }
3412
+ },
3413
+ popup: {
3414
+ id: "popup",
3415
+ name: "Popup app",
3416
+ category: { name: "Agent App Widget" },
3417
+ description: "Learn the ropes of the popup authorization flow from the Accounts SDK.",
3418
+ tags: ["Accounts SDK", "Popup flow", "Widget"],
3419
+ link: "https://github.com/livechat/sample-app-popup-auth",
3420
+ icons: {},
3421
+ repository: {
3422
+ name: "livechat/sample-app-popup-auth",
3423
+ target: "node"
3424
+ }
3425
+ },
3426
+ redirect: {
3427
+ id: "redirect",
3428
+ name: "Redirect app",
3429
+ category: { name: "Agent App Widget" },
3430
+ description: "See how to implement the redirect authorization flow from the Accounts SDK.",
3431
+ tags: ["Accounts SDK", "Redirect flow", "Widget"],
3432
+ link: "https://github.com/livechat/sample-app-redirect-auth",
3433
+ icons: {},
3434
+ repository: {
3435
+ name: "livechat/sample-app-redirect-auth",
3436
+ target: "node"
3437
+ }
3438
+ }
3439
+ };
3440
+ var appTemplates = {
3441
+ saas: {
3442
+ id: "saas",
3443
+ name: "Nextjs SaaS boilerplate",
3444
+ category: { name: "Agent App Widget" },
3445
+ description: "CRM-like app with key-value storage and simple UI. Authorization and payments fully set up.",
3446
+ tags: ["UI", "Auth", "Storage", "Payments", "Analytics"],
3447
+ template: true,
3448
+ manifest: {
3449
+ name: "Nextjs SaaS boilerplate",
3450
+ product: "livechat",
3451
+ blocks: {
3452
+ repository: {
3453
+ provider: "github",
3454
+ name: "livechat/developer-app-template-saas",
3455
+ branch: "main",
3456
+ target: "nextjs"
3457
+ },
3458
+ deployment: {
3459
+ provider: "netlify",
3460
+ url: ""
3461
+ },
3462
+ // storage: {
3463
+ // provider: "neon",
3464
+ // databaseName: "",
3465
+ // isSeeded: false,
3466
+ // },
3467
+ authorization: {
3468
+ scopes: [
3469
+ { scope: "properties.configuration:rw", required: true },
3470
+ {
3471
+ scope: "properties.license.value--all:rw",
3472
+ required: true
3473
+ }
3474
+ ],
3475
+ type: "javascript_app",
3476
+ redirectUri: "/"
3477
+ },
3478
+ widgets: {
3479
+ "chat-details": {
3480
+ placement: "plugin",
3481
+ url: "/livechat/chat-details"
3482
+ },
3483
+ fullscreen: {
3484
+ placement: "fullscreen",
3485
+ url: "/livechat/fullscreen"
3486
+ }
3487
+ },
3488
+ properties: {
3489
+ "123-456-789": {
3490
+ type: "string",
3491
+ default_value: "Mike;mike@yahoo.com",
3492
+ description: "123-456-789",
3493
+ access: {
3494
+ license: {
3495
+ agent: ["read"]
3496
+ }
3497
+ }
3498
+ },
3499
+ "111-222-333": {
3500
+ type: "string",
3501
+ default_value: "Dwight;dwight@yahoo.com",
3502
+ description: "111-222-333",
3503
+ access: {
3504
+ license: {
3505
+ agent: ["read"]
3506
+ }
3507
+ }
3508
+ },
3509
+ "333-555-777": {
3510
+ type: "string",
3511
+ default_value: "Pam;pam@yahoo.com",
3512
+ description: "333-555-777",
3513
+ access: {
3514
+ license: {
3515
+ agent: ["read"]
3516
+ }
3517
+ }
3518
+ }
3519
+ },
3520
+ monetization: {
3521
+ frequency: "monthly",
3522
+ charge: "organization",
3523
+ creditCardRequired: true,
3524
+ price: 500,
3525
+ trialDays: 7
3526
+ }
3527
+ }
3528
+ }
3529
+ }
3530
+ };
3531
+ var allAppTemplates = __spreadValues(__spreadValues(__spreadValues({}, appRepositoryTemplates), appBaseTemplates), appTemplates);
3532
+
3533
+ // src/apis/platform/dps/applications/application/chatActions/api.ts
3534
+ var platformDpsApplicationChatActionsApi = {
3535
+ createChatAction(appId, payload, authorization) {
3536
+ return __async(this, null, function* () {
3537
+ try {
3538
+ yield platformDpsClientInstance.put(
3539
+ `/v2/applications/${appId}/chat-actions/${payload.id}`,
3540
+ payload,
3541
+ getPlatformDpsClientConfig(authorization)
3542
+ );
3543
+ } catch (error) {
3544
+ if (error instanceof Error) {
3545
+ throw new Error(
3546
+ `${API_NOTIFICATIONS.BUILDING_BLOCKS.FAILURE.CREATED} [${error.message}]`
3547
+ );
3803
3548
  }
3804
3549
  throw error;
3805
3550
  }
@@ -3930,6 +3675,24 @@ var platformDpsApplicationDisplayApi = {
3930
3675
  }
3931
3676
  });
3932
3677
  },
3678
+ patchBasicDetails(appId, basicDetails, authorization) {
3679
+ return __async(this, null, function* () {
3680
+ try {
3681
+ yield platformDpsClientInstance.patch(
3682
+ `/v2/applications/${appId}/display`,
3683
+ basicDetails,
3684
+ getPlatformDpsClientConfig(authorization)
3685
+ );
3686
+ } catch (error) {
3687
+ if (error instanceof Error) {
3688
+ throw new Error(
3689
+ `Listing details couldn't be updated. [${error.message}]`
3690
+ );
3691
+ }
3692
+ throw error;
3693
+ }
3694
+ });
3695
+ },
3933
3696
  updateOverview(appId, data, authorization) {
3934
3697
  return __async(this, null, function* () {
3935
3698
  try {
@@ -4068,6 +3831,7 @@ var platformDpsApplicationInfrastructureBlocksApi = {
4068
3831
  `/v2/applications/${appId}/infrastructure/blocks`,
4069
3832
  getPlatformDpsClientConfig(authorization)
4070
3833
  );
3834
+ delete response.data.appId;
4071
3835
  return response.data;
4072
3836
  });
4073
3837
  },
@@ -4132,20 +3896,6 @@ var platformDpsApplicationInfrastructureBlocksApi = {
4132
3896
  getPlatformDpsClientConfig(authorization)
4133
3897
  );
4134
3898
  });
4135
- },
4136
- updateLogger(appId, payload, authorization) {
4137
- return __async(this, null, function* () {
4138
- yield platformDpsClientInstance.post(
4139
- `/v2/applications/${appId}/infrastructure/blocks`,
4140
- {
4141
- appId,
4142
- logger: {
4143
- provider: payload.provider
4144
- }
4145
- },
4146
- getPlatformDpsClientConfig(authorization)
4147
- );
4148
- });
4149
3899
  }
4150
3900
  };
4151
3901
 
@@ -4532,6 +4282,23 @@ var platformDpsApplicationWebhooksApi = {
4532
4282
  }
4533
4283
  });
4534
4284
  },
4285
+ deleteAppWebhooks(appId, authorization) {
4286
+ return __async(this, null, function* () {
4287
+ try {
4288
+ yield platformDpsClientInstance.delete(
4289
+ `/v2/applications/${appId}/webhook`,
4290
+ getPlatformDpsClientConfig(authorization)
4291
+ );
4292
+ } catch (error) {
4293
+ if (error instanceof Error) {
4294
+ throw new Error(
4295
+ `${API_NOTIFICATIONS.BUILDING_BLOCKS.FAILURE.DELETED} [${error.message}]`
4296
+ );
4297
+ }
4298
+ throw error;
4299
+ }
4300
+ });
4301
+ },
4535
4302
  getChatWebhook(appId, authorization) {
4536
4303
  return __async(this, null, function* () {
4537
4304
  try {
@@ -4669,8 +4436,10 @@ var platformDpsApplicationApi = {
4669
4436
  );
4670
4437
  return response.data;
4671
4438
  } catch (error) {
4672
- if (error instanceof Error) {
4673
- throw new Error(`App couldn't be fetched. [${error.message}]`);
4439
+ if (error instanceof DpsApiError) {
4440
+ throw error.withCustomMessage(
4441
+ `App couldn't be fetched. [${error.message}]`
4442
+ );
4674
4443
  }
4675
4444
  throw error;
4676
4445
  }
@@ -5249,7 +5018,7 @@ var platformDpsApi = {
5249
5018
  };
5250
5019
 
5251
5020
  // src/apis/platform/adapter/instance.ts
5252
- import axios15 from "axios";
5021
+ import axios14 from "axios";
5253
5022
  var REGION2 = {
5254
5023
  FRA: "fra",
5255
5024
  DAL: "dal",
@@ -5263,6 +5032,12 @@ var getRegion2 = (token) => {
5263
5032
  return region;
5264
5033
  }
5265
5034
  };
5035
+ var AdapterApiError = class extends ApiErrorBase {
5036
+ constructor() {
5037
+ super(...arguments);
5038
+ this.name = "adapter";
5039
+ }
5040
+ };
5266
5041
  function getPlatformAdapterClientAuthorization(req) {
5267
5042
  return {
5268
5043
  platform: {
@@ -5276,33 +5051,33 @@ function getPlatformAdapterClientAuthorization(req) {
5276
5051
  vercel: req.headers["vercel-token"],
5277
5052
  planetscale: req.headers["planetscale-token"],
5278
5053
  neon: req.headers["neon-token"],
5279
- sentry: req.headers["sentry-token"],
5280
5054
  openai: req.headers["openai-token"]
5281
5055
  };
5282
5056
  }
5283
- var platformAdapterClientInstance = axios15.create({
5057
+ var platformAdapterClientInstance = axios14.create({
5284
5058
  baseURL: "https://platform.labs.text.com/console-adapter/api",
5285
5059
  headers: {
5286
5060
  "Content-Type": "application/json"
5287
5061
  }
5288
5062
  });
5289
5063
  platformAdapterClientInstance.interceptors.response.use(
5290
- (r) => r,
5064
+ (response) => response,
5291
5065
  (error) => {
5292
- var _a;
5293
- if (axios15.isAxiosError(error)) {
5294
- if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
5295
- const source = error.response.data.error.source;
5296
- if (source) {
5297
- throw new UnauthorizeApiError(source);
5298
- }
5299
- }
5066
+ var _a, _b;
5067
+ const apiError = (_a = error.response) == null ? void 0 : _a.data;
5068
+ if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
5069
+ return Promise.reject(new UnauthorizeApiError(apiError.source));
5070
+ } else if ((apiError == null ? void 0 : apiError.kind) === "error") {
5071
+ const data = (_b = error.response) == null ? void 0 : _b.data;
5072
+ return Promise.reject(
5073
+ new AdapterApiError(data.message, data.data, data.code)
5074
+ );
5300
5075
  }
5301
- throw error;
5076
+ return Promise.reject(error);
5302
5077
  }
5303
5078
  );
5304
5079
  function getPlatformAdapterClientConfig(options = {}) {
5305
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
5080
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
5306
5081
  const currentHeaders = platformAdapterClientInstance.defaults.headers;
5307
5082
  const headers = {
5308
5083
  platform: {
@@ -5317,41 +5092,44 @@ function getPlatformAdapterClientConfig(options = {}) {
5317
5092
  vercel: (_h = currentHeaders["vercel-token"]) != null ? _h : options.vercel,
5318
5093
  planetscale: (_i = currentHeaders["planetscale-token"]) != null ? _i : options.planetscale,
5319
5094
  neon: (_j = currentHeaders["neon-token"]) != null ? _j : options.neon,
5320
- sentry: (_k = currentHeaders["sentry-token"]) != null ? _k : options.sentry,
5321
- openai: (_l = currentHeaders["openai-token"]) != null ? _l : options.openai
5095
+ openai: (_k = currentHeaders["openai-token"]) != null ? _k : options.openai
5322
5096
  }
5323
5097
  };
5324
5098
  if (currentHeaders["platform-dps-token"]) {
5325
- currentHeaders["X-Region"] = (_m = getRegion2(currentHeaders["platform-dps-token"])) != null ? _m : void 0;
5099
+ currentHeaders["X-Region"] = (_l = getRegion2(currentHeaders["platform-dps-token"])) != null ? _l : void 0;
5326
5100
  }
5327
- if (((_o = (_n = options.ensureAuthorizationToken) == null ? void 0 : _n.platform) == null ? void 0 : _o.dps) && !headers.platform.dps) {
5328
- throw new UnauthorizeApiError("dps");
5101
+ if (((_n = (_m = options.ensureAuthorizationToken) == null ? void 0 : _m.platform) == null ? void 0 : _n.dps) && !headers.platform.dps) {
5102
+ throw new UnauthorizeApiError("accounts");
5329
5103
  }
5330
- if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
5104
+ if (((_o = options.ensureAuthorizationToken) == null ? void 0 : _o.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
5331
5105
  throw new UnauthorizeApiError("github");
5332
5106
  }
5333
- if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.vercel) && !headers.integrations.vercel) {
5107
+ if (((_p = options.ensureAuthorizationToken) == null ? void 0 : _p.vercel) && !headers.integrations.vercel) {
5334
5108
  throw new UnauthorizeApiError("vercel");
5335
5109
  }
5336
- if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.netlify) && !headers.integrations.netlify) {
5110
+ if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.netlify) && !headers.integrations.netlify) {
5337
5111
  throw new UnauthorizeApiError("netlify");
5338
5112
  }
5339
- if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.planetscale) && !headers.integrations.planetscale) {
5113
+ if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.planetscale) && !headers.integrations.planetscale) {
5340
5114
  throw new UnauthorizeApiError("planetscale");
5341
5115
  }
5342
- if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.neon) && !headers.integrations.neon) {
5116
+ if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.neon) && !headers.integrations.neon) {
5343
5117
  throw new UnauthorizeApiError("neon");
5344
5118
  }
5345
- if (((_u = options.ensureAuthorizationToken) == null ? void 0 : _u.sentry) && !headers.integrations.sentry) {
5346
- throw new UnauthorizeApiError("sentry");
5347
- }
5348
- if (((_v = options.ensureAuthorizationToken) == null ? void 0 : _v.openai) && !headers.integrations.openai) {
5119
+ if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.openai) && !headers.integrations.openai) {
5349
5120
  throw new UnauthorizeApiError("openai");
5350
5121
  }
5351
5122
  return {
5352
- 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 } : {})
5123
+ 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 } : {})
5353
5124
  };
5354
5125
  }
5126
+ var getPlatformAdapterClientDefaultConfig = (authorization) => getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5127
+ ensureAuthorizationToken: {
5128
+ platform: {
5129
+ dps: true
5130
+ }
5131
+ }
5132
+ }));
5355
5133
  function initPlatformAdapterClientInstance(baseUrl, tokens) {
5356
5134
  if (baseUrl) {
5357
5135
  platformAdapterClientInstance.interceptors.request.use(
@@ -5390,253 +5168,344 @@ function updatePlatformAdapterClientInstance(tokens) {
5390
5168
  if (tokens == null ? void 0 : tokens.neon) {
5391
5169
  headers["neon-token"] = tokens.neon;
5392
5170
  }
5393
- if (tokens == null ? void 0 : tokens.sentry) {
5394
- headers["sentry-token"] = tokens.sentry;
5395
- }
5396
5171
  if (tokens == null ? void 0 : tokens.openai) {
5397
5172
  headers["openai-token"] = tokens.openai;
5398
5173
  }
5399
5174
  }
5400
5175
 
5176
+ // src/apis/platform/adapter/app/blocks/authorization/api.ts
5177
+ var platformAdapterAppAuthorizationApi = {
5178
+ get(appId, authorization) {
5179
+ return __async(this, null, function* () {
5180
+ return platformAdapterClientInstance.get(
5181
+ `/console/app/${appId}/blocks/authorization`,
5182
+ getPlatformAdapterClientDefaultConfig(authorization)
5183
+ );
5184
+ });
5185
+ },
5186
+ add(payload, authorization) {
5187
+ return __async(this, null, function* () {
5188
+ return platformAdapterClientInstance.post(
5189
+ `/console/app/${payload.appId}/blocks/authorization`,
5190
+ payload,
5191
+ getPlatformAdapterClientDefaultConfig(authorization)
5192
+ );
5193
+ });
5194
+ },
5195
+ update(payload, authorization) {
5196
+ return __async(this, null, function* () {
5197
+ return platformAdapterClientInstance.put(
5198
+ `/console/app/${payload.appId}/blocks/authorization`,
5199
+ payload,
5200
+ getPlatformAdapterClientDefaultConfig(authorization)
5201
+ );
5202
+ });
5203
+ },
5204
+ remove(payload, authorization) {
5205
+ return __async(this, null, function* () {
5206
+ return platformAdapterClientInstance.delete(
5207
+ `/console/app/${payload.appId}/blocks/authorization`,
5208
+ getPlatformAdapterClientDefaultConfig(authorization)
5209
+ );
5210
+ });
5211
+ }
5212
+ };
5213
+
5401
5214
  // src/apis/platform/adapter/app/blocks/deployment/api.ts
5402
5215
  var platformAdapterAppDeploymentApi = {
5216
+ getAggregate(appId, authorization) {
5217
+ return __async(this, null, function* () {
5218
+ return platformAdapterClientInstance.get(
5219
+ `/console/app/${appId}/blocks/deployment/aggregate`,
5220
+ getPlatformAdapterClientDefaultConfig(authorization)
5221
+ );
5222
+ });
5223
+ },
5403
5224
  get(appId, authorization) {
5404
5225
  return __async(this, null, function* () {
5405
- const response = yield platformAdapterClientInstance.get(
5226
+ return platformAdapterClientInstance.get(
5406
5227
  `/console/app/${appId}/blocks/deployment`,
5407
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5408
- ensureAuthorizationToken: {
5409
- platform: {
5410
- dps: true
5411
- }
5412
- }
5413
- }))
5228
+ getPlatformAdapterClientDefaultConfig(authorization)
5414
5229
  );
5415
- return response.data;
5416
5230
  });
5417
5231
  },
5418
5232
  link(payload, authorization) {
5419
5233
  return __async(this, null, function* () {
5420
- const response = yield platformAdapterClientInstance.post(
5421
- `/console/app/${payload.appId}/blocks/deployment/link`,
5234
+ return platformAdapterClientInstance.put(
5235
+ `/console/app/${payload.appId}/blocks/deployment`,
5422
5236
  payload,
5423
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5424
- ensureAuthorizationToken: {
5425
- platform: {
5426
- dps: true
5427
- }
5428
- }
5429
- }))
5237
+ getPlatformAdapterClientDefaultConfig(authorization)
5430
5238
  );
5431
- return response.data;
5432
5239
  });
5433
5240
  },
5434
5241
  unlink(payload, authorization) {
5435
5242
  return __async(this, null, function* () {
5436
- yield platformAdapterClientInstance.post(
5437
- `/console/app/${payload.appId}/blocks/deployment/unlink`,
5438
- payload,
5439
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5440
- ensureAuthorizationToken: {
5441
- platform: {
5442
- dps: true
5443
- }
5444
- }
5445
- }))
5243
+ return platformAdapterClientInstance.delete(
5244
+ `/console/app/${payload.appId}/blocks/deployment?${new URLSearchParams(
5245
+ payload
5246
+ ).toString()}`,
5247
+ getPlatformAdapterClientDefaultConfig(authorization)
5446
5248
  );
5447
5249
  });
5448
5250
  },
5449
- installSentry(appId, authorization) {
5251
+ upsert(payload, authorization) {
5450
5252
  return __async(this, null, function* () {
5451
- yield platformAdapterClientInstance.post(
5452
- `/console/app/${appId}/blocks/deployment/install/sentry`,
5453
- {},
5454
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5455
- ensureAuthorizationToken: {
5456
- platform: {
5457
- dps: true
5458
- }
5459
- }
5460
- }))
5253
+ return platformAdapterClientInstance.patch(
5254
+ `/console/app/${payload.appId}/blocks/deployment`,
5255
+ payload,
5256
+ getPlatformAdapterClientDefaultConfig(authorization)
5461
5257
  );
5462
5258
  });
5463
5259
  }
5464
5260
  };
5465
5261
 
5466
- // src/apis/platform/adapter/app/blocks/logger/providers/sentry/api.ts
5467
- var platformAdapterAppSentryLoggerApi = {
5468
- get(projectSlug, authorization) {
5262
+ // src/apis/platform/adapter/app/blocks/monetization/api.ts
5263
+ var platformAdapterAppMonetizationApi = {
5264
+ get(appId, authorization) {
5469
5265
  return __async(this, null, function* () {
5470
- const response = yield platformAdapterClientInstance.get(
5471
- `/console/app/blocks/logger/providers/sentry/get?projectSlug=${projectSlug}`,
5472
- getPlatformAdapterClientConfig(authorization)
5266
+ return platformAdapterClientInstance.get(
5267
+ `/console/app/${appId}/blocks/monetization`,
5268
+ getPlatformAdapterClientDefaultConfig(authorization)
5473
5269
  );
5474
- return response.data;
5475
5270
  });
5476
5271
  },
5477
- link(payload, authorization) {
5272
+ upsert(payload, authorization) {
5478
5273
  return __async(this, null, function* () {
5479
- yield platformAdapterClientInstance.post(
5480
- "/console/app/blocks/logger/providers/sentry/link",
5274
+ return platformAdapterClientInstance.post(
5275
+ `/console/app/${payload.appId}/blocks/monetization`,
5481
5276
  payload,
5482
- getPlatformAdapterClientConfig(authorization)
5277
+ getPlatformAdapterClientDefaultConfig(authorization)
5483
5278
  );
5484
5279
  });
5485
5280
  },
5486
- unlink(payload, authorization) {
5281
+ remove(payload, authorization) {
5487
5282
  return __async(this, null, function* () {
5488
- yield platformAdapterClientInstance.post(
5489
- "/console/app/blocks/logger/providers/sentry/unlink",
5490
- payload,
5491
- getPlatformAdapterClientConfig(authorization)
5283
+ return platformAdapterClientInstance.delete(
5284
+ `/console/app/${payload.appId}/blocks/monetization`,
5285
+ getPlatformAdapterClientDefaultConfig(authorization)
5286
+ );
5287
+ });
5288
+ }
5289
+ };
5290
+
5291
+ // src/apis/platform/adapter/app/blocks/properties/property/api.ts
5292
+ var platformAdapterAppPropertyApi = {
5293
+ get(appId, propertyId, authorization) {
5294
+ return __async(this, null, function* () {
5295
+ return platformAdapterClientInstance.get(
5296
+ `/console/app/${appId}/blocks/properties/${propertyId}`,
5297
+ getPlatformAdapterClientDefaultConfig(authorization)
5492
5298
  );
5493
5299
  });
5494
5300
  },
5495
- reauthorizeSentryApp(userId, sentryInstallationId, sentryRefreshToken, authorization) {
5301
+ upsert(payload, authorization) {
5496
5302
  return __async(this, null, function* () {
5497
- const response = yield platformAdapterClientInstance.post(
5498
- "/integrations/sentry/refresh",
5499
- {
5500
- userId,
5501
- sentryInstallationId,
5502
- sentryRefreshToken
5503
- },
5504
- getPlatformAdapterClientConfig(authorization)
5303
+ return platformAdapterClientInstance.post(
5304
+ `/console/app/${payload.appId}/blocks/properties/${payload.propertyId}`,
5305
+ payload,
5306
+ getPlatformAdapterClientDefaultConfig(authorization)
5505
5307
  );
5506
- return response.data;
5507
5308
  });
5508
5309
  },
5509
- requestSentryIssueSolution(stacktrace, authorization) {
5310
+ remove(payload, authorization) {
5510
5311
  return __async(this, null, function* () {
5511
- const response = yield platformAdapterClientInstance.post(
5512
- "/integrations/openai/issues/solution",
5513
- {
5514
- stacktrace
5515
- },
5516
- getPlatformAdapterClientConfig(authorization)
5312
+ return platformAdapterClientInstance.delete(
5313
+ `/console/app/${payload.appId}/blocks/properties/${payload.propertyId}`,
5314
+ getPlatformAdapterClientDefaultConfig(authorization)
5517
5315
  );
5518
- return response.data;
5519
5316
  });
5520
5317
  }
5521
5318
  };
5522
5319
 
5523
- // src/apis/platform/adapter/app/blocks/logger/api.ts
5524
- var platformAdapterAppLoggerApi = {
5525
- providers: {
5526
- sentry: platformAdapterAppSentryLoggerApi
5320
+ // src/apis/platform/adapter/app/blocks/properties/api.ts
5321
+ var platformAdapterAppPropertiesApi = {
5322
+ property: platformAdapterAppPropertyApi,
5323
+ get(appId, authorization) {
5324
+ return __async(this, null, function* () {
5325
+ return platformAdapterClientInstance.get(
5326
+ `/console/app/${appId}/blocks/properties`,
5327
+ getPlatformAdapterClientDefaultConfig(authorization)
5328
+ );
5329
+ });
5330
+ },
5331
+ upsert(payload, authorization) {
5332
+ return __async(this, null, function* () {
5333
+ return platformAdapterClientInstance.post(
5334
+ `/console/app/${payload.appId}/blocks/properties`,
5335
+ payload,
5336
+ getPlatformAdapterClientDefaultConfig(authorization)
5337
+ );
5338
+ });
5339
+ },
5340
+ remove(payload, authorization) {
5341
+ return __async(this, null, function* () {
5342
+ return platformAdapterClientInstance.delete(
5343
+ `/console/app/${payload.appId}/blocks/properties`,
5344
+ getPlatformAdapterClientDefaultConfig(authorization)
5345
+ );
5346
+ });
5527
5347
  }
5528
5348
  };
5529
5349
 
5530
5350
  // src/apis/platform/adapter/app/blocks/repository/api.ts
5531
5351
  var platformAdapterAppRepositoryApi = {
5352
+ getAggregate(appId, authorization) {
5353
+ return __async(this, null, function* () {
5354
+ return platformAdapterClientInstance.get(
5355
+ `/console/app/${appId}/blocks/repository/aggregate`,
5356
+ getPlatformAdapterClientDefaultConfig(authorization)
5357
+ );
5358
+ });
5359
+ },
5532
5360
  get(appId, authorization) {
5533
5361
  return __async(this, null, function* () {
5534
- const response = yield platformAdapterClientInstance.get(
5362
+ return platformAdapterClientInstance.get(
5535
5363
  `/console/app/${appId}/blocks/repository`,
5536
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5537
- ensureAuthorizationToken: {
5538
- platform: {
5539
- dps: true
5540
- }
5541
- }
5542
- }))
5364
+ getPlatformAdapterClientDefaultConfig(authorization)
5543
5365
  );
5544
- return response.data;
5545
5366
  });
5546
5367
  },
5547
5368
  link(payload, authorization) {
5548
5369
  return __async(this, null, function* () {
5549
- const response = yield platformAdapterClientInstance.post(
5550
- `/console/app/${payload.appId}/blocks/repository/link`,
5370
+ return platformAdapterClientInstance.put(
5371
+ `/console/app/${payload.appId}/blocks/repository`,
5551
5372
  payload,
5552
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5553
- ensureAuthorizationToken: {
5554
- platform: {
5555
- dps: true
5556
- }
5557
- }
5558
- }))
5373
+ getPlatformAdapterClientDefaultConfig(authorization)
5559
5374
  );
5560
- return response.data;
5561
5375
  });
5562
5376
  },
5563
5377
  unlink(payload, authorization) {
5564
5378
  return __async(this, null, function* () {
5565
- yield platformAdapterClientInstance.post(
5566
- `/console/app/${payload.appId}/blocks/repository/unlink`,
5379
+ return platformAdapterClientInstance.delete(
5380
+ `/console/app/${payload.appId}/blocks/repository?${new URLSearchParams(
5381
+ payload
5382
+ ).toString()}`,
5383
+ getPlatformAdapterClientDefaultConfig(authorization)
5384
+ );
5385
+ });
5386
+ },
5387
+ upsert(payload, authorization) {
5388
+ return __async(this, null, function* () {
5389
+ return platformAdapterClientInstance.patch(
5390
+ `/console/app/${payload.appId}/blocks/repository`,
5567
5391
  payload,
5568
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5569
- ensureAuthorizationToken: {
5570
- platform: {
5571
- dps: true
5572
- }
5573
- }
5574
- }))
5392
+ getPlatformAdapterClientDefaultConfig(authorization)
5575
5393
  );
5576
5394
  });
5577
5395
  },
5578
5396
  seed(payload, authorization) {
5579
5397
  return __async(this, null, function* () {
5580
- const response = yield platformAdapterClientInstance.post(
5398
+ return platformAdapterClientInstance.post(
5581
5399
  `/console/app/${payload.appId}/blocks/repository/seed`,
5582
5400
  payload,
5583
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5584
- ensureAuthorizationToken: {
5585
- platform: {
5586
- dps: true
5587
- }
5588
- }
5589
- }))
5401
+ getPlatformAdapterClientDefaultConfig(authorization)
5590
5402
  );
5591
- return response.data;
5592
5403
  });
5593
5404
  }
5594
5405
  };
5595
5406
 
5596
5407
  // src/apis/platform/adapter/app/blocks/storage/api.ts
5597
5408
  var platformAdapterAppStorageApi = {
5409
+ getAggregate(appId, authorization) {
5410
+ return __async(this, null, function* () {
5411
+ return platformAdapterClientInstance.get(
5412
+ `/console/app/${appId}/blocks/storage/aggregate`,
5413
+ getPlatformAdapterClientDefaultConfig(authorization)
5414
+ );
5415
+ });
5416
+ },
5598
5417
  get(appId, authorization) {
5599
5418
  return __async(this, null, function* () {
5600
- const response = yield platformAdapterClientInstance.get(
5419
+ return platformAdapterClientInstance.get(
5601
5420
  `/console/app/${appId}/blocks/storage`,
5602
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5603
- ensureAuthorizationToken: {
5604
- platform: {
5605
- dps: true
5606
- }
5607
- }
5608
- }))
5421
+ getPlatformAdapterClientDefaultConfig(authorization)
5609
5422
  );
5610
- return response.data;
5611
5423
  });
5612
5424
  },
5613
5425
  link(payload, authorization) {
5614
5426
  return __async(this, null, function* () {
5615
- yield platformAdapterClientInstance.post(
5616
- `/console/app/${payload.appId}/blocks/storage/link`,
5427
+ return platformAdapterClientInstance.put(
5428
+ `/console/app/${payload.appId}/blocks/storage`,
5617
5429
  payload,
5618
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5619
- ensureAuthorizationToken: {
5620
- platform: {
5621
- dps: true
5622
- }
5623
- }
5624
- }))
5430
+ getPlatformAdapterClientDefaultConfig(authorization)
5625
5431
  );
5626
5432
  });
5627
5433
  },
5628
5434
  unlink(payload, authorization) {
5629
5435
  return __async(this, null, function* () {
5630
- yield platformAdapterClientInstance.post(
5631
- `/console/app/${payload.appId}/blocks/storage/unlink`,
5436
+ return platformAdapterClientInstance.delete(
5437
+ `/console/app/${payload.appId}/blocks/storage?${new URLSearchParams(
5438
+ payload
5439
+ ).toString()}`,
5440
+ getPlatformAdapterClientDefaultConfig(authorization)
5441
+ );
5442
+ });
5443
+ },
5444
+ upsert(payload, authorization) {
5445
+ return __async(this, null, function* () {
5446
+ return platformAdapterClientInstance.patch(
5447
+ `/console/app/${payload.appId}/blocks/storage`,
5632
5448
  payload,
5633
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5634
- ensureAuthorizationToken: {
5635
- platform: {
5636
- dps: true
5637
- }
5638
- }
5639
- }))
5449
+ getPlatformAdapterClientDefaultConfig(authorization)
5450
+ );
5451
+ });
5452
+ }
5453
+ };
5454
+
5455
+ // src/apis/platform/adapter/app/blocks/widgets/widget/api.ts
5456
+ var platformAdapterAppWidgetApi = {
5457
+ get(appId, widgetId, authorization) {
5458
+ return __async(this, null, function* () {
5459
+ return platformAdapterClientInstance.get(
5460
+ `/console/app/${appId}/blocks/widgets/${widgetId}`,
5461
+ getPlatformAdapterClientDefaultConfig(authorization)
5462
+ );
5463
+ });
5464
+ },
5465
+ upsert(payload, authorization) {
5466
+ return __async(this, null, function* () {
5467
+ return platformAdapterClientInstance.post(
5468
+ `/console/app/${payload.appId}/blocks/widgets/${payload.widgetId}`,
5469
+ payload,
5470
+ getPlatformAdapterClientDefaultConfig(authorization)
5471
+ );
5472
+ });
5473
+ },
5474
+ remove(payload, authorization) {
5475
+ return __async(this, null, function* () {
5476
+ return platformAdapterClientInstance.delete(
5477
+ `/console/app/${payload.appId}/blocks/widgets/${payload.widgetId}`,
5478
+ getPlatformAdapterClientDefaultConfig(authorization)
5479
+ );
5480
+ });
5481
+ }
5482
+ };
5483
+
5484
+ // src/apis/platform/adapter/app/blocks/widgets/api.ts
5485
+ var platformAdapterAppWidgetsApi = {
5486
+ widget: platformAdapterAppWidgetApi,
5487
+ get(appId, authorization) {
5488
+ return __async(this, null, function* () {
5489
+ return platformAdapterClientInstance.get(
5490
+ `/console/app/${appId}/blocks/widgets`,
5491
+ getPlatformAdapterClientDefaultConfig(authorization)
5492
+ );
5493
+ });
5494
+ },
5495
+ upsert(payload, authorization) {
5496
+ return __async(this, null, function* () {
5497
+ return platformAdapterClientInstance.post(
5498
+ `/console/app/${payload.appId}/blocks/widgets`,
5499
+ payload,
5500
+ getPlatformAdapterClientDefaultConfig(authorization)
5501
+ );
5502
+ });
5503
+ },
5504
+ remove(payload, authorization) {
5505
+ return __async(this, null, function* () {
5506
+ return platformAdapterClientInstance.delete(
5507
+ `/console/app/${payload.appId}/blocks/widgets`,
5508
+ getPlatformAdapterClientDefaultConfig(authorization)
5640
5509
  );
5641
5510
  });
5642
5511
  }
@@ -5644,10 +5513,13 @@ var platformAdapterAppStorageApi = {
5644
5513
 
5645
5514
  // src/apis/platform/adapter/app/blocks/api.ts
5646
5515
  var platformAdapterAppBlocksApi = {
5516
+ authorization: platformAdapterAppAuthorizationApi,
5517
+ monetization: platformAdapterAppMonetizationApi,
5647
5518
  repository: platformAdapterAppRepositoryApi,
5648
5519
  deployment: platformAdapterAppDeploymentApi,
5649
5520
  storage: platformAdapterAppStorageApi,
5650
- logger: platformAdapterAppLoggerApi
5521
+ properties: platformAdapterAppPropertiesApi,
5522
+ widgets: platformAdapterAppWidgetsApi
5651
5523
  };
5652
5524
 
5653
5525
  // src/apis/platform/adapter/app/variables/api.ts
@@ -5660,7 +5532,7 @@ var platformAdapterAppVariablesApi = {
5660
5532
  params: {
5661
5533
  decrypted
5662
5534
  }
5663
- }, getPlatformAdapterClientConfig(authorization))
5535
+ }, getPlatformAdapterClientDefaultConfig(authorization))
5664
5536
  );
5665
5537
  return response.data;
5666
5538
  });
@@ -5669,7 +5541,7 @@ var platformAdapterAppVariablesApi = {
5669
5541
  return __async(this, null, function* () {
5670
5542
  const response = yield platformAdapterClientInstance.get(
5671
5543
  `/console/app/${appId}/variables/${key}`,
5672
- getPlatformAdapterClientConfig(authorization)
5544
+ getPlatformAdapterClientDefaultConfig(authorization)
5673
5545
  );
5674
5546
  return response.data;
5675
5547
  });
@@ -5679,7 +5551,7 @@ var platformAdapterAppVariablesApi = {
5679
5551
  yield platformAdapterClientInstance.post(
5680
5552
  `/console/app/${appId}/variables/${key}/sync`,
5681
5553
  payload,
5682
- getPlatformAdapterClientConfig(authorization)
5554
+ getPlatformAdapterClientDefaultConfig(authorization)
5683
5555
  );
5684
5556
  });
5685
5557
  },
@@ -5688,7 +5560,7 @@ var platformAdapterAppVariablesApi = {
5688
5560
  yield platformAdapterClientInstance.post(
5689
5561
  `/console/app/${appId}/variables/${data.key}`,
5690
5562
  data,
5691
- getPlatformAdapterClientConfig(authorization)
5563
+ getPlatformAdapterClientDefaultConfig(authorization)
5692
5564
  );
5693
5565
  });
5694
5566
  },
@@ -5697,7 +5569,7 @@ var platformAdapterAppVariablesApi = {
5697
5569
  yield platformAdapterClientInstance.post(
5698
5570
  `/console/app/${appId}/variables/${data.key}/edit`,
5699
5571
  data,
5700
- getPlatformAdapterClientConfig(authorization)
5572
+ getPlatformAdapterClientDefaultConfig(authorization)
5701
5573
  );
5702
5574
  });
5703
5575
  },
@@ -5710,284 +5582,87 @@ var platformAdapterAppVariablesApi = {
5710
5582
  }
5711
5583
  };
5712
5584
 
5713
- // src/apis/platform/adapter/app/creator/api.ts
5714
- var platformAdapterAppCreatorApi = {
5715
- app(payload, authorization) {
5716
- return __async(this, null, function* () {
5717
- try {
5718
- const response = yield platformAdapterClientInstance.post(
5719
- `/console/app/new/app`,
5720
- payload,
5721
- getPlatformAdapterClientConfig(authorization)
5722
- );
5723
- return response.data;
5724
- } catch (error) {
5725
- if (error instanceof Error) {
5726
- throw new Error(`App couldn't be created. [${error.message}]`);
5727
- }
5728
- throw error;
5729
- }
5730
- });
5731
- },
5732
- repository(payload, authorization) {
5733
- return __async(this, null, function* () {
5734
- try {
5735
- const response = yield platformAdapterClientInstance.post(
5736
- `/console/app/new/repository`,
5737
- payload,
5738
- getPlatformAdapterClientConfig(authorization)
5739
- );
5740
- return response.data;
5741
- } catch (error) {
5742
- if (error instanceof Error) {
5743
- throw new Error(`Repository couldn't be created. [${error.message}]`);
5744
- }
5745
- throw error;
5746
- }
5747
- });
5748
- },
5749
- seed(payload, authorization) {
5750
- return __async(this, null, function* () {
5751
- try {
5752
- const response = yield platformAdapterClientInstance.post(
5753
- `/console/app/new/seed`,
5754
- payload,
5755
- getPlatformAdapterClientConfig(authorization)
5756
- );
5757
- return response.data;
5758
- } catch (error) {
5759
- if (error instanceof Error) {
5760
- throw new Error(`Seed couldn't be created. [${error.message}]`);
5761
- }
5762
- throw error;
5763
- }
5764
- });
5765
- },
5766
- deployment(payload, authorization) {
5767
- return __async(this, null, function* () {
5768
- try {
5769
- const response = yield platformAdapterClientInstance.post(
5770
- `/console/app/new/deployment`,
5771
- payload,
5772
- getPlatformAdapterClientConfig(authorization)
5773
- );
5774
- return response.data;
5775
- } catch (error) {
5776
- if (error instanceof Error) {
5777
- throw new Error(`Deployment couldn't be created. [${error.message}]`);
5778
- }
5779
- throw error;
5780
- }
5781
- });
5782
- },
5783
- deployment_accessible(payload, authorization) {
5585
+ // src/apis/platform/adapter/app/templates/api.ts
5586
+ var platformAdapterAppTemplatesApi = {
5587
+ getTemplates(authorization) {
5784
5588
  return __async(this, null, function* () {
5785
5589
  try {
5786
- const response = yield platformAdapterClientInstance.post(
5787
- `/console/app/new/deployment_accessible`,
5788
- payload,
5789
- getPlatformAdapterClientConfig(authorization)
5590
+ const response = yield platformAdapterClientInstance.get(
5591
+ `/console/app/templates`,
5592
+ getPlatformAdapterClientDefaultConfig(authorization)
5790
5593
  );
5791
5594
  return response.data;
5792
5595
  } catch (error) {
5793
5596
  if (error instanceof Error) {
5794
5597
  throw new Error(
5795
- `Deployment accessibility couldn't be checked. [${error.message}]`
5598
+ `App templates couldn't be fetched. [${error.message}]`
5796
5599
  );
5797
5600
  }
5798
5601
  throw error;
5799
5602
  }
5800
5603
  });
5801
5604
  },
5802
- storage(payload, authorization) {
5605
+ getRepositoryTemplates(authorization) {
5803
5606
  return __async(this, null, function* () {
5804
5607
  try {
5805
- const response = yield platformAdapterClientInstance.post(
5806
- `/console/app/new/storage`,
5807
- payload,
5808
- getPlatformAdapterClientConfig(authorization)
5809
- );
5810
- return response.data;
5811
- } catch (error) {
5812
- if (error instanceof Error) {
5813
- throw new Error(`Storage couldn't be created. [${error.message}]`);
5814
- }
5815
- throw error;
5816
- }
5817
- });
5818
- },
5819
- authorization(payload, authorization) {
5820
- return __async(this, null, function* () {
5821
- try {
5822
- const response = yield platformAdapterClientInstance.post(
5823
- `/console/app/new/authorization`,
5824
- payload,
5825
- getPlatformAdapterClientConfig(authorization)
5608
+ const response = yield platformAdapterClientInstance.get(
5609
+ `/console/app/templates/repository`,
5610
+ getPlatformAdapterClientDefaultConfig(authorization)
5826
5611
  );
5827
5612
  return response.data;
5828
5613
  } catch (error) {
5829
5614
  if (error instanceof Error) {
5830
5615
  throw new Error(
5831
- `Authorization couldn't be created. [${error.message}]`
5616
+ `App repository templates couldn't be fetched. [${error.message}]`
5832
5617
  );
5833
5618
  }
5834
5619
  throw error;
5835
5620
  }
5836
5621
  });
5837
- },
5838
- widgets(payload, authorization) {
5839
- return __async(this, null, function* () {
5840
- try {
5841
- const response = yield platformAdapterClientInstance.post(
5842
- `/console/app/new/widgets`,
5843
- payload,
5844
- getPlatformAdapterClientConfig(authorization)
5845
- );
5846
- return response.data;
5847
- } catch (error) {
5848
- if (error instanceof Error) {
5849
- throw new Error(`Widgets couldn't be created. [${error.message}]`);
5850
- }
5851
- throw error;
5852
- }
5853
- });
5854
- },
5855
- properties(payload, authorization) {
5856
- return __async(this, null, function* () {
5857
- try {
5858
- const response = yield platformAdapterClientInstance.post(
5859
- `/console/app/new/properties`,
5860
- payload,
5861
- getPlatformAdapterClientConfig(authorization)
5862
- );
5863
- return response.data;
5864
- } catch (error) {
5865
- if (error instanceof Error) {
5866
- throw new Error(`Properties couldn't be created. [${error.message}]`);
5867
- }
5868
- throw error;
5869
- }
5870
- });
5871
- },
5872
- monetization(payload, authorization) {
5873
- return __async(this, null, function* () {
5874
- try {
5875
- const response = yield platformAdapterClientInstance.post(
5876
- `/console/app/new/monetization`,
5877
- payload,
5878
- getPlatformAdapterClientConfig(authorization)
5879
- );
5880
- return response.data;
5881
- } catch (error) {
5882
- if (error instanceof Error) {
5883
- throw new Error(`Monetization couldn't be created. [${error.message}]`);
5884
- }
5885
- throw error;
5886
- }
5887
- });
5888
5622
  }
5889
5623
  };
5890
5624
 
5891
- // src/apis/platform/adapter/app/manifest/api.ts
5892
- var platformAdapterAppManifestApi = {
5893
- getManifest(appId, authorization) {
5625
+ // src/apis/platform/adapter/app/api.ts
5626
+ var platformAdapterAppApi = {
5627
+ blocks: platformAdapterAppBlocksApi,
5628
+ variables: platformAdapterAppVariablesApi,
5629
+ templates: platformAdapterAppTemplatesApi,
5630
+ push(payload, authorization) {
5894
5631
  return __async(this, null, function* () {
5895
- try {
5896
- const response = yield platformAdapterClientInstance.get(
5897
- `/console/app/${appId}/manifest`,
5898
- getPlatformAdapterClientConfig(authorization)
5899
- );
5900
- return response.data;
5901
- } catch (error) {
5902
- if (error instanceof Error) {
5903
- throw new Error(`App manifest couldn't be created. [${error.message}]`);
5904
- }
5905
- throw error;
5906
- }
5632
+ return platformAdapterClientInstance.post(
5633
+ `/console/app${payload.manifest.id ? `/${payload.manifest.id}` : ""}`,
5634
+ payload,
5635
+ getPlatformAdapterClientDefaultConfig(authorization)
5636
+ );
5907
5637
  });
5908
5638
  },
5909
- pushManifest(manifest, authorization) {
5639
+ pull(appId, authorization) {
5910
5640
  return __async(this, null, function* () {
5911
- try {
5912
- yield platformAdapterClientInstance.post(
5913
- `/console/app/${manifest.id}/manifest`,
5914
- manifest,
5915
- getPlatformAdapterClientConfig(authorization)
5916
- );
5917
- } catch (error) {
5918
- if (error instanceof Error) {
5919
- throw new Error(`App manifest couldn't be pushed. [${error.message}]`);
5920
- }
5921
- throw error;
5922
- }
5641
+ return platformAdapterClientInstance.get(
5642
+ `/console/app/${appId}`,
5643
+ getPlatformAdapterClientDefaultConfig(authorization)
5644
+ );
5923
5645
  });
5924
5646
  },
5925
- verifyManifest(manifest, authorization) {
5647
+ verify(payload, authorization) {
5926
5648
  return __async(this, null, function* () {
5927
- try {
5928
- const response = yield platformAdapterClientInstance.post(
5929
- `/console/app/${manifest.id}/manifest/verify`,
5930
- manifest,
5931
- getPlatformAdapterClientConfig(authorization)
5932
- );
5933
- return response.data;
5934
- } catch (error) {
5935
- if (error instanceof Error) {
5936
- throw new Error(
5937
- `App manifest couldn't be verified. [${error.message}]`
5938
- );
5939
- }
5940
- throw error;
5941
- }
5942
- });
5943
- }
5944
- };
5945
-
5946
- // src/apis/platform/adapter/app/api.ts
5947
- var platformAdapterAppApi = {
5948
- creator: platformAdapterAppCreatorApi,
5949
- blocks: platformAdapterAppBlocksApi,
5950
- variables: platformAdapterAppVariablesApi,
5951
- manifest: platformAdapterAppManifestApi,
5952
- create(payload, authorization) {
5953
- return __async(this, null, function* () {
5954
- const response = yield platformAdapterClientInstance.post(
5955
- `/console/app/new`,
5649
+ return platformAdapterClientInstance.post(
5650
+ `/console/app/${payload.appId}/verify`,
5956
5651
  payload,
5957
- getPlatformAdapterClientConfig(authorization)
5652
+ getPlatformAdapterClientDefaultConfig(authorization)
5958
5653
  );
5959
- return response.data;
5960
5654
  });
5961
5655
  },
5962
- createStatus(sagaId, authorization) {
5656
+ status(sagaId, authorization) {
5963
5657
  return __async(this, null, function* () {
5964
- const response = yield platformAdapterClientInstance.get(
5965
- `/console/app/new/status`,
5658
+ return platformAdapterClientInstance.get(
5659
+ `/console/app/status`,
5966
5660
  __spreadValues({
5967
5661
  params: {
5968
5662
  sagaId
5969
5663
  }
5970
- }, getPlatformAdapterClientConfig(authorization))
5664
+ }, getPlatformAdapterClientDefaultConfig(authorization))
5971
5665
  );
5972
- return response.data;
5973
- });
5974
- },
5975
- getTemplates(authorization) {
5976
- return __async(this, null, function* () {
5977
- try {
5978
- const response = yield platformAdapterClientInstance.get(
5979
- `/console/app/templates`,
5980
- getPlatformAdapterClientConfig(authorization)
5981
- );
5982
- return response.data;
5983
- } catch (error) {
5984
- if (error instanceof Error) {
5985
- throw new Error(
5986
- `App templates couldn't be created. [${error.message}]`
5987
- );
5988
- }
5989
- throw error;
5990
- }
5991
5666
  });
5992
5667
  }
5993
5668
  };
@@ -6007,8 +5682,8 @@ var platformAdapterConductorApi = {
6007
5682
  };
6008
5683
 
6009
5684
  // src/apis/platform/billing/instance.ts
6010
- import axios16 from "axios";
6011
- var platformBillingClientInstance = axios16.create({
5685
+ import axios15 from "axios";
5686
+ var platformBillingClientInstance = axios15.create({
6012
5687
  baseURL: "https://billing.labs.livechatinc.com"
6013
5688
  });
6014
5689
  function getPlatformBillingClientAuthorization(req) {
@@ -6028,10 +5703,10 @@ function getPlatformBillingClientConfig(options = {}) {
6028
5703
  function initPlatformBillingClientInstance(baseUrl, token) {
6029
5704
  if (baseUrl) {
6030
5705
  platformBillingClientInstance.interceptors.request.use(
6031
- (config) => __async(this, null, function* () {
5706
+ (config) => {
6032
5707
  config.baseURL = baseUrl;
6033
5708
  return config;
6034
- }),
5709
+ },
6035
5710
  (error) => Promise.reject(error)
6036
5711
  );
6037
5712
  }
@@ -6197,7 +5872,7 @@ var api = {
6197
5872
  isInitialized: false
6198
5873
  };
6199
5874
  function initApi(config, tokens) {
6200
- 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;
5875
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
6201
5876
  initPlatformAccountsClientInstance(
6202
5877
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
6203
5878
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.dps
@@ -6223,27 +5898,35 @@ function initApi(config, tokens) {
6223
5898
  netlify: (_k = tokens.netlify) == null ? void 0 : _k.token,
6224
5899
  vercel: (_l = tokens.vercel) == null ? void 0 : _l.token,
6225
5900
  neon: (_m = tokens.neon) == null ? void 0 : _m.token,
6226
- planetscale: (_n = tokens.planetscale) == null ? void 0 : _n.token,
6227
- sentry: (_o = tokens.sentry) == null ? void 0 : _o.token
5901
+ planetscale: (_n = tokens.planetscale) == null ? void 0 : _n.token
6228
5902
  } : void 0
6229
5903
  );
6230
5904
  initLiveChatClientInstance(
6231
- (_p = config.urls.products) == null ? void 0 : _p.livechat,
6232
- (_q = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _q.dps
5905
+ (_o = config.urls.products) == null ? void 0 : _o.livechat,
5906
+ (_p = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _p.dps
6233
5907
  );
6234
- initTextClientInstance((_r = config.urls.integrations) == null ? void 0 : _r.text, (_s = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _s.dps);
6235
- initGithubClientInstance((_t = tokens == null ? void 0 : tokens.github) == null ? void 0 : _t.apps);
6236
- initNetlifyClientInstance((_u = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _u.token);
6237
- initVercelClientInstance((_v = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _v.token);
6238
- initNeonClientInstance((_w = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _w.token);
6239
- initPlanetScaleClientInstance((_x = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _x.token);
6240
- initSentryClientInstance((_y = tokens == null ? void 0 : tokens.sentry) == null ? void 0 : _y.token);
5908
+ initTextClientInstance((_q = config.urls.integrations) == null ? void 0 : _q.text, (_r = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _r.dps);
5909
+ initGithubClientInstance((_s = tokens == null ? void 0 : tokens.github) == null ? void 0 : _s.apps);
5910
+ initNetlifyClientInstance((_t = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _t.token);
5911
+ initVercelClientInstance((_u = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _u.token);
5912
+ initNeonClientInstance((_v = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _v.token);
5913
+ initPlanetScaleClientInstance((_w = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _w.token);
6241
5914
  api.isInitialized = true;
6242
5915
  }
6243
5916
  export {
6244
5917
  API_NOTIFICATIONS,
5918
+ AccountsApiError,
5919
+ AdapterApiError,
5920
+ ApiErrorBase,
5921
+ DpsApiError,
6245
5922
  UnauthorizeApiError,
5923
+ allAppTemplates,
6246
5924
  api,
5925
+ appBaseTemplates,
5926
+ appRepositoryTemplates,
5927
+ appRepositoryTemplatesMap,
5928
+ appTemplates,
5929
+ appTemplatesMap,
6247
5930
  getAppAutoReviewPayload,
6248
5931
  getEmptyAppAutoReview,
6249
5932
  getGitHubClientAuthorization,
@@ -6260,14 +5943,13 @@ export {
6260
5943
  getPlatformAccountsClientConfig,
6261
5944
  getPlatformAdapterClientAuthorization,
6262
5945
  getPlatformAdapterClientConfig,
5946
+ getPlatformAdapterClientDefaultConfig,
6263
5947
  getPlatformBillingClientAuthorization,
6264
5948
  getPlatformBillingClientConfig,
6265
5949
  getPlatformDpsAdminClientAuthorization,
6266
5950
  getPlatformDpsClientAuthorization,
6267
5951
  getPlatformDpsClientConfig,
6268
5952
  getRegion,
6269
- getSentryClientAuthorization,
6270
- getSentryClientConfig,
6271
5953
  getTextClientAuthorization,
6272
5954
  getTextClientConfig,
6273
5955
  getVercelClientAuthorization,
@@ -6283,7 +5965,6 @@ export {
6283
5965
  initPlatformAdapterClientInstance,
6284
5966
  initPlatformBillingClientInstance,
6285
5967
  initPlatformDpsClientInstance,
6286
- initSentryClientInstance,
6287
5968
  initTextClientInstance,
6288
5969
  initVercelClientInstance,
6289
5970
  livechatClientInstance,
@@ -6294,14 +5975,12 @@ export {
6294
5975
  platformAdapterClientInstance,
6295
5976
  platformBillingClientInstance,
6296
5977
  platformDpsClientInstance,
6297
- sentryClientInstance,
6298
5978
  textClientInstance,
6299
5979
  updateGithubClientInstance,
6300
5980
  updateNeonClientInstance,
6301
5981
  updateNetlifyClientInstance,
6302
5982
  updatePlanetScaleClientInstance,
6303
5983
  updatePlatformAdapterClientInstance,
6304
- updateSentryClientInstance,
6305
5984
  updateVercelClientInstance,
6306
5985
  vercelClientInstance
6307
5986
  };