@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.js CHANGED
@@ -92,6 +92,7 @@ __export(src_exports, {
92
92
  MailchimpEventNames: () => MailchimpEventNames,
93
93
  ShopifyApiError: () => ShopifyApiError,
94
94
  ShopifyEventNames: () => ShopifyEventNames,
95
+ SlackApiError: () => SlackApiError,
95
96
  TextApiError: () => TextApiError,
96
97
  TextHelpDeskEventNames: () => TextHelpDeskEventNames,
97
98
  TextLivechatEventNames: () => TextLivechatEventNames,
@@ -134,6 +135,7 @@ __export(src_exports, {
134
135
  getRegion: () => getRegion2,
135
136
  getShopifyClientConfig: () => getShopifyClientConfig,
136
137
  getShopifyClientUrl: () => getShopifyClientUrl,
138
+ getSlackClientConfig: () => getSlackClientConfig,
137
139
  getTextClientConfig: () => getTextClientConfig,
138
140
  getVercelClientConfig: () => getVercelClientConfig,
139
141
  githubClientInstance: () => githubClientInstance,
@@ -155,6 +157,7 @@ __export(src_exports, {
155
157
  initPlanetScaleClient: () => initPlanetScaleClient,
156
158
  initPlatformAccountsClient: () => initPlatformAccountsClient,
157
159
  initShopifyClient: () => initShopifyClient,
160
+ initSlackClient: () => initSlackClient,
158
161
  initTextClient: () => initTextClient,
159
162
  initVercelClient: () => initVercelClient,
160
163
  integrationEventsZods: () => integrationEventsZods,
@@ -168,6 +171,7 @@ __export(src_exports, {
168
171
  platformAccountsClientInstance: () => platformAccountsClientInstance,
169
172
  shopifyClientInstance: () => shopifyClientInstance,
170
173
  shopifyEventsZods: () => shopifyEventsZods,
174
+ slackClientInstance: () => slackClientInstance,
171
175
  textClientInstance: () => textClientInstance,
172
176
  textHelpDeskEventsZods: () => textHelpDeskEventsZods,
173
177
  textLivechatEventsZods: () => textLivechatEventsZods,
@@ -180,6 +184,7 @@ __export(src_exports, {
180
184
  updateNetlifyClient: () => updateNetlifyClient,
181
185
  updatePlanetScaleClient: () => updatePlanetScaleClient,
182
186
  updateShopifyClient: () => updateShopifyClient,
187
+ updateSlackClient: () => updateSlackClient,
183
188
  updateVercelClient: () => updateVercelClient,
184
189
  vercelClientInstance: () => vercelClientInstance
185
190
  });
@@ -2079,6 +2084,66 @@ function updateBigCommerceClient(token, shop) {
2079
2084
  }
2080
2085
  }
2081
2086
 
2087
+ // src/apis/integrations/slack/instance.ts
2088
+ var import_axios16 = __toESM(require("axios"));
2089
+ var SlackApiError = class extends ApiErrorBase {
2090
+ constructor() {
2091
+ super(...arguments);
2092
+ this.name = "slack";
2093
+ }
2094
+ };
2095
+ var slackClientInstance = import_axios16.default.create({
2096
+ baseURL: "https://slack.com/api",
2097
+ headers: {
2098
+ "Content-Type": "application/json"
2099
+ }
2100
+ });
2101
+ slackClientInstance.interceptors.response.use(
2102
+ (r) => r,
2103
+ (error) => {
2104
+ var _a, _b, _c, _d;
2105
+ if (import_axios16.default.isAxiosError(error)) {
2106
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2107
+ throw new UnauthorizeApiError("slack");
2108
+ }
2109
+ }
2110
+ return Promise.reject(
2111
+ new SlackApiError(
2112
+ error.message,
2113
+ (_b = error.response) == null ? void 0 : _b.data,
2114
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
2115
+ )
2116
+ );
2117
+ }
2118
+ );
2119
+ function getSlackClientConfig(options = {}) {
2120
+ var _a;
2121
+ const currentHeaders = slackClientInstance.defaults.headers;
2122
+ const config = {
2123
+ authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : currentHeaders.Authorization
2124
+ };
2125
+ if (options.ensureAuthorizationToken && !config.authorization) {
2126
+ throw new UnauthorizeApiError("slack");
2127
+ }
2128
+ return {
2129
+ headers: __spreadValues({}, config.authorization ? { Authorization: config.authorization } : {})
2130
+ };
2131
+ }
2132
+ function updateSlackClient(token) {
2133
+ const defaults = slackClientInstance.defaults;
2134
+ const headers = defaults.headers;
2135
+ if (token) {
2136
+ headers.Authorization = `Bearer ${token}`;
2137
+ } else {
2138
+ delete headers.Authorization;
2139
+ }
2140
+ }
2141
+ function initSlackClient(token) {
2142
+ if (token) {
2143
+ updateSlackClient(token);
2144
+ }
2145
+ }
2146
+
2082
2147
  // src/apis/platform/accounts/instance.ts
2083
2148
  var AccountsApiError = class extends ApiErrorBase {
2084
2149
  constructor() {
@@ -2118,8 +2183,8 @@ function initPlatformAccountsClient(baseUrl, token) {
2118
2183
  }
2119
2184
 
2120
2185
  // src/apis/platform/billing/instance.ts
2121
- var import_axios16 = __toESM(require("axios"));
2122
- var billingClientInstance = import_axios16.default.create({
2186
+ var import_axios17 = __toESM(require("axios"));
2187
+ var billingClientInstance = import_axios17.default.create({
2123
2188
  baseURL: "https://billing.labs.livechatinc.com"
2124
2189
  });
2125
2190
  function getBillingClientConfig(options = {}) {
@@ -2172,6 +2237,7 @@ var IntegrationNames = /* @__PURE__ */ ((IntegrationNames2) => {
2172
2237
  IntegrationNames2["Text"] = "text";
2173
2238
  IntegrationNames2["LiveChat"] = "text-livechat";
2174
2239
  IntegrationNames2["HelpDesk"] = "text-helpdesk";
2240
+ IntegrationNames2["Slack"] = "slack";
2175
2241
  return IntegrationNames2;
2176
2242
  })(IntegrationNames || {});
2177
2243
  var IntegrationDisplayNames = /* @__PURE__ */ ((IntegrationDisplayNames2) => {
@@ -2189,6 +2255,7 @@ var IntegrationDisplayNames = /* @__PURE__ */ ((IntegrationDisplayNames2) => {
2189
2255
  IntegrationDisplayNames2["Text"] = "Text";
2190
2256
  IntegrationDisplayNames2["LiveChat"] = "LiveChat";
2191
2257
  IntegrationDisplayNames2["HelpDesk"] = "HelpDesk";
2258
+ IntegrationDisplayNames2["Slack"] = "Slack";
2192
2259
  return IntegrationDisplayNames2;
2193
2260
  })(IntegrationDisplayNames || {});
2194
2261
 
@@ -2688,7 +2755,7 @@ var integrationEventsZods = {
2688
2755
  };
2689
2756
 
2690
2757
  // src/apis/platform/adapter/instance.ts
2691
- var import_axios17 = __toESM(require("axios"));
2758
+ var import_axios18 = __toESM(require("axios"));
2692
2759
  var REGION = {
2693
2760
  FRA: "fra",
2694
2761
  DAL: "dal",
@@ -2718,7 +2785,7 @@ var AdapterApiError = class _AdapterApiError extends ApiErrorBase {
2718
2785
  );
2719
2786
  }
2720
2787
  };
2721
- var adapterClientInstance = import_axios17.default.create({
2788
+ var adapterClientInstance = import_axios18.default.create({
2722
2789
  baseURL: "https://platform.labs.text.com/console-adapter/api",
2723
2790
  headers: {
2724
2791
  "Content-Type": "application/json"
@@ -2741,7 +2808,7 @@ adapterClientInstance.interceptors.response.use(
2741
2808
  }
2742
2809
  );
2743
2810
  function getAdapterClientConfig(options = {}) {
2744
- 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;
2811
+ 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;
2745
2812
  const currentHeaders = adapterClientInstance.defaults.headers;
2746
2813
  const headers = {
2747
2814
  platform: {
@@ -2761,49 +2828,53 @@ function getAdapterClientConfig(options = {}) {
2761
2828
  shopify: (_u = currentHeaders["x-adapter-shopify-token"]) != null ? _u : (_t = options.shopify) == null ? void 0 : _t.token,
2762
2829
  shopifyShop: (_w = currentHeaders["x-adapter-shopify-shop"]) != null ? _w : (_v = options.shopify) == null ? void 0 : _v.shop,
2763
2830
  hubspot: (_y = currentHeaders["x-adapter-hubspot-token"]) != null ? _y : (_x = options.hubspot) == null ? void 0 : _x.token,
2764
- bigcommerce: (_A = currentHeaders["x-adapter-bigcommerce-token"]) != null ? _A : (_z = options.bigcommerce) == null ? void 0 : _z.token,
2765
- bigcommerceShop: (_C = currentHeaders["x-adapter-bigcommerce-shop"]) != null ? _C : (_B = options.bigcommerce) == null ? void 0 : _B.shop,
2766
- text: (_E = currentHeaders["x-adapter-text-token"]) != null ? _E : (_D = options.text) == null ? void 0 : _D.token
2831
+ slack: (_A = currentHeaders["x-adapter-slack-token"]) != null ? _A : (_z = options.slack) == null ? void 0 : _z.token,
2832
+ bigcommerce: (_C = currentHeaders["x-adapter-bigcommerce-token"]) != null ? _C : (_B = options.bigcommerce) == null ? void 0 : _B.token,
2833
+ bigcommerceShop: (_E = currentHeaders["x-adapter-bigcommerce-shop"]) != null ? _E : (_D = options.bigcommerce) == null ? void 0 : _D.shop,
2834
+ text: (_G = currentHeaders["x-adapter-text-token"]) != null ? _G : (_F = options.text) == null ? void 0 : _F.token
2767
2835
  }
2768
2836
  };
2769
2837
  if (currentHeaders.Authorization) {
2770
- currentHeaders["X-Region"] = (_F = getRegion(currentHeaders.Authorization)) != null ? _F : void 0;
2838
+ currentHeaders["X-Region"] = (_H = getRegion(currentHeaders.Authorization)) != null ? _H : void 0;
2771
2839
  }
2772
- if (((_G = options.ensureAuthorizationToken) == null ? void 0 : _G.platform) && !headers.platform.token) {
2840
+ if (((_I = options.ensureAuthorizationToken) == null ? void 0 : _I.platform) && !headers.platform.token) {
2773
2841
  throw new UnauthorizeApiError("accounts");
2774
2842
  }
2775
- if (((_H = options.ensureAuthorizationToken) == null ? void 0 : _H.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
2843
+ if (((_J = options.ensureAuthorizationToken) == null ? void 0 : _J.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
2776
2844
  throw new UnauthorizeApiError("github");
2777
2845
  }
2778
- if (((_I = options.ensureAuthorizationToken) == null ? void 0 : _I.vercel) && !headers.integrations.vercel) {
2846
+ if (((_K = options.ensureAuthorizationToken) == null ? void 0 : _K.vercel) && !headers.integrations.vercel) {
2779
2847
  throw new UnauthorizeApiError("vercel");
2780
2848
  }
2781
- if (((_J = options.ensureAuthorizationToken) == null ? void 0 : _J.netlify) && !headers.integrations.netlify) {
2849
+ if (((_L = options.ensureAuthorizationToken) == null ? void 0 : _L.netlify) && !headers.integrations.netlify) {
2782
2850
  throw new UnauthorizeApiError("netlify");
2783
2851
  }
2784
- if (((_K = options.ensureAuthorizationToken) == null ? void 0 : _K.planetscale) && !headers.integrations.planetscale) {
2852
+ if (((_M = options.ensureAuthorizationToken) == null ? void 0 : _M.planetscale) && !headers.integrations.planetscale) {
2785
2853
  throw new UnauthorizeApiError("planetscale");
2786
2854
  }
2787
- if (((_L = options.ensureAuthorizationToken) == null ? void 0 : _L.neon) && !headers.integrations.neon) {
2855
+ if (((_N = options.ensureAuthorizationToken) == null ? void 0 : _N.neon) && !headers.integrations.neon) {
2788
2856
  throw new UnauthorizeApiError("neon");
2789
2857
  }
2790
- if (((_M = options.ensureAuthorizationToken) == null ? void 0 : _M.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
2858
+ if (((_O = options.ensureAuthorizationToken) == null ? void 0 : _O.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
2791
2859
  throw new UnauthorizeApiError("mailchimp");
2792
2860
  }
2793
- if (((_N = options.ensureAuthorizationToken) == null ? void 0 : _N.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
2861
+ if (((_P = options.ensureAuthorizationToken) == null ? void 0 : _P.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
2794
2862
  throw new UnauthorizeApiError("shopify");
2795
2863
  }
2796
- if (((_O = options.ensureAuthorizationToken) == null ? void 0 : _O.hubspot) && !headers.integrations.hubspot) {
2864
+ if (((_Q = options.ensureAuthorizationToken) == null ? void 0 : _Q.hubspot) && !headers.integrations.hubspot) {
2797
2865
  throw new UnauthorizeApiError("hubspot");
2798
2866
  }
2799
- if (((_P = options.ensureAuthorizationToken) == null ? void 0 : _P.bigcommerce) && (!headers.integrations.bigcommerce || !headers.integrations.bigcommerceShop)) {
2867
+ if (((_R = options.ensureAuthorizationToken) == null ? void 0 : _R.slack) && !headers.integrations.slack) {
2868
+ throw new UnauthorizeApiError("slack");
2869
+ }
2870
+ if (((_S = options.ensureAuthorizationToken) == null ? void 0 : _S.bigcommerce) && (!headers.integrations.bigcommerce || !headers.integrations.bigcommerceShop)) {
2800
2871
  throw new UnauthorizeApiError("bigcommerce");
2801
2872
  }
2802
- if (((_Q = options.ensureAuthorizationToken) == null ? void 0 : _Q.text) && !headers.integrations.text) {
2873
+ if (((_T = options.ensureAuthorizationToken) == null ? void 0 : _T.text) && !headers.integrations.text) {
2803
2874
  throw new UnauthorizeApiError("text");
2804
2875
  }
2805
2876
  return {
2806
- 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 } : {})
2877
+ 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 } : {})
2807
2878
  };
2808
2879
  }
2809
2880
  var getAdapterClientDefaultConfig = (authorization) => getAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -2826,7 +2897,7 @@ function initAdapterClient(baseUrl, tokens) {
2826
2897
  }
2827
2898
  }
2828
2899
  function updateAdapterClient(tokens) {
2829
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
2900
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
2830
2901
  const headers = adapterClientInstance.defaults.headers;
2831
2902
  if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
2832
2903
  headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
@@ -2864,13 +2935,16 @@ function updateAdapterClient(tokens) {
2864
2935
  if ((_m = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _m.token) {
2865
2936
  headers["x-adapter-hubspot-token"] = tokens.hubspot.token;
2866
2937
  }
2867
- if ((_n = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _n.shop) {
2938
+ if ((_n = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _n.token) {
2939
+ headers["x-adapter-slack-token"] = tokens.slack.token;
2940
+ }
2941
+ if ((_o = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _o.shop) {
2868
2942
  headers["x-adapter-bigcommerce-shop"] = tokens.bigcommerce.shop;
2869
2943
  }
2870
- if ((_o = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _o.token) {
2944
+ if ((_p = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _p.token) {
2871
2945
  headers["x-adapter-bigcommerce-token"] = tokens.bigcommerce.token;
2872
2946
  }
2873
- if ((_p = tokens == null ? void 0 : tokens.text) == null ? void 0 : _p.token) {
2947
+ if ((_q = tokens == null ? void 0 : tokens.text) == null ? void 0 : _q.token) {
2874
2948
  headers["x-adapter-text-token"] = tokens.text.token;
2875
2949
  }
2876
2950
  }
@@ -2944,14 +3018,14 @@ var getAppAutoReviewPayload = (value) => {
2944
3018
  };
2945
3019
 
2946
3020
  // src/apis/platform/dps/instance.ts
2947
- var import_axios18 = __toESM(require("axios"));
3021
+ var import_axios19 = __toESM(require("axios"));
2948
3022
  var DpsApiError = class extends ApiErrorBase {
2949
3023
  constructor() {
2950
3024
  super(...arguments);
2951
3025
  this.name = "dps";
2952
3026
  }
2953
3027
  };
2954
- var dpsClientInstance = import_axios18.default.create({
3028
+ var dpsClientInstance = import_axios19.default.create({
2955
3029
  baseURL: "https://dev-platform.labs.livechatinc.com"
2956
3030
  });
2957
3031
  dpsClientInstance.interceptors.response.use(
@@ -3013,14 +3087,14 @@ var HelpDeskWebhookEventType = /* @__PURE__ */ ((HelpDeskWebhookEventType2) => {
3013
3087
  })(HelpDeskWebhookEventType || {});
3014
3088
 
3015
3089
  // src/apis/products/helpdesk/instance.ts
3016
- var import_axios19 = __toESM(require("axios"));
3090
+ var import_axios20 = __toESM(require("axios"));
3017
3091
  var HelpDeskApiError = class extends ApiErrorBase {
3018
3092
  constructor() {
3019
3093
  super(...arguments);
3020
3094
  this.name = "helpdesk";
3021
3095
  }
3022
3096
  };
3023
- var helpdeskClientInstance = import_axios19.default.create({
3097
+ var helpdeskClientInstance = import_axios20.default.create({
3024
3098
  baseURL: "https://api.labs.helpdesk.com/v1"
3025
3099
  });
3026
3100
  helpdeskClientInstance.interceptors.response.use(
@@ -3095,7 +3169,7 @@ var LivechatWebhookSystemMessages = /* @__PURE__ */ ((LivechatWebhookSystemMessa
3095
3169
  })(LivechatWebhookSystemMessages || {});
3096
3170
 
3097
3171
  // src/apis/products/livechat/instance.ts
3098
- var import_axios20 = __toESM(require("axios"));
3172
+ var import_axios21 = __toESM(require("axios"));
3099
3173
  var REGION2 = {
3100
3174
  FRA: "fra",
3101
3175
  DAL: "dal",
@@ -3115,7 +3189,7 @@ var LivechatApiError = class extends ApiErrorBase {
3115
3189
  this.name = "livechat";
3116
3190
  }
3117
3191
  };
3118
- var livechatClientInstance = import_axios20.default.create({
3192
+ var livechatClientInstance = import_axios21.default.create({
3119
3193
  baseURL: "https://api.labs.livechatinc.com"
3120
3194
  });
3121
3195
  livechatClientInstance.interceptors.response.use(
@@ -3591,6 +3665,32 @@ var textPlatformWorkflowsFunctionsApi = {
3591
3665
  }
3592
3666
  };
3593
3667
 
3668
+ // src/apis/integrations/text/platform/workflow/resources/api.ts
3669
+ var textPlatformWorkflowsResourcesApi = {
3670
+ get(resource, authorization) {
3671
+ return __async(this, null, function* () {
3672
+ const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3673
+ ensureAuthorizationToken: true
3674
+ }));
3675
+ return textClientInstance.get(
3676
+ `/workflow_platform/external_resources/${encodeURIComponent(resource.product)}/${encodeURIComponent(resource.name)}`,
3677
+ __spreadProps(__spreadValues({}, config), {
3678
+ headers: __spreadProps(__spreadValues({}, config.headers), {
3679
+ "X-Cred-ID": authorization == null ? void 0 : authorization.credentialId
3680
+ })
3681
+ })
3682
+ ).catch((error) => {
3683
+ if (error instanceof TextApiError) {
3684
+ throw error.withCustomMessage(
3685
+ `Couldn't get external resources. [${error.message}]`
3686
+ );
3687
+ }
3688
+ throw error;
3689
+ });
3690
+ });
3691
+ }
3692
+ };
3693
+
3594
3694
  // src/apis/integrations/text/platform/workflow/workflows/api.ts
3595
3695
  var textPlatformWorkflowsApi = {
3596
3696
  getWorkflows(authorization) {
@@ -3742,7 +3842,8 @@ var textPlatformWorkflowsApi = {
3742
3842
  var textPlatformWorkflowApi = {
3743
3843
  workflows: textPlatformWorkflowsApi,
3744
3844
  credentials: textPlatformWorkflowsCredentialsApi,
3745
- functions: textPlatformWorkflowsFunctionsApi
3845
+ functions: textPlatformWorkflowsFunctionsApi,
3846
+ resources: textPlatformWorkflowsResourcesApi
3746
3847
  };
3747
3848
 
3748
3849
  // src/apis/integrations/text/platform/api.ts
@@ -3759,7 +3860,7 @@ var textApi = {
3759
3860
  };
3760
3861
 
3761
3862
  // src/apis/integrations/vercel/api.ts
3762
- var import_axios21 = __toESM(require("axios"));
3863
+ var import_axios22 = __toESM(require("axios"));
3763
3864
 
3764
3865
  // src/apis/integrations/vercel/deploy/api.ts
3765
3866
  var vercelDeployApi = {
@@ -4019,7 +4120,7 @@ var vercelApi = {
4019
4120
  client_secret: clientSecret,
4020
4121
  redirect_uri: redirectUrl
4021
4122
  });
4022
- const response = yield import_axios21.default.post("https://api.vercel.com/v2/oauth/access_token", data, {
4123
+ const response = yield import_axios22.default.post("https://api.vercel.com/v2/oauth/access_token", data, {
4023
4124
  headers: {
4024
4125
  "Content-Type": "application/x-www-form-urlencoded"
4025
4126
  }
@@ -4035,7 +4136,7 @@ var vercelApi = {
4035
4136
  };
4036
4137
 
4037
4138
  // src/apis/integrations/neon/api.ts
4038
- var import_axios22 = __toESM(require("axios"));
4139
+ var import_axios23 = __toESM(require("axios"));
4039
4140
 
4040
4141
  // src/apis/integrations/neon/project/branch/api.ts
4041
4142
  var neonProjectBranchApi = {
@@ -4279,7 +4380,7 @@ var neonApi = {
4279
4380
  redirect_uri: redirectUri,
4280
4381
  grant_type: "authorization_code"
4281
4382
  });
4282
- const response = yield import_axios22.default.post(
4383
+ const response = yield import_axios23.default.post(
4283
4384
  "https://oauth2.neon.tech/oauth2/token",
4284
4385
  data,
4285
4386
  {
@@ -4304,7 +4405,7 @@ var neonApi = {
4304
4405
  client_secret: clientSecret,
4305
4406
  grant_type: "refresh_token"
4306
4407
  });
4307
- const response = yield import_axios22.default.post("https://oauth2.neon.tech/oauth2/token", data, {
4408
+ const response = yield import_axios23.default.post("https://oauth2.neon.tech/oauth2/token", data, {
4308
4409
  headers: {
4309
4410
  "Content-Type": "application/x-www-form-urlencoded"
4310
4411
  }
@@ -4319,7 +4420,7 @@ var neonApi = {
4319
4420
  };
4320
4421
 
4321
4422
  // src/apis/integrations/mailchimp/api.ts
4322
- var import_axios23 = __toESM(require("axios"));
4423
+ var import_axios24 = __toESM(require("axios"));
4323
4424
 
4324
4425
  // src/apis/integrations/mailchimp/lists/webhooks/api.ts
4325
4426
  var mailchimpListsWebhooksApi = {
@@ -4376,7 +4477,7 @@ var mailchimpApi = {
4376
4477
  redirect_uri: redirectUri,
4377
4478
  grant_type: "authorization_code"
4378
4479
  });
4379
- const tokenResponse = yield import_axios23.default.post(
4480
+ const tokenResponse = yield import_axios24.default.post(
4380
4481
  "https://login.mailchimp.com/oauth2/token",
4381
4482
  data,
4382
4483
  {
@@ -4397,7 +4498,7 @@ var mailchimpApi = {
4397
4498
  return __async(this, arguments, function* ({ token }) {
4398
4499
  const {
4399
4500
  data: { dc: server }
4400
- } = yield import_axios23.default.get(
4501
+ } = yield import_axios24.default.get(
4401
4502
  "https://login.mailchimp.com/oauth2/metadata",
4402
4503
  {
4403
4504
  headers: {
@@ -4414,7 +4515,7 @@ var mailchimpApi = {
4414
4515
  };
4415
4516
 
4416
4517
  // src/apis/integrations/shopify/api.ts
4417
- var import_axios24 = __toESM(require("axios"));
4518
+ var import_axios25 = __toESM(require("axios"));
4418
4519
 
4419
4520
  // src/apis/integrations/shopify/webhooks/api.ts
4420
4521
  var shopifyWebhooksApi = {
@@ -4469,7 +4570,7 @@ var shopifyApi = {
4469
4570
  redirect_uri: redirectUri,
4470
4571
  grant_type: "authorization_code"
4471
4572
  });
4472
- const response = yield import_axios24.default.post(
4573
+ const response = yield import_axios25.default.post(
4473
4574
  `https://${encodeURIComponent(
4474
4575
  shop
4475
4576
  )}.myshopify.com/admin/oauth/access_token`,
@@ -4647,7 +4748,7 @@ var hubspotApi = {
4647
4748
  };
4648
4749
 
4649
4750
  // src/apis/integrations/bigcommerce/api.ts
4650
- var import_axios25 = __toESM(require("axios"));
4751
+ var import_axios26 = __toESM(require("axios"));
4651
4752
 
4652
4753
  // src/apis/integrations/bigcommerce/webhooks/api.ts
4653
4754
  var bigCommerceWebhooksApi = {
@@ -4701,7 +4802,7 @@ var bigcommerceApi = {
4701
4802
  redirect_uri: redirectUri,
4702
4803
  grant_type: "authorization_code"
4703
4804
  });
4704
- const tokenResponse = yield import_axios25.default.post(
4805
+ const tokenResponse = yield import_axios26.default.post(
4705
4806
  "https://login.bigcommerce.com/oauth2/token",
4706
4807
  data,
4707
4808
  {
@@ -4721,11 +4822,11 @@ var bigcommerceApi = {
4721
4822
  };
4722
4823
 
4723
4824
  // src/apis/integrations/openai/api.ts
4724
- var import_axios26 = __toESM(require("axios"));
4825
+ var import_axios27 = __toESM(require("axios"));
4725
4826
  var openaiApi = {
4726
4827
  verifyToken(token) {
4727
4828
  return __async(this, null, function* () {
4728
- const response = yield import_axios26.default.get("https://api.openai.com/v1/models", {
4829
+ const response = yield import_axios27.default.get("https://api.openai.com/v1/models", {
4729
4830
  headers: {
4730
4831
  Authorization: `Bearer ${token}`
4731
4832
  }
@@ -4735,6 +4836,43 @@ var openaiApi = {
4735
4836
  }
4736
4837
  };
4737
4838
 
4839
+ // src/apis/integrations/slack/api.ts
4840
+ var slackApi = {
4841
+ getToken(code, clientId, clientSecret, redirectUri) {
4842
+ return __async(this, null, function* () {
4843
+ var _a;
4844
+ const data = new URLSearchParams({
4845
+ code,
4846
+ client_id: clientId,
4847
+ client_secret: clientSecret,
4848
+ redirect_uri: redirectUri,
4849
+ grant_type: "authorization_code"
4850
+ });
4851
+ const tokenResponse = yield slackClientInstance.post(
4852
+ "/oauth/v1/token",
4853
+ data,
4854
+ {
4855
+ headers: {
4856
+ "Content-Type": "application/x-www-form-urlencoded"
4857
+ }
4858
+ }
4859
+ );
4860
+ const params = new URLSearchParams(
4861
+ tokenResponse.data
4862
+ );
4863
+ return {
4864
+ token: (_a = params.get("access_token")) != null ? _a : ""
4865
+ };
4866
+ });
4867
+ },
4868
+ getTokenInfo(token) {
4869
+ return __async(this, null, function* () {
4870
+ const { data: tokenInfo } = yield slackClientInstance.get(`/oauth/v1/access-tokens/${token}`);
4871
+ return tokenInfo;
4872
+ });
4873
+ }
4874
+ };
4875
+
4738
4876
  // src/apis/integrations/api.ts
4739
4877
  var integrationsApi = {
4740
4878
  github: gitHubApi,
@@ -4747,7 +4885,8 @@ var integrationsApi = {
4747
4885
  hubspot: hubspotApi,
4748
4886
  bigcommerce: bigcommerceApi,
4749
4887
  openai: openaiApi,
4750
- text: textApi
4888
+ text: textApi,
4889
+ slack: slackApi
4751
4890
  };
4752
4891
 
4753
4892
  // src/apis/products/livechat/agents/api.ts
@@ -7988,7 +8127,7 @@ var api = {
7988
8127
  isInitialized: false
7989
8128
  };
7990
8129
  function initApi(config, tokens) {
7991
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
8130
+ 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;
7992
8131
  initPlatformAccountsClient(
7993
8132
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
7994
8133
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.token
@@ -8005,7 +8144,8 @@ function initApi(config, tokens) {
8005
8144
  neon: tokens.neon,
8006
8145
  planetscale: tokens.planetscale,
8007
8146
  mailchimp: tokens.mailchimp,
8008
- shopify: tokens.shopify
8147
+ shopify: tokens.shopify,
8148
+ slack: tokens.slack
8009
8149
  } : void 0
8010
8150
  );
8011
8151
  initLiveChatClient((_h = config.urls.products) == null ? void 0 : _h.livechat, (_i = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _i.token);
@@ -8019,6 +8159,7 @@ function initApi(config, tokens) {
8019
8159
  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);
8020
8160
  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);
8021
8161
  initHubspotClient((_w = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _w.token);
8162
+ initSlackClient((_x = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _x.token);
8022
8163
  api.isInitialized = true;
8023
8164
  }
8024
8165
 
@@ -8150,6 +8291,7 @@ var debounce = (func, wait) => {
8150
8291
  MailchimpEventNames,
8151
8292
  ShopifyApiError,
8152
8293
  ShopifyEventNames,
8294
+ SlackApiError,
8153
8295
  TextApiError,
8154
8296
  TextHelpDeskEventNames,
8155
8297
  TextLivechatEventNames,
@@ -8192,6 +8334,7 @@ var debounce = (func, wait) => {
8192
8334
  getRegion,
8193
8335
  getShopifyClientConfig,
8194
8336
  getShopifyClientUrl,
8337
+ getSlackClientConfig,
8195
8338
  getTextClientConfig,
8196
8339
  getVercelClientConfig,
8197
8340
  githubClientInstance,
@@ -8213,6 +8356,7 @@ var debounce = (func, wait) => {
8213
8356
  initPlanetScaleClient,
8214
8357
  initPlatformAccountsClient,
8215
8358
  initShopifyClient,
8359
+ initSlackClient,
8216
8360
  initTextClient,
8217
8361
  initVercelClient,
8218
8362
  integrationEventsZods,
@@ -8226,6 +8370,7 @@ var debounce = (func, wait) => {
8226
8370
  platformAccountsClientInstance,
8227
8371
  shopifyClientInstance,
8228
8372
  shopifyEventsZods,
8373
+ slackClientInstance,
8229
8374
  textClientInstance,
8230
8375
  textHelpDeskEventsZods,
8231
8376
  textLivechatEventsZods,
@@ -8238,6 +8383,7 @@ var debounce = (func, wait) => {
8238
8383
  updateNetlifyClient,
8239
8384
  updatePlanetScaleClient,
8240
8385
  updateShopifyClient,
8386
+ updateSlackClient,
8241
8387
  updateVercelClient,
8242
8388
  vercelClientInstance
8243
8389
  });