<script>
function chatFunction() {
var form = {
wrapper: "<table></table>",
inputs: [
{
id: "cx_webchat_form_firstname",
name: "firstname",
maxlength: "100",
placeholder: "Required",
label: "@i18n:webchat.ChatFormFirstName",
validateWhileTyping: false,
validate: function (event, form, input, label, $, CXBus, Common) {
if (input) {
if (input.val())
return true;
else
return false;
}
return false;
}
},
{
id: "cx_webchat_form_lastname",
name: "lastname",
maxlength: "100",
placeholder: "Required",
label: "@i18n:webchat.ChatFormLastName",
validateWhileTyping: false,
validate: function (event, form, input, label, $, CXBus, Common) {
if (input) {
if (input.val())
return true;
else
return false;
}
return false;
}
},
{
id: "cx_webchat_form_email",
name: "email",
maxlength: "100",
placeholder: "Required",
label: "Email",
validateWhileTyping: false,
validate: function (event, form, input, label, $, CXBus, Common) {
if (input) {
if (input.val())
return true;
else
return false;
}
return false;
}
},
{
id: "cx_webchat_form_subject",
name: "subject",
placeholder: "Required",
label: "Subject",
validateWhileTyping: false,
validate: function (event, form, input, label, $, CXBus, Common) {
if (input) {
if (input.val())
return true;
else
return false;
}
return false;
},
type: "select",
options: [
{
disabled: "disabled",
selected: "selected",
hidden: "hidden"
},
{
text: "Finance",
value: "value1"
},
{
text: "Bank",
value: "value2"
},
{
text: "Payments",
value: "value3"
}
],
wrapper: "<tr><th>{label}</th><td>{input}</td></tr>"
}
]
};
window._genesys.widgets.bus.command("WebChat.open", { formJSON: form });
}
</script>
<script>
if (!window._genesys.widgets.extensions) {
window._genesys.widgets.extensions = {
};
}
window._genesys.widgets.extensions["TestExtension"] = function ($, CXBus, Common) {
var oTestExtension = CXBus.registerPlugin("TestExtension");
oTestExtension.subscribe("WebChat.opened", function (e) { });
oTestExtension.publish("ready");
oTestExtension.command("WebChat.open").done(function (e) {
console.log("hello");
}).fail(function (e) {
console.log("hello1");
});
oTestExtension.registerCommand("form", function (e) {
console.log("hello2");
});
};