@livechat/developer-studio-api 3.4.12 → 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
 
@@ -2182,7 +2244,8 @@ var textLivechatEventsZods = {
2182
2244
  eventName: z3.nativeEnum(TextLivechatEventNames),
2183
2245
  events: {
2184
2246
  chatStarted: z3.object({
2185
- name: z3.literal("chat_started" /* ChatStarted */)
2247
+ name: z3.literal("chat_started" /* ChatStarted */),
2248
+ targetAgentId: z3.string().email().optional()
2186
2249
  }),
2187
2250
  chatEnded: z3.object({
2188
2251
  name: z3.literal("chat_ended" /* ChatEnded */)
@@ -2540,7 +2603,7 @@ var integrationEventsZods = {
2540
2603
  };
2541
2604
 
2542
2605
  // src/apis/platform/adapter/instance.ts
2543
- import axios15 from "axios";
2606
+ import axios16 from "axios";
2544
2607
  var REGION = {
2545
2608
  FRA: "fra",
2546
2609
  DAL: "dal",
@@ -2570,7 +2633,7 @@ var AdapterApiError = class _AdapterApiError extends ApiErrorBase {
2570
2633
  );
2571
2634
  }
2572
2635
  };
2573
- var adapterClientInstance = axios15.create({
2636
+ var adapterClientInstance = axios16.create({
2574
2637
  baseURL: "https://platform.labs.text.com/console-adapter/api",
2575
2638
  headers: {
2576
2639
  "Content-Type": "application/json"
@@ -2593,7 +2656,7 @@ adapterClientInstance.interceptors.response.use(
2593
2656
  }
2594
2657
  );
2595
2658
  function getAdapterClientConfig(options = {}) {
2596
- 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;
2597
2660
  const currentHeaders = adapterClientInstance.defaults.headers;
2598
2661
  const headers = {
2599
2662
  platform: {
@@ -2613,49 +2676,53 @@ function getAdapterClientConfig(options = {}) {
2613
2676
  shopify: (_u = currentHeaders["x-adapter-shopify-token"]) != null ? _u : (_t = options.shopify) == null ? void 0 : _t.token,
2614
2677
  shopifyShop: (_w = currentHeaders["x-adapter-shopify-shop"]) != null ? _w : (_v = options.shopify) == null ? void 0 : _v.shop,
2615
2678
  hubspot: (_y = currentHeaders["x-adapter-hubspot-token"]) != null ? _y : (_x = options.hubspot) == null ? void 0 : _x.token,
2616
- bigcommerce: (_A = currentHeaders["x-adapter-bigcommerce-token"]) != null ? _A : (_z = options.bigcommerce) == null ? void 0 : _z.token,
2617
- bigcommerceShop: (_C = currentHeaders["x-adapter-bigcommerce-shop"]) != null ? _C : (_B = options.bigcommerce) == null ? void 0 : _B.shop,
2618
- 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
2619
2683
  }
2620
2684
  };
2621
2685
  if (currentHeaders.Authorization) {
2622
- currentHeaders["X-Region"] = (_F = getRegion(currentHeaders.Authorization)) != null ? _F : void 0;
2686
+ currentHeaders["X-Region"] = (_H = getRegion(currentHeaders.Authorization)) != null ? _H : void 0;
2623
2687
  }
2624
- 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) {
2625
2689
  throw new UnauthorizeApiError("accounts");
2626
2690
  }
2627
- 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)) {
2628
2692
  throw new UnauthorizeApiError("github");
2629
2693
  }
2630
- 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) {
2631
2695
  throw new UnauthorizeApiError("vercel");
2632
2696
  }
2633
- 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) {
2634
2698
  throw new UnauthorizeApiError("netlify");
2635
2699
  }
2636
- 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) {
2637
2701
  throw new UnauthorizeApiError("planetscale");
2638
2702
  }
2639
- 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) {
2640
2704
  throw new UnauthorizeApiError("neon");
2641
2705
  }
2642
- 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)) {
2643
2707
  throw new UnauthorizeApiError("mailchimp");
2644
2708
  }
2645
- 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)) {
2646
2710
  throw new UnauthorizeApiError("shopify");
2647
2711
  }
2648
- 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) {
2649
2713
  throw new UnauthorizeApiError("hubspot");
2650
2714
  }
2651
- 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)) {
2652
2719
  throw new UnauthorizeApiError("bigcommerce");
2653
2720
  }
2654
- 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) {
2655
2722
  throw new UnauthorizeApiError("text");
2656
2723
  }
2657
2724
  return {
2658
- 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 } : {})
2659
2726
  };
2660
2727
  }
2661
2728
  var getAdapterClientDefaultConfig = (authorization) => getAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -2678,7 +2745,7 @@ function initAdapterClient(baseUrl, tokens) {
2678
2745
  }
2679
2746
  }
2680
2747
  function updateAdapterClient(tokens) {
2681
- 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;
2682
2749
  const headers = adapterClientInstance.defaults.headers;
2683
2750
  if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
2684
2751
  headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
@@ -2716,13 +2783,16 @@ function updateAdapterClient(tokens) {
2716
2783
  if ((_m = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _m.token) {
2717
2784
  headers["x-adapter-hubspot-token"] = tokens.hubspot.token;
2718
2785
  }
2719
- 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) {
2720
2790
  headers["x-adapter-bigcommerce-shop"] = tokens.bigcommerce.shop;
2721
2791
  }
2722
- 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) {
2723
2793
  headers["x-adapter-bigcommerce-token"] = tokens.bigcommerce.token;
2724
2794
  }
2725
- 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) {
2726
2796
  headers["x-adapter-text-token"] = tokens.text.token;
2727
2797
  }
2728
2798
  }
@@ -2796,14 +2866,14 @@ var getAppAutoReviewPayload = (value) => {
2796
2866
  };
2797
2867
 
2798
2868
  // src/apis/platform/dps/instance.ts
2799
- import axios16 from "axios";
2869
+ import axios17 from "axios";
2800
2870
  var DpsApiError = class extends ApiErrorBase {
2801
2871
  constructor() {
2802
2872
  super(...arguments);
2803
2873
  this.name = "dps";
2804
2874
  }
2805
2875
  };
2806
- var dpsClientInstance = axios16.create({
2876
+ var dpsClientInstance = axios17.create({
2807
2877
  baseURL: "https://dev-platform.labs.livechatinc.com"
2808
2878
  });
2809
2879
  dpsClientInstance.interceptors.response.use(
@@ -2865,14 +2935,14 @@ var HelpDeskWebhookEventType = /* @__PURE__ */ ((HelpDeskWebhookEventType2) => {
2865
2935
  })(HelpDeskWebhookEventType || {});
2866
2936
 
2867
2937
  // src/apis/products/helpdesk/instance.ts
2868
- import axios17 from "axios";
2938
+ import axios18 from "axios";
2869
2939
  var HelpDeskApiError = class extends ApiErrorBase {
2870
2940
  constructor() {
2871
2941
  super(...arguments);
2872
2942
  this.name = "helpdesk";
2873
2943
  }
2874
2944
  };
2875
- var helpdeskClientInstance = axios17.create({
2945
+ var helpdeskClientInstance = axios18.create({
2876
2946
  baseURL: "https://api.labs.helpdesk.com/v1"
2877
2947
  });
2878
2948
  helpdeskClientInstance.interceptors.response.use(
@@ -2947,7 +3017,7 @@ var LivechatWebhookSystemMessages = /* @__PURE__ */ ((LivechatWebhookSystemMessa
2947
3017
  })(LivechatWebhookSystemMessages || {});
2948
3018
 
2949
3019
  // src/apis/products/livechat/instance.ts
2950
- import axios18 from "axios";
3020
+ import axios19 from "axios";
2951
3021
  var REGION2 = {
2952
3022
  FRA: "fra",
2953
3023
  DAL: "dal",
@@ -2967,7 +3037,7 @@ var LivechatApiError = class extends ApiErrorBase {
2967
3037
  this.name = "livechat";
2968
3038
  }
2969
3039
  };
2970
- var livechatClientInstance = axios18.create({
3040
+ var livechatClientInstance = axios19.create({
2971
3041
  baseURL: "https://api.labs.livechatinc.com"
2972
3042
  });
2973
3043
  livechatClientInstance.interceptors.response.use(
@@ -3443,6 +3513,32 @@ var textPlatformWorkflowsFunctionsApi = {
3443
3513
  }
3444
3514
  };
3445
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
+
3446
3542
  // src/apis/integrations/text/platform/workflow/workflows/api.ts
3447
3543
  var textPlatformWorkflowsApi = {
3448
3544
  getWorkflows(authorization) {
@@ -3594,7 +3690,8 @@ var textPlatformWorkflowsApi = {
3594
3690
  var textPlatformWorkflowApi = {
3595
3691
  workflows: textPlatformWorkflowsApi,
3596
3692
  credentials: textPlatformWorkflowsCredentialsApi,
3597
- functions: textPlatformWorkflowsFunctionsApi
3693
+ functions: textPlatformWorkflowsFunctionsApi,
3694
+ resources: textPlatformWorkflowsResourcesApi
3598
3695
  };
3599
3696
 
3600
3697
  // src/apis/integrations/text/platform/api.ts
@@ -3611,7 +3708,7 @@ var textApi = {
3611
3708
  };
3612
3709
 
3613
3710
  // src/apis/integrations/vercel/api.ts
3614
- import axios19 from "axios";
3711
+ import axios20 from "axios";
3615
3712
 
3616
3713
  // src/apis/integrations/vercel/deploy/api.ts
3617
3714
  var vercelDeployApi = {
@@ -3871,7 +3968,7 @@ var vercelApi = {
3871
3968
  client_secret: clientSecret,
3872
3969
  redirect_uri: redirectUrl
3873
3970
  });
3874
- 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, {
3875
3972
  headers: {
3876
3973
  "Content-Type": "application/x-www-form-urlencoded"
3877
3974
  }
@@ -3887,7 +3984,7 @@ var vercelApi = {
3887
3984
  };
3888
3985
 
3889
3986
  // src/apis/integrations/neon/api.ts
3890
- import axios20 from "axios";
3987
+ import axios21 from "axios";
3891
3988
 
3892
3989
  // src/apis/integrations/neon/project/branch/api.ts
3893
3990
  var neonProjectBranchApi = {
@@ -4131,7 +4228,7 @@ var neonApi = {
4131
4228
  redirect_uri: redirectUri,
4132
4229
  grant_type: "authorization_code"
4133
4230
  });
4134
- const response = yield axios20.post(
4231
+ const response = yield axios21.post(
4135
4232
  "https://oauth2.neon.tech/oauth2/token",
4136
4233
  data,
4137
4234
  {
@@ -4156,7 +4253,7 @@ var neonApi = {
4156
4253
  client_secret: clientSecret,
4157
4254
  grant_type: "refresh_token"
4158
4255
  });
4159
- 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, {
4160
4257
  headers: {
4161
4258
  "Content-Type": "application/x-www-form-urlencoded"
4162
4259
  }
@@ -4171,7 +4268,7 @@ var neonApi = {
4171
4268
  };
4172
4269
 
4173
4270
  // src/apis/integrations/mailchimp/api.ts
4174
- import axios21 from "axios";
4271
+ import axios22 from "axios";
4175
4272
 
4176
4273
  // src/apis/integrations/mailchimp/lists/webhooks/api.ts
4177
4274
  var mailchimpListsWebhooksApi = {
@@ -4228,7 +4325,7 @@ var mailchimpApi = {
4228
4325
  redirect_uri: redirectUri,
4229
4326
  grant_type: "authorization_code"
4230
4327
  });
4231
- const tokenResponse = yield axios21.post(
4328
+ const tokenResponse = yield axios22.post(
4232
4329
  "https://login.mailchimp.com/oauth2/token",
4233
4330
  data,
4234
4331
  {
@@ -4249,7 +4346,7 @@ var mailchimpApi = {
4249
4346
  return __async(this, arguments, function* ({ token }) {
4250
4347
  const {
4251
4348
  data: { dc: server }
4252
- } = yield axios21.get(
4349
+ } = yield axios22.get(
4253
4350
  "https://login.mailchimp.com/oauth2/metadata",
4254
4351
  {
4255
4352
  headers: {
@@ -4266,7 +4363,7 @@ var mailchimpApi = {
4266
4363
  };
4267
4364
 
4268
4365
  // src/apis/integrations/shopify/api.ts
4269
- import axios22 from "axios";
4366
+ import axios23 from "axios";
4270
4367
 
4271
4368
  // src/apis/integrations/shopify/webhooks/api.ts
4272
4369
  var shopifyWebhooksApi = {
@@ -4321,7 +4418,7 @@ var shopifyApi = {
4321
4418
  redirect_uri: redirectUri,
4322
4419
  grant_type: "authorization_code"
4323
4420
  });
4324
- const response = yield axios22.post(
4421
+ const response = yield axios23.post(
4325
4422
  `https://${encodeURIComponent(
4326
4423
  shop
4327
4424
  )}.myshopify.com/admin/oauth/access_token`,
@@ -4499,7 +4596,7 @@ var hubspotApi = {
4499
4596
  };
4500
4597
 
4501
4598
  // src/apis/integrations/bigcommerce/api.ts
4502
- import axios23 from "axios";
4599
+ import axios24 from "axios";
4503
4600
 
4504
4601
  // src/apis/integrations/bigcommerce/webhooks/api.ts
4505
4602
  var bigCommerceWebhooksApi = {
@@ -4553,7 +4650,7 @@ var bigcommerceApi = {
4553
4650
  redirect_uri: redirectUri,
4554
4651
  grant_type: "authorization_code"
4555
4652
  });
4556
- const tokenResponse = yield axios23.post(
4653
+ const tokenResponse = yield axios24.post(
4557
4654
  "https://login.bigcommerce.com/oauth2/token",
4558
4655
  data,
4559
4656
  {
@@ -4573,11 +4670,11 @@ var bigcommerceApi = {
4573
4670
  };
4574
4671
 
4575
4672
  // src/apis/integrations/openai/api.ts
4576
- import axios24 from "axios";
4673
+ import axios25 from "axios";
4577
4674
  var openaiApi = {
4578
4675
  verifyToken(token) {
4579
4676
  return __async(this, null, function* () {
4580
- const response = yield axios24.get("https://api.openai.com/v1/models", {
4677
+ const response = yield axios25.get("https://api.openai.com/v1/models", {
4581
4678
  headers: {
4582
4679
  Authorization: `Bearer ${token}`
4583
4680
  }
@@ -4587,6 +4684,43 @@ var openaiApi = {
4587
4684
  }
4588
4685
  };
4589
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
+
4590
4724
  // src/apis/integrations/api.ts
4591
4725
  var integrationsApi = {
4592
4726
  github: gitHubApi,
@@ -4599,7 +4733,8 @@ var integrationsApi = {
4599
4733
  hubspot: hubspotApi,
4600
4734
  bigcommerce: bigcommerceApi,
4601
4735
  openai: openaiApi,
4602
- text: textApi
4736
+ text: textApi,
4737
+ slack: slackApi
4603
4738
  };
4604
4739
 
4605
4740
  // src/apis/products/livechat/agents/api.ts
@@ -7840,7 +7975,7 @@ var api = {
7840
7975
  isInitialized: false
7841
7976
  };
7842
7977
  function initApi(config, tokens) {
7843
- 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;
7844
7979
  initPlatformAccountsClient(
7845
7980
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
7846
7981
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.token
@@ -7857,7 +7992,8 @@ function initApi(config, tokens) {
7857
7992
  neon: tokens.neon,
7858
7993
  planetscale: tokens.planetscale,
7859
7994
  mailchimp: tokens.mailchimp,
7860
- shopify: tokens.shopify
7995
+ shopify: tokens.shopify,
7996
+ slack: tokens.slack
7861
7997
  } : void 0
7862
7998
  );
7863
7999
  initLiveChatClient((_h = config.urls.products) == null ? void 0 : _h.livechat, (_i = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _i.token);
@@ -7871,6 +8007,7 @@ function initApi(config, tokens) {
7871
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);
7872
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);
7873
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);
7874
8011
  api.isInitialized = true;
7875
8012
  }
7876
8013
 
@@ -8001,6 +8138,7 @@ export {
8001
8138
  MailchimpEventNames,
8002
8139
  ShopifyApiError,
8003
8140
  ShopifyEventNames,
8141
+ SlackApiError,
8004
8142
  TextApiError,
8005
8143
  TextHelpDeskEventNames,
8006
8144
  TextLivechatEventNames,
@@ -8043,6 +8181,7 @@ export {
8043
8181
  getRegion2 as getRegion,
8044
8182
  getShopifyClientConfig,
8045
8183
  getShopifyClientUrl,
8184
+ getSlackClientConfig,
8046
8185
  getTextClientConfig,
8047
8186
  getVercelClientConfig,
8048
8187
  githubClientInstance,
@@ -8064,6 +8203,7 @@ export {
8064
8203
  initPlanetScaleClient,
8065
8204
  initPlatformAccountsClient,
8066
8205
  initShopifyClient,
8206
+ initSlackClient,
8067
8207
  initTextClient,
8068
8208
  initVercelClient,
8069
8209
  integrationEventsZods,
@@ -8077,6 +8217,7 @@ export {
8077
8217
  platformAccountsClientInstance,
8078
8218
  shopifyClientInstance,
8079
8219
  shopifyEventsZods,
8220
+ slackClientInstance,
8080
8221
  textClientInstance,
8081
8222
  textHelpDeskEventsZods,
8082
8223
  textLivechatEventsZods,
@@ -8089,6 +8230,7 @@ export {
8089
8230
  updateNetlifyClient,
8090
8231
  updatePlanetScaleClient,
8091
8232
  updateShopifyClient,
8233
+ updateSlackClient,
8092
8234
  updateVercelClient,
8093
8235
  vercelClientInstance
8094
8236
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livechat/developer-studio-api",
3
- "version": "3.4.12",
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",