@livechat/developer-studio-api 3.4.23 → 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);
@@ -2687,6 +2777,42 @@ var SlackEventTypes = /* @__PURE__ */ ((SlackEventTypes2) => {
2687
2777
  SlackEventTypes2["MessagePosted"] = "message";
2688
2778
  return SlackEventTypes2;
2689
2779
  })(SlackEventTypes || {});
2780
+ var SlackMessageEventSubTypes = /* @__PURE__ */ ((SlackMessageEventSubTypes2) => {
2781
+ SlackMessageEventSubTypes2["AssistantAppThread"] = "assistant_app_thread";
2782
+ SlackMessageEventSubTypes2["BotMessage"] = "bot_message";
2783
+ SlackMessageEventSubTypes2["ChannelArchive"] = "channel_archive";
2784
+ SlackMessageEventSubTypes2["ChannelConvertToPrivate"] = "channel_convert_to_private";
2785
+ SlackMessageEventSubTypes2["ChannelConvertToPublic"] = "channel_convert_to_public";
2786
+ SlackMessageEventSubTypes2["ChannelJoin"] = "channel_join";
2787
+ SlackMessageEventSubTypes2["ChannelLeave"] = "channel_leave";
2788
+ SlackMessageEventSubTypes2["ChannelName"] = "channel_name";
2789
+ SlackMessageEventSubTypes2["ChannelPostingPermissions"] = "channel_posting_permissions";
2790
+ SlackMessageEventSubTypes2["ChannelPurpose"] = "channel_purpose";
2791
+ SlackMessageEventSubTypes2["ChannelTopic"] = "channel_topic";
2792
+ SlackMessageEventSubTypes2["ChannelUnarchive"] = "channel_unarchive";
2793
+ SlackMessageEventSubTypes2["DocumentMention"] = "document_mention";
2794
+ SlackMessageEventSubTypes2["EkmAccessDenied"] = "ekm_access_denied";
2795
+ SlackMessageEventSubTypes2["FileComment"] = "file_comment";
2796
+ SlackMessageEventSubTypes2["FileMention"] = "file_mention";
2797
+ SlackMessageEventSubTypes2["FileShare"] = "file_share";
2798
+ SlackMessageEventSubTypes2["GroupArchive"] = "group_archive";
2799
+ SlackMessageEventSubTypes2["GroupJoin"] = "group_join";
2800
+ SlackMessageEventSubTypes2["GroupLeave"] = "group_leave";
2801
+ SlackMessageEventSubTypes2["GroupName"] = "group_name";
2802
+ SlackMessageEventSubTypes2["GroupPurpose"] = "group_purpose";
2803
+ SlackMessageEventSubTypes2["GroupTopic"] = "group_topic";
2804
+ SlackMessageEventSubTypes2["GroupUnarchive"] = "group_unarchive";
2805
+ SlackMessageEventSubTypes2["MessageChanged"] = "message_changed";
2806
+ SlackMessageEventSubTypes2["MessageDeleted"] = "message_deleted";
2807
+ SlackMessageEventSubTypes2["MeMessage"] = "me_message";
2808
+ SlackMessageEventSubTypes2["MessageReplied"] = "message_replied";
2809
+ SlackMessageEventSubTypes2["PinnedItem"] = "pinned_item";
2810
+ SlackMessageEventSubTypes2["ReminderAdd"] = "reminder_add";
2811
+ SlackMessageEventSubTypes2["ReplyBroadcast"] = "reply_broadcast";
2812
+ SlackMessageEventSubTypes2["ThreadBroadcast"] = "thread_broadcast";
2813
+ SlackMessageEventSubTypes2["UnpinnedItem"] = "unpinned_item";
2814
+ return SlackMessageEventSubTypes2;
2815
+ })(SlackMessageEventSubTypes || {});
2690
2816
 
2691
2817
  // src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflows.ts
2692
2818
  var WorkflowTemplateCategory = /* @__PURE__ */ ((WorkflowTemplateCategory2) => {
@@ -2714,6 +2840,16 @@ var WorkflowExecutionStatus = /* @__PURE__ */ ((WorkflowExecutionStatus2) => {
2714
2840
 
2715
2841
  // src/apis/integrations/vercel/instance.ts
2716
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
+ }
2717
2853
  var vercelClientInstance = axios19.create({
2718
2854
  baseURL: "https://api.vercel.com"
2719
2855
  });
@@ -3656,6 +3792,147 @@ function initBillingClient(baseUrl, token) {
3656
3792
  }
3657
3793
  }
3658
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
+
3659
3936
  // src/apis/platform/dps/applications/application/autoReview/_contracts/dtos/autoReview.ts
3660
3937
  var getEmptyAppAutoReview = () => ({
3661
3938
  isReviewed: false,
@@ -3725,14 +4002,14 @@ var getAppAutoReviewPayload = (value) => {
3725
4002
  };
3726
4003
 
3727
4004
  // src/apis/platform/dps/instance.ts
3728
- import axios22 from "axios";
4005
+ import axios23 from "axios";
3729
4006
  var DpsApiError = class extends ApiErrorBase {
3730
4007
  constructor() {
3731
4008
  super(...arguments);
3732
4009
  this.name = "dps";
3733
4010
  }
3734
4011
  };
3735
- var dpsClientInstance = axios22.create({
4012
+ var dpsClientInstance = axios23.create({
3736
4013
  baseURL: "https://dev-platform.labs.livechatinc.com"
3737
4014
  });
3738
4015
  dpsClientInstance.interceptors.response.use(
@@ -3781,14 +4058,14 @@ function initDpsClient(baseUrl, token) {
3781
4058
  }
3782
4059
 
3783
4060
  // src/apis/products/helpdesk/instance.ts
3784
- import axios23 from "axios";
4061
+ import axios24 from "axios";
3785
4062
  var HelpDeskApiError = class extends ApiErrorBase {
3786
4063
  constructor() {
3787
4064
  super(...arguments);
3788
4065
  this.name = "helpdesk";
3789
4066
  }
3790
4067
  };
3791
- var helpdeskClientInstance = axios23.create({
4068
+ var helpdeskClientInstance = axios24.create({
3792
4069
  baseURL: "https://api.labs.helpdesk.com"
3793
4070
  });
3794
4071
  helpdeskClientInstance.interceptors.response.use(
@@ -3876,17 +4153,17 @@ var LivechatWebhookSystemMessages = /* @__PURE__ */ ((LivechatWebhookSystemMessa
3876
4153
  })(LivechatWebhookSystemMessages || {});
3877
4154
 
3878
4155
  // src/apis/products/livechat/instance.ts
3879
- import axios24 from "axios";
3880
- var REGION2 = {
4156
+ import axios25 from "axios";
4157
+ var REGION3 = {
3881
4158
  FRA: "fra",
3882
4159
  DAL: "dal",
3883
4160
  FRA_A: "fra-a",
3884
4161
  FRA_B: "fra-b"
3885
4162
  };
3886
- var supportedRegions2 = Object.values(REGION2);
3887
- var getRegion2 = (token) => {
4163
+ var supportedRegions3 = Object.values(REGION3);
4164
+ var getRegion3 = (token) => {
3888
4165
  const region = token.split(":")[0];
3889
- if (supportedRegions2.includes(region)) {
4166
+ if (supportedRegions3.includes(region)) {
3890
4167
  return region;
3891
4168
  }
3892
4169
  };
@@ -3896,7 +4173,7 @@ var LivechatApiError = class extends ApiErrorBase {
3896
4173
  this.name = "livechat";
3897
4174
  }
3898
4175
  };
3899
- var livechatClientInstance = axios24.create({
4176
+ var livechatClientInstance = axios25.create({
3900
4177
  baseURL: "https://api.labs.livechatinc.com"
3901
4178
  });
3902
4179
  livechatClientInstance.interceptors.response.use(
@@ -3931,7 +4208,7 @@ function getLiveChatClientConfig(options = {}) {
3931
4208
  };
3932
4209
  }
3933
4210
  function initLiveChatClient(baseUrl, token) {
3934
- const region = token ? getRegion2(token) : void 0;
4211
+ const region = token ? getRegion3(token) : void 0;
3935
4212
  const headers = livechatClientInstance.defaults.headers;
3936
4213
  if (baseUrl) {
3937
4214
  livechatClientInstance.interceptors.request.use(
@@ -4292,7 +4569,8 @@ var urls = {
4292
4569
  create: () => getUrl(),
4293
4570
  update: (id) => getUrl([id]),
4294
4571
  delete: (id) => getUrl([id]),
4295
- connect: (id) => getUrl([id, "connection"])
4572
+ connect: (id) => getUrl([id, "connection"]),
4573
+ disconnect: (id) => getUrl([id, "disconnect"])
4296
4574
  };
4297
4575
  var textPlatformWorkflowsCredentialsApi = {
4298
4576
  meta: {
@@ -4404,6 +4682,24 @@ var textPlatformWorkflowsCredentialsApi = {
4404
4682
  throw error;
4405
4683
  });
4406
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
+ });
4407
4703
  }
4408
4704
  };
4409
4705
 
@@ -4637,7 +4933,7 @@ var textApi = {
4637
4933
  };
4638
4934
 
4639
4935
  // src/apis/integrations/vercel/api.ts
4640
- import axios25 from "axios";
4936
+ import axios26 from "axios";
4641
4937
 
4642
4938
  // src/apis/integrations/vercel/deploy/api.ts
4643
4939
  var vercelDeployApi = {
@@ -4897,7 +5193,7 @@ var vercelApi = {
4897
5193
  client_secret: clientSecret,
4898
5194
  redirect_uri: redirectUrl
4899
5195
  });
4900
- 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, {
4901
5197
  headers: {
4902
5198
  "Content-Type": "application/x-www-form-urlencoded"
4903
5199
  }
@@ -5238,769 +5534,767 @@ var platformAccountsApi = {
5238
5534
  token: platformAccountsTokenApi
5239
5535
  };
5240
5536
 
5241
- // src/apis/platform/adapter/app/blocks/authorization/api.ts
5242
- var platformAdapterAppAuthorizationApi = {
5243
- get(appId, authorization) {
5244
- return __async(this, null, function* () {
5245
- return adapterClientInstance.get(
5246
- `/console/app/${encodeURIComponent(appId)}/blocks/authorization`,
5247
- getAdapterClientDefaultConfig(authorization)
5248
- );
5249
- });
5250
- },
5251
- add(payload, authorization) {
5252
- return __async(this, null, function* () {
5253
- return adapterClientInstance.post(
5254
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5255
- payload,
5256
- getAdapterClientDefaultConfig(authorization)
5257
- );
5258
- });
5259
- },
5260
- update(payload, authorization) {
5261
- return __async(this, null, function* () {
5262
- return adapterClientInstance.put(
5263
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5264
- payload,
5265
- getAdapterClientDefaultConfig(authorization)
5266
- );
5267
- });
5268
- },
5269
- remove(payload, authorization) {
5270
- return __async(this, null, function* () {
5271
- return adapterClientInstance.delete(
5272
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5273
- getAdapterClientDefaultConfig(authorization)
5274
- );
5275
- });
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
+ }
5276
5558
  }
5277
5559
  };
5278
5560
 
5279
- // src/apis/platform/adapter/app/blocks/deployment/api.ts
5280
- var platformAdapterAppDeploymentApi = {
5281
- getAggregate(appId, authorization) {
5282
- return __async(this, null, function* () {
5283
- return adapterClientInstance.get(
5284
- `/console/app/${encodeURIComponent(appId)}/blocks/deployment/aggregate`,
5285
- getAdapterClientDefaultConfig(authorization)
5286
- );
5287
- });
5288
- },
5289
- get(appId, authorization) {
5290
- return __async(this, null, function* () {
5291
- return adapterClientInstance.get(
5292
- `/console/app/${encodeURIComponent(appId)}/blocks/deployment`,
5293
- getAdapterClientDefaultConfig(authorization)
5294
- );
5295
- });
5296
- },
5297
- link(payload, authorization) {
5298
- return __async(this, null, function* () {
5299
- return adapterClientInstance.put(
5300
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5301
- payload,
5302
- getAdapterClientDefaultConfig(authorization)
5303
- );
5304
- });
5305
- },
5306
- unlink(payload, authorization) {
5307
- return __async(this, null, function* () {
5308
- return adapterClientInstance.delete(
5309
- `/console/app/${encodeURIComponent(
5310
- payload.appId
5311
- )}/blocks/deployment?${new URLSearchParams(
5312
- payload
5313
- ).toString()}`,
5314
- getAdapterClientDefaultConfig(authorization)
5315
- );
5316
- });
5317
- },
5318
- upsert(payload, authorization) {
5319
- return __async(this, null, function* () {
5320
- return adapterClientInstance.patch(
5321
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5322
- payload,
5323
- getAdapterClientDefaultConfig(authorization)
5324
- );
5325
- });
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
+ }
5326
5582
  }
5327
5583
  };
5328
5584
 
5329
- // src/apis/platform/adapter/app/blocks/monetization/api.ts
5330
- var platformAdapterAppMonetizationApi = {
5331
- get(appId, authorization) {
5332
- return __async(this, null, function* () {
5333
- return adapterClientInstance.get(
5334
- `/console/app/${encodeURIComponent(appId)}/blocks/monetization`,
5335
- getAdapterClientDefaultConfig(authorization)
5336
- );
5337
- });
5338
- },
5339
- 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) {
5340
5699
  return __async(this, null, function* () {
5341
- return adapterClientInstance.post(
5342
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5343
- payload,
5344
- getAdapterClientDefaultConfig(authorization)
5345
- );
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
+ }
5346
5712
  });
5347
5713
  },
5348
- remove(payload, authorization) {
5714
+ getAccountInfo(product, authorization) {
5349
5715
  return __async(this, null, function* () {
5350
- return adapterClientInstance.delete(
5351
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5352
- getAdapterClientDefaultConfig(authorization)
5353
- );
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
+ }
5354
5730
  });
5355
5731
  }
5356
5732
  };
5357
5733
 
5358
- // src/apis/platform/adapter/app/blocks/properties/property/api.ts
5359
- var platformAdapterAppPropertyApi = {
5360
- get(appId, propertyId, authorization) {
5361
- return __async(this, null, function* () {
5362
- return adapterClientInstance.get(
5363
- `/console/app/${encodeURIComponent(
5364
- appId
5365
- )}/blocks/properties/${encodeURIComponent(propertyId)}`,
5366
- getAdapterClientDefaultConfig(authorization)
5367
- );
5368
- });
5369
- },
5370
- upsert(payload, authorization) {
5734
+ // src/apis/platform/billing/invoices/api.ts
5735
+ var platformBillingInvoicesApi = {
5736
+ getInvoices(product, authorization) {
5371
5737
  return __async(this, null, function* () {
5372
- return adapterClientInstance.post(
5373
- `/console/app/${encodeURIComponent(
5374
- payload.appId
5375
- )}/blocks/properties/${encodeURIComponent(payload.propertyId)}`,
5376
- payload,
5377
- getAdapterClientDefaultConfig(authorization)
5378
- );
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
+ }
5379
5750
  });
5380
5751
  },
5381
- remove(payload, authorization) {
5752
+ downloadInvoices(number, authorization) {
5382
5753
  return __async(this, null, function* () {
5383
- return adapterClientInstance.delete(
5384
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/properties/${payload.propertyId}`,
5385
- getAdapterClientDefaultConfig(authorization)
5386
- );
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
+ }
5387
5780
  });
5388
5781
  }
5389
5782
  };
5390
5783
 
5391
- // src/apis/platform/adapter/app/blocks/properties/api.ts
5392
- var platformAdapterAppPropertiesApi = {
5393
- 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 = {
5394
5792
  get(appId, authorization) {
5395
5793
  return __async(this, null, function* () {
5396
- return adapterClientInstance.get(
5397
- `/console/app/${encodeURIComponent(appId)}/blocks/properties`,
5398
- getAdapterClientDefaultConfig(authorization)
5794
+ return consoleClientInstance.get(
5795
+ `/app/${encodeURIComponent(appId)}/blocks/authorization`,
5796
+ getConsoleClientDefaultConfig(authorization)
5399
5797
  );
5400
5798
  });
5401
5799
  },
5402
- 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) {
5403
5810
  return __async(this, null, function* () {
5404
- return adapterClientInstance.post(
5405
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5811
+ return consoleClientInstance.put(
5812
+ `/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5406
5813
  payload,
5407
- getAdapterClientDefaultConfig(authorization)
5814
+ getConsoleClientDefaultConfig(authorization)
5408
5815
  );
5409
5816
  });
5410
5817
  },
5411
5818
  remove(payload, authorization) {
5412
5819
  return __async(this, null, function* () {
5413
- return adapterClientInstance.delete(
5414
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5415
- getAdapterClientDefaultConfig(authorization)
5820
+ return consoleClientInstance.delete(
5821
+ `/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5822
+ getConsoleClientDefaultConfig(authorization)
5416
5823
  );
5417
5824
  });
5418
5825
  }
5419
5826
  };
5420
5827
 
5421
- // src/apis/platform/adapter/app/blocks/repository/api.ts
5422
- var platformAdapterAppRepositoryApi = {
5828
+ // src/apis/platform/console/app/blocks/deployment/api.ts
5829
+ var platformConsoleAppDeploymentApi = {
5423
5830
  getAggregate(appId, authorization) {
5424
5831
  return __async(this, null, function* () {
5425
- return adapterClientInstance.get(
5426
- `/console/app/${encodeURIComponent(appId)}/blocks/repository/aggregate`,
5427
- getAdapterClientDefaultConfig(authorization)
5832
+ return consoleClientInstance.get(
5833
+ `/app/${encodeURIComponent(appId)}/blocks/deployment/aggregate`,
5834
+ getConsoleClientDefaultConfig(authorization)
5428
5835
  );
5429
5836
  });
5430
5837
  },
5431
5838
  get(appId, authorization) {
5432
5839
  return __async(this, null, function* () {
5433
- return adapterClientInstance.get(
5434
- `/console/app/${encodeURIComponent(appId)}/blocks/repository`,
5435
- getAdapterClientDefaultConfig(authorization)
5840
+ return consoleClientInstance.get(
5841
+ `/app/${encodeURIComponent(appId)}/blocks/deployment`,
5842
+ getConsoleClientDefaultConfig(authorization)
5436
5843
  );
5437
5844
  });
5438
5845
  },
5439
5846
  link(payload, authorization) {
5440
5847
  return __async(this, null, function* () {
5441
- return adapterClientInstance.put(
5442
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
5848
+ return consoleClientInstance.put(
5849
+ `/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5443
5850
  payload,
5444
- getAdapterClientDefaultConfig(authorization)
5851
+ getConsoleClientDefaultConfig(authorization)
5445
5852
  );
5446
5853
  });
5447
5854
  },
5448
5855
  unlink(payload, authorization) {
5449
5856
  return __async(this, null, function* () {
5450
- return adapterClientInstance.delete(
5451
- `/console/app/${encodeURIComponent(
5857
+ return consoleClientInstance.delete(
5858
+ `/app/${encodeURIComponent(
5452
5859
  payload.appId
5453
- )}/blocks/repository?${new URLSearchParams(
5860
+ )}/blocks/deployment?${new URLSearchParams(
5454
5861
  payload
5455
5862
  ).toString()}`,
5456
- getAdapterClientDefaultConfig(authorization)
5863
+ getConsoleClientDefaultConfig(authorization)
5457
5864
  );
5458
5865
  });
5459
5866
  },
5460
5867
  upsert(payload, authorization) {
5461
5868
  return __async(this, null, function* () {
5462
- return adapterClientInstance.patch(
5463
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
5869
+ return consoleClientInstance.patch(
5870
+ `/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5464
5871
  payload,
5465
- getAdapterClientDefaultConfig(authorization)
5466
- );
5467
- });
5468
- },
5469
- seed(payload, authorization) {
5470
- return __async(this, null, function* () {
5471
- return adapterClientInstance.post(
5472
- `/console/app/${encodeURIComponent(
5473
- payload.appId
5474
- )}/blocks/repository/seed`,
5475
- payload,
5476
- getAdapterClientDefaultConfig(authorization)
5872
+ getConsoleClientDefaultConfig(authorization)
5477
5873
  );
5478
5874
  });
5479
5875
  }
5480
5876
  };
5481
5877
 
5482
- // src/apis/platform/adapter/app/blocks/storage/api.ts
5483
- var platformAdapterAppStorageApi = {
5484
- getAggregate(appId, authorization) {
5485
- return __async(this, null, function* () {
5486
- return adapterClientInstance.get(
5487
- `/console/app/${encodeURIComponent(appId)}/blocks/storage/aggregate`,
5488
- getAdapterClientDefaultConfig(authorization)
5489
- );
5490
- });
5491
- },
5878
+ // src/apis/platform/console/app/blocks/monetization/api.ts
5879
+ var platformConsoleAppMonetizationApi = {
5492
5880
  get(appId, authorization) {
5493
5881
  return __async(this, null, function* () {
5494
- return adapterClientInstance.get(
5495
- `/console/app/${encodeURIComponent(appId)}/blocks/storage`,
5496
- getAdapterClientDefaultConfig(authorization)
5882
+ return consoleClientInstance.get(
5883
+ `/app/${encodeURIComponent(appId)}/blocks/monetization`,
5884
+ getConsoleClientDefaultConfig(authorization)
5497
5885
  );
5498
5886
  });
5499
5887
  },
5500
- link(payload, authorization) {
5888
+ upsert(payload, authorization) {
5501
5889
  return __async(this, null, function* () {
5502
- return adapterClientInstance.put(
5503
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
5890
+ return consoleClientInstance.post(
5891
+ `/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5504
5892
  payload,
5505
- getAdapterClientDefaultConfig(authorization)
5893
+ getConsoleClientDefaultConfig(authorization)
5506
5894
  );
5507
5895
  });
5508
5896
  },
5509
- unlink(payload, authorization) {
5510
- return __async(this, null, function* () {
5511
- return adapterClientInstance.delete(
5512
- `/console/app/${encodeURIComponent(
5513
- payload.appId
5514
- )}/blocks/storage?${new URLSearchParams(
5515
- payload
5516
- ).toString()}`,
5517
- getAdapterClientDefaultConfig(authorization)
5518
- );
5519
- });
5520
- },
5521
- upsert(payload, authorization) {
5897
+ remove(payload, authorization) {
5522
5898
  return __async(this, null, function* () {
5523
- return adapterClientInstance.patch(
5524
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
5525
- payload,
5526
- getAdapterClientDefaultConfig(authorization)
5899
+ return consoleClientInstance.delete(
5900
+ `/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5901
+ getConsoleClientDefaultConfig(authorization)
5527
5902
  );
5528
5903
  });
5529
5904
  }
5530
5905
  };
5531
5906
 
5532
- // src/apis/platform/adapter/app/blocks/widgets/widget/api.ts
5533
- var platformAdapterAppWidgetApi = {
5534
- get(appId, widgetId, authorization) {
5907
+ // src/apis/platform/console/app/blocks/properties/property/api.ts
5908
+ var platformConsoleAppPropertyApi = {
5909
+ get(appId, propertyId, authorization) {
5535
5910
  return __async(this, null, function* () {
5536
- return adapterClientInstance.get(
5537
- `/console/app/${encodeURIComponent(
5911
+ return consoleClientInstance.get(
5912
+ `/app/${encodeURIComponent(
5538
5913
  appId
5539
- )}/blocks/widgets/${encodeURIComponent(widgetId)}`,
5540
- getAdapterClientDefaultConfig(authorization)
5914
+ )}/blocks/properties/${encodeURIComponent(propertyId)}`,
5915
+ getConsoleClientDefaultConfig(authorization)
5541
5916
  );
5542
5917
  });
5543
5918
  },
5544
5919
  upsert(payload, authorization) {
5545
5920
  return __async(this, null, function* () {
5546
- return adapterClientInstance.post(
5547
- `/console/app/${encodeURIComponent(
5921
+ return consoleClientInstance.post(
5922
+ `/app/${encodeURIComponent(
5548
5923
  payload.appId
5549
- )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
5924
+ )}/blocks/properties/${encodeURIComponent(payload.propertyId)}`,
5550
5925
  payload,
5551
- getAdapterClientDefaultConfig(authorization)
5926
+ getConsoleClientDefaultConfig(authorization)
5552
5927
  );
5553
5928
  });
5554
5929
  },
5555
5930
  remove(payload, authorization) {
5556
5931
  return __async(this, null, function* () {
5557
- return adapterClientInstance.delete(
5558
- `/console/app/${encodeURIComponent(
5559
- payload.appId
5560
- )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
5561
- getAdapterClientDefaultConfig(authorization)
5932
+ return consoleClientInstance.delete(
5933
+ `/app/${encodeURIComponent(payload.appId)}/blocks/properties/${payload.propertyId}`,
5934
+ getConsoleClientDefaultConfig(authorization)
5562
5935
  );
5563
5936
  });
5564
5937
  }
5565
5938
  };
5566
5939
 
5567
- // src/apis/platform/adapter/app/blocks/widgets/api.ts
5568
- var platformAdapterAppWidgetsApi = {
5569
- widget: platformAdapterAppWidgetApi,
5940
+ // src/apis/platform/console/app/blocks/properties/api.ts
5941
+ var platformConsoleAppPropertiesApi = {
5942
+ property: platformConsoleAppPropertyApi,
5570
5943
  get(appId, authorization) {
5571
5944
  return __async(this, null, function* () {
5572
- return adapterClientInstance.get(
5573
- `/console/app/${encodeURIComponent(appId)}/blocks/widgets`,
5574
- getAdapterClientDefaultConfig(authorization)
5945
+ return consoleClientInstance.get(
5946
+ `/app/${encodeURIComponent(appId)}/blocks/properties`,
5947
+ getConsoleClientDefaultConfig(authorization)
5575
5948
  );
5576
5949
  });
5577
5950
  },
5578
5951
  upsert(payload, authorization) {
5579
5952
  return __async(this, null, function* () {
5580
- return adapterClientInstance.post(
5581
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
5953
+ return consoleClientInstance.post(
5954
+ `/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5582
5955
  payload,
5583
- getAdapterClientDefaultConfig(authorization)
5956
+ getConsoleClientDefaultConfig(authorization)
5584
5957
  );
5585
5958
  });
5586
5959
  },
5587
5960
  remove(payload, authorization) {
5588
5961
  return __async(this, null, function* () {
5589
- return adapterClientInstance.delete(
5590
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
5591
- getAdapterClientDefaultConfig(authorization)
5962
+ return consoleClientInstance.delete(
5963
+ `/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5964
+ getConsoleClientDefaultConfig(authorization)
5592
5965
  );
5593
5966
  });
5594
5967
  }
5595
5968
  };
5596
5969
 
5597
- // src/apis/platform/adapter/app/blocks/api.ts
5598
- var platformAdapterAppBlocksApi = {
5599
- authorization: platformAdapterAppAuthorizationApi,
5600
- monetization: platformAdapterAppMonetizationApi,
5601
- repository: platformAdapterAppRepositoryApi,
5602
- deployment: platformAdapterAppDeploymentApi,
5603
- storage: platformAdapterAppStorageApi,
5604
- properties: platformAdapterAppPropertiesApi,
5605
- widgets: platformAdapterAppWidgetsApi
5606
- };
5607
-
5608
- // src/apis/platform/adapter/app/templates/api.ts
5609
- var platformAdapterAppTemplatesApi = {
5610
- getTemplates(authorization) {
5970
+ // src/apis/platform/console/app/blocks/repository/api.ts
5971
+ var platformConsoleAppRepositoryApi = {
5972
+ getAggregate(appId, authorization) {
5611
5973
  return __async(this, null, function* () {
5612
- return adapterClientInstance.get(
5613
- "/console/app/templates",
5614
- getAdapterClientDefaultConfig(authorization)
5974
+ return consoleClientInstance.get(
5975
+ `/app/${encodeURIComponent(appId)}/blocks/repository/aggregate`,
5976
+ getConsoleClientDefaultConfig(authorization)
5615
5977
  );
5616
5978
  });
5617
5979
  },
5618
- getRepositoryTemplates(authorization) {
5619
- return __async(this, null, function* () {
5620
- return adapterClientInstance.get(
5621
- "/console/app/templates/repository",
5622
- getAdapterClientDefaultConfig(authorization)
5623
- );
5624
- });
5625
- }
5626
- };
5627
-
5628
- // src/apis/platform/adapter/app/variables/api.ts
5629
- var platformAdapterAppVariablesApi = {
5630
- getVariables(appId, decrypted, authorization) {
5980
+ get(appId, authorization) {
5631
5981
  return __async(this, null, function* () {
5632
- const response = yield adapterClientInstance.get(
5633
- `/console/app/${encodeURIComponent(appId)}/variables`,
5634
- __spreadValues({
5635
- params: {
5636
- decrypted
5637
- }
5638
- }, getAdapterClientDefaultConfig(authorization))
5982
+ return consoleClientInstance.get(
5983
+ `/app/${encodeURIComponent(appId)}/blocks/repository`,
5984
+ getConsoleClientDefaultConfig(authorization)
5639
5985
  );
5640
- return response.data;
5641
5986
  });
5642
5987
  },
5643
- getVariable(appId, key, authorization) {
5644
- return __async(this, null, function* () {
5645
- const response = yield adapterClientInstance.get(
5646
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5647
- key
5648
- )}`,
5649
- getAdapterClientDefaultConfig(authorization)
5650
- );
5651
- return response.data;
5652
- });
5653
- },
5654
- syncVariable(appId, key, payload, authorization) {
5988
+ link(payload, authorization) {
5655
5989
  return __async(this, null, function* () {
5656
- yield adapterClientInstance.post(
5657
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5658
- key
5659
- )}/sync`,
5990
+ return consoleClientInstance.put(
5991
+ `/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
5660
5992
  payload,
5661
- getAdapterClientDefaultConfig(authorization)
5993
+ getConsoleClientDefaultConfig(authorization)
5662
5994
  );
5663
5995
  });
5664
5996
  },
5665
- createVariable(appId, data, authorization) {
5997
+ unlink(payload, authorization) {
5666
5998
  return __async(this, null, function* () {
5667
- yield adapterClientInstance.post(
5668
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5669
- data.key
5670
- )}`,
5671
- data,
5672
- getAdapterClientDefaultConfig(authorization)
5999
+ return consoleClientInstance.delete(
6000
+ `/app/${encodeURIComponent(
6001
+ payload.appId
6002
+ )}/blocks/repository?${new URLSearchParams(
6003
+ payload
6004
+ ).toString()}`,
6005
+ getConsoleClientDefaultConfig(authorization)
5673
6006
  );
5674
6007
  });
5675
6008
  },
5676
- editVariable(appId, data, authorization) {
6009
+ upsert(payload, authorization) {
5677
6010
  return __async(this, null, function* () {
5678
- yield adapterClientInstance.post(
5679
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5680
- data.key
5681
- )}/edit`,
5682
- data,
5683
- getAdapterClientDefaultConfig(authorization)
6011
+ return consoleClientInstance.patch(
6012
+ `/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
6013
+ payload,
6014
+ getConsoleClientDefaultConfig(authorization)
5684
6015
  );
5685
6016
  });
5686
6017
  },
5687
- deleteVariable(appId, key) {
6018
+ seed(payload, authorization) {
5688
6019
  return __async(this, null, function* () {
5689
- yield adapterClientInstance.delete(
5690
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5691
- key
5692
- )}`
6020
+ return consoleClientInstance.post(
6021
+ `/app/${encodeURIComponent(payload.appId)}/blocks/repository/seed`,
6022
+ payload,
6023
+ getConsoleClientDefaultConfig(authorization)
5693
6024
  );
5694
6025
  });
5695
6026
  }
5696
6027
  };
5697
6028
 
5698
- // src/apis/platform/adapter/app/api.ts
5699
- var platformAdapterAppApi = {
5700
- blocks: platformAdapterAppBlocksApi,
5701
- variables: platformAdapterAppVariablesApi,
5702
- templates: platformAdapterAppTemplatesApi,
5703
- push(payload, authorization) {
6029
+ // src/apis/platform/console/app/blocks/storage/api.ts
6030
+ var platformConsoleAppStorageApi = {
6031
+ getAggregate(appId, authorization) {
5704
6032
  return __async(this, null, function* () {
5705
- return adapterClientInstance.post(
5706
- `/console/app${payload.manifest.id ? `/${encodeURIComponent(payload.manifest.id)}` : ""}`,
5707
- payload,
5708
- getAdapterClientDefaultConfig(authorization)
6033
+ return consoleClientInstance.get(
6034
+ `/app/${encodeURIComponent(appId)}/blocks/storage/aggregate`,
6035
+ getConsoleClientDefaultConfig(authorization)
5709
6036
  );
5710
6037
  });
5711
6038
  },
5712
- pull(appId, authorization) {
6039
+ get(appId, authorization) {
5713
6040
  return __async(this, null, function* () {
5714
- return adapterClientInstance.get(
5715
- `/console/app/${encodeURIComponent(appId)}`,
5716
- getAdapterClientDefaultConfig(authorization)
6041
+ return consoleClientInstance.get(
6042
+ `/app/${encodeURIComponent(appId)}/blocks/storage`,
6043
+ getConsoleClientDefaultConfig(authorization)
5717
6044
  );
5718
6045
  });
5719
6046
  },
5720
- verify(payload, authorization) {
6047
+ link(payload, authorization) {
5721
6048
  return __async(this, null, function* () {
5722
- return adapterClientInstance.post(
5723
- `/console/app/${encodeURIComponent(payload.appId)}/verify`,
6049
+ return consoleClientInstance.put(
6050
+ `/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
5724
6051
  payload,
5725
- getAdapterClientDefaultConfig(authorization)
6052
+ getConsoleClientDefaultConfig(authorization)
5726
6053
  );
5727
6054
  });
5728
6055
  },
5729
- status(sagaId, authorization) {
6056
+ unlink(payload, authorization) {
5730
6057
  return __async(this, null, function* () {
5731
- return adapterClientInstance.get(
5732
- "/console/app/status",
5733
- __spreadValues({
5734
- params: {
5735
- sagaId
5736
- }
5737
- }, getAdapterClientDefaultConfig(authorization))
5738
- );
5739
- });
5740
- }
5741
- };
5742
-
5743
- // src/apis/platform/adapter/integrations/bigcommerce/api.ts
5744
- var platformAdapterBigCommerceApi = {
5745
- events: {
5746
- subscribe(payload, authorization) {
5747
- return __async(this, null, function* () {
5748
- yield adapterClientInstance.post(
5749
- "/integrations/bigcommerce/events/subscribe",
5750
- payload,
5751
- getBigCommerceClientConfig(authorization)
5752
- );
5753
- });
5754
- },
5755
- unsubscribe(payload, authorization) {
5756
- return __async(this, null, function* () {
5757
- yield adapterClientInstance.post(
5758
- "/integrations/bigcommerce/events/unsubscribe",
5759
- payload,
5760
- getBigCommerceClientConfig(authorization)
5761
- );
5762
- });
5763
- }
5764
- }
5765
- };
5766
-
5767
- // src/apis/platform/adapter/integrations/hubspot/api.ts
5768
- var platformAdapterHubspotApi = {
5769
- events: {
5770
- subscribe(payload, authorization) {
5771
- return __async(this, null, function* () {
5772
- yield adapterClientInstance.post(
5773
- "/integrations/hubspot/events/subscribe",
5774
- payload,
5775
- getHubspotClientConfig(authorization)
5776
- );
5777
- });
5778
- },
5779
- unsubscribe(payload, authorization) {
5780
- return __async(this, null, function* () {
5781
- yield adapterClientInstance.post(
5782
- "/integrations/hubspot/events/unsubscribe",
5783
- payload,
5784
- getHubspotClientConfig(authorization)
5785
- );
5786
- });
5787
- }
5788
- }
5789
- };
5790
-
5791
- // src/apis/platform/adapter/integrations/mailchimp/api.ts
5792
- var platformAdapterMailchimpApi = {
5793
- events: {
5794
- subscribe(payload, authorization) {
5795
- return __async(this, null, function* () {
5796
- yield adapterClientInstance.post(
5797
- "/integrations/mailchimp/events/subscribe",
5798
- payload,
5799
- getMailchimpClientConfig(authorization)
5800
- );
5801
- });
5802
- },
5803
- unsubscribe(payload, authorization) {
5804
- return __async(this, null, function* () {
5805
- yield adapterClientInstance.post(
5806
- "/integrations/mailchimp/events/unsubscribe",
5807
- payload,
5808
- getMailchimpClientConfig(authorization)
5809
- );
5810
- });
5811
- }
5812
- }
5813
- };
5814
-
5815
- // src/apis/platform/adapter/integrations/shopify/api.ts
5816
- var platformAdapterShopifyApi = {
5817
- events: {
5818
- subscribe(payload, authorization) {
5819
- return __async(this, null, function* () {
5820
- yield adapterClientInstance.post(
5821
- "/integrations/shopify/events/subscribe",
5822
- payload,
5823
- getShopifyClientConfig(authorization)
5824
- );
5825
- });
5826
- },
5827
- unsubscribe(payload, authorization) {
5828
- return __async(this, null, function* () {
5829
- yield adapterClientInstance.post(
5830
- "/integrations/shopify/events/unsubscribe",
5831
- payload,
5832
- getShopifyClientConfig(authorization)
5833
- );
5834
- });
5835
- }
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
+ });
5836
6076
  }
5837
6077
  };
5838
6078
 
5839
- // src/apis/platform/adapter/integrations/slack/api.ts
5840
- var platformAdapterSlackApi = {
5841
- events: {
5842
- subscribe(payload, authorization) {
5843
- return __async(this, null, function* () {
5844
- yield adapterClientInstance.post(
5845
- "/integrations/slack/events/subscribe",
5846
- payload,
5847
- getSlackClientConfig(authorization)
5848
- );
5849
- });
5850
- },
5851
- unsubscribe(payload, authorization) {
5852
- return __async(this, null, function* () {
5853
- yield adapterClientInstance.post(
5854
- "/integrations/slack/events/unsubscribe",
5855
- payload,
5856
- getSlackClientConfig(authorization)
5857
- );
5858
- });
5859
- }
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
+ });
5860
6111
  }
5861
6112
  };
5862
6113
 
5863
- // src/apis/platform/adapter/integrations/text/api.ts
5864
- var platformAdapterTextApi = {
5865
- events: {
5866
- subscribe(payload, authorization) {
5867
- return __async(this, null, function* () {
5868
- yield adapterClientInstance.post(
5869
- "/integrations/text/events/subscribe",
5870
- payload,
5871
- getTextClientConfig(authorization)
5872
- );
5873
- });
5874
- },
5875
- unsubscribe(payload, authorization) {
5876
- return __async(this, null, function* () {
5877
- yield adapterClientInstance.post(
5878
- "/integrations/text/events/unsubscribe",
5879
- payload,
5880
- getTextClientConfig(authorization)
5881
- );
5882
- });
5883
- }
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
+ });
5884
6141
  }
5885
6142
  };
5886
6143
 
5887
- // src/apis/platform/adapter/integrations/api.ts
5888
- var platformAdapterIntegrationsApi = {
5889
- mailchimp: platformAdapterMailchimpApi,
5890
- shopify: platformAdapterShopifyApi,
5891
- hubspot: platformAdapterHubspotApi,
5892
- slack: platformAdapterSlackApi,
5893
- bigcommerce: platformAdapterBigCommerceApi,
5894
- 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
5895
6153
  };
5896
6154
 
5897
- // src/apis/platform/adapter/api.ts
5898
- var platformAdapterApi = {
5899
- app: platformAdapterAppApi,
5900
- integrations: platformAdapterIntegrationsApi,
5901
- log(payload, authorization) {
6155
+ // src/apis/platform/console/app/templates/api.ts
6156
+ var platformConsoleAppTemplatesApi = {
6157
+ getTemplates(authorization) {
5902
6158
  return __async(this, null, function* () {
5903
- return adapterClientInstance.post(
5904
- "/log",
5905
- payload,
5906
- 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)
5907
6170
  );
5908
6171
  });
5909
6172
  }
5910
6173
  };
5911
6174
 
5912
- // src/apis/platform/billing/account/api.ts
5913
- var platformBillingAccountApi = {
5914
- getAccount(authorization) {
6175
+ // src/apis/platform/console/app/variables/api.ts
6176
+ var platformConsoleAppVariablesApi = {
6177
+ getVariables(appId, decrypted, authorization) {
5915
6178
  return __async(this, null, function* () {
5916
- try {
5917
- return yield billingClientInstance.get(
5918
- "/v3/account",
5919
- getBillingClientConfig(authorization)
5920
- );
5921
- } catch (error) {
5922
- if (error instanceof Error) {
5923
- throw new Error(`Account couldn't be fetched. [${error.message}]`);
5924
- } else {
5925
- throw error;
5926
- }
5927
- }
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;
5928
6188
  });
5929
6189
  },
5930
- getAccountInfo(product, authorization) {
6190
+ getVariable(appId, key, authorization) {
5931
6191
  return __async(this, null, function* () {
5932
- try {
5933
- return yield billingClientInstance.get(
5934
- `/v3/account/${encodeURIComponent(product)}/billing_info`,
5935
- getBillingClientConfig(authorization)
5936
- );
5937
- } catch (error) {
5938
- if (error instanceof Error) {
5939
- throw new Error(
5940
- `Account billing info couldn't be fetched. [${error.message}]`
5941
- );
5942
- } else {
5943
- throw error;
5944
- }
5945
- }
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
+ );
5946
6237
  });
5947
6238
  }
5948
6239
  };
5949
6240
 
5950
- // src/apis/platform/billing/invoices/api.ts
5951
- var platformBillingInvoicesApi = {
5952
- 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) {
5953
6247
  return __async(this, null, function* () {
5954
- try {
5955
- return yield billingClientInstance.get(
5956
- `/v2/invoices/${encodeURIComponent(product)}`,
5957
- getBillingClientConfig(authorization)
5958
- );
5959
- } catch (error) {
5960
- if (error instanceof Error) {
5961
- throw new Error(`Invoices couldn't be fetched. [${error.message}]`);
5962
- } else {
5963
- throw error;
5964
- }
5965
- }
6248
+ return consoleClientInstance.post(
6249
+ `/app${payload.manifest.id ? `/${encodeURIComponent(payload.manifest.id)}` : ""}`,
6250
+ payload,
6251
+ getConsoleClientDefaultConfig(authorization)
6252
+ );
5966
6253
  });
5967
6254
  },
5968
- downloadInvoices(number, authorization) {
6255
+ pull(appId, authorization) {
5969
6256
  return __async(this, null, function* () {
5970
- try {
5971
- const response = yield billingClientInstance.request(__spreadValues({
5972
- url: `https://api.labs.livechatinc.com/v2/invoices/${encodeURIComponent(
5973
- number
5974
- )}`,
5975
- data: new URLSearchParams({
5976
- _method: "GET"
5977
- //gave the values directly for testing
5978
- }),
5979
- responseType: "blob"
5980
- }, getBillingClientConfig(authorization)));
5981
- const href = URL.createObjectURL(response.data);
5982
- const link = document.createElement("a");
5983
- link.href = href;
5984
- link.setAttribute("download", `invoice-${number}.pdf`);
5985
- document.body.appendChild(link);
5986
- link.click();
5987
- document.body.removeChild(link);
5988
- URL.revokeObjectURL(href);
5989
- } catch (error) {
5990
- if (error instanceof Error) {
5991
- throw new Error(`Invoice couldn't be downloaded. [${error.message}]`);
5992
- } else {
5993
- throw error;
5994
- }
5995
- }
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
+ );
5996
6282
  });
5997
6283
  }
5998
6284
  };
5999
6285
 
6000
- // src/apis/platform/billing/api.ts
6001
- var platformBillingApi = {
6002
- account: platformBillingAccountApi,
6003
- 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
+ }
6004
6298
  };
6005
6299
 
6006
6300
  // src/constants/app/templates/repository.ts
@@ -7519,6 +7813,7 @@ var platformApi = {
7519
7813
  accounts: platformAccountsApi,
7520
7814
  billing: platformBillingApi,
7521
7815
  adapter: platformAdapterApi,
7816
+ console: platformConsoleApi,
7522
7817
  dps: platformDpsApi
7523
7818
  };
7524
7819
 
@@ -8219,7 +8514,7 @@ var api2 = {
8219
8514
  isInitialized: false
8220
8515
  };
8221
8516
  function initApi(config, tokens) {
8222
- 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;
8223
8518
  initPlatformAccountsClient(
8224
8519
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
8225
8520
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.token
@@ -8240,19 +8535,29 @@ function initApi(config, tokens) {
8240
8535
  slack: tokens.slack
8241
8536
  } : void 0
8242
8537
  );
8243
- initLiveChatClient((_h = config.urls.products) == null ? void 0 : _h.livechat, (_i = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _i.token);
8244
- initHelpDeskClient((_j = config.urls.products) == null ? void 0 : _j.helpdesk, (_k = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _k.token);
8245
- initTextClient((_l = config.urls.integrations) == null ? void 0 : _l.text, (_m = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _m.token);
8246
- initGithubClient((_n = tokens == null ? void 0 : tokens.github) == null ? void 0 : _n.appToken);
8247
- initNetlifyClient((_o = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _o.token);
8248
- initVercelClient((_p = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _p.token);
8249
- initNeonClient((_q = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _q.token);
8250
- initPlanetScaleClient((_r = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _r.token);
8251
- 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);
8252
- 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);
8253
- 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);
8254
- initHubspotClient((_y = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _y.token);
8255
- 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);
8256
8561
  api2.isInitialized = true;
8257
8562
  }
8258
8563
 
@@ -8312,6 +8617,7 @@ export {
8312
8617
  BigCommerceApiError,
8313
8618
  BigCommerceEventNames,
8314
8619
  BigCommerceWebhookScopes,
8620
+ ConsoleApiError,
8315
8621
  DpsApiError,
8316
8622
  HelpDeskApiError,
8317
8623
  HelpDeskWebhookEventType,
@@ -8332,6 +8638,7 @@ export {
8332
8638
  SlackApiError,
8333
8639
  SlackEventNames,
8334
8640
  SlackEventTypes,
8641
+ SlackMessageEventSubTypes,
8335
8642
  TextApiError,
8336
8643
  TextHelpDeskEventNames,
8337
8644
  TextLivechatEventNames,
@@ -8352,31 +8659,43 @@ export {
8352
8659
  bigcommerceEventsZods,
8353
8660
  billingClientInstance,
8354
8661
  buildUrlFromSegments,
8662
+ consoleClientInstance,
8355
8663
  dpsClientInstance,
8356
8664
  getAdapterClientConfig,
8357
8665
  getAdapterClientDefaultConfig,
8358
8666
  getAppAutoReviewPayload,
8667
+ getBigCommerceClientAuthorization,
8359
8668
  getBigCommerceClientConfig,
8360
8669
  getBigCommerceClientUrl,
8361
8670
  getBillingClientConfig,
8671
+ getConsoleClientConfig,
8672
+ getConsoleClientDefaultConfig,
8362
8673
  getDpsClientConfig,
8363
8674
  getEmptyAppAutoReview,
8675
+ getGitHubClientAuthorization,
8364
8676
  getGithubClientConfig,
8365
8677
  getHelpDeskClientConfig,
8678
+ getHubspotClientAuthorization,
8366
8679
  getHubspotClientConfig,
8367
8680
  getIntegrationFlowUrl,
8368
8681
  getIntegrationFlowUrlForRedirection,
8369
8682
  getLiveChatClientConfig,
8683
+ getMailchimpClientAuthorization,
8370
8684
  getMailchimpClientConfig,
8371
8685
  getMailchimpClientUrl,
8372
8686
  getNeonClientConfig,
8687
+ getNetlifyClientAuthorization,
8373
8688
  getNetlifyClientConfig,
8374
8689
  getPlanetScaleClientConfig,
8375
- getRegion2 as getRegion,
8690
+ getRegion3 as getRegion,
8691
+ getShopifyClientAuthorization,
8376
8692
  getShopifyClientConfig,
8377
8693
  getShopifyClientUrl,
8694
+ getSlackClientAuthorization,
8378
8695
  getSlackClientConfig,
8696
+ getTextClientAuthorization,
8379
8697
  getTextClientConfig,
8698
+ getVercelClientAuthorization,
8380
8699
  getVercelClientConfig,
8381
8700
  githubClientInstance,
8382
8701
  helpdeskClientInstance,
@@ -8386,6 +8705,7 @@ export {
8386
8705
  initApi,
8387
8706
  initBigCommerceClient,
8388
8707
  initBillingClient,
8708
+ initConsoleClient,
8389
8709
  initDpsClient,
8390
8710
  initGithubClient,
8391
8711
  initHelpDeskClient,
@@ -8418,6 +8738,7 @@ export {
8418
8738
  textLivechatEventsZods,
8419
8739
  updateAdapterClient,
8420
8740
  updateBigCommerceClient,
8741
+ updateConsoleClient,
8421
8742
  updateGithubClient,
8422
8743
  updateHubspotClient,
8423
8744
  updateMailchimpClient,