@webitel/ui-sdk 0.1.2-vue3 → 0.1.3-vite

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 (374) hide show
  1. package/README.md +1 -1
  2. package/dist/img/sprite/arrow-mix.svg +5 -0
  3. package/dist/img/sprite/azure.svg +19 -0
  4. package/dist/img/sprite/email.svg +3 -0
  5. package/dist/img/sprite/index.js +1 -1
  6. package/dist/img/sprite/meta.svg +17 -0
  7. package/dist/img/sprite/options.svg +5 -0
  8. package/dist/img/sprite/role.svg +3 -0
  9. package/dist/img/sprite/scorecard.svg +4 -0
  10. package/dist/img/sprite/user.svg +3 -0
  11. package/dist/ui-sdk.common.js +36361 -11605
  12. package/dist/ui-sdk.common.js.map +1 -1
  13. package/dist/ui-sdk.css +1 -1
  14. package/dist/ui-sdk.umd.js +36342 -11586
  15. package/dist/ui-sdk.umd.js.map +1 -1
  16. package/dist/ui-sdk.umd.min.js +27 -4
  17. package/dist/ui-sdk.umd.min.js.map +1 -1
  18. package/package.json +24 -8
  19. package/src/api/axios/generateInstance.js +25 -0
  20. package/src/api/defaults/getDefaultGetListResponse/getDefaultGetListResponse.js +6 -0
  21. package/src/api/defaults/getDefaultGetParams/getDefaultGetParams.js +9 -0
  22. package/src/api/defaults/index.js +7 -0
  23. package/src/api/interceptors/request/updateToken.interceptor.js +10 -0
  24. package/src/api/interceptors/response/handleUnauthorized.interceptor.js +12 -0
  25. package/src/api/transformers/applyTransform.js +8 -0
  26. package/src/api/transformers/camelToSnake/camelToSnake.transformer.js +4 -0
  27. package/src/api/transformers/generateUrl/generateUrl.transformer.js +13 -0
  28. package/src/api/transformers/index.js +23 -0
  29. package/src/api/transformers/log/log.transformer.js +6 -0
  30. package/src/api/transformers/merge/merge.transformer.js +5 -0
  31. package/src/api/transformers/mergeEach/mergeEach.transformer.js +8 -0
  32. package/src/api/transformers/notify/notify.transformer.js +32 -0
  33. package/src/api/transformers/sanitize/sanitize.transformer.js +12 -0
  34. package/src/api/transformers/snakeToCamel/snakeToCamel.transformer.js +4 -0
  35. package/src/api/transformers/starToSearch/starToSearch.transformer.js +12 -0
  36. package/src/components/index.js +63 -55
  37. package/src/components/on-demand/wt-cc-agent-status-timers/__tests__/wt-cc-agent-status-timers.spec.js +25 -0
  38. package/src/components/on-demand/wt-cc-agent-status-timers/wt-cc-agent-status-timers.vue +48 -0
  39. package/src/components/transitions/wt-expand-transition.vue +41 -39
  40. package/src/components/{organisms/wt-app-header → wt-app-header}/__tests__/WtAppNavigator.spec.js +2 -2
  41. package/src/components/{organisms/wt-app-header → wt-app-header}/__tests__/WtHeaderActions.spec.js +1 -1
  42. package/src/{css/components/organisms → components}/wt-app-header/_variables.scss +3 -2
  43. package/src/components/wt-app-header/wt-app-header.vue +29 -0
  44. package/src/components/{organisms/wt-app-header → wt-app-header}/wt-app-navigator.vue +69 -40
  45. package/src/components/wt-avatar/_variables.scss +32 -0
  46. package/src/components/wt-avatar/wt-avatar.vue +187 -0
  47. package/src/components/{atoms/wt-badge → wt-badge}/wt-badge.vue +20 -13
  48. package/src/components/wt-button/Readme.md +23 -0
  49. package/src/components/{atoms/wt-button → wt-button}/__tests__/WtButton.spec.js +1 -1
  50. package/src/components/wt-button/_variables.scss +41 -0
  51. package/src/components/wt-button/wt-button.vue +205 -0
  52. package/src/components/wt-button-select/Readme.md +13 -0
  53. package/src/components/{molecules/wt-button-select → wt-button-select}/__tests__/WtButtonSelect.spec.js +16 -5
  54. package/src/components/wt-button-select/_variables.scss +7 -0
  55. package/src/components/wt-button-select/wt-button-select.vue +130 -0
  56. package/src/components/{molecules/wt-checkbox → wt-checkbox}/__tests__/WtCheckbox.spec.js +6 -6
  57. package/src/components/wt-checkbox/wt-checkbox.vue +191 -0
  58. package/src/{css/components/atoms → components}/wt-chip/wt-chip.scss +1 -1
  59. package/src/components/wt-chip/wt-chip.vue +24 -0
  60. package/src/components/{atoms/wt-context-menu → wt-context-menu}/__tests__/WtContextMenu.spec.js +1 -1
  61. package/src/{css/components/atoms → components}/wt-context-menu/_variables.scss +2 -0
  62. package/src/components/{atoms/wt-context-menu → wt-context-menu}/wt-context-menu.vue +68 -42
  63. package/src/components/{molecules/wt-datepicker → wt-datepicker}/__tests__/WtDatepicker.spec.js +4 -4
  64. package/src/components/wt-datepicker/_variables.scss +56 -0
  65. package/src/components/wt-datepicker/wt-datepicker.vue +240 -0
  66. package/src/components/wt-divider/wt-divider.vue +30 -0
  67. package/src/components/wt-dummy/__tests__/WtDummy.spec.js +9 -0
  68. package/src/components/wt-dummy/wt-dummy.vue +73 -0
  69. package/src/components/{organisms/wt-error-page → wt-error-page}/__tests__/wt-error-page.spec.js +3 -3
  70. package/src/components/{organisms/wt-error-page → wt-error-page}/wt-error-page.vue +2 -2
  71. package/src/components/wt-expansion-panel/__tests__/WtExpansionPanel.spec.js +9 -0
  72. package/src/components/wt-expansion-panel/wt-expansion-panel.vue +67 -0
  73. package/src/components/{organisms/wt-filters-panel-wrapper → wt-filters-panel-wrapper}/wt-filters-panel-wrapper.vue +6 -6
  74. package/src/components/{organisms/wt-headline → wt-headline}/wt-headline.vue +5 -0
  75. package/src/components/wt-headline-nav/Readme.md +9 -0
  76. package/src/components/{organisms/wt-headline-nav → wt-headline-nav}/__tests__/wt-headline-nav.spec.js +1 -1
  77. package/src/components/wt-headline-nav/_variables.scss +8 -0
  78. package/src/components/{organisms/wt-headline-nav → wt-headline-nav}/wt-headline-nav.vue +41 -29
  79. package/src/components/{molecules/wt-hint → wt-hint}/wt-hint.vue +7 -1
  80. package/src/components/wt-icon/Readme.md +327 -0
  81. package/src/components/{atoms/wt-icon → wt-icon}/__tests__/WtIcon.spec.js +2 -2
  82. package/src/components/wt-icon/_variables.scss +31 -0
  83. package/src/components/wt-icon/docs/cleanup-svg-fill-none.png +0 -0
  84. package/src/components/wt-icon/docs/cleanup-svg-fill.png +0 -0
  85. package/src/components/wt-icon/docs/cleanup-svg-viewbox-correct.png +0 -0
  86. package/src/components/wt-icon/docs/cleanup-svg-viewbox-incorrect.png +0 -0
  87. package/src/components/wt-icon/docs/cleanup-svg-width-height.png +0 -0
  88. package/src/components/wt-icon/docs/svg-icon-code-example.png +0 -0
  89. package/src/components/wt-icon/docs/svg-sprite-in-dom.png +0 -0
  90. package/src/components/wt-icon/wt-icon.vue +172 -0
  91. package/src/components/wt-icon-action/__tests__/WtIconAction.spec.js +9 -0
  92. package/src/components/wt-icon-action/_internals/__tests__/WtAddIconAction.spec.js +9 -0
  93. package/src/components/wt-icon-action/_internals/__tests__/WtDeleteIconAction.spec.js +9 -0
  94. package/src/components/wt-icon-action/_internals/__tests__/WtDownloadIconAction.spec.js +9 -0
  95. package/src/components/wt-icon-action/_internals/__tests__/WtEditIconAction.spec.js +9 -0
  96. package/src/components/wt-icon-action/_internals/__tests__/WtHistoryIconAction.spec.js +9 -0
  97. package/src/components/wt-icon-action/_internals/__tests__/WtRefreshIconAction.spec.js +9 -0
  98. package/src/components/wt-icon-action/_internals/wt-add-icon-action.vue +27 -0
  99. package/src/components/wt-icon-action/_internals/wt-delete-icon-action.vue +27 -0
  100. package/src/components/wt-icon-action/_internals/wt-download-icon-action.vue +27 -0
  101. package/src/components/wt-icon-action/_internals/wt-edit-icon-action.vue +27 -0
  102. package/src/components/wt-icon-action/_internals/wt-history-icon-action.vue +27 -0
  103. package/src/components/wt-icon-action/_internals/wt-refresh-icon-action.vue +27 -0
  104. package/src/components/wt-icon-action/wt-icon-action.vue +54 -0
  105. package/src/components/wt-icon-btn/Readme.md +10 -0
  106. package/src/components/{molecules/wt-icon-btn → wt-icon-btn}/__tests__/WtIconBtn.spec.js +2 -2
  107. package/src/components/wt-icon-btn/_variables.scss +9 -0
  108. package/src/components/wt-icon-btn/wt-icon-btn.vue +47 -0
  109. package/src/components/{atoms/wt-indicator → wt-indicator}/__tests__/WtIndicator.spec.js +2 -2
  110. package/src/{css/components/atoms → components}/wt-indicator/_variables.scss +3 -3
  111. package/src/components/{atoms/wt-indicator → wt-indicator}/wt-indicator.vue +5 -0
  112. package/src/components/{molecules/wt-input → wt-input}/__tests__/WtInput.spec.js +3 -3
  113. package/src/components/{molecules/wt-input → wt-input}/wt-input.vue +40 -20
  114. package/src/{css/components/atoms → components}/wt-input-info/_variables.scss +2 -2
  115. package/src/components/wt-input-info/wt-input-info.vue +40 -0
  116. package/src/components/wt-item-link/__tests__/WtItemLink.spec.js +9 -0
  117. package/src/components/wt-item-link/wt-item-link.vue +57 -0
  118. package/src/components/{molecules/wt-label → wt-label}/wt-label.vue +5 -0
  119. package/src/components/{molecules/wt-load-bar → wt-load-bar}/wt-load-bar.vue +7 -2
  120. package/src/{css/components/atoms → components}/wt-loader/_variables.scss +2 -2
  121. package/src/components/{atoms/wt-loader → wt-loader}/wt-loader.vue +22 -17
  122. package/src/components/{organisms/wt-navigation-bar → wt-navigation-bar}/__tests__/WtNavigationBar.spec.js +22 -18
  123. package/src/components/{organisms/wt-navigation-bar → wt-navigation-bar}/wt-navigation-bar.vue +27 -16
  124. package/src/components/{molecules/wt-notification → wt-notification}/__tests__/WtNotification.spec.js +1 -1
  125. package/src/components/wt-notification/wt-notification.vue +86 -0
  126. package/src/components/{organisms/wt-notifications-bar → wt-notifications-bar}/__tests__/WtNotificationsBar.spec.js +6 -6
  127. package/src/components/wt-notifications-bar/wt-notifications-bar.vue +78 -0
  128. package/src/components/wt-page-header/__tests__/wt-page-header.spec.js +9 -0
  129. package/src/components/wt-page-header/wt-page-header.vue +83 -0
  130. package/src/components/{organisms/wt-page-wrapper → wt-page-wrapper}/wt-page-wrapper.vue +6 -0
  131. package/src/components/{organisms/wt-pagination → wt-pagination}/__tests__/WtPagination.spec.js +2 -1
  132. package/src/components/{organisms/wt-pagination → wt-pagination}/wt-pagination.vue +7 -1
  133. package/src/{css/components/organisms → components}/wt-player/_variables.scss +1 -1
  134. package/src/components/{organisms/wt-player → wt-player}/wt-player.vue +10 -5
  135. package/src/components/{molecules/wt-popup → wt-popup}/wt-popup.vue +5 -0
  136. package/src/components/{molecules/wt-progress-bar → wt-progress-bar}/__tests__/WtProgressBar.spec.js +2 -2
  137. package/src/{css/components/molecules → components}/wt-progress-bar/_variables.scss +2 -2
  138. package/src/components/{molecules/wt-progress-bar → wt-progress-bar}/wt-progress-bar.vue +13 -3
  139. package/src/components/{molecules/wt-radio → wt-radio}/__tests__/WtRadio.spec.js +6 -6
  140. package/src/components/wt-radio/wt-radio.vue +180 -0
  141. package/src/components/wt-rounded-action/Readme.md +68 -0
  142. package/src/components/{atoms/wt-rounded-action → wt-rounded-action}/__tests__/WtRoundedAction.spec.js +1 -1
  143. package/src/components/wt-rounded-action/_variables.scss +14 -0
  144. package/src/components/wt-rounded-action/wt-rounded-action.vue +139 -0
  145. package/src/components/{molecules/wt-search-bar → wt-search-bar}/__tests__/WtSearchBar.spec.js +9 -0
  146. package/src/components/wt-search-bar/wt-search-bar.vue +222 -0
  147. package/src/components/{molecules/wt-select → wt-select}/__tests__/WtSelect.spec.js +3 -3
  148. package/src/components/{molecules/wt-select → wt-select}/mixins/__tests__/multiselectMixin.spec.js +4 -4
  149. package/src/components/{molecules/wt-select → wt-select}/mixins/multiselectMixin.js +9 -4
  150. package/src/components/{molecules/wt-select → wt-select}/wt-select.vue +23 -9
  151. package/src/components/{molecules/wt-slider → wt-slider}/wt-slider.vue +8 -3
  152. package/src/components/{organisms/wt-status-select → wt-status-select}/__tests__/WtStatusSelect.spec.js +1 -1
  153. package/src/components/{organisms/wt-status-select → wt-status-select}/_internals/StatusOptions.lookup.js +1 -1
  154. package/src/components/{organisms/wt-status-select → wt-status-select}/wt-status-select.vue +27 -23
  155. package/src/components/wt-stepper/__tests__/WtStepper.spec.vue.js +18 -0
  156. package/src/components/wt-stepper/wt-stepper.vue +89 -0
  157. package/src/components/{molecules/wt-switcher → wt-switcher}/__tests__/WtSwitcher.spec.js +5 -5
  158. package/src/components/wt-switcher/wt-switcher.vue +191 -0
  159. package/src/components/{organisms/wt-table → wt-table}/__tests__/WtTable.spec.js +11 -11
  160. package/src/components/{organisms/wt-table → wt-table}/wt-table.vue +20 -3
  161. package/src/components/{organisms/wt-table-actions → wt-table-actions}/wt-table-actions.vue +5 -0
  162. package/src/components/{organisms/wt-table-column-select → wt-table-column-select}/__tests__/WtTableColumnSelect.spec.js +3 -3
  163. package/src/components/wt-table-column-select/wt-table-column-select.vue +178 -0
  164. package/src/components/{molecules/wt-tabs → wt-tabs}/__tests__/WtTabs.spec.js +3 -3
  165. package/src/{css/components/molecules → components}/wt-tabs/_variables.scss +1 -1
  166. package/src/components/{molecules/wt-tabs → wt-tabs}/wt-tabs.vue +9 -1
  167. package/src/components/{molecules/wt-tags-input → wt-tags-input}/__tests__/WtTagsInput.spec.js +7 -7
  168. package/src/components/{molecules/wt-tags-input → wt-tags-input}/wt-tags-input.vue +18 -7
  169. package/src/components/{molecules/wt-textarea → wt-textarea}/__tests__/WtTextarea.spec.js +4 -4
  170. package/src/components/wt-textarea/wt-textarea.vue +223 -0
  171. package/src/components/{molecules/wt-time-input → wt-time-input}/__tests__/WtTimeInput.spec.js +3 -3
  172. package/src/components/wt-time-input/wt-time-input.vue +187 -0
  173. package/src/components/{molecules/wt-timepicker → wt-timepicker}/__tests__/WtTimepicker.spec.js +13 -13
  174. package/src/components/{molecules/wt-timepicker → wt-timepicker}/wt-timepicker.vue +13 -5
  175. package/src/components/{atoms/wt-tooltip → wt-tooltip}/__tests__/WtTooltip.spec.js +1 -1
  176. package/src/components/wt-tooltip/_internals/useTooltipTriggerSubscriptions.js +68 -0
  177. package/src/components/wt-tooltip/_internals/wt-tooltip-floating.vue +48 -0
  178. package/src/components/wt-tooltip/_variables.scss +11 -0
  179. package/src/components/wt-tooltip/wt-tooltip.vue +150 -0
  180. package/src/composables/useCachedInterval/__tests__/useCachedInterval.spec.js +14 -0
  181. package/src/composables/useCachedInterval/useCachedInterval.js +21 -0
  182. package/src/composables/useDestroyableSortable/useDestroyableSortable.js +66 -0
  183. package/src/composables/useRepresentableAgentPauseCause/__tests__/useRepresentableAgentPauseCause.spec.js +83 -0
  184. package/src/composables/useRepresentableAgentPauseCause/useRepresentableAgentPauseCause.js +37 -0
  185. package/src/css/main.scss +0 -3
  186. package/src/css/styleguide/colors/_colors.scss +177 -147
  187. package/src/css/styleguide/colors/_deprecated.scss +151 -0
  188. package/src/css/styleguide/colors/_palette.scss +358 -0
  189. package/src/directives/clickaway/clickaway.js +3 -0
  190. package/src/directives/index.js +7 -0
  191. package/src/enums/WebitelApplications/AdminSections.enum.js +4 -0
  192. package/src/enums/WebitelApplications/AuditorSections.enum.js +5 -0
  193. package/src/enums/WebitelApplications/CrmSections.enum.js +5 -0
  194. package/src/enums/WebitelApplications/WebitelApplications.enum.js +1 -0
  195. package/src/locale/.DS_Store +0 -0
  196. package/src/locale/en/en.js +96 -13
  197. package/src/locale/es/es.js +282 -0
  198. package/src/locale/i18n.js +4 -0
  199. package/src/locale/ru/ru.js +97 -12
  200. package/src/locale/ua/ua.js +98 -13
  201. package/src/mixins/dataFilterMixins/__tests__/apiFilterMixin.spec.js +5 -7
  202. package/src/mixins/dataFilterMixins/__tests__/enumFilterMixin.spec.js +17 -13
  203. package/src/mixins/dataFilterMixins/__tests__/paginationFilterMixin.spec.js +23 -31
  204. package/src/mixins/dataFilterMixins/__tests__/sortFilterMixin.spec.js +12 -15
  205. package/src/mixins/dataFilterMixins/__tests__/urlControllerMixin.spec.js +12 -12
  206. package/src/mixins/dataFilterMixins/_urlControllerMixin/_urlControllerMixin.js +2 -2
  207. package/src/mixins/dataFilterMixins/paginationFilterMixin.js +3 -3
  208. package/src/mixins/dataFilterMixins/sortFilterMixin.js +2 -2
  209. package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +5 -5
  210. package/src/mixins/validationMixin/useValidation.js +41 -0
  211. package/src/mixins/validationMixin/validationMixin.js +17 -12
  212. package/src/modules/AgentStatusSelect/api/agent-status.js +24 -0
  213. package/src/modules/AgentStatusSelect/api/pause-cause.js +47 -0
  214. package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js +83 -0
  215. package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-pause-cause-popup.spec.js +18 -0
  216. package/src/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue +122 -0
  217. package/src/modules/AgentStatusSelect/components/_internals/wt-cc-status-select-error-popup.vue +55 -0
  218. package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +107 -0
  219. package/src/modules/AuditForm/components/__tests__/audit-form-question-read-wrapper.spec.js +14 -0
  220. package/src/modules/AuditForm/components/__tests__/audit-form-question-write-wrapper.spec.js +60 -0
  221. package/src/modules/AuditForm/components/__tests__/audit-form-question.spec.js +14 -0
  222. package/src/modules/AuditForm/components/__tests__/audit-form.spec.js +70 -0
  223. package/src/modules/AuditForm/components/audit-form-question-read-wrapper.vue +132 -0
  224. package/src/modules/AuditForm/components/audit-form-question-write-wrapper.vue +154 -0
  225. package/src/modules/AuditForm/components/audit-form-question.vue +136 -0
  226. package/src/modules/AuditForm/components/audit-form.vue +183 -0
  227. package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options-write-row.spec.js +24 -0
  228. package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options.spec.js +45 -0
  229. package/src/modules/AuditForm/components/questions/options/audit-form-question-options-write-row.vue +89 -0
  230. package/src/modules/AuditForm/components/questions/options/audit-form-question-options.vue +97 -0
  231. package/src/modules/AuditForm/components/questions/score/__tests__/audit-form-question-score.spec.js +30 -0
  232. package/src/modules/AuditForm/components/questions/score/audit-form-question-score.vue +132 -0
  233. package/src/modules/AuditForm/schemas/AuditFormQuestionOptionsSchema.js +13 -0
  234. package/src/modules/AuditForm/schemas/AuditFormQuestionSchema.js +8 -0
  235. package/src/modules/AuditForm/schemas/AuditFormQuestionScoreSchema.js +8 -0
  236. package/src/modules/CardStoreModule/composables/useCardStore.js +55 -0
  237. package/src/modules/CardStoreModule/store/CardStoreModule.js +84 -0
  238. package/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue +87 -0
  239. package/src/modules/DeleteConfirmationPopup/composables/useDeleteConfirmationPopup.js +28 -0
  240. package/src/modules/FilesExport/FilesExport.js +4 -1
  241. package/src/modules/FilesExport/scripts/generateMediaURL.js +1 -1
  242. package/src/modules/Filters/classes/BaseFilterSchema.js +13 -0
  243. package/src/modules/Filters/components/filter-pagination.vue +61 -0
  244. package/src/modules/Filters/components/filter-table-fields.vue +61 -0
  245. package/src/modules/Filters/composables/useTableFilters.js +17 -0
  246. package/src/modules/Filters/restores/filterFieldsRestore.js +9 -0
  247. package/src/modules/Filters/restores/readme.md +1 -0
  248. package/src/modules/Filters/store/FiltersStoreModule.js +181 -0
  249. package/src/modules/QueryFilters/components/__tests__/abstract-api-filter.spec.js +10 -12
  250. package/src/modules/QueryFilters/components/__tests__/abstract-enum-filter.spec.js +10 -12
  251. package/src/modules/QueryFilters/components/__tests__/filter-datetime.spec.js +12 -12
  252. package/src/modules/QueryFilters/components/__tests__/filter-from-to.spec.js +10 -12
  253. package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +10 -12
  254. package/src/modules/QueryFilters/components/abstract-api-filter.vue +1 -1
  255. package/src/modules/QueryFilters/components/abstract-enum-filter.vue +1 -1
  256. package/src/modules/QueryFilters/components/filter-datetime.vue +4 -3
  257. package/src/modules/QueryFilters/components/filter-from-to.vue +15 -8
  258. package/src/modules/QueryFilters/components/filter-table-fields.vue +101 -0
  259. package/src/modules/QueryFilters/mixins/__tests__/apiFilterMixin.spec.js +11 -11
  260. package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +11 -13
  261. package/src/modules/QueryFilters/mixins/__tests__/paginationFilterMixin.spec.js +18 -25
  262. package/src/modules/QueryFilters/mixins/__tests__/sortFilterMixin.spec.js +14 -9
  263. package/src/modules/QueryFilters/mixins/__tests__/urlControllerMixin.spec.js +12 -14
  264. package/src/modules/QueryFilters/mixins/_urlControllerMixin/_urlControllerMixin.js +2 -2
  265. package/src/modules/QueryFilters/mixins/paginationFilterMixin.js +4 -4
  266. package/src/modules/QueryFilters/store/QueryFiltersStoreModule.js +21 -8
  267. package/src/modules/TableStoreModule/composables/useTableStore.js +58 -0
  268. package/src/modules/TableStoreModule/store/TableStoreModule.js +207 -0
  269. package/src/modules/Userinfo/api/auth.js +6 -4
  270. package/src/modules/Userinfo/api/userinfo.js +16 -4
  271. package/src/modules/Userinfo/classes/ApplicationsAccess.js +27 -0
  272. package/src/modules/Userinfo/components/__tests__/auth.spec.js +11 -12
  273. package/src/modules/Userinfo/components/the-auth.vue +2 -1
  274. package/src/modules/Userinfo/enums/Permissions.enum.js +7 -0
  275. package/src/modules/Userinfo/store/UserinfoStoreModule.js +41 -1
  276. package/src/plugins/breakpoint/breakpoint.plugin.js +5 -4
  277. package/src/scripts/__tests__/updateObject.spec.js +19 -0
  278. package/src/scripts/caseConverters.js +2 -2
  279. package/src/scripts/debounce.js +3 -9
  280. package/src/scripts/eventBus.js +7 -3
  281. package/src/scripts/updateObject.js +6 -0
  282. package/src/store/BaseStoreModules/ApiStoreModule.js +93 -0
  283. package/src/store/ReactiveNowStoreModule/ReactiveNowStoreModule.js +27 -0
  284. package/src/validators/decimalValidator.js +9 -0
  285. package/src/validators/domainValidator.js +5 -0
  286. package/src/components/atoms/wt-avatar/wt-avatar.vue +0 -102
  287. package/src/components/atoms/wt-button/wt-button.vue +0 -288
  288. package/src/components/atoms/wt-chip/wt-chip.vue +0 -23
  289. package/src/components/atoms/wt-divider/wt-divider.vue +0 -25
  290. package/src/components/atoms/wt-icon/wt-icon.vue +0 -150
  291. package/src/components/atoms/wt-input-info/wt-input-info.vue +0 -35
  292. package/src/components/atoms/wt-rounded-action/wt-rounded-action.vue +0 -156
  293. package/src/components/atoms/wt-tooltip/wt-tooltip.vue +0 -48
  294. package/src/components/molecules/wt-button-select/wt-button-select.vue +0 -184
  295. package/src/components/molecules/wt-checkbox/wt-checkbox.vue +0 -179
  296. package/src/components/molecules/wt-datepicker/wt-datepicker.vue +0 -203
  297. package/src/components/molecules/wt-datetimepicker/__tests__/WtDatetimepicker.spec.js +0 -79
  298. package/src/components/molecules/wt-datetimepicker/wt-datetimepicker.vue +0 -300
  299. package/src/components/molecules/wt-icon-btn/wt-icon-btn.vue +0 -75
  300. package/src/components/molecules/wt-notification/wt-notification.vue +0 -75
  301. package/src/components/molecules/wt-radio/wt-radio.vue +0 -170
  302. package/src/components/molecules/wt-search-bar/wt-search-bar.vue +0 -194
  303. package/src/components/molecules/wt-switcher/wt-switcher.vue +0 -182
  304. package/src/components/molecules/wt-textarea/wt-textarea.vue +0 -215
  305. package/src/components/molecules/wt-time-input/wt-time-input.vue +0 -190
  306. package/src/components/organisms/wt-app-header/wt-app-header.vue +0 -24
  307. package/src/components/organisms/wt-notifications-bar/wt-notifications-bar.vue +0 -71
  308. package/src/components/organisms/wt-table/__tests__/WtTableDeleteAction.spec.js +0 -9
  309. package/src/components/organisms/wt-table/__tests__/WtTableEditAction.spec.js +0 -9
  310. package/src/components/organisms/wt-table/table-cells/wt-table-delete-action.vue +0 -21
  311. package/src/components/organisms/wt-table/table-cells/wt-table-edit-action.vue +0 -22
  312. package/src/components/organisms/wt-table-column-select/wt-table-column-select.vue +0 -120
  313. package/src/css/components/_components.scss +0 -45
  314. package/src/css/components/atoms/wt-avatar/_variables.scss +0 -14
  315. package/src/css/components/atoms/wt-button/_variables.scss +0 -47
  316. package/src/css/components/atoms/wt-icon/_variables.scss +0 -8
  317. package/src/css/components/atoms/wt-rounded-action/_variables.scss +0 -7
  318. package/src/css/components/atoms/wt-tooltip/_variables.scss +0 -29
  319. package/src/css/components/molecules/wt-button-select/_variables.scss +0 -18
  320. package/src/css/components/molecules/wt-datepicker/_variables.scss +0 -21
  321. package/src/css/components/molecules/wt-datepicker/datepicker-calendar.scss +0 -90
  322. package/src/css/components/molecules/wt-datetimepicker/_variables.scss +0 -11
  323. package/src/css/components/molecules/wt-icon-btn/_variables.scss +0 -3
  324. package/src/css/components/organisms/wt-headline-nav/_variables.scss +0 -5
  325. /package/src/components/{organisms/wt-app-header → wt-app-header}/__tests__/WtAppHeader.spec.js +0 -0
  326. /package/src/components/{organisms/wt-app-header → wt-app-header}/wt-header-actions.vue +0 -0
  327. /package/src/components/{atoms/wt-avatar → wt-avatar}/__tests__/wt-avatar.spec.js +0 -0
  328. /package/src/components/{atoms/wt-badge → wt-badge}/__tests__/wt-badge.spec.js +0 -0
  329. /package/src/{css/components/atoms → components}/wt-badge/_variables.scss +0 -0
  330. /package/src/{css/components/molecules → components}/wt-checkbox/_variables.scss +0 -0
  331. /package/src/components/{atoms/wt-chip → wt-chip}/__tests__/WtChip.spec.js +0 -0
  332. /package/src/{css/components/atoms → components}/wt-chip/_variables.scss +0 -0
  333. /package/src/components/{molecules/wt-copy-action → wt-copy-action}/__tests__/WtCopyAction.spec.js +0 -0
  334. /package/src/components/{molecules/wt-copy-action → wt-copy-action}/wt-copy-action.vue +0 -0
  335. /package/src/components/{atoms/wt-divider → wt-divider}/__tests__/WtDivider.spec.js +0 -0
  336. /package/src/{css/components/atoms → components}/wt-divider/_variables.scss +0 -0
  337. /package/src/components/{organisms/wt-filters-panel-wrapper/__tests__/wt-filters-panel-wrapper.spec.js → wt-filters-panel-wrapper/__tests__/WtFiltersPanelWrapper.spec.js} +0 -0
  338. /package/src/components/{organisms/wt-headline → wt-headline}/__tests__/WtHeadline.spec.js +0 -0
  339. /package/src/{css/components/organisms → components}/wt-headline/_variables.scss +0 -0
  340. /package/src/components/{molecules/wt-hint → wt-hint}/__tests__/WtHint.spec.js +0 -0
  341. /package/src/{css/components/molecules → components}/wt-input/_variables.scss +0 -0
  342. /package/src/components/{atoms/wt-input-info → wt-input-info}/__tests__/WtInputInfo.spec.js +0 -0
  343. /package/src/components/{molecules/wt-label → wt-label}/__tests__/WtLabel.spec.js +0 -0
  344. /package/src/{css/components/atoms → components}/wt-label/_variables.scss +0 -0
  345. /package/src/components/{molecules/wt-label → wt-label}/mixins/labelUsageMixin.js +0 -0
  346. /package/src/components/{molecules/wt-load-bar → wt-load-bar}/__tests__/WtLoadBar.spec.js +0 -0
  347. /package/src/{css/components/molecules → components}/wt-load-bar/_variables.scss +0 -0
  348. /package/src/components/{atoms/wt-loader → wt-loader}/__tests__/WtLoader.spec.js +0 -0
  349. /package/src/components/{atoms/wt-loader → wt-loader}/_internals/wt-loader--md.vue +0 -0
  350. /package/src/components/{atoms/wt-loader → wt-loader}/_internals/wt-loader--sm.vue +0 -0
  351. /package/src/{css/components/organisms → components}/wt-navigation-bar/_variables.scss +0 -0
  352. /package/src/{css/components/molecules → components}/wt-notification/_variables.scss +0 -0
  353. /package/src/{css/components/organisms → components}/wt-notifications-bar/_variables.scss +0 -0
  354. /package/src/components/{organisms/wt-page-wrapper → wt-page-wrapper}/__tests__/WtPageWrapper.spec.js +0 -0
  355. /package/src/{css/components/organisms → components}/wt-page-wrapper/_variables.scss +0 -0
  356. /package/src/{css/components/organisms → components}/wt-pagination/_variables.scss +0 -0
  357. /package/src/components/{organisms/wt-player → wt-player}/__tests__/WtPlayer.spec.js +0 -0
  358. /package/src/components/{molecules/wt-popup → wt-popup}/__tests__/WtPopup.spec.js +0 -0
  359. /package/src/{css/components/molecules → components}/wt-popup/_variables.scss +0 -0
  360. /package/src/{css/components/molecules → components}/wt-radio/_variables.scss +0 -0
  361. /package/src/{css/components/molecules → components}/wt-search-bar/_variables.scss +0 -0
  362. /package/src/{css/components/molecules → components}/wt-select/_multiselect.scss +0 -0
  363. /package/src/{css/components/molecules → components}/wt-select/_variables.scss +0 -0
  364. /package/src/components/{molecules/wt-slider → wt-slider}/__tests__/WtSlider.spec.js +0 -0
  365. /package/src/{css/components/molecules → components}/wt-slider/_variables.scss +0 -0
  366. /package/src/{css/components/organisms → components}/wt-status-select/_variables.scss +0 -0
  367. /package/src/{css/components/molecules → components}/wt-switcher/_variables.scss +0 -0
  368. /package/src/components/{organisms/wt-table → wt-table}/_internals/getSortOrder.js +0 -0
  369. /package/src/{css/components/organisms → components}/wt-table/_variables.scss +0 -0
  370. /package/src/components/{organisms/wt-table-actions → wt-table-actions}/__tests__/WtTableActions.spec.js +0 -0
  371. /package/src/{css/components/organisms → components}/wt-table-actions/_variables.scss +0 -0
  372. /package/src/{css/components/molecules → components}/wt-tags-input/_variables.scss +0 -0
  373. /package/src/{css/components/molecules → components}/wt-textarea/_variables.scss +0 -0
  374. /package/src/{css/components/molecules → components}/wt-timepicker/_variables.scss +0 -0
@@ -0,0 +1,207 @@
1
+ import {
2
+ queryToSortAdapter,
3
+ SortSymbols,
4
+ sortToQueryAdapter,
5
+ } from '../../../scripts/sortQueryAdapters';
6
+ import BaseStoreModule from '../../../store/BaseStoreModules/BaseStoreModule';
7
+
8
+ export default class TableStoreModule extends BaseStoreModule {
9
+ state = {
10
+ headers: [],
11
+ dataList: [],
12
+ error: {},
13
+ isLoading: false,
14
+ isNextPage: false,
15
+ };
16
+
17
+ getters = {
18
+ PARENT_ID: () => null,
19
+
20
+ GET_FILTERS: (state, getters) => getters['filters/GET_FILTERS'],
21
+
22
+ // required fields to send as "fields" param with GET_LIST
23
+ REQUIRED_FIELDS: () => ['id'],
24
+
25
+ FIELDS: (state, getters) => {
26
+ const filtersFields = getters.GET_FILTERS.filters;
27
+
28
+ const defaultFields = state.headers.filter((header) => header.show)
29
+ .map((header) => header.field);
30
+
31
+ const getFieldsByFieldValues = (values) => {
32
+ values.map((passedValue) => state.headers.find(({ value }) => passedValue
33
+ === value).field);
34
+ };
35
+
36
+ return [
37
+ ...new Set(filtersFields
38
+ ? getFieldsByFieldValues(filtersFields)
39
+ : defaultFields),
40
+ ].concat(getters.REQUIRED_FIELDS);
41
+ },
42
+
43
+ // main GET_LIST params collector
44
+ GET_LIST_PARAMS: (state, getters) => (overrideFilters) => {
45
+ const filters = getters.GET_FILTERS;
46
+ const fields = getters.FIELDS;
47
+ const parentId = getters.PARENT_ID;
48
+
49
+ return {
50
+ parentId,
51
+ ...filters,
52
+ fields,
53
+ ...overrideFilters,
54
+ };
55
+ },
56
+ };
57
+
58
+ actions = {
59
+ LOAD_DATA_LIST: async (context, query) => {
60
+ /*
61
+ https://my.webitel.com/browse/WTEL-3560
62
+ preventively disable isNext to handle case when user is clicking
63
+ "next" faster than actual request is made
64
+ */
65
+ context.commit('SET_IS_NEXT', false);
66
+
67
+ const params = context.getters.GET_LIST_PARAMS(query);
68
+ try {
69
+ context.commit('SET_LOADING', true);
70
+ let {
71
+ items = [],
72
+ next = false,
73
+ } = await context.dispatch('api/GET_LIST', { context, params });
74
+
75
+ /* [https://my.webitel.com/browse/WTEL-3793]
76
+ * When deleting the last item from list,
77
+ * if there are other items on the previous page, you need to go back */
78
+ if (!items.length && params.page > 1) {
79
+ return context.dispatch('filters/SET_FILTER', {
80
+ filter: 'page',
81
+ value: params.page - 1,
82
+ });
83
+ }
84
+
85
+ /* we should set _isSelected property to all items in tables cause their checkbox selection
86
+ * is based on this property. Previously, this prop was set it api consumers, but now
87
+ * admin-specific were replaced by webitel-sdk consumers and i supposed it will be
88
+ * weird to set this property in each api file through defaultListObject */
89
+ items = items.map((item) => ({ ...item, _isSelected: false }));
90
+ context.commit('SET_DATA_LIST', items);
91
+ context.commit('SET_IS_NEXT', next);
92
+ } catch (err) {
93
+ context.commit('SET_ERROR', err);
94
+ } finally {
95
+ context.commit('SET_LOADING', false);
96
+ }
97
+ },
98
+ SET_HEADERS: (context, headers) => context.commit('SET_HEADERS', headers),
99
+ RESTORE_FIELDS_FROM_FILTER: (context, { value }) => {
100
+ const headers = context.state.headers.map((header) => ({
101
+ ...header,
102
+ show: value.includes(header.value),
103
+ }));
104
+ return context.dispatch('SET_HEADERS', headers);
105
+ },
106
+ SORT: async (context, { header, nextSortOrder }) => {
107
+ const sort = nextSortOrder
108
+ ? `${sortToQueryAdapter(nextSortOrder)}${header.field}`
109
+ : nextSortOrder;
110
+ await context.dispatch('filters/SET_FILTER', {
111
+ filter: 'sort',
112
+ value: sort,
113
+ });
114
+ await context.dispatch('UPDATE_HEADER_SORT', { header, nextSortOrder });
115
+ },
116
+ RESTORE_SORT_FROM_FILTER: (context, { value }) => {
117
+ const sort = queryToSortAdapter(value.slice(0, 1));
118
+ const field = sort ? value.slice(1) : value;
119
+ return context.dispatch('UPDATE_HEADER_SORT', {
120
+ header: { field },
121
+ nextSortOrder: sort,
122
+ });
123
+ },
124
+ UPDATE_HEADER_SORT: (context, { header, nextSortOrder }) => {
125
+ const headers = context.state.headers.map((oldHeader) => ({
126
+ ...oldHeader,
127
+ sort: oldHeader.field === header.field
128
+ ? nextSortOrder
129
+ : SortSymbols.NONE,
130
+ }));
131
+ context.commit('SET_HEADERS', headers);
132
+ },
133
+ PATCH_ITEM_PROPERTY: async (context, {
134
+ item, index, prop, value,
135
+ }) => {
136
+ await context.commit('PATCH_ITEM_PROPERTY', { index, prop, value });
137
+ const id = item?.id || context.state.dataList[index].id;
138
+ const { etag } = item;
139
+ const changes = { [prop]: value };
140
+ try {
141
+ await context.dispatch('api/PATCH_ITEM', {
142
+ context,
143
+ id,
144
+ etag,
145
+ changes,
146
+ });
147
+ context.commit('PATCH_ITEM_PROPERTY', {
148
+ item, index, prop, value,
149
+ });
150
+ } catch (err) {
151
+ await context.dispatch('LOAD_DATA_LIST');
152
+ throw err;
153
+ }
154
+ },
155
+ DELETE: async (context, deleted) => {
156
+ let action = 'DELETE_SINGLE';
157
+ if (Array.isArray(deleted)) {
158
+ if (deleted.length) action = 'DELETE_BULK';
159
+ else action = 'DELETE_ALL';
160
+ }
161
+ try {
162
+ await context.dispatch(action, deleted);
163
+ } catch (err) {
164
+ throw err;
165
+ } finally {
166
+ await context.dispatch('LOAD_DATA_LIST');
167
+ }
168
+ },
169
+ DELETE_SINGLE: async (context, { id, etag }) => {
170
+ try {
171
+ await context.dispatch('api/DELETE_ITEM', { context, id, etag });
172
+ } catch (err) {
173
+ throw err;
174
+ }
175
+ },
176
+ DELETE_BULK: async (
177
+ context,
178
+ deleted,
179
+ ) => Promise.allSettled(deleted.map((item) => context.dispatch('DELETE_SINGLE', item))),
180
+ };
181
+
182
+ mutations = {
183
+ SET_DATA_LIST: (state, items) => {
184
+ state.dataList = items;
185
+ },
186
+ SET_IS_NEXT: (state, next) => {
187
+ state.isNextPage = next;
188
+ },
189
+ SET_HEADERS: (state, headers) => {
190
+ state.headers = headers;
191
+ },
192
+ PATCH_ITEM_PROPERTY: (state, { index, prop, value }) => {
193
+ state.dataList[index][prop] = value;
194
+ },
195
+ SET_LOADING: (state, value) => {
196
+ state.isLoading = value;
197
+ },
198
+ SET_ERROR: (state, value) => {
199
+ state.error = value;
200
+ },
201
+ };
202
+
203
+ constructor({ headers = [] }) {
204
+ super();
205
+ this.state.headers = headers;
206
+ }
207
+ }
@@ -1,15 +1,15 @@
1
1
  import BaseAPIService from './BaseAPIService';
2
+ import applyTransform, {
3
+ notify,
4
+ } from '../../../api/transformers';
2
5
 
3
6
  class AuthAPI extends BaseAPIService {
4
7
  async setToken(token) {
5
8
  localStorage.setItem('access-token', token);
6
- this._instance.defaults.headers['X-Webitel-Access'] = localStorage.getItem('access-token');
7
9
  }
8
10
 
9
11
  removeToken() {
10
12
  localStorage.removeItem('access-token');
11
- localStorage.removeItem('domain');
12
- this._instance.defaults.headers['X-Webitel-Access'] = '';
13
13
  }
14
14
 
15
15
  async logout() {
@@ -19,7 +19,9 @@ class AuthAPI extends BaseAPIService {
19
19
  await this._instance.post(url, {});
20
20
  this.removeToken();
21
21
  } catch (err) {
22
- throw err;
22
+ throw applyTransform(err, [
23
+ notify,
24
+ ]);
23
25
  }
24
26
  }
25
27
  }
@@ -1,3 +1,7 @@
1
+ import applyTransform, {
2
+ notify,
3
+ snakeToCamel,
4
+ } from '../../../api/transformers';
1
5
  import BaseAPIService from './BaseAPIService';
2
6
 
3
7
  class UserinfoAPI extends BaseAPIService {
@@ -9,9 +13,13 @@ class UserinfoAPI extends BaseAPIService {
9
13
  const url = '/userinfo';
10
14
  try {
11
15
  const response = await this._instance.get(url);
12
- return response;
16
+ return applyTransform(response.data, [
17
+ snakeToCamel(),
18
+ ]);
13
19
  } catch (err) {
14
- throw err;
20
+ throw applyTransform(err, [
21
+ notify,
22
+ ]);
15
23
  }
16
24
  // }
17
25
  }
@@ -20,9 +28,13 @@ class UserinfoAPI extends BaseAPIService {
20
28
  const url = 'role/metadata/access';
21
29
  try {
22
30
  const response = await this._instance.get(url);
23
- return response;
31
+ return applyTransform(response.data, [
32
+ snakeToCamel(),
33
+ ]);
24
34
  } catch (err) {
25
- throw err;
35
+ throw applyTransform(err, [
36
+ notify,
37
+ ]);
26
38
  }
27
39
  }
28
40
  }
@@ -1,8 +1,11 @@
1
1
  import deepmerge from 'deepmerge';
2
2
  import deepCopy from 'deep-copy';
3
+ import CrmSections from '../../../enums/WebitelApplications/CrmSections.enum';
3
4
  import WebitelApplications from '../../../enums/WebitelApplications/WebitelApplications.enum';
4
5
  import SupervisorSections from '../../../enums/WebitelApplications/SupervisorSections.enum';
5
6
  import AdminSections from '../../../enums/WebitelApplications/AdminSections.enum';
7
+ import AuditorSections
8
+ from '../../../enums/WebitelApplications/AuditorSections.enum';
6
9
 
7
10
  const applicationsAccess = (value = true) => ({
8
11
  [WebitelApplications.AGENT]: {
@@ -148,6 +151,30 @@ const applicationsAccess = (value = true) => ({
148
151
  _enabled: value,
149
152
  _locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.OBJECTS}`,
150
153
  },
154
+ [AdminSections.CHANGELOGS]: {
155
+ _enabled: value,
156
+ _locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.CHANGELOGS}`,
157
+ },
158
+ [AdminSections.SETTINGS]: {
159
+ _enabled: value,
160
+ _locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.SETTINGS}`,
161
+ },
162
+ },
163
+ [WebitelApplications.AUDIT]: {
164
+ _enabled: value,
165
+ _locale: `WebitelApplications.${WebitelApplications.AUDIT}.name`,
166
+ [AuditorSections.SCORECARDS]: {
167
+ _enabled: value,
168
+ _locale: `WebitelApplications.${WebitelApplications.AUDIT}.sections.${AuditorSections.SCORECARDS}`,
169
+ },
170
+ },
171
+ [WebitelApplications.CRM]: {
172
+ _enabled: value,
173
+ _locale: `WebitelApplications.${WebitelApplications.CRM}.name`,
174
+ [CrmSections.CONTACTS]: {
175
+ _enabled: value,
176
+ _locale: `WebitelApplications.${WebitelApplications.CRM}.sections.${CrmSections.CONTACTS}`,
177
+ },
151
178
  },
152
179
  });
153
180
 
@@ -1,6 +1,6 @@
1
- import { shallowMount, createLocalVue } from '@vue/test-utils';
2
- import Vuex from 'vuex';
3
- import VueRouter from 'vue-router';
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import { createStore } from 'vuex';
3
+ import { createRouter, createWebHistory } from 'vue-router';
4
4
  import JSDOM from 'jsdom';
5
5
  import authAPI from '../../api/auth';
6
6
  import userinfoAPI from '../../api/userinfo';
@@ -11,10 +11,6 @@ import '../../../../../tests/mocks/localStorageMock';
11
11
 
12
12
  localStorage.setItem('access-token', 'jest');
13
13
 
14
- const localVue = createLocalVue();
15
- localVue.use(Vuex);
16
- localVue.use(VueRouter);
17
-
18
14
  authAPI.setToken = jest.fn();
19
15
  userinfoAPI.getSession = jest.fn(() => ({}));
20
16
  userinfoAPI.getApplicationsAccess = jest.fn(() => ({}));
@@ -23,19 +19,22 @@ describe('Auth', () => {
23
19
  let store;
24
20
  let wrapper;
25
21
  global.window = new JSDOM.JSDOM().window;
26
- const router = new VueRouter();
22
+ const router = createRouter({
23
+ history: createWebHistory(),
24
+ routes: [],
25
+ });
27
26
  router.replace = jest.fn();
28
27
 
29
28
  const userinfo = new UserinfoStoreModule().getModule();
30
29
  beforeEach(() => {
31
- store = new Vuex.Store({
30
+ store = createStore({
32
31
  modules: { userinfo },
33
32
  });
34
33
 
35
34
  wrapper = shallowMount(Auth, {
36
- localVue,
37
- store,
38
- router,
35
+ global: {
36
+ plugins: [router, store],
37
+ },
39
38
  });
40
39
  });
41
40
 
@@ -16,7 +16,7 @@
16
16
  <script>
17
17
  import AuthAPI from '../api/auth';
18
18
 
19
- const authURL = process.env.VUE_APP_AUTH_MODULE_URL;
19
+ const authURL = process?.env?.VUE_APP_AUTH_MODULE_URL || import.meta.env.VITE_AUTH_MODE_URL;
20
20
 
21
21
  export default {
22
22
  name: 'auth',
@@ -59,6 +59,7 @@ export default {
59
59
  position: relative;
60
60
  height: 100vh;
61
61
  width: 100vw;
62
+ overflow: hidden;
62
63
 
63
64
  .wt-loader {
64
65
  position: absolute;
@@ -0,0 +1,7 @@
1
+ export default Object.freeze({
2
+ CREATE: 'add',
3
+ READ: 'read',
4
+ EDIT: 'write',
5
+ DELETE: 'delete',
6
+ PLAYBACK_RECORD_FILE: 'playbackRecordFile',
7
+ });
@@ -1,6 +1,7 @@
1
1
  import userinfo from '../api/userinfo';
2
2
  import ApplicationsAccess from '../classes/ApplicationsAccess';
3
3
  import BaseStoreModule from '../../../store/BaseStoreModules/BaseStoreModule';
4
+ import Permissions from '../enums/Permissions.enum';
4
5
 
5
6
  const defaultState = () => ({
6
7
  isLoading: true,
@@ -39,13 +40,52 @@ export default class UserinfoStoreModule extends BaseStoreModule {
39
40
  const accessKey = Object.keys(state.access[getters.THIS_APP]).find((object) => route.name.includes(object));
40
41
  return state.access[getters.THIS_APP][accessKey]?._enabled;
41
42
  },
43
+ GET_OBJECT_SCOPE: (state, getters) => ({ name, route }) => {
44
+ if (route) return getters.GET_OBJECT_SCOPE_BY_ROUTE(route);
45
+ return getters.GET_OBJECT_SCOPE_BY_NAME(name);
46
+ },
47
+ GET_OBJECT_SCOPE_BY_NAME: (state) => (name) => (
48
+ Object.values(state.scope).find((object) => name === object.name)
49
+ ),
50
+ GET_OBJECT_SCOPE_BY_ROUTE: (state) => (route) => (
51
+ Object.values(state.scope).find((object) => route.name.includes(object.route))
52
+ ),
53
+ HAS_READ_ACCESS: (state, getters) => (checkedObject) => {
54
+ if (!getters.CHECK_OBJECT_ACCESS(checkedObject)) return false;
55
+ if (state.permissions[Permissions.READ]) return true;
56
+ const objectScope = getters.GET_OBJECT_SCOPE(checkedObject);
57
+ return objectScope?.access?.includes('r');
58
+ },
59
+ HAS_CREATE_ACCESS: (state, getters) => (checkedObject) => {
60
+ if (state.permissions[Permissions.CREATE]) return true;
61
+ const objectScope = getters.GET_OBJECT_SCOPE(checkedObject);
62
+ return objectScope?.access?.includes('x');
63
+ },
64
+ HAS_EDIT_ACCESS: (state, getters) => (checkedObject) => {
65
+ if (state.permissions[Permissions.EDIT]) return true;
66
+ const objectScope = getters.GET_OBJECT_SCOPE(checkedObject);
67
+ return objectScope?.access?.includes('w');
68
+ },
69
+ HAS_DELETE_ACCESS: (state, getters) => (checkedObject) => {
70
+ if (state.permissions[Permissions.DELETE]) return true;
71
+ const objectScope = getters.GET_OBJECT_SCOPE(checkedObject);
72
+ return objectScope?.access?.includes('d');
73
+ },
42
74
  }
43
75
 
44
76
  actions = {
45
77
  BEFORE_OPEN_SESSION_HOOK: () => {},
46
78
  AFTER_OPEN_SESSION_HOOK: () => {},
47
79
  CONVERT_USER_SCOPE: (context, scope) => scope,
48
- CONVERT_USER_PERMISSIONS: (context, permissions) => permissions,
80
+ CONVERT_USER_PERMISSIONS: (context, initialPermissions) => {
81
+ let permissions = {};
82
+ if (!initialPermissions) return permissions;
83
+ permissions = initialPermissions.reduce((permissions, currentPermission) => ({
84
+ ...permissions,
85
+ [currentPermission.id]: currentPermission,
86
+ }), {});
87
+ return permissions;
88
+ },
49
89
 
50
90
  OPEN_SESSION: async (context) => {
51
91
  await context.dispatch('BEFORE_OPEN_SESSION_HOOK');
@@ -1,3 +1,4 @@
1
+ import { reactive } from 'vue';
1
2
  import debounce from '../../scripts/debounce';
2
3
 
3
4
  // https://stackoverflow.com/questions/41791193/vuejs-reactive-binding-for-a-plugin-how-to/41801107#41801107
@@ -5,7 +6,7 @@ import debounce from '../../scripts/debounce';
5
6
 
6
7
  // https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/services/breakpoint/index.ts
7
8
 
8
- const breakpoint = {
9
+ const breakpoint = reactive({
9
10
  // Breakpoints
10
11
  xs: false,
11
12
  sm: false,
@@ -34,7 +35,7 @@ const breakpoint = {
34
35
  // Dimensions
35
36
  height: 0,
36
37
  width: 0,
37
- };
38
+ });
38
39
 
39
40
  const getClientWidth = () => Math.max(
40
41
  document.documentElement.clientWidth,
@@ -124,13 +125,13 @@ const onResize = () => {
124
125
  breakpoint.mobile = current <= max;
125
126
  };
126
127
 
127
- const install = (Vue) => {
128
+ const install = (app) => {
128
129
  window.addEventListener('resize', debounce(onResize), { passive: true });
129
130
 
130
131
  onResize();
131
132
 
132
133
  // eslint-disable-next-line no-param-reassign
133
- Vue.prototype.$breakpoint = Vue.observable(breakpoint);
134
+ app.config.globalProperties.$breakpoint = breakpoint;
134
135
  };
135
136
 
136
137
  export { install };
@@ -0,0 +1,19 @@
1
+ import updateObject from '../updateObject';
2
+
3
+ describe('updateObject', () => {
4
+ it('doesn\'t mutate original object', () => {
5
+ const original = { jest: 'jest' };
6
+ updateObject({ obj: original, path: 'jest', value: '123' });
7
+ expect(original.jest).toBe('jest');
8
+ });
9
+ it('changes shallow value', () => {
10
+ const original = { jest: 'jest' };
11
+ const result = { jest: 'huest' };
12
+ expect(updateObject({ obj: original, path: 'jest', value: 'huest' })).toEqual(result);
13
+ });
14
+ it('changes deep value', () => {
15
+ const original = { jest: { deep: 'jest' } };
16
+ const result = { jest: { deep: 'huest' } };
17
+ expect(updateObject({ obj: original, path: 'jest.deep', value: 'huest' })).toEqual(result);
18
+ });
19
+ });
@@ -50,7 +50,7 @@ export const objSnakeToCamel = (obj, skipKeys = []) => {
50
50
  } else {
51
51
  const newKey = snakeToCamel(oldKey);
52
52
  let value = obj[oldKey];
53
- if (Array.isArray(value) || (value !== null && value.constructor === Object)) {
53
+ if (Array.isArray(value) || (value !== null && value !== undefined && value.constructor === Object)) {
54
54
  value = objSnakeToCamel(value, skipKeys);
55
55
  }
56
56
  newObj[newKey] = value;
@@ -78,7 +78,7 @@ export const objCamelToSnake = (obj, skipKeys = []) => {
78
78
  } else {
79
79
  const newKey = camelToSnake(oldKey);
80
80
  let value = obj[oldKey];
81
- if (Array.isArray(value) || (value !== null && value.constructor === Object)) {
81
+ if (Array.isArray(value) || (value !== null && value !== undefined && value.constructor === Object)) {
82
82
  value = objCamelToSnake(value, skipKeys);
83
83
  }
84
84
  newObj[newKey] = value;
@@ -1,11 +1,5 @@
1
- const debounce = (method, delay = 1000) => {
2
- let timer;
3
- return (args) => {
4
- if (timer) clearTimeout(timer);
5
- timer = setTimeout(() => {
6
- method(args);
7
- }, delay);
8
- };
9
- };
1
+ import lodashDebounce from 'lodash/debounce';
2
+
3
+ const debounce = (fn, wait = 1000, options) => lodashDebounce(fn, wait, options);
10
4
 
11
5
  export default debounce;
@@ -1,4 +1,8 @@
1
- import Vue from 'vue';
1
+ import emitter from 'tiny-emitter/instance';
2
2
 
3
- const eventBus = new Vue();
4
- export default eventBus;
3
+ export default {
4
+ $on: (...args) => emitter.on(...args),
5
+ $once: (...args) => emitter.once(...args),
6
+ $off: (...args) => emitter.off(...args),
7
+ $emit: (...args) => emitter.emit(...args),
8
+ };
@@ -0,0 +1,6 @@
1
+ import set from 'lodash/set';
2
+ import cloneDeep from 'lodash/cloneDeep';
3
+
4
+ const updateObject = ({ obj, path, value }) => set(cloneDeep(obj), path, value);
5
+
6
+ export default updateObject;
@@ -0,0 +1,93 @@
1
+ import BaseStoreModule from './BaseStoreModule';
2
+
3
+ const getParentIdFromContext = (context) => (
4
+ context?.getters?.PARENT_ID || context?.state?.parentId
5
+ );
6
+
7
+ export default class ApiStoreModule extends BaseStoreModule {
8
+ generateAPIActions(api) {
9
+ if (!api) throw new ReferenceError('pass API module!');
10
+ this.actions
11
+ .GET_LIST = (
12
+ _,
13
+ { context: callerContext = {}, params = {} },
14
+ ) => {
15
+ if (!api.getList) throw Error('No API "getList" method provided');
16
+ return api.getList({
17
+ ...callerContext.state,
18
+ parentId: getParentIdFromContext(callerContext),
19
+ ...params,
20
+ });
21
+ };
22
+
23
+ this.actions
24
+ .GET_ITEM = (
25
+ _,
26
+ { context: callerContext = {}, params = {} } = {},
27
+ ) => {
28
+ if (!api.get) throw Error('No API "get" method provided');
29
+ return api.get({
30
+ ...callerContext.state,
31
+ parentId: getParentIdFromContext(callerContext),
32
+ ...params,
33
+ });
34
+ };
35
+
36
+ this.actions
37
+ .POST_ITEM = (
38
+ _,
39
+ { context: callerContext = {}, ...rest } = {},
40
+ ) => {
41
+ if (!api.add) throw Error('No API "add" method provided');
42
+ return api.add({
43
+ ...callerContext.state,
44
+ parentId: getParentIdFromContext(callerContext),
45
+ ...rest,
46
+ });
47
+ };
48
+
49
+ this.actions
50
+ .PATCH_ITEM = (
51
+ _,
52
+ { context: callerContext = {}, id, changes, ...rest },
53
+ ) => {
54
+ if (!api.patch) throw Error('No API "patch" method provided');
55
+ return api.patch({
56
+ ...callerContext.state,
57
+ parentId: getParentIdFromContext(callerContext),
58
+ ...rest,
59
+ id,
60
+ changes,
61
+ });
62
+ };
63
+
64
+ this.actions
65
+ .UPD_ITEM = (
66
+ _,
67
+ { context: callerContext = {}, ...rest } = {},
68
+ ) => {
69
+ if (!api.update) throw Error('No API "update" method provided');
70
+ return api.update({
71
+ ...callerContext.state,
72
+ parentId: getParentIdFromContext(callerContext),
73
+ ...rest,
74
+ });
75
+ };
76
+
77
+ this.actions
78
+ .DELETE_ITEM = (
79
+ _,
80
+ { context: callerContext = {}, id, ...rest },
81
+ ) => {
82
+ if (!api.delete) throw Error('No API "delete" method provided');
83
+ return api.delete({
84
+ ...callerContext.state,
85
+ parentId: getParentIdFromContext(callerContext),
86
+ ...rest,
87
+ id,
88
+ });
89
+ };
90
+
91
+ return this;
92
+ }
93
+ }