vue-wiguet-chatweb 0.1.22 → 0.1.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/dist/App.vue.d.ts +2 -0
  2. package/dist/components/Chat.vue.d.ts +16 -6
  3. package/dist/components/ChatMessage.vue.d.ts +12 -0
  4. package/dist/components/DangerIcon.vue.d.ts +1 -1
  5. package/dist/components/IconAttach.vue.d.ts +2 -0
  6. package/dist/components/IconChat.vue.d.ts +1 -1
  7. package/dist/components/IconClose.vue.d.ts +1 -1
  8. package/dist/components/IconSend.vue.d.ts +1 -1
  9. package/dist/components/IconTelegram.vue.d.ts +1 -1
  10. package/dist/components/IconWhatsApp.vue.d.ts +1 -1
  11. package/dist/components/IconWidget.vue.d.ts +1 -1
  12. package/dist/components/Loader.vue.d.ts +1 -1
  13. package/dist/components/LoadingComponent.vue.d.ts +21 -0
  14. package/dist/components/MessageList.vue.d.ts +12 -6
  15. package/dist/components/ODialog/IPropsDialog.d.ts +6 -0
  16. package/dist/components/ODialog/IPropsSidebar.d.ts +14 -0
  17. package/dist/components/ODialog/ODialog.vue.d.ts +26 -0
  18. package/dist/components/Widget.vue.d.ts +10 -6
  19. package/dist/components/sidebar/SidebarHeader.vue.d.ts +36 -0
  20. package/dist/dto/app.dto.d.ts +9 -1
  21. package/dist/hooks/useMobile.d.ts +3 -0
  22. package/dist/index.d.ts +1 -1
  23. package/dist/resources/constants/message-type.constant.d.ts +8 -0
  24. package/dist/store/config.d.ts +1 -1
  25. package/dist/store/index.d.ts +1 -4
  26. package/dist/style.css +1 -1
  27. package/dist/vue-wiguet-chatweb.js +3284 -2585
  28. package/dist/vue-wiguet-chatweb.umd.cjs +17 -7
  29. package/package.json +7 -7
  30. package/src/components/Chat.vue +163 -52
  31. package/src/components/ChatMessage.vue +2 -2
  32. package/src/components/IconAttach.vue +24 -0
  33. package/src/components/IconSend.vue +1 -1
  34. package/src/components/LoadingComponent.vue +111 -0
  35. package/src/components/MessageList.vue +46 -18
  36. package/src/components/ODialog/IPropsDialog.ts +10 -0
  37. package/src/components/ODialog/IPropsSidebar.ts +17 -0
  38. package/src/components/ODialog/ODialog.vue +82 -0
  39. package/src/components/sidebar/SidebarHeader.vue +40 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-wiguet-chatweb",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -34,9 +34,11 @@
34
34
  "prepack": "npm run build"
35
35
  },
36
36
  "peerDependencies": {
37
+ "@primevue/themes": "^4.2.5",
37
38
  "@vueuse/core": "^10.0.0",
38
39
  "axios": "^1.4.0",
39
40
  "luxon": "^3.0.0",
41
+ "primevue": "^4.2.5",
40
42
  "socket.io-client": "^4.7.2",
41
43
  "uuid": "^9.0.1",
42
44
  "vue": "^3.2.0"
@@ -45,11 +47,7 @@
45
47
  "@vueuse/core": "^10.0.0",
46
48
  "axios": "^1.4.0",
47
49
  "luxon": "^3.0.0",
48
- "socket.io-client": "^4.7.2",
49
- "uuid": "^9.0.1",
50
- "vite-plugin-dts": "^3.4.0",
51
- "vue": "^3.2.0",
52
- "vue-rabbit-frontend": "^0.0.15"
50
+ "uuid": "^9.0.1"
53
51
  },
54
52
  "devDependencies": {
55
53
  "@types/luxon": "^3.4.2",
@@ -59,9 +57,11 @@
59
57
  "@vitest/coverage-v8": "^2.1.8",
60
58
  "@vue/test-utils": "^2.4.6",
61
59
  "jsdom": "^25.0.1",
60
+ "rollup-plugin-visualizer": "^5.14.0",
62
61
  "typescript": "^5.0.2",
63
62
  "vite": "^5.4.11",
63
+ "vite-plugin-dts": "^4.5.0",
64
64
  "vitest": "^2.1.8",
65
- "vue-tsc": "^1.8.5"
65
+ "vue-tsc": "^2.2.0"
66
66
  }
67
67
  }
@@ -24,7 +24,7 @@
24
24
  </div>
25
25
 
26
26
  <div class="w-full">
27
- <form class="message-send" @submit.prevent="(event) => submitMessage(event)">
27
+ <form v-if="!isDisabledBoxMessage" class="message-send" @submit.prevent="(event) => submitMessage()">
28
28
  <div class="form-message">
29
29
  <div class="jl-inputgroup-chat">
30
30
  <textarea
@@ -36,20 +36,90 @@
36
36
  @input="() => autoAdjustHeight()"
37
37
  @keydown.enter="
38
38
  (event) => {
39
- !isMovil && event.preventDefault();
39
+ !isMobile && event.preventDefault();
40
40
  }
41
41
  "
42
42
  @keyup.enter="saltoDeLineaOEnviar"
43
43
  />
44
44
 
45
+ <FileUpload
46
+ mode="basic"
47
+ accept="image/png,image/jpeg,image/jpg,image/webp"
48
+ :maxFileSize="2000000"
49
+ @select="onFileSelect"
50
+ title="Adjuntar imagen"
51
+ :chooseButtonProps="{ label: '', outlined: true }"
52
+ :auto="false"
53
+ style="height: 39px"
54
+ >
55
+ <template #filelabel>
56
+ <span style="display:none"></span>
57
+ </template>
58
+
59
+ <template #chooseicon>
60
+ <IconAttach style="width: 20px; height: 20px" />
61
+ </template>
62
+ </FileUpload>
63
+
64
+ <!-- <button class="pointer btn-primary">
65
+ <IconAttach style="width: 20px; height: 20px" />
66
+ </button> -->
67
+
45
68
  <button type="submit" class="pointer btn-primary">
46
69
  <IconSend style="width: 20px; height: 20px" />
47
70
  </button>
48
71
  </div>
49
72
  </div>
50
73
  </form>
74
+ <span class="message-send-block" v-else>
75
+ Necesitamos que nos califique la atención para continuar
76
+ </span>
51
77
  </div>
52
78
  </div>
79
+
80
+ <ODialog v-bind="dialog" modal>
81
+ <div class="flex flex-col gap-3 justify-center items-center">
82
+ <Image v-for="(urlFile, i) in urlFiles" :key="i" :src="urlFile" alt="Image" width="400" />
83
+
84
+ <div class="w-full">
85
+ <form
86
+ class="message-send"
87
+ @submit.prevent="
88
+ (event) => {
89
+ submitMessage();
90
+ dialog.modelValue = false;
91
+ }
92
+ "
93
+ >
94
+ <div class="form-message">
95
+ <div class="jl-inputgroup-chat">
96
+ <textarea
97
+ v-model="message"
98
+ autofocus
99
+ class="jl2-input-chat"
100
+ placeholder="Escribe tu mensaje"
101
+ ref="textAreaRef"
102
+ @input="() => autoAdjustHeight()"
103
+ @keydown.enter="
104
+ (event) => {
105
+ !isMobile && event.preventDefault();
106
+ }
107
+ "
108
+ @keyup.enter="(event)=>{
109
+ saltoDeLineaOEnviar(event, MESSAGE_TYPE_CODES.IMAGEN)
110
+ dialog.modelValue = false;
111
+ }"
112
+ />
113
+
114
+ <button type="submit" class="pointer btn-primary">
115
+ <IconSend style="width: 20px; height: 20px" />
116
+ </button>
117
+ </div>
118
+ </div>
119
+ </form>
120
+ </div>
121
+ </div>
122
+ </ODialog>
53
123
  </template>
54
124
 
55
125
  <script setup lang="ts">
@@ -60,7 +130,7 @@ import {
60
130
  PropType,
61
131
  watch,
62
132
  onUnmounted,
63
- computed,
133
+ reactive,
64
134
  } from "vue";
65
135
  import { v4 as uuidv4 } from "uuid";
66
136
 
@@ -84,6 +154,14 @@ import Loader from "./Loader.vue";
84
154
  import { searchFromLast } from "../resources/functions.helpers";
85
155
  import { io, Socket } from "socket.io-client";
86
156
  import { APP_TYPE } from "../dto/chat.dto";
157
+ import { MESSAGE_TYPE_CODES, TypeMessageTypeCodes } from "../resources/constants/message-type.constant";
158
+ import { useMobile } from "../hooks/useMobile";
159
+ import { IPropsDialog } from "./ODialog/IPropsDialog";
160
+ import IconAttach from "./IconAttach.vue";
161
+ import ODialog from "./ODialog/ODialog.vue";
162
+ import { type FileUploadSelectEvent } from "primevue";
163
+ import FileUpload from "primevue/fileupload";
164
+ import Image from "primevue/image";
87
165
 
88
166
  //DATA
89
167
  const message = ref("");
@@ -148,8 +226,8 @@ watch(
148
226
  }
149
227
  );
150
228
 
151
- function saltoDeLineaOEnviar(event: KeyboardEvent) {
152
- if(isMovil.value) {
229
+ function saltoDeLineaOEnviar(event: KeyboardEvent, messageTypeCode?: TypeMessageTypeCodes) {
230
+ if(isMobile.value) {
153
231
  autoAdjustHeight();
154
232
  return;
155
233
  }
@@ -161,10 +239,10 @@ function saltoDeLineaOEnviar(event: KeyboardEvent) {
161
239
  return;
162
240
  }
163
241
 
164
- submitMessage(event);
242
+ submitMessage({ codigoTipoMensaje: messageTypeCode });
165
243
  }
166
244
 
167
- function createMessage(message: string) {
245
+ function createMessage(message: string, codigoTipoMensaje?: TypeMessageTypeCodes) {
168
246
  if (message?.length > 300) {
169
247
  emit("show-toast", {
170
248
  severity: "warn",
@@ -175,7 +253,7 @@ function createMessage(message: string) {
175
253
  return;
176
254
  }
177
255
 
178
- if (!message.trim()) {
256
+ if (!message.trim() && codigoTipoMensaje !== MESSAGE_TYPE_CODES.IMAGEN) {
179
257
  emit("show-toast", {
180
258
  severity: "warn",
181
259
  summary: "Error",
@@ -185,6 +263,15 @@ function createMessage(message: string) {
185
263
  return;
186
264
  }
187
265
 
266
+ const messageType = codigoTipoMensaje
267
+ ? {
268
+ code: codigoTipoMensaje,
269
+ }
270
+ : undefined;
271
+
272
+ console.warn(inputFiles.value);
273
+
274
+
188
275
  const newMessage: Message = {
189
276
  id: uuidv4(),
190
277
  chatId: information.value?.chat?.id,
@@ -195,6 +282,9 @@ function createMessage(message: string) {
195
282
  appChatId: appChatId.value,
196
283
  createdAt: new Date().toISOString(),
197
284
  updatedAt: new Date().toISOString(),
285
+ file: inputFiles.value?.[0],
286
+ urlFile: inputFiles.value?.[0]?.objectURL,
287
+ messageType,
198
288
  sender: {
199
289
  nombreCompleto: props.user.nombreCompleto,
200
290
  ci: props.user.ci,
@@ -212,7 +302,7 @@ function updateMessageStatus(
212
302
  messageSaved?: Message,
213
303
  tipoCalificacionId?: number
214
304
  ) {
215
- if (!idxMessageToCommunicate) throw new Error('idx is required')
305
+ if (idxMessageToCommunicate == null) throw new Error('idx is required')
216
306
 
217
307
  if (!messageSaved) {
218
308
  if (tipoCalificacionId) {
@@ -250,12 +340,11 @@ function updateMessageStatus(
250
340
  }
251
341
 
252
342
  const submitMessage = async (
253
- event?: Event,
254
- messageExtraData?: { mensajeARespondeId?: string, tipoCalificacionId?: number, codigoTipoMensaje?: number}
343
+ messageExtraData?: { mensajeARespondeId?: string, tipoCalificacionId?: number, codigoTipoMensaje?: TypeMessageTypeCodes}
255
344
  ) => {
256
345
 
257
- const newMessage = createMessage(message.value);
258
-
346
+ const newMessage = createMessage(message.value, messageExtraData?.codigoTipoMensaje);
347
+ message.value = '';
259
348
  if (!newMessage) return;
260
349
 
261
350
  let idxMessageToCommunicate = -1;
@@ -274,6 +363,8 @@ const submitMessage = async (
274
363
  message: message.value,
275
364
  appChatId: appChatId.value,
276
365
  ...messageExtraData,
366
+ codigoTipoMensaje: messageExtraData?.codigoTipoMensaje,
367
+ files: inputFiles.value,
277
368
  }
278
369
  sendApi(body).then((messageSaved) => {
279
370
  let messageUpdated = updateMessageStatus(
@@ -285,6 +376,8 @@ const submitMessage = async (
285
376
 
286
377
  if(!messageUpdated) return
287
378
 
379
+ isDisabledBoxMessage.value = !!messagesData.value.data.find((msg) => msg.messageType?.code === MESSAGE_TYPE_CODES.PREGUNTA && msg.response == null);
380
+
288
381
  socketService.value?.emit(
289
382
  "sendMessage",
290
383
  { roomId: information?.value?.appChat.id, message: messageUpdated },
@@ -319,6 +412,8 @@ const getMessages = async () => {
319
412
  const resp = await getMessagesApi({ body, token: props.tokenAuth });
320
413
  isLoading.value = false;
321
414
 
415
+ isDisabledBoxMessage.value = !!resp.data.find((msg) => msg.messageType?.code === MESSAGE_TYPE_CODES.PREGUNTA && msg.response == null);
416
+
322
417
  messagesData.value.data.unshift(
323
418
  ...resp.data.sort((a, b) => -b.createdAt.localeCompare(a.createdAt))
324
419
  );
@@ -447,50 +542,15 @@ function connectMsWebSocket(
447
542
  messagesData.value.data.push(data.message);
448
543
  }
449
544
 
545
+ isDisabledBoxMessage.value = !!messagesData.value.data.find((msg) => msg.messageType?.code === MESSAGE_TYPE_CODES.PREGUNTA && msg.response == null);
546
+
450
547
  setVistoToTrueApi(data.message.appChatId, props.tokenAuth);
451
548
  scrollToBottom();
452
549
  !props.visible && emit("new-message");
453
550
  });
454
551
  }
455
552
 
456
- const isMovil = computed(() => {
457
- return [OS.ANDROID, OS.IOS].includes(getOS() as OS);
458
- });
459
-
460
- const enum OS {
461
- ANDROID = "Android",
462
- IOS = "iPhone",
463
- }
464
-
465
- function getOS() {
466
- const userAgent = window.navigator.userAgent;
467
- const platform = (window.navigator as any)?.userAgentData?.platform || window.navigator.platform;
468
- const macosPlatforms = [
469
- "macOS",
470
- "Macintosh",
471
- "MacIntel",
472
- "MacPPC",
473
- "Mac68K",
474
- ];
475
- const windowsPlatforms = ["Win32", "Win64", "Windows", "WinCE"];
476
- const iosPlatforms = ["iPhone", "iPad", "iPod"];
477
-
478
- let os = null;
479
-
480
- if (macosPlatforms.indexOf(platform) !== -1) {
481
- os = "Mac OS";
482
- } else if (iosPlatforms.indexOf(platform) !== -1) {
483
- os = OS.IOS;
484
- } else if (windowsPlatforms.indexOf(platform) !== -1) {
485
- os = "Windows";
486
- } else if (/Android/.test(userAgent)) {
487
- os = OS.ANDROID;
488
- } else if (/Linux/.test(platform)) {
489
- os = "Linux";
490
- }
491
-
492
- return os;
493
- }
553
+ const { isMobile } = useMobile()
494
554
 
495
555
  function onQualifying({ message: messageParam, emoji }: { message: Message, emoji: { iconUnicode: string, value: number } }) {
496
556
  const callback = async () => {
@@ -498,12 +558,57 @@ function onQualifying({ message: messageParam, emoji }: { message: Message, emoj
498
558
 
499
559
  message.value = emoji.iconUnicode
500
560
 
501
- submitMessage(undefined, { tipoCalificacionId: emoji.value, mensajeARespondeId: messageParam.id }).then();
561
+ submitMessage({
562
+ tipoCalificacionId: emoji.value,
563
+ mensajeARespondeId: messageParam.id
564
+ }).then();
502
565
  }
503
566
 
504
567
  emit('onQualifying', { message: emoji.iconUnicode , callback})
505
568
  };
506
569
 
570
+ const isDisabledBoxMessage = ref(false);
571
+
572
+ // Adjuntar
573
+ function onFileSelect(event: FileUploadSelectEvent) {
574
+ inputFiles.value = [];
575
+ urlFiles.value = [];
576
+
577
+ const file = event.files[0]; // Obtiene el primer archivo seleccionado
578
+
579
+ inputFiles.value = event.files as (File & { objectURL: string })[];
580
+
581
+ if (!file) return;
582
+
583
+ const reader = new FileReader();
584
+ reader.onload = (e) => {
585
+ e.target?.result && urlFiles.value.push(e.target?.result);
586
+ };
587
+ reader.readAsDataURL(file);
588
+
589
+ dialog.modelValue = true;
590
+ }
591
+
592
+ // Dialog
593
+
594
+ const inputFiles = ref<(File & { objectURL: string })[]>([]);
595
+ const urlFiles = ref<Array<string | ArrayBuffer>>([]);
596
+
597
+ const dialog = reactive<IPropsDialog>({
598
+ modelValue: false,
599
+ 'onUpdate:modelValue': (args) => {
600
+ dialog.modelValue = args;
601
+
602
+ if (args) return;
603
+
604
+ urlFiles.value = [];
605
+ inputFiles.value = [];
606
+ },
607
+ hideActions: true,
608
+ title: 'SIN TITULO',
609
+ });
610
+
611
+ //
507
612
 
508
613
  onMounted(async () => {
509
614
  if (appChatId.value) return;
@@ -567,4 +672,10 @@ onUnmounted(() => {
567
672
  left: 50%;
568
673
  transform: translate(-50%, -50%);
569
674
  }
675
+
676
+ .message-send-block {
677
+ display: block;
678
+ margin: 1.5rem;
679
+ text-align: center;
680
+ }
570
681
  </style>
@@ -22,8 +22,8 @@
22
22
  </template>
23
23
 
24
24
  <script setup lang="ts">
25
- // TODO: parece que no se usa
26
- import {computed } from 'vue';
25
+ // TODO: parece que no se usa el componente
26
+ import { computed } from 'vue';
27
27
  import { formatTimeAPDate,textCapitalize } from '../resources/functions.helpers'
28
28
  const props = defineProps({
29
29
  message:{ type: Object, required: true },
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <svg
3
+ version="1.1"
4
+ id="Layer_1"
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ xmlns:xlink="http://www.w3.org/1999/xlink"
7
+ viewBox="0 0 280.067 280.067"
8
+ xml:space="preserve"
9
+ >
10
+ <g>
11
+ <path
12
+ fill="currentColor"
13
+ d="M149.823,257.142c-31.398,30.698-81.882,30.576-113.105-0.429
14
+ c-31.214-30.987-31.337-81.129-0.42-112.308l-0.026-0.018L149.841,31.615l14.203-14.098c23.522-23.356,61.65-23.356,85.172,0
15
+ s23.522,61.221,0,84.586l-125.19,123.02l-0.044-0.035c-15.428,14.771-40.018,14.666-55.262-0.394
16
+ c-15.244-15.069-15.34-39.361-0.394-54.588l-0.044-0.053l13.94-13.756l69.701-68.843l13.931,13.774l-83.632,82.599
17
+ c-7.701,7.596-7.701,19.926,0,27.53s20.188,7.604,27.88,0L235.02,87.987l-0.035-0.026l0.473-0.403
18
+ c15.682-15.568,15.682-40.823,0-56.39s-41.094-15.568-56.776,0l-0.42,0.473l-0.026-0.018l-14.194,14.089L50.466,158.485
19
+ c-23.522,23.356-23.522,61.221,0,84.577s61.659,23.356,85.163,0l99.375-98.675l14.194-14.089l14.194,14.089l-14.194,14.098
20
+ l-99.357,98.675C149.841,257.159,149.823,257.142,149.823,257.142z"
21
+ />
22
+ </g>
23
+ </svg>
24
+ </template>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
3
3
  <path
4
- fill="#F28B0C"
4
+ fill="currentColor"
5
5
  d="M16.1 260.2c-22.6 12.9-20.5 47.3 3.6 57.3L160 376V479.3c0 18.1 14.6 32.7 32.7 32.7c9.7 0 18.9-4.3 25.1-11.8l62-74.3 123.9 51.6c18.9 7.9 40.8-4.5 43.9-24.7l64-416c1.9-12.1-3.4-24.3-13.5-31.2s-23.3-7.5-34-1.4l-448 256zm52.1 25.5L409.7 90.6 190.1 336l1.2 1L68.2 285.7zM403.3 425.4L236.7 355.9 450.8 116.6 403.3 425.4z"
6
6
  />
7
7
  </svg>
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <div class="auth-loading">
3
+ <div class="relative">
4
+ <!-- SPINNER ICON -->
5
+ <svg
6
+ class="icon_1"
7
+ :class="{ 'sm-loader-size': props.size === 'small' }"
8
+ viewBox="0 0 275 276"
9
+ fill="none"
10
+ xmlns="http://www.w3.org/2000/svg"
11
+ >
12
+ <path
13
+ d="M137.1 1C124.2 1 111.2 2.80001 98.3 6.60001C68.5 15.4 43.9 33.5 26.8 56.7C9.69999 79.9 0.0999756 108.3 0.0999756 137.9C0.0999756 150.8 1.90001 163.8 5.70001 176.7C7.60001 183 13.3 187 19.5 187C25.7 187 22.2 186.8 23.6 186.4C31.2 184.1 35.6 176.1 33.3 168.5C30.3 158.3 28.8 148 28.8 137.8C28.8 114.5 36.4 92 49.9 73.7C63.4 55.3 82.7 41.1 106.3 34.2C116.5 31.2 126.8 29.7 137 29.7C160.3 29.7 182.8 37.3 201.1 50.8C219.5 64.3 233.7 83.6 240.6 107.2C242.5 113.5 248.2 117.5 254.4 117.5C260.6 117.5 257.1 117.3 258.5 116.9C266.1 114.6 270.5 106.6 268.2 99C259.4 69.2 241.3 44.6 218.1 27.5C194.9 10.4 166.5 0.799988 136.9 0.799988"
14
+ fill="url(#paint0_linear_672_78)"
15
+ />
16
+ <path
17
+ d="M254.5 88.9C253.1 88.9 251.8 89.1 250.4 89.5C242.8 91.8 238.4 99.8 240.7 107.4C243.7 117.6 245.2 127.9 245.2 138.1C245.2 161.4 237.6 183.9 224.1 202.2C210.6 220.6 191.3 234.8 167.7 241.7C157.5 244.7 147.2 246.2 137 246.2C113.7 246.2 91.2 238.6 72.9 225.1C54.5 211.6 40.3001 192.3 33.4001 168.7C31.5001 162.4 25.8 158.4 19.6 158.4C13.4 158.4 16.9 158.6 15.5 159C7.90003 161.3 3.50001 169.3 5.80001 176.9C14.6 206.7 32.7001 231.3 55.9001 248.4C79.1001 265.5 107.5 275.1 137.1 275.1C150 275.1 163 273.3 175.9 269.5C205.7 260.7 230.3 242.6 247.4 219.4C264.5 196.2 274.1 167.8 274.1 138.2C274.1 125.4 272.3 112.3 268.5 99.4C266.6 93.1 260.9 89.1 254.7 89.1"
18
+ fill="url(#paint1_linear_672_78)"
19
+ />
20
+ <defs>
21
+ <linearGradient
22
+ id="paint0_linear_672_78"
23
+ x1="-2.44076e-05"
24
+ y1="94.1"
25
+ x2="269"
26
+ y2="94.1"
27
+ gradientUnits="userSpaceOnUse"
28
+ >
29
+ <stop stop-color="white" />
30
+ <stop offset="1" stop-color="white" stop-opacity="0" />
31
+ </linearGradient>
32
+ <linearGradient
33
+ id="paint1_linear_672_78"
34
+ x1="5.00002"
35
+ y1="181.9"
36
+ x2="274"
37
+ y2="181.9"
38
+ gradientUnits="userSpaceOnUse"
39
+ >
40
+ <stop stop-color="white" stop-opacity="0" />
41
+ <stop offset="1" stop-color="white" />
42
+ </linearGradient>
43
+ </defs>
44
+ </svg>
45
+ <!-- TEXTO SVG -->
46
+ <svg
47
+ class="icon_2"
48
+ :class="{ hidden: props.size === 'small' }"
49
+ xmlns="http://www.w3.org/2000/svg"
50
+ fill="none"
51
+ viewBox="0 0 176 74"
52
+ >
53
+ <path
54
+ fill="#fff"
55
+ d="M6.4 70v-3.5c-.3 1.3-1.5 4.5-2.2 6.6h-.8c-.6-1.7-1.7-5.2-2.1-6.6v6.6H.5v-7.3h1.4c.8 2.1 1.7 5.1 2 6.1.1-.7 1.3-3.9 2.1-6.1h1.3v7.3h-.9V70ZM10.8 65.8v7.3h-.9v-7.3h.9ZM13.5 73.1v-7.3h1.2c2.9 5.1 3.3 5.8 3.4 6.2v-6.1h.9v7.3h-1.1c-3.1-5.6-3.3-6-3.5-6.3v6.4h-.8l-.1-.2ZM22.5 65.8v7.3h-.9v-7.3h.9ZM25.5 71c.1.9.8 1.4 1.6 1.4s1.4-.4 1.4-1.3-.4-1.1-1.7-1.5c-1.5-.5-2.1-1-2.1-2s.9-1.9 2.2-1.9c1.3 0 2.2.9 2.3 1.9h-.9c-.1-.7-.5-1.2-1.4-1.2-.9 0-1.3.4-1.3 1.1 0 .7.4.9 1.5 1.3 1.8.5 2.2 1.2 2.2 2.2 0 1-.8 2.1-2.4 2.1-1.6 0-2.4-.8-2.5-2.1h1.1ZM32.9 66.6h-2.1v-.8H36v.8h-2.1v6.5H33v-6.5h-.1ZM41.9 69.6h-3.3v2.6h3.6v.8h-4.5v-7.3H42v.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.9 3.1c0 1.7.9 3 3.6 4.3 3.7 1.8 5.1 3.6 5.1 6.8 0 3.2-1.9 5.9-5.9 5.9s-5.7-2.8-5.9-5.9h2.4l-.1-.1ZM77.9 1.1v21.4h-2.3V1.1h2.3ZM87.9 16.9c.2 2.2 1.2 4 3.6 4 2.4 0 3.4-1.2 3.4-3.7s-.9-3.5-3.8-4.9c-3.4-1.6-4.8-3.1-4.8-6.2S88.2.8 91.7.8c3.5 0 5.3 3 5.3 5.5h-2.3c-.1-1-.4-3.5-3.1-3.5s-2.9 1.4-2.9 3.1c0 1.7.9 3 3.6 4.3 3.7 1.8 5.1 3.6 5.1 6.8 0 3.2-1.9 5.9-5.9 5.9s-5.7-2.8-5.9-5.9H88l-.1-.1ZM107.9 3.2h-4.8V1.1H115v2.1h-4.8v19.3h-2.4V3.2h.1ZM131.5 12.3h-7.1v8.2h7.9l-.3 2.1h-9.9V1.2h9.8v2.1h-7.5v7h7.1v2.1-.1ZM152.5 13.4c0-4 0-8 .1-10.3-.8 3.7-2.7 12.6-4.4 19.4h-2.3c-1.3-5.9-3.3-15.5-4.1-19.4.1 2.5.2 7.2.2 10.9v8.5h-2.2V1.1h3.5c1.7 6.7 3.4 14.9 3.9 17.7.4-2.3 2.5-11.2 4.2-17.7h3.5v21.4h-2.3v-9.1h-.1ZM165.9 15.8l-1.6 6.8h-2.4l5.2-21.4h3l5.3 21.4h-2.5l-1.6-6.8h-5.6.2Zm5.1-2.1c-1.2-5.3-2-8.6-2.3-10.3-.3 1.9-1.2 5.7-2.2 10.3h4.6-.1Z"
56
+ />
57
+ </svg>
58
+ </div>
59
+ </div>
60
+ </template>
61
+
62
+ <script setup lang="ts">
63
+ import { PropType } from 'vue';
64
+
65
+ const props = defineProps({
66
+ size: {
67
+ type: String as PropType<'small' | 'normal'>,
68
+ default: 'normal',
69
+ },
70
+ footer_text: {
71
+ type: String,
72
+ },
73
+ });
74
+ </script>
75
+
76
+ <style scoped>
77
+ .auth-loading {
78
+ position: absolute;
79
+ width: 100%;
80
+ height: 100%;
81
+ background: rgba(85, 85, 85, 0.75);
82
+ left: 0;
83
+ top: 0;
84
+ z-index: 999999;
85
+ display: flex;
86
+ flex-direction: column;
87
+ align-items: center;
88
+ justify-content: center;
89
+ }
90
+
91
+ .icon_1 {
92
+ animation: rotate 2s linear infinite;
93
+ height: 200px;
94
+ }
95
+ .sm-loader-size {
96
+ height: 40px;
97
+ }
98
+
99
+ @keyframes rotate {
100
+ 100% {
101
+ transform: rotate(-360deg);
102
+ }
103
+ }
104
+ .icon_2 {
105
+ width: 115px;
106
+ position: absolute;
107
+ top: 50%;
108
+ left: 50%;
109
+ transform: translate(-50%, -50%);
110
+ }
111
+ </style>
@@ -26,33 +26,52 @@
26
26
  <div class="chat-message">
27
27
  <div class="bubble" :class="message.esCliente ? 'right' : 'left'">
28
28
  <div :class="message.esCliente ? 'content-right' : 'content-left'">
29
- <div v-if="message.message === '😊😄🙂😐🙁'" class="flex gap-2" >
29
+ <div v-if="message.message === '😊😄🙂😐🙁'" class="flex flex-col gap-2" >
30
30
  <div class="mb-2">
31
31
  <strong style="display: block;">Ayúdanos a mejorar nuestro servicio.</strong>
32
32
  <span>¿Que le pareció la atención?</span>
33
33
  </div>
34
34
 
35
- <a
36
- v-for="emojiParam in emojis"
37
- :key="emojiParam.value"
38
- :href="!message.response ? 'javascript:' : undefined"
39
- class="btn-icon"
40
- :class="{ 'content-disabled' : !showIcon(message, emojiParam) }"
41
- @click="!message.response && emit('onQualifying', { message, emoji: emojiParam })"
42
- >
43
- <div class="flex flex-col items-center">
44
- <img :src="emojiParam.icon" alt="icono" class="icon" />
45
- <span>{{ emojiParam.label }}</span>
46
- </div>
47
- </a>
35
+ <div style="font-size: 14px;" class="flex justify-between gap-2">
36
+ <a
37
+ v-for="emojiParam in emojis"
38
+ :key="emojiParam.value"
39
+ :href="!message.response ? 'javascript:' : undefined"
40
+ class="btn-icon"
41
+ :class="{ 'content-disabled' : !showIcon(message, emojiParam) }"
42
+ @click="!message.response && emit('onQualifying', { message, emoji: emojiParam })"
43
+ >
44
+ <div class="flex flex-col items-center">
45
+ <img :src="emojiParam.icon" alt="icono" class="icon" />
46
+ <span>{{ emojiParam.label }}</span>
47
+ </div>
48
+ </a>
49
+ </div>
48
50
  </div>
49
51
 
50
- <div v-else-if="emoji[message.message ?? '']">
51
- <img :src="emoji[message.message]" alt="icono" class="icon" />
52
+ <div v-else>
53
+ <div v-if="message.messageType?.code === MESSAGE_TYPE_CODES.IMAGEN" class="text-center">
54
+ <Image
55
+ alt="Image"
56
+ preview
57
+ >
58
+ <template #image>
59
+ <img :src="message.thumbnailFile ?? message.urlFile" alt="image" width="150" />
60
+ </template>
61
+ <template #original="slotProps">
62
+ <img :src="message.urlFile" alt="preview" :style="slotProps.style" width="800" @click="slotProps.previewCallback" />
63
+ </template>
64
+ </Image>
65
+ </div>
66
+
67
+ <div v-if="emoji[message.message ?? '']">
68
+ <img :src="emoji[message.message]" alt="icono" class="icon" />
69
+ </div>
70
+
71
+ <div v-else class="message-text" style="white-space: pre-line" v-html="textToRichFormat(message.message)"></div>
52
72
  </div>
53
73
 
54
- <div v-else class="message-text" style="white-space: pre-line" v-html="textToRichFormat(message.message)"></div>
55
- <div class="detail-message flex justify-content-between">
74
+ <div class="detail-message flex justify-between mt-2">
56
75
  <span class="mr-5" v-if="message.sender?.nombreCompleto">
57
76
  {{
58
77
  message.esCliente
@@ -88,6 +107,8 @@ import AngryIcon from '../assets/emojis/AngryIcon.svg'
88
107
  import HappiestIcon from '../assets/emojis/HappiestIcon.svg'
89
108
  import NeutralIcon from '../assets/emojis/NeutralIcon.svg'
90
109
  import HappyIcon from '../assets/emojis/HappyIcon.svg'
110
+ import { MESSAGE_TYPE_CODES } from '../resources/constants/message-type.constant';
111
+ import Image from 'primevue/image';
91
112
 
92
113
  const emit = defineEmits(["loadMore", "retry", "onQualifying"]);
93
114
  const props = defineProps({
@@ -354,10 +375,17 @@ const emoji: { [key in string]: any } = {
354
375
  margin-bottom: 8px;
355
376
  }
356
377
 
378
+ .mt-2 {
379
+ margin-top: 8px;
380
+ }
381
+
357
382
  .content-disabled {
358
383
  -webkit-filter: grayscale(1); /* Google Chrome, Safari 6+ & Opera 15+ */
359
384
  filter: grayscale(1); /* Microsoft Edge and Firefox 35+ */
360
385
  opacity: 0.5;
361
386
  }
387
+ .justify-between {
388
+ justify-content: space-between;
389
+ }
362
390
 
363
391
  </style>
@@ -0,0 +1,10 @@
1
+ import { IPropsSidebar } from './IPropsSidebar';
2
+ import { type DialogProps } from "primevue/dialog";
3
+
4
+
5
+ export interface IPropsDialog extends Omit<IPropsSidebar, 'position'> {
6
+ position?: DialogProps['position'];
7
+
8
+ // solo para v-bind
9
+ 'onUpdate:modelValue'?: (args: IPropsDialog['modelValue'])=> void
10
+ }