(function() { 'use strict'; try { const chatWebsiteAddress = new URL('https://www.umassonline.net') if (chatWebsiteAddress.origin !== window.location.origin){ throw new Error(`Domain "${window.location.origin}"" can't load snippet for 'https://www.umassonline.net'. Please check your website domain in the current XCALLY Chat Website settings.`) } } catch (error) { window.alert(`Domain ${window.location.origin} can't load snippet for 'https://www.umassonline.net'. Please check your website domain in the current XCALLY Chat Website settings.`) return } // Init all URLs const remoteURL = new URL('https://jetspring-mo2-vcc.sahosted.com:443') const chatOrigin = remoteURL.origin const chatPath = '/snippet/' const chatStylesPath = chatPath + 'styles/' const chatVersion = '3.9.0' // Style setttings const divColor = '#085cbc' const textColor = '#ffffff' const buttonColor = '#085cbc' const backgroungColor = '#fafafa' let alignment = "right"; let verticalAlignment = "30"; // iframe URL settings const iframeId = 'motion-chat-iframe' const iframeSrcURL = new URL(chatPath, chatOrigin) const iframeSearchParams = new URLSearchParams('onlineForm=&offlineForm=&id=27&name=UMass%20Online&address=&description=&mapKey=email&mapKeyOffline=email&key=UMOL&agentAlias=Agent&customerAlias=Me&color=%23085cbc&color_button=%23085cbc&textColor=%23ffffff&textButtonColor=%23ffffff&fontSize=15&remote=https%3A%2F%2Fjetspring-mo2-vcc.sahosted.com%3A443&animation=true&header_shape=rounded&header_online=CHAT%20NOW&start_chat_button=Chat&offline_chat_button=Send&header_offline=Contact%20us&download_transcript=true&timeout=0&whiteLabel=Powered%20by%20xCALLY&defaultWhiteLabel=true&sitepic=&closingQuestion=Do%20you%20want%20to%20close%20the%20interaction%3F&formSubmitSuccessMessage=Form%20properly%20submitted&formSubmitFailureMessage=Form%20submission%20error¬eTitle=Note&placeholderMessage=Type%20a%20message&closingMessage=Thank%20you%20chatting%20with%20us%20today!&closingMessageButton=Send&skipMessageButton=Skip&conditionAgreement=false&enableRating=true&enableFeedback=true&enableSendButton=true&feedbackTitle=Feedback&ratingType=star&ratingStarsNumber=5&token=rcya2IDNgYNjupK4WDKVGE3TD6QhGaiO&autoclose=true&enableCustomerWriting=false&forwardTranscript=true&forwardTranscriptMessage=Email%20Transcript&forwardOffline=true&forwardOfflineAddress=&waitingTitle=One%20moment%20while%20we%20connect%20you%20to%20a%20representative.&waitingMessage=Please%20hold%20and%20we%20will%20answer%20your%20request%20as%20soon%20as%20possible.&offlineMessageSubject=New%20offline%20message%20from%20websiteName&offlineMessageBody=You%20received%20a%20new%20offline%20message%20from%20websiteName.%20Here%20you%20can%20find%20the%20details%20of%20the%20request%3A&enableUnmanagedNote=true&unmanagedMessage=Your%20request%20has%20not%20been%20processed.&skipUnmanaged=Skip&sendUnmanaged=Send&enableCustomerAttachment=false&enableCustomerCheckmarks=false&agentAvatar=1674667101218-agent%20stock%20image.png&showAgentAvatar=false&timezone=¬ificationTemplate=%3Cp%3EAccount%3A%20%7B%7Baccount.name%7D%7D%3Cbr%20%2F%3E%0A%7B%7B%23queue%7D%7DQueue%3A%20%7B%7Bqueue.name%7D%7D%3Cbr%20%2F%3E%0A%7B%7B%2Fqueue%7D%7DFrom%20%3A%20%7B%7Bfrom%7D%7D%3C%2Fp%3E%0A¬ificationSound=true¬ificationShake=false&hideWhenOffline=true&agentIdentifier=agent_alias&waitForTheAssignedAgent=120&waitForTheAssignedQueue=10&alignment=right&verticalAlignment=30&labelText=CHAT&messagesAlignment=alternate&defaultTitle=&customerAvatar=&showCustomerAvatar=false&messageFontSize=12&backgroundColor=%23fafafa&queueTransfer=false&queueTransferTimeout=300&agentTransfer=false&agentTransferTimeout=300&systemAlias=System&systemAvatar=1674667135218-UMOL.png&mandatoryDispositionPauseId=4&mandatoryDisposition=true&vidaooEscalation=false&vidaooApiKey=&vidaooTopic=Generated%20by%20XCALLY%20Motion&vidaooNote=Meeting%20generated%20for%20interaction%20%23%7B%7Binteraction.id%7D%7D%20by%20%7B%7Bagent.name%7D%7D&vidaooMetadata=&openNewInteraction=false&subjectOffline=&createdAt=&updatedAt=&ListId=38&IntervalId=15&MailAccountId=&Interval=&customerIp=95.216.99.153&referer=http%3A%2F%2Fwww.umassonline.net&openedInteractions=1&maxInteractions=270&virtual=&online=true&custom=false') iframeSearchParams.append('version', chatVersion) iframeSearchParams.append('location', btoa(window.location.host)) iframeSrcURL.search = iframeSearchParams // Style URL settings const linkURL = new URL(chatStylesPath + 'mobile.css', chatOrigin) linkURL.search = new URLSearchParams({ version: chatVersion }) const linkMobile = document.createElement('link'); linkMobile.type = "text/css"; linkMobile.rel='stylesheet'; linkMobile.href = linkURL.toString() // Iframe localstorage whitelisting const allowedOrigins = [chatOrigin] function remoteLocalStorageEventHandler(event){ if (allowedOrigins.includes(event.origin)) { const { action, key, value } = event.data const localStorage = window.localStorage switch(action){ case 'setItem': { localStorage.setItem(key, JSON.stringify(value)) event.source.postMessage( { action: 'setItemResult', key }, event.origin) } break case 'getItem': { let item = localStorage.getItem(key) if(item){ try { item = JSON.parse(item) } catch (error) { console.error('Cannot read data from localstorage', error) } } event.source.postMessage( { action: 'getItemResult', key, item }, event.origin) } break case 'removeItem': { localStorage.removeItem(key) event.source.postMessage( { action: 'removeItemResult', key }, event.origin) } break default: typeof action === 'string' && console.debug('Unsupported action', action) break; } } } // DOM Manipulation let iframe = document.createElement('iframe'); // Attributes iframe['id'] = iframeId; iframe['src'] = iframeSrcURL.toString() let iframe_status = false; document.documentElement.style.setProperty('--xc-ws-div-color', divColor); document.documentElement.style.setProperty('--xc-ws-text-color', textColor); document.documentElement.style.setProperty('--xc-ws-button-color', buttonColor); document.documentElement.style.setProperty('--xc-ws-background-color', backgroungColor); document.head.appendChild(linkMobile); // Right iframe.className = 'motion-chat-iframe-right'; iframe.style['top'] = verticalAlignment+'%'; let iframe_h = topIframe_calc(); topIframe_set(iframe_h); let div_tab = document.createElement('div'); div_tab['id'] = 'motion-chat-iframe-tab'; div_tab.className = 'motion-chat-div-right'; let tab_status=0; // Right topChat_set(iframe_h, verticalAlignment); document.body.appendChild(div_tab); let html = '