@meetelise/chat 1.40.3 → 1.41.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.
@@ -6,6 +6,7 @@ export declare class FeeItemComponent extends LitElement {
6
6
  get name(): string;
7
7
  get isRequired(): boolean;
8
8
  get description(): string;
9
+ get amount(): string | null;
9
10
  render(): TemplateResult;
10
11
  }
11
12
  declare global {
@@ -58,7 +58,7 @@ export declare class TourScheduler extends LitElement {
58
58
  leadSourceInputValue: string;
59
59
  errorGettingAvailabilities: boolean;
60
60
  _setAvailabilities: () => Promise<void>;
61
- _getHighestRankedTourType: (availabilities: TourAvailabilityResponse) => TourAvailabilityResponseRankOrderedSupportedTourTypesEnum;
61
+ _getHighestRankedTourType: (availabilities: TourAvailabilityResponse) => TourAvailabilityResponseRankOrderedSupportedTourTypesEnum | null;
62
62
  _getTourTypeOffered: (tourType: TourType) => string | null;
63
63
  firstUpdated: () => Promise<void>;
64
64
  protected willUpdate: (_changedProperties: PropertyValueMap<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.40.3",
3
+ "version": "1.41.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/MeetElise/chat-ui#readme",
@@ -1179,7 +1179,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
1179
1179
  gap: 12px;
1180
1180
  align-items: center;
1181
1181
  }
1182
- `;class wn{constructor(e,t,i,n){this.org=e,this.building=t,this.chatId=i,this.incomingProcessedLeadSource=n,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:Cn(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const Cn=()=>{var e,t,i,n,o,r;try{const n=new URL(window.location.href).searchParams,o=null!==(i=null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&void 0!==i?i:null,r=n.get("switch_cls[id]"),a=n.get("ilm");return{entrataCampaignSource:r,realpageCampaignSource:a,utmCampaignSource:n.get("utm_source"),yardiCampaignSource:o,bozzutoAdSource:yi("bozzuto_ad_source")}}catch(e){console.warn(`Couldnt get campaign sources from url, error: ${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 i=t.contentWindow.URL;if(!i)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const a=new i(window.location.href).searchParams,s=null!==(r=null===(o=null===(n=window.RCTPCampaign)||void 0===n?void 0:n.CampaignDetails)||void 0===o?void 0:o.Source)&&void 0!==r?r:null;return{entrataCampaignSource:a.get("switch_cls[id]"),realpageCampaignSource:a.get("ilm"),utmCampaignSource:a.get("utm_source"),yardiCampaignSource:s,bozzutoAdSource:yi("bozzuto_ad_source")}}};var xn;!function(e){e.error="error",e.info="info",e.warn="warn"}(xn||(xn={}));const An=async({logType:e,buildingSlug:i,orgSlug:n,logTitle:o,logData:r})=>{await t().post("https://app.meetelise.com/platformApi/webchat/logging",{...r},{headers:{"Content-Type":"application/json","building-slug":null!=i?i:"","org-slug":null!=n?n:"","log-type":null!=e?e:xn.error,"log-title":o.toUpperCase().replace(/\s/g,"_")}})},Sn=async({params:e,sampleRate:i})=>{try{if(Math.random()>=i)return;await t().post("https://app.meetelise.com/platformApi/webchat/log/signal",{...e,website_origin:window.location.origin,website_search:window.location.search})}catch(e){console.warn(e)}};function kn(){return Tn()?function(){const e=window.location.search,t={};return e.split("?").slice(1).join("&").split("&").forEach((e=>{const[i,n]=e.split("=");i&&n&&(t[decodeURIComponent(i)]=decodeURIComponent(n))})),t}():function(){const e=new URLSearchParams(window.location.search),t=e.has("utm_content"),i=e.has("utm_source");if(t&&!i){const t=e.get("utm_content");e.delete("utm_content"),e.set("utm_source",t)}return Object.fromEntries(e)}()}const Tn=()=>(window.location.search.match(/\?/g)||[]).length>1;var En=i(8367),_n=i.n(En);function On(e){return"avb"===e?"AVB Company Website":"windsor"===e?"Windsorcommunities.com":"property-website"}const Pn=async(e,i=!1)=>{const n=`https://app.meetelise.com/eliseCrmApi/building/${e}/scheduling_status?observe_dynamic_scheduling=${i}`;try{return(await t().get(n)).data.is_enabled}catch(e){return!1}};var Nn,Mn,In;!function(e){e.EMOJI="emoji",e.PILLS="pills",e.MINIMIZED="minimized"}(Nn||(Nn={})),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"}(Mn||(Mn={})),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"}(In||(In={}));const Dn=(e,t)=>"self"===e?!["SCHEDULED_BY_ME_MANAGED_BY_ME","SCHEDULED_BY_ME_MANAGED_BY_CONCIERGE"].includes(t):"virtual"===e&&!["SCHEDULED_BY_ME_MANAGED_BY_CLIENT"].includes(t);async function Un(e,i){var n;const o=`https://app.meetelise.com/api/pub/v1/organization/${e}/building/${i}/v2`,r=(await t().get(o)).data;try{r.welcomeMessage=Ln(null!==(n=r.welcomeMessage)&&void 0!==n?n:"",r.userFirstName)}catch(e){console.error(e)}return r}const Ln=(e,t)=>e.replace(/elise/gi,t);var Rn=i(6420),Bn=i(5616);function jn(e,t,i){var n=function(e,t,i){if(i&&!i.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(i?[i.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}(e,i.timeZone,i.locale);return n.formatToParts?function(e,t){for(var i=e.formatToParts(t),n=i.length-1;n>=0;--n)if("timeZoneName"===i[n].type)return i[n].value}(n,t):function(e,t){var i=e.format(t).replace(/\u200E/g,""),n=/ [\w-+ ]+$/.exec(i);return n?n[0].substr(1):""}(n,t)}var Hn={year:0,month:1,day:2,hour:3,minute:4,second:5},Fn={};function $n(e,t,i,n,o,r,a){var s=new Date(0);return s.setUTCFullYear(e,t,i),s.setUTCHours(n,o,r,a),s}var zn=36e5,Qn={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Gn(e,t,i){var n,o,r;if(!e)return 0;if(n=Qn.timezoneZ.exec(e))return 0;if(n=Qn.timezoneHH.exec(e))return Wn(r=parseInt(n[1],10))?-r*zn:NaN;if(n=Qn.timezoneHHMM.exec(e)){r=parseInt(n[2],10);var a=parseInt(n[3],10);return Wn(r,a)?(o=Math.abs(r)*zn+6e4*a,"+"===n[1]?-o:o):NaN}if(function(e){if(Vn[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Vn[e]=!0,!0}catch(e){return!1}}(e)){t=new Date(t||Date.now());var s=i?t:function(e){return $n(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),l=qn(s,e),u=i?l:function(e,t,i){var n=e.getTime()-t,o=qn(new Date(n),i);if(t===o)return t;n-=o-t;var r=qn(new Date(n),i);return o===r?o:Math.max(o,r)}(t,l,e);return-u}return NaN}function qn(e,t){var i=function(e,t){var i=function(e){if(!Fn[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")),i="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;Fn[e]=i?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 Fn[e]}(t);return i.formatToParts?function(e,t){try{for(var i=e.formatToParts(t),n=[],o=0;o<i.length;o++){var r=Hn[i[o].type];r>=0&&(n[r]=parseInt(i[o].value,10))}return n}catch(e){if(e instanceof RangeError)return[NaN];throw e}}(i,e):function(e,t){var i=e.format(t),n=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(i);return[n[3],n[1],n[2],n[4],n[5],n[6]]}(i,e)}(e,t),n=$n(i[0],i[1]-1,i[2],i[3]%24,i[4],i[5],0).getTime(),o=e.getTime(),r=o%1e3;return n-(o-(r>=0?r:1e3+r))}function Wn(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var Vn={},Yn={X:function(e,t,i,n){var o=Kn(n.timeZone,e);if(0===o)return"Z";switch(t){case"X":return Jn(o);case"XXXX":case"XX":return Zn(o);default:return Zn(o,":")}},x:function(e,t,i,n){var o=Kn(n.timeZone,e);switch(t){case"x":return Jn(o);case"xxxx":case"xx":return Zn(o);default:return Zn(o,":")}},O:function(e,t,i,n){var o=Kn(n.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+function(e,t){var i=e>0?"-":"+",n=Math.abs(e),o=Math.floor(n/60),r=n%60;if(0===r)return i+String(o);return i+String(o)+":"+Xn(r,2)}(o);default:return"GMT"+Zn(o,":")}},z:function(e,t,i,n){switch(t){case"z":case"zz":case"zzz":return jn("short",e,n);default:return jn("long",e,n)}}};function Kn(e,t){var i=e?Gn(e,t,!0)/6e4:t.getTimezoneOffset();if(Number.isNaN(i))throw new RangeError("Invalid time zone specified: "+e);return i}function Xn(e,t){for(var i=e<0?"-":"",n=Math.abs(e).toString();n.length<t;)n="0"+n;return i+n}function Zn(e,t){var i=t||"",n=e>0?"-":"+",o=Math.abs(e);return n+Xn(Math.floor(o/60),2)+i+Xn(Math.floor(o%60),2)}function Jn(e,t){return e%60==0?(e>0?"-":"+")+Xn(Math.abs(e)/60,2):Zn(e,t)}const eo=Yn;var to=i(2084),io=i(3561),no=36e5,oo={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 ro(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 i=t||{},n=null==i.additionalDigits?2:to(i.additionalDigits);if(2!==n&&1!==n&&0!==n)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 o=ao(e),r=so(o.date,n),a=r.year,s=r.restDateString,l=lo(s,a);if(isNaN(l))return new Date(NaN);if(l){var u,c=l.getTime(),d=0;if(o.time&&(d=uo(o.time),isNaN(d)))return new Date(NaN);if(o.timeZone||i.timeZone){if(u=Gn(o.timeZone||i.timeZone,new Date(c+d)),isNaN(u))return new Date(NaN)}else u=io(new Date(c+d)),u=io(new Date(c+d+u));return new Date(c+d+u)}return new Date(NaN)}function ao(e){var t,i={},n=oo.dateTimePattern.exec(e);if(n?(i.date=n[1],t=n[3]):(n=oo.datePattern.exec(e))?(i.date=n[1],t=n[2]):(i.date=null,t=e),t){var o=oo.timeZone.exec(t);o?(i.time=t.replace(o[1],""),i.timeZone=o[1].trim()):i.time=t}return i}function so(e,t){var i,n=oo.YYY[t],o=oo.YYYYY[t];if(i=oo.YYYY.exec(e)||o.exec(e)){var r=i[1];return{year:parseInt(r,10),restDateString:e.slice(r.length)}}if(i=oo.YY.exec(e)||n.exec(e)){var a=i[1];return{year:100*parseInt(a,10),restDateString:e.slice(a.length)}}return{year:null}}function lo(e,t){if(null===t)return null;var i,n,o,r;if(0===e.length)return(n=new Date(0)).setUTCFullYear(t),n;if(i=oo.MM.exec(e))return n=new Date(0),go(t,o=parseInt(i[1],10)-1)?(n.setUTCFullYear(t,o),n):new Date(NaN);if(i=oo.DDD.exec(e)){n=new Date(0);var a=parseInt(i[1],10);return function(e,t){if(t<1)return!1;var i=fo(e);return!(i&&t>366)&&!(!i&&t>365)}(t,a)?(n.setUTCFullYear(t,0,a),n):new Date(NaN)}if(i=oo.MMDD.exec(e)){n=new Date(0),o=parseInt(i[1],10)-1;var s=parseInt(i[2],10);return go(t,o,s)?(n.setUTCFullYear(t,o,s),n):new Date(NaN)}if(i=oo.Www.exec(e))return mo(0,r=parseInt(i[1],10)-1)?co(t,r):new Date(NaN);if(i=oo.WwwD.exec(e)){r=parseInt(i[1],10)-1;var l=parseInt(i[2],10)-1;return mo(0,r,l)?co(t,r,l):new Date(NaN)}return null}function uo(e){var t,i,n;if(t=oo.HH.exec(e))return bo(i=parseFloat(t[1].replace(",",".")))?i%24*no:NaN;if(t=oo.HHMM.exec(e))return bo(i=parseInt(t[1],10),n=parseFloat(t[2].replace(",",".")))?i%24*no+6e4*n:NaN;if(t=oo.HHMMSS.exec(e)){i=parseInt(t[1],10),n=parseInt(t[2],10);var o=parseFloat(t[3].replace(",","."));return bo(i,n,o)?i%24*no+6e4*n+1e3*o:NaN}return null}function co(e,t,i){t=t||0,i=i||0;var n=new Date(0);n.setUTCFullYear(e,0,4);var o=7*t+i+1-(n.getUTCDay()||7);return n.setUTCDate(n.getUTCDate()+o),n}var ho=[31,28,31,30,31,30,31,31,30,31,30,31],po=[31,29,31,30,31,30,31,31,30,31,30,31];function fo(e){return e%400==0||e%4==0&&e%100!=0}function go(e,t,i){if(t<0||t>11)return!1;if(null!=i){if(i<1)return!1;var n=fo(e);if(n&&i>po[t])return!1;if(!n&&i>ho[t])return!1}return!0}function mo(e,t,i){return!(t<0||t>52||null!=i&&(i<0||i>6))}function bo(e,t,i){return!(null!=e&&(e<0||e>=25)||null!=t&&(t<0||t>=60)||null!=i&&(i<0||i>=60))}var vo=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function yo(e,t,i,n){var o=Rn(n);return o.timeZone=t,o.originalDate=e,function(e,t,i){var n=String(t),o=i||{},r=n.match(vo);if(r){var a=ro(o.originalDate||e,o);n=r.reduce((function(e,t){if("'"===t[0])return e;var i=e.indexOf(t),n="'"===e[i-1],r=e.replace(t,"'"+eo[t[0]](a,t,null,o)+"'");return n?r.substring(0,i-1)+r.substring(i+1):r}),n)}return Bn(e,n,o)}(function(e,t,i){var n=ro(e,void 0),o=Gn(t,n,!0),r=new Date(n.getTime()-o),a=new Date(0);return a.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),a.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),a}(e,t),i,o)}var wo=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let Co=class extends oe{constructor(){super(...arguments),this.tourTypeOptions=[],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.buildingName="",this.tourType=null,this.shouldShowTourType={[xo.Guided]:!0,[xo.Self]:!0,[xo.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=Ie,this.backgroundColor=De,this.foregroundColorOnPrimaryBackgroundColor="white",this.foregroundColorOnSecondaryBackgroundColor="black",this.firstNameInputValue="",this.lastNameInputValue="",this.leadSourceInputValue="",this.errorGettingAvailabilities=!1,this._setAvailabilities=async()=>{var e,t,i;try{const[n,o]=await Promise.all([Pn(this.buildingId,this.hasDynamicSchedulingEnabled),Yi()]);this.shouldAllowScheduling=n,this.shouldAllowScheduleLoading=!1,this.calendarTimeZone=await(async e=>{var t;return null!==(t=(await Wi(e)).calendarTimeZone)&&void 0!==t?t:Intl.DateTimeFormat().resolvedOptions().timeZone})(this.buildingId),An({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:o,logType:xn.info,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});const r=Object.values(o).every((e=>!1===e)),a=!this.sgtUrl&&!this.escortedToursLink&&!this.virtualToursLink;if(r&&a)return this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,void An({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:xn.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});this.shouldShowTourType={[xo.Guided]:this.tourTypeOptions.map((e=>e.value)).includes("WITH_AGENT")&&(o[xo.Guided]||!!this.escortedToursLink),[xo.Self]:this.tourTypeOptions.map((e=>e.value)).includes("SELF_GUIDED")&&(o[xo.Self]||!!this.sgtUrl),[xo.Virtual]:this.tourTypeOptions.map((e=>e.value)).includes("VIRTUAL_SHOWING")&&(o[xo.Virtual]||!!this.virtualToursLink)};const s=1===Object.values(this.shouldShowTourType).reduce(((e,t)=>!0===t?e+1:e),0),l=await Wi(this.buildingId),u=this._getHighestRankedTourType(l),c=u?null===(t=null===(e=l.availability)||void 0===e?void 0:e[u])||void 0===t?void 0:t.availableTourStartTimes:[],d=null==c?void 0:c[0];if(u&&d&&u!==Ti.Unknown&&u!==Ti.MediaTour&&(this.selectedDate=pi("string"==typeof d?Ni(d):d),this.tourType=So[u],this.selectedTime="string"==typeof d?Xi(d):{datetime:$t(i=d,"yyyy-MM-dd'T'HH:mm:ss"),offset:$t(i,"xxx")}),s&&(this.tourType=Object.keys(this.shouldShowTourType).find((e=>this.shouldShowTourType[e]))),null===this.tourType)return void(this.waitingForAvailabilities=!1);this.availabilitiesGroupedByDay=await Ki(Ao[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,An({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:xn.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this._getHighestRankedTourType=e=>{var t;const i=(null!==(t=e.rankOrderedSupportedTourTypes)&&void 0!==t?t:[]).map((t=>{var i,n;return{tourType:t,availabilities:null===(n=null===(i=e.availability)||void 0===i?void 0:i[t])||void 0===n?void 0:n.availableTourStartTimes}})).filter((e=>{if(e.tourType===Ti.Unknown||e.tourType===Ti.MediaTour)return!1;const t=So[e.tourType],i=this._getTourTypeOffered(t);return!!i&&!Dn(t,i)&&e.availabilities&&e.availabilities.length>0}));return i[0].tourType},this._getTourTypeOffered=e=>e===xo.Guided?this.escortedToursTypeOffered:e===xo.Self?this.selfGuidedToursTypeOffered:e===xo.Virtual?this.virtualToursTypeOffered:null,this.firstUpdated=async()=>{await this._setAvailabilities()},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Ki(Ao[this.tourType]))},this.handlePhoneKeydown=e=>{var t;if(!(e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&null!==e.target.selectionStart))return;const i=e.target.selectionStart;if(1!==e.key.length||Pe(e)){if("Backspace"===e.key){if(Pe(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,n=this.phoneNumber.slice(0,i).replace(/\D/g,""),o=this.phoneNumber.slice(i).replace(/\D/g,""),r=`${n.slice(0,-1)}${o}`;this.phoneNumber=Ee(r),this.phoneInput.value=this.phoneNumber;const a=i-(t-this.phoneNumber.length);return this.phoneInput.setSelectionRange(a,a),e.preventDefault(),void e.stopPropagation()}if(!["ArrowLeft","ArrowRight"].includes(e.key)||Pe(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,i).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,n=i-e>-1?i-e:0;this.phoneInput.setSelectionRange(n,n)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(i).split(/\d+/)[0].length||0)+1,t=i+e<this.phoneNumber.length?i+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,i)+e.key+this.phoneNumber.slice(i);this.phoneNumber=Ee(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 i=this.phoneInput.selectionStart,n=i?this.phoneInput.value.slice(i).replace(/\D/g,""):"";this.phoneNumber=Ee(this.phoneInput.value);let o=0,r=n.length;for(;r;)(null===(t=this.phoneNumber.at(o))||void 0===t?void 0:t.match(/\d/))&&r--,o++;const a=this.phoneInput.value.length-o+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,i;return(!!(null===(e=this.firstNameInput)||void 0===e?void 0:e.value)||!!(null===(t=this.lastNameInput)||void 0===t?void 0:t.value))&&(null===(i=this.emailInput)||void 0===i?void 0:i.value.includes("@"))&&!!this.phoneNumber&&14===this.phoneNumber.length&&wi(this.phoneNumber)}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),this.timeStringToHoursAndMinutes=e=>{const[t,i]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(i)]},this.submit=async()=>{var e,i,n,o,r,a,s,l,u,c,d,h,p,f,g,m;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const b=new URLSearchParams(window.location.search);let v=null;v=this.selectedLeadSource&&this.selectedLeadSource.value&&this.selectedLeadSource.value.length>0?this.selectedLeadSource.value:this.leadSourceInputValue&&this.leadSourceInputValue.length>0?this.leadSourceInputValue:this.currentLeadSource;const y=[...new Set(v?[v,"property-website"]:["property-website"])];this.firstNameInput&&(this.firstNameInputValue=this.firstNameInput.value),this.lastNameInput&&(this.lastNameInputValue=this.lastNameInput.value),this.leadSourceInputValue=v,cn("scheduleTourSubmitted",{email:this.email,phone:`+1${null===(e=this.phoneNumber.match(/\d/g))||void 0===e?void 0:e.join("")}`,firstName:null!==(n=null===(i=this.firstNameInput)||void 0===i?void 0:i.value)&&void 0!==n?n:this.firstNameInputValue,lastName:null!==(r=null===(o=this.lastNameInput)||void 0===o?void 0:o.value)&&void 0!==r?r:this.lastNameInputValue,tourType:ko[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:y.find((e=>"property-website"!==e))||null});const w={referrer:document.referrer,email_address:this.email,phone_number:`+1${null===(a=this.phoneNumber.match(/\d/g))||void 0===a?void 0:a.join("")}`,building_id:this.buildingId,first_name:null!==(l=null===(s=this.firstNameInput)||void 0===s?void 0:s.value)&&void 0!==l?l:this.firstNameInputValue,last_name:null!==(c=null===(u=this.lastNameInput)||void 0===u?void 0:u.value)&&void 0!==c?c:this.lastNameInputValue,tour_type:ko[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(v?[v,On(this.orgSlug)]:[On(this.orgSlug)])],query_params:Object.fromEntries(b.entries()),conversation_tracking_id:null===(d=this.leadSourceClient)||void 0===d?void 0:d.chatId};this.isSubmitting=!0;try{await t().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",w,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG","org-slug":this.orgSlug}}),null===(h=this.leadSourceClient)||void 0===h||h.checkAndHandleForLogLeadSource({webchatAction:"tour-scheduler",stateId:null}),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e,i=(null===(f=null===(p=t.response)||void 0===p?void 0:p.data)||void 0===f?void 0:f.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[$t(this.selectedDate,"yyyy-MM-dd")];e&&(this.availabilitiesGroupedByDay[$t(this.selectedDate,"yyyy-MM-dd")]=e.filter((e=>e!==this.selectedTime)))}}else{if(409===(null===(g=t.response)||void 0===g?void 0:g.status)&&!this.promptForReschedule&&"User already has a tour scheduled for this building"===i)return this.promptForReschedule=!0,this.isSubmitting=!1,void(this.tourIsBooked=!1);if(409===(null===(m=t.response)||void 0===m?void 0:m.status)&&!this.promptForReschedule)return this.isSubmitting=!1,this.tourIsBooked=!1,qi(),this.availabilitiesGroupedByDay=await Ki(Ao[this.tourType],this.buildingId),void alert("This timeslot is no longer available. Please select a different time.")}alert(i),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>R`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>R`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>R` <action-confirm-button
1182
+ `;class wn{constructor(e,t,i,n){this.org=e,this.building=t,this.chatId=i,this.incomingProcessedLeadSource=n,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:Cn(),incomingProcessedLeadSource:this.incomingProcessedLeadSource,webchatVersion:null!==(t="MISSING_ENV_VAR".npm_package_version)&&void 0!==t?t:"1.20.155"})})}}const Cn=()=>{var e,t,i,n,o,r;try{const n=new URL(window.location.href).searchParams,o=null!==(i=null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&void 0!==i?i:null,r=n.get("switch_cls[id]"),a=n.get("ilm");return{entrataCampaignSource:r,realpageCampaignSource:a,utmCampaignSource:n.get("utm_source"),yardiCampaignSource:o,bozzutoAdSource:yi("bozzuto_ad_source")}}catch(e){console.warn(`Couldnt get campaign sources from url, error: ${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 i=t.contentWindow.URL;if(!i)return{entrataCampaignSource:null,realpageCampaignSource:null,utmCampaignSource:null,yardiCampaignSource:null,bozzutoAdSource:null};const a=new i(window.location.href).searchParams,s=null!==(r=null===(o=null===(n=window.RCTPCampaign)||void 0===n?void 0:n.CampaignDetails)||void 0===o?void 0:o.Source)&&void 0!==r?r:null;return{entrataCampaignSource:a.get("switch_cls[id]"),realpageCampaignSource:a.get("ilm"),utmCampaignSource:a.get("utm_source"),yardiCampaignSource:s,bozzutoAdSource:yi("bozzuto_ad_source")}}};var xn;!function(e){e.error="error",e.info="info",e.warn="warn"}(xn||(xn={}));const An=async({logType:e,buildingSlug:i,orgSlug:n,logTitle:o,logData:r})=>{await t().post("https://app.meetelise.com/platformApi/webchat/logging",{...r},{headers:{"Content-Type":"application/json","building-slug":null!=i?i:"","org-slug":null!=n?n:"","log-type":null!=e?e:xn.error,"log-title":o.toUpperCase().replace(/\s/g,"_")}})},Sn=async({params:e,sampleRate:i})=>{try{if(Math.random()>=i)return;await t().post("https://app.meetelise.com/platformApi/webchat/log/signal",{...e,website_origin:window.location.origin,website_search:window.location.search})}catch(e){console.warn(e)}};function kn(){return Tn()?function(){const e=window.location.search,t={};return e.split("?").slice(1).join("&").split("&").forEach((e=>{const[i,n]=e.split("=");i&&n&&(t[decodeURIComponent(i)]=decodeURIComponent(n))})),t}():function(){const e=new URLSearchParams(window.location.search),t=e.has("utm_content"),i=e.has("utm_source");if(t&&!i){const t=e.get("utm_content");e.delete("utm_content"),e.set("utm_source",t)}return Object.fromEntries(e)}()}const Tn=()=>(window.location.search.match(/\?/g)||[]).length>1;var En=i(8367),_n=i.n(En);function On(e){return"avb"===e?"AVB Company Website":"windsor"===e?"Windsorcommunities.com":"property-website"}const Pn=async(e,i=!1)=>{const n=`https://app.meetelise.com/eliseCrmApi/building/${e}/scheduling_status?observe_dynamic_scheduling=${i}`;try{return(await t().get(n)).data.is_enabled}catch(e){return!1}};var Nn,Mn,In;!function(e){e.EMOJI="emoji",e.PILLS="pills",e.MINIMIZED="minimized"}(Nn||(Nn={})),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"}(Mn||(Mn={})),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"}(In||(In={}));const Dn=(e,t)=>"self"===e?!["SCHEDULED_BY_ME_MANAGED_BY_ME","SCHEDULED_BY_ME_MANAGED_BY_CONCIERGE","SCHEDULED_BY_ME_MANAGED_BY_CLIENT"].includes(t):"virtual"===e&&!["SCHEDULED_BY_ME_MANAGED_BY_CLIENT"].includes(t);async function Un(e,i){var n;const o=`https://app.meetelise.com/api/pub/v1/organization/${e}/building/${i}/v2`,r=(await t().get(o)).data;try{r.welcomeMessage=Ln(null!==(n=r.welcomeMessage)&&void 0!==n?n:"",r.userFirstName)}catch(e){console.error(e)}return r}const Ln=(e,t)=>e.replace(/elise/gi,t);var Rn=i(6420),Bn=i(5616);function jn(e,t,i){var n=function(e,t,i){if(i&&!i.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(i?[i.code,"en-US"]:void 0,{timeZone:t,timeZoneName:e})}(e,i.timeZone,i.locale);return n.formatToParts?function(e,t){for(var i=e.formatToParts(t),n=i.length-1;n>=0;--n)if("timeZoneName"===i[n].type)return i[n].value}(n,t):function(e,t){var i=e.format(t).replace(/\u200E/g,""),n=/ [\w-+ ]+$/.exec(i);return n?n[0].substr(1):""}(n,t)}var Hn={year:0,month:1,day:2,hour:3,minute:4,second:5},Fn={};function $n(e,t,i,n,o,r,a){var s=new Date(0);return s.setUTCFullYear(e,t,i),s.setUTCHours(n,o,r,a),s}var zn=36e5,Qn={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function Gn(e,t,i){var n,o,r;if(!e)return 0;if(n=Qn.timezoneZ.exec(e))return 0;if(n=Qn.timezoneHH.exec(e))return Wn(r=parseInt(n[1],10))?-r*zn:NaN;if(n=Qn.timezoneHHMM.exec(e)){r=parseInt(n[2],10);var a=parseInt(n[3],10);return Wn(r,a)?(o=Math.abs(r)*zn+6e4*a,"+"===n[1]?-o:o):NaN}if(function(e){if(Vn[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),Vn[e]=!0,!0}catch(e){return!1}}(e)){t=new Date(t||Date.now());var s=i?t:function(e){return $n(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),l=qn(s,e),u=i?l:function(e,t,i){var n=e.getTime()-t,o=qn(new Date(n),i);if(t===o)return t;n-=o-t;var r=qn(new Date(n),i);return o===r?o:Math.max(o,r)}(t,l,e);return-u}return NaN}function qn(e,t){var i=function(e,t){var i=function(e){if(!Fn[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")),i="06/25/2014, 00:00:00"===t||"‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00"===t;Fn[e]=i?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 Fn[e]}(t);return i.formatToParts?function(e,t){try{for(var i=e.formatToParts(t),n=[],o=0;o<i.length;o++){var r=Hn[i[o].type];r>=0&&(n[r]=parseInt(i[o].value,10))}return n}catch(e){if(e instanceof RangeError)return[NaN];throw e}}(i,e):function(e,t){var i=e.format(t),n=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(i);return[n[3],n[1],n[2],n[4],n[5],n[6]]}(i,e)}(e,t),n=$n(i[0],i[1]-1,i[2],i[3]%24,i[4],i[5],0).getTime(),o=e.getTime(),r=o%1e3;return n-(o-(r>=0?r:1e3+r))}function Wn(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var Vn={},Yn={X:function(e,t,i,n){var o=Kn(n.timeZone,e);if(0===o)return"Z";switch(t){case"X":return Jn(o);case"XXXX":case"XX":return Zn(o);default:return Zn(o,":")}},x:function(e,t,i,n){var o=Kn(n.timeZone,e);switch(t){case"x":return Jn(o);case"xxxx":case"xx":return Zn(o);default:return Zn(o,":")}},O:function(e,t,i,n){var o=Kn(n.timeZone,e);switch(t){case"O":case"OO":case"OOO":return"GMT"+function(e,t){var i=e>0?"-":"+",n=Math.abs(e),o=Math.floor(n/60),r=n%60;if(0===r)return i+String(o);return i+String(o)+":"+Xn(r,2)}(o);default:return"GMT"+Zn(o,":")}},z:function(e,t,i,n){switch(t){case"z":case"zz":case"zzz":return jn("short",e,n);default:return jn("long",e,n)}}};function Kn(e,t){var i=e?Gn(e,t,!0)/6e4:t.getTimezoneOffset();if(Number.isNaN(i))throw new RangeError("Invalid time zone specified: "+e);return i}function Xn(e,t){for(var i=e<0?"-":"",n=Math.abs(e).toString();n.length<t;)n="0"+n;return i+n}function Zn(e,t){var i=t||"",n=e>0?"-":"+",o=Math.abs(e);return n+Xn(Math.floor(o/60),2)+i+Xn(Math.floor(o%60),2)}function Jn(e,t){return e%60==0?(e>0?"-":"+")+Xn(Math.abs(e)/60,2):Zn(e,t)}const eo=Yn;var to=i(2084),io=i(3561),no=36e5,oo={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 ro(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 i=t||{},n=null==i.additionalDigits?2:to(i.additionalDigits);if(2!==n&&1!==n&&0!==n)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 o=ao(e),r=so(o.date,n),a=r.year,s=r.restDateString,l=lo(s,a);if(isNaN(l))return new Date(NaN);if(l){var u,c=l.getTime(),d=0;if(o.time&&(d=uo(o.time),isNaN(d)))return new Date(NaN);if(o.timeZone||i.timeZone){if(u=Gn(o.timeZone||i.timeZone,new Date(c+d)),isNaN(u))return new Date(NaN)}else u=io(new Date(c+d)),u=io(new Date(c+d+u));return new Date(c+d+u)}return new Date(NaN)}function ao(e){var t,i={},n=oo.dateTimePattern.exec(e);if(n?(i.date=n[1],t=n[3]):(n=oo.datePattern.exec(e))?(i.date=n[1],t=n[2]):(i.date=null,t=e),t){var o=oo.timeZone.exec(t);o?(i.time=t.replace(o[1],""),i.timeZone=o[1].trim()):i.time=t}return i}function so(e,t){var i,n=oo.YYY[t],o=oo.YYYYY[t];if(i=oo.YYYY.exec(e)||o.exec(e)){var r=i[1];return{year:parseInt(r,10),restDateString:e.slice(r.length)}}if(i=oo.YY.exec(e)||n.exec(e)){var a=i[1];return{year:100*parseInt(a,10),restDateString:e.slice(a.length)}}return{year:null}}function lo(e,t){if(null===t)return null;var i,n,o,r;if(0===e.length)return(n=new Date(0)).setUTCFullYear(t),n;if(i=oo.MM.exec(e))return n=new Date(0),go(t,o=parseInt(i[1],10)-1)?(n.setUTCFullYear(t,o),n):new Date(NaN);if(i=oo.DDD.exec(e)){n=new Date(0);var a=parseInt(i[1],10);return function(e,t){if(t<1)return!1;var i=fo(e);return!(i&&t>366)&&!(!i&&t>365)}(t,a)?(n.setUTCFullYear(t,0,a),n):new Date(NaN)}if(i=oo.MMDD.exec(e)){n=new Date(0),o=parseInt(i[1],10)-1;var s=parseInt(i[2],10);return go(t,o,s)?(n.setUTCFullYear(t,o,s),n):new Date(NaN)}if(i=oo.Www.exec(e))return mo(0,r=parseInt(i[1],10)-1)?co(t,r):new Date(NaN);if(i=oo.WwwD.exec(e)){r=parseInt(i[1],10)-1;var l=parseInt(i[2],10)-1;return mo(0,r,l)?co(t,r,l):new Date(NaN)}return null}function uo(e){var t,i,n;if(t=oo.HH.exec(e))return bo(i=parseFloat(t[1].replace(",",".")))?i%24*no:NaN;if(t=oo.HHMM.exec(e))return bo(i=parseInt(t[1],10),n=parseFloat(t[2].replace(",",".")))?i%24*no+6e4*n:NaN;if(t=oo.HHMMSS.exec(e)){i=parseInt(t[1],10),n=parseInt(t[2],10);var o=parseFloat(t[3].replace(",","."));return bo(i,n,o)?i%24*no+6e4*n+1e3*o:NaN}return null}function co(e,t,i){t=t||0,i=i||0;var n=new Date(0);n.setUTCFullYear(e,0,4);var o=7*t+i+1-(n.getUTCDay()||7);return n.setUTCDate(n.getUTCDate()+o),n}var ho=[31,28,31,30,31,30,31,31,30,31,30,31],po=[31,29,31,30,31,30,31,31,30,31,30,31];function fo(e){return e%400==0||e%4==0&&e%100!=0}function go(e,t,i){if(t<0||t>11)return!1;if(null!=i){if(i<1)return!1;var n=fo(e);if(n&&i>po[t])return!1;if(!n&&i>ho[t])return!1}return!0}function mo(e,t,i){return!(t<0||t>52||null!=i&&(i<0||i>6))}function bo(e,t,i){return!(null!=e&&(e<0||e>=25)||null!=t&&(t<0||t>=60)||null!=i&&(i<0||i>=60))}var vo=/([xXOz]+)|''|'(''|[^'])+('|$)/g;function yo(e,t,i,n){var o=Rn(n);return o.timeZone=t,o.originalDate=e,function(e,t,i){var n=String(t),o=i||{},r=n.match(vo);if(r){var a=ro(o.originalDate||e,o);n=r.reduce((function(e,t){if("'"===t[0])return e;var i=e.indexOf(t),n="'"===e[i-1],r=e.replace(t,"'"+eo[t[0]](a,t,null,o)+"'");return n?r.substring(0,i-1)+r.substring(i+1):r}),n)}return Bn(e,n,o)}(function(e,t,i){var n=ro(e,void 0),o=Gn(t,n,!0),r=new Date(n.getTime()-o),a=new Date(0);return a.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),a.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),a}(e,t),i,o)}var wo=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let Co=class extends oe{constructor(){super(...arguments),this.tourTypeOptions=[],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.buildingName="",this.tourType=null,this.shouldShowTourType={[xo.Guided]:!0,[xo.Self]:!0,[xo.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=Ie,this.backgroundColor=De,this.foregroundColorOnPrimaryBackgroundColor="white",this.foregroundColorOnSecondaryBackgroundColor="black",this.firstNameInputValue="",this.lastNameInputValue="",this.leadSourceInputValue="",this.errorGettingAvailabilities=!1,this._setAvailabilities=async()=>{var e,t,i;try{const[n,o]=await Promise.all([Pn(this.buildingId,this.hasDynamicSchedulingEnabled),Yi()]);this.shouldAllowScheduling=n,this.shouldAllowScheduleLoading=!1,this.calendarTimeZone=await(async e=>{var t;return null!==(t=(await Wi(e)).calendarTimeZone)&&void 0!==t?t:Intl.DateTimeFormat().resolvedOptions().timeZone})(this.buildingId),An({logTitle:"AVAILABILITIES_EXIST_FOR_TOUR_TYPE",logData:o,logType:xn.info,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});const r=Object.values(o).every((e=>!1===e)),a=!this.sgtUrl&&!this.escortedToursLink&&!this.virtualToursLink;if(r&&a)return this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,void An({logTitle:"NO_AVAILABILITIES_EXIST",logData:null,logType:xn.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug});this.shouldShowTourType={[xo.Guided]:this.tourTypeOptions.map((e=>e.value)).includes("WITH_AGENT")&&(o[xo.Guided]||!!this.escortedToursLink),[xo.Self]:this.tourTypeOptions.map((e=>e.value)).includes("SELF_GUIDED")&&(o[xo.Self]||!!this.sgtUrl),[xo.Virtual]:this.tourTypeOptions.map((e=>e.value)).includes("VIRTUAL_SHOWING")&&(o[xo.Virtual]||!!this.virtualToursLink)};const s=1===Object.values(this.shouldShowTourType).reduce(((e,t)=>!0===t?e+1:e),0),l=await Wi(this.buildingId),u=this._getHighestRankedTourType(l),c=u?null===(t=null===(e=l.availability)||void 0===e?void 0:e[u])||void 0===t?void 0:t.availableTourStartTimes:[],d=null==c?void 0:c[0];if(u&&d&&u!==Ti.Unknown&&u!==Ti.MediaTour&&(this.selectedDate=pi("string"==typeof d?Ni(d):d),this.tourType=So[u],this.selectedTime="string"==typeof d?Xi(d):{datetime:$t(i=d,"yyyy-MM-dd'T'HH:mm:ss"),offset:$t(i,"xxx")}),s&&(this.tourType=Object.keys(this.shouldShowTourType).find((e=>this.shouldShowTourType[e]))),null===this.tourType)return void(this.waitingForAvailabilities=!1);this.availabilitiesGroupedByDay=await Ki(Ao[this.tourType]),this.waitingForAvailabilities=!1}catch(e){this.errorGettingAvailabilities=!0,this.waitingForAvailabilities=!1,An({logTitle:"ERROR_LOADING_AVAILABILITIES",logData:{error:e},logType:xn.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this._getHighestRankedTourType=e=>{var t;const i=(null!==(t=e.rankOrderedSupportedTourTypes)&&void 0!==t?t:[]).map((t=>{var i,n;return{tourType:t,availabilities:null===(n=null===(i=e.availability)||void 0===i?void 0:i[t])||void 0===n?void 0:n.availableTourStartTimes}})).filter((e=>{if(e.tourType===Ti.Unknown||e.tourType===Ti.MediaTour)return!1;const t=So[e.tourType],i=this._getTourTypeOffered(t);return!!i&&!Dn(t,i)&&e.availabilities&&e.availabilities.length>0})),n=i[0];return n?n.tourType:null},this._getTourTypeOffered=e=>e===xo.Guided?this.escortedToursTypeOffered:e===xo.Self?this.selfGuidedToursTypeOffered:e===xo.Virtual?this.virtualToursTypeOffered:null,this.firstUpdated=async()=>{await this._setAvailabilities()},this.willUpdate=async e=>{e.has("tourType")&&this.tourType&&(this.availabilitiesGroupedByDay=await Ki(Ao[this.tourType]))},this.handlePhoneKeydown=e=>{var t;if(!(e instanceof KeyboardEvent&&e.target instanceof HTMLInputElement&&null!==e.target.selectionStart))return;const i=e.target.selectionStart;if(1!==e.key.length||Pe(e)){if("Backspace"===e.key){if(Pe(e))return;if(this.phoneInput.selectionEnd&&this.phoneInput.selectionStart&&this.phoneInput.selectionEnd-this.phoneInput.selectionStart>0)return;const t=this.phoneNumber.length,n=this.phoneNumber.slice(0,i).replace(/\D/g,""),o=this.phoneNumber.slice(i).replace(/\D/g,""),r=`${n.slice(0,-1)}${o}`;this.phoneNumber=Ee(r),this.phoneInput.value=this.phoneNumber;const a=i-(t-this.phoneNumber.length);return this.phoneInput.setSelectionRange(a,a),e.preventDefault(),void e.stopPropagation()}if(!["ArrowLeft","ArrowRight"].includes(e.key)||Pe(e)||e.shiftKey)return;if("ArrowLeft"===e.key){const e=((null===(t=this.phoneNumber.slice(0,i).split(/\d+/).at(-1))||void 0===t?void 0:t.length)||0)+1,n=i-e>-1?i-e:0;this.phoneInput.setSelectionRange(n,n)}if("ArrowRight"===e.key){const e=(this.phoneNumber.slice(i).split(/\d+/)[0].length||0)+1,t=i+e<this.phoneNumber.length?i+e:this.phoneNumber.length;this.phoneInput.setSelectionRange(t,t)}e.preventDefault(),e.stopPropagation()}else{e.preventDefault(),e.stopPropagation();const t=this.phoneNumber.slice(0,i)+e.key+this.phoneNumber.slice(i);this.phoneNumber=Ee(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 i=this.phoneInput.selectionStart,n=i?this.phoneInput.value.slice(i).replace(/\D/g,""):"";this.phoneNumber=Ee(this.phoneInput.value);let o=0,r=n.length;for(;r;)(null===(t=this.phoneNumber.at(o))||void 0===t?void 0:t.match(/\d/))&&r--,o++;const a=this.phoneInput.value.length-o+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,i;return(!!(null===(e=this.firstNameInput)||void 0===e?void 0:e.value)||!!(null===(t=this.lastNameInput)||void 0===t?void 0:t.value))&&(null===(i=this.emailInput)||void 0===i?void 0:i.value.includes("@"))&&!!this.phoneNumber&&14===this.phoneNumber.length&&wi(this.phoneNumber)}},this.formIsValidForSubmission=()=>this.validators.tourType()&&this.validators.dateAndTime()&&this.validators.leadInfo(),this.timeStringToHoursAndMinutes=e=>{const[t,i]=e.split(/\D/g);return[parseInt(t)+(e.toLowerCase().includes("pm")?12:0),parseInt(i)]},this.submit=async()=>{var e,i,n,o,r,a,s,l,u,c,d,h,p,f,g,m;if(!this.selectedDate||!this.selectedTime||null===this.tourType)return;const b=new URLSearchParams(window.location.search);let v=null;v=this.selectedLeadSource&&this.selectedLeadSource.value&&this.selectedLeadSource.value.length>0?this.selectedLeadSource.value:this.leadSourceInputValue&&this.leadSourceInputValue.length>0?this.leadSourceInputValue:this.currentLeadSource;const y=[...new Set(v?[v,"property-website"]:["property-website"])];this.firstNameInput&&(this.firstNameInputValue=this.firstNameInput.value),this.lastNameInput&&(this.lastNameInputValue=this.lastNameInput.value),this.leadSourceInputValue=v,cn("scheduleTourSubmitted",{email:this.email,phone:`+1${null===(e=this.phoneNumber.match(/\d/g))||void 0===e?void 0:e.join("")}`,firstName:null!==(n=null===(i=this.firstNameInput)||void 0===i?void 0:i.value)&&void 0!==n?n:this.firstNameInputValue,lastName:null!==(r=null===(o=this.lastNameInput)||void 0===o?void 0:o.value)&&void 0!==r?r:this.lastNameInputValue,tourType:ko[this.tourType],tourTime:`${this.selectedTime.datetime}${this.selectedTime.offset}`,originatingSource:y.find((e=>"property-website"!==e))||null});const w={referrer:document.referrer,email_address:this.email,phone_number:`+1${null===(a=this.phoneNumber.match(/\d/g))||void 0===a?void 0:a.join("")}`,building_id:this.buildingId,first_name:null!==(l=null===(s=this.firstNameInput)||void 0===s?void 0:s.value)&&void 0!==l?l:this.firstNameInputValue,last_name:null!==(c=null===(u=this.lastNameInput)||void 0===u?void 0:u.value)&&void 0!==c?c:this.lastNameInputValue,tour_type:ko[this.tourType],tour_time:`${this.selectedTime.datetime}${this.selectedTime.offset}`,cancel_existing_tours:this.promptForReschedule,lead_sources:[...new Set(v?[v,On(this.orgSlug)]:[On(this.orgSlug)])],query_params:Object.fromEntries(b.entries()),conversation_tracking_id:null===(d=this.leadSourceClient)||void 0===d?void 0:d.chatId};this.isSubmitting=!0;try{await t().post("https://app.meetelise.com/platformApi/state/create/v2/scheduleMe",w,{headers:{"building-slug":this.buildingSlug,"X-SecurityKey":"JRL8jV4VcSCwOSir5gWkpgNLfKghmhBG","org-slug":this.orgSlug}}),null===(h=this.leadSourceClient)||void 0===h||h.checkAndHandleForLogLeadSource({webchatAction:"tour-scheduler",stateId:null}),this.isSubmitting=!1,this.tourIsBooked=!0}catch(e){const t=e,i=(null===(f=null===(p=t.response)||void 0===p?void 0:p.data)||void 0===f?void 0:f.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[$t(this.selectedDate,"yyyy-MM-dd")];e&&(this.availabilitiesGroupedByDay[$t(this.selectedDate,"yyyy-MM-dd")]=e.filter((e=>e!==this.selectedTime)))}}else{if(409===(null===(g=t.response)||void 0===g?void 0:g.status)&&!this.promptForReschedule&&"User already has a tour scheduled for this building"===i)return this.promptForReschedule=!0,this.isSubmitting=!1,void(this.tourIsBooked=!1);if(409===(null===(m=t.response)||void 0===m?void 0:m.status)&&!this.promptForReschedule)return this.isSubmitting=!1,this.tourIsBooked=!1,qi(),this.availabilitiesGroupedByDay=await Ki(Ao[this.tourType],this.buildingId),void alert("This timeslot is no longer available. Please select a different time.")}alert(i),this.isSubmitting=!1,this.tourIsBooked=!1}},this.mobilePages=[{validate:this.validators.tourType,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>R`${this.tourTypeMenu()}`},{validate:this.validators.dateAndTime,nextButtonText:"Next",nextButtonAction:()=>{this.mobilePageIndex++},render:()=>R`${this.dateAndTimeMenu()}`},{validate:()=>this.validators.leadInfo(),nextButtonText:null,renderNextButton:()=>R` <action-confirm-button
1183
1183
  id="schedule-bttn"
1184
1184
  .onClick=${this.submit}
1185
1185
  .isLoading=${this.isSubmitting}
@@ -3709,16 +3709,14 @@ xmlns="http://www.w3.org/2000/svg"
3709
3709
  font-size: 1rem;
3710
3710
  align-self: center;
3711
3711
  }
3712
- `;var br=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let vr=class extends oe{constructor(){super(...arguments),this.feeQuote=null}get name(){var e,t,i,n;return(null===(e=this.feeQuote)||void 0===e?void 0:e.sourceRentableItem)?this.feeQuote.sourceRentableItem.description:null!==(n=null===(i=null===(t=this.feeQuote)||void 0===t?void 0:t.sourceFee)||void 0===i?void 0:i.name)&&void 0!==n?n:""}get isRequired(){var e;return!!(null===(e=this.feeQuote)||void 0===e?void 0:e.sourceFee)&&"MANDATORY"===this.feeQuote.sourceFee.pricingMetadata.pricingCategory}get description(){var e,t,i,n;return(null===(e=this.feeQuote)||void 0===e?void 0:e.sourceRentableItem)?"":null!==(n=null===(i=null===(t=this.feeQuote)||void 0===t?void 0:t.sourceFee)||void 0===i?void 0:i.description)&&void 0!==n?n:""}render(){var e;return this.feeQuote?R`
3712
+ `;var br=function(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a};let vr=class extends oe{constructor(){super(...arguments),this.feeQuote=null}get name(){var e,t,i,n;return(null===(e=this.feeQuote)||void 0===e?void 0:e.sourceRentableItem)?this.feeQuote.sourceRentableItem.description:null!==(n=null===(i=null===(t=this.feeQuote)||void 0===t?void 0:t.sourceFee)||void 0===i?void 0:i.name)&&void 0!==n?n:""}get isRequired(){var e;return!!(null===(e=this.feeQuote)||void 0===e?void 0:e.sourceFee)&&"MANDATORY"===this.feeQuote.sourceFee.pricingMetadata.pricingCategory}get description(){var e,t,i,n;return(null===(e=this.feeQuote)||void 0===e?void 0:e.sourceRentableItem)?"":null!==(n=null===(i=null===(t=this.feeQuote)||void 0===t?void 0:t.sourceFee)||void 0===i?void 0:i.description)&&void 0!==n?n:""}get amount(){var e;if(!this.feeQuote)return null;const t=null!==(e=this.feeQuote.amountRange.fixedValue)&&void 0!==e?e:0;return 0===t?null:Ci(t)}render(){return this.feeQuote&&this.amount?R`
3713
3713
  <div class="fee-item">
3714
3714
  <div class="fee-info">
3715
3715
  ${this.isRequired?R`<div class="required-label">Required</div>`:""}
3716
3716
  <div class="fee-name">${this.name}</div>
3717
3717
  <div class="fee-description">${this.description}</div>
3718
3718
  </div>
3719
- <div class="fee-amount">
3720
- ${Ci(null!==(e=this.feeQuote.amountRange.fixedValue)&&void 0!==e?e:0)}
3721
- </div>
3719
+ <div class="fee-amount">${this.amount}</div>
3722
3720
  </div>
3723
3721
  `:R``}};vr.styles=mr,br([le({type:Object})],vr.prototype,"feeQuote",void 0),vr=br([ae("fee-item")],vr);const yr=l`
3724
3722
  .fee-card-section-container {
@@ -31,8 +31,16 @@ export class FeeItemComponent extends LitElement {
31
31
  return this.feeQuote?.sourceFee?.description ?? "";
32
32
  }
33
33
 
34
+ get amount(): string | null {
35
+ if (!this.feeQuote) return null;
36
+ const amt = this.feeQuote.amountRange.fixedValue ?? 0;
37
+ if (amt === 0) return null;
38
+ return formatCurrency(amt);
39
+ }
40
+
34
41
  render(): TemplateResult {
35
42
  if (!this.feeQuote) return html``;
43
+ if (!this.amount) return html``;
36
44
 
37
45
  return html`
38
46
  <div class="fee-item">
@@ -43,9 +51,7 @@ export class FeeItemComponent extends LitElement {
43
51
  <div class="fee-name">${this.name}</div>
44
52
  <div class="fee-description">${this.description}</div>
45
53
  </div>
46
- <div class="fee-amount">
47
- ${formatCurrency(this.feeQuote.amountRange.fixedValue ?? 0)}
48
- </div>
54
+ <div class="fee-amount">${this.amount}</div>
49
55
  </div>
50
56
  `;
51
57
  }
@@ -316,7 +316,7 @@ export class TourScheduler extends LitElement {
316
316
 
317
317
  _getHighestRankedTourType = (
318
318
  availabilities: TourAvailabilityResponse
319
- ): TourAvailabilityResponseRankOrderedSupportedTourTypesEnum => {
319
+ ): TourAvailabilityResponseRankOrderedSupportedTourTypesEnum | null => {
320
320
  const rankedTourTypeToAvailabilities = (
321
321
  availabilities.rankOrderedSupportedTourTypes ?? []
322
322
  )
@@ -350,6 +350,9 @@ export class TourScheduler extends LitElement {
350
350
  });
351
351
 
352
352
  const highestRankedTourType = rankedTourTypeToAvailabilities[0];
353
+ if (!highestRankedTourType) {
354
+ return null;
355
+ }
353
356
  return highestRankedTourType.tourType;
354
357
  };
355
358
 
@@ -36,6 +36,7 @@ export const shouldOpenTourLink = (
36
36
  const shouldntOpenTourTypesOffered = [
37
37
  "SCHEDULED_BY_ME_MANAGED_BY_ME",
38
38
  "SCHEDULED_BY_ME_MANAGED_BY_CONCIERGE",
39
+ "SCHEDULED_BY_ME_MANAGED_BY_CLIENT",
39
40
  ];
40
41
  return !shouldntOpenTourTypesOffered.includes(tourTypeOffered);
41
42
  }