@meetelise/chat 1.15.1 → 1.15.2

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.15.1",
3
+ "version": "1.15.2",
4
4
  "description": "",
5
5
  "main": "public/dist/index.js",
6
6
  "type": "module",
@@ -1958,7 +1958,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
1958
1958
  </div>
1959
1959
  `}
1960
1960
  </div>
1961
- `}};ei.styles=Mn,Yn([oe({type:Boolean})],ei.prototype,"isMobile",void 0),Yn([oe({type:Boolean})],ei.prototype,"isFirstMount",void 0),Yn([oe()],ei.prototype,"backgroundColor",void 0),Yn([oe()],ei.prototype,"textColor",void 0),Yn([oe({type:Boolean})],ei.prototype,"isMini",void 0),Yn([oe()],ei.prototype,"phoneNumber",void 0),Yn([oe({attribute:!1})],ei.prototype,"buildingId",void 0),Yn([oe({type:Boolean})],ei.prototype,"hasEmailEnabled",void 0),Yn([oe({type:Boolean})],ei.prototype,"hasSSTEnabled",void 0),Yn([oe({type:Boolean})],ei.prototype,"hasTextUsEnabled",void 0),Yn([oe({attribute:!1})],ei.prototype,"layoutOptions",void 0),Yn([oe({attribute:!1})],ei.prototype,"tourTypeOptions",void 0),Yn([oe({attribute:!1})],ei.prototype,"onChatTapped",void 0),Yn([oe()],ei.prototype,"launcherStyles",void 0),Yn([ae()],ei.prototype,"isEmailWindowOpen",void 0),Yn([ae()],ei.prototype,"isCallUsWindowOpen",void 0),Yn([ae()],ei.prototype,"isSSTWindowOpen",void 0),Yn([ae()],ei.prototype,"isTextUsWindowOpen",void 0),ei=Yn([ie("meetelise-launcher")],ei);var ti=n(3379),ni=n.n(ti),ii=n(7795),ri=n.n(ii),oi=n(569),ai=n.n(oi),si=n(3565),ui=n.n(si),li=n(9216),di=n.n(li),ci=n(4589),pi=n.n(ci),fi=n(3631),hi={};hi.styleTagTransform=pi(),hi.setAttributes=ui(),hi.insert=ai().bind(null,"head"),hi.domAPI=ri(),hi.insertStyleElement=di(),ni()(fi.Z,hi),fi.Z&&fi.Z.locals&&fi.Z.locals;var mi,vi=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 gi=mi=class extends te{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.useMiniWidget=!0,this.launcherStyles={},this.popup=null,this.theme=Cn(),this.chatId="",this.analytics=null,this.isMobile=rn(),this.launcher=null,this.building=null,this.hasMounted=!1,this.hideLauncher=!1,this.yardiDNIScriptInterval=null,this.launcherRef=be(),this.initializeInstanceVariables=async()=>{await this.setBuildingDerivedInfo(),await this.initializeLaunchJS(),this.attachOnClickToLauncher()},this.setBuildingDerivedInfo=async()=>{var e;this.buildingSlug&&this.orgSlug&&(this.building=await async function(e,t){const n=`https://app.meetelise.com/api/pub/v1/organization/${e}/building/${t}`,i=await fetch(n);return await i.json()}(this.orgSlug,this.buildingSlug),Yt(this.building.id),this.chatId=function(e,t){const n=Tn(e,t),i=localStorage.getItem(n);return i&&!function(e,t){const n=xn(e,t),i=localStorage.getItem(n)||Sn(e,t),r=new Date(new Date(i).getTime()+864e5);return new Date>r}(e,t)?i:bn(e,t)}(this.orgSlug,this.buildingSlug),this.avatarSrc=this.avatarSrc||this.building.avatarSrc,this.theme=Cn(null!==(e=this.themeId)&&void 0!==e?e:this.building.themeId),this.analytics=new cn(this.orgSlug,this.buildingSlug,this.chatId))},this.initializeLaunchJS=async()=>{if(!this.building||!this.theme)return;if(this.popup&&this.launcher)return;const[e,t,n,i]=await Promise.all([this.building,this.theme,this.avatarSrc,mi.session]);if(e.conversationMaintenanceMode)return new Promise((()=>{console.warn("MeetElise Chat is in maintenance mode. Chat icon will not appear.")}));await this.configureTalkJSPopup(e,t,i,n),this.configureLauncherElement(),this.yardiDNIScriptInterval=setInterval((()=>this.pollForYardiCampaignSource()),1e3),setTimeout(clearInterval,15e3,this.yardiDNIScriptInterval)},this.configureLauncherElement=()=>{this.popup&&this.launcherRef.value&&(this.launcher=this.launcherRef.value)},this.configureTalkJSPopup=async(e,t,n,i)=>{const r=n.createPopup(_n(n,e,t,i||e.avatarSrc,this.chatId,this.isMobile),{launcher:"never",showCloseInHeader:!0,messageField:{placeholder:"Ask a question..."}});await r.mount({show:!1}),r.on("close",(()=>{this.hideLauncher=!1}));const o=document.querySelector(".__talkjs_popup");if(!o)throw new Error("Failed to find chat window");o.classList.add("meetelise-chat","pane"),this.isMobile||o.classList.add("launcher__desktop"),o.style.zIndex="99999999999",this.popup=r},this.firstUpdated=()=>{this.initializeInstanceVariables()},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{var e;this.popup&&(this.popup.show(),null===(e=this.analytics)||void 0===e||e.ping("open"),this.hideLauncher=!0,this.hasMounted=!0)})}}pollForYardiCampaignSource(){var e,t,n;(null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&(null===(n=this.analytics)||void 0===n||n.ping("yardi-DNI-init"),this.yardiDNIScriptInterval&&clearInterval(this.yardiDNIScriptInterval))}async restartConversation(){if(!(this.analytics&&this.analytics.chatId&&this.building&&this.popup&&mi.session))return;this.chatId=bn(this.orgSlug,this.buildingSlug);const e=await mi.session;this.analytics.chatId=this.chatId,this.popup.select(_n(e,this.building,this.theme,this.avatarSrc||this.building.avatarSrc,this.chatId,this.isMobile))}remove(){var e;null===(e=this.popup)||void 0===e||e.destroy()}open(){var e;null===(e=this.popup)||void 0===e||e.show()}close(){var e;null===(e=this.popup)||void 0===e||e.hide()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}render(){var e,t,n,i,r,o,a,s,u;return 4930===(null===(e=this.building)||void 0===e?void 0:e.id)?D``:(window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",ei),D`
1961
+ `}};ei.styles=Mn,Yn([oe({type:Boolean})],ei.prototype,"isMobile",void 0),Yn([oe({type:Boolean})],ei.prototype,"isFirstMount",void 0),Yn([oe()],ei.prototype,"backgroundColor",void 0),Yn([oe()],ei.prototype,"textColor",void 0),Yn([oe({type:Boolean})],ei.prototype,"isMini",void 0),Yn([oe()],ei.prototype,"phoneNumber",void 0),Yn([oe({attribute:!1})],ei.prototype,"buildingId",void 0),Yn([oe({type:Boolean})],ei.prototype,"hasEmailEnabled",void 0),Yn([oe({type:Boolean})],ei.prototype,"hasSSTEnabled",void 0),Yn([oe({type:Boolean})],ei.prototype,"hasTextUsEnabled",void 0),Yn([oe({attribute:!1})],ei.prototype,"layoutOptions",void 0),Yn([oe({attribute:!1})],ei.prototype,"tourTypeOptions",void 0),Yn([oe({attribute:!1})],ei.prototype,"onChatTapped",void 0),Yn([oe()],ei.prototype,"launcherStyles",void 0),Yn([ae()],ei.prototype,"isEmailWindowOpen",void 0),Yn([ae()],ei.prototype,"isCallUsWindowOpen",void 0),Yn([ae()],ei.prototype,"isSSTWindowOpen",void 0),Yn([ae()],ei.prototype,"isTextUsWindowOpen",void 0),ei=Yn([ie("meetelise-launcher")],ei);var ti=n(3379),ni=n.n(ti),ii=n(7795),ri=n.n(ii),oi=n(569),ai=n.n(oi),si=n(3565),ui=n.n(si),li=n(9216),di=n.n(li),ci=n(4589),pi=n.n(ci),fi=n(3631),hi={};hi.styleTagTransform=pi(),hi.setAttributes=ui(),hi.insert=ai().bind(null,"head"),hi.domAPI=ri(),hi.insertStyleElement=di(),ni()(fi.Z,hi),fi.Z&&fi.Z.locals&&fi.Z.locals;var mi,vi=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 gi=mi=class extends te{constructor(){super(...arguments),this.buildingSlug="",this.orgSlug="",this.useMiniWidget=!0,this.launcherStyles={},this.popup=null,this.theme=Cn(),this.chatId="",this.analytics=null,this.isMobile=rn(),this.launcher=null,this.building=null,this.hasMounted=!1,this.hideLauncher=!1,this.yardiDNIScriptInterval=null,this.launcherRef=be(),this.initializeInstanceVariables=async()=>{await this.setBuildingDerivedInfo(),await this.initializeLaunchJS(),this.attachOnClickToLauncher()},this.setBuildingDerivedInfo=async()=>{var e;this.buildingSlug&&this.orgSlug&&(this.building=await async function(e,t){const n=`https://app.meetelise.com/api/pub/v1/organization/${e}/building/${t}`,i=await fetch(n);return await i.json()}(this.orgSlug,this.buildingSlug),Yt(this.building.id),this.chatId=function(e,t){const n=Tn(e,t),i=localStorage.getItem(n);return i&&!function(e,t){const n=xn(e,t),i=localStorage.getItem(n)||Sn(e,t),r=new Date(new Date(i).getTime()+864e5);return new Date>r}(e,t)?i:bn(e,t)}(this.orgSlug,this.buildingSlug),this.avatarSrc=this.avatarSrc||this.building.avatarSrc,this.theme=Cn(null!==(e=this.themeId)&&void 0!==e?e:this.building.themeId),this.analytics=new cn(this.orgSlug,this.buildingSlug,this.chatId))},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,mi.session]);if(t.conversationMaintenanceMode)return new Promise((()=>{console.warn("MeetElise Chat is in maintenance mode. Chat icon will not appear.")}));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)},this.configureLauncherElement=()=>{this.popup&&this.launcherRef.value&&(this.launcher=this.launcherRef.value)},this.configureTalkJSPopup=async(e,t,n,i)=>{const r=n.createPopup(_n(n,e,t,i||e.avatarSrc,this.chatId,this.isMobile),{launcher:"never",showCloseInHeader:!0,messageField:{placeholder:"Ask a question..."}});await r.mount({show:!1}),r.on("close",(()=>{this.hideLauncher=!1}));const o=document.querySelector(".__talkjs_popup");if(!o)throw new Error("Failed to find chat window");o.classList.add("meetelise-chat","pane"),this.isMobile||o.classList.add("launcher__desktop"),o.style.zIndex="99999999999",this.popup=r},this.firstUpdated=()=>{this.initializeInstanceVariables()},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{var e;this.popup&&(this.popup.show(),null===(e=this.analytics)||void 0===e||e.ping("open"),this.hideLauncher=!0,this.hasMounted=!0)})}}pollForYardiCampaignSource(){var e,t,n;(null===(t=null===(e=window.RCTPCampaign)||void 0===e?void 0:e.CampaignDetails)||void 0===t?void 0:t.Source)&&(null===(n=this.analytics)||void 0===n||n.ping("yardi-DNI-init"),this.yardiDNIScriptInterval&&clearInterval(this.yardiDNIScriptInterval))}async restartConversation(){if(!(this.analytics&&this.analytics.chatId&&this.building&&this.popup&&mi.session))return;this.chatId=bn(this.orgSlug,this.buildingSlug);const e=await mi.session;this.analytics.chatId=this.chatId,this.popup.select(_n(e,this.building,this.theme,this.avatarSrc||this.building.avatarSrc,this.chatId,this.isMobile))}remove(){var e;null===(e=this.popup)||void 0===e||e.destroy()}open(){var e;null===(e=this.popup)||void 0===e||e.show()}close(){var e;null===(e=this.popup)||void 0===e||e.hide()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}render(){var e,t,n,i,r,o,a,s,u;return 4930===(null===(e=this.building)||void 0===e?void 0:e.id)?D``:(window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",ei),D`
1962
1962
  <div
1963
1963
  class=${ce({launcherContainer:!0,launcher__mobile:this.isMobile,launcher__desktop:!this.isMobile,"meetelise-chat":!0,launcher:!0,shouldBeVisible:!0})}
1964
1964
  >
@@ -136,6 +136,8 @@ export class MEChat extends LitElement {
136
136
  await this.configureTalkJSPopup(building, theme, session, avatarSrc);
137
137
  this.configureLauncherElement();
138
138
 
139
+ this.analytics?.ping("load");
140
+
139
141
  this.yardiDNIScriptInterval = setInterval(
140
142
  () => this.pollForYardiCampaignSource(),
141
143
  1000