@livechat/developer-studio-api 3.4.13 → 3.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1932,6 +1932,66 @@ function updateBigCommerceClient(token, shop) {
1932
1932
  }
1933
1933
  }
1934
1934
 
1935
+ // src/apis/integrations/slack/instance.ts
1936
+ import axios14 from "axios";
1937
+ var SlackApiError = class extends ApiErrorBase {
1938
+ constructor() {
1939
+ super(...arguments);
1940
+ this.name = "slack";
1941
+ }
1942
+ };
1943
+ var slackClientInstance = axios14.create({
1944
+ baseURL: "https://slack.com/api",
1945
+ headers: {
1946
+ "Content-Type": "application/json"
1947
+ }
1948
+ });
1949
+ slackClientInstance.interceptors.response.use(
1950
+ (r) => r,
1951
+ (error) => {
1952
+ var _a, _b, _c, _d;
1953
+ if (axios14.isAxiosError(error)) {
1954
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
1955
+ throw new UnauthorizeApiError("slack");
1956
+ }
1957
+ }
1958
+ return Promise.reject(
1959
+ new SlackApiError(
1960
+ error.message,
1961
+ (_b = error.response) == null ? void 0 : _b.data,
1962
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
1963
+ )
1964
+ );
1965
+ }
1966
+ );
1967
+ function getSlackClientConfig(options = {}) {
1968
+ var _a;
1969
+ const currentHeaders = slackClientInstance.defaults.headers;
1970
+ const config = {
1971
+ authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : currentHeaders.Authorization
1972
+ };
1973
+ if (options.ensureAuthorizationToken && !config.authorization) {
1974
+ throw new UnauthorizeApiError("slack");
1975
+ }
1976
+ return {
1977
+ headers: __spreadValues({}, config.authorization ? { Authorization: config.authorization } : {})
1978
+ };
1979
+ }
1980
+ function updateSlackClient(token) {
1981
+ const defaults = slackClientInstance.defaults;
1982
+ const headers = defaults.headers;
1983
+ if (token) {
1984
+ headers.Authorization = `Bearer ${token}`;
1985
+ } else {
1986
+ delete headers.Authorization;
1987
+ }
1988
+ }
1989
+ function initSlackClient(token) {
1990
+ if (token) {
1991
+ updateSlackClient(token);
1992
+ }
1993
+ }
1994
+
1935
1995
  // src/apis/platform/accounts/instance.ts
1936
1996
  var AccountsApiError = class extends ApiErrorBase {
1937
1997
  constructor() {
@@ -1971,8 +2031,8 @@ function initPlatformAccountsClient(baseUrl, token) {
1971
2031
  }
1972
2032
 
1973
2033
  // src/apis/platform/billing/instance.ts
1974
- import axios14 from "axios";
1975
- var billingClientInstance = axios14.create({
2034
+ import axios15 from "axios";
2035
+ var billingClientInstance = axios15.create({
1976
2036
  baseURL: "https://billing.labs.livechatinc.com"
1977
2037
  });
1978
2038
  function getBillingClientConfig(options = {}) {
@@ -2025,6 +2085,7 @@ var IntegrationNames = /* @__PURE__ */ ((IntegrationNames2) => {
2025
2085
  IntegrationNames2["Text"] = "text";
2026
2086
  IntegrationNames2["LiveChat"] = "text-livechat";
2027
2087
  IntegrationNames2["HelpDesk"] = "text-helpdesk";
2088
+ IntegrationNames2["Slack"] = "slack";
2028
2089
  return IntegrationNames2;
2029
2090
  })(IntegrationNames || {});
2030
2091
  var IntegrationDisplayNames = /* @__PURE__ */ ((IntegrationDisplayNames2) => {
@@ -2042,6 +2103,7 @@ var IntegrationDisplayNames = /* @__PURE__ */ ((IntegrationDisplayNames2) => {
2042
2103
  IntegrationDisplayNames2["Text"] = "Text";
2043
2104
  IntegrationDisplayNames2["LiveChat"] = "LiveChat";
2044
2105
  IntegrationDisplayNames2["HelpDesk"] = "HelpDesk";
2106
+ IntegrationDisplayNames2["Slack"] = "Slack";
2045
2107
  return IntegrationDisplayNames2;
2046
2108
  })(IntegrationDisplayNames || {});
2047
2109
 
@@ -2541,7 +2603,7 @@ var integrationEventsZods = {
2541
2603
  };
2542
2604
 
2543
2605
  // src/apis/platform/adapter/instance.ts
2544
- import axios15 from "axios";
2606
+ import axios16 from "axios";
2545
2607
  var REGION = {
2546
2608
  FRA: "fra",
2547
2609
  DAL: "dal",
@@ -2571,7 +2633,7 @@ var AdapterApiError = class _AdapterApiError extends ApiErrorBase {
2571
2633
  );
2572
2634
  }
2573
2635
  };
2574
- var adapterClientInstance = axios15.create({
2636
+ var adapterClientInstance = axios16.create({
2575
2637
  baseURL: "https://platform.labs.text.com/console-adapter/api",
2576
2638
  headers: {
2577
2639
  "Content-Type": "application/json"
@@ -2594,7 +2656,7 @@ adapterClientInstance.interceptors.response.use(
2594
2656
  }
2595
2657
  );
2596
2658
  function getAdapterClientConfig(options = {}) {
2597
- 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, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q;
2659
+ 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, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T;
2598
2660
  const currentHeaders = adapterClientInstance.defaults.headers;
2599
2661
  const headers = {
2600
2662
  platform: {
@@ -2614,49 +2676,53 @@ function getAdapterClientConfig(options = {}) {
2614
2676
  shopify: (_u = currentHeaders["x-adapter-shopify-token"]) != null ? _u : (_t = options.shopify) == null ? void 0 : _t.token,
2615
2677
  shopifyShop: (_w = currentHeaders["x-adapter-shopify-shop"]) != null ? _w : (_v = options.shopify) == null ? void 0 : _v.shop,
2616
2678
  hubspot: (_y = currentHeaders["x-adapter-hubspot-token"]) != null ? _y : (_x = options.hubspot) == null ? void 0 : _x.token,
2617
- bigcommerce: (_A = currentHeaders["x-adapter-bigcommerce-token"]) != null ? _A : (_z = options.bigcommerce) == null ? void 0 : _z.token,
2618
- bigcommerceShop: (_C = currentHeaders["x-adapter-bigcommerce-shop"]) != null ? _C : (_B = options.bigcommerce) == null ? void 0 : _B.shop,
2619
- text: (_E = currentHeaders["x-adapter-text-token"]) != null ? _E : (_D = options.text) == null ? void 0 : _D.token
2679
+ slack: (_A = currentHeaders["x-adapter-slack-token"]) != null ? _A : (_z = options.slack) == null ? void 0 : _z.token,
2680
+ bigcommerce: (_C = currentHeaders["x-adapter-bigcommerce-token"]) != null ? _C : (_B = options.bigcommerce) == null ? void 0 : _B.token,
2681
+ bigcommerceShop: (_E = currentHeaders["x-adapter-bigcommerce-shop"]) != null ? _E : (_D = options.bigcommerce) == null ? void 0 : _D.shop,
2682
+ text: (_G = currentHeaders["x-adapter-text-token"]) != null ? _G : (_F = options.text) == null ? void 0 : _F.token
2620
2683
  }
2621
2684
  };
2622
2685
  if (currentHeaders.Authorization) {
2623
- currentHeaders["X-Region"] = (_F = getRegion(currentHeaders.Authorization)) != null ? _F : void 0;
2686
+ currentHeaders["X-Region"] = (_H = getRegion(currentHeaders.Authorization)) != null ? _H : void 0;
2624
2687
  }
2625
- if (((_G = options.ensureAuthorizationToken) == null ? void 0 : _G.platform) && !headers.platform.token) {
2688
+ if (((_I = options.ensureAuthorizationToken) == null ? void 0 : _I.platform) && !headers.platform.token) {
2626
2689
  throw new UnauthorizeApiError("accounts");
2627
2690
  }
2628
- if (((_H = options.ensureAuthorizationToken) == null ? void 0 : _H.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
2691
+ if (((_J = options.ensureAuthorizationToken) == null ? void 0 : _J.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
2629
2692
  throw new UnauthorizeApiError("github");
2630
2693
  }
2631
- if (((_I = options.ensureAuthorizationToken) == null ? void 0 : _I.vercel) && !headers.integrations.vercel) {
2694
+ if (((_K = options.ensureAuthorizationToken) == null ? void 0 : _K.vercel) && !headers.integrations.vercel) {
2632
2695
  throw new UnauthorizeApiError("vercel");
2633
2696
  }
2634
- if (((_J = options.ensureAuthorizationToken) == null ? void 0 : _J.netlify) && !headers.integrations.netlify) {
2697
+ if (((_L = options.ensureAuthorizationToken) == null ? void 0 : _L.netlify) && !headers.integrations.netlify) {
2635
2698
  throw new UnauthorizeApiError("netlify");
2636
2699
  }
2637
- if (((_K = options.ensureAuthorizationToken) == null ? void 0 : _K.planetscale) && !headers.integrations.planetscale) {
2700
+ if (((_M = options.ensureAuthorizationToken) == null ? void 0 : _M.planetscale) && !headers.integrations.planetscale) {
2638
2701
  throw new UnauthorizeApiError("planetscale");
2639
2702
  }
2640
- if (((_L = options.ensureAuthorizationToken) == null ? void 0 : _L.neon) && !headers.integrations.neon) {
2703
+ if (((_N = options.ensureAuthorizationToken) == null ? void 0 : _N.neon) && !headers.integrations.neon) {
2641
2704
  throw new UnauthorizeApiError("neon");
2642
2705
  }
2643
- if (((_M = options.ensureAuthorizationToken) == null ? void 0 : _M.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
2706
+ if (((_O = options.ensureAuthorizationToken) == null ? void 0 : _O.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
2644
2707
  throw new UnauthorizeApiError("mailchimp");
2645
2708
  }
2646
- if (((_N = options.ensureAuthorizationToken) == null ? void 0 : _N.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
2709
+ if (((_P = options.ensureAuthorizationToken) == null ? void 0 : _P.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
2647
2710
  throw new UnauthorizeApiError("shopify");
2648
2711
  }
2649
- if (((_O = options.ensureAuthorizationToken) == null ? void 0 : _O.hubspot) && !headers.integrations.hubspot) {
2712
+ if (((_Q = options.ensureAuthorizationToken) == null ? void 0 : _Q.hubspot) && !headers.integrations.hubspot) {
2650
2713
  throw new UnauthorizeApiError("hubspot");
2651
2714
  }
2652
- if (((_P = options.ensureAuthorizationToken) == null ? void 0 : _P.bigcommerce) && (!headers.integrations.bigcommerce || !headers.integrations.bigcommerceShop)) {
2715
+ if (((_R = options.ensureAuthorizationToken) == null ? void 0 : _R.slack) && !headers.integrations.slack) {
2716
+ throw new UnauthorizeApiError("slack");
2717
+ }
2718
+ if (((_S = options.ensureAuthorizationToken) == null ? void 0 : _S.bigcommerce) && (!headers.integrations.bigcommerce || !headers.integrations.bigcommerceShop)) {
2653
2719
  throw new UnauthorizeApiError("bigcommerce");
2654
2720
  }
2655
- if (((_Q = options.ensureAuthorizationToken) == null ? void 0 : _Q.text) && !headers.integrations.text) {
2721
+ if (((_T = options.ensureAuthorizationToken) == null ? void 0 : _T.text) && !headers.integrations.text) {
2656
2722
  throw new UnauthorizeApiError("text");
2657
2723
  }
2658
2724
  return {
2659
- headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__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 } : {}), headers.integrations.mailchimp ? { "x-adapter-mailchimp-token": headers.integrations.mailchimp } : {}), headers.integrations.mailchimpServer ? { "x-adapter-mailchimp-server": headers.integrations.mailchimpServer } : {}), headers.integrations.shopify ? { "x-adapter-shopify-token": headers.integrations.shopify } : {}), headers.integrations.shopifyShop ? { "x-adapter-shopify-shop": headers.integrations.shopifyShop } : {}), headers.integrations.hubspot ? { "x-adapter-hubspot-token": headers.integrations.hubspot } : {}), headers.integrations.bigcommerce ? { "x-adapter-bigcommerce-token": headers.integrations.bigcommerce } : {}), headers.integrations.bigcommerceShop ? { "x-adapter-bigcommerce-shop": headers.integrations.bigcommerceShop } : {}), headers.integrations.text ? { "x-adapter-text-token": headers.integrations.text } : {})
2725
+ headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__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 } : {}), headers.integrations.mailchimp ? { "x-adapter-mailchimp-token": headers.integrations.mailchimp } : {}), headers.integrations.mailchimpServer ? { "x-adapter-mailchimp-server": headers.integrations.mailchimpServer } : {}), headers.integrations.shopify ? { "x-adapter-shopify-token": headers.integrations.shopify } : {}), headers.integrations.shopifyShop ? { "x-adapter-shopify-shop": headers.integrations.shopifyShop } : {}), headers.integrations.hubspot ? { "x-adapter-hubspot-token": headers.integrations.hubspot } : {}), headers.integrations.slack ? { "x-adapter-slack-token": headers.integrations.slack } : {}), headers.integrations.bigcommerce ? { "x-adapter-bigcommerce-token": headers.integrations.bigcommerce } : {}), headers.integrations.bigcommerceShop ? { "x-adapter-bigcommerce-shop": headers.integrations.bigcommerceShop } : {}), headers.integrations.text ? { "x-adapter-text-token": headers.integrations.text } : {})
2660
2726
  };
2661
2727
  }
2662
2728
  var getAdapterClientDefaultConfig = (authorization) => getAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -2679,7 +2745,7 @@ function initAdapterClient(baseUrl, tokens) {
2679
2745
  }
2680
2746
  }
2681
2747
  function updateAdapterClient(tokens) {
2682
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
2748
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
2683
2749
  const headers = adapterClientInstance.defaults.headers;
2684
2750
  if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
2685
2751
  headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
@@ -2717,13 +2783,16 @@ function updateAdapterClient(tokens) {
2717
2783
  if ((_m = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _m.token) {
2718
2784
  headers["x-adapter-hubspot-token"] = tokens.hubspot.token;
2719
2785
  }
2720
- if ((_n = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _n.shop) {
2786
+ if ((_n = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _n.token) {
2787
+ headers["x-adapter-slack-token"] = tokens.slack.token;
2788
+ }
2789
+ if ((_o = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _o.shop) {
2721
2790
  headers["x-adapter-bigcommerce-shop"] = tokens.bigcommerce.shop;
2722
2791
  }
2723
- if ((_o = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _o.token) {
2792
+ if ((_p = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _p.token) {
2724
2793
  headers["x-adapter-bigcommerce-token"] = tokens.bigcommerce.token;
2725
2794
  }
2726
- if ((_p = tokens == null ? void 0 : tokens.text) == null ? void 0 : _p.token) {
2795
+ if ((_q = tokens == null ? void 0 : tokens.text) == null ? void 0 : _q.token) {
2727
2796
  headers["x-adapter-text-token"] = tokens.text.token;
2728
2797
  }
2729
2798
  }
@@ -2797,14 +2866,14 @@ var getAppAutoReviewPayload = (value) => {
2797
2866
  };
2798
2867
 
2799
2868
  // src/apis/platform/dps/instance.ts
2800
- import axios16 from "axios";
2869
+ import axios17 from "axios";
2801
2870
  var DpsApiError = class extends ApiErrorBase {
2802
2871
  constructor() {
2803
2872
  super(...arguments);
2804
2873
  this.name = "dps";
2805
2874
  }
2806
2875
  };
2807
- var dpsClientInstance = axios16.create({
2876
+ var dpsClientInstance = axios17.create({
2808
2877
  baseURL: "https://dev-platform.labs.livechatinc.com"
2809
2878
  });
2810
2879
  dpsClientInstance.interceptors.response.use(
@@ -2866,14 +2935,14 @@ var HelpDeskWebhookEventType = /* @__PURE__ */ ((HelpDeskWebhookEventType2) => {
2866
2935
  })(HelpDeskWebhookEventType || {});
2867
2936
 
2868
2937
  // src/apis/products/helpdesk/instance.ts
2869
- import axios17 from "axios";
2938
+ import axios18 from "axios";
2870
2939
  var HelpDeskApiError = class extends ApiErrorBase {
2871
2940
  constructor() {
2872
2941
  super(...arguments);
2873
2942
  this.name = "helpdesk";
2874
2943
  }
2875
2944
  };
2876
- var helpdeskClientInstance = axios17.create({
2945
+ var helpdeskClientInstance = axios18.create({
2877
2946
  baseURL: "https://api.labs.helpdesk.com/v1"
2878
2947
  });
2879
2948
  helpdeskClientInstance.interceptors.response.use(
@@ -2948,7 +3017,7 @@ var LivechatWebhookSystemMessages = /* @__PURE__ */ ((LivechatWebhookSystemMessa
2948
3017
  })(LivechatWebhookSystemMessages || {});
2949
3018
 
2950
3019
  // src/apis/products/livechat/instance.ts
2951
- import axios18 from "axios";
3020
+ import axios19 from "axios";
2952
3021
  var REGION2 = {
2953
3022
  FRA: "fra",
2954
3023
  DAL: "dal",
@@ -2968,7 +3037,7 @@ var LivechatApiError = class extends ApiErrorBase {
2968
3037
  this.name = "livechat";
2969
3038
  }
2970
3039
  };
2971
- var livechatClientInstance = axios18.create({
3040
+ var livechatClientInstance = axios19.create({
2972
3041
  baseURL: "https://api.labs.livechatinc.com"
2973
3042
  });
2974
3043
  livechatClientInstance.interceptors.response.use(
@@ -3444,6 +3513,32 @@ var textPlatformWorkflowsFunctionsApi = {
3444
3513
  }
3445
3514
  };
3446
3515
 
3516
+ // src/apis/integrations/text/platform/workflow/resources/api.ts
3517
+ var textPlatformWorkflowsResourcesApi = {
3518
+ get(resource, authorization) {
3519
+ return __async(this, null, function* () {
3520
+ const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3521
+ ensureAuthorizationToken: true
3522
+ }));
3523
+ return textClientInstance.get(
3524
+ `/workflow_platform/external_resources/${encodeURIComponent(resource.product)}/${encodeURIComponent(resource.name)}`,
3525
+ __spreadProps(__spreadValues({}, config), {
3526
+ headers: __spreadProps(__spreadValues({}, config.headers), {
3527
+ "X-Cred-ID": authorization == null ? void 0 : authorization.credentialId
3528
+ })
3529
+ })
3530
+ ).catch((error) => {
3531
+ if (error instanceof TextApiError) {
3532
+ throw error.withCustomMessage(
3533
+ `Couldn't get external resources. [${error.message}]`
3534
+ );
3535
+ }
3536
+ throw error;
3537
+ });
3538
+ });
3539
+ }
3540
+ };
3541
+
3447
3542
  // src/apis/integrations/text/platform/workflow/workflows/api.ts
3448
3543
  var textPlatformWorkflowsApi = {
3449
3544
  getWorkflows(authorization) {
@@ -3595,7 +3690,8 @@ var textPlatformWorkflowsApi = {
3595
3690
  var textPlatformWorkflowApi = {
3596
3691
  workflows: textPlatformWorkflowsApi,
3597
3692
  credentials: textPlatformWorkflowsCredentialsApi,
3598
- functions: textPlatformWorkflowsFunctionsApi
3693
+ functions: textPlatformWorkflowsFunctionsApi,
3694
+ resources: textPlatformWorkflowsResourcesApi
3599
3695
  };
3600
3696
 
3601
3697
  // src/apis/integrations/text/platform/api.ts
@@ -3612,7 +3708,7 @@ var textApi = {
3612
3708
  };
3613
3709
 
3614
3710
  // src/apis/integrations/vercel/api.ts
3615
- import axios19 from "axios";
3711
+ import axios20 from "axios";
3616
3712
 
3617
3713
  // src/apis/integrations/vercel/deploy/api.ts
3618
3714
  var vercelDeployApi = {
@@ -3872,7 +3968,7 @@ var vercelApi = {
3872
3968
  client_secret: clientSecret,
3873
3969
  redirect_uri: redirectUrl
3874
3970
  });
3875
- const response = yield axios19.post("https://api.vercel.com/v2/oauth/access_token", data, {
3971
+ const response = yield axios20.post("https://api.vercel.com/v2/oauth/access_token", data, {
3876
3972
  headers: {
3877
3973
  "Content-Type": "application/x-www-form-urlencoded"
3878
3974
  }
@@ -3888,7 +3984,7 @@ var vercelApi = {
3888
3984
  };
3889
3985
 
3890
3986
  // src/apis/integrations/neon/api.ts
3891
- import axios20 from "axios";
3987
+ import axios21 from "axios";
3892
3988
 
3893
3989
  // src/apis/integrations/neon/project/branch/api.ts
3894
3990
  var neonProjectBranchApi = {
@@ -4132,7 +4228,7 @@ var neonApi = {
4132
4228
  redirect_uri: redirectUri,
4133
4229
  grant_type: "authorization_code"
4134
4230
  });
4135
- const response = yield axios20.post(
4231
+ const response = yield axios21.post(
4136
4232
  "https://oauth2.neon.tech/oauth2/token",
4137
4233
  data,
4138
4234
  {
@@ -4157,7 +4253,7 @@ var neonApi = {
4157
4253
  client_secret: clientSecret,
4158
4254
  grant_type: "refresh_token"
4159
4255
  });
4160
- const response = yield axios20.post("https://oauth2.neon.tech/oauth2/token", data, {
4256
+ const response = yield axios21.post("https://oauth2.neon.tech/oauth2/token", data, {
4161
4257
  headers: {
4162
4258
  "Content-Type": "application/x-www-form-urlencoded"
4163
4259
  }
@@ -4172,7 +4268,7 @@ var neonApi = {
4172
4268
  };
4173
4269
 
4174
4270
  // src/apis/integrations/mailchimp/api.ts
4175
- import axios21 from "axios";
4271
+ import axios22 from "axios";
4176
4272
 
4177
4273
  // src/apis/integrations/mailchimp/lists/webhooks/api.ts
4178
4274
  var mailchimpListsWebhooksApi = {
@@ -4229,7 +4325,7 @@ var mailchimpApi = {
4229
4325
  redirect_uri: redirectUri,
4230
4326
  grant_type: "authorization_code"
4231
4327
  });
4232
- const tokenResponse = yield axios21.post(
4328
+ const tokenResponse = yield axios22.post(
4233
4329
  "https://login.mailchimp.com/oauth2/token",
4234
4330
  data,
4235
4331
  {
@@ -4250,7 +4346,7 @@ var mailchimpApi = {
4250
4346
  return __async(this, arguments, function* ({ token }) {
4251
4347
  const {
4252
4348
  data: { dc: server }
4253
- } = yield axios21.get(
4349
+ } = yield axios22.get(
4254
4350
  "https://login.mailchimp.com/oauth2/metadata",
4255
4351
  {
4256
4352
  headers: {
@@ -4267,7 +4363,7 @@ var mailchimpApi = {
4267
4363
  };
4268
4364
 
4269
4365
  // src/apis/integrations/shopify/api.ts
4270
- import axios22 from "axios";
4366
+ import axios23 from "axios";
4271
4367
 
4272
4368
  // src/apis/integrations/shopify/webhooks/api.ts
4273
4369
  var shopifyWebhooksApi = {
@@ -4322,7 +4418,7 @@ var shopifyApi = {
4322
4418
  redirect_uri: redirectUri,
4323
4419
  grant_type: "authorization_code"
4324
4420
  });
4325
- const response = yield axios22.post(
4421
+ const response = yield axios23.post(
4326
4422
  `https://${encodeURIComponent(
4327
4423
  shop
4328
4424
  )}.myshopify.com/admin/oauth/access_token`,
@@ -4500,7 +4596,7 @@ var hubspotApi = {
4500
4596
  };
4501
4597
 
4502
4598
  // src/apis/integrations/bigcommerce/api.ts
4503
- import axios23 from "axios";
4599
+ import axios24 from "axios";
4504
4600
 
4505
4601
  // src/apis/integrations/bigcommerce/webhooks/api.ts
4506
4602
  var bigCommerceWebhooksApi = {
@@ -4554,7 +4650,7 @@ var bigcommerceApi = {
4554
4650
  redirect_uri: redirectUri,
4555
4651
  grant_type: "authorization_code"
4556
4652
  });
4557
- const tokenResponse = yield axios23.post(
4653
+ const tokenResponse = yield axios24.post(
4558
4654
  "https://login.bigcommerce.com/oauth2/token",
4559
4655
  data,
4560
4656
  {
@@ -4574,11 +4670,11 @@ var bigcommerceApi = {
4574
4670
  };
4575
4671
 
4576
4672
  // src/apis/integrations/openai/api.ts
4577
- import axios24 from "axios";
4673
+ import axios25 from "axios";
4578
4674
  var openaiApi = {
4579
4675
  verifyToken(token) {
4580
4676
  return __async(this, null, function* () {
4581
- const response = yield axios24.get("https://api.openai.com/v1/models", {
4677
+ const response = yield axios25.get("https://api.openai.com/v1/models", {
4582
4678
  headers: {
4583
4679
  Authorization: `Bearer ${token}`
4584
4680
  }
@@ -4588,6 +4684,43 @@ var openaiApi = {
4588
4684
  }
4589
4685
  };
4590
4686
 
4687
+ // src/apis/integrations/slack/api.ts
4688
+ var slackApi = {
4689
+ getToken(code, clientId, clientSecret, redirectUri) {
4690
+ return __async(this, null, function* () {
4691
+ var _a;
4692
+ const data = new URLSearchParams({
4693
+ code,
4694
+ client_id: clientId,
4695
+ client_secret: clientSecret,
4696
+ redirect_uri: redirectUri,
4697
+ grant_type: "authorization_code"
4698
+ });
4699
+ const tokenResponse = yield slackClientInstance.post(
4700
+ "/oauth/v1/token",
4701
+ data,
4702
+ {
4703
+ headers: {
4704
+ "Content-Type": "application/x-www-form-urlencoded"
4705
+ }
4706
+ }
4707
+ );
4708
+ const params = new URLSearchParams(
4709
+ tokenResponse.data
4710
+ );
4711
+ return {
4712
+ token: (_a = params.get("access_token")) != null ? _a : ""
4713
+ };
4714
+ });
4715
+ },
4716
+ getTokenInfo(token) {
4717
+ return __async(this, null, function* () {
4718
+ const { data: tokenInfo } = yield slackClientInstance.get(`/oauth/v1/access-tokens/${token}`);
4719
+ return tokenInfo;
4720
+ });
4721
+ }
4722
+ };
4723
+
4591
4724
  // src/apis/integrations/api.ts
4592
4725
  var integrationsApi = {
4593
4726
  github: gitHubApi,
@@ -4600,7 +4733,8 @@ var integrationsApi = {
4600
4733
  hubspot: hubspotApi,
4601
4734
  bigcommerce: bigcommerceApi,
4602
4735
  openai: openaiApi,
4603
- text: textApi
4736
+ text: textApi,
4737
+ slack: slackApi
4604
4738
  };
4605
4739
 
4606
4740
  // src/apis/products/livechat/agents/api.ts
@@ -7841,7 +7975,7 @@ var api = {
7841
7975
  isInitialized: false
7842
7976
  };
7843
7977
  function initApi(config, tokens) {
7844
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
7978
+ 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;
7845
7979
  initPlatformAccountsClient(
7846
7980
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
7847
7981
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.token
@@ -7858,7 +7992,8 @@ function initApi(config, tokens) {
7858
7992
  neon: tokens.neon,
7859
7993
  planetscale: tokens.planetscale,
7860
7994
  mailchimp: tokens.mailchimp,
7861
- shopify: tokens.shopify
7995
+ shopify: tokens.shopify,
7996
+ slack: tokens.slack
7862
7997
  } : void 0
7863
7998
  );
7864
7999
  initLiveChatClient((_h = config.urls.products) == null ? void 0 : _h.livechat, (_i = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _i.token);
@@ -7872,6 +8007,7 @@ function initApi(config, tokens) {
7872
8007
  initShopifyClient((_s = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _s.token, (_t = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _t.shop);
7873
8008
  initBigCommerceClient((_u = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _u.token, (_v = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _v.shop);
7874
8009
  initHubspotClient((_w = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _w.token);
8010
+ initSlackClient((_x = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _x.token);
7875
8011
  api.isInitialized = true;
7876
8012
  }
7877
8013
 
@@ -8002,6 +8138,7 @@ export {
8002
8138
  MailchimpEventNames,
8003
8139
  ShopifyApiError,
8004
8140
  ShopifyEventNames,
8141
+ SlackApiError,
8005
8142
  TextApiError,
8006
8143
  TextHelpDeskEventNames,
8007
8144
  TextLivechatEventNames,
@@ -8044,6 +8181,7 @@ export {
8044
8181
  getRegion2 as getRegion,
8045
8182
  getShopifyClientConfig,
8046
8183
  getShopifyClientUrl,
8184
+ getSlackClientConfig,
8047
8185
  getTextClientConfig,
8048
8186
  getVercelClientConfig,
8049
8187
  githubClientInstance,
@@ -8065,6 +8203,7 @@ export {
8065
8203
  initPlanetScaleClient,
8066
8204
  initPlatformAccountsClient,
8067
8205
  initShopifyClient,
8206
+ initSlackClient,
8068
8207
  initTextClient,
8069
8208
  initVercelClient,
8070
8209
  integrationEventsZods,
@@ -8078,6 +8217,7 @@ export {
8078
8217
  platformAccountsClientInstance,
8079
8218
  shopifyClientInstance,
8080
8219
  shopifyEventsZods,
8220
+ slackClientInstance,
8081
8221
  textClientInstance,
8082
8222
  textHelpDeskEventsZods,
8083
8223
  textLivechatEventsZods,
@@ -8090,6 +8230,7 @@ export {
8090
8230
  updateNetlifyClient,
8091
8231
  updatePlanetScaleClient,
8092
8232
  updateShopifyClient,
8233
+ updateSlackClient,
8093
8234
  updateVercelClient,
8094
8235
  vercelClientInstance
8095
8236
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livechat/developer-studio-api",
3
- "version": "3.4.13",
3
+ "version": "3.4.14",
4
4
  "description": "This project is API for LiveChat Developer Studio.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,8 +21,8 @@
21
21
  "tsup": "^7.1.0",
22
22
  "typescript": "^5.1.6",
23
23
  "eslint-config-custom": "0.0.10",
24
- "tsconfig": "0.0.1",
25
- "utils": "0.0.4"
24
+ "utils": "0.0.4",
25
+ "tsconfig": "0.0.1"
26
26
  },
27
27
  "scripts": {
28
28
  "build": "tsup",