const tinyInboxLanguage =
(currentUser.language || "").replace(/_/g, "-").toLowerCase() === "zh-tw"
? "zh-tw"
: "en"
function onTinyInboxReady(callback) {
if (window.TinyInbox && window.TinyInbox.isReady) {
callback(window.TinyInbox)
return
}
window.addEventListener(
"tinyinbox:ready",
(event) => callback(event.detail),
{ once: true }
)
}
onTinyInboxReady((TinyInbox) => {
TinyInbox.configure({
language: tinyInboxLanguage,
welcomeMessage: translate("support.chatWelcome"),
labels: {
send: translate("support.send"),
messagePlaceholder: translate("support.messagePlaceholder"),
},
})
})