@meetelise/chat 1.20.185 → 1.20.186
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/WebComponent/me-chat.ts +15 -0
package/package.json
CHANGED
package/public/dist/index.js
CHANGED
|
@@ -3944,7 +3944,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3944
3944
|
position: fixed;
|
|
3945
3945
|
bottom: 0;
|
|
3946
3946
|
}
|
|
3947
|
-
`,jr([ue({type:String})],Hr.prototype,"buildingSlug",void 0),jr([ue({type:String})],Hr.prototype,"orgSlug",void 0),jr([ue({type:Object})],Hr.prototype,"launcherStyles",void 0),jr([ue()],Hr.prototype,"mobileStyles",void 0),jr([ue({type:Boolean})],Hr.prototype,"isMinimized",void 0),jr([ue({type:String})],Hr.prototype,"brandColor",void 0),jr([le()],Hr.prototype,"chatId",void 0),jr([le()],Hr.prototype,"analytics",void 0),jr([le()],Hr.prototype,"launcher",void 0),jr([le()],Hr.prototype,"building",void 0),jr([le()],Hr.prototype,"designConcept",void 0),jr([le()],Hr.prototype,"leadSources",void 0),jr([le()],Hr.prototype,"currentLeadSource",void 0),jr([le()],Hr.prototype,"featureFlagShowDropdown",void 0),jr([le()],Hr.prototype,"phoneNumberForSource",void 0),jr([le()],Hr.prototype,"hasMounted",void 0),jr([le()],Hr.prototype,"hideLauncher",void 0),jr([le()],Hr.prototype,"isLoading",void 0),jr([le()],Hr.prototype,"showTourNextToChat",void 0),jr([le()],Hr.prototype,"displayPubnubChat",void 0),jr([le()],Hr.prototype,"myPubnub",void 0),jr([le()],Hr.prototype,"LeadSourceClient",void 0),jr([le()],Hr.prototype,"enabledChatWidgets",void 0),jr([le()],Hr.prototype,"webchatConfigHasAutoOpenChat",void 0),jr([le()],Hr.prototype,"requiresConsent",void 0),jr([le()],Hr.prototype,"privacyPolicyUrl",void 0),Hr=jr([ae("me-chat")],Hr);const Gr=e=>{for(const t of e){const e=document.getElementById(t);if(e)return e}return null},zr=async(e,n,i)=>{var r;if(!n||!e)return;const o=await async function(e){if(!e)return!1;try{return(await t().get(Wn(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(!o)return;const a=Gr(["myContactForm","contactus","fpa-myContactForm"]);let s;if(!(a&&a instanceof HTMLFormElement)){const t=document.querySelector("form");return void(window.location.pathname.toLowerCase().includes("contactus")&&Wr(n,e,"Could not find form",t?{id:t.id}:void 0))}for(let e=0;e<a.elements.length;e++){const t=a.elements[e];if("button"===t.tagName.toLowerCase()&&"fakebutton"===t.getAttribute("data-selenium-id")){s=t;break}if("fpa-contact-submit"===t.getAttribute("id")){s=t;break}}if(!s)return Wr(n,e,"Could not find submit button");const u=()=>({firstName:Gr(["firstname","txtName","fpa-firstname"]),lastName:Gr(["lastname","txtName2","fpa-lastname"]),email:Gr(["email","txtEmail","fpa-email"]),phone:Gr(["phonenumber","txtPhone","fpa-phonenumber"]),message:Gr(["message","txtComments","fpa-email"])});if(Object.values(u()).some((e=>null===e))){const t=Object.entries(u()).filter((([,e])=>null===e)).map((([e])=>e));return Wr(n,e,"Missing the following form elements: "+t.join(", "))}const l=s.textContent,d=s.cloneNode(!0);null===(r=s.parentNode)||void 0===r||r.replaceChild(d,s),d.onclick=async function(t){if(Object.values(u()).forEach((e=>{"true"!==(null==e?void 0:e.getAttribute("aria-required"))||e.value||(e.className="form-control required is-invalid")})),!Object.values(u()).every((e=>null!==e&&!("true"===e.getAttribute("aria-required")&&!e.value)&&("email"!==e.id&&"phonenumber"!==e.id||"true"!==e.getAttribute("aria-invalid")))))return;t.preventDefault(),d.textContent="Processing request...",d.disabled=!0;const r={};Object.entries(u()).forEach((([e,t])=>r[e]=null==t?void 0:t.value));const o=await ci(e,n);if(!o)return Wr(n,e,"Could not find building"),null;const s={email_address:r.email,first_name:r.firstName,last_name:r.lastName,phone_number:r.phone,first_message:r.message,building_id:o.id,is_external_form:!0,lead_sources:[...new Set(i?[i,"property-website"]:["property-website"])]},c=JSON.stringify(s);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":n,"org-slug":e},body:c}).then((e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return a&&a.reset(),Object.values(u()).forEach((e=>{e&&(e.disabled=!0)})),d.textContent="Submitted",d.disabled=!0,e.json()})).catch((()=>{d.textContent=l}))}},Wr=(e,t,n,i)=>{const r=JSON.stringify({orgSlug:t,buildingSlug:e,reason:n,url:window.location.href,formIdInfo:i});fetch("https://app.meetelise.com/platformApi/webchat/form-override-error",{method:"POST",headers:{"Content-Type":"application/json","building-slug":e,"org-slug":t},body:r})},Qr=u`
|
|
3947
|
+
`,jr([ue({type:String})],Hr.prototype,"buildingSlug",void 0),jr([ue({type:String})],Hr.prototype,"orgSlug",void 0),jr([ue({type:Object})],Hr.prototype,"launcherStyles",void 0),jr([ue()],Hr.prototype,"mobileStyles",void 0),jr([ue({type:Boolean})],Hr.prototype,"isMinimized",void 0),jr([ue({type:String})],Hr.prototype,"brandColor",void 0),jr([le()],Hr.prototype,"chatId",void 0),jr([le()],Hr.prototype,"analytics",void 0),jr([le()],Hr.prototype,"launcher",void 0),jr([le()],Hr.prototype,"building",void 0),jr([le()],Hr.prototype,"designConcept",void 0),jr([le()],Hr.prototype,"leadSources",void 0),jr([le()],Hr.prototype,"currentLeadSource",void 0),jr([le()],Hr.prototype,"featureFlagShowDropdown",void 0),jr([le()],Hr.prototype,"phoneNumberForSource",void 0),jr([le()],Hr.prototype,"hasMounted",void 0),jr([le()],Hr.prototype,"hideLauncher",void 0),jr([le()],Hr.prototype,"isLoading",void 0),jr([le()],Hr.prototype,"showTourNextToChat",void 0),jr([le()],Hr.prototype,"displayPubnubChat",void 0),jr([le()],Hr.prototype,"myPubnub",void 0),jr([le()],Hr.prototype,"LeadSourceClient",void 0),jr([le()],Hr.prototype,"enabledChatWidgets",void 0),jr([le()],Hr.prototype,"webchatConfigHasAutoOpenChat",void 0),jr([le()],Hr.prototype,"requiresConsent",void 0),jr([le()],Hr.prototype,"privacyPolicyUrl",void 0),Hr=jr([ae("me-chat")],Hr);const Gr=e=>{for(const t of e){const e=document.getElementById(t);if(e)return e}return null},zr=async(e,n,i)=>{var r;if(!n||!e)return;const o=await async function(e){if(!e)return!1;try{return(await t().get(Wn(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(!o)return;const a=Gr(["myContactForm","contactus","fpa-myContactForm"]);let s;if(!(a&&a instanceof HTMLFormElement)){const t=document.querySelector("form");return void(window.location.pathname.toLowerCase().includes("contactus")&&Wr(n,e,"Could not find form",t?{id:t.id}:void 0))}try{if(a.parentElement&&"scheduleTourForm"===a.parentElement.id)return Wr(n,e,"Form is apart of schedule tour form!")}catch(e){console.error("error",e)}for(let e=0;e<a.elements.length;e++){const t=a.elements[e];if("button"===t.tagName.toLowerCase()&&"fakebutton"===t.getAttribute("data-selenium-id")){s=t;break}if("fpa-contact-submit"===t.getAttribute("id")){s=t;break}}if(!s)return Wr(n,e,"Could not find submit button");const u=()=>({firstName:Gr(["firstname","txtName","fpa-firstname"]),lastName:Gr(["lastname","txtName2","fpa-lastname"]),email:Gr(["email","txtEmail","fpa-email"]),phone:Gr(["phonenumber","txtPhone","fpa-phonenumber"]),message:Gr(["message","txtComments","fpa-email"])});if(Object.values(u()).some((e=>null===e))){const t=Object.entries(u()).filter((([,e])=>null===e)).map((([e])=>e));return Wr(n,e,"Missing the following form elements: "+t.join(", "))}const l=s.textContent,d=s.cloneNode(!0);null===(r=s.parentNode)||void 0===r||r.replaceChild(d,s),d.onclick=async function(t){if(Object.values(u()).forEach((e=>{"true"!==(null==e?void 0:e.getAttribute("aria-required"))||e.value||(e.className="form-control required is-invalid")})),!Object.values(u()).every((e=>null!==e&&!("true"===e.getAttribute("aria-required")&&!e.value)&&("email"!==e.id&&"phonenumber"!==e.id||"true"!==e.getAttribute("aria-invalid")))))return;t.preventDefault(),d.textContent="Processing request...",d.disabled=!0;const r={};Object.entries(u()).forEach((([e,t])=>r[e]=null==t?void 0:t.value));const o=await ci(e,n);if(!o)return Wr(n,e,"Could not find building"),null;const s={email_address:r.email,first_name:r.firstName,last_name:r.lastName,phone_number:r.phone,first_message:r.message,building_id:o.id,is_external_form:!0,lead_sources:[...new Set(i?[i,"property-website"]:["property-website"])]},c=JSON.stringify(s);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":n,"org-slug":e},body:c}).then((e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return a&&a.reset(),Object.values(u()).forEach((e=>{e&&(e.disabled=!0)})),d.textContent="Submitted",d.disabled=!0,e.json()})).catch((()=>{d.textContent=l}))}},Wr=(e,t,n,i)=>{const r=JSON.stringify({orgSlug:t,buildingSlug:e,reason:n,url:window.location.href,formIdInfo:i});fetch("https://app.meetelise.com/platformApi/webchat/form-override-error",{method:"POST",headers:{"Content-Type":"application/json","building-slug":e,"org-slug":t},body:r})},Qr=u`
|
|
3948
3948
|
.chat-launcher {
|
|
3949
3949
|
position: fixed;
|
|
3950
3950
|
}
|
|
@@ -752,6 +752,21 @@ const overrideContactUsForm = async (
|
|
|
752
752
|
return;
|
|
753
753
|
}
|
|
754
754
|
|
|
755
|
+
// If the form is apart of the schedule tour form, do not override
|
|
756
|
+
// https://meetelise.slack.com/archives/C01BT9GB9LZ/p1706132172167819
|
|
757
|
+
try {
|
|
758
|
+
if (form.parentElement && form.parentElement.id === "scheduleTourForm") {
|
|
759
|
+
return logContactUsFormError(
|
|
760
|
+
buildingSlug,
|
|
761
|
+
orgSlug,
|
|
762
|
+
"Form is apart of schedule tour form!"
|
|
763
|
+
);
|
|
764
|
+
}
|
|
765
|
+
} catch (error) {
|
|
766
|
+
// eslint-disable-next-line no-console
|
|
767
|
+
console.error("error", error);
|
|
768
|
+
}
|
|
769
|
+
|
|
755
770
|
// Loop through the elements of the form
|
|
756
771
|
for (let i = 0; i < form.elements.length; i++) {
|
|
757
772
|
const element = form.elements[i];
|