@weni/unnnic-system 3.25.5 → 3.25.6

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": "@weni/unnnic-system",
3
- "version": "3.25.5",
3
+ "version": "3.25.6",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -106,6 +106,20 @@
106
106
  <section
107
107
  class="chats-contact__infos__unread-messages-container__pin-container"
108
108
  >
109
+ <UnnnicTooltip
110
+ v-if="pendingResponse"
111
+ class="chats-contact__infos__pending-response"
112
+ :enabled="!!pendingResponseTooltip"
113
+ :text="pendingResponseTooltip"
114
+ side="top"
115
+ >
116
+ <UnnnicIcon
117
+ icon="reply"
118
+ size="sm"
119
+ scheme="fg-info"
120
+ data-testid="pending-response-icon"
121
+ />
122
+ </UnnnicTooltip>
109
123
  <button
110
124
  v-if="isRenderPin"
111
125
  data-testid="pin-button"
@@ -148,6 +162,7 @@ import UnnnicIcon from '../Icon.vue';
148
162
  import TransitionRipple from '../TransitionRipple/TransitionRipple.vue';
149
163
  import UnnnicI18n from '../../mixins/i18n';
150
164
  import Checkbox from '../Checkbox/Checkbox.vue';
165
+ import UnnnicTooltip from '../ToolTip/ToolTip.vue';
151
166
 
152
167
  import('moment/dist/locale/es.js');
153
168
  import('moment/dist/locale/pt-br.js');
@@ -162,6 +177,7 @@ export default {
162
177
  UnnnicIcon,
163
178
  TransitionRipple,
164
179
  Checkbox,
180
+ UnnnicTooltip,
165
181
  },
166
182
 
167
183
  mixins: [UnnnicI18n],
@@ -235,6 +251,14 @@ export default {
235
251
  type: String,
236
252
  default: ' fg-base',
237
253
  },
254
+ pendingResponse: {
255
+ type: Boolean,
256
+ default: false,
257
+ },
258
+ pendingResponseTooltip: {
259
+ type: String,
260
+ default: '',
261
+ },
238
262
  },
239
263
 
240
264
  emits: ['click', 'clickPin'],
@@ -547,6 +571,11 @@ export default {
547
571
  color: $unnnic-color-fg-muted;
548
572
  }
549
573
 
574
+ &__pending-response {
575
+ display: flex;
576
+ align-items: center;
577
+ }
578
+
550
579
  &__unread-messages-container {
551
580
  height: 100%;
552
581
  min-width: max-content;
@@ -560,6 +589,7 @@ export default {
560
589
  &__pin-container {
561
590
  display: flex;
562
591
  align-items: center;
592
+ gap: $unnnic-space-1;
563
593
  position: relative;
564
594
  z-index: 10;
565
595
  }
@@ -1,4 +1,4 @@
1
- import { beforeEach, describe, expect, afterEach, test, vi } from 'vitest';
1
+ import { beforeEach, describe, expect, afterEach, it, vi } from 'vitest';
2
2
  import { mount } from '@vue/test-utils';
3
3
 
4
4
  import UnnnicChatsContact from '../ChatsContact.vue';
@@ -258,4 +258,48 @@ describe('UnnnicChatsContact', () => {
258
258
  expect(pinElement.exists()).toBe(false);
259
259
  });
260
260
  });
261
+
262
+ describe('Pending response', () => {
263
+ it('should not render the pending response icon by default', () => {
264
+ const icon = wrapper.find('[data-testid="pending-response-icon"]');
265
+ expect(icon.exists()).toBe(false);
266
+ });
267
+
268
+ it('should render the pending response icon when pendingResponse is true', async () => {
269
+ await wrapper.setProps({ pendingResponse: true });
270
+
271
+ const icon = wrapper.findComponent(
272
+ '[data-testid="pending-response-icon"]',
273
+ );
274
+ expect(icon.exists()).toBe(true);
275
+ expect(icon.props('icon')).toBe('reply');
276
+ expect(icon.props('scheme')).toBe('fg-info');
277
+ });
278
+
279
+ it('should keep tooltip disabled when pendingResponseTooltip is empty', async () => {
280
+ await wrapper.setProps({
281
+ pendingResponse: true,
282
+ pendingResponseTooltip: '',
283
+ });
284
+
285
+ const tooltip = wrapper.findComponent({ name: 'UnnnicTooltip' });
286
+ expect(tooltip.exists()).toBe(true);
287
+ expect(tooltip.props('enabled')).toBe(false);
288
+ expect(tooltip.props('text')).toBe('');
289
+ });
290
+
291
+ it('should enable tooltip with the provided text when pendingResponseTooltip is set', async () => {
292
+ const tooltipText = 'You did not respond to this contact';
293
+
294
+ await wrapper.setProps({
295
+ pendingResponse: true,
296
+ pendingResponseTooltip: tooltipText,
297
+ });
298
+
299
+ const tooltip = wrapper.findComponent({ name: 'UnnnicTooltip' });
300
+ expect(tooltip.exists()).toBe(true);
301
+ expect(tooltip.props('enabled')).toBe(true);
302
+ expect(tooltip.props('text')).toBe(tooltipText);
303
+ });
304
+ });
261
305
  });
@@ -16,6 +16,7 @@ exports[`UnnnicChatsContact > should match snapshot 1`] = `
16
16
  <!--v-if-->
17
17
  <section data-v-8ce6efd5="" class="chats-contact__infos__unread-messages-container__pin-container">
18
18
  <!--v-if-->
19
+ <!--v-if-->
19
20
  </section>
20
21
  </section>
21
22
  <transition-group-stub data-v-17112bed="" data-v-8ce6efd5="" name="grow" tag="div" appear="false" persisted="false" css="true" class="ripples"></transition-group-stub>
@@ -135,6 +135,36 @@ export const Discussion = {
135
135
  },
136
136
  };
137
137
 
138
+ export const PendingResponse = {
139
+ args: {
140
+ ...defaultArgs,
141
+ title: 'Aline',
142
+ projectName: 'Sector name',
143
+ lastMessage: {
144
+ text: 'I’d like to know if powdered dishwasher detergent is available',
145
+ },
146
+ lastInteractionTime: new Date().toISOString(),
147
+ pendingResponse: true,
148
+ pendingResponseTooltip: 'You did not respond to this contact',
149
+ },
150
+ };
151
+
152
+ export const PendingResponsePinned = {
153
+ args: {
154
+ ...defaultArgs,
155
+ title: 'Milena',
156
+ projectName: 'Sector name',
157
+ lastMessage: {
158
+ text: 'Okay, I’ll wait for a response regarding the order status',
159
+ },
160
+ lastInteractionTime: new Date().toISOString(),
161
+ pendingResponse: true,
162
+ pendingResponseTooltip: 'You did not respond to this contact',
163
+ pinned: true,
164
+ activePin: true,
165
+ },
166
+ };
167
+
138
168
  export const ContactList = {
139
169
  args: {
140
170
  ...defaultArgs,