Skip to content

Commit 6bcbecb

Browse files
author
Spencer Lepine
authored
add ChatDuration support to examples (#92)
1 parent 7a98c27 commit 6bcbecb

11 files changed

+41
-16
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
## [1.3.3] - 2023-2-21
7+
### Changed
8+
- Custom Chat Widget - Support Custom Chat Duration
9+
- cloudformationTemplates - startChatContactAPI - Support Custom Chat Duration
10+
- Customize total chat duration of a newly started chat session. [Learn more](https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html#connect-StartChatContact-request-ChatDurationInMinutes)
11+
612
## [1.3.2] - 2023-2-10
713
### Changed
814
- Mark `asyncCustomerChatUX` approach as deprecated.
Binary file not shown.

cloudformationTemplates/startChatContactAPI/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -431,4 +431,18 @@ connect.ChatInterface.initiateChat({
431431
},
432432
...
433433
}, successHandler, failureHandler);
434+
```
435+
436+
## Custom chat duration
437+
438+
Learn more about chat duration: https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html#connect-StartChatContact-request-ChatDurationInMinutes
439+
440+
You can set custom chat duration in [`widgetIndex.html`](https://github.com/amazon-connect/amazon-connect-chat-ui-examples/blob/master/cloudformationTemplates/startChatContactAPI/widgetIndex.html).
441+
442+
```
443+
connect.ChatInterface.initiateChat({
444+
...
445+
chatDurationInMinutes: 1500, // min 60, max 10080 - default 1500 (25 hours)
446+
...
447+
}, successHandler, failureHandler);
434448
```

cloudformationTemplates/startChatContactAPI/customBuildIndex.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ <h1>Amazon Connect - Custom Implementation of Customer Chat</h1>
9898
ContactFlowId: contactFlowId,
9999
InstanceId: instanceId,
100100
// Enable rich messaging support: https://docs.aws.amazon.com/connect/latest/adminguide/enable-text-formatting-chat.html
101-
SupportedMessagingContentTypes: ["text/plain", "text/markdown"] // include 'text/markdown'
101+
SupportedMessagingContentTypes: ["text/plain", "text/markdown"], // include 'text/markdown',
102+
// Set optional chat duration: https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html#connect-StartChatContact-request-ChatDurationInMinutes
103+
ChatDurationInMinutes: 1500, // min 60, max 10080 - default 1500 (25 hours)
102104
};
103105

104106
$.ajax({

cloudformationTemplates/startChatContactAPI/js/amazon-connect-chat-interface.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cloudformationTemplates/startChatContactAPI/js/startChatContact.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ function startChatContact(body) {
3737
"DisplayName": body["ParticipantDetails"]["DisplayName"]
3838
},
3939
// Enable rich messaging: https://docs.aws.amazon.com/connect/latest/adminguide/enable-text-formatting-chat.html
40-
...(!!body["SupportedMessagingContentTypes"] && { "SupportedMessagingContentTypes": body["SupportedMessagingContentTypes"] })
40+
...(!!body["SupportedMessagingContentTypes"] && { "SupportedMessagingContentTypes": body["SupportedMessagingContentTypes"] }),
41+
// Set optional chat duration: https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html#connect-StartChatContact-request-ChatDurationInMinutes
42+
...(!!body["ChatDurationInMinutes"] && { "ChatDurationInMinutes": body["ChatDurationInMinutes"] })
4143
};
4244
const persistentChatEnabled = body.PersistentChat && body.PersistentChat.RehydrationType && body.PersistentChat.SourceContactId;
4345
if(persistentChatEnabled) {

cloudformationTemplates/startChatContactAPI/widgetIndex.html

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ <h1>Amazon Connect - Custom Implementation of Customer Chat</h1>
8888
"ATTACHMENTS": enableAttachments, // this is the override flag from user for attachments
8989
"MESSAGING_MARKDOWN": true // enable rich messaging toolbar and text formatting
9090
},
91+
// Set optional chat duration: https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html#connect-StartChatContact-request-ChatDurationInMinutes
92+
chatDurationInMinutes: 1500, // min 60, max 10080 - default 1500 (25 hours)
9193
supportedMessagingContentTypes: "text/plain,text/markdown", // include 'text/markdown' for rich messaging support
9294
// Learn more about persistent chat: https://docs.aws.amazon.com/connect/latest/adminguide/chat-persistence.html
9395
persistentChat: {

customChatWidget/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ Below steps explain how Custom Chat Widget works on a web page
139139
sampleKey1: 'sampleValue1',
140140
sampleKey2: 'sampleValue2',
141141
},
142+
// Set optional chat duration: https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html#connect-StartChatContact-request-ChatDurationInMinutes
143+
chatDurationInMinutes: 1500, // min 60, max 10080 - default 1500 (25 hours)
142144
preChatForm: {
143145
visible: true,
144146
inputFields: [

customChatWidget/public/amazon-connect-chat-interface.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

customChatWidget/public/amazon-connect-chat-interface.js.LICENSE.txt

+7-12
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ object-assign
1818
* @license MIT
1919
*/
2020

21+
/*!
22+
* repeat-string <https://github.com/jonschlinkert/repeat-string>
23+
*
24+
* Copyright (c) 2014-2015, Jon Schlinkert.
25+
* Licensed under the MIT License.
26+
*/
27+
2128
/*! *****************************************************************************
2229
Copyright (c) Microsoft Corporation. All rights reserved.
2330
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
@@ -37,18 +44,6 @@ and limitations under the License.
3744

3845
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
3946

40-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
41-
42-
/**
43-
* @license React
44-
* react-is.production.min.js
45-
*
46-
* Copyright (c) Facebook, Inc. and its affiliates.
47-
*
48-
* This source code is licensed under the MIT license found in the
49-
* LICENSE file in the root directory of this source tree.
50-
*/
51-
5247
/** @license React v0.19.1
5348
* scheduler.production.min.js
5449
*

customChatWidget/public/index.html

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
contactAttr: {
2727
SomeContactAttributeKey: "SomeContactAttributeValue",
2828
},
29+
// Set optional chat duration: https://docs.aws.amazon.com/connect/latest/APIReference/API_StartChatContact.html#connect-StartChatContact-request-ChatDurationInMinutes
30+
chatDurationInMinutes: 1500, // min 60, max 10080 - default 1500 (25 hours)
2931
preChatForm: {
3032
visible: true,
3133
inputFields: [{

0 commit comments

Comments
 (0)