@livechat/developer-studio-api 2.3.71 → 3.0.0-beta.2

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) {
@@ -2058,18 +1675,18 @@ var textApi = {
2058
1675
  };
2059
1676
 
2060
1677
  // src/apis/integrations/vercel/api.ts
2061
- import axios9 from "axios";
1678
+ import axios8 from "axios";
2062
1679
 
2063
1680
  // src/apis/integrations/vercel/instance.ts
2064
- import axios8 from "axios";
2065
- var vercelClientInstance = axios8.create({
1681
+ import axios7 from "axios";
1682
+ var vercelClientInstance = axios7.create({
2066
1683
  baseURL: "https://api.vercel.com"
2067
1684
  });
2068
1685
  vercelClientInstance.interceptors.response.use(
2069
1686
  (r) => r,
2070
1687
  (error) => {
2071
1688
  var _a, _b;
2072
- if (axios8.isAxiosError(error)) {
1689
+ if (axios7.isAxiosError(error)) {
2073
1690
  if (((_a = error.response) == null ? void 0 : _a.status) === 401 || ((_b = error.response) == null ? void 0 : _b.status) === 403) {
2074
1691
  throw new UnauthorizeApiError("vercel");
2075
1692
  }
@@ -2358,7 +1975,7 @@ var vercelApi = {
2358
1975
  client_secret: clientSecret,
2359
1976
  redirect_uri: redirectUrl
2360
1977
  });
2361
- 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, {
2362
1979
  headers: {
2363
1980
  "Content-Type": "application/x-www-form-urlencoded"
2364
1981
  }
@@ -2374,18 +1991,18 @@ var vercelApi = {
2374
1991
  };
2375
1992
 
2376
1993
  // src/apis/integrations/neon/api.ts
2377
- import axios11 from "axios";
1994
+ import axios10 from "axios";
2378
1995
 
2379
1996
  // src/apis/integrations/neon/instance.ts
2380
- import axios10 from "axios";
2381
- var neonClientInstance = axios10.create({
1997
+ import axios9 from "axios";
1998
+ var neonClientInstance = axios9.create({
2382
1999
  baseURL: "https://console.neon.tech/api/v2/"
2383
2000
  });
2384
2001
  neonClientInstance.interceptors.response.use(
2385
2002
  (r) => r,
2386
2003
  (error) => {
2387
2004
  var _a;
2388
- if (axios10.isAxiosError(error)) {
2005
+ if (axios9.isAxiosError(error)) {
2389
2006
  if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2390
2007
  throw new UnauthorizeApiError("neon");
2391
2008
  }
@@ -2598,7 +2215,7 @@ var neonApi = {
2598
2215
  redirect_uri: redirectUri,
2599
2216
  grant_type: "authorization_code"
2600
2217
  });
2601
- const response = yield axios11.post(
2218
+ const response = yield axios10.post(
2602
2219
  "https://oauth2.neon.tech/oauth2/token",
2603
2220
  data,
2604
2221
  {
@@ -2623,7 +2240,7 @@ var neonApi = {
2623
2240
  client_secret: clientSecret,
2624
2241
  grant_type: "refresh_token"
2625
2242
  });
2626
- 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, {
2627
2244
  headers: {
2628
2245
  "Content-Type": "application/x-www-form-urlencoded"
2629
2246
  }
@@ -2644,12 +2261,11 @@ var integrationsApi = {
2644
2261
  vercel: vercelApi,
2645
2262
  neon: neonApi,
2646
2263
  planetscale: planetscaleApi,
2647
- sentry: sentryApi,
2648
2264
  text: textApi
2649
2265
  };
2650
2266
 
2651
2267
  // src/apis/products/livechat/instance.ts
2652
- import axios12 from "axios";
2268
+ import axios11 from "axios";
2653
2269
  var REGION = {
2654
2270
  FRA: "fra",
2655
2271
  DAL: "dal",
@@ -2663,7 +2279,7 @@ var getRegion = (token) => {
2663
2279
  return region;
2664
2280
  }
2665
2281
  };
2666
- var livechatClientInstance = axios12.create({
2282
+ var livechatClientInstance = axios11.create({
2667
2283
  baseURL: "https://api.labs.livechatinc.com"
2668
2284
  });
2669
2285
  function getLiveChatClientAuthorization(req) {
@@ -3161,17 +2777,39 @@ var productsApi = {
3161
2777
  };
3162
2778
 
3163
2779
  // src/apis/platform/accounts/instance.ts
3164
- import axios13 from "axios";
3165
- 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({
3166
2788
  baseURL: "https://accounts.labs.livechatinc.com"
3167
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
+ );
3168
2806
  function getPlatformAccountsClientAuthorization(req) {
3169
2807
  return {
3170
2808
  token: req.headers["platform-accounts-token"]
3171
2809
  };
3172
2810
  }
3173
2811
  function getPlatformAccountsClientConfig(options = {}) {
3174
- const defaultAuthorization = platformAccountsClientInstance.defaults.headers["Authorization"];
2812
+ const defaultAuthorization = platformAccountsClientInstance.defaults.headers.Authorization;
3175
2813
  const headers = {
3176
2814
  authorization: defaultAuthorization != null ? defaultAuthorization : options.token ? `Bearer ${options.token}` : void 0
3177
2815
  };
@@ -3182,17 +2820,17 @@ function getPlatformAccountsClientConfig(options = {}) {
3182
2820
  function initPlatformAccountsClientInstance(baseUrl, token) {
3183
2821
  if (baseUrl) {
3184
2822
  platformAccountsClientInstance.interceptors.request.use(
3185
- (config) => __async(this, null, function* () {
2823
+ (config) => {
3186
2824
  config.baseURL = baseUrl;
3187
2825
  return config;
3188
- }),
2826
+ },
3189
2827
  (error) => Promise.reject(error)
3190
2828
  );
3191
2829
  }
3192
2830
  if (token) {
3193
- platformAccountsClientInstance.defaults.headers["Authorization"] = `Bearer ${token}`;
2831
+ platformAccountsClientInstance.defaults.headers.Authorization = `Bearer ${token}`;
3194
2832
  } else {
3195
- delete platformAccountsClientInstance.defaults.headers["Authorization"];
2833
+ delete platformAccountsClientInstance.defaults.headers.Authorization;
3196
2834
  }
3197
2835
  }
3198
2836
 
@@ -3200,50 +2838,32 @@ function initPlatformAccountsClientInstance(baseUrl, token) {
3200
2838
  var platformAccountsAccountApi = {
3201
2839
  getAccounts(authorization) {
3202
2840
  return __async(this, null, function* () {
3203
- try {
3204
- return yield platformAccountsClientInstance.get(
3205
- `/v2/accounts`,
3206
- getPlatformAccountsClientConfig(authorization)
3207
- );
3208
- } catch (error) {
3209
- if (error instanceof Error) {
3210
- throw new Error(`Accounts couldn't be fetched. [${error.message}]`);
3211
- } else {
3212
- throw error;
3213
- }
3214
- }
2841
+ return platformAccountsClientInstance.get(
2842
+ `/v2/accounts`,
2843
+ getPlatformAccountsClientConfig(authorization)
2844
+ ).catch((error) => {
2845
+ throw error.withCustomMessage("Accounts couldn't be fetched.");
2846
+ });
3215
2847
  });
3216
2848
  },
3217
2849
  getAccount(accountId, authorization) {
3218
2850
  return __async(this, null, function* () {
3219
- try {
3220
- return yield platformAccountsClientInstance.get(
3221
- `/v2/accounts/${accountId}`,
3222
- getPlatformAccountsClientConfig(authorization)
3223
- );
3224
- } catch (error) {
3225
- if (error instanceof Error) {
3226
- throw new Error(`Account couldn't be fetched. [${error.message}]`);
3227
- } else {
3228
- throw error;
3229
- }
3230
- }
2851
+ return platformAccountsClientInstance.get(
2852
+ `/v2/accounts/${accountId}`,
2853
+ getPlatformAccountsClientConfig(authorization)
2854
+ ).catch((error) => {
2855
+ throw error.withCustomMessage("Account couldn't be fetched.");
2856
+ });
3231
2857
  });
3232
2858
  },
3233
2859
  getMeAccount(authorization) {
3234
2860
  return __async(this, null, function* () {
3235
- try {
3236
- return yield platformAccountsClientInstance.get(
3237
- `/v2/accounts/me`,
3238
- getPlatformAccountsClientConfig(authorization)
3239
- );
3240
- } catch (error) {
3241
- if (error instanceof Error) {
3242
- throw new Error(`Account couldn't be fetched. [${error.message}]`);
3243
- } else {
3244
- throw error;
3245
- }
3246
- }
2861
+ return platformAccountsClientInstance.get(
2862
+ `/v2/accounts/me`,
2863
+ getPlatformAccountsClientConfig(authorization)
2864
+ ).catch((error) => {
2865
+ throw error.withCustomMessage("Account couldn't be fetched.");
2866
+ });
3247
2867
  });
3248
2868
  }
3249
2869
  };
@@ -3252,141 +2872,90 @@ var platformAccountsAccountApi = {
3252
2872
  var platformAccountsClientApi = {
3253
2873
  getClients(authorization) {
3254
2874
  return __async(this, null, function* () {
3255
- try {
3256
- return yield platformAccountsClientInstance.get(
3257
- `/v2/clients`,
3258
- getPlatformAccountsClientConfig(authorization)
3259
- );
3260
- } catch (error) {
3261
- if (error instanceof Error) {
3262
- throw new Error(`Clients couldn't be fetched. [${error.message}]`);
3263
- } else {
3264
- throw error;
3265
- }
3266
- }
2875
+ return platformAccountsClientInstance.get(
2876
+ `/v2/clients`,
2877
+ getPlatformAccountsClientConfig(authorization)
2878
+ ).catch((error) => {
2879
+ throw error.withCustomMessage("Clients couldn't be fetched.");
2880
+ });
3267
2881
  });
3268
2882
  },
3269
2883
  getClient(clientId, authorization) {
3270
2884
  return __async(this, null, function* () {
3271
- try {
3272
- return yield platformAccountsClientInstance.get(
3273
- `/v2/clients/${clientId}`,
3274
- getPlatformAccountsClientConfig(authorization)
3275
- );
3276
- } catch (error) {
3277
- if (error instanceof Error) {
3278
- throw new Error(`Client couldn't be fetched. [${error.message}]`);
3279
- } else {
3280
- throw error;
3281
- }
3282
- }
2885
+ return platformAccountsClientInstance.get(
2886
+ `/v2/clients/${clientId}`,
2887
+ getPlatformAccountsClientConfig(authorization)
2888
+ ).catch((error) => {
2889
+ throw error.withCustomMessage("Client couldn't be fetched.");
2890
+ });
3283
2891
  });
3284
2892
  },
3285
2893
  createClient(payload, authorization) {
3286
2894
  return __async(this, null, function* () {
3287
- try {
3288
- return yield platformAccountsClientInstance.post(
3289
- `/v2/clients`,
3290
- payload,
3291
- getPlatformAccountsClientConfig(authorization)
3292
- );
3293
- } catch (error) {
3294
- if (error instanceof Error) {
3295
- throw new Error(`Client couldn't be created. [${error.message}]`);
3296
- } else {
3297
- throw error;
3298
- }
3299
- }
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
+ });
3300
2902
  });
3301
2903
  },
3302
2904
  updateClient(clientId, payload, authorization) {
3303
2905
  return __async(this, null, function* () {
3304
- try {
3305
- return yield platformAccountsClientInstance.patch(
3306
- `/v2/clients/${clientId}`,
3307
- payload,
3308
- getPlatformAccountsClientConfig(authorization)
3309
- );
3310
- } catch (error) {
3311
- if (error instanceof Error) {
3312
- throw new Error(`Client couldn't be updated. [${error.message}]`);
3313
- } else {
3314
- throw error;
3315
- }
3316
- }
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
+ });
3317
2913
  });
3318
2914
  },
3319
2915
  deleteClient(clientId, authorization) {
3320
2916
  return __async(this, null, function* () {
3321
- try {
3322
- return yield platformAccountsClientInstance.delete(
3323
- `/v2/clients/${clientId}`,
3324
- getPlatformAccountsClientConfig(authorization)
3325
- );
3326
- } catch (error) {
3327
- if (error instanceof Error) {
3328
- throw new Error(`Client couldn't be deleted. [${error.message}]`);
3329
- } else {
3330
- throw error;
3331
- }
3332
- }
2917
+ return platformAccountsClientInstance.delete(
2918
+ `/v2/clients/${clientId}`,
2919
+ getPlatformAccountsClientConfig(authorization)
2920
+ ).catch((error) => {
2921
+ throw error.withCustomMessage("Clients couldn't be deleted.");
2922
+ });
3333
2923
  });
3334
2924
  },
3335
2925
  updateClientScopes(clientId, scopes, authorization) {
3336
2926
  return __async(this, null, function* () {
3337
- try {
3338
- return yield platformAccountsClientInstance.put(
3339
- `/v2/clients/${clientId}/scopes`,
3340
- scopes.map((scope) => ({
3341
- scope: scope.scope,
3342
- required: scope.required
3343
- })),
3344
- getPlatformAccountsClientConfig(authorization)
3345
- );
3346
- } catch (error) {
3347
- if (error instanceof Error) {
3348
- throw new Error(`Scopes couldn't be updated. [${error.message}]`);
3349
- } else {
3350
- throw error;
3351
- }
3352
- }
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
+ });
3353
2937
  });
3354
2938
  },
3355
2939
  deleteClientScopes(clientId, scopes, authorization) {
3356
2940
  return __async(this, null, function* () {
3357
- try {
3358
- return yield platformAccountsClientInstance.delete(
3359
- `/v2/clients/${clientId}/scopes`,
3360
- __spreadValues({
3361
- data: scopes.map((scope) => ({
3362
- scope: scope.scope,
3363
- required: scope.required
3364
- }))
3365
- }, getPlatformAccountsClientConfig(authorization))
3366
- );
3367
- } catch (error) {
3368
- if (error instanceof Error) {
3369
- throw new Error(`Scopes couldn't be updated. [${error.message}]`);
3370
- } else {
3371
- throw error;
3372
- }
3373
- }
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
+ });
3374
2949
  });
3375
2950
  },
3376
2951
  getInfo(authorization) {
3377
2952
  return __async(this, null, function* () {
3378
- try {
3379
- return yield platformAccountsClientInstance.get(
3380
- `/v2/info`,
3381
- getPlatformAccountsClientConfig(authorization)
3382
- );
3383
- } catch (error) {
3384
- if (error instanceof Error) {
3385
- throw new Error(`Info couldn't be fetched. [${error.message}]`);
3386
- } else {
3387
- throw error;
3388
- }
3389
- }
2953
+ return platformAccountsClientInstance.get(
2954
+ `/v2/info`,
2955
+ getPlatformAccountsClientConfig(authorization)
2956
+ ).catch((error) => {
2957
+ throw error.withCustomMessage("Client info couldn't be fetched.");
2958
+ });
3390
2959
  });
3391
2960
  }
3392
2961
  };
@@ -3395,34 +2964,22 @@ var platformAccountsClientApi = {
3395
2964
  var platformAccountsOrganizationApi = {
3396
2965
  getOrganizations(authorization) {
3397
2966
  return __async(this, null, function* () {
3398
- try {
3399
- const response = yield platformAccountsClientInstance.get(`/v2/organizations`, getPlatformAccountsClientConfig(authorization));
3400
- return response.data || [];
3401
- } catch (error) {
3402
- if (error instanceof Error) {
3403
- throw new Error(
3404
- `Organizations couldn't be fetched. [${error.message}]`
3405
- );
3406
- } else {
3407
- throw error;
3408
- }
3409
- }
2967
+ return platformAccountsClientInstance.get(
2968
+ `/v2/organizations`,
2969
+ getPlatformAccountsClientConfig(authorization)
2970
+ ).catch((error) => {
2971
+ throw error.withCustomMessage("Organizations couldn't be fetched.");
2972
+ });
3410
2973
  });
3411
2974
  },
3412
2975
  getMyOrganization(authorization) {
3413
2976
  return __async(this, null, function* () {
3414
- try {
3415
- return yield platformAccountsClientInstance.get(
3416
- `/v2/organizations/my`,
3417
- getPlatformAccountsClientConfig(authorization)
3418
- );
3419
- } catch (error) {
3420
- if (error instanceof Error) {
3421
- throw new Error(`Organization couldn't be fetched. [${error.message}]`);
3422
- } else {
3423
- throw error;
3424
- }
3425
- }
2977
+ return platformAccountsClientInstance.get(
2978
+ `/v2/organizations/my`,
2979
+ getPlatformAccountsClientConfig(authorization)
2980
+ ).catch((error) => {
2981
+ throw error.withCustomMessage("Organization couldn't be fetched.");
2982
+ });
3426
2983
  });
3427
2984
  }
3428
2985
  };
@@ -3431,62 +2988,39 @@ var platformAccountsOrganizationApi = {
3431
2988
  var platformAccountsPersonalAccessTokenApi = {
3432
2989
  getPersonalAccessTokens(authorization) {
3433
2990
  return __async(this, null, function* () {
3434
- try {
3435
- const response = yield platformAccountsClientInstance.get(
3436
- `/v2/personal_token`,
3437
- __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."
3438
2994
  );
3439
- return response.data;
3440
- } catch (error) {
3441
- if (error instanceof Error) {
3442
- throw new Error(
3443
- `Personal Access Token couldn't be fetched. [${error.message}]`
3444
- );
3445
- } else {
3446
- throw error;
3447
- }
3448
- }
2995
+ });
3449
2996
  });
3450
2997
  },
3451
2998
  createPersonalAccessToken(name, scopes, authorization) {
3452
2999
  return __async(this, null, function* () {
3453
- try {
3454
- const response = yield platformAccountsClientInstance.post(
3455
- `/v2/personal_token`,
3456
- {
3457
- name,
3458
- scope: scopes && scopes.map((item) => item.name).filter((el) => el).join(",")
3459
- },
3460
- 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."
3461
3010
  );
3462
- return response.data;
3463
- } catch (error) {
3464
- if (error instanceof Error) {
3465
- throw new Error(
3466
- `Personal Access Token couldn't be created. [${error.message}]`
3467
- );
3468
- } else {
3469
- throw error;
3470
- }
3471
- }
3011
+ });
3472
3012
  });
3473
3013
  },
3474
3014
  deletePersonalAccessToken(id, authorization) {
3475
3015
  return __async(this, null, function* () {
3476
- try {
3477
- yield platformAccountsClientInstance.delete(
3478
- `/v2/personal_token/${id}`,
3479
- 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."
3480
3022
  );
3481
- } catch (error) {
3482
- if (error instanceof Error) {
3483
- throw new Error(
3484
- `Personal Access Token couldn't be deleted. [${error.message}]`
3485
- );
3486
- } else {
3487
- throw error;
3488
- }
3489
- }
3023
+ });
3490
3024
  });
3491
3025
  }
3492
3026
  };
@@ -3495,37 +3029,23 @@ var platformAccountsPersonalAccessTokenApi = {
3495
3029
  var platformAccountsProductsApi = {
3496
3030
  getOrganizationProducts(authorization) {
3497
3031
  return __async(this, null, function* () {
3498
- try {
3499
- const response = yield platformAccountsClientInstance.get(
3500
- `/v2/organizations/my/products`,
3501
- getPlatformAccountsClientConfig(authorization)
3502
- );
3503
- return response.data;
3504
- } catch (error) {
3505
- if (error instanceof Error) {
3506
- throw new Error(`Products couldn't be fetched. [${error.message}]`);
3507
- } else {
3508
- throw error;
3509
- }
3510
- }
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
+ });
3511
3038
  });
3512
3039
  },
3513
3040
  updateOrganizationProducts(payload, authorization) {
3514
3041
  return __async(this, null, function* () {
3515
- try {
3516
- const response = yield platformAccountsClientInstance.post(
3517
- `/v2/organizations/my/products`,
3518
- payload,
3519
- getPlatformAccountsClientConfig(authorization)
3520
- );
3521
- return response.data;
3522
- } catch (error) {
3523
- if (error instanceof Error) {
3524
- throw new Error(`Products couldn't be updated. [${error.message}]`);
3525
- } else {
3526
- throw error;
3527
- }
3528
- }
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
+ });
3529
3049
  });
3530
3050
  }
3531
3051
  };
@@ -3534,19 +3054,12 @@ var platformAccountsProductsApi = {
3534
3054
  var platformAccountsScopesApi = {
3535
3055
  getScopes(authorization) {
3536
3056
  return __async(this, null, function* () {
3537
- try {
3538
- const response = yield platformAccountsClientInstance.get(
3539
- `/v2/scopes`,
3540
- getPlatformAccountsClientConfig(authorization)
3541
- );
3542
- return response.data || [];
3543
- } catch (error) {
3544
- if (error instanceof Error) {
3545
- throw new Error(`Scopes couldn't be fetched. [${error.message}]`);
3546
- } else {
3547
- throw error;
3548
- }
3549
- }
3057
+ return platformAccountsClientInstance.get(
3058
+ `/v2/scopes`,
3059
+ getPlatformAccountsClientConfig(authorization)
3060
+ ).catch((error) => {
3061
+ throw error.withCustomMessage("Scopes couldn't be fetched.");
3062
+ });
3550
3063
  });
3551
3064
  }
3552
3065
  };
@@ -3555,18 +3068,12 @@ var platformAccountsScopesApi = {
3555
3068
  var platformAccountsSessionsApi = {
3556
3069
  deleteSessions(authorization) {
3557
3070
  return __async(this, null, function* () {
3558
- try {
3559
- return yield platformAccountsClientInstance.delete(
3560
- `/v2/sessions`,
3561
- getPlatformAccountsClientConfig(authorization)
3562
- );
3563
- } catch (error) {
3564
- if (error instanceof Error) {
3565
- throw new Error(`Sessions couldn't be deleted. [${error.message}]`);
3566
- } else {
3567
- throw error;
3568
- }
3569
- }
3071
+ return platformAccountsClientInstance.delete(
3072
+ `/v2/sessions`,
3073
+ getPlatformAccountsClientConfig(authorization)
3074
+ ).catch((error) => {
3075
+ throw error.withCustomMessage("Sessions couldn't be fetched.");
3076
+ });
3570
3077
  });
3571
3078
  }
3572
3079
  };
@@ -3582,23 +3089,13 @@ var platformAccountsTokenApi = {
3582
3089
  client_secret: clientSecret,
3583
3090
  redirect_uri: redirectUrl
3584
3091
  });
3585
- try {
3586
- return yield platformAccountsClientInstance.post(
3587
- `/v2/token`,
3588
- data,
3589
- {
3590
- headers: {
3591
- "Content-Type": "application/x-www-form-urlencoded"
3592
- }
3593
- }
3594
- );
3595
- } catch (error) {
3596
- if (error instanceof Error) {
3597
- throw new Error(`Couldn't exchange code for token. [${error.message}]`);
3598
- } else {
3599
- throw error;
3092
+ return platformAccountsClientInstance.post(`/v2/token`, data, {
3093
+ headers: {
3094
+ "Content-Type": "application/x-www-form-urlencoded"
3600
3095
  }
3601
- }
3096
+ }).catch((error) => {
3097
+ throw error.withCustomMessage("Couldn't exchange code for token.");
3098
+ });
3602
3099
  });
3603
3100
  }
3604
3101
  };
@@ -3616,10 +3113,32 @@ var platformAccountsApi = {
3616
3113
  };
3617
3114
 
3618
3115
  // src/apis/platform/dps/instance.ts
3619
- import axios14 from "axios";
3620
- 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({
3621
3124
  baseURL: "https://dev-platform.labs.livechatinc.com"
3622
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
+ );
3623
3142
  function getPlatformDpsClientAuthorization(req) {
3624
3143
  var _a;
3625
3144
  return {
@@ -3682,6 +3201,23 @@ var platformDpsApplicationAuthorizationApi = {
3682
3201
  throw error;
3683
3202
  }
3684
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
+ });
3685
3221
  }
3686
3222
  };
3687
3223
 
@@ -3791,24 +3327,227 @@ var platformDpsApplicationAutoReviewApi = {
3791
3327
  }
3792
3328
  };
3793
3329
 
3794
- // src/apis/platform/dps/applications/application/chatActions/api.ts
3795
- var platformDpsApplicationChatActionsApi = {
3796
- createChatAction(appId, payload, authorization) {
3797
- return __async(this, null, function* () {
3798
- try {
3799
- yield platformDpsClientInstance.put(
3800
- `/v2/applications/${appId}/chat-actions/${payload.id}`,
3801
- payload,
3802
- getPlatformDpsClientConfig(authorization)
3803
- );
3804
- } catch (error) {
3805
- if (error instanceof Error) {
3806
- throw new Error(
3807
- `${API_NOTIFICATIONS.BUILDING_BLOCKS.FAILURE.CREATED} [${error.message}]`
3808
- );
3809
- }
3810
- throw error;
3811
- }
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
+ );
3548
+ }
3549
+ throw error;
3550
+ }
3812
3551
  });
3813
3552
  },
3814
3553
  updateChatAction(appId, payload, authorization) {
@@ -3936,6 +3675,24 @@ var platformDpsApplicationDisplayApi = {
3936
3675
  }
3937
3676
  });
3938
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
+ },
3939
3696
  updateOverview(appId, data, authorization) {
3940
3697
  return __async(this, null, function* () {
3941
3698
  try {
@@ -4074,6 +3831,7 @@ var platformDpsApplicationInfrastructureBlocksApi = {
4074
3831
  `/v2/applications/${appId}/infrastructure/blocks`,
4075
3832
  getPlatformDpsClientConfig(authorization)
4076
3833
  );
3834
+ delete response.data.appId;
4077
3835
  return response.data;
4078
3836
  });
4079
3837
  },
@@ -4138,20 +3896,6 @@ var platformDpsApplicationInfrastructureBlocksApi = {
4138
3896
  getPlatformDpsClientConfig(authorization)
4139
3897
  );
4140
3898
  });
4141
- },
4142
- updateLogger(appId, payload, authorization) {
4143
- return __async(this, null, function* () {
4144
- yield platformDpsClientInstance.post(
4145
- `/v2/applications/${appId}/infrastructure/blocks`,
4146
- {
4147
- appId,
4148
- logger: {
4149
- provider: payload.provider
4150
- }
4151
- },
4152
- getPlatformDpsClientConfig(authorization)
4153
- );
4154
- });
4155
3899
  }
4156
3900
  };
4157
3901
 
@@ -4538,6 +4282,23 @@ var platformDpsApplicationWebhooksApi = {
4538
4282
  }
4539
4283
  });
4540
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
+ },
4541
4302
  getChatWebhook(appId, authorization) {
4542
4303
  return __async(this, null, function* () {
4543
4304
  try {
@@ -4675,8 +4436,10 @@ var platformDpsApplicationApi = {
4675
4436
  );
4676
4437
  return response.data;
4677
4438
  } catch (error) {
4678
- if (error instanceof Error) {
4679
- 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
+ );
4680
4443
  }
4681
4444
  throw error;
4682
4445
  }
@@ -5255,7 +5018,7 @@ var platformDpsApi = {
5255
5018
  };
5256
5019
 
5257
5020
  // src/apis/platform/adapter/instance.ts
5258
- import axios15 from "axios";
5021
+ import axios14 from "axios";
5259
5022
  var REGION2 = {
5260
5023
  FRA: "fra",
5261
5024
  DAL: "dal",
@@ -5269,6 +5032,12 @@ var getRegion2 = (token) => {
5269
5032
  return region;
5270
5033
  }
5271
5034
  };
5035
+ var AdapterApiError = class extends ApiErrorBase {
5036
+ constructor() {
5037
+ super(...arguments);
5038
+ this.name = "adapter";
5039
+ }
5040
+ };
5272
5041
  function getPlatformAdapterClientAuthorization(req) {
5273
5042
  return {
5274
5043
  platform: {
@@ -5282,33 +5051,33 @@ function getPlatformAdapterClientAuthorization(req) {
5282
5051
  vercel: req.headers["vercel-token"],
5283
5052
  planetscale: req.headers["planetscale-token"],
5284
5053
  neon: req.headers["neon-token"],
5285
- sentry: req.headers["sentry-token"],
5286
5054
  openai: req.headers["openai-token"]
5287
5055
  };
5288
5056
  }
5289
- var platformAdapterClientInstance = axios15.create({
5057
+ var platformAdapterClientInstance = axios14.create({
5290
5058
  baseURL: "https://platform.labs.text.com/console-adapter/api",
5291
5059
  headers: {
5292
5060
  "Content-Type": "application/json"
5293
5061
  }
5294
5062
  });
5295
5063
  platformAdapterClientInstance.interceptors.response.use(
5296
- (r) => r,
5064
+ (response) => response,
5297
5065
  (error) => {
5298
- var _a;
5299
- if (axios15.isAxiosError(error)) {
5300
- if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
5301
- const source = error.response.data.error.source;
5302
- if (source) {
5303
- throw new UnauthorizeApiError(source);
5304
- }
5305
- }
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
+ );
5306
5075
  }
5307
- throw error;
5076
+ return Promise.reject(error);
5308
5077
  }
5309
5078
  );
5310
5079
  function getPlatformAdapterClientConfig(options = {}) {
5311
- 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;
5312
5081
  const currentHeaders = platformAdapterClientInstance.defaults.headers;
5313
5082
  const headers = {
5314
5083
  platform: {
@@ -5323,41 +5092,44 @@ function getPlatformAdapterClientConfig(options = {}) {
5323
5092
  vercel: (_h = currentHeaders["vercel-token"]) != null ? _h : options.vercel,
5324
5093
  planetscale: (_i = currentHeaders["planetscale-token"]) != null ? _i : options.planetscale,
5325
5094
  neon: (_j = currentHeaders["neon-token"]) != null ? _j : options.neon,
5326
- sentry: (_k = currentHeaders["sentry-token"]) != null ? _k : options.sentry,
5327
- openai: (_l = currentHeaders["openai-token"]) != null ? _l : options.openai
5095
+ openai: (_k = currentHeaders["openai-token"]) != null ? _k : options.openai
5328
5096
  }
5329
5097
  };
5330
5098
  if (currentHeaders["platform-dps-token"]) {
5331
- 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;
5332
5100
  }
5333
- if (((_o = (_n = options.ensureAuthorizationToken) == null ? void 0 : _n.platform) == null ? void 0 : _o.dps) && !headers.platform.dps) {
5334
- 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");
5335
5103
  }
5336
- 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)) {
5337
5105
  throw new UnauthorizeApiError("github");
5338
5106
  }
5339
- 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) {
5340
5108
  throw new UnauthorizeApiError("vercel");
5341
5109
  }
5342
- 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) {
5343
5111
  throw new UnauthorizeApiError("netlify");
5344
5112
  }
5345
- 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) {
5346
5114
  throw new UnauthorizeApiError("planetscale");
5347
5115
  }
5348
- 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) {
5349
5117
  throw new UnauthorizeApiError("neon");
5350
5118
  }
5351
- if (((_u = options.ensureAuthorizationToken) == null ? void 0 : _u.sentry) && !headers.integrations.sentry) {
5352
- throw new UnauthorizeApiError("sentry");
5353
- }
5354
- 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) {
5355
5120
  throw new UnauthorizeApiError("openai");
5356
5121
  }
5357
5122
  return {
5358
- 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 } : {})
5359
5124
  };
5360
5125
  }
5126
+ var getPlatformAdapterClientDefaultConfig = (authorization) => getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5127
+ ensureAuthorizationToken: {
5128
+ platform: {
5129
+ dps: true
5130
+ }
5131
+ }
5132
+ }));
5361
5133
  function initPlatformAdapterClientInstance(baseUrl, tokens) {
5362
5134
  if (baseUrl) {
5363
5135
  platformAdapterClientInstance.interceptors.request.use(
@@ -5396,253 +5168,344 @@ function updatePlatformAdapterClientInstance(tokens) {
5396
5168
  if (tokens == null ? void 0 : tokens.neon) {
5397
5169
  headers["neon-token"] = tokens.neon;
5398
5170
  }
5399
- if (tokens == null ? void 0 : tokens.sentry) {
5400
- headers["sentry-token"] = tokens.sentry;
5401
- }
5402
5171
  if (tokens == null ? void 0 : tokens.openai) {
5403
5172
  headers["openai-token"] = tokens.openai;
5404
5173
  }
5405
5174
  }
5406
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
+
5407
5214
  // src/apis/platform/adapter/app/blocks/deployment/api.ts
5408
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
+ },
5409
5224
  get(appId, authorization) {
5410
5225
  return __async(this, null, function* () {
5411
- const response = yield platformAdapterClientInstance.get(
5226
+ return platformAdapterClientInstance.get(
5412
5227
  `/console/app/${appId}/blocks/deployment`,
5413
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5414
- ensureAuthorizationToken: {
5415
- platform: {
5416
- dps: true
5417
- }
5418
- }
5419
- }))
5228
+ getPlatformAdapterClientDefaultConfig(authorization)
5420
5229
  );
5421
- return response.data;
5422
5230
  });
5423
5231
  },
5424
5232
  link(payload, authorization) {
5425
5233
  return __async(this, null, function* () {
5426
- const response = yield platformAdapterClientInstance.post(
5427
- `/console/app/${payload.appId}/blocks/deployment/link`,
5234
+ return platformAdapterClientInstance.put(
5235
+ `/console/app/${payload.appId}/blocks/deployment`,
5428
5236
  payload,
5429
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5430
- ensureAuthorizationToken: {
5431
- platform: {
5432
- dps: true
5433
- }
5434
- }
5435
- }))
5237
+ getPlatformAdapterClientDefaultConfig(authorization)
5436
5238
  );
5437
- return response.data;
5438
5239
  });
5439
5240
  },
5440
5241
  unlink(payload, authorization) {
5441
5242
  return __async(this, null, function* () {
5442
- yield platformAdapterClientInstance.post(
5443
- `/console/app/${payload.appId}/blocks/deployment/unlink`,
5444
- payload,
5445
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5446
- ensureAuthorizationToken: {
5447
- platform: {
5448
- dps: true
5449
- }
5450
- }
5451
- }))
5243
+ return platformAdapterClientInstance.delete(
5244
+ `/console/app/${payload.appId}/blocks/deployment?${new URLSearchParams(
5245
+ payload
5246
+ ).toString()}`,
5247
+ getPlatformAdapterClientDefaultConfig(authorization)
5452
5248
  );
5453
5249
  });
5454
5250
  },
5455
- installSentry(appId, authorization) {
5251
+ upsert(payload, authorization) {
5456
5252
  return __async(this, null, function* () {
5457
- yield platformAdapterClientInstance.post(
5458
- `/console/app/${appId}/blocks/deployment/install/sentry`,
5459
- {},
5460
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5461
- ensureAuthorizationToken: {
5462
- platform: {
5463
- dps: true
5464
- }
5465
- }
5466
- }))
5253
+ return platformAdapterClientInstance.patch(
5254
+ `/console/app/${payload.appId}/blocks/deployment`,
5255
+ payload,
5256
+ getPlatformAdapterClientDefaultConfig(authorization)
5467
5257
  );
5468
5258
  });
5469
5259
  }
5470
5260
  };
5471
5261
 
5472
- // src/apis/platform/adapter/app/blocks/logger/providers/sentry/api.ts
5473
- var platformAdapterAppSentryLoggerApi = {
5474
- get(projectSlug, authorization) {
5262
+ // src/apis/platform/adapter/app/blocks/monetization/api.ts
5263
+ var platformAdapterAppMonetizationApi = {
5264
+ get(appId, authorization) {
5475
5265
  return __async(this, null, function* () {
5476
- const response = yield platformAdapterClientInstance.get(
5477
- `/console/app/blocks/logger/providers/sentry/get?projectSlug=${projectSlug}`,
5478
- getPlatformAdapterClientConfig(authorization)
5266
+ return platformAdapterClientInstance.get(
5267
+ `/console/app/${appId}/blocks/monetization`,
5268
+ getPlatformAdapterClientDefaultConfig(authorization)
5479
5269
  );
5480
- return response.data;
5481
5270
  });
5482
5271
  },
5483
- link(payload, authorization) {
5272
+ upsert(payload, authorization) {
5484
5273
  return __async(this, null, function* () {
5485
- yield platformAdapterClientInstance.post(
5486
- "/console/app/blocks/logger/providers/sentry/link",
5274
+ return platformAdapterClientInstance.post(
5275
+ `/console/app/${payload.appId}/blocks/monetization`,
5487
5276
  payload,
5488
- getPlatformAdapterClientConfig(authorization)
5277
+ getPlatformAdapterClientDefaultConfig(authorization)
5489
5278
  );
5490
5279
  });
5491
5280
  },
5492
- unlink(payload, authorization) {
5281
+ remove(payload, authorization) {
5493
5282
  return __async(this, null, function* () {
5494
- yield platformAdapterClientInstance.post(
5495
- "/console/app/blocks/logger/providers/sentry/unlink",
5496
- payload,
5497
- 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)
5498
5298
  );
5499
5299
  });
5500
5300
  },
5501
- reauthorizeSentryApp(userId, sentryInstallationId, sentryRefreshToken, authorization) {
5301
+ upsert(payload, authorization) {
5502
5302
  return __async(this, null, function* () {
5503
- const response = yield platformAdapterClientInstance.post(
5504
- "/integrations/sentry/refresh",
5505
- {
5506
- userId,
5507
- sentryInstallationId,
5508
- sentryRefreshToken
5509
- },
5510
- getPlatformAdapterClientConfig(authorization)
5303
+ return platformAdapterClientInstance.post(
5304
+ `/console/app/${payload.appId}/blocks/properties/${payload.propertyId}`,
5305
+ payload,
5306
+ getPlatformAdapterClientDefaultConfig(authorization)
5511
5307
  );
5512
- return response.data;
5513
5308
  });
5514
5309
  },
5515
- requestSentryIssueSolution(stacktrace, authorization) {
5310
+ remove(payload, authorization) {
5516
5311
  return __async(this, null, function* () {
5517
- const response = yield platformAdapterClientInstance.post(
5518
- "/integrations/openai/issues/solution",
5519
- {
5520
- stacktrace
5521
- },
5522
- getPlatformAdapterClientConfig(authorization)
5312
+ return platformAdapterClientInstance.delete(
5313
+ `/console/app/${payload.appId}/blocks/properties/${payload.propertyId}`,
5314
+ getPlatformAdapterClientDefaultConfig(authorization)
5523
5315
  );
5524
- return response.data;
5525
5316
  });
5526
5317
  }
5527
5318
  };
5528
5319
 
5529
- // src/apis/platform/adapter/app/blocks/logger/api.ts
5530
- var platformAdapterAppLoggerApi = {
5531
- providers: {
5532
- 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
+ });
5533
5347
  }
5534
5348
  };
5535
5349
 
5536
5350
  // src/apis/platform/adapter/app/blocks/repository/api.ts
5537
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
+ },
5538
5360
  get(appId, authorization) {
5539
5361
  return __async(this, null, function* () {
5540
- const response = yield platformAdapterClientInstance.get(
5362
+ return platformAdapterClientInstance.get(
5541
5363
  `/console/app/${appId}/blocks/repository`,
5542
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5543
- ensureAuthorizationToken: {
5544
- platform: {
5545
- dps: true
5546
- }
5547
- }
5548
- }))
5364
+ getPlatformAdapterClientDefaultConfig(authorization)
5549
5365
  );
5550
- return response.data;
5551
5366
  });
5552
5367
  },
5553
5368
  link(payload, authorization) {
5554
5369
  return __async(this, null, function* () {
5555
- const response = yield platformAdapterClientInstance.post(
5556
- `/console/app/${payload.appId}/blocks/repository/link`,
5370
+ return platformAdapterClientInstance.put(
5371
+ `/console/app/${payload.appId}/blocks/repository`,
5557
5372
  payload,
5558
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5559
- ensureAuthorizationToken: {
5560
- platform: {
5561
- dps: true
5562
- }
5563
- }
5564
- }))
5373
+ getPlatformAdapterClientDefaultConfig(authorization)
5565
5374
  );
5566
- return response.data;
5567
5375
  });
5568
5376
  },
5569
5377
  unlink(payload, authorization) {
5570
5378
  return __async(this, null, function* () {
5571
- yield platformAdapterClientInstance.post(
5572
- `/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`,
5573
5391
  payload,
5574
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5575
- ensureAuthorizationToken: {
5576
- platform: {
5577
- dps: true
5578
- }
5579
- }
5580
- }))
5392
+ getPlatformAdapterClientDefaultConfig(authorization)
5581
5393
  );
5582
5394
  });
5583
5395
  },
5584
5396
  seed(payload, authorization) {
5585
5397
  return __async(this, null, function* () {
5586
- const response = yield platformAdapterClientInstance.post(
5398
+ return platformAdapterClientInstance.post(
5587
5399
  `/console/app/${payload.appId}/blocks/repository/seed`,
5588
5400
  payload,
5589
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5590
- ensureAuthorizationToken: {
5591
- platform: {
5592
- dps: true
5593
- }
5594
- }
5595
- }))
5401
+ getPlatformAdapterClientDefaultConfig(authorization)
5596
5402
  );
5597
- return response.data;
5598
5403
  });
5599
5404
  }
5600
5405
  };
5601
5406
 
5602
5407
  // src/apis/platform/adapter/app/blocks/storage/api.ts
5603
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
+ },
5604
5417
  get(appId, authorization) {
5605
5418
  return __async(this, null, function* () {
5606
- const response = yield platformAdapterClientInstance.get(
5419
+ return platformAdapterClientInstance.get(
5607
5420
  `/console/app/${appId}/blocks/storage`,
5608
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5609
- ensureAuthorizationToken: {
5610
- platform: {
5611
- dps: true
5612
- }
5613
- }
5614
- }))
5421
+ getPlatformAdapterClientDefaultConfig(authorization)
5615
5422
  );
5616
- return response.data;
5617
5423
  });
5618
5424
  },
5619
5425
  link(payload, authorization) {
5620
5426
  return __async(this, null, function* () {
5621
- yield platformAdapterClientInstance.post(
5622
- `/console/app/${payload.appId}/blocks/storage/link`,
5427
+ return platformAdapterClientInstance.put(
5428
+ `/console/app/${payload.appId}/blocks/storage`,
5623
5429
  payload,
5624
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5625
- ensureAuthorizationToken: {
5626
- platform: {
5627
- dps: true
5628
- }
5629
- }
5630
- }))
5430
+ getPlatformAdapterClientDefaultConfig(authorization)
5631
5431
  );
5632
5432
  });
5633
5433
  },
5634
5434
  unlink(payload, authorization) {
5635
5435
  return __async(this, null, function* () {
5636
- yield platformAdapterClientInstance.post(
5637
- `/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`,
5638
5448
  payload,
5639
- getPlatformAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
5640
- ensureAuthorizationToken: {
5641
- platform: {
5642
- dps: true
5643
- }
5644
- }
5645
- }))
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)
5646
5509
  );
5647
5510
  });
5648
5511
  }
@@ -5650,10 +5513,13 @@ var platformAdapterAppStorageApi = {
5650
5513
 
5651
5514
  // src/apis/platform/adapter/app/blocks/api.ts
5652
5515
  var platformAdapterAppBlocksApi = {
5516
+ authorization: platformAdapterAppAuthorizationApi,
5517
+ monetization: platformAdapterAppMonetizationApi,
5653
5518
  repository: platformAdapterAppRepositoryApi,
5654
5519
  deployment: platformAdapterAppDeploymentApi,
5655
5520
  storage: platformAdapterAppStorageApi,
5656
- logger: platformAdapterAppLoggerApi
5521
+ properties: platformAdapterAppPropertiesApi,
5522
+ widgets: platformAdapterAppWidgetsApi
5657
5523
  };
5658
5524
 
5659
5525
  // src/apis/platform/adapter/app/variables/api.ts
@@ -5666,7 +5532,7 @@ var platformAdapterAppVariablesApi = {
5666
5532
  params: {
5667
5533
  decrypted
5668
5534
  }
5669
- }, getPlatformAdapterClientConfig(authorization))
5535
+ }, getPlatformAdapterClientDefaultConfig(authorization))
5670
5536
  );
5671
5537
  return response.data;
5672
5538
  });
@@ -5675,7 +5541,7 @@ var platformAdapterAppVariablesApi = {
5675
5541
  return __async(this, null, function* () {
5676
5542
  const response = yield platformAdapterClientInstance.get(
5677
5543
  `/console/app/${appId}/variables/${key}`,
5678
- getPlatformAdapterClientConfig(authorization)
5544
+ getPlatformAdapterClientDefaultConfig(authorization)
5679
5545
  );
5680
5546
  return response.data;
5681
5547
  });
@@ -5685,7 +5551,7 @@ var platformAdapterAppVariablesApi = {
5685
5551
  yield platformAdapterClientInstance.post(
5686
5552
  `/console/app/${appId}/variables/${key}/sync`,
5687
5553
  payload,
5688
- getPlatformAdapterClientConfig(authorization)
5554
+ getPlatformAdapterClientDefaultConfig(authorization)
5689
5555
  );
5690
5556
  });
5691
5557
  },
@@ -5694,7 +5560,7 @@ var platformAdapterAppVariablesApi = {
5694
5560
  yield platformAdapterClientInstance.post(
5695
5561
  `/console/app/${appId}/variables/${data.key}`,
5696
5562
  data,
5697
- getPlatformAdapterClientConfig(authorization)
5563
+ getPlatformAdapterClientDefaultConfig(authorization)
5698
5564
  );
5699
5565
  });
5700
5566
  },
@@ -5703,7 +5569,7 @@ var platformAdapterAppVariablesApi = {
5703
5569
  yield platformAdapterClientInstance.post(
5704
5570
  `/console/app/${appId}/variables/${data.key}/edit`,
5705
5571
  data,
5706
- getPlatformAdapterClientConfig(authorization)
5572
+ getPlatformAdapterClientDefaultConfig(authorization)
5707
5573
  );
5708
5574
  });
5709
5575
  },
@@ -5716,284 +5582,87 @@ var platformAdapterAppVariablesApi = {
5716
5582
  }
5717
5583
  };
5718
5584
 
5719
- // src/apis/platform/adapter/app/creator/api.ts
5720
- var platformAdapterAppCreatorApi = {
5721
- app(payload, authorization) {
5722
- return __async(this, null, function* () {
5723
- try {
5724
- const response = yield platformAdapterClientInstance.post(
5725
- `/console/app/new/app`,
5726
- payload,
5727
- getPlatformAdapterClientConfig(authorization)
5728
- );
5729
- return response.data;
5730
- } catch (error) {
5731
- if (error instanceof Error) {
5732
- throw new Error(`App couldn't be created. [${error.message}]`);
5733
- }
5734
- throw error;
5735
- }
5736
- });
5737
- },
5738
- repository(payload, authorization) {
5739
- return __async(this, null, function* () {
5740
- try {
5741
- const response = yield platformAdapterClientInstance.post(
5742
- `/console/app/new/repository`,
5743
- payload,
5744
- getPlatformAdapterClientConfig(authorization)
5745
- );
5746
- return response.data;
5747
- } catch (error) {
5748
- if (error instanceof Error) {
5749
- throw new Error(`Repository couldn't be created. [${error.message}]`);
5750
- }
5751
- throw error;
5752
- }
5753
- });
5754
- },
5755
- seed(payload, authorization) {
5756
- return __async(this, null, function* () {
5757
- try {
5758
- const response = yield platformAdapterClientInstance.post(
5759
- `/console/app/new/seed`,
5760
- payload,
5761
- getPlatformAdapterClientConfig(authorization)
5762
- );
5763
- return response.data;
5764
- } catch (error) {
5765
- if (error instanceof Error) {
5766
- throw new Error(`Seed couldn't be created. [${error.message}]`);
5767
- }
5768
- throw error;
5769
- }
5770
- });
5771
- },
5772
- deployment(payload, authorization) {
5773
- return __async(this, null, function* () {
5774
- try {
5775
- const response = yield platformAdapterClientInstance.post(
5776
- `/console/app/new/deployment`,
5777
- payload,
5778
- getPlatformAdapterClientConfig(authorization)
5779
- );
5780
- return response.data;
5781
- } catch (error) {
5782
- if (error instanceof Error) {
5783
- throw new Error(`Deployment couldn't be created. [${error.message}]`);
5784
- }
5785
- throw error;
5786
- }
5787
- });
5788
- },
5789
- deployment_accessible(payload, authorization) {
5585
+ // src/apis/platform/adapter/app/templates/api.ts
5586
+ var platformAdapterAppTemplatesApi = {
5587
+ getTemplates(authorization) {
5790
5588
  return __async(this, null, function* () {
5791
5589
  try {
5792
- const response = yield platformAdapterClientInstance.post(
5793
- `/console/app/new/deployment_accessible`,
5794
- payload,
5795
- getPlatformAdapterClientConfig(authorization)
5590
+ const response = yield platformAdapterClientInstance.get(
5591
+ `/console/app/templates`,
5592
+ getPlatformAdapterClientDefaultConfig(authorization)
5796
5593
  );
5797
5594
  return response.data;
5798
5595
  } catch (error) {
5799
5596
  if (error instanceof Error) {
5800
5597
  throw new Error(
5801
- `Deployment accessibility couldn't be checked. [${error.message}]`
5598
+ `App templates couldn't be fetched. [${error.message}]`
5802
5599
  );
5803
5600
  }
5804
5601
  throw error;
5805
5602
  }
5806
5603
  });
5807
5604
  },
5808
- storage(payload, authorization) {
5605
+ getRepositoryTemplates(authorization) {
5809
5606
  return __async(this, null, function* () {
5810
5607
  try {
5811
- const response = yield platformAdapterClientInstance.post(
5812
- `/console/app/new/storage`,
5813
- payload,
5814
- getPlatformAdapterClientConfig(authorization)
5815
- );
5816
- return response.data;
5817
- } catch (error) {
5818
- if (error instanceof Error) {
5819
- throw new Error(`Storage couldn't be created. [${error.message}]`);
5820
- }
5821
- throw error;
5822
- }
5823
- });
5824
- },
5825
- authorization(payload, authorization) {
5826
- return __async(this, null, function* () {
5827
- try {
5828
- const response = yield platformAdapterClientInstance.post(
5829
- `/console/app/new/authorization`,
5830
- payload,
5831
- getPlatformAdapterClientConfig(authorization)
5608
+ const response = yield platformAdapterClientInstance.get(
5609
+ `/console/app/templates/repository`,
5610
+ getPlatformAdapterClientDefaultConfig(authorization)
5832
5611
  );
5833
5612
  return response.data;
5834
5613
  } catch (error) {
5835
5614
  if (error instanceof Error) {
5836
5615
  throw new Error(
5837
- `Authorization couldn't be created. [${error.message}]`
5616
+ `App repository templates couldn't be fetched. [${error.message}]`
5838
5617
  );
5839
5618
  }
5840
5619
  throw error;
5841
5620
  }
5842
5621
  });
5843
- },
5844
- widgets(payload, authorization) {
5845
- return __async(this, null, function* () {
5846
- try {
5847
- const response = yield platformAdapterClientInstance.post(
5848
- `/console/app/new/widgets`,
5849
- payload,
5850
- getPlatformAdapterClientConfig(authorization)
5851
- );
5852
- return response.data;
5853
- } catch (error) {
5854
- if (error instanceof Error) {
5855
- throw new Error(`Widgets couldn't be created. [${error.message}]`);
5856
- }
5857
- throw error;
5858
- }
5859
- });
5860
- },
5861
- properties(payload, authorization) {
5862
- return __async(this, null, function* () {
5863
- try {
5864
- const response = yield platformAdapterClientInstance.post(
5865
- `/console/app/new/properties`,
5866
- payload,
5867
- getPlatformAdapterClientConfig(authorization)
5868
- );
5869
- return response.data;
5870
- } catch (error) {
5871
- if (error instanceof Error) {
5872
- throw new Error(`Properties couldn't be created. [${error.message}]`);
5873
- }
5874
- throw error;
5875
- }
5876
- });
5877
- },
5878
- monetization(payload, authorization) {
5879
- return __async(this, null, function* () {
5880
- try {
5881
- const response = yield platformAdapterClientInstance.post(
5882
- `/console/app/new/monetization`,
5883
- payload,
5884
- getPlatformAdapterClientConfig(authorization)
5885
- );
5886
- return response.data;
5887
- } catch (error) {
5888
- if (error instanceof Error) {
5889
- throw new Error(`Monetization couldn't be created. [${error.message}]`);
5890
- }
5891
- throw error;
5892
- }
5893
- });
5894
5622
  }
5895
5623
  };
5896
5624
 
5897
- // src/apis/platform/adapter/app/manifest/api.ts
5898
- var platformAdapterAppManifestApi = {
5899
- 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) {
5900
5631
  return __async(this, null, function* () {
5901
- try {
5902
- const response = yield platformAdapterClientInstance.get(
5903
- `/console/app/${appId}/manifest`,
5904
- getPlatformAdapterClientConfig(authorization)
5905
- );
5906
- return response.data;
5907
- } catch (error) {
5908
- if (error instanceof Error) {
5909
- throw new Error(`App manifest couldn't be created. [${error.message}]`);
5910
- }
5911
- throw error;
5912
- }
5632
+ return platformAdapterClientInstance.post(
5633
+ `/console/app${payload.manifest.id ? `/${payload.manifest.id}` : ""}`,
5634
+ payload,
5635
+ getPlatformAdapterClientDefaultConfig(authorization)
5636
+ );
5913
5637
  });
5914
5638
  },
5915
- pushManifest(manifest, authorization) {
5639
+ pull(appId, authorization) {
5916
5640
  return __async(this, null, function* () {
5917
- try {
5918
- yield platformAdapterClientInstance.post(
5919
- `/console/app/${manifest.id}/manifest`,
5920
- manifest,
5921
- getPlatformAdapterClientConfig(authorization)
5922
- );
5923
- } catch (error) {
5924
- if (error instanceof Error) {
5925
- throw new Error(`App manifest couldn't be pushed. [${error.message}]`);
5926
- }
5927
- throw error;
5928
- }
5641
+ return platformAdapterClientInstance.get(
5642
+ `/console/app/${appId}`,
5643
+ getPlatformAdapterClientDefaultConfig(authorization)
5644
+ );
5929
5645
  });
5930
5646
  },
5931
- verifyManifest(manifest, authorization) {
5932
- return __async(this, null, function* () {
5933
- try {
5934
- const response = yield platformAdapterClientInstance.post(
5935
- `/console/app/${manifest.id}/manifest/verify`,
5936
- manifest,
5937
- getPlatformAdapterClientConfig(authorization)
5938
- );
5939
- return response.data;
5940
- } catch (error) {
5941
- if (error instanceof Error) {
5942
- throw new Error(
5943
- `App manifest couldn't be verified. [${error.message}]`
5944
- );
5945
- }
5946
- throw error;
5947
- }
5948
- });
5949
- }
5950
- };
5951
-
5952
- // src/apis/platform/adapter/app/api.ts
5953
- var platformAdapterAppApi = {
5954
- creator: platformAdapterAppCreatorApi,
5955
- blocks: platformAdapterAppBlocksApi,
5956
- variables: platformAdapterAppVariablesApi,
5957
- manifest: platformAdapterAppManifestApi,
5958
- create(payload, authorization) {
5647
+ verify(payload, authorization) {
5959
5648
  return __async(this, null, function* () {
5960
- const response = yield platformAdapterClientInstance.post(
5961
- `/console/app/new`,
5649
+ return platformAdapterClientInstance.post(
5650
+ `/console/app/${payload.appId}/verify`,
5962
5651
  payload,
5963
- getPlatformAdapterClientConfig(authorization)
5652
+ getPlatformAdapterClientDefaultConfig(authorization)
5964
5653
  );
5965
- return response.data;
5966
5654
  });
5967
5655
  },
5968
- createStatus(sagaId, authorization) {
5656
+ status(sagaId, authorization) {
5969
5657
  return __async(this, null, function* () {
5970
- const response = yield platformAdapterClientInstance.get(
5971
- `/console/app/new/status`,
5658
+ return platformAdapterClientInstance.get(
5659
+ `/console/app/status`,
5972
5660
  __spreadValues({
5973
5661
  params: {
5974
5662
  sagaId
5975
5663
  }
5976
- }, getPlatformAdapterClientConfig(authorization))
5664
+ }, getPlatformAdapterClientDefaultConfig(authorization))
5977
5665
  );
5978
- return response.data;
5979
- });
5980
- },
5981
- getTemplates(authorization) {
5982
- return __async(this, null, function* () {
5983
- try {
5984
- const response = yield platformAdapterClientInstance.get(
5985
- `/console/app/templates`,
5986
- getPlatformAdapterClientConfig(authorization)
5987
- );
5988
- return response.data;
5989
- } catch (error) {
5990
- if (error instanceof Error) {
5991
- throw new Error(
5992
- `App templates couldn't be created. [${error.message}]`
5993
- );
5994
- }
5995
- throw error;
5996
- }
5997
5666
  });
5998
5667
  }
5999
5668
  };
@@ -6013,8 +5682,8 @@ var platformAdapterConductorApi = {
6013
5682
  };
6014
5683
 
6015
5684
  // src/apis/platform/billing/instance.ts
6016
- import axios16 from "axios";
6017
- var platformBillingClientInstance = axios16.create({
5685
+ import axios15 from "axios";
5686
+ var platformBillingClientInstance = axios15.create({
6018
5687
  baseURL: "https://billing.labs.livechatinc.com"
6019
5688
  });
6020
5689
  function getPlatformBillingClientAuthorization(req) {
@@ -6034,10 +5703,10 @@ function getPlatformBillingClientConfig(options = {}) {
6034
5703
  function initPlatformBillingClientInstance(baseUrl, token) {
6035
5704
  if (baseUrl) {
6036
5705
  platformBillingClientInstance.interceptors.request.use(
6037
- (config) => __async(this, null, function* () {
5706
+ (config) => {
6038
5707
  config.baseURL = baseUrl;
6039
5708
  return config;
6040
- }),
5709
+ },
6041
5710
  (error) => Promise.reject(error)
6042
5711
  );
6043
5712
  }
@@ -6203,7 +5872,7 @@ var api = {
6203
5872
  isInitialized: false
6204
5873
  };
6205
5874
  function initApi(config, tokens) {
6206
- 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;
6207
5876
  initPlatformAccountsClientInstance(
6208
5877
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
6209
5878
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.dps
@@ -6229,27 +5898,35 @@ function initApi(config, tokens) {
6229
5898
  netlify: (_k = tokens.netlify) == null ? void 0 : _k.token,
6230
5899
  vercel: (_l = tokens.vercel) == null ? void 0 : _l.token,
6231
5900
  neon: (_m = tokens.neon) == null ? void 0 : _m.token,
6232
- planetscale: (_n = tokens.planetscale) == null ? void 0 : _n.token,
6233
- sentry: (_o = tokens.sentry) == null ? void 0 : _o.token
5901
+ planetscale: (_n = tokens.planetscale) == null ? void 0 : _n.token
6234
5902
  } : void 0
6235
5903
  );
6236
5904
  initLiveChatClientInstance(
6237
- (_p = config.urls.products) == null ? void 0 : _p.livechat,
6238
- (_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
6239
5907
  );
6240
- initTextClientInstance((_r = config.urls.integrations) == null ? void 0 : _r.text, (_s = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _s.dps);
6241
- initGithubClientInstance((_t = tokens == null ? void 0 : tokens.github) == null ? void 0 : _t.apps);
6242
- initNetlifyClientInstance((_u = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _u.token);
6243
- initVercelClientInstance((_v = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _v.token);
6244
- initNeonClientInstance((_w = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _w.token);
6245
- initPlanetScaleClientInstance((_x = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _x.token);
6246
- 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);
6247
5914
  api.isInitialized = true;
6248
5915
  }
6249
5916
  export {
6250
5917
  API_NOTIFICATIONS,
5918
+ AccountsApiError,
5919
+ AdapterApiError,
5920
+ ApiErrorBase,
5921
+ DpsApiError,
6251
5922
  UnauthorizeApiError,
5923
+ allAppTemplates,
6252
5924
  api,
5925
+ appBaseTemplates,
5926
+ appRepositoryTemplates,
5927
+ appRepositoryTemplatesMap,
5928
+ appTemplates,
5929
+ appTemplatesMap,
6253
5930
  getAppAutoReviewPayload,
6254
5931
  getEmptyAppAutoReview,
6255
5932
  getGitHubClientAuthorization,
@@ -6266,14 +5943,13 @@ export {
6266
5943
  getPlatformAccountsClientConfig,
6267
5944
  getPlatformAdapterClientAuthorization,
6268
5945
  getPlatformAdapterClientConfig,
5946
+ getPlatformAdapterClientDefaultConfig,
6269
5947
  getPlatformBillingClientAuthorization,
6270
5948
  getPlatformBillingClientConfig,
6271
5949
  getPlatformDpsAdminClientAuthorization,
6272
5950
  getPlatformDpsClientAuthorization,
6273
5951
  getPlatformDpsClientConfig,
6274
5952
  getRegion,
6275
- getSentryClientAuthorization,
6276
- getSentryClientConfig,
6277
5953
  getTextClientAuthorization,
6278
5954
  getTextClientConfig,
6279
5955
  getVercelClientAuthorization,
@@ -6289,7 +5965,6 @@ export {
6289
5965
  initPlatformAdapterClientInstance,
6290
5966
  initPlatformBillingClientInstance,
6291
5967
  initPlatformDpsClientInstance,
6292
- initSentryClientInstance,
6293
5968
  initTextClientInstance,
6294
5969
  initVercelClientInstance,
6295
5970
  livechatClientInstance,
@@ -6300,14 +5975,12 @@ export {
6300
5975
  platformAdapterClientInstance,
6301
5976
  platformBillingClientInstance,
6302
5977
  platformDpsClientInstance,
6303
- sentryClientInstance,
6304
5978
  textClientInstance,
6305
5979
  updateGithubClientInstance,
6306
5980
  updateNeonClientInstance,
6307
5981
  updateNetlifyClientInstance,
6308
5982
  updatePlanetScaleClientInstance,
6309
5983
  updatePlatformAdapterClientInstance,
6310
- updateSentryClientInstance,
6311
5984
  updateVercelClientInstance,
6312
5985
  vercelClientInstance
6313
5986
  };