@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.
Files changed (201) 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/index.js +1 -3
  26. package/src/api/defaults/getDefaultGetParams/getDefaultGetParams.js +1 -4
  27. package/src/api/defaults/getDefaultInstance/getDefaultInstance.js +10 -11
  28. package/src/api/defaults/getDefaultOpenAPIConfig/getDefaultOpenAPIConfig.js +6 -5
  29. package/src/api/defaults/index.js +2 -4
  30. package/src/api/history/index.js +1 -3
  31. package/src/api/history/transcript/callTranscript.js +10 -30
  32. package/src/api/interceptors/request/updateToken.interceptor.js +1 -2
  33. package/src/api/transformers/merge/merge.transformer.js +4 -1
  34. package/src/api/transformers/mergeEach/mergeEach.transformer.js +4 -4
  35. package/src/api/transformers/notify/notify.transformer.js +9 -6
  36. package/src/api/transformers/starToSearch/starToSearch.transformer.js +8 -6
  37. package/src/components/index.js +3 -6
  38. package/src/components/on-demand/wt-cc-agent-status-timers/__tests__/wt-cc-agent-status-timers.spec.js +2 -4
  39. package/src/components/transitions/wt-expand-transition.vue +2 -3
  40. package/src/components/wt-app-header/__tests__/WtAppNavigator.spec.js +1 -2
  41. package/src/components/wt-app-header/__tests__/WtHeaderActions.spec.js +1 -2
  42. package/src/components/wt-app-header/wt-app-navigator.vue +15 -9
  43. package/src/components/wt-avatar/wt-avatar.vue +8 -3
  44. package/src/components/wt-button/wt-button.vue +0 -1
  45. package/src/components/wt-button-select/__tests__/WtButtonSelect.spec.js +4 -5
  46. package/src/components/wt-button-select/wt-button-select.vue +0 -1
  47. package/src/components/wt-context-menu/wt-context-menu.vue +32 -35
  48. package/src/components/wt-dummy/wt-dummy.vue +2 -5
  49. package/src/components/wt-expansion-panel/wt-expansion-panel.vue +10 -7
  50. package/src/components/wt-filters-panel-wrapper/__tests__/WtFiltersPanelWrapper.spec.js +4 -8
  51. package/src/components/wt-icon/wt-icon.vue +0 -1
  52. package/src/components/wt-indicator/__tests__/WtIndicator.spec.js +3 -2
  53. package/src/components/wt-indicator/wt-indicator.vue +10 -1
  54. package/src/components/wt-input/wt-input.vue +7 -10
  55. package/src/components/wt-item-link/wt-item-link.vue +7 -4
  56. package/src/components/wt-navigation-bar/__tests__/WtNavigationBar.spec.js +7 -15
  57. package/src/components/wt-navigation-bar/wt-navigation-bar.vue +7 -7
  58. package/src/components/wt-notification/wt-notification.vue +1 -2
  59. package/src/components/wt-notifications-bar/__tests__/WtNotificationsBar.spec.js +6 -3
  60. package/src/components/wt-notifications-bar/wt-notifications-bar.vue +4 -1
  61. package/src/components/wt-page-wrapper/__tests__/WtPageWrapper.spec.js +1 -2
  62. package/src/components/wt-pagination/wt-pagination.vue +1 -3
  63. package/src/components/wt-player/scripts/__tests__/createPlyrURL.spec.js +4 -8
  64. package/src/components/wt-player/wt-player.vue +13 -4
  65. package/src/components/wt-popup/wt-popup.vue +2 -1
  66. package/src/components/wt-search-bar/wt-search-bar.vue +1 -1
  67. package/src/components/wt-select/mixins/multiselectMixin.js +2 -5
  68. package/src/components/wt-select/wt-select.vue +12 -11
  69. package/src/components/wt-slider/wt-slider.vue +4 -2
  70. package/src/components/wt-status-select/wt-status-select.vue +10 -6
  71. package/src/components/wt-stepper/wt-stepper.vue +6 -4
  72. package/src/components/wt-switcher/wt-switcher.vue +1 -3
  73. package/src/components/wt-table/__tests__/WtTable.spec.js +2 -5
  74. package/src/components/wt-table/wt-table.vue +18 -16
  75. package/src/components/wt-table-column-select/wt-table-column-select.vue +9 -8
  76. package/src/components/wt-tabs/wt-tabs.vue +1 -3
  77. package/src/components/wt-tags-input/mixin/taggableMixin.js +7 -7
  78. package/src/components/wt-textarea/__tests__/WtTextarea.spec.js +2 -4
  79. package/src/components/wt-textarea/wt-textarea.vue +3 -2
  80. package/src/components/wt-timepicker/wt-timepicker.vue +1 -3
  81. package/src/components/wt-tooltip/_internals/useTooltipTriggerSubscriptions.js +1 -3
  82. package/src/components/wt-tooltip/_internals/wt-tooltip-floating.vue +8 -12
  83. package/src/components/wt-tooltip/wt-tooltip.vue +13 -13
  84. package/src/composables/useCachedInterval/__tests__/useCachedInterval.spec.js +6 -4
  85. package/src/composables/useCachedInterval/useCachedInterval.js +3 -8
  86. package/src/composables/useRepresentableAgentPauseCause/__tests__/useRepresentableAgentPauseCause.spec.js +11 -33
  87. package/src/composables/useRepresentableAgentPauseCause/useRepresentableAgentPauseCause.js +11 -9
  88. package/src/enums/WebitelApplications/AdminSections.enum.js +28 -28
  89. package/src/enums/WebitelApplications/CrmSections.enum.js +1 -1
  90. package/src/locale/en/en.js +12 -15
  91. package/src/locale/es/es.js +4 -8
  92. package/src/locale/kz/kz.js +5 -7
  93. package/src/locale/ru/ru.js +7 -11
  94. package/src/locale/ua/ua.js +13 -17
  95. package/src/mixins/dataFilterMixins/__tests__/enumFilterMixin.spec.js +1 -2
  96. package/src/mixins/dataFilterMixins/__tests__/sortFilterMixin.spec.js +4 -2
  97. package/src/mixins/dataFilterMixins/__tests__/urlControllerMixin.spec.js +4 -1
  98. package/src/mixins/dataFilterMixins/_urlControllerMixin/_urlControllerMixin.js +1 -1
  99. package/src/mixins/dataFilterMixins/apiFilterMixin.js +1 -2
  100. package/src/mixins/dataFilterMixins/baseFilterMixin/baseFilterMixin.js +1 -2
  101. package/src/mixins/dataFilterMixins/enumFilterMixin.js +5 -6
  102. package/src/mixins/dataFilterMixins/paginationFilterMixin.js +1 -2
  103. package/src/mixins/dataFilterMixins/sortFilterMixin.js +1 -4
  104. package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +1 -2
  105. package/src/mixins/validationMixin/useValidation.js +25 -19
  106. package/src/mixins/validationMixin/validationMixin.js +22 -10
  107. package/src/modules/AgentStatusSelect/api/pause-cause.js +3 -11
  108. package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js +16 -18
  109. package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-pause-cause-popup.spec.js +1 -2
  110. package/src/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue +12 -12
  111. package/src/modules/AgentStatusSelect/components/_internals/wt-cc-status-select-error-popup.vue +0 -1
  112. package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +20 -7
  113. package/src/modules/Appearance/components/__tests__/wt-dark-mode-switcher.spec.js +2 -4
  114. package/src/modules/Appearance/components/wt-dark-mode-switcher.vue +0 -1
  115. package/src/modules/AuditForm/components/__tests__/audit-form-question-read-wrapper.spec.js +1 -2
  116. package/src/modules/AuditForm/components/__tests__/audit-form-question-write-wrapper.spec.js +15 -25
  117. package/src/modules/AuditForm/components/__tests__/audit-form.spec.js +11 -20
  118. package/src/modules/AuditForm/components/audit-form-question-read-wrapper.vue +1 -4
  119. package/src/modules/AuditForm/components/audit-form-question-write-wrapper.vue +4 -7
  120. package/src/modules/AuditForm/components/audit-form-question.vue +18 -17
  121. package/src/modules/AuditForm/components/audit-form.vue +12 -14
  122. package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options-write-row.spec.js +1 -2
  123. package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options.spec.js +1 -3
  124. package/src/modules/AuditForm/components/questions/options/audit-form-question-options-write-row.vue +11 -15
  125. package/src/modules/AuditForm/components/questions/options/audit-form-question-options.vue +1 -4
  126. package/src/modules/AuditForm/components/questions/score/audit-form-question-score.vue +16 -20
  127. package/src/modules/AuditForm/schemas/AuditFormQuestionOptionsSchema.js +1 -3
  128. package/src/modules/CSVExport/CSVExport.js +3 -7
  129. package/src/modules/CSVExport/XLSExport.js +6 -7
  130. package/src/modules/CSVExport/__tests__/CSVExport.spec.js +1 -2
  131. package/src/modules/CSVExport/mixins/exportCSVMixin.js +2 -5
  132. package/src/modules/CSVExport/mixins/exportXLSMixin.js +2 -4
  133. package/src/modules/CardStoreModule/store/CardStoreModule.js +2 -6
  134. package/src/modules/DeleteConfirmationPopup/__tests__/delete-confirmation-popup.spec.js +13 -10
  135. package/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue +5 -14
  136. package/src/modules/FilesExport/FilesExport.js +4 -3
  137. package/src/modules/FilesExport/__tests__/FilesExport.spec.js +12 -12
  138. package/src/modules/FilesExport/mixins/exportFilesMixin.js +6 -7
  139. package/src/modules/FilesExport/scripts/generateMediaURL.js +1 -2
  140. package/src/modules/Filters/classes/BaseFilterSchema.js +21 -23
  141. package/src/modules/Filters/components/filter-pagination.vue +7 -3
  142. package/src/modules/Filters/components/filter-search.vue +21 -12
  143. package/src/modules/Filters/components/filter-table-fields.vue +1 -3
  144. package/src/modules/Filters/scripts/getters/index.js +1 -5
  145. package/src/modules/Filters/scripts/getters/queryGetter.js +8 -3
  146. package/src/modules/Filters/scripts/getters/valueGetter.js +1 -2
  147. package/src/modules/Filters/scripts/restores/index.js +1 -4
  148. package/src/modules/Filters/scripts/setters/index.js +1 -5
  149. package/src/modules/Filters/scripts/setters/querySetter.js +24 -22
  150. package/src/modules/Filters/scripts/utils/changeRouteQuery.js +16 -15
  151. package/src/modules/Filters/store/FiltersStoreModule.js +51 -45
  152. package/src/modules/Filters/store/__tests__/FiltersStoreModule.spec.js +51 -45
  153. package/src/modules/Notifications/store/NotificationsStoreModule.js +41 -38
  154. package/src/modules/Notifications/store/__tests__/NotificationsStoreModule.actions.spec.js +6 -6
  155. package/src/modules/QueryFilters/api/defaults.js +2 -3
  156. package/src/modules/QueryFilters/classes/ApiFilterSchema.js +1 -4
  157. package/src/modules/QueryFilters/classes/EnumFilterSchema.js +1 -4
  158. package/src/modules/QueryFilters/components/__tests__/filter-datetime.spec.js +1 -2
  159. package/src/modules/QueryFilters/components/__tests__/filter-from-to.spec.js +2 -4
  160. package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +2 -4
  161. package/src/modules/QueryFilters/components/filter-table-fields.vue +1 -5
  162. package/src/modules/QueryFilters/mixins/__tests__/apiFilterMixin.spec.js +4 -3
  163. package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +2 -4
  164. package/src/modules/QueryFilters/mixins/__tests__/sortFilterMixin.spec.js +4 -2
  165. package/src/modules/QueryFilters/mixins/__tests__/urlControllerMixin.spec.js +4 -1
  166. package/src/modules/QueryFilters/mixins/_urlControllerMixin/_urlControllerMixin.js +1 -1
  167. package/src/modules/QueryFilters/mixins/apiFilterMixin.js +1 -1
  168. package/src/modules/QueryFilters/mixins/baseFilterMixin/baseFilterMixin.js +4 -2
  169. package/src/modules/QueryFilters/mixins/enumFilterMixin.js +9 -11
  170. package/src/modules/QueryFilters/mixins/paginationFilterMixin.js +2 -4
  171. package/src/modules/QueryFilters/mixins/sortFilterMixin.js +2 -5
  172. package/src/modules/QueryFilters/store/QueryFiltersStoreModule.js +13 -17
  173. package/src/modules/QueryFilters/store/__tests__/QueryFiltersStoreModule.spec.js +15 -16
  174. package/src/modules/TableStoreModule/store/TableStoreModule.js +14 -33
  175. package/src/modules/TableStoreModule/store/__tests__/TableStoreModule.spec.js +69 -83
  176. package/src/modules/Userinfo/api/userinfo.js +6 -19
  177. package/src/modules/Userinfo/classes/ApplicationsAccess.js +5 -12
  178. package/src/modules/Userinfo/store/UserinfoStoreModule.js +38 -41
  179. package/src/plugins/breakpoint/breakpoint.plugin.js +11 -16
  180. package/src/scripts/__tests__/caseConverters.spec.js +1 -4
  181. package/src/scripts/__tests__/debounce.spec.js +3 -1
  182. package/src/scripts/__tests__/prettifyFileSize.spec.js +2 -2
  183. package/src/scripts/__tests__/preventHiddenPageCallsDecorator.spec.js +7 -4
  184. package/src/scripts/__tests__/updateObject.spec.js +3 -5
  185. package/src/scripts/caseConverters.js +22 -38
  186. package/src/scripts/debounce.js +1 -5
  187. package/src/scripts/editProxy.js +8 -7
  188. package/src/scripts/prettifyFileSize.js +1 -1
  189. package/src/scripts/preventHiddenPageCallsDecorator.js +3 -6
  190. package/src/store/BaseStoreModules/ApiStoreModule.js +7 -33
  191. package/src/store/BaseStoreModules/BaseStoreModule.js +14 -23
  192. package/src/store/BaseStoreModules/__tests__/BaseStoreModule.spec.js +7 -28
  193. package/src/store/helpers/getNamespacedState.js +2 -4
  194. package/src/store/new/modules/apiStoreModule/apiStoreModule.js +7 -27
  195. package/src/store/new/modules/cardStoreModule/cardStoreModule.js +0 -1
  196. package/src/store/new/modules/tableStoreModule/__tests__/tableStoreModule.spec.js +64 -77
  197. package/src/store/new/modules/tableStoreModule/tableStoreModule.js +12 -29
  198. package/src/tests/mocks/axiosMock.js +25 -19
  199. package/src/validators/decimalValidator.js +5 -4
  200. package/src/validators/websocketValidator/__tests__/websocketValidator.spec.js +1 -2
  201. package/src/validators/websocketValidator/websocketValidator.js +1 -1
@@ -1,5 +1,4 @@
1
- import ChatGatewayProvider
2
- from '../../../../enums/ChatGatewayProvider/ChatGatewayProvider.enum.js';
1
+ import ChatGatewayProvider from '../../../../enums/ChatGatewayProvider/ChatGatewayProvider.enum.js';
3
2
  import defaultChatGateway from '../defaults/defaultChatGateway.js';
4
3
  import WebchatAlternativeChannel from '../enums/WebchatAlternativeChannel.enum.js';
5
4
 
@@ -57,17 +56,16 @@ const webChatGateway = (_btnCodeDirty = false) => ({
57
56
  flow: {},
58
57
  id: '',
59
58
  },
60
- alternativeChannels: Object
61
- .values(WebchatAlternativeChannel)
62
- .reduce((channels, channel) => (
63
- {
59
+ alternativeChannels: Object.values(WebchatAlternativeChannel).reduce(
60
+ (channels, channel) => ({
64
61
  ...channels,
65
62
  [channel]: {
66
63
  url: '',
67
64
  enabled: false,
68
65
  },
69
- }
70
- ), {}),
66
+ }),
67
+ {},
68
+ ),
71
69
  },
72
70
  });
73
71
 
@@ -1,7 +1,7 @@
1
1
  /* Difference between MessangerType enum and WebchatAlternativeChannel:
2
- * MessangerType - backend fields naming, provider
3
- * WebchatAlternativeChannel - front-end only "simple" channel naming
4
- * */
2
+ * MessangerType - backend fields naming, provider
3
+ * WebchatAlternativeChannel - front-end only "simple" channel naming
4
+ * */
5
5
 
6
6
  const WebchatAlternativeChannel = Object.freeze({
7
7
  VIBER: 'viber',
@@ -25,14 +25,7 @@ const getCommunicationsList = async (params) => {
25
25
  default: false,
26
26
  };
27
27
 
28
- const {
29
- page,
30
- size,
31
- search,
32
- sort,
33
- fields,
34
- id,
35
- } = applyTransform(params, [
28
+ const { page, size, search, sort, fields, id } = applyTransform(params, [
36
29
  merge(getDefaultGetParams()),
37
30
  starToSearch('search'),
38
31
  ]);
@@ -51,85 +44,52 @@ const getCommunicationsList = async (params) => {
51
44
  merge(getDefaultGetListResponse()),
52
45
  ]);
53
46
  return {
54
- items: applyTransform(items, [
55
- mergeEach(defaultObject),
56
- ]),
47
+ items: applyTransform(items, [mergeEach(defaultObject)]),
57
48
  next,
58
49
  };
59
50
  } catch (err) {
60
- throw applyTransform(err, [
61
-
62
- notify,
63
- ]);
51
+ throw applyTransform(err, [notify]);
64
52
  }
65
53
  };
66
54
 
67
55
  const getCommunication = async ({ itemId: id }) => {
68
56
  try {
69
57
  const response = await communicationService.readCommunicationType(id);
70
- return applyTransform(response.data, [
71
- snakeToCamel(),
72
- ]);
58
+ return applyTransform(response.data, [snakeToCamel()]);
73
59
  } catch (err) {
74
- throw applyTransform(err, [
75
-
76
- notify,
77
- ]);
60
+ throw applyTransform(err, [notify]);
78
61
  }
79
62
  };
80
63
 
81
64
  const fieldsToSend = ['code', 'name', 'description', 'channel', 'default'];
82
65
 
83
66
  const addCommunication = async ({ itemInstance }) => {
84
- const item = applyTransform(itemInstance, [
85
- sanitize(fieldsToSend),
86
- camelToSnake(),
87
- ]);
67
+ const item = applyTransform(itemInstance, [sanitize(fieldsToSend), camelToSnake()]);
88
68
  try {
89
69
  const response = await communicationService.createCommunicationType(item);
90
- return applyTransform(response.data, [
91
- snakeToCamel(),
92
- ]);
70
+ return applyTransform(response.data, [snakeToCamel()]);
93
71
  } catch (err) {
94
- throw applyTransform(err, [
95
-
96
- notify,
97
- ]);
72
+ throw applyTransform(err, [notify]);
98
73
  }
99
74
  };
100
75
 
101
76
  const patchCommunication = async ({ changes, id }) => {
102
- const body = applyTransform(changes, [
103
- sanitize(fieldsToSend),
104
- camelToSnake(),
105
- ]);
77
+ const body = applyTransform(changes, [sanitize(fieldsToSend), camelToSnake()]);
106
78
  try {
107
79
  const response = await communicationService.patchCommunicationType(id, body);
108
- return applyTransform(response.data, [
109
- snakeToCamel(),
110
- ]);
80
+ return applyTransform(response.data, [snakeToCamel()]);
111
81
  } catch (err) {
112
- throw applyTransform(err, [
113
- notify,
114
- ]);
82
+ throw applyTransform(err, [notify]);
115
83
  }
116
84
  };
117
85
 
118
86
  const updateCommunication = async ({ itemInstance, itemId: id }) => {
119
- const item = applyTransform(itemInstance, [
120
- sanitize(fieldsToSend),
121
- camelToSnake(),
122
- ]);
87
+ const item = applyTransform(itemInstance, [sanitize(fieldsToSend), camelToSnake()]);
123
88
  try {
124
89
  const response = await communicationService.updateCommunicationType(id, item);
125
- return applyTransform(response.data, [
126
- snakeToCamel(),
127
- ]);
90
+ return applyTransform(response.data, [snakeToCamel()]);
128
91
  } catch (err) {
129
- throw applyTransform(err, [
130
-
131
- notify,
132
- ]);
92
+ throw applyTransform(err, [notify]);
133
93
  }
134
94
  };
135
95
 
@@ -138,17 +98,15 @@ const deleteCommunication = async ({ id }) => {
138
98
  const response = await communicationService.deleteCommunicationType(id);
139
99
  return applyTransform(response.data, []);
140
100
  } catch (err) {
141
- throw applyTransform(err, [
142
-
143
- notify,
144
- ]);
101
+ throw applyTransform(err, [notify]);
145
102
  }
146
103
  };
147
104
 
148
- const getCommunicationsLookup = (params) => getCommunicationsList({
149
- ...params,
150
- fields: params.fields || ['id', 'name'],
151
- });
105
+ const getCommunicationsLookup = (params) =>
106
+ getCommunicationsList({
107
+ ...params,
108
+ fields: params.fields || ['id', 'name'],
109
+ });
152
110
 
153
111
  const CommunicationsAPI = {
154
112
  getList: getCommunicationsList,
@@ -1,7 +1,9 @@
1
1
  import { SystemSettingServiceApiFactory } from 'webitel-sdk';
2
2
  import {
3
3
  getDefaultGetListResponse,
4
- getDefaultGetParams, getDefaultInstance, getDefaultOpenAPIConfig,
4
+ getDefaultGetParams,
5
+ getDefaultInstance,
6
+ getDefaultOpenAPIConfig,
5
7
  } from '../../defaults/index.js';
6
8
  import applyTransform, {
7
9
  camelToSnake,
@@ -24,7 +26,14 @@ const getList = async (params) => {
24
26
  ]);
25
27
 
26
28
  try {
27
- const response = await configurationService.searchSystemSetting(page, size, search, sort, fields, name);
29
+ const response = await configurationService.searchSystemSetting(
30
+ page,
31
+ size,
32
+ search,
33
+ sort,
34
+ fields,
35
+ name,
36
+ );
28
37
  const { items, next } = applyTransform(response.data, [
29
38
  snakeToCamel(),
30
39
  merge(getDefaultGetListResponse()),
@@ -91,7 +100,13 @@ const getObjectsList = async (params) => {
91
100
  ]);
92
101
 
93
102
  try {
94
- const response = await configurationService.searchAvailableSystemSetting(page, size, search, sort, fields);
103
+ const response = await configurationService.searchAvailableSystemSetting(
104
+ page,
105
+ size,
106
+ search,
107
+ sort,
108
+ fields,
109
+ );
95
110
  const { items, next } = applyTransform(response.data, [
96
111
  snakeToCamel(),
97
112
  merge(getDefaultGetListResponse()),
@@ -1,7 +1,4 @@
1
- import {
2
- EngineRoutingSchemaType,
3
- RoutingSchemaServiceApiFactory,
4
- } from 'webitel-sdk';
1
+ import { EngineRoutingSchemaType, RoutingSchemaServiceApiFactory } from 'webitel-sdk';
5
2
  import {
6
3
  getDefaultGetListResponse,
7
4
  getDefaultGetParams,
@@ -42,26 +39,14 @@ const getFlowList = async (params) => {
42
39
  };
43
40
 
44
41
  if (paramsCopy.type) {
45
- const _type = Array.isArray(paramsCopy.type)
46
- ? paramsCopy.type
47
- : [paramsCopy.type];
42
+ const _type = Array.isArray(paramsCopy.type) ? paramsCopy.type : [paramsCopy.type];
48
43
  if (!paramsCopy.type.includes(EngineRoutingSchemaType.Default)) {
49
44
  _type.push(EngineRoutingSchemaType.Default);
50
45
  }
51
46
  paramsCopy.type = _type;
52
47
  }
53
48
 
54
- const {
55
- page,
56
- size,
57
- search,
58
- sort,
59
- fields,
60
- id,
61
- name,
62
- type,
63
- tags,
64
- } = applyTransform(paramsCopy, [
49
+ const { page, size, search, sort, fields, id, name, type, tags } = applyTransform(paramsCopy, [
65
50
  merge(getDefaultGetParams()),
66
51
  starToSearch('search'),
67
52
  camelToSnake(doNotConvertKeys),
@@ -85,16 +70,11 @@ const getFlowList = async (params) => {
85
70
  merge(getDefaultGetListResponse()),
86
71
  ]);
87
72
  return {
88
- items: applyTransform(items, [
89
- mergeEach(defaultObject),
90
- ]),
73
+ items: applyTransform(items, [mergeEach(defaultObject)]),
91
74
  next,
92
75
  };
93
76
  } catch (err) {
94
- throw applyTransform(err, [
95
-
96
- notify,
97
- ]);
77
+ throw applyTransform(err, [notify]);
98
78
  }
99
79
  };
100
80
  const getFlow = async ({ itemId: id }) => {
@@ -121,18 +101,13 @@ const getFlow = async ({ itemId: id }) => {
121
101
  itemResponseHandler,
122
102
  ]);
123
103
  } catch (err) {
124
- throw applyTransform(err, [
125
-
126
- notify,
127
- ]);
104
+ throw applyTransform(err, [notify]);
128
105
  }
129
106
  };
130
107
 
131
108
  const preRequestHandler = (item) => ({
132
109
  ...item,
133
- schema: typeof item.schema === 'string'
134
- ? JSON.parse(item.schema)
135
- : item.schema,
110
+ schema: typeof item.schema === 'string' ? JSON.parse(item.schema) : item.schema,
136
111
  });
137
112
 
138
113
  const addFlow = async ({ itemInstance }) => {
@@ -155,10 +130,7 @@ const addFlow = async ({ itemInstance }) => {
155
130
  }),
156
131
  ]);
157
132
  } catch (err) {
158
- throw applyTransform(err, [
159
-
160
- notify,
161
- ]);
133
+ throw applyTransform(err, [notify]);
162
134
  }
163
135
  };
164
136
  const updateFlow = async ({ itemInstance, itemId: id }) => {
@@ -181,10 +153,7 @@ const updateFlow = async ({ itemInstance, itemId: id }) => {
181
153
  }),
182
154
  ]);
183
155
  } catch (err) {
184
- throw applyTransform(err, [
185
-
186
- notify,
187
- ]);
156
+ throw applyTransform(err, [notify]);
188
157
  }
189
158
  };
190
159
 
@@ -193,27 +162,18 @@ const deleteFlow = async ({ id }) => {
193
162
  const response = await flowService.deleteRoutingSchema(id);
194
163
  return applyTransform(response.data, []);
195
164
  } catch (err) {
196
- throw applyTransform(err, [
197
-
198
- notify,
199
- ]);
165
+ throw applyTransform(err, [notify]);
200
166
  }
201
167
  };
202
168
 
203
- const getFlowsLookup = (params) => getFlowList({
204
- ...params,
205
- fields: params.fields || ['id', 'name', 'type'],
206
- });
169
+ const getFlowsLookup = (params) =>
170
+ getFlowList({
171
+ ...params,
172
+ fields: params.fields || ['id', 'name', 'type'],
173
+ });
207
174
 
208
175
  const getFlowTags = async (params) => {
209
- const {
210
- page,
211
- size,
212
- search,
213
- sort,
214
- fields,
215
- ids,
216
- } = applyTransform(params, [
176
+ const { page, size, search, sort, fields, ids } = applyTransform(params, [
217
177
  merge(getDefaultGetParams()),
218
178
  starToSearch(),
219
179
  camelToSnake(doNotConvertKeys),
@@ -236,10 +196,7 @@ const getFlowTags = async (params) => {
236
196
  next,
237
197
  };
238
198
  } catch (err) {
239
- throw applyTransform(err, [
240
-
241
- notify,
242
- ]);
199
+ throw applyTransform(err, [notify]);
243
200
  }
244
201
  };
245
202
 
@@ -44,16 +44,11 @@ const getGatewayList = async (params) => {
44
44
  merge(getDefaultGetListResponse()),
45
45
  ]);
46
46
  return {
47
- items: applyTransform(items, [
48
- mergeEach(defaultObject),
49
- ]),
47
+ items: applyTransform(items, [mergeEach(defaultObject)]),
50
48
  next,
51
49
  };
52
50
  } catch (err) {
53
- throw applyTransform(err, [
54
-
55
- notify,
56
- ]);
51
+ throw applyTransform(err, [notify]);
57
52
  }
58
53
  };
59
54
 
@@ -66,9 +61,7 @@ const getGateway = async ({ itemId: id }) => {
66
61
  };
67
62
 
68
63
  const result = { ...trunkingGateway(), ...response };
69
- result.ipacl = result.ipacl.map((acl) => (
70
- { ...defaultIPacl, ...acl }
71
- ));
64
+ result.ipacl = result.ipacl.map((acl) => ({ ...defaultIPacl, ...acl }));
72
65
  return result;
73
66
  };
74
67
 
@@ -86,15 +79,9 @@ const getGateway = async ({ itemId: id }) => {
86
79
 
87
80
  try {
88
81
  const response = await instance.get(url);
89
- return applyTransform(response.data, [
90
- snakeToCamel(),
91
- itemResponseHandler,
92
- ]);
82
+ return applyTransform(response.data, [snakeToCamel(), itemResponseHandler]);
93
83
  } catch (err) {
94
- throw applyTransform(err, [
95
-
96
- notify,
97
- ]);
84
+ throw applyTransform(err, [notify]);
98
85
  }
99
86
  };
100
87
 
@@ -118,58 +105,34 @@ const fieldsToSend = [
118
105
  ];
119
106
 
120
107
  const addGateway = async ({ itemInstance }) => {
121
- const item = applyTransform(itemInstance, [
122
- sanitize(fieldsToSend),
123
- camelToSnake(),
124
- ]);
108
+ const item = applyTransform(itemInstance, [sanitize(fieldsToSend), camelToSnake()]);
125
109
  try {
126
110
  const response = await instance.post(baseUrl, item);
127
- return applyTransform(response.data, [
128
- snakeToCamel(),
129
- ]);
111
+ return applyTransform(response.data, [snakeToCamel()]);
130
112
  } catch (err) {
131
- throw applyTransform(err, [
132
-
133
- notify,
134
- ]);
113
+ throw applyTransform(err, [notify]);
135
114
  }
136
115
  };
137
116
  const updateGateway = async ({ itemInstance, itemId: id }) => {
138
- const item = applyTransform(itemInstance, [
139
- sanitize(fieldsToSend),
140
- camelToSnake(),
141
- ]);
117
+ const item = applyTransform(itemInstance, [sanitize(fieldsToSend), camelToSnake()]);
142
118
 
143
119
  const url = `${baseUrl}/${id}`;
144
120
  try {
145
121
  const response = await instance.put(url, item);
146
- return applyTransform(response.data, [
147
- snakeToCamel(),
148
- ]);
122
+ return applyTransform(response.data, [snakeToCamel()]);
149
123
  } catch (err) {
150
- throw applyTransform(err, [
151
-
152
- notify,
153
- ]);
124
+ throw applyTransform(err, [notify]);
154
125
  }
155
126
  };
156
127
 
157
128
  const patchGateway = async ({ changes, id }) => {
158
- const body = applyTransform(changes, [
159
- sanitize(fieldsToSend),
160
- camelToSnake(),
161
- ]);
129
+ const body = applyTransform(changes, [sanitize(fieldsToSend), camelToSnake()]);
162
130
  const url = `${baseUrl}/${id}`;
163
131
  try {
164
132
  const response = await instance.patch(url, body);
165
- return applyTransform(response.data, [
166
- snakeToCamel(),
167
- ]);
133
+ return applyTransform(response.data, [snakeToCamel()]);
168
134
  } catch (err) {
169
- throw applyTransform(err, [
170
-
171
- notify,
172
- ]);
135
+ throw applyTransform(err, [notify]);
173
136
  }
174
137
  };
175
138
 
@@ -179,17 +142,15 @@ const deleteGateway = async ({ id }) => {
179
142
  const response = await instance.delete(url);
180
143
  return applyTransform(response.data, []);
181
144
  } catch (err) {
182
- throw applyTransform(err, [
183
-
184
- notify,
185
- ]);
145
+ throw applyTransform(err, [notify]);
186
146
  }
187
147
  };
188
148
 
189
- const getGatewaysLookup = (params) => getGatewayList({
190
- ...params,
191
- fields: params.fields || ['id', 'name'],
192
- });
149
+ const getGatewaysLookup = (params) =>
150
+ getGatewayList({
151
+ ...params,
152
+ fields: params.fields || ['id', 'name'],
153
+ });
193
154
 
194
155
  const GatewaysAPI = {
195
156
  getList: getGatewayList,
@@ -3,6 +3,7 @@ import buckets from './buckets/buckets.js';
3
3
  import calendars from './calendars/calendars.js';
4
4
  import chatGateways from './chatGateways/chatGateways.js';
5
5
  import communications from './communications/communications.js';
6
+ import configurations from './configurations/configurations.js';
6
7
  import flows from './flows/flow.js';
7
8
  import gateways from './gateways/gateways.js';
8
9
  import lists from './lists/blacklists.js';
@@ -10,7 +11,6 @@ import media from './media/media.js';
10
11
  import queues from './queues/queues.js';
11
12
  import roles from './roles/roles.js';
12
13
  import users from './users/users.js';
13
- import configurations from './configurations/configurations.js';
14
14
 
15
15
  export {
16
16
  agents,
@@ -26,95 +26,55 @@ const getBlacklistList = async (params) => {
26
26
  count: 0,
27
27
  };
28
28
 
29
- const {
30
- page,
31
- size,
32
- search,
33
- sort,
34
- fields,
35
- id,
36
- } = applyTransform(params, [
29
+ const { page, size, search, sort, fields, id } = applyTransform(params, [
37
30
  merge(getDefaultGetParams()),
38
31
  starToSearch('search'),
39
32
  camelToSnake(),
40
33
  ]);
41
34
 
42
35
  try {
43
- const response = await listService.searchList(
44
- page,
45
- size,
46
- search,
47
- sort,
48
- fields,
49
- id,
50
- );
36
+ const response = await listService.searchList(page, size, search, sort, fields, id);
51
37
  const { items, next } = applyTransform(response.data, [
52
38
  snakeToCamel(),
53
39
  merge(getDefaultGetListResponse()),
54
40
  ]);
55
41
  return {
56
- items: applyTransform(items, [
57
- mergeEach(defaultObject),
58
- ]),
42
+ items: applyTransform(items, [mergeEach(defaultObject)]),
59
43
  next,
60
44
  };
61
45
  } catch (err) {
62
- throw applyTransform(err, [
63
-
64
- notify,
65
- ]);
46
+ throw applyTransform(err, [notify]);
66
47
  }
67
48
  };
68
49
 
69
50
  const getBlacklist = async ({ itemId: id }) => {
70
51
  try {
71
52
  const response = await listService.readList(id);
72
- return applyTransform(response.data, [
73
- snakeToCamel(),
74
- ]);
53
+ return applyTransform(response.data, [snakeToCamel()]);
75
54
  } catch (err) {
76
- throw applyTransform(err, [
77
-
78
- notify,
79
- ]);
55
+ throw applyTransform(err, [notify]);
80
56
  }
81
57
  };
82
58
 
83
59
  const fieldsToSend = ['name', 'description'];
84
60
 
85
61
  const addBlacklist = async ({ itemInstance }) => {
86
- const item = applyTransform(itemInstance, [
87
- sanitize(fieldsToSend),
88
- camelToSnake(),
89
- ]);
62
+ const item = applyTransform(itemInstance, [sanitize(fieldsToSend), camelToSnake()]);
90
63
  try {
91
64
  const response = await listService.createList(item);
92
- return applyTransform(response.data, [
93
- snakeToCamel(),
94
- ]);
65
+ return applyTransform(response.data, [snakeToCamel()]);
95
66
  } catch (err) {
96
- throw applyTransform(err, [
97
-
98
- notify,
99
- ]);
67
+ throw applyTransform(err, [notify]);
100
68
  }
101
69
  };
102
70
 
103
71
  const updateBlacklist = async ({ itemInstance, itemId: id }) => {
104
- const item = applyTransform(itemInstance, [
105
- sanitize(fieldsToSend),
106
- camelToSnake(),
107
- ]);
72
+ const item = applyTransform(itemInstance, [sanitize(fieldsToSend), camelToSnake()]);
108
73
  try {
109
74
  const response = await listService.updateList(id, item);
110
- return applyTransform(response.data, [
111
- snakeToCamel(),
112
- ]);
75
+ return applyTransform(response.data, [snakeToCamel()]);
113
76
  } catch (err) {
114
- throw applyTransform(err, [
115
-
116
- notify,
117
- ]);
77
+ throw applyTransform(err, [notify]);
118
78
  }
119
79
  };
120
80
 
@@ -123,16 +83,14 @@ const deleteBlacklist = async ({ id }) => {
123
83
  const response = await listService.deleteList(id);
124
84
  return applyTransform(response.data, []);
125
85
  } catch (err) {
126
- throw applyTransform(err, [
127
-
128
- notify,
129
- ]);
86
+ throw applyTransform(err, [notify]);
130
87
  }
131
88
  };
132
- const getBlacklistsLookup = (params) => getBlacklistList({
133
- ...params,
134
- fields: params.fields || ['id', 'name'],
135
- });
89
+ const getBlacklistsLookup = (params) =>
90
+ getBlacklistList({
91
+ ...params,
92
+ fields: params.fields || ['id', 'name'],
93
+ });
136
94
 
137
95
  const BlacklistsAPI = {
138
96
  getList: getBlacklistList,