@meetelise/chat 1.20.87 → 1.20.89
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
package/public/demo/index.html
CHANGED
|
@@ -119,12 +119,12 @@
|
|
|
119
119
|
import MEChat from "/index.js";
|
|
120
120
|
MEChat.start({
|
|
121
121
|
// 123 Main Street
|
|
122
|
-
organization: "test-company",
|
|
123
|
-
building: "3fc93384-91f5-11ed-98a3-43f5a2f42588",
|
|
122
|
+
// organization: "test-company",
|
|
123
|
+
// building: "3fc93384-91f5-11ed-98a3-43f5a2f42588",
|
|
124
124
|
|
|
125
125
|
// Taylor Street Apartments
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
organization: "test-company",
|
|
127
|
+
building: "e2e-test-yardi-building",
|
|
128
128
|
|
|
129
129
|
// Cambridge House
|
|
130
130
|
// organization: "elise-ai",
|
package/public/dist/index.js
CHANGED
|
@@ -1182,7 +1182,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
1182
1182
|
margin-top: 37px;
|
|
1183
1183
|
}
|
|
1184
1184
|
}
|
|
1185
|
-
`,Zt],Qn([de({attribute:!1})],Wn.prototype,"layoutOptions",void 0),Qn([de({attribute:!1})],Wn.prototype,"unitOptions",void 0),Qn([de({attribute:!1})],Wn.prototype,"tourTypeOptions",void 0),Qn([de({attribute:!0})],Wn.prototype,"chatId",void 0),Qn([de({type:Number})],Wn.prototype,"buildingId",void 0),Qn([de({attribute:!0})],Wn.prototype,"buildingSlug",void 0),Qn([de({attribute:!0})],Wn.prototype,"sgtUrl",void 0),Qn([de({attribute:!0})],Wn.prototype,"escortedToursLink",void 0),Qn([de({attribute:!0})],Wn.prototype,"virtualToursLink",void 0),Qn([de({attribute:!0})],Wn.prototype,"orgSlug",void 0),Qn([de({attribute:!0})],Wn.prototype,"buildingName",void 0),Qn([ce()],Wn.prototype,"tourType",void 0),Qn([ce()],Wn.prototype,"shouldShowTourType",void 0),Qn([ce()],Wn.prototype,"email",void 0),Qn([ce()],Wn.prototype,"phoneNumber",void 0),Qn([ce()],Wn.prototype,"availabilitiesGroupedByDay",void 0),Qn([ce()],Wn.prototype,"waitingForAvailabilities",void 0),Qn([ce()],Wn.prototype,"selectedDate",void 0),Qn([ce()],Wn.prototype,"selectedTime",void 0),Qn([ce()],Wn.prototype,"mobilePageIndex",void 0),Qn([ce()],Wn.prototype,"isSubmitting",void 0),Qn([ce()],Wn.prototype,"tourIsBooked",void 0),Qn([de({attribute:!1})],Wn.prototype,"leadSources",void 0),Qn([de({attribute:!0})],Wn.prototype,"currentLeadSource",void 0),Qn([de({attribute:!0})],Wn.prototype,"featureFlagShowDropdown",void 0),Qn([pe(".nameContainer#firstName input")],Wn.prototype,"firstNameInput",void 0),Qn([pe(".nameContainer#lastName input")],Wn.prototype,"lastNameInput",void 0),Qn([pe(".inputContainer#email input")],Wn.prototype,"emailInput",void 0),Qn([pe(".inputContainer#phone input")],Wn.prototype,"phoneInput",void 0),Qn([pe("me-select#unitType")],Wn.prototype,"unitTypeSelect",void 0),Qn([pe("me-select#layoutType")],Wn.prototype,"layoutTypeSelect",void 0),Qn([pe("me-select#leadSource")],Wn.prototype,"selectedLeadSource",void 0),Wn=Qn([ue("tour-scheduler")],Wn),function(e){e.Guided="guided",e.Self="self",e.Virtual="virtual"}(Vn||(Vn={}));const Kn={[Vn.Guided]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent,[Vn.Self]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided,[Vn.Virtual]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing},Xn={[Vn.Guided]:"escorted-tour",[Vn.Self]:"self-guided-tour",[Vn.Virtual]:"live-virtual-tour"},Yn=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(Nn()).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(_n());class Zn{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:$n()})})}}const $n=()=>{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 ei,ti=new Uint8Array(16);function ni(){if(!ei&&!(ei="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 ei(ti)}const ii=/^(?:[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,ri=function(e){return"string"==typeof e&&ii.test(e)};for(var oi=[],ai=0;ai<256;++ai)oi.push((ai+256).toString(16).substr(1));const si=function(e,t,n){var i=(e=e||{}).random||(e.rng||ni)();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=(oi[e[t+0]]+oi[e[t+1]]+oi[e[t+2]]+oi[e[t+3]]+"-"+oi[e[t+4]]+oi[e[t+5]]+"-"+oi[e[t+6]]+oi[e[t+7]]+"-"+oi[e[t+8]]+oi[e[t+9]]+"-"+oi[e[t+10]]+oi[e[t+11]]+oi[e[t+12]]+oi[e[t+13]]+oi[e[t+14]]+oi[e[t+15]]).toLowerCase();if(!ri(n))throw TypeError("Stringified UUID is invalid");return n}(i)};function ui(e,t){const n=ci(e,t),i=localStorage.getItem(n);return i&&!function(e,t){const n=pi(e,t),i=localStorage.getItem(n)||di(e,t),r=new Date(new Date(i).getTime()+216e5);return new Date>r}(e,t)?i:li(e,t)}function li(e,t){const n=ci(e,t),i=si();return localStorage.setItem(n,i),di(e,t),i}function di(e,t){const n=pi(e,t),i=(new Date).toISOString();return localStorage.setItem(n,i),i}function ci(e,t){return`com.meetelise.chatID-${e}-${t}`}function pi(e,t){return`com.meetelise.chatIDIssueTime-${e}-${t}`}const hi="#FFFFFF",fi="#202020",mi="#636889",gi={user:{textColor:hi,backgroundColor:"#1990FF"},agent:{textColor:hi,backgroundColor:"#1E1E1E"}},vi={user:{textColor:hi,backgroundColor:"#83818E"},agent:{textColor:hi,backgroundColor:fi}},yi={Light:{chatHeader:{backgroundColor:hi,textColor:fi},chatPaneBackgroundColor:"rgba(255, 255, 255, 0.9)",message:gi},Dark:{chatHeader:{backgroundColor:fi,textColor:hi},chatPaneBackgroundColor:"rgba(32, 32, 32, 0.9)",message:gi},Purple:{chatHeader:{backgroundColor:"#550098",textColor:hi},chatPaneBackgroundColor:"rgba(85, 0, 152, 0.6)",message:gi},Blue:{chatHeader:{backgroundColor:"#0814E5",textColor:hi},chatPaneBackgroundColor:"rgba(4, 17, 245, 0.6)",message:gi},Teal:{chatHeader:{backgroundColor:"#6EE7ED",textColor:fi},chatPaneBackgroundColor:"rgba(115, 247, 253, 0.8)",message:vi},Green:{chatHeader:{backgroundColor:"#147B0E",textColor:hi},chatPaneBackgroundColor:"rgba(13, 141, 5, 0.6)",message:gi},Yellow:{chatHeader:{backgroundColor:"#F1E54F",textColor:fi},chatPaneBackgroundColor:"rgba(251, 239, 80, 0.9)",message:vi},Orange:{chatHeader:{backgroundColor:"#C06C31",textColor:hi},chatPaneBackgroundColor:"rgba(238, 126, 49, 0.7)",message:gi},Pink:{chatHeader:{backgroundColor:"#A24599",textColor:hi},chatPaneBackgroundColor:"rgba(167, 70, 157, 0.8)",message:gi},Glass:{chatHeader:{backgroundColor:hi,textColor:fi},chatPaneBackgroundColor:"rgba(193, 193, 193, 0.5)",message:{user:{textColor:"#FFFFFF",backgroundColor:"#000000"},agent:{textColor:"#000000",backgroundColor:"#FFFFFF"}}}},bi=({themeId:e,brandColor:t})=>{const n=yi[e&&Object.keys(yi).includes(e)?e:"Light"];return t&&t!==mi&&(n.message.user.backgroundColor=t,n.chatHeader.backgroundColor=o(t,.6)),n};function wi(e,t,n,i,r,o){var a;const s=new Ee.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===vi).toString(),avatarUrl:"image"===t.avatarType&&t.avatarSrc?i:"https://eliseusercontent.meetelise.com/webchat/looping-gradient.gif"},u}async function Si(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}var Ti,Ai;async function xi(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,autoMinimize:"true"===n.data.autoMinimize}:null}catch(e){return null}}async function Oi(e){try{return(await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/ab-test-type`)).data}catch(e){return null}}async function Ci(e,n){try{return(await t().post("https://app.meetelise.com/platformApi/webchat/current-parsed-lead-source",{query_params:kn(),building_slug:e,referrer:n,campaign_sources:$n()})).data}catch(e){return null}}!function(e){e.EMOJI="emoji",e.PILLS="pills",e.MINIMIZED="minimized"}(Ti||(Ti={})),function(e){e.ConceptEmoji="Concept 2 (Blue/White)"}(Ai||(Ai={}));const Ii=d`
|
|
1185
|
+
`,Zt],Qn([de({attribute:!1})],Wn.prototype,"layoutOptions",void 0),Qn([de({attribute:!1})],Wn.prototype,"unitOptions",void 0),Qn([de({attribute:!1})],Wn.prototype,"tourTypeOptions",void 0),Qn([de({attribute:!0})],Wn.prototype,"chatId",void 0),Qn([de({type:Number})],Wn.prototype,"buildingId",void 0),Qn([de({attribute:!0})],Wn.prototype,"buildingSlug",void 0),Qn([de({attribute:!0})],Wn.prototype,"sgtUrl",void 0),Qn([de({attribute:!0})],Wn.prototype,"escortedToursLink",void 0),Qn([de({attribute:!0})],Wn.prototype,"virtualToursLink",void 0),Qn([de({attribute:!0})],Wn.prototype,"orgSlug",void 0),Qn([de({attribute:!0})],Wn.prototype,"buildingName",void 0),Qn([ce()],Wn.prototype,"tourType",void 0),Qn([ce()],Wn.prototype,"shouldShowTourType",void 0),Qn([ce()],Wn.prototype,"email",void 0),Qn([ce()],Wn.prototype,"phoneNumber",void 0),Qn([ce()],Wn.prototype,"availabilitiesGroupedByDay",void 0),Qn([ce()],Wn.prototype,"waitingForAvailabilities",void 0),Qn([ce()],Wn.prototype,"selectedDate",void 0),Qn([ce()],Wn.prototype,"selectedTime",void 0),Qn([ce()],Wn.prototype,"mobilePageIndex",void 0),Qn([ce()],Wn.prototype,"isSubmitting",void 0),Qn([ce()],Wn.prototype,"tourIsBooked",void 0),Qn([de({attribute:!1})],Wn.prototype,"leadSources",void 0),Qn([de({attribute:!0})],Wn.prototype,"currentLeadSource",void 0),Qn([de({attribute:!0})],Wn.prototype,"featureFlagShowDropdown",void 0),Qn([pe(".nameContainer#firstName input")],Wn.prototype,"firstNameInput",void 0),Qn([pe(".nameContainer#lastName input")],Wn.prototype,"lastNameInput",void 0),Qn([pe(".inputContainer#email input")],Wn.prototype,"emailInput",void 0),Qn([pe(".inputContainer#phone input")],Wn.prototype,"phoneInput",void 0),Qn([pe("me-select#unitType")],Wn.prototype,"unitTypeSelect",void 0),Qn([pe("me-select#layoutType")],Wn.prototype,"layoutTypeSelect",void 0),Qn([pe("me-select#leadSource")],Wn.prototype,"selectedLeadSource",void 0),Wn=Qn([ue("tour-scheduler")],Wn),function(e){e.Guided="guided",e.Self="self",e.Virtual="virtual"}(Vn||(Vn={}));const Kn={[Vn.Guided]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.WithAgent,[Vn.Self]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.SelfGuided,[Vn.Virtual]:nn.TourAvailabilityResponseRankOrderedSupportedTourTypesEnum.VirtualShowing},Xn={[Vn.Guided]:"escorted-tour",[Vn.Self]:"self-guided-tour",[Vn.Virtual]:"live-virtual-tour"},Yn=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(Nn()).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(_n());class Zn{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){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:$n(),incomingProcessedLeadSource:this.incomingProcessedLeadSource})})}}const $n=()=>{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 ei,ti=new Uint8Array(16);function ni(){if(!ei&&!(ei="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 ei(ti)}const ii=/^(?:[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,ri=function(e){return"string"==typeof e&&ii.test(e)};for(var oi=[],ai=0;ai<256;++ai)oi.push((ai+256).toString(16).substr(1));const si=function(e,t,n){var i=(e=e||{}).random||(e.rng||ni)();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=(oi[e[t+0]]+oi[e[t+1]]+oi[e[t+2]]+oi[e[t+3]]+"-"+oi[e[t+4]]+oi[e[t+5]]+"-"+oi[e[t+6]]+oi[e[t+7]]+"-"+oi[e[t+8]]+oi[e[t+9]]+"-"+oi[e[t+10]]+oi[e[t+11]]+oi[e[t+12]]+oi[e[t+13]]+oi[e[t+14]]+oi[e[t+15]]).toLowerCase();if(!ri(n))throw TypeError("Stringified UUID is invalid");return n}(i)};function ui(e,t){const n=ci(e,t),i=localStorage.getItem(n);return i&&!function(e,t){const n=pi(e,t),i=localStorage.getItem(n)||di(e,t),r=new Date(new Date(i).getTime()+216e5);return new Date>r}(e,t)?i:li(e,t)}function li(e,t){const n=ci(e,t),i=si();return localStorage.setItem(n,i),di(e,t),i}function di(e,t){const n=pi(e,t),i=(new Date).toISOString();return localStorage.setItem(n,i),i}function ci(e,t){return`com.meetelise.chatID-${e}-${t}`}function pi(e,t){return`com.meetelise.chatIDIssueTime-${e}-${t}`}const hi="#FFFFFF",fi="#202020",mi="#636889",gi={user:{textColor:hi,backgroundColor:"#1990FF"},agent:{textColor:hi,backgroundColor:"#1E1E1E"}},vi={user:{textColor:hi,backgroundColor:"#83818E"},agent:{textColor:hi,backgroundColor:fi}},yi={Light:{chatHeader:{backgroundColor:hi,textColor:fi},chatPaneBackgroundColor:"rgba(255, 255, 255, 0.9)",message:gi},Dark:{chatHeader:{backgroundColor:fi,textColor:hi},chatPaneBackgroundColor:"rgba(32, 32, 32, 0.9)",message:gi},Purple:{chatHeader:{backgroundColor:"#550098",textColor:hi},chatPaneBackgroundColor:"rgba(85, 0, 152, 0.6)",message:gi},Blue:{chatHeader:{backgroundColor:"#0814E5",textColor:hi},chatPaneBackgroundColor:"rgba(4, 17, 245, 0.6)",message:gi},Teal:{chatHeader:{backgroundColor:"#6EE7ED",textColor:fi},chatPaneBackgroundColor:"rgba(115, 247, 253, 0.8)",message:vi},Green:{chatHeader:{backgroundColor:"#147B0E",textColor:hi},chatPaneBackgroundColor:"rgba(13, 141, 5, 0.6)",message:gi},Yellow:{chatHeader:{backgroundColor:"#F1E54F",textColor:fi},chatPaneBackgroundColor:"rgba(251, 239, 80, 0.9)",message:vi},Orange:{chatHeader:{backgroundColor:"#C06C31",textColor:hi},chatPaneBackgroundColor:"rgba(238, 126, 49, 0.7)",message:gi},Pink:{chatHeader:{backgroundColor:"#A24599",textColor:hi},chatPaneBackgroundColor:"rgba(167, 70, 157, 0.8)",message:gi},Glass:{chatHeader:{backgroundColor:hi,textColor:fi},chatPaneBackgroundColor:"rgba(193, 193, 193, 0.5)",message:{user:{textColor:"#FFFFFF",backgroundColor:"#000000"},agent:{textColor:"#000000",backgroundColor:"#FFFFFF"}}}},bi=({themeId:e,brandColor:t})=>{const n=yi[e&&Object.keys(yi).includes(e)?e:"Light"];return t&&t!==mi&&(n.message.user.backgroundColor=t,n.chatHeader.backgroundColor=o(t,.6)),n};function wi(e,t,n,i,r,o){var a;const s=new Ee.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===vi).toString(),avatarUrl:"image"===t.avatarType&&t.avatarSrc?i:"https://eliseusercontent.meetelise.com/webchat/looping-gradient.gif"},u}async function Si(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}var Ti,Ai;async function xi(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,autoMinimize:"true"===n.data.autoMinimize}:null}catch(e){return null}}async function Oi(e){try{return(await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/ab-test-type`)).data}catch(e){return null}}async function Ci(e,n){try{return(await t().post("https://app.meetelise.com/platformApi/webchat/current-parsed-lead-source",{query_params:kn(),building_slug:e,referrer:n,campaign_sources:$n()})).data}catch(e){return null}}!function(e){e.EMOJI="emoji",e.PILLS="pills",e.MINIMIZED="minimized"}(Ti||(Ti={})),function(e){e.ConceptEmoji="Concept 2 (Blue/White)"}(Ai||(Ai={}));const Ii=d`
|
|
1186
1186
|
* {
|
|
1187
1187
|
font-family: "Helvetica Neue", Arial;
|
|
1188
1188
|
font-size: 14px;
|
|
@@ -2967,6 +2967,12 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
2967
2967
|
.disclaimer-message {
|
|
2968
2968
|
font-size: 12px;
|
|
2969
2969
|
}
|
|
2970
|
+
.disclaimer-inner {
|
|
2971
|
+
margin: 0;
|
|
2972
|
+
}
|
|
2973
|
+
.disclaimer-inner > a {
|
|
2974
|
+
color: black;
|
|
2975
|
+
}
|
|
2970
2976
|
|
|
2971
2977
|
.message-container {
|
|
2972
2978
|
display: flex;
|
|
@@ -2996,6 +3002,9 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
2996
3002
|
line-height: 130%;
|
|
2997
3003
|
}
|
|
2998
3004
|
|
|
3005
|
+
#loading-message {
|
|
3006
|
+
padding: 16px;
|
|
3007
|
+
}
|
|
2999
3008
|
.loading-dot {
|
|
3000
3009
|
width: 6px;
|
|
3001
3010
|
height: 6px;
|
|
@@ -3084,9 +3093,17 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
3084
3093
|
<div id="conversation-body">
|
|
3085
3094
|
<ul id="message-thread-list">
|
|
3086
3095
|
<li class="message-container disclaimer-message">
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3096
|
+
<p class="disclaimer-inner">
|
|
3097
|
+
By interacting with this system, you consent to
|
|
3098
|
+
<a
|
|
3099
|
+
href="http://bit.ly/me_privacy_policy"
|
|
3100
|
+
target="_blank"
|
|
3101
|
+
rel="noopener noreferrer"
|
|
3102
|
+
>
|
|
3103
|
+
this privacy policy</a
|
|
3104
|
+
>, including being contacted by AI or a human & having your
|
|
3105
|
+
conversation recorded by a third party.
|
|
3106
|
+
</p>
|
|
3090
3107
|
</li>
|
|
3091
3108
|
${this.building.welcomeMessage?B` <li class="message-container ai-message">
|
|
3092
3109
|
<p class="message-text">${this.building.welcomeMessage}</p>
|
|
@@ -3125,7 +3142,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
3125
3142
|
</button>
|
|
3126
3143
|
</div>
|
|
3127
3144
|
</div>
|
|
3128
|
-
`:B``}};Fr.styles=[Pr],_r([de({attribute:!0})],Fr.prototype,"channel",void 0),_r([de({attribute:!0})],Fr.prototype,"myPubnub",void 0),_r([de({attribute:!0})],Fr.prototype,"buildingSlug",void 0),_r([de({attribute:!0})],Fr.prototype,"building",void 0),_r([de({attribute:!0})],Fr.prototype,"brandColor",void 0),_r([de({attribute:!0})],Fr.prototype,"onClickExit",void 0),_r([de({attribute:!0})],Fr.prototype,"onMount",void 0),_r([pe("#message-input",!0)],Fr.prototype,"messageInput",void 0),_r([pe("#conversation-body",!0)],Fr.prototype,"messageBody",void 0),_r([ce()],Fr.prototype,"messages",void 0),_r([ce()],Fr.prototype,"isMobile",void 0),_r([ce()],Fr.prototype,"isLoadingMessages",void 0),Fr=_r([ue("pubnub-chat")],Fr);var Mr,Dr,kr=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};!function(e){e.TALKJS="talkjs",e.PUBNUB="pubnub"}(Dr||(Dr={}));let Ur=Mr=class extends ae{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.themeId="Glass",this.useMiniWidget=!0,this.launcherStyles={},this.isMinimized=!1,this.brandColor=null,this.popup=null,this.theme=bi({themeId:this.themeId,brandColor:this.brandColor}),this.chatId="",this.analytics=null,this.isMobile=r(),this.launcher=null,this.building=null,this.buildingABTestType=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=qn.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.talkjsPopupElement=null,this.chatProvider=Dr.TALKJS,this.displayPubnubChat=!1,this.myPubnub=null,this.yardiDNIScriptInterval=null,this.launcherRef=Oe(),this.initializeInstanceVariables=async()=>{Mr.session=Ee.ready.then((()=>{const e=new Ee.User({id:"anonymous-"+ui(this.orgSlug,this.buildingSlug),name:"Me",email:null,role:"Default"});return new Ee.Session({appId:"ogKIvCor",me:e})})),await this.setBuildingDerivedInfo(),await this.initializeLaunchJS()&&(this.attachOnClickToLauncher(),this.isLoading=!1)},this.setBuildingDerivedInfo=async()=>{var e,n,i;if(!this.buildingSlug||!this.orgSlug)return;const[r,o,a,s,u,l,d]=await Promise.all([Si(this.orgSlug,this.buildingSlug),Oi(this.buildingSlug),xr(this.buildingSlug),Ci(this.buildingSlug,document.referrer),Bn(this.buildingSlug),Ln(this.buildingSlug),xi(this.buildingSlug)]);r.phoneNumber=Pe(r.phoneNumber),this.building=r,this.buildingABTestType=null!==(e=null==o?void 0:o.abTestType)&&void 0!==e?e:"",this.leadSources=a,this.currentLeadSource=s,this.featureFlagShowDropdown=u,d&&(null===this.brandColor&&(this.brandColor=null!==(n=d.primaryColor)&&void 0!==n?n:null),this.isMinimized=!!d.autoMinimize,d.designConcept&&(d.designConcept===Ti.MINIMIZED&&(this.isMobile=!0),d.designConcept===Ti.PILLS&&(this.buildingABTestType=null),d.designConcept===Ti.EMOJI&&(this.buildingABTestType=Ai.ConceptEmoji))),null===this.brandColor&&(this.brandColor=mi);let c=null;l&&(c=await async function(e,n){try{const i=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source?source=${n}`);return i.data?{number:Pe(i.data.number),isMatch:i.data.isMatch,isPropertyWebsiteCatchall:i.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,this.currentLeadSource)),this.phoneNumberForSource=c||{number:this.building.phoneNumber,isMatch:!1,isPropertyWebsiteCatchall:!0},this.currentLeadSource&&(this.leadSources.includes(this.currentLeadSource)||this.leadSources.push(this.currentLeadSource)),An(this.building.id),this.chatId=ui(this.orgSlug,this.buildingSlug),this.avatarSrc=this.avatarSrc||this.building.avatarSrc,this.theme=bi({themeId:null!==(i=this.themeId)&&void 0!==i?i:this.building.themeId,brandColor:this.brandColor}),this.analytics=new Zn(this.orgSlug,this.buildingSlug,this.chatId),this.analytics.ping("webchat_heartbeat")},this.initializeLaunchJS=async()=>{var e;if(!this.building||!this.theme)return;if(this.popup&&this.launcher)return;const[t,n,i,r]=await Promise.all([this.building,this.theme,this.avatarSrc,Mr.session]);return t.conversationMaintenanceMode?(console.warn("MeetElise Chat is in maintenance mode. Chat icon will not appear."),!1):r?(await this.configureTalkJSPopup(t,n,r,i),this.configureLauncherElement(),null===(e=this.analytics)||void 0===e||e.ping("load"),this.yardiDNIScriptInterval=setInterval((()=>this.pollForYardiCampaignSource()),1e3),setTimeout(clearInterval,15e3,this.yardiDNIScriptInterval),!0):void 0},this.configureLauncherElement=()=>{this.popup&&this.launcherRef.value&&(this.launcher=this.launcherRef.value)},this.configureTalkJSPopup=async(e,t,n,i)=>{var r;const o=n.createPopup(wi(n,e,t,i||e.avatarSrc,this.chatId,this.isMobile),{launcher:"never",showCloseInHeader:!0,messageField:{placeholder:"Ask a question..."}});await o.mount({show:!1}),o.on("close",(()=>{this.hideLauncher=!1}));const a=document.querySelector(".__talkjs_popup");if(this.talkjsPopupElement=a,!a)throw new Error("Failed to find chat window");a.classList.add("meetelise-chat","pane"),this.isMobile||a.classList.add("launcher__desktop"),a.style.zIndex="99999999999",this.popup=o,this.shouldAutoOpenChat(e.autoOpenChatWidget)&&(this.popup.show(),this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp(),null===(r=this.analytics)||void 0===r||r.ping("autoOpen"))},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!an(un(t)));return!!e&&!!n&&!r()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",tn(function(e,t){Ue(2,arguments);var n=et(t);return tt(e,6e4*n)}(new Date,15)))},this.firstUpdated=async()=>{await async function(e){try{return(await t().get(Un(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"use-pubnub-chat-provider",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(this.buildingSlug)?(this.chatProvider=Dr.PUBNUB,this.initializePubnubVariables()):this.initializeInstanceVariables()},this.initializePubnubVariables=async()=>{await this.setBuildingDerivedInfo(),this.building&&(this.myPubnub=new class{constructor(e,t){this.apiHost="https://app.meetelise.com",this.building=null,this.ttlHours=24,this.pubnub=null,this.leadUserId="",this.channel="",this.chatListener=null,this.messages=[],this.listenerParams={message:e=>{var t;this.messages=[...this.messages,{channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken}];const n="eliseai"!==e.publisher;null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.messages,isLoading:n}),this.isLoadingMessages=n}},this.isLoadingMessages=!1,this.handleChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams))},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub&&!await this.initializePubnub())return;await this.withAuthToken((async()=>{var t,n;this.pubnub&&this.channel&&await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(t=this.building)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,userId:null===(n=this.building)||void 0===n?void 0:n.userId}})})),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.createChatStorageKey=e=>{const t=tn(new Date),n=null!=e?e:`lead_${si()}_${this.buildingSlug}`;return localStorage.setItem("com.eliseai.webchat.slug="+this.buildingSlug,JSON.stringify({buildingSlug:this.buildingSlug,leadId:n,timestamp:t})),{leadId:n,timestamp:un(t),buildingSlug:this.buildingSlug}},this.getChatStorageKey=()=>{const e=localStorage.getItem("com.eliseai.webchat.slug="+this.buildingSlug);if(e)try{const t=JSON.parse(e),n=t.buildingSlug,i=t.leadId,r=new Date(t.timestamp);if(this.isChatKeyValid({leadId:i,timestamp:r,buildingSlug:n}))return{leadId:i,timestamp:r,buildingSlug:n}}catch(e){console.warn("Error getting chat storage key")}return this.createChatStorageKey()},this.isChatKeyValid=e=>{if(e.buildingSlug!==this.buildingSlug||!e.leadId||!e.timestamp)return!1;const t=Nr(new Date,this.ttlHours);return function(e,t){Ue(2,arguments);var n=qe(e),i=qe(t);return n.getTime()<i.getTime()}(e.timestamp,t)},this.buildingSlug=e,this.building=t}addChatListener(e){this.chatListener=e}async initializePubnub(){const e=this.getChatStorageKey();if(!e.leadId)return void console.error("Error getting chat storage key...");this.leadUserId=e.leadId,this.channel=`webchat_${this.leadUserId}`,e.timestamp&&function(e,t){Ue(2,arguments);var n=qe(e),i=qe(t);return n.getTime()>i.getTime()}(e.timestamp,Nr(new Date,this.ttlHours))&&this.createChatStorageKey(this.leadUserId);const t=await this.fetchToken(this.leadUserId,this.channel);return this.pubnub=new(Cr())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token}),this.withAuthToken((()=>new Promise((()=>this.handleChatListeners())))),await this.withAuthToken((()=>this.getChannelHistory())),this.pubnub}async fetchToken(e,n){return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${n}`)).data}async fetchChannelExists(e){return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}async withAuthToken(t){try{await t()}catch(n){if(n instanceof e.AxiosError&&n&&n.response&&403===n.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const e=await this.fetchToken(this.leadUserId,this.channel);if(!e)return;this.pubnub.setAuthKey(e.auth.result.token),await t()}catch(e){}}}async getChannelHistory(){var e;try{const t=await new Promise(((e,t)=>{this.pubnub&&this.channel&&this.pubnub.fetchMessages({channels:[this.channel],count:100},((n,i)=>{n.error?t(n):e(i)}))}));if(this.channel&&0!==Object.keys(t.channels).length){const n=t.channels[this.channel],i=[];n.forEach((e=>{e.uuid&&i.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})})),this.messages=i,null===(e=this.chatListener)||void 0===e||e.call(this,{messages:this.messages,isLoading:!1})}}catch(e){}}}(this.buildingSlug,this.building),this.myPubnub.isChatKeyValid(this.myPubnub.getChatStorageKey())&&await this.myPubnub.initializePubnub(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.building.autoOpenChatWidget)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1)},this.handleContactClicked=e=>{var t,n;this.chatProvider===Dr.TALKJS?null===(t=this.popup)||void 0===t||t.hide():this.chatProvider===Dr.PUBNUB&&(this.displayPubnubChat=!1),this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.chatProvider===Dr.TALKJS?null===(t=this.popup)||void 0===t||t.hide():this.chatProvider===Dr.PUBNUB&&(this.displayPubnubChat=!1),this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e)},this.handleContactTabClicked=e=>{var t,n;this.chatProvider===Dr.TALKJS?null===(t=this.popup)||void 0===t||t.hide():this.chatProvider===Dr.PUBNUB&&(this.displayPubnubChat=!1),this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickPhoneOption(e)},this.adjustTopHeaderContactCoords=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById(this.chatProvider===Dr.TALKJS?"chatAdditionalActionsTalkjs":"chatAdditionalActionsPubnub");if(r)if(this.chatProvider===Dr.TALKJS&&this.talkjsPopupElement){const e=this.talkjsPopupElement.getBoundingClientRect();r.style.left=`${e.left+20}px`,r.style.top=e.bottom-24+"px"}else if(this.chatProvider===Dr.PUBNUB){const e=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),o=null==e?void 0:e.getBoundingClientRect();if(!o)return;r.style.left=`${o.left}px`,r.style.top=`${o.bottom}px`}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized},this.renderChatAdditionalActions=(e,t)=>{var n,i,r,o,a,s,u,l;return B` <div
|
|
3145
|
+
`:B``}};Fr.styles=[Pr],_r([de({attribute:!0})],Fr.prototype,"channel",void 0),_r([de({attribute:!0})],Fr.prototype,"myPubnub",void 0),_r([de({attribute:!0})],Fr.prototype,"buildingSlug",void 0),_r([de({attribute:!0})],Fr.prototype,"building",void 0),_r([de({attribute:!0})],Fr.prototype,"brandColor",void 0),_r([de({attribute:!0})],Fr.prototype,"onClickExit",void 0),_r([de({attribute:!0})],Fr.prototype,"onMount",void 0),_r([pe("#message-input",!0)],Fr.prototype,"messageInput",void 0),_r([pe("#conversation-body",!0)],Fr.prototype,"messageBody",void 0),_r([ce()],Fr.prototype,"messages",void 0),_r([ce()],Fr.prototype,"isMobile",void 0),_r([ce()],Fr.prototype,"isLoadingMessages",void 0),Fr=_r([ue("pubnub-chat")],Fr);var Mr,Dr,kr=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};!function(e){e.TALKJS="talkjs",e.PUBNUB="pubnub"}(Dr||(Dr={}));let Ur=Mr=class extends ae{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.themeId="Glass",this.useMiniWidget=!0,this.launcherStyles={},this.isMinimized=!1,this.brandColor=null,this.popup=null,this.theme=bi({themeId:this.themeId,brandColor:this.brandColor}),this.chatId="",this.analytics=null,this.isMobile=r(),this.launcher=null,this.building=null,this.buildingABTestType=null,this.leadSources=null,this.currentLeadSource=null,this.featureFlagShowDropdown=qn.always,this.phoneNumberForSource=null,this.hasMounted=!1,this.hideLauncher=!1,this.isLoading=!0,this.talkjsPopupElement=null,this.chatProvider=Dr.TALKJS,this.displayPubnubChat=!1,this.myPubnub=null,this.yardiDNIScriptInterval=null,this.launcherRef=Oe(),this.initializeInstanceVariables=async()=>{Mr.session=Ee.ready.then((()=>{const e=new Ee.User({id:"anonymous-"+ui(this.orgSlug,this.buildingSlug),name:"Me",email:null,role:"Default"});return new Ee.Session({appId:"ogKIvCor",me:e})})),await this.setBuildingDerivedInfo(),await this.initializeLaunchJS()&&(this.attachOnClickToLauncher(),this.isLoading=!1)},this.setBuildingDerivedInfo=async()=>{var e,n,i;if(!this.buildingSlug||!this.orgSlug)return;const[r,o,a,s,u,l,d]=await Promise.all([Si(this.orgSlug,this.buildingSlug),Oi(this.buildingSlug),xr(this.buildingSlug),Ci(this.buildingSlug,document.referrer),Bn(this.buildingSlug),Ln(this.buildingSlug),xi(this.buildingSlug)]);r.phoneNumber=Pe(r.phoneNumber),this.building=r,this.buildingABTestType=null!==(e=null==o?void 0:o.abTestType)&&void 0!==e?e:"",this.leadSources=a,this.currentLeadSource=s,this.featureFlagShowDropdown=u,d&&(null===this.brandColor&&(this.brandColor=null!==(n=d.primaryColor)&&void 0!==n?n:null),this.isMinimized=!!d.autoMinimize,d.designConcept&&(d.designConcept===Ti.MINIMIZED&&(this.isMobile=!0),d.designConcept===Ti.PILLS&&(this.buildingABTestType=null),d.designConcept===Ti.EMOJI&&(this.buildingABTestType=Ai.ConceptEmoji))),null===this.brandColor&&(this.brandColor=mi);let c=null;l&&(c=await async function(e,n){try{const i=await t().get(`https://app.meetelise.com/platformApi/webchat/${e}/phone-number-by-source?source=${n}`);return i.data?{number:Pe(i.data.number),isMatch:i.data.isMatch,isPropertyWebsiteCatchall:i.data.isPropertyWebsiteCatchall}:null}catch(e){return null}}(this.buildingSlug,this.currentLeadSource)),this.phoneNumberForSource=c||{number:this.building.phoneNumber,isMatch:!1,isPropertyWebsiteCatchall:!0},this.currentLeadSource&&(this.leadSources.includes(this.currentLeadSource)||this.leadSources.push(this.currentLeadSource)),An(this.building.id),this.chatId=ui(this.orgSlug,this.buildingSlug),this.avatarSrc=this.avatarSrc||this.building.avatarSrc,this.theme=bi({themeId:null!==(i=this.themeId)&&void 0!==i?i:this.building.themeId,brandColor:this.brandColor}),this.analytics=new Zn(this.orgSlug,this.buildingSlug,this.chatId,this.currentLeadSource),this.analytics.ping("webchat_heartbeat")},this.initializeLaunchJS=async()=>{var e;if(!this.building||!this.theme)return;if(this.popup&&this.launcher)return;const[t,n,i,r]=await Promise.all([this.building,this.theme,this.avatarSrc,Mr.session]);return t.conversationMaintenanceMode?(console.warn("MeetElise Chat is in maintenance mode. Chat icon will not appear."),!1):r?(await this.configureTalkJSPopup(t,n,r,i),this.configureLauncherElement(),null===(e=this.analytics)||void 0===e||e.ping("load"),this.yardiDNIScriptInterval=setInterval((()=>this.pollForYardiCampaignSource()),1e3),setTimeout(clearInterval,15e3,this.yardiDNIScriptInterval),!0):void 0},this.configureLauncherElement=()=>{this.popup&&this.launcherRef.value&&(this.launcher=this.launcherRef.value)},this.configureTalkJSPopup=async(e,t,n,i)=>{var r;const o=n.createPopup(wi(n,e,t,i||e.avatarSrc,this.chatId,this.isMobile),{launcher:"never",showCloseInHeader:!0,messageField:{placeholder:"Ask a question..."}});await o.mount({show:!1}),o.on("close",(()=>{this.hideLauncher=!1}));const a=document.querySelector(".__talkjs_popup");if(this.talkjsPopupElement=a,!a)throw new Error("Failed to find chat window");a.classList.add("meetelise-chat","pane"),this.isMobile||a.classList.add("launcher__desktop"),a.style.zIndex="99999999999",this.popup=o,this.shouldAutoOpenChat(e.autoOpenChatWidget)&&(this.popup.show(),this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp(),null===(r=this.analytics)||void 0===r||r.ping("autoOpen"))},this.shouldAutoOpenChat=e=>{const t=sessionStorage.getItem("alreadyAutoOpenedTimestamp"),n=!t||!(t&&!an(un(t)));return!!e&&!!n&&!r()},this.updateAlreadyAutoOpenedTimestamp=()=>{sessionStorage.setItem("alreadyAutoOpenedTimestamp",tn(function(e,t){Ue(2,arguments);var n=et(t);return tt(e,6e4*n)}(new Date,15)))},this.firstUpdated=async()=>{await async function(e){try{return(await t().get(Un(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"use-pubnub-chat-provider",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(this.buildingSlug)?(this.chatProvider=Dr.PUBNUB,this.initializePubnubVariables()):this.initializeInstanceVariables()},this.initializePubnubVariables=async()=>{await this.setBuildingDerivedInfo(),this.building&&(this.myPubnub=new class{constructor(e,t){this.apiHost="https://app.meetelise.com",this.building=null,this.ttlHours=24,this.pubnub=null,this.leadUserId="",this.channel="",this.chatListener=null,this.messages=[],this.listenerParams={message:e=>{var t;this.messages=[...this.messages,{channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken}];const n="eliseai"!==e.publisher;null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.messages,isLoading:n}),this.isLoadingMessages=n}},this.isLoadingMessages=!1,this.handleChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams))},this.removeChatListeners=()=>{this.pubnub&&this.channel&&(this.pubnub.unsubscribe({channels:[this.channel]}),this.pubnub.removeListener(this.listenerParams))},this.sendMessage=async e=>{if(e){if(!this.pubnub&&!await this.initializePubnub())return;await this.withAuthToken((async()=>{var t,n;this.pubnub&&this.channel&&await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(t=this.building)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,userId:null===(n=this.building)||void 0===n?void 0:n.userId}})})),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.createChatStorageKey=e=>{const t=tn(new Date),n=null!=e?e:`lead_${si()}_${this.buildingSlug}`;return localStorage.setItem("com.eliseai.webchat.slug="+this.buildingSlug,JSON.stringify({buildingSlug:this.buildingSlug,leadId:n,timestamp:t})),{leadId:n,timestamp:un(t),buildingSlug:this.buildingSlug}},this.getChatStorageKey=()=>{const e=localStorage.getItem("com.eliseai.webchat.slug="+this.buildingSlug);if(e)try{const t=JSON.parse(e),n=t.buildingSlug,i=t.leadId,r=new Date(t.timestamp);if(this.isChatKeyValid({leadId:i,timestamp:r,buildingSlug:n}))return{leadId:i,timestamp:r,buildingSlug:n}}catch(e){console.warn("Error getting chat storage key")}return this.createChatStorageKey()},this.isChatKeyValid=e=>{if(e.buildingSlug!==this.buildingSlug||!e.leadId||!e.timestamp)return!1;const t=Nr(new Date,this.ttlHours);return function(e,t){Ue(2,arguments);var n=qe(e),i=qe(t);return n.getTime()<i.getTime()}(e.timestamp,t)},this.buildingSlug=e,this.building=t}addChatListener(e){this.chatListener=e}async initializePubnub(){const e=this.getChatStorageKey();if(!e.leadId)return void console.error("Error getting chat storage key...");this.leadUserId=e.leadId,this.channel=`webchat_${this.leadUserId}`,e.timestamp&&function(e,t){Ue(2,arguments);var n=qe(e),i=qe(t);return n.getTime()>i.getTime()}(e.timestamp,Nr(new Date,this.ttlHours))&&this.createChatStorageKey(this.leadUserId);const t=await this.fetchToken(this.leadUserId,this.channel);return this.pubnub=new(Cr())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token}),this.withAuthToken((()=>new Promise((()=>this.handleChatListeners())))),await this.withAuthToken((()=>this.getChannelHistory())),this.pubnub}async fetchToken(e,n){return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${n}`)).data}async fetchChannelExists(e){return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}async withAuthToken(t){try{await t()}catch(n){if(n instanceof e.AxiosError&&n&&n.response&&403===n.response.status)try{if(!this.pubnub||!this.leadUserId||!this.channel)return;const e=await this.fetchToken(this.leadUserId,this.channel);if(!e)return;this.pubnub.setAuthKey(e.auth.result.token),await t()}catch(e){}}}async getChannelHistory(){var e;try{const t=await new Promise(((e,t)=>{this.pubnub&&this.channel&&this.pubnub.fetchMessages({channels:[this.channel],count:100},((n,i)=>{n.error?t(n):e(i)}))}));if(this.channel&&0!==Object.keys(t.channels).length){const n=t.channels[this.channel],i=[];n.forEach((e=>{e.uuid&&i.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})})),this.messages=i,null===(e=this.chatListener)||void 0===e||e.call(this,{messages:this.messages,isLoading:!1})}}catch(e){}}}(this.buildingSlug,this.building),this.myPubnub.isChatKeyValid(this.myPubnub.getChatStorageKey())&&await this.myPubnub.initializePubnub(),this.attachOnClickToLauncher(),this.shouldAutoOpenChat(this.building.autoOpenChatWidget)&&(this.displayPubnubChat=!0,this.hideLauncher=!0,this.hasMounted=!0,this.updateAlreadyAutoOpenedTimestamp()),this.isLoading=!1)},this.handleContactClicked=e=>{var t,n;this.chatProvider===Dr.TALKJS?null===(t=this.popup)||void 0===t||t.hide():this.chatProvider===Dr.PUBNUB&&(this.displayPubnubChat=!1),this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickEmailOption(e)},this.handleTourClicked=e=>{var t,n;this.chatProvider===Dr.TALKJS?null===(t=this.popup)||void 0===t||t.hide():this.chatProvider===Dr.PUBNUB&&(this.displayPubnubChat=!1),this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickSSTOption(e)},this.handleContactTabClicked=e=>{var t,n;this.chatProvider===Dr.TALKJS?null===(t=this.popup)||void 0===t||t.hide():this.chatProvider===Dr.PUBNUB&&(this.displayPubnubChat=!1),this.hideLauncher=!1,null===(n=this.launcherRef.value)||void 0===n||n.onClickPhoneOption(e)},this.adjustTopHeaderContactCoords=()=>{var e,t,n,i;const r=null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById(this.chatProvider===Dr.TALKJS?"chatAdditionalActionsTalkjs":"chatAdditionalActionsPubnub");if(r)if(this.chatProvider===Dr.TALKJS&&this.talkjsPopupElement){const e=this.talkjsPopupElement.getBoundingClientRect();r.style.left=`${e.left+20}px`,r.style.top=e.bottom-24+"px"}else if(this.chatProvider===Dr.PUBNUB){const e=null===(i=null===(n=null===(t=this.shadowRoot)||void 0===t?void 0:t.getElementById("pubnub-chat"))||void 0===n?void 0:n.shadowRoot)||void 0===i?void 0:i.getElementById("pubnub-chat-container"),o=null==e?void 0:e.getBoundingClientRect();if(!o)return;r.style.left=`${o.left}px`,r.style.top=`${o.bottom}px`}},this.onClickMinimize=e=>{e.preventDefault(),e.stopPropagation(),this.isMinimized=!this.isMinimized},this.renderChatAdditionalActions=(e,t)=>{var n,i,r,o,a,s,u,l;return B` <div
|
|
3129
3146
|
id=${e}
|
|
3130
3147
|
class=${ge({showTab:t,hideTab:!t})}
|
|
3131
3148
|
>
|
|
@@ -82,6 +82,12 @@ export const pubnubChatStyles = css`
|
|
|
82
82
|
.disclaimer-message {
|
|
83
83
|
font-size: 12px;
|
|
84
84
|
}
|
|
85
|
+
.disclaimer-inner {
|
|
86
|
+
margin: 0;
|
|
87
|
+
}
|
|
88
|
+
.disclaimer-inner > a {
|
|
89
|
+
color: black;
|
|
90
|
+
}
|
|
85
91
|
|
|
86
92
|
.message-container {
|
|
87
93
|
display: flex;
|
|
@@ -111,6 +117,9 @@ export const pubnubChatStyles = css`
|
|
|
111
117
|
line-height: 130%;
|
|
112
118
|
}
|
|
113
119
|
|
|
120
|
+
#loading-message {
|
|
121
|
+
padding: 16px;
|
|
122
|
+
}
|
|
114
123
|
.loading-dot {
|
|
115
124
|
width: 6px;
|
|
116
125
|
height: 6px;
|
|
@@ -103,9 +103,17 @@ export class PubnubChat extends LitElement {
|
|
|
103
103
|
<div id="conversation-body">
|
|
104
104
|
<ul id="message-thread-list">
|
|
105
105
|
<li class="message-container disclaimer-message">
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
<p class="disclaimer-inner">
|
|
107
|
+
By interacting with this system, you consent to
|
|
108
|
+
<a
|
|
109
|
+
href="http://bit.ly/me_privacy_policy"
|
|
110
|
+
target="_blank"
|
|
111
|
+
rel="noopener noreferrer"
|
|
112
|
+
>
|
|
113
|
+
this privacy policy</a
|
|
114
|
+
>, including being contacted by AI or a human & having your
|
|
115
|
+
conversation recorded by a third party.
|
|
116
|
+
</p>
|
|
109
117
|
</li>
|
|
110
118
|
${this.building.welcomeMessage
|
|
111
119
|
? html` <li class="message-container ai-message">
|
package/src/analytics.ts
CHANGED
|
@@ -19,11 +19,18 @@ export default class Analytics {
|
|
|
19
19
|
private building: string;
|
|
20
20
|
private featureFlags?: Record<string, boolean>;
|
|
21
21
|
public chatId: string;
|
|
22
|
+
private incomingProcessedLeadSource: string | null;
|
|
22
23
|
|
|
23
|
-
constructor(
|
|
24
|
+
constructor(
|
|
25
|
+
org: string,
|
|
26
|
+
building: string,
|
|
27
|
+
chatId: string,
|
|
28
|
+
incomingProcessedLeadSource: string | null
|
|
29
|
+
) {
|
|
24
30
|
this.org = org;
|
|
25
31
|
this.building = building;
|
|
26
32
|
this.chatId = chatId;
|
|
33
|
+
this.incomingProcessedLeadSource = incomingProcessedLeadSource;
|
|
27
34
|
this.featureFlags = {};
|
|
28
35
|
}
|
|
29
36
|
|
|
@@ -57,6 +64,7 @@ export default class Analytics {
|
|
|
57
64
|
referrer: document.referrer,
|
|
58
65
|
featureFlags: this.featureFlags,
|
|
59
66
|
campaignSources: getCampaignSources(),
|
|
67
|
+
incomingProcessedLeadSource: this.incomingProcessedLeadSource, // if we already know the lead source, send it along
|
|
60
68
|
}),
|
|
61
69
|
}
|
|
62
70
|
);
|