@meetelise/chat 1.46.0 → 1.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/WebComponent/Scheduler/tour-scheduler.d.ts +3 -0
- package/dist/src/fetchCentralConvoBuildings.d.ts +6 -3
- package/package.json +1 -1
- package/public/dist/index.js +34 -24
- package/src/WebComponent/Scheduler/tour-scheduler.ts +67 -31
- package/src/WebComponent/Scheduler/tourSchedulerStyles.ts +4 -0
- package/src/fetchCentralConvoBuildings.ts +14 -6
|
@@ -68,6 +68,7 @@ export declare class TourScheduler extends LitElement {
|
|
|
68
68
|
private allowOccupiedUnitTours;
|
|
69
69
|
errorGettingAvailabilities: boolean;
|
|
70
70
|
private centralConvoBuildings;
|
|
71
|
+
private isGeneralBuilding;
|
|
71
72
|
selectedBuildingEl?: MESelect;
|
|
72
73
|
private statusMessage;
|
|
73
74
|
_setAvailabilities: () => Promise<void>;
|
|
@@ -83,6 +84,7 @@ export declare class TourScheduler extends LitElement {
|
|
|
83
84
|
private _loadForCurrentBuilding;
|
|
84
85
|
private _fetchCentralConvoBuildings;
|
|
85
86
|
private _onBuildingChange;
|
|
87
|
+
buildingSelectMenu(): TemplateResult;
|
|
86
88
|
buildingSelector(): TemplateResult | string;
|
|
87
89
|
protected willUpdate: (_changedProperties: PropertyValueMap<{
|
|
88
90
|
tourType: TourType;
|
|
@@ -121,6 +123,7 @@ export declare class TourScheduler extends LitElement {
|
|
|
121
123
|
confirmationMessage(): TemplateResult;
|
|
122
124
|
loadingIcon(size?: number): TemplateResult;
|
|
123
125
|
render(): TemplateResult;
|
|
126
|
+
private renderCenteredCard;
|
|
124
127
|
private renderBody;
|
|
125
128
|
}
|
|
126
129
|
export declare enum TourType {
|
|
@@ -3,12 +3,15 @@ export interface CentralConvoBuilding {
|
|
|
3
3
|
name: string;
|
|
4
4
|
slug: string;
|
|
5
5
|
}
|
|
6
|
+
export interface CentralConvoBuildingsResponse {
|
|
7
|
+
is_general_building: boolean;
|
|
8
|
+
buildings: CentralConvoBuilding[];
|
|
9
|
+
}
|
|
6
10
|
/**
|
|
7
11
|
* Fetch the buildings that belong to the same central conversation group as the
|
|
8
|
-
* current building.
|
|
9
|
-
* central conversation group (in which case no building selector is shown).
|
|
12
|
+
* current building.
|
|
10
13
|
*
|
|
11
14
|
* @param orgSlug - The org slug, e.g. "big-prop-co"
|
|
12
15
|
* @param buildingSlug - The current building's slug, e.g. "gravity-falls"
|
|
13
16
|
*/
|
|
14
|
-
export default function fetchCentralConvoBuildings(orgSlug: string, buildingSlug: string): Promise<
|
|
17
|
+
export default function fetchCentralConvoBuildings(orgSlug: string, buildingSlug: string): Promise<CentralConvoBuildingsResponse>;
|
package/package.json
CHANGED
package/public/dist/index.js
CHANGED
|
@@ -1277,6 +1277,10 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
1277
1277
|
font-size: 14px;
|
|
1278
1278
|
text-align: left;
|
|
1279
1279
|
}
|
|
1280
|
+
.general-building-select {
|
|
1281
|
+
width: 100%;
|
|
1282
|
+
margin-top: 16px;
|
|
1283
|
+
}
|
|
1280
1284
|
.loading-entire-tour-icon {
|
|
1281
1285
|
padding: 24px;
|
|
1282
1286
|
}
|
|
@@ -1286,7 +1290,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
1286
1290
|
gap: 12px;
|
|
1287
1291
|
align-items: center;
|
|
1288
1292
|
}
|
|
1289
|
-
`;class wi{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:Ci(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const Ci=()=>{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:Cn("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:Cn("bozzuto_ad_source")}}};var xi;!function(e){e.error="error",e.info="info",e.warn="warn"}(xi||(xi={}));const Ai=async({logType:e,buildingSlug:t,orgSlug:n,logTitle:i,logData:o})=>{await r().post("https://app.meetelise.com/platformApi/webchat/logging",{...o},{headers:{"Content-Type":"application/json","building-slug":null!=t?t:"","org-slug":null!=n?n:"","log-type":null!=e?e:xi.error,"log-title":i.toUpperCase().replace(/\s/g,"_")}})},Si=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){}};function Ei(){return ki()?function(){const e=window.location.search,t={},n=e.split("?").slice(1).join("&");return n.split("&").forEach(e=>{const[n,i]=e.split("=");n&&i&&(t[decodeURIComponent(n)]=decodeURIComponent(i))}),t}():function(){const e=new URLSearchParams(window.location.search),t=e.has("utm_content"),n=e.has("utm_source");if(t&&!n){const t=e.get("utm_content");e.delete("utm_content"),e.set("utm_source",t)}return Object.fromEntries(e)}()}const ki=()=>(window.location.search.match(/\?/g)||[]).length>1;var Ti=n(2193),_i=n.n(Ti);function Oi(e){return"avb"===e?"AVB Company Website":"windsor"===e?"Windsorcommunities.com":"property-website"}const Pi=class{constructor(){this.chatId=null,this.apiHost="https://app.meetelise.com",this.leadSource=null,this.localStorageTTLDays=30,this.buildingId=null,this.orgSlug=null,this.buildingSlug=null,this.queryParameters=null,this.leadSourceInput=null,this.updateLeadSourceLocalStorage=(e,t,n,i,r)=>{const o=Ei();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(Ci()).filter(e=>e)},i)return;if(!r){const t=this.getLeadSourceBodyIfValid(e);if(t){if(!wn(t.timestamp,24*this.localStorageTTLDays))return{...t,timestamp:Rn(t.timestamp)}}}const a={leadSource:t,leadId:n,buildingSlug:e,timestamp:On(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:Rn(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&&!wn(Rn(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}){try{return(await r().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,{query_params:t,building_slug:e,referrer:n,campaign_sources:i})).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 c=null,d=null;try{if("f1ba5a20-d207-4e5a-879e-65199e7d0a53"===this.orgSlug){const e=await this.getCookieValue("_ga");e&&(c=e),d=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:_i()(c)?null:c,extras:null!=d?d: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}){try{const i={queryParams:Ei(),buildingSlug:n,referrer:document.referrer,campaignSources:Ci()};let r=!1;const o=n?this.getLeadSourceBodyIfValid(n):null;if(o){if(!["test-company","daf00bd2-1ecb-482c-b6f4-e1c5511a01be"].includes(t))return this.leadSource=o.leadSource,this.leadSource;{const e=await this.fetchCurrentParsedLeadSource(i);if(!e)return this.leadSource=o.leadSource,this.leadSource;this.leadSource=e,r=!0}}const a=await this.fetchCurrentParsedLeadSource(i);if(this.leadSource=a,this.buildingId=null,this.orgSlug=t,this.buildingSlug=n,n&&!a){const e=this.getLeadSourceBodyIfValid(n);if(e)return this.leadSource=e.leadSource,this.leadSource}if(n){const t=!!a&&a.length>0;this.updateLeadSourceLocalStorage(n,a,e,!t&&!r,r)}return a}catch(e){}return null}},Ii=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 Mi,Ni,Di;!function(e){e.EMOJI="emoji",e.PILLS="pills",e.MINIMIZED="minimized"}(Mi||(Mi={})),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"}(Ni||(Ni={})),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"}(Di||(Di={}));const Li=(e,t)=>"link"===(null==t?void 0:t.toLowerCase());async function Ui(e,t){var n;const i=`https://app.meetelise.com/api/pub/v1/organization/${e}/building/${t}/v2`,o=(await r().get(i)).data;try{o.welcomeMessage=Ri(null!==(n=o.welcomeMessage)&&void 0!==n?n:"",o.userFirstName)}catch(e){}return o}const Ri=(e,t)=>e.replace(/elise/gi,t);var Bi=n(7035),ji=n(6353);function Fi(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 Hi(e,t){var n=function(e){if(!zi[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;zi[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 zi[e]}(t);return n.formatToParts?function(e,t){try{for(var n=e.formatToParts(t),i=[],r=0;r<n.length;r++){var o=$i[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 $i={year:0,month:1,day:2,hour:3,minute:4,second:5};var zi={};function Gi(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 Qi=36e5,Wi={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function qi(e,t,n){var i,r,o;if(!e)return 0;if(i=Wi.timezoneZ.exec(e))return 0;if(i=Wi.timezoneHH.exec(e))return Yi(o=parseInt(i[1],10))?-o*Qi:NaN;if(i=Wi.timezoneHHMM.exec(e)){o=parseInt(i[2],10);var a=parseInt(i[3],10);return Yi(o,a)?(r=Math.abs(o)*Qi+6e4*a,"+"===i[1]?-r:r):NaN}if(function(e){if(Ki[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Ki[e]=!0,!0}catch(e){return!1}}(e)){t=new Date(t||Date.now());var s=n?t:function(e){return Gi(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),l=Vi(s,e),u=n?l:function(e,t,n){var i=e.getTime(),r=i-t,o=Vi(new Date(r),n);if(t===o)return t;r-=o-t;var a=Vi(new Date(r),n);if(o===a)return o;return Math.max(o,a)}(t,l,e);return-u}return NaN}function Vi(e,t){var n=Hi(e,t),i=Gi(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 Yi(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var Ki={};var Xi={X:function(e,t,n,i){var r=Zi(i.timeZone,e);if(0===r)return"Z";switch(t){case"X":return tr(r);case"XXXX":case"XX":return er(r);default:return er(r,":")}},x:function(e,t,n,i){var r=Zi(i.timeZone,e);switch(t){case"x":return tr(r);case"xxxx":case"xx":return er(r);default:return er(r,":")}},O:function(e,t,n,i){var r=Zi(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+Ji(o,2)}(r,":");default:return"GMT"+er(r,":")}},z:function(e,t,n,i){switch(t){case"z":case"zz":case"zzz":return Fi("short",e,i);default:return Fi("long",e,i)}}};function Zi(e,t){var n=e?qi(e,t,!0)/6e4:t.getTimezoneOffset();if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+e);return n}function Ji(e,t){for(var n=e<0?"-":"",i=Math.abs(e).toString();i.length<t;)i="0"+i;return n+i}function er(e,t){var n=t||"",i=e>0?"-":"+",r=Math.abs(e);return i+Ji(Math.floor(r/60),2)+n+Ji(Math.floor(r%60),2)}function tr(e,t){return e%60==0?(e>0?"-":"+")+Ji(Math.abs(e)/60,2):er(e,t)}const nr=Xi;var ir=n(9784),rr=n(9720);var or=36e5,ar=6e4,sr={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 lr(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:ir(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=sr.dateTimePattern.exec(e);i?(n.date=i[1],t=i[3]):(i=sr.datePattern.exec(e))?(n.date=i[1],t=i[2]):(n.date=null,t=e);if(t){var r=sr.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=sr.YYY[t],r=sr.YYYYY[t];if(n=sr.YYYY.exec(e)||r.exec(e)){var o=n[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(n=sr.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=sr.MM.exec(e))return i=new Date(0),pr(t,r=parseInt(n[1],10)-1)?(i.setUTCFullYear(t,r),i):new Date(NaN);if(n=sr.DDD.exec(e)){i=new Date(0);var a=parseInt(n[1],10);return function(e,t){if(t<1)return!1;var n=hr(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=sr.MMDD.exec(e)){i=new Date(0),r=parseInt(n[1],10)-1;var s=parseInt(n[2],10);return pr(t,r,s)?(i.setUTCFullYear(t,r,s),i):new Date(NaN)}if(n=sr.Www.exec(e))return fr(t,o=parseInt(n[1],10)-1)?ur(t,o):new Date(NaN);if(n=sr.WwwD.exec(e)){o=parseInt(n[1],10)-1;var l=parseInt(n[2],10)-1;return fr(t,o,l)?ur(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(),c=0;if(r.time&&(c=function(e){var t,n,i;if(t=sr.HH.exec(e))return gr(n=parseFloat(t[1].replace(",",".")))?n%24*or:NaN;if(t=sr.HHMM.exec(e))return gr(n=parseInt(t[1],10),i=parseFloat(t[2].replace(",",".")))?n%24*or+i*ar:NaN;if(t=sr.HHMMSS.exec(e)){n=parseInt(t[1],10),i=parseInt(t[2],10);var r=parseFloat(t[3].replace(",","."));return gr(n,i,r)?n%24*or+i*ar+1e3*r:NaN}return null}(r.time),isNaN(c)))return new Date(NaN);if(r.timeZone||n.timeZone){if(l=qi(r.timeZone||n.timeZone,new Date(u+c)),isNaN(l))return new Date(NaN)}else l=rr(new Date(u+c)),l=rr(new Date(u+c+l));return new Date(u+c+l)}return new Date(NaN)}function ur(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 cr=[31,28,31,30,31,30,31,31,30,31,30,31],dr=[31,29,31,30,31,30,31,31,30,31,30,31];function hr(e){return e%400==0||e%4==0&&e%100!=0}function pr(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;var i=hr(e);if(i&&n>dr[t])return!1;if(!i&&n>cr[t])return!1}return!0}function fr(e,t,n){return!(t<0||t>52)&&(null==n||!(n<0||n>6))}function gr(e,t,n){return(null==e||!(e<0||e>=25))&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}var mr=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function yr(e,t,n,i){var r=Bi(i);return r.timeZone=t,r.originalDate=e,function(e,t,n){var i=String(t),r=n||{},o=i.match(mr);if(o){var a=lr(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,"'"+nr[t[0]](a,t,null,r)+"'");return i?o.substring(0,n-1)+o.substring(n+1):o},i)}return ji(e,i,r)}(function(e,t,n){var i=lr(e,n),r=qi(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 br=async({buildingSlug:e})=>{try{const t=await r().get(`${hn}/platformApi/webchat/${e}/units/summary`);if(t.data)return fn(t.data)}catch(t){Ai({logType:xi.error,buildingSlug:e,logTitle:"[ERROR_GETTING_UNITS_SUMMARY]",logData:{error:t}})}return[]};var vr=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 wr=class extends oe{constructor(){super(...arguments),this.tourTypeOptions=[],this.layoutOptions=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.sgtUrl="",this.selfGuidedToursTypeOffered="",this.selfGuidedTourEnabled=!1,this.escortedToursLink="",this.escortedToursTypeOffered="",this.virtualToursLink="",this.virtualToursTypeOffered="",this.orgSlug="",this.hasDynamicSchedulingEnabled=!1,this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingName="",this.tourType=null,this.shouldShowTourType={[Cr.Guided]:!0,[Cr.Self]:!0,[Cr.Virtual]:!0},this.email="",this.phoneNumber="",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.currentLeadSource="",this.featureFlagShowDropdown="",this.compactDesign=!1,this.primaryColor=Ue,this.backgroundColor=Re,this.foregroundColorOnPrimaryBackgroundColor="white",this.foregroundColorOnSecondaryBackgroundColor="black",this.firstNameInputValue="",this.lastNameInputValue="",this.leadSourceInputValue="",this.selectedLayoutValue="",this.selectedUnitValue="",this.units=[],this.allowOccupiedUnitTours=!1,this.errorGettingAvailabilities=!1,this.centralConvoBuildings=[],this.statusMessage="",this._setAvailabilities=async()=>{try{const[e,t]=await Promise.all([Ii(this.buildingId,this.hasDynamicSchedulingEnabled),Kn()]);this.shouldAllowScheduling=e,this.shouldAllowScheduleLoading=!1,this.calendarTimeZone=await(async e=>{var t;return null!==(t=(await Vn(e)).calendarTimeZone)&&void 0!==t?t:Intl.DateTimeFormat().resolvedOptions().timeZone})(this.buildingId),Ai({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:t,logType:xi.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 Ai({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});this.shouldShowTourType={[Cr.Guided]:this.tourTypeOptions.map(e=>e.value).includes("WITH_AGENT")&&(t[Cr.Guided]||!!this.escortedToursLink),[Cr.Self]:this.tourTypeOptions.map(e=>e.value).includes("SELF_GUIDED")&&(t[Cr.Self]||!!this.sgtUrl),[Cr.Virtual]:this.tourTypeOptions.map(e=>e.value).includes("VIRTUAL_SHOWING")&&(t[Cr.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 Xn(xr[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,Ai({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this._setDefaultSelectedDateAndTimes=async(e,t)=>{var n,i,r;const o=await Vn(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 Wt("string"==typeof e?Rn(e):e,t)}):[],l=null==s?void 0:s[0];a&&l&&a!==In.Unknown&&a!==In.MediaTour&&(this.selectedDate=Qt("string"==typeof l?Rn(l):l),this.tourType=Ar[a],this.selectedTime="string"==typeof l?Zn(l):(e=>({datetime:Ft(e,"yyyy-MM-dd'T'HH:mm:ss"),offset:Ft(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===In.Unknown||e.tourType===In.MediaTour)return!1;const t=Ar[e.tourType],n=this._getTourTypeOffered(t);return!!n&&(!Li(0,n)&&e.availabilities&&e.availabilities.length>0)}),i=n[0];return i?i.tourType:null},this._getTourTypeOffered=e=>e===Cr.Guided?this.escortedToursTypeOffered:e===Cr.Self?this.selfGuidedToursTypeOffered:e===Cr.Virtual?this.virtualToursTypeOffered:null,this._getUnitOptions=()=>{const e=this.selectedLayoutValue?this.units.filter(e=>Er(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 br({buildingSlug:this.buildingSlug})}catch(e){this.units=[],Ai({logTitle:"ERROR_LOADING_UNITS_FOR_TOUR_SCHEDULER",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.firstUpdated=async()=>{this._fetchCentralConvoBuildings(),await this._loadForCurrentBuilding()},this._loadForCurrentBuilding=async()=>{try{await Vn(this.buildingId)}catch(e){}await Promise.all([this._setAvailabilities().then(async()=>{try{const e=await Vn(this.buildingId);this.allowOccupiedUnitTours=!!e.allowOccupiedUnitTours}catch(e){this.allowOccupiedUnitTours=!1}}),this._fetchUnits()])},this._fetchCentralConvoBuildings=async()=>{if(this.orgSlug&&this.buildingSlug)try{this.centralConvoBuildings=await async function(e,t){var n;return null!==(n=(await r().get("https://app.meetelise.com/platformApi/webchat/central-convo-buildings",{headers:{"building-slug":t,"org-slug":e}})).data)&&void 0!==n?n:[]}(this.orgSlug,this.buildingSlug)}catch(e){this.centralConvoBuildings=[]}},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.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}…`,ai("tourBuildingSelected",{buildingId:n.building_id});try{const e=await Ui(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 Xn(xr[this.tourType]))},this.handlePhoneKeydown=e=>{var t;if(!(e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&null!==e.target.selectionStart))return;const n=e.target.selectionStart;if(1!==e.key.length||Ne(e)){if("Backspace"===e.key){if(Ne(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,i=this.phoneNumber.slice(0,n).replace(/\D/g,""),r=this.phoneNumber.slice(n).replace(/\D/g,""),o=`${i.slice(0,-1)}${r}`;this.phoneNumber=Pe(o),this.phoneInput.value=this.phoneNumber;const a=n-(t-this.phoneNumber.length);return this.phoneInput.setSelectionRange(a,a),e.preventDefault(),void e.stopPropagation()}if(!["ArrowLeft","ArrowRight"].includes(e.key)||Ne(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,n).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,i=n-e>-1?n-e:0;this.phoneInput.setSelectionRange(i,i)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(n).split(/\d+/)[0].length||0)+1,t=n+e<this.phoneNumber.length?n+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,n)+e.key+this.phoneNumber.slice(n);this.phoneNumber=Pe(t.replace(/\D/g,"")),this.phoneInput.value=this.phoneNumber}},this.handlePhoneKeyup=e=>{var t;if(!e.key)return;if(e.key.includes("Arrow")||["Meta","Shift","Control","Alt"].includes(e.key))return;const n=this.phoneInput.selectionStart,i=n?this.phoneInput.value.slice(n).replace(/\D/g,""):"";this.phoneNumber=Pe(this.phoneInput.value);let r=0,o=i.length;for(;o;)(null===(t=this.phoneNumber.at(r))||void 0===t?void 0:t.match(/\d/))&&o--,r++;const a=this.phoneInput.value.length-r+1;this.phoneInput.setSelectionRange(a,a)},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))&&An(null!==(i=null===(n=this.emailInput)||void 0===n?void 0:n.value)&&void 0!==i?i:"")&&!!this.phoneNumber&&14===this.phoneNumber.length&&xn(this.phoneNumber)}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),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,c,d,h,p,f,g,m,y,b,v,w,C,x,A;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const S=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 k=[...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 T=(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;ai("scheduleTourSubmitted",{email:this.email,phone:`+1${null===(n=this.phoneNumber.match(/\d/g))||void 0===n?void 0:n.join("")}`,firstName:null!==(o=null===(i=this.firstNameInput)||void 0===i?void 0:i.value)&&void 0!==o?o:this.firstNameInputValue,lastName:null!==(s=null===(a=this.lastNameInput)||void 0===a?void 0:a.value)&&void 0!==s?s:this.lastNameInputValue,tourType:Sr[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:k.find(e=>"property-website"!==e)||null,layout:T,unit:_});const O={referrer:document.referrer,email_address:this.email,phone_number:`+1${null===(l=this.phoneNumber.match(/\d/g))||void 0===l?void 0:l.join("")}`,building_id:this.buildingId,first_name:null!==(c=null===(u=this.firstNameInput)||void 0===u?void 0:u.value)&&void 0!==c?c:this.firstNameInputValue,last_name:null!==(h=null===(d=this.lastNameInput)||void 0===d?void 0:d.value)&&void 0!==h?h:this.lastNameInputValue,tour_type:Sr[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(E?[E,Oi(this.orgSlug)]:[Oi(this.orgSlug)])],query_params:Object.fromEntries(S.entries()),conversation_tracking_id:null===(p=this.leadSourceClient)||void 0===p?void 0:p.chatId,layouts:T?[T]: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=>gn({...e}))};this.isSubmitting=!0;try{await r().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",O,{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[Ft(this.selectedDate,"yyyy-MM-dd")];e&&(this.availabilitiesGroupedByDay[Ft(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===(A=t.response)||void 0===A?void 0:A.status)&&!this.promptForReschedule)return this.isSubmitting=!1,this.tourIsBooked=!1,qn(),this.availabilitiesGroupedByDay=await Xn(xr[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:()=>B`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>B`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>B` <action-confirm-button
|
|
1293
|
+
`;class wi{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:Ci(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const Ci=()=>{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:Cn("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:Cn("bozzuto_ad_source")}}};var xi;!function(e){e.error="error",e.info="info",e.warn="warn"}(xi||(xi={}));const Ai=async({logType:e,buildingSlug:t,orgSlug:n,logTitle:i,logData:o})=>{await r().post("https://app.meetelise.com/platformApi/webchat/logging",{...o},{headers:{"Content-Type":"application/json","building-slug":null!=t?t:"","org-slug":null!=n?n:"","log-type":null!=e?e:xi.error,"log-title":i.toUpperCase().replace(/\s/g,"_")}})},Si=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){}};function Ei(){return ki()?function(){const e=window.location.search,t={},n=e.split("?").slice(1).join("&");return n.split("&").forEach(e=>{const[n,i]=e.split("=");n&&i&&(t[decodeURIComponent(n)]=decodeURIComponent(i))}),t}():function(){const e=new URLSearchParams(window.location.search),t=e.has("utm_content"),n=e.has("utm_source");if(t&&!n){const t=e.get("utm_content");e.delete("utm_content"),e.set("utm_source",t)}return Object.fromEntries(e)}()}const ki=()=>(window.location.search.match(/\?/g)||[]).length>1;var Ti=n(2193),_i=n.n(Ti);function Oi(e){return"avb"===e?"AVB Company Website":"windsor"===e?"Windsorcommunities.com":"property-website"}const Pi=class{constructor(){this.chatId=null,this.apiHost="https://app.meetelise.com",this.leadSource=null,this.localStorageTTLDays=30,this.buildingId=null,this.orgSlug=null,this.buildingSlug=null,this.queryParameters=null,this.leadSourceInput=null,this.updateLeadSourceLocalStorage=(e,t,n,i,r)=>{const o=Ei();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(Ci()).filter(e=>e)},i)return;if(!r){const t=this.getLeadSourceBodyIfValid(e);if(t){if(!wn(t.timestamp,24*this.localStorageTTLDays))return{...t,timestamp:Rn(t.timestamp)}}}const a={leadSource:t,leadId:n,buildingSlug:e,timestamp:On(new Date),leadSourceInput:this.leadSourceInput};return localStorage.setItem("com.elise.webchat.leadsource.slug="+e,JSON.stringify(a)),{...a,timestamp:Rn(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&&!wn(Rn(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}){try{return(await r().post(`${this.apiHost}/platformApi/webchat/current-parsed-lead-source`,{query_params:t,building_slug:e,referrer:n,campaign_sources:i})).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 c=null,d=null;try{if("f1ba5a20-d207-4e5a-879e-65199e7d0a53"===this.orgSlug){const e=await this.getCookieValue("_ga");e&&(c=e),d=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:_i()(c)?null:c,extras:null!=d?d: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}){try{const i={queryParams:Ei(),buildingSlug:n,referrer:document.referrer,campaignSources:Ci()};let r=!1;const o=n?this.getLeadSourceBodyIfValid(n):null;if(o){if(!["test-company","daf00bd2-1ecb-482c-b6f4-e1c5511a01be"].includes(t))return this.leadSource=o.leadSource,this.leadSource;{const e=await this.fetchCurrentParsedLeadSource(i);if(!e)return this.leadSource=o.leadSource,this.leadSource;this.leadSource=e,r=!0}}const a=await this.fetchCurrentParsedLeadSource(i);if(this.leadSource=a,this.buildingId=null,this.orgSlug=t,this.buildingSlug=n,n&&!a){const e=this.getLeadSourceBodyIfValid(n);if(e)return this.leadSource=e.leadSource,this.leadSource}if(n){const t=!!a&&a.length>0;this.updateLeadSourceLocalStorage(n,a,e,!t&&!r,r)}return a}catch(e){}return null}},Ii=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 Mi,Ni,Di;!function(e){e.EMOJI="emoji",e.PILLS="pills",e.MINIMIZED="minimized"}(Mi||(Mi={})),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"}(Ni||(Ni={})),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"}(Di||(Di={}));const Li=(e,t)=>"link"===(null==t?void 0:t.toLowerCase());async function Ui(e,t){var n;const i=`https://app.meetelise.com/api/pub/v1/organization/${e}/building/${t}/v2`,o=(await r().get(i)).data;try{o.welcomeMessage=Ri(null!==(n=o.welcomeMessage)&&void 0!==n?n:"",o.userFirstName)}catch(e){}return o}const Ri=(e,t)=>e.replace(/elise/gi,t);var Bi=n(7035),ji=n(6353);function Fi(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 Hi(e,t){var n=function(e){if(!zi[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;zi[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 zi[e]}(t);return n.formatToParts?function(e,t){try{for(var n=e.formatToParts(t),i=[],r=0;r<n.length;r++){var o=$i[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 $i={year:0,month:1,day:2,hour:3,minute:4,second:5};var zi={};function Gi(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 Qi=36e5,Wi={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function qi(e,t,n){var i,r,o;if(!e)return 0;if(i=Wi.timezoneZ.exec(e))return 0;if(i=Wi.timezoneHH.exec(e))return Yi(o=parseInt(i[1],10))?-o*Qi:NaN;if(i=Wi.timezoneHHMM.exec(e)){o=parseInt(i[2],10);var a=parseInt(i[3],10);return Yi(o,a)?(r=Math.abs(o)*Qi+6e4*a,"+"===i[1]?-r:r):NaN}if(function(e){if(Ki[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Ki[e]=!0,!0}catch(e){return!1}}(e)){t=new Date(t||Date.now());var s=n?t:function(e){return Gi(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),l=Vi(s,e),u=n?l:function(e,t,n){var i=e.getTime(),r=i-t,o=Vi(new Date(r),n);if(t===o)return t;r-=o-t;var a=Vi(new Date(r),n);if(o===a)return o;return Math.max(o,a)}(t,l,e);return-u}return NaN}function Vi(e,t){var n=Hi(e,t),i=Gi(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 Yi(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var Ki={};var Xi={X:function(e,t,n,i){var r=Zi(i.timeZone,e);if(0===r)return"Z";switch(t){case"X":return tr(r);case"XXXX":case"XX":return er(r);default:return er(r,":")}},x:function(e,t,n,i){var r=Zi(i.timeZone,e);switch(t){case"x":return tr(r);case"xxxx":case"xx":return er(r);default:return er(r,":")}},O:function(e,t,n,i){var r=Zi(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+Ji(o,2)}(r,":");default:return"GMT"+er(r,":")}},z:function(e,t,n,i){switch(t){case"z":case"zz":case"zzz":return Fi("short",e,i);default:return Fi("long",e,i)}}};function Zi(e,t){var n=e?qi(e,t,!0)/6e4:t.getTimezoneOffset();if(Number.isNaN(n))throw new RangeError("Invalid time zone specified: "+e);return n}function Ji(e,t){for(var n=e<0?"-":"",i=Math.abs(e).toString();i.length<t;)i="0"+i;return n+i}function er(e,t){var n=t||"",i=e>0?"-":"+",r=Math.abs(e);return i+Ji(Math.floor(r/60),2)+n+Ji(Math.floor(r%60),2)}function tr(e,t){return e%60==0?(e>0?"-":"+")+Ji(Math.abs(e)/60,2):er(e,t)}const nr=Xi;var ir=n(9784),rr=n(9720);var or=36e5,ar=6e4,sr={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 lr(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:ir(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=sr.dateTimePattern.exec(e);i?(n.date=i[1],t=i[3]):(i=sr.datePattern.exec(e))?(n.date=i[1],t=i[2]):(n.date=null,t=e);if(t){var r=sr.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=sr.YYY[t],r=sr.YYYYY[t];if(n=sr.YYYY.exec(e)||r.exec(e)){var o=n[1];return{year:parseInt(o,10),restDateString:e.slice(o.length)}}if(n=sr.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=sr.MM.exec(e))return i=new Date(0),pr(t,r=parseInt(n[1],10)-1)?(i.setUTCFullYear(t,r),i):new Date(NaN);if(n=sr.DDD.exec(e)){i=new Date(0);var a=parseInt(n[1],10);return function(e,t){if(t<1)return!1;var n=hr(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=sr.MMDD.exec(e)){i=new Date(0),r=parseInt(n[1],10)-1;var s=parseInt(n[2],10);return pr(t,r,s)?(i.setUTCFullYear(t,r,s),i):new Date(NaN)}if(n=sr.Www.exec(e))return fr(t,o=parseInt(n[1],10)-1)?ur(t,o):new Date(NaN);if(n=sr.WwwD.exec(e)){o=parseInt(n[1],10)-1;var l=parseInt(n[2],10)-1;return fr(t,o,l)?ur(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(),c=0;if(r.time&&(c=function(e){var t,n,i;if(t=sr.HH.exec(e))return gr(n=parseFloat(t[1].replace(",",".")))?n%24*or:NaN;if(t=sr.HHMM.exec(e))return gr(n=parseInt(t[1],10),i=parseFloat(t[2].replace(",",".")))?n%24*or+i*ar:NaN;if(t=sr.HHMMSS.exec(e)){n=parseInt(t[1],10),i=parseInt(t[2],10);var r=parseFloat(t[3].replace(",","."));return gr(n,i,r)?n%24*or+i*ar+1e3*r:NaN}return null}(r.time),isNaN(c)))return new Date(NaN);if(r.timeZone||n.timeZone){if(l=qi(r.timeZone||n.timeZone,new Date(u+c)),isNaN(l))return new Date(NaN)}else l=rr(new Date(u+c)),l=rr(new Date(u+c+l));return new Date(u+c+l)}return new Date(NaN)}function ur(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 cr=[31,28,31,30,31,30,31,31,30,31,30,31],dr=[31,29,31,30,31,30,31,31,30,31,30,31];function hr(e){return e%400==0||e%4==0&&e%100!=0}function pr(e,t,n){if(t<0||t>11)return!1;if(null!=n){if(n<1)return!1;var i=hr(e);if(i&&n>dr[t])return!1;if(!i&&n>cr[t])return!1}return!0}function fr(e,t,n){return!(t<0||t>52)&&(null==n||!(n<0||n>6))}function gr(e,t,n){return(null==e||!(e<0||e>=25))&&((null==t||!(t<0||t>=60))&&(null==n||!(n<0||n>=60)))}var mr=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function yr(e,t,n,i){var r=Bi(i);return r.timeZone=t,r.originalDate=e,function(e,t,n){var i=String(t),r=n||{},o=i.match(mr);if(o){var a=lr(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,"'"+nr[t[0]](a,t,null,r)+"'");return i?o.substring(0,n-1)+o.substring(n+1):o},i)}return ji(e,i,r)}(function(e,t,n){var i=lr(e,n),r=qi(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 br=async({buildingSlug:e})=>{try{const t=await r().get(`${hn}/platformApi/webchat/${e}/units/summary`);if(t.data)return fn(t.data)}catch(t){Ai({logType:xi.error,buildingSlug:e,logTitle:"[ERROR_GETTING_UNITS_SUMMARY]",logData:{error:t}})}return[]};var vr=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 wr=class extends oe{constructor(){super(...arguments),this.tourTypeOptions=[],this.layoutOptions=[],this.chatId="",this.buildingId=0,this.buildingSlug="",this.sgtUrl="",this.selfGuidedToursTypeOffered="",this.selfGuidedTourEnabled=!1,this.escortedToursLink="",this.escortedToursTypeOffered="",this.virtualToursLink="",this.virtualToursTypeOffered="",this.orgSlug="",this.hasDynamicSchedulingEnabled=!1,this.leadSourceClient=null,this.leadSourceMultitouchClient=null,this.buildingName="",this.tourType=null,this.shouldShowTourType={[Cr.Guided]:!0,[Cr.Self]:!0,[Cr.Virtual]:!0},this.email="",this.phoneNumber="",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.currentLeadSource="",this.featureFlagShowDropdown="",this.compactDesign=!1,this.primaryColor=Ue,this.backgroundColor=Re,this.foregroundColorOnPrimaryBackgroundColor="white",this.foregroundColorOnSecondaryBackgroundColor="black",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([Ii(this.buildingId,this.hasDynamicSchedulingEnabled),Kn()]);this.shouldAllowScheduling=e,this.shouldAllowScheduleLoading=!1,this.calendarTimeZone=await(async e=>{var t;return null!==(t=(await Vn(e)).calendarTimeZone)&&void 0!==t?t:Intl.DateTimeFormat().resolvedOptions().timeZone})(this.buildingId),Ai({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:t,logType:xi.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 Ai({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:xi.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});this.shouldShowTourType={[Cr.Guided]:this.tourTypeOptions.map(e=>e.value).includes("WITH_AGENT")&&(t[Cr.Guided]||!!this.escortedToursLink),[Cr.Self]:this.tourTypeOptions.map(e=>e.value).includes("SELF_GUIDED")&&(t[Cr.Self]||!!this.sgtUrl),[Cr.Virtual]:this.tourTypeOptions.map(e=>e.value).includes("VIRTUAL_SHOWING")&&(t[Cr.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 Xn(xr[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,Ai({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this._setDefaultSelectedDateAndTimes=async(e,t)=>{var n,i,r;const o=await Vn(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 Wt("string"==typeof e?Rn(e):e,t)}):[],l=null==s?void 0:s[0];a&&l&&a!==In.Unknown&&a!==In.MediaTour&&(this.selectedDate=Qt("string"==typeof l?Rn(l):l),this.tourType=Ar[a],this.selectedTime="string"==typeof l?Zn(l):(e=>({datetime:Ft(e,"yyyy-MM-dd'T'HH:mm:ss"),offset:Ft(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===In.Unknown||e.tourType===In.MediaTour)return!1;const t=Ar[e.tourType],n=this._getTourTypeOffered(t);return!!n&&(!Li(0,n)&&e.availabilities&&e.availabilities.length>0)}),i=n[0];return i?i.tourType:null},this._getTourTypeOffered=e=>e===Cr.Guided?this.escortedToursTypeOffered:e===Cr.Self?this.selfGuidedToursTypeOffered:e===Cr.Virtual?this.virtualToursTypeOffered:null,this._getUnitOptions=()=>{const e=this.selectedLayoutValue?this.units.filter(e=>Er(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 br({buildingSlug:this.buildingSlug})}catch(e){this.units=[],Ai({logTitle:"ERROR_LOADING_UNITS_FOR_TOUR_SCHEDULER",logData:{error:e},logType:xi.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},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 Vn(this.buildingId)}catch(e){}await Promise.all([this._setAvailabilities().then(async()=>{try{const e=await Vn(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}…`,ai("tourBuildingSelected",{buildingId:n.building_id});try{const e=await Ui(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 Xn(xr[this.tourType]))},this.handlePhoneKeydown=e=>{var t;if(!(e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&null!==e.target.selectionStart))return;const n=e.target.selectionStart;if(1!==e.key.length||Ne(e)){if("Backspace"===e.key){if(Ne(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,i=this.phoneNumber.slice(0,n).replace(/\D/g,""),r=this.phoneNumber.slice(n).replace(/\D/g,""),o=`${i.slice(0,-1)}${r}`;this.phoneNumber=Pe(o),this.phoneInput.value=this.phoneNumber;const a=n-(t-this.phoneNumber.length);return this.phoneInput.setSelectionRange(a,a),e.preventDefault(),void e.stopPropagation()}if(!["ArrowLeft","ArrowRight"].includes(e.key)||Ne(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,n).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,i=n-e>-1?n-e:0;this.phoneInput.setSelectionRange(i,i)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(n).split(/\d+/)[0].length||0)+1,t=n+e<this.phoneNumber.length?n+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,n)+e.key+this.phoneNumber.slice(n);this.phoneNumber=Pe(t.replace(/\D/g,"")),this.phoneInput.value=this.phoneNumber}},this.handlePhoneKeyup=e=>{var t;if(!e.key)return;if(e.key.includes("Arrow")||["Meta","Shift","Control","Alt"].includes(e.key))return;const n=this.phoneInput.selectionStart,i=n?this.phoneInput.value.slice(n).replace(/\D/g,""):"";this.phoneNumber=Pe(this.phoneInput.value);let r=0,o=i.length;for(;o;)(null===(t=this.phoneNumber.at(r))||void 0===t?void 0:t.match(/\d/))&&o--,r++;const a=this.phoneInput.value.length-r+1;this.phoneInput.setSelectionRange(a,a)},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))&&An(null!==(i=null===(n=this.emailInput)||void 0===n?void 0:n.value)&&void 0!==i?i:"")&&!!this.phoneNumber&&14===this.phoneNumber.length&&xn(this.phoneNumber)}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),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,c,d,h,p,f,g,m,y,b,v,w,C,x,A;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const S=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 k=[...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 T=(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;ai("scheduleTourSubmitted",{email:this.email,phone:`+1${null===(n=this.phoneNumber.match(/\d/g))||void 0===n?void 0:n.join("")}`,firstName:null!==(o=null===(i=this.firstNameInput)||void 0===i?void 0:i.value)&&void 0!==o?o:this.firstNameInputValue,lastName:null!==(s=null===(a=this.lastNameInput)||void 0===a?void 0:a.value)&&void 0!==s?s:this.lastNameInputValue,tourType:Sr[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:k.find(e=>"property-website"!==e)||null,layout:T,unit:_});const O={referrer:document.referrer,email_address:this.email,phone_number:`+1${null===(l=this.phoneNumber.match(/\d/g))||void 0===l?void 0:l.join("")}`,building_id:this.buildingId,first_name:null!==(c=null===(u=this.firstNameInput)||void 0===u?void 0:u.value)&&void 0!==c?c:this.firstNameInputValue,last_name:null!==(h=null===(d=this.lastNameInput)||void 0===d?void 0:d.value)&&void 0!==h?h:this.lastNameInputValue,tour_type:Sr[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(E?[E,Oi(this.orgSlug)]:[Oi(this.orgSlug)])],query_params:Object.fromEntries(S.entries()),conversation_tracking_id:null===(p=this.leadSourceClient)||void 0===p?void 0:p.chatId,layouts:T?[T]: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=>gn({...e}))};this.isSubmitting=!0;try{await r().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",O,{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[Ft(this.selectedDate,"yyyy-MM-dd")];e&&(this.availabilitiesGroupedByDay[Ft(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===(A=t.response)||void 0===A?void 0:A.status)&&!this.promptForReschedule)return this.isSubmitting=!1,this.tourIsBooked=!1,qn(),this.availabilitiesGroupedByDay=await Xn(xr[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:()=>B`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>B`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>B` <action-confirm-button
|
|
1290
1294
|
id="schedule-bttn"
|
|
1291
1295
|
.onClick=${this.submit}
|
|
1292
1296
|
.isLoading=${this.isSubmitting}
|
|
@@ -1294,15 +1298,15 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
1294
1298
|
width="145px"
|
|
1295
1299
|
text="Schedule tour"
|
|
1296
1300
|
?disabled=${!this.formIsValidForSubmission()}
|
|
1297
|
-
></action-confirm-button>`,nextButtonAction:null,render:()=>B`${this.userInfoAndLayoutMenu()}`}]}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("aria-modal")||this.setAttribute("aria-modal","true"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Schedule a Tour")}
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1301
|
+
></action-confirm-button>`,nextButtonAction:null,render:()=>B`${this.userInfoAndLayoutMenu()}`}]}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("aria-modal")||this.setAttribute("aria-modal","true"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Schedule a Tour")}buildingSelectMenu(){return B`<me-select
|
|
1302
|
+
id="building"
|
|
1303
|
+
placeholder="Select a property"
|
|
1304
|
+
.value=${this.isGeneralBuilding?"":this.buildingSlug}
|
|
1305
|
+
.options="${this.centralConvoBuildings.map(e=>({label:e.name,value:e.slug}))}"
|
|
1306
|
+
@change=${this._onBuildingChange}
|
|
1307
|
+
>
|
|
1308
|
+
</me-select>`}buildingSelector(){if(this.isGeneralBuilding){if(0===this.centralConvoBuildings.length)return""}else if(this.centralConvoBuildings.length<=1)return"";return B`<h2 class="journey-header">Building</h2>
|
|
1309
|
+
${this.buildingSelectMenu()}`}tourTypeMenu(){return B`${this.buildingSelector()}
|
|
1306
1310
|
<h2 id="tour-type-heading" class="journey-header">Tour Type</h2>
|
|
1307
1311
|
<div
|
|
1308
1312
|
id="tour-type-menu"
|
|
@@ -1571,19 +1575,25 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
1571
1575
|
${this.statusMessage}
|
|
1572
1576
|
</div>
|
|
1573
1577
|
${this.renderBody()}
|
|
1574
|
-
`}
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1578
|
+
`}renderCenteredCard(e){return B` <div
|
|
1579
|
+
id="tour-scheduler-inner-form"
|
|
1580
|
+
class="${ni()({"tour-scheduler-full":!this.compactDesign&&!bn(),"tour-scheduler-compact":this.compactDesign&&!bn(),"tour-scheduler-mobile":bn()})}"
|
|
1581
|
+
>
|
|
1582
|
+
<div id="top-header">
|
|
1583
|
+
<div></div>
|
|
1584
|
+
${this.closeButton()}
|
|
1585
|
+
</div>
|
|
1586
|
+
<div class="center-tour-not-avail">${e}</div>
|
|
1587
|
+
</div>`}renderBody(){var e,t,n,i,r,o;const a=this.waitingForAvailabilities||this.shouldAllowScheduleLoading;if(this.isGeneralBuilding&&!a)return this.renderCenteredCard(B`
|
|
1588
|
+
<h1>Please select a building</h1>
|
|
1589
|
+
<p>Choose a property to see available tours.</p>
|
|
1590
|
+
${this.centralConvoBuildings.length>0?B`<div class="general-building-select">
|
|
1591
|
+
${this.buildingSelectMenu()}
|
|
1592
|
+
</div>`:""}
|
|
1593
|
+
`);if(!this.shouldAllowScheduling&&!a)return this.renderCenteredCard(B`
|
|
1594
|
+
<h1>Sorry, there are currently no tour availabilities</h1>
|
|
1595
|
+
<p>Please check back again later</p>
|
|
1596
|
+
`);if(a)return B` <div
|
|
1587
1597
|
id="tour-scheduler-inner-form"
|
|
1588
1598
|
class="${ni()({"tour-scheduler-full":!this.compactDesign&&!bn(),"tour-scheduler-compact":this.compactDesign&&!bn(),"tour-scheduler-mobile":bn()})}"
|
|
1589
1599
|
>
|
|
@@ -1792,7 +1802,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
1792
1802
|
</div>
|
|
1793
1803
|
`}
|
|
1794
1804
|
</div>
|
|
1795
|
-
`}};var Cr;wr.styles=[vi,kn],vr([ue({attribute:!1})],wr.prototype,"tourTypeOptions",void 0),vr([ue({attribute:!1})],wr.prototype,"layoutOptions",void 0),vr([ue({attribute:!0})],wr.prototype,"chatId",void 0),vr([ue({type:Number})],wr.prototype,"buildingId",void 0),vr([ue({attribute:!0})],wr.prototype,"buildingSlug",void 0),vr([ue({attribute:!0})],wr.prototype,"sgtUrl",void 0),vr([ue({attribute:!0})],wr.prototype,"selfGuidedToursTypeOffered",void 0),vr([ue({attribute:!0})],wr.prototype,"selfGuidedTourEnabled",void 0),vr([ue({attribute:!0})],wr.prototype,"escortedToursLink",void 0),vr([ue({attribute:!0})],wr.prototype,"escortedToursTypeOffered",void 0),vr([ue({attribute:!0})],wr.prototype,"virtualToursLink",void 0),vr([ue({attribute:!0})],wr.prototype,"virtualToursTypeOffered",void 0),vr([ue({attribute:!0})],wr.prototype,"orgSlug",void 0),vr([ue({attribute:!0})],wr.prototype,"hasDynamicSchedulingEnabled",void 0),vr([ue({attribute:!0})],wr.prototype,"leadSourceClient",void 0),vr([ue({attribute:!0})],wr.prototype,"leadSourceMultitouchClient",void 0),vr([ue({attribute:!0})],wr.prototype,"buildingName",void 0),vr([ce()],wr.prototype,"tourType",void 0),vr([ce()],wr.prototype,"shouldShowTourType",void 0),vr([ce()],wr.prototype,"email",void 0),vr([ce()],wr.prototype,"phoneNumber",void 0),vr([ce()],wr.prototype,"availabilitiesGroupedByDay",void 0),vr([ce()],wr.prototype,"calendarTimeZone",void 0),vr([ce()],wr.prototype,"waitingForAvailabilities",void 0),vr([ce()],wr.prototype,"selectedDate",void 0),vr([ce()],wr.prototype,"selectedTime",void 0),vr([ce()],wr.prototype,"mobilePageIndex",void 0),vr([ce()],wr.prototype,"isSubmitting",void 0),vr([ce()],wr.prototype,"tourIsBooked",void 0),vr([ce()],wr.prototype,"shouldAllowScheduling",void 0),vr([ce()],wr.prototype,"shouldAllowScheduleLoading",void 0),vr([ce()],wr.prototype,"promptForReschedule",void 0),vr([ce()],wr.prototype,"canceledReschedule",void 0),vr([ue({attribute:!1})],wr.prototype,"leadSources",void 0),vr([ue({attribute:!0})],wr.prototype,"orgLegalName",void 0),vr([ue({attribute:!0})],wr.prototype,"currentLeadSource",void 0),vr([ue({attribute:!0})],wr.prototype,"featureFlagShowDropdown",void 0),vr([ue({attribute:!0})],wr.prototype,"compactDesign",void 0),vr([ue({attribute:!0})],wr.prototype,"primaryColor",void 0),vr([ue({attribute:!0})],wr.prototype,"backgroundColor",void 0),vr([ue({attribute:!0})],wr.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),vr([ue({attribute:!0})],wr.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),vr([de(".nameContainer#firstName input")],wr.prototype,"firstNameInput",void 0),vr([de(".nameContainer#lastName input")],wr.prototype,"lastNameInput",void 0),vr([de(".inputContainer#email input")],wr.prototype,"emailInput",void 0),vr([de(".inputContainer#phone input")],wr.prototype,"phoneInput",void 0),vr([de("me-select#leadSource")],wr.prototype,"selectedLeadSource",void 0),vr([de("me-select#layout")],wr.prototype,"selectedLayoutEl",void 0),vr([de("me-select#unit")],wr.prototype,"selectedUnitEl",void 0),vr([ce()],wr.prototype,"firstNameInputValue",void 0),vr([ce()],wr.prototype,"lastNameInputValue",void 0),vr([ce()],wr.prototype,"leadSourceInputValue",void 0),vr([ce()],wr.prototype,"selectedLayoutValue",void 0),vr([ce()],wr.prototype,"selectedUnitValue",void 0),vr([ce()],wr.prototype,"units",void 0),vr([ce()],wr.prototype,"allowOccupiedUnitTours",void 0),vr([ce()],wr.prototype,"errorGettingAvailabilities",void 0),vr([ce()],wr.prototype,"centralConvoBuildings",void 0),vr([de("me-select#building")],wr.prototype,"selectedBuildingEl",void 0),vr([ce()],wr.prototype,"statusMessage",void 0),wr=vr([se("tour-scheduler")],wr),function(e){e.Guided="guided",e.Self="self",e.Virtual="virtual"}(Cr||(Cr={}));const xr={[Cr.Guided]:In.WithAgent,[Cr.Self]:In.SelfGuided,[Cr.Virtual]:In.VirtualShowing},Ar={[In.WithAgent]:Cr.Guided,[In.SelfGuided]:Cr.Self,[In.VirtualShowing]:Cr.Virtual},Sr={[Cr.Guided]:"escorted-tour",[Cr.Self]:"self-guided-tour",[Cr.Virtual]:"live-virtual-tour"};function Er(e){const t=Math.round(e/10);return 0===t?"studio":`${t}br`}const kr=(e,t,n=!0,i=!1,r,o=.01)=>Si({params:{org_slug:e,building_slug:t,is_pixel_on_site:n,is_any_webchat_showing:i,extra_data:{webchat_no_show_reason:r}},sampleRate:o}),Tr=async(e,t,n)=>{const i=.01;if(!e)return kr(n,t,!0,!1,"building_does_not_exist",i),!1;if(!e.launchedDateTime)return kr(n,t,!0,!1,"building_not_launched",i),!1;if(!e.active)return kr(n,t,!0,!1,"building_not_active",i),!1;if(!e.webchatScopeConfigured)return kr(n,t,!0,!1,"building_not_webchat_scope_configured",i),!1;const o=await async function(e){if(!e)return!1;try{return(await r().get(ii(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-leasing-in-maintenance-mode",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(t);return!o||(kr(n,t,!0,!1,"building_in_maintenance_mode",i),!1)},_r=u`
|
|
1805
|
+
`}};var Cr;wr.styles=[vi,kn],vr([ue({attribute:!1})],wr.prototype,"tourTypeOptions",void 0),vr([ue({attribute:!1})],wr.prototype,"layoutOptions",void 0),vr([ue({attribute:!0})],wr.prototype,"chatId",void 0),vr([ue({type:Number})],wr.prototype,"buildingId",void 0),vr([ue({attribute:!0})],wr.prototype,"buildingSlug",void 0),vr([ue({attribute:!0})],wr.prototype,"sgtUrl",void 0),vr([ue({attribute:!0})],wr.prototype,"selfGuidedToursTypeOffered",void 0),vr([ue({attribute:!0})],wr.prototype,"selfGuidedTourEnabled",void 0),vr([ue({attribute:!0})],wr.prototype,"escortedToursLink",void 0),vr([ue({attribute:!0})],wr.prototype,"escortedToursTypeOffered",void 0),vr([ue({attribute:!0})],wr.prototype,"virtualToursLink",void 0),vr([ue({attribute:!0})],wr.prototype,"virtualToursTypeOffered",void 0),vr([ue({attribute:!0})],wr.prototype,"orgSlug",void 0),vr([ue({attribute:!0})],wr.prototype,"hasDynamicSchedulingEnabled",void 0),vr([ue({attribute:!0})],wr.prototype,"leadSourceClient",void 0),vr([ue({attribute:!0})],wr.prototype,"leadSourceMultitouchClient",void 0),vr([ue({attribute:!0})],wr.prototype,"buildingName",void 0),vr([ce()],wr.prototype,"tourType",void 0),vr([ce()],wr.prototype,"shouldShowTourType",void 0),vr([ce()],wr.prototype,"email",void 0),vr([ce()],wr.prototype,"phoneNumber",void 0),vr([ce()],wr.prototype,"availabilitiesGroupedByDay",void 0),vr([ce()],wr.prototype,"calendarTimeZone",void 0),vr([ce()],wr.prototype,"waitingForAvailabilities",void 0),vr([ce()],wr.prototype,"selectedDate",void 0),vr([ce()],wr.prototype,"selectedTime",void 0),vr([ce()],wr.prototype,"mobilePageIndex",void 0),vr([ce()],wr.prototype,"isSubmitting",void 0),vr([ce()],wr.prototype,"tourIsBooked",void 0),vr([ce()],wr.prototype,"shouldAllowScheduling",void 0),vr([ce()],wr.prototype,"shouldAllowScheduleLoading",void 0),vr([ce()],wr.prototype,"promptForReschedule",void 0),vr([ce()],wr.prototype,"canceledReschedule",void 0),vr([ue({attribute:!1})],wr.prototype,"leadSources",void 0),vr([ue({attribute:!0})],wr.prototype,"orgLegalName",void 0),vr([ue({attribute:!0})],wr.prototype,"currentLeadSource",void 0),vr([ue({attribute:!0})],wr.prototype,"featureFlagShowDropdown",void 0),vr([ue({attribute:!0})],wr.prototype,"compactDesign",void 0),vr([ue({attribute:!0})],wr.prototype,"primaryColor",void 0),vr([ue({attribute:!0})],wr.prototype,"backgroundColor",void 0),vr([ue({attribute:!0})],wr.prototype,"foregroundColorOnPrimaryBackgroundColor",void 0),vr([ue({attribute:!0})],wr.prototype,"foregroundColorOnSecondaryBackgroundColor",void 0),vr([de(".nameContainer#firstName input")],wr.prototype,"firstNameInput",void 0),vr([de(".nameContainer#lastName input")],wr.prototype,"lastNameInput",void 0),vr([de(".inputContainer#email input")],wr.prototype,"emailInput",void 0),vr([de(".inputContainer#phone input")],wr.prototype,"phoneInput",void 0),vr([de("me-select#leadSource")],wr.prototype,"selectedLeadSource",void 0),vr([de("me-select#layout")],wr.prototype,"selectedLayoutEl",void 0),vr([de("me-select#unit")],wr.prototype,"selectedUnitEl",void 0),vr([ce()],wr.prototype,"firstNameInputValue",void 0),vr([ce()],wr.prototype,"lastNameInputValue",void 0),vr([ce()],wr.prototype,"leadSourceInputValue",void 0),vr([ce()],wr.prototype,"selectedLayoutValue",void 0),vr([ce()],wr.prototype,"selectedUnitValue",void 0),vr([ce()],wr.prototype,"units",void 0),vr([ce()],wr.prototype,"allowOccupiedUnitTours",void 0),vr([ce()],wr.prototype,"errorGettingAvailabilities",void 0),vr([ce()],wr.prototype,"centralConvoBuildings",void 0),vr([ce()],wr.prototype,"isGeneralBuilding",void 0),vr([de("me-select#building")],wr.prototype,"selectedBuildingEl",void 0),vr([ce()],wr.prototype,"statusMessage",void 0),wr=vr([se("tour-scheduler")],wr),function(e){e.Guided="guided",e.Self="self",e.Virtual="virtual"}(Cr||(Cr={}));const xr={[Cr.Guided]:In.WithAgent,[Cr.Self]:In.SelfGuided,[Cr.Virtual]:In.VirtualShowing},Ar={[In.WithAgent]:Cr.Guided,[In.SelfGuided]:Cr.Self,[In.VirtualShowing]:Cr.Virtual},Sr={[Cr.Guided]:"escorted-tour",[Cr.Self]:"self-guided-tour",[Cr.Virtual]:"live-virtual-tour"};function Er(e){const t=Math.round(e/10);return 0===t?"studio":`${t}br`}const kr=(e,t,n=!0,i=!1,r,o=.01)=>Si({params:{org_slug:e,building_slug:t,is_pixel_on_site:n,is_any_webchat_showing:i,extra_data:{webchat_no_show_reason:r}},sampleRate:o}),Tr=async(e,t,n)=>{const i=.01;if(!e)return kr(n,t,!0,!1,"building_does_not_exist",i),!1;if(!e.launchedDateTime)return kr(n,t,!0,!1,"building_not_launched",i),!1;if(!e.active)return kr(n,t,!0,!1,"building_not_active",i),!1;if(!e.webchatScopeConfigured)return kr(n,t,!0,!1,"building_not_webchat_scope_configured",i),!1;const o=await async function(e){if(!e)return!1;try{return(await r().get(ii(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-leasing-in-maintenance-mode",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(t);return!o||(kr(n,t,!0,!1,"building_in_maintenance_mode",i),!1)},_r=u`
|
|
1796
1806
|
* {
|
|
1797
1807
|
font-family: "Helvetica Neue", Arial;
|
|
1798
1808
|
font-size: 14px;
|
|
@@ -226,6 +226,8 @@ export class TourScheduler extends LitElement {
|
|
|
226
226
|
|
|
227
227
|
@state()
|
|
228
228
|
private centralConvoBuildings: CentralConvoBuilding[] = [];
|
|
229
|
+
@state()
|
|
230
|
+
private isGeneralBuilding = false;
|
|
229
231
|
@query("me-select#building")
|
|
230
232
|
selectedBuildingEl?: MESelect;
|
|
231
233
|
@state()
|
|
@@ -466,7 +468,14 @@ export class TourScheduler extends LitElement {
|
|
|
466
468
|
};
|
|
467
469
|
|
|
468
470
|
firstUpdated = async (): Promise<void> => {
|
|
469
|
-
this._fetchCentralConvoBuildings();
|
|
471
|
+
await this._fetchCentralConvoBuildings();
|
|
472
|
+
if (this.isGeneralBuilding) {
|
|
473
|
+
this.waitingForAvailabilities = false;
|
|
474
|
+
this.shouldAllowScheduleLoading = false;
|
|
475
|
+
this.statusMessage =
|
|
476
|
+
"Please select a building to see tour availabilities.";
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
470
479
|
await this._loadForCurrentBuilding();
|
|
471
480
|
};
|
|
472
481
|
|
|
@@ -493,12 +502,15 @@ export class TourScheduler extends LitElement {
|
|
|
493
502
|
private _fetchCentralConvoBuildings = async (): Promise<void> => {
|
|
494
503
|
if (!this.orgSlug || !this.buildingSlug) return;
|
|
495
504
|
try {
|
|
496
|
-
|
|
505
|
+
const res = await fetchCentralConvoBuildings(
|
|
497
506
|
this.orgSlug,
|
|
498
507
|
this.buildingSlug
|
|
499
508
|
);
|
|
509
|
+
this.centralConvoBuildings = res.buildings;
|
|
510
|
+
this.isGeneralBuilding = res.is_general_building;
|
|
500
511
|
} catch (e) {
|
|
501
512
|
this.centralConvoBuildings = [];
|
|
513
|
+
this.isGeneralBuilding = false;
|
|
502
514
|
}
|
|
503
515
|
};
|
|
504
516
|
|
|
@@ -508,6 +520,7 @@ export class TourScheduler extends LitElement {
|
|
|
508
520
|
const building = this.centralConvoBuildings.find((b) => b.slug === slug);
|
|
509
521
|
if (!building) return;
|
|
510
522
|
|
|
523
|
+
this.isGeneralBuilding = false;
|
|
511
524
|
this.waitingForAvailabilities = true;
|
|
512
525
|
this.errorGettingAvailabilities = false;
|
|
513
526
|
this.tourType = null;
|
|
@@ -561,20 +574,28 @@ export class TourScheduler extends LitElement {
|
|
|
561
574
|
}
|
|
562
575
|
};
|
|
563
576
|
|
|
577
|
+
buildingSelectMenu(): TemplateResult {
|
|
578
|
+
return html`<me-select
|
|
579
|
+
id="building"
|
|
580
|
+
placeholder="Select a property"
|
|
581
|
+
.value=${this.isGeneralBuilding ? "" : this.buildingSlug}
|
|
582
|
+
.options="${this.centralConvoBuildings.map((b) => ({
|
|
583
|
+
label: b.name,
|
|
584
|
+
value: b.slug,
|
|
585
|
+
}))}"
|
|
586
|
+
@change=${this._onBuildingChange}
|
|
587
|
+
>
|
|
588
|
+
</me-select>`;
|
|
589
|
+
}
|
|
590
|
+
|
|
564
591
|
buildingSelector(): TemplateResult | string {
|
|
565
|
-
if (this.
|
|
592
|
+
if (this.isGeneralBuilding) {
|
|
593
|
+
if (this.centralConvoBuildings.length === 0) return "";
|
|
594
|
+
} else if (this.centralConvoBuildings.length <= 1) {
|
|
595
|
+
return "";
|
|
596
|
+
}
|
|
566
597
|
return html`<h2 class="journey-header">Building</h2>
|
|
567
|
-
|
|
568
|
-
id="building"
|
|
569
|
-
placeholder="Select a property"
|
|
570
|
-
.value=${this.buildingSlug}
|
|
571
|
-
.options="${this.centralConvoBuildings.map((b) => ({
|
|
572
|
-
label: b.name,
|
|
573
|
-
value: b.slug,
|
|
574
|
-
}))}"
|
|
575
|
-
@change=${this._onBuildingChange}
|
|
576
|
-
>
|
|
577
|
-
</me-select>`;
|
|
598
|
+
${this.buildingSelectMenu()}`;
|
|
578
599
|
}
|
|
579
600
|
|
|
580
601
|
protected willUpdate = async (
|
|
@@ -1578,27 +1599,42 @@ export class TourScheduler extends LitElement {
|
|
|
1578
1599
|
`;
|
|
1579
1600
|
}
|
|
1580
1601
|
|
|
1602
|
+
private renderCenteredCard(content: TemplateResult): TemplateResult {
|
|
1603
|
+
return html` <div
|
|
1604
|
+
id="tour-scheduler-inner-form"
|
|
1605
|
+
class="${classnames({
|
|
1606
|
+
"tour-scheduler-full": !this.compactDesign && !isMobile(),
|
|
1607
|
+
"tour-scheduler-compact": this.compactDesign && !isMobile(),
|
|
1608
|
+
"tour-scheduler-mobile": isMobile(),
|
|
1609
|
+
})}"
|
|
1610
|
+
>
|
|
1611
|
+
<div id="top-header">
|
|
1612
|
+
<div></div>
|
|
1613
|
+
${this.closeButton()}
|
|
1614
|
+
</div>
|
|
1615
|
+
<div class="center-tour-not-avail">${content}</div>
|
|
1616
|
+
</div>`;
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1581
1619
|
private renderBody(): TemplateResult {
|
|
1582
1620
|
const isLoading =
|
|
1583
1621
|
this.waitingForAvailabilities || this.shouldAllowScheduleLoading;
|
|
1622
|
+
if (this.isGeneralBuilding && !isLoading) {
|
|
1623
|
+
return this.renderCenteredCard(html`
|
|
1624
|
+
<h1>Please select a building</h1>
|
|
1625
|
+
<p>Choose a property to see available tours.</p>
|
|
1626
|
+
${this.centralConvoBuildings.length > 0
|
|
1627
|
+
? html`<div class="general-building-select">
|
|
1628
|
+
${this.buildingSelectMenu()}
|
|
1629
|
+
</div>`
|
|
1630
|
+
: ""}
|
|
1631
|
+
`);
|
|
1632
|
+
}
|
|
1584
1633
|
if (!this.shouldAllowScheduling && !isLoading) {
|
|
1585
|
-
return html`
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
"tour-scheduler-compact": this.compactDesign && !isMobile(),
|
|
1590
|
-
"tour-scheduler-mobile": isMobile(),
|
|
1591
|
-
})}"
|
|
1592
|
-
>
|
|
1593
|
-
<div id="top-header">
|
|
1594
|
-
<div></div>
|
|
1595
|
-
${this.closeButton()}
|
|
1596
|
-
</div>
|
|
1597
|
-
<div class="center-tour-not-avail">
|
|
1598
|
-
<h1>Sorry, there are currently no tour availabilities</h1>
|
|
1599
|
-
<p>Please check back again later</p>
|
|
1600
|
-
</div>
|
|
1601
|
-
</div>`;
|
|
1634
|
+
return this.renderCenteredCard(html`
|
|
1635
|
+
<h1>Sorry, there are currently no tour availabilities</h1>
|
|
1636
|
+
<p>Please check back again later</p>
|
|
1637
|
+
`);
|
|
1602
1638
|
}
|
|
1603
1639
|
if (isLoading) {
|
|
1604
1640
|
return html` <div
|
|
@@ -441,6 +441,10 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
441
441
|
font-size: 14px;
|
|
442
442
|
text-align: left;
|
|
443
443
|
}
|
|
444
|
+
.general-building-select {
|
|
445
|
+
width: 100%;
|
|
446
|
+
margin-top: 16px;
|
|
447
|
+
}
|
|
444
448
|
.loading-entire-tour-icon {
|
|
445
449
|
padding: 24px;
|
|
446
450
|
}
|
|
@@ -6,10 +6,14 @@ export interface CentralConvoBuilding {
|
|
|
6
6
|
slug: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
export interface CentralConvoBuildingsResponse {
|
|
10
|
+
is_general_building: boolean;
|
|
11
|
+
buildings: CentralConvoBuilding[];
|
|
12
|
+
}
|
|
13
|
+
|
|
9
14
|
/**
|
|
10
15
|
* Fetch the buildings that belong to the same central conversation group as the
|
|
11
|
-
* current building.
|
|
12
|
-
* central conversation group (in which case no building selector is shown).
|
|
16
|
+
* current building.
|
|
13
17
|
*
|
|
14
18
|
* @param orgSlug - The org slug, e.g. "big-prop-co"
|
|
15
19
|
* @param buildingSlug - The current building's slug, e.g. "gravity-falls"
|
|
@@ -17,16 +21,20 @@ export interface CentralConvoBuilding {
|
|
|
17
21
|
export default async function fetchCentralConvoBuildings(
|
|
18
22
|
orgSlug: string,
|
|
19
23
|
buildingSlug: string
|
|
20
|
-
): Promise<
|
|
24
|
+
): Promise<CentralConvoBuildingsResponse> {
|
|
21
25
|
const host = "https://app.meetelise.com";
|
|
22
|
-
const url = `${host}/platformApi/webchat/central-convo-buildings`;
|
|
26
|
+
const url = `${host}/platformApi/webchat/central-convo-buildings-v2`;
|
|
23
27
|
|
|
24
|
-
const response = await axios.get<
|
|
28
|
+
const response = await axios.get<CentralConvoBuildingsResponse>(url, {
|
|
25
29
|
headers: {
|
|
26
30
|
["building-slug"]: buildingSlug,
|
|
27
31
|
["org-slug"]: orgSlug,
|
|
28
32
|
},
|
|
29
33
|
});
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
const data = response.data;
|
|
36
|
+
return {
|
|
37
|
+
is_general_building: data?.is_general_building ?? false,
|
|
38
|
+
buildings: data?.buildings ?? [],
|
|
39
|
+
};
|
|
32
40
|
}
|