vue-intergrall-plugins 0.0.168 → 0.0.171
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.
- package/dist/vue-intergrall-plugins.esm.js +27697 -252
- package/dist/vue-intergrall-plugins.min.js +1 -1
- package/dist/vue-intergrall-plugins.ssr.js +25139 -322
- package/package.json +5 -2
- package/src/lib-components/Chat/StandardMessages.vue +21 -25
- package/src/lib-components/Chat/TextFooter.vue +13 -9
- package/src/lib-components/Messages/ChatMessages.vue +35 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-intergrall-plugins",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.171",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/vue-intergrall-plugins.ssr.js",
|
|
6
6
|
"browser": "dist/vue-intergrall-plugins.esm.js",
|
|
@@ -60,6 +60,9 @@
|
|
|
60
60
|
"node": ">=12"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"axios": "^0.26.0"
|
|
63
|
+
"axios": "^0.26.0",
|
|
64
|
+
"kind-of": "^6.0.3",
|
|
65
|
+
"link-preview-js": "^2.1.13",
|
|
66
|
+
"link-prevue": "^1.2.0"
|
|
64
67
|
}
|
|
65
68
|
}
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
:calculatePosition="calculateSelectPosition"
|
|
43
43
|
class="text-footer-v-select"
|
|
44
44
|
:options="formatted_messages_3"
|
|
45
|
+
:reduce="formatted_messages_3 => formatted_messages_3.cod"
|
|
45
46
|
label="value"
|
|
46
47
|
:clearable="false"
|
|
47
48
|
@input="openMsg()"
|
|
@@ -49,14 +50,6 @@
|
|
|
49
50
|
>
|
|
50
51
|
<div slot="no-options"> {{ dictionary.msg_sem_resultados }} </div>
|
|
51
52
|
</v-select>
|
|
52
|
-
<template v-if="key_3.cod">
|
|
53
|
-
<!-- <span class="text-footer--btn-select-03" v-if="messageType == 1" :title="dictionary.title_btn_preencher_msg_formatada" @click="insertFormattedMessage(key_3)">
|
|
54
|
-
<fa-icon :icon="['fas', 'level-up-alt']" />
|
|
55
|
-
</span> -->
|
|
56
|
-
<span class="text-footer--btn-select-03" :title="dictionary.title_btn_abrir_msg_tipo_2" @click="openFormattedMsgType2(key_3)"> <!-- v-else-if="messageType == 2" -->
|
|
57
|
-
<fa-icon :icon="['fas', 'file-alt']" />
|
|
58
|
-
</span>
|
|
59
|
-
</template>
|
|
60
53
|
</div>
|
|
61
54
|
<div class="loader-select" v-else-if="key_2 && loadingReq">
|
|
62
55
|
<VueLoader />
|
|
@@ -73,6 +66,9 @@
|
|
|
73
66
|
.loader-select {
|
|
74
67
|
position: relative; min-height: 35px;background: #FFF;width: 100%; border: 1px solid #ccc;border-radius: 5px;z-index: 1;
|
|
75
68
|
}
|
|
69
|
+
.loading-message {
|
|
70
|
+
background-color: #555!important;
|
|
71
|
+
}
|
|
76
72
|
</style>
|
|
77
73
|
|
|
78
74
|
<script>
|
|
@@ -156,7 +152,7 @@ export default {
|
|
|
156
152
|
this.loadingReq = true
|
|
157
153
|
this.getStandardMessages(cod, this.token_cliente).then((data) => {
|
|
158
154
|
this.loadingReq = false
|
|
159
|
-
if(data
|
|
155
|
+
if(data.msg_ret) return this.$toasted.global.emConstrucao({ msg: data.msg_ret })
|
|
160
156
|
if(data) return this.showFormattedMessage(data, selectionIndex)
|
|
161
157
|
this.$toasted.global.defaultError()
|
|
162
158
|
}).catch(e => {
|
|
@@ -172,7 +168,7 @@ export default {
|
|
|
172
168
|
try {
|
|
173
169
|
let success = false
|
|
174
170
|
if(Array.isArray(messageData)) success = true
|
|
175
|
-
if(!success) this.$toasted.global.emConstrucao({ msg: messageData ? messageData.msg : "Nao foi possível obter mensagens" })
|
|
171
|
+
if(!success && selectionIndex != 4) this.$toasted.global.emConstrucao({ msg: messageData ? messageData.msg : "Nao foi possível obter mensagens" })
|
|
176
172
|
|
|
177
173
|
switch (selectionIndex) {
|
|
178
174
|
case 2:
|
|
@@ -195,21 +191,21 @@ export default {
|
|
|
195
191
|
this.$toasted.global.emConstrucao({msg: this.dictionary.msg_erro_sem_msg_formatada})
|
|
196
192
|
this.$emit("close-blocker-standard-message")
|
|
197
193
|
}else{
|
|
198
|
-
if(
|
|
199
|
-
this.formatted_messages_3.push(this.dictionary.msg_erro_sem_msg_formatada)
|
|
200
|
-
this.key_3 = this.formatted_messages_3[0]
|
|
201
|
-
this.openFormattedMsgType2(this.key_3)
|
|
202
|
-
}else{
|
|
194
|
+
if(messageData.length){
|
|
203
195
|
this.formatted_messages_3 = messageData
|
|
204
|
-
if(this.formatted_messages_3.length == 1) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
this.openFormattedMsgType2(this.key_3)
|
|
208
|
-
}
|
|
196
|
+
if(this.formatted_messages_3.length == 1 && this.formatted_messages_3[0].cod) {
|
|
197
|
+
this.key_3 = this.formatted_messages_3[0].cod
|
|
198
|
+
this.openMsg()
|
|
209
199
|
}
|
|
210
200
|
}
|
|
211
201
|
}
|
|
212
202
|
break
|
|
203
|
+
case 4:
|
|
204
|
+
const finalMessage = `${this.message}${this.message && !this.message.endsWith(" ") ? ` ${messageData}` : messageData}`
|
|
205
|
+
this.$emit("add-standard-message", finalMessage)
|
|
206
|
+
this.$parent.focusTextarea()
|
|
207
|
+
// return this.closeStandardMessages()
|
|
208
|
+
break
|
|
213
209
|
default:
|
|
214
210
|
console.error("Error in showFormattedMessage: selectionIndex not found")
|
|
215
211
|
break
|
|
@@ -219,10 +215,12 @@ export default {
|
|
|
219
215
|
console.error("Error in showFormattedMessage: ", e)
|
|
220
216
|
}
|
|
221
217
|
},
|
|
218
|
+
closeStandardMessages() {
|
|
219
|
+
this.$emit("close-standard-messages")
|
|
220
|
+
},
|
|
222
221
|
openMsg() {
|
|
223
222
|
try {
|
|
224
|
-
|
|
225
|
-
this.openFormattedMsgType2(this.key_3)
|
|
223
|
+
this.messageType == 1 ? this.insertFormattedMessage(this.key_3) : this.openFormattedMsgType2(this.key_3)
|
|
226
224
|
}catch(e) {
|
|
227
225
|
console.error("Error in openMsg: ", e)
|
|
228
226
|
}
|
|
@@ -240,9 +238,7 @@ export default {
|
|
|
240
238
|
insertFormattedMessage() {
|
|
241
239
|
try {
|
|
242
240
|
if(!this.key_3) return this.$toasted.global.defaultError({msg: 'Selecione uma mensagem'})
|
|
243
|
-
|
|
244
|
-
// const finalMessage = `${this.message}${this.message && !this.message.endsWith(" ") ? ` ${value}` : value}`
|
|
245
|
-
// return value ? this.$emit("add-standard-message", finalMessage) : this.$toasted.global.emConstrucao({msg: 'Mensagem vazia'})
|
|
241
|
+
this.receiveValueFormattedMessage(`T/${this.key_2}/${this.key_3}`, 4)
|
|
246
242
|
}catch(e) {
|
|
247
243
|
console.error("Erro ao inserir mensagem formatada: ", e)
|
|
248
244
|
}
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
:message="message"
|
|
88
88
|
:messageType="messageType"
|
|
89
89
|
|
|
90
|
+
@close-standard-messages="closeStandardMessages"
|
|
90
91
|
@open-blocker-standard-message="openBlockerStandardMessage"
|
|
91
92
|
@close-blocker-standard-message="closeBlockerStandardMessage"
|
|
92
93
|
@set-message-type="setMessageType"
|
|
@@ -203,20 +204,20 @@ export default {
|
|
|
203
204
|
},
|
|
204
205
|
methods: {
|
|
205
206
|
listenerPostMessage(event){
|
|
207
|
+
const baseURL = window.location.hostname == 'localhost' ? `https://linux07` : `https://${window.location.hostname}`
|
|
206
208
|
if(!this.formattedMessageSettings.hasStandardMessages) return
|
|
207
209
|
if(event.data.gerenciador || event.data.abrirFishing || event.data.multiplos_contatos || event.data.inserir_cliente_omni || event.data.multiple_contatos) return
|
|
208
|
-
if(event.
|
|
209
|
-
if(this.showStandardMessages)
|
|
210
|
+
if(event.origin == baseURL) {
|
|
211
|
+
if(event.data == '' && this.showStandardMessages){
|
|
212
|
+
this.closeBlockerStandardMessage()
|
|
213
|
+
this.toggleStandardMessages()
|
|
214
|
+
this.$toasted.global.emConstrucao({msg: this.dictionary.msg_erro_sem_msg_formatada})
|
|
215
|
+
}else if(typeof event.data === "string" && this.showStandardMessages){
|
|
216
|
+
this.message = event.data
|
|
217
|
+
this.focusTextarea()
|
|
210
218
|
this.closeBlockerStandardMessage()
|
|
211
219
|
this.toggleStandardMessages()
|
|
212
220
|
}
|
|
213
|
-
this.$toasted.global.emConstrucao({msg: this.dicionario.msg_erro_sem_msg_formatada})
|
|
214
|
-
}else if(typeof event.data === "string"){
|
|
215
|
-
this.message = event.data
|
|
216
|
-
this.focusTextarea()
|
|
217
|
-
|
|
218
|
-
this.closeBlockerStandardMessage()
|
|
219
|
-
this.toggleStandardMessages()
|
|
220
221
|
}
|
|
221
222
|
},
|
|
222
223
|
closeEmojis() {
|
|
@@ -472,6 +473,9 @@ export default {
|
|
|
472
473
|
this.message = message
|
|
473
474
|
this.sendFinalMessage()
|
|
474
475
|
},
|
|
476
|
+
closeStandardMessages() {
|
|
477
|
+
this.showStandardMessages = false
|
|
478
|
+
}
|
|
475
479
|
},
|
|
476
480
|
destroyed() {
|
|
477
481
|
// this.$root.$off("drop-file")
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
</li>
|
|
25
25
|
</ul>
|
|
26
26
|
</div>
|
|
27
|
+
<!-- <LinkPrevue v-if="linkPreview && link" :url="linkPreview" /> -->
|
|
27
28
|
<p v-html="formatMsg(message)"></p>
|
|
28
29
|
<InteratividadeBotoes
|
|
29
30
|
v-if="interatividade"
|
|
@@ -64,9 +65,11 @@
|
|
|
64
65
|
import AnexoMensagem from "./AnexoMensagem"
|
|
65
66
|
import InteratividadeBotoes from "./InteratividadeBotoes"
|
|
66
67
|
import { formataTimezoneData } from "../../services/textFormatting"
|
|
68
|
+
import LinkPrevue from "link-prevue"
|
|
69
|
+
import { getLinkPreview } from "link-preview-js";
|
|
67
70
|
|
|
68
71
|
export default {
|
|
69
|
-
components: { AnexoMensagem, InteratividadeBotoes },
|
|
72
|
+
components: { AnexoMensagem, InteratividadeBotoes, LinkPrevue },
|
|
70
73
|
props: ["smartchannel", "messageIndex", "dictionary", "autor", "origem", "msg", "link", "anexo", "imgAnexo", "tipoDoc", "docAnexo", "nomeArquivo", "audio", "video", "horario", "status", "logo", "msgTooltip", "seq", "mapa", "histMsg", "erro", "msgErro", "origemExterna", "anexos", "dominio", "corMsg", "interatividade", "msgReply", "hasReply", "iniDialogo", "dialogoId", "dialogoOrigem", "expSessao"],
|
|
71
74
|
data(){
|
|
72
75
|
return{
|
|
@@ -87,7 +90,8 @@ export default {
|
|
|
87
90
|
rotateControl: false,
|
|
88
91
|
fullscreenControl: false,
|
|
89
92
|
disableDefaultUI: false
|
|
90
|
-
}
|
|
93
|
+
},
|
|
94
|
+
linkPreview: ""
|
|
91
95
|
}
|
|
92
96
|
},
|
|
93
97
|
computed: {
|
|
@@ -150,6 +154,19 @@ export default {
|
|
|
150
154
|
this.urlFileName = this.getUrlFileName()
|
|
151
155
|
this.message = this.removeUrlStickerByString(this.urlSticker)
|
|
152
156
|
}
|
|
157
|
+
if(this.validadeIfExistsUrl()){
|
|
158
|
+
const linkRegex = /(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])/igm;
|
|
159
|
+
let link = [];
|
|
160
|
+
link = this.message.match(linkRegex);
|
|
161
|
+
if(!link || link.length == 0){
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
getLinkPreview(link[0]).then((data) => {
|
|
165
|
+
if(data.images && data.images.length > 0){
|
|
166
|
+
this.urlSticker = data.images[0];
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
153
170
|
},
|
|
154
171
|
getUrlFileName(){
|
|
155
172
|
let urlRegex = /(?<=\/)[^\/\?#]+(?=[^\/]*$)/;
|
|
@@ -165,6 +182,12 @@ export default {
|
|
|
165
182
|
let url = this.message.match(urlRegex)[1];
|
|
166
183
|
return url;
|
|
167
184
|
},
|
|
185
|
+
validadeIfExistsUrl(){
|
|
186
|
+
if(this.message && this.message.indexOf("https://") !== false && this.message.indexOf("<a") !== false){
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
return false;
|
|
190
|
+
},
|
|
168
191
|
validadeIfExistsSticker(){
|
|
169
192
|
if(this.message && this.message.indexOf("KSTICKERK https://smarters") === 0){
|
|
170
193
|
return true;
|
|
@@ -208,8 +231,17 @@ export default {
|
|
|
208
231
|
formatMsg(msg) {
|
|
209
232
|
const regex = /(\n| )/g
|
|
210
233
|
if(regex.test(msg)) msg = msg.replace(regex, "<br>")
|
|
234
|
+
// if(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi.test(msg) && this.link) this.setLinkPreview(msg)
|
|
211
235
|
return msg
|
|
212
|
-
}
|
|
236
|
+
},
|
|
237
|
+
// setLinkPreview(link) {
|
|
238
|
+
// try {
|
|
239
|
+
// this.linkPreview = link
|
|
240
|
+
// }catch(e) {
|
|
241
|
+
// console.error("Erro ao receber a previa do link")
|
|
242
|
+
// console.error(e)
|
|
243
|
+
// }
|
|
244
|
+
// }
|
|
213
245
|
}
|
|
214
246
|
}
|
|
215
247
|
</script>
|