andoncloud-sdk 1.7.13 → 1.7.15
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/dist/andoncloud-sdk.js +4 -4
- package/dist/andoncloud-sdk.js.map +1 -1
- package/dist/cypress/support/component.d.ts +9 -12
- package/dist/cypress.config.d.ts +2 -3
- package/dist/index.d.ts +9 -3
- package/dist/src/__tests__/loginWithPassword.cy.d.ts +1 -0
- package/dist/src/assets/index.d.ts +1 -1
- package/dist/src/components/Header/Header.cy.d.ts +1 -0
- package/dist/src/components/Header/Header.d.ts +3 -0
- package/dist/src/components/Header/index.d.ts +1 -0
- package/dist/src/components/Header/styles.d.ts +11 -0
- package/dist/src/components/Header/types.d.ts +52 -0
- package/dist/src/components/access/AccessBlocker.cy.d.ts +1 -0
- package/dist/src/components/access/AccessBlocker.d.ts +12 -0
- package/dist/src/components/access/AccessBlocker.styles.d.ts +34 -0
- package/dist/src/components/access/AccessGuard.cy.d.ts +1 -0
- package/dist/src/components/access/AccessGuard.d.ts +9 -0
- package/dist/src/components/access/AccessRequestModal.cy.d.ts +1 -0
- package/dist/src/components/access/AccessRequestModal.d.ts +8 -0
- package/dist/src/components/access/AccessRequestModal.styles.d.ts +31 -0
- package/dist/src/components/access/CooldownModal.cy.d.ts +1 -0
- package/dist/src/components/access/CooldownModal.d.ts +7 -0
- package/dist/src/components/access/CooldownModal.styles.d.ts +30 -0
- package/dist/src/components/access/index.d.ts +3 -0
- package/dist/src/components/access/withAccessGuard.cy.d.ts +1 -0
- package/dist/src/components/access/withAccessGuard.d.ts +6 -0
- package/dist/src/components/app.d.ts +3 -0
- package/dist/src/components/authRedirect.cy.d.ts +1 -0
- package/dist/src/components/authRedirect.d.ts +3 -0
- package/dist/src/components/container.cy.d.ts +1 -0
- package/dist/src/components/container.d.ts +44 -0
- package/dist/src/components/container.styles.d.ts +20 -0
- package/dist/src/components/externalContent.d.ts +5 -0
- package/dist/src/components/footer.d.ts +6 -0
- package/dist/src/components/iframeNavigation.d.ts +2 -0
- package/dist/src/components/loader.d.ts +6 -0
- package/dist/src/components/loginForm.cy.d.ts +1 -0
- package/dist/src/components/loginForm.d.ts +29 -0
- package/dist/src/components/loginModal.cy.d.ts +1 -0
- package/dist/src/components/loginModal.d.ts +16 -0
- package/dist/src/components/loginRedirect.d.ts +3 -0
- package/dist/src/components/networkError.d.ts +4 -0
- package/dist/src/components/router.d.ts +5 -0
- package/dist/src/components/sidePanel.d.ts +66 -0
- package/dist/src/components/sidePanel.styles.d.ts +15 -0
- package/dist/src/components/sidebarMenu.d.ts +32 -0
- package/dist/src/components/sidebarMenu.styles.d.ts +32 -0
- package/dist/src/core/ui/Checkbox/Checkbox.d.ts +6 -0
- package/dist/src/core/ui/Checkbox/index.d.ts +1 -0
- package/dist/src/core/ui/Checkbox/styled.d.ts +6 -0
- package/dist/src/core/ui/Radio/Radio.d.ts +6 -0
- package/dist/src/core/ui/Radio/index.d.ts +1 -0
- package/dist/src/core/ui/Radio/styled.d.ts +6 -0
- package/dist/src/core/ui/RadioGroup/RadioGroup.d.ts +6 -0
- package/dist/src/core/ui/RadioGroup/index.d.ts +1 -0
- package/dist/src/core/ui/RadioGroup/styled.d.ts +4 -0
- package/dist/src/hooks/useAccess/accessState.d.ts +7 -0
- package/dist/src/hooks/useAccess/deriveButtons.d.ts +5 -0
- package/dist/src/hooks/useAccess/index.d.ts +11 -0
- package/dist/src/hooks/useAccess.cy.d.ts +1 -0
- package/dist/src/hooks/useFeatures.cy.d.ts +1 -0
- package/dist/src/hooks/useFeatures.d.ts +6 -0
- package/dist/src/hooks/useHeaderContentEvent.cy.d.ts +1 -0
- package/dist/src/hooks/useHeaderContentEvent.d.ts +3 -0
- package/dist/src/hooks/useLogin.d.ts +2 -0
- package/dist/src/hooks/useLoginStatus.d.ts +3 -0
- package/dist/src/hooks/useModalHook/ModalContext.d.ts +7 -0
- package/dist/src/hooks/useModalHook/ModalProvider.d.ts +5 -0
- package/dist/src/hooks/useModalHook/index.d.ts +3 -0
- package/dist/src/hooks/useModalHook/useModal.d.ts +8 -0
- package/dist/src/hooks/usePermissions.cy.d.ts +1 -0
- package/dist/src/hooks/usePermissions.d.ts +13 -0
- package/dist/src/hooks/useQueryParams.d.ts +2 -0
- package/dist/src/i18n.d.ts +9 -0
- package/dist/src/index.d.ts +36 -54
- package/dist/src/pages/ErrorPage.d.ts +14 -0
- package/dist/src/pages/LoaderPage.d.ts +7 -0
- package/dist/src/pages/LoginPage.d.ts +15 -0
- package/dist/src/providers/authConfig.d.ts +6 -0
- package/dist/src/providers/display.d.ts +5 -0
- package/dist/src/providers/metaInfo.d.ts +6 -0
- package/dist/src/providers/store.d.ts +171 -0
- package/dist/src/serviceWorkerRegistration.d.ts +2 -2
- package/dist/src/stores/SessionStore/CookiesManager.d.ts +11 -0
- package/dist/src/stores/SessionStore/SessionStore.cy.d.ts +1 -0
- package/dist/src/stores/SessionStore/SessionStore.d.ts +60 -0
- package/dist/src/stores/SessionStore/TokenCoordinator.cy.d.ts +1 -0
- package/dist/src/stores/SessionStore/TokenCoordinator.d.ts +46 -0
- package/dist/src/stores/SessionStore/index.d.ts +3 -0
- package/dist/src/stores/SessionStore/types.d.ts +62 -0
- package/dist/src/stores/appStore.d.ts +10 -0
- package/dist/src/stores/sessionStore.d.ts +83 -0
- package/dist/src/stores/userStore.d.ts +14 -0
- package/dist/src/theme.d.ts +2 -0
- package/dist/src/utils/authFetch.d.ts +10 -0
- package/dist/src/utils/cookies-manager.d.ts +9 -0
- package/dist/src/utils/display.d.ts +14 -0
- package/dist/src/utils/fetch.d.ts +9 -0
- package/dist/src/utils/service-worker.d.ts +1 -0
- package/dist/src/utils/stores.d.ts +26 -0
- package/dist/src/utils/text.d.ts +1 -0
- package/dist/src/utils/validateRedirect.cy.d.ts +1 -0
- package/dist/src/utils/validateRedirect.d.ts +1 -0
- package/dist/src/version.d.ts +1 -1
- package/package.json +5 -2
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type CheckboxProps } from '@mui/material';
|
|
2
|
+
export interface StyledCheckboxProps extends CheckboxProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const UncheckedIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
5
|
+
export declare const CheckedIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>, {}, {}>;
|
|
6
|
+
export declare const StyledCheckbox: import("@emotion/styled").StyledComponent<CheckboxProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & StyledCheckboxProps, {}, {}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Radio';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type RadioProps } from '@mui/material';
|
|
2
|
+
export interface StyledRadioProps extends RadioProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const UncheckedIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
5
|
+
export declare const CheckedIcon: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>, {}, {}>;
|
|
6
|
+
export declare const StyledRadio: import("@emotion/styled").StyledComponent<RadioProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & StyledRadioProps, {}, {}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './RadioGroup';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type RadioGroupProps } from '@mui/material';
|
|
2
|
+
export interface StyledRadioGroupProps extends RadioGroupProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const StyledRadioGroup: import("@emotion/styled").StyledComponent<RadioGroupProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & StyledRadioGroupProps, {}, {}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default useAccess;
|
|
2
|
+
/**
|
|
3
|
+
* Hook for checking feature access based on features and permissions
|
|
4
|
+
* @param {string[]} features - Array of feature keys to check
|
|
5
|
+
* @param {{ extraPermissions?: string[], workplaceId?: string }} options - Additional options
|
|
6
|
+
* @returns {UseAccessResult}
|
|
7
|
+
*/
|
|
8
|
+
declare function useAccess(features?: string[], options?: {
|
|
9
|
+
extraPermissions?: string[];
|
|
10
|
+
workplaceId?: string;
|
|
11
|
+
}): UseAccessResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export default useModal;
|
|
2
|
+
declare function useModal(component: any, data: any, onClose: any): ((modalData: any) => any)[];
|
|
3
|
+
declare namespace useModal {
|
|
4
|
+
export { ModalContext };
|
|
5
|
+
export { ModalProvider };
|
|
6
|
+
}
|
|
7
|
+
import ModalContext from './ModalContext';
|
|
8
|
+
import ModalProvider from './ModalProvider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default usePermissions;
|
|
2
|
+
declare function usePermissions(): {
|
|
3
|
+
checkPermission: (permissionKey: any) => {
|
|
4
|
+
isAllowed: boolean;
|
|
5
|
+
denyReason: string | null;
|
|
6
|
+
};
|
|
7
|
+
checkPermissions: (permissionKeys: any) => {
|
|
8
|
+
allAllowed: boolean;
|
|
9
|
+
results: any;
|
|
10
|
+
deniedKeys: any;
|
|
11
|
+
};
|
|
12
|
+
permissionsMap: null;
|
|
13
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import i18n from 'i18next';
|
|
2
|
+
interface TranslationResources {
|
|
3
|
+
[lang: string]: {
|
|
4
|
+
translation?: Record<string, unknown>;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
declare const registerTranslations: (locales: TranslationResources) => void;
|
|
8
|
+
export { registerTranslations };
|
|
9
|
+
export default i18n;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,54 +1,36 @@
|
|
|
1
|
-
import { AccessBlocker } from
|
|
2
|
-
import { AccessGuard } from
|
|
3
|
-
import App from
|
|
4
|
-
import { Checkbox } from
|
|
5
|
-
import Container from
|
|
6
|
-
import { Radio } from
|
|
7
|
-
import { RadioGroup } from
|
|
8
|
-
import { sidePanelDefaultProps } from
|
|
9
|
-
import { withAccessGuard } from
|
|
10
|
-
import { getDisplayMode } from
|
|
11
|
-
import { updateParentHeaderTitle } from
|
|
12
|
-
import { resetParentHeaderTitle } from
|
|
13
|
-
import { updateParentHeaderLeadingText } from
|
|
14
|
-
import { resetParentHeaderLeadingText } from
|
|
15
|
-
import { updateParentHeaderStyles } from
|
|
16
|
-
import { resetParentHeaderContent } from
|
|
17
|
-
import { resetParentHeaderStyles } from
|
|
18
|
-
import { updateParentHeaderContent } from
|
|
19
|
-
import useAccess from
|
|
20
|
-
import { useHeaderContentEvent } from
|
|
21
|
-
import { useDisplay } from
|
|
22
|
-
import useFeatures from
|
|
23
|
-
import usePermissions from
|
|
24
|
-
import { useStore } from
|
|
25
|
-
import useLogin from
|
|
26
|
-
import useLoginStatus from
|
|
27
|
-
export function logout(): Promise<void>;
|
|
28
|
-
export function refreshUserData(): Promise<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
[k: string]: {
|
|
38
|
-
status: any;
|
|
39
|
-
entitlementType: any;
|
|
40
|
-
expiresAt: any;
|
|
41
|
-
daysSinceExpiry: any;
|
|
42
|
-
permissions: any;
|
|
43
|
-
} | null;
|
|
44
|
-
} | null;
|
|
45
|
-
featuresRequestsMap: {} | null;
|
|
46
|
-
} | null>;
|
|
47
|
-
export function setLocale(locale: any): Promise<import("i18next").TFunction<"translation", undefined>>;
|
|
48
|
-
export function getLocale(): string;
|
|
49
|
-
import toast from "react-hot-toast";
|
|
50
|
-
import { fetch } from "./app/utils/fetch";
|
|
51
|
-
import { registerServiceWorker } from "./app/utils/service-worker";
|
|
52
|
-
import { registerTranslations } from "./app/i18n";
|
|
53
|
-
import { captureException } from "@sentry/browser/build/npm/types-ts3.8/exports";
|
|
54
|
-
export { AccessBlocker, AccessGuard, App, Checkbox, Container, Radio, RadioGroup, sidePanelDefaultProps, withAccessGuard, getDisplayMode, updateParentHeaderTitle, resetParentHeaderTitle, updateParentHeaderLeadingText, resetParentHeaderLeadingText, updateParentHeaderStyles, resetParentHeaderContent, resetParentHeaderStyles, updateParentHeaderContent, useAccess, useHeaderContentEvent, useDisplay, useFeatures, usePermissions, useStore, useLogin, useLoginStatus, toast as notify, fetch, registerServiceWorker, registerTranslations, captureException };
|
|
1
|
+
import { AccessBlocker } from './components/access';
|
|
2
|
+
import { AccessGuard } from './components/access';
|
|
3
|
+
import App from './components/app';
|
|
4
|
+
import { Checkbox } from './core/ui/Checkbox';
|
|
5
|
+
import Container from './components/container';
|
|
6
|
+
import { Radio } from './core/ui/Radio';
|
|
7
|
+
import { RadioGroup } from './core/ui/RadioGroup';
|
|
8
|
+
import { sidePanelDefaultProps } from './components/sidePanel';
|
|
9
|
+
import { withAccessGuard } from './components/access';
|
|
10
|
+
import { getDisplayMode } from './utils/display';
|
|
11
|
+
import { updateParentHeaderTitle } from './utils/display';
|
|
12
|
+
import { resetParentHeaderTitle } from './utils/display';
|
|
13
|
+
import { updateParentHeaderLeadingText } from './utils/display';
|
|
14
|
+
import { resetParentHeaderLeadingText } from './utils/display';
|
|
15
|
+
import { updateParentHeaderStyles } from './utils/display';
|
|
16
|
+
import { resetParentHeaderContent } from './utils/display';
|
|
17
|
+
import { resetParentHeaderStyles } from './utils/display';
|
|
18
|
+
import { updateParentHeaderContent } from './utils/display';
|
|
19
|
+
import useAccess from './hooks/useAccess';
|
|
20
|
+
import { useHeaderContentEvent } from './hooks/useHeaderContentEvent';
|
|
21
|
+
import { useDisplay } from './providers/display';
|
|
22
|
+
import useFeatures from './hooks/useFeatures';
|
|
23
|
+
import usePermissions from './hooks/usePermissions';
|
|
24
|
+
import { useStore } from './providers/store';
|
|
25
|
+
import useLogin from './hooks/useLogin';
|
|
26
|
+
import useLoginStatus from './hooks/useLoginStatus';
|
|
27
|
+
export function logout(): Promise<void>;
|
|
28
|
+
export function refreshUserData(): Promise<import("./stores/SessionStore").UserData | null>;
|
|
29
|
+
export function setLocale(locale: any): Promise<import("i18next").TFunction<"translation", undefined>>;
|
|
30
|
+
export function getLocale(): string;
|
|
31
|
+
import toast from 'react-hot-toast';
|
|
32
|
+
import { fetch } from './utils/authFetch';
|
|
33
|
+
import { registerServiceWorker } from './utils/service-worker';
|
|
34
|
+
import { registerTranslations } from './i18n';
|
|
35
|
+
import { captureException } from '@sentry/react';
|
|
36
|
+
export { AccessBlocker, AccessGuard, App, Checkbox, Container, Radio, RadioGroup, sidePanelDefaultProps, withAccessGuard, getDisplayMode, updateParentHeaderTitle, resetParentHeaderTitle, updateParentHeaderLeadingText, resetParentHeaderLeadingText, updateParentHeaderStyles, resetParentHeaderContent, resetParentHeaderStyles, updateParentHeaderContent, useAccess, useHeaderContentEvent, useDisplay, useFeatures, usePermissions, useStore, useLogin, useLoginStatus, toast as notify, fetch, registerServiceWorker, registerTranslations, captureException };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default ErrorPage;
|
|
2
|
+
declare function ErrorPage({ error, appVersion, apiVersion }: {
|
|
3
|
+
error: any;
|
|
4
|
+
appVersion: any;
|
|
5
|
+
apiVersion: any;
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
declare namespace ErrorPage {
|
|
8
|
+
namespace propTypes {
|
|
9
|
+
let error: any;
|
|
10
|
+
let componentStack: any;
|
|
11
|
+
}
|
|
12
|
+
let defaultProps: {};
|
|
13
|
+
}
|
|
14
|
+
import React from 'react';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
({ redirectPath }: {
|
|
3
|
+
redirectPath: any;
|
|
4
|
+
}): React.JSX.Element;
|
|
5
|
+
propTypes: {
|
|
6
|
+
redirectPath: any;
|
|
7
|
+
};
|
|
8
|
+
defaultProps: {
|
|
9
|
+
redirectPath: string;
|
|
10
|
+
};
|
|
11
|
+
} & {
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
15
|
+
import React from 'react';
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
export namespace rootStore {
|
|
2
|
+
export { sessionStore };
|
|
3
|
+
}
|
|
4
|
+
export const StoreContext: React.Context<{
|
|
5
|
+
sessionStore: {
|
|
6
|
+
loading: boolean;
|
|
7
|
+
loginStatus: {
|
|
8
|
+
status: string;
|
|
9
|
+
};
|
|
10
|
+
refreshTokenPromise: null;
|
|
11
|
+
api: {
|
|
12
|
+
setAuthConfig({ baseUrl, clientId, redirectUri }: {
|
|
13
|
+
baseUrl: any;
|
|
14
|
+
clientId: any;
|
|
15
|
+
redirectUri: any;
|
|
16
|
+
}): void;
|
|
17
|
+
baseUrl: any;
|
|
18
|
+
clientId: any;
|
|
19
|
+
redirectUri: any;
|
|
20
|
+
authorize(credentials: any): Promise<undefined>;
|
|
21
|
+
getUserData(authData: any): Promise<{
|
|
22
|
+
id: any;
|
|
23
|
+
companyId: any;
|
|
24
|
+
roleId: any;
|
|
25
|
+
username: any;
|
|
26
|
+
email: any;
|
|
27
|
+
name: any;
|
|
28
|
+
permissionsMap: any;
|
|
29
|
+
featuresMap: {
|
|
30
|
+
[k: string]: {
|
|
31
|
+
status: any;
|
|
32
|
+
entitlementType: any;
|
|
33
|
+
expiresAt: any;
|
|
34
|
+
daysSinceExpiry: any;
|
|
35
|
+
permissions: any;
|
|
36
|
+
} | null;
|
|
37
|
+
} | null;
|
|
38
|
+
featuresRequestsMap: {} | null;
|
|
39
|
+
} | null>;
|
|
40
|
+
signOut(token: any): Promise<void>;
|
|
41
|
+
};
|
|
42
|
+
networkError: any;
|
|
43
|
+
setLoading(value: any): void;
|
|
44
|
+
setConnectedLoginStatus(): void;
|
|
45
|
+
setNotAuthorizedLoginStatus(): void;
|
|
46
|
+
setAuthConfig(config: any): void;
|
|
47
|
+
setNetworkError(value: any): void;
|
|
48
|
+
isLoggedIn(): boolean;
|
|
49
|
+
requestHeaders(): {
|
|
50
|
+
'Accept-Language': string;
|
|
51
|
+
} | {
|
|
52
|
+
Authorization: string;
|
|
53
|
+
'Accept-Language': string;
|
|
54
|
+
};
|
|
55
|
+
authorize(credentials: any, storeSession?: boolean): Promise<null>;
|
|
56
|
+
session: any;
|
|
57
|
+
refresh(): Promise<null>;
|
|
58
|
+
recover(): Promise<void>;
|
|
59
|
+
logout(): Promise<void>;
|
|
60
|
+
refreshUserData(): Promise<{
|
|
61
|
+
id: any;
|
|
62
|
+
companyId: any;
|
|
63
|
+
roleId: any;
|
|
64
|
+
username: any;
|
|
65
|
+
email: any;
|
|
66
|
+
name: any;
|
|
67
|
+
permissionsMap: any;
|
|
68
|
+
featuresMap: {
|
|
69
|
+
[k: string]: {
|
|
70
|
+
status: any;
|
|
71
|
+
entitlementType: any;
|
|
72
|
+
expiresAt: any;
|
|
73
|
+
daysSinceExpiry: any;
|
|
74
|
+
permissions: any;
|
|
75
|
+
} | null;
|
|
76
|
+
} | null;
|
|
77
|
+
featuresRequestsMap: {} | null;
|
|
78
|
+
} | null>;
|
|
79
|
+
storeSession(): Promise<void>;
|
|
80
|
+
restoreSession(): Promise<void>;
|
|
81
|
+
removeSession(): void;
|
|
82
|
+
setCurrentUser(user: any): void;
|
|
83
|
+
removeCurrentUser(): void;
|
|
84
|
+
};
|
|
85
|
+
}>;
|
|
86
|
+
export const StoreProvider: React.FunctionComponent<object>;
|
|
87
|
+
export function useStore(): {
|
|
88
|
+
sessionStore: {
|
|
89
|
+
loading: boolean;
|
|
90
|
+
loginStatus: {
|
|
91
|
+
status: string;
|
|
92
|
+
};
|
|
93
|
+
refreshTokenPromise: null;
|
|
94
|
+
api: {
|
|
95
|
+
setAuthConfig({ baseUrl, clientId, redirectUri }: {
|
|
96
|
+
baseUrl: any;
|
|
97
|
+
clientId: any;
|
|
98
|
+
redirectUri: any;
|
|
99
|
+
}): void;
|
|
100
|
+
baseUrl: any;
|
|
101
|
+
clientId: any;
|
|
102
|
+
redirectUri: any;
|
|
103
|
+
authorize(credentials: any): Promise<undefined>;
|
|
104
|
+
getUserData(authData: any): Promise<{
|
|
105
|
+
id: any;
|
|
106
|
+
companyId: any;
|
|
107
|
+
roleId: any;
|
|
108
|
+
username: any;
|
|
109
|
+
email: any;
|
|
110
|
+
name: any;
|
|
111
|
+
permissionsMap: any;
|
|
112
|
+
featuresMap: {
|
|
113
|
+
[k: string]: {
|
|
114
|
+
status: any;
|
|
115
|
+
entitlementType: any;
|
|
116
|
+
expiresAt: any;
|
|
117
|
+
daysSinceExpiry: any;
|
|
118
|
+
permissions: any;
|
|
119
|
+
} | null;
|
|
120
|
+
} | null;
|
|
121
|
+
featuresRequestsMap: {} | null;
|
|
122
|
+
} | null>;
|
|
123
|
+
signOut(token: any): Promise<void>;
|
|
124
|
+
};
|
|
125
|
+
networkError: any;
|
|
126
|
+
setLoading(value: any): void;
|
|
127
|
+
setConnectedLoginStatus(): void;
|
|
128
|
+
setNotAuthorizedLoginStatus(): void;
|
|
129
|
+
setAuthConfig(config: any): void;
|
|
130
|
+
setNetworkError(value: any): void;
|
|
131
|
+
isLoggedIn(): boolean;
|
|
132
|
+
requestHeaders(): {
|
|
133
|
+
'Accept-Language': string;
|
|
134
|
+
} | {
|
|
135
|
+
Authorization: string;
|
|
136
|
+
'Accept-Language': string;
|
|
137
|
+
};
|
|
138
|
+
authorize(credentials: any, storeSession?: boolean): Promise<null>;
|
|
139
|
+
session: any;
|
|
140
|
+
refresh(): Promise<null>;
|
|
141
|
+
recover(): Promise<void>;
|
|
142
|
+
logout(): Promise<void>;
|
|
143
|
+
refreshUserData(): Promise<{
|
|
144
|
+
id: any;
|
|
145
|
+
companyId: any;
|
|
146
|
+
roleId: any;
|
|
147
|
+
username: any;
|
|
148
|
+
email: any;
|
|
149
|
+
name: any;
|
|
150
|
+
permissionsMap: any;
|
|
151
|
+
featuresMap: {
|
|
152
|
+
[k: string]: {
|
|
153
|
+
status: any;
|
|
154
|
+
entitlementType: any;
|
|
155
|
+
expiresAt: any;
|
|
156
|
+
daysSinceExpiry: any;
|
|
157
|
+
permissions: any;
|
|
158
|
+
} | null;
|
|
159
|
+
} | null;
|
|
160
|
+
featuresRequestsMap: {} | null;
|
|
161
|
+
} | null>;
|
|
162
|
+
storeSession(): Promise<void>;
|
|
163
|
+
restoreSession(): Promise<void>;
|
|
164
|
+
removeSession(): void;
|
|
165
|
+
setCurrentUser(user: any): void;
|
|
166
|
+
removeCurrentUser(): void;
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
export default rootStore;
|
|
170
|
+
import sessionStore from '../stores/sessionStore';
|
|
171
|
+
import React from 'react';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function register(config: any): void;
|
|
2
|
-
export function unregister(): void;
|
|
1
|
+
export function register(config: any): void;
|
|
2
|
+
export function unregister(): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CookieData } from './types';
|
|
2
|
+
export declare class CookiesManager {
|
|
3
|
+
private static rootDomain;
|
|
4
|
+
static recognizeRootDomain(): string;
|
|
5
|
+
static get(key: string): string | undefined;
|
|
6
|
+
static set(key: string, value: string): void;
|
|
7
|
+
static remove(key: string): void;
|
|
8
|
+
static getAuthData(): CookieData | null;
|
|
9
|
+
static setAuthData(data: CookieData): void;
|
|
10
|
+
static removeAuthData(): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { LoginStatus, Session, UserData } from './types';
|
|
2
|
+
interface AuthConfig {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
clientId: string;
|
|
5
|
+
redirectUri: string;
|
|
6
|
+
}
|
|
7
|
+
interface Credentials {
|
|
8
|
+
scope?: string;
|
|
9
|
+
refresh?: string;
|
|
10
|
+
code?: string;
|
|
11
|
+
username?: string;
|
|
12
|
+
password?: string;
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
}
|
|
15
|
+
declare class SessionAPI {
|
|
16
|
+
baseUrl: string;
|
|
17
|
+
clientId: string;
|
|
18
|
+
redirectUri: string;
|
|
19
|
+
setAuthConfig({ baseUrl, clientId, redirectUri }: AuthConfig): void;
|
|
20
|
+
authorize(credentials: Credentials): Promise<Session | null>;
|
|
21
|
+
getUserData(authData?: {
|
|
22
|
+
token_type: string;
|
|
23
|
+
access_token: string;
|
|
24
|
+
}): Promise<UserData | null>;
|
|
25
|
+
signOut(token: string): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
declare class SessionStore {
|
|
28
|
+
loading: boolean;
|
|
29
|
+
loginStatus: LoginStatus;
|
|
30
|
+
session: Session | null;
|
|
31
|
+
api: SessionAPI;
|
|
32
|
+
networkError: {
|
|
33
|
+
title: string;
|
|
34
|
+
details: string;
|
|
35
|
+
} | null;
|
|
36
|
+
refreshTokenPromise: Promise<Session | null> | null;
|
|
37
|
+
constructor();
|
|
38
|
+
setLoading(value: boolean): void;
|
|
39
|
+
setConnectedLoginStatus(): void;
|
|
40
|
+
setNotAuthorizedLoginStatus(): void;
|
|
41
|
+
setAuthConfig(config: AuthConfig): void;
|
|
42
|
+
setNetworkError(value: {
|
|
43
|
+
title: string;
|
|
44
|
+
details: string;
|
|
45
|
+
} | null): void;
|
|
46
|
+
isLoggedIn(): boolean;
|
|
47
|
+
requestHeaders(): Record<string, string>;
|
|
48
|
+
authorize(credentials: Credentials, storeSession?: boolean): Promise<Session | null>;
|
|
49
|
+
refresh(): Promise<Session | null>;
|
|
50
|
+
recover(): Promise<void>;
|
|
51
|
+
logout(): Promise<void>;
|
|
52
|
+
refreshUserData(): Promise<UserData | null>;
|
|
53
|
+
storeSession(): void;
|
|
54
|
+
restoreSession(): Promise<void>;
|
|
55
|
+
removeSession(): void;
|
|
56
|
+
setCurrentUser(user: UserData | null): void;
|
|
57
|
+
removeCurrentUser(): void;
|
|
58
|
+
}
|
|
59
|
+
declare const sessionStore: SessionStore;
|
|
60
|
+
export default sessionStore;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Session } from './types';
|
|
2
|
+
interface SessionStoreRef {
|
|
3
|
+
session: Session | null;
|
|
4
|
+
api: {
|
|
5
|
+
authorize: (credentials: Record<string, unknown>) => Promise<Session | null>;
|
|
6
|
+
};
|
|
7
|
+
storeSession: () => void;
|
|
8
|
+
setConnectedLoginStatus: () => void;
|
|
9
|
+
removeSession: () => void;
|
|
10
|
+
removeCurrentUser: () => void;
|
|
11
|
+
setNotAuthorizedLoginStatus: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare class TokenCoordinator {
|
|
14
|
+
private refreshPromise;
|
|
15
|
+
private refreshTimer;
|
|
16
|
+
private broadcastChannel;
|
|
17
|
+
private store;
|
|
18
|
+
private onLogout;
|
|
19
|
+
private requestQueue;
|
|
20
|
+
private authFetchFn;
|
|
21
|
+
init(store: SessionStoreRef, onLogout: () => void): void;
|
|
22
|
+
setAuthFetch(fn: (url: string, options: RequestInit) => Promise<Response>): void;
|
|
23
|
+
private initBroadcastChannel;
|
|
24
|
+
private handleBroadcast;
|
|
25
|
+
private handleTokenRefreshedBroadcast;
|
|
26
|
+
private handleLogoutBroadcast;
|
|
27
|
+
private initVisibilityListener;
|
|
28
|
+
refresh(): Promise<Session | null>;
|
|
29
|
+
isRefreshing(): boolean;
|
|
30
|
+
private doRefresh;
|
|
31
|
+
private refreshWithLock;
|
|
32
|
+
private executeRefresh;
|
|
33
|
+
private refreshWithRetry;
|
|
34
|
+
handleUnauthorized(url: string, options: RequestInit): Promise<Response>;
|
|
35
|
+
private enqueue;
|
|
36
|
+
private replayQueue;
|
|
37
|
+
private rejectQueue;
|
|
38
|
+
scheduleProactiveRefresh(): void;
|
|
39
|
+
private clearRefreshTimer;
|
|
40
|
+
private broadcast;
|
|
41
|
+
broadcastLogout(): void;
|
|
42
|
+
private triggerLogout;
|
|
43
|
+
dispose(): void;
|
|
44
|
+
}
|
|
45
|
+
export declare const tokenCoordinator: TokenCoordinator;
|
|
46
|
+
export {};
|