@meetelise/chat 1.22.13 → 1.22.15

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.22.13",
3
+ "version": "1.22.15",
4
4
  "description": "",
5
5
  "main": "public/dist/index.js",
6
6
  "type": "module",
@@ -156,24 +156,24 @@
156
156
  };
157
157
 
158
158
  MEChat.start({
159
- organization: "test-company",
160
- building: "3fc93384-91f5-11ed-98a3-43f5a2f42588",
161
- onSstClose: () => {
162
- const meetEliseChats = document.getElementsByTagName("me-chat");
163
- if (!meetEliseChats || meetEliseChats.length === 0) {
164
- return;
165
- }
166
- const meetEliseChat = meetEliseChats[0];
167
- meetEliseChat.setAttribute("style", "display: none;");
168
- },
169
- onWidgetLoaded: onWidgetLoaded,
159
+ // organization: "test-company",
160
+ // building: "3fc93384-91f5-11ed-98a3-43f5a2f42588",
161
+ // onSstClose: () => {
162
+ // const meetEliseChats = document.getElementsByTagName("me-chat");
163
+ // if (!meetEliseChats || meetEliseChats.length === 0) {
164
+ // return;
165
+ // }
166
+ // const meetEliseChat = meetEliseChats[0];
167
+ // meetEliseChat.setAttribute("style", "display: none;");
168
+ // },
169
+ // onWidgetLoaded: onWidgetLoaded,
170
170
 
171
171
  // organization: "4c78cac8-017a-4497-8b71-3df15779a83c",
172
172
 
173
173
  // building: "43e3b1bc-d1b2-11ee-acb9-d77ba815aaac",
174
174
 
175
- // organization: "cardinal-group",
176
- // widgetType: "utilities",
175
+ organization: "cardinal-group",
176
+ widgetType: "utilities",
177
177
 
178
178
  // organization: "test-company",
179
179
  // building: "e2e-test-yardi-building",
@@ -4654,7 +4654,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
4654
4654
  position: fixed;
4655
4655
  bottom: 0;
4656
4656
  }
4657
- `,Ao([le({type:String})],Co.prototype,"buildingSlug",void 0),Ao([le({type:String})],Co.prototype,"orgSlug",void 0),Ao([le({type:Object})],Co.prototype,"launcherStyles",void 0),Ao([le()],Co.prototype,"mobileStyles",void 0),Ao([le({type:Boolean})],Co.prototype,"isMinimized",void 0),Ao([le({type:String})],Co.prototype,"brandColor",void 0),Ao([le({type:String})],Co.prototype,"backgroundColor",void 0),Ao([ue()],Co.prototype,"chatId",void 0),Ao([ue()],Co.prototype,"analytics",void 0),Ao([ue()],Co.prototype,"launcher",void 0),Ao([ue()],Co.prototype,"building",void 0),Ao([ue()],Co.prototype,"designConcept",void 0),Ao([ue()],Co.prototype,"leadSources",void 0),Ao([ue()],Co.prototype,"currentLeadSource",void 0),Ao([ue()],Co.prototype,"featureFlagShowDropdown",void 0),Ao([ue()],Co.prototype,"phoneNumberForSource",void 0),Ao([ue()],Co.prototype,"hasMounted",void 0),Ao([ue()],Co.prototype,"hideLauncher",void 0),Ao([ue()],Co.prototype,"isLoading",void 0),Ao([ue()],Co.prototype,"showTourNextToChat",void 0),Ao([ue()],Co.prototype,"displayPubnubChat",void 0),Ao([ue()],Co.prototype,"myPubnub",void 0),Ao([ue()],Co.prototype,"LeadSourceClient",void 0),Ao([le({type:Number})],Co.prototype,"right",void 0),Ao([le({type:Number})],Co.prototype,"bottom",void 0),Ao([le({type:Number})],Co.prototype,"top",void 0),Ao([le({type:Number})],Co.prototype,"left",void 0),Ao([le({attribute:!0})],Co.prototype,"overrideRentgrata",void 0),Ao([le({attribute:!0})],Co.prototype,"widgetType",void 0),Ao([le()],Co.prototype,"onWidgetLoaded",void 0),Ao([le({attribute:!0})],Co.prototype,"onSstClose",void 0),Ao([ue()],Co.prototype,"enabledChatWidgets",void 0),Ao([ue()],Co.prototype,"webchatConfigHasAutoOpenChat",void 0),Ao([ue()],Co.prototype,"requiresConsent",void 0),Ao([ue()],Co.prototype,"hideMobileFeatures",void 0),Ao([ue()],Co.prototype,"privacyPolicyUrl",void 0),Co=Ao([ae("me-chat")],Co);const Oo=e=>{for(const t of e){const e=document.getElementById(t);if(e)return e}return null},Io=async(e,i,n)=>{var r;if(!i||!e)return;const o=await async function(e){if(!e)return!1;try{return(await t().get(Ki(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}}(i);if(!o)return;const a=Oo(["myContactForm","contactus","fpa-myContactForm","contact-form"]);let s;if(!(a&&a instanceof HTMLFormElement)){const t=document.querySelector("form");return void(window.location.pathname.toLowerCase().includes("contactus")&&No(i,e,"Could not find form",t?{id:t.id}:void 0))}try{if(a.parentElement&&"scheduleTourForm"===a.parentElement.id)return No(i,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 No(i,e,"Could not find submit button");const l=()=>({firstName:Oo(["firstname","txtName","fpa-firstname","Form_FirstName"]),lastName:Oo(["lastname","txtName2","fpa-lastname","Form_LastName"]),email:Oo(["email","txtEmail","fpa-email","Form_Email"]),phone:Oo(["phonenumber","txtPhone","fpa-phonenumber","Form_Phone"]),message:Oo(["message","txtComments","fpa-email","Form_Message"])});if(Object.values(l()).some((e=>null===e))){const t=Object.entries(l()).filter((([,e])=>null===e)).map((([e])=>e));return No(i,e,"Missing the following form elements: "+t.join(", "))}const u=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(l()).forEach((e=>{"true"!==(null==e?void 0:e.getAttribute("aria-required"))||e.value||(e.className="form-control required is-invalid")})),!Object.values(l()).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(l()).forEach((([e,t])=>r[e]=null==t?void 0:t.value));const o=await Sn(e,i);if(!o)return No(i,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(n?[n,fn(e)]:[fn(e)])]},c=JSON.stringify(s);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":i,"org-slug":e},body:c}).then((e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return a&&a.reset(),Object.values(l()).forEach((e=>{e&&(e.disabled=!0)})),d.textContent="Submitted",d.disabled=!0,e.json()})).catch((()=>{d.textContent=u}))}},No=(e,t,i,n)=>{const r=JSON.stringify({orgSlug:t,buildingSlug:e,reason:i,url:window.location.href,formIdInfo: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:r})},Eo=l`
4657
+ `,Ao([le({type:String})],Co.prototype,"buildingSlug",void 0),Ao([le({type:String})],Co.prototype,"orgSlug",void 0),Ao([le({type:Object})],Co.prototype,"launcherStyles",void 0),Ao([le()],Co.prototype,"mobileStyles",void 0),Ao([le({type:Boolean})],Co.prototype,"isMinimized",void 0),Ao([le({type:String})],Co.prototype,"brandColor",void 0),Ao([le({type:String})],Co.prototype,"backgroundColor",void 0),Ao([ue()],Co.prototype,"chatId",void 0),Ao([ue()],Co.prototype,"analytics",void 0),Ao([ue()],Co.prototype,"launcher",void 0),Ao([ue()],Co.prototype,"building",void 0),Ao([ue()],Co.prototype,"designConcept",void 0),Ao([ue()],Co.prototype,"leadSources",void 0),Ao([ue()],Co.prototype,"currentLeadSource",void 0),Ao([ue()],Co.prototype,"featureFlagShowDropdown",void 0),Ao([ue()],Co.prototype,"phoneNumberForSource",void 0),Ao([ue()],Co.prototype,"hasMounted",void 0),Ao([ue()],Co.prototype,"hideLauncher",void 0),Ao([ue()],Co.prototype,"isLoading",void 0),Ao([ue()],Co.prototype,"showTourNextToChat",void 0),Ao([ue()],Co.prototype,"displayPubnubChat",void 0),Ao([ue()],Co.prototype,"myPubnub",void 0),Ao([ue()],Co.prototype,"LeadSourceClient",void 0),Ao([le({type:Number})],Co.prototype,"right",void 0),Ao([le({type:Number})],Co.prototype,"bottom",void 0),Ao([le({type:Number})],Co.prototype,"top",void 0),Ao([le({type:Number})],Co.prototype,"left",void 0),Ao([le({attribute:!0})],Co.prototype,"overrideRentgrata",void 0),Ao([le({attribute:!0})],Co.prototype,"widgetType",void 0),Ao([le()],Co.prototype,"onWidgetLoaded",void 0),Ao([le({attribute:!0})],Co.prototype,"onSstClose",void 0),Ao([ue()],Co.prototype,"enabledChatWidgets",void 0),Ao([ue()],Co.prototype,"webchatConfigHasAutoOpenChat",void 0),Ao([ue()],Co.prototype,"requiresConsent",void 0),Ao([ue()],Co.prototype,"hideMobileFeatures",void 0),Ao([ue()],Co.prototype,"privacyPolicyUrl",void 0),Co=Ao([ae("me-chat")],Co);const Oo=e=>{for(const t of e){const e=document.getElementById(t);if(e)return e}return null},Io=async(e,i,n)=>{var r;if(!i||!e)return;const o=await async function(e){if(!e)return!1;try{return(await t().get(Ki(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}}(i);if(!o)return;const a=Oo(["myContactForm","contactus","fpa-myContactForm"]);let s;if(!(a&&a instanceof HTMLFormElement)){const t=document.querySelector("form");return void(window.location.pathname.toLowerCase().includes("contactus")&&No(i,e,"Could not find form",t?{id:t.id}:void 0))}try{if(a.parentElement&&"scheduleTourForm"===a.parentElement.id)return No(i,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 No(i,e,"Could not find submit button");const l=()=>({firstName:Oo(["firstname","txtName","fpa-firstname","Form_FirstName"]),lastName:Oo(["lastname","txtName2","fpa-lastname","Form_LastName"]),email:Oo(["email","txtEmail","fpa-email","Form_Email"]),phone:Oo(["phonenumber","txtPhone","fpa-phonenumber","Form_Phone"]),message:Oo(["message","txtComments","fpa-email","Form_Message"])});if(Object.values(l()).some((e=>null===e))){const t=Object.entries(l()).filter((([,e])=>null===e)).map((([e])=>e));return No(i,e,"Missing the following form elements: "+t.join(", "))}const u=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(l()).forEach((e=>{"true"!==(null==e?void 0:e.getAttribute("aria-required"))||e.value||(e.className="form-control required is-invalid")})),!Object.values(l()).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(l()).forEach((([e,t])=>r[e]=null==t?void 0:t.value));const o=await Sn(e,i);if(!o)return No(i,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(n?[n,fn(e)]:[fn(e)])]},c=JSON.stringify(s);fetch("https://app.meetelise.com/platformApi/state/create/contactMe",{method:"POST",headers:{"Content-Type":"application/json","building-slug":i,"org-slug":e},body:c}).then((e=>{if(!e.ok)throw new Error(`HTTP error ${e.status}`);return a&&a.reset(),Object.values(l()).forEach((e=>{e&&(e.disabled=!0)})),d.textContent="Submitted",d.disabled=!0,e.json()})).catch((()=>{d.textContent=u}))}},No=(e,t,i,n)=>{const r=JSON.stringify({orgSlug:t,buildingSlug:e,reason:i,url:window.location.href,formIdInfo: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:r})},Eo=l`
4658
4658
  .chat-launcher {
4659
4659
  position: fixed;
4660
4660
  }
@@ -4815,7 +4815,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
4815
4815
  line-height: 150%;
4816
4816
  font-size: 16px;
4817
4817
  }
4818
- `,Po([le({type:String})],Mo.prototype,"healthcareId",void 0),Po([le({type:Number})],Mo.prototype,"right",void 0),Po([le({type:Number})],Mo.prototype,"bottom",void 0),Po([le({type:Number})],Mo.prototype,"top",void 0),Po([le({type:Number})],Mo.prototype,"left",void 0),Po([ue()],Mo.prototype,"launcher",void 0),Po([ue()],Mo.prototype,"currentLeadSource",void 0),Po([ue()],Mo.prototype,"displayPubnubChat",void 0),Po([ue()],Mo.prototype,"myPubnub",void 0),Po([ue()],Mo.prototype,"requiresConsent",void 0),Po([ue()],Mo.prototype,"privacyPolicyUrl",void 0),Po([ue()],Mo.prototype,"isLoading",void 0),Mo=Po([ae("health-chat")],Mo);var Fo=function(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};let Do=class extends re{constructor(){super(...arguments),this.orgSlug="",this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=xe(),this.firstUpdated=async()=>{"test-company"===this.orgSlug&&await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=Wr(this.orgSlug),t=Vr(this.orgSlug,e)?e:zr(this.orgSlug,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new Yr(this.orgSlug,null,this.orgSlug,this.currentLeadSource,t.leadId,null,Lo.Utilities),t.initiatedChat&&await this.myPubnub.initializePubnub(e),ci()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),Gr(this.orgSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return vr(),this.isLoading?U``:U`
4818
+ `,Po([le({type:String})],Mo.prototype,"healthcareId",void 0),Po([le({type:Number})],Mo.prototype,"right",void 0),Po([le({type:Number})],Mo.prototype,"bottom",void 0),Po([le({type:Number})],Mo.prototype,"top",void 0),Po([le({type:Number})],Mo.prototype,"left",void 0),Po([ue()],Mo.prototype,"launcher",void 0),Po([ue()],Mo.prototype,"currentLeadSource",void 0),Po([ue()],Mo.prototype,"displayPubnubChat",void 0),Po([ue()],Mo.prototype,"myPubnub",void 0),Po([ue()],Mo.prototype,"requiresConsent",void 0),Po([ue()],Mo.prototype,"privacyPolicyUrl",void 0),Po([ue()],Mo.prototype,"isLoading",void 0),Mo=Po([ae("health-chat")],Mo);var Fo=function(e,t,i,n){var r,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};let Do=class extends re{constructor(){super(...arguments),this.orgSlug="",this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.launcher=null,this.currentLeadSource=null,this.displayPubnubChat=!1,this.myPubnub=null,this.requiresConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.isLoading=!0,this.launcherRef=xe(),this.firstUpdated=async()=>{await async function(e){if(!e)return!1;const i="e2e-test-yardi-building";try{return(await t().get(Ki(i),{params:{building_slug:i,flag_type:"bool",feature_flag:"enable-show-utilities-webchat",default_str:null,default_bool:!1}})).data}catch(e){return!1}}(this.orgSlug)&&await this.initializeChatVariables()},this.initializeChatVariables=async()=>{this.isLoading=!0;const e=Wr(this.orgSlug),t=Vr(this.orgSlug,e)?e:zr(this.orgSlug,!1);if(!t.leadId)throw new Error("Lead ID is null");this.myPubnub=new Yr(this.orgSlug,null,this.orgSlug,this.currentLeadSource,t.leadId,null,Lo.Utilities),t.initiatedChat&&await this.myPubnub.initializePubnub(e),ci()||(this.displayPubnubChat=!0),this.attachOnClickToLauncher(),this.isLoading=!1},this.attachOnClickToLauncher=()=>{const e=this.launcherRef.value;e&&(e.onChatTapped=async()=>{this.displayPubnubChat=!0})}}async restartConversation(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),Gr(this.orgSlug),this.myPubnub=null,this.displayPubnubChat=!1,await this.initializeChatVariables()}show(){this.launcher&&(this.launcher.style.display="")}hide(){this.launcher&&(this.launcher.style.display="none")}disconnectedCallback(){var e;null===(e=this.myPubnub)||void 0===e||e.handleDisconnect(),super.disconnectedCallback()}render(){var e;return vr(),this.isLoading?U``:U`
4819
4819
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
4820
4820
  <div id="aria-describe-info" style="display: none;">
4821
4821
  EliseAI widget that allows you to chat with a virtual assistant, book
@@ -956,7 +956,6 @@ const overrideContactUsForm = async (
956
956
  "myContactForm",
957
957
  "contactus",
958
958
  "fpa-myContactForm",
959
- "contact-form",
960
959
  ]);
961
960
  let btn = undefined;
962
961
 
@@ -20,6 +20,7 @@ import {
20
20
  import { isMobile } from "../utils";
21
21
  import "./simple-launcher/simple-launcher";
22
22
  import { WidgetType } from "../main/MEChat";
23
+ import { fetchFeatureFlagShowUtilities } from "../fetchFeatureFlag";
23
24
 
24
25
  @customElement("utilities-chat")
25
26
  export class UtilitiesChat extends LitElement {
@@ -117,9 +118,13 @@ export class UtilitiesChat extends LitElement {
117
118
  launcherRef: Ref<Launcher> = createRef();
118
119
 
119
120
  firstUpdated = async (): Promise<void> => {
120
- if (this.orgSlug !== "test-company") {
121
+ const showShouldUtilities = await fetchFeatureFlagShowUtilities(
122
+ this.orgSlug
123
+ );
124
+ if (!showShouldUtilities) {
121
125
  return;
122
126
  }
127
+
123
128
  const isInMaintenanceMode = false; // TODO: check
124
129
  if (isInMaintenanceMode) {
125
130
  // eslint-disable-next-line no-console
@@ -145,3 +145,29 @@ export async function fetchFeatureFlagInsertDNIWebsite(
145
145
  return false;
146
146
  }
147
147
  }
148
+
149
+ export async function fetchFeatureFlagShowUtilities(
150
+ orgSlug: string
151
+ ): Promise<boolean> {
152
+ if (!orgSlug) {
153
+ return false;
154
+ }
155
+ const buildingSlug = "e2e-test-yardi-building";
156
+ try {
157
+ const featureFlagResponse = await axios.get(
158
+ featureFlagEndpointV1(buildingSlug),
159
+ {
160
+ params: {
161
+ building_slug: buildingSlug,
162
+ flag_type: "bool",
163
+ feature_flag: "enable-show-utilities-webchat",
164
+ default_str: null,
165
+ default_bool: false,
166
+ },
167
+ }
168
+ );
169
+ return featureFlagResponse.data;
170
+ } catch (_) {
171
+ return false;
172
+ }
173
+ }