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.
@@ -7794,7 +7794,7 @@ var dev = window.location.hostname == 'localhost' ? '&teste=levchat2' : '';var s
7794
7794
  return _context.abrupt("return", _this.$httpRequest({
7795
7795
  method: 'get',
7796
7796
  url: "".concat(baseURL, "/messages/").concat(type, "?token_cliente=").concat(token).concat(dev) // headers: {
7797
- // Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdGQiOiJNS1VuNENMdFVlYTVZeDA4VmltQmgwQWN6Rkp0Y3pIUjZBTXd3eGI0NGF3d1ZTTTh2ZFhPS1pnIiwibWFuYWdlciI6Ik1LVVZkRm8zWmFreGJOUHd6bjNBRjVmVnF1MmVReFEyTUh2ZVloZ3V3SzJMbzU1IiwiaGFzX2luZm9zIjp0cnVlLCJucm9zIjpbIjEwIiwiMjYzIl0sImF1dGgiOiJNS1U3YzZNQnBJWTkyamFKbFZJTXQxd3dpbTRsNXd3Mjc4SU0wdkpRT0JnV3lTeHZZM3k0dmRYIiwiaWF0IjoxNjQ4MTQ2MzEwLCJleHAiOjE2NDgyMzI3MTB9.JSgv4e0DY0gkWaz6u9yBSH2P507zBZoTRKf9ki7TP_M"
7797
+ // Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdGQiOiJNS1U5azQ3c2h2bGpOak9Db3dNMjJoMW94d3d4YjQ0YXd3allrbG1JVFNpMmV0aDI5ZTVIRXZNIiwibWFuYWdlciI6Ik1LVWVUQWlxWXBNTmk0M054bDVIeDM4aDdOOTNFQW9qUkN3d2ltNGw1d3dJbDdPdWpSTlV6V0ciLCJoYXNfaW5mb3MiOnRydWUsIm5yb3MiOlsiMjY3Il0sImF1dGgiOiJNS1VBbTNPaWhaaWJlQVRPQ2xaRnBYYUhFN3d3eGI0NGF3d1N1S1VwNG9lN3haTXRNcUJ1aVdIIiwiaWF0IjoxNjQ4MjE1NjE3LCJleHAiOjE2NDgzMDIwMTd9.EJZTSTac_SLgq9NFnLOctf-J06u3GY1L9ZTV_1zSQ7A"
7798
7798
  // }
7799
7799
 
7800
7800
  }).then(function (response) {
@@ -11151,6 +11151,7 @@ var InteratividadeBotoes = __vue_component__$8;var script$4 = {
11151
11151
  data: function data() {
11152
11152
  return {
11153
11153
  linkPreview: {
11154
+ author: "",
11154
11155
  description: "",
11155
11156
  imageSource: "",
11156
11157
  colorTheme: "",
@@ -11166,106 +11167,106 @@ var InteratividadeBotoes = __vue_component__$8;var script$4 = {
11166
11167
  });
11167
11168
  },
11168
11169
  methods: {
11170
+ returnURL: function returnURL() {
11171
+ if (!this.message) return "";
11172
+ var isSticker = this.message.indexOf("KSTICKERK") < 0 ? false : true;
11173
+ if (isSticker) return "";
11174
+ var 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;
11175
+ var url = regex.exec(this.message);
11176
+
11177
+ if (!url || !url[0]) {
11178
+ console.warn("URL invalida para gerar preview");
11179
+ return "";
11180
+ }
11181
+
11182
+ return url[0].replace(/["'*]/g, "");
11183
+ },
11169
11184
  gerarPreview: function gerarPreview() {
11170
11185
  var _this2 = this;
11171
11186
 
11172
11187
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
11173
- var isSticker, regex, url, encodedURL, response, data, st_ret, msg_ret, raspagem, description, og, theme_color;
11188
+ var url, encodedURL, response, data, st_ret, msg_ret, raspagem, description, og, theme_color, author;
11174
11189
  return regeneratorRuntime.wrap(function _callee$(_context) {
11175
11190
  while (1) {
11176
11191
  switch (_context.prev = _context.next) {
11177
11192
  case 0:
11178
11193
  _context.prev = 0;
11194
+ url = _this2.returnURL();
11179
11195
 
11180
- if (_this2.message) {
11181
- _context.next = 3;
11196
+ if (url) {
11197
+ _context.next = 4;
11182
11198
  break;
11183
11199
  }
11184
11200
 
11185
11201
  return _context.abrupt("return");
11186
11202
 
11187
- case 3:
11188
- isSticker = _this2.message.indexOf("KSTICKERK") < 0 ? false : true;
11189
-
11190
- if (!isSticker) {
11191
- _context.next = 6;
11192
- break;
11193
- }
11194
-
11195
- return _context.abrupt("return");
11196
-
11197
- case 6:
11198
- 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;
11199
- url = regex.exec(_this2.message);
11200
-
11201
- if (!(!url || !url[0])) {
11202
- _context.next = 10;
11203
- break;
11204
- }
11205
-
11206
- return _context.abrupt("return", console.warn("URL invalida para gerar preview"));
11207
-
11208
- case 10:
11209
- encodedURL = Buffer(url[0]).toString("base64");
11210
- _context.next = 13;
11203
+ case 4:
11204
+ encodedURL = Buffer(url).toString("base64");
11205
+ _context.next = 7;
11211
11206
  return _this2.$httpRequest({
11212
11207
  method: 'get',
11213
- url: "".concat(baseURL, "/preview?url=").concat(encodedURL).concat(dev) // headers: {
11214
- // Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdGQiOiJNS1VuNENMdFVlYTVZeDA4VmltQmgwQWN6Rkp0Y3pIUjZBTXd3eGI0NGF3d1ZTTTh2ZFhPS1pnIiwibWFuYWdlciI6Ik1LVVZkRm8zWmFreGJOUHd6bjNBRjVmVnF1MmVReFEyTUh2ZVloZ3V3SzJMbzU1IiwiaGFzX2luZm9zIjp0cnVlLCJucm9zIjpbIjEwIiwiMjYzIl0sImF1dGgiOiJNS1U3YzZNQnBJWTkyamFKbFZJTXQxd3dpbTRsNXd3Mjc4SU0wdkpRT0JnV3lTeHZZM3k0dmRYIiwiaWF0IjoxNjQ4MTQ2MzEwLCJleHAiOjE2NDgyMzI3MTB9.JSgv4e0DY0gkWaz6u9yBSH2P507zBZoTRKf9ki7TP_M"
11215
- // }
11216
-
11208
+ url: "".concat(baseURL, "/preview?url=").concat(encodedURL).concat(dev),
11209
+ headers: {
11210
+ Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdGQiOiJNS1U5azQ3c2h2bGpOak9Db3dNMjJoMW94d3d4YjQ0YXd3allrbG1JVFNpMmV0aDI5ZTVIRXZNIiwibWFuYWdlciI6Ik1LVWVUQWlxWXBNTmk0M054bDVIeDM4aDdOOTNFQW9qUkN3d2ltNGw1d3dJbDdPdWpSTlV6V0ciLCJoYXNfaW5mb3MiOnRydWUsIm5yb3MiOlsiMjY3Il0sImF1dGgiOiJNS1VBbTNPaWhaaWJlQVRPQ2xaRnBYYUhFN3d3eGI0NGF3d1N1S1VwNG9lN3haTXRNcUJ1aVdIIiwiaWF0IjoxNjQ4MjE1NjE3LCJleHAiOjE2NDgzMDIwMTd9.EJZTSTac_SLgq9NFnLOctf-J06u3GY1L9ZTV_1zSQ7A"
11211
+ }
11217
11212
  });
11218
11213
 
11219
- case 13:
11214
+ case 7:
11220
11215
  response = _context.sent;
11221
11216
 
11222
11217
  if (!(_typeof(response) != "object" || _typeof(response.data) != "object")) {
11223
- _context.next = 16;
11218
+ _context.next = 10;
11224
11219
  break;
11225
11220
  }
11226
11221
 
11227
11222
  throw "Retorno incorreto";
11228
11223
 
11229
- case 16:
11224
+ case 10:
11230
11225
  data = response.data;
11231
11226
  st_ret = data.st_ret, msg_ret = data.msg_ret, raspagem = data.raspagem;
11232
11227
 
11233
11228
  if (!(st_ret != "OK")) {
11234
- _context.next = 20;
11229
+ _context.next = 14;
11235
11230
  break;
11236
11231
  }
11237
11232
 
11238
11233
  throw "".concat(st_ret, " - ").concat(msg_ret);
11239
11234
 
11240
- case 20:
11235
+ case 14:
11241
11236
  if (raspagem) {
11242
- _context.next = 22;
11237
+ _context.next = 16;
11243
11238
  break;
11244
11239
  }
11245
11240
 
11246
11241
  throw "".concat(st_ret, " - ").concat(msg_ret, " | (Raspagem nao encontrada no retorno)");
11247
11242
 
11248
- case 22:
11249
- description = raspagem.description, og = raspagem.og, theme_color = raspagem.theme_color;
11243
+ case 16:
11244
+ description = raspagem.description, og = raspagem.og, theme_color = raspagem.theme_color, author = raspagem.author;
11245
+ if (author) _this2.linkPreview.author = author;
11250
11246
  if (description) _this2.linkPreview.description = description;
11251
11247
  if (og && og.image) _this2.linkPreview.imageSource = og.image;
11252
11248
  if (theme_color) _this2.linkPreview.colorTheme = theme_color;
11253
11249
  if (_this2.linkPreview.description || _this2.linkPreview.imageSource) _this2.linkPreview.isValid = true;
11254
- _context.next = 32;
11250
+ _context.next = 27;
11255
11251
  break;
11256
11252
 
11257
- case 29:
11258
- _context.prev = 29;
11253
+ case 24:
11254
+ _context.prev = 24;
11259
11255
  _context.t0 = _context["catch"](0);
11260
11256
  console.error("Erro ao gerar o preview do link: ", _context.t0);
11261
11257
 
11262
- case 32:
11258
+ case 27:
11263
11259
  case "end":
11264
11260
  return _context.stop();
11265
11261
  }
11266
11262
  }
11267
- }, _callee, null, [[0, 29]]);
11263
+ }, _callee, null, [[0, 24]]);
11268
11264
  }))();
11265
+ },
11266
+ openUrl: function openUrl() {
11267
+ var url = this.returnURL();
11268
+ if (!url) return;
11269
+ window.open(url, "_blank");
11269
11270
  }
11270
11271
  }
11271
11272
  };/* script */
@@ -11280,8 +11281,16 @@ var __vue_render__$4 = function __vue_render__() {
11280
11281
  var _c = _vm._self._c || _h;
11281
11282
 
11282
11283
  return _vm.linkPreview.isValid ? _c('div', {
11283
- staticClass: "link-preview"
11284
- }, [_vm._ssrNode((_vm.linkPreview.imageSource ? "<div class=\"link-preview-image\"" + _vm._ssrStyle(null, _vm.linkPreview.colorTheme ? "background-color: " + _vm.linkPreview.colorTheme : '', null) + " data-v-071e3510><img" + _vm._ssrAttr("src", _vm.linkPreview.imageSource) + " alt=\"Imagem referente ao link\" data-v-071e3510></div>" : "<!---->") + " " + (_vm.linkPreview.description ? "<div class=\"link-preview-infos\" data-v-071e3510>" + (_vm.linkPreview.description ? "<p data-v-071e3510>" + _vm._ssrEscape(_vm._s(_vm.linkPreview.description)) + "</p>" : "<!---->") + "</div>" : "<!---->"))]) : _vm._e();
11284
+ staticClass: "link-preview",
11285
+ attrs: {
11286
+ "title": "Abrir " + _vm.returnURL() + " em uma nova guia"
11287
+ },
11288
+ on: {
11289
+ "click": function click($event) {
11290
+ return _vm.openUrl();
11291
+ }
11292
+ }
11293
+ }, [_vm._ssrNode((_vm.linkPreview.imageSource ? "<div class=\"link-preview-image\"" + _vm._ssrStyle(null, _vm.linkPreview.colorTheme ? "background-color: " + _vm.linkPreview.colorTheme : '', null) + " data-v-87545f64><img" + _vm._ssrAttr("src", _vm.linkPreview.imageSource) + " alt=\"Imagem referente ao link\" data-v-87545f64></div>" : "<!---->") + " " + (_vm.linkPreview.author ? "<div class=\"link-preview-author\" data-v-87545f64><h1 data-v-87545f64>" + _vm._ssrEscape(_vm._s(_vm.linkPreview.author)) + "</h1></div>" : "<!---->") + " " + (_vm.linkPreview.description ? "<div class=\"link-preview-infos\" data-v-87545f64>" + (_vm.linkPreview.description ? "<p data-v-87545f64>" + _vm._ssrEscape(_vm._s(_vm.linkPreview.description)) + "</p>" : "<!---->") + "</div>" : "<!---->"))]) : _vm._e();
11285
11294
  };
11286
11295
 
11287
11296
  var __vue_staticRenderFns__$4 = [];
@@ -11289,8 +11298,8 @@ var __vue_staticRenderFns__$4 = [];
11289
11298
 
11290
11299
  var __vue_inject_styles__$4 = function __vue_inject_styles__(inject) {
11291
11300
  if (!inject) return;
11292
- inject("data-v-071e3510_0", {
11293
- 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}",
11301
+ inject("data-v-87545f64_0", {
11302
+ 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}",
11294
11303
  map: undefined,
11295
11304
  media: undefined
11296
11305
  });
@@ -11298,10 +11307,10 @@ var __vue_inject_styles__$4 = function __vue_inject_styles__(inject) {
11298
11307
  /* scoped */
11299
11308
 
11300
11309
 
11301
- var __vue_scope_id__$4 = "data-v-071e3510";
11310
+ var __vue_scope_id__$4 = "data-v-87545f64";
11302
11311
  /* module identifier */
11303
11312
 
11304
- var __vue_module_identifier__$4 = "data-v-071e3510";
11313
+ var __vue_module_identifier__$4 = "data-v-87545f64";
11305
11314
  /* functional template */
11306
11315
 
11307
11316
  var __vue_is_functional_template__$4 = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-intergrall-plugins",
3
- "version": "0.0.192",
3
+ "version": "0.0.193",
4
4
  "description": "",
5
5
  "main": "dist/vue-intergrall-plugins.ssr.js",
6
6
  "browser": "dist/vue-intergrall-plugins.esm.js",
@@ -1,5 +1,10 @@
1
1
  <template>
2
- <div v-if="linkPreview.isValid" class="link-preview">
2
+ <div
3
+ v-if="linkPreview.isValid"
4
+ class="link-preview"
5
+ @click="openUrl()"
6
+ :title="`Abrir ${returnURL()} em uma nova guia`"
7
+ >
3
8
  <div
4
9
  v-if="linkPreview.imageSource"
5
10
  :style="linkPreview.colorTheme ? `background-color: ${linkPreview.colorTheme}` : ''"
@@ -7,6 +12,9 @@
7
12
  >
8
13
  <img :src="linkPreview.imageSource" alt="Imagem referente ao link" />
9
14
  </div>
15
+ <div class="link-preview-author" v-if="linkPreview.author">
16
+ <h1 v-text="linkPreview.author"></h1>
17
+ </div>
10
18
  <div v-if="linkPreview.description" class="link-preview-infos">
11
19
  <p v-if="linkPreview.description" v-text="linkPreview.description"></p>
12
20
  </div>
@@ -26,6 +34,7 @@ export default {
26
34
  data() {
27
35
  return {
28
36
  linkPreview: {
37
+ author: "",
29
38
  description: "",
30
39
  imageSource: "",
31
40
  colorTheme: "",
@@ -37,29 +46,38 @@ export default {
37
46
  this.$nextTick(() => { this.gerarPreview() })
38
47
  },
39
48
  methods: {
40
- async gerarPreview() {
41
- try {
42
- if(!this.message) return
49
+ returnURL() {
50
+ if(!this.message) return ""
43
51
  const isSticker = this.message.indexOf("KSTICKERK") < 0 ? false : true
44
- if(isSticker) return
52
+ if(isSticker) return ""
45
53
  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
46
54
  const url = regex.exec(this.message)
47
- if(!url || !url[0]) return console.warn("URL invalida para gerar preview")
48
- const encodedURL = Buffer(url[0]).toString("base64")
55
+ if(!url || !url[0]) {
56
+ console.warn("URL invalida para gerar preview")
57
+ return ""
58
+ }
59
+ return url[0].replace(/["'*]/g, "")
60
+ },
61
+ async gerarPreview() {
62
+ try {
63
+ const url = this.returnURL()
64
+ if(!url) return
65
+ const encodedURL = Buffer(url).toString("base64")
49
66
  const response = await this.$httpRequest(
50
67
  {
51
68
  method: 'get',
52
69
  url: `${baseURL}/preview?url=${encodedURL}${dev}`,
53
- // headers: {
54
- // Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdGQiOiJNS1VuNENMdFVlYTVZeDA4VmltQmgwQWN6Rkp0Y3pIUjZBTXd3eGI0NGF3d1ZTTTh2ZFhPS1pnIiwibWFuYWdlciI6Ik1LVVZkRm8zWmFreGJOUHd6bjNBRjVmVnF1MmVReFEyTUh2ZVloZ3V3SzJMbzU1IiwiaGFzX2luZm9zIjp0cnVlLCJucm9zIjpbIjEwIiwiMjYzIl0sImF1dGgiOiJNS1U3YzZNQnBJWTkyamFKbFZJTXQxd3dpbTRsNXd3Mjc4SU0wdkpRT0JnV3lTeHZZM3k0dmRYIiwiaWF0IjoxNjQ4MTQ2MzEwLCJleHAiOjE2NDgyMzI3MTB9.JSgv4e0DY0gkWaz6u9yBSH2P507zBZoTRKf9ki7TP_M"
55
- // }
70
+ headers: {
71
+ Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdGQiOiJNS1U5azQ3c2h2bGpOak9Db3dNMjJoMW94d3d4YjQ0YXd3allrbG1JVFNpMmV0aDI5ZTVIRXZNIiwibWFuYWdlciI6Ik1LVWVUQWlxWXBNTmk0M054bDVIeDM4aDdOOTNFQW9qUkN3d2ltNGw1d3dJbDdPdWpSTlV6V0ciLCJoYXNfaW5mb3MiOnRydWUsIm5yb3MiOlsiMjY3Il0sImF1dGgiOiJNS1VBbTNPaWhaaWJlQVRPQ2xaRnBYYUhFN3d3eGI0NGF3d1N1S1VwNG9lN3haTXRNcUJ1aVdIIiwiaWF0IjoxNjQ4MjE1NjE3LCJleHAiOjE2NDgzMDIwMTd9.EJZTSTac_SLgq9NFnLOctf-J06u3GY1L9ZTV_1zSQ7A"
72
+ }
56
73
  })
57
74
  if(typeof response != "object" || typeof response.data != "object") throw "Retorno incorreto"
58
75
  const { data } = response
59
76
  const { st_ret, msg_ret, raspagem } = data
60
77
  if(st_ret != "OK") throw `${st_ret} - ${msg_ret}`
61
78
  if(!raspagem) throw `${st_ret} - ${msg_ret} | (Raspagem nao encontrada no retorno)`
62
- const { description, og, theme_color } = raspagem
79
+ const { description, og, theme_color, author } = raspagem
80
+ if(author) this.linkPreview.author = author
63
81
  if(description) this.linkPreview.description = description
64
82
  if(og && og.image) this.linkPreview.imageSource = og.image
65
83
  if(theme_color) this.linkPreview.colorTheme = theme_color
@@ -69,7 +87,11 @@ export default {
69
87
  console.error("Erro ao gerar o preview do link: ", e)
70
88
  }
71
89
  },
72
-
90
+ openUrl() {
91
+ const url = this.returnURL()
92
+ if(!url) return
93
+ window.open(url, "_blank")
94
+ }
73
95
  }
74
96
  }
75
97
  </script>
@@ -80,6 +102,9 @@ export default {
80
102
  flex-direction: column;
81
103
  background-color: #EEE;
82
104
  color: #333;
105
+ cursor: pointer;
106
+ margin-bottom: 5px;
107
+ border-radius: 5px;
83
108
  }
84
109
 
85
110
  .link-preview-image {
@@ -87,6 +112,12 @@ export default {
87
112
  justify-content: center;
88
113
  align-items: center;
89
114
  padding: 10px;
115
+ margin-bottom: 5px;
116
+ }
117
+
118
+ .link-preview-author {
119
+ margin: 5px;
120
+ font-size: .625em
90
121
  }
91
122
 
92
123
  .link-preview-image img {
@@ -97,7 +128,8 @@ export default {
97
128
  .link-preview-infos {
98
129
  background-color: rgba(38, 38, 38, 10%);
99
130
  padding: 5px;
100
- margin: 5px;
131
+ margin: 0 5px 5px 5px;
101
132
  font-size: .8rem;
133
+ border-radius: 5px;
102
134
  }
103
135
  </style>