@meetelise/chat 1.20.162 → 1.20.164
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/public/demo/index.html
CHANGED
|
@@ -117,14 +117,14 @@
|
|
|
117
117
|
<!-- Webpack dev server will serve the bundle, index.js, at the path '/' -->
|
|
118
118
|
<script type="module" async>
|
|
119
119
|
import MEChat from "/index.js";
|
|
120
|
-
MEChat.start({
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
});
|
|
125
|
-
// MEChat.healthcareStart({
|
|
126
|
-
// id: "1234567890",
|
|
120
|
+
// MEChat.start({
|
|
121
|
+
// // // 123 Main Street
|
|
122
|
+
// organization: "Washington-Real-Estate-Investment-Trust",
|
|
123
|
+
// building: "24e41d0c-9cdd-11ed-89a8-af35965a3d2d",
|
|
127
124
|
// });
|
|
125
|
+
MEChat.healthcareStart({
|
|
126
|
+
id: "1234567890",
|
|
127
|
+
});
|
|
128
128
|
</script>
|
|
129
129
|
<main>
|
|
130
130
|
<h1>Example Page</h1>
|
package/public/dist/index.js
CHANGED
|
@@ -2930,7 +2930,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
2930
2930
|
${mi}
|
|
2931
2931
|
${gi}
|
|
2932
2932
|
${vi}
|
|
2933
|
-
`,Wi([ue({attribute:!0})],Qi.prototype,"isMinimized",void 0),Wi([ue()],Qi.prototype,"mobileStyles",void 0),Wi([ue({type:Boolean})],Qi.prototype,"isFirstMount",void 0),Wi([ue({attribute:!1})],Qi.prototype,"autoOpenChatWidget",void 0),Wi([ue()],Qi.prototype,"phoneNumber",void 0),Wi([ue({attribute:!0})],Qi.prototype,"buildingName",void 0),Wi([ue({attribute:!0})],Qi.prototype,"chatId",void 0),Wi([ue({attribute:!0})],Qi.prototype,"chatCallUsHeader",void 0),Wi([ue({attribute:!1})],Qi.prototype,"buildingId",void 0),Wi([ue({attribute:!0})],Qi.prototype,"buildingSlug",void 0),Wi([ue({attribute:!0})],Qi.prototype,"orgSlug",void 0),Wi([ue({attribute:!0})],Qi.prototype,"sgtUrl",void 0),Wi([ue({attribute:!0})],Qi.prototype,"designConcept",void 0),Wi([ue({attribute:!0})],Qi.prototype,"featureFlagShowDropdown",void 0),Wi([ue({attribute:!1})],Qi.prototype,"leadSources",void 0),Wi([ue({attribute:!0})],Qi.prototype,"currentLeadSource",void 0),Wi([ue({attribute:!0})],Qi.prototype,"escortedToursLink",void 0),Wi([ue({attribute:!0})],Qi.prototype,"virtualToursLink",void 0),Wi([ue({type:Boolean})],Qi.prototype,"hasCallUsEnabled",void 0),Wi([ue({type:Boolean})],Qi.prototype,"hasChatEnabled",void 0),Wi([ue({type:Boolean})],Qi.prototype,"hasEmailEnabled",void 0),Wi([ue({type:Boolean})],Qi.prototype,"hasSSTEnabled",void 0),Wi([ue({type:Boolean})],Qi.prototype,"hasTextUsEnabled",void 0),Wi([ue({attribute:!1})],Qi.prototype,"layoutOptions",void 0),Wi([ue({attribute:!1})],Qi.prototype,"unitOptions",void 0),Wi([ue({attribute:!1})],Qi.prototype,"tourTypeOptions",void 0),Wi([ue({attribute:!0})],Qi.prototype,"showTourNextToChat",void 0),Wi([ue({attribute:!1})],Qi.prototype,"onChatTapped",void 0),Wi([ue({attribute:!0})],Qi.prototype,"onClickMinimize",void 0),Wi([ue({attribute:!1})],Qi.prototype,"launcherStyles",void 0),Wi([ue({attribute:!0})],Qi.prototype,"brandColor",void 0),Wi([le()],Qi.prototype,"isEmailWindowOpen",void 0),Wi([le()],Qi.prototype,"isCallUsWindowOpen",void 0),Wi([le()],Qi.prototype,"isSSTWindowOpen",void 0),Wi([le()],Qi.prototype,"isTextUsWindowOpen",void 0),Qi=Wi([ae("meetelise-launcher")],Qi);const Vi=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Qi)};var Ki=n(3379),Xi=n.n(Ki),Yi=n(7795),Zi=n.n(Yi),$i=n(569),er=n.n($i),tr=n(3565),nr=n.n(tr),ir=n(9216),rr=n.n(ir),or=n(4589),ar=n.n(or),sr=n(3631),ur={};async function lr(e){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/lead-sources`);return n.data?dr(n.data,e):[]}catch(e){return[]}}ur.styleTagTransform=ar(),ur.setAttributes=nr(),ur.insert=er().bind(null,"head"),ur.domAPI=Zi(),ur.insertStyleElement=rr(),Xi()(sr.Z,ur),sr.Z&&sr.Z.locals&&sr.Z.locals;const dr=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter((e=>{const t=e.toLowerCase();return!n.map((e=>e.toLowerCase())).includes(t)}))};var cr,pr=n(9594),hr=n.n(pr),fr=new Uint8Array(16);function mr(){if(!cr&&!(cr="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return cr(fr)}const gr=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,vr=function(e){return"string"==typeof e&&gr.test(e)};for(var yr=[],br=0;br<256;++br)yr.push((br+256).toString(16).substr(1));const wr=function(e,t,n){var i=(e=e||{}).random||(e.rng||mr)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(yr[e[t+0]]+yr[e[t+1]]+yr[e[t+2]]+yr[e[t+3]]+"-"+yr[e[t+4]]+yr[e[t+5]]+"-"+yr[e[t+6]]+yr[e[t+7]]+"-"+yr[e[t+8]]+yr[e[t+9]]+"-"+yr[e[t+10]]+yr[e[t+11]]+yr[e[t+12]]+yr[e[t+13]]+yr[e[t+14]]+yr[e[t+15]]).toLowerCase();if(!vr(n))throw TypeError("Stringified UUID is invalid");return n}(i)};var Sr=36e5;const Tr=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Ar=(e,t,n)=>{const i=pn(new Date),r=n||`lead_${wr()}_${e}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:yn(i),buildingSlug:e,initiatedChat:t}},xr=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(Or(e,i))return i}catch(e){console.warn("Error getting chat storage key")}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Or=(e,t)=>!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!function(e,t){Ue(2,arguments);var n=qe(e),i=qe(t);return n.getTime()<i.getTime()}(function(e,t){Ue(2,arguments);var n=et(t);return tt(e,n*Sr)}(t.timestamp,24),Date.now());var Cr;!function(e){e.noReply="no-reply",e.text="text"}(Cr||(Cr={}));const Ir=class{constructor(e,t,n,i=null,r){this.apiHost="https://app.meetelise.com",this.building=null,this.eliseResponseTimeout=null,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.chatListener=null,this.messages=[],this.listenerParams={message:e=>{var t;e.message.messageType!==Cr.noReply&&(this.messages=[...this.messages,{channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken}]);const n="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.messages,isLoading:n}),!n&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=n}},this.isLoadingMessages=!1,this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){ii({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:ni.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.removeChatListeners()},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub){const e=Ar(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken((async()=>{var t,n;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout((()=>{console.error("Elise AI did not respond in time..."),ii({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:ni.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}),6e4),await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(t=this.building)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,userId:null===(n=this.building)||void 0===n?void 0:n.userId,leadSource:this.leadSource}}))})),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.buildingSlug=e,this.building=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(hr())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token}),this.withAuthToken((()=>new Promise((()=>this.handleChatListeners())))),await this.withAuthToken((()=>this.getChannelHistory())),this.pubnub):void 0}async fetchToken(e,n){try{return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${n}&${this.building?"":"industry=health_care"}`)).data}catch(e){ii({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:ni.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){ii({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:ni.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(t){try{await t()}catch(n){if(n instanceof e.AxiosError&&n&&n.response&&403===n.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const e=await this.fetchToken(this.leadUserId,this.channel);if(!e)return;this.pubnub.setAuthKey(e.auth.result.token),await t()}catch(e){ii({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:ni.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(){var e;try{const t=await new Promise(((e,t)=>{this.pubnub&&this.channel&&this.pubnub.fetchMessages({channels:[this.channel],count:100},((n,i)=>{n.error?(ii({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{channel:this.channel,status:n,response:i},logType:ni.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),t(n)):e(i)}))}));if(this.channel&&0!==Object.keys(t.channels).length){const n=t.channels[this.channel],i=[];n.forEach((e=>{e.uuid&&i.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})})),this.messages=i.filter((e=>e.message.messageType!==Cr.noReply)),null===(e=this.chatListener)||void 0===e||e.call(this,{messages:this.messages,isLoading:!1})}}catch(e){ii({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:ni.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}},Nr=(e,t,n)=>{const i=`tel:${e}`,r=`sms:${e}`,o=`whatsapp://send?phone=${e}}`,a=`facetime:${e}`,s=`facetime-audio:${e}`,u=/\(\d{3}\)\s\d{3}-\d{4}/g,l=/(tel|sms):\(\d{3}\)\s\d{3}-\d{4}/g,d=/whatsapp:\/\/send\?phone=\d+/g,c=/(facetime|facetime-audio):\d+/g,p=document.body.getElementsByTagName("*");let h=!1;const f=e.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");for(let e=0;e<p.length;e++)if(p[e].nodeType===Node.ELEMENT_NODE&&(1===p[e].childNodes.length&&p[e].childNodes[0].nodeType==Node.TEXT_NODE&&(p[e].innerHTML=p[e].innerHTML.replace(u,f),h=!0,ii({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",originalPhoneNumber:p[e].innerHTML,newPhoneNumber:f,website:window.location.href},logType:ni.info,buildingSlug:n,orgSlug:t})),p[e].hasAttribute("href"))){const u=p[e].getAttribute("href");if(!u)continue;let h="",m=l;u.startsWith("sms:")?h=r:u.startsWith("whatsapp:")?(h=o,m=d):u.startsWith("facetime:")?(h=a,m=c):u.startsWith("facetime-audio:")?(h=s,m=c):h=i;const g=u.replace(m,h);p[e].setAttribute("href",g),ii({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",hrefAttribute:u,originalPhoneNumber:p[e].innerHTML,newPhoneNumber:f,website:window.location.href},logType:ni.info,buildingSlug:n,orgSlug:t})}h||ii({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:ni.warn,buildingSlug:n,orgSlug:t})};var Er=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Rr=class extends re{constructor(){super(...arguments),this.onClick=()=>{},this.brandColor=Fe,this.toExpand=!1}render(){return U`
|
|
2933
|
+
`,Wi([ue({attribute:!0})],Qi.prototype,"isMinimized",void 0),Wi([ue()],Qi.prototype,"mobileStyles",void 0),Wi([ue({type:Boolean})],Qi.prototype,"isFirstMount",void 0),Wi([ue({attribute:!1})],Qi.prototype,"autoOpenChatWidget",void 0),Wi([ue()],Qi.prototype,"phoneNumber",void 0),Wi([ue({attribute:!0})],Qi.prototype,"buildingName",void 0),Wi([ue({attribute:!0})],Qi.prototype,"chatId",void 0),Wi([ue({attribute:!0})],Qi.prototype,"chatCallUsHeader",void 0),Wi([ue({attribute:!1})],Qi.prototype,"buildingId",void 0),Wi([ue({attribute:!0})],Qi.prototype,"buildingSlug",void 0),Wi([ue({attribute:!0})],Qi.prototype,"orgSlug",void 0),Wi([ue({attribute:!0})],Qi.prototype,"sgtUrl",void 0),Wi([ue({attribute:!0})],Qi.prototype,"designConcept",void 0),Wi([ue({attribute:!0})],Qi.prototype,"featureFlagShowDropdown",void 0),Wi([ue({attribute:!1})],Qi.prototype,"leadSources",void 0),Wi([ue({attribute:!0})],Qi.prototype,"currentLeadSource",void 0),Wi([ue({attribute:!0})],Qi.prototype,"escortedToursLink",void 0),Wi([ue({attribute:!0})],Qi.prototype,"virtualToursLink",void 0),Wi([ue({type:Boolean})],Qi.prototype,"hasCallUsEnabled",void 0),Wi([ue({type:Boolean})],Qi.prototype,"hasChatEnabled",void 0),Wi([ue({type:Boolean})],Qi.prototype,"hasEmailEnabled",void 0),Wi([ue({type:Boolean})],Qi.prototype,"hasSSTEnabled",void 0),Wi([ue({type:Boolean})],Qi.prototype,"hasTextUsEnabled",void 0),Wi([ue({attribute:!1})],Qi.prototype,"layoutOptions",void 0),Wi([ue({attribute:!1})],Qi.prototype,"unitOptions",void 0),Wi([ue({attribute:!1})],Qi.prototype,"tourTypeOptions",void 0),Wi([ue({attribute:!0})],Qi.prototype,"showTourNextToChat",void 0),Wi([ue({attribute:!1})],Qi.prototype,"onChatTapped",void 0),Wi([ue({attribute:!0})],Qi.prototype,"onClickMinimize",void 0),Wi([ue({attribute:!1})],Qi.prototype,"launcherStyles",void 0),Wi([ue({attribute:!0})],Qi.prototype,"brandColor",void 0),Wi([le()],Qi.prototype,"isEmailWindowOpen",void 0),Wi([le()],Qi.prototype,"isCallUsWindowOpen",void 0),Wi([le()],Qi.prototype,"isSSTWindowOpen",void 0),Wi([le()],Qi.prototype,"isTextUsWindowOpen",void 0),Qi=Wi([ae("meetelise-launcher")],Qi);const Vi=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Qi)};var Ki=n(3379),Xi=n.n(Ki),Yi=n(7795),Zi=n.n(Yi),$i=n(569),er=n.n($i),tr=n(3565),nr=n.n(tr),ir=n(9216),rr=n.n(ir),or=n(4589),ar=n.n(or),sr=n(3631),ur={};async function lr(e){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/lead-sources`);return n.data?dr(n.data,e):[]}catch(e){return[]}}ur.styleTagTransform=ar(),ur.setAttributes=nr(),ur.insert=er().bind(null,"head"),ur.domAPI=Zi(),ur.insertStyleElement=rr(),Xi()(sr.Z,ur),sr.Z&&sr.Z.locals&&sr.Z.locals;const dr=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter((e=>{const t=e.toLowerCase();return!n.map((e=>e.toLowerCase())).includes(t)}))};var cr,pr=n(9594),hr=n.n(pr),fr=new Uint8Array(16);function mr(){if(!cr&&!(cr="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return cr(fr)}const gr=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,vr=function(e){return"string"==typeof e&&gr.test(e)};for(var yr=[],br=0;br<256;++br)yr.push((br+256).toString(16).substr(1));const wr=function(e,t,n){var i=(e=e||{}).random||(e.rng||mr)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(yr[e[t+0]]+yr[e[t+1]]+yr[e[t+2]]+yr[e[t+3]]+"-"+yr[e[t+4]]+yr[e[t+5]]+"-"+yr[e[t+6]]+yr[e[t+7]]+"-"+yr[e[t+8]]+yr[e[t+9]]+"-"+yr[e[t+10]]+yr[e[t+11]]+yr[e[t+12]]+yr[e[t+13]]+yr[e[t+14]]+yr[e[t+15]]).toLowerCase();if(!vr(n))throw TypeError("Stringified UUID is invalid");return n}(i)};var Sr=36e5;const Tr=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Ar=(e,t,n)=>{const i=pn(new Date),r=n||`lead_${wr()}_${e}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:yn(i),buildingSlug:e,initiatedChat:t}},xr=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(Or(e,i))return i}catch(e){console.warn("Error getting chat storage key")}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Or=(e,t)=>!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!function(e,t){Ue(2,arguments);var n=qe(e),i=qe(t);return n.getTime()<i.getTime()}(function(e,t){Ue(2,arguments);var n=et(t);return tt(e,n*Sr)}(t.timestamp,24),Date.now());var Cr;!function(e){e.noReply="no-reply",e.text="text"}(Cr||(Cr={}));const Ir=class{constructor(e,t,n,i=null,r){this.apiHost="https://app.meetelise.com",this.building=null,this.eliseResponseTimeout=null,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.chatListener=null,this.messages=[],this.listenerParams={message:e=>{var t;e.message.messageType!==Cr.noReply&&(this.messages=[...this.messages,{channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken}]);const n="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.messages,isLoading:n}),!n&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=n}},this.isLoadingMessages=!1,this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.building&&ii({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:ni.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.removeChatListeners()},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub){const e=Ar(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken((async()=>{var t,n;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout((()=>{console.error("Elise AI did not respond in time..."),this.building&&ii({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:ni.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}),9e4),await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(t=this.building)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,userId:null===(n=this.building)||void 0===n?void 0:n.userId,leadSource:this.leadSource}}))})),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.buildingSlug=e,this.building=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(hr())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token}),this.withAuthToken((()=>new Promise((()=>this.handleChatListeners())))),await this.withAuthToken((()=>this.getChannelHistory())),this.pubnub):void 0}async fetchToken(e,n){try{return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${n}&${this.building?"":"industry=health_care"}`)).data}catch(e){this.building&&ii({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:ni.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.building&&ii({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:ni.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(t){try{await t()}catch(n){if(n instanceof e.AxiosError&&n&&n.response&&403===n.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const e=await this.fetchToken(this.leadUserId,this.channel);if(!e)return;this.pubnub.setAuthKey(e.auth.result.token),await t()}catch(e){this.building&&ii({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:ni.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(){var e;try{const t=await new Promise(((e,t)=>{this.pubnub&&this.channel&&this.pubnub.fetchMessages({channels:[this.channel],count:100},((n,i)=>{n.error?(this.building&&ii({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{channel:this.channel,status:n,response:i},logType:ni.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),t(n)):e(i)}))}));if(this.channel&&0!==Object.keys(t.channels).length){const n=t.channels[this.channel],i=[];n.forEach((e=>{e.uuid&&i.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})})),this.messages=i.filter((e=>e.message.messageType!==Cr.noReply)),null===(e=this.chatListener)||void 0===e||e.call(this,{messages:this.messages,isLoading:!1})}}catch(e){this.building&&ii({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:ni.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}},Nr=(e,t,n)=>{const i=`tel:${e}`,r=`sms:${e}`,o=`whatsapp://send?phone=${e}}`,a=`facetime:${e}`,s=`facetime-audio:${e}`,u=/\(\d{3}\)\s\d{3}-\d{4}/g,l=/(tel|sms):\(\d{3}\)\s\d{3}-\d{4}/g,d=/whatsapp:\/\/send\?phone=\d+/g,c=/(facetime|facetime-audio):\d+/g,p=document.body.getElementsByTagName("*");let h=!1;const f=e.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");for(let e=0;e<p.length;e++)if(p[e].nodeType===Node.ELEMENT_NODE&&(1===p[e].childNodes.length&&p[e].childNodes[0].nodeType==Node.TEXT_NODE&&(p[e].innerHTML=p[e].innerHTML.replace(u,f),h=!0,ii({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",originalPhoneNumber:p[e].innerHTML,newPhoneNumber:f,website:window.location.href},logType:ni.info,buildingSlug:n,orgSlug:t})),p[e].hasAttribute("href"))){const u=p[e].getAttribute("href");if(!u)continue;let h="",m=l;u.startsWith("sms:")?h=r:u.startsWith("whatsapp:")?(h=o,m=d):u.startsWith("facetime:")?(h=a,m=c):u.startsWith("facetime-audio:")?(h=s,m=c):h=i;const g=u.replace(m,h);p[e].setAttribute("href",g),ii({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",hrefAttribute:u,originalPhoneNumber:p[e].innerHTML,newPhoneNumber:f,website:window.location.href},logType:ni.info,buildingSlug:n,orgSlug:t})}h||ii({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:ni.warn,buildingSlug:n,orgSlug:t})};var Er=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Rr=class extends re{constructor(){super(...arguments),this.onClick=()=>{},this.brandColor=Fe,this.toExpand=!1}render(){return U`
|
|
2934
2934
|
<div
|
|
2935
2935
|
class=${this.toExpand?"button-container mini":"button-container"}
|
|
2936
2936
|
@click=${this.onClick}
|
|
@@ -3166,6 +3166,15 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3166
3166
|
transform: scale(1);
|
|
3167
3167
|
}
|
|
3168
3168
|
}
|
|
3169
|
+
#footer-hc {
|
|
3170
|
+
background: black;
|
|
3171
|
+
padding: 0px 12px 18px;
|
|
3172
|
+
color: rgba(227, 227, 227, 0.9);
|
|
3173
|
+
text-align: center;
|
|
3174
|
+
font-size: 10px;
|
|
3175
|
+
width: 100%;
|
|
3176
|
+
border-top: 2px solid rgba(0, 0, 0, 0.5);
|
|
3177
|
+
}
|
|
3169
3178
|
|
|
3170
3179
|
#footer {
|
|
3171
3180
|
min-height: 70px;
|
|
@@ -3367,7 +3376,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3367
3376
|
</div>
|
|
3368
3377
|
</div>
|
|
3369
3378
|
</a></div> `}))}
|
|
3370
|
-
</div>`:U``}};Fr.styles=[ln,_r],Pr([ue({attribute:!0})],Fr.prototype,"message",void 0),Pr([ue({attribute:!0})],Fr.prototype,"myPubnub",void 0),Pr([ue({attribute:!0})],Fr.prototype,"onMount",void 0),Pr([le()],Fr.prototype,"loadingPreviews",void 0),Pr([le()],Fr.prototype,"parsedMessage",void 0),Pr([le()],Fr.prototype,"websitePreviewInfo",void 0),Pr([le()],Fr.prototype,"imagesToDisplay",void 0),Pr([le()],Fr.prototype,"imageUrlError",void 0),Fr=Pr([ae("pubnub-message")],Fr);var Mr=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Dr=class extends re{constructor(){super(...arguments),this.onMount=()=>({}),this.brandColor=Fe,this.onClickExit=()=>({}),this.requiresConsent=!1,this.messages=[],this.isLoadingMessages=!1,this.hasReceivedConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.websitePreviewMapping={},this.sendMessage=async e=>{var t;this.messageInput.value="",this.autoResizeMessageInput(),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e))},this.scrollToChatBottom=()=>{this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"smooth"})},this.autoResizeMessageInput=()=>{this.messageInput.style.height="auto",this.messageInput.style.height=this.messageInput.scrollHeight+"px"},this.needsConsent=()=>!!this.requiresConsent&&!!this.requiresConsent&&!this.hasReceivedConsent}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.messages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener((e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading})),this.onMount()}async updated(){this.scrollToChatBottom()}render(){var e,t,n
|
|
3379
|
+
</div>`:U``}};Fr.styles=[ln,_r],Pr([ue({attribute:!0})],Fr.prototype,"message",void 0),Pr([ue({attribute:!0})],Fr.prototype,"myPubnub",void 0),Pr([ue({attribute:!0})],Fr.prototype,"onMount",void 0),Pr([le()],Fr.prototype,"loadingPreviews",void 0),Pr([le()],Fr.prototype,"parsedMessage",void 0),Pr([le()],Fr.prototype,"websitePreviewInfo",void 0),Pr([le()],Fr.prototype,"imagesToDisplay",void 0),Pr([le()],Fr.prototype,"imageUrlError",void 0),Fr=Pr([ae("pubnub-message")],Fr);var Mr=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Dr=class extends re{constructor(){super(...arguments),this.onMount=()=>({}),this.brandColor=Fe,this.onClickExit=()=>({}),this.requiresConsent=!1,this.messages=[],this.isLoadingMessages=!1,this.hasReceivedConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.websitePreviewMapping={},this.sendMessage=async e=>{var t;this.messageInput.value="",this.autoResizeMessageInput(),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e))},this.scrollToChatBottom=()=>{this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"smooth"})},this.autoResizeMessageInput=()=>{this.messageInput.style.height="auto",this.messageInput.style.height=this.messageInput.scrollHeight+"px"},this.needsConsent=()=>!!this.requiresConsent&&!!this.requiresConsent&&!this.hasReceivedConsent}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.messages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener((e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading})),this.onMount()}async updated(){this.scrollToChatBottom()}render(){var e,t,n;return this.buildingSlug?this.building?U`
|
|
3371
3380
|
<div
|
|
3372
3381
|
id="pubnub-chat-container"
|
|
3373
3382
|
class=${fe({"pubnub-container__mobile":un(),"pubnub-container__desktop":!un()})}
|
|
@@ -3384,7 +3393,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3384
3393
|
<div
|
|
3385
3394
|
class=${fe({hidden:!this.needsConsent(),"legal-confirmation-container":!0})}
|
|
3386
3395
|
>
|
|
3387
|
-
${Ur(null!==(
|
|
3396
|
+
${Ur(null!==(t=this.orgSlug)&&void 0!==t?t:null,this.building?this.privacyPolicyUrl:"https://www.eliseai.com/privacy/healthcare",(e=>{this.hasReceivedConsent=e}))}
|
|
3388
3397
|
</div>
|
|
3389
3398
|
<div
|
|
3390
3399
|
id="conversation-body"
|
|
@@ -3394,7 +3403,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3394
3403
|
id="message-thread-list"
|
|
3395
3404
|
class=${fe({hidden:this.needsConsent()})}
|
|
3396
3405
|
>
|
|
3397
|
-
${kr(null!==(
|
|
3406
|
+
${kr(null!==(n=this.orgSlug)&&void 0!==n?n:"")}
|
|
3398
3407
|
${this.building.welcomeMessage?U` <li class="message-container ai-message">
|
|
3399
3408
|
<p
|
|
3400
3409
|
class=${fe({"message-text":!0,"webchat-font__desktop":!un(),"webchat-font__mobile":un()})}
|
|
@@ -3472,12 +3481,27 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3472
3481
|
id="message-thread-list"
|
|
3473
3482
|
class=${fe({hidden:this.needsConsent()})}
|
|
3474
3483
|
>
|
|
3475
|
-
|
|
3484
|
+
<li class="message-container disclaimer-message">
|
|
3485
|
+
<p class="disclaimer-inner">
|
|
3486
|
+
Hi! I am a third-party bot. Your messages with me are recorded
|
|
3487
|
+
by Forefront Dermatology and our vendors. By replying, you
|
|
3488
|
+
consent to this
|
|
3489
|
+
<a
|
|
3490
|
+
href="https://www.eliseai.com/privacy/healthcare"
|
|
3491
|
+
target="_blank"
|
|
3492
|
+
rel="noopener noreferrer"
|
|
3493
|
+
>
|
|
3494
|
+
this privacy policy</a
|
|
3495
|
+
>
|
|
3496
|
+
and to being contacted by a bot.
|
|
3497
|
+
</p>
|
|
3498
|
+
</li>
|
|
3476
3499
|
<li class="message-container ai-message">
|
|
3477
3500
|
<p
|
|
3478
3501
|
class=${fe({"message-text":!0,"webchat-font__desktop":!un(),"webchat-font__mobile":un()})}
|
|
3479
3502
|
>
|
|
3480
|
-
Hi
|
|
3503
|
+
Hi I'm Elise. If this is a medical emergency, please call 911.
|
|
3504
|
+
How can I assist you today?"
|
|
3481
3505
|
</p>
|
|
3482
3506
|
</li>
|
|
3483
3507
|
${this.messages.map((e=>{var t,n;return U`
|
|
@@ -3506,6 +3530,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3506
3530
|
`:""}
|
|
3507
3531
|
</ul>
|
|
3508
3532
|
</div>
|
|
3533
|
+
|
|
3509
3534
|
<div
|
|
3510
3535
|
id="footer"
|
|
3511
3536
|
class=${fe({hidden:this.needsConsent()})}
|
|
@@ -3526,6 +3551,9 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3526
3551
|
${ki}
|
|
3527
3552
|
</button>
|
|
3528
3553
|
</div>
|
|
3554
|
+
<div id="footer-hc">
|
|
3555
|
+
Recorded by Forefront Dermatology and our vendors.
|
|
3556
|
+
</div>
|
|
3529
3557
|
</div>
|
|
3530
3558
|
`:U``}};Dr.styles=[ln,_r],Mr([ue({attribute:!0})],Dr.prototype,"onMount",void 0),Mr([ue({attribute:!0})],Dr.prototype,"channel",void 0),Mr([ue({attribute:!0})],Dr.prototype,"myPubnub",void 0),Mr([ue({attribute:!0})],Dr.prototype,"orgSlug",void 0),Mr([ue({attribute:!0})],Dr.prototype,"buildingSlug",void 0),Mr([ue({attribute:!0})],Dr.prototype,"building",void 0),Mr([ue({attribute:!0})],Dr.prototype,"brandColor",void 0),Mr([ue({attribute:!0})],Dr.prototype,"onClickExit",void 0),Mr([ue({attribute:!0})],Dr.prototype,"requiresConsent",void 0),Mr([de("#message-input",!0)],Dr.prototype,"messageInput",void 0),Mr([de("#conversation-body",!0)],Dr.prototype,"messageBody",void 0),Mr([le()],Dr.prototype,"messages",void 0),Mr([le()],Dr.prototype,"isLoadingMessages",void 0),Mr([le()],Dr.prototype,"hasReceivedConsent",void 0),Mr([le()],Dr.prototype,"privacyPolicyUrl",void 0),Mr([le()],Dr.prototype,"websitePreviewMapping",void 0),Dr=Mr([ae("pubnub-chat")],Dr);const kr=e=>"avb"===e?U`
|
|
3531
3559
|
<li class="message-container disclaimer-message">
|
|
@@ -3778,7 +3806,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3778
3806
|
position: fixed;
|
|
3779
3807
|
bottom: 0;
|
|
3780
3808
|
}
|
|
3781
|
-
`,qr([ue({type:String})],Br.prototype,"buildingSlug",void 0),qr([ue({type:String})],Br.prototype,"orgSlug",void 0),qr([ue({type:Object})],Br.prototype,"launcherStyles",void 0),qr([ue()],Br.prototype,"mobileStyles",void 0),qr([ue({type:Boolean})],Br.prototype,"isMinimized",void 0),qr([ue({type:String})],Br.prototype,"brandColor",void 0),qr([le()],Br.prototype,"chatId",void 0),qr([le()],Br.prototype,"analytics",void 0),qr([le()],Br.prototype,"launcher",void 0),qr([le()],Br.prototype,"building",void 0),qr([le()],Br.prototype,"designConcept",void 0),qr([le()],Br.prototype,"leadSources",void 0),qr([le()],Br.prototype,"currentLeadSource",void 0),qr([le()],Br.prototype,"featureFlagShowDropdown",void 0),qr([le()],Br.prototype,"phoneNumberForSource",void 0),qr([le()],Br.prototype,"hasMounted",void 0),qr([le()],Br.prototype,"hideLauncher",void 0),qr([le()],Br.prototype,"isLoading",void 0),qr([le()],Br.prototype,"showTourNextToChat",void 0),qr([le()],Br.prototype,"displayPubnubChat",void 0),qr([le()],Br.prototype,"myPubnub",void 0),qr([le()],Br.prototype,"enabledChatWidgets",void 0),qr([le()],Br.prototype,"webchatConfigHasAutoOpenChat",void 0),qr([le()],Br.prototype,"requiresConsent",void 0),qr([le()],Br.prototype,"privacyPolicyUrl",void 0),Br=qr([ae("me-chat")],Br);const Lr=e=>{for(const t of e){const e=document.getElementById(t);if(e)return e}return null},Jr=async(e,n)=>{var i;if(!n||!e)return;const r=await async function(e){if(!e)return!1;try{return(await t().get(Gn(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-use-override-contact-us-form",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(n);if(!r)return;const o=Lr(["myContactForm","contactus"]);let a;if(!(o&&o instanceof HTMLFormElement)){const t=document.querySelector("form");return void(window.location.pathname.toLowerCase().includes("contactus")&&jr(n,e,"Could not find form",t?{id:t.id}:void 0))}for(let e=0;e<o.elements.length;e++){const t=o.elements[e];if("button"===t.tagName.toLowerCase()&&"fakebutton"===t.getAttribute("data-selenium-id")){a=t;break}}if(!a)return jr(n,e,"Could not find submit button");const s=()=>({firstName:Lr(["firstname","txtName"]),lastName:Lr(["lastname","txtName2"]),email:Lr(["email","txtEmail"]),phone:Lr(["phonenumber","txtPhone"]),message:Lr(["message","txtComments"])});if(Object.values(s()).some((e=>null===e))){const t=Object.entries(s()).filter((([,e])=>null===e)).map((([e])=>e));return jr(n,e,"Missing the following form elements: "+t.join(", "))}const u=a.textContent,l=a.cloneNode(!0);null===(i=a.parentNode)||void 0===i||i.replaceChild(l,a),l.onclick=async function(t){if(Object.values(s()).forEach((e=>{"true"!==(null==e?void 0:e.getAttribute("aria-required"))||e.value||(e.className="form-control required is-invalid")})),!Object.values(s()).every((e=>null!==e&&!("true"===e.getAttribute("aria-required")&&!e.value)&&("email"!==e.id&&"phonenumber"!==e.id||"true"!==e.getAttribute("aria-invalid")))))return;t.preventDefault(),l.textContent="Processing request...",l.disabled=!0;const i={};Object.entries(s()).forEach((([e,t])=>i[e]=null==t?void 0:t.value));const r=await li(e,n),a=await fi(n,document.referrer);if(!r)return jr(n,e,"Could not find building"),null;const d={email_address:i.email,first_name:i.firstName,last_name:i.lastName,phone_number:i.phone,first_message:i.message,building_id:r.id,is_external_form:!0,lead_sources:[...new Set(a?[a,"property-website"]:["property-website"])]},c=JSON.stringify(d);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":n,"org-slug":e},body:c}).then((e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return o&&o.reset(),Object.values(s()).forEach((e=>{e&&(e.disabled=!0)})),l.textContent="Submitted",l.disabled=!0,e.json()})).catch((()=>{l.textContent=u}))}},jr=(e,t,n,i)=>{const r=JSON.stringify({orgSlug:t,buildingSlug:e,reason:n,url:window.location.href,formIdInfo:i});fetch("https://app.meetelise.com/platformApi/webchat/form-override-error",{method:"POST",headers:{"Content-Type":"application/json","building-slug":e,"org-slug":t},body:r})};var Hr=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Gr=class extends re{constructor(){super(...arguments),this.healthcareId="",this.
|
|
3809
|
+
`,qr([ue({type:String})],Br.prototype,"buildingSlug",void 0),qr([ue({type:String})],Br.prototype,"orgSlug",void 0),qr([ue({type:Object})],Br.prototype,"launcherStyles",void 0),qr([ue()],Br.prototype,"mobileStyles",void 0),qr([ue({type:Boolean})],Br.prototype,"isMinimized",void 0),qr([ue({type:String})],Br.prototype,"brandColor",void 0),qr([le()],Br.prototype,"chatId",void 0),qr([le()],Br.prototype,"analytics",void 0),qr([le()],Br.prototype,"launcher",void 0),qr([le()],Br.prototype,"building",void 0),qr([le()],Br.prototype,"designConcept",void 0),qr([le()],Br.prototype,"leadSources",void 0),qr([le()],Br.prototype,"currentLeadSource",void 0),qr([le()],Br.prototype,"featureFlagShowDropdown",void 0),qr([le()],Br.prototype,"phoneNumberForSource",void 0),qr([le()],Br.prototype,"hasMounted",void 0),qr([le()],Br.prototype,"hideLauncher",void 0),qr([le()],Br.prototype,"isLoading",void 0),qr([le()],Br.prototype,"showTourNextToChat",void 0),qr([le()],Br.prototype,"displayPubnubChat",void 0),qr([le()],Br.prototype,"myPubnub",void 0),qr([le()],Br.prototype,"enabledChatWidgets",void 0),qr([le()],Br.prototype,"webchatConfigHasAutoOpenChat",void 0),qr([le()],Br.prototype,"requiresConsent",void 0),qr([le()],Br.prototype,"privacyPolicyUrl",void 0),Br=qr([ae("me-chat")],Br);const Lr=e=>{for(const t of e){const e=document.getElementById(t);if(e)return e}return null},Jr=async(e,n)=>{var i;if(!n||!e)return;const r=await async function(e){if(!e)return!1;try{return(await t().get(Gn(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-use-override-contact-us-form",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(n);if(!r)return;const o=Lr(["myContactForm","contactus"]);let a;if(!(o&&o instanceof HTMLFormElement)){const t=document.querySelector("form");return void(window.location.pathname.toLowerCase().includes("contactus")&&jr(n,e,"Could not find form",t?{id:t.id}:void 0))}for(let e=0;e<o.elements.length;e++){const t=o.elements[e];if("button"===t.tagName.toLowerCase()&&"fakebutton"===t.getAttribute("data-selenium-id")){a=t;break}}if(!a)return jr(n,e,"Could not find submit button");const s=()=>({firstName:Lr(["firstname","txtName"]),lastName:Lr(["lastname","txtName2"]),email:Lr(["email","txtEmail"]),phone:Lr(["phonenumber","txtPhone"]),message:Lr(["message","txtComments"])});if(Object.values(s()).some((e=>null===e))){const t=Object.entries(s()).filter((([,e])=>null===e)).map((([e])=>e));return jr(n,e,"Missing the following form elements: "+t.join(", "))}const u=a.textContent,l=a.cloneNode(!0);null===(i=a.parentNode)||void 0===i||i.replaceChild(l,a),l.onclick=async function(t){if(Object.values(s()).forEach((e=>{"true"!==(null==e?void 0:e.getAttribute("aria-required"))||e.value||(e.className="form-control required is-invalid")})),!Object.values(s()).every((e=>null!==e&&!("true"===e.getAttribute("aria-required")&&!e.value)&&("email"!==e.id&&"phonenumber"!==e.id||"true"!==e.getAttribute("aria-invalid")))))return;t.preventDefault(),l.textContent="Processing request...",l.disabled=!0;const i={};Object.entries(s()).forEach((([e,t])=>i[e]=null==t?void 0:t.value));const r=await li(e,n),a=await fi(n,document.referrer);if(!r)return jr(n,e,"Could not find building"),null;const d={email_address:i.email,first_name:i.firstName,last_name:i.lastName,phone_number:i.phone,first_message:i.message,building_id:r.id,is_external_form:!0,lead_sources:[...new Set(a?[a,"property-website"]:["property-website"])]},c=JSON.stringify(d);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":n,"org-slug":e},body:c}).then((e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return o&&o.reset(),Object.values(s()).forEach((e=>{e&&(e.disabled=!0)})),l.textContent="Submitted",l.disabled=!0,e.json()})).catch((()=>{l.textContent=u}))}},jr=(e,t,n,i)=>{const r=JSON.stringify({orgSlug:t,buildingSlug:e,reason:n,url:window.location.href,formIdInfo:i});fetch("https://app.meetelise.com/platformApi/webchat/form-override-error",{method:"POST",headers:{"Content-Type":"application/json","building-slug":e,"org-slug":t},body:r})};var Hr=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Gr=class extends re{constructor(){super(...arguments),this.healthcareId="",this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=Ae(),this.firstUpdated=async()=>{await this.initializeChatVariables()},this.initializeChatVariables=async()=>{const e=xr(this.healthcareId),t=Or(this.healthcareId,e)?e:Ar(this.healthcareId,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new Ir(this.healthcareId,null,"",this.currentLeadSource,t.leadId),t.initiatedChat&&await this.myPubnub.initializePubnub(e),this.attachOnClickToLauncher()},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),Tr(this.healthcareId),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return Vi(),U`
|
|
3782
3810
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
3783
3811
|
<div id="aria-describe-info" style="display: none;">
|
|
3784
3812
|
EliseAI widget that allows you to chat with a virtual assistant, book
|
|
@@ -3790,7 +3818,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3790
3818
|
.channel=${null===(e=this.myPubnub)||void 0===e?void 0:e.channel}
|
|
3791
3819
|
.myPubnub=${this.myPubnub}
|
|
3792
3820
|
.buildingSlug=${this.healthcareId}
|
|
3793
|
-
.onClickExit=${()=>{this.displayPubnubChat=!1
|
|
3821
|
+
.onClickExit=${()=>{this.displayPubnubChat=!1}}
|
|
3794
3822
|
.requiresConsent=${this.requiresConsent}
|
|
3795
3823
|
.privacyPolicyUrl=${this.privacyPolicyUrl}
|
|
3796
3824
|
></pubnub-chat>
|
|
@@ -3858,4 +3886,4 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3858
3886
|
line-height: 150%;
|
|
3859
3887
|
font-size: 16px;
|
|
3860
3888
|
}
|
|
3861
|
-
`,Hr([ue({type:String})],Gr.prototype,"healthcareId",void 0),Hr([le()],Gr.prototype,"
|
|
3889
|
+
`,Hr([ue({type:String})],Gr.prototype,"healthcareId",void 0),Hr([le()],Gr.prototype,"launcher",void 0),Hr([le()],Gr.prototype,"currentLeadSource",void 0),Hr([le()],Gr.prototype,"displayPubnubChat",void 0),Hr([le()],Gr.prototype,"myPubnub",void 0),Hr([le()],Gr.prototype,"requiresConsent",void 0),Hr([le()],Gr.prototype,"privacyPolicyUrl",void 0),Gr=Hr([ae("health-chat")],Gr);class zr{static healthcareStart(e,t=!0){t&&(this.healthcareId=e.id),Wr();const n=document.createElement("health-chat");n.setAttribute("class","health-chat"),n.setAttribute("role","dialog"),n.setAttribute("aria-label","EliseAI Healthcare Widget"),n.setAttribute("aria-describedby","aria-describe-info"),n.setAttribute("aria-modal","true"),n.setAttribute("healthcareId",e.id),document.body.appendChild(n),zr.healthChat=n}static start(e,t=!0){if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;t&&(this.orgSlug=e.organization,this.hasBuildingSlug=!!e.building),Wr();const n=document.createElement("me-chat");n.setAttribute("orgSlug",e.organization),this.handleBuildingslug(n,e.building),n.setAttribute("class","meetelise-chat"),n.setAttribute("role","dialog"),n.setAttribute("aria-label","EliseAI Widget"),n.setAttribute("aria-describedby","aria-describe-info"),n.setAttribute("aria-modal","true"),e.launcherStyles&&(n.launcherStyles=e.launcherStyles),e.mobileStyles&&(n.mobileStyles=e.mobileStyles),e.brandColor&&(this.brandColor=e.brandColor,n.setAttribute("brandColor",((e,t)=>{const n=(r=e,{r:parseInt(r.substring(1,3),16),g:parseInt(r.substring(3,5),16),b:parseInt(r.substring(5,7),16)}),i={r:n.r+Math.round(.3*(0-n.r)),g:n.g+Math.round(.3*(0-n.g)),b:n.b+Math.round(.3*(0-n.b))};var r;return((e,t,n)=>"#"+[e,t,n].map((e=>{const t=e.toString(16);return 1===t.length?"0"+t:t})).join(""))(i.r,i.g,i.b)})(e.brandColor))),document.body.appendChild(n),zr.meChat=n}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.meChat&&(await this.meChat.remove(),document.body.removeChild(this.meChat),zr.meChat=null)}static async handleBuildingslug(e,t){t?e.setAttribute("buildingSlug",t):this.mutationObserver||(this.handleSingleFamilyUrl(),this.previousUrl=window.location.href,document.body.addEventListener("click",(()=>{requestAnimationFrame((()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,this.handleSingleFamilyUrl())}))}),!0))}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,i=await t().get(n,{headers:{"org-slug":this.orgSlug}});if(!i||!i.data)return;const r={organization:this.orgSlug,building:i.data,brandColor:this.brandColor};this.start(r,!1)}}zr.meChat=null,zr.healthChat=null,zr.orgSlug="",zr.mutationObserver=null,zr.previousUrl="",zr.hasBuildingSlug=null,zr.brandColor="",zr.healthcareId="";const Wr=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)}})();var r=i.Z;export{r as default};
|
package/src/MyPubnub.ts
CHANGED
|
@@ -144,13 +144,15 @@ class MyPubnub {
|
|
|
144
144
|
);
|
|
145
145
|
return response.data;
|
|
146
146
|
} catch (error) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
147
|
+
if (this.building) {
|
|
148
|
+
sendLoggingEvent({
|
|
149
|
+
logTitle: "PUBNUB_ERROR_FETCHING_TOKEN",
|
|
150
|
+
logData: { error },
|
|
151
|
+
logType: LogType.error,
|
|
152
|
+
buildingSlug: this.buildingSlug,
|
|
153
|
+
orgSlug: this.orgSlug,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
154
156
|
}
|
|
155
157
|
return null;
|
|
156
158
|
}
|
|
@@ -161,13 +163,15 @@ class MyPubnub {
|
|
|
161
163
|
);
|
|
162
164
|
return response.data;
|
|
163
165
|
} catch (error) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
if (this.building) {
|
|
167
|
+
sendLoggingEvent({
|
|
168
|
+
logTitle: "PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",
|
|
169
|
+
logData: { error },
|
|
170
|
+
logType: LogType.error,
|
|
171
|
+
buildingSlug: this.buildingSlug,
|
|
172
|
+
orgSlug: this.orgSlug,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
171
175
|
}
|
|
172
176
|
return false;
|
|
173
177
|
}
|
|
@@ -193,15 +197,17 @@ class MyPubnub {
|
|
|
193
197
|
|
|
194
198
|
await apiRequestFunc();
|
|
195
199
|
} catch (retryError) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
200
|
+
if (this.building) {
|
|
201
|
+
sendLoggingEvent({
|
|
202
|
+
logTitle: "PUBNUB_ERROR_REFETCHING_TOKEN",
|
|
203
|
+
logData: {
|
|
204
|
+
retryError,
|
|
205
|
+
},
|
|
206
|
+
logType: LogType.error,
|
|
207
|
+
buildingSlug: this.buildingSlug,
|
|
208
|
+
orgSlug: this.orgSlug,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
205
211
|
}
|
|
206
212
|
}
|
|
207
213
|
}
|
|
@@ -219,17 +225,19 @@ class MyPubnub {
|
|
|
219
225
|
},
|
|
220
226
|
(status, response) => {
|
|
221
227
|
if (status.error) {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
228
|
+
if (this.building) {
|
|
229
|
+
sendLoggingEvent({
|
|
230
|
+
logTitle: "PUBNUB_WARN_FETCHING_HISTORY",
|
|
231
|
+
logData: {
|
|
232
|
+
channel: this.channel,
|
|
233
|
+
status: status,
|
|
234
|
+
response: response,
|
|
235
|
+
},
|
|
236
|
+
logType: LogType.warn,
|
|
237
|
+
buildingSlug: this.buildingSlug,
|
|
238
|
+
orgSlug: this.orgSlug,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
233
241
|
reject(status);
|
|
234
242
|
} else {
|
|
235
243
|
resolve(response);
|
|
@@ -259,13 +267,15 @@ class MyPubnub {
|
|
|
259
267
|
this.chatListener?.({ messages: this.messages, isLoading: false });
|
|
260
268
|
}
|
|
261
269
|
} catch (error) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
270
|
+
if (this.building) {
|
|
271
|
+
sendLoggingEvent({
|
|
272
|
+
logTitle: "PUBNUB_WARN_FETCHING_HISTORY",
|
|
273
|
+
logData: { error },
|
|
274
|
+
logType: LogType.warn,
|
|
275
|
+
buildingSlug: this.buildingSlug,
|
|
276
|
+
orgSlug: this.orgSlug,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
269
279
|
}
|
|
270
280
|
}
|
|
271
281
|
|
|
@@ -275,18 +285,20 @@ class MyPubnub {
|
|
|
275
285
|
this.pubnub.subscribe({ channels: [this.channel] });
|
|
276
286
|
this.pubnub.addListener(this.listenerParams);
|
|
277
287
|
} catch (error) {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
if (this.building) {
|
|
289
|
+
sendLoggingEvent({
|
|
290
|
+
logTitle: "PUBNUB_ERROR_ADDING_LISTENER",
|
|
291
|
+
logData: {
|
|
292
|
+
error,
|
|
293
|
+
channel: this.channel,
|
|
294
|
+
leadUserId: this.leadUserId,
|
|
295
|
+
website: location.href,
|
|
296
|
+
},
|
|
297
|
+
logType: LogType.error,
|
|
298
|
+
buildingSlug: this.buildingSlug,
|
|
299
|
+
orgSlug: this.orgSlug,
|
|
300
|
+
});
|
|
301
|
+
}
|
|
290
302
|
}
|
|
291
303
|
};
|
|
292
304
|
handleDisconnect = (): void => {
|
|
@@ -326,18 +338,20 @@ class MyPubnub {
|
|
|
326
338
|
this.eliseResponseTimeout = setTimeout(() => {
|
|
327
339
|
// eslint-disable-next-line no-console
|
|
328
340
|
console.error("Elise AI did not respond in time...");
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
+
if (this.building) {
|
|
342
|
+
sendLoggingEvent({
|
|
343
|
+
logTitle: "PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",
|
|
344
|
+
logData: {
|
|
345
|
+
channel: this.channel,
|
|
346
|
+
leadUserId: this.leadUserId,
|
|
347
|
+
message,
|
|
348
|
+
},
|
|
349
|
+
logType: LogType.error,
|
|
350
|
+
buildingSlug: this.buildingSlug,
|
|
351
|
+
orgSlug: this.orgSlug,
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
}, 90000); // if after 90 seconds, no message - we log error
|
|
341
355
|
|
|
342
356
|
await this.pubnub.publish({
|
|
343
357
|
channel: this.channel,
|
|
@@ -3,10 +3,6 @@ import { customElement, property, state } from "lit/decorators.js";
|
|
|
3
3
|
import { createRef, Ref } from "lit/directives/ref.js";
|
|
4
4
|
import { Launcher } from "./launcher/Launcher";
|
|
5
5
|
import "./Scheduler/tour-scheduler";
|
|
6
|
-
import Analytics from "../analytics";
|
|
7
|
-
import { Building } from "../fetchBuildingInfo";
|
|
8
|
-
import { FeatureFlagsShowDropdown } from "../fetchFeatureFlag";
|
|
9
|
-
import { NumberForSelectedSource } from "../fetchPhoneNumberFromSource";
|
|
10
6
|
import { installLauncher } from "./launcher/Launcher";
|
|
11
7
|
|
|
12
8
|
import { HeyThereEmoji } from "../svgIcons";
|
|
@@ -82,34 +78,11 @@ export class HealthChat extends LitElement {
|
|
|
82
78
|
@property({ type: String })
|
|
83
79
|
private healthcareId = "";
|
|
84
80
|
|
|
85
|
-
@state()
|
|
86
|
-
private chatId = "";
|
|
87
|
-
@state()
|
|
88
|
-
private analytics: Analytics | null = null;
|
|
89
81
|
@state()
|
|
90
82
|
private launcher: HTMLElement | null = null;
|
|
91
|
-
@state()
|
|
92
|
-
private building: Building | null = null;
|
|
93
|
-
@state()
|
|
94
|
-
private designConcept: string | null = null;
|
|
95
|
-
@state()
|
|
96
|
-
private leadSources: string[] | null = null;
|
|
97
|
-
@state()
|
|
98
|
-
private currentLeadSource: string | null = null;
|
|
99
|
-
@state()
|
|
100
|
-
private featureFlagShowDropdown: FeatureFlagsShowDropdown =
|
|
101
|
-
FeatureFlagsShowDropdown.always;
|
|
102
|
-
@state()
|
|
103
|
-
private phoneNumberForSource: NumberForSelectedSource | null = null;
|
|
104
|
-
@state()
|
|
105
|
-
private hasMounted = false;
|
|
106
|
-
@state()
|
|
107
|
-
private hideLauncher = false;
|
|
108
|
-
@state()
|
|
109
|
-
private isLoading = true;
|
|
110
83
|
|
|
111
84
|
@state()
|
|
112
|
-
private
|
|
85
|
+
private currentLeadSource: string | null = null;
|
|
113
86
|
|
|
114
87
|
@state()
|
|
115
88
|
private displayPubnubChat = false;
|
|
@@ -117,21 +90,6 @@ export class HealthChat extends LitElement {
|
|
|
117
90
|
@state()
|
|
118
91
|
private myPubnub: MyPubnub | null = null;
|
|
119
92
|
|
|
120
|
-
@state()
|
|
121
|
-
private enabledChatWidgets: {
|
|
122
|
-
call: boolean;
|
|
123
|
-
chat: boolean;
|
|
124
|
-
email: boolean;
|
|
125
|
-
text: boolean;
|
|
126
|
-
sst: boolean;
|
|
127
|
-
} = {
|
|
128
|
-
call: true,
|
|
129
|
-
chat: true,
|
|
130
|
-
email: true,
|
|
131
|
-
text: true,
|
|
132
|
-
sst: true,
|
|
133
|
-
};
|
|
134
|
-
|
|
135
93
|
@state()
|
|
136
94
|
private requiresConsent = false;
|
|
137
95
|
|
|
@@ -171,7 +129,6 @@ export class HealthChat extends LitElement {
|
|
|
171
129
|
}
|
|
172
130
|
|
|
173
131
|
this.attachOnClickToLauncher();
|
|
174
|
-
this.isLoading = false;
|
|
175
132
|
};
|
|
176
133
|
|
|
177
134
|
public async restartConversation(): Promise<void> {
|
|
@@ -210,8 +167,6 @@ export class HealthChat extends LitElement {
|
|
|
210
167
|
}
|
|
211
168
|
launcher.onChatTapped = async () => {
|
|
212
169
|
this.displayPubnubChat = true;
|
|
213
|
-
this.hideLauncher = true;
|
|
214
|
-
this.hasMounted = true;
|
|
215
170
|
};
|
|
216
171
|
};
|
|
217
172
|
|
|
@@ -233,7 +188,6 @@ export class HealthChat extends LitElement {
|
|
|
233
188
|
.buildingSlug=${this.healthcareId}
|
|
234
189
|
.onClickExit=${() => {
|
|
235
190
|
this.displayPubnubChat = false;
|
|
236
|
-
this.hideLauncher = false;
|
|
237
191
|
}}
|
|
238
192
|
.requiresConsent=${this.requiresConsent}
|
|
239
193
|
.privacyPolicyUrl=${this.privacyPolicyUrl}
|
|
@@ -175,6 +175,15 @@ export const pubnubChatStyles = css`
|
|
|
175
175
|
transform: scale(1);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
+
#footer-hc {
|
|
179
|
+
background: black;
|
|
180
|
+
padding: 0px 12px 18px;
|
|
181
|
+
color: rgba(227, 227, 227, 0.9);
|
|
182
|
+
text-align: center;
|
|
183
|
+
font-size: 10px;
|
|
184
|
+
width: 100%;
|
|
185
|
+
border-top: 2px solid rgba(0, 0, 0, 0.5);
|
|
186
|
+
}
|
|
178
187
|
|
|
179
188
|
#footer {
|
|
180
189
|
min-height: 70px;
|
|
@@ -171,7 +171,21 @@ export class PubnubChat extends LitElement {
|
|
|
171
171
|
["hidden"]: this.needsConsent(),
|
|
172
172
|
})}
|
|
173
173
|
>
|
|
174
|
-
|
|
174
|
+
<li class="message-container disclaimer-message">
|
|
175
|
+
<p class="disclaimer-inner">
|
|
176
|
+
Hi! I am a third-party bot. Your messages with me are recorded
|
|
177
|
+
by Forefront Dermatology and our vendors. By replying, you
|
|
178
|
+
consent to this
|
|
179
|
+
<a
|
|
180
|
+
href="https://www.eliseai.com/privacy/healthcare"
|
|
181
|
+
target="_blank"
|
|
182
|
+
rel="noopener noreferrer"
|
|
183
|
+
>
|
|
184
|
+
this privacy policy</a
|
|
185
|
+
>
|
|
186
|
+
and to being contacted by a bot.
|
|
187
|
+
</p>
|
|
188
|
+
</li>
|
|
175
189
|
<li class="message-container ai-message">
|
|
176
190
|
<p
|
|
177
191
|
class=${classMap({
|
|
@@ -180,7 +194,8 @@ export class PubnubChat extends LitElement {
|
|
|
180
194
|
["webchat-font__mobile"]: isMobile(),
|
|
181
195
|
})}
|
|
182
196
|
>
|
|
183
|
-
Hi
|
|
197
|
+
Hi I'm Elise. If this is a medical emergency, please call 911.
|
|
198
|
+
How can I assist you today?"
|
|
184
199
|
</p>
|
|
185
200
|
</li>
|
|
186
201
|
${this.messages.map((message) => {
|
|
@@ -219,6 +234,7 @@ export class PubnubChat extends LitElement {
|
|
|
219
234
|
: ""}
|
|
220
235
|
</ul>
|
|
221
236
|
</div>
|
|
237
|
+
|
|
222
238
|
<div
|
|
223
239
|
id="footer"
|
|
224
240
|
class=${classMap({
|
|
@@ -249,6 +265,9 @@ export class PubnubChat extends LitElement {
|
|
|
249
265
|
${SendMessageIconWhite}
|
|
250
266
|
</button>
|
|
251
267
|
</div>
|
|
268
|
+
<div id="footer-hc">
|
|
269
|
+
Recorded by Forefront Dermatology and our vendors.
|
|
270
|
+
</div>
|
|
252
271
|
</div>
|
|
253
272
|
`;
|
|
254
273
|
}
|
|
@@ -283,7 +302,9 @@ export class PubnubChat extends LitElement {
|
|
|
283
302
|
>
|
|
284
303
|
${getConsentPreChatDisclaimer(
|
|
285
304
|
this.orgSlug ?? null,
|
|
286
|
-
this.
|
|
305
|
+
this.building
|
|
306
|
+
? this.privacyPolicyUrl
|
|
307
|
+
: "https://www.eliseai.com/privacy/healthcare",
|
|
287
308
|
(hasConsent: boolean) => {
|
|
288
309
|
this.hasReceivedConsent = hasConsent;
|
|
289
310
|
}
|