@webitel/ui-sdk 0.1.1 → 0.1.2-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.
- package/CHANGELOG.md +9 -0
- package/README.md +29 -29
- package/dist/demo.html +1 -10
- package/dist/img/plyr.svg +68 -0
- package/dist/img/sprite/account.svg +4 -0
- package/dist/img/sprite/adfs.svg +5 -0
- package/dist/img/sprite/app-navigator.svg +11 -0
- package/dist/img/sprite/arrow-down.svg +3 -0
- package/dist/img/sprite/arrow-left.svg +3 -0
- package/dist/img/sprite/arrow-mix.svg +5 -0
- package/dist/img/sprite/arrow-right.svg +3 -0
- package/dist/img/sprite/arrow-up.svg +3 -0
- package/dist/img/sprite/attach.svg +3 -0
- package/dist/img/sprite/attention.svg +3 -0
- package/dist/img/sprite/azure.svg +19 -0
- package/dist/img/sprite/back.svg +4 -0
- package/dist/img/sprite/bell-badged.svg +4 -0
- package/dist/img/sprite/bell.svg +3 -0
- package/dist/img/sprite/bucket.svg +3 -0
- package/dist/img/sprite/calendar.svg +3 -0
- package/dist/img/sprite/call--filled.svg +3 -0
- package/dist/img/sprite/call-add-to--filled.svg +4 -0
- package/dist/img/sprite/call-add-to.svg +4 -0
- package/dist/img/sprite/call-disconnect--filled.svg +3 -0
- package/dist/img/sprite/call-disconnect.svg +3 -0
- package/dist/img/sprite/call-end--filled.svg +3 -0
- package/dist/img/sprite/call-end.svg +3 -0
- package/dist/img/sprite/call-inbound--filled.svg +4 -0
- package/dist/img/sprite/call-inbound.svg +3 -0
- package/dist/img/sprite/call-missed--filled.svg +4 -0
- package/dist/img/sprite/call-missed.svg +3 -0
- package/dist/img/sprite/call-outbound--filled.svg +3 -0
- package/dist/img/sprite/call-outbound.svg +3 -0
- package/dist/img/sprite/call-ringing--filled.svg +5 -0
- package/dist/img/sprite/call-ringing.svg +3 -0
- package/dist/img/sprite/call-transfer--filled.svg +4 -0
- package/dist/img/sprite/call-transfer.svg +3 -0
- package/dist/img/sprite/call.svg +3 -0
- package/dist/img/sprite/chat--filled.svg +3 -0
- package/dist/img/sprite/chat-emoji.svg +3 -0
- package/dist/img/sprite/chat-end--filled.svg +3 -0
- package/dist/img/sprite/chat-end.svg +4 -0
- package/dist/img/sprite/chat-group.svg +5 -0
- package/dist/img/sprite/chat-join.svg +4 -0
- package/dist/img/sprite/chat-message-status-read.svg +3 -0
- package/dist/img/sprite/chat-message-status-sent.svg +3 -0
- package/dist/img/sprite/chat-quick-response--filled.svg +3 -0
- package/dist/img/sprite/chat-quick-response.svg +3 -0
- package/dist/img/sprite/chat-reply.svg +3 -0
- package/dist/img/sprite/chat-send.svg +6 -0
- package/dist/img/sprite/chat-transfer--filled.svg +3 -0
- package/dist/img/sprite/chat-transfer.svg +4 -0
- package/dist/img/sprite/chat.svg +3 -0
- package/dist/img/sprite/checkbox--checked--filled.svg +3 -0
- package/dist/img/sprite/checkbox--checked.svg +3 -0
- package/dist/img/sprite/checkbox.svg +3 -0
- package/dist/img/sprite/clear.svg +3 -0
- package/dist/img/sprite/close--filled.svg +3 -0
- package/dist/img/sprite/close.svg +3 -0
- package/dist/img/sprite/collapse.svg +5 -0
- package/dist/img/sprite/column-select.svg +4 -0
- package/dist/img/sprite/conference.svg +8 -0
- package/dist/img/sprite/contacts.svg +3 -0
- package/dist/img/sprite/copy.svg +3 -0
- package/dist/img/sprite/docs.svg +6 -0
- package/dist/img/sprite/done.svg +4 -0
- package/dist/img/sprite/download.svg +5 -0
- package/dist/img/sprite/edit.svg +3 -0
- package/dist/img/sprite/email.svg +3 -0
- package/dist/img/sprite/expand.svg +5 -0
- package/dist/img/sprite/eye--closed.svg +5 -0
- package/dist/img/sprite/eye--opened.svg +4 -0
- package/dist/img/sprite/filter.svg +5 -0
- package/dist/img/sprite/generate.svg +4 -0
- package/dist/img/sprite/google.svg +6 -0
- package/dist/img/sprite/history.svg +4 -0
- package/dist/img/sprite/hold.svg +3 -0
- package/dist/img/sprite/idle.svg +4 -0
- package/dist/img/sprite/index.js +1 -0
- package/dist/img/sprite/instagram.svg +28 -0
- package/dist/img/sprite/job--accept.svg +4 -0
- package/dist/img/sprite/job--end.svg +4 -0
- package/dist/img/sprite/job.svg +5 -0
- package/dist/img/sprite/lock.svg +3 -0
- package/dist/img/sprite/logout.svg +3 -0
- package/dist/img/sprite/mail--color.svg +4 -0
- package/dist/img/sprite/mail.svg +3 -0
- package/dist/img/sprite/menu.svg +3 -0
- package/dist/img/sprite/messenger-facebook--filled.svg +3 -0
- package/dist/img/sprite/messenger-facebook.svg +9 -0
- package/dist/img/sprite/messenger-infobip.svg +5 -0
- package/dist/img/sprite/messenger-messenger.svg +12 -0
- package/dist/img/sprite/messenger-telegram--filled.svg +3 -0
- package/dist/img/sprite/messenger-telegram.svg +10 -0
- package/dist/img/sprite/messenger-viber--filled.svg +3 -0
- package/dist/img/sprite/messenger-viber.svg +3 -0
- package/dist/img/sprite/messenger-web-chat.svg +7 -0
- package/dist/img/sprite/messenger-whatsapp--filled.svg +4 -0
- package/dist/img/sprite/messenger-whatsapp.svg +10 -0
- package/dist/img/sprite/meta.svg +17 -0
- package/dist/img/sprite/mic-muted.svg +6 -0
- package/dist/img/sprite/mic.svg +4 -0
- package/dist/img/sprite/move.svg +6 -0
- package/dist/img/sprite/note.svg +3 -0
- package/dist/img/sprite/numpad.svg +24 -0
- package/dist/img/sprite/options.svg +5 -0
- package/dist/img/sprite/pause.svg +3 -0
- package/dist/img/sprite/pin.svg +3 -0
- package/dist/img/sprite/play.svg +4 -0
- package/dist/img/sprite/plus.svg +3 -0
- package/dist/img/sprite/preview-tag-application.svg +6 -0
- package/dist/img/sprite/preview-tag-audio.svg +4 -0
- package/dist/img/sprite/preview-tag-image.svg +4 -0
- package/dist/img/sprite/preview-tag-video.svg +4 -0
- package/dist/img/sprite/prompter.svg +3 -0
- package/dist/img/sprite/queue-member.svg +3 -0
- package/dist/img/sprite/radio--checked.svg +4 -0
- package/dist/img/sprite/radio.svg +3 -0
- package/dist/img/sprite/rec-off.svg +3 -0
- package/dist/img/sprite/rec.svg +4 -0
- package/dist/img/sprite/refresh.svg +4 -0
- package/dist/img/sprite/role.svg +3 -0
- package/dist/img/sprite/rounded-info.svg +3 -0
- package/dist/img/sprite/scorecard.svg +4 -0
- package/dist/img/sprite/search.svg +3 -0
- package/dist/img/sprite/send-arrow.svg +4 -0
- package/dist/img/sprite/settings.svg +3 -0
- package/dist/img/sprite/sort-arrow-down.svg +4 -0
- package/dist/img/sprite/sort-arrow-up.svg +4 -0
- package/dist/img/sprite/sound-off.svg +4 -0
- package/dist/img/sprite/sound-on.svg +3 -0
- package/dist/img/sprite/star--filled.svg +3 -0
- package/dist/img/sprite/star.svg +3 -0
- package/dist/img/sprite/stop.svg +4 -0
- package/dist/img/sprite/stt-download.svg +4 -0
- package/dist/img/sprite/stt-search.svg +3 -0
- package/dist/img/sprite/stt.svg +4 -0
- package/dist/img/sprite/telegram-bot.svg +6 -0
- package/dist/img/sprite/tick.svg +3 -0
- package/dist/img/sprite/tts-download.svg +5 -0
- package/dist/img/sprite/unpin.svg +5 -0
- package/dist/img/sprite/upload.svg +5 -0
- package/dist/img/sprite/user.svg +3 -0
- package/dist/img/sprite/video-cam-off.svg +4 -0
- package/dist/img/sprite/video-cam.svg +3 -0
- package/dist/img/sprite/zoom-in.svg +3 -0
- package/dist/img/sprite/zoom-out.svg +4 -0
- package/dist/ui-sdk.common.js +43300 -0
- package/dist/ui-sdk.common.js.map +1 -0
- package/dist/ui-sdk.css +1 -0
- package/dist/ui-sdk.umd.js +43319 -0
- package/dist/ui-sdk.umd.js.map +1 -0
- package/dist/ui-sdk.umd.min.js +35 -0
- package/dist/ui-sdk.umd.min.js.map +1 -0
- package/package.json +95 -44
- package/src/api/axios/generateInstance.js +25 -0
- package/src/api/defaults/getDefaultGetListResponse/getDefaultGetListResponse.js +6 -0
- package/src/api/defaults/getDefaultGetParams/getDefaultGetParams.js +9 -0
- package/src/api/defaults/index.js +7 -0
- package/src/api/interceptors/request/updateToken.interceptor.js +10 -0
- package/src/api/interceptors/response/handleUnauthorized.interceptor.js +12 -0
- package/src/api/transformers/applyTransform.js +8 -0
- package/src/api/transformers/camelToSnake/camelToSnake.transformer.js +4 -0
- package/src/api/transformers/generateUrl/generateUrl.transformer.js +13 -0
- package/src/api/transformers/index.js +23 -0
- package/src/api/transformers/log/log.transformer.js +6 -0
- package/src/api/transformers/merge/merge.transformer.js +5 -0
- package/src/api/transformers/mergeEach/mergeEach.transformer.js +8 -0
- package/src/api/transformers/notify/notify.transformer.js +32 -0
- package/src/api/transformers/sanitize/sanitize.transformer.js +12 -0
- package/src/api/transformers/snakeToCamel/snakeToCamel.transformer.js +4 -0
- package/src/api/transformers/starToSearch/starToSearch.transformer.js +12 -0
- package/src/components/index.js +91 -33
- package/src/components/on-demand/wt-cc-agent-status-timers/__tests__/wt-cc-agent-status-timers.spec.js +25 -0
- package/src/components/on-demand/wt-cc-agent-status-timers/wt-cc-agent-status-timers.vue +48 -0
- package/src/components/transitions/__tests__/ExpandTransition.spec.js +9 -0
- package/src/components/transitions/wt-expand-transition.vue +72 -0
- package/src/components/wt-app-header/__tests__/WtAppHeader.spec.js +19 -0
- package/src/components/wt-app-header/__tests__/WtAppNavigator.spec.js +23 -0
- package/src/components/wt-app-header/__tests__/WtHeaderActions.spec.js +21 -0
- package/src/components/wt-app-header/_variables.scss +25 -0
- package/src/components/wt-app-header/wt-app-header.vue +29 -0
- package/src/components/wt-app-header/wt-app-navigator.vue +278 -0
- package/src/components/wt-app-header/wt-header-actions.vue +183 -0
- package/src/components/wt-avatar/__tests__/wt-avatar.spec.js +9 -0
- package/src/components/wt-avatar/_variables.scss +32 -0
- package/src/components/wt-avatar/wt-avatar.vue +187 -0
- package/src/components/wt-badge/__tests__/wt-badge.spec.js +9 -0
- package/src/components/wt-badge/_variables.scss +3 -0
- package/src/components/wt-badge/wt-badge.vue +59 -0
- package/src/components/wt-button/Readme.md +23 -0
- package/src/components/wt-button/__tests__/WtButton.spec.js +29 -0
- package/src/components/wt-button/_variables.scss +41 -0
- package/src/components/wt-button/wt-button.vue +205 -0
- package/src/components/wt-button-select/Readme.md +13 -0
- package/src/components/wt-button-select/__tests__/WtButtonSelect.spec.js +40 -0
- package/src/components/wt-button-select/_variables.scss +7 -0
- package/src/components/wt-button-select/wt-button-select.vue +130 -0
- package/src/components/wt-checkbox/__tests__/WtCheckbox.spec.js +41 -0
- package/src/components/wt-checkbox/_variables.scss +4 -0
- package/src/components/wt-checkbox/wt-checkbox.vue +191 -0
- package/src/components/wt-chip/__tests__/WtChip.spec.js +19 -0
- package/src/components/wt-chip/_variables.scss +7 -0
- package/src/components/wt-chip/wt-chip.scss +41 -0
- package/src/components/wt-chip/wt-chip.vue +24 -0
- package/src/components/wt-context-menu/__tests__/WtContextMenu.spec.js +9 -0
- package/src/components/wt-context-menu/_variables.scss +9 -0
- package/src/components/wt-context-menu/wt-context-menu.vue +131 -0
- package/src/components/wt-copy-action/__tests__/WtCopyAction.spec.js +14 -0
- package/src/components/wt-copy-action/wt-copy-action.vue +63 -0
- package/src/components/wt-datepicker/__tests__/WtDatepicker.spec.js +28 -0
- package/src/components/wt-datepicker/_variables.scss +56 -0
- package/src/components/wt-datepicker/wt-datepicker.vue +240 -0
- package/src/components/wt-divider/__tests__/WtDivider.spec.js +9 -0
- package/src/components/wt-divider/_variables.scss +5 -0
- package/src/components/wt-divider/wt-divider.vue +30 -0
- package/src/components/wt-dummy/__tests__/WtDummy.spec.js +9 -0
- package/src/components/wt-dummy/wt-dummy.vue +73 -0
- package/src/components/wt-error-page/__tests__/wt-error-page.spec.js +17 -0
- package/src/components/wt-error-page/wt-error-page.vue +104 -0
- package/src/components/wt-expansion-panel/__tests__/WtExpansionPanel.spec.js +9 -0
- package/src/components/wt-expansion-panel/wt-expansion-panel.vue +67 -0
- package/src/components/wt-filters-panel-wrapper/__tests__/WtFiltersPanelWrapper.spec.js +24 -0
- package/src/components/wt-filters-panel-wrapper/wt-filters-panel-wrapper.vue +146 -0
- package/src/components/wt-headline/__tests__/WtHeadline.spec.js +47 -0
- package/src/components/wt-headline/_variables.scss +6 -0
- package/src/components/wt-headline/wt-headline.vue +50 -0
- package/src/components/wt-headline-nav/Readme.md +9 -0
- package/src/components/wt-headline-nav/__tests__/wt-headline-nav.spec.js +13 -0
- package/src/components/wt-headline-nav/_variables.scss +8 -0
- package/src/components/wt-headline-nav/wt-headline-nav.vue +97 -0
- package/src/components/wt-hint/__tests__/WtHint.spec.js +9 -0
- package/src/components/wt-hint/wt-hint.vue +27 -0
- package/src/components/wt-icon/Readme.md +327 -0
- package/src/components/wt-icon/__tests__/WtIcon.spec.js +24 -0
- package/src/components/wt-icon/_variables.scss +31 -0
- package/src/components/wt-icon/docs/cleanup-svg-fill-none.png +0 -0
- package/src/components/wt-icon/docs/cleanup-svg-fill.png +0 -0
- package/src/components/wt-icon/docs/cleanup-svg-viewbox-correct.png +0 -0
- package/src/components/wt-icon/docs/cleanup-svg-viewbox-incorrect.png +0 -0
- package/src/components/wt-icon/docs/cleanup-svg-width-height.png +0 -0
- package/src/components/wt-icon/docs/svg-icon-code-example.png +0 -0
- package/src/components/wt-icon/docs/svg-sprite-in-dom.png +0 -0
- package/src/components/wt-icon/wt-icon.vue +172 -0
- package/src/components/wt-icon-action/__tests__/WtIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtAddIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtDeleteIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtDownloadIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtEditIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtHistoryIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/__tests__/WtRefreshIconAction.spec.js +9 -0
- package/src/components/wt-icon-action/_internals/wt-add-icon-action.vue +27 -0
- package/src/components/wt-icon-action/_internals/wt-delete-icon-action.vue +27 -0
- package/src/components/wt-icon-action/_internals/wt-download-icon-action.vue +27 -0
- package/src/components/wt-icon-action/_internals/wt-edit-icon-action.vue +27 -0
- package/src/components/wt-icon-action/_internals/wt-history-icon-action.vue +27 -0
- package/src/components/wt-icon-action/_internals/wt-refresh-icon-action.vue +27 -0
- package/src/components/wt-icon-action/wt-icon-action.vue +54 -0
- package/src/components/wt-icon-btn/Readme.md +10 -0
- package/src/components/wt-icon-btn/__tests__/WtIconBtn.spec.js +15 -0
- package/src/components/wt-icon-btn/_variables.scss +9 -0
- package/src/components/wt-icon-btn/wt-icon-btn.vue +47 -0
- package/src/components/wt-indicator/__tests__/WtIndicator.spec.js +29 -0
- package/src/components/wt-indicator/_variables.scss +22 -0
- package/src/components/wt-indicator/wt-indicator.vue +124 -0
- package/src/components/wt-input/__tests__/WtInput.spec.js +25 -0
- package/src/components/wt-input/_variables.scss +8 -0
- package/src/components/wt-input/wt-input.vue +343 -0
- package/src/components/wt-input-info/__tests__/WtInputInfo.spec.js +9 -0
- package/src/{css/components/atoms → components}/wt-input-info/_variables.scss +7 -6
- package/src/components/wt-input-info/wt-input-info.vue +40 -0
- package/src/components/wt-item-link/__tests__/WtItemLink.spec.js +9 -0
- package/src/components/wt-item-link/wt-item-link.vue +57 -0
- package/src/components/wt-label/__tests__/WtLabel.spec.js +9 -0
- package/src/{css/components/atoms → components}/wt-label/_variables.scss +3 -4
- package/src/components/wt-label/mixins/labelUsageMixin.js +21 -0
- package/src/components/wt-label/wt-label.vue +77 -0
- package/src/components/wt-load-bar/__tests__/WtLoadBar.spec.js +9 -0
- package/src/components/wt-load-bar/_variables.scss +6 -0
- package/src/components/wt-load-bar/wt-load-bar.vue +55 -0
- package/src/components/wt-loader/__tests__/WtLoader.spec.js +9 -0
- package/src/components/{atoms/wt-loader/wt-loader.vue → wt-loader/_internals/wt-loader--md.vue} +5 -6
- package/src/components/wt-loader/_internals/wt-loader--sm.vue +73 -0
- package/src/components/wt-loader/_variables.scss +8 -0
- package/src/components/wt-loader/wt-loader.vue +37 -0
- package/src/components/wt-navigation-bar/__tests__/WtNavigationBar.spec.js +68 -0
- package/src/components/wt-navigation-bar/_variables.scss +16 -0
- package/src/components/wt-navigation-bar/wt-navigation-bar.vue +282 -0
- package/src/components/wt-notification/__tests__/WtNotification.spec.js +21 -0
- package/src/components/wt-notification/_variables.scss +10 -0
- package/src/components/wt-notification/wt-notification.vue +86 -0
- package/src/components/wt-notifications-bar/__tests__/WtNotificationsBar.spec.js +50 -0
- package/src/components/wt-notifications-bar/_variables.scss +7 -0
- package/src/components/wt-notifications-bar/wt-notifications-bar.vue +78 -0
- package/src/components/wt-page-header/__tests__/wt-page-header.spec.js +9 -0
- package/src/components/wt-page-header/wt-page-header.vue +83 -0
- package/src/components/wt-page-wrapper/__tests__/WtPageWrapper.spec.js +33 -0
- package/src/components/wt-page-wrapper/_variables.scss +5 -0
- package/src/components/wt-page-wrapper/wt-page-wrapper.vue +58 -0
- package/src/components/wt-pagination/__tests__/WtPagination.spec.js +38 -0
- package/src/components/wt-pagination/_variables.scss +5 -0
- package/src/components/wt-pagination/wt-pagination.vue +148 -0
- package/src/components/wt-player/__tests__/WtPlayer.spec.js +9 -0
- package/src/components/wt-player/_variables.scss +8 -0
- package/src/components/wt-player/wt-player.vue +208 -0
- package/src/components/wt-popup/__tests__/WtPopup.spec.js +47 -0
- package/src/components/wt-popup/_variables.scss +20 -0
- package/src/components/wt-popup/wt-popup.vue +138 -0
- package/src/components/wt-progress-bar/__tests__/WtProgressBar.spec.js +17 -0
- package/src/components/wt-progress-bar/_variables.scss +11 -0
- package/src/components/wt-progress-bar/wt-progress-bar.vue +89 -0
- package/src/components/wt-radio/__tests__/WtRadio.spec.js +42 -0
- package/src/{css/components/molecules → components}/wt-radio/_variables.scss +6 -6
- package/src/components/wt-radio/wt-radio.vue +180 -0
- package/src/components/wt-rounded-action/Readme.md +68 -0
- package/src/components/wt-rounded-action/__tests__/WtRoundedAction.spec.js +9 -0
- package/src/components/wt-rounded-action/_variables.scss +14 -0
- package/src/components/wt-rounded-action/wt-rounded-action.vue +139 -0
- package/src/components/wt-search-bar/__tests__/WtSearchBar.spec.js +44 -0
- package/src/components/wt-search-bar/_variables.scss +8 -0
- package/src/components/wt-search-bar/wt-search-bar.vue +222 -0
- package/src/components/wt-select/__tests__/WtSelect.spec.js +27 -0
- package/src/components/wt-select/_multiselect.scss +198 -0
- package/src/components/wt-select/_variables.scss +14 -0
- package/src/components/wt-select/mixins/__tests__/multiselectMixin.spec.js +32 -0
- package/src/components/wt-select/mixins/multiselectMixin.js +151 -0
- package/src/components/wt-select/wt-select.vue +288 -0
- package/src/components/wt-slider/__tests__/WtSlider.spec.js +9 -0
- package/src/components/wt-slider/_variables.scss +15 -0
- package/src/components/wt-slider/wt-slider.vue +179 -0
- package/src/components/wt-status-select/__tests__/WtStatusSelect.spec.js +25 -0
- package/src/components/wt-status-select/_internals/StatusOptions.lookup.js +24 -0
- package/src/components/wt-status-select/_variables.scss +6 -0
- package/src/components/wt-status-select/wt-status-select.vue +134 -0
- package/src/components/wt-stepper/__tests__/WtStepper.spec.vue.js +18 -0
- package/src/components/wt-stepper/wt-stepper.vue +89 -0
- package/src/components/wt-switcher/__tests__/WtSwitcher.spec.js +31 -0
- package/src/components/wt-switcher/_variables.scss +17 -0
- package/src/components/wt-switcher/wt-switcher.vue +191 -0
- package/src/components/wt-table/__tests__/WtTable.spec.js +134 -0
- package/src/components/wt-table/_internals/getSortOrder.js +12 -0
- package/src/components/wt-table/_variables.scss +16 -0
- package/src/components/wt-table/wt-table.vue +269 -0
- package/src/components/wt-table-actions/__tests__/WtTableActions.spec.js +9 -0
- package/src/components/wt-table-actions/_variables.scss +5 -0
- package/src/components/wt-table-actions/wt-table-actions.vue +110 -0
- package/src/components/wt-table-column-select/__tests__/WtTableColumnSelect.spec.js +31 -0
- package/src/components/wt-table-column-select/wt-table-column-select.vue +178 -0
- package/src/components/wt-tabs/__tests__/WtTabs.spec.js +36 -0
- package/src/{css/components/molecules → components}/wt-tabs/_variables.scss +14 -14
- package/src/components/wt-tabs/wt-tabs.vue +125 -0
- package/src/components/wt-tags-input/__tests__/WtTagsInput.spec.js +42 -0
- package/src/components/wt-tags-input/_variables.scss +24 -0
- package/src/components/wt-tags-input/wt-tags-input.vue +226 -0
- package/src/components/wt-textarea/__tests__/WtTextarea.spec.js +46 -0
- package/src/components/wt-textarea/_variables.scss +5 -0
- package/src/components/wt-textarea/wt-textarea.vue +223 -0
- package/src/components/wt-time-input/__tests__/WtTimeInput.spec.js +25 -0
- package/src/components/wt-time-input/wt-time-input.vue +187 -0
- package/src/components/wt-timepicker/__tests__/WtTimepicker.spec.js +60 -0
- package/src/components/wt-timepicker/_variables.scss +5 -0
- package/src/components/wt-timepicker/wt-timepicker.vue +181 -0
- package/src/components/wt-tooltip/__tests__/WtTooltip.spec.js +30 -0
- package/src/components/wt-tooltip/_internals/useTooltipTriggerSubscriptions.js +68 -0
- package/src/components/wt-tooltip/_internals/wt-tooltip-floating.vue +48 -0
- package/src/components/wt-tooltip/_variables.scss +11 -0
- package/src/components/wt-tooltip/wt-tooltip.vue +150 -0
- package/src/composables/useCachedInterval/__tests__/useCachedInterval.spec.js +14 -0
- package/src/composables/useCachedInterval/useCachedInterval.js +21 -0
- package/src/composables/useDestroyableSortable/useDestroyableSortable.js +66 -0
- package/src/composables/useRepresentableAgentPauseCause/__tests__/useRepresentableAgentPauseCause.spec.js +83 -0
- package/src/composables/useRepresentableAgentPauseCause/useRepresentableAgentPauseCause.js +37 -0
- package/src/css/main.scss +72 -69
- package/src/css/styleguide/_styleguide.scss +9 -0
- package/src/css/styleguide/border-radius/_border-radius.scss +4 -0
- package/src/css/styleguide/colors/_colors.scss +180 -0
- package/src/css/styleguide/colors/_deprecated.scss +151 -0
- package/src/css/styleguide/colors/_palette.scss +358 -0
- package/src/css/styleguide/display-helpers/_display-helpers.scss +23 -0
- package/src/css/styleguide/elevations/_elevations.scss +13 -0
- package/src/css/styleguide/fonts/_fonts.scss +126 -0
- package/src/css/styleguide/placeholder/_placeholder.scss +49 -0
- package/src/css/styleguide/scroll.scss +43 -40
- package/src/css/styleguide/spacings/_spacings.scss +15 -0
- package/src/css/styleguide/transitions/_transitions.scss +1 -0
- package/src/css/styleguide/transitions/fade/_fade.scss +8 -0
- package/src/css/styleguide/typography/_typography.scss +113 -0
- package/src/css/styleguide/viewport-breakpoints/_viewport-breakpoints.scss +25 -0
- package/src/directives/clickaway/clickaway.js +3 -52
- package/src/directives/index.js +0 -5
- package/src/enums/AbstractUserStatus/AbstractUserStatus.enum.js +8 -0
- package/src/enums/AgentStatus/AgentStatus.enum.js +6 -0
- package/src/enums/WebitelApplications/AdminSections.enum.js +50 -0
- package/src/enums/WebitelApplications/AuditorSections.enum.js +5 -0
- package/src/enums/WebitelApplications/CrmSections.enum.js +5 -0
- package/src/enums/WebitelApplications/SupervisorSections.enum.js +7 -0
- package/src/enums/WebitelApplications/WebitelApplications.enum.js +11 -0
- package/src/locale/.DS_Store +0 -0
- package/src/locale/en/en.js +333 -0
- package/src/locale/es/es.js +282 -0
- package/src/locale/i18n.js +9 -5
- package/src/locale/ru/ru.js +334 -3
- package/src/locale/ua/ua.js +358 -0
- package/src/mixins/dataFilterMixins/__tests__/apiFilterMixin.spec.js +55 -0
- package/src/mixins/dataFilterMixins/__tests__/enumFilterMixin.spec.js +70 -0
- package/src/mixins/dataFilterMixins/__tests__/paginationFilterMixin.spec.js +85 -0
- package/src/mixins/dataFilterMixins/__tests__/sortFilterMixin.spec.js +57 -0
- package/src/mixins/dataFilterMixins/__tests__/urlControllerMixin.spec.js +48 -0
- package/src/mixins/dataFilterMixins/_urlControllerMixin/_urlControllerMixin.js +37 -0
- package/src/mixins/dataFilterMixins/apiFilterMixin.js +23 -0
- package/src/mixins/dataFilterMixins/baseFilterMixin/baseFilterMixin.js +29 -0
- package/src/mixins/dataFilterMixins/enumFilterMixin.js +30 -0
- package/src/mixins/dataFilterMixins/paginationFilterMixin.js +79 -0
- package/src/mixins/dataFilterMixins/sortFilterMixin.js +75 -0
- package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +47 -0
- package/src/mixins/validationMixin/useValidation.js +41 -0
- package/src/mixins/validationMixin/validationMixin.js +26 -10
- package/src/modules/AgentStatusSelect/api/agent-status.js +24 -0
- package/src/modules/AgentStatusSelect/api/pause-cause.js +47 -0
- package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js +83 -0
- package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-pause-cause-popup.spec.js +18 -0
- package/src/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue +122 -0
- package/src/modules/AgentStatusSelect/components/_internals/wt-cc-status-select-error-popup.vue +55 -0
- package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +107 -0
- package/src/modules/AuditForm/components/__tests__/audit-form-question-read-wrapper.spec.js +14 -0
- package/src/modules/AuditForm/components/__tests__/audit-form-question-write-wrapper.spec.js +60 -0
- package/src/modules/AuditForm/components/__tests__/audit-form-question.spec.js +14 -0
- package/src/modules/AuditForm/components/__tests__/audit-form.spec.js +70 -0
- package/src/modules/AuditForm/components/audit-form-question-read-wrapper.vue +132 -0
- package/src/modules/AuditForm/components/audit-form-question-write-wrapper.vue +154 -0
- package/src/modules/AuditForm/components/audit-form-question.vue +136 -0
- package/src/modules/AuditForm/components/audit-form.vue +183 -0
- package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options-write-row.spec.js +24 -0
- package/src/modules/AuditForm/components/questions/options/__tests__/audit-form-question-options.spec.js +45 -0
- package/src/modules/AuditForm/components/questions/options/audit-form-question-options-write-row.vue +89 -0
- package/src/modules/AuditForm/components/questions/options/audit-form-question-options.vue +97 -0
- package/src/modules/AuditForm/components/questions/score/__tests__/audit-form-question-score.spec.js +30 -0
- package/src/modules/AuditForm/components/questions/score/audit-form-question-score.vue +132 -0
- package/src/modules/AuditForm/schemas/AuditFormQuestionOptionsSchema.js +13 -0
- package/src/modules/AuditForm/schemas/AuditFormQuestionSchema.js +8 -0
- package/src/modules/AuditForm/schemas/AuditFormQuestionScoreSchema.js +8 -0
- package/src/modules/CSVExport/CSVExport.js +89 -0
- package/src/modules/CSVExport/__tests__/CSVExport.spec.js +63 -0
- package/src/modules/CSVExport/mixins/exportCSVMixin.js +46 -0
- package/src/modules/CardStoreModule/composables/useCardStore.js +55 -0
- package/src/modules/CardStoreModule/store/CardStoreModule.js +84 -0
- package/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue +87 -0
- package/src/modules/DeleteConfirmationPopup/composables/useDeleteConfirmationPopup.js +28 -0
- package/src/modules/FilesExport/FilesExport.js +113 -0
- package/src/modules/FilesExport/__tests__/FilesExport.spec.js +66 -0
- package/src/modules/FilesExport/mixins/exportFilesMixin.js +46 -0
- package/src/modules/FilesExport/scripts/generateMediaURL.js +7 -0
- package/src/modules/Filters/classes/BaseFilterSchema.js +13 -0
- package/src/modules/Filters/components/filter-pagination.vue +61 -0
- package/src/modules/Filters/components/filter-table-fields.vue +61 -0
- package/src/modules/Filters/composables/useTableFilters.js +17 -0
- package/src/modules/Filters/restores/filterFieldsRestore.js +9 -0
- package/src/modules/Filters/restores/readme.md +1 -0
- package/src/modules/Filters/store/FiltersStoreModule.js +181 -0
- package/src/modules/Notifications/assets/audio/end-chat.wav +0 -0
- package/src/modules/Notifications/assets/audio/new-chat.wav +0 -0
- package/src/modules/Notifications/assets/audio/new-message.wav +0 -0
- package/src/modules/Notifications/assets/audio/ringing.mp3 +0 -0
- package/src/modules/Notifications/assets/img/notification-icon.png +0 -0
- package/src/modules/Notifications/store/NotificationsStoreModule.js +185 -0
- package/src/modules/Notifications/store/__tests__/NotificationsStoreModule.actions.spec.js +130 -0
- package/src/modules/Notifications/store/__tests__/NotificationsStoreModule.mutations.spec.js +49 -0
- package/src/modules/QueryFilters/api/__tests__/defaults.spec.js +18 -0
- package/src/modules/QueryFilters/api/defaults.js +16 -0
- package/src/modules/QueryFilters/classes/ApiFilterSchema.js +32 -0
- package/src/modules/QueryFilters/classes/BaseFilterSchema.js +6 -0
- package/src/modules/QueryFilters/classes/EnumFilterSchema.js +23 -0
- package/src/modules/QueryFilters/classes/__tests__/ApiFilterSchema.spec.js +25 -0
- package/src/modules/QueryFilters/components/__tests__/abstract-api-filter.spec.js +52 -0
- package/src/modules/QueryFilters/components/__tests__/abstract-enum-filter.spec.js +38 -0
- package/src/modules/QueryFilters/components/__tests__/filter-datetime.spec.js +49 -0
- package/src/modules/QueryFilters/components/__tests__/filter-from-to.spec.js +63 -0
- package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +47 -0
- package/src/modules/QueryFilters/components/abstract-api-filter.vue +42 -0
- package/src/modules/QueryFilters/components/abstract-enum-filter.vue +32 -0
- package/src/modules/QueryFilters/components/filter-datetime.vue +40 -0
- package/src/modules/QueryFilters/components/filter-from-to.vue +143 -0
- package/src/modules/QueryFilters/components/filter-search.vue +33 -0
- package/src/modules/QueryFilters/components/filter-table-fields.vue +101 -0
- package/src/modules/QueryFilters/mixins/__tests__/apiFilterMixin.spec.js +48 -0
- package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +68 -0
- package/src/modules/QueryFilters/mixins/__tests__/paginationFilterMixin.spec.js +79 -0
- package/src/modules/QueryFilters/mixins/__tests__/sortFilterMixin.spec.js +63 -0
- package/src/modules/QueryFilters/mixins/__tests__/urlControllerMixin.spec.js +46 -0
- package/src/modules/QueryFilters/mixins/_urlControllerMixin/_urlControllerMixin.js +39 -0
- package/src/modules/QueryFilters/mixins/apiFilterMixin.js +41 -0
- package/src/modules/QueryFilters/mixins/baseFilterMixin/baseFilterMixin.js +34 -0
- package/src/modules/QueryFilters/mixins/enumFilterMixin.js +51 -0
- package/src/modules/QueryFilters/mixins/paginationFilterMixin.js +76 -0
- package/src/modules/QueryFilters/mixins/sortFilterMixin.js +56 -0
- package/src/modules/QueryFilters/store/QueryFiltersStoreModule.js +61 -0
- package/src/modules/QueryFilters/store/__tests__/QueryFiltersStoreModule.spec.js +89 -0
- package/src/modules/QueryFilters/store/queryFilters.js +6 -0
- package/src/modules/TableStoreModule/composables/useTableStore.js +58 -0
- package/src/modules/TableStoreModule/store/TableStoreModule.js +207 -0
- package/src/modules/Userinfo/api/BaseAPIService.js +7 -0
- package/src/modules/Userinfo/api/auth.js +31 -0
- package/src/modules/Userinfo/api/userinfo.js +44 -0
- package/src/modules/Userinfo/classes/ApplicationsAccess.js +217 -0
- package/src/modules/Userinfo/components/__tests__/auth.spec.js +55 -0
- package/src/modules/Userinfo/components/the-auth.vue +76 -0
- package/src/modules/Userinfo/enums/Permissions.enum.js +7 -0
- package/src/modules/Userinfo/store/UserinfoStoreModule.js +153 -0
- package/src/plugins/breakpoint/breakpoint.plugin.js +137 -0
- package/src/scripts/__tests__/caseConverters.spec.js +81 -0
- package/src/scripts/__tests__/convertDuration.spec.js +21 -0
- package/src/scripts/__tests__/debounce.spec.js +14 -0
- package/src/scripts/__tests__/editProxy.spec.js +9 -0
- package/src/scripts/__tests__/isEmpty.spec.js +16 -0
- package/src/scripts/__tests__/prettifyFileSize.spec.js +18 -0
- package/src/scripts/__tests__/prettifyTime.spec.js +18 -0
- package/src/scripts/__tests__/preventHiddenPageCallsDecorator.spec.js +16 -0
- package/src/scripts/__tests__/sortQueryAdapters.spec.js +12 -0
- package/src/scripts/__tests__/updateObject.spec.js +19 -0
- package/src/scripts/caseConverters.js +89 -0
- package/src/scripts/convertDuration.js +15 -0
- package/src/scripts/debounce.js +3 -9
- package/src/scripts/editProxy.js +9 -0
- package/src/scripts/eventBus.js +8 -0
- package/src/scripts/isEmpty.js +9 -0
- package/src/scripts/prettifyFileSize.js +11 -0
- package/src/scripts/prettifyTime.js +9 -0
- package/src/scripts/preventHiddenPageCallsDecorator.js +6 -0
- package/src/scripts/sortQueryAdapters.js +21 -0
- package/src/scripts/updateObject.js +6 -0
- package/src/store/BaseStoreModules/ApiStoreModule.js +93 -0
- package/src/store/BaseStoreModules/BaseStoreModule.js +49 -0
- package/src/store/BaseStoreModules/__tests__/BaseStoreModule.spec.js +104 -0
- package/src/store/ReactiveNowStoreModule/ReactiveNowStoreModule.js +27 -0
- package/src/store/helpers/__tests__/getNamespacedState.spec.js +11 -0
- package/src/store/helpers/getNamespacedState.js +5 -0
- package/src/validators/decimalValidator.js +9 -0
- package/src/validators/domainValidator.js +5 -0
- package/.eslintrc.js +0 -34
- package/babel.config.js +0 -5
- package/dist/@webitel/ui-sdk.common.js +0 -11586
- package/dist/@webitel/ui-sdk.common.js.map +0 -1
- package/dist/@webitel/ui-sdk.css +0 -1
- package/dist/@webitel/ui-sdk.umd.js +0 -11596
- package/dist/@webitel/ui-sdk.umd.js.map +0 -1
- package/dist/@webitel/ui-sdk.umd.min.js +0 -2
- package/dist/@webitel/ui-sdk.umd.min.js.map +0 -1
- package/dist/fonts/Montserrat-Regular.ee653992.ttf +0 -0
- package/dist/fonts/Montserrat-SemiBold.c641dbee.ttf +0 -0
- package/dist/img/arrow-down--active--md.06c6b9a1.svg +0 -3
- package/dist/img/arrow-down--disabled--md.8dd31dcb.svg +0 -3
- package/dist/img/arrow-down--md.907c231e.svg +0 -3
- package/dist/img/calendar--active--md.b649abe2.svg +0 -6
- package/dist/img/calendar--disabled--md.ff268289.svg +0 -3
- package/dist/img/calendar--md.d0280382.svg +0 -6
- package/jest.config.js +0 -3
- package/package-lock.json +0 -15072
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/src/assets/icons/arrow-down--active--md.svg +0 -3
- package/src/assets/icons/arrow-down--disabled--md.svg +0 -3
- package/src/assets/icons/arrow-down--md.svg +0 -3
- package/src/assets/icons/calendar--active--md.svg +0 -6
- package/src/assets/icons/calendar--disabled--md.svg +0 -3
- package/src/assets/icons/calendar--md.svg +0 -6
- package/src/components/atoms/wt-badge/wt-badge.vue +0 -15
- package/src/components/atoms/wt-button/wt-button.vue +0 -202
- package/src/components/atoms/wt-divider/wt-divider.vue +0 -24
- package/src/components/atoms/wt-icon/wt-icon.vue +0 -499
- package/src/components/atoms/wt-input-info/wt-input-info.vue +0 -34
- package/src/components/atoms/wt-label/wt-label.vue +0 -58
- package/src/components/atoms/wt-tooltip/wt-tooltip.vue +0 -54
- package/src/components/molecules/wt-checkbox/wt-checkbox.vue +0 -167
- package/src/components/molecules/wt-datepicker/wt-datepicker.vue +0 -200
- package/src/components/molecules/wt-datetimepicker/wt-datetimepicker.vue +0 -306
- package/src/components/molecules/wt-icon-btn/wt-icon-btn.vue +0 -69
- package/src/components/molecules/wt-input/wt-input.vue +0 -300
- package/src/components/molecules/wt-notification/wt-notification.vue +0 -74
- package/src/components/molecules/wt-popup/wt-popup.vue +0 -89
- package/src/components/molecules/wt-radio/wt-radio.vue +0 -168
- package/src/components/molecules/wt-search-bar/wt-search-bar.vue +0 -186
- package/src/components/molecules/wt-select/wt-select.vue +0 -394
- package/src/components/molecules/wt-switcher/wt-switcher.vue +0 -157
- package/src/components/molecules/wt-tabs/wt-tabs.vue +0 -125
- package/src/components/molecules/wt-textarea/wt-textarea.vue +0 -141
- package/src/components/molecules/wt-time-input/wt-time-input.vue +0 -141
- package/src/components/molecules/wt-timepicker/wt-timepicker.vue +0 -110
- package/src/components/organisms/wt-pagination/wt-pagination.vue +0 -122
- package/src/css/colors/_colors.scss +0 -67
- package/src/css/components/_components.scss +0 -25
- package/src/css/components/atoms/wt-badge/_variables.scss +0 -6
- package/src/css/components/atoms/wt-badge/wt-badge.scss +0 -8
- package/src/css/components/atoms/wt-button/_variables.scss +0 -47
- package/src/css/components/atoms/wt-divider/_variables.scss +0 -5
- package/src/css/components/atoms/wt-icon/_variables.scss +0 -29
- package/src/css/components/atoms/wt-loader/_variables.scss +0 -8
- package/src/css/components/atoms/wt-tooltip/_variables.scss +0 -10
- package/src/css/components/molecules/wt-checkbox/_variables.scss +0 -4
- package/src/css/components/molecules/wt-datepicker/_variables.scss +0 -20
- package/src/css/components/molecules/wt-datepicker/datepicker-calendar.scss +0 -100
- package/src/css/components/molecules/wt-datetimepicker/_variables.scss +0 -12
- package/src/css/components/molecules/wt-icon-btn/_variables.scss +0 -3
- package/src/css/components/molecules/wt-input/_variables.scss +0 -6
- package/src/css/components/molecules/wt-notification/_variables.scss +0 -10
- package/src/css/components/molecules/wt-popup/_variables.scss +0 -11
- package/src/css/components/molecules/wt-search-bar/_variables.scss +0 -4
- package/src/css/components/molecules/wt-select/_variables.scss +0 -23
- package/src/css/components/molecules/wt-switcher/_variables.scss +0 -14
- package/src/css/components/molecules/wt-textarea/_variables.scss +0 -5
- package/src/css/components/molecules/wt-timepicker/_variables.scss +0 -4
- package/src/css/components/organisms/wt-pagination/_variables.scss +0 -7
- package/src/css/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/src/css/fonts/Montserrat/Montserrat-SemiBold.ttf +0 -0
- package/src/css/fonts.scss +0 -9
- package/src/css/styleguide/styleguide.scss +0 -3
- package/src/css/typography/_typography.scss +0 -72
- package/src/install.js +0 -15
- package/src/main.js +0 -14
- package/src/playground.vue +0 -451
- package/src/the-app.vue +0 -20
- package/vue.config.js +0 -11
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { ChatActions, CallActions, JobState } from 'webitel-sdk';
|
|
2
|
+
import i18n from '../../../locale/i18n';
|
|
3
|
+
import BaseStoreModule from '../../../store/BaseStoreModules/BaseStoreModule';
|
|
4
|
+
import endChatSound from '../assets/audio/end-chat.wav';
|
|
5
|
+
import newChatSound from '../assets/audio/new-chat.wav';
|
|
6
|
+
import newMessageSound from '../assets/audio/new-message.wav';
|
|
7
|
+
import ringingSound from '../assets/audio/ringing.mp3';
|
|
8
|
+
import notificationIcon from '../assets/img/notification-icon.png';
|
|
9
|
+
|
|
10
|
+
const NOTIFICATION_VISIBLE_INTERVAL = 2000;
|
|
11
|
+
|
|
12
|
+
const getNotificationSound = (action) => {
|
|
13
|
+
switch (action) {
|
|
14
|
+
case ChatActions.UserInvite:
|
|
15
|
+
case JobState.Distribute:
|
|
16
|
+
return new Audio(newChatSound);
|
|
17
|
+
case ChatActions.Message:
|
|
18
|
+
return new Audio(newMessageSound);
|
|
19
|
+
case ChatActions.Close:
|
|
20
|
+
return new Audio(endChatSound);
|
|
21
|
+
case CallActions.Ringing:
|
|
22
|
+
// eslint-disable-next-line no-case-declarations
|
|
23
|
+
const audio = new Audio(ringingSound);
|
|
24
|
+
audio.loop = true;
|
|
25
|
+
return audio;
|
|
26
|
+
default:
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const getCurrentTabId = () => localStorage.getItem('currentTabId');
|
|
32
|
+
|
|
33
|
+
const setCurrentTabId = (value) => localStorage.setItem('currentTabId', value);
|
|
34
|
+
|
|
35
|
+
export default class NotificationsStoreModule extends BaseStoreModule {
|
|
36
|
+
state = {
|
|
37
|
+
thisTabId: null, // this tab
|
|
38
|
+
currentTabId: null, // current tab is localStorage
|
|
39
|
+
broadcastChannel: null, // in order to reset the tab title with unread number
|
|
40
|
+
unreadCount: 0,
|
|
41
|
+
currentlyPlaying: false,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
getters = {
|
|
45
|
+
IS_MAIN_TAB: (state) => state.thisTabId === state.currentTabId,
|
|
46
|
+
IS_SOUND_ALLOWED: (state, getters) => getters.IS_MAIN_TAB && !state.currentlyPlaying,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
actions = {
|
|
50
|
+
// private
|
|
51
|
+
_SUBSCRIBE_TAB_CLOSING: (context) => {
|
|
52
|
+
window.addEventListener('storage', () => {
|
|
53
|
+
if (!getCurrentTabId()) {
|
|
54
|
+
setCurrentTabId(context.state.thisTabId);
|
|
55
|
+
}
|
|
56
|
+
context.commit('SET_CURRENT_TAB_ID', getCurrentTabId());
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
_SETUP_THIS_TAB_ID: (context) => {
|
|
61
|
+
const thisTabId = Math.random().toString();
|
|
62
|
+
context.commit('SET_THIS_TAB_ID', thisTabId);
|
|
63
|
+
setCurrentTabId(thisTabId);
|
|
64
|
+
context.commit('SET_CURRENT_TAB_ID', thisTabId);
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
_SETUP_UNREAD_COUND_BROADCAST_LISTENING: (context) => {
|
|
68
|
+
const broadcastChannel = new BroadcastChannel('WtAppNotifications');
|
|
69
|
+
broadcastChannel.addEventListener('message', ({ data }) => {
|
|
70
|
+
context.dispatch('_SET_UNREAD_COUNT', data.count);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
document.documentElement.addEventListener('click', () => {
|
|
74
|
+
context.dispatch('_RESET_UNREAD_COUNT');
|
|
75
|
+
});
|
|
76
|
+
context.commit('SET_BROADCAST_CHANNEL', broadcastChannel);
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
_SET_UNREAD_COUNT: (context, count) => {
|
|
80
|
+
context.commit('SET_UNREAD_COUNT', count);
|
|
81
|
+
context.dispatch('_SET_TAB_TITLE');
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
_RESET_UNREAD_COUNT: (context) => {
|
|
85
|
+
if (context.state.unreadCount === 0) return;
|
|
86
|
+
const count = 0;
|
|
87
|
+
context.dispatch('_SET_UNREAD_COUNT', count);
|
|
88
|
+
context.state.broadcastChannel.postMessage({ count });
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
_SET_TAB_TITLE: (context) => {
|
|
92
|
+
const count = context.state.unreadCount;
|
|
93
|
+
const titleText = document.title.replace(/\s*\(.*?\)\s*/g, '');
|
|
94
|
+
document.title = count ? `(${count}) ${titleText}` : titleText;
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
_REMOVE_CURRENT_TAB_ID: () => {
|
|
98
|
+
localStorage.removeItem('currentTabId');
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
// public
|
|
102
|
+
INITIALIZE: (context) => Promise
|
|
103
|
+
.allSettled([
|
|
104
|
+
context.dispatch('_SETUP_THIS_TAB_ID'),
|
|
105
|
+
context.dispatch('_SETUP_UNREAD_COUND_BROADCAST_LISTENING'),
|
|
106
|
+
context.dispatch('_SUBSCRIBE_TAB_CLOSING'),
|
|
107
|
+
]),
|
|
108
|
+
|
|
109
|
+
DESTROY: (context) => Promise
|
|
110
|
+
.allSettled([
|
|
111
|
+
context.dispatch('STOP_SOUND'),
|
|
112
|
+
context.dispatch('_REMOVE_CURRENT_TAB_ID'),
|
|
113
|
+
]),
|
|
114
|
+
|
|
115
|
+
PLAY_SOUND: (context, {
|
|
116
|
+
action,
|
|
117
|
+
sound = getNotificationSound(action),
|
|
118
|
+
}) => {
|
|
119
|
+
if (context.getters.IS_SOUND_ALLOWED
|
|
120
|
+
&& !localStorage.getItem('wtIsPlaying')
|
|
121
|
+
) {
|
|
122
|
+
const audio = sound instanceof Audio ? sound : new Audio(sound);
|
|
123
|
+
audio.addEventListener('ended', () => {
|
|
124
|
+
context.dispatch('STOP_SOUND');
|
|
125
|
+
}, { once: true });
|
|
126
|
+
audio.play();
|
|
127
|
+
localStorage.setItem('wtIsPlaying', 'true');
|
|
128
|
+
context.commit('SET_CURRENTLY_PLAYING', audio);
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
STOP_SOUND: (context) => {
|
|
133
|
+
const { currentlyPlaying } = context.state;
|
|
134
|
+
if (currentlyPlaying && currentlyPlaying instanceof Audio) currentlyPlaying.pause();
|
|
135
|
+
localStorage.removeItem('wtIsPlaying');
|
|
136
|
+
context.commit('RESET_CURRENTLY_PLAYING');
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
SEND_NOTIFICATION: (context, {
|
|
140
|
+
locale,
|
|
141
|
+
text = i18n.t(locale),
|
|
142
|
+
icon = notificationIcon,
|
|
143
|
+
interval = NOTIFICATION_VISIBLE_INTERVAL,
|
|
144
|
+
}) => {
|
|
145
|
+
const notification = new Notification(text, { icon });
|
|
146
|
+
|
|
147
|
+
notification.addEventListener('click', () => {
|
|
148
|
+
window.focus();
|
|
149
|
+
}, { once: true });
|
|
150
|
+
|
|
151
|
+
setTimeout(() => {
|
|
152
|
+
notification.close();
|
|
153
|
+
}, interval);
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
INCREMENT_UNREAD_COUNT: (context) => {
|
|
157
|
+
const count = context.state.unreadCount + 1;
|
|
158
|
+
context.dispatch('_SET_UNREAD_COUNT', count);
|
|
159
|
+
context.state.broadcastChannel.postMessage({ count });
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
mutations = {
|
|
164
|
+
SET_THIS_TAB_ID: (state, thisTabId) => {
|
|
165
|
+
state.thisTabId = thisTabId;
|
|
166
|
+
},
|
|
167
|
+
|
|
168
|
+
SET_CURRENT_TAB_ID: (state, currentTabId) => {
|
|
169
|
+
state.currentTabId = currentTabId;
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
SET_BROADCAST_CHANNEL: (state, channel) => {
|
|
173
|
+
state.broadcastChannel = channel;
|
|
174
|
+
},
|
|
175
|
+
SET_CURRENTLY_PLAYING: (state, sound) => {
|
|
176
|
+
state.currentlyPlaying = sound;
|
|
177
|
+
},
|
|
178
|
+
RESET_CURRENTLY_PLAYING: (state) => {
|
|
179
|
+
state.currentlyPlaying = false;
|
|
180
|
+
},
|
|
181
|
+
SET_UNREAD_COUNT: (state, count) => {
|
|
182
|
+
state.unreadCount = count;
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import audio from '../../assets/audio/new-message.wav';
|
|
2
|
+
import NotificationsStoreModule from '../NotificationsStoreModule';
|
|
3
|
+
import '../../../../../tests/mocks/broadcastChannelMock';
|
|
4
|
+
|
|
5
|
+
const notificationsModule = new NotificationsStoreModule().getModule();
|
|
6
|
+
|
|
7
|
+
const state = {
|
|
8
|
+
thisTabId: null,
|
|
9
|
+
broadcastChannel: new BroadcastChannel('WtAppNotifications'),
|
|
10
|
+
unreadCount: 0,
|
|
11
|
+
currentlyPlaying: false,
|
|
12
|
+
wtIsPlaying: false,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
describe('features/notifications store: actions', () => {
|
|
16
|
+
const context = {
|
|
17
|
+
dispatch: jest.fn(),
|
|
18
|
+
commit: jest.fn(),
|
|
19
|
+
getters: {
|
|
20
|
+
IS_MAIN_TAB: () => true,
|
|
21
|
+
IS_SOUND_ALLOWED: () => true,
|
|
22
|
+
},
|
|
23
|
+
rootGetters: {
|
|
24
|
+
'workspace/TASK_ON_WORKSPACE': { channelId: 'id' },
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
context.state = { ...state };
|
|
30
|
+
context.dispatch.mockClear();
|
|
31
|
+
context.commit.mockClear();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('INITIALIZE action dispatches _SETUP_THIS_TAB_ID action', () => {
|
|
35
|
+
notificationsModule.actions.INITIALIZE(context);
|
|
36
|
+
expect(context.dispatch.mock.calls[0][0]).toContain('_SETUP_THIS_TAB_ID');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('INITIALIZE action dispatches _SETUP_UNREAD_COUND_BROADCAST_LISTENING action', () => {
|
|
40
|
+
notificationsModule.actions.INITIALIZE(context);
|
|
41
|
+
expect(context.dispatch.mock.calls[1][0]).toContain('_SETUP_UNREAD_COUND_BROADCAST_LISTENING');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('INITIALIZE action dispatches _SETUP_THIS_TAB_ID action', () => {
|
|
45
|
+
notificationsModule.actions.INITIALIZE(context);
|
|
46
|
+
expect(context.dispatch).toHaveBeenCalledWith('_SETUP_THIS_TAB_ID');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('DESTROY action dispatches STOP_SOUND action', () => {
|
|
50
|
+
notificationsModule.actions.DESTROY(context);
|
|
51
|
+
expect(context.dispatch).toHaveBeenCalledWith('STOP_SOUND');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('DESTROY action dispatches _REMOVE_CURRENT_TAB_ID action', () => {
|
|
55
|
+
notificationsModule.actions.DESTROY(context);
|
|
56
|
+
expect(context.dispatch).toHaveBeenCalledWith('_REMOVE_CURRENT_TAB_ID');
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('INCREMENT_UNREAD_COUNT action dispatches _SET_UNREAD_COUNT and increases unreadCount', () => {
|
|
60
|
+
notificationsModule.actions.INCREMENT_UNREAD_COUNT(context);
|
|
61
|
+
expect(context.dispatch).toHaveBeenCalledWith('_SET_UNREAD_COUNT', context.state.unreadCount + 1);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('_SETUP_UNREAD_COUND_BROADCAST_LISTENING action commits SET_BROADCAST_CHANNEL mutation', () => {
|
|
65
|
+
notificationsModule.actions._SETUP_UNREAD_COUND_BROADCAST_LISTENING(context);
|
|
66
|
+
expect(context.commit.mock.calls[0][0]).toContain('SET_BROADCAST_CHANNEL');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('_SUBSCRIBE_TAB_CLOSING action commits SET_CURRENT_TAB_ID mutation', async () => {
|
|
70
|
+
await notificationsModule.actions._SUBSCRIBE_TAB_CLOSING(context);
|
|
71
|
+
window.dispatchEvent(new Event('storage'));
|
|
72
|
+
expect(context.commit).toHaveBeenCalledWith('SET_CURRENT_TAB_ID', 'null');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('PLAY_SOUND action commits SET_CURRENTLY_PLAIYNG mutation with sound', async () => {
|
|
76
|
+
const sound = new Audio(audio);
|
|
77
|
+
await notificationsModule.actions.PLAY_SOUND(context, { sound });
|
|
78
|
+
expect(context.commit).toHaveBeenCalledWith('SET_CURRENTLY_PLAYING', sound);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('_SET_UNREAD_COUNT dispatches _SET_TAB_TITLE action', () => {
|
|
82
|
+
const unreadCount = 5;
|
|
83
|
+
notificationsModule.actions._SET_UNREAD_COUNT(context, unreadCount);
|
|
84
|
+
expect(context.dispatch).toHaveBeenCalledWith('_SET_TAB_TITLE');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('_SETUP_THIS_TAB_ID commits SET_THIS_TAB_ID mutation', () => {
|
|
88
|
+
notificationsModule.actions._SETUP_THIS_TAB_ID(context);
|
|
89
|
+
expect(context.commit.mock.calls[0][0]).toBe('SET_THIS_TAB_ID');
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('_SETUP_THIS_TAB_ID commits SET_CURRENT_TAB_ID mutation', () => {
|
|
93
|
+
notificationsModule.actions._SETUP_THIS_TAB_ID(context);
|
|
94
|
+
expect(context.commit.mock.calls[1][0]).toBe('SET_CURRENT_TAB_ID');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('_SET_UNREAD_COUNT action commits _SET_UNREAD_COUNT mutation with count', () => {
|
|
98
|
+
const unreadCount = 5;
|
|
99
|
+
notificationsModule.actions._SET_UNREAD_COUNT(context, unreadCount);
|
|
100
|
+
expect(context.commit).toHaveBeenCalledWith('SET_UNREAD_COUNT', unreadCount);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('_RESET_UNREAD_COUNT action does not dispatch if unread count is 0', () => {
|
|
104
|
+
notificationsModule.actions._RESET_UNREAD_COUNT(context);
|
|
105
|
+
expect(context.dispatch).not.toHaveBeenCalledWith('_SET_UNREAD_COUNT');
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('_RESET_UNREAD_COUNT action dispatches _SET_UNREAD_COUNT passing unread count equal to 0', () => {
|
|
109
|
+
context.state.unreadCount = 1;
|
|
110
|
+
notificationsModule.actions._RESET_UNREAD_COUNT(context);
|
|
111
|
+
expect(context.dispatch).toHaveBeenCalledWith('_SET_UNREAD_COUNT', 0);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('PLAY_SOUND action sets localStorage wtIsPlaying to true', () => {
|
|
115
|
+
const sound = new Audio(audio);
|
|
116
|
+
notificationsModule.actions.PLAY_SOUND(context, { sound });
|
|
117
|
+
expect(localStorage.getItem('wtIsPlaying')).toBeTruthy();
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('STOP_SOUND action commits RESET_CURRENTLY_PLAYING mutation', () => {
|
|
121
|
+
notificationsModule.actions.STOP_SOUND(context);
|
|
122
|
+
expect(context.commit).toHaveBeenCalledWith('RESET_CURRENTLY_PLAYING');
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('STOP_SOUND action removes localStorage wtIsPlaying', () => {
|
|
126
|
+
localStorage.setItem('wtIsPlaying', 'true');
|
|
127
|
+
notificationsModule.actions.STOP_SOUND(context);
|
|
128
|
+
expect(localStorage.getItem('wtIsPlaying')).toBeFalsy();
|
|
129
|
+
});
|
|
130
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import NotificationsStoreModule from '../NotificationsStoreModule';
|
|
2
|
+
import '../../../../../tests/mocks/broadcastChannelMock';
|
|
3
|
+
|
|
4
|
+
const notificationsModule = new NotificationsStoreModule().getModule();
|
|
5
|
+
|
|
6
|
+
const state = {
|
|
7
|
+
thisTabId: null,
|
|
8
|
+
broadcastChannel: new BroadcastChannel('WtAppNotifications'),
|
|
9
|
+
unreadCount: 0,
|
|
10
|
+
currentlyPlaying: false,
|
|
11
|
+
wtIsPlaying: false,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
describe('features/notifications store: mutations', () => {
|
|
15
|
+
it('SET_THIS_TAB_ID sets thisTabId to state', () => {
|
|
16
|
+
const thisTabId = 'thisTabId';
|
|
17
|
+
notificationsModule.mutations.SET_THIS_TAB_ID(state, thisTabId);
|
|
18
|
+
expect(state.thisTabId).toBe(thisTabId);
|
|
19
|
+
});
|
|
20
|
+
it('SET_CURRENT_TAB_ID sets currentTabId to state', () => {
|
|
21
|
+
const currentTabId = 'currentTabId';
|
|
22
|
+
notificationsModule.mutations.SET_CURRENT_TAB_ID(state, currentTabId);
|
|
23
|
+
expect(state.currentTabId).toBe(currentTabId);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('SET_BROADCAST_CHANNEL sets broadcastChannel to state', () => {
|
|
27
|
+
const state = { broadcastChannel: null };
|
|
28
|
+
const channel = new BroadcastChannel('test channel');
|
|
29
|
+
notificationsModule.mutations.SET_BROADCAST_CHANNEL(state, channel);
|
|
30
|
+
expect(state.broadcastChannel).toEqual(channel);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('SET_CURRENTLY_PLAIYNG mutation sets currentlyPlaying to state', () => {
|
|
34
|
+
const wtIsPlaying = true;
|
|
35
|
+
notificationsModule.mutations.SET_CURRENTLY_PLAYING(state, wtIsPlaying);
|
|
36
|
+
expect(state.currentlyPlaying).toBe(true);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('RESET_CURRENTLY_PLAYING mutation sets currentlyPlaying to false in state', () => {
|
|
40
|
+
notificationsModule.mutations.RESET_CURRENTLY_PLAYING(state);
|
|
41
|
+
expect(state.currentlyPlaying).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('_SET_UNREAD_COUNT mutation sets unreadCount to state', () => {
|
|
45
|
+
const unreadCount = 15;
|
|
46
|
+
notificationsModule.mutations.SET_UNREAD_COUNT(state, unreadCount);
|
|
47
|
+
expect(state.unreadCount).toEqual(unreadCount);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { listResponseHandler } from '../defaults';
|
|
2
|
+
|
|
3
|
+
describe('filter api Defaults', () => {
|
|
4
|
+
it('listResponseHandler returns only lookups from response', () => {
|
|
5
|
+
const response = {
|
|
6
|
+
items: [
|
|
7
|
+
{ name: 'jest1', id: 1, myField: '1' },
|
|
8
|
+
{ name: 'jest2', id: 2, obj: [] },
|
|
9
|
+
],
|
|
10
|
+
next: true,
|
|
11
|
+
};
|
|
12
|
+
const expectedResult = [
|
|
13
|
+
{ name: 'jest1', id: 1 },
|
|
14
|
+
{ name: 'jest2', id: 2 },
|
|
15
|
+
];
|
|
16
|
+
expect(listResponseHandler(response)).toEqual(expectedResult);
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const PAGE = 1;
|
|
2
|
+
const SIZE = 20;
|
|
3
|
+
const FIELDS = ['id', 'name'];
|
|
4
|
+
|
|
5
|
+
export const defaultParams = {
|
|
6
|
+
page: PAGE,
|
|
7
|
+
size: SIZE,
|
|
8
|
+
fields: FIELDS,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const listResponseHandler = (response) => (
|
|
12
|
+
response.items.map((item) => ({
|
|
13
|
+
name: item.name,
|
|
14
|
+
id: item.id,
|
|
15
|
+
}))
|
|
16
|
+
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import BaseFilterSchema from './BaseFilterSchema';
|
|
2
|
+
|
|
3
|
+
export default class ApiFilterSchema extends BaseFilterSchema {
|
|
4
|
+
constructor(params = {}) {
|
|
5
|
+
const {
|
|
6
|
+
value = [],
|
|
7
|
+
defaultValue = [],
|
|
8
|
+
} = params;
|
|
9
|
+
super({ value, defaultValue });
|
|
10
|
+
const {
|
|
11
|
+
locale = { label: 'filter' },
|
|
12
|
+
storedProp = 'id',
|
|
13
|
+
multiple = true,
|
|
14
|
+
closeOnSelect = false,
|
|
15
|
+
API,
|
|
16
|
+
} = params;
|
|
17
|
+
this.locale = locale;
|
|
18
|
+
this.storedProp = storedProp;
|
|
19
|
+
this.multiple = multiple;
|
|
20
|
+
this.closeOnSelect = closeOnSelect;
|
|
21
|
+
this.API = API;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
search(params) {
|
|
25
|
+
return this.API(params);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
fetchSelected(idsList) {
|
|
29
|
+
const params = { size: idsList.length, id: idsList };
|
|
30
|
+
return this.API(params);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import BaseFilterSchema from './BaseFilterSchema';
|
|
2
|
+
|
|
3
|
+
export default class EnumFilterSchema extends BaseFilterSchema {
|
|
4
|
+
constructor(params = {}) {
|
|
5
|
+
const {
|
|
6
|
+
value = [],
|
|
7
|
+
defaultValue = [],
|
|
8
|
+
} = params;
|
|
9
|
+
super({ value, defaultValue });
|
|
10
|
+
const {
|
|
11
|
+
locale = { label: 'filter' },
|
|
12
|
+
storedProp = 'value',
|
|
13
|
+
multiple = true,
|
|
14
|
+
closeOnSelect = false,
|
|
15
|
+
options = [],
|
|
16
|
+
} = params;
|
|
17
|
+
this.locale = locale;
|
|
18
|
+
this.storedProp = storedProp;
|
|
19
|
+
this.multiple = multiple;
|
|
20
|
+
this.closeOnSelect = closeOnSelect;
|
|
21
|
+
this.options = options;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import ApiFilterSchema from '../ApiFilterSchema';
|
|
2
|
+
|
|
3
|
+
describe('Api Filter Schema', () => {
|
|
4
|
+
const APIMock = jest.fn();
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
APIMock.mockClear();
|
|
7
|
+
});
|
|
8
|
+
it('creates default class without passed params', () => {
|
|
9
|
+
const filter = new ApiFilterSchema();
|
|
10
|
+
expect(filter).toBeTruthy();
|
|
11
|
+
});
|
|
12
|
+
it('calls API getList() method at search()', () => {
|
|
13
|
+
const params = { page: 1 };
|
|
14
|
+
const filter = new ApiFilterSchema({ API: APIMock });
|
|
15
|
+
filter.search(params);
|
|
16
|
+
expect(APIMock).toHaveBeenCalledWith(params);
|
|
17
|
+
});
|
|
18
|
+
it('calls API getList() method at fetchSelected()', () => {
|
|
19
|
+
const idsList = [1];
|
|
20
|
+
const expectedParams = { size: 1, id: [1] };
|
|
21
|
+
const filter = new ApiFilterSchema({ API: APIMock });
|
|
22
|
+
filter.fetchSelected(idsList);
|
|
23
|
+
expect(APIMock).toHaveBeenCalledWith(expectedParams);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import { createStore } from 'vuex';
|
|
3
|
+
import { createRouter, createWebHistory } from 'vue-router';
|
|
4
|
+
import AbstractApiFilter from '../abstract-api-filter.vue';
|
|
5
|
+
import ApiFilterSchema from '../../classes/ApiFilterSchema';
|
|
6
|
+
|
|
7
|
+
const router = createRouter({
|
|
8
|
+
history: createWebHistory(),
|
|
9
|
+
routes: [],
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
describe('Abstract Api Filter', () => {
|
|
13
|
+
const namespace = 'jest';
|
|
14
|
+
const filterQuery = 'jest';
|
|
15
|
+
const filterSchema = new ApiFilterSchema({ locale: {} });
|
|
16
|
+
const searchMock = jest.fn();
|
|
17
|
+
const fetchSelectedMock = jest.fn(() => ({ items: [] }));
|
|
18
|
+
jest.spyOn(filterSchema, 'search').mockImplementation(searchMock);
|
|
19
|
+
jest.spyOn(filterSchema, 'fetchSelected').mockImplementation(fetchSelectedMock);
|
|
20
|
+
const store = createStore({
|
|
21
|
+
modules: {
|
|
22
|
+
[namespace]: {
|
|
23
|
+
namespaced: true,
|
|
24
|
+
state: {
|
|
25
|
+
[filterQuery]: filterSchema,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const mountOptions = {
|
|
32
|
+
global: { plugins: [store, router] },
|
|
33
|
+
props: {
|
|
34
|
+
namespace,
|
|
35
|
+
filterQuery,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
it('renders a component', () => {
|
|
39
|
+
const wrapper = shallowMount(AbstractApiFilter, mountOptions);
|
|
40
|
+
expect(wrapper.exists()).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
it('calls filter schema API search()', () => {
|
|
43
|
+
const wrapper = shallowMount(AbstractApiFilter, mountOptions);
|
|
44
|
+
wrapper.vm.search();
|
|
45
|
+
expect(searchMock).toHaveBeenCalled();
|
|
46
|
+
});
|
|
47
|
+
it(' filter schema API fetchSelected()', () => {
|
|
48
|
+
const wrapper = shallowMount(AbstractApiFilter, mountOptions);
|
|
49
|
+
wrapper.vm.fetchSelected();
|
|
50
|
+
expect(fetchSelectedMock).toHaveBeenCalled();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import { createStore } from 'vuex';
|
|
3
|
+
import { createRouter, createWebHistory } from 'vue-router';
|
|
4
|
+
import AbstractEnumFilter from '../abstract-enum-filter.vue';
|
|
5
|
+
import EnumFilterSchema from '../../classes/EnumFilterSchema';
|
|
6
|
+
|
|
7
|
+
const router = createRouter({
|
|
8
|
+
history: createWebHistory(),
|
|
9
|
+
routes: [],
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
describe('Abstract Enum Filter', () => {
|
|
13
|
+
const namespace = 'jest';
|
|
14
|
+
const filterQuery = 'jest';
|
|
15
|
+
const filterSchema = new EnumFilterSchema({ locale: {} });
|
|
16
|
+
const store = createStore({
|
|
17
|
+
modules: {
|
|
18
|
+
[namespace]: {
|
|
19
|
+
namespaced: true,
|
|
20
|
+
state: {
|
|
21
|
+
[filterQuery]: filterSchema,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const mountOptions = {
|
|
28
|
+
global: { plugins: [store, router] },
|
|
29
|
+
props: {
|
|
30
|
+
namespace,
|
|
31
|
+
filterQuery,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
it('renders a component', () => {
|
|
35
|
+
const wrapper = shallowMount(AbstractEnumFilter, mountOptions);
|
|
36
|
+
expect(wrapper.exists()).toBe(true);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import { createStore } from 'vuex';
|
|
3
|
+
import { createRouter, createWebHistory } from 'vue-router';
|
|
4
|
+
import DatetimeFilter from '../filter-datetime.vue';
|
|
5
|
+
import BaseFilterSchema from '../../classes/BaseFilterSchema';
|
|
6
|
+
import baseFilterMixin from '../../mixins/baseFilterMixin/baseFilterMixin';
|
|
7
|
+
|
|
8
|
+
const router = createRouter({
|
|
9
|
+
history: createWebHistory(),
|
|
10
|
+
routes: [{ path: '/', name: 'jest' }],
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
describe('DatetimeFilter Filter', () => {
|
|
14
|
+
const namespace = 'jest';
|
|
15
|
+
const filterQuery = 'jest';
|
|
16
|
+
const filterSchema = new BaseFilterSchema();
|
|
17
|
+
const store = createStore({
|
|
18
|
+
modules: {
|
|
19
|
+
[namespace]: {
|
|
20
|
+
namespaced: true,
|
|
21
|
+
state: {
|
|
22
|
+
[filterQuery]: filterSchema,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const mountOptions = {
|
|
29
|
+
global: {
|
|
30
|
+
plugins: [router, store],
|
|
31
|
+
},
|
|
32
|
+
props: {
|
|
33
|
+
namespace,
|
|
34
|
+
filterQuery,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
it('renders a component', () => {
|
|
38
|
+
const wrapper = shallowMount(DatetimeFilter, mountOptions);
|
|
39
|
+
expect(wrapper.exists()).toBe(true);
|
|
40
|
+
});
|
|
41
|
+
it('initial restoreValue() triggers setValue() method', async () => {
|
|
42
|
+
const value = Date.now();
|
|
43
|
+
await router.replace({ query: { [filterQuery]: value } });
|
|
44
|
+
const setValueMock = jest.fn();
|
|
45
|
+
jest.spyOn(baseFilterMixin.methods, 'setValue').mockImplementationOnce(setValueMock);
|
|
46
|
+
shallowMount(DatetimeFilter, mountOptions);
|
|
47
|
+
expect(setValueMock).toHaveBeenCalledWith({ filter: filterQuery, value });
|
|
48
|
+
});
|
|
49
|
+
});
|