vue-intergrall-plugins 0.0.192 → 0.0.193

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 {
@@ -12272,8 +12284,10 @@ var script$4 = {
12272
12284
  const {
12273
12285
  description,
12274
12286
  og,
12275
- theme_color
12287
+ theme_color,
12288
+ author
12276
12289
  } = raspagem;
12290
+ if (author) this.linkPreview.author = author;
12277
12291
  if (description) this.linkPreview.description = description;
12278
12292
  if (og && og.image) this.linkPreview.imageSource = og.image;
12279
12293
  if (theme_color) this.linkPreview.colorTheme = theme_color;
@@ -12281,6 +12295,12 @@ var script$4 = {
12281
12295
  } catch (e) {
12282
12296
  console.error("Erro ao gerar o preview do link: ", e);
12283
12297
  }
12298
+ },
12299
+
12300
+ openUrl() {
12301
+ const url = this.returnURL();
12302
+ if (!url) return;
12303
+ window.open(url, "_blank");
12284
12304
  }
12285
12305
 
12286
12306
  }
@@ -12298,7 +12318,15 @@ var __vue_render__$4 = function () {
12298
12318
  var _c = _vm._self._c || _h;
12299
12319
 
12300
12320
  return _vm.linkPreview.isValid ? _c('div', {
12301
- staticClass: "link-preview"
12321
+ staticClass: "link-preview",
12322
+ attrs: {
12323
+ "title": "Abrir " + _vm.returnURL() + " em uma nova guia"
12324
+ },
12325
+ on: {
12326
+ "click": function ($event) {
12327
+ return _vm.openUrl();
12328
+ }
12329
+ }
12302
12330
  }, [_vm.linkPreview.imageSource ? _c('div', {
12303
12331
  staticClass: "link-preview-image",
12304
12332
  style: _vm.linkPreview.colorTheme ? "background-color: " + _vm.linkPreview.colorTheme : ''
@@ -12307,6 +12335,12 @@ var __vue_render__$4 = function () {
12307
12335
  "src": _vm.linkPreview.imageSource,
12308
12336
  "alt": "Imagem referente ao link"
12309
12337
  }
12338
+ })]) : _vm._e(), _vm._v(" "), _vm.linkPreview.author ? _c('div', {
12339
+ staticClass: "link-preview-author"
12340
+ }, [_c('h1', {
12341
+ domProps: {
12342
+ "textContent": _vm._s(_vm.linkPreview.author)
12343
+ }
12310
12344
  })]) : _vm._e(), _vm._v(" "), _vm.linkPreview.description ? _c('div', {
12311
12345
  staticClass: "link-preview-infos"
12312
12346
  }, [_vm.linkPreview.description ? _c('p', {
@@ -12321,8 +12355,8 @@ var __vue_staticRenderFns__$4 = [];
12321
12355
 
12322
12356
  const __vue_inject_styles__$4 = function (inject) {
12323
12357
  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}",
12358
+ inject("data-v-87545f64_0", {
12359
+ source: ".link-preview[data-v-87545f64]{display:flex;flex-direction:column;background-color:#eee;color:#333;cursor:pointer;margin-bottom:5px;border-radius:5px}.link-preview-image[data-v-87545f64]{display:flex;justify-content:center;align-items:center;padding:10px;margin-bottom:5px}.link-preview-author[data-v-87545f64]{margin:5px;font-size:.625em}.link-preview-image img[data-v-87545f64]{min-width:100px;max-width:200px}.link-preview-infos[data-v-87545f64]{background-color:rgba(38,38%,38%,10%);padding:5px;margin:0 5px 5px 5px;font-size:.8rem;border-radius:5px}",
12326
12360
  map: undefined,
12327
12361
  media: undefined
12328
12362
  });
@@ -12330,7 +12364,7 @@ const __vue_inject_styles__$4 = function (inject) {
12330
12364
  /* scoped */
12331
12365
 
12332
12366
 
12333
- const __vue_scope_id__$4 = "data-v-071e3510";
12367
+ const __vue_scope_id__$4 = "data-v-87545f64";
12334
12368
  /* module identifier */
12335
12369
 
12336
12370
  const __vue_module_identifier__$4 = undefined;