@livechat/developer-studio-api 3.4.19 → 3.4.22
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 +425 -297
- package/dist/index.d.ts +425 -297
- package/dist/index.js +146 -21
- package/dist/index.mjs +143 -21
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -93,6 +93,8 @@ __export(src_exports, {
|
|
|
93
93
|
ShopifyApiError: () => ShopifyApiError,
|
|
94
94
|
ShopifyEventNames: () => ShopifyEventNames,
|
|
95
95
|
SlackApiError: () => SlackApiError,
|
|
96
|
+
SlackEventNames: () => SlackEventNames,
|
|
97
|
+
SlackEventTypes: () => SlackEventTypes,
|
|
96
98
|
TextApiError: () => TextApiError,
|
|
97
99
|
TextHelpDeskEventNames: () => TextHelpDeskEventNames,
|
|
98
100
|
TextLivechatEventNames: () => TextLivechatEventNames,
|
|
@@ -173,6 +175,7 @@ __export(src_exports, {
|
|
|
173
175
|
shopifyClientInstance: () => shopifyClientInstance,
|
|
174
176
|
shopifyEventsZods: () => shopifyEventsZods,
|
|
175
177
|
slackClientInstance: () => slackClientInstance,
|
|
178
|
+
slackEventsZods: () => slackEventsZods,
|
|
176
179
|
textClientInstance: () => textClientInstance,
|
|
177
180
|
textHelpDeskEventsZods: () => textHelpDeskEventsZods,
|
|
178
181
|
textLivechatEventsZods: () => textLivechatEventsZods,
|
|
@@ -2092,6 +2095,12 @@ function updateBigCommerceClient(token, shop) {
|
|
|
2092
2095
|
}
|
|
2093
2096
|
}
|
|
2094
2097
|
|
|
2098
|
+
// src/apis/integrations/slack/_contracts/webhooks/dtos/webhooks.ts
|
|
2099
|
+
var SlackEventTypes = /* @__PURE__ */ ((SlackEventTypes2) => {
|
|
2100
|
+
SlackEventTypes2["MessagePosted"] = "message";
|
|
2101
|
+
return SlackEventTypes2;
|
|
2102
|
+
})(SlackEventTypes || {});
|
|
2103
|
+
|
|
2095
2104
|
// src/apis/integrations/slack/instance.ts
|
|
2096
2105
|
var import_axios16 = __toESM(require("axios"));
|
|
2097
2106
|
var SlackApiError = class extends ApiErrorBase {
|
|
@@ -2107,7 +2116,16 @@ var slackClientInstance = import_axios16.default.create({
|
|
|
2107
2116
|
}
|
|
2108
2117
|
});
|
|
2109
2118
|
slackClientInstance.interceptors.response.use(
|
|
2110
|
-
(r) =>
|
|
2119
|
+
(r) => {
|
|
2120
|
+
if (!r.data.ok) {
|
|
2121
|
+
throw new SlackApiError(
|
|
2122
|
+
`Slack API Error ${r.data.error}`,
|
|
2123
|
+
r.data,
|
|
2124
|
+
r.status
|
|
2125
|
+
);
|
|
2126
|
+
}
|
|
2127
|
+
return r;
|
|
2128
|
+
},
|
|
2111
2129
|
(error) => {
|
|
2112
2130
|
var _a, _b, _c, _d;
|
|
2113
2131
|
if (import_axios16.default.isAxiosError(error)) {
|
|
@@ -2268,7 +2286,7 @@ var IntegrationDisplayNames = /* @__PURE__ */ ((IntegrationDisplayNames2) => {
|
|
|
2268
2286
|
})(IntegrationDisplayNames || {});
|
|
2269
2287
|
|
|
2270
2288
|
// src/apis/platform/adapter/integrations/_contracts/requests/events.ts
|
|
2271
|
-
var
|
|
2289
|
+
var import_zod8 = require("zod");
|
|
2272
2290
|
|
|
2273
2291
|
// src/apis/platform/adapter/integrations/shopify/_contracts/requests/events.ts
|
|
2274
2292
|
var import_zod = require("zod");
|
|
@@ -2474,7 +2492,9 @@ var textLivechatEventsZods = {
|
|
|
2474
2492
|
get unsubscribe() {
|
|
2475
2493
|
return this.source.and(
|
|
2476
2494
|
import_zod3.z.object({
|
|
2477
|
-
event:
|
|
2495
|
+
event: import_zod3.z.object({
|
|
2496
|
+
name: this.eventName
|
|
2497
|
+
})
|
|
2478
2498
|
})
|
|
2479
2499
|
);
|
|
2480
2500
|
},
|
|
@@ -2564,7 +2584,9 @@ var textHelpDeskEventsZods = {
|
|
|
2564
2584
|
get unsubscribe() {
|
|
2565
2585
|
return this.source.and(
|
|
2566
2586
|
import_zod4.z.object({
|
|
2567
|
-
event:
|
|
2587
|
+
event: import_zod4.z.object({
|
|
2588
|
+
name: this.eventName
|
|
2589
|
+
})
|
|
2568
2590
|
})
|
|
2569
2591
|
);
|
|
2570
2592
|
},
|
|
@@ -2624,7 +2646,9 @@ var hubspotEventsZods = {
|
|
|
2624
2646
|
get unsubscribe() {
|
|
2625
2647
|
return this.source.and(
|
|
2626
2648
|
import_zod5.z.object({
|
|
2627
|
-
event:
|
|
2649
|
+
event: import_zod5.z.object({
|
|
2650
|
+
name: this.eventName
|
|
2651
|
+
})
|
|
2628
2652
|
})
|
|
2629
2653
|
);
|
|
2630
2654
|
},
|
|
@@ -2704,7 +2728,9 @@ var bigcommerceEventsZods = {
|
|
|
2704
2728
|
get unsubscribe() {
|
|
2705
2729
|
return this.source.and(
|
|
2706
2730
|
import_zod6.z.object({
|
|
2707
|
-
event:
|
|
2731
|
+
event: import_zod6.z.object({
|
|
2732
|
+
name: this.eventName
|
|
2733
|
+
})
|
|
2708
2734
|
})
|
|
2709
2735
|
);
|
|
2710
2736
|
},
|
|
@@ -2716,46 +2742,113 @@ var bigcommerceEventsZods = {
|
|
|
2716
2742
|
}
|
|
2717
2743
|
};
|
|
2718
2744
|
|
|
2745
|
+
// src/apis/platform/adapter/integrations/slack/_contracts/requests/events.ts
|
|
2746
|
+
var import_zod7 = require("zod");
|
|
2747
|
+
var SlackEventNames = /* @__PURE__ */ ((SlackEventNames2) => {
|
|
2748
|
+
SlackEventNames2["ChannelNewMessagePosted"] = "channel_new_message_posted";
|
|
2749
|
+
SlackEventNames2["MemberNewMention"] = "member_new_mention";
|
|
2750
|
+
return SlackEventNames2;
|
|
2751
|
+
})(SlackEventNames || {});
|
|
2752
|
+
var slackEventsZods = {
|
|
2753
|
+
provider: import_zod7.z.literal("slack" /* Slack */),
|
|
2754
|
+
eventName: import_zod7.z.nativeEnum(SlackEventNames),
|
|
2755
|
+
events: {
|
|
2756
|
+
channelNewMessagePosted: import_zod7.z.object({
|
|
2757
|
+
name: import_zod7.z.literal("channel_new_message_posted" /* ChannelNewMessagePosted */),
|
|
2758
|
+
channelId: import_zod7.z.string()
|
|
2759
|
+
}),
|
|
2760
|
+
memberNewMention: import_zod7.z.object({
|
|
2761
|
+
name: import_zod7.z.literal("member_new_mention" /* MemberNewMention */),
|
|
2762
|
+
userId: import_zod7.z.string()
|
|
2763
|
+
})
|
|
2764
|
+
},
|
|
2765
|
+
get event() {
|
|
2766
|
+
return import_zod7.z.discriminatedUnion("name", [
|
|
2767
|
+
this.events.channelNewMessagePosted,
|
|
2768
|
+
this.events.memberNewMention
|
|
2769
|
+
]);
|
|
2770
|
+
},
|
|
2771
|
+
get source() {
|
|
2772
|
+
return import_zod7.z.object({
|
|
2773
|
+
sourceName: import_zod7.z.enum(["apps", "workflows"]),
|
|
2774
|
+
sourceKey: import_zod7.z.string()
|
|
2775
|
+
});
|
|
2776
|
+
},
|
|
2777
|
+
get subscribe() {
|
|
2778
|
+
return this.source.and(
|
|
2779
|
+
import_zod7.z.object({
|
|
2780
|
+
event: this.event,
|
|
2781
|
+
callback: import_zod7.z.string()
|
|
2782
|
+
})
|
|
2783
|
+
);
|
|
2784
|
+
},
|
|
2785
|
+
get subscribeContent() {
|
|
2786
|
+
return import_zod7.z.object({
|
|
2787
|
+
provider: this.provider,
|
|
2788
|
+
event: this.event,
|
|
2789
|
+
callback: import_zod7.z.string()
|
|
2790
|
+
});
|
|
2791
|
+
},
|
|
2792
|
+
get unsubscribe() {
|
|
2793
|
+
return this.source.and(
|
|
2794
|
+
import_zod7.z.object({
|
|
2795
|
+
event: import_zod7.z.object({
|
|
2796
|
+
name: this.eventName
|
|
2797
|
+
})
|
|
2798
|
+
})
|
|
2799
|
+
);
|
|
2800
|
+
},
|
|
2801
|
+
get unsubscribeContent() {
|
|
2802
|
+
return import_zod7.z.object({
|
|
2803
|
+
provider: this.provider,
|
|
2804
|
+
event: this.event
|
|
2805
|
+
});
|
|
2806
|
+
}
|
|
2807
|
+
};
|
|
2808
|
+
|
|
2719
2809
|
// src/apis/platform/adapter/integrations/_contracts/requests/events.ts
|
|
2720
2810
|
var integrationEventsZods = {
|
|
2721
|
-
sourceName:
|
|
2722
|
-
providerName:
|
|
2811
|
+
sourceName: import_zod8.z.enum(["apps", "workflows"]),
|
|
2812
|
+
providerName: import_zod8.z.enum([
|
|
2723
2813
|
"text-livechat" /* LiveChat */,
|
|
2724
2814
|
"text-helpdesk" /* HelpDesk */,
|
|
2725
2815
|
"mailchimp" /* Mailchimp */,
|
|
2726
2816
|
"shopify" /* Shopify */,
|
|
2727
2817
|
"hubspot" /* HubSpot */,
|
|
2818
|
+
"slack" /* Slack */,
|
|
2728
2819
|
"bigcommerce" /* BigCommerce */
|
|
2729
2820
|
]),
|
|
2730
2821
|
get event() {
|
|
2731
|
-
return textLivechatEventsZods.event.or(textHelpDeskEventsZods.event).or(shopifyEventsZods.event).or(mailchimpEventsZods.event).or(hubspotEventsZods.event).or(bigcommerceEventsZods.event);
|
|
2822
|
+
return textLivechatEventsZods.event.or(textHelpDeskEventsZods.event).or(shopifyEventsZods.event).or(mailchimpEventsZods.event).or(hubspotEventsZods.event).or(bigcommerceEventsZods.event).or(slackEventsZods.event);
|
|
2732
2823
|
},
|
|
2733
2824
|
get source() {
|
|
2734
|
-
return
|
|
2825
|
+
return import_zod8.z.object({
|
|
2735
2826
|
sourceName: this.sourceName,
|
|
2736
|
-
sourceKey:
|
|
2827
|
+
sourceKey: import_zod8.z.string()
|
|
2737
2828
|
});
|
|
2738
2829
|
},
|
|
2739
2830
|
get subscribe() {
|
|
2740
2831
|
return this.source.and(
|
|
2741
|
-
|
|
2832
|
+
import_zod8.z.discriminatedUnion("provider", [
|
|
2742
2833
|
textLivechatEventsZods.subscribeContent,
|
|
2743
2834
|
textHelpDeskEventsZods.subscribeContent,
|
|
2744
2835
|
shopifyEventsZods.subscribeContent,
|
|
2745
2836
|
mailchimpEventsZods.subscribeContent,
|
|
2746
2837
|
hubspotEventsZods.subscribeContent,
|
|
2838
|
+
slackEventsZods.subscribeContent,
|
|
2747
2839
|
bigcommerceEventsZods.subscribeContent
|
|
2748
2840
|
])
|
|
2749
2841
|
);
|
|
2750
2842
|
},
|
|
2751
2843
|
get unsubscribe() {
|
|
2752
2844
|
return this.source.and(
|
|
2753
|
-
|
|
2845
|
+
import_zod8.z.discriminatedUnion("provider", [
|
|
2754
2846
|
textLivechatEventsZods.unsubscribeContent,
|
|
2755
2847
|
textHelpDeskEventsZods.unsubscribeContent,
|
|
2756
2848
|
shopifyEventsZods.unsubscribeContent,
|
|
2757
2849
|
mailchimpEventsZods.unsubscribeContent,
|
|
2758
2850
|
hubspotEventsZods.unsubscribeContent,
|
|
2851
|
+
slackEventsZods.unsubscribeContent,
|
|
2759
2852
|
bigcommerceEventsZods.unsubscribeContent
|
|
2760
2853
|
])
|
|
2761
2854
|
);
|
|
@@ -3103,7 +3196,7 @@ var HelpDeskApiError = class extends ApiErrorBase {
|
|
|
3103
3196
|
}
|
|
3104
3197
|
};
|
|
3105
3198
|
var helpdeskClientInstance = import_axios20.default.create({
|
|
3106
|
-
baseURL: "https://api.labs.helpdesk.com
|
|
3199
|
+
baseURL: "https://api.labs.helpdesk.com"
|
|
3107
3200
|
});
|
|
3108
3201
|
helpdeskClientInstance.interceptors.response.use(
|
|
3109
3202
|
(response) => response,
|
|
@@ -4943,9 +5036,13 @@ var slackApi = {
|
|
|
4943
5036
|
};
|
|
4944
5037
|
});
|
|
4945
5038
|
},
|
|
4946
|
-
|
|
5039
|
+
getUserTokenInfo(token) {
|
|
4947
5040
|
return __async(this, null, function* () {
|
|
4948
|
-
const { data: tokenInfo } = yield slackClientInstance.get(
|
|
5041
|
+
const { data: tokenInfo } = yield slackClientInstance.get("/auth.test", {
|
|
5042
|
+
headers: {
|
|
5043
|
+
Authorization: `Bearer ${token}`
|
|
5044
|
+
}
|
|
5045
|
+
});
|
|
4949
5046
|
return tokenInfo;
|
|
4950
5047
|
});
|
|
4951
5048
|
}
|
|
@@ -5773,7 +5870,7 @@ var helpdeskWebhooksApi = {
|
|
|
5773
5870
|
list(authorization) {
|
|
5774
5871
|
return __async(this, null, function* () {
|
|
5775
5872
|
const response = yield helpdeskClientInstance.get(
|
|
5776
|
-
"/webhooks",
|
|
5873
|
+
"/v1/webhooks",
|
|
5777
5874
|
getHelpDeskClientConfig(authorization)
|
|
5778
5875
|
);
|
|
5779
5876
|
return response;
|
|
@@ -5782,7 +5879,7 @@ var helpdeskWebhooksApi = {
|
|
|
5782
5879
|
get(webhookId, authorization) {
|
|
5783
5880
|
return __async(this, null, function* () {
|
|
5784
5881
|
const response = yield helpdeskClientInstance.get(
|
|
5785
|
-
`/webhooks/${encodeURIComponent(webhookId)}`,
|
|
5882
|
+
`/v1/webhooks/${encodeURIComponent(webhookId)}`,
|
|
5786
5883
|
getHelpDeskClientConfig(authorization)
|
|
5787
5884
|
);
|
|
5788
5885
|
return response;
|
|
@@ -5791,7 +5888,7 @@ var helpdeskWebhooksApi = {
|
|
|
5791
5888
|
create(payload, authorization) {
|
|
5792
5889
|
return __async(this, null, function* () {
|
|
5793
5890
|
const response = yield helpdeskClientInstance.post(
|
|
5794
|
-
"/webhooks",
|
|
5891
|
+
"/v1/webhooks",
|
|
5795
5892
|
payload,
|
|
5796
5893
|
getHelpDeskClientConfig(authorization)
|
|
5797
5894
|
);
|
|
@@ -5801,7 +5898,7 @@ var helpdeskWebhooksApi = {
|
|
|
5801
5898
|
update(webhookId, payload, authorization) {
|
|
5802
5899
|
return __async(this, null, function* () {
|
|
5803
5900
|
const response = yield helpdeskClientInstance.patch(
|
|
5804
|
-
`/webhooks/${encodeURIComponent(webhookId)}`,
|
|
5901
|
+
`/v1/webhooks/${encodeURIComponent(webhookId)}`,
|
|
5805
5902
|
payload,
|
|
5806
5903
|
getHelpDeskClientConfig(authorization)
|
|
5807
5904
|
);
|
|
@@ -5811,7 +5908,7 @@ var helpdeskWebhooksApi = {
|
|
|
5811
5908
|
delete(webhookId, authorization) {
|
|
5812
5909
|
return __async(this, null, function* () {
|
|
5813
5910
|
const response = yield helpdeskClientInstance.delete(
|
|
5814
|
-
`/webhooks/${encodeURIComponent(webhookId)}`,
|
|
5911
|
+
`/v1/webhooks/${encodeURIComponent(webhookId)}`,
|
|
5815
5912
|
getHelpDeskClientConfig(authorization)
|
|
5816
5913
|
);
|
|
5817
5914
|
return response;
|
|
@@ -8099,11 +8196,36 @@ var platformAdapterTextApi = {
|
|
|
8099
8196
|
}
|
|
8100
8197
|
};
|
|
8101
8198
|
|
|
8199
|
+
// src/apis/platform/adapter/integrations/slack/api.ts
|
|
8200
|
+
var platformAdapterSlackApi = {
|
|
8201
|
+
events: {
|
|
8202
|
+
subscribe(payload, authorization) {
|
|
8203
|
+
return __async(this, null, function* () {
|
|
8204
|
+
yield adapterClientInstance.post(
|
|
8205
|
+
"/integrations/slack/events/subscribe",
|
|
8206
|
+
payload,
|
|
8207
|
+
getSlackClientConfig(authorization)
|
|
8208
|
+
);
|
|
8209
|
+
});
|
|
8210
|
+
},
|
|
8211
|
+
unsubscribe(payload, authorization) {
|
|
8212
|
+
return __async(this, null, function* () {
|
|
8213
|
+
yield adapterClientInstance.post(
|
|
8214
|
+
"/integrations/slack/events/unsubscribe",
|
|
8215
|
+
payload,
|
|
8216
|
+
getSlackClientConfig(authorization)
|
|
8217
|
+
);
|
|
8218
|
+
});
|
|
8219
|
+
}
|
|
8220
|
+
}
|
|
8221
|
+
};
|
|
8222
|
+
|
|
8102
8223
|
// src/apis/platform/adapter/integrations/api.ts
|
|
8103
8224
|
var platformAdapterIntegrationsApi = {
|
|
8104
8225
|
mailchimp: platformAdapterMailchimpApi,
|
|
8105
8226
|
shopify: platformAdapterShopifyApi,
|
|
8106
8227
|
hubspot: platformAdapterHubspotApi,
|
|
8228
|
+
slack: platformAdapterSlackApi,
|
|
8107
8229
|
bigcommerce: platformAdapterBigCommerceApi,
|
|
8108
8230
|
text: platformAdapterTextApi
|
|
8109
8231
|
};
|
|
@@ -8345,6 +8467,8 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
|
|
|
8345
8467
|
ShopifyApiError,
|
|
8346
8468
|
ShopifyEventNames,
|
|
8347
8469
|
SlackApiError,
|
|
8470
|
+
SlackEventNames,
|
|
8471
|
+
SlackEventTypes,
|
|
8348
8472
|
TextApiError,
|
|
8349
8473
|
TextHelpDeskEventNames,
|
|
8350
8474
|
TextLivechatEventNames,
|
|
@@ -8425,6 +8549,7 @@ function getIntegrationFlowUrl(name, flow, trigger, context, state, config) {
|
|
|
8425
8549
|
shopifyClientInstance,
|
|
8426
8550
|
shopifyEventsZods,
|
|
8427
8551
|
slackClientInstance,
|
|
8552
|
+
slackEventsZods,
|
|
8428
8553
|
textClientInstance,
|
|
8429
8554
|
textHelpDeskEventsZods,
|
|
8430
8555
|
textLivechatEventsZods,
|
package/dist/index.mjs
CHANGED
|
@@ -1939,6 +1939,12 @@ function updateBigCommerceClient(token, shop) {
|
|
|
1939
1939
|
}
|
|
1940
1940
|
}
|
|
1941
1941
|
|
|
1942
|
+
// src/apis/integrations/slack/_contracts/webhooks/dtos/webhooks.ts
|
|
1943
|
+
var SlackEventTypes = /* @__PURE__ */ ((SlackEventTypes2) => {
|
|
1944
|
+
SlackEventTypes2["MessagePosted"] = "message";
|
|
1945
|
+
return SlackEventTypes2;
|
|
1946
|
+
})(SlackEventTypes || {});
|
|
1947
|
+
|
|
1942
1948
|
// src/apis/integrations/slack/instance.ts
|
|
1943
1949
|
import axios14 from "axios";
|
|
1944
1950
|
var SlackApiError = class extends ApiErrorBase {
|
|
@@ -1954,7 +1960,16 @@ var slackClientInstance = axios14.create({
|
|
|
1954
1960
|
}
|
|
1955
1961
|
});
|
|
1956
1962
|
slackClientInstance.interceptors.response.use(
|
|
1957
|
-
(r) =>
|
|
1963
|
+
(r) => {
|
|
1964
|
+
if (!r.data.ok) {
|
|
1965
|
+
throw new SlackApiError(
|
|
1966
|
+
`Slack API Error ${r.data.error}`,
|
|
1967
|
+
r.data,
|
|
1968
|
+
r.status
|
|
1969
|
+
);
|
|
1970
|
+
}
|
|
1971
|
+
return r;
|
|
1972
|
+
},
|
|
1958
1973
|
(error) => {
|
|
1959
1974
|
var _a, _b, _c, _d;
|
|
1960
1975
|
if (axios14.isAxiosError(error)) {
|
|
@@ -2115,7 +2130,7 @@ var IntegrationDisplayNames = /* @__PURE__ */ ((IntegrationDisplayNames2) => {
|
|
|
2115
2130
|
})(IntegrationDisplayNames || {});
|
|
2116
2131
|
|
|
2117
2132
|
// src/apis/platform/adapter/integrations/_contracts/requests/events.ts
|
|
2118
|
-
import { z as
|
|
2133
|
+
import { z as z8 } from "zod";
|
|
2119
2134
|
|
|
2120
2135
|
// src/apis/platform/adapter/integrations/shopify/_contracts/requests/events.ts
|
|
2121
2136
|
import { z } from "zod";
|
|
@@ -2321,7 +2336,9 @@ var textLivechatEventsZods = {
|
|
|
2321
2336
|
get unsubscribe() {
|
|
2322
2337
|
return this.source.and(
|
|
2323
2338
|
z3.object({
|
|
2324
|
-
event:
|
|
2339
|
+
event: z3.object({
|
|
2340
|
+
name: this.eventName
|
|
2341
|
+
})
|
|
2325
2342
|
})
|
|
2326
2343
|
);
|
|
2327
2344
|
},
|
|
@@ -2411,7 +2428,9 @@ var textHelpDeskEventsZods = {
|
|
|
2411
2428
|
get unsubscribe() {
|
|
2412
2429
|
return this.source.and(
|
|
2413
2430
|
z4.object({
|
|
2414
|
-
event:
|
|
2431
|
+
event: z4.object({
|
|
2432
|
+
name: this.eventName
|
|
2433
|
+
})
|
|
2415
2434
|
})
|
|
2416
2435
|
);
|
|
2417
2436
|
},
|
|
@@ -2471,7 +2490,9 @@ var hubspotEventsZods = {
|
|
|
2471
2490
|
get unsubscribe() {
|
|
2472
2491
|
return this.source.and(
|
|
2473
2492
|
z5.object({
|
|
2474
|
-
event:
|
|
2493
|
+
event: z5.object({
|
|
2494
|
+
name: this.eventName
|
|
2495
|
+
})
|
|
2475
2496
|
})
|
|
2476
2497
|
);
|
|
2477
2498
|
},
|
|
@@ -2551,7 +2572,9 @@ var bigcommerceEventsZods = {
|
|
|
2551
2572
|
get unsubscribe() {
|
|
2552
2573
|
return this.source.and(
|
|
2553
2574
|
z6.object({
|
|
2554
|
-
event:
|
|
2575
|
+
event: z6.object({
|
|
2576
|
+
name: this.eventName
|
|
2577
|
+
})
|
|
2555
2578
|
})
|
|
2556
2579
|
);
|
|
2557
2580
|
},
|
|
@@ -2563,46 +2586,113 @@ var bigcommerceEventsZods = {
|
|
|
2563
2586
|
}
|
|
2564
2587
|
};
|
|
2565
2588
|
|
|
2589
|
+
// src/apis/platform/adapter/integrations/slack/_contracts/requests/events.ts
|
|
2590
|
+
import { z as z7 } from "zod";
|
|
2591
|
+
var SlackEventNames = /* @__PURE__ */ ((SlackEventNames2) => {
|
|
2592
|
+
SlackEventNames2["ChannelNewMessagePosted"] = "channel_new_message_posted";
|
|
2593
|
+
SlackEventNames2["MemberNewMention"] = "member_new_mention";
|
|
2594
|
+
return SlackEventNames2;
|
|
2595
|
+
})(SlackEventNames || {});
|
|
2596
|
+
var slackEventsZods = {
|
|
2597
|
+
provider: z7.literal("slack" /* Slack */),
|
|
2598
|
+
eventName: z7.nativeEnum(SlackEventNames),
|
|
2599
|
+
events: {
|
|
2600
|
+
channelNewMessagePosted: z7.object({
|
|
2601
|
+
name: z7.literal("channel_new_message_posted" /* ChannelNewMessagePosted */),
|
|
2602
|
+
channelId: z7.string()
|
|
2603
|
+
}),
|
|
2604
|
+
memberNewMention: z7.object({
|
|
2605
|
+
name: z7.literal("member_new_mention" /* MemberNewMention */),
|
|
2606
|
+
userId: z7.string()
|
|
2607
|
+
})
|
|
2608
|
+
},
|
|
2609
|
+
get event() {
|
|
2610
|
+
return z7.discriminatedUnion("name", [
|
|
2611
|
+
this.events.channelNewMessagePosted,
|
|
2612
|
+
this.events.memberNewMention
|
|
2613
|
+
]);
|
|
2614
|
+
},
|
|
2615
|
+
get source() {
|
|
2616
|
+
return z7.object({
|
|
2617
|
+
sourceName: z7.enum(["apps", "workflows"]),
|
|
2618
|
+
sourceKey: z7.string()
|
|
2619
|
+
});
|
|
2620
|
+
},
|
|
2621
|
+
get subscribe() {
|
|
2622
|
+
return this.source.and(
|
|
2623
|
+
z7.object({
|
|
2624
|
+
event: this.event,
|
|
2625
|
+
callback: z7.string()
|
|
2626
|
+
})
|
|
2627
|
+
);
|
|
2628
|
+
},
|
|
2629
|
+
get subscribeContent() {
|
|
2630
|
+
return z7.object({
|
|
2631
|
+
provider: this.provider,
|
|
2632
|
+
event: this.event,
|
|
2633
|
+
callback: z7.string()
|
|
2634
|
+
});
|
|
2635
|
+
},
|
|
2636
|
+
get unsubscribe() {
|
|
2637
|
+
return this.source.and(
|
|
2638
|
+
z7.object({
|
|
2639
|
+
event: z7.object({
|
|
2640
|
+
name: this.eventName
|
|
2641
|
+
})
|
|
2642
|
+
})
|
|
2643
|
+
);
|
|
2644
|
+
},
|
|
2645
|
+
get unsubscribeContent() {
|
|
2646
|
+
return z7.object({
|
|
2647
|
+
provider: this.provider,
|
|
2648
|
+
event: this.event
|
|
2649
|
+
});
|
|
2650
|
+
}
|
|
2651
|
+
};
|
|
2652
|
+
|
|
2566
2653
|
// src/apis/platform/adapter/integrations/_contracts/requests/events.ts
|
|
2567
2654
|
var integrationEventsZods = {
|
|
2568
|
-
sourceName:
|
|
2569
|
-
providerName:
|
|
2655
|
+
sourceName: z8.enum(["apps", "workflows"]),
|
|
2656
|
+
providerName: z8.enum([
|
|
2570
2657
|
"text-livechat" /* LiveChat */,
|
|
2571
2658
|
"text-helpdesk" /* HelpDesk */,
|
|
2572
2659
|
"mailchimp" /* Mailchimp */,
|
|
2573
2660
|
"shopify" /* Shopify */,
|
|
2574
2661
|
"hubspot" /* HubSpot */,
|
|
2662
|
+
"slack" /* Slack */,
|
|
2575
2663
|
"bigcommerce" /* BigCommerce */
|
|
2576
2664
|
]),
|
|
2577
2665
|
get event() {
|
|
2578
|
-
return textLivechatEventsZods.event.or(textHelpDeskEventsZods.event).or(shopifyEventsZods.event).or(mailchimpEventsZods.event).or(hubspotEventsZods.event).or(bigcommerceEventsZods.event);
|
|
2666
|
+
return textLivechatEventsZods.event.or(textHelpDeskEventsZods.event).or(shopifyEventsZods.event).or(mailchimpEventsZods.event).or(hubspotEventsZods.event).or(bigcommerceEventsZods.event).or(slackEventsZods.event);
|
|
2579
2667
|
},
|
|
2580
2668
|
get source() {
|
|
2581
|
-
return
|
|
2669
|
+
return z8.object({
|
|
2582
2670
|
sourceName: this.sourceName,
|
|
2583
|
-
sourceKey:
|
|
2671
|
+
sourceKey: z8.string()
|
|
2584
2672
|
});
|
|
2585
2673
|
},
|
|
2586
2674
|
get subscribe() {
|
|
2587
2675
|
return this.source.and(
|
|
2588
|
-
|
|
2676
|
+
z8.discriminatedUnion("provider", [
|
|
2589
2677
|
textLivechatEventsZods.subscribeContent,
|
|
2590
2678
|
textHelpDeskEventsZods.subscribeContent,
|
|
2591
2679
|
shopifyEventsZods.subscribeContent,
|
|
2592
2680
|
mailchimpEventsZods.subscribeContent,
|
|
2593
2681
|
hubspotEventsZods.subscribeContent,
|
|
2682
|
+
slackEventsZods.subscribeContent,
|
|
2594
2683
|
bigcommerceEventsZods.subscribeContent
|
|
2595
2684
|
])
|
|
2596
2685
|
);
|
|
2597
2686
|
},
|
|
2598
2687
|
get unsubscribe() {
|
|
2599
2688
|
return this.source.and(
|
|
2600
|
-
|
|
2689
|
+
z8.discriminatedUnion("provider", [
|
|
2601
2690
|
textLivechatEventsZods.unsubscribeContent,
|
|
2602
2691
|
textHelpDeskEventsZods.unsubscribeContent,
|
|
2603
2692
|
shopifyEventsZods.unsubscribeContent,
|
|
2604
2693
|
mailchimpEventsZods.unsubscribeContent,
|
|
2605
2694
|
hubspotEventsZods.unsubscribeContent,
|
|
2695
|
+
slackEventsZods.unsubscribeContent,
|
|
2606
2696
|
bigcommerceEventsZods.unsubscribeContent
|
|
2607
2697
|
])
|
|
2608
2698
|
);
|
|
@@ -2950,7 +3040,7 @@ var HelpDeskApiError = class extends ApiErrorBase {
|
|
|
2950
3040
|
}
|
|
2951
3041
|
};
|
|
2952
3042
|
var helpdeskClientInstance = axios18.create({
|
|
2953
|
-
baseURL: "https://api.labs.helpdesk.com
|
|
3043
|
+
baseURL: "https://api.labs.helpdesk.com"
|
|
2954
3044
|
});
|
|
2955
3045
|
helpdeskClientInstance.interceptors.response.use(
|
|
2956
3046
|
(response) => response,
|
|
@@ -4790,9 +4880,13 @@ var slackApi = {
|
|
|
4790
4880
|
};
|
|
4791
4881
|
});
|
|
4792
4882
|
},
|
|
4793
|
-
|
|
4883
|
+
getUserTokenInfo(token) {
|
|
4794
4884
|
return __async(this, null, function* () {
|
|
4795
|
-
const { data: tokenInfo } = yield slackClientInstance.get(
|
|
4885
|
+
const { data: tokenInfo } = yield slackClientInstance.get("/auth.test", {
|
|
4886
|
+
headers: {
|
|
4887
|
+
Authorization: `Bearer ${token}`
|
|
4888
|
+
}
|
|
4889
|
+
});
|
|
4796
4890
|
return tokenInfo;
|
|
4797
4891
|
});
|
|
4798
4892
|
}
|
|
@@ -5620,7 +5714,7 @@ var helpdeskWebhooksApi = {
|
|
|
5620
5714
|
list(authorization) {
|
|
5621
5715
|
return __async(this, null, function* () {
|
|
5622
5716
|
const response = yield helpdeskClientInstance.get(
|
|
5623
|
-
"/webhooks",
|
|
5717
|
+
"/v1/webhooks",
|
|
5624
5718
|
getHelpDeskClientConfig(authorization)
|
|
5625
5719
|
);
|
|
5626
5720
|
return response;
|
|
@@ -5629,7 +5723,7 @@ var helpdeskWebhooksApi = {
|
|
|
5629
5723
|
get(webhookId, authorization) {
|
|
5630
5724
|
return __async(this, null, function* () {
|
|
5631
5725
|
const response = yield helpdeskClientInstance.get(
|
|
5632
|
-
`/webhooks/${encodeURIComponent(webhookId)}`,
|
|
5726
|
+
`/v1/webhooks/${encodeURIComponent(webhookId)}`,
|
|
5633
5727
|
getHelpDeskClientConfig(authorization)
|
|
5634
5728
|
);
|
|
5635
5729
|
return response;
|
|
@@ -5638,7 +5732,7 @@ var helpdeskWebhooksApi = {
|
|
|
5638
5732
|
create(payload, authorization) {
|
|
5639
5733
|
return __async(this, null, function* () {
|
|
5640
5734
|
const response = yield helpdeskClientInstance.post(
|
|
5641
|
-
"/webhooks",
|
|
5735
|
+
"/v1/webhooks",
|
|
5642
5736
|
payload,
|
|
5643
5737
|
getHelpDeskClientConfig(authorization)
|
|
5644
5738
|
);
|
|
@@ -5648,7 +5742,7 @@ var helpdeskWebhooksApi = {
|
|
|
5648
5742
|
update(webhookId, payload, authorization) {
|
|
5649
5743
|
return __async(this, null, function* () {
|
|
5650
5744
|
const response = yield helpdeskClientInstance.patch(
|
|
5651
|
-
`/webhooks/${encodeURIComponent(webhookId)}`,
|
|
5745
|
+
`/v1/webhooks/${encodeURIComponent(webhookId)}`,
|
|
5652
5746
|
payload,
|
|
5653
5747
|
getHelpDeskClientConfig(authorization)
|
|
5654
5748
|
);
|
|
@@ -5658,7 +5752,7 @@ var helpdeskWebhooksApi = {
|
|
|
5658
5752
|
delete(webhookId, authorization) {
|
|
5659
5753
|
return __async(this, null, function* () {
|
|
5660
5754
|
const response = yield helpdeskClientInstance.delete(
|
|
5661
|
-
`/webhooks/${encodeURIComponent(webhookId)}`,
|
|
5755
|
+
`/v1/webhooks/${encodeURIComponent(webhookId)}`,
|
|
5662
5756
|
getHelpDeskClientConfig(authorization)
|
|
5663
5757
|
);
|
|
5664
5758
|
return response;
|
|
@@ -7946,11 +8040,36 @@ var platformAdapterTextApi = {
|
|
|
7946
8040
|
}
|
|
7947
8041
|
};
|
|
7948
8042
|
|
|
8043
|
+
// src/apis/platform/adapter/integrations/slack/api.ts
|
|
8044
|
+
var platformAdapterSlackApi = {
|
|
8045
|
+
events: {
|
|
8046
|
+
subscribe(payload, authorization) {
|
|
8047
|
+
return __async(this, null, function* () {
|
|
8048
|
+
yield adapterClientInstance.post(
|
|
8049
|
+
"/integrations/slack/events/subscribe",
|
|
8050
|
+
payload,
|
|
8051
|
+
getSlackClientConfig(authorization)
|
|
8052
|
+
);
|
|
8053
|
+
});
|
|
8054
|
+
},
|
|
8055
|
+
unsubscribe(payload, authorization) {
|
|
8056
|
+
return __async(this, null, function* () {
|
|
8057
|
+
yield adapterClientInstance.post(
|
|
8058
|
+
"/integrations/slack/events/unsubscribe",
|
|
8059
|
+
payload,
|
|
8060
|
+
getSlackClientConfig(authorization)
|
|
8061
|
+
);
|
|
8062
|
+
});
|
|
8063
|
+
}
|
|
8064
|
+
}
|
|
8065
|
+
};
|
|
8066
|
+
|
|
7949
8067
|
// src/apis/platform/adapter/integrations/api.ts
|
|
7950
8068
|
var platformAdapterIntegrationsApi = {
|
|
7951
8069
|
mailchimp: platformAdapterMailchimpApi,
|
|
7952
8070
|
shopify: platformAdapterShopifyApi,
|
|
7953
8071
|
hubspot: platformAdapterHubspotApi,
|
|
8072
|
+
slack: platformAdapterSlackApi,
|
|
7954
8073
|
bigcommerce: platformAdapterBigCommerceApi,
|
|
7955
8074
|
text: platformAdapterTextApi
|
|
7956
8075
|
};
|
|
@@ -8191,6 +8310,8 @@ export {
|
|
|
8191
8310
|
ShopifyApiError,
|
|
8192
8311
|
ShopifyEventNames,
|
|
8193
8312
|
SlackApiError,
|
|
8313
|
+
SlackEventNames,
|
|
8314
|
+
SlackEventTypes,
|
|
8194
8315
|
TextApiError,
|
|
8195
8316
|
TextHelpDeskEventNames,
|
|
8196
8317
|
TextLivechatEventNames,
|
|
@@ -8271,6 +8392,7 @@ export {
|
|
|
8271
8392
|
shopifyClientInstance,
|
|
8272
8393
|
shopifyEventsZods,
|
|
8273
8394
|
slackClientInstance,
|
|
8395
|
+
slackEventsZods,
|
|
8274
8396
|
textClientInstance,
|
|
8275
8397
|
textHelpDeskEventsZods,
|
|
8276
8398
|
textLivechatEventsZods,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livechat/developer-studio-api",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.22",
|
|
4
4
|
"description": "This project is API for LiveChat Developer Studio.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"@types/node": "^17.0.12",
|
|
21
21
|
"tsup": "^7.1.0",
|
|
22
22
|
"typescript": "^5.1.6",
|
|
23
|
+
"eslint-config-custom": "0.0.10",
|
|
23
24
|
"tsconfig": "0.0.1",
|
|
24
|
-
"utils": "0.0.
|
|
25
|
-
"eslint-config-custom": "0.0.10"
|
|
25
|
+
"utils": "0.0.6"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsup",
|