vue-intergrall-plugins 0.0.192 → 0.0.195

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.
@@ -8279,7 +8279,7 @@ const standardMessages = {
8279
8279
  return this.$httpRequest({
8280
8280
  method: 'get',
8281
8281
  url: `${baseURL}/messages/${type}?token_cliente=${token}${dev}` // headers: {
8282
- // Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdGQiOiJNS1VuNENMdFVlYTVZeDA4VmltQmgwQWN6Rkp0Y3pIUjZBTXd3eGI0NGF3d1ZTTTh2ZFhPS1pnIiwibWFuYWdlciI6Ik1LVVZkRm8zWmFreGJOUHd6bjNBRjVmVnF1MmVReFEyTUh2ZVloZ3V3SzJMbzU1IiwiaGFzX2luZm9zIjp0cnVlLCJucm9zIjpbIjEwIiwiMjYzIl0sImF1dGgiOiJNS1U3YzZNQnBJWTkyamFKbFZJTXQxd3dpbTRsNXd3Mjc4SU0wdkpRT0JnV3lTeHZZM3k0dmRYIiwiaWF0IjoxNjQ4MTQ2MzEwLCJleHAiOjE2NDgyMzI3MTB9.JSgv4e0DY0gkWaz6u9yBSH2P507zBZoTRKf9ki7TP_M"
8282
+ // Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdGQiOiJNS1U5azQ3c2h2bGpOak9Db3dNMjJoMW94d3d4YjQ0YXd3allrbG1JVFNpMmV0aDI5ZTVIRXZNIiwibWFuYWdlciI6Ik1LVWVUQWlxWXBNTmk0M054bDVIeDM4aDdOOTNFQW9qUkN3d2ltNGw1d3dJbDdPdWpSTlV6V0ciLCJoYXNfaW5mb3MiOnRydWUsIm5yb3MiOlsiMjY3Il0sImF1dGgiOiJNS1VBbTNPaWhaaWJlQVRPQ2xaRnBYYUhFN3d3eGI0NGF3d1N1S1VwNG9lN3haTXRNcUJ1aVdIIiwiaWF0IjoxNjQ4MjE1NjE3LCJleHAiOjE2NDgzMDIwMTd9.EJZTSTac_SLgq9NFnLOctf-J06u3GY1L9ZTV_1zSQ7A"
8283
8283
  // }
8284
8284
 
8285
8285
  }).then(response => {
@@ -12227,6 +12227,7 @@ var script$4 = {
12227
12227
  data() {
12228
12228
  return {
12229
12229
  linkPreview: {
12230
+ author: "",
12230
12231
  description: "",
12231
12232
  imageSource: "",
12232
12233
  colorTheme: "",
@@ -12242,21 +12243,32 @@ var script$4 = {
12242
12243
  },
12243
12244
 
12244
12245
  methods: {
12246
+ returnURL() {
12247
+ if (!this.message) return "";
12248
+ const isSticker = this.message.indexOf("KSTICKERK") < 0 ? false : true;
12249
+ if (isSticker) return "";
12250
+ 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;
12251
+ const url = regex.exec(this.message);
12252
+
12253
+ if (!url || !url[0]) {
12254
+ console.warn("URL invalida para gerar preview");
12255
+ return "";
12256
+ }
12257
+
12258
+ return url[0].replace(/["'*]/g, "");
12259
+ },
12260
+
12245
12261
  async gerarPreview() {
12246
12262
  try {
12247
- if (!this.message) return;
12248
- const isSticker = this.message.indexOf("KSTICKERK") < 0 ? false : true;
12249
- if (isSticker) return;
12250
- 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;
12251
- const url = regex.exec(this.message);
12252
- if (!url || !url[0]) return console.warn("URL invalida para gerar preview");
12253
- const encodedURL = Buffer(url[0]).toString("base64");
12263
+ const url = this.returnURL();
12264
+ if (!url) return;
12265
+ const encodedURL = Buffer(url).toString("base64");
12254
12266
  const response = await this.$httpRequest({
12255
12267
  method: 'get',
12256
- url: `${baseURL}/preview?url=${encodedURL}${dev}` // headers: {
12257
- // Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdGQiOiJNS1VuNENMdFVlYTVZeDA4VmltQmgwQWN6Rkp0Y3pIUjZBTXd3eGI0NGF3d1ZTTTh2ZFhPS1pnIiwibWFuYWdlciI6Ik1LVVZkRm8zWmFreGJOUHd6bjNBRjVmVnF1MmVReFEyTUh2ZVloZ3V3SzJMbzU1IiwiaGFzX2luZm9zIjp0cnVlLCJucm9zIjpbIjEwIiwiMjYzIl0sImF1dGgiOiJNS1U3YzZNQnBJWTkyamFKbFZJTXQxd3dpbTRsNXd3Mjc4SU0wdkpRT0JnV3lTeHZZM3k0dmRYIiwiaWF0IjoxNjQ4MTQ2MzEwLCJleHAiOjE2NDgyMzI3MTB9.JSgv4e0DY0gkWaz6u9yBSH2P507zBZoTRKf9ki7TP_M"
12258
- // }
12259
-
12268
+ url: `${baseURL}/preview?url=${encodedURL}${dev}`,
12269
+ headers: {
12270
+ Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdGQiOiJNS1U5azQ3c2h2bGpOak9Db3dNMjJoMW94d3d4YjQ0YXd3allrbG1JVFNpMmV0aDI5ZTVIRXZNIiwibWFuYWdlciI6Ik1LVWVUQWlxWXBNTmk0M054bDVIeDM4aDdOOTNFQW9qUkN3d2ltNGw1d3dJbDdPdWpSTlV6V0ciLCJoYXNfaW5mb3MiOnRydWUsIm5yb3MiOlsiMjY3Il0sImF1dGgiOiJNS1VBbTNPaWhaaWJlQVRPQ2xaRnBYYUhFN3d3eGI0NGF3d1N1S1VwNG9lN3haTXRNcUJ1aVdIIiwiaWF0IjoxNjQ4MjE1NjE3LCJleHAiOjE2NDgzMDIwMTd9.EJZTSTac_SLgq9NFnLOctf-J06u3GY1L9ZTV_1zSQ7A"
12271
+ }
12260
12272
  });
12261
12273
  if (typeof response != "object" || typeof response.data != "object") throw "Retorno incorreto";
12262
12274
  const {
@@ -12275,12 +12287,31 @@ var script$4 = {
12275
12287
  theme_color
12276
12288
  } = raspagem;
12277
12289
  if (description) this.linkPreview.description = description;
12278
- if (og && og.image) this.linkPreview.imageSource = og.image;
12290
+ if (raspagem.author) this.linkPreview.author = raspagem.author;
12291
+
12292
+ if (og) {
12293
+ const {
12294
+ image,
12295
+ site_name,
12296
+ title,
12297
+ author
12298
+ } = og;
12299
+ if (image) this.linkPreview.imageSource = image;
12300
+ if (author || site_name || title) this.linkPreview.author = author ? author : site_name ? site_name : title;
12301
+ if (og.description) this.linkPreview.description = og.description;
12302
+ }
12303
+
12279
12304
  if (theme_color) this.linkPreview.colorTheme = theme_color;
12280
12305
  if (this.linkPreview.description || this.linkPreview.imageSource) this.linkPreview.isValid = true;
12281
12306
  } catch (e) {
12282
12307
  console.error("Erro ao gerar o preview do link: ", e);
12283
12308
  }
12309
+ },
12310
+
12311
+ openUrl() {
12312
+ const url = this.returnURL();
12313
+ if (!url) return;
12314
+ window.open(url, "_blank");
12284
12315
  }
12285
12316
 
12286
12317
  }
@@ -12298,7 +12329,15 @@ var __vue_render__$4 = function () {
12298
12329
  var _c = _vm._self._c || _h;
12299
12330
 
12300
12331
  return _vm.linkPreview.isValid ? _c('div', {
12301
- staticClass: "link-preview"
12332
+ staticClass: "link-preview",
12333
+ attrs: {
12334
+ "title": "Abrir " + _vm.returnURL() + " em uma nova guia"
12335
+ },
12336
+ on: {
12337
+ "click": function ($event) {
12338
+ return _vm.openUrl();
12339
+ }
12340
+ }
12302
12341
  }, [_vm.linkPreview.imageSource ? _c('div', {
12303
12342
  staticClass: "link-preview-image",
12304
12343
  style: _vm.linkPreview.colorTheme ? "background-color: " + _vm.linkPreview.colorTheme : ''
@@ -12307,6 +12346,12 @@ var __vue_render__$4 = function () {
12307
12346
  "src": _vm.linkPreview.imageSource,
12308
12347
  "alt": "Imagem referente ao link"
12309
12348
  }
12349
+ })]) : _vm._e(), _vm._v(" "), _vm.linkPreview.author ? _c('div', {
12350
+ staticClass: "link-preview-author"
12351
+ }, [_c('h1', {
12352
+ domProps: {
12353
+ "textContent": _vm._s(_vm.linkPreview.author)
12354
+ }
12310
12355
  })]) : _vm._e(), _vm._v(" "), _vm.linkPreview.description ? _c('div', {
12311
12356
  staticClass: "link-preview-infos"
12312
12357
  }, [_vm.linkPreview.description ? _c('p', {
@@ -12321,8 +12366,8 @@ var __vue_staticRenderFns__$4 = [];
12321
12366
 
12322
12367
  const __vue_inject_styles__$4 = function (inject) {
12323
12368
  if (!inject) return;
12324
- inject("data-v-071e3510_0", {
12325
- source: ".link-preview[data-v-071e3510]{display:flex;flex-direction:column;background-color:#eee;color:#333}.link-preview-image[data-v-071e3510]{display:flex;justify-content:center;align-items:center;padding:10px}.link-preview-image img[data-v-071e3510]{min-width:100px;max-width:200px}.link-preview-infos[data-v-071e3510]{background-color:rgba(38,38%,38%,10%);padding:5px;margin:5px;font-size:.8rem}",
12369
+ inject("data-v-1c4c4efa_0", {
12370
+ source: ".link-preview[data-v-1c4c4efa]{display:flex;flex-direction:column;background-color:#eee;color:#333;cursor:pointer;margin:5px 0;border-radius:5px}.link-preview-image[data-v-1c4c4efa]{display:flex;justify-content:center;align-items:center;padding:10px;margin-bottom:5px}.link-preview-author[data-v-1c4c4efa]{margin:5px;font-size:.625em}.link-preview-author h1[data-v-1c4c4efa]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.link-preview-image img[data-v-1c4c4efa]{min-width:100px;max-width:200px}.link-preview-infos[data-v-1c4c4efa]{background-color:#2626261a;padding:5px;margin:0 5px 5px 5px;font-size:.8rem;border-radius:5px}.link-preview:hover .link-preview-infos p[data-v-1c4c4efa]{text-decoration:underline}",
12326
12371
  map: undefined,
12327
12372
  media: undefined
12328
12373
  });
@@ -12330,7 +12375,7 @@ const __vue_inject_styles__$4 = function (inject) {
12330
12375
  /* scoped */
12331
12376
 
12332
12377
 
12333
- const __vue_scope_id__$4 = "data-v-071e3510";
12378
+ const __vue_scope_id__$4 = "data-v-1c4c4efa";
12334
12379
  /* module identifier */
12335
12380
 
12336
12381
  const __vue_module_identifier__$4 = undefined;