vue-wiguet-chatweb 0.1.22 → 0.1.24

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.
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
@@ -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>
@@ -0,0 +1,40 @@
1
+ <template>
2
+ <header class="flex justify-between items-center border-b-2 p-2 pl-4 pb-0">
3
+ <slot name="content">
4
+ <span class="text-gray-500 dark:text-gray-200 text-xl font-roboto font-medium">
5
+ {{ props.title }}
6
+ </span>
7
+ </slot>
8
+ <Button
9
+ icon="pi pi-times"
10
+ severity="secondary"
11
+ text
12
+ rounded
13
+ aria-label="Cancel"
14
+ @click="props.closeFn"
15
+ >
16
+ <template #icon>
17
+ <IconClose />
18
+ </template>
19
+ </Button>
20
+ </header>
21
+ </template>
22
+
23
+ <script setup lang="ts">
24
+ import Button from 'primevue/button';
25
+ import IconClose from '../IconClose.vue';
26
+ import { PropType } from 'vue';
27
+
28
+ const props = defineProps({
29
+ closeFn: {
30
+ type: Function as PropType<(event: Event) => void>,
31
+ required: true,
32
+ },
33
+ title: {
34
+ type: String,
35
+ required: false,
36
+ },
37
+ });
38
+ </script>
39
+
40
+ <style scoped></style>