vue-intergrall-plugins 1.1.89 → 1.2.0
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/README.md +220 -220
- package/dist/dist/vue-intergrall-plugins.css +1 -1
- package/dist/vue-intergrall-plugins.esm.js +193 -78
- package/dist/vue-intergrall-plugins.min.js +7 -7
- package/dist/vue-intergrall-plugins.ssr.js +245 -136
- package/package.json +61 -61
- package/src/lib-components/Buttons/IconButton.vue +27 -27
- package/src/lib-components/Buttons/SimpleButton.vue +140 -140
- package/src/lib-components/Cards/Card.vue +490 -490
- package/src/lib-components/Cards/CardCheck.vue +35 -35
- package/src/lib-components/Cards/CardFile.vue +163 -163
- package/src/lib-components/Chat/BtnDownloadAllFiles.vue +36 -36
- package/src/lib-components/Chat/BtnEmojis.vue +118 -118
- package/src/lib-components/Chat/BtnExpand.vue +17 -17
- package/src/lib-components/Chat/BtnFiles.vue +486 -486
- package/src/lib-components/Chat/BtnMic.vue +60 -60
- package/src/lib-components/Chat/BtnScreenShare.vue +31 -31
- package/src/lib-components/Chat/BtnStandardMessages.vue +17 -17
- package/src/lib-components/Chat/ExpandTextarea.vue +427 -427
- package/src/lib-components/Chat/MultipleFilePreview.vue +291 -291
- package/src/lib-components/Chat/Picker.vue +525 -525
- package/src/lib-components/Chat/RemainingCharacters.vue +28 -28
- package/src/lib-components/Chat/SingleFilePreview.vue +94 -94
- package/src/lib-components/Chat/SkeletonPicker.vue +110 -110
- package/src/lib-components/Chat/StandardMessages.vue +252 -252
- package/src/lib-components/Chat/TextFooter.vue +1007 -1007
- package/src/lib-components/Email/EmailExpanded.vue +270 -270
- package/src/lib-components/Email/EmailFile.vue +192 -192
- package/src/lib-components/Email/EmailFrom.vue +66 -66
- package/src/lib-components/Email/EmailItem.vue +867 -850
- package/src/lib-components/Email/EmailTo.vue +64 -64
- package/src/lib-components/Loader/Loader.vue +78 -78
- package/src/lib-components/Messages/AnexoMensagem.vue +534 -497
- package/src/lib-components/Messages/CardAttachment.vue +61 -61
- package/src/lib-components/Messages/CardMessages.vue +687 -687
- package/src/lib-components/Messages/InteratividadeBotoes.vue +197 -197
- package/src/lib-components/Messages/InteratividadeContato.vue +32 -32
- package/src/lib-components/Messages/InteratividadeContatoItem.vue +235 -235
- package/src/lib-components/Messages/InteratividadeFormulario.vue +334 -334
- package/src/lib-components/Messages/InteratividadePopup.vue +95 -95
- package/src/lib-components/Messages/LinkPreview.vue +176 -176
- package/src/lib-components/Scroll/ScrollContent.vue +166 -166
- package/src/lib-components/Templates/TemplateGenerator.vue +640 -640
- package/src/lib-components/Templates/TemplateMessage.vue +83 -83
- package/src/lib-components/Templates/TemplateSingle.vue +478 -478
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="interatividade-popup box-shadow" v-clickaway="away">
|
|
3
|
-
<div class="interatividade-popup-titulo" v-if="titulo">
|
|
4
|
-
<h1>
|
|
5
|
-
<span v-html="titulo"></span>
|
|
6
|
-
<fa-icon :icon="['fas', 'times-circle']" @click="away" />
|
|
7
|
-
</h1>
|
|
8
|
-
</div>
|
|
9
|
-
<div class="interatividade-popup-conteudo" v-for="(objItem, index) in lista" :key="index">
|
|
10
|
-
<template v-if="objItem.items && objItem.items.length">
|
|
11
|
-
<div class="interatividade-popup-item" v-for="(item, indexItem) in objItem.items" :key="`${index}${indexItem}`">
|
|
12
|
-
<p v-if="item.title" v-html="item.title" class="interatividade-popup-item-titulo"></p>
|
|
13
|
-
<p v-if="item.description" v-html="item.description" class="interatividade-popup-item-desc"></p>
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script>
|
|
21
|
-
import Clickaway from '@/directives/clickaway';
|
|
22
|
-
|
|
23
|
-
export default {
|
|
24
|
-
directives: {
|
|
25
|
-
clickaway: Clickaway
|
|
26
|
-
},
|
|
27
|
-
props: {
|
|
28
|
-
lista: {
|
|
29
|
-
type: [Array, Object],
|
|
30
|
-
required: true,
|
|
31
|
-
},
|
|
32
|
-
titulo: {
|
|
33
|
-
type: String,
|
|
34
|
-
required: false,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
methods: {
|
|
38
|
-
away() {
|
|
39
|
-
this.$emit("close");
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<style>
|
|
46
|
-
.box-shadow {
|
|
47
|
-
-webkit-box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2),
|
|
48
|
-
0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
|
|
49
|
-
-moz-box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2),
|
|
50
|
-
0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
|
|
51
|
-
box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14),
|
|
52
|
-
0px 1px 5px 0px rgba(0, 0, 0, 0.12);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.interatividade-popup {
|
|
56
|
-
position: absolute;
|
|
57
|
-
top: 15px;
|
|
58
|
-
right: 0;
|
|
59
|
-
width: 250px;
|
|
60
|
-
height: auto;
|
|
61
|
-
max-height: 300px;
|
|
62
|
-
overflow-y: auto;
|
|
63
|
-
overflow-x: hidden;
|
|
64
|
-
background-color: #fff;
|
|
65
|
-
border-radius: 15px;
|
|
66
|
-
color: #333;
|
|
67
|
-
font-size: 14px;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.interatividade-popup-titulo h1 {
|
|
71
|
-
padding: 4px 10px;
|
|
72
|
-
background-color: #333;
|
|
73
|
-
color: #fff;
|
|
74
|
-
font-size: 19.2px;
|
|
75
|
-
display: flex;
|
|
76
|
-
justify-content: space-between;
|
|
77
|
-
align-items: center;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.interatividade-popup-titulo h1 svg {
|
|
81
|
-
color: #e74c3c;
|
|
82
|
-
cursor: pointer;
|
|
83
|
-
font-size: 14.4px;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.interatividade-popup-item {
|
|
87
|
-
padding: 10px;
|
|
88
|
-
border-bottom: 1px solid #d7d7d7;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.interatividade-popup-item-desc {
|
|
92
|
-
font-size: 14.4px;
|
|
93
|
-
color: #767676;
|
|
94
|
-
}
|
|
95
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="interatividade-popup box-shadow" v-clickaway="away">
|
|
3
|
+
<div class="interatividade-popup-titulo" v-if="titulo">
|
|
4
|
+
<h1>
|
|
5
|
+
<span v-html="titulo"></span>
|
|
6
|
+
<fa-icon :icon="['fas', 'times-circle']" @click="away" />
|
|
7
|
+
</h1>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="interatividade-popup-conteudo" v-for="(objItem, index) in lista" :key="index">
|
|
10
|
+
<template v-if="objItem.items && objItem.items.length">
|
|
11
|
+
<div class="interatividade-popup-item" v-for="(item, indexItem) in objItem.items" :key="`${index}${indexItem}`">
|
|
12
|
+
<p v-if="item.title" v-html="item.title" class="interatividade-popup-item-titulo"></p>
|
|
13
|
+
<p v-if="item.description" v-html="item.description" class="interatividade-popup-item-desc"></p>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import Clickaway from '@/directives/clickaway';
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
directives: {
|
|
25
|
+
clickaway: Clickaway
|
|
26
|
+
},
|
|
27
|
+
props: {
|
|
28
|
+
lista: {
|
|
29
|
+
type: [Array, Object],
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
titulo: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: false,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
away() {
|
|
39
|
+
this.$emit("close");
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<style>
|
|
46
|
+
.box-shadow {
|
|
47
|
+
-webkit-box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2),
|
|
48
|
+
0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
|
|
49
|
+
-moz-box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2),
|
|
50
|
+
0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);
|
|
51
|
+
box-shadow: 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14),
|
|
52
|
+
0px 1px 5px 0px rgba(0, 0, 0, 0.12);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.interatividade-popup {
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: 15px;
|
|
58
|
+
right: 0;
|
|
59
|
+
width: 250px;
|
|
60
|
+
height: auto;
|
|
61
|
+
max-height: 300px;
|
|
62
|
+
overflow-y: auto;
|
|
63
|
+
overflow-x: hidden;
|
|
64
|
+
background-color: #fff;
|
|
65
|
+
border-radius: 15px;
|
|
66
|
+
color: #333;
|
|
67
|
+
font-size: 14px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.interatividade-popup-titulo h1 {
|
|
71
|
+
padding: 4px 10px;
|
|
72
|
+
background-color: #333;
|
|
73
|
+
color: #fff;
|
|
74
|
+
font-size: 19.2px;
|
|
75
|
+
display: flex;
|
|
76
|
+
justify-content: space-between;
|
|
77
|
+
align-items: center;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.interatividade-popup-titulo h1 svg {
|
|
81
|
+
color: #e74c3c;
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
font-size: 14.4px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.interatividade-popup-item {
|
|
87
|
+
padding: 10px;
|
|
88
|
+
border-bottom: 1px solid #d7d7d7;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.interatividade-popup-item-desc {
|
|
92
|
+
font-size: 14.4px;
|
|
93
|
+
color: #767676;
|
|
94
|
+
}
|
|
95
|
+
</style>
|
|
@@ -1,176 +1,176 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div v-if="linkPreview.isValid" class="link-preview" @click="openUrl()"
|
|
3
|
-
:title="`Abrir ${returnURL()} em uma nova guia`">
|
|
4
|
-
<div v-if="linkPreview.imageSource"
|
|
5
|
-
:style="linkPreview.colorTheme ? `background-color: ${linkPreview.colorTheme}` : ''" class="link-preview-image">
|
|
6
|
-
<img :src="linkPreview.imageSource" alt="Imagem referente ao link" />
|
|
7
|
-
</div>
|
|
8
|
-
<div class="link-preview-author" :class="{ 'mb-0': linkPreview.description }" v-if="linkPreview.author">
|
|
9
|
-
<h1 v-text="linkPreview.author"></h1>
|
|
10
|
-
</div>
|
|
11
|
-
<div v-if="linkPreview.description" class="link-preview-infos">
|
|
12
|
-
<p v-if="linkPreview.description" v-text="linkPreview.description"></p>
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script>
|
|
18
|
-
import { dev, baseURL } from "@/services/smartChannelAxios";
|
|
19
|
-
|
|
20
|
-
export default {
|
|
21
|
-
props: {
|
|
22
|
-
message: {
|
|
23
|
-
type: String,
|
|
24
|
-
default: "",
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
data() {
|
|
28
|
-
return {
|
|
29
|
-
linkPreview: {
|
|
30
|
-
author: "",
|
|
31
|
-
description: "",
|
|
32
|
-
imageSource: "",
|
|
33
|
-
colorTheme: "",
|
|
34
|
-
isValid: false,
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
mounted() {
|
|
39
|
-
this.$nextTick(() => {
|
|
40
|
-
this.gerarPreview();
|
|
41
|
-
});
|
|
42
|
-
},
|
|
43
|
-
methods: {
|
|
44
|
-
returnURL() {
|
|
45
|
-
if (!this.message) return "";
|
|
46
|
-
const isSticker = this.message.indexOf("KSTICKERK") < 0 ? false : true;
|
|
47
|
-
if (isSticker) return "";
|
|
48
|
-
const regex = /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/g;
|
|
49
|
-
const url = regex.exec(this.message);
|
|
50
|
-
if (!url || !url[0]) {
|
|
51
|
-
console.warn("URL invalida para gerar preview");
|
|
52
|
-
return "";
|
|
53
|
-
}
|
|
54
|
-
const finalUrl = url[0].replace(/["'*]/g, "");
|
|
55
|
-
if (
|
|
56
|
-
/((https?|ftp):\/\/.)?(www\.)?(?:([-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6})|(linux07|linux03))\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi.test(
|
|
57
|
-
finalUrl
|
|
58
|
-
)
|
|
59
|
-
)
|
|
60
|
-
return finalUrl;
|
|
61
|
-
return false;
|
|
62
|
-
},
|
|
63
|
-
async gerarPreview() {
|
|
64
|
-
try {
|
|
65
|
-
const url = this.returnURL();
|
|
66
|
-
if (!url) return;
|
|
67
|
-
if (!this.$root.$httpRequest) return
|
|
68
|
-
const encodedURL = Buffer(url).toString("base64");
|
|
69
|
-
const response = await this.$root.$httpRequest.get(`${baseURL}/preview?url=${encodedURL}${dev}`);
|
|
70
|
-
if (typeof response != "object" || typeof response.data != "object")
|
|
71
|
-
throw "Retorno incorreto";
|
|
72
|
-
const { data } = response;
|
|
73
|
-
const { st_ret, msg_ret, raspagem } = data;
|
|
74
|
-
if (st_ret != "OK") throw `${st_ret} - ${msg_ret}`;
|
|
75
|
-
if (!raspagem)
|
|
76
|
-
throw `${st_ret} - ${msg_ret} | (Raspagem nao encontrada no retorno)`;
|
|
77
|
-
const { description, og, theme_color } = raspagem;
|
|
78
|
-
if (description) this.linkPreview.description = description;
|
|
79
|
-
if (raspagem.author) this.linkPreview.author = raspagem.author;
|
|
80
|
-
if (og) {
|
|
81
|
-
const { image, site_name, title, author } = og;
|
|
82
|
-
if (image)
|
|
83
|
-
this.linkPreview.imageSource = image.url
|
|
84
|
-
? image.url
|
|
85
|
-
: image.url == ""
|
|
86
|
-
? ""
|
|
87
|
-
: image;
|
|
88
|
-
if (author || site_name || title)
|
|
89
|
-
this.linkPreview.author = title
|
|
90
|
-
? title
|
|
91
|
-
: author
|
|
92
|
-
? author
|
|
93
|
-
: site_name
|
|
94
|
-
? site_name
|
|
95
|
-
: "";
|
|
96
|
-
if (og.description) this.linkPreview.description = og.description;
|
|
97
|
-
}
|
|
98
|
-
if (theme_color) this.linkPreview.colorTheme = theme_color;
|
|
99
|
-
|
|
100
|
-
if (this.linkPreview.description || this.linkPreview.imageSource)
|
|
101
|
-
this.linkPreview.isValid = true;
|
|
102
|
-
} catch (e) {
|
|
103
|
-
console.error("Erro ao gerar o preview do link: ", e);
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
openUrl() {
|
|
107
|
-
const url = this.returnURL();
|
|
108
|
-
if (!url) return;
|
|
109
|
-
window.open(url, "_blank");
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
</script>
|
|
114
|
-
|
|
115
|
-
<style>
|
|
116
|
-
.link-preview {
|
|
117
|
-
display: flex;
|
|
118
|
-
flex-direction: column;
|
|
119
|
-
background-color: #eee;
|
|
120
|
-
color: #333;
|
|
121
|
-
cursor: pointer;
|
|
122
|
-
margin: 5px 0;
|
|
123
|
-
border-radius: 5px;
|
|
124
|
-
opacity: 0.95;
|
|
125
|
-
transition: opacity 300ms ease-in-out;
|
|
126
|
-
font-size: 13.6px;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.link-preview-image {
|
|
130
|
-
display: flex;
|
|
131
|
-
justify-content: center;
|
|
132
|
-
align-items: center;
|
|
133
|
-
padding: 1px;
|
|
134
|
-
border-top-left-radius: 5px;
|
|
135
|
-
border-top-right-radius: 5px;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.link-preview-author {
|
|
139
|
-
margin: 5px;
|
|
140
|
-
font-size: 9.84px;
|
|
141
|
-
font-weight: bold;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.link-preview-author.mb-0 {
|
|
145
|
-
margin-bottom: 0;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.link-preview-author h1 {
|
|
149
|
-
overflow: hidden;
|
|
150
|
-
text-overflow: ellipsis;
|
|
151
|
-
white-space: nowrap;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.link-preview-image img {
|
|
155
|
-
min-width: 100px;
|
|
156
|
-
max-width: 200px;
|
|
157
|
-
border-top-left-radius: 5px;
|
|
158
|
-
border-top-right-radius: 5px;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.link-preview-infos {
|
|
162
|
-
background-color: #2626261a;
|
|
163
|
-
padding: 5px;
|
|
164
|
-
margin: 5px;
|
|
165
|
-
font-size: 13.28px;
|
|
166
|
-
border-radius: 5px;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.link-preview:hover {
|
|
170
|
-
opacity: 1;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.link-preview:hover .link-preview-infos p {
|
|
174
|
-
text-decoration: underline;
|
|
175
|
-
}
|
|
176
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="linkPreview.isValid" class="link-preview" @click="openUrl()"
|
|
3
|
+
:title="`Abrir ${returnURL()} em uma nova guia`">
|
|
4
|
+
<div v-if="linkPreview.imageSource"
|
|
5
|
+
:style="linkPreview.colorTheme ? `background-color: ${linkPreview.colorTheme}` : ''" class="link-preview-image">
|
|
6
|
+
<img :src="linkPreview.imageSource" alt="Imagem referente ao link" />
|
|
7
|
+
</div>
|
|
8
|
+
<div class="link-preview-author" :class="{ 'mb-0': linkPreview.description }" v-if="linkPreview.author">
|
|
9
|
+
<h1 v-text="linkPreview.author"></h1>
|
|
10
|
+
</div>
|
|
11
|
+
<div v-if="linkPreview.description" class="link-preview-infos">
|
|
12
|
+
<p v-if="linkPreview.description" v-text="linkPreview.description"></p>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import { dev, baseURL } from "@/services/smartChannelAxios";
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
props: {
|
|
22
|
+
message: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
data() {
|
|
28
|
+
return {
|
|
29
|
+
linkPreview: {
|
|
30
|
+
author: "",
|
|
31
|
+
description: "",
|
|
32
|
+
imageSource: "",
|
|
33
|
+
colorTheme: "",
|
|
34
|
+
isValid: false,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
mounted() {
|
|
39
|
+
this.$nextTick(() => {
|
|
40
|
+
this.gerarPreview();
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
methods: {
|
|
44
|
+
returnURL() {
|
|
45
|
+
if (!this.message) return "";
|
|
46
|
+
const isSticker = this.message.indexOf("KSTICKERK") < 0 ? false : true;
|
|
47
|
+
if (isSticker) return "";
|
|
48
|
+
const regex = /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/g;
|
|
49
|
+
const url = regex.exec(this.message);
|
|
50
|
+
if (!url || !url[0]) {
|
|
51
|
+
console.warn("URL invalida para gerar preview");
|
|
52
|
+
return "";
|
|
53
|
+
}
|
|
54
|
+
const finalUrl = url[0].replace(/["'*]/g, "");
|
|
55
|
+
if (
|
|
56
|
+
/((https?|ftp):\/\/.)?(www\.)?(?:([-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6})|(linux07|linux03))\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi.test(
|
|
57
|
+
finalUrl
|
|
58
|
+
)
|
|
59
|
+
)
|
|
60
|
+
return finalUrl;
|
|
61
|
+
return false;
|
|
62
|
+
},
|
|
63
|
+
async gerarPreview() {
|
|
64
|
+
try {
|
|
65
|
+
const url = this.returnURL();
|
|
66
|
+
if (!url) return;
|
|
67
|
+
if (!this.$root.$httpRequest) return
|
|
68
|
+
const encodedURL = Buffer(url).toString("base64");
|
|
69
|
+
const response = await this.$root.$httpRequest.get(`${baseURL}/preview?url=${encodedURL}${dev}`);
|
|
70
|
+
if (typeof response != "object" || typeof response.data != "object")
|
|
71
|
+
throw "Retorno incorreto";
|
|
72
|
+
const { data } = response;
|
|
73
|
+
const { st_ret, msg_ret, raspagem } = data;
|
|
74
|
+
if (st_ret != "OK") throw `${st_ret} - ${msg_ret}`;
|
|
75
|
+
if (!raspagem)
|
|
76
|
+
throw `${st_ret} - ${msg_ret} | (Raspagem nao encontrada no retorno)`;
|
|
77
|
+
const { description, og, theme_color } = raspagem;
|
|
78
|
+
if (description) this.linkPreview.description = description;
|
|
79
|
+
if (raspagem.author) this.linkPreview.author = raspagem.author;
|
|
80
|
+
if (og) {
|
|
81
|
+
const { image, site_name, title, author } = og;
|
|
82
|
+
if (image)
|
|
83
|
+
this.linkPreview.imageSource = image.url
|
|
84
|
+
? image.url
|
|
85
|
+
: image.url == ""
|
|
86
|
+
? ""
|
|
87
|
+
: image;
|
|
88
|
+
if (author || site_name || title)
|
|
89
|
+
this.linkPreview.author = title
|
|
90
|
+
? title
|
|
91
|
+
: author
|
|
92
|
+
? author
|
|
93
|
+
: site_name
|
|
94
|
+
? site_name
|
|
95
|
+
: "";
|
|
96
|
+
if (og.description) this.linkPreview.description = og.description;
|
|
97
|
+
}
|
|
98
|
+
if (theme_color) this.linkPreview.colorTheme = theme_color;
|
|
99
|
+
|
|
100
|
+
if (this.linkPreview.description || this.linkPreview.imageSource)
|
|
101
|
+
this.linkPreview.isValid = true;
|
|
102
|
+
} catch (e) {
|
|
103
|
+
console.error("Erro ao gerar o preview do link: ", e);
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
openUrl() {
|
|
107
|
+
const url = this.returnURL();
|
|
108
|
+
if (!url) return;
|
|
109
|
+
window.open(url, "_blank");
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<style>
|
|
116
|
+
.link-preview {
|
|
117
|
+
display: flex;
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
background-color: #eee;
|
|
120
|
+
color: #333;
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
margin: 5px 0;
|
|
123
|
+
border-radius: 5px;
|
|
124
|
+
opacity: 0.95;
|
|
125
|
+
transition: opacity 300ms ease-in-out;
|
|
126
|
+
font-size: 13.6px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.link-preview-image {
|
|
130
|
+
display: flex;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
align-items: center;
|
|
133
|
+
padding: 1px;
|
|
134
|
+
border-top-left-radius: 5px;
|
|
135
|
+
border-top-right-radius: 5px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.link-preview-author {
|
|
139
|
+
margin: 5px;
|
|
140
|
+
font-size: 9.84px;
|
|
141
|
+
font-weight: bold;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.link-preview-author.mb-0 {
|
|
145
|
+
margin-bottom: 0;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.link-preview-author h1 {
|
|
149
|
+
overflow: hidden;
|
|
150
|
+
text-overflow: ellipsis;
|
|
151
|
+
white-space: nowrap;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.link-preview-image img {
|
|
155
|
+
min-width: 100px;
|
|
156
|
+
max-width: 200px;
|
|
157
|
+
border-top-left-radius: 5px;
|
|
158
|
+
border-top-right-radius: 5px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.link-preview-infos {
|
|
162
|
+
background-color: #2626261a;
|
|
163
|
+
padding: 5px;
|
|
164
|
+
margin: 5px;
|
|
165
|
+
font-size: 13.28px;
|
|
166
|
+
border-radius: 5px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.link-preview:hover {
|
|
170
|
+
opacity: 1;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.link-preview:hover .link-preview-infos p {
|
|
174
|
+
text-decoration: underline;
|
|
175
|
+
}
|
|
176
|
+
</style>
|