@vc-shell/framework 1.0.127 → 1.0.129
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 +43 -0
- package/core/api/platform.ts +514 -92
- package/core/composables/index.ts +2 -1
- package/core/composables/useApiClient/index.ts +1 -7
- package/core/composables/useAssets/index.ts +0 -6
- package/core/composables/useBeforeUnload/index.ts +20 -0
- package/core/composables/useMenuService/index.ts +96 -0
- package/core/composables/useNotifications/index.ts +29 -40
- package/core/composables/useSettings/index.ts +23 -29
- package/core/composables/useUser/index.ts +69 -125
- package/core/directives/loading/styles.css +5 -5
- package/core/interceptors/index.ts +75 -0
- package/core/plugins/i18n/index.ts +1 -0
- package/core/plugins/modularity/index.ts +63 -20
- package/core/plugins/moment/moment.ts +2 -2
- package/core/plugins/signalR/index.ts +24 -4
- package/core/types/index.ts +18 -35
- package/core/utilities/kebabToCamel.ts +1 -1
- package/dist/core/api/platform.d.ts +125 -87
- package/dist/core/api/platform.d.ts.map +1 -1
- package/dist/core/composables/index.d.ts +2 -1
- package/dist/core/composables/index.d.ts.map +1 -1
- package/dist/core/composables/useApiClient/index.d.ts.map +1 -1
- package/dist/core/composables/useAssets/index.d.ts.map +1 -1
- package/dist/core/composables/useBeforeUnload/index.d.ts +5 -0
- package/dist/core/composables/useBeforeUnload/index.d.ts.map +1 -0
- package/dist/core/composables/useMenuService/index.d.ts +16 -0
- package/dist/core/composables/useMenuService/index.d.ts.map +1 -0
- package/dist/core/composables/useNotifications/index.d.ts.map +1 -1
- package/dist/core/composables/useSettings/index.d.ts +2 -2
- package/dist/core/composables/useSettings/index.d.ts.map +1 -1
- package/dist/core/composables/useUser/index.d.ts +8 -6
- package/dist/core/composables/useUser/index.d.ts.map +1 -1
- package/dist/core/interceptors/index.d.ts +3 -0
- package/dist/core/interceptors/index.d.ts.map +1 -0
- package/dist/core/plugins/i18n/index.d.ts.map +1 -1
- package/dist/core/plugins/modularity/index.d.ts +1 -1
- package/dist/core/plugins/modularity/index.d.ts.map +1 -1
- package/dist/core/plugins/moment/moment.d.ts.map +1 -1
- package/dist/core/plugins/signalR/index.d.ts.map +1 -1
- package/dist/core/types/index.d.ts +16 -29
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/{framework.mjs → framework.js} +31832 -31900
- package/dist/index.css +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/shared/components/app-switcher/components/vc-app-switcher/index.d.ts +1 -19
- package/dist/shared/components/app-switcher/components/vc-app-switcher/index.d.ts.map +1 -1
- package/dist/shared/components/app-switcher/components/vc-app-switcher/vc-app-switcher.vue.d.ts +3 -0
- package/dist/shared/components/app-switcher/components/vc-app-switcher/vc-app-switcher.vue.d.ts.map +1 -1
- package/dist/shared/components/blade-navigation/components/vc-blade-navigation/index.d.ts +1 -70
- package/dist/shared/components/blade-navigation/components/vc-blade-navigation/index.d.ts.map +1 -1
- package/dist/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue.d.ts +1 -82
- package/dist/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue.d.ts.map +1 -1
- package/dist/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.d.ts +28 -0
- package/dist/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.d.ts.map +1 -0
- package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts +11 -27
- package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
- package/dist/shared/components/blade-navigation/injectionKeys.d.ts +4 -0
- package/dist/shared/components/blade-navigation/injectionKeys.d.ts.map +1 -0
- package/dist/shared/components/blade-navigation/plugin.d.ts +4 -1
- package/dist/shared/components/blade-navigation/plugin.d.ts.map +1 -1
- package/dist/shared/components/blade-navigation/types/index.d.ts +48 -35
- package/dist/shared/components/blade-navigation/types/index.d.ts.map +1 -1
- package/dist/shared/components/error-interceptor/index.d.ts +33 -67
- package/dist/shared/components/error-interceptor/index.d.ts.map +1 -1
- package/dist/shared/components/index.d.ts +2 -0
- package/dist/shared/components/index.d.ts.map +1 -1
- package/dist/shared/components/language-selector/index.d.ts +1 -49
- package/dist/shared/components/language-selector/index.d.ts.map +1 -1
- package/dist/shared/components/language-selector/language-selector.vue.d.ts +1 -40
- package/dist/shared/components/language-selector/language-selector.vue.d.ts.map +1 -1
- package/dist/{ui/components/organisms/vc-notification-dropdown → shared/components/notification-dropdown}/_internal/notification/notification.vue.d.ts +2 -2
- package/dist/shared/components/notification-dropdown/_internal/notification/notification.vue.d.ts.map +1 -0
- package/dist/shared/components/notification-dropdown/index.d.ts +7 -0
- package/dist/shared/components/notification-dropdown/index.d.ts.map +1 -0
- package/dist/shared/components/notification-dropdown/notification-dropdown.vue.d.ts +3 -0
- package/dist/shared/components/notification-dropdown/notification-dropdown.vue.d.ts.map +1 -0
- package/dist/shared/components/notification-template/index.d.ts +91 -0
- package/dist/shared/components/notification-template/index.d.ts.map +1 -0
- package/dist/{ui/components/organisms/vc-notification-template/vc-notification-template.vue.d.ts → shared/components/notification-template/notification-template.vue.d.ts} +2 -2
- package/dist/shared/components/notification-template/notification-template.vue.d.ts.map +1 -0
- package/dist/shared/components/notifications/components/notification-container/index.d.ts +1 -1
- package/dist/shared/components/notifications/components/notification-container/index.d.ts.map +1 -1
- package/dist/shared/components/popup-handler/composables/usePopup/index.d.ts.map +1 -1
- package/dist/shared/components/user-dropdown-button/index.d.ts +10 -16
- package/dist/shared/components/user-dropdown-button/index.d.ts.map +1 -1
- package/dist/shared/components/user-dropdown-button/user-dropdown-button.vue.d.ts +7 -4
- package/dist/shared/components/user-dropdown-button/user-dropdown-button.vue.d.ts.map +1 -1
- package/dist/shared/index.d.ts +4 -1
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/modules/assets/components/assets-details/assets-details.vue.d.ts +3 -0
- package/dist/shared/modules/assets/components/assets-details/assets-details.vue.d.ts.map +1 -1
- package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts +3 -0
- package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/components/fields/InputCurrency.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/composables/useFilterBuilder/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/factories/base/useDetailsFactory.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/factories/types/index.d.ts +3 -1
- package/dist/shared/modules/dynamic/factories/types/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/index.d.ts +1 -3
- package/dist/shared/modules/dynamic/index.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts +12 -10
- package/dist/shared/modules/dynamic/pages/dynamic-blade-form.vue.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts +5 -2
- package/dist/shared/modules/dynamic/pages/dynamic-blade-list.vue.d.ts.map +1 -1
- package/dist/shared/modules/dynamic/types/index.d.ts +20 -2
- package/dist/shared/modules/dynamic/types/index.d.ts.map +1 -1
- package/dist/shared/pages/InvitePage/components/invite/Invite.vue.d.ts.map +1 -1
- package/dist/shared/pages/LoginPage/components/login/Login.vue.d.ts.map +1 -1
- package/dist/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue.d.ts.map +1 -1
- package/dist/shared/utilities/vueUtils.d.ts.map +1 -1
- package/dist/tailwind.config.d.ts +56 -0
- package/dist/tailwind.config.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/atoms/vc-badge/index.d.ts +32 -67
- package/dist/ui/components/atoms/vc-badge/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-badge/vc-badge.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-button/vc-button.vue.d.ts +6 -1
- package/dist/ui/components/atoms/vc-button/vc-button.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-card/index.d.ts +66 -102
- package/dist/ui/components/atoms/vc-card/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-card/vc-card.stories.d.ts +7 -0
- package/dist/ui/components/atoms/vc-card/vc-card.stories.d.ts.map +1 -0
- package/dist/ui/components/atoms/vc-card/vc-card.vue.d.ts +7 -1
- package/dist/ui/components/atoms/vc-card/vc-card.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-checkbox/index.d.ts +91 -129
- package/dist/ui/components/atoms/vc-checkbox/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.vue.d.ts +7 -1
- package/dist/ui/components/atoms/vc-checkbox/vc-checkbox.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-col/vc-col.vue.d.ts +6 -1
- package/dist/ui/components/atoms/vc-col/vc-col.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-container/index.d.ts +36 -71
- package/dist/ui/components/atoms/vc-container/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-container/vc-container.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-hint/index.d.ts +8 -38
- package/dist/ui/components/atoms/vc-hint/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-hint/vc-hint.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts +3 -0
- package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-image/vc-image.vue.d.ts +3 -0
- package/dist/ui/components/atoms/vc-image/vc-image.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-info-row/vc-info-row.vue.d.ts +3 -0
- package/dist/ui/components/atoms/vc-info-row/vc-info-row.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-label/index.d.ts +42 -74
- package/dist/ui/components/atoms/vc-label/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-label/vc-label.vue.d.ts +7 -1
- package/dist/ui/components/atoms/vc-label/vc-label.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-link/index.d.ts +32 -66
- package/dist/ui/components/atoms/vc-link/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-link/vc-link.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-loading/vc-loading.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-progress/index.d.ts +30 -63
- package/dist/ui/components/atoms/vc-progress/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-progress/vc-progress.vue.d.ts +3 -0
- package/dist/ui/components/atoms/vc-progress/vc-progress.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-row/vc-row.vue.d.ts +3 -1
- package/dist/ui/components/atoms/vc-row/vc-row.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-status/vc-status.vue.d.ts +6 -1
- package/dist/ui/components/atoms/vc-status/vc-status.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-status-icon/vc-status-icon.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-switch/vc-switch.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-video/vc-video.vue.d.ts +3 -0
- package/dist/ui/components/atoms/vc-video/vc-video.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-widget/vc-widget.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue.d.ts +3 -0
- package/dist/ui/components/molecules/vc-breadcrumbs/vc-breadcrumbs.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-code-editor/index.d.ts +59 -98
- package/dist/ui/components/molecules/vc-code-editor/index.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-code-editor/vc-code-editor.vue.d.ts +1 -0
- package/dist/ui/components/molecules/vc-code-editor/vc-code-editor.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts +4 -1
- package/dist/ui/components/molecules/vc-editor/vc-editor.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-field/_internal/vc-field-type/vc-field-type.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-field/vc-field.vue.d.ts +3 -0
- package/dist/ui/components/molecules/vc-field/vc-field.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-file-upload/index.d.ts +67 -105
- package/dist/ui/components/molecules/vc-file-upload/index.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts +3 -0
- package/dist/ui/components/molecules/vc-file-upload/vc-file-upload.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-form/index.d.ts +8 -38
- package/dist/ui/components/molecules/vc-form/index.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-form/vc-form.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts +56 -1
- package/dist/ui/components/molecules/vc-input/vc-input.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input-currency/index.d.ts +159 -214
- package/dist/ui/components/molecules/vc-input-currency/index.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts +3 -0
- package/dist/ui/components/molecules/vc-input-currency/vc-input-currency.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts +27 -9
- package/dist/ui/components/molecules/vc-multivalue/vc-multivalue.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-notification/vc-notification.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-pagination/vc-pagination.vue.d.ts +3 -0
- package/dist/ui/components/molecules/vc-pagination/vc-pagination.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-rating/index.d.ts +59 -96
- package/dist/ui/components/molecules/vc-rating/index.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts +3 -0
- package/dist/ui/components/molecules/vc-rating/vc-rating.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +257 -8
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-slider/index.d.ts +55 -91
- package/dist/ui/components/molecules/vc-slider/index.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-slider/vc-slider.vue.d.ts +3 -0
- package/dist/ui/components/molecules/vc-slider/vc-slider.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts +6 -1
- package/dist/ui/components/molecules/vc-textarea/vc-textarea.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/index.d.ts +0 -2
- package/dist/ui/components/organisms/index.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue.d.ts +2 -4
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.d.ts +10 -7
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts +10 -18
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue.d.ts +16 -16
- package/dist/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-app/index.d.ts +1 -292
- package/dist/ui/components/organisms/vc-app/index.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts +17 -56
- package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-header/vc-blade-header.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue.d.ts +3 -0
- package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue.d.ts +3 -0
- package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/index.d.ts +89 -131
- package/dist/ui/components/organisms/vc-blade/index.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts +3 -0
- package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts +21 -18
- package/dist/ui/components/organisms/vc-dynamic-property/vc-dynamic-property.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts +4 -1
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-item/vc-gallery-item.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts +4 -1
- package/dist/ui/components/organisms/vc-gallery/_internal/vc-gallery-preview/vc-gallery-preview.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts +3 -0
- package/dist/ui/components/organisms/vc-gallery/vc-gallery.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-login-form/index.d.ts +32 -66
- package/dist/ui/components/organisms/vc-login-form/index.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-login-form/vc-login-form.vue.d.ts +3 -0
- package/dist/ui/components/organisms/vc-login-form/vc-login-form.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-popup/_internal/vc-popup-error/vc-popup-error.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-popup/_internal/vc-popup-warning/vc-popup-warning.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue.d.ts +3 -0
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue.d.ts +3 -0
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-counter/vc-table-counter.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue.d.ts +3 -0
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +57 -6
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
- package/dist/ui/types/index.d.ts +5 -45
- package/dist/ui/types/index.d.ts.map +1 -1
- package/package.json +24 -28
- package/shared/components/app-switcher/components/vc-app-switcher/index.ts +1 -3
- package/shared/components/app-switcher/composables/useAppSwitcher/index.ts +3 -3
- package/shared/components/blade-navigation/components/vc-blade-navigation/index.ts +1 -3
- package/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue +46 -157
- package/shared/components/blade-navigation/components/vc-blade-view/vc-blade-view.ts +81 -0
- package/shared/components/blade-navigation/composables/useBladeNavigation/index.ts +323 -261
- package/shared/components/blade-navigation/injectionKeys.ts +4 -0
- package/shared/components/blade-navigation/plugin.ts +8 -10
- package/shared/components/blade-navigation/types/index.ts +53 -44
- package/shared/components/index.ts +2 -0
- package/shared/components/language-selector/language-selector.vue +12 -12
- package/{ui/components/organisms/vc-notification-dropdown → shared/components/notification-dropdown}/_internal/notification/notification.vue +6 -5
- package/shared/components/notification-dropdown/index.ts +10 -0
- package/{ui/components/organisms/vc-notification-dropdown/vc-notification-dropdown.vue → shared/components/notification-dropdown/notification-dropdown.vue} +21 -17
- package/shared/components/notification-template/index.ts +10 -0
- package/{ui/components/organisms/vc-notification-template/vc-notification-template.vue → shared/components/notification-template/notification-template.vue} +2 -2
- package/shared/components/popup-handler/composables/usePopup/index.ts +29 -9
- package/shared/components/user-dropdown-button/user-dropdown-button.vue +58 -17
- package/shared/index.ts +3 -2
- package/shared/locales/en.json +7 -0
- package/shared/modules/assets/components/assets-details/assets-details.vue +5 -0
- package/shared/modules/assets-manager/components/assets-manager/assets-manager.vue +8 -5
- package/shared/modules/dynamic/components/fields/GalleryField.ts +7 -7
- package/shared/modules/dynamic/components/fields/InputCurrency.ts +2 -1
- package/shared/modules/dynamic/composables/useFilterBuilder/index.ts +42 -36
- package/shared/modules/dynamic/factories/base/useDetailsFactory.ts +5 -3
- package/shared/modules/dynamic/factories/types/index.ts +6 -2
- package/shared/modules/dynamic/helpers/override.ts +38 -32
- package/shared/modules/dynamic/helpers/safeIn.ts +1 -1
- package/shared/modules/dynamic/index.ts +12 -12
- package/shared/modules/dynamic/pages/dynamic-blade-form.vue +96 -57
- package/shared/modules/dynamic/pages/dynamic-blade-list.vue +150 -114
- package/shared/modules/dynamic/types/index.ts +22 -2
- package/shared/pages/InvitePage/components/invite/Invite.vue +2 -2
- package/shared/pages/LoginPage/components/login/Login.vue +23 -16
- package/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue +3 -3
- package/shared/utilities/vueUtils.ts +7 -7
- package/ui/components/atoms/vc-button/vc-button.vue +1 -1
- package/ui/components/atoms/vc-card/vc-card.stories.ts +25 -0
- package/ui/components/atoms/vc-card/vc-card.vue +1 -1
- package/ui/components/atoms/vc-container/vc-container.vue +1 -1
- package/ui/components/atoms/vc-icon/vc-icon.vue +1 -1
- package/ui/components/molecules/vc-editor/vc-editor.vue +2 -7
- package/ui/components/molecules/vc-notification/vc-notification.vue +2 -2
- package/ui/components/molecules/vc-select/vc-select.vue +13 -13
- package/ui/components/organisms/index.ts +0 -2
- package/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +25 -42
- package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/_internal/vc-app-menu-link.vue +123 -25
- package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +11 -103
- package/ui/components/organisms/vc-app/_internal/vc-app-menu/vc-app-menu.vue +34 -52
- package/ui/components/organisms/vc-app/index.ts +1 -12
- package/ui/components/organisms/vc-app/vc-app.stories.ts +36 -36
- package/ui/components/organisms/vc-app/vc-app.vue +122 -61
- package/ui/components/organisms/vc-blade/vc-blade.vue +5 -13
- package/ui/components/organisms/vc-table/vc-table.vue +19 -11
- package/ui/locales/en.json +2 -4
- package/ui/types/index.ts +7 -51
- package/core/composables/useMenuComposer/index.ts +0 -25
- package/dist/core/composables/useMenuComposer/index.d.ts +0 -12
- package/dist/core/composables/useMenuComposer/index.d.ts.map +0 -1
- package/dist/ui/components/organisms/vc-notification-dropdown/_internal/notification/notification.vue.d.ts.map +0 -1
- package/dist/ui/components/organisms/vc-notification-dropdown/index.d.ts +0 -38
- package/dist/ui/components/organisms/vc-notification-dropdown/index.d.ts.map +0 -1
- package/dist/ui/components/organisms/vc-notification-dropdown/vc-notification-dropdown.vue.d.ts +0 -21
- package/dist/ui/components/organisms/vc-notification-dropdown/vc-notification-dropdown.vue.d.ts.map +0 -1
- package/dist/ui/components/organisms/vc-notification-template/index.d.ts +0 -2
- package/dist/ui/components/organisms/vc-notification-template/index.d.ts.map +0 -1
- package/dist/ui/components/organisms/vc-notification-template/vc-notification-template.vue.d.ts.map +0 -1
- package/dist/vite.config.d.ts +0 -3
- package/dist/vite.config.d.ts.map +0 -1
- package/tailwind.config.js +0 -50
- package/ui/components/organisms/vc-notification-dropdown/index.ts +0 -3
- package/ui/components/organisms/vc-notification-template/index.ts +0 -1
|
@@ -8,5 +8,6 @@ export * from "./useAsync";
|
|
|
8
8
|
export * from "./useApiClient";
|
|
9
9
|
export * from "./useLoading";
|
|
10
10
|
export * from "./useErrorHandler";
|
|
11
|
-
export * from "./useMenuComposer";
|
|
12
11
|
export { useAssets } from "./useAssets";
|
|
12
|
+
export { useMenuService } from "./useMenuService";
|
|
13
|
+
export { useBeforeUnload } from "./useBeforeUnload";
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { useUser } from "../useUser";
|
|
2
|
-
|
|
3
1
|
export interface IAuthApiBase {
|
|
4
2
|
authToken: string;
|
|
5
3
|
setAuthToken(token: string): void;
|
|
@@ -11,14 +9,10 @@ interface UseApiClient<ApiClient extends IAuthApiBase> {
|
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
export function useApiClient<ApiClient extends IAuthApiBase>(
|
|
14
|
-
c: new (baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> }) => ApiClient
|
|
12
|
+
c: new (baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> }) => ApiClient,
|
|
15
13
|
): UseApiClient<ApiClient> {
|
|
16
|
-
const { getAccessToken } = useUser();
|
|
17
|
-
|
|
18
14
|
async function getApiClient() {
|
|
19
15
|
const client = new c();
|
|
20
|
-
const token = await getAccessToken();
|
|
21
|
-
if (token) client.setAuthToken(token);
|
|
22
16
|
return client;
|
|
23
17
|
}
|
|
24
18
|
|
|
@@ -11,7 +11,6 @@ export interface IUseAssets {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export function useAssets(): IUseAssets {
|
|
14
|
-
const { getAccessToken } = useUser();
|
|
15
14
|
const loading = ref(false);
|
|
16
15
|
|
|
17
16
|
async function upload(files: FileList, uploadPath: string, startingSortOrder?: number): Promise<ICommonAsset[]> {
|
|
@@ -19,8 +18,6 @@ export function useAssets(): IUseAssets {
|
|
|
19
18
|
loading.value = true;
|
|
20
19
|
|
|
21
20
|
const uploadedAssets: Ref<ICommonAsset[]> = ref([]);
|
|
22
|
-
const authToken = await getAccessToken();
|
|
23
|
-
|
|
24
21
|
for (let i = 0; i < files.length; i++) {
|
|
25
22
|
const formData = new FormData();
|
|
26
23
|
formData.append("file", files[i]);
|
|
@@ -28,9 +25,6 @@ export function useAssets(): IUseAssets {
|
|
|
28
25
|
const result = await fetch(`/api/assets?folderUrl=/${uploadPath}`, {
|
|
29
26
|
method: "POST",
|
|
30
27
|
body: formData,
|
|
31
|
-
headers: {
|
|
32
|
-
Authorization: `Bearer ${authToken}`,
|
|
33
|
-
},
|
|
34
28
|
});
|
|
35
29
|
|
|
36
30
|
const response = await result.json();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { onBeforeMount, onBeforeUnmount, unref, ComputedRef } from "vue";
|
|
2
|
+
|
|
3
|
+
export const useBeforeUnload = (modified: ComputedRef<boolean>) => {
|
|
4
|
+
onBeforeMount(() => {
|
|
5
|
+
window.addEventListener("beforeunload", preventUnload);
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
onBeforeUnmount(() => {
|
|
9
|
+
window.removeEventListener("beforeunload", preventUnload);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
function preventUnload(event: Event) {
|
|
13
|
+
if (!unref(modified)) return;
|
|
14
|
+
event.preventDefault();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
modified,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { createSharedComposable, createUnrefFn, useArrayFind } from "@vueuse/core";
|
|
2
|
+
import { Ref, ref, computed } from "vue";
|
|
3
|
+
import * as _ from "lodash-es";
|
|
4
|
+
import { i18n } from "./../../plugins/i18n";
|
|
5
|
+
import { MenuItemConfig } from "../../../shared/components/blade-navigation/types";
|
|
6
|
+
import { MenuItem } from "../../types";
|
|
7
|
+
|
|
8
|
+
export interface IUseMenuService {
|
|
9
|
+
addMenuItem: MenuItemConfig;
|
|
10
|
+
menuItems: Ref<MenuItem[]>;
|
|
11
|
+
removeMenuItem: (item: MenuItem) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const menuItems: Ref<MenuItem[]> = ref([]);
|
|
15
|
+
const rawMenu: Ref<Record<string, unknown>[]> = ref([]);
|
|
16
|
+
|
|
17
|
+
function useMenuServiceFn() {
|
|
18
|
+
const { t } = i18n.global;
|
|
19
|
+
|
|
20
|
+
function addMenuItem(item: Record<string, unknown>) {
|
|
21
|
+
rawMenu.value.push(item);
|
|
22
|
+
|
|
23
|
+
constructMenu();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const upsert = createUnrefFn((array: Record<string, unknown>[], element: Record<string, unknown>) => {
|
|
27
|
+
const i = array.findIndex((_element) => _.isEqual(_element, element));
|
|
28
|
+
if (i > -1) array[i] = { ...element };
|
|
29
|
+
else array.push({ ...element });
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
function sortByPriority(a: MenuItem, b: MenuItem) {
|
|
33
|
+
const priorityA = a.priority !== undefined ? a.priority : Infinity;
|
|
34
|
+
const priorityB = b.priority !== undefined ? b.priority : Infinity;
|
|
35
|
+
|
|
36
|
+
return priorityA - priorityB;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function constructMenu() {
|
|
40
|
+
const constructedMenu = ref<MenuItem[]>([]);
|
|
41
|
+
|
|
42
|
+
rawMenu.value.forEach((item) => {
|
|
43
|
+
let group;
|
|
44
|
+
if (item.group) {
|
|
45
|
+
const isGroupExist = useArrayFind(constructedMenu, (m) => m.groupId === "group_" + item.group);
|
|
46
|
+
|
|
47
|
+
const groupItem = _.omit(
|
|
48
|
+
{
|
|
49
|
+
...item,
|
|
50
|
+
title: computed(() => t(item.title as string)),
|
|
51
|
+
},
|
|
52
|
+
"group",
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
if (isGroupExist.value) {
|
|
56
|
+
upsert(isGroupExist.value.children, groupItem);
|
|
57
|
+
} else {
|
|
58
|
+
group = {
|
|
59
|
+
groupId: "group_" + item.group,
|
|
60
|
+
icon: item.icon,
|
|
61
|
+
title: computed(() => t(item.group as string)),
|
|
62
|
+
children: [_.omit(groupItem)],
|
|
63
|
+
priority: item.priority,
|
|
64
|
+
};
|
|
65
|
+
upsert(constructedMenu.value, group);
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
if (item && item.title) {
|
|
69
|
+
upsert(constructedMenu.value, {
|
|
70
|
+
...item,
|
|
71
|
+
title: item.title,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
menuItems.value = constructedMenu.value
|
|
78
|
+
.map((x, index) => ({ ...x, title: computed(() => t(x.title as string)), id: index }))
|
|
79
|
+
.sort(sortByPriority);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function removeMenuItem(item: MenuItem) {
|
|
83
|
+
const index = menuItems.value.indexOf(item);
|
|
84
|
+
menuItems.value.splice(index, 1);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
addMenuItem,
|
|
89
|
+
menuItems,
|
|
90
|
+
removeMenuItem,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const useMenuService = createSharedComposable(useMenuServiceFn);
|
|
95
|
+
|
|
96
|
+
export { useMenuService };
|
|
@@ -18,31 +18,24 @@ const notifications = ref<PushNotification[]>([]);
|
|
|
18
18
|
const pushNotifications = ref<PushNotification[]>([]);
|
|
19
19
|
|
|
20
20
|
export function useNotifications(notifyType?: string | string[]): INotifications {
|
|
21
|
-
const { getAccessToken } = useUser();
|
|
22
|
-
|
|
23
21
|
async function loadFromHistory(take = 10) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
authorization: `Bearer ${token}`,
|
|
35
|
-
},
|
|
36
|
-
body: JSON.stringify({ take }),
|
|
37
|
-
});
|
|
22
|
+
// TODO temporary workaround to get push notifications without base type
|
|
23
|
+
try {
|
|
24
|
+
const result = await fetch("/api/platform/pushnotifications", {
|
|
25
|
+
method: "POST",
|
|
26
|
+
headers: {
|
|
27
|
+
"Content-Type": "application/json-patch+json",
|
|
28
|
+
Accept: "application/json",
|
|
29
|
+
},
|
|
30
|
+
body: JSON.stringify({ take }),
|
|
31
|
+
});
|
|
38
32
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
33
|
+
result.text().then((response) => {
|
|
34
|
+
notifications.value = <PushNotification[]>JSON.parse(response).notifyEvents ?? [];
|
|
35
|
+
});
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.error(e);
|
|
38
|
+
throw e;
|
|
46
39
|
}
|
|
47
40
|
}
|
|
48
41
|
|
|
@@ -75,21 +68,17 @@ export function useNotifications(notifyType?: string | string[]): INotifications
|
|
|
75
68
|
}
|
|
76
69
|
|
|
77
70
|
async function markAllAsRead() {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
} catch (e) {
|
|
90
|
-
console.error(e);
|
|
91
|
-
throw e;
|
|
92
|
-
}
|
|
71
|
+
try {
|
|
72
|
+
await notificationsClient.markAllAsRead();
|
|
73
|
+
notifications.value = notifications.value.map((x) => {
|
|
74
|
+
if (x.isNew) {
|
|
75
|
+
x.isNew = false;
|
|
76
|
+
}
|
|
77
|
+
return x;
|
|
78
|
+
});
|
|
79
|
+
} catch (e) {
|
|
80
|
+
console.error(e);
|
|
81
|
+
throw e;
|
|
93
82
|
}
|
|
94
83
|
}
|
|
95
84
|
|
|
@@ -97,8 +86,8 @@ export function useNotifications(notifyType?: string | string[]): INotifications
|
|
|
97
86
|
() =>
|
|
98
87
|
pushNotifications.value.filter(
|
|
99
88
|
(item: PushNotification) =>
|
|
100
|
-
item.isNew && !!item.notifyType && !!notifyType && notifyType.includes(item.notifyType)
|
|
101
|
-
) ?? []
|
|
89
|
+
item.isNew && !!item.notifyType && !!notifyType && notifyType.includes(item.notifyType),
|
|
90
|
+
) ?? [],
|
|
102
91
|
);
|
|
103
92
|
|
|
104
93
|
return {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useAsync } from "./../useAsync";
|
|
2
|
+
import { useApiClient } from "./../useApiClient";
|
|
3
|
+
import { computed, inject, onBeforeMount, Ref, ref, ComputedRef } from "vue";
|
|
3
4
|
import { SettingClient } from "./../../api/platform";
|
|
5
|
+
import { useLoading } from "../useLoading";
|
|
4
6
|
|
|
5
7
|
interface IUISetting {
|
|
6
8
|
contrast_logo?: string;
|
|
@@ -10,52 +12,44 @@ interface IUISetting {
|
|
|
10
12
|
|
|
11
13
|
interface IUseSettings {
|
|
12
14
|
readonly uiSettings: Ref<IUISetting>;
|
|
13
|
-
|
|
15
|
+
readonly loading: ComputedRef<boolean>;
|
|
14
16
|
applySettings: (args: { logo?: string; title?: string }) => void;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
const uiSettings = ref<IUISetting>(
|
|
18
|
-
logo: undefined,
|
|
19
|
-
title: undefined,
|
|
20
|
-
});
|
|
19
|
+
const uiSettings = ref<IUISetting | undefined>();
|
|
21
20
|
export function useSettings(): IUseSettings {
|
|
22
|
-
const { getAccessToken } = useUser();
|
|
23
21
|
const base = inject("platformUrl");
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
const client = new SettingClient();
|
|
27
|
-
client.setAuthToken((await getAccessToken()) ?? "");
|
|
28
|
-
return client;
|
|
29
|
-
}
|
|
23
|
+
const { getApiClient } = useApiClient(SettingClient);
|
|
30
24
|
|
|
31
|
-
|
|
32
|
-
const
|
|
25
|
+
const { loading, action: getUiCustomizationSettings } = useAsync(async () => {
|
|
26
|
+
const result = await (await getApiClient()).getUICustomizationSetting();
|
|
27
|
+
const settings = await JSON.parse(result.defaultValue ?? null);
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
const result = await client.getUICustomizationSetting();
|
|
36
|
-
const settings = JSON.parse(result.defaultValue);
|
|
29
|
+
if (settings) {
|
|
37
30
|
uiSettings.value = {
|
|
38
31
|
contrast_logo: base + settings.contrast_logo,
|
|
39
32
|
logo: base + settings.logo,
|
|
40
33
|
title: settings.title,
|
|
41
34
|
};
|
|
42
|
-
} catch (e) {
|
|
43
|
-
console.error(e);
|
|
44
35
|
}
|
|
45
|
-
}
|
|
36
|
+
});
|
|
46
37
|
|
|
47
38
|
function applySettings(args: { logo?: string; title?: string }) {
|
|
48
|
-
|
|
49
|
-
uiSettings.value
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
39
|
+
uiSettings.value = {
|
|
40
|
+
...uiSettings.value,
|
|
41
|
+
logo: args.logo,
|
|
42
|
+
title: args.title,
|
|
43
|
+
};
|
|
54
44
|
}
|
|
55
45
|
|
|
46
|
+
onBeforeMount(async () => {
|
|
47
|
+
await getUiCustomizationSettings();
|
|
48
|
+
});
|
|
49
|
+
|
|
56
50
|
return {
|
|
57
|
-
uiSettings: computed(() => uiSettings.value),
|
|
58
|
-
getUiCustomizationSettings,
|
|
51
|
+
uiSettings: computed(() => uiSettings.value ?? {}),
|
|
59
52
|
applySettings,
|
|
53
|
+
loading: useLoading(loading),
|
|
60
54
|
};
|
|
61
55
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import { computed, Ref, ref, ComputedRef } from "vue";
|
|
3
|
-
import ClientOAuth2 from "client-oauth2";
|
|
4
3
|
import {
|
|
5
4
|
UserDetail,
|
|
6
5
|
SecurityClient,
|
|
@@ -12,30 +11,21 @@ import {
|
|
|
12
11
|
ChangePasswordRequest,
|
|
13
12
|
LoginType,
|
|
14
13
|
ExternalSignInProviderInfo,
|
|
14
|
+
LoginRequest,
|
|
15
|
+
SignInResult,
|
|
15
16
|
} from "./../../api/platform";
|
|
16
|
-
import {
|
|
17
|
-
import { useLocalStorage } from "@vueuse/core";
|
|
18
|
-
//The Platform Manager uses the same key to store authorization data in the
|
|
19
|
-
//local storage, so we can exchange authorization data between the Platform Manager
|
|
20
|
-
//and the user application that is hosted in the same domain as the sub application.
|
|
21
|
-
const VC_AUTH_DATA_KEY = "ls.authenticationData";
|
|
17
|
+
import { RequestPasswordResult } from "./../../types";
|
|
18
|
+
import { createSharedComposable, useLocalStorage } from "@vueuse/core";
|
|
22
19
|
|
|
23
|
-
const
|
|
24
|
-
const loading: Ref<boolean> = ref(false);
|
|
25
|
-
const authData: Ref<AuthData | undefined> = ref();
|
|
26
|
-
const authClient = new ClientOAuth2({
|
|
27
|
-
accessTokenUri: `/connect/token`,
|
|
28
|
-
scopes: ["offline_access"],
|
|
29
|
-
});
|
|
30
|
-
const securityClient = new SecurityClient();
|
|
20
|
+
const VC_EXTERNAL_AUTH_DATA_KEY = "externalSignIn";
|
|
31
21
|
|
|
32
22
|
interface IUseUser {
|
|
33
23
|
user: ComputedRef<UserDetail | undefined>;
|
|
34
24
|
loading: ComputedRef<boolean>;
|
|
35
25
|
isAdministrator: ComputedRef<boolean | undefined>;
|
|
36
|
-
getAccessToken: () => Promise<string | undefined>;
|
|
26
|
+
// getAccessToken: () => Promise<string | undefined>;
|
|
37
27
|
loadUser: () => Promise<UserDetail>;
|
|
38
|
-
signIn: (username: string, password: string) => Promise<
|
|
28
|
+
signIn: (username: string, password: string) => Promise<SignInResult | { succeeded: boolean; error?: any }>;
|
|
39
29
|
signOut: () => Promise<void>;
|
|
40
30
|
validateToken: (userId: string, token: string) => Promise<boolean>;
|
|
41
31
|
validatePassword: (password: string) => Promise<IdentityResult>;
|
|
@@ -45,19 +35,25 @@ interface IUseUser {
|
|
|
45
35
|
getExternalLoginProviders: () => Promise<ExternalSignInProviderInfo[] | undefined>;
|
|
46
36
|
externalSignIn: (authenticationType?: string | undefined, returnUrl?: string | undefined) => void;
|
|
47
37
|
getLoginType: () => Promise<LoginType[]>;
|
|
48
|
-
isAuthenticated:
|
|
38
|
+
isAuthenticated: ComputedRef<boolean>;
|
|
49
39
|
}
|
|
40
|
+
const user: Ref<UserDetail | undefined> = ref();
|
|
41
|
+
function useUserFn(): IUseUser {
|
|
42
|
+
const loading: Ref<boolean> = ref(false);
|
|
50
43
|
|
|
51
|
-
|
|
44
|
+
const securityClient = new SecurityClient();
|
|
52
45
|
const base = window.location.origin + "/";
|
|
53
46
|
const externalSecurityClient = new ExternalSignInClient(base);
|
|
54
|
-
const externalSignInStorage = useLocalStorage<{ providerType
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
const externalSignInStorage = useLocalStorage<{ providerType?: string | undefined }>(
|
|
48
|
+
VC_EXTERNAL_AUTH_DATA_KEY,
|
|
49
|
+
{},
|
|
50
|
+
{
|
|
51
|
+
listenToStorageChanges: true,
|
|
52
|
+
deep: true,
|
|
53
|
+
},
|
|
54
|
+
);
|
|
57
55
|
|
|
58
|
-
const isAuthenticated =
|
|
59
|
-
return !!((externalSignInStorage.value && externalSignInStorage.value.providerType) ?? (await getAccessToken()));
|
|
60
|
-
};
|
|
56
|
+
const isAuthenticated = computed(() => user.value?.userName != null);
|
|
61
57
|
|
|
62
58
|
async function validateToken(userId: string, token: string): Promise<boolean> {
|
|
63
59
|
let result = false;
|
|
@@ -85,111 +81,60 @@ export function useUser(): IUseUser {
|
|
|
85
81
|
} as ResetPasswordConfirmRequest);
|
|
86
82
|
}
|
|
87
83
|
|
|
88
|
-
async function signIn(
|
|
84
|
+
async function signIn(
|
|
85
|
+
username: string,
|
|
86
|
+
password: string,
|
|
87
|
+
): Promise<SignInResult | { succeeded: boolean; error?: any }> {
|
|
89
88
|
console.debug(`[@vc-shell/framework#useUser:signIn] - Entry point`);
|
|
90
|
-
let token = undefined;
|
|
91
89
|
try {
|
|
92
90
|
loading.value = true;
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
const result = await securityClient.login(new LoginRequest({ userName: username, password }));
|
|
92
|
+
return await securityClient
|
|
93
|
+
.getCurrentUser()
|
|
94
|
+
.then((res) => {
|
|
95
|
+
if (res) {
|
|
96
|
+
user.value = res;
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
throw { succeeded: false };
|
|
100
|
+
})
|
|
101
|
+
.catch((e) => {
|
|
102
|
+
throw e;
|
|
103
|
+
});
|
|
104
|
+
} catch (e: any) {
|
|
95
105
|
//TODO: log error
|
|
96
|
-
|
|
106
|
+
console.log(e);
|
|
107
|
+
return { succeeded: false, error: e.message };
|
|
97
108
|
} finally {
|
|
98
109
|
loading.value = false;
|
|
99
110
|
}
|
|
100
|
-
|
|
101
|
-
if (token) {
|
|
102
|
-
authData.value = {
|
|
103
|
-
accessToken: token.accessToken,
|
|
104
|
-
refreshToken: token.refreshToken,
|
|
105
|
-
expiresAt: addOffsetToCurrentDate(Number(token.data["expires_in"])),
|
|
106
|
-
userName: username,
|
|
107
|
-
};
|
|
108
|
-
console.log("[useUser]: an access token has been obtained successfully", authData.value);
|
|
109
|
-
|
|
110
|
-
storeAuthData(authData.value);
|
|
111
|
-
}
|
|
112
|
-
await loadUser();
|
|
113
|
-
return { succeeded: true };
|
|
114
111
|
}
|
|
115
112
|
|
|
116
113
|
async function signOut(): Promise<void> {
|
|
117
114
|
console.debug(`[@vc-shell/framework#useUser:signOut] - Entry point`);
|
|
118
115
|
|
|
119
|
-
if (externalSignInStorage.value
|
|
120
|
-
externalSignOut(externalSignInStorage.value.providerType);
|
|
116
|
+
if (externalSignInStorage.value?.providerType) {
|
|
117
|
+
await externalSignOut(externalSignInStorage.value.providerType);
|
|
121
118
|
} else {
|
|
122
119
|
user.value = undefined;
|
|
123
|
-
|
|
124
|
-
storeAuthData({});
|
|
120
|
+
securityClient.logout();
|
|
125
121
|
}
|
|
126
122
|
}
|
|
127
123
|
|
|
128
124
|
async function loadUser(): Promise<UserDetail> {
|
|
129
125
|
console.debug(`[@vc-shell/framework#useUser:loadUser] - Entry point`);
|
|
130
|
-
const token = await getAccessToken();
|
|
131
|
-
if (token) {
|
|
132
|
-
securityClient.setAuthToken(token);
|
|
133
|
-
|
|
134
|
-
try {
|
|
135
|
-
loading.value = true;
|
|
136
|
-
user.value = await securityClient.getCurrentUser();
|
|
137
|
-
console.log("[useUser]: an user details has been loaded", user.value);
|
|
138
|
-
} catch (e) {
|
|
139
|
-
console.dir(e);
|
|
140
|
-
throw e;
|
|
141
|
-
} finally {
|
|
142
|
-
loading.value = false;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return { ...user.value } as UserDetail;
|
|
147
|
-
}
|
|
148
126
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
authData.value.accessToken ?? authData.value.token ?? "",
|
|
158
|
-
authData.value.refreshToken ?? "",
|
|
159
|
-
{}
|
|
160
|
-
);
|
|
161
|
-
|
|
162
|
-
console.log("[useUser]: an access token is expired, using refresh token to receive a new");
|
|
163
|
-
try {
|
|
164
|
-
const newToken = await token.refresh();
|
|
165
|
-
if (newToken) {
|
|
166
|
-
authData.value = {
|
|
167
|
-
...authData.value,
|
|
168
|
-
accessToken: newToken.accessToken,
|
|
169
|
-
token: newToken.accessToken,
|
|
170
|
-
refreshToken: newToken.refreshToken,
|
|
171
|
-
expiresAt: addOffsetToCurrentDate(Number(newToken.data["expires_in"])),
|
|
172
|
-
};
|
|
173
|
-
storeAuthData(authData.value);
|
|
174
|
-
}
|
|
175
|
-
} catch (e) {
|
|
176
|
-
console.log("[useUser]: getAccessToken() returns error", e);
|
|
177
|
-
}
|
|
127
|
+
try {
|
|
128
|
+
loading.value = true;
|
|
129
|
+
user.value = await securityClient.getCurrentUser();
|
|
130
|
+
console.log("[useUser]: an user details has been loaded", user.value);
|
|
131
|
+
} catch (e: any) {
|
|
132
|
+
console.error(e);
|
|
133
|
+
} finally {
|
|
134
|
+
loading.value = false;
|
|
178
135
|
}
|
|
179
136
|
|
|
180
|
-
return
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function storeAuthData(authData: AuthData) {
|
|
184
|
-
localStorage.setItem(VC_AUTH_DATA_KEY, JSON.stringify({ ...(authData || {}) }));
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
async function readAuthData(): Promise<AuthData> {
|
|
188
|
-
return (await JSON.parse(localStorage.getItem(VC_AUTH_DATA_KEY) || "{}")) as AuthData;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function addOffsetToCurrentDate(offsetInSeconds: number): number {
|
|
192
|
-
return Date.now() + offsetInSeconds * 1000;
|
|
137
|
+
return { ...user.value } as UserDetail;
|
|
193
138
|
}
|
|
194
139
|
|
|
195
140
|
async function requestPasswordReset(loginOrEmail: string): Promise<RequestPasswordResult> {
|
|
@@ -206,23 +151,20 @@ export function useUser(): IUseUser {
|
|
|
206
151
|
}
|
|
207
152
|
|
|
208
153
|
async function changeUserPassword(oldPassword: string, newPassword: string): Promise<SecurityResult | undefined> {
|
|
209
|
-
const token = await getAccessToken();
|
|
210
154
|
let result;
|
|
211
155
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
loading.value = false;
|
|
225
|
-
}
|
|
156
|
+
try {
|
|
157
|
+
loading.value = true;
|
|
158
|
+
const command = new ChangePasswordRequest({
|
|
159
|
+
oldPassword,
|
|
160
|
+
newPassword,
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
result = await securityClient.changeCurrentUserPassword(command);
|
|
164
|
+
} catch (e: any) {
|
|
165
|
+
return { succeeded: false, errors: [e.message] } as SecurityResult;
|
|
166
|
+
} finally {
|
|
167
|
+
loading.value = false;
|
|
226
168
|
}
|
|
227
169
|
|
|
228
170
|
return result;
|
|
@@ -282,7 +224,7 @@ export function useUser(): IUseUser {
|
|
|
282
224
|
try {
|
|
283
225
|
externalSecurityClient.signOut(authenticationType);
|
|
284
226
|
|
|
285
|
-
externalSignInStorage.value =
|
|
227
|
+
externalSignInStorage.value = {};
|
|
286
228
|
} catch (e) {
|
|
287
229
|
console.error(e);
|
|
288
230
|
throw e;
|
|
@@ -294,7 +236,7 @@ export function useUser(): IUseUser {
|
|
|
294
236
|
loading: computed(() => loading.value),
|
|
295
237
|
isAdministrator: computed(() => user.value?.isAdministrator),
|
|
296
238
|
isAuthenticated,
|
|
297
|
-
getAccessToken,
|
|
239
|
+
// getAccessToken,
|
|
298
240
|
loadUser,
|
|
299
241
|
signIn,
|
|
300
242
|
signOut,
|
|
@@ -308,3 +250,5 @@ export function useUser(): IUseUser {
|
|
|
308
250
|
getLoginType,
|
|
309
251
|
};
|
|
310
252
|
}
|
|
253
|
+
|
|
254
|
+
export const useUser = createSharedComposable(() => useUserFn());
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
.v-loading::before {
|
|
8
|
-
content:
|
|
8
|
+
content: "";
|
|
9
9
|
position: absolute;
|
|
10
|
-
z-index:
|
|
10
|
+
z-index: 9998;
|
|
11
11
|
top: 0;
|
|
12
12
|
right: 0;
|
|
13
13
|
bottom: 0;
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.v-loading::after {
|
|
20
|
-
content:
|
|
20
|
+
content: "";
|
|
21
21
|
position: absolute;
|
|
22
|
-
z-index:
|
|
22
|
+
z-index: 9999;
|
|
23
23
|
width: 30px;
|
|
24
24
|
height: 30px;
|
|
25
25
|
border: 4px solid #319ed4;
|
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
|
|
34
34
|
@keyframes v-loading {
|
|
35
35
|
to {
|
|
36
|
-
|
|
36
|
+
transform: rotate(360deg);
|
|
37
37
|
}
|
|
38
38
|
}
|