Casino Not On Gamstop
Online Casino
Live Chat
Powered by Amazon Connect
`) } } }); }); const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); let flowName = urlParams.get('flow'); let brand = urlParams.get('brand'); let flowId = fid = ""; let instanceID = "39ae86f3-28a6-4e79-bdcf-ceff85fceffa"; // B2B PROD INSTANCE BY DEFAULT switch (flowName) { case "uki": flowId = "a4f82f72-d43a-4430-becb-06929d974a04"; break; case "nbcsg": flowId = "61e003b2-0287-4516-aa2b-20a1b4072a9a"; break; case "nbcolympics": flowId = "2634ed65-3df9-4b6b-a09a-126519e2ec8c"; break; case "testchat": flowId = "86ca599b-913e-4f4b-98bd-8b16d2389eff"; break; case "rescenter": flowId = "32142c13-859a-4603-b941-8b76be66cd8d"; instanceID = "c977234e-4945-4fe5-bd5a-7ca5765e43e1"; // CHANGING TO RC INSTANCE fid = urlParams.get('fid'); break; case "mcmain": default: flowId = "9b61dbdf-8874-4df3-8412-a8d724c93f1d"; break; } $(function () { $('#contactDetails').submit(function (e) { e.preventDefault(); var customerName = $('#firstName').val(); var email = $('#username').val(); var username = email + Date.now(); var phone = $('#phone').val(); if (!customerName || !username) { alert('You must enter a name & email.'); document.getElementById("contactDetails").reset(); } else { console.log("this is the first name:" + customerName); console.log("this is the username: " + username); // console.log("Flow ID: " + flowId); // console.log("Instance ID: " + instanceID); document.getElementById("contactDetails").reset(); connect.ChatInterface.initiateChat({ name: customerName, username: username, region: "us-east-1", apiGatewayEndpoint: "https://7twfne8nof.execute-api.us-east-1.amazonaws.com/Prod", contactAttributes: JSON.stringify({ "customerName": customerName, "brand": brand, "email": email, "phone": phone, "fid": fid }), contactFlowId: flowId, instanceId: instanceID }, successHandler, failureHandler) $('#firstName').blur(); $('#username').blur(); document.getElementById("startChat").disabled = true; document.getElementById("firstName").disabled = true; document.getElementById("username").disabled = true; $("#nav").css("width", "1063"); $('#chatWrapper').hide(); $('#section-main').hide(); $("#section-chat").show(); $("#section-chat").draggable({ handle: ".header-wrapper" }); $("#divSpinner").delay(310).fadeIn(); } }); }); //Chat Management function successHandler(chatSession) { window.chatSession = chatSession; // chat connected $("#divSpinner").fadeOut(200); $('#chatWrapper').fadeIn(400); //Change the incoming data set chatSession.incomingItemDecorator = function (item) { if (["SYSTEM_MESSAGE"].indexOf(item.displayName) !== -1) { item.displayName = "System Message"; } if (chatSession.transcript.length > 0) { var transcriptItem = chatSession.transcript[chatSession.transcript.length - 1]; if (transcriptItem.transportDetails.direction === "Incoming") { var chatDescription = ""; var name = transcriptItem.displayName; if (["prod", "$LATEST", "AI Assistant", "SYSTEM_MESSAGE", "System Message"].indexOf(name) === -1) { chatDescription = "You are now chatting with " + name; } document.getElementById("chatDescription").innerHTML = chatDescription; } } return item; } chatSession.onIncoming(function (data) { console.log("incoming message:|| " + JSON.stringify(data)); }); chatSession.onOutgoing(function (data) { // console.log("outgoing message: " + JSON.stringify(data)); }); chatSession.onChatDisconnected(function (data) { resetForm(); }); connect.ChatInterface.init({ containerId: 'root', headerConfig: { isHTML: true, render: () => { return (`
Chat
`) } } }); } function failureHandler(error) { // chat failed console.log("failed", error); } function resetForm() { document.getElementById("startChat").disabled = false; document.getElementById("firstName").disabled = false; document.getElementById("username").disabled = false; $("#section-chat").removeAttr('style'); $("#nav").css("width", "690"); $('#section-main').show(); $("#section-chat").hide(); document.getElementById("contactDetails").reset(); }
Loading