@livechat/developer-studio-api 3.4.24 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -75,6 +75,7 @@ __export(src_exports, {
75
75
  BigCommerceApiError: () => BigCommerceApiError,
76
76
  BigCommerceEventNames: () => BigCommerceEventNames,
77
77
  BigCommerceWebhookScopes: () => BigCommerceWebhookScopes,
78
+ ConsoleApiError: () => ConsoleApiError,
78
79
  DpsApiError: () => DpsApiError,
79
80
  HelpDeskApiError: () => HelpDeskApiError,
80
81
  HelpDeskWebhookEventType: () => HelpDeskWebhookEventType,
@@ -116,31 +117,43 @@ __export(src_exports, {
116
117
  bigcommerceEventsZods: () => bigcommerceEventsZods,
117
118
  billingClientInstance: () => billingClientInstance,
118
119
  buildUrlFromSegments: () => buildUrlFromSegments,
120
+ consoleClientInstance: () => consoleClientInstance,
119
121
  dpsClientInstance: () => dpsClientInstance,
120
122
  getAdapterClientConfig: () => getAdapterClientConfig,
121
123
  getAdapterClientDefaultConfig: () => getAdapterClientDefaultConfig,
122
124
  getAppAutoReviewPayload: () => getAppAutoReviewPayload,
125
+ getBigCommerceClientAuthorization: () => getBigCommerceClientAuthorization,
123
126
  getBigCommerceClientConfig: () => getBigCommerceClientConfig,
124
127
  getBigCommerceClientUrl: () => getBigCommerceClientUrl,
125
128
  getBillingClientConfig: () => getBillingClientConfig,
129
+ getConsoleClientConfig: () => getConsoleClientConfig,
130
+ getConsoleClientDefaultConfig: () => getConsoleClientDefaultConfig,
126
131
  getDpsClientConfig: () => getDpsClientConfig,
127
132
  getEmptyAppAutoReview: () => getEmptyAppAutoReview,
133
+ getGitHubClientAuthorization: () => getGitHubClientAuthorization,
128
134
  getGithubClientConfig: () => getGithubClientConfig,
129
135
  getHelpDeskClientConfig: () => getHelpDeskClientConfig,
136
+ getHubspotClientAuthorization: () => getHubspotClientAuthorization,
130
137
  getHubspotClientConfig: () => getHubspotClientConfig,
131
138
  getIntegrationFlowUrl: () => getIntegrationFlowUrl,
132
139
  getIntegrationFlowUrlForRedirection: () => getIntegrationFlowUrlForRedirection,
133
140
  getLiveChatClientConfig: () => getLiveChatClientConfig,
141
+ getMailchimpClientAuthorization: () => getMailchimpClientAuthorization,
134
142
  getMailchimpClientConfig: () => getMailchimpClientConfig,
135
143
  getMailchimpClientUrl: () => getMailchimpClientUrl,
136
144
  getNeonClientConfig: () => getNeonClientConfig,
145
+ getNetlifyClientAuthorization: () => getNetlifyClientAuthorization,
137
146
  getNetlifyClientConfig: () => getNetlifyClientConfig,
138
147
  getPlanetScaleClientConfig: () => getPlanetScaleClientConfig,
139
- getRegion: () => getRegion2,
148
+ getRegion: () => getRegion3,
149
+ getShopifyClientAuthorization: () => getShopifyClientAuthorization,
140
150
  getShopifyClientConfig: () => getShopifyClientConfig,
141
151
  getShopifyClientUrl: () => getShopifyClientUrl,
152
+ getSlackClientAuthorization: () => getSlackClientAuthorization,
142
153
  getSlackClientConfig: () => getSlackClientConfig,
154
+ getTextClientAuthorization: () => getTextClientAuthorization,
143
155
  getTextClientConfig: () => getTextClientConfig,
156
+ getVercelClientAuthorization: () => getVercelClientAuthorization,
144
157
  getVercelClientConfig: () => getVercelClientConfig,
145
158
  githubClientInstance: () => githubClientInstance,
146
159
  helpdeskClientInstance: () => helpdeskClientInstance,
@@ -150,6 +163,7 @@ __export(src_exports, {
150
163
  initApi: () => initApi,
151
164
  initBigCommerceClient: () => initBigCommerceClient,
152
165
  initBillingClient: () => initBillingClient,
166
+ initConsoleClient: () => initConsoleClient,
153
167
  initDpsClient: () => initDpsClient,
154
168
  initGithubClient: () => initGithubClient,
155
169
  initHelpDeskClient: () => initHelpDeskClient,
@@ -182,6 +196,7 @@ __export(src_exports, {
182
196
  textLivechatEventsZods: () => textLivechatEventsZods,
183
197
  updateAdapterClient: () => updateAdapterClient,
184
198
  updateBigCommerceClient: () => updateBigCommerceClient,
199
+ updateConsoleClient: () => updateConsoleClient,
185
200
  updateGithubClient: () => updateGithubClient,
186
201
  updateHubspotClient: () => updateHubspotClient,
187
202
  updateMailchimpClient: () => updateMailchimpClient,
@@ -313,6 +328,18 @@ var UnauthorizeApiError = class extends Error {
313
328
  };
314
329
 
315
330
  // src/apis/integrations/bigcommerce/instance.ts
331
+ function getBigCommerceClientAuthorization(req, headerPrefix = "x-adapter-bigcommerce") {
332
+ if (req.headers instanceof Headers) {
333
+ return {
334
+ shop: req.headers.get(`${headerPrefix}-shop`),
335
+ token: req.headers.get(`${headerPrefix}-token`)
336
+ };
337
+ }
338
+ return {
339
+ shop: req.headers[`${headerPrefix}-shop`],
340
+ token: req.headers[`${headerPrefix}-token`]
341
+ };
342
+ }
316
343
  var BigCommerceApiError = class extends ApiErrorBase {
317
344
  constructor() {
318
345
  super(...arguments);
@@ -451,6 +478,18 @@ var import_axios5 = __toESM(require("axios"));
451
478
 
452
479
  // src/apis/integrations/github/instance.ts
453
480
  var import_axios3 = __toESM(require("axios"));
481
+ function getGitHubClientAuthorization(req, headerPrefix = "x-adapter-github") {
482
+ if (req.headers instanceof Headers) {
483
+ return {
484
+ appToken: req.headers.get(`${headerPrefix}-app-token`),
485
+ oauthToken: req.headers.get(`${headerPrefix}-oauth-token`)
486
+ };
487
+ }
488
+ return {
489
+ appToken: req.headers[`${headerPrefix}-app-token`],
490
+ oauthToken: req.headers[`${headerPrefix}-oauth-token`]
491
+ };
492
+ }
454
493
  var githubClientInstance = import_axios3.default.create({
455
494
  baseURL: "https://api.github.com",
456
495
  headers: {
@@ -904,6 +943,16 @@ var gitHubApi = {
904
943
 
905
944
  // src/apis/integrations/hubspot/instance.ts
906
945
  var import_axios6 = __toESM(require("axios"));
946
+ function getHubspotClientAuthorization(req, headerPrefix = "x-adapter-hubspot") {
947
+ if (req.headers instanceof Headers) {
948
+ return {
949
+ token: req.headers.get(`${headerPrefix}-token`)
950
+ };
951
+ }
952
+ return {
953
+ token: req.headers[`${headerPrefix}-token`]
954
+ };
955
+ }
907
956
  var HubspotApiError = class extends ApiErrorBase {
908
957
  constructor() {
909
958
  super(...arguments);
@@ -1125,6 +1174,18 @@ var import_axios8 = __toESM(require("axios"));
1125
1174
 
1126
1175
  // src/apis/integrations/mailchimp/instance.ts
1127
1176
  var import_axios7 = __toESM(require("axios"));
1177
+ function getMailchimpClientAuthorization(req, headerPrefix = "x-adapter-mailchimp") {
1178
+ if (req.headers instanceof Headers) {
1179
+ return {
1180
+ server: req.headers.get(`${headerPrefix}-server`),
1181
+ token: req.headers.get(`${headerPrefix}-token`)
1182
+ };
1183
+ }
1184
+ return {
1185
+ server: req.headers[`${headerPrefix}-server`],
1186
+ token: req.headers[`${headerPrefix}-token`]
1187
+ };
1188
+ }
1128
1189
  var MailchimpApiError = class extends ApiErrorBase {
1129
1190
  constructor() {
1130
1191
  super(...arguments);
@@ -1622,6 +1683,16 @@ var import_axios12 = require("axios");
1622
1683
 
1623
1684
  // src/apis/integrations/netlify/instance.ts
1624
1685
  var import_axios11 = __toESM(require("axios"));
1686
+ function getNetlifyClientAuthorization(req, headerPrefix = "x-adapter-netlify-token") {
1687
+ if (req.headers instanceof Headers) {
1688
+ return {
1689
+ token: req.headers.get(`${headerPrefix}-token`)
1690
+ };
1691
+ }
1692
+ return {
1693
+ token: req.headers[`${headerPrefix}-token`]
1694
+ };
1695
+ }
1625
1696
  var netlifyClientInstance = import_axios11.default.create({
1626
1697
  baseURL: "https://api.netlify.com/api/v1",
1627
1698
  headers: {
@@ -2385,6 +2456,18 @@ var import_axios18 = __toESM(require("axios"));
2385
2456
 
2386
2457
  // src/apis/integrations/shopify/instance.ts
2387
2458
  var import_axios17 = __toESM(require("axios"));
2459
+ function getShopifyClientAuthorization(req, headerPrefix = "x-adapter-shopify") {
2460
+ if (req.headers instanceof Headers) {
2461
+ return {
2462
+ shop: req.headers.get(`${headerPrefix}-shop`),
2463
+ token: req.headers.get(`${headerPrefix}-token`)
2464
+ };
2465
+ }
2466
+ return {
2467
+ shop: req.headers[`${headerPrefix}-shop`],
2468
+ token: req.headers[`${headerPrefix}-token`]
2469
+ };
2470
+ }
2388
2471
  var ShopifyApiError = class extends ApiErrorBase {
2389
2472
  constructor() {
2390
2473
  super(...arguments);
@@ -2527,6 +2610,16 @@ var SlackApiError = class extends ApiErrorBase {
2527
2610
  this.name = "slack";
2528
2611
  }
2529
2612
  };
2613
+ function getSlackClientAuthorization(req, headerPrefix = "x-adapter-slack") {
2614
+ if (req.headers instanceof Headers) {
2615
+ return {
2616
+ token: req.headers.get(`${headerPrefix}-token`)
2617
+ };
2618
+ }
2619
+ return {
2620
+ token: req.headers[`${headerPrefix}-token`]
2621
+ };
2622
+ }
2530
2623
  var slackClientInstance = import_axios19.default.create({
2531
2624
  baseURL: "https://slack.com/api",
2532
2625
  headers: {
@@ -2631,6 +2724,18 @@ var slackApi = {
2631
2724
 
2632
2725
  // src/apis/integrations/text/instance.ts
2633
2726
  var import_axios20 = __toESM(require("axios"));
2727
+ function getTextClientAuthorization(req, headerPrefix = "x-adapter-text") {
2728
+ if (req.headers instanceof Headers) {
2729
+ return {
2730
+ token: req.headers.get(`${headerPrefix}-token`),
2731
+ tokenType: "Bearer"
2732
+ };
2733
+ }
2734
+ return {
2735
+ token: req.headers[`${headerPrefix}-token`],
2736
+ tokenType: "Bearer"
2737
+ };
2738
+ }
2634
2739
  var TextApiError = class extends ApiErrorBase {
2635
2740
  constructor() {
2636
2741
  super(...arguments);
@@ -2907,6 +3012,16 @@ var WorkflowExecutionStatus = /* @__PURE__ */ ((WorkflowExecutionStatus2) => {
2907
3012
 
2908
3013
  // src/apis/integrations/vercel/instance.ts
2909
3014
  var import_axios21 = __toESM(require("axios"));
3015
+ function getVercelClientAuthorization(req, headerPrefix = "x-adapter-vercel") {
3016
+ if (req.headers instanceof Headers) {
3017
+ return {
3018
+ token: req.headers.get(`${headerPrefix}-token`)
3019
+ };
3020
+ }
3021
+ return {
3022
+ token: req.headers[`${headerPrefix}-token`]
3023
+ };
3024
+ }
2910
3025
  var vercelClientInstance = import_axios21.default.create({
2911
3026
  baseURL: "https://api.vercel.com"
2912
3027
  });
@@ -3849,6 +3964,147 @@ function initBillingClient(baseUrl, token) {
3849
3964
  }
3850
3965
  }
3851
3966
 
3967
+ // src/apis/platform/console/instance.ts
3968
+ var import_axios24 = __toESM(require("axios"));
3969
+ var REGION2 = {
3970
+ FRA: "fra",
3971
+ DAL: "dal",
3972
+ FRA_A: "fra-a",
3973
+ FRA_B: "fra-b"
3974
+ };
3975
+ var supportedRegions2 = Object.values(REGION2);
3976
+ var getRegion2 = (token) => {
3977
+ const region = token.split(":")[0];
3978
+ if (supportedRegions2.includes(region)) {
3979
+ return region;
3980
+ }
3981
+ };
3982
+ var ConsoleApiError = class _ConsoleApiError extends ApiErrorBase {
3983
+ constructor() {
3984
+ super(...arguments);
3985
+ this.name = "console";
3986
+ }
3987
+ static notFound(message) {
3988
+ return new _ConsoleApiError(
3989
+ message != null ? message : "Not found",
3990
+ {
3991
+ errorCode: "not_found",
3992
+ errorMessage: "Not found"
3993
+ },
3994
+ 404
3995
+ );
3996
+ }
3997
+ };
3998
+ var consoleClientInstance = import_axios24.default.create({
3999
+ baseURL: "https://platform.labs.text.com/console/api",
4000
+ headers: {
4001
+ "Content-Type": "application/json"
4002
+ }
4003
+ });
4004
+ consoleClientInstance.interceptors.response.use(
4005
+ (response) => response,
4006
+ (error) => {
4007
+ var _a, _b;
4008
+ const apiError = (_a = error.response) == null ? void 0 : _a.data;
4009
+ if ((apiError == null ? void 0 : apiError.kind) === "unauthorized") {
4010
+ return Promise.reject(new UnauthorizeApiError(apiError.source));
4011
+ } else if ((apiError == null ? void 0 : apiError.kind) === "error") {
4012
+ const data = (_b = error.response) == null ? void 0 : _b.data;
4013
+ return Promise.reject(
4014
+ new ConsoleApiError(data.message, data.data, data.code)
4015
+ );
4016
+ }
4017
+ return Promise.reject(error);
4018
+ }
4019
+ );
4020
+ function getConsoleClientConfig(options = {}) {
4021
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
4022
+ const currentHeaders = consoleClientInstance.defaults.headers;
4023
+ const headers = {
4024
+ platform: {
4025
+ 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
4026
+ },
4027
+ integrations: {
4028
+ github: {
4029
+ app: (_e = currentHeaders["x-adapter-github-app-token"]) != null ? _e : (_d = options.github) == null ? void 0 : _d.appToken,
4030
+ oauth: (_g = currentHeaders["x-adapter-github-oauth-token"]) != null ? _g : (_f = options.github) == null ? void 0 : _f.oauthToken
4031
+ },
4032
+ netlify: (_i = currentHeaders["x-adapter-netlify-token"]) != null ? _i : (_h = options.netlify) == null ? void 0 : _h.token,
4033
+ vercel: (_k = currentHeaders["x-adapter-vercel-token"]) != null ? _k : (_j = options.vercel) == null ? void 0 : _j.token,
4034
+ planetscale: (_m = currentHeaders["x-adapter-planetscale-token"]) != null ? _m : (_l = options.planetscale) == null ? void 0 : _l.token,
4035
+ neon: (_o = currentHeaders["x-adapter-neon-token"]) != null ? _o : (_n = options.neon) == null ? void 0 : _n.token
4036
+ }
4037
+ };
4038
+ if (currentHeaders.Authorization) {
4039
+ currentHeaders["X-Region"] = (_p = getRegion2(currentHeaders.Authorization)) != null ? _p : void 0;
4040
+ }
4041
+ if (((_q = options.ensureAuthorizationToken) == null ? void 0 : _q.platform) && !headers.platform.token) {
4042
+ throw new UnauthorizeApiError("accounts");
4043
+ }
4044
+ if (((_r = options.ensureAuthorizationToken) == null ? void 0 : _r.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
4045
+ throw new UnauthorizeApiError("github");
4046
+ }
4047
+ if (((_s = options.ensureAuthorizationToken) == null ? void 0 : _s.vercel) && !headers.integrations.vercel) {
4048
+ throw new UnauthorizeApiError("vercel");
4049
+ }
4050
+ if (((_t = options.ensureAuthorizationToken) == null ? void 0 : _t.netlify) && !headers.integrations.netlify) {
4051
+ throw new UnauthorizeApiError("netlify");
4052
+ }
4053
+ if (((_u = options.ensureAuthorizationToken) == null ? void 0 : _u.planetscale) && !headers.integrations.planetscale) {
4054
+ throw new UnauthorizeApiError("planetscale");
4055
+ }
4056
+ if (((_v = options.ensureAuthorizationToken) == null ? void 0 : _v.neon) && !headers.integrations.neon) {
4057
+ throw new UnauthorizeApiError("neon");
4058
+ }
4059
+ return {
4060
+ 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 } : {})
4061
+ };
4062
+ }
4063
+ var getConsoleClientDefaultConfig = (authorization) => getConsoleClientConfig(__spreadProps(__spreadValues({}, authorization), {
4064
+ ensureAuthorizationToken: {
4065
+ platform: true
4066
+ }
4067
+ }));
4068
+ function initConsoleClient(baseUrl, tokens) {
4069
+ if (baseUrl) {
4070
+ consoleClientInstance.interceptors.request.use(
4071
+ (config) => {
4072
+ config.baseURL = baseUrl;
4073
+ return config;
4074
+ },
4075
+ (error) => Promise.reject(error)
4076
+ );
4077
+ }
4078
+ if (tokens) {
4079
+ updateConsoleClient(tokens);
4080
+ }
4081
+ }
4082
+ function updateConsoleClient(tokens) {
4083
+ var _a, _b, _c, _d, _e, _f, _g, _h;
4084
+ const headers = consoleClientInstance.defaults.headers;
4085
+ if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
4086
+ headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
4087
+ }
4088
+ if ((_c = tokens == null ? void 0 : tokens.github) == null ? void 0 : _c.appToken) {
4089
+ headers["x-adapter-github-app-token"] = tokens.github.appToken;
4090
+ }
4091
+ if ((_d = tokens == null ? void 0 : tokens.github) == null ? void 0 : _d.oauthToken) {
4092
+ headers["x-adapter-github-oauth-token"] = tokens.github.oauthToken;
4093
+ }
4094
+ if ((_e = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _e.token) {
4095
+ headers["x-adapter-netlify-token"] = tokens.netlify.token;
4096
+ }
4097
+ if ((_f = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _f.token) {
4098
+ headers["x-adapter-vercel-token"] = tokens.vercel.token;
4099
+ }
4100
+ if ((_g = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _g.token) {
4101
+ headers["x-adapter-planetscale-token"] = tokens.planetscale.token;
4102
+ }
4103
+ if ((_h = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _h.token) {
4104
+ headers["x-adapter-neon-token"] = tokens.neon.token;
4105
+ }
4106
+ }
4107
+
3852
4108
  // src/apis/platform/dps/applications/application/autoReview/_contracts/dtos/autoReview.ts
3853
4109
  var getEmptyAppAutoReview = () => ({
3854
4110
  isReviewed: false,
@@ -3918,14 +4174,14 @@ var getAppAutoReviewPayload = (value) => {
3918
4174
  };
3919
4175
 
3920
4176
  // src/apis/platform/dps/instance.ts
3921
- var import_axios24 = __toESM(require("axios"));
4177
+ var import_axios25 = __toESM(require("axios"));
3922
4178
  var DpsApiError = class extends ApiErrorBase {
3923
4179
  constructor() {
3924
4180
  super(...arguments);
3925
4181
  this.name = "dps";
3926
4182
  }
3927
4183
  };
3928
- var dpsClientInstance = import_axios24.default.create({
4184
+ var dpsClientInstance = import_axios25.default.create({
3929
4185
  baseURL: "https://dev-platform.labs.livechatinc.com"
3930
4186
  });
3931
4187
  dpsClientInstance.interceptors.response.use(
@@ -3974,14 +4230,14 @@ function initDpsClient(baseUrl, token) {
3974
4230
  }
3975
4231
 
3976
4232
  // src/apis/products/helpdesk/instance.ts
3977
- var import_axios25 = __toESM(require("axios"));
4233
+ var import_axios26 = __toESM(require("axios"));
3978
4234
  var HelpDeskApiError = class extends ApiErrorBase {
3979
4235
  constructor() {
3980
4236
  super(...arguments);
3981
4237
  this.name = "helpdesk";
3982
4238
  }
3983
4239
  };
3984
- var helpdeskClientInstance = import_axios25.default.create({
4240
+ var helpdeskClientInstance = import_axios26.default.create({
3985
4241
  baseURL: "https://api.labs.helpdesk.com"
3986
4242
  });
3987
4243
  helpdeskClientInstance.interceptors.response.use(
@@ -4069,17 +4325,17 @@ var LivechatWebhookSystemMessages = /* @__PURE__ */ ((LivechatWebhookSystemMessa
4069
4325
  })(LivechatWebhookSystemMessages || {});
4070
4326
 
4071
4327
  // src/apis/products/livechat/instance.ts
4072
- var import_axios26 = __toESM(require("axios"));
4073
- var REGION2 = {
4328
+ var import_axios27 = __toESM(require("axios"));
4329
+ var REGION3 = {
4074
4330
  FRA: "fra",
4075
4331
  DAL: "dal",
4076
4332
  FRA_A: "fra-a",
4077
4333
  FRA_B: "fra-b"
4078
4334
  };
4079
- var supportedRegions2 = Object.values(REGION2);
4080
- var getRegion2 = (token) => {
4335
+ var supportedRegions3 = Object.values(REGION3);
4336
+ var getRegion3 = (token) => {
4081
4337
  const region = token.split(":")[0];
4082
- if (supportedRegions2.includes(region)) {
4338
+ if (supportedRegions3.includes(region)) {
4083
4339
  return region;
4084
4340
  }
4085
4341
  };
@@ -4089,7 +4345,7 @@ var LivechatApiError = class extends ApiErrorBase {
4089
4345
  this.name = "livechat";
4090
4346
  }
4091
4347
  };
4092
- var livechatClientInstance = import_axios26.default.create({
4348
+ var livechatClientInstance = import_axios27.default.create({
4093
4349
  baseURL: "https://api.labs.livechatinc.com"
4094
4350
  });
4095
4351
  livechatClientInstance.interceptors.response.use(
@@ -4124,7 +4380,7 @@ function getLiveChatClientConfig(options = {}) {
4124
4380
  };
4125
4381
  }
4126
4382
  function initLiveChatClient(baseUrl, token) {
4127
- const region = token ? getRegion2(token) : void 0;
4383
+ const region = token ? getRegion3(token) : void 0;
4128
4384
  const headers = livechatClientInstance.defaults.headers;
4129
4385
  if (baseUrl) {
4130
4386
  livechatClientInstance.interceptors.request.use(
@@ -4485,7 +4741,8 @@ var urls = {
4485
4741
  create: () => getUrl(),
4486
4742
  update: (id) => getUrl([id]),
4487
4743
  delete: (id) => getUrl([id]),
4488
- connect: (id) => getUrl([id, "connection"])
4744
+ connect: (id) => getUrl([id, "connection"]),
4745
+ disconnect: (id) => getUrl([id, "disconnect"])
4489
4746
  };
4490
4747
  var textPlatformWorkflowsCredentialsApi = {
4491
4748
  meta: {
@@ -4597,6 +4854,24 @@ var textPlatformWorkflowsCredentialsApi = {
4597
4854
  throw error;
4598
4855
  });
4599
4856
  });
4857
+ },
4858
+ disconnect(id, authorization) {
4859
+ return __async(this, null, function* () {
4860
+ return textClientInstance.put(
4861
+ urls.disconnect(id),
4862
+ {},
4863
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4864
+ ensureAuthorizationToken: true
4865
+ }))
4866
+ ).catch((error) => {
4867
+ if (error instanceof TextApiError) {
4868
+ throw error.withCustomMessage(
4869
+ `Couldn't disconnect to credentials. [${error.message}]`
4870
+ );
4871
+ }
4872
+ throw error;
4873
+ });
4874
+ });
4600
4875
  }
4601
4876
  };
4602
4877
 
@@ -4830,7 +5105,7 @@ var textApi = {
4830
5105
  };
4831
5106
 
4832
5107
  // src/apis/integrations/vercel/api.ts
4833
- var import_axios27 = __toESM(require("axios"));
5108
+ var import_axios28 = __toESM(require("axios"));
4834
5109
 
4835
5110
  // src/apis/integrations/vercel/deploy/api.ts
4836
5111
  var vercelDeployApi = {
@@ -5090,7 +5365,7 @@ var vercelApi = {
5090
5365
  client_secret: clientSecret,
5091
5366
  redirect_uri: redirectUrl
5092
5367
  });
5093
- const response = yield import_axios27.default.post("https://api.vercel.com/v2/oauth/access_token", data, {
5368
+ const response = yield import_axios28.default.post("https://api.vercel.com/v2/oauth/access_token", data, {
5094
5369
  headers: {
5095
5370
  "Content-Type": "application/x-www-form-urlencoded"
5096
5371
  }
@@ -5431,769 +5706,767 @@ var platformAccountsApi = {
5431
5706
  token: platformAccountsTokenApi
5432
5707
  };
5433
5708
 
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
- });
5709
+ // src/apis/platform/adapter/integrations/bigcommerce/api.ts
5710
+ var platformAdapterBigCommerceApi = {
5711
+ events: {
5712
+ subscribe(payload, authorization) {
5713
+ return __async(this, null, function* () {
5714
+ yield adapterClientInstance.post(
5715
+ "/integrations/bigcommerce/events/subscribe",
5716
+ payload,
5717
+ getBigCommerceClientConfig(authorization)
5718
+ );
5719
+ });
5720
+ },
5721
+ unsubscribe(payload, authorization) {
5722
+ return __async(this, null, function* () {
5723
+ yield adapterClientInstance.post(
5724
+ "/integrations/bigcommerce/events/unsubscribe",
5725
+ payload,
5726
+ getBigCommerceClientConfig(authorization)
5727
+ );
5728
+ });
5729
+ }
5469
5730
  }
5470
5731
  };
5471
5732
 
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) {
5500
- 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
- );
5509
- });
5510
- },
5511
- upsert(payload, authorization) {
5512
- return __async(this, null, function* () {
5513
- return adapterClientInstance.patch(
5514
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5515
- payload,
5516
- getAdapterClientDefaultConfig(authorization)
5517
- );
5518
- });
5733
+ // src/apis/platform/adapter/integrations/hubspot/api.ts
5734
+ var platformAdapterHubspotApi = {
5735
+ events: {
5736
+ subscribe(payload, authorization) {
5737
+ return __async(this, null, function* () {
5738
+ yield adapterClientInstance.post(
5739
+ "/integrations/hubspot/events/subscribe",
5740
+ payload,
5741
+ getHubspotClientConfig(authorization)
5742
+ );
5743
+ });
5744
+ },
5745
+ unsubscribe(payload, authorization) {
5746
+ return __async(this, null, function* () {
5747
+ yield adapterClientInstance.post(
5748
+ "/integrations/hubspot/events/unsubscribe",
5749
+ payload,
5750
+ getHubspotClientConfig(authorization)
5751
+ );
5752
+ });
5753
+ }
5519
5754
  }
5520
5755
  };
5521
5756
 
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) {
5757
+ // src/apis/platform/adapter/integrations/mailchimp/api.ts
5758
+ var platformAdapterMailchimpApi = {
5759
+ events: {
5760
+ subscribe(payload, authorization) {
5761
+ return __async(this, null, function* () {
5762
+ yield adapterClientInstance.post(
5763
+ "/integrations/mailchimp/events/subscribe",
5764
+ payload,
5765
+ getMailchimpClientConfig(authorization)
5766
+ );
5767
+ });
5768
+ },
5769
+ unsubscribe(payload, authorization) {
5770
+ return __async(this, null, function* () {
5771
+ yield adapterClientInstance.post(
5772
+ "/integrations/mailchimp/events/unsubscribe",
5773
+ payload,
5774
+ getMailchimpClientConfig(authorization)
5775
+ );
5776
+ });
5777
+ }
5778
+ }
5779
+ };
5780
+
5781
+ // src/apis/platform/adapter/integrations/shopify/api.ts
5782
+ var platformAdapterShopifyApi = {
5783
+ events: {
5784
+ subscribe(payload, authorization) {
5785
+ return __async(this, null, function* () {
5786
+ yield adapterClientInstance.post(
5787
+ "/integrations/shopify/events/subscribe",
5788
+ payload,
5789
+ getShopifyClientConfig(authorization)
5790
+ );
5791
+ });
5792
+ },
5793
+ unsubscribe(payload, authorization) {
5794
+ return __async(this, null, function* () {
5795
+ yield adapterClientInstance.post(
5796
+ "/integrations/shopify/events/unsubscribe",
5797
+ payload,
5798
+ getShopifyClientConfig(authorization)
5799
+ );
5800
+ });
5801
+ }
5802
+ }
5803
+ };
5804
+
5805
+ // src/apis/platform/adapter/integrations/slack/api.ts
5806
+ var platformAdapterSlackApi = {
5807
+ events: {
5808
+ subscribe(payload, authorization) {
5809
+ return __async(this, null, function* () {
5810
+ yield adapterClientInstance.post(
5811
+ "/integrations/slack/events/subscribe",
5812
+ payload,
5813
+ getSlackClientConfig(authorization)
5814
+ );
5815
+ });
5816
+ },
5817
+ unsubscribe(payload, authorization) {
5818
+ return __async(this, null, function* () {
5819
+ yield adapterClientInstance.post(
5820
+ "/integrations/slack/events/unsubscribe",
5821
+ payload,
5822
+ getSlackClientConfig(authorization)
5823
+ );
5824
+ });
5825
+ }
5826
+ }
5827
+ };
5828
+
5829
+ // src/apis/platform/adapter/integrations/text/api.ts
5830
+ var platformAdapterTextApi = {
5831
+ events: {
5832
+ subscribe(payload, authorization) {
5833
+ return __async(this, null, function* () {
5834
+ yield adapterClientInstance.post(
5835
+ "/integrations/text/events/subscribe",
5836
+ payload,
5837
+ getTextClientConfig(authorization)
5838
+ );
5839
+ });
5840
+ },
5841
+ unsubscribe(payload, authorization) {
5842
+ return __async(this, null, function* () {
5843
+ yield adapterClientInstance.post(
5844
+ "/integrations/text/events/unsubscribe",
5845
+ payload,
5846
+ getTextClientConfig(authorization)
5847
+ );
5848
+ });
5849
+ }
5850
+ }
5851
+ };
5852
+
5853
+ // src/apis/platform/adapter/integrations/api.ts
5854
+ var platformAdapterIntegrationsApi = {
5855
+ mailchimp: platformAdapterMailchimpApi,
5856
+ shopify: platformAdapterShopifyApi,
5857
+ hubspot: platformAdapterHubspotApi,
5858
+ slack: platformAdapterSlackApi,
5859
+ bigcommerce: platformAdapterBigCommerceApi,
5860
+ text: platformAdapterTextApi
5861
+ };
5862
+
5863
+ // src/apis/platform/adapter/api.ts
5864
+ var platformAdapterApi = {
5865
+ integrations: platformAdapterIntegrationsApi
5866
+ };
5867
+
5868
+ // src/apis/platform/billing/account/api.ts
5869
+ var platformBillingAccountApi = {
5870
+ getAccount(authorization) {
5533
5871
  return __async(this, null, function* () {
5534
- return adapterClientInstance.post(
5535
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5536
- payload,
5537
- getAdapterClientDefaultConfig(authorization)
5538
- );
5872
+ try {
5873
+ return yield billingClientInstance.get(
5874
+ "/v3/account",
5875
+ getBillingClientConfig(authorization)
5876
+ );
5877
+ } catch (error) {
5878
+ if (error instanceof Error) {
5879
+ throw new Error(`Account couldn't be fetched. [${error.message}]`);
5880
+ } else {
5881
+ throw error;
5882
+ }
5883
+ }
5539
5884
  });
5540
5885
  },
5541
- remove(payload, authorization) {
5886
+ getAccountInfo(product, authorization) {
5542
5887
  return __async(this, null, function* () {
5543
- return adapterClientInstance.delete(
5544
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5545
- getAdapterClientDefaultConfig(authorization)
5546
- );
5888
+ try {
5889
+ return yield billingClientInstance.get(
5890
+ `/v3/account/${encodeURIComponent(product)}/billing_info`,
5891
+ getBillingClientConfig(authorization)
5892
+ );
5893
+ } catch (error) {
5894
+ if (error instanceof Error) {
5895
+ throw new Error(
5896
+ `Account billing info couldn't be fetched. [${error.message}]`
5897
+ );
5898
+ } else {
5899
+ throw error;
5900
+ }
5901
+ }
5547
5902
  });
5548
5903
  }
5549
5904
  };
5550
5905
 
5551
- // src/apis/platform/adapter/app/blocks/properties/property/api.ts
5552
- var platformAdapterAppPropertyApi = {
5553
- get(appId, propertyId, authorization) {
5554
- return __async(this, null, function* () {
5555
- return adapterClientInstance.get(
5556
- `/console/app/${encodeURIComponent(
5557
- appId
5558
- )}/blocks/properties/${encodeURIComponent(propertyId)}`,
5559
- getAdapterClientDefaultConfig(authorization)
5560
- );
5561
- });
5562
- },
5563
- upsert(payload, authorization) {
5906
+ // src/apis/platform/billing/invoices/api.ts
5907
+ var platformBillingInvoicesApi = {
5908
+ getInvoices(product, authorization) {
5564
5909
  return __async(this, null, function* () {
5565
- return adapterClientInstance.post(
5566
- `/console/app/${encodeURIComponent(
5567
- payload.appId
5568
- )}/blocks/properties/${encodeURIComponent(payload.propertyId)}`,
5569
- payload,
5570
- getAdapterClientDefaultConfig(authorization)
5571
- );
5910
+ try {
5911
+ return yield billingClientInstance.get(
5912
+ `/v2/invoices/${encodeURIComponent(product)}`,
5913
+ getBillingClientConfig(authorization)
5914
+ );
5915
+ } catch (error) {
5916
+ if (error instanceof Error) {
5917
+ throw new Error(`Invoices couldn't be fetched. [${error.message}]`);
5918
+ } else {
5919
+ throw error;
5920
+ }
5921
+ }
5572
5922
  });
5573
5923
  },
5574
- remove(payload, authorization) {
5924
+ downloadInvoices(number, authorization) {
5575
5925
  return __async(this, null, function* () {
5576
- return adapterClientInstance.delete(
5577
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/properties/${payload.propertyId}`,
5578
- getAdapterClientDefaultConfig(authorization)
5579
- );
5926
+ try {
5927
+ const response = yield billingClientInstance.request(__spreadValues({
5928
+ url: `https://api.labs.livechatinc.com/v2/invoices/${encodeURIComponent(
5929
+ number
5930
+ )}`,
5931
+ data: new URLSearchParams({
5932
+ _method: "GET"
5933
+ //gave the values directly for testing
5934
+ }),
5935
+ responseType: "blob"
5936
+ }, getBillingClientConfig(authorization)));
5937
+ const href = URL.createObjectURL(response.data);
5938
+ const link = document.createElement("a");
5939
+ link.href = href;
5940
+ link.setAttribute("download", `invoice-${number}.pdf`);
5941
+ document.body.appendChild(link);
5942
+ link.click();
5943
+ document.body.removeChild(link);
5944
+ URL.revokeObjectURL(href);
5945
+ } catch (error) {
5946
+ if (error instanceof Error) {
5947
+ throw new Error(`Invoice couldn't be downloaded. [${error.message}]`);
5948
+ } else {
5949
+ throw error;
5950
+ }
5951
+ }
5580
5952
  });
5581
5953
  }
5582
5954
  };
5583
5955
 
5584
- // src/apis/platform/adapter/app/blocks/properties/api.ts
5585
- var platformAdapterAppPropertiesApi = {
5586
- property: platformAdapterAppPropertyApi,
5956
+ // src/apis/platform/billing/api.ts
5957
+ var platformBillingApi = {
5958
+ account: platformBillingAccountApi,
5959
+ invoices: platformBillingInvoicesApi
5960
+ };
5961
+
5962
+ // src/apis/platform/console/app/blocks/authorization/api.ts
5963
+ var platformConsoleAppAuthorizationApi = {
5587
5964
  get(appId, authorization) {
5588
5965
  return __async(this, null, function* () {
5589
- return adapterClientInstance.get(
5590
- `/console/app/${encodeURIComponent(appId)}/blocks/properties`,
5591
- getAdapterClientDefaultConfig(authorization)
5966
+ return consoleClientInstance.get(
5967
+ `/app/${encodeURIComponent(appId)}/blocks/authorization`,
5968
+ getConsoleClientDefaultConfig(authorization)
5592
5969
  );
5593
5970
  });
5594
5971
  },
5595
- upsert(payload, authorization) {
5972
+ add(payload, authorization) {
5973
+ return __async(this, null, function* () {
5974
+ return consoleClientInstance.post(
5975
+ `/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5976
+ payload,
5977
+ getConsoleClientDefaultConfig(authorization)
5978
+ );
5979
+ });
5980
+ },
5981
+ update(payload, authorization) {
5596
5982
  return __async(this, null, function* () {
5597
- return adapterClientInstance.post(
5598
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5983
+ return consoleClientInstance.put(
5984
+ `/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5599
5985
  payload,
5600
- getAdapterClientDefaultConfig(authorization)
5986
+ getConsoleClientDefaultConfig(authorization)
5601
5987
  );
5602
5988
  });
5603
5989
  },
5604
5990
  remove(payload, authorization) {
5605
5991
  return __async(this, null, function* () {
5606
- return adapterClientInstance.delete(
5607
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5608
- getAdapterClientDefaultConfig(authorization)
5992
+ return consoleClientInstance.delete(
5993
+ `/app/${encodeURIComponent(payload.appId)}/blocks/authorization`,
5994
+ getConsoleClientDefaultConfig(authorization)
5609
5995
  );
5610
5996
  });
5611
5997
  }
5612
5998
  };
5613
5999
 
5614
- // src/apis/platform/adapter/app/blocks/repository/api.ts
5615
- var platformAdapterAppRepositoryApi = {
6000
+ // src/apis/platform/console/app/blocks/deployment/api.ts
6001
+ var platformConsoleAppDeploymentApi = {
5616
6002
  getAggregate(appId, authorization) {
5617
6003
  return __async(this, null, function* () {
5618
- return adapterClientInstance.get(
5619
- `/console/app/${encodeURIComponent(appId)}/blocks/repository/aggregate`,
5620
- getAdapterClientDefaultConfig(authorization)
6004
+ return consoleClientInstance.get(
6005
+ `/app/${encodeURIComponent(appId)}/blocks/deployment/aggregate`,
6006
+ getConsoleClientDefaultConfig(authorization)
5621
6007
  );
5622
6008
  });
5623
6009
  },
5624
6010
  get(appId, authorization) {
5625
6011
  return __async(this, null, function* () {
5626
- return adapterClientInstance.get(
5627
- `/console/app/${encodeURIComponent(appId)}/blocks/repository`,
5628
- getAdapterClientDefaultConfig(authorization)
6012
+ return consoleClientInstance.get(
6013
+ `/app/${encodeURIComponent(appId)}/blocks/deployment`,
6014
+ getConsoleClientDefaultConfig(authorization)
5629
6015
  );
5630
6016
  });
5631
6017
  },
5632
6018
  link(payload, authorization) {
5633
6019
  return __async(this, null, function* () {
5634
- return adapterClientInstance.put(
5635
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
6020
+ return consoleClientInstance.put(
6021
+ `/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5636
6022
  payload,
5637
- getAdapterClientDefaultConfig(authorization)
6023
+ getConsoleClientDefaultConfig(authorization)
5638
6024
  );
5639
6025
  });
5640
6026
  },
5641
6027
  unlink(payload, authorization) {
5642
6028
  return __async(this, null, function* () {
5643
- return adapterClientInstance.delete(
5644
- `/console/app/${encodeURIComponent(
6029
+ return consoleClientInstance.delete(
6030
+ `/app/${encodeURIComponent(
5645
6031
  payload.appId
5646
- )}/blocks/repository?${new URLSearchParams(
6032
+ )}/blocks/deployment?${new URLSearchParams(
5647
6033
  payload
5648
6034
  ).toString()}`,
5649
- getAdapterClientDefaultConfig(authorization)
6035
+ getConsoleClientDefaultConfig(authorization)
5650
6036
  );
5651
6037
  });
5652
6038
  },
5653
6039
  upsert(payload, authorization) {
5654
6040
  return __async(this, null, function* () {
5655
- return adapterClientInstance.patch(
5656
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
6041
+ return consoleClientInstance.patch(
6042
+ `/app/${encodeURIComponent(payload.appId)}/blocks/deployment`,
5657
6043
  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`,
5668
- payload,
5669
- getAdapterClientDefaultConfig(authorization)
6044
+ getConsoleClientDefaultConfig(authorization)
5670
6045
  );
5671
6046
  });
5672
6047
  }
5673
6048
  };
5674
6049
 
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
- },
6050
+ // src/apis/platform/console/app/blocks/monetization/api.ts
6051
+ var platformConsoleAppMonetizationApi = {
5685
6052
  get(appId, authorization) {
5686
6053
  return __async(this, null, function* () {
5687
- return adapterClientInstance.get(
5688
- `/console/app/${encodeURIComponent(appId)}/blocks/storage`,
5689
- getAdapterClientDefaultConfig(authorization)
6054
+ return consoleClientInstance.get(
6055
+ `/app/${encodeURIComponent(appId)}/blocks/monetization`,
6056
+ getConsoleClientDefaultConfig(authorization)
5690
6057
  );
5691
6058
  });
5692
6059
  },
5693
- link(payload, authorization) {
6060
+ upsert(payload, authorization) {
5694
6061
  return __async(this, null, function* () {
5695
- return adapterClientInstance.put(
5696
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
6062
+ return consoleClientInstance.post(
6063
+ `/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
5697
6064
  payload,
5698
- getAdapterClientDefaultConfig(authorization)
6065
+ getConsoleClientDefaultConfig(authorization)
5699
6066
  );
5700
6067
  });
5701
6068
  },
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)
5711
- );
5712
- });
5713
- },
5714
- upsert(payload, authorization) {
6069
+ remove(payload, authorization) {
5715
6070
  return __async(this, null, function* () {
5716
- return adapterClientInstance.patch(
5717
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
5718
- payload,
5719
- getAdapterClientDefaultConfig(authorization)
6071
+ return consoleClientInstance.delete(
6072
+ `/app/${encodeURIComponent(payload.appId)}/blocks/monetization`,
6073
+ getConsoleClientDefaultConfig(authorization)
5720
6074
  );
5721
6075
  });
5722
6076
  }
5723
6077
  };
5724
6078
 
5725
- // src/apis/platform/adapter/app/blocks/widgets/widget/api.ts
5726
- var platformAdapterAppWidgetApi = {
5727
- get(appId, widgetId, authorization) {
6079
+ // src/apis/platform/console/app/blocks/properties/property/api.ts
6080
+ var platformConsoleAppPropertyApi = {
6081
+ get(appId, propertyId, authorization) {
5728
6082
  return __async(this, null, function* () {
5729
- return adapterClientInstance.get(
5730
- `/console/app/${encodeURIComponent(
6083
+ return consoleClientInstance.get(
6084
+ `/app/${encodeURIComponent(
5731
6085
  appId
5732
- )}/blocks/widgets/${encodeURIComponent(widgetId)}`,
5733
- getAdapterClientDefaultConfig(authorization)
6086
+ )}/blocks/properties/${encodeURIComponent(propertyId)}`,
6087
+ getConsoleClientDefaultConfig(authorization)
5734
6088
  );
5735
6089
  });
5736
6090
  },
5737
6091
  upsert(payload, authorization) {
5738
6092
  return __async(this, null, function* () {
5739
- return adapterClientInstance.post(
5740
- `/console/app/${encodeURIComponent(
6093
+ return consoleClientInstance.post(
6094
+ `/app/${encodeURIComponent(
5741
6095
  payload.appId
5742
- )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
6096
+ )}/blocks/properties/${encodeURIComponent(payload.propertyId)}`,
5743
6097
  payload,
5744
- getAdapterClientDefaultConfig(authorization)
6098
+ getConsoleClientDefaultConfig(authorization)
5745
6099
  );
5746
6100
  });
5747
6101
  },
5748
6102
  remove(payload, authorization) {
5749
6103
  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)
6104
+ return consoleClientInstance.delete(
6105
+ `/app/${encodeURIComponent(payload.appId)}/blocks/properties/${payload.propertyId}`,
6106
+ getConsoleClientDefaultConfig(authorization)
5755
6107
  );
5756
6108
  });
5757
6109
  }
5758
6110
  };
5759
6111
 
5760
- // src/apis/platform/adapter/app/blocks/widgets/api.ts
5761
- var platformAdapterAppWidgetsApi = {
5762
- widget: platformAdapterAppWidgetApi,
6112
+ // src/apis/platform/console/app/blocks/properties/api.ts
6113
+ var platformConsoleAppPropertiesApi = {
6114
+ property: platformConsoleAppPropertyApi,
5763
6115
  get(appId, authorization) {
5764
6116
  return __async(this, null, function* () {
5765
- return adapterClientInstance.get(
5766
- `/console/app/${encodeURIComponent(appId)}/blocks/widgets`,
5767
- getAdapterClientDefaultConfig(authorization)
6117
+ return consoleClientInstance.get(
6118
+ `/app/${encodeURIComponent(appId)}/blocks/properties`,
6119
+ getConsoleClientDefaultConfig(authorization)
5768
6120
  );
5769
6121
  });
5770
6122
  },
5771
6123
  upsert(payload, authorization) {
5772
6124
  return __async(this, null, function* () {
5773
- return adapterClientInstance.post(
5774
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
6125
+ return consoleClientInstance.post(
6126
+ `/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
5775
6127
  payload,
5776
- getAdapterClientDefaultConfig(authorization)
6128
+ getConsoleClientDefaultConfig(authorization)
5777
6129
  );
5778
6130
  });
5779
6131
  },
5780
6132
  remove(payload, authorization) {
5781
6133
  return __async(this, null, function* () {
5782
- return adapterClientInstance.delete(
5783
- `/console/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
5784
- getAdapterClientDefaultConfig(authorization)
6134
+ return consoleClientInstance.delete(
6135
+ `/app/${encodeURIComponent(payload.appId)}/blocks/properties`,
6136
+ getConsoleClientDefaultConfig(authorization)
5785
6137
  );
5786
6138
  });
5787
6139
  }
5788
6140
  };
5789
6141
 
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) {
6142
+ // src/apis/platform/console/app/blocks/repository/api.ts
6143
+ var platformConsoleAppRepositoryApi = {
6144
+ getAggregate(appId, authorization) {
5804
6145
  return __async(this, null, function* () {
5805
- return adapterClientInstance.get(
5806
- "/console/app/templates",
5807
- getAdapterClientDefaultConfig(authorization)
6146
+ return consoleClientInstance.get(
6147
+ `/app/${encodeURIComponent(appId)}/blocks/repository/aggregate`,
6148
+ getConsoleClientDefaultConfig(authorization)
5808
6149
  );
5809
6150
  });
5810
6151
  },
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) {
6152
+ get(appId, authorization) {
5824
6153
  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))
6154
+ return consoleClientInstance.get(
6155
+ `/app/${encodeURIComponent(appId)}/blocks/repository`,
6156
+ getConsoleClientDefaultConfig(authorization)
5832
6157
  );
5833
- return response.data;
5834
6158
  });
5835
6159
  },
5836
- getVariable(appId, key, authorization) {
5837
- return __async(this, null, function* () {
5838
- const response = yield adapterClientInstance.get(
5839
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5840
- key
5841
- )}`,
5842
- getAdapterClientDefaultConfig(authorization)
5843
- );
5844
- return response.data;
5845
- });
5846
- },
5847
- syncVariable(appId, key, payload, authorization) {
6160
+ link(payload, authorization) {
5848
6161
  return __async(this, null, function* () {
5849
- yield adapterClientInstance.post(
5850
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5851
- key
5852
- )}/sync`,
6162
+ return consoleClientInstance.put(
6163
+ `/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
5853
6164
  payload,
5854
- getAdapterClientDefaultConfig(authorization)
6165
+ getConsoleClientDefaultConfig(authorization)
5855
6166
  );
5856
6167
  });
5857
6168
  },
5858
- createVariable(appId, data, authorization) {
6169
+ unlink(payload, authorization) {
5859
6170
  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)
6171
+ return consoleClientInstance.delete(
6172
+ `/app/${encodeURIComponent(
6173
+ payload.appId
6174
+ )}/blocks/repository?${new URLSearchParams(
6175
+ payload
6176
+ ).toString()}`,
6177
+ getConsoleClientDefaultConfig(authorization)
5866
6178
  );
5867
6179
  });
5868
6180
  },
5869
- editVariable(appId, data, authorization) {
6181
+ upsert(payload, authorization) {
5870
6182
  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)
6183
+ return consoleClientInstance.patch(
6184
+ `/app/${encodeURIComponent(payload.appId)}/blocks/repository`,
6185
+ payload,
6186
+ getConsoleClientDefaultConfig(authorization)
5877
6187
  );
5878
6188
  });
5879
6189
  },
5880
- deleteVariable(appId, key) {
6190
+ seed(payload, authorization) {
5881
6191
  return __async(this, null, function* () {
5882
- yield adapterClientInstance.delete(
5883
- `/console/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
5884
- key
5885
- )}`
6192
+ return consoleClientInstance.post(
6193
+ `/app/${encodeURIComponent(payload.appId)}/blocks/repository/seed`,
6194
+ payload,
6195
+ getConsoleClientDefaultConfig(authorization)
5886
6196
  );
5887
6197
  });
5888
6198
  }
5889
6199
  };
5890
6200
 
5891
- // src/apis/platform/adapter/app/api.ts
5892
- var platformAdapterAppApi = {
5893
- blocks: platformAdapterAppBlocksApi,
5894
- variables: platformAdapterAppVariablesApi,
5895
- templates: platformAdapterAppTemplatesApi,
5896
- push(payload, authorization) {
6201
+ // src/apis/platform/console/app/blocks/storage/api.ts
6202
+ var platformConsoleAppStorageApi = {
6203
+ getAggregate(appId, authorization) {
5897
6204
  return __async(this, null, function* () {
5898
- return adapterClientInstance.post(
5899
- `/console/app${payload.manifest.id ? `/${encodeURIComponent(payload.manifest.id)}` : ""}`,
5900
- payload,
5901
- getAdapterClientDefaultConfig(authorization)
6205
+ return consoleClientInstance.get(
6206
+ `/app/${encodeURIComponent(appId)}/blocks/storage/aggregate`,
6207
+ getConsoleClientDefaultConfig(authorization)
5902
6208
  );
5903
6209
  });
5904
6210
  },
5905
- pull(appId, authorization) {
6211
+ get(appId, authorization) {
5906
6212
  return __async(this, null, function* () {
5907
- return adapterClientInstance.get(
5908
- `/console/app/${encodeURIComponent(appId)}`,
5909
- getAdapterClientDefaultConfig(authorization)
6213
+ return consoleClientInstance.get(
6214
+ `/app/${encodeURIComponent(appId)}/blocks/storage`,
6215
+ getConsoleClientDefaultConfig(authorization)
5910
6216
  );
5911
6217
  });
5912
6218
  },
5913
- verify(payload, authorization) {
6219
+ link(payload, authorization) {
5914
6220
  return __async(this, null, function* () {
5915
- return adapterClientInstance.post(
5916
- `/console/app/${encodeURIComponent(payload.appId)}/verify`,
6221
+ return consoleClientInstance.put(
6222
+ `/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
5917
6223
  payload,
5918
- getAdapterClientDefaultConfig(authorization)
6224
+ getConsoleClientDefaultConfig(authorization)
5919
6225
  );
5920
6226
  });
5921
6227
  },
5922
- status(sagaId, authorization) {
6228
+ unlink(payload, authorization) {
5923
6229
  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
- }
6230
+ return consoleClientInstance.delete(
6231
+ `/app/${encodeURIComponent(
6232
+ payload.appId
6233
+ )}/blocks/storage?${new URLSearchParams(
6234
+ payload
6235
+ ).toString()}`,
6236
+ getConsoleClientDefaultConfig(authorization)
6237
+ );
6238
+ });
6239
+ },
6240
+ upsert(payload, authorization) {
6241
+ return __async(this, null, function* () {
6242
+ return consoleClientInstance.patch(
6243
+ `/app/${encodeURIComponent(payload.appId)}/blocks/storage`,
6244
+ payload,
6245
+ getConsoleClientDefaultConfig(authorization)
6246
+ );
6247
+ });
6029
6248
  }
6030
6249
  };
6031
6250
 
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
- }
6251
+ // src/apis/platform/console/app/blocks/widgets/widget/api.ts
6252
+ var platformConsoleAppWidgetApi = {
6253
+ get(appId, widgetId, authorization) {
6254
+ return __async(this, null, function* () {
6255
+ return consoleClientInstance.get(
6256
+ `/app/${encodeURIComponent(
6257
+ appId
6258
+ )}/blocks/widgets/${encodeURIComponent(widgetId)}`,
6259
+ getConsoleClientDefaultConfig(authorization)
6260
+ );
6261
+ });
6262
+ },
6263
+ upsert(payload, authorization) {
6264
+ return __async(this, null, function* () {
6265
+ return consoleClientInstance.post(
6266
+ `/app/${encodeURIComponent(
6267
+ payload.appId
6268
+ )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
6269
+ payload,
6270
+ getConsoleClientDefaultConfig(authorization)
6271
+ );
6272
+ });
6273
+ },
6274
+ remove(payload, authorization) {
6275
+ return __async(this, null, function* () {
6276
+ return consoleClientInstance.delete(
6277
+ `/app/${encodeURIComponent(
6278
+ payload.appId
6279
+ )}/blocks/widgets/${encodeURIComponent(payload.widgetId)}`,
6280
+ getConsoleClientDefaultConfig(authorization)
6281
+ );
6282
+ });
6053
6283
  }
6054
6284
  };
6055
6285
 
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
- }
6286
+ // src/apis/platform/console/app/blocks/widgets/api.ts
6287
+ var platformConsoleAppWidgetsApi = {
6288
+ widget: platformConsoleAppWidgetApi,
6289
+ get(appId, authorization) {
6290
+ return __async(this, null, function* () {
6291
+ return consoleClientInstance.get(
6292
+ `/app/${encodeURIComponent(appId)}/blocks/widgets`,
6293
+ getConsoleClientDefaultConfig(authorization)
6294
+ );
6295
+ });
6296
+ },
6297
+ upsert(payload, authorization) {
6298
+ return __async(this, null, function* () {
6299
+ return consoleClientInstance.post(
6300
+ `/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
6301
+ payload,
6302
+ getConsoleClientDefaultConfig(authorization)
6303
+ );
6304
+ });
6305
+ },
6306
+ remove(payload, authorization) {
6307
+ return __async(this, null, function* () {
6308
+ return consoleClientInstance.delete(
6309
+ `/app/${encodeURIComponent(payload.appId)}/blocks/widgets`,
6310
+ getConsoleClientDefaultConfig(authorization)
6311
+ );
6312
+ });
6077
6313
  }
6078
6314
  };
6079
6315
 
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
6316
+ // src/apis/platform/console/app/blocks/api.ts
6317
+ var platformConsoleAppBlocksApi = {
6318
+ authorization: platformConsoleAppAuthorizationApi,
6319
+ monetization: platformConsoleAppMonetizationApi,
6320
+ repository: platformConsoleAppRepositoryApi,
6321
+ deployment: platformConsoleAppDeploymentApi,
6322
+ storage: platformConsoleAppStorageApi,
6323
+ properties: platformConsoleAppPropertiesApi,
6324
+ widgets: platformConsoleAppWidgetsApi
6088
6325
  };
6089
6326
 
6090
- // src/apis/platform/adapter/api.ts
6091
- var platformAdapterApi = {
6092
- app: platformAdapterAppApi,
6093
- integrations: platformAdapterIntegrationsApi,
6094
- log(payload, authorization) {
6327
+ // src/apis/platform/console/app/templates/api.ts
6328
+ var platformConsoleAppTemplatesApi = {
6329
+ getTemplates(authorization) {
6095
6330
  return __async(this, null, function* () {
6096
- return adapterClientInstance.post(
6097
- "/log",
6098
- payload,
6099
- getAdapterClientConfig(authorization)
6331
+ return consoleClientInstance.get(
6332
+ "/app/templates",
6333
+ getConsoleClientDefaultConfig(authorization)
6334
+ );
6335
+ });
6336
+ },
6337
+ getRepositoryTemplates(authorization) {
6338
+ return __async(this, null, function* () {
6339
+ return consoleClientInstance.get(
6340
+ "/app/templates/repository",
6341
+ getConsoleClientDefaultConfig(authorization)
6100
6342
  );
6101
6343
  });
6102
6344
  }
6103
6345
  };
6104
6346
 
6105
- // src/apis/platform/billing/account/api.ts
6106
- var platformBillingAccountApi = {
6107
- getAccount(authorization) {
6347
+ // src/apis/platform/console/app/variables/api.ts
6348
+ var platformConsoleAppVariablesApi = {
6349
+ getVariables(appId, decrypted, authorization) {
6108
6350
  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
- }
6351
+ const response = yield consoleClientInstance.get(
6352
+ `/app/${encodeURIComponent(appId)}/variables`,
6353
+ __spreadValues({
6354
+ params: {
6355
+ decrypted
6356
+ }
6357
+ }, getConsoleClientDefaultConfig(authorization))
6358
+ );
6359
+ return response.data;
6121
6360
  });
6122
6361
  },
6123
- getAccountInfo(product, authorization) {
6362
+ getVariable(appId, key, authorization) {
6124
6363
  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
- }
6364
+ const response = yield consoleClientInstance.get(
6365
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(key)}`,
6366
+ getConsoleClientDefaultConfig(authorization)
6367
+ );
6368
+ return response.data;
6369
+ });
6370
+ },
6371
+ syncVariable(appId, key, payload, authorization) {
6372
+ return __async(this, null, function* () {
6373
+ yield consoleClientInstance.post(
6374
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
6375
+ key
6376
+ )}/sync`,
6377
+ payload,
6378
+ getConsoleClientDefaultConfig(authorization)
6379
+ );
6380
+ });
6381
+ },
6382
+ createVariable(appId, data, authorization) {
6383
+ return __async(this, null, function* () {
6384
+ yield consoleClientInstance.post(
6385
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
6386
+ data.key
6387
+ )}`,
6388
+ data,
6389
+ getConsoleClientDefaultConfig(authorization)
6390
+ );
6391
+ });
6392
+ },
6393
+ editVariable(appId, data, authorization) {
6394
+ return __async(this, null, function* () {
6395
+ yield consoleClientInstance.post(
6396
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(
6397
+ data.key
6398
+ )}/edit`,
6399
+ data,
6400
+ getConsoleClientDefaultConfig(authorization)
6401
+ );
6402
+ });
6403
+ },
6404
+ deleteVariable(appId, key) {
6405
+ return __async(this, null, function* () {
6406
+ yield consoleClientInstance.delete(
6407
+ `/app/${encodeURIComponent(appId)}/variables/${encodeURIComponent(key)}`
6408
+ );
6139
6409
  });
6140
6410
  }
6141
6411
  };
6142
6412
 
6143
- // src/apis/platform/billing/invoices/api.ts
6144
- var platformBillingInvoicesApi = {
6145
- getInvoices(product, authorization) {
6413
+ // src/apis/platform/console/app/api.ts
6414
+ var platformConsoleAppApi = {
6415
+ blocks: platformConsoleAppBlocksApi,
6416
+ variables: platformConsoleAppVariablesApi,
6417
+ templates: platformConsoleAppTemplatesApi,
6418
+ push(payload, authorization) {
6146
6419
  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
- }
6420
+ return consoleClientInstance.post(
6421
+ `/app${payload.manifest.id ? `/${encodeURIComponent(payload.manifest.id)}` : ""}`,
6422
+ payload,
6423
+ getConsoleClientDefaultConfig(authorization)
6424
+ );
6159
6425
  });
6160
6426
  },
6161
- downloadInvoices(number, authorization) {
6427
+ pull(appId, authorization) {
6162
6428
  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
- }
6429
+ return consoleClientInstance.get(
6430
+ `/app/${encodeURIComponent(appId)}`,
6431
+ getConsoleClientDefaultConfig(authorization)
6432
+ );
6433
+ });
6434
+ },
6435
+ verify(payload, authorization) {
6436
+ return __async(this, null, function* () {
6437
+ return consoleClientInstance.post(
6438
+ `/app/${encodeURIComponent(payload.appId)}/verify`,
6439
+ payload,
6440
+ getConsoleClientDefaultConfig(authorization)
6441
+ );
6442
+ });
6443
+ },
6444
+ status(sagaId, authorization) {
6445
+ return __async(this, null, function* () {
6446
+ return consoleClientInstance.get(
6447
+ "/app/status",
6448
+ __spreadValues({
6449
+ params: {
6450
+ sagaId
6451
+ }
6452
+ }, getConsoleClientDefaultConfig(authorization))
6453
+ );
6189
6454
  });
6190
6455
  }
6191
6456
  };
6192
6457
 
6193
- // src/apis/platform/billing/api.ts
6194
- var platformBillingApi = {
6195
- account: platformBillingAccountApi,
6196
- invoices: platformBillingInvoicesApi
6458
+ // src/apis/platform/console/api.ts
6459
+ var platformConsoleApi = {
6460
+ app: platformConsoleAppApi,
6461
+ log(payload, authorization) {
6462
+ return __async(this, null, function* () {
6463
+ return consoleClientInstance.post(
6464
+ "/log",
6465
+ payload,
6466
+ getConsoleClientConfig(authorization)
6467
+ );
6468
+ });
6469
+ }
6197
6470
  };
6198
6471
 
6199
6472
  // src/constants/app/templates/repository.ts
@@ -7712,6 +7985,7 @@ var platformApi = {
7712
7985
  accounts: platformAccountsApi,
7713
7986
  billing: platformBillingApi,
7714
7987
  adapter: platformAdapterApi,
7988
+ console: platformConsoleApi,
7715
7989
  dps: platformDpsApi
7716
7990
  };
7717
7991
 
@@ -8412,7 +8686,7 @@ var api2 = {
8412
8686
  isInitialized: false
8413
8687
  };
8414
8688
  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;
8689
+ 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
8690
  initPlatformAccountsClient(
8417
8691
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
8418
8692
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.token
@@ -8433,19 +8707,29 @@ function initApi(config, tokens) {
8433
8707
  slack: tokens.slack
8434
8708
  } : void 0
8435
8709
  );
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);
8710
+ initConsoleClient(
8711
+ (_h = config.urls.platform) == null ? void 0 : _h.console,
8712
+ tokens ? {
8713
+ platform: tokens.platform,
8714
+ github: tokens.github,
8715
+ netlify: tokens.netlify,
8716
+ vercel: tokens.vercel,
8717
+ neon: tokens.neon
8718
+ } : void 0
8719
+ );
8720
+ initLiveChatClient((_i = config.urls.products) == null ? void 0 : _i.livechat, (_j = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _j.token);
8721
+ initHelpDeskClient((_k = config.urls.products) == null ? void 0 : _k.helpdesk, (_l = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _l.token);
8722
+ initTextClient((_m = config.urls.integrations) == null ? void 0 : _m.text, (_n = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _n.token);
8723
+ initGithubClient((_o = tokens == null ? void 0 : tokens.github) == null ? void 0 : _o.appToken);
8724
+ initNetlifyClient((_p = tokens == null ? void 0 : tokens.netlify) == null ? void 0 : _p.token);
8725
+ initVercelClient((_q = tokens == null ? void 0 : tokens.vercel) == null ? void 0 : _q.token);
8726
+ initNeonClient((_r = tokens == null ? void 0 : tokens.neon) == null ? void 0 : _r.token);
8727
+ initPlanetScaleClient((_s = tokens == null ? void 0 : tokens.planetscale) == null ? void 0 : _s.token);
8728
+ 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);
8729
+ 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);
8730
+ 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);
8731
+ initHubspotClient((_z = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _z.token);
8732
+ initSlackClient((_A = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _A.token);
8449
8733
  api2.isInitialized = true;
8450
8734
  }
8451
8735
 
@@ -8506,6 +8790,7 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
8506
8790
  BigCommerceApiError,
8507
8791
  BigCommerceEventNames,
8508
8792
  BigCommerceWebhookScopes,
8793
+ ConsoleApiError,
8509
8794
  DpsApiError,
8510
8795
  HelpDeskApiError,
8511
8796
  HelpDeskWebhookEventType,
@@ -8547,31 +8832,43 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
8547
8832
  bigcommerceEventsZods,
8548
8833
  billingClientInstance,
8549
8834
  buildUrlFromSegments,
8835
+ consoleClientInstance,
8550
8836
  dpsClientInstance,
8551
8837
  getAdapterClientConfig,
8552
8838
  getAdapterClientDefaultConfig,
8553
8839
  getAppAutoReviewPayload,
8840
+ getBigCommerceClientAuthorization,
8554
8841
  getBigCommerceClientConfig,
8555
8842
  getBigCommerceClientUrl,
8556
8843
  getBillingClientConfig,
8844
+ getConsoleClientConfig,
8845
+ getConsoleClientDefaultConfig,
8557
8846
  getDpsClientConfig,
8558
8847
  getEmptyAppAutoReview,
8848
+ getGitHubClientAuthorization,
8559
8849
  getGithubClientConfig,
8560
8850
  getHelpDeskClientConfig,
8851
+ getHubspotClientAuthorization,
8561
8852
  getHubspotClientConfig,
8562
8853
  getIntegrationFlowUrl,
8563
8854
  getIntegrationFlowUrlForRedirection,
8564
8855
  getLiveChatClientConfig,
8856
+ getMailchimpClientAuthorization,
8565
8857
  getMailchimpClientConfig,
8566
8858
  getMailchimpClientUrl,
8567
8859
  getNeonClientConfig,
8860
+ getNetlifyClientAuthorization,
8568
8861
  getNetlifyClientConfig,
8569
8862
  getPlanetScaleClientConfig,
8570
8863
  getRegion,
8864
+ getShopifyClientAuthorization,
8571
8865
  getShopifyClientConfig,
8572
8866
  getShopifyClientUrl,
8867
+ getSlackClientAuthorization,
8573
8868
  getSlackClientConfig,
8869
+ getTextClientAuthorization,
8574
8870
  getTextClientConfig,
8871
+ getVercelClientAuthorization,
8575
8872
  getVercelClientConfig,
8576
8873
  githubClientInstance,
8577
8874
  helpdeskClientInstance,
@@ -8581,6 +8878,7 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
8581
8878
  initApi,
8582
8879
  initBigCommerceClient,
8583
8880
  initBillingClient,
8881
+ initConsoleClient,
8584
8882
  initDpsClient,
8585
8883
  initGithubClient,
8586
8884
  initHelpDeskClient,
@@ -8613,6 +8911,7 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
8613
8911
  textLivechatEventsZods,
8614
8912
  updateAdapterClient,
8615
8913
  updateBigCommerceClient,
8914
+ updateConsoleClient,
8616
8915
  updateGithubClient,
8617
8916
  updateHubspotClient,
8618
8917
  updateMailchimpClient,