@webitel/ui-sdk 24.10.3 → 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 -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
|
@@ -22,27 +22,13 @@ const token = localStorage.getItem('access-token');
|
|
|
22
22
|
const baseUrl = import.meta.env.VITE_API_URL;
|
|
23
23
|
|
|
24
24
|
const getMediaList = async (params) => {
|
|
25
|
-
const {
|
|
26
|
-
page,
|
|
27
|
-
size,
|
|
28
|
-
search,
|
|
29
|
-
sort,
|
|
30
|
-
fields,
|
|
31
|
-
id,
|
|
32
|
-
} = applyTransform(params, [
|
|
25
|
+
const { page, size, search, sort, fields, id } = applyTransform(params, [
|
|
33
26
|
merge(getDefaultGetParams()),
|
|
34
27
|
starToSearch('search'),
|
|
35
28
|
]);
|
|
36
29
|
|
|
37
30
|
try {
|
|
38
|
-
const response = await mediaService.searchMediaFile(
|
|
39
|
-
page,
|
|
40
|
-
size,
|
|
41
|
-
search,
|
|
42
|
-
sort,
|
|
43
|
-
fields,
|
|
44
|
-
id,
|
|
45
|
-
);
|
|
31
|
+
const response = await mediaService.searchMediaFile(page, size, search, sort, fields, id);
|
|
46
32
|
const { items, next } = applyTransform(response.data, [
|
|
47
33
|
snakeToCamel(),
|
|
48
34
|
merge(getDefaultGetListResponse()),
|
|
@@ -52,10 +38,7 @@ const getMediaList = async (params) => {
|
|
|
52
38
|
next,
|
|
53
39
|
};
|
|
54
40
|
} catch (err) {
|
|
55
|
-
throw applyTransform(err, [
|
|
56
|
-
|
|
57
|
-
notify,
|
|
58
|
-
]);
|
|
41
|
+
throw applyTransform(err, [notify]);
|
|
59
42
|
}
|
|
60
43
|
};
|
|
61
44
|
|
|
@@ -64,10 +47,7 @@ const getMedia = async ({ itemId }) => {
|
|
|
64
47
|
try {
|
|
65
48
|
return await instance.get(url);
|
|
66
49
|
} catch (err) {
|
|
67
|
-
throw applyTransform(err, [
|
|
68
|
-
|
|
69
|
-
notify,
|
|
70
|
-
]);
|
|
50
|
+
throw applyTransform(err, [notify]);
|
|
71
51
|
}
|
|
72
52
|
};
|
|
73
53
|
|
|
@@ -76,10 +56,7 @@ export const downloadMedia = async (id) => {
|
|
|
76
56
|
try {
|
|
77
57
|
return await instance.get(url);
|
|
78
58
|
} catch (err) {
|
|
79
|
-
throw applyTransform(err, [
|
|
80
|
-
|
|
81
|
-
notify,
|
|
82
|
-
]);
|
|
59
|
+
throw applyTransform(err, [notify]);
|
|
83
60
|
}
|
|
84
61
|
};
|
|
85
62
|
|
|
@@ -96,15 +73,10 @@ const addMedia = async (params) => {
|
|
|
96
73
|
formData.append('file', params.itemInstance);
|
|
97
74
|
try {
|
|
98
75
|
const response = await addMediaInstance.post(url, formData);
|
|
99
|
-
applyTransform(response, [
|
|
100
|
-
notify(() => ({ type: 'success', text: 'Successfully added' })),
|
|
101
|
-
]);
|
|
76
|
+
applyTransform(response, [notify(() => ({ type: 'success', text: 'Successfully added' }))]);
|
|
102
77
|
return response;
|
|
103
78
|
} catch (err) {
|
|
104
|
-
throw applyTransform(err, [
|
|
105
|
-
|
|
106
|
-
notify,
|
|
107
|
-
]);
|
|
79
|
+
throw applyTransform(err, [notify]);
|
|
108
80
|
}
|
|
109
81
|
};
|
|
110
82
|
|
|
@@ -113,17 +85,15 @@ const deleteMedia = async ({ id }) => {
|
|
|
113
85
|
const response = await mediaService.deleteMediaFile(id);
|
|
114
86
|
return applyTransform(response.data, []);
|
|
115
87
|
} catch (err) {
|
|
116
|
-
throw applyTransform(err, [
|
|
117
|
-
|
|
118
|
-
notify,
|
|
119
|
-
]);
|
|
88
|
+
throw applyTransform(err, [notify]);
|
|
120
89
|
}
|
|
121
90
|
};
|
|
122
91
|
|
|
123
|
-
const getMediaLookup = (params) =>
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
92
|
+
const getMediaLookup = (params) =>
|
|
93
|
+
getMediaList({
|
|
94
|
+
...params,
|
|
95
|
+
fields: params.fields || ['id', 'name'],
|
|
96
|
+
});
|
|
127
97
|
|
|
128
98
|
const MediaAPI = {
|
|
129
99
|
getList: getMediaList,
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import deepmerge from 'deepmerge';
|
|
2
2
|
|
|
3
|
-
const processing = (processing = {}) =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const processing = (processing = {}) =>
|
|
4
|
+
deepmerge(
|
|
5
|
+
{
|
|
6
|
+
enabled: false,
|
|
7
|
+
formSchema: {},
|
|
8
|
+
sec: 30,
|
|
9
|
+
renewalSec: 15,
|
|
10
|
+
},
|
|
11
|
+
processing,
|
|
12
|
+
);
|
|
9
13
|
|
|
10
14
|
export default processing;
|
|
@@ -68,17 +68,7 @@ const getQueuesList = async (params) => {
|
|
|
68
68
|
priority: '0',
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
const {
|
|
72
|
-
page,
|
|
73
|
-
size,
|
|
74
|
-
search,
|
|
75
|
-
sort,
|
|
76
|
-
fields,
|
|
77
|
-
id,
|
|
78
|
-
queueType,
|
|
79
|
-
team,
|
|
80
|
-
tags,
|
|
81
|
-
} = applyTransform(params, [
|
|
71
|
+
const { page, size, search, sort, fields, id, queueType, team, tags } = applyTransform(params, [
|
|
82
72
|
merge(getDefaultGetParams()),
|
|
83
73
|
starToSearch('search'),
|
|
84
74
|
]);
|
|
@@ -100,15 +90,11 @@ const getQueuesList = async (params) => {
|
|
|
100
90
|
merge(getDefaultGetListResponse()),
|
|
101
91
|
]);
|
|
102
92
|
return {
|
|
103
|
-
items: applyTransform(items, [
|
|
104
|
-
mergeEach(defaultObject),
|
|
105
|
-
]),
|
|
93
|
+
items: applyTransform(items, [mergeEach(defaultObject)]),
|
|
106
94
|
next,
|
|
107
95
|
};
|
|
108
96
|
} catch (err) {
|
|
109
|
-
throw applyTransform(err, [
|
|
110
|
-
notify,
|
|
111
|
-
]);
|
|
97
|
+
throw applyTransform(err, [notify]);
|
|
112
98
|
}
|
|
113
99
|
};
|
|
114
100
|
|
|
@@ -123,8 +109,7 @@ const getQueue = async ({ itemId: id }) => {
|
|
|
123
109
|
const copy = deepCopy(item);
|
|
124
110
|
try {
|
|
125
111
|
if (copy.variables) {
|
|
126
|
-
copy.variables = Object.keys(copy.variables)
|
|
127
|
-
.map((key) => ({
|
|
112
|
+
copy.variables = Object.keys(copy.variables).map((key) => ({
|
|
128
113
|
key,
|
|
129
114
|
value: copy.variables[key],
|
|
130
115
|
}));
|
|
@@ -150,9 +135,7 @@ const getQueue = async ({ itemId: id }) => {
|
|
|
150
135
|
responseHandler,
|
|
151
136
|
]);
|
|
152
137
|
} catch (err) {
|
|
153
|
-
throw applyTransform(err, [
|
|
154
|
-
notify,
|
|
155
|
-
]);
|
|
138
|
+
throw applyTransform(err, [notify]);
|
|
156
139
|
}
|
|
157
140
|
};
|
|
158
141
|
|
|
@@ -164,13 +147,9 @@ const addQueue = async ({ itemInstance }) => {
|
|
|
164
147
|
]);
|
|
165
148
|
try {
|
|
166
149
|
const response = await queueService.createQueue(item);
|
|
167
|
-
return applyTransform(response.data, [
|
|
168
|
-
snakeToCamel(doNotConvertKeys),
|
|
169
|
-
]);
|
|
150
|
+
return applyTransform(response.data, [snakeToCamel(doNotConvertKeys)]);
|
|
170
151
|
} catch (err) {
|
|
171
|
-
throw applyTransform(err, [
|
|
172
|
-
notify,
|
|
173
|
-
]);
|
|
152
|
+
throw applyTransform(err, [notify]);
|
|
174
153
|
}
|
|
175
154
|
};
|
|
176
155
|
|
|
@@ -182,30 +161,19 @@ const updateQueue = async ({ itemInstance, itemId: id }) => {
|
|
|
182
161
|
]);
|
|
183
162
|
try {
|
|
184
163
|
const response = await queueService.updateQueue(id, item);
|
|
185
|
-
return applyTransform(response.data, [
|
|
186
|
-
snakeToCamel(doNotConvertKeys),
|
|
187
|
-
]);
|
|
164
|
+
return applyTransform(response.data, [snakeToCamel(doNotConvertKeys)]);
|
|
188
165
|
} catch (err) {
|
|
189
|
-
throw applyTransform(err, [
|
|
190
|
-
notify,
|
|
191
|
-
]);
|
|
166
|
+
throw applyTransform(err, [notify]);
|
|
192
167
|
}
|
|
193
168
|
};
|
|
194
169
|
|
|
195
170
|
const patchQueue = async ({ id, changes }) => {
|
|
196
|
-
const item = applyTransform(changes, [
|
|
197
|
-
sanitize(fieldsToSend),
|
|
198
|
-
camelToSnake(doNotConvertKeys),
|
|
199
|
-
]);
|
|
171
|
+
const item = applyTransform(changes, [sanitize(fieldsToSend), camelToSnake(doNotConvertKeys)]);
|
|
200
172
|
try {
|
|
201
173
|
const response = await queueService.patchQueue(id, item);
|
|
202
|
-
return applyTransform(response.data, [
|
|
203
|
-
snakeToCamel(doNotConvertKeys),
|
|
204
|
-
]);
|
|
174
|
+
return applyTransform(response.data, [snakeToCamel(doNotConvertKeys)]);
|
|
205
175
|
} catch (err) {
|
|
206
|
-
throw applyTransform(err, [
|
|
207
|
-
notify,
|
|
208
|
-
]);
|
|
176
|
+
throw applyTransform(err, [notify]);
|
|
209
177
|
}
|
|
210
178
|
};
|
|
211
179
|
|
|
@@ -214,37 +182,24 @@ const deleteQueue = async ({ id }) => {
|
|
|
214
182
|
const response = await queueService.deleteQueue(id);
|
|
215
183
|
return applyTransform(response.data, []);
|
|
216
184
|
} catch (err) {
|
|
217
|
-
throw applyTransform(err, [
|
|
218
|
-
notify,
|
|
219
|
-
]);
|
|
185
|
+
throw applyTransform(err, [notify]);
|
|
220
186
|
}
|
|
221
187
|
};
|
|
222
188
|
|
|
223
|
-
const getQueuesLookup = (params) =>
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
189
|
+
const getQueuesLookup = (params) =>
|
|
190
|
+
getQueuesList({
|
|
191
|
+
...params,
|
|
192
|
+
fields: params.fields || ['id', 'name', 'type'],
|
|
193
|
+
});
|
|
227
194
|
|
|
228
195
|
const getQueuesTags = async (params) => {
|
|
229
|
-
const {
|
|
230
|
-
page,
|
|
231
|
-
size,
|
|
232
|
-
search,
|
|
233
|
-
sort,
|
|
234
|
-
fields,
|
|
235
|
-
} = applyTransform(params, [
|
|
196
|
+
const { page, size, search, sort, fields } = applyTransform(params, [
|
|
236
197
|
merge(getDefaultGetParams()),
|
|
237
198
|
starToSearch(),
|
|
238
199
|
camelToSnake(doNotConvertKeys),
|
|
239
200
|
]);
|
|
240
201
|
try {
|
|
241
|
-
const response = await queueService.searchQueueTags(
|
|
242
|
-
page,
|
|
243
|
-
size,
|
|
244
|
-
search,
|
|
245
|
-
sort,
|
|
246
|
-
fields,
|
|
247
|
-
);
|
|
202
|
+
const response = await queueService.searchQueueTags(page, size, search, sort, fields);
|
|
248
203
|
const { items, next } = applyTransform(response.data, [
|
|
249
204
|
snakeToCamel(doNotConvertKeys),
|
|
250
205
|
merge(getDefaultGetListResponse()),
|
|
@@ -254,10 +209,7 @@ const getQueuesTags = async (params) => {
|
|
|
254
209
|
next,
|
|
255
210
|
};
|
|
256
211
|
} catch (err) {
|
|
257
|
-
throw applyTransform(err, [
|
|
258
|
-
|
|
259
|
-
notify,
|
|
260
|
-
]);
|
|
212
|
+
throw applyTransform(err, [notify]);
|
|
261
213
|
}
|
|
262
214
|
};
|
|
263
215
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import deepCopy from 'deep-copy';
|
|
2
|
-
import ApplicationsAccess
|
|
3
|
-
from '../../../modules/Userinfo/classes/ApplicationsAccess.js';
|
|
2
|
+
import ApplicationsAccess from '../../../modules/Userinfo/classes/ApplicationsAccess.js';
|
|
4
3
|
import {
|
|
5
4
|
getDefaultGetListResponse,
|
|
6
5
|
getDefaultGetParams,
|
|
@@ -49,9 +48,7 @@ const getRoleList = async (params) => {
|
|
|
49
48
|
next,
|
|
50
49
|
};
|
|
51
50
|
} catch (err) {
|
|
52
|
-
throw applyTransform(err, [
|
|
53
|
-
notify,
|
|
54
|
-
]);
|
|
51
|
+
throw applyTransform(err, [notify]);
|
|
55
52
|
}
|
|
56
53
|
};
|
|
57
54
|
|
|
@@ -79,9 +76,7 @@ const getRole = async ({ itemId: id }) => {
|
|
|
79
76
|
itemResponseHandler,
|
|
80
77
|
]);
|
|
81
78
|
} catch (err) {
|
|
82
|
-
throw applyTransform(err, [
|
|
83
|
-
notify,
|
|
84
|
-
]);
|
|
79
|
+
throw applyTransform(err, [notify]);
|
|
85
80
|
}
|
|
86
81
|
};
|
|
87
82
|
|
|
@@ -107,9 +102,7 @@ const getExtendedRoles = async (params) => {
|
|
|
107
102
|
next,
|
|
108
103
|
};
|
|
109
104
|
} catch (err) {
|
|
110
|
-
throw applyTransform(err, [
|
|
111
|
-
notify,
|
|
112
|
-
]);
|
|
105
|
+
throw applyTransform(err, [notify]);
|
|
113
106
|
}
|
|
114
107
|
};
|
|
115
108
|
|
|
@@ -121,13 +114,9 @@ const addRole = async ({ itemInstance }) => {
|
|
|
121
114
|
]);
|
|
122
115
|
try {
|
|
123
116
|
const response = await instance.post(baseUrl, item);
|
|
124
|
-
return applyTransform(response.data, [
|
|
125
|
-
snakeToCamel(),
|
|
126
|
-
]);
|
|
117
|
+
return applyTransform(response.data, [snakeToCamel()]);
|
|
127
118
|
} catch (err) {
|
|
128
|
-
throw applyTransform(err, [
|
|
129
|
-
notify,
|
|
130
|
-
]);
|
|
119
|
+
throw applyTransform(err, [notify]);
|
|
131
120
|
}
|
|
132
121
|
};
|
|
133
122
|
|
|
@@ -141,13 +130,9 @@ const updateRole = async ({ itemInstance, itemId: id }) => {
|
|
|
141
130
|
const url = `${baseUrl}/${id}`;
|
|
142
131
|
try {
|
|
143
132
|
const response = await instance.put(url, item);
|
|
144
|
-
return applyTransform(response.data, [
|
|
145
|
-
snakeToCamel(),
|
|
146
|
-
]);
|
|
133
|
+
return applyTransform(response.data, [snakeToCamel()]);
|
|
147
134
|
} catch (err) {
|
|
148
|
-
throw applyTransform(err, [
|
|
149
|
-
notify,
|
|
150
|
-
]);
|
|
135
|
+
throw applyTransform(err, [notify]);
|
|
151
136
|
}
|
|
152
137
|
};
|
|
153
138
|
|
|
@@ -157,16 +142,15 @@ const deleteRole = async ({ id }) => {
|
|
|
157
142
|
const response = await instance.delete(url);
|
|
158
143
|
return applyTransform(response.data, []);
|
|
159
144
|
} catch (err) {
|
|
160
|
-
throw applyTransform(err, [
|
|
161
|
-
notify,
|
|
162
|
-
]);
|
|
145
|
+
throw applyTransform(err, [notify]);
|
|
163
146
|
}
|
|
164
147
|
};
|
|
165
148
|
|
|
166
|
-
const getRolesLookup = (params) =>
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
149
|
+
const getRolesLookup = (params) =>
|
|
150
|
+
getRoleList({
|
|
151
|
+
...params,
|
|
152
|
+
fields: params.fields || ['id', 'name'],
|
|
153
|
+
});
|
|
170
154
|
|
|
171
155
|
const PERMISSIONS_LIST_URL = '/permissions';
|
|
172
156
|
|
|
@@ -192,9 +176,7 @@ const getPermissionsOptions = async (params) => {
|
|
|
192
176
|
next,
|
|
193
177
|
};
|
|
194
178
|
} catch (err) {
|
|
195
|
-
throw applyTransform(err, [
|
|
196
|
-
notify,
|
|
197
|
-
]);
|
|
179
|
+
throw applyTransform(err, [notify]);
|
|
198
180
|
}
|
|
199
181
|
};
|
|
200
182
|
|
|
@@ -12,9 +12,11 @@ describe('UsersAPI', () => {
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
it('correctly computes "getList" method api call', async () => {
|
|
15
|
-
const get = vi.fn(() =>
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const get = vi.fn(() =>
|
|
16
|
+
Promise.resolve({
|
|
17
|
+
data: {},
|
|
18
|
+
}),
|
|
19
|
+
);
|
|
18
20
|
|
|
19
21
|
instanceMock.get = get;
|
|
20
22
|
|
|
@@ -39,14 +41,14 @@ describe('UsersAPI', () => {
|
|
|
39
41
|
status: '',
|
|
40
42
|
shouldCaseConvert: '',
|
|
41
43
|
},
|
|
42
|
-
],
|
|
44
|
+
],
|
|
45
|
+
next: true,
|
|
43
46
|
};
|
|
44
47
|
|
|
45
48
|
const response = {
|
|
46
49
|
data: {
|
|
47
|
-
items: [
|
|
48
|
-
|
|
49
|
-
], next: true,
|
|
50
|
+
items: [{ id: 1, should_case_convert: '' }],
|
|
51
|
+
next: true,
|
|
50
52
|
},
|
|
51
53
|
};
|
|
52
54
|
|
|
@@ -65,9 +67,11 @@ describe('UsersAPI', () => {
|
|
|
65
67
|
};
|
|
66
68
|
const url = '/users/1';
|
|
67
69
|
|
|
68
|
-
const get = vi.fn(() =>
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
const get = vi.fn(() =>
|
|
71
|
+
Promise.resolve({
|
|
72
|
+
data: {},
|
|
73
|
+
}),
|
|
74
|
+
);
|
|
71
75
|
|
|
72
76
|
instanceMock.get = get;
|
|
73
77
|
|
|
@@ -79,9 +83,15 @@ describe('UsersAPI', () => {
|
|
|
79
83
|
|
|
80
84
|
it('correctly computes "get" method output', async () => {
|
|
81
85
|
const output = {
|
|
82
|
-
id: 1,
|
|
86
|
+
id: 1,
|
|
87
|
+
device: {},
|
|
88
|
+
devices: [],
|
|
89
|
+
license: [],
|
|
90
|
+
roles: [],
|
|
91
|
+
variables: [
|
|
83
92
|
{
|
|
84
|
-
key: '',
|
|
93
|
+
key: '',
|
|
94
|
+
value: '',
|
|
85
95
|
},
|
|
86
96
|
],
|
|
87
97
|
};
|
|
@@ -115,9 +125,11 @@ describe('UsersAPI', () => {
|
|
|
115
125
|
|
|
116
126
|
const url = '/users';
|
|
117
127
|
|
|
118
|
-
const post = vi.fn(() =>
|
|
119
|
-
|
|
120
|
-
|
|
128
|
+
const post = vi.fn(() =>
|
|
129
|
+
Promise.resolve({
|
|
130
|
+
data: {},
|
|
131
|
+
}),
|
|
132
|
+
);
|
|
121
133
|
|
|
122
134
|
instanceMock.post = post;
|
|
123
135
|
|
|
@@ -164,9 +176,11 @@ describe('UsersAPI', () => {
|
|
|
164
176
|
|
|
165
177
|
const url = '/users/1';
|
|
166
178
|
|
|
167
|
-
const put = vi.fn(() =>
|
|
168
|
-
|
|
169
|
-
|
|
179
|
+
const put = vi.fn(() =>
|
|
180
|
+
Promise.resolve({
|
|
181
|
+
data: {},
|
|
182
|
+
}),
|
|
183
|
+
);
|
|
170
184
|
|
|
171
185
|
instanceMock.put = put;
|
|
172
186
|
|
|
@@ -195,8 +209,7 @@ describe('UsersAPI', () => {
|
|
|
195
209
|
|
|
196
210
|
const UsersAPI = (await import('../users.js')).default;
|
|
197
211
|
|
|
198
|
-
expect(await UsersAPI.update({ itemInstance: {}, itemId: 1 }))
|
|
199
|
-
.toEqual(output);
|
|
212
|
+
expect(await UsersAPI.update({ itemInstance: {}, itemId: 1 })).toEqual(output);
|
|
200
213
|
});
|
|
201
214
|
|
|
202
215
|
it('correctly computes "patch" method api call', async () => {
|
|
@@ -213,9 +226,11 @@ describe('UsersAPI', () => {
|
|
|
213
226
|
|
|
214
227
|
const url = '/users/1';
|
|
215
228
|
|
|
216
|
-
const patch = vi.fn(() =>
|
|
217
|
-
|
|
218
|
-
|
|
229
|
+
const patch = vi.fn(() =>
|
|
230
|
+
Promise.resolve({
|
|
231
|
+
data: {},
|
|
232
|
+
}),
|
|
233
|
+
);
|
|
219
234
|
|
|
220
235
|
instanceMock.patch = patch;
|
|
221
236
|
|
|
@@ -232,9 +247,11 @@ describe('UsersAPI', () => {
|
|
|
232
247
|
|
|
233
248
|
const url = '/users/1?permanent=true';
|
|
234
249
|
|
|
235
|
-
const _delete = vi.fn(() =>
|
|
236
|
-
|
|
237
|
-
|
|
250
|
+
const _delete = vi.fn(() =>
|
|
251
|
+
Promise.resolve({
|
|
252
|
+
data: {},
|
|
253
|
+
}),
|
|
254
|
+
);
|
|
238
255
|
|
|
239
256
|
instanceMock.delete = _delete;
|
|
240
257
|
|
|
@@ -57,15 +57,11 @@ const getUsersList = async (params) => {
|
|
|
57
57
|
merge(getDefaultGetListResponse()),
|
|
58
58
|
]);
|
|
59
59
|
return {
|
|
60
|
-
items: applyTransform(items, [
|
|
61
|
-
mergeEach(defaultObject),
|
|
62
|
-
]),
|
|
60
|
+
items: applyTransform(items, [mergeEach(defaultObject)]),
|
|
63
61
|
next,
|
|
64
62
|
};
|
|
65
63
|
} catch (err) {
|
|
66
|
-
throw applyTransform(err, [
|
|
67
|
-
notify,
|
|
68
|
-
]);
|
|
64
|
+
throw applyTransform(err, [notify]);
|
|
69
65
|
}
|
|
70
66
|
};
|
|
71
67
|
|
|
@@ -75,16 +71,13 @@ const getUser = async ({ itemId: id }) => {
|
|
|
75
71
|
license: [],
|
|
76
72
|
devices: [],
|
|
77
73
|
device: {},
|
|
78
|
-
variables: [
|
|
79
|
-
{ key: '', value: '' },
|
|
80
|
-
],
|
|
74
|
+
variables: [{ key: '', value: '' }],
|
|
81
75
|
};
|
|
82
76
|
|
|
83
77
|
const itemResponseHandler = (item) => {
|
|
84
78
|
const copy = deepCopy(item);
|
|
85
79
|
if (copy.license) {
|
|
86
80
|
copy.license.forEach((item) => {
|
|
87
|
-
|
|
88
81
|
item.name = item.prod;
|
|
89
82
|
});
|
|
90
83
|
}
|
|
@@ -109,9 +102,7 @@ const getUser = async ({ itemId: id }) => {
|
|
|
109
102
|
itemResponseHandler,
|
|
110
103
|
]);
|
|
111
104
|
} catch (err) {
|
|
112
|
-
throw applyTransform(err, [
|
|
113
|
-
notify,
|
|
114
|
-
]);
|
|
105
|
+
throw applyTransform(err, [notify]);
|
|
115
106
|
}
|
|
116
107
|
};
|
|
117
108
|
|
|
@@ -142,13 +133,9 @@ const addUser = async ({ itemInstance }) => {
|
|
|
142
133
|
]);
|
|
143
134
|
try {
|
|
144
135
|
const response = await instance.post(baseUrl, item);
|
|
145
|
-
return applyTransform(response.data, [
|
|
146
|
-
snakeToCamel(['profile']),
|
|
147
|
-
]);
|
|
136
|
+
return applyTransform(response.data, [snakeToCamel(['profile'])]);
|
|
148
137
|
} catch (err) {
|
|
149
|
-
throw applyTransform(err, [
|
|
150
|
-
notify,
|
|
151
|
-
]);
|
|
138
|
+
throw applyTransform(err, [notify]);
|
|
152
139
|
}
|
|
153
140
|
};
|
|
154
141
|
|
|
@@ -162,49 +149,31 @@ const updateUser = async ({ itemInstance, itemId: id }) => {
|
|
|
162
149
|
const url = `${baseUrl}/${id}`;
|
|
163
150
|
try {
|
|
164
151
|
const response = await instance.put(url, item);
|
|
165
|
-
return applyTransform(response.data, [
|
|
166
|
-
snakeToCamel(['profile']),
|
|
167
|
-
]);
|
|
152
|
+
return applyTransform(response.data, [snakeToCamel(['profile'])]);
|
|
168
153
|
} catch (err) {
|
|
169
|
-
throw applyTransform(err, [
|
|
170
|
-
notify,
|
|
171
|
-
]);
|
|
154
|
+
throw applyTransform(err, [notify]);
|
|
172
155
|
}
|
|
173
156
|
};
|
|
174
157
|
|
|
175
158
|
const patchUser = async ({ changes, id }) => {
|
|
176
|
-
const body = applyTransform(changes, [
|
|
177
|
-
sanitize(fieldsToSend),
|
|
178
|
-
camelToSnake(['profile']),
|
|
179
|
-
]);
|
|
159
|
+
const body = applyTransform(changes, [sanitize(fieldsToSend), camelToSnake(['profile'])]);
|
|
180
160
|
const url = `${baseUrl}/${id}`;
|
|
181
161
|
try {
|
|
182
162
|
const response = await instance.patch(url, body);
|
|
183
|
-
return applyTransform(response.data, [
|
|
184
|
-
snakeToCamel(['profile']),
|
|
185
|
-
]);
|
|
163
|
+
return applyTransform(response.data, [snakeToCamel(['profile'])]);
|
|
186
164
|
} catch (err) {
|
|
187
|
-
throw applyTransform(err, [
|
|
188
|
-
notify,
|
|
189
|
-
]);
|
|
165
|
+
throw applyTransform(err, [notify]);
|
|
190
166
|
}
|
|
191
167
|
};
|
|
192
168
|
|
|
193
169
|
const patchUserPresence = async ({ changes, id }) => {
|
|
194
|
-
const body = applyTransform(changes, [
|
|
195
|
-
sanitize(fieldsToSend),
|
|
196
|
-
camelToSnake(['profile']),
|
|
197
|
-
]);
|
|
170
|
+
const body = applyTransform(changes, [sanitize(fieldsToSend), camelToSnake(['profile'])]);
|
|
198
171
|
const url = `${baseUrl}/${id}/presence`;
|
|
199
172
|
try {
|
|
200
173
|
const response = await instance.patch(url, body);
|
|
201
|
-
return applyTransform(response.data, [
|
|
202
|
-
snakeToCamel(['profile']),
|
|
203
|
-
]);
|
|
174
|
+
return applyTransform(response.data, [snakeToCamel(['profile'])]);
|
|
204
175
|
} catch (err) {
|
|
205
|
-
throw applyTransform(err, [
|
|
206
|
-
notify,
|
|
207
|
-
]);
|
|
176
|
+
throw applyTransform(err, [notify]);
|
|
208
177
|
}
|
|
209
178
|
};
|
|
210
179
|
|
|
@@ -215,16 +184,15 @@ const deleteUser = async ({ id }) => {
|
|
|
215
184
|
const response = await instance.delete(url);
|
|
216
185
|
return applyTransform(response.data, []);
|
|
217
186
|
} catch (err) {
|
|
218
|
-
throw applyTransform(err, [
|
|
219
|
-
notify,
|
|
220
|
-
]);
|
|
187
|
+
throw applyTransform(err, [notify]);
|
|
221
188
|
}
|
|
222
189
|
};
|
|
223
190
|
|
|
224
|
-
const getUsersLookup = (params) =>
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
191
|
+
const getUsersLookup = (params) =>
|
|
192
|
+
getUsersList({
|
|
193
|
+
...params,
|
|
194
|
+
fields: params.fields || ['id', 'name'],
|
|
195
|
+
});
|
|
228
196
|
|
|
229
197
|
const logoutUser = async ({ id }) => {
|
|
230
198
|
const url = `${baseUrl}/${id}/logout`;
|
|
@@ -232,10 +200,7 @@ const logoutUser = async ({ id }) => {
|
|
|
232
200
|
const response = await instance.post(url, {});
|
|
233
201
|
return applyTransform(response.data, []);
|
|
234
202
|
} catch (err) {
|
|
235
|
-
throw applyTransform(err, [
|
|
236
|
-
|
|
237
|
-
notify,
|
|
238
|
-
]);
|
|
203
|
+
throw applyTransform(err, [notify]);
|
|
239
204
|
}
|
|
240
205
|
};
|
|
241
206
|
|