@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.d.mts +129 -11
- package/dist/index.d.ts +129 -11
- package/dist/index.js +347 -133
- package/dist/index.mjs +340 -133
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1567,6 +1567,13 @@ var WorkflowDefinitionTaskType = {
|
|
|
1567
1567
|
join: "JOIN"
|
|
1568
1568
|
};
|
|
1569
1569
|
|
|
1570
|
+
// src/apis/integrations/text/platform/workflow/workflows/_contracts/requests/workflows.ts
|
|
1571
|
+
var WorkflowExecutionStatus = /* @__PURE__ */ ((WorkflowExecutionStatus2) => {
|
|
1572
|
+
WorkflowExecutionStatus2["Completed"] = "COMPLETED";
|
|
1573
|
+
WorkflowExecutionStatus2["Failed"] = "FAILED";
|
|
1574
|
+
return WorkflowExecutionStatus2;
|
|
1575
|
+
})(WorkflowExecutionStatus || {});
|
|
1576
|
+
|
|
1570
1577
|
// src/apis/integrations/vercel/instance.ts
|
|
1571
1578
|
import axios8 from "axios";
|
|
1572
1579
|
var vercelClientInstance = axios8.create({
|
|
@@ -1932,6 +1939,66 @@ function updateBigCommerceClient(token, shop) {
|
|
|
1932
1939
|
}
|
|
1933
1940
|
}
|
|
1934
1941
|
|
|
1942
|
+
// src/apis/integrations/slack/instance.ts
|
|
1943
|
+
import axios14 from "axios";
|
|
1944
|
+
var SlackApiError = class extends ApiErrorBase {
|
|
1945
|
+
constructor() {
|
|
1946
|
+
super(...arguments);
|
|
1947
|
+
this.name = "slack";
|
|
1948
|
+
}
|
|
1949
|
+
};
|
|
1950
|
+
var slackClientInstance = axios14.create({
|
|
1951
|
+
baseURL: "https://slack.com/api",
|
|
1952
|
+
headers: {
|
|
1953
|
+
"Content-Type": "application/json"
|
|
1954
|
+
}
|
|
1955
|
+
});
|
|
1956
|
+
slackClientInstance.interceptors.response.use(
|
|
1957
|
+
(r) => r,
|
|
1958
|
+
(error) => {
|
|
1959
|
+
var _a, _b, _c, _d;
|
|
1960
|
+
if (axios14.isAxiosError(error)) {
|
|
1961
|
+
if (((_a = error.response) == null ? void 0 : _a.status) === 401) {
|
|
1962
|
+
throw new UnauthorizeApiError("slack");
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
return Promise.reject(
|
|
1966
|
+
new SlackApiError(
|
|
1967
|
+
error.message,
|
|
1968
|
+
(_b = error.response) == null ? void 0 : _b.data,
|
|
1969
|
+
(_d = (_c = error.response) == null ? void 0 : _c.status) != null ? _d : 400
|
|
1970
|
+
)
|
|
1971
|
+
);
|
|
1972
|
+
}
|
|
1973
|
+
);
|
|
1974
|
+
function getSlackClientConfig(options = {}) {
|
|
1975
|
+
var _a;
|
|
1976
|
+
const currentHeaders = slackClientInstance.defaults.headers;
|
|
1977
|
+
const config = {
|
|
1978
|
+
authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : currentHeaders.Authorization
|
|
1979
|
+
};
|
|
1980
|
+
if (options.ensureAuthorizationToken && !config.authorization) {
|
|
1981
|
+
throw new UnauthorizeApiError("slack");
|
|
1982
|
+
}
|
|
1983
|
+
return {
|
|
1984
|
+
headers: __spreadValues({}, config.authorization ? { Authorization: config.authorization } : {})
|
|
1985
|
+
};
|
|
1986
|
+
}
|
|
1987
|
+
function updateSlackClient(token) {
|
|
1988
|
+
const defaults = slackClientInstance.defaults;
|
|
1989
|
+
const headers = defaults.headers;
|
|
1990
|
+
if (token) {
|
|
1991
|
+
headers.Authorization = `Bearer ${token}`;
|
|
1992
|
+
} else {
|
|
1993
|
+
delete headers.Authorization;
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
function initSlackClient(token) {
|
|
1997
|
+
if (token) {
|
|
1998
|
+
updateSlackClient(token);
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
|
|
1935
2002
|
// src/apis/platform/accounts/instance.ts
|
|
1936
2003
|
var AccountsApiError = class extends ApiErrorBase {
|
|
1937
2004
|
constructor() {
|
|
@@ -1971,8 +2038,8 @@ function initPlatformAccountsClient(baseUrl, token) {
|
|
|
1971
2038
|
}
|
|
1972
2039
|
|
|
1973
2040
|
// src/apis/platform/billing/instance.ts
|
|
1974
|
-
import
|
|
1975
|
-
var billingClientInstance =
|
|
2041
|
+
import axios15 from "axios";
|
|
2042
|
+
var billingClientInstance = axios15.create({
|
|
1976
2043
|
baseURL: "https://billing.labs.livechatinc.com"
|
|
1977
2044
|
});
|
|
1978
2045
|
function getBillingClientConfig(options = {}) {
|
|
@@ -2025,6 +2092,7 @@ var IntegrationNames = /* @__PURE__ */ ((IntegrationNames2) => {
|
|
|
2025
2092
|
IntegrationNames2["Text"] = "text";
|
|
2026
2093
|
IntegrationNames2["LiveChat"] = "text-livechat";
|
|
2027
2094
|
IntegrationNames2["HelpDesk"] = "text-helpdesk";
|
|
2095
|
+
IntegrationNames2["Slack"] = "slack";
|
|
2028
2096
|
return IntegrationNames2;
|
|
2029
2097
|
})(IntegrationNames || {});
|
|
2030
2098
|
var IntegrationDisplayNames = /* @__PURE__ */ ((IntegrationDisplayNames2) => {
|
|
@@ -2042,6 +2110,7 @@ var IntegrationDisplayNames = /* @__PURE__ */ ((IntegrationDisplayNames2) => {
|
|
|
2042
2110
|
IntegrationDisplayNames2["Text"] = "Text";
|
|
2043
2111
|
IntegrationDisplayNames2["LiveChat"] = "LiveChat";
|
|
2044
2112
|
IntegrationDisplayNames2["HelpDesk"] = "HelpDesk";
|
|
2113
|
+
IntegrationDisplayNames2["Slack"] = "Slack";
|
|
2045
2114
|
return IntegrationDisplayNames2;
|
|
2046
2115
|
})(IntegrationDisplayNames || {});
|
|
2047
2116
|
|
|
@@ -2541,7 +2610,7 @@ var integrationEventsZods = {
|
|
|
2541
2610
|
};
|
|
2542
2611
|
|
|
2543
2612
|
// src/apis/platform/adapter/instance.ts
|
|
2544
|
-
import
|
|
2613
|
+
import axios16 from "axios";
|
|
2545
2614
|
var REGION = {
|
|
2546
2615
|
FRA: "fra",
|
|
2547
2616
|
DAL: "dal",
|
|
@@ -2571,7 +2640,7 @@ var AdapterApiError = class _AdapterApiError extends ApiErrorBase {
|
|
|
2571
2640
|
);
|
|
2572
2641
|
}
|
|
2573
2642
|
};
|
|
2574
|
-
var adapterClientInstance =
|
|
2643
|
+
var adapterClientInstance = axios16.create({
|
|
2575
2644
|
baseURL: "https://platform.labs.text.com/console-adapter/api",
|
|
2576
2645
|
headers: {
|
|
2577
2646
|
"Content-Type": "application/json"
|
|
@@ -2594,7 +2663,7 @@ adapterClientInstance.interceptors.response.use(
|
|
|
2594
2663
|
}
|
|
2595
2664
|
);
|
|
2596
2665
|
function getAdapterClientConfig(options = {}) {
|
|
2597
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q;
|
|
2666
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T;
|
|
2598
2667
|
const currentHeaders = adapterClientInstance.defaults.headers;
|
|
2599
2668
|
const headers = {
|
|
2600
2669
|
platform: {
|
|
@@ -2614,49 +2683,53 @@ function getAdapterClientConfig(options = {}) {
|
|
|
2614
2683
|
shopify: (_u = currentHeaders["x-adapter-shopify-token"]) != null ? _u : (_t = options.shopify) == null ? void 0 : _t.token,
|
|
2615
2684
|
shopifyShop: (_w = currentHeaders["x-adapter-shopify-shop"]) != null ? _w : (_v = options.shopify) == null ? void 0 : _v.shop,
|
|
2616
2685
|
hubspot: (_y = currentHeaders["x-adapter-hubspot-token"]) != null ? _y : (_x = options.hubspot) == null ? void 0 : _x.token,
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2686
|
+
slack: (_A = currentHeaders["x-adapter-slack-token"]) != null ? _A : (_z = options.slack) == null ? void 0 : _z.token,
|
|
2687
|
+
bigcommerce: (_C = currentHeaders["x-adapter-bigcommerce-token"]) != null ? _C : (_B = options.bigcommerce) == null ? void 0 : _B.token,
|
|
2688
|
+
bigcommerceShop: (_E = currentHeaders["x-adapter-bigcommerce-shop"]) != null ? _E : (_D = options.bigcommerce) == null ? void 0 : _D.shop,
|
|
2689
|
+
text: (_G = currentHeaders["x-adapter-text-token"]) != null ? _G : (_F = options.text) == null ? void 0 : _F.token
|
|
2620
2690
|
}
|
|
2621
2691
|
};
|
|
2622
2692
|
if (currentHeaders.Authorization) {
|
|
2623
|
-
currentHeaders["X-Region"] = (
|
|
2693
|
+
currentHeaders["X-Region"] = (_H = getRegion(currentHeaders.Authorization)) != null ? _H : void 0;
|
|
2624
2694
|
}
|
|
2625
|
-
if (((
|
|
2695
|
+
if (((_I = options.ensureAuthorizationToken) == null ? void 0 : _I.platform) && !headers.platform.token) {
|
|
2626
2696
|
throw new UnauthorizeApiError("accounts");
|
|
2627
2697
|
}
|
|
2628
|
-
if (((
|
|
2698
|
+
if (((_J = options.ensureAuthorizationToken) == null ? void 0 : _J.github) && (!headers.integrations.github.app || !headers.integrations.github.oauth)) {
|
|
2629
2699
|
throw new UnauthorizeApiError("github");
|
|
2630
2700
|
}
|
|
2631
|
-
if (((
|
|
2701
|
+
if (((_K = options.ensureAuthorizationToken) == null ? void 0 : _K.vercel) && !headers.integrations.vercel) {
|
|
2632
2702
|
throw new UnauthorizeApiError("vercel");
|
|
2633
2703
|
}
|
|
2634
|
-
if (((
|
|
2704
|
+
if (((_L = options.ensureAuthorizationToken) == null ? void 0 : _L.netlify) && !headers.integrations.netlify) {
|
|
2635
2705
|
throw new UnauthorizeApiError("netlify");
|
|
2636
2706
|
}
|
|
2637
|
-
if (((
|
|
2707
|
+
if (((_M = options.ensureAuthorizationToken) == null ? void 0 : _M.planetscale) && !headers.integrations.planetscale) {
|
|
2638
2708
|
throw new UnauthorizeApiError("planetscale");
|
|
2639
2709
|
}
|
|
2640
|
-
if (((
|
|
2710
|
+
if (((_N = options.ensureAuthorizationToken) == null ? void 0 : _N.neon) && !headers.integrations.neon) {
|
|
2641
2711
|
throw new UnauthorizeApiError("neon");
|
|
2642
2712
|
}
|
|
2643
|
-
if (((
|
|
2713
|
+
if (((_O = options.ensureAuthorizationToken) == null ? void 0 : _O.mailchimp) && (!headers.integrations.mailchimp || !headers.integrations.mailchimpServer)) {
|
|
2644
2714
|
throw new UnauthorizeApiError("mailchimp");
|
|
2645
2715
|
}
|
|
2646
|
-
if (((
|
|
2716
|
+
if (((_P = options.ensureAuthorizationToken) == null ? void 0 : _P.shopify) && (!headers.integrations.shopify || !headers.integrations.shopifyShop)) {
|
|
2647
2717
|
throw new UnauthorizeApiError("shopify");
|
|
2648
2718
|
}
|
|
2649
|
-
if (((
|
|
2719
|
+
if (((_Q = options.ensureAuthorizationToken) == null ? void 0 : _Q.hubspot) && !headers.integrations.hubspot) {
|
|
2650
2720
|
throw new UnauthorizeApiError("hubspot");
|
|
2651
2721
|
}
|
|
2652
|
-
if (((
|
|
2722
|
+
if (((_R = options.ensureAuthorizationToken) == null ? void 0 : _R.slack) && !headers.integrations.slack) {
|
|
2723
|
+
throw new UnauthorizeApiError("slack");
|
|
2724
|
+
}
|
|
2725
|
+
if (((_S = options.ensureAuthorizationToken) == null ? void 0 : _S.bigcommerce) && (!headers.integrations.bigcommerce || !headers.integrations.bigcommerceShop)) {
|
|
2653
2726
|
throw new UnauthorizeApiError("bigcommerce");
|
|
2654
2727
|
}
|
|
2655
|
-
if (((
|
|
2728
|
+
if (((_T = options.ensureAuthorizationToken) == null ? void 0 : _T.text) && !headers.integrations.text) {
|
|
2656
2729
|
throw new UnauthorizeApiError("text");
|
|
2657
2730
|
}
|
|
2658
2731
|
return {
|
|
2659
|
-
headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.token ? { Authorization: headers.platform.token } : {}), headers.integrations.github.app ? { "x-adapter-github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "x-adapter-github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "x-adapter-netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "x-adapter-vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "x-adapter-planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.neon ? { "x-adapter-neon-token": headers.integrations.neon } : {}), headers.integrations.mailchimp ? { "x-adapter-mailchimp-token": headers.integrations.mailchimp } : {}), headers.integrations.mailchimpServer ? { "x-adapter-mailchimp-server": headers.integrations.mailchimpServer } : {}), headers.integrations.shopify ? { "x-adapter-shopify-token": headers.integrations.shopify } : {}), headers.integrations.shopifyShop ? { "x-adapter-shopify-shop": headers.integrations.shopifyShop } : {}), headers.integrations.hubspot ? { "x-adapter-hubspot-token": headers.integrations.hubspot } : {}), headers.integrations.bigcommerce ? { "x-adapter-bigcommerce-token": headers.integrations.bigcommerce } : {}), headers.integrations.bigcommerceShop ? { "x-adapter-bigcommerce-shop": headers.integrations.bigcommerceShop } : {}), headers.integrations.text ? { "x-adapter-text-token": headers.integrations.text } : {})
|
|
2732
|
+
headers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, headers.platform.token ? { Authorization: headers.platform.token } : {}), headers.integrations.github.app ? { "x-adapter-github-app-token": headers.integrations.github.app } : {}), headers.integrations.github.oauth ? { "x-adapter-github-oauth-token": headers.integrations.github.oauth } : {}), headers.integrations.netlify ? { "x-adapter-netlify-token": headers.integrations.netlify } : {}), headers.integrations.vercel ? { "x-adapter-vercel-token": headers.integrations.vercel } : {}), headers.integrations.planetscale ? { "x-adapter-planetscale-token": headers.integrations.planetscale } : {}), headers.integrations.neon ? { "x-adapter-neon-token": headers.integrations.neon } : {}), headers.integrations.mailchimp ? { "x-adapter-mailchimp-token": headers.integrations.mailchimp } : {}), headers.integrations.mailchimpServer ? { "x-adapter-mailchimp-server": headers.integrations.mailchimpServer } : {}), headers.integrations.shopify ? { "x-adapter-shopify-token": headers.integrations.shopify } : {}), headers.integrations.shopifyShop ? { "x-adapter-shopify-shop": headers.integrations.shopifyShop } : {}), headers.integrations.hubspot ? { "x-adapter-hubspot-token": headers.integrations.hubspot } : {}), headers.integrations.slack ? { "x-adapter-slack-token": headers.integrations.slack } : {}), headers.integrations.bigcommerce ? { "x-adapter-bigcommerce-token": headers.integrations.bigcommerce } : {}), headers.integrations.bigcommerceShop ? { "x-adapter-bigcommerce-shop": headers.integrations.bigcommerceShop } : {}), headers.integrations.text ? { "x-adapter-text-token": headers.integrations.text } : {})
|
|
2660
2733
|
};
|
|
2661
2734
|
}
|
|
2662
2735
|
var getAdapterClientDefaultConfig = (authorization) => getAdapterClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
@@ -2679,7 +2752,7 @@ function initAdapterClient(baseUrl, tokens) {
|
|
|
2679
2752
|
}
|
|
2680
2753
|
}
|
|
2681
2754
|
function updateAdapterClient(tokens) {
|
|
2682
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
2755
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
2683
2756
|
const headers = adapterClientInstance.defaults.headers;
|
|
2684
2757
|
if ((_a = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _a.token) {
|
|
2685
2758
|
headers.Authorization = `${(_b = tokens.platform.tokenType) != null ? _b : "Bearer"} ${tokens.platform.token}`;
|
|
@@ -2717,13 +2790,16 @@ function updateAdapterClient(tokens) {
|
|
|
2717
2790
|
if ((_m = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _m.token) {
|
|
2718
2791
|
headers["x-adapter-hubspot-token"] = tokens.hubspot.token;
|
|
2719
2792
|
}
|
|
2720
|
-
if ((_n = tokens == null ? void 0 : tokens.
|
|
2793
|
+
if ((_n = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _n.token) {
|
|
2794
|
+
headers["x-adapter-slack-token"] = tokens.slack.token;
|
|
2795
|
+
}
|
|
2796
|
+
if ((_o = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _o.shop) {
|
|
2721
2797
|
headers["x-adapter-bigcommerce-shop"] = tokens.bigcommerce.shop;
|
|
2722
2798
|
}
|
|
2723
|
-
if ((
|
|
2799
|
+
if ((_p = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _p.token) {
|
|
2724
2800
|
headers["x-adapter-bigcommerce-token"] = tokens.bigcommerce.token;
|
|
2725
2801
|
}
|
|
2726
|
-
if ((
|
|
2802
|
+
if ((_q = tokens == null ? void 0 : tokens.text) == null ? void 0 : _q.token) {
|
|
2727
2803
|
headers["x-adapter-text-token"] = tokens.text.token;
|
|
2728
2804
|
}
|
|
2729
2805
|
}
|
|
@@ -2797,14 +2873,14 @@ var getAppAutoReviewPayload = (value) => {
|
|
|
2797
2873
|
};
|
|
2798
2874
|
|
|
2799
2875
|
// src/apis/platform/dps/instance.ts
|
|
2800
|
-
import
|
|
2876
|
+
import axios17 from "axios";
|
|
2801
2877
|
var DpsApiError = class extends ApiErrorBase {
|
|
2802
2878
|
constructor() {
|
|
2803
2879
|
super(...arguments);
|
|
2804
2880
|
this.name = "dps";
|
|
2805
2881
|
}
|
|
2806
2882
|
};
|
|
2807
|
-
var dpsClientInstance =
|
|
2883
|
+
var dpsClientInstance = axios17.create({
|
|
2808
2884
|
baseURL: "https://dev-platform.labs.livechatinc.com"
|
|
2809
2885
|
});
|
|
2810
2886
|
dpsClientInstance.interceptors.response.use(
|
|
@@ -2866,14 +2942,14 @@ var HelpDeskWebhookEventType = /* @__PURE__ */ ((HelpDeskWebhookEventType2) => {
|
|
|
2866
2942
|
})(HelpDeskWebhookEventType || {});
|
|
2867
2943
|
|
|
2868
2944
|
// src/apis/products/helpdesk/instance.ts
|
|
2869
|
-
import
|
|
2945
|
+
import axios18 from "axios";
|
|
2870
2946
|
var HelpDeskApiError = class extends ApiErrorBase {
|
|
2871
2947
|
constructor() {
|
|
2872
2948
|
super(...arguments);
|
|
2873
2949
|
this.name = "helpdesk";
|
|
2874
2950
|
}
|
|
2875
2951
|
};
|
|
2876
|
-
var helpdeskClientInstance =
|
|
2952
|
+
var helpdeskClientInstance = axios18.create({
|
|
2877
2953
|
baseURL: "https://api.labs.helpdesk.com/v1"
|
|
2878
2954
|
});
|
|
2879
2955
|
helpdeskClientInstance.interceptors.response.use(
|
|
@@ -2948,7 +3024,7 @@ var LivechatWebhookSystemMessages = /* @__PURE__ */ ((LivechatWebhookSystemMessa
|
|
|
2948
3024
|
})(LivechatWebhookSystemMessages || {});
|
|
2949
3025
|
|
|
2950
3026
|
// src/apis/products/livechat/instance.ts
|
|
2951
|
-
import
|
|
3027
|
+
import axios19 from "axios";
|
|
2952
3028
|
var REGION2 = {
|
|
2953
3029
|
FRA: "fra",
|
|
2954
3030
|
DAL: "dal",
|
|
@@ -2968,7 +3044,7 @@ var LivechatApiError = class extends ApiErrorBase {
|
|
|
2968
3044
|
this.name = "livechat";
|
|
2969
3045
|
}
|
|
2970
3046
|
};
|
|
2971
|
-
var livechatClientInstance =
|
|
3047
|
+
var livechatClientInstance = axios19.create({
|
|
2972
3048
|
baseURL: "https://api.labs.livechatinc.com"
|
|
2973
3049
|
});
|
|
2974
3050
|
livechatClientInstance.interceptors.response.use(
|
|
@@ -3312,12 +3388,68 @@ var textPlatformDashboardApi = {
|
|
|
3312
3388
|
}
|
|
3313
3389
|
};
|
|
3314
3390
|
|
|
3391
|
+
// src/utils/misc/mergeDeep.ts
|
|
3392
|
+
function isObject(item) {
|
|
3393
|
+
return item !== null && typeof item === "object" && !Array.isArray(item);
|
|
3394
|
+
}
|
|
3395
|
+
function mergeDeep(target, source) {
|
|
3396
|
+
if (!isObject(target) || !isObject(source)) {
|
|
3397
|
+
return source;
|
|
3398
|
+
}
|
|
3399
|
+
const output = __spreadValues({}, target);
|
|
3400
|
+
Object.keys(source).forEach((key) => {
|
|
3401
|
+
if (isObject(source[key])) {
|
|
3402
|
+
if (!(key in target)) {
|
|
3403
|
+
output[key] = source[key];
|
|
3404
|
+
} else {
|
|
3405
|
+
output[key] = mergeDeep(
|
|
3406
|
+
target[key],
|
|
3407
|
+
source[key]
|
|
3408
|
+
);
|
|
3409
|
+
}
|
|
3410
|
+
} else if (Array.isArray(source[key])) {
|
|
3411
|
+
output[key] = [...source[key]];
|
|
3412
|
+
} else {
|
|
3413
|
+
output[key] = source[key];
|
|
3414
|
+
}
|
|
3415
|
+
});
|
|
3416
|
+
return output;
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3419
|
+
// src/utils/misc/debounce.ts
|
|
3420
|
+
var debounce = (func, wait) => {
|
|
3421
|
+
let timeout = null;
|
|
3422
|
+
return (...args) => {
|
|
3423
|
+
if (timeout) {
|
|
3424
|
+
clearTimeout(timeout);
|
|
3425
|
+
}
|
|
3426
|
+
timeout = setTimeout(() => {
|
|
3427
|
+
func(...args);
|
|
3428
|
+
}, wait);
|
|
3429
|
+
};
|
|
3430
|
+
};
|
|
3431
|
+
|
|
3432
|
+
// src/utils/misc/url/build.ts
|
|
3433
|
+
var buildUrlFromSegments = (segments, basePath, baseUrl = "") => segments.length ? `${baseUrl}${basePath}/${segments.map(encodeURIComponent).join("/")}` : basePath;
|
|
3434
|
+
|
|
3315
3435
|
// src/apis/integrations/text/platform/workflow/credentials/api.ts
|
|
3436
|
+
var getUrl = (segments = []) => buildUrlFromSegments(segments, "/workflow_platform/credentials");
|
|
3437
|
+
var urls = {
|
|
3438
|
+
get: (id) => getUrl([id]),
|
|
3439
|
+
getList: () => getUrl(),
|
|
3440
|
+
create: () => getUrl(),
|
|
3441
|
+
update: (id) => getUrl([id]),
|
|
3442
|
+
delete: (id) => getUrl([id]),
|
|
3443
|
+
connect: (id) => getUrl([id, "connection"])
|
|
3444
|
+
};
|
|
3316
3445
|
var textPlatformWorkflowsCredentialsApi = {
|
|
3446
|
+
meta: {
|
|
3447
|
+
urls
|
|
3448
|
+
},
|
|
3317
3449
|
get(id, authorization) {
|
|
3318
3450
|
return __async(this, null, function* () {
|
|
3319
3451
|
return textClientInstance.get(
|
|
3320
|
-
|
|
3452
|
+
urls.get(id),
|
|
3321
3453
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3322
3454
|
ensureAuthorizationToken: true
|
|
3323
3455
|
}))
|
|
@@ -3334,7 +3466,7 @@ var textPlatformWorkflowsCredentialsApi = {
|
|
|
3334
3466
|
getList(authorization) {
|
|
3335
3467
|
return __async(this, null, function* () {
|
|
3336
3468
|
return textClientInstance.get(
|
|
3337
|
-
|
|
3469
|
+
urls.getList(),
|
|
3338
3470
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3339
3471
|
ensureAuthorizationToken: true
|
|
3340
3472
|
}))
|
|
@@ -3351,7 +3483,7 @@ var textPlatformWorkflowsCredentialsApi = {
|
|
|
3351
3483
|
create(payload, authorization) {
|
|
3352
3484
|
return __async(this, null, function* () {
|
|
3353
3485
|
return textClientInstance.post(
|
|
3354
|
-
|
|
3486
|
+
urls.create(),
|
|
3355
3487
|
payload,
|
|
3356
3488
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3357
3489
|
ensureAuthorizationToken: true
|
|
@@ -3369,7 +3501,7 @@ var textPlatformWorkflowsCredentialsApi = {
|
|
|
3369
3501
|
update(id, payload, authorization) {
|
|
3370
3502
|
return __async(this, null, function* () {
|
|
3371
3503
|
return textClientInstance.put(
|
|
3372
|
-
|
|
3504
|
+
urls.update(id),
|
|
3373
3505
|
payload,
|
|
3374
3506
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3375
3507
|
ensureAuthorizationToken: true
|
|
@@ -3387,7 +3519,7 @@ var textPlatformWorkflowsCredentialsApi = {
|
|
|
3387
3519
|
delete(id, authorization) {
|
|
3388
3520
|
return __async(this, null, function* () {
|
|
3389
3521
|
return textClientInstance.delete(
|
|
3390
|
-
|
|
3522
|
+
urls.delete(id),
|
|
3391
3523
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3392
3524
|
ensureAuthorizationToken: true
|
|
3393
3525
|
}))
|
|
@@ -3404,7 +3536,7 @@ var textPlatformWorkflowsCredentialsApi = {
|
|
|
3404
3536
|
connect(id, code, authorization) {
|
|
3405
3537
|
return __async(this, null, function* () {
|
|
3406
3538
|
return textClientInstance.put(
|
|
3407
|
-
|
|
3539
|
+
urls.connect(id),
|
|
3408
3540
|
{
|
|
3409
3541
|
code
|
|
3410
3542
|
},
|
|
@@ -3424,11 +3556,18 @@ var textPlatformWorkflowsCredentialsApi = {
|
|
|
3424
3556
|
};
|
|
3425
3557
|
|
|
3426
3558
|
// src/apis/integrations/text/platform/workflow/functions/api.ts
|
|
3559
|
+
var getUrl2 = (segments = []) => buildUrlFromSegments(segments, "/workflow_platform/functions");
|
|
3560
|
+
var urls2 = {
|
|
3561
|
+
get: () => getUrl2()
|
|
3562
|
+
};
|
|
3427
3563
|
var textPlatformWorkflowsFunctionsApi = {
|
|
3564
|
+
meta: {
|
|
3565
|
+
urls: urls2
|
|
3566
|
+
},
|
|
3428
3567
|
get(authorization) {
|
|
3429
3568
|
return __async(this, null, function* () {
|
|
3430
3569
|
return textClientInstance.get(
|
|
3431
|
-
|
|
3570
|
+
urls2.get(),
|
|
3432
3571
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3433
3572
|
ensureAuthorizationToken: true
|
|
3434
3573
|
}))
|
|
@@ -3444,12 +3583,56 @@ var textPlatformWorkflowsFunctionsApi = {
|
|
|
3444
3583
|
}
|
|
3445
3584
|
};
|
|
3446
3585
|
|
|
3586
|
+
// src/apis/integrations/text/platform/workflow/resources/api.ts
|
|
3587
|
+
var textPlatformWorkflowsResourcesApi = {
|
|
3588
|
+
get(resource, authorization) {
|
|
3589
|
+
return __async(this, null, function* () {
|
|
3590
|
+
const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3591
|
+
ensureAuthorizationToken: true
|
|
3592
|
+
}));
|
|
3593
|
+
return textClientInstance.get(
|
|
3594
|
+
`/workflow_platform/external_resources/${encodeURIComponent(resource.product)}/${encodeURIComponent(resource.name)}`,
|
|
3595
|
+
__spreadProps(__spreadValues({}, config), {
|
|
3596
|
+
headers: __spreadProps(__spreadValues({}, config.headers), {
|
|
3597
|
+
"X-Cred-ID": authorization == null ? void 0 : authorization.credentialId
|
|
3598
|
+
})
|
|
3599
|
+
})
|
|
3600
|
+
).catch((error) => {
|
|
3601
|
+
if (error instanceof TextApiError) {
|
|
3602
|
+
throw error.withCustomMessage(
|
|
3603
|
+
`Couldn't get external resources. [${error.message}]`
|
|
3604
|
+
);
|
|
3605
|
+
}
|
|
3606
|
+
throw error;
|
|
3607
|
+
});
|
|
3608
|
+
});
|
|
3609
|
+
}
|
|
3610
|
+
};
|
|
3611
|
+
|
|
3447
3612
|
// src/apis/integrations/text/platform/workflow/workflows/api.ts
|
|
3613
|
+
var getUrl3 = (segments = []) => buildUrlFromSegments(segments, "/workflow_platform/workflows");
|
|
3614
|
+
var urls3 = {
|
|
3615
|
+
getWorkflows: () => getUrl3(),
|
|
3616
|
+
createWorkflow: () => getUrl3(),
|
|
3617
|
+
getWorkflow: (id) => getUrl3([id]),
|
|
3618
|
+
updateWorkflow: (id) => getUrl3([id]),
|
|
3619
|
+
deleteWorkflow: (id) => getUrl3([id]),
|
|
3620
|
+
createWorkflowDraft: (id) => getUrl3([id, "draft"]),
|
|
3621
|
+
publishWorkflowDraft: (id) => getUrl3([id, "publish"]),
|
|
3622
|
+
toggleWorkflowActivation: (id) => getUrl3([id, "activation"]),
|
|
3623
|
+
executeWorkflow: (id) => getUrl3([id, "executions"]),
|
|
3624
|
+
getWorkflowExecutionsList: (id) => getUrl3([id, "executions"]),
|
|
3625
|
+
getWorkflowExecutionDetails: (id, executionId) => getUrl3([id, "executions", executionId]),
|
|
3626
|
+
validateWorkflowDefinition: () => getUrl3(["validation"])
|
|
3627
|
+
};
|
|
3448
3628
|
var textPlatformWorkflowsApi = {
|
|
3629
|
+
meta: {
|
|
3630
|
+
urls: urls3
|
|
3631
|
+
},
|
|
3449
3632
|
getWorkflows(authorization) {
|
|
3450
3633
|
return __async(this, null, function* () {
|
|
3451
3634
|
const { data: workflows } = yield textClientInstance.get(
|
|
3452
|
-
|
|
3635
|
+
urls3.getWorkflows(),
|
|
3453
3636
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3454
3637
|
ensureAuthorizationToken: true
|
|
3455
3638
|
}))
|
|
@@ -3460,7 +3643,7 @@ var textPlatformWorkflowsApi = {
|
|
|
3460
3643
|
getWorkflow(workflowId, authorization) {
|
|
3461
3644
|
return __async(this, null, function* () {
|
|
3462
3645
|
const { data: workflow } = yield textClientInstance.get(
|
|
3463
|
-
|
|
3646
|
+
urls3.getWorkflow(workflowId),
|
|
3464
3647
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3465
3648
|
ensureAuthorizationToken: true
|
|
3466
3649
|
}))
|
|
@@ -3471,7 +3654,7 @@ var textPlatformWorkflowsApi = {
|
|
|
3471
3654
|
createWorkflow(payload, authorization) {
|
|
3472
3655
|
return __async(this, null, function* () {
|
|
3473
3656
|
return textClientInstance.post(
|
|
3474
|
-
|
|
3657
|
+
urls3.createWorkflow(),
|
|
3475
3658
|
payload,
|
|
3476
3659
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3477
3660
|
ensureAuthorizationToken: true
|
|
@@ -3482,7 +3665,7 @@ var textPlatformWorkflowsApi = {
|
|
|
3482
3665
|
updateWorkflow(workflowId, payload, authorization) {
|
|
3483
3666
|
return __async(this, null, function* () {
|
|
3484
3667
|
return textClientInstance.put(
|
|
3485
|
-
|
|
3668
|
+
urls3.updateWorkflow(workflowId),
|
|
3486
3669
|
payload,
|
|
3487
3670
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3488
3671
|
ensureAuthorizationToken: true
|
|
@@ -3492,18 +3675,15 @@ var textPlatformWorkflowsApi = {
|
|
|
3492
3675
|
},
|
|
3493
3676
|
deleteWorkflow(workflowId, authorization) {
|
|
3494
3677
|
return __async(this, null, function* () {
|
|
3495
|
-
return textClientInstance.delete(
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
ensureAuthorizationToken: true
|
|
3499
|
-
})))
|
|
3500
|
-
);
|
|
3678
|
+
return textClientInstance.delete(urls3.deleteWorkflow(workflowId), __spreadValues({}, getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3679
|
+
ensureAuthorizationToken: true
|
|
3680
|
+
}))));
|
|
3501
3681
|
});
|
|
3502
3682
|
},
|
|
3503
3683
|
createWorkflowDraft(workflowId, payload, authorization) {
|
|
3504
3684
|
return __async(this, null, function* () {
|
|
3505
3685
|
return textClientInstance.post(
|
|
3506
|
-
|
|
3686
|
+
urls3.createWorkflowDraft(workflowId),
|
|
3507
3687
|
payload,
|
|
3508
3688
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3509
3689
|
ensureAuthorizationToken: true
|
|
@@ -3514,7 +3694,7 @@ var textPlatformWorkflowsApi = {
|
|
|
3514
3694
|
publishWorkflowDraft(workflowId, authorization) {
|
|
3515
3695
|
return __async(this, null, function* () {
|
|
3516
3696
|
return textClientInstance.post(
|
|
3517
|
-
|
|
3697
|
+
urls3.publishWorkflowDraft(workflowId),
|
|
3518
3698
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3519
3699
|
ensureAuthorizationToken: true
|
|
3520
3700
|
}))
|
|
@@ -3524,9 +3704,7 @@ var textPlatformWorkflowsApi = {
|
|
|
3524
3704
|
toggleWorkflowActivation(workflowId, isActive, authorization) {
|
|
3525
3705
|
return __async(this, null, function* () {
|
|
3526
3706
|
return textClientInstance.put(
|
|
3527
|
-
|
|
3528
|
-
workflowId
|
|
3529
|
-
)}/activation`,
|
|
3707
|
+
urls3.toggleWorkflowActivation(workflowId),
|
|
3530
3708
|
{
|
|
3531
3709
|
active: isActive
|
|
3532
3710
|
},
|
|
@@ -3539,9 +3717,7 @@ var textPlatformWorkflowsApi = {
|
|
|
3539
3717
|
executeWorkflow(workflowId, input, authorization) {
|
|
3540
3718
|
return __async(this, null, function* () {
|
|
3541
3719
|
const { data: execution } = yield textClientInstance.post(
|
|
3542
|
-
|
|
3543
|
-
workflowId
|
|
3544
|
-
)}/executions`,
|
|
3720
|
+
urls3.executeWorkflow(workflowId),
|
|
3545
3721
|
{
|
|
3546
3722
|
input
|
|
3547
3723
|
},
|
|
@@ -3555,9 +3731,7 @@ var textPlatformWorkflowsApi = {
|
|
|
3555
3731
|
getWorkflowExecutionsList(workflowId, authorization) {
|
|
3556
3732
|
return __async(this, null, function* () {
|
|
3557
3733
|
const { data: executions } = yield textClientInstance.get(
|
|
3558
|
-
|
|
3559
|
-
workflowId
|
|
3560
|
-
)}/executions`,
|
|
3734
|
+
urls3.executeWorkflow(workflowId),
|
|
3561
3735
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3562
3736
|
ensureAuthorizationToken: true
|
|
3563
3737
|
}))
|
|
@@ -3568,9 +3742,7 @@ var textPlatformWorkflowsApi = {
|
|
|
3568
3742
|
getWorkflowExecutionDetails(workflowId, executionId, authorization) {
|
|
3569
3743
|
return __async(this, null, function* () {
|
|
3570
3744
|
const { data: execution } = yield textClientInstance.get(
|
|
3571
|
-
|
|
3572
|
-
workflowId
|
|
3573
|
-
)}/executions/${encodeURIComponent(executionId)}`,
|
|
3745
|
+
urls3.getWorkflowExecutionDetails(workflowId, executionId),
|
|
3574
3746
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3575
3747
|
ensureAuthorizationToken: true
|
|
3576
3748
|
}))
|
|
@@ -3581,7 +3753,7 @@ var textPlatformWorkflowsApi = {
|
|
|
3581
3753
|
validateWorkflowDefinition(payload, authorization) {
|
|
3582
3754
|
return __async(this, null, function* () {
|
|
3583
3755
|
yield textClientInstance.post(
|
|
3584
|
-
|
|
3756
|
+
urls3.validateWorkflowDefinition(),
|
|
3585
3757
|
payload,
|
|
3586
3758
|
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3587
3759
|
ensureAuthorizationToken: true
|
|
@@ -3595,7 +3767,8 @@ var textPlatformWorkflowsApi = {
|
|
|
3595
3767
|
var textPlatformWorkflowApi = {
|
|
3596
3768
|
workflows: textPlatformWorkflowsApi,
|
|
3597
3769
|
credentials: textPlatformWorkflowsCredentialsApi,
|
|
3598
|
-
functions: textPlatformWorkflowsFunctionsApi
|
|
3770
|
+
functions: textPlatformWorkflowsFunctionsApi,
|
|
3771
|
+
resources: textPlatformWorkflowsResourcesApi
|
|
3599
3772
|
};
|
|
3600
3773
|
|
|
3601
3774
|
// src/apis/integrations/text/platform/api.ts
|
|
@@ -3612,7 +3785,7 @@ var textApi = {
|
|
|
3612
3785
|
};
|
|
3613
3786
|
|
|
3614
3787
|
// src/apis/integrations/vercel/api.ts
|
|
3615
|
-
import
|
|
3788
|
+
import axios20 from "axios";
|
|
3616
3789
|
|
|
3617
3790
|
// src/apis/integrations/vercel/deploy/api.ts
|
|
3618
3791
|
var vercelDeployApi = {
|
|
@@ -3872,7 +4045,7 @@ var vercelApi = {
|
|
|
3872
4045
|
client_secret: clientSecret,
|
|
3873
4046
|
redirect_uri: redirectUrl
|
|
3874
4047
|
});
|
|
3875
|
-
const response = yield
|
|
4048
|
+
const response = yield axios20.post("https://api.vercel.com/v2/oauth/access_token", data, {
|
|
3876
4049
|
headers: {
|
|
3877
4050
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
3878
4051
|
}
|
|
@@ -3888,7 +4061,7 @@ var vercelApi = {
|
|
|
3888
4061
|
};
|
|
3889
4062
|
|
|
3890
4063
|
// src/apis/integrations/neon/api.ts
|
|
3891
|
-
import
|
|
4064
|
+
import axios21 from "axios";
|
|
3892
4065
|
|
|
3893
4066
|
// src/apis/integrations/neon/project/branch/api.ts
|
|
3894
4067
|
var neonProjectBranchApi = {
|
|
@@ -4132,7 +4305,7 @@ var neonApi = {
|
|
|
4132
4305
|
redirect_uri: redirectUri,
|
|
4133
4306
|
grant_type: "authorization_code"
|
|
4134
4307
|
});
|
|
4135
|
-
const response = yield
|
|
4308
|
+
const response = yield axios21.post(
|
|
4136
4309
|
"https://oauth2.neon.tech/oauth2/token",
|
|
4137
4310
|
data,
|
|
4138
4311
|
{
|
|
@@ -4157,7 +4330,7 @@ var neonApi = {
|
|
|
4157
4330
|
client_secret: clientSecret,
|
|
4158
4331
|
grant_type: "refresh_token"
|
|
4159
4332
|
});
|
|
4160
|
-
const response = yield
|
|
4333
|
+
const response = yield axios21.post("https://oauth2.neon.tech/oauth2/token", data, {
|
|
4161
4334
|
headers: {
|
|
4162
4335
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
4163
4336
|
}
|
|
@@ -4172,7 +4345,7 @@ var neonApi = {
|
|
|
4172
4345
|
};
|
|
4173
4346
|
|
|
4174
4347
|
// src/apis/integrations/mailchimp/api.ts
|
|
4175
|
-
import
|
|
4348
|
+
import axios22 from "axios";
|
|
4176
4349
|
|
|
4177
4350
|
// src/apis/integrations/mailchimp/lists/webhooks/api.ts
|
|
4178
4351
|
var mailchimpListsWebhooksApi = {
|
|
@@ -4229,7 +4402,7 @@ var mailchimpApi = {
|
|
|
4229
4402
|
redirect_uri: redirectUri,
|
|
4230
4403
|
grant_type: "authorization_code"
|
|
4231
4404
|
});
|
|
4232
|
-
const tokenResponse = yield
|
|
4405
|
+
const tokenResponse = yield axios22.post(
|
|
4233
4406
|
"https://login.mailchimp.com/oauth2/token",
|
|
4234
4407
|
data,
|
|
4235
4408
|
{
|
|
@@ -4250,7 +4423,7 @@ var mailchimpApi = {
|
|
|
4250
4423
|
return __async(this, arguments, function* ({ token }) {
|
|
4251
4424
|
const {
|
|
4252
4425
|
data: { dc: server }
|
|
4253
|
-
} = yield
|
|
4426
|
+
} = yield axios22.get(
|
|
4254
4427
|
"https://login.mailchimp.com/oauth2/metadata",
|
|
4255
4428
|
{
|
|
4256
4429
|
headers: {
|
|
@@ -4267,7 +4440,7 @@ var mailchimpApi = {
|
|
|
4267
4440
|
};
|
|
4268
4441
|
|
|
4269
4442
|
// src/apis/integrations/shopify/api.ts
|
|
4270
|
-
import
|
|
4443
|
+
import axios23 from "axios";
|
|
4271
4444
|
|
|
4272
4445
|
// src/apis/integrations/shopify/webhooks/api.ts
|
|
4273
4446
|
var shopifyWebhooksApi = {
|
|
@@ -4322,7 +4495,7 @@ var shopifyApi = {
|
|
|
4322
4495
|
redirect_uri: redirectUri,
|
|
4323
4496
|
grant_type: "authorization_code"
|
|
4324
4497
|
});
|
|
4325
|
-
const response = yield
|
|
4498
|
+
const response = yield axios23.post(
|
|
4326
4499
|
`https://${encodeURIComponent(
|
|
4327
4500
|
shop
|
|
4328
4501
|
)}.myshopify.com/admin/oauth/access_token`,
|
|
@@ -4500,7 +4673,7 @@ var hubspotApi = {
|
|
|
4500
4673
|
};
|
|
4501
4674
|
|
|
4502
4675
|
// src/apis/integrations/bigcommerce/api.ts
|
|
4503
|
-
import
|
|
4676
|
+
import axios24 from "axios";
|
|
4504
4677
|
|
|
4505
4678
|
// src/apis/integrations/bigcommerce/webhooks/api.ts
|
|
4506
4679
|
var bigCommerceWebhooksApi = {
|
|
@@ -4554,7 +4727,7 @@ var bigcommerceApi = {
|
|
|
4554
4727
|
redirect_uri: redirectUri,
|
|
4555
4728
|
grant_type: "authorization_code"
|
|
4556
4729
|
});
|
|
4557
|
-
const tokenResponse = yield
|
|
4730
|
+
const tokenResponse = yield axios24.post(
|
|
4558
4731
|
"https://login.bigcommerce.com/oauth2/token",
|
|
4559
4732
|
data,
|
|
4560
4733
|
{
|
|
@@ -4574,11 +4747,11 @@ var bigcommerceApi = {
|
|
|
4574
4747
|
};
|
|
4575
4748
|
|
|
4576
4749
|
// src/apis/integrations/openai/api.ts
|
|
4577
|
-
import
|
|
4750
|
+
import axios25 from "axios";
|
|
4578
4751
|
var openaiApi = {
|
|
4579
4752
|
verifyToken(token) {
|
|
4580
4753
|
return __async(this, null, function* () {
|
|
4581
|
-
const response = yield
|
|
4754
|
+
const response = yield axios25.get("https://api.openai.com/v1/models", {
|
|
4582
4755
|
headers: {
|
|
4583
4756
|
Authorization: `Bearer ${token}`
|
|
4584
4757
|
}
|
|
@@ -4588,6 +4761,43 @@ var openaiApi = {
|
|
|
4588
4761
|
}
|
|
4589
4762
|
};
|
|
4590
4763
|
|
|
4764
|
+
// src/apis/integrations/slack/api.ts
|
|
4765
|
+
var slackApi = {
|
|
4766
|
+
getToken(code, clientId, clientSecret, redirectUri) {
|
|
4767
|
+
return __async(this, null, function* () {
|
|
4768
|
+
var _a;
|
|
4769
|
+
const data = new URLSearchParams({
|
|
4770
|
+
code,
|
|
4771
|
+
client_id: clientId,
|
|
4772
|
+
client_secret: clientSecret,
|
|
4773
|
+
redirect_uri: redirectUri,
|
|
4774
|
+
grant_type: "authorization_code"
|
|
4775
|
+
});
|
|
4776
|
+
const tokenResponse = yield slackClientInstance.post(
|
|
4777
|
+
"/oauth/v1/token",
|
|
4778
|
+
data,
|
|
4779
|
+
{
|
|
4780
|
+
headers: {
|
|
4781
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
4782
|
+
}
|
|
4783
|
+
}
|
|
4784
|
+
);
|
|
4785
|
+
const params = new URLSearchParams(
|
|
4786
|
+
tokenResponse.data
|
|
4787
|
+
);
|
|
4788
|
+
return {
|
|
4789
|
+
token: (_a = params.get("access_token")) != null ? _a : ""
|
|
4790
|
+
};
|
|
4791
|
+
});
|
|
4792
|
+
},
|
|
4793
|
+
getTokenInfo(token) {
|
|
4794
|
+
return __async(this, null, function* () {
|
|
4795
|
+
const { data: tokenInfo } = yield slackClientInstance.get(`/oauth/v1/access-tokens/${token}`);
|
|
4796
|
+
return tokenInfo;
|
|
4797
|
+
});
|
|
4798
|
+
}
|
|
4799
|
+
};
|
|
4800
|
+
|
|
4591
4801
|
// src/apis/integrations/api.ts
|
|
4592
4802
|
var integrationsApi = {
|
|
4593
4803
|
github: gitHubApi,
|
|
@@ -4600,7 +4810,8 @@ var integrationsApi = {
|
|
|
4600
4810
|
hubspot: hubspotApi,
|
|
4601
4811
|
bigcommerce: bigcommerceApi,
|
|
4602
4812
|
openai: openaiApi,
|
|
4603
|
-
text: textApi
|
|
4813
|
+
text: textApi,
|
|
4814
|
+
slack: slackApi
|
|
4604
4815
|
};
|
|
4605
4816
|
|
|
4606
4817
|
// src/apis/products/livechat/agents/api.ts
|
|
@@ -5467,19 +5678,34 @@ var productsApi = {
|
|
|
5467
5678
|
};
|
|
5468
5679
|
|
|
5469
5680
|
// src/apis/platform/accounts/accounts/api.ts
|
|
5470
|
-
var
|
|
5681
|
+
var urls4 = (withBaseUrl = false) => {
|
|
5682
|
+
const getUrl5 = (segments = []) => buildUrlFromSegments(
|
|
5683
|
+
segments,
|
|
5684
|
+
"/v2/accounts",
|
|
5685
|
+
withBaseUrl ? platformAccountsClientInstance.config.baseURL : void 0
|
|
5686
|
+
);
|
|
5687
|
+
return {
|
|
5688
|
+
getAccounts: () => getUrl5(),
|
|
5689
|
+
getAccount: (id) => getUrl5([id]),
|
|
5690
|
+
getMeAccount: () => getUrl5(["me"])
|
|
5691
|
+
};
|
|
5692
|
+
};
|
|
5693
|
+
var api = {
|
|
5471
5694
|
getAccounts(authorization) {
|
|
5472
5695
|
return __async(this, null, function* () {
|
|
5473
|
-
return platformAccountsClientInstance.get(
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5696
|
+
return platformAccountsClientInstance.get(
|
|
5697
|
+
urls4().getAccounts(),
|
|
5698
|
+
{
|
|
5699
|
+
authorization,
|
|
5700
|
+
customErrorMessage: "Accounts couldn't be fetched."
|
|
5701
|
+
}
|
|
5702
|
+
);
|
|
5477
5703
|
});
|
|
5478
5704
|
},
|
|
5479
5705
|
getAccount(accountId, authorization) {
|
|
5480
5706
|
return __async(this, null, function* () {
|
|
5481
5707
|
return platformAccountsClientInstance.get(
|
|
5482
|
-
|
|
5708
|
+
urls4().getAccount(accountId),
|
|
5483
5709
|
{
|
|
5484
5710
|
authorization,
|
|
5485
5711
|
customErrorMessage: "Account couldn't be fetched."
|
|
@@ -5499,6 +5725,11 @@ var platformAccountsAccountApi = {
|
|
|
5499
5725
|
});
|
|
5500
5726
|
}
|
|
5501
5727
|
};
|
|
5728
|
+
var platformAccountsAccountApi = __spreadProps(__spreadValues({}, api), {
|
|
5729
|
+
meta: {
|
|
5730
|
+
urls: urls4
|
|
5731
|
+
}
|
|
5732
|
+
});
|
|
5502
5733
|
|
|
5503
5734
|
// src/apis/platform/accounts/client/api.ts
|
|
5504
5735
|
var platformAccountsClientApi = {
|
|
@@ -5661,11 +5892,19 @@ var platformAccountsPersonalAccessTokenApi = {
|
|
|
5661
5892
|
};
|
|
5662
5893
|
|
|
5663
5894
|
// src/apis/platform/accounts/products/api.ts
|
|
5895
|
+
var getUrl4 = (segments = []) => buildUrlFromSegments(segments, "/v2/organizations");
|
|
5896
|
+
var urls5 = {
|
|
5897
|
+
getOrganizationProducts: () => getUrl4(["my", "products"]),
|
|
5898
|
+
updateOrganizationProducts: () => getUrl4(["my", "products"])
|
|
5899
|
+
};
|
|
5664
5900
|
var platformAccountsProductsApi = {
|
|
5901
|
+
meta: {
|
|
5902
|
+
urls: urls5
|
|
5903
|
+
},
|
|
5665
5904
|
getOrganizationProducts(authorization) {
|
|
5666
5905
|
return __async(this, null, function* () {
|
|
5667
5906
|
return platformAccountsClientInstance.get(
|
|
5668
|
-
|
|
5907
|
+
urls5.getOrganizationProducts(),
|
|
5669
5908
|
{ authorization, customErrorMessage: "Products couldn't be fetched." }
|
|
5670
5909
|
);
|
|
5671
5910
|
});
|
|
@@ -5673,7 +5912,7 @@ var platformAccountsProductsApi = {
|
|
|
5673
5912
|
updateOrganizationProducts(payload, authorization) {
|
|
5674
5913
|
return __async(this, null, function* () {
|
|
5675
5914
|
return platformAccountsClientInstance.post(
|
|
5676
|
-
|
|
5915
|
+
urls5.updateOrganizationProducts(),
|
|
5677
5916
|
payload,
|
|
5678
5917
|
{ authorization, customErrorMessage: "Products couldn't be updated." }
|
|
5679
5918
|
);
|
|
@@ -7834,14 +8073,14 @@ var platformApi = {
|
|
|
7834
8073
|
};
|
|
7835
8074
|
|
|
7836
8075
|
// src/apis/api.ts
|
|
7837
|
-
var
|
|
8076
|
+
var api2 = {
|
|
7838
8077
|
platform: platformApi,
|
|
7839
8078
|
products: productsApi,
|
|
7840
8079
|
integrations: integrationsApi,
|
|
7841
8080
|
isInitialized: false
|
|
7842
8081
|
};
|
|
7843
8082
|
function initApi(config, tokens) {
|
|
7844
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
8083
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
7845
8084
|
initPlatformAccountsClient(
|
|
7846
8085
|
(_a = config.urls.platform) == null ? void 0 : _a.accounts,
|
|
7847
8086
|
(_b = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _b.token
|
|
@@ -7858,7 +8097,8 @@ function initApi(config, tokens) {
|
|
|
7858
8097
|
neon: tokens.neon,
|
|
7859
8098
|
planetscale: tokens.planetscale,
|
|
7860
8099
|
mailchimp: tokens.mailchimp,
|
|
7861
|
-
shopify: tokens.shopify
|
|
8100
|
+
shopify: tokens.shopify,
|
|
8101
|
+
slack: tokens.slack
|
|
7862
8102
|
} : void 0
|
|
7863
8103
|
);
|
|
7864
8104
|
initLiveChatClient((_h = config.urls.products) == null ? void 0 : _h.livechat, (_i = tokens == null ? void 0 : tokens.platform) == null ? void 0 : _i.token);
|
|
@@ -7872,7 +8112,8 @@ function initApi(config, tokens) {
|
|
|
7872
8112
|
initShopifyClient((_s = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _s.token, (_t = tokens == null ? void 0 : tokens.shopify) == null ? void 0 : _t.shop);
|
|
7873
8113
|
initBigCommerceClient((_u = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _u.token, (_v = tokens == null ? void 0 : tokens.bigcommerce) == null ? void 0 : _v.shop);
|
|
7874
8114
|
initHubspotClient((_w = tokens == null ? void 0 : tokens.hubspot) == null ? void 0 : _w.token);
|
|
7875
|
-
|
|
8115
|
+
initSlackClient((_x = tokens == null ? void 0 : tokens.slack) == null ? void 0 : _x.token);
|
|
8116
|
+
api2.isInitialized = true;
|
|
7876
8117
|
}
|
|
7877
8118
|
|
|
7878
8119
|
// ../../../private/utils/src/serializers/base64.ts
|
|
@@ -7935,47 +8176,6 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
|
|
|
7935
8176
|
window.location.href = url;
|
|
7936
8177
|
});
|
|
7937
8178
|
}
|
|
7938
|
-
|
|
7939
|
-
// src/utils/misc/mergeDeep.ts
|
|
7940
|
-
function isObject(item) {
|
|
7941
|
-
return item !== null && typeof item === "object" && !Array.isArray(item);
|
|
7942
|
-
}
|
|
7943
|
-
function mergeDeep(target, source) {
|
|
7944
|
-
if (!isObject(target) || !isObject(source)) {
|
|
7945
|
-
return source;
|
|
7946
|
-
}
|
|
7947
|
-
const output = __spreadValues({}, target);
|
|
7948
|
-
Object.keys(source).forEach((key) => {
|
|
7949
|
-
if (isObject(source[key])) {
|
|
7950
|
-
if (!(key in target)) {
|
|
7951
|
-
output[key] = source[key];
|
|
7952
|
-
} else {
|
|
7953
|
-
output[key] = mergeDeep(
|
|
7954
|
-
target[key],
|
|
7955
|
-
source[key]
|
|
7956
|
-
);
|
|
7957
|
-
}
|
|
7958
|
-
} else if (Array.isArray(source[key])) {
|
|
7959
|
-
output[key] = [...source[key]];
|
|
7960
|
-
} else {
|
|
7961
|
-
output[key] = source[key];
|
|
7962
|
-
}
|
|
7963
|
-
});
|
|
7964
|
-
return output;
|
|
7965
|
-
}
|
|
7966
|
-
|
|
7967
|
-
// src/utils/misc/debounce.ts
|
|
7968
|
-
var debounce = (func, wait) => {
|
|
7969
|
-
let timeout = null;
|
|
7970
|
-
return (...args) => {
|
|
7971
|
-
if (timeout) {
|
|
7972
|
-
clearTimeout(timeout);
|
|
7973
|
-
}
|
|
7974
|
-
timeout = setTimeout(() => {
|
|
7975
|
-
func(...args);
|
|
7976
|
-
}, wait);
|
|
7977
|
-
};
|
|
7978
|
-
};
|
|
7979
8179
|
export {
|
|
7980
8180
|
API_NOTIFICATIONS,
|
|
7981
8181
|
AccountsApiError,
|
|
@@ -8002,16 +8202,18 @@ export {
|
|
|
8002
8202
|
MailchimpEventNames,
|
|
8003
8203
|
ShopifyApiError,
|
|
8004
8204
|
ShopifyEventNames,
|
|
8205
|
+
SlackApiError,
|
|
8005
8206
|
TextApiError,
|
|
8006
8207
|
TextHelpDeskEventNames,
|
|
8007
8208
|
TextLivechatEventNames,
|
|
8008
8209
|
UnauthorizeAccountsApiError,
|
|
8009
8210
|
UnauthorizeApiError,
|
|
8010
8211
|
WorkflowDefinitionTaskType,
|
|
8212
|
+
WorkflowExecutionStatus,
|
|
8011
8213
|
WorkflowTemplateCategory,
|
|
8012
8214
|
adapterClientInstance,
|
|
8013
8215
|
allAppTemplates,
|
|
8014
|
-
api,
|
|
8216
|
+
api2 as api,
|
|
8015
8217
|
appBaseTemplates,
|
|
8016
8218
|
appRepositoryTemplates,
|
|
8017
8219
|
appRepositoryTemplatesMap,
|
|
@@ -8020,6 +8222,7 @@ export {
|
|
|
8020
8222
|
bigCommerceClientInstance,
|
|
8021
8223
|
bigcommerceEventsZods,
|
|
8022
8224
|
billingClientInstance,
|
|
8225
|
+
buildUrlFromSegments,
|
|
8023
8226
|
debounce,
|
|
8024
8227
|
dpsClientInstance,
|
|
8025
8228
|
getAdapterClientConfig,
|
|
@@ -8044,6 +8247,7 @@ export {
|
|
|
8044
8247
|
getRegion2 as getRegion,
|
|
8045
8248
|
getShopifyClientConfig,
|
|
8046
8249
|
getShopifyClientUrl,
|
|
8250
|
+
getSlackClientConfig,
|
|
8047
8251
|
getTextClientConfig,
|
|
8048
8252
|
getVercelClientConfig,
|
|
8049
8253
|
githubClientInstance,
|
|
@@ -8065,6 +8269,7 @@ export {
|
|
|
8065
8269
|
initPlanetScaleClient,
|
|
8066
8270
|
initPlatformAccountsClient,
|
|
8067
8271
|
initShopifyClient,
|
|
8272
|
+
initSlackClient,
|
|
8068
8273
|
initTextClient,
|
|
8069
8274
|
initVercelClient,
|
|
8070
8275
|
integrationEventsZods,
|
|
@@ -8078,6 +8283,7 @@ export {
|
|
|
8078
8283
|
platformAccountsClientInstance,
|
|
8079
8284
|
shopifyClientInstance,
|
|
8080
8285
|
shopifyEventsZods,
|
|
8286
|
+
slackClientInstance,
|
|
8081
8287
|
textClientInstance,
|
|
8082
8288
|
textHelpDeskEventsZods,
|
|
8083
8289
|
textLivechatEventsZods,
|
|
@@ -8090,6 +8296,7 @@ export {
|
|
|
8090
8296
|
updateNetlifyClient,
|
|
8091
8297
|
updatePlanetScaleClient,
|
|
8092
8298
|
updateShopifyClient,
|
|
8299
|
+
updateSlackClient,
|
|
8093
8300
|
updateVercelClient,
|
|
8094
8301
|
vercelClientInstance
|
|
8095
8302
|
};
|