@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.
Files changed (202) hide show
  1. package/dist/ui-sdk.css +1 -1
  2. package/dist/ui-sdk.js +111 -114
  3. package/dist/ui-sdk.umd.cjs +8 -8
  4. package/package.json +6 -4
  5. package/src/api/axios/generateInstance.js +1 -4
  6. package/src/api/clients/agents/agents.js +31 -78
  7. package/src/api/clients/buckets/buckets.js +17 -57
  8. package/src/api/clients/calendars/calendars.js +18 -71
  9. package/src/api/clients/chatGateways/chatGateways.js +23 -61
  10. package/src/api/clients/chatGateways/defaults/webChatGateway.js +6 -8
  11. package/src/api/clients/chatGateways/enums/WebchatAlternativeChannel.enum.js +3 -3
  12. package/src/api/clients/communications/communications.js +20 -62
  13. package/src/api/clients/configurations/configurations.js +18 -3
  14. package/src/api/clients/flows/flow.js +17 -60
  15. package/src/api/clients/gateways/gateways.js +20 -59
  16. package/src/api/clients/index.js +1 -1
  17. package/src/api/clients/lists/blacklists.js +18 -60
  18. package/src/api/clients/media/media.js +13 -43
  19. package/src/api/clients/queues/defaults/processing.js +10 -6
  20. package/src/api/clients/queues/queues.js +21 -69
  21. package/src/api/clients/roles/roles.js +15 -33
  22. package/src/api/clients/users/__tests__/users.spec.js +43 -26
  23. package/src/api/clients/users/users.js +21 -56
  24. package/src/api/crm/contactChatMessagesHistory.js +8 -23
  25. package/src/api/crm/contacts.js +235 -0
  26. package/src/api/crm/enums/ContactsSearchMode.js +9 -0
  27. package/src/api/crm/index.js +2 -3
  28. package/src/api/defaults/getDefaultGetParams/getDefaultGetParams.js +1 -4
  29. package/src/api/defaults/getDefaultInstance/getDefaultInstance.js +10 -11
  30. package/src/api/defaults/getDefaultOpenAPIConfig/getDefaultOpenAPIConfig.js +6 -5
  31. package/src/api/defaults/index.js +2 -4
  32. package/src/api/history/index.js +1 -3
  33. package/src/api/history/transcript/callTranscript.js +10 -30
  34. package/src/api/interceptors/request/updateToken.interceptor.js +1 -2
  35. package/src/api/transformers/merge/merge.transformer.js +4 -1
  36. package/src/api/transformers/mergeEach/mergeEach.transformer.js +4 -4
  37. package/src/api/transformers/notify/notify.transformer.js +9 -6
  38. package/src/api/transformers/starToSearch/starToSearch.transformer.js +8 -6
  39. package/src/components/index.js +3 -6
  40. package/src/components/on-demand/wt-cc-agent-status-timers/__tests__/wt-cc-agent-status-timers.spec.js +2 -4
  41. package/src/components/transitions/wt-expand-transition.vue +2 -3
  42. package/src/components/wt-app-header/__tests__/WtAppNavigator.spec.js +1 -2
  43. package/src/components/wt-app-header/__tests__/WtHeaderActions.spec.js +1 -2
  44. package/src/components/wt-app-header/wt-app-navigator.vue +15 -9
  45. package/src/components/wt-avatar/wt-avatar.vue +8 -3
  46. package/src/components/wt-button/wt-button.vue +0 -1
  47. package/src/components/wt-button-select/__tests__/WtButtonSelect.spec.js +4 -5
  48. package/src/components/wt-button-select/wt-button-select.vue +0 -1
  49. package/src/components/wt-context-menu/wt-context-menu.vue +32 -35
  50. package/src/components/wt-dummy/wt-dummy.vue +2 -5
  51. package/src/components/wt-expansion-panel/wt-expansion-panel.vue +10 -7
  52. package/src/components/wt-filters-panel-wrapper/__tests__/WtFiltersPanelWrapper.spec.js +4 -8
  53. package/src/components/wt-icon/wt-icon.vue +0 -1
  54. package/src/components/wt-indicator/__tests__/WtIndicator.spec.js +3 -2
  55. package/src/components/wt-indicator/wt-indicator.vue +10 -1
  56. package/src/components/wt-input/wt-input.vue +7 -10
  57. package/src/components/wt-item-link/wt-item-link.vue +7 -4
  58. package/src/components/wt-navigation-bar/__tests__/WtNavigationBar.spec.js +7 -15
  59. package/src/components/wt-navigation-bar/wt-navigation-bar.vue +7 -7
  60. package/src/components/wt-notification/wt-notification.vue +1 -2
  61. package/src/components/wt-notifications-bar/__tests__/WtNotificationsBar.spec.js +6 -3
  62. package/src/components/wt-notifications-bar/wt-notifications-bar.vue +4 -1
  63. package/src/components/wt-page-wrapper/__tests__/WtPageWrapper.spec.js +1 -2
  64. package/src/components/wt-pagination/wt-pagination.vue +1 -3
  65. package/src/components/wt-player/scripts/__tests__/createPlyrURL.spec.js +4 -8
  66. package/src/components/wt-player/wt-player.vue +13 -4
  67. package/src/components/wt-popup/wt-popup.vue +2 -1
  68. package/src/components/wt-search-bar/wt-search-bar.vue +1 -1
  69. package/src/components/wt-select/mixins/multiselectMixin.js +2 -5
  70. package/src/components/wt-select/wt-select.vue +12 -11
  71. package/src/components/wt-slider/wt-slider.vue +4 -2
  72. package/src/components/wt-status-select/wt-status-select.vue +10 -6
  73. package/src/components/wt-stepper/wt-stepper.vue +6 -4
  74. package/src/components/wt-switcher/wt-switcher.vue +1 -3
  75. package/src/components/wt-table/__tests__/WtTable.spec.js +2 -5
  76. package/src/components/wt-table/wt-table.vue +18 -16
  77. package/src/components/wt-table-column-select/wt-table-column-select.vue +9 -8
  78. package/src/components/wt-tabs/wt-tabs.vue +1 -3
  79. package/src/components/wt-tags-input/mixin/taggableMixin.js +7 -7
  80. package/src/components/wt-textarea/__tests__/WtTextarea.spec.js +2 -4
  81. package/src/components/wt-textarea/wt-textarea.vue +3 -2
  82. package/src/components/wt-timepicker/wt-timepicker.vue +1 -3
  83. package/src/components/wt-tooltip/_internals/useTooltipTriggerSubscriptions.js +1 -3
  84. package/src/components/wt-tooltip/_internals/wt-tooltip-floating.vue +8 -12
  85. package/src/components/wt-tooltip/wt-tooltip.vue +13 -13
  86. package/src/composables/useCachedInterval/__tests__/useCachedInterval.spec.js +6 -4
  87. package/src/composables/useCachedInterval/useCachedInterval.js +3 -8
  88. package/src/composables/useRepresentableAgentPauseCause/__tests__/useRepresentableAgentPauseCause.spec.js +11 -33
  89. package/src/composables/useRepresentableAgentPauseCause/useRepresentableAgentPauseCause.js +11 -9
  90. package/src/enums/WebitelApplications/AdminSections.enum.js +28 -28
  91. package/src/enums/WebitelApplications/CrmSections.enum.js +1 -1
  92. package/src/locale/en/en.js +12 -15
  93. package/src/locale/es/es.js +4 -8
  94. package/src/locale/kz/kz.js +5 -7
  95. package/src/locale/ru/ru.js +7 -11
  96. package/src/locale/ua/ua.js +13 -17
  97. package/src/mixins/dataFilterMixins/__tests__/enumFilterMixin.spec.js +1 -2
  98. package/src/mixins/dataFilterMixins/__tests__/sortFilterMixin.spec.js +4 -2
  99. package/src/mixins/dataFilterMixins/__tests__/urlControllerMixin.spec.js +4 -1
  100. package/src/mixins/dataFilterMixins/_urlControllerMixin/_urlControllerMixin.js +1 -1
  101. package/src/mixins/dataFilterMixins/apiFilterMixin.js +1 -2
  102. package/src/mixins/dataFilterMixins/baseFilterMixin/baseFilterMixin.js +1 -2
  103. package/src/mixins/dataFilterMixins/enumFilterMixin.js +5 -6
  104. package/src/mixins/dataFilterMixins/paginationFilterMixin.js +1 -2
  105. package/src/mixins/dataFilterMixins/sortFilterMixin.js +1 -4
  106. package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +1 -2
  107. package/src/mixins/validationMixin/useValidation.js +25 -19
  108. package/src/mixins/validationMixin/validationMixin.js +22 -10
  109. package/src/modules/AgentStatusSelect/api/pause-cause.js +3 -11
  110. package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js +16 -18
  111. package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-pause-cause-popup.spec.js +1 -2
  112. package/src/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue +12 -12
  113. package/src/modules/AgentStatusSelect/components/_internals/wt-cc-status-select-error-popup.vue +0 -1
  114. package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +20 -7
  115. package/src/modules/Appearance/components/__tests__/wt-dark-mode-switcher.spec.js +2 -4
  116. package/src/modules/Appearance/components/wt-dark-mode-switcher.vue +0 -1
  117. package/src/modules/AuditForm/components/__tests__/audit-form-question-read-wrapper.spec.js +1 -2
  118. package/src/modules/AuditForm/components/__tests__/audit-form-question-write-wrapper.spec.js +15 -25
  119. package/src/modules/AuditForm/components/__tests__/audit-form.spec.js +11 -20
  120. package/src/modules/AuditForm/components/audit-form-question-read-wrapper.vue +1 -4
  121. package/src/modules/AuditForm/components/audit-form-question-write-wrapper.vue +4 -7
  122. package/src/modules/AuditForm/components/audit-form-question.vue +18 -17
  123. package/src/modules/AuditForm/components/audit-form.vue +12 -14
  124. package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options-write-row.spec.js +1 -2
  125. package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options.spec.js +1 -3
  126. package/src/modules/AuditForm/components/questions/options/audit-form-question-options-write-row.vue +11 -15
  127. package/src/modules/AuditForm/components/questions/options/audit-form-question-options.vue +1 -4
  128. package/src/modules/AuditForm/components/questions/score/audit-form-question-score.vue +16 -20
  129. package/src/modules/AuditForm/schemas/AuditFormQuestionOptionsSchema.js +1 -3
  130. package/src/modules/CSVExport/CSVExport.js +3 -7
  131. package/src/modules/CSVExport/XLSExport.js +6 -7
  132. package/src/modules/CSVExport/__tests__/CSVExport.spec.js +1 -2
  133. package/src/modules/CSVExport/mixins/exportCSVMixin.js +2 -5
  134. package/src/modules/CSVExport/mixins/exportXLSMixin.js +2 -4
  135. package/src/modules/CardStoreModule/store/CardStoreModule.js +2 -6
  136. package/src/modules/DeleteConfirmationPopup/__tests__/delete-confirmation-popup.spec.js +13 -10
  137. package/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue +5 -14
  138. package/src/modules/FilesExport/FilesExport.js +4 -3
  139. package/src/modules/FilesExport/__tests__/FilesExport.spec.js +12 -12
  140. package/src/modules/FilesExport/mixins/exportFilesMixin.js +6 -7
  141. package/src/modules/FilesExport/scripts/generateMediaURL.js +1 -2
  142. package/src/modules/Filters/classes/BaseFilterSchema.js +21 -25
  143. package/src/modules/Filters/components/filter-pagination.vue +7 -3
  144. package/src/modules/Filters/components/filter-search.vue +21 -12
  145. package/src/modules/Filters/components/filter-table-fields.vue +1 -3
  146. package/src/modules/Filters/scripts/getters/index.js +1 -5
  147. package/src/modules/Filters/scripts/getters/queryGetter.js +2 -3
  148. package/src/modules/Filters/scripts/restores/index.js +1 -4
  149. package/src/modules/Filters/scripts/setters/index.js +1 -5
  150. package/src/modules/Filters/scripts/setters/querySetter.js +24 -22
  151. package/src/modules/Filters/scripts/utils/changeRouteQuery.js +16 -15
  152. package/src/modules/Filters/store/FiltersStoreModule.js +51 -45
  153. package/src/modules/Filters/store/__tests__/FiltersStoreModule.spec.js +51 -45
  154. package/src/modules/Notifications/store/NotificationsStoreModule.js +41 -38
  155. package/src/modules/Notifications/store/__tests__/NotificationsStoreModule.actions.spec.js +6 -6
  156. package/src/modules/QueryFilters/api/defaults.js +2 -3
  157. package/src/modules/QueryFilters/classes/ApiFilterSchema.js +1 -4
  158. package/src/modules/QueryFilters/classes/EnumFilterSchema.js +1 -4
  159. package/src/modules/QueryFilters/components/__tests__/filter-datetime.spec.js +1 -2
  160. package/src/modules/QueryFilters/components/__tests__/filter-from-to.spec.js +2 -4
  161. package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +2 -4
  162. package/src/modules/QueryFilters/components/filter-table-fields.vue +1 -5
  163. package/src/modules/QueryFilters/mixins/__tests__/apiFilterMixin.spec.js +4 -3
  164. package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +2 -4
  165. package/src/modules/QueryFilters/mixins/__tests__/sortFilterMixin.spec.js +4 -2
  166. package/src/modules/QueryFilters/mixins/__tests__/urlControllerMixin.spec.js +4 -1
  167. package/src/modules/QueryFilters/mixins/_urlControllerMixin/_urlControllerMixin.js +1 -1
  168. package/src/modules/QueryFilters/mixins/apiFilterMixin.js +1 -1
  169. package/src/modules/QueryFilters/mixins/baseFilterMixin/baseFilterMixin.js +4 -2
  170. package/src/modules/QueryFilters/mixins/enumFilterMixin.js +9 -11
  171. package/src/modules/QueryFilters/mixins/paginationFilterMixin.js +2 -4
  172. package/src/modules/QueryFilters/mixins/sortFilterMixin.js +2 -5
  173. package/src/modules/QueryFilters/store/QueryFiltersStoreModule.js +13 -17
  174. package/src/modules/QueryFilters/store/__tests__/QueryFiltersStoreModule.spec.js +15 -16
  175. package/src/modules/TableStoreModule/store/TableStoreModule.js +14 -33
  176. package/src/modules/TableStoreModule/store/__tests__/TableStoreModule.spec.js +69 -83
  177. package/src/modules/Userinfo/api/userinfo.js +6 -19
  178. package/src/modules/Userinfo/classes/ApplicationsAccess.js +5 -12
  179. package/src/modules/Userinfo/store/UserinfoStoreModule.js +38 -41
  180. package/src/plugins/breakpoint/breakpoint.plugin.js +11 -16
  181. package/src/scripts/__tests__/caseConverters.spec.js +1 -4
  182. package/src/scripts/__tests__/debounce.spec.js +3 -1
  183. package/src/scripts/__tests__/prettifyFileSize.spec.js +2 -2
  184. package/src/scripts/__tests__/preventHiddenPageCallsDecorator.spec.js +7 -4
  185. package/src/scripts/__tests__/updateObject.spec.js +3 -5
  186. package/src/scripts/caseConverters.js +22 -38
  187. package/src/scripts/debounce.js +1 -5
  188. package/src/scripts/editProxy.js +8 -7
  189. package/src/scripts/prettifyFileSize.js +1 -1
  190. package/src/scripts/preventHiddenPageCallsDecorator.js +3 -6
  191. package/src/store/BaseStoreModules/ApiStoreModule.js +7 -33
  192. package/src/store/BaseStoreModules/BaseStoreModule.js +14 -23
  193. package/src/store/BaseStoreModules/__tests__/BaseStoreModule.spec.js +7 -28
  194. package/src/store/helpers/getNamespacedState.js +2 -4
  195. package/src/store/new/modules/apiStoreModule/apiStoreModule.js +7 -27
  196. package/src/store/new/modules/cardStoreModule/cardStoreModule.js +0 -1
  197. package/src/store/new/modules/tableStoreModule/__tests__/tableStoreModule.spec.js +64 -77
  198. package/src/store/new/modules/tableStoreModule/tableStoreModule.js +12 -29
  199. package/src/tests/mocks/axiosMock.js +25 -19
  200. package/src/validators/decimalValidator.js +5 -4
  201. package/src/validators/websocketValidator/__tests__/websocketValidator.spec.js +1 -2
  202. 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) => getMediaList({
124
- ...params,
125
- fields: params.fields || ['id', 'name'],
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 = {}) => (deepmerge({
4
- enabled: false,
5
- formSchema: {},
6
- sec: 30,
7
- renewalSec: 15,
8
- }, processing));
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) => getQueuesList({
224
- ...params,
225
- fields: params.fields || ['id', 'name', 'type'],
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) => getRoleList({
167
- ...params,
168
- fields: params.fields || ['id', 'name'],
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(() => Promise.resolve({
16
- data: {},
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
- ], next: true,
44
+ ],
45
+ next: true,
43
46
  };
44
47
 
45
48
  const response = {
46
49
  data: {
47
- items: [
48
- { id: 1, should_case_convert: '' },
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(() => Promise.resolve({
69
- data: {},
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, device: {}, devices: [], license: [], roles: [], variables: [
86
+ id: 1,
87
+ device: {},
88
+ devices: [],
89
+ license: [],
90
+ roles: [],
91
+ variables: [
83
92
  {
84
- key: '', value: '',
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(() => Promise.resolve({
119
- data: {},
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(() => Promise.resolve({
168
- data: {},
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(() => Promise.resolve({
217
- data: {},
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(() => Promise.resolve({
236
- data: {},
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) => getUsersList({
225
- ...params,
226
- fields: params.fields || ['id', 'name'],
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