@livechat/developer-studio-api 3.4.24 → 3.5.0

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
@@ -156,6 +156,18 @@ var UnauthorizeApiError = class extends Error {
156
156
  };
157
157
 
158
158
  // src/apis/integrations/bigcommerce/instance.ts
159
+ function getBigCommerceClientAuthorization(req, headerPrefix = "x-adapter-bigcommerce") {
160
+ if (req.headers instanceof Headers) {
161
+ return {
162
+ shop: req.headers.get(`${headerPrefix}-shop`),
163
+ token: req.headers.get(`${headerPrefix}-token`)
164
+ };
165
+ }
166
+ return {
167
+ shop: req.headers[`${headerPrefix}-shop`],
168
+ token: req.headers[`${headerPrefix}-token`]
169
+ };
170
+ }
159
171
  var BigCommerceApiError = class extends ApiErrorBase {
160
172
  constructor() {
161
173
  super(...arguments);
@@ -294,6 +306,18 @@ import axios4 from "axios";
294
306
 
295
307
  // src/apis/integrations/github/instance.ts
296
308
  import axios3 from "axios";
309
+ function getGitHubClientAuthorization(req, headerPrefix = "x-adapter-github") {
310
+ if (req.headers instanceof Headers) {
311
+ return {
312
+ appToken: req.headers.get(`${headerPrefix}-app-token`),
313
+ oauthToken: req.headers.get(`${headerPrefix}-oauth-token`)
314
+ };
315
+ }
316
+ return {
317
+ appToken: req.headers[`${headerPrefix}-app-token`],
318
+ oauthToken: req.headers[`${headerPrefix}-oauth-token`]
319
+ };
320
+ }
297
321
  var githubClientInstance = axios3.create({
298
322
  baseURL: "https://api.github.com",
299
323
  headers: {
@@ -747,6 +771,16 @@ var gitHubApi = {
747
771
 
748
772
  // src/apis/integrations/hubspot/instance.ts
749
773
  import axios5 from "axios";
774
+ function getHubspotClientAuthorization(req, headerPrefix = "x-adapter-hubspot") {
775
+ if (req.headers instanceof Headers) {
776
+ return {
777
+ token: req.headers.get(`${headerPrefix}-token`)
778
+ };
779
+ }
780
+ return {
781
+ token: req.headers[`${headerPrefix}-token`]
782
+ };
783
+ }
750
784
  var HubspotApiError = class extends ApiErrorBase {
751
785
  constructor() {
752
786
  super(...arguments);
@@ -968,6 +1002,18 @@ import axios7 from "axios";
968
1002
 
969
1003
  // src/apis/integrations/mailchimp/instance.ts
970
1004
  import axios6 from "axios";
1005
+ function getMailchimpClientAuthorization(req, headerPrefix = "x-adapter-mailchimp") {
1006
+ if (req.headers instanceof Headers) {
1007
+ return {
1008
+ server: req.headers.get(`${headerPrefix}-server`),
1009
+ token: req.headers.get(`${headerPrefix}-token`)
1010
+ };
1011
+ }
1012
+ return {
1013
+ server: req.headers[`${headerPrefix}-server`],
1014
+ token: req.headers[`${headerPrefix}-token`]
1015
+ };
1016
+ }
971
1017
  var MailchimpApiError = class extends ApiErrorBase {
972
1018
  constructor() {
973
1019
  super(...arguments);
@@ -1465,6 +1511,16 @@ import { AxiosError as AxiosError2 } from "axios";
1465
1511
 
1466
1512
  // src/apis/integrations/netlify/instance.ts
1467
1513
  import axios10 from "axios";
1514
+ function getNetlifyClientAuthorization(req, headerPrefix = "x-adapter-netlify-token") {
1515
+ if (req.headers instanceof Headers) {
1516
+ return {
1517
+ token: req.headers.get(`${headerPrefix}-token`)
1518
+ };
1519
+ }
1520
+ return {
1521
+ token: req.headers[`${headerPrefix}-token`]
1522
+ };
1523
+ }
1468
1524
  var netlifyClientInstance = axios10.create({
1469
1525
  baseURL: "https://api.netlify.com/api/v1",
1470
1526
  headers: {
@@ -2228,6 +2284,18 @@ import axios16 from "axios";
2228
2284
 
2229
2285
  // src/apis/integrations/shopify/instance.ts
2230
2286
  import axios15 from "axios";
2287
+ function getShopifyClientAuthorization(req, headerPrefix = "x-adapter-shopify") {
2288
+ if (req.headers instanceof Headers) {
2289
+ return {
2290
+ shop: req.headers.get(`${headerPrefix}-shop`),
2291
+ token: req.headers.get(`${headerPrefix}-token`)
2292
+ };
2293
+ }
2294
+ return {
2295
+ shop: req.headers[`${headerPrefix}-shop`],
2296
+ token: req.headers[`${headerPrefix}-token`]
2297
+ };
2298
+ }
2231
2299
  var ShopifyApiError = class extends ApiErrorBase {
2232
2300
  constructor() {
2233
2301
  super(...arguments);
@@ -2370,6 +2438,16 @@ var SlackApiError = class extends ApiErrorBase {
2370
2438
  this.name = "slack";
2371
2439
  }
2372
2440
  };
2441
+ function getSlackClientAuthorization(req, headerPrefix = "x-adapter-slack") {
2442
+ if (req.headers instanceof Headers) {
2443
+ return {
2444
+ token: req.headers.get(`${headerPrefix}-token`)
2445
+ };
2446
+ }
2447
+ return {
2448
+ token: req.headers[`${headerPrefix}-token`]
2449
+ };
2450
+ }
2373
2451
  var slackClientInstance = axios17.create({
2374
2452
  baseURL: "https://slack.com/api",
2375
2453
  headers: {
@@ -2474,6 +2552,18 @@ var slackApi = {
2474
2552
 
2475
2553
  // src/apis/integrations/text/instance.ts
2476
2554
  import axios18 from "axios";
2555
+ function getTextClientAuthorization(req, headerPrefix = "x-adapter-text") {
2556
+ if (req.headers instanceof Headers) {
2557
+ return {
2558
+ token: req.headers.get(`${headerPrefix}-token`),
2559
+ tokenType: "Bearer"
2560
+ };
2561
+ }
2562
+ return {
2563
+ token: req.headers[`${headerPrefix}-token`],
2564
+ tokenType: "Bearer"
2565
+ };
2566
+ }
2477
2567
  var TextApiError = class extends ApiErrorBase {
2478
2568
  constructor() {
2479
2569
  super(...arguments);
@@ -2750,6 +2840,16 @@ var WorkflowExecutionStatus = /* @__PURE__ */ ((WorkflowExecutionStatus2) => {
2750
2840
 
2751
2841
  // src/apis/integrations/vercel/instance.ts
2752
2842
  import axios19 from "axios";
2843
+ function getVercelClientAuthorization(req, headerPrefix = "x-adapter-vercel") {
2844
+ if (req.headers instanceof Headers) {
2845
+ return {
2846
+ token: req.headers.get(`${headerPrefix}-token`)
2847
+ };
2848
+ }
2849
+ return {
2850
+ token: req.headers[`${headerPrefix}-token`]
2851
+ };
2852
+ }
2753
2853
  var vercelClientInstance = axios19.create({
2754
2854
  baseURL: "https://api.vercel.com"
2755
2855
  });
@@ -3692,6 +3792,147 @@ function initBillingClient(baseUrl, token) {
3692
3792
  }
3693
3793
  }
3694
3794
 
3795
+ // src/apis/platform/console/instance.ts
3796
+ import axios22 from "axios";
3797
+ var REGION2 = {
3798
+ FRA: "fra",
3799
+ DAL: "dal",
3800
+ FRA_A: "fra-a",
3801
+ FRA_B: "fra-b"
3802
+ };
3803
+ var supportedRegions2 = Object.values(REGION2);
3804
+ var getRegion2 = (token) => {
3805
+ const region = token.split(":")[0];
3806
+ if (supportedRegions2.includes(region)) {
3807
+ return region;
3808
+ }
3809
+ };
3810
+ var ConsoleApiError = class _ConsoleApiError extends ApiErrorBase {
3811
+ constructor() {
3812
+ super(...arguments);
3813
+ this.name = "console";
3814
+ }
3815
+ static notFound(message) {
3816
+ return new _ConsoleApiError(
3817
+ message != null ? message : "Not found",
3818
+ {
3819
+ errorCode: "not_found",
3820
+ errorMessage: "Not found"
3821
+ },
3822
+ 404
3823
+ );
3824
+ }
3825
+ };
3826
+ var consoleClientInstance = axios22.create({
3827
+ baseURL: "https://platform.labs.text.com/console/api",
3828
+ headers: {
3829
+ "Content-Type": "application/json"
3830
+ }
3831
+ });
3832
+ consoleClientInstance.interceptors.response.use(
3833
+ (response) => response,
3834
+ (error) => {
3835
+ var _a, _b;
3836
+ const apiError = (_a = error.response) == null ? void 0 : _a.data;
3837
+ if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
3838
+ return Promise.reject(new UnauthorizeApiError(apiError.source));
3839
+ } else if ((apiError == null ? void 0 : apiError.kind) === "error") {
3840
+ const data = (_b = error.response) == null ? void 0 : _b.data;
3841
+ return Promise.reject(
3842
+ new ConsoleApiError(data.message, data.data, data.code)
3843
+ );
3844
+ }
3845
+ return Promise.reject(error);
3846
+ }
3847
+ );
3848
+ function getConsoleClientConfig(options = {}) {
3849
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
3850
+ const currentHeaders = consoleClientInstance.defaults.headers;
3851
+ const headers = {
3852
+ platform: {
3853
+ token: (_c = currentHeaders.Authorization) != null ? _c : ((_a = options.platform) == null ? void 0 : _a.token) ? `${(_b = options.platform.tokenType) != null ? _b : "Bearer"} ${options.platform.token}` : void 0
3854
+ },
3855
+ integrations: {
3856
+ github: {
3857
+ app: (_e = currentHeaders["x-adapter-github-app-token"]) != null ? _e : (_d = options.github) == null ? void 0 : _d.appToken,
3858
+ oauth: (_g = currentHeaders["x-adapter-github-oauth-token"]) != null ? _g : (_f = options.github) == null ? void 0 : _f.oauthToken
3859
+ },
3860
+ netlify: (_i = currentHeaders["x-adapter-netlify-token"]) != null ? _i : (_h = options.netlify) == null ? void 0 : _h.token,
3861
+ vercel: (_k = currentHeaders["x-adapter-vercel-token"]) != null ? _k : (_j = options.vercel) == null ? void 0 : _j.token,
3862
+ planetscale: (_m = currentHeaders["x-adapter-planetscale-token"]) != null ? _m : (_l = options.planetscale) == null ? void 0 : _l.token,
3863
+ neon: (_o = currentHeaders["x-adapter-neon-token"]) != null ? _o : (_n = options.neon) == null ? void 0 : _n.token
3864
+ }
3865
+ };
3866
+ if (currentHeaders.Authorization) {
3867
+ currentHeaders["X-Region"] = (_p = getRegion2(currentHeaders.Authorization)) != null ? _p : void 0;
3868
+ }
3869
+ if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.platform) && !headers.platform.token) {
3870
+ throw new UnauthorizeApiError("accounts");
3871
+ }
3872
+ if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
3873
+ throw new UnauthorizeApiError("github");
3874
+ }
3875
+ if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.vercel) && !headers.integrations.vercel) {
3876
+ throw new UnauthorizeApiError("vercel");
3877
+ }
3878
+ if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.netlify) && !headers.integrations.netlify) {
3879
+ throw new UnauthorizeApiError("netlify");
3880
+ }
3881
+ if (((_u = options.ensureAuthorizationToken) == null ? void 0 : _u.planetscale) && !headers.integrations.planetscale) {
3882
+ throw new UnauthorizeApiError("planetscale");
3883
+ }
3884
+ if (((_v = options.ensureAuthorizationToken) == null ? void 0 : _v.neon) && !headers.integrations.neon) {
3885
+ throw new UnauthorizeApiError("neon");
3886
+ }
3887
+ return {
3888
+ headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.token ? { Authorization: headers.platform.token } : {}), headers.integrations.github.app ? { "x-adapter-github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "x-adapter-github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "x-adapter-netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "x-adapter-vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "x-adapter-planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.neon ? { "x-adapter-neon-token": headers.integrations.neon } : {})
3889
+ };
3890
+ }
3891
+ var getConsoleClientDefaultConfig = (authorization) => getConsoleClientConfig(__spreadProps(__spreadValues({}, authorization), {
3892
+ ensureAuthorizationToken: {
3893
+ platform: true
3894
+ }
3895
+ }));
3896
+ function initConsoleClient(baseUrl, tokens) {
3897
+ if (baseUrl) {
3898
+ consoleClientInstance.interceptors.request.use(
3899
+ (config) => {
3900
+ config.baseURL = baseUrl;
3901
+ return config;
3902
+ },
3903
+ (error) => Promise.reject(error)
3904
+ );
3905
+ }
3906
+ if (tokens) {
3907
+ updateConsoleClient(tokens);
3908
+ }
3909
+ }
3910
+ function updateConsoleClient(tokens) {
3911
+ var _a, _b, _c, _d, _e, _f, _g, _h;
3912
+ const headers = consoleClientInstance.defaults.headers;
3913
+ if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
3914
+ headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
3915
+ }
3916
+ if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.appToken) {
3917
+ headers["x-adapter-github-app-token"] = tokens.github.appToken;
3918
+ }
3919
+ if ((_d = tokens == null ? void 0 : tokens.github) == null ? void 0 : _d.oauthToken) {
3920
+ headers["x-adapter-github-oauth-token"] = tokens.github.oauthToken;
3921
+ }
3922
+ if ((_e = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _e.token) {
3923
+ headers["x-adapter-netlify-token"] = tokens.netlify.token;
3924
+ }
3925
+ if ((_f = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _f.token) {
3926
+ headers["x-adapter-vercel-token"] = tokens.vercel.token;
3927
+ }
3928
+ if ((_g = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _g.token) {
3929
+ headers["x-adapter-planetscale-token"] = tokens.planetscale.token;
3930
+ }
3931
+ if ((_h = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _h.token) {
3932
+ headers["x-adapter-neon-token"] = tokens.neon.token;
3933
+ }
3934
+ }
3935
+
3695
3936
  // src/apis/platform/dps/applications/application/autoReview/_contracts/dtos/autoReview.ts
3696
3937
  var getEmptyAppAutoReview = () => ({
3697
3938
  isReviewed: false,
@@ -3761,14 +4002,14 @@ var getAppAutoReviewPayload = (value) => {
3761
4002
  };
3762
4003
 
3763
4004
  // src/apis/platform/dps/instance.ts
3764
- import axios22 from "axios";
4005
+ import axios23 from "axios";
3765
4006
  var DpsApiError = class extends ApiErrorBase {
3766
4007
  constructor() {
3767
4008
  super(...arguments);
3768
4009
  this.name = "dps";
3769
4010
  }
3770
4011
  };
3771
- var dpsClientInstance = axios22.create({
4012
+ var dpsClientInstance = axios23.create({
3772
4013
  baseURL: "https://dev-platform.labs.livechatinc.com"
3773
4014
  });
3774
4015
  dpsClientInstance.interceptors.response.use(
@@ -3817,14 +4058,14 @@ function initDpsClient(baseUrl, token) {
3817
4058
  }
3818
4059
 
3819
4060
  // src/apis/products/helpdesk/instance.ts
3820
- import axios23 from "axios";
4061
+ import axios24 from "axios";
3821
4062
  var HelpDeskApiError = class extends ApiErrorBase {
3822
4063
  constructor() {
3823
4064
  super(...arguments);
3824
4065
  this.name = "helpdesk";
3825
4066
  }
3826
4067
  };
3827
- var helpdeskClientInstance = axios23.create({
4068
+ var helpdeskClientInstance = axios24.create({
3828
4069
  baseURL: "https://api.labs.helpdesk.com"
3829
4070
  });
3830
4071
  helpdeskClientInstance.interceptors.response.use(
@@ -3912,17 +4153,17 @@ var LivechatWebhookSystemMessages = /* @__PURE__ */ ((LivechatWebhookSystemMessa
3912
4153
  })(LivechatWebhookSystemMessages || {});
3913
4154
 
3914
4155
  // src/apis/products/livechat/instance.ts
3915
- import axios24 from "axios";
3916
- var REGION2 = {
4156
+ import axios25 from "axios";
4157
+ var REGION3 = {
3917
4158
  FRA: "fra",
3918
4159
  DAL: "dal",
3919
4160
  FRA_A: "fra-a",
3920
4161
  FRA_B: "fra-b"
3921
4162
  };
3922
- var supportedRegions2 = Object.values(REGION2);
3923
- var getRegion2 = (token) => {
4163
+ var supportedRegions3 = Object.values(REGION3);
4164
+ var getRegion3 = (token) => {
3924
4165
  const region = token.split(":")[0];
3925
- if (supportedRegions2.includes(region)) {
4166
+ if (supportedRegions3.includes(region)) {
3926
4167
  return region;
3927
4168
  }
3928
4169
  };
@@ -3932,7 +4173,7 @@ var LivechatApiError = class extends ApiErrorBase {
3932
4173
  this.name = "livechat";
3933
4174
  }
3934
4175
  };
3935
- var livechatClientInstance = axios24.create({
4176
+ var livechatClientInstance = axios25.create({
3936
4177
  baseURL: "https://api.labs.livechatinc.com"
3937
4178
  });
3938
4179
  livechatClientInstance.interceptors.response.use(
@@ -3967,7 +4208,7 @@ function getLiveChatClientConfig(options = {}) {
3967
4208
  };
3968
4209
  }
3969
4210
  function initLiveChatClient(baseUrl, token) {
3970
- const region = token ? getRegion2(token) : void 0;
4211
+ const region = token ? getRegion3(token) : void 0;
3971
4212
  const headers = livechatClientInstance.defaults.headers;
3972
4213
  if (baseUrl) {
3973
4214
  livechatClientInstance.interceptors.request.use(
@@ -4328,7 +4569,8 @@ var urls = {
4328
4569
  create: () => getUrl(),
4329
4570
  update: (id) => getUrl([id]),
4330
4571
  delete: (id) => getUrl([id]),
4331
- connect: (id) => getUrl([id, "connection"])
4572
+ connect: (id) => getUrl([id, "connection"]),
4573
+ disconnect: (id) => getUrl([id, "disconnect"])
4332
4574
  };
4333
4575
  var textPlatformWorkflowsCredentialsApi = {
4334
4576
  meta: {
@@ -4440,6 +4682,24 @@ var textPlatformWorkflowsCredentialsApi = {
4440
4682
  throw error;
4441
4683
  });
4442
4684
  });
4685
+ },
4686
+ disconnect(id, authorization) {
4687
+ return __async(this, null, function* () {
4688
+ return textClientInstance.put(
4689
+ urls.disconnect(id),
4690
+ {},
4691
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4692
+ ensureAuthorizationToken: true
4693
+ }))
4694
+ ).catch((error) => {
4695
+ if (error instanceof TextApiError) {
4696
+ throw error.withCustomMessage(
4697
+ `Couldn't disconnect to credentials. [${error.message}]`
4698
+ );
4699
+ }
4700
+ throw error;
4701
+ });
4702
+ });
4443
4703
  }
4444
4704
  };
4445
4705
 
@@ -4673,7 +4933,7 @@ var textApi = {
4673
4933
  };
4674
4934
 
4675
4935
  // src/apis/integrations/vercel/api.ts
4676
- import axios25 from "axios";
4936
+ import axios26 from "axios";
4677
4937
 
4678
4938
  // src/apis/integrations/vercel/deploy/api.ts
4679
4939
  var vercelDeployApi = {
@@ -4933,7 +5193,7 @@ var vercelApi = {
4933
5193
  client_secret: clientSecret,
4934
5194
  redirect_uri: redirectUrl
4935
5195
  });
4936
- const response = yield axios25.post("https://api.vercel.com/v2/oauth/access_token", data, {
5196
+ const response = yield axios26.post("https://api.vercel.com/v2/oauth/access_token", data, {
4937
5197
  headers: {
4938
5198
  "Content-Type": "application/x-www-form-urlencoded"
4939
5199
  }
@@ -5274,769 +5534,767 @@ var platformAccountsApi = {
5274
5534
  token: platformAccountsTokenApi
5275
5535
  };
5276
5536
 
5277
- // src/apis/platform/adapter/app/blocks/authorization/api.ts
5278
- var platformAdapterAppAuthorizationApi = {
5279
- get(appId, authorization) {
5280
- return __async(this, null, function* () {
5281
- return adapterClientInstance.get(
5282
- `/console/app/${encodeURIComponent(appId)}/blocks/authorization`,
5283
- getAdapterClientDefaultConfig(authorization)
5284
- );
5285
- });
5286
- },
5287
- add(payload, authorization) {
5288
- return __async(this, null, function* () {
5289
- return adapterClientInstance.post(
5290
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5291
- payload,
5292
- getAdapterClientDefaultConfig(authorization)
5293
- );
5294
- });
5295
- },
5296
- update(payload, authorization) {
5297
- return __async(this, null, function* () {
5298
- return adapterClientInstance.put(
5299
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5300
- payload,
5301
- getAdapterClientDefaultConfig(authorization)
5302
- );
5303
- });
5304
- },
5305
- remove(payload, authorization) {
5306
- return __async(this, null, function* () {
5307
- return adapterClientInstance.delete(
5308
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5309
- getAdapterClientDefaultConfig(authorization)
5310
- );
5311
- });
5537
+ // src/apis/platform/adapter/integrations/bigcommerce/api.ts
5538
+ var platformAdapterBigCommerceApi = {
5539
+ events: {
5540
+ subscribe(payload, authorization) {
5541
+ return __async(this, null, function* () {
5542
+ yield adapterClientInstance.post(
5543
+ "/integrations/bigcommerce/events/subscribe",
5544
+ payload,
5545
+ getBigCommerceClientConfig(authorization)
5546
+ );
5547
+ });
5548
+ },
5549
+ unsubscribe(payload, authorization) {
5550
+ return __async(this, null, function* () {
5551
+ yield adapterClientInstance.post(
5552
+ "/integrations/bigcommerce/events/unsubscribe",
5553
+ payload,
5554
+ getBigCommerceClientConfig(authorization)
5555
+ );
5556
+ });
5557
+ }
5312
5558
  }
5313
5559
  };
5314
5560
 
5315
- // src/apis/platform/adapter/app/blocks/deployment/api.ts
5316
- var platformAdapterAppDeploymentApi = {
5317
- getAggregate(appId, authorization) {
5318
- return __async(this, null, function* () {
5319
- return adapterClientInstance.get(
5320
- `/console/app/${encodeURIComponent(appId)}/blocks/deployment/aggregate`,
5321
- getAdapterClientDefaultConfig(authorization)
5322
- );
5323
- });
5324
- },
5325
- get(appId, authorization) {
5326
- return __async(this, null, function* () {
5327
- return adapterClientInstance.get(
5328
- `/console/app/${encodeURIComponent(appId)}/blocks/deployment`,
5329
- getAdapterClientDefaultConfig(authorization)
5330
- );
5331
- });
5332
- },
5333
- link(payload, authorization) {
5334
- return __async(this, null, function* () {
5335
- return adapterClientInstance.put(
5336
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5337
- payload,
5338
- getAdapterClientDefaultConfig(authorization)
5339
- );
5340
- });
5341
- },
5342
- unlink(payload, authorization) {
5343
- return __async(this, null, function* () {
5344
- return adapterClientInstance.delete(
5345
- `/console/app/${encodeURIComponent(
5346
- payload.appId
5347
- )}/blocks/deployment?${new URLSearchParams(
5348
- payload
5349
- ).toString()}`,
5350
- getAdapterClientDefaultConfig(authorization)
5351
- );
5352
- });
5353
- },
5354
- upsert(payload, authorization) {
5355
- return __async(this, null, function* () {
5356
- return adapterClientInstance.patch(
5357
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5358
- payload,
5359
- getAdapterClientDefaultConfig(authorization)
5360
- );
5361
- });
5561
+ // src/apis/platform/adapter/integrations/hubspot/api.ts
5562
+ var platformAdapterHubspotApi = {
5563
+ events: {
5564
+ subscribe(payload, authorization) {
5565
+ return __async(this, null, function* () {
5566
+ yield adapterClientInstance.post(
5567
+ "/integrations/hubspot/events/subscribe",
5568
+ payload,
5569
+ getHubspotClientConfig(authorization)
5570
+ );
5571
+ });
5572
+ },
5573
+ unsubscribe(payload, authorization) {
5574
+ return __async(this, null, function* () {
5575
+ yield adapterClientInstance.post(
5576
+ "/integrations/hubspot/events/unsubscribe",
5577
+ payload,
5578
+ getHubspotClientConfig(authorization)
5579
+ );
5580
+ });
5581
+ }
5362
5582
  }
5363
5583
  };
5364
5584
 
5365
- // src/apis/platform/adapter/app/blocks/monetization/api.ts
5366
- var platformAdapterAppMonetizationApi = {
5367
- get(appId, authorization) {
5368
- return __async(this, null, function* () {
5369
- return adapterClientInstance.get(
5370
- `/console/app/${encodeURIComponent(appId)}/blocks/monetization`,
5371
- getAdapterClientDefaultConfig(authorization)
5372
- );
5373
- });
5374
- },
5375
- upsert(payload, authorization) {
5585
+ // src/apis/platform/adapter/integrations/mailchimp/api.ts
5586
+ var platformAdapterMailchimpApi = {
5587
+ events: {
5588
+ subscribe(payload, authorization) {
5589
+ return __async(this, null, function* () {
5590
+ yield adapterClientInstance.post(
5591
+ "/integrations/mailchimp/events/subscribe",
5592
+ payload,
5593
+ getMailchimpClientConfig(authorization)
5594
+ );
5595
+ });
5596
+ },
5597
+ unsubscribe(payload, authorization) {
5598
+ return __async(this, null, function* () {
5599
+ yield adapterClientInstance.post(
5600
+ "/integrations/mailchimp/events/unsubscribe",
5601
+ payload,
5602
+ getMailchimpClientConfig(authorization)
5603
+ );
5604
+ });
5605
+ }
5606
+ }
5607
+ };
5608
+
5609
+ // src/apis/platform/adapter/integrations/shopify/api.ts
5610
+ var platformAdapterShopifyApi = {
5611
+ events: {
5612
+ subscribe(payload, authorization) {
5613
+ return __async(this, null, function* () {
5614
+ yield adapterClientInstance.post(
5615
+ "/integrations/shopify/events/subscribe",
5616
+ payload,
5617
+ getShopifyClientConfig(authorization)
5618
+ );
5619
+ });
5620
+ },
5621
+ unsubscribe(payload, authorization) {
5622
+ return __async(this, null, function* () {
5623
+ yield adapterClientInstance.post(
5624
+ "/integrations/shopify/events/unsubscribe",
5625
+ payload,
5626
+ getShopifyClientConfig(authorization)
5627
+ );
5628
+ });
5629
+ }
5630
+ }
5631
+ };
5632
+
5633
+ // src/apis/platform/adapter/integrations/slack/api.ts
5634
+ var platformAdapterSlackApi = {
5635
+ events: {
5636
+ subscribe(payload, authorization) {
5637
+ return __async(this, null, function* () {
5638
+ yield adapterClientInstance.post(
5639
+ "/integrations/slack/events/subscribe",
5640
+ payload,
5641
+ getSlackClientConfig(authorization)
5642
+ );
5643
+ });
5644
+ },
5645
+ unsubscribe(payload, authorization) {
5646
+ return __async(this, null, function* () {
5647
+ yield adapterClientInstance.post(
5648
+ "/integrations/slack/events/unsubscribe",
5649
+ payload,
5650
+ getSlackClientConfig(authorization)
5651
+ );
5652
+ });
5653
+ }
5654
+ }
5655
+ };
5656
+
5657
+ // src/apis/platform/adapter/integrations/text/api.ts
5658
+ var platformAdapterTextApi = {
5659
+ events: {
5660
+ subscribe(payload, authorization) {
5661
+ return __async(this, null, function* () {
5662
+ yield adapterClientInstance.post(
5663
+ "/integrations/text/events/subscribe",
5664
+ payload,
5665
+ getTextClientConfig(authorization)
5666
+ );
5667
+ });
5668
+ },
5669
+ unsubscribe(payload, authorization) {
5670
+ return __async(this, null, function* () {
5671
+ yield adapterClientInstance.post(
5672
+ "/integrations/text/events/unsubscribe",
5673
+ payload,
5674
+ getTextClientConfig(authorization)
5675
+ );
5676
+ });
5677
+ }
5678
+ }
5679
+ };
5680
+
5681
+ // src/apis/platform/adapter/integrations/api.ts
5682
+ var platformAdapterIntegrationsApi = {
5683
+ mailchimp: platformAdapterMailchimpApi,
5684
+ shopify: platformAdapterShopifyApi,
5685
+ hubspot: platformAdapterHubspotApi,
5686
+ slack: platformAdapterSlackApi,
5687
+ bigcommerce: platformAdapterBigCommerceApi,
5688
+ text: platformAdapterTextApi
5689
+ };
5690
+
5691
+ // src/apis/platform/adapter/api.ts
5692
+ var platformAdapterApi = {
5693
+ integrations: platformAdapterIntegrationsApi
5694
+ };
5695
+
5696
+ // src/apis/platform/billing/account/api.ts
5697
+ var platformBillingAccountApi = {
5698
+ getAccount(authorization) {
5376
5699
  return __async(this, null, function* () {
5377
- return adapterClientInstance.post(
5378
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5379
- payload,
5380
- getAdapterClientDefaultConfig(authorization)
5381
- );
5700
+ try {
5701
+ return yield billingClientInstance.get(
5702
+ "/v3/account",
5703
+ getBillingClientConfig(authorization)
5704
+ );
5705
+ } catch (error) {
5706
+ if (error instanceof Error) {
5707
+ throw new Error(`Account couldn't be fetched. [${error.message}]`);
5708
+ } else {
5709
+ throw error;
5710
+ }
5711
+ }
5382
5712
  });
5383
5713
  },
5384
- remove(payload, authorization) {
5714
+ getAccountInfo(product, authorization) {
5385
5715
  return __async(this, null, function* () {
5386
- return adapterClientInstance.delete(
5387
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5388
- getAdapterClientDefaultConfig(authorization)
5389
- );
5716
+ try {
5717
+ return yield billingClientInstance.get(
5718
+ `/v3/account/${encodeURIComponent(product)}/billing_info`,
5719
+ getBillingClientConfig(authorization)
5720
+ );
5721
+ } catch (error) {
5722
+ if (error instanceof Error) {
5723
+ throw new Error(
5724
+ `Account billing info couldn't be fetched. [${error.message}]`
5725
+ );
5726
+ } else {
5727
+ throw error;
5728
+ }
5729
+ }
5390
5730
  });
5391
5731
  }
5392
5732
  };
5393
5733
 
5394
- // src/apis/platform/adapter/app/blocks/properties/property/api.ts
5395
- var platformAdapterAppPropertyApi = {
5396
- get(appId, propertyId, authorization) {
5397
- return __async(this, null, function* () {
5398
- return adapterClientInstance.get(
5399
- `/console/app/${encodeURIComponent(
5400
- appId
5401
- )}/blocks/properties/${encodeURIComponent(propertyId)}`,
5402
- getAdapterClientDefaultConfig(authorization)
5403
- );
5404
- });
5405
- },
5406
- upsert(payload, authorization) {
5734
+ // src/apis/platform/billing/invoices/api.ts
5735
+ var platformBillingInvoicesApi = {
5736
+ getInvoices(product, authorization) {
5407
5737
  return __async(this, null, function* () {
5408
- return adapterClientInstance.post(
5409
- `/console/app/${encodeURIComponent(
5410
- payload.appId
5411
- )}/blocks/properties/${encodeURIComponent(payload.propertyId)}`,
5412
- payload,
5413
- getAdapterClientDefaultConfig(authorization)
5414
- );
5738
+ try {
5739
+ return yield billingClientInstance.get(
5740
+ `/v2/invoices/${encodeURIComponent(product)}`,
5741
+ getBillingClientConfig(authorization)
5742
+ );
5743
+ } catch (error) {
5744
+ if (error instanceof Error) {
5745
+ throw new Error(`Invoices couldn't be fetched. [${error.message}]`);
5746
+ } else {
5747
+ throw error;
5748
+ }
5749
+ }
5415
5750
  });
5416
5751
  },
5417
- remove(payload, authorization) {
5752
+ downloadInvoices(number, authorization) {
5418
5753
  return __async(this, null, function* () {
5419
- return adapterClientInstance.delete(
5420
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/properties/${payload.propertyId}`,
5421
- getAdapterClientDefaultConfig(authorization)
5422
- );
5754
+ try {
5755
+ const response = yield billingClientInstance.request(__spreadValues({
5756
+ url: `https://api.labs.livechatinc.com/v2/invoices/${encodeURIComponent(
5757
+ number
5758
+ )}`,
5759
+ data: new URLSearchParams({
5760
+ _method: "GET"
5761
+ //gave the values directly for testing
5762
+ }),
5763
+ responseType: "blob"
5764
+ }, getBillingClientConfig(authorization)));
5765
+ const href = URL.createObjectURL(response.data);
5766
+ const link = document.createElement("a");
5767
+ link.href = href;
5768
+ link.setAttribute("download", `invoice-${number}.pdf`);
5769
+ document.body.appendChild(link);
5770
+ link.click();
5771
+ document.body.removeChild(link);
5772
+ URL.revokeObjectURL(href);
5773
+ } catch (error) {
5774
+ if (error instanceof Error) {
5775
+ throw new Error(`Invoice couldn't be downloaded. [${error.message}]`);
5776
+ } else {
5777
+ throw error;
5778
+ }
5779
+ }
5423
5780
  });
5424
5781
  }
5425
5782
  };
5426
5783
 
5427
- // src/apis/platform/adapter/app/blocks/properties/api.ts
5428
- var platformAdapterAppPropertiesApi = {
5429
- property: platformAdapterAppPropertyApi,
5784
+ // src/apis/platform/billing/api.ts
5785
+ var platformBillingApi = {
5786
+ account: platformBillingAccountApi,
5787
+ invoices: platformBillingInvoicesApi
5788
+ };
5789
+
5790
+ // src/apis/platform/console/app/blocks/authorization/api.ts
5791
+ var platformConsoleAppAuthorizationApi = {
5430
5792
  get(appId, authorization) {
5431
5793
  return __async(this, null, function* () {
5432
- return adapterClientInstance.get(
5433
- `/console/app/${encodeURIComponent(appId)}/blocks/properties`,
5434
- getAdapterClientDefaultConfig(authorization)
5794
+ return consoleClientInstance.get(
5795
+ `/app/${encodeURIComponent(appId)}/blocks/authorization`,
5796
+ getConsoleClientDefaultConfig(authorization)
5435
5797
  );
5436
5798
  });
5437
5799
  },
5438
- upsert(payload, authorization) {
5800
+ add(payload, authorization) {
5801
+ return __async(this, null, function* () {
5802
+ return consoleClientInstance.post(
5803
+ `/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5804
+ payload,
5805
+ getConsoleClientDefaultConfig(authorization)
5806
+ );
5807
+ });
5808
+ },
5809
+ update(payload, authorization) {
5439
5810
  return __async(this, null, function* () {
5440
- return adapterClientInstance.post(
5441
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5811
+ return consoleClientInstance.put(
5812
+ `/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5442
5813
  payload,
5443
- getAdapterClientDefaultConfig(authorization)
5814
+ getConsoleClientDefaultConfig(authorization)
5444
5815
  );
5445
5816
  });
5446
5817
  },
5447
5818
  remove(payload, authorization) {
5448
5819
  return __async(this, null, function* () {
5449
- return adapterClientInstance.delete(
5450
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5451
- getAdapterClientDefaultConfig(authorization)
5820
+ return consoleClientInstance.delete(
5821
+ `/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5822
+ getConsoleClientDefaultConfig(authorization)
5452
5823
  );
5453
5824
  });
5454
5825
  }
5455
5826
  };
5456
5827
 
5457
- // src/apis/platform/adapter/app/blocks/repository/api.ts
5458
- var platformAdapterAppRepositoryApi = {
5828
+ // src/apis/platform/console/app/blocks/deployment/api.ts
5829
+ var platformConsoleAppDeploymentApi = {
5459
5830
  getAggregate(appId, authorization) {
5460
5831
  return __async(this, null, function* () {
5461
- return adapterClientInstance.get(
5462
- `/console/app/${encodeURIComponent(appId)}/blocks/repository/aggregate`,
5463
- getAdapterClientDefaultConfig(authorization)
5832
+ return consoleClientInstance.get(
5833
+ `/app/${encodeURIComponent(appId)}/blocks/deployment/aggregate`,
5834
+ getConsoleClientDefaultConfig(authorization)
5464
5835
  );
5465
5836
  });
5466
5837
  },
5467
5838
  get(appId, authorization) {
5468
5839
  return __async(this, null, function* () {
5469
- return adapterClientInstance.get(
5470
- `/console/app/${encodeURIComponent(appId)}/blocks/repository`,
5471
- getAdapterClientDefaultConfig(authorization)
5840
+ return consoleClientInstance.get(
5841
+ `/app/${encodeURIComponent(appId)}/blocks/deployment`,
5842
+ getConsoleClientDefaultConfig(authorization)
5472
5843
  );
5473
5844
  });
5474
5845
  },
5475
5846
  link(payload, authorization) {
5476
5847
  return __async(this, null, function* () {
5477
- return adapterClientInstance.put(
5478
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
5848
+ return consoleClientInstance.put(
5849
+ `/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5479
5850
  payload,
5480
- getAdapterClientDefaultConfig(authorization)
5851
+ getConsoleClientDefaultConfig(authorization)
5481
5852
  );
5482
5853
  });
5483
5854
  },
5484
5855
  unlink(payload, authorization) {
5485
5856
  return __async(this, null, function* () {
5486
- return adapterClientInstance.delete(
5487
- `/console/app/${encodeURIComponent(
5857
+ return consoleClientInstance.delete(
5858
+ `/app/${encodeURIComponent(
5488
5859
  payload.appId
5489
- )}/blocks/repository?${new URLSearchParams(
5860
+ )}/blocks/deployment?${new URLSearchParams(
5490
5861
  payload
5491
5862
  ).toString()}`,
5492
- getAdapterClientDefaultConfig(authorization)
5863
+ getConsoleClientDefaultConfig(authorization)
5493
5864
  );
5494
5865
  });
5495
5866
  },
5496
5867
  upsert(payload, authorization) {
5497
5868
  return __async(this, null, function* () {
5498
- return adapterClientInstance.patch(
5499
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
5869
+ return consoleClientInstance.patch(
5870
+ `/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5500
5871
  payload,
5501
- getAdapterClientDefaultConfig(authorization)
5502
- );
5503
- });
5504
- },
5505
- seed(payload, authorization) {
5506
- return __async(this, null, function* () {
5507
- return adapterClientInstance.post(
5508
- `/console/app/${encodeURIComponent(
5509
- payload.appId
5510
- )}/blocks/repository/seed`,
5511
- payload,
5512
- getAdapterClientDefaultConfig(authorization)
5872
+ getConsoleClientDefaultConfig(authorization)
5513
5873
  );
5514
5874
  });
5515
5875
  }
5516
5876
  };
5517
5877
 
5518
- // src/apis/platform/adapter/app/blocks/storage/api.ts
5519
- var platformAdapterAppStorageApi = {
5520
- getAggregate(appId, authorization) {
5521
- return __async(this, null, function* () {
5522
- return adapterClientInstance.get(
5523
- `/console/app/${encodeURIComponent(appId)}/blocks/storage/aggregate`,
5524
- getAdapterClientDefaultConfig(authorization)
5525
- );
5526
- });
5527
- },
5878
+ // src/apis/platform/console/app/blocks/monetization/api.ts
5879
+ var platformConsoleAppMonetizationApi = {
5528
5880
  get(appId, authorization) {
5529
5881
  return __async(this, null, function* () {
5530
- return adapterClientInstance.get(
5531
- `/console/app/${encodeURIComponent(appId)}/blocks/storage`,
5532
- getAdapterClientDefaultConfig(authorization)
5882
+ return consoleClientInstance.get(
5883
+ `/app/${encodeURIComponent(appId)}/blocks/monetization`,
5884
+ getConsoleClientDefaultConfig(authorization)
5533
5885
  );
5534
5886
  });
5535
5887
  },
5536
- link(payload, authorization) {
5888
+ upsert(payload, authorization) {
5537
5889
  return __async(this, null, function* () {
5538
- return adapterClientInstance.put(
5539
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
5890
+ return consoleClientInstance.post(
5891
+ `/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5540
5892
  payload,
5541
- getAdapterClientDefaultConfig(authorization)
5893
+ getConsoleClientDefaultConfig(authorization)
5542
5894
  );
5543
5895
  });
5544
5896
  },
5545
- unlink(payload, authorization) {
5546
- return __async(this, null, function* () {
5547
- return adapterClientInstance.delete(
5548
- `/console/app/${encodeURIComponent(
5549
- payload.appId
5550
- )}/blocks/storage?${new URLSearchParams(
5551
- payload
5552
- ).toString()}`,
5553
- getAdapterClientDefaultConfig(authorization)
5554
- );
5555
- });
5556
- },
5557
- upsert(payload, authorization) {
5897
+ remove(payload, authorization) {
5558
5898
  return __async(this, null, function* () {
5559
- return adapterClientInstance.patch(
5560
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
5561
- payload,
5562
- getAdapterClientDefaultConfig(authorization)
5899
+ return consoleClientInstance.delete(
5900
+ `/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5901
+ getConsoleClientDefaultConfig(authorization)
5563
5902
  );
5564
5903
  });
5565
5904
  }
5566
5905
  };
5567
5906
 
5568
- // src/apis/platform/adapter/app/blocks/widgets/widget/api.ts
5569
- var platformAdapterAppWidgetApi = {
5570
- get(appId, widgetId, authorization) {
5907
+ // src/apis/platform/console/app/blocks/properties/property/api.ts
5908
+ var platformConsoleAppPropertyApi = {
5909
+ get(appId, propertyId, authorization) {
5571
5910
  return __async(this, null, function* () {
5572
- return adapterClientInstance.get(
5573
- `/console/app/${encodeURIComponent(
5911
+ return consoleClientInstance.get(
5912
+ `/app/${encodeURIComponent(
5574
5913
  appId
5575
- )}/blocks/widgets/${encodeURIComponent(widgetId)}`,
5576
- getAdapterClientDefaultConfig(authorization)
5914
+ )}/blocks/properties/${encodeURIComponent(propertyId)}`,
5915
+ getConsoleClientDefaultConfig(authorization)
5577
5916
  );
5578
5917
  });
5579
5918
  },
5580
5919
  upsert(payload, authorization) {
5581
5920
  return __async(this, null, function* () {
5582
- return adapterClientInstance.post(
5583
- `/console/app/${encodeURIComponent(
5921
+ return consoleClientInstance.post(
5922
+ `/app/${encodeURIComponent(
5584
5923
  payload.appId
5585
- )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
5924
+ )}/blocks/properties/${encodeURIComponent(payload.propertyId)}`,
5586
5925
  payload,
5587
- getAdapterClientDefaultConfig(authorization)
5926
+ getConsoleClientDefaultConfig(authorization)
5588
5927
  );
5589
5928
  });
5590
5929
  },
5591
5930
  remove(payload, authorization) {
5592
5931
  return __async(this, null, function* () {
5593
- return adapterClientInstance.delete(
5594
- `/console/app/${encodeURIComponent(
5595
- payload.appId
5596
- )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
5597
- getAdapterClientDefaultConfig(authorization)
5932
+ return consoleClientInstance.delete(
5933
+ `/app/${encodeURIComponent(payload.appId)}/blocks/properties/${payload.propertyId}`,
5934
+ getConsoleClientDefaultConfig(authorization)
5598
5935
  );
5599
5936
  });
5600
5937
  }
5601
5938
  };
5602
5939
 
5603
- // src/apis/platform/adapter/app/blocks/widgets/api.ts
5604
- var platformAdapterAppWidgetsApi = {
5605
- widget: platformAdapterAppWidgetApi,
5940
+ // src/apis/platform/console/app/blocks/properties/api.ts
5941
+ var platformConsoleAppPropertiesApi = {
5942
+ property: platformConsoleAppPropertyApi,
5606
5943
  get(appId, authorization) {
5607
5944
  return __async(this, null, function* () {
5608
- return adapterClientInstance.get(
5609
- `/console/app/${encodeURIComponent(appId)}/blocks/widgets`,
5610
- getAdapterClientDefaultConfig(authorization)
5945
+ return consoleClientInstance.get(
5946
+ `/app/${encodeURIComponent(appId)}/blocks/properties`,
5947
+ getConsoleClientDefaultConfig(authorization)
5611
5948
  );
5612
5949
  });
5613
5950
  },
5614
5951
  upsert(payload, authorization) {
5615
5952
  return __async(this, null, function* () {
5616
- return adapterClientInstance.post(
5617
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
5953
+ return consoleClientInstance.post(
5954
+ `/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5618
5955
  payload,
5619
- getAdapterClientDefaultConfig(authorization)
5956
+ getConsoleClientDefaultConfig(authorization)
5620
5957
  );
5621
5958
  });
5622
5959
  },
5623
5960
  remove(payload, authorization) {
5624
5961
  return __async(this, null, function* () {
5625
- return adapterClientInstance.delete(
5626
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
5627
- getAdapterClientDefaultConfig(authorization)
5962
+ return consoleClientInstance.delete(
5963
+ `/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5964
+ getConsoleClientDefaultConfig(authorization)
5628
5965
  );
5629
5966
  });
5630
5967
  }
5631
5968
  };
5632
5969
 
5633
- // src/apis/platform/adapter/app/blocks/api.ts
5634
- var platformAdapterAppBlocksApi = {
5635
- authorization: platformAdapterAppAuthorizationApi,
5636
- monetization: platformAdapterAppMonetizationApi,
5637
- repository: platformAdapterAppRepositoryApi,
5638
- deployment: platformAdapterAppDeploymentApi,
5639
- storage: platformAdapterAppStorageApi,
5640
- properties: platformAdapterAppPropertiesApi,
5641
- widgets: platformAdapterAppWidgetsApi
5642
- };
5643
-
5644
- // src/apis/platform/adapter/app/templates/api.ts
5645
- var platformAdapterAppTemplatesApi = {
5646
- getTemplates(authorization) {
5970
+ // src/apis/platform/console/app/blocks/repository/api.ts
5971
+ var platformConsoleAppRepositoryApi = {
5972
+ getAggregate(appId, authorization) {
5647
5973
  return __async(this, null, function* () {
5648
- return adapterClientInstance.get(
5649
- "/console/app/templates",
5650
- getAdapterClientDefaultConfig(authorization)
5974
+ return consoleClientInstance.get(
5975
+ `/app/${encodeURIComponent(appId)}/blocks/repository/aggregate`,
5976
+ getConsoleClientDefaultConfig(authorization)
5651
5977
  );
5652
5978
  });
5653
5979
  },
5654
- getRepositoryTemplates(authorization) {
5655
- return __async(this, null, function* () {
5656
- return adapterClientInstance.get(
5657
- "/console/app/templates/repository",
5658
- getAdapterClientDefaultConfig(authorization)
5659
- );
5660
- });
5661
- }
5662
- };
5663
-
5664
- // src/apis/platform/adapter/app/variables/api.ts
5665
- var platformAdapterAppVariablesApi = {
5666
- getVariables(appId, decrypted, authorization) {
5980
+ get(appId, authorization) {
5667
5981
  return __async(this, null, function* () {
5668
- const response = yield adapterClientInstance.get(
5669
- `/console/app/${encodeURIComponent(appId)}/variables`,
5670
- __spreadValues({
5671
- params: {
5672
- decrypted
5673
- }
5674
- }, getAdapterClientDefaultConfig(authorization))
5982
+ return consoleClientInstance.get(
5983
+ `/app/${encodeURIComponent(appId)}/blocks/repository`,
5984
+ getConsoleClientDefaultConfig(authorization)
5675
5985
  );
5676
- return response.data;
5677
5986
  });
5678
5987
  },
5679
- getVariable(appId, key, authorization) {
5680
- return __async(this, null, function* () {
5681
- const response = yield adapterClientInstance.get(
5682
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5683
- key
5684
- )}`,
5685
- getAdapterClientDefaultConfig(authorization)
5686
- );
5687
- return response.data;
5688
- });
5689
- },
5690
- syncVariable(appId, key, payload, authorization) {
5988
+ link(payload, authorization) {
5691
5989
  return __async(this, null, function* () {
5692
- yield adapterClientInstance.post(
5693
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5694
- key
5695
- )}/sync`,
5990
+ return consoleClientInstance.put(
5991
+ `/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
5696
5992
  payload,
5697
- getAdapterClientDefaultConfig(authorization)
5993
+ getConsoleClientDefaultConfig(authorization)
5698
5994
  );
5699
5995
  });
5700
5996
  },
5701
- createVariable(appId, data, authorization) {
5997
+ unlink(payload, authorization) {
5702
5998
  return __async(this, null, function* () {
5703
- yield adapterClientInstance.post(
5704
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5705
- data.key
5706
- )}`,
5707
- data,
5708
- getAdapterClientDefaultConfig(authorization)
5999
+ return consoleClientInstance.delete(
6000
+ `/app/${encodeURIComponent(
6001
+ payload.appId
6002
+ )}/blocks/repository?${new URLSearchParams(
6003
+ payload
6004
+ ).toString()}`,
6005
+ getConsoleClientDefaultConfig(authorization)
5709
6006
  );
5710
6007
  });
5711
6008
  },
5712
- editVariable(appId, data, authorization) {
6009
+ upsert(payload, authorization) {
5713
6010
  return __async(this, null, function* () {
5714
- yield adapterClientInstance.post(
5715
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5716
- data.key
5717
- )}/edit`,
5718
- data,
5719
- getAdapterClientDefaultConfig(authorization)
6011
+ return consoleClientInstance.patch(
6012
+ `/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
6013
+ payload,
6014
+ getConsoleClientDefaultConfig(authorization)
5720
6015
  );
5721
6016
  });
5722
6017
  },
5723
- deleteVariable(appId, key) {
6018
+ seed(payload, authorization) {
5724
6019
  return __async(this, null, function* () {
5725
- yield adapterClientInstance.delete(
5726
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5727
- key
5728
- )}`
6020
+ return consoleClientInstance.post(
6021
+ `/app/${encodeURIComponent(payload.appId)}/blocks/repository/seed`,
6022
+ payload,
6023
+ getConsoleClientDefaultConfig(authorization)
5729
6024
  );
5730
6025
  });
5731
6026
  }
5732
6027
  };
5733
6028
 
5734
- // src/apis/platform/adapter/app/api.ts
5735
- var platformAdapterAppApi = {
5736
- blocks: platformAdapterAppBlocksApi,
5737
- variables: platformAdapterAppVariablesApi,
5738
- templates: platformAdapterAppTemplatesApi,
5739
- push(payload, authorization) {
6029
+ // src/apis/platform/console/app/blocks/storage/api.ts
6030
+ var platformConsoleAppStorageApi = {
6031
+ getAggregate(appId, authorization) {
5740
6032
  return __async(this, null, function* () {
5741
- return adapterClientInstance.post(
5742
- `/console/app${payload.manifest.id ? `/${encodeURIComponent(payload.manifest.id)}` : ""}`,
5743
- payload,
5744
- getAdapterClientDefaultConfig(authorization)
6033
+ return consoleClientInstance.get(
6034
+ `/app/${encodeURIComponent(appId)}/blocks/storage/aggregate`,
6035
+ getConsoleClientDefaultConfig(authorization)
5745
6036
  );
5746
6037
  });
5747
6038
  },
5748
- pull(appId, authorization) {
6039
+ get(appId, authorization) {
5749
6040
  return __async(this, null, function* () {
5750
- return adapterClientInstance.get(
5751
- `/console/app/${encodeURIComponent(appId)}`,
5752
- getAdapterClientDefaultConfig(authorization)
6041
+ return consoleClientInstance.get(
6042
+ `/app/${encodeURIComponent(appId)}/blocks/storage`,
6043
+ getConsoleClientDefaultConfig(authorization)
5753
6044
  );
5754
6045
  });
5755
6046
  },
5756
- verify(payload, authorization) {
6047
+ link(payload, authorization) {
5757
6048
  return __async(this, null, function* () {
5758
- return adapterClientInstance.post(
5759
- `/console/app/${encodeURIComponent(payload.appId)}/verify`,
6049
+ return consoleClientInstance.put(
6050
+ `/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
5760
6051
  payload,
5761
- getAdapterClientDefaultConfig(authorization)
6052
+ getConsoleClientDefaultConfig(authorization)
5762
6053
  );
5763
6054
  });
5764
6055
  },
5765
- status(sagaId, authorization) {
6056
+ unlink(payload, authorization) {
5766
6057
  return __async(this, null, function* () {
5767
- return adapterClientInstance.get(
5768
- "/console/app/status",
5769
- __spreadValues({
5770
- params: {
5771
- sagaId
5772
- }
5773
- }, getAdapterClientDefaultConfig(authorization))
5774
- );
5775
- });
5776
- }
5777
- };
5778
-
5779
- // src/apis/platform/adapter/integrations/bigcommerce/api.ts
5780
- var platformAdapterBigCommerceApi = {
5781
- events: {
5782
- subscribe(payload, authorization) {
5783
- return __async(this, null, function* () {
5784
- yield adapterClientInstance.post(
5785
- "/integrations/bigcommerce/events/subscribe",
5786
- payload,
5787
- getBigCommerceClientConfig(authorization)
5788
- );
5789
- });
5790
- },
5791
- unsubscribe(payload, authorization) {
5792
- return __async(this, null, function* () {
5793
- yield adapterClientInstance.post(
5794
- "/integrations/bigcommerce/events/unsubscribe",
5795
- payload,
5796
- getBigCommerceClientConfig(authorization)
5797
- );
5798
- });
5799
- }
5800
- }
5801
- };
5802
-
5803
- // src/apis/platform/adapter/integrations/hubspot/api.ts
5804
- var platformAdapterHubspotApi = {
5805
- events: {
5806
- subscribe(payload, authorization) {
5807
- return __async(this, null, function* () {
5808
- yield adapterClientInstance.post(
5809
- "/integrations/hubspot/events/subscribe",
5810
- payload,
5811
- getHubspotClientConfig(authorization)
5812
- );
5813
- });
5814
- },
5815
- unsubscribe(payload, authorization) {
5816
- return __async(this, null, function* () {
5817
- yield adapterClientInstance.post(
5818
- "/integrations/hubspot/events/unsubscribe",
5819
- payload,
5820
- getHubspotClientConfig(authorization)
5821
- );
5822
- });
5823
- }
5824
- }
5825
- };
5826
-
5827
- // src/apis/platform/adapter/integrations/mailchimp/api.ts
5828
- var platformAdapterMailchimpApi = {
5829
- events: {
5830
- subscribe(payload, authorization) {
5831
- return __async(this, null, function* () {
5832
- yield adapterClientInstance.post(
5833
- "/integrations/mailchimp/events/subscribe",
5834
- payload,
5835
- getMailchimpClientConfig(authorization)
5836
- );
5837
- });
5838
- },
5839
- unsubscribe(payload, authorization) {
5840
- return __async(this, null, function* () {
5841
- yield adapterClientInstance.post(
5842
- "/integrations/mailchimp/events/unsubscribe",
5843
- payload,
5844
- getMailchimpClientConfig(authorization)
5845
- );
5846
- });
5847
- }
5848
- }
5849
- };
5850
-
5851
- // src/apis/platform/adapter/integrations/shopify/api.ts
5852
- var platformAdapterShopifyApi = {
5853
- events: {
5854
- subscribe(payload, authorization) {
5855
- return __async(this, null, function* () {
5856
- yield adapterClientInstance.post(
5857
- "/integrations/shopify/events/subscribe",
5858
- payload,
5859
- getShopifyClientConfig(authorization)
5860
- );
5861
- });
5862
- },
5863
- unsubscribe(payload, authorization) {
5864
- return __async(this, null, function* () {
5865
- yield adapterClientInstance.post(
5866
- "/integrations/shopify/events/unsubscribe",
5867
- payload,
5868
- getShopifyClientConfig(authorization)
5869
- );
5870
- });
5871
- }
6058
+ return consoleClientInstance.delete(
6059
+ `/app/${encodeURIComponent(
6060
+ payload.appId
6061
+ )}/blocks/storage?${new URLSearchParams(
6062
+ payload
6063
+ ).toString()}`,
6064
+ getConsoleClientDefaultConfig(authorization)
6065
+ );
6066
+ });
6067
+ },
6068
+ upsert(payload, authorization) {
6069
+ return __async(this, null, function* () {
6070
+ return consoleClientInstance.patch(
6071
+ `/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
6072
+ payload,
6073
+ getConsoleClientDefaultConfig(authorization)
6074
+ );
6075
+ });
5872
6076
  }
5873
6077
  };
5874
6078
 
5875
- // src/apis/platform/adapter/integrations/slack/api.ts
5876
- var platformAdapterSlackApi = {
5877
- events: {
5878
- subscribe(payload, authorization) {
5879
- return __async(this, null, function* () {
5880
- yield adapterClientInstance.post(
5881
- "/integrations/slack/events/subscribe",
5882
- payload,
5883
- getSlackClientConfig(authorization)
5884
- );
5885
- });
5886
- },
5887
- unsubscribe(payload, authorization) {
5888
- return __async(this, null, function* () {
5889
- yield adapterClientInstance.post(
5890
- "/integrations/slack/events/unsubscribe",
5891
- payload,
5892
- getSlackClientConfig(authorization)
5893
- );
5894
- });
5895
- }
6079
+ // src/apis/platform/console/app/blocks/widgets/widget/api.ts
6080
+ var platformConsoleAppWidgetApi = {
6081
+ get(appId, widgetId, authorization) {
6082
+ return __async(this, null, function* () {
6083
+ return consoleClientInstance.get(
6084
+ `/app/${encodeURIComponent(
6085
+ appId
6086
+ )}/blocks/widgets/${encodeURIComponent(widgetId)}`,
6087
+ getConsoleClientDefaultConfig(authorization)
6088
+ );
6089
+ });
6090
+ },
6091
+ upsert(payload, authorization) {
6092
+ return __async(this, null, function* () {
6093
+ return consoleClientInstance.post(
6094
+ `/app/${encodeURIComponent(
6095
+ payload.appId
6096
+ )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
6097
+ payload,
6098
+ getConsoleClientDefaultConfig(authorization)
6099
+ );
6100
+ });
6101
+ },
6102
+ remove(payload, authorization) {
6103
+ return __async(this, null, function* () {
6104
+ return consoleClientInstance.delete(
6105
+ `/app/${encodeURIComponent(
6106
+ payload.appId
6107
+ )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
6108
+ getConsoleClientDefaultConfig(authorization)
6109
+ );
6110
+ });
5896
6111
  }
5897
6112
  };
5898
6113
 
5899
- // src/apis/platform/adapter/integrations/text/api.ts
5900
- var platformAdapterTextApi = {
5901
- events: {
5902
- subscribe(payload, authorization) {
5903
- return __async(this, null, function* () {
5904
- yield adapterClientInstance.post(
5905
- "/integrations/text/events/subscribe",
5906
- payload,
5907
- getTextClientConfig(authorization)
5908
- );
5909
- });
5910
- },
5911
- unsubscribe(payload, authorization) {
5912
- return __async(this, null, function* () {
5913
- yield adapterClientInstance.post(
5914
- "/integrations/text/events/unsubscribe",
5915
- payload,
5916
- getTextClientConfig(authorization)
5917
- );
5918
- });
5919
- }
6114
+ // src/apis/platform/console/app/blocks/widgets/api.ts
6115
+ var platformConsoleAppWidgetsApi = {
6116
+ widget: platformConsoleAppWidgetApi,
6117
+ get(appId, authorization) {
6118
+ return __async(this, null, function* () {
6119
+ return consoleClientInstance.get(
6120
+ `/app/${encodeURIComponent(appId)}/blocks/widgets`,
6121
+ getConsoleClientDefaultConfig(authorization)
6122
+ );
6123
+ });
6124
+ },
6125
+ upsert(payload, authorization) {
6126
+ return __async(this, null, function* () {
6127
+ return consoleClientInstance.post(
6128
+ `/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
6129
+ payload,
6130
+ getConsoleClientDefaultConfig(authorization)
6131
+ );
6132
+ });
6133
+ },
6134
+ remove(payload, authorization) {
6135
+ return __async(this, null, function* () {
6136
+ return consoleClientInstance.delete(
6137
+ `/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
6138
+ getConsoleClientDefaultConfig(authorization)
6139
+ );
6140
+ });
5920
6141
  }
5921
6142
  };
5922
6143
 
5923
- // src/apis/platform/adapter/integrations/api.ts
5924
- var platformAdapterIntegrationsApi = {
5925
- mailchimp: platformAdapterMailchimpApi,
5926
- shopify: platformAdapterShopifyApi,
5927
- hubspot: platformAdapterHubspotApi,
5928
- slack: platformAdapterSlackApi,
5929
- bigcommerce: platformAdapterBigCommerceApi,
5930
- text: platformAdapterTextApi
6144
+ // src/apis/platform/console/app/blocks/api.ts
6145
+ var platformConsoleAppBlocksApi = {
6146
+ authorization: platformConsoleAppAuthorizationApi,
6147
+ monetization: platformConsoleAppMonetizationApi,
6148
+ repository: platformConsoleAppRepositoryApi,
6149
+ deployment: platformConsoleAppDeploymentApi,
6150
+ storage: platformConsoleAppStorageApi,
6151
+ properties: platformConsoleAppPropertiesApi,
6152
+ widgets: platformConsoleAppWidgetsApi
5931
6153
  };
5932
6154
 
5933
- // src/apis/platform/adapter/api.ts
5934
- var platformAdapterApi = {
5935
- app: platformAdapterAppApi,
5936
- integrations: platformAdapterIntegrationsApi,
5937
- log(payload, authorization) {
6155
+ // src/apis/platform/console/app/templates/api.ts
6156
+ var platformConsoleAppTemplatesApi = {
6157
+ getTemplates(authorization) {
5938
6158
  return __async(this, null, function* () {
5939
- return adapterClientInstance.post(
5940
- "/log",
5941
- payload,
5942
- getAdapterClientConfig(authorization)
6159
+ return consoleClientInstance.get(
6160
+ "/app/templates",
6161
+ getConsoleClientDefaultConfig(authorization)
6162
+ );
6163
+ });
6164
+ },
6165
+ getRepositoryTemplates(authorization) {
6166
+ return __async(this, null, function* () {
6167
+ return consoleClientInstance.get(
6168
+ "/app/templates/repository",
6169
+ getConsoleClientDefaultConfig(authorization)
5943
6170
  );
5944
6171
  });
5945
6172
  }
5946
6173
  };
5947
6174
 
5948
- // src/apis/platform/billing/account/api.ts
5949
- var platformBillingAccountApi = {
5950
- getAccount(authorization) {
6175
+ // src/apis/platform/console/app/variables/api.ts
6176
+ var platformConsoleAppVariablesApi = {
6177
+ getVariables(appId, decrypted, authorization) {
5951
6178
  return __async(this, null, function* () {
5952
- try {
5953
- return yield billingClientInstance.get(
5954
- "/v3/account",
5955
- getBillingClientConfig(authorization)
5956
- );
5957
- } catch (error) {
5958
- if (error instanceof Error) {
5959
- throw new Error(`Account couldn't be fetched. [${error.message}]`);
5960
- } else {
5961
- throw error;
5962
- }
5963
- }
6179
+ const response = yield consoleClientInstance.get(
6180
+ `/app/${encodeURIComponent(appId)}/variables`,
6181
+ __spreadValues({
6182
+ params: {
6183
+ decrypted
6184
+ }
6185
+ }, getConsoleClientDefaultConfig(authorization))
6186
+ );
6187
+ return response.data;
5964
6188
  });
5965
6189
  },
5966
- getAccountInfo(product, authorization) {
6190
+ getVariable(appId, key, authorization) {
5967
6191
  return __async(this, null, function* () {
5968
- try {
5969
- return yield billingClientInstance.get(
5970
- `/v3/account/${encodeURIComponent(product)}/billing_info`,
5971
- getBillingClientConfig(authorization)
5972
- );
5973
- } catch (error) {
5974
- if (error instanceof Error) {
5975
- throw new Error(
5976
- `Account billing info couldn't be fetched. [${error.message}]`
5977
- );
5978
- } else {
5979
- throw error;
5980
- }
5981
- }
6192
+ const response = yield consoleClientInstance.get(
6193
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(key)}`,
6194
+ getConsoleClientDefaultConfig(authorization)
6195
+ );
6196
+ return response.data;
6197
+ });
6198
+ },
6199
+ syncVariable(appId, key, payload, authorization) {
6200
+ return __async(this, null, function* () {
6201
+ yield consoleClientInstance.post(
6202
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
6203
+ key
6204
+ )}/sync`,
6205
+ payload,
6206
+ getConsoleClientDefaultConfig(authorization)
6207
+ );
6208
+ });
6209
+ },
6210
+ createVariable(appId, data, authorization) {
6211
+ return __async(this, null, function* () {
6212
+ yield consoleClientInstance.post(
6213
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
6214
+ data.key
6215
+ )}`,
6216
+ data,
6217
+ getConsoleClientDefaultConfig(authorization)
6218
+ );
6219
+ });
6220
+ },
6221
+ editVariable(appId, data, authorization) {
6222
+ return __async(this, null, function* () {
6223
+ yield consoleClientInstance.post(
6224
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
6225
+ data.key
6226
+ )}/edit`,
6227
+ data,
6228
+ getConsoleClientDefaultConfig(authorization)
6229
+ );
6230
+ });
6231
+ },
6232
+ deleteVariable(appId, key) {
6233
+ return __async(this, null, function* () {
6234
+ yield consoleClientInstance.delete(
6235
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(key)}`
6236
+ );
5982
6237
  });
5983
6238
  }
5984
6239
  };
5985
6240
 
5986
- // src/apis/platform/billing/invoices/api.ts
5987
- var platformBillingInvoicesApi = {
5988
- getInvoices(product, authorization) {
6241
+ // src/apis/platform/console/app/api.ts
6242
+ var platformConsoleAppApi = {
6243
+ blocks: platformConsoleAppBlocksApi,
6244
+ variables: platformConsoleAppVariablesApi,
6245
+ templates: platformConsoleAppTemplatesApi,
6246
+ push(payload, authorization) {
5989
6247
  return __async(this, null, function* () {
5990
- try {
5991
- return yield billingClientInstance.get(
5992
- `/v2/invoices/${encodeURIComponent(product)}`,
5993
- getBillingClientConfig(authorization)
5994
- );
5995
- } catch (error) {
5996
- if (error instanceof Error) {
5997
- throw new Error(`Invoices couldn't be fetched. [${error.message}]`);
5998
- } else {
5999
- throw error;
6000
- }
6001
- }
6248
+ return consoleClientInstance.post(
6249
+ `/app${payload.manifest.id ? `/${encodeURIComponent(payload.manifest.id)}` : ""}`,
6250
+ payload,
6251
+ getConsoleClientDefaultConfig(authorization)
6252
+ );
6002
6253
  });
6003
6254
  },
6004
- downloadInvoices(number, authorization) {
6255
+ pull(appId, authorization) {
6005
6256
  return __async(this, null, function* () {
6006
- try {
6007
- const response = yield billingClientInstance.request(__spreadValues({
6008
- url: `https://api.labs.livechatinc.com/v2/invoices/${encodeURIComponent(
6009
- number
6010
- )}`,
6011
- data: new URLSearchParams({
6012
- _method: "GET"
6013
- //gave the values directly for testing
6014
- }),
6015
- responseType: "blob"
6016
- }, getBillingClientConfig(authorization)));
6017
- const href = URL.createObjectURL(response.data);
6018
- const link = document.createElement("a");
6019
- link.href = href;
6020
- link.setAttribute("download", `invoice-${number}.pdf`);
6021
- document.body.appendChild(link);
6022
- link.click();
6023
- document.body.removeChild(link);
6024
- URL.revokeObjectURL(href);
6025
- } catch (error) {
6026
- if (error instanceof Error) {
6027
- throw new Error(`Invoice couldn't be downloaded. [${error.message}]`);
6028
- } else {
6029
- throw error;
6030
- }
6031
- }
6257
+ return consoleClientInstance.get(
6258
+ `/app/${encodeURIComponent(appId)}`,
6259
+ getConsoleClientDefaultConfig(authorization)
6260
+ );
6261
+ });
6262
+ },
6263
+ verify(payload, authorization) {
6264
+ return __async(this, null, function* () {
6265
+ return consoleClientInstance.post(
6266
+ `/app/${encodeURIComponent(payload.appId)}/verify`,
6267
+ payload,
6268
+ getConsoleClientDefaultConfig(authorization)
6269
+ );
6270
+ });
6271
+ },
6272
+ status(sagaId, authorization) {
6273
+ return __async(this, null, function* () {
6274
+ return consoleClientInstance.get(
6275
+ "/app/status",
6276
+ __spreadValues({
6277
+ params: {
6278
+ sagaId
6279
+ }
6280
+ }, getConsoleClientDefaultConfig(authorization))
6281
+ );
6032
6282
  });
6033
6283
  }
6034
6284
  };
6035
6285
 
6036
- // src/apis/platform/billing/api.ts
6037
- var platformBillingApi = {
6038
- account: platformBillingAccountApi,
6039
- invoices: platformBillingInvoicesApi
6286
+ // src/apis/platform/console/api.ts
6287
+ var platformConsoleApi = {
6288
+ app: platformConsoleAppApi,
6289
+ log(payload, authorization) {
6290
+ return __async(this, null, function* () {
6291
+ return consoleClientInstance.post(
6292
+ "/log",
6293
+ payload,
6294
+ getConsoleClientConfig(authorization)
6295
+ );
6296
+ });
6297
+ }
6040
6298
  };
6041
6299
 
6042
6300
  // src/constants/app/templates/repository.ts
@@ -7555,6 +7813,7 @@ var platformApi = {
7555
7813
  accounts: platformAccountsApi,
7556
7814
  billing: platformBillingApi,
7557
7815
  adapter: platformAdapterApi,
7816
+ console: platformConsoleApi,
7558
7817
  dps: platformDpsApi
7559
7818
  };
7560
7819
 
@@ -8255,7 +8514,7 @@ var api2 = {
8255
8514
  isInitialized: false
8256
8515
  };
8257
8516
  function initApi(config, tokens) {
8258
- 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, _z;
8517
+ 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, _z, _A;
8259
8518
  initPlatformAccountsClient(
8260
8519
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
8261
8520
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.token
@@ -8276,19 +8535,29 @@ function initApi(config, tokens) {
8276
8535
  slack: tokens.slack
8277
8536
  } : void 0
8278
8537
  );
8279
- initLiveChatClient((_h = config.urls.products) == null ? void 0 : _h.livechat, (_i = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _i.token);
8280
- initHelpDeskClient((_j = config.urls.products) == null ? void 0 : _j.helpdesk, (_k = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _k.token);
8281
- initTextClient((_l = config.urls.integrations) == null ? void 0 : _l.text, (_m = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _m.token);
8282
- initGithubClient((_n = tokens == null ? void 0 : tokens.github) == null ? void 0 : _n.appToken);
8283
- initNetlifyClient((_o = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _o.token);
8284
- initVercelClient((_p = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _p.token);
8285
- initNeonClient((_q = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _q.token);
8286
- initPlanetScaleClient((_r = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _r.token);
8287
- initMailchimpClient((_s = tokens == null ? void 0 : tokens.mailchimp) == null ? void 0 : _s.token, (_t = tokens == null ? void 0 : tokens.mailchimp) == null ? void 0 : _t.server);
8288
- initShopifyClient((_u = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _u.token, (_v = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _v.shop);
8289
- initBigCommerceClient((_w = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _w.token, (_x = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _x.shop);
8290
- initHubspotClient((_y = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _y.token);
8291
- initSlackClient((_z = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _z.token);
8538
+ initConsoleClient(
8539
+ (_h = config.urls.platform) == null ? void 0 : _h.console,
8540
+ tokens ? {
8541
+ platform: tokens.platform,
8542
+ github: tokens.github,
8543
+ netlify: tokens.netlify,
8544
+ vercel: tokens.vercel,
8545
+ neon: tokens.neon
8546
+ } : void 0
8547
+ );
8548
+ initLiveChatClient((_i = config.urls.products) == null ? void 0 : _i.livechat, (_j = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _j.token);
8549
+ initHelpDeskClient((_k = config.urls.products) == null ? void 0 : _k.helpdesk, (_l = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _l.token);
8550
+ initTextClient((_m = config.urls.integrations) == null ? void 0 : _m.text, (_n = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _n.token);
8551
+ initGithubClient((_o = tokens == null ? void 0 : tokens.github) == null ? void 0 : _o.appToken);
8552
+ initNetlifyClient((_p = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _p.token);
8553
+ initVercelClient((_q = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _q.token);
8554
+ initNeonClient((_r = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _r.token);
8555
+ initPlanetScaleClient((_s = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _s.token);
8556
+ initMailchimpClient((_t = tokens == null ? void 0 : tokens.mailchimp) == null ? void 0 : _t.token, (_u = tokens == null ? void 0 : tokens.mailchimp) == null ? void 0 : _u.server);
8557
+ initShopifyClient((_v = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _v.token, (_w = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _w.shop);
8558
+ initBigCommerceClient((_x = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _x.token, (_y = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _y.shop);
8559
+ initHubspotClient((_z = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _z.token);
8560
+ initSlackClient((_A = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _A.token);
8292
8561
  api2.isInitialized = true;
8293
8562
  }
8294
8563
 
@@ -8348,6 +8617,7 @@ export {
8348
8617
  BigCommerceApiError,
8349
8618
  BigCommerceEventNames,
8350
8619
  BigCommerceWebhookScopes,
8620
+ ConsoleApiError,
8351
8621
  DpsApiError,
8352
8622
  HelpDeskApiError,
8353
8623
  HelpDeskWebhookEventType,
@@ -8389,31 +8659,43 @@ export {
8389
8659
  bigcommerceEventsZods,
8390
8660
  billingClientInstance,
8391
8661
  buildUrlFromSegments,
8662
+ consoleClientInstance,
8392
8663
  dpsClientInstance,
8393
8664
  getAdapterClientConfig,
8394
8665
  getAdapterClientDefaultConfig,
8395
8666
  getAppAutoReviewPayload,
8667
+ getBigCommerceClientAuthorization,
8396
8668
  getBigCommerceClientConfig,
8397
8669
  getBigCommerceClientUrl,
8398
8670
  getBillingClientConfig,
8671
+ getConsoleClientConfig,
8672
+ getConsoleClientDefaultConfig,
8399
8673
  getDpsClientConfig,
8400
8674
  getEmptyAppAutoReview,
8675
+ getGitHubClientAuthorization,
8401
8676
  getGithubClientConfig,
8402
8677
  getHelpDeskClientConfig,
8678
+ getHubspotClientAuthorization,
8403
8679
  getHubspotClientConfig,
8404
8680
  getIntegrationFlowUrl,
8405
8681
  getIntegrationFlowUrlForRedirection,
8406
8682
  getLiveChatClientConfig,
8683
+ getMailchimpClientAuthorization,
8407
8684
  getMailchimpClientConfig,
8408
8685
  getMailchimpClientUrl,
8409
8686
  getNeonClientConfig,
8687
+ getNetlifyClientAuthorization,
8410
8688
  getNetlifyClientConfig,
8411
8689
  getPlanetScaleClientConfig,
8412
- getRegion2 as getRegion,
8690
+ getRegion3 as getRegion,
8691
+ getShopifyClientAuthorization,
8413
8692
  getShopifyClientConfig,
8414
8693
  getShopifyClientUrl,
8694
+ getSlackClientAuthorization,
8415
8695
  getSlackClientConfig,
8696
+ getTextClientAuthorization,
8416
8697
  getTextClientConfig,
8698
+ getVercelClientAuthorization,
8417
8699
  getVercelClientConfig,
8418
8700
  githubClientInstance,
8419
8701
  helpdeskClientInstance,
@@ -8423,6 +8705,7 @@ export {
8423
8705
  initApi,
8424
8706
  initBigCommerceClient,
8425
8707
  initBillingClient,
8708
+ initConsoleClient,
8426
8709
  initDpsClient,
8427
8710
  initGithubClient,
8428
8711
  initHelpDeskClient,
@@ -8455,6 +8738,7 @@ export {
8455
8738
  textLivechatEventsZods,
8456
8739
  updateAdapterClient,
8457
8740
  updateBigCommerceClient,
8741
+ updateConsoleClient,
8458
8742
  updateGithubClient,
8459
8743
  updateHubspotClient,
8460
8744
  updateMailchimpClient,