@meetelise/chat 1.53.1 → 1.53.2
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare type GoogleReserveReferral = {
|
|
2
2
|
rwgToken: string;
|
|
3
|
+
environment: string;
|
|
3
4
|
buildingId: number;
|
|
4
5
|
expiresAt: number;
|
|
5
6
|
};
|
|
@@ -7,6 +8,8 @@ export declare const shouldOpenTourSchedulerFromUrl: () => boolean;
|
|
|
7
8
|
/**
|
|
8
9
|
* Remembers a click from a building's Google listing, which arrives with an
|
|
9
10
|
* `rwg_token` query param, so a booking within 30 days can be reported back.
|
|
11
|
+
* Only links from our feed count: other integrations' links carry an
|
|
12
|
+
* `rwg_token` too.
|
|
10
13
|
*/
|
|
11
14
|
export declare const storeGoogleReserveReferral: (buildingId: number) => void;
|
|
12
15
|
/**
|
package/package.json
CHANGED
package/public/dist/index.js
CHANGED
|
@@ -1553,7 +1553,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
1553
1553
|
gap: 12px;
|
|
1554
1554
|
align-items: center;
|
|
1555
1555
|
}
|
|
1556
|
-
`;class Qo{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:Wo(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const Wo=()=>{var e,t,n,i,r,o;try{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,o=i.get("switch_cls[id]"),a=i.get("ilm"),s=i.get("utm_source");return{entrataCampaignSource:o,realpageCampaignSource:a,utmCampaignSource:s,yardiCampaignSource:r,bozzutoAdSource:Mr("bozzuto_ad_source")}}catch(e){const t=document.createElement("iframe");if(t.style.display="none",document.body.appendChild(t),!t.contentWindow)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const n=t.contentWindow.URL;if(!n)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const a=new n(window.location.href).searchParams,s=null!==(o=null===(r=null===(i=window.RCTPCampaign)||void 0===i?void 0:i.CampaignDetails)||void 0===r?void 0:r.Source)&&void 0!==o?o:null;return{entrataCampaignSource:a.get("switch_cls[id]"),realpageCampaignSource:a.get("ilm"),utmCampaignSource:a.get("utm_source"),yardiCampaignSource:s,bozzutoAdSource:Mr("bozzuto_ad_source")}}};var qo;!function(e){e.error="error",e.info="info",e.warn="warn"}(qo||(qo={}));const Vo=async({logType:e,buildingSlug:t,orgSlug:n,logTitle:o,logData:a,error:s})=>{var l;if(s instanceof i.AxiosError&&403===(null===(l=s.response)||void 0===l?void 0:l.status))return;await r().post("https://app.meetelise.com/platformApi/webchat/logging",{...a},{headers:{"Content-Type":"application/json","building-slug":null!=t?t:"","org-slug":null!=n?n:"","log-type":null!=e?e:qo.error,"log-title":o.toUpperCase().replace(/\s/g,"_")}})},Yo=async({params:e,sampleRate:t})=>{try{if(Math.random()>=t)return;await r().post("https://app.meetelise.com/platformApi/webchat/log/signal",{...e,website_origin:window.location.origin,website_search:window.location.search})}catch(e){}};var Ko=n(2193),Xo=n.n(Ko);function Zo(e){return"avb"===e?"AVB Company Website":"windsor"===e?"Windsorcommunities.com":"property-website"}const Jo=class{constructor(){this.chatId=null,this.apiHost="https://app.meetelise.com",this.leadSource=null,this.leadSourceParams=null,this.localStorageTTLDays=30,this.buildingId=null,this.orgId=null,this.orgSlug=null,this.buildingSlug=null,this.queryParameters=null,this.leadSourceInput=null,this.updateLeadSourceLocalStorage=(e,t,n,i,r)=>{const o=bo();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(Wo()).filter(e=>e)},i)return;if(!r){const t=this.getLeadSourceBodyIfValid(e);if(t){if(!Ir(t.timestamp,24*this.localStorageTTLDays))return{...t,timestamp:qr(t.timestamp)}}}const a={leadSource:t,leadSourceParams:this.leadSourceParams,leadId:n,buildingSlug:e,timestamp:Br(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:qr(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&&!Ir(qr(n.timestamp),24*this.localStorageTTLDays)){try{this.leadSourceInput=n.leadSourceInput}catch(e){}return n}}catch(e){return null}return null},this.resetLeadSource=()=>{if(!this.buildingSlug)return!1;const e="com.elise.webchat.leadsource.slug="+this.buildingSlug;return localStorage.removeItem(e),!0}}async fetchCurrentParsedLeadSource({buildingSlug:e,queryParams:t,referrer:n,campaignSources:i}){const o={query_params:t,building_slug:e,referrer:n,campaign_sources:i};try{return(await r().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,o)).data}catch(e){return null}}async checkAndHandleForLogLeadSource({webchatAction:e,stateId:t}){var n,i,o,a,s,l,u;try{if(!this.chatId)return null;if(!this.orgSlug)return null;let d=null,c=null;try{if("f1ba5a20-d207-4e5a-879e-65199e7d0a53"===this.orgSlug){const e=await this.getCookieValue("_ga");e&&(d=e),c=null===(n=window.dataLayer.find(e=>{var t;return"gtagApiGet"==(null===(t=e.value)||void 0===t?void 0:t.event)}))||void 0===n?void 0:n.value}}catch(e){}return await r().post(`${this.apiHost}/platformApi/webchat/log/lead-source`,{chat_id:this.chatId,webchat_action:e,state_id:t,building_id:this.buildingId,org_slug:this.orgSlug,building_slug:this.buildingSlug,website_origin:null===(i=this.leadSourceInput)||void 0===i?void 0:i.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:Xo()(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){}return null}async generateUserLeadSource({leadId:e,orgSlug:t,buildingSlug:n}){var i,r,o;try{const a={queryParams:bo(),buildingSlug:n,referrer:document.referrer,campaignSources:Wo()};let s=!1;const l=n?this.getLeadSourceBodyIfValid(n):null;if(l){if(!["test-company","daf00bd2-1ecb-482c-b6f4-e1c5511a01be"].includes(t))return this.leadSource=l.leadSource,this.leadSourceParams=null!==(r=l.leadSourceParams)&&void 0!==r?r:null,this.leadSource;{const e=await this.fetchCurrentParsedLeadSource(a);if(!e)return this.leadSource=l.leadSource,this.leadSourceParams=null!==(i=l.leadSourceParams)&&void 0!==i?i:null,this.leadSource;this.leadSource=e,s=!0}}const u=await this.fetchCurrentParsedLeadSource(a);if(this.leadSource=u,this.buildingId=null,this.orgSlug=t,this.buildingSlug=n,n&&!u){const e=this.getLeadSourceBodyIfValid(n);if(e)return this.leadSource=e.leadSource,this.leadSourceParams=null!==(o=e.leadSourceParams)&&void 0!==o?o:null,this.leadSource}if(n){const t=!!u&&u.length>0;this.updateLeadSourceLocalStorage(n,u,e,!t&&!s,s)}return u}catch(e){}return null}},ea=async(e,t=!1)=>{const n=`https://app.meetelise.com/eliseCrmApi/building/${e}/scheduling_status?observe_dynamic_scheduling=${t}`;try{return(await r().get(n)).data.is_enabled}catch(e){return!1}};var ta,na,ia;!function(e){e.EMOJI="emoji",e.PILLS="pills",e.MINIMIZED="minimized"}(ta||(ta={})),function(e){e.UNKNOWN="UNKNOWN",e.SELF_GUIDED="SELF_GUIDED",e.VIRTUAL_SHOWING="VIRTUAL_SHOWING",e.WITH_AGENT="WITH_AGENT",e.MEDIA_TOUR="MEDIA_TOUR",e.OPEN_HOUSE_STUDIO="OPEN_HOUSE_STUDIO",e.OPEN_HOUSE_1BR="OPEN_HOUSE_1BR",e.OPEN_HOUSE_2BR="OPEN_HOUSE_2BR",e.OPEN_HOUSE_3BR="OPEN_HOUSE_3BR",e.OPEN_HOUSE_4BR="OPEN_HOUSE_4BR",e.OPEN_HOUSE_5BR="OPEN_HOUSE_5BR"}(na||(na={})),function(e){e.LINK="link",e.CLIENT_SCHEDULED="client_scheduled",e.SCHEDULED_BY_ME_MANAGED_BY_ME="scheduled_by_ME_managed_by_ME",e.SCHEDULED_BY_ME_MANAGED_BY_CLIENT="scheduled_by_ME_managed_by_client",e.SCHEDULED_BY_ME_MANAGED_BY_CONCIERGE="scheduled_by_ME_managed_by_concierge"}(ia||(ia={}));const ra=(e,t)=>"link"===(null==t?void 0:t.toLowerCase());async function oa(e,t){const n=`https://app.meetelise.com/api/pub/v1/organization/${e}/building/${t}/v2`,i=await r().get(n);return aa(i.data)}const aa=e=>{var t;try{e.welcomeMessage=sa(null!==(t=e.welcomeMessage)&&void 0!==t?t:"",e.userFirstName)}catch(e){}return e},sa=(e,t)=>e.replace(/elise/gi,t);var la=n(7035),ua=n(6353);function da(e,t,n){var i=function(e,t,n){if(n&&!n.code)throw new Error("date-fns-tz error: Please set a language code on the locale object imported from date-fns, e.g. `locale.code = 'en-US'`");return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}(e,n.timeZone,n.locale);return i.formatToParts?function(e,t){for(var n=e.formatToParts(t),i=n.length-1;i>=0;--i)if("timeZoneName"===n[i].type)return n[i].value}(i,t):function(e,t){var n=e.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(n);return i?i[0].substr(1):""}(i,t)}function ca(e,t){var n=function(e){if(!pa[e]){var t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"06/25/2014 00:00:00"===t;pa[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return pa[e]}(t);return n.formatToParts?function(e,t){try{for(var n=e.formatToParts(t),i=[],r=0;r<n.length;r++){var o=ha[n[r].type];o>=0&&(i[o]=parseInt(n[r].value,10))}return i}catch(e){if(e instanceof RangeError)return[NaN];throw e}}(n,e):function(e,t){var n=e.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[i[3],i[1],i[2],i[4],i[5],i[6]]}(n,e)}var ha={year:0,month:1,day:2,hour:3,minute:4,second:5};var pa={};function fa(e,t,n,i,r,o,a){var s=new Date(0);return s.setUTCFullYear(e,t,n),s.setUTCHours(i,r,o,a),s}var ga=36e5,ma={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function ya(e,t,n){var i,r,o;if(!e)return 0;if(i=ma.timezoneZ.exec(e))return 0;if(i=ma.timezoneHH.exec(e))return va(o=parseInt(i[1],10))?-o*ga:NaN;if(i=ma.timezoneHHMM.exec(e)){o=parseInt(i[2],10);var a=parseInt(i[3],10);return va(o,a)?(r=Math.abs(o)*ga+6e4*a,"+"===i[1]?-r:r):NaN}if(function(e){if(wa[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),wa[e]=!0,!0}catch(e){return!1}}(e)){t=new Date(t||Date.now());var s=n?t:function(e){return fa(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),l=ba(s,e),u=n?l:function(e,t,n){var i=e.getTime(),r=i-t,o=ba(new Date(r),n);if(t===o)return t;r-=o-t;var a=ba(new Date(r),n);if(o===a)return o;return Math.max(o,a)}(t,l,e);return-u}return NaN}function ba(e,t){var n=ca(e,t),i=fa(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime(),r=e.getTime(),o=r%1e3;return i-(r-=o>=0?o:1e3+o)}function va(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var wa={};var Ca={X:function(e,t,n,i){var r=xa(i.timeZone,e);if(0===r)return"Z";switch(t){case"X":return Aa(r);case"XXXX":case"XX":return Sa(r);default:return Sa(r,":")}},x:function(e,t,n,i){var r=xa(i.timeZone,e);switch(t){case"x":return Aa(r);case"xxxx":case"xx":return Sa(r);default:return Sa(r,":")}},O:function(e,t,n,i){var r=xa(i.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+function(e,t){var n=e>0?"-":"+",i=Math.abs(e),r=Math.floor(i/60),o=i%60;if(0===o)return n+String(r);var a=t||"";return n+String(r)+a+$a(o,2)}(r,":");default:return"GMT"+Sa(r,":")}},z:function(e,t,n,i){switch(t){case"z":case"zz":case"zzz":return da("short",e,i);default:return da("long",e,i)}}};function xa(e,t){var n=e?ya(e,t,!0)/6e4:t.getTimezoneOffset();if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+e);return n}function $a(e,t){for(var n=e<0?"-":"",i=Math.abs(e).toString();i.length<t;)i="0"+i;return n+i}function Sa(e,t){var n=t||"",i=e>0?"-":"+",r=Math.abs(e);return i+$a(Math.floor(r/60),2)+n+$a(Math.floor(r%60),2)}function Aa(e,t){return e%60==0?(e>0?"-":"+")+$a(Math.abs(e)/60,2):Sa(e,t)}const Ea=Ca;var Ta=n(9784),ka=n(9720);var _a=36e5,Oa=6e4,Pa={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function Ia(e,t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);var n=t||{},i=null==n.additionalDigits?2:Ta(n.additionalDigits);if(2!==i&&1!==i&&0!==i)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var r=function(e){var t,n={},i=Pa.dateTimePattern.exec(e);i?(n.date=i[1],t=i[3]):(i=Pa.datePattern.exec(e))?(n.date=i[1],t=i[2]):(n.date=null,t=e);if(t){var r=Pa.timeZone.exec(t);r?(n.time=t.replace(r[1],""),n.timeZone=r[1].trim()):n.time=t}return n}(e),o=function(e,t){var n,i=Pa.YYY[t],r=Pa.YYYYY[t];if(n=Pa.YYYY.exec(e)||r.exec(e)){var o=n[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(n=Pa.YY.exec(e)||i.exec(e)){var a=n[1];return{year:100*parseInt(a,10),restDateString:e.slice(a.length)}}return{year:null}}(r.date,i),a=o.year,s=function(e,t){if(null===t)return null;var n,i,r,o;if(0===e.length)return(i=new Date(0)).setUTCFullYear(t),i;if(n=Pa.MM.exec(e))return i=new Date(0),Ua(t,r=parseInt(n[1],10)-1)?(i.setUTCFullYear(t,r),i):new Date(NaN);if(n=Pa.DDD.exec(e)){i=new Date(0);var a=parseInt(n[1],10);return function(e,t){if(t<1)return!1;var n=La(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,a)?(i.setUTCFullYear(t,0,a),i):new Date(NaN)}if(n=Pa.MMDD.exec(e)){i=new Date(0),r=parseInt(n[1],10)-1;var s=parseInt(n[2],10);return Ua(t,r,s)?(i.setUTCFullYear(t,r,s),i):new Date(NaN)}if(n=Pa.Www.exec(e))return Ra(t,o=parseInt(n[1],10)-1)?Ma(t,o):new Date(NaN);if(n=Pa.WwwD.exec(e)){o=parseInt(n[1],10)-1;var l=parseInt(n[2],10)-1;return Ra(t,o,l)?Ma(t,o,l):new Date(NaN)}return null}(o.restDateString,a);if(isNaN(s))return new Date(NaN);if(s){var l,u=s.getTime(),d=0;if(r.time&&(d=function(e){var t,n,i;if(t=Pa.HH.exec(e))return Ba(n=parseFloat(t[1].replace(",",".")))?n%24*_a:NaN;if(t=Pa.HHMM.exec(e))return Ba(n=parseInt(t[1],10),i=parseFloat(t[2].replace(",",".")))?n%24*_a+i*Oa:NaN;if(t=Pa.HHMMSS.exec(e)){n=parseInt(t[1],10),i=parseInt(t[2],10);var r=parseFloat(t[3].replace(",","."));return Ba(n,i,r)?n%24*_a+i*Oa+1e3*r:NaN}return null}(r.time),isNaN(d)))return new Date(NaN);if(r.timeZone||n.timeZone){if(l=ya(r.timeZone||n.timeZone,new Date(u+d)),isNaN(l))return new Date(NaN)}else l=ka(new Date(u+d)),l=ka(new Date(u+d+l));return new Date(u+d+l)}return new Date(NaN)}function Ma(e,t,n){t=t||0,n=n||0;var i=new Date(0);i.setUTCFullYear(e,0,4);var r=7*t+n+1-(i.getUTCDay()||7);return i.setUTCDate(i.getUTCDate()+r),i}var Na=[31,28,31,30,31,30,31,31,30,31,30,31],Da=[31,29,31,30,31,30,31,31,30,31,30,31];function La(e){return e%400==0||e%4==0&&e%100!=0}function Ua(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;var i=La(e);if(i&&n>Da[t])return!1;if(!i&&n>Na[t])return!1}return!0}function Ra(e,t,n){return!(t<0||t>52)&&(null==n||!(n<0||n>6))}function Ba(e,t,n){return(null==e||!(e<0||e>=25))&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}var ja=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Fa(e,t,n,i){var r=la(i);return r.timeZone=t,r.originalDate=e,function(e,t,n){var i=String(t),r=n||{},o=i.match(ja);if(o){var a=Ia(r.originalDate||e,r);i=o.reduce(function(e,t){if("'"===t[0])return e;var n=e.indexOf(t),i="'"===e[n-1],o=e.replace(t,"'"+Ea[t[0]](a,t,null,r)+"'");return i?o.substring(0,n-1)+o.substring(n+1):o},i)}return ua(e,i,r)}(function(e,t,n){var i=Ia(e,n),r=ya(t,i,!0),o=new Date(i.getTime()-r),a=new Date(0);return a.setFullYear(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()),a.setHours(o.getUTCHours(),o.getUTCMinutes(),o.getUTCSeconds(),o.getUTCMilliseconds()),a}(e,t),n,r)}const Ha="com.eliseai.webchat.googlereserve.referral",Ga=async({buildingSlug:e})=>{try{const t=await r().get(`${Sr}/platformApi/webchat/${e}/units/summary`);if(t.data)return Er(t.data)}catch(t){Vo({logType:qo.error,buildingSlug:e,logTitle:"[ERROR_GETTING_UNITS_SUMMARY]",logData:{error:t},error:t})}return[]};var za=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 Qa=class extends oe{constructor(){super(...arguments),this.tourTypeOptions=[],this.layoutOptions=[],this.chatId="",this.buildingId=0,this.orgId=0,this.leadSourceParams=null,this.buildingSlug="",this.sgtUrl="",this.selfGuidedToursTypeOffered="",this.selfGuidedTourEnabled=!1,this.escortedToursLink="",this.escortedToursTypeOffered="",this.virtualToursLink="",this.virtualToursTypeOffered="",this.orgSlug="",this.hasDynamicSchedulingEnabled=!1,this.bedroomPreferenceRequired=!1,this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingName="",this.tourType=null,this.shouldShowTourType={[Wa.Guided]:!0,[Wa.Self]:!0,[Wa.Virtual]:!0},this.email="",this.phoneNumber="",this.phoneNumberE164=null,this.phoneCountry=null,this.phoneNumberIsValid=!1,this.phoneNumberHasBlurred=!1,this.availabilitiesGroupedByDay={},this.calendarTimeZone=Intl.DateTimeFormat().resolvedOptions().timeZone,this.waitingForAvailabilities=!0,this.mobilePageIndex=0,this.isSubmitting=!1,this.tourIsBooked=!1,this.shouldAllowScheduling=!1,this.shouldAllowScheduleLoading=!0,this.promptForReschedule=!1,this.canceledReschedule=!1,this.leadSources=[],this.orgLegalName="",this.country=null,this.buildingState=null,this.currentLeadSource="",this.featureFlagShowDropdown="",this.compactDesign=!1,this.primaryColor=Vn,this.foregroundColorOnPrimaryBackgroundColor="white",this.firstNameInputValue="",this.lastNameInputValue="",this.leadSourceInputValue="",this.selectedLayoutValue="",this.selectedUnitValue="",this.units=[],this.allowOccupiedUnitTours=!1,this.errorGettingAvailabilities=!1,this.centralConvoBuildings=[],this.isGeneralBuilding=!1,this.statusMessage="",this._setAvailabilities=async()=>{try{const[e,t]=await Promise.all([ea(this.buildingId,this.hasDynamicSchedulingEnabled),ao()]);this.shouldAllowScheduling=e,this.shouldAllowScheduleLoading=!1,this.calendarTimeZone=await(async e=>{var t;return null!==(t=(await ro(e)).calendarTimeZone)&&void 0!==t?t:Intl.DateTimeFormat().resolvedOptions().timeZone})(this.buildingId),Vo({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:t,logType:qo.info,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});const n=Object.values(t).every(e=>!1===e),i=!this.sgtUrl&&!this.escortedToursLink&&!this.virtualToursLink;if(n&&i)return this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,void Vo({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:qo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});this.shouldShowTourType={[Wa.Guided]:this.tourTypeOptions.map(e=>e.value).includes("WITH_AGENT")&&(t[Wa.Guided]||!!this.escortedToursLink),[Wa.Self]:this.tourTypeOptions.map(e=>e.value).includes("SELF_GUIDED")&&(t[Wa.Self]||!!this.sgtUrl),[Wa.Virtual]:this.tourTypeOptions.map(e=>e.value).includes("VIRTUAL_SHOWING")&&(t[Wa.Virtual]||!!this.virtualToursLink)};const r=1===Object.values(this.shouldShowTourType).reduce((e,t)=>!0===t?e+1:e,0);if(this._setDefaultSelectedDateAndTimes(),r&&(this.tourType=Object.keys(this.shouldShowTourType).find(e=>this.shouldShowTourType[e])),null===this.tourType)return void(this.waitingForAvailabilities=!1);this.availabilitiesGroupedByDay=await so(qa[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,Vo({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}},this._setDefaultSelectedDateAndTimes=async(e,t)=>{var n,i,r;const o=await ro(this.buildingId),a=null!=e?e:this._getHighestRankedTourType(o),s=a?null===(r=null===(i=null===(n=o.availability)||void 0===n?void 0:n[a])||void 0===i?void 0:i.availableTourStartTimes)||void 0===r?void 0:r.filter(e=>{if(!t)return!0;return or("string"==typeof e?qr(e):e,t)}):[],l=null==s?void 0:s[0];a&&l&&a!==Fr.Unknown&&a!==Fr.MediaTour&&(this.selectedDate=rr("string"==typeof l?qr(l):l),this.tourType=Va[a],this.selectedTime="string"==typeof l?lo(l):(e=>({datetime:Ji(e,"yyyy-MM-dd'T'HH:mm:ss"),offset:Ji(e,"xxx")}))(l))},this._getHighestRankedTourType=e=>{var t;const n=(null!==(t=e.rankOrderedSupportedTourTypes)&&void 0!==t?t:[]).map(t=>{var n,i;return{tourType:t,availabilities:null===(i=null===(n=e.availability)||void 0===n?void 0:n[t])||void 0===i?void 0:i.availableTourStartTimes}}).filter(e=>{if(e.tourType===Fr.Unknown||e.tourType===Fr.MediaTour)return!1;const t=Va[e.tourType],n=this._getTourTypeOffered(t);return!!n&&(!ra(0,n)&&e.availabilities&&e.availabilities.length>0)}),i=n[0];return i?i.tourType:null},this._getTourTypeOffered=e=>e===Wa.Guided?this.escortedToursTypeOffered:e===Wa.Self?this.selfGuidedToursTypeOffered:e===Wa.Virtual?this.virtualToursTypeOffered:null,this._getUnitOptions=()=>{const e=this.selectedLayoutValue?this.units.filter(e=>Ka(10*e.numberOfBedrooms)===this.selectedLayoutValue):this.units,t=e.map(e=>({label:e.unitNumber,value:e.unitNumber}));return t},this._fetchUnits=async()=>{if(this.buildingSlug)try{this.units=await Ga({buildingSlug:this.buildingSlug})}catch(e){this.units=[],Vo({logTitle:"ERROR_LOADING_UNITS_FOR_TOUR_SCHEDULER",logData:{error:e},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}},this.firstUpdated=async()=>{if(await this._fetchCentralConvoBuildings(),this.isGeneralBuilding)return this.waitingForAvailabilities=!1,this.shouldAllowScheduleLoading=!1,void(this.statusMessage="Please select a building to see tour availabilities.");await this._loadForCurrentBuilding()},this._loadForCurrentBuilding=async()=>{try{await ro(this.buildingId)}catch(e){}await Promise.all([this._setAvailabilities().then(async()=>{try{const e=await ro(this.buildingId);this.allowOccupiedUnitTours=!!e.allowOccupiedUnitTours}catch(e){this.allowOccupiedUnitTours=!1}}),this._fetchUnits()])},this._fetchCentralConvoBuildings=async()=>{if(this.orgSlug&&this.buildingSlug)try{const e=await async function(e,t){var n,i;const o=(await r().get("https://app.meetelise.com/platformApi/webchat/central-convo-buildings-v2",{headers:{"building-slug":t,"org-slug":e}})).data;return{is_general_building:null!==(n=null==o?void 0:o.is_general_building)&&void 0!==n&&n,buildings:null!==(i=null==o?void 0:o.buildings)&&void 0!==i?i:[]}}(this.orgSlug,this.buildingSlug);this.centralConvoBuildings=e.buildings,this.isGeneralBuilding=e.is_general_building}catch(e){this.centralConvoBuildings=[],this.isGeneralBuilding=!1}},this._onBuildingChange=async()=>{var e;const t=null===(e=this.selectedBuildingEl)||void 0===e?void 0:e.value;if(!t||t===this.buildingSlug)return;const n=this.centralConvoBuildings.find(e=>e.slug===t);if(n){this.isGeneralBuilding=!1,this.waitingForAvailabilities=!0,this.errorGettingAvailabilities=!1,this.tourType=null,this.selectedDate=void 0,this.selectedTime=void 0,this.availabilitiesGroupedByDay={},this.mobilePageIndex=0,this.units=[],this.selectedLayoutValue="",this.selectedUnitValue="",this.buildingId=n.building_id,this.buildingSlug=n.slug,this.buildingName=n.name,this.statusMessage=`Loading tours for ${n.name}…`,$o("tourBuildingSelected",{buildingId:n.building_id});try{const e=await oa(this.orgSlug,n.slug);this.sgtUrl=e.sgtUrl,this.selfGuidedToursTypeOffered=e.selfGuidedToursTypeOffered,this.selfGuidedTourEnabled=e.isSelfGuidedTourEnabled,this.escortedToursLink=e.escortedToursLink,this.escortedToursTypeOffered=e.escortedToursTypeOffered,this.virtualToursLink=e.virtualToursLink,this.virtualToursTypeOffered=e.virtualToursTypeOffered,this.tourTypeOptions=e.tourTypeOptions.map(e=>({label:e.label,value:e.value})),this.hasDynamicSchedulingEnabled=e.usesDynamicScheduling}catch(e){}if(await this._loadForCurrentBuilding(),!this.shouldAllowScheduling||this.errorGettingAvailabilities)this.statusMessage=`No tour availabilities for ${n.name}.`;else{const e=Object.values(this.shouldShowTourType).filter(Boolean).length;this.statusMessage=`Showing tours for ${n.name}. ${e} tour type${1===e?"":"s"} available.`}}},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await so(qa[this.tourType]))},this.onChangePhoneNumber=e=>{this.phoneNumber=e.detail.formattedValue,this.phoneNumberE164=e.detail.e164,this.phoneCountry=e.detail.country,this.phoneNumberIsValid=e.detail.isValid},this.onChangeEmail=e=>{e.target&&(this.email=e.target.value)},this.validators={tourType:()=>null!==this.tourType,dateAndTime:()=>!!this.selectedDate&&!!this.selectedTime,leadInfo:()=>{var e,t,n,i;return(!!(null===(e=this.firstNameInput)||void 0===e?void 0:e.value)||!!(null===(t=this.lastNameInput)||void 0===t?void 0:t.value))&&Nr(null!==(i=null===(n=this.emailInput)||void 0===n?void 0:n.value)&&void 0!==i?i:"")&&!!this.phoneNumber&&!!this.phoneNumberE164},layout:()=>!this.bedroomPreferenceRequired||!!this.selectedLayoutValue},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo()&&this.validators.layout(),this.timeStringToHoursAndMinutes=e=>{const[t,n]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(n)]},this.submit=async()=>{var e,t,n,i,o,a,s,l,u,d,c,h,p,f,g,m,y,b,v,w,C,x,$;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const S=this.phoneNumberE164;if(!S)return void(this.phoneNumberIsValid=!1);const A=new URLSearchParams(window.location.search);let E=null;E=this.selectedLeadSource&&this.selectedLeadSource.value&&this.selectedLeadSource.value.length>0?this.selectedLeadSource.value:this.leadSourceInputValue&&this.leadSourceInputValue.length>0?this.leadSourceInputValue:this.currentLeadSource;const T=[...new Set(E?[E,"property-website"]:["property-website"])];this.firstNameInput&&(this.firstNameInputValue=this.firstNameInput.value),this.lastNameInput&&(this.lastNameInputValue=this.lastNameInput.value),this.leadSourceInputValue=E;const k=(null===(e=this.selectedLayoutEl)||void 0===e?void 0:e.value)||this.selectedLayoutValue||null,_=(null===(t=this.selectedUnitEl)||void 0===t?void 0:t.value)||this.selectedUnitValue||null;$o("scheduleTourSubmitted",{email:this.email,phone:S,firstName:null!==(i=null===(n=this.firstNameInput)||void 0===n?void 0:n.value)&&void 0!==i?i:this.firstNameInputValue,lastName:null!==(a=null===(o=this.lastNameInput)||void 0===o?void 0:o.value)&&void 0!==a?a:this.lastNameInputValue,tourType:Ya[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:T.find(e=>"property-website"!==e)||null,layout:k,unit:_,conversationTrackingId:null!==(l=null===(s=this.leadSourceClient)||void 0===s?void 0:s.chatId)&&void 0!==l?l:null});const O=(()=>{var e;try{const t=JSON.parse(null!==(e=localStorage.getItem(Ha))&&void 0!==e?e:"null");return(null==t?void 0:t.rwgToken)&&Date.now()<t.expiresAt?t:null}catch{return null}})(),P={referrer:document.referrer,email_address:this.email,phone_number:S,building_id:this.buildingId,first_name:null!==(d=null===(u=this.firstNameInput)||void 0===u?void 0:u.value)&&void 0!==d?d:this.firstNameInputValue,last_name:null!==(h=null===(c=this.lastNameInput)||void 0===c?void 0:c.value)&&void 0!==h?h:this.lastNameInputValue,tour_type:Ya[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(E?[E,Zo(this.orgSlug)]:[Zo(this.orgSlug)])],query_params:Object.fromEntries(A.entries()),conversation_tracking_id:null===(p=this.leadSourceClient)||void 0===p?void 0:p.chatId,layouts:k?[k]:void 0,unit_numbers:_?[_]:void 0,lead_sources_with_timestamps:(null!==(m=null===(f=this.leadSourceMultitouchClient)||void 0===f?void 0:f.getSafeLeadSourceTouchpointsWithDefault({includedUserSelectedLeadSource:(null===(g=this.selectedLeadSource)||void 0===g?void 0:g.value)&&this.selectedLeadSource.value.length>0?this.selectedLeadSource.value:null}))&&void 0!==m?m:[]).map(e=>Tr({...e})),google_rwg_token:null==O?void 0:O.rwgToken,google_referral_building_id:null==O?void 0:O.buildingId};this.isSubmitting=!0;try{await r().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",P,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"webchatkey-wkjcWAKZjqhLStvP8L6SN8y4FbYmPhdE","org-slug":this.orgSlug}}),null===(y=this.leadSourceClient)||void 0===y||y.checkAndHandleForLogLeadSource({webchatAction:"tour-scheduler",stateId:null}),null===(b=this.leadSourceClient)||void 0===b||b.resetLeadSource(),null===(v=this.leadSourceMultitouchClient)||void 0===v||v.resetLeadSourceTouchpoints(),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e,n=(null===(C=null===(w=t.response)||void 0===w?void 0:w.data)||void 0===C?void 0:C.detail)||"Failed to book tour";if(t.response&&t.response.headers&&t.response.headers["funnel-prospect-conflicting-appointment-error"]){if(this.selectedDate&&this.selectedTime){const e=this.availabilitiesGroupedByDay[Ji(this.selectedDate,"yyyy-MM-dd")];e&&(this.availabilitiesGroupedByDay[Ji(this.selectedDate,"yyyy-MM-dd")]=e.filter(e=>e!==this.selectedTime))}}else{if(409===(null===(x=t.response)||void 0===x?void 0:x.status)&&!this.promptForReschedule&&"User already has a tour scheduled for this building"===n)return this.promptForReschedule=!0,this.isSubmitting=!1,void(this.tourIsBooked=!1);if(409===(null===($=t.response)||void 0===$?void 0:$.status)&&!this.promptForReschedule)return this.isSubmitting=!1,this.tourIsBooked=!1,io(),this.availabilitiesGroupedByDay=await so(qa[this.tourType],this.buildingId),void alert("This timeslot is no longer available. Please select a different time.")}alert(n),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>R`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>R`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>R` <action-confirm-button
|
|
1556
|
+
`;class Qo{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:Wo(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const Wo=()=>{var e,t,n,i,r,o;try{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,o=i.get("switch_cls[id]"),a=i.get("ilm"),s=i.get("utm_source");return{entrataCampaignSource:o,realpageCampaignSource:a,utmCampaignSource:s,yardiCampaignSource:r,bozzutoAdSource:Mr("bozzuto_ad_source")}}catch(e){const t=document.createElement("iframe");if(t.style.display="none",document.body.appendChild(t),!t.contentWindow)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const n=t.contentWindow.URL;if(!n)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const a=new n(window.location.href).searchParams,s=null!==(o=null===(r=null===(i=window.RCTPCampaign)||void 0===i?void 0:i.CampaignDetails)||void 0===r?void 0:r.Source)&&void 0!==o?o:null;return{entrataCampaignSource:a.get("switch_cls[id]"),realpageCampaignSource:a.get("ilm"),utmCampaignSource:a.get("utm_source"),yardiCampaignSource:s,bozzutoAdSource:Mr("bozzuto_ad_source")}}};var qo;!function(e){e.error="error",e.info="info",e.warn="warn"}(qo||(qo={}));const Vo=async({logType:e,buildingSlug:t,orgSlug:n,logTitle:o,logData:a,error:s})=>{var l;if(s instanceof i.AxiosError&&403===(null===(l=s.response)||void 0===l?void 0:l.status))return;await r().post("https://app.meetelise.com/platformApi/webchat/logging",{...a},{headers:{"Content-Type":"application/json","building-slug":null!=t?t:"","org-slug":null!=n?n:"","log-type":null!=e?e:qo.error,"log-title":o.toUpperCase().replace(/\s/g,"_")}})},Yo=async({params:e,sampleRate:t})=>{try{if(Math.random()>=t)return;await r().post("https://app.meetelise.com/platformApi/webchat/log/signal",{...e,website_origin:window.location.origin,website_search:window.location.search})}catch(e){}};var Ko=n(2193),Xo=n.n(Ko);function Zo(e){return"avb"===e?"AVB Company Website":"windsor"===e?"Windsorcommunities.com":"property-website"}const Jo=class{constructor(){this.chatId=null,this.apiHost="https://app.meetelise.com",this.leadSource=null,this.leadSourceParams=null,this.localStorageTTLDays=30,this.buildingId=null,this.orgId=null,this.orgSlug=null,this.buildingSlug=null,this.queryParameters=null,this.leadSourceInput=null,this.updateLeadSourceLocalStorage=(e,t,n,i,r)=>{const o=bo();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(Wo()).filter(e=>e)},i)return;if(!r){const t=this.getLeadSourceBodyIfValid(e);if(t){if(!Ir(t.timestamp,24*this.localStorageTTLDays))return{...t,timestamp:qr(t.timestamp)}}}const a={leadSource:t,leadSourceParams:this.leadSourceParams,leadId:n,buildingSlug:e,timestamp:Br(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:qr(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&&!Ir(qr(n.timestamp),24*this.localStorageTTLDays)){try{this.leadSourceInput=n.leadSourceInput}catch(e){}return n}}catch(e){return null}return null},this.resetLeadSource=()=>{if(!this.buildingSlug)return!1;const e="com.elise.webchat.leadsource.slug="+this.buildingSlug;return localStorage.removeItem(e),!0}}async fetchCurrentParsedLeadSource({buildingSlug:e,queryParams:t,referrer:n,campaignSources:i}){const o={query_params:t,building_slug:e,referrer:n,campaign_sources:i};try{return(await r().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,o)).data}catch(e){return null}}async checkAndHandleForLogLeadSource({webchatAction:e,stateId:t}){var n,i,o,a,s,l,u;try{if(!this.chatId)return null;if(!this.orgSlug)return null;let d=null,c=null;try{if("f1ba5a20-d207-4e5a-879e-65199e7d0a53"===this.orgSlug){const e=await this.getCookieValue("_ga");e&&(d=e),c=null===(n=window.dataLayer.find(e=>{var t;return"gtagApiGet"==(null===(t=e.value)||void 0===t?void 0:t.event)}))||void 0===n?void 0:n.value}}catch(e){}return await r().post(`${this.apiHost}/platformApi/webchat/log/lead-source`,{chat_id:this.chatId,webchat_action:e,state_id:t,building_id:this.buildingId,org_slug:this.orgSlug,building_slug:this.buildingSlug,website_origin:null===(i=this.leadSourceInput)||void 0===i?void 0:i.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:Xo()(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){}return null}async generateUserLeadSource({leadId:e,orgSlug:t,buildingSlug:n}){var i,r,o;try{const a={queryParams:bo(),buildingSlug:n,referrer:document.referrer,campaignSources:Wo()};let s=!1;const l=n?this.getLeadSourceBodyIfValid(n):null;if(l){if(!["test-company","daf00bd2-1ecb-482c-b6f4-e1c5511a01be"].includes(t))return this.leadSource=l.leadSource,this.leadSourceParams=null!==(r=l.leadSourceParams)&&void 0!==r?r:null,this.leadSource;{const e=await this.fetchCurrentParsedLeadSource(a);if(!e)return this.leadSource=l.leadSource,this.leadSourceParams=null!==(i=l.leadSourceParams)&&void 0!==i?i:null,this.leadSource;this.leadSource=e,s=!0}}const u=await this.fetchCurrentParsedLeadSource(a);if(this.leadSource=u,this.buildingId=null,this.orgSlug=t,this.buildingSlug=n,n&&!u){const e=this.getLeadSourceBodyIfValid(n);if(e)return this.leadSource=e.leadSource,this.leadSourceParams=null!==(o=e.leadSourceParams)&&void 0!==o?o:null,this.leadSource}if(n){const t=!!u&&u.length>0;this.updateLeadSourceLocalStorage(n,u,e,!t&&!s,s)}return u}catch(e){}return null}},ea=async(e,t=!1)=>{const n=`https://app.meetelise.com/eliseCrmApi/building/${e}/scheduling_status?observe_dynamic_scheduling=${t}`;try{return(await r().get(n)).data.is_enabled}catch(e){return!1}};var ta,na,ia;!function(e){e.EMOJI="emoji",e.PILLS="pills",e.MINIMIZED="minimized"}(ta||(ta={})),function(e){e.UNKNOWN="UNKNOWN",e.SELF_GUIDED="SELF_GUIDED",e.VIRTUAL_SHOWING="VIRTUAL_SHOWING",e.WITH_AGENT="WITH_AGENT",e.MEDIA_TOUR="MEDIA_TOUR",e.OPEN_HOUSE_STUDIO="OPEN_HOUSE_STUDIO",e.OPEN_HOUSE_1BR="OPEN_HOUSE_1BR",e.OPEN_HOUSE_2BR="OPEN_HOUSE_2BR",e.OPEN_HOUSE_3BR="OPEN_HOUSE_3BR",e.OPEN_HOUSE_4BR="OPEN_HOUSE_4BR",e.OPEN_HOUSE_5BR="OPEN_HOUSE_5BR"}(na||(na={})),function(e){e.LINK="link",e.CLIENT_SCHEDULED="client_scheduled",e.SCHEDULED_BY_ME_MANAGED_BY_ME="scheduled_by_ME_managed_by_ME",e.SCHEDULED_BY_ME_MANAGED_BY_CLIENT="scheduled_by_ME_managed_by_client",e.SCHEDULED_BY_ME_MANAGED_BY_CONCIERGE="scheduled_by_ME_managed_by_concierge"}(ia||(ia={}));const ra=(e,t)=>"link"===(null==t?void 0:t.toLowerCase());async function oa(e,t){const n=`https://app.meetelise.com/api/pub/v1/organization/${e}/building/${t}/v2`,i=await r().get(n);return aa(i.data)}const aa=e=>{var t;try{e.welcomeMessage=sa(null!==(t=e.welcomeMessage)&&void 0!==t?t:"",e.userFirstName)}catch(e){}return e},sa=(e,t)=>e.replace(/elise/gi,t);var la=n(7035),ua=n(6353);function da(e,t,n){var i=function(e,t,n){if(n&&!n.code)throw new Error("date-fns-tz error: Please set a language code on the locale object imported from date-fns, e.g. `locale.code = 'en-US'`");return new Intl.DateTimeFormat(n?[n.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}(e,n.timeZone,n.locale);return i.formatToParts?function(e,t){for(var n=e.formatToParts(t),i=n.length-1;i>=0;--i)if("timeZoneName"===n[i].type)return n[i].value}(i,t):function(e,t){var n=e.format(t).replace(/\u200E/g,""),i=/ [\w-+ ]+$/.exec(n);return i?i[0].substr(1):""}(i,t)}function ca(e,t){var n=function(e){if(!pa[e]){var t=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),n="06/25/2014, 00:00:00"===t||"06/25/2014 00:00:00"===t;pa[e]=n?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return pa[e]}(t);return n.formatToParts?function(e,t){try{for(var n=e.formatToParts(t),i=[],r=0;r<n.length;r++){var o=ha[n[r].type];o>=0&&(i[o]=parseInt(n[r].value,10))}return i}catch(e){if(e instanceof RangeError)return[NaN];throw e}}(n,e):function(e,t){var n=e.format(t),i=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(n);return[i[3],i[1],i[2],i[4],i[5],i[6]]}(n,e)}var ha={year:0,month:1,day:2,hour:3,minute:4,second:5};var pa={};function fa(e,t,n,i,r,o,a){var s=new Date(0);return s.setUTCFullYear(e,t,n),s.setUTCHours(i,r,o,a),s}var ga=36e5,ma={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function ya(e,t,n){var i,r,o;if(!e)return 0;if(i=ma.timezoneZ.exec(e))return 0;if(i=ma.timezoneHH.exec(e))return va(o=parseInt(i[1],10))?-o*ga:NaN;if(i=ma.timezoneHHMM.exec(e)){o=parseInt(i[2],10);var a=parseInt(i[3],10);return va(o,a)?(r=Math.abs(o)*ga+6e4*a,"+"===i[1]?-r:r):NaN}if(function(e){if(wa[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),wa[e]=!0,!0}catch(e){return!1}}(e)){t=new Date(t||Date.now());var s=n?t:function(e){return fa(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),l=ba(s,e),u=n?l:function(e,t,n){var i=e.getTime(),r=i-t,o=ba(new Date(r),n);if(t===o)return t;r-=o-t;var a=ba(new Date(r),n);if(o===a)return o;return Math.max(o,a)}(t,l,e);return-u}return NaN}function ba(e,t){var n=ca(e,t),i=fa(n[0],n[1]-1,n[2],n[3]%24,n[4],n[5],0).getTime(),r=e.getTime(),o=r%1e3;return i-(r-=o>=0?o:1e3+o)}function va(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var wa={};var Ca={X:function(e,t,n,i){var r=xa(i.timeZone,e);if(0===r)return"Z";switch(t){case"X":return Aa(r);case"XXXX":case"XX":return Sa(r);default:return Sa(r,":")}},x:function(e,t,n,i){var r=xa(i.timeZone,e);switch(t){case"x":return Aa(r);case"xxxx":case"xx":return Sa(r);default:return Sa(r,":")}},O:function(e,t,n,i){var r=xa(i.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+function(e,t){var n=e>0?"-":"+",i=Math.abs(e),r=Math.floor(i/60),o=i%60;if(0===o)return n+String(r);var a=t||"";return n+String(r)+a+$a(o,2)}(r,":");default:return"GMT"+Sa(r,":")}},z:function(e,t,n,i){switch(t){case"z":case"zz":case"zzz":return da("short",e,i);default:return da("long",e,i)}}};function xa(e,t){var n=e?ya(e,t,!0)/6e4:t.getTimezoneOffset();if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+e);return n}function $a(e,t){for(var n=e<0?"-":"",i=Math.abs(e).toString();i.length<t;)i="0"+i;return n+i}function Sa(e,t){var n=t||"",i=e>0?"-":"+",r=Math.abs(e);return i+$a(Math.floor(r/60),2)+n+$a(Math.floor(r%60),2)}function Aa(e,t){return e%60==0?(e>0?"-":"+")+$a(Math.abs(e)/60,2):Sa(e,t)}const Ea=Ca;var Ta=n(9784),ka=n(9720);var _a=36e5,Oa=6e4,Pa={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function Ia(e,t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)return new Date(NaN);var n=t||{},i=null==n.additionalDigits?2:Ta(n.additionalDigits);if(2!==i&&1!==i&&0!==i)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("string"!=typeof e&&"[object String]"!==Object.prototype.toString.call(e))return new Date(NaN);var r=function(e){var t,n={},i=Pa.dateTimePattern.exec(e);i?(n.date=i[1],t=i[3]):(i=Pa.datePattern.exec(e))?(n.date=i[1],t=i[2]):(n.date=null,t=e);if(t){var r=Pa.timeZone.exec(t);r?(n.time=t.replace(r[1],""),n.timeZone=r[1].trim()):n.time=t}return n}(e),o=function(e,t){var n,i=Pa.YYY[t],r=Pa.YYYYY[t];if(n=Pa.YYYY.exec(e)||r.exec(e)){var o=n[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(n=Pa.YY.exec(e)||i.exec(e)){var a=n[1];return{year:100*parseInt(a,10),restDateString:e.slice(a.length)}}return{year:null}}(r.date,i),a=o.year,s=function(e,t){if(null===t)return null;var n,i,r,o;if(0===e.length)return(i=new Date(0)).setUTCFullYear(t),i;if(n=Pa.MM.exec(e))return i=new Date(0),Ua(t,r=parseInt(n[1],10)-1)?(i.setUTCFullYear(t,r),i):new Date(NaN);if(n=Pa.DDD.exec(e)){i=new Date(0);var a=parseInt(n[1],10);return function(e,t){if(t<1)return!1;var n=La(e);if(n&&t>366)return!1;if(!n&&t>365)return!1;return!0}(t,a)?(i.setUTCFullYear(t,0,a),i):new Date(NaN)}if(n=Pa.MMDD.exec(e)){i=new Date(0),r=parseInt(n[1],10)-1;var s=parseInt(n[2],10);return Ua(t,r,s)?(i.setUTCFullYear(t,r,s),i):new Date(NaN)}if(n=Pa.Www.exec(e))return Ra(t,o=parseInt(n[1],10)-1)?Ma(t,o):new Date(NaN);if(n=Pa.WwwD.exec(e)){o=parseInt(n[1],10)-1;var l=parseInt(n[2],10)-1;return Ra(t,o,l)?Ma(t,o,l):new Date(NaN)}return null}(o.restDateString,a);if(isNaN(s))return new Date(NaN);if(s){var l,u=s.getTime(),d=0;if(r.time&&(d=function(e){var t,n,i;if(t=Pa.HH.exec(e))return Ba(n=parseFloat(t[1].replace(",",".")))?n%24*_a:NaN;if(t=Pa.HHMM.exec(e))return Ba(n=parseInt(t[1],10),i=parseFloat(t[2].replace(",",".")))?n%24*_a+i*Oa:NaN;if(t=Pa.HHMMSS.exec(e)){n=parseInt(t[1],10),i=parseInt(t[2],10);var r=parseFloat(t[3].replace(",","."));return Ba(n,i,r)?n%24*_a+i*Oa+1e3*r:NaN}return null}(r.time),isNaN(d)))return new Date(NaN);if(r.timeZone||n.timeZone){if(l=ya(r.timeZone||n.timeZone,new Date(u+d)),isNaN(l))return new Date(NaN)}else l=ka(new Date(u+d)),l=ka(new Date(u+d+l));return new Date(u+d+l)}return new Date(NaN)}function Ma(e,t,n){t=t||0,n=n||0;var i=new Date(0);i.setUTCFullYear(e,0,4);var r=7*t+n+1-(i.getUTCDay()||7);return i.setUTCDate(i.getUTCDate()+r),i}var Na=[31,28,31,30,31,30,31,31,30,31,30,31],Da=[31,29,31,30,31,30,31,31,30,31,30,31];function La(e){return e%400==0||e%4==0&&e%100!=0}function Ua(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;var i=La(e);if(i&&n>Da[t])return!1;if(!i&&n>Na[t])return!1}return!0}function Ra(e,t,n){return!(t<0||t>52)&&(null==n||!(n<0||n>6))}function Ba(e,t,n){return(null==e||!(e<0||e>=25))&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}var ja=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function Fa(e,t,n,i){var r=la(i);return r.timeZone=t,r.originalDate=e,function(e,t,n){var i=String(t),r=n||{},o=i.match(ja);if(o){var a=Ia(r.originalDate||e,r);i=o.reduce(function(e,t){if("'"===t[0])return e;var n=e.indexOf(t),i="'"===e[n-1],o=e.replace(t,"'"+Ea[t[0]](a,t,null,r)+"'");return i?o.substring(0,n-1)+o.substring(n+1):o},i)}return ua(e,i,r)}(function(e,t,n){var i=Ia(e,n),r=ya(t,i,!0),o=new Date(i.getTime()-r),a=new Date(0);return a.setFullYear(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()),a.setHours(o.getUTCHours(),o.getUTCMinutes(),o.getUTCSeconds(),o.getUTCMilliseconds()),a}(e,t),n,r)}const Ha="com.eliseai.webchat.googlereserve.referral",Ga=async({buildingSlug:e})=>{try{const t=await r().get(`${Sr}/platformApi/webchat/${e}/units/summary`);if(t.data)return Er(t.data)}catch(t){Vo({logType:qo.error,buildingSlug:e,logTitle:"[ERROR_GETTING_UNITS_SUMMARY]",logData:{error:t},error:t})}return[]};var za=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 Qa=class extends oe{constructor(){super(...arguments),this.tourTypeOptions=[],this.layoutOptions=[],this.chatId="",this.buildingId=0,this.orgId=0,this.leadSourceParams=null,this.buildingSlug="",this.sgtUrl="",this.selfGuidedToursTypeOffered="",this.selfGuidedTourEnabled=!1,this.escortedToursLink="",this.escortedToursTypeOffered="",this.virtualToursLink="",this.virtualToursTypeOffered="",this.orgSlug="",this.hasDynamicSchedulingEnabled=!1,this.bedroomPreferenceRequired=!1,this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingName="",this.tourType=null,this.shouldShowTourType={[Wa.Guided]:!0,[Wa.Self]:!0,[Wa.Virtual]:!0},this.email="",this.phoneNumber="",this.phoneNumberE164=null,this.phoneCountry=null,this.phoneNumberIsValid=!1,this.phoneNumberHasBlurred=!1,this.availabilitiesGroupedByDay={},this.calendarTimeZone=Intl.DateTimeFormat().resolvedOptions().timeZone,this.waitingForAvailabilities=!0,this.mobilePageIndex=0,this.isSubmitting=!1,this.tourIsBooked=!1,this.shouldAllowScheduling=!1,this.shouldAllowScheduleLoading=!0,this.promptForReschedule=!1,this.canceledReschedule=!1,this.leadSources=[],this.orgLegalName="",this.country=null,this.buildingState=null,this.currentLeadSource="",this.featureFlagShowDropdown="",this.compactDesign=!1,this.primaryColor=Vn,this.foregroundColorOnPrimaryBackgroundColor="white",this.firstNameInputValue="",this.lastNameInputValue="",this.leadSourceInputValue="",this.selectedLayoutValue="",this.selectedUnitValue="",this.units=[],this.allowOccupiedUnitTours=!1,this.errorGettingAvailabilities=!1,this.centralConvoBuildings=[],this.isGeneralBuilding=!1,this.statusMessage="",this._setAvailabilities=async()=>{try{const[e,t]=await Promise.all([ea(this.buildingId,this.hasDynamicSchedulingEnabled),ao()]);this.shouldAllowScheduling=e,this.shouldAllowScheduleLoading=!1,this.calendarTimeZone=await(async e=>{var t;return null!==(t=(await ro(e)).calendarTimeZone)&&void 0!==t?t:Intl.DateTimeFormat().resolvedOptions().timeZone})(this.buildingId),Vo({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:t,logType:qo.info,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});const n=Object.values(t).every(e=>!1===e),i=!this.sgtUrl&&!this.escortedToursLink&&!this.virtualToursLink;if(n&&i)return this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,void Vo({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:qo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});this.shouldShowTourType={[Wa.Guided]:this.tourTypeOptions.map(e=>e.value).includes("WITH_AGENT")&&(t[Wa.Guided]||!!this.escortedToursLink),[Wa.Self]:this.tourTypeOptions.map(e=>e.value).includes("SELF_GUIDED")&&(t[Wa.Self]||!!this.sgtUrl),[Wa.Virtual]:this.tourTypeOptions.map(e=>e.value).includes("VIRTUAL_SHOWING")&&(t[Wa.Virtual]||!!this.virtualToursLink)};const r=1===Object.values(this.shouldShowTourType).reduce((e,t)=>!0===t?e+1:e,0);if(this._setDefaultSelectedDateAndTimes(),r&&(this.tourType=Object.keys(this.shouldShowTourType).find(e=>this.shouldShowTourType[e])),null===this.tourType)return void(this.waitingForAvailabilities=!1);this.availabilitiesGroupedByDay=await so(qa[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,Vo({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}},this._setDefaultSelectedDateAndTimes=async(e,t)=>{var n,i,r;const o=await ro(this.buildingId),a=null!=e?e:this._getHighestRankedTourType(o),s=a?null===(r=null===(i=null===(n=o.availability)||void 0===n?void 0:n[a])||void 0===i?void 0:i.availableTourStartTimes)||void 0===r?void 0:r.filter(e=>{if(!t)return!0;return or("string"==typeof e?qr(e):e,t)}):[],l=null==s?void 0:s[0];a&&l&&a!==Fr.Unknown&&a!==Fr.MediaTour&&(this.selectedDate=rr("string"==typeof l?qr(l):l),this.tourType=Va[a],this.selectedTime="string"==typeof l?lo(l):(e=>({datetime:Ji(e,"yyyy-MM-dd'T'HH:mm:ss"),offset:Ji(e,"xxx")}))(l))},this._getHighestRankedTourType=e=>{var t;const n=(null!==(t=e.rankOrderedSupportedTourTypes)&&void 0!==t?t:[]).map(t=>{var n,i;return{tourType:t,availabilities:null===(i=null===(n=e.availability)||void 0===n?void 0:n[t])||void 0===i?void 0:i.availableTourStartTimes}}).filter(e=>{if(e.tourType===Fr.Unknown||e.tourType===Fr.MediaTour)return!1;const t=Va[e.tourType],n=this._getTourTypeOffered(t);return!!n&&(!ra(0,n)&&e.availabilities&&e.availabilities.length>0)}),i=n[0];return i?i.tourType:null},this._getTourTypeOffered=e=>e===Wa.Guided?this.escortedToursTypeOffered:e===Wa.Self?this.selfGuidedToursTypeOffered:e===Wa.Virtual?this.virtualToursTypeOffered:null,this._getUnitOptions=()=>{const e=this.selectedLayoutValue?this.units.filter(e=>Ka(10*e.numberOfBedrooms)===this.selectedLayoutValue):this.units,t=e.map(e=>({label:e.unitNumber,value:e.unitNumber}));return t},this._fetchUnits=async()=>{if(this.buildingSlug)try{this.units=await Ga({buildingSlug:this.buildingSlug})}catch(e){this.units=[],Vo({logTitle:"ERROR_LOADING_UNITS_FOR_TOUR_SCHEDULER",logData:{error:e},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}},this.firstUpdated=async()=>{if(await this._fetchCentralConvoBuildings(),this.isGeneralBuilding)return this.waitingForAvailabilities=!1,this.shouldAllowScheduleLoading=!1,void(this.statusMessage="Please select a building to see tour availabilities.");await this._loadForCurrentBuilding()},this._loadForCurrentBuilding=async()=>{try{await ro(this.buildingId)}catch(e){}await Promise.all([this._setAvailabilities().then(async()=>{try{const e=await ro(this.buildingId);this.allowOccupiedUnitTours=!!e.allowOccupiedUnitTours}catch(e){this.allowOccupiedUnitTours=!1}}),this._fetchUnits()])},this._fetchCentralConvoBuildings=async()=>{if(this.orgSlug&&this.buildingSlug)try{const e=await async function(e,t){var n,i;const o=(await r().get("https://app.meetelise.com/platformApi/webchat/central-convo-buildings-v2",{headers:{"building-slug":t,"org-slug":e}})).data;return{is_general_building:null!==(n=null==o?void 0:o.is_general_building)&&void 0!==n&&n,buildings:null!==(i=null==o?void 0:o.buildings)&&void 0!==i?i:[]}}(this.orgSlug,this.buildingSlug);this.centralConvoBuildings=e.buildings,this.isGeneralBuilding=e.is_general_building}catch(e){this.centralConvoBuildings=[],this.isGeneralBuilding=!1}},this._onBuildingChange=async()=>{var e;const t=null===(e=this.selectedBuildingEl)||void 0===e?void 0:e.value;if(!t||t===this.buildingSlug)return;const n=this.centralConvoBuildings.find(e=>e.slug===t);if(n){this.isGeneralBuilding=!1,this.waitingForAvailabilities=!0,this.errorGettingAvailabilities=!1,this.tourType=null,this.selectedDate=void 0,this.selectedTime=void 0,this.availabilitiesGroupedByDay={},this.mobilePageIndex=0,this.units=[],this.selectedLayoutValue="",this.selectedUnitValue="",this.buildingId=n.building_id,this.buildingSlug=n.slug,this.buildingName=n.name,this.statusMessage=`Loading tours for ${n.name}…`,$o("tourBuildingSelected",{buildingId:n.building_id});try{const e=await oa(this.orgSlug,n.slug);this.sgtUrl=e.sgtUrl,this.selfGuidedToursTypeOffered=e.selfGuidedToursTypeOffered,this.selfGuidedTourEnabled=e.isSelfGuidedTourEnabled,this.escortedToursLink=e.escortedToursLink,this.escortedToursTypeOffered=e.escortedToursTypeOffered,this.virtualToursLink=e.virtualToursLink,this.virtualToursTypeOffered=e.virtualToursTypeOffered,this.tourTypeOptions=e.tourTypeOptions.map(e=>({label:e.label,value:e.value})),this.hasDynamicSchedulingEnabled=e.usesDynamicScheduling}catch(e){}if(await this._loadForCurrentBuilding(),!this.shouldAllowScheduling||this.errorGettingAvailabilities)this.statusMessage=`No tour availabilities for ${n.name}.`;else{const e=Object.values(this.shouldShowTourType).filter(Boolean).length;this.statusMessage=`Showing tours for ${n.name}. ${e} tour type${1===e?"":"s"} available.`}}},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await so(qa[this.tourType]))},this.onChangePhoneNumber=e=>{this.phoneNumber=e.detail.formattedValue,this.phoneNumberE164=e.detail.e164,this.phoneCountry=e.detail.country,this.phoneNumberIsValid=e.detail.isValid},this.onChangeEmail=e=>{e.target&&(this.email=e.target.value)},this.validators={tourType:()=>null!==this.tourType,dateAndTime:()=>!!this.selectedDate&&!!this.selectedTime,leadInfo:()=>{var e,t,n,i;return(!!(null===(e=this.firstNameInput)||void 0===e?void 0:e.value)||!!(null===(t=this.lastNameInput)||void 0===t?void 0:t.value))&&Nr(null!==(i=null===(n=this.emailInput)||void 0===n?void 0:n.value)&&void 0!==i?i:"")&&!!this.phoneNumber&&!!this.phoneNumberE164},layout:()=>!this.bedroomPreferenceRequired||!!this.selectedLayoutValue},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo()&&this.validators.layout(),this.timeStringToHoursAndMinutes=e=>{const[t,n]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(n)]},this.submit=async()=>{var e,t,n,i,o,a,s,l,u,d,c,h,p,f,g,m,y,b,v,w,C,x,$;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const S=this.phoneNumberE164;if(!S)return void(this.phoneNumberIsValid=!1);const A=new URLSearchParams(window.location.search);let E=null;E=this.selectedLeadSource&&this.selectedLeadSource.value&&this.selectedLeadSource.value.length>0?this.selectedLeadSource.value:this.leadSourceInputValue&&this.leadSourceInputValue.length>0?this.leadSourceInputValue:this.currentLeadSource;const T=[...new Set(E?[E,"property-website"]:["property-website"])];this.firstNameInput&&(this.firstNameInputValue=this.firstNameInput.value),this.lastNameInput&&(this.lastNameInputValue=this.lastNameInput.value),this.leadSourceInputValue=E;const k=(null===(e=this.selectedLayoutEl)||void 0===e?void 0:e.value)||this.selectedLayoutValue||null,_=(null===(t=this.selectedUnitEl)||void 0===t?void 0:t.value)||this.selectedUnitValue||null;$o("scheduleTourSubmitted",{email:this.email,phone:S,firstName:null!==(i=null===(n=this.firstNameInput)||void 0===n?void 0:n.value)&&void 0!==i?i:this.firstNameInputValue,lastName:null!==(a=null===(o=this.lastNameInput)||void 0===o?void 0:o.value)&&void 0!==a?a:this.lastNameInputValue,tourType:Ya[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:T.find(e=>"property-website"!==e)||null,layout:k,unit:_,conversationTrackingId:null!==(l=null===(s=this.leadSourceClient)||void 0===s?void 0:s.chatId)&&void 0!==l?l:null});const O=(()=>{var e;try{const t=JSON.parse(null!==(e=localStorage.getItem(Ha))&&void 0!==e?e:"null");return(null==t?void 0:t.rwgToken)&&Date.now()<t.expiresAt?t:null}catch{return null}})(),P={referrer:document.referrer,email_address:this.email,phone_number:S,building_id:this.buildingId,first_name:null!==(d=null===(u=this.firstNameInput)||void 0===u?void 0:u.value)&&void 0!==d?d:this.firstNameInputValue,last_name:null!==(h=null===(c=this.lastNameInput)||void 0===c?void 0:c.value)&&void 0!==h?h:this.lastNameInputValue,tour_type:Ya[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(E?[E,Zo(this.orgSlug)]:[Zo(this.orgSlug)])],query_params:Object.fromEntries(A.entries()),conversation_tracking_id:null===(p=this.leadSourceClient)||void 0===p?void 0:p.chatId,layouts:k?[k]:void 0,unit_numbers:_?[_]:void 0,lead_sources_with_timestamps:(null!==(m=null===(f=this.leadSourceMultitouchClient)||void 0===f?void 0:f.getSafeLeadSourceTouchpointsWithDefault({includedUserSelectedLeadSource:(null===(g=this.selectedLeadSource)||void 0===g?void 0:g.value)&&this.selectedLeadSource.value.length>0?this.selectedLeadSource.value:null}))&&void 0!==m?m:[]).map(e=>Tr({...e})),google_rwg_token:null==O?void 0:O.rwgToken,google_referral_building_id:null==O?void 0:O.buildingId,google_environment:null==O?void 0:O.environment};this.isSubmitting=!0;try{await r().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",P,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"webchatkey-wkjcWAKZjqhLStvP8L6SN8y4FbYmPhdE","org-slug":this.orgSlug}}),null===(y=this.leadSourceClient)||void 0===y||y.checkAndHandleForLogLeadSource({webchatAction:"tour-scheduler",stateId:null}),null===(b=this.leadSourceClient)||void 0===b||b.resetLeadSource(),null===(v=this.leadSourceMultitouchClient)||void 0===v||v.resetLeadSourceTouchpoints(),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e,n=(null===(C=null===(w=t.response)||void 0===w?void 0:w.data)||void 0===C?void 0:C.detail)||"Failed to book tour";if(t.response&&t.response.headers&&t.response.headers["funnel-prospect-conflicting-appointment-error"]){if(this.selectedDate&&this.selectedTime){const e=this.availabilitiesGroupedByDay[Ji(this.selectedDate,"yyyy-MM-dd")];e&&(this.availabilitiesGroupedByDay[Ji(this.selectedDate,"yyyy-MM-dd")]=e.filter(e=>e!==this.selectedTime))}}else{if(409===(null===(x=t.response)||void 0===x?void 0:x.status)&&!this.promptForReschedule&&"User already has a tour scheduled for this building"===n)return this.promptForReschedule=!0,this.isSubmitting=!1,void(this.tourIsBooked=!1);if(409===(null===($=t.response)||void 0===$?void 0:$.status)&&!this.promptForReschedule)return this.isSubmitting=!1,this.tourIsBooked=!1,io(),this.availabilitiesGroupedByDay=await so(qa[this.tourType],this.buildingId),void alert("This timeslot is no longer available. Please select a different time.")}alert(n),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>R`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>R`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>R` <action-confirm-button
|
|
1557
1557
|
id="schedule-bttn"
|
|
1558
1558
|
.onClick=${this.submit}
|
|
1559
1559
|
.isLoading=${this.isSubmitting}
|
|
@@ -7298,7 +7298,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
7298
7298
|
</button>
|
|
7299
7299
|
</div>
|
|
7300
7300
|
</div>
|
|
7301
|
-
`}};cc.AUTO_SCROLL_THRESHOLD_PX=32,cc.styles=[Oe,Wu,Qu,zu,ac],dc([ue({type:Number})],cc.prototype,"right",void 0),dc([ue({type:Number})],cc.prototype,"bottom",void 0),dc([ue({type:Number})],cc.prototype,"top",void 0),dc([ue({type:Number})],cc.prototype,"left",void 0),dc([ue({attribute:!0})],cc.prototype,"onMount",void 0),dc([ue({attribute:!0})],cc.prototype,"channel",void 0),dc([ue({attribute:!0})],cc.prototype,"isHealthChat",void 0),dc([ue({attribute:!0})],cc.prototype,"myPubnub",void 0),dc([ue({attribute:!0})],cc.prototype,"orgSlug",void 0),dc([ue({attribute:!0})],cc.prototype,"buildingSlug",void 0),dc([ue({attribute:!0})],cc.prototype,"widgetType",void 0),dc([ue({attribute:!0})],cc.prototype,"building",void 0),dc([ue({attribute:!0})],cc.prototype,"primaryColor",void 0),dc([ue({attribute:!0})],cc.prototype,"backgroundColor",void 0),dc([ue({attribute:!0})],cc.prototype,"onClickExit",void 0),dc([ue({attribute:!0})],cc.prototype,"requiresConsent",void 0),dc([ce("#message-input",!0)],cc.prototype,"messageInput",void 0),dc([ce("#conversation-body",!0)],cc.prototype,"messageBody",void 0),dc([de()],cc.prototype,"_isMobile",void 0),dc([de()],cc.prototype,"messages",void 0),dc([de()],cc.prototype,"isLoadingMessages",void 0),dc([de()],cc.prototype,"hasReceivedConsent",void 0),dc([de()],cc.prototype,"privacyPolicyUrl",void 0),dc([de()],cc.prototype,"websitePreviewMapping",void 0),cc=uc=dc([se("pubnub-chat")],cc);const hc="cdn.skypack.dev/@meetelise/chat",pc="cdn.eliseai.com/@meetelise/chat",fc=async(e,t)=>{try{if(Math.random()>=.15)return;const n=(()=>{try{const e=document.getElementsByTagName("script");for(const t of e){const e=t.src||"",n=t.textContent||"";if(e.includes(hc)||n.includes(hc))return"skypack";if(e.includes(pc)||n.includes(pc))return"eliseai"}return"unknown"}catch(e){return"unknown"}})();await r().post("https://app.meetelise.com/platformApi/webchat/cdn-version",{cdn_version:n},{params:{cdn_version:n},headers:{"Content-Type":"application/json","building-slug":t,"org-slug":e}})}catch(e){}},gc=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?t.endsWith("/units")?t:`${t}/units`:t,mc={"95ae958e-95db-11ed-9862-6f4db5533d3f":"8008db60-45b7-11f1-88ac-635f686365da","95ae96b0-95db-11ed-9863-a7aa664fd985":"72ed27c4-45b7-11f1-82d9-37b7db547687"},yc="https://applications.eliseai.com",bc=["Check Availability","Apply Now"],vc=(e,t,n,i)=>{if(!(e=>{var t;if(!e.classList.contains("floorplan-button"))return!1;const n=e.getElementsByTagName("span");if(1!==n.length)return!1;const i=null===(t=n[0].textContent)||void 0===t?void 0:t.trim();return null!=i&&bc.includes(i)})(e))return!1;if(e.getAttribute("href")===t)return!1;const r=e.getAttribute("href");return e.setAttribute("href",t),e.setAttribute("target","_blank"),Vo({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:qo.info,buildingSlug:i,orgSlug:n}),!0},wc=(e,t,n,i)=>{for(let r=0;r<e.length;r++){const o=e[r];if(o.nodeType!==Node.ELEMENT_NODE)continue;const a=o;"A"===a.tagName&&vc(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)vc(s[e],t,n,i)}},Cc=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)vc(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)wc(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class xc{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>Br(jr(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=bo();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(Wo()).filter(e=>e)}},this.addSafeLeadSourceTouchpoint=e=>{const t=this.getLocalStorageMultitouchValue(),n=this._generateLeadSourceLocalStorageKey();if(!t||this.isExpiredTimestamp(t.timestampExpires)){const t={timestampExpires:this._generateNewExpirationTimestamp(),leadSources:[{parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:Br(new Date),type:"touchpoint"}]};localStorage.setItem(n,JSON.stringify(t))}else{if(t.leadSources.find(t=>t.leadSourceValue===e))return;if(t.leadSources.length<this.maxSourcesNonPropertyWebsiteCount)return t.leadSources.push({parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:Br(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));Vo({logType:qo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,logTitle:"TOO_MANY_LEAD_SOURCES",logData:{buildingSlug:this.buildingSlug}})}},this.getSafeLeadSourceTouchpointsWithDefault=({includedUserSelectedLeadSource:e})=>{const t=this.getLocalStorageMultitouchValue(),n=Zo(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:Br(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:Br(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>qr(e.timestampInitiallyLogged).getTime()-qr(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:Br(new Date),r=[{timestampInitiallyLogged:i,leadSourceValue:n,type:"default"},...t.leadSources.map(e=>({timestampInitiallyLogged:e.timestampInitiallyLogged,leadSourceValue:e.leadSourceValue,type:e.type}))];return e&&r.push({leadSourceValue:e,timestampInitiallyLogged:Br(new Date),type:"user-selected"}),r},this.getLocalStorageMultitouchValue=()=>{const e=this._generateLeadSourceLocalStorageKey(),t=localStorage.getItem(e);if(!t)return null;return JSON.parse(t)},this.isExpiredTimestamp=e=>qr(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var $c,Sc=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 Ac=$c=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.centralConvo=!1,this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=Or(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=go.always,this.bedroomPreferenceRequired=!1,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.openTourSchedulerOnLoad=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.LeadSourceMultitouchClient=null,this.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=jc.Default,this.onWidgetLoaded=ql(),this.onSstClose=ql(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1,calcDesktop:!1,calcMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=Ee(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{var e,t;if(!this.orgSlug)return;if(!this.centralConvo&&!this.buildingSlug)return;const n=this.centralConvo?await async function(e){const t=`https://app.meetelise.com/api/pub/v1/organization/${e}/webchat/v2`,n=await r().get(t);return aa(n.data)}(this.orgSlug):await oa(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,t)=>{const n=window.rentgrata;if(!n)return;const i=n.Widget;if(!i)return;const o=i.config;if(!o)return;const a=o.widgetKey;a&&await r().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=t?t:""}})})(this.buildingSlug,this.orgSlug)}catch(e){}try{fc(this.orgSlug,this.buildingSlug)}catch(e){}await Za(n,this.buildingSlug,this.orgSlug)&&(Yo({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==n?void 0:n.launchedDateTime)?.01:.05}),this.buildingWebchatView=n,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),(e=>{const t=new URLSearchParams(window.location.search).get("rwg_token");if(!t||!e)return;const n={rwgToken:t,buildingId:e,expiresAt:Date.now()+2592e6};localStorage.setItem(Ha,JSON.stringify(n))})(null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.id)&&void 0!==t?t:0),"tour"===new URLSearchParams(window.location.search).get("elise_open")&&(this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile)?this.openTourSchedulerOnLoad=!0:this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)?(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()):"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0),this.isLoading=!1)},this.setBuildingDerivedInfo=async()=>{var e,t,n,i,o,a,s,l,u,d,c,h,p,f,g,m,y,b,v,w,C,x,$,S,A,E,T,k,_,O,P,I,M,N,D,L,U,R,B,j,F,H,G,z,Q,W,q,V,Y;const K=this.buildingWebchatView;if(!K)return;K&&this.orgSlug&&Tc(this.orgSlug,null!==(t=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==t?t:null,this.sampleRateToUse,this.buildingSlug,null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null);const X=K.featureFlagWebchatMarketingSourceDropdownConfiguration,Z=K.featureFlagWebchatUseDniPhoneNumberBySource,J=K.featureFlagInsertDniIntoWebsite,ee=K.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite;var te;te=wo.includes(K.orgId),xo=te;const[ne,ie,re,oe]=await Promise.all([gu(this.orgSlug,this.buildingSlug),mo(this.buildingSlug),yu(this.buildingSlug),yo(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Gn(K.phoneNumber),this.buildingWebchatView.isAip=re),this.leadSources=ne,this.featureFlagShowDropdown=X,this.bedroomPreferenceRequired=oe;const ae=K.textWithUsPhoneNumber?K.textWithUsPhoneNumber:await(async e=>{try{const t="https://app.meetelise.com",n=await r().get(`${t}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return Vo({logType:qo.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t},error:t}),null}return null})(this.buildingSlug),se=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,le=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,ue={callDesktop:null!==(d=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==d&&d,callMobile:null!==(h=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.shouldShowPhoneMobile)&&void 0!==h&&h,chatDesktop:null!==(f=null===(p=this.buildingWebchatView)||void 0===p?void 0:p.shouldShowChatDesktop)&&void 0!==f&&f,chatMobile:null!==(m=null===(g=this.buildingWebchatView)||void 0===g?void 0:g.shouldShowChatMobile)&&void 0!==m&&m,emailDesktop:null!==(b=null===(y=this.buildingWebchatView)||void 0===y?void 0:y.shouldShowEmailDesktop)&&void 0!==b&&b,emailMobile:null!==(w=null===(v=this.buildingWebchatView)||void 0===v?void 0:v.shouldShowEmailMobile)&&void 0!==w&&w,textDesktop:null!==(x=(null===(C=this.buildingWebchatView)||void 0===C?void 0:C.shouldShowTextDesktop)&&!!ae)&&void 0!==x&&x,textMobile:null!==(S=(null===($=this.buildingWebchatView)||void 0===$?void 0:$.shouldShowTextMobile)&&!!ae)&&void 0!==S&&S,sstDesktop:null!==(E=null===(A=this.buildingWebchatView)||void 0===A?void 0:A.shouldShowSstDesktop)&&void 0!==E&&E,sstMobile:null!==(k=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstMobile)&&void 0!==k&&k,calcDesktop:se,calcMobile:le};var de,ce;this.enabledChatWidgets=eu(ue),this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(Fu(this.handleTourClicked,this.orgSlug,this.buildingSlug,()=>this.isConnected),ee&&(ce=this.handleTourClicked,document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(e=>{e&&e.addEventListener("click",e=>{e.preventDefault(),ce(e)})})),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach(t=>{var n;if(!t)return;const i=document.createElement("a");i.textContent=t.textContent,i.style.cursor="pointer",i.addEventListener("click",t=>{t.preventDefault(),e(t)}),null===(n=t.parentNode)||void 0===n||n.replaceChild(i,t)})})(this.handleTourClicked)):(null===(_=this.LeadSourceClient)||void 0===_?void 0:_.leadSource)&&(de=null!==(P=null===(O=this.LeadSourceClient)||void 0===O?void 0:O.leadSource)&&void 0!==P?P: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(de)}`)}})),this.buildingWebchatView&&(this.primaryColor=null!==(I=this.buildingWebchatView.primaryColor)&&void 0!==I?I:null,this.backgroundColor=null!==(M=this.buildingWebchatView.secondaryColor)&&void 0!==M?M:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(N=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==N?N:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(D=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==D?D:null,this.webchatConfigHasAutoOpenChat=null!==(L=this.buildingWebchatView.autoOpenChat)&&void 0!==L&&L,this.requiresConsent=null!==(U=this.buildingWebchatView.requiresConsentForChat)&&void 0!==U&&U,this.hideMobileFeatures=null!==(R=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==R&&R,this.privacyPolicyUrl=null!==(B=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==B?B:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===ta.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===ta.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===ta.EMOJI&&(this.designConcept=ta.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Vn),null===this.backgroundColor&&(this.backgroundColor=Yn);const he=null!==(F=null===(j=this.buildingWebchatView)||void 0===j?void 0:j.phoneNumber)&&void 0!==F?F:"";let pe=null;if(Z&&(pe=await async function(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source`,{params:{source:t}});return n.data?{number:Gn(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(G=null===(H=this.LeadSourceClient)||void 0===H?void 0:H.leadSource)&&void 0!==G?G:null),pe&&!pe.isMatch&&(pe.number=he)),J&&(null==pe?void 0:pe.number)){const e=ju(pe.number,this.orgSlug,this.buildingSlug);e>0&&Yo({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const fe=localStorage.getItem("eliseai_phone_number_devtest");fe&&ju(fe,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=pe||{number:he,isMatch:!1,isPropertyWebsiteCatchall:!0};const ge=null!==(Q=null===(z=this.LeadSourceClient)||void 0===z?void 0:z.leadSource)&&void 0!==Q?Q:null;ge&&(this.leadSources.includes(ge)||this.leadSources.push(ge)),ro(K.id);if((ie||(null===(W=this.buildingWebchatView)||void 0===W?void 0:W.isAip))&&(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isLiveOnApplications)&&this.buildingSlug){const e=((e,t,n)=>{var i;const r=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/content\/apply/,/\/apply-now/,/\/apply/,/vsc\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/New\/.*(\?.*)?$/,/busboomgroup\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/],o=document.body.getElementsByTagName("a");let a=0;for(let s=0;s<o.length;s++){const l=o[s];if(l.nodeType===Node.ELEMENT_NODE&&r.some(e=>e.test(l.href))){const r=l.getAttribute("href"),o=(null===(i=l.textContent)||void 0===i?void 0:i.toLowerCase())||"",s=gc(o,e);l.setAttribute("href",s),a++,Vo({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:qo.info,buildingSlug:n,orgSlug:t})}}return 0===a&&Vo({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:qo.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}/units`,this.orgSlug,this.buildingSlug);e>0&&Yo({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}if(this.buildingSlug&&this.orgSlug)try{(e=>{const t=mc[e];if(!t)return 0;const n=`${yc}/building/${t}/units`,i=`${yc}/building/${e}/units`,r=new RegExp(`https://applications\\.eliseai\\.com/building/${t}/units`,"g");let o=0;const a=document.body.getElementsByTagName("a");for(let e=0;e<a.length;e++){const t=a[e],s=t.getAttribute("href");if(!s||!s.includes(n))continue;const l=s.replace(r,i);l!==s&&(t.setAttribute("href",l),o++)}document.body.querySelectorAll("[onclick]").forEach(e=>{const t=e.getAttribute("onclick");if(!t||!t.includes(n))return;const a=t.replace(r,i);a!==t&&(e.setAttribute("onclick",a),o++)})})(this.buildingSlug)}catch{}this.buildingSlug&&(null===(V=this.buildingWebchatView)||void 0===V?void 0:V.isLiveOnApplications)&&(null===(Y=this.buildingWebchatView)||void 0===Y?void 0:Y.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&Cc(this.orgSlug,this.buildingSlug,this.buildingWebchatView.applicationLink)},this.initializeChatVariables=async()=>{var e,t,n,i,r,o,a,s,l,u;if(!this.buildingWebchatView)return;const d=Pu(this.buildingSlug),c=Iu(this.buildingSlug,d),h=c?d:Ou(this.buildingSlug,!1);if(!h.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new Jo,this.LeadSourceClient.orgId=null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.orgId)&&void 0!==t?t:0,this.LeadSourceMultitouchClient=new xc(this.orgSlug,this.buildingSlug),this.myPubnub=new Uu(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,h.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType);const p=await this.myPubnub.initSession(this.buildingSlug,this.orgSlug,c&&null!==(n=h.leadId)&&void 0!==n?n:void 0);p&&Ou(this.buildingSlug,h.initiatedChat,p.lead_id),this.LeadSourceClient.chatId=this.myPubnub.channel;const f=await(null===(i=this.LeadSourceClient)||void 0===i?void 0:i.generateUserLeadSource({leadId:null!==(o=null===(r=this.myPubnub)||void 0===r?void 0:r.leadUserId)&&void 0!==o?o:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));f&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(f),"property-website"!==Zo(this.orgSlug)?this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:Zo(this.orgSlug):this.myPubnub.leadSource=null!==(u=null===(l=this.LeadSourceClient)||void 0===l?void 0:l.leadSource)&&void 0!==u?u:null;const g=Pu(this.buildingSlug);g.initiatedChat&&await this.myPubnub.initializePubnub(g)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!zr(qr(t)));return!!e&&!!n&&!Or()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",Br(function(e,t){return ii(2,arguments),wi(e,6e4*vi(t))}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,n,i,r,o,a,s,l;if("Tab"!==e.key)return;const u=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("meetelise-launcher"))||void 0===n?void 0:n.shadowRoot;let d=[];if(this.displayPubnubChat){const e=null===(o=null===(r=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat"))||void 0===r?void 0:r.shadowRoot)||void 0===o?void 0:o.getElementById("pubnub-chat-container"),t=null===(a=this.shadowRoot)||void 0===a?void 0:a.getElementById("chatAdditionalActionsPubnub");e&&d.push(...this.collectFocusableElements(e)),t&&d.push(...this.collectFocusableElements(t))}else{const e=null!==(l=null!==(s=null==u?void 0:u.getElementById("email-us-window"))&&void 0!==s?s:null==u?void 0:u.getElementById("tour-scheduler-window"))&&void 0!==l?l:null==u?void 0:u.getElementById("call-us-window");e&&(d=this.collectFocusableElements(e))}if(0===d.length)return;e.preventDefault();const c=this.getDeepActiveElement(),h=d.findIndex(e=>e===c);d[e.shiftKey?(h-1+d.length)%d.length:(h+1)%d.length].focus()},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")}}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new Qo(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),_u(this.buildingSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.setupWebchat(),this.hideLauncher=!1}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustPositionChatAdditionalActions),window.addEventListener("keydown",this.handleKeydownTab),this._cleanupMobileListener=Pr(e=>{this._isMobile=e})}static isFocusable(e){return!("disabled"in e)||!e.disabled}collectFocusableElements(e){const t=[];e instanceof Element&&e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));const n=e.querySelectorAll("*");for(const e of Array.from(n))e.matches($c.FOCUSABLE_SELECTOR)&&$c.isFocusable(e)&&t.push(e),e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));return t}getDeepActiveElement(){let e=document.activeElement,t=0;for(;(null==e?void 0:e.shadowRoot)&&(null==e?void 0:e.shadowRoot.activeElement);)if(t+=1,e=null==e?void 0:e.shadowRoot.activeElement,t>100){Vo({logType:qo.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_GETTING_DEEP_ELEMENT]",logData:{message:"error getting deep active element"}});break}return e}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e,t;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),window.removeEventListener("keydown",this.handleKeydownTab),null===(t=this._cleanupMobileListener)||void 0===t||t.call(this),super.disconnectedCallback()}render(){var e,t,n,i,r,o,a,s,l,u,d,c,h,p,f,g,m,y,b,v,w,C,x,$,S,A,E,T,k,_,O,P,I,M,N,D,L,U,B,j,F,H,G,z,Q,W,q;Xl();const V=this.hideLauncher&&!this.isLoading&&!this._isMobile;return R`
|
|
7301
|
+
`}};cc.AUTO_SCROLL_THRESHOLD_PX=32,cc.styles=[Oe,Wu,Qu,zu,ac],dc([ue({type:Number})],cc.prototype,"right",void 0),dc([ue({type:Number})],cc.prototype,"bottom",void 0),dc([ue({type:Number})],cc.prototype,"top",void 0),dc([ue({type:Number})],cc.prototype,"left",void 0),dc([ue({attribute:!0})],cc.prototype,"onMount",void 0),dc([ue({attribute:!0})],cc.prototype,"channel",void 0),dc([ue({attribute:!0})],cc.prototype,"isHealthChat",void 0),dc([ue({attribute:!0})],cc.prototype,"myPubnub",void 0),dc([ue({attribute:!0})],cc.prototype,"orgSlug",void 0),dc([ue({attribute:!0})],cc.prototype,"buildingSlug",void 0),dc([ue({attribute:!0})],cc.prototype,"widgetType",void 0),dc([ue({attribute:!0})],cc.prototype,"building",void 0),dc([ue({attribute:!0})],cc.prototype,"primaryColor",void 0),dc([ue({attribute:!0})],cc.prototype,"backgroundColor",void 0),dc([ue({attribute:!0})],cc.prototype,"onClickExit",void 0),dc([ue({attribute:!0})],cc.prototype,"requiresConsent",void 0),dc([ce("#message-input",!0)],cc.prototype,"messageInput",void 0),dc([ce("#conversation-body",!0)],cc.prototype,"messageBody",void 0),dc([de()],cc.prototype,"_isMobile",void 0),dc([de()],cc.prototype,"messages",void 0),dc([de()],cc.prototype,"isLoadingMessages",void 0),dc([de()],cc.prototype,"hasReceivedConsent",void 0),dc([de()],cc.prototype,"privacyPolicyUrl",void 0),dc([de()],cc.prototype,"websitePreviewMapping",void 0),cc=uc=dc([se("pubnub-chat")],cc);const hc="cdn.skypack.dev/@meetelise/chat",pc="cdn.eliseai.com/@meetelise/chat",fc=async(e,t)=>{try{if(Math.random()>=.15)return;const n=(()=>{try{const e=document.getElementsByTagName("script");for(const t of e){const e=t.src||"",n=t.textContent||"";if(e.includes(hc)||n.includes(hc))return"skypack";if(e.includes(pc)||n.includes(pc))return"eliseai"}return"unknown"}catch(e){return"unknown"}})();await r().post("https://app.meetelise.com/platformApi/webchat/cdn-version",{cdn_version:n},{params:{cdn_version:n},headers:{"Content-Type":"application/json","building-slug":t,"org-slug":e}})}catch(e){}},gc=(e,t)=>["floor plan","floorplan","floor plans","floorplans","apply here"].some(t=>e.toLowerCase().includes(t))?t.endsWith("/units")?t:`${t}/units`:t,mc={"95ae958e-95db-11ed-9862-6f4db5533d3f":"8008db60-45b7-11f1-88ac-635f686365da","95ae96b0-95db-11ed-9863-a7aa664fd985":"72ed27c4-45b7-11f1-82d9-37b7db547687"},yc="https://applications.eliseai.com",bc=["Check Availability","Apply Now"],vc=(e,t,n,i)=>{if(!(e=>{var t;if(!e.classList.contains("floorplan-button"))return!1;const n=e.getElementsByTagName("span");if(1!==n.length)return!1;const i=null===(t=n[0].textContent)||void 0===t?void 0:t.trim();return null!=i&&bc.includes(i)})(e))return!1;if(e.getAttribute("href")===t)return!1;const r=e.getAttribute("href");return e.setAttribute("href",t),e.setAttribute("target","_blank"),Vo({logTitle:"CHECK_AVAIL_OVERWRITE",logData:{oldHref:r,newHref:t,website:window.location.href},logType:qo.info,buildingSlug:i,orgSlug:n}),!0},wc=(e,t,n,i)=>{for(let r=0;r<e.length;r++){const o=e[r];if(o.nodeType!==Node.ELEMENT_NODE)continue;const a=o;"A"===a.tagName&&vc(a,t,n,i);const s=a.getElementsByTagName("a");for(let e=0;e<s.length;e++)vc(s[e],t,n,i)}},Cc=(e,t,n)=>{((e,t,n)=>{const i=document.body.getElementsByTagName("a");for(let r=0;r<i.length;r++)vc(i[r],e,t,n)})(n,e,t);new MutationObserver(i=>{for(const r of i)wc(r.addedNodes,n,e,t)}).observe(document.body,{childList:!0,subtree:!0})};class xc{constructor(e,t){this.persistLeadSourceTTLDays=30,this.maxSourcesNonPropertyWebsiteCount=3,this._generateLeadSourceLocalStorageKey=()=>`com.eliseai.webchat.leadsources.v2.buildingslug=${this.buildingSlug}`,this._generateNewExpirationTimestamp=()=>Br(jr(new Date,this.persistLeadSourceTTLDays)),this._generateLeadSourceParameters=()=>{const e=bo();return{websiteOrigin:window.location.origin,websiteSearch:window.location.search,queryParameters:e,referrer:document.referrer,parsedUtmSource:e?e.utm_source:null,campaignSources:Object.values(Wo()).filter(e=>e)}},this.addSafeLeadSourceTouchpoint=e=>{const t=this.getLocalStorageMultitouchValue(),n=this._generateLeadSourceLocalStorageKey();if(!t||this.isExpiredTimestamp(t.timestampExpires)){const t={timestampExpires:this._generateNewExpirationTimestamp(),leadSources:[{parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:Br(new Date),type:"touchpoint"}]};localStorage.setItem(n,JSON.stringify(t))}else{if(t.leadSources.find(t=>t.leadSourceValue===e))return;if(t.leadSources.length<this.maxSourcesNonPropertyWebsiteCount)return t.leadSources.push({parameters:this._generateLeadSourceParameters(),leadSourceValue:e,timestampInitiallyLogged:Br(new Date),type:"touchpoint"}),t.timestampExpires=this._generateNewExpirationTimestamp(),void localStorage.setItem(n,JSON.stringify(t));Vo({logType:qo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,logTitle:"TOO_MANY_LEAD_SOURCES",logData:{buildingSlug:this.buildingSlug}})}},this.getSafeLeadSourceTouchpointsWithDefault=({includedUserSelectedLeadSource:e})=>{const t=this.getLocalStorageMultitouchValue(),n=Zo(this.orgSlug);if(!t){const t=[{leadSourceValue:n,timestampInitiallyLogged:Br(new Date),type:"default"}];return e&&t.push({leadSourceValue:e,timestampInitiallyLogged:Br(new Date),type:"user-selected"}),t}const i=t.leadSources.length>0?t.leadSources.sort((e,t)=>qr(e.timestampInitiallyLogged).getTime()-qr(t.timestampInitiallyLogged).getTime())[0].timestampInitiallyLogged:Br(new Date),r=[{timestampInitiallyLogged:i,leadSourceValue:n,type:"default"},...t.leadSources.map(e=>({timestampInitiallyLogged:e.timestampInitiallyLogged,leadSourceValue:e.leadSourceValue,type:e.type}))];return e&&r.push({leadSourceValue:e,timestampInitiallyLogged:Br(new Date),type:"user-selected"}),r},this.getLocalStorageMultitouchValue=()=>{const e=this._generateLeadSourceLocalStorageKey(),t=localStorage.getItem(e);if(!t)return null;return JSON.parse(t)},this.isExpiredTimestamp=e=>qr(e)<new Date,this.resetLeadSourceTouchpoints=()=>{const e=this._generateLeadSourceLocalStorageKey();return localStorage.removeItem(e),!0},this.orgSlug=e,this.buildingSlug=t}}var $c,Sc=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 Ac=$c=class extends oe{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.centralConvo=!1,this.launcherStyles={},this.mobileStyles={},this.isMinimized=!1,this.primaryColor=null,this.backgroundColor=null,this.foregroundColorOnPrimaryBackgroundColor=null,this.foregroundColorOnSecondaryBackgroundColor=null,this._isMobile=Or(),this.chatId="",this.analytics=null,this.launcher=null,this.buildingWebchatView=null,this.designConcept=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=go.always,this.bedroomPreferenceRequired=!1,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.showTourNextToChat=!1,this.openTourSchedulerOnLoad=!1,this.displayPubnubChat=!1,this.myPubnub=null,this.LeadSourceClient=null,this.LeadSourceMultitouchClient=null,this.sampleRateToUse=.05,this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.overrideRentgrata=!1,this.widgetType=jc.Default,this.onWidgetLoaded=ql(),this.onSstClose=ql(),this.enabledChatWidgets={callDesktop:!1,callMobile:!1,chatMobile:!1,chatDesktop:!1,emailDesktop:!1,emailMobile:!1,textDesktop:!1,textMobile:!1,sstDesktop:!1,sstMobile:!1,calcDesktop:!1,calcMobile:!1},this.webchatConfigHasAutoOpenChat=!1,this.requiresConsent=!1,this.hideMobileFeatures=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.launcherRef=Ee(),this.firstUpdated=async()=>this.setupWebchat(),this.setupWebchat=async()=>{var e,t;if(!this.orgSlug)return;if(!this.centralConvo&&!this.buildingSlug)return;const n=this.centralConvo?await async function(e){const t=`https://app.meetelise.com/api/pub/v1/organization/${e}/webchat/v2`,n=await r().get(t);return aa(n.data)}(this.orgSlug):await oa(this.orgSlug,this.buildingSlug);if(Math.random()<.2)try{(async(e,t)=>{const n=window.rentgrata;if(!n)return;const i=n.Widget;if(!i)return;const o=i.config;if(!o)return;const a=o.widgetKey;a&&await r().post(`https://app.meetelise.com/platformApi/webchat/rentgrata?token=${a}`,{},{headers:{"Content-Type":"application/json","building-slug":null!=e?e:"","org-slug":null!=t?t:""}})})(this.buildingSlug,this.orgSlug)}catch(e){}try{fc(this.orgSlug,this.buildingSlug)}catch(e){}await Za(n,this.buildingSlug,this.orgSlug)&&(Yo({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_pixel_on_site:!0,is_any_webchat_showing:!0},sampleRate:(null==n?void 0:n.launchedDateTime)?.01:.05}),this.buildingWebchatView=n,await this.initializeChatVariables(),await this.handleChatInitializeAnalytics(),await this.setBuildingDerivedInfo(),this.attachOnClickToLauncher(),(e=>{const t=new URLSearchParams(window.location.search),n=t.get("rwg_token"),i=t.get("elise_google_env");if(!n||!i||!e)return;const r={rwgToken:n,environment:i,buildingId:e,expiresAt:Date.now()+2592e6};localStorage.setItem(Ha,JSON.stringify(r))})(null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.id)&&void 0!==t?t:0),"tour"===new URLSearchParams(window.location.search).get("elise_open")&&(this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile)?this.openTourSchedulerOnLoad=!0:this.shouldAutoOpenChat(this.webchatConfigHasAutoOpenChat)?(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()):"true"===localStorage.getItem("isChatOpen")&&(this.hideLauncher=!0,this.displayPubnubChat=!0),this.isLoading=!1)},this.setBuildingDerivedInfo=async()=>{var e,t,n,i,o,a,s,l,u,d,c,h,p,f,g,m,y,b,v,w,C,x,$,S,A,E,T,k,_,O,P,I,M,N,D,L,U,R,B,j,F,H,G,z,Q,W,q,V,Y;const K=this.buildingWebchatView;if(!K)return;K&&this.orgSlug&&Tc(this.orgSlug,null!==(t=null===(e=this.LeadSourceClient)||void 0===e?void 0:e.chatId)&&void 0!==t?t:null,this.sampleRateToUse,this.buildingSlug,null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null);const X=K.featureFlagWebchatMarketingSourceDropdownConfiguration,Z=K.featureFlagWebchatUseDniPhoneNumberBySource,J=K.featureFlagInsertDniIntoWebsite,ee=K.featureFlagWebchatReplaceAnyScheduleTourCtaWebsite;var te;te=wo.includes(K.orgId),xo=te;const[ne,ie,re,oe]=await Promise.all([gu(this.orgSlug,this.buildingSlug),mo(this.buildingSlug),yu(this.buildingSlug),yo(this.buildingSlug)]);this.buildingWebchatView&&(this.buildingWebchatView.phoneNumber=Gn(K.phoneNumber),this.buildingWebchatView.isAip=re),this.leadSources=ne,this.featureFlagShowDropdown=X,this.bedroomPreferenceRequired=oe;const ae=K.textWithUsPhoneNumber?K.textWithUsPhoneNumber:await(async e=>{try{const t="https://app.meetelise.com",n=await r().get(`${t}/platformApi/webchat/${e}/phone-number`);if(n.data)return n.data}catch(t){return Vo({logType:qo.error,buildingSlug:e,logTitle:"[ERROR_GETTING_PHONE_NUMBERS]",logData:{error:t},error:t}),null}return null})(this.buildingSlug),se=null!==(a=null===(o=this.buildingWebchatView)||void 0===o?void 0:o.shouldShowPricingCalculatorDesktop)&&void 0!==a&&a,le=null!==(l=null===(s=this.buildingWebchatView)||void 0===s?void 0:s.shouldShowPricingCalculatorMobile)&&void 0!==l&&l,ue={callDesktop:null!==(d=null===(u=this.buildingWebchatView)||void 0===u?void 0:u.shouldShowPhoneDesktop)&&void 0!==d&&d,callMobile:null!==(h=null===(c=this.buildingWebchatView)||void 0===c?void 0:c.shouldShowPhoneMobile)&&void 0!==h&&h,chatDesktop:null!==(f=null===(p=this.buildingWebchatView)||void 0===p?void 0:p.shouldShowChatDesktop)&&void 0!==f&&f,chatMobile:null!==(m=null===(g=this.buildingWebchatView)||void 0===g?void 0:g.shouldShowChatMobile)&&void 0!==m&&m,emailDesktop:null!==(b=null===(y=this.buildingWebchatView)||void 0===y?void 0:y.shouldShowEmailDesktop)&&void 0!==b&&b,emailMobile:null!==(w=null===(v=this.buildingWebchatView)||void 0===v?void 0:v.shouldShowEmailMobile)&&void 0!==w&&w,textDesktop:null!==(x=(null===(C=this.buildingWebchatView)||void 0===C?void 0:C.shouldShowTextDesktop)&&!!ae)&&void 0!==x&&x,textMobile:null!==(S=(null===($=this.buildingWebchatView)||void 0===$?void 0:$.shouldShowTextMobile)&&!!ae)&&void 0!==S&&S,sstDesktop:null!==(E=null===(A=this.buildingWebchatView)||void 0===A?void 0:A.shouldShowSstDesktop)&&void 0!==E&&E,sstMobile:null!==(k=null===(T=this.buildingWebchatView)||void 0===T?void 0:T.shouldShowSstMobile)&&void 0!==k&&k,calcDesktop:se,calcMobile:le};var de,ce;this.enabledChatWidgets=eu(ue),this.enabledChatWidgets.sstDesktop||this.enabledChatWidgets.sstMobile||"radco"===this.orgSlug?(Fu(this.handleTourClicked,this.orgSlug,this.buildingSlug,()=>this.isConnected),ee&&(ce=this.handleTourClicked,document.querySelectorAll('a[href$="schedule-a-tour"]').forEach(e=>{e&&e.addEventListener("click",e=>{e.preventDefault(),ce(e)})})),"radco"===this.orgSlug&&(e=>{document.querySelectorAll('a[href^="#leaseleads-tour-open"]').forEach(t=>{var n;if(!t)return;const i=document.createElement("a");i.textContent=t.textContent,i.style.cursor="pointer",i.addEventListener("click",t=>{t.preventDefault(),e(t)}),null===(n=t.parentNode)||void 0===n||n.replaceChild(i,t)})})(this.handleTourClicked)):(null===(_=this.LeadSourceClient)||void 0===_?void 0:_.leadSource)&&(de=null!==(P=null===(O=this.LeadSourceClient)||void 0===O?void 0:O.leadSource)&&void 0!==P?P: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(de)}`)}})),this.buildingWebchatView&&(this.primaryColor=null!==(I=this.buildingWebchatView.primaryColor)&&void 0!==I?I:null,this.backgroundColor=null!==(M=this.buildingWebchatView.secondaryColor)&&void 0!==M?M:null,this.foregroundColorOnPrimaryBackgroundColor=null!==(N=this.buildingWebchatView.foregroundColorOnPrimaryBackgroundColor)&&void 0!==N?N:null,this.foregroundColorOnSecondaryBackgroundColor=null!==(D=this.buildingWebchatView.foregroundColorOnSecondaryBackgroundColor)&&void 0!==D?D:null,this.webchatConfigHasAutoOpenChat=null!==(L=this.buildingWebchatView.autoOpenChat)&&void 0!==L&&L,this.requiresConsent=null!==(U=this.buildingWebchatView.requiresConsentForChat)&&void 0!==U&&U,this.hideMobileFeatures=null!==(R=this.buildingWebchatView.collapseMobileFeatures)&&void 0!==R&&R,this.privacyPolicyUrl=null!==(B=this.buildingWebchatView.privacyPolicyUrlForChat)&&void 0!==B?B:this.privacyPolicyUrl,this.buildingWebchatView.displayStyle===ta.MINIMIZED&&(this.isMinimized=!0),this.buildingWebchatView.displayStyle===ta.PILLS&&(this.designConcept=null),this.buildingWebchatView.displayStyle===ta.EMOJI&&(this.designConcept=ta.EMOJI),this.onWidgetLoaded()),null===this.primaryColor&&(this.primaryColor=Vn),null===this.backgroundColor&&(this.backgroundColor=Yn);const he=null!==(F=null===(j=this.buildingWebchatView)||void 0===j?void 0:j.phoneNumber)&&void 0!==F?F:"";let pe=null;if(Z&&(pe=await async function(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source`,{params:{source:t}});return n.data?{number:Gn(n.data.number),isMatch:n.data.match,isPropertyWebsiteCatchall:n.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,null!==(G=null===(H=this.LeadSourceClient)||void 0===H?void 0:H.leadSource)&&void 0!==G?G:null),pe&&!pe.isMatch&&(pe.number=he)),J&&(null==pe?void 0:pe.number)){const e=ju(pe.number,this.orgSlug,this.buildingSlug);e>0&&Yo({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_dni_insert_override_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}const fe=localStorage.getItem("eliseai_phone_number_devtest");fe&&ju(fe,this.orgSlug,this.buildingSlug),this.phoneNumberForSource=pe||{number:he,isMatch:!1,isPropertyWebsiteCatchall:!0};const ge=null!==(Q=null===(z=this.LeadSourceClient)||void 0===z?void 0:z.leadSource)&&void 0!==Q?Q:null;ge&&(this.leadSources.includes(ge)||this.leadSources.push(ge)),ro(K.id);if((ie||(null===(W=this.buildingWebchatView)||void 0===W?void 0:W.isAip))&&(null===(q=this.buildingWebchatView)||void 0===q?void 0:q.isLiveOnApplications)&&this.buildingSlug){const e=((e,t,n)=>{var i;const r=[/thehavenatgreenhill\.securecafe\.com\/onlineleasing\/the-haven-at-greenhill\/oleapplication\.aspx(\?.*)?$/,/securecafe\.com\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/onlineleasing.*\/oleapplication\.aspx(\?.*)?$/,/\/content\/apply/,/\/apply-now/,/\/apply/,/vsc\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/,/vsc\.myresman\.com\/Portal\/Applicants\/New\/.*(\?.*)?$/,/busboomgroup\.myresman\.com\/Portal\/Applicants\/Availability(\?.*)?$/],o=document.body.getElementsByTagName("a");let a=0;for(let s=0;s<o.length;s++){const l=o[s];if(l.nodeType===Node.ELEMENT_NODE&&r.some(e=>e.test(l.href))){const r=l.getAttribute("href"),o=(null===(i=l.textContent)||void 0===i?void 0:i.toLowerCase())||"",s=gc(o,e);l.setAttribute("href",s),a++,Vo({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"link-replacement",oldHref:r,newHref:s,website:window.location.href},logType:qo.info,buildingSlug:n,orgSlug:t})}}return 0===a&&Vo({logTitle:"SELECT_BUTTON_LINK_REPLACEMENT",logData:{type:"no-select-buttons-found",website:window.location.href},logType:qo.warn,buildingSlug:n,orgSlug:t}),a})(`https://applications.eliseai.com/building/${this.buildingSlug}/units`,this.orgSlug,this.buildingSlug);e>0&&Yo({params:{org_slug:this.orgSlug,building_slug:this.buildingSlug,is_application_link_replacement_success:!0,extra_data:{total_replacements:e}},sampleRate:this.sampleRateToUse})}if(this.buildingSlug&&this.orgSlug)try{(e=>{const t=mc[e];if(!t)return 0;const n=`${yc}/building/${t}/units`,i=`${yc}/building/${e}/units`,r=new RegExp(`https://applications\\.eliseai\\.com/building/${t}/units`,"g");let o=0;const a=document.body.getElementsByTagName("a");for(let e=0;e<a.length;e++){const t=a[e],s=t.getAttribute("href");if(!s||!s.includes(n))continue;const l=s.replace(r,i);l!==s&&(t.setAttribute("href",l),o++)}document.body.querySelectorAll("[onclick]").forEach(e=>{const t=e.getAttribute("onclick");if(!t||!t.includes(n))return;const a=t.replace(r,i);a!==t&&(e.setAttribute("onclick",a),o++)})})(this.buildingSlug)}catch{}this.buildingSlug&&(null===(V=this.buildingWebchatView)||void 0===V?void 0:V.isLiveOnApplications)&&(null===(Y=this.buildingWebchatView)||void 0===Y?void 0:Y.applicationLink)&&"c954426c-12ab-4f8e-8384-8218e79eaf72"===this.orgSlug&&Cc(this.orgSlug,this.buildingSlug,this.buildingWebchatView.applicationLink)},this.initializeChatVariables=async()=>{var e,t,n,i,r,o,a,s,l,u;if(!this.buildingWebchatView)return;const d=Pu(this.buildingSlug),c=Iu(this.buildingSlug,d),h=c?d:Ou(this.buildingSlug,!1);if(!h.leadId)throw new Error("Lead ID is null");this.LeadSourceClient=new Jo,this.LeadSourceClient.orgId=null!==(t=null===(e=this.buildingWebchatView)||void 0===e?void 0:e.orgId)&&void 0!==t?t:0,this.LeadSourceMultitouchClient=new xc(this.orgSlug,this.buildingSlug),this.myPubnub=new Uu(this.buildingSlug,this.buildingWebchatView,this.orgSlug,null,h.leadId,this.LeadSourceMultitouchClient,this.LeadSourceClient,this.widgetType);const p=await this.myPubnub.initSession(this.buildingSlug,this.orgSlug,c&&null!==(n=h.leadId)&&void 0!==n?n:void 0);p&&Ou(this.buildingSlug,h.initiatedChat,p.lead_id),this.LeadSourceClient.chatId=this.myPubnub.channel;const f=await(null===(i=this.LeadSourceClient)||void 0===i?void 0:i.generateUserLeadSource({leadId:null!==(o=null===(r=this.myPubnub)||void 0===r?void 0:r.leadUserId)&&void 0!==o?o:"",orgSlug:this.orgSlug,buildingSlug:this.buildingSlug}));f&&this.LeadSourceMultitouchClient.addSafeLeadSourceTouchpoint(f),"property-website"!==Zo(this.orgSlug)?this.myPubnub.leadSource=null!==(s=null===(a=this.LeadSourceClient)||void 0===a?void 0:a.leadSource)&&void 0!==s?s:Zo(this.orgSlug):this.myPubnub.leadSource=null!==(u=null===(l=this.LeadSourceClient)||void 0===l?void 0:l.leadSource)&&void 0!==u?u:null;const g=Pu(this.buildingSlug);g.initiatedChat&&await this.myPubnub.initializePubnub(g)},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!zr(qr(t)));return!!e&&!!n&&!Or()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",Br(function(e,t){return ii(2,arguments),wi(e,6e4*vi(t))}(new Date,15)))},this.handleContactClicked=e=>{var t;this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.showTourNextToChat?null===(t=this.launcherRef.value)||void 0===t||t.onClickSSTOption(e):(this.hideLauncher?this.showTourNextToChat=!0:this.displayPubnubChat=!1,this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e))},this.handleContactTabClicked=e=>{var t;this.displayPubnubChat=!1,this.showTourNextToChat=!1,this.hideLauncher=!1,null===(t=this.launcherRef.value)||void 0===t||t.onClickPhoneOption(e)},this.adjustPositionChatAdditionalActions=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("chatAdditionalActionsPubnub");if(!r)return;const o=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),a=null==o?void 0:o.getBoundingClientRect();a&&(r.style.left=`${a.left}px`,r.style.top=`${a.bottom}px`)},this.handleKeydownTab=e=>{var t,n,i,r,o,a,s,l;if("Tab"!==e.key)return;const u=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("meetelise-launcher"))||void 0===n?void 0:n.shadowRoot;let d=[];if(this.displayPubnubChat){const e=null===(o=null===(r=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat"))||void 0===r?void 0:r.shadowRoot)||void 0===o?void 0:o.getElementById("pubnub-chat-container"),t=null===(a=this.shadowRoot)||void 0===a?void 0:a.getElementById("chatAdditionalActionsPubnub");e&&d.push(...this.collectFocusableElements(e)),t&&d.push(...this.collectFocusableElements(t))}else{const e=null!==(l=null!==(s=null==u?void 0:u.getElementById("email-us-window"))&&void 0!==s?s:null==u?void 0:u.getElementById("tour-scheduler-window"))&&void 0!==l?l:null==u?void 0:u.getElementById("call-us-window");e&&(d=this.collectFocusableElements(e))}if(0===d.length)return;e.preventDefault();const c=this.getDeepActiveElement(),h=d.findIndex(e=>e===c);d[e.shiftKey?(h-1+d.length)%d.length:(h+1)%d.length].focus()},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized,this.showTourNextToChat=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,localStorage.setItem("isChatOpen","true")},e.onExitChat=this.onExitChat)},this.onExitChat=()=>{this.displayPubnubChat=!1,this.hideLauncher=!1,this.showTourNextToChat=!1,localStorage.setItem("isChatOpen","false")}}async handleChatInitializeAnalytics(){var e,t,n,i;this.analytics=new Qo(this.orgSlug,this.buildingSlug,null!==(t=null===(e=this.myPubnub)||void 0===e?void 0:e.channel)&&void 0!==t?t:"",null!==(i=null===(n=this.LeadSourceClient)||void 0===n?void 0:n.leadSource)&&void 0!==i?i:null),Math.random()<.05&&this.analytics.ping("webchat_heartbeat")}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),_u(this.buildingSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.setupWebchat(),this.hideLauncher=!1}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.adjustPositionChatAdditionalActions),window.addEventListener("keydown",this.handleKeydownTab),this._cleanupMobileListener=Pr(e=>{this._isMobile=e})}static isFocusable(e){return!("disabled"in e)||!e.disabled}collectFocusableElements(e){const t=[];e instanceof Element&&e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));const n=e.querySelectorAll("*");for(const e of Array.from(n))e.matches($c.FOCUSABLE_SELECTOR)&&$c.isFocusable(e)&&t.push(e),e.shadowRoot&&t.push(...this.collectFocusableElements(e.shadowRoot));return t}getDeepActiveElement(){let e=document.activeElement,t=0;for(;(null==e?void 0:e.shadowRoot)&&(null==e?void 0:e.shadowRoot.activeElement);)if(t+=1,e=null==e?void 0:e.shadowRoot.activeElement,t>100){Vo({logType:qo.error,buildingSlug:this.buildingSlug,logTitle:"[ERROR_GETTING_DEEP_ELEMENT]",logData:{message:"error getting deep active element"}});break}return e}updated(){this.adjustPositionChatAdditionalActions()}disconnectedCallback(){var e,t;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),window.removeEventListener("resize",this.adjustPositionChatAdditionalActions),window.removeEventListener("keydown",this.handleKeydownTab),null===(t=this._cleanupMobileListener)||void 0===t||t.call(this),super.disconnectedCallback()}render(){var e,t,n,i,r,o,a,s,l,u,d,c,h,p,f,g,m,y,b,v,w,C,x,$,S,A,E,T,k,_,O,P,I,M,N,D,L,U,B,j,F,H,G,z,Q,W,q;Xl();const V=this.hideLauncher&&!this.isLoading&&!this._isMobile;return R`
|
|
7302
7302
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7303
7303
|
${this.displayPubnubChat?R`
|
|
7304
7304
|
<pubnub-chat
|
|
@@ -780,6 +780,7 @@ export class TourScheduler extends LitElement {
|
|
|
780
780
|
).map((source) => snakify({ ...source })),
|
|
781
781
|
google_rwg_token: googleReferral?.rwgToken,
|
|
782
782
|
google_referral_building_id: googleReferral?.buildingId,
|
|
783
|
+
google_environment: googleReferral?.environment,
|
|
783
784
|
};
|
|
784
785
|
|
|
785
786
|
const url = `https://app.meetelise.com/platformApi/state/create/v2/scheduleMe`;
|
|
@@ -22,26 +22,33 @@ describe("Google Reserve", () => {
|
|
|
22
22
|
visit(originalSearch);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
it("remembers a click from
|
|
26
|
-
visit("?elise_open=tour&rwg_token=AFd1x%3D%3D");
|
|
25
|
+
it("remembers a click from our Google feed, keeping the token intact", () => {
|
|
26
|
+
visit("?elise_open=tour&elise_google_env=production&rwg_token=AFd1x%3D%3D");
|
|
27
27
|
storeGoogleReserveReferral(7);
|
|
28
28
|
visit("");
|
|
29
29
|
|
|
30
30
|
expect(readGoogleReserveReferral()).to.include({
|
|
31
31
|
rwgToken: "AFd1x==",
|
|
32
|
+
environment: "production",
|
|
32
33
|
buildingId: 7,
|
|
33
34
|
});
|
|
34
35
|
});
|
|
35
36
|
|
|
36
|
-
it("has no referral without
|
|
37
|
+
it("has no referral without our feed's token or once it has expired", () => {
|
|
37
38
|
visit("?utm_source=website");
|
|
38
39
|
storeGoogleReserveReferral(7);
|
|
39
40
|
expect(readGoogleReserveReferral()).to.equal(null);
|
|
40
41
|
|
|
42
|
+
// Another integration's Google link.
|
|
43
|
+
visit("?rwg_token=AFd1x%3D%3D");
|
|
44
|
+
storeGoogleReserveReferral(7);
|
|
45
|
+
expect(readGoogleReserveReferral()).to.equal(null);
|
|
46
|
+
|
|
41
47
|
localStorage.setItem(
|
|
42
48
|
STORAGE_KEY,
|
|
43
49
|
JSON.stringify({
|
|
44
50
|
rwgToken: "AFd1x==",
|
|
51
|
+
environment: "production",
|
|
45
52
|
buildingId: 7,
|
|
46
53
|
expiresAt: Date.now() - 1,
|
|
47
54
|
})
|
package/src/googleReserve.ts
CHANGED
|
@@ -3,9 +3,12 @@ const REFERRAL_TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
|
|
3
3
|
const REFERRAL_STORAGE_KEY = "com.eliseai.webchat.googlereserve.referral";
|
|
4
4
|
// Google "Book" links to a customer's page add this so the widget opens the tour scheduler.
|
|
5
5
|
const OPEN_PARAM = "elise_open";
|
|
6
|
+
// Our Google feed tags its links with the Actions Center environment.
|
|
7
|
+
const ENVIRONMENT_PARAM = "elise_google_env";
|
|
6
8
|
|
|
7
9
|
type GoogleReserveReferral = {
|
|
8
10
|
rwgToken: string;
|
|
11
|
+
environment: string;
|
|
9
12
|
buildingId: number;
|
|
10
13
|
expiresAt: number;
|
|
11
14
|
};
|
|
@@ -16,14 +19,19 @@ export const shouldOpenTourSchedulerFromUrl = (): boolean =>
|
|
|
16
19
|
/**
|
|
17
20
|
* Remembers a click from a building's Google listing, which arrives with an
|
|
18
21
|
* `rwg_token` query param, so a booking within 30 days can be reported back.
|
|
22
|
+
* Only links from our feed count: other integrations' links carry an
|
|
23
|
+
* `rwg_token` too.
|
|
19
24
|
*/
|
|
20
25
|
export const storeGoogleReserveReferral = (buildingId: number): void => {
|
|
21
|
-
const
|
|
22
|
-
|
|
26
|
+
const params = new URLSearchParams(window.location.search);
|
|
27
|
+
const rwgToken = params.get("rwg_token");
|
|
28
|
+
const environment = params.get(ENVIRONMENT_PARAM);
|
|
29
|
+
if (!rwgToken || !environment || !buildingId) {
|
|
23
30
|
return;
|
|
24
31
|
}
|
|
25
32
|
const referral: GoogleReserveReferral = {
|
|
26
33
|
rwgToken,
|
|
34
|
+
environment,
|
|
27
35
|
buildingId,
|
|
28
36
|
expiresAt: Date.now() + REFERRAL_TTL_MS,
|
|
29
37
|
};
|