vue-intergrall-plugins 1.0.13 → 1.0.15

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.
@@ -25,6 +25,27 @@
25
25
  return a;
26
26
  }
27
27
  }
28
+ function ownKeys(e, r) {
29
+ var t = Object.keys(e);
30
+ if (Object.getOwnPropertySymbols) {
31
+ var o = Object.getOwnPropertySymbols(e);
32
+ r && (o = o.filter(function (r) {
33
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
34
+ })), t.push.apply(t, o);
35
+ }
36
+ return t;
37
+ }
38
+ function _objectSpread2(e) {
39
+ for (var r = 1; r < arguments.length; r++) {
40
+ var t = null != arguments[r] ? arguments[r] : {};
41
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
42
+ _defineProperty(e, r, t[r]);
43
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
44
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
45
+ });
46
+ }
47
+ return e;
48
+ }
28
49
  function _regeneratorRuntime() {
29
50
  _regeneratorRuntime = function () {
30
51
  return e;
@@ -326,6 +347,20 @@ function _regeneratorRuntime() {
326
347
  }
327
348
  }, e;
328
349
  }
350
+ function _toPrimitive(t, r) {
351
+ if ("object" != typeof t || !t) return t;
352
+ var e = t[Symbol.toPrimitive];
353
+ if (void 0 !== e) {
354
+ var i = e.call(t, r || "default");
355
+ if ("object" != typeof i) return i;
356
+ throw new TypeError("@@toPrimitive must return a primitive value.");
357
+ }
358
+ return ("string" === r ? String : Number)(t);
359
+ }
360
+ function _toPropertyKey(t) {
361
+ var i = _toPrimitive(t, "string");
362
+ return "symbol" == typeof i ? i : String(i);
363
+ }
329
364
  function _typeof(o) {
330
365
  "@babel/helpers - typeof";
331
366
 
@@ -365,6 +400,20 @@ function _asyncToGenerator(fn) {
365
400
  });
366
401
  };
367
402
  }
403
+ function _defineProperty(obj, key, value) {
404
+ key = _toPropertyKey(key);
405
+ if (key in obj) {
406
+ Object.defineProperty(obj, key, {
407
+ value: value,
408
+ enumerable: true,
409
+ configurable: true,
410
+ writable: true
411
+ });
412
+ } else {
413
+ obj[key] = value;
414
+ }
415
+ return obj;
416
+ }
368
417
  function _slicedToArray(arr, i) {
369
418
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
370
419
  }
@@ -8614,6 +8663,13 @@ var LinkPreview = __vue_component__$a;var script$5 = {
8614
8663
  if (!this.showMenu || _typeof(this.showMenu) !== "object") return false;
8615
8664
  for (var key in this.showMenu) {
8616
8665
  if (this.showMenu.hasOwnProperty(key) && this.showMenu[key] === true) return true;
8666
+ if (key === "customButtons") {
8667
+ var hasAny = this.showMenu[key].some(function (_ref) {
8668
+ var use = _ref.use;
8669
+ return use;
8670
+ });
8671
+ if (hasAny) return true;
8672
+ }
8617
8673
  }
8618
8674
  return false;
8619
8675
  }
@@ -8656,17 +8712,6 @@ var LinkPreview = __vue_component__$a;var script$5 = {
8656
8712
  if (this.isMenuOpen) this.closeMenu();
8657
8713
  this.isEmojisOpen = !this.isEmojisOpen;
8658
8714
  },
8659
- useGPTHandler: function useGPTHandler() {
8660
- if (this.isMenuOpen) this.closeMenu();
8661
- var params = {
8662
- message: this.msg
8663
- };
8664
- if (this.showMenu.gptCallback && typeof this.showMenu.gptCallback === "function") {
8665
- this.showMenu.gptCallback(params);
8666
- return;
8667
- }
8668
- this.$emit("use-gpt", params);
8669
- },
8670
8715
  addReaction: function addReaction(emoji) {
8671
8716
  this.messageReaction = this.messageReaction && this.messageReaction.hexa === emoji.hexa ? "" : {
8672
8717
  hexa: emoji.hexa,
@@ -8811,6 +8856,22 @@ var LinkPreview = __vue_component__$a;var script$5 = {
8811
8856
  var regex = /(\n|&nbsp;)/g;
8812
8857
  if (regex.test(msg)) msg = msg.replace(regex, "<br>");
8813
8858
  return msg;
8859
+ },
8860
+ returnParams: function returnParams(params) {
8861
+ var _this = this;
8862
+ var defaultParams = {
8863
+ message: this.msg
8864
+ };
8865
+ if (!params) return defaultParams;
8866
+ var keys = params.instanceKeys.split("|");
8867
+ if (!keys || !keys.length) return _objectSpread2({
8868
+ defaultParams: defaultParams
8869
+ }, params.values);
8870
+ var customParams = _objectSpread2({}, params.values);
8871
+ keys.forEach(function (key) {
8872
+ if (_this[key]) customParams[key] = _this[key];else console.warn("Cant find ".concat(key, " on 'this' instance"));
8873
+ });
8874
+ return Object.keys(customParams).length ? customParams : defaultParams;
8814
8875
  }
8815
8876
  }
8816
8877
  };/* script */
@@ -9160,23 +9221,33 @@ var __vue_render__$5 = function __vue_render__() {
9160
9221
  attrs: {
9161
9222
  "icon": ['fas', 'smile']
9162
9223
  }
9163
- })], 1) : _vm._e(), _vm._v(" "), _vm.showMenu.useGPT ? _c('span', {
9164
- directives: [{
9165
- name: "tippy",
9166
- rawName: "v-tippy"
9167
- }],
9168
- staticClass: "menu-mensagem",
9169
- attrs: {
9170
- "content": _vm.dictionary.tit_use_gpt
9171
- },
9172
- on: {
9173
- "click": _vm.useGPTHandler
9174
- }
9175
- }, [_c('fa-icon', {
9176
- attrs: {
9177
- "icon": ['fas', 'question-circle']
9178
- }
9179
- })], 1) : _vm._e()]) : _vm._e(), _vm._v(" "), _vm.isEmojisOpen ? _c('div', {
9224
+ })], 1) : _vm._e(), _vm._v(" "), _vm.showMenu.customButtons && _vm.showMenu.customButtons.length ? _vm._l(_vm.showMenu.customButtons, function (button, index) {
9225
+ return _c('span', {
9226
+ directives: [{
9227
+ name: "show",
9228
+ rawName: "v-show",
9229
+ value: button.use,
9230
+ expression: "button.use"
9231
+ }, {
9232
+ name: "tippy",
9233
+ rawName: "v-tippy"
9234
+ }],
9235
+ key: button.id || index,
9236
+ class: "" + (button.customClass || 'menu-mensagem'),
9237
+ attrs: {
9238
+ "content": button.tippyContent
9239
+ },
9240
+ on: {
9241
+ "click": function click($event) {
9242
+ button.callback(_vm.returnParams(button.params));
9243
+ }
9244
+ }
9245
+ }, [_c('fa-icon', {
9246
+ attrs: {
9247
+ "icon": ['fas', button.icon || 'question-circle']
9248
+ }
9249
+ })], 1);
9250
+ }) : _vm._e()], 2) : _vm._e(), _vm._v(" "), _vm.isEmojisOpen ? _c('div', {
9180
9251
  directives: [{
9181
9252
  name: "on-clickaway",
9182
9253
  rawName: "v-on-clickaway",
@@ -9243,7 +9314,7 @@ var __vue_staticRenderFns__$5 = [];
9243
9314
  /* style */
9244
9315
  var __vue_inject_styles__$5 = function __vue_inject_styles__(inject) {
9245
9316
  if (!inject) return;
9246
- inject("data-v-73ca470f_0", {
9317
+ inject("data-v-bb67a87c_0", {
9247
9318
  source: ":root{--message-color:#373737;--text-color:#fff;--files-bg:rgba(255, 255, 255, 0.1);--files-bg-hover:rgba(255, 255, 255, 0.1);--light:80;--threshold:60}.fade-enter-active,.fade-leave-active{transition:opacity .5s}.fade-enter,.fade-leave-to{opacity:0}.mensagem-reply{padding:5px 10px;font-size:12px;color:#666;transition:background-color 150ms ease-in-out;border-radius:5px;margin:5px 0;overflow:hidden;max-width:100%}.mensagem-reply p{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.message-reply-principal{border-left:3px solid transparent;background-color:rgba(100,100,100,.1)}.message-reply-principal:hover{background-color:rgba(100,100,100,.2)}.message-reply-outros{background-color:#f5f5f5;border-left:3px solid var(--message-color)}.message-reply-outros:hover{background-color:#ebebeb}.mensagem-reply-vazia{display:flex;align-items:center}.mensagem-reply-vazia svg{margin-right:5px;color:#ba181b}.mensagem{padding:20px 7px 14px 7px;border-radius:5px;min-width:150px;min-height:60px;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;position:relative;max-width:80%;margin-bottom:10px;font-size:12px;word-break:break-word;-webkit-box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12);-moz-box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12);box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12)}.mensagem.max-w-60{max-width:60%}.mensagem.mapa{width:100%}.mensagem.hist-msg{animation:show 1s}.mensagem a{margin-right:5px;font-weight:550;color:inherit;text-decoration:none}.mensagem a:hover{text-decoration:underline}.message p{white-space:pre-wrap}.mensagem:hover .menu-primario{visibility:visible;opacity:1}.mensagem-anexo a,.mensagem-div-mapa a{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.reply{cursor:pointer;position:absolute;right:53px;bottom:5px;font-size:9.6px;color:#67a332;width:14.4px;height:14.4px;display:flex;justify-content:center;align-items:center;border-radius:50%;background-color:#fff}.reply svg{margin-top:-1px;margin-right:-1px}.reply-with-2-icons{right:30px}.check{cursor:pointer;position:absolute;right:10px;bottom:2px;font-size:11.2px}.check.visualizado,.check.visualizado svg{color:#006daa}.check.verde,.check.verde svg{color:#4f772d}.check.vermelho,.check.vermelho svg{color:#ba181b}.check.cinza,.check.cinza svg{color:#999}.check.preto,.check.preto svg{color:#666}.star{cursor:pointer;position:absolute;right:30px;bottom:2px;font-size:6.4px;width:11.2px}.default-stick-size{width:180px;height:auto}.horario-envio{margin-right:15px;font-size:11.2px;position:absolute;left:10px;bottom:2px}.autor-mensagem{position:absolute;font-size:9.6px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;max-width:90%;font-weight:700;top:2px}.menu-primario{visibility:hidden;opacity:0;transition:opacity 150ms ease-in-out;position:absolute;font-size:11.2px;top:3px;display:flex;gap:5px;padding:2px 4px}.menu-primario.principal{left:4px;color:var(--text-color);background-color:var(--message-color)}.menu-primario.outros{right:4px;color:var(--text-color);background-color:#fff}.menu-primario.outros>span:nth-child(1){order:10}.menu-mensagem{cursor:pointer;padding:1px}.menu-flutuante{background-color:#fff;-webkit-box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12);-moz-box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12);box-shadow:0 3px 1px -2px rgba(0,0,0,.2),0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12);border-radius:10px;position:absolute;top:20px;width:120px;min-height:50px;height:50px;max-height:50px;overflow-x:hidden;overflow-y:auto;margin:0;padding:0;display:flex;flex-direction:column;z-index:1}.menu-flutuante.principal{left:3px}.menu-flutuante.outros{right:3px}.menu-flutuante li{transition:background-color .3s ease-in-out;width:100%;cursor:pointer;padding:5px 10px;display:flex;align-items:center}.menu-flutuante li:hover{background-color:#e9e9e9}.mensagem__principal{width:100%;display:flex;justify-content:flex-end}.mensagem__principal>.mensagem::after{content:\"\";width:0;height:0;position:absolute;border-left:10px solid transparent;border-right:10px solid transparent;border-top:10px solid var(--message-color);bottom:5px;right:-10px;transform:rotate(-90deg)}.mensagem__principal>.mensagem{background-color:var(--message-color);color:var(--text-color)}.mensagem__principal>.mensagem .horario-envio{color:var(--text-color)}.mensagem__principal>.mensagem .autor-mensagem{right:5px;color:var(--text-color)}.mensagem__outros{width:100%;display:flex}.mensagem__outros>.mensagem{background-color:#fff;color:#333}.mensagem__outros>.mensagem::after{content:\"\";width:0;height:0;position:absolute;border-left:10px solid transparent;border-right:10px solid transparent;border-top:10px solid #fff;bottom:5px;left:-10px;transform:rotate(90deg)}.mensagem__outros>.autor-mensagem{left:5px;color:#333}.mensagem-div-mapa{width:100%;display:flex;justify-content:center;align-items:center;flex-direction:column;margin-bottom:5px}.msg-mapa{width:100%;min-height:225px;height:100%;box-sizing:initial}.msg-mapa img{max-width:none!important}.info-mapa{list-style-type:none}.info-mapa li.title{font-size:.85em}.info-mapa li.address,.info-mapa li.url{font-size:.85em}.info-mapa li.url{font-size:.85em}.tooltip-list{margin:0;padding:0;display:flex;flex-direction:column;justify-content:center;align-items:flex-start}.emoji-message-container{position:absolute;top:0;z-index:1;width:300px;height:250px}.emoji-message-container .sm-emoji-picker{width:300px;height:250px}.emoji-message-container .sm-emoji-picker .sm-emoji-header{overflow-x:auto;overflow-y:hidden}.reaction{position:absolute;bottom:0;border-radius:50%;display:flex;justify-content:center;align-items:center;background-color:rgba(100,100,100,.4);padding:5px;font-size:1.3em;min-width:1.8em;min-height:1.8em;max-width:1.8em;max-height:1.8em}.reaction>span{display:block;transform:translateY(-1px)}.mensagem__outros .reaction{right:-30px}.mensagem__principal .reaction{left:-30px}",
9248
9319
  map: undefined,
9249
9320
  media: undefined
@@ -9252,7 +9323,7 @@ var __vue_inject_styles__$5 = function __vue_inject_styles__(inject) {
9252
9323
  /* scoped */
9253
9324
  var __vue_scope_id__$5 = undefined;
9254
9325
  /* module identifier */
9255
- var __vue_module_identifier__$5 = "data-v-73ca470f";
9326
+ var __vue_module_identifier__$5 = "data-v-bb67a87c";
9256
9327
  /* functional template */
9257
9328
  var __vue_is_functional_template__$5 = false;
9258
9329
  /* style inject shadow dom */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-intergrall-plugins",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "",
5
5
  "main": "dist/vue-intergrall-plugins.ssr.js",
6
6
  "browser": "dist/vue-intergrall-plugins.esm.js",
@@ -228,15 +228,19 @@
228
228
  >
229
229
  <fa-icon :icon="['fas', 'smile']" />
230
230
  </span>
231
- <span
232
- v-if="showMenu.useGPT"
233
- @click="useGPTHandler"
234
- class="menu-mensagem"
235
- v-tippy
236
- :content="dictionary.tit_use_gpt"
237
- >
238
- <fa-icon :icon="['fas', 'question-circle']" />
239
- </span>
231
+ <template v-if="showMenu.customButtons && showMenu.customButtons.length">
232
+ <span
233
+ v-for="(button, index) in showMenu.customButtons"
234
+ :key="button.id || index"
235
+ v-show="button.use"
236
+ @click="button.callback(returnParams(button.params))"
237
+ :class="`${button.customClass || 'menu-mensagem'}`"
238
+ v-tippy
239
+ :content="button.tippyContent"
240
+ >
241
+ <fa-icon :icon="['fas', button.icon || 'question-circle']" />
242
+ </span>
243
+ </template>
240
244
  </div>
241
245
  <div
242
246
  class="emoji-message-container"
@@ -435,6 +439,10 @@ export default {
435
439
  if (!this.showMenu || typeof this.showMenu !== "object") return false;
436
440
  for (let key in this.showMenu) {
437
441
  if (this.showMenu.hasOwnProperty(key) && this.showMenu[key] === true) return true;
442
+ if (key === "customButtons") {
443
+ const hasAny = this.showMenu[key].some(({ use }) => use);
444
+ if (hasAny) return true;
445
+ }
438
446
  }
439
447
  return false;
440
448
  },
@@ -477,19 +485,6 @@ export default {
477
485
  if (this.isMenuOpen) this.closeMenu();
478
486
  this.isEmojisOpen = !this.isEmojisOpen;
479
487
  },
480
- useGPTHandler() {
481
- if (this.isMenuOpen) this.closeMenu();
482
- const params = {
483
- message: this.msg,
484
- };
485
-
486
- if (this.showMenu.gptCallback && typeof this.showMenu.gptCallback === "function") {
487
- this.showMenu.gptCallback(params);
488
- return;
489
- }
490
-
491
- this.$emit("use-gpt", params);
492
- },
493
488
  addReaction(emoji) {
494
489
  this.messageReaction =
495
490
  this.messageReaction && this.messageReaction.hexa === emoji.hexa
@@ -657,6 +652,28 @@ export default {
657
652
  if (regex.test(msg)) msg = msg.replace(regex, "<br>");
658
653
  return msg;
659
654
  },
655
+ returnParams(params) {
656
+ const defaultParams = {
657
+ message: this.msg,
658
+ };
659
+
660
+ if (!params) return defaultParams;
661
+
662
+ const keys = params.instanceKeys.split("|");
663
+ if (!keys || !keys.length)
664
+ return {
665
+ defaultParams,
666
+ ...params.values,
667
+ };
668
+
669
+ const customParams = { ...params.values };
670
+ keys.forEach((key) => {
671
+ if (this[key]) customParams[key] = this[key];
672
+ else console.warn(`Cant find ${key} on 'this' instance`);
673
+ });
674
+
675
+ return Object.keys(customParams).length ? customParams : defaultParams;
676
+ },
660
677
  },
661
678
  };
662
679
  </script>