@bcc-code/vue-bcc-chat-ui 1.0.7 → 1.1.0

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@bcc-code/vue-bcc-chat-ui",
3
3
  "author": "bcc-code",
4
4
  "license": "Apache-2.0",
5
- "version": "1.0.7",
5
+ "version": "1.1.0",
6
6
  "type": "module",
7
7
  "private": false,
8
8
  "files": [
@@ -13,22 +13,8 @@
13
13
  "type": "git",
14
14
  "url": "git+https://github.com/bcc-code/bcc-chat.git"
15
15
  },
16
- "main": "./dist/vue-bcc-chat-ui.umd.cjs",
17
16
  "module": "./dist/vue-bcc-chat-ui.js",
18
17
  "types": "./dist/index.d.ts",
19
- "exports": {
20
- ".": {
21
- "import": {
22
- "types": "./dist/index.d.ts",
23
- "default": "./dist/vue-bcc-chat-ui.js"
24
- },
25
- "require": {
26
- "types": "./dist/index.d.ts",
27
- "default": "./dist/vue-bcc-chat-ui.umd.cjs"
28
- }
29
- },
30
- "./style.css": "./dist/style.css"
31
- },
32
18
  "publishConfig": {
33
19
  "access": "public"
34
20
  },
@@ -43,18 +29,17 @@
43
29
  "vite": "^5.0.8",
44
30
  "vite-plugin-dts": "^3.7.2",
45
31
  "vue": "^3.3.11",
46
- "vue-tsc": "^1.8.25"
32
+ "sass": "^1.70.0"
47
33
  },
48
34
  "dependencies": {
49
35
  "@cometchat/chat-sdk-javascript": "^4.0.3",
50
36
  "@cometchat/chat-uikit-vue": "^4.2.0",
51
37
  "@cometchat/uikit-resources": "^4.2.2",
52
- "@cometchat/uikit-shared": "^4.2.1",
53
- "sass": "^1.70.0"
38
+ "@cometchat/uikit-shared": "^4.2.1"
54
39
  },
55
40
  "scripts": {
56
41
  "dev": "vite",
57
- "build": "vite build && vue-tsc --emitDeclarationOnly",
42
+ "build": "vite build",
58
43
  "preview": "vite preview"
59
44
  }
60
45
  }
@@ -1,69 +1,39 @@
1
1
  <script setup lang="ts">
2
- import { computed, onBeforeMount, ref } from 'vue'
2
+ import { onUnmounted, ref, watchEffect } from 'vue'
3
3
  import chat from '../chat';
4
- import { watch } from 'vue';
5
4
  import { CometChatMessages } from '@cometchat/chat-uikit-vue'
5
+ import { Group } from '@cometchat/chat-sdk-javascript';
6
6
  //import { ThreadedMessagesStyle } from '@cometchat/uikit-shared';
7
7
 
8
8
  const props = defineProps({
9
- accessToken: String,
10
- chatUid: String,
11
- active: Boolean
9
+ accessToken: {type: String, required: true},
10
+ chatUid: {type: String, required: true},
12
11
  })
13
12
 
14
- const accessToken = computed(() => props.accessToken);
15
- const active = computed(() => props.active);
16
13
  const connected = ref(false);
17
- const chatGroup = ref();
14
+ const chatGroup = ref<Group>();
18
15
  const user = ref();
19
16
 
20
-
21
- const connect = async () => {
22
- if (accessToken.value && active.value){
23
- user.value = await chat.connection.connect(accessToken.value);
24
- console.log('USER', user.value);
25
- if (props.chatUid){
26
- chatGroup.value = await chat.data.getGroup(props.chatUid);
27
- console.log('GROUP', chatGroup.value);
28
- }
29
- connected.value = true;
17
+ watchEffect(async () => {
18
+ if (props.accessToken) {
19
+ user.value = await chat.connection.connect(props.accessToken);
20
+ chatGroup.value = await chat.data.getGroup(props.chatUid);
21
+ connected.value = true
30
22
  }
31
- }
23
+ })
32
24
 
33
- const disconnect = async () => {
34
- console.log('Disconnecting');
25
+ onUnmounted(async () => {
35
26
  if (connected.value){
36
27
  await chat.connection.disconnect();
37
- console.log('Disconnected');
38
28
  connected.value = false;
39
29
  }
40
- }
41
-
42
- watch(accessToken, async (token) => {
43
- if (token && active){
44
- await connect();
45
- }
46
- });
47
-
48
- watch(active, async (isActive, wasActive) => {
49
- if (isActive && !wasActive){
50
- await connect();
51
- }
52
- if (!isActive && connected.value){
53
- await disconnect();
54
- }
55
- });
56
-
57
- onBeforeMount(async() => {
58
- await connect();
59
- });
60
-
30
+ })
61
31
 
62
32
  </script>
63
33
 
64
34
  <template>
65
- <div v-if="connected" class="bcc-chat-message-list">
66
- <CometChatMessages :hideMessageHeader="true" :hideMessageComposer="false" :hideDetails="true" :group="chatGroup"></CometChatMessages>
35
+ <div v-if="connected" class="bcc-chat-message-list">
36
+ <CometChatMessages :hideMessageHeader="true" :hideMessageComposer="false" :hideDetails="true" :group="chatGroup"></CometChatMessages>
67
37
  </div>
68
38
  </template>
69
39
 
@@ -71,49 +41,18 @@ onBeforeMount(async() => {
71
41
 
72
42
  .bcc-chat-message-list {
73
43
  height: 100%;
74
-
75
44
  /* 1. Wrapper for Messages component */
76
45
  .cc-messages-wrapper {
77
-
78
46
  /* 1.1 Messages component */
79
47
  .cc-messages-wrapper__messages {
80
-
81
48
  /* 1.1.1 Wrapper for Messages List */
82
49
  .cc-messages-wrapper__messages-list {
83
-
84
50
  height: calc(100% - 96px);
85
-
86
- /* 1.1.1.1 Messages List header view */
87
- .cc__messagelist__headerview {
88
- }
89
-
90
- /* 1.1.1.2 Messages List messages */
91
- .cc-messagelist {
92
- .cc-list__wrapper {
93
- .cc-list__header {
94
- }
95
- .cc-list__list {
96
- }
97
- }
98
- }
99
-
100
- /* 1.1.1.3 Message List footer */
101
- .cc__messagelist__footerview {
102
- }
103
- }
104
-
105
- /* 1.1.2 Wrapper for Composer */
106
- .cc-messages-wrapper__composer {
107
51
  }
108
-
109
- /* 1.1.3 Wrapper for Live Reaction */
110
- .cc__messages__livereaction {
111
- }
112
-
113
52
  }
114
-
115
53
  }
116
54
  }
55
+
117
56
  .cc-threadedmessages-wrapper__bubbleview::-webkit-scrollbar,
118
57
  .cc__message-list::-webkit-scrollbar {
119
58
  background: transparent;
@@ -126,5 +65,4 @@ onBeforeMount(async() => {
126
65
  border-radius: 8px;
127
66
  }
128
67
 
129
-
130
68
  </style>
package/dist/App.vue.d.ts DELETED
@@ -1,2 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
2
- export default _default;