@meetelise/chat 1.22.28 → 1.22.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.22.28",
3
+ "version": "1.22.30",
4
4
  "description": "",
5
5
  "main": "public/dist/index.js",
6
6
  "type": "module",
@@ -171,8 +171,14 @@
171
171
  };
172
172
 
173
173
  MEChat.start({
174
- organization: "test-company",
175
- building: "3fc93384-91f5-11ed-98a3-43f5a2f42588",
174
+ // organization: "test-company",
175
+ // building: "3fc93384-91f5-11ed-98a3-43f5a2f42588",
176
+
177
+ // organization: "c259a157-cff3-470a-9ded-f6c5c8d917b8",
178
+ // building: "2c75381a-2286-11ee-a434-7bc2192a0c0e",
179
+
180
+ organization: "radco",
181
+ building: "7eba79d2-22f5-11ed-9af3-4b3e8b1acfb4",
176
182
 
177
183
  // organization: "c259a157-cff3-470a-9ded-f6c5c8d917b8",
178
184
  // building: "22ea2d7e-5df4-11ee-a665-63eeb20a5762",
@@ -216,9 +222,33 @@
216
222
  <a href="/secret.html">
217
223
  <button id="navigate" type="button">Show me a secret!</button>
218
224
  </a>
225
+ <a
226
+ target="_self"
227
+ href="#leaseleads-tour-open"
228
+ data-ll-event="ll_web_tour"
229
+ data-ll-event-label="Schedule Tour Menu Item"
230
+ ><span>Schedule a tour radco stuff</span></a
231
+ >
219
232
  <button onclick="window.eliseAi.onOpenChat()">
220
233
  Open chat without widget
221
234
  </button>
235
+ <a
236
+ href="tel:4075192080"
237
+ id="appended-phone-phone-number-27490085"
238
+ title="Property Phone Number"
239
+ class="
240
+ appended-phone
241
+ phone-number-27490085
242
+ number
243
+ h-c-ret
244
+ v-c-ret
245
+ h-card
246
+ vcard
247
+ phone-widget-number
248
+ "
249
+ >
250
+ <span class="p-tel tel" style="visibility: visible">407-519-2080</span>
251
+ </a>
222
252
  <div>
223
253
  <a
224
254
  href="javascript:void(0);"
@@ -3246,7 +3246,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
3246
3246
  ${Nn}
3247
3247
  ${En}
3248
3248
  ${Rn}
3249
- `,gr([le({attribute:!0})],vr.prototype,"isMinimized",void 0),gr([le()],vr.prototype,"mobileStyles",void 0),gr([le({type:Boolean})],vr.prototype,"isFirstMount",void 0),gr([le({attribute:!1})],vr.prototype,"autoOpenChatWidget",void 0),gr([le()],vr.prototype,"phoneNumber",void 0),gr([le({attribute:!0})],vr.prototype,"buildingName",void 0),gr([le({attribute:!0})],vr.prototype,"chatId",void 0),gr([le({attribute:!0})],vr.prototype,"orgLegalName",void 0),gr([le({attribute:!0})],vr.prototype,"chatCallUsHeader",void 0),gr([le({attribute:!1})],vr.prototype,"buildingId",void 0),gr([le({attribute:!0})],vr.prototype,"buildingSlug",void 0),gr([le({attribute:!0})],vr.prototype,"orgSlug",void 0),gr([le({attribute:!0})],vr.prototype,"sgtUrl",void 0),gr([le({attribute:!0})],vr.prototype,"designConcept",void 0),gr([le({attribute:!0})],vr.prototype,"featureFlagShowDropdown",void 0),gr([le({attribute:!1})],vr.prototype,"leadSources",void 0),gr([le({attribute:!0})],vr.prototype,"currentLeadSource",void 0),gr([le({attribute:!0})],vr.prototype,"escortedToursLink",void 0),gr([le({attribute:!0})],vr.prototype,"virtualToursLink",void 0),gr([le({type:Boolean})],vr.prototype,"hasChatEnabledDesktop",void 0),gr([le({type:Boolean})],vr.prototype,"hasChatEnabledMobile",void 0),gr([le({type:Boolean})],vr.prototype,"hasEmailEnabledDesktop",void 0),gr([le({type:Boolean})],vr.prototype,"hasEmailEnabledMobile",void 0),gr([le({type:Boolean})],vr.prototype,"hasCallUsEnabledDesktop",void 0),gr([le({type:Boolean})],vr.prototype,"hasCallUsEnabledMobile",void 0),gr([le({type:Boolean})],vr.prototype,"hasTextUsEnabledDesktop",void 0),gr([le({type:Boolean})],vr.prototype,"hasTextUsEnabledMobile",void 0),gr([le({type:Boolean})],vr.prototype,"hasSSTEnabledDesktop",void 0),gr([le({type:Boolean})],vr.prototype,"hasSSTEnabledMobile",void 0),gr([le({attribute:!1})],vr.prototype,"tourTypeOptions",void 0),gr([le({attribute:!0})],vr.prototype,"hasDynamicSchedulingEnabled",void 0),gr([le({attribute:!0})],vr.prototype,"onExitChat",void 0),gr([le({attribute:!1})],vr.prototype,"hasHideMobileFeatures",void 0),gr([le({type:Number})],vr.prototype,"right",void 0),gr([le({type:Number})],vr.prototype,"bottom",void 0),gr([le({type:Number})],vr.prototype,"top",void 0),gr([le({type:Number})],vr.prototype,"left",void 0),gr([le({attribute:!0})],vr.prototype,"showTourNextToChat",void 0),gr([le({attribute:!1})],vr.prototype,"onChatTapped",void 0),gr([le({attribute:!0})],vr.prototype,"onClickMinimize",void 0),gr([le({attribute:!0})],vr.prototype,"onSstClose",void 0),gr([le({attribute:!0})],vr.prototype,"overrideRentgrata",void 0),gr([le({attribute:!1})],vr.prototype,"launcherStyles",void 0),gr([le({attribute:!0})],vr.prototype,"brandColor",void 0),gr([le({attribute:!0})],vr.prototype,"backgroundColor",void 0),gr([le({attribute:!0})],vr.prototype,"leadSourceClient",void 0),gr([ue()],vr.prototype,"isEmailWindowOpen",void 0),gr([ue()],vr.prototype,"isCallUsWindowOpen",void 0),gr([ue()],vr.prototype,"isSSTWindowOpen",void 0),gr([ue()],vr.prototype,"isTextUsWindowOpen",void 0),gr([ue()],vr.prototype,"isMobileFeaturesExpanded",void 0),vr=gr([ae("meetelise-launcher")],vr);const yr=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",vr)};var br=i(3379),wr=i.n(br),Sr=i(7795),Tr=i.n(Sr),xr=i(569),Ar=i.n(xr),Cr=i(3565),Or=i.n(Cr),Ir=i(9216),Nr=i.n(Ir),Er=i(4589),Rr=i.n(Er),_r=i(3631),Pr={};async function Mr(e,i){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${i}/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 Fr(n.data,i)}return[]}catch(e){return[]}}Pr.styleTagTransform=Rr(),Pr.setAttributes=Or(),Pr.insert=Ar().bind(null,"head"),Pr.domAPI=Tr(),Pr.insertStyleElement=Nr(),wr()(_r.Z,Pr),_r.Z&&_r.Z.locals&&_r.Z.locals;const Fr=(e,t)=>{let i=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":i=["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":i=["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:i=[]}return e.sort(),e.filter((e=>{const t=e.toLowerCase();return!i.map((e=>e.toLowerCase())).includes(t)}))};var Dr,kr=i(9594),Ur=i.n(kr),Lr=new Uint8Array(16);function Br(){if(!Dr&&!(Dr="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 Dr(Lr)}const qr=/^(?:[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,Jr=function(e){return"string"==typeof e&&qr.test(e)};for(var jr=[],Hr=0;Hr<256;++Hr)jr.push((Hr+256).toString(16).substr(1));const Gr=function(e,t,i){var n=(e=e||{}).random||(e.rng||Br)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(var r=0;r<16;++r)t[i+r]=n[r];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(jr[e[t+0]]+jr[e[t+1]]+jr[e[t+2]]+jr[e[t+3]]+"-"+jr[e[t+4]]+jr[e[t+5]]+"-"+jr[e[t+6]]+jr[e[t+7]]+"-"+jr[e[t+8]]+jr[e[t+9]]+"-"+jr[e[t+10]]+jr[e[t+11]]+jr[e[t+12]]+jr[e[t+13]]+jr[e[t+14]]+jr[e[t+15]]).toLowerCase();if(!Jr(i))throw TypeError("Stringified UUID is invalid");return i}(n)},zr=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Wr=(e,t,i)=>{const n=yi(new Date),r=i||`lead_${Gr()}_${e}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:n,initiatedChat:t})),{leadId:r,timestamp:Ci(n),buildingSlug:e,initiatedChat:t}},Vr=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const i=JSON.parse(t),n={leadId:i.leadId,timestamp:new Date(i.timestamp),buildingSlug:i.buildingSlug,initiatedChat:i.initiatedChat};if(Qr(e,n))return n}catch(e){console.warn("Error getting chat storage key")}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Qr=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(ui(t.timestamp,e))return!1}}catch(e){console.warn("Error checking chat storage key validity")}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp||pi(t.timestamp,24))};var Kr;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(Kr||(Kr={}));const Xr=e=>e.type===Yr.text,$r=e=>e.type===Yr.media;var Yr;!function(e){e.text="text",e.media="media"}(Yr||(Yr={}));const Zr=class{constructor(e,t,i,n=null,r,o=null,a=Bo.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.building=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.widgetType=Bo.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,i;const n={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,n],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter((e=>e.message.messageType!==Kr.noReply)),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const r="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;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===Yr.text&&e.message.includes("confirmed for your tour")))&&tn("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(i=this.building)||void 0===i?void 0:i.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(!Xr(e))return!1;const t=e.chunks.find((e=>e.isDone));return!t||e.chunks.length===t.order}));t&&(this.streamingMessageTimeout=setTimeout((()=>{dn({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:un.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),console.warn(`PUBNUB_WARN_DELAYED_STREAMING_MESSAGES: ${e}`),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 console.warn("Error checking if message contains email",e),!1}})(e.message.text))return;tn("leadProvidedEmail",{buildingId:null===(t=this.building)||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,i;for(let n=e.length-1;n>=0;n--){const r=null===(t=e[n])||void 0===t?void 0:t.message,o=n>0&&(null===(i=e[n-1])||void 0===i?void 0:i.message);(null==r?void 0:r.messageType)===Kr.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.building&&dn({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:un.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=Wr(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken((async()=>{var t,i,n,r,o;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout((()=>{console.error("Elise AI did not respond in time..."),this.building&&dn({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:un.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===Bo.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===(i=this.building)||void 0===i?void 0:i.id,buildingSlug:this.buildingSlug,userId:null===(n=this.building)||void 0===n?void 0:n.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState()}}),this.isFirstChatMessageSent||(tn("firstChatMessageSent",{message:e,buildingId:null===(r=this.building)||void 0===r?void 0:r.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),tn("chatMessageSent",{message:e,buildingId:null===(o=this.building)||void 0===o?void 0:o.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 i=`${e.message.stream_id}-${e.message.order}-${e.message.messageType}`;return t.has(i)?(dn({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:un.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),!1):(t.add(i),!0)}))},this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],i={};return this.removeDuplicatedRawPubnubMessages(e).forEach((e=>{var n;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(n=e.message.media)&&void 0!==n?n:[],isLeadMessage:this.isLeadMessage(e),type:Yr.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:Yr.text}):i[e.message.stream_id]?i[e.message.stream_id].push(e):i[e.message.stream_id]=[e]})),Object.keys(i).forEach((e=>{const n=i[e],r=this.getConsecutiveChunks(n.sort(((e,t)=>{var i,n;return(null!==(i=e.message.order)&&void 0!==i?i:0)-(null!==(n=t.message.order)&&void 0!==n?n: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,i;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(i=e.message.is_done)&&void 0!==i&&i}})),type:Yr.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)})),t.sort(((e,t)=>e.timestamp-t.timestamp)),t},this.getConsecutiveChunks=e=>{var t,i;const n=e.sort(((e,t)=>{var i,n;return(null!==(i=e.message.order)&&void 0!==i?i:0)-(null!==(n=t.message.order)&&void 0!==n?n:0)})),r=[];let o=null!==(t=n[0].message.order)&&void 0!==t?t:0;for(const e of n){if((null!==(i=e.message.order)&&void 0!==i?i:-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.building=t,this.orgSlug=i,this.leadSource=n,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=o,this.widgetType=a}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(Ur())({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,i){try{return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${i}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.building&&dn({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:un.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.building&&dn({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:un.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(t){try{await t()}catch(i){if(i instanceof e.AxiosError&&i&&i.response&&403===i.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const e=await this.fetchToken(this.leadUserId,this.channel);if(!e)return;this.pubnub.setAuthKey(e.auth.result.token),await t()}catch(e){this.building&&dn({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:un.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let i=[],n=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise(((i,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=n?n:void 0},((e,t)=>{e.error?o(e):i(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),i=i.concat(t.filter((e=>e.message.messageType!==Kr.noReply)))}if(n=a[0].timetoken,i.length>=e||a.length<r)break}this.rawPubnubMessages=i.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.building&&dn({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:un.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},eo=(e,t,i)=>{const n=`tel:${e}`,r=`sms:${e}`,o=`whatsapp://send?phone=${e}}`,a=`facetime:${e}`,s=`facetime-audio:${e}`,l=/\(\d{3}\)\s\d{3}-\d{4}/g,u=/(tel|sms):\(\d{3}\)\s\d{3}-\d{4}/g,d=/whatsapp:\/\/send\?phone=\d+/g,c=/(facetime|facetime-audio):\d+/g,p=document.body.getElementsByTagName("*");let h=!1;const f=e.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let m=!1,g=!1;for(let e=0;e<p.length;e++)if(p[e].nodeType===Node.ELEMENT_NODE&&(1===p[e].childNodes.length&&p[e].childNodes[0].nodeType==Node.TEXT_NODE&&(p[e].innerHTML=p[e].innerHTML.replace(l,f),h=!0,m||(m=!0)),p[e].hasAttribute("href"))){const t=p[e].getAttribute("href");if(!t)continue;let i="",l=u;t.startsWith("sms:")?i=r:t.startsWith("whatsapp:")?(i=o,l=d):t.startsWith("facetime:")?(i=a,l=c):t.startsWith("facetime-audio:")?(i=s,l=c):i=n;const h=t.replace(l,i);p[e].setAttribute("href",h),g||(g=!0)}m&&dn({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:f,website:window.location.href},logType:un.info,buildingSlug:i,orgSlug:t}),g&&dn({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:f,website:window.location.href},logType:un.info,buildingSlug:i,orgSlug:t}),h||dn({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:un.warn,buildingSlug:i,orgSlug:t})};var to=function(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};let io=class extends re{constructor(){super(...arguments),this.onClick=()=>{},this.brandColor=Me,this.toExpand=!1}render(){return U`
3249
+ `,gr([le({attribute:!0})],vr.prototype,"isMinimized",void 0),gr([le()],vr.prototype,"mobileStyles",void 0),gr([le({type:Boolean})],vr.prototype,"isFirstMount",void 0),gr([le({attribute:!1})],vr.prototype,"autoOpenChatWidget",void 0),gr([le()],vr.prototype,"phoneNumber",void 0),gr([le({attribute:!0})],vr.prototype,"buildingName",void 0),gr([le({attribute:!0})],vr.prototype,"chatId",void 0),gr([le({attribute:!0})],vr.prototype,"orgLegalName",void 0),gr([le({attribute:!0})],vr.prototype,"chatCallUsHeader",void 0),gr([le({attribute:!1})],vr.prototype,"buildingId",void 0),gr([le({attribute:!0})],vr.prototype,"buildingSlug",void 0),gr([le({attribute:!0})],vr.prototype,"orgSlug",void 0),gr([le({attribute:!0})],vr.prototype,"sgtUrl",void 0),gr([le({attribute:!0})],vr.prototype,"designConcept",void 0),gr([le({attribute:!0})],vr.prototype,"featureFlagShowDropdown",void 0),gr([le({attribute:!1})],vr.prototype,"leadSources",void 0),gr([le({attribute:!0})],vr.prototype,"currentLeadSource",void 0),gr([le({attribute:!0})],vr.prototype,"escortedToursLink",void 0),gr([le({attribute:!0})],vr.prototype,"virtualToursLink",void 0),gr([le({type:Boolean})],vr.prototype,"hasChatEnabledDesktop",void 0),gr([le({type:Boolean})],vr.prototype,"hasChatEnabledMobile",void 0),gr([le({type:Boolean})],vr.prototype,"hasEmailEnabledDesktop",void 0),gr([le({type:Boolean})],vr.prototype,"hasEmailEnabledMobile",void 0),gr([le({type:Boolean})],vr.prototype,"hasCallUsEnabledDesktop",void 0),gr([le({type:Boolean})],vr.prototype,"hasCallUsEnabledMobile",void 0),gr([le({type:Boolean})],vr.prototype,"hasTextUsEnabledDesktop",void 0),gr([le({type:Boolean})],vr.prototype,"hasTextUsEnabledMobile",void 0),gr([le({type:Boolean})],vr.prototype,"hasSSTEnabledDesktop",void 0),gr([le({type:Boolean})],vr.prototype,"hasSSTEnabledMobile",void 0),gr([le({attribute:!1})],vr.prototype,"tourTypeOptions",void 0),gr([le({attribute:!0})],vr.prototype,"hasDynamicSchedulingEnabled",void 0),gr([le({attribute:!0})],vr.prototype,"onExitChat",void 0),gr([le({attribute:!1})],vr.prototype,"hasHideMobileFeatures",void 0),gr([le({type:Number})],vr.prototype,"right",void 0),gr([le({type:Number})],vr.prototype,"bottom",void 0),gr([le({type:Number})],vr.prototype,"top",void 0),gr([le({type:Number})],vr.prototype,"left",void 0),gr([le({attribute:!0})],vr.prototype,"showTourNextToChat",void 0),gr([le({attribute:!1})],vr.prototype,"onChatTapped",void 0),gr([le({attribute:!0})],vr.prototype,"onClickMinimize",void 0),gr([le({attribute:!0})],vr.prototype,"onSstClose",void 0),gr([le({attribute:!0})],vr.prototype,"overrideRentgrata",void 0),gr([le({attribute:!1})],vr.prototype,"launcherStyles",void 0),gr([le({attribute:!0})],vr.prototype,"brandColor",void 0),gr([le({attribute:!0})],vr.prototype,"backgroundColor",void 0),gr([le({attribute:!0})],vr.prototype,"leadSourceClient",void 0),gr([ue()],vr.prototype,"isEmailWindowOpen",void 0),gr([ue()],vr.prototype,"isCallUsWindowOpen",void 0),gr([ue()],vr.prototype,"isSSTWindowOpen",void 0),gr([ue()],vr.prototype,"isTextUsWindowOpen",void 0),gr([ue()],vr.prototype,"isMobileFeaturesExpanded",void 0),vr=gr([ae("meetelise-launcher")],vr);const yr=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",vr)};var br=i(3379),wr=i.n(br),Sr=i(7795),Tr=i.n(Sr),xr=i(569),Ar=i.n(xr),Cr=i(3565),Or=i.n(Cr),Ir=i(9216),Nr=i.n(Ir),Er=i(4589),Rr=i.n(Er),_r=i(3631),Pr={};async function Mr(e,i){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${i}/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 Fr(n.data,i)}return[]}catch(e){return[]}}Pr.styleTagTransform=Rr(),Pr.setAttributes=Or(),Pr.insert=Ar().bind(null,"head"),Pr.domAPI=Tr(),Pr.insertStyleElement=Nr(),wr()(_r.Z,Pr),_r.Z&&_r.Z.locals&&_r.Z.locals;const Fr=(e,t)=>{let i=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":i=["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":i=["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:i=[]}return e.sort(),e.filter((e=>{const t=e.toLowerCase();return!i.map((e=>e.toLowerCase())).includes(t)}))};var Dr,kr=i(9594),Ur=i.n(kr),Lr=new Uint8Array(16);function Br(){if(!Dr&&!(Dr="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 Dr(Lr)}const qr=/^(?:[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,Jr=function(e){return"string"==typeof e&&qr.test(e)};for(var jr=[],Hr=0;Hr<256;++Hr)jr.push((Hr+256).toString(16).substr(1));const Gr=function(e,t,i){var n=(e=e||{}).random||(e.rng||Br)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(var r=0;r<16;++r)t[i+r]=n[r];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(jr[e[t+0]]+jr[e[t+1]]+jr[e[t+2]]+jr[e[t+3]]+"-"+jr[e[t+4]]+jr[e[t+5]]+"-"+jr[e[t+6]]+jr[e[t+7]]+"-"+jr[e[t+8]]+jr[e[t+9]]+"-"+jr[e[t+10]]+jr[e[t+11]]+jr[e[t+12]]+jr[e[t+13]]+jr[e[t+14]]+jr[e[t+15]]).toLowerCase();if(!Jr(i))throw TypeError("Stringified UUID is invalid");return i}(n)},zr=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Wr=(e,t,i)=>{const n=yi(new Date),r=i||`lead_${Gr()}_${e}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:n,initiatedChat:t})),{leadId:r,timestamp:Ci(n),buildingSlug:e,initiatedChat:t}},Vr=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const i=JSON.parse(t),n={leadId:i.leadId,timestamp:new Date(i.timestamp),buildingSlug:i.buildingSlug,initiatedChat:i.initiatedChat};if(Qr(e,n))return n}catch(e){console.warn("Error getting chat storage key")}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Qr=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(ui(t.timestamp,e))return!1}}catch(e){console.warn("Error checking chat storage key validity")}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp||pi(t.timestamp,24))};var Kr;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(Kr||(Kr={}));const Xr=e=>e.type===Yr.text,$r=e=>e.type===Yr.media;var Yr;!function(e){e.text="text",e.media="media"}(Yr||(Yr={}));const Zr=class{constructor(e,t,i,n=null,r,o=null,a=Bo.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.building=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.widgetType=Bo.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,i;const n={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,n],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter((e=>e.message.messageType!==Kr.noReply)),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const r="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;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===Yr.text&&e.message.includes("confirmed for your tour")))&&tn("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(i=this.building)||void 0===i?void 0:i.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(!Xr(e))return!1;const t=e.chunks.find((e=>e.isDone));return!t||e.chunks.length===t.order}));t&&(this.streamingMessageTimeout=setTimeout((()=>{dn({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:un.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),console.warn(`PUBNUB_WARN_DELAYED_STREAMING_MESSAGES: ${e}`),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 console.warn("Error checking if message contains email",e),!1}})(e.message.text))return;tn("leadProvidedEmail",{buildingId:null===(t=this.building)||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,i;for(let n=e.length-1;n>=0;n--){const r=null===(t=e[n])||void 0===t?void 0:t.message,o=n>0&&(null===(i=e[n-1])||void 0===i?void 0:i.message);(null==r?void 0:r.messageType)===Kr.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.building&&dn({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:un.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=Wr(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken((async()=>{var t,i,n,r,o;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout((()=>{console.error("Elise AI did not respond in time..."),this.building&&dn({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:un.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===Bo.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===(i=this.building)||void 0===i?void 0:i.id,buildingSlug:this.buildingSlug,userId:null===(n=this.building)||void 0===n?void 0:n.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState()}}),this.isFirstChatMessageSent||(tn("firstChatMessageSent",{message:e,buildingId:null===(r=this.building)||void 0===r?void 0:r.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),tn("chatMessageSent",{message:e,buildingId:null===(o=this.building)||void 0===o?void 0:o.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 i=`${e.message.stream_id}-${e.message.order}-${e.message.messageType}`;return t.has(i)?(dn({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:un.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),!1):(t.add(i),!0)}))},this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],i={};return this.removeDuplicatedRawPubnubMessages(e).forEach((e=>{var n;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(n=e.message.media)&&void 0!==n?n:[],isLeadMessage:this.isLeadMessage(e),type:Yr.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:Yr.text}):i[e.message.stream_id]?i[e.message.stream_id].push(e):i[e.message.stream_id]=[e]})),Object.keys(i).forEach((e=>{const n=i[e],r=this.getConsecutiveChunks(n.sort(((e,t)=>{var i,n;return(null!==(i=e.message.order)&&void 0!==i?i:0)-(null!==(n=t.message.order)&&void 0!==n?n: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,i;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(i=e.message.is_done)&&void 0!==i&&i}})),type:Yr.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)})),t.sort(((e,t)=>e.timestamp-t.timestamp)),t},this.getConsecutiveChunks=e=>{var t,i;const n=e.sort(((e,t)=>{var i,n;return(null!==(i=e.message.order)&&void 0!==i?i:0)-(null!==(n=t.message.order)&&void 0!==n?n:0)})),r=[];let o=null!==(t=n[0].message.order)&&void 0!==t?t:0;for(const e of n){if((null!==(i=e.message.order)&&void 0!==i?i:-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.building=t,this.orgSlug=i,this.leadSource=n,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=o,this.widgetType=a}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(Ur())({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,i){try{return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${i}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.building&&dn({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:un.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.building&&dn({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:un.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(t){try{await t()}catch(i){if(i instanceof e.AxiosError&&i&&i.response&&403===i.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const e=await this.fetchToken(this.leadUserId,this.channel);if(!e)return;this.pubnub.setAuthKey(e.auth.result.token),await t()}catch(e){this.building&&dn({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:un.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let i=[],n=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise(((i,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=n?n:void 0},((e,t)=>{e.error?o(e):i(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),i=i.concat(t.filter((e=>e.message.messageType!==Kr.noReply)))}if(n=a[0].timetoken,i.length>=e||a.length<r)break}this.rawPubnubMessages=i.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.building&&dn({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:un.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},eo=(e,t,i)=>{const n=`tel:${e}`,r=`sms:${e}`,o=`whatsapp://send?phone=${e}}`,a=`facetime:${e}`,s=`facetime-audio:${e}`,l=/(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}/g,u=/(tel|sms):(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}/g,d=/whatsapp:\/\/send\?phone=\d+/g,c=/(facetime|facetime-audio):\d+/g,p=document.body.getElementsByTagName("*");let h=!1;const f=e.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let m=!1,g=!1;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].innerHTML.replace(l,f);p[e].innerHTML=t,h=!0,m||(m=!0)}if(p[e].hasAttribute("href")){const t=p[e].getAttribute("href");if(!t)continue;let i="",l=u;t.startsWith("sms:")?i=r:t.startsWith("whatsapp:")?(i=o,l=d):t.startsWith("facetime:")?(i=a,l=c):t.startsWith("facetime-audio:")?(i=s,l=c):i=n;const h=t.replace(l,i);p[e].setAttribute("href",h),g||(g=!0)}}m&&dn({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:f,website:window.location.href},logType:un.info,buildingSlug:i,orgSlug:t}),g&&dn({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:f,website:window.location.href},logType:un.info,buildingSlug:i,orgSlug:t}),h||dn({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:un.warn,buildingSlug:i,orgSlug:t})};var to=function(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};let io=class extends re{constructor(){super(...arguments),this.onClick=()=>{},this.brandColor=Me,this.toExpand=!1}render(){return U`
3250
3250
  <div
3251
3251
  class=${this.toExpand?"button-container mini":"button-container"}
3252
3252
  @click=${this.onClick}
@@ -4489,7 +4489,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
4489
4489
  I agree
4490
4490
  </button>
4491
4491
  </div>
4492
- `;var Co=function(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};let Oo=class extends re{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.brandColor=null,this.backgroundColor=null,this.chatId="",this.analytics=null,this.launcher=null,this.building=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=Xi.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.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=Bo.Default,this.onWidgetLoaded=mr(),this.onSstClose=mr(),this.enabledChatWidgets={callDesktop:!0,callMobile:!0,chatMobile:!0,chatDesktop:!0,emailDesktop:!0,emailMobile:!0,textDesktop:!0,textMobile:!0,sstDesktop:!0,sstMobile:!0},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=xe(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await Tn(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,i)=>{const n=window.rentgrata;if(!n)return;const r=n.Widget;if(!r)return;const o=r.config;if(!o)return;const a=o.widgetKey;a&&await t().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=i?i:""}})})(this.buildingSlug,this.orgSlug)}catch(e){console.warn("Error updating rentgrata token",e)}e.conversationMaintenanceMode?console.warn("MeetElise Chat is in maintenance mode. Chat icon will not appear."):1===e.active?(this.building=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)):console.warn("MeetElise has detected this building is NOT active. Chat icon will not appear.")},this.setBuildingDerivedInfo=async()=>{var e,i,n,r,o,a,s,l,u,d,c,p,h,f,m,g,v,y,b,w,S,T,x,A,C,O,I,N,E,R,_,P,M,F,D;const k=this.building;if(!k)return;k&&this.orgSlug&&No(this.orgSlug,this.buildingSlug,null!==(i=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.leadSource)&&void 0!==i?i:null);const[U,L,B,q,J,j,H]=await Promise.all([In(this.buildingSlug),Mr(this.orgSlug,this.buildingSlug),$i(this.buildingSlug),Yi(this.buildingSlug),On(k.id),Zi(this.buildingSlug),en(this.buildingSlug)]);this.building&&(this.building.phoneNumber=Ne(k.phoneNumber)),this.designConcept=null!==(n=null==U?void 0:U.abTestType)&&void 0!==n?n:"",this.leadSources=L,this.featureFlagShowDropdown=B;const G=k.textWithUsPhoneNumber?k.textWithUsPhoneNumber:await(async e=>{try{const i="https://app.meetelise.com",n=await t().get(`${i}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return dn({logType:un.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug);var z,W;this.enabledChatWidgets={callDesktop:!(null===(r=null==J?void 0:J.config.shouldShowPhone)||void 0===r||!r)||null!==(o=null==J?void 0:J.config.shouldShowPhoneDesktop)&&void 0!==o&&o,callMobile:!(null===(a=null==J?void 0:J.config.shouldShowPhone)||void 0===a||!a)||null!==(s=null==J?void 0:J.config.shouldShowPhoneMobile)&&void 0!==s&&s,chatDesktop:!(null===(l=null==J?void 0:J.config.shouldShowChat)||void 0===l||!l)||null!==(u=null==J?void 0:J.config.shouldShowChatDesktop)&&void 0!==u&&u,chatMobile:!(null===(d=null==J?void 0:J.config.shouldShowChat)||void 0===d||!d)||null!==(c=null==J?void 0:J.config.shouldShowChatMobile)&&void 0!==c&&c,emailDesktop:!(null===(p=null==J?void 0:J.config.shouldShowEmail)||void 0===p||!p)||null!==(h=null==J?void 0:J.config.shouldShowEmailDesktop)&&void 0!==h&&h,emailMobile:!(null===(f=null==J?void 0:J.config.shouldShowEmail)||void 0===f||!f)||null!==(m=null==J?void 0:J.config.shouldShowEmailMobile)&&void 0!==m&&m,textDesktop:(!(null===(g=null==J?void 0:J.config.shouldShowText)||void 0===g||!g)||null!==(v=null==J?void 0:J.config.shouldShowTextDesktop)&&void 0!==v&&v)&&!!G,textMobile:(!(null===(y=null==J?void 0:J.config.shouldShowText)||void 0===y||!y)||null!==(b=null==J?void 0:J.config.shouldShowTextMobile)&&void 0!==b&&b)&&!!G,sstDesktop:!(null===(w=null==J?void 0:J.config.shouldShowSst)||void 0===w||!w)||null!==(S=null==J?void 0:J.config.shouldShowSstDesktop)&&void 0!==S&&S,sstMobile:!(null===(T=null==J?void 0:J.config.shouldShowSst)||void 0===T||!T)||null!==(x=null==J?void 0:J.config.shouldShowSstMobile)&&void 0!==x&&x},this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(W=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(),W(e)}))})),H&&(e=>{document.querySelectorAll('a[href$="schedule-a-tour"]').forEach((t=>{t&&t.addEventListener("click",(t=>{t.preventDefault(),e(t)}))}))})(this.handleTourClicked)):(null===(A=this.LeadSourceClient)||void 0===A?void 0:A.leadSource)&&(z=null!==(O=null===(C=this.LeadSourceClient)||void 0===C?void 0:C.leadSource)&&void 0!==O?O:null,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const i=t.includes("?")?"&":"?";e.setAttribute("href",t+i+`eliseParsedLeadSource=${encodeURIComponent(z)}`)}}))),J&&J.config&&(this.brandColor=null!==(I=J.config.primaryColor)&&void 0!==I?I:null,this.backgroundColor=null!==(N=J.config.backgroundColor)&&void 0!==N?N:null,this.webchatConfigHasAutoOpenChat=J.config.autoOpenChat,this.requiresConsent=J.config.requiresConsent,this.hideMobileFeatures=J.config.hideMobileFeatures,this.privacyPolicyUrl=null!==(E=J.config.privacyPolicyUrl)&&void 0!==E?E:this.privacyPolicyUrl,J.config.displayStyle===An.MINIMIZED&&(this.isMinimized=!0),J.config.displayStyle===An.PILLS&&(this.designConcept=null),J.config.displayStyle===An.EMOJI&&(this.designConcept=An.EMOJI),this.onWidgetLoaded()),null===this.brandColor&&(this.brandColor=Me),null===this.backgroundColor&&(this.backgroundColor=Fe);const V=null!==(_=null===(R=this.building)||void 0===R?void 0:R.phoneNumber)&&void 0!==_?_:"";let Q=null;q&&(Q=await async function(e,i){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source?source=${i}`);return n.data?{number:Ne(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(M=null===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&void 0!==M?M:null),Q&&!Q.isMatch&&(Q.number=V)),j&&(null==Q?void 0:Q.number)&&eo(Q.number,this.orgSlug,this.buildingSlug);const K=localStorage.getItem("eliseai_phone_number_devtest");K&&(console.info("Using dev test phone number: ",K),eo(K,this.orgSlug,this.buildingSlug)),this.phoneNumberForSource=Q||{number:V,isMatch:!1,isPropertyWebsiteCatchall:!0};const X=null!==(D=null===(F=this.LeadSourceClient)||void 0===F?void 0:F.leadSource)&&void 0!==D?D:null;X&&(this.leadSources.includes(X)||this.leadSources.push(X)),qi(k.id)},this.initializeChatVariables=async()=>{var e,i,n,r,o,a,s;if(!this.building)return;const l=Vr(this.buildingSlug),u=Qr(this.buildingSlug,l)?l:Wr(this.buildingSlug,!1);if(!u.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new class{constructor(){this.chatId=null,this.apiHost="https://app.meetelise.com",this.leadSource=null,this.localStorageTTLDays=30,this.buildingId=null,this.orgSlug=null,this.buildingSlug=null,this.queryParameters=null,this.leadSourceInput=null,this.updateLeadSourceLocalStorage=(e,t,i,n)=>{const r=cn();if(this.leadSourceInput={websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:r,referrer:document.referrer,parsedUtmSource:r?r.utm_source:null,campaignSources:Object.values(ln()).filter((e=>e))},n)return;const o=this.getLeadSourceBodyIfValid(e);if(o&&!pi(o.timestamp,24*this.localStorageTTLDays))return{...o,timestamp:Ci(o.timestamp)};const a={leadSource:t,leadId:i,buildingSlug:e,timestamp:yi(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:Ci(a.timestamp)}},this.getLeadSourceBodyIfValid=e=>{const t=localStorage.getItem("com.elise.webchat.leadsource.slug="+e);if(t)try{const i=JSON.parse(t);if(i.buildingSlug===e&&i.leadSource&&i.leadId&&i.timestamp&&!pi(Ci(i.timestamp),24*this.localStorageTTLDays)){try{this.leadSourceInput=i.leadSourceInput}catch(e){console.error("Error parsing leadSourceInput from localStorage")}return i}}catch(e){return null}return null}}async fetchCurrentParsedLeadSource({buildingSlug:e,queryParams:i,referrer:n,campaignSources:r}){try{return(await t().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,{query_params:i,building_slug:e,referrer:n,campaign_sources:r})).data}catch(e){return null}}async checkAndHandleForLogLeadSource({webchatAction:e,stateId:i}){var n,r,o,a,s,l,u;try{if(!this.chatId)return console.error("chatId is not set"),null;if(!this.orgSlug)return console.error("orgId is not set"),null;let d=null,c=null;try{if("f1ba5a20-d207-4e5a-879e-65199e7d0a53"===this.orgSlug){const e=await this.getCookieValue("_ga");e&&(d=e),c=null===(n=window.dataLayer.find((e=>{var t;return"gtagApiGet"==(null===(t=e.value)||void 0===t?void 0:t.event)})))||void 0===n?void 0:n.value}}catch(e){console.error("error getting cookie")}return await t().post(`${this.apiHost}/platformApi/webchat/log/lead-source`,{chat_id:this.chatId,webchat_action:e,state_id:i,building_id:this.buildingId,org_slug:this.orgSlug,building_slug:this.buildingSlug,website_origin:null===(r=this.leadSourceInput)||void 0===r?void 0:r.websiteOrigin,website_search:null===(o=this.leadSourceInput)||void 0===o?void 0:o.websiteSearch,query_parameters:null===(a=this.leadSourceInput)||void 0===a?void 0:a.queryParameters,referrer:null===(s=this.leadSourceInput)||void 0===s?void 0:s.referrer,parsed_utm_source:null===(l=this.leadSourceInput)||void 0===l?void 0:l.parsedUtmSource,campaign_sources:null===(u=this.leadSourceInput)||void 0===u?void 0:u.campaignSources,lead_source_output:this.leadSource,google_analytics_client_id:fn()(d)?null:d,extras:null!=c?c:null}),null}catch(e){return null}}async getCookieValue(e){try{const t=document.cookie.split(";");for(let i=0;i<t.length;i++){const n=t[i].trim();if(n.startsWith(e+"="))return n.substring((e+"=").length,-1===n.indexOf(";")?void 0:n.indexOf(";"))}return null}catch(e){console.error("error getting cookie value")}return null}async generateUserLeadSource({leadId:e,orgSlug:t,buildingSlug:i}){try{const n={queryParams:cn(),buildingSlug:i,referrer:document.referrer,campaignSources:ln()},r=i?this.getLeadSourceBodyIfValid(i):null;if(r)return this.leadSource=r.leadSource,this.leadSource;const o=await this.fetchCurrentParsedLeadSource(n);if(this.leadSource=o,this.buildingId=null,this.orgSlug=t,this.buildingSlug=i,i&&!o){const e=this.getLeadSourceBodyIfValid(i);if(e)return this.leadSource=e.leadSource,this.leadSource}if(i){const t=!!o&&o.length>0;this.updateLeadSourceLocalStorage(i,o,e,!t)}return o}catch(e){console.error(e)}return null}},this.myPubnub=new Zr(this.buildingSlug,this.building,this.orgSlug,null,u.leadId,this.LeadSourceClient,this.widgetType),this.LeadSourceClient.chatId=this.myPubnub.channel,await(null===(e=this.LeadSourceClient)||void 0===e?void 0:e.generateUserLeadSource({leadId:null!==(n=null===(i=this.myPubnub)||void 0===i?void 0:i.leadUserId)&&void 0!==n?n:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug})),"property-website"!==mn(this.orgSlug)?this.myPubnub.leadSource=null!==(o=null===(r=this.LeadSourceClient)||void 0===r?void 0:r.leadSource)&&void 0!==o?o:mn(this.orgSlug):this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:null,u.initiatedChat&&await this.myPubnub.initializePubnub(l)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),i=!t||!(t&&!xi(Ci(t)));return!!e&&!!i&&!ci()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",yi(function(e,t){Be(2,arguments);var i=it(t);return nt(e,6e4*i)}(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,i;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===(i=this.launcherRef.value)||void 0===i||i.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,i,n;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(n=null===(i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===i?void 0:i.shadowRoot)||void 0===n?void 0:n.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,i,n,r,o,a,s,l,u,d,c,p,h,f,m,g,v,y,b,w;if("Tab"===e.key){const S=this.displayPubnubChat?null===(n=null===(i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===i?void 0:i.shadowRoot)||void 0===n?void 0:n.getElementById("pubnub-chat-container"):null!==(m=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===(h=null===(p=null===(c=null===(d=this.shadowRoot)||void 0===d?void 0:d.getElementById("meetelise-launcher"))||void 0===c?void 0:c.shadowRoot)||void 0===p?void 0:p.getElementById("tour-scheduler-window"))||void 0===h?void 0:h.shadowRoot)||void 0===f?void 0:f.getElementById("scheduler-container"))&&void 0!==m?m:null===(w=null===(b=null===(y=null===(v=null===(g=this.shadowRoot)||void 0===g?void 0:g.getElementById("meetelise-launcher"))||void 0===v?void 0:v.shadowRoot)||void 0===y?void 0:y.getElementById("call-us-window"))||void 0===b?void 0:b.shadowRoot)||void 0===w?void 0:w.getElementById("details-window");if(!S)return;e.preventDefault();const T=S.querySelectorAll("input, me-select, textarea, action-confirm-button, [tabindex]"),x=Array.from(T),A=x.findIndex((e=>e.matches(":focus")));x[(A+1)%x.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")},this.renderChatAdditionalActions=(e,t)=>{const i=this.building&&ke(this.building.orgId,this.building.id)&&this.brandColor&&this.brandColor!==Me?De(this.brandColor,.6):"black";return U` <style>
4492
+ `;var Co=function(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};let Oo=class extends re{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.brandColor=null,this.backgroundColor=null,this.chatId="",this.analytics=null,this.launcher=null,this.building=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=Xi.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.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=Bo.Default,this.onWidgetLoaded=mr(),this.onSstClose=mr(),this.enabledChatWidgets={callDesktop:!0,callMobile:!0,chatMobile:!0,chatDesktop:!0,emailDesktop:!0,emailMobile:!0,textDesktop:!0,textMobile:!0,sstDesktop:!0,sstMobile:!0},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=xe(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await Tn(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,i)=>{const n=window.rentgrata;if(!n)return;const r=n.Widget;if(!r)return;const o=r.config;if(!o)return;const a=o.widgetKey;a&&await t().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=i?i:""}})})(this.buildingSlug,this.orgSlug)}catch(e){console.warn("Error updating rentgrata token",e)}e.conversationMaintenanceMode?console.warn("MeetElise Chat is in maintenance mode. Chat icon will not appear."):1===e.active?(this.building=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)):console.warn("MeetElise has detected this building is NOT active. Chat icon will not appear.")},this.setBuildingDerivedInfo=async()=>{var e,i,n,r,o,a,s,l,u,d,c,p,h,f,m,g,v,y,b,w,S,T,x,A,C,O,I,N,E,R,_,P,M,F,D;const k=this.building;if(!k)return;k&&this.orgSlug&&No(this.orgSlug,this.buildingSlug,null!==(i=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.leadSource)&&void 0!==i?i:null);const[U,L,B,q,J,j,H]=await Promise.all([In(this.buildingSlug),Mr(this.orgSlug,this.buildingSlug),$i(this.buildingSlug),Yi(this.buildingSlug),On(k.id),Zi(this.buildingSlug),en(this.buildingSlug)]);this.building&&(this.building.phoneNumber=Ne(k.phoneNumber)),this.designConcept=null!==(n=null==U?void 0:U.abTestType)&&void 0!==n?n:"",this.leadSources=L,this.featureFlagShowDropdown=B;const G=k.textWithUsPhoneNumber?k.textWithUsPhoneNumber:await(async e=>{try{const i="https://app.meetelise.com",n=await t().get(`${i}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return dn({logType:un.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug);var z,W;this.enabledChatWidgets={callDesktop:!(null===(r=null==J?void 0:J.config.shouldShowPhone)||void 0===r||!r)||null!==(o=null==J?void 0:J.config.shouldShowPhoneDesktop)&&void 0!==o&&o,callMobile:!(null===(a=null==J?void 0:J.config.shouldShowPhone)||void 0===a||!a)||null!==(s=null==J?void 0:J.config.shouldShowPhoneMobile)&&void 0!==s&&s,chatDesktop:!(null===(l=null==J?void 0:J.config.shouldShowChat)||void 0===l||!l)||null!==(u=null==J?void 0:J.config.shouldShowChatDesktop)&&void 0!==u&&u,chatMobile:!(null===(d=null==J?void 0:J.config.shouldShowChat)||void 0===d||!d)||null!==(c=null==J?void 0:J.config.shouldShowChatMobile)&&void 0!==c&&c,emailDesktop:!(null===(p=null==J?void 0:J.config.shouldShowEmail)||void 0===p||!p)||null!==(h=null==J?void 0:J.config.shouldShowEmailDesktop)&&void 0!==h&&h,emailMobile:!(null===(f=null==J?void 0:J.config.shouldShowEmail)||void 0===f||!f)||null!==(m=null==J?void 0:J.config.shouldShowEmailMobile)&&void 0!==m&&m,textDesktop:(!(null===(g=null==J?void 0:J.config.shouldShowText)||void 0===g||!g)||null!==(v=null==J?void 0:J.config.shouldShowTextDesktop)&&void 0!==v&&v)&&!!G,textMobile:(!(null===(y=null==J?void 0:J.config.shouldShowText)||void 0===y||!y)||null!==(b=null==J?void 0:J.config.shouldShowTextMobile)&&void 0!==b&&b)&&!!G,sstDesktop:!(null===(w=null==J?void 0:J.config.shouldShowSst)||void 0===w||!w)||null!==(S=null==J?void 0:J.config.shouldShowSstDesktop)&&void 0!==S&&S,sstMobile:!(null===(T=null==J?void 0:J.config.shouldShowSst)||void 0===T||!T)||null!==(x=null==J?void 0:J.config.shouldShowSstMobile)&&void 0!==x&&x},this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(W=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(),W(e)}))})),H&&(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=>{const t=document.querySelector('a[href^="#leaseleads-tour-open"]');t&&t.addEventListener("click",(t=>{t.preventDefault(),e(t)}))})(this.handleTourClicked)):(null===(A=this.LeadSourceClient)||void 0===A?void 0:A.leadSource)&&(z=null!==(O=null===(C=this.LeadSourceClient)||void 0===C?void 0:C.leadSource)&&void 0!==O?O:null,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");if(t&&t.startsWith("https://app.meetelise.com/")){const i=t.includes("?")?"&":"?";e.setAttribute("href",t+i+`eliseParsedLeadSource=${encodeURIComponent(z)}`)}}))),J&&J.config&&(this.brandColor=null!==(I=J.config.primaryColor)&&void 0!==I?I:null,this.backgroundColor=null!==(N=J.config.backgroundColor)&&void 0!==N?N:null,this.webchatConfigHasAutoOpenChat=J.config.autoOpenChat,this.requiresConsent=J.config.requiresConsent,this.hideMobileFeatures=J.config.hideMobileFeatures,this.privacyPolicyUrl=null!==(E=J.config.privacyPolicyUrl)&&void 0!==E?E:this.privacyPolicyUrl,J.config.displayStyle===An.MINIMIZED&&(this.isMinimized=!0),J.config.displayStyle===An.PILLS&&(this.designConcept=null),J.config.displayStyle===An.EMOJI&&(this.designConcept=An.EMOJI),this.onWidgetLoaded()),null===this.brandColor&&(this.brandColor=Me),null===this.backgroundColor&&(this.backgroundColor=Fe);const V=null!==(_=null===(R=this.building)||void 0===R?void 0:R.phoneNumber)&&void 0!==_?_:"";let Q=null;q&&(Q=await async function(e,i){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source?source=${i}`);return n.data?{number:Ne(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(M=null===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&void 0!==M?M:null),Q&&!Q.isMatch&&(Q.number=V)),j&&(null==Q?void 0:Q.number)&&eo(Q.number,this.orgSlug,this.buildingSlug);const K=localStorage.getItem("eliseai_phone_number_devtest");K&&(console.info("Using dev test phone number: ",K),eo(K,this.orgSlug,this.buildingSlug)),this.phoneNumberForSource=Q||{number:V,isMatch:!1,isPropertyWebsiteCatchall:!0};const X=null!==(D=null===(F=this.LeadSourceClient)||void 0===F?void 0:F.leadSource)&&void 0!==D?D:null;X&&(this.leadSources.includes(X)||this.leadSources.push(X)),qi(k.id)},this.initializeChatVariables=async()=>{var e,i,n,r,o,a,s;if(!this.building)return;const l=Vr(this.buildingSlug),u=Qr(this.buildingSlug,l)?l:Wr(this.buildingSlug,!1);if(!u.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new class{constructor(){this.chatId=null,this.apiHost="https://app.meetelise.com",this.leadSource=null,this.localStorageTTLDays=30,this.buildingId=null,this.orgSlug=null,this.buildingSlug=null,this.queryParameters=null,this.leadSourceInput=null,this.updateLeadSourceLocalStorage=(e,t,i,n)=>{const r=cn();if(this.leadSourceInput={websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:r,referrer:document.referrer,parsedUtmSource:r?r.utm_source:null,campaignSources:Object.values(ln()).filter((e=>e))},n)return;const o=this.getLeadSourceBodyIfValid(e);if(o&&!pi(o.timestamp,24*this.localStorageTTLDays))return{...o,timestamp:Ci(o.timestamp)};const a={leadSource:t,leadId:i,buildingSlug:e,timestamp:yi(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:Ci(a.timestamp)}},this.getLeadSourceBodyIfValid=e=>{const t=localStorage.getItem("com.elise.webchat.leadsource.slug="+e);if(t)try{const i=JSON.parse(t);if(i.buildingSlug===e&&i.leadSource&&i.leadId&&i.timestamp&&!pi(Ci(i.timestamp),24*this.localStorageTTLDays)){try{this.leadSourceInput=i.leadSourceInput}catch(e){console.error("Error parsing leadSourceInput from localStorage")}return i}}catch(e){return null}return null}}async fetchCurrentParsedLeadSource({buildingSlug:e,queryParams:i,referrer:n,campaignSources:r}){try{return(await t().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,{query_params:i,building_slug:e,referrer:n,campaign_sources:r})).data}catch(e){return null}}async checkAndHandleForLogLeadSource({webchatAction:e,stateId:i}){var n,r,o,a,s,l,u;try{if(!this.chatId)return console.error("chatId is not set"),null;if(!this.orgSlug)return console.error("orgId is not set"),null;let d=null,c=null;try{if("f1ba5a20-d207-4e5a-879e-65199e7d0a53"===this.orgSlug){const e=await this.getCookieValue("_ga");e&&(d=e),c=null===(n=window.dataLayer.find((e=>{var t;return"gtagApiGet"==(null===(t=e.value)||void 0===t?void 0:t.event)})))||void 0===n?void 0:n.value}}catch(e){console.error("error getting cookie")}return await t().post(`${this.apiHost}/platformApi/webchat/log/lead-source`,{chat_id:this.chatId,webchat_action:e,state_id:i,building_id:this.buildingId,org_slug:this.orgSlug,building_slug:this.buildingSlug,website_origin:null===(r=this.leadSourceInput)||void 0===r?void 0:r.websiteOrigin,website_search:null===(o=this.leadSourceInput)||void 0===o?void 0:o.websiteSearch,query_parameters:null===(a=this.leadSourceInput)||void 0===a?void 0:a.queryParameters,referrer:null===(s=this.leadSourceInput)||void 0===s?void 0:s.referrer,parsed_utm_source:null===(l=this.leadSourceInput)||void 0===l?void 0:l.parsedUtmSource,campaign_sources:null===(u=this.leadSourceInput)||void 0===u?void 0:u.campaignSources,lead_source_output:this.leadSource,google_analytics_client_id:fn()(d)?null:d,extras:null!=c?c:null}),null}catch(e){return null}}async getCookieValue(e){try{const t=document.cookie.split(";");for(let i=0;i<t.length;i++){const n=t[i].trim();if(n.startsWith(e+"="))return n.substring((e+"=").length,-1===n.indexOf(";")?void 0:n.indexOf(";"))}return null}catch(e){console.error("error getting cookie value")}return null}async generateUserLeadSource({leadId:e,orgSlug:t,buildingSlug:i}){try{const n={queryParams:cn(),buildingSlug:i,referrer:document.referrer,campaignSources:ln()},r=i?this.getLeadSourceBodyIfValid(i):null;if(r)return this.leadSource=r.leadSource,this.leadSource;const o=await this.fetchCurrentParsedLeadSource(n);if(this.leadSource=o,this.buildingId=null,this.orgSlug=t,this.buildingSlug=i,i&&!o){const e=this.getLeadSourceBodyIfValid(i);if(e)return this.leadSource=e.leadSource,this.leadSource}if(i){const t=!!o&&o.length>0;this.updateLeadSourceLocalStorage(i,o,e,!t)}return o}catch(e){console.error(e)}return null}},this.myPubnub=new Zr(this.buildingSlug,this.building,this.orgSlug,null,u.leadId,this.LeadSourceClient,this.widgetType),this.LeadSourceClient.chatId=this.myPubnub.channel,await(null===(e=this.LeadSourceClient)||void 0===e?void 0:e.generateUserLeadSource({leadId:null!==(n=null===(i=this.myPubnub)||void 0===i?void 0:i.leadUserId)&&void 0!==n?n:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug})),"property-website"!==mn(this.orgSlug)?this.myPubnub.leadSource=null!==(o=null===(r=this.LeadSourceClient)||void 0===r?void 0:r.leadSource)&&void 0!==o?o:mn(this.orgSlug):this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:null,u.initiatedChat&&await this.myPubnub.initializePubnub(l)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),i=!t||!(t&&!xi(Ci(t)));return!!e&&!!i&&!ci()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",yi(function(e,t){Be(2,arguments);var i=it(t);return nt(e,6e4*i)}(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,i;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===(i=this.launcherRef.value)||void 0===i||i.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,i,n;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(n=null===(i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===i?void 0:i.shadowRoot)||void 0===n?void 0:n.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,i,n,r,o,a,s,l,u,d,c,p,h,f,m,g,v,y,b,w;if("Tab"===e.key){const S=this.displayPubnubChat?null===(n=null===(i=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===i?void 0:i.shadowRoot)||void 0===n?void 0:n.getElementById("pubnub-chat-container"):null!==(m=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===(h=null===(p=null===(c=null===(d=this.shadowRoot)||void 0===d?void 0:d.getElementById("meetelise-launcher"))||void 0===c?void 0:c.shadowRoot)||void 0===p?void 0:p.getElementById("tour-scheduler-window"))||void 0===h?void 0:h.shadowRoot)||void 0===f?void 0:f.getElementById("scheduler-container"))&&void 0!==m?m:null===(w=null===(b=null===(y=null===(v=null===(g=this.shadowRoot)||void 0===g?void 0:g.getElementById("meetelise-launcher"))||void 0===v?void 0:v.shadowRoot)||void 0===y?void 0:y.getElementById("call-us-window"))||void 0===b?void 0:b.shadowRoot)||void 0===w?void 0:w.getElementById("details-window");if(!S)return;e.preventDefault();const T=S.querySelectorAll("input, me-select, textarea, action-confirm-button, [tabindex]"),x=Array.from(T),A=x.findIndex((e=>e.matches(":focus")));x[(A+1)%x.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")},this.renderChatAdditionalActions=(e,t)=>{const i=this.building&&ke(this.building.orgId,this.building.id)&&this.brandColor&&this.brandColor!==Me?De(this.brandColor,.6):"black";return U` <style>
4493
4493
  #{id}::after {
4494
4494
  border-right-color: ${i} !important;
4495
4495
  }
@@ -46,6 +46,7 @@ import {
46
46
  insertLeadSourceIntoSchedulerLinks,
47
47
  replacePageRedirectElementWithTourWidgetTrigger,
48
48
  replaceSSTLinkWithTourWidgetTrigger,
49
+ replaceTourTriggerElementWithTourWidgetTrigger,
49
50
  } from "../insertLeadSourceIntoSchedulerLinks";
50
51
 
51
52
  import "./actions/minimize-expand-button";
@@ -385,6 +386,9 @@ export class MEChat extends LitElement {
385
386
  if (featureFlagReplaceScheduleTourCtaWebsite) {
386
387
  replacePageRedirectElementWithTourWidgetTrigger(this.handleTourClicked);
387
388
  }
389
+ if (this.orgSlug === "radco") {
390
+ replaceTourTriggerElementWithTourWidgetTrigger(this.handleTourClicked);
391
+ }
388
392
  } else {
389
393
  if (this.LeadSourceClient?.leadSource) {
390
394
  insertLeadSourceIntoSchedulerLinks(
@@ -16,8 +16,9 @@ export const insertDNIIntoWebsite = (
16
16
  const newFacetimeNumber = `facetime:${cleanPhoneNumber}`;
17
17
  const newFacetimeAudioNumber = `facetime-audio:${cleanPhoneNumber}`;
18
18
 
19
- const phoneNumberPattern = /\(\d{3}\)\s\d{3}-\d{4}/g;
20
- const hrefNumberPattern = /(tel|sms):\(\d{3}\)\s\d{3}-\d{4}/g;
19
+ const phoneNumberPattern = /(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}/g;
20
+ const hrefNumberPattern = /(tel|sms):(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}/g;
21
+
21
22
  const whatsappNumberPattern = /whatsapp:\/\/send\?phone=\d+/g;
22
23
  const facetimeNumberPattern = /(facetime|facetime-audio):\d+/g;
23
24
 
@@ -44,10 +45,12 @@ export const insertDNIIntoWebsite = (
44
45
  allHTMLItems[i].childNodes.length === 1 &&
45
46
  allHTMLItems[i].childNodes[0].nodeType == Node.TEXT_NODE
46
47
  ) {
47
- allHTMLItems[i].innerHTML = allHTMLItems[i].innerHTML.replace(
48
+ const oldInnerHTML = allHTMLItems[i].innerHTML;
49
+ const newInnerHTML = oldInnerHTML.replace(
48
50
  phoneNumberPattern,
49
51
  newPhoneNumber
50
52
  );
53
+ allHTMLItems[i].innerHTML = newInnerHTML;
51
54
 
52
55
  foundPhoneNumber = true;
53
56
 
@@ -48,3 +48,16 @@ export const replacePageRedirectElementWithTourWidgetTrigger = (
48
48
  });
49
49
  });
50
50
  };
51
+
52
+ export const replaceTourTriggerElementWithTourWidgetTrigger = (
53
+ handleTourClicked: (e: MouseEvent) => void
54
+ ): void => {
55
+ // example https://bristolcreekga.com/
56
+ const element = document.querySelector('a[href^="#leaseleads-tour-open"]');
57
+ if (element) {
58
+ element.addEventListener("click", (event) => {
59
+ event.preventDefault();
60
+ handleTourClicked(event as MouseEvent);
61
+ });
62
+ }
63
+ };