@meetelise/chat 1.21.7 → 1.21.8
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/demo/index.html +2 -2
- package/public/dist/index.js +10 -10
- package/src/WebComponent/pubnub-chat.ts +12 -0
package/package.json
CHANGED
package/public/demo/index.html
CHANGED
|
@@ -155,8 +155,8 @@
|
|
|
155
155
|
// organization: "avb",
|
|
156
156
|
// building: "ava-somerville-2",
|
|
157
157
|
|
|
158
|
-
organization: "
|
|
159
|
-
building: "
|
|
158
|
+
organization: "6467c8cd-44cd-4fc9-8acf-9236090febbc",
|
|
159
|
+
building: "f719e0f8-b5ab-11ee-b9df-9f80a8f9a7b6",
|
|
160
160
|
overrideRentgrata: true,
|
|
161
161
|
// onWidgetLoaded: onWidgetLoaded,
|
|
162
162
|
|
package/public/dist/index.js
CHANGED
|
@@ -3932,11 +3932,11 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3932
3932
|
max-height: 200px;
|
|
3933
3933
|
overflow-y: auto;
|
|
3934
3934
|
}
|
|
3935
|
-
`],uo([le({attribute:!0})],co.prototype,"message",void 0),uo([le({attribute:!0})],co.prototype,"myPubnub",void 0),uo([le({attribute:!0})],co.prototype,"onMount",void 0),uo([ue()],co.prototype,"showMediaAsCarousel",void 0),uo([ue()],co.prototype,"activeIndex",void 0),co=uo([ae("pubnub-media")],co);var po=864e5;function ho(e,t){Le(2,arguments);var n=bn(e),i=bn(t),r=n.getTime()-Rt(n),o=i.getTime()-Rt(i);return Math.round((r-o)/po)}function fo(e,t){var n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}var mo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let go=class extends re{constructor(){super(...arguments),this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.onMount=()=>({}),this.isHealthChat=!1,this.brandColor=Me,this.backgroundColor=Fe,this.onClickExit=()=>{localStorage.setItem("isChatOpen","false")},this.requiresConsent=!1,this.messages=[],this.isLoadingMessages=!1,this.hasReceivedConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.websitePreviewMapping={},this.sendMessage=async e=>{var t;this.messageInput.value="",this.autoResizeMessageInput(),0===this.messages.length&&(this.messages=[{timestamp:0,message:e,isLeadMessage:!0,chunks:[{text:e,order:0,isDone:!0}],type:Qr.text}]),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e))},this.scrollToChatBottom=()=>{this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"smooth"})},this.autoResizeMessageInput=()=>{this.messageInput.style.height="auto",this.messageInput.style.height=this.messageInput.scrollHeight+"px"},this.needsConsent=()=>this.requiresConsent&&!this.hasReceivedConsent}get consentKey(){return`${this.orgSlug}Consent`}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.simpleChatMessages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener((e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading})),this.onMount();const n=localStorage.getItem(this.consentKey);if(!n)return void(this.hasReceivedConsent=!1);const i=JSON.parse(n),{timestamp:r,consentId:o}=i,a=function(e,t){Le(2,arguments);var n=qe(e),i=qe(t),r=fo(n,i),o=Math.abs(ho(n,i));n.setDate(n.getDate()-r*o);var a=Number(fo(n,i)===-r),s=r*(o-a);return 0===s?0:s}(new Date,new Date(r));a<7&&o===vo?this.hasReceivedConsent=!0:(this.hasReceivedConsent=!1,localStorage.removeItem(this.consentKey))}async updated(){this.scrollToChatBottom();try{const e=document.getElementById("#healthchat-container");if(!e)return;e.focus()}catch(e){console.error(e)}}render(){var e,t,n,i;if(!this.buildingSlug)return U``;let
|
|
3935
|
+
`],uo([le({attribute:!0})],co.prototype,"message",void 0),uo([le({attribute:!0})],co.prototype,"myPubnub",void 0),uo([le({attribute:!0})],co.prototype,"onMount",void 0),uo([ue()],co.prototype,"showMediaAsCarousel",void 0),uo([ue()],co.prototype,"activeIndex",void 0),co=uo([ae("pubnub-media")],co);var po=864e5;function ho(e,t){Le(2,arguments);var n=bn(e),i=bn(t),r=n.getTime()-Rt(n),o=i.getTime()-Rt(i);return Math.round((r-o)/po)}function fo(e,t){var n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}var mo=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let go=class extends re{constructor(){super(...arguments),this.right=void 0,this.bottom=void 0,this.top=void 0,this.left=void 0,this.onMount=()=>({}),this.isHealthChat=!1,this.brandColor=Me,this.backgroundColor=Fe,this.onClickExit=()=>{localStorage.setItem("isChatOpen","false")},this.requiresConsent=!1,this.messages=[],this.isLoadingMessages=!1,this.hasReceivedConsent=!1,this.privacyPolicyUrl="http://bit.ly/me_privacy_policy",this.websitePreviewMapping={},this.sendMessage=async e=>{var t;this.messageInput.value="",this.autoResizeMessageInput(),0===this.messages.length&&(this.messages=[{timestamp:0,message:e,isLeadMessage:!0,chunks:[{text:e,order:0,isDone:!0}],type:Qr.text}]),await(null===(t=this.myPubnub)||void 0===t?void 0:t.sendMessage(e))},this.scrollToChatBottom=()=>{this.messageBody.scrollTo({top:this.messageBody.scrollHeight-this.messageBody.clientHeight,behavior:"smooth"})},this.autoResizeMessageInput=()=>{this.messageInput.style.height="auto",this.messageInput.style.height=this.messageInput.scrollHeight+"px"},this.needsConsent=()=>this.requiresConsent&&!this.hasReceivedConsent}get consentKey(){return`${this.orgSlug}Consent`}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.simpleChatMessages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener((e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading})),this.onMount();const n=localStorage.getItem(this.consentKey);if(!n)return void(this.hasReceivedConsent=!1);const i=JSON.parse(n),{timestamp:r,consentId:o}=i,a=function(e,t){Le(2,arguments);var n=qe(e),i=qe(t),r=fo(n,i),o=Math.abs(ho(n,i));n.setDate(n.getDate()-r*o);var a=Number(fo(n,i)===-r),s=r*(o-a);return 0===s?0:s}(new Date,new Date(r));a<7&&o===vo?this.hasReceivedConsent=!0:(this.hasReceivedConsent=!1,localStorage.removeItem(this.consentKey))}async updated(){this.scrollToChatBottom();try{const e=document.getElementById("#healthchat-container");if(!e)return;e.focus()}catch(e){console.error(e)}}render(){var e,t,n,i,r;if(!this.buildingSlug)return U``;const o=null===(e=this.building)||void 0===e?void 0:e.id;let a={};if(a=cn()?{top:void 0,bottom:0,left:void 0,right:0}:{top:void 0===this.top||isNaN(this.top)?void 0:`${this.top}px`,bottom:void 0===this.bottom||isNaN(this.bottom)?"130px":`${this.bottom}px`,left:void 0===this.left||isNaN(this.left)?void 0:`${this.left}px`,right:void 0===this.right||isNaN(this.right)?"18px":`${this.right}px`},22320===o&&(a={...a,fontFamily:'"Helvetica Neue", Arial'}),this.isHealthChat)return U`
|
|
3936
3936
|
<div
|
|
3937
3937
|
id="healthchat-container"
|
|
3938
3938
|
class=${fe({"pubnub-container__mobile":cn(),"healthchat-container__desktop":!cn()})}
|
|
3939
|
-
style=${Pe(
|
|
3939
|
+
style=${Pe(a)}
|
|
3940
3940
|
>
|
|
3941
3941
|
<div id="healthchat-header">
|
|
3942
3942
|
${"6a9e65e5-9699-4c96-af75-1741d0df79aa"===this.buildingSlug?U` <div>
|
|
@@ -3953,7 +3953,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3953
3953
|
<div
|
|
3954
3954
|
class=${fe({hidden:!this.needsConsent(),"legal-confirmation-container":!0})}
|
|
3955
3955
|
>
|
|
3956
|
-
${bo(null!==(
|
|
3956
|
+
${bo(null!==(t=this.orgSlug)&&void 0!==t?t:null,this.privacyPolicyUrl,this.consentKey,(e=>{this.hasReceivedConsent=e}))}
|
|
3957
3957
|
</div>
|
|
3958
3958
|
<div
|
|
3959
3959
|
id="conversation-body"
|
|
@@ -4044,11 +4044,11 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
4044
4044
|
</div>
|
|
4045
4045
|
</div>
|
|
4046
4046
|
</div>
|
|
4047
|
-
`;if(!this.building)return U``;const
|
|
4047
|
+
`;if(!this.building)return U``;const s=this.building.orgId;return U`
|
|
4048
4048
|
<div
|
|
4049
4049
|
id="pubnub-chat-container"
|
|
4050
4050
|
class=${fe({"pubnub-container__mobile":cn(),"pubnub-container__desktop":!cn()})}
|
|
4051
|
-
style=${Pe(
|
|
4051
|
+
style=${Pe(a)}
|
|
4052
4052
|
>
|
|
4053
4053
|
<div
|
|
4054
4054
|
id="leasing-header"
|
|
@@ -4062,7 +4062,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
4062
4062
|
<div
|
|
4063
4063
|
class=${fe({hidden:!this.needsConsent(),"legal-confirmation-container":!0})}
|
|
4064
4064
|
>
|
|
4065
|
-
${bo(null!==(
|
|
4065
|
+
${bo(null!==(n=this.orgSlug)&&void 0!==n?n:null,this.privacyPolicyUrl,this.consentKey,(e=>{this.hasReceivedConsent=e}))}
|
|
4066
4066
|
</div>
|
|
4067
4067
|
<div
|
|
4068
4068
|
id="conversation-body"
|
|
@@ -4073,9 +4073,9 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
4073
4073
|
id="message-thread-list"
|
|
4074
4074
|
class=${fe({hidden:this.needsConsent()})}
|
|
4075
4075
|
>
|
|
4076
|
-
${yo(null!==(
|
|
4076
|
+
${yo(null!==(i=this.orgSlug)&&void 0!==i?i:"")}
|
|
4077
4077
|
${this.building.welcomeMessage?U` <li
|
|
4078
|
-
class=${fe({"message-container":!0,"ai-message":!0,"with-box-shadow":444===
|
|
4078
|
+
class=${fe({"message-container":!0,"ai-message":!0,"with-box-shadow":444===s})}
|
|
4079
4079
|
>
|
|
4080
4080
|
<p
|
|
4081
4081
|
class=${fe({"message-text":!0,"webchat-font__desktop":!cn(),"webchat-font__mobile":cn()})}
|
|
@@ -4085,7 +4085,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
4085
4085
|
</li>`:""}
|
|
4086
4086
|
${this.messages.map((e=>U`
|
|
4087
4087
|
<li
|
|
4088
|
-
class=${Qn()("message-container",{"lead-message":e.isLeadMessage,"ai-message":!e.isLeadMessage,"with-box-shadow":444===
|
|
4088
|
+
class=${Qn()("message-container",{"lead-message":e.isLeadMessage,"ai-message":!e.isLeadMessage,"with-box-shadow":444===s})}
|
|
4089
4089
|
key=${e.timestamp}
|
|
4090
4090
|
>
|
|
4091
4091
|
${Vr(e)?U` <pubnub-media
|
|
@@ -4130,7 +4130,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
4130
4130
|
tabindex="0"
|
|
4131
4131
|
id="send-message-bttn"
|
|
4132
4132
|
@click=${()=>this.sendMessage(this.messageInput.value)}
|
|
4133
|
-
?disabled=${null===(
|
|
4133
|
+
?disabled=${null===(r=this.myPubnub)||void 0===r?void 0:r.isCurrentlyStreamingMessage}
|
|
4134
4134
|
>
|
|
4135
4135
|
${Ki}
|
|
4136
4136
|
</button>
|
|
@@ -201,6 +201,7 @@ export class PubnubChat extends LitElement {
|
|
|
201
201
|
return html``; // error should be here
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
+
const buildingId = this.building?.id;
|
|
204
205
|
let styles = {};
|
|
205
206
|
if (isMobile()) {
|
|
206
207
|
styles = {
|
|
@@ -229,6 +230,17 @@ export class PubnubChat extends LitElement {
|
|
|
229
230
|
: "18px",
|
|
230
231
|
};
|
|
231
232
|
}
|
|
233
|
+
/**
|
|
234
|
+
* This chat window uses 'Poppins' as its font, but https://www.120ninthst.com/ seemingly installs a 'Poppins' font that is
|
|
235
|
+
* not the same as the Google Font 'Poppins'. This causes the chat window to look different from the rest of the website. This
|
|
236
|
+
* is a special case/hack to just change to a system default font for this building.
|
|
237
|
+
*/
|
|
238
|
+
if (buildingId === 22320) {
|
|
239
|
+
styles = {
|
|
240
|
+
...styles,
|
|
241
|
+
fontFamily: `"Helvetica Neue", Arial`,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
232
244
|
|
|
233
245
|
if (this.isHealthChat) {
|
|
234
246
|
return html`
|