@meetelise/chat 1.43.21 → 1.43.23
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/dist/src/logCdnVersion.d.ts +3 -0
- package/package.json +1 -1
- package/public/dist/index.js +19 -19
- package/src/WebComponent/me-chat.ts +8 -0
- package/src/logCdnVersion.ts +67 -0
package/package.json
CHANGED
package/public/dist/index.js
CHANGED
|
@@ -5521,7 +5521,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
5521
5521
|
${xr}
|
|
5522
5522
|
${Ar}
|
|
5523
5523
|
${Sr}
|
|
5524
|
-
`,va([ue({attribute:!0})],wa.prototype,"isMinimized",void 0),va([ue()],wa.prototype,"mobileStyles",void 0),va([ue({type:Boolean})],wa.prototype,"isFirstMount",void 0),va([ue({attribute:!1})],wa.prototype,"autoOpenChatWidget",void 0),va([ue()],wa.prototype,"phoneNumber",void 0),va([ue({attribute:!0})],wa.prototype,"buildingName",void 0),va([ue({attribute:!0})],wa.prototype,"chatId",void 0),va([ue({attribute:!0})],wa.prototype,"orgLegalName",void 0),va([ue({attribute:!0})],wa.prototype,"chatCallUsHeader",void 0),va([ue({attribute:!1})],wa.prototype,"buildingId",void 0),va([ue({attribute:!0})],wa.prototype,"buildingSlug",void 0),va([ue({attribute:!0})],wa.prototype,"orgSlug",void 0),va([ue({attribute:!0})],wa.prototype,"sgtUrl",void 0),va([ue({attribute:!0})],wa.prototype,"selfGuidedTourEnabled",void 0),va([ue({attribute:!0})],wa.prototype,"selfGuidedToursTypeOffered",void 0),va([ue({attribute:!0})],wa.prototype,"designConcept",void 0),va([ue({attribute:!0})],wa.prototype,"featureFlagShowDropdown",void 0),va([ue({attribute:!1})],wa.prototype,"leadSources",void 0),va([ue({attribute:!0})],wa.prototype,"currentLeadSource",void 0),va([ue({attribute:!0})],wa.prototype,"escortedToursLink",void 0),va([ue({attribute:!0})],wa.prototype,"escortedToursTypeOffered",void 0),va([ue({attribute:!0})],wa.prototype,"virtualToursLink",void 0),va([ue({attribute:!0})],wa.prototype,"virtualToursTypeOffered",void 0),va([ue({type:Boolean})],wa.prototype,"hasChatEnabledDesktop",void 0),va([ue({type:Boolean})],wa.prototype,"hasChatEnabledMobile",void 0),va([ue({type:Boolean})],wa.prototype,"hasEmailEnabledDesktop",void 0),va([ue({type:Boolean})],wa.prototype,"hasEmailEnabledMobile",void 0),va([ue({attribute:!0})],wa.prototype,"hasApplyNowEnabledDesktop",void 0),va([ue({attribute:!0})],wa.prototype,"hasApplyNowEnabledMobile",void 0),va([ue({attribute:!0})],wa.prototype,"applicationLink",void 0),va([ue({type:Boolean})],wa.prototype,"hasCallUsEnabledDesktop",void 0),va([ue({type:Boolean})],wa.prototype,"hasCallUsEnabledMobile",void 0),va([ue({type:Boolean})],wa.prototype,"hasTextUsEnabledDesktop",void 0),va([ue({type:Boolean})],wa.prototype,"hasTextUsEnabledMobile",void 0),va([ue({type:Boolean})],wa.prototype,"hasSSTEnabledDesktop",void 0),va([ue({type:Boolean})],wa.prototype,"hasSSTEnabledMobile",void 0),va([ue({attribute:!1})],wa.prototype,"tourTypeOptions",void 0),va([ue({attribute:!0})],wa.prototype,"hasDynamicSchedulingEnabled",void 0),va([ue({attribute:!0})],wa.prototype,"hasPricingCalculatorEnabledDesktop",void 0),va([ue({attribute:!0})],wa.prototype,"hasPricingCalculatorEnabledMobile",void 0),va([ue({attribute:!1})],wa.prototype,"hasHideMobileFeatures",void 0),va([ue({type:Number})],wa.prototype,"right",void 0),va([ue({type:Number})],wa.prototype,"bottom",void 0),va([ue({type:Number})],wa.prototype,"top",void 0),va([ue({type:Number})],wa.prototype,"left",void 0),va([ue({attribute:!0})],wa.prototype,"showTourNextToChat",void 0),va([ue({attribute:!1})],wa.prototype,"onChatTapped",void 0),va([ue({attribute:!0})],wa.prototype,"onClickMinimize",void 0),va([ue({attribute:!0})],wa.prototype,"onSstClose",void 0),va([ue({attribute:!0})],wa.prototype,"overrideRentgrata",void 0),va([ue({attribute:!1})],wa.prototype,"launcherStyles",void 0),va([ue({attribute:!0})],wa.prototype,"primaryColor",void 0),va([ue({attribute:!0})],wa.prototype,"backgroundColor",void 0),va([ue({attribute:!0})],wa.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),va([ue({attribute:!0})],wa.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),va([ue({attribute:!0})],wa.prototype,"leadSourceClient",void 0),va([ce()],wa.prototype,"leadSourceMultitouchClient",void 0),va([ce()],wa.prototype,"isEmailWindowOpen",void 0),va([ce()],wa.prototype,"isCallUsWindowOpen",void 0),va([ce()],wa.prototype,"isSSTWindowOpen",void 0),va([ce()],wa.prototype,"isTextUsWindowOpen",void 0),va([ce()],wa.prototype,"isCalculatorWindowOpen",void 0),va([ce()],wa.prototype,"isMobileFeaturesExpanded",void 0),wa=va([se("meetelise-launcher")],wa);const Ca=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",wa)},xa=["app.meetelise.com","staging.eliseai.com","localhost"],Aa={calculator:{desktop:"calcDesktop",mobile:"calcMobile"},email:{desktop:"emailDesktop",mobile:"emailMobile"},call:{desktop:"callDesktop",mobile:"callMobile"},text:{desktop:"textDesktop",mobile:"textMobile"},sst:{desktop:"sstDesktop",mobile:"sstMobile"}},Sa=e=>{const t=window.location.hostname;if(!xa.includes(t))return e;const n=(e=>{if(!e)return{};try{return e.split(",").reduce((e,t)=>{const[n,i]=t.split(":");return n&&i&&n in Aa&&(e[n]="true"===i.toLowerCase()),e},{})}catch(e){return{}}})(new URLSearchParams(window.location.search).get("widgets"));if(0===Object.keys(n).length)return e;const i={...e};return Object.entries(n).forEach(([e,t])=>{const n=Aa[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var Ea=n(5072),ka=n.n(Ea),Ta=n(7825),_a=n.n(Ta),Oa=n(7659),Pa=n.n(Oa),Ia=n(5056),Na=n.n(Ia),Ma=n(540),Da=n.n(Ma),Ua=n(1113),La=n.n(Ua),Ra=n(5541),Ba={};Ba.styleTagTransform=La(),Ba.setAttributes=Na(),Ba.insert=Pa().bind(null,"head"),Ba.domAPI=_a(),Ba.insertStyleElement=Da();ka()(Ra.A,Ba);Ra.A&&Ra.A.locals&&Ra.A.locals;async function ja(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${t}/lead-sources`);if(n.data){if("7e352741-1120-4ccf-9929-5dc99193a908"===e){const e=["Zillow","Apartments.com","Google PPC","Google Maps","Apple Maps","Social Media","Print Marketing"];return n.data.filter(t=>e.includes(t))}return Fa(n.data,t)}return[]}catch(e){return[]}}const Fa=(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 Ha,$a=n(8805),za=n.n($a),Ga=new Uint8Array(16);function Qa(){if(!Ha&&!(Ha="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 Ha(Ga)}const qa=/^(?:[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;const Wa=function(e){return"string"==typeof e&&qa.test(e)};for(var Va=[],Ya=0;Ya<256;++Ya)Va.push((Ya+256).toString(16).substr(1));const Ka=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Va[e[t+0]]+Va[e[t+1]]+Va[e[t+2]]+Va[e[t+3]]+"-"+Va[e[t+4]]+Va[e[t+5]]+"-"+Va[e[t+6]]+Va[e[t+7]]+"-"+Va[e[t+8]]+Va[e[t+9]]+"-"+Va[e[t+10]]+Va[e[t+11]]+Va[e[t+12]]+Va[e[t+13]]+Va[e[t+14]]+Va[e[t+15]]).toLowerCase();if(!Wa(n))throw TypeError("Stringified UUID is invalid");return n};const Xa=function(e,t,n){var i=(e=e||{}).random||(e.rng||Qa)();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 Ka(i)},Za=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Ja=(e,t,n)=>{const i=En(new Date),r=n||`lead_${Xa()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Mn(i),buildingSlug:e,initiatedChat:t}},es=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(ts(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},ts=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(dn(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!yn(t.timestamp,24)};var ns;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(ns||(ns={}));const is=e=>e.type===os.text,rs=e=>e.type===os.media;var os;!function(e){e.text="text",e.media="media"}(os||(os={}));const as=class{constructor(e,t,n,i=null,r,o,a=null,s=Vl.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.widgetType=Vl.Default,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t,n;const i={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,i],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter(e=>e.message.messageType!==ns.noReply),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const r="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;if(null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:r}),!r&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=r,"ai_message"===e.message.customType){this.simpleChatMessages.some(e=>e.type===os.text&&e.message.includes("confirmed for your"))&&ni("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}this.checkAndHandleGTMForLeadEmail(e)}},this.isLoadingMessages=!1,this.isFirstChatMessageSent=!1,this.streamingMessageTimeout=null,this.checkAndHandleDelayStreamingMessages=({delayToFetchHistoryInMs:e=1e4}={})=>{this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null);const t=this.simpleChatMessages.some(e=>{if(!is(e))return!1;const t=e.chunks.find(e=>e.isDone);return!t||e.chunks.length===t.order});t&&(this.streamingMessageTimeout=setTimeout(()=>{vi({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:bi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory()},e))},this.checkAndHandleGTMForLeadEmail=e=>{var t;try{if("lead_message"!==e.message.customType)return;if(!(e=>{try{return/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b/.test(e)}catch(e){return!1}})(e.message.text))return;ni("leadProvidedEmail",{buildingId:null===(t=this.buildingWebchatView)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}catch(e){return}},this.markEveryPreviousNoReplyMessageDone=e=>{var t,n;for(let i=e.length-1;i>=0;i--){const r=null===(t=e[i])||void 0===t?void 0:t.message,o=i>0&&(null===(n=e[i-1])||void 0===n?void 0:n.message);(null==r?void 0:r.messageType)===ns.noReply&&o&&(o.is_done=!0)}},this.checkMessageChunkValid=e=>{try{return!!e.message&&!!e.message.text&&e.message.text.length>0&&!!e.message.customType}catch(e){return!1}},this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.buildingWebchatView&&vi({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:bi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=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=Ja(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken(async()=>{var t,n,i,r,o,a,s,l,u;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout(()=>{this.buildingWebchatView&&vi({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:bi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})},9e4),0===this.simpleChatMessages.length&&(null===(t=this.leadSourceClient)||void 0===t||t.checkAndHandleForLogLeadSource({webchatAction:"chat",stateId:null})),this.widgetType===Vl.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),orgSlug:this.orgSlug}}):(await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,userId:null===(i=this.buildingWebchatView)||void 0===i?void 0:i.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),lead_sources_with_timestamps:(null!==(o=null===(r=this.leadSourceMultitouchClient)||void 0===r?void 0:r.getSafeLeadSourceTouchpointsWithDefault({includedUserSelectedLeadSource:null}))&&void 0!==o?o:[]).map(e=>gn({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||(ni("firstChatMessageSent",{message:e,buildingId:null===(l=this.buildingWebchatView)||void 0===l?void 0:l.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),ni("chatMessageSent",{message:e,buildingId:null===(u=this.buildingWebchatView)||void 0===u?void 0:u.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))}),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.removeDuplicatedRawPubnubMessages=e=>{const t=new Set;return e.filter(e=>{if("lead_message"===e.message.customType||!e.message.stream_id||!e.message.order)return!0;const n=`${e.message.stream_id}-${e.message.order}-${e.message.messageType}`;return t.has(n)?(vi({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:bi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),!1):(t.add(n),!0)})},this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],n={};return this.removeDuplicatedRawPubnubMessages(e).forEach(e=>{var i;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:os.media}):!e.message.stream_id||e.message.is_done&&0===e.message.order?t.push({timestamp:e.timetoken,message:e.message.text,isLeadMessage:this.isLeadMessage(e),chunks:[{text:e.message.text,order:0,isDone:!0}],type:os.text}):n[e.message.stream_id]?n[e.message.stream_id].push(e):n[e.message.stream_id]=[e]}),Object.keys(n).forEach(e=>{const i=n[e],r=this.getConsecutiveChunks(i.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)})),o=r.map(e=>e.message.text).join(""),a=r[0],s={timestamp:a.timetoken,message:o,isLeadMessage:this.isLeadMessage(a),chunks:r.map(e=>{var t,n;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(n=e.message.is_done)&&void 0!==n&&n}}),type:os.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)}),t.sort((e,t)=>e.timestamp-t.timestamp),t},this.getConsecutiveChunks=e=>{var t,n;const i=e.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}),r=[];let o=null!==(t=i[0].message.order)&&void 0!==t?t:0;for(const e of i){if((null!==(n=e.message.order)&&void 0!==n?n:-1)!==o)break;r.push(e),o++}return r},this.isMessageStillStreamingChunks=e=>{const t=e.find(e=>e.message.is_done);return!t||e.length===t.message.order},this.buildingSlug=e,this.buildingWebchatView=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=a,this.leadSourceMultitouchClient=o,this.widgetType=s}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(za())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token,origin:"meetelise.pubnubapi.com"}),this.withAuthToken(()=>new Promise(()=>this.handleChatListeners())),await this.withAuthToken(()=>this.getChannelHistory()),this.pubnub):void 0}async fetchToken(e,t){try{return(await r().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${t}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.buildingWebchatView&&vi({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:bi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await r().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.buildingWebchatView&&vi({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:bi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(e){try{await e()}catch(t){if(t instanceof i.AxiosError&&t&&t.response&&403===t.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const t=await this.fetchToken(this.leadUserId,this.channel);if(!t)return;this.pubnub.setAuthKey(t.auth.result.token),await e()}catch(e){this.buildingWebchatView&&vi({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:bi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let n=[],i=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise((n,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=i?i:void 0},(e,t)=>{e.error?o(e):n(t)})}),a=o.channels[this.channel];if(!a)break;if(a.sort((e,t)=>+e.timetoken-+t.timetoken),!a||0===a.length)break;if(this.channel&&0!==Object.keys(o.channels).length){const e=o.channels[this.channel],t=[];e.forEach(e=>{e.uuid&&t.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})}),this.markEveryPreviousNoReplyMessageDone(t),n=n.concat(t.filter(e=>e.message.messageType!==ns.noReply))}if(i=a[0].timetoken,n.length>=e||a.length<r)break}this.rawPubnubMessages=n.slice(0,e),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:!1})}catch(e){this.buildingWebchatView&&vi({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:bi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},ss=(e,t,n)=>{const i=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1"),r=`tel:${i}`,o=`sms:${i}`,a=`whatsapp://send?phone=${i}`,s=`facetime:${i}`,l=`facetime-audio:${i}`,u=/(?:\+1\s)?(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}/g,c=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,d=/whatsapp:\/\/send\?phone=\d+/g,h=/(facetime|facetime-audio):\d+/g,p=document.body.getElementsByTagName("*");let f=!1;const g=i.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let m=!1,y=!1,b=0;for(let e=0;e<p.length;e++)if(p[e].nodeType===Node.ELEMENT_NODE){if(1===p[e].childNodes.length&&p[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=p[e].textContent;if(!t)continue;const n=t.replace(u,e=>e.startsWith("+1 ")?`+1 ${g}`:g);t!==n&&(b++,p[e].textContent=n),f=!0,m||(m=!0)}if(p[e].hasAttribute("href")){const t=p[e].getAttribute("href");if(!t)continue;let n="",i=c;t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=d):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r;const u=t.replace(i,n);if(p[e].setAttribute("href",u),(t.startsWith("tel:")||t.startsWith("sms:"))&&u===t&&u!==n){t.replace(/\D/g,"").length>=7&&p[e].setAttribute("href",t.startsWith("tel:")?r:o)}y||(y=!0)}}return m&&vi({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:g,website:window.location.href},logType:bi.info,buildingSlug:n,orgSlug:t}),y&&vi({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:g,website:window.location.href},logType:bi.info,buildingSlug:n,orgSlug:t}),f||vi({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:bi.warn,buildingSlug:n,orgSlug:t}),b};var ls=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 us=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=Le,this.toExpand=!1}render(){return B`
|
|
5524
|
+
`,va([ue({attribute:!0})],wa.prototype,"isMinimized",void 0),va([ue()],wa.prototype,"mobileStyles",void 0),va([ue({type:Boolean})],wa.prototype,"isFirstMount",void 0),va([ue({attribute:!1})],wa.prototype,"autoOpenChatWidget",void 0),va([ue()],wa.prototype,"phoneNumber",void 0),va([ue({attribute:!0})],wa.prototype,"buildingName",void 0),va([ue({attribute:!0})],wa.prototype,"chatId",void 0),va([ue({attribute:!0})],wa.prototype,"orgLegalName",void 0),va([ue({attribute:!0})],wa.prototype,"chatCallUsHeader",void 0),va([ue({attribute:!1})],wa.prototype,"buildingId",void 0),va([ue({attribute:!0})],wa.prototype,"buildingSlug",void 0),va([ue({attribute:!0})],wa.prototype,"orgSlug",void 0),va([ue({attribute:!0})],wa.prototype,"sgtUrl",void 0),va([ue({attribute:!0})],wa.prototype,"selfGuidedTourEnabled",void 0),va([ue({attribute:!0})],wa.prototype,"selfGuidedToursTypeOffered",void 0),va([ue({attribute:!0})],wa.prototype,"designConcept",void 0),va([ue({attribute:!0})],wa.prototype,"featureFlagShowDropdown",void 0),va([ue({attribute:!1})],wa.prototype,"leadSources",void 0),va([ue({attribute:!0})],wa.prototype,"currentLeadSource",void 0),va([ue({attribute:!0})],wa.prototype,"escortedToursLink",void 0),va([ue({attribute:!0})],wa.prototype,"escortedToursTypeOffered",void 0),va([ue({attribute:!0})],wa.prototype,"virtualToursLink",void 0),va([ue({attribute:!0})],wa.prototype,"virtualToursTypeOffered",void 0),va([ue({type:Boolean})],wa.prototype,"hasChatEnabledDesktop",void 0),va([ue({type:Boolean})],wa.prototype,"hasChatEnabledMobile",void 0),va([ue({type:Boolean})],wa.prototype,"hasEmailEnabledDesktop",void 0),va([ue({type:Boolean})],wa.prototype,"hasEmailEnabledMobile",void 0),va([ue({attribute:!0})],wa.prototype,"hasApplyNowEnabledDesktop",void 0),va([ue({attribute:!0})],wa.prototype,"hasApplyNowEnabledMobile",void 0),va([ue({attribute:!0})],wa.prototype,"applicationLink",void 0),va([ue({type:Boolean})],wa.prototype,"hasCallUsEnabledDesktop",void 0),va([ue({type:Boolean})],wa.prototype,"hasCallUsEnabledMobile",void 0),va([ue({type:Boolean})],wa.prototype,"hasTextUsEnabledDesktop",void 0),va([ue({type:Boolean})],wa.prototype,"hasTextUsEnabledMobile",void 0),va([ue({type:Boolean})],wa.prototype,"hasSSTEnabledDesktop",void 0),va([ue({type:Boolean})],wa.prototype,"hasSSTEnabledMobile",void 0),va([ue({attribute:!1})],wa.prototype,"tourTypeOptions",void 0),va([ue({attribute:!0})],wa.prototype,"hasDynamicSchedulingEnabled",void 0),va([ue({attribute:!0})],wa.prototype,"hasPricingCalculatorEnabledDesktop",void 0),va([ue({attribute:!0})],wa.prototype,"hasPricingCalculatorEnabledMobile",void 0),va([ue({attribute:!1})],wa.prototype,"hasHideMobileFeatures",void 0),va([ue({type:Number})],wa.prototype,"right",void 0),va([ue({type:Number})],wa.prototype,"bottom",void 0),va([ue({type:Number})],wa.prototype,"top",void 0),va([ue({type:Number})],wa.prototype,"left",void 0),va([ue({attribute:!0})],wa.prototype,"showTourNextToChat",void 0),va([ue({attribute:!1})],wa.prototype,"onChatTapped",void 0),va([ue({attribute:!0})],wa.prototype,"onClickMinimize",void 0),va([ue({attribute:!0})],wa.prototype,"onSstClose",void 0),va([ue({attribute:!0})],wa.prototype,"overrideRentgrata",void 0),va([ue({attribute:!1})],wa.prototype,"launcherStyles",void 0),va([ue({attribute:!0})],wa.prototype,"primaryColor",void 0),va([ue({attribute:!0})],wa.prototype,"backgroundColor",void 0),va([ue({attribute:!0})],wa.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),va([ue({attribute:!0})],wa.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),va([ue({attribute:!0})],wa.prototype,"leadSourceClient",void 0),va([ce()],wa.prototype,"leadSourceMultitouchClient",void 0),va([ce()],wa.prototype,"isEmailWindowOpen",void 0),va([ce()],wa.prototype,"isCallUsWindowOpen",void 0),va([ce()],wa.prototype,"isSSTWindowOpen",void 0),va([ce()],wa.prototype,"isTextUsWindowOpen",void 0),va([ce()],wa.prototype,"isCalculatorWindowOpen",void 0),va([ce()],wa.prototype,"isMobileFeaturesExpanded",void 0),wa=va([se("meetelise-launcher")],wa);const Ca=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",wa)},xa=["app.meetelise.com","staging.eliseai.com","localhost"],Aa={calculator:{desktop:"calcDesktop",mobile:"calcMobile"},email:{desktop:"emailDesktop",mobile:"emailMobile"},call:{desktop:"callDesktop",mobile:"callMobile"},text:{desktop:"textDesktop",mobile:"textMobile"},sst:{desktop:"sstDesktop",mobile:"sstMobile"}},Sa=e=>{const t=window.location.hostname;if(!xa.includes(t))return e;const n=(e=>{if(!e)return{};try{return e.split(",").reduce((e,t)=>{const[n,i]=t.split(":");return n&&i&&n in Aa&&(e[n]="true"===i.toLowerCase()),e},{})}catch(e){return{}}})(new URLSearchParams(window.location.search).get("widgets"));if(0===Object.keys(n).length)return e;const i={...e};return Object.entries(n).forEach(([e,t])=>{const n=Aa[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var Ea=n(5072),ka=n.n(Ea),Ta=n(7825),_a=n.n(Ta),Oa=n(7659),Pa=n.n(Oa),Ia=n(5056),Na=n.n(Ia),Ma=n(540),Da=n.n(Ma),Ua=n(1113),La=n.n(Ua),Ra=n(5541),Ba={};Ba.styleTagTransform=La(),Ba.setAttributes=Na(),Ba.insert=Pa().bind(null,"head"),Ba.domAPI=_a(),Ba.insertStyleElement=Da();ka()(Ra.A,Ba);Ra.A&&Ra.A.locals&&Ra.A.locals;async function ja(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${t}/lead-sources`);if(n.data){if("7e352741-1120-4ccf-9929-5dc99193a908"===e){const e=["Zillow","Apartments.com","Google PPC","Google Maps","Apple Maps","Social Media","Print Marketing"];return n.data.filter(t=>e.includes(t))}return Fa(n.data,t)}return[]}catch(e){return[]}}const Fa=(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 Ha,$a=n(8805),za=n.n($a),Ga=new Uint8Array(16);function Qa(){if(!Ha&&!(Ha="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 Ha(Ga)}const qa=/^(?:[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;const Wa=function(e){return"string"==typeof e&&qa.test(e)};for(var Va=[],Ya=0;Ya<256;++Ya)Va.push((Ya+256).toString(16).substr(1));const Ka=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Va[e[t+0]]+Va[e[t+1]]+Va[e[t+2]]+Va[e[t+3]]+"-"+Va[e[t+4]]+Va[e[t+5]]+"-"+Va[e[t+6]]+Va[e[t+7]]+"-"+Va[e[t+8]]+Va[e[t+9]]+"-"+Va[e[t+10]]+Va[e[t+11]]+Va[e[t+12]]+Va[e[t+13]]+Va[e[t+14]]+Va[e[t+15]]).toLowerCase();if(!Wa(n))throw TypeError("Stringified UUID is invalid");return n};const Xa=function(e,t,n){var i=(e=e||{}).random||(e.rng||Qa)();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 Ka(i)},Za=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Ja=(e,t,n)=>{const i=En(new Date),r=n||`lead_${Xa()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Mn(i),buildingSlug:e,initiatedChat:t}},es=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(ts(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},ts=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(dn(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!yn(t.timestamp,24)};var ns;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(ns||(ns={}));const is=e=>e.type===os.text,rs=e=>e.type===os.media;var os;!function(e){e.text="text",e.media="media"}(os||(os={}));const as=class{constructor(e,t,n,i=null,r,o,a=null,s=Xl.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.widgetType=Xl.Default,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t,n;const i={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,i],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter(e=>e.message.messageType!==ns.noReply),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const r="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;if(null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:r}),!r&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=r,"ai_message"===e.message.customType){this.simpleChatMessages.some(e=>e.type===os.text&&e.message.includes("confirmed for your"))&&ni("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}this.checkAndHandleGTMForLeadEmail(e)}},this.isLoadingMessages=!1,this.isFirstChatMessageSent=!1,this.streamingMessageTimeout=null,this.checkAndHandleDelayStreamingMessages=({delayToFetchHistoryInMs:e=1e4}={})=>{this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null);const t=this.simpleChatMessages.some(e=>{if(!is(e))return!1;const t=e.chunks.find(e=>e.isDone);return!t||e.chunks.length===t.order});t&&(this.streamingMessageTimeout=setTimeout(()=>{vi({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:bi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory()},e))},this.checkAndHandleGTMForLeadEmail=e=>{var t;try{if("lead_message"!==e.message.customType)return;if(!(e=>{try{return/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b/.test(e)}catch(e){return!1}})(e.message.text))return;ni("leadProvidedEmail",{buildingId:null===(t=this.buildingWebchatView)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}catch(e){return}},this.markEveryPreviousNoReplyMessageDone=e=>{var t,n;for(let i=e.length-1;i>=0;i--){const r=null===(t=e[i])||void 0===t?void 0:t.message,o=i>0&&(null===(n=e[i-1])||void 0===n?void 0:n.message);(null==r?void 0:r.messageType)===ns.noReply&&o&&(o.is_done=!0)}},this.checkMessageChunkValid=e=>{try{return!!e.message&&!!e.message.text&&e.message.text.length>0&&!!e.message.customType}catch(e){return!1}},this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.buildingWebchatView&&vi({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:bi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=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=Ja(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken(async()=>{var t,n,i,r,o,a,s,l,u;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout(()=>{this.buildingWebchatView&&vi({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:bi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})},9e4),0===this.simpleChatMessages.length&&(null===(t=this.leadSourceClient)||void 0===t||t.checkAndHandleForLogLeadSource({webchatAction:"chat",stateId:null})),this.widgetType===Xl.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),orgSlug:this.orgSlug}}):(await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,userId:null===(i=this.buildingWebchatView)||void 0===i?void 0:i.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),lead_sources_with_timestamps:(null!==(o=null===(r=this.leadSourceMultitouchClient)||void 0===r?void 0:r.getSafeLeadSourceTouchpointsWithDefault({includedUserSelectedLeadSource:null}))&&void 0!==o?o:[]).map(e=>gn({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||(ni("firstChatMessageSent",{message:e,buildingId:null===(l=this.buildingWebchatView)||void 0===l?void 0:l.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),ni("chatMessageSent",{message:e,buildingId:null===(u=this.buildingWebchatView)||void 0===u?void 0:u.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))}),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.removeDuplicatedRawPubnubMessages=e=>{const t=new Set;return e.filter(e=>{if("lead_message"===e.message.customType||!e.message.stream_id||!e.message.order)return!0;const n=`${e.message.stream_id}-${e.message.order}-${e.message.messageType}`;return t.has(n)?(vi({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:bi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),!1):(t.add(n),!0)})},this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],n={};return this.removeDuplicatedRawPubnubMessages(e).forEach(e=>{var i;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:os.media}):!e.message.stream_id||e.message.is_done&&0===e.message.order?t.push({timestamp:e.timetoken,message:e.message.text,isLeadMessage:this.isLeadMessage(e),chunks:[{text:e.message.text,order:0,isDone:!0}],type:os.text}):n[e.message.stream_id]?n[e.message.stream_id].push(e):n[e.message.stream_id]=[e]}),Object.keys(n).forEach(e=>{const i=n[e],r=this.getConsecutiveChunks(i.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)})),o=r.map(e=>e.message.text).join(""),a=r[0],s={timestamp:a.timetoken,message:o,isLeadMessage:this.isLeadMessage(a),chunks:r.map(e=>{var t,n;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(n=e.message.is_done)&&void 0!==n&&n}}),type:os.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)}),t.sort((e,t)=>e.timestamp-t.timestamp),t},this.getConsecutiveChunks=e=>{var t,n;const i=e.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}),r=[];let o=null!==(t=i[0].message.order)&&void 0!==t?t:0;for(const e of i){if((null!==(n=e.message.order)&&void 0!==n?n:-1)!==o)break;r.push(e),o++}return r},this.isMessageStillStreamingChunks=e=>{const t=e.find(e=>e.message.is_done);return!t||e.length===t.message.order},this.buildingSlug=e,this.buildingWebchatView=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=a,this.leadSourceMultitouchClient=o,this.widgetType=s}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(za())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token,origin:"meetelise.pubnubapi.com"}),this.withAuthToken(()=>new Promise(()=>this.handleChatListeners())),await this.withAuthToken(()=>this.getChannelHistory()),this.pubnub):void 0}async fetchToken(e,t){try{return(await r().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${t}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.buildingWebchatView&&vi({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:bi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await r().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.buildingWebchatView&&vi({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:bi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(e){try{await e()}catch(t){if(t instanceof i.AxiosError&&t&&t.response&&403===t.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const t=await this.fetchToken(this.leadUserId,this.channel);if(!t)return;this.pubnub.setAuthKey(t.auth.result.token),await e()}catch(e){this.buildingWebchatView&&vi({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:bi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let n=[],i=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise((n,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=i?i:void 0},(e,t)=>{e.error?o(e):n(t)})}),a=o.channels[this.channel];if(!a)break;if(a.sort((e,t)=>+e.timetoken-+t.timetoken),!a||0===a.length)break;if(this.channel&&0!==Object.keys(o.channels).length){const e=o.channels[this.channel],t=[];e.forEach(e=>{e.uuid&&t.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})}),this.markEveryPreviousNoReplyMessageDone(t),n=n.concat(t.filter(e=>e.message.messageType!==ns.noReply))}if(i=a[0].timetoken,n.length>=e||a.length<r)break}this.rawPubnubMessages=n.slice(0,e),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:!1})}catch(e){this.buildingWebchatView&&vi({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:bi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},ss=(e,t,n)=>{const i=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1"),r=`tel:${i}`,o=`sms:${i}`,a=`whatsapp://send?phone=${i}`,s=`facetime:${i}`,l=`facetime-audio:${i}`,u=/(?:\+1\s)?(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}/g,c=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,d=/whatsapp:\/\/send\?phone=\d+/g,h=/(facetime|facetime-audio):\d+/g,p=document.body.getElementsByTagName("*");let f=!1;const g=i.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let m=!1,y=!1,b=0;for(let e=0;e<p.length;e++)if(p[e].nodeType===Node.ELEMENT_NODE){if(1===p[e].childNodes.length&&p[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=p[e].textContent;if(!t)continue;const n=t.replace(u,e=>e.startsWith("+1 ")?`+1 ${g}`:g);t!==n&&(b++,p[e].textContent=n),f=!0,m||(m=!0)}if(p[e].hasAttribute("href")){const t=p[e].getAttribute("href");if(!t)continue;let n="",i=c;t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=d):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r;const u=t.replace(i,n);if(p[e].setAttribute("href",u),(t.startsWith("tel:")||t.startsWith("sms:"))&&u===t&&u!==n){t.replace(/\D/g,"").length>=7&&p[e].setAttribute("href",t.startsWith("tel:")?r:o)}y||(y=!0)}}return m&&vi({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:g,website:window.location.href},logType:bi.info,buildingSlug:n,orgSlug:t}),y&&vi({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:g,website:window.location.href},logType:bi.info,buildingSlug:n,orgSlug:t}),f||vi({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:bi.warn,buildingSlug:n,orgSlug:t}),b};var ls=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 us=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=Le,this.toExpand=!1}render(){return B`
|
|
5525
5525
|
<div
|
|
5526
5526
|
class=${this.toExpand?"button-container mini":"button-container"}
|
|
5527
5527
|
@click=${this.onClick}
|
|
@@ -6035,7 +6035,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6035
6035
|
transform: rotate(360deg);
|
|
6036
6036
|
}
|
|
6037
6037
|
}
|
|
6038
|
-
`,bl([ue({type:Number})],vl.prototype,"spinSpeed",void 0),vl=bl([se("mini-loader")],vl);var wl=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 Cl=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.loadingPreviews=!0,this.websitePreviewInfo=[],this.imagesToDisplay=[],this.imageUrlError=[],this.isLeadMessage=!1,this.widgetType=
|
|
6038
|
+
`,bl([ue({type:Number})],vl.prototype,"spinSpeed",void 0),vl=bl([se("mini-loader")],vl);var wl=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 Cl=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.loadingPreviews=!0,this.websitePreviewInfo=[],this.imagesToDisplay=[],this.imageUrlError=[],this.isLeadMessage=!1,this.widgetType=Xl.Default}isMessageStillStreamingChunks(){if(!this.message)return!1;const e=this.message.chunks.find(e=>e.isDone);return!e||this.message.chunks.length===e.order}updated(e){if(this.onMount(),!e.has("message"))return;if(!this.message)return;const{hyperlinks:t,markedText:n}=this.mapAndMarkHyperLinks(this.message.message),i=/(https?:\/\/[^\s]+)/g,r=[],o=[];this.parsedMessage=B`${n.trim().split("\n").map(e=>{const n=this.sanitizeMarkdownText(e),a=this.preserveHTMLTags(n);return a?B`${a.map(e=>{if(t.find(t=>t.id===e)){const n=t.find(t=>t.id===e);if(!n)return;return o.push({redirectTo:null==n?void 0:n.link,source:null==n?void 0:n.link}),B`<a
|
|
6039
6039
|
class="redirect-link"
|
|
6040
6040
|
href="${null==n?void 0:n.link}"
|
|
6041
6041
|
target="_blank"
|
|
@@ -6050,7 +6050,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6050
6050
|
</a>`}return B`${ri(yl.sanitize(e))} `})}<br />`:B``})}`,this.imagesToDisplay=o,Promise.all(r).then(e=>{this.websitePreviewInfo=e})}preserveHTMLTags(e){var t;const n=e.match(/(<\/?[a-z][^>]*>[^<]*<\/?[a-z]*>|[^\s]+[.,?!]?|\S)/gi);return null!==(t=null==n?void 0:n.filter(e=>""!==e.trim()))&&void 0!==t?t:[]}sanitizeMarkdownText(e){return e.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*?)\*\*/gim,"<b>$1</b>").replace(/\*(.*?)\*/gim,"<i>$1</i>").trim()}removeTrailingPunctuation(e){return[".",",","!","?",":",";"].includes(e[e.length-1])?this.removeTrailingPunctuation(e.slice(0,-1)):e}mapAndMarkHyperLinks(e){const t=Array.from(e.matchAll(/<https?:\/\/[^|]+\|[^>]+>|<a href="[^"]+"(?: target="[^"]*")?>[^<]+<\/a>|\[.*?\]\([^)]*\.[^)]*\)/g)),n=[],i=t.map(t=>{const n=t[0];if(void 0===t.index)return;const i=e[t.index-1],r=e[t.index+n.length];if(n.startsWith("<https")||n.startsWith("<http"))return{matchedLink:n,link:n.split("|")[0].replace("<",""),hyperlink:n.split("|")[1].replace(">",""),addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)};if(n.startsWith("<a href=")){const e=n.match(/href="([^"]+)"/),t=n.match(/>[^<]+</);return{matchedLink:n,link:e?e[1]:"",hyperlink:t?t[0].slice(1,-1):"",addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)}}{const[e,t]=n.split("](");return{matchedLink:n,link:t?t.slice(0,-1):"",hyperlink:e?e.slice(1):"",addSpaceBefore:!(!i||" "===i),addSpaceAfter:!(!r||" "===r)}}});return i.forEach(t=>{if(t&&t.link&&t.hyperlink){const i=Xa().replace(/-/g,"");n.push({link:this.removeTrailingPunctuation(t.link),hyperlink:this.removeTrailingPunctuation(t.hyperlink),mark:t.matchedLink,id:i}),e=e.replace(t.matchedLink,`${t.addSpaceBefore?" ":""}${i}${t.addSpaceAfter?" ":""}`)}}),{hyperlinks:n,markedText:e}}async getLinkData(e){var t,n,i,o;try{const a=(await r().get(e)).data,s=(new DOMParser).parseFromString(a,"text/html");return s?{title:null!==(n=null===(t=s.querySelector("title"))||void 0===t?void 0:t.textContent)&&void 0!==n?n:null,description:(null===(i=s.querySelector('meta[name="description"]'))||void 0===i?void 0:i.getAttribute("content"))||null,image:(null===(o=s.querySelector('meta[property="og:image"]'))||void 0===o?void 0:o.getAttribute("content"))||null,favicon:null,link:e}:{title:null,description:null,image:null,favicon:null,link:e}}catch(t){return{title:null,description:null,image:null,favicon:null,link:e}}}render(){return this.message?B`<div class="message-inner-body">
|
|
6051
6051
|
${this.isMessageStillStreamingChunks()?B`<div class="message-loader"><mini-loader></mini-loader></div>`:""}
|
|
6052
6052
|
<p
|
|
6053
|
-
class=${ye({"message-text":this.widgetType!==
|
|
6053
|
+
class=${ye({"message-text":this.widgetType!==Xl.Utilities,"message-text-large":this.widgetType===Xl.Utilities,"webchat-font__desktop":!mn(),"webchat-font__mobile":mn()})}
|
|
6054
6054
|
>
|
|
6055
6055
|
${this.parsedMessage}
|
|
6056
6056
|
</p>
|
|
@@ -6081,9 +6081,9 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6081
6081
|
/>`:""}
|
|
6082
6082
|
|
|
6083
6083
|
<div class="website-preview-body">
|
|
6084
|
-
<p class=${ye({"message-text":this.widgetType!==
|
|
6084
|
+
<p class=${ye({"message-text":this.widgetType!==Xl.Utilities,"message-text-large":this.widgetType===Xl.Utilities,"website-preview-title":!0,"webchat-font__desktop":!mn(),"webchat-font__mobile":mn()})}>${e.title}</p>
|
|
6085
6085
|
${e.description?B`<p
|
|
6086
|
-
class=${ye({"message-text":this.widgetType!==
|
|
6086
|
+
class=${ye({"message-text":this.widgetType!==Xl.Utilities,"message-text-large":this.widgetType===Xl.Utilities,"website-preview-description":!0,"webchat-font__desktop":!mn(),"webchat-font__mobile":mn()})}
|
|
6087
6087
|
>
|
|
6088
6088
|
${e.description}
|
|
6089
6089
|
</p>`:""}
|
|
@@ -6349,7 +6349,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6349
6349
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M15 0C17.7614 0 20 2.23858 20 5V15C20 17.7614 17.7614 20 15 20H5C2.23858 20 0 17.7614 0 15V5C0 2.23858 2.23858 0 5 0H15ZM18 5C18 3.34315 16.6569 2 15 2H5C3.34315 2 2 3.34315 2 5V15C2 16.6569 3.34315 18 5 18H15C16.6569 18 18 16.6569 18 15V5Z" fill="${e}"/>
|
|
6350
6350
|
<path d="M12.1893 9.25L10.4697 7.53033C10.1768 7.23744 10.1768 6.76256 10.4697 6.46967C10.7626 6.17678 11.2374 6.17678 11.5303 6.46967L13.8232 8.76256C14.5066 9.44598 14.5066 10.554 13.8232 11.2374L11.5303 13.5303C11.2374 13.8232 10.7626 13.8232 10.4697 13.5303C10.1768 13.2374 10.1768 12.7626 10.4697 12.4697L12.1893 10.75L6 10.75C5.58579 10.75 5.25 10.4142 5.25 10C5.25 9.58579 5.58579 9.25 6 9.25L12.1893 9.25Z" fill="${e}"/>
|
|
6351
6351
|
</svg>
|
|
6352
|
-
`;var Ol=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 Pl=class extends oe{constructor(){super(...arguments),this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.onMount=()=>({}),this.isHealthChat=!1,this.widgetType=
|
|
6352
|
+
`;var Ol=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 Pl=class extends oe{constructor(){super(...arguments),this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.onMount=()=>({}),this.isHealthChat=!1,this.widgetType=Xl.Default,this.primaryColor=Le,this.backgroundColor=Re,this.onClickExit=()=>{localStorage.setItem("isChatOpen","false")},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;0!==e.length&&(this.messageInput.value="",this.autoResizeMessageInput(),0===this.messages.length&&(this.messages=[{timestamp:0,message:e,isLeadMessage:!0,chunks:[{text:e,order:0,isDone:!0}],type:os.text}]),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.hasReceivedConsent}get consentKey(){return`${this.orgSlug}Consent`}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.simpleChatMessages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener(e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading}),this.onMount();const n=localStorage.getItem(this.consentKey);if(!n)return void(this.hasReceivedConsent=!1);const i=JSON.parse(n),{timestamp:r,consentId:o}=i;El(new Date,new Date(r))<7&&o===ci?this.hasReceivedConsent=!0:(this.hasReceivedConsent=!1,localStorage.removeItem(this.consentKey))}async updated(){this.scrollToChatBottom();try{const e=document.getElementById("#healthchat-container");if(!e)return;e.focus()}catch(e){}}render(){var e,t,n,i,r,o,a,s,l,u,c,d,h,p,f;if(!this.buildingSlug)return B``;const g=null===(e=this.building)||void 0===e?void 0:e.id;let m={};if(m=mn()?{top:void 0,bottom:0,left:void 0,right:0}:{top:void 0===this.top||isNaN(this.top)?void 0:`${this.top}px`,bottom:void 0===this.bottom||isNaN(this.bottom)?"130px":`${this.bottom}px`,left:void 0===this.left||isNaN(this.left)?void 0:`${this.left}px`,right:void 0===this.right||isNaN(this.right)?"18px":`${this.right}px`},22320===g&&(m={...m,fontFamily:'"Helvetica Neue", Arial'}),this.widgetType===Xl.Utilities)return B`
|
|
6353
6353
|
<div
|
|
6354
6354
|
id="utilities-container"
|
|
6355
6355
|
class=${ye({"pubnub-container__mobile":mn(),"utilities-container__desktop":!mn()})}
|
|
@@ -6449,7 +6449,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6449
6449
|
</div>
|
|
6450
6450
|
</div>
|
|
6451
6451
|
</div>
|
|
6452
|
-
`;if(this.widgetType===
|
|
6452
|
+
`;if(this.widgetType===Xl.Healthcare)return B`
|
|
6453
6453
|
<div
|
|
6454
6454
|
id="healthchat-container"
|
|
6455
6455
|
class=${ye({"pubnub-container__mobile":mn(),"healthchat-container__desktop":!mn()})}
|
|
@@ -6657,7 +6657,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6657
6657
|
</button>
|
|
6658
6658
|
</div>
|
|
6659
6659
|
</div>
|
|
6660
|
-
`}};Pl.styles=[xn,hs,ds,cs,kl],Ol([ue({type:Number})],Pl.prototype,"right",void 0),Ol([ue({type:Number})],Pl.prototype,"bottom",void 0),Ol([ue({type:Number})],Pl.prototype,"top",void 0),Ol([ue({type:Number})],Pl.prototype,"left",void 0),Ol([ue({attribute:!0})],Pl.prototype,"onMount",void 0),Ol([ue({attribute:!0})],Pl.prototype,"channel",void 0),Ol([ue({attribute:!0})],Pl.prototype,"isHealthChat",void 0),Ol([ue({attribute:!0})],Pl.prototype,"myPubnub",void 0),Ol([ue({attribute:!0})],Pl.prototype,"orgSlug",void 0),Ol([ue({attribute:!0})],Pl.prototype,"buildingSlug",void 0),Ol([ue({attribute:!0})],Pl.prototype,"widgetType",void 0),Ol([ue({attribute:!0})],Pl.prototype,"building",void 0),Ol([ue({attribute:!0})],Pl.prototype,"primaryColor",void 0),Ol([ue({attribute:!0})],Pl.prototype,"backgroundColor",void 0),Ol([ue({attribute:!0})],Pl.prototype,"onClickExit",void 0),Ol([ue({attribute:!0})],Pl.prototype,"requiresConsent",void 0),Ol([de("#message-input",!0)],Pl.prototype,"messageInput",void 0),Ol([de("#conversation-body",!0)],Pl.prototype,"messageBody",void 0),Ol([ce()],Pl.prototype,"messages",void 0),Ol([ce()],Pl.prototype,"isLoadingMessages",void 0),Ol([ce()],Pl.prototype,"hasReceivedConsent",void 0),Ol([ce()],Pl.prototype,"privacyPolicyUrl",void 0),Ol([ce()],Pl.prototype,"websitePreviewMapping",void 0),Pl=Ol([se("pubnub-chat")],Pl);const Il=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?`${t}/units`:t;class Nl{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>En(kn(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=Ci();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(yi()).filter(e=>e)}},this.addSafeLeadSourceTouchpoint=e=>{const t=this.getLocalStorageMultitouchValue(),n=this._generateLeadSourceLocalStorageKey();if(!t||this.isExpiredTimestamp(t.timestampExpires)){const t={timestampExpires:this._generateNewExpirationTimestamp(),leadSources:[{parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:En(new Date),type:"touchpoint"}]};localStorage.setItem(n,JSON.stringify(t))}else{if(t.leadSources.find(t=>t.leadSourceValue===e))return;if(t.leadSources.length<this.maxSourcesNonPropertyWebsiteCount)return t.leadSources.push({parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:En(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));vi({logType:bi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,logTitle:"TOO_MANY_LEAD_SOURCES",logData:{buildingSlug:this.buildingSlug}})}},this.getSafeLeadSourceTouchpointsWithDefault=({includedUserSelectedLeadSource:e})=>{const t=this.getLocalStorageMultitouchValue(),n=Ei(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:En(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:En(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Mn(e.timestampInitiallyLogged).getTime()-Mn(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:En(new Date),r=[{timestampInitiallyLogged:i,leadSourceValue:n,type:"default"},...t.leadSources.map(e=>({timestampInitiallyLogged:e.timestampInitiallyLogged,leadSourceValue:e.leadSourceValue,type:e.type}))];return e&&r.push({leadSourceValue:e,timestampInitiallyLogged:En(new Date),type:"user-selected"}),r},this.getLocalStorageMultitouchValue=()=>{const e=this._generateLeadSourceLocalStorageKey(),t=localStorage.getItem(e);if(!t)return null;return JSON.parse(t)},this.isExpiredTimestamp=e=>Mn(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var Ml=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 Dl=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=ei.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.LeadSourceMultitouchClient=null,this.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=Vl.Default,this.onWidgetLoaded=ya(),this.onSstClose=ya(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1,calcDesktop:!1,calcMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=ke(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await Ni(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,t)=>{const n=window.rentgrata;if(!n)return;const i=n.Widget;if(!i)return;const o=i.config;if(!o)return;const a=o.widgetKey;a&&await r().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=t?t:""}})})(this.buildingSlug,this.orgSlug)}catch(e){}await Cr(e,this.buildingSlug,this.orgSlug)&&(wi({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==e?void 0:e.launchedDateTime)?.01:.05}),this.buildingWebchatView=e,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1,"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0))},this.setBuildingDerivedInfo=async()=>{var e,t,n,i,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,A,S,E,k,T,_,O,P,I,N,M,D,U,L,R,B,j,F,H,$,z,G,Q,q;const W=this.buildingWebchatView;if(!W)return;W&&this.orgSlug&&Ll(this.orgSlug,null!==(t=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==t?t:null,this.sampleRateToUse,this.buildingSlug,null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null);const V=W.featureFlagWebchatMarketingSourceDropdownConfiguration,Y=W.featureFlagWebchatUseDniPhoneNumberBySource,K=W.featureFlagInsertDniIntoWebsite,X=W.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite,[Z,J]=await Promise.all([ja(this.orgSlug,this.buildingSlug),ti(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Ie(W.phoneNumber)),this.leadSources=Z,this.featureFlagShowDropdown=V;const ee=W.textWithUsPhoneNumber?W.textWithUsPhoneNumber:await(async e=>{try{const t="https://app.meetelise.com",n=await r().get(`${t}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return vi({logType:bi.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug),te=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,ne=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,ie={callDesktop:null!==(c=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==c&&c,callMobile:null!==(h=null===(d=this.buildingWebchatView)||void 0===d?void 0:d.shouldShowPhoneMobile)&&void 0!==h&&h,chatDesktop:null!==(f=null===(p=this.buildingWebchatView)||void 0===p?void 0:p.shouldShowChatDesktop)&&void 0!==f&&f,chatMobile:null!==(m=null===(g=this.buildingWebchatView)||void 0===g?void 0:g.shouldShowChatMobile)&&void 0!==m&&m,emailDesktop:null!==(b=null===(y=this.buildingWebchatView)||void 0===y?void 0:y.shouldShowEmailDesktop)&&void 0!==b&&b,emailMobile:null!==(w=null===(v=this.buildingWebchatView)||void 0===v?void 0:v.shouldShowEmailMobile)&&void 0!==w&&w,textDesktop:null!==(x=(null===(C=this.buildingWebchatView)||void 0===C?void 0:C.shouldShowTextDesktop)&&!!ee)&&void 0!==x&&x,textMobile:null!==(S=(null===(A=this.buildingWebchatView)||void 0===A?void 0:A.shouldShowTextMobile)&&!!ee)&&void 0!==S&&S,sstDesktop:null!==(k=null===(E=this.buildingWebchatView)||void 0===E?void 0:E.shouldShowSstDesktop)&&void 0!==k&&k,sstMobile:null!==(_=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstMobile)&&void 0!==_&&_,calcDesktop:te,calcMobile:ne};var re,oe;this.enabledChatWidgets=Sa(ie),this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(oe=this.handleTourClicked,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");t&&t.startsWith("https://app.meetelise.com/")&&e.addEventListener("click",e=>{e.preventDefault(),oe(e)})}),X&&(e=>{document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(t=>{t&&t.addEventListener("click",t=>{t.preventDefault(),e(t)})})})(this.handleTourClicked),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach(t=>{var n;if(!t)return;const i=document.createElement("a");i.textContent=t.textContent,i.style.cursor="pointer",i.addEventListener("click",t=>{t.preventDefault(),e(t)}),null===(n=t.parentNode)||void 0===n||n.replaceChild(i,t)})})(this.handleTourClicked)):(null===(O=this.LeadSourceClient)||void 0===O?void 0:O.leadSource)&&(re=null!==(I=null===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&void 0!==I?I:null,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const n=t.includes("?")?"&":"?";e.setAttribute("href",t+n+`eliseParsedLeadSource=${encodeURIComponent(re)}`)}})),this.buildingWebchatView&&(this.primaryColor=null!==(N=this.buildingWebchatView.primaryColor)&&void 0!==N?N:null,this.backgroundColor=null!==(M=this.buildingWebchatView.secondaryColor)&&void 0!==M?M:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(D=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==D?D:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(U=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==U?U:null,this.webchatConfigHasAutoOpenChat=null!==(L=this.buildingWebchatView.autoOpenChat)&&void 0!==L&&L,this.requiresConsent=null!==(R=this.buildingWebchatView.requiresConsentForChat)&&void 0!==R&&R,this.hideMobileFeatures=null!==(B=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==B&&B,this.privacyPolicyUrl=null!==(j=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==j?j:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===_i.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===_i.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===_i.EMOJI&&(this.designConcept=_i.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Le),null===this.backgroundColor&&(this.backgroundColor=Re);const ae=null!==(H=null===(F=this.buildingWebchatView)||void 0===F?void 0:F.phoneNumber)&&void 0!==H?H:"";let se=null;if(Y&&(se=await async function(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source`,{params:{source:t}});return n.data?{number:Ie(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(z=null===($=this.LeadSourceClient)||void 0===$?void 0:$.leadSource)&&void 0!==z?z:null),se&&!se.isMatch&&(se.number=ae)),K&&(null==se?void 0:se.number)){const e=ss(se.number,this.orgSlug,this.buildingSlug);e>0&&wi({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const le=localStorage.getItem("eliseai_phone_number_devtest");le&&ss(le,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=se||{number:ae,isMatch:!1,isPropertyWebsiteCatchall:!0};const ue=null!==(Q=null===(G=this.LeadSourceClient)||void 0===G?void 0:G.leadSource)&&void 0!==Q?Q:null;if(ue&&(this.leadSources.includes(ue)||this.leadSources.push(ue)),Gn(W.id),J&&this.buildingSlug&&(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isLiveOnApplications)){const e=((e,t,n)=>{var i;const r=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/New\/.*(\?.*)?$/,/busboomgroup\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/],o=document.body.getElementsByTagName("a");let a=0;for(let s=0;s<o.length;s++){const l=o[s];if(l.nodeType===Node.ELEMENT_NODE&&r.some(e=>e.test(l.href))){const r=l.getAttribute("href"),o=(null===(i=l.textContent)||void 0===i?void 0:i.toLowerCase())||"",s=Il(o,e);l.setAttribute("href",s),a++,vi({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:bi.info,buildingSlug:n,orgSlug:t})}}return 0===a&&vi({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:bi.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}`,this.orgSlug,this.buildingSlug);e>0&&wi({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}},this.initializeChatVariables=async()=>{var e,t,n,i,r,o,a;if(!this.buildingWebchatView)return;const s=es(this.buildingSlug),l=ts(this.buildingSlug,s)?s:Ja(this.buildingSlug,!1);if(!l.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new ki,this.LeadSourceMultitouchClient=new Nl(this.orgSlug,this.buildingSlug),this.myPubnub=new as(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,l.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType),this.LeadSourceClient.chatId=this.myPubnub.channel;const u=await(null===(e=this.LeadSourceClient)||void 0===e?void 0:e.generateUserLeadSource({leadId:null!==(n=null===(t=this.myPubnub)||void 0===t?void 0:t.leadUserId)&&void 0!==n?n:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));u&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(u),"property-website"!==Ei(this.orgSlug)?this.myPubnub.leadSource=null!==(r=null===(i=this.LeadSourceClient)||void 0===i?void 0:i.leadSource)&&void 0!==r?r:Ei(this.orgSlug):this.myPubnub.leadSource=null!==(a=null===(o=this.LeadSourceClient)||void 0===o?void 0:o.leadSource)&&void 0!==a?a:null,l.initiatedChat&&await this.myPubnub.initializePubnub(s)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!Pn(Mn(t)));return!!e&&!!n&&!mn()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",En(function(e,t){return Ge(2,arguments),st(e,6e4*at(t))}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,n,i,r,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w;if("Tab"===e.key){const C=this.displayPubnubChat?null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"):null!==(g=null!==(u=null===(l=null===(s=null===(a=null===(o=null===(r=this.shadowRoot)||void 0===r?void 0:r.getElementById("meetelise-launcher"))||void 0===o?void 0:o.shadowRoot)||void 0===a?void 0:a.getElementById("email-us-window"))||void 0===s?void 0:s.shadowRoot)||void 0===l?void 0:l.getElementById("email-us-form"))&&void 0!==u?u:null===(f=null===(p=null===(h=null===(d=null===(c=this.shadowRoot)||void 0===c?void 0:c.getElementById("meetelise-launcher"))||void 0===d?void 0:d.shadowRoot)||void 0===h?void 0:h.getElementById("tour-scheduler-window"))||void 0===p?void 0:p.shadowRoot)||void 0===f?void 0:f.getElementById("scheduler-container"))&&void 0!==g?g:null===(w=null===(v=null===(b=null===(y=null===(m=this.shadowRoot)||void 0===m?void 0:m.getElementById("meetelise-launcher"))||void 0===y?void 0:y.shadowRoot)||void 0===b?void 0:b.getElementById("call-us-window"))||void 0===v?void 0:v.shadowRoot)||void 0===w?void 0:w.getElementById("details-window");if(!C)return;e.preventDefault();const x=C.querySelectorAll("input, me-select, textarea, action-confirm-button, [tabindex]"),A=Array.from(x),S=A.findIndex(e=>e.matches(":focus"));A[(S+1)%A.length].focus()}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")}}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new mi(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),Za(this.buildingSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.setupWebchat(),this.hideLauncher=!1}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustPositionChatAdditionalActions),window.addEventListener("keydown",this.handleKeydownTab)}getDeepActiveElement(){let e=document.activeElement,t=0;for(;(null==e?void 0:e.shadowRoot)&&(null==e?void 0:e.shadowRoot.activeElement);)if(t+=1,e=null==e?void 0:e.shadowRoot.activeElement,t>100){vi({logType:bi.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_GETTING_DEEP_ELEMENT]",logData:{message:"error getting deep active element"}});break}return e}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),window.removeEventListener("keydown",this.handleKeydownTab),super.disconnectedCallback()}render(){var e,t,n,i,r,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,A,S,E,k,T,_,O,P,I,N,M,D,U;Ca();const L=this.hideLauncher&&!this.isLoading&&!mn();return B`
|
|
6660
|
+
`}};Pl.styles=[xn,hs,ds,cs,kl],Ol([ue({type:Number})],Pl.prototype,"right",void 0),Ol([ue({type:Number})],Pl.prototype,"bottom",void 0),Ol([ue({type:Number})],Pl.prototype,"top",void 0),Ol([ue({type:Number})],Pl.prototype,"left",void 0),Ol([ue({attribute:!0})],Pl.prototype,"onMount",void 0),Ol([ue({attribute:!0})],Pl.prototype,"channel",void 0),Ol([ue({attribute:!0})],Pl.prototype,"isHealthChat",void 0),Ol([ue({attribute:!0})],Pl.prototype,"myPubnub",void 0),Ol([ue({attribute:!0})],Pl.prototype,"orgSlug",void 0),Ol([ue({attribute:!0})],Pl.prototype,"buildingSlug",void 0),Ol([ue({attribute:!0})],Pl.prototype,"widgetType",void 0),Ol([ue({attribute:!0})],Pl.prototype,"building",void 0),Ol([ue({attribute:!0})],Pl.prototype,"primaryColor",void 0),Ol([ue({attribute:!0})],Pl.prototype,"backgroundColor",void 0),Ol([ue({attribute:!0})],Pl.prototype,"onClickExit",void 0),Ol([ue({attribute:!0})],Pl.prototype,"requiresConsent",void 0),Ol([de("#message-input",!0)],Pl.prototype,"messageInput",void 0),Ol([de("#conversation-body",!0)],Pl.prototype,"messageBody",void 0),Ol([ce()],Pl.prototype,"messages",void 0),Ol([ce()],Pl.prototype,"isLoadingMessages",void 0),Ol([ce()],Pl.prototype,"hasReceivedConsent",void 0),Ol([ce()],Pl.prototype,"privacyPolicyUrl",void 0),Ol([ce()],Pl.prototype,"websitePreviewMapping",void 0),Pl=Ol([se("pubnub-chat")],Pl);const Il="cdn.skypack.dev/@meetelise/chat",Nl="cdn.eliseai.com/@meetelise/chat",Ml=async(e,t)=>{try{if(Math.random()>=.15)return;const n=(()=>{try{const e=document.getElementsByTagName("script");for(const t of e){const e=t.src||"",n=t.textContent||"";if(e.includes(Il)||n.includes(Il))return"skypack";if(e.includes(Nl)||n.includes(Nl))return"eliseai"}return"unknown"}catch(e){return"unknown"}})();await r().post("https://app.meetelise.com/platformApi/webchat/cdn-version",{cdn_version:n},{params:{cdn_version:n},headers:{"Content-Type":"application/json","building-slug":t,"org-slug":e}})}catch(e){}},Dl=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?`${t}/units`:t;class Ul{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>En(kn(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=Ci();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(yi()).filter(e=>e)}},this.addSafeLeadSourceTouchpoint=e=>{const t=this.getLocalStorageMultitouchValue(),n=this._generateLeadSourceLocalStorageKey();if(!t||this.isExpiredTimestamp(t.timestampExpires)){const t={timestampExpires:this._generateNewExpirationTimestamp(),leadSources:[{parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:En(new Date),type:"touchpoint"}]};localStorage.setItem(n,JSON.stringify(t))}else{if(t.leadSources.find(t=>t.leadSourceValue===e))return;if(t.leadSources.length<this.maxSourcesNonPropertyWebsiteCount)return t.leadSources.push({parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:En(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));vi({logType:bi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,logTitle:"TOO_MANY_LEAD_SOURCES",logData:{buildingSlug:this.buildingSlug}})}},this.getSafeLeadSourceTouchpointsWithDefault=({includedUserSelectedLeadSource:e})=>{const t=this.getLocalStorageMultitouchValue(),n=Ei(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:En(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:En(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Mn(e.timestampInitiallyLogged).getTime()-Mn(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:En(new Date),r=[{timestampInitiallyLogged:i,leadSourceValue:n,type:"default"},...t.leadSources.map(e=>({timestampInitiallyLogged:e.timestampInitiallyLogged,leadSourceValue:e.leadSourceValue,type:e.type}))];return e&&r.push({leadSourceValue:e,timestampInitiallyLogged:En(new Date),type:"user-selected"}),r},this.getLocalStorageMultitouchValue=()=>{const e=this._generateLeadSourceLocalStorageKey(),t=localStorage.getItem(e);if(!t)return null;return JSON.parse(t)},this.isExpiredTimestamp=e=>Mn(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var Ll=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 Rl=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=ei.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.LeadSourceMultitouchClient=null,this.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=Xl.Default,this.onWidgetLoaded=ya(),this.onSstClose=ya(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1,calcDesktop:!1,calcMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=ke(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await Ni(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,t)=>{const n=window.rentgrata;if(!n)return;const i=n.Widget;if(!i)return;const o=i.config;if(!o)return;const a=o.widgetKey;a&&await r().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=t?t:""}})})(this.buildingSlug,this.orgSlug)}catch(e){}try{Ml(this.orgSlug,this.buildingSlug)}catch(e){}await Cr(e,this.buildingSlug,this.orgSlug)&&(wi({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==e?void 0:e.launchedDateTime)?.01:.05}),this.buildingWebchatView=e,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1,"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0))},this.setBuildingDerivedInfo=async()=>{var e,t,n,i,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,A,S,E,k,T,_,O,P,I,N,M,D,U,L,R,B,j,F,H,$,z,G,Q,q;const W=this.buildingWebchatView;if(!W)return;W&&this.orgSlug&&jl(this.orgSlug,null!==(t=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==t?t:null,this.sampleRateToUse,this.buildingSlug,null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null);const V=W.featureFlagWebchatMarketingSourceDropdownConfiguration,Y=W.featureFlagWebchatUseDniPhoneNumberBySource,K=W.featureFlagInsertDniIntoWebsite,X=W.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite,[Z,J]=await Promise.all([ja(this.orgSlug,this.buildingSlug),ti(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Ie(W.phoneNumber)),this.leadSources=Z,this.featureFlagShowDropdown=V;const ee=W.textWithUsPhoneNumber?W.textWithUsPhoneNumber:await(async e=>{try{const t="https://app.meetelise.com",n=await r().get(`${t}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return vi({logType:bi.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug),te=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,ne=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,ie={callDesktop:null!==(c=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==c&&c,callMobile:null!==(h=null===(d=this.buildingWebchatView)||void 0===d?void 0:d.shouldShowPhoneMobile)&&void 0!==h&&h,chatDesktop:null!==(f=null===(p=this.buildingWebchatView)||void 0===p?void 0:p.shouldShowChatDesktop)&&void 0!==f&&f,chatMobile:null!==(m=null===(g=this.buildingWebchatView)||void 0===g?void 0:g.shouldShowChatMobile)&&void 0!==m&&m,emailDesktop:null!==(b=null===(y=this.buildingWebchatView)||void 0===y?void 0:y.shouldShowEmailDesktop)&&void 0!==b&&b,emailMobile:null!==(w=null===(v=this.buildingWebchatView)||void 0===v?void 0:v.shouldShowEmailMobile)&&void 0!==w&&w,textDesktop:null!==(x=(null===(C=this.buildingWebchatView)||void 0===C?void 0:C.shouldShowTextDesktop)&&!!ee)&&void 0!==x&&x,textMobile:null!==(S=(null===(A=this.buildingWebchatView)||void 0===A?void 0:A.shouldShowTextMobile)&&!!ee)&&void 0!==S&&S,sstDesktop:null!==(k=null===(E=this.buildingWebchatView)||void 0===E?void 0:E.shouldShowSstDesktop)&&void 0!==k&&k,sstMobile:null!==(_=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstMobile)&&void 0!==_&&_,calcDesktop:te,calcMobile:ne};var re,oe;this.enabledChatWidgets=Sa(ie),this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(oe=this.handleTourClicked,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");t&&t.startsWith("https://app.meetelise.com/")&&e.addEventListener("click",e=>{e.preventDefault(),oe(e)})}),X&&(e=>{document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(t=>{t&&t.addEventListener("click",t=>{t.preventDefault(),e(t)})})})(this.handleTourClicked),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach(t=>{var n;if(!t)return;const i=document.createElement("a");i.textContent=t.textContent,i.style.cursor="pointer",i.addEventListener("click",t=>{t.preventDefault(),e(t)}),null===(n=t.parentNode)||void 0===n||n.replaceChild(i,t)})})(this.handleTourClicked)):(null===(O=this.LeadSourceClient)||void 0===O?void 0:O.leadSource)&&(re=null!==(I=null===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&void 0!==I?I:null,document.querySelectorAll("a").forEach(function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const n=t.includes("?")?"&":"?";e.setAttribute("href",t+n+`eliseParsedLeadSource=${encodeURIComponent(re)}`)}})),this.buildingWebchatView&&(this.primaryColor=null!==(N=this.buildingWebchatView.primaryColor)&&void 0!==N?N:null,this.backgroundColor=null!==(M=this.buildingWebchatView.secondaryColor)&&void 0!==M?M:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(D=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==D?D:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(U=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==U?U:null,this.webchatConfigHasAutoOpenChat=null!==(L=this.buildingWebchatView.autoOpenChat)&&void 0!==L&&L,this.requiresConsent=null!==(R=this.buildingWebchatView.requiresConsentForChat)&&void 0!==R&&R,this.hideMobileFeatures=null!==(B=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==B&&B,this.privacyPolicyUrl=null!==(j=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==j?j:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===_i.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===_i.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===_i.EMOJI&&(this.designConcept=_i.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Le),null===this.backgroundColor&&(this.backgroundColor=Re);const ae=null!==(H=null===(F=this.buildingWebchatView)||void 0===F?void 0:F.phoneNumber)&&void 0!==H?H:"";let se=null;if(Y&&(se=await async function(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source`,{params:{source:t}});return n.data?{number:Ie(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(z=null===($=this.LeadSourceClient)||void 0===$?void 0:$.leadSource)&&void 0!==z?z:null),se&&!se.isMatch&&(se.number=ae)),K&&(null==se?void 0:se.number)){const e=ss(se.number,this.orgSlug,this.buildingSlug);e>0&&wi({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const le=localStorage.getItem("eliseai_phone_number_devtest");le&&ss(le,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=se||{number:ae,isMatch:!1,isPropertyWebsiteCatchall:!0};const ue=null!==(Q=null===(G=this.LeadSourceClient)||void 0===G?void 0:G.leadSource)&&void 0!==Q?Q:null;if(ue&&(this.leadSources.includes(ue)||this.leadSources.push(ue)),Gn(W.id),J&&this.buildingSlug&&(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isLiveOnApplications)){const e=((e,t,n)=>{var i;const r=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/New\/.*(\?.*)?$/,/busboomgroup\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/],o=document.body.getElementsByTagName("a");let a=0;for(let s=0;s<o.length;s++){const l=o[s];if(l.nodeType===Node.ELEMENT_NODE&&r.some(e=>e.test(l.href))){const r=l.getAttribute("href"),o=(null===(i=l.textContent)||void 0===i?void 0:i.toLowerCase())||"",s=Dl(o,e);l.setAttribute("href",s),a++,vi({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:bi.info,buildingSlug:n,orgSlug:t})}}return 0===a&&vi({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:bi.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}`,this.orgSlug,this.buildingSlug);e>0&&wi({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}},this.initializeChatVariables=async()=>{var e,t,n,i,r,o,a;if(!this.buildingWebchatView)return;const s=es(this.buildingSlug),l=ts(this.buildingSlug,s)?s:Ja(this.buildingSlug,!1);if(!l.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new ki,this.LeadSourceMultitouchClient=new Ul(this.orgSlug,this.buildingSlug),this.myPubnub=new as(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,l.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType),this.LeadSourceClient.chatId=this.myPubnub.channel;const u=await(null===(e=this.LeadSourceClient)||void 0===e?void 0:e.generateUserLeadSource({leadId:null!==(n=null===(t=this.myPubnub)||void 0===t?void 0:t.leadUserId)&&void 0!==n?n:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));u&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(u),"property-website"!==Ei(this.orgSlug)?this.myPubnub.leadSource=null!==(r=null===(i=this.LeadSourceClient)||void 0===i?void 0:i.leadSource)&&void 0!==r?r:Ei(this.orgSlug):this.myPubnub.leadSource=null!==(a=null===(o=this.LeadSourceClient)||void 0===o?void 0:o.leadSource)&&void 0!==a?a:null,l.initiatedChat&&await this.myPubnub.initializePubnub(s)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!Pn(Mn(t)));return!!e&&!!n&&!mn()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",En(function(e,t){return Ge(2,arguments),st(e,6e4*at(t))}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,n,i,r,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w;if("Tab"===e.key){const C=this.displayPubnubChat?null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"):null!==(g=null!==(u=null===(l=null===(s=null===(a=null===(o=null===(r=this.shadowRoot)||void 0===r?void 0:r.getElementById("meetelise-launcher"))||void 0===o?void 0:o.shadowRoot)||void 0===a?void 0:a.getElementById("email-us-window"))||void 0===s?void 0:s.shadowRoot)||void 0===l?void 0:l.getElementById("email-us-form"))&&void 0!==u?u:null===(f=null===(p=null===(h=null===(d=null===(c=this.shadowRoot)||void 0===c?void 0:c.getElementById("meetelise-launcher"))||void 0===d?void 0:d.shadowRoot)||void 0===h?void 0:h.getElementById("tour-scheduler-window"))||void 0===p?void 0:p.shadowRoot)||void 0===f?void 0:f.getElementById("scheduler-container"))&&void 0!==g?g:null===(w=null===(v=null===(b=null===(y=null===(m=this.shadowRoot)||void 0===m?void 0:m.getElementById("meetelise-launcher"))||void 0===y?void 0:y.shadowRoot)||void 0===b?void 0:b.getElementById("call-us-window"))||void 0===v?void 0:v.shadowRoot)||void 0===w?void 0:w.getElementById("details-window");if(!C)return;e.preventDefault();const x=C.querySelectorAll("input, me-select, textarea, action-confirm-button, [tabindex]"),A=Array.from(x),S=A.findIndex(e=>e.matches(":focus"));A[(S+1)%A.length].focus()}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")}}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new mi(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),Za(this.buildingSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.setupWebchat(),this.hideLauncher=!1}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustPositionChatAdditionalActions),window.addEventListener("keydown",this.handleKeydownTab)}getDeepActiveElement(){let e=document.activeElement,t=0;for(;(null==e?void 0:e.shadowRoot)&&(null==e?void 0:e.shadowRoot.activeElement);)if(t+=1,e=null==e?void 0:e.shadowRoot.activeElement,t>100){vi({logType:bi.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_GETTING_DEEP_ELEMENT]",logData:{message:"error getting deep active element"}});break}return e}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),window.removeEventListener("keydown",this.handleKeydownTab),super.disconnectedCallback()}render(){var e,t,n,i,r,o,a,s,l,u,c,d,h,p,f,g,m,y,b,v,w,C,x,A,S,E,k,T,_,O,P,I,N,M,D,U;Ca();const L=this.hideLauncher&&!this.isLoading&&!mn();return B`
|
|
6661
6661
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6662
6662
|
<div id="aria-describe-info" style="display: none;">
|
|
6663
6663
|
EliseAI widget that allows you to chat with a virtual assistant, book
|
|
@@ -6672,7 +6672,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6672
6672
|
.myPubnub=${this.myPubnub}
|
|
6673
6673
|
.orgSlug=${this.orgSlug}
|
|
6674
6674
|
.buildingSlug=${this.buildingSlug}
|
|
6675
|
-
.widgetType=${
|
|
6675
|
+
.widgetType=${Xl.Default}
|
|
6676
6676
|
.building=${this.buildingWebchatView}
|
|
6677
6677
|
.primaryColor=${this.primaryColor}
|
|
6678
6678
|
.backgroundColor=${this.backgroundColor}
|
|
@@ -6770,7 +6770,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6770
6770
|
</meetelise-launcher>`:""}
|
|
6771
6771
|
</div>
|
|
6772
6772
|
</meta>
|
|
6773
|
-
`}};
|
|
6773
|
+
`}};Rl.styles=u`
|
|
6774
6774
|
:host {
|
|
6775
6775
|
all: initial;
|
|
6776
6776
|
}
|
|
@@ -6819,7 +6819,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6819
6819
|
position: fixed;
|
|
6820
6820
|
bottom: 0;
|
|
6821
6821
|
}
|
|
6822
|
-
`,
|
|
6822
|
+
`,Ll([ue({type:String})],Rl.prototype,"buildingSlug",void 0),Ll([ue({type:String})],Rl.prototype,"orgSlug",void 0),Ll([ue({type:Object})],Rl.prototype,"launcherStyles",void 0),Ll([ue()],Rl.prototype,"mobileStyles",void 0),Ll([ue({type:Boolean})],Rl.prototype,"isMinimized",void 0),Ll([ue({type:String})],Rl.prototype,"primaryColor",void 0),Ll([ue({type:String})],Rl.prototype,"backgroundColor",void 0),Ll([ue({type:String})],Rl.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Ll([ue({type:String})],Rl.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),Ll([ce()],Rl.prototype,"chatId",void 0),Ll([ce()],Rl.prototype,"analytics",void 0),Ll([ce()],Rl.prototype,"launcher",void 0),Ll([ce()],Rl.prototype,"buildingWebchatView",void 0),Ll([ce()],Rl.prototype,"designConcept",void 0),Ll([ce()],Rl.prototype,"leadSources",void 0),Ll([ce()],Rl.prototype,"currentLeadSource",void 0),Ll([ce()],Rl.prototype,"featureFlagShowDropdown",void 0),Ll([ce()],Rl.prototype,"phoneNumberForSource",void 0),Ll([ce()],Rl.prototype,"hasMounted",void 0),Ll([ce()],Rl.prototype,"hideLauncher",void 0),Ll([ce()],Rl.prototype,"isLoading",void 0),Ll([ce()],Rl.prototype,"showTourNextToChat",void 0),Ll([ce()],Rl.prototype,"displayPubnubChat",void 0),Ll([ce()],Rl.prototype,"myPubnub",void 0),Ll([ce()],Rl.prototype,"LeadSourceClient",void 0),Ll([ce()],Rl.prototype,"LeadSourceMultitouchClient",void 0),Ll([ce()],Rl.prototype,"sampleRateToUse",void 0),Ll([ue({type:Number})],Rl.prototype,"right",void 0),Ll([ue({type:Number})],Rl.prototype,"bottom",void 0),Ll([ue({type:Number})],Rl.prototype,"top",void 0),Ll([ue({type:Number})],Rl.prototype,"left",void 0),Ll([ue({attribute:!0})],Rl.prototype,"overrideRentgrata",void 0),Ll([ue({attribute:!0})],Rl.prototype,"widgetType",void 0),Ll([ue()],Rl.prototype,"onWidgetLoaded",void 0),Ll([ue({attribute:!0})],Rl.prototype,"onSstClose",void 0),Ll([ce()],Rl.prototype,"enabledChatWidgets",void 0),Ll([ce()],Rl.prototype,"webchatConfigHasAutoOpenChat",void 0),Ll([ce()],Rl.prototype,"requiresConsent",void 0),Ll([ce()],Rl.prototype,"hideMobileFeatures",void 0),Ll([ce()],Rl.prototype,"privacyPolicyUrl",void 0),Rl=Ll([se("me-chat")],Rl);const Bl=e=>{for(const t of e){const e=document.getElementById(t);if(e)return e}return null},jl=async(e,t,n,i,o)=>{var a;if(!i||!e)return;const s=await async function(e){if(!e)return!1;try{return(await r().get(Jn(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}}(i);if(!s)return;const l=Bl(["myContactForm","contactus","fpa-myContactForm"]);let u;if(!(l&&l instanceof HTMLFormElement)){const t=document.querySelector("form");return void(window.location.pathname.toLowerCase().includes("contactus")&&Fl(i,e,"Could not find form",t?{id:t.id}:void 0))}try{if(l.parentElement&&"scheduleTourForm"===l.parentElement.id)return Fl(i,e,"Form is apart of schedule tour form!")}catch(e){}for(let e=0;e<l.elements.length;e++){const t=l.elements[e];if("button"===t.tagName.toLowerCase()&&"fakebutton"===t.getAttribute("data-selenium-id")){u=t;break}if("fpa-contact-submit"===t.getAttribute("id")){u=t;break}}if(!u)return Fl(i,e,"Could not find submit button");const c=()=>({firstName:Bl(["firstname","txtName","fpa-firstname","Form_FirstName"]),lastName:Bl(["lastname","txtName2","fpa-lastname","Form_LastName"]),email:Bl(["email","txtEmail","fpa-email","Form_Email"]),phone:Bl(["phonenumber","txtPhone","fpa-phonenumber","Form_Phone"]),message:Bl(["message","txtComments","fpa-email","Form_Message"])});if(Object.values(c()).some(e=>null===e)){const t=Object.entries(c()).filter(([,e])=>null===e).map(([e])=>e);return Fl(i,e,"Missing the following form elements: "+t.join(", "))}const d=u.textContent,h=u.cloneNode(!0);null===(a=u.parentNode)||void 0===a||a.replaceChild(h,u),h&&wi({params:{chat_id:t,org_slug:e,building_slug:i,is_form_override_success:!0},sampleRate:n}),h.onclick=async function(t){if(Object.values(c()).forEach(e=>{"true"!==(null==e?void 0:e.getAttribute("aria-required"))||e.value||(e.className="form-control required is-invalid")}),!Object.values(c()).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(),h.textContent="Processing request...",h.disabled=!0;const n={};Object.entries(c()).forEach(([e,t])=>n[e]=null==t?void 0:t.value);const r=await Ni(e,i);if(!r)return Fl(i,e,"Could not find building"),null;const a={email_address:n.email,first_name:n.firstName,last_name:n.lastName,phone_number:n.phone,first_message:n.message,building_id:r.id,is_external_form:!0,lead_sources:[...new Set(o?[o,Ei(e)]:[Ei(e)])]},s=JSON.stringify(a);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":i,"org-slug":e},body:s}).then(e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return l&&l.reset(),Object.values(c()).forEach(e=>{e&&(e.disabled=!0)}),h.textContent="Submitted",h.disabled=!0,e.json()}).catch(()=>{h.textContent=d})}},Fl=(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})},Hl=u`
|
|
6823
6823
|
.chat-launcher {
|
|
6824
6824
|
position: fixed;
|
|
6825
6825
|
}
|
|
@@ -6850,7 +6850,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6850
6850
|
filter: brightness(1.1);
|
|
6851
6851
|
}
|
|
6852
6852
|
}
|
|
6853
|
-
`;var
|
|
6853
|
+
`;var $l=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 zl=class extends oe{constructor(){super(...arguments),this.right=0,this.bottom=0,this.top=0,this.left=0,this.isChatOpen=!1,this.onClickCloseChat=()=>({}),this.onClickOpenChat=()=>({})}render(){return this.isChatOpen?B`
|
|
6854
6854
|
<div
|
|
6855
6855
|
class="chat-launcher"
|
|
6856
6856
|
style=${Ue({top:mn()||isNaN(this.top)?void 0:`${this.top+432}px`,bottom:mn()||isNaN(this.bottom)?"72px":this.bottom-60+"px",left:mn()||isNaN(this.left)?void 0:`${this.left}px`,right:mn()||isNaN(this.right)?"18px":`${this.right}px`})}
|
|
@@ -6892,7 +6892,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6892
6892
|
/>
|
|
6893
6893
|
</svg>
|
|
6894
6894
|
</button>
|
|
6895
|
-
</div>`}};
|
|
6895
|
+
</div>`}};zl.styles=[Hl],$l([ue({type:Number})],zl.prototype,"right",void 0),$l([ue({type:Number})],zl.prototype,"bottom",void 0),$l([ue({type:Number})],zl.prototype,"top",void 0),$l([ue({type:Number})],zl.prototype,"left",void 0),$l([ue({attribute:!0})],zl.prototype,"isChatOpen",void 0),$l([ue({attribute:!0})],zl.prototype,"onClickCloseChat",void 0),$l([ue({attribute:!0})],zl.prototype,"onClickOpenChat",void 0),zl=$l([se("simple-launcher")],zl);var Gl=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 Ql=class extends oe{constructor(){super(...arguments),this.healthcareId="",this.right=0,this.bottom=0,this.top=0,this.left=0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=ke(),this.firstUpdated=async()=>{await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=es(this.healthcareId),t=ts(this.healthcareId,e)?e:Ja(this.healthcareId,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new as(this.healthcareId,null,"",this.currentLeadSource,t.leadId,null,null,Xl.Healthcare),t.initiatedChat&&await this.myPubnub.initializePubnub(e),mn()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},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(),Za(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 Ca(),this.isLoading?B``:B`
|
|
6896
6896
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
6897
6897
|
<div id="aria-describe-info" style="display: none;">
|
|
6898
6898
|
EliseAI widget that allows you to chat with a virtual assistant, book
|
|
@@ -6901,7 +6901,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6901
6901
|
${this.displayPubnubChat?B`
|
|
6902
6902
|
<pubnub-chat
|
|
6903
6903
|
id="pubnub-chat"
|
|
6904
|
-
.widgetType=${
|
|
6904
|
+
.widgetType=${Xl.Healthcare}
|
|
6905
6905
|
.channel=${null===(e=this.myPubnub)||void 0===e?void 0:e.channel}
|
|
6906
6906
|
.myPubnub=${this.myPubnub}
|
|
6907
6907
|
.buildingSlug=${this.healthcareId}
|
|
@@ -6927,7 +6927,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6927
6927
|
></simple-launcher>
|
|
6928
6928
|
|
|
6929
6929
|
</meta>
|
|
6930
|
-
`}}
|
|
6930
|
+
`}};Ql.styles=u`
|
|
6931
6931
|
:host {
|
|
6932
6932
|
all: initial;
|
|
6933
6933
|
}
|
|
@@ -6980,7 +6980,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6980
6980
|
line-height: 150%;
|
|
6981
6981
|
font-size: 16px;
|
|
6982
6982
|
}
|
|
6983
|
-
`,
|
|
6983
|
+
`,Gl([ue({type:String})],Ql.prototype,"healthcareId",void 0),Gl([ue({type:Number})],Ql.prototype,"right",void 0),Gl([ue({type:Number})],Ql.prototype,"bottom",void 0),Gl([ue({type:Number})],Ql.prototype,"top",void 0),Gl([ue({type:Number})],Ql.prototype,"left",void 0),Gl([ce()],Ql.prototype,"launcher",void 0),Gl([ce()],Ql.prototype,"currentLeadSource",void 0),Gl([ce()],Ql.prototype,"displayPubnubChat",void 0),Gl([ce()],Ql.prototype,"myPubnub",void 0),Gl([ce()],Ql.prototype,"requiresConsent",void 0),Gl([ce()],Ql.prototype,"privacyPolicyUrl",void 0),Gl([ce()],Ql.prototype,"isLoading",void 0),Ql=Gl([se("health-chat")],Ql);var ql=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 Wl=class extends oe{constructor(){super(...arguments),this.orgSlug="",this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=ke(),this.firstUpdated=async()=>{(await async function(e){if(!e)return!1;const t="e2e-test-yardi-building";try{return(await r().get(Jn(t),{params:{building_slug:t,flag_type:"bool",feature_flag:"enable-show-utilities-webchat",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(this.orgSlug)||location.href.includes("demo/utilities"))&&await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=es(this.orgSlug),t=ts(this.orgSlug,e)?e:Ja(this.orgSlug,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new as(this.orgSlug,null,this.orgSlug,this.currentLeadSource,t.leadId,null,null,Xl.Utilities),t.initiatedChat&&await this.myPubnub.initializePubnub(e),mn()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},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(),Za(this.orgSlug),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 Ca(),this.isLoading?B``:B`
|
|
6984
6984
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
6985
6985
|
<div id="aria-describe-info" style="display: none;">
|
|
6986
6986
|
EliseAI widget that allows you to chat with a virtual assistant, book
|
|
@@ -6992,7 +6992,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6992
6992
|
<pubnub-chat
|
|
6993
6993
|
id="pubnub-chat"
|
|
6994
6994
|
.channel=${null===(e=this.myPubnub)||void 0===e?void 0:e.channel}
|
|
6995
|
-
.widgetType=${
|
|
6995
|
+
.widgetType=${Xl.Utilities}
|
|
6996
6996
|
.myPubnub=${this.myPubnub}
|
|
6997
6997
|
.buildingSlug=${this.orgSlug}
|
|
6998
6998
|
.onClickExit=${()=>{this.displayPubnubChat=!1}}
|
|
@@ -7016,7 +7016,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
7016
7016
|
|
|
7017
7017
|
></simple-launcher>
|
|
7018
7018
|
</meta>
|
|
7019
|
-
`}};
|
|
7019
|
+
`}};Wl.styles=u`
|
|
7020
7020
|
:host {
|
|
7021
7021
|
all: initial;
|
|
7022
7022
|
}
|
|
@@ -7069,4 +7069,4 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
7069
7069
|
line-height: 150%;
|
|
7070
7070
|
font-size: 16px;
|
|
7071
7071
|
}
|
|
7072
|
-
`,
|
|
7072
|
+
`,ql([ue({type:String})],Wl.prototype,"orgSlug",void 0),ql([ue({type:Number})],Wl.prototype,"right",void 0),ql([ue({type:Number})],Wl.prototype,"bottom",void 0),ql([ue({type:Number})],Wl.prototype,"top",void 0),ql([ue({type:Number})],Wl.prototype,"left",void 0),ql([ce()],Wl.prototype,"launcher",void 0),ql([ce()],Wl.prototype,"currentLeadSource",void 0),ql([ce()],Wl.prototype,"displayPubnubChat",void 0),ql([ce()],Wl.prototype,"myPubnub",void 0),ql([ce()],Wl.prototype,"requiresConsent",void 0),ql([ce()],Wl.prototype,"privacyPolicyUrl",void 0),ql([ce()],Wl.prototype,"isLoading",void 0),Wl=ql([se("utilities-chat")],Wl);const Vl=async e=>{const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":e}});return Math.random()<.2&&vi({logType:i&&i.data?bi.info:bi.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:e,givenBuildingSlug:null,reason:i&&i.data?null:"No match found"}}),i.data},Yl=async(e,t=5e3)=>new Promise((n,i)=>{const r=new MutationObserver((t,i)=>{const r=document.getElementById(e);r&&(i.disconnect(),n(r))});r.observe(document.body,{childList:!0,subtree:!0});const o=setTimeout(()=>{r.disconnect(),i(new Error(`Element ${e} did not appear within ${t}ms`))},t),a=document.querySelector(e);a&&(clearTimeout(o),r.disconnect(),n(a))});class Kl{static healthcareStart(e,t=!0){var n,i,r,o;t&&(this.healthcareId=e.id,this.overridePlacement={right:e.right,bottom:e.bottom,top:e.top,left:e.left}),Zl();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","dialog"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),a.setAttribute("aria-describedby","aria-describe-info"),a.setAttribute("aria-modal","true"),a.setAttribute("healthcareId",e.id),a.setAttribute("right",(null===(n=e.right)||void 0===n?void 0:n.toString())||"unset"),a.setAttribute("bottom",(null===(i=e.bottom)||void 0===i?void 0:i.toString())||"unset"),a.setAttribute("top",(null===(r=e.top)||void 0===r?void 0:r.toString())||"unset"),a.setAttribute("left",(null===(o=e.left)||void 0===o?void 0:o.toString())||"unset"),document.body.appendChild(a),Kl.healthChat=a}static start(e,t=!0){var n,i,r,o,a,s,l,u;if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;t&&(this.orgSlug="Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization,this.hasBuildingSlug=!!e.building,this.overridePlacement={right:null===(n=null==e?void 0:e.position)||void 0===n?void 0:n.right,bottom:null===(i=null==e?void 0:e.position)||void 0===i?void 0:i.bottom,top:null===(r=null==e?void 0:e.position)||void 0===r?void 0:r.top,left:null===(o=null==e?void 0:e.position)||void 0===o?void 0:o.left}),Zl();let c=null;switch(e.widgetType){case Xl.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case Xl.Default:c=document.createElement("me-chat");break;case Xl.Utilities:c=document.createElement("utilities-chat");break;default:c=document.createElement("me-chat")}if(!c)throw new Error("Invalid widget type");c.setAttribute("orgSlug","Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization),c.setAttribute("widgetType",e.widgetType||Xl.Default),c.setAttribute("class","meetelise-chat"),c.setAttribute("role","dialog"),c.setAttribute("aria-label","EliseAI Widget"),c.setAttribute("aria-describedby","aria-describe-info"),c.setAttribute("aria-modal","true"),e.brandColor&&(this.brandColor=e.brandColor,c.setAttribute("primaryColor",((e,t)=>{const n=Be(e),i=0,r=0,o=0,a={r:n.r+Math.round((i-n.r)*t),g:n.g+Math.round((r-n.g)*t),b:n.b+Math.round((o-n.b)*t)};return je(a.r,a.g,a.b)})(e.brandColor,.3))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),c instanceof Rl&&(this.handleBuildingslug(c,e.organization,e.building,e),e.launcherStyles&&(c.launcherStyles=e.launcherStyles),e.mobileStyles&&(c.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(c.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await Yl("rg-widget-compact");e&&e.setAttribute("style","display: none")})(),c.overrideRentgrata=!0),e.onSstClose&&(c.onSstClose=e.onSstClose)),e.position&&(c.setAttribute("right",(null===(a=e.position.right)||void 0===a?void 0:a.toString())||"unset"),c.setAttribute("bottom",(null===(s=e.position.bottom)||void 0===s?void 0:s.toString())||"unset"),c.setAttribute("top",(null===(l=e.position.top)||void 0===l?void 0:l.toString())||"unset"),c.setAttribute("left",(null===(u=e.position.left)||void 0===u?void 0:u.toString())||"unset")),window.eliseAi={},document.body.appendChild(c),c instanceof Rl&&(Kl.meChat=c),c instanceof Wl&&(Kl.utilitiesChat=c)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.meChat&&(await this.meChat.remove(),document.body.removeChild(this.meChat),Kl.meChat=null)}static async handleBuildingslug(e,t,n,i){if(n)return void e.setAttribute("buildingSlug",n);if(this.mutationObserver)return;if(!t)return;const r=await Vl(t);if(r){const e={...i,organization:t,building:r};this.start(e,!1)}this.previousUrl=window.location.href,document.body.addEventListener("click",()=>{requestAnimationFrame(()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,Vl(t).then(e=>{if(!e)return;const n={...i,organization:t,building:e};this.start(n,!1)}))})},!0)}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,t=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,n=await r().get(t,{headers:{"org-slug":this.orgSlug}});if(Math.random()<.2&&vi({logType:n&&n.data?bi.info:bi.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${n?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:n.data,url:e,orgSlug:this.orgSlug,givenBuildingSlug:null,reason:n&&n.data?null:"No match found"}}),!n||!n.data)return;const i={organization:this.orgSlug,building:n.data,brandColor:this.brandColor,backgroundColor:this.backgroundColor};this.start(i,!1)}static async calculateBuildingSlugForLogging(e){const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":this.orgSlug}});Math.random()<.2&&vi({logType:i&&i.data===e?bi.info:bi.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i&&i.data===e?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:this.orgSlug,givenBuildingSlug:e,reason:i&&i.data===e?null:i&&!i.data?"No match found":i&&i.data!==e?"Mismatch":"No match found"}}),i&&i.data}}var Xl;Kl.meChat=null,Kl.healthChat=null,Kl.utilitiesChat=null,Kl.orgSlug="",Kl.mutationObserver=null,Kl.previousUrl="",Kl.hasBuildingSlug=null,Kl.brandColor="",Kl.backgroundColor="",Kl.healthcareId="",Kl.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(Xl||(Xl={}));const Zl=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)};export{Xl as WidgetType,Kl as default};
|
|
@@ -57,6 +57,7 @@ import LeadSourceClient, {
|
|
|
57
57
|
import noop from "lodash/noop";
|
|
58
58
|
import { updateRentgrataToken } from "../rentgrata";
|
|
59
59
|
import { WidgetType } from "../main/MEChat";
|
|
60
|
+
import { logCdnVersion } from "../logCdnVersion";
|
|
60
61
|
import { replaceSelectButtonsWithNewLink } from "../replaceSelectButtonsWithNewLink";
|
|
61
62
|
|
|
62
63
|
import "./chat-additional-actions";
|
|
@@ -268,6 +269,13 @@ export class MEChat extends LitElement {
|
|
|
268
269
|
}
|
|
269
270
|
}
|
|
270
271
|
|
|
272
|
+
try {
|
|
273
|
+
logCdnVersion(this.orgSlug, this.buildingSlug);
|
|
274
|
+
} catch (e) {
|
|
275
|
+
// eslint-disable-next-line no-console
|
|
276
|
+
console.warn("Error logging CDN version", e);
|
|
277
|
+
}
|
|
278
|
+
|
|
271
279
|
const shouldShowWebchat = await getShouldShowWebchat(
|
|
272
280
|
buildingWebchatView,
|
|
273
281
|
this.buildingSlug,
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
|
|
3
|
+
export type CdnSource = "skypack" | "eliseai" | "unknown";
|
|
4
|
+
|
|
5
|
+
const SKYPACK_CDN_PATTERN = "cdn.skypack.dev/@meetelise/chat";
|
|
6
|
+
const ELISEAI_CDN_PATTERN = "cdn.eliseai.com/@meetelise/chat";
|
|
7
|
+
|
|
8
|
+
export const getWidgetCdnSource = (): CdnSource => {
|
|
9
|
+
try {
|
|
10
|
+
const scripts = document.getElementsByTagName("script");
|
|
11
|
+
|
|
12
|
+
for (const script of scripts) {
|
|
13
|
+
const src = script.src || "";
|
|
14
|
+
const textContent = script.textContent || "";
|
|
15
|
+
if (
|
|
16
|
+
src.includes(SKYPACK_CDN_PATTERN) ||
|
|
17
|
+
textContent.includes(SKYPACK_CDN_PATTERN)
|
|
18
|
+
) {
|
|
19
|
+
return "skypack";
|
|
20
|
+
}
|
|
21
|
+
if (
|
|
22
|
+
src.includes(ELISEAI_CDN_PATTERN) ||
|
|
23
|
+
textContent.includes(ELISEAI_CDN_PATTERN)
|
|
24
|
+
) {
|
|
25
|
+
return "eliseai";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return "unknown";
|
|
30
|
+
} catch (e) {
|
|
31
|
+
// eslint-disable-next-line no-console
|
|
32
|
+
console.warn("Error detecting CDN source:", e);
|
|
33
|
+
return "unknown";
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const logCdnVersion = async (
|
|
38
|
+
orgSlug: string,
|
|
39
|
+
buildingSlug: string
|
|
40
|
+
): Promise<void> => {
|
|
41
|
+
try {
|
|
42
|
+
if (Math.random() >= 0.15) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const cdnSource = getWidgetCdnSource();
|
|
47
|
+
await axios.post(
|
|
48
|
+
"https://app.meetelise.com/platformApi/webchat/cdn-version",
|
|
49
|
+
{
|
|
50
|
+
cdn_version: cdnSource,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
params: {
|
|
54
|
+
cdn_version: cdnSource,
|
|
55
|
+
},
|
|
56
|
+
headers: {
|
|
57
|
+
"Content-Type": "application/json",
|
|
58
|
+
"building-slug": buildingSlug,
|
|
59
|
+
"org-slug": orgSlug,
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
// eslint-disable-next-line no-console
|
|
65
|
+
console.warn("Error logging CDN version:", e);
|
|
66
|
+
}
|
|
67
|
+
};
|