@webitel/ui-sdk 24.10.3 → 24.10.5
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/ui-sdk.css +1 -1
- package/dist/ui-sdk.js +111 -114
- package/dist/ui-sdk.umd.cjs +8 -8
- package/package.json +6 -4
- package/src/api/axios/generateInstance.js +1 -4
- package/src/api/clients/agents/agents.js +31 -78
- package/src/api/clients/buckets/buckets.js +17 -57
- package/src/api/clients/calendars/calendars.js +18 -71
- package/src/api/clients/chatGateways/chatGateways.js +23 -61
- package/src/api/clients/chatGateways/defaults/webChatGateway.js +6 -8
- package/src/api/clients/chatGateways/enums/WebchatAlternativeChannel.enum.js +3 -3
- package/src/api/clients/communications/communications.js +20 -62
- package/src/api/clients/configurations/configurations.js +18 -3
- package/src/api/clients/flows/flow.js +17 -60
- package/src/api/clients/gateways/gateways.js +20 -59
- package/src/api/clients/index.js +1 -1
- package/src/api/clients/lists/blacklists.js +18 -60
- package/src/api/clients/media/media.js +13 -43
- package/src/api/clients/queues/defaults/processing.js +10 -6
- package/src/api/clients/queues/queues.js +21 -69
- package/src/api/clients/roles/roles.js +15 -33
- package/src/api/clients/users/__tests__/users.spec.js +43 -26
- package/src/api/clients/users/users.js +21 -56
- package/src/api/crm/contactChatMessagesHistory.js +8 -23
- package/src/api/crm/contacts.js +235 -0
- package/src/api/crm/enums/ContactsSearchMode.js +9 -0
- package/src/api/crm/index.js +2 -3
- package/src/api/defaults/getDefaultGetParams/getDefaultGetParams.js +1 -4
- package/src/api/defaults/getDefaultInstance/getDefaultInstance.js +10 -11
- package/src/api/defaults/getDefaultOpenAPIConfig/getDefaultOpenAPIConfig.js +6 -5
- package/src/api/defaults/index.js +2 -4
- package/src/api/history/index.js +1 -3
- package/src/api/history/transcript/callTranscript.js +10 -30
- package/src/api/interceptors/request/updateToken.interceptor.js +1 -2
- package/src/api/transformers/merge/merge.transformer.js +4 -1
- package/src/api/transformers/mergeEach/mergeEach.transformer.js +4 -4
- package/src/api/transformers/notify/notify.transformer.js +9 -6
- package/src/api/transformers/starToSearch/starToSearch.transformer.js +8 -6
- package/src/components/index.js +3 -6
- package/src/components/on-demand/wt-cc-agent-status-timers/__tests__/wt-cc-agent-status-timers.spec.js +2 -4
- package/src/components/transitions/wt-expand-transition.vue +2 -3
- package/src/components/wt-app-header/__tests__/WtAppNavigator.spec.js +1 -2
- package/src/components/wt-app-header/__tests__/WtHeaderActions.spec.js +1 -2
- package/src/components/wt-app-header/wt-app-navigator.vue +15 -9
- package/src/components/wt-avatar/wt-avatar.vue +8 -3
- package/src/components/wt-button/wt-button.vue +0 -1
- package/src/components/wt-button-select/__tests__/WtButtonSelect.spec.js +4 -5
- package/src/components/wt-button-select/wt-button-select.vue +0 -1
- package/src/components/wt-context-menu/wt-context-menu.vue +32 -35
- package/src/components/wt-dummy/wt-dummy.vue +2 -5
- package/src/components/wt-expansion-panel/wt-expansion-panel.vue +10 -7
- package/src/components/wt-filters-panel-wrapper/__tests__/WtFiltersPanelWrapper.spec.js +4 -8
- package/src/components/wt-icon/wt-icon.vue +0 -1
- package/src/components/wt-indicator/__tests__/WtIndicator.spec.js +3 -2
- package/src/components/wt-indicator/wt-indicator.vue +10 -1
- package/src/components/wt-input/wt-input.vue +7 -10
- package/src/components/wt-item-link/wt-item-link.vue +7 -4
- package/src/components/wt-navigation-bar/__tests__/WtNavigationBar.spec.js +7 -15
- package/src/components/wt-navigation-bar/wt-navigation-bar.vue +7 -7
- package/src/components/wt-notification/wt-notification.vue +1 -2
- package/src/components/wt-notifications-bar/__tests__/WtNotificationsBar.spec.js +6 -3
- package/src/components/wt-notifications-bar/wt-notifications-bar.vue +4 -1
- package/src/components/wt-page-wrapper/__tests__/WtPageWrapper.spec.js +1 -2
- package/src/components/wt-pagination/wt-pagination.vue +1 -3
- package/src/components/wt-player/scripts/__tests__/createPlyrURL.spec.js +4 -8
- package/src/components/wt-player/wt-player.vue +13 -4
- package/src/components/wt-popup/wt-popup.vue +2 -1
- package/src/components/wt-search-bar/wt-search-bar.vue +1 -1
- package/src/components/wt-select/mixins/multiselectMixin.js +2 -5
- package/src/components/wt-select/wt-select.vue +12 -11
- package/src/components/wt-slider/wt-slider.vue +4 -2
- package/src/components/wt-status-select/wt-status-select.vue +10 -6
- package/src/components/wt-stepper/wt-stepper.vue +6 -4
- package/src/components/wt-switcher/wt-switcher.vue +1 -3
- package/src/components/wt-table/__tests__/WtTable.spec.js +2 -5
- package/src/components/wt-table/wt-table.vue +18 -16
- package/src/components/wt-table-column-select/wt-table-column-select.vue +9 -8
- package/src/components/wt-tabs/wt-tabs.vue +1 -3
- package/src/components/wt-tags-input/mixin/taggableMixin.js +7 -7
- package/src/components/wt-textarea/__tests__/WtTextarea.spec.js +2 -4
- package/src/components/wt-textarea/wt-textarea.vue +3 -2
- package/src/components/wt-timepicker/wt-timepicker.vue +1 -3
- package/src/components/wt-tooltip/_internals/useTooltipTriggerSubscriptions.js +1 -3
- package/src/components/wt-tooltip/_internals/wt-tooltip-floating.vue +8 -12
- package/src/components/wt-tooltip/wt-tooltip.vue +13 -13
- package/src/composables/useCachedInterval/__tests__/useCachedInterval.spec.js +6 -4
- package/src/composables/useCachedInterval/useCachedInterval.js +3 -8
- package/src/composables/useRepresentableAgentPauseCause/__tests__/useRepresentableAgentPauseCause.spec.js +11 -33
- package/src/composables/useRepresentableAgentPauseCause/useRepresentableAgentPauseCause.js +11 -9
- package/src/enums/WebitelApplications/AdminSections.enum.js +28 -28
- package/src/enums/WebitelApplications/CrmSections.enum.js +1 -1
- package/src/locale/en/en.js +12 -15
- package/src/locale/es/es.js +4 -8
- package/src/locale/kz/kz.js +5 -7
- package/src/locale/ru/ru.js +7 -11
- package/src/locale/ua/ua.js +13 -17
- package/src/mixins/dataFilterMixins/__tests__/enumFilterMixin.spec.js +1 -2
- package/src/mixins/dataFilterMixins/__tests__/sortFilterMixin.spec.js +4 -2
- package/src/mixins/dataFilterMixins/__tests__/urlControllerMixin.spec.js +4 -1
- package/src/mixins/dataFilterMixins/_urlControllerMixin/_urlControllerMixin.js +1 -1
- package/src/mixins/dataFilterMixins/apiFilterMixin.js +1 -2
- package/src/mixins/dataFilterMixins/baseFilterMixin/baseFilterMixin.js +1 -2
- package/src/mixins/dataFilterMixins/enumFilterMixin.js +5 -6
- package/src/mixins/dataFilterMixins/paginationFilterMixin.js +1 -2
- package/src/mixins/dataFilterMixins/sortFilterMixin.js +1 -4
- package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +1 -2
- package/src/mixins/validationMixin/useValidation.js +25 -19
- package/src/mixins/validationMixin/validationMixin.js +22 -10
- package/src/modules/AgentStatusSelect/api/pause-cause.js +3 -11
- package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js +16 -18
- package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-pause-cause-popup.spec.js +1 -2
- package/src/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue +12 -12
- package/src/modules/AgentStatusSelect/components/_internals/wt-cc-status-select-error-popup.vue +0 -1
- package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +20 -7
- package/src/modules/Appearance/components/__tests__/wt-dark-mode-switcher.spec.js +2 -4
- package/src/modules/Appearance/components/wt-dark-mode-switcher.vue +0 -1
- package/src/modules/AuditForm/components/__tests__/audit-form-question-read-wrapper.spec.js +1 -2
- package/src/modules/AuditForm/components/__tests__/audit-form-question-write-wrapper.spec.js +15 -25
- package/src/modules/AuditForm/components/__tests__/audit-form.spec.js +11 -20
- package/src/modules/AuditForm/components/audit-form-question-read-wrapper.vue +1 -4
- package/src/modules/AuditForm/components/audit-form-question-write-wrapper.vue +4 -7
- package/src/modules/AuditForm/components/audit-form-question.vue +18 -17
- package/src/modules/AuditForm/components/audit-form.vue +12 -14
- package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options-write-row.spec.js +1 -2
- package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options.spec.js +1 -3
- package/src/modules/AuditForm/components/questions/options/audit-form-question-options-write-row.vue +11 -15
- package/src/modules/AuditForm/components/questions/options/audit-form-question-options.vue +1 -4
- package/src/modules/AuditForm/components/questions/score/audit-form-question-score.vue +16 -20
- package/src/modules/AuditForm/schemas/AuditFormQuestionOptionsSchema.js +1 -3
- package/src/modules/CSVExport/CSVExport.js +3 -7
- package/src/modules/CSVExport/XLSExport.js +6 -7
- package/src/modules/CSVExport/__tests__/CSVExport.spec.js +1 -2
- package/src/modules/CSVExport/mixins/exportCSVMixin.js +2 -5
- package/src/modules/CSVExport/mixins/exportXLSMixin.js +2 -4
- package/src/modules/CardStoreModule/store/CardStoreModule.js +2 -6
- package/src/modules/DeleteConfirmationPopup/__tests__/delete-confirmation-popup.spec.js +13 -10
- package/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue +5 -14
- package/src/modules/FilesExport/FilesExport.js +4 -3
- package/src/modules/FilesExport/__tests__/FilesExport.spec.js +12 -12
- package/src/modules/FilesExport/mixins/exportFilesMixin.js +6 -7
- package/src/modules/FilesExport/scripts/generateMediaURL.js +1 -2
- package/src/modules/Filters/classes/BaseFilterSchema.js +21 -25
- package/src/modules/Filters/components/filter-pagination.vue +7 -3
- package/src/modules/Filters/components/filter-search.vue +21 -12
- package/src/modules/Filters/components/filter-table-fields.vue +1 -3
- package/src/modules/Filters/scripts/getters/index.js +1 -5
- package/src/modules/Filters/scripts/getters/queryGetter.js +2 -3
- package/src/modules/Filters/scripts/restores/index.js +1 -4
- package/src/modules/Filters/scripts/setters/index.js +1 -5
- package/src/modules/Filters/scripts/setters/querySetter.js +24 -22
- package/src/modules/Filters/scripts/utils/changeRouteQuery.js +16 -15
- package/src/modules/Filters/store/FiltersStoreModule.js +51 -45
- package/src/modules/Filters/store/__tests__/FiltersStoreModule.spec.js +51 -45
- package/src/modules/Notifications/store/NotificationsStoreModule.js +41 -38
- package/src/modules/Notifications/store/__tests__/NotificationsStoreModule.actions.spec.js +6 -6
- package/src/modules/QueryFilters/api/defaults.js +2 -3
- package/src/modules/QueryFilters/classes/ApiFilterSchema.js +1 -4
- package/src/modules/QueryFilters/classes/EnumFilterSchema.js +1 -4
- package/src/modules/QueryFilters/components/__tests__/filter-datetime.spec.js +1 -2
- package/src/modules/QueryFilters/components/__tests__/filter-from-to.spec.js +2 -4
- package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +2 -4
- package/src/modules/QueryFilters/components/filter-table-fields.vue +1 -5
- package/src/modules/QueryFilters/mixins/__tests__/apiFilterMixin.spec.js +4 -3
- package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +2 -4
- package/src/modules/QueryFilters/mixins/__tests__/sortFilterMixin.spec.js +4 -2
- package/src/modules/QueryFilters/mixins/__tests__/urlControllerMixin.spec.js +4 -1
- package/src/modules/QueryFilters/mixins/_urlControllerMixin/_urlControllerMixin.js +1 -1
- package/src/modules/QueryFilters/mixins/apiFilterMixin.js +1 -1
- package/src/modules/QueryFilters/mixins/baseFilterMixin/baseFilterMixin.js +4 -2
- package/src/modules/QueryFilters/mixins/enumFilterMixin.js +9 -11
- package/src/modules/QueryFilters/mixins/paginationFilterMixin.js +2 -4
- package/src/modules/QueryFilters/mixins/sortFilterMixin.js +2 -5
- package/src/modules/QueryFilters/store/QueryFiltersStoreModule.js +13 -17
- package/src/modules/QueryFilters/store/__tests__/QueryFiltersStoreModule.spec.js +15 -16
- package/src/modules/TableStoreModule/store/TableStoreModule.js +14 -33
- package/src/modules/TableStoreModule/store/__tests__/TableStoreModule.spec.js +69 -83
- package/src/modules/Userinfo/api/userinfo.js +6 -19
- package/src/modules/Userinfo/classes/ApplicationsAccess.js +5 -12
- package/src/modules/Userinfo/store/UserinfoStoreModule.js +38 -41
- package/src/plugins/breakpoint/breakpoint.plugin.js +11 -16
- package/src/scripts/__tests__/caseConverters.spec.js +1 -4
- package/src/scripts/__tests__/debounce.spec.js +3 -1
- package/src/scripts/__tests__/prettifyFileSize.spec.js +2 -2
- package/src/scripts/__tests__/preventHiddenPageCallsDecorator.spec.js +7 -4
- package/src/scripts/__tests__/updateObject.spec.js +3 -5
- package/src/scripts/caseConverters.js +22 -38
- package/src/scripts/debounce.js +1 -5
- package/src/scripts/editProxy.js +8 -7
- package/src/scripts/prettifyFileSize.js +1 -1
- package/src/scripts/preventHiddenPageCallsDecorator.js +3 -6
- package/src/store/BaseStoreModules/ApiStoreModule.js +7 -33
- package/src/store/BaseStoreModules/BaseStoreModule.js +14 -23
- package/src/store/BaseStoreModules/__tests__/BaseStoreModule.spec.js +7 -28
- package/src/store/helpers/getNamespacedState.js +2 -4
- package/src/store/new/modules/apiStoreModule/apiStoreModule.js +7 -27
- package/src/store/new/modules/cardStoreModule/cardStoreModule.js +0 -1
- package/src/store/new/modules/tableStoreModule/__tests__/tableStoreModule.spec.js +64 -77
- package/src/store/new/modules/tableStoreModule/tableStoreModule.js +12 -29
- package/src/tests/mocks/axiosMock.js +25 -19
- package/src/validators/decimalValidator.js +5 -4
- package/src/validators/websocketValidator/__tests__/websocketValidator.spec.js +1 -2
- package/src/validators/websocketValidator/websocketValidator.js +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import mitt from 'mitt';
|
|
2
2
|
import isEmpty from '../../../scripts/isEmpty.js';
|
|
3
|
-
import BaseStoreModule
|
|
4
|
-
from '../../../store/BaseStoreModules/BaseStoreModule.js';
|
|
3
|
+
import BaseStoreModule from '../../../store/BaseStoreModules/BaseStoreModule.js';
|
|
5
4
|
import BaseFilterSchema from '../classes/BaseFilterSchema.js';
|
|
6
5
|
import FilterEvent from '../enums/FilterEvent.enum.js';
|
|
7
6
|
|
|
@@ -15,17 +14,19 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
15
14
|
ROUTER: (state, g, rootState) => {
|
|
16
15
|
if (!state._requireRouter) return null;
|
|
17
16
|
if (rootState.router === undefined) {
|
|
18
|
-
throw new Error(
|
|
19
|
-
'
|
|
17
|
+
throw new Error(
|
|
18
|
+
'"rootState.router" is needed for filters to work properly.' +
|
|
19
|
+
' Please, provide to root state, or setup it in filters module as getter "ROUTER"',
|
|
20
|
+
);
|
|
20
21
|
}
|
|
21
22
|
return rootState.router;
|
|
22
23
|
},
|
|
23
24
|
|
|
24
25
|
_STATE_FILTER_NAMES: (state) => {
|
|
25
|
-
return Object.values(state)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
return Object.values(state).reduce(
|
|
27
|
+
(names, prop) => (prop.value || prop.name ? [...names, prop.name] : names),
|
|
28
|
+
[],
|
|
29
|
+
);
|
|
29
30
|
},
|
|
30
31
|
|
|
31
32
|
// get value of specific filter
|
|
@@ -45,23 +46,27 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
45
46
|
|
|
46
47
|
// get all filters values
|
|
47
48
|
GET_FILTERS: (state, getters) => () => {
|
|
48
|
-
return getters._STATE_FILTER_NAMES
|
|
49
|
-
.reduce((values, filterName) => {
|
|
49
|
+
return getters._STATE_FILTER_NAMES.reduce((values, filterName) => {
|
|
50
50
|
const filterValue = getters.GET_FILTER(filterName);
|
|
51
|
-
return isEmpty(filterValue)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
return isEmpty(filterValue)
|
|
52
|
+
? values
|
|
53
|
+
: {
|
|
54
|
+
...values,
|
|
55
|
+
[filterName]: filterValue,
|
|
56
|
+
};
|
|
55
57
|
}, {});
|
|
56
58
|
},
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
actions = {
|
|
60
|
-
SET_FILTER: async (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
SET_FILTER: async (
|
|
63
|
+
context,
|
|
64
|
+
{
|
|
65
|
+
name,
|
|
66
|
+
value,
|
|
67
|
+
silent = false, // if true, don't call ON_FILTER_SET event
|
|
68
|
+
},
|
|
69
|
+
) => {
|
|
65
70
|
const filter = context.state[name];
|
|
66
71
|
|
|
67
72
|
await filter.set(value, {
|
|
@@ -74,13 +79,14 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
74
79
|
value: context.getters.GET_FILTER(name),
|
|
75
80
|
});
|
|
76
81
|
|
|
77
|
-
if (!silent)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
if (!silent)
|
|
83
|
+
await context.dispatch('EMIT', {
|
|
84
|
+
event: FilterEvent.FILTER_SET,
|
|
85
|
+
payload: {
|
|
86
|
+
name,
|
|
87
|
+
value: context.getters.GET_FILTER(name),
|
|
88
|
+
},
|
|
89
|
+
});
|
|
84
90
|
},
|
|
85
91
|
|
|
86
92
|
RESTORE_FILTER: async (context, { name }) => {
|
|
@@ -90,18 +96,20 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
90
96
|
});
|
|
91
97
|
|
|
92
98
|
if (value) {
|
|
93
|
-
await context.dispatch('SET_FILTER',
|
|
99
|
+
await context.dispatch('SET_FILTER', {
|
|
94
100
|
name,
|
|
95
101
|
value,
|
|
96
102
|
silent: true,
|
|
97
|
-
})
|
|
103
|
+
});
|
|
98
104
|
}
|
|
99
105
|
},
|
|
100
106
|
|
|
101
107
|
RESTORE_FILTERS: async (context) => {
|
|
102
|
-
await Promise.allSettled(
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
await Promise.allSettled(
|
|
109
|
+
context.getters._STATE_FILTER_NAMES.map((name) => {
|
|
110
|
+
return context.dispatch('RESTORE_FILTER', { name });
|
|
111
|
+
}),
|
|
112
|
+
);
|
|
105
113
|
|
|
106
114
|
return context.dispatch('EMIT', {
|
|
107
115
|
event: FilterEvent.RESTORED,
|
|
@@ -109,16 +117,17 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
109
117
|
});
|
|
110
118
|
},
|
|
111
119
|
|
|
112
|
-
RESET_FILTERS: (context) =>
|
|
113
|
-
|
|
114
|
-
|
|
120
|
+
RESET_FILTERS: (context) =>
|
|
121
|
+
Promise.allSettled(
|
|
122
|
+
context.getters._FILTER_NAMES.map((name) => {
|
|
123
|
+
const filter = context.state[name];
|
|
115
124
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
125
|
+
return context.dispatch('SET_FILTER', {
|
|
126
|
+
filter,
|
|
127
|
+
value: filter.defaultValue,
|
|
128
|
+
});
|
|
129
|
+
}),
|
|
130
|
+
),
|
|
122
131
|
|
|
123
132
|
SUBSCRIBE: (context, { event, callback }) => {
|
|
124
133
|
const subscribe = () => context.state._emitter.on(event, callback);
|
|
@@ -135,10 +144,7 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
135
144
|
const wildcardListeners = context.state._emitter.all.get('*');
|
|
136
145
|
const eventListeners = context.state._emitter.all.get(event);
|
|
137
146
|
|
|
138
|
-
const listeners = [
|
|
139
|
-
...(wildcardListeners || []),
|
|
140
|
-
...(eventListeners || []),
|
|
141
|
-
];
|
|
147
|
+
const listeners = [...(wildcardListeners || []), ...(eventListeners || [])];
|
|
142
148
|
|
|
143
149
|
if (!listeners) {
|
|
144
150
|
console.info(`No listeners for ${event} event`);
|
|
@@ -175,4 +181,4 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
175
181
|
|
|
176
182
|
return this;
|
|
177
183
|
}
|
|
178
|
-
}
|
|
184
|
+
}
|
|
@@ -7,16 +7,18 @@ import FiltersStoreModule from '../FiltersStoreModule.js';
|
|
|
7
7
|
|
|
8
8
|
describe('FiltersStoreModule', () => {
|
|
9
9
|
it('get/sets primitive type filter', async () => {
|
|
10
|
-
const filters = new FiltersStoreModule()
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
const filters = new FiltersStoreModule()
|
|
11
|
+
.addFilter([
|
|
12
|
+
{
|
|
13
|
+
name: 'vi',
|
|
14
|
+
value: 1,
|
|
15
|
+
defaultValue: 1,
|
|
16
|
+
get: ['value'],
|
|
17
|
+
set: ['value'],
|
|
18
|
+
restore: [],
|
|
19
|
+
},
|
|
20
|
+
])
|
|
21
|
+
.getModule();
|
|
20
22
|
|
|
21
23
|
const store = createStore({
|
|
22
24
|
state: {
|
|
@@ -41,15 +43,15 @@ describe('FiltersStoreModule', () => {
|
|
|
41
43
|
const localStorageKey = 'vivivi';
|
|
42
44
|
|
|
43
45
|
const filters = new FiltersStoreModule()
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
.addFilter({
|
|
47
|
+
name: 'vi',
|
|
48
|
+
value: 1,
|
|
49
|
+
localStorageKey,
|
|
50
|
+
get: ['value'],
|
|
51
|
+
set: ['value', 'localStorage'],
|
|
52
|
+
restore: ['localStorage'],
|
|
53
|
+
})
|
|
54
|
+
.getModule();
|
|
53
55
|
|
|
54
56
|
const store = createStore({
|
|
55
57
|
state: {
|
|
@@ -87,23 +89,27 @@ describe('FiltersStoreModule', () => {
|
|
|
87
89
|
await router.push({ name: 'home' });
|
|
88
90
|
|
|
89
91
|
const filters = new FiltersStoreModule()
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
92
|
+
.addFilter({
|
|
93
|
+
name: 'vi',
|
|
94
|
+
value: 1,
|
|
95
|
+
requireRouter: true,
|
|
96
|
+
get: (context) => () => {
|
|
97
|
+
return valueGetter(context)();
|
|
98
|
+
},
|
|
99
|
+
set:
|
|
100
|
+
(context) =>
|
|
101
|
+
async (v, { router }) => {
|
|
102
|
+
valueSetter(context)(v);
|
|
103
|
+
await querySetter(context)(router)(v);
|
|
104
|
+
return context;
|
|
105
|
+
},
|
|
106
|
+
restore:
|
|
107
|
+
(context) =>
|
|
108
|
+
({ router }) => {
|
|
109
|
+
return queryRestore(context)(router)();
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
.getModule();
|
|
107
113
|
|
|
108
114
|
const store = createStore({
|
|
109
115
|
state: {
|
|
@@ -139,15 +145,15 @@ describe('FiltersStoreModule', () => {
|
|
|
139
145
|
await router.push({ name: 'home' });
|
|
140
146
|
|
|
141
147
|
const filters = new FiltersStoreModule()
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
.addFilter({
|
|
149
|
+
name: 'vi',
|
|
150
|
+
value: 1,
|
|
151
|
+
get: ['value'],
|
|
152
|
+
set: ['value', 'query'],
|
|
153
|
+
restore: ['query'],
|
|
154
|
+
router,
|
|
155
|
+
})
|
|
156
|
+
.getModule();
|
|
151
157
|
|
|
152
158
|
const store = createStore({
|
|
153
159
|
state: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CallActions, ChatActions, JobState } from 'webitel-sdk';
|
|
2
2
|
import i18n from '../../../locale/i18n.js';
|
|
3
3
|
import BaseStoreModule from '../../../store/BaseStoreModules/BaseStoreModule.js';
|
|
4
|
-
import endChatSound from '../assets/audio/end-chat.wav';
|
|
5
4
|
import endCallSound from '../assets/audio/end-call.mp3';
|
|
5
|
+
import endChatSound from '../assets/audio/end-chat.wav';
|
|
6
6
|
import newChatSound from '../assets/audio/new-chat.wav';
|
|
7
7
|
import newMessageSound from '../assets/audio/new-message.wav';
|
|
8
8
|
import ringingSound from '../assets/audio/ringing.mp3';
|
|
@@ -45,8 +45,7 @@ export default class NotificationsStoreModule extends BaseStoreModule {
|
|
|
45
45
|
|
|
46
46
|
getters = {
|
|
47
47
|
IS_MAIN_TAB: (state) => state.thisTabId === state.currentTabId,
|
|
48
|
-
IS_SOUND_ALLOWED: (state, getters) => getters.IS_MAIN_TAB &&
|
|
49
|
-
!state.currentlyPlaying,
|
|
48
|
+
IS_SOUND_ALLOWED: (state, getters) => getters.IS_MAIN_TAB && !state.currentlyPlaying,
|
|
50
49
|
};
|
|
51
50
|
|
|
52
51
|
actions = {
|
|
@@ -102,32 +101,30 @@ export default class NotificationsStoreModule extends BaseStoreModule {
|
|
|
102
101
|
},
|
|
103
102
|
|
|
104
103
|
// public
|
|
105
|
-
INITIALIZE: (context) =>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
DESTROY: (context) =>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
PLAY_SOUND: (context, {
|
|
119
|
-
|
|
120
|
-
sound = getNotificationSound(action),
|
|
121
|
-
}) => {
|
|
122
|
-
if (context.getters.IS_SOUND_ALLOWED
|
|
123
|
-
&& !localStorage.getItem('wtIsPlaying')
|
|
124
|
-
) {
|
|
125
|
-
|
|
104
|
+
INITIALIZE: (context) =>
|
|
105
|
+
Promise.allSettled([
|
|
106
|
+
context.dispatch('_SETUP_THIS_TAB_ID'),
|
|
107
|
+
context.dispatch('_SETUP_UNREAD_COUND_BROADCAST_LISTENING'),
|
|
108
|
+
context.dispatch('_SUBSCRIBE_TAB_CLOSING'),
|
|
109
|
+
]),
|
|
110
|
+
|
|
111
|
+
DESTROY: (context) =>
|
|
112
|
+
Promise.allSettled([
|
|
113
|
+
context.dispatch('STOP_SOUND'),
|
|
114
|
+
context.dispatch('_REMOVE_CURRENT_TAB_ID'),
|
|
115
|
+
]),
|
|
116
|
+
|
|
117
|
+
PLAY_SOUND: (context, { action, sound = getNotificationSound(action) }) => {
|
|
118
|
+
if (context.getters.IS_SOUND_ALLOWED && !localStorage.getItem('wtIsPlaying')) {
|
|
126
119
|
const audio = sound instanceof Audio ? sound : new Audio(sound);
|
|
127
120
|
|
|
128
|
-
audio.addEventListener(
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
audio.addEventListener(
|
|
122
|
+
'ended',
|
|
123
|
+
() => {
|
|
124
|
+
context.dispatch('STOP_SOUND');
|
|
125
|
+
},
|
|
126
|
+
{ once: true },
|
|
127
|
+
);
|
|
131
128
|
|
|
132
129
|
if (action === CallActions.Ringing) audio.loop = true;
|
|
133
130
|
|
|
@@ -139,23 +136,29 @@ export default class NotificationsStoreModule extends BaseStoreModule {
|
|
|
139
136
|
|
|
140
137
|
STOP_SOUND: (context) => {
|
|
141
138
|
const { currentlyPlaying } = context.state;
|
|
142
|
-
if (currentlyPlaying && currentlyPlaying instanceof
|
|
143
|
-
Audio) currentlyPlaying.pause();
|
|
139
|
+
if (currentlyPlaying && currentlyPlaying instanceof Audio) currentlyPlaying.pause();
|
|
144
140
|
localStorage.removeItem('wtIsPlaying');
|
|
145
141
|
context.commit('RESET_CURRENTLY_PLAYING');
|
|
146
142
|
},
|
|
147
143
|
|
|
148
|
-
SEND_NOTIFICATION: (
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
144
|
+
SEND_NOTIFICATION: (
|
|
145
|
+
context,
|
|
146
|
+
{
|
|
147
|
+
locale,
|
|
148
|
+
text = i18n.t(locale),
|
|
149
|
+
icon = notificationIcon,
|
|
150
|
+
interval = NOTIFICATION_VISIBLE_INTERVAL,
|
|
151
|
+
},
|
|
152
|
+
) => {
|
|
154
153
|
const notification = new Notification(text, { icon });
|
|
155
154
|
|
|
156
|
-
notification.addEventListener(
|
|
157
|
-
|
|
158
|
-
|
|
155
|
+
notification.addEventListener(
|
|
156
|
+
'click',
|
|
157
|
+
() => {
|
|
158
|
+
window.focus();
|
|
159
|
+
},
|
|
160
|
+
{ once: true },
|
|
161
|
+
);
|
|
159
162
|
|
|
160
163
|
setTimeout(() => {
|
|
161
164
|
notification.close();
|
|
@@ -38,8 +38,7 @@ describe('features/notifications store: actions', () => {
|
|
|
38
38
|
|
|
39
39
|
it('INITIALIZE action dispatches _SETUP_UNREAD_COUND_BROADCAST_LISTENING action', () => {
|
|
40
40
|
notificationsModule.actions.INITIALIZE(context);
|
|
41
|
-
expect(context.dispatch.mock.calls[1][0])
|
|
42
|
-
.toContain('_SETUP_UNREAD_COUND_BROADCAST_LISTENING');
|
|
41
|
+
expect(context.dispatch.mock.calls[1][0]).toContain('_SETUP_UNREAD_COUND_BROADCAST_LISTENING');
|
|
43
42
|
});
|
|
44
43
|
|
|
45
44
|
it('INITIALIZE action dispatches _SETUP_THIS_TAB_ID action', () => {
|
|
@@ -59,8 +58,10 @@ describe('features/notifications store: actions', () => {
|
|
|
59
58
|
|
|
60
59
|
it('INCREMENT_UNREAD_COUNT action dispatches _SET_UNREAD_COUNT and increases unreadCount', () => {
|
|
61
60
|
notificationsModule.actions.INCREMENT_UNREAD_COUNT(context);
|
|
62
|
-
expect(context.dispatch)
|
|
63
|
-
|
|
61
|
+
expect(context.dispatch).toHaveBeenCalledWith(
|
|
62
|
+
'_SET_UNREAD_COUNT',
|
|
63
|
+
context.state.unreadCount + 1,
|
|
64
|
+
);
|
|
64
65
|
});
|
|
65
66
|
|
|
66
67
|
it('_SETUP_UNREAD_COUND_BROADCAST_LISTENING action commits SET_BROADCAST_CHANNEL mutation', () => {
|
|
@@ -99,8 +100,7 @@ describe('features/notifications store: actions', () => {
|
|
|
99
100
|
it('_SET_UNREAD_COUNT action commits _SET_UNREAD_COUNT mutation with count', () => {
|
|
100
101
|
const unreadCount = 5;
|
|
101
102
|
notificationsModule.actions._SET_UNREAD_COUNT(context, unreadCount);
|
|
102
|
-
expect(context.commit)
|
|
103
|
-
.toHaveBeenCalledWith('SET_UNREAD_COUNT', unreadCount);
|
|
103
|
+
expect(context.commit).toHaveBeenCalledWith('SET_UNREAD_COUNT', unreadCount);
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
it('_RESET_UNREAD_COUNT action does not dispatch if unread count is 0', () => {
|
|
@@ -2,10 +2,7 @@ import BaseFilterSchema from './BaseFilterSchema.js';
|
|
|
2
2
|
|
|
3
3
|
export default class ApiFilterSchema extends BaseFilterSchema {
|
|
4
4
|
constructor(params = {}) {
|
|
5
|
-
const {
|
|
6
|
-
value = [],
|
|
7
|
-
defaultValue = [],
|
|
8
|
-
} = params;
|
|
5
|
+
const { value = [], defaultValue = [] } = params;
|
|
9
6
|
super({ value, defaultValue });
|
|
10
7
|
const {
|
|
11
8
|
locale = { label: 'filter' },
|
|
@@ -2,10 +2,7 @@ import BaseFilterSchema from './BaseFilterSchema.js';
|
|
|
2
2
|
|
|
3
3
|
export default class EnumFilterSchema extends BaseFilterSchema {
|
|
4
4
|
constructor(params = {}) {
|
|
5
|
-
const {
|
|
6
|
-
value = [],
|
|
7
|
-
defaultValue = [],
|
|
8
|
-
} = params;
|
|
5
|
+
const { value = [], defaultValue = [] } = params;
|
|
9
6
|
super({ value, defaultValue });
|
|
10
7
|
const {
|
|
11
8
|
locale = { label: 'filter' },
|
|
@@ -42,8 +42,7 @@ describe('DatetimeFilter Filter', () => {
|
|
|
42
42
|
const value = Date.now();
|
|
43
43
|
await router.replace({ query: { [filterQuery]: value } });
|
|
44
44
|
const setValueMock = vi.fn();
|
|
45
|
-
vi.spyOn(baseFilterMixin.methods, 'setValue')
|
|
46
|
-
.mockImplementationOnce(setValueMock);
|
|
45
|
+
vi.spyOn(baseFilterMixin.methods, 'setValue').mockImplementationOnce(setValueMock);
|
|
47
46
|
shallowMount(DatetimeFilter, mountOptions);
|
|
48
47
|
expect(setValueMock).toHaveBeenCalledWith({ filter: filterQuery, value });
|
|
49
48
|
});
|
|
@@ -40,8 +40,7 @@ describe('FilterFromTo Filter', () => {
|
|
|
40
40
|
const value = 10;
|
|
41
41
|
await router.replace({ query: { [`${filterQuery}From`]: value } });
|
|
42
42
|
const setValueMock = vi.fn();
|
|
43
|
-
vi.spyOn(baseFilterMixin.methods, 'setValue')
|
|
44
|
-
.mockImplementation(setValueMock);
|
|
43
|
+
vi.spyOn(baseFilterMixin.methods, 'setValue').mockImplementation(setValueMock);
|
|
45
44
|
shallowMount(FilterFromTo, mountOptions);
|
|
46
45
|
expect(setValueMock).toHaveBeenNthCalledWith(1, {
|
|
47
46
|
filter: filterQuery,
|
|
@@ -52,8 +51,7 @@ describe('FilterFromTo Filter', () => {
|
|
|
52
51
|
const value = 10;
|
|
53
52
|
await router.replace({ query: { [`${filterQuery}To`]: value } });
|
|
54
53
|
const setValueMock = vi.fn();
|
|
55
|
-
vi.spyOn(baseFilterMixin.methods, 'setValue')
|
|
56
|
-
.mockImplementation(setValueMock);
|
|
54
|
+
vi.spyOn(baseFilterMixin.methods, 'setValue').mockImplementation(setValueMock);
|
|
57
55
|
shallowMount(FilterFromTo, mountOptions);
|
|
58
56
|
expect(setValueMock).toHaveBeenNthCalledWith(2, {
|
|
59
57
|
filter: filterQuery,
|
|
@@ -40,10 +40,8 @@ describe('Search Filter', () => {
|
|
|
40
40
|
const search = 'jest';
|
|
41
41
|
await router.replace({ query: { [filterQuery]: search } });
|
|
42
42
|
const setValueMock = vi.fn();
|
|
43
|
-
vi.spyOn(baseFilterMixin.methods, 'setValue')
|
|
44
|
-
.mockImplementationOnce(setValueMock);
|
|
43
|
+
vi.spyOn(baseFilterMixin.methods, 'setValue').mockImplementationOnce(setValueMock);
|
|
45
44
|
shallowMount(SearchFilter, mountOptions);
|
|
46
|
-
expect(setValueMock)
|
|
47
|
-
.toHaveBeenCalledWith({ filter: filterQuery, value: search });
|
|
45
|
+
expect(setValueMock).toHaveBeenCalledWith({ filter: filterQuery, value: search });
|
|
48
46
|
});
|
|
49
47
|
});
|
|
@@ -84,11 +84,7 @@ export default {
|
|
|
84
84
|
|
|
85
85
|
// copy-pasted params from "setValueArrayToQuery method
|
|
86
86
|
// for easier future refactors, if method should be abstract
|
|
87
|
-
setToLocalStorage({
|
|
88
|
-
filterQuery,
|
|
89
|
-
value,
|
|
90
|
-
storedProp = 'id',
|
|
91
|
-
}) {
|
|
87
|
+
setToLocalStorage({ filterQuery, value, storedProp = 'id' }) {
|
|
92
88
|
const filter = value.map((item) => item[storedProp]);
|
|
93
89
|
localStorage.setItem(`${this.entity}-${filterQuery}`, filter);
|
|
94
90
|
},
|
|
@@ -20,7 +20,9 @@ describe('API filter mixin', () => {
|
|
|
20
20
|
filterQuery: 'team',
|
|
21
21
|
}),
|
|
22
22
|
computed: {
|
|
23
|
-
filterSchema() {
|
|
23
|
+
filterSchema() {
|
|
24
|
+
return filterSchema;
|
|
25
|
+
},
|
|
24
26
|
},
|
|
25
27
|
methods: { setValue },
|
|
26
28
|
};
|
|
@@ -35,8 +37,7 @@ describe('API filter mixin', () => {
|
|
|
35
37
|
const wrapper = shallowMount(Component, {
|
|
36
38
|
global: { plugins: [router] },
|
|
37
39
|
});
|
|
38
|
-
expect(setValue)
|
|
39
|
-
.toHaveBeenCalledWith({
|
|
40
|
+
expect(setValue).toHaveBeenCalledWith({
|
|
40
41
|
filter: 'team',
|
|
41
42
|
value: [{ id: team[0] }, { id: team[1] }],
|
|
42
43
|
});
|
|
@@ -21,8 +21,7 @@ const router = createRouter({
|
|
|
21
21
|
describe('Enum filter mixin', () => {
|
|
22
22
|
const setValue = vi.fn();
|
|
23
23
|
const Component = {
|
|
24
|
-
render() {
|
|
25
|
-
},
|
|
24
|
+
render() {},
|
|
26
25
|
mixins: [enumFilterMixin],
|
|
27
26
|
data: () => ({
|
|
28
27
|
filterQuery: 'direction',
|
|
@@ -43,8 +42,7 @@ describe('Enum filter mixin', () => {
|
|
|
43
42
|
global: { plugins: [router] },
|
|
44
43
|
});
|
|
45
44
|
await wrapper.vm.$nextTick();
|
|
46
|
-
expect(setValue)
|
|
47
|
-
.toHaveBeenCalledWith({ filter: 'direction', value: options[0] });
|
|
45
|
+
expect(setValue).toHaveBeenCalledWith({ filter: 'direction', value: options[0] });
|
|
48
46
|
});
|
|
49
47
|
|
|
50
48
|
it('Sets empty array value if $route query is empty', async () => {
|
|
@@ -13,7 +13,8 @@ const headers = [
|
|
|
13
13
|
show: true,
|
|
14
14
|
sort: null,
|
|
15
15
|
field: 'queue',
|
|
16
|
-
},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
17
18
|
value: 'agents',
|
|
18
19
|
show: true,
|
|
19
20
|
sort: null,
|
|
@@ -27,7 +28,8 @@ const sortedHeaders = [
|
|
|
27
28
|
show: true,
|
|
28
29
|
sort: 'asc',
|
|
29
30
|
field: 'queue',
|
|
30
|
-
},
|
|
31
|
+
},
|
|
32
|
+
{
|
|
31
33
|
value: 'agents',
|
|
32
34
|
show: true,
|
|
33
35
|
sort: null,
|
|
@@ -24,7 +24,10 @@ describe('URL Controller mixin Set and Get operations', () => {
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
it('Array of objects', async () => {
|
|
27
|
-
const value = [
|
|
27
|
+
const value = [
|
|
28
|
+
{ name: 'team 1', id: '1' },
|
|
29
|
+
{ name: 'team 2', id: '2' },
|
|
30
|
+
];
|
|
28
31
|
await wrapper.vm.setValueToQuery({ filterQuery, value });
|
|
29
32
|
const queryValue = wrapper.vm.getValueFromQuery({ filterQuery });
|
|
30
33
|
expect(queryValue).toEqual(['1', '2']);
|
|
@@ -14,7 +14,8 @@ export default {
|
|
|
14
14
|
},
|
|
15
15
|
computed: {
|
|
16
16
|
filterSchema() {
|
|
17
|
-
if (!this.$store)
|
|
17
|
+
if (!this.$store)
|
|
18
|
+
throw new Error('Vuex is required for default filterSchema baseFilterMixin property');
|
|
18
19
|
return getNamespacedState(this.$store.state, this.namespace)[this.filterQuery];
|
|
19
20
|
},
|
|
20
21
|
value() {
|
|
@@ -27,7 +28,8 @@ export default {
|
|
|
27
28
|
if (value) this.restoreValue(value);
|
|
28
29
|
},
|
|
29
30
|
setValue(payload) {
|
|
30
|
-
if (!this.$store)
|
|
31
|
+
if (!this.$store)
|
|
32
|
+
throw new Error('Vuex is required for default setValue() baseFilterMixin method');
|
|
31
33
|
return this.$store.dispatch(`${this.namespace}/SET_FILTER`, payload);
|
|
32
34
|
},
|
|
33
35
|
},
|