vue-intergrall-plugins 0.0.1085 → 1.0.0

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.
Files changed (37) hide show
  1. package/README.md +13 -5
  2. package/dist/vue-intergrall-plugins.min.js +1 -1
  3. package/package.json +70 -62
  4. package/src/lib-components/Buttons/IconButton.vue +27 -0
  5. package/src/lib-components/Buttons/SimpleButton.vue +140 -0
  6. package/src/lib-components/Cards/Card.vue +429 -0
  7. package/src/lib-components/Cards/CardCheck.vue +35 -0
  8. package/src/lib-components/Cards/CardFile.vue +157 -0
  9. package/src/lib-components/Chat/AudioSpeedControl.vue +60 -0
  10. package/src/lib-components/Chat/BtnDownloadAllFiles.vue +36 -0
  11. package/src/lib-components/Chat/BtnEmojis.vue +51 -45
  12. package/src/lib-components/Chat/BtnFiles.vue +408 -131
  13. package/src/lib-components/Chat/BtnScreenShare.vue +36 -0
  14. package/src/lib-components/Chat/BtnStandardMessages.vue +17 -0
  15. package/src/lib-components/Chat/ExpandTextarea.vue +5 -6
  16. package/src/lib-components/Chat/MultipleFilePreview.vue +40 -22
  17. package/src/lib-components/Chat/Picker.vue +185 -149
  18. package/src/lib-components/Chat/SingleFilePreview.vue +28 -7
  19. package/src/lib-components/Chat/StandardMessages.vue +245 -0
  20. package/src/lib-components/Chat/TextFooter.vue +791 -451
  21. package/src/lib-components/Email/EmailFile.vue +126 -0
  22. package/src/lib-components/Email/EmailItem.vue +186 -0
  23. package/src/lib-components/Loader/Loader.vue +6 -1
  24. package/src/lib-components/Messages/AnexoMensagem.vue +442 -0
  25. package/src/lib-components/Messages/CardAttachment.vue +61 -0
  26. package/src/lib-components/Messages/CardMessages.vue +666 -0
  27. package/src/lib-components/Messages/ChatMessages.vue +1082 -0
  28. package/src/lib-components/Messages/InteratividadeBotoes.vue +165 -0
  29. package/src/lib-components/Messages/InteratividadeFormulario.vue +392 -0
  30. package/src/lib-components/Messages/InteratividadePopup.vue +89 -0
  31. package/src/lib-components/Messages/LinkPreview.vue +189 -0
  32. package/src/lib-components/Scroll/ScrollContent.vue +166 -0
  33. package/src/lib-components/Templates/TemplateGenerator.vue +187 -50
  34. package/src/lib-components/Templates/TemplateMessage.vue +12 -1
  35. package/src/lib-components/Templates/TemplateSingle.vue +232 -13
  36. package/dist/vue-intergrall-plugins.esm.js +0 -5693
  37. package/dist/vue-intergrall-plugins.ssr.js +0 -5033
@@ -0,0 +1,189 @@
1
+ <template>
2
+ <div
3
+ v-if="linkPreview.isValid"
4
+ class="link-preview"
5
+ @click="openUrl()"
6
+ :title="`Abrir ${returnURL()} em uma nova guia`"
7
+ >
8
+ <div
9
+ v-if="linkPreview.imageSource"
10
+ :style="linkPreview.colorTheme ? `background-color: ${linkPreview.colorTheme}` : ''"
11
+ class="link-preview-image"
12
+ >
13
+ <img :src="linkPreview.imageSource" alt="Imagem referente ao link" />
14
+ </div>
15
+ <div
16
+ class="link-preview-author"
17
+ :class="{ 'mb-0': linkPreview.description }"
18
+ v-if="linkPreview.author"
19
+ >
20
+ <h1 v-text="linkPreview.author"></h1>
21
+ </div>
22
+ <div v-if="linkPreview.description" class="link-preview-infos">
23
+ <p v-if="linkPreview.description" v-text="linkPreview.description"></p>
24
+ </div>
25
+ </div>
26
+ </template>
27
+
28
+ <script>
29
+ import { dev, baseURL } from "@/services/smartChannelAxios";
30
+
31
+ export default {
32
+ props: {
33
+ message: {
34
+ type: String,
35
+ default: "",
36
+ },
37
+ },
38
+ data() {
39
+ return {
40
+ linkPreview: {
41
+ author: "",
42
+ description: "",
43
+ imageSource: "",
44
+ colorTheme: "",
45
+ isValid: false,
46
+ },
47
+ };
48
+ },
49
+ mounted() {
50
+ this.$nextTick(() => {
51
+ this.gerarPreview();
52
+ });
53
+ },
54
+ methods: {
55
+ returnURL() {
56
+ if (!this.message) return "";
57
+ const isSticker = this.message.indexOf("KSTICKERK") < 0 ? false : true;
58
+ if (isSticker) return "";
59
+ 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;
60
+ const url = regex.exec(this.message);
61
+ if (!url || !url[0]) {
62
+ console.warn("URL invalida para gerar preview");
63
+ return "";
64
+ }
65
+ const finalUrl = url[0].replace(/["'*]/g, "");
66
+ if (
67
+ /((https?|ftp):\/\/.)?(www\.)?(?:([-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6})|(linux07|linux03))\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi.test(
68
+ finalUrl
69
+ )
70
+ )
71
+ return finalUrl;
72
+ return false;
73
+ },
74
+ async gerarPreview() {
75
+ try {
76
+ const url = this.returnURL();
77
+ if (!url) return;
78
+ const encodedURL = Buffer(url).toString("base64");
79
+ const response = await this.$httpRequest({
80
+ method: "get",
81
+ url: `${baseURL}/preview?url=${encodedURL}${dev}`,
82
+ // headers: {
83
+ // Authorization: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdGQiOiJNS1VGWnBQeEV1UHc5UXdvN21HU2tWNEl4VHN0blM3MHNyZUJTTWt3d3hiNDRhd3dDcWwxd09jIiwibWFuYWdlciI6Ik1LVXRhd3dpbTRsNXd3WW1LMWFJYXd3aW00bDV3d3d3eGI0NGF3d0s0a2pveHBPMnl6TFZ3dXBud3d4YjQ0YXd3cmxNNHRqZ3FKTExsTjMiLCJoYXNfaW5mb3MiOnRydWUsIm5yb3MiOlsiMjczIl0sImF1dGgiOiJNS1VncmxDdkdRbElGbXZVTERCSGplV0wyOXFVUHdyOVlSMVMyeXdJanlLOUNteCIsImlhdCI6MTY0ODQ3MzYxNSwiZXhwIjoxNjQ4NTYwMDE1fQ.KSG_6_9NfQhk5br7hnXzeLyVZuT69XLaEYF9XkdgmmQ"
84
+ // }
85
+ });
86
+ if (typeof response != "object" || typeof response.data != "object")
87
+ throw "Retorno incorreto";
88
+ const { data } = response;
89
+ const { st_ret, msg_ret, raspagem } = data;
90
+ if (st_ret != "OK") throw `${st_ret} - ${msg_ret}`;
91
+ if (!raspagem)
92
+ throw `${st_ret} - ${msg_ret} | (Raspagem nao encontrada no retorno)`;
93
+ const { description, og, theme_color } = raspagem;
94
+ if (description) this.linkPreview.description = description;
95
+ if (raspagem.author) this.linkPreview.author = raspagem.author;
96
+ if (og) {
97
+ const { image, site_name, title, author } = og;
98
+ if (image)
99
+ this.linkPreview.imageSource = image.url
100
+ ? image.url
101
+ : image.url == ""
102
+ ? ""
103
+ : image;
104
+ if (author || site_name || title)
105
+ this.linkPreview.author = title
106
+ ? title
107
+ : author
108
+ ? author
109
+ : site_name
110
+ ? site_name
111
+ : "";
112
+ if (og.description) this.linkPreview.description = og.description;
113
+ }
114
+ if (theme_color) this.linkPreview.colorTheme = theme_color;
115
+
116
+ if (this.linkPreview.description || this.linkPreview.imageSource)
117
+ this.linkPreview.isValid = true;
118
+ } catch (e) {
119
+ console.error("Erro ao gerar o preview do link: ", e);
120
+ }
121
+ },
122
+ openUrl() {
123
+ const url = this.returnURL();
124
+ if (!url) return;
125
+ window.open(url, "_blank");
126
+ },
127
+ },
128
+ };
129
+ </script>
130
+
131
+ <style scoped>
132
+ .link-preview {
133
+ display: flex;
134
+ flex-direction: column;
135
+ background-color: #eee;
136
+ color: #333;
137
+ cursor: pointer;
138
+ margin: 5px 0;
139
+ border-radius: 5px;
140
+ opacity: 0.95;
141
+ transition: opacity 300ms ease-in-out;
142
+ font-size: 13.6px;
143
+ }
144
+
145
+ .link-preview-image {
146
+ display: flex;
147
+ justify-content: center;
148
+ align-items: center;
149
+ padding: 1px;
150
+ border-top-left-radius: 5px;
151
+ border-top-right-radius: 5px;
152
+ }
153
+
154
+ .link-preview-author {
155
+ margin: 5px;
156
+ font-size: 0.615em;
157
+ font-weight: bold;
158
+ }
159
+ .link-preview-author.mb-0 {
160
+ margin-bottom: 0;
161
+ }
162
+ .link-preview-author h1 {
163
+ overflow: hidden;
164
+ text-overflow: ellipsis;
165
+ white-space: nowrap;
166
+ }
167
+
168
+ .link-preview-image img {
169
+ min-width: 100px;
170
+ max-width: 200px;
171
+ border-top-left-radius: 5px;
172
+ border-top-right-radius: 5px;
173
+ }
174
+
175
+ .link-preview-infos {
176
+ background-color: #2626261a;
177
+ padding: 5px;
178
+ margin: 5px;
179
+ font-size: 0.83em;
180
+ border-radius: 5px;
181
+ }
182
+
183
+ .link-preview:hover {
184
+ opacity: 1;
185
+ }
186
+ .link-preview:hover .link-preview-infos p {
187
+ text-decoration: underline;
188
+ }
189
+ </style>
@@ -0,0 +1,166 @@
1
+ <template>
2
+ <transition name="fade">
3
+ <div
4
+ class="btn-rolagem"
5
+ :class="{ higher: classeCustomizada }"
6
+ v-show="visibilidade"
7
+ @click="rolar()"
8
+ >
9
+ <div class="sinalizar-msg-nova" :title="tituloSinalizador" v-show="sinalizar"></div>
10
+ <fa-icon :icon="['fas', 'arrow-circle-down']" />
11
+ </div>
12
+ </transition>
13
+ </template>
14
+
15
+ <style scoped>
16
+ .fade-enter-active,
17
+ .fade-leave-active {
18
+ transition: opacity 0.3s;
19
+ }
20
+ .fade-enter,
21
+ .fade-leave-to {
22
+ opacity: 0;
23
+ }
24
+ </style>
25
+
26
+ <script>
27
+ export default {
28
+ props: {
29
+ identificador: {
30
+ type: String,
31
+ required: true,
32
+ },
33
+ containerSelector: {
34
+ type: String,
35
+ required: true,
36
+ },
37
+ classeCustomizada: {
38
+ type: Boolean,
39
+ required: false,
40
+ },
41
+ sinalizar: {
42
+ type: Boolean,
43
+ required: false,
44
+ },
45
+ tituloSinalizador: {
46
+ type: String,
47
+ required: false,
48
+ },
49
+ rolarParaMsg: {
50
+ type: Boolean,
51
+ required: false,
52
+ },
53
+ callbackFn: {
54
+ type: Function,
55
+ required: false,
56
+ },
57
+ },
58
+ created() {
59
+ this.$root.$refs[`rc-${this.identificador}`] = this;
60
+ },
61
+ data() {
62
+ return {
63
+ visibilidade: false,
64
+ container: "",
65
+ };
66
+ },
67
+ methods: {
68
+ getContainer() {
69
+ this.container = document.querySelector(this.containerSelector);
70
+ },
71
+ rolar(paraCima) {
72
+ try {
73
+ this.getContainer();
74
+ if (this.sinalizar && this.callbackFn) this.callbackFn();
75
+ let alturaFinal = this.container.scrollHeight;
76
+ if (this.rolarParaMsg) {
77
+ let ultimaMsgContainer = this.container.children[
78
+ this.container.children.length - 2
79
+ ];
80
+ !ultimaMsgContainer.children.length
81
+ ? (ultimaMsgContainer = this.container.children[
82
+ this.container.children.length - 3
83
+ ])
84
+ : "";
85
+ const ultimaMsg = ultimaMsgContainer.lastElementChild.offsetHeight + 10;
86
+ alturaFinal -= ultimaMsg;
87
+ }
88
+
89
+ this.container.scroll(0, paraCima ? 0 : alturaFinal);
90
+ } catch (e) {
91
+ console.error("Nao foi possivel rolar o container");
92
+ console.error(e);
93
+ }
94
+ },
95
+ verifyScrollbar() {
96
+ try {
97
+ this.getContainer();
98
+
99
+ this.visibilidade = true;
100
+
101
+ const posicaoDaBarra = this.container.scrollTop,
102
+ tamanhoContainer = this.container.offsetHeight,
103
+ tamanhoBarra = this.container.scrollHeight;
104
+
105
+ if (posicaoDaBarra == tamanhoBarra - tamanhoContainer) {
106
+ if (this.sinalizar) this.$emit("updateKey");
107
+ this.visibilidade = false;
108
+ } else if (
109
+ parseInt(posicaoDaBarra) + tamanhoContainer == tamanhoBarra ||
110
+ parseInt(posicaoDaBarra) + tamanhoContainer == tamanhoBarra + 1 ||
111
+ parseInt(posicaoDaBarra) + tamanhoContainer == tamanhoBarra - 1
112
+ ) {
113
+ this.visibilidade = false;
114
+ }
115
+ } catch (e) {
116
+ console.error("Ignorando botao de rolagem devido a erro");
117
+ console.error(e);
118
+ this.visibilidade = false;
119
+ }
120
+ },
121
+ },
122
+ };
123
+ </script>
124
+ <style>
125
+ .btn-rolagem {
126
+ position: absolute;
127
+ bottom: 10px;
128
+ right: 20px;
129
+ }
130
+ .btn-rolagem.higher {
131
+ bottom: 36px;
132
+ }
133
+ .btn-rolagem svg {
134
+ font-size: 38.4px;
135
+ color: #757575;
136
+ transition-duration: 300ms;
137
+ transition-property: opacity;
138
+ opacity: 0.8;
139
+ cursor: pointer;
140
+ }
141
+ .btn-rolagem svg:hover {
142
+ opacity: 1;
143
+ }
144
+ .sinalizar-msg-nova {
145
+ position: absolute;
146
+ top: -10px;
147
+ left: -10px;
148
+ background-color: #4f772d;
149
+ width: 12.5px;
150
+ height: 12.5px;
151
+ border-radius: 50%;
152
+ animation-name: blink;
153
+ animation-duration: 1000ms;
154
+ animation-direction: alternate;
155
+ animation-iteration-count: infinite;
156
+ }
157
+
158
+ @keyframes blink {
159
+ from {
160
+ opacity: 0.8 - 0.1;
161
+ }
162
+ to {
163
+ opacity: 1;
164
+ }
165
+ }
166
+ </style>