@livechat/developer-studio-api 5.11.1 → 5.12.0
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/{chunk-QGX7NFQO.mjs → chunk-XVLSQUPO.mjs} +83 -19
- package/dist/{events-Cbu2KbXk.d.mts → events-BdPlrYKo.d.mts} +2768 -305
- package/dist/{events-Cbu2KbXk.d.ts → events-BdPlrYKo.d.ts} +2768 -305
- package/dist/index.d.mts +31 -372
- package/dist/index.d.ts +31 -372
- package/dist/index.js +86 -19
- package/dist/index.mjs +7 -1
- package/dist/workflow-contracts.d.mts +1 -1
- package/dist/workflow-contracts.d.ts +1 -1
- package/dist/workflow-contracts.js +38 -19
- package/dist/workflow-contracts.mjs +1 -1
- package/package.json +3 -3
|
@@ -3199,6 +3199,14 @@ var slackApi = {
|
|
|
3199
3199
|
}
|
|
3200
3200
|
};
|
|
3201
3201
|
|
|
3202
|
+
// src/apis/integrations/text/ai-agent/contracts.ts
|
|
3203
|
+
var RegenerateIntentRejectionError = class extends ApiErrorBase {
|
|
3204
|
+
constructor() {
|
|
3205
|
+
super(...arguments);
|
|
3206
|
+
this.name = "text";
|
|
3207
|
+
}
|
|
3208
|
+
};
|
|
3209
|
+
|
|
3202
3210
|
// src/apis/integrations/text/ai-agent/api.ts
|
|
3203
3211
|
var textAiAgentApi = {
|
|
3204
3212
|
generateResponses(payload, authorization) {
|
|
@@ -3212,6 +3220,40 @@ var textAiAgentApi = {
|
|
|
3212
3220
|
);
|
|
3213
3221
|
return response;
|
|
3214
3222
|
});
|
|
3223
|
+
},
|
|
3224
|
+
regenerateIntent(payload, authorization) {
|
|
3225
|
+
return __async(this, null, function* () {
|
|
3226
|
+
const getRejection = (error) => {
|
|
3227
|
+
var _a;
|
|
3228
|
+
const isTextApiError = error instanceof TextApiError;
|
|
3229
|
+
if (!isTextApiError) {
|
|
3230
|
+
return void 0;
|
|
3231
|
+
}
|
|
3232
|
+
const data = error.data;
|
|
3233
|
+
const { message, suggestion } = (_a = data == null ? void 0 : data.innerError) != null ? _a : {};
|
|
3234
|
+
if (typeof message === "string" && typeof suggestion === "string") {
|
|
3235
|
+
return { message, suggestion };
|
|
3236
|
+
}
|
|
3237
|
+
return void 0;
|
|
3238
|
+
};
|
|
3239
|
+
return textClientInstance.post(
|
|
3240
|
+
"/nlp-gateway/v2/agents/skills/regenerate-intent",
|
|
3241
|
+
payload,
|
|
3242
|
+
getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
|
|
3243
|
+
ensureAuthorizationToken: true
|
|
3244
|
+
}))
|
|
3245
|
+
).then(({ data }) => data).catch((error) => {
|
|
3246
|
+
const rejection = getRejection(error);
|
|
3247
|
+
if (rejection) {
|
|
3248
|
+
throw new RegenerateIntentRejectionError(
|
|
3249
|
+
rejection.message,
|
|
3250
|
+
rejection,
|
|
3251
|
+
error.code
|
|
3252
|
+
);
|
|
3253
|
+
}
|
|
3254
|
+
throw error;
|
|
3255
|
+
});
|
|
3256
|
+
});
|
|
3215
3257
|
}
|
|
3216
3258
|
};
|
|
3217
3259
|
|
|
@@ -9283,7 +9325,7 @@ var textHelpDeskEventsZods = {
|
|
|
9283
9325
|
ticketMessageAdded: z13.discriminatedUnion("version", [
|
|
9284
9326
|
z13.object({
|
|
9285
9327
|
name: z13.literal("ticket_message_added" /* TicketMessageAdded */),
|
|
9286
|
-
version: z13.
|
|
9328
|
+
version: z13.literal("v0").optional()
|
|
9287
9329
|
}).extend(baseFiltersZod.shape),
|
|
9288
9330
|
z13.object({
|
|
9289
9331
|
name: z13.literal("ticket_message_added" /* TicketMessageAdded */),
|
|
@@ -9354,6 +9396,7 @@ var TextLivechatEventNames = /* @__PURE__ */ ((TextLivechatEventNames2) => {
|
|
|
9354
9396
|
TextLivechatEventNames2["CustomerLeftChat"] = "customer_left_chat";
|
|
9355
9397
|
TextLivechatEventNames2["ChatIdle"] = "chat_idle";
|
|
9356
9398
|
TextLivechatEventNames2["ProductCardEvent"] = "product_card_event";
|
|
9399
|
+
TextLivechatEventNames2["RichMessagePostback"] = "rich_message_postback";
|
|
9357
9400
|
TextLivechatEventNames2["FormFilled"] = "form_filled";
|
|
9358
9401
|
TextLivechatEventNames2["CustomFormFilled"] = "custom_form_filled";
|
|
9359
9402
|
return TextLivechatEventNames2;
|
|
@@ -9369,43 +9412,49 @@ var TextLivechatProductCardEventType = /* @__PURE__ */ ((TextLivechatProductCard
|
|
|
9369
9412
|
TextLivechatProductCardEventType2["AddToCart"] = "add_to_cart";
|
|
9370
9413
|
return TextLivechatProductCardEventType2;
|
|
9371
9414
|
})(TextLivechatProductCardEventType || {});
|
|
9415
|
+
var livechatChatContext = z14.object({
|
|
9416
|
+
chat_id: z14.string().min(1).optional(),
|
|
9417
|
+
thread_id: z14.string().min(1).optional()
|
|
9418
|
+
});
|
|
9419
|
+
var livechatEventContext = z14.object({
|
|
9420
|
+
event_id: z14.string().min(1).optional()
|
|
9421
|
+
});
|
|
9372
9422
|
var textLivechatEventsZods = {
|
|
9373
9423
|
provider: z14.literal("text-livechat" /* LiveChat */),
|
|
9374
9424
|
eventName: z14.nativeEnum(TextLivechatEventNames),
|
|
9375
9425
|
events: {
|
|
9376
|
-
chatStarted: integrationEventBase.extend({
|
|
9426
|
+
chatStarted: integrationEventBase.extend(livechatChatContext.shape).extend({
|
|
9377
9427
|
name: z14.literal("chat_started" /* ChatStarted */),
|
|
9378
9428
|
targetAgentId: z14.string().optional()
|
|
9379
9429
|
}),
|
|
9380
|
-
chatEnded: integrationEventBase.extend({
|
|
9430
|
+
chatEnded: integrationEventBase.extend(livechatChatContext.shape).extend({
|
|
9381
9431
|
name: z14.literal("chat_ended" /* ChatEnded */)
|
|
9382
9432
|
}),
|
|
9383
|
-
chatTransferred: integrationEventBase.extend({
|
|
9433
|
+
chatTransferred: integrationEventBase.extend(livechatChatContext.shape).extend({
|
|
9384
9434
|
name: z14.literal("chat_transferred" /* ChatTransferred */),
|
|
9385
9435
|
targetGroups: z14.array(z14.number()).optional(),
|
|
9386
9436
|
targetAgents: z14.array(z14.string()).optional()
|
|
9387
9437
|
}),
|
|
9388
|
-
chatTagged: integrationEventBase.extend({
|
|
9438
|
+
chatTagged: integrationEventBase.extend(livechatChatContext.shape).extend({
|
|
9389
9439
|
name: z14.literal("chat_tagged" /* ChatTagged */),
|
|
9390
|
-
tag: z14.string().optional()
|
|
9391
|
-
exact: z14.boolean().optional()
|
|
9440
|
+
tag: z14.string().optional()
|
|
9392
9441
|
}),
|
|
9393
|
-
chatRated: integrationEventBase.extend({
|
|
9442
|
+
chatRated: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
|
|
9394
9443
|
name: z14.literal("chat_rated" /* ChatRated */),
|
|
9395
9444
|
rating: z14.enum(["good", "bad", "all"]).optional()
|
|
9396
9445
|
}),
|
|
9397
|
-
chatCommented: integrationEventBase.extend({
|
|
9446
|
+
chatCommented: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
|
|
9398
9447
|
name: z14.literal("chat_commented" /* ChatCommented */)
|
|
9399
9448
|
}),
|
|
9400
9449
|
chatMessage: z14.discriminatedUnion("version", [
|
|
9401
|
-
|
|
9450
|
+
integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
|
|
9402
9451
|
name: z14.literal("chat_message" /* ChatMessage */),
|
|
9403
|
-
version: z14.
|
|
9452
|
+
version: z14.literal("v0").optional(),
|
|
9404
9453
|
filter: z14.string().optional(),
|
|
9405
9454
|
caseInsensitive: z14.boolean().optional(),
|
|
9406
9455
|
matchWholeWords: z14.boolean().optional()
|
|
9407
9456
|
}),
|
|
9408
|
-
|
|
9457
|
+
integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
|
|
9409
9458
|
name: z14.literal("chat_message" /* ChatMessage */),
|
|
9410
9459
|
version: z14.enum(["v1", "v2"]),
|
|
9411
9460
|
filters: z14.array(z14.string()),
|
|
@@ -9413,31 +9462,42 @@ var textLivechatEventsZods = {
|
|
|
9413
9462
|
matchWholeWords: z14.boolean().optional()
|
|
9414
9463
|
})
|
|
9415
9464
|
]),
|
|
9416
|
-
userAddedToChat: integrationEventBase.extend({
|
|
9465
|
+
userAddedToChat: integrationEventBase.extend(livechatChatContext.shape).extend({
|
|
9417
9466
|
name: z14.literal("user_added_to_chat" /* UserAddedToChat */),
|
|
9418
9467
|
userType: z14.enum(["agent", "customer"]).optional(),
|
|
9419
9468
|
targetAgentId: z14.string().optional()
|
|
9420
9469
|
}),
|
|
9421
|
-
userRemovedFromChat: integrationEventBase.extend({
|
|
9470
|
+
userRemovedFromChat: integrationEventBase.extend(livechatChatContext.shape).extend({
|
|
9422
9471
|
name: z14.literal("user_removed_from_chat" /* UserRemovedFromChat */)
|
|
9423
9472
|
}),
|
|
9424
|
-
customerLeftChat: integrationEventBase.extend({
|
|
9473
|
+
customerLeftChat: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
|
|
9425
9474
|
name: z14.literal("customer_left_chat" /* CustomerLeftChat */),
|
|
9426
9475
|
reasons: z14.array(z14.nativeEnum(CustomerLeftChatReason)).optional()
|
|
9427
9476
|
}),
|
|
9428
|
-
chatIdle: integrationEventBase.extend({
|
|
9477
|
+
chatIdle: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
|
|
9429
9478
|
name: z14.literal("chat_idle" /* ChatIdle */)
|
|
9430
9479
|
}),
|
|
9431
|
-
productCardEvent: integrationEventBase.extend({
|
|
9480
|
+
productCardEvent: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
|
|
9432
9481
|
name: z14.literal("product_card_event" /* ProductCardEvent */),
|
|
9433
9482
|
type: z14.nativeEnum(TextLivechatProductCardEventType),
|
|
9434
9483
|
product_id: z14.string().optional()
|
|
9435
9484
|
}),
|
|
9436
|
-
|
|
9485
|
+
richMessagePostback: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
|
|
9486
|
+
name: z14.literal("rich_message_postback" /* RichMessagePostback */),
|
|
9487
|
+
postbacks: z14.union([
|
|
9488
|
+
z14.array(z14.string().min(1)),
|
|
9489
|
+
z14.record(z14.string().min(1), z14.string().min(1))
|
|
9490
|
+
]).refine((input) => {
|
|
9491
|
+
const ids = Array.isArray(input) ? input : Object.values(input);
|
|
9492
|
+
return ids.length > 0 && new Set(ids).size === ids.length;
|
|
9493
|
+
}, "Postbacks must be nonempty and IDs must be unique"),
|
|
9494
|
+
user_ids: z14.array(z14.string().min(1)).min(1).optional()
|
|
9495
|
+
}),
|
|
9496
|
+
formFilled: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
|
|
9437
9497
|
name: z14.literal("form_filled" /* FormFilled */),
|
|
9438
9498
|
form_id: z14.string().optional()
|
|
9439
9499
|
}),
|
|
9440
|
-
customFormFilled: integrationEventBase.extend({
|
|
9500
|
+
customFormFilled: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
|
|
9441
9501
|
name: z14.literal("custom_form_filled" /* CustomFormFilled */),
|
|
9442
9502
|
form_id: z14.string().optional()
|
|
9443
9503
|
})
|
|
@@ -9456,6 +9516,7 @@ var textLivechatEventsZods = {
|
|
|
9456
9516
|
this.events.customerLeftChat,
|
|
9457
9517
|
this.events.chatIdle,
|
|
9458
9518
|
this.events.productCardEvent,
|
|
9519
|
+
this.events.richMessagePostback,
|
|
9459
9520
|
this.events.formFilled,
|
|
9460
9521
|
this.events.customFormFilled
|
|
9461
9522
|
]);
|
|
@@ -9868,6 +9929,8 @@ export {
|
|
|
9868
9929
|
TextLivechatEventNames,
|
|
9869
9930
|
CustomerLeftChatReason,
|
|
9870
9931
|
TextLivechatProductCardEventType,
|
|
9932
|
+
livechatChatContext,
|
|
9933
|
+
livechatEventContext,
|
|
9871
9934
|
textLivechatEventsZods,
|
|
9872
9935
|
textEventsZods,
|
|
9873
9936
|
integrationEventsZods,
|
|
@@ -9930,6 +9993,7 @@ export {
|
|
|
9930
9993
|
textClientInstance,
|
|
9931
9994
|
getTextClientConfig,
|
|
9932
9995
|
initTextClient,
|
|
9996
|
+
RegenerateIntentRejectionError,
|
|
9933
9997
|
TextBillingApiError,
|
|
9934
9998
|
UnauthorizeTextBillingApiError,
|
|
9935
9999
|
textBillingClientInstance,
|