@webitel/ui-sdk 2.0.10 → 2.0.11-1

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-sdk",
3
- "version": "2.0.10",
3
+ "version": "2.0.11-1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -44,7 +44,7 @@
44
44
  "vue-observe-visibility": "^1.0.0",
45
45
  "vue-router": "^3.2.0",
46
46
  "vuejs-datepicker": "^1.6.2",
47
- "webitel-sdk": "^0.1.91"
47
+ "webitel-sdk": "^0.1.128"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@babel/eslint-parser": "^7.17.0",
@@ -32,7 +32,7 @@ export default {
32
32
  color: {
33
33
  type: String,
34
34
  default: 'accent',
35
- options: ['accent', 'secondary', 'success', 'danger', 'transfer'],
35
+ options: ['accent', 'secondary', 'success', 'danger', 'transfer', 'job'],
36
36
  },
37
37
  disabled: {
38
38
  type: Boolean,
@@ -71,7 +71,7 @@ export default {
71
71
  return '';
72
72
  },
73
73
  loaderColor() {
74
- if (['success', 'transfer', 'danger'].includes(this.color)) return 'main';
74
+ if (['success', 'transfer', 'danger', 'job'].includes(this.color)) return 'main';
75
75
  return 'contrast';
76
76
  },
77
77
  },
@@ -159,6 +159,18 @@ export default {
159
159
  }
160
160
  }
161
161
 
162
+ &.job {
163
+ color: var(--btn-light-font-color);
164
+ background-color: var(--btn-job-color);
165
+ border-color: var(--btn-job-color);
166
+
167
+ &:hover,
168
+ &:active {
169
+ background-color: var(--btn-job--hover-color);
170
+ border-color: var(--btn-job--hover-color);
171
+ }
172
+ }
173
+
162
174
  &.danger {
163
175
  color: var(--btn-light-font-color);
164
176
  background-color: var(--btn-false-color);
@@ -230,6 +242,18 @@ export default {
230
242
  }
231
243
  }
232
244
 
245
+ &.job {
246
+ color: var(--btn-job-color);
247
+ border-color: var(--btn-job-color);
248
+
249
+ &:hover,
250
+ &:active {
251
+ color: var(--btn-job--hover-color);
252
+ border-color: var(--btn-job--hover-color);
253
+ background-color: transparent;
254
+ }
255
+ }
256
+
233
257
  &.danger {
234
258
  color: var(--btn-false-color);
235
259
  border-color: var(--btn-false-color);
@@ -29,7 +29,7 @@ export default {
29
29
  color: {
30
30
  type: String,
31
31
  default: 'default',
32
- options: ['default', 'contrast', 'active', 'accent', 'disabled', 'success', 'danger', 'transfer', 'hold', 'secondary-50'],
32
+ options: ['default', 'contrast', 'active', 'accent', 'disabled', 'success', 'danger', 'transfer', 'job', 'hold', 'secondary-50'],
33
33
  },
34
34
  iconPrefix: {
35
35
  type: String,
@@ -97,6 +97,10 @@ svg {
97
97
  fill: var(--icon-color-transfer);
98
98
  }
99
99
 
100
+ &-job .wt-icon__icon {
101
+ fill: var(--job-color);
102
+ }
103
+
100
104
  &-hold .wt-icon__icon {
101
105
  fill: var(--icon-color-hold);
102
106
  }
@@ -41,4 +41,7 @@
41
41
 
42
42
  --btn-transfer-color: var(--transfer-color);
43
43
  --btn-transfer--hover-color: var(--transfer--hover-color);
44
- }
44
+
45
+ --btn-job-color: var(--job-color);
46
+ --btn-job--hover-color: var(--job--hover-color);
47
+ }
@@ -9,6 +9,7 @@
9
9
 
10
10
  --_hold-color-hue: 54;
11
11
  --_transfer-color-hue: 227;
12
+ --_job-color-hue: 209;
12
13
 
13
14
  // DEFAULT STATES OPACITY
14
15
  --_opacity--default: 0.8;
@@ -31,6 +32,7 @@
31
32
 
32
33
  --_hold-color: var(--_hold-color-hue), 80%, 50%;
33
34
  --_transfer-color: var(--_transfer-color-hue), 80%, 50%;
35
+ --_job-color: var(--_job-color-hue), 96%, 57%;
34
36
 
35
37
  // MAIN COLORS
36
38
  --accent-color: hsla(var(--_accent-color), 1);
@@ -78,6 +80,9 @@
78
80
  --transfer-color: hsla(var(--_transfer-color), var(--_opacity--default));
79
81
  --transfer--hover-color: hsla(var(--_transfer-color), var(--_opacity--hover));
80
82
 
83
+ --job-color: hsla(var(--_job-color), var(--_opacity--default));
84
+ --job--hover-color: hsla(var(--_job-color), var(--_opacity--hover));
85
+
81
86
  // SUBORDINATE COLORS
82
87
  --tag-bg-color: var(--accent-secondary-color);
83
88
 
@@ -1,4 +1,4 @@
1
- import { ChatActions, CallActions } from 'webitel-sdk';
1
+ import { ChatActions, CallActions, JobState } from 'webitel-sdk';
2
2
  import i18n from '../../../locale/i18n';
3
3
  import BaseStoreModule from '../../../store/BaseStoreModules/BaseStoreModule';
4
4
  import endChatSound from '../assets/audio/end-chat.wav';
@@ -12,6 +12,7 @@ const NOTIFICATION_VISIBLE_INTERVAL = 2000;
12
12
  const getNotificationSound = (action) => {
13
13
  switch (action) {
14
14
  case ChatActions.UserInvite:
15
+ case JobState.Distribute:
15
16
  return new Audio(newChatSound);
16
17
  case ChatActions.Message:
17
18
  return new Audio(newMessageSound);
@@ -1,4 +1,3 @@
1
- import { ChatActions } from 'webitel-sdk';
2
1
  import audio from '../../assets/audio/new-message.wav';
3
2
  import NotificationsStoreModule from '../NotificationsStoreModule';
4
3
  import '../../../../../tests/mocks/broadcastChannelMock';
@@ -13,8 +12,6 @@ const state = {
13
12
  wtIsPlaying: false,
14
13
  };
15
14
 
16
- const chat = { id: '1', messages: [{ member: { name: 'name' } }] };
17
-
18
15
  describe('features/notifications store: actions', () => {
19
16
  const context = {
20
17
  dispatch: jest.fn(),
@@ -44,11 +41,21 @@ describe('features/notifications store: actions', () => {
44
41
  expect(context.dispatch.mock.calls[1][0]).toContain('_SETUP_UNREAD_COUND_BROADCAST_LISTENING');
45
42
  });
46
43
 
47
- it('INITIALIZE action commits _SETUP_THIS_TAB_ID action', () => {
44
+ it('INITIALIZE action dispatches _SETUP_THIS_TAB_ID action', () => {
48
45
  notificationsModule.actions.INITIALIZE(context);
49
46
  expect(context.dispatch).toHaveBeenCalledWith('_SETUP_THIS_TAB_ID');
50
47
  });
51
48
 
49
+ it('DESTROY action dispatches STOP_SOUND action', () => {
50
+ notificationsModule.actions.DESTROY(context);
51
+ expect(context.dispatch).toHaveBeenCalledWith('STOP_SOUND');
52
+ });
53
+
54
+ it('DESTROY action dispatches _REMOVE_CURRENT_TAB_ID action', () => {
55
+ notificationsModule.actions.DESTROY(context);
56
+ expect(context.dispatch).toHaveBeenCalledWith('_REMOVE_CURRENT_TAB_ID');
57
+ });
58
+
52
59
  it('INCREMENT_UNREAD_COUNT action dispatches _SET_UNREAD_COUNT and increases unreadCount', () => {
53
60
  notificationsModule.actions.INCREMENT_UNREAD_COUNT(context);
54
61
  expect(context.dispatch).toHaveBeenCalledWith('_SET_UNREAD_COUNT', context.state.unreadCount + 1);
@@ -59,6 +66,12 @@ describe('features/notifications store: actions', () => {
59
66
  expect(context.commit.mock.calls[0][0]).toContain('SET_BROADCAST_CHANNEL');
60
67
  });
61
68
 
69
+ it('_SUBSCRIBE_TAB_CLOSING action commits SET_CURRENT_TAB_ID mutation', async () => {
70
+ await notificationsModule.actions._SUBSCRIBE_TAB_CLOSING(context);
71
+ window.dispatchEvent(new Event('storage'));
72
+ expect(context.commit).toHaveBeenCalledWith('SET_CURRENT_TAB_ID', 'null');
73
+ });
74
+
62
75
  it('PLAY_SOUND action commits SET_CURRENTLY_PLAIYNG mutation with sound', async () => {
63
76
  const sound = new Audio(audio);
64
77
  await notificationsModule.actions.PLAY_SOUND(context, { sound });
@@ -71,6 +84,16 @@ describe('features/notifications store: actions', () => {
71
84
  expect(context.dispatch).toHaveBeenCalledWith('_SET_TAB_TITLE');
72
85
  });
73
86
 
87
+ it('_SETUP_THIS_TAB_ID commits SET_THIS_TAB_ID mutation', () => {
88
+ notificationsModule.actions._SETUP_THIS_TAB_ID(context);
89
+ expect(context.commit.mock.calls[0][0]).toBe('SET_THIS_TAB_ID');
90
+ });
91
+
92
+ it('_SETUP_THIS_TAB_ID commits SET_CURRENT_TAB_ID mutation', () => {
93
+ notificationsModule.actions._SETUP_THIS_TAB_ID(context);
94
+ expect(context.commit.mock.calls[1][0]).toBe('SET_CURRENT_TAB_ID');
95
+ });
96
+
74
97
  it('_SET_UNREAD_COUNT action commits _SET_UNREAD_COUNT mutation with count', () => {
75
98
  const unreadCount = 5;
76
99
  notificationsModule.actions._SET_UNREAD_COUNT(context, unreadCount);
@@ -105,35 +128,3 @@ describe('features/notifications store: actions', () => {
105
128
  expect(localStorage.getItem('wtIsPlaying')).toBeFalsy();
106
129
  });
107
130
  });
108
-
109
- describe('features/notifications store: mutations', () => {
110
- it('SET_THIS_TAB_ID sets window id to state', () => {
111
- const thisTabId = 'thisTabId';
112
- notificationsModule.mutations.SET_THIS_TAB_ID(state, thisTabId);
113
- expect(state.thisTabId).toBe(thisTabId);
114
- });
115
-
116
- it('SET_BROADCAST_CHANNEL sets broadcastChannel to state', () => {
117
- const state = { broadcastChannel: null };
118
- const channel = new BroadcastChannel('test channel');
119
- notificationsModule.mutations.SET_BROADCAST_CHANNEL(state, channel);
120
- expect(state.broadcastChannel).toEqual(channel);
121
- });
122
-
123
- it('SET_CURRENTLY_PLAIYNG mutation sets currentlyPlaying to state', () => {
124
- const wtIsPlaying = true;
125
- notificationsModule.mutations.SET_CURRENTLY_PLAYING(state, wtIsPlaying);
126
- expect(state.currentlyPlaying).toBe(true);
127
- });
128
-
129
- it('RESET_CURRENTLY_PLAYING mutation sets currentlyPlaying to false in state', () => {
130
- notificationsModule.mutations.RESET_CURRENTLY_PLAYING(state);
131
- expect(state.currentlyPlaying).toBe(false);
132
- });
133
-
134
- it('_SET_UNREAD_COUNT mutation sets unreadCount to state', () => {
135
- const unreadCount = 15;
136
- notificationsModule.mutations.SET_UNREAD_COUNT(state, unreadCount);
137
- expect(state.unreadCount).toEqual(unreadCount);
138
- });
139
- });
@@ -0,0 +1,49 @@
1
+ import NotificationsStoreModule from '../NotificationsStoreModule';
2
+ import '../../../../../tests/mocks/broadcastChannelMock';
3
+
4
+ const notificationsModule = new NotificationsStoreModule().getModule();
5
+
6
+ const state = {
7
+ thisTabId: null,
8
+ broadcastChannel: new BroadcastChannel('WtAppNotifications'),
9
+ unreadCount: 0,
10
+ currentlyPlaying: false,
11
+ wtIsPlaying: false,
12
+ };
13
+
14
+ describe('features/notifications store: mutations', () => {
15
+ it('SET_THIS_TAB_ID sets thisTabId to state', () => {
16
+ const thisTabId = 'thisTabId';
17
+ notificationsModule.mutations.SET_THIS_TAB_ID(state, thisTabId);
18
+ expect(state.thisTabId).toBe(thisTabId);
19
+ });
20
+ it('SET_CURRENT_TAB_ID sets currentTabId to state', () => {
21
+ const currentTabId = 'currentTabId';
22
+ notificationsModule.mutations.SET_CURRENT_TAB_ID(state, currentTabId);
23
+ expect(state.currentTabId).toBe(currentTabId);
24
+ });
25
+
26
+ it('SET_BROADCAST_CHANNEL sets broadcastChannel to state', () => {
27
+ const state = { broadcastChannel: null };
28
+ const channel = new BroadcastChannel('test channel');
29
+ notificationsModule.mutations.SET_BROADCAST_CHANNEL(state, channel);
30
+ expect(state.broadcastChannel).toEqual(channel);
31
+ });
32
+
33
+ it('SET_CURRENTLY_PLAIYNG mutation sets currentlyPlaying to state', () => {
34
+ const wtIsPlaying = true;
35
+ notificationsModule.mutations.SET_CURRENTLY_PLAYING(state, wtIsPlaying);
36
+ expect(state.currentlyPlaying).toBe(true);
37
+ });
38
+
39
+ it('RESET_CURRENTLY_PLAYING mutation sets currentlyPlaying to false in state', () => {
40
+ notificationsModule.mutations.RESET_CURRENTLY_PLAYING(state);
41
+ expect(state.currentlyPlaying).toBe(false);
42
+ });
43
+
44
+ it('_SET_UNREAD_COUNT mutation sets unreadCount to state', () => {
45
+ const unreadCount = 15;
46
+ notificationsModule.mutations.SET_UNREAD_COUNT(state, unreadCount);
47
+ expect(state.unreadCount).toEqual(unreadCount);
48
+ });
49
+ });