@meetelise/chat 1.57.0 → 1.58.0
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/WebComponent/me-chat.d.ts +11 -0
- package/dist/src/main/MEChat.d.ts +12 -1
- package/package.json +1 -1
- package/public/dist/index.js +14 -14
- package/src/WebComponent/me-chat.ts +25 -4
- package/src/main/MEChat.ts +75 -1
- package/src/orgLevelNavigation.test.ts +114 -1
|
@@ -20,6 +20,11 @@ export declare class MEChat extends LitElement {
|
|
|
20
20
|
* org-anchored; its id is sent with visitor messages as `declaredBuildingId`.
|
|
21
21
|
*/
|
|
22
22
|
private declaredBuildingSlug;
|
|
23
|
+
/**
|
|
24
|
+
* Org-level webchat on a host that knows the page's building by id (Elise
|
|
25
|
+
* Studio), set with `setDeclaredBuildingId`. Undefined until the host sets it.
|
|
26
|
+
*/
|
|
27
|
+
private hostDeclaredBuildingId;
|
|
23
28
|
/**
|
|
24
29
|
* Org-level webchat (`centralConvo` started without a building). Stays true
|
|
25
30
|
* after the widget adopts the org's triage general building from
|
|
@@ -93,6 +98,12 @@ export declare class MEChat extends LitElement {
|
|
|
93
98
|
* its building's number (the org's triage line).
|
|
94
99
|
*/
|
|
95
100
|
private withOrgLevelContactOptions;
|
|
101
|
+
/**
|
|
102
|
+
* Org-level webchat: the page's building, sent with later visitor messages as
|
|
103
|
+
* `declaredBuildingId`. For hosts that move between pages without restarting
|
|
104
|
+
* the widget; it doesn't change config or the conversation.
|
|
105
|
+
*/
|
|
106
|
+
setDeclaredBuildingId(id: number | null): void;
|
|
96
107
|
/** The numeric id of the snippet's building in org-level webchat, if it names one. */
|
|
97
108
|
private fetchDeclaredBuildingId;
|
|
98
109
|
private shouldAutoOpenChat;
|
|
@@ -27,7 +27,7 @@ export interface HealthcareOptions extends PositioningOptions {
|
|
|
27
27
|
id: string;
|
|
28
28
|
}
|
|
29
29
|
export declare type StudioWebchatMode = "host_managed_context";
|
|
30
|
-
export declare type StudioWebchatSessionScopeType = "building" | "building_group" | "site";
|
|
30
|
+
export declare type StudioWebchatSessionScopeType = "building" | "building_group" | "site" | "org";
|
|
31
31
|
export interface StudioWebchatSessionScope {
|
|
32
32
|
type: StudioWebchatSessionScopeType;
|
|
33
33
|
key: string;
|
|
@@ -45,6 +45,11 @@ export interface StudioWebchatContext {
|
|
|
45
45
|
building?: string | null;
|
|
46
46
|
buildingGroupId?: string | number | null;
|
|
47
47
|
sessionScope?: StudioWebchatSessionScope;
|
|
48
|
+
/**
|
|
49
|
+
* Org scope only: the page's building, sent with visitor messages as
|
|
50
|
+
* `declaredBuildingId`. Null on pages with no single building.
|
|
51
|
+
*/
|
|
52
|
+
declaredBuildingId?: number | null;
|
|
48
53
|
path?: string;
|
|
49
54
|
pageId?: string;
|
|
50
55
|
}
|
|
@@ -86,6 +91,12 @@ export default class MEChat {
|
|
|
86
91
|
static removeWidget(): Promise<void>;
|
|
87
92
|
static handleStudioContext(opts: Options): void;
|
|
88
93
|
static updateStudioContext(context: StudioWebchatContext): void;
|
|
94
|
+
/**
|
|
95
|
+
* Org-level webchat on a Studio site: one org-anchored widget for the whole
|
|
96
|
+
* site, started as the org-level pixel starts it. Route changes only move the
|
|
97
|
+
* page's declared building, so the conversation carries across pages.
|
|
98
|
+
*/
|
|
99
|
+
static updateStudioOrgContext(context: StudioWebchatContext, opts: Options, updateToken: number): void;
|
|
89
100
|
static clearStudioContext(_context?: StudioWebchatClearContext): void;
|
|
90
101
|
static handleBuildingslug(meChat: MEChatLitElement, orgSlug?: string, buildingSlug?: string, originalOpts?: Options): Promise<void>;
|
|
91
102
|
static handleSingleFamilyUrl(): Promise<void>;
|
package/package.json
CHANGED
package/public/dist/index.js
CHANGED
|
@@ -6456,7 +6456,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6456
6456
|
${os}
|
|
6457
6457
|
${as}
|
|
6458
6458
|
${ss}
|
|
6459
|
-
`,au([ue({attribute:!0})],su.prototype,"isMinimized",void 0),au([ue()],su.prototype,"mobileStyles",void 0),au([ue({type:Boolean})],su.prototype,"isFirstMount",void 0),au([ue({attribute:!1})],su.prototype,"openSSTWindowOnLoad",void 0),au([ue({attribute:!1})],su.prototype,"autoOpenChatWidget",void 0),au([ue()],su.prototype,"phoneNumber",void 0),au([ue({attribute:!0})],su.prototype,"buildingName",void 0),au([ue({attribute:!0})],su.prototype,"chatId",void 0),au([ue({attribute:!0})],su.prototype,"orgLegalName",void 0),au([ue({attribute:!1})],su.prototype,"country",void 0),au([ue({attribute:!1})],su.prototype,"buildingState",void 0),au([ue({attribute:!0})],su.prototype,"chatCallUsHeader",void 0),au([ue({attribute:!1})],su.prototype,"buildingId",void 0),au([ue({type:Number})],su.prototype,"orgId",void 0),au([ue({attribute:!1})],su.prototype,"leadSourceParams",void 0),au([ue({attribute:!0})],su.prototype,"buildingSlug",void 0),au([ue({attribute:!0})],su.prototype,"orgSlug",void 0),au([ue({attribute:!0})],su.prototype,"sgtUrl",void 0),au([ue({attribute:!0})],su.prototype,"selfGuidedTourEnabled",void 0),au([ue({attribute:!0})],su.prototype,"selfGuidedToursTypeOffered",void 0),au([ue({attribute:!0})],su.prototype,"designConcept",void 0),au([ue({attribute:!0})],su.prototype,"featureFlagShowDropdown",void 0),au([ue({attribute:!1})],su.prototype,"leadSources",void 0),au([ue({attribute:!0})],su.prototype,"currentLeadSource",void 0),au([ue({attribute:!0})],su.prototype,"escortedToursLink",void 0),au([ue({attribute:!0})],su.prototype,"escortedToursTypeOffered",void 0),au([ue({attribute:!0})],su.prototype,"virtualToursLink",void 0),au([ue({attribute:!0})],su.prototype,"virtualToursTypeOffered",void 0),au([ue({type:Boolean})],su.prototype,"hasChatEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasChatEnabledMobile",void 0),au([ue({type:Boolean})],su.prototype,"hasEmailEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasEmailEnabledMobile",void 0),au([ue({attribute:!0})],su.prototype,"hasApplyNowEnabledDesktop",void 0),au([ue({attribute:!0})],su.prototype,"hasApplyNowEnabledMobile",void 0),au([ue({attribute:!0})],su.prototype,"applicationLink",void 0),au([ue({type:Boolean})],su.prototype,"hasCallUsEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasCallUsEnabledMobile",void 0),au([ue({type:Boolean})],su.prototype,"hasTextUsEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasTextUsEnabledMobile",void 0),au([ue({type:Boolean})],su.prototype,"hasSSTEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasSSTEnabledMobile",void 0),au([ue({attribute:!1})],su.prototype,"tourTypeOptions",void 0),au([ue({attribute:!1})],su.prototype,"layoutOptions",void 0),au([ue({attribute:!0})],su.prototype,"bedroomPreferenceRequired",void 0),au([ue({attribute:!1})],su.prototype,"brokerIntakeEnabled",void 0),au([ue({attribute:!0})],su.prototype,"hasDynamicSchedulingEnabled",void 0),au([ue({attribute:!0})],su.prototype,"hasPricingCalculatorEnabledDesktop",void 0),au([ue({attribute:!0})],su.prototype,"hasPricingCalculatorEnabledMobile",void 0),au([ue({attribute:!1})],su.prototype,"hasHideMobileFeatures",void 0),au([ue({type:Number})],su.prototype,"right",void 0),au([ue({type:Number})],su.prototype,"bottom",void 0),au([ue({type:Number})],su.prototype,"top",void 0),au([ue({type:Number})],su.prototype,"left",void 0),au([ue({attribute:!0})],su.prototype,"showTourNextToChat",void 0),au([ue({attribute:!1})],su.prototype,"onChatTapped",void 0),au([ue({attribute:!0})],su.prototype,"onClickMinimize",void 0),au([ue({attribute:!0})],su.prototype,"onSstClose",void 0),au([ue({attribute:!0})],su.prototype,"overrideRentgrata",void 0),au([ue({attribute:!1})],su.prototype,"launcherStyles",void 0),au([ue({attribute:!0})],su.prototype,"primaryColor",void 0),au([ue({attribute:!0})],su.prototype,"backgroundColor",void 0),au([ue({attribute:!0})],su.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),au([ue({attribute:!0})],su.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),au([ue({attribute:!0})],su.prototype,"leadSourceClient",void 0),au([de()],su.prototype,"leadSourceMultitouchClient",void 0),au([de()],su.prototype,"_isMobile",void 0),au([de()],su.prototype,"isEmailWindowOpen",void 0),au([de()],su.prototype,"isCallUsWindowOpen",void 0),au([de()],su.prototype,"isSSTWindowOpen",void 0),au([de()],su.prototype,"isTextUsWindowOpen",void 0),au([de()],su.prototype,"isCalculatorWindowOpen",void 0),au([de()],su.prototype,"isMobileFeaturesExpanded",void 0),su=au([se("meetelise-launcher")],su);const lu=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",su)},uu=["app.meetelise.com","staging.eliseai.com","localhost"],du={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"}},cu=e=>{const t=window.location.hostname;if(!uu.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 du&&(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=du[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var hu=n(5072),pu=n.n(hu),fu=n(7825),gu=n.n(fu),mu=n(7659),bu=n.n(mu),yu=n(5056),vu=n.n(yu),wu=n(540),Cu=n.n(wu),xu=n(1113),$u=n.n(xu),Su=n(5541),Au={};Au.styleTagTransform=$u(),Au.setAttributes=vu(),Au.insert=bu().bind(null,"head"),Au.domAPI=gu(),Au.insertStyleElement=Cu();pu()(Su.A,Au);Su.A&&Su.A.locals&&Su.A.locals;async function ku(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 Eu(n.data,t)}return[]}catch(e){return[]}}const Eu=(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)})};async function Tu(e){var t,n;if(!e)return!1;try{return null!==(n=null===(t=(await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/aip`)).data)||void 0===t?void 0:t.is_aip)&&void 0!==n&&n}catch(e){return!1}}var _u,Ou=n(8805),Pu=n.n(Ou),Iu=new Uint8Array(16);function Nu(){if(!_u&&!(_u="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 _u(Iu)}const Mu=/^(?:[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 Du=function(e){return"string"==typeof e&&Mu.test(e)};for(var Lu=[],Ru=0;Ru<256;++Ru)Lu.push((Ru+256).toString(16).substr(1));const Uu=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Lu[e[t+0]]+Lu[e[t+1]]+Lu[e[t+2]]+Lu[e[t+3]]+"-"+Lu[e[t+4]]+Lu[e[t+5]]+"-"+Lu[e[t+6]]+Lu[e[t+7]]+"-"+Lu[e[t+8]]+Lu[e[t+9]]+"-"+Lu[e[t+10]]+Lu[e[t+11]]+Lu[e[t+12]]+Lu[e[t+13]]+Lu[e[t+14]]+Lu[e[t+15]]).toLowerCase();if(!Du(n))throw TypeError("Stringified UUID is invalid");return n};const Bu=function(e,t,n){var i=(e=e||{}).random||(e.rng||Nu)();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 Uu(i)},ju=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Fu=(e,t,n)=>{const i=Rr(new Date),r=n||`lead_${Bu()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Wr(i),buildingSlug:e,initiatedChat:t}},Hu=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(Gu(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Gu=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if($r(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!Or(t.timestamp,24)},zu=e=>e.startsWith("https://app.meetelise.com/settings/widgets")||e.startsWith("https://app.meetelise.com/settings/marketing/webchat")||e.includes("demo/utilities"),Qu="com.elise.webchat.reopenAfterNavigation",Wu=e=>{try{const t=new URL(e);return`${t.origin}${t.pathname}`}catch{return""}},Vu=e=>{const t={pageUrl:Wu(window.location.href),pageTitle:document.title};return"number"==typeof e&&Number.isInteger(e)&&e>0&&(t.declaredBuildingId=e),t},qu=(e,t=e=>window.location.assign(e))=>{(()=>{try{sessionStorage.setItem(Qu,"true")}catch{}})(),t(e.url)};var Yu;!function(e){e.noReply="no-reply",e.text="text",e.media="media",e.navigation="navigation"}(Yu||(Yu={}));const Ku=e=>e.type===Ju.text,Xu=e=>e.type===Ju.media,Zu=e=>e.type===Ju.navigation;var Ju;!function(e){e.text="text",e.media="media",e.navigation="navigation"}(Ju||(Ju={}));const ed=class{constructor(e,t,n,i=null,r,o,a=null,s=ah.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.firedScheduledTourConfirmationIds=new Set,this.widgetType=ah.Default,this.centralConvo=!1,this.declaredBuildingId=null,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.sessionToken=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!==Yu.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){const t=e.message.stream_id,i=null!=t?t:String(+e.timetoken);(t?this.reconstructStreamText(t):null!==(n=e.message.text)&&void 0!==n?n:"").includes("confirmed for your")&&this.fireScheduledTourEventOnce(i,e.message)}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=new Map;this.rawPubnubMessages.forEach(e=>{var n;const i=e.message.stream_id;i&&t.set(i,[...null!==(n=t.get(i))&&void 0!==n?n:[],e])});const n=[...t.entries()].filter(([,e])=>!this.isStreamComplete(e)).map(([e])=>e);n.length>0&&(this.streamingMessageTimeout=setTimeout(()=>{Jo({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:Zo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory().then(()=>n.forEach(e=>this.checkAndFireTourConfirmationForStream(e)))},e))},this.isStreamComplete=e=>{var t;const n=e.find(e=>e.message.is_done);if(!n)return!1;const i=new Set(e.map(e=>{var t;return null!==(t=e.message.order)&&void 0!==t?t:0}));for(let e=0;e<=(null!==(t=n.message.order)&&void 0!==t?t:0);e++)if(!i.has(e))return!1;return!0},this.getStreamChunks=e=>this.removeDuplicatedRawPubnubMessages(this.rawPubnubMessages).filter(t=>t.message.stream_id===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)}),this.reconstructStreamText=e=>this.getStreamChunks(e).map(e=>e.message.text).join(""),this.fireScheduledTourEventOnce=(e,t)=>{var n;this.firedScheduledTourConfirmationIds.has(e)||(this.firedScheduledTourConfirmationIds.add(e),So("scheduledTourEvent",{tourDetails:t,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.checkAndFireTourConfirmationForStream=e=>{var t;if(this.reconstructStreamText(e).includes("confirmed for your")){const n=this.getStreamChunks(e);this.fireScheduledTourEventOnce(e,null===(t=n[n.length-1])||void 0===t?void 0:t.message)}},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;So("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)===Yu.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&&Jo({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}},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=Fu(this.chatStorageSlug,!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&&Jo({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:Zo.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===ah.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:zu(location.href),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:zu(location.href),...Vu(this.declaredBuildingId),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=>Ar({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||(So("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),So("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)?(Jo({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:Zo.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;if(e.message.messageType===Yu.navigation){const n=(e=>{if(!e||"object"!=typeof e)return null;const{url:t,label:n}=e;if("string"!=typeof t||"string"!=typeof n)return null;if(!n.trim())return null;try{const e=new URL(t,window.location.href);return"http:"!==e.protocol&&"https:"!==e.protocol?null:{url:e.href,label:n.trim()}}catch{return null}})(e.message.navigation);n&&t.push({timestamp:e.timetoken,navigation:n,isLeadMessage:!1,type:Ju.navigation})}else if("media"===e.message.messageType)t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:Ju.media});else{if("string"!=typeof e.message.text)return;!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:Ju.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:Ju.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.chatStorageSlug=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}async initSession(e,t,n){try{const i={building_slug:e,org_slug:t};this.centralConvo&&(i.central_convo=!0),n&&(i.lead_id=n);const o=await r().post(`${this.apiHost}/platformApi/webchat/init`,i);return this.sessionToken=o.data.session_token,this.leadUserId=o.data.lead_id,this.channel=o.data.channel,o.data}catch(e){return this.buildingWebchatView&&Jo({logTitle:"WEBCHAT_INIT_SESSION_ERROR",logData:{error:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e}),null}}adoptBuilding(e,t){this.buildingSlug=e,this.buildingWebchatView=t}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(Pu())({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{if(this.sessionToken){const e="healthcare"===this.widgetType?"?industry=health_care":"";return(await r().get(`${this.apiHost}/platformApi/webchat/pn/v2/request-token${e}`,{headers:{"X-Session-Token":this.sessionToken}})).data}if(this.centralConvo)return null;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&&Jo({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}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&&Jo({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}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&&Jo({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}}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!==Yu.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&&Jo({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:Zo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}},td=new Set(["8009855990","8338526262","8002221222","8006624357","8002738255","8007997233","8007874889","8006564673","8004224453","8883737888","8006213362","8009506264","8558272736","8008435678","8007862929","8008523836","8007849433","8007729100","8006699777","8006858470","8004322209","8003473735","8008778339","8009552232","8002255342","8009272891","8003049320","8007937724","8002382333","8003353863","8776858878","8003329227","8776554371","8772944357","8772944356","6092925760","6092926735","8007928339","8008329173","8882853036","6092921210","8007929773","8003561561","8003826717","8005727233","8009291040","8888958179","8006879512","8004262537","8773475463","8774149251","8005103102","8889372835","8007010710","8007010720","8774288844","8007929745","8003283838","6092927060","6092928319","8008527899","8662401347","8009923678","8776522873","8776527624","8003313937","8008435437","8776536783","8778392339","8003676274","8006896411"]),nd=e=>{const t=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1");return td.has(t)},id=(e,t,n)=>{try{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.-]?)?(?:\([2-9]\d{2}\)[\s.-]?|[2-9]\d{2}[\s.-])[2-9]\d{2}[\s.-]?\d{4}/g,d=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,c=/whatsapp:\/\/send\?phone=\d+/g,h=/(facetime|facetime-audio):\d+/g,p=/emergency|emergencia/i,f=300,g=e=>!(!e||e.length>f)&&p.test(e),m=e=>{var t,n,i,r;if(g(e.textContent))return!0;if(g(null===(t=e.previousElementSibling)||void 0===t?void 0:t.textContent)||g(null===(n=e.nextElementSibling)||void 0===n?void 0:n.textContent))return!0;const o=e.parentElement;return!(!o||!g(null===(i=o.previousElementSibling)||void 0===i?void 0:i.textContent)&&!g(null===(r=o.nextElementSibling)||void 0===r?void 0:r.textContent))},b=document.body.getElementsByTagName("*");let y=!1;const v=i.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let w=!1,C=!1,x=0;for(let e=0;e<b.length;e++)if(b[e].nodeType===Node.ELEMENT_NODE&&!m(b[e])){if(1===b[e].childNodes.length&&b[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=b[e].textContent;if(!t)continue;const n=t.replace(u,e=>{if(nd(e))return e;return e.startsWith("+1 ")?`+1 ${v}`:v});t!==n&&(x++,b[e].textContent=n),y=!0,w||(w=!0)}if(b[e].hasAttribute("href")){const t=b[e].getAttribute("href");if(!t)continue;let n="",i=d;if(t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=c):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r,nd(t))continue;const u=t.replace(i,n);if(b[e].setAttribute("href",u),(t.startsWith("tel:")||t.startsWith("sms:"))&&u===t&&u!==n){t.replace(/\D/g,"").length>=7&&b[e].setAttribute("href",t.startsWith("tel:")?r:o)}C||(C=!0)}}return w&&Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:v,website:window.location.href},logType:Zo.info,buildingSlug:n,orgSlug:t}),C&&Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:v,website:window.location.href},logType:Zo.info,buildingSlug:n,orgSlug:t}),y||Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:Zo.warn,buildingSlug:n,orgSlug:t}),x}catch(e){return Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"insertion-error",error:e instanceof Error?e.message:String(e),website:window.location.href},logType:Zo.error,buildingSlug:n,orgSlug:t,error:e}),0}},rd=(e,t,n,i)=>{document.querySelectorAll("a").forEach(function(r){const o=r.getAttribute("href");o&&o.startsWith("https://app.meetelise.com/")&&((e,t,n)=>{const[i,r,o,...a]=new URL(e).pathname.split("/").filter(Boolean).map(e=>e.toLowerCase());return 0===a.length&&"tour"===o&&i===t.toLowerCase()&&r===n.toLowerCase()})(o,t,n)&&r.addEventListener("click",t=>{i()&&(t.preventDefault(),e(t))})})};var od=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 ad=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=qn,this.foregroundColorOnPrimaryBackgroundColor="white",this.toExpand=!1}render(){return U`
|
|
6459
|
+
`,au([ue({attribute:!0})],su.prototype,"isMinimized",void 0),au([ue()],su.prototype,"mobileStyles",void 0),au([ue({type:Boolean})],su.prototype,"isFirstMount",void 0),au([ue({attribute:!1})],su.prototype,"openSSTWindowOnLoad",void 0),au([ue({attribute:!1})],su.prototype,"autoOpenChatWidget",void 0),au([ue()],su.prototype,"phoneNumber",void 0),au([ue({attribute:!0})],su.prototype,"buildingName",void 0),au([ue({attribute:!0})],su.prototype,"chatId",void 0),au([ue({attribute:!0})],su.prototype,"orgLegalName",void 0),au([ue({attribute:!1})],su.prototype,"country",void 0),au([ue({attribute:!1})],su.prototype,"buildingState",void 0),au([ue({attribute:!0})],su.prototype,"chatCallUsHeader",void 0),au([ue({attribute:!1})],su.prototype,"buildingId",void 0),au([ue({type:Number})],su.prototype,"orgId",void 0),au([ue({attribute:!1})],su.prototype,"leadSourceParams",void 0),au([ue({attribute:!0})],su.prototype,"buildingSlug",void 0),au([ue({attribute:!0})],su.prototype,"orgSlug",void 0),au([ue({attribute:!0})],su.prototype,"sgtUrl",void 0),au([ue({attribute:!0})],su.prototype,"selfGuidedTourEnabled",void 0),au([ue({attribute:!0})],su.prototype,"selfGuidedToursTypeOffered",void 0),au([ue({attribute:!0})],su.prototype,"designConcept",void 0),au([ue({attribute:!0})],su.prototype,"featureFlagShowDropdown",void 0),au([ue({attribute:!1})],su.prototype,"leadSources",void 0),au([ue({attribute:!0})],su.prototype,"currentLeadSource",void 0),au([ue({attribute:!0})],su.prototype,"escortedToursLink",void 0),au([ue({attribute:!0})],su.prototype,"escortedToursTypeOffered",void 0),au([ue({attribute:!0})],su.prototype,"virtualToursLink",void 0),au([ue({attribute:!0})],su.prototype,"virtualToursTypeOffered",void 0),au([ue({type:Boolean})],su.prototype,"hasChatEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasChatEnabledMobile",void 0),au([ue({type:Boolean})],su.prototype,"hasEmailEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasEmailEnabledMobile",void 0),au([ue({attribute:!0})],su.prototype,"hasApplyNowEnabledDesktop",void 0),au([ue({attribute:!0})],su.prototype,"hasApplyNowEnabledMobile",void 0),au([ue({attribute:!0})],su.prototype,"applicationLink",void 0),au([ue({type:Boolean})],su.prototype,"hasCallUsEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasCallUsEnabledMobile",void 0),au([ue({type:Boolean})],su.prototype,"hasTextUsEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasTextUsEnabledMobile",void 0),au([ue({type:Boolean})],su.prototype,"hasSSTEnabledDesktop",void 0),au([ue({type:Boolean})],su.prototype,"hasSSTEnabledMobile",void 0),au([ue({attribute:!1})],su.prototype,"tourTypeOptions",void 0),au([ue({attribute:!1})],su.prototype,"layoutOptions",void 0),au([ue({attribute:!0})],su.prototype,"bedroomPreferenceRequired",void 0),au([ue({attribute:!1})],su.prototype,"brokerIntakeEnabled",void 0),au([ue({attribute:!0})],su.prototype,"hasDynamicSchedulingEnabled",void 0),au([ue({attribute:!0})],su.prototype,"hasPricingCalculatorEnabledDesktop",void 0),au([ue({attribute:!0})],su.prototype,"hasPricingCalculatorEnabledMobile",void 0),au([ue({attribute:!1})],su.prototype,"hasHideMobileFeatures",void 0),au([ue({type:Number})],su.prototype,"right",void 0),au([ue({type:Number})],su.prototype,"bottom",void 0),au([ue({type:Number})],su.prototype,"top",void 0),au([ue({type:Number})],su.prototype,"left",void 0),au([ue({attribute:!0})],su.prototype,"showTourNextToChat",void 0),au([ue({attribute:!1})],su.prototype,"onChatTapped",void 0),au([ue({attribute:!0})],su.prototype,"onClickMinimize",void 0),au([ue({attribute:!0})],su.prototype,"onSstClose",void 0),au([ue({attribute:!0})],su.prototype,"overrideRentgrata",void 0),au([ue({attribute:!1})],su.prototype,"launcherStyles",void 0),au([ue({attribute:!0})],su.prototype,"primaryColor",void 0),au([ue({attribute:!0})],su.prototype,"backgroundColor",void 0),au([ue({attribute:!0})],su.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),au([ue({attribute:!0})],su.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),au([ue({attribute:!0})],su.prototype,"leadSourceClient",void 0),au([de()],su.prototype,"leadSourceMultitouchClient",void 0),au([de()],su.prototype,"_isMobile",void 0),au([de()],su.prototype,"isEmailWindowOpen",void 0),au([de()],su.prototype,"isCallUsWindowOpen",void 0),au([de()],su.prototype,"isSSTWindowOpen",void 0),au([de()],su.prototype,"isTextUsWindowOpen",void 0),au([de()],su.prototype,"isCalculatorWindowOpen",void 0),au([de()],su.prototype,"isMobileFeaturesExpanded",void 0),su=au([se("meetelise-launcher")],su);const lu=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",su)},uu=["app.meetelise.com","staging.eliseai.com","localhost"],du={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"}},cu=e=>{const t=window.location.hostname;if(!uu.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 du&&(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=du[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var hu=n(5072),pu=n.n(hu),fu=n(7825),gu=n.n(fu),mu=n(7659),bu=n.n(mu),yu=n(5056),vu=n.n(yu),wu=n(540),Cu=n.n(wu),xu=n(1113),$u=n.n(xu),Su=n(5541),Au={};Au.styleTagTransform=$u(),Au.setAttributes=vu(),Au.insert=bu().bind(null,"head"),Au.domAPI=gu(),Au.insertStyleElement=Cu();pu()(Su.A,Au);Su.A&&Su.A.locals&&Su.A.locals;async function ku(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 Eu(n.data,t)}return[]}catch(e){return[]}}const Eu=(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)})};async function Tu(e){var t,n;if(!e)return!1;try{return null!==(n=null===(t=(await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/aip`)).data)||void 0===t?void 0:t.is_aip)&&void 0!==n&&n}catch(e){return!1}}var _u,Ou=n(8805),Pu=n.n(Ou),Iu=new Uint8Array(16);function Nu(){if(!_u&&!(_u="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 _u(Iu)}const Mu=/^(?:[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 Du=function(e){return"string"==typeof e&&Mu.test(e)};for(var Lu=[],Ru=0;Ru<256;++Ru)Lu.push((Ru+256).toString(16).substr(1));const Uu=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Lu[e[t+0]]+Lu[e[t+1]]+Lu[e[t+2]]+Lu[e[t+3]]+"-"+Lu[e[t+4]]+Lu[e[t+5]]+"-"+Lu[e[t+6]]+Lu[e[t+7]]+"-"+Lu[e[t+8]]+Lu[e[t+9]]+"-"+Lu[e[t+10]]+Lu[e[t+11]]+Lu[e[t+12]]+Lu[e[t+13]]+Lu[e[t+14]]+Lu[e[t+15]]).toLowerCase();if(!Du(n))throw TypeError("Stringified UUID is invalid");return n};const Bu=function(e,t,n){var i=(e=e||{}).random||(e.rng||Nu)();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 Uu(i)},ju=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Fu=(e,t,n)=>{const i=Rr(new Date),r=n||`lead_${Bu()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:Wr(i),buildingSlug:e,initiatedChat:t}},Hu=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(Gu(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Gu=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if($r(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!Or(t.timestamp,24)},zu=e=>e.startsWith("https://app.meetelise.com/settings/widgets")||e.startsWith("https://app.meetelise.com/settings/marketing/webchat")||e.includes("demo/utilities"),Qu="com.elise.webchat.reopenAfterNavigation",Wu=e=>{try{const t=new URL(e);return`${t.origin}${t.pathname}`}catch{return""}},Vu=e=>{const t={pageUrl:Wu(window.location.href),pageTitle:document.title};return"number"==typeof e&&Number.isInteger(e)&&e>0&&(t.declaredBuildingId=e),t},qu=(e,t=e=>window.location.assign(e))=>{(()=>{try{sessionStorage.setItem(Qu,"true")}catch{}})(),t(e.url)};var Yu;!function(e){e.noReply="no-reply",e.text="text",e.media="media",e.navigation="navigation"}(Yu||(Yu={}));const Ku=e=>e.type===Ju.text,Xu=e=>e.type===Ju.media,Zu=e=>e.type===Ju.navigation;var Ju;!function(e){e.text="text",e.media="media",e.navigation="navigation"}(Ju||(Ju={}));const ed=class{constructor(e,t,n,i=null,r,o,a=null,s=sh.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.firedScheduledTourConfirmationIds=new Set,this.widgetType=sh.Default,this.centralConvo=!1,this.declaredBuildingId=null,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.sessionToken=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!==Yu.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){const t=e.message.stream_id,i=null!=t?t:String(+e.timetoken);(t?this.reconstructStreamText(t):null!==(n=e.message.text)&&void 0!==n?n:"").includes("confirmed for your")&&this.fireScheduledTourEventOnce(i,e.message)}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=new Map;this.rawPubnubMessages.forEach(e=>{var n;const i=e.message.stream_id;i&&t.set(i,[...null!==(n=t.get(i))&&void 0!==n?n:[],e])});const n=[...t.entries()].filter(([,e])=>!this.isStreamComplete(e)).map(([e])=>e);n.length>0&&(this.streamingMessageTimeout=setTimeout(()=>{Jo({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:Zo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory().then(()=>n.forEach(e=>this.checkAndFireTourConfirmationForStream(e)))},e))},this.isStreamComplete=e=>{var t;const n=e.find(e=>e.message.is_done);if(!n)return!1;const i=new Set(e.map(e=>{var t;return null!==(t=e.message.order)&&void 0!==t?t:0}));for(let e=0;e<=(null!==(t=n.message.order)&&void 0!==t?t:0);e++)if(!i.has(e))return!1;return!0},this.getStreamChunks=e=>this.removeDuplicatedRawPubnubMessages(this.rawPubnubMessages).filter(t=>t.message.stream_id===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)}),this.reconstructStreamText=e=>this.getStreamChunks(e).map(e=>e.message.text).join(""),this.fireScheduledTourEventOnce=(e,t)=>{var n;this.firedScheduledTourConfirmationIds.has(e)||(this.firedScheduledTourConfirmationIds.add(e),So("scheduledTourEvent",{tourDetails:t,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.checkAndFireTourConfirmationForStream=e=>{var t;if(this.reconstructStreamText(e).includes("confirmed for your")){const n=this.getStreamChunks(e);this.fireScheduledTourEventOnce(e,null===(t=n[n.length-1])||void 0===t?void 0:t.message)}},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;So("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)===Yu.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&&Jo({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}},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=Fu(this.chatStorageSlug,!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&&Jo({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:Zo.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===sh.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:zu(location.href),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:zu(location.href),...Vu(this.declaredBuildingId),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=>Ar({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||(So("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),So("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)?(Jo({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:Zo.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;if(e.message.messageType===Yu.navigation){const n=(e=>{if(!e||"object"!=typeof e)return null;const{url:t,label:n}=e;if("string"!=typeof t||"string"!=typeof n)return null;if(!n.trim())return null;try{const e=new URL(t,window.location.href);return"http:"!==e.protocol&&"https:"!==e.protocol?null:{url:e.href,label:n.trim()}}catch{return null}})(e.message.navigation);n&&t.push({timestamp:e.timetoken,navigation:n,isLeadMessage:!1,type:Ju.navigation})}else if("media"===e.message.messageType)t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:Ju.media});else{if("string"!=typeof e.message.text)return;!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:Ju.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:Ju.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.chatStorageSlug=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}async initSession(e,t,n){try{const i={building_slug:e,org_slug:t};this.centralConvo&&(i.central_convo=!0),n&&(i.lead_id=n);const o=await r().post(`${this.apiHost}/platformApi/webchat/init`,i);return this.sessionToken=o.data.session_token,this.leadUserId=o.data.lead_id,this.channel=o.data.channel,o.data}catch(e){return this.buildingWebchatView&&Jo({logTitle:"WEBCHAT_INIT_SESSION_ERROR",logData:{error:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e}),null}}adoptBuilding(e,t){this.buildingSlug=e,this.buildingWebchatView=t}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(Pu())({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{if(this.sessionToken){const e="healthcare"===this.widgetType?"?industry=health_care":"";return(await r().get(`${this.apiHost}/platformApi/webchat/pn/v2/request-token${e}`,{headers:{"X-Session-Token":this.sessionToken}})).data}if(this.centralConvo)return null;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&&Jo({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}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&&Jo({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}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&&Jo({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:Zo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}}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!==Yu.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&&Jo({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:Zo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}},td=new Set(["8009855990","8338526262","8002221222","8006624357","8002738255","8007997233","8007874889","8006564673","8004224453","8883737888","8006213362","8009506264","8558272736","8008435678","8007862929","8008523836","8007849433","8007729100","8006699777","8006858470","8004322209","8003473735","8008778339","8009552232","8002255342","8009272891","8003049320","8007937724","8002382333","8003353863","8776858878","8003329227","8776554371","8772944357","8772944356","6092925760","6092926735","8007928339","8008329173","8882853036","6092921210","8007929773","8003561561","8003826717","8005727233","8009291040","8888958179","8006879512","8004262537","8773475463","8774149251","8005103102","8889372835","8007010710","8007010720","8774288844","8007929745","8003283838","6092927060","6092928319","8008527899","8662401347","8009923678","8776522873","8776527624","8003313937","8008435437","8776536783","8778392339","8003676274","8006896411"]),nd=e=>{const t=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1");return td.has(t)},id=(e,t,n)=>{try{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.-]?)?(?:\([2-9]\d{2}\)[\s.-]?|[2-9]\d{2}[\s.-])[2-9]\d{2}[\s.-]?\d{4}/g,d=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,c=/whatsapp:\/\/send\?phone=\d+/g,h=/(facetime|facetime-audio):\d+/g,p=/emergency|emergencia/i,f=300,g=e=>!(!e||e.length>f)&&p.test(e),m=e=>{var t,n,i,r;if(g(e.textContent))return!0;if(g(null===(t=e.previousElementSibling)||void 0===t?void 0:t.textContent)||g(null===(n=e.nextElementSibling)||void 0===n?void 0:n.textContent))return!0;const o=e.parentElement;return!(!o||!g(null===(i=o.previousElementSibling)||void 0===i?void 0:i.textContent)&&!g(null===(r=o.nextElementSibling)||void 0===r?void 0:r.textContent))},b=document.body.getElementsByTagName("*");let y=!1;const v=i.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let w=!1,C=!1,x=0;for(let e=0;e<b.length;e++)if(b[e].nodeType===Node.ELEMENT_NODE&&!m(b[e])){if(1===b[e].childNodes.length&&b[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=b[e].textContent;if(!t)continue;const n=t.replace(u,e=>{if(nd(e))return e;return e.startsWith("+1 ")?`+1 ${v}`:v});t!==n&&(x++,b[e].textContent=n),y=!0,w||(w=!0)}if(b[e].hasAttribute("href")){const t=b[e].getAttribute("href");if(!t)continue;let n="",i=d;if(t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=c):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r,nd(t))continue;const u=t.replace(i,n);if(b[e].setAttribute("href",u),(t.startsWith("tel:")||t.startsWith("sms:"))&&u===t&&u!==n){t.replace(/\D/g,"").length>=7&&b[e].setAttribute("href",t.startsWith("tel:")?r:o)}C||(C=!0)}}return w&&Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:v,website:window.location.href},logType:Zo.info,buildingSlug:n,orgSlug:t}),C&&Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:v,website:window.location.href},logType:Zo.info,buildingSlug:n,orgSlug:t}),y||Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:Zo.warn,buildingSlug:n,orgSlug:t}),x}catch(e){return Jo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"insertion-error",error:e instanceof Error?e.message:String(e),website:window.location.href},logType:Zo.error,buildingSlug:n,orgSlug:t,error:e}),0}},rd=(e,t,n,i)=>{document.querySelectorAll("a").forEach(function(r){const o=r.getAttribute("href");o&&o.startsWith("https://app.meetelise.com/")&&((e,t,n)=>{const[i,r,o,...a]=new URL(e).pathname.split("/").filter(Boolean).map(e=>e.toLowerCase());return 0===a.length&&"tour"===o&&i===t.toLowerCase()&&r===n.toLowerCase()})(o,t,n)&&r.addEventListener("click",t=>{i()&&(t.preventDefault(),e(t))})})};var od=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 ad=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=qn,this.foregroundColorOnPrimaryBackgroundColor="white",this.toExpand=!1}render(){return U`
|
|
6460
6460
|
<button
|
|
6461
6461
|
class=${this.toExpand?"button-container mini":"button-container"}
|
|
6462
6462
|
@click=${this.onClick}
|
|
@@ -6980,7 +6980,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6980
6980
|
transform: rotate(360deg);
|
|
6981
6981
|
}
|
|
6982
6982
|
}
|
|
6983
|
-
`,gc([ue({type:Number})],mc.prototype,"spinSpeed",void 0),mc=gc([se("mini-loader")],mc);var bc=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 yc=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.loadingPreviews=!0,this.websitePreviewInfo=[],this.imagesToDisplay=[],this.imageUrlError=[],this.isLeadMessage=!1,this.widgetType=
|
|
6983
|
+
`,gc([ue({type:Number})],mc.prototype,"spinSpeed",void 0),mc=gc([se("mini-loader")],mc);var bc=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 yc=class extends oe{constructor(){super(...arguments),this.onMount=()=>({}),this.loadingPreviews=!0,this.websitePreviewInfo=[],this.imagesToDisplay=[],this.imageUrlError=[],this.isLeadMessage=!1,this.widgetType=sh.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=U`${n.trim().split("\n").map(e=>{const n=this.sanitizeMarkdownText(e),a=this.preserveHTMLTags(n);return a?U`${a.map(e=>{const n=t.filter(t=>e.includes(t.id));if(n.length){let t=e;return n.forEach(e=>{o.push({redirectTo:e.link,source:e.link}),t=t.replace(e.id,this.hyperlinkHTML(e.link,e.hyperlink))}),U`${ko(fc.sanitize(t,{ADD_ATTR:["target"]}))} `}if(i.test(e)){const t=this.removeTrailingPunctuation(e);return r.push(this.getLinkData(t)),U`<a
|
|
6984
6984
|
class="redirect-link"
|
|
6985
6985
|
href="${t}"
|
|
6986
6986
|
target="_blank"
|
|
@@ -6989,7 +6989,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6989
6989
|
</a>`}return U`${ko(fc.sanitize(e))} `})}<br />`:U``})}`,this.imagesToDisplay=o,Promise.all(r).then(e=>{this.websitePreviewInfo=e})}hyperlinkHTML(e,t){const n=document.createElement("a");return n.className="redirect-link",n.href=e,n.target="_blank",n.rel="noopener noreferrer",n.textContent=t,n.outerHTML}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=Bu().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?U`<div class="message-inner-body">
|
|
6990
6990
|
${this.isMessageStillStreamingChunks()?U`<div class="message-loader"><mini-loader></mini-loader></div>`:""}
|
|
6991
6991
|
<p
|
|
6992
|
-
class=${be({"message-text":this.widgetType!==
|
|
6992
|
+
class=${be({"message-text":this.widgetType!==sh.Utilities,"message-text-large":this.widgetType===sh.Utilities,"webchat-font__desktop":!Tr(),"webchat-font__mobile":Tr()})}
|
|
6993
6993
|
>
|
|
6994
6994
|
${this.parsedMessage}
|
|
6995
6995
|
</p>
|
|
@@ -7020,9 +7020,9 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
7020
7020
|
/>`:""}
|
|
7021
7021
|
|
|
7022
7022
|
<div class="website-preview-body">
|
|
7023
|
-
<p class=${be({"message-text":this.widgetType!==
|
|
7023
|
+
<p class=${be({"message-text":this.widgetType!==sh.Utilities,"message-text-large":this.widgetType===sh.Utilities,"website-preview-title":!0,"webchat-font__desktop":!Tr(),"webchat-font__mobile":Tr()})}>${e.title}</p>
|
|
7024
7024
|
${e.description?U`<p
|
|
7025
|
-
class=${be({"message-text":this.widgetType!==
|
|
7025
|
+
class=${be({"message-text":this.widgetType!==sh.Utilities,"message-text-large":this.widgetType===sh.Utilities,"website-preview-description":!0,"webchat-font__desktop":!Tr(),"webchat-font__mobile":Tr()})}
|
|
7026
7026
|
>
|
|
7027
7027
|
${e.description}
|
|
7028
7028
|
</p>`:""}
|
|
@@ -7296,7 +7296,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
7296
7296
|
<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}"/>
|
|
7297
7297
|
<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}"/>
|
|
7298
7298
|
</svg>
|
|
7299
|
-
`;var Tc,_c=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 Oc=Tc=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.centralConvo=!1,this.widgetType=
|
|
7299
|
+
`;var Tc,_c=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 Oc=Tc=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.centralConvo=!1,this.widgetType=sh.Default,this.primaryColor=qn,this.backgroundColor=Yn,this.onClickExit=()=>{localStorage.setItem("isChatOpen","false")},this.requiresConsent=!1,this._isMobile=Tr(),this.shouldAutoScroll=!0,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.shouldAutoScroll=!0,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:Ju.text}]),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e)))},this.scrollToChatBottom=()=>{this.shouldAutoScroll&&this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"auto"})},this.handleConversationScroll=e=>{const t=e.currentTarget,n=t.scrollHeight-t.clientHeight-t.scrollTop;this.shouldAutoScroll=n<=Tc.AUTO_SCROLL_THRESHOLD_PX},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`}connectedCallback(){super.connectedCallback(),this._cleanupMobileListener=_r(e=>{this._isMobile=e})}disconnectedCallback(){var e;null===(e=this._cleanupMobileListener)||void 0===e||e.call(this),super.disconnectedCallback()}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;Sc(new Date,new Date(r))<7&&o===jo?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,d,c,h,p,f,g,m,b,y,v,w,C,x;if(!this.buildingSlug&&!this.centralConvo)return U``;const $=null===(e=this.building)||void 0===e?void 0:e.id;let S={};if(S=this._isMobile?{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===$&&(S={...S,fontFamily:'"Helvetica Neue", Arial'}),this.widgetType===sh.Utilities)return U`
|
|
7300
7300
|
<div
|
|
7301
7301
|
id="utilities-container"
|
|
7302
7302
|
class=${be({"pubnub-container__mobile":this._isMobile,"utilities-container__desktop":!this._isMobile})}
|
|
@@ -7411,7 +7411,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
7411
7411
|
</div>
|
|
7412
7412
|
</div>
|
|
7413
7413
|
</div>
|
|
7414
|
-
`;if(this.widgetType===
|
|
7414
|
+
`;if(this.widgetType===sh.Healthcare)return U`
|
|
7415
7415
|
<div
|
|
7416
7416
|
id="healthchat-container"
|
|
7417
7417
|
class=${be({"pubnub-container__mobile":this._isMobile,"healthchat-container__desktop":!this._isMobile})}
|
|
@@ -7647,7 +7647,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
7647
7647
|
</button>
|
|
7648
7648
|
</div>
|
|
7649
7649
|
</div>
|
|
7650
|
-
`}};Oc.AUTO_SCROLL_THRESHOLD_PX=32,Oc.styles=[Oe,ud,ld,sd,Ac],_c([ue({type:Number})],Oc.prototype,"right",void 0),_c([ue({type:Number})],Oc.prototype,"bottom",void 0),_c([ue({type:Number})],Oc.prototype,"top",void 0),_c([ue({type:Number})],Oc.prototype,"left",void 0),_c([ue({attribute:!0})],Oc.prototype,"onMount",void 0),_c([ue({attribute:!0})],Oc.prototype,"channel",void 0),_c([ue({attribute:!0})],Oc.prototype,"isHealthChat",void 0),_c([ue({attribute:!0})],Oc.prototype,"myPubnub",void 0),_c([ue({attribute:!0})],Oc.prototype,"orgSlug",void 0),_c([ue({attribute:!0})],Oc.prototype,"buildingSlug",void 0),_c([ue({attribute:!0})],Oc.prototype,"centralConvo",void 0),_c([ue({attribute:!0})],Oc.prototype,"widgetType",void 0),_c([ue({attribute:!0})],Oc.prototype,"building",void 0),_c([ue({attribute:!0})],Oc.prototype,"primaryColor",void 0),_c([ue({attribute:!0})],Oc.prototype,"backgroundColor",void 0),_c([ue({attribute:!0})],Oc.prototype,"onClickExit",void 0),_c([ue({attribute:!0})],Oc.prototype,"requiresConsent",void 0),_c([ce("#message-input",!0)],Oc.prototype,"messageInput",void 0),_c([ce("#conversation-body",!0)],Oc.prototype,"messageBody",void 0),_c([de()],Oc.prototype,"_isMobile",void 0),_c([de()],Oc.prototype,"messages",void 0),_c([de()],Oc.prototype,"isLoadingMessages",void 0),_c([de()],Oc.prototype,"hasReceivedConsent",void 0),_c([de()],Oc.prototype,"privacyPolicyUrl",void 0),_c([de()],Oc.prototype,"websitePreviewMapping",void 0),Oc=Tc=_c([se("pubnub-chat")],Oc);const Pc=e=>Ku(e)?e.message:Zu(e)?`Take me to ${e.navigation.label}`:"Media message",Ic="cdn.skypack.dev/@meetelise/chat",Nc="cdn.eliseai.com/@meetelise/chat",Mc=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(Ic)||n.includes(Ic))return"skypack";if(e.includes(Nc)||n.includes(Nc))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){}},Dc=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?t.endsWith("/units")?t:`${t}/units`:t,Lc={"95ae958e-95db-11ed-9862-6f4db5533d3f":"8008db60-45b7-11f1-88ac-635f686365da","95ae96b0-95db-11ed-9863-a7aa664fd985":"72ed27c4-45b7-11f1-82d9-37b7db547687"},Rc="https://applications.eliseai.com",Uc=["Check Availability","Apply Now"],Bc=(e,t,n,i)=>{if(!(e=>{var t;if(!e.classList.contains("floorplan-button"))return!1;const n=e.getElementsByTagName("span");if(1!==n.length)return!1;const i=null===(t=n[0].textContent)||void 0===t?void 0:t.trim();return null!=i&&Uc.includes(i)})(e))return!1;if(e.getAttribute("href")===t)return!1;const r=e.getAttribute("href");return e.setAttribute("href",t),e.setAttribute("target","_blank"),Jo({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:Zo.info,buildingSlug:i,orgSlug:n}),!0},jc=(e,t,n,i)=>{for(let r=0;r<e.length;r++){const o=e[r];if(o.nodeType!==Node.ELEMENT_NODE)continue;const a=o;"A"===a.tagName&&Bc(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)Bc(s[e],t,n,i)}},Fc=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)Bc(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)jc(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class Hc{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>Rr(Br(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=vo();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(Xo()).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:Rr(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:Rr(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));Jo({logType:Zo.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=ia(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:Rr(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:Rr(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Wr(e.timestampInitiallyLogged).getTime()-Wr(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:Rr(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:Rr(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=>Wr(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var Gc,zc=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 Qc=Gc=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.centralConvo=!1,this.declaredBuildingSlug="",this.orgLevel=!1,this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=Tr(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=fo.always,this.bedroomPreferenceRequired=!1,this.brokerIntakeEnabled=!1,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.openTourSchedulerOnLoad=!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=ah.Default,this.onWidgetLoaded=ru(),this.onSstClose=ru(),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()=>{var e,t;if(!this.orgSlug)return;if(!this.centralConvo&&!this.buildingSlug)return;this.centralConvo&&!this.buildingSlug&&(this.orgLevel=!0);const n=this.centralConvo?await async function(e){const t=`https://app.meetelise.com/api/pub/v1/organization/${e}/webchat/v2`,n=await r().get(t);return ca(n.data)}(this.orgSlug):await da(this.orgSlug,this.buildingSlug);if(!this.isOrgMode()){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{Mc(this.orgSlug,this.buildingSlug)}catch(e){}}if(!await rs(n,this.buildingSlug,this.orgSlug))return;ea({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==n?void 0:n.launchedDateTime)?.01:.05}),this.buildingWebchatView=n;const i=(()=>{try{const e="true"===sessionStorage.getItem(Qu);return sessionStorage.removeItem(Qu),e}catch{return!1}})();await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),(e=>{const t=new URLSearchParams(window.location.search),n=t.get("rwg_token"),i=t.get("elise_google_env");if(!n||!i||!e)return;const r={rwgToken:n,environment:i,buildingId:e,expiresAt:Date.now()+2592e6};localStorage.setItem(Va,JSON.stringify(r))})(null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.id)&&void 0!==t?t:0),i?(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0):"tour"===new URLSearchParams(window.location.search).get("elise_open")&&(this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile)?this.openTourSchedulerOnLoad=!0:this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)?(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()):"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0),this.isLoading=!1},this.setBuildingDerivedInfo=async()=>{var e,t,n,i,o,a,s,l,u,d,c,h,p,f,g,m,b,y,v,w,C,x,$,S,A,k,E,T,_,O,P,I,N,M,D,L,R,U,B,j,F,H,G,z,Q,W,V,q,Y,K,X;const Z=this.buildingWebchatView;if(!Z)return;Z&&this.orgSlug&&!this.orgLevel&&Vc(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 J=Z.featureFlagWebchatMarketingSourceDropdownConfiguration,ee=Z.featureFlagWebchatUseDniPhoneNumberBySource,te=Z.featureFlagInsertDniIntoWebsite,ne=Z.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite;var ie;ie=Co.includes(Z.orgId),$o=ie;const[re,oe,ae,se,le]=await Promise.all([this.isOrgMode()?Promise.resolve([]):ku(this.orgSlug,this.buildingSlug),go(this.buildingSlug),Tu(this.buildingSlug),bo(this.buildingSlug),yo(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Gn(Z.phoneNumber),this.buildingWebchatView.isAip=ae),this.leadSources=re,this.featureFlagShowDropdown=J,this.bedroomPreferenceRequired=se,this.brokerIntakeEnabled=le;const ue=this.orgLevel?null:Z.textWithUsPhoneNumber?Z.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 Jo({logType:Zo.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t},error:t}),null}return null})(this.buildingSlug),de=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,ce=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,he={callDesktop:null!==(d=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==d&&d,callMobile:null!==(h=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.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!==(y=null===(b=this.buildingWebchatView)||void 0===b?void 0:b.shouldShowEmailDesktop)&&void 0!==y&&y,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)&&!!ue)&&void 0!==x&&x,textMobile:null!==(S=(null===($=this.buildingWebchatView)||void 0===$?void 0:$.shouldShowTextMobile)&&!!ue)&&void 0!==S&&S,sstDesktop:null!==(k=null===(A=this.buildingWebchatView)||void 0===A?void 0:A.shouldShowSstDesktop)&&void 0!==k&&k,sstMobile:null!==(T=null===(E=this.buildingWebchatView)||void 0===E?void 0:E.shouldShowSstMobile)&&void 0!==T&&T,calcDesktop:de,calcMobile:ce};var pe,fe;this.enabledChatWidgets=this.withOrgLevelContactOptions(cu(he),null!==(O=null===(_=this.buildingWebchatView)||void 0===_?void 0:_.phoneNumber)&&void 0!==O?O:""),this.orgLevel||(this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(rd(this.handleTourClicked,this.orgSlug,this.buildingSlug,()=>this.isConnected),ne&&(fe=this.handleTourClicked,document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(e=>{e&&e.addEventListener("click",e=>{e.preventDefault(),fe(e)})})),"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===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&(pe=null!==(N=null===(I=this.LeadSourceClient)||void 0===I?void 0:I.leadSource)&&void 0!==N?N: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(pe)}`)}}))),this.buildingWebchatView&&(this.primaryColor=null!==(M=this.buildingWebchatView.primaryColor)&&void 0!==M?M:null,this.backgroundColor=null!==(D=this.buildingWebchatView.secondaryColor)&&void 0!==D?D:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(L=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==L?L:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(R=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==R?R:null,this.webchatConfigHasAutoOpenChat=null!==(U=this.buildingWebchatView.autoOpenChat)&&void 0!==U&&U,this.requiresConsent=null!==(B=this.buildingWebchatView.requiresConsentForChat)&&void 0!==B&&B,this.hideMobileFeatures=null!==(j=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==j&&j,this.privacyPolicyUrl=null!==(F=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==F?F:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===aa.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===aa.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===aa.EMOJI&&(this.designConcept=aa.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=qn),null===this.backgroundColor&&(this.backgroundColor=Yn);const ge=null!==(G=null===(H=this.buildingWebchatView)||void 0===H?void 0:H.phoneNumber)&&void 0!==G?G:"";let me=null;if(ee&&!this.orgLevel&&(me=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:Gn(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(Q=null===(z=this.LeadSourceClient)||void 0===z?void 0:z.leadSource)&&void 0!==Q?Q:null),me&&!me.isMatch&&(me.number=ge)),te&&(null==me?void 0:me.number)){const e=id(me.number,this.orgSlug,this.buildingSlug);e>0&&ea({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const be=localStorage.getItem("eliseai_phone_number_devtest");be&&id(be,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=me||{number:ge,isMatch:!1,isPropertyWebsiteCatchall:!0};const ye=null!==(V=null===(W=this.LeadSourceClient)||void 0===W?void 0:W.leadSource)&&void 0!==V?V:null;ye&&(this.leadSources.includes(ye)||this.leadSources.push(ye)),this.isOrgMode()||io(Z.id);if((oe||(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isAip))&&(null===(Y=this.buildingWebchatView)||void 0===Y?void 0:Y.isLiveOnApplications)&&this.buildingSlug&&!this.orgLevel){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(\?.*)?$/,/\/content\/apply/,/\/apply-now/,/\/apply/,/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=Dc(o,e);l.setAttribute("href",s),a++,Jo({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:Zo.info,buildingSlug:n,orgSlug:t})}}return 0===a&&Jo({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:Zo.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}/units`,this.orgSlug,this.buildingSlug);e>0&&ea({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}if(this.buildingSlug&&this.orgSlug&&!this.orgLevel)try{(e=>{const t=Lc[e];if(!t)return 0;const n=`${Rc}/building/${t}/units`,i=`${Rc}/building/${e}/units`,r=new RegExp(`https://applications\\.eliseai\\.com/building/${t}/units`,"g");let o=0;const a=document.body.getElementsByTagName("a");for(let e=0;e<a.length;e++){const t=a[e],s=t.getAttribute("href");if(!s||!s.includes(n))continue;const l=s.replace(r,i);l!==s&&(t.setAttribute("href",l),o++)}document.body.querySelectorAll("[onclick]").forEach(e=>{const t=e.getAttribute("onclick");if(!t||!t.includes(n))return;const a=t.replace(r,i);a!==t&&(e.setAttribute("onclick",a),o++)})})(this.buildingSlug)}catch{}this.buildingSlug&&!this.orgLevel&&(null===(K=this.buildingWebchatView)||void 0===K?void 0:K.isLiveOnApplications)&&(null===(X=this.buildingWebchatView)||void 0===X?void 0:X.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&Fc(this.orgSlug,this.buildingSlug,this.buildingWebchatView.applicationLink)},this.initializeChatVariables=async()=>{var e,t,n,i,r,o,a,s,l,u;if(!this.buildingWebchatView)return;const d=this.chatStorageSlug(),c=Hu(d),h=Gu(d,c),p=h?c:Fu(d,!1);if(!p.leadId)throw new Error("Lead ID is null");if(this.LeadSourceClient=new ra,this.LeadSourceClient.orgId=null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.orgId)&&void 0!==t?t:0,this.LeadSourceMultitouchClient=new Hc(this.orgSlug,this.buildingSlug),this.myPubnub=new ed(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,p.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType),this.myPubnub.chatStorageSlug=d,this.centralConvo){const e=this.myPubnub;e.centralConvo=!0,this.fetchDeclaredBuildingId().then(t=>{e.declaredBuildingId=t})}else this.myPubnub.declaredBuildingId=this.buildingWebchatView.id;const f=await this.myPubnub.initSession(this.buildingSlug,this.orgSlug,h&&null!==(n=p.leadId)&&void 0!==n?n:void 0);f&&(Fu(d,p.initiatedChat,f.lead_id),this.isOrgMode()&&f.building_slug&&await this.adoptBuilding(f.building_slug)),this.LeadSourceClient.chatId=this.myPubnub.channel;const g=await(null===(i=this.LeadSourceClient)||void 0===i?void 0:i.generateUserLeadSource({leadId:null!==(o=null===(r=this.myPubnub)||void 0===r?void 0:r.leadUserId)&&void 0!==o?o:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));g&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(g),"property-website"!==ia(this.orgSlug)?this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:ia(this.orgSlug):this.myPubnub.leadSource=null!==(u=null===(l=this.LeadSourceClient)||void 0===l?void 0:l.leadSource)&&void 0!==u?u:null;const m=Hu(d);m.initiatedChat&&await this.myPubnub.initializePubnub(m)},this.isOrgMode=()=>this.centralConvo&&!this.buildingSlug,this.chatStorageSlug=()=>this.orgLevel?"":this.buildingSlug,this.adoptBuilding=async e=>{var t;try{const n=await da(this.orgSlug,e);if(!(null==n?void 0:n.id))return;this.buildingSlug=e,this.buildingWebchatView=n,null===(t=this.myPubnub)||void 0===t||t.adoptBuilding(e,n)}catch(e){}},this.withOrgLevelContactOptions=(e,t)=>this.orgLevel?{...e,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,callDesktop:e.callDesktop&&!!t,callMobile:e.callMobile&&!!t}:e,this.fetchDeclaredBuildingId=async()=>{if(!this.declaredBuildingSlug||!this.orgSlug)return null;try{const e=await da(this.orgSlug,this.declaredBuildingSlug);return"number"==typeof(null==e?void 0:e.id)&&e.id>0?e.id:null}catch{return null}},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!Gr(Wr(t)));return!!e&&!!n&&!Tr()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",Rr(function(e,t){return ii(2,arguments),wi(e,6e4*vi(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;if("Tab"!==e.key)return;const u=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("meetelise-launcher"))||void 0===n?void 0:n.shadowRoot;let d=[];if(this.displayPubnubChat){const e=null===(o=null===(r=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat"))||void 0===r?void 0:r.shadowRoot)||void 0===o?void 0:o.getElementById("pubnub-chat-container"),t=null===(a=this.shadowRoot)||void 0===a?void 0:a.getElementById("chatAdditionalActionsPubnub");e&&d.push(...this.collectFocusableElements(e)),t&&d.push(...this.collectFocusableElements(t))}else{const e=null!==(l=null!==(s=null==u?void 0:u.getElementById("email-us-window"))&&void 0!==s?s:null==u?void 0:u.getElementById("tour-scheduler-window"))&&void 0!==l?l:null==u?void 0:u.getElementById("call-us-window");e&&(d=this.collectFocusableElements(e))}if(0===d.length)return;e.preventDefault();const c=this.getDeepActiveElement(),h=d.findIndex(e=>e===c);d[e.shiftKey?(h-1+d.length)%d.length:(h+1)%d.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 Ko(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(),ju(this.chatStorageSlug()),this.orgLevel&&(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),this._cleanupMobileListener=_r(e=>{this._isMobile=e})}static isFocusable(e){return!("disabled"in e)||!e.disabled}collectFocusableElements(e){const t=[];e instanceof Element&&e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));const n=e.querySelectorAll("*");for(const e of Array.from(n))e.matches(Gc.FOCUSABLE_SELECTOR)&&Gc.isFocusable(e)&&t.push(e),e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));return t}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){Jo({logType:Zo.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,t;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),window.removeEventListener("keydown",this.handleKeydownTab),null===(t=this._cleanupMobileListener)||void 0===t||t.call(this),super.disconnectedCallback()}render(){var e,t,n,i,r,o,a,s,l,u,d,c,h,p,f,g,m,b,y,v,w,C,x,$,S,A,k,E,T,_,O,P,I,N,M,D,L,R,B,j,F,H,G,z,Q,W,V;lu();const q=this.hideLauncher&&!this.isLoading&&!this._isMobile;return U`
|
|
7650
|
+
`}};Oc.AUTO_SCROLL_THRESHOLD_PX=32,Oc.styles=[Oe,ud,ld,sd,Ac],_c([ue({type:Number})],Oc.prototype,"right",void 0),_c([ue({type:Number})],Oc.prototype,"bottom",void 0),_c([ue({type:Number})],Oc.prototype,"top",void 0),_c([ue({type:Number})],Oc.prototype,"left",void 0),_c([ue({attribute:!0})],Oc.prototype,"onMount",void 0),_c([ue({attribute:!0})],Oc.prototype,"channel",void 0),_c([ue({attribute:!0})],Oc.prototype,"isHealthChat",void 0),_c([ue({attribute:!0})],Oc.prototype,"myPubnub",void 0),_c([ue({attribute:!0})],Oc.prototype,"orgSlug",void 0),_c([ue({attribute:!0})],Oc.prototype,"buildingSlug",void 0),_c([ue({attribute:!0})],Oc.prototype,"centralConvo",void 0),_c([ue({attribute:!0})],Oc.prototype,"widgetType",void 0),_c([ue({attribute:!0})],Oc.prototype,"building",void 0),_c([ue({attribute:!0})],Oc.prototype,"primaryColor",void 0),_c([ue({attribute:!0})],Oc.prototype,"backgroundColor",void 0),_c([ue({attribute:!0})],Oc.prototype,"onClickExit",void 0),_c([ue({attribute:!0})],Oc.prototype,"requiresConsent",void 0),_c([ce("#message-input",!0)],Oc.prototype,"messageInput",void 0),_c([ce("#conversation-body",!0)],Oc.prototype,"messageBody",void 0),_c([de()],Oc.prototype,"_isMobile",void 0),_c([de()],Oc.prototype,"messages",void 0),_c([de()],Oc.prototype,"isLoadingMessages",void 0),_c([de()],Oc.prototype,"hasReceivedConsent",void 0),_c([de()],Oc.prototype,"privacyPolicyUrl",void 0),_c([de()],Oc.prototype,"websitePreviewMapping",void 0),Oc=Tc=_c([se("pubnub-chat")],Oc);const Pc=e=>Ku(e)?e.message:Zu(e)?`Take me to ${e.navigation.label}`:"Media message",Ic="cdn.skypack.dev/@meetelise/chat",Nc="cdn.eliseai.com/@meetelise/chat",Mc=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(Ic)||n.includes(Ic))return"skypack";if(e.includes(Nc)||n.includes(Nc))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){}},Dc=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?t.endsWith("/units")?t:`${t}/units`:t,Lc={"95ae958e-95db-11ed-9862-6f4db5533d3f":"8008db60-45b7-11f1-88ac-635f686365da","95ae96b0-95db-11ed-9863-a7aa664fd985":"72ed27c4-45b7-11f1-82d9-37b7db547687"},Rc="https://applications.eliseai.com",Uc=["Check Availability","Apply Now"],Bc=(e,t,n,i)=>{if(!(e=>{var t;if(!e.classList.contains("floorplan-button"))return!1;const n=e.getElementsByTagName("span");if(1!==n.length)return!1;const i=null===(t=n[0].textContent)||void 0===t?void 0:t.trim();return null!=i&&Uc.includes(i)})(e))return!1;if(e.getAttribute("href")===t)return!1;const r=e.getAttribute("href");return e.setAttribute("href",t),e.setAttribute("target","_blank"),Jo({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:Zo.info,buildingSlug:i,orgSlug:n}),!0},jc=(e,t,n,i)=>{for(let r=0;r<e.length;r++){const o=e[r];if(o.nodeType!==Node.ELEMENT_NODE)continue;const a=o;"A"===a.tagName&&Bc(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)Bc(s[e],t,n,i)}},Fc=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)Bc(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)jc(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class Hc{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>Rr(Br(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=vo();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(Xo()).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:Rr(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:Rr(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));Jo({logType:Zo.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=ia(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:Rr(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:Rr(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Wr(e.timestampInitiallyLogged).getTime()-Wr(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:Rr(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:Rr(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=>Wr(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var Gc,zc=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 Qc=Gc=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.centralConvo=!1,this.declaredBuildingSlug="",this.hostDeclaredBuildingId=void 0,this.orgLevel=!1,this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=Tr(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=fo.always,this.bedroomPreferenceRequired=!1,this.brokerIntakeEnabled=!1,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.openTourSchedulerOnLoad=!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=sh.Default,this.onWidgetLoaded=ru(),this.onSstClose=ru(),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()=>{var e,t;if(!this.orgSlug)return;if(!this.centralConvo&&!this.buildingSlug)return;this.centralConvo&&!this.buildingSlug&&(this.orgLevel=!0);const n=this.centralConvo?await async function(e){const t=`https://app.meetelise.com/api/pub/v1/organization/${e}/webchat/v2`,n=await r().get(t);return ca(n.data)}(this.orgSlug):await da(this.orgSlug,this.buildingSlug);if(!this.isOrgMode()){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{Mc(this.orgSlug,this.buildingSlug)}catch(e){}}if(!await rs(n,this.buildingSlug,this.orgSlug))return;ea({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==n?void 0:n.launchedDateTime)?.01:.05}),this.buildingWebchatView=n;const i=(()=>{try{const e="true"===sessionStorage.getItem(Qu);return sessionStorage.removeItem(Qu),e}catch{return!1}})();await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),(e=>{const t=new URLSearchParams(window.location.search),n=t.get("rwg_token"),i=t.get("elise_google_env");if(!n||!i||!e)return;const r={rwgToken:n,environment:i,buildingId:e,expiresAt:Date.now()+2592e6};localStorage.setItem(Va,JSON.stringify(r))})(null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.id)&&void 0!==t?t:0),i?(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0):"tour"===new URLSearchParams(window.location.search).get("elise_open")&&(this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile)?this.openTourSchedulerOnLoad=!0:this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)?(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()):"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0),this.isLoading=!1},this.setBuildingDerivedInfo=async()=>{var e,t,n,i,o,a,s,l,u,d,c,h,p,f,g,m,b,y,v,w,C,x,$,S,A,k,E,T,_,O,P,I,N,M,D,L,R,U,B,j,F,H,G,z,Q,W,V,q,Y,K,X;const Z=this.buildingWebchatView;if(!Z)return;Z&&this.orgSlug&&!this.orgLevel&&Vc(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 J=Z.featureFlagWebchatMarketingSourceDropdownConfiguration,ee=Z.featureFlagWebchatUseDniPhoneNumberBySource,te=Z.featureFlagInsertDniIntoWebsite,ne=Z.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite;var ie;ie=Co.includes(Z.orgId),$o=ie;const[re,oe,ae,se,le]=await Promise.all([this.isOrgMode()?Promise.resolve([]):ku(this.orgSlug,this.buildingSlug),go(this.buildingSlug),Tu(this.buildingSlug),bo(this.buildingSlug),yo(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Gn(Z.phoneNumber),this.buildingWebchatView.isAip=ae),this.leadSources=re,this.featureFlagShowDropdown=J,this.bedroomPreferenceRequired=se,this.brokerIntakeEnabled=le;const ue=this.orgLevel?null:Z.textWithUsPhoneNumber?Z.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 Jo({logType:Zo.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t},error:t}),null}return null})(this.buildingSlug),de=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,ce=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,he={callDesktop:null!==(d=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==d&&d,callMobile:null!==(h=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.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!==(y=null===(b=this.buildingWebchatView)||void 0===b?void 0:b.shouldShowEmailDesktop)&&void 0!==y&&y,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)&&!!ue)&&void 0!==x&&x,textMobile:null!==(S=(null===($=this.buildingWebchatView)||void 0===$?void 0:$.shouldShowTextMobile)&&!!ue)&&void 0!==S&&S,sstDesktop:null!==(k=null===(A=this.buildingWebchatView)||void 0===A?void 0:A.shouldShowSstDesktop)&&void 0!==k&&k,sstMobile:null!==(T=null===(E=this.buildingWebchatView)||void 0===E?void 0:E.shouldShowSstMobile)&&void 0!==T&&T,calcDesktop:de,calcMobile:ce};var pe,fe;this.enabledChatWidgets=this.withOrgLevelContactOptions(cu(he),null!==(O=null===(_=this.buildingWebchatView)||void 0===_?void 0:_.phoneNumber)&&void 0!==O?O:""),this.orgLevel||(this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(rd(this.handleTourClicked,this.orgSlug,this.buildingSlug,()=>this.isConnected),ne&&(fe=this.handleTourClicked,document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(e=>{e&&e.addEventListener("click",e=>{e.preventDefault(),fe(e)})})),"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===(P=this.LeadSourceClient)||void 0===P?void 0:P.leadSource)&&(pe=null!==(N=null===(I=this.LeadSourceClient)||void 0===I?void 0:I.leadSource)&&void 0!==N?N: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(pe)}`)}}))),this.buildingWebchatView&&(this.primaryColor=null!==(M=this.buildingWebchatView.primaryColor)&&void 0!==M?M:null,this.backgroundColor=null!==(D=this.buildingWebchatView.secondaryColor)&&void 0!==D?D:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(L=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==L?L:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(R=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==R?R:null,this.webchatConfigHasAutoOpenChat=null!==(U=this.buildingWebchatView.autoOpenChat)&&void 0!==U&&U,this.requiresConsent=null!==(B=this.buildingWebchatView.requiresConsentForChat)&&void 0!==B&&B,this.hideMobileFeatures=null!==(j=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==j&&j,this.privacyPolicyUrl=null!==(F=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==F?F:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===aa.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===aa.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===aa.EMOJI&&(this.designConcept=aa.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=qn),null===this.backgroundColor&&(this.backgroundColor=Yn);const ge=null!==(G=null===(H=this.buildingWebchatView)||void 0===H?void 0:H.phoneNumber)&&void 0!==G?G:"";let me=null;if(ee&&!this.orgLevel&&(me=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:Gn(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(Q=null===(z=this.LeadSourceClient)||void 0===z?void 0:z.leadSource)&&void 0!==Q?Q:null),me&&!me.isMatch&&(me.number=ge)),te&&(null==me?void 0:me.number)){const e=id(me.number,this.orgSlug,this.buildingSlug);e>0&&ea({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const be=localStorage.getItem("eliseai_phone_number_devtest");be&&id(be,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=me||{number:ge,isMatch:!1,isPropertyWebsiteCatchall:!0};const ye=null!==(V=null===(W=this.LeadSourceClient)||void 0===W?void 0:W.leadSource)&&void 0!==V?V:null;ye&&(this.leadSources.includes(ye)||this.leadSources.push(ye)),this.isOrgMode()||io(Z.id);if((oe||(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isAip))&&(null===(Y=this.buildingWebchatView)||void 0===Y?void 0:Y.isLiveOnApplications)&&this.buildingSlug&&!this.orgLevel){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(\?.*)?$/,/\/content\/apply/,/\/apply-now/,/\/apply/,/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=Dc(o,e);l.setAttribute("href",s),a++,Jo({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:Zo.info,buildingSlug:n,orgSlug:t})}}return 0===a&&Jo({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:Zo.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}/units`,this.orgSlug,this.buildingSlug);e>0&&ea({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}if(this.buildingSlug&&this.orgSlug&&!this.orgLevel)try{(e=>{const t=Lc[e];if(!t)return 0;const n=`${Rc}/building/${t}/units`,i=`${Rc}/building/${e}/units`,r=new RegExp(`https://applications\\.eliseai\\.com/building/${t}/units`,"g");let o=0;const a=document.body.getElementsByTagName("a");for(let e=0;e<a.length;e++){const t=a[e],s=t.getAttribute("href");if(!s||!s.includes(n))continue;const l=s.replace(r,i);l!==s&&(t.setAttribute("href",l),o++)}document.body.querySelectorAll("[onclick]").forEach(e=>{const t=e.getAttribute("onclick");if(!t||!t.includes(n))return;const a=t.replace(r,i);a!==t&&(e.setAttribute("onclick",a),o++)})})(this.buildingSlug)}catch{}this.buildingSlug&&!this.orgLevel&&(null===(K=this.buildingWebchatView)||void 0===K?void 0:K.isLiveOnApplications)&&(null===(X=this.buildingWebchatView)||void 0===X?void 0:X.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&Fc(this.orgSlug,this.buildingSlug,this.buildingWebchatView.applicationLink)},this.initializeChatVariables=async()=>{var e,t,n,i,r,o,a,s,l,u;if(!this.buildingWebchatView)return;const d=this.chatStorageSlug(),c=Hu(d),h=Gu(d,c),p=h?c:Fu(d,!1);if(!p.leadId)throw new Error("Lead ID is null");if(this.LeadSourceClient=new ra,this.LeadSourceClient.orgId=null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.orgId)&&void 0!==t?t:0,this.LeadSourceMultitouchClient=new Hc(this.orgSlug,this.buildingSlug),this.myPubnub=new ed(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,p.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType),this.myPubnub.chatStorageSlug=d,this.centralConvo){const e=this.myPubnub;e.centralConvo=!0,void 0!==this.hostDeclaredBuildingId?e.declaredBuildingId=this.hostDeclaredBuildingId:this.fetchDeclaredBuildingId().then(t=>{void 0===this.hostDeclaredBuildingId&&(e.declaredBuildingId=t)})}else this.myPubnub.declaredBuildingId=this.buildingWebchatView.id;const f=await this.myPubnub.initSession(this.buildingSlug,this.orgSlug,h&&null!==(n=p.leadId)&&void 0!==n?n:void 0);f&&(Fu(d,p.initiatedChat,f.lead_id),this.isOrgMode()&&f.building_slug&&await this.adoptBuilding(f.building_slug)),this.LeadSourceClient.chatId=this.myPubnub.channel;const g=await(null===(i=this.LeadSourceClient)||void 0===i?void 0:i.generateUserLeadSource({leadId:null!==(o=null===(r=this.myPubnub)||void 0===r?void 0:r.leadUserId)&&void 0!==o?o:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));g&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(g),"property-website"!==ia(this.orgSlug)?this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:ia(this.orgSlug):this.myPubnub.leadSource=null!==(u=null===(l=this.LeadSourceClient)||void 0===l?void 0:l.leadSource)&&void 0!==u?u:null;const m=Hu(d);m.initiatedChat&&await this.myPubnub.initializePubnub(m)},this.isOrgMode=()=>this.centralConvo&&!this.buildingSlug,this.chatStorageSlug=()=>this.orgLevel?"":this.buildingSlug,this.adoptBuilding=async e=>{var t;try{const n=await da(this.orgSlug,e);if(!(null==n?void 0:n.id))return;this.buildingSlug=e,this.buildingWebchatView=n,null===(t=this.myPubnub)||void 0===t||t.adoptBuilding(e,n)}catch(e){}},this.withOrgLevelContactOptions=(e,t)=>this.orgLevel?{...e,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,callDesktop:e.callDesktop&&!!t,callMobile:e.callMobile&&!!t}:e,this.fetchDeclaredBuildingId=async()=>{if(!this.declaredBuildingSlug||!this.orgSlug)return null;try{const e=await da(this.orgSlug,this.declaredBuildingSlug);return"number"==typeof(null==e?void 0:e.id)&&e.id>0?e.id:null}catch{return null}},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!Gr(Wr(t)));return!!e&&!!n&&!Tr()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",Rr(function(e,t){return ii(2,arguments),wi(e,6e4*vi(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;if("Tab"!==e.key)return;const u=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("meetelise-launcher"))||void 0===n?void 0:n.shadowRoot;let d=[];if(this.displayPubnubChat){const e=null===(o=null===(r=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat"))||void 0===r?void 0:r.shadowRoot)||void 0===o?void 0:o.getElementById("pubnub-chat-container"),t=null===(a=this.shadowRoot)||void 0===a?void 0:a.getElementById("chatAdditionalActionsPubnub");e&&d.push(...this.collectFocusableElements(e)),t&&d.push(...this.collectFocusableElements(t))}else{const e=null!==(l=null!==(s=null==u?void 0:u.getElementById("email-us-window"))&&void 0!==s?s:null==u?void 0:u.getElementById("tour-scheduler-window"))&&void 0!==l?l:null==u?void 0:u.getElementById("call-us-window");e&&(d=this.collectFocusableElements(e))}if(0===d.length)return;e.preventDefault();const c=this.getDeepActiveElement(),h=d.findIndex(e=>e===c);d[e.shiftKey?(h-1+d.length)%d.length:(h+1)%d.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")}}setDeclaredBuildingId(e){this.hostDeclaredBuildingId=e,this.myPubnub&&(this.myPubnub.declaredBuildingId=e)}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new Ko(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(),ju(this.chatStorageSlug()),this.orgLevel&&(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),this._cleanupMobileListener=_r(e=>{this._isMobile=e})}static isFocusable(e){return!("disabled"in e)||!e.disabled}collectFocusableElements(e){const t=[];e instanceof Element&&e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));const n=e.querySelectorAll("*");for(const e of Array.from(n))e.matches(Gc.FOCUSABLE_SELECTOR)&&Gc.isFocusable(e)&&t.push(e),e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));return t}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){Jo({logType:Zo.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,t;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),window.removeEventListener("keydown",this.handleKeydownTab),null===(t=this._cleanupMobileListener)||void 0===t||t.call(this),super.disconnectedCallback()}render(){var e,t,n,i,r,o,a,s,l,u,d,c,h,p,f,g,m,b,y,v,w,C,x,$,S,A,k,E,T,_,O,P,I,N,M,D,L,R,B,j,F,H,G,z,Q,W,V;lu();const q=this.hideLauncher&&!this.isLoading&&!this._isMobile;return U`
|
|
7651
7651
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7652
7652
|
${this.displayPubnubChat?U`
|
|
7653
7653
|
<pubnub-chat
|
|
@@ -7657,7 +7657,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
7657
7657
|
.orgSlug=${this.orgSlug}
|
|
7658
7658
|
.buildingSlug=${this.buildingSlug}
|
|
7659
7659
|
.centralConvo=${this.centralConvo}
|
|
7660
|
-
.widgetType=${
|
|
7660
|
+
.widgetType=${sh.Default}
|
|
7661
7661
|
.building=${this.buildingWebchatView}
|
|
7662
7662
|
.primaryColor=${this.primaryColor}
|
|
7663
7663
|
.backgroundColor=${this.backgroundColor}
|
|
@@ -7899,12 +7899,12 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
7899
7899
|
/>
|
|
7900
7900
|
</svg>
|
|
7901
7901
|
</button>
|
|
7902
|
-
</div>`}};Xc.styles=[Yc],Kc([ue({type:Number})],Xc.prototype,"right",void 0),Kc([ue({type:Number})],Xc.prototype,"bottom",void 0),Kc([ue({type:Number})],Xc.prototype,"top",void 0),Kc([ue({type:Number})],Xc.prototype,"left",void 0),Kc([ue({attribute:!0})],Xc.prototype,"isChatOpen",void 0),Kc([ue({attribute:!0})],Xc.prototype,"onClickCloseChat",void 0),Kc([ue({attribute:!0})],Xc.prototype,"onClickOpenChat",void 0),Xc=Kc([se("simple-launcher")],Xc);var Zc=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 Jc=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=Hu(this.healthcareId),t=Gu(this.healthcareId,e)?e:Fu(this.healthcareId,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new ed(this.healthcareId,null,"",this.currentLeadSource,t.leadId,null,null,
|
|
7902
|
+
</div>`}};Xc.styles=[Yc],Kc([ue({type:Number})],Xc.prototype,"right",void 0),Kc([ue({type:Number})],Xc.prototype,"bottom",void 0),Kc([ue({type:Number})],Xc.prototype,"top",void 0),Kc([ue({type:Number})],Xc.prototype,"left",void 0),Kc([ue({attribute:!0})],Xc.prototype,"isChatOpen",void 0),Kc([ue({attribute:!0})],Xc.prototype,"onClickCloseChat",void 0),Kc([ue({attribute:!0})],Xc.prototype,"onClickOpenChat",void 0),Xc=Kc([se("simple-launcher")],Xc);var Zc=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 Jc=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=Hu(this.healthcareId),t=Gu(this.healthcareId,e)?e:Fu(this.healthcareId,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new ed(this.healthcareId,null,"",this.currentLeadSource,t.leadId,null,null,sh.Healthcare),t.initiatedChat&&await this.myPubnub.initializePubnub(e),Tr()||(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(),ju(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 lu(),this.isLoading?U``:U`
|
|
7903
7903
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
7904
7904
|
${this.displayPubnubChat?U`
|
|
7905
7905
|
<pubnub-chat
|
|
7906
7906
|
id="pubnub-chat"
|
|
7907
|
-
.widgetType=${
|
|
7907
|
+
.widgetType=${sh.Healthcare}
|
|
7908
7908
|
.channel=${null===(e=this.myPubnub)||void 0===e?void 0:e.channel}
|
|
7909
7909
|
.myPubnub=${this.myPubnub}
|
|
7910
7910
|
.buildingSlug=${this.healthcareId}
|
|
@@ -7983,13 +7983,13 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
7983
7983
|
line-height: 150%;
|
|
7984
7984
|
font-size: 16px;
|
|
7985
7985
|
}
|
|
7986
|
-
`,Zc([ue({type:String})],Jc.prototype,"healthcareId",void 0),Zc([ue({type:Number})],Jc.prototype,"right",void 0),Zc([ue({type:Number})],Jc.prototype,"bottom",void 0),Zc([ue({type:Number})],Jc.prototype,"top",void 0),Zc([ue({type:Number})],Jc.prototype,"left",void 0),Zc([de()],Jc.prototype,"launcher",void 0),Zc([de()],Jc.prototype,"currentLeadSource",void 0),Zc([de()],Jc.prototype,"displayPubnubChat",void 0),Zc([de()],Jc.prototype,"myPubnub",void 0),Zc([de()],Jc.prototype,"requiresConsent",void 0),Zc([de()],Jc.prototype,"privacyPolicyUrl",void 0),Zc([de()],Jc.prototype,"isLoading",void 0),Jc=Zc([se("health-chat")],Jc);var eh=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 th=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(po(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=Hu(this.orgSlug),t=Gu(this.orgSlug,e)?e:Fu(this.orgSlug,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new ed(this.orgSlug,null,this.orgSlug,this.currentLeadSource,t.leadId,null,null,
|
|
7986
|
+
`,Zc([ue({type:String})],Jc.prototype,"healthcareId",void 0),Zc([ue({type:Number})],Jc.prototype,"right",void 0),Zc([ue({type:Number})],Jc.prototype,"bottom",void 0),Zc([ue({type:Number})],Jc.prototype,"top",void 0),Zc([ue({type:Number})],Jc.prototype,"left",void 0),Zc([de()],Jc.prototype,"launcher",void 0),Zc([de()],Jc.prototype,"currentLeadSource",void 0),Zc([de()],Jc.prototype,"displayPubnubChat",void 0),Zc([de()],Jc.prototype,"myPubnub",void 0),Zc([de()],Jc.prototype,"requiresConsent",void 0),Zc([de()],Jc.prototype,"privacyPolicyUrl",void 0),Zc([de()],Jc.prototype,"isLoading",void 0),Jc=Zc([se("health-chat")],Jc);var eh=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 th=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(po(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=Hu(this.orgSlug),t=Gu(this.orgSlug,e)?e:Fu(this.orgSlug,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new ed(this.orgSlug,null,this.orgSlug,this.currentLeadSource,t.leadId,null,null,sh.Utilities),t.initiatedChat&&await this.myPubnub.initializePubnub(e),Tr()||(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(),ju(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 lu(),this.isLoading?U``:U`
|
|
7987
7987
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
7988
7988
|
${this.displayPubnubChat?U`
|
|
7989
7989
|
<pubnub-chat
|
|
7990
7990
|
id="pubnub-chat"
|
|
7991
7991
|
.channel=${null===(e=this.myPubnub)||void 0===e?void 0:e.channel}
|
|
7992
|
-
.widgetType=${
|
|
7992
|
+
.widgetType=${sh.Utilities}
|
|
7993
7993
|
.myPubnub=${this.myPubnub}
|
|
7994
7994
|
.buildingSlug=${this.orgSlug}
|
|
7995
7995
|
.onClickExit=${()=>{this.displayPubnubChat=!1}}
|
|
@@ -8066,4 +8066,4 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
8066
8066
|
line-height: 150%;
|
|
8067
8067
|
font-size: 16px;
|
|
8068
8068
|
}
|
|
8069
|
-
`,eh([ue({type:String})],th.prototype,"orgSlug",void 0),eh([ue({type:Number})],th.prototype,"right",void 0),eh([ue({type:Number})],th.prototype,"bottom",void 0),eh([ue({type:Number})],th.prototype,"top",void 0),eh([ue({type:Number})],th.prototype,"left",void 0),eh([de()],th.prototype,"launcher",void 0),eh([de()],th.prototype,"currentLeadSource",void 0),eh([de()],th.prototype,"displayPubnubChat",void 0),eh([de()],th.prototype,"myPubnub",void 0),eh([de()],th.prototype,"requiresConsent",void 0),eh([de()],th.prototype,"privacyPolicyUrl",void 0),eh([de()],th.prototype,"isLoading",void 0),th=eh([se("utilities-chat")],th);const nh=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&&Jo({logType:i&&i.data?Zo.info:Zo.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},ih=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 rh{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}),sh();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","region"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),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),rh.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;if(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}),sh(),e.studio&&!e.building)return void this.handleStudioContext(e);let d=null;switch(e.widgetType){case ah.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case ah.Default:d=document.createElement("me-chat");break;case ah.Utilities:d=document.createElement("utilities-chat");break;default:d=document.createElement("me-chat")}if(!d)throw new Error("Invalid widget type");d.setAttribute("orgSlug","Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||""),d.setAttribute("widgetType",e.widgetType||ah.Default),d.setAttribute("class","meetelise-chat"),d.setAttribute("role","region"),d.setAttribute("aria-label","EliseAI Widget"),e.brandColor&&(this.brandColor=e.brandColor,d.setAttribute("primaryColor",((e,t)=>{const n=Kn(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 Xn(a.r,a.g,a.b)})(e.brandColor,.3))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),d instanceof Qc&&(e.centralConvo?(d.setAttribute("centralConvo","true"),e.building&&d.setAttribute("declaredBuildingSlug",e.building)):this.handleBuildingslug(d,e.organization,e.building,e),e.launcherStyles&&(d.launcherStyles=e.launcherStyles),e.mobileStyles&&(d.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(d.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await ih("rg-widget-compact");e&&e.setAttribute("style","display: none")})(),d.overrideRentgrata=!0),e.onSstClose&&(d.onSstClose=e.onSstClose)),e.position&&(d.setAttribute("right",(null===(a=e.position.right)||void 0===a?void 0:a.toString())||"unset"),d.setAttribute("bottom",(null===(s=e.position.bottom)||void 0===s?void 0:s.toString())||"unset"),d.setAttribute("top",(null===(l=e.position.top)||void 0===l?void 0:l.toString())||"unset"),d.setAttribute("left",(null===(u=e.position.left)||void 0===u?void 0:u.toString())||"unset")),window.eliseAi={},document.body.appendChild(d),d instanceof Qc&&(rh.meChat=d),d instanceof th&&(rh.utilitiesChat=d)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.studioUpdateToken+=1,await this.removeWidget(),this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.activeStudioOptions=null}static async removeWidget(){var e;if(!this.meChat)return;const t=this.meChat;await t.remove(),null===(e=t.parentNode)||void 0===e||e.removeChild(t),rh.meChat=null}static handleStudioContext(e){e.studio&&(this.activeStudioOptions=e)}static updateStudioContext(e){const t=this.activeStudioOptions;if(!(null==t?void 0:t.studio))return;const n=++this.studioUpdateToken;if(e.siteId&&e.siteId!==t.studio.siteId)return void Jo({logType:Zo.warn,logTitle:"[STUDIO_WEBCHAT_CONTEXT_SITE_MISMATCH]",logData:{activeSiteId:t.studio.siteId,contextSiteId:e.siteId,url:window.location.href}});const i=oh(e.organization),r=oh(e.building);if(!i||!r)return void this.clearStudioContext({source:"elise_studio",reason:"missing_context",preserveCache:!0});const o=function(e,t){if(!(null==e?void 0:e.key))return`building:${t}`;return e.key}(e.sessionScope,r),a=function(e){return"Pacific Urban Residential"===e?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e}(i);this.activeStudioOrgSlug===a&&this.activeStudioBuildingSlug===r&&this.activeStudioSessionScopeKey===o||this.removeWidget().then(()=>{n===this.studioUpdateToken&&(this.activeStudioOrgSlug=a,this.activeStudioBuildingSlug=r,this.activeStudioSessionScopeKey=o,this.orgSlug=a,this.start({...t,organization:i,building:r},!1))})}static clearStudioContext(e){this.studioUpdateToken+=1,this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.removeWidget()}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 nh(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,nh(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&&Jo({logType:n&&n.data?Zo.info:Zo.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&&Jo({logType:i&&i.data===e?Zo.info:Zo.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}}function oh(e){return"string"!=typeof e?"":e.trim()}var ah;rh.meChat=null,rh.healthChat=null,rh.utilitiesChat=null,rh.orgSlug="",rh.mutationObserver=null,rh.previousUrl="",rh.hasBuildingSlug=null,rh.brandColor="",rh.backgroundColor="",rh.healthcareId="",rh.activeStudioOrgSlug="",rh.activeStudioBuildingSlug="",rh.activeStudioSessionScopeKey="",rh.activeStudioOptions=null,rh.studioUpdateToken=0,rh.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(ah||(ah={}));const sh=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)};export{ah as WidgetType,rh as default};
|
|
8069
|
+
`,eh([ue({type:String})],th.prototype,"orgSlug",void 0),eh([ue({type:Number})],th.prototype,"right",void 0),eh([ue({type:Number})],th.prototype,"bottom",void 0),eh([ue({type:Number})],th.prototype,"top",void 0),eh([ue({type:Number})],th.prototype,"left",void 0),eh([de()],th.prototype,"launcher",void 0),eh([de()],th.prototype,"currentLeadSource",void 0),eh([de()],th.prototype,"displayPubnubChat",void 0),eh([de()],th.prototype,"myPubnub",void 0),eh([de()],th.prototype,"requiresConsent",void 0),eh([de()],th.prototype,"privacyPolicyUrl",void 0),eh([de()],th.prototype,"isLoading",void 0),th=eh([se("utilities-chat")],th);const nh=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&&Jo({logType:i&&i.data?Zo.info:Zo.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},ih=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 rh{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}),lh();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","region"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),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),rh.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;if(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}),lh(),e.studio&&!e.building)return void this.handleStudioContext(e);let d=null;switch(e.widgetType){case sh.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case sh.Default:d=document.createElement("me-chat");break;case sh.Utilities:d=document.createElement("utilities-chat");break;default:d=document.createElement("me-chat")}if(!d)throw new Error("Invalid widget type");d.setAttribute("orgSlug","Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||""),d.setAttribute("widgetType",e.widgetType||sh.Default),d.setAttribute("class","meetelise-chat"),d.setAttribute("role","region"),d.setAttribute("aria-label","EliseAI Widget"),e.brandColor&&(this.brandColor=e.brandColor,d.setAttribute("primaryColor",((e,t)=>{const n=Kn(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 Xn(a.r,a.g,a.b)})(e.brandColor,.3))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),d instanceof Qc&&(e.centralConvo?(d.setAttribute("centralConvo","true"),e.building&&d.setAttribute("declaredBuildingSlug",e.building)):this.handleBuildingslug(d,e.organization,e.building,e),e.launcherStyles&&(d.launcherStyles=e.launcherStyles),e.mobileStyles&&(d.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(d.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await ih("rg-widget-compact");e&&e.setAttribute("style","display: none")})(),d.overrideRentgrata=!0),e.onSstClose&&(d.onSstClose=e.onSstClose)),e.position&&(d.setAttribute("right",(null===(a=e.position.right)||void 0===a?void 0:a.toString())||"unset"),d.setAttribute("bottom",(null===(s=e.position.bottom)||void 0===s?void 0:s.toString())||"unset"),d.setAttribute("top",(null===(l=e.position.top)||void 0===l?void 0:l.toString())||"unset"),d.setAttribute("left",(null===(u=e.position.left)||void 0===u?void 0:u.toString())||"unset")),window.eliseAi={},document.body.appendChild(d),d instanceof Qc&&(rh.meChat=d),d instanceof th&&(rh.utilitiesChat=d)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.studioUpdateToken+=1,await this.removeWidget(),this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.activeStudioOptions=null}static async removeWidget(){var e;if(!this.meChat)return;const t=this.meChat;await t.remove(),null===(e=t.parentNode)||void 0===e||e.removeChild(t),rh.meChat=null}static handleStudioContext(e){e.studio&&(this.activeStudioOptions=e)}static updateStudioContext(e){var t;const n=this.activeStudioOptions;if(!(null==n?void 0:n.studio))return;const i=++this.studioUpdateToken;if(e.siteId&&e.siteId!==n.studio.siteId)return void Jo({logType:Zo.warn,logTitle:"[STUDIO_WEBCHAT_CONTEXT_SITE_MISMATCH]",logData:{activeSiteId:n.studio.siteId,contextSiteId:e.siteId,url:window.location.href}});if("org"===(null===(t=e.sessionScope)||void 0===t?void 0:t.type))return void this.updateStudioOrgContext(e,n,i);const r=oh(e.organization),o=oh(e.building);if(!r||!o)return void this.clearStudioContext({source:"elise_studio",reason:"missing_context",preserveCache:!0});const a=function(e,t){if(!(null==e?void 0:e.key))return`building:${t}`;return e.key}(e.sessionScope,o),s=ah(r);this.activeStudioOrgSlug===s&&this.activeStudioBuildingSlug===o&&this.activeStudioSessionScopeKey===a||this.removeWidget().then(()=>{i===this.studioUpdateToken&&(this.activeStudioOrgSlug=s,this.activeStudioBuildingSlug=o,this.activeStudioSessionScopeKey=a,this.orgSlug=s,this.start({...n,organization:r,building:o},!1))})}static updateStudioOrgContext(e,t,n){var i;const r=oh(e.organization);if(!r)return void this.clearStudioContext({source:"elise_studio",reason:"missing_context",preserveCache:!0});const o=ah(r),a=(null===(i=e.sessionScope)||void 0===i?void 0:i.key)||`org:${r}`,s=function(e){const t="string"==typeof e?Number(e):e;return"number"==typeof t&&Number.isInteger(t)&&t>0?t:null}(e.declaredBuildingId);!this.meChat||this.activeStudioOrgSlug!==o||this.activeStudioBuildingSlug||this.activeStudioSessionScopeKey!==a?this.removeWidget().then(()=>{var e;n===this.studioUpdateToken&&(this.activeStudioOrgSlug=o,this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey=a,this.orgSlug=o,this.start({...t,studio:void 0,organization:r,building:void 0,centralConvo:!0},!1),null===(e=this.meChat)||void 0===e||e.setDeclaredBuildingId(s))}):this.meChat.setDeclaredBuildingId(s)}static clearStudioContext(e){this.studioUpdateToken+=1,this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.removeWidget()}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 nh(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,nh(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&&Jo({logType:n&&n.data?Zo.info:Zo.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&&Jo({logType:i&&i.data===e?Zo.info:Zo.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}}function oh(e){return"string"!=typeof e?"":e.trim()}function ah(e){return"Pacific Urban Residential"===e?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e}var sh;rh.meChat=null,rh.healthChat=null,rh.utilitiesChat=null,rh.orgSlug="",rh.mutationObserver=null,rh.previousUrl="",rh.hasBuildingSlug=null,rh.brandColor="",rh.backgroundColor="",rh.healthcareId="",rh.activeStudioOrgSlug="",rh.activeStudioBuildingSlug="",rh.activeStudioSessionScopeKey="",rh.activeStudioOptions=null,rh.studioUpdateToken=0,rh.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(sh||(sh={}));const lh=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)};export{sh as WidgetType,rh as default};
|
|
@@ -144,6 +144,11 @@ export class MEChat extends LitElement {
|
|
|
144
144
|
*/
|
|
145
145
|
@property({ type: String })
|
|
146
146
|
private declaredBuildingSlug = "";
|
|
147
|
+
/**
|
|
148
|
+
* Org-level webchat on a host that knows the page's building by id (Elise
|
|
149
|
+
* Studio), set with `setDeclaredBuildingId`. Undefined until the host sets it.
|
|
150
|
+
*/
|
|
151
|
+
private hostDeclaredBuildingId: number | null | undefined = undefined;
|
|
147
152
|
/**
|
|
148
153
|
* Org-level webchat (`centralConvo` started without a building). Stays true
|
|
149
154
|
* after the widget adopts the org's triage general building from
|
|
@@ -700,10 +705,16 @@ export class MEChat extends LitElement {
|
|
|
700
705
|
if (this.centralConvo) {
|
|
701
706
|
const myPubnub = this.myPubnub;
|
|
702
707
|
myPubnub.centralConvo = true;
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
708
|
+
if (this.hostDeclaredBuildingId !== undefined) {
|
|
709
|
+
myPubnub.declaredBuildingId = this.hostDeclaredBuildingId;
|
|
710
|
+
} else {
|
|
711
|
+
// Not awaited: only needed once the visitor sends a message.
|
|
712
|
+
void this.fetchDeclaredBuildingId().then((id) => {
|
|
713
|
+
if (this.hostDeclaredBuildingId === undefined) {
|
|
714
|
+
myPubnub.declaredBuildingId = id;
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
}
|
|
707
718
|
} else {
|
|
708
719
|
this.myPubnub.declaredBuildingId = this.buildingWebchatView.id;
|
|
709
720
|
}
|
|
@@ -814,6 +825,16 @@ export class MEChat extends LitElement {
|
|
|
814
825
|
};
|
|
815
826
|
};
|
|
816
827
|
|
|
828
|
+
/**
|
|
829
|
+
* Org-level webchat: the page's building, sent with later visitor messages as
|
|
830
|
+
* `declaredBuildingId`. For hosts that move between pages without restarting
|
|
831
|
+
* the widget; it doesn't change config or the conversation.
|
|
832
|
+
*/
|
|
833
|
+
setDeclaredBuildingId(id: number | null): void {
|
|
834
|
+
this.hostDeclaredBuildingId = id;
|
|
835
|
+
if (this.myPubnub) this.myPubnub.declaredBuildingId = id;
|
|
836
|
+
}
|
|
837
|
+
|
|
817
838
|
/** The numeric id of the snippet's building in org-level webchat, if it names one. */
|
|
818
839
|
private fetchDeclaredBuildingId = async (): Promise<number | null> => {
|
|
819
840
|
if (!this.declaredBuildingSlug || !this.orgSlug) return null;
|
package/src/main/MEChat.ts
CHANGED
|
@@ -40,7 +40,8 @@ export type StudioWebchatMode = "host_managed_context";
|
|
|
40
40
|
export type StudioWebchatSessionScopeType =
|
|
41
41
|
| "building"
|
|
42
42
|
| "building_group"
|
|
43
|
-
| "site"
|
|
43
|
+
| "site"
|
|
44
|
+
| "org";
|
|
44
45
|
|
|
45
46
|
export interface StudioWebchatSessionScope {
|
|
46
47
|
type: StudioWebchatSessionScopeType;
|
|
@@ -60,6 +61,11 @@ export interface StudioWebchatContext {
|
|
|
60
61
|
building?: string | null;
|
|
61
62
|
buildingGroupId?: string | number | null;
|
|
62
63
|
sessionScope?: StudioWebchatSessionScope;
|
|
64
|
+
/**
|
|
65
|
+
* Org scope only: the page's building, sent with visitor messages as
|
|
66
|
+
* `declaredBuildingId`. Null on pages with no single building.
|
|
67
|
+
*/
|
|
68
|
+
declaredBuildingId?: number | null;
|
|
63
69
|
path?: string;
|
|
64
70
|
pageId?: string;
|
|
65
71
|
}
|
|
@@ -323,6 +329,11 @@ export default class MEChat {
|
|
|
323
329
|
return;
|
|
324
330
|
}
|
|
325
331
|
|
|
332
|
+
if (context.sessionScope?.type === "org") {
|
|
333
|
+
this.updateStudioOrgContext(context, opts, updateToken);
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
|
|
326
337
|
const orgSlug = coerceStudioContextString(context.organization);
|
|
327
338
|
const buildingSlug = coerceStudioContextString(context.building);
|
|
328
339
|
|
|
@@ -368,6 +379,64 @@ export default class MEChat {
|
|
|
368
379
|
});
|
|
369
380
|
}
|
|
370
381
|
|
|
382
|
+
/**
|
|
383
|
+
* Org-level webchat on a Studio site: one org-anchored widget for the whole
|
|
384
|
+
* site, started as the org-level pixel starts it. Route changes only move the
|
|
385
|
+
* page's declared building, so the conversation carries across pages.
|
|
386
|
+
*/
|
|
387
|
+
static updateStudioOrgContext(
|
|
388
|
+
context: StudioWebchatContext,
|
|
389
|
+
opts: Options,
|
|
390
|
+
updateToken: number
|
|
391
|
+
): void {
|
|
392
|
+
const orgSlug = coerceStudioContextString(context.organization);
|
|
393
|
+
if (!orgSlug) {
|
|
394
|
+
this.clearStudioContext({
|
|
395
|
+
source: "elise_studio",
|
|
396
|
+
reason: "missing_context",
|
|
397
|
+
preserveCache: true,
|
|
398
|
+
});
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
const normalizedOrgSlug = normalizeOrgSlug(orgSlug);
|
|
403
|
+
const sessionScopeKey = context.sessionScope?.key || `org:${orgSlug}`;
|
|
404
|
+
const declaredBuildingId = coerceDeclaredBuildingId(
|
|
405
|
+
context.declaredBuildingId
|
|
406
|
+
);
|
|
407
|
+
|
|
408
|
+
if (
|
|
409
|
+
this.meChat &&
|
|
410
|
+
this.activeStudioOrgSlug === normalizedOrgSlug &&
|
|
411
|
+
!this.activeStudioBuildingSlug &&
|
|
412
|
+
this.activeStudioSessionScopeKey === sessionScopeKey
|
|
413
|
+
) {
|
|
414
|
+
this.meChat.setDeclaredBuildingId(declaredBuildingId);
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
void this.removeWidget().then(() => {
|
|
419
|
+
if (updateToken !== this.studioUpdateToken) return;
|
|
420
|
+
|
|
421
|
+
this.activeStudioOrgSlug = normalizedOrgSlug;
|
|
422
|
+
this.activeStudioBuildingSlug = "";
|
|
423
|
+
this.activeStudioSessionScopeKey = sessionScopeKey;
|
|
424
|
+
this.orgSlug = normalizedOrgSlug;
|
|
425
|
+
|
|
426
|
+
this.start(
|
|
427
|
+
{
|
|
428
|
+
...opts,
|
|
429
|
+
studio: undefined,
|
|
430
|
+
organization: orgSlug,
|
|
431
|
+
building: undefined,
|
|
432
|
+
centralConvo: true,
|
|
433
|
+
},
|
|
434
|
+
false
|
|
435
|
+
);
|
|
436
|
+
this.meChat?.setDeclaredBuildingId(declaredBuildingId);
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
|
|
371
440
|
static clearStudioContext(_context?: StudioWebchatClearContext): void {
|
|
372
441
|
void _context;
|
|
373
442
|
this.studioUpdateToken += 1;
|
|
@@ -536,6 +605,11 @@ function normalizeOrgSlug(orgSlug: string): string {
|
|
|
536
605
|
: orgSlug;
|
|
537
606
|
}
|
|
538
607
|
|
|
608
|
+
function coerceDeclaredBuildingId(value: unknown): number | null {
|
|
609
|
+
const id = typeof value === "string" ? Number(value) : value;
|
|
610
|
+
return typeof id === "number" && Number.isInteger(id) && id > 0 ? id : null;
|
|
611
|
+
}
|
|
612
|
+
|
|
539
613
|
function coerceStudioSessionScopeKey(
|
|
540
614
|
sessionScope: StudioWebchatSessionScope | undefined,
|
|
541
615
|
buildingSlug: string
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect } from "@esm-bundle/chai";
|
|
2
2
|
import { restore, stub, useFakeXMLHttpRequest } from "sinon/pkg/sinon-esm";
|
|
3
|
-
import "../public/dist/index";
|
|
3
|
+
import MEChat from "../public/dist/index";
|
|
4
4
|
import type MyPubnub from "./MyPubnub";
|
|
5
5
|
import type { SimpleChatMessage } from "./MyPubnub";
|
|
6
6
|
import type { PubnubChat } from "./WebComponent/pubnub-chat";
|
|
@@ -623,3 +623,116 @@ it("still opens a per-building widget's tour scheduler from its tour link", asyn
|
|
|
623
623
|
expect(widgetTakesOverClick(buildingTourLink)).to.equal(true);
|
|
624
624
|
[buildingTourLink, ...others].forEach((link) => link.remove());
|
|
625
625
|
});
|
|
626
|
+
|
|
627
|
+
// --- Org mode on an Elise Studio site ---
|
|
628
|
+
|
|
629
|
+
const STUDIO_SITE = "site-1";
|
|
630
|
+
|
|
631
|
+
const studioOrgContext = (declaredBuildingId: number | null) => ({
|
|
632
|
+
source: "elise_studio" as const,
|
|
633
|
+
siteId: STUDIO_SITE,
|
|
634
|
+
organization: "test-org",
|
|
635
|
+
sessionScope: { type: "org" as const, key: "org:test-org" },
|
|
636
|
+
declaredBuildingId,
|
|
637
|
+
});
|
|
638
|
+
|
|
639
|
+
const studioWidget = async (): Promise<MeChatInternals> => {
|
|
640
|
+
for (let i = 0; i < 200; i++) {
|
|
641
|
+
const meChat = document.querySelector("me-chat") as MeChatInternals | null;
|
|
642
|
+
if (meChat && !meChat.isLoading) {
|
|
643
|
+
await meChat.updateComplete;
|
|
644
|
+
return meChat;
|
|
645
|
+
}
|
|
646
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
647
|
+
}
|
|
648
|
+
throw new Error("Studio widget never finished loading");
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
it("runs a Studio site's org scope as org-level webchat, one widget across pages", async () => {
|
|
652
|
+
const requests = fakeBackend(inRollout);
|
|
653
|
+
MEChat.start({
|
|
654
|
+
studio: { siteId: STUDIO_SITE, mode: "host_managed_context" },
|
|
655
|
+
});
|
|
656
|
+
try {
|
|
657
|
+
// The homepage: no building.
|
|
658
|
+
MEChat.updateStudioContext(studioOrgContext(null));
|
|
659
|
+
const meChat = await studioWidget();
|
|
660
|
+
|
|
661
|
+
expect(initBodies(requests)).to.deep.equal([
|
|
662
|
+
{ building_slug: "", org_slug: "test-org", central_convo: true },
|
|
663
|
+
]);
|
|
664
|
+
expect(meChat.buildingSlug).to.equal(GENERAL_BUILDING);
|
|
665
|
+
expect(meChat.myPubnub?.declaredBuildingId).to.equal(null);
|
|
666
|
+
|
|
667
|
+
// A property page: same widget and conversation, with the page's building.
|
|
668
|
+
MEChat.updateStudioContext(studioOrgContext(445038));
|
|
669
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
670
|
+
|
|
671
|
+
expect(document.querySelectorAll("me-chat")).to.have.length(1);
|
|
672
|
+
expect(document.querySelector("me-chat")).to.equal(meChat);
|
|
673
|
+
expect(initBodies(requests)).to.have.length(1);
|
|
674
|
+
const message = await publishedMessage(meChat.myPubnub as MyPubnub);
|
|
675
|
+
expect(message).to.include({ declaredBuildingId: 445038 });
|
|
676
|
+
|
|
677
|
+
// Back to a page with no building.
|
|
678
|
+
MEChat.updateStudioContext(studioOrgContext(null));
|
|
679
|
+
expect(meChat.myPubnub?.declaredBuildingId).to.equal(null);
|
|
680
|
+
} finally {
|
|
681
|
+
await MEChat.remove();
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
|
|
685
|
+
it("swaps a Studio site's building widget for org-level webchat", async () => {
|
|
686
|
+
const requests = fakeBackend(inRollout);
|
|
687
|
+
MEChat.start({
|
|
688
|
+
studio: { siteId: STUDIO_SITE, mode: "host_managed_context" },
|
|
689
|
+
});
|
|
690
|
+
try {
|
|
691
|
+
MEChat.updateStudioContext({
|
|
692
|
+
source: "elise_studio",
|
|
693
|
+
siteId: STUDIO_SITE,
|
|
694
|
+
organization: "test-org",
|
|
695
|
+
building: "test-building",
|
|
696
|
+
sessionScope: { type: "building", key: "building:test-building" },
|
|
697
|
+
});
|
|
698
|
+
const buildingWidget = await studioWidget();
|
|
699
|
+
expect(buildingWidget.myPubnub?.centralConvo).to.not.equal(true);
|
|
700
|
+
|
|
701
|
+
MEChat.updateStudioContext(studioOrgContext(445038));
|
|
702
|
+
for (
|
|
703
|
+
let i = 0;
|
|
704
|
+
i < 100 && document.querySelector("me-chat") === buildingWidget;
|
|
705
|
+
i++
|
|
706
|
+
) {
|
|
707
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
708
|
+
}
|
|
709
|
+
const orgWidget = await studioWidget();
|
|
710
|
+
|
|
711
|
+
expect(orgWidget).to.not.equal(buildingWidget);
|
|
712
|
+
expect(document.querySelectorAll("me-chat")).to.have.length(1);
|
|
713
|
+
expect(orgWidget.myPubnub?.centralConvo).to.equal(true);
|
|
714
|
+
expect(orgWidget.myPubnub?.declaredBuildingId).to.equal(445038);
|
|
715
|
+
expect(initBodies(requests).at(-1)).to.deep.equal({
|
|
716
|
+
building_slug: "",
|
|
717
|
+
org_slug: "test-org",
|
|
718
|
+
central_convo: true,
|
|
719
|
+
});
|
|
720
|
+
} finally {
|
|
721
|
+
await MEChat.remove();
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
|
|
725
|
+
it("clears a Studio site's org scope without an organization", async () => {
|
|
726
|
+
fakeBackend(inRollout);
|
|
727
|
+
MEChat.start({
|
|
728
|
+
studio: { siteId: STUDIO_SITE, mode: "host_managed_context" },
|
|
729
|
+
});
|
|
730
|
+
try {
|
|
731
|
+
MEChat.updateStudioContext({ ...studioOrgContext(null), organization: "" });
|
|
732
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
733
|
+
|
|
734
|
+
expect(document.querySelector("me-chat")).to.equal(null);
|
|
735
|
+
} finally {
|
|
736
|
+
await MEChat.remove();
|
|
737
|
+
}
|
|
738
|
+
});
|