@meetelise/chat 1.53.1 → 1.53.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/googleReserve.d.ts +3 -0
- package/package.json +1 -1
- package/public/dist/index.js +9 -3
- package/src/MyPubnub.ts +2 -1
- package/src/WebComponent/Scheduler/tour-scheduler.ts +1 -0
- package/src/WebComponent/pubnub-media.ts +6 -0
- package/src/googleReserve.test.ts +10 -3
- package/src/googleReserve.ts +10 -2
- package/src/pubnub-chat.test.ts +53 -1
|
@@ -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}
|
|
@@ -6125,7 +6125,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6125
6125
|
${Ja}
|
|
6126
6126
|
${es}
|
|
6127
6127
|
${ts}
|
|
6128
|
-
`,Yl([ue({attribute:!0})],Kl.prototype,"isMinimized",void 0),Yl([ue()],Kl.prototype,"mobileStyles",void 0),Yl([ue({type:Boolean})],Kl.prototype,"isFirstMount",void 0),Yl([ue({attribute:!1})],Kl.prototype,"openSSTWindowOnLoad",void 0),Yl([ue({attribute:!1})],Kl.prototype,"autoOpenChatWidget",void 0),Yl([ue()],Kl.prototype,"phoneNumber",void 0),Yl([ue({attribute:!0})],Kl.prototype,"buildingName",void 0),Yl([ue({attribute:!0})],Kl.prototype,"chatId",void 0),Yl([ue({attribute:!0})],Kl.prototype,"orgLegalName",void 0),Yl([ue({attribute:!1})],Kl.prototype,"country",void 0),Yl([ue({attribute:!1})],Kl.prototype,"buildingState",void 0),Yl([ue({attribute:!0})],Kl.prototype,"chatCallUsHeader",void 0),Yl([ue({attribute:!1})],Kl.prototype,"buildingId",void 0),Yl([ue({type:Number})],Kl.prototype,"orgId",void 0),Yl([ue({attribute:!1})],Kl.prototype,"leadSourceParams",void 0),Yl([ue({attribute:!0})],Kl.prototype,"buildingSlug",void 0),Yl([ue({attribute:!0})],Kl.prototype,"orgSlug",void 0),Yl([ue({attribute:!0})],Kl.prototype,"sgtUrl",void 0),Yl([ue({attribute:!0})],Kl.prototype,"selfGuidedTourEnabled",void 0),Yl([ue({attribute:!0})],Kl.prototype,"selfGuidedToursTypeOffered",void 0),Yl([ue({attribute:!0})],Kl.prototype,"designConcept",void 0),Yl([ue({attribute:!0})],Kl.prototype,"featureFlagShowDropdown",void 0),Yl([ue({attribute:!1})],Kl.prototype,"leadSources",void 0),Yl([ue({attribute:!0})],Kl.prototype,"currentLeadSource",void 0),Yl([ue({attribute:!0})],Kl.prototype,"escortedToursLink",void 0),Yl([ue({attribute:!0})],Kl.prototype,"escortedToursTypeOffered",void 0),Yl([ue({attribute:!0})],Kl.prototype,"virtualToursLink",void 0),Yl([ue({attribute:!0})],Kl.prototype,"virtualToursTypeOffered",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasChatEnabledDesktop",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasChatEnabledMobile",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasEmailEnabledDesktop",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasEmailEnabledMobile",void 0),Yl([ue({attribute:!0})],Kl.prototype,"hasApplyNowEnabledDesktop",void 0),Yl([ue({attribute:!0})],Kl.prototype,"hasApplyNowEnabledMobile",void 0),Yl([ue({attribute:!0})],Kl.prototype,"applicationLink",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasCallUsEnabledDesktop",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasCallUsEnabledMobile",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasTextUsEnabledDesktop",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasTextUsEnabledMobile",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasSSTEnabledDesktop",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasSSTEnabledMobile",void 0),Yl([ue({attribute:!1})],Kl.prototype,"tourTypeOptions",void 0),Yl([ue({attribute:!1})],Kl.prototype,"layoutOptions",void 0),Yl([ue({attribute:!0})],Kl.prototype,"bedroomPreferenceRequired",void 0),Yl([ue({attribute:!0})],Kl.prototype,"hasDynamicSchedulingEnabled",void 0),Yl([ue({attribute:!0})],Kl.prototype,"hasPricingCalculatorEnabledDesktop",void 0),Yl([ue({attribute:!0})],Kl.prototype,"hasPricingCalculatorEnabledMobile",void 0),Yl([ue({attribute:!1})],Kl.prototype,"hasHideMobileFeatures",void 0),Yl([ue({type:Number})],Kl.prototype,"right",void 0),Yl([ue({type:Number})],Kl.prototype,"bottom",void 0),Yl([ue({type:Number})],Kl.prototype,"top",void 0),Yl([ue({type:Number})],Kl.prototype,"left",void 0),Yl([ue({attribute:!0})],Kl.prototype,"showTourNextToChat",void 0),Yl([ue({attribute:!1})],Kl.prototype,"onChatTapped",void 0),Yl([ue({attribute:!0})],Kl.prototype,"onClickMinimize",void 0),Yl([ue({attribute:!0})],Kl.prototype,"onSstClose",void 0),Yl([ue({attribute:!0})],Kl.prototype,"overrideRentgrata",void 0),Yl([ue({attribute:!1})],Kl.prototype,"launcherStyles",void 0),Yl([ue({attribute:!0})],Kl.prototype,"primaryColor",void 0),Yl([ue({attribute:!0})],Kl.prototype,"backgroundColor",void 0),Yl([ue({attribute:!0})],Kl.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Yl([ue({attribute:!0})],Kl.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),Yl([ue({attribute:!0})],Kl.prototype,"leadSourceClient",void 0),Yl([de()],Kl.prototype,"leadSourceMultitouchClient",void 0),Yl([de()],Kl.prototype,"_isMobile",void 0),Yl([de()],Kl.prototype,"isEmailWindowOpen",void 0),Yl([de()],Kl.prototype,"isCallUsWindowOpen",void 0),Yl([de()],Kl.prototype,"isSSTWindowOpen",void 0),Yl([de()],Kl.prototype,"isTextUsWindowOpen",void 0),Yl([de()],Kl.prototype,"isCalculatorWindowOpen",void 0),Yl([de()],Kl.prototype,"isMobileFeaturesExpanded",void 0),Kl=Yl([se("meetelise-launcher")],Kl);const Xl=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Kl)},Zl=["app.meetelise.com","staging.eliseai.com","localhost"],Jl={calculator:{desktop:"calcDesktop",mobile:"calcMobile"},email:{desktop:"emailDesktop",mobile:"emailMobile"},call:{desktop:"callDesktop",mobile:"callMobile"},text:{desktop:"textDesktop",mobile:"textMobile"},sst:{desktop:"sstDesktop",mobile:"sstMobile"}},eu=e=>{const t=window.location.hostname;if(!Zl.includes(t))return e;const n=(e=>{if(!e)return{};try{return e.split(",").reduce((e,t)=>{const[n,i]=t.split(":");return n&&i&&n in Jl&&(e[n]="true"===i.toLowerCase()),e},{})}catch(e){return{}}})(new URLSearchParams(window.location.search).get("widgets"));if(0===Object.keys(n).length)return e;const i={...e};return Object.entries(n).forEach(([e,t])=>{const n=Jl[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var tu=n(5072),nu=n.n(tu),iu=n(7825),ru=n.n(iu),ou=n(7659),au=n.n(ou),su=n(5056),lu=n.n(su),uu=n(540),du=n.n(uu),cu=n(1113),hu=n.n(cu),pu=n(5541),fu={};fu.styleTagTransform=hu(),fu.setAttributes=lu(),fu.insert=au().bind(null,"head"),fu.domAPI=ru(),fu.insertStyleElement=du();nu()(pu.A,fu);pu.A&&pu.A.locals&&pu.A.locals;async function gu(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${t}/lead-sources`);if(n.data){if("7e352741-1120-4ccf-9929-5dc99193a908"===e){const e=["Zillow","Apartments.com","Google PPC","Google Maps","Apple Maps","Social Media","Print Marketing"];return n.data.filter(t=>e.includes(t))}return mu(n.data,t)}return[]}catch(e){return[]}}const mu=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter(e=>{const t=e.toLowerCase();return!n.map(e=>e.toLowerCase()).includes(t)})};async function yu(e){var t,n;if(!e)return!1;try{return null!==(n=null===(t=(await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/aip`)).data)||void 0===t?void 0:t.is_aip)&&void 0!==n&&n}catch(e){return!1}}var bu,vu=n(8805),wu=n.n(vu),Cu=new Uint8Array(16);function xu(){if(!bu&&!(bu="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return bu(Cu)}const $u=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const Su=function(e){return"string"==typeof e&&$u.test(e)};for(var Au=[],Eu=0;Eu<256;++Eu)Au.push((Eu+256).toString(16).substr(1));const Tu=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Au[e[t+0]]+Au[e[t+1]]+Au[e[t+2]]+Au[e[t+3]]+"-"+Au[e[t+4]]+Au[e[t+5]]+"-"+Au[e[t+6]]+Au[e[t+7]]+"-"+Au[e[t+8]]+Au[e[t+9]]+"-"+Au[e[t+10]]+Au[e[t+11]]+Au[e[t+12]]+Au[e[t+13]]+Au[e[t+14]]+Au[e[t+15]]).toLowerCase();if(!Su(n))throw TypeError("Stringified UUID is invalid");return n};const ku=function(e,t,n){var i=(e=e||{}).random||(e.rng||xu)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return Tu(i)},_u=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Ou=(e,t,n)=>{const i=Br(new Date),r=n||`lead_${ku()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:qr(i),buildingSlug:e,initiatedChat:t}},Pu=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(Iu(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Iu=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if($r(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!Ir(t.timestamp,24)};var Mu;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(Mu||(Mu={}));const Nu=e=>e.type===Lu.text,Du=e=>e.type===Lu.media;var Lu;!function(e){e.text="text",e.media="media"}(Lu||(Lu={}));const Uu=class{constructor(e,t,n,i=null,r,o,a=null,s=jc.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.firedScheduledTourConfirmationIds=new Set,this.widgetType=jc.Default,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.sessionToken=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t;const n={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,n],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter(e=>e.message.messageType!==Mu.noReply),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const i="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;if(null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:i}),!i&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=i,"ai_message"===e.message.customType){const t=e.message.stream_id,n=null!=t?t:String(+e.timetoken);(t?this.reconstructStreamText(t):e.message.text).includes("confirmed for your")&&this.fireScheduledTourEventOnce(n,e.message)}this.checkAndHandleGTMForLeadEmail(e)}},this.isLoadingMessages=!1,this.isFirstChatMessageSent=!1,this.streamingMessageTimeout=null,this.checkAndHandleDelayStreamingMessages=({delayToFetchHistoryInMs:e=1e4}={})=>{this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null);const t=new Map;this.rawPubnubMessages.forEach(e=>{var n;const i=e.message.stream_id;i&&t.set(i,[...null!==(n=t.get(i))&&void 0!==n?n:[],e])});const n=[...t.entries()].filter(([,e])=>!this.isStreamComplete(e)).map(([e])=>e);n.length>0&&(this.streamingMessageTimeout=setTimeout(()=>{Vo({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:qo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory().then(()=>n.forEach(e=>this.checkAndFireTourConfirmationForStream(e)))},e))},this.isStreamComplete=e=>{var t;const n=e.find(e=>e.message.is_done);if(!n)return!1;const i=new Set(e.map(e=>{var t;return null!==(t=e.message.order)&&void 0!==t?t:0}));for(let e=0;e<=(null!==(t=n.message.order)&&void 0!==t?t:0);e++)if(!i.has(e))return!1;return!0},this.getStreamChunks=e=>this.removeDuplicatedRawPubnubMessages(this.rawPubnubMessages).filter(t=>t.message.stream_id===e).sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}),this.reconstructStreamText=e=>this.getStreamChunks(e).map(e=>e.message.text).join(""),this.fireScheduledTourEventOnce=(e,t)=>{var n;this.firedScheduledTourConfirmationIds.has(e)||(this.firedScheduledTourConfirmationIds.add(e),$o("scheduledTourEvent",{tourDetails:t,buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))},this.checkAndFireTourConfirmationForStream=e=>{var t;if(this.reconstructStreamText(e).includes("confirmed for your")){const n=this.getStreamChunks(e);this.fireScheduledTourEventOnce(e,null===(t=n[n.length-1])||void 0===t?void 0:t.message)}},this.checkAndHandleGTMForLeadEmail=e=>{var t;try{if("lead_message"!==e.message.customType)return;if(!(e=>{try{return/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b/.test(e)}catch(e){return!1}})(e.message.text))return;$o("leadProvidedEmail",{buildingId:null===(t=this.buildingWebchatView)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}catch(e){return}},this.markEveryPreviousNoReplyMessageDone=e=>{var t,n;for(let i=e.length-1;i>=0;i--){const r=null===(t=e[i])||void 0===t?void 0:t.message,o=i>0&&(null===(n=e[i-1])||void 0===n?void 0:n.message);(null==r?void 0:r.messageType)===Mu.noReply&&o&&(o.is_done=!0)}},this.checkMessageChunkValid=e=>{try{return!!e.message&&!!e.message.text&&e.message.text.length>0&&!!e.message.customType}catch(e){return!1}},this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.buildingWebchatView&&Vo({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null),this.removeChatListeners()},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub){const e=Ou(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken(async()=>{var t,n,i,r,o,a,s,l,u;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout(()=>{this.buildingWebchatView&&Vo({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})},9e4),0===this.simpleChatMessages.length&&(null===(t=this.leadSourceClient)||void 0===t||t.checkAndHandleForLogLeadSource({webchatAction:"chat",stateId:null})),this.widgetType===jc.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),orgSlug:this.orgSlug}}):(await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,userId:null===(i=this.buildingWebchatView)||void 0===i?void 0:i.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),lead_sources_with_timestamps:(null!==(o=null===(r=this.leadSourceMultitouchClient)||void 0===r?void 0:r.getSafeLeadSourceTouchpointsWithDefault({includedUserSelectedLeadSource:null}))&&void 0!==o?o:[]).map(e=>Tr({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||($o("firstChatMessageSent",{message:e,buildingId:null===(l=this.buildingWebchatView)||void 0===l?void 0:l.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),$o("chatMessageSent",{message:e,buildingId:null===(u=this.buildingWebchatView)||void 0===u?void 0:u.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))}),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.removeDuplicatedRawPubnubMessages=e=>{const t=new Set;return e.filter(e=>{if("lead_message"===e.message.customType||!e.message.stream_id||!e.message.order)return!0;const n=`${e.message.stream_id}-${e.message.order}-${e.message.messageType}`;return t.has(n)?(Vo({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:qo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),!1):(t.add(n),!0)})},this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],n={};return this.removeDuplicatedRawPubnubMessages(e).forEach(e=>{var i;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:Lu.media}):!e.message.stream_id||e.message.is_done&&0===e.message.order?t.push({timestamp:e.timetoken,message:e.message.text,isLeadMessage:this.isLeadMessage(e),chunks:[{text:e.message.text,order:0,isDone:!0}],type:Lu.text}):n[e.message.stream_id]?n[e.message.stream_id].push(e):n[e.message.stream_id]=[e]}),Object.keys(n).forEach(e=>{const i=n[e],r=this.getConsecutiveChunks(i.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)})),o=r.map(e=>e.message.text).join(""),a=r[0],s={timestamp:a.timetoken,message:o,isLeadMessage:this.isLeadMessage(a),chunks:r.map(e=>{var t,n;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(n=e.message.is_done)&&void 0!==n&&n}}),type:Lu.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)}),t.sort((e,t)=>e.timestamp-t.timestamp),t},this.getConsecutiveChunks=e=>{var t,n;const i=e.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}),r=[];let o=null!==(t=i[0].message.order)&&void 0!==t?t:0;for(const e of i){if((null!==(n=e.message.order)&&void 0!==n?n:-1)!==o)break;r.push(e),o++}return r},this.isMessageStillStreamingChunks=e=>{const t=e.find(e=>e.message.is_done);return!t||e.length===t.message.order},this.buildingSlug=e,this.buildingWebchatView=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=a,this.leadSourceMultitouchClient=o,this.widgetType=s}async initSession(e,t,n){try{const i={building_slug:e,org_slug:t};n&&(i.lead_id=n);const o=await r().post(`${this.apiHost}/platformApi/webchat/init`,i);return this.sessionToken=o.data.session_token,this.leadUserId=o.data.lead_id,this.channel=o.data.channel,o.data}catch(e){return this.buildingWebchatView&&Vo({logTitle:"WEBCHAT_INIT_SESSION_ERROR",logData:{error:e},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e}),null}}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(wu())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token,origin:"meetelise.pubnubapi.com"}),this.withAuthToken(()=>new Promise(()=>this.handleChatListeners())),await this.withAuthToken(()=>this.getChannelHistory()),this.pubnub):void 0}async fetchToken(e,t){try{if(this.sessionToken){const e="healthcare"===this.widgetType?"?industry=health_care":"";return(await r().get(`${this.apiHost}/platformApi/webchat/pn/v2/request-token${e}`,{headers:{"X-Session-Token":this.sessionToken}})).data}return(await r().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${t}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.buildingWebchatView&&Vo({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}return null}async fetchChannelExists(e){try{return(await r().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.buildingWebchatView&&Vo({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}return!1}async withAuthToken(e){try{await e()}catch(t){if(t instanceof i.AxiosError&&t&&t.response&&403===t.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const t=await this.fetchToken(this.leadUserId,this.channel);if(!t)return;this.pubnub.setAuthKey(t.auth.result.token),await e()}catch(e){this.buildingWebchatView&&Vo({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}}async getChannelHistory(e=1500){var t;try{let n=[],i=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise((n,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=i?i:void 0},(e,t)=>{e.error?o(e):n(t)})}),a=o.channels[this.channel];if(!a)break;if(a.sort((e,t)=>+e.timetoken-+t.timetoken),!a||0===a.length)break;if(this.channel&&0!==Object.keys(o.channels).length){const e=o.channels[this.channel],t=[];e.forEach(e=>{e.uuid&&t.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})}),this.markEveryPreviousNoReplyMessageDone(t),n=n.concat(t.filter(e=>e.message.messageType!==Mu.noReply))}if(i=a[0].timetoken,n.length>=e||a.length<r)break}this.rawPubnubMessages=n.slice(0,e),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:!1})}catch(e){this.buildingWebchatView&&Vo({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:qo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},Ru=new Set(["8009855990","8338526262","8002221222","8006624357","8002738255","8007997233","8007874889","8006564673","8004224453","8883737888","8006213362","8009506264","8558272736","8008435678","8007862929","8008523836","8007849433","8007729100","8006699777","8006858470","8004322209","8003473735","8008778339","8009552232","8002255342","8009272891","8003049320","8007937724","8002382333","8003353863","8776858878","8003329227","8776554371","8772944357","8772944356","6092925760","6092926735","8007928339","8008329173","8882853036","6092921210","8007929773","8003561561","8003826717","8005727233","8009291040","8888958179","8006879512","8004262537","8773475463","8774149251","8005103102","8889372835","8007010710","8007010720","8774288844","8007929745","8003283838","6092927060","6092928319","8008527899","8662401347","8009923678","8776522873","8776527624","8003313937","8008435437","8776536783","8778392339","8003676274","8006896411"]),Bu=e=>{const t=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1");return Ru.has(t)},ju=(e,t,n)=>{try{const i=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1"),r=`tel:${i}`,o=`sms:${i}`,a=`whatsapp://send?phone=${i}`,s=`facetime:${i}`,l=`facetime-audio:${i}`,u=/(?:\+1[\s.-]?)?(?:\([2-9]\d{2}\)[\s.-]?|[2-9]\d{2}[\s.-])[2-9]\d{2}[\s.-]?\d{4}/g,d=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,c=/whatsapp:\/\/send\?phone=\d+/g,h=/(facetime|facetime-audio):\d+/g,p=/emergency|emergencia/i,f=300,g=e=>!(!e||e.length>f)&&p.test(e),m=e=>{var t,n,i,r;if(g(e.textContent))return!0;if(g(null===(t=e.previousElementSibling)||void 0===t?void 0:t.textContent)||g(null===(n=e.nextElementSibling)||void 0===n?void 0:n.textContent))return!0;const o=e.parentElement;return!(!o||!g(null===(i=o.previousElementSibling)||void 0===i?void 0:i.textContent)&&!g(null===(r=o.nextElementSibling)||void 0===r?void 0:r.textContent))},y=document.body.getElementsByTagName("*");let b=!1;const v=i.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let w=!1,C=!1,x=0;for(let e=0;e<y.length;e++)if(y[e].nodeType===Node.ELEMENT_NODE&&!m(y[e])){if(1===y[e].childNodes.length&&y[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=y[e].textContent;if(!t)continue;const n=t.replace(u,e=>{if(Bu(e))return e;return e.startsWith("+1 ")?`+1 ${v}`:v});t!==n&&(x++,y[e].textContent=n),b=!0,w||(w=!0)}if(y[e].hasAttribute("href")){const t=y[e].getAttribute("href");if(!t)continue;let n="",i=d;if(t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=c):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r,Bu(t))continue;const u=t.replace(i,n);if(y[e].setAttribute("href",u),(t.startsWith("tel:")||t.startsWith("sms:"))&&u===t&&u!==n){t.replace(/\D/g,"").length>=7&&y[e].setAttribute("href",t.startsWith("tel:")?r:o)}C||(C=!0)}}return w&&Vo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:v,website:window.location.href},logType:qo.info,buildingSlug:n,orgSlug:t}),C&&Vo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:v,website:window.location.href},logType:qo.info,buildingSlug:n,orgSlug:t}),b||Vo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:qo.warn,buildingSlug:n,orgSlug:t}),x}catch(e){return Vo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"insertion-error",error:e instanceof Error?e.message:String(e),website:window.location.href},logType:qo.error,buildingSlug:n,orgSlug:t,error:e}),0}},Fu=(e,t,n,i)=>{document.querySelectorAll("a").forEach(function(r){const o=r.getAttribute("href");o&&o.startsWith("https://app.meetelise.com/")&&((e,t,n)=>{const[i,r,o,...a]=new URL(e).pathname.split("/").filter(Boolean).map(e=>e.toLowerCase());return 0===a.length&&"tour"===o&&i===t.toLowerCase()&&r===n.toLowerCase()})(o,t,n)&&r.addEventListener("click",t=>{i()&&(t.preventDefault(),e(t))})})};var Hu=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 Gu=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=Vn,this.foregroundColorOnPrimaryBackgroundColor="white",this.toExpand=!1}render(){return R`
|
|
6128
|
+
`,Yl([ue({attribute:!0})],Kl.prototype,"isMinimized",void 0),Yl([ue()],Kl.prototype,"mobileStyles",void 0),Yl([ue({type:Boolean})],Kl.prototype,"isFirstMount",void 0),Yl([ue({attribute:!1})],Kl.prototype,"openSSTWindowOnLoad",void 0),Yl([ue({attribute:!1})],Kl.prototype,"autoOpenChatWidget",void 0),Yl([ue()],Kl.prototype,"phoneNumber",void 0),Yl([ue({attribute:!0})],Kl.prototype,"buildingName",void 0),Yl([ue({attribute:!0})],Kl.prototype,"chatId",void 0),Yl([ue({attribute:!0})],Kl.prototype,"orgLegalName",void 0),Yl([ue({attribute:!1})],Kl.prototype,"country",void 0),Yl([ue({attribute:!1})],Kl.prototype,"buildingState",void 0),Yl([ue({attribute:!0})],Kl.prototype,"chatCallUsHeader",void 0),Yl([ue({attribute:!1})],Kl.prototype,"buildingId",void 0),Yl([ue({type:Number})],Kl.prototype,"orgId",void 0),Yl([ue({attribute:!1})],Kl.prototype,"leadSourceParams",void 0),Yl([ue({attribute:!0})],Kl.prototype,"buildingSlug",void 0),Yl([ue({attribute:!0})],Kl.prototype,"orgSlug",void 0),Yl([ue({attribute:!0})],Kl.prototype,"sgtUrl",void 0),Yl([ue({attribute:!0})],Kl.prototype,"selfGuidedTourEnabled",void 0),Yl([ue({attribute:!0})],Kl.prototype,"selfGuidedToursTypeOffered",void 0),Yl([ue({attribute:!0})],Kl.prototype,"designConcept",void 0),Yl([ue({attribute:!0})],Kl.prototype,"featureFlagShowDropdown",void 0),Yl([ue({attribute:!1})],Kl.prototype,"leadSources",void 0),Yl([ue({attribute:!0})],Kl.prototype,"currentLeadSource",void 0),Yl([ue({attribute:!0})],Kl.prototype,"escortedToursLink",void 0),Yl([ue({attribute:!0})],Kl.prototype,"escortedToursTypeOffered",void 0),Yl([ue({attribute:!0})],Kl.prototype,"virtualToursLink",void 0),Yl([ue({attribute:!0})],Kl.prototype,"virtualToursTypeOffered",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasChatEnabledDesktop",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasChatEnabledMobile",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasEmailEnabledDesktop",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasEmailEnabledMobile",void 0),Yl([ue({attribute:!0})],Kl.prototype,"hasApplyNowEnabledDesktop",void 0),Yl([ue({attribute:!0})],Kl.prototype,"hasApplyNowEnabledMobile",void 0),Yl([ue({attribute:!0})],Kl.prototype,"applicationLink",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasCallUsEnabledDesktop",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasCallUsEnabledMobile",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasTextUsEnabledDesktop",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasTextUsEnabledMobile",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasSSTEnabledDesktop",void 0),Yl([ue({type:Boolean})],Kl.prototype,"hasSSTEnabledMobile",void 0),Yl([ue({attribute:!1})],Kl.prototype,"tourTypeOptions",void 0),Yl([ue({attribute:!1})],Kl.prototype,"layoutOptions",void 0),Yl([ue({attribute:!0})],Kl.prototype,"bedroomPreferenceRequired",void 0),Yl([ue({attribute:!0})],Kl.prototype,"hasDynamicSchedulingEnabled",void 0),Yl([ue({attribute:!0})],Kl.prototype,"hasPricingCalculatorEnabledDesktop",void 0),Yl([ue({attribute:!0})],Kl.prototype,"hasPricingCalculatorEnabledMobile",void 0),Yl([ue({attribute:!1})],Kl.prototype,"hasHideMobileFeatures",void 0),Yl([ue({type:Number})],Kl.prototype,"right",void 0),Yl([ue({type:Number})],Kl.prototype,"bottom",void 0),Yl([ue({type:Number})],Kl.prototype,"top",void 0),Yl([ue({type:Number})],Kl.prototype,"left",void 0),Yl([ue({attribute:!0})],Kl.prototype,"showTourNextToChat",void 0),Yl([ue({attribute:!1})],Kl.prototype,"onChatTapped",void 0),Yl([ue({attribute:!0})],Kl.prototype,"onClickMinimize",void 0),Yl([ue({attribute:!0})],Kl.prototype,"onSstClose",void 0),Yl([ue({attribute:!0})],Kl.prototype,"overrideRentgrata",void 0),Yl([ue({attribute:!1})],Kl.prototype,"launcherStyles",void 0),Yl([ue({attribute:!0})],Kl.prototype,"primaryColor",void 0),Yl([ue({attribute:!0})],Kl.prototype,"backgroundColor",void 0),Yl([ue({attribute:!0})],Kl.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),Yl([ue({attribute:!0})],Kl.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),Yl([ue({attribute:!0})],Kl.prototype,"leadSourceClient",void 0),Yl([de()],Kl.prototype,"leadSourceMultitouchClient",void 0),Yl([de()],Kl.prototype,"_isMobile",void 0),Yl([de()],Kl.prototype,"isEmailWindowOpen",void 0),Yl([de()],Kl.prototype,"isCallUsWindowOpen",void 0),Yl([de()],Kl.prototype,"isSSTWindowOpen",void 0),Yl([de()],Kl.prototype,"isTextUsWindowOpen",void 0),Yl([de()],Kl.prototype,"isCalculatorWindowOpen",void 0),Yl([de()],Kl.prototype,"isMobileFeaturesExpanded",void 0),Kl=Yl([se("meetelise-launcher")],Kl);const Xl=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",Kl)},Zl=["app.meetelise.com","staging.eliseai.com","localhost"],Jl={calculator:{desktop:"calcDesktop",mobile:"calcMobile"},email:{desktop:"emailDesktop",mobile:"emailMobile"},call:{desktop:"callDesktop",mobile:"callMobile"},text:{desktop:"textDesktop",mobile:"textMobile"},sst:{desktop:"sstDesktop",mobile:"sstMobile"}},eu=e=>{const t=window.location.hostname;if(!Zl.includes(t))return e;const n=(e=>{if(!e)return{};try{return e.split(",").reduce((e,t)=>{const[n,i]=t.split(":");return n&&i&&n in Jl&&(e[n]="true"===i.toLowerCase()),e},{})}catch(e){return{}}})(new URLSearchParams(window.location.search).get("widgets"));if(0===Object.keys(n).length)return e;const i={...e};return Object.entries(n).forEach(([e,t])=>{const n=Jl[e];n&&(i[n.desktop]=t,i[n.mobile]=t)}),i};var tu=n(5072),nu=n.n(tu),iu=n(7825),ru=n.n(iu),ou=n(7659),au=n.n(ou),su=n(5056),lu=n.n(su),uu=n(540),du=n.n(uu),cu=n(1113),hu=n.n(cu),pu=n(5541),fu={};fu.styleTagTransform=hu(),fu.setAttributes=lu(),fu.insert=au().bind(null,"head"),fu.domAPI=ru(),fu.insertStyleElement=du();nu()(pu.A,fu);pu.A&&pu.A.locals&&pu.A.locals;async function gu(e,t){try{const n=await r().get(`https://app.meetelise.com/platformApi/webchat/${t}/lead-sources`);if(n.data){if("7e352741-1120-4ccf-9929-5dc99193a908"===e){const e=["Zillow","Apartments.com","Google PPC","Google Maps","Apple Maps","Social Media","Print Marketing"];return n.data.filter(t=>e.includes(t))}return mu(n.data,t)}return[]}catch(e){return[]}}const mu=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter(e=>{const t=e.toLowerCase();return!n.map(e=>e.toLowerCase()).includes(t)})};async function yu(e){var t,n;if(!e)return!1;try{return null!==(n=null===(t=(await r().get(`https://app.meetelise.com/platformApi/webchat/${e}/aip`)).data)||void 0===t?void 0:t.is_aip)&&void 0!==n&&n}catch(e){return!1}}var bu,vu=n(8805),wu=n.n(vu),Cu=new Uint8Array(16);function xu(){if(!bu&&!(bu="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return bu(Cu)}const $u=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const Su=function(e){return"string"==typeof e&&$u.test(e)};for(var Au=[],Eu=0;Eu<256;++Eu)Au.push((Eu+256).toString(16).substr(1));const Tu=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Au[e[t+0]]+Au[e[t+1]]+Au[e[t+2]]+Au[e[t+3]]+"-"+Au[e[t+4]]+Au[e[t+5]]+"-"+Au[e[t+6]]+Au[e[t+7]]+"-"+Au[e[t+8]]+Au[e[t+9]]+"-"+Au[e[t+10]]+Au[e[t+11]]+Au[e[t+12]]+Au[e[t+13]]+Au[e[t+14]]+Au[e[t+15]]).toLowerCase();if(!Su(n))throw TypeError("Stringified UUID is invalid");return n};const ku=function(e,t,n){var i=(e=e||{}).random||(e.rng||xu)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return Tu(i)},_u=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Ou=(e,t,n)=>{const i=Br(new Date),r=n||`lead_${ku()}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:qr(i),buildingSlug:e,initiatedChat:t}},Pu=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(Iu(e,i))return i}catch(e){}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},Iu=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if($r(t.timestamp,e))return!1}}catch(e){}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp)&&!Ir(t.timestamp,24)};var Mu;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(Mu||(Mu={}));const Nu=e=>e.type===Lu.text,Du=e=>e.type===Lu.media;var Lu;!function(e){e.text="text",e.media="media"}(Lu||(Lu={}));const Uu=class{constructor(e,t,n,i=null,r,o,a=null,s=jc.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingWebchatView=null,this.eliseResponseTimeout=null,this.isWaitingForStreamingMessages=!1,this.firedScheduledTourConfirmationIds=new Set,this.widgetType=jc.Default,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.sessionToken=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t,n;const i={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,i],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter(e=>e.message.messageType!==Mu.noReply),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),this.checkAndHandleDelayStreamingMessages();const r="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;if(null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:r}),!r&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=r,"ai_message"===e.message.customType){const t=e.message.stream_id,i=null!=t?t:String(+e.timetoken);(t?this.reconstructStreamText(t):null!==(n=e.message.text)&&void 0!==n?n:"").includes("confirmed for your")&&this.fireScheduledTourEventOnce(i,e.message)}this.checkAndHandleGTMForLeadEmail(e)}},this.isLoadingMessages=!1,this.isFirstChatMessageSent=!1,this.streamingMessageTimeout=null,this.checkAndHandleDelayStreamingMessages=({delayToFetchHistoryInMs:e=1e4}={})=>{this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null);const t=new Map;this.rawPubnubMessages.forEach(e=>{var n;const i=e.message.stream_id;i&&t.set(i,[...null!==(n=t.get(i))&&void 0!==n?n:[],e])});const n=[...t.entries()].filter(([,e])=>!this.isStreamComplete(e)).map(([e])=>e);n.length>0&&(this.streamingMessageTimeout=setTimeout(()=>{Vo({logTitle:"PUBNUB_WARN_DELAYED_STREAMING_MESSAGES",logData:{channel:this.channel},logType:qo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),this.getChannelHistory().then(()=>n.forEach(e=>this.checkAndFireTourConfirmationForStream(e)))},e))},this.isStreamComplete=e=>{var t;const n=e.find(e=>e.message.is_done);if(!n)return!1;const i=new Set(e.map(e=>{var t;return null!==(t=e.message.order)&&void 0!==t?t:0}));for(let e=0;e<=(null!==(t=n.message.order)&&void 0!==t?t:0);e++)if(!i.has(e))return!1;return!0},this.getStreamChunks=e=>this.removeDuplicatedRawPubnubMessages(this.rawPubnubMessages).filter(t=>t.message.stream_id===e).sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}),this.reconstructStreamText=e=>this.getStreamChunks(e).map(e=>e.message.text).join(""),this.fireScheduledTourEventOnce=(e,t)=>{var n;this.firedScheduledTourConfirmationIds.has(e)||(this.firedScheduledTourConfirmationIds.add(e),$o("scheduledTourEvent",{tourDetails:t,buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))},this.checkAndFireTourConfirmationForStream=e=>{var t;if(this.reconstructStreamText(e).includes("confirmed for your")){const n=this.getStreamChunks(e);this.fireScheduledTourEventOnce(e,null===(t=n[n.length-1])||void 0===t?void 0:t.message)}},this.checkAndHandleGTMForLeadEmail=e=>{var t;try{if("lead_message"!==e.message.customType)return;if(!(e=>{try{return/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b/.test(e)}catch(e){return!1}})(e.message.text))return;$o("leadProvidedEmail",{buildingId:null===(t=this.buildingWebchatView)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}catch(e){return}},this.markEveryPreviousNoReplyMessageDone=e=>{var t,n;for(let i=e.length-1;i>=0;i--){const r=null===(t=e[i])||void 0===t?void 0:t.message,o=i>0&&(null===(n=e[i-1])||void 0===n?void 0:n.message);(null==r?void 0:r.messageType)===Mu.noReply&&o&&(o.is_done=!0)}},this.checkMessageChunkValid=e=>{try{return!!e.message&&!!e.message.text&&e.message.text.length>0&&!!e.message.customType}catch(e){return!1}},this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.buildingWebchatView&&Vo({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.streamingMessageTimeout&&(clearTimeout(this.streamingMessageTimeout),this.streamingMessageTimeout=null),this.removeChatListeners()},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub){const e=Ou(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken(async()=>{var t,n,i,r,o,a,s,l,u;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout(()=>{this.buildingWebchatView&&Vo({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})},9e4),0===this.simpleChatMessages.length&&(null===(t=this.leadSourceClient)||void 0===t||t.checkAndHandleForLogLeadSource({webchatAction:"chat",stateId:null})),this.widgetType===jc.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),orgSlug:this.orgSlug}}):(await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(n=this.buildingWebchatView)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,userId:null===(i=this.buildingWebchatView)||void 0===i?void 0:i.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),lead_sources_with_timestamps:(null!==(o=null===(r=this.leadSourceMultitouchClient)||void 0===r?void 0:r.getSafeLeadSourceTouchpointsWithDefault({includedUserSelectedLeadSource:null}))&&void 0!==o?o:[]).map(e=>Tr({...e}))}}),null===(a=this.leadSourceClient)||void 0===a||a.resetLeadSource(),null===(s=this.leadSourceMultitouchClient)||void 0===s||s.resetLeadSourceTouchpoints()),this.isFirstChatMessageSent||($o("firstChatMessageSent",{message:e,buildingId:null===(l=this.buildingWebchatView)||void 0===l?void 0:l.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),$o("chatMessageSent",{message:e,buildingId:null===(u=this.buildingWebchatView)||void 0===u?void 0:u.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))}),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.removeDuplicatedRawPubnubMessages=e=>{const t=new Set;return e.filter(e=>{if("lead_message"===e.message.customType||!e.message.stream_id||!e.message.order)return!0;const n=`${e.message.stream_id}-${e.message.order}-${e.message.messageType}`;return t.has(n)?(Vo({logTitle:"PUBNUB_WARN_DUPLICATE_MESSAGE",logData:{message:e,channel:this.channel},logType:qo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug}),!1):(t.add(n),!0)})},this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],n={};return this.removeDuplicatedRawPubnubMessages(e).forEach(e=>{var i;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:Lu.media}):!e.message.stream_id||e.message.is_done&&0===e.message.order?t.push({timestamp:e.timetoken,message:e.message.text,isLeadMessage:this.isLeadMessage(e),chunks:[{text:e.message.text,order:0,isDone:!0}],type:Lu.text}):n[e.message.stream_id]?n[e.message.stream_id].push(e):n[e.message.stream_id]=[e]}),Object.keys(n).forEach(e=>{const i=n[e],r=this.getConsecutiveChunks(i.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)})),o=r.map(e=>e.message.text).join(""),a=r[0],s={timestamp:a.timetoken,message:o,isLeadMessage:this.isLeadMessage(a),chunks:r.map(e=>{var t,n;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(n=e.message.is_done)&&void 0!==n&&n}}),type:Lu.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)}),t.sort((e,t)=>e.timestamp-t.timestamp),t},this.getConsecutiveChunks=e=>{var t,n;const i=e.sort((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}),r=[];let o=null!==(t=i[0].message.order)&&void 0!==t?t:0;for(const e of i){if((null!==(n=e.message.order)&&void 0!==n?n:-1)!==o)break;r.push(e),o++}return r},this.isMessageStillStreamingChunks=e=>{const t=e.find(e=>e.message.is_done);return!t||e.length===t.message.order},this.buildingSlug=e,this.buildingWebchatView=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=a,this.leadSourceMultitouchClient=o,this.widgetType=s}async initSession(e,t,n){try{const i={building_slug:e,org_slug:t};n&&(i.lead_id=n);const o=await r().post(`${this.apiHost}/platformApi/webchat/init`,i);return this.sessionToken=o.data.session_token,this.leadUserId=o.data.lead_id,this.channel=o.data.channel,o.data}catch(e){return this.buildingWebchatView&&Vo({logTitle:"WEBCHAT_INIT_SESSION_ERROR",logData:{error:e},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e}),null}}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(wu())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token,origin:"meetelise.pubnubapi.com"}),this.withAuthToken(()=>new Promise(()=>this.handleChatListeners())),await this.withAuthToken(()=>this.getChannelHistory()),this.pubnub):void 0}async fetchToken(e,t){try{if(this.sessionToken){const e="healthcare"===this.widgetType?"?industry=health_care":"";return(await r().get(`${this.apiHost}/platformApi/webchat/pn/v2/request-token${e}`,{headers:{"X-Session-Token":this.sessionToken}})).data}return(await r().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${t}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.buildingWebchatView&&Vo({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}return null}async fetchChannelExists(e){try{return(await r().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.buildingWebchatView&&Vo({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}return!1}async withAuthToken(e){try{await e()}catch(t){if(t instanceof i.AxiosError&&t&&t.response&&403===t.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const t=await this.fetchToken(this.leadUserId,this.channel);if(!t)return;this.pubnub.setAuthKey(t.auth.result.token),await e()}catch(e){this.buildingWebchatView&&Vo({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:qo.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}}async getChannelHistory(e=1500){var t;try{let n=[],i=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise((n,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=i?i:void 0},(e,t)=>{e.error?o(e):n(t)})}),a=o.channels[this.channel];if(!a)break;if(a.sort((e,t)=>+e.timetoken-+t.timetoken),!a||0===a.length)break;if(this.channel&&0!==Object.keys(o.channels).length){const e=o.channels[this.channel],t=[];e.forEach(e=>{e.uuid&&t.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})}),this.markEveryPreviousNoReplyMessageDone(t),n=n.concat(t.filter(e=>e.message.messageType!==Mu.noReply))}if(i=a[0].timetoken,n.length>=e||a.length<r)break}this.rawPubnubMessages=n.slice(0,e),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:!1})}catch(e){this.buildingWebchatView&&Vo({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:qo.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,error:e})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")||location.href.includes("demo/utilities")}},Ru=new Set(["8009855990","8338526262","8002221222","8006624357","8002738255","8007997233","8007874889","8006564673","8004224453","8883737888","8006213362","8009506264","8558272736","8008435678","8007862929","8008523836","8007849433","8007729100","8006699777","8006858470","8004322209","8003473735","8008778339","8009552232","8002255342","8009272891","8003049320","8007937724","8002382333","8003353863","8776858878","8003329227","8776554371","8772944357","8772944356","6092925760","6092926735","8007928339","8008329173","8882853036","6092921210","8007929773","8003561561","8003826717","8005727233","8009291040","8888958179","8006879512","8004262537","8773475463","8774149251","8005103102","8889372835","8007010710","8007010720","8774288844","8007929745","8003283838","6092927060","6092928319","8008527899","8662401347","8009923678","8776522873","8776527624","8003313937","8008435437","8776536783","8778392339","8003676274","8006896411"]),Bu=e=>{const t=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1");return Ru.has(t)},ju=(e,t,n)=>{try{const i=e.replace(/\D/g,"").replace(/^1(\d{10})$/,"$1"),r=`tel:${i}`,o=`sms:${i}`,a=`whatsapp://send?phone=${i}`,s=`facetime:${i}`,l=`facetime-audio:${i}`,u=/(?:\+1[\s.-]?)?(?:\([2-9]\d{2}\)[\s.-]?|[2-9]\d{2}[\s.-])[2-9]\d{2}[\s.-]?\d{4}/g,d=/(tel|sms):(?:\+1\s)?(?:(?:\(\d{3}\)\s|\d{3}-)\d{3}-\d{4}|\d{10,11})/g,c=/whatsapp:\/\/send\?phone=\d+/g,h=/(facetime|facetime-audio):\d+/g,p=/emergency|emergencia/i,f=300,g=e=>!(!e||e.length>f)&&p.test(e),m=e=>{var t,n,i,r;if(g(e.textContent))return!0;if(g(null===(t=e.previousElementSibling)||void 0===t?void 0:t.textContent)||g(null===(n=e.nextElementSibling)||void 0===n?void 0:n.textContent))return!0;const o=e.parentElement;return!(!o||!g(null===(i=o.previousElementSibling)||void 0===i?void 0:i.textContent)&&!g(null===(r=o.nextElementSibling)||void 0===r?void 0:r.textContent))},y=document.body.getElementsByTagName("*");let b=!1;const v=i.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let w=!1,C=!1,x=0;for(let e=0;e<y.length;e++)if(y[e].nodeType===Node.ELEMENT_NODE&&!m(y[e])){if(1===y[e].childNodes.length&&y[e].childNodes[0].nodeType==Node.TEXT_NODE){const t=y[e].textContent;if(!t)continue;const n=t.replace(u,e=>{if(Bu(e))return e;return e.startsWith("+1 ")?`+1 ${v}`:v});t!==n&&(x++,y[e].textContent=n),b=!0,w||(w=!0)}if(y[e].hasAttribute("href")){const t=y[e].getAttribute("href");if(!t)continue;let n="",i=d;if(t.startsWith("sms:")?n=o:t.startsWith("whatsapp:")?(n=a,i=c):t.startsWith("facetime:")?(n=s,i=h):t.startsWith("facetime-audio:")?(n=l,i=h):n=r,Bu(t))continue;const u=t.replace(i,n);if(y[e].setAttribute("href",u),(t.startsWith("tel:")||t.startsWith("sms:"))&&u===t&&u!==n){t.replace(/\D/g,"").length>=7&&y[e].setAttribute("href",t.startsWith("tel:")?r:o)}C||(C=!0)}}return w&&Vo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:v,website:window.location.href},logType:qo.info,buildingSlug:n,orgSlug:t}),C&&Vo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:v,website:window.location.href},logType:qo.info,buildingSlug:n,orgSlug:t}),b||Vo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:qo.warn,buildingSlug:n,orgSlug:t}),x}catch(e){return Vo({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"insertion-error",error:e instanceof Error?e.message:String(e),website:window.location.href},logType:qo.error,buildingSlug:n,orgSlug:t,error:e}),0}},Fu=(e,t,n,i)=>{document.querySelectorAll("a").forEach(function(r){const o=r.getAttribute("href");o&&o.startsWith("https://app.meetelise.com/")&&((e,t,n)=>{const[i,r,o,...a]=new URL(e).pathname.split("/").filter(Boolean).map(e=>e.toLowerCase());return 0===a.length&&"tour"===o&&i===t.toLowerCase()&&r===n.toLowerCase()})(o,t,n)&&r.addEventListener("click",t=>{i()&&(t.preventDefault(),e(t))})})};var Hu=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 Gu=class extends oe{constructor(){super(...arguments),this.onClick=()=>{},this.primaryColor=Vn,this.foregroundColorOnPrimaryBackgroundColor="white",this.toExpand=!1}render(){return R`
|
|
6129
6129
|
<button
|
|
6130
6130
|
class=${this.toExpand?"button-container mini":"button-container"}
|
|
6131
6131
|
@click=${this.onClick}
|
|
@@ -6749,6 +6749,12 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6749
6749
|
><img class=${"displayed-message-image"} src=${e.url} alt=""
|
|
6750
6750
|
/></a>`)}
|
|
6751
6751
|
</div>`:R``}};ic.styles=[Oe,Wu,u`
|
|
6752
|
+
/* This element is a flex item in a bubble capped below the chat width.
|
|
6753
|
+
Without min-width: 0 it is at least as wide as all slides' captions
|
|
6754
|
+
side by side, so the carousel spills out of the bubble and the chat. */
|
|
6755
|
+
:host {
|
|
6756
|
+
min-width: 0;
|
|
6757
|
+
}
|
|
6752
6758
|
.carousel {
|
|
6753
6759
|
position: relative;
|
|
6754
6760
|
max-width: 400px;
|
|
@@ -7298,7 +7304,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
7298
7304
|
</button>
|
|
7299
7305
|
</div>
|
|
7300
7306
|
</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`
|
|
7307
|
+
`}};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
7308
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
7303
7309
|
${this.displayPubnubChat?R`
|
|
7304
7310
|
<pubnub-chat
|
package/src/MyPubnub.ts
CHANGED
|
@@ -164,9 +164,10 @@ class MyPubnub {
|
|
|
164
164
|
const streamId = messageEvent.message.stream_id;
|
|
165
165
|
// A stream_id is a stable identity for the whole reply regardless of chunk arrival order, unlike any timetoken derived from its chunks.
|
|
166
166
|
const confirmationId = streamId ?? String(+messageEvent.timetoken);
|
|
167
|
+
// Media messages carry no text.
|
|
167
168
|
const currentMessageText = streamId
|
|
168
169
|
? this.reconstructStreamText(streamId)
|
|
169
|
-
: messageEvent.message.text;
|
|
170
|
+
: messageEvent.message.text ?? "";
|
|
170
171
|
if (currentMessageText.includes("confirmed for your")) {
|
|
171
172
|
this.fireScheduledTourEventOnce(confirmationId, messageEvent.message);
|
|
172
173
|
}
|
|
@@ -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`;
|
|
@@ -11,6 +11,12 @@ export class PubnubMedia extends LitElement {
|
|
|
11
11
|
InputStyles,
|
|
12
12
|
pubnubChatStyles,
|
|
13
13
|
css`
|
|
14
|
+
/* This element is a flex item in a bubble capped below the chat width.
|
|
15
|
+
Without min-width: 0 it is at least as wide as all slides' captions
|
|
16
|
+
side by side, so the carousel spills out of the bubble and the chat. */
|
|
17
|
+
:host {
|
|
18
|
+
min-width: 0;
|
|
19
|
+
}
|
|
14
20
|
.carousel {
|
|
15
21
|
position: relative;
|
|
16
22
|
max-width: 400px;
|
|
@@ -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
|
};
|
package/src/pubnub-chat.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expect } from "@esm-bundle/chai";
|
|
2
2
|
import "../public/dist/index";
|
|
3
3
|
import { BuildingWebchatView } from "./fetchBuildingWebchatView";
|
|
4
|
-
import type { SimpleTextChatMessage } from "./MyPubnub";
|
|
4
|
+
import type { SimpleMediaChatMessage, SimpleTextChatMessage } from "./MyPubnub";
|
|
5
5
|
import type { PubnubChat } from "./WebComponent/pubnub-chat";
|
|
6
6
|
|
|
7
7
|
declare const afterEach: (callback: () => void) => void;
|
|
@@ -190,3 +190,55 @@ it("follows the conversation again when the reader sends a message", async () =>
|
|
|
190
190
|
|
|
191
191
|
expectOnlyAutoScrollsTo(scrollCalls, 600);
|
|
192
192
|
});
|
|
193
|
+
|
|
194
|
+
it("keeps a photo carousel and its arrows inside the message bubble", async () => {
|
|
195
|
+
const { chat } = await createScrollableChat();
|
|
196
|
+
// Wide photos, like real floor plan images, inlined so the test needs no network.
|
|
197
|
+
const widePhoto = `data:image/svg+xml,${encodeURIComponent(
|
|
198
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="1600" height="900"/>'
|
|
199
|
+
)}`;
|
|
200
|
+
const photos: SimpleMediaChatMessage = {
|
|
201
|
+
timestamp: 100,
|
|
202
|
+
// Eight captioned photos, as one floor plan can have: the overflow came
|
|
203
|
+
// from the slides' combined caption widths, so a few short ones hide it.
|
|
204
|
+
media: [
|
|
205
|
+
"Living Room",
|
|
206
|
+
"Dining Area",
|
|
207
|
+
"Kitchen",
|
|
208
|
+
"Pantry",
|
|
209
|
+
"Bedroom",
|
|
210
|
+
"Closet",
|
|
211
|
+
"Hallway",
|
|
212
|
+
"Bathroom",
|
|
213
|
+
].map((title) => ({
|
|
214
|
+
title,
|
|
215
|
+
description: `${title} with refrigerator, cabinetry and shelving`,
|
|
216
|
+
url: widePhoto,
|
|
217
|
+
})),
|
|
218
|
+
isLeadMessage: false,
|
|
219
|
+
type: "media" as SimpleMediaChatMessage["type"],
|
|
220
|
+
};
|
|
221
|
+
chat.messages = [photos];
|
|
222
|
+
await waitForRender(chat);
|
|
223
|
+
const media = chat.shadowRoot?.querySelector("pubnub-media") as
|
|
224
|
+
| (HTMLElement & { updateComplete: Promise<boolean> })
|
|
225
|
+
| null;
|
|
226
|
+
if (!media) throw new Error("Expected the photo message to render");
|
|
227
|
+
await media.updateComplete;
|
|
228
|
+
await Promise.all(
|
|
229
|
+
Array.from(media.shadowRoot?.querySelectorAll("img") ?? []).map((img) =>
|
|
230
|
+
img.decode()
|
|
231
|
+
)
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
const bubble = media.closest("li")?.getBoundingClientRect();
|
|
235
|
+
const carousel = media.shadowRoot
|
|
236
|
+
?.querySelector(".carousel")
|
|
237
|
+
?.getBoundingClientRect();
|
|
238
|
+
const next = media.shadowRoot
|
|
239
|
+
?.querySelector(".next")
|
|
240
|
+
?.getBoundingClientRect();
|
|
241
|
+
if (!bubble || !carousel || !next) throw new Error("Expected a carousel");
|
|
242
|
+
expect(carousel.right).to.be.at.most(bubble.right);
|
|
243
|
+
expect(next.right).to.be.at.most(bubble.right);
|
|
244
|
+
});
|