@weni/unnnic-system 3.1.4-alpha.2 → 3.1.4-alpha.3

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.1.4-alpha.2",
3
+ "version": "3.1.4-alpha.3",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -3,6 +3,7 @@
3
3
  class="unnnic-chats-message"
4
4
  :class="{
5
5
  sent: type === 'sent',
6
+ automatic: automatic,
6
7
  sending: status === 'sending',
7
8
  'is-document': isDocument,
8
9
  'is-media': isMedia,
@@ -45,7 +46,9 @@
45
46
  />
46
47
  <UnnnicChatsMessageText
47
48
  v-if="isText"
49
+ :locale="locale"
48
50
  :text="slotText"
51
+ :isAutomatic="automatic"
49
52
  />
50
53
  <div
51
54
  v-if="isDocument"
@@ -156,6 +159,10 @@ export default {
156
159
  },
157
160
  mixins: [UnnnicI18n],
158
161
  props: {
162
+ locale: {
163
+ type: String,
164
+ default: 'en',
165
+ },
159
166
  enableReply: {
160
167
  type: Boolean,
161
168
  default: false,
@@ -171,6 +178,10 @@ export default {
171
178
  return ['received', 'sent'].includes(type);
172
179
  },
173
180
  },
181
+ automatic: {
182
+ type: Boolean,
183
+ default: false,
184
+ },
174
185
  time: {
175
186
  type: Date,
176
187
  required: true,
@@ -323,6 +334,10 @@ $defaultLineHeight: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
323
334
 
324
335
  &.sent {
325
336
  background-color: #cff8f4;
337
+
338
+ &.automatic {
339
+ background-color: $unnnic-color-aux-blue-50;
340
+ }
326
341
  }
327
342
 
328
343
  &.sending {
@@ -1,18 +1,45 @@
1
1
  <template>
2
- <p
3
- class="unnnic-chats-message__text"
4
- v-html="formattedText"
5
- />
2
+ <section class="unnnic-chats-message__text__container">
3
+ <p
4
+ class="unnnic-chats-message__text"
5
+ v-html="formattedText"
6
+ />
7
+ <p v-if="isAutomatic" class="unnnic-chats-message__text--automatic">
8
+ {{ i18n('automatic_message') }}
9
+ </p>
10
+ </section>
6
11
  </template>
7
12
 
8
13
  <script>
14
+ import UnnnicI18n from '../../mixins/i18n';
15
+
9
16
  export default {
10
17
  name: 'ChatsMessageText',
18
+ mixins: [UnnnicI18n],
11
19
  props: {
20
+ locale: {
21
+ type: String,
22
+ default: 'en',
23
+ },
12
24
  text: {
13
25
  type: String,
14
26
  required: true,
15
27
  },
28
+ isAutomatic: {
29
+ type: Boolean,
30
+ default: false,
31
+ },
32
+ },
33
+ data() {
34
+ return {
35
+ defaultTranslations: {
36
+ automatic_message: {
37
+ 'pt-br': 'Mensagem de abertura automática',
38
+ en: 'Automatic Opening Message',
39
+ es: 'Mensaje de apertura automático',
40
+ },
41
+ },
42
+ };
16
43
  },
17
44
  computed: {
18
45
  formattedText() {
@@ -78,3 +105,30 @@ export default {
78
105
  },
79
106
  };
80
107
  </script>
108
+
109
+ <style lang="scss" scoped>
110
+ @use '@/assets/scss/unnnic' as *;
111
+
112
+ * {
113
+ padding: 0;
114
+ margin: 0;
115
+ }
116
+
117
+ .unnnic-chats-message__text {
118
+ &__container {
119
+ display: flex;
120
+ flex-direction: column;
121
+ gap: $unnnic-spacing-sm;
122
+ padding: $unnnic-spacing-nano 0;
123
+ font-size: $unnnic-font-size-body-gt;
124
+ color: $unnnic-color-neutral-dark;
125
+ line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
126
+ word-break: break-word;
127
+ }
128
+ &--automatic {
129
+ font-size: $unnnic-font-size-body-md;
130
+ line-height: $unnnic-line-height-caption-1;
131
+ color: $unnnic-color-aux-blue-500;
132
+ }
133
+ }
134
+ </style>
@@ -9,7 +9,10 @@
9
9
  :data="emojiIndex"
10
10
  set="apple"
11
11
  theme="light"
12
- :preview="false"
12
+ emoji="point_up"
13
+ :title="title"
14
+ :showPreview="true"
15
+ showSkinTones
13
16
  :search="true"
14
17
  nav-position="bottom"
15
18
  no-results-emoji="cry"
@@ -26,7 +29,7 @@ import { computed, ref, onMounted, onUnmounted } from 'vue'
26
29
  import { get } from 'lodash'
27
30
  import i18n from '../../utils/plugins/i18n'
28
31
  import { Picker, EmojiIndex } from 'emoji-mart-vue-fast/src'
29
- import data from 'emoji-mart-vue-fast/data/apple.json'
32
+ import data from 'emoji-mart-vue-fast/data/all.json'
30
33
  import 'emoji-mart-vue-fast/css/emoji-mart.css'
31
34
  import UnnnicI18n from '../../mixins/i18n'
32
35
 
@@ -71,6 +74,8 @@ const translation = (key: string) => {
71
74
  return get(localeMsgs, key) || get(enMsgs, key) || key
72
75
  }
73
76
 
77
+ const title = computed(() => translation('emoji_picker.title'))
78
+
74
79
  const translations = computed(() => ({
75
80
  search: translation('emoji_picker.search'),
76
81
  notfound: translation('emoji_picker.notfound'),
@@ -158,7 +163,7 @@ const onEmojiSelect = (emoji: Emoji) => {
158
163
  }
159
164
 
160
165
  :deep(.emoji-type-image.emoji-set-apple) {
161
- background-image: url('/apple-64.png') !important;
166
+ background-image: url('./apple-64.png') !important;
162
167
  }
163
168
 
164
169
  :deep(.emoji-type-image.emoji-set-facebook),
@@ -12,7 +12,7 @@ vi.mock('emoji-mart-vue-fast/src', () => ({
12
12
  EmojiIndex: vi.fn().mockImplementation(() => ({}))
13
13
  }));
14
14
 
15
- vi.mock('emoji-mart-vue-fast/data/apple.json', () => ({
15
+ vi.mock('emoji-mart-vue-fast/data/all.json', () => ({
16
16
  default: {}
17
17
  }));
18
18
 
@@ -50,7 +50,7 @@ describe('UnnnicEmojiPicker', () => {
50
50
  stubs: {
51
51
  Picker: {
52
52
  name: 'Picker',
53
- props: ['data', 'set', 'theme', 'preview', 'search', 'navPosition', 'noResultsEmoji', 'maxFrequentRows', 'i18n', 'color'],
53
+ props: ['data', 'set', 'theme', 'emoji', 'title', 'showPreview', 'search', 'navPosition', 'noResultsEmoji', 'maxFrequentRows', 'i18n', 'color'],
54
54
  emits: ['select', 'click-outside'],
55
55
  template: '<div class="emoji-mart-picker" @select="$emit(\'select\', $event)" @click-outside="$emit(\'click-outside\')"></div>'
56
56
  }
@@ -69,7 +69,9 @@ describe('UnnnicEmojiPicker', () => {
69
69
  expect(picker.exists()).toBe(true);
70
70
  expect(picker.props('set')).toBe('apple');
71
71
  expect(picker.props('theme')).toBe('light');
72
- expect(picker.props('preview')).toBe(false);
72
+ expect(picker.props('emoji')).toBe('point_up');
73
+ expect(picker.props('title')).toBe('Escolha seu emoji...');
74
+ expect(picker.props('showPreview')).toBe(true);
73
75
  expect(picker.props('search')).toBe(true);
74
76
  expect(picker.props('navPosition')).toBe('bottom');
75
77
  expect(picker.props('noResultsEmoji')).toBe('cry');
@@ -94,7 +96,7 @@ describe('UnnnicEmojiPicker', () => {
94
96
  stubs: {
95
97
  Picker: {
96
98
  name: 'Picker',
97
- props: ['data', 'set', 'theme', 'preview', 'search', 'navPosition', 'noResultsEmoji', 'maxFrequentRows', 'i18n', 'color'],
99
+ props: ['data', 'set', 'theme', 'emoji', 'title', 'showPreview', 'search', 'navPosition', 'noResultsEmoji', 'maxFrequentRows', 'i18n', 'color'],
98
100
  emits: ['select', 'click-outside'],
99
101
  template: '<div class="emoji-mart-picker" @select="$emit(\'select\', $event)"></div>'
100
102
  }
@@ -131,7 +133,7 @@ describe('UnnnicEmojiPicker', () => {
131
133
  it('renders bottom position class when position is bottom', async () => {
132
134
  const custom = mount(UnnnicEmojiPicker, {
133
135
  props: { position: 'bottom' },
134
- global: { stubs: { Picker: { name: 'Picker', props: ['data','set','theme','preview','search','navPosition','noResultsEmoji','maxFrequentRows','i18n','color'], template: '<div />' } } }
136
+ global: { stubs: { Picker: { name: 'Picker', props: ['data','set','theme','emoji','title','showPreview','search','navPosition','noResultsEmoji','maxFrequentRows','i18n','color'], template: '<div />' } } }
135
137
  });
136
138
  expect(custom.classes()).toContain('emoji-picker--bottom');
137
139
  custom.unmount();
@@ -24,6 +24,7 @@
24
24
  }
25
25
  },
26
26
  "emoji_picker": {
27
+ "title": "Pick your emoji...",
27
28
  "search": "Search",
28
29
  "notfound": "No Emoji Found",
29
30
  "categories": {
@@ -24,6 +24,7 @@
24
24
  }
25
25
  },
26
26
  "emoji_picker": {
27
+ "title": "Elige tu emoji...",
27
28
  "search": "Buscar",
28
29
  "notfound": "No se encontró ningún emoji",
29
30
  "categories": {
@@ -24,6 +24,7 @@
24
24
  }
25
25
  },
26
26
  "emoji_picker": {
27
+ "title": "Escolha seu emoji...",
27
28
  "search": "Buscar",
28
29
  "notfound": "Nenhum emoji encontrado",
29
30
  "categories": {