@webitel/ui-sdk 2.0.10 → 2.0.11
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/dist/img/sprite/index.js +1 -1
- package/dist/img/sprite/task--accept.svg +4 -0
- package/dist/img/sprite/task--end.svg +4 -0
- package/dist/img/sprite/task.svg +5 -0
- package/dist/ui-sdk.common.js +19 -19
- package/dist/ui-sdk.common.js.map +1 -1
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.umd.js +19 -19
- package/dist/ui-sdk.umd.js.map +1 -1
- package/dist/ui-sdk.umd.min.js +1 -1
- package/dist/ui-sdk.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/wt-button/wt-button.vue +26 -2
- package/src/components/atoms/wt-icon/wt-icon.vue +5 -1
- package/src/css/components/atoms/wt-button/_variables.scss +4 -1
- package/src/css/styleguide/colors/_colors.scss +5 -0
- package/src/modules/Notifications/store/__tests__/{notifications.spec.js → NotificationsStoreModule.actions.spec.js} +27 -36
- package/src/modules/Notifications/store/__tests__/NotificationsStoreModule.mutations.spec.js +49 -0
package/package.json
CHANGED
|
@@ -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', 'task'],
|
|
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', 'task'].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
|
+
&.task {
|
|
163
|
+
color: var(--btn-light-font-color);
|
|
164
|
+
background-color: var(--btn-task-color);
|
|
165
|
+
border-color: var(--btn-task-color);
|
|
166
|
+
|
|
167
|
+
&:hover,
|
|
168
|
+
&:active {
|
|
169
|
+
background-color: var(--btn-task--hover-color);
|
|
170
|
+
border-color: var(--btn-task--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
|
+
&.task {
|
|
246
|
+
color: var(--btn-task-color);
|
|
247
|
+
border-color: var(--btn-task-color);
|
|
248
|
+
|
|
249
|
+
&:hover,
|
|
250
|
+
&:active {
|
|
251
|
+
color: var(--btn-task--hover-color);
|
|
252
|
+
border-color: var(--btn-task--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', 'task', '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
|
+
&-task .wt-icon__icon {
|
|
101
|
+
fill: var(--task-color);
|
|
102
|
+
}
|
|
103
|
+
|
|
100
104
|
&-hold .wt-icon__icon {
|
|
101
105
|
fill: var(--icon-color-hold);
|
|
102
106
|
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
--_hold-color-hue: 54;
|
|
11
11
|
--_transfer-color-hue: 227;
|
|
12
|
+
--_task-color-hue: 227;
|
|
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
|
+
--_task-color: var(--_task-color-hue), 80%, 50%;
|
|
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
|
+
--task-color: hsla(var(--_task-color), var(--_opacity--default));
|
|
84
|
+
--task--hover-color: hsla(var(--_task-color), var(--_opacity--hover));
|
|
85
|
+
|
|
81
86
|
// SUBORDINATE COLORS
|
|
82
87
|
--tag-bg-color: var(--accent-secondary-color);
|
|
83
88
|
|
|
@@ -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
|
|
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
|
+
});
|