@meetelise/chat 1.20.115 → 1.20.117
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/dist/index.js +9 -10
- package/src/WebComponent/actions/call-us-window.ts +0 -2
- package/src/WebComponent/launcher/Launcher.ts +3 -2
- package/src/WebComponent/launcher/mobile-launcher.ts +4 -1
- package/src/WebComponent/me-chat.ts +1 -1
- package/src/analytics.ts +1 -1
package/package.json
CHANGED
package/public/dist/index.js
CHANGED
|
@@ -1208,7 +1208,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
1208
1208
|
</div>
|
|
1209
1209
|
`}
|
|
1210
1210
|
</div>
|
|
1211
|
-
`}};var oi;ri.styles=[ni,Zt],ii([ue({attribute:!1})],ri.prototype,"layoutOptions",void 0),ii([ue({attribute:!1})],ri.prototype,"unitOptions",void 0),ii([ue({attribute:!1})],ri.prototype,"tourTypeOptions",void 0),ii([ue({attribute:!0})],ri.prototype,"chatId",void 0),ii([ue({type:Number})],ri.prototype,"buildingId",void 0),ii([ue({attribute:!0})],ri.prototype,"buildingSlug",void 0),ii([ue({attribute:!0})],ri.prototype,"sgtUrl",void 0),ii([ue({attribute:!0})],ri.prototype,"escortedToursLink",void 0),ii([ue({attribute:!0})],ri.prototype,"virtualToursLink",void 0),ii([ue({attribute:!0})],ri.prototype,"orgSlug",void 0),ii([ue({attribute:!0})],ri.prototype,"buildingName",void 0),ii([le()],ri.prototype,"tourType",void 0),ii([le()],ri.prototype,"shouldShowTourType",void 0),ii([le()],ri.prototype,"email",void 0),ii([le()],ri.prototype,"phoneNumber",void 0),ii([le()],ri.prototype,"availabilitiesGroupedByDay",void 0),ii([le()],ri.prototype,"waitingForAvailabilities",void 0),ii([le()],ri.prototype,"selectedDate",void 0),ii([le()],ri.prototype,"selectedTime",void 0),ii([le()],ri.prototype,"mobilePageIndex",void 0),ii([le()],ri.prototype,"isSubmitting",void 0),ii([le()],ri.prototype,"tourIsBooked",void 0),ii([ue({attribute:!1})],ri.prototype,"leadSources",void 0),ii([ue({attribute:!0})],ri.prototype,"currentLeadSource",void 0),ii([ue({attribute:!0})],ri.prototype,"featureFlagShowDropdown",void 0),ii([ue({attribute:!0})],ri.prototype,"compactDesign",void 0),ii([ue({attribute:!0})],ri.prototype,"brandColor",void 0),ii([de(".nameContainer#firstName input")],ri.prototype,"firstNameInput",void 0),ii([de(".nameContainer#lastName input")],ri.prototype,"lastNameInput",void 0),ii([de(".inputContainer#email input")],ri.prototype,"emailInput",void 0),ii([de(".inputContainer#phone input")],ri.prototype,"phoneInput",void 0),ii([de("me-select#unitType")],ri.prototype,"unitTypeSelect",void 0),ii([de("me-select#layoutType")],ri.prototype,"layoutTypeSelect",void 0),ii([de("me-select#leadSource")],ri.prototype,"selectedLeadSource",void 0),ri=ii([ae("tour-scheduler")],ri),function(e){e.Guided="guided",e.Self="self",e.Virtual="virtual"}(oi||(oi={}));const ai={[oi.Guided]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent,[oi.Self]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided,[oi.Virtual]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing},si={[oi.Guided]:"escorted-tour",[oi.Self]:"self-guided-tour",[oi.Virtual]:"live-virtual-tour"},ui=e=>e.map((e=>(e=>({studio:0,"1br":1,"2br":2,"3br":3,"4br":4,"5br":5,"6br":6,"7br":7,"8br":8,"9br":9,"10br":10}[e]))(e))).filter(qn()).sort().map((e=>(e=>({0:"studio",1:"1br",2:"2br",3:"3br",4:"4br",5:"5br",6:"6br",7:"7br",8:"8br",9:"9br",10:"10br"}[e]))(e))).filter(jn());class li{constructor(e,t,n,i){this.org=e,this.building=t,this.chatId=n,this.incomingProcessedLeadSource=i,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}ping(e){var t;fetch("https://app.meetelise.com/platformApi/connectors/talk_js/analytics",{method:"POST",credentials:"omit",keepalive:!0,headers:{"content-type":"application/json; charset=UTF-8"},body:JSON.stringify({eventType:e,chatId:this.chatId,url:location.href,org:this.org,building:this.building,referrer:document.referrer,featureFlags:this.featureFlags,campaignSources:di(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.
|
|
1211
|
+
`}};var oi;ri.styles=[ni,Zt],ii([ue({attribute:!1})],ri.prototype,"layoutOptions",void 0),ii([ue({attribute:!1})],ri.prototype,"unitOptions",void 0),ii([ue({attribute:!1})],ri.prototype,"tourTypeOptions",void 0),ii([ue({attribute:!0})],ri.prototype,"chatId",void 0),ii([ue({type:Number})],ri.prototype,"buildingId",void 0),ii([ue({attribute:!0})],ri.prototype,"buildingSlug",void 0),ii([ue({attribute:!0})],ri.prototype,"sgtUrl",void 0),ii([ue({attribute:!0})],ri.prototype,"escortedToursLink",void 0),ii([ue({attribute:!0})],ri.prototype,"virtualToursLink",void 0),ii([ue({attribute:!0})],ri.prototype,"orgSlug",void 0),ii([ue({attribute:!0})],ri.prototype,"buildingName",void 0),ii([le()],ri.prototype,"tourType",void 0),ii([le()],ri.prototype,"shouldShowTourType",void 0),ii([le()],ri.prototype,"email",void 0),ii([le()],ri.prototype,"phoneNumber",void 0),ii([le()],ri.prototype,"availabilitiesGroupedByDay",void 0),ii([le()],ri.prototype,"waitingForAvailabilities",void 0),ii([le()],ri.prototype,"selectedDate",void 0),ii([le()],ri.prototype,"selectedTime",void 0),ii([le()],ri.prototype,"mobilePageIndex",void 0),ii([le()],ri.prototype,"isSubmitting",void 0),ii([le()],ri.prototype,"tourIsBooked",void 0),ii([ue({attribute:!1})],ri.prototype,"leadSources",void 0),ii([ue({attribute:!0})],ri.prototype,"currentLeadSource",void 0),ii([ue({attribute:!0})],ri.prototype,"featureFlagShowDropdown",void 0),ii([ue({attribute:!0})],ri.prototype,"compactDesign",void 0),ii([ue({attribute:!0})],ri.prototype,"brandColor",void 0),ii([de(".nameContainer#firstName input")],ri.prototype,"firstNameInput",void 0),ii([de(".nameContainer#lastName input")],ri.prototype,"lastNameInput",void 0),ii([de(".inputContainer#email input")],ri.prototype,"emailInput",void 0),ii([de(".inputContainer#phone input")],ri.prototype,"phoneInput",void 0),ii([de("me-select#unitType")],ri.prototype,"unitTypeSelect",void 0),ii([de("me-select#layoutType")],ri.prototype,"layoutTypeSelect",void 0),ii([de("me-select#leadSource")],ri.prototype,"selectedLeadSource",void 0),ri=ii([ae("tour-scheduler")],ri),function(e){e.Guided="guided",e.Self="self",e.Virtual="virtual"}(oi||(oi={}));const ai={[oi.Guided]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent,[oi.Self]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided,[oi.Virtual]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing},si={[oi.Guided]:"escorted-tour",[oi.Self]:"self-guided-tour",[oi.Virtual]:"live-virtual-tour"},ui=e=>e.map((e=>(e=>({studio:0,"1br":1,"2br":2,"3br":3,"4br":4,"5br":5,"6br":6,"7br":7,"8br":8,"9br":9,"10br":10}[e]))(e))).filter(qn()).sort().map((e=>(e=>({0:"studio",1:"1br",2:"2br",3:"3br",4:"4br",5:"5br",6:"6br",7:"7br",8:"8br",9:"9br",10:"10br"}[e]))(e))).filter(jn());class li{constructor(e,t,n,i){this.org=e,this.building=t,this.chatId=n,this.incomingProcessedLeadSource=i,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}ping(e){var t;fetch("https://app.meetelise.com/platformApi/connectors/talk_js/analytics",{method:"POST",credentials:"omit",keepalive:!0,headers:{"content-type":"application/json; charset=UTF-8"},body:JSON.stringify({eventType:e,chatId:this.chatId,url:location.href,org:this.org,building:this.building,referrer:document.referrer,featureFlags:this.featureFlags,campaignSources:di(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.116"})})}}const di=()=>{var e,t,n;const i=new URL(window.location.href).searchParams,r=null!==(n=null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&void 0!==n?n:null;return{entrataCampaignSource:i.get("switch_cls[id]"),realpageCampaignSource:i.get("ilm"),utmCampaignSource:i.get("utm_source"),yardiCampaignSource:r}};var ci;!function(e){e.error="error",e.info="info",e.warn="warn"}(ci||(ci={}));const pi=async({logType:e,buildingSlug:n,orgSlug:i,logTitle:r,logData:o})=>{await t().post("https://app.meetelise.com/platformApi/webchat/logging",{...o},{headers:{"Content-Type":"application/json","building-slug":null!=n?n:"","org-slug":null!=i?i:"","log-type":null!=e?e:ci.error,"log-title":r.toUpperCase().replace(/\s/g,"_")}})};async function hi(e,n){const i="https://app.meetelise.com",r=`${i}/api/pub/v1/organization/${e}/building/${n}`,o=`${i}/eliseCrmApi/pub/building/${n}/units`,a=`${i}/eliseCrmApi/pub/building/${n}/layouts`,[s,u,l]=await Promise.all([t().get(r),t().get(o),t().get(a)]),d=s.data,c=u.data,p=l.data;return d.unitOptionsV2=c,d.layoutOptionsV2=p,d}var fi,mi;async function gi(e){try{const n=await t().get(`https://app.meetelise.com/eliseCrmApi/webchat/config/building/${e}`);if(n.data)return Dn(n.data)}catch(e){return null}return null}async function vi(e){try{return(await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/ab-test-type`)).data}catch(e){return null}}async function yi(e,n){try{return(await t().post("https://app.meetelise.com/platformApi/webchat/current-parsed-lead-source",{query_params:Qn(),building_slug:e,referrer:n,campaign_sources:di()})).data}catch(e){return null}}!function(e){e.EMOJI="emoji",e.PILLS="pills",e.MINIMIZED="minimized"}(fi||(fi={})),function(e){e.ConceptEmoji="Concept 2 (Blue/White)"}(mi||(mi={}));const bi=u`
|
|
1212
1212
|
* {
|
|
1213
1213
|
font-family: "Helvetica Neue", Arial;
|
|
1214
1214
|
font-size: 14px;
|
|
@@ -2378,7 +2378,6 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
2378
2378
|
`,this.render=()=>k`
|
|
2379
2379
|
<details-window
|
|
2380
2380
|
height=${this.hasTextUsEnabled?"600px":"443px"}
|
|
2381
|
-
headerText="${this.chatCallUsHeader}"
|
|
2382
2381
|
.onCloseClick=${this.onCloseClicked}
|
|
2383
2382
|
>
|
|
2384
2383
|
${this.hasCallUsEnabled?k` <div id="call-us-window__content-wrapper">
|
|
@@ -2480,7 +2479,6 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
2480
2479
|
}
|
|
2481
2480
|
|
|
2482
2481
|
.text-us-wrapper {
|
|
2483
|
-
margin-top: 33px;
|
|
2484
2482
|
color: #202020;
|
|
2485
2483
|
}
|
|
2486
2484
|
.text-us-window__header {
|
|
@@ -2565,7 +2563,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
2565
2563
|
justify-content: center;
|
|
2566
2564
|
align-items: center;
|
|
2567
2565
|
}
|
|
2568
|
-
`;var Wi=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 Vi=class extends re{constructor(){super(...arguments),this.onClickMinimize=()=>{},this.onClickEmailOption=()=>{},this.onClickPhoneOption=()=>{},this.onClickSSTOption=()=>{},this.onChatTapped=()=>{},this.hideChat=!1,this.isMobile=!1,this.brandColor=Fe,this.hasChatEnabled=!1,this.hasEmailEnabled=!1,this.hasCallUsEnabled=!1,this.hasSSTEnabled=!1,this.renderListElement=(e,t,n)=>e?k` <li
|
|
2566
|
+
`;var Wi=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 Vi=class extends re{constructor(){super(...arguments),this.onClickMinimize=()=>{},this.onClickEmailOption=()=>{},this.onClickPhoneOption=()=>{},this.onClickSSTOption=()=>{},this.onChatTapped=()=>{},this.hideChat=!1,this.isMobile=!1,this.brandColor=Fe,this.hasChatEnabled=!1,this.hasEmailEnabled=!1,this.hasCallUsEnabled=!1,this.hasTextUsEnabled=!1,this.hasSSTEnabled=!1,this.renderListElement=(e,t,n)=>e?k` <li
|
|
2569
2567
|
@click=${t}
|
|
2570
2568
|
class="typeMobile-bttn"
|
|
2571
2569
|
style=${_e({background:`${this.brandColor}`})}
|
|
@@ -2576,7 +2574,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
2576
2574
|
</li>`:""}render(){return k`<div class="typeMobile-list">
|
|
2577
2575
|
<ul>
|
|
2578
2576
|
${this.renderListElement(this.hasEmailEnabled,this.onClickEmailOption,Fi)}
|
|
2579
|
-
${this.renderListElement(this.hasCallUsEnabled,this.onClickPhoneOption,_i)}
|
|
2577
|
+
${this.renderListElement(this.hasCallUsEnabled||this.hasTextUsEnabled,this.onClickPhoneOption,_i)}
|
|
2580
2578
|
${this.renderListElement(this.hasSSTEnabled,this.onClickSSTOption,Pi)}
|
|
2581
2579
|
${this.renderListElement(this.hasChatEnabled&&!this.hideChat,this.onChatTapped,Di)}
|
|
2582
2580
|
${this.isMobile||this.hideChat?"":k`
|
|
@@ -2587,7 +2585,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
2587
2585
|
></minimize-expand-button>
|
|
2588
2586
|
`}
|
|
2589
2587
|
</ul>
|
|
2590
|
-
</div>`}};Vi.styles=[Qi],Wi([ue({attribute:!0})],Vi.prototype,"onClickMinimize",void 0),Wi([ue({attribute:!0})],Vi.prototype,"onClickEmailOption",void 0),Wi([ue({attribute:!0})],Vi.prototype,"onClickPhoneOption",void 0),Wi([ue({attribute:!0})],Vi.prototype,"onClickSSTOption",void 0),Wi([ue({attribute:!0})],Vi.prototype,"onChatTapped",void 0),Wi([ue({attribute:!0})],Vi.prototype,"hideChat",void 0),Wi([ue({attribute:!0})],Vi.prototype,"isMobile",void 0),Wi([ue({attribute:!0})],Vi.prototype,"brandColor",void 0),Wi([ue({attribute:!0})],Vi.prototype,"hasChatEnabled",void 0),Wi([ue({attribute:!0})],Vi.prototype,"hasEmailEnabled",void 0),Wi([ue({attribute:!0})],Vi.prototype,"hasCallUsEnabled",void 0),Wi([ue({attribute:!0})],Vi.prototype,"hasSSTEnabled",void 0),Vi=Wi([ae("mobile-launcher")],Vi);var Ki=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 Xi=class extends re{constructor(){super(...arguments),this.isMobile=!1,this.isMinimized=!1,this.isFirstMount=!1,this.autoOpenChatWidget=!1,this.phoneNumber="",this.buildingName="",this.chatId="",this.chatCallUsHeader="",this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.sgtUrl="",this.designConcept="",this.featureFlagShowDropdown="",this.leadSources=[],this.currentLeadSource="",this.escortedToursLink="",this.virtualToursLink="",this.hasCallUsEnabled=!1,this.hasChatEnabled=!1,this.hasEmailEnabled=!1,this.hasSSTEnabled=!1,this.hasTextUsEnabled=!1,this.layoutOptions=[],this.unitOptions=[],this.tourTypeOptions=[],this.showTourNextToChat=!1,this.onChatTapped=()=>{},this.onClickMinimize=()=>{},this.launcherStyles={},this.brandColor=Fe,this.isEmailWindowOpen=!1,this.isCallUsWindowOpen=!1,this.isSSTWindowOpen=!1,this.isTextUsWindowOpen=!1,this.getNumCallToActions=()=>[this.hasEmailEnabled,!!this.phoneNumber&&this.hasCallUsEnabled,this.hasSSTEnabled,this.hasTextUsEnabled].filter((e=>e)).length,this.emailUsWindowRef=Ae(),this.tourSchedulerRef=Ae(),this.updated=async()=>{this.attachOnClickToEmailUsWindow(),this.attachOnClickToSSTWindow(),(this.isEmailWindowOpen||this.isCallUsWindowOpen)&&this.isSSTWindowOpen&&this.onCloseSSTWindow()},this.attachOnClickToEmailUsWindow=()=>{const e=this.emailUsWindowRef.value;e&&(e.onCloseClicked=this.onCloseEmailWindow)},this.attachOnClickToSSTWindow=()=>{const e=this.tourSchedulerRef.value;e&&(e.onCloseClicked=this.onCloseSSTWindow)},this.onClickEmailOption=e=>{e.preventDefault(),e.stopPropagation(),this.isEmailWindowOpen=!0},this.onCloseEmailWindow=()=>{this.isEmailWindowOpen=!1},this.renderEmailOption=()=>{const e=this.getNumCallToActions()>2?"Email":"Email us";return k`
|
|
2588
|
+
</div>`}};Vi.styles=[Qi],Wi([ue({attribute:!0})],Vi.prototype,"onClickMinimize",void 0),Wi([ue({attribute:!0})],Vi.prototype,"onClickEmailOption",void 0),Wi([ue({attribute:!0})],Vi.prototype,"onClickPhoneOption",void 0),Wi([ue({attribute:!0})],Vi.prototype,"onClickSSTOption",void 0),Wi([ue({attribute:!0})],Vi.prototype,"onChatTapped",void 0),Wi([ue({attribute:!0})],Vi.prototype,"hideChat",void 0),Wi([ue({attribute:!0})],Vi.prototype,"isMobile",void 0),Wi([ue({attribute:!0})],Vi.prototype,"brandColor",void 0),Wi([ue({attribute:!0})],Vi.prototype,"hasChatEnabled",void 0),Wi([ue({attribute:!0})],Vi.prototype,"hasEmailEnabled",void 0),Wi([ue({attribute:!0})],Vi.prototype,"hasCallUsEnabled",void 0),Wi([ue({attribute:!0})],Vi.prototype,"hasTextUsEnabled",void 0),Wi([ue({attribute:!0})],Vi.prototype,"hasSSTEnabled",void 0),Vi=Wi([ae("mobile-launcher")],Vi);var Ki=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 Xi=class extends re{constructor(){super(...arguments),this.isMobile=!1,this.isMinimized=!1,this.isFirstMount=!1,this.autoOpenChatWidget=!1,this.phoneNumber="",this.buildingName="",this.chatId="",this.chatCallUsHeader="",this.buildingId=0,this.buildingSlug="",this.orgSlug="",this.sgtUrl="",this.designConcept="",this.featureFlagShowDropdown="",this.leadSources=[],this.currentLeadSource="",this.escortedToursLink="",this.virtualToursLink="",this.hasCallUsEnabled=!1,this.hasChatEnabled=!1,this.hasEmailEnabled=!1,this.hasSSTEnabled=!1,this.hasTextUsEnabled=!1,this.layoutOptions=[],this.unitOptions=[],this.tourTypeOptions=[],this.showTourNextToChat=!1,this.onChatTapped=()=>{},this.onClickMinimize=()=>{},this.launcherStyles={},this.brandColor=Fe,this.isEmailWindowOpen=!1,this.isCallUsWindowOpen=!1,this.isSSTWindowOpen=!1,this.isTextUsWindowOpen=!1,this.getNumCallToActions=()=>[this.hasEmailEnabled,!!this.phoneNumber&&this.hasCallUsEnabled,this.hasSSTEnabled,this.hasTextUsEnabled].filter((e=>e)).length,this.emailUsWindowRef=Ae(),this.tourSchedulerRef=Ae(),this.updated=async()=>{this.attachOnClickToEmailUsWindow(),this.attachOnClickToSSTWindow(),(this.isEmailWindowOpen||this.isCallUsWindowOpen)&&this.isSSTWindowOpen&&this.onCloseSSTWindow()},this.attachOnClickToEmailUsWindow=()=>{const e=this.emailUsWindowRef.value;e&&(e.onCloseClicked=this.onCloseEmailWindow)},this.attachOnClickToSSTWindow=()=>{const e=this.tourSchedulerRef.value;e&&(e.onCloseClicked=this.onCloseSSTWindow)},this.onClickEmailOption=e=>{e.preventDefault(),e.stopPropagation(),this.isEmailWindowOpen=!0},this.onCloseEmailWindow=()=>{this.isEmailWindowOpen=!1},this.renderEmailOption=()=>{const e=this.getNumCallToActions()>2?"Email":"Email us";return k`
|
|
2591
2589
|
<div
|
|
2592
2590
|
@click=${this.onClickEmailOption}
|
|
2593
2591
|
class="launcher__call-to-action-option"
|
|
@@ -2619,6 +2617,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
2619
2617
|
.hasChatEnabled=${this.hasChatEnabled}
|
|
2620
2618
|
.hasEmailEnabled=${this.hasEmailEnabled}
|
|
2621
2619
|
.hasCallUsEnabled=${this.phoneNumber&&this.hasCallUsEnabled}
|
|
2620
|
+
.hasTextUsEnabled=${this.hasTextUsEnabled}
|
|
2622
2621
|
.hasSSTEnabled=${this.hasSSTEnabled}
|
|
2623
2622
|
></mobile-launcher>`:this.designConcept===fi.EMOJI?k`
|
|
2624
2623
|
<div
|
|
@@ -2675,8 +2674,8 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
2675
2674
|
<div class="type-hey__pill-left">
|
|
2676
2675
|
<div class="type-hey__icon">${_i}</div>
|
|
2677
2676
|
<div>
|
|
2678
|
-
${this.hasCallUsEnabled&&this.hasTextUsEnabled?k` <span class="title-bold">Call</span
|
|
2679
|
-
|
|
2677
|
+
${this.hasCallUsEnabled&&this.hasTextUsEnabled?k` <span class="title-bold">Call</span> or
|
|
2678
|
+
<span class="title-bold">text</span> us`:""}
|
|
2680
2679
|
${this.hasCallUsEnabled&&!this.hasTextUsEnabled?k` <span class="title-bold">Call</span> us`:""}
|
|
2681
2680
|
${!this.hasCallUsEnabled&&this.hasTextUsEnabled?k` <span class="title-bold">Text</span> us`:""}
|
|
2682
2681
|
|
|
@@ -3415,7 +3414,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3415
3414
|
</button>
|
|
3416
3415
|
</div>
|
|
3417
3416
|
</div>
|
|
3418
|
-
`:k``}};Fr.styles=[Er],_r([ue({attribute:!0})],Fr.prototype,"onMount",void 0),_r([ue({attribute:!0})],Fr.prototype,"channel",void 0),_r([ue({attribute:!0})],Fr.prototype,"myPubnub",void 0),_r([ue({attribute:!0})],Fr.prototype,"buildingSlug",void 0),_r([ue({attribute:!0})],Fr.prototype,"building",void 0),_r([ue({attribute:!0})],Fr.prototype,"brandColor",void 0),_r([ue({attribute:!0})],Fr.prototype,"onClickExit",void 0),_r([ue({attribute:!0})],Fr.prototype,"requiresConsent",void 0),_r([de("#message-input",!0)],Fr.prototype,"messageInput",void 0),_r([de("#conversation-body",!0)],Fr.prototype,"messageBody",void 0),_r([le()],Fr.prototype,"messages",void 0),_r([le()],Fr.prototype,"isMobile",void 0),_r([le()],Fr.prototype,"isLoadingMessages",void 0),_r([le()],Fr.prototype,"hasReceivedConsent",void 0),_r([le()],Fr.prototype,"websitePreviewMapping",void 0),Fr=_r([ae("pubnub-chat")],Fr);const Mr={};var Dr=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 Ur=class extends re{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.isMinimized=!1,this.brandColor=null,this.chatId="",this.analytics=null,this.isMobile=Un(),this.launcher=null,this.building=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=Vn.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.enabledChatWidgets={call:!0,chat:!0,email:!0,text:!0,sst:!0},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.launcherRef=Ae(),this.firstUpdated=async()=>{await this.setBuildingDerivedInfo(),await this.initializeChatVariables()},this.setBuildingDerivedInfo=async()=>{var e,n,i,r,o,a,s,u,l,d,c,p,h,f,m,g,v;if(!this.buildingSlug||!this.orgSlug)return;const y=await hi(this.orgSlug,this.buildingSlug);if(1!==y.active)return;const[b,w,S,T,A,x,O]=await Promise.all([vi(this.buildingSlug),cr(this.buildingSlug),yi(this.buildingSlug,document.referrer),Kn(this.buildingSlug),Xn(this.buildingSlug),gi(y.id),Yn(this.buildingSlug)]);y.phoneNumber=Ne(y.phoneNumber),this.building=y,this.designConcept=null!==(e=null==b?void 0:b.abTestType)&&void 0!==e?e:"",this.leadSources=w,this.currentLeadSource=S,this.featureFlagShowDropdown=T;const C=await(async e=>{if(Mr[e])return Mr[e];const n=`https://app.meetelise.com/sms_management_numbers/webchat/building/${e}/numbers`,i=await t().get(n);return Mr[e]=i.data,i.data})(y.id);this.enabledChatWidgets={call:x&&!x.isGlobalDefault?x.config.shouldShowPhone:null===(r=null===(i=null===(n=this.building)||void 0===n?void 0:n.chatWidgets)||void 0===i?void 0:i.includes("CALL"))||void 0===r||r,chat:x&&!x.isGlobalDefault?x.config.shouldShowChat:null===(s=null===(a=null===(o=this.building)||void 0===o?void 0:o.chatWidgets)||void 0===a?void 0:a.includes("CHAT"))||void 0===s||s,email:x&&!x.isGlobalDefault?x.config.shouldShowEmail:null===(d=null===(l=null===(u=this.building)||void 0===u?void 0:u.chatWidgets)||void 0===l?void 0:l.includes("EMAIL"))||void 0===d||d,text:(x&&!x.isGlobalDefault?x.config.shouldShowText:null===(h=null===(p=null===(c=this.building)||void 0===c?void 0:c.chatWidgets)||void 0===p?void 0:p.includes("SMS"))||void 0===h||h)&&C.length>0,sst:x&&!x.isGlobalDefault?x.config.shouldShowSst:null===(g=null===(m=null===(f=this.building)||void 0===f?void 0:f.chatWidgets)||void 0===m?void 0:m.includes("SST"))||void 0===g||g},x&&x.config&&(this.brandColor=null!==(v=x.config.primaryColor)&&void 0!==v?v:null,this.webchatConfigHasAutoOpenChat=x.config.autoOpenChat,this.requiresConsent=x.config.requiresConsent,x.config.displayStyle===fi.MINIMIZED&&(this.isMinimized=!0),x.config.displayStyle===fi.PILLS&&(this.designConcept=null),x.config.displayStyle===fi.EMOJI&&(this.designConcept=fi.EMOJI)),null===this.brandColor&&(this.brandColor=Fe);let I=null;var N;A&&(I=await async function(e,n){try{const i=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source?source=${n}`);return i.data?{number:Ne(i.data.number),isMatch:i.data.isMatch,isPropertyWebsiteCatchall:i.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,this.currentLeadSource)),O&&(null==I?void 0:I.number)&&((e=>{const t=document.querySelectorAll('a[data-selenium-id="click_to_call"]');t&&t.forEach((t=>{"A"===t.tagName&&(t.href=`tel:${Cr(e)}`);const n=t.querySelector(".click-to-call");n&&Or(n)&&(n.textContent=e)}))})(N=I.number),(e=>{const t=document.querySelectorAll(".dvPhone");t&&t.forEach((t=>{var n;"A"===t.tagName&&(t.href=`tel:${Cr(e)}`),Or(t)&&(t.textContent=e);const i=t.nextElementSibling;if("BR"!==(null==i?void 0:i.tagName)||"A"!==(null===(n=null==i?void 0:i.nextElementSibling)||void 0===n?void 0:n.tagName))return;const r=null==i?void 0:i.nextElementSibling;r.href=`sms:${Cr(e)}`,Or(r)&&(r.textContent=`Text: ${e}`)}))})(N),(e=>{const t=document.querySelectorAll(".click_to_call_href");t&&2===t.length&&t.forEach((t=>{"A"===t.tagName&&(t.href=`tel:${Cr(e)}`);const n=t.querySelector(".click_to_call")||t.querySelector(".click_to_call_foot");n&&Or(n)&&(n.textContent=e)}))})(N)),this.phoneNumberForSource=I||{number:this.building.phoneNumber,isMatch:!1,isPropertyWebsiteCatchall:!0},this.currentLeadSource&&(this.leadSources.includes(this.currentLeadSource)||this.leadSources.push(this.currentLeadSource)),An(this.building.id)},this.initializeChatVariables=async()=>{var n;this.building&&(this.building.conversationMaintenanceMode?console.warn("MeetElise Chat is in maintenance mode. Chat icon will not appear."):(this.myPubnub=new class{constructor(e,t,n){this.apiHost="https://app.meetelise.com",this.building=null,this.ttlHours=24,this.eliseResponseTimeout=null,this.pubnub=null,this.leadUserId="",this.channel="",this.chatListener=null,this.messages=[],this.listenerParams={message:e=>{var t;e.message.messageType!==Tr.noReply&&(this.messages=[...this.messages,{channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken}]);const n="eliseai"!==e.publisher;null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.messages,isLoading:n}),!n&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=n}},this.isLoadingMessages=!1,this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){pi({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:ci.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub&&!await this.initializePubnub())return;await this.withAuthToken((async()=>{var t,n;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout((()=>{console.error("Elise AI did not respond in time..."),pi({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:ci.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}),45e3),await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(t=this.building)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,userId:null===(n=this.building)||void 0===n?void 0:n.userId}}))})),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.clearChatStorageKey=()=>localStorage.removeItem("com.eliseai.webchat.slug="+this.buildingSlug),this.createChatStorageKey=e=>{const t=tn(new Date),n=null!=e?e:`lead_${Sr()}_${this.buildingSlug}`;return localStorage.setItem("com.eliseai.webchat.slug="+this.buildingSlug,JSON.stringify({buildingSlug:this.buildingSlug,leadId:n,timestamp:t})),{leadId:n,timestamp:un(t),buildingSlug:this.buildingSlug}},this.getChatStorageKey=(e=!0)=>{const t=localStorage.getItem("com.eliseai.webchat.slug="+this.buildingSlug);if(t)try{const e=JSON.parse(t),n=e.buildingSlug,i=e.leadId,r=new Date(e.timestamp);if(this.isChatKeyValid({leadId:i,timestamp:r,buildingSlug:n}))return{leadId:i,timestamp:r,buildingSlug:n}}catch(e){console.warn("Error getting chat storage key")}return e?this.createChatStorageKey():{leadId:null,timestamp:null,buildingSlug:null}},this.isChatKeyValid=e=>{if(e.buildingSlug!==this.buildingSlug||!e.leadId||!e.timestamp)return!1;const t=xr(e.timestamp,this.ttlHours);return function(e,t){ke(2,arguments);var n=qe(e),i=qe(t);return n.getTime()<i.getTime()}(e.timestamp,t)},this.buildingSlug=e,this.building=t,this.orgSlug=n}addChatListener(e){this.chatListener=e}async initializePubnub(){const e=this.getChatStorageKey();if(!e.leadId)return void pi({logTitle:"PUBNUB_ERROR_FETCHING_STORAGE_KEY",logData:{channel:this.channel,eliseaiLocalStorageValue:e,leadUserId:this.leadUserId},logType:ci.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});this.leadUserId=e.leadId,this.channel=`webchat_${this.leadUserId}`,e.timestamp&&function(e,t){ke(2,arguments);var n=qe(e),i=qe(t);return n.getTime()>i.getTime()}(e.timestamp,xr(new Date,this.ttlHours))&&this.createChatStorageKey(this.leadUserId);const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(fr())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token}),this.withAuthToken((()=>new Promise((()=>this.handleChatListeners())))),await this.withAuthToken((()=>this.getChannelHistory())),this.pubnub):void 0}async fetchToken(e,n){try{return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${n}`)).data}catch(e){pi({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:ci.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){pi({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:ci.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(t){try{await t()}catch(n){if(n instanceof e.AxiosError&&n&&n.response&&403===n.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const e=await this.fetchToken(this.leadUserId,this.channel);if(!e)return;this.pubnub.setAuthKey(e.auth.result.token),await t()}catch(e){pi({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:ci.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(){var e;try{const t=await new Promise(((e,t)=>{this.pubnub&&this.channel&&this.pubnub.fetchMessages({channels:[this.channel],count:100},((n,i)=>{n.error?(pi({logTitle:"PUBNUB_ERROR_FETCHING_HISTORY",logData:{channel:this.channel,status:n,response:i},logType:ci.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),t(n)):e(i)}))}));if(this.channel&&0!==Object.keys(t.channels).length){const n=t.channels[this.channel],i=[];n.forEach((e=>{e.uuid&&i.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})})),this.messages=i.filter((e=>e.message.messageType!==Tr.noReply)),null===(e=this.chatListener)||void 0===e||e.call(this,{messages:this.messages,isLoading:!1})}}catch(e){pi({logTitle:"PUBNUB_ERROR_FETCHING_HISTORY",logData:{error:e},logType:ci.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}(this.buildingSlug,this.building,this.orgSlug),this.myPubnub.isChatKeyValid(this.myPubnub.getChatStorageKey(!1))&&await this.myPubnub.initializePubnub(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(null!==(n=this.building.autoOpenChatWidget)&&void 0!==n?n:this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1))},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!an(un(t)));return!!e&&!!n&&!Un()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",tn(function(e,t){ke(2,arguments);var n=et(t);return tt(e,6e4*n)}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0})},this.renderChatAdditionalActions=(e,t)=>k` <div
|
|
3417
|
+
`:k``}};Fr.styles=[Er],_r([ue({attribute:!0})],Fr.prototype,"onMount",void 0),_r([ue({attribute:!0})],Fr.prototype,"channel",void 0),_r([ue({attribute:!0})],Fr.prototype,"myPubnub",void 0),_r([ue({attribute:!0})],Fr.prototype,"buildingSlug",void 0),_r([ue({attribute:!0})],Fr.prototype,"building",void 0),_r([ue({attribute:!0})],Fr.prototype,"brandColor",void 0),_r([ue({attribute:!0})],Fr.prototype,"onClickExit",void 0),_r([ue({attribute:!0})],Fr.prototype,"requiresConsent",void 0),_r([de("#message-input",!0)],Fr.prototype,"messageInput",void 0),_r([de("#conversation-body",!0)],Fr.prototype,"messageBody",void 0),_r([le()],Fr.prototype,"messages",void 0),_r([le()],Fr.prototype,"isMobile",void 0),_r([le()],Fr.prototype,"isLoadingMessages",void 0),_r([le()],Fr.prototype,"hasReceivedConsent",void 0),_r([le()],Fr.prototype,"websitePreviewMapping",void 0),Fr=_r([ae("pubnub-chat")],Fr);const Mr={};var Dr=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 Ur=class extends re{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.isMinimized=!1,this.brandColor=null,this.chatId="",this.analytics=null,this.isMobile=Un(),this.launcher=null,this.building=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=Vn.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.enabledChatWidgets={call:!0,chat:!0,email:!0,text:!0,sst:!0},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.launcherRef=Ae(),this.firstUpdated=async()=>{await this.setBuildingDerivedInfo(),await this.initializeChatVariables(),this.handleChatInitializeAnalytics()},this.setBuildingDerivedInfo=async()=>{var e,n,i,r,o,a,s,u,l,d,c,p,h,f,m,g,v;if(!this.buildingSlug||!this.orgSlug)return;const y=await hi(this.orgSlug,this.buildingSlug);if(1!==y.active)return;const[b,w,S,T,A,x,O]=await Promise.all([vi(this.buildingSlug),cr(this.buildingSlug),yi(this.buildingSlug,document.referrer),Kn(this.buildingSlug),Xn(this.buildingSlug),gi(y.id),Yn(this.buildingSlug)]);y.phoneNumber=Ne(y.phoneNumber),this.building=y,this.designConcept=null!==(e=null==b?void 0:b.abTestType)&&void 0!==e?e:"",this.leadSources=w,this.currentLeadSource=S,this.featureFlagShowDropdown=T;const C=await(async e=>{if(Mr[e])return Mr[e];const n=`https://app.meetelise.com/sms_management_numbers/webchat/building/${e}/numbers`,i=await t().get(n);return Mr[e]=i.data,i.data})(y.id);this.enabledChatWidgets={call:x&&!x.isGlobalDefault?x.config.shouldShowPhone:null===(r=null===(i=null===(n=this.building)||void 0===n?void 0:n.chatWidgets)||void 0===i?void 0:i.includes("CALL"))||void 0===r||r,chat:x&&!x.isGlobalDefault?x.config.shouldShowChat:null===(s=null===(a=null===(o=this.building)||void 0===o?void 0:o.chatWidgets)||void 0===a?void 0:a.includes("CHAT"))||void 0===s||s,email:x&&!x.isGlobalDefault?x.config.shouldShowEmail:null===(d=null===(l=null===(u=this.building)||void 0===u?void 0:u.chatWidgets)||void 0===l?void 0:l.includes("EMAIL"))||void 0===d||d,text:(x&&!x.isGlobalDefault?x.config.shouldShowText:null===(h=null===(p=null===(c=this.building)||void 0===c?void 0:c.chatWidgets)||void 0===p?void 0:p.includes("SMS"))||void 0===h||h)&&C.length>0,sst:x&&!x.isGlobalDefault?x.config.shouldShowSst:null===(g=null===(m=null===(f=this.building)||void 0===f?void 0:f.chatWidgets)||void 0===m?void 0:m.includes("SST"))||void 0===g||g},x&&x.config&&(this.brandColor=null!==(v=x.config.primaryColor)&&void 0!==v?v:null,this.webchatConfigHasAutoOpenChat=x.config.autoOpenChat,this.requiresConsent=x.config.requiresConsent,x.config.displayStyle===fi.MINIMIZED&&(this.isMinimized=!0),x.config.displayStyle===fi.PILLS&&(this.designConcept=null),x.config.displayStyle===fi.EMOJI&&(this.designConcept=fi.EMOJI)),null===this.brandColor&&(this.brandColor=Fe);let I=null;var N;A&&(I=await async function(e,n){try{const i=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source?source=${n}`);return i.data?{number:Ne(i.data.number),isMatch:i.data.isMatch,isPropertyWebsiteCatchall:i.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,this.currentLeadSource)),O&&(null==I?void 0:I.number)&&((e=>{const t=document.querySelectorAll('a[data-selenium-id="click_to_call"]');t&&t.forEach((t=>{"A"===t.tagName&&(t.href=`tel:${Cr(e)}`);const n=t.querySelector(".click-to-call");n&&Or(n)&&(n.textContent=e)}))})(N=I.number),(e=>{const t=document.querySelectorAll(".dvPhone");t&&t.forEach((t=>{var n;"A"===t.tagName&&(t.href=`tel:${Cr(e)}`),Or(t)&&(t.textContent=e);const i=t.nextElementSibling;if("BR"!==(null==i?void 0:i.tagName)||"A"!==(null===(n=null==i?void 0:i.nextElementSibling)||void 0===n?void 0:n.tagName))return;const r=null==i?void 0:i.nextElementSibling;r.href=`sms:${Cr(e)}`,Or(r)&&(r.textContent=`Text: ${e}`)}))})(N),(e=>{const t=document.querySelectorAll(".click_to_call_href");t&&2===t.length&&t.forEach((t=>{"A"===t.tagName&&(t.href=`tel:${Cr(e)}`);const n=t.querySelector(".click_to_call")||t.querySelector(".click_to_call_foot");n&&Or(n)&&(n.textContent=e)}))})(N)),this.phoneNumberForSource=I||{number:this.building.phoneNumber,isMatch:!1,isPropertyWebsiteCatchall:!0},this.currentLeadSource&&(this.leadSources.includes(this.currentLeadSource)||this.leadSources.push(this.currentLeadSource)),An(this.building.id)},this.initializeChatVariables=async()=>{var n;this.building&&(this.building.conversationMaintenanceMode?console.warn("MeetElise Chat is in maintenance mode. Chat icon will not appear."):(this.myPubnub=new class{constructor(e,t,n){this.apiHost="https://app.meetelise.com",this.building=null,this.ttlHours=24,this.eliseResponseTimeout=null,this.pubnub=null,this.leadUserId="",this.channel="",this.chatListener=null,this.messages=[],this.listenerParams={message:e=>{var t;e.message.messageType!==Tr.noReply&&(this.messages=[...this.messages,{channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken}]);const n="eliseai"!==e.publisher;null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.messages,isLoading:n}),!n&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=n}},this.isLoadingMessages=!1,this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){pi({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:ci.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub&&!await this.initializePubnub())return;await this.withAuthToken((async()=>{var t,n;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout((()=>{console.error("Elise AI did not respond in time..."),pi({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:ci.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}),45e3),await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(t=this.building)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,userId:null===(n=this.building)||void 0===n?void 0:n.userId}}))})),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.clearChatStorageKey=()=>localStorage.removeItem("com.eliseai.webchat.slug="+this.buildingSlug),this.createChatStorageKey=e=>{const t=tn(new Date),n=null!=e?e:`lead_${Sr()}_${this.buildingSlug}`;return localStorage.setItem("com.eliseai.webchat.slug="+this.buildingSlug,JSON.stringify({buildingSlug:this.buildingSlug,leadId:n,timestamp:t})),{leadId:n,timestamp:un(t),buildingSlug:this.buildingSlug}},this.getChatStorageKey=(e=!0)=>{const t=localStorage.getItem("com.eliseai.webchat.slug="+this.buildingSlug);if(t)try{const e=JSON.parse(t),n=e.buildingSlug,i=e.leadId,r=new Date(e.timestamp);if(this.isChatKeyValid({leadId:i,timestamp:r,buildingSlug:n}))return{leadId:i,timestamp:r,buildingSlug:n}}catch(e){console.warn("Error getting chat storage key")}return e?this.createChatStorageKey():{leadId:null,timestamp:null,buildingSlug:null}},this.isChatKeyValid=e=>{if(e.buildingSlug!==this.buildingSlug||!e.leadId||!e.timestamp)return!1;const t=xr(e.timestamp,this.ttlHours);return function(e,t){ke(2,arguments);var n=qe(e),i=qe(t);return n.getTime()<i.getTime()}(e.timestamp,t)},this.buildingSlug=e,this.building=t,this.orgSlug=n}addChatListener(e){this.chatListener=e}async initializePubnub(){const e=this.getChatStorageKey();if(!e.leadId)return void pi({logTitle:"PUBNUB_ERROR_FETCHING_STORAGE_KEY",logData:{channel:this.channel,eliseaiLocalStorageValue:e,leadUserId:this.leadUserId},logType:ci.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});this.leadUserId=e.leadId,this.channel=`webchat_${this.leadUserId}`,e.timestamp&&function(e,t){ke(2,arguments);var n=qe(e),i=qe(t);return n.getTime()>i.getTime()}(e.timestamp,xr(new Date,this.ttlHours))&&this.createChatStorageKey(this.leadUserId);const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(fr())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token}),this.withAuthToken((()=>new Promise((()=>this.handleChatListeners())))),await this.withAuthToken((()=>this.getChannelHistory())),this.pubnub):void 0}async fetchToken(e,n){try{return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${n}`)).data}catch(e){pi({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:ci.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){pi({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:ci.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}async withAuthToken(t){try{await t()}catch(n){if(n instanceof e.AxiosError&&n&&n.response&&403===n.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const e=await this.fetchToken(this.leadUserId,this.channel);if(!e)return;this.pubnub.setAuthKey(e.auth.result.token),await t()}catch(e){pi({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:ci.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(){var e;try{const t=await new Promise(((e,t)=>{this.pubnub&&this.channel&&this.pubnub.fetchMessages({channels:[this.channel],count:100},((n,i)=>{n.error?(pi({logTitle:"PUBNUB_ERROR_FETCHING_HISTORY",logData:{channel:this.channel,status:n,response:i},logType:ci.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),t(n)):e(i)}))}));if(this.channel&&0!==Object.keys(t.channels).length){const n=t.channels[this.channel],i=[];n.forEach((e=>{e.uuid&&i.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})})),this.messages=i.filter((e=>e.message.messageType!==Tr.noReply)),null===(e=this.chatListener)||void 0===e||e.call(this,{messages:this.messages,isLoading:!1})}}catch(e){pi({logTitle:"PUBNUB_ERROR_FETCHING_HISTORY",logData:{error:e},logType:ci.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}(this.buildingSlug,this.building,this.orgSlug),this.myPubnub.isChatKeyValid(this.myPubnub.getChatStorageKey(!1))&&await this.myPubnub.initializePubnub(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(null!==(n=this.building.autoOpenChatWidget)&&void 0!==n?n:this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1))},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!an(un(t)));return!!e&&!!n&&!Un()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",tn(function(e,t){ke(2,arguments);var n=et(t);return tt(e,6e4*n)}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0})},this.renderChatAdditionalActions=(e,t)=>k` <div
|
|
3419
3418
|
id=${e}
|
|
3420
3419
|
class=${fe({showTab:t,hideTab:!t})}
|
|
3421
3420
|
>
|
|
@@ -3437,7 +3436,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3437
3436
|
.brandColor=${this.brandColor}
|
|
3438
3437
|
.onClick=${()=>{this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1}}
|
|
3439
3438
|
></minimize-expand-button>
|
|
3440
|
-
</div>`}async handleChatInitializeAnalytics(){var e,t;this.analytics=new li(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",this.currentLeadSource),this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e,t;null===(e=this.myPubnub)||void 0===e||e.removeChatListeners(),null===(t=this.myPubnub)||void 0===t||t.clearChatStorageKey(),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables(),this.
|
|
3439
|
+
</div>`}async handleChatInitializeAnalytics(){var e,t;this.analytics=new li(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",this.currentLeadSource),this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e,t;null===(e=this.myPubnub)||void 0===e||e.removeChatListeners(),null===(t=this.myPubnub)||void 0===t||t.clearChatStorageKey(),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables(),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)}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.removeChatListeners(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),super.disconnectedCallback()}render(){var e,t,n,i,r,o,a,s,u,l,d,c,p,h,f,m,g,v,y,b,w,S,T,A,x,O,C,I;window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Xi);const N=this.hideLauncher&&!this.isLoading&&!this.isMobile;return k`
|
|
3441
3440
|
<meta name="viewport" content="width=device-width, initial-scale=1 user-scalable=1">
|
|
3442
3441
|
<div id="aria-describe-info" style="display: none;">
|
|
3443
3442
|
EliseAI widget that allows you to chat with a virtual assistant, book
|
|
@@ -85,7 +85,6 @@ export class CallUsWindow extends LitElement {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
.text-us-wrapper {
|
|
88
|
-
margin-top: 33px;
|
|
89
88
|
color: #202020;
|
|
90
89
|
}
|
|
91
90
|
.text-us-window__header {
|
|
@@ -316,7 +315,6 @@ export class CallUsWindow extends LitElement {
|
|
|
316
315
|
return html`
|
|
317
316
|
<details-window
|
|
318
317
|
height=${this.hasTextUsEnabled ? "600px" : "443px"}
|
|
319
|
-
headerText="${this.chatCallUsHeader}"
|
|
320
318
|
.onCloseClick=${this.onCloseClicked}
|
|
321
319
|
>
|
|
322
320
|
${this.hasCallUsEnabled
|
|
@@ -277,6 +277,7 @@ export class Launcher extends LitElement {
|
|
|
277
277
|
.hasChatEnabled=${this.hasChatEnabled}
|
|
278
278
|
.hasEmailEnabled=${this.hasEmailEnabled}
|
|
279
279
|
.hasCallUsEnabled=${this.phoneNumber && this.hasCallUsEnabled}
|
|
280
|
+
.hasTextUsEnabled=${this.hasTextUsEnabled}
|
|
280
281
|
.hasSSTEnabled=${this.hasSSTEnabled}
|
|
281
282
|
></mobile-launcher>`;
|
|
282
283
|
}
|
|
@@ -351,8 +352,8 @@ export class Launcher extends LitElement {
|
|
|
351
352
|
<div>
|
|
352
353
|
${
|
|
353
354
|
this.hasCallUsEnabled && this.hasTextUsEnabled
|
|
354
|
-
? html` <span class="title-bold">Call</span
|
|
355
|
-
|
|
355
|
+
? html` <span class="title-bold">Call</span> or
|
|
356
|
+
<span class="title-bold">text</span> us`
|
|
356
357
|
: ""
|
|
357
358
|
}
|
|
358
359
|
${
|
|
@@ -54,6 +54,9 @@ export class MobileLauncher extends LitElement {
|
|
|
54
54
|
@property({ attribute: true })
|
|
55
55
|
hasCallUsEnabled = false;
|
|
56
56
|
|
|
57
|
+
@property({ attribute: true })
|
|
58
|
+
hasTextUsEnabled = false;
|
|
59
|
+
|
|
57
60
|
@property({ attribute: true })
|
|
58
61
|
hasSSTEnabled = false;
|
|
59
62
|
|
|
@@ -87,7 +90,7 @@ export class MobileLauncher extends LitElement {
|
|
|
87
90
|
EmailBlackOutlineIcon
|
|
88
91
|
)}
|
|
89
92
|
${this.renderListElement(
|
|
90
|
-
this.hasCallUsEnabled,
|
|
93
|
+
this.hasCallUsEnabled || this.hasTextUsEnabled,
|
|
91
94
|
this.onClickPhoneOption,
|
|
92
95
|
PhoneBlackOutlineIcon
|
|
93
96
|
)}
|
|
@@ -171,6 +171,7 @@ export class MEChat extends LitElement {
|
|
|
171
171
|
firstUpdated = async (): Promise<void> => {
|
|
172
172
|
await this.setBuildingDerivedInfo();
|
|
173
173
|
await this.initializeChatVariables();
|
|
174
|
+
this.handleChatInitializeAnalytics();
|
|
174
175
|
};
|
|
175
176
|
|
|
176
177
|
// The general info for the building
|
|
@@ -344,7 +345,6 @@ export class MEChat extends LitElement {
|
|
|
344
345
|
this.myPubnub = null;
|
|
345
346
|
this.displayPubnubChat = false;
|
|
346
347
|
await this.initializeChatVariables();
|
|
347
|
-
this.handleChatInitializeAnalytics();
|
|
348
348
|
this.hideLauncher = false;
|
|
349
349
|
}
|
|
350
350
|
|
package/src/analytics.ts
CHANGED
|
@@ -67,7 +67,7 @@ export default class Analytics {
|
|
|
67
67
|
featureFlags: this.featureFlags,
|
|
68
68
|
campaignSources: getCampaignSources(),
|
|
69
69
|
incomingProcessedLeadSource: this.incomingProcessedLeadSource, // if we already know the lead source, send it along
|
|
70
|
-
webchatVersion: process.env.npm_package_version ?? "1.20.
|
|
70
|
+
webchatVersion: process.env.npm_package_version ?? "1.20.116",
|
|
71
71
|
}),
|
|
72
72
|
}
|
|
73
73
|
);
|