

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# Amazon Connect 聊天小工具的其他自訂
<a name="pass-customization-object"></a>

您可以將下列選用的自訂新增至聊天使用者介面：
+ 在標頭下拉式功能表，顯示**結束聊天**按鈕，而不是在頁腳中。
+ 遮蓋或隱藏顯示名稱。
+ 新增訊息圖示。
+ 覆寫事件訊息。
+ 設定會在客戶選擇**結束聊天**按鈕時顯示的確認對話方塊。此對話方塊會確認客戶是否真的要結束聊天工作階段。您可以自訂確認對話方塊、標題、訊息和按鈕文字。
+ 覆寫附件拒絕訊息。
+ 在聊天標頭中顯示**最小化**按鈕。

## 設定自訂物件
<a name="configure-customization-object"></a>

此範例說明如何實作部分選用的自訂。如需所有可能自訂的清單，請參閱 [支援的選項和限制](#customization-options-constraints)。由於這些自訂是選用的，您可以實作下列範例中顯示的部分或所有欄位。視需要取代 `eventNames.customer`、`eventNames.agent`、`eventNames.supervisor`、`eventMessages.participantJoined`、`eventMessages.participantDisconnect`、`eventMessages.participantLeft`、`eventMessages.participantIdle`、`eventMessages.participantReturned` 和 `eventMessages.chatEnded` 字串。圖示必須在公共 URL 上受管。

```
amazon_connect('customizationObject', {
        header: { 
            dropdown: true, 
            dynamicHeader: true,
            minimizeChatHeaderButton: true,
        },
        transcript: { 
            hideDisplayNames: false, 
            eventNames: {
                customer: "{{User}}",
                agent: "{{Webchat Agent}}",
                supervisor: "{{Webchat Supervisor}}"
            },
            eventMessages: {
                participantJoined: "{name} has joined the chat",
                participantDisconnect: "",
                participantLeft: "{name} has dropped",
                participantIdle: "{name}, are you still there?",
                participantReturned: "",
                chatEnded: "Chat ended",
            },
            displayIcons: true,
            iconSources: { 
                botMessage: "{{imageURL}}",
                systemMessage: "{{imageURL}}",
                agentMessage: "{{imageURL}}",
                customerMessage: "{{imageURL}}",
            },
        },
        composer: {
            disableEmojiPicker: true,
            disableCustomerAttachments: true,
            alwaysHideToolbar: true,
            hide: false,
        },
        footer: {
            disabled:true,
            skipCloseChatButton: true,
        },
        endChat: {
            enableConfirmationDialog: true,
            confirmationDialogText: {
                title: "End Chat",
                message: "Are you sure you want to end this chat?",
                confirmButtonText: "End Chat",
                cancelButtonText: "Cancel",
        },
    },
    attachment: {
         // Default rejectedErrorMessage: Attachment was rejected.
        rejectedErrorMessage: "Custom Error Message: Files cannot exceed 15 MB." //this is customizable attribute 
    }
});
```

下圖顯示如果您使用此範例，自訂的外觀：

![顯示可自訂的顯示名稱、功能表位置、圖示和結束聊天確認對話方塊的圖表。](http://docs.aws.amazon.com/zh_tw/connect/latest/adminguide/images/chat-customization-diagram2.png)


## 支援的選項和限制
<a name="customization-options-constraints"></a>

下表會列出支援的自訂欄位和建議的數值條件限制。


| 自訂配置選項 | Type | 描述 | 
| --- | --- | --- | 
| `header.dropdown` | Boolean | 呈現標頭下拉式功能表，而不是預設的頁腳 當您將此選項設定為 `true` 時，**文字記錄下載**按鈕會出現並可見，直到您將選項設定為 `false`，或直到您移除該選項為止。  | 
| `header.dynamicHeader` | Boolean | 將標頭標題動態設定為「與 Bot/AgentName 聊天」。 | 
| `header.hideTranscriptDownloadButton` | Boolean | 隱藏標頭下拉式功能表中的[下載文字記錄](chat-widget-download-transcript.md)按鈕。預設值為 false。 | 
| `header.minimizeChatHeaderButton` | Boolean | 在聊天標頭中顯示最小化按鈕。預設值為 false。 | 
| `transcript.hideDisplayNames` | Boolean | 隱藏所有顯示名稱，如果 `eventNames` 未提供，將套用預設名稱遮罩。 | 
| `transcript.eventNames.customer` | String | 遮蓋客戶的顯示名稱。 | 
| `transcript.eventNames.agent` | String | 遮蓋客服人員的顯示名稱。 | 
| `transcript.eventNames.supervisor` | String | 遮蓋主管的顯示名稱。 | 
| ` transcript.eventMessages.participantJoined` | String | 覆寫文字記錄中關於參與者加入聊天時的事件訊息。如果指定空白字串，則會在文字記錄中省略事件訊息。`{name}` 可以傳入訊息中，且將取代為對應參與者的顯示名稱。預設訊息為 `{name} has joined the chat`。 | 
| `transcript.eventMessages.participantDisconnect` | String | 覆寫文字記錄中關於參與者聊天連線中斷時的事件訊息。如果指定空白字串，則會在文字記錄中省略事件訊息。`{name}` 可以傳入訊息中，且將取代為對應參與者的顯示名稱。預設訊息為 {`name} has been idle too long, disconnecting`。 | 
| `transcript.eventMessages.participantLeft` | String | 覆寫文字記錄中關於參與者退出聊天時的事件訊息。如果指定空白字串，則會在文字記錄中省略事件訊息。`{name}` 可以傳入訊息中，且將取代為對應參與者的顯示名稱。預設訊息為 `{name} has left the chat`。 | 
| `transcript.eventMessages.participantIdle` | String | 覆寫文字記錄中關於參與者閒置時的事件訊息。如果指定空白字串，則會在文字記錄中省略事件訊息。`{name}` 可以傳入訊息中，且將取代為對應參與者的顯示名稱。預設訊息為 `{name} has become idle`。 | 
| `transcript.eventMessages.participantReturned` | String | 覆寫文字記錄中關於參與者返回聊天時的事件訊息。如果指定空白字串，則會在文字記錄中省略事件訊息。`{name} ` 可以傳入訊息中，且將取代為對應參與者的顯示名稱。預設訊息為 `{name} has returned`。 | 
| `transcript.eventMessages.chatEnded` | String | 覆寫文字記錄中關於聊天結束時的事件訊息。如果指定空白字串，則會在文字記錄中省略事件訊息。`{name}` 可以傳入訊息中，且將取代為對應參與者的顯示名稱。預設訊息為 `Chat has ended!` | 
| `transcript.displayIcons` | Boolean | 啟用訊息顯示圖示。 | 
| `transcript.iconSources.botMessage` | String | 為機器人訊息顯示的圖示必須託管於公開 URL 上。 | 
| `transcript.iconSources.systemMessage` | String | 為系統訊息顯示的圖示必須託管於公開 URL 上。 | 
| `transcript.iconSources.agentMessage` | String | 為客服人員訊息顯示的圖示必須託管於公開 URL 上。 | 
| `transcript.iconSources.customerMessage` | String | 為客戶訊息顯示的圖示必須託管於公開 URL 上。 | 
| `composer.alwaysHideToolbar` | Boolean | 隱藏包含文字樣式功能的格式工具列，例如粗體、斜體，以及項目符號和編號清單選項。 | 
| `composer.disableEmojiPicker` | Boolean | 使用 [RTF 文字編輯器](enable-text-formatting-chat.md)時停用表情符號選擇器。 | 
| `composer.disableCustomerAttachments` | Boolean | 防止客戶傳送或上傳附件。 | 
| `composer.hide` | Boolean | 隱藏編譯器 (`true`) 或顯示它 (`false`)。若要根據事件 （例如當客服人員加入時） 切換編譯器，請使用 `registerCallback`搭配 `hideComposer`方法。如需詳細資訊，請參閱[Amazon Connect 中支援的可自訂小工具程式碼片段欄位](supported-snippet-fields.md)。<pre>document.getElementById("amazon-connect-chat-widget-iframe").contentWindow.connect.ChatInterface.hideComposer(false)</pre> | 
| `footer.disabled` | Boolean | 隱藏**結束聊天**按鈕的預設頁腳。 | 
| `footer.skipCloseChatButton` | Boolean | 按一下**結束聊天**按鈕即可直接關閉小工具，而不顯示**關閉**按鈕。 | 
| `endChat.enableConfirmationDialog` | Boolean | 啟用結束聊天確認對話方塊。若未提供 confirmationDialogText，則使用預設文字。 | 
| `endChat.confirmationDialogText.title` | String | 覆寫結束聊天確認對話方塊的標題。 | 
| `endChat.confirmationDialogText.message` | String | 覆寫結束聊天確認對話方塊的訊息。 | 
| `endChat.confirmationDialogText.confirmButtonText` | String | 覆寫結束聊天確認對話方塊中的確認按鈕文字。 | 
| `endChat.confirmationDialogText.cancelButtonText` | String | 覆寫結束聊天確認對話方塊中的取消按鈕文字。 | 
| `attachment.rejectedErrorMessage` | String | 覆寫聊天小工具附件拒絕的錯誤訊息。 | 