@meetelise/chat 1.59.1 → 1.59.3
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/actions/email-us-window.d.ts +3 -0
- package/dist/src/WebComponent/me-chat.d.ts +7 -0
- package/dist/src/WebComponent/pubnub-chat.d.ts +2 -0
- package/package.json +1 -1
- package/public/dist/index.js +7 -7
- package/src/WebComponent/actions/email-us-window.ts +12 -4
- package/src/WebComponent/me-chat.ts +22 -4
- package/src/WebComponent/pubnub-chat.ts +11 -0
- package/src/brokerReferralSubmission.test.ts +47 -0
- package/src/chatKeyboard.test.ts +132 -2
- package/src/disclaimers.ts +17 -3
|
@@ -54,6 +54,9 @@ export declare class EmailUsWindow extends LitElement {
|
|
|
54
54
|
hasBrokerNameError: boolean;
|
|
55
55
|
brokerEmailError: string | null;
|
|
56
56
|
hasSubmittedForm: boolean;
|
|
57
|
+
/** The backend matched the submitter's own email to a broker the org already has: it made no lead and emailed
|
|
58
|
+
* them their submission link, so the confirmation mustn't promise that the leasing team will be in touch. */
|
|
59
|
+
isKnownBroker: boolean;
|
|
57
60
|
windowHeight: number;
|
|
58
61
|
hasSubmissionError: boolean;
|
|
59
62
|
isSubmitting: boolean;
|
|
@@ -129,6 +129,13 @@ export declare class MEChat extends LitElement {
|
|
|
129
129
|
private attachOnClickToLauncher;
|
|
130
130
|
onExitChat: () => void;
|
|
131
131
|
private focusLauncherButton;
|
|
132
|
+
/**
|
|
133
|
+
* User-initiated open. The caret belongs in the message field.
|
|
134
|
+
* While consent hides the composer, keep focus on the dialog so the agree
|
|
135
|
+
* control is reachable. Stored consent is applied after onMount, so try
|
|
136
|
+
* again once that paint has committed.
|
|
137
|
+
*/
|
|
138
|
+
private focusMessageFieldOnOpen;
|
|
132
139
|
private closeChatAndRestoreFocus;
|
|
133
140
|
private currentLauncherButton;
|
|
134
141
|
render(): TemplateResult;
|
|
@@ -60,6 +60,8 @@ export declare class PubnubChat extends LitElement {
|
|
|
60
60
|
updated(): Promise<void>;
|
|
61
61
|
autoResizeMessageInput: () => void;
|
|
62
62
|
needsConsent: () => boolean;
|
|
63
|
+
/** Caret in the message field when the composer is on screen. */
|
|
64
|
+
focusMessageField(): boolean;
|
|
63
65
|
/** Tab cycles inside the fullscreen mobile dialog. Desktop stays non-modal. */
|
|
64
66
|
private trapTabInMobileDialog;
|
|
65
67
|
render(): TemplateResult;
|
package/package.json
CHANGED
package/public/dist/index.js
CHANGED
|
@@ -838,7 +838,7 @@ var e={2:(e,t,n)=>{var i=n(2199),r=n(4664),o=n(5950);e.exports=function(e){retur
|
|
|
838
838
|
${"textUs"===e||n?H`<p style=${o}>
|
|
839
839
|
Msg freq varies. Text STOP to opt-out of messages. Text HELP for
|
|
840
840
|
assistance.
|
|
841
|
-
</p>`:""}`},Go="currentConsentId",zo=(e,t,n,i,r)=>{const o=Ro(r)?Lo:t,a=e=>{var t;const n=null===(t=e.currentTarget)||void 0===t?void 0:t.getRootNode();if(!(n instanceof ShadowRoot))return;const i=n.host,r=()=>{
|
|
841
|
+
</p>`:""}`},Go="currentConsentId",zo=(e,t,n,i,r)=>{const o=Ro(r)?Lo:t,a=e=>{var t;const n=null===(t=e.currentTarget)||void 0===t?void 0:t.getRootNode();if(!(n instanceof ShadowRoot))return;const i=n.host,r=()=>{if("function"==typeof i.focusMessageField)return void i.focusMessageField();const e=n.getElementById("message-input");e instanceof HTMLElement&&e.getClientRects().length>0&&e.focus()},o=()=>{r(),setTimeout(r,0)};i.updateComplete?i.updateComplete.then(o):o()};return"avb"!==e||localStorage.getItem(null!=n?n:"")?"mill-creek"===e?H`<div class="legal-confirmation-inner-container">
|
|
842
842
|
<div>${Po()}</div>
|
|
843
843
|
<div>
|
|
844
844
|
<span style="font-weight: 600">Confirm to continue</span>
|
|
@@ -2414,7 +2414,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
2414
2414
|
aria-atomic="true"
|
|
2415
2415
|
>
|
|
2416
2416
|
${this._replyAnnouncement}
|
|
2417
|
-
</div>`}async updated(){this.scrollToChatBottom();try{const e=document.getElementById("#healthchat-container");if(!e)return;e.focus()}catch(e){}}trapTabInMobileDialog(e){var t;if(!this._isMobile)return;const n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat-container");n&&Xl(e,n)}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 H``;const S=(null===(e=this.building)||void 0===e?void 0:e.userFirstName)||"Elise",A=null===(t=this.building)||void 0===t?void 0:t.id;let k={};if(k=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===A&&(k={...k,fontFamily:'"Helvetica Neue", Arial'}),this.widgetType===fh.Utilities)return H`
|
|
2417
|
+
</div>`}async updated(){this.scrollToChatBottom();try{const e=document.getElementById("#healthchat-container");if(!e)return;e.focus()}catch(e){}}focusMessageField(){const e=this.shadowRoot,t=null==e?void 0:e.getElementById("message-input");return!!(t instanceof HTMLTextAreaElement&&e)&&(0!==t.getClientRects().length&&(e.activeElement!==t&&t.focus(),e.activeElement===t))}trapTabInMobileDialog(e){var t;if(!this._isMobile)return;const n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat-container");n&&Xl(e,n)}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 H``;const S=(null===(e=this.building)||void 0===e?void 0:e.userFirstName)||"Elise",A=null===(t=this.building)||void 0===t?void 0:t.id;let k={};if(k=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===A&&(k={...k,fontFamily:'"Helvetica Neue", Arial'}),this.widgetType===fh.Utilities)return H`
|
|
2418
2418
|
<div
|
|
2419
2419
|
id="utilities-container"
|
|
2420
2420
|
class=${Ce({"pubnub-container__mobile":this._isMobile,"utilities-container__desktop":!this._isMobile})}
|
|
@@ -4302,7 +4302,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
4302
4302
|
border-radius: 0px 0px 0px 0px;
|
|
4303
4303
|
}
|
|
4304
4304
|
}
|
|
4305
|
-
`,mu([pe({type:String})],bu.prototype,"height",void 0),mu([pe({type:String})],bu.prototype,"width",void 0),mu([pe({type:Boolean})],bu.prototype,"useRoundedBorders",void 0),mu([pe({type:String})],bu.prototype,"headerText",void 0),mu([pe({attribute:!1})],bu.prototype,"onCloseClick",void 0),mu([fe()],bu.prototype,"isMobileSized",void 0),mu([pe({attribute:!0})],bu.prototype,"useGradientDesign",void 0),bu=mu([ce("details-window")],bu);var yu=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 vu=class extends ue{constructor(){super(...arguments),this.trapOverlayTab=e=>{Xl(e,this)},this.movedFocusInside=!1,this.leadSources=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.buildingName="",this.orgLegalName="",this.country=null,this.buildingState=null,this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.featureFlagShowDropdown="",this.brokerIntakeEnabled=!1,this.privatePolicyUrl="https://www.meetelise.com/privacy",this.termsOfServiceUrl="_blank",this.firstName="",this.lastName="",this.email="",this.phoneNumber="",this.phoneNumberE164=null,this.phoneCountry=null,this.message="",this.isBrokerReferral=!1,this.brokerFirstName="",this.brokerLastName="",this.brokerEmail="",this.brokerFirmName="",this.brokerPhone="",this.brokerPhoneE164=null,this.brokerPhoneCountry=null,this.brokerPhoneIsValid=!1,this.hasBrokerPhoneError=!1,this.currentLeadSource="",this.hasNameError=!1,this.hasEmailError=!1,this.hasPhoneNumberError=!1,this.hasMessageError=!1,this.hasBrokerNameError=!1,this.brokerEmailError=null,this.hasSubmittedForm=!1,this.windowHeight=525,this.hasSubmissionError=!1,this.isSubmitting=!1,this.onChangeFirstName=e=>{e.target&&(this.firstName=e.target.value)},this.onChangeLastName=e=>{e.target&&(this.lastName=e.target.value)},this.onChangeEmail=e=>{e.target&&(this.email=e.target.value)},this.onChangePhoneNumber=e=>{this.phoneNumber=e.detail.formattedValue,this.phoneNumberE164=e.detail.e164,this.phoneCountry=e.detail.country},this.onChangeBrokerPhone=e=>{this.brokerPhone=e.detail.formattedValue,this.brokerPhoneE164=e.detail.e164,this.brokerPhoneCountry=e.detail.country,this.brokerPhoneIsValid=e.detail.isValid},this.onChangeMessage=e=>{e.target&&(this.message=e.target.value)},this.onToggleBrokerReferral=e=>{const t=e.target.checked,n=!(this.brokerFirstName||this.brokerLastName||this.brokerEmail||this.brokerPhone);t&&n?(this.brokerFirstName=this.firstName,this.brokerLastName=this.lastName,this.brokerEmail=this.email,this.brokerPhone=this.phoneNumber,this.brokerPhoneE164=this.phoneNumberE164,this.brokerPhoneCountry=this.phoneCountry,this.brokerPhoneIsValid=!!this.phoneNumberE164,this.firstName="",this.lastName="",this.email="",this.phoneNumber="",this.phoneNumberE164=null):t||this.firstName||this.lastName||this.email||this.phoneNumber||(this.firstName=this.brokerFirstName,this.lastName=this.brokerLastName,this.email=this.brokerEmail,this.phoneNumber=this.brokerPhone,this.phoneNumberE164=this.brokerPhoneE164,this.phoneCountry=this.brokerPhoneCountry,this.brokerFirstName="",this.brokerLastName="",this.brokerEmail="",this.brokerPhone="",this.brokerPhoneE164=null,this.brokerPhoneIsValid=!1),this.isBrokerReferral=t,this.hasNameError=!1,this.hasEmailError=!1,this.hasPhoneNumberError=!1,this.hasBrokerNameError=!1,this.brokerEmailError=null,this.hasBrokerPhoneError=!1,this.windowHeight=this.baseHeight()+30*this.getNumErrors()},this.onChangeBrokerField=e=>t=>{t.target&&(this[e]=t.target.value)},this.baseHeight=()=>525+(this.brokerIntakeEnabled&&this.isBrokerReferral?143:0),this.brokerReferral=()=>{var e;return this.brokerIntakeEnabled&&this.isBrokerReferral?Yo(this.brokerFirstName,this.brokerLastName,this.brokerEmail,this.brokerFirmName,null!==(e=this.brokerPhoneE164)&&void 0!==e?e:""):null},this.validateFormFields=()=>{this.hasNameError=!1,this.hasEmailError=!1,this.hasPhoneNumberError=!1,this.hasMessageError=!1,this.hasSubmissionError=!1,this.hasBrokerNameError=!1,this.brokerEmailError=null,this.hasBrokerPhoneError=!1;const e=this.brokerReferral();e&&(this.hasBrokerNameError=Ko(e),this.brokerEmailError=Xo(e,this.email),this.hasBrokerPhoneError=!!this.brokerPhone&&!this.brokerPhoneIsValid),this.firstName&&this.lastName||(this.hasNameError=!0),this.email&&Lr(this.email)||(this.hasEmailError=!0),this.phoneNumberE164||(this.hasPhoneNumberError=!0),this.windowHeight=this.baseHeight()+30*this.getNumErrors()},this.onClick=async()=>{var e,t,n,i,r,o;if(this.isSubmitting)return;if(this.validateFormFields(),this.hasNameError||this.hasEmailError||this.hasPhoneNumberError||this.hasMessageError||this.hasBrokerNameError||this.brokerEmailError||this.hasBrokerPhoneError)return;const a=this.phoneNumberE164;if(a)try{this.isSubmitting=!0,this.windowHeight=this.baseHeight()+60;const s=this.selectedLeadSource&&this.selectedLeadSource.value?this.selectedLeadSource.value:this.currentLeadSource
|
|
4305
|
+
`,mu([pe({type:String})],bu.prototype,"height",void 0),mu([pe({type:String})],bu.prototype,"width",void 0),mu([pe({type:Boolean})],bu.prototype,"useRoundedBorders",void 0),mu([pe({type:String})],bu.prototype,"headerText",void 0),mu([pe({attribute:!1})],bu.prototype,"onCloseClick",void 0),mu([fe()],bu.prototype,"isMobileSized",void 0),mu([pe({attribute:!0})],bu.prototype,"useGradientDesign",void 0),bu=mu([ce("details-window")],bu);var yu=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 vu=class extends ue{constructor(){super(...arguments),this.trapOverlayTab=e=>{Xl(e,this)},this.movedFocusInside=!1,this.leadSources=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.buildingName="",this.orgLegalName="",this.country=null,this.buildingState=null,this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.featureFlagShowDropdown="",this.brokerIntakeEnabled=!1,this.privatePolicyUrl="https://www.meetelise.com/privacy",this.termsOfServiceUrl="_blank",this.firstName="",this.lastName="",this.email="",this.phoneNumber="",this.phoneNumberE164=null,this.phoneCountry=null,this.message="",this.isBrokerReferral=!1,this.brokerFirstName="",this.brokerLastName="",this.brokerEmail="",this.brokerFirmName="",this.brokerPhone="",this.brokerPhoneE164=null,this.brokerPhoneCountry=null,this.brokerPhoneIsValid=!1,this.hasBrokerPhoneError=!1,this.currentLeadSource="",this.hasNameError=!1,this.hasEmailError=!1,this.hasPhoneNumberError=!1,this.hasMessageError=!1,this.hasBrokerNameError=!1,this.brokerEmailError=null,this.hasSubmittedForm=!1,this.isKnownBroker=!1,this.windowHeight=525,this.hasSubmissionError=!1,this.isSubmitting=!1,this.onChangeFirstName=e=>{e.target&&(this.firstName=e.target.value)},this.onChangeLastName=e=>{e.target&&(this.lastName=e.target.value)},this.onChangeEmail=e=>{e.target&&(this.email=e.target.value)},this.onChangePhoneNumber=e=>{this.phoneNumber=e.detail.formattedValue,this.phoneNumberE164=e.detail.e164,this.phoneCountry=e.detail.country},this.onChangeBrokerPhone=e=>{this.brokerPhone=e.detail.formattedValue,this.brokerPhoneE164=e.detail.e164,this.brokerPhoneCountry=e.detail.country,this.brokerPhoneIsValid=e.detail.isValid},this.onChangeMessage=e=>{e.target&&(this.message=e.target.value)},this.onToggleBrokerReferral=e=>{const t=e.target.checked,n=!(this.brokerFirstName||this.brokerLastName||this.brokerEmail||this.brokerPhone);t&&n?(this.brokerFirstName=this.firstName,this.brokerLastName=this.lastName,this.brokerEmail=this.email,this.brokerPhone=this.phoneNumber,this.brokerPhoneE164=this.phoneNumberE164,this.brokerPhoneCountry=this.phoneCountry,this.brokerPhoneIsValid=!!this.phoneNumberE164,this.firstName="",this.lastName="",this.email="",this.phoneNumber="",this.phoneNumberE164=null):t||this.firstName||this.lastName||this.email||this.phoneNumber||(this.firstName=this.brokerFirstName,this.lastName=this.brokerLastName,this.email=this.brokerEmail,this.phoneNumber=this.brokerPhone,this.phoneNumberE164=this.brokerPhoneE164,this.phoneCountry=this.brokerPhoneCountry,this.brokerFirstName="",this.brokerLastName="",this.brokerEmail="",this.brokerPhone="",this.brokerPhoneE164=null,this.brokerPhoneIsValid=!1),this.isBrokerReferral=t,this.hasNameError=!1,this.hasEmailError=!1,this.hasPhoneNumberError=!1,this.hasBrokerNameError=!1,this.brokerEmailError=null,this.hasBrokerPhoneError=!1,this.windowHeight=this.baseHeight()+30*this.getNumErrors()},this.onChangeBrokerField=e=>t=>{t.target&&(this[e]=t.target.value)},this.baseHeight=()=>525+(this.brokerIntakeEnabled&&this.isBrokerReferral?143:0),this.brokerReferral=()=>{var e;return this.brokerIntakeEnabled&&this.isBrokerReferral?Yo(this.brokerFirstName,this.brokerLastName,this.brokerEmail,this.brokerFirmName,null!==(e=this.brokerPhoneE164)&&void 0!==e?e:""):null},this.validateFormFields=()=>{this.hasNameError=!1,this.hasEmailError=!1,this.hasPhoneNumberError=!1,this.hasMessageError=!1,this.hasSubmissionError=!1,this.hasBrokerNameError=!1,this.brokerEmailError=null,this.hasBrokerPhoneError=!1;const e=this.brokerReferral();e&&(this.hasBrokerNameError=Ko(e),this.brokerEmailError=Xo(e,this.email),this.hasBrokerPhoneError=!!this.brokerPhone&&!this.brokerPhoneIsValid),this.firstName&&this.lastName||(this.hasNameError=!0),this.email&&Lr(this.email)||(this.hasEmailError=!0),this.phoneNumberE164||(this.hasPhoneNumberError=!0),this.windowHeight=this.baseHeight()+30*this.getNumErrors()},this.onClick=async()=>{var e,t,n,i,r,o;if(this.isSubmitting)return;if(this.validateFormFields(),this.hasNameError||this.hasEmailError||this.hasPhoneNumberError||this.hasMessageError||this.hasBrokerNameError||this.brokerEmailError||this.hasBrokerPhoneError)return;const a=this.phoneNumberE164;if(a)try{this.isSubmitting=!0,this.windowHeight=this.baseHeight()+60;const s=this.selectedLeadSource&&this.selectedLeadSource.value?this.selectedLeadSource.value:this.currentLeadSource,{knownBroker:l}=await wu(this.firstName,this.lastName,this.email,a,this.message,this.buildingId,this.orgSlug,this.buildingSlug,[...new Set(s?[s,aa(this.orgSlug)]:[aa(this.orgSlug)])],null===(e=this.leadSourceClient)||void 0===e?void 0:e.chatId,null===(t=this.leadSourceMultitouchClient)||void 0===t?void 0:t.getSafeLeadSourceTouchpointsWithDefault({includedUserSelectedLeadSource:(null===(n=this.selectedLeadSource)||void 0===n?void 0:n.value)&&this.selectedLeadSource.value.length>0?this.selectedLeadSource.value:null}),this.brokerReferral());null===(i=this.leadSourceClient)||void 0===i||i.checkAndHandleForLogLeadSource({webchatAction:"email-us",stateId:null}),null===(r=this.leadSourceClient)||void 0===r||r.resetLeadSource(),null===(o=this.leadSourceMultitouchClient)||void 0===o||o.resetLeadSourceTouchpoints(),this.isKnownBroker=l,this.hasSubmittedForm=!0,this.isSubmitting=!1,this.windowHeight=this.baseHeight()}catch(e){this.hasSubmissionError=!0,this.isSubmitting=!1,this.windowHeight=this.baseHeight()}else this.hasPhoneNumberError=!0},this.getNumErrors=()=>[this.hasNameError,this.hasEmailError,this.hasPhoneNumberError,this.hasMessageError,this.hasSubmissionError,this.hasBrokerNameError,!!this.brokerEmailError,this.hasBrokerPhoneError].filter(e=>e).length,this.renderBrokerToggle=()=>H`
|
|
4306
4306
|
<label class="email-us__broker-toggle">
|
|
4307
4307
|
<span>Are you a broker or locator?</span>
|
|
4308
4308
|
<input
|
|
@@ -4402,7 +4402,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
4402
4402
|
</div>
|
|
4403
4403
|
<div class="email-us__vertical-spacer"></div>
|
|
4404
4404
|
<div class="email-us__submitted-info">
|
|
4405
|
-
${this.isBrokerReferral?"Thank you for the referral. A member of our leasing team will contact your client.":"Thank you for your message. A member of our leasing team will contact you."}
|
|
4405
|
+
${this.isKnownBroker?"It looks like you're a broker or locator. We've emailed you a link where you can submit your client.":this.isBrokerReferral?"Thank you for the referral. A member of our leasing team will contact your client.":"Thank you for your message. A member of our leasing team will contact you."}
|
|
4406
4406
|
</div>
|
|
4407
4407
|
</div>
|
|
4408
4408
|
</details-window>
|
|
@@ -4641,7 +4641,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
4641
4641
|
width: 50%;
|
|
4642
4642
|
}
|
|
4643
4643
|
}
|
|
4644
|
-
`,Me],yu([pe({attribute:!1})],vu.prototype,"leadSources",void 0),yu([pe({attribute:!1})],vu.prototype,"onCloseClicked",void 0),yu([pe({attribute:!0})],vu.prototype,"chatId",void 0),yu([pe({attribute:!1})],vu.prototype,"buildingId",void 0),yu([pe({attribute:!0})],vu.prototype,"buildingSlug",void 0),yu([pe({attribute:!0})],vu.prototype,"orgSlug",void 0),yu([pe({attribute:!0})],vu.prototype,"buildingName",void 0),yu([pe({attribute:!0})],vu.prototype,"orgLegalName",void 0),yu([pe({attribute:!1})],vu.prototype,"country",void 0),yu([pe({attribute:!1})],vu.prototype,"buildingState",void 0),yu([pe({attribute:!0})],vu.prototype,"leadSourceClient",void 0),yu([pe({attribute:!0})],vu.prototype,"leadSourceMultitouchClient",void 0),yu([pe({attribute:!0})],vu.prototype,"featureFlagShowDropdown",void 0),yu([pe({attribute:!1})],vu.prototype,"brokerIntakeEnabled",void 0),yu([pe()],vu.prototype,"privatePolicyUrl",void 0),yu([pe()],vu.prototype,"termsOfServiceUrl",void 0),yu([fe()],vu.prototype,"firstName",void 0),yu([fe()],vu.prototype,"lastName",void 0),yu([fe()],vu.prototype,"email",void 0),yu([fe()],vu.prototype,"phoneNumber",void 0),yu([fe()],vu.prototype,"phoneNumberE164",void 0),yu([fe()],vu.prototype,"phoneCountry",void 0),yu([fe()],vu.prototype,"message",void 0),yu([fe()],vu.prototype,"isBrokerReferral",void 0),yu([fe()],vu.prototype,"brokerFirstName",void 0),yu([fe()],vu.prototype,"brokerLastName",void 0),yu([fe()],vu.prototype,"brokerEmail",void 0),yu([fe()],vu.prototype,"brokerFirmName",void 0),yu([fe()],vu.prototype,"brokerPhone",void 0),yu([fe()],vu.prototype,"brokerPhoneE164",void 0),yu([fe()],vu.prototype,"brokerPhoneCountry",void 0),yu([fe()],vu.prototype,"brokerPhoneIsValid",void 0),yu([fe()],vu.prototype,"hasBrokerPhoneError",void 0),yu([ge("me-select#leadSource")],vu.prototype,"selectedLeadSource",void 0),yu([pe({attribute:!0})],vu.prototype,"currentLeadSource",void 0),yu([fe()],vu.prototype,"hasNameError",void 0),yu([fe()],vu.prototype,"hasEmailError",void 0),yu([fe()],vu.prototype,"hasPhoneNumberError",void 0),yu([fe()],vu.prototype,"hasMessageError",void 0),yu([fe()],vu.prototype,"hasBrokerNameError",void 0),yu([fe()],vu.prototype,"brokerEmailError",void 0),yu([fe()],vu.prototype,"hasSubmittedForm",void 0),yu([fe()],vu.prototype,"windowHeight",void 0),yu([fe()],vu.prototype,"hasSubmissionError",void 0),yu([fe()],vu.prototype,"isSubmitting",void 0),vu=yu([ce("email-us-window")],vu);const wu=async(e,t,n,i,o,a,s,u,d,c,h,p)=>{const
|
|
4644
|
+
`,Me],yu([pe({attribute:!1})],vu.prototype,"leadSources",void 0),yu([pe({attribute:!1})],vu.prototype,"onCloseClicked",void 0),yu([pe({attribute:!0})],vu.prototype,"chatId",void 0),yu([pe({attribute:!1})],vu.prototype,"buildingId",void 0),yu([pe({attribute:!0})],vu.prototype,"buildingSlug",void 0),yu([pe({attribute:!0})],vu.prototype,"orgSlug",void 0),yu([pe({attribute:!0})],vu.prototype,"buildingName",void 0),yu([pe({attribute:!0})],vu.prototype,"orgLegalName",void 0),yu([pe({attribute:!1})],vu.prototype,"country",void 0),yu([pe({attribute:!1})],vu.prototype,"buildingState",void 0),yu([pe({attribute:!0})],vu.prototype,"leadSourceClient",void 0),yu([pe({attribute:!0})],vu.prototype,"leadSourceMultitouchClient",void 0),yu([pe({attribute:!0})],vu.prototype,"featureFlagShowDropdown",void 0),yu([pe({attribute:!1})],vu.prototype,"brokerIntakeEnabled",void 0),yu([pe()],vu.prototype,"privatePolicyUrl",void 0),yu([pe()],vu.prototype,"termsOfServiceUrl",void 0),yu([fe()],vu.prototype,"firstName",void 0),yu([fe()],vu.prototype,"lastName",void 0),yu([fe()],vu.prototype,"email",void 0),yu([fe()],vu.prototype,"phoneNumber",void 0),yu([fe()],vu.prototype,"phoneNumberE164",void 0),yu([fe()],vu.prototype,"phoneCountry",void 0),yu([fe()],vu.prototype,"message",void 0),yu([fe()],vu.prototype,"isBrokerReferral",void 0),yu([fe()],vu.prototype,"brokerFirstName",void 0),yu([fe()],vu.prototype,"brokerLastName",void 0),yu([fe()],vu.prototype,"brokerEmail",void 0),yu([fe()],vu.prototype,"brokerFirmName",void 0),yu([fe()],vu.prototype,"brokerPhone",void 0),yu([fe()],vu.prototype,"brokerPhoneE164",void 0),yu([fe()],vu.prototype,"brokerPhoneCountry",void 0),yu([fe()],vu.prototype,"brokerPhoneIsValid",void 0),yu([fe()],vu.prototype,"hasBrokerPhoneError",void 0),yu([ge("me-select#leadSource")],vu.prototype,"selectedLeadSource",void 0),yu([pe({attribute:!0})],vu.prototype,"currentLeadSource",void 0),yu([fe()],vu.prototype,"hasNameError",void 0),yu([fe()],vu.prototype,"hasEmailError",void 0),yu([fe()],vu.prototype,"hasPhoneNumberError",void 0),yu([fe()],vu.prototype,"hasMessageError",void 0),yu([fe()],vu.prototype,"hasBrokerNameError",void 0),yu([fe()],vu.prototype,"brokerEmailError",void 0),yu([fe()],vu.prototype,"hasSubmittedForm",void 0),yu([fe()],vu.prototype,"isKnownBroker",void 0),yu([fe()],vu.prototype,"windowHeight",void 0),yu([fe()],vu.prototype,"hasSubmissionError",void 0),yu([fe()],vu.prototype,"isSubmitting",void 0),vu=yu([ce("email-us-window")],vu);const wu=async(e,t,n,i,o,a,s,u,d,c,h,p)=>{var f;const g=new URLSearchParams(window.location.search),m={email_address:n,building_id:a,lead_sources:d,first_message:o,first_name:e,last_name:t,phone_number:i,referrer:document.referrer,query_params:Object.fromEntries(g.entries()),conversation_tracking_id:c,tracking_params:l(s),lead_sources_with_timestamps:(null!=h?h:[]).map(e=>_r({...e})),...Zo(p)};Eo("emailUsSubmitted",{firstName:e,lastName:t,email:n,phone:i,message:o,originatingSource:d.find(e=>"property-website"!==e)||null,conversationTrackingId:null!=c?c:null,...p?{isBrokerReferral:!0}:{}});return{knownBroker:!0===(null===(f=(await r().post("https://app.meetelise.com/platformApi/state/create/emailMe",m,{headers:{"building-slug":u,"org-slug":s,"X-SecurityKey":"webchatkey-wkjcWAKZjqhLStvP8L6SN8y4FbYmPhdE"}})).data)||void 0===f?void 0:f.known_broker)}},Cu=(e="white")=>G`<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" width="14" height="17" viewBox="0 0 14 17" fill="none">
|
|
4645
4645
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.95487 2.54301e-07H7.04513C8.51534 -1.22821e-05 9.67985 -2.22686e-05 10.5912 0.121084C11.5292 0.24572 12.2883 0.508324 12.887 1.10005C13.4857 1.69178 13.7514 2.44211 13.8775 3.36914C14 4.26992 14 5.42089 14 6.874V10.126C14 11.5791 14 12.7301 13.8775 13.6309C13.7514 14.5579 13.4857 15.3082 12.887 15.8999C12.2883 16.4917 11.5292 16.7543 10.5912 16.8789C9.67985 17 8.51534 17 7.04513 17H6.95487C5.48466 17 4.32015 17 3.40878 16.8789C2.47084 16.7543 1.71169 16.4917 1.11299 15.8999C0.514304 15.3082 0.248611 14.5579 0.122508 13.6309C-2.25306e-05 12.7301 -1.24266e-05 11.5791 2.57292e-07 10.126V6.87399C-1.24266e-05 5.42088 -2.25306e-05 4.26992 0.122508 3.36914C0.248611 2.44211 0.514304 1.69178 1.11299 1.10005C1.71169 0.508324 2.47084 0.24572 3.40878 0.121084C4.32015 -2.22686e-05 5.48466 -1.22821e-05 6.95487 2.54301e-07ZM2.85118 1.44157C2.45996 1.55714 2.18378 1.71904 1.96152 1.93871C1.62295 2.27335 1.42002 2.73167 1.31181 3.52718C1.20127 4.33975 1.2 5.41089 1.2 6.9186V10.0814C1.2 11.5891 1.20127 12.6602 1.31181 13.4728C1.42002 14.2683 1.62295 14.7267 1.96152 15.0613C2.30009 15.3959 2.76381 15.5965 3.56868 15.7034C4.39081 15.8127 5.47454 15.814 7 15.814C8.52546 15.814 9.60919 15.8127 10.4313 15.7034C11.2362 15.5965 11.6999 15.3959 12.0385 15.0613C12.377 14.7267 12.58 14.2683 12.6882 13.4728C12.7987 12.6602 12.8 11.5891 12.8 10.0814V6.9186C12.8 5.41089 12.7987 4.33975 12.6882 3.52718C12.58 2.73167 12.377 2.27335 12.0385 1.93871C11.8162 1.71905 11.54 1.55714 11.1488 1.44157C10.6194 2.22728 10.2493 2.77349 9.69896 3.1115C9.58916 3.17894 9.47507 3.23928 9.3574 3.29217C8.76366 3.55903 8.09363 3.55868 7.12834 3.55818C7.08613 3.55816 7.04336 3.55814 7 3.55814C6.95664 3.55814 6.91387 3.55816 6.87166 3.55818C5.90637 3.55868 5.23634 3.55903 4.6426 3.29217C4.52493 3.23928 4.41084 3.17894 4.30104 3.1115C3.75069 2.77349 3.38057 2.22729 2.85118 1.44157ZM4.16103 1.2383C4.51629 1.74715 4.70232 1.96157 4.9344 2.10411C5.00028 2.14457 5.06873 2.18078 5.13933 2.21251C5.46646 2.35954 5.85406 2.37209 7 2.37209C8.14594 2.37209 8.53354 2.35954 8.86066 2.21251C8.93127 2.18078 8.99972 2.14457 9.0656 2.10411C9.29768 1.96157 9.48371 1.74715 9.83897 1.2383C9.10278 1.18681 8.18457 1.18605 7 1.18605C5.81543 1.18605 4.89722 1.18681 4.16103 1.2383ZM4 14.0349C4 13.7074 4.26863 13.4419 4.6 13.4419H9.4C9.73137 13.4419 10 13.7074 10 14.0349C10 14.3624 9.73137 14.6279 9.4 14.6279H4.6C4.26863 14.6279 4 14.3624 4 14.0349Z" fill="${e}"/>
|
|
4646
4646
|
</svg>`,xu={},$u=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],Su=async e=>{const t=await(async e=>{if(xu[e])return xu[e];const t=`https://app.meetelise.com/platformApi/connectors/talk_js/leasing_office_hours/${e}`,n=await r().get(t);return xu[e]=n.data,n.data})(e);return $u.map(e=>{const n=t[e];return n?{dayOfWeek:e,startTime:n.start,endTime:n.end}:e})};var Au=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 ku=class extends ue{constructor(){super(...arguments),this.trapOverlayTab=e=>{Xl(e,this)},this.movedFocusInside=!1,this.buildingSlug="",this.orgSlug="",this.phoneNumberToCall="",this.phoneNumberToText="",this.buildingId=0,this.buildingName="",this.chatCallUsHeader="",this.hasCallUsEnabled="",this.hasTextUsEnabled="",this.currentLeadSource="",this.orgLegalName="",this.country=null,this.buildingState=null,this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.phoneNumberInputRef=Oe(),this.hasSubmittedForm=!1,this.hasPhoneNumberError=!1,this.hasSubmissionError=!1,this.submittingTextUsOption=!1,this.officeHoursTextInfo=[],this.firstUpdated=async()=>{this.buildingId&&this.hasCallUsEnabled&&(this.officeHoursTextInfo=await Su(this.buildingId))},this.getCallLink=e=>{const t=(e.match(/\d+/g)||[]).join(""),n=t.length<11?`1${t}`:t,i=`+${n[0]}-${n.slice(1,4)}-${n.slice(4,7)}-${n.slice(7)}`;return H`<a href="tel:${i}"
|
|
4647
4647
|
>${e}</a
|
|
@@ -7663,7 +7663,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
7663
7663
|
cursor: pointer;
|
|
7664
7664
|
filter: brightness(90%);
|
|
7665
7665
|
}
|
|
7666
|
-
`],Uc([pe({attribute:!0})],Bc.prototype,"onClick",void 0),Uc([pe({attribute:!0})],Bc.prototype,"primaryColor",void 0),Uc([pe({attribute:!0})],Bc.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Uc([pe({attribute:!0})],Bc.prototype,"toExpand",void 0),Bc=Uc([ce("minimize-expand-button")],Bc);const jc="cdn.skypack.dev/@meetelise/chat",Fc="cdn.eliseai.com/@meetelise/chat",Hc=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(jc)||n.includes(jc))return"skypack";if(e.includes(Fc)||n.includes(Fc))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){}},Gc=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?t.endsWith("/units")?t:`${t}/units`:t,zc={"95ae958e-95db-11ed-9862-6f4db5533d3f":"8008db60-45b7-11f1-88ac-635f686365da","95ae96b0-95db-11ed-9863-a7aa664fd985":"72ed27c4-45b7-11f1-82d9-37b7db547687"},Qc="https://applications.eliseai.com",Wc=["Check Availability","Apply Now"],Vc=(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&&Wc.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"),na({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:ta.info,buildingSlug:i,orgSlug:n}),!0},qc=(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&&Vc(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)Vc(s[e],t,n,i)}},Yc=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)Vc(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)qc(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class Kc{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>Fr(Gr(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=xo();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(ea()).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:Fr(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:Fr(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));na({logType:ta.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=aa(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:Fr(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:Fr(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Yr(e.timestampInitiallyLogged).getTime()-Yr(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:Fr(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:Fr(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=>Yr(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var Xc=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 Zc=class extends ue{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=Ir(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=bo.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.launcherButton=null,this.focusChatOnMount=!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=fh.Default,this.onWidgetLoaded=uc(),this.onSstClose=uc(),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=Oe(),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 fa(n.data)}(this.orgSlug):await pa(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{Hc(this.orgSlug,this.buildingSlug)}catch(e){}}if(!await du(n,this.buildingSlug,this.orgSlug))return;ia({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(gs);return sessionStorage.removeItem(gs),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(Ka,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.rememberChatAutoOpenDismissed()):"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&&eh(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=So.includes(Z.orgId),ko=ie;const[re,oe,ae,se,le]=await Promise.all([this.isOrgMode()?Promise.resolve([]):Pc(this.orgSlug,this.buildingSlug),yo(this.buildingSlug),Nc(this.buildingSlug),wo(this.buildingSlug),Co(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Vn(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 na({logType:ta.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(mc(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?(Rc(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===ua.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===ua.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===ua.EMOJI&&(this.designConcept=ua.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Zn),null===this.backgroundColor&&(this.backgroundColor=Jn);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:Vn(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=Lc(me.number,this.orgSlug,this.buildingSlug);e>0&&ia({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&&Lc(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()||ao(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=Gc(o,e);l.setAttribute("href",s),a++,na({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:ta.info,buildingSlug:n,orgSlug:t})}}return 0===a&&na({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:ta.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}/units`,this.orgSlug,this.buildingSlug);e>0&&ia({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=zc[e];if(!t)return 0;const n=`${Qc}/building/${t}/units`,i=`${Qc}/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&&Yc(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=hs(d),h=ps(d,c),p=h?c:cs(d,!1);if(!p.leadId)throw new Error("Lead ID is null");if(this.LeadSourceClient=new sa,this.LeadSourceClient.orgId=null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.orgId)&&void 0!==t?t:0,this.LeadSourceMultitouchClient=new Kc(this.orgSlug,this.buildingSlug),this.myPubnub=new Ss(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&&(cs(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"!==aa(this.orgSlug)?this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:aa(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=hs(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 pa(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 pa(this.orgSlug,this.declaredBuildingSlug);return"number"==typeof(null==e?void 0:e.id)&&e.id>0?e.id:null}catch{return null}},this.chatAutoOpenDismissedStorageKey=()=>{const{orgSlug:e,buildingSlug:t}=this;return e&&t?`com.elise.webchat.autoOpenDismissed=${e}=${t}`:t?`com.elise.webchat.autoOpenDismissed=${t}`:e?`com.elise.webchat.autoOpenDismissed=${e}`:null},this.shouldAutoOpenChat=e=>{if(!e||Ir())return!1;const t=this.chatAutoOpenDismissedStorageKey();return!t||"true"!==localStorage.getItem(t)},this.rememberChatAutoOpenDismissed=()=>{const e=this.chatAutoOpenDismissedStorageKey();e&&localStorage.setItem(e,"true")},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.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.focusChatOnMount=!0,this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false"),this.rememberChatAutoOpenDismissed()},this.focusLauncherButton=()=>{var e,t;const n=(null===(e=this.launcherButton)||void 0===e?void 0:e.isConnected)?this.launcherButton:null;null===(t=null!=n?n:this.currentLauncherButton())||void 0===t||t.focus()},this.closeChatAndRestoreFocus=()=>{this.onExitChat(),this.updateComplete.then(()=>{this.focusLauncherButton(),requestAnimationFrame(()=>this.focusLauncherButton())})}}setDeclaredBuildingId(e){this.hostDeclaredBuildingId=e,this.myPubnub&&(this.myPubnub.declaredBuildingId=e)}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new Jo(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(),ds(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),this._cleanupMobileListener=Nr(e=>{this._isMobile=e})}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e,t;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),null===(t=this._cleanupMobileListener)||void 0===t||t.call(this),super.disconnectedCallback()}currentLauncherButton(){var e,t,n,i;const r=null===(t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("meetelise-launcher"))||void 0===t?void 0:t.shadowRoot,o=null==r?void 0:r.querySelector("#type-hey__ask-prompt, button[aria-label='Chat with us']"),a=null===(i=null===(n=null==r?void 0:r.querySelector("mobile-launcher"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.querySelector("button[aria-label='Chat with us']");return o instanceof HTMLElement?o:a instanceof HTMLElement?a:null}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,U,B,j,F,G,z,Q,W,V;pc();const q=this.hideLauncher&&!this.isLoading&&!this._isMobile;return H`
|
|
7666
|
+
`],Uc([pe({attribute:!0})],Bc.prototype,"onClick",void 0),Uc([pe({attribute:!0})],Bc.prototype,"primaryColor",void 0),Uc([pe({attribute:!0})],Bc.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Uc([pe({attribute:!0})],Bc.prototype,"toExpand",void 0),Bc=Uc([ce("minimize-expand-button")],Bc);const jc="cdn.skypack.dev/@meetelise/chat",Fc="cdn.eliseai.com/@meetelise/chat",Hc=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(jc)||n.includes(jc))return"skypack";if(e.includes(Fc)||n.includes(Fc))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){}},Gc=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?t.endsWith("/units")?t:`${t}/units`:t,zc={"95ae958e-95db-11ed-9862-6f4db5533d3f":"8008db60-45b7-11f1-88ac-635f686365da","95ae96b0-95db-11ed-9863-a7aa664fd985":"72ed27c4-45b7-11f1-82d9-37b7db547687"},Qc="https://applications.eliseai.com",Wc=["Check Availability","Apply Now"],Vc=(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&&Wc.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"),na({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:ta.info,buildingSlug:i,orgSlug:n}),!0},qc=(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&&Vc(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)Vc(s[e],t,n,i)}},Yc=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)Vc(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)qc(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class Kc{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>Fr(Gr(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=xo();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(ea()).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:Fr(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:Fr(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));na({logType:ta.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=aa(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:Fr(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:Fr(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>Yr(e.timestampInitiallyLogged).getTime()-Yr(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:Fr(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:Fr(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=>Yr(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var Xc=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 Zc=class extends ue{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=Ir(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=bo.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.launcherButton=null,this.focusChatOnMount=!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=fh.Default,this.onWidgetLoaded=uc(),this.onSstClose=uc(),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=Oe(),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 fa(n.data)}(this.orgSlug):await pa(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{Hc(this.orgSlug,this.buildingSlug)}catch(e){}}if(!await du(n,this.buildingSlug,this.orgSlug))return;ia({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(gs);return sessionStorage.removeItem(gs),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(Ka,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.rememberChatAutoOpenDismissed()):"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&&eh(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=So.includes(Z.orgId),ko=ie;const[re,oe,ae,se,le]=await Promise.all([this.isOrgMode()?Promise.resolve([]):Pc(this.orgSlug,this.buildingSlug),yo(this.buildingSlug),Nc(this.buildingSlug),wo(this.buildingSlug),Co(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Vn(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 na({logType:ta.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(mc(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?(Rc(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===ua.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===ua.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===ua.EMOJI&&(this.designConcept=ua.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Zn),null===this.backgroundColor&&(this.backgroundColor=Jn);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:Vn(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=Lc(me.number,this.orgSlug,this.buildingSlug);e>0&&ia({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&&Lc(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()||ao(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=Gc(o,e);l.setAttribute("href",s),a++,na({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:ta.info,buildingSlug:n,orgSlug:t})}}return 0===a&&na({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:ta.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}/units`,this.orgSlug,this.buildingSlug);e>0&&ia({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=zc[e];if(!t)return 0;const n=`${Qc}/building/${t}/units`,i=`${Qc}/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&&Yc(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=hs(d),h=ps(d,c),p=h?c:cs(d,!1);if(!p.leadId)throw new Error("Lead ID is null");if(this.LeadSourceClient=new sa,this.LeadSourceClient.orgId=null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.orgId)&&void 0!==t?t:0,this.LeadSourceMultitouchClient=new Kc(this.orgSlug,this.buildingSlug),this.myPubnub=new Ss(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&&(cs(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"!==aa(this.orgSlug)?this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:aa(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=hs(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 pa(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 pa(this.orgSlug,this.declaredBuildingSlug);return"number"==typeof(null==e?void 0:e.id)&&e.id>0?e.id:null}catch{return null}},this.chatAutoOpenDismissedStorageKey=()=>{const{orgSlug:e,buildingSlug:t}=this;return e&&t?`com.elise.webchat.autoOpenDismissed=${e}=${t}`:t?`com.elise.webchat.autoOpenDismissed=${t}`:e?`com.elise.webchat.autoOpenDismissed=${e}`:null},this.shouldAutoOpenChat=e=>{if(!e||Ir())return!1;const t=this.chatAutoOpenDismissedStorageKey();return!t||"true"!==localStorage.getItem(t)},this.rememberChatAutoOpenDismissed=()=>{const e=this.chatAutoOpenDismissedStorageKey();e&&localStorage.setItem(e,"true")},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.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.focusChatOnMount=!0,this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false"),this.rememberChatAutoOpenDismissed()},this.focusLauncherButton=()=>{var e,t;const n=(null===(e=this.launcherButton)||void 0===e?void 0:e.isConnected)?this.launcherButton:null;null===(t=null!=n?n:this.currentLauncherButton())||void 0===t||t.focus()},this.focusMessageFieldOnOpen=()=>{var e,t;const n=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("pubnub-chat"),i=null==n?void 0:n.shadowRoot;n&&i&&(n.focusMessageField()||null===(t=i.getElementById("pubnub-chat-container"))||void 0===t||t.focus(),setTimeout(()=>{n.focusMessageField()},0))},this.closeChatAndRestoreFocus=()=>{this.onExitChat(),this.updateComplete.then(()=>{this.focusLauncherButton(),requestAnimationFrame(()=>this.focusLauncherButton())})}}setDeclaredBuildingId(e){this.hostDeclaredBuildingId=e,this.myPubnub&&(this.myPubnub.declaredBuildingId=e)}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new Jo(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(),ds(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),this._cleanupMobileListener=Nr(e=>{this._isMobile=e})}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e,t;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),null===(t=this._cleanupMobileListener)||void 0===t||t.call(this),super.disconnectedCallback()}currentLauncherButton(){var e,t,n,i;const r=null===(t=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("meetelise-launcher"))||void 0===t?void 0:t.shadowRoot,o=null==r?void 0:r.querySelector("#type-hey__ask-prompt, button[aria-label='Chat with us']"),a=null===(i=null===(n=null==r?void 0:r.querySelector("mobile-launcher"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.querySelector("button[aria-label='Chat with us']");return o instanceof HTMLElement?o:a instanceof HTMLElement?a:null}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,U,B,j,F,G,z,Q,W,V;pc();const q=this.hideLauncher&&!this.isLoading&&!this._isMobile;return H`
|
|
7667
7667
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7668
7668
|
${this.displayPubnubChat?H`
|
|
7669
7669
|
<pubnub-chat
|
|
@@ -7678,7 +7678,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
7678
7678
|
.primaryColor=${this.primaryColor}
|
|
7679
7679
|
.backgroundColor=${this.backgroundColor}
|
|
7680
7680
|
.onClickExit=${this.closeChatAndRestoreFocus}
|
|
7681
|
-
.onMount=${()=>{
|
|
7681
|
+
.onMount=${()=>{this.adjustPositionChatAdditionalActions(),this.launcherButton=this.currentLauncherButton(),this.focusChatOnMount&&(this.focusChatOnMount=!1,this.focusMessageFieldOnOpen())}}
|
|
7682
7682
|
.requiresConsent=${this.requiresConsent}
|
|
7683
7683
|
.hideMobileFeatures=${this.hideMobileFeatures}
|
|
7684
7684
|
.privacyPolicyUrl=${this.privacyPolicyUrl}
|
|
@@ -297,6 +297,10 @@ export class EmailUsWindow extends LitElement {
|
|
|
297
297
|
brokerEmailError: string | null = null;
|
|
298
298
|
@state()
|
|
299
299
|
hasSubmittedForm = false;
|
|
300
|
+
/** The backend matched the submitter's own email to a broker the org already has: it made no lead and emailed
|
|
301
|
+
* them their submission link, so the confirmation mustn't promise that the leasing team will be in touch. */
|
|
302
|
+
@state()
|
|
303
|
+
isKnownBroker = false;
|
|
300
304
|
@state()
|
|
301
305
|
windowHeight = 525;
|
|
302
306
|
@state()
|
|
@@ -499,7 +503,7 @@ export class EmailUsWindow extends LitElement {
|
|
|
499
503
|
this.selectedLeadSource && this.selectedLeadSource.value
|
|
500
504
|
? this.selectedLeadSource.value
|
|
501
505
|
: this.currentLeadSource;
|
|
502
|
-
await createEmail(
|
|
506
|
+
const { knownBroker } = await createEmail(
|
|
503
507
|
this.firstName,
|
|
504
508
|
this.lastName,
|
|
505
509
|
this.email,
|
|
@@ -536,6 +540,7 @@ export class EmailUsWindow extends LitElement {
|
|
|
536
540
|
});
|
|
537
541
|
this.leadSourceClient?.resetLeadSource();
|
|
538
542
|
this.leadSourceMultitouchClient?.resetLeadSourceTouchpoints();
|
|
543
|
+
this.isKnownBroker = knownBroker;
|
|
539
544
|
this.hasSubmittedForm = true;
|
|
540
545
|
this.isSubmitting = false;
|
|
541
546
|
// Remove the height of the button when it leaves the loading state
|
|
@@ -687,7 +692,9 @@ export class EmailUsWindow extends LitElement {
|
|
|
687
692
|
</div>
|
|
688
693
|
<div class="email-us__vertical-spacer"></div>
|
|
689
694
|
<div class="email-us__submitted-info">
|
|
690
|
-
${this.
|
|
695
|
+
${this.isKnownBroker
|
|
696
|
+
? "It looks like you're a broker or locator. We've emailed you a link where you can submit your client."
|
|
697
|
+
: this.isBrokerReferral
|
|
691
698
|
? "Thank you for the referral. A member of our leasing team will contact your client."
|
|
692
699
|
: "Thank you for your message. A member of our leasing team will contact you."}
|
|
693
700
|
</div>
|
|
@@ -873,7 +880,7 @@ const createEmail = async (
|
|
|
873
880
|
chatId?: string | null,
|
|
874
881
|
leadSourcesWithTimestamps?: LeadSourceSubmittedListItem[],
|
|
875
882
|
broker?: BrokerReferral | null
|
|
876
|
-
) => {
|
|
883
|
+
): Promise<{ knownBroker: boolean }> => {
|
|
877
884
|
const queryParams = new URLSearchParams(window.location.search);
|
|
878
885
|
const requestBody = {
|
|
879
886
|
email_address: email,
|
|
@@ -906,7 +913,7 @@ const createEmail = async (
|
|
|
906
913
|
// A flag only: the broker's own details stay out of the data layer.
|
|
907
914
|
...(broker ? { isBrokerReferral: true } : {}),
|
|
908
915
|
});
|
|
909
|
-
await axios.post(
|
|
916
|
+
const response = await axios.post<{ known_broker?: boolean }>(
|
|
910
917
|
"https://app.meetelise.com/platformApi/state/create/emailMe",
|
|
911
918
|
requestBody,
|
|
912
919
|
{
|
|
@@ -917,4 +924,5 @@ const createEmail = async (
|
|
|
917
924
|
},
|
|
918
925
|
}
|
|
919
926
|
);
|
|
927
|
+
return { knownBroker: response.data?.known_broker === true };
|
|
920
928
|
};
|
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
import "./actions/minimize-expand-button";
|
|
47
47
|
import "./launcher/mobile-launcher";
|
|
48
48
|
import "./pubnub-chat";
|
|
49
|
+
import type { PubnubChat } from "./pubnub-chat";
|
|
49
50
|
import { getBuildingPhoneNumber } from "../getBuildingPhoneNumber";
|
|
50
51
|
import {
|
|
51
52
|
clearChatStorageKey,
|
|
@@ -1029,6 +1030,26 @@ export class MEChat extends LitElement {
|
|
|
1029
1030
|
(stored ?? this.currentLauncherButton())?.focus();
|
|
1030
1031
|
};
|
|
1031
1032
|
|
|
1033
|
+
/**
|
|
1034
|
+
* User-initiated open. The caret belongs in the message field.
|
|
1035
|
+
* While consent hides the composer, keep focus on the dialog so the agree
|
|
1036
|
+
* control is reachable. Stored consent is applied after onMount, so try
|
|
1037
|
+
* again once that paint has committed.
|
|
1038
|
+
*/
|
|
1039
|
+
private focusMessageFieldOnOpen = (): void => {
|
|
1040
|
+
const chat = this.shadowRoot?.getElementById(
|
|
1041
|
+
"pubnub-chat"
|
|
1042
|
+
) as PubnubChat | null;
|
|
1043
|
+
const root = chat?.shadowRoot;
|
|
1044
|
+
if (!chat || !root) return;
|
|
1045
|
+
if (!chat.focusMessageField()) {
|
|
1046
|
+
root.getElementById("pubnub-chat-container")?.focus();
|
|
1047
|
+
}
|
|
1048
|
+
setTimeout(() => {
|
|
1049
|
+
chat.focusMessageField();
|
|
1050
|
+
}, 0);
|
|
1051
|
+
};
|
|
1052
|
+
|
|
1032
1053
|
private closeChatAndRestoreFocus = (): void => {
|
|
1033
1054
|
this.onExitChat();
|
|
1034
1055
|
void this.updateComplete.then(() => {
|
|
@@ -1078,10 +1099,7 @@ export class MEChat extends LitElement {
|
|
|
1078
1099
|
this.launcherButton = this.currentLauncherButton();
|
|
1079
1100
|
if (!this.focusChatOnMount) return;
|
|
1080
1101
|
this.focusChatOnMount = false;
|
|
1081
|
-
this.
|
|
1082
|
-
?.getElementById("pubnub-chat")
|
|
1083
|
-
?.shadowRoot?.getElementById("pubnub-chat-container")
|
|
1084
|
-
?.focus();
|
|
1102
|
+
this.focusMessageFieldOnOpen();
|
|
1085
1103
|
}}
|
|
1086
1104
|
.requiresConsent=${this.requiresConsent}
|
|
1087
1105
|
.hideMobileFeatures=${this.hideMobileFeatures}
|
|
@@ -301,6 +301,17 @@ export class PubnubChat extends LitElement {
|
|
|
301
301
|
return this.requiresConsent && !this.hasReceivedConsent;
|
|
302
302
|
};
|
|
303
303
|
|
|
304
|
+
/** Caret in the message field when the composer is on screen. */
|
|
305
|
+
focusMessageField(): boolean {
|
|
306
|
+
const root = this.shadowRoot;
|
|
307
|
+
const input = root?.getElementById("message-input");
|
|
308
|
+
if (!(input instanceof HTMLTextAreaElement) || !root) return false;
|
|
309
|
+
// Consent hides the footer with display:none. Focusing it would no-op.
|
|
310
|
+
if (input.getClientRects().length === 0) return false;
|
|
311
|
+
if (root.activeElement !== input) input.focus();
|
|
312
|
+
return root.activeElement === input;
|
|
313
|
+
}
|
|
314
|
+
|
|
304
315
|
/** Tab cycles inside the fullscreen mobile dialog. Desktop stays non-modal. */
|
|
305
316
|
private trapTabInMobileDialog(event: KeyboardEvent): void {
|
|
306
317
|
if (!this._isMobile) return;
|
|
@@ -85,6 +85,53 @@ it("sends a broker referral with the client as the prospect and the broker field
|
|
|
85
85
|
expect(JSON.stringify(event)).not.to.contain("bea@realty.example.com");
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
+
const submittedText = async (emailUs: EmailUsWindow): Promise<string> => {
|
|
89
|
+
await emailUs.updateComplete;
|
|
90
|
+
return (
|
|
91
|
+
emailUs.shadowRoot
|
|
92
|
+
?.querySelector(".email-us__submitted-info")
|
|
93
|
+
?.textContent?.trim() ?? ""
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
it("tells a known broker writing in as the lead that they've been emailed their submission link", async () => {
|
|
98
|
+
const requests = captureRequests();
|
|
99
|
+
const emailUs = createForm({ brokerIntakeEnabled: true });
|
|
100
|
+
document.body.appendChild(emailUs);
|
|
101
|
+
|
|
102
|
+
const submission = emailUs.onClick();
|
|
103
|
+
requests[0].respond(
|
|
104
|
+
200,
|
|
105
|
+
{ "Content-Type": "application/json" },
|
|
106
|
+
JSON.stringify({ status: "ok", known_broker: true })
|
|
107
|
+
);
|
|
108
|
+
await submission;
|
|
109
|
+
|
|
110
|
+
expect(await submittedText(emailUs)).to.contain(
|
|
111
|
+
"We've emailed you a link where you can submit your client."
|
|
112
|
+
);
|
|
113
|
+
emailUs.remove();
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("tells any other lead the leasing team will be in touch", async () => {
|
|
117
|
+
const requests = captureRequests();
|
|
118
|
+
const emailUs = createForm({ brokerIntakeEnabled: true });
|
|
119
|
+
document.body.appendChild(emailUs);
|
|
120
|
+
|
|
121
|
+
const submission = emailUs.onClick();
|
|
122
|
+
requests[0].respond(
|
|
123
|
+
200,
|
|
124
|
+
{ "Content-Type": "application/json" },
|
|
125
|
+
JSON.stringify({ status: "ok" })
|
|
126
|
+
);
|
|
127
|
+
await submission;
|
|
128
|
+
|
|
129
|
+
expect(await submittedText(emailUs)).to.equal(
|
|
130
|
+
"Thank you for your message. A member of our leasing team will contact you."
|
|
131
|
+
);
|
|
132
|
+
emailUs.remove();
|
|
133
|
+
});
|
|
134
|
+
|
|
88
135
|
it("sends the broker's phone on a referral email when they gave one", async () => {
|
|
89
136
|
const requests = captureRequests();
|
|
90
137
|
const emailUs = createForm({
|
package/src/chatKeyboard.test.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { expect } from "@esm-bundle/chai";
|
|
2
2
|
import { sendKeys } from "@web/test-runner-commands";
|
|
3
3
|
import "../public/dist/index";
|
|
4
|
+
import { CURRENT_CONSENT_ID } from "./disclaimers";
|
|
4
5
|
import type { BuildingWebchatView } from "./fetchBuildingWebchatView";
|
|
5
6
|
import type { MEChat } from "./WebComponent/me-chat";
|
|
6
7
|
import type { MESelect } from "./WebComponent/me-select";
|
|
@@ -17,6 +18,7 @@ type MeChatTest = MEChat & {
|
|
|
17
18
|
buildingSlug: string;
|
|
18
19
|
orgSlug: string;
|
|
19
20
|
focusChatOnMount: boolean;
|
|
21
|
+
requiresConsent: boolean;
|
|
20
22
|
launcherButton: HTMLElement | null;
|
|
21
23
|
hideLauncher: boolean;
|
|
22
24
|
isLoading: boolean;
|
|
@@ -34,6 +36,11 @@ const building = {
|
|
|
34
36
|
tourTypeOptions: [],
|
|
35
37
|
} as unknown as BuildingWebchatView;
|
|
36
38
|
|
|
39
|
+
const nextTask = (): Promise<void> =>
|
|
40
|
+
new Promise((resolve) => {
|
|
41
|
+
setTimeout(resolve, 0);
|
|
42
|
+
});
|
|
43
|
+
|
|
37
44
|
const deepActive = (): Element | null => {
|
|
38
45
|
let active: Element | null = document.activeElement;
|
|
39
46
|
while (active?.shadowRoot?.activeElement) {
|
|
@@ -203,7 +210,7 @@ it("makes the mobile dialog modal and wraps Tab inside it", async () => {
|
|
|
203
210
|
expect(deepActive()).to.equal(outside);
|
|
204
211
|
});
|
|
205
212
|
|
|
206
|
-
it("focuses the
|
|
213
|
+
it("focuses the message field on a user open and not on auto-open", async () => {
|
|
207
214
|
const pageInput = document.createElement("input");
|
|
208
215
|
document.body.appendChild(pageInput);
|
|
209
216
|
pageInput.focus();
|
|
@@ -234,10 +241,90 @@ it("focuses the chat on a user open and not on auto-open", async () => {
|
|
|
234
241
|
"pubnub-chat"
|
|
235
242
|
) as PubnubChat;
|
|
236
243
|
await reopened.updateComplete;
|
|
237
|
-
|
|
244
|
+
await nextTask();
|
|
245
|
+
expect(deepActive()?.id).to.equal("message-input");
|
|
238
246
|
expect(widget.focusChatOnMount).to.equal(false);
|
|
239
247
|
});
|
|
240
248
|
|
|
249
|
+
it("focuses the message field on open when consent is already stored", async () => {
|
|
250
|
+
const consentKey = "stored-consent-orgConsent";
|
|
251
|
+
localStorage.setItem(
|
|
252
|
+
consentKey,
|
|
253
|
+
JSON.stringify({
|
|
254
|
+
consentGiven: true,
|
|
255
|
+
timestamp: Date.now(),
|
|
256
|
+
consentId: CURRENT_CONSENT_ID,
|
|
257
|
+
})
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
const pageInput = document.createElement("input");
|
|
261
|
+
document.body.appendChild(pageInput);
|
|
262
|
+
pageInput.focus();
|
|
263
|
+
|
|
264
|
+
(window as unknown as { eliseAi: Record<string, unknown> }).eliseAi = {};
|
|
265
|
+
const widget = document.createElement("me-chat") as MeChatTest;
|
|
266
|
+
document.body.appendChild(widget);
|
|
267
|
+
await widget.updateComplete;
|
|
268
|
+
widget.buildingSlug = "test-building";
|
|
269
|
+
widget.orgSlug = "stored-consent-org";
|
|
270
|
+
widget.primaryColor = "#646987";
|
|
271
|
+
widget.backgroundColor = "#ffffff";
|
|
272
|
+
widget.buildingWebchatView = building;
|
|
273
|
+
widget.requiresConsent = true;
|
|
274
|
+
widget.focusChatOnMount = false;
|
|
275
|
+
widget.displayPubnubChat = true;
|
|
276
|
+
await widget.updateComplete;
|
|
277
|
+
const pubnub = widget.shadowRoot?.getElementById("pubnub-chat") as PubnubChat;
|
|
278
|
+
await pubnub.updateComplete;
|
|
279
|
+
await nextTask();
|
|
280
|
+
expect(deepActive()).to.equal(pageInput);
|
|
281
|
+
|
|
282
|
+
widget.displayPubnubChat = false;
|
|
283
|
+
await widget.updateComplete;
|
|
284
|
+
widget.focusChatOnMount = true;
|
|
285
|
+
widget.displayPubnubChat = true;
|
|
286
|
+
await widget.updateComplete;
|
|
287
|
+
const reopened = widget.shadowRoot?.getElementById(
|
|
288
|
+
"pubnub-chat"
|
|
289
|
+
) as PubnubChat;
|
|
290
|
+
await reopened.updateComplete;
|
|
291
|
+
await nextTask();
|
|
292
|
+
expect(deepActive()?.id).to.equal("message-input");
|
|
293
|
+
localStorage.removeItem(consentKey);
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
it("focuses the dialog until consent, then the message field", async () => {
|
|
297
|
+
localStorage.removeItem("consent-gate-orgConsent");
|
|
298
|
+
(window as unknown as { eliseAi: Record<string, unknown> }).eliseAi = {};
|
|
299
|
+
const widget = document.createElement("me-chat") as MeChatTest;
|
|
300
|
+
document.body.appendChild(widget);
|
|
301
|
+
await widget.updateComplete;
|
|
302
|
+
widget.buildingSlug = "test-building";
|
|
303
|
+
widget.orgSlug = "consent-gate-org";
|
|
304
|
+
widget.primaryColor = "#646987";
|
|
305
|
+
widget.backgroundColor = "#ffffff";
|
|
306
|
+
widget.buildingWebchatView = building;
|
|
307
|
+
widget.requiresConsent = true;
|
|
308
|
+
widget.focusChatOnMount = true;
|
|
309
|
+
widget.displayPubnubChat = true;
|
|
310
|
+
await widget.updateComplete;
|
|
311
|
+
const pubnub = widget.shadowRoot?.getElementById("pubnub-chat") as PubnubChat;
|
|
312
|
+
await pubnub.updateComplete;
|
|
313
|
+
await nextTask();
|
|
314
|
+
expect(deepActive()?.id).to.equal("pubnub-chat-container");
|
|
315
|
+
|
|
316
|
+
const agree = pubnub.shadowRoot?.querySelector(
|
|
317
|
+
".agreeButton"
|
|
318
|
+
) as HTMLButtonElement | null;
|
|
319
|
+
expect(agree?.textContent?.trim()).to.equal("I agree");
|
|
320
|
+
agree?.click();
|
|
321
|
+
await pubnub.updateComplete;
|
|
322
|
+
await nextTask();
|
|
323
|
+
expect(deepActive()?.id).to.equal("message-input");
|
|
324
|
+
const footer = pubnub.shadowRoot?.getElementById("footer");
|
|
325
|
+
expect(footer?.classList.contains("hidden")).to.equal(false);
|
|
326
|
+
});
|
|
327
|
+
|
|
241
328
|
it("returns focus to the launcher from Minimize chat", async () => {
|
|
242
329
|
const launcher = document.createElement("button");
|
|
243
330
|
launcher.textContent = "Chat with us";
|
|
@@ -274,6 +361,49 @@ it("returns focus to the launcher from Minimize chat", async () => {
|
|
|
274
361
|
expect(deepActive()).to.equal(launcher);
|
|
275
362
|
});
|
|
276
363
|
|
|
364
|
+
it("returns focus to the launcher on Escape", async () => {
|
|
365
|
+
const launcher = document.createElement("button");
|
|
366
|
+
launcher.setAttribute("aria-label", "Chat with us");
|
|
367
|
+
launcher.textContent = "Chat with us";
|
|
368
|
+
document.body.appendChild(launcher);
|
|
369
|
+
|
|
370
|
+
(window as unknown as { eliseAi: Record<string, unknown> }).eliseAi = {};
|
|
371
|
+
const widget = document.createElement("me-chat") as MeChatTest;
|
|
372
|
+
document.body.appendChild(widget);
|
|
373
|
+
await widget.updateComplete;
|
|
374
|
+
widget.buildingSlug = "test-building";
|
|
375
|
+
widget.orgSlug = "test-org";
|
|
376
|
+
widget.primaryColor = "#646987";
|
|
377
|
+
widget.backgroundColor = "#ffffff";
|
|
378
|
+
widget.buildingWebchatView = building;
|
|
379
|
+
widget._isMobile = false;
|
|
380
|
+
widget.isLoading = false;
|
|
381
|
+
widget.hideLauncher = true;
|
|
382
|
+
widget.displayPubnubChat = true;
|
|
383
|
+
await widget.updateComplete;
|
|
384
|
+
widget.launcherButton = launcher;
|
|
385
|
+
|
|
386
|
+
const pubnub = widget.shadowRoot?.getElementById("pubnub-chat") as PubnubChat;
|
|
387
|
+
await pubnub.updateComplete;
|
|
388
|
+
const container = pubnub.shadowRoot?.getElementById(
|
|
389
|
+
"pubnub-chat-container"
|
|
390
|
+
) as HTMLElement;
|
|
391
|
+
const input = pubnub.shadowRoot?.getElementById(
|
|
392
|
+
"message-input"
|
|
393
|
+
) as HTMLTextAreaElement;
|
|
394
|
+
input.focus();
|
|
395
|
+
container.dispatchEvent(
|
|
396
|
+
new KeyboardEvent("keydown", {
|
|
397
|
+
key: "Escape",
|
|
398
|
+
bubbles: true,
|
|
399
|
+
composed: true,
|
|
400
|
+
})
|
|
401
|
+
);
|
|
402
|
+
await widget.updateComplete;
|
|
403
|
+
expect(widget.displayPubnubChat).to.equal(false);
|
|
404
|
+
expect(deepActive()).to.equal(launcher);
|
|
405
|
+
});
|
|
406
|
+
|
|
277
407
|
it("moves Tab from an open, scrolling select to the next control", async () => {
|
|
278
408
|
const select = document.createElement("me-select") as MESelect & {
|
|
279
409
|
updateComplete: Promise<boolean>;
|
package/src/disclaimers.ts
CHANGED
|
@@ -319,14 +319,28 @@ export const getConsentPreChatDisclaimer = (
|
|
|
319
319
|
if (!(root instanceof ShadowRoot)) return;
|
|
320
320
|
const host = root.host as HTMLElement & {
|
|
321
321
|
updateComplete?: Promise<unknown>;
|
|
322
|
+
focusMessageField?: () => boolean;
|
|
322
323
|
};
|
|
324
|
+
// The agree control is what has focus. Hiding it sends focus to the dialog
|
|
325
|
+
// (tabindex=-1). Move the caret to the message field after that.
|
|
323
326
|
const focus = (): void => {
|
|
324
|
-
|
|
327
|
+
if (typeof host.focusMessageField === "function") {
|
|
328
|
+
host.focusMessageField();
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
const input = root.getElementById("message-input");
|
|
332
|
+
if (input instanceof HTMLElement && input.getClientRects().length > 0) {
|
|
333
|
+
input.focus();
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
const afterUpdate = (): void => {
|
|
337
|
+
focus();
|
|
338
|
+
setTimeout(focus, 0);
|
|
325
339
|
};
|
|
326
340
|
if (host.updateComplete) {
|
|
327
|
-
void host.updateComplete.then(
|
|
341
|
+
void host.updateComplete.then(afterUpdate);
|
|
328
342
|
} else {
|
|
329
|
-
|
|
343
|
+
afterUpdate();
|
|
330
344
|
}
|
|
331
345
|
};
|
|
332
346
|
|