vue-intergrall-plugins 1.1.8 → 1.1.10
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 +735 -382
- package/dist/vue-intergrall-plugins.min.js +1 -1
- package/dist/vue-intergrall-plugins.ssr.js +670 -378
- package/package.json +1 -1
- package/src/lib-components/Messages/ChatMessages.vue +24 -2
- package/src/lib-components/Messages/InteratividadeContato.vue +32 -0
- package/src/lib-components/Messages/InteratividadeContatoItem.vue +214 -0
package/package.json
CHANGED
|
@@ -40,9 +40,13 @@
|
|
|
40
40
|
<!-- Preview do link -->
|
|
41
41
|
<LinkPreview v-if="link && !mapa && status != 'O'" :message="message" />
|
|
42
42
|
<!-- Mensagem -->
|
|
43
|
-
<p v-html="validateInterativity() ? '' : formatMsg(message)"></p>
|
|
43
|
+
<p v-html="validateInterativity() || isInteratividadeContato() ? '' : formatMsg(message)"></p>
|
|
44
44
|
<!-- Botoes da interatividade -->
|
|
45
|
-
<
|
|
45
|
+
<template v-if="interatividade">
|
|
46
|
+
<InteratividadeContato v-if="isInteratividadeContato()" :interatividade="interatividade"
|
|
47
|
+
:dictionary="dictionary" :emitContactClick="emitContactClick" @contact-click="emitContactData" />
|
|
48
|
+
<InteratividadeBotoes v-else :interatividade="interatividade" :dictionary="dictionary" />
|
|
49
|
+
</template>
|
|
46
50
|
<!-- Horario da mensagem -->
|
|
47
51
|
<span class="horario-envio" v-text="horario"></span>
|
|
48
52
|
<!-- Reenviar mensagem -->
|
|
@@ -153,6 +157,7 @@
|
|
|
153
157
|
import AnexoMensagem from "./AnexoMensagem";
|
|
154
158
|
import InteratividadeBotoes from "./InteratividadeBotoes";
|
|
155
159
|
import InteratividadeFormulario from "./InteratividadeFormulario";
|
|
160
|
+
import InteratividadeContato from "./InteratividadeContato";
|
|
156
161
|
import Picker from "../Chat/Picker";
|
|
157
162
|
import { formataTimezoneData } from "../../services/textFormatting";
|
|
158
163
|
import LinkPreview from "./LinkPreview";
|
|
@@ -163,10 +168,12 @@ export default {
|
|
|
163
168
|
AnexoMensagem,
|
|
164
169
|
InteratividadeBotoes,
|
|
165
170
|
InteratividadeFormulario,
|
|
171
|
+
InteratividadeContato,
|
|
166
172
|
LinkPreview,
|
|
167
173
|
Picker,
|
|
168
174
|
},
|
|
169
175
|
props: [
|
|
176
|
+
"emitContactClick",
|
|
170
177
|
"smartchannel",
|
|
171
178
|
"messageIndex",
|
|
172
179
|
"dictionary",
|
|
@@ -385,6 +392,18 @@ export default {
|
|
|
385
392
|
return false;
|
|
386
393
|
}
|
|
387
394
|
},
|
|
395
|
+
isInteratividadeContato() {
|
|
396
|
+
try {
|
|
397
|
+
if (
|
|
398
|
+
this.interatividade && this.interatividade.length && this.interatividade[0].phones
|
|
399
|
+
) {
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
return false;
|
|
403
|
+
} catch (error) {
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
},
|
|
388
407
|
validadeUrlToMsg() {
|
|
389
408
|
try {
|
|
390
409
|
this.message = this.msg;
|
|
@@ -458,6 +477,9 @@ export default {
|
|
|
458
477
|
abrirImagem(imagem) {
|
|
459
478
|
this.$emit("abrir-imagem", imagem);
|
|
460
479
|
},
|
|
480
|
+
emitContactData(props) {
|
|
481
|
+
this.$emit("contact-click", props);
|
|
482
|
+
},
|
|
461
483
|
adjustFontColor(cor) {
|
|
462
484
|
try {
|
|
463
485
|
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(cor);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<InteratividadeContatoItem v-for="(item, index) in interatividade" :key="index" :item="item"
|
|
4
|
+
:dictionary="dictionary" :emitContactClick="emitContactClick" @contact-click="emitData" />
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
<script>
|
|
8
|
+
import InteratividadeContatoItem from "./InteratividadeContatoItem";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
components: { InteratividadeContatoItem },
|
|
12
|
+
props: {
|
|
13
|
+
interatividade: {
|
|
14
|
+
type: Array,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
dictionary: {
|
|
18
|
+
type: Object,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
emitContactClick: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false,
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
methods: {
|
|
27
|
+
emitData(props) {
|
|
28
|
+
this.$emit("contact-click", props);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="contact-card" ref="contactCard">
|
|
3
|
+
<div class="contact-header">
|
|
4
|
+
<div class="header-content">
|
|
5
|
+
<span class="badge">{{ getInitials(item.name) }}</span>
|
|
6
|
+
<h3>{{ item.name.formatted_name }}</h3>
|
|
7
|
+
</div>
|
|
8
|
+
<ul v-if="item.org" class="contact-list">
|
|
9
|
+
<li v-if="item.org.company">{{ item.org.company }}</li>
|
|
10
|
+
<li v-if="item.org.title">{{ item.org.title }}</li>
|
|
11
|
+
</ul>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="contact-content">
|
|
14
|
+
<div class="contact-section">
|
|
15
|
+
<h4>
|
|
16
|
+
<fa-icon :icon="['fas', 'phone-alt']" />
|
|
17
|
+
Telefones
|
|
18
|
+
</h4>
|
|
19
|
+
<ul class="contact-list">
|
|
20
|
+
<li v-for="phone in item.phones" :key="phone.phone">
|
|
21
|
+
{{ dictionary[`${phone.type}_phone`] || phone.type }}: {{ phone.phone }}
|
|
22
|
+
<button v-if="emitContactClick" @click="emitData(phone.phone, 'phone')" title="Adicionar contato">
|
|
23
|
+
<fa-icon :icon="['fas', 'user-plus']" />
|
|
24
|
+
</button>
|
|
25
|
+
</li>
|
|
26
|
+
</ul>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="contact-section" v-if="item.emails && item.emails.length">
|
|
29
|
+
<h4><fa-icon :icon="['fas', 'envelope']" />Emails</h4>
|
|
30
|
+
<ul class="contact-list">
|
|
31
|
+
<li v-for="email in item.emails" :key="email.email">
|
|
32
|
+
{{ dictionary[`${email.type}_email`] || email.type }}: {{ email.email }}
|
|
33
|
+
<button v-if="emitContactClick" @click="emitData(email.email, 'email')" title="Adicionar contato">
|
|
34
|
+
<fa-icon :icon="['fas', 'user-plus']" />
|
|
35
|
+
</button>
|
|
36
|
+
</li>
|
|
37
|
+
</ul>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="contact-section" v-if="hasInfos">
|
|
40
|
+
<h4>
|
|
41
|
+
<fa-icon :icon="['fas', 'info']" /> {{ dictionary.titulo_informacoes }} adicionais
|
|
42
|
+
</h4>
|
|
43
|
+
<ul class="contact-list">
|
|
44
|
+
<template v-if="item.addresses && item.addresses.length">
|
|
45
|
+
<li v-for="address in item.addresses" :key="address.street">
|
|
46
|
+
{{ dictionary[`${address.type}_address`] || address.type }}: {{ address.street }}, {{ address.city }} - {{
|
|
47
|
+
address.state ? address.state.toUpperCase() : '(vazio)' }} - {{
|
|
48
|
+
address.country }}, {{
|
|
49
|
+
address.zip }}
|
|
50
|
+
</li>
|
|
51
|
+
</template>
|
|
52
|
+
<template v-if="item.urls && item.urls.length">
|
|
53
|
+
<li v-for="url in item.urls" :key="url.url">
|
|
54
|
+
{{ dictionary[url.type] || url.type }}: <a
|
|
55
|
+
:href="`${url.url.startsWith('https://') ? url.url : `https://${url.url}`}`" target="_blank">{{ url.url
|
|
56
|
+
}}</a>
|
|
57
|
+
</li>
|
|
58
|
+
</template>
|
|
59
|
+
<li v-if="item.birthday">{{ dictionary.birthday }}: {{ formatBirthday(item.birthday) }}</li>
|
|
60
|
+
<template v-if="additionals && additionals.length">
|
|
61
|
+
<li v-for="(value, key) in additionals" :key="key">
|
|
62
|
+
{{ key }}: {{ value }}
|
|
63
|
+
</li>
|
|
64
|
+
</template>
|
|
65
|
+
</ul>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<script>
|
|
72
|
+
|
|
73
|
+
export default {
|
|
74
|
+
props: {
|
|
75
|
+
item: {
|
|
76
|
+
type: Object,
|
|
77
|
+
required: true,
|
|
78
|
+
},
|
|
79
|
+
dictionary: {
|
|
80
|
+
type: Object,
|
|
81
|
+
required: true,
|
|
82
|
+
},
|
|
83
|
+
emitContactClick: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: false,
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
data() {
|
|
89
|
+
return {
|
|
90
|
+
additionals: [],
|
|
91
|
+
hasInfos: false,
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
mounted() {
|
|
95
|
+
this.additionals = this.getAdditionalInfo(JSON.parse(JSON.stringify(this.item)));
|
|
96
|
+
this.verifyHasInfos()
|
|
97
|
+
},
|
|
98
|
+
methods: {
|
|
99
|
+
getInitials(name) {
|
|
100
|
+
if (!name) return '';
|
|
101
|
+
const initials = name.first_name.charAt(0);
|
|
102
|
+
if (name.last_name) {
|
|
103
|
+
return initials + name.last_name.charAt(0);
|
|
104
|
+
}
|
|
105
|
+
return initials;
|
|
106
|
+
},
|
|
107
|
+
formatBirthday(birthday) {
|
|
108
|
+
if (!birthday) return '';
|
|
109
|
+
const values = birthday.split('-');
|
|
110
|
+
const month = values[values.length - 2]
|
|
111
|
+
const day = values[values.length - 1]
|
|
112
|
+
const months = [
|
|
113
|
+
'janeiro', 'fevereiro', `mar${this.dictionary.c_dil}o`, 'abril', 'maio', 'junho',
|
|
114
|
+
'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro'
|
|
115
|
+
];
|
|
116
|
+
return `${parseInt(day)} de ${months[parseInt(month) - 1]}`;
|
|
117
|
+
},
|
|
118
|
+
emitData(contact, type) {
|
|
119
|
+
this.$emit('contact-click', {
|
|
120
|
+
contact,
|
|
121
|
+
type,
|
|
122
|
+
data: JSON.parse(JSON.stringify(this.item))
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
verifyHasInfos() {
|
|
126
|
+
const keysToInclude = ['addresses', 'urls', 'birthday'];
|
|
127
|
+
this.hasInfos = Object.keys(this.item).some(key => keysToInclude.includes(key));
|
|
128
|
+
},
|
|
129
|
+
getAdditionalInfo(item) {
|
|
130
|
+
const keysToExclude = ['name', 'org', 'phones', 'emails', 'addresses', 'urls', 'birthday'];
|
|
131
|
+
return Object.keys(item)
|
|
132
|
+
.filter(key => !keysToExclude.includes(key))
|
|
133
|
+
.reduce((obj, key) => {
|
|
134
|
+
obj[key] = item[key];
|
|
135
|
+
return obj;
|
|
136
|
+
}, {});
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
</script>
|
|
141
|
+
|
|
142
|
+
<style scoped>
|
|
143
|
+
.contact-card {
|
|
144
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
145
|
+
background-color: rgba(255, 255, 255, 0.9);
|
|
146
|
+
border-radius: 5px;
|
|
147
|
+
padding: 5px;
|
|
148
|
+
margin-bottom: 10px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.contact-header {
|
|
152
|
+
margin-bottom: 16px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.header-content {
|
|
156
|
+
display: flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
gap: 5px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.header-content h3 {
|
|
162
|
+
margin: 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.contact-list {
|
|
166
|
+
list-style: none;
|
|
167
|
+
padding: 0;
|
|
168
|
+
margin: 0;
|
|
169
|
+
display: flex;
|
|
170
|
+
flex-direction: column;
|
|
171
|
+
gap: 5px;
|
|
172
|
+
margin: 10px 0;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.contact-list li>button {
|
|
176
|
+
background-color: transparent;
|
|
177
|
+
border: none;
|
|
178
|
+
cursor: pointer;
|
|
179
|
+
font-size: 14px;
|
|
180
|
+
color: var(--konecta-success);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.contact-list li>button:hover {
|
|
184
|
+
color: var(--konecta-success-hover);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.badge {
|
|
188
|
+
display: flex;
|
|
189
|
+
justify-content: center;
|
|
190
|
+
align-items: center;
|
|
191
|
+
width: 30px;
|
|
192
|
+
height: 30px;
|
|
193
|
+
border-radius: 50%;
|
|
194
|
+
background-color: var(--message-color);
|
|
195
|
+
color: var(--text-color);
|
|
196
|
+
text-align: center;
|
|
197
|
+
line-height: 24px;
|
|
198
|
+
font-size: 14px;
|
|
199
|
+
font-weight: bold;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.contact-section {
|
|
203
|
+
margin-bottom: 16px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.contact-section h4 {
|
|
207
|
+
margin: 0;
|
|
208
|
+
font-size: 14px;
|
|
209
|
+
font-weight: bold;
|
|
210
|
+
display: flex;
|
|
211
|
+
align-items: center;
|
|
212
|
+
gap: 5px;
|
|
213
|
+
}
|
|
214
|
+
</style>
|