@kiva/kv-components 3.68.1 → 3.69.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.69.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.69.0...@kiva/kv-components@3.69.1) (2024-03-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * remove reaction wasn't working ([4fa9d53](https://github.com/kiva/kv-ui-elements/commit/4fa9d5358da329c3bc4fcd49e4d0d6ef4d3d830c))
12
+
13
+
14
+
15
+
16
+
17
+ # [3.69.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.68.1...@kiva/kv-components@3.69.0) (2024-03-27)
18
+
19
+
20
+ ### Features
21
+
22
+ * adjust comment components for chat product ([077a8ff](https://github.com/kiva/kv-ui-elements/commit/077a8fffbd8df44ee91ce2cf97b7f460fdbc1b49))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [3.68.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.68.0...@kiva/kv-components@3.68.1) (2024-03-26)
7
29
 
8
30
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "3.68.1",
3
+ "version": "3.69.1",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -75,5 +75,5 @@
75
75
  "optional": true
76
76
  }
77
77
  },
78
- "gitHead": "6c98dd89f573d586c0311d56039c3a22e25c8ddc"
78
+ "gitHead": "12d886b4e18e7c961758e6b2c95568d85bed191c"
79
79
  }
@@ -0,0 +1,36 @@
1
+ export const publicLenderId = 'Jess1234';
2
+
3
+ export const comments = [
4
+ {
5
+ id: 'a86167d1-8222-42a8-a53b-e16d3955efa8',
6
+ publicLenderId,
7
+ children: {
8
+ comment: [
9
+ {
10
+ id: '7634a90c-04a8-457b-9849-2ac48d3f44e0',
11
+ publicLenderId,
12
+ children: {
13
+ comment: [],
14
+ like: [
15
+ {
16
+ publicLenderId,
17
+ },
18
+ ],
19
+ },
20
+ text: 'First reply',
21
+ },
22
+ ],
23
+ like: [
24
+ {
25
+ publicLenderId,
26
+ },
27
+ ],
28
+ },
29
+ text: 'First comment',
30
+ },
31
+ {
32
+ id: '2507fcb5-12c8-4b1c-aedc-822492021584',
33
+ publicLenderId,
34
+ text: 'Second comment',
35
+ },
36
+ ];
@@ -1,7 +1,7 @@
1
1
  import { render } from '@testing-library/vue';
2
2
  import userEvent from '@testing-library/user-event';
3
3
  import ListComponent from '../../../../vue/KvCommentsList.vue';
4
- import comments from '../../../fixtures/mockFeedActivityData';
4
+ import { comments } from '../../../fixtures/mockCommentsData';
5
5
  import { LIKE_COMMENT_EVENT, REPLY_COMMENT_EVENT } from '../../../../vue/KvCommentsListItem.vue';
6
6
  import { ADD_REACTION_EVENT } from '../../../../vue/KvCommentsContainer.vue';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { render } from '@testing-library/vue';
2
2
  import userEvent from '@testing-library/user-event';
3
3
  import KvCommentsListItem, { LIKE_COMMENT_EVENT, REPLY_COMMENT_EVENT } from '../../../../vue/KvCommentsListItem.vue';
4
- import comments from '../../../fixtures/mockFeedActivityData';
4
+ import { comments } from '../../../fixtures/mockCommentsData';
5
5
  import { ADD_REACTION_EVENT } from '../../../../vue/KvCommentsContainer.vue';
6
6
 
7
7
  const comment = comments[0];
@@ -52,7 +52,7 @@ describe('KvCommentsListItem', () => {
52
52
 
53
53
  await userEvent.click(openRepliesButton);
54
54
 
55
- const childComment = getAllByText(comment.latest_children.comment[0].text)[0];
55
+ const childComment = getAllByText(comment.children.comment[0].text)[0];
56
56
 
57
57
  expect(childComment).toBeDefined();
58
58
  });
@@ -4,7 +4,6 @@
4
4
  v-for="comment in comments"
5
5
  :id="comment.id"
6
6
  :key="comment.id"
7
- :nest-level="1"
8
7
  :comment="comment"
9
8
  :user-image-url="userImageUrl"
10
9
  :user-display-name="userDisplayName"
@@ -18,10 +18,7 @@
18
18
  {{ commentText }}
19
19
  </p>
20
20
  </div>
21
- <div
22
- v-if="nestLevel < 3"
23
- class="tw-flex tw-items-center tw-gap-x-1"
24
- >
21
+ <div class="tw-flex tw-items-center tw-gap-x-1">
25
22
  <div class="tw-flex tw-items-center tw-gap-0.5">
26
23
  <kv-comments-heart-button
27
24
  :is-small="true"
@@ -38,7 +35,7 @@
38
35
  </p>
39
36
  </div>
40
37
  <kv-comments-reply-button
41
- v-if="userPublicId"
38
+ v-if="userPublicId && nestLevel === 0"
42
39
  @click="replyClick"
43
40
  />
44
41
  </div>
@@ -74,15 +71,15 @@
74
71
  </button>
75
72
  <div v-if="repliesOpened">
76
73
  <div
77
- v-for="nested_comment in childComments"
78
- :key="nested_comment.id"
74
+ v-for="childComment in childComments"
75
+ :key="childComment.id"
79
76
  class="tw-ml-3"
80
77
  >
81
78
  <kv-comments-list-item
82
79
  :user-image-url="userImageUrl"
83
80
  :user-display-name="userDisplayName"
84
81
  :user-public-id="userPublicId"
85
- :comment="nested_comment"
82
+ :comment="childComment"
86
83
  :nest-level="nestLevel + 1"
87
84
  @add-reaction="$emit(ADD_REACTION_EVENT, $event);"
88
85
  />
@@ -178,9 +175,9 @@ export default {
178
175
  const authorImage = computed(() => authorInfo?.value?.image?.url ?? '');
179
176
  const authorName = computed(() => authorInfo?.value?.name ?? '');
180
177
 
181
- const childComments = computed(() => comment?.value?.latest_children?.comment ?? null);
182
- const childLikes = computed(() => comment?.value?.latest_children?.like ?? []);
183
- const likedObject = computed(() => childLikes.value.find((child) => child?.user?.data?.publicLenderId === userPublicId.value)); // eslint-disable-line max-len
178
+ const childComments = computed(() => comment?.value?.children?.comment ?? null);
179
+ const childLikes = computed(() => (comment?.value?.children?.like ?? []));
180
+ const likedObject = computed(() => childLikes.value.find((l) => l.publicLenderId === userPublicId.value));
184
181
  const isLiked = computed(() => likedObject.value !== undefined);
185
182
 
186
183
  const replyClick = () => {
@@ -197,18 +194,15 @@ export default {
197
194
  isChild: true,
198
195
  value,
199
196
  };
200
- if (reaction === LIKE_COMMENT_EVENT && !value) {
201
- payload.id = likedObject.value.id;
202
- }
203
197
 
204
198
  emit(ADD_REACTION_EVENT, payload);
205
199
  };
206
200
 
207
201
  const hideInput = () => { showInput.value = false; };
208
202
 
209
- const numberOfLikes = computed(() => comment?.value?.children_counts?.like ?? 0);
203
+ const numberOfLikes = computed(() => comment?.value?.children?.like?.length ?? 0);
210
204
 
211
- const numberOfReplies = computed(() => comment?.value?.children_counts?.comment ?? 0);
205
+ const numberOfReplies = computed(() => comment?.value?.children?.comment?.length ?? 0);
212
206
 
213
207
  const toggleReplies = () => { repliesOpened.value = !repliesOpened.value; };
214
208
 
@@ -1,5 +1,5 @@
1
1
  import KvCommentsContainer from '../KvCommentsContainer.vue';
2
- import comments from '../../tests/fixtures/mockFeedActivityData';
2
+ import { publicLenderId, comments } from '../../tests/fixtures/mockCommentsData';
3
3
 
4
4
  export default {
5
5
  title: 'KvCommentsContainer',
@@ -37,6 +37,6 @@ export const UserData = story(
37
37
  comments,
38
38
  userDisplayName: TEST_USER_NAME,
39
39
  userImageUrl: TEST_USER_IMAGE,
40
- userPublicId: 'Jess1234',
40
+ userPublicId: publicLenderId,
41
41
  },
42
42
  );
@@ -1,5 +1,5 @@
1
1
  import KvCommentsList from '../KvCommentsList.vue';
2
- import comments from '../../tests/fixtures/mockFeedActivityData';
2
+ import { publicLenderId, comments } from '../../tests/fixtures/mockCommentsData';
3
3
 
4
4
  export default {
5
5
  title: 'KvCommentsList',
@@ -34,6 +34,6 @@ export const UserData = story(
34
34
  comments,
35
35
  userDisplayName: TEST_USER_NAME,
36
36
  userImageUrl: TEST_USER_IMAGE,
37
- userPublicId: 'Jess1234',
37
+ userPublicId: publicLenderId,
38
38
  },
39
39
  );
@@ -1,5 +1,5 @@
1
1
  import KvCommentsListItem from '../KvCommentsListItem.vue';
2
- import comments from '../../tests/fixtures/mockFeedActivityData';
2
+ import { publicLenderId, comments } from '../../tests/fixtures/mockCommentsData';
3
3
 
4
4
  export default {
5
5
  title: 'KvCommentsListItem',
@@ -40,6 +40,6 @@ export const UserData = story(
40
40
  comment: childComments,
41
41
  userDisplayName: TEST_USER_NAME,
42
42
  userImageUrl: TEST_USER_IMAGE,
43
- userPublicId: 'Jess1234',
43
+ userPublicId: publicLenderId,
44
44
  },
45
45
  );
@@ -19,5 +19,3 @@ const story = (args) => {
19
19
  };
20
20
 
21
21
  export const Default = story({});
22
-
23
- export const ReplyCount = story({ numberOfReplies: 6 });
@@ -1,155 +0,0 @@
1
- const comments = [
2
- {
3
- created_at: '2024-02-01T20:12:31.398932Z',
4
- updated_at: '2024-02-01T20:12:31.398932Z',
5
- id: 'dade3812-6aa0-4c32-90ea-2366dab178a1',
6
- kind: 'comment',
7
- activity_id: 'efb2dbfe-c12a-11ee-9fbc-065afce7d41d',
8
- text: 'another guest comment',
9
- user: {
10
- publicLenderId: 'Nathan2352',
11
- name: 'Nathan',
12
- image: 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg', // eslint-disable-line max-len
13
- },
14
- parent: '',
15
- latest_children: {
16
- like: [
17
- {
18
- created_at: '2024-02-28T20:04:21.445272Z',
19
- updated_at: '2024-02-28T20:04:21.445272Z',
20
- id: '290a6c07-143a-416e-b016-ac0d9ac8ad91',
21
- user: {
22
- created_at: '2024-02-28T19:09:54.093757Z',
23
- updated_at: '2024-02-28T19:09:54.093757Z',
24
- publicLenderId: 'Jess1234',
25
- name: 'Jess',
26
- image: 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg', // eslint-disable-line max-len
27
- },
28
- kind: 'like',
29
- activity_id: 'efb2dbfe-c12a-11ee-9fbc-065afce7d41d',
30
- parent: '6384df77-d7c4-4ea9-b1b9-ef1c76a054a2',
31
- latest_children: {},
32
- children_counts: {},
33
- },
34
- ],
35
- comment: [
36
- {
37
- created_at: '2024-02-28T20:04:21.445272Z',
38
- updated_at: '2024-02-28T20:04:21.445272Z',
39
- id: '290a6c07-143a-416e-b016-ac0d9ac8ad92',
40
- user: {
41
- publicLenderId: 'Casey1234',
42
- name: 'Casey',
43
- image: 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg', // eslint-disable-line max-len
44
- },
45
- kind: 'comment',
46
- activity_id: 'efb2dbfe-c12a-11ee-9fbc-065afce7d41d',
47
- text: 'child comment',
48
- parent: '6384df77-d7c4-4ea9-b1b9-ef1c76a054a2',
49
- latest_children: {
50
- comment: [
51
- {
52
- created_at: '2024-02-28T20:04:21.445272Z',
53
- updated_at: '2024-02-28T20:04:21.445272Z',
54
- id: '290a6c07-143a-416e-b016-ac0d9ac8ad93',
55
- user: {
56
- publicLenderId: 'Sarah1234',
57
- name: 'Sarah',
58
- image: 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg', // eslint-disable-line max-len
59
- },
60
- kind: 'comment',
61
- activity_id: 'efb2dbfe-c12a-11ee-9fbc-065afce7d41d',
62
- text: 'child comment reply',
63
- parent: '6384df77-d7c4-4ea9-b1b9-ef1c76a054a2',
64
- latest_children: {},
65
- children_counts: {},
66
- },
67
- ],
68
- },
69
- children_counts: {
70
- comment: 1,
71
- },
72
- },
73
- {
74
- created_at: '2024-02-28T20:04:21.445272Z',
75
- updated_at: '2024-02-28T20:04:21.445272Z',
76
- id: '290a6c07-143a-416e-b016-ac0d9ac8ad90',
77
- user: {
78
- publicLenderId: 'Sophie1234',
79
- name: 'Sophie',
80
- image: 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg', // eslint-disable-line max-len
81
- },
82
- kind: 'comment',
83
- activity_id: 'efb2dbfe-c12a-11ee-9fbc-065afce7d41d',
84
- text: 'second child comment',
85
- parent: '6384df77-d7c4-4ea9-b1b9-ef1c76a054a2',
86
- latest_children: {
87
- like: [
88
- {
89
- created_at: '2024-02-28T20:04:21.445272Z',
90
- updated_at: '2024-02-28T20:04:21.445272Z',
91
- id: '290a6c07-143a-416e-b016-ac0d9ac8ad99',
92
- user: {
93
- created_at: '2024-02-28T19:09:54.093757Z',
94
- updated_at: '2024-02-28T19:09:54.093757Z',
95
- publicLenderId: 'Jess1234',
96
- name: 'Jess',
97
- image: 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg', // eslint-disable-line max-len
98
- },
99
- kind: 'like',
100
- activity_id: 'efb2dbfe-c12a-11ee-9fbc-065afce7d41d',
101
- parent: '6384df77-d7c4-4ea9-b1b9-ef1c76a054a2',
102
- latest_children: {},
103
- children_counts: {},
104
- },
105
- ],
106
- },
107
- children_counts: {},
108
- },
109
- ],
110
- },
111
- children_counts: {
112
- comment: 1,
113
- like: 1,
114
- },
115
- },
116
- {
117
- created_at: '2024-02-01T20:11:23.931133Z',
118
- updated_at: '2024-02-01T20:11:23.931133Z',
119
- id: '3de615bb-0d48-4a69-9004-141ee26985eb',
120
- kind: 'comment',
121
- activity_id: 'efb2dbfe-c12a-11ee-9fbc-065afce7d41d',
122
- text: 'test as visitor',
123
- user: {
124
- created_at: '2024-02-28T19:09:54.093757Z',
125
- updated_at: '2024-02-28T19:09:54.093757Z',
126
- publicLenderId: 'Lauren1234',
127
- name: '',
128
- image: '',
129
- },
130
- parent: '',
131
- latest_children: {},
132
- children_counts: {},
133
- is_liked: true,
134
- },
135
- {
136
- created_at: '2024-02-01T20:06:46.651764Z',
137
- updated_at: '2024-02-01T20:06:46.651764Z',
138
- id: 'e1db4420-159e-4ba2-aab9-704d1cc56dae',
139
- user: {
140
- created_at: '2024-02-28T19:09:54.093757Z',
141
- updated_at: '2024-02-28T19:09:54.093757Z',
142
- publicLenderId: 'Todd1234',
143
- name: 'Todd',
144
- image: 'https://www-0.development.kiva.org/img/s100/6b1a24092be3aaa22216874e644a4acf.jpg', // eslint-disable-line max-len
145
- },
146
- kind: 'comment',
147
- activity_id: 'efb2dbfe-c12a-11ee-9fbc-065afce7d41d',
148
- text: 'comment test forever!',
149
- parent: '',
150
- latest_children: {},
151
- children_counts: {},
152
- },
153
- ];
154
-
155
- export default comments;