@webitel/ui-chats 0.1.25 → 0.1.27

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": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "Reusable Webitel Frontend Code for Chats UI",
5
5
  "workspaces": [
6
6
  "../../",
@@ -19,6 +19,7 @@
19
19
  v-for="(message, index) of props.messages"
20
20
  :key="message.id"
21
21
  :message="message"
22
+ :agent-name="props.agentName"
22
23
  :show-avatar="showAvatar(index)"
23
24
  :without-avatars="props.withoutAvatars"
24
25
  @[MessageAction.ClickOnImage]="clickOnImage(message)"
@@ -72,6 +73,7 @@ const props = withDefaults(
72
73
  next?: boolean;
73
74
  isLoading?: boolean;
74
75
  withoutAvatars?: boolean;
76
+ agentName?: string;
75
77
  }>(),
76
78
  {
77
79
  next: false,
@@ -15,7 +15,7 @@
15
15
  >
16
16
  <wt-avatar
17
17
  v-if="props.showAvatar"
18
- :username="username"
18
+ :username="getClientUsername"
19
19
  :size="ComponentSize.SM || size"
20
20
  :bot="isBot"
21
21
  />
@@ -80,6 +80,7 @@ const props = withDefaults(
80
80
  showAvatar?: boolean;
81
81
  withoutAvatars?: boolean;
82
82
  username?: string;
83
+ agentName?: string;
83
84
  }>(),
84
85
  {
85
86
  showAvatar: false,
@@ -106,6 +107,12 @@ const isSelfSide = computed<boolean>(
106
107
  );
107
108
  const isBot = computed<boolean>(() => props.message.member?.type === 'bot');
108
109
 
110
+ const getClientUsername = computed<string>(() => {
111
+ if (isSelfSide.value) return isSelfSide?.value;
112
+
113
+ return props.username || props.message.member?.name;
114
+ });
115
+
109
116
  function handlePlayerInitialize(player) {
110
117
  emit(MessageAction.InitializedPlayer, {
111
118
  player,
@@ -16,6 +16,7 @@
16
16
  :next="props.canLoadNextMessages"
17
17
  :is-loading="props.isNextMessagesLoading"
18
18
  :without-avatars="props.withoutAvatars"
19
+ :agent-name="props.agentName"
19
20
  @[ChatAction.LoadNextMessages]="emit(ChatAction.LoadNextMessages)"
20
21
  />
21
22
  </slot>
@@ -79,6 +80,7 @@ const props = withDefaults(
79
80
  isNextMessagesLoading?: boolean;
80
81
  withoutAvatars?: boolean;
81
82
  readonly?: boolean; // hide chat footer with textarea and action-buttons
83
+ agentName?: string;
82
84
  }>(),
83
85
  {
84
86
  size: ComponentSize.MD,
@@ -4,6 +4,7 @@ type __VLS_Props = {
4
4
  next?: boolean;
5
5
  isLoading?: boolean;
6
6
  withoutAvatars?: boolean;
7
+ agentName?: string;
7
8
  };
8
9
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
9
10
  loadNextMessages: () => any;
@@ -4,6 +4,7 @@ type __VLS_Props = {
4
4
  showAvatar?: boolean;
5
5
  withoutAvatars?: boolean;
6
6
  username?: string;
7
+ agentName?: string;
7
8
  };
8
9
  declare var __VLS_1: {}, __VLS_52: {};
9
10
  type __VLS_Slots = {} & {