From 348f0fc6b9feae4a0f467a352d5a7dd764ef5e5f Mon Sep 17 00:00:00 2001 From: Yen Truong Date: Tue, 25 Jun 2024 16:17:16 -0400 Subject: [PATCH] support integrationDetails and conversationSummary field --- package-lock.json | 2 +- ...at-core.awsconnectcredentials.contactid.md | 13 +++++++++ .../docs/chat-core.awsconnectcredentials.md | 22 +++++++++++++++ ...ore.awsconnectcredentials.participantid.md | 13 +++++++++ ....awsconnectcredentials.participanttoken.md | 18 ++++++++++++ ...chat-core.awsconnecthandoff.credentials.md | 13 +++++++++ .../docs/chat-core.awsconnecthandoff.md | 20 +++++++++++++ ...re.integrationdetails.awsconnecthandoff.md | 13 +++++++++ .../docs/chat-core.integrationdetails.md | 24 ++++++++++++++++ packages/chat-core/docs/chat-core.md | 3 ++ ...t-core.messagenotes.conversationsummary.md | 13 +++++++++ .../chat-core/docs/chat-core.messagenotes.md | 1 + ...core.messageresponse.integrationdetails.md | 18 ++++++++++++ .../docs/chat-core.messageresponse.md | 1 + packages/chat-core/etc/chat-core.api.md | 19 +++++++++++++ packages/chat-core/package.json | 2 +- packages/chat-core/src/infra/ChatCoreImpl.ts | 1 + .../src/models/endpoints/MessageNotes.ts | 2 ++ .../src/models/endpoints/MessageResponse.ts | 3 ++ packages/chat-core/src/models/index.ts | 7 +++++ .../src/models/integrations/AwsConnect.ts | 28 +++++++++++++++++++ .../models/integrations/IntegrationDetails.ts | 14 ++++++++++ .../test-browser-esm/package-lock.json | 4 +-- .../chat-core/test-node-cjs/package-lock.json | 4 +-- packages/chat-core/tests/ChatCore.test.ts | 10 +++++++ 25 files changed, 262 insertions(+), 6 deletions(-) create mode 100644 packages/chat-core/docs/chat-core.awsconnectcredentials.contactid.md create mode 100644 packages/chat-core/docs/chat-core.awsconnectcredentials.md create mode 100644 packages/chat-core/docs/chat-core.awsconnectcredentials.participantid.md create mode 100644 packages/chat-core/docs/chat-core.awsconnectcredentials.participanttoken.md create mode 100644 packages/chat-core/docs/chat-core.awsconnecthandoff.credentials.md create mode 100644 packages/chat-core/docs/chat-core.awsconnecthandoff.md create mode 100644 packages/chat-core/docs/chat-core.integrationdetails.awsconnecthandoff.md create mode 100644 packages/chat-core/docs/chat-core.integrationdetails.md create mode 100644 packages/chat-core/docs/chat-core.messagenotes.conversationsummary.md create mode 100644 packages/chat-core/docs/chat-core.messageresponse.integrationdetails.md create mode 100644 packages/chat-core/src/models/integrations/AwsConnect.ts create mode 100644 packages/chat-core/src/models/integrations/IntegrationDetails.ts diff --git a/package-lock.json b/package-lock.json index 9174ecc..bce6016 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10210,7 +10210,7 @@ }, "packages/chat-core": { "name": "@yext/chat-core", - "version": "0.8.0", + "version": "0.8.1", "license": "BSD-3-Clause", "dependencies": { "cross-fetch": "^3.1.5" diff --git a/packages/chat-core/docs/chat-core.awsconnectcredentials.contactid.md b/packages/chat-core/docs/chat-core.awsconnectcredentials.contactid.md new file mode 100644 index 0000000..e1ae9ce --- /dev/null +++ b/packages/chat-core/docs/chat-core.awsconnectcredentials.contactid.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core](./chat-core.md) > [AwsConnectCredentials](./chat-core.awsconnectcredentials.md) > [contactId](./chat-core.awsconnectcredentials.contactid.md) + +## AwsConnectCredentials.contactId property + +The identifier of an AWS chat session. + +**Signature:** + +```typescript +contactId: string; +``` diff --git a/packages/chat-core/docs/chat-core.awsconnectcredentials.md b/packages/chat-core/docs/chat-core.awsconnectcredentials.md new file mode 100644 index 0000000..633e141 --- /dev/null +++ b/packages/chat-core/docs/chat-core.awsconnectcredentials.md @@ -0,0 +1,22 @@ + + +[Home](./index.md) > [@yext/chat-core](./chat-core.md) > [AwsConnectCredentials](./chat-core.awsconnectcredentials.md) + +## AwsConnectCredentials interface + +AWS Connect handoff credentials. + +**Signature:** + +```typescript +export interface AwsConnectCredentials +``` + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [contactId](./chat-core.awsconnectcredentials.contactid.md) | | string | The identifier of an AWS chat session. | +| [participantId](./chat-core.awsconnectcredentials.participantid.md) | | string | The identifier for a chat participant in AWS Connect. | +| [participantToken](./chat-core.awsconnectcredentials.participanttoken.md) | | string | The token used by the chat participant create connection. | + diff --git a/packages/chat-core/docs/chat-core.awsconnectcredentials.participantid.md b/packages/chat-core/docs/chat-core.awsconnectcredentials.participantid.md new file mode 100644 index 0000000..e7a51ba --- /dev/null +++ b/packages/chat-core/docs/chat-core.awsconnectcredentials.participantid.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core](./chat-core.md) > [AwsConnectCredentials](./chat-core.awsconnectcredentials.md) > [participantId](./chat-core.awsconnectcredentials.participantid.md) + +## AwsConnectCredentials.participantId property + +The identifier for a chat participant in AWS Connect. + +**Signature:** + +```typescript +participantId: string; +``` diff --git a/packages/chat-core/docs/chat-core.awsconnectcredentials.participanttoken.md b/packages/chat-core/docs/chat-core.awsconnectcredentials.participanttoken.md new file mode 100644 index 0000000..06ec9b5 --- /dev/null +++ b/packages/chat-core/docs/chat-core.awsconnectcredentials.participanttoken.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [@yext/chat-core](./chat-core.md) > [AwsConnectCredentials](./chat-core.awsconnectcredentials.md) > [participantToken](./chat-core.awsconnectcredentials.participanttoken.md) + +## AwsConnectCredentials.participantToken property + +The token used by the chat participant create connection. + +**Signature:** + +```typescript +participantToken: string; +``` + +## Remarks + +The participant token is valid for the lifetime of a chat participant. + diff --git a/packages/chat-core/docs/chat-core.awsconnecthandoff.credentials.md b/packages/chat-core/docs/chat-core.awsconnecthandoff.credentials.md new file mode 100644 index 0000000..e3d1b70 --- /dev/null +++ b/packages/chat-core/docs/chat-core.awsconnecthandoff.credentials.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core](./chat-core.md) > [AwsConnectHandoff](./chat-core.awsconnecthandoff.md) > [credentials](./chat-core.awsconnecthandoff.credentials.md) + +## AwsConnectHandoff.credentials property + +AWS Connect handoff credentials. + +**Signature:** + +```typescript +credentials: AwsConnectCredentials; +``` diff --git a/packages/chat-core/docs/chat-core.awsconnecthandoff.md b/packages/chat-core/docs/chat-core.awsconnecthandoff.md new file mode 100644 index 0000000..e10ebb6 --- /dev/null +++ b/packages/chat-core/docs/chat-core.awsconnecthandoff.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [@yext/chat-core](./chat-core.md) > [AwsConnectHandoff](./chat-core.awsconnecthandoff.md) + +## AwsConnectHandoff interface + +Configurations for AWS Connect handoff. + +**Signature:** + +```typescript +export interface AwsConnectHandoff +``` + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [credentials](./chat-core.awsconnecthandoff.credentials.md) | | [AwsConnectCredentials](./chat-core.awsconnectcredentials.md) | AWS Connect handoff credentials. | + diff --git a/packages/chat-core/docs/chat-core.integrationdetails.awsconnecthandoff.md b/packages/chat-core/docs/chat-core.integrationdetails.awsconnecthandoff.md new file mode 100644 index 0000000..59aaaf1 --- /dev/null +++ b/packages/chat-core/docs/chat-core.integrationdetails.awsconnecthandoff.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core](./chat-core.md) > [IntegrationDetails](./chat-core.integrationdetails.md) > [awsConnectHandoff](./chat-core.integrationdetails.awsconnecthandoff.md) + +## IntegrationDetails.awsConnectHandoff property + +Configurations for AWS Connect handoff. + +**Signature:** + +```typescript +awsConnectHandoff?: AwsConnectHandoff; +``` diff --git a/packages/chat-core/docs/chat-core.integrationdetails.md b/packages/chat-core/docs/chat-core.integrationdetails.md new file mode 100644 index 0000000..ff6e430 --- /dev/null +++ b/packages/chat-core/docs/chat-core.integrationdetails.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [@yext/chat-core](./chat-core.md) > [IntegrationDetails](./chat-core.integrationdetails.md) + +## IntegrationDetails interface + +Integration details for the current conversation. + +**Signature:** + +```typescript +export interface IntegrationDetails +``` + +## Remarks + +This is only present when the conversation is integrated with a third-party service, such as AWS Connect and Zendesk. + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [awsConnectHandoff?](./chat-core.integrationdetails.awsconnecthandoff.md) | | [AwsConnectHandoff](./chat-core.awsconnecthandoff.md) | _(Optional)_ Configurations for AWS Connect handoff. | + diff --git a/packages/chat-core/docs/chat-core.md b/packages/chat-core/docs/chat-core.md index 3732fb2..7371156 100644 --- a/packages/chat-core/docs/chat-core.md +++ b/packages/chat-core/docs/chat-core.md @@ -30,10 +30,13 @@ | Interface | Description | | --- | --- | +| [AwsConnectCredentials](./chat-core.awsconnectcredentials.md) | AWS Connect handoff credentials. | +| [AwsConnectHandoff](./chat-core.awsconnecthandoff.md) | Configurations for AWS Connect handoff. | | [ChatConfig](./chat-core.chatconfig.md) | The configuration options for [ChatCore](./chat-core.chatcore.md). | | [ChatCore](./chat-core.chatcore.md) | Provide methods for interacting with Chat API. | | [EndEvent](./chat-core.endevent.md) | An event that indicates end of Chat stream. | | [Endpoints](./chat-core.endpoints.md) | The URLs which are used when making requests to the Chat API. | +| [IntegrationDetails](./chat-core.integrationdetails.md) | Integration details for the current conversation. | | [Message](./chat-core.message.md) | Represents a message within a conversation. | | [MessageNotes](./chat-core.messagenotes.md) | Information relevant to the current state of the conversation, serving as the bot’s "memory" regarding what work it previously did to help determine future actions. | | [MessageRequest](./chat-core.messagerequest.md) | A request to Chat API. | diff --git a/packages/chat-core/docs/chat-core.messagenotes.conversationsummary.md b/packages/chat-core/docs/chat-core.messagenotes.conversationsummary.md new file mode 100644 index 0000000..4197295 --- /dev/null +++ b/packages/chat-core/docs/chat-core.messagenotes.conversationsummary.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core](./chat-core.md) > [MessageNotes](./chat-core.messagenotes.md) > [conversationSummary](./chat-core.messagenotes.conversationsummary.md) + +## MessageNotes.conversationSummary property + +The summary of the conversation up to this point. + +**Signature:** + +```typescript +conversationSummary?: string; +``` diff --git a/packages/chat-core/docs/chat-core.messagenotes.md b/packages/chat-core/docs/chat-core.messagenotes.md index b50f2fb..ad8e4cd 100644 --- a/packages/chat-core/docs/chat-core.messagenotes.md +++ b/packages/chat-core/docs/chat-core.messagenotes.md @@ -21,6 +21,7 @@ This data will come from the API. As such, a user’s first request may have thi | Property | Modifiers | Type | Description | | --- | --- | --- | --- | | [collectedData?](./chat-core.messagenotes.collecteddata.md) | | Record<string, unknown> | _(Optional)_ Data collected from user in a conversation. | +| [conversationSummary?](./chat-core.messagenotes.conversationsummary.md) | | string | _(Optional)_ The summary of the conversation up to this point. | | [currentGoal?](./chat-core.messagenotes.currentgoal.md) | | string | _(Optional)_ The goal of the latest message. | | [currentStepIndices?](./chat-core.messagenotes.currentstepindices.md) | | number\[\] | _(Optional)_ The indices to traversed within the nested instruction array to access the target step. | | [goalFirstMsgIndex?](./chat-core.messagenotes.goalfirstmsgindex.md) | | number | _(Optional)_ The index of the message that started the current goal. | diff --git a/packages/chat-core/docs/chat-core.messageresponse.integrationdetails.md b/packages/chat-core/docs/chat-core.messageresponse.integrationdetails.md new file mode 100644 index 0000000..bc55a38 --- /dev/null +++ b/packages/chat-core/docs/chat-core.messageresponse.integrationdetails.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [@yext/chat-core](./chat-core.md) > [MessageResponse](./chat-core.messageresponse.md) > [integrationDetails](./chat-core.messageresponse.integrationdetails.md) + +## MessageResponse.integrationDetails property + +Integration details for the current conversation. + +**Signature:** + +```typescript +integrationDetails?: IntegrationDetails; +``` + +## Remarks + +This is only present when the conversation is integrated with a third-party service, such as AWS Connect and Zendesk. + diff --git a/packages/chat-core/docs/chat-core.messageresponse.md b/packages/chat-core/docs/chat-core.messageresponse.md index 6cdd390..f4ff3cc 100644 --- a/packages/chat-core/docs/chat-core.messageresponse.md +++ b/packages/chat-core/docs/chat-core.messageresponse.md @@ -17,6 +17,7 @@ export interface MessageResponse | Property | Modifiers | Type | Description | | --- | --- | --- | --- | | [conversationId?](./chat-core.messageresponse.conversationid.md) | | string | _(Optional)_ The id corresponds to the current conversation. | +| [integrationDetails?](./chat-core.messageresponse.integrationdetails.md) | | [IntegrationDetails](./chat-core.integrationdetails.md) | _(Optional)_ Integration details for the current conversation. | | [message](./chat-core.messageresponse.message.md) | | [Message](./chat-core.message.md) | The generated reply to the latest message in the request. | | [notes](./chat-core.messageresponse.notes.md) | | [MessageNotes](./chat-core.messagenotes.md) | Information relevant to the current state of the conversation, serving as the bot’s "memory" regarding what work it previously did to help determine future actions. | diff --git a/packages/chat-core/etc/chat-core.api.md b/packages/chat-core/etc/chat-core.api.md index c88e91b..aa3f103 100644 --- a/packages/chat-core/etc/chat-core.api.md +++ b/packages/chat-core/etc/chat-core.api.md @@ -16,6 +16,18 @@ export class ApiError extends Error { type?: string; } +// @public +export interface AwsConnectCredentials { + contactId: string; + participantId: string; + participantToken: string; +} + +// @public +export interface AwsConnectHandoff { + credentials: AwsConnectCredentials; +} + // @public export interface ChatConfig { apiKey: string; @@ -61,6 +73,11 @@ export enum Environment { SANDBOX = "SANDBOX" } +// @public +export interface IntegrationDetails { + awsConnectHandoff?: AwsConnectHandoff; +} + // Warning: (ae-internal-missing-underscore) The name "InternalConfig" should be prefixed with an underscore because the declaration is marked as @internal // // @internal @@ -79,6 +96,7 @@ export interface Message { // @public export interface MessageNotes { collectedData?: Record; + conversationSummary?: string; currentGoal?: string; currentStepIndices?: number[]; goalFirstMsgIndex?: number; @@ -98,6 +116,7 @@ export interface MessageRequest { // @public export interface MessageResponse { conversationId?: string; + integrationDetails?: IntegrationDetails; message: Message; notes: MessageNotes; } diff --git a/packages/chat-core/package.json b/packages/chat-core/package.json index f774f67..bb8ee86 100644 --- a/packages/chat-core/package.json +++ b/packages/chat-core/package.json @@ -1,6 +1,6 @@ { "name": "@yext/chat-core", - "version": "0.8.0", + "version": "0.8.1", "description": "Typescript Networking Library for the Yext Chat API", "main": "./dist/commonjs/index.js", "module": "./dist/esm/index.mjs", diff --git a/packages/chat-core/src/infra/ChatCoreImpl.ts b/packages/chat-core/src/infra/ChatCoreImpl.ts index e77cc2a..706a225 100644 --- a/packages/chat-core/src/infra/ChatCoreImpl.ts +++ b/packages/chat-core/src/infra/ChatCoreImpl.ts @@ -71,6 +71,7 @@ export class ChatCoreImpl implements ChatCore { conversationId: data.response.conversationId, message: data.response.message, notes: data.response.notes, + integrationDetails: data.response.integrationDetails, }; } diff --git a/packages/chat-core/src/models/endpoints/MessageNotes.ts b/packages/chat-core/src/models/endpoints/MessageNotes.ts index a55e4a3..23351d1 100644 --- a/packages/chat-core/src/models/endpoints/MessageNotes.ts +++ b/packages/chat-core/src/models/endpoints/MessageNotes.ts @@ -23,4 +23,6 @@ export interface MessageNotes { goalFirstMsgIndex?: number; /** A set of pre-generated replies given by the AI. */ suggestedReplies?: string[]; + /** The summary of the conversation up to this point. */ + conversationSummary?: string; } diff --git a/packages/chat-core/src/models/endpoints/MessageResponse.ts b/packages/chat-core/src/models/endpoints/MessageResponse.ts index c5665cd..289c595 100644 --- a/packages/chat-core/src/models/endpoints/MessageResponse.ts +++ b/packages/chat-core/src/models/endpoints/MessageResponse.ts @@ -1,3 +1,4 @@ +import { IntegrationDetails } from "../integrations/IntegrationDetails"; import { Message } from "./Message"; import { MessageNotes } from "./MessageNotes"; @@ -18,4 +19,6 @@ export interface MessageResponse { message: Message; /** {@inheritDoc MessageNotes} */ notes: MessageNotes; + /** {@inheritdoc IntegrationDetails} */ + integrationDetails?: IntegrationDetails; } diff --git a/packages/chat-core/src/models/index.ts b/packages/chat-core/src/models/index.ts index 5057768..0821325 100644 --- a/packages/chat-core/src/models/index.ts +++ b/packages/chat-core/src/models/index.ts @@ -24,3 +24,10 @@ export { ApiError } from "./http/ApiError"; export { StreamEventCallback } from "./endpoints/stream/StreamEventCallback"; export { EnumOrLiteral } from "./utils/EnumOrLiteral"; + +export { IntegrationDetails } from "./integrations/IntegrationDetails"; + +export { + AwsConnectHandoff, + AwsConnectCredentials, +} from "./integrations/AwsConnect"; diff --git a/packages/chat-core/src/models/integrations/AwsConnect.ts b/packages/chat-core/src/models/integrations/AwsConnect.ts new file mode 100644 index 0000000..5ecacad --- /dev/null +++ b/packages/chat-core/src/models/integrations/AwsConnect.ts @@ -0,0 +1,28 @@ +/** + * Configurations for AWS Connect handoff. + * + * @public + */ +export interface AwsConnectHandoff { + /** {@inheritdoc AwsConnectCredentials} */ + credentials: AwsConnectCredentials; +} + +/** + * AWS Connect handoff credentials. + * + * @public + */ +export interface AwsConnectCredentials { + /** The identifier of an AWS chat session. */ + contactId: string; + /** The identifier for a chat participant in AWS Connect. */ + participantId: string; + /** + * The token used by the chat participant create connection. + * + * @remarks + * The participant token is valid for the lifetime of a chat participant. + */ + participantToken: string; +} diff --git a/packages/chat-core/src/models/integrations/IntegrationDetails.ts b/packages/chat-core/src/models/integrations/IntegrationDetails.ts new file mode 100644 index 0000000..28712c6 --- /dev/null +++ b/packages/chat-core/src/models/integrations/IntegrationDetails.ts @@ -0,0 +1,14 @@ +import { AwsConnectHandoff } from "./AwsConnect"; + +/** + * Integration details for the current conversation. + * + * @public + * + * @remarks + * This is only present when the conversation is integrated with a third-party service, such as AWS Connect and Zendesk. + */ +export interface IntegrationDetails { + /** {@inheritdoc AwsConnectHandoff} */ + awsConnectHandoff?: AwsConnectHandoff; +} diff --git a/packages/chat-core/test-browser-esm/package-lock.json b/packages/chat-core/test-browser-esm/package-lock.json index 28ef5b4..ba750bb 100644 --- a/packages/chat-core/test-browser-esm/package-lock.json +++ b/packages/chat-core/test-browser-esm/package-lock.json @@ -21,7 +21,7 @@ }, "..": { "name": "@yext/chat-core", - "version": "0.7.4", + "version": "0.8.1", "license": "BSD-3-Clause", "dependencies": { "cross-fetch": "^3.1.5" @@ -36,7 +36,7 @@ "@yext/eslint-config": "^1.0.0", "babel-jest": "^29.5.0", "eslint": "^8.39.0", - "generate-license-file": "^2.0.0", + "generate-license-file": "^1.0.0", "jest": "^29.5.0", "jest-environment-jsdom": "^29.5.0", "prettier": "^2.8.8", diff --git a/packages/chat-core/test-node-cjs/package-lock.json b/packages/chat-core/test-node-cjs/package-lock.json index 9fe0872..8bf50e1 100644 --- a/packages/chat-core/test-node-cjs/package-lock.json +++ b/packages/chat-core/test-node-cjs/package-lock.json @@ -19,7 +19,7 @@ }, "..": { "name": "@yext/chat-core", - "version": "0.7.4", + "version": "0.8.1", "license": "BSD-3-Clause", "dependencies": { "cross-fetch": "^3.1.5" @@ -34,7 +34,7 @@ "@yext/eslint-config": "^1.0.0", "babel-jest": "^29.5.0", "eslint": "^8.39.0", - "generate-license-file": "^2.0.0", + "generate-license-file": "^1.0.0", "jest": "^29.5.0", "jest-environment-jsdom": "^29.5.0", "prettier": "^2.8.8", diff --git a/packages/chat-core/tests/ChatCore.test.ts b/packages/chat-core/tests/ChatCore.test.ts index ae3fefd..05d460e 100644 --- a/packages/chat-core/tests/ChatCore.test.ts +++ b/packages/chat-core/tests/ChatCore.test.ts @@ -45,6 +45,16 @@ it("returns message response on successful API response", async () => { }, notes: { currentGoal: "test!", + conversationSummary: "convo summary", + }, + integrationDetails: { + awsConnectHandoff: { + credentials: { + contactId: "contact-id", + participantId: "participant-id", + participantToken: "participant-token", + }, + }, }, }; mockHttpPost({