@meetelise/chat 1.22.62 → 1.22.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.22.62",
3
+ "version": "1.22.63",
4
4
  "description": "",
5
5
  "main": "public/dist/index.js",
6
6
  "type": "module",
@@ -4442,7 +4442,7 @@ xmlns="http://www.w3.org/2000/svg"
4442
4442
  I agree
4443
4443
  </button>
4444
4444
  </div>
4445
- `;var wo=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 So=class extends re{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this.chatId="",this.analytics=null,this.launcher=null,this.building=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=$n.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=Fo.Default,this.onWidgetLoaded=rr(),this.onSstClose=rr(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=xe(),this.firstUpdated=async()=>this.setupWebchat(),this.shouldShowWebchat=async(e,n)=>{if(!e)return console.warn("MeetElise Chat will NOT appear. Building does NOT exist."),ci({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!1,extra_data:{webchat_no_show_reason:"building_does_not_exist"}},sampleRate:this.sampleRateToUse}),!1;if(!e.launchedDateTime)return console.warn("MeetElise Chat will NOT appear. Building is NOT launched (based on launched date time)."),ci({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!1,extra_data:{webchat_no_show_reason:"building_not_launched"}},sampleRate:this.sampleRateToUse}),!1;if(!e.active)return console.warn("MeetElise Chat will NOT appear. Building is NOT active."),ci({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!1,extra_data:{webchat_no_show_reason:"building_not_active"}},sampleRate:this.sampleRateToUse}),!1;if(!e.webchatScopeConfigured)return console.warn("MeetElise Chat will NOT appear. Building is NOT webchat scope configured."),ci({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!1,extra_data:{webchat_no_show_reason:"building_not_webchat_scope_configured"}},sampleRate:this.sampleRateToUse}),!1;const i=await async function(e){if(!e)return!1;try{return(await t().get(Xn(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-leasing-in-maintenance-mode",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(n);return!i||(console.warn("MeetElise Chat will NOT appear. Chat is in maintenance mode."),ci({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!1,extra_data:{webchat_no_show_reason:"building_in_maintenance_mode"}},sampleRate:this.sampleRateToUse}),!1)},this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await xi(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,n)=>{const i=window.rentgrata;if(!i)return;const r=i.Widget;if(!r)return;const o=r.config;if(!o)return;const a=o.widgetKey;a&&await t().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=n?n:""}})})(this.buildingSlug,this.orgSlug)}catch(e){console.warn("Error updating rentgrata token",e)}this.sampleRateToUse=(null==e?void 0:e.launchedDateTime)?.05:.1,await this.shouldShowWebchat(e,this.buildingSlug)&&(ci({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:this.sampleRateToUse}),this.building=e,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1,"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0))},this.setBuildingDerivedInfo=async()=>{var e,n,i,r,o,a,s,l,u,d,c,p,h,f,m,g,v,y,b,w,S,T,x,A,C,O,I,N,E;const R=this.building;if(!R)return;R&&this.orgSlug&&xo(this.orgSlug,null!==(n=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==n?n:null,this.sampleRateToUse,this.buildingSlug,null!==(r=null===(i=this.LeadSourceClient)||void 0===i?void 0:i.leadSource)&&void 0!==r?r:null);const[_,P,M,F,k,D,U]=await Promise.all([Ni(this.buildingSlug),Ar(this.orgSlug,this.buildingSlug),Yn(this.buildingSlug),Zn(this.buildingSlug),Ii(R.id),ei(this.buildingSlug),ti(this.buildingSlug)]);this.building&&(this.building.phoneNumber=Ne(R.phoneNumber)),this.designConcept=null!==(o=null==_?void 0:_.abTestType)&&void 0!==o?o:"",this.leadSources=P,this.featureFlagShowDropdown=M;const B=R.textWithUsPhoneNumber?R.textWithUsPhoneNumber:await(async e=>{try{const n="https://app.meetelise.com",i=await t().get(`${n}/platformApi/webchat/${e}/phone-number`);if(i.data)return i.data}catch(t){return di({logType:ui.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug);var L,q;this.enabledChatWidgets={callDesktop:null!==(a=null==k?void 0:k.shouldShowPhoneDesktop)&&void 0!==a&&a,callMobile:null!==(s=null==k?void 0:k.shouldShowPhoneMobile)&&void 0!==s&&s,chatDesktop:null!==(l=null==k?void 0:k.shouldShowChatDesktop)&&void 0!==l&&l,chatMobile:null!==(u=null==k?void 0:k.shouldShowChatMobile)&&void 0!==u&&u,emailDesktop:null!==(d=null==k?void 0:k.shouldShowEmailDesktop)&&void 0!==d&&d,emailMobile:null!==(c=null==k?void 0:k.shouldShowEmailMobile)&&void 0!==c&&c,textDesktop:null!==(p=(null==k?void 0:k.shouldShowTextDesktop)&&!!B)&&void 0!==p&&p,textMobile:null!==(h=(null==k?void 0:k.shouldShowTextMobile)&&!!B)&&void 0!==h&&h,sstDesktop:null!==(f=null==k?void 0:k.shouldShowSstDesktop)&&void 0!==f&&f,sstMobile:null!==(m=null==k?void 0:k.shouldShowSstMobile)&&void 0!==m&&m},this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(q=this.handleTourClicked,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");t&&t.startsWith("https://app.meetelise.com/")&&e.addEventListener("click",(e=>{e.preventDefault(),q(e)}))})),U&&(e=>{document.querySelectorAll('a[href$="schedule-a-tour"]').forEach((t=>{t&&t.addEventListener("click",(t=>{t.preventDefault(),e(t)}))}))})(this.handleTourClicked),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach((t=>{var n;if(!t)return;const i=document.createElement("a");i.innerHTML=t.innerHTML,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===(g=this.LeadSourceClient)||void 0===g?void 0:g.leadSource)&&(L=null!==(y=null===(v=this.LeadSourceClient)||void 0===v?void 0:v.leadSource)&&void 0!==y?y: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(L)}`)}}))),k&&(this.primaryColor=null!==(b=k.primaryColor)&&void 0!==b?b:null,this.backgroundColor=null!==(w=k.secondaryColor)&&void 0!==w?w:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(S=k.foregroundColorOnPrimaryBackgroundColor)&&void 0!==S?S:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(T=k.foregroundColorOnSecondaryBackgroundColor)&&void 0!==T?T:null,this.webchatConfigHasAutoOpenChat=k.autoOpenChat,this.requiresConsent=k.requiresConsentForChat,this.hideMobileFeatures=k.collapseMobileFeatures,this.privacyPolicyUrl=null!==(x=k.privacyPolicyUrlForChat)&&void 0!==x?x:this.privacyPolicyUrl,k.displayStyle===Ci.MINIMIZED&&(this.isMinimized=!0),k.displayStyle===Ci.PILLS&&(this.designConcept=null),k.displayStyle===Ci.EMOJI&&(this.designConcept=Ci.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Me),null===this.backgroundColor&&(this.backgroundColor=Fe);const J=null!==(C=null===(A=this.building)||void 0===A?void 0:A.phoneNumber)&&void 0!==C?C:"";let j=null;if(F&&(j=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.match,isPropertyWebsiteCatchall:i.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(I=null===(O=this.LeadSourceClient)||void 0===O?void 0:O.leadSource)&&void 0!==I?I:null),j&&!j.isMatch&&(j.number=J)),D&&(null==j?void 0:j.number)){const e=zr(j.number,this.orgSlug,this.buildingSlug);e>0&&ci({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const H=localStorage.getItem("eliseai_phone_number_devtest");H&&(console.info("Using dev test phone number: ",H),zr(H,this.orgSlug,this.buildingSlug)),this.phoneNumberForSource=j||{number:J,isMatch:!1,isPropertyWebsiteCatchall:!0};const G=null!==(E=null===(N=this.LeadSourceClient)||void 0===N?void 0:N.leadSource)&&void 0!==E?E:null;G&&(this.leadSources.includes(G)||this.leadSources.push(G)),Jn(R.id)},this.initializeChatVariables=async()=>{var e,n,i,r,o,a,s,l;if(!this.building)return;const u=Br(this.buildingSlug),d=Lr(this.buildingSlug,u)?u:Ur(this.buildingSlug,!1);if(!d.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new class{constructor(){this.chatId=null,this.apiHost="https://app.meetelise.com",this.leadSource=null,this.localStorageTTLDays=30,this.buildingId=null,this.orgSlug=null,this.buildingSlug=null,this.queryParameters=null,this.leadSourceInput=null,this.updateLeadSourceLocalStorage=(e,t,n,i,r)=>{const o=pi();if(this.leadSourceInput={websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:o,referrer:document.referrer,parsedUtmSource:o?o.utm_source:null,campaignSources:Object.values(li()).filter((e=>e))},i)return;if(!r){const t=this.getLeadSourceBodyIfValid(e);if(t&&!hn(t.timestamp,24*this.localStorageTTLDays))return{...t,timestamp:On(t.timestamp)}}const a={leadSource:t,leadId:n,buildingSlug:e,timestamp:bn(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:On(a.timestamp)}},this.getLeadSourceBodyIfValid=e=>{const t=localStorage.getItem("com.elise.webchat.leadsource.slug="+e);if(t)try{const n=JSON.parse(t);if(n.buildingSlug===e&&n.leadSource&&n.leadId&&n.timestamp&&!hn(On(n.timestamp),24*this.localStorageTTLDays)){try{this.leadSourceInput=n.leadSourceInput}catch(e){console.error("Error parsing leadSourceInput from localStorage")}return n}}catch(e){return null}return null}}async fetchCurrentParsedLeadSource({buildingSlug:e,queryParams:n,referrer:i,campaignSources:r}){try{return(await t().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,{query_params:n,building_slug:e,referrer:i,campaign_sources:r})).data}catch(e){return null}}async checkAndHandleForLogLeadSource({webchatAction:e,stateId:n}){var i,r,o,a,s,l,u;try{if(!this.chatId)return console.error("chatId is not set"),null;if(!this.orgSlug)return console.error("orgId is not set"),null;let d=null,c=null;try{if("f1ba5a20-d207-4e5a-879e-65199e7d0a53"===this.orgSlug){const e=await this.getCookieValue("_ga");e&&(d=e),c=null===(i=window.dataLayer.find((e=>{var t;return"gtagApiGet"==(null===(t=e.value)||void 0===t?void 0:t.event)})))||void 0===i?void 0:i.value}}catch(e){console.error("error getting cookie")}return await t().post(`${this.apiHost}/platformApi/webchat/log/lead-source`,{chat_id:this.chatId,webchat_action:e,state_id:n,building_id:this.buildingId,org_slug:this.orgSlug,building_slug:this.buildingSlug,website_origin:null===(r=this.leadSourceInput)||void 0===r?void 0:r.websiteOrigin,website_search:null===(o=this.leadSourceInput)||void 0===o?void 0:o.websiteSearch,query_parameters:null===(a=this.leadSourceInput)||void 0===a?void 0:a.queryParameters,referrer:null===(s=this.leadSourceInput)||void 0===s?void 0:s.referrer,parsed_utm_source:null===(l=this.leadSourceInput)||void 0===l?void 0:l.parsedUtmSource,campaign_sources:null===(u=this.leadSourceInput)||void 0===u?void 0:u.campaignSources,lead_source_output:this.leadSource,google_analytics_client_id:mi()(d)?null:d,extras:null!=c?c:null}),null}catch(e){return null}}async getCookieValue(e){try{const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const i=t[n].trim();if(i.startsWith(e+"="))return i.substring((e+"=").length,-1===i.indexOf(";")?void 0:i.indexOf(";"))}return null}catch(e){console.error("error getting cookie value")}return null}async generateUserLeadSource({leadId:e,orgSlug:t,buildingSlug:n}){try{const i={queryParams:pi(),buildingSlug:n,referrer:document.referrer,campaignSources:li()};let r=!1;const o=n?this.getLeadSourceBodyIfValid(n):null;if(o){if(!["test-company","daf00bd2-1ecb-482c-b6f4-e1c5511a01be"].includes(t))return this.leadSource=o.leadSource,this.leadSource;{const e=await this.fetchCurrentParsedLeadSource(i);if(!e)return this.leadSource=o.leadSource,this.leadSource;this.leadSource=e,r=!0}}const a=await this.fetchCurrentParsedLeadSource(i);if(this.leadSource=a,this.buildingId=null,this.orgSlug=t,this.buildingSlug=n,n&&!a){const e=this.getLeadSourceBodyIfValid(n);if(e)return this.leadSource=e.leadSource,this.leadSource}if(n){const t=!!a&&a.length>0;this.updateLeadSourceLocalStorage(n,a,e,!t&&!r,r)}return a}catch(e){console.error(e)}return null}},this.myPubnub=new Gr(this.buildingSlug,this.building,this.orgSlug,null,d.leadId,this.LeadSourceClient,this.widgetType),this.LeadSourceClient.chatId=this.myPubnub.channel,await(null===(e=this.LeadSourceClient)||void 0===e?void 0:e.generateUserLeadSource({leadId:null!==(i=null===(n=this.myPubnub)||void 0===n?void 0:n.leadUserId)&&void 0!==i?i:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug})),console.log("EliseAI Mapped Lead Source source: ",null===(r=this.LeadSourceClient)||void 0===r?void 0:r.leadSource),"property-website"!==gi(this.orgSlug)?this.myPubnub.leadSource=null!==(a=null===(o=this.LeadSourceClient)||void 0===o?void 0:o.leadSource)&&void 0!==a?a:gi(this.orgSlug):this.myPubnub.leadSource=null!==(l=null===(s=this.LeadSourceClient)||void 0===s?void 0:s.leadSource)&&void 0!==l?l:null,d.initiatedChat&&await this.myPubnub.initializePubnub(u)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!An(On(t)));return!!e&&!!n&&!pn()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",bn(function(e,t){Le(2,arguments);var n=nt(t);return it(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.handleKeydownTab=e=>{var t,n,i,r,o,a,s,l,u,d,c,p,h,f,m,g,v,y,b,w;if("Tab"===e.key){const S=this.displayPubnubChat?null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"):null!==(m=null!==(u=null===(l=null===(s=null===(a=null===(o=null===(r=this.shadowRoot)||void 0===r?void 0:r.getElementById("meetelise-launcher"))||void 0===o?void 0:o.shadowRoot)||void 0===a?void 0:a.getElementById("email-us-window"))||void 0===s?void 0:s.shadowRoot)||void 0===l?void 0:l.getElementById("email-us-form"))&&void 0!==u?u:null===(f=null===(h=null===(p=null===(c=null===(d=this.shadowRoot)||void 0===d?void 0:d.getElementById("meetelise-launcher"))||void 0===c?void 0:c.shadowRoot)||void 0===p?void 0:p.getElementById("tour-scheduler-window"))||void 0===h?void 0:h.shadowRoot)||void 0===f?void 0:f.getElementById("scheduler-container"))&&void 0!==m?m:null===(w=null===(b=null===(y=null===(v=null===(g=this.shadowRoot)||void 0===g?void 0:g.getElementById("meetelise-launcher"))||void 0===v?void 0:v.shadowRoot)||void 0===y?void 0:y.getElementById("call-us-window"))||void 0===b?void 0:b.shadowRoot)||void 0===w?void 0:w.getElementById("details-window");if(!S)return;e.preventDefault();const T=S.querySelectorAll("input, me-select, textarea, action-confirm-button, [tabindex]"),x=Array.from(T),A=x.findIndex((e=>e.matches(":focus")));x[(A+1)%x.length].focus()}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")},this.renderChatAdditionalActions=(e,t)=>{const n=this.building&&De(this.building.orgId,this.building.id)&&this.primaryColor&&this.primaryColor!==Me?ke(this.primaryColor,.6):"black";return U` <style>
4445
+ `;var wo=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 So=class extends re{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this.chatId="",this.analytics=null,this.launcher=null,this.building=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=$n.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=Fo.Default,this.onWidgetLoaded=rr(),this.onSstClose=rr(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=xe(),this.firstUpdated=async()=>this.setupWebchat(),this.shouldShowWebchat=async(e,n)=>{const i=.01;if(!e)return console.warn("MeetElise Chat will NOT appear. Building does NOT exist."),ci({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!1,extra_data:{webchat_no_show_reason:"building_does_not_exist"}},sampleRate:i}),!1;if(!e.launchedDateTime)return console.warn("MeetElise Chat will NOT appear. Building is NOT launched (based on launched date time)."),ci({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!1,extra_data:{webchat_no_show_reason:"building_not_launched"}},sampleRate:i}),!1;if(!e.active)return console.warn("MeetElise Chat will NOT appear. Building is NOT active."),ci({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!1,extra_data:{webchat_no_show_reason:"building_not_active"}},sampleRate:i}),!1;if(!e.webchatScopeConfigured)return console.warn("MeetElise Chat will NOT appear. Building is NOT webchat scope configured."),ci({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!1,extra_data:{webchat_no_show_reason:"building_not_webchat_scope_configured"}},sampleRate:i}),!1;const r=await async function(e){if(!e)return!1;try{return(await t().get(Xn(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-leasing-in-maintenance-mode",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(n);return!r||(console.warn("MeetElise Chat will NOT appear. Chat is in maintenance mode."),ci({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!1,extra_data:{webchat_no_show_reason:"building_in_maintenance_mode"}},sampleRate:i}),!1)},this.setupWebchat=async()=>{if(!this.buildingSlug||!this.orgSlug)return;const e=await xi(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,n)=>{const i=window.rentgrata;if(!i)return;const r=i.Widget;if(!r)return;const o=r.config;if(!o)return;const a=o.widgetKey;a&&await t().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=n?n:""}})})(this.buildingSlug,this.orgSlug)}catch(e){console.warn("Error updating rentgrata token",e)}await this.shouldShowWebchat(e,this.buildingSlug)&&(ci({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==e?void 0:e.launchedDateTime)?.01:.05}),this.building=e,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1,"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0))},this.setBuildingDerivedInfo=async()=>{var e,n,i,r,o,a,s,l,u,d,c,p,h,f,m,g,v,y,b,w,S,T,x,A,C,O,I,N,E;const R=this.building;if(!R)return;R&&this.orgSlug&&xo(this.orgSlug,null!==(n=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==n?n:null,this.sampleRateToUse,this.buildingSlug,null!==(r=null===(i=this.LeadSourceClient)||void 0===i?void 0:i.leadSource)&&void 0!==r?r:null);const[_,P,M,F,k,D,U]=await Promise.all([Ni(this.buildingSlug),Ar(this.orgSlug,this.buildingSlug),Yn(this.buildingSlug),Zn(this.buildingSlug),Ii(R.id),ei(this.buildingSlug),ti(this.buildingSlug)]);this.building&&(this.building.phoneNumber=Ne(R.phoneNumber)),this.designConcept=null!==(o=null==_?void 0:_.abTestType)&&void 0!==o?o:"",this.leadSources=P,this.featureFlagShowDropdown=M;const B=R.textWithUsPhoneNumber?R.textWithUsPhoneNumber:await(async e=>{try{const n="https://app.meetelise.com",i=await t().get(`${n}/platformApi/webchat/${e}/phone-number`);if(i.data)return i.data}catch(t){return di({logType:ui.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t}}),null}return null})(this.buildingSlug);var L,q;this.enabledChatWidgets={callDesktop:null!==(a=null==k?void 0:k.shouldShowPhoneDesktop)&&void 0!==a&&a,callMobile:null!==(s=null==k?void 0:k.shouldShowPhoneMobile)&&void 0!==s&&s,chatDesktop:null!==(l=null==k?void 0:k.shouldShowChatDesktop)&&void 0!==l&&l,chatMobile:null!==(u=null==k?void 0:k.shouldShowChatMobile)&&void 0!==u&&u,emailDesktop:null!==(d=null==k?void 0:k.shouldShowEmailDesktop)&&void 0!==d&&d,emailMobile:null!==(c=null==k?void 0:k.shouldShowEmailMobile)&&void 0!==c&&c,textDesktop:null!==(p=(null==k?void 0:k.shouldShowTextDesktop)&&!!B)&&void 0!==p&&p,textMobile:null!==(h=(null==k?void 0:k.shouldShowTextMobile)&&!!B)&&void 0!==h&&h,sstDesktop:null!==(f=null==k?void 0:k.shouldShowSstDesktop)&&void 0!==f&&f,sstMobile:null!==(m=null==k?void 0:k.shouldShowSstMobile)&&void 0!==m&&m},this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(q=this.handleTourClicked,document.querySelectorAll("a").forEach((function(e){const t=e.getAttribute("href");t&&t.startsWith("https://app.meetelise.com/")&&e.addEventListener("click",(e=>{e.preventDefault(),q(e)}))})),U&&(e=>{document.querySelectorAll('a[href$="schedule-a-tour"]').forEach((t=>{t&&t.addEventListener("click",(t=>{t.preventDefault(),e(t)}))}))})(this.handleTourClicked),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach((t=>{var n;if(!t)return;const i=document.createElement("a");i.innerHTML=t.innerHTML,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===(g=this.LeadSourceClient)||void 0===g?void 0:g.leadSource)&&(L=null!==(y=null===(v=this.LeadSourceClient)||void 0===v?void 0:v.leadSource)&&void 0!==y?y: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(L)}`)}}))),k&&(this.primaryColor=null!==(b=k.primaryColor)&&void 0!==b?b:null,this.backgroundColor=null!==(w=k.secondaryColor)&&void 0!==w?w:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(S=k.foregroundColorOnPrimaryBackgroundColor)&&void 0!==S?S:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(T=k.foregroundColorOnSecondaryBackgroundColor)&&void 0!==T?T:null,this.webchatConfigHasAutoOpenChat=k.autoOpenChat,this.requiresConsent=k.requiresConsentForChat,this.hideMobileFeatures=k.collapseMobileFeatures,this.privacyPolicyUrl=null!==(x=k.privacyPolicyUrlForChat)&&void 0!==x?x:this.privacyPolicyUrl,k.displayStyle===Ci.MINIMIZED&&(this.isMinimized=!0),k.displayStyle===Ci.PILLS&&(this.designConcept=null),k.displayStyle===Ci.EMOJI&&(this.designConcept=Ci.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Me),null===this.backgroundColor&&(this.backgroundColor=Fe);const J=null!==(C=null===(A=this.building)||void 0===A?void 0:A.phoneNumber)&&void 0!==C?C:"";let j=null;if(F&&(j=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.match,isPropertyWebsiteCatchall:i.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(I=null===(O=this.LeadSourceClient)||void 0===O?void 0:O.leadSource)&&void 0!==I?I:null),j&&!j.isMatch&&(j.number=J)),D&&(null==j?void 0:j.number)){const e=zr(j.number,this.orgSlug,this.buildingSlug);e>0&&ci({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const H=localStorage.getItem("eliseai_phone_number_devtest");H&&(console.info("Using dev test phone number: ",H),zr(H,this.orgSlug,this.buildingSlug)),this.phoneNumberForSource=j||{number:J,isMatch:!1,isPropertyWebsiteCatchall:!0};const G=null!==(E=null===(N=this.LeadSourceClient)||void 0===N?void 0:N.leadSource)&&void 0!==E?E:null;G&&(this.leadSources.includes(G)||this.leadSources.push(G)),Jn(R.id)},this.initializeChatVariables=async()=>{var e,n,i,r,o,a,s,l;if(!this.building)return;const u=Br(this.buildingSlug),d=Lr(this.buildingSlug,u)?u:Ur(this.buildingSlug,!1);if(!d.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new class{constructor(){this.chatId=null,this.apiHost="https://app.meetelise.com",this.leadSource=null,this.localStorageTTLDays=30,this.buildingId=null,this.orgSlug=null,this.buildingSlug=null,this.queryParameters=null,this.leadSourceInput=null,this.updateLeadSourceLocalStorage=(e,t,n,i,r)=>{const o=pi();if(this.leadSourceInput={websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:o,referrer:document.referrer,parsedUtmSource:o?o.utm_source:null,campaignSources:Object.values(li()).filter((e=>e))},i)return;if(!r){const t=this.getLeadSourceBodyIfValid(e);if(t&&!hn(t.timestamp,24*this.localStorageTTLDays))return{...t,timestamp:On(t.timestamp)}}const a={leadSource:t,leadId:n,buildingSlug:e,timestamp:bn(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:On(a.timestamp)}},this.getLeadSourceBodyIfValid=e=>{const t=localStorage.getItem("com.elise.webchat.leadsource.slug="+e);if(t)try{const n=JSON.parse(t);if(n.buildingSlug===e&&n.leadSource&&n.leadId&&n.timestamp&&!hn(On(n.timestamp),24*this.localStorageTTLDays)){try{this.leadSourceInput=n.leadSourceInput}catch(e){console.error("Error parsing leadSourceInput from localStorage")}return n}}catch(e){return null}return null}}async fetchCurrentParsedLeadSource({buildingSlug:e,queryParams:n,referrer:i,campaignSources:r}){try{return(await t().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,{query_params:n,building_slug:e,referrer:i,campaign_sources:r})).data}catch(e){return null}}async checkAndHandleForLogLeadSource({webchatAction:e,stateId:n}){var i,r,o,a,s,l,u;try{if(!this.chatId)return console.error("chatId is not set"),null;if(!this.orgSlug)return console.error("orgId is not set"),null;let d=null,c=null;try{if("f1ba5a20-d207-4e5a-879e-65199e7d0a53"===this.orgSlug){const e=await this.getCookieValue("_ga");e&&(d=e),c=null===(i=window.dataLayer.find((e=>{var t;return"gtagApiGet"==(null===(t=e.value)||void 0===t?void 0:t.event)})))||void 0===i?void 0:i.value}}catch(e){console.error("error getting cookie")}return await t().post(`${this.apiHost}/platformApi/webchat/log/lead-source`,{chat_id:this.chatId,webchat_action:e,state_id:n,building_id:this.buildingId,org_slug:this.orgSlug,building_slug:this.buildingSlug,website_origin:null===(r=this.leadSourceInput)||void 0===r?void 0:r.websiteOrigin,website_search:null===(o=this.leadSourceInput)||void 0===o?void 0:o.websiteSearch,query_parameters:null===(a=this.leadSourceInput)||void 0===a?void 0:a.queryParameters,referrer:null===(s=this.leadSourceInput)||void 0===s?void 0:s.referrer,parsed_utm_source:null===(l=this.leadSourceInput)||void 0===l?void 0:l.parsedUtmSource,campaign_sources:null===(u=this.leadSourceInput)||void 0===u?void 0:u.campaignSources,lead_source_output:this.leadSource,google_analytics_client_id:mi()(d)?null:d,extras:null!=c?c:null}),null}catch(e){return null}}async getCookieValue(e){try{const t=document.cookie.split(";");for(let n=0;n<t.length;n++){const i=t[n].trim();if(i.startsWith(e+"="))return i.substring((e+"=").length,-1===i.indexOf(";")?void 0:i.indexOf(";"))}return null}catch(e){console.error("error getting cookie value")}return null}async generateUserLeadSource({leadId:e,orgSlug:t,buildingSlug:n}){try{const i={queryParams:pi(),buildingSlug:n,referrer:document.referrer,campaignSources:li()};let r=!1;const o=n?this.getLeadSourceBodyIfValid(n):null;if(o){if(!["test-company","daf00bd2-1ecb-482c-b6f4-e1c5511a01be"].includes(t))return this.leadSource=o.leadSource,this.leadSource;{const e=await this.fetchCurrentParsedLeadSource(i);if(!e)return this.leadSource=o.leadSource,this.leadSource;this.leadSource=e,r=!0}}const a=await this.fetchCurrentParsedLeadSource(i);if(this.leadSource=a,this.buildingId=null,this.orgSlug=t,this.buildingSlug=n,n&&!a){const e=this.getLeadSourceBodyIfValid(n);if(e)return this.leadSource=e.leadSource,this.leadSource}if(n){const t=!!a&&a.length>0;this.updateLeadSourceLocalStorage(n,a,e,!t&&!r,r)}return a}catch(e){console.error(e)}return null}},this.myPubnub=new Gr(this.buildingSlug,this.building,this.orgSlug,null,d.leadId,this.LeadSourceClient,this.widgetType),this.LeadSourceClient.chatId=this.myPubnub.channel,await(null===(e=this.LeadSourceClient)||void 0===e?void 0:e.generateUserLeadSource({leadId:null!==(i=null===(n=this.myPubnub)||void 0===n?void 0:n.leadUserId)&&void 0!==i?i:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug})),console.log("EliseAI Mapped Lead Source source: ",null===(r=this.LeadSourceClient)||void 0===r?void 0:r.leadSource),"property-website"!==gi(this.orgSlug)?this.myPubnub.leadSource=null!==(a=null===(o=this.LeadSourceClient)||void 0===o?void 0:o.leadSource)&&void 0!==a?a:gi(this.orgSlug):this.myPubnub.leadSource=null!==(l=null===(s=this.LeadSourceClient)||void 0===s?void 0:s.leadSource)&&void 0!==l?l:null,d.initiatedChat&&await this.myPubnub.initializePubnub(u)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!An(On(t)));return!!e&&!!n&&!pn()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",bn(function(e,t){Le(2,arguments);var n=nt(t);return it(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.handleKeydownTab=e=>{var t,n,i,r,o,a,s,l,u,d,c,p,h,f,m,g,v,y,b,w;if("Tab"===e.key){const S=this.displayPubnubChat?null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"):null!==(m=null!==(u=null===(l=null===(s=null===(a=null===(o=null===(r=this.shadowRoot)||void 0===r?void 0:r.getElementById("meetelise-launcher"))||void 0===o?void 0:o.shadowRoot)||void 0===a?void 0:a.getElementById("email-us-window"))||void 0===s?void 0:s.shadowRoot)||void 0===l?void 0:l.getElementById("email-us-form"))&&void 0!==u?u:null===(f=null===(h=null===(p=null===(c=null===(d=this.shadowRoot)||void 0===d?void 0:d.getElementById("meetelise-launcher"))||void 0===c?void 0:c.shadowRoot)||void 0===p?void 0:p.getElementById("tour-scheduler-window"))||void 0===h?void 0:h.shadowRoot)||void 0===f?void 0:f.getElementById("scheduler-container"))&&void 0!==m?m:null===(w=null===(b=null===(y=null===(v=null===(g=this.shadowRoot)||void 0===g?void 0:g.getElementById("meetelise-launcher"))||void 0===v?void 0:v.shadowRoot)||void 0===y?void 0:y.getElementById("call-us-window"))||void 0===b?void 0:b.shadowRoot)||void 0===w?void 0:w.getElementById("details-window");if(!S)return;e.preventDefault();const T=S.querySelectorAll("input, me-select, textarea, action-confirm-button, [tabindex]"),x=Array.from(T),A=x.findIndex((e=>e.matches(":focus")));x[(A+1)%x.length].focus()}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")},this.renderChatAdditionalActions=(e,t)=>{const n=this.building&&De(this.building.orgId,this.building.id)&&this.primaryColor&&this.primaryColor!==Me?ke(this.primaryColor,.6):"black";return U` <style>
4446
4446
  #{id}::after {
4447
4447
  border-right-color: ${n} !important;
4448
4448
  }
@@ -255,6 +255,7 @@ export class MEChat extends LitElement {
255
255
  building: Building | null,
256
256
  buildingSlug: string
257
257
  ): Promise<boolean> => {
258
+ const sampleRateForWebchat = 0.01;
258
259
  if (!building) {
259
260
  // eslint-disable-next-line no-console
260
261
  console.warn("MeetElise Chat will NOT appear. Building does NOT exist.");
@@ -268,7 +269,7 @@ export class MEChat extends LitElement {
268
269
  webchat_no_show_reason: "building_does_not_exist",
269
270
  },
270
271
  },
271
- sampleRate: this.sampleRateToUse,
272
+ sampleRate: sampleRateForWebchat,
272
273
  });
273
274
  return false;
274
275
  }
@@ -287,7 +288,7 @@ export class MEChat extends LitElement {
287
288
  webchat_no_show_reason: "building_not_launched",
288
289
  },
289
290
  },
290
- sampleRate: this.sampleRateToUse,
291
+ sampleRate: sampleRateForWebchat,
291
292
  });
292
293
  return false;
293
294
  }
@@ -304,7 +305,7 @@ export class MEChat extends LitElement {
304
305
  webchat_no_show_reason: "building_not_active",
305
306
  },
306
307
  },
307
- sampleRate: this.sampleRateToUse,
308
+ sampleRate: sampleRateForWebchat,
308
309
  });
309
310
  return false;
310
311
  }
@@ -323,7 +324,7 @@ export class MEChat extends LitElement {
323
324
  webchat_no_show_reason: "building_not_webchat_scope_configured",
324
325
  },
325
326
  },
326
- sampleRate: this.sampleRateToUse,
327
+ sampleRate: sampleRateForWebchat,
327
328
  });
328
329
  return false;
329
330
  }
@@ -347,7 +348,7 @@ export class MEChat extends LitElement {
347
348
  webchat_no_show_reason: "building_in_maintenance_mode",
348
349
  },
349
350
  },
350
- sampleRate: this.sampleRateToUse,
351
+ sampleRate: sampleRateForWebchat,
351
352
  });
352
353
  return false;
353
354
  }
@@ -366,9 +367,6 @@ export class MEChat extends LitElement {
366
367
  }
367
368
  }
368
369
 
369
- // We use a lower sample rate if not launched yet because likely still in onboarding process
370
- this.sampleRateToUse = building?.launchedDateTime ? 0.05 : 0.1;
371
-
372
370
  const shouldShowWebchat = await this.shouldShowWebchat(
373
371
  building,
374
372
  this.buildingSlug
@@ -383,7 +381,8 @@ export class MEChat extends LitElement {
383
381
  is_pixel_on_site: true,
384
382
  is_any_webchat_showing: true,
385
383
  },
386
- sampleRate: this.sampleRateToUse,
384
+ // We use a lower sample rate if not launched yet because likely still in onboarding process
385
+ sampleRate: building?.launchedDateTime ? 0.01 : 0.05,
387
386
  });
388
387
  }
389
388