@meetelise/chat 1.45.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 +11 -0
- package/dist/src/fetchCentralConvoBuildings.d.ts +17 -0
- package/package.json +1 -1
- package/public/dist/index.js +56 -16
- package/src/WebComponent/Scheduler/tour-scheduler.ts +174 -19
- package/src/WebComponent/Scheduler/tourSchedulerStyles.ts +20 -0
- package/src/fetchCentralConvoBuildings.ts +40 -0
|
@@ -67,6 +67,10 @@ export declare class TourScheduler extends LitElement {
|
|
|
67
67
|
private units;
|
|
68
68
|
private allowOccupiedUnitTours;
|
|
69
69
|
errorGettingAvailabilities: boolean;
|
|
70
|
+
private centralConvoBuildings;
|
|
71
|
+
private isGeneralBuilding;
|
|
72
|
+
selectedBuildingEl?: MESelect;
|
|
73
|
+
private statusMessage;
|
|
70
74
|
_setAvailabilities: () => Promise<void>;
|
|
71
75
|
_setDefaultSelectedDateAndTimes: (tourType?: TourAvailabilityResponseRankOrderedSupportedTourTypesEnum, date?: Date) => Promise<void>;
|
|
72
76
|
_getHighestRankedTourType: (availabilities: TourAvailabilityResponse) => TourAvailabilityResponseRankOrderedSupportedTourTypesEnum | null;
|
|
@@ -77,6 +81,11 @@ export declare class TourScheduler extends LitElement {
|
|
|
77
81
|
}[];
|
|
78
82
|
_fetchUnits: () => Promise<void>;
|
|
79
83
|
firstUpdated: () => Promise<void>;
|
|
84
|
+
private _loadForCurrentBuilding;
|
|
85
|
+
private _fetchCentralConvoBuildings;
|
|
86
|
+
private _onBuildingChange;
|
|
87
|
+
buildingSelectMenu(): TemplateResult;
|
|
88
|
+
buildingSelector(): TemplateResult | string;
|
|
80
89
|
protected willUpdate: (_changedProperties: PropertyValueMap<{
|
|
81
90
|
tourType: TourType;
|
|
82
91
|
}> | Map<PropertyKey, unknown>) => Promise<void>;
|
|
@@ -114,6 +123,8 @@ export declare class TourScheduler extends LitElement {
|
|
|
114
123
|
confirmationMessage(): TemplateResult;
|
|
115
124
|
loadingIcon(size?: number): TemplateResult;
|
|
116
125
|
render(): TemplateResult;
|
|
126
|
+
private renderCenteredCard;
|
|
127
|
+
private renderBody;
|
|
117
128
|
}
|
|
118
129
|
export declare enum TourType {
|
|
119
130
|
Guided = "guided",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface CentralConvoBuilding {
|
|
2
|
+
building_id: number;
|
|
3
|
+
name: string;
|
|
4
|
+
slug: string;
|
|
5
|
+
}
|
|
6
|
+
export interface CentralConvoBuildingsResponse {
|
|
7
|
+
is_general_building: boolean;
|
|
8
|
+
buildings: CentralConvoBuilding[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Fetch the buildings that belong to the same central conversation group as the
|
|
12
|
+
* current building.
|
|
13
|
+
*
|
|
14
|
+
* @param orgSlug - The org slug, e.g. "big-prop-co"
|
|
15
|
+
* @param buildingSlug - The current building's slug, e.g. "gravity-falls"
|
|
16
|
+
*/
|
|
17
|
+
export default function fetchCentralConvoBuildings(orgSlug: string, buildingSlug: string): Promise<CentralConvoBuildingsResponse>;
|
package/package.json
CHANGED
package/public/dist/index.js
CHANGED
|
@@ -947,6 +947,17 @@ var e={2:(e,t,n)=>{var i=n(2199),r=n(4664),o=n(5950);e.exports=function(e){retur
|
|
|
947
947
|
font-size: 14px;
|
|
948
948
|
font-weight: 600;
|
|
949
949
|
}
|
|
950
|
+
.sr-only {
|
|
951
|
+
position: absolute;
|
|
952
|
+
width: 1px;
|
|
953
|
+
height: 1px;
|
|
954
|
+
padding: 0;
|
|
955
|
+
margin: -1px;
|
|
956
|
+
overflow: hidden;
|
|
957
|
+
clip: rect(0, 0, 0, 0);
|
|
958
|
+
white-space: nowrap;
|
|
959
|
+
border: 0;
|
|
960
|
+
}
|
|
950
961
|
#close-button {
|
|
951
962
|
background: none;
|
|
952
963
|
border: none;
|
|
@@ -974,6 +985,11 @@ var e={2:(e,t,n)=>{var i=n(2199),r=n(4664),o=n(5950);e.exports=function(e){retur
|
|
|
974
985
|
padding-bottom: 12px;
|
|
975
986
|
}
|
|
976
987
|
|
|
988
|
+
me-select#building {
|
|
989
|
+
display: block;
|
|
990
|
+
margin-bottom: 20px;
|
|
991
|
+
}
|
|
992
|
+
|
|
977
993
|
#tour-type-menu-outer-container {
|
|
978
994
|
width: 220px;
|
|
979
995
|
}
|
|
@@ -1261,6 +1277,10 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
1261
1277
|
font-size: 14px;
|
|
1262
1278
|
text-align: left;
|
|
1263
1279
|
}
|
|
1280
|
+
.general-building-select {
|
|
1281
|
+
width: 100%;
|
|
1282
|
+
margin-top: 16px;
|
|
1283
|
+
}
|
|
1264
1284
|
.loading-entire-tour-icon {
|
|
1265
1285
|
padding: 24px;
|
|
1266
1286
|
}
|
|
@@ -1270,7 +1290,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
1270
1290
|
gap: 12px;
|
|
1271
1291
|
align-items: center;
|
|
1272
1292
|
}
|
|
1273
|
-
`;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._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()=>{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.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
|
|
1274
1294
|
id="schedule-bttn"
|
|
1275
1295
|
.onClick=${this.submit}
|
|
1276
1296
|
.isLoading=${this.isSubmitting}
|
|
@@ -1278,7 +1298,16 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
1278
1298
|
width="145px"
|
|
1279
1299
|
text="Schedule tour"
|
|
1280
1300
|
?disabled=${!this.formIsValidForSubmission()}
|
|
1281
|
-
></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")}
|
|
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()}
|
|
1310
|
+
<h2 id="tour-type-heading" class="journey-header">Tour Type</h2>
|
|
1282
1311
|
<div
|
|
1283
1312
|
id="tour-type-menu"
|
|
1284
1313
|
role="radiogroup"
|
|
@@ -1541,19 +1570,30 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
1541
1570
|
d="M17.835 13.1045C18.4839 11.5628 18.6332 9.85647 18.2621 8.22548C17.8909 6.5945 17.018 5.12084 15.7659 4.0117C14.5139 2.90256 12.9457 2.21372 11.2818 2.04201C9.618 1.87031 7.94218 2.22438 6.49 3.05445L5.498 1.31745C7.01563 0.450066 8.73419 -0.00418222 10.4822 2.90165e-05C12.2302 0.00424025 13.9466 0.466764 15.46 1.34145C19.95 3.93345 21.67 9.48345 19.577 14.1115L20.919 14.8855L16.754 17.0995L16.589 12.3855L17.835 13.1045ZM3.085 6.89845C2.43614 8.44015 2.28678 10.1464 2.65792 11.7774C3.02905 13.4084 3.90201 14.8821 5.15407 15.9912C6.40613 17.1003 7.97432 17.7892 9.63816 17.9609C11.302 18.1326 12.9778 17.7785 14.43 16.9485L15.422 18.6855C13.9044 19.5528 12.1858 20.0071 10.4378 20.0029C8.68979 19.9987 6.97344 19.5361 5.46 18.6615C0.97 16.0695 -0.75 10.5195 1.343 5.89145L0 5.11845L4.165 2.90445L4.33 7.61845L3.084 6.89945L3.085 6.89845Z"
|
|
1542
1571
|
fill="#1E1E1E"
|
|
1543
1572
|
/>
|
|
1544
|
-
</svg>`}render(){
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
>
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
</div
|
|
1573
|
+
</svg>`}render(){return B`
|
|
1574
|
+
<div class="sr-only" role="status" aria-live="polite">
|
|
1575
|
+
${this.statusMessage}
|
|
1576
|
+
</div>
|
|
1577
|
+
${this.renderBody()}
|
|
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
|
|
1557
1597
|
id="tour-scheduler-inner-form"
|
|
1558
1598
|
class="${ni()({"tour-scheduler-full":!this.compactDesign&&!bn(),"tour-scheduler-compact":this.compactDesign&&!bn(),"tour-scheduler-mobile":bn()})}"
|
|
1559
1599
|
>
|
|
@@ -1762,7 +1802,7 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
1762
1802
|
</div>
|
|
1763
1803
|
`}
|
|
1764
1804
|
</div>
|
|
1765
|
-
`}};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),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`
|
|
1766
1806
|
* {
|
|
1767
1807
|
font-family: "Helvetica Neue", Arial;
|
|
1768
1808
|
font-size: 14px;
|
|
@@ -57,6 +57,10 @@ import { TourVirtuallyIcon } from "../icons/TourVirtuallyIcon";
|
|
|
57
57
|
import { TourSelfGuidedIcon } from "../icons/TourSelfGuidedIcon";
|
|
58
58
|
import { TourWithAgentIcon } from "../icons/TourWithAgentIcon";
|
|
59
59
|
import { shouldOpenTourLink } from "../../fetchBuildingWebchatView";
|
|
60
|
+
import fetchBuildingWebchatView from "../../fetchBuildingWebchatView";
|
|
61
|
+
import fetchCentralConvoBuildings, {
|
|
62
|
+
CentralConvoBuilding,
|
|
63
|
+
} from "../../fetchCentralConvoBuildings";
|
|
60
64
|
import formatInTimeZone from "date-fns-tz/formatInTimeZone";
|
|
61
65
|
import { getTimezoneAbbreviation } from "../../getTimezoneString";
|
|
62
66
|
import startOfDay from "date-fns/startOfDay";
|
|
@@ -220,6 +224,15 @@ export class TourScheduler extends LitElement {
|
|
|
220
224
|
@state()
|
|
221
225
|
errorGettingAvailabilities = false;
|
|
222
226
|
|
|
227
|
+
@state()
|
|
228
|
+
private centralConvoBuildings: CentralConvoBuilding[] = [];
|
|
229
|
+
@state()
|
|
230
|
+
private isGeneralBuilding = false;
|
|
231
|
+
@query("me-select#building")
|
|
232
|
+
selectedBuildingEl?: MESelect;
|
|
233
|
+
@state()
|
|
234
|
+
private statusMessage = "";
|
|
235
|
+
|
|
223
236
|
_setAvailabilities = async (): Promise<void> => {
|
|
224
237
|
try {
|
|
225
238
|
const [allowScheduling, availabilitiesExistForTourType] =
|
|
@@ -455,11 +468,29 @@ export class TourScheduler extends LitElement {
|
|
|
455
468
|
};
|
|
456
469
|
|
|
457
470
|
firstUpdated = async (): Promise<void> => {
|
|
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
|
+
}
|
|
479
|
+
await this._loadForCurrentBuilding();
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
private _loadForCurrentBuilding = async (): Promise<void> => {
|
|
483
|
+
try {
|
|
484
|
+
await getRawAvailabilities(this.buildingId);
|
|
485
|
+
} catch (e) {
|
|
486
|
+
// noop
|
|
487
|
+
}
|
|
458
488
|
await Promise.all([
|
|
459
489
|
this._setAvailabilities().then(async () => {
|
|
460
490
|
try {
|
|
461
491
|
const rawAvailabilities = await getRawAvailabilities(this.buildingId);
|
|
462
|
-
this.allowOccupiedUnitTours =
|
|
492
|
+
this.allowOccupiedUnitTours =
|
|
493
|
+
!!rawAvailabilities.allowOccupiedUnitTours;
|
|
463
494
|
} catch (e) {
|
|
464
495
|
this.allowOccupiedUnitTours = false;
|
|
465
496
|
}
|
|
@@ -468,6 +499,105 @@ export class TourScheduler extends LitElement {
|
|
|
468
499
|
]);
|
|
469
500
|
};
|
|
470
501
|
|
|
502
|
+
private _fetchCentralConvoBuildings = async (): Promise<void> => {
|
|
503
|
+
if (!this.orgSlug || !this.buildingSlug) return;
|
|
504
|
+
try {
|
|
505
|
+
const res = await fetchCentralConvoBuildings(
|
|
506
|
+
this.orgSlug,
|
|
507
|
+
this.buildingSlug
|
|
508
|
+
);
|
|
509
|
+
this.centralConvoBuildings = res.buildings;
|
|
510
|
+
this.isGeneralBuilding = res.is_general_building;
|
|
511
|
+
} catch (e) {
|
|
512
|
+
this.centralConvoBuildings = [];
|
|
513
|
+
this.isGeneralBuilding = false;
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
private _onBuildingChange = async (): Promise<void> => {
|
|
518
|
+
const slug = this.selectedBuildingEl?.value;
|
|
519
|
+
if (!slug || slug === this.buildingSlug) return;
|
|
520
|
+
const building = this.centralConvoBuildings.find((b) => b.slug === slug);
|
|
521
|
+
if (!building) return;
|
|
522
|
+
|
|
523
|
+
this.isGeneralBuilding = false;
|
|
524
|
+
this.waitingForAvailabilities = true;
|
|
525
|
+
this.errorGettingAvailabilities = false;
|
|
526
|
+
this.tourType = null;
|
|
527
|
+
this.selectedDate = undefined;
|
|
528
|
+
this.selectedTime = undefined;
|
|
529
|
+
this.availabilitiesGroupedByDay = {};
|
|
530
|
+
this.mobilePageIndex = 0;
|
|
531
|
+
this.units = [];
|
|
532
|
+
this.selectedLayoutValue = "";
|
|
533
|
+
this.selectedUnitValue = "";
|
|
534
|
+
|
|
535
|
+
this.buildingId = building.building_id;
|
|
536
|
+
this.buildingSlug = building.slug;
|
|
537
|
+
this.buildingName = building.name;
|
|
538
|
+
this.statusMessage = `Loading tours for ${building.name}…`;
|
|
539
|
+
|
|
540
|
+
pushGtmEvent("tourBuildingSelected", {
|
|
541
|
+
buildingId: building.building_id,
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
try {
|
|
545
|
+
const view = await fetchBuildingWebchatView(this.orgSlug, building.slug);
|
|
546
|
+
this.sgtUrl = view.sgtUrl;
|
|
547
|
+
this.selfGuidedToursTypeOffered = view.selfGuidedToursTypeOffered;
|
|
548
|
+
this.selfGuidedTourEnabled = view.isSelfGuidedTourEnabled;
|
|
549
|
+
this.escortedToursLink = view.escortedToursLink;
|
|
550
|
+
this.escortedToursTypeOffered = view.escortedToursTypeOffered;
|
|
551
|
+
this.virtualToursLink = view.virtualToursLink;
|
|
552
|
+
this.virtualToursTypeOffered = view.virtualToursTypeOffered;
|
|
553
|
+
this.tourTypeOptions = view.tourTypeOptions.map((o) => ({
|
|
554
|
+
label: o.label,
|
|
555
|
+
value: o.value,
|
|
556
|
+
}));
|
|
557
|
+
this.hasDynamicSchedulingEnabled = view.usesDynamicScheduling;
|
|
558
|
+
} catch (e) {
|
|
559
|
+
// eslint-disable-next-line no-console
|
|
560
|
+
console.error("Failed to load building config for selection", e);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
await this._loadForCurrentBuilding();
|
|
564
|
+
|
|
565
|
+
if (!this.shouldAllowScheduling || this.errorGettingAvailabilities) {
|
|
566
|
+
this.statusMessage = `No tour availabilities for ${building.name}.`;
|
|
567
|
+
} else {
|
|
568
|
+
const count = Object.values(this.shouldShowTourType).filter(
|
|
569
|
+
Boolean
|
|
570
|
+
).length;
|
|
571
|
+
this.statusMessage = `Showing tours for ${
|
|
572
|
+
building.name
|
|
573
|
+
}. ${count} tour type${count === 1 ? "" : "s"} available.`;
|
|
574
|
+
}
|
|
575
|
+
};
|
|
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
|
+
|
|
591
|
+
buildingSelector(): TemplateResult | string {
|
|
592
|
+
if (this.isGeneralBuilding) {
|
|
593
|
+
if (this.centralConvoBuildings.length === 0) return "";
|
|
594
|
+
} else if (this.centralConvoBuildings.length <= 1) {
|
|
595
|
+
return "";
|
|
596
|
+
}
|
|
597
|
+
return html`<h2 class="journey-header">Building</h2>
|
|
598
|
+
${this.buildingSelectMenu()}`;
|
|
599
|
+
}
|
|
600
|
+
|
|
471
601
|
protected willUpdate = async (
|
|
472
602
|
_changedProperties:
|
|
473
603
|
| PropertyValueMap<{ tourType: TourType }>
|
|
@@ -831,7 +961,8 @@ export class TourScheduler extends LitElement {
|
|
|
831
961
|
static styles = [tourSchedulerStyles, InputStyles];
|
|
832
962
|
|
|
833
963
|
tourTypeMenu(): TemplateResult {
|
|
834
|
-
return html
|
|
964
|
+
return html`${this.buildingSelector()}
|
|
965
|
+
<h2 id="tour-type-heading" class="journey-header">Tour Type</h2>
|
|
835
966
|
<div
|
|
836
967
|
id="tour-type-menu"
|
|
837
968
|
role="radiogroup"
|
|
@@ -1460,26 +1591,50 @@ export class TourScheduler extends LitElement {
|
|
|
1460
1591
|
}
|
|
1461
1592
|
|
|
1462
1593
|
render(): TemplateResult {
|
|
1594
|
+
return html`
|
|
1595
|
+
<div class="sr-only" role="status" aria-live="polite">
|
|
1596
|
+
${this.statusMessage}
|
|
1597
|
+
</div>
|
|
1598
|
+
${this.renderBody()}
|
|
1599
|
+
`;
|
|
1600
|
+
}
|
|
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
|
+
|
|
1619
|
+
private renderBody(): TemplateResult {
|
|
1463
1620
|
const isLoading =
|
|
1464
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
|
+
}
|
|
1465
1633
|
if (!this.shouldAllowScheduling && !isLoading) {
|
|
1466
|
-
return html`
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
"tour-scheduler-compact": this.compactDesign && !isMobile(),
|
|
1471
|
-
"tour-scheduler-mobile": isMobile(),
|
|
1472
|
-
})}"
|
|
1473
|
-
>
|
|
1474
|
-
<div id="top-header">
|
|
1475
|
-
<div></div>
|
|
1476
|
-
${this.closeButton()}
|
|
1477
|
-
</div>
|
|
1478
|
-
<div class="center-tour-not-avail">
|
|
1479
|
-
<h1>Sorry, there are currently no tour availabilities</h1>
|
|
1480
|
-
<p>Please check back again later</p>
|
|
1481
|
-
</div>
|
|
1482
|
-
</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
|
+
`);
|
|
1483
1638
|
}
|
|
1484
1639
|
if (isLoading) {
|
|
1485
1640
|
return html` <div
|
|
@@ -111,6 +111,17 @@ export const tourSchedulerStyles = css`
|
|
|
111
111
|
font-size: 14px;
|
|
112
112
|
font-weight: 600;
|
|
113
113
|
}
|
|
114
|
+
.sr-only {
|
|
115
|
+
position: absolute;
|
|
116
|
+
width: 1px;
|
|
117
|
+
height: 1px;
|
|
118
|
+
padding: 0;
|
|
119
|
+
margin: -1px;
|
|
120
|
+
overflow: hidden;
|
|
121
|
+
clip: rect(0, 0, 0, 0);
|
|
122
|
+
white-space: nowrap;
|
|
123
|
+
border: 0;
|
|
124
|
+
}
|
|
114
125
|
#close-button {
|
|
115
126
|
background: none;
|
|
116
127
|
border: none;
|
|
@@ -138,6 +149,11 @@ export const tourSchedulerStyles = css`
|
|
|
138
149
|
padding-bottom: 12px;
|
|
139
150
|
}
|
|
140
151
|
|
|
152
|
+
me-select#building {
|
|
153
|
+
display: block;
|
|
154
|
+
margin-bottom: 20px;
|
|
155
|
+
}
|
|
156
|
+
|
|
141
157
|
#tour-type-menu-outer-container {
|
|
142
158
|
width: 220px;
|
|
143
159
|
}
|
|
@@ -425,6 +441,10 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
425
441
|
font-size: 14px;
|
|
426
442
|
text-align: left;
|
|
427
443
|
}
|
|
444
|
+
.general-building-select {
|
|
445
|
+
width: 100%;
|
|
446
|
+
margin-top: 16px;
|
|
447
|
+
}
|
|
428
448
|
.loading-entire-tour-icon {
|
|
429
449
|
padding: 24px;
|
|
430
450
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
|
|
3
|
+
export interface CentralConvoBuilding {
|
|
4
|
+
building_id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface CentralConvoBuildingsResponse {
|
|
10
|
+
is_general_building: boolean;
|
|
11
|
+
buildings: CentralConvoBuilding[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Fetch the buildings that belong to the same central conversation group as the
|
|
16
|
+
* current building.
|
|
17
|
+
*
|
|
18
|
+
* @param orgSlug - The org slug, e.g. "big-prop-co"
|
|
19
|
+
* @param buildingSlug - The current building's slug, e.g. "gravity-falls"
|
|
20
|
+
*/
|
|
21
|
+
export default async function fetchCentralConvoBuildings(
|
|
22
|
+
orgSlug: string,
|
|
23
|
+
buildingSlug: string
|
|
24
|
+
): Promise<CentralConvoBuildingsResponse> {
|
|
25
|
+
const host = "https://app.meetelise.com";
|
|
26
|
+
const url = `${host}/platformApi/webchat/central-convo-buildings-v2`;
|
|
27
|
+
|
|
28
|
+
const response = await axios.get<CentralConvoBuildingsResponse>(url, {
|
|
29
|
+
headers: {
|
|
30
|
+
["building-slug"]: buildingSlug,
|
|
31
|
+
["org-slug"]: orgSlug,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const data = response.data;
|
|
36
|
+
return {
|
|
37
|
+
is_general_building: data?.is_general_building ?? false,
|
|
38
|
+
buildings: data?.buildings ?? [],
|
|
39
|
+
};
|
|
40
|
+
}
|