vue-wiguet-chatweb 0.0.27 → 0.0.29
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/components/IconChat.vue.d.ts +2 -0
- package/dist/components/IconTelegram.vue.d.ts +2 -0
- package/dist/components/IconWhatsApp.vue.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/vue-wiguet-chatweb.js +1278 -1120
- package/dist/vue-wiguet-chatweb.umd.cjs +17 -5
- package/package.json +1 -1
- package/src/components/IconChat.vue +23 -0
- package/src/components/IconTelegram.vue +28 -0
- package/src/components/IconWhatsApp.vue +39 -0
- package/src/components/Widget.vue +103 -6
package/package.json
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
<template>
|
2
|
+
<svg
|
3
|
+
version="1.1"
|
4
|
+
id="Capa_1"
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
6
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
7
|
+
viewBox="-10 -10 78 78"
|
8
|
+
xml:space="preserve"
|
9
|
+
>
|
10
|
+
<g>
|
11
|
+
<path
|
12
|
+
style="fill: orange"
|
13
|
+
d="M29,1.5c-16.016,0-29,11.641-29,26c0,5.292,1.768,10.211,4.796,14.318
|
14
|
+
C4.398,46.563,3.254,53.246,0,56.5c0,0,9.943-1.395,16.677-5.462c0.007,0.003,0.015,0.006,0.022,0.009
|
15
|
+
c2.764-1.801,5.532-3.656,6.105-4.126c0.3-0.421,0.879-0.548,1.33-0.277c0.296,0.178,0.483,0.503,0.489,0.848
|
16
|
+
c0.01,0.622-0.005,0.784-5.585,4.421C22.146,52.933,25.498,53.5,29,53.5c16.016,0,29-11.641,29-26S45.016,1.5,29,1.5z"
|
17
|
+
/>
|
18
|
+
<circle style="fill: #ffffff" cx="15" cy="27.5" r="3" />
|
19
|
+
<circle style="fill: #ffffff" cx="29" cy="27.5" r="3" />
|
20
|
+
<circle style="fill: #ffffff" cx="43" cy="27.5" r="3" />
|
21
|
+
</g>
|
22
|
+
</svg>
|
23
|
+
</template>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<template>
|
2
|
+
<svg
|
3
|
+
viewBox="0 0 256 256"
|
4
|
+
version="1.1"
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
6
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
7
|
+
preserveAspectRatio="xMidYMid"
|
8
|
+
>
|
9
|
+
<g>
|
10
|
+
<path
|
11
|
+
d="M128,0 C57.307,0 0,57.307 0,128 L0,128 C0,198.693 57.307,256 128,256 L128,256 C198.693,256 256,198.693 256,128 L256,128 C256,57.307 198.693,0 128,0 L128,0 Z"
|
12
|
+
fill="#40B3E0"
|
13
|
+
></path>
|
14
|
+
<path
|
15
|
+
d="M190.2826,73.6308 L167.4206,188.8978 C167.4206,188.8978 164.2236,196.8918 155.4306,193.0548 L102.6726,152.6068 L83.4886,143.3348 L51.1946,132.4628 C51.1946,132.4628 46.2386,130.7048 45.7586,126.8678 C45.2796,123.0308 51.3546,120.9528 51.3546,120.9528 L179.7306,70.5928 C179.7306,70.5928 190.2826,65.9568 190.2826,73.6308"
|
16
|
+
fill="#FFFFFF"
|
17
|
+
></path>
|
18
|
+
<path
|
19
|
+
d="M98.6178,187.6035 C98.6178,187.6035 97.0778,187.4595 95.1588,181.3835 C93.2408,175.3085 83.4888,143.3345 83.4888,143.3345 L161.0258,94.0945 C161.0258,94.0945 165.5028,91.3765 165.3428,94.0945 C165.3428,94.0945 166.1418,94.5735 163.7438,96.8115 C161.3458,99.0505 102.8328,151.6475 102.8328,151.6475"
|
20
|
+
fill="#D2E5F1"
|
21
|
+
></path>
|
22
|
+
<path
|
23
|
+
d="M122.9015,168.1154 L102.0335,187.1414 C102.0335,187.1414 100.4025,188.3794 98.6175,187.6034 L102.6135,152.2624"
|
24
|
+
fill="#B5CFE4"
|
25
|
+
></path>
|
26
|
+
</g>
|
27
|
+
</svg>
|
28
|
+
</template>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<template>
|
2
|
+
<svg
|
3
|
+
version="1.1"
|
4
|
+
id="Capa_1"
|
5
|
+
xmlns="http://www.w3.org/2000/svg"
|
6
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
7
|
+
viewBox="0 0 455.731 455.731"
|
8
|
+
xml:space="preserve"
|
9
|
+
>
|
10
|
+
<g>
|
11
|
+
<rect
|
12
|
+
x="0"
|
13
|
+
y="0"
|
14
|
+
style="fill: #1bd741"
|
15
|
+
width="455.731"
|
16
|
+
height="455.731"
|
17
|
+
/>
|
18
|
+
<g>
|
19
|
+
<path
|
20
|
+
style="fill: #ffffff"
|
21
|
+
d="M68.494,387.41l22.323-79.284c-14.355-24.387-21.913-52.134-21.913-80.638
|
22
|
+
c0-87.765,71.402-159.167,159.167-159.167s159.166,71.402,159.166,159.167c0,87.765-71.401,159.167-159.166,159.167
|
23
|
+
c-27.347,0-54.125-7-77.814-20.292L68.494,387.41z M154.437,337.406l4.872,2.975c20.654,12.609,44.432,19.274,68.762,19.274
|
24
|
+
c72.877,0,132.166-59.29,132.166-132.167S300.948,95.321,228.071,95.321S95.904,154.611,95.904,227.488
|
25
|
+
c0,25.393,7.217,50.052,20.869,71.311l3.281,5.109l-12.855,45.658L154.437,337.406z"
|
26
|
+
/>
|
27
|
+
<path
|
28
|
+
style="fill: #ffffff"
|
29
|
+
d="M183.359,153.407l-10.328-0.563c-3.244-0.177-6.426,0.907-8.878,3.037
|
30
|
+
c-5.007,4.348-13.013,12.754-15.472,23.708c-3.667,16.333,2,36.333,16.667,56.333c14.667,20,42,52,90.333,65.667
|
31
|
+
c15.575,4.404,27.827,1.435,37.28-4.612c7.487-4.789,12.648-12.476,14.508-21.166l1.649-7.702c0.524-2.448-0.719-4.932-2.993-5.98
|
32
|
+
l-34.905-16.089c-2.266-1.044-4.953-0.384-6.477,1.591l-13.703,17.764c-1.035,1.342-2.807,1.874-4.407,1.312
|
33
|
+
c-9.384-3.298-40.818-16.463-58.066-49.687c-0.748-1.441-0.562-3.19,0.499-4.419l13.096-15.15
|
34
|
+
c1.338-1.547,1.676-3.722,0.872-5.602l-15.046-35.201C187.187,154.774,185.392,153.518,183.359,153.407z"
|
35
|
+
/>
|
36
|
+
</g>
|
37
|
+
</g>
|
38
|
+
</svg>
|
39
|
+
</template>
|
@@ -5,16 +5,37 @@
|
|
5
5
|
>
|
6
6
|
<div
|
7
7
|
id="chat-circle"
|
8
|
-
role="button"
|
9
|
-
@click="toggleChat"
|
10
8
|
class="widget-container"
|
11
9
|
v-show="!isChatBoxVisible"
|
12
|
-
>
|
13
|
-
<div class="
|
10
|
+
>
|
11
|
+
<div class="container-buttons-chat" :class="{'active': toggleButtonsChats}">
|
12
|
+
<a href="javascript:;" class="button whatsapp" @click="go(MeansCommunication.WHATSAPP)">
|
13
|
+
<IconWhatsApp />
|
14
|
+
</a>
|
15
|
+
|
16
|
+
<a href="javascript:;" class="button telegram" @click="go(MeansCommunication.TELEGRAM)">
|
17
|
+
<IconTelegram />
|
18
|
+
</a>
|
19
|
+
|
20
|
+
<a
|
21
|
+
href="javascript:;"
|
22
|
+
class="button webchat"
|
23
|
+
title="Debe estar autenticado"
|
24
|
+
:class="{'disabled': !props.tokenAuth }"
|
25
|
+
@click="toggleButtonsChats && toggleChat()"
|
26
|
+
>
|
27
|
+
<IconChat />
|
28
|
+
</a>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div class="new-message-badge" v-if="newMessages" >
|
14
32
|
{{ newMessages > 9 ? "9+" : newMessages }}
|
15
33
|
</div>
|
16
|
-
<
|
34
|
+
<a href="javascript:;" @click="toggleButtonsChats = !toggleButtonsChats">
|
35
|
+
<IconWidget />
|
36
|
+
</a>
|
17
37
|
</div>
|
38
|
+
|
18
39
|
<div class="chat-box" v-show="isChatBoxVisible">
|
19
40
|
<Chat
|
20
41
|
:visible="isChatBoxVisible"
|
@@ -36,16 +57,47 @@
|
|
36
57
|
import { PropType, ref } from "vue";
|
37
58
|
import Chat from "./Chat.vue";
|
38
59
|
import IconWidget from "./IconWidget.vue";
|
60
|
+
import { VirtualHost } from '../dto/app.dto';
|
61
|
+
import IconTelegram from "./IconTelegram.vue";
|
62
|
+
import IconWhatsApp from "./IconWhatsApp.vue";
|
63
|
+
import IconChat from "./IconChat.vue";
|
39
64
|
|
40
65
|
const emit = defineEmits(["show-toast", "show-confirm"]);
|
41
66
|
|
67
|
+
const enum MeansCommunication{
|
68
|
+
WHATSAPP,
|
69
|
+
TELEGRAM
|
70
|
+
}
|
71
|
+
|
72
|
+
function go(means: MeansCommunication) {
|
73
|
+
const cellphoneNumbers = window.VITE_CELLPHONE_NUMBERS.split(',');
|
74
|
+
|
75
|
+
if (cellphoneNumbers.length === 0) {
|
76
|
+
console.warn('not found cellphone numbers')
|
77
|
+
return
|
78
|
+
}
|
79
|
+
|
80
|
+
toggleButtonsChats.value = false;
|
81
|
+
|
82
|
+
const index = Math.floor(Math.random() * cellphoneNumbers.length)
|
83
|
+
|
84
|
+
if(MeansCommunication['WHATSAPP'] === means) {
|
85
|
+
window.open('https://wa.me/'+ cellphoneNumbers[index], 'WhatsApp', 'noopener')
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
|
89
|
+
window.open('https://t.me/+' + cellphoneNumbers[index], 'Telegram', 'noopener')
|
90
|
+
}
|
91
|
+
|
42
92
|
const isChatBoxVisible = ref(false);
|
43
93
|
const newMessages = ref(0);
|
94
|
+
const toggleButtonsChats = ref(false);
|
95
|
+
|
44
96
|
const toggleChat = () => {
|
45
97
|
isChatBoxVisible.value = !isChatBoxVisible.value;
|
46
98
|
};
|
47
99
|
|
48
|
-
defineProps({
|
100
|
+
const props = defineProps({
|
49
101
|
tokenAuth: { type: String, required: true },
|
50
102
|
titlePrincipal: { type: String },
|
51
103
|
user: {
|
@@ -67,6 +119,51 @@ defineProps({
|
|
67
119
|
</style>
|
68
120
|
|
69
121
|
<style scoped>
|
122
|
+
|
123
|
+
.disabled {
|
124
|
+
color: currentColor;
|
125
|
+
cursor: not-allowed;
|
126
|
+
opacity: 0.3;
|
127
|
+
text-decoration: none;
|
128
|
+
}
|
129
|
+
|
130
|
+
.container-buttons-chat {
|
131
|
+
position: relative;
|
132
|
+
}
|
133
|
+
.button {
|
134
|
+
position: absolute;
|
135
|
+
width: 2.5rem;
|
136
|
+
height: 2.5rem;
|
137
|
+
right: 1.35rem;
|
138
|
+
|
139
|
+
opacity: 0;
|
140
|
+
box-shadow: 0px 1px 3px 1px #c0c0c0;
|
141
|
+
border-radius: 100%;
|
142
|
+
border: 1px solid white;
|
143
|
+
background-color: white;
|
144
|
+
overflow: hidden;
|
145
|
+
cursor: pointer;
|
146
|
+
transition: transform 0.5s ease, opacity 0.3s ease;
|
147
|
+
z-index: -1;
|
148
|
+
}
|
149
|
+
|
150
|
+
.container-buttons-chat.active > a {
|
151
|
+
z-index: 1;
|
152
|
+
opacity: 1;
|
153
|
+
}
|
154
|
+
|
155
|
+
.container-buttons-chat.active .whatsapp {
|
156
|
+
transform: translateY(-150px); /* Subir más arriba */
|
157
|
+
}
|
158
|
+
|
159
|
+
.container-buttons-chat.active .telegram {
|
160
|
+
transform: translateY(-100px); /* Subir más arriba */
|
161
|
+
}
|
162
|
+
|
163
|
+
.container-buttons-chat.active .webchat {
|
164
|
+
transform: translateY(-50px); /* Subir más arriba */
|
165
|
+
}
|
166
|
+
|
70
167
|
.widget-container {
|
71
168
|
position: relative;
|
72
169
|
}
|