@livechat/developer-studio-api 3.1.0 → 3.1.2
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 +1182 -190
- package/dist/index.d.ts +1182 -190
- package/dist/index.js +207 -76
- package/dist/index.mjs +201 -73
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1318,17 +1318,15 @@ import axios6 from "axios";
|
|
|
1318
1318
|
var textClientInstance = axios6.create({
|
|
1319
1319
|
baseURL: "https://api.labs.text.com"
|
|
1320
1320
|
});
|
|
1321
|
-
function getTextClientAuthorization(req
|
|
1321
|
+
function getTextClientAuthorization(req) {
|
|
1322
1322
|
if (req.headers instanceof Headers) {
|
|
1323
1323
|
return {
|
|
1324
|
-
token: req.headers.get(
|
|
1325
|
-
useIntegration ? "x-adapter-text-token" : "x-adapter-platform-token"
|
|
1326
|
-
),
|
|
1324
|
+
token: req.headers.get("x-adapter-text-token"),
|
|
1327
1325
|
tokenType: "Bearer"
|
|
1328
1326
|
};
|
|
1329
1327
|
}
|
|
1330
1328
|
return {
|
|
1331
|
-
token: req.headers[
|
|
1329
|
+
token: req.headers["x-adapter-text-token"],
|
|
1332
1330
|
tokenType: "Bearer"
|
|
1333
1331
|
};
|
|
1334
1332
|
}
|
|
@@ -6051,25 +6049,23 @@ function initPlatformBillingClient(baseUrl, token) {
|
|
|
6051
6049
|
import { z as z4 } from "zod";
|
|
6052
6050
|
|
|
6053
6051
|
// src/apis/platform/adapter/integrations/shopify/_contracts/dtos/events.ts
|
|
6054
|
-
var
|
|
6055
|
-
|
|
6056
|
-
return
|
|
6057
|
-
})(
|
|
6052
|
+
var ShopifyEventNames = /* @__PURE__ */ ((ShopifyEventNames2) => {
|
|
6053
|
+
ShopifyEventNames2["OrderCreated"] = "order_created";
|
|
6054
|
+
return ShopifyEventNames2;
|
|
6055
|
+
})(ShopifyEventNames || {});
|
|
6058
6056
|
|
|
6059
6057
|
// src/apis/platform/adapter/integrations/shopify/_contracts/requests/events.ts
|
|
6060
6058
|
import { z } from "zod";
|
|
6061
6059
|
var shopifyEventsZods = {
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6060
|
+
provider: z.literal("shopify"),
|
|
6061
|
+
eventName: z.nativeEnum(ShopifyEventNames),
|
|
6062
|
+
events: {
|
|
6063
|
+
orderCreated: z.object({
|
|
6064
|
+
name: z.literal("order_created" /* OrderCreated */)
|
|
6065
|
+
})
|
|
6067
6066
|
},
|
|
6068
|
-
get
|
|
6069
|
-
return z.
|
|
6070
|
-
provider: z.literal("shopify"),
|
|
6071
|
-
event: this.event
|
|
6072
|
-
});
|
|
6067
|
+
get event() {
|
|
6068
|
+
return z.discriminatedUnion("name", [this.events.orderCreated]);
|
|
6073
6069
|
},
|
|
6074
6070
|
get source() {
|
|
6075
6071
|
return z.object({
|
|
@@ -6078,14 +6074,32 @@ var shopifyEventsZods = {
|
|
|
6078
6074
|
});
|
|
6079
6075
|
},
|
|
6080
6076
|
get subscribe() {
|
|
6081
|
-
return this.source.and(
|
|
6077
|
+
return this.source.and(
|
|
6082
6078
|
z.object({
|
|
6079
|
+
event: this.event,
|
|
6083
6080
|
callback: z.string()
|
|
6084
6081
|
})
|
|
6085
6082
|
);
|
|
6086
6083
|
},
|
|
6084
|
+
get subscribeContent() {
|
|
6085
|
+
return z.object({
|
|
6086
|
+
provider: this.provider,
|
|
6087
|
+
event: this.event,
|
|
6088
|
+
callback: z.string()
|
|
6089
|
+
});
|
|
6090
|
+
},
|
|
6087
6091
|
get unsubscribe() {
|
|
6088
|
-
return this.source.and(
|
|
6092
|
+
return this.source.and(
|
|
6093
|
+
z.object({
|
|
6094
|
+
event: this.eventName
|
|
6095
|
+
})
|
|
6096
|
+
);
|
|
6097
|
+
},
|
|
6098
|
+
get unsubscribeContent() {
|
|
6099
|
+
return z.object({
|
|
6100
|
+
provider: this.provider,
|
|
6101
|
+
event: this.eventName
|
|
6102
|
+
});
|
|
6089
6103
|
}
|
|
6090
6104
|
};
|
|
6091
6105
|
|
|
@@ -6093,27 +6107,29 @@ var shopifyEventsZods = {
|
|
|
6093
6107
|
import { z as z2 } from "zod";
|
|
6094
6108
|
|
|
6095
6109
|
// src/apis/platform/adapter/integrations/mailchimp/_contracts/dtos/events.ts
|
|
6096
|
-
var
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
return
|
|
6100
|
-
})(
|
|
6110
|
+
var MailchimpEventNames = /* @__PURE__ */ ((MailchimpEventNames2) => {
|
|
6111
|
+
MailchimpEventNames2["Subscribed"] = "subscribed";
|
|
6112
|
+
MailchimpEventNames2["Unsubscribed"] = "unsubscribed";
|
|
6113
|
+
return MailchimpEventNames2;
|
|
6114
|
+
})(MailchimpEventNames || {});
|
|
6101
6115
|
|
|
6102
6116
|
// src/apis/platform/adapter/integrations/mailchimp/_contracts/requests/events.ts
|
|
6103
6117
|
var mailchimpEventsZods = {
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
})
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6118
|
+
provider: z2.literal("mailchimp"),
|
|
6119
|
+
eventName: z2.nativeEnum(MailchimpEventNames),
|
|
6120
|
+
events: {
|
|
6121
|
+
subscribed: z2.object({
|
|
6122
|
+
name: z2.literal("subscribed" /* Subscribed */)
|
|
6123
|
+
}),
|
|
6124
|
+
unsubscribed: z2.object({
|
|
6125
|
+
name: z2.literal("unsubscribed" /* Unsubscribed */)
|
|
6126
|
+
})
|
|
6127
|
+
},
|
|
6128
|
+
get event() {
|
|
6129
|
+
return z2.discriminatedUnion("name", [
|
|
6130
|
+
this.events.subscribed,
|
|
6131
|
+
this.events.unsubscribed
|
|
6132
|
+
]);
|
|
6117
6133
|
},
|
|
6118
6134
|
get source() {
|
|
6119
6135
|
return z2.object({
|
|
@@ -6122,39 +6138,100 @@ var mailchimpEventsZods = {
|
|
|
6122
6138
|
});
|
|
6123
6139
|
},
|
|
6124
6140
|
get subscribe() {
|
|
6125
|
-
return this.source.and(
|
|
6141
|
+
return this.source.and(
|
|
6126
6142
|
z2.object({
|
|
6143
|
+
event: this.event,
|
|
6144
|
+
listId: z2.string(),
|
|
6127
6145
|
callback: z2.string()
|
|
6128
6146
|
})
|
|
6129
6147
|
);
|
|
6130
6148
|
},
|
|
6149
|
+
get subscribeContent() {
|
|
6150
|
+
return z2.object({
|
|
6151
|
+
provider: this.provider,
|
|
6152
|
+
event: this.event,
|
|
6153
|
+
callback: z2.string(),
|
|
6154
|
+
listId: z2.string()
|
|
6155
|
+
});
|
|
6156
|
+
},
|
|
6131
6157
|
get unsubscribe() {
|
|
6132
|
-
return this.source.and(
|
|
6158
|
+
return this.source.and(
|
|
6159
|
+
z2.object({
|
|
6160
|
+
event: this.eventName,
|
|
6161
|
+
listId: z2.string()
|
|
6162
|
+
})
|
|
6163
|
+
);
|
|
6164
|
+
},
|
|
6165
|
+
get unsubscribeContent() {
|
|
6166
|
+
return z2.object({
|
|
6167
|
+
provider: this.provider,
|
|
6168
|
+
event: this.eventName,
|
|
6169
|
+
listId: z2.string()
|
|
6170
|
+
});
|
|
6133
6171
|
}
|
|
6134
6172
|
};
|
|
6135
6173
|
|
|
6136
6174
|
// src/apis/platform/adapter/integrations/text/_contracts/dtos/events.ts
|
|
6137
|
-
var
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6175
|
+
var TextLivechatEventNames = /* @__PURE__ */ ((TextLivechatEventNames2) => {
|
|
6176
|
+
TextLivechatEventNames2["ChatStarted"] = "chat_started";
|
|
6177
|
+
TextLivechatEventNames2["ChatEnded"] = "chat_ended";
|
|
6178
|
+
TextLivechatEventNames2["ChatTransferred"] = "chat_transferred";
|
|
6179
|
+
TextLivechatEventNames2["ChatRated"] = "chat_rated";
|
|
6180
|
+
TextLivechatEventNames2["ChatCommented"] = "chat_commented";
|
|
6181
|
+
TextLivechatEventNames2["ChatMessage"] = "chat_message";
|
|
6182
|
+
TextLivechatEventNames2["UserAddedToChat"] = "user_added_to_chat";
|
|
6183
|
+
TextLivechatEventNames2["UserRemovedFromChat"] = "user_removed_from_chat";
|
|
6184
|
+
return TextLivechatEventNames2;
|
|
6185
|
+
})(TextLivechatEventNames || {});
|
|
6143
6186
|
|
|
6144
6187
|
// src/apis/platform/adapter/integrations/text/_contracts/requests/events.ts
|
|
6145
6188
|
import { z as z3 } from "zod";
|
|
6146
6189
|
var textLivechatEventsZods = {
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6190
|
+
provider: z3.literal("text-livechat"),
|
|
6191
|
+
eventName: z3.nativeEnum(TextLivechatEventNames),
|
|
6192
|
+
events: {
|
|
6193
|
+
chatStarted: z3.object({
|
|
6194
|
+
name: z3.literal("chat_started" /* ChatStarted */)
|
|
6195
|
+
}),
|
|
6196
|
+
chatEnded: z3.object({
|
|
6197
|
+
name: z3.literal("chat_ended" /* ChatEnded */)
|
|
6198
|
+
}),
|
|
6199
|
+
chatTransferred: z3.object({
|
|
6200
|
+
name: z3.literal("chat_transferred" /* ChatTransferred */)
|
|
6201
|
+
}),
|
|
6202
|
+
chatRated: z3.object({
|
|
6203
|
+
name: z3.literal("chat_rated" /* ChatRated */)
|
|
6204
|
+
}),
|
|
6205
|
+
chatCommented: z3.object({
|
|
6206
|
+
name: z3.literal("chat_commented" /* ChatCommented */)
|
|
6207
|
+
}),
|
|
6208
|
+
chatMessage: z3.object({
|
|
6209
|
+
name: z3.literal("chat_message" /* ChatMessage */),
|
|
6210
|
+
params: z3.object({
|
|
6211
|
+
filter: z3.string().optional()
|
|
6212
|
+
}).optional()
|
|
6213
|
+
}),
|
|
6214
|
+
userAddedToChat: z3.object({
|
|
6215
|
+
name: z3.literal("user_added_to_chat" /* UserAddedToChat */),
|
|
6216
|
+
params: z3.object({
|
|
6217
|
+
userType: z3.enum(["agent", "customer"]).optional()
|
|
6218
|
+
}).optional()
|
|
6219
|
+
}),
|
|
6220
|
+
userRemovedFromChat: z3.object({
|
|
6221
|
+
name: z3.literal("user_removed_from_chat" /* UserRemovedFromChat */)
|
|
6222
|
+
})
|
|
6223
|
+
},
|
|
6224
|
+
get event() {
|
|
6225
|
+
return z3.discriminatedUnion("name", [
|
|
6226
|
+
this.events.chatStarted,
|
|
6227
|
+
this.events.chatEnded,
|
|
6228
|
+
this.events.chatTransferred,
|
|
6229
|
+
this.events.chatRated,
|
|
6230
|
+
this.events.chatCommented,
|
|
6231
|
+
this.events.chatMessage,
|
|
6232
|
+
this.events.userAddedToChat,
|
|
6233
|
+
this.events.userRemovedFromChat
|
|
6234
|
+
]);
|
|
6158
6235
|
},
|
|
6159
6236
|
get source() {
|
|
6160
6237
|
return z3.object({
|
|
@@ -6163,14 +6240,32 @@ var textLivechatEventsZods = {
|
|
|
6163
6240
|
});
|
|
6164
6241
|
},
|
|
6165
6242
|
get subscribe() {
|
|
6166
|
-
return this.source.and(
|
|
6243
|
+
return this.source.and(
|
|
6167
6244
|
z3.object({
|
|
6245
|
+
event: this.event,
|
|
6168
6246
|
callback: z3.string()
|
|
6169
6247
|
})
|
|
6170
6248
|
);
|
|
6171
6249
|
},
|
|
6250
|
+
get subscribeContent() {
|
|
6251
|
+
return z3.object({
|
|
6252
|
+
provider: this.provider,
|
|
6253
|
+
event: this.event,
|
|
6254
|
+
callback: z3.string()
|
|
6255
|
+
});
|
|
6256
|
+
},
|
|
6172
6257
|
get unsubscribe() {
|
|
6173
|
-
return this.source.and(
|
|
6258
|
+
return this.source.and(
|
|
6259
|
+
z3.object({
|
|
6260
|
+
event: this.eventName
|
|
6261
|
+
})
|
|
6262
|
+
);
|
|
6263
|
+
},
|
|
6264
|
+
get unsubscribeContent() {
|
|
6265
|
+
return z3.object({
|
|
6266
|
+
provider: this.provider,
|
|
6267
|
+
event: this.eventName
|
|
6268
|
+
});
|
|
6174
6269
|
}
|
|
6175
6270
|
};
|
|
6176
6271
|
|
|
@@ -6178,29 +6273,59 @@ var textLivechatEventsZods = {
|
|
|
6178
6273
|
var integrationEventsZods = {
|
|
6179
6274
|
sourceName: z4.enum(["apps", "workflows"]),
|
|
6180
6275
|
providerName: z4.enum(["text-livechat", "mailchimp", "shopify"]),
|
|
6276
|
+
get event() {
|
|
6277
|
+
return textLivechatEventsZods.event.or(shopifyEventsZods.event).or(mailchimpEventsZods.event);
|
|
6278
|
+
},
|
|
6181
6279
|
get source() {
|
|
6182
6280
|
return z4.object({
|
|
6183
6281
|
sourceName: this.sourceName,
|
|
6184
6282
|
sourceKey: z4.string()
|
|
6185
6283
|
});
|
|
6186
6284
|
},
|
|
6187
|
-
provider: z4.discriminatedUnion("provider", [
|
|
6188
|
-
textLivechatEventsZods.provider,
|
|
6189
|
-
mailchimpEventsZods.provider,
|
|
6190
|
-
shopifyEventsZods.provider
|
|
6191
|
-
]),
|
|
6192
6285
|
get subscribe() {
|
|
6193
|
-
return this.source.and(
|
|
6194
|
-
z4.
|
|
6195
|
-
|
|
6196
|
-
|
|
6286
|
+
return this.source.and(
|
|
6287
|
+
z4.discriminatedUnion("provider", [
|
|
6288
|
+
textLivechatEventsZods.subscribeContent,
|
|
6289
|
+
shopifyEventsZods.subscribeContent,
|
|
6290
|
+
mailchimpEventsZods.subscribeContent
|
|
6291
|
+
])
|
|
6197
6292
|
);
|
|
6198
6293
|
},
|
|
6199
6294
|
get unsubscribe() {
|
|
6200
|
-
return this.source.and(
|
|
6295
|
+
return this.source.and(
|
|
6296
|
+
z4.discriminatedUnion("provider", [
|
|
6297
|
+
textLivechatEventsZods.unsubscribeContent,
|
|
6298
|
+
shopifyEventsZods.unsubscribeContent,
|
|
6299
|
+
mailchimpEventsZods.unsubscribeContent
|
|
6300
|
+
])
|
|
6301
|
+
);
|
|
6201
6302
|
}
|
|
6202
6303
|
};
|
|
6203
6304
|
|
|
6305
|
+
// src/apis/products/livechat/configuration/webhooks/_contracts/dtos/webhook.ts
|
|
6306
|
+
var WebhookActions = /* @__PURE__ */ ((WebhookActions2) => {
|
|
6307
|
+
WebhookActions2["IncomingChat"] = "incoming_chat";
|
|
6308
|
+
WebhookActions2["ChatDeactivated"] = "chat_deactivated";
|
|
6309
|
+
WebhookActions2["ChatAccessUpdated"] = "chat_access_updated";
|
|
6310
|
+
WebhookActions2["ChatTransferred"] = "chat_transferred";
|
|
6311
|
+
WebhookActions2["UserAddedToChat"] = "user_added_to_chat";
|
|
6312
|
+
WebhookActions2["UserRemovedFromChat"] = "user_removed_from_chat";
|
|
6313
|
+
WebhookActions2["IncomingEvent"] = "incoming_event";
|
|
6314
|
+
WebhookActions2["IncomingCustomer"] = "incoming_customer";
|
|
6315
|
+
return WebhookActions2;
|
|
6316
|
+
})(WebhookActions || {});
|
|
6317
|
+
var WebhookEvents = /* @__PURE__ */ ((WebhookEvents2) => {
|
|
6318
|
+
WebhookEvents2["Message"] = "message";
|
|
6319
|
+
WebhookEvents2["SystemMessage"] = "system_message";
|
|
6320
|
+
WebhookEvents2["Custom"] = "custom";
|
|
6321
|
+
return WebhookEvents2;
|
|
6322
|
+
})(WebhookEvents || {});
|
|
6323
|
+
var WebhookSystemMessages = /* @__PURE__ */ ((WebhookSystemMessages2) => {
|
|
6324
|
+
WebhookSystemMessages2["ChatRated"] = "rating.chat_rated";
|
|
6325
|
+
WebhookSystemMessages2["ChatCommented"] = "rating.chat_commented";
|
|
6326
|
+
return WebhookSystemMessages2;
|
|
6327
|
+
})(WebhookSystemMessages || {});
|
|
6328
|
+
|
|
6204
6329
|
// src/apis/platform/adapter/integrations/mailchimp/api.ts
|
|
6205
6330
|
var platformAdapterMailchimpApi = {
|
|
6206
6331
|
events: {
|
|
@@ -6503,12 +6628,15 @@ export {
|
|
|
6503
6628
|
DpsApiError,
|
|
6504
6629
|
LivechatApiError,
|
|
6505
6630
|
MailchimpApiError,
|
|
6506
|
-
|
|
6631
|
+
MailchimpEventNames,
|
|
6507
6632
|
ShopifyApiError,
|
|
6508
|
-
|
|
6509
|
-
|
|
6633
|
+
ShopifyEventNames,
|
|
6634
|
+
TextLivechatEventNames,
|
|
6510
6635
|
UnauthorizeAccountsApiError,
|
|
6511
6636
|
UnauthorizeApiError,
|
|
6637
|
+
WebhookActions,
|
|
6638
|
+
WebhookEvents,
|
|
6639
|
+
WebhookSystemMessages,
|
|
6512
6640
|
WorkflowDefinitionTaskType,
|
|
6513
6641
|
allAppTemplates,
|
|
6514
6642
|
api,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livechat/developer-studio-api",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "This project is API for LiveChat Developer Studio.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"tsup": "^7.1.0",
|
|
22
22
|
"typescript": "^5.1.6",
|
|
23
23
|
"eslint-config-custom": "0.0.8",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"utils": "0.0.4",
|
|
25
|
+
"tsconfig": "0.0.1"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsup",
|