Skip to content

Commit

Permalink
remove temp region field
Browse files Browse the repository at this point in the history
  • Loading branch information
popestr committed Jul 1, 2024
1 parent 3fc7243 commit 5699ebe
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 26 deletions.
8 changes: 5 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/chat-core-aws-connect/THIRD-PARTY-NOTICES
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The following NPM package may be included in this product:

- @yext/chat-core@0.8.1
- @yext/chat-core@0.8.2

This package contains the following license and notice below:

Expand Down
2 changes: 1 addition & 1 deletion packages/chat-core-aws-connect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@
"dotenv": "^16.4.5"
},
"peerDependencies": {
"@yext/chat-core": "^0.8.1"
"@yext/chat-core": "^0.8.2"
}
}
23 changes: 3 additions & 20 deletions packages/chat-core-aws-connect/src/infra/ChatCoreAwsConnectImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,6 @@ import { EventMap, EventCallback } from "../models/EventCallback";
import { LoggerConfig } from "../models/LoggerConfig";
import "amazon-connect-chatjs";

// TODO: Remove this type once the region is added to the MessageResponse type in chat-core
type MessageResponseWithRegion = MessageResponse & {
integrationDetails: {
awsConnectHandoff: {
credentials: {
accessKeyId: string;
secretAccessKey: string;
sessionToken: string;
};
region: string;
};
};
};

/**
* The primary class for the chat-core integration with AWS Connect.
*
Expand All @@ -43,11 +29,8 @@ export class ChatCoreAwsConnectImpl implements ChatCoreAwsConnect {
return;
}

// TODO: Remove this type once the region is added to the MessageResponse type in chat-core
const messageResponse = messageRsp as MessageResponseWithRegion;

const connectionCreds =
messageResponse.integrationDetails?.awsConnectHandoff?.credentials;
messageRsp.integrationDetails?.awsConnectHandoff?.credentials;
if (!connectionCreds) {
throw new Error(
"Integration credentials not specified. Cannot initialize chat session."
Expand All @@ -60,7 +43,7 @@ export class ChatCoreAwsConnectImpl implements ChatCoreAwsConnect {
useDefaultLogger: this.loggerConfig.customizedLogger ? false : true,
customizedLogger: this.loggerConfig.customizedLogger,
},
region: messageResponse.integrationDetails.awsConnectHandoff.region,
region: messageRsp.integrationDetails?.awsConnectHandoff?.region,
});

this.session = connect.ChatSession.create({
Expand All @@ -78,7 +61,7 @@ export class ChatCoreAwsConnectImpl implements ChatCoreAwsConnect {
this.setupEventListeners();
this.session.sendMessage({
contentType: "text/plain",
message: messageResponse.notes["conversationSummary"],
message: messageRsp.notes.conversationSummary,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"serve": "^14.2.0"
},
"dependencies": {
"@yext/chat-core": "^0.8.1",
"@yext/chat-core": "^0.8.2",
"@yext/chat-core-aws-connect": "file:..",
"dotenv": "^16.0.3"
},
Expand Down

0 comments on commit 5699ebe

Please sign in to comment.