@meetelise/chat 1.22.5 → 1.22.6

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.22.5",
3
+ "version": "1.22.6",
4
4
  "description": "",
5
5
  "main": "public/dist/index.js",
6
6
  "type": "module",
@@ -155,14 +155,14 @@
155
155
  // organization: "test-company",
156
156
  // building: "3fc93384-91f5-11ed-98a3-43f5a2f42588",
157
157
 
158
- organization: "4c78cac8-017a-4497-8b71-3df15779a83c",
158
+ // organization: "4c78cac8-017a-4497-8b71-3df15779a83c",
159
159
 
160
- building: "43e3b1bc-d1b2-11ee-acb9-d77ba815aaac",
160
+ // building: "43e3b1bc-d1b2-11ee-acb9-d77ba815aaac",
161
161
 
162
162
  // organization: "cardinal-group",
163
- // widgetType: "utilities",
163
+ widgetType: "utilities",
164
164
 
165
- // organization: "test-company",
165
+ organization: "test-company",
166
166
  // building: "e2e-test-yardi-building",
167
167
  // overrideRentgrata: true,
168
168
  // onWidgetLoaded: onWidgetLoaded,
@@ -3240,7 +3240,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
3240
3240
  ${Ii}
3241
3241
  ${Ni}
3242
3242
  ${Ei}
3243
- `,hr([le({attribute:!0})],fr.prototype,"isMinimized",void 0),hr([le()],fr.prototype,"mobileStyles",void 0),hr([le({type:Boolean})],fr.prototype,"isFirstMount",void 0),hr([le({attribute:!1})],fr.prototype,"autoOpenChatWidget",void 0),hr([le()],fr.prototype,"phoneNumber",void 0),hr([le({attribute:!0})],fr.prototype,"buildingName",void 0),hr([le({attribute:!0})],fr.prototype,"chatId",void 0),hr([le({attribute:!0})],fr.prototype,"chatCallUsHeader",void 0),hr([le({attribute:!1})],fr.prototype,"buildingId",void 0),hr([le({attribute:!0})],fr.prototype,"buildingSlug",void 0),hr([le({attribute:!0})],fr.prototype,"orgSlug",void 0),hr([le({attribute:!0})],fr.prototype,"sgtUrl",void 0),hr([le({attribute:!0})],fr.prototype,"designConcept",void 0),hr([le({attribute:!0})],fr.prototype,"featureFlagShowDropdown",void 0),hr([le({attribute:!1})],fr.prototype,"leadSources",void 0),hr([le({attribute:!0})],fr.prototype,"currentLeadSource",void 0),hr([le({attribute:!0})],fr.prototype,"escortedToursLink",void 0),hr([le({attribute:!0})],fr.prototype,"virtualToursLink",void 0),hr([le({type:Boolean})],fr.prototype,"hasChatEnabledDesktop",void 0),hr([le({type:Boolean})],fr.prototype,"hasChatEnabledMobile",void 0),hr([le({type:Boolean})],fr.prototype,"hasEmailEnabledDesktop",void 0),hr([le({type:Boolean})],fr.prototype,"hasEmailEnabledMobile",void 0),hr([le({type:Boolean})],fr.prototype,"hasCallUsEnabledDesktop",void 0),hr([le({type:Boolean})],fr.prototype,"hasCallUsEnabledMobile",void 0),hr([le({type:Boolean})],fr.prototype,"hasTextUsEnabledDesktop",void 0),hr([le({type:Boolean})],fr.prototype,"hasTextUsEnabledMobile",void 0),hr([le({type:Boolean})],fr.prototype,"hasSSTEnabledDesktop",void 0),hr([le({type:Boolean})],fr.prototype,"hasSSTEnabledMobile",void 0),hr([le({attribute:!1})],fr.prototype,"tourTypeOptions",void 0),hr([le({attribute:!0})],fr.prototype,"hasDynamicSchedulingEnabled",void 0),hr([le({attribute:!0})],fr.prototype,"onExitChat",void 0),hr([le({attribute:!1})],fr.prototype,"hasHideMobileFeatures",void 0),hr([le({type:Number})],fr.prototype,"right",void 0),hr([le({type:Number})],fr.prototype,"bottom",void 0),hr([le({type:Number})],fr.prototype,"top",void 0),hr([le({type:Number})],fr.prototype,"left",void 0),hr([le({attribute:!0})],fr.prototype,"showTourNextToChat",void 0),hr([le({attribute:!1})],fr.prototype,"onChatTapped",void 0),hr([le({attribute:!0})],fr.prototype,"onClickMinimize",void 0),hr([le({attribute:!0})],fr.prototype,"overrideRentgrata",void 0),hr([le({attribute:!1})],fr.prototype,"launcherStyles",void 0),hr([le({attribute:!0})],fr.prototype,"brandColor",void 0),hr([le({attribute:!0})],fr.prototype,"backgroundColor",void 0),hr([le({attribute:!0})],fr.prototype,"leadSourceClient",void 0),hr([ue()],fr.prototype,"isEmailWindowOpen",void 0),hr([ue()],fr.prototype,"isCallUsWindowOpen",void 0),hr([ue()],fr.prototype,"isSSTWindowOpen",void 0),hr([ue()],fr.prototype,"isTextUsWindowOpen",void 0),hr([ue()],fr.prototype,"isMobileFeaturesExpanded",void 0),fr=hr([ae("meetelise-launcher")],fr);const mr=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",fr)};var gr=n(3379),vr=n.n(gr),yr=n(7795),br=n.n(yr),wr=n(569),Sr=n.n(wr),Tr=n(3565),xr=n.n(Tr),Ar=n(9216),Cr=n.n(Ar),Or=n(4589),Ir=n.n(Or),Nr=n(3631),Er={};async function Rr(e,n){try{const i=await t().get(`https://app.meetelise.com/platformApi/webchat/${n}/lead-sources`);if(i.data){if("7e352741-1120-4ccf-9929-5dc99193a908"===e){const e=["Zillow","Apartments.com","Google PPC","Google Maps","Apple Maps","Social Media","Print Marketing"];return i.data.filter((t=>e.includes(t)))}return _r(i.data,n)}return[]}catch(e){return[]}}Er.styleTagTransform=Ir(),Er.setAttributes=xr(),Er.insert=Sr().bind(null,"head"),Er.domAPI=br(),Er.insertStyleElement=Cr(),vr()(Nr.Z,Er),Nr.Z&&Nr.Z.locals&&Nr.Z.locals;const _r=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter((e=>{const t=e.toLowerCase();return!n.map((e=>e.toLowerCase())).includes(t)}))};var Pr,Mr=n(9594),Fr=n.n(Mr),Dr=new Uint8Array(16);function kr(){if(!Pr&&!(Pr="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 Pr(Dr)}const Ur=/^(?:[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,Lr=function(e){return"string"==typeof e&&Ur.test(e)};for(var Br=[],qr=0;qr<256;++qr)Br.push((qr+256).toString(16).substr(1));const Jr=function(e,t,n){var i=(e=e||{}).random||(e.rng||kr)();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=(Br[e[t+0]]+Br[e[t+1]]+Br[e[t+2]]+Br[e[t+3]]+"-"+Br[e[t+4]]+Br[e[t+5]]+"-"+Br[e[t+6]]+Br[e[t+7]]+"-"+Br[e[t+8]]+Br[e[t+9]]+"-"+Br[e[t+10]]+Br[e[t+11]]+Br[e[t+12]]+Br[e[t+13]]+Br[e[t+14]]+Br[e[t+15]]).toLowerCase();if(!Lr(n))throw TypeError("Stringified UUID is invalid");return n}(i)},jr=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Hr=(e,t,n)=>{const i=bn(new Date),r=n||`lead_${Jr()}_${e}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:On(i),buildingSlug:e,initiatedChat:t}},Gr=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(zr(e,i))return i}catch(e){console.warn("Error getting chat storage key")}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},zr=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(dn(t.timestamp,e))return!1}}catch(e){console.warn("Error checking chat storage key validity")}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp||hn(t.timestamp,24))};var Wr;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(Wr||(Wr={}));const Vr=e=>e.type===Kr.text,Qr=e=>e.type===Kr.media;var Kr;!function(e){e.text="text",e.media="media"}(Kr||(Kr={}));const Xr=class{constructor(e,t,n,i=null,r,o=null,a=Uo.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.building=null,this.eliseResponseTimeout=null,this.widgetType=Uo.Default,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t,n;const i={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,i],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter((e=>e.message.messageType!==Wr.noReply)),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages);const r="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:r}),!r&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=r,"ai_message"===e.message.customType&&this.simpleChatMessages.some((e=>e.type===Kr.text&&e.message.includes("confirmed for your tour")))&&ti("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(n=this.building)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.checkAndHandleGTMForLeadEmail(e)}},this.isLoadingMessages=!1,this.isFirstChatMessageSent=!1,this.checkAndHandleGTMForLeadEmail=e=>{var t;try{if("lead_message"!==e.message.customType)return;if(!(e=>{try{return/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b/.test(e)}catch(e){return console.warn("Error checking if message contains email",e),!1}})(e.message.text))return;ti("leadProvidedEmail",{buildingId:null===(t=this.building)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}catch(e){return}},this.markEveryPreviousNoReplyMessageDone=e=>{var t,n;for(let i=e.length-1;i>=0;i--){const r=null===(t=e[i])||void 0===t?void 0:t.message,o=i>0&&(null===(n=e[i-1])||void 0===n?void 0:n.message);(null==r?void 0:r.messageType)===Wr.noReply&&o&&(o.is_done=!0)}},this.checkMessageChunkValid=e=>{try{return!!e.message&&!!e.message.text&&e.message.text.length>0&&!!e.message.customType}catch(e){return!1}},this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.building&&ui({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:li.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.removeChatListeners()},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){const e=Hr(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken((async()=>{var t,n,i,r,o;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout((()=>{console.error("Elise AI did not respond in time..."),this.building&&ui({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:li.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}),9e4),0===this.simpleChatMessages.length&&(null===(t=this.leadSourceClient)||void 0===t||t.checkAndHandleForLogLeadSource({webchatAction:"chat",stateId:null})),this.widgetType===Uo.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState()}}):await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(n=this.building)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,userId:null===(i=this.building)||void 0===i?void 0:i.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState()}}),this.isFirstChatMessageSent||(ti("firstChatMessageSent",{message:e,buildingId:null===(r=this.building)||void 0===r?void 0:r.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),ti("chatMessageSent",{message:e,buildingId:null===(o=this.building)||void 0===o?void 0:o.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))})),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],n={};return e.forEach((e=>{var i;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:Kr.media}):!e.message.stream_id||e.message.is_done&&0===e.message.order?t.push({timestamp:e.timetoken,message:e.message.text,isLeadMessage:this.isLeadMessage(e),chunks:[{text:e.message.text,order:0,isDone:!0}],type:Kr.text}):n[e.message.stream_id]?n[e.message.stream_id].push(e):n[e.message.stream_id]=[e]})),Object.keys(n).forEach((e=>{const i=n[e],r=this.getConsecutiveChunks(i.sort(((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}))),o=r.map((e=>e.message.text)).join(""),a=r[0],s={timestamp:a.timetoken,message:o,isLeadMessage:this.isLeadMessage(a),chunks:r.map((e=>{var t,n;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(n=e.message.is_done)&&void 0!==n&&n}})),type:Kr.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)})),t.sort(((e,t)=>e.timestamp-t.timestamp)),t},this.getConsecutiveChunks=e=>{var t,n;const i=e.sort(((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)})),r=[];let o=null!==(t=i[0].message.order)&&void 0!==t?t:0;for(const e of i){if((null!==(n=e.message.order)&&void 0!==n?n:-1)!==o)break;r.push(e),o++}return r},this.isMessageStillStreamingChunks=e=>{const t=e.find((e=>e.message.is_done));return!t||e.length===t.message.order},this.buildingSlug=e,this.building=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=o,this.widgetType=a}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(Fr())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token,origin:"meetelise.pubnubapi.com"}),this.withAuthToken((()=>new Promise((()=>this.handleChatListeners())))),await this.withAuthToken((()=>this.getChannelHistory())),this.pubnub):void 0}async fetchToken(e,n){try{return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${n}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.building&&ui({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:li.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.building&&ui({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:li.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}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){this.building&&ui({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:li.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let n=[],i=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise(((n,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=i?i:void 0},((e,t)=>{e.error?o(e):n(t)}))})),a=o.channels[this.channel];if(!a)break;if(a.sort(((e,t)=>+e.timetoken-+t.timetoken)),!a||0===a.length)break;if(this.channel&&0!==Object.keys(o.channels).length){const e=o.channels[this.channel],t=[];e.forEach((e=>{e.uuid&&t.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})})),this.markEveryPreviousNoReplyMessageDone(t),n=n.concat(t.filter((e=>e.message.messageType!==Wr.noReply)))}if(i=a[0].timetoken,n.length>=e||a.length<r)break}this.rawPubnubMessages=n.slice(0,e),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:!1})}catch(e){this.building&&ui({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:li.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")}},Yr=(e,t,n)=>{const i=`tel:${e}`,r=`sms:${e}`,o=`whatsapp://send?phone=${e}}`,a=`facetime:${e}`,s=`facetime-audio:${e}`,l=/\(\d{3}\)\s\d{3}-\d{4}/g,u=/(tel|sms):\(\d{3}\)\s\d{3}-\d{4}/g,d=/whatsapp:\/\/send\?phone=\d+/g,c=/(facetime|facetime-audio):\d+/g,p=document.body.getElementsByTagName("*");let h=!1;const f=e.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let m=!1,g=!1;for(let e=0;e<p.length;e++)if(p[e].nodeType===Node.ELEMENT_NODE&&(1===p[e].childNodes.length&&p[e].childNodes[0].nodeType==Node.TEXT_NODE&&(p[e].innerHTML=p[e].innerHTML.replace(l,f),h=!0,m||(m=!0)),p[e].hasAttribute("href"))){const t=p[e].getAttribute("href");if(!t)continue;let n="",l=u;t.startsWith("sms:")?n=r:t.startsWith("whatsapp:")?(n=o,l=d):t.startsWith("facetime:")?(n=a,l=c):t.startsWith("facetime-audio:")?(n=s,l=c):n=i;const h=t.replace(l,n);p[e].setAttribute("href",h),g||(g=!0)}m&&ui({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:f,website:window.location.href},logType:li.info,buildingSlug:n,orgSlug:t}),g&&ui({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:f,website:window.location.href},logType:li.info,buildingSlug:n,orgSlug:t}),h||ui({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:li.warn,buildingSlug:n,orgSlug:t})};var $r=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Zr=class extends re{constructor(){super(...arguments),this.onClick=()=>{},this.brandColor=Me,this.toExpand=!1}render(){return U`
3243
+ `,hr([le({attribute:!0})],fr.prototype,"isMinimized",void 0),hr([le()],fr.prototype,"mobileStyles",void 0),hr([le({type:Boolean})],fr.prototype,"isFirstMount",void 0),hr([le({attribute:!1})],fr.prototype,"autoOpenChatWidget",void 0),hr([le()],fr.prototype,"phoneNumber",void 0),hr([le({attribute:!0})],fr.prototype,"buildingName",void 0),hr([le({attribute:!0})],fr.prototype,"chatId",void 0),hr([le({attribute:!0})],fr.prototype,"chatCallUsHeader",void 0),hr([le({attribute:!1})],fr.prototype,"buildingId",void 0),hr([le({attribute:!0})],fr.prototype,"buildingSlug",void 0),hr([le({attribute:!0})],fr.prototype,"orgSlug",void 0),hr([le({attribute:!0})],fr.prototype,"sgtUrl",void 0),hr([le({attribute:!0})],fr.prototype,"designConcept",void 0),hr([le({attribute:!0})],fr.prototype,"featureFlagShowDropdown",void 0),hr([le({attribute:!1})],fr.prototype,"leadSources",void 0),hr([le({attribute:!0})],fr.prototype,"currentLeadSource",void 0),hr([le({attribute:!0})],fr.prototype,"escortedToursLink",void 0),hr([le({attribute:!0})],fr.prototype,"virtualToursLink",void 0),hr([le({type:Boolean})],fr.prototype,"hasChatEnabledDesktop",void 0),hr([le({type:Boolean})],fr.prototype,"hasChatEnabledMobile",void 0),hr([le({type:Boolean})],fr.prototype,"hasEmailEnabledDesktop",void 0),hr([le({type:Boolean})],fr.prototype,"hasEmailEnabledMobile",void 0),hr([le({type:Boolean})],fr.prototype,"hasCallUsEnabledDesktop",void 0),hr([le({type:Boolean})],fr.prototype,"hasCallUsEnabledMobile",void 0),hr([le({type:Boolean})],fr.prototype,"hasTextUsEnabledDesktop",void 0),hr([le({type:Boolean})],fr.prototype,"hasTextUsEnabledMobile",void 0),hr([le({type:Boolean})],fr.prototype,"hasSSTEnabledDesktop",void 0),hr([le({type:Boolean})],fr.prototype,"hasSSTEnabledMobile",void 0),hr([le({attribute:!1})],fr.prototype,"tourTypeOptions",void 0),hr([le({attribute:!0})],fr.prototype,"hasDynamicSchedulingEnabled",void 0),hr([le({attribute:!0})],fr.prototype,"onExitChat",void 0),hr([le({attribute:!1})],fr.prototype,"hasHideMobileFeatures",void 0),hr([le({type:Number})],fr.prototype,"right",void 0),hr([le({type:Number})],fr.prototype,"bottom",void 0),hr([le({type:Number})],fr.prototype,"top",void 0),hr([le({type:Number})],fr.prototype,"left",void 0),hr([le({attribute:!0})],fr.prototype,"showTourNextToChat",void 0),hr([le({attribute:!1})],fr.prototype,"onChatTapped",void 0),hr([le({attribute:!0})],fr.prototype,"onClickMinimize",void 0),hr([le({attribute:!0})],fr.prototype,"overrideRentgrata",void 0),hr([le({attribute:!1})],fr.prototype,"launcherStyles",void 0),hr([le({attribute:!0})],fr.prototype,"brandColor",void 0),hr([le({attribute:!0})],fr.prototype,"backgroundColor",void 0),hr([le({attribute:!0})],fr.prototype,"leadSourceClient",void 0),hr([ue()],fr.prototype,"isEmailWindowOpen",void 0),hr([ue()],fr.prototype,"isCallUsWindowOpen",void 0),hr([ue()],fr.prototype,"isSSTWindowOpen",void 0),hr([ue()],fr.prototype,"isTextUsWindowOpen",void 0),hr([ue()],fr.prototype,"isMobileFeaturesExpanded",void 0),fr=hr([ae("meetelise-launcher")],fr);const mr=()=>{window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",fr)};var gr=n(3379),vr=n.n(gr),yr=n(7795),br=n.n(yr),wr=n(569),Sr=n.n(wr),Tr=n(3565),xr=n.n(Tr),Ar=n(9216),Cr=n.n(Ar),Or=n(4589),Ir=n.n(Or),Nr=n(3631),Er={};async function Rr(e,n){try{const i=await t().get(`https://app.meetelise.com/platformApi/webchat/${n}/lead-sources`);if(i.data){if("7e352741-1120-4ccf-9929-5dc99193a908"===e){const e=["Zillow","Apartments.com","Google PPC","Google Maps","Apple Maps","Social Media","Print Marketing"];return i.data.filter((t=>e.includes(t)))}return _r(i.data,n)}return[]}catch(e){return[]}}Er.styleTagTransform=Ir(),Er.setAttributes=xr(),Er.insert=Sr().bind(null,"head"),Er.domAPI=br(),Er.insertStyleElement=Cr(),vr()(Nr.Z,Er),Nr.Z&&Nr.Z.locals&&Nr.Z.locals;const _r=(e,t)=>{let n=[];switch(t){case"d41619ec-0f79-11ee-8439-93855926ad58":n=["Forthea - PPC","HotPads","Forthea","Locator","Website-apartmentguide.com","Forthea - organic search","Tdc employee","University newspaper","Nashville apartment locators","Forthea - paid social","Apartment list","Off campus partners","Waze ads","Athletic event","Website-apartment guide"];break;case"d4160560-0f79-11ee-8438-fba837bf3a46":n=["Forthea - PPC","Rentgrata","Website-ApartmentFinder.com","Word of Mouth","Texas A&M A-Frame on Campus","Rent.com","Website-craigslist","Apartment List","Website-apartments.com","Forthea - paid social","Forthea - organic search","Website-apartmentguide.com","Forthea","Uhomes","Phone book","Property - website"];break;default:n=[]}return e.sort(),e.filter((e=>{const t=e.toLowerCase();return!n.map((e=>e.toLowerCase())).includes(t)}))};var Pr,Mr=n(9594),Fr=n.n(Mr),Dr=new Uint8Array(16);function kr(){if(!Pr&&!(Pr="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 Pr(Dr)}const Ur=/^(?:[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,Lr=function(e){return"string"==typeof e&&Ur.test(e)};for(var Br=[],qr=0;qr<256;++qr)Br.push((qr+256).toString(16).substr(1));const Jr=function(e,t,n){var i=(e=e||{}).random||(e.rng||kr)();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=(Br[e[t+0]]+Br[e[t+1]]+Br[e[t+2]]+Br[e[t+3]]+"-"+Br[e[t+4]]+Br[e[t+5]]+"-"+Br[e[t+6]]+Br[e[t+7]]+"-"+Br[e[t+8]]+Br[e[t+9]]+"-"+Br[e[t+10]]+Br[e[t+11]]+Br[e[t+12]]+Br[e[t+13]]+Br[e[t+14]]+Br[e[t+15]]).toLowerCase();if(!Lr(n))throw TypeError("Stringified UUID is invalid");return n}(i)},jr=e=>localStorage.removeItem("com.elise.webchat.slug="+e),Hr=(e,t,n)=>{const i=bn(new Date),r=n||`lead_${Jr()}_${e}`;return localStorage.setItem("com.elise.webchat.slug="+e,JSON.stringify({buildingSlug:e,leadId:r,timestamp:i,initiatedChat:t})),{leadId:r,timestamp:On(i),buildingSlug:e,initiatedChat:t}},Gr=e=>{const t=localStorage.getItem("com.elise.webchat.slug="+e);if(t)try{const n=JSON.parse(t),i={leadId:n.leadId,timestamp:new Date(n.timestamp),buildingSlug:n.buildingSlug,initiatedChat:n.initiatedChat};if(zr(e,i))return i}catch(e){console.warn("Error getting chat storage key")}return{leadId:null,timestamp:null,buildingSlug:null,initiatedChat:!1}},zr=(e,t)=>{try{if(t.timestamp&&t.initiatedChat){const e=new Date("2024-06-06T21:30:00Z");if(dn(t.timestamp,e))return!1}}catch(e){console.warn("Error checking chat storage key validity")}return!(t.buildingSlug!==e||!t.leadId||!t.timestamp||hn(t.timestamp,24))};var Wr;!function(e){e.noReply="no-reply",e.text="text",e.media="media"}(Wr||(Wr={}));const Vr=e=>e.type===Kr.text,Qr=e=>e.type===Kr.media;var Kr;!function(e){e.text="text",e.media="media"}(Kr||(Kr={}));const Xr=class{constructor(e,t,n,i=null,r,o=null,a=Uo.Default){this.apiHost="https://app.meetelise.com",this.leadSourceClient=null,this.building=null,this.eliseResponseTimeout=null,this.widgetType=Uo.Default,this.pubnub=null,this.leadUserId="",this.channel="",this.leadSource=null,this.isCurrentlyStreamingMessage=!1,this.chatListener=null,this.rawPubnubMessages=[],this.simpleChatMessages=[],this.listenerParams={message:e=>{var t,n;const i={channel:e.channel,message:e.message,publisher:e.publisher,subscription:e.subscription,timetoken:+e.timetoken};this.rawPubnubMessages=[...this.rawPubnubMessages,i],this.markEveryPreviousNoReplyMessageDone(this.rawPubnubMessages),this.rawPubnubMessages=this.rawPubnubMessages.filter((e=>e.message.messageType!==Wr.noReply)),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages);const r="eliseai"!==e.publisher&&"elise_health_ai"!==e.publisher;null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:r}),!r&&this.eliseResponseTimeout&&clearTimeout(this.eliseResponseTimeout),this.isLoadingMessages=r,"ai_message"===e.message.customType&&this.simpleChatMessages.some((e=>e.type===Kr.text&&e.message.includes("confirmed for your tour")))&&ti("scheduledTourEvent",{tourDetails:e.message,buildingId:null===(n=this.building)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.checkAndHandleGTMForLeadEmail(e)}},this.isLoadingMessages=!1,this.isFirstChatMessageSent=!1,this.checkAndHandleGTMForLeadEmail=e=>{var t;try{if("lead_message"!==e.message.customType)return;if(!(e=>{try{return/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,7}\b/.test(e)}catch(e){return console.warn("Error checking if message contains email",e),!1}})(e.message.text))return;ti("leadProvidedEmail",{buildingId:null===(t=this.building)||void 0===t?void 0:t.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel})}catch(e){return}},this.markEveryPreviousNoReplyMessageDone=e=>{var t,n;for(let i=e.length-1;i>=0;i--){const r=null===(t=e[i])||void 0===t?void 0:t.message,o=i>0&&(null===(n=e[i-1])||void 0===n?void 0:n.message);(null==r?void 0:r.messageType)===Wr.noReply&&o&&(o.is_done=!0)}},this.checkMessageChunkValid=e=>{try{return!!e.message&&!!e.message.text&&e.message.text.length>0&&!!e.message.customType}catch(e){return!1}},this.handleChatListeners=()=>{if(this.pubnub&&this.channel)try{this.pubnub.subscribe({channels:[this.channel]}),this.pubnub.addListener(this.listenerParams)}catch(e){this.building&&ui({logTitle:"PUBNUB_ERROR_ADDING_LISTENER",logData:{error:e,channel:this.channel,leadUserId:this.leadUserId,website:location.href},logType:li.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}},this.handleDisconnect=()=>{this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.removeChatListeners()},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){const e=Hr(this.buildingSlug,!0,this.leadUserId);if(!await this.initializePubnub(e))return}await this.withAuthToken((async()=>{var t,n,i,r,o;this.pubnub&&this.channel&&(this.eliseResponseTimeout&&(clearTimeout(this.eliseResponseTimeout),this.eliseResponseTimeout=null),this.eliseResponseTimeout=setTimeout((()=>{console.error("Elise AI did not respond in time..."),this.building&&ui({logTitle:"PUBNUB_ERROR_ELISEAI_MESSAGE_TIMEOUT",logData:{channel:this.channel,leadUserId:this.leadUserId,message:e},logType:li.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}),9e4),0===this.simpleChatMessages.length&&(null===(t=this.leadSourceClient)||void 0===t||t.checkAndHandleForLogLeadSource({webchatAction:"chat",stateId:null})),this.widgetType===Uo.Utilities?await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState(),orgSlug:this.orgSlug}}):await this.pubnub.publish({channel:this.channel,message:{text:e,customType:"lead_message",buildingId:null===(n=this.building)||void 0===n?void 0:n.id,buildingSlug:this.buildingSlug,userId:null===(i=this.building)||void 0===i?void 0:i.userId,leadSource:this.leadSource,widgetType:this.widgetType,isDevState:this.shouldCreateAsDevState()}}),this.isFirstChatMessageSent||(ti("firstChatMessageSent",{message:e,buildingId:null===(r=this.building)||void 0===r?void 0:r.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}),this.isFirstChatMessageSent=!0),ti("chatMessageSent",{message:e,buildingId:null===(o=this.building)||void 0===o?void 0:o.id,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug,leadUserId:this.leadUserId,channel:this.channel}))})),!1===this.isLoadingMessages&&(this.isLoadingMessages=!0)}},this.isLeadMessage=e=>e.publisher.includes("lead_")&&"lead_message"===e.message.customType,this.translatePubnubMessagesIntoSimpleChatMessages=e=>{const t=[],n={};return e.forEach((e=>{var i;"media"===e.message.messageType?t.push({timestamp:e.timetoken,media:null!==(i=e.message.media)&&void 0!==i?i:[],isLeadMessage:this.isLeadMessage(e),type:Kr.media}):!e.message.stream_id||e.message.is_done&&0===e.message.order?t.push({timestamp:e.timetoken,message:e.message.text,isLeadMessage:this.isLeadMessage(e),chunks:[{text:e.message.text,order:0,isDone:!0}],type:Kr.text}):n[e.message.stream_id]?n[e.message.stream_id].push(e):n[e.message.stream_id]=[e]})),Object.keys(n).forEach((e=>{const i=n[e],r=this.getConsecutiveChunks(i.sort(((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)}))),o=r.map((e=>e.message.text)).join(""),a=r[0],s={timestamp:a.timetoken,message:o,isLeadMessage:this.isLeadMessage(a),chunks:r.map((e=>{var t,n;return{text:e.message.text,order:null!==(t=e.message.order)&&void 0!==t?t:0,isDone:null!==(n=e.message.is_done)&&void 0!==n&&n}})),type:Kr.text};this.isCurrentlyStreamingMessage=this.isMessageStillStreamingChunks(r),t.push(s)})),t.sort(((e,t)=>e.timestamp-t.timestamp)),t},this.getConsecutiveChunks=e=>{var t,n;const i=e.sort(((e,t)=>{var n,i;return(null!==(n=e.message.order)&&void 0!==n?n:0)-(null!==(i=t.message.order)&&void 0!==i?i:0)})),r=[];let o=null!==(t=i[0].message.order)&&void 0!==t?t:0;for(const e of i){if((null!==(n=e.message.order)&&void 0!==n?n:-1)!==o)break;r.push(e),o++}return r},this.isMessageStillStreamingChunks=e=>{const t=e.find((e=>e.message.is_done));return!t||e.length===t.message.order},this.buildingSlug=e,this.building=t,this.orgSlug=n,this.leadSource=i,this.leadUserId=r,this.channel=`webchat_${r}`,this.leadSourceClient=o,this.widgetType=a}addChatListener(e){this.chatListener=e}async initializePubnub(e){if(!e.leadId)return;this.leadUserId=e.leadId;const t=await this.fetchToken(this.leadUserId,this.channel);return t?(this.pubnub=new(Fr())({publishKey:t.keys.publish_key,subscribeKey:t.keys.subscribe_key,userId:this.leadUserId,authKey:t.auth.result.token,origin:"meetelise.pubnubapi.com"}),this.withAuthToken((()=>new Promise((()=>this.handleChatListeners())))),await this.withAuthToken((()=>this.getChannelHistory())),this.pubnub):void 0}async fetchToken(e,n){try{return(await t().get(`${this.apiHost}/platformApi/webchat/pn/request-token?user_id=${e}&channel=${n}&${"healthcare"===this.widgetType?"industry=health_care":""}`)).data}catch(e){this.building&&ui({logTitle:"PUBNUB_ERROR_FETCHING_TOKEN",logData:{error:e},logType:li.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return null}async fetchChannelExists(e){try{return(await t().get(`${this.apiHost}/platformApi/webchat/check-channel-exists?channel_name=${e}`)).data}catch(e){this.building&&ui({logTitle:"PUBNUB_ERROR_FETCHING_CHANNEL_EXISTS",logData:{error:e},logType:li.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}return!1}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){this.building&&ui({logTitle:"PUBNUB_ERROR_REFETCHING_TOKEN",logData:{retryError:e},logType:li.error,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}}async getChannelHistory(e=1500){var t;try{let n=[],i=null;const r=100;for(let t=0;t<e;t+=r){const o=await new Promise(((n,o)=>{if(!this.pubnub||!this.channel)return[];const a=Math.min(r,e-t);this.pubnub.fetchMessages({channels:[this.channel],count:a,start:null!=i?i:void 0},((e,t)=>{e.error?o(e):n(t)}))})),a=o.channels[this.channel];if(!a)break;if(a.sort(((e,t)=>+e.timetoken-+t.timetoken)),!a||0===a.length)break;if(this.channel&&0!==Object.keys(o.channels).length){const e=o.channels[this.channel],t=[];e.forEach((e=>{e.uuid&&t.push({channel:e.channel,message:e.message,publisher:e.uuid,subscription:e.channel,timetoken:+e.timetoken})})),this.markEveryPreviousNoReplyMessageDone(t),n=n.concat(t.filter((e=>e.message.messageType!==Wr.noReply)))}if(i=a[0].timetoken,n.length>=e||a.length<r)break}this.rawPubnubMessages=n.slice(0,e),this.simpleChatMessages=this.translatePubnubMessagesIntoSimpleChatMessages(this.rawPubnubMessages),null===(t=this.chatListener)||void 0===t||t.call(this,{messages:this.simpleChatMessages,isLoading:!1})}catch(e){this.building&&ui({logTitle:"PUBNUB_WARN_FETCHING_HISTORY",logData:{error:e},logType:li.warn,buildingSlug:this.buildingSlug,orgSlug:this.orgSlug})}}shouldCreateAsDevState(){return location.href.startsWith("https://app.meetelise.com/settings/widgets")}},Yr=(e,t,n)=>{const i=`tel:${e}`,r=`sms:${e}`,o=`whatsapp://send?phone=${e}}`,a=`facetime:${e}`,s=`facetime-audio:${e}`,l=/\(\d{3}\)\s\d{3}-\d{4}/g,u=/(tel|sms):\(\d{3}\)\s\d{3}-\d{4}/g,d=/whatsapp:\/\/send\?phone=\d+/g,c=/(facetime|facetime-audio):\d+/g,p=document.body.getElementsByTagName("*");let h=!1;const f=e.replace(/(\d{3})(\d{3})(\d{4})/,"($1) $2-$3");let m=!1,g=!1;for(let e=0;e<p.length;e++)if(p[e].nodeType===Node.ELEMENT_NODE&&(1===p[e].childNodes.length&&p[e].childNodes[0].nodeType==Node.TEXT_NODE&&(p[e].innerHTML=p[e].innerHTML.replace(l,f),h=!0,m||(m=!0)),p[e].hasAttribute("href"))){const t=p[e].getAttribute("href");if(!t)continue;let n="",l=u;t.startsWith("sms:")?n=r:t.startsWith("whatsapp:")?(n=o,l=d):t.startsWith("facetime:")?(n=a,l=c):t.startsWith("facetime-audio:")?(n=s,l=c):n=i;const h=t.replace(l,n);p[e].setAttribute("href",h),g||(g=!0)}m&&ui({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"text-insertion",newPhoneNumber:f,website:window.location.href},logType:li.info,buildingSlug:n,orgSlug:t}),g&&ui({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"href-insertion",newPhoneNumber:f,website:window.location.href},logType:li.info,buildingSlug:n,orgSlug:t}),h||ui({logTitle:"DNI_WEBSITE_INSERTION",logData:{type:"no-phone-number-found",website:window.location.href},logType:li.warn,buildingSlug:n,orgSlug:t})};var $r=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Zr=class extends re{constructor(){super(...arguments),this.onClick=()=>{},this.brandColor=Me,this.toExpand=!1}render(){return U`
3244
3244
  <div
3245
3245
  class=${this.toExpand?"button-container mini":"button-container"}
3246
3246
  @click=${this.onClick}
@@ -4685,7 +4685,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
4685
4685
  line-height: 150%;
4686
4686
  font-size: 16px;
4687
4687
  }
4688
- `,_o([le({type:String})],Po.prototype,"healthcareId",void 0),_o([le({type:Number})],Po.prototype,"right",void 0),_o([le({type:Number})],Po.prototype,"bottom",void 0),_o([le({type:Number})],Po.prototype,"top",void 0),_o([le({type:Number})],Po.prototype,"left",void 0),_o([ue()],Po.prototype,"launcher",void 0),_o([ue()],Po.prototype,"currentLeadSource",void 0),_o([ue()],Po.prototype,"displayPubnubChat",void 0),_o([ue()],Po.prototype,"myPubnub",void 0),_o([ue()],Po.prototype,"requiresConsent",void 0),_o([ue()],Po.prototype,"privacyPolicyUrl",void 0),_o([ue()],Po.prototype,"isLoading",void 0),Po=_o([ae("health-chat")],Po);var Mo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Fo=class extends re{constructor(){super(...arguments),this.orgSlug="",this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=xe(),this.firstUpdated=async()=>{"test-company"===this.orgSlug&&await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=Gr(this.orgSlug),t=zr(this.orgSlug,e)?e:Hr(this.orgSlug,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new Xr(this.orgSlug,null,"",this.currentLeadSource,t.leadId,null,Uo.Utilities),t.initiatedChat&&await this.myPubnub.initializePubnub(e),pn()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),jr(this.orgSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return mr(),this.isLoading?U``:U`
4688
+ `,_o([le({type:String})],Po.prototype,"healthcareId",void 0),_o([le({type:Number})],Po.prototype,"right",void 0),_o([le({type:Number})],Po.prototype,"bottom",void 0),_o([le({type:Number})],Po.prototype,"top",void 0),_o([le({type:Number})],Po.prototype,"left",void 0),_o([ue()],Po.prototype,"launcher",void 0),_o([ue()],Po.prototype,"currentLeadSource",void 0),_o([ue()],Po.prototype,"displayPubnubChat",void 0),_o([ue()],Po.prototype,"myPubnub",void 0),_o([ue()],Po.prototype,"requiresConsent",void 0),_o([ue()],Po.prototype,"privacyPolicyUrl",void 0),_o([ue()],Po.prototype,"isLoading",void 0),Po=_o([ae("health-chat")],Po);var Mo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let Fo=class extends re{constructor(){super(...arguments),this.orgSlug="",this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=xe(),this.firstUpdated=async()=>{"test-company"===this.orgSlug&&await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=Gr(this.orgSlug),t=zr(this.orgSlug,e)?e:Hr(this.orgSlug,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new Xr(this.orgSlug,null,this.orgSlug,this.currentLeadSource,t.leadId,null,Uo.Utilities),t.initiatedChat&&await this.myPubnub.initializePubnub(e),pn()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),jr(this.orgSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return mr(),this.isLoading?U``:U`
4689
4689
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
4690
4690
  <div id="aria-describe-info" style="display: none;">
4691
4691
  EliseAI widget that allows you to chat with a virtual assistant, book
package/src/MyPubnub.ts CHANGED
@@ -548,6 +548,7 @@ class MyPubnub {
548
548
  customType: "lead_message",
549
549
  widgetType: this.widgetType,
550
550
  isDevState: this.shouldCreateAsDevState(),
551
+ orgSlug: this.orgSlug,
551
552
  },
552
553
  });
553
554
  } else {
@@ -150,7 +150,7 @@ export class UtilitiesChat extends LitElement {
150
150
  this.myPubnub = new MyPubnub(
151
151
  this.orgSlug,
152
152
  null,
153
- "",
153
+ this.orgSlug,
154
154
  this.currentLeadSource,
155
155
  updatedChatStorageKey.leadId,
156
156
  null,
@@ -379,7 +379,7 @@ export interface Options {
379
379
  position?: PositioningOptions;
380
380
  onWidgetLoaded?: () => void;
381
381
  overrideRentgrata?: boolean;
382
- widgetType?: WidgetType;
382
+ widgetType?: string;
383
383
  }
384
384
 
385
385
  export enum WidgetType {