@webitel/ui-chats 26.8.6 → 26.8.8

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-chats",
3
- "version": "26.8.6",
3
+ "version": "26.8.8",
4
4
  "description": "Reusable Webitel Frontend Code for Chats UI",
5
5
  "workspaces": [
6
6
  "../../",
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "@biomejs/biome": "2.4.16",
32
32
  "@types/node": "^24.10.0",
33
- "@webitel/chat-web-sdk": "^0.0.19",
33
+ "@webitel/chat-web-sdk": "~0.0.19",
34
34
  "@vitejs/plugin-vue": "^6.0.1",
35
35
  "@vue/tsconfig": "^0.8.1",
36
36
  "mitt": "^3",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@webitel/api-services": "~26.8",
45
- "@webitel/chat-web-sdk": "^0.0.19",
45
+ "@webitel/chat-web-sdk": "~0.0.19",
46
46
  "@webitel/styleguide": "~26.8",
47
47
  "@webitel/ui-sdk": "~26.8",
48
48
  "mitt": "^3",
@@ -331,4 +331,23 @@ describe('ChatHistory', () => {
331
331
  wrapper.find('.chat-history__sentinel').findAll('.wt-loader'),
332
332
  ).toHaveLength(0);
333
333
  });
334
+ it('renders the history-end slot after the last message, inside the scroller', () => {
335
+ const wrapper = mountWithChats(ChatHistory, {
336
+ props: {
337
+ thread: thread(),
338
+ messages: [
339
+ message(),
340
+ ],
341
+ selfMemberId: operator.id,
342
+ },
343
+ slots: {
344
+ 'history-end': '<button class="snooze" />',
345
+ },
346
+ });
347
+ const content = wrapper.find('.chat-history__content');
348
+ const last = content.element.lastElementChild;
349
+ expect(last?.querySelector('.snooze')).not.toBeNull();
350
+ // not an entry: the scroll anchor and the seen tracking skip it
351
+ expect(last?.classList.contains('chat-history__entry')).toBe(false);
352
+ });
334
353
  });
@@ -52,6 +52,15 @@
52
52
  >
53
53
  {{ t('history.waitingForOperator') }}
54
54
  </div>
55
+
56
+ <!-- after the newest message and scrolled with it; not an entry, so
57
+ neither the scroll anchor nor the seen tracking counts it -->
58
+ <div
59
+ v-if="slots['history-end']"
60
+ class="chat-history__end"
61
+ >
62
+ <slot name="history-end" />
63
+ </div>
55
64
  </div>
56
65
  </div>
57
66
 
@@ -109,6 +118,10 @@ const emit = defineEmits<{
109
118
  ];
110
119
  }>();
111
120
 
121
+ const slots = defineSlots<{
122
+ 'history-end'?: () => unknown;
123
+ }>();
124
+
112
125
  const { t } = useChatsV2I18n();
113
126
 
114
127
  const scrollContainer = useTemplateRef<HTMLElement>('scroll-container');
@@ -245,6 +258,11 @@ watch(
245
258
  min-height: calc(var(--spacing-lg) * 2 + var(--icon-md-size));
246
259
  }
247
260
 
261
+ .chat-history__end {
262
+ display: flex;
263
+ justify-content: center;
264
+ }
265
+
248
266
  .chat-history__awaiting {
249
267
  display: flex;
250
268
  align-items: center;
@@ -119,4 +119,17 @@ describe('ChatThread', () => {
119
119
  });
120
120
  expect(wrapper.find('.chat-composer .quick-reply').exists()).toBe(true);
121
121
  });
122
+ it('forwards the history-end slot to the history', () => {
123
+ const wrapper = mountWithChats(ChatThread, {
124
+ props: {
125
+ thread: thread(),
126
+ messages: [],
127
+ selfMemberId: operator.id,
128
+ },
129
+ slots: {
130
+ 'history-end': '<button class="snooze" />',
131
+ },
132
+ });
133
+ expect(wrapper.find('.chat-history .snooze').exists()).toBe(true);
134
+ });
122
135
  });
@@ -10,7 +10,14 @@
10
10
  :on-load-more="props.onLoadMore"
11
11
  :resolve-avatar-url="props.resolveAvatarUrl"
12
12
  @seen="emit('seen', $event)"
13
- />
13
+ >
14
+ <template
15
+ v-if="slots['history-end']"
16
+ #history-end
17
+ >
18
+ <slot name="history-end" />
19
+ </template>
20
+ </chat-history>
14
21
  <!-- keyed by thread: switching chats drops the draft and any pending state -->
15
22
  <chat-composer
16
23
  v-if="props.mode === ChatThreadMode.Active"
@@ -68,8 +75,9 @@ const emit = defineEmits<{
68
75
  ];
69
76
  }>();
70
77
 
71
- defineSlots<{
78
+ const slots = defineSlots<{
72
79
  actions?: (props: ChatComposerSlotProps) => unknown;
80
+ 'history-end'?: () => unknown;
73
81
  }>();
74
82
 
75
83
  const instance = getCurrentInstance();