vue-wiguet-chatweb 0.1.23 → 0.1.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) 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/store/config.d.ts +1 -1
  24. package/dist/store/index.d.ts +1 -4
  25. package/dist/style.css +1 -1
  26. package/dist/vue-wiguet-chatweb.js +3296 -2622
  27. package/dist/vue-wiguet-chatweb.umd.cjs +17 -7
  28. package/package.json +7 -7
  29. package/src/components/Chat.vue +147 -53
  30. package/src/components/IconAttach.vue +24 -0
  31. package/src/components/IconSend.vue +1 -1
  32. package/src/components/LoadingComponent.vue +111 -0
  33. package/src/components/MessageList.vue +22 -4
  34. package/src/components/ODialog/IPropsDialog.ts +10 -0
  35. package/src/components/ODialog/IPropsSidebar.ts +17 -0
  36. package/src/components/ODialog/ODialog.vue +82 -0
  37. 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.23",
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 v-if="!isDisabledBoxMessage" 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,12 +36,35 @@
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>
@@ -53,6 +76,50 @@
53
76
  </span>
54
77
  </div>
55
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>
56
123
  </template>
57
124
 
58
125
  <script setup lang="ts">
@@ -63,7 +130,7 @@ import {
63
130
  PropType,
64
131
  watch,
65
132
  onUnmounted,
66
- computed,
133
+ reactive,
67
134
  } from "vue";
68
135
  import { v4 as uuidv4 } from "uuid";
69
136
 
@@ -87,7 +154,14 @@ import Loader from "./Loader.vue";
87
154
  import { searchFromLast } from "../resources/functions.helpers";
88
155
  import { io, Socket } from "socket.io-client";
89
156
  import { APP_TYPE } from "../dto/chat.dto";
90
- import { MESSAGE_TYPE_CODES } from "../resources/constants/message-type.constant";
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";
91
165
 
92
166
  //DATA
93
167
  const message = ref("");
@@ -152,8 +226,8 @@ watch(
152
226
  }
153
227
  );
154
228
 
155
- function saltoDeLineaOEnviar(event: KeyboardEvent) {
156
- if(isMovil.value) {
229
+ function saltoDeLineaOEnviar(event: KeyboardEvent, messageTypeCode?: TypeMessageTypeCodes) {
230
+ if(isMobile.value) {
157
231
  autoAdjustHeight();
158
232
  return;
159
233
  }
@@ -165,10 +239,10 @@ function saltoDeLineaOEnviar(event: KeyboardEvent) {
165
239
  return;
166
240
  }
167
241
 
168
- submitMessage(event);
242
+ submitMessage({ codigoTipoMensaje: messageTypeCode });
169
243
  }
170
244
 
171
- function createMessage(message: string) {
245
+ function createMessage(message: string, codigoTipoMensaje?: TypeMessageTypeCodes) {
172
246
  if (message?.length > 300) {
173
247
  emit("show-toast", {
174
248
  severity: "warn",
@@ -179,7 +253,7 @@ function createMessage(message: string) {
179
253
  return;
180
254
  }
181
255
 
182
- if (!message.trim()) {
256
+ if (!message.trim() && codigoTipoMensaje !== MESSAGE_TYPE_CODES.IMAGEN) {
183
257
  emit("show-toast", {
184
258
  severity: "warn",
185
259
  summary: "Error",
@@ -189,6 +263,15 @@ function createMessage(message: string) {
189
263
  return;
190
264
  }
191
265
 
266
+ const messageType = codigoTipoMensaje
267
+ ? {
268
+ code: codigoTipoMensaje,
269
+ }
270
+ : undefined;
271
+
272
+ console.warn(inputFiles.value);
273
+
274
+
192
275
  const newMessage: Message = {
193
276
  id: uuidv4(),
194
277
  chatId: information.value?.chat?.id,
@@ -199,6 +282,9 @@ function createMessage(message: string) {
199
282
  appChatId: appChatId.value,
200
283
  createdAt: new Date().toISOString(),
201
284
  updatedAt: new Date().toISOString(),
285
+ file: inputFiles.value?.[0],
286
+ urlFile: inputFiles.value?.[0]?.objectURL,
287
+ messageType,
202
288
  sender: {
203
289
  nombreCompleto: props.user.nombreCompleto,
204
290
  ci: props.user.ci,
@@ -216,7 +302,7 @@ function updateMessageStatus(
216
302
  messageSaved?: Message,
217
303
  tipoCalificacionId?: number
218
304
  ) {
219
- if (!idxMessageToCommunicate) throw new Error('idx is required')
305
+ if (idxMessageToCommunicate == null) throw new Error('idx is required')
220
306
 
221
307
  if (!messageSaved) {
222
308
  if (tipoCalificacionId) {
@@ -254,12 +340,11 @@ function updateMessageStatus(
254
340
  }
255
341
 
256
342
  const submitMessage = async (
257
- event?: Event,
258
- messageExtraData?: { mensajeARespondeId?: string, tipoCalificacionId?: number, codigoTipoMensaje?: number}
343
+ messageExtraData?: { mensajeARespondeId?: string, tipoCalificacionId?: number, codigoTipoMensaje?: TypeMessageTypeCodes}
259
344
  ) => {
260
345
 
261
- const newMessage = createMessage(message.value);
262
-
346
+ const newMessage = createMessage(message.value, messageExtraData?.codigoTipoMensaje);
347
+ message.value = '';
263
348
  if (!newMessage) return;
264
349
 
265
350
  let idxMessageToCommunicate = -1;
@@ -278,6 +363,8 @@ const submitMessage = async (
278
363
  message: message.value,
279
364
  appChatId: appChatId.value,
280
365
  ...messageExtraData,
366
+ codigoTipoMensaje: messageExtraData?.codigoTipoMensaje,
367
+ files: inputFiles.value,
281
368
  }
282
369
  sendApi(body).then((messageSaved) => {
283
370
  let messageUpdated = updateMessageStatus(
@@ -463,44 +550,7 @@ function connectMsWebSocket(
463
550
  });
464
551
  }
465
552
 
466
- const isMovil = computed(() => {
467
- return [OS.ANDROID, OS.IOS].includes(getOS() as OS);
468
- });
469
-
470
- const enum OS {
471
- ANDROID = "Android",
472
- IOS = "iPhone",
473
- }
474
-
475
- function getOS() {
476
- const userAgent = window.navigator.userAgent;
477
- const platform = (window.navigator as any)?.userAgentData?.platform || window.navigator.platform;
478
- const macosPlatforms = [
479
- "macOS",
480
- "Macintosh",
481
- "MacIntel",
482
- "MacPPC",
483
- "Mac68K",
484
- ];
485
- const windowsPlatforms = ["Win32", "Win64", "Windows", "WinCE"];
486
- const iosPlatforms = ["iPhone", "iPad", "iPod"];
487
-
488
- let os = null;
489
-
490
- if (macosPlatforms.indexOf(platform) !== -1) {
491
- os = "Mac OS";
492
- } else if (iosPlatforms.indexOf(platform) !== -1) {
493
- os = OS.IOS;
494
- } else if (windowsPlatforms.indexOf(platform) !== -1) {
495
- os = "Windows";
496
- } else if (/Android/.test(userAgent)) {
497
- os = OS.ANDROID;
498
- } else if (/Linux/.test(platform)) {
499
- os = "Linux";
500
- }
501
-
502
- return os;
503
- }
553
+ const { isMobile } = useMobile()
504
554
 
505
555
  function onQualifying({ message: messageParam, emoji }: { message: Message, emoji: { iconUnicode: string, value: number } }) {
506
556
  const callback = async () => {
@@ -508,7 +558,10 @@ function onQualifying({ message: messageParam, emoji }: { message: Message, emoj
508
558
 
509
559
  message.value = emoji.iconUnicode
510
560
 
511
- submitMessage(undefined, { tipoCalificacionId: emoji.value, mensajeARespondeId: messageParam.id }).then();
561
+ submitMessage({
562
+ tipoCalificacionId: emoji.value,
563
+ mensajeARespondeId: messageParam.id
564
+ }).then();
512
565
  }
513
566
 
514
567
  emit('onQualifying', { message: emoji.iconUnicode , callback})
@@ -516,6 +569,47 @@ function onQualifying({ message: messageParam, emoji }: { message: Message, emoj
516
569
 
517
570
  const isDisabledBoxMessage = ref(false);
518
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
+ //
612
+
519
613
  onMounted(async () => {
520
614
  if (appChatId.value) return;
521
615
 
@@ -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-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9c-3.4-1.6-4.8-3.1-4.8-6.2S58.7.8 62.2.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.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>
@@ -49,11 +49,27 @@
49
49
  </div>
50
50
  </div>
51
51
 
52
- <div v-else-if="emoji[message.message ?? '']">
53
- <img :src="emoji[message.message]" alt="icono" class="icon" />
54
- </div>
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>
55
66
 
56
- <div v-else class="message-text" style="white-space: pre-line" v-html="textToRichFormat(message.message)"></div>
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>
72
+ </div>
57
73
 
58
74
  <div class="detail-message flex justify-between mt-2">
59
75
  <span class="mr-5" v-if="message.sender?.nombreCompleto">
@@ -91,6 +107,8 @@ import AngryIcon from '../assets/emojis/AngryIcon.svg'
91
107
  import HappiestIcon from '../assets/emojis/HappiestIcon.svg'
92
108
  import NeutralIcon from '../assets/emojis/NeutralIcon.svg'
93
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';
94
112
 
95
113
  const emit = defineEmits(["loadMore", "retry", "onQualifying"]);
96
114
  const props = defineProps({
@@ -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
+ }
@@ -0,0 +1,17 @@
1
+ import type { DrawerProps } from "primevue/drawer";
2
+
3
+ export interface IPropsSidebar {
4
+ modelValue: boolean;
5
+ dismissable?: boolean;
6
+ position?: DrawerProps['position'];
7
+ title?: string;
8
+ isLoading?: boolean;
9
+ hideActions?: boolean;
10
+ hideHeader?: boolean;
11
+ acceptFn?: () => Promise<boolean>;
12
+ beforeAcceptFn?: () => Promise<boolean>;
13
+ disable?: boolean;
14
+
15
+ // solo para v-bind
16
+ 'onUpdate:modelValue'?: (args: IPropsSidebar['modelValue'])=> void
17
+ }
@@ -0,0 +1,82 @@
1
+ <template>
2
+ <Dialog
3
+ :visible="propsComponent.modelValue"
4
+ :dismissable
5
+ :position
6
+ @update:visible="(val: boolean) => emit('update:modelValue', val)"
7
+ class="!w-auto min-w-[20rem] dark:!bg-[var(--theme-background-secondary)]"
8
+ >
9
+ <template #container>
10
+ <LoadingComponent v-if="propsComponent.isLoading || isWorking" />
11
+ <SidebarHeader v-if="!propsComponent.hideHeader" :title :closeFn="() => emit('update:modelValue', false)" />
12
+
13
+ <!-- <Divider class="!m-0 !p-0" /> -->
14
+
15
+ <div class="overflow-y-auto m-4 h-full max-h-full">
16
+ <slot></slot>
17
+ </div>
18
+
19
+ <footer v-if="!hideActions" class="flex sm:justify-between gap-16 items-center mx-5 py-5">
20
+ <Button
21
+ label="Cancelar"
22
+ severity="secondary"
23
+ class="w-full h-[40px] !rounded-2xl pr-5 sm:max-w-48"
24
+ icon="pi pi-times"
25
+ outlined
26
+ @click="() => emit('update:modelValue', false)"
27
+ ></Button>
28
+ <Button
29
+ label="Aceptar"
30
+ :disabled="disable || isLoading"
31
+ icon="pi pi-check"
32
+ aria-label="save"
33
+ class="w-full h-[40px] !rounded-2xl pr-5 sm:max-w-48"
34
+ @click="onAccept"
35
+ ></Button>
36
+ </footer>
37
+ </template>
38
+ </Dialog>
39
+ </template>
40
+
41
+ <script setup lang="ts">
42
+ import Dialog from 'primevue/dialog';
43
+ import { IPropsDialog } from './IPropsDialog';
44
+ import LoadingComponent from '../LoadingComponent.vue';
45
+ import SidebarHeader from '../sidebar/SidebarHeader.vue';
46
+ import { computed, ref } from 'vue';
47
+ import Button from 'primevue/button';
48
+
49
+ const propsComponent = withDefaults(defineProps<IPropsDialog>(), {
50
+ beforeAcceptFn: async () => true
51
+ });
52
+
53
+ const emit = defineEmits<{
54
+ 'update:modelValue': [visible: boolean];
55
+ accept: [void];
56
+ }>();
57
+
58
+ const isWorking = ref(false);
59
+ const isLoading = computed(() => {
60
+ return isWorking.value || propsComponent.disable || propsComponent.isLoading;
61
+ });
62
+
63
+ async function onAccept() {
64
+ if (!propsComponent.acceptFn) {
65
+ emit('accept');
66
+ return;
67
+ }
68
+
69
+ const isPassed = await propsComponent.beforeAcceptFn();
70
+
71
+ if(!isPassed) return;
72
+
73
+ isWorking.value = true;
74
+ const result = await propsComponent.acceptFn?.();
75
+ isWorking.value = false;
76
+
77
+ if(!result) return
78
+
79
+ emit('accept')
80
+ emit('update:modelValue', false);
81
+ }
82
+ </script>