@webitel/ui-sdk 24.10.2 → 24.10.4
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/index.js +1 -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 -23
- 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 +8 -3
- package/src/modules/Filters/scripts/getters/valueGetter.js +1 -2
- 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,13 +1,9 @@
|
|
|
1
1
|
import { createRouter, createWebHistory } from 'vue-router';
|
|
2
2
|
import { createStore } from 'vuex';
|
|
3
|
-
import FilterEvent
|
|
4
|
-
|
|
5
|
-
import FiltersStoreModule
|
|
6
|
-
from '../../../../../modules/Filters/store/FiltersStoreModule.js';
|
|
3
|
+
import FilterEvent from '../../../../../modules/Filters/enums/FilterEvent.enum.js';
|
|
4
|
+
import FiltersStoreModule from '../../../../../modules/Filters/store/FiltersStoreModule.js';
|
|
7
5
|
import { SortSymbols } from '../../../../../scripts/sortQueryAdapters.js';
|
|
8
|
-
import {
|
|
9
|
-
createTableStoreModule,
|
|
10
|
-
} from '../../../helpers/createTableStoreModule.js';
|
|
6
|
+
import { createTableStoreModule } from '../../../helpers/createTableStoreModule.js';
|
|
11
7
|
|
|
12
8
|
describe('TableStoreModule', () => {
|
|
13
9
|
it('correctly computes FIELDS getter', () => {
|
|
@@ -19,8 +15,7 @@ describe('TableStoreModule', () => {
|
|
|
19
15
|
|
|
20
16
|
const state = { headers };
|
|
21
17
|
|
|
22
|
-
expect(createTableStoreModule().getters.FIELDS(state))
|
|
23
|
-
.toEqual(['id', 'age']);
|
|
18
|
+
expect(createTableStoreModule().getters.FIELDS(state)).toEqual(['id', 'age']);
|
|
24
19
|
});
|
|
25
20
|
});
|
|
26
21
|
|
|
@@ -32,23 +27,22 @@ describe('TableStoreModule integration with FiltersStoreModule', () => {
|
|
|
32
27
|
|
|
33
28
|
it('filters restore event triggers LOAD_DATA_LIST', async () => {
|
|
34
29
|
const filters = new FiltersStoreModule()
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
30
|
+
.addFilter({
|
|
31
|
+
name: 'vi',
|
|
32
|
+
value: 23,
|
|
33
|
+
defaultValue: 23,
|
|
34
|
+
get: ['value'],
|
|
35
|
+
set: ['value'],
|
|
36
|
+
restore: () => 'vivi',
|
|
37
|
+
})
|
|
38
|
+
.getModule();
|
|
44
39
|
|
|
45
40
|
const table = createTableStoreModule({
|
|
46
41
|
modules: { filters },
|
|
47
42
|
});
|
|
48
43
|
|
|
49
44
|
const mock = vi.fn();
|
|
50
|
-
vi.spyOn(table.actions, 'LOAD_DATA_LIST')
|
|
51
|
-
.mockImplementationOnce(mock);
|
|
45
|
+
vi.spyOn(table.actions, 'LOAD_DATA_LIST').mockImplementationOnce(mock);
|
|
52
46
|
|
|
53
47
|
const store = createStore({
|
|
54
48
|
state: { router },
|
|
@@ -69,23 +63,22 @@ describe('TableStoreModule integration with FiltersStoreModule', () => {
|
|
|
69
63
|
|
|
70
64
|
it('FILTER_SET event triggers LOAD_DATA_LIST', async () => {
|
|
71
65
|
const filters = new FiltersStoreModule()
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
.addFilter({
|
|
67
|
+
name: 'vi',
|
|
68
|
+
value: 23,
|
|
69
|
+
defaultValue: 23,
|
|
70
|
+
get: ['value'],
|
|
71
|
+
set: ['value'],
|
|
72
|
+
restore: () => {},
|
|
73
|
+
})
|
|
74
|
+
.getModule();
|
|
81
75
|
|
|
82
76
|
const table = createTableStoreModule({
|
|
83
77
|
modules: { filters },
|
|
84
78
|
});
|
|
85
79
|
|
|
86
80
|
const mock = vi.fn();
|
|
87
|
-
vi.spyOn(table.actions, 'LOAD_DATA_LIST')
|
|
88
|
-
.mockImplementationOnce(mock);
|
|
81
|
+
vi.spyOn(table.actions, 'LOAD_DATA_LIST').mockImplementationOnce(mock);
|
|
89
82
|
|
|
90
83
|
const store = createStore({
|
|
91
84
|
state: { router },
|
|
@@ -111,32 +104,31 @@ describe('TableStoreModule integration with FiltersStoreModule', () => {
|
|
|
111
104
|
|
|
112
105
|
it('FILTER_SET with not-page filter name resets page filter', async () => {
|
|
113
106
|
const filters = new FiltersStoreModule()
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
107
|
+
.addFilter([
|
|
108
|
+
{
|
|
109
|
+
name: 'vi',
|
|
110
|
+
value: 23,
|
|
111
|
+
defaultValue: 23,
|
|
112
|
+
get: ['value'],
|
|
113
|
+
set: ['value'],
|
|
114
|
+
restore: () => {},
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'page',
|
|
118
|
+
value: 12,
|
|
119
|
+
defaultValue: 12,
|
|
120
|
+
get: ['value'],
|
|
121
|
+
set: ['value'],
|
|
122
|
+
restore: () => {},
|
|
123
|
+
},
|
|
124
|
+
])
|
|
125
|
+
.getModule();
|
|
133
126
|
|
|
134
127
|
const table = createTableStoreModule({
|
|
135
128
|
modules: { filters },
|
|
136
129
|
});
|
|
137
130
|
|
|
138
|
-
vi.spyOn(table.actions, 'LOAD_DATA_LIST')
|
|
139
|
-
.mockImplementationOnce(vi.fn());
|
|
131
|
+
vi.spyOn(table.actions, 'LOAD_DATA_LIST').mockImplementationOnce(vi.fn());
|
|
140
132
|
|
|
141
133
|
const store = createStore({
|
|
142
134
|
state: { router },
|
|
@@ -162,26 +154,23 @@ describe('TableStoreModule integration with FiltersStoreModule', () => {
|
|
|
162
154
|
|
|
163
155
|
it('SORT changes both headers and sort filter', async () => {
|
|
164
156
|
const filters = new FiltersStoreModule()
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
157
|
+
.addFilter({
|
|
158
|
+
name: 'sort',
|
|
159
|
+
value: '',
|
|
160
|
+
get: ['value'],
|
|
161
|
+
set: ['value'],
|
|
162
|
+
restore: () => {},
|
|
163
|
+
})
|
|
164
|
+
.getModule();
|
|
173
165
|
|
|
174
|
-
const headers = [
|
|
175
|
-
{ value: 'id', field: 'sort_me', sort: SortSymbols.NONE },
|
|
176
|
-
];
|
|
166
|
+
const headers = [{ value: 'id', field: 'sort_me', sort: SortSymbols.NONE }];
|
|
177
167
|
|
|
178
168
|
const table = createTableStoreModule({
|
|
179
169
|
state: { headers },
|
|
180
170
|
modules: { filters },
|
|
181
171
|
});
|
|
182
172
|
|
|
183
|
-
vi.spyOn(table.actions, 'LOAD_DATA_LIST')
|
|
184
|
-
.mockImplementationOnce(vi.fn());
|
|
173
|
+
vi.spyOn(table.actions, 'LOAD_DATA_LIST').mockImplementationOnce(vi.fn());
|
|
185
174
|
|
|
186
175
|
const store = createStore({
|
|
187
176
|
state: { router },
|
|
@@ -207,14 +196,14 @@ describe('TableStoreModule integration with FiltersStoreModule', () => {
|
|
|
207
196
|
|
|
208
197
|
it('fields filter change changes headers', async () => {
|
|
209
198
|
const filters = new FiltersStoreModule()
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
199
|
+
.addFilter({
|
|
200
|
+
name: 'fields',
|
|
201
|
+
value: [],
|
|
202
|
+
get: ['value'],
|
|
203
|
+
set: ['value'],
|
|
204
|
+
restore: () => {},
|
|
205
|
+
})
|
|
206
|
+
.getModule();
|
|
218
207
|
|
|
219
208
|
const headers = [
|
|
220
209
|
{ value: 'surname', field: 'included', show: false },
|
|
@@ -226,8 +215,7 @@ describe('TableStoreModule integration with FiltersStoreModule', () => {
|
|
|
226
215
|
modules: { filters },
|
|
227
216
|
});
|
|
228
217
|
|
|
229
|
-
vi.spyOn(table.actions, 'LOAD_DATA_LIST')
|
|
230
|
-
.mockImplementationOnce(vi.fn());
|
|
218
|
+
vi.spyOn(table.actions, 'LOAD_DATA_LIST').mockImplementationOnce(vi.fn());
|
|
231
219
|
|
|
232
220
|
const store = createStore({
|
|
233
221
|
state: { router },
|
|
@@ -244,8 +232,7 @@ describe('TableStoreModule integration with FiltersStoreModule', () => {
|
|
|
244
232
|
value: ['surname'],
|
|
245
233
|
});
|
|
246
234
|
|
|
247
|
-
expect(store.getters['table/filters/GET_FILTER']('fields'))
|
|
248
|
-
.toEqual(['surname']);
|
|
235
|
+
expect(store.getters['table/filters/GET_FILTER']('fields')).toEqual(['surname']);
|
|
249
236
|
|
|
250
237
|
expect(store.getters['table/FIELDS']).toEqual(['id', 'included']);
|
|
251
238
|
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import FilterEvent from '../../../../modules/Filters/enums/FilterEvent.enum.js';
|
|
2
|
-
import {
|
|
3
|
-
queryToSortAdapter,
|
|
4
|
-
sortToQueryAdapter,
|
|
5
|
-
} from '../../../../scripts/sortQueryAdapters.js';
|
|
2
|
+
import { queryToSortAdapter, sortToQueryAdapter } from '../../../../scripts/sortQueryAdapters.js';
|
|
6
3
|
|
|
7
4
|
const state = () => ({
|
|
8
5
|
headers: [],
|
|
@@ -45,10 +42,7 @@ const getters = {
|
|
|
45
42
|
|
|
46
43
|
const actions = {
|
|
47
44
|
// FIXME: maybe move to filters module?
|
|
48
|
-
SET_FILTER: (
|
|
49
|
-
context,
|
|
50
|
-
payload,
|
|
51
|
-
) => context.dispatch('filters/SET_FILTER', payload),
|
|
45
|
+
SET_FILTER: (context, payload) => context.dispatch('filters/SET_FILTER', payload),
|
|
52
46
|
|
|
53
47
|
// FIXME: maybe move to filters module?
|
|
54
48
|
ON_FILTER_EVENT: async (context, { event, payload }) => {
|
|
@@ -63,10 +57,7 @@ const actions = {
|
|
|
63
57
|
},
|
|
64
58
|
|
|
65
59
|
// FIXME: maybe move to filters module?
|
|
66
|
-
HANDLE_FILTERS_RESTORE: async (context, {
|
|
67
|
-
fields,
|
|
68
|
-
sort,
|
|
69
|
-
}) => {
|
|
60
|
+
HANDLE_FILTERS_RESTORE: async (context, { fields, sort }) => {
|
|
70
61
|
if (sort) await context.dispatch('HANDLE_SORT_CHANGE', { value: sort });
|
|
71
62
|
if (fields?.length) await context.dispatch('HANDLE_FIELDS_CHANGE', { value: fields });
|
|
72
63
|
return context.dispatch('LOAD_DATA_LIST');
|
|
@@ -106,10 +97,7 @@ const actions = {
|
|
|
106
97
|
const nextSort = queryToSortAdapter(value?.slice(0, 1) || '');
|
|
107
98
|
const field = nextSort ? value.slice(1) : value;
|
|
108
99
|
|
|
109
|
-
const headers = context.state.headers.map(({
|
|
110
|
-
sort: currentSort,
|
|
111
|
-
...header
|
|
112
|
-
}) => {
|
|
100
|
+
const headers = context.state.headers.map(({ sort: currentSort, ...header }) => {
|
|
113
101
|
let sort;
|
|
114
102
|
|
|
115
103
|
if (field) {
|
|
@@ -130,10 +118,10 @@ const actions = {
|
|
|
130
118
|
|
|
131
119
|
const params = context.getters.GET_LIST_PARAMS(query);
|
|
132
120
|
try {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
121
|
+
const { items = [], next = false } = await context.dispatch('api/GET_LIST', {
|
|
122
|
+
context,
|
|
123
|
+
params,
|
|
124
|
+
});
|
|
137
125
|
|
|
138
126
|
context.commit('SET', { path: 'dataList', value: items });
|
|
139
127
|
context.commit('SET', { path: 'isNextPage', value: next });
|
|
@@ -156,9 +144,7 @@ const actions = {
|
|
|
156
144
|
});
|
|
157
145
|
},
|
|
158
146
|
|
|
159
|
-
PATCH_ITEM_PROPERTY: async (context, {
|
|
160
|
-
item: _item, index, prop, value,
|
|
161
|
-
}) => {
|
|
147
|
+
PATCH_ITEM_PROPERTY: async (context, { item: _item, index, prop, value }) => {
|
|
162
148
|
const item = _item || context.state.dataList[index];
|
|
163
149
|
|
|
164
150
|
const { id, etag } = item;
|
|
@@ -197,8 +183,7 @@ const actions = {
|
|
|
197
183
|
await context.dispatch('LOAD_DATA_LIST');
|
|
198
184
|
|
|
199
185
|
/* if no items on current page after DELETE, move to prev page [WTEL-3793] */
|
|
200
|
-
if (!context.state.dataList.length && context.getters.FILTERS.page >
|
|
201
|
-
1) {
|
|
186
|
+
if (!context.state.dataList.length && context.getters.FILTERS.page > 1) {
|
|
202
187
|
await context.dispatch('SET_FILTER', {
|
|
203
188
|
name: 'page',
|
|
204
189
|
value: context.getters.FILTERS.page - 1,
|
|
@@ -215,10 +200,8 @@ const actions = {
|
|
|
215
200
|
}
|
|
216
201
|
},
|
|
217
202
|
|
|
218
|
-
DELETE_BULK: async (
|
|
219
|
-
context,
|
|
220
|
-
deleted,
|
|
221
|
-
) => Promise.allSettled(deleted.map((item) => context.dispatch('DELETE_SINGLE', item))),
|
|
203
|
+
DELETE_BULK: async (context, deleted) =>
|
|
204
|
+
Promise.allSettled(deleted.map((item) => context.dispatch('DELETE_SINGLE', item))),
|
|
222
205
|
|
|
223
206
|
SET_SELECTED: (context, selected) => {
|
|
224
207
|
context.commit('SET', { path: 'selected', value: selected });
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
import deepmerge from 'deepmerge';
|
|
2
2
|
|
|
3
|
-
const axiosMock =
|
|
4
|
-
{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
const axiosMock =
|
|
4
|
+
(customMock = {}) =>
|
|
5
|
+
() =>
|
|
6
|
+
deepmerge(
|
|
7
|
+
{
|
|
8
|
+
default: {
|
|
9
|
+
post: vi.fn(() => Promise.resolve({ data: {} })),
|
|
10
|
+
get: vi.fn(() => Promise.resolve({ data: {} })),
|
|
11
|
+
delete: vi.fn(() => Promise.resolve({ data: {} })),
|
|
12
|
+
put: vi.fn(() => Promise.resolve({ data: {} })),
|
|
13
|
+
patch: vi.fn(() => Promise.resolve({ data: {} })),
|
|
14
|
+
request: vi.fn(() => Promise.resolve({ data: {} })),
|
|
15
|
+
create: vi.fn().mockReturnThis(),
|
|
16
|
+
interceptors: {
|
|
17
|
+
request: {
|
|
18
|
+
use: vi.fn(),
|
|
19
|
+
eject: vi.fn(),
|
|
20
|
+
},
|
|
21
|
+
response: {
|
|
22
|
+
use: vi.fn(),
|
|
23
|
+
eject: vi.fn(),
|
|
24
|
+
},
|
|
25
|
+
},
|
|
18
26
|
},
|
|
19
27
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
customMock,
|
|
23
|
-
);
|
|
28
|
+
customMock,
|
|
29
|
+
);
|
|
24
30
|
|
|
25
31
|
export default axiosMock;
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
/* Check value is an integer or has n* decimal places */
|
|
3
3
|
import { helpers } from '@vuelidate/validators';
|
|
4
4
|
|
|
5
|
-
const decimalValidator = (count) =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
)
|
|
5
|
+
const decimalValidator = (count) =>
|
|
6
|
+
helpers.withParams(
|
|
7
|
+
{ count },
|
|
8
|
+
(value) => value % 1 == 0 || value.toString().split('.')[1].length <= count,
|
|
9
|
+
);
|
|
9
10
|
|
|
10
11
|
export default decimalValidator;
|
|
@@ -20,8 +20,7 @@ describe('websocketValidator', () => {
|
|
|
20
20
|
expect(websocketValidator('wss://example.com/ws')).toBe(true);
|
|
21
21
|
});
|
|
22
22
|
it('truthy case 7: dns name', () => {
|
|
23
|
-
expect(websocketValidator('wss://socket.socket.com/v3/channel_123?api_key=123'))
|
|
24
|
-
.toBe(true);
|
|
23
|
+
expect(websocketValidator('wss://socket.socket.com/v3/channel_123?api_key=123')).toBe(true);
|
|
25
24
|
});
|
|
26
25
|
it('falsy case 1: empty string', () => {
|
|
27
26
|
expect(websocketValidator('')).toBe(false);
|