vue-intergrall-plugins 0.0.170 → 0.0.173
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/vue-intergrall-plugins.esm.js +27661 -223
- package/dist/vue-intergrall-plugins.min.js +1 -1
- package/dist/vue-intergrall-plugins.ssr.js +25098 -285
- package/package.json +3 -1
- package/src/lib-components/Messages/CardMessages.vue +2 -0
- package/src/lib-components/Messages/ChatMessages.vue +29 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-intergrall-plugins",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.173",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/vue-intergrall-plugins.ssr.js",
|
|
6
6
|
"browser": "dist/vue-intergrall-plugins.esm.js",
|
|
@@ -61,6 +61,8 @@
|
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"axios": "^0.26.0",
|
|
64
|
+
"kind-of": "^6.0.3",
|
|
65
|
+
"link-preview-js": "^2.1.13",
|
|
64
66
|
"link-prevue": "^1.2.0"
|
|
65
67
|
}
|
|
66
68
|
}
|
|
@@ -66,6 +66,7 @@ import AnexoMensagem from "./AnexoMensagem"
|
|
|
66
66
|
import InteratividadeBotoes from "./InteratividadeBotoes"
|
|
67
67
|
import { formataTimezoneData } from "../../services/textFormatting"
|
|
68
68
|
import LinkPrevue from "link-prevue"
|
|
69
|
+
import { getLinkPreview } from "link-preview-js";
|
|
69
70
|
|
|
70
71
|
export default {
|
|
71
72
|
components: { AnexoMensagem, InteratividadeBotoes, LinkPrevue },
|
|
@@ -153,6 +154,19 @@ export default {
|
|
|
153
154
|
this.urlFileName = this.getUrlFileName()
|
|
154
155
|
this.message = this.removeUrlStickerByString(this.urlSticker)
|
|
155
156
|
}
|
|
157
|
+
if(this.validadeIfExistsUrl()){
|
|
158
|
+
const linkRegex = /(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])/igm;
|
|
159
|
+
let link = [];
|
|
160
|
+
link = this.removeTags(this.message).match(linkRegex);
|
|
161
|
+
if(!link || link.length == 0){
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
getLinkPreview(this.removeTags(link[0])).then((data) => {
|
|
165
|
+
if(data.images && data.images.length > 0){
|
|
166
|
+
this.urlSticker = data.images[0];
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
156
170
|
},
|
|
157
171
|
getUrlFileName(){
|
|
158
172
|
let urlRegex = /(?<=\/)[^\/\?#]+(?=[^\/]*$)/;
|
|
@@ -168,6 +182,12 @@ export default {
|
|
|
168
182
|
let url = this.message.match(urlRegex)[1];
|
|
169
183
|
return url;
|
|
170
184
|
},
|
|
185
|
+
validadeIfExistsUrl(){
|
|
186
|
+
if(this.message && this.message.indexOf("https://") !== false && this.message.indexOf("<a") !== false){
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
return false;
|
|
190
|
+
},
|
|
171
191
|
validadeIfExistsSticker(){
|
|
172
192
|
if(this.message && this.message.indexOf("KSTICKERK https://smarters") === 0){
|
|
173
193
|
return true;
|
|
@@ -214,6 +234,15 @@ export default {
|
|
|
214
234
|
// if(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi.test(msg) && this.link) this.setLinkPreview(msg)
|
|
215
235
|
return msg
|
|
216
236
|
},
|
|
237
|
+
removeTags(str) {
|
|
238
|
+
if ((str===null) || (str==='')){
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
else{
|
|
242
|
+
str = str.toString();
|
|
243
|
+
return str.replace( /(<([^>]+)>)/ig, '');
|
|
244
|
+
}
|
|
245
|
+
}
|
|
217
246
|
// setLinkPreview(link) {
|
|
218
247
|
// try {
|
|
219
248
|
// this.linkPreview = link
|