@meetelise/chat 1.41.0 → 1.41.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/dist/src/main/MEChat.d.ts +1 -1
- package/package.json +1 -1
- package/public/dist/index.js +1 -1
- package/src/main/MEChat.ts +8 -8
|
@@ -47,7 +47,7 @@ export default class MEChat {
|
|
|
47
47
|
static start(opts: Options, isInitialStart?: boolean): void;
|
|
48
48
|
static restartConversation(): Promise<void>;
|
|
49
49
|
static remove(): Promise<void>;
|
|
50
|
-
static handleBuildingslug(meChat: MEChatLitElement, orgSlug?: string, buildingSlug?: string): Promise<void>;
|
|
50
|
+
static handleBuildingslug(meChat: MEChatLitElement, orgSlug?: string, buildingSlug?: string, originalOpts?: Options): Promise<void>;
|
|
51
51
|
static handleSingleFamilyUrl(): Promise<void>;
|
|
52
52
|
static calculateBuildingSlugForLogging(givenBuildingSlug: string): Promise<void>;
|
|
53
53
|
}
|
package/package.json
CHANGED
package/public/dist/index.js
CHANGED
|
@@ -6909,4 +6909,4 @@ xmlns="http://www.w3.org/2000/svg"
|
|
|
6909
6909
|
line-height: 150%;
|
|
6910
6910
|
font-size: 16px;
|
|
6911
6911
|
}
|
|
6912
|
-
`,Hs([le({type:String})],Fs.prototype,"orgSlug",void 0),Hs([le({type:Number})],Fs.prototype,"right",void 0),Hs([le({type:Number})],Fs.prototype,"bottom",void 0),Hs([le({type:Number})],Fs.prototype,"top",void 0),Hs([le({type:Number})],Fs.prototype,"left",void 0),Hs([ue()],Fs.prototype,"launcher",void 0),Hs([ue()],Fs.prototype,"currentLeadSource",void 0),Hs([ue()],Fs.prototype,"displayPubnubChat",void 0),Hs([ue()],Fs.prototype,"myPubnub",void 0),Hs([ue()],Fs.prototype,"requiresConsent",void 0),Hs([ue()],Fs.prototype,"privacyPolicyUrl",void 0),Hs([ue()],Fs.prototype,"isLoading",void 0),Fs=Hs([ae("utilities-chat")],Fs);const $s=async e=>{const i=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(i)}`,o=await t().get(n,{headers:{"org-slug":e}});return Math.random()<.2&&An({logType:o&&o.data?xn.info:xn.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${o?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:o.data,url:i,orgSlug:e,givenBuildingSlug:null,reason:o&&o.data?null:"No match found"}}),o.data};class zs{static healthcareStart(e,t=!0){var i,n,o,r;t&&(this.healthcareId=e.id,this.overridePlacement={right:e.right,bottom:e.bottom,top:e.top,left:e.left}),Gs();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","dialog"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),a.setAttribute("aria-describedby","aria-describe-info"),a.setAttribute("aria-modal","true"),a.setAttribute("healthcareId",e.id),a.setAttribute("right",(null===(i=e.right)||void 0===i?void 0:i.toString())||"unset"),a.setAttribute("bottom",(null===(n=e.bottom)||void 0===n?void 0:n.toString())||"unset"),a.setAttribute("top",(null===(o=e.top)||void 0===o?void 0:o.toString())||"unset"),a.setAttribute("left",(null===(r=e.left)||void 0===r?void 0:r.toString())||"unset"),document.body.appendChild(a),zs.healthChat=a}static start(e,t=!0){var i,n,o,r,a,s,l,u;if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;t&&(this.orgSlug="Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization,this.hasBuildingSlug=!!e.building,this.overridePlacement={right:null===(i=null==e?void 0:e.position)||void 0===i?void 0:i.right,bottom:null===(n=null==e?void 0:e.position)||void 0===n?void 0:n.bottom,top:null===(o=null==e?void 0:e.position)||void 0===o?void 0:o.top,left:null===(r=null==e?void 0:e.position)||void 0===r?void 0:r.left}),Gs();let c=null;switch(e.widgetType){case Qs.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case Qs.Default:c=document.createElement("me-chat");break;case Qs.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||Qs.Default),c.setAttribute("class","meetelise-chat"),c.setAttribute("role","dialog"),c.setAttribute("aria-label","EliseAI Widget"),c.setAttribute("aria-describedby","aria-describe-info"),c.setAttribute("aria-modal","true"),e.brandColor&&(this.brandColor=e.brandColor,c.setAttribute("primaryColor",((e,t)=>{const i=(o=e,{r:parseInt(o.substring(1,3),16),g:parseInt(o.substring(3,5),16),b:parseInt(o.substring(5,7),16)}),n={r:i.r+Math.round(.3*(0-i.r)),g:i.g+Math.round(.3*(0-i.g)),b:i.b+Math.round(.3*(0-i.b))};var o;return((e,t,i)=>"#"+[e,t,i].map((e=>{const t=e.toString(16);return 1===t.length?"0"+t:t})).join(""))(n.r,n.g,n.b)})(e.brandColor))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),c instanceof Ns&&(this.handleBuildingslug(c,e.organization,e.building),e.launcherStyles&&(c.launcherStyles=e.launcherStyles),e.mobileStyles&&(c.mobileStyles=e.mobileStyles),e.onWidgetLoaded&&(c.onWidgetLoaded=e.onWidgetLoaded),e.overrideRentgrata&&((async()=>{const e=await(async(e,t=5e3)=>new Promise(((i,n)=>{const o=new MutationObserver(((t,n)=>{const o=document.getElementById(e);o&&(n.disconnect(),i(o))}));o.observe(document.body,{childList:!0,subtree:!0});const r=setTimeout((()=>{o.disconnect(),n(new Error(`Element ${e} did not appear within ${t}ms`))}),t),a=document.querySelector(e);a&&(clearTimeout(r),o.disconnect(),i(a))})))("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 Ns&&(zs.meChat=c),c instanceof Fs&&(zs.utilitiesChat=c)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.meChat&&(await this.meChat.remove(),document.body.removeChild(this.meChat),zs.meChat=null)}static async handleBuildingslug(e,t,i){if(i)return void e.setAttribute("buildingSlug",i);if(this.mutationObserver)return;if(!t)return;const
|
|
6912
|
+
`,Hs([le({type:String})],Fs.prototype,"orgSlug",void 0),Hs([le({type:Number})],Fs.prototype,"right",void 0),Hs([le({type:Number})],Fs.prototype,"bottom",void 0),Hs([le({type:Number})],Fs.prototype,"top",void 0),Hs([le({type:Number})],Fs.prototype,"left",void 0),Hs([ue()],Fs.prototype,"launcher",void 0),Hs([ue()],Fs.prototype,"currentLeadSource",void 0),Hs([ue()],Fs.prototype,"displayPubnubChat",void 0),Hs([ue()],Fs.prototype,"myPubnub",void 0),Hs([ue()],Fs.prototype,"requiresConsent",void 0),Hs([ue()],Fs.prototype,"privacyPolicyUrl",void 0),Hs([ue()],Fs.prototype,"isLoading",void 0),Fs=Hs([ae("utilities-chat")],Fs);const $s=async e=>{const i=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(i)}`,o=await t().get(n,{headers:{"org-slug":e}});return Math.random()<.2&&An({logType:o&&o.data?xn.info:xn.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${o?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:o.data,url:i,orgSlug:e,givenBuildingSlug:null,reason:o&&o.data?null:"No match found"}}),o.data};class zs{static healthcareStart(e,t=!0){var i,n,o,r;t&&(this.healthcareId=e.id,this.overridePlacement={right:e.right,bottom:e.bottom,top:e.top,left:e.left}),Gs();const a=document.createElement("health-chat");a.setAttribute("class","health-chat"),a.setAttribute("role","dialog"),a.setAttribute("aria-label","EliseAI Healthcare Widget"),a.setAttribute("aria-describedby","aria-describe-info"),a.setAttribute("aria-modal","true"),a.setAttribute("healthcareId",e.id),a.setAttribute("right",(null===(i=e.right)||void 0===i?void 0:i.toString())||"unset"),a.setAttribute("bottom",(null===(n=e.bottom)||void 0===n?void 0:n.toString())||"unset"),a.setAttribute("top",(null===(o=e.top)||void 0===o?void 0:o.toString())||"unset"),a.setAttribute("left",(null===(r=e.left)||void 0===r?void 0:r.toString())||"unset"),document.body.appendChild(a),zs.healthChat=a}static start(e,t=!0){var i,n,o,r,a,s,l,u;if(window.location.pathname.includes("residentservices")||window.location.pathname.includes("onlineleasing"))return;t&&(this.orgSlug="Pacific Urban Residential"===e.organization?"cbc11aba-21c4-4571-bc43-ff9d86a029e3":e.organization,this.hasBuildingSlug=!!e.building,this.overridePlacement={right:null===(i=null==e?void 0:e.position)||void 0===i?void 0:i.right,bottom:null===(n=null==e?void 0:e.position)||void 0===n?void 0:n.bottom,top:null===(o=null==e?void 0:e.position)||void 0===o?void 0:o.top,left:null===(r=null==e?void 0:e.position)||void 0===r?void 0:r.left}),Gs();let c=null;switch(e.widgetType){case Qs.Healthcare:throw new Error("Healthcare widget is not supported yet, please use the healthcareStart method instead.");case Qs.Default:c=document.createElement("me-chat");break;case Qs.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||Qs.Default),c.setAttribute("class","meetelise-chat"),c.setAttribute("role","dialog"),c.setAttribute("aria-label","EliseAI Widget"),c.setAttribute("aria-describedby","aria-describe-info"),c.setAttribute("aria-modal","true"),e.brandColor&&(this.brandColor=e.brandColor,c.setAttribute("primaryColor",((e,t)=>{const i=(o=e,{r:parseInt(o.substring(1,3),16),g:parseInt(o.substring(3,5),16),b:parseInt(o.substring(5,7),16)}),n={r:i.r+Math.round(.3*(0-i.r)),g:i.g+Math.round(.3*(0-i.g)),b:i.b+Math.round(.3*(0-i.b))};var o;return((e,t,i)=>"#"+[e,t,i].map((e=>{const t=e.toString(16);return 1===t.length?"0"+t:t})).join(""))(n.r,n.g,n.b)})(e.brandColor))),e.backgroundColor&&(this.backgroundColor=e.backgroundColor),c instanceof Ns&&(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(async(e,t=5e3)=>new Promise(((i,n)=>{const o=new MutationObserver(((t,n)=>{const o=document.getElementById(e);o&&(n.disconnect(),i(o))}));o.observe(document.body,{childList:!0,subtree:!0});const r=setTimeout((()=>{o.disconnect(),n(new Error(`Element ${e} did not appear within ${t}ms`))}),t),a=document.querySelector(e);a&&(clearTimeout(r),o.disconnect(),i(a))})))("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 Ns&&(zs.meChat=c),c instanceof Fs&&(zs.utilitiesChat=c)}static async restartConversation(){this.meChat&&await this.meChat.restartConversation()}static async remove(){this.meChat&&(await this.meChat.remove(),document.body.removeChild(this.meChat),zs.meChat=null)}static async handleBuildingslug(e,t,i,n){if(i)return void e.setAttribute("buildingSlug",i);if(this.mutationObserver)return;if(!t)return;const o=await $s(t);if(o){const e={...n,organization:t,building:o};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,$s(t).then((e=>{if(!e)return;const i={...n,organization:t,building:e};this.start(i,!1)})))}))}),!0)}static async handleSingleFamilyUrl(){if(this.hasBuildingSlug)return;this.remove();const e=window.location.href,i=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(e)}`,n=await t().get(i,{headers:{"org-slug":this.orgSlug}});if(Math.random()<.2&&An({logType:n&&n.data?xn.info:xn.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 o={organization:this.orgSlug,building:n.data,brandColor:this.brandColor,backgroundColor:this.backgroundColor};this.start(o,!1)}static async calculateBuildingSlugForLogging(e){const i=window.location.href,n=`https://app.meetelise.com/platformApi/webchat/microsite_slug?uri=${encodeURIComponent(i)}`,o=await t().get(n,{headers:{"org-slug":this.orgSlug}});Math.random()<.2&&An({logType:o&&o.data===e?xn.info:xn.warn,logTitle:`[BUILDING_SLUG_CALCULATED_${o&&o.data===e?"SUCCESS":"FAILURE"}]`,logData:{calculatedBuildingSlug:o.data,url:i,orgSlug:this.orgSlug,givenBuildingSlug:e,reason:o&&o.data===e?null:o&&!o.data?"No match found":o&&o.data!==e?"Mismatch":"No match found"}}),o&&o.data}}var Qs;zs.meChat=null,zs.healthChat=null,zs.utilitiesChat=null,zs.orgSlug="",zs.mutationObserver=null,zs.previousUrl="",zs.hasBuildingSlug=null,zs.brandColor="",zs.backgroundColor="",zs.healthcareId="",zs.overridePlacement={},function(e){e.Default="default",e.Healthcare="healthcare",e.Utilities="utilities"}(Qs||(Qs={}));const Gs=()=>{const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),document.head.appendChild(e)}})();var o=n.l,r=n.Z;export{o as WidgetType,r as default};
|
package/src/main/MEChat.ts
CHANGED
|
@@ -161,7 +161,8 @@ export default class MEChat {
|
|
|
161
161
|
this.handleBuildingslug(
|
|
162
162
|
meChatElement as MEChatLitElement,
|
|
163
163
|
opts.organization,
|
|
164
|
-
opts.building
|
|
164
|
+
opts.building,
|
|
165
|
+
opts
|
|
165
166
|
);
|
|
166
167
|
if (opts.launcherStyles) {
|
|
167
168
|
meChatElement.launcherStyles = opts.launcherStyles;
|
|
@@ -230,7 +231,8 @@ export default class MEChat {
|
|
|
230
231
|
static async handleBuildingslug(
|
|
231
232
|
meChat: MEChatLitElement,
|
|
232
233
|
orgSlug?: string,
|
|
233
|
-
buildingSlug?: string
|
|
234
|
+
buildingSlug?: string,
|
|
235
|
+
originalOpts?: Options
|
|
234
236
|
): Promise<void> {
|
|
235
237
|
if (buildingSlug) {
|
|
236
238
|
meChat.setAttribute("buildingSlug", buildingSlug);
|
|
@@ -248,10 +250,9 @@ export default class MEChat {
|
|
|
248
250
|
const foundBuildingSlugFromSite = await findBuildingSlugFromSite(orgSlug);
|
|
249
251
|
if (foundBuildingSlugFromSite) {
|
|
250
252
|
const opts = {
|
|
253
|
+
...originalOpts,
|
|
251
254
|
organization: orgSlug,
|
|
252
255
|
building: foundBuildingSlugFromSite,
|
|
253
|
-
brandColor: this.brandColor,
|
|
254
|
-
backgroundColor: this.backgroundColor,
|
|
255
256
|
};
|
|
256
257
|
this.start(opts, false);
|
|
257
258
|
}
|
|
@@ -273,13 +274,12 @@ export default class MEChat {
|
|
|
273
274
|
if (!foundBuildingSlugFromSite) {
|
|
274
275
|
return;
|
|
275
276
|
}
|
|
276
|
-
const
|
|
277
|
+
const newOpts = {
|
|
278
|
+
...originalOpts,
|
|
277
279
|
organization: orgSlug,
|
|
278
280
|
building: foundBuildingSlugFromSite,
|
|
279
|
-
brandColor: this.brandColor,
|
|
280
|
-
backgroundColor: this.backgroundColor,
|
|
281
281
|
};
|
|
282
|
-
this.start(
|
|
282
|
+
this.start(newOpts, false);
|
|
283
283
|
}
|
|
284
284
|
);
|
|
285
285
|
});
|