@meetelise/chat 1.13.0 → 1.13.1

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.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "public/dist/index.js",
@@ -1953,7 +1953,7 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
1953
1953
  </div>
1954
1954
  `}
1955
1955
  </div>
1956
- `}};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=An(),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=An(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;return window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",ei),D`
1956
+ `}};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=An(),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=An(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 3660!==(null===(e=this.building)||void 0===e?void 0:e.id)?D``:(window.customElements.get("meetelise-launcher")||window.customElements.define("meetelise-launcher",ei),D`
1957
1957
  <div
1958
1958
  class=${ce({launcherContainer:!0,launcher__mobile:this.isMobile,launcher__desktop:!this.isMobile,"meetelise-chat":!0,launcher:!0,shouldBeVisible:!0})}
1959
1959
  >
@@ -1962,18 +1962,18 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
1962
1962
  .isMobile=${this.isMobile}
1963
1963
  .isFirstMount=${!this.hasMounted}
1964
1964
  .isMini=${this.useMiniWidget}
1965
- .buildingId=${null!==(t=null===(e=this.building)||void 0===e?void 0:e.id)&&void 0!==t?t:0}
1966
- .layoutOptions=${null!==(i=null===(n=this.building)||void 0===n?void 0:n.layoutOptions)&&void 0!==i?i:[]}
1967
- .tourTypeOptions=${null!==(o=null===(r=this.building)||void 0===r?void 0:r.tourTypeOptions)&&void 0!==o?o:[]}
1965
+ .buildingId=${null!==(n=null===(t=this.building)||void 0===t?void 0:t.id)&&void 0!==n?n:0}
1966
+ .layoutOptions=${null!==(r=null===(i=this.building)||void 0===i?void 0:i.layoutOptions)&&void 0!==r?r:[]}
1967
+ .tourTypeOptions=${null!==(a=null===(o=this.building)||void 0===o?void 0:o.tourTypeOptions)&&void 0!==a?a:[]}
1968
1968
  .launcherStyles=${this.launcherStyles}
1969
- phoneNumber="${null!==(s=null===(a=this.building)||void 0===a?void 0:a.phoneNumber)&&void 0!==s?s:""}"
1969
+ phoneNumber="${null!==(u=null===(s=this.building)||void 0===s?void 0:s.phoneNumber)&&void 0!==u?u:""}"
1970
1970
  textColor="${this.theme.chatHeader.textColor}"
1971
1971
  backgroundColor="${this.theme.chatPaneBackgroundColor}"
1972
1972
  ?hidden=${this.hideLauncher}
1973
1973
  >
1974
1974
  </meetelise-launcher>
1975
1975
  </div>
1976
- `}};gi.styles=a`
1976
+ `)}};gi.styles=a`
1977
1977
  :host {
1978
1978
  all: initial;
1979
1979
  }
@@ -1986,4 +1986,4 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
1986
1986
  width: 100%;
1987
1987
  height: 100px;
1988
1988
  }
1989
- `,gi.session=Oe.ready.then((()=>{const e=new Oe.User({id:"anonymous",name:"Me",email:null,role:"Default"});return new Oe.Session({appId:"ogKIvCor",me:e})})),vi([oe({type:String})],gi.prototype,"buildingSlug",void 0),vi([oe({type:String})],gi.prototype,"orgSlug",void 0),vi([oe({type:String})],gi.prototype,"themeId",void 0),vi([oe({attribute:!1})],gi.prototype,"avatarSrc",void 0),vi([oe({type:Boolean})],gi.prototype,"useMiniWidget",void 0),vi([oe()],gi.prototype,"launcherStyles",void 0),vi([ae()],gi.prototype,"popup",void 0),vi([ae()],gi.prototype,"theme",void 0),vi([ae()],gi.prototype,"chatId",void 0),vi([ae()],gi.prototype,"analytics",void 0),vi([ae()],gi.prototype,"isMobile",void 0),vi([ae()],gi.prototype,"launcher",void 0),vi([ae()],gi.prototype,"building",void 0),vi([ae()],gi.prototype,"hasMounted",void 0),vi([ae()],gi.prototype,"hideLauncher",void 0),gi=mi=vi([ie("me-chat")],gi);class yi{static start(e){wi();const t=document.createElement("me-chat");t.setAttribute("orgSlug",e.organization),t.setAttribute("buildingSlug",e.building),t.setAttribute("class","meetelise-chat"),e.themeId&&t.setAttribute("themeId",e.themeId),e.avatarSrc&&t.setAttribute("avatarSrc",e.avatarSrc),void 0!==e.mini&&(t.useMiniWidget=e.mini),e.launcherStyles&&(t.launcherStyles=e.launcherStyles),document.body.appendChild(t),yi.meChat=t}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}}yi.meChat=null;const wi=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),e.setAttribute("href","https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;900&display=swap"),document.head.appendChild(e)}})();var r=i.Z;export{r as default};
1989
+ `,gi.session=Oe.ready.then((()=>{const e=new Oe.User({id:"anonymous",name:"Me",email:null,role:"Default"});return new Oe.Session({appId:"ogKIvCor",me:e})})),vi([oe({type:String})],gi.prototype,"buildingSlug",void 0),vi([oe({type:String})],gi.prototype,"orgSlug",void 0),vi([oe({type:String})],gi.prototype,"themeId",void 0),vi([oe({attribute:!1})],gi.prototype,"avatarSrc",void 0),vi([oe({type:Boolean})],gi.prototype,"useMiniWidget",void 0),vi([oe()],gi.prototype,"launcherStyles",void 0),vi([ae()],gi.prototype,"popup",void 0),vi([ae()],gi.prototype,"theme",void 0),vi([ae()],gi.prototype,"chatId",void 0),vi([ae()],gi.prototype,"analytics",void 0),vi([ae()],gi.prototype,"isMobile",void 0),vi([ae()],gi.prototype,"launcher",void 0),vi([ae()],gi.prototype,"building",void 0),vi([ae()],gi.prototype,"hasMounted",void 0),vi([ae()],gi.prototype,"hideLauncher",void 0),gi=mi=vi([ie("me-chat")],gi);class yi{static start(e){wi(),bi();const t=document.createElement("me-chat");t.setAttribute("orgSlug",e.organization),t.setAttribute("buildingSlug",e.building),t.setAttribute("class","meetelise-chat"),e.themeId&&t.setAttribute("themeId",e.themeId),e.avatarSrc&&t.setAttribute("avatarSrc",e.avatarSrc),void 0!==e.mini&&(t.useMiniWidget=e.mini),e.launcherStyles&&(t.launcherStyles=e.launcherStyles),document.body.appendChild(t),yi.meChat=t}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}}yi.meChat=null;const wi=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),e.setAttribute("href","https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;900&display=swap"),document.head.appendChild(e)},bi=()=>{const e=document.createElement("meta");e.setAttribute("name","viewport"),e.setAttribute("content","width=device-width, initial-scale=1, maximum-scale=1"),document.head.appendChild(e)}})();var r=i.Z;export{r as default};
package/src/MEChat.ts CHANGED
@@ -20,6 +20,7 @@ export default class MEChat {
20
20
 
21
21
  static start(opts: Options): void {
22
22
  installFont();
23
+ installTalkjsMobileStyleFix();
23
24
  const meChat = document.createElement("me-chat");
24
25
  meChat.setAttribute("orgSlug", opts.organization);
25
26
  meChat.setAttribute("buildingSlug", opts.building);
@@ -68,3 +69,13 @@ const installFont = () => {
68
69
  );
69
70
  document.head.appendChild(link);
70
71
  };
72
+
73
+ const installTalkjsMobileStyleFix = () => {
74
+ const metaTag = document.createElement("meta");
75
+ metaTag.setAttribute("name", "viewport");
76
+ metaTag.setAttribute(
77
+ "content",
78
+ "width=device-width, initial-scale=1, maximum-scale=1"
79
+ );
80
+ document.head.appendChild(metaTag);
81
+ };
@@ -263,6 +263,9 @@ export class MEChat extends LitElement {
263
263
  };
264
264
 
265
265
  render(): TemplateResult {
266
+ if (this.building?.id !== 3660) {
267
+ return html``;
268
+ }
266
269
  installLauncher();
267
270
 
268
271
  return html`