vue-intergrall-plugins 0.0.191 → 0.0.194

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,30 @@ 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
+
12291
+ if (og) {
12292
+ const {
12293
+ image,
12294
+ site_name,
12295
+ title,
12296
+ author
12297
+ } = og;
12298
+ if (image) this.linkPreview.imageSource = image;
12299
+ if (author || site_name || title) this.linkPreview.author = author ? author : site_name ? site_name : title;
12300
+ if (og.description) this.linkPreview.description = og.description;
12301
+ }
12302
+
12279
12303
  if (theme_color) this.linkPreview.colorTheme = theme_color;
12280
12304
  if (this.linkPreview.description || this.linkPreview.imageSource) this.linkPreview.isValid = true;
12281
12305
  } catch (e) {
12282
12306
  console.error("Erro ao gerar o preview do link: ", e);
12283
12307
  }
12308
+ },
12309
+
12310
+ openUrl() {
12311
+ const url = this.returnURL();
12312
+ if (!url) return;
12313
+ window.open(url, "_blank");
12284
12314
  }
12285
12315
 
12286
12316
  }
@@ -12298,7 +12328,15 @@ var __vue_render__$4 = function () {
12298
12328
  var _c = _vm._self._c || _h;
12299
12329
 
12300
12330
  return _vm.linkPreview.isValid ? _c('div', {
12301
- staticClass: "link-preview"
12331
+ staticClass: "link-preview",
12332
+ attrs: {
12333
+ "title": "Abrir " + _vm.returnURL() + " em uma nova guia"
12334
+ },
12335
+ on: {
12336
+ "click": function ($event) {
12337
+ return _vm.openUrl();
12338
+ }
12339
+ }
12302
12340
  }, [_vm.linkPreview.imageSource ? _c('div', {
12303
12341
  staticClass: "link-preview-image",
12304
12342
  style: _vm.linkPreview.colorTheme ? "background-color: " + _vm.linkPreview.colorTheme : ''
@@ -12307,6 +12345,12 @@ var __vue_render__$4 = function () {
12307
12345
  "src": _vm.linkPreview.imageSource,
12308
12346
  "alt": "Imagem referente ao link"
12309
12347
  }
12348
+ })]) : _vm._e(), _vm._v(" "), _vm.linkPreview.author ? _c('div', {
12349
+ staticClass: "link-preview-author"
12350
+ }, [_c('h1', {
12351
+ domProps: {
12352
+ "textContent": _vm._s(_vm.linkPreview.author)
12353
+ }
12310
12354
  })]) : _vm._e(), _vm._v(" "), _vm.linkPreview.description ? _c('div', {
12311
12355
  staticClass: "link-preview-infos"
12312
12356
  }, [_vm.linkPreview.description ? _c('p', {
@@ -12321,8 +12365,8 @@ var __vue_staticRenderFns__$4 = [];
12321
12365
 
12322
12366
  const __vue_inject_styles__$4 = function (inject) {
12323
12367
  if (!inject) return;
12324
- inject("data-v-718e1ebf_0", {
12325
- source: ".link-preview[data-v-718e1ebf]{display:flex;flex-direction:column}.link-preview-image[data-v-718e1ebf]{display:flex;justify-content:center;align-items:center;padding:10px}.link-preview-image img[data-v-718e1ebf]{max-width:250px}.link-preview-infos[data-v-718e1ebf]{background-color:rgba(0,0,0,.1);padding:10px;font-size:.8rem}",
12368
+ inject("data-v-0d92e314_0", {
12369
+ source: ".link-preview[data-v-0d92e314]{display:flex;flex-direction:column;background-color:#eee;color:#333;cursor:pointer;margin-bottom:5px;border-radius:5px}.link-preview-image[data-v-0d92e314]{display:flex;justify-content:center;align-items:center;padding:10px;margin-bottom:5px}.link-preview-author[data-v-0d92e314]{margin:5px;font-size:.625em}.link-preview-image img[data-v-0d92e314]{min-width:100px;max-width:200px}.link-preview-infos[data-v-0d92e314]{background-color:#2626261a;padding:5px;margin:0 5px 5px 5px;font-size:.8rem;border-radius:5px}",
12326
12370
  map: undefined,
12327
12371
  media: undefined
12328
12372
  });
@@ -12330,7 +12374,7 @@ const __vue_inject_styles__$4 = function (inject) {
12330
12374
  /* scoped */
12331
12375
 
12332
12376
 
12333
- const __vue_scope_id__$4 = "data-v-718e1ebf";
12377
+ const __vue_scope_id__$4 = "data-v-0d92e314";
12334
12378
  /* module identifier */
12335
12379
 
12336
12380
  const __vue_module_identifier__$4 = undefined;