@meetelise/chat 1.20.71 → 1.20.73

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetelise/chat",
3
- "version": "1.20.71",
3
+ "version": "1.20.73",
4
4
  "description": "",
5
5
  "main": "public/dist/index.js",
6
6
  "type": "module",
@@ -1148,7 +1148,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
1148
1148
  margin-top: 37px;
1149
1149
  }
1150
1150
  }
1151
- `,Zt],qn([de({attribute:!1})],Un.prototype,"layoutOptions",void 0),qn([de({attribute:!1})],Un.prototype,"unitOptions",void 0),qn([de({attribute:!1})],Un.prototype,"tourTypeOptions",void 0),qn([de({attribute:!0})],Un.prototype,"chatId",void 0),qn([de({type:Number})],Un.prototype,"buildingId",void 0),qn([de({attribute:!0})],Un.prototype,"buildingSlug",void 0),qn([de({attribute:!0})],Un.prototype,"sgtUrl",void 0),qn([de({attribute:!0})],Un.prototype,"escortedToursLink",void 0),qn([de({attribute:!0})],Un.prototype,"virtualToursLink",void 0),qn([de({attribute:!0})],Un.prototype,"orgSlug",void 0),qn([ce()],Un.prototype,"tourType",void 0),qn([ce()],Un.prototype,"shouldShowTourType",void 0),qn([ce()],Un.prototype,"email",void 0),qn([ce()],Un.prototype,"phoneNumber",void 0),qn([ce()],Un.prototype,"availabilitiesGroupedByDay",void 0),qn([ce()],Un.prototype,"waitingForAvailabilities",void 0),qn([ce()],Un.prototype,"selectedDate",void 0),qn([ce()],Un.prototype,"selectedTime",void 0),qn([ce()],Un.prototype,"mobilePageIndex",void 0),qn([ce()],Un.prototype,"isSubmitting",void 0),qn([ce()],Un.prototype,"tourIsBooked",void 0),qn([de({attribute:!1})],Un.prototype,"leadSources",void 0),qn([de({attribute:!0})],Un.prototype,"currentLeadSource",void 0),qn([de({attribute:!0})],Un.prototype,"featureFlagShowDropdown",void 0),qn([pe(".nameContainer#firstName input")],Un.prototype,"firstNameInput",void 0),qn([pe(".nameContainer#lastName input")],Un.prototype,"lastNameInput",void 0),qn([pe(".inputContainer#email input")],Un.prototype,"emailInput",void 0),qn([pe(".inputContainer#phone input")],Un.prototype,"phoneInput",void 0),qn([pe("me-select#unitType")],Un.prototype,"unitTypeSelect",void 0),qn([pe("me-select#layoutType")],Un.prototype,"layoutTypeSelect",void 0),qn([pe("me-select#leadSource")],Un.prototype,"selectedLeadSource",void 0),Un=qn([ue("tour-scheduler")],Un),function(e){e.Guided="guided",e.Self="self",e.Virtual="virtual"}(Bn||(Bn={}));const Jn={[Bn.Guided]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent,[Bn.Self]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided,[Bn.Virtual]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing},kn={[Bn.Guided]:"escorted-tour",[Bn.Self]:"self-guided-tour",[Bn.Virtual]:"live-virtual-tour"},Ln=e=>e.map((e=>(e=>({studio:0,"1br":1,"2br":2,"3br":3,"4br":4,"5br":5,"6br":6,"7br":7,"8br":8,"9br":9,"10br":10}[e]))(e))).filter(In.isNumber).sort().map((e=>(e=>({0:"studio",1:"1br",2:"2br",3:"3br",4:"4br",5:"5br",6:"6br",7:"7br",8:"8br",9:"9br",10:"10br"}[e]))(e))).filter(In.isString);class jn{constructor(e,t,n){this.org=e,this.building=t,this.chatId=n,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}ping(e){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:Hn()})})}}const Hn=()=>{var e,t,n;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;return{entrataCampaignSource:i.get("switch_cls[id]"),realpageCampaignSource:i.get("ilm"),utmCampaignSource:i.get("utm_source"),yardiCampaignSource:r}};var Gn,Wn=new Uint8Array(16);function Qn(){if(!Gn&&!(Gn="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Gn(Wn)}const zn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Vn=function(e){return"string"==typeof e&&zn.test(e)};for(var Xn=[],Yn=0;Yn<256;++Yn)Xn.push((Yn+256).toString(16).substr(1));const Kn=function(e,t,n){var i=(e=e||{}).random||(e.rng||Qn)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Xn[e[t+0]]+Xn[e[t+1]]+Xn[e[t+2]]+Xn[e[t+3]]+"-"+Xn[e[t+4]]+Xn[e[t+5]]+"-"+Xn[e[t+6]]+Xn[e[t+7]]+"-"+Xn[e[t+8]]+Xn[e[t+9]]+"-"+Xn[e[t+10]]+Xn[e[t+11]]+Xn[e[t+12]]+Xn[e[t+13]]+Xn[e[t+14]]+Xn[e[t+15]]).toLowerCase();if(!Vn(n))throw TypeError("Stringified UUID is invalid");return n}(i)};function Zn(e,t){const n=ei(e,t),i=Kn();return localStorage.setItem(n,i),$n(e,t),i}function $n(e,t){const n=ti(e,t),i=(new Date).toISOString();return localStorage.setItem(n,i),i}function ei(e,t){return`com.meetelise.chatID-${e}-${t}`}function ti(e,t){return`com.meetelise.chatIDIssueTime-${e}-${t}`}const ni="#FFFFFF",ii="#202020",ri="#636889",oi={user:{textColor:ni,backgroundColor:"#1990FF"},agent:{textColor:ni,backgroundColor:"#1E1E1E"}},ai={user:{textColor:ni,backgroundColor:"#83818E"},agent:{textColor:ni,backgroundColor:ii}},si={Light:{chatHeader:{backgroundColor:ni,textColor:ii},chatPaneBackgroundColor:"rgba(255, 255, 255, 0.9)",message:oi},Dark:{chatHeader:{backgroundColor:ii,textColor:ni},chatPaneBackgroundColor:"rgba(32, 32, 32, 0.9)",message:oi},Purple:{chatHeader:{backgroundColor:"#550098",textColor:ni},chatPaneBackgroundColor:"rgba(85, 0, 152, 0.6)",message:oi},Blue:{chatHeader:{backgroundColor:"#0814E5",textColor:ni},chatPaneBackgroundColor:"rgba(4, 17, 245, 0.6)",message:oi},Teal:{chatHeader:{backgroundColor:"#6EE7ED",textColor:ii},chatPaneBackgroundColor:"rgba(115, 247, 253, 0.8)",message:ai},Green:{chatHeader:{backgroundColor:"#147B0E",textColor:ni},chatPaneBackgroundColor:"rgba(13, 141, 5, 0.6)",message:oi},Yellow:{chatHeader:{backgroundColor:"#F1E54F",textColor:ii},chatPaneBackgroundColor:"rgba(251, 239, 80, 0.9)",message:ai},Orange:{chatHeader:{backgroundColor:"#C06C31",textColor:ni},chatPaneBackgroundColor:"rgba(238, 126, 49, 0.7)",message:oi},Pink:{chatHeader:{backgroundColor:"#A24599",textColor:ni},chatPaneBackgroundColor:"rgba(167, 70, 157, 0.8)",message:oi},Glass:{chatHeader:{backgroundColor:ni,textColor:ii},chatPaneBackgroundColor:"rgba(193, 193, 193, 0.5)",message:{user:{textColor:"#FFFFFF",backgroundColor:"#000000"},agent:{textColor:"#000000",backgroundColor:"#FFFFFF"}}}},ui=({themeId:e,brandColor:t})=>{const n=si[e&&Object.keys(si).includes(e)?e:"Light"];return t&&t!==ri&&(n.message.user.backgroundColor=t,n.chatHeader.backgroundColor=o(t,.6)),n};function li(e,t,n,i,r,o){var a;const s=new Re.User({id:`building_${t.id}`,name:t.userFirstName,email:null,role:"Default",welcomeMessage:t.welcomeMessage,availabilityText:t.systemWelcomeMessage}),u=e.getOrCreateConversation(r);return u.setParticipant(e.me),u.setParticipant(s),u.subject=16===t.orgId?"Leasing team":null!==(a=t.chatTitle)&&void 0!==a?a:t.userFirstName,u.custom={buildingId:t.id.toString(),userId:t.userId.toString(),orgId:t.orgId.toString(),subtitle:t.chatSubtitle,url:location.href,buildingName:t.name,isMobile:o.toString(),chatHeaderBackgroundColor:n.chatHeader.backgroundColor,chatHeaderTextColor:n.chatHeader.textColor,chatPaneBackgroundColor:n.chatPaneBackgroundColor,userMessageTextColor:n.message.user.textColor,userMessageBackgroundColor:n.message.user.backgroundColor,agentMessageTextColor:n.message.agent.textColor,agentMessageBackgroundColor:n.message.agent.backgroundColor,isLightTheme:(n.message===ai).toString(),avatarUrl:"image"===t.avatarType&&t.avatarSrc?i:"https://eliseusercontent.meetelise.com/webchat/looping-gradient.gif"},u}async function di(e,t){const n="https://app.meetelise.com",i=`${n}/api/pub/v1/organization/${e}/building/${t}`,r=await fetch(i),o=await r.json(),a=await fetch(`${n}/eliseCrmApi/pub/building/${t}/units`),s=await a.json(),u=await fetch(`${n}/eliseCrmApi/pub/building/${t}/layouts`),l=await u.json();return o.unitOptionsV2=s,o.layoutOptionsV2=l,o}async function ci(e){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/customization`);return n.data?{primaryColor:n.data.primaryColor,designConcept:n.data.designConcept,delayOpen:+n.data.delayOpen}:null}catch(e){return null}}var pi;async function fi(e){try{return(await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/ab-test-type`)).data}catch(e){return null}}async function hi(e,n){try{return(await t().post("https://app.meetelise.com/platformApi/webchat/current-parsed-lead-source",{query_params:Fn(),building_slug:e,referrer:n,campaign_sources:Hn()})).data}catch(e){return null}}!function(e){e.ConceptEmoji="Concept 2 (Blue/White)"}(pi||(pi={}));const mi=d`
1151
+ `,Zt],qn([de({attribute:!1})],Un.prototype,"layoutOptions",void 0),qn([de({attribute:!1})],Un.prototype,"unitOptions",void 0),qn([de({attribute:!1})],Un.prototype,"tourTypeOptions",void 0),qn([de({attribute:!0})],Un.prototype,"chatId",void 0),qn([de({type:Number})],Un.prototype,"buildingId",void 0),qn([de({attribute:!0})],Un.prototype,"buildingSlug",void 0),qn([de({attribute:!0})],Un.prototype,"sgtUrl",void 0),qn([de({attribute:!0})],Un.prototype,"escortedToursLink",void 0),qn([de({attribute:!0})],Un.prototype,"virtualToursLink",void 0),qn([de({attribute:!0})],Un.prototype,"orgSlug",void 0),qn([ce()],Un.prototype,"tourType",void 0),qn([ce()],Un.prototype,"shouldShowTourType",void 0),qn([ce()],Un.prototype,"email",void 0),qn([ce()],Un.prototype,"phoneNumber",void 0),qn([ce()],Un.prototype,"availabilitiesGroupedByDay",void 0),qn([ce()],Un.prototype,"waitingForAvailabilities",void 0),qn([ce()],Un.prototype,"selectedDate",void 0),qn([ce()],Un.prototype,"selectedTime",void 0),qn([ce()],Un.prototype,"mobilePageIndex",void 0),qn([ce()],Un.prototype,"isSubmitting",void 0),qn([ce()],Un.prototype,"tourIsBooked",void 0),qn([de({attribute:!1})],Un.prototype,"leadSources",void 0),qn([de({attribute:!0})],Un.prototype,"currentLeadSource",void 0),qn([de({attribute:!0})],Un.prototype,"featureFlagShowDropdown",void 0),qn([pe(".nameContainer#firstName input")],Un.prototype,"firstNameInput",void 0),qn([pe(".nameContainer#lastName input")],Un.prototype,"lastNameInput",void 0),qn([pe(".inputContainer#email input")],Un.prototype,"emailInput",void 0),qn([pe(".inputContainer#phone input")],Un.prototype,"phoneInput",void 0),qn([pe("me-select#unitType")],Un.prototype,"unitTypeSelect",void 0),qn([pe("me-select#layoutType")],Un.prototype,"layoutTypeSelect",void 0),qn([pe("me-select#leadSource")],Un.prototype,"selectedLeadSource",void 0),Un=qn([ue("tour-scheduler")],Un),function(e){e.Guided="guided",e.Self="self",e.Virtual="virtual"}(Bn||(Bn={}));const Jn={[Bn.Guided]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent,[Bn.Self]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided,[Bn.Virtual]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing},kn={[Bn.Guided]:"escorted-tour",[Bn.Self]:"self-guided-tour",[Bn.Virtual]:"live-virtual-tour"},Ln=e=>e.map((e=>(e=>({studio:0,"1br":1,"2br":2,"3br":3,"4br":4,"5br":5,"6br":6,"7br":7,"8br":8,"9br":9,"10br":10}[e]))(e))).filter(In.isNumber).sort().map((e=>(e=>({0:"studio",1:"1br",2:"2br",3:"3br",4:"4br",5:"5br",6:"6br",7:"7br",8:"8br",9:"9br",10:"10br"}[e]))(e))).filter(In.isString);class jn{constructor(e,t,n){this.org=e,this.building=t,this.chatId=n,this.featureFlags={}}setFeatureFlags(e){this.featureFlags={...this.featureFlags,...e}}ping(e){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:Hn()})})}}const Hn=()=>{var e,t,n;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;return{entrataCampaignSource:i.get("switch_cls[id]"),realpageCampaignSource:i.get("ilm"),utmCampaignSource:i.get("utm_source"),yardiCampaignSource:r}};var Gn,Wn=new Uint8Array(16);function Qn(){if(!Gn&&!(Gn="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Gn(Wn)}const zn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Vn=function(e){return"string"==typeof e&&zn.test(e)};for(var Xn=[],Yn=0;Yn<256;++Yn)Xn.push((Yn+256).toString(16).substr(1));const Kn=function(e,t,n){var i=(e=e||{}).random||(e.rng||Qn)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){n=n||0;for(var r=0;r<16;++r)t[n+r]=i[r];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Xn[e[t+0]]+Xn[e[t+1]]+Xn[e[t+2]]+Xn[e[t+3]]+"-"+Xn[e[t+4]]+Xn[e[t+5]]+"-"+Xn[e[t+6]]+Xn[e[t+7]]+"-"+Xn[e[t+8]]+Xn[e[t+9]]+"-"+Xn[e[t+10]]+Xn[e[t+11]]+Xn[e[t+12]]+Xn[e[t+13]]+Xn[e[t+14]]+Xn[e[t+15]]).toLowerCase();if(!Vn(n))throw TypeError("Stringified UUID is invalid");return n}(i)};function Zn(e,t){const n=ei(e,t),i=Kn();return localStorage.setItem(n,i),$n(e,t),i}function $n(e,t){const n=ti(e,t),i=(new Date).toISOString();return localStorage.setItem(n,i),i}function ei(e,t){return`com.meetelise.chatID-${e}-${t}`}function ti(e,t){return`com.meetelise.chatIDIssueTime-${e}-${t}`}const ni="#FFFFFF",ii="#202020",ri="#636889",oi={user:{textColor:ni,backgroundColor:"#1990FF"},agent:{textColor:ni,backgroundColor:"#1E1E1E"}},ai={user:{textColor:ni,backgroundColor:"#83818E"},agent:{textColor:ni,backgroundColor:ii}},si={Light:{chatHeader:{backgroundColor:ni,textColor:ii},chatPaneBackgroundColor:"rgba(255, 255, 255, 0.9)",message:oi},Dark:{chatHeader:{backgroundColor:ii,textColor:ni},chatPaneBackgroundColor:"rgba(32, 32, 32, 0.9)",message:oi},Purple:{chatHeader:{backgroundColor:"#550098",textColor:ni},chatPaneBackgroundColor:"rgba(85, 0, 152, 0.6)",message:oi},Blue:{chatHeader:{backgroundColor:"#0814E5",textColor:ni},chatPaneBackgroundColor:"rgba(4, 17, 245, 0.6)",message:oi},Teal:{chatHeader:{backgroundColor:"#6EE7ED",textColor:ii},chatPaneBackgroundColor:"rgba(115, 247, 253, 0.8)",message:ai},Green:{chatHeader:{backgroundColor:"#147B0E",textColor:ni},chatPaneBackgroundColor:"rgba(13, 141, 5, 0.6)",message:oi},Yellow:{chatHeader:{backgroundColor:"#F1E54F",textColor:ii},chatPaneBackgroundColor:"rgba(251, 239, 80, 0.9)",message:ai},Orange:{chatHeader:{backgroundColor:"#C06C31",textColor:ni},chatPaneBackgroundColor:"rgba(238, 126, 49, 0.7)",message:oi},Pink:{chatHeader:{backgroundColor:"#A24599",textColor:ni},chatPaneBackgroundColor:"rgba(167, 70, 157, 0.8)",message:oi},Glass:{chatHeader:{backgroundColor:ni,textColor:ii},chatPaneBackgroundColor:"rgba(193, 193, 193, 0.5)",message:{user:{textColor:"#FFFFFF",backgroundColor:"#000000"},agent:{textColor:"#000000",backgroundColor:"#FFFFFF"}}}},ui=({themeId:e,brandColor:t})=>{const n=si[e&&Object.keys(si).includes(e)?e:"Light"];return t&&t!==ri&&(n.message.user.backgroundColor=t,n.chatHeader.backgroundColor=o(t,.6)),n};function li(e,t,n,i,r,o){var a;const s=new Re.User({id:`building_${t.id}`,name:t.userFirstName,email:null,role:"Default",welcomeMessage:t.welcomeMessage,availabilityText:t.systemWelcomeMessage}),u=e.getOrCreateConversation(r);return u.setParticipant(e.me),u.setParticipant(s),u.subject=16===t.orgId?"Leasing team":null!==(a=t.chatTitle)&&void 0!==a?a:t.userFirstName,u.custom={buildingId:t.id.toString(),userId:t.userId.toString(),orgId:t.orgId.toString(),subtitle:t.chatSubtitle,url:location.href,buildingName:t.name,isMobile:o.toString(),chatHeaderBackgroundColor:n.chatHeader.backgroundColor,chatHeaderTextColor:n.chatHeader.textColor,chatPaneBackgroundColor:n.chatPaneBackgroundColor,userMessageTextColor:n.message.user.textColor,userMessageBackgroundColor:n.message.user.backgroundColor,agentMessageTextColor:n.message.agent.textColor,agentMessageBackgroundColor:n.message.agent.backgroundColor,isLightTheme:(n.message===ai).toString(),avatarUrl:"image"===t.avatarType&&t.avatarSrc?i:"https://eliseusercontent.meetelise.com/webchat/looping-gradient.gif"},u}async function di(e,t){const n="https://app.meetelise.com",i=`${n}/api/pub/v1/organization/${e}/building/${t}`,r=await fetch(i),o=await r.json(),a=await fetch(`${n}/eliseCrmApi/pub/building/${t}/units?showAvailableOnly=true`),s=await a.json(),u=await fetch(`${n}/eliseCrmApi/pub/building/${t}/layouts`),l=await u.json();return o.unitOptionsV2=s,o.layoutOptionsV2=l,o}async function ci(e){try{const n=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/customization`);return n.data?{primaryColor:n.data.primaryColor,designConcept:n.data.designConcept,delayOpen:+n.data.delayOpen}:null}catch(e){return null}}var pi;async function fi(e){try{return(await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/ab-test-type`)).data}catch(e){return null}}async function hi(e,n){try{return(await t().post("https://app.meetelise.com/platformApi/webchat/current-parsed-lead-source",{query_params:Fn(),building_slug:e,referrer:n,campaign_sources:Hn()})).data}catch(e){return null}}!function(e){e.ConceptEmoji="Concept 2 (Blue/White)"}(pi||(pi={}));const mi=d`
1152
1152
  * {
1153
1153
  font-family: "Helvetica Neue", Arial;
1154
1154
  font-size: 14px;
@@ -2956,4 +2956,4 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
2956
2956
  border-bottom: 22px solid transparent;
2957
2957
  border-right: 30px solid black;
2958
2958
  }
2959
- `,vr.session=Re.ready.then((()=>{const e=new Re.User({id:"anonymous",name:"Me",email:null,role:"Default"});return new Re.Session({appId:"ogKIvCor",me:e})})),mr([de({type:String})],vr.prototype,"buildingSlug",void 0),mr([de({type:String})],vr.prototype,"orgSlug",void 0),mr([de({type:String})],vr.prototype,"themeId",void 0),mr([de({attribute:!1})],vr.prototype,"avatarSrc",void 0),mr([de({type:Boolean})],vr.prototype,"useMiniWidget",void 0),mr([de({type:Object})],vr.prototype,"launcherStyles",void 0),mr([de({type:Boolean})],vr.prototype,"isMinimized",void 0),mr([de({type:String})],vr.prototype,"brandColor",void 0),mr([ce()],vr.prototype,"popup",void 0),mr([ce()],vr.prototype,"theme",void 0),mr([ce()],vr.prototype,"chatId",void 0),mr([ce()],vr.prototype,"analytics",void 0),mr([ce()],vr.prototype,"isMobile",void 0),mr([ce()],vr.prototype,"launcher",void 0),mr([ce()],vr.prototype,"building",void 0),mr([ce()],vr.prototype,"buildingABTestType",void 0),mr([ce()],vr.prototype,"leadSources",void 0),mr([ce()],vr.prototype,"currentLeadSource",void 0),mr([ce()],vr.prototype,"featureFlagShowDropdown",void 0),mr([ce()],vr.prototype,"phoneNumberForSource",void 0),mr([ce()],vr.prototype,"hasMounted",void 0),mr([ce()],vr.prototype,"hideLauncher",void 0),mr([ce()],vr.prototype,"isLoading",void 0),mr([ce()],vr.prototype,"talkjsPopupElement",void 0),vr=hr=mr([ue("me-chat")],vr);class gr{static start(e,t=!0){if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;t&&(this.orgSlug=e.organization,this.hasBuildingSlug=!!e.building),yr(),br();const n=document.createElement("me-chat");n.setAttribute("orgSlug",e.organization),this.handleBuildingslug(n,e.building),n.setAttribute("class","meetelise-chat"),n.setAttribute("role","dialog"),n.setAttribute("aria-label","EliseAI Widget"),n.setAttribute("aria-describedby","aria-describe-info"),n.setAttribute("aria-modal","true"),e.themeId&&n.setAttribute("themeId",e.themeId),e.avatarSrc&&n.setAttribute("avatarSrc",e.avatarSrc),void 0!==e.mini&&(n.useMiniWidget=e.mini),e.launcherStyles&&(n.launcherStyles=e.launcherStyles),e.brandColor&&(this.brandColor=e.brandColor,n.setAttribute("brandColor",((e,t)=>{const n=(r=e,{r:parseInt(r.substring(1,3),16),g:parseInt(r.substring(3,5),16),b:parseInt(r.substring(5,7),16)}),i={r:n.r+Math.round(.3*(0-n.r)),g:n.g+Math.round(.3*(0-n.g)),b:n.b+Math.round(.3*(0-n.b))};var r;return((e,t,n)=>"#"+[e,t,n].map((e=>{const t=e.toString(16);return 1===t.length?"0"+t:t})).join(""))(i.r,i.g,i.b)})(e.brandColor))),document.body.appendChild(n),gr.meChat=n,e.building&&e.organization&&wr(e.organization,e.building)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.meChat&&(await this.meChat.remove(),document.body.removeChild(this.meChat),gr.meChat=null)}static async handleBuildingslug(e,t){t?e.setAttribute("buildingSlug",t):this.mutationObserver||(this.handleSingleFamilyUrl(),this.previousUrl=window.location.href,document.body.addEventListener("click",(()=>{requestAnimationFrame((()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,this.handleSingleFamilyUrl())}))}),!0))}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,i=await t().get(n,{headers:{"org-slug":this.orgSlug}});if(!i||!i.data)return;const r={organization:this.orgSlug,building:i.data,brandColor:this.brandColor};this.start(r,!1)}}gr.meChat=null,gr.orgSlug="",gr.mutationObserver=null,gr.previousUrl="",gr.hasBuildingSlug=null,gr.brandColor="";const yr=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)},br=()=>{const e=document.createElement("meta");e.setAttribute("name","viewport"),e.setAttribute("content","width=device-width, initial-scale=1, maximum-scale=2"),document.head.appendChild(e)},wr=async(e,n)=>{var i;if("true"!==localStorage.getItem("overrideContactUsForm"))return;const r=await async function(e){try{return(await t().get(_n(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-use-override-contact-us-form",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(n);if(!r)return;const o=document.getElementById("myContactForm");let a;if(!(o&&o instanceof HTMLFormElement))return void(window.location.pathname.toLowerCase().includes("contactus")&&Sr(n,e,"Could not find form"));for(let e=0;e<o.elements.length;e++){const t=o.elements[e];if("button"===t.tagName.toLowerCase()&&"fakebutton"===t.getAttribute("data-selenium-id")){a=t;break}}if(!a)return Sr(n,e,"Could not find submit button");const s=()=>({firstName:document.getElementById("firstname"),lastName:document.getElementById("lastname"),email:document.getElementById("email"),phone:document.getElementById("phonenumber"),message:document.getElementById("message")});if(Object.values(s()).some((e=>null===e))){const t=Object.entries(s()).filter((([,e])=>null===e)).map((([e])=>e));return Sr(n,e,"Missing the following form elements: "+t.join(", "))}const u=a.cloneNode(!0);null===(i=a.parentNode)||void 0===i||i.replaceChild(u,a),u.textContent="Elise Submit",u.onclick=async function(t){if(!Object.values(s()).every((t=>null!==t&&(null===t.getAttribute("aria-invalid")&&Sr(n,e,"Missing aria-invalid attribute on "+t.id),"true"!==t.getAttribute("aria-invalid")))))return;t.preventDefault();const i={};Object.entries(s()).forEach((([e,t])=>i[e]=null==t?void 0:t.value));const r=await di(e,n),a=await hi(n,document.referrer);if(!r)return Sr(n,e,"Could not find building"),null;const l={email_address:i.email,first_name:i.firstName,last_name:i.lastName,phone_number:i.phone,first_message:i.message,building_id:r.id,is_external_form:!0,lead_sources:[...new Set(a?[a,"property-website"]:["property-website"])]},d=JSON.stringify(l);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":n,"org-slug":e},body:d}).then((e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return o.reset(),Object.values(s()).forEach((e=>{e&&(e.disabled=!0)})),u.textContent="Submitted",u.disabled=!0,e.json()}))}},Sr=(e,t,n)=>{const i=JSON.stringify({orgSlug:t,buildingSlug:e,reason:n});fetch("https://app.meetelise.com/platformApi/webchat/form-override-error",{method:"POST",headers:{"Content-Type":"application/json","building-slug":e,"org-slug":t},body:i})}})();var r=i.Z;export{r as default};
2959
+ `,vr.session=Re.ready.then((()=>{const e=new Re.User({id:"anonymous",name:"Me",email:null,role:"Default"});return new Re.Session({appId:"ogKIvCor",me:e})})),mr([de({type:String})],vr.prototype,"buildingSlug",void 0),mr([de({type:String})],vr.prototype,"orgSlug",void 0),mr([de({type:String})],vr.prototype,"themeId",void 0),mr([de({attribute:!1})],vr.prototype,"avatarSrc",void 0),mr([de({type:Boolean})],vr.prototype,"useMiniWidget",void 0),mr([de({type:Object})],vr.prototype,"launcherStyles",void 0),mr([de({type:Boolean})],vr.prototype,"isMinimized",void 0),mr([de({type:String})],vr.prototype,"brandColor",void 0),mr([ce()],vr.prototype,"popup",void 0),mr([ce()],vr.prototype,"theme",void 0),mr([ce()],vr.prototype,"chatId",void 0),mr([ce()],vr.prototype,"analytics",void 0),mr([ce()],vr.prototype,"isMobile",void 0),mr([ce()],vr.prototype,"launcher",void 0),mr([ce()],vr.prototype,"building",void 0),mr([ce()],vr.prototype,"buildingABTestType",void 0),mr([ce()],vr.prototype,"leadSources",void 0),mr([ce()],vr.prototype,"currentLeadSource",void 0),mr([ce()],vr.prototype,"featureFlagShowDropdown",void 0),mr([ce()],vr.prototype,"phoneNumberForSource",void 0),mr([ce()],vr.prototype,"hasMounted",void 0),mr([ce()],vr.prototype,"hideLauncher",void 0),mr([ce()],vr.prototype,"isLoading",void 0),mr([ce()],vr.prototype,"talkjsPopupElement",void 0),vr=hr=mr([ue("me-chat")],vr);class gr{static start(e,t=!0){if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;t&&(this.orgSlug=e.organization,this.hasBuildingSlug=!!e.building),yr(),br();const n=document.createElement("me-chat");n.setAttribute("orgSlug",e.organization),this.handleBuildingslug(n,e.building),n.setAttribute("class","meetelise-chat"),n.setAttribute("role","dialog"),n.setAttribute("aria-label","EliseAI Widget"),n.setAttribute("aria-describedby","aria-describe-info"),n.setAttribute("aria-modal","true"),e.themeId&&n.setAttribute("themeId",e.themeId),e.avatarSrc&&n.setAttribute("avatarSrc",e.avatarSrc),void 0!==e.mini&&(n.useMiniWidget=e.mini),e.launcherStyles&&(n.launcherStyles=e.launcherStyles),e.brandColor&&(this.brandColor=e.brandColor,n.setAttribute("brandColor",((e,t)=>{const n=(r=e,{r:parseInt(r.substring(1,3),16),g:parseInt(r.substring(3,5),16),b:parseInt(r.substring(5,7),16)}),i={r:n.r+Math.round(.3*(0-n.r)),g:n.g+Math.round(.3*(0-n.g)),b:n.b+Math.round(.3*(0-n.b))};var r;return((e,t,n)=>"#"+[e,t,n].map((e=>{const t=e.toString(16);return 1===t.length?"0"+t:t})).join(""))(i.r,i.g,i.b)})(e.brandColor))),document.body.appendChild(n),gr.meChat=n,e.building&&e.organization&&wr(e.organization,e.building)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.meChat&&(await this.meChat.remove(),document.body.removeChild(this.meChat),gr.meChat=null)}static async handleBuildingslug(e,t){t?e.setAttribute("buildingSlug",t):this.mutationObserver||(this.handleSingleFamilyUrl(),this.previousUrl=window.location.href,document.body.addEventListener("click",(()=>{requestAnimationFrame((()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,this.handleSingleFamilyUrl())}))}),!0))}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,i=await t().get(n,{headers:{"org-slug":this.orgSlug}});if(!i||!i.data)return;const r={organization:this.orgSlug,building:i.data,brandColor:this.brandColor};this.start(r,!1)}}gr.meChat=null,gr.orgSlug="",gr.mutationObserver=null,gr.previousUrl="",gr.hasBuildingSlug=null,gr.brandColor="";const yr=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)},br=()=>{const e=document.createElement("meta");e.setAttribute("name","viewport"),e.setAttribute("content","width=device-width, initial-scale=1, maximum-scale=2"),document.head.appendChild(e)},wr=async(e,n)=>{var i;const r=await async function(e){try{return(await t().get(_n(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-use-override-contact-us-form",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(n);if(!r)return;const o=document.getElementById("myContactForm");let a;if(!(o&&o instanceof HTMLFormElement))return void(window.location.pathname.toLowerCase().includes("contactus")&&Sr(n,e,"Could not find form"));for(let e=0;e<o.elements.length;e++){const t=o.elements[e];if("button"===t.tagName.toLowerCase()&&"fakebutton"===t.getAttribute("data-selenium-id")){a=t;break}}if(!a)return Sr(n,e,"Could not find submit button");const s=()=>({firstName:document.getElementById("firstname"),lastName:document.getElementById("lastname"),email:document.getElementById("email"),phone:document.getElementById("phonenumber"),message:document.getElementById("message")});if(Object.values(s()).some((e=>null===e))){const t=Object.entries(s()).filter((([,e])=>null===e)).map((([e])=>e));return Sr(n,e,"Missing the following form elements: "+t.join(", "))}const u=a.cloneNode(!0);null===(i=a.parentNode)||void 0===i||i.replaceChild(u,a),u.onclick=async function(t){if(!Object.values(s()).every((t=>null!==t&&(null===t.getAttribute("aria-invalid")&&Sr(n,e,"Missing aria-invalid attribute on "+t.id),"true"!==t.getAttribute("aria-invalid")))))return;t.preventDefault();const i={};Object.entries(s()).forEach((([e,t])=>i[e]=null==t?void 0:t.value));const r=await di(e,n),a=await hi(n,document.referrer);if(!r)return Sr(n,e,"Could not find building"),null;const l={email_address:i.email,first_name:i.firstName,last_name:i.lastName,phone_number:i.phone,first_message:i.message,building_id:r.id,is_external_form:!0,lead_sources:[...new Set(a?[a,"property-website"]:["property-website"])]},d=JSON.stringify(l);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":n,"org-slug":e},body:d}).then((e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return o.reset(),Object.values(s()).forEach((e=>{e&&(e.disabled=!0)})),u.textContent="Submitted",u.disabled=!0,e.json()}))}},Sr=(e,t,n)=>{const i=JSON.stringify({orgSlug:t,buildingSlug:e,reason:n});fetch("https://app.meetelise.com/platformApi/webchat/form-override-error",{method:"POST",headers:{"Content-Type":"application/json","building-slug":e,"org-slug":t},body:i})}})();var r=i.Z;export{r as default};
package/src/MEChat.ts CHANGED
@@ -183,8 +183,6 @@ const overrideContactUsForm = async (
183
183
  orgSlug: string,
184
184
  buildingSlug: string
185
185
  ): Promise<void> => {
186
- // TODO: Remove after testing in production
187
- if (localStorage.getItem("overrideContactUsForm") !== "true") return;
188
186
  const shouldUseOverrideContactUsForm =
189
187
  await fetchFeatureFlagUseOverrideContactUsForm(buildingSlug);
190
188
  if (!shouldUseOverrideContactUsForm) return;
@@ -280,9 +278,6 @@ const overrideContactUsForm = async (
280
278
  const clonedButton = btn.cloneNode(true) as HTMLButtonElement;
281
279
  btn.parentNode?.replaceChild(clonedButton, btn);
282
280
 
283
- // TODO: Remove after testing in production
284
- clonedButton.textContent = "Elise Submit";
285
-
286
281
  clonedButton.onclick = async function (event) {
287
282
  if (!isValid()) return;
288
283
  event.preventDefault();
@@ -56,7 +56,7 @@ export default async function fetchBuildingInfo(
56
56
  // HACK
57
57
  // We will fetch these units/layouts from elise-crm-api and supplement the DTO
58
58
  const unitsResponse = await fetch(
59
- `${host}/eliseCrmApi/pub/building/${buildingSlug}/units`
59
+ `${host}/eliseCrmApi/pub/building/${buildingSlug}/units?showAvailableOnly=true`
60
60
  );
61
61
  const units: UnitV2[] = await unitsResponse.json();
62
62
  const layoutsResponse = await fetch(