@livechat/developer-studio-api 3.4.24 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -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);
@@ -2675,6 +2765,13 @@ var BigCommerceWebhookScopes = /* @__PURE__ */ ((BigCommerceWebhookScopes2) => {
2675
2765
  return BigCommerceWebhookScopes2;
2676
2766
  })(BigCommerceWebhookScopes || {});
2677
2767
 
2768
+ // src/apis/integrations/github/webhooks/_contracts/dtos/webhooks.ts
2769
+ var GitHubWebhookActions = /* @__PURE__ */ ((GitHubWebhookActions2) => {
2770
+ GitHubWebhookActions2["Unknown"] = "unknown";
2771
+ GitHubWebhookActions2["Deleted"] = "deleted";
2772
+ return GitHubWebhookActions2;
2773
+ })(GitHubWebhookActions || {});
2774
+
2678
2775
  // src/apis/integrations/hubspot/webhooks/_contracts/dtos/webhooks.ts
2679
2776
  var HubSpotWebhookEventTypes = /* @__PURE__ */ ((HubSpotWebhookEventTypes2) => {
2680
2777
  HubSpotWebhookEventTypes2["ContactCreation"] = "contact.creation";
@@ -2750,6 +2847,16 @@ var WorkflowExecutionStatus = /* @__PURE__ */ ((WorkflowExecutionStatus2) => {
2750
2847
 
2751
2848
  // src/apis/integrations/vercel/instance.ts
2752
2849
  import axios19 from "axios";
2850
+ function getVercelClientAuthorization(req, headerPrefix = "x-adapter-vercel") {
2851
+ if (req.headers instanceof Headers) {
2852
+ return {
2853
+ token: req.headers.get(`${headerPrefix}-token`)
2854
+ };
2855
+ }
2856
+ return {
2857
+ token: req.headers[`${headerPrefix}-token`]
2858
+ };
2859
+ }
2753
2860
  var vercelClientInstance = axios19.create({
2754
2861
  baseURL: "https://api.vercel.com"
2755
2862
  });
@@ -3141,18 +3248,14 @@ var bigcommerceEventsZods = {
3141
3248
  get unsubscribe() {
3142
3249
  return this.source.and(
3143
3250
  z.object({
3144
- event: z.object({
3145
- name: this.eventName
3146
- })
3251
+ event: this.event
3147
3252
  })
3148
3253
  );
3149
3254
  },
3150
3255
  get unsubscribeContent() {
3151
3256
  return z.object({
3152
3257
  provider: this.provider,
3153
- event: z.object({
3154
- name: this.eventName
3155
- })
3258
+ event: this.event
3156
3259
  });
3157
3260
  }
3158
3261
  };
@@ -3205,18 +3308,14 @@ var hubspotEventsZods = {
3205
3308
  get unsubscribe() {
3206
3309
  return this.source.and(
3207
3310
  z2.object({
3208
- event: z2.object({
3209
- name: this.eventName
3210
- })
3311
+ event: this.event
3211
3312
  })
3212
3313
  );
3213
3314
  },
3214
3315
  get unsubscribeContent() {
3215
3316
  return z2.object({
3216
3317
  provider: this.provider,
3217
- event: z2.object({
3218
- name: this.eventName
3219
- })
3318
+ event: this.event
3220
3319
  });
3221
3320
  }
3222
3321
  };
@@ -3281,10 +3380,7 @@ var mailchimpEventsZods = {
3281
3380
  get unsubscribeContent() {
3282
3381
  return z3.object({
3283
3382
  provider: this.provider,
3284
- event: z3.object({
3285
- listId: z3.string(),
3286
- name: this.eventName
3287
- })
3383
+ event: this.event
3288
3384
  });
3289
3385
  }
3290
3386
  };
@@ -3339,9 +3435,7 @@ var shopifyEventsZods = {
3339
3435
  get unsubscribeContent() {
3340
3436
  return z4.object({
3341
3437
  provider: this.provider,
3342
- event: z4.object({
3343
- name: this.eventName
3344
- })
3438
+ event: this.event
3345
3439
  });
3346
3440
  }
3347
3441
  };
@@ -3405,9 +3499,7 @@ var slackEventsZods = {
3405
3499
  get unsubscribeContent() {
3406
3500
  return z5.object({
3407
3501
  provider: this.provider,
3408
- event: z5.object({
3409
- name: this.eventName
3410
- })
3502
+ event: this.event
3411
3503
  });
3412
3504
  }
3413
3505
  };
@@ -3490,18 +3582,14 @@ var textHelpDeskEventsZods = {
3490
3582
  get unsubscribe() {
3491
3583
  return this.source.and(
3492
3584
  z6.object({
3493
- event: z6.object({
3494
- name: this.eventName
3495
- })
3585
+ event: this.event
3496
3586
  })
3497
3587
  );
3498
3588
  },
3499
3589
  get unsubscribeContent() {
3500
3590
  return z6.object({
3501
3591
  provider: this.provider,
3502
- event: z6.object({
3503
- name: this.eventName
3504
- })
3592
+ event: this.event
3505
3593
  });
3506
3594
  }
3507
3595
  };
@@ -3595,18 +3683,14 @@ var textLivechatEventsZods = {
3595
3683
  get unsubscribe() {
3596
3684
  return this.source.and(
3597
3685
  z7.object({
3598
- event: z7.object({
3599
- name: this.eventName
3600
- })
3686
+ event: this.event
3601
3687
  })
3602
3688
  );
3603
3689
  },
3604
3690
  get unsubscribeContent() {
3605
3691
  return z7.object({
3606
3692
  provider: this.provider,
3607
- event: z7.object({
3608
- name: this.eventName
3609
- })
3693
+ event: this.event
3610
3694
  });
3611
3695
  }
3612
3696
  };
@@ -3692,6 +3776,147 @@ function initBillingClient(baseUrl, token) {
3692
3776
  }
3693
3777
  }
3694
3778
 
3779
+ // src/apis/platform/console/instance.ts
3780
+ import axios22 from "axios";
3781
+ var REGION2 = {
3782
+ FRA: "fra",
3783
+ DAL: "dal",
3784
+ FRA_A: "fra-a",
3785
+ FRA_B: "fra-b"
3786
+ };
3787
+ var supportedRegions2 = Object.values(REGION2);
3788
+ var getRegion2 = (token) => {
3789
+ const region = token.split(":")[0];
3790
+ if (supportedRegions2.includes(region)) {
3791
+ return region;
3792
+ }
3793
+ };
3794
+ var ConsoleApiError = class _ConsoleApiError extends ApiErrorBase {
3795
+ constructor() {
3796
+ super(...arguments);
3797
+ this.name = "console";
3798
+ }
3799
+ static notFound(message) {
3800
+ return new _ConsoleApiError(
3801
+ message != null ? message : "Not found",
3802
+ {
3803
+ errorCode: "not_found",
3804
+ errorMessage: "Not found"
3805
+ },
3806
+ 404
3807
+ );
3808
+ }
3809
+ };
3810
+ var consoleClientInstance = axios22.create({
3811
+ baseURL: "https://platform.labs.text.com/console/api",
3812
+ headers: {
3813
+ "Content-Type": "application/json"
3814
+ }
3815
+ });
3816
+ consoleClientInstance.interceptors.response.use(
3817
+ (response) => response,
3818
+ (error) => {
3819
+ var _a, _b;
3820
+ const apiError = (_a = error.response) == null ? void 0 : _a.data;
3821
+ if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
3822
+ return Promise.reject(new UnauthorizeApiError(apiError.source));
3823
+ } else if ((apiError == null ? void 0 : apiError.kind) === "error") {
3824
+ const data = (_b = error.response) == null ? void 0 : _b.data;
3825
+ return Promise.reject(
3826
+ new ConsoleApiError(data.message, data.data, data.code)
3827
+ );
3828
+ }
3829
+ return Promise.reject(error);
3830
+ }
3831
+ );
3832
+ function getConsoleClientConfig(options = {}) {
3833
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
3834
+ const currentHeaders = consoleClientInstance.defaults.headers;
3835
+ const headers = {
3836
+ platform: {
3837
+ 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
3838
+ },
3839
+ integrations: {
3840
+ github: {
3841
+ app: (_e = currentHeaders["x-adapter-github-app-token"]) != null ? _e : (_d = options.github) == null ? void 0 : _d.appToken,
3842
+ oauth: (_g = currentHeaders["x-adapter-github-oauth-token"]) != null ? _g : (_f = options.github) == null ? void 0 : _f.oauthToken
3843
+ },
3844
+ netlify: (_i = currentHeaders["x-adapter-netlify-token"]) != null ? _i : (_h = options.netlify) == null ? void 0 : _h.token,
3845
+ vercel: (_k = currentHeaders["x-adapter-vercel-token"]) != null ? _k : (_j = options.vercel) == null ? void 0 : _j.token,
3846
+ planetscale: (_m = currentHeaders["x-adapter-planetscale-token"]) != null ? _m : (_l = options.planetscale) == null ? void 0 : _l.token,
3847
+ neon: (_o = currentHeaders["x-adapter-neon-token"]) != null ? _o : (_n = options.neon) == null ? void 0 : _n.token
3848
+ }
3849
+ };
3850
+ if (currentHeaders.Authorization) {
3851
+ currentHeaders["X-Region"] = (_p = getRegion2(currentHeaders.Authorization)) != null ? _p : void 0;
3852
+ }
3853
+ if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.platform) && !headers.platform.token) {
3854
+ throw new UnauthorizeApiError("accounts");
3855
+ }
3856
+ if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
3857
+ throw new UnauthorizeApiError("github");
3858
+ }
3859
+ if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.vercel) && !headers.integrations.vercel) {
3860
+ throw new UnauthorizeApiError("vercel");
3861
+ }
3862
+ if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.netlify) && !headers.integrations.netlify) {
3863
+ throw new UnauthorizeApiError("netlify");
3864
+ }
3865
+ if (((_u = options.ensureAuthorizationToken) == null ? void 0 : _u.planetscale) && !headers.integrations.planetscale) {
3866
+ throw new UnauthorizeApiError("planetscale");
3867
+ }
3868
+ if (((_v = options.ensureAuthorizationToken) == null ? void 0 : _v.neon) && !headers.integrations.neon) {
3869
+ throw new UnauthorizeApiError("neon");
3870
+ }
3871
+ return {
3872
+ 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 } : {})
3873
+ };
3874
+ }
3875
+ var getConsoleClientDefaultConfig = (authorization) => getConsoleClientConfig(__spreadProps(__spreadValues({}, authorization), {
3876
+ ensureAuthorizationToken: {
3877
+ platform: true
3878
+ }
3879
+ }));
3880
+ function initConsoleClient(baseUrl, tokens) {
3881
+ if (baseUrl) {
3882
+ consoleClientInstance.interceptors.request.use(
3883
+ (config) => {
3884
+ config.baseURL = baseUrl;
3885
+ return config;
3886
+ },
3887
+ (error) => Promise.reject(error)
3888
+ );
3889
+ }
3890
+ if (tokens) {
3891
+ updateConsoleClient(tokens);
3892
+ }
3893
+ }
3894
+ function updateConsoleClient(tokens) {
3895
+ var _a, _b, _c, _d, _e, _f, _g, _h;
3896
+ const headers = consoleClientInstance.defaults.headers;
3897
+ if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
3898
+ headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
3899
+ }
3900
+ if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.appToken) {
3901
+ headers["x-adapter-github-app-token"] = tokens.github.appToken;
3902
+ }
3903
+ if ((_d = tokens == null ? void 0 : tokens.github) == null ? void 0 : _d.oauthToken) {
3904
+ headers["x-adapter-github-oauth-token"] = tokens.github.oauthToken;
3905
+ }
3906
+ if ((_e = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _e.token) {
3907
+ headers["x-adapter-netlify-token"] = tokens.netlify.token;
3908
+ }
3909
+ if ((_f = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _f.token) {
3910
+ headers["x-adapter-vercel-token"] = tokens.vercel.token;
3911
+ }
3912
+ if ((_g = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _g.token) {
3913
+ headers["x-adapter-planetscale-token"] = tokens.planetscale.token;
3914
+ }
3915
+ if ((_h = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _h.token) {
3916
+ headers["x-adapter-neon-token"] = tokens.neon.token;
3917
+ }
3918
+ }
3919
+
3695
3920
  // src/apis/platform/dps/applications/application/autoReview/_contracts/dtos/autoReview.ts
3696
3921
  var getEmptyAppAutoReview = () => ({
3697
3922
  isReviewed: false,
@@ -3761,14 +3986,14 @@ var getAppAutoReviewPayload = (value) => {
3761
3986
  };
3762
3987
 
3763
3988
  // src/apis/platform/dps/instance.ts
3764
- import axios22 from "axios";
3989
+ import axios23 from "axios";
3765
3990
  var DpsApiError = class extends ApiErrorBase {
3766
3991
  constructor() {
3767
3992
  super(...arguments);
3768
3993
  this.name = "dps";
3769
3994
  }
3770
3995
  };
3771
- var dpsClientInstance = axios22.create({
3996
+ var dpsClientInstance = axios23.create({
3772
3997
  baseURL: "https://dev-platform.labs.livechatinc.com"
3773
3998
  });
3774
3999
  dpsClientInstance.interceptors.response.use(
@@ -3817,14 +4042,14 @@ function initDpsClient(baseUrl, token) {
3817
4042
  }
3818
4043
 
3819
4044
  // src/apis/products/helpdesk/instance.ts
3820
- import axios23 from "axios";
4045
+ import axios24 from "axios";
3821
4046
  var HelpDeskApiError = class extends ApiErrorBase {
3822
4047
  constructor() {
3823
4048
  super(...arguments);
3824
4049
  this.name = "helpdesk";
3825
4050
  }
3826
4051
  };
3827
- var helpdeskClientInstance = axios23.create({
4052
+ var helpdeskClientInstance = axios24.create({
3828
4053
  baseURL: "https://api.labs.helpdesk.com"
3829
4054
  });
3830
4055
  helpdeskClientInstance.interceptors.response.use(
@@ -3912,17 +4137,17 @@ var LivechatWebhookSystemMessages = /* @__PURE__ */ ((LivechatWebhookSystemMessa
3912
4137
  })(LivechatWebhookSystemMessages || {});
3913
4138
 
3914
4139
  // src/apis/products/livechat/instance.ts
3915
- import axios24 from "axios";
3916
- var REGION2 = {
4140
+ import axios25 from "axios";
4141
+ var REGION3 = {
3917
4142
  FRA: "fra",
3918
4143
  DAL: "dal",
3919
4144
  FRA_A: "fra-a",
3920
4145
  FRA_B: "fra-b"
3921
4146
  };
3922
- var supportedRegions2 = Object.values(REGION2);
3923
- var getRegion2 = (token) => {
4147
+ var supportedRegions3 = Object.values(REGION3);
4148
+ var getRegion3 = (token) => {
3924
4149
  const region = token.split(":")[0];
3925
- if (supportedRegions2.includes(region)) {
4150
+ if (supportedRegions3.includes(region)) {
3926
4151
  return region;
3927
4152
  }
3928
4153
  };
@@ -3932,7 +4157,7 @@ var LivechatApiError = class extends ApiErrorBase {
3932
4157
  this.name = "livechat";
3933
4158
  }
3934
4159
  };
3935
- var livechatClientInstance = axios24.create({
4160
+ var livechatClientInstance = axios25.create({
3936
4161
  baseURL: "https://api.labs.livechatinc.com"
3937
4162
  });
3938
4163
  livechatClientInstance.interceptors.response.use(
@@ -3967,7 +4192,7 @@ function getLiveChatClientConfig(options = {}) {
3967
4192
  };
3968
4193
  }
3969
4194
  function initLiveChatClient(baseUrl, token) {
3970
- const region = token ? getRegion2(token) : void 0;
4195
+ const region = token ? getRegion3(token) : void 0;
3971
4196
  const headers = livechatClientInstance.defaults.headers;
3972
4197
  if (baseUrl) {
3973
4198
  livechatClientInstance.interceptors.request.use(
@@ -4328,7 +4553,8 @@ var urls = {
4328
4553
  create: () => getUrl(),
4329
4554
  update: (id) => getUrl([id]),
4330
4555
  delete: (id) => getUrl([id]),
4331
- connect: (id) => getUrl([id, "connection"])
4556
+ connect: (id) => getUrl([id, "connection"]),
4557
+ disconnect: (id) => getUrl([id, "disconnect"])
4332
4558
  };
4333
4559
  var textPlatformWorkflowsCredentialsApi = {
4334
4560
  meta: {
@@ -4440,6 +4666,24 @@ var textPlatformWorkflowsCredentialsApi = {
4440
4666
  throw error;
4441
4667
  });
4442
4668
  });
4669
+ },
4670
+ disconnect(id, authorization) {
4671
+ return __async(this, null, function* () {
4672
+ return textClientInstance.put(
4673
+ urls.disconnect(id),
4674
+ {},
4675
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4676
+ ensureAuthorizationToken: true
4677
+ }))
4678
+ ).catch((error) => {
4679
+ if (error instanceof TextApiError) {
4680
+ throw error.withCustomMessage(
4681
+ `Couldn't disconnect to credentials. [${error.message}]`
4682
+ );
4683
+ }
4684
+ throw error;
4685
+ });
4686
+ });
4443
4687
  }
4444
4688
  };
4445
4689
 
@@ -4673,7 +4917,7 @@ var textApi = {
4673
4917
  };
4674
4918
 
4675
4919
  // src/apis/integrations/vercel/api.ts
4676
- import axios25 from "axios";
4920
+ import axios26 from "axios";
4677
4921
 
4678
4922
  // src/apis/integrations/vercel/deploy/api.ts
4679
4923
  var vercelDeployApi = {
@@ -4933,7 +5177,7 @@ var vercelApi = {
4933
5177
  client_secret: clientSecret,
4934
5178
  redirect_uri: redirectUrl
4935
5179
  });
4936
- const response = yield axios25.post("https://api.vercel.com/v2/oauth/access_token", data, {
5180
+ const response = yield axios26.post("https://api.vercel.com/v2/oauth/access_token", data, {
4937
5181
  headers: {
4938
5182
  "Content-Type": "application/x-www-form-urlencoded"
4939
5183
  }
@@ -5274,769 +5518,767 @@ var platformAccountsApi = {
5274
5518
  token: platformAccountsTokenApi
5275
5519
  };
5276
5520
 
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
- });
5521
+ // src/apis/platform/adapter/integrations/bigcommerce/api.ts
5522
+ var platformAdapterBigCommerceApi = {
5523
+ events: {
5524
+ subscribe(payload, authorization) {
5525
+ return __async(this, null, function* () {
5526
+ yield adapterClientInstance.post(
5527
+ "/integrations/bigcommerce/events/subscribe",
5528
+ payload,
5529
+ getBigCommerceClientConfig(authorization)
5530
+ );
5531
+ });
5532
+ },
5533
+ unsubscribe(payload, authorization) {
5534
+ return __async(this, null, function* () {
5535
+ yield adapterClientInstance.post(
5536
+ "/integrations/bigcommerce/events/unsubscribe",
5537
+ payload,
5538
+ getBigCommerceClientConfig(authorization)
5539
+ );
5540
+ });
5541
+ }
5312
5542
  }
5313
5543
  };
5314
5544
 
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) {
5545
+ // src/apis/platform/adapter/integrations/hubspot/api.ts
5546
+ var platformAdapterHubspotApi = {
5547
+ events: {
5548
+ subscribe(payload, authorization) {
5549
+ return __async(this, null, function* () {
5550
+ yield adapterClientInstance.post(
5551
+ "/integrations/hubspot/events/subscribe",
5552
+ payload,
5553
+ getHubspotClientConfig(authorization)
5554
+ );
5555
+ });
5556
+ },
5557
+ unsubscribe(payload, authorization) {
5558
+ return __async(this, null, function* () {
5559
+ yield adapterClientInstance.post(
5560
+ "/integrations/hubspot/events/unsubscribe",
5561
+ payload,
5562
+ getHubspotClientConfig(authorization)
5563
+ );
5564
+ });
5565
+ }
5566
+ }
5567
+ };
5568
+
5569
+ // src/apis/platform/adapter/integrations/mailchimp/api.ts
5570
+ var platformAdapterMailchimpApi = {
5571
+ events: {
5572
+ subscribe(payload, authorization) {
5573
+ return __async(this, null, function* () {
5574
+ yield adapterClientInstance.post(
5575
+ "/integrations/mailchimp/events/subscribe",
5576
+ payload,
5577
+ getMailchimpClientConfig(authorization)
5578
+ );
5579
+ });
5580
+ },
5581
+ unsubscribe(payload, authorization) {
5582
+ return __async(this, null, function* () {
5583
+ yield adapterClientInstance.post(
5584
+ "/integrations/mailchimp/events/unsubscribe",
5585
+ payload,
5586
+ getMailchimpClientConfig(authorization)
5587
+ );
5588
+ });
5589
+ }
5590
+ }
5591
+ };
5592
+
5593
+ // src/apis/platform/adapter/integrations/shopify/api.ts
5594
+ var platformAdapterShopifyApi = {
5595
+ events: {
5596
+ subscribe(payload, authorization) {
5597
+ return __async(this, null, function* () {
5598
+ yield adapterClientInstance.post(
5599
+ "/integrations/shopify/events/subscribe",
5600
+ payload,
5601
+ getShopifyClientConfig(authorization)
5602
+ );
5603
+ });
5604
+ },
5605
+ unsubscribe(payload, authorization) {
5606
+ return __async(this, null, function* () {
5607
+ yield adapterClientInstance.post(
5608
+ "/integrations/shopify/events/unsubscribe",
5609
+ payload,
5610
+ getShopifyClientConfig(authorization)
5611
+ );
5612
+ });
5613
+ }
5614
+ }
5615
+ };
5616
+
5617
+ // src/apis/platform/adapter/integrations/slack/api.ts
5618
+ var platformAdapterSlackApi = {
5619
+ events: {
5620
+ subscribe(payload, authorization) {
5621
+ return __async(this, null, function* () {
5622
+ yield adapterClientInstance.post(
5623
+ "/integrations/slack/events/subscribe",
5624
+ payload,
5625
+ getSlackClientConfig(authorization)
5626
+ );
5627
+ });
5628
+ },
5629
+ unsubscribe(payload, authorization) {
5630
+ return __async(this, null, function* () {
5631
+ yield adapterClientInstance.post(
5632
+ "/integrations/slack/events/unsubscribe",
5633
+ payload,
5634
+ getSlackClientConfig(authorization)
5635
+ );
5636
+ });
5637
+ }
5638
+ }
5639
+ };
5640
+
5641
+ // src/apis/platform/adapter/integrations/text/api.ts
5642
+ var platformAdapterTextApi = {
5643
+ events: {
5644
+ subscribe(payload, authorization) {
5645
+ return __async(this, null, function* () {
5646
+ yield adapterClientInstance.post(
5647
+ "/integrations/text/events/subscribe",
5648
+ payload,
5649
+ getTextClientConfig(authorization)
5650
+ );
5651
+ });
5652
+ },
5653
+ unsubscribe(payload, authorization) {
5654
+ return __async(this, null, function* () {
5655
+ yield adapterClientInstance.post(
5656
+ "/integrations/text/events/unsubscribe",
5657
+ payload,
5658
+ getTextClientConfig(authorization)
5659
+ );
5660
+ });
5661
+ }
5662
+ }
5663
+ };
5664
+
5665
+ // src/apis/platform/adapter/integrations/api.ts
5666
+ var platformAdapterIntegrationsApi = {
5667
+ mailchimp: platformAdapterMailchimpApi,
5668
+ shopify: platformAdapterShopifyApi,
5669
+ hubspot: platformAdapterHubspotApi,
5670
+ slack: platformAdapterSlackApi,
5671
+ bigcommerce: platformAdapterBigCommerceApi,
5672
+ text: platformAdapterTextApi
5673
+ };
5674
+
5675
+ // src/apis/platform/adapter/api.ts
5676
+ var platformAdapterApi = {
5677
+ integrations: platformAdapterIntegrationsApi
5678
+ };
5679
+
5680
+ // src/apis/platform/billing/account/api.ts
5681
+ var platformBillingAccountApi = {
5682
+ getAccount(authorization) {
5343
5683
  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
- );
5684
+ try {
5685
+ return yield billingClientInstance.get(
5686
+ "/v3/account",
5687
+ getBillingClientConfig(authorization)
5688
+ );
5689
+ } catch (error) {
5690
+ if (error instanceof Error) {
5691
+ throw new Error(`Account couldn't be fetched. [${error.message}]`);
5692
+ } else {
5693
+ throw error;
5694
+ }
5695
+ }
5352
5696
  });
5353
5697
  },
5354
- upsert(payload, authorization) {
5698
+ getAccountInfo(product, authorization) {
5355
5699
  return __async(this, null, function* () {
5356
- return adapterClientInstance.patch(
5357
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5358
- payload,
5359
- getAdapterClientDefaultConfig(authorization)
5360
- );
5700
+ try {
5701
+ return yield billingClientInstance.get(
5702
+ `/v3/account/${encodeURIComponent(product)}/billing_info`,
5703
+ getBillingClientConfig(authorization)
5704
+ );
5705
+ } catch (error) {
5706
+ if (error instanceof Error) {
5707
+ throw new Error(
5708
+ `Account billing info couldn't be fetched. [${error.message}]`
5709
+ );
5710
+ } else {
5711
+ throw error;
5712
+ }
5713
+ }
5361
5714
  });
5362
5715
  }
5363
5716
  };
5364
5717
 
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) {
5718
+ // src/apis/platform/billing/invoices/api.ts
5719
+ var platformBillingInvoicesApi = {
5720
+ getInvoices(product, authorization) {
5376
5721
  return __async(this, null, function* () {
5377
- return adapterClientInstance.post(
5378
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5379
- payload,
5380
- getAdapterClientDefaultConfig(authorization)
5381
- );
5722
+ try {
5723
+ return yield billingClientInstance.get(
5724
+ `/v2/invoices/${encodeURIComponent(product)}`,
5725
+ getBillingClientConfig(authorization)
5726
+ );
5727
+ } catch (error) {
5728
+ if (error instanceof Error) {
5729
+ throw new Error(`Invoices couldn't be fetched. [${error.message}]`);
5730
+ } else {
5731
+ throw error;
5732
+ }
5733
+ }
5382
5734
  });
5383
5735
  },
5384
- remove(payload, authorization) {
5736
+ downloadInvoices(number, authorization) {
5385
5737
  return __async(this, null, function* () {
5386
- return adapterClientInstance.delete(
5387
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5388
- getAdapterClientDefaultConfig(authorization)
5389
- );
5738
+ try {
5739
+ const response = yield billingClientInstance.request(__spreadValues({
5740
+ url: `https://api.labs.livechatinc.com/v2/invoices/${encodeURIComponent(
5741
+ number
5742
+ )}`,
5743
+ data: new URLSearchParams({
5744
+ _method: "GET"
5745
+ //gave the values directly for testing
5746
+ }),
5747
+ responseType: "blob"
5748
+ }, getBillingClientConfig(authorization)));
5749
+ const href = URL.createObjectURL(response.data);
5750
+ const link = document.createElement("a");
5751
+ link.href = href;
5752
+ link.setAttribute("download", `invoice-${number}.pdf`);
5753
+ document.body.appendChild(link);
5754
+ link.click();
5755
+ document.body.removeChild(link);
5756
+ URL.revokeObjectURL(href);
5757
+ } catch (error) {
5758
+ if (error instanceof Error) {
5759
+ throw new Error(`Invoice couldn't be downloaded. [${error.message}]`);
5760
+ } else {
5761
+ throw error;
5762
+ }
5763
+ }
5390
5764
  });
5391
5765
  }
5392
5766
  };
5393
5767
 
5394
- // src/apis/platform/adapter/app/blocks/properties/property/api.ts
5395
- var platformAdapterAppPropertyApi = {
5396
- get(appId, propertyId, authorization) {
5768
+ // src/apis/platform/billing/api.ts
5769
+ var platformBillingApi = {
5770
+ account: platformBillingAccountApi,
5771
+ invoices: platformBillingInvoicesApi
5772
+ };
5773
+
5774
+ // src/apis/platform/console/app/blocks/authorization/api.ts
5775
+ var platformConsoleAppAuthorizationApi = {
5776
+ get(appId, authorization) {
5397
5777
  return __async(this, null, function* () {
5398
- return adapterClientInstance.get(
5399
- `/console/app/${encodeURIComponent(
5400
- appId
5401
- )}/blocks/properties/${encodeURIComponent(propertyId)}`,
5402
- getAdapterClientDefaultConfig(authorization)
5778
+ return consoleClientInstance.get(
5779
+ `/app/${encodeURIComponent(appId)}/blocks/authorization`,
5780
+ getConsoleClientDefaultConfig(authorization)
5403
5781
  );
5404
5782
  });
5405
5783
  },
5406
- upsert(payload, authorization) {
5784
+ add(payload, authorization) {
5407
5785
  return __async(this, null, function* () {
5408
- return adapterClientInstance.post(
5409
- `/console/app/${encodeURIComponent(
5410
- payload.appId
5411
- )}/blocks/properties/${encodeURIComponent(payload.propertyId)}`,
5786
+ return consoleClientInstance.post(
5787
+ `/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5412
5788
  payload,
5413
- getAdapterClientDefaultConfig(authorization)
5789
+ getConsoleClientDefaultConfig(authorization)
5414
5790
  );
5415
5791
  });
5416
5792
  },
5417
- remove(payload, authorization) {
5418
- return __async(this, null, function* () {
5419
- return adapterClientInstance.delete(
5420
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/properties/${payload.propertyId}`,
5421
- getAdapterClientDefaultConfig(authorization)
5422
- );
5423
- });
5424
- }
5425
- };
5426
-
5427
- // src/apis/platform/adapter/app/blocks/properties/api.ts
5428
- var platformAdapterAppPropertiesApi = {
5429
- property: platformAdapterAppPropertyApi,
5430
- get(appId, authorization) {
5431
- return __async(this, null, function* () {
5432
- return adapterClientInstance.get(
5433
- `/console/app/${encodeURIComponent(appId)}/blocks/properties`,
5434
- getAdapterClientDefaultConfig(authorization)
5435
- );
5436
- });
5437
- },
5438
- upsert(payload, authorization) {
5793
+ update(payload, authorization) {
5439
5794
  return __async(this, null, function* () {
5440
- return adapterClientInstance.post(
5441
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5795
+ return consoleClientInstance.put(
5796
+ `/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5442
5797
  payload,
5443
- getAdapterClientDefaultConfig(authorization)
5798
+ getConsoleClientDefaultConfig(authorization)
5444
5799
  );
5445
5800
  });
5446
5801
  },
5447
5802
  remove(payload, authorization) {
5448
5803
  return __async(this, null, function* () {
5449
- return adapterClientInstance.delete(
5450
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5451
- getAdapterClientDefaultConfig(authorization)
5804
+ return consoleClientInstance.delete(
5805
+ `/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5806
+ getConsoleClientDefaultConfig(authorization)
5452
5807
  );
5453
5808
  });
5454
5809
  }
5455
5810
  };
5456
5811
 
5457
- // src/apis/platform/adapter/app/blocks/repository/api.ts
5458
- var platformAdapterAppRepositoryApi = {
5812
+ // src/apis/platform/console/app/blocks/deployment/api.ts
5813
+ var platformConsoleAppDeploymentApi = {
5459
5814
  getAggregate(appId, authorization) {
5460
5815
  return __async(this, null, function* () {
5461
- return adapterClientInstance.get(
5462
- `/console/app/${encodeURIComponent(appId)}/blocks/repository/aggregate`,
5463
- getAdapterClientDefaultConfig(authorization)
5816
+ return consoleClientInstance.get(
5817
+ `/app/${encodeURIComponent(appId)}/blocks/deployment/aggregate`,
5818
+ getConsoleClientDefaultConfig(authorization)
5464
5819
  );
5465
5820
  });
5466
5821
  },
5467
5822
  get(appId, authorization) {
5468
5823
  return __async(this, null, function* () {
5469
- return adapterClientInstance.get(
5470
- `/console/app/${encodeURIComponent(appId)}/blocks/repository`,
5471
- getAdapterClientDefaultConfig(authorization)
5824
+ return consoleClientInstance.get(
5825
+ `/app/${encodeURIComponent(appId)}/blocks/deployment`,
5826
+ getConsoleClientDefaultConfig(authorization)
5472
5827
  );
5473
5828
  });
5474
5829
  },
5475
5830
  link(payload, authorization) {
5476
5831
  return __async(this, null, function* () {
5477
- return adapterClientInstance.put(
5478
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
5832
+ return consoleClientInstance.put(
5833
+ `/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5479
5834
  payload,
5480
- getAdapterClientDefaultConfig(authorization)
5835
+ getConsoleClientDefaultConfig(authorization)
5481
5836
  );
5482
5837
  });
5483
5838
  },
5484
5839
  unlink(payload, authorization) {
5485
5840
  return __async(this, null, function* () {
5486
- return adapterClientInstance.delete(
5487
- `/console/app/${encodeURIComponent(
5841
+ return consoleClientInstance.delete(
5842
+ `/app/${encodeURIComponent(
5488
5843
  payload.appId
5489
- )}/blocks/repository?${new URLSearchParams(
5844
+ )}/blocks/deployment?${new URLSearchParams(
5490
5845
  payload
5491
5846
  ).toString()}`,
5492
- getAdapterClientDefaultConfig(authorization)
5847
+ getConsoleClientDefaultConfig(authorization)
5493
5848
  );
5494
5849
  });
5495
5850
  },
5496
5851
  upsert(payload, authorization) {
5497
5852
  return __async(this, null, function* () {
5498
- return adapterClientInstance.patch(
5499
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
5500
- 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`,
5853
+ return consoleClientInstance.patch(
5854
+ `/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5511
5855
  payload,
5512
- getAdapterClientDefaultConfig(authorization)
5856
+ getConsoleClientDefaultConfig(authorization)
5513
5857
  );
5514
5858
  });
5515
5859
  }
5516
5860
  };
5517
5861
 
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
- },
5862
+ // src/apis/platform/console/app/blocks/monetization/api.ts
5863
+ var platformConsoleAppMonetizationApi = {
5528
5864
  get(appId, authorization) {
5529
5865
  return __async(this, null, function* () {
5530
- return adapterClientInstance.get(
5531
- `/console/app/${encodeURIComponent(appId)}/blocks/storage`,
5532
- getAdapterClientDefaultConfig(authorization)
5866
+ return consoleClientInstance.get(
5867
+ `/app/${encodeURIComponent(appId)}/blocks/monetization`,
5868
+ getConsoleClientDefaultConfig(authorization)
5533
5869
  );
5534
5870
  });
5535
5871
  },
5536
- link(payload, authorization) {
5872
+ upsert(payload, authorization) {
5537
5873
  return __async(this, null, function* () {
5538
- return adapterClientInstance.put(
5539
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
5874
+ return consoleClientInstance.post(
5875
+ `/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5540
5876
  payload,
5541
- getAdapterClientDefaultConfig(authorization)
5542
- );
5543
- });
5544
- },
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)
5877
+ getConsoleClientDefaultConfig(authorization)
5554
5878
  );
5555
5879
  });
5556
5880
  },
5557
- upsert(payload, authorization) {
5881
+ remove(payload, authorization) {
5558
5882
  return __async(this, null, function* () {
5559
- return adapterClientInstance.patch(
5560
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
5561
- payload,
5562
- getAdapterClientDefaultConfig(authorization)
5883
+ return consoleClientInstance.delete(
5884
+ `/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5885
+ getConsoleClientDefaultConfig(authorization)
5563
5886
  );
5564
5887
  });
5565
5888
  }
5566
5889
  };
5567
5890
 
5568
- // src/apis/platform/adapter/app/blocks/widgets/widget/api.ts
5569
- var platformAdapterAppWidgetApi = {
5570
- get(appId, widgetId, authorization) {
5891
+ // src/apis/platform/console/app/blocks/properties/property/api.ts
5892
+ var platformConsoleAppPropertyApi = {
5893
+ get(appId, propertyId, authorization) {
5571
5894
  return __async(this, null, function* () {
5572
- return adapterClientInstance.get(
5573
- `/console/app/${encodeURIComponent(
5895
+ return consoleClientInstance.get(
5896
+ `/app/${encodeURIComponent(
5574
5897
  appId
5575
- )}/blocks/widgets/${encodeURIComponent(widgetId)}`,
5576
- getAdapterClientDefaultConfig(authorization)
5898
+ )}/blocks/properties/${encodeURIComponent(propertyId)}`,
5899
+ getConsoleClientDefaultConfig(authorization)
5577
5900
  );
5578
5901
  });
5579
5902
  },
5580
5903
  upsert(payload, authorization) {
5581
5904
  return __async(this, null, function* () {
5582
- return adapterClientInstance.post(
5583
- `/console/app/${encodeURIComponent(
5905
+ return consoleClientInstance.post(
5906
+ `/app/${encodeURIComponent(
5584
5907
  payload.appId
5585
- )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
5908
+ )}/blocks/properties/${encodeURIComponent(payload.propertyId)}`,
5586
5909
  payload,
5587
- getAdapterClientDefaultConfig(authorization)
5910
+ getConsoleClientDefaultConfig(authorization)
5588
5911
  );
5589
5912
  });
5590
5913
  },
5591
5914
  remove(payload, authorization) {
5592
5915
  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)
5916
+ return consoleClientInstance.delete(
5917
+ `/app/${encodeURIComponent(payload.appId)}/blocks/properties/${payload.propertyId}`,
5918
+ getConsoleClientDefaultConfig(authorization)
5598
5919
  );
5599
5920
  });
5600
5921
  }
5601
5922
  };
5602
5923
 
5603
- // src/apis/platform/adapter/app/blocks/widgets/api.ts
5604
- var platformAdapterAppWidgetsApi = {
5605
- widget: platformAdapterAppWidgetApi,
5924
+ // src/apis/platform/console/app/blocks/properties/api.ts
5925
+ var platformConsoleAppPropertiesApi = {
5926
+ property: platformConsoleAppPropertyApi,
5606
5927
  get(appId, authorization) {
5607
5928
  return __async(this, null, function* () {
5608
- return adapterClientInstance.get(
5609
- `/console/app/${encodeURIComponent(appId)}/blocks/widgets`,
5610
- getAdapterClientDefaultConfig(authorization)
5929
+ return consoleClientInstance.get(
5930
+ `/app/${encodeURIComponent(appId)}/blocks/properties`,
5931
+ getConsoleClientDefaultConfig(authorization)
5611
5932
  );
5612
5933
  });
5613
5934
  },
5614
5935
  upsert(payload, authorization) {
5615
5936
  return __async(this, null, function* () {
5616
- return adapterClientInstance.post(
5617
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
5937
+ return consoleClientInstance.post(
5938
+ `/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5618
5939
  payload,
5619
- getAdapterClientDefaultConfig(authorization)
5940
+ getConsoleClientDefaultConfig(authorization)
5620
5941
  );
5621
5942
  });
5622
5943
  },
5623
5944
  remove(payload, authorization) {
5624
5945
  return __async(this, null, function* () {
5625
- return adapterClientInstance.delete(
5626
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
5627
- getAdapterClientDefaultConfig(authorization)
5946
+ return consoleClientInstance.delete(
5947
+ `/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5948
+ getConsoleClientDefaultConfig(authorization)
5628
5949
  );
5629
5950
  });
5630
5951
  }
5631
5952
  };
5632
5953
 
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) {
5647
- return __async(this, null, function* () {
5648
- return adapterClientInstance.get(
5649
- "/console/app/templates",
5650
- getAdapterClientDefaultConfig(authorization)
5651
- );
5652
- });
5653
- },
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) {
5954
+ // src/apis/platform/console/app/blocks/repository/api.ts
5955
+ var platformConsoleAppRepositoryApi = {
5956
+ getAggregate(appId, authorization) {
5667
5957
  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))
5958
+ return consoleClientInstance.get(
5959
+ `/app/${encodeURIComponent(appId)}/blocks/repository/aggregate`,
5960
+ getConsoleClientDefaultConfig(authorization)
5675
5961
  );
5676
- return response.data;
5677
5962
  });
5678
5963
  },
5679
- getVariable(appId, key, authorization) {
5964
+ get(appId, authorization) {
5680
5965
  return __async(this, null, function* () {
5681
- const response = yield adapterClientInstance.get(
5682
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5683
- key
5684
- )}`,
5685
- getAdapterClientDefaultConfig(authorization)
5966
+ return consoleClientInstance.get(
5967
+ `/app/${encodeURIComponent(appId)}/blocks/repository`,
5968
+ getConsoleClientDefaultConfig(authorization)
5686
5969
  );
5687
- return response.data;
5688
5970
  });
5689
5971
  },
5690
- syncVariable(appId, key, payload, authorization) {
5972
+ link(payload, authorization) {
5691
5973
  return __async(this, null, function* () {
5692
- yield adapterClientInstance.post(
5693
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5694
- key
5695
- )}/sync`,
5974
+ return consoleClientInstance.put(
5975
+ `/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
5696
5976
  payload,
5697
- getAdapterClientDefaultConfig(authorization)
5977
+ getConsoleClientDefaultConfig(authorization)
5698
5978
  );
5699
5979
  });
5700
5980
  },
5701
- createVariable(appId, data, authorization) {
5981
+ unlink(payload, authorization) {
5702
5982
  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)
5983
+ return consoleClientInstance.delete(
5984
+ `/app/${encodeURIComponent(
5985
+ payload.appId
5986
+ )}/blocks/repository?${new URLSearchParams(
5987
+ payload
5988
+ ).toString()}`,
5989
+ getConsoleClientDefaultConfig(authorization)
5709
5990
  );
5710
5991
  });
5711
5992
  },
5712
- editVariable(appId, data, authorization) {
5993
+ upsert(payload, authorization) {
5713
5994
  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)
5995
+ return consoleClientInstance.patch(
5996
+ `/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
5997
+ payload,
5998
+ getConsoleClientDefaultConfig(authorization)
5720
5999
  );
5721
6000
  });
5722
6001
  },
5723
- deleteVariable(appId, key) {
6002
+ seed(payload, authorization) {
5724
6003
  return __async(this, null, function* () {
5725
- yield adapterClientInstance.delete(
5726
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5727
- key
5728
- )}`
6004
+ return consoleClientInstance.post(
6005
+ `/app/${encodeURIComponent(payload.appId)}/blocks/repository/seed`,
6006
+ payload,
6007
+ getConsoleClientDefaultConfig(authorization)
5729
6008
  );
5730
6009
  });
5731
6010
  }
5732
6011
  };
5733
6012
 
5734
- // src/apis/platform/adapter/app/api.ts
5735
- var platformAdapterAppApi = {
5736
- blocks: platformAdapterAppBlocksApi,
5737
- variables: platformAdapterAppVariablesApi,
5738
- templates: platformAdapterAppTemplatesApi,
5739
- push(payload, authorization) {
6013
+ // src/apis/platform/console/app/blocks/storage/api.ts
6014
+ var platformConsoleAppStorageApi = {
6015
+ getAggregate(appId, authorization) {
5740
6016
  return __async(this, null, function* () {
5741
- return adapterClientInstance.post(
5742
- `/console/app${payload.manifest.id ? `/${encodeURIComponent(payload.manifest.id)}` : ""}`,
5743
- payload,
5744
- getAdapterClientDefaultConfig(authorization)
6017
+ return consoleClientInstance.get(
6018
+ `/app/${encodeURIComponent(appId)}/blocks/storage/aggregate`,
6019
+ getConsoleClientDefaultConfig(authorization)
5745
6020
  );
5746
6021
  });
5747
6022
  },
5748
- pull(appId, authorization) {
6023
+ get(appId, authorization) {
5749
6024
  return __async(this, null, function* () {
5750
- return adapterClientInstance.get(
5751
- `/console/app/${encodeURIComponent(appId)}`,
5752
- getAdapterClientDefaultConfig(authorization)
6025
+ return consoleClientInstance.get(
6026
+ `/app/${encodeURIComponent(appId)}/blocks/storage`,
6027
+ getConsoleClientDefaultConfig(authorization)
5753
6028
  );
5754
6029
  });
5755
6030
  },
5756
- verify(payload, authorization) {
6031
+ link(payload, authorization) {
5757
6032
  return __async(this, null, function* () {
5758
- return adapterClientInstance.post(
5759
- `/console/app/${encodeURIComponent(payload.appId)}/verify`,
6033
+ return consoleClientInstance.put(
6034
+ `/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
5760
6035
  payload,
5761
- getAdapterClientDefaultConfig(authorization)
6036
+ getConsoleClientDefaultConfig(authorization)
5762
6037
  );
5763
6038
  });
5764
6039
  },
5765
- status(sagaId, authorization) {
6040
+ unlink(payload, authorization) {
5766
6041
  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
- }
6042
+ return consoleClientInstance.delete(
6043
+ `/app/${encodeURIComponent(
6044
+ payload.appId
6045
+ )}/blocks/storage?${new URLSearchParams(
6046
+ payload
6047
+ ).toString()}`,
6048
+ getConsoleClientDefaultConfig(authorization)
6049
+ );
6050
+ });
6051
+ },
6052
+ upsert(payload, authorization) {
6053
+ return __async(this, null, function* () {
6054
+ return consoleClientInstance.patch(
6055
+ `/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
6056
+ payload,
6057
+ getConsoleClientDefaultConfig(authorization)
6058
+ );
6059
+ });
5872
6060
  }
5873
6061
  };
5874
6062
 
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
- }
6063
+ // src/apis/platform/console/app/blocks/widgets/widget/api.ts
6064
+ var platformConsoleAppWidgetApi = {
6065
+ get(appId, widgetId, authorization) {
6066
+ return __async(this, null, function* () {
6067
+ return consoleClientInstance.get(
6068
+ `/app/${encodeURIComponent(
6069
+ appId
6070
+ )}/blocks/widgets/${encodeURIComponent(widgetId)}`,
6071
+ getConsoleClientDefaultConfig(authorization)
6072
+ );
6073
+ });
6074
+ },
6075
+ upsert(payload, authorization) {
6076
+ return __async(this, null, function* () {
6077
+ return consoleClientInstance.post(
6078
+ `/app/${encodeURIComponent(
6079
+ payload.appId
6080
+ )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
6081
+ payload,
6082
+ getConsoleClientDefaultConfig(authorization)
6083
+ );
6084
+ });
6085
+ },
6086
+ remove(payload, authorization) {
6087
+ return __async(this, null, function* () {
6088
+ return consoleClientInstance.delete(
6089
+ `/app/${encodeURIComponent(
6090
+ payload.appId
6091
+ )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
6092
+ getConsoleClientDefaultConfig(authorization)
6093
+ );
6094
+ });
5896
6095
  }
5897
6096
  };
5898
6097
 
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
- }
6098
+ // src/apis/platform/console/app/blocks/widgets/api.ts
6099
+ var platformConsoleAppWidgetsApi = {
6100
+ widget: platformConsoleAppWidgetApi,
6101
+ get(appId, authorization) {
6102
+ return __async(this, null, function* () {
6103
+ return consoleClientInstance.get(
6104
+ `/app/${encodeURIComponent(appId)}/blocks/widgets`,
6105
+ getConsoleClientDefaultConfig(authorization)
6106
+ );
6107
+ });
6108
+ },
6109
+ upsert(payload, authorization) {
6110
+ return __async(this, null, function* () {
6111
+ return consoleClientInstance.post(
6112
+ `/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
6113
+ payload,
6114
+ getConsoleClientDefaultConfig(authorization)
6115
+ );
6116
+ });
6117
+ },
6118
+ remove(payload, authorization) {
6119
+ return __async(this, null, function* () {
6120
+ return consoleClientInstance.delete(
6121
+ `/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
6122
+ getConsoleClientDefaultConfig(authorization)
6123
+ );
6124
+ });
5920
6125
  }
5921
6126
  };
5922
6127
 
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
6128
+ // src/apis/platform/console/app/blocks/api.ts
6129
+ var platformConsoleAppBlocksApi = {
6130
+ authorization: platformConsoleAppAuthorizationApi,
6131
+ monetization: platformConsoleAppMonetizationApi,
6132
+ repository: platformConsoleAppRepositoryApi,
6133
+ deployment: platformConsoleAppDeploymentApi,
6134
+ storage: platformConsoleAppStorageApi,
6135
+ properties: platformConsoleAppPropertiesApi,
6136
+ widgets: platformConsoleAppWidgetsApi
5931
6137
  };
5932
6138
 
5933
- // src/apis/platform/adapter/api.ts
5934
- var platformAdapterApi = {
5935
- app: platformAdapterAppApi,
5936
- integrations: platformAdapterIntegrationsApi,
5937
- log(payload, authorization) {
6139
+ // src/apis/platform/console/app/templates/api.ts
6140
+ var platformConsoleAppTemplatesApi = {
6141
+ getTemplates(authorization) {
5938
6142
  return __async(this, null, function* () {
5939
- return adapterClientInstance.post(
5940
- "/log",
5941
- payload,
5942
- getAdapterClientConfig(authorization)
6143
+ return consoleClientInstance.get(
6144
+ "/app/templates",
6145
+ getConsoleClientDefaultConfig(authorization)
6146
+ );
6147
+ });
6148
+ },
6149
+ getRepositoryTemplates(authorization) {
6150
+ return __async(this, null, function* () {
6151
+ return consoleClientInstance.get(
6152
+ "/app/templates/repository",
6153
+ getConsoleClientDefaultConfig(authorization)
5943
6154
  );
5944
6155
  });
5945
6156
  }
5946
6157
  };
5947
6158
 
5948
- // src/apis/platform/billing/account/api.ts
5949
- var platformBillingAccountApi = {
5950
- getAccount(authorization) {
6159
+ // src/apis/platform/console/app/variables/api.ts
6160
+ var platformConsoleAppVariablesApi = {
6161
+ getVariables(appId, decrypted, authorization) {
5951
6162
  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
- }
6163
+ const response = yield consoleClientInstance.get(
6164
+ `/app/${encodeURIComponent(appId)}/variables`,
6165
+ __spreadValues({
6166
+ params: {
6167
+ decrypted
6168
+ }
6169
+ }, getConsoleClientDefaultConfig(authorization))
6170
+ );
6171
+ return response.data;
5964
6172
  });
5965
6173
  },
5966
- getAccountInfo(product, authorization) {
6174
+ getVariable(appId, key, authorization) {
5967
6175
  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
- }
6176
+ const response = yield consoleClientInstance.get(
6177
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(key)}`,
6178
+ getConsoleClientDefaultConfig(authorization)
6179
+ );
6180
+ return response.data;
6181
+ });
6182
+ },
6183
+ syncVariable(appId, key, payload, authorization) {
6184
+ return __async(this, null, function* () {
6185
+ yield consoleClientInstance.post(
6186
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
6187
+ key
6188
+ )}/sync`,
6189
+ payload,
6190
+ getConsoleClientDefaultConfig(authorization)
6191
+ );
6192
+ });
6193
+ },
6194
+ createVariable(appId, data, authorization) {
6195
+ return __async(this, null, function* () {
6196
+ yield consoleClientInstance.post(
6197
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
6198
+ data.key
6199
+ )}`,
6200
+ data,
6201
+ getConsoleClientDefaultConfig(authorization)
6202
+ );
6203
+ });
6204
+ },
6205
+ editVariable(appId, data, authorization) {
6206
+ return __async(this, null, function* () {
6207
+ yield consoleClientInstance.post(
6208
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
6209
+ data.key
6210
+ )}/edit`,
6211
+ data,
6212
+ getConsoleClientDefaultConfig(authorization)
6213
+ );
6214
+ });
6215
+ },
6216
+ deleteVariable(appId, key) {
6217
+ return __async(this, null, function* () {
6218
+ yield consoleClientInstance.delete(
6219
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(key)}`
6220
+ );
5982
6221
  });
5983
6222
  }
5984
6223
  };
5985
6224
 
5986
- // src/apis/platform/billing/invoices/api.ts
5987
- var platformBillingInvoicesApi = {
5988
- getInvoices(product, authorization) {
6225
+ // src/apis/platform/console/app/api.ts
6226
+ var platformConsoleAppApi = {
6227
+ blocks: platformConsoleAppBlocksApi,
6228
+ variables: platformConsoleAppVariablesApi,
6229
+ templates: platformConsoleAppTemplatesApi,
6230
+ push(payload, authorization) {
5989
6231
  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
- }
6232
+ return consoleClientInstance.post(
6233
+ `/app${payload.manifest.id ? `/${encodeURIComponent(payload.manifest.id)}` : ""}`,
6234
+ payload,
6235
+ getConsoleClientDefaultConfig(authorization)
6236
+ );
6002
6237
  });
6003
6238
  },
6004
- downloadInvoices(number, authorization) {
6239
+ pull(appId, authorization) {
6005
6240
  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
- }
6241
+ return consoleClientInstance.get(
6242
+ `/app/${encodeURIComponent(appId)}`,
6243
+ getConsoleClientDefaultConfig(authorization)
6244
+ );
6245
+ });
6246
+ },
6247
+ verify(payload, authorization) {
6248
+ return __async(this, null, function* () {
6249
+ return consoleClientInstance.post(
6250
+ `/app/${encodeURIComponent(payload.appId)}/verify`,
6251
+ payload,
6252
+ getConsoleClientDefaultConfig(authorization)
6253
+ );
6254
+ });
6255
+ },
6256
+ status(sagaId, authorization) {
6257
+ return __async(this, null, function* () {
6258
+ return consoleClientInstance.get(
6259
+ "/app/status",
6260
+ __spreadValues({
6261
+ params: {
6262
+ sagaId
6263
+ }
6264
+ }, getConsoleClientDefaultConfig(authorization))
6265
+ );
6032
6266
  });
6033
6267
  }
6034
6268
  };
6035
6269
 
6036
- // src/apis/platform/billing/api.ts
6037
- var platformBillingApi = {
6038
- account: platformBillingAccountApi,
6039
- invoices: platformBillingInvoicesApi
6270
+ // src/apis/platform/console/api.ts
6271
+ var platformConsoleApi = {
6272
+ app: platformConsoleAppApi,
6273
+ log(payload, authorization) {
6274
+ return __async(this, null, function* () {
6275
+ return consoleClientInstance.post(
6276
+ "/log",
6277
+ payload,
6278
+ getConsoleClientConfig(authorization)
6279
+ );
6280
+ });
6281
+ }
6040
6282
  };
6041
6283
 
6042
6284
  // src/constants/app/templates/repository.ts
@@ -7555,6 +7797,7 @@ var platformApi = {
7555
7797
  accounts: platformAccountsApi,
7556
7798
  billing: platformBillingApi,
7557
7799
  adapter: platformAdapterApi,
7800
+ console: platformConsoleApi,
7558
7801
  dps: platformDpsApi
7559
7802
  };
7560
7803
 
@@ -8255,7 +8498,7 @@ var api2 = {
8255
8498
  isInitialized: false
8256
8499
  };
8257
8500
  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;
8501
+ 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
8502
  initPlatformAccountsClient(
8260
8503
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
8261
8504
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.token
@@ -8276,19 +8519,29 @@ function initApi(config, tokens) {
8276
8519
  slack: tokens.slack
8277
8520
  } : void 0
8278
8521
  );
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);
8522
+ initConsoleClient(
8523
+ (_h = config.urls.platform) == null ? void 0 : _h.console,
8524
+ tokens ? {
8525
+ platform: tokens.platform,
8526
+ github: tokens.github,
8527
+ netlify: tokens.netlify,
8528
+ vercel: tokens.vercel,
8529
+ neon: tokens.neon
8530
+ } : void 0
8531
+ );
8532
+ initLiveChatClient((_i = config.urls.products) == null ? void 0 : _i.livechat, (_j = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _j.token);
8533
+ initHelpDeskClient((_k = config.urls.products) == null ? void 0 : _k.helpdesk, (_l = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _l.token);
8534
+ initTextClient((_m = config.urls.integrations) == null ? void 0 : _m.text, (_n = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _n.token);
8535
+ initGithubClient((_o = tokens == null ? void 0 : tokens.github) == null ? void 0 : _o.appToken);
8536
+ initNetlifyClient((_p = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _p.token);
8537
+ initVercelClient((_q = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _q.token);
8538
+ initNeonClient((_r = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _r.token);
8539
+ initPlanetScaleClient((_s = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _s.token);
8540
+ 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);
8541
+ 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);
8542
+ 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);
8543
+ initHubspotClient((_z = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _z.token);
8544
+ initSlackClient((_A = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _A.token);
8292
8545
  api2.isInitialized = true;
8293
8546
  }
8294
8547
 
@@ -8348,7 +8601,9 @@ export {
8348
8601
  BigCommerceApiError,
8349
8602
  BigCommerceEventNames,
8350
8603
  BigCommerceWebhookScopes,
8604
+ ConsoleApiError,
8351
8605
  DpsApiError,
8606
+ GitHubWebhookActions,
8352
8607
  HelpDeskApiError,
8353
8608
  HelpDeskWebhookEventType,
8354
8609
  HubSpotWebhookEventTypes,
@@ -8389,31 +8644,43 @@ export {
8389
8644
  bigcommerceEventsZods,
8390
8645
  billingClientInstance,
8391
8646
  buildUrlFromSegments,
8647
+ consoleClientInstance,
8392
8648
  dpsClientInstance,
8393
8649
  getAdapterClientConfig,
8394
8650
  getAdapterClientDefaultConfig,
8395
8651
  getAppAutoReviewPayload,
8652
+ getBigCommerceClientAuthorization,
8396
8653
  getBigCommerceClientConfig,
8397
8654
  getBigCommerceClientUrl,
8398
8655
  getBillingClientConfig,
8656
+ getConsoleClientConfig,
8657
+ getConsoleClientDefaultConfig,
8399
8658
  getDpsClientConfig,
8400
8659
  getEmptyAppAutoReview,
8660
+ getGitHubClientAuthorization,
8401
8661
  getGithubClientConfig,
8402
8662
  getHelpDeskClientConfig,
8663
+ getHubspotClientAuthorization,
8403
8664
  getHubspotClientConfig,
8404
8665
  getIntegrationFlowUrl,
8405
8666
  getIntegrationFlowUrlForRedirection,
8406
8667
  getLiveChatClientConfig,
8668
+ getMailchimpClientAuthorization,
8407
8669
  getMailchimpClientConfig,
8408
8670
  getMailchimpClientUrl,
8409
8671
  getNeonClientConfig,
8672
+ getNetlifyClientAuthorization,
8410
8673
  getNetlifyClientConfig,
8411
8674
  getPlanetScaleClientConfig,
8412
- getRegion2 as getRegion,
8675
+ getRegion3 as getRegion,
8676
+ getShopifyClientAuthorization,
8413
8677
  getShopifyClientConfig,
8414
8678
  getShopifyClientUrl,
8679
+ getSlackClientAuthorization,
8415
8680
  getSlackClientConfig,
8681
+ getTextClientAuthorization,
8416
8682
  getTextClientConfig,
8683
+ getVercelClientAuthorization,
8417
8684
  getVercelClientConfig,
8418
8685
  githubClientInstance,
8419
8686
  helpdeskClientInstance,
@@ -8423,6 +8690,7 @@ export {
8423
8690
  initApi,
8424
8691
  initBigCommerceClient,
8425
8692
  initBillingClient,
8693
+ initConsoleClient,
8426
8694
  initDpsClient,
8427
8695
  initGithubClient,
8428
8696
  initHelpDeskClient,
@@ -8455,6 +8723,7 @@ export {
8455
8723
  textLivechatEventsZods,
8456
8724
  updateAdapterClient,
8457
8725
  updateBigCommerceClient,
8726
+ updateConsoleClient,
8458
8727
  updateGithubClient,
8459
8728
  updateHubspotClient,
8460
8729
  updateMailchimpClient,