Use code snippets to get Enhanced Web Chat deployment details in your custom Lightning web components.
language
To get the language code for your client, use the following snippet in your custom component.
Example
const language = this.configuration.language;
termsAndConditions
To get the Terms and Conditions settings for your client, use the following snippet in your custom component.
Example
if (this.configuration.termsAndConditions.isTermsAndConditionsEnabled) {
const isTermsAndConditionsRequired = this.configuration.termsAndConditions
.isTermsAndConditionsRequired;
const termsAndConditionsLabel = this.configuration.termsAndConditions.label;
}
customLabels
To get the customized labels in Embedded Service deployment setup in the language configured on the client, use the following snippet in your custom component. This example shows how to get the customized label for End Conversation Header text.
Example
const endConversationLabelObj =
this.configuration.customLabels.filter(
(label) =>
label.sectionName === "EmbeddedMessagingChatHeader" &&
label.labelName === "CloseConversation",
)[0] || {};
const endConversationLabel = endConversationLabelObj.labelValue || "End Conversation";