// 1. Create the container var qc_container = document.createElement( 'div' ); qc_container.id = 'qc-container'; document.body.appendChild( qc_container ); var widget_script = ''; var origin_url = window.document.location.origin; // 2. Create a iframe to load the react App var qc_iframe = document.createElement( 'iframe' ); qc_iframe.id = 'qc-frame'; // position: fixed; remove a white space which was added at the bottom of the page qc_iframe.style.position = 'fixed'; // Cannot use display: none; otherwise the autogrow textarea will not work qc_iframe.style.visibility = 'hidden'; document.body.appendChild( qc_iframe ); qc_iframe.contentWindow.document.write( '' + widget_script + '' ); qc_iframe.contentWindow.document.close(); qc_iframe.contentWindow.context = { baseUrl: 'https://onelocal.com', environment: 'production', merchantId: '6412340c0e8918b74d60e830', merchantName: 'OneLocal Demo Painter', originUrl: origin_url, sentry: 'https://ec0b927b3ee742b1ac32f546edbe3cad@app.getsentry.com/20033', widgetSettings: {"hipaa_enabled":false,"auto_response":{"enabled":true,"text":"Thanks for texting OneLocal Demo Painter. We're busy serving other clients right now, but will get back to you as soon as we can.\n\nIn the meantime, you can reply \"APPT\" to book an appointment, \"QUOTE\" to get a quote, or \"INFO\" for our hours and location. Otherwise, we'll get back to you as soon as we can - thank you!"},"call_phone_number":{"national_format":"(647) 952-6753","value":"+16479526753"},"confirmation":{"title":"Thanks for testing out the LocalMessages widget!","text":"Your messages is now in the OneLocal dashboard and you should have received a text."},"intro":{"enabled":true,"text":"This is your chat widget! Let site visitors connect with you and generate more leads."},"message_form":{"cta_text":"Try it out","name_optional":true,"title":"Connect with Site Visitors","text":"This is where your website visitors can connect with you if they can't call or prefer texting."},"mobile":{"call_cta_enabled":true,"text":"This is your mobile widget. Visitors can choose to text using LocalMessages or call with LocalResponse. Try it out!","title":"Get in Touch!"},"style":{"primary_color":"#f9db4d"},"default_assignee":{"id":"641b3aebebe0540fde92ba71","ref":"employees"},"chatbot":{"auto_load":true,"enabled":false,"name":"SparkAI","intro":{"enabled":false,"text":"Have a question? Ask our chatbot, SparkAI"}},"phone_number":{"national_format":"(866) 511-7164","value":"+18665117164"},"locations":[],"location_selection":{"title":"Location Selection","text":"Select the location which you would like to contact","skip_text":"Skip"}} }; window.addEventListener( "message", ( event ) => { if( event.origin.indexOf( origin_url ) === -1 || ! event.data?.event_name ) { return; } if( typeof gtag !== "undefined" ) { gtag( "event", event.data.event_name, { name: event.data.event_name } ); } }, false );