@vc-shell/framework 1.0.70 → 1.0.71
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 +35 -1
- package/core/composables/useNotifications/index.ts +1 -1
- package/core/composables/useUser/index.ts +175 -9
- package/dist/core/composables/useNotifications/index.d.ts +1 -1
- package/dist/core/composables/useNotifications/index.d.ts.map +1 -1
- package/dist/core/composables/useUser/index.d.ts +18 -1
- package/dist/core/composables/useUser/index.d.ts.map +1 -1
- package/dist/framework.mjs +17124 -15573
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/injectionSymbols.d.ts +6 -0
- package/dist/injectionSymbols.d.ts.map +1 -0
- package/dist/shared/components/app-switcher/composables/useAppSwitcher/index.d.ts +1 -1
- package/dist/shared/components/app-switcher/composables/useAppSwitcher/index.d.ts.map +1 -1
- 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/composables/useBladeNavigation/index.d.ts +1 -1
- package/dist/shared/components/blade-navigation/composables/useBladeNavigation/index.d.ts.map +1 -1
- package/dist/shared/components/change-password/change-password.vue.d.ts +7 -0
- package/dist/shared/components/change-password/change-password.vue.d.ts.map +1 -0
- package/dist/shared/components/change-password/index.d.ts +11 -0
- package/dist/shared/components/change-password/index.d.ts.map +1 -0
- package/dist/shared/components/index.d.ts +9 -0
- package/dist/shared/components/index.d.ts.map +1 -0
- package/dist/shared/components/language-selector/index.d.ts +55 -0
- package/dist/shared/components/language-selector/index.d.ts.map +1 -0
- package/dist/shared/components/language-selector/language-selector.vue.d.ts +45 -0
- package/dist/shared/components/language-selector/language-selector.vue.d.ts.map +1 -0
- package/dist/shared/components/notifications/core/notification.d.ts.map +1 -1
- package/dist/shared/components/notifications/types/index.d.ts +3 -1
- package/dist/shared/components/notifications/types/index.d.ts.map +1 -1
- package/dist/shared/components/user-dropdown-button/index.d.ts +43 -0
- package/dist/shared/components/user-dropdown-button/index.d.ts.map +1 -0
- package/dist/shared/components/user-dropdown-button/user-dropdown-button.vue.d.ts +33 -0
- package/dist/shared/components/user-dropdown-button/user-dropdown-button.vue.d.ts.map +1 -0
- package/dist/shared/index.d.ts +3 -7
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/locales/index.d.ts +3 -0
- package/dist/shared/locales/index.d.ts.map +1 -0
- package/dist/shared/modules/assets/components/assets-details/assets-details.vue.d.ts +2 -9
- package/dist/shared/modules/assets/components/assets-details/assets-details.vue.d.ts.map +1 -1
- package/dist/shared/modules/assets/components/assets-details/index.d.ts +23 -157
- package/dist/shared/modules/assets/components/assets-details/index.d.ts.map +1 -1
- package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts +2 -9
- package/dist/shared/modules/assets-manager/components/assets-manager/assets-manager.vue.d.ts.map +1 -1
- package/dist/shared/modules/assets-manager/components/assets-manager/index.d.ts +27 -172
- package/dist/shared/modules/assets-manager/components/assets-manager/index.d.ts.map +1 -1
- package/dist/shared/modules/index.d.ts +3 -0
- package/dist/shared/modules/index.d.ts.map +1 -0
- package/dist/shared/pages/InvitePage/components/index.d.ts +2 -0
- package/dist/shared/pages/InvitePage/components/index.d.ts.map +1 -0
- package/dist/shared/pages/InvitePage/components/invite/Invite.vue.d.ts +33 -0
- package/dist/shared/pages/InvitePage/components/invite/Invite.vue.d.ts.map +1 -0
- package/dist/shared/pages/InvitePage/components/invite/index.d.ts +32 -0
- package/dist/shared/pages/InvitePage/components/invite/index.d.ts.map +1 -0
- package/dist/shared/pages/InvitePage/index.d.ts +5 -0
- package/dist/shared/pages/InvitePage/index.d.ts.map +1 -0
- package/dist/shared/pages/InvitePage/locales/index.d.ts +3 -0
- package/dist/shared/pages/InvitePage/locales/index.d.ts.map +1 -0
- package/dist/shared/pages/LoginPage/components/index.d.ts +2 -0
- package/dist/shared/pages/LoginPage/components/index.d.ts.map +1 -0
- package/dist/shared/pages/LoginPage/components/login/Login.vue.d.ts +17 -0
- package/dist/shared/pages/LoginPage/components/login/Login.vue.d.ts.map +1 -0
- package/dist/shared/pages/LoginPage/components/login/index.d.ts +28 -0
- package/dist/shared/pages/LoginPage/components/login/index.d.ts.map +1 -0
- package/dist/shared/pages/LoginPage/index.d.ts +3 -0
- package/dist/shared/pages/LoginPage/index.d.ts.map +1 -0
- package/dist/shared/pages/LoginPage/locales/index.d.ts +3 -0
- package/dist/shared/pages/LoginPage/locales/index.d.ts.map +1 -0
- package/dist/shared/pages/LoginPage/plugin.d.ts +6 -0
- package/dist/shared/pages/LoginPage/plugin.d.ts.map +1 -0
- package/dist/shared/pages/ResetPasswordPage/components/index.d.ts +2 -0
- package/dist/shared/pages/ResetPasswordPage/components/index.d.ts.map +1 -0
- package/dist/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue.d.ts +33 -0
- package/dist/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue.d.ts.map +1 -0
- package/dist/shared/pages/ResetPasswordPage/components/reset-password/index.d.ts +32 -0
- package/dist/shared/pages/ResetPasswordPage/components/reset-password/index.d.ts.map +1 -0
- package/dist/shared/pages/ResetPasswordPage/index.d.ts +5 -0
- package/dist/shared/pages/ResetPasswordPage/index.d.ts.map +1 -0
- package/dist/shared/pages/ResetPasswordPage/locales/index.d.ts +3 -0
- package/dist/shared/pages/ResetPasswordPage/locales/index.d.ts.map +1 -0
- package/dist/shared/pages/index.d.ts +10 -0
- package/dist/shared/pages/index.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/typings/index.d.ts +8 -0
- package/dist/typings/index.d.ts.map +1 -0
- package/dist/ui/components/atoms/vc-button/index.d.ts +36 -6
- package/dist/ui/components/atoms/vc-button/index.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-button/vc-button.vue.d.ts +10 -7
- package/dist/ui/components/atoms/vc-button/vc-button.vue.d.ts.map +1 -1
- package/dist/ui/components/atoms/vc-status/index.d.ts +6 -6
- package/dist/ui/components/atoms/vc-status/vc-status.vue.d.ts +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 +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.map +1 -1
- package/dist/ui/components/organisms/vc-app/vc-app.vue.d.ts +2 -2
- 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-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/index.d.ts +1 -31
- 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 +1 -6
- package/dist/ui/components/organisms/vc-blade/vc-blade.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-popup/index.d.ts +6 -6
- package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts +1 -1
- package/dist/ui/components/organisms/vc-popup/vc-popup.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue.d.ts +2 -1
- 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/index.d.ts +7 -7
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +7 -7
- package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
- package/package.json +9 -7
- package/shared/components/app-switcher/composables/useAppSwitcher/index.ts +1 -1
- package/shared/components/blade-navigation/components/vc-blade-navigation/vc-blade-navigation.vue +4 -11
- package/shared/components/blade-navigation/composables/useBladeNavigation/index.ts +4 -7
- package/shared/components/change-password/change-password.vue +167 -0
- package/shared/components/change-password/index.ts +10 -0
- package/shared/components/index.ts +8 -0
- package/shared/components/language-selector/index.ts +10 -0
- package/shared/components/language-selector/language-selector.vue +60 -0
- package/shared/components/notifications/core/notification.ts +3 -3
- package/shared/components/notifications/types/index.ts +4 -1
- package/shared/components/user-dropdown-button/index.ts +10 -0
- package/shared/components/user-dropdown-button/user-dropdown-button.vue +124 -0
- package/shared/index.ts +12 -8
- package/shared/locales/en.json +35 -0
- package/shared/locales/index.ts +2 -0
- package/shared/modules/assets/components/assets-details/assets-details.vue +1 -7
- package/shared/modules/assets-manager/components/assets-manager/assets-manager.vue +0 -6
- package/shared/modules/index.ts +2 -0
- package/shared/pages/InvitePage/components/index.ts +1 -0
- package/shared/pages/InvitePage/components/invite/Invite.vue +172 -0
- package/shared/pages/InvitePage/components/invite/index.ts +3 -0
- package/shared/pages/InvitePage/index.ts +7 -0
- package/shared/pages/InvitePage/locales/en.json +31 -0
- package/shared/pages/InvitePage/locales/index.ts +2 -0
- package/shared/pages/LoginPage/components/index.ts +1 -0
- package/shared/pages/LoginPage/components/login/Login.vue +283 -0
- package/shared/pages/LoginPage/components/login/index.ts +3 -0
- package/shared/pages/LoginPage/index.ts +2 -0
- package/shared/pages/LoginPage/locales/en.json +36 -0
- package/shared/pages/LoginPage/locales/index.ts +2 -0
- package/shared/pages/LoginPage/plugin.ts +17 -0
- package/shared/pages/ResetPasswordPage/components/index.ts +1 -0
- package/shared/pages/ResetPasswordPage/components/reset-password/ResetPassword.vue +166 -0
- package/shared/pages/ResetPasswordPage/components/reset-password/index.ts +3 -0
- package/shared/pages/ResetPasswordPage/index.ts +7 -0
- package/shared/pages/ResetPasswordPage/locales/en.json +28 -0
- package/shared/pages/ResetPasswordPage/locales/index.ts +2 -0
- package/shared/pages/index.ts +12 -0
- package/ui/components/atoms/vc-button/vc-button.vue +109 -143
- package/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +1 -1
- package/ui/components/organisms/vc-app/_internal/vc-app-menu/_internal/vc-app-menu-item/vc-app-menu-item.vue +3 -4
- package/ui/components/organisms/vc-app/vc-app.vue +6 -9
- package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-button/vc-blade-toolbar-button.vue +5 -8
- package/ui/components/organisms/vc-blade/vc-blade.vue +14 -22
- package/ui/components/organisms/vc-login-form/vc-login-form.stories.ts +1 -1
- package/ui/components/organisms/vc-popup/_internal/vc-popup-warning/vc-popup-warning.vue +1 -1
- package/ui/components/organisms/vc-popup/vc-popup.vue +1 -1
- package/ui/components/organisms/vc-table/_internal/vc-table-filter/vc-table-filter.vue +5 -8
- package/ui/components/organisms/vc-table/vc-table.vue +25 -18
- package/ui/locales/en.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
## [1.0.71](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.70...v1.0.71) (2023-06-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* *ui* vc-button text style ([58545cc](https://github.com/VirtoCommerce/vc-shell/commit/58545cc7955549a877e48cb8451e751490c564b3))
|
|
7
|
+
* *ui* vc-popup condition fix ([f0a3866](https://github.com/VirtoCommerce/vc-shell/commit/f0a3866325b12bf4fbc7d68eb83d1692d4cb7cca))
|
|
8
|
+
* navigation prevention fix ([fd94904](https://github.com/VirtoCommerce/vc-shell/commit/fd94904dc94d076dd690c41c18417e5e80dd2cc5))
|
|
9
|
+
* required blade in IBladeEvent interface ([b5197b2](https://github.com/VirtoCommerce/vc-shell/commit/b5197b26994291cb3cb8955626e7fff5154e2e73))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* azure active directory signin ([46cee05](https://github.com/VirtoCommerce/vc-shell/commit/46cee052064434bdd143d744ca7557f5c0fd7e84))
|
|
15
|
+
* common pages moved to shell ([fca5967](https://github.com/VirtoCommerce/vc-shell/commit/fca5967bfa8fdfee09c043dfc565e8aa2534ada1))
|
|
16
|
+
* error slot removed from blades ([9135daa](https://github.com/VirtoCommerce/vc-shell/commit/9135daa186236c6ee9b95ebe786b4fc532828bfb))
|
|
17
|
+
* refactored vc-button ([b66d081](https://github.com/VirtoCommerce/vc-shell/commit/b66d081b79c32fd9a726bf686ec94070debd7f63))
|
|
18
|
+
* select-all ([3e30fef](https://github.com/VirtoCommerce/vc-shell/commit/3e30fefb71f0e5319724f0487c4c01f049ae19ff))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Reverts
|
|
22
|
+
|
|
23
|
+
* required blade in IBladeEvent ([61b1223](https://github.com/VirtoCommerce/vc-shell/commit/61b1223a3b4ce8a131a0ac58ec6c65ca18a053e8))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
1
27
|
## [1.0.70](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.69...v1.0.70) (2023-05-18)
|
|
2
28
|
|
|
3
29
|
|
|
@@ -21,7 +47,6 @@
|
|
|
21
47
|
* notifications template ([1af7c34](https://github.com/VirtoCommerce/vc-shell/commit/1af7c34e228a8c7f8f0cdffd4edce4ff00b5882c))
|
|
22
48
|
* popup handler/updated variant templates ([eae6366](https://github.com/VirtoCommerce/vc-shell/commit/eae6366839a2ab2e0c0dccfc14cf7c6bab5731f6))
|
|
23
49
|
* refactored notifications ([84fda40](https://github.com/VirtoCommerce/vc-shell/commit/84fda4097a3afc7bb8e4a9f99da574885b872d7c))
|
|
24
|
-
* transition to yarn berry monorepo ([73a4da7](https://github.com/VirtoCommerce/vc-shell/commit/73a4da7905fffa030501175d76aeaa0f4caae99a))
|
|
25
50
|
* updated boilerplate ([9f686cc](https://github.com/VirtoCommerce/vc-shell/commit/9f686cca9361a1070b09d4763f6c5b3ace1a47ce))
|
|
26
51
|
* v-click-outside changed to vueUse directive ([26d764f](https://github.com/VirtoCommerce/vc-shell/commit/26d764f83c9b53e667a85684b424a91de8e06a29))
|
|
27
52
|
* vc-select generic component ([c71c8da](https://github.com/VirtoCommerce/vc-shell/commit/c71c8daead1ba5c5ece2a0eb4e15a52d01b1666e))
|
|
@@ -36,6 +61,15 @@
|
|
|
36
61
|
|
|
37
62
|
|
|
38
63
|
|
|
64
|
+
## [1.0.69](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.68...v1.0.69) (2023-04-26)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Features
|
|
68
|
+
|
|
69
|
+
* transition to yarn berry monorepo ([73a4da7](https://github.com/VirtoCommerce/vc-shell/commit/73a4da7905fffa030501175d76aeaa0f4caae99a))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
39
73
|
## [1.0.68](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.67...v1.0.68) (2023-04-24)
|
|
40
74
|
|
|
41
75
|
|
|
@@ -8,7 +8,7 @@ const notificationsClient = new PushNotificationClient();
|
|
|
8
8
|
interface INotifications {
|
|
9
9
|
readonly notifications: ComputedRef<PushNotification[]>;
|
|
10
10
|
readonly moduleNotifications: ComputedRef<PushNotification[]>;
|
|
11
|
-
loadFromHistory(take?: number): void
|
|
11
|
+
loadFromHistory(take?: number): Promise<void>;
|
|
12
12
|
addNotification(message: PushNotification): void;
|
|
13
13
|
markAsRead(message: PushNotification): void;
|
|
14
14
|
markAllAsRead(): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, Ref, ref, ComputedRef } from "vue";
|
|
1
|
+
import { computed, Ref, ref, ComputedRef, onUnmounted, getCurrentInstance } from "vue";
|
|
2
2
|
import ClientOAuth2 from "client-oauth2";
|
|
3
3
|
import {
|
|
4
4
|
UserDetail,
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
IdentityResult,
|
|
10
10
|
} from "./../../api";
|
|
11
11
|
import { AuthData, RequestPasswordResult, SignInResults } from "./../../types";
|
|
12
|
+
import * as _ from "lodash-es";
|
|
13
|
+
import fetchIntercept from "fetch-intercept";
|
|
12
14
|
//The Platform Manager uses the same key to store authorization data in the
|
|
13
15
|
//local storage, so we can exchange authorization data between the Platform Manager
|
|
14
16
|
//and the user application that is hosted in the same domain as the sub application.
|
|
@@ -21,11 +23,25 @@ const authClient = new ClientOAuth2({
|
|
|
21
23
|
accessTokenUri: `/connect/token`,
|
|
22
24
|
scopes: ["offline_access"],
|
|
23
25
|
});
|
|
26
|
+
const isExternalSignedIn = ref(false);
|
|
27
|
+
const activeAuthenticationType = ref();
|
|
24
28
|
const securityClient = new SecurityClient();
|
|
25
29
|
|
|
30
|
+
export interface LoginTypes {
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
hasLoginForm?: boolean;
|
|
33
|
+
authenticationType?: string;
|
|
34
|
+
priority?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface LoginProviders {
|
|
37
|
+
authenticationType?: string;
|
|
38
|
+
displayName?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
26
41
|
interface IUseUser {
|
|
27
42
|
user: ComputedRef<UserDetail | null>;
|
|
28
43
|
loading: ComputedRef<boolean>;
|
|
44
|
+
isExternalSignedIn: Ref<boolean>;
|
|
29
45
|
getAccessToken: () => Promise<string | null>;
|
|
30
46
|
loadUser: () => Promise<UserDetail>;
|
|
31
47
|
signIn: (username: string, password: string) => Promise<SignInResults>;
|
|
@@ -35,9 +51,23 @@ interface IUseUser {
|
|
|
35
51
|
resetPasswordByToken: (userId: string, password: string, token: string) => Promise<SecurityResult>;
|
|
36
52
|
requestPasswordReset: (loginOrEmail: string) => Promise<RequestPasswordResult>;
|
|
37
53
|
changeUserPassword: (oldPassword: string, newPassword: string) => Promise<SecurityResult>;
|
|
54
|
+
getExternalLoginProviders: () => Promise<LoginProviders[]>;
|
|
55
|
+
externalSignIn: (authenticationType?: string | undefined, returnUrl?: string | undefined) => void;
|
|
56
|
+
externalSignOut: (authenticationType?: string | undefined) => void;
|
|
57
|
+
getLoginTypes: () => Promise<LoginTypes[]>;
|
|
58
|
+
isAzureAdAuthAvailable: () => Promise<boolean>;
|
|
59
|
+
getAzureAdAuthCaption: () => Promise<string>;
|
|
38
60
|
}
|
|
39
61
|
|
|
40
62
|
export function useUser(): IUseUser {
|
|
63
|
+
// const instance = getCurrentInstance();
|
|
64
|
+
// if (instance) {
|
|
65
|
+
// onUnmounted(() => {
|
|
66
|
+
// console.error("UNREGISTET");
|
|
67
|
+
// unregister();
|
|
68
|
+
// });
|
|
69
|
+
// }
|
|
70
|
+
|
|
41
71
|
async function validateToken(userId: string, token: string): Promise<boolean> {
|
|
42
72
|
let result = false;
|
|
43
73
|
try {
|
|
@@ -84,7 +114,7 @@ export function useUser(): IUseUser {
|
|
|
84
114
|
expiresAt: addOffsetToCurrentDate(Number(token.data["expires_in"])),
|
|
85
115
|
userName: username,
|
|
86
116
|
};
|
|
87
|
-
console.log("[
|
|
117
|
+
console.log("[useUser]: an access token has been obtained successfully", authData.value);
|
|
88
118
|
|
|
89
119
|
storeAuthData(authData.value);
|
|
90
120
|
await loadUser();
|
|
@@ -94,10 +124,15 @@ export function useUser(): IUseUser {
|
|
|
94
124
|
|
|
95
125
|
async function signOut(): Promise<void> {
|
|
96
126
|
console.debug(`[@vc-shell/framework#useUser:signOut] - Entry point`);
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
127
|
+
|
|
128
|
+
if (!isExternalSignedIn.value) {
|
|
129
|
+
user.value = undefined;
|
|
130
|
+
authData.value = undefined;
|
|
131
|
+
storeAuthData({});
|
|
132
|
+
} else {
|
|
133
|
+
externalSignOut(activeAuthenticationType.value);
|
|
134
|
+
activeAuthenticationType.value = undefined;
|
|
135
|
+
}
|
|
101
136
|
}
|
|
102
137
|
|
|
103
138
|
async function loadUser(): Promise<UserDetail> {
|
|
@@ -108,7 +143,7 @@ export function useUser(): IUseUser {
|
|
|
108
143
|
try {
|
|
109
144
|
loading.value = true;
|
|
110
145
|
user.value = await securityClient.getCurrentUser();
|
|
111
|
-
console.log("[
|
|
146
|
+
console.log("[useUser]: an user details has been loaded", user.value);
|
|
112
147
|
} catch (e) {
|
|
113
148
|
console.dir(e);
|
|
114
149
|
throw e;
|
|
@@ -131,7 +166,7 @@ export function useUser(): IUseUser {
|
|
|
131
166
|
authData.value.refreshToken ?? "",
|
|
132
167
|
{}
|
|
133
168
|
);
|
|
134
|
-
console.log("[
|
|
169
|
+
console.log("[useUser]: an access token is expired, using refresh token to receive a new");
|
|
135
170
|
try {
|
|
136
171
|
const newToken = await token.refresh();
|
|
137
172
|
if (newToken) {
|
|
@@ -145,7 +180,7 @@ export function useUser(): IUseUser {
|
|
|
145
180
|
storeAuthData(authData.value);
|
|
146
181
|
}
|
|
147
182
|
} catch (e) {
|
|
148
|
-
console.log("[
|
|
183
|
+
console.log("[useUser]: getAccessToken() returns error", e);
|
|
149
184
|
}
|
|
150
185
|
}
|
|
151
186
|
|
|
@@ -211,9 +246,134 @@ export function useUser(): IUseUser {
|
|
|
211
246
|
return result as SecurityResult;
|
|
212
247
|
}
|
|
213
248
|
|
|
249
|
+
async function getLoginTypes(): Promise<LoginTypes[]> {
|
|
250
|
+
let result = null as LoginTypes[];
|
|
251
|
+
try {
|
|
252
|
+
const fetchResult = await fetch("/api/platform/security/logintypes", {
|
|
253
|
+
method: "GET",
|
|
254
|
+
headers: {},
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
const response = await fetchResult.text();
|
|
258
|
+
if (response && response.trim()) {
|
|
259
|
+
result = JSON.parse(response) as LoginTypes[];
|
|
260
|
+
}
|
|
261
|
+
} catch (e) {
|
|
262
|
+
console.error(e);
|
|
263
|
+
|
|
264
|
+
throw e;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return result;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
async function getExternalLoginProviders(): Promise<LoginProviders[]> {
|
|
271
|
+
let result = null as LoginProviders[];
|
|
272
|
+
try {
|
|
273
|
+
const fetchResult = await fetch(import.meta.env.APP_PLATFORM_URL + "externalsignin/providers", {
|
|
274
|
+
method: "GET",
|
|
275
|
+
mode: "no-cors",
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
const response = await fetchResult.text();
|
|
279
|
+
if (response && response.trim()) {
|
|
280
|
+
result = JSON.parse(response) as LoginProviders[];
|
|
281
|
+
}
|
|
282
|
+
} catch (e) {
|
|
283
|
+
console.error(e);
|
|
284
|
+
|
|
285
|
+
throw e;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
return result;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
async function externalSignIn(authenticationType?: string | undefined, returnUrl?: string | undefined) {
|
|
292
|
+
activeAuthenticationType.value = authenticationType;
|
|
293
|
+
try {
|
|
294
|
+
let url_ = import.meta.env.APP_PLATFORM_URL + "externalsignin?";
|
|
295
|
+
if (authenticationType === null) throw new Error("The parameter 'authenticationType' cannot be null.");
|
|
296
|
+
else {
|
|
297
|
+
if (authenticationType !== undefined)
|
|
298
|
+
url_ += "authenticationType=" + encodeURIComponent("" + authenticationType) + "&";
|
|
299
|
+
if (returnUrl !== undefined) url_ += "returnUrl=" + encodeURIComponent("" + returnUrl) + "&";
|
|
300
|
+
}
|
|
301
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
302
|
+
isExternalSignedIn.value = true;
|
|
303
|
+
initInterceptor();
|
|
304
|
+
|
|
305
|
+
window.location.href = url_;
|
|
306
|
+
} catch (e) {
|
|
307
|
+
isExternalSignedIn.value = false;
|
|
308
|
+
console.error(e);
|
|
309
|
+
|
|
310
|
+
throw e;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
async function externalSignOut(authenticationType?: string | undefined): Promise<void> {
|
|
315
|
+
try {
|
|
316
|
+
let url_ = import.meta.env.APP_PLATFORM_URL + "externalsignin/signout?";
|
|
317
|
+
if (authenticationType === null) throw new Error("The parameter 'authenticationType' cannot be null.");
|
|
318
|
+
else {
|
|
319
|
+
if (authenticationType !== undefined)
|
|
320
|
+
url_ += "authenticationType=" + encodeURIComponent("" + authenticationType) + "&";
|
|
321
|
+
}
|
|
322
|
+
url_ = url_.replace(/[?&]$/, "");
|
|
323
|
+
|
|
324
|
+
await fetch(url_, {
|
|
325
|
+
method: "GET",
|
|
326
|
+
mode: "no-cors",
|
|
327
|
+
headers: {},
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
fetchIntercept.clear();
|
|
331
|
+
} catch (e) {
|
|
332
|
+
console.error(e);
|
|
333
|
+
|
|
334
|
+
throw e;
|
|
335
|
+
}
|
|
336
|
+
isExternalSignedIn.value = false;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
async function isAzureAdAuthAvailable(): Promise<boolean> {
|
|
340
|
+
const loginTypes = await getLoginTypes();
|
|
341
|
+
if (loginTypes) {
|
|
342
|
+
return (
|
|
343
|
+
loginTypes.filter((x) => x.authenticationType === "AzureAD").length > 0 &&
|
|
344
|
+
loginTypes.find((x) => x.authenticationType === "AzureAD").enabled
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
async function getAzureAdAuthCaption(): Promise<string> {
|
|
351
|
+
const loginProviders = await getExternalLoginProviders();
|
|
352
|
+
if (loginProviders) {
|
|
353
|
+
return loginProviders.find((x) => x.authenticationType === "AzureAD").displayName;
|
|
354
|
+
}
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/* Intercepting requests to explicitly remove auth token when we use AzureAd authentication */
|
|
359
|
+
function initInterceptor() {
|
|
360
|
+
console.log("[@vc-shell/framework#useUser:initInterceptor]: Entry point");
|
|
361
|
+
return fetchIntercept.register({
|
|
362
|
+
request: function (_url, config) {
|
|
363
|
+
if (isExternalSignedIn.value) {
|
|
364
|
+
const edited = _.omit(config.headers, "authorization");
|
|
365
|
+
config.headers = edited;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
return [_url, config];
|
|
369
|
+
},
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
|
|
214
373
|
return {
|
|
215
374
|
user: computed(() => user.value),
|
|
216
375
|
loading: computed(() => loading.value),
|
|
376
|
+
isExternalSignedIn,
|
|
217
377
|
getAccessToken,
|
|
218
378
|
loadUser,
|
|
219
379
|
signIn,
|
|
@@ -223,5 +383,11 @@ export function useUser(): IUseUser {
|
|
|
223
383
|
resetPasswordByToken,
|
|
224
384
|
requestPasswordReset,
|
|
225
385
|
changeUserPassword,
|
|
386
|
+
getExternalLoginProviders,
|
|
387
|
+
externalSignIn,
|
|
388
|
+
externalSignOut,
|
|
389
|
+
getLoginTypes,
|
|
390
|
+
isAzureAdAuthAvailable,
|
|
391
|
+
getAzureAdAuthCaption,
|
|
226
392
|
};
|
|
227
393
|
}
|
|
@@ -3,7 +3,7 @@ import { ComputedRef } from "vue";
|
|
|
3
3
|
interface INotifications {
|
|
4
4
|
readonly notifications: ComputedRef<PushNotification[]>;
|
|
5
5
|
readonly moduleNotifications: ComputedRef<PushNotification[]>;
|
|
6
|
-
loadFromHistory(take?: number): void
|
|
6
|
+
loadFromHistory(take?: number): Promise<void>;
|
|
7
7
|
addNotification(message: PushNotification): void;
|
|
8
8
|
markAsRead(message: PushNotification): void;
|
|
9
9
|
markAllAsRead(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useNotifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA0B,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAY,WAAW,EAAO,MAAM,KAAK,CAAC;AAKjD,UAAU,cAAc;IACtB,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACxD,QAAQ,CAAC,mBAAmB,EAAE,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC9D,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useNotifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA0B,MAAM,aAAa,CAAC;AAEvE,OAAO,EAAY,WAAW,EAAO,MAAM,KAAK,CAAC;AAKjD,UAAU,cAAc;IACtB,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACxD,QAAQ,CAAC,mBAAmB,EAAE,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC9D,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACjD,UAAU,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC5C,aAAa,IAAI,IAAI,CAAC;CACvB;AAKD,wBAAgB,gBAAgB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,CA6F/E"}
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import { ComputedRef } from "vue";
|
|
1
|
+
import { Ref, ComputedRef } from "vue";
|
|
2
2
|
import { UserDetail, SecurityResult, IdentityResult } from "./../../api";
|
|
3
3
|
import { RequestPasswordResult, SignInResults } from "./../../types";
|
|
4
|
+
export interface LoginTypes {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
hasLoginForm?: boolean;
|
|
7
|
+
authenticationType?: string;
|
|
8
|
+
priority?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface LoginProviders {
|
|
11
|
+
authenticationType?: string;
|
|
12
|
+
displayName?: string;
|
|
13
|
+
}
|
|
4
14
|
interface IUseUser {
|
|
5
15
|
user: ComputedRef<UserDetail | null>;
|
|
6
16
|
loading: ComputedRef<boolean>;
|
|
17
|
+
isExternalSignedIn: Ref<boolean>;
|
|
7
18
|
getAccessToken: () => Promise<string | null>;
|
|
8
19
|
loadUser: () => Promise<UserDetail>;
|
|
9
20
|
signIn: (username: string, password: string) => Promise<SignInResults>;
|
|
@@ -13,6 +24,12 @@ interface IUseUser {
|
|
|
13
24
|
resetPasswordByToken: (userId: string, password: string, token: string) => Promise<SecurityResult>;
|
|
14
25
|
requestPasswordReset: (loginOrEmail: string) => Promise<RequestPasswordResult>;
|
|
15
26
|
changeUserPassword: (oldPassword: string, newPassword: string) => Promise<SecurityResult>;
|
|
27
|
+
getExternalLoginProviders: () => Promise<LoginProviders[]>;
|
|
28
|
+
externalSignIn: (authenticationType?: string | undefined, returnUrl?: string | undefined) => void;
|
|
29
|
+
externalSignOut: (authenticationType?: string | undefined) => void;
|
|
30
|
+
getLoginTypes: () => Promise<LoginTypes[]>;
|
|
31
|
+
isAzureAdAuthAvailable: () => Promise<boolean>;
|
|
32
|
+
getAzureAdAuthCaption: () => Promise<string>;
|
|
16
33
|
}
|
|
17
34
|
export declare function useUser(): IUseUser;
|
|
18
35
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useUser/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/composables/useUser/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,GAAG,EAAO,WAAW,EAAmC,MAAM,KAAK,CAAC;AAEvF,OAAO,EACL,UAAU,EAGV,cAAc,EAEd,cAAc,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAY,qBAAqB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAmB/E,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,WAAW,cAAc;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,QAAQ;IAChB,IAAI,EAAE,WAAW,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACrC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC9B,kBAAkB,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACjC,cAAc,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC7C,QAAQ,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;IACpC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IACvE,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAChE,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACnG,oBAAoB,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC/E,kBAAkB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1F,yBAAyB,EAAE,MAAM,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;IAC3D,cAAc,EAAE,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAClG,eAAe,EAAE,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACnE,aAAa,EAAE,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC3C,sBAAsB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/C,qBAAqB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9C;AAED,wBAAgB,OAAO,IAAI,QAAQ,CA2UlC"}
|