@livechat/developer-studio-api 3.4.13 → 3.4.15

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,16 +92,18 @@ __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,
98
99
  UnauthorizeAccountsApiError: () => UnauthorizeAccountsApiError,
99
100
  UnauthorizeApiError: () => UnauthorizeApiError,
100
101
  WorkflowDefinitionTaskType: () => WorkflowDefinitionTaskType,
102
+ WorkflowExecutionStatus: () => WorkflowExecutionStatus,
101
103
  WorkflowTemplateCategory: () => WorkflowTemplateCategory,
102
104
  adapterClientInstance: () => adapterClientInstance,
103
105
  allAppTemplates: () => allAppTemplates,
104
- api: () => api,
106
+ api: () => api2,
105
107
  appBaseTemplates: () => appBaseTemplates,
106
108
  appRepositoryTemplates: () => appRepositoryTemplates,
107
109
  appRepositoryTemplatesMap: () => appRepositoryTemplatesMap,
@@ -110,6 +112,7 @@ __export(src_exports, {
110
112
  bigCommerceClientInstance: () => bigCommerceClientInstance,
111
113
  bigcommerceEventsZods: () => bigcommerceEventsZods,
112
114
  billingClientInstance: () => billingClientInstance,
115
+ buildUrlFromSegments: () => buildUrlFromSegments,
113
116
  debounce: () => debounce,
114
117
  dpsClientInstance: () => dpsClientInstance,
115
118
  getAdapterClientConfig: () => getAdapterClientConfig,
@@ -134,6 +137,7 @@ __export(src_exports, {
134
137
  getRegion: () => getRegion2,
135
138
  getShopifyClientConfig: () => getShopifyClientConfig,
136
139
  getShopifyClientUrl: () => getShopifyClientUrl,
140
+ getSlackClientConfig: () => getSlackClientConfig,
137
141
  getTextClientConfig: () => getTextClientConfig,
138
142
  getVercelClientConfig: () => getVercelClientConfig,
139
143
  githubClientInstance: () => githubClientInstance,
@@ -155,6 +159,7 @@ __export(src_exports, {
155
159
  initPlanetScaleClient: () => initPlanetScaleClient,
156
160
  initPlatformAccountsClient: () => initPlatformAccountsClient,
157
161
  initShopifyClient: () => initShopifyClient,
162
+ initSlackClient: () => initSlackClient,
158
163
  initTextClient: () => initTextClient,
159
164
  initVercelClient: () => initVercelClient,
160
165
  integrationEventsZods: () => integrationEventsZods,
@@ -168,6 +173,7 @@ __export(src_exports, {
168
173
  platformAccountsClientInstance: () => platformAccountsClientInstance,
169
174
  shopifyClientInstance: () => shopifyClientInstance,
170
175
  shopifyEventsZods: () => shopifyEventsZods,
176
+ slackClientInstance: () => slackClientInstance,
171
177
  textClientInstance: () => textClientInstance,
172
178
  textHelpDeskEventsZods: () => textHelpDeskEventsZods,
173
179
  textLivechatEventsZods: () => textLivechatEventsZods,
@@ -180,6 +186,7 @@ __export(src_exports, {
180
186
  updateNetlifyClient: () => updateNetlifyClient,
181
187
  updatePlanetScaleClient: () => updatePlanetScaleClient,
182
188
  updateShopifyClient: () => updateShopifyClient,
189
+ updateSlackClient: () => updateSlackClient,
183
190
  updateVercelClient: () => updateVercelClient,
184
191
  vercelClientInstance: () => vercelClientInstance
185
192
  });
@@ -1714,6 +1721,13 @@ var WorkflowDefinitionTaskType = {
1714
1721
  join: "JOIN"
1715
1722
  };
1716
1723
 
1724
+ // src/apis/integrations/text/platform/workflow/workflows/_contracts/requests/workflows.ts
1725
+ var WorkflowExecutionStatus = /* @__PURE__ */ ((WorkflowExecutionStatus2) => {
1726
+ WorkflowExecutionStatus2["Completed"] = "COMPLETED";
1727
+ WorkflowExecutionStatus2["Failed"] = "FAILED";
1728
+ return WorkflowExecutionStatus2;
1729
+ })(WorkflowExecutionStatus || {});
1730
+
1717
1731
  // src/apis/integrations/vercel/instance.ts
1718
1732
  var import_axios10 = __toESM(require("axios"));
1719
1733
  var vercelClientInstance = import_axios10.default.create({
@@ -2079,6 +2093,66 @@ function updateBigCommerceClient(token, shop) {
2079
2093
  }
2080
2094
  }
2081
2095
 
2096
+ // src/apis/integrations/slack/instance.ts
2097
+ var import_axios16 = __toESM(require("axios"));
2098
+ var SlackApiError = class extends ApiErrorBase {
2099
+ constructor() {
2100
+ super(...arguments);
2101
+ this.name = "slack";
2102
+ }
2103
+ };
2104
+ var slackClientInstance = import_axios16.default.create({
2105
+ baseURL: "https://slack.com/api",
2106
+ headers: {
2107
+ "Content-Type": "application/json"
2108
+ }
2109
+ });
2110
+ slackClientInstance.interceptors.response.use(
2111
+ (r) => r,
2112
+ (error) => {
2113
+ var _a, _b, _c, _d;
2114
+ if (import_axios16.default.isAxiosError(error)) {
2115
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
2116
+ throw new UnauthorizeApiError("slack");
2117
+ }
2118
+ }
2119
+ return Promise.reject(
2120
+ new SlackApiError(
2121
+ error.message,
2122
+ (_b = error.response) == null ? void 0 : _b.data,
2123
+ (_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
2124
+ )
2125
+ );
2126
+ }
2127
+ );
2128
+ function getSlackClientConfig(options = {}) {
2129
+ var _a;
2130
+ const currentHeaders = slackClientInstance.defaults.headers;
2131
+ const config = {
2132
+ authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : currentHeaders.Authorization
2133
+ };
2134
+ if (options.ensureAuthorizationToken && !config.authorization) {
2135
+ throw new UnauthorizeApiError("slack");
2136
+ }
2137
+ return {
2138
+ headers: __spreadValues({}, config.authorization ? { Authorization: config.authorization } : {})
2139
+ };
2140
+ }
2141
+ function updateSlackClient(token) {
2142
+ const defaults = slackClientInstance.defaults;
2143
+ const headers = defaults.headers;
2144
+ if (token) {
2145
+ headers.Authorization = `Bearer ${token}`;
2146
+ } else {
2147
+ delete headers.Authorization;
2148
+ }
2149
+ }
2150
+ function initSlackClient(token) {
2151
+ if (token) {
2152
+ updateSlackClient(token);
2153
+ }
2154
+ }
2155
+
2082
2156
  // src/apis/platform/accounts/instance.ts
2083
2157
  var AccountsApiError = class extends ApiErrorBase {
2084
2158
  constructor() {
@@ -2118,8 +2192,8 @@ function initPlatformAccountsClient(baseUrl, token) {
2118
2192
  }
2119
2193
 
2120
2194
  // src/apis/platform/billing/instance.ts
2121
- var import_axios16 = __toESM(require("axios"));
2122
- var billingClientInstance = import_axios16.default.create({
2195
+ var import_axios17 = __toESM(require("axios"));
2196
+ var billingClientInstance = import_axios17.default.create({
2123
2197
  baseURL: "https://billing.labs.livechatinc.com"
2124
2198
  });
2125
2199
  function getBillingClientConfig(options = {}) {
@@ -2172,6 +2246,7 @@ var IntegrationNames = /* @__PURE__ */ ((IntegrationNames2) => {
2172
2246
  IntegrationNames2["Text"] = "text";
2173
2247
  IntegrationNames2["LiveChat"] = "text-livechat";
2174
2248
  IntegrationNames2["HelpDesk"] = "text-helpdesk";
2249
+ IntegrationNames2["Slack"] = "slack";
2175
2250
  return IntegrationNames2;
2176
2251
  })(IntegrationNames || {});
2177
2252
  var IntegrationDisplayNames = /* @__PURE__ */ ((IntegrationDisplayNames2) => {
@@ -2189,6 +2264,7 @@ var IntegrationDisplayNames = /* @__PURE__ */ ((IntegrationDisplayNames2) => {
2189
2264
  IntegrationDisplayNames2["Text"] = "Text";
2190
2265
  IntegrationDisplayNames2["LiveChat"] = "LiveChat";
2191
2266
  IntegrationDisplayNames2["HelpDesk"] = "HelpDesk";
2267
+ IntegrationDisplayNames2["Slack"] = "Slack";
2192
2268
  return IntegrationDisplayNames2;
2193
2269
  })(IntegrationDisplayNames || {});
2194
2270
 
@@ -2688,7 +2764,7 @@ var integrationEventsZods = {
2688
2764
  };
2689
2765
 
2690
2766
  // src/apis/platform/adapter/instance.ts
2691
- var import_axios17 = __toESM(require("axios"));
2767
+ var import_axios18 = __toESM(require("axios"));
2692
2768
  var REGION = {
2693
2769
  FRA: "fra",
2694
2770
  DAL: "dal",
@@ -2718,7 +2794,7 @@ var AdapterApiError = class _AdapterApiError extends ApiErrorBase {
2718
2794
  );
2719
2795
  }
2720
2796
  };
2721
- var adapterClientInstance = import_axios17.default.create({
2797
+ var adapterClientInstance = import_axios18.default.create({
2722
2798
  baseURL: "https://platform.labs.text.com/console-adapter/api",
2723
2799
  headers: {
2724
2800
  "Content-Type": "application/json"
@@ -2741,7 +2817,7 @@ adapterClientInstance.interceptors.response.use(
2741
2817
  }
2742
2818
  );
2743
2819
  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;
2820
+ 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
2821
  const currentHeaders = adapterClientInstance.defaults.headers;
2746
2822
  const headers = {
2747
2823
  platform: {
@@ -2761,49 +2837,53 @@ function getAdapterClientConfig(options = {}) {
2761
2837
  shopify: (_u = currentHeaders["x-adapter-shopify-token"]) != null ? _u : (_t = options.shopify) == null ? void 0 : _t.token,
2762
2838
  shopifyShop: (_w = currentHeaders["x-adapter-shopify-shop"]) != null ? _w : (_v = options.shopify) == null ? void 0 : _v.shop,
2763
2839
  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
2840
+ slack: (_A = currentHeaders["x-adapter-slack-token"]) != null ? _A : (_z = options.slack) == null ? void 0 : _z.token,
2841
+ bigcommerce: (_C = currentHeaders["x-adapter-bigcommerce-token"]) != null ? _C : (_B = options.bigcommerce) == null ? void 0 : _B.token,
2842
+ bigcommerceShop: (_E = currentHeaders["x-adapter-bigcommerce-shop"]) != null ? _E : (_D = options.bigcommerce) == null ? void 0 : _D.shop,
2843
+ text: (_G = currentHeaders["x-adapter-text-token"]) != null ? _G : (_F = options.text) == null ? void 0 : _F.token
2767
2844
  }
2768
2845
  };
2769
2846
  if (currentHeaders.Authorization) {
2770
- currentHeaders["X-Region"] = (_F = getRegion(currentHeaders.Authorization)) != null ? _F : void 0;
2847
+ currentHeaders["X-Region"] = (_H = getRegion(currentHeaders.Authorization)) != null ? _H : void 0;
2771
2848
  }
2772
- if (((_G = options.ensureAuthorizationToken) == null ? void 0 : _G.platform) && !headers.platform.token) {
2849
+ if (((_I = options.ensureAuthorizationToken) == null ? void 0 : _I.platform) && !headers.platform.token) {
2773
2850
  throw new UnauthorizeApiError("accounts");
2774
2851
  }
2775
- if (((_H = options.ensureAuthorizationToken) == null ? void 0 : _H.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
2852
+ if (((_J = options.ensureAuthorizationToken) == null ? void 0 : _J.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
2776
2853
  throw new UnauthorizeApiError("github");
2777
2854
  }
2778
- if (((_I = options.ensureAuthorizationToken) == null ? void 0 : _I.vercel) && !headers.integrations.vercel) {
2855
+ if (((_K = options.ensureAuthorizationToken) == null ? void 0 : _K.vercel) && !headers.integrations.vercel) {
2779
2856
  throw new UnauthorizeApiError("vercel");
2780
2857
  }
2781
- if (((_J = options.ensureAuthorizationToken) == null ? void 0 : _J.netlify) && !headers.integrations.netlify) {
2858
+ if (((_L = options.ensureAuthorizationToken) == null ? void 0 : _L.netlify) && !headers.integrations.netlify) {
2782
2859
  throw new UnauthorizeApiError("netlify");
2783
2860
  }
2784
- if (((_K = options.ensureAuthorizationToken) == null ? void 0 : _K.planetscale) && !headers.integrations.planetscale) {
2861
+ if (((_M = options.ensureAuthorizationToken) == null ? void 0 : _M.planetscale) && !headers.integrations.planetscale) {
2785
2862
  throw new UnauthorizeApiError("planetscale");
2786
2863
  }
2787
- if (((_L = options.ensureAuthorizationToken) == null ? void 0 : _L.neon) && !headers.integrations.neon) {
2864
+ if (((_N = options.ensureAuthorizationToken) == null ? void 0 : _N.neon) && !headers.integrations.neon) {
2788
2865
  throw new UnauthorizeApiError("neon");
2789
2866
  }
2790
- if (((_M = options.ensureAuthorizationToken) == null ? void 0 : _M.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
2867
+ if (((_O = options.ensureAuthorizationToken) == null ? void 0 : _O.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
2791
2868
  throw new UnauthorizeApiError("mailchimp");
2792
2869
  }
2793
- if (((_N = options.ensureAuthorizationToken) == null ? void 0 : _N.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
2870
+ if (((_P = options.ensureAuthorizationToken) == null ? void 0 : _P.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
2794
2871
  throw new UnauthorizeApiError("shopify");
2795
2872
  }
2796
- if (((_O = options.ensureAuthorizationToken) == null ? void 0 : _O.hubspot) && !headers.integrations.hubspot) {
2873
+ if (((_Q = options.ensureAuthorizationToken) == null ? void 0 : _Q.hubspot) && !headers.integrations.hubspot) {
2797
2874
  throw new UnauthorizeApiError("hubspot");
2798
2875
  }
2799
- if (((_P = options.ensureAuthorizationToken) == null ? void 0 : _P.bigcommerce) && (!headers.integrations.bigcommerce || !headers.integrations.bigcommerceShop)) {
2876
+ if (((_R = options.ensureAuthorizationToken) == null ? void 0 : _R.slack) && !headers.integrations.slack) {
2877
+ throw new UnauthorizeApiError("slack");
2878
+ }
2879
+ if (((_S = options.ensureAuthorizationToken) == null ? void 0 : _S.bigcommerce) && (!headers.integrations.bigcommerce || !headers.integrations.bigcommerceShop)) {
2800
2880
  throw new UnauthorizeApiError("bigcommerce");
2801
2881
  }
2802
- if (((_Q = options.ensureAuthorizationToken) == null ? void 0 : _Q.text) && !headers.integrations.text) {
2882
+ if (((_T = options.ensureAuthorizationToken) == null ? void 0 : _T.text) && !headers.integrations.text) {
2803
2883
  throw new UnauthorizeApiError("text");
2804
2884
  }
2805
2885
  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 } : {})
2886
+ 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
2887
  };
2808
2888
  }
2809
2889
  var getAdapterClientDefaultConfig = (authorization) => getAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -2826,7 +2906,7 @@ function initAdapterClient(baseUrl, tokens) {
2826
2906
  }
2827
2907
  }
2828
2908
  function updateAdapterClient(tokens) {
2829
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
2909
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
2830
2910
  const headers = adapterClientInstance.defaults.headers;
2831
2911
  if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
2832
2912
  headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
@@ -2864,13 +2944,16 @@ function updateAdapterClient(tokens) {
2864
2944
  if ((_m = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _m.token) {
2865
2945
  headers["x-adapter-hubspot-token"] = tokens.hubspot.token;
2866
2946
  }
2867
- if ((_n = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _n.shop) {
2947
+ if ((_n = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _n.token) {
2948
+ headers["x-adapter-slack-token"] = tokens.slack.token;
2949
+ }
2950
+ if ((_o = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _o.shop) {
2868
2951
  headers["x-adapter-bigcommerce-shop"] = tokens.bigcommerce.shop;
2869
2952
  }
2870
- if ((_o = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _o.token) {
2953
+ if ((_p = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _p.token) {
2871
2954
  headers["x-adapter-bigcommerce-token"] = tokens.bigcommerce.token;
2872
2955
  }
2873
- if ((_p = tokens == null ? void 0 : tokens.text) == null ? void 0 : _p.token) {
2956
+ if ((_q = tokens == null ? void 0 : tokens.text) == null ? void 0 : _q.token) {
2874
2957
  headers["x-adapter-text-token"] = tokens.text.token;
2875
2958
  }
2876
2959
  }
@@ -2944,14 +3027,14 @@ var getAppAutoReviewPayload = (value) => {
2944
3027
  };
2945
3028
 
2946
3029
  // src/apis/platform/dps/instance.ts
2947
- var import_axios18 = __toESM(require("axios"));
3030
+ var import_axios19 = __toESM(require("axios"));
2948
3031
  var DpsApiError = class extends ApiErrorBase {
2949
3032
  constructor() {
2950
3033
  super(...arguments);
2951
3034
  this.name = "dps";
2952
3035
  }
2953
3036
  };
2954
- var dpsClientInstance = import_axios18.default.create({
3037
+ var dpsClientInstance = import_axios19.default.create({
2955
3038
  baseURL: "https://dev-platform.labs.livechatinc.com"
2956
3039
  });
2957
3040
  dpsClientInstance.interceptors.response.use(
@@ -3013,14 +3096,14 @@ var HelpDeskWebhookEventType = /* @__PURE__ */ ((HelpDeskWebhookEventType2) => {
3013
3096
  })(HelpDeskWebhookEventType || {});
3014
3097
 
3015
3098
  // src/apis/products/helpdesk/instance.ts
3016
- var import_axios19 = __toESM(require("axios"));
3099
+ var import_axios20 = __toESM(require("axios"));
3017
3100
  var HelpDeskApiError = class extends ApiErrorBase {
3018
3101
  constructor() {
3019
3102
  super(...arguments);
3020
3103
  this.name = "helpdesk";
3021
3104
  }
3022
3105
  };
3023
- var helpdeskClientInstance = import_axios19.default.create({
3106
+ var helpdeskClientInstance = import_axios20.default.create({
3024
3107
  baseURL: "https://api.labs.helpdesk.com/v1"
3025
3108
  });
3026
3109
  helpdeskClientInstance.interceptors.response.use(
@@ -3095,7 +3178,7 @@ var LivechatWebhookSystemMessages = /* @__PURE__ */ ((LivechatWebhookSystemMessa
3095
3178
  })(LivechatWebhookSystemMessages || {});
3096
3179
 
3097
3180
  // src/apis/products/livechat/instance.ts
3098
- var import_axios20 = __toESM(require("axios"));
3181
+ var import_axios21 = __toESM(require("axios"));
3099
3182
  var REGION2 = {
3100
3183
  FRA: "fra",
3101
3184
  DAL: "dal",
@@ -3115,7 +3198,7 @@ var LivechatApiError = class extends ApiErrorBase {
3115
3198
  this.name = "livechat";
3116
3199
  }
3117
3200
  };
3118
- var livechatClientInstance = import_axios20.default.create({
3201
+ var livechatClientInstance = import_axios21.default.create({
3119
3202
  baseURL: "https://api.labs.livechatinc.com"
3120
3203
  });
3121
3204
  livechatClientInstance.interceptors.response.use(
@@ -3459,12 +3542,68 @@ var textPlatformDashboardApi = {
3459
3542
  }
3460
3543
  };
3461
3544
 
3545
+ // src/utils/misc/mergeDeep.ts
3546
+ function isObject(item) {
3547
+ return item !== null && typeof item === "object" && !Array.isArray(item);
3548
+ }
3549
+ function mergeDeep(target, source) {
3550
+ if (!isObject(target) || !isObject(source)) {
3551
+ return source;
3552
+ }
3553
+ const output = __spreadValues({}, target);
3554
+ Object.keys(source).forEach((key) => {
3555
+ if (isObject(source[key])) {
3556
+ if (!(key in target)) {
3557
+ output[key] = source[key];
3558
+ } else {
3559
+ output[key] = mergeDeep(
3560
+ target[key],
3561
+ source[key]
3562
+ );
3563
+ }
3564
+ } else if (Array.isArray(source[key])) {
3565
+ output[key] = [...source[key]];
3566
+ } else {
3567
+ output[key] = source[key];
3568
+ }
3569
+ });
3570
+ return output;
3571
+ }
3572
+
3573
+ // src/utils/misc/debounce.ts
3574
+ var debounce = (func, wait) => {
3575
+ let timeout = null;
3576
+ return (...args) => {
3577
+ if (timeout) {
3578
+ clearTimeout(timeout);
3579
+ }
3580
+ timeout = setTimeout(() => {
3581
+ func(...args);
3582
+ }, wait);
3583
+ };
3584
+ };
3585
+
3586
+ // src/utils/misc/url/build.ts
3587
+ var buildUrlFromSegments = (segments, basePath, baseUrl = "") => segments.length ? `${baseUrl}${basePath}/${segments.map(encodeURIComponent).join("/")}` : basePath;
3588
+
3462
3589
  // src/apis/integrations/text/platform/workflow/credentials/api.ts
3590
+ var getUrl = (segments = []) => buildUrlFromSegments(segments, "/workflow_platform/credentials");
3591
+ var urls = {
3592
+ get: (id) => getUrl([id]),
3593
+ getList: () => getUrl(),
3594
+ create: () => getUrl(),
3595
+ update: (id) => getUrl([id]),
3596
+ delete: (id) => getUrl([id]),
3597
+ connect: (id) => getUrl([id, "connection"])
3598
+ };
3463
3599
  var textPlatformWorkflowsCredentialsApi = {
3600
+ meta: {
3601
+ urls
3602
+ },
3464
3603
  get(id, authorization) {
3465
3604
  return __async(this, null, function* () {
3466
3605
  return textClientInstance.get(
3467
- `/workflow_platform/credentials/${encodeURIComponent(id)}`,
3606
+ urls.get(id),
3468
3607
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3469
3608
  ensureAuthorizationToken: true
3470
3609
  }))
@@ -3481,7 +3620,7 @@ var textPlatformWorkflowsCredentialsApi = {
3481
3620
  getList(authorization) {
3482
3621
  return __async(this, null, function* () {
3483
3622
  return textClientInstance.get(
3484
- "/workflow_platform/credentials",
3623
+ urls.getList(),
3485
3624
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3486
3625
  ensureAuthorizationToken: true
3487
3626
  }))
@@ -3498,7 +3637,7 @@ var textPlatformWorkflowsCredentialsApi = {
3498
3637
  create(payload, authorization) {
3499
3638
  return __async(this, null, function* () {
3500
3639
  return textClientInstance.post(
3501
- "/workflow_platform/credentials",
3640
+ urls.create(),
3502
3641
  payload,
3503
3642
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3504
3643
  ensureAuthorizationToken: true
@@ -3516,7 +3655,7 @@ var textPlatformWorkflowsCredentialsApi = {
3516
3655
  update(id, payload, authorization) {
3517
3656
  return __async(this, null, function* () {
3518
3657
  return textClientInstance.put(
3519
- `/workflow_platform/credentials/${encodeURIComponent(id)}`,
3658
+ urls.update(id),
3520
3659
  payload,
3521
3660
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3522
3661
  ensureAuthorizationToken: true
@@ -3534,7 +3673,7 @@ var textPlatformWorkflowsCredentialsApi = {
3534
3673
  delete(id, authorization) {
3535
3674
  return __async(this, null, function* () {
3536
3675
  return textClientInstance.delete(
3537
- `/workflow_platform/credentials/${encodeURIComponent(id)}`,
3676
+ urls.delete(id),
3538
3677
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3539
3678
  ensureAuthorizationToken: true
3540
3679
  }))
@@ -3551,7 +3690,7 @@ var textPlatformWorkflowsCredentialsApi = {
3551
3690
  connect(id, code, authorization) {
3552
3691
  return __async(this, null, function* () {
3553
3692
  return textClientInstance.put(
3554
- `/workflow_platform/credentials/${encodeURIComponent(id)}/connection`,
3693
+ urls.connect(id),
3555
3694
  {
3556
3695
  code
3557
3696
  },
@@ -3571,11 +3710,18 @@ var textPlatformWorkflowsCredentialsApi = {
3571
3710
  };
3572
3711
 
3573
3712
  // src/apis/integrations/text/platform/workflow/functions/api.ts
3713
+ var getUrl2 = (segments = []) => buildUrlFromSegments(segments, "/workflow_platform/functions");
3714
+ var urls2 = {
3715
+ get: () => getUrl2()
3716
+ };
3574
3717
  var textPlatformWorkflowsFunctionsApi = {
3718
+ meta: {
3719
+ urls: urls2
3720
+ },
3575
3721
  get(authorization) {
3576
3722
  return __async(this, null, function* () {
3577
3723
  return textClientInstance.get(
3578
- "/workflow_platform/functions",
3724
+ urls2.get(),
3579
3725
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3580
3726
  ensureAuthorizationToken: true
3581
3727
  }))
@@ -3591,12 +3737,56 @@ var textPlatformWorkflowsFunctionsApi = {
3591
3737
  }
3592
3738
  };
3593
3739
 
3740
+ // src/apis/integrations/text/platform/workflow/resources/api.ts
3741
+ var textPlatformWorkflowsResourcesApi = {
3742
+ get(resource, authorization) {
3743
+ return __async(this, null, function* () {
3744
+ const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3745
+ ensureAuthorizationToken: true
3746
+ }));
3747
+ return textClientInstance.get(
3748
+ `/workflow_platform/external_resources/${encodeURIComponent(resource.product)}/${encodeURIComponent(resource.name)}`,
3749
+ __spreadProps(__spreadValues({}, config), {
3750
+ headers: __spreadProps(__spreadValues({}, config.headers), {
3751
+ "X-Cred-ID": authorization == null ? void 0 : authorization.credentialId
3752
+ })
3753
+ })
3754
+ ).catch((error) => {
3755
+ if (error instanceof TextApiError) {
3756
+ throw error.withCustomMessage(
3757
+ `Couldn't get external resources. [${error.message}]`
3758
+ );
3759
+ }
3760
+ throw error;
3761
+ });
3762
+ });
3763
+ }
3764
+ };
3765
+
3594
3766
  // src/apis/integrations/text/platform/workflow/workflows/api.ts
3767
+ var getUrl3 = (segments = []) => buildUrlFromSegments(segments, "/workflow_platform/workflows");
3768
+ var urls3 = {
3769
+ getWorkflows: () => getUrl3(),
3770
+ createWorkflow: () => getUrl3(),
3771
+ getWorkflow: (id) => getUrl3([id]),
3772
+ updateWorkflow: (id) => getUrl3([id]),
3773
+ deleteWorkflow: (id) => getUrl3([id]),
3774
+ createWorkflowDraft: (id) => getUrl3([id, "draft"]),
3775
+ publishWorkflowDraft: (id) => getUrl3([id, "publish"]),
3776
+ toggleWorkflowActivation: (id) => getUrl3([id, "activation"]),
3777
+ executeWorkflow: (id) => getUrl3([id, "executions"]),
3778
+ getWorkflowExecutionsList: (id) => getUrl3([id, "executions"]),
3779
+ getWorkflowExecutionDetails: (id, executionId) => getUrl3([id, "executions", executionId]),
3780
+ validateWorkflowDefinition: () => getUrl3(["validation"])
3781
+ };
3595
3782
  var textPlatformWorkflowsApi = {
3783
+ meta: {
3784
+ urls: urls3
3785
+ },
3596
3786
  getWorkflows(authorization) {
3597
3787
  return __async(this, null, function* () {
3598
3788
  const { data: workflows } = yield textClientInstance.get(
3599
- "/workflow_platform/workflows",
3789
+ urls3.getWorkflows(),
3600
3790
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3601
3791
  ensureAuthorizationToken: true
3602
3792
  }))
@@ -3607,7 +3797,7 @@ var textPlatformWorkflowsApi = {
3607
3797
  getWorkflow(workflowId, authorization) {
3608
3798
  return __async(this, null, function* () {
3609
3799
  const { data: workflow } = yield textClientInstance.get(
3610
- `/workflow_platform/workflows/${encodeURIComponent(workflowId)}`,
3800
+ urls3.getWorkflow(workflowId),
3611
3801
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3612
3802
  ensureAuthorizationToken: true
3613
3803
  }))
@@ -3618,7 +3808,7 @@ var textPlatformWorkflowsApi = {
3618
3808
  createWorkflow(payload, authorization) {
3619
3809
  return __async(this, null, function* () {
3620
3810
  return textClientInstance.post(
3621
- "/workflow_platform/workflows",
3811
+ urls3.createWorkflow(),
3622
3812
  payload,
3623
3813
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3624
3814
  ensureAuthorizationToken: true
@@ -3629,7 +3819,7 @@ var textPlatformWorkflowsApi = {
3629
3819
  updateWorkflow(workflowId, payload, authorization) {
3630
3820
  return __async(this, null, function* () {
3631
3821
  return textClientInstance.put(
3632
- `/workflow_platform/workflows/${encodeURIComponent(workflowId)}`,
3822
+ urls3.updateWorkflow(workflowId),
3633
3823
  payload,
3634
3824
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3635
3825
  ensureAuthorizationToken: true
@@ -3639,18 +3829,15 @@ var textPlatformWorkflowsApi = {
3639
3829
  },
3640
3830
  deleteWorkflow(workflowId, authorization) {
3641
3831
  return __async(this, null, function* () {
3642
- return textClientInstance.delete(
3643
- `/workflow_platform/workflows/${encodeURIComponent(workflowId)}`,
3644
- __spreadValues({}, getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3645
- ensureAuthorizationToken: true
3646
- })))
3647
- );
3832
+ return textClientInstance.delete(urls3.deleteWorkflow(workflowId), __spreadValues({}, getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3833
+ ensureAuthorizationToken: true
3834
+ }))));
3648
3835
  });
3649
3836
  },
3650
3837
  createWorkflowDraft(workflowId, payload, authorization) {
3651
3838
  return __async(this, null, function* () {
3652
3839
  return textClientInstance.post(
3653
- `/workflow_platform/workflows/${encodeURIComponent(workflowId)}/draft`,
3840
+ urls3.createWorkflowDraft(workflowId),
3654
3841
  payload,
3655
3842
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3656
3843
  ensureAuthorizationToken: true
@@ -3661,7 +3848,7 @@ var textPlatformWorkflowsApi = {
3661
3848
  publishWorkflowDraft(workflowId, authorization) {
3662
3849
  return __async(this, null, function* () {
3663
3850
  return textClientInstance.post(
3664
- `/workflow_platform/workflows/${encodeURIComponent(workflowId)}/publish`,
3851
+ urls3.publishWorkflowDraft(workflowId),
3665
3852
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3666
3853
  ensureAuthorizationToken: true
3667
3854
  }))
@@ -3671,9 +3858,7 @@ var textPlatformWorkflowsApi = {
3671
3858
  toggleWorkflowActivation(workflowId, isActive, authorization) {
3672
3859
  return __async(this, null, function* () {
3673
3860
  return textClientInstance.put(
3674
- `/workflow_platform/workflows/${encodeURIComponent(
3675
- workflowId
3676
- )}/activation`,
3861
+ urls3.toggleWorkflowActivation(workflowId),
3677
3862
  {
3678
3863
  active: isActive
3679
3864
  },
@@ -3686,9 +3871,7 @@ var textPlatformWorkflowsApi = {
3686
3871
  executeWorkflow(workflowId, input, authorization) {
3687
3872
  return __async(this, null, function* () {
3688
3873
  const { data: execution } = yield textClientInstance.post(
3689
- `/workflow_platform/workflows/${encodeURIComponent(
3690
- workflowId
3691
- )}/executions`,
3874
+ urls3.executeWorkflow(workflowId),
3692
3875
  {
3693
3876
  input
3694
3877
  },
@@ -3702,9 +3885,7 @@ var textPlatformWorkflowsApi = {
3702
3885
  getWorkflowExecutionsList(workflowId, authorization) {
3703
3886
  return __async(this, null, function* () {
3704
3887
  const { data: executions } = yield textClientInstance.get(
3705
- `/workflow_platform/workflows/${encodeURIComponent(
3706
- workflowId
3707
- )}/executions`,
3888
+ urls3.executeWorkflow(workflowId),
3708
3889
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3709
3890
  ensureAuthorizationToken: true
3710
3891
  }))
@@ -3715,9 +3896,7 @@ var textPlatformWorkflowsApi = {
3715
3896
  getWorkflowExecutionDetails(workflowId, executionId, authorization) {
3716
3897
  return __async(this, null, function* () {
3717
3898
  const { data: execution } = yield textClientInstance.get(
3718
- `/workflow_platform/workflows/${encodeURIComponent(
3719
- workflowId
3720
- )}/executions/${encodeURIComponent(executionId)}`,
3899
+ urls3.getWorkflowExecutionDetails(workflowId, executionId),
3721
3900
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3722
3901
  ensureAuthorizationToken: true
3723
3902
  }))
@@ -3728,7 +3907,7 @@ var textPlatformWorkflowsApi = {
3728
3907
  validateWorkflowDefinition(payload, authorization) {
3729
3908
  return __async(this, null, function* () {
3730
3909
  yield textClientInstance.post(
3731
- "/workflow_platform/workflows/validation",
3910
+ urls3.validateWorkflowDefinition(),
3732
3911
  payload,
3733
3912
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3734
3913
  ensureAuthorizationToken: true
@@ -3742,7 +3921,8 @@ var textPlatformWorkflowsApi = {
3742
3921
  var textPlatformWorkflowApi = {
3743
3922
  workflows: textPlatformWorkflowsApi,
3744
3923
  credentials: textPlatformWorkflowsCredentialsApi,
3745
- functions: textPlatformWorkflowsFunctionsApi
3924
+ functions: textPlatformWorkflowsFunctionsApi,
3925
+ resources: textPlatformWorkflowsResourcesApi
3746
3926
  };
3747
3927
 
3748
3928
  // src/apis/integrations/text/platform/api.ts
@@ -3759,7 +3939,7 @@ var textApi = {
3759
3939
  };
3760
3940
 
3761
3941
  // src/apis/integrations/vercel/api.ts
3762
- var import_axios21 = __toESM(require("axios"));
3942
+ var import_axios22 = __toESM(require("axios"));
3763
3943
 
3764
3944
  // src/apis/integrations/vercel/deploy/api.ts
3765
3945
  var vercelDeployApi = {
@@ -4019,7 +4199,7 @@ var vercelApi = {
4019
4199
  client_secret: clientSecret,
4020
4200
  redirect_uri: redirectUrl
4021
4201
  });
4022
- const response = yield import_axios21.default.post("https://api.vercel.com/v2/oauth/access_token", data, {
4202
+ const response = yield import_axios22.default.post("https://api.vercel.com/v2/oauth/access_token", data, {
4023
4203
  headers: {
4024
4204
  "Content-Type": "application/x-www-form-urlencoded"
4025
4205
  }
@@ -4035,7 +4215,7 @@ var vercelApi = {
4035
4215
  };
4036
4216
 
4037
4217
  // src/apis/integrations/neon/api.ts
4038
- var import_axios22 = __toESM(require("axios"));
4218
+ var import_axios23 = __toESM(require("axios"));
4039
4219
 
4040
4220
  // src/apis/integrations/neon/project/branch/api.ts
4041
4221
  var neonProjectBranchApi = {
@@ -4279,7 +4459,7 @@ var neonApi = {
4279
4459
  redirect_uri: redirectUri,
4280
4460
  grant_type: "authorization_code"
4281
4461
  });
4282
- const response = yield import_axios22.default.post(
4462
+ const response = yield import_axios23.default.post(
4283
4463
  "https://oauth2.neon.tech/oauth2/token",
4284
4464
  data,
4285
4465
  {
@@ -4304,7 +4484,7 @@ var neonApi = {
4304
4484
  client_secret: clientSecret,
4305
4485
  grant_type: "refresh_token"
4306
4486
  });
4307
- const response = yield import_axios22.default.post("https://oauth2.neon.tech/oauth2/token", data, {
4487
+ const response = yield import_axios23.default.post("https://oauth2.neon.tech/oauth2/token", data, {
4308
4488
  headers: {
4309
4489
  "Content-Type": "application/x-www-form-urlencoded"
4310
4490
  }
@@ -4319,7 +4499,7 @@ var neonApi = {
4319
4499
  };
4320
4500
 
4321
4501
  // src/apis/integrations/mailchimp/api.ts
4322
- var import_axios23 = __toESM(require("axios"));
4502
+ var import_axios24 = __toESM(require("axios"));
4323
4503
 
4324
4504
  // src/apis/integrations/mailchimp/lists/webhooks/api.ts
4325
4505
  var mailchimpListsWebhooksApi = {
@@ -4376,7 +4556,7 @@ var mailchimpApi = {
4376
4556
  redirect_uri: redirectUri,
4377
4557
  grant_type: "authorization_code"
4378
4558
  });
4379
- const tokenResponse = yield import_axios23.default.post(
4559
+ const tokenResponse = yield import_axios24.default.post(
4380
4560
  "https://login.mailchimp.com/oauth2/token",
4381
4561
  data,
4382
4562
  {
@@ -4397,7 +4577,7 @@ var mailchimpApi = {
4397
4577
  return __async(this, arguments, function* ({ token }) {
4398
4578
  const {
4399
4579
  data: { dc: server }
4400
- } = yield import_axios23.default.get(
4580
+ } = yield import_axios24.default.get(
4401
4581
  "https://login.mailchimp.com/oauth2/metadata",
4402
4582
  {
4403
4583
  headers: {
@@ -4414,7 +4594,7 @@ var mailchimpApi = {
4414
4594
  };
4415
4595
 
4416
4596
  // src/apis/integrations/shopify/api.ts
4417
- var import_axios24 = __toESM(require("axios"));
4597
+ var import_axios25 = __toESM(require("axios"));
4418
4598
 
4419
4599
  // src/apis/integrations/shopify/webhooks/api.ts
4420
4600
  var shopifyWebhooksApi = {
@@ -4469,7 +4649,7 @@ var shopifyApi = {
4469
4649
  redirect_uri: redirectUri,
4470
4650
  grant_type: "authorization_code"
4471
4651
  });
4472
- const response = yield import_axios24.default.post(
4652
+ const response = yield import_axios25.default.post(
4473
4653
  `https://${encodeURIComponent(
4474
4654
  shop
4475
4655
  )}.myshopify.com/admin/oauth/access_token`,
@@ -4647,7 +4827,7 @@ var hubspotApi = {
4647
4827
  };
4648
4828
 
4649
4829
  // src/apis/integrations/bigcommerce/api.ts
4650
- var import_axios25 = __toESM(require("axios"));
4830
+ var import_axios26 = __toESM(require("axios"));
4651
4831
 
4652
4832
  // src/apis/integrations/bigcommerce/webhooks/api.ts
4653
4833
  var bigCommerceWebhooksApi = {
@@ -4701,7 +4881,7 @@ var bigcommerceApi = {
4701
4881
  redirect_uri: redirectUri,
4702
4882
  grant_type: "authorization_code"
4703
4883
  });
4704
- const tokenResponse = yield import_axios25.default.post(
4884
+ const tokenResponse = yield import_axios26.default.post(
4705
4885
  "https://login.bigcommerce.com/oauth2/token",
4706
4886
  data,
4707
4887
  {
@@ -4721,11 +4901,11 @@ var bigcommerceApi = {
4721
4901
  };
4722
4902
 
4723
4903
  // src/apis/integrations/openai/api.ts
4724
- var import_axios26 = __toESM(require("axios"));
4904
+ var import_axios27 = __toESM(require("axios"));
4725
4905
  var openaiApi = {
4726
4906
  verifyToken(token) {
4727
4907
  return __async(this, null, function* () {
4728
- const response = yield import_axios26.default.get("https://api.openai.com/v1/models", {
4908
+ const response = yield import_axios27.default.get("https://api.openai.com/v1/models", {
4729
4909
  headers: {
4730
4910
  Authorization: `Bearer ${token}`
4731
4911
  }
@@ -4735,6 +4915,43 @@ var openaiApi = {
4735
4915
  }
4736
4916
  };
4737
4917
 
4918
+ // src/apis/integrations/slack/api.ts
4919
+ var slackApi = {
4920
+ getToken(code, clientId, clientSecret, redirectUri) {
4921
+ return __async(this, null, function* () {
4922
+ var _a;
4923
+ const data = new URLSearchParams({
4924
+ code,
4925
+ client_id: clientId,
4926
+ client_secret: clientSecret,
4927
+ redirect_uri: redirectUri,
4928
+ grant_type: "authorization_code"
4929
+ });
4930
+ const tokenResponse = yield slackClientInstance.post(
4931
+ "/oauth/v1/token",
4932
+ data,
4933
+ {
4934
+ headers: {
4935
+ "Content-Type": "application/x-www-form-urlencoded"
4936
+ }
4937
+ }
4938
+ );
4939
+ const params = new URLSearchParams(
4940
+ tokenResponse.data
4941
+ );
4942
+ return {
4943
+ token: (_a = params.get("access_token")) != null ? _a : ""
4944
+ };
4945
+ });
4946
+ },
4947
+ getTokenInfo(token) {
4948
+ return __async(this, null, function* () {
4949
+ const { data: tokenInfo } = yield slackClientInstance.get(`/oauth/v1/access-tokens/${token}`);
4950
+ return tokenInfo;
4951
+ });
4952
+ }
4953
+ };
4954
+
4738
4955
  // src/apis/integrations/api.ts
4739
4956
  var integrationsApi = {
4740
4957
  github: gitHubApi,
@@ -4747,7 +4964,8 @@ var integrationsApi = {
4747
4964
  hubspot: hubspotApi,
4748
4965
  bigcommerce: bigcommerceApi,
4749
4966
  openai: openaiApi,
4750
- text: textApi
4967
+ text: textApi,
4968
+ slack: slackApi
4751
4969
  };
4752
4970
 
4753
4971
  // src/apis/products/livechat/agents/api.ts
@@ -5614,19 +5832,34 @@ var productsApi = {
5614
5832
  };
5615
5833
 
5616
5834
  // src/apis/platform/accounts/accounts/api.ts
5617
- var platformAccountsAccountApi = {
5835
+ var urls4 = (withBaseUrl = false) => {
5836
+ const getUrl5 = (segments = []) => buildUrlFromSegments(
5837
+ segments,
5838
+ "/v2/accounts",
5839
+ withBaseUrl ? platformAccountsClientInstance.config.baseURL : void 0
5840
+ );
5841
+ return {
5842
+ getAccounts: () => getUrl5(),
5843
+ getAccount: (id) => getUrl5([id]),
5844
+ getMeAccount: () => getUrl5(["me"])
5845
+ };
5846
+ };
5847
+ var api = {
5618
5848
  getAccounts(authorization) {
5619
5849
  return __async(this, null, function* () {
5620
- return platformAccountsClientInstance.get("/v2/accounts", {
5621
- authorization,
5622
- customErrorMessage: "Accounts couldn't be fetched."
5623
- });
5850
+ return platformAccountsClientInstance.get(
5851
+ urls4().getAccounts(),
5852
+ {
5853
+ authorization,
5854
+ customErrorMessage: "Accounts couldn't be fetched."
5855
+ }
5856
+ );
5624
5857
  });
5625
5858
  },
5626
5859
  getAccount(accountId, authorization) {
5627
5860
  return __async(this, null, function* () {
5628
5861
  return platformAccountsClientInstance.get(
5629
- `/v2/accounts/${encodeURIComponent(accountId)}`,
5862
+ urls4().getAccount(accountId),
5630
5863
  {
5631
5864
  authorization,
5632
5865
  customErrorMessage: "Account couldn't be fetched."
@@ -5646,6 +5879,11 @@ var platformAccountsAccountApi = {
5646
5879
  });
5647
5880
  }
5648
5881
  };
5882
+ var platformAccountsAccountApi = __spreadProps(__spreadValues({}, api), {
5883
+ meta: {
5884
+ urls: urls4
5885
+ }
5886
+ });
5649
5887
 
5650
5888
  // src/apis/platform/accounts/client/api.ts
5651
5889
  var platformAccountsClientApi = {
@@ -5808,11 +6046,19 @@ var platformAccountsPersonalAccessTokenApi = {
5808
6046
  };
5809
6047
 
5810
6048
  // src/apis/platform/accounts/products/api.ts
6049
+ var getUrl4 = (segments = []) => buildUrlFromSegments(segments, "/v2/organizations");
6050
+ var urls5 = {
6051
+ getOrganizationProducts: () => getUrl4(["my", "products"]),
6052
+ updateOrganizationProducts: () => getUrl4(["my", "products"])
6053
+ };
5811
6054
  var platformAccountsProductsApi = {
6055
+ meta: {
6056
+ urls: urls5
6057
+ },
5812
6058
  getOrganizationProducts(authorization) {
5813
6059
  return __async(this, null, function* () {
5814
6060
  return platformAccountsClientInstance.get(
5815
- "/v2/organizations/my/products",
6061
+ urls5.getOrganizationProducts(),
5816
6062
  { authorization, customErrorMessage: "Products couldn't be fetched." }
5817
6063
  );
5818
6064
  });
@@ -5820,7 +6066,7 @@ var platformAccountsProductsApi = {
5820
6066
  updateOrganizationProducts(payload, authorization) {
5821
6067
  return __async(this, null, function* () {
5822
6068
  return platformAccountsClientInstance.post(
5823
- "/v2/organizations/my/products",
6069
+ urls5.updateOrganizationProducts(),
5824
6070
  payload,
5825
6071
  { authorization, customErrorMessage: "Products couldn't be updated." }
5826
6072
  );
@@ -7981,14 +8227,14 @@ var platformApi = {
7981
8227
  };
7982
8228
 
7983
8229
  // src/apis/api.ts
7984
- var api = {
8230
+ var api2 = {
7985
8231
  platform: platformApi,
7986
8232
  products: productsApi,
7987
8233
  integrations: integrationsApi,
7988
8234
  isInitialized: false
7989
8235
  };
7990
8236
  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;
8237
+ 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
8238
  initPlatformAccountsClient(
7993
8239
  (_a = config.urls.platform) == null ? void 0 : _a.accounts,
7994
8240
  (_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.token
@@ -8005,7 +8251,8 @@ function initApi(config, tokens) {
8005
8251
  neon: tokens.neon,
8006
8252
  planetscale: tokens.planetscale,
8007
8253
  mailchimp: tokens.mailchimp,
8008
- shopify: tokens.shopify
8254
+ shopify: tokens.shopify,
8255
+ slack: tokens.slack
8009
8256
  } : void 0
8010
8257
  );
8011
8258
  initLiveChatClient((_h = config.urls.products) == null ? void 0 : _h.livechat, (_i = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _i.token);
@@ -8019,7 +8266,8 @@ function initApi(config, tokens) {
8019
8266
  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
8267
  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
8268
  initHubspotClient((_w = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _w.token);
8022
- api.isInitialized = true;
8269
+ initSlackClient((_x = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _x.token);
8270
+ api2.isInitialized = true;
8023
8271
  }
8024
8272
 
8025
8273
  // ../../../private/utils/src/serializers/base64.ts
@@ -8082,47 +8330,6 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
8082
8330
  window.location.href = url;
8083
8331
  });
8084
8332
  }
8085
-
8086
- // src/utils/misc/mergeDeep.ts
8087
- function isObject(item) {
8088
- return item !== null && typeof item === "object" && !Array.isArray(item);
8089
- }
8090
- function mergeDeep(target, source) {
8091
- if (!isObject(target) || !isObject(source)) {
8092
- return source;
8093
- }
8094
- const output = __spreadValues({}, target);
8095
- Object.keys(source).forEach((key) => {
8096
- if (isObject(source[key])) {
8097
- if (!(key in target)) {
8098
- output[key] = source[key];
8099
- } else {
8100
- output[key] = mergeDeep(
8101
- target[key],
8102
- source[key]
8103
- );
8104
- }
8105
- } else if (Array.isArray(source[key])) {
8106
- output[key] = [...source[key]];
8107
- } else {
8108
- output[key] = source[key];
8109
- }
8110
- });
8111
- return output;
8112
- }
8113
-
8114
- // src/utils/misc/debounce.ts
8115
- var debounce = (func, wait) => {
8116
- let timeout = null;
8117
- return (...args) => {
8118
- if (timeout) {
8119
- clearTimeout(timeout);
8120
- }
8121
- timeout = setTimeout(() => {
8122
- func(...args);
8123
- }, wait);
8124
- };
8125
- };
8126
8333
  // Annotate the CommonJS export names for ESM import in node:
8127
8334
  0 && (module.exports = {
8128
8335
  API_NOTIFICATIONS,
@@ -8150,12 +8357,14 @@ var debounce = (func, wait) => {
8150
8357
  MailchimpEventNames,
8151
8358
  ShopifyApiError,
8152
8359
  ShopifyEventNames,
8360
+ SlackApiError,
8153
8361
  TextApiError,
8154
8362
  TextHelpDeskEventNames,
8155
8363
  TextLivechatEventNames,
8156
8364
  UnauthorizeAccountsApiError,
8157
8365
  UnauthorizeApiError,
8158
8366
  WorkflowDefinitionTaskType,
8367
+ WorkflowExecutionStatus,
8159
8368
  WorkflowTemplateCategory,
8160
8369
  adapterClientInstance,
8161
8370
  allAppTemplates,
@@ -8168,6 +8377,7 @@ var debounce = (func, wait) => {
8168
8377
  bigCommerceClientInstance,
8169
8378
  bigcommerceEventsZods,
8170
8379
  billingClientInstance,
8380
+ buildUrlFromSegments,
8171
8381
  debounce,
8172
8382
  dpsClientInstance,
8173
8383
  getAdapterClientConfig,
@@ -8192,6 +8402,7 @@ var debounce = (func, wait) => {
8192
8402
  getRegion,
8193
8403
  getShopifyClientConfig,
8194
8404
  getShopifyClientUrl,
8405
+ getSlackClientConfig,
8195
8406
  getTextClientConfig,
8196
8407
  getVercelClientConfig,
8197
8408
  githubClientInstance,
@@ -8213,6 +8424,7 @@ var debounce = (func, wait) => {
8213
8424
  initPlanetScaleClient,
8214
8425
  initPlatformAccountsClient,
8215
8426
  initShopifyClient,
8427
+ initSlackClient,
8216
8428
  initTextClient,
8217
8429
  initVercelClient,
8218
8430
  integrationEventsZods,
@@ -8226,6 +8438,7 @@ var debounce = (func, wait) => {
8226
8438
  platformAccountsClientInstance,
8227
8439
  shopifyClientInstance,
8228
8440
  shopifyEventsZods,
8441
+ slackClientInstance,
8229
8442
  textClientInstance,
8230
8443
  textHelpDeskEventsZods,
8231
8444
  textLivechatEventsZods,
@@ -8238,6 +8451,7 @@ var debounce = (func, wait) => {
8238
8451
  updateNetlifyClient,
8239
8452
  updatePlanetScaleClient,
8240
8453
  updateShopifyClient,
8454
+ updateSlackClient,
8241
8455
  updateVercelClient,
8242
8456
  vercelClientInstance
8243
8457
  });