@meetelise/chat 1.20.71 → 1.20.72
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 +1 -1
- package/public/dist/index.js +1 -1
- package/src/MEChat.ts +0 -5
package/package.json
CHANGED
package/public/dist/index.js
CHANGED
|
@@ -2956,4 +2956,4 @@ var e={8005:function(e,t,n){var i,r=this&&this.__extends||(i=function(e,t){retur
|
|
|
2956
2956
|
border-bottom: 22px solid transparent;
|
|
2957
2957
|
border-right: 30px solid black;
|
|
2958
2958
|
}
|
|
2959
|
-
`,vr.session=Re.ready.then((()=>{const e=new Re.User({id:"anonymous",name:"Me",email:null,role:"Default"});return new Re.Session({appId:"ogKIvCor",me:e})})),mr([de({type:String})],vr.prototype,"buildingSlug",void 0),mr([de({type:String})],vr.prototype,"orgSlug",void 0),mr([de({type:String})],vr.prototype,"themeId",void 0),mr([de({attribute:!1})],vr.prototype,"avatarSrc",void 0),mr([de({type:Boolean})],vr.prototype,"useMiniWidget",void 0),mr([de({type:Object})],vr.prototype,"launcherStyles",void 0),mr([de({type:Boolean})],vr.prototype,"isMinimized",void 0),mr([de({type:String})],vr.prototype,"brandColor",void 0),mr([ce()],vr.prototype,"popup",void 0),mr([ce()],vr.prototype,"theme",void 0),mr([ce()],vr.prototype,"chatId",void 0),mr([ce()],vr.prototype,"analytics",void 0),mr([ce()],vr.prototype,"isMobile",void 0),mr([ce()],vr.prototype,"launcher",void 0),mr([ce()],vr.prototype,"building",void 0),mr([ce()],vr.prototype,"buildingABTestType",void 0),mr([ce()],vr.prototype,"leadSources",void 0),mr([ce()],vr.prototype,"currentLeadSource",void 0),mr([ce()],vr.prototype,"featureFlagShowDropdown",void 0),mr([ce()],vr.prototype,"phoneNumberForSource",void 0),mr([ce()],vr.prototype,"hasMounted",void 0),mr([ce()],vr.prototype,"hideLauncher",void 0),mr([ce()],vr.prototype,"isLoading",void 0),mr([ce()],vr.prototype,"talkjsPopupElement",void 0),vr=hr=mr([ue("me-chat")],vr);class gr{static start(e,t=!0){if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;t&&(this.orgSlug=e.organization,this.hasBuildingSlug=!!e.building),yr(),br();const n=document.createElement("me-chat");n.setAttribute("orgSlug",e.organization),this.handleBuildingslug(n,e.building),n.setAttribute("class","meetelise-chat"),n.setAttribute("role","dialog"),n.setAttribute("aria-label","EliseAI Widget"),n.setAttribute("aria-describedby","aria-describe-info"),n.setAttribute("aria-modal","true"),e.themeId&&n.setAttribute("themeId",e.themeId),e.avatarSrc&&n.setAttribute("avatarSrc",e.avatarSrc),void 0!==e.mini&&(n.useMiniWidget=e.mini),e.launcherStyles&&(n.launcherStyles=e.launcherStyles),e.brandColor&&(this.brandColor=e.brandColor,n.setAttribute("brandColor",((e,t)=>{const n=(r=e,{r:parseInt(r.substring(1,3),16),g:parseInt(r.substring(3,5),16),b:parseInt(r.substring(5,7),16)}),i={r:n.r+Math.round(.3*(0-n.r)),g:n.g+Math.round(.3*(0-n.g)),b:n.b+Math.round(.3*(0-n.b))};var r;return((e,t,n)=>"#"+[e,t,n].map((e=>{const t=e.toString(16);return 1===t.length?"0"+t:t})).join(""))(i.r,i.g,i.b)})(e.brandColor))),document.body.appendChild(n),gr.meChat=n,e.building&&e.organization&&wr(e.organization,e.building)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.meChat&&(await this.meChat.remove(),document.body.removeChild(this.meChat),gr.meChat=null)}static async handleBuildingslug(e,t){t?e.setAttribute("buildingSlug",t):this.mutationObserver||(this.handleSingleFamilyUrl(),this.previousUrl=window.location.href,document.body.addEventListener("click",(()=>{requestAnimationFrame((()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,this.handleSingleFamilyUrl())}))}),!0))}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,i=await t().get(n,{headers:{"org-slug":this.orgSlug}});if(!i||!i.data)return;const r={organization:this.orgSlug,building:i.data,brandColor:this.brandColor};this.start(r,!1)}}gr.meChat=null,gr.orgSlug="",gr.mutationObserver=null,gr.previousUrl="",gr.hasBuildingSlug=null,gr.brandColor="";const yr=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)},br=()=>{const e=document.createElement("meta");e.setAttribute("name","viewport"),e.setAttribute("content","width=device-width, initial-scale=1, maximum-scale=2"),document.head.appendChild(e)},wr=async(e,n)=>{var i;
|
|
2959
|
+
`,vr.session=Re.ready.then((()=>{const e=new Re.User({id:"anonymous",name:"Me",email:null,role:"Default"});return new Re.Session({appId:"ogKIvCor",me:e})})),mr([de({type:String})],vr.prototype,"buildingSlug",void 0),mr([de({type:String})],vr.prototype,"orgSlug",void 0),mr([de({type:String})],vr.prototype,"themeId",void 0),mr([de({attribute:!1})],vr.prototype,"avatarSrc",void 0),mr([de({type:Boolean})],vr.prototype,"useMiniWidget",void 0),mr([de({type:Object})],vr.prototype,"launcherStyles",void 0),mr([de({type:Boolean})],vr.prototype,"isMinimized",void 0),mr([de({type:String})],vr.prototype,"brandColor",void 0),mr([ce()],vr.prototype,"popup",void 0),mr([ce()],vr.prototype,"theme",void 0),mr([ce()],vr.prototype,"chatId",void 0),mr([ce()],vr.prototype,"analytics",void 0),mr([ce()],vr.prototype,"isMobile",void 0),mr([ce()],vr.prototype,"launcher",void 0),mr([ce()],vr.prototype,"building",void 0),mr([ce()],vr.prototype,"buildingABTestType",void 0),mr([ce()],vr.prototype,"leadSources",void 0),mr([ce()],vr.prototype,"currentLeadSource",void 0),mr([ce()],vr.prototype,"featureFlagShowDropdown",void 0),mr([ce()],vr.prototype,"phoneNumberForSource",void 0),mr([ce()],vr.prototype,"hasMounted",void 0),mr([ce()],vr.prototype,"hideLauncher",void 0),mr([ce()],vr.prototype,"isLoading",void 0),mr([ce()],vr.prototype,"talkjsPopupElement",void 0),vr=hr=mr([ue("me-chat")],vr);class gr{static start(e,t=!0){if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;t&&(this.orgSlug=e.organization,this.hasBuildingSlug=!!e.building),yr(),br();const n=document.createElement("me-chat");n.setAttribute("orgSlug",e.organization),this.handleBuildingslug(n,e.building),n.setAttribute("class","meetelise-chat"),n.setAttribute("role","dialog"),n.setAttribute("aria-label","EliseAI Widget"),n.setAttribute("aria-describedby","aria-describe-info"),n.setAttribute("aria-modal","true"),e.themeId&&n.setAttribute("themeId",e.themeId),e.avatarSrc&&n.setAttribute("avatarSrc",e.avatarSrc),void 0!==e.mini&&(n.useMiniWidget=e.mini),e.launcherStyles&&(n.launcherStyles=e.launcherStyles),e.brandColor&&(this.brandColor=e.brandColor,n.setAttribute("brandColor",((e,t)=>{const n=(r=e,{r:parseInt(r.substring(1,3),16),g:parseInt(r.substring(3,5),16),b:parseInt(r.substring(5,7),16)}),i={r:n.r+Math.round(.3*(0-n.r)),g:n.g+Math.round(.3*(0-n.g)),b:n.b+Math.round(.3*(0-n.b))};var r;return((e,t,n)=>"#"+[e,t,n].map((e=>{const t=e.toString(16);return 1===t.length?"0"+t:t})).join(""))(i.r,i.g,i.b)})(e.brandColor))),document.body.appendChild(n),gr.meChat=n,e.building&&e.organization&&wr(e.organization,e.building)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.meChat&&(await this.meChat.remove(),document.body.removeChild(this.meChat),gr.meChat=null)}static async handleBuildingslug(e,t){t?e.setAttribute("buildingSlug",t):this.mutationObserver||(this.handleSingleFamilyUrl(),this.previousUrl=window.location.href,document.body.addEventListener("click",(()=>{requestAnimationFrame((()=>{this.previousUrl===window.location.href||this.hasBuildingSlug||(this.previousUrl=window.location.href,this.handleSingleFamilyUrl())}))}),!0))}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,i=await t().get(n,{headers:{"org-slug":this.orgSlug}});if(!i||!i.data)return;const r={organization:this.orgSlug,building:i.data,brandColor:this.brandColor};this.start(r,!1)}}gr.meChat=null,gr.orgSlug="",gr.mutationObserver=null,gr.previousUrl="",gr.hasBuildingSlug=null,gr.brandColor="";const yr=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)},br=()=>{const e=document.createElement("meta");e.setAttribute("name","viewport"),e.setAttribute("content","width=device-width, initial-scale=1, maximum-scale=2"),document.head.appendChild(e)},wr=async(e,n)=>{var i;const r=await async function(e){try{return(await t().get(_n(e),{params:{building_slug:e,flag_type:"bool",feature_flag:"webchat-use-override-contact-us-form",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(n);if(!r)return;const o=document.getElementById("myContactForm");let a;if(!(o&&o instanceof HTMLFormElement))return void(window.location.pathname.toLowerCase().includes("contactus")&&Sr(n,e,"Could not find form"));for(let e=0;e<o.elements.length;e++){const t=o.elements[e];if("button"===t.tagName.toLowerCase()&&"fakebutton"===t.getAttribute("data-selenium-id")){a=t;break}}if(!a)return Sr(n,e,"Could not find submit button");const s=()=>({firstName:document.getElementById("firstname"),lastName:document.getElementById("lastname"),email:document.getElementById("email"),phone:document.getElementById("phonenumber"),message:document.getElementById("message")});if(Object.values(s()).some((e=>null===e))){const t=Object.entries(s()).filter((([,e])=>null===e)).map((([e])=>e));return Sr(n,e,"Missing the following form elements: "+t.join(", "))}const u=a.cloneNode(!0);null===(i=a.parentNode)||void 0===i||i.replaceChild(u,a),u.onclick=async function(t){if(!Object.values(s()).every((t=>null!==t&&(null===t.getAttribute("aria-invalid")&&Sr(n,e,"Missing aria-invalid attribute on "+t.id),"true"!==t.getAttribute("aria-invalid")))))return;t.preventDefault();const i={};Object.entries(s()).forEach((([e,t])=>i[e]=null==t?void 0:t.value));const r=await di(e,n),a=await hi(n,document.referrer);if(!r)return Sr(n,e,"Could not find building"),null;const l={email_address:i.email,first_name:i.firstName,last_name:i.lastName,phone_number:i.phone,first_message:i.message,building_id:r.id,is_external_form:!0,lead_sources:[...new Set(a?[a,"property-website"]:["property-website"])]},d=JSON.stringify(l);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":n,"org-slug":e},body:d}).then((e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return o.reset(),Object.values(s()).forEach((e=>{e&&(e.disabled=!0)})),u.textContent="Submitted",u.disabled=!0,e.json()}))}},Sr=(e,t,n)=>{const i=JSON.stringify({orgSlug:t,buildingSlug:e,reason:n});fetch("https://app.meetelise.com/platformApi/webchat/form-override-error",{method:"POST",headers:{"Content-Type":"application/json","building-slug":e,"org-slug":t},body:i})}})();var r=i.Z;export{r as default};
|
package/src/MEChat.ts
CHANGED
|
@@ -183,8 +183,6 @@ const overrideContactUsForm = async (
|
|
|
183
183
|
orgSlug: string,
|
|
184
184
|
buildingSlug: string
|
|
185
185
|
): Promise<void> => {
|
|
186
|
-
// TODO: Remove after testing in production
|
|
187
|
-
if (localStorage.getItem("overrideContactUsForm") !== "true") return;
|
|
188
186
|
const shouldUseOverrideContactUsForm =
|
|
189
187
|
await fetchFeatureFlagUseOverrideContactUsForm(buildingSlug);
|
|
190
188
|
if (!shouldUseOverrideContactUsForm) return;
|
|
@@ -280,9 +278,6 @@ const overrideContactUsForm = async (
|
|
|
280
278
|
const clonedButton = btn.cloneNode(true) as HTMLButtonElement;
|
|
281
279
|
btn.parentNode?.replaceChild(clonedButton, btn);
|
|
282
280
|
|
|
283
|
-
// TODO: Remove after testing in production
|
|
284
|
-
clonedButton.textContent = "Elise Submit";
|
|
285
|
-
|
|
286
281
|
clonedButton.onclick = async function (event) {
|
|
287
282
|
if (!isValid()) return;
|
|
288
283
|
event.preventDefault();
|