@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.js CHANGED
@@ -75,7 +75,9 @@ __export(src_exports, {
75
75
  BigCommerceApiError: () => BigCommerceApiError,
76
76
  BigCommerceEventNames: () => BigCommerceEventNames,
77
77
  BigCommerceWebhookScopes: () => BigCommerceWebhookScopes,
78
+ ConsoleApiError: () => ConsoleApiError,
78
79
  DpsApiError: () => DpsApiError,
80
+ GitHubWebhookActions: () => GitHubWebhookActions,
79
81
  HelpDeskApiError: () => HelpDeskApiError,
80
82
  HelpDeskWebhookEventType: () => HelpDeskWebhookEventType,
81
83
  HubSpotWebhookEventTypes: () => HubSpotWebhookEventTypes,
@@ -116,31 +118,43 @@ __export(src_exports, {
116
118
  bigcommerceEventsZods: () => bigcommerceEventsZods,
117
119
  billingClientInstance: () => billingClientInstance,
118
120
  buildUrlFromSegments: () => buildUrlFromSegments,
121
+ consoleClientInstance: () => consoleClientInstance,
119
122
  dpsClientInstance: () => dpsClientInstance,
120
123
  getAdapterClientConfig: () => getAdapterClientConfig,
121
124
  getAdapterClientDefaultConfig: () => getAdapterClientDefaultConfig,
122
125
  getAppAutoReviewPayload: () => getAppAutoReviewPayload,
126
+ getBigCommerceClientAuthorization: () => getBigCommerceClientAuthorization,
123
127
  getBigCommerceClientConfig: () => getBigCommerceClientConfig,
124
128
  getBigCommerceClientUrl: () => getBigCommerceClientUrl,
125
129
  getBillingClientConfig: () => getBillingClientConfig,
130
+ getConsoleClientConfig: () => getConsoleClientConfig,
131
+ getConsoleClientDefaultConfig: () => getConsoleClientDefaultConfig,
126
132
  getDpsClientConfig: () => getDpsClientConfig,
127
133
  getEmptyAppAutoReview: () => getEmptyAppAutoReview,
134
+ getGitHubClientAuthorization: () => getGitHubClientAuthorization,
128
135
  getGithubClientConfig: () => getGithubClientConfig,
129
136
  getHelpDeskClientConfig: () => getHelpDeskClientConfig,
137
+ getHubspotClientAuthorization: () => getHubspotClientAuthorization,
130
138
  getHubspotClientConfig: () => getHubspotClientConfig,
131
139
  getIntegrationFlowUrl: () => getIntegrationFlowUrl,
132
140
  getIntegrationFlowUrlForRedirection: () => getIntegrationFlowUrlForRedirection,
133
141
  getLiveChatClientConfig: () => getLiveChatClientConfig,
142
+ getMailchimpClientAuthorization: () => getMailchimpClientAuthorization,
134
143
  getMailchimpClientConfig: () => getMailchimpClientConfig,
135
144
  getMailchimpClientUrl: () => getMailchimpClientUrl,
136
145
  getNeonClientConfig: () => getNeonClientConfig,
146
+ getNetlifyClientAuthorization: () => getNetlifyClientAuthorization,
137
147
  getNetlifyClientConfig: () => getNetlifyClientConfig,
138
148
  getPlanetScaleClientConfig: () => getPlanetScaleClientConfig,
139
- getRegion: () => getRegion2,
149
+ getRegion: () => getRegion3,
150
+ getShopifyClientAuthorization: () => getShopifyClientAuthorization,
140
151
  getShopifyClientConfig: () => getShopifyClientConfig,
141
152
  getShopifyClientUrl: () => getShopifyClientUrl,
153
+ getSlackClientAuthorization: () => getSlackClientAuthorization,
142
154
  getSlackClientConfig: () => getSlackClientConfig,
155
+ getTextClientAuthorization: () => getTextClientAuthorization,
143
156
  getTextClientConfig: () => getTextClientConfig,
157
+ getVercelClientAuthorization: () => getVercelClientAuthorization,
144
158
  getVercelClientConfig: () => getVercelClientConfig,
145
159
  githubClientInstance: () => githubClientInstance,
146
160
  helpdeskClientInstance: () => helpdeskClientInstance,
@@ -150,6 +164,7 @@ __export(src_exports, {
150
164
  initApi: () => initApi,
151
165
  initBigCommerceClient: () => initBigCommerceClient,
152
166
  initBillingClient: () => initBillingClient,
167
+ initConsoleClient: () => initConsoleClient,
153
168
  initDpsClient: () => initDpsClient,
154
169
  initGithubClient: () => initGithubClient,
155
170
  initHelpDeskClient: () => initHelpDeskClient,
@@ -182,6 +197,7 @@ __export(src_exports, {
182
197
  textLivechatEventsZods: () => textLivechatEventsZods,
183
198
  updateAdapterClient: () => updateAdapterClient,
184
199
  updateBigCommerceClient: () => updateBigCommerceClient,
200
+ updateConsoleClient: () => updateConsoleClient,
185
201
  updateGithubClient: () => updateGithubClient,
186
202
  updateHubspotClient: () => updateHubspotClient,
187
203
  updateMailchimpClient: () => updateMailchimpClient,
@@ -313,6 +329,18 @@ var UnauthorizeApiError = class extends Error {
313
329
  };
314
330
 
315
331
  // src/apis/integrations/bigcommerce/instance.ts
332
+ function getBigCommerceClientAuthorization(req, headerPrefix = "x-adapter-bigcommerce") {
333
+ if (req.headers instanceof Headers) {
334
+ return {
335
+ shop: req.headers.get(`${headerPrefix}-shop`),
336
+ token: req.headers.get(`${headerPrefix}-token`)
337
+ };
338
+ }
339
+ return {
340
+ shop: req.headers[`${headerPrefix}-shop`],
341
+ token: req.headers[`${headerPrefix}-token`]
342
+ };
343
+ }
316
344
  var BigCommerceApiError = class extends ApiErrorBase {
317
345
  constructor() {
318
346
  super(...arguments);
@@ -451,6 +479,18 @@ var import_axios5 = __toESM(require("axios"));
451
479
 
452
480
  // src/apis/integrations/github/instance.ts
453
481
  var import_axios3 = __toESM(require("axios"));
482
+ function getGitHubClientAuthorization(req, headerPrefix = "x-adapter-github") {
483
+ if (req.headers instanceof Headers) {
484
+ return {
485
+ appToken: req.headers.get(`${headerPrefix}-app-token`),
486
+ oauthToken: req.headers.get(`${headerPrefix}-oauth-token`)
487
+ };
488
+ }
489
+ return {
490
+ appToken: req.headers[`${headerPrefix}-app-token`],
491
+ oauthToken: req.headers[`${headerPrefix}-oauth-token`]
492
+ };
493
+ }
454
494
  var githubClientInstance = import_axios3.default.create({
455
495
  baseURL: "https://api.github.com",
456
496
  headers: {
@@ -904,6 +944,16 @@ var gitHubApi = {
904
944
 
905
945
  // src/apis/integrations/hubspot/instance.ts
906
946
  var import_axios6 = __toESM(require("axios"));
947
+ function getHubspotClientAuthorization(req, headerPrefix = "x-adapter-hubspot") {
948
+ if (req.headers instanceof Headers) {
949
+ return {
950
+ token: req.headers.get(`${headerPrefix}-token`)
951
+ };
952
+ }
953
+ return {
954
+ token: req.headers[`${headerPrefix}-token`]
955
+ };
956
+ }
907
957
  var HubspotApiError = class extends ApiErrorBase {
908
958
  constructor() {
909
959
  super(...arguments);
@@ -1125,6 +1175,18 @@ var import_axios8 = __toESM(require("axios"));
1125
1175
 
1126
1176
  // src/apis/integrations/mailchimp/instance.ts
1127
1177
  var import_axios7 = __toESM(require("axios"));
1178
+ function getMailchimpClientAuthorization(req, headerPrefix = "x-adapter-mailchimp") {
1179
+ if (req.headers instanceof Headers) {
1180
+ return {
1181
+ server: req.headers.get(`${headerPrefix}-server`),
1182
+ token: req.headers.get(`${headerPrefix}-token`)
1183
+ };
1184
+ }
1185
+ return {
1186
+ server: req.headers[`${headerPrefix}-server`],
1187
+ token: req.headers[`${headerPrefix}-token`]
1188
+ };
1189
+ }
1128
1190
  var MailchimpApiError = class extends ApiErrorBase {
1129
1191
  constructor() {
1130
1192
  super(...arguments);
@@ -1622,6 +1684,16 @@ var import_axios12 = require("axios");
1622
1684
 
1623
1685
  // src/apis/integrations/netlify/instance.ts
1624
1686
  var import_axios11 = __toESM(require("axios"));
1687
+ function getNetlifyClientAuthorization(req, headerPrefix = "x-adapter-netlify-token") {
1688
+ if (req.headers instanceof Headers) {
1689
+ return {
1690
+ token: req.headers.get(`${headerPrefix}-token`)
1691
+ };
1692
+ }
1693
+ return {
1694
+ token: req.headers[`${headerPrefix}-token`]
1695
+ };
1696
+ }
1625
1697
  var netlifyClientInstance = import_axios11.default.create({
1626
1698
  baseURL: "https://api.netlify.com/api/v1",
1627
1699
  headers: {
@@ -2385,6 +2457,18 @@ var import_axios18 = __toESM(require("axios"));
2385
2457
 
2386
2458
  // src/apis/integrations/shopify/instance.ts
2387
2459
  var import_axios17 = __toESM(require("axios"));
2460
+ function getShopifyClientAuthorization(req, headerPrefix = "x-adapter-shopify") {
2461
+ if (req.headers instanceof Headers) {
2462
+ return {
2463
+ shop: req.headers.get(`${headerPrefix}-shop`),
2464
+ token: req.headers.get(`${headerPrefix}-token`)
2465
+ };
2466
+ }
2467
+ return {
2468
+ shop: req.headers[`${headerPrefix}-shop`],
2469
+ token: req.headers[`${headerPrefix}-token`]
2470
+ };
2471
+ }
2388
2472
  var ShopifyApiError = class extends ApiErrorBase {
2389
2473
  constructor() {
2390
2474
  super(...arguments);
@@ -2527,6 +2611,16 @@ var SlackApiError = class extends ApiErrorBase {
2527
2611
  this.name = "slack";
2528
2612
  }
2529
2613
  };
2614
+ function getSlackClientAuthorization(req, headerPrefix = "x-adapter-slack") {
2615
+ if (req.headers instanceof Headers) {
2616
+ return {
2617
+ token: req.headers.get(`${headerPrefix}-token`)
2618
+ };
2619
+ }
2620
+ return {
2621
+ token: req.headers[`${headerPrefix}-token`]
2622
+ };
2623
+ }
2530
2624
  var slackClientInstance = import_axios19.default.create({
2531
2625
  baseURL: "https://slack.com/api",
2532
2626
  headers: {
@@ -2631,6 +2725,18 @@ var slackApi = {
2631
2725
 
2632
2726
  // src/apis/integrations/text/instance.ts
2633
2727
  var import_axios20 = __toESM(require("axios"));
2728
+ function getTextClientAuthorization(req, headerPrefix = "x-adapter-text") {
2729
+ if (req.headers instanceof Headers) {
2730
+ return {
2731
+ token: req.headers.get(`${headerPrefix}-token`),
2732
+ tokenType: "Bearer"
2733
+ };
2734
+ }
2735
+ return {
2736
+ token: req.headers[`${headerPrefix}-token`],
2737
+ tokenType: "Bearer"
2738
+ };
2739
+ }
2634
2740
  var TextApiError = class extends ApiErrorBase {
2635
2741
  constructor() {
2636
2742
  super(...arguments);
@@ -2832,6 +2938,13 @@ var BigCommerceWebhookScopes = /* @__PURE__ */ ((BigCommerceWebhookScopes2) => {
2832
2938
  return BigCommerceWebhookScopes2;
2833
2939
  })(BigCommerceWebhookScopes || {});
2834
2940
 
2941
+ // src/apis/integrations/github/webhooks/_contracts/dtos/webhooks.ts
2942
+ var GitHubWebhookActions = /* @__PURE__ */ ((GitHubWebhookActions2) => {
2943
+ GitHubWebhookActions2["Unknown"] = "unknown";
2944
+ GitHubWebhookActions2["Deleted"] = "deleted";
2945
+ return GitHubWebhookActions2;
2946
+ })(GitHubWebhookActions || {});
2947
+
2835
2948
  // src/apis/integrations/hubspot/webhooks/_contracts/dtos/webhooks.ts
2836
2949
  var HubSpotWebhookEventTypes = /* @__PURE__ */ ((HubSpotWebhookEventTypes2) => {
2837
2950
  HubSpotWebhookEventTypes2["ContactCreation"] = "contact.creation";
@@ -2907,6 +3020,16 @@ var WorkflowExecutionStatus = /* @__PURE__ */ ((WorkflowExecutionStatus2) => {
2907
3020
 
2908
3021
  // src/apis/integrations/vercel/instance.ts
2909
3022
  var import_axios21 = __toESM(require("axios"));
3023
+ function getVercelClientAuthorization(req, headerPrefix = "x-adapter-vercel") {
3024
+ if (req.headers instanceof Headers) {
3025
+ return {
3026
+ token: req.headers.get(`${headerPrefix}-token`)
3027
+ };
3028
+ }
3029
+ return {
3030
+ token: req.headers[`${headerPrefix}-token`]
3031
+ };
3032
+ }
2910
3033
  var vercelClientInstance = import_axios21.default.create({
2911
3034
  baseURL: "https://api.vercel.com"
2912
3035
  });
@@ -3298,18 +3421,14 @@ var bigcommerceEventsZods = {
3298
3421
  get unsubscribe() {
3299
3422
  return this.source.and(
3300
3423
  import_zod.z.object({
3301
- event: import_zod.z.object({
3302
- name: this.eventName
3303
- })
3424
+ event: this.event
3304
3425
  })
3305
3426
  );
3306
3427
  },
3307
3428
  get unsubscribeContent() {
3308
3429
  return import_zod.z.object({
3309
3430
  provider: this.provider,
3310
- event: import_zod.z.object({
3311
- name: this.eventName
3312
- })
3431
+ event: this.event
3313
3432
  });
3314
3433
  }
3315
3434
  };
@@ -3362,18 +3481,14 @@ var hubspotEventsZods = {
3362
3481
  get unsubscribe() {
3363
3482
  return this.source.and(
3364
3483
  import_zod2.z.object({
3365
- event: import_zod2.z.object({
3366
- name: this.eventName
3367
- })
3484
+ event: this.event
3368
3485
  })
3369
3486
  );
3370
3487
  },
3371
3488
  get unsubscribeContent() {
3372
3489
  return import_zod2.z.object({
3373
3490
  provider: this.provider,
3374
- event: import_zod2.z.object({
3375
- name: this.eventName
3376
- })
3491
+ event: this.event
3377
3492
  });
3378
3493
  }
3379
3494
  };
@@ -3438,10 +3553,7 @@ var mailchimpEventsZods = {
3438
3553
  get unsubscribeContent() {
3439
3554
  return import_zod3.z.object({
3440
3555
  provider: this.provider,
3441
- event: import_zod3.z.object({
3442
- listId: import_zod3.z.string(),
3443
- name: this.eventName
3444
- })
3556
+ event: this.event
3445
3557
  });
3446
3558
  }
3447
3559
  };
@@ -3496,9 +3608,7 @@ var shopifyEventsZods = {
3496
3608
  get unsubscribeContent() {
3497
3609
  return import_zod4.z.object({
3498
3610
  provider: this.provider,
3499
- event: import_zod4.z.object({
3500
- name: this.eventName
3501
- })
3611
+ event: this.event
3502
3612
  });
3503
3613
  }
3504
3614
  };
@@ -3562,9 +3672,7 @@ var slackEventsZods = {
3562
3672
  get unsubscribeContent() {
3563
3673
  return import_zod5.z.object({
3564
3674
  provider: this.provider,
3565
- event: import_zod5.z.object({
3566
- name: this.eventName
3567
- })
3675
+ event: this.event
3568
3676
  });
3569
3677
  }
3570
3678
  };
@@ -3647,18 +3755,14 @@ var textHelpDeskEventsZods = {
3647
3755
  get unsubscribe() {
3648
3756
  return this.source.and(
3649
3757
  import_zod6.z.object({
3650
- event: import_zod6.z.object({
3651
- name: this.eventName
3652
- })
3758
+ event: this.event
3653
3759
  })
3654
3760
  );
3655
3761
  },
3656
3762
  get unsubscribeContent() {
3657
3763
  return import_zod6.z.object({
3658
3764
  provider: this.provider,
3659
- event: import_zod6.z.object({
3660
- name: this.eventName
3661
- })
3765
+ event: this.event
3662
3766
  });
3663
3767
  }
3664
3768
  };
@@ -3752,18 +3856,14 @@ var textLivechatEventsZods = {
3752
3856
  get unsubscribe() {
3753
3857
  return this.source.and(
3754
3858
  import_zod7.z.object({
3755
- event: import_zod7.z.object({
3756
- name: this.eventName
3757
- })
3859
+ event: this.event
3758
3860
  })
3759
3861
  );
3760
3862
  },
3761
3863
  get unsubscribeContent() {
3762
3864
  return import_zod7.z.object({
3763
3865
  provider: this.provider,
3764
- event: import_zod7.z.object({
3765
- name: this.eventName
3766
- })
3866
+ event: this.event
3767
3867
  });
3768
3868
  }
3769
3869
  };
@@ -3849,6 +3949,147 @@ function initBillingClient(baseUrl, token) {
3849
3949
  }
3850
3950
  }
3851
3951
 
3952
+ // src/apis/platform/console/instance.ts
3953
+ var import_axios24 = __toESM(require("axios"));
3954
+ var REGION2 = {
3955
+ FRA: "fra",
3956
+ DAL: "dal",
3957
+ FRA_A: "fra-a",
3958
+ FRA_B: "fra-b"
3959
+ };
3960
+ var supportedRegions2 = Object.values(REGION2);
3961
+ var getRegion2 = (token) => {
3962
+ const region = token.split(":")[0];
3963
+ if (supportedRegions2.includes(region)) {
3964
+ return region;
3965
+ }
3966
+ };
3967
+ var ConsoleApiError = class _ConsoleApiError extends ApiErrorBase {
3968
+ constructor() {
3969
+ super(...arguments);
3970
+ this.name = "console";
3971
+ }
3972
+ static notFound(message) {
3973
+ return new _ConsoleApiError(
3974
+ message != null ? message : "Not found",
3975
+ {
3976
+ errorCode: "not_found",
3977
+ errorMessage: "Not found"
3978
+ },
3979
+ 404
3980
+ );
3981
+ }
3982
+ };
3983
+ var consoleClientInstance = import_axios24.default.create({
3984
+ baseURL: "https://platform.labs.text.com/console/api",
3985
+ headers: {
3986
+ "Content-Type": "application/json"
3987
+ }
3988
+ });
3989
+ consoleClientInstance.interceptors.response.use(
3990
+ (response) => response,
3991
+ (error) => {
3992
+ var _a, _b;
3993
+ const apiError = (_a = error.response) == null ? void 0 : _a.data;
3994
+ if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
3995
+ return Promise.reject(new UnauthorizeApiError(apiError.source));
3996
+ } else if ((apiError == null ? void 0 : apiError.kind) === "error") {
3997
+ const data = (_b = error.response) == null ? void 0 : _b.data;
3998
+ return Promise.reject(
3999
+ new ConsoleApiError(data.message, data.data, data.code)
4000
+ );
4001
+ }
4002
+ return Promise.reject(error);
4003
+ }
4004
+ );
4005
+ function getConsoleClientConfig(options = {}) {
4006
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
4007
+ const currentHeaders = consoleClientInstance.defaults.headers;
4008
+ const headers = {
4009
+ platform: {
4010
+ 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
4011
+ },
4012
+ integrations: {
4013
+ github: {
4014
+ app: (_e = currentHeaders["x-adapter-github-app-token"]) != null ? _e : (_d = options.github) == null ? void 0 : _d.appToken,
4015
+ oauth: (_g = currentHeaders["x-adapter-github-oauth-token"]) != null ? _g : (_f = options.github) == null ? void 0 : _f.oauthToken
4016
+ },
4017
+ netlify: (_i = currentHeaders["x-adapter-netlify-token"]) != null ? _i : (_h = options.netlify) == null ? void 0 : _h.token,
4018
+ vercel: (_k = currentHeaders["x-adapter-vercel-token"]) != null ? _k : (_j = options.vercel) == null ? void 0 : _j.token,
4019
+ planetscale: (_m = currentHeaders["x-adapter-planetscale-token"]) != null ? _m : (_l = options.planetscale) == null ? void 0 : _l.token,
4020
+ neon: (_o = currentHeaders["x-adapter-neon-token"]) != null ? _o : (_n = options.neon) == null ? void 0 : _n.token
4021
+ }
4022
+ };
4023
+ if (currentHeaders.Authorization) {
4024
+ currentHeaders["X-Region"] = (_p = getRegion2(currentHeaders.Authorization)) != null ? _p : void 0;
4025
+ }
4026
+ if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.platform) && !headers.platform.token) {
4027
+ throw new UnauthorizeApiError("accounts");
4028
+ }
4029
+ if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
4030
+ throw new UnauthorizeApiError("github");
4031
+ }
4032
+ if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.vercel) && !headers.integrations.vercel) {
4033
+ throw new UnauthorizeApiError("vercel");
4034
+ }
4035
+ if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.netlify) && !headers.integrations.netlify) {
4036
+ throw new UnauthorizeApiError("netlify");
4037
+ }
4038
+ if (((_u = options.ensureAuthorizationToken) == null ? void 0 : _u.planetscale) && !headers.integrations.planetscale) {
4039
+ throw new UnauthorizeApiError("planetscale");
4040
+ }
4041
+ if (((_v = options.ensureAuthorizationToken) == null ? void 0 : _v.neon) && !headers.integrations.neon) {
4042
+ throw new UnauthorizeApiError("neon");
4043
+ }
4044
+ return {
4045
+ 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 } : {})
4046
+ };
4047
+ }
4048
+ var getConsoleClientDefaultConfig = (authorization) => getConsoleClientConfig(__spreadProps(__spreadValues({}, authorization), {
4049
+ ensureAuthorizationToken: {
4050
+ platform: true
4051
+ }
4052
+ }));
4053
+ function initConsoleClient(baseUrl, tokens) {
4054
+ if (baseUrl) {
4055
+ consoleClientInstance.interceptors.request.use(
4056
+ (config) => {
4057
+ config.baseURL = baseUrl;
4058
+ return config;
4059
+ },
4060
+ (error) => Promise.reject(error)
4061
+ );
4062
+ }
4063
+ if (tokens) {
4064
+ updateConsoleClient(tokens);
4065
+ }
4066
+ }
4067
+ function updateConsoleClient(tokens) {
4068
+ var _a, _b, _c, _d, _e, _f, _g, _h;
4069
+ const headers = consoleClientInstance.defaults.headers;
4070
+ if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
4071
+ headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
4072
+ }
4073
+ if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.appToken) {
4074
+ headers["x-adapter-github-app-token"] = tokens.github.appToken;
4075
+ }
4076
+ if ((_d = tokens == null ? void 0 : tokens.github) == null ? void 0 : _d.oauthToken) {
4077
+ headers["x-adapter-github-oauth-token"] = tokens.github.oauthToken;
4078
+ }
4079
+ if ((_e = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _e.token) {
4080
+ headers["x-adapter-netlify-token"] = tokens.netlify.token;
4081
+ }
4082
+ if ((_f = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _f.token) {
4083
+ headers["x-adapter-vercel-token"] = tokens.vercel.token;
4084
+ }
4085
+ if ((_g = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _g.token) {
4086
+ headers["x-adapter-planetscale-token"] = tokens.planetscale.token;
4087
+ }
4088
+ if ((_h = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _h.token) {
4089
+ headers["x-adapter-neon-token"] = tokens.neon.token;
4090
+ }
4091
+ }
4092
+
3852
4093
  // src/apis/platform/dps/applications/application/autoReview/_contracts/dtos/autoReview.ts
3853
4094
  var getEmptyAppAutoReview = () => ({
3854
4095
  isReviewed: false,
@@ -3918,14 +4159,14 @@ var getAppAutoReviewPayload = (value) => {
3918
4159
  };
3919
4160
 
3920
4161
  // src/apis/platform/dps/instance.ts
3921
- var import_axios24 = __toESM(require("axios"));
4162
+ var import_axios25 = __toESM(require("axios"));
3922
4163
  var DpsApiError = class extends ApiErrorBase {
3923
4164
  constructor() {
3924
4165
  super(...arguments);
3925
4166
  this.name = "dps";
3926
4167
  }
3927
4168
  };
3928
- var dpsClientInstance = import_axios24.default.create({
4169
+ var dpsClientInstance = import_axios25.default.create({
3929
4170
  baseURL: "https://dev-platform.labs.livechatinc.com"
3930
4171
  });
3931
4172
  dpsClientInstance.interceptors.response.use(
@@ -3974,14 +4215,14 @@ function initDpsClient(baseUrl, token) {
3974
4215
  }
3975
4216
 
3976
4217
  // src/apis/products/helpdesk/instance.ts
3977
- var import_axios25 = __toESM(require("axios"));
4218
+ var import_axios26 = __toESM(require("axios"));
3978
4219
  var HelpDeskApiError = class extends ApiErrorBase {
3979
4220
  constructor() {
3980
4221
  super(...arguments);
3981
4222
  this.name = "helpdesk";
3982
4223
  }
3983
4224
  };
3984
- var helpdeskClientInstance = import_axios25.default.create({
4225
+ var helpdeskClientInstance = import_axios26.default.create({
3985
4226
  baseURL: "https://api.labs.helpdesk.com"
3986
4227
  });
3987
4228
  helpdeskClientInstance.interceptors.response.use(
@@ -4069,17 +4310,17 @@ var LivechatWebhookSystemMessages = /* @__PURE__ */ ((LivechatWebhookSystemMessa
4069
4310
  })(LivechatWebhookSystemMessages || {});
4070
4311
 
4071
4312
  // src/apis/products/livechat/instance.ts
4072
- var import_axios26 = __toESM(require("axios"));
4073
- var REGION2 = {
4313
+ var import_axios27 = __toESM(require("axios"));
4314
+ var REGION3 = {
4074
4315
  FRA: "fra",
4075
4316
  DAL: "dal",
4076
4317
  FRA_A: "fra-a",
4077
4318
  FRA_B: "fra-b"
4078
4319
  };
4079
- var supportedRegions2 = Object.values(REGION2);
4080
- var getRegion2 = (token) => {
4320
+ var supportedRegions3 = Object.values(REGION3);
4321
+ var getRegion3 = (token) => {
4081
4322
  const region = token.split(":")[0];
4082
- if (supportedRegions2.includes(region)) {
4323
+ if (supportedRegions3.includes(region)) {
4083
4324
  return region;
4084
4325
  }
4085
4326
  };
@@ -4089,7 +4330,7 @@ var LivechatApiError = class extends ApiErrorBase {
4089
4330
  this.name = "livechat";
4090
4331
  }
4091
4332
  };
4092
- var livechatClientInstance = import_axios26.default.create({
4333
+ var livechatClientInstance = import_axios27.default.create({
4093
4334
  baseURL: "https://api.labs.livechatinc.com"
4094
4335
  });
4095
4336
  livechatClientInstance.interceptors.response.use(
@@ -4124,7 +4365,7 @@ function getLiveChatClientConfig(options = {}) {
4124
4365
  };
4125
4366
  }
4126
4367
  function initLiveChatClient(baseUrl, token) {
4127
- const region = token ? getRegion2(token) : void 0;
4368
+ const region = token ? getRegion3(token) : void 0;
4128
4369
  const headers = livechatClientInstance.defaults.headers;
4129
4370
  if (baseUrl) {
4130
4371
  livechatClientInstance.interceptors.request.use(
@@ -4485,7 +4726,8 @@ var urls = {
4485
4726
  create: () => getUrl(),
4486
4727
  update: (id) => getUrl([id]),
4487
4728
  delete: (id) => getUrl([id]),
4488
- connect: (id) => getUrl([id, "connection"])
4729
+ connect: (id) => getUrl([id, "connection"]),
4730
+ disconnect: (id) => getUrl([id, "disconnect"])
4489
4731
  };
4490
4732
  var textPlatformWorkflowsCredentialsApi = {
4491
4733
  meta: {
@@ -4597,6 +4839,24 @@ var textPlatformWorkflowsCredentialsApi = {
4597
4839
  throw error;
4598
4840
  });
4599
4841
  });
4842
+ },
4843
+ disconnect(id, authorization) {
4844
+ return __async(this, null, function* () {
4845
+ return textClientInstance.put(
4846
+ urls.disconnect(id),
4847
+ {},
4848
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4849
+ ensureAuthorizationToken: true
4850
+ }))
4851
+ ).catch((error) => {
4852
+ if (error instanceof TextApiError) {
4853
+ throw error.withCustomMessage(
4854
+ `Couldn't disconnect to credentials. [${error.message}]`
4855
+ );
4856
+ }
4857
+ throw error;
4858
+ });
4859
+ });
4600
4860
  }
4601
4861
  };
4602
4862
 
@@ -4830,7 +5090,7 @@ var textApi = {
4830
5090
  };
4831
5091
 
4832
5092
  // src/apis/integrations/vercel/api.ts
4833
- var import_axios27 = __toESM(require("axios"));
5093
+ var import_axios28 = __toESM(require("axios"));
4834
5094
 
4835
5095
  // src/apis/integrations/vercel/deploy/api.ts
4836
5096
  var vercelDeployApi = {
@@ -5090,7 +5350,7 @@ var vercelApi = {
5090
5350
  client_secret: clientSecret,
5091
5351
  redirect_uri: redirectUrl
5092
5352
  });
5093
- const response = yield import_axios27.default.post("https://api.vercel.com/v2/oauth/access_token", data, {
5353
+ const response = yield import_axios28.default.post("https://api.vercel.com/v2/oauth/access_token", data, {
5094
5354
  headers: {
5095
5355
  "Content-Type": "application/x-www-form-urlencoded"
5096
5356
  }
@@ -5431,769 +5691,767 @@ var platformAccountsApi = {
5431
5691
  token: platformAccountsTokenApi
5432
5692
  };
5433
5693
 
5434
- // src/apis/platform/adapter/app/blocks/authorization/api.ts
5435
- var platformAdapterAppAuthorizationApi = {
5436
- get(appId, authorization) {
5437
- return __async(this, null, function* () {
5438
- return adapterClientInstance.get(
5439
- `/console/app/${encodeURIComponent(appId)}/blocks/authorization`,
5440
- getAdapterClientDefaultConfig(authorization)
5441
- );
5442
- });
5443
- },
5444
- add(payload, authorization) {
5445
- return __async(this, null, function* () {
5446
- return adapterClientInstance.post(
5447
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5448
- payload,
5449
- getAdapterClientDefaultConfig(authorization)
5450
- );
5451
- });
5452
- },
5453
- update(payload, authorization) {
5454
- return __async(this, null, function* () {
5455
- return adapterClientInstance.put(
5456
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5457
- payload,
5458
- getAdapterClientDefaultConfig(authorization)
5459
- );
5460
- });
5461
- },
5462
- remove(payload, authorization) {
5463
- return __async(this, null, function* () {
5464
- return adapterClientInstance.delete(
5465
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5466
- getAdapterClientDefaultConfig(authorization)
5467
- );
5468
- });
5694
+ // src/apis/platform/adapter/integrations/bigcommerce/api.ts
5695
+ var platformAdapterBigCommerceApi = {
5696
+ events: {
5697
+ subscribe(payload, authorization) {
5698
+ return __async(this, null, function* () {
5699
+ yield adapterClientInstance.post(
5700
+ "/integrations/bigcommerce/events/subscribe",
5701
+ payload,
5702
+ getBigCommerceClientConfig(authorization)
5703
+ );
5704
+ });
5705
+ },
5706
+ unsubscribe(payload, authorization) {
5707
+ return __async(this, null, function* () {
5708
+ yield adapterClientInstance.post(
5709
+ "/integrations/bigcommerce/events/unsubscribe",
5710
+ payload,
5711
+ getBigCommerceClientConfig(authorization)
5712
+ );
5713
+ });
5714
+ }
5469
5715
  }
5470
5716
  };
5471
5717
 
5472
- // src/apis/platform/adapter/app/blocks/deployment/api.ts
5473
- var platformAdapterAppDeploymentApi = {
5474
- getAggregate(appId, authorization) {
5475
- return __async(this, null, function* () {
5476
- return adapterClientInstance.get(
5477
- `/console/app/${encodeURIComponent(appId)}/blocks/deployment/aggregate`,
5478
- getAdapterClientDefaultConfig(authorization)
5479
- );
5480
- });
5481
- },
5482
- get(appId, authorization) {
5483
- return __async(this, null, function* () {
5484
- return adapterClientInstance.get(
5485
- `/console/app/${encodeURIComponent(appId)}/blocks/deployment`,
5486
- getAdapterClientDefaultConfig(authorization)
5487
- );
5488
- });
5489
- },
5490
- link(payload, authorization) {
5491
- return __async(this, null, function* () {
5492
- return adapterClientInstance.put(
5493
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5494
- payload,
5495
- getAdapterClientDefaultConfig(authorization)
5496
- );
5497
- });
5498
- },
5499
- unlink(payload, authorization) {
5718
+ // src/apis/platform/adapter/integrations/hubspot/api.ts
5719
+ var platformAdapterHubspotApi = {
5720
+ events: {
5721
+ subscribe(payload, authorization) {
5722
+ return __async(this, null, function* () {
5723
+ yield adapterClientInstance.post(
5724
+ "/integrations/hubspot/events/subscribe",
5725
+ payload,
5726
+ getHubspotClientConfig(authorization)
5727
+ );
5728
+ });
5729
+ },
5730
+ unsubscribe(payload, authorization) {
5731
+ return __async(this, null, function* () {
5732
+ yield adapterClientInstance.post(
5733
+ "/integrations/hubspot/events/unsubscribe",
5734
+ payload,
5735
+ getHubspotClientConfig(authorization)
5736
+ );
5737
+ });
5738
+ }
5739
+ }
5740
+ };
5741
+
5742
+ // src/apis/platform/adapter/integrations/mailchimp/api.ts
5743
+ var platformAdapterMailchimpApi = {
5744
+ events: {
5745
+ subscribe(payload, authorization) {
5746
+ return __async(this, null, function* () {
5747
+ yield adapterClientInstance.post(
5748
+ "/integrations/mailchimp/events/subscribe",
5749
+ payload,
5750
+ getMailchimpClientConfig(authorization)
5751
+ );
5752
+ });
5753
+ },
5754
+ unsubscribe(payload, authorization) {
5755
+ return __async(this, null, function* () {
5756
+ yield adapterClientInstance.post(
5757
+ "/integrations/mailchimp/events/unsubscribe",
5758
+ payload,
5759
+ getMailchimpClientConfig(authorization)
5760
+ );
5761
+ });
5762
+ }
5763
+ }
5764
+ };
5765
+
5766
+ // src/apis/platform/adapter/integrations/shopify/api.ts
5767
+ var platformAdapterShopifyApi = {
5768
+ events: {
5769
+ subscribe(payload, authorization) {
5770
+ return __async(this, null, function* () {
5771
+ yield adapterClientInstance.post(
5772
+ "/integrations/shopify/events/subscribe",
5773
+ payload,
5774
+ getShopifyClientConfig(authorization)
5775
+ );
5776
+ });
5777
+ },
5778
+ unsubscribe(payload, authorization) {
5779
+ return __async(this, null, function* () {
5780
+ yield adapterClientInstance.post(
5781
+ "/integrations/shopify/events/unsubscribe",
5782
+ payload,
5783
+ getShopifyClientConfig(authorization)
5784
+ );
5785
+ });
5786
+ }
5787
+ }
5788
+ };
5789
+
5790
+ // src/apis/platform/adapter/integrations/slack/api.ts
5791
+ var platformAdapterSlackApi = {
5792
+ events: {
5793
+ subscribe(payload, authorization) {
5794
+ return __async(this, null, function* () {
5795
+ yield adapterClientInstance.post(
5796
+ "/integrations/slack/events/subscribe",
5797
+ payload,
5798
+ getSlackClientConfig(authorization)
5799
+ );
5800
+ });
5801
+ },
5802
+ unsubscribe(payload, authorization) {
5803
+ return __async(this, null, function* () {
5804
+ yield adapterClientInstance.post(
5805
+ "/integrations/slack/events/unsubscribe",
5806
+ payload,
5807
+ getSlackClientConfig(authorization)
5808
+ );
5809
+ });
5810
+ }
5811
+ }
5812
+ };
5813
+
5814
+ // src/apis/platform/adapter/integrations/text/api.ts
5815
+ var platformAdapterTextApi = {
5816
+ events: {
5817
+ subscribe(payload, authorization) {
5818
+ return __async(this, null, function* () {
5819
+ yield adapterClientInstance.post(
5820
+ "/integrations/text/events/subscribe",
5821
+ payload,
5822
+ getTextClientConfig(authorization)
5823
+ );
5824
+ });
5825
+ },
5826
+ unsubscribe(payload, authorization) {
5827
+ return __async(this, null, function* () {
5828
+ yield adapterClientInstance.post(
5829
+ "/integrations/text/events/unsubscribe",
5830
+ payload,
5831
+ getTextClientConfig(authorization)
5832
+ );
5833
+ });
5834
+ }
5835
+ }
5836
+ };
5837
+
5838
+ // src/apis/platform/adapter/integrations/api.ts
5839
+ var platformAdapterIntegrationsApi = {
5840
+ mailchimp: platformAdapterMailchimpApi,
5841
+ shopify: platformAdapterShopifyApi,
5842
+ hubspot: platformAdapterHubspotApi,
5843
+ slack: platformAdapterSlackApi,
5844
+ bigcommerce: platformAdapterBigCommerceApi,
5845
+ text: platformAdapterTextApi
5846
+ };
5847
+
5848
+ // src/apis/platform/adapter/api.ts
5849
+ var platformAdapterApi = {
5850
+ integrations: platformAdapterIntegrationsApi
5851
+ };
5852
+
5853
+ // src/apis/platform/billing/account/api.ts
5854
+ var platformBillingAccountApi = {
5855
+ getAccount(authorization) {
5500
5856
  return __async(this, null, function* () {
5501
- return adapterClientInstance.delete(
5502
- `/console/app/${encodeURIComponent(
5503
- payload.appId
5504
- )}/blocks/deployment?${new URLSearchParams(
5505
- payload
5506
- ).toString()}`,
5507
- getAdapterClientDefaultConfig(authorization)
5508
- );
5857
+ try {
5858
+ return yield billingClientInstance.get(
5859
+ "/v3/account",
5860
+ getBillingClientConfig(authorization)
5861
+ );
5862
+ } catch (error) {
5863
+ if (error instanceof Error) {
5864
+ throw new Error(`Account couldn't be fetched. [${error.message}]`);
5865
+ } else {
5866
+ throw error;
5867
+ }
5868
+ }
5509
5869
  });
5510
5870
  },
5511
- upsert(payload, authorization) {
5871
+ getAccountInfo(product, authorization) {
5512
5872
  return __async(this, null, function* () {
5513
- return adapterClientInstance.patch(
5514
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5515
- payload,
5516
- getAdapterClientDefaultConfig(authorization)
5517
- );
5873
+ try {
5874
+ return yield billingClientInstance.get(
5875
+ `/v3/account/${encodeURIComponent(product)}/billing_info`,
5876
+ getBillingClientConfig(authorization)
5877
+ );
5878
+ } catch (error) {
5879
+ if (error instanceof Error) {
5880
+ throw new Error(
5881
+ `Account billing info couldn't be fetched. [${error.message}]`
5882
+ );
5883
+ } else {
5884
+ throw error;
5885
+ }
5886
+ }
5518
5887
  });
5519
5888
  }
5520
5889
  };
5521
5890
 
5522
- // src/apis/platform/adapter/app/blocks/monetization/api.ts
5523
- var platformAdapterAppMonetizationApi = {
5524
- get(appId, authorization) {
5525
- return __async(this, null, function* () {
5526
- return adapterClientInstance.get(
5527
- `/console/app/${encodeURIComponent(appId)}/blocks/monetization`,
5528
- getAdapterClientDefaultConfig(authorization)
5529
- );
5530
- });
5531
- },
5532
- upsert(payload, authorization) {
5891
+ // src/apis/platform/billing/invoices/api.ts
5892
+ var platformBillingInvoicesApi = {
5893
+ getInvoices(product, authorization) {
5533
5894
  return __async(this, null, function* () {
5534
- return adapterClientInstance.post(
5535
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5536
- payload,
5537
- getAdapterClientDefaultConfig(authorization)
5538
- );
5895
+ try {
5896
+ return yield billingClientInstance.get(
5897
+ `/v2/invoices/${encodeURIComponent(product)}`,
5898
+ getBillingClientConfig(authorization)
5899
+ );
5900
+ } catch (error) {
5901
+ if (error instanceof Error) {
5902
+ throw new Error(`Invoices couldn't be fetched. [${error.message}]`);
5903
+ } else {
5904
+ throw error;
5905
+ }
5906
+ }
5539
5907
  });
5540
5908
  },
5541
- remove(payload, authorization) {
5909
+ downloadInvoices(number, authorization) {
5542
5910
  return __async(this, null, function* () {
5543
- return adapterClientInstance.delete(
5544
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5545
- getAdapterClientDefaultConfig(authorization)
5546
- );
5911
+ try {
5912
+ const response = yield billingClientInstance.request(__spreadValues({
5913
+ url: `https://api.labs.livechatinc.com/v2/invoices/${encodeURIComponent(
5914
+ number
5915
+ )}`,
5916
+ data: new URLSearchParams({
5917
+ _method: "GET"
5918
+ //gave the values directly for testing
5919
+ }),
5920
+ responseType: "blob"
5921
+ }, getBillingClientConfig(authorization)));
5922
+ const href = URL.createObjectURL(response.data);
5923
+ const link = document.createElement("a");
5924
+ link.href = href;
5925
+ link.setAttribute("download", `invoice-${number}.pdf`);
5926
+ document.body.appendChild(link);
5927
+ link.click();
5928
+ document.body.removeChild(link);
5929
+ URL.revokeObjectURL(href);
5930
+ } catch (error) {
5931
+ if (error instanceof Error) {
5932
+ throw new Error(`Invoice couldn't be downloaded. [${error.message}]`);
5933
+ } else {
5934
+ throw error;
5935
+ }
5936
+ }
5547
5937
  });
5548
5938
  }
5549
5939
  };
5550
5940
 
5551
- // src/apis/platform/adapter/app/blocks/properties/property/api.ts
5552
- var platformAdapterAppPropertyApi = {
5553
- get(appId, propertyId, authorization) {
5941
+ // src/apis/platform/billing/api.ts
5942
+ var platformBillingApi = {
5943
+ account: platformBillingAccountApi,
5944
+ invoices: platformBillingInvoicesApi
5945
+ };
5946
+
5947
+ // src/apis/platform/console/app/blocks/authorization/api.ts
5948
+ var platformConsoleAppAuthorizationApi = {
5949
+ get(appId, authorization) {
5554
5950
  return __async(this, null, function* () {
5555
- return adapterClientInstance.get(
5556
- `/console/app/${encodeURIComponent(
5557
- appId
5558
- )}/blocks/properties/${encodeURIComponent(propertyId)}`,
5559
- getAdapterClientDefaultConfig(authorization)
5951
+ return consoleClientInstance.get(
5952
+ `/app/${encodeURIComponent(appId)}/blocks/authorization`,
5953
+ getConsoleClientDefaultConfig(authorization)
5560
5954
  );
5561
5955
  });
5562
5956
  },
5563
- upsert(payload, authorization) {
5957
+ add(payload, authorization) {
5564
5958
  return __async(this, null, function* () {
5565
- return adapterClientInstance.post(
5566
- `/console/app/${encodeURIComponent(
5567
- payload.appId
5568
- )}/blocks/properties/${encodeURIComponent(payload.propertyId)}`,
5959
+ return consoleClientInstance.post(
5960
+ `/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5569
5961
  payload,
5570
- getAdapterClientDefaultConfig(authorization)
5962
+ getConsoleClientDefaultConfig(authorization)
5571
5963
  );
5572
5964
  });
5573
5965
  },
5574
- remove(payload, authorization) {
5575
- return __async(this, null, function* () {
5576
- return adapterClientInstance.delete(
5577
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/properties/${payload.propertyId}`,
5578
- getAdapterClientDefaultConfig(authorization)
5579
- );
5580
- });
5581
- }
5582
- };
5583
-
5584
- // src/apis/platform/adapter/app/blocks/properties/api.ts
5585
- var platformAdapterAppPropertiesApi = {
5586
- property: platformAdapterAppPropertyApi,
5587
- get(appId, authorization) {
5588
- return __async(this, null, function* () {
5589
- return adapterClientInstance.get(
5590
- `/console/app/${encodeURIComponent(appId)}/blocks/properties`,
5591
- getAdapterClientDefaultConfig(authorization)
5592
- );
5593
- });
5594
- },
5595
- upsert(payload, authorization) {
5966
+ update(payload, authorization) {
5596
5967
  return __async(this, null, function* () {
5597
- return adapterClientInstance.post(
5598
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5968
+ return consoleClientInstance.put(
5969
+ `/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5599
5970
  payload,
5600
- getAdapterClientDefaultConfig(authorization)
5971
+ getConsoleClientDefaultConfig(authorization)
5601
5972
  );
5602
5973
  });
5603
5974
  },
5604
5975
  remove(payload, authorization) {
5605
5976
  return __async(this, null, function* () {
5606
- return adapterClientInstance.delete(
5607
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5608
- getAdapterClientDefaultConfig(authorization)
5977
+ return consoleClientInstance.delete(
5978
+ `/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5979
+ getConsoleClientDefaultConfig(authorization)
5609
5980
  );
5610
5981
  });
5611
5982
  }
5612
5983
  };
5613
5984
 
5614
- // src/apis/platform/adapter/app/blocks/repository/api.ts
5615
- var platformAdapterAppRepositoryApi = {
5985
+ // src/apis/platform/console/app/blocks/deployment/api.ts
5986
+ var platformConsoleAppDeploymentApi = {
5616
5987
  getAggregate(appId, authorization) {
5617
5988
  return __async(this, null, function* () {
5618
- return adapterClientInstance.get(
5619
- `/console/app/${encodeURIComponent(appId)}/blocks/repository/aggregate`,
5620
- getAdapterClientDefaultConfig(authorization)
5989
+ return consoleClientInstance.get(
5990
+ `/app/${encodeURIComponent(appId)}/blocks/deployment/aggregate`,
5991
+ getConsoleClientDefaultConfig(authorization)
5621
5992
  );
5622
5993
  });
5623
5994
  },
5624
5995
  get(appId, authorization) {
5625
5996
  return __async(this, null, function* () {
5626
- return adapterClientInstance.get(
5627
- `/console/app/${encodeURIComponent(appId)}/blocks/repository`,
5628
- getAdapterClientDefaultConfig(authorization)
5997
+ return consoleClientInstance.get(
5998
+ `/app/${encodeURIComponent(appId)}/blocks/deployment`,
5999
+ getConsoleClientDefaultConfig(authorization)
5629
6000
  );
5630
6001
  });
5631
6002
  },
5632
6003
  link(payload, authorization) {
5633
6004
  return __async(this, null, function* () {
5634
- return adapterClientInstance.put(
5635
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
6005
+ return consoleClientInstance.put(
6006
+ `/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5636
6007
  payload,
5637
- getAdapterClientDefaultConfig(authorization)
6008
+ getConsoleClientDefaultConfig(authorization)
5638
6009
  );
5639
6010
  });
5640
6011
  },
5641
6012
  unlink(payload, authorization) {
5642
6013
  return __async(this, null, function* () {
5643
- return adapterClientInstance.delete(
5644
- `/console/app/${encodeURIComponent(
6014
+ return consoleClientInstance.delete(
6015
+ `/app/${encodeURIComponent(
5645
6016
  payload.appId
5646
- )}/blocks/repository?${new URLSearchParams(
6017
+ )}/blocks/deployment?${new URLSearchParams(
5647
6018
  payload
5648
6019
  ).toString()}`,
5649
- getAdapterClientDefaultConfig(authorization)
6020
+ getConsoleClientDefaultConfig(authorization)
5650
6021
  );
5651
6022
  });
5652
6023
  },
5653
6024
  upsert(payload, authorization) {
5654
6025
  return __async(this, null, function* () {
5655
- return adapterClientInstance.patch(
5656
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
5657
- payload,
5658
- getAdapterClientDefaultConfig(authorization)
5659
- );
5660
- });
5661
- },
5662
- seed(payload, authorization) {
5663
- return __async(this, null, function* () {
5664
- return adapterClientInstance.post(
5665
- `/console/app/${encodeURIComponent(
5666
- payload.appId
5667
- )}/blocks/repository/seed`,
6026
+ return consoleClientInstance.patch(
6027
+ `/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5668
6028
  payload,
5669
- getAdapterClientDefaultConfig(authorization)
6029
+ getConsoleClientDefaultConfig(authorization)
5670
6030
  );
5671
6031
  });
5672
6032
  }
5673
6033
  };
5674
6034
 
5675
- // src/apis/platform/adapter/app/blocks/storage/api.ts
5676
- var platformAdapterAppStorageApi = {
5677
- getAggregate(appId, authorization) {
5678
- return __async(this, null, function* () {
5679
- return adapterClientInstance.get(
5680
- `/console/app/${encodeURIComponent(appId)}/blocks/storage/aggregate`,
5681
- getAdapterClientDefaultConfig(authorization)
5682
- );
5683
- });
5684
- },
6035
+ // src/apis/platform/console/app/blocks/monetization/api.ts
6036
+ var platformConsoleAppMonetizationApi = {
5685
6037
  get(appId, authorization) {
5686
6038
  return __async(this, null, function* () {
5687
- return adapterClientInstance.get(
5688
- `/console/app/${encodeURIComponent(appId)}/blocks/storage`,
5689
- getAdapterClientDefaultConfig(authorization)
6039
+ return consoleClientInstance.get(
6040
+ `/app/${encodeURIComponent(appId)}/blocks/monetization`,
6041
+ getConsoleClientDefaultConfig(authorization)
5690
6042
  );
5691
6043
  });
5692
6044
  },
5693
- link(payload, authorization) {
6045
+ upsert(payload, authorization) {
5694
6046
  return __async(this, null, function* () {
5695
- return adapterClientInstance.put(
5696
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
6047
+ return consoleClientInstance.post(
6048
+ `/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5697
6049
  payload,
5698
- getAdapterClientDefaultConfig(authorization)
5699
- );
5700
- });
5701
- },
5702
- unlink(payload, authorization) {
5703
- return __async(this, null, function* () {
5704
- return adapterClientInstance.delete(
5705
- `/console/app/${encodeURIComponent(
5706
- payload.appId
5707
- )}/blocks/storage?${new URLSearchParams(
5708
- payload
5709
- ).toString()}`,
5710
- getAdapterClientDefaultConfig(authorization)
6050
+ getConsoleClientDefaultConfig(authorization)
5711
6051
  );
5712
6052
  });
5713
6053
  },
5714
- upsert(payload, authorization) {
6054
+ remove(payload, authorization) {
5715
6055
  return __async(this, null, function* () {
5716
- return adapterClientInstance.patch(
5717
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
5718
- payload,
5719
- getAdapterClientDefaultConfig(authorization)
6056
+ return consoleClientInstance.delete(
6057
+ `/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
6058
+ getConsoleClientDefaultConfig(authorization)
5720
6059
  );
5721
6060
  });
5722
6061
  }
5723
6062
  };
5724
6063
 
5725
- // src/apis/platform/adapter/app/blocks/widgets/widget/api.ts
5726
- var platformAdapterAppWidgetApi = {
5727
- get(appId, widgetId, authorization) {
6064
+ // src/apis/platform/console/app/blocks/properties/property/api.ts
6065
+ var platformConsoleAppPropertyApi = {
6066
+ get(appId, propertyId, authorization) {
5728
6067
  return __async(this, null, function* () {
5729
- return adapterClientInstance.get(
5730
- `/console/app/${encodeURIComponent(
6068
+ return consoleClientInstance.get(
6069
+ `/app/${encodeURIComponent(
5731
6070
  appId
5732
- )}/blocks/widgets/${encodeURIComponent(widgetId)}`,
5733
- getAdapterClientDefaultConfig(authorization)
6071
+ )}/blocks/properties/${encodeURIComponent(propertyId)}`,
6072
+ getConsoleClientDefaultConfig(authorization)
5734
6073
  );
5735
6074
  });
5736
6075
  },
5737
6076
  upsert(payload, authorization) {
5738
6077
  return __async(this, null, function* () {
5739
- return adapterClientInstance.post(
5740
- `/console/app/${encodeURIComponent(
6078
+ return consoleClientInstance.post(
6079
+ `/app/${encodeURIComponent(
5741
6080
  payload.appId
5742
- )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
6081
+ )}/blocks/properties/${encodeURIComponent(payload.propertyId)}`,
5743
6082
  payload,
5744
- getAdapterClientDefaultConfig(authorization)
6083
+ getConsoleClientDefaultConfig(authorization)
5745
6084
  );
5746
6085
  });
5747
6086
  },
5748
6087
  remove(payload, authorization) {
5749
6088
  return __async(this, null, function* () {
5750
- return adapterClientInstance.delete(
5751
- `/console/app/${encodeURIComponent(
5752
- payload.appId
5753
- )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
5754
- getAdapterClientDefaultConfig(authorization)
6089
+ return consoleClientInstance.delete(
6090
+ `/app/${encodeURIComponent(payload.appId)}/blocks/properties/${payload.propertyId}`,
6091
+ getConsoleClientDefaultConfig(authorization)
5755
6092
  );
5756
6093
  });
5757
6094
  }
5758
6095
  };
5759
6096
 
5760
- // src/apis/platform/adapter/app/blocks/widgets/api.ts
5761
- var platformAdapterAppWidgetsApi = {
5762
- widget: platformAdapterAppWidgetApi,
6097
+ // src/apis/platform/console/app/blocks/properties/api.ts
6098
+ var platformConsoleAppPropertiesApi = {
6099
+ property: platformConsoleAppPropertyApi,
5763
6100
  get(appId, authorization) {
5764
6101
  return __async(this, null, function* () {
5765
- return adapterClientInstance.get(
5766
- `/console/app/${encodeURIComponent(appId)}/blocks/widgets`,
5767
- getAdapterClientDefaultConfig(authorization)
6102
+ return consoleClientInstance.get(
6103
+ `/app/${encodeURIComponent(appId)}/blocks/properties`,
6104
+ getConsoleClientDefaultConfig(authorization)
5768
6105
  );
5769
6106
  });
5770
6107
  },
5771
6108
  upsert(payload, authorization) {
5772
6109
  return __async(this, null, function* () {
5773
- return adapterClientInstance.post(
5774
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
6110
+ return consoleClientInstance.post(
6111
+ `/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5775
6112
  payload,
5776
- getAdapterClientDefaultConfig(authorization)
6113
+ getConsoleClientDefaultConfig(authorization)
5777
6114
  );
5778
6115
  });
5779
6116
  },
5780
6117
  remove(payload, authorization) {
5781
6118
  return __async(this, null, function* () {
5782
- return adapterClientInstance.delete(
5783
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
5784
- getAdapterClientDefaultConfig(authorization)
6119
+ return consoleClientInstance.delete(
6120
+ `/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
6121
+ getConsoleClientDefaultConfig(authorization)
5785
6122
  );
5786
6123
  });
5787
6124
  }
5788
6125
  };
5789
6126
 
5790
- // src/apis/platform/adapter/app/blocks/api.ts
5791
- var platformAdapterAppBlocksApi = {
5792
- authorization: platformAdapterAppAuthorizationApi,
5793
- monetization: platformAdapterAppMonetizationApi,
5794
- repository: platformAdapterAppRepositoryApi,
5795
- deployment: platformAdapterAppDeploymentApi,
5796
- storage: platformAdapterAppStorageApi,
5797
- properties: platformAdapterAppPropertiesApi,
5798
- widgets: platformAdapterAppWidgetsApi
5799
- };
5800
-
5801
- // src/apis/platform/adapter/app/templates/api.ts
5802
- var platformAdapterAppTemplatesApi = {
5803
- getTemplates(authorization) {
5804
- return __async(this, null, function* () {
5805
- return adapterClientInstance.get(
5806
- "/console/app/templates",
5807
- getAdapterClientDefaultConfig(authorization)
5808
- );
5809
- });
5810
- },
5811
- getRepositoryTemplates(authorization) {
5812
- return __async(this, null, function* () {
5813
- return adapterClientInstance.get(
5814
- "/console/app/templates/repository",
5815
- getAdapterClientDefaultConfig(authorization)
5816
- );
5817
- });
5818
- }
5819
- };
5820
-
5821
- // src/apis/platform/adapter/app/variables/api.ts
5822
- var platformAdapterAppVariablesApi = {
5823
- getVariables(appId, decrypted, authorization) {
6127
+ // src/apis/platform/console/app/blocks/repository/api.ts
6128
+ var platformConsoleAppRepositoryApi = {
6129
+ getAggregate(appId, authorization) {
5824
6130
  return __async(this, null, function* () {
5825
- const response = yield adapterClientInstance.get(
5826
- `/console/app/${encodeURIComponent(appId)}/variables`,
5827
- __spreadValues({
5828
- params: {
5829
- decrypted
5830
- }
5831
- }, getAdapterClientDefaultConfig(authorization))
6131
+ return consoleClientInstance.get(
6132
+ `/app/${encodeURIComponent(appId)}/blocks/repository/aggregate`,
6133
+ getConsoleClientDefaultConfig(authorization)
5832
6134
  );
5833
- return response.data;
5834
6135
  });
5835
6136
  },
5836
- getVariable(appId, key, authorization) {
6137
+ get(appId, authorization) {
5837
6138
  return __async(this, null, function* () {
5838
- const response = yield adapterClientInstance.get(
5839
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5840
- key
5841
- )}`,
5842
- getAdapterClientDefaultConfig(authorization)
6139
+ return consoleClientInstance.get(
6140
+ `/app/${encodeURIComponent(appId)}/blocks/repository`,
6141
+ getConsoleClientDefaultConfig(authorization)
5843
6142
  );
5844
- return response.data;
5845
6143
  });
5846
6144
  },
5847
- syncVariable(appId, key, payload, authorization) {
6145
+ link(payload, authorization) {
5848
6146
  return __async(this, null, function* () {
5849
- yield adapterClientInstance.post(
5850
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5851
- key
5852
- )}/sync`,
6147
+ return consoleClientInstance.put(
6148
+ `/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
5853
6149
  payload,
5854
- getAdapterClientDefaultConfig(authorization)
6150
+ getConsoleClientDefaultConfig(authorization)
5855
6151
  );
5856
6152
  });
5857
6153
  },
5858
- createVariable(appId, data, authorization) {
6154
+ unlink(payload, authorization) {
5859
6155
  return __async(this, null, function* () {
5860
- yield adapterClientInstance.post(
5861
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5862
- data.key
5863
- )}`,
5864
- data,
5865
- getAdapterClientDefaultConfig(authorization)
6156
+ return consoleClientInstance.delete(
6157
+ `/app/${encodeURIComponent(
6158
+ payload.appId
6159
+ )}/blocks/repository?${new URLSearchParams(
6160
+ payload
6161
+ ).toString()}`,
6162
+ getConsoleClientDefaultConfig(authorization)
5866
6163
  );
5867
6164
  });
5868
6165
  },
5869
- editVariable(appId, data, authorization) {
6166
+ upsert(payload, authorization) {
5870
6167
  return __async(this, null, function* () {
5871
- yield adapterClientInstance.post(
5872
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5873
- data.key
5874
- )}/edit`,
5875
- data,
5876
- getAdapterClientDefaultConfig(authorization)
6168
+ return consoleClientInstance.patch(
6169
+ `/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
6170
+ payload,
6171
+ getConsoleClientDefaultConfig(authorization)
5877
6172
  );
5878
6173
  });
5879
6174
  },
5880
- deleteVariable(appId, key) {
6175
+ seed(payload, authorization) {
5881
6176
  return __async(this, null, function* () {
5882
- yield adapterClientInstance.delete(
5883
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5884
- key
5885
- )}`
6177
+ return consoleClientInstance.post(
6178
+ `/app/${encodeURIComponent(payload.appId)}/blocks/repository/seed`,
6179
+ payload,
6180
+ getConsoleClientDefaultConfig(authorization)
5886
6181
  );
5887
6182
  });
5888
6183
  }
5889
6184
  };
5890
6185
 
5891
- // src/apis/platform/adapter/app/api.ts
5892
- var platformAdapterAppApi = {
5893
- blocks: platformAdapterAppBlocksApi,
5894
- variables: platformAdapterAppVariablesApi,
5895
- templates: platformAdapterAppTemplatesApi,
5896
- push(payload, authorization) {
6186
+ // src/apis/platform/console/app/blocks/storage/api.ts
6187
+ var platformConsoleAppStorageApi = {
6188
+ getAggregate(appId, authorization) {
5897
6189
  return __async(this, null, function* () {
5898
- return adapterClientInstance.post(
5899
- `/console/app${payload.manifest.id ? `/${encodeURIComponent(payload.manifest.id)}` : ""}`,
5900
- payload,
5901
- getAdapterClientDefaultConfig(authorization)
6190
+ return consoleClientInstance.get(
6191
+ `/app/${encodeURIComponent(appId)}/blocks/storage/aggregate`,
6192
+ getConsoleClientDefaultConfig(authorization)
5902
6193
  );
5903
6194
  });
5904
6195
  },
5905
- pull(appId, authorization) {
6196
+ get(appId, authorization) {
5906
6197
  return __async(this, null, function* () {
5907
- return adapterClientInstance.get(
5908
- `/console/app/${encodeURIComponent(appId)}`,
5909
- getAdapterClientDefaultConfig(authorization)
6198
+ return consoleClientInstance.get(
6199
+ `/app/${encodeURIComponent(appId)}/blocks/storage`,
6200
+ getConsoleClientDefaultConfig(authorization)
5910
6201
  );
5911
6202
  });
5912
6203
  },
5913
- verify(payload, authorization) {
6204
+ link(payload, authorization) {
5914
6205
  return __async(this, null, function* () {
5915
- return adapterClientInstance.post(
5916
- `/console/app/${encodeURIComponent(payload.appId)}/verify`,
6206
+ return consoleClientInstance.put(
6207
+ `/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
5917
6208
  payload,
5918
- getAdapterClientDefaultConfig(authorization)
6209
+ getConsoleClientDefaultConfig(authorization)
5919
6210
  );
5920
6211
  });
5921
6212
  },
5922
- status(sagaId, authorization) {
6213
+ unlink(payload, authorization) {
5923
6214
  return __async(this, null, function* () {
5924
- return adapterClientInstance.get(
5925
- "/console/app/status",
5926
- __spreadValues({
5927
- params: {
5928
- sagaId
5929
- }
5930
- }, getAdapterClientDefaultConfig(authorization))
5931
- );
5932
- });
5933
- }
5934
- };
5935
-
5936
- // src/apis/platform/adapter/integrations/bigcommerce/api.ts
5937
- var platformAdapterBigCommerceApi = {
5938
- events: {
5939
- subscribe(payload, authorization) {
5940
- return __async(this, null, function* () {
5941
- yield adapterClientInstance.post(
5942
- "/integrations/bigcommerce/events/subscribe",
5943
- payload,
5944
- getBigCommerceClientConfig(authorization)
5945
- );
5946
- });
5947
- },
5948
- unsubscribe(payload, authorization) {
5949
- return __async(this, null, function* () {
5950
- yield adapterClientInstance.post(
5951
- "/integrations/bigcommerce/events/unsubscribe",
5952
- payload,
5953
- getBigCommerceClientConfig(authorization)
5954
- );
5955
- });
5956
- }
5957
- }
5958
- };
5959
-
5960
- // src/apis/platform/adapter/integrations/hubspot/api.ts
5961
- var platformAdapterHubspotApi = {
5962
- events: {
5963
- subscribe(payload, authorization) {
5964
- return __async(this, null, function* () {
5965
- yield adapterClientInstance.post(
5966
- "/integrations/hubspot/events/subscribe",
5967
- payload,
5968
- getHubspotClientConfig(authorization)
5969
- );
5970
- });
5971
- },
5972
- unsubscribe(payload, authorization) {
5973
- return __async(this, null, function* () {
5974
- yield adapterClientInstance.post(
5975
- "/integrations/hubspot/events/unsubscribe",
5976
- payload,
5977
- getHubspotClientConfig(authorization)
5978
- );
5979
- });
5980
- }
5981
- }
5982
- };
5983
-
5984
- // src/apis/platform/adapter/integrations/mailchimp/api.ts
5985
- var platformAdapterMailchimpApi = {
5986
- events: {
5987
- subscribe(payload, authorization) {
5988
- return __async(this, null, function* () {
5989
- yield adapterClientInstance.post(
5990
- "/integrations/mailchimp/events/subscribe",
5991
- payload,
5992
- getMailchimpClientConfig(authorization)
5993
- );
5994
- });
5995
- },
5996
- unsubscribe(payload, authorization) {
5997
- return __async(this, null, function* () {
5998
- yield adapterClientInstance.post(
5999
- "/integrations/mailchimp/events/unsubscribe",
6000
- payload,
6001
- getMailchimpClientConfig(authorization)
6002
- );
6003
- });
6004
- }
6005
- }
6006
- };
6007
-
6008
- // src/apis/platform/adapter/integrations/shopify/api.ts
6009
- var platformAdapterShopifyApi = {
6010
- events: {
6011
- subscribe(payload, authorization) {
6012
- return __async(this, null, function* () {
6013
- yield adapterClientInstance.post(
6014
- "/integrations/shopify/events/subscribe",
6015
- payload,
6016
- getShopifyClientConfig(authorization)
6017
- );
6018
- });
6019
- },
6020
- unsubscribe(payload, authorization) {
6021
- return __async(this, null, function* () {
6022
- yield adapterClientInstance.post(
6023
- "/integrations/shopify/events/unsubscribe",
6024
- payload,
6025
- getShopifyClientConfig(authorization)
6026
- );
6027
- });
6028
- }
6215
+ return consoleClientInstance.delete(
6216
+ `/app/${encodeURIComponent(
6217
+ payload.appId
6218
+ )}/blocks/storage?${new URLSearchParams(
6219
+ payload
6220
+ ).toString()}`,
6221
+ getConsoleClientDefaultConfig(authorization)
6222
+ );
6223
+ });
6224
+ },
6225
+ upsert(payload, authorization) {
6226
+ return __async(this, null, function* () {
6227
+ return consoleClientInstance.patch(
6228
+ `/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
6229
+ payload,
6230
+ getConsoleClientDefaultConfig(authorization)
6231
+ );
6232
+ });
6029
6233
  }
6030
6234
  };
6031
6235
 
6032
- // src/apis/platform/adapter/integrations/slack/api.ts
6033
- var platformAdapterSlackApi = {
6034
- events: {
6035
- subscribe(payload, authorization) {
6036
- return __async(this, null, function* () {
6037
- yield adapterClientInstance.post(
6038
- "/integrations/slack/events/subscribe",
6039
- payload,
6040
- getSlackClientConfig(authorization)
6041
- );
6042
- });
6043
- },
6044
- unsubscribe(payload, authorization) {
6045
- return __async(this, null, function* () {
6046
- yield adapterClientInstance.post(
6047
- "/integrations/slack/events/unsubscribe",
6048
- payload,
6049
- getSlackClientConfig(authorization)
6050
- );
6051
- });
6052
- }
6236
+ // src/apis/platform/console/app/blocks/widgets/widget/api.ts
6237
+ var platformConsoleAppWidgetApi = {
6238
+ get(appId, widgetId, authorization) {
6239
+ return __async(this, null, function* () {
6240
+ return consoleClientInstance.get(
6241
+ `/app/${encodeURIComponent(
6242
+ appId
6243
+ )}/blocks/widgets/${encodeURIComponent(widgetId)}`,
6244
+ getConsoleClientDefaultConfig(authorization)
6245
+ );
6246
+ });
6247
+ },
6248
+ upsert(payload, authorization) {
6249
+ return __async(this, null, function* () {
6250
+ return consoleClientInstance.post(
6251
+ `/app/${encodeURIComponent(
6252
+ payload.appId
6253
+ )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
6254
+ payload,
6255
+ getConsoleClientDefaultConfig(authorization)
6256
+ );
6257
+ });
6258
+ },
6259
+ remove(payload, authorization) {
6260
+ return __async(this, null, function* () {
6261
+ return consoleClientInstance.delete(
6262
+ `/app/${encodeURIComponent(
6263
+ payload.appId
6264
+ )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
6265
+ getConsoleClientDefaultConfig(authorization)
6266
+ );
6267
+ });
6053
6268
  }
6054
6269
  };
6055
6270
 
6056
- // src/apis/platform/adapter/integrations/text/api.ts
6057
- var platformAdapterTextApi = {
6058
- events: {
6059
- subscribe(payload, authorization) {
6060
- return __async(this, null, function* () {
6061
- yield adapterClientInstance.post(
6062
- "/integrations/text/events/subscribe",
6063
- payload,
6064
- getTextClientConfig(authorization)
6065
- );
6066
- });
6067
- },
6068
- unsubscribe(payload, authorization) {
6069
- return __async(this, null, function* () {
6070
- yield adapterClientInstance.post(
6071
- "/integrations/text/events/unsubscribe",
6072
- payload,
6073
- getTextClientConfig(authorization)
6074
- );
6075
- });
6076
- }
6271
+ // src/apis/platform/console/app/blocks/widgets/api.ts
6272
+ var platformConsoleAppWidgetsApi = {
6273
+ widget: platformConsoleAppWidgetApi,
6274
+ get(appId, authorization) {
6275
+ return __async(this, null, function* () {
6276
+ return consoleClientInstance.get(
6277
+ `/app/${encodeURIComponent(appId)}/blocks/widgets`,
6278
+ getConsoleClientDefaultConfig(authorization)
6279
+ );
6280
+ });
6281
+ },
6282
+ upsert(payload, authorization) {
6283
+ return __async(this, null, function* () {
6284
+ return consoleClientInstance.post(
6285
+ `/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
6286
+ payload,
6287
+ getConsoleClientDefaultConfig(authorization)
6288
+ );
6289
+ });
6290
+ },
6291
+ remove(payload, authorization) {
6292
+ return __async(this, null, function* () {
6293
+ return consoleClientInstance.delete(
6294
+ `/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
6295
+ getConsoleClientDefaultConfig(authorization)
6296
+ );
6297
+ });
6077
6298
  }
6078
6299
  };
6079
6300
 
6080
- // src/apis/platform/adapter/integrations/api.ts
6081
- var platformAdapterIntegrationsApi = {
6082
- mailchimp: platformAdapterMailchimpApi,
6083
- shopify: platformAdapterShopifyApi,
6084
- hubspot: platformAdapterHubspotApi,
6085
- slack: platformAdapterSlackApi,
6086
- bigcommerce: platformAdapterBigCommerceApi,
6087
- text: platformAdapterTextApi
6301
+ // src/apis/platform/console/app/blocks/api.ts
6302
+ var platformConsoleAppBlocksApi = {
6303
+ authorization: platformConsoleAppAuthorizationApi,
6304
+ monetization: platformConsoleAppMonetizationApi,
6305
+ repository: platformConsoleAppRepositoryApi,
6306
+ deployment: platformConsoleAppDeploymentApi,
6307
+ storage: platformConsoleAppStorageApi,
6308
+ properties: platformConsoleAppPropertiesApi,
6309
+ widgets: platformConsoleAppWidgetsApi
6088
6310
  };
6089
6311
 
6090
- // src/apis/platform/adapter/api.ts
6091
- var platformAdapterApi = {
6092
- app: platformAdapterAppApi,
6093
- integrations: platformAdapterIntegrationsApi,
6094
- log(payload, authorization) {
6312
+ // src/apis/platform/console/app/templates/api.ts
6313
+ var platformConsoleAppTemplatesApi = {
6314
+ getTemplates(authorization) {
6095
6315
  return __async(this, null, function* () {
6096
- return adapterClientInstance.post(
6097
- "/log",
6098
- payload,
6099
- getAdapterClientConfig(authorization)
6316
+ return consoleClientInstance.get(
6317
+ "/app/templates",
6318
+ getConsoleClientDefaultConfig(authorization)
6319
+ );
6320
+ });
6321
+ },
6322
+ getRepositoryTemplates(authorization) {
6323
+ return __async(this, null, function* () {
6324
+ return consoleClientInstance.get(
6325
+ "/app/templates/repository",
6326
+ getConsoleClientDefaultConfig(authorization)
6100
6327
  );
6101
6328
  });
6102
6329
  }
6103
6330
  };
6104
6331
 
6105
- // src/apis/platform/billing/account/api.ts
6106
- var platformBillingAccountApi = {
6107
- getAccount(authorization) {
6332
+ // src/apis/platform/console/app/variables/api.ts
6333
+ var platformConsoleAppVariablesApi = {
6334
+ getVariables(appId, decrypted, authorization) {
6108
6335
  return __async(this, null, function* () {
6109
- try {
6110
- return yield billingClientInstance.get(
6111
- "/v3/account",
6112
- getBillingClientConfig(authorization)
6113
- );
6114
- } catch (error) {
6115
- if (error instanceof Error) {
6116
- throw new Error(`Account couldn't be fetched. [${error.message}]`);
6117
- } else {
6118
- throw error;
6119
- }
6120
- }
6336
+ const response = yield consoleClientInstance.get(
6337
+ `/app/${encodeURIComponent(appId)}/variables`,
6338
+ __spreadValues({
6339
+ params: {
6340
+ decrypted
6341
+ }
6342
+ }, getConsoleClientDefaultConfig(authorization))
6343
+ );
6344
+ return response.data;
6121
6345
  });
6122
6346
  },
6123
- getAccountInfo(product, authorization) {
6347
+ getVariable(appId, key, authorization) {
6124
6348
  return __async(this, null, function* () {
6125
- try {
6126
- return yield billingClientInstance.get(
6127
- `/v3/account/${encodeURIComponent(product)}/billing_info`,
6128
- getBillingClientConfig(authorization)
6129
- );
6130
- } catch (error) {
6131
- if (error instanceof Error) {
6132
- throw new Error(
6133
- `Account billing info couldn't be fetched. [${error.message}]`
6134
- );
6135
- } else {
6136
- throw error;
6137
- }
6138
- }
6349
+ const response = yield consoleClientInstance.get(
6350
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(key)}`,
6351
+ getConsoleClientDefaultConfig(authorization)
6352
+ );
6353
+ return response.data;
6354
+ });
6355
+ },
6356
+ syncVariable(appId, key, payload, authorization) {
6357
+ return __async(this, null, function* () {
6358
+ yield consoleClientInstance.post(
6359
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
6360
+ key
6361
+ )}/sync`,
6362
+ payload,
6363
+ getConsoleClientDefaultConfig(authorization)
6364
+ );
6365
+ });
6366
+ },
6367
+ createVariable(appId, data, authorization) {
6368
+ return __async(this, null, function* () {
6369
+ yield consoleClientInstance.post(
6370
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
6371
+ data.key
6372
+ )}`,
6373
+ data,
6374
+ getConsoleClientDefaultConfig(authorization)
6375
+ );
6376
+ });
6377
+ },
6378
+ editVariable(appId, data, authorization) {
6379
+ return __async(this, null, function* () {
6380
+ yield consoleClientInstance.post(
6381
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
6382
+ data.key
6383
+ )}/edit`,
6384
+ data,
6385
+ getConsoleClientDefaultConfig(authorization)
6386
+ );
6387
+ });
6388
+ },
6389
+ deleteVariable(appId, key) {
6390
+ return __async(this, null, function* () {
6391
+ yield consoleClientInstance.delete(
6392
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(key)}`
6393
+ );
6139
6394
  });
6140
6395
  }
6141
6396
  };
6142
6397
 
6143
- // src/apis/platform/billing/invoices/api.ts
6144
- var platformBillingInvoicesApi = {
6145
- getInvoices(product, authorization) {
6398
+ // src/apis/platform/console/app/api.ts
6399
+ var platformConsoleAppApi = {
6400
+ blocks: platformConsoleAppBlocksApi,
6401
+ variables: platformConsoleAppVariablesApi,
6402
+ templates: platformConsoleAppTemplatesApi,
6403
+ push(payload, authorization) {
6146
6404
  return __async(this, null, function* () {
6147
- try {
6148
- return yield billingClientInstance.get(
6149
- `/v2/invoices/${encodeURIComponent(product)}`,
6150
- getBillingClientConfig(authorization)
6151
- );
6152
- } catch (error) {
6153
- if (error instanceof Error) {
6154
- throw new Error(`Invoices couldn't be fetched. [${error.message}]`);
6155
- } else {
6156
- throw error;
6157
- }
6158
- }
6405
+ return consoleClientInstance.post(
6406
+ `/app${payload.manifest.id ? `/${encodeURIComponent(payload.manifest.id)}` : ""}`,
6407
+ payload,
6408
+ getConsoleClientDefaultConfig(authorization)
6409
+ );
6159
6410
  });
6160
6411
  },
6161
- downloadInvoices(number, authorization) {
6412
+ pull(appId, authorization) {
6162
6413
  return __async(this, null, function* () {
6163
- try {
6164
- const response = yield billingClientInstance.request(__spreadValues({
6165
- url: `https://api.labs.livechatinc.com/v2/invoices/${encodeURIComponent(
6166
- number
6167
- )}`,
6168
- data: new URLSearchParams({
6169
- _method: "GET"
6170
- //gave the values directly for testing
6171
- }),
6172
- responseType: "blob"
6173
- }, getBillingClientConfig(authorization)));
6174
- const href = URL.createObjectURL(response.data);
6175
- const link = document.createElement("a");
6176
- link.href = href;
6177
- link.setAttribute("download", `invoice-${number}.pdf`);
6178
- document.body.appendChild(link);
6179
- link.click();
6180
- document.body.removeChild(link);
6181
- URL.revokeObjectURL(href);
6182
- } catch (error) {
6183
- if (error instanceof Error) {
6184
- throw new Error(`Invoice couldn't be downloaded. [${error.message}]`);
6185
- } else {
6186
- throw error;
6187
- }
6188
- }
6414
+ return consoleClientInstance.get(
6415
+ `/app/${encodeURIComponent(appId)}`,
6416
+ getConsoleClientDefaultConfig(authorization)
6417
+ );
6418
+ });
6419
+ },
6420
+ verify(payload, authorization) {
6421
+ return __async(this, null, function* () {
6422
+ return consoleClientInstance.post(
6423
+ `/app/${encodeURIComponent(payload.appId)}/verify`,
6424
+ payload,
6425
+ getConsoleClientDefaultConfig(authorization)
6426
+ );
6427
+ });
6428
+ },
6429
+ status(sagaId, authorization) {
6430
+ return __async(this, null, function* () {
6431
+ return consoleClientInstance.get(
6432
+ "/app/status",
6433
+ __spreadValues({
6434
+ params: {
6435
+ sagaId
6436
+ }
6437
+ }, getConsoleClientDefaultConfig(authorization))
6438
+ );
6189
6439
  });
6190
6440
  }
6191
6441
  };
6192
6442
 
6193
- // src/apis/platform/billing/api.ts
6194
- var platformBillingApi = {
6195
- account: platformBillingAccountApi,
6196
- invoices: platformBillingInvoicesApi
6443
+ // src/apis/platform/console/api.ts
6444
+ var platformConsoleApi = {
6445
+ app: platformConsoleAppApi,
6446
+ log(payload, authorization) {
6447
+ return __async(this, null, function* () {
6448
+ return consoleClientInstance.post(
6449
+ "/log",
6450
+ payload,
6451
+ getConsoleClientConfig(authorization)
6452
+ );
6453
+ });
6454
+ }
6197
6455
  };
6198
6456
 
6199
6457
  // src/constants/app/templates/repository.ts
@@ -7712,6 +7970,7 @@ var platformApi = {
7712
7970
  accounts: platformAccountsApi,
7713
7971
  billing: platformBillingApi,
7714
7972
  adapter: platformAdapterApi,
7973
+ console: platformConsoleApi,
7715
7974
  dps: platformDpsApi
7716
7975
  };
7717
7976
 
@@ -8412,7 +8671,7 @@ var api2 = {
8412
8671
  isInitialized: false
8413
8672
  };
8414
8673
  function initApi(config, tokens) {
8415
- 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;
8674
+ 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;
8416
8675
  initPlatformAccountsClient(
8417
8676
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
8418
8677
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.token
@@ -8433,19 +8692,29 @@ function initApi(config, tokens) {
8433
8692
  slack: tokens.slack
8434
8693
  } : void 0
8435
8694
  );
8436
- initLiveChatClient((_h = config.urls.products) == null ? void 0 : _h.livechat, (_i = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _i.token);
8437
- initHelpDeskClient((_j = config.urls.products) == null ? void 0 : _j.helpdesk, (_k = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _k.token);
8438
- initTextClient((_l = config.urls.integrations) == null ? void 0 : _l.text, (_m = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _m.token);
8439
- initGithubClient((_n = tokens == null ? void 0 : tokens.github) == null ? void 0 : _n.appToken);
8440
- initNetlifyClient((_o = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _o.token);
8441
- initVercelClient((_p = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _p.token);
8442
- initNeonClient((_q = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _q.token);
8443
- initPlanetScaleClient((_r = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _r.token);
8444
- 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);
8445
- 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);
8446
- 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);
8447
- initHubspotClient((_y = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _y.token);
8448
- initSlackClient((_z = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _z.token);
8695
+ initConsoleClient(
8696
+ (_h = config.urls.platform) == null ? void 0 : _h.console,
8697
+ tokens ? {
8698
+ platform: tokens.platform,
8699
+ github: tokens.github,
8700
+ netlify: tokens.netlify,
8701
+ vercel: tokens.vercel,
8702
+ neon: tokens.neon
8703
+ } : void 0
8704
+ );
8705
+ initLiveChatClient((_i = config.urls.products) == null ? void 0 : _i.livechat, (_j = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _j.token);
8706
+ initHelpDeskClient((_k = config.urls.products) == null ? void 0 : _k.helpdesk, (_l = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _l.token);
8707
+ initTextClient((_m = config.urls.integrations) == null ? void 0 : _m.text, (_n = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _n.token);
8708
+ initGithubClient((_o = tokens == null ? void 0 : tokens.github) == null ? void 0 : _o.appToken);
8709
+ initNetlifyClient((_p = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _p.token);
8710
+ initVercelClient((_q = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _q.token);
8711
+ initNeonClient((_r = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _r.token);
8712
+ initPlanetScaleClient((_s = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _s.token);
8713
+ 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);
8714
+ 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);
8715
+ 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);
8716
+ initHubspotClient((_z = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _z.token);
8717
+ initSlackClient((_A = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _A.token);
8449
8718
  api2.isInitialized = true;
8450
8719
  }
8451
8720
 
@@ -8506,7 +8775,9 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
8506
8775
  BigCommerceApiError,
8507
8776
  BigCommerceEventNames,
8508
8777
  BigCommerceWebhookScopes,
8778
+ ConsoleApiError,
8509
8779
  DpsApiError,
8780
+ GitHubWebhookActions,
8510
8781
  HelpDeskApiError,
8511
8782
  HelpDeskWebhookEventType,
8512
8783
  HubSpotWebhookEventTypes,
@@ -8547,31 +8818,43 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
8547
8818
  bigcommerceEventsZods,
8548
8819
  billingClientInstance,
8549
8820
  buildUrlFromSegments,
8821
+ consoleClientInstance,
8550
8822
  dpsClientInstance,
8551
8823
  getAdapterClientConfig,
8552
8824
  getAdapterClientDefaultConfig,
8553
8825
  getAppAutoReviewPayload,
8826
+ getBigCommerceClientAuthorization,
8554
8827
  getBigCommerceClientConfig,
8555
8828
  getBigCommerceClientUrl,
8556
8829
  getBillingClientConfig,
8830
+ getConsoleClientConfig,
8831
+ getConsoleClientDefaultConfig,
8557
8832
  getDpsClientConfig,
8558
8833
  getEmptyAppAutoReview,
8834
+ getGitHubClientAuthorization,
8559
8835
  getGithubClientConfig,
8560
8836
  getHelpDeskClientConfig,
8837
+ getHubspotClientAuthorization,
8561
8838
  getHubspotClientConfig,
8562
8839
  getIntegrationFlowUrl,
8563
8840
  getIntegrationFlowUrlForRedirection,
8564
8841
  getLiveChatClientConfig,
8842
+ getMailchimpClientAuthorization,
8565
8843
  getMailchimpClientConfig,
8566
8844
  getMailchimpClientUrl,
8567
8845
  getNeonClientConfig,
8846
+ getNetlifyClientAuthorization,
8568
8847
  getNetlifyClientConfig,
8569
8848
  getPlanetScaleClientConfig,
8570
8849
  getRegion,
8850
+ getShopifyClientAuthorization,
8571
8851
  getShopifyClientConfig,
8572
8852
  getShopifyClientUrl,
8853
+ getSlackClientAuthorization,
8573
8854
  getSlackClientConfig,
8855
+ getTextClientAuthorization,
8574
8856
  getTextClientConfig,
8857
+ getVercelClientAuthorization,
8575
8858
  getVercelClientConfig,
8576
8859
  githubClientInstance,
8577
8860
  helpdeskClientInstance,
@@ -8581,6 +8864,7 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
8581
8864
  initApi,
8582
8865
  initBigCommerceClient,
8583
8866
  initBillingClient,
8867
+ initConsoleClient,
8584
8868
  initDpsClient,
8585
8869
  initGithubClient,
8586
8870
  initHelpDeskClient,
@@ -8613,6 +8897,7 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
8613
8897
  textLivechatEventsZods,
8614
8898
  updateAdapterClient,
8615
8899
  updateBigCommerceClient,
8900
+ updateConsoleClient,
8616
8901
  updateGithubClient,
8617
8902
  updateHubspotClient,
8618
8903
  updateMailchimpClient,