@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
@@ -29,33 +29,33 @@ export default class UserinfoStoreModule extends BaseStoreModule {
29
29
  getters = {
30
30
  THIS_APP: (state) => state.thisApp,
31
31
  // if no access[app] => accessed by default
32
- CHECK_APP_ACCESS: (state) => (app) => !state.access[app] ||
33
- state.access[app]?._enabled,
34
- CHECK_OBJECT_ACCESS: (state, getters) => ({ name, route }) => {
35
- if (!state.access[getters.THIS_APP] ||
36
- !state.access[getters.THIS_APP]._enabled) return false;
37
- if (route) return getters.CHECK_OBJECT_ACCESS_BY_ROUTE(route);
38
- return getters.CHECK_OBJECT_ACCESS_BY_NAME(name);
39
- },
40
- CHECK_OBJECT_ACCESS_BY_NAME: (state, getters) => (name) => (
41
- state.access[getters.THIS_APP][name]?._enabled
42
- ),
32
+ CHECK_APP_ACCESS: (state) => (app) => !state.access[app] || state.access[app]?._enabled,
33
+ CHECK_OBJECT_ACCESS:
34
+ (state, getters) =>
35
+ ({ name, route }) => {
36
+ if (!state.access[getters.THIS_APP] || !state.access[getters.THIS_APP]._enabled)
37
+ return false;
38
+ if (route) return getters.CHECK_OBJECT_ACCESS_BY_ROUTE(route);
39
+ return getters.CHECK_OBJECT_ACCESS_BY_NAME(name);
40
+ },
41
+ CHECK_OBJECT_ACCESS_BY_NAME: (state, getters) => (name) =>
42
+ state.access[getters.THIS_APP][name]?._enabled,
43
43
  CHECK_OBJECT_ACCESS_BY_ROUTE: (state, getters) => (route) => {
44
- const accessKey = Object.keys(state.access[getters.THIS_APP])
45
- .find((object) => route.name.includes(object));
44
+ const accessKey = Object.keys(state.access[getters.THIS_APP]).find((object) =>
45
+ route.name.includes(object),
46
+ );
46
47
  return state.access[getters.THIS_APP][accessKey]?._enabled;
47
48
  },
48
- GET_OBJECT_SCOPE: (state, getters) => ({ name, route }) => {
49
- if (route) return getters.GET_OBJECT_SCOPE_BY_ROUTE(route);
50
- return getters.GET_OBJECT_SCOPE_BY_NAME(name);
51
- },
52
- GET_OBJECT_SCOPE_BY_NAME: (state) => (name) => (
53
- Object.values(state.scope).find((object) => name === object.name)
54
- ),
55
- GET_OBJECT_SCOPE_BY_ROUTE: (state) => (route) => (
56
- Object.values(state.scope)
57
- .find((object) => route.name.includes(object.route))
58
- ),
49
+ GET_OBJECT_SCOPE:
50
+ (state, getters) =>
51
+ ({ name, route }) => {
52
+ if (route) return getters.GET_OBJECT_SCOPE_BY_ROUTE(route);
53
+ return getters.GET_OBJECT_SCOPE_BY_NAME(name);
54
+ },
55
+ GET_OBJECT_SCOPE_BY_NAME: (state) => (name) =>
56
+ Object.values(state.scope).find((object) => name === object.name),
57
+ GET_OBJECT_SCOPE_BY_ROUTE: (state) => (route) =>
58
+ Object.values(state.scope).find((object) => route.name.includes(object.route)),
59
59
  HAS_READ_ACCESS: (state, getters) => (checkedObject) => {
60
60
  if (!getters.CHECK_OBJECT_ACCESS(checkedObject)) return false;
61
61
  if (state.permissions[Permissions.READ]) return true;
@@ -86,13 +86,13 @@ export default class UserinfoStoreModule extends BaseStoreModule {
86
86
  CONVERT_USER_PERMISSIONS: (context, initialPermissions) => {
87
87
  let permissions = {};
88
88
  if (!initialPermissions) return permissions;
89
- permissions = initialPermissions.reduce((
90
- permissions,
91
- currentPermission,
92
- ) => ({
93
- ...permissions,
94
- [currentPermission.id]: currentPermission,
95
- }), {});
89
+ permissions = initialPermissions.reduce(
90
+ (permissions, currentPermission) => ({
91
+ ...permissions,
92
+ [currentPermission.id]: currentPermission,
93
+ }),
94
+ {},
95
+ );
96
96
  return permissions;
97
97
  },
98
98
 
@@ -105,14 +105,17 @@ export default class UserinfoStoreModule extends BaseStoreModule {
105
105
 
106
106
  const session = await userinfo.getSession();
107
107
 
108
- if ((session.expiresAt - Date.now() < HOUR_LENGTH)) {
108
+ if (session.expiresAt - Date.now() < HOUR_LENGTH) {
109
109
  await context.dispatch('LOGOUT');
110
110
  throw new Error(`Session expires soon ${session.expiresAt}`);
111
111
  }
112
112
 
113
113
  await context.dispatch('SET_SESSION', session);
114
114
  const access = await userinfo.getApplicationsAccess();
115
- await context.dispatch('SET_APPLICATIONS_ACCESS', new ApplicationsAccess({ access }).getAccess());
115
+ await context.dispatch(
116
+ 'SET_APPLICATIONS_ACCESS',
117
+ new ApplicationsAccess({ access }).getAccess(),
118
+ );
116
119
  await context.dispatch('AFTER_OPEN_SESSION_HOOK');
117
120
  },
118
121
  SET_SESSION: async (context, _session) => {
@@ -137,19 +140,13 @@ export default class UserinfoStoreModule extends BaseStoreModule {
137
140
  }
138
141
  },
139
142
 
140
- LOGOUT: async (
141
- context,
142
- { authUrl = import.meta.env.VITE_AUTH_URL } = {},
143
- ) => {
143
+ LOGOUT: async (context, { authUrl = import.meta.env.VITE_AUTH_URL } = {}) => {
144
144
  if (!authUrl) throw new Error('No authUrl for LOGOUT provided');
145
145
  await userinfo.logout();
146
146
  window.location.href = authUrl;
147
147
  },
148
148
 
149
- SET_APPLICATIONS_ACCESS: (
150
- context,
151
- access,
152
- ) => context.commit('SET_APPLICATIONS_ACCESS', access),
149
+ SET_APPLICATIONS_ACCESS: (context, access) => context.commit('SET_APPLICATIONS_ACCESS', access),
153
150
 
154
151
  SET_LOADING: (context, isLoading) => {
155
152
  context.commit('SET_LOADING', isLoading);
@@ -37,15 +37,10 @@ const breakpoint = reactive({
37
37
  width: 0,
38
38
  });
39
39
 
40
- const getClientWidth = () => Math.max(
41
- document.documentElement.clientWidth,
42
- window.innerWidth || 0,
43
- );
40
+ const getClientWidth = () => Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
44
41
 
45
- const getClientHeight = () => Math.max(
46
- document.documentElement.clientHeight,
47
- window.innerHeight || 0,
48
- );
42
+ const getClientHeight = () =>
43
+ Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
49
44
 
50
45
  const thresholds = {
51
46
  xs: 600,
@@ -62,9 +57,9 @@ const onResize = () => {
62
57
 
63
58
  const xs = width < thresholds.xs;
64
59
  const sm = width < thresholds.sm && !xs;
65
- const md = width < (thresholds.md - scrollBarWidth) && !(sm || xs);
66
- const lg = width < (thresholds.lg - scrollBarWidth) && !(md || sm || xs);
67
- const xl = width >= (thresholds.lg - scrollBarWidth);
60
+ const md = width < thresholds.md - scrollBarWidth && !(sm || xs);
61
+ const lg = width < thresholds.lg - scrollBarWidth && !(md || sm || xs);
62
+ const xl = width >= thresholds.lg - scrollBarWidth;
68
63
 
69
64
  breakpoint.height = height;
70
65
  breakpoint.width = width;
@@ -88,16 +83,16 @@ const onResize = () => {
88
83
  breakpoint.xlOnly = xl;
89
84
 
90
85
  switch (true) {
91
- case (xs):
86
+ case xs:
92
87
  breakpoint.name = 'xs';
93
88
  break;
94
- case (sm):
89
+ case sm:
95
90
  breakpoint.name = 'sm';
96
91
  break;
97
- case (md):
92
+ case md:
98
93
  breakpoint.name = 'md';
99
94
  break;
100
- case (lg):
95
+ case lg:
101
96
  breakpoint.name = 'lg';
102
97
  break;
103
98
  default:
@@ -106,7 +101,7 @@ const onResize = () => {
106
101
  }
107
102
 
108
103
  if (typeof mobileBreakpoint === 'number') {
109
- breakpoint.mobile = width < parseInt(mobileBreakpoint, 10);
104
+ breakpoint.mobile = width < Number.parseInt(mobileBreakpoint, 10);
110
105
 
111
106
  return;
112
107
  }
@@ -60,10 +60,7 @@ describe('Case converters', () => {
60
60
 
61
61
  it('Camel-Snake Arrays', () => {
62
62
  const camelArr = ['camelToSnake', { camelToSnake: { camelToSnake: null } }];
63
- const snakeArr = [
64
- 'camel_to_snake',
65
- { camel_to_snake: { camel_to_snake: null } },
66
- ];
63
+ const snakeArr = ['camel_to_snake', { camel_to_snake: { camel_to_snake: null } }];
67
64
  expect(objCamelToSnake(camelArr)).toEqual(snakeArr);
68
65
  expect(objSnakeToCamel(snakeArr)).toEqual(camelArr);
69
66
  });
@@ -3,7 +3,9 @@ import debounce from '../debounce.js';
3
3
  describe('debounce', () => {
4
4
  it('debounces call', async () => {
5
5
  let isFnCalled = false;
6
- let fn = () => { isFnCalled = true; };
6
+ let fn = () => {
7
+ isFnCalled = true;
8
+ };
7
9
  fn = debounce(fn, 50);
8
10
  fn();
9
11
  expect(isFnCalled).toBeFalsy();
@@ -1,12 +1,12 @@
1
1
  import prettifyFileSize from '../prettifyFileSize.js';
2
2
 
3
3
  describe('prettifyFileSize', () => {
4
- it('prettifies bytes to kb\'s', () => {
4
+ it("prettifies bytes to kb's", () => {
5
5
  const size = 1025;
6
6
  expect(prettifyFileSize(size)).toBe('1 Kb');
7
7
  });
8
8
 
9
- it('prettifies bytes to mb\'s', () => {
9
+ it("prettifies bytes to mb's", () => {
10
10
  const size = 1205 ** 2;
11
11
  expect(prettifyFileSize(size)).toBe('1.38 Mb');
12
12
  });
@@ -1,14 +1,17 @@
1
- import preventHiddenPageCallsDecorator
2
- from '../preventHiddenPageCallsDecorator.js';
1
+ import preventHiddenPageCallsDecorator from '../preventHiddenPageCallsDecorator.js';
3
2
 
4
3
  describe('preventHiddenPageCallsDecorator', () => {
5
4
  it('prevents call on hidden page', () => {
6
5
  let isFnCalled = false;
7
- let fn = () => { isFnCalled = true; };
6
+ let fn = () => {
7
+ isFnCalled = true;
8
+ };
8
9
  fn = preventHiddenPageCallsDecorator(fn, 50);
9
10
  Object.defineProperty(document, 'hidden', {
10
11
  configurable: true,
11
- get() { return true; },
12
+ get() {
13
+ return true;
14
+ },
12
15
  });
13
16
  expect(isFnCalled).toBeFalsy();
14
17
  fn();
@@ -1,7 +1,7 @@
1
1
  import updateObject from '../updateObject.js';
2
2
 
3
3
  describe('updateObject', () => {
4
- it('doesn\'t mutate original object', () => {
4
+ it("doesn't mutate original object", () => {
5
5
  const original = { jest: 'jest' };
6
6
  updateObject({ obj: original, path: 'jest', value: '123' });
7
7
  expect(original.jest).toBe('jest');
@@ -9,13 +9,11 @@ describe('updateObject', () => {
9
9
  it('changes shallow value', () => {
10
10
  const original = { jest: 'jest' };
11
11
  const result = { jest: 'huest' };
12
- expect(updateObject({ obj: original, path: 'jest', value: 'huest' }))
13
- .toEqual(result);
12
+ expect(updateObject({ obj: original, path: 'jest', value: 'huest' })).toEqual(result);
14
13
  });
15
14
  it('changes deep value', () => {
16
15
  const original = { jest: { deep: 'jest' } };
17
16
  const result = { jest: { deep: 'huest' } };
18
- expect(updateObject({ obj: original, path: 'jest.deep', value: 'huest' }))
19
- .toEqual(result);
17
+ expect(updateObject({ obj: original, path: 'jest.deep', value: 'huest' })).toEqual(result);
20
18
  });
21
19
  });
@@ -1,36 +1,20 @@
1
- export const snakeToCamel = (str) => str.replace(
2
- /([a-z])([_])([a-z])/g,
3
- (group, p1, p2, p3) => [p1, p3.toUpperCase()].join(''),
4
- );
1
+ export const snakeToCamel = (str) =>
2
+ str.replace(/([a-z])([_])([a-z])/g, (group, p1, p2, p3) => [p1, p3.toUpperCase()].join(''));
5
3
 
6
- export const camelToSnake = (str) => str.replace(
7
- /([a-z])([A-Z])/g,
8
- (group, p1, p2) => [p1, '_', p2.toLowerCase()].join(''),
9
- );
4
+ export const camelToSnake = (str) =>
5
+ str.replace(/([a-z])([A-Z])/g, (group, p1, p2) => [p1, '_', p2.toLowerCase()].join(''));
10
6
 
11
- export const kebabToCamel = (str) => str.replace(
12
- /([-_][a-z])/g,
13
- (group) => group.toUpperCase()
14
- .replace('-', ''),
15
- );
7
+ export const kebabToCamel = (str) =>
8
+ str.replace(/([-_][a-z])/g, (group) => group.toUpperCase().replace('-', ''));
16
9
 
17
- export const camelToKebab = (str) => str.replace(
18
- /([A-Z])/g,
19
- (group) => group.toLowerCase()
20
- .replace('', '-'),
21
- );
10
+ export const camelToKebab = (str) =>
11
+ str.replace(/([A-Z])/g, (group) => group.toLowerCase().replace('', '-'));
22
12
 
23
- export const kebabToSnake = (str) => str.replace(
24
- /([-_][a-z])/g,
25
- (group) => group
26
- .replace('-', '_'),
27
- );
13
+ export const kebabToSnake = (str) =>
14
+ str.replace(/([-_][a-z])/g, (group) => group.replace('-', '_'));
28
15
 
29
- export const snakeToKebab = (str) => str.replace(
30
- /([-_][a-z])/g,
31
- (group) => group
32
- .replace('_', '-'),
33
- );
16
+ export const snakeToKebab = (str) =>
17
+ str.replace(/([-_][a-z])/g, (group) => group.replace('_', '-'));
34
18
 
35
19
  export const objSnakeToCamel = (obj, skipKeys = []) => {
36
20
  if (!obj) return obj;
@@ -44,16 +28,16 @@ export const objSnakeToCamel = (obj, skipKeys = []) => {
44
28
  return value; // number
45
29
  });
46
30
  }
47
- Object.keys(obj)
48
- .forEach((oldKey) => {
31
+ Object.keys(obj).forEach((oldKey) => {
49
32
  if (skipKeys.includes(oldKey)) {
50
33
  newObj[oldKey] = obj[oldKey];
51
34
  } else {
52
35
  const newKey = snakeToCamel(oldKey);
53
36
  let value = obj[oldKey];
54
- if (Array.isArray(value) ||
55
- (value !== null && value !== undefined && value.constructor ===
56
- Object)) {
37
+ if (
38
+ Array.isArray(value) ||
39
+ (value !== null && value !== undefined && value.constructor === Object)
40
+ ) {
57
41
  value = objSnakeToCamel(value, skipKeys);
58
42
  }
59
43
  newObj[newKey] = value;
@@ -75,16 +59,16 @@ export const objCamelToSnake = (obj, skipKeys = []) => {
75
59
  return value; // number
76
60
  });
77
61
  }
78
- Object.keys(obj)
79
- .forEach((oldKey) => {
62
+ Object.keys(obj).forEach((oldKey) => {
80
63
  if (skipKeys.includes(oldKey)) {
81
64
  newObj[oldKey] = obj[oldKey];
82
65
  } else {
83
66
  const newKey = camelToSnake(oldKey);
84
67
  let value = obj[oldKey];
85
- if (Array.isArray(value) ||
86
- (value !== null && value !== undefined && value.constructor ===
87
- Object)) {
68
+ if (
69
+ Array.isArray(value) ||
70
+ (value !== null && value !== undefined && value.constructor === Object)
71
+ ) {
88
72
  value = objCamelToSnake(value, skipKeys);
89
73
  }
90
74
  newObj[newKey] = value;
@@ -1,9 +1,5 @@
1
1
  import lodashDebounce from 'lodash/debounce.js';
2
2
 
3
- const debounce = (
4
- fn,
5
- wait = 1000,
6
- options,
7
- ) => lodashDebounce(fn, wait, options);
3
+ const debounce = (fn, options, wait = 1000) => lodashDebounce(fn, wait, options);
8
4
 
9
5
  export default debounce;
@@ -1,9 +1,10 @@
1
- const editProxy = (item) => new Proxy(item, {
2
- set(obj, prop, value) {
3
- obj._dirty = true;
4
- obj[prop] = value;
5
- return obj;
6
- },
7
- });
1
+ const editProxy = (item) =>
2
+ new Proxy(item, {
3
+ set(obj, prop, value) {
4
+ obj._dirty = true;
5
+ obj[prop] = value;
6
+ return obj;
7
+ },
8
+ });
8
9
 
9
10
  export default editProxy;
@@ -5,7 +5,7 @@ const prettifyFileSize = (size) => {
5
5
  const k = 1024;
6
6
  const sizes = ['b', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb', 'Zb', 'Yb'];
7
7
  const i = Math.floor(Math.log(size) / Math.log(k));
8
- return `${parseFloat((size / k ** i).toFixed(2))} ${sizes[i]}`;
8
+ return `${Number.parseFloat((size / k ** i).toFixed(2))} ${sizes[i]}`;
9
9
  };
10
10
 
11
11
  export default prettifyFileSize;
@@ -1,8 +1,5 @@
1
- const isPageHidden = () => (
2
- document.hidden || document.msHidden || document.webkitHidden ||
3
- document.mozHidden
4
- );
1
+ const isPageHidden = () =>
2
+ document.hidden || document.msHidden || document.webkitHidden || document.mozHidden;
5
3
 
6
- const preventHiddenPageCallsDecorator = (method) => (args) => isPageHidden() ||
7
- method(args);
4
+ const preventHiddenPageCallsDecorator = (method) => (args) => isPageHidden() || method(args);
8
5
  export default preventHiddenPageCallsDecorator;
@@ -1,17 +1,11 @@
1
1
  import BaseStoreModule from './BaseStoreModule.js';
2
2
 
3
- const getParentIdFromContext = (context) => (
4
- context?.getters?.PARENT_ID || context?.state?.parentId
5
- );
3
+ const getParentIdFromContext = (context) => context?.getters?.PARENT_ID || context?.state?.parentId;
6
4
 
7
5
  export default class ApiStoreModule extends BaseStoreModule {
8
6
  generateAPIActions(api) {
9
7
  if (!api) throw new ReferenceError('pass API module!');
10
- this.actions
11
- .GET_LIST = (
12
- _,
13
- { context: callerContext = {}, params = {} },
14
- ) => {
8
+ this.actions.GET_LIST = (_, { context: callerContext = {}, params = {} }) => {
15
9
  if (!api.getList) throw Error('No API "getList" method provided');
16
10
  return api.getList({
17
11
  ...callerContext.state,
@@ -20,11 +14,7 @@ export default class ApiStoreModule extends BaseStoreModule {
20
14
  });
21
15
  };
22
16
 
23
- this.actions
24
- .GET_ITEM = (
25
- _,
26
- { context: callerContext = {}, params = {} } = {},
27
- ) => {
17
+ this.actions.GET_ITEM = (_, { context: callerContext = {}, params = {} } = {}) => {
28
18
  if (!api.get) throw Error('No API "get" method provided');
29
19
  return api.get({
30
20
  ...callerContext.state,
@@ -33,11 +23,7 @@ export default class ApiStoreModule extends BaseStoreModule {
33
23
  });
34
24
  };
35
25
 
36
- this.actions
37
- .POST_ITEM = (
38
- _,
39
- { context: callerContext = {}, ...rest } = {},
40
- ) => {
26
+ this.actions.POST_ITEM = (_, { context: callerContext = {}, ...rest } = {}) => {
41
27
  if (!api.add) throw Error('No API "add" method provided');
42
28
  return api.add({
43
29
  ...callerContext.state,
@@ -46,11 +32,7 @@ export default class ApiStoreModule extends BaseStoreModule {
46
32
  });
47
33
  };
48
34
 
49
- this.actions
50
- .PATCH_ITEM = (
51
- _,
52
- { context: callerContext = {}, id, changes, ...rest },
53
- ) => {
35
+ this.actions.PATCH_ITEM = (_, { context: callerContext = {}, id, changes, ...rest }) => {
54
36
  if (!api.patch) throw Error('No API "patch" method provided');
55
37
  return api.patch({
56
38
  ...callerContext.state,
@@ -61,11 +43,7 @@ export default class ApiStoreModule extends BaseStoreModule {
61
43
  });
62
44
  };
63
45
 
64
- this.actions
65
- .UPD_ITEM = (
66
- _,
67
- { context: callerContext = {}, ...rest } = {},
68
- ) => {
46
+ this.actions.UPD_ITEM = (_, { context: callerContext = {}, ...rest } = {}) => {
69
47
  if (!api.update) throw Error('No API "update" method provided');
70
48
  return api.update({
71
49
  ...callerContext.state,
@@ -74,11 +52,7 @@ export default class ApiStoreModule extends BaseStoreModule {
74
52
  });
75
53
  };
76
54
 
77
- this.actions
78
- .DELETE_ITEM = (
79
- _,
80
- { context: callerContext = {}, id, ...rest },
81
- ) => {
55
+ this.actions.DELETE_ITEM = (_, { context: callerContext = {}, id, ...rest }) => {
82
56
  if (!api.delete) throw Error('No API "delete" method provided');
83
57
  return api.delete({
84
58
  ...callerContext.state,
@@ -18,24 +18,15 @@ export default class BaseStoreModule {
18
18
 
19
19
  generateAPIActions() {
20
20
  if (!this._APIModule) throw new ReferenceError('attach API module first!');
21
- this.actions.GET_LIST = (
22
- context,
23
- params = {},
24
- ) => this._APIModule.getList({ ...context.state, ...params });
25
- this.actions.GET_ITEM = (
26
- context,
27
- params = {},
28
- ) => this._APIModule.get({ ...context.state, ...params });
21
+ this.actions.GET_LIST = (context, params = {}) =>
22
+ this._APIModule.getList({ ...context.state, ...params });
23
+ this.actions.GET_ITEM = (context, params = {}) =>
24
+ this._APIModule.get({ ...context.state, ...params });
29
25
  this.actions.POST_ITEM = (context) => this._APIModule.add(context.state);
30
- this.actions.PATCH_ITEM = (
31
- context,
32
- { id, changes },
33
- ) => (this._APIModule.patch({ ...context.state, id, changes }));
26
+ this.actions.PATCH_ITEM = (context, { id, changes }) =>
27
+ this._APIModule.patch({ ...context.state, id, changes });
34
28
  this.actions.UPD_ITEM = (context) => this._APIModule.update(context.state);
35
- this.actions.DELETE_ITEM = (
36
- context,
37
- id,
38
- ) => this._APIModule.delete({ ...context.state, id });
29
+ this.actions.DELETE_ITEM = (context, id) => this._APIModule.delete({ ...context.state, id });
39
30
  return this;
40
31
  }
41
32
 
@@ -45,13 +36,13 @@ export default class BaseStoreModule {
45
36
  }
46
37
 
47
38
  getModule({
48
- state = {},
49
- getters = {},
50
- actions = {},
51
- mutations = {},
52
- modules = {},
53
- namespaced = true,
54
- } = {}) {
39
+ state = {},
40
+ getters = {},
41
+ actions = {},
42
+ mutations = {},
43
+ modules = {},
44
+ namespaced = true,
45
+ } = {}) {
55
46
  return {
56
47
  namespaced,
57
48
  state: { ...this.state, ...state },
@@ -15,10 +15,7 @@ describe('Base Store Module', () => {
15
15
  module = new BaseStoreModule();
16
16
  });
17
17
  it('attaches api module and generates API actions from it', () => {
18
- const _module = module
19
- .attachAPIModule(APIModule)
20
- .generateAPIActions()
21
- .getModule();
18
+ const _module = module.attachAPIModule(APIModule).generateAPIActions().getModule();
22
19
  expect(_module.actions.GET_LIST).toBeTruthy();
23
20
  expect(_module.actions.GET_ITEM).toBeTruthy();
24
21
  expect(_module.actions.POST_ITEM).toBeTruthy();
@@ -31,10 +28,7 @@ describe('Base Store Module', () => {
31
28
  const params = { jest2: 'jest1' };
32
29
  const context = { state };
33
30
  const expectedParams = { jest: 'jest', jest2: 'jest1' };
34
- const _module = module
35
- .attachAPIModule(APIModule)
36
- .generateAPIActions()
37
- .getModule();
31
+ const _module = module.attachAPIModule(APIModule).generateAPIActions().getModule();
38
32
  _module.actions.GET_LIST(context, params);
39
33
  expect(APIModule.getList).toHaveBeenCalledWith(expectedParams);
40
34
  });
@@ -43,10 +37,7 @@ describe('Base Store Module', () => {
43
37
  const params = { jest2: 'jest1' };
44
38
  const context = { state };
45
39
  const expectedParams = { jest: 'jest', jest2: 'jest1' };
46
- const _module = module
47
- .attachAPIModule(APIModule)
48
- .generateAPIActions()
49
- .getModule();
40
+ const _module = module.attachAPIModule(APIModule).generateAPIActions().getModule();
50
41
  _module.actions.GET_ITEM(context, params);
51
42
  expect(APIModule.get).toHaveBeenCalledWith(expectedParams);
52
43
  });
@@ -54,10 +45,7 @@ describe('Base Store Module', () => {
54
45
  const state = { jest: 'jest' };
55
46
  const context = { state };
56
47
  const expectedParams = { jest: 'jest' };
57
- const _module = module
58
- .attachAPIModule(APIModule)
59
- .generateAPIActions()
60
- .getModule();
48
+ const _module = module.attachAPIModule(APIModule).generateAPIActions().getModule();
61
49
  _module.actions.POST_ITEM(context);
62
50
  expect(APIModule.add).toHaveBeenCalledWith(expectedParams);
63
51
  });
@@ -70,10 +58,7 @@ describe('Base Store Module', () => {
70
58
  id: '1',
71
59
  changes: { jest: 'my change!' },
72
60
  };
73
- const _module = module
74
- .attachAPIModule(APIModule)
75
- .generateAPIActions()
76
- .getModule();
61
+ const _module = module.attachAPIModule(APIModule).generateAPIActions().getModule();
77
62
  _module.actions.PATCH_ITEM(context, params);
78
63
  expect(APIModule.patch).toHaveBeenCalledWith(expectedParams);
79
64
  });
@@ -81,10 +66,7 @@ describe('Base Store Module', () => {
81
66
  const state = { jest: 'jest' };
82
67
  const context = { state };
83
68
  const expectedParams = { jest: 'jest' };
84
- const _module = module
85
- .attachAPIModule(APIModule)
86
- .generateAPIActions()
87
- .getModule();
69
+ const _module = module.attachAPIModule(APIModule).generateAPIActions().getModule();
88
70
  _module.actions.UPD_ITEM(context);
89
71
  expect(APIModule.update).toHaveBeenCalledWith(expectedParams);
90
72
  });
@@ -93,10 +75,7 @@ describe('Base Store Module', () => {
93
75
  const params = '1';
94
76
  const context = { state };
95
77
  const expectedParams = { jest: 'jest', id: '1' };
96
- const _module = module
97
- .attachAPIModule(APIModule)
98
- .generateAPIActions()
99
- .getModule();
78
+ const _module = module.attachAPIModule(APIModule).generateAPIActions().getModule();
100
79
  _module.actions.DELETE_ITEM(context, params);
101
80
  expect(APIModule.delete).toHaveBeenCalledWith(expectedParams);
102
81
  });
@@ -1,6 +1,4 @@
1
- const getNamespacedState = (state, namespace) => (
2
- namespace.split('/')
3
- .reduce((subState, subNamespace) => subState[subNamespace], state)
4
- );
1
+ const getNamespacedState = (state, namespace) =>
2
+ namespace.split('/').reduce((subState, subNamespace) => subState[subNamespace], state);
5
3
 
6
4
  export default getNamespacedState;