@meetelise/chat 1.48.0 → 1.48.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.48.0",
3
+ "version": "1.48.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/MeetElise/chat-ui#readme",
@@ -815,6 +815,14 @@ var e={2:(e,t,n)=>{var i=n(2199),r=n(4664),o=n(5950);e.exports=function(e){retur
815
815
  target="_blank"
816
816
  rel="noopener noreferrer"
817
817
  >privacy policy</a
818
+ >
819
+ and these
820
+ <a
821
+ style=${Le(hi)}
822
+ href="https://eliseai.com/msgterms"
823
+ target="_blank"
824
+ rel="noopener noreferrer"
825
+ >terms and conditions</a
818
826
  >, including having your number and communications recorded and used by a
819
827
  third party.
820
828
  </div>`:t?B` <div style=${Le(di)}>
@@ -7387,4 +7395,4 @@ xmlns="http://www.w3.org/2000/svg"
7387
7395
  line-height: 150%;
7388
7396
  font-size: 16px;
7389
7397
  }
7390
- `,lu([ue({type:String})],uu.prototype,"orgSlug",void 0),lu([ue({type:Number})],uu.prototype,"right",void 0),lu([ue({type:Number})],uu.prototype,"bottom",void 0),lu([ue({type:Number})],uu.prototype,"top",void 0),lu([ue({type:Number})],uu.prototype,"left",void 0),lu([ce()],uu.prototype,"launcher",void 0),lu([ce()],uu.prototype,"currentLeadSource",void 0),lu([ce()],uu.prototype,"displayPubnubChat",void 0),lu([ce()],uu.prototype,"myPubnub",void 0),lu([ce()],uu.prototype,"requiresConsent",void 0),lu([ce()],uu.prototype,"privacyPolicyUrl",void 0),lu([ce()],uu.prototype,"isLoading",void 0),uu=lu([se("utilities-chat")],uu);const cu=async e=>{const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":e}});return Math.random()<.2&&Si({logType:i&&i.data?xi.info:xi.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:e,givenBuildingSlug:null,reason:i&&i.data?null:"No match found"}}),i.data},du=async(e,t=5e3)=>new Promise((n,i)=>{const r=new MutationObserver((t,i)=>{const r=document.getElementById(e);r&&(i.disconnect(),n(r))});r.observe(document.body,{childList:!0,subtree:!0});const o=setTimeout(()=>{r.disconnect(),i(new Error(`Element ${e} did not appear within ${t}ms`))},t),a=document.querySelector(e);a&&(clearTimeout(o),r.disconnect(),n(a))});class hu{static healthcareStart(e,t=!0){var n,i,r,o;t&&(this.healthcareId=e.id,this.overridePlacement={right:e.right,bottom:e.bottom,top:e.top,left:e.left}),gu();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","region"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),a.setAttribute("healthcareId",e.id),a.setAttribute("right",(null===(n=e.right)||void 0===n?void 0:n.toString())||"unset"),a.setAttribute("bottom",(null===(i=e.bottom)||void 0===i?void 0:i.toString())||"unset"),a.setAttribute("top",(null===(r=e.top)||void 0===r?void 0:r.toString())||"unset"),a.setAttribute("left",(null===(o=e.left)||void 0===o?void 0:o.toString())||"unset"),document.body.appendChild(a),hu.healthChat=a}static start(e,t=!0){var n,i,r,o,a,s,l,u;if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;if(t&&(this.orgSlug="Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||"",this.hasBuildingSlug=!!e.building,this.overridePlacement={right:null===(n=null==e?void 0:e.position)||void 0===n?void 0:n.right,bottom:null===(i=null==e?void 0:e.position)||void 0===i?void 0:i.bottom,top:null===(r=null==e?void 0:e.position)||void 0===r?void 0:r.top,left:null===(o=null==e?void 0:e.position)||void 0===o?void 0:o.left}),gu(),e.studio&&!e.building)return void this.handleStudioContext(e);let c=null;switch(e.widgetType){case fu.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case fu.Default:c=document.createElement("me-chat");break;case fu.Utilities:c=document.createElement("utilities-chat");break;default:c=document.createElement("me-chat")}if(!c)throw new Error("Invalid widget type");c.setAttribute("orgSlug","Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||""),c.setAttribute("widgetType",e.widgetType||fu.Default),c.setAttribute("class","meetelise-chat"),c.setAttribute("role","region"),c.setAttribute("aria-label","EliseAI Widget"),e.brandColor&&(this.brandColor=e.brandColor,c.setAttribute("primaryColor",((e,t)=>{const n=Be(e),i=0,r=0,o=0,a={r:n.r+Math.round((i-n.r)*t),g:n.g+Math.round((r-n.g)*t),b:n.b+Math.round((o-n.b)*t)};return je(a.r,a.g,a.b)})(e.brandColor,.3))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),c instanceof Jl&&(this.handleBuildingslug(c,e.organization,e.building,e),e.launcherStyles&&(c.launcherStyles=e.launcherStyles),e.mobileStyles&&(c.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(c.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await du("rg-widget-compact");e&&e.setAttribute("style","display: none")})(),c.overrideRentgrata=!0),e.onSstClose&&(c.onSstClose=e.onSstClose)),e.position&&(c.setAttribute("right",(null===(a=e.position.right)||void 0===a?void 0:a.toString())||"unset"),c.setAttribute("bottom",(null===(s=e.position.bottom)||void 0===s?void 0:s.toString())||"unset"),c.setAttribute("top",(null===(l=e.position.top)||void 0===l?void 0:l.toString())||"unset"),c.setAttribute("left",(null===(u=e.position.left)||void 0===u?void 0:u.toString())||"unset")),window.eliseAi={},document.body.appendChild(c),c instanceof Jl&&(hu.meChat=c),c instanceof uu&&(hu.utilitiesChat=c)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.studioUpdateToken+=1,await this.removeWidget(),this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.activeStudioOptions=null}static async removeWidget(){this.meChat&&(await this.meChat.remove(),document.body.removeChild(this.meChat),hu.meChat=null)}static handleStudioContext(e){e.studio&&(this.activeStudioOptions=e)}static updateStudioContext(e){const t=this.activeStudioOptions;if(!(null==t?void 0:t.studio))return;const n=++this.studioUpdateToken;if(e.siteId&&e.siteId!==t.studio.siteId)return void Si({logType:xi.warn,logTitle:"[STUDIO_WEBCHAT_CONTEXT_SITE_MISMATCH]",logData:{activeSiteId:t.studio.siteId,contextSiteId:e.siteId,url:window.location.href}});const i=pu(e.organization),r=pu(e.building);if(!i||!r)return void this.clearStudioContext({source:"elise_studio",reason:"missing_context",preserveCache:!0});const o=function(e,t){if(!(null==e?void 0:e.key))return`building:${t}`;return e.key}(e.sessionScope,r),a=function(e){return"Pacific Urban Residential"===e?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e}(i);this.activeStudioOrgSlug===a&&this.activeStudioBuildingSlug===r&&this.activeStudioSessionScopeKey===o||this.removeWidget().then(()=>{n===this.studioUpdateToken&&(this.activeStudioOrgSlug=a,this.activeStudioBuildingSlug=r,this.activeStudioSessionScopeKey=o,this.orgSlug=a,this.start({...t,organization:i,building:r},!1))})}static clearStudioContext(e){this.studioUpdateToken+=1,this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.removeWidget()}static async handleBuildingslug(e,t,n,i){if(n)return void e.setAttribute("buildingSlug",n);if(this.mutationObserver)return;if(!t)return;const r=await cu(t);if(r){const e={...i,organization:t,building:r};this.start(e,!1)}this.previousUrl=window.location.href,document.body.addEventListener("click",()=>{requestAnimationFrame(()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,cu(t).then(e=>{if(!e)return;const n={...i,organization:t,building:e};this.start(n,!1)}))})},!0)}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,t=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,n=await r().get(t,{headers:{"org-slug":this.orgSlug}});if(Math.random()<.2&&Si({logType:n&&n.data?xi.info:xi.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${n?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:n.data,url:e,orgSlug:this.orgSlug,givenBuildingSlug:null,reason:n&&n.data?null:"No match found"}}),!n||!n.data)return;const i={organization:this.orgSlug,building:n.data,brandColor:this.brandColor,backgroundColor:this.backgroundColor};this.start(i,!1)}static async calculateBuildingSlugForLogging(e){const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":this.orgSlug}});Math.random()<.2&&Si({logType:i&&i.data===e?xi.info:xi.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i&&i.data===e?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:this.orgSlug,givenBuildingSlug:e,reason:i&&i.data===e?null:i&&!i.data?"No match found":i&&i.data!==e?"Mismatch":"No match found"}}),i&&i.data}}function pu(e){return"string"!=typeof e?"":e.trim()}var fu;hu.meChat=null,hu.healthChat=null,hu.utilitiesChat=null,hu.orgSlug="",hu.mutationObserver=null,hu.previousUrl="",hu.hasBuildingSlug=null,hu.brandColor="",hu.backgroundColor="",hu.healthcareId="",hu.activeStudioOrgSlug="",hu.activeStudioBuildingSlug="",hu.activeStudioSessionScopeKey="",hu.activeStudioOptions=null,hu.studioUpdateToken=0,hu.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(fu||(fu={}));const gu=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)};export{fu as WidgetType,hu as default};
7398
+ `,lu([ue({type:String})],uu.prototype,"orgSlug",void 0),lu([ue({type:Number})],uu.prototype,"right",void 0),lu([ue({type:Number})],uu.prototype,"bottom",void 0),lu([ue({type:Number})],uu.prototype,"top",void 0),lu([ue({type:Number})],uu.prototype,"left",void 0),lu([ce()],uu.prototype,"launcher",void 0),lu([ce()],uu.prototype,"currentLeadSource",void 0),lu([ce()],uu.prototype,"displayPubnubChat",void 0),lu([ce()],uu.prototype,"myPubnub",void 0),lu([ce()],uu.prototype,"requiresConsent",void 0),lu([ce()],uu.prototype,"privacyPolicyUrl",void 0),lu([ce()],uu.prototype,"isLoading",void 0),uu=lu([se("utilities-chat")],uu);const cu=async e=>{const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":e}});return Math.random()<.2&&Si({logType:i&&i.data?xi.info:xi.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:e,givenBuildingSlug:null,reason:i&&i.data?null:"No match found"}}),i.data},du=async(e,t=5e3)=>new Promise((n,i)=>{const r=new MutationObserver((t,i)=>{const r=document.getElementById(e);r&&(i.disconnect(),n(r))});r.observe(document.body,{childList:!0,subtree:!0});const o=setTimeout(()=>{r.disconnect(),i(new Error(`Element ${e} did not appear within ${t}ms`))},t),a=document.querySelector(e);a&&(clearTimeout(o),r.disconnect(),n(a))});class hu{static healthcareStart(e,t=!0){var n,i,r,o;t&&(this.healthcareId=e.id,this.overridePlacement={right:e.right,bottom:e.bottom,top:e.top,left:e.left}),gu();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","region"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),a.setAttribute("healthcareId",e.id),a.setAttribute("right",(null===(n=e.right)||void 0===n?void 0:n.toString())||"unset"),a.setAttribute("bottom",(null===(i=e.bottom)||void 0===i?void 0:i.toString())||"unset"),a.setAttribute("top",(null===(r=e.top)||void 0===r?void 0:r.toString())||"unset"),a.setAttribute("left",(null===(o=e.left)||void 0===o?void 0:o.toString())||"unset"),document.body.appendChild(a),hu.healthChat=a}static start(e,t=!0){var n,i,r,o,a,s,l,u;if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;if(t&&(this.orgSlug="Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||"",this.hasBuildingSlug=!!e.building,this.overridePlacement={right:null===(n=null==e?void 0:e.position)||void 0===n?void 0:n.right,bottom:null===(i=null==e?void 0:e.position)||void 0===i?void 0:i.bottom,top:null===(r=null==e?void 0:e.position)||void 0===r?void 0:r.top,left:null===(o=null==e?void 0:e.position)||void 0===o?void 0:o.left}),gu(),e.studio&&!e.building)return void this.handleStudioContext(e);let c=null;switch(e.widgetType){case fu.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case fu.Default:c=document.createElement("me-chat");break;case fu.Utilities:c=document.createElement("utilities-chat");break;default:c=document.createElement("me-chat")}if(!c)throw new Error("Invalid widget type");c.setAttribute("orgSlug","Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization||""),c.setAttribute("widgetType",e.widgetType||fu.Default),c.setAttribute("class","meetelise-chat"),c.setAttribute("role","region"),c.setAttribute("aria-label","EliseAI Widget"),e.brandColor&&(this.brandColor=e.brandColor,c.setAttribute("primaryColor",((e,t)=>{const n=Be(e),i=0,r=0,o=0,a={r:n.r+Math.round((i-n.r)*t),g:n.g+Math.round((r-n.g)*t),b:n.b+Math.round((o-n.b)*t)};return je(a.r,a.g,a.b)})(e.brandColor,.3))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),c instanceof Jl&&(this.handleBuildingslug(c,e.organization,e.building,e),e.launcherStyles&&(c.launcherStyles=e.launcherStyles),e.mobileStyles&&(c.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(c.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await du("rg-widget-compact");e&&e.setAttribute("style","display: none")})(),c.overrideRentgrata=!0),e.onSstClose&&(c.onSstClose=e.onSstClose)),e.position&&(c.setAttribute("right",(null===(a=e.position.right)||void 0===a?void 0:a.toString())||"unset"),c.setAttribute("bottom",(null===(s=e.position.bottom)||void 0===s?void 0:s.toString())||"unset"),c.setAttribute("top",(null===(l=e.position.top)||void 0===l?void 0:l.toString())||"unset"),c.setAttribute("left",(null===(u=e.position.left)||void 0===u?void 0:u.toString())||"unset")),window.eliseAi={},document.body.appendChild(c),c instanceof Jl&&(hu.meChat=c),c instanceof uu&&(hu.utilitiesChat=c)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.studioUpdateToken+=1,await this.removeWidget(),this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.activeStudioOptions=null}static async removeWidget(){var e;if(!this.meChat)return;const t=this.meChat;await t.remove(),null===(e=t.parentNode)||void 0===e||e.removeChild(t),hu.meChat=null}static handleStudioContext(e){e.studio&&(this.activeStudioOptions=e)}static updateStudioContext(e){const t=this.activeStudioOptions;if(!(null==t?void 0:t.studio))return;const n=++this.studioUpdateToken;if(e.siteId&&e.siteId!==t.studio.siteId)return void Si({logType:xi.warn,logTitle:"[STUDIO_WEBCHAT_CONTEXT_SITE_MISMATCH]",logData:{activeSiteId:t.studio.siteId,contextSiteId:e.siteId,url:window.location.href}});const i=pu(e.organization),r=pu(e.building);if(!i||!r)return void this.clearStudioContext({source:"elise_studio",reason:"missing_context",preserveCache:!0});const o=function(e,t){if(!(null==e?void 0:e.key))return`building:${t}`;return e.key}(e.sessionScope,r),a=function(e){return"Pacific Urban Residential"===e?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e}(i);this.activeStudioOrgSlug===a&&this.activeStudioBuildingSlug===r&&this.activeStudioSessionScopeKey===o||this.removeWidget().then(()=>{n===this.studioUpdateToken&&(this.activeStudioOrgSlug=a,this.activeStudioBuildingSlug=r,this.activeStudioSessionScopeKey=o,this.orgSlug=a,this.start({...t,organization:i,building:r},!1))})}static clearStudioContext(e){this.studioUpdateToken+=1,this.activeStudioOrgSlug="",this.activeStudioBuildingSlug="",this.activeStudioSessionScopeKey="",this.removeWidget()}static async handleBuildingslug(e,t,n,i){if(n)return void e.setAttribute("buildingSlug",n);if(this.mutationObserver)return;if(!t)return;const r=await cu(t);if(r){const e={...i,organization:t,building:r};this.start(e,!1)}this.previousUrl=window.location.href,document.body.addEventListener("click",()=>{requestAnimationFrame(()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,cu(t).then(e=>{if(!e)return;const n={...i,organization:t,building:e};this.start(n,!1)}))})},!0)}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,t=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,n=await r().get(t,{headers:{"org-slug":this.orgSlug}});if(Math.random()<.2&&Si({logType:n&&n.data?xi.info:xi.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${n?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:n.data,url:e,orgSlug:this.orgSlug,givenBuildingSlug:null,reason:n&&n.data?null:"No match found"}}),!n||!n.data)return;const i={organization:this.orgSlug,building:n.data,brandColor:this.brandColor,backgroundColor:this.backgroundColor};this.start(i,!1)}static async calculateBuildingSlugForLogging(e){const t=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(t)}`,i=await r().get(n,{headers:{"org-slug":this.orgSlug}});Math.random()<.2&&Si({logType:i&&i.data===e?xi.info:xi.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${i&&i.data===e?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:i.data,url:t,orgSlug:this.orgSlug,givenBuildingSlug:e,reason:i&&i.data===e?null:i&&!i.data?"No match found":i&&i.data!==e?"Mismatch":"No match found"}}),i&&i.data}}function pu(e){return"string"!=typeof e?"":e.trim()}var fu;hu.meChat=null,hu.healthChat=null,hu.utilitiesChat=null,hu.orgSlug="",hu.mutationObserver=null,hu.previousUrl="",hu.hasBuildingSlug=null,hu.brandColor="",hu.backgroundColor="",hu.healthcareId="",hu.activeStudioOrgSlug="",hu.activeStudioBuildingSlug="",hu.activeStudioSessionScopeKey="",hu.activeStudioOptions=null,hu.studioUpdateToken=0,hu.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(fu||(fu={}));const gu=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)};export{fu as WidgetType,hu as default};
@@ -74,10 +74,19 @@ const formDisclaimer = ({
74
74
  target="_blank"
75
75
  rel="noopener noreferrer"
76
76
  >privacy policy</a
77
+ >
78
+ and these
79
+ <a
80
+ style=${styleMap(disclaimerStyles.link)}
81
+ href="https://eliseai.com/msgterms"
82
+ target="_blank"
83
+ rel="noopener noreferrer"
84
+ >terms and conditions</a
77
85
  >, including having your number and communications recorded and used by a
78
86
  third party.
79
87
  </div>`;
80
88
  }
89
+
81
90
  if (emailInput) {
82
91
  return html` <div style=${styleMap(disclaimerStyles.container)}>
83
92
  By entering your email and clicking ${clickingButtonText}, you consent to
@@ -49,6 +49,25 @@ afterEach(() => {
49
49
  restore();
50
50
  });
51
51
 
52
+ it("does not throw when removing a widget that already detached itself", async function () {
53
+ const element = document.createElement("me-chat");
54
+ document.body.appendChild(element);
55
+
56
+ (MEChat as unknown as { meChat: HTMLElement | null }).meChat = element;
57
+
58
+ await (
59
+ MEChat as unknown as { removeWidget: () => Promise<void> }
60
+ ).removeWidget();
61
+
62
+ expect((MEChat as unknown as { meChat: HTMLElement | null }).meChat).to.equal(
63
+ null
64
+ );
65
+
66
+ await (
67
+ MEChat as unknown as { removeWidget: () => Promise<void> }
68
+ ).removeWidget();
69
+ });
70
+
52
71
  it.skip("shows the launcher", async function () {
53
72
  // Given an API that returns this building theme
54
73
  stub(window, "fetch").resolves(stubResponse);
@@ -279,8 +279,9 @@ export default class MEChat {
279
279
  if (!this.meChat) {
280
280
  return;
281
281
  }
282
- await this.meChat.remove();
283
- document.body.removeChild(this.meChat);
282
+ const meChat = this.meChat;
283
+ await meChat.remove();
284
+ meChat.parentNode?.removeChild(meChat);
284
285
  MEChat.meChat = null;
285
286
  }
286
287