@meetelise/chat 1.20.107 → 1.20.108
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
package/public/dist/index.js
CHANGED
|
@@ -3085,6 +3085,9 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3085
3085
|
width: auto;
|
|
3086
3086
|
height: auto;
|
|
3087
3087
|
}
|
|
3088
|
+
.displayed-message-image-error {
|
|
3089
|
+
display: none;
|
|
3090
|
+
}
|
|
3088
3091
|
.redirect-link {
|
|
3089
3092
|
color: black;
|
|
3090
3093
|
}
|
|
@@ -3184,7 +3187,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3184
3187
|
flex-direction: column;
|
|
3185
3188
|
justify-content: center;
|
|
3186
3189
|
|
|
3187
|
-
margin:
|
|
3190
|
+
margin: 0px 6px 6px;
|
|
3188
3191
|
}
|
|
3189
3192
|
.website-preview-image {
|
|
3190
3193
|
max-width: 100%;
|
|
@@ -3221,30 +3224,31 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3221
3224
|
color: inherit;
|
|
3222
3225
|
text-decoration: none;
|
|
3223
3226
|
}
|
|
3224
|
-
`;var kr=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 Ur=class extends ae{constructor(){super(...arguments),this.onMount=()=>({}),this.loadingPreviews=!0,this.websitePreviewInfo=[]}firstUpdated(){if(!this.message)return;const{hyperlinks:e,markedText:t}=this.mapAndMarkHyperLinks(this.message.message.text),n=/(https?:\/\/[^\s]+)/g,i=[],r=[];this.parsedMessage=B`${t.split("\n").map((t=>B`${t.split(" ").map((t=>{if(e.find((e=>e.id===t))){const n=e.find((e=>e.id===t));if(!n)return;return
|
|
3227
|
+
`;var kr=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 Ur=class extends ae{constructor(){super(...arguments),this.onMount=()=>({}),this.loadingPreviews=!0,this.websitePreviewInfo=[],this.imagesToDisplay=[],this.imageUrlError=[]}firstUpdated(){if(!this.message)return;const{hyperlinks:e,markedText:t}=this.mapAndMarkHyperLinks(this.message.message.text),n=/(https?:\/\/[^\s]+)/g,i=[],r=[];this.parsedMessage=B`${t.split("\n").map((t=>B`${t.split(" ").map((t=>{if(e.find((e=>e.id===t))){const n=e.find((e=>e.id===t));if(!n)return;return r.push({redirectTo:null==n?void 0:n.link,source:null==n?void 0:n.link}),B`<a
|
|
3225
3228
|
class="redirect-link"
|
|
3226
3229
|
href="${null==n?void 0:n.link}"
|
|
3227
3230
|
target="_blank"
|
|
3228
3231
|
rel="noopener noreferrer"
|
|
3229
3232
|
>${null==n?void 0:n.hyperlink}
|
|
3230
|
-
</a>`}return n.test(t)?(
|
|
3233
|
+
</a>`}return n.test(t)?(i.push(this.getLinkData(t)),B`<a
|
|
3231
3234
|
class="redirect-link"
|
|
3232
3235
|
href="${t}"
|
|
3233
3236
|
target="_blank"
|
|
3234
3237
|
rel="noopener noreferrer"
|
|
3235
3238
|
>${t}
|
|
3236
|
-
</a>`):B`${t} `}))}<br />`))}
|
|
3237
|
-
${i.map((e=>B`<a
|
|
3238
|
-
href="${e.redirectTo}"
|
|
3239
|
-
target="_blank"
|
|
3240
|
-
rel="noopener noreferrer"
|
|
3241
|
-
><img
|
|
3242
|
-
class="displayed-message-image"
|
|
3243
|
-
src=${e.source}
|
|
3244
|
-
alt="displayed message image"
|
|
3245
|
-
/></a>`))}`,Promise.all(r).then((e=>{this.websitePreviewInfo=e}))}mapAndMarkHyperLinks(e){const t=Array.from(e.matchAll(/<https?:\/\/[^|]+\|[^>]+>/g)),n=[];return t.forEach((t=>{try{const i=t[0].split("|")[0].replace("<",""),r=t[0].split("|")[1].replace(">","");if(i&&r){const o=di();n.push({link:i,hyperlink:r,mark:t[0],id:o}),e=e.replace(t[0],o)}}catch(e){}})),{hyperlinks:n,markedText:e}}async getLinkData(e){var n,i,r,o,a,s;try{const u=(await t().get(e)).data,l=(new DOMParser).parseFromString(u,"text/html");return l?{title:null!==(i=null===(n=l.querySelector("title"))||void 0===n?void 0:n.textContent)&&void 0!==i?i:null,description:(null===(r=l.querySelector('meta[name="description"]'))||void 0===r?void 0:r.getAttribute("content"))||null,image:(null===(o=l.querySelector('meta[property="og:image"]'))||void 0===o?void 0:o.getAttribute("content"))||null,favicon:(null===(a=l.querySelector('link[rel="shortcut icon"]'))||void 0===a?void 0:a.getAttribute("href"))||(null===(s=l.querySelector('link[rel="icon"]'))||void 0===s?void 0:s.getAttribute("href"))||null,link:e}:{title:null,description:null,image:null,favicon:null,link:e}}catch(t){return console.error("Error fetching website details:",t),{title:null,description:null,image:null,favicon:null,link:e}}}updated(){this.onMount()}render(){return this.message?B`<div class="message-inner-body">
|
|
3239
|
+
</a>`):B`${t} `}))}<br />`))}`,this.imagesToDisplay=r,Promise.all(i).then((e=>{this.websitePreviewInfo=e}))}mapAndMarkHyperLinks(e){const t=Array.from(e.matchAll(/<https?:\/\/[^|]+\|[^>]+>/g)),n=[];return t.forEach((t=>{try{const i=t[0].split("|")[0].replace("<",""),r=t[0].split("|")[1].replace(">","");if(i&&r){const o=di();n.push({link:i,hyperlink:r,mark:t[0],id:o}),e=e.replace(t[0],o)}}catch(e){}})),{hyperlinks:n,markedText:e}}async getLinkData(e){var n,i,r,o,a,s;try{const u=(await t().get(e)).data,l=(new DOMParser).parseFromString(u,"text/html");return l?{title:null!==(i=null===(n=l.querySelector("title"))||void 0===n?void 0:n.textContent)&&void 0!==i?i:null,description:(null===(r=l.querySelector('meta[name="description"]'))||void 0===r?void 0:r.getAttribute("content"))||null,image:(null===(o=l.querySelector('meta[property="og:image"]'))||void 0===o?void 0:o.getAttribute("content"))||null,favicon:(null===(a=l.querySelector('link[rel="shortcut icon"]'))||void 0===a?void 0:a.getAttribute("href"))||(null===(s=l.querySelector('link[rel="icon"]'))||void 0===s?void 0:s.getAttribute("href"))||null,link:e}:{title:null,description:null,image:null,favicon:null,link:e}}catch(t){return console.error("Error fetching website details:",t),{title:null,description:null,image:null,favicon:null,link:e}}}updated(){this.onMount()}render(){return this.message?B`<div class="message-inner-body">
|
|
3246
3240
|
<p class="message-text">${this.parsedMessage}</p>
|
|
3247
3241
|
${this.websitePreviewInfo.length>0&&this.websitePreviewInfo.some((e=>e.title&&(e.image||e.favicon)))?B`<br />`:""}
|
|
3242
|
+
${this.imagesToDisplay.map((e=>B`<a
|
|
3243
|
+
href="${e.redirectTo}"
|
|
3244
|
+
target="_blank"
|
|
3245
|
+
rel="noopener noreferrer"
|
|
3246
|
+
><img
|
|
3247
|
+
class=${this.imageUrlError.includes(e.source)?"displayed-message-image-error":"displayed-message-image"}
|
|
3248
|
+
src=${e.source}
|
|
3249
|
+
alt="displayed message image"
|
|
3250
|
+
@error=${()=>{this.imageUrlError=[...this.imageUrlError,e.source]}}
|
|
3251
|
+
/></a>`))}
|
|
3248
3252
|
${this.websitePreviewInfo.map((e=>{var t;if(e.title&&(e.image||e.favicon))return B` <a
|
|
3249
3253
|
class="redirect-link-preview"
|
|
3250
3254
|
href=${e.link}
|
|
@@ -3252,13 +3256,14 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3252
3256
|
rel="noopener noreferrer"
|
|
3253
3257
|
>
|
|
3254
3258
|
<div class="website-preview">
|
|
3255
|
-
<img
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3259
|
+
${e.image||e.favicon?B` <img
|
|
3260
|
+
src=${null!==(t=e.image)&&void 0!==t?t:e.favicon}
|
|
3261
|
+
class="website-preview-image"
|
|
3262
|
+
alt="website preview image"
|
|
3263
|
+
width="100%"
|
|
3264
|
+
height="100%"
|
|
3265
|
+
/>`:""}
|
|
3266
|
+
|
|
3262
3267
|
<div class="website-preview-body">
|
|
3263
3268
|
<p class="message-text website-preview-title">${e.title}</p>
|
|
3264
3269
|
<p class="message-text website-preview-description">
|
|
@@ -3267,7 +3272,7 @@ otherwise there's some empty space at the bottom of the button, which interferes
|
|
|
3267
3272
|
</div>
|
|
3268
3273
|
</div>
|
|
3269
3274
|
</a></div> `}))}
|
|
3270
|
-
</div>`:B``}};Ur.styles=[Dr],kr([de({attribute:!0})],Ur.prototype,"message",void 0),kr([de({attribute:!0})],Ur.prototype,"myPubnub",void 0),kr([de({attribute:!0})],Ur.prototype,"onMount",void 0),kr([ce()],Ur.prototype,"loadingPreviews",void 0),kr([ce()],Ur.prototype,"parsedMessage",void 0),kr([ce()],Ur.prototype,"websitePreviewInfo",void 0),Ur=kr([ue("pubnub-message")],Ur);var qr=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 Br=class extends ae{constructor(){super(...arguments),this.brandColor=yi,this.onClickExit=()=>({}),this.onMount=()=>({}),this.messages=[],this.isMobile=!1,this.isLoadingMessages=!1,this.websitePreviewMapping={},this.sendMessage=async e=>{var t;this.messageInput.value="",this.autoResizeMessageInput(),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"}}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.messages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener((e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading})),this.onMount()}async updated(){this.scrollToChatBottom()}render(){return this.buildingSlug&&this.building?B`
|
|
3275
|
+
</div>`:B``}};Ur.styles=[Dr],kr([de({attribute:!0})],Ur.prototype,"message",void 0),kr([de({attribute:!0})],Ur.prototype,"myPubnub",void 0),kr([de({attribute:!0})],Ur.prototype,"onMount",void 0),kr([ce()],Ur.prototype,"loadingPreviews",void 0),kr([ce()],Ur.prototype,"parsedMessage",void 0),kr([ce()],Ur.prototype,"websitePreviewInfo",void 0),kr([ce()],Ur.prototype,"imagesToDisplay",void 0),kr([ce()],Ur.prototype,"imageUrlError",void 0),Ur=kr([ue("pubnub-message")],Ur);var qr=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 Br=class extends ae{constructor(){super(...arguments),this.brandColor=yi,this.onClickExit=()=>({}),this.onMount=()=>({}),this.messages=[],this.isMobile=!1,this.isLoadingMessages=!1,this.websitePreviewMapping={},this.sendMessage=async e=>{var t;this.messageInput.value="",this.autoResizeMessageInput(),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"}}firstUpdated(){var e,t;this.messages=(null===(e=this.myPubnub)||void 0===e?void 0:e.messages)||[],null===(t=this.myPubnub)||void 0===t||t.addChatListener((e=>{this.messages=e.messages,this.isLoadingMessages=e.isLoading})),this.onMount()}async updated(){this.scrollToChatBottom()}render(){return this.buildingSlug&&this.building?B`
|
|
3271
3276
|
<div
|
|
3272
3277
|
id="pubnub-chat-container"
|
|
3273
3278
|
class=${ge({"pubnub-container__mobile":this.isMobile,"pubnub-container__desktop":!this.isMobile})}
|
|
@@ -122,6 +122,9 @@ export const pubnubChatStyles = css`
|
|
|
122
122
|
width: auto;
|
|
123
123
|
height: auto;
|
|
124
124
|
}
|
|
125
|
+
.displayed-message-image-error {
|
|
126
|
+
display: none;
|
|
127
|
+
}
|
|
125
128
|
.redirect-link {
|
|
126
129
|
color: black;
|
|
127
130
|
}
|
|
@@ -221,7 +224,7 @@ export const pubnubChatStyles = css`
|
|
|
221
224
|
flex-direction: column;
|
|
222
225
|
justify-content: center;
|
|
223
226
|
|
|
224
|
-
margin:
|
|
227
|
+
margin: 0px 6px 6px;
|
|
225
228
|
}
|
|
226
229
|
.website-preview-image {
|
|
227
230
|
max-width: 100%;
|
|
@@ -12,6 +12,11 @@ interface WebsitePreview {
|
|
|
12
12
|
favicon: string | null;
|
|
13
13
|
link: string;
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
interface ImageToDisplay {
|
|
17
|
+
redirectTo: string;
|
|
18
|
+
source: string;
|
|
19
|
+
}
|
|
15
20
|
@customElement("pubnub-message")
|
|
16
21
|
export class PubnubMessage extends LitElement {
|
|
17
22
|
static styles = [pubnubChatStyles];
|
|
@@ -34,18 +39,20 @@ export class PubnubMessage extends LitElement {
|
|
|
34
39
|
@state()
|
|
35
40
|
websitePreviewInfo: WebsitePreview[] = [];
|
|
36
41
|
|
|
42
|
+
@state()
|
|
43
|
+
imagesToDisplay: ImageToDisplay[] = [];
|
|
44
|
+
|
|
45
|
+
@state()
|
|
46
|
+
imageUrlError: string[] = [];
|
|
47
|
+
|
|
37
48
|
firstUpdated(): void {
|
|
38
49
|
if (!this.message) return;
|
|
39
50
|
const { hyperlinks, markedText } = this.mapAndMarkHyperLinks(
|
|
40
51
|
this.message.message.text
|
|
41
52
|
);
|
|
42
53
|
const urlRegex = /(https?:\/\/[^\s]+)/g; // Regular expression to match URLs
|
|
43
|
-
const imagesToDisplay: {
|
|
44
|
-
redirectTo: string;
|
|
45
|
-
source: string;
|
|
46
|
-
}[] = [];
|
|
47
|
-
|
|
48
54
|
const loadingWebsitePreviews: Promise<WebsitePreview>[] = [];
|
|
55
|
+
const imagesToDisplay: ImageToDisplay[] = [];
|
|
49
56
|
this.parsedMessage = html`${markedText.split("\n").map((line) => {
|
|
50
57
|
return html`${line.split(" ").map((word) => {
|
|
51
58
|
if (hyperlinks.find((obj) => obj.id === word)) {
|
|
@@ -78,18 +85,8 @@ export class PubnubMessage extends LitElement {
|
|
|
78
85
|
return html`${word} `;
|
|
79
86
|
}
|
|
80
87
|
})}<br />`;
|
|
81
|
-
})}
|
|
82
|
-
${imagesToDisplay.map((image) => {
|
|
83
|
-
return html`<a
|
|
84
|
-
href="${image.redirectTo}"
|
|
85
|
-
target="_blank"
|
|
86
|
-
rel="noopener noreferrer"
|
|
87
|
-
><img
|
|
88
|
-
class="displayed-message-image"
|
|
89
|
-
src=${image.source}
|
|
90
|
-
alt="displayed message image"
|
|
91
|
-
/></a>`;
|
|
92
88
|
})}`;
|
|
89
|
+
this.imagesToDisplay = imagesToDisplay;
|
|
93
90
|
Promise.all(loadingWebsitePreviews).then((results) => {
|
|
94
91
|
this.websitePreviewInfo = results;
|
|
95
92
|
});
|
|
@@ -195,6 +192,23 @@ export class PubnubMessage extends LitElement {
|
|
|
195
192
|
)
|
|
196
193
|
? html`<br />`
|
|
197
194
|
: ""}
|
|
195
|
+
${this.imagesToDisplay.map((image) => {
|
|
196
|
+
return html`<a
|
|
197
|
+
href="${image.redirectTo}"
|
|
198
|
+
target="_blank"
|
|
199
|
+
rel="noopener noreferrer"
|
|
200
|
+
><img
|
|
201
|
+
class=${this.imageUrlError.includes(image.source)
|
|
202
|
+
? "displayed-message-image-error"
|
|
203
|
+
: "displayed-message-image"}
|
|
204
|
+
src=${image.source}
|
|
205
|
+
alt="displayed message image"
|
|
206
|
+
@error=${() => {
|
|
207
|
+
// to trigger rerender
|
|
208
|
+
this.imageUrlError = [...this.imageUrlError, image.source];
|
|
209
|
+
}}
|
|
210
|
+
/></a>`;
|
|
211
|
+
})}
|
|
198
212
|
${this.websitePreviewInfo.map((preview) => {
|
|
199
213
|
if (!preview.title || !(preview.image || preview.favicon)) return;
|
|
200
214
|
return html` <a
|
|
@@ -204,13 +218,18 @@ export class PubnubMessage extends LitElement {
|
|
|
204
218
|
rel="noopener noreferrer"
|
|
205
219
|
>
|
|
206
220
|
<div class="website-preview">
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
221
|
+
${
|
|
222
|
+
preview.image || preview.favicon
|
|
223
|
+
? html` <img
|
|
224
|
+
src=${preview.image ?? preview.favicon}
|
|
225
|
+
class="website-preview-image"
|
|
226
|
+
alt="website preview image"
|
|
227
|
+
width="100%"
|
|
228
|
+
height="100%"
|
|
229
|
+
/>`
|
|
230
|
+
: ""
|
|
231
|
+
}
|
|
232
|
+
|
|
214
233
|
<div class="website-preview-body">
|
|
215
234
|
<p class="message-text website-preview-title">${preview.title}</p>
|
|
216
235
|
<p class="message-text website-preview-description">
|
|
@@ -223,3 +242,5 @@ export class PubnubMessage extends LitElement {
|
|
|
223
242
|
</div>`;
|
|
224
243
|
}
|
|
225
244
|
}
|
|
245
|
+
|
|
246
|
+
("Would you be available for a tour tomorrow at 11:00am or 3:45pm? We also have additional <https://app.meetelise.com/milhaus/2a5c7bdc-4d63-11ec-aa49-5f037e1156e7/tour?stateId=gAAAAABkihW_IJql0zzRF-Mved31jlp9yDgtBrPsSaZ63db9pV1m2vXLpWSXC4afXzCXqf6YbzCCIsmY7fkyOdX4OJei7v5HwIFa9tPTXhhxRnFTi1GpV5s=|timeslots here.>");
|