@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.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
 
@@ -2329,7 +2396,8 @@ var textLivechatEventsZods = {
2329
2396
  eventName: import_zod3.z.nativeEnum(TextLivechatEventNames),
2330
2397
  events: {
2331
2398
  chatStarted: import_zod3.z.object({
2332
- name: import_zod3.z.literal("chat_started" /* ChatStarted */)
2399
+ name: import_zod3.z.literal("chat_started" /* ChatStarted */),
2400
+ targetAgentId: import_zod3.z.string().email().optional()
2333
2401
  }),
2334
2402
  chatEnded: import_zod3.z.object({
2335
2403
  name: import_zod3.z.literal("chat_ended" /* ChatEnded */)
@@ -2687,7 +2755,7 @@ var integrationEventsZods = {
2687
2755
  };
2688
2756
 
2689
2757
  // src/apis/platform/adapter/instance.ts
2690
- var import_axios17 = __toESM(require("axios"));
2758
+ var import_axios18 = __toESM(require("axios"));
2691
2759
  var REGION = {
2692
2760
  FRA: "fra",
2693
2761
  DAL: "dal",
@@ -2717,7 +2785,7 @@ var AdapterApiError = class _AdapterApiError extends ApiErrorBase {
2717
2785
  );
2718
2786
  }
2719
2787
  };
2720
- var adapterClientInstance = import_axios17.default.create({
2788
+ var adapterClientInstance = import_axios18.default.create({
2721
2789
  baseURL: "https://platform.labs.text.com/console-adapter/api",
2722
2790
  headers: {
2723
2791
  "Content-Type": "application/json"
@@ -2740,7 +2808,7 @@ adapterClientInstance.interceptors.response.use(
2740
2808
  }
2741
2809
  );
2742
2810
  function getAdapterClientConfig(options = {}) {
2743
- 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;
2744
2812
  const currentHeaders = adapterClientInstance.defaults.headers;
2745
2813
  const headers = {
2746
2814
  platform: {
@@ -2760,49 +2828,53 @@ function getAdapterClientConfig(options = {}) {
2760
2828
  shopify: (_u = currentHeaders["x-adapter-shopify-token"]) != null ? _u : (_t = options.shopify) == null ? void 0 : _t.token,
2761
2829
  shopifyShop: (_w = currentHeaders["x-adapter-shopify-shop"]) != null ? _w : (_v = options.shopify) == null ? void 0 : _v.shop,
2762
2830
  hubspot: (_y = currentHeaders["x-adapter-hubspot-token"]) != null ? _y : (_x = options.hubspot) == null ? void 0 : _x.token,
2763
- bigcommerce: (_A = currentHeaders["x-adapter-bigcommerce-token"]) != null ? _A : (_z = options.bigcommerce) == null ? void 0 : _z.token,
2764
- bigcommerceShop: (_C = currentHeaders["x-adapter-bigcommerce-shop"]) != null ? _C : (_B = options.bigcommerce) == null ? void 0 : _B.shop,
2765
- 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
2766
2835
  }
2767
2836
  };
2768
2837
  if (currentHeaders.Authorization) {
2769
- currentHeaders["X-Region"] = (_F = getRegion(currentHeaders.Authorization)) != null ? _F : void 0;
2838
+ currentHeaders["X-Region"] = (_H = getRegion(currentHeaders.Authorization)) != null ? _H : void 0;
2770
2839
  }
2771
- 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) {
2772
2841
  throw new UnauthorizeApiError("accounts");
2773
2842
  }
2774
- 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)) {
2775
2844
  throw new UnauthorizeApiError("github");
2776
2845
  }
2777
- 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) {
2778
2847
  throw new UnauthorizeApiError("vercel");
2779
2848
  }
2780
- 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) {
2781
2850
  throw new UnauthorizeApiError("netlify");
2782
2851
  }
2783
- 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) {
2784
2853
  throw new UnauthorizeApiError("planetscale");
2785
2854
  }
2786
- 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) {
2787
2856
  throw new UnauthorizeApiError("neon");
2788
2857
  }
2789
- 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)) {
2790
2859
  throw new UnauthorizeApiError("mailchimp");
2791
2860
  }
2792
- 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)) {
2793
2862
  throw new UnauthorizeApiError("shopify");
2794
2863
  }
2795
- 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) {
2796
2865
  throw new UnauthorizeApiError("hubspot");
2797
2866
  }
2798
- 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)) {
2799
2871
  throw new UnauthorizeApiError("bigcommerce");
2800
2872
  }
2801
- 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) {
2802
2874
  throw new UnauthorizeApiError("text");
2803
2875
  }
2804
2876
  return {
2805
- 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 } : {})
2806
2878
  };
2807
2879
  }
2808
2880
  var getAdapterClientDefaultConfig = (authorization) => getAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -2825,7 +2897,7 @@ function initAdapterClient(baseUrl, tokens) {
2825
2897
  }
2826
2898
  }
2827
2899
  function updateAdapterClient(tokens) {
2828
- 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;
2829
2901
  const headers = adapterClientInstance.defaults.headers;
2830
2902
  if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
2831
2903
  headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
@@ -2863,13 +2935,16 @@ function updateAdapterClient(tokens) {
2863
2935
  if ((_m = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _m.token) {
2864
2936
  headers["x-adapter-hubspot-token"] = tokens.hubspot.token;
2865
2937
  }
2866
- 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) {
2867
2942
  headers["x-adapter-bigcommerce-shop"] = tokens.bigcommerce.shop;
2868
2943
  }
2869
- 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) {
2870
2945
  headers["x-adapter-bigcommerce-token"] = tokens.bigcommerce.token;
2871
2946
  }
2872
- 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) {
2873
2948
  headers["x-adapter-text-token"] = tokens.text.token;
2874
2949
  }
2875
2950
  }
@@ -2943,14 +3018,14 @@ var getAppAutoReviewPayload = (value) => {
2943
3018
  };
2944
3019
 
2945
3020
  // src/apis/platform/dps/instance.ts
2946
- var import_axios18 = __toESM(require("axios"));
3021
+ var import_axios19 = __toESM(require("axios"));
2947
3022
  var DpsApiError = class extends ApiErrorBase {
2948
3023
  constructor() {
2949
3024
  super(...arguments);
2950
3025
  this.name = "dps";
2951
3026
  }
2952
3027
  };
2953
- var dpsClientInstance = import_axios18.default.create({
3028
+ var dpsClientInstance = import_axios19.default.create({
2954
3029
  baseURL: "https://dev-platform.labs.livechatinc.com"
2955
3030
  });
2956
3031
  dpsClientInstance.interceptors.response.use(
@@ -3012,14 +3087,14 @@ var HelpDeskWebhookEventType = /* @__PURE__ */ ((HelpDeskWebhookEventType2) => {
3012
3087
  })(HelpDeskWebhookEventType || {});
3013
3088
 
3014
3089
  // src/apis/products/helpdesk/instance.ts
3015
- var import_axios19 = __toESM(require("axios"));
3090
+ var import_axios20 = __toESM(require("axios"));
3016
3091
  var HelpDeskApiError = class extends ApiErrorBase {
3017
3092
  constructor() {
3018
3093
  super(...arguments);
3019
3094
  this.name = "helpdesk";
3020
3095
  }
3021
3096
  };
3022
- var helpdeskClientInstance = import_axios19.default.create({
3097
+ var helpdeskClientInstance = import_axios20.default.create({
3023
3098
  baseURL: "https://api.labs.helpdesk.com/v1"
3024
3099
  });
3025
3100
  helpdeskClientInstance.interceptors.response.use(
@@ -3094,7 +3169,7 @@ var LivechatWebhookSystemMessages = /* @__PURE__ */ ((LivechatWebhookSystemMessa
3094
3169
  })(LivechatWebhookSystemMessages || {});
3095
3170
 
3096
3171
  // src/apis/products/livechat/instance.ts
3097
- var import_axios20 = __toESM(require("axios"));
3172
+ var import_axios21 = __toESM(require("axios"));
3098
3173
  var REGION2 = {
3099
3174
  FRA: "fra",
3100
3175
  DAL: "dal",
@@ -3114,7 +3189,7 @@ var LivechatApiError = class extends ApiErrorBase {
3114
3189
  this.name = "livechat";
3115
3190
  }
3116
3191
  };
3117
- var livechatClientInstance = import_axios20.default.create({
3192
+ var livechatClientInstance = import_axios21.default.create({
3118
3193
  baseURL: "https://api.labs.livechatinc.com"
3119
3194
  });
3120
3195
  livechatClientInstance.interceptors.response.use(
@@ -3590,6 +3665,32 @@ var textPlatformWorkflowsFunctionsApi = {
3590
3665
  }
3591
3666
  };
3592
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
+
3593
3694
  // src/apis/integrations/text/platform/workflow/workflows/api.ts
3594
3695
  var textPlatformWorkflowsApi = {
3595
3696
  getWorkflows(authorization) {
@@ -3741,7 +3842,8 @@ var textPlatformWorkflowsApi = {
3741
3842
  var textPlatformWorkflowApi = {
3742
3843
  workflows: textPlatformWorkflowsApi,
3743
3844
  credentials: textPlatformWorkflowsCredentialsApi,
3744
- functions: textPlatformWorkflowsFunctionsApi
3845
+ functions: textPlatformWorkflowsFunctionsApi,
3846
+ resources: textPlatformWorkflowsResourcesApi
3745
3847
  };
3746
3848
 
3747
3849
  // src/apis/integrations/text/platform/api.ts
@@ -3758,7 +3860,7 @@ var textApi = {
3758
3860
  };
3759
3861
 
3760
3862
  // src/apis/integrations/vercel/api.ts
3761
- var import_axios21 = __toESM(require("axios"));
3863
+ var import_axios22 = __toESM(require("axios"));
3762
3864
 
3763
3865
  // src/apis/integrations/vercel/deploy/api.ts
3764
3866
  var vercelDeployApi = {
@@ -4018,7 +4120,7 @@ var vercelApi = {
4018
4120
  client_secret: clientSecret,
4019
4121
  redirect_uri: redirectUrl
4020
4122
  });
4021
- 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, {
4022
4124
  headers: {
4023
4125
  "Content-Type": "application/x-www-form-urlencoded"
4024
4126
  }
@@ -4034,7 +4136,7 @@ var vercelApi = {
4034
4136
  };
4035
4137
 
4036
4138
  // src/apis/integrations/neon/api.ts
4037
- var import_axios22 = __toESM(require("axios"));
4139
+ var import_axios23 = __toESM(require("axios"));
4038
4140
 
4039
4141
  // src/apis/integrations/neon/project/branch/api.ts
4040
4142
  var neonProjectBranchApi = {
@@ -4278,7 +4380,7 @@ var neonApi = {
4278
4380
  redirect_uri: redirectUri,
4279
4381
  grant_type: "authorization_code"
4280
4382
  });
4281
- const response = yield import_axios22.default.post(
4383
+ const response = yield import_axios23.default.post(
4282
4384
  "https://oauth2.neon.tech/oauth2/token",
4283
4385
  data,
4284
4386
  {
@@ -4303,7 +4405,7 @@ var neonApi = {
4303
4405
  client_secret: clientSecret,
4304
4406
  grant_type: "refresh_token"
4305
4407
  });
4306
- 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, {
4307
4409
  headers: {
4308
4410
  "Content-Type": "application/x-www-form-urlencoded"
4309
4411
  }
@@ -4318,7 +4420,7 @@ var neonApi = {
4318
4420
  };
4319
4421
 
4320
4422
  // src/apis/integrations/mailchimp/api.ts
4321
- var import_axios23 = __toESM(require("axios"));
4423
+ var import_axios24 = __toESM(require("axios"));
4322
4424
 
4323
4425
  // src/apis/integrations/mailchimp/lists/webhooks/api.ts
4324
4426
  var mailchimpListsWebhooksApi = {
@@ -4375,7 +4477,7 @@ var mailchimpApi = {
4375
4477
  redirect_uri: redirectUri,
4376
4478
  grant_type: "authorization_code"
4377
4479
  });
4378
- const tokenResponse = yield import_axios23.default.post(
4480
+ const tokenResponse = yield import_axios24.default.post(
4379
4481
  "https://login.mailchimp.com/oauth2/token",
4380
4482
  data,
4381
4483
  {
@@ -4396,7 +4498,7 @@ var mailchimpApi = {
4396
4498
  return __async(this, arguments, function* ({ token }) {
4397
4499
  const {
4398
4500
  data: { dc: server }
4399
- } = yield import_axios23.default.get(
4501
+ } = yield import_axios24.default.get(
4400
4502
  "https://login.mailchimp.com/oauth2/metadata",
4401
4503
  {
4402
4504
  headers: {
@@ -4413,7 +4515,7 @@ var mailchimpApi = {
4413
4515
  };
4414
4516
 
4415
4517
  // src/apis/integrations/shopify/api.ts
4416
- var import_axios24 = __toESM(require("axios"));
4518
+ var import_axios25 = __toESM(require("axios"));
4417
4519
 
4418
4520
  // src/apis/integrations/shopify/webhooks/api.ts
4419
4521
  var shopifyWebhooksApi = {
@@ -4468,7 +4570,7 @@ var shopifyApi = {
4468
4570
  redirect_uri: redirectUri,
4469
4571
  grant_type: "authorization_code"
4470
4572
  });
4471
- const response = yield import_axios24.default.post(
4573
+ const response = yield import_axios25.default.post(
4472
4574
  `https://${encodeURIComponent(
4473
4575
  shop
4474
4576
  )}.myshopify.com/admin/oauth/access_token`,
@@ -4646,7 +4748,7 @@ var hubspotApi = {
4646
4748
  };
4647
4749
 
4648
4750
  // src/apis/integrations/bigcommerce/api.ts
4649
- var import_axios25 = __toESM(require("axios"));
4751
+ var import_axios26 = __toESM(require("axios"));
4650
4752
 
4651
4753
  // src/apis/integrations/bigcommerce/webhooks/api.ts
4652
4754
  var bigCommerceWebhooksApi = {
@@ -4700,7 +4802,7 @@ var bigcommerceApi = {
4700
4802
  redirect_uri: redirectUri,
4701
4803
  grant_type: "authorization_code"
4702
4804
  });
4703
- const tokenResponse = yield import_axios25.default.post(
4805
+ const tokenResponse = yield import_axios26.default.post(
4704
4806
  "https://login.bigcommerce.com/oauth2/token",
4705
4807
  data,
4706
4808
  {
@@ -4720,11 +4822,11 @@ var bigcommerceApi = {
4720
4822
  };
4721
4823
 
4722
4824
  // src/apis/integrations/openai/api.ts
4723
- var import_axios26 = __toESM(require("axios"));
4825
+ var import_axios27 = __toESM(require("axios"));
4724
4826
  var openaiApi = {
4725
4827
  verifyToken(token) {
4726
4828
  return __async(this, null, function* () {
4727
- 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", {
4728
4830
  headers: {
4729
4831
  Authorization: `Bearer ${token}`
4730
4832
  }
@@ -4734,6 +4836,43 @@ var openaiApi = {
4734
4836
  }
4735
4837
  };
4736
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
+
4737
4876
  // src/apis/integrations/api.ts
4738
4877
  var integrationsApi = {
4739
4878
  github: gitHubApi,
@@ -4746,7 +4885,8 @@ var integrationsApi = {
4746
4885
  hubspot: hubspotApi,
4747
4886
  bigcommerce: bigcommerceApi,
4748
4887
  openai: openaiApi,
4749
- text: textApi
4888
+ text: textApi,
4889
+ slack: slackApi
4750
4890
  };
4751
4891
 
4752
4892
  // src/apis/products/livechat/agents/api.ts
@@ -7987,7 +8127,7 @@ var api = {
7987
8127
  isInitialized: false
7988
8128
  };
7989
8129
  function initApi(config, tokens) {
7990
- 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;
7991
8131
  initPlatformAccountsClient(
7992
8132
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
7993
8133
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.token
@@ -8004,7 +8144,8 @@ function initApi(config, tokens) {
8004
8144
  neon: tokens.neon,
8005
8145
  planetscale: tokens.planetscale,
8006
8146
  mailchimp: tokens.mailchimp,
8007
- shopify: tokens.shopify
8147
+ shopify: tokens.shopify,
8148
+ slack: tokens.slack
8008
8149
  } : void 0
8009
8150
  );
8010
8151
  initLiveChatClient((_h = config.urls.products) == null ? void 0 : _h.livechat, (_i = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _i.token);
@@ -8018,6 +8159,7 @@ function initApi(config, tokens) {
8018
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);
8019
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);
8020
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);
8021
8163
  api.isInitialized = true;
8022
8164
  }
8023
8165
 
@@ -8149,6 +8291,7 @@ var debounce = (func, wait) => {
8149
8291
  MailchimpEventNames,
8150
8292
  ShopifyApiError,
8151
8293
  ShopifyEventNames,
8294
+ SlackApiError,
8152
8295
  TextApiError,
8153
8296
  TextHelpDeskEventNames,
8154
8297
  TextLivechatEventNames,
@@ -8191,6 +8334,7 @@ var debounce = (func, wait) => {
8191
8334
  getRegion,
8192
8335
  getShopifyClientConfig,
8193
8336
  getShopifyClientUrl,
8337
+ getSlackClientConfig,
8194
8338
  getTextClientConfig,
8195
8339
  getVercelClientConfig,
8196
8340
  githubClientInstance,
@@ -8212,6 +8356,7 @@ var debounce = (func, wait) => {
8212
8356
  initPlanetScaleClient,
8213
8357
  initPlatformAccountsClient,
8214
8358
  initShopifyClient,
8359
+ initSlackClient,
8215
8360
  initTextClient,
8216
8361
  initVercelClient,
8217
8362
  integrationEventsZods,
@@ -8225,6 +8370,7 @@ var debounce = (func, wait) => {
8225
8370
  platformAccountsClientInstance,
8226
8371
  shopifyClientInstance,
8227
8372
  shopifyEventsZods,
8373
+ slackClientInstance,
8228
8374
  textClientInstance,
8229
8375
  textHelpDeskEventsZods,
8230
8376
  textLivechatEventsZods,
@@ -8237,6 +8383,7 @@ var debounce = (func, wait) => {
8237
8383
  updateNetlifyClient,
8238
8384
  updatePlanetScaleClient,
8239
8385
  updateShopifyClient,
8386
+ updateSlackClient,
8240
8387
  updateVercelClient,
8241
8388
  vercelClientInstance
8242
8389
  });