@kiva/kv-components 3.60.0 → 3.61.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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
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.61.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.60.0...@kiva/kv-components@3.61.0) (2024-03-04)
7
+
8
+
9
+ ### Features
10
+
11
+ * fetchlenderinfo method injected to comment item component ([#362](https://github.com/kiva/kv-ui-elements/issues/362)) ([2aba5e0](https://github.com/kiva/kv-ui-elements/commit/2aba5e0837d57eec77f2d1bee48ca2c3c127c1d4))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.60.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.59.1...@kiva/kv-components@3.60.0) (2024-03-04)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "3.60.0",
3
+ "version": "3.61.0",
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": "30d18f082b47330947b701d87edb26ea5e65d4ac"
78
+ "gitHead": "5a1b6f22bba95529946eaf398992273b8e117d6b"
79
79
  }
@@ -6,7 +6,20 @@ import { LIKE_COMMENT_EVENT, REPLY_COMMENT_EVENT } from '../../../../vue/KvComme
6
6
  import { ADD_REACTION_EVENT } from '../../../../vue/KvCommentsContainer.vue';
7
7
 
8
8
  const renderList = (props = {}) => {
9
- return render(ListComponent, { props });
9
+ return render(ListComponent,
10
+ {
11
+ props,
12
+ // provide function for vue 2 testing
13
+ provide: {
14
+ fetchLenderInfo: () => Promise.resolve({}),
15
+ },
16
+ // provide function for vue 3 testing
17
+ global: {
18
+ provide: {
19
+ fetchLenderInfo: () => Promise.resolve({}),
20
+ },
21
+ },
22
+ });
10
23
  };
11
24
 
12
25
  const comments = activityFeed.results[0].latest_reactions;
@@ -7,7 +7,20 @@ import { ADD_REACTION_EVENT } from '../../../../vue/KvCommentsContainer.vue';
7
7
  const comment = activityFeed.results[0].latest_reactions.comment[0];
8
8
 
9
9
  const renderComment = (props = {}) => {
10
- return render(KvCommentsListItem, { props });
10
+ return render(KvCommentsListItem,
11
+ {
12
+ props,
13
+ // provide function for vue 2 testing
14
+ provide: {
15
+ fetchLenderInfo: () => Promise.resolve({}),
16
+ },
17
+ // provide function for vue 3 testing
18
+ global: {
19
+ provide: {
20
+ fetchLenderInfo: () => Promise.resolve({}),
21
+ },
22
+ },
23
+ });
11
24
  };
12
25
 
13
26
  describe('KvCommentsListItem', () => {
@@ -83,6 +83,8 @@ import {
83
83
  nextTick,
84
84
  computed,
85
85
  toRefs,
86
+ onMounted,
87
+ inject,
86
88
  } from 'vue-demi';
87
89
  import KvCommentsReplyButton from './KvCommentsReplyButton.vue';
88
90
  import KvCommentsHeartButton from './KvCommentsHeartButton.vue';
@@ -149,10 +151,14 @@ export default {
149
151
 
150
152
  const showInput = ref(false);
151
153
  const commentsAddRef = ref(null);
154
+ const authorInfo = ref();
152
155
 
153
156
  const commentText = computed(() => comment?.value?.data?.text ?? '');
154
- const authorImage = computed(() => comment?.value?.user?.data?.image ?? '');
155
- const authorName = computed(() => comment?.value?.user?.data?.name ?? '');
157
+
158
+ const authorId = computed(() => comment?.value?.user?.data?.publicLenderId ?? '');
159
+ const authorImage = computed(() => authorInfo?.value?.image?.url ?? '');
160
+ const authorName = computed(() => authorInfo?.value?.name ?? '');
161
+
156
162
  const childComments = computed(() => comment?.value?.latest_children?.comment ?? null);
157
163
  const childLikes = computed(() => comment?.value?.latest_children?.like ?? []);
158
164
  const likedObject = computed(() => childLikes.value.find((child) => child.user.data.publicLenderId === userPublicId.value)); // eslint-disable-line max-len
@@ -185,6 +191,15 @@ export default {
185
191
 
186
192
  const numberOfReplies = computed(() => comment?.value?.children_counts?.comment ?? 0);
187
193
 
194
+ const fetchLenderInfo = inject('fetchLenderInfo');
195
+
196
+ onMounted(async () => {
197
+ if (authorId.value) {
198
+ const authorData = await fetchLenderInfo(authorId.value);
199
+ authorInfo.value = authorData;
200
+ }
201
+ });
202
+
188
203
  return {
189
204
  hideInput,
190
205
  showInput,