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.
Files changed (105) hide show
  1. package/dist/andoncloud-sdk.js +4 -4
  2. package/dist/andoncloud-sdk.js.map +1 -1
  3. package/dist/cypress/support/component.d.ts +9 -12
  4. package/dist/cypress.config.d.ts +2 -3
  5. package/dist/index.d.ts +9 -3
  6. package/dist/src/__tests__/loginWithPassword.cy.d.ts +1 -0
  7. package/dist/src/assets/index.d.ts +1 -1
  8. package/dist/src/components/Header/Header.cy.d.ts +1 -0
  9. package/dist/src/components/Header/Header.d.ts +3 -0
  10. package/dist/src/components/Header/index.d.ts +1 -0
  11. package/dist/src/components/Header/styles.d.ts +11 -0
  12. package/dist/src/components/Header/types.d.ts +52 -0
  13. package/dist/src/components/access/AccessBlocker.cy.d.ts +1 -0
  14. package/dist/src/components/access/AccessBlocker.d.ts +12 -0
  15. package/dist/src/components/access/AccessBlocker.styles.d.ts +34 -0
  16. package/dist/src/components/access/AccessGuard.cy.d.ts +1 -0
  17. package/dist/src/components/access/AccessGuard.d.ts +9 -0
  18. package/dist/src/components/access/AccessRequestModal.cy.d.ts +1 -0
  19. package/dist/src/components/access/AccessRequestModal.d.ts +8 -0
  20. package/dist/src/components/access/AccessRequestModal.styles.d.ts +31 -0
  21. package/dist/src/components/access/CooldownModal.cy.d.ts +1 -0
  22. package/dist/src/components/access/CooldownModal.d.ts +7 -0
  23. package/dist/src/components/access/CooldownModal.styles.d.ts +30 -0
  24. package/dist/src/components/access/index.d.ts +3 -0
  25. package/dist/src/components/access/withAccessGuard.cy.d.ts +1 -0
  26. package/dist/src/components/access/withAccessGuard.d.ts +6 -0
  27. package/dist/src/components/app.d.ts +3 -0
  28. package/dist/src/components/authRedirect.cy.d.ts +1 -0
  29. package/dist/src/components/authRedirect.d.ts +3 -0
  30. package/dist/src/components/container.cy.d.ts +1 -0
  31. package/dist/src/components/container.d.ts +44 -0
  32. package/dist/src/components/container.styles.d.ts +20 -0
  33. package/dist/src/components/externalContent.d.ts +5 -0
  34. package/dist/src/components/footer.d.ts +6 -0
  35. package/dist/src/components/iframeNavigation.d.ts +2 -0
  36. package/dist/src/components/loader.d.ts +6 -0
  37. package/dist/src/components/loginForm.cy.d.ts +1 -0
  38. package/dist/src/components/loginForm.d.ts +29 -0
  39. package/dist/src/components/loginModal.cy.d.ts +1 -0
  40. package/dist/src/components/loginModal.d.ts +16 -0
  41. package/dist/src/components/loginRedirect.d.ts +3 -0
  42. package/dist/src/components/networkError.d.ts +4 -0
  43. package/dist/src/components/router.d.ts +5 -0
  44. package/dist/src/components/sidePanel.d.ts +66 -0
  45. package/dist/src/components/sidePanel.styles.d.ts +15 -0
  46. package/dist/src/components/sidebarMenu.d.ts +32 -0
  47. package/dist/src/components/sidebarMenu.styles.d.ts +32 -0
  48. package/dist/src/core/ui/Checkbox/Checkbox.d.ts +6 -0
  49. package/dist/src/core/ui/Checkbox/index.d.ts +1 -0
  50. package/dist/src/core/ui/Checkbox/styled.d.ts +6 -0
  51. package/dist/src/core/ui/Radio/Radio.d.ts +6 -0
  52. package/dist/src/core/ui/Radio/index.d.ts +1 -0
  53. package/dist/src/core/ui/Radio/styled.d.ts +6 -0
  54. package/dist/src/core/ui/RadioGroup/RadioGroup.d.ts +6 -0
  55. package/dist/src/core/ui/RadioGroup/index.d.ts +1 -0
  56. package/dist/src/core/ui/RadioGroup/styled.d.ts +4 -0
  57. package/dist/src/hooks/useAccess/accessState.d.ts +7 -0
  58. package/dist/src/hooks/useAccess/deriveButtons.d.ts +5 -0
  59. package/dist/src/hooks/useAccess/index.d.ts +11 -0
  60. package/dist/src/hooks/useAccess.cy.d.ts +1 -0
  61. package/dist/src/hooks/useFeatures.cy.d.ts +1 -0
  62. package/dist/src/hooks/useFeatures.d.ts +6 -0
  63. package/dist/src/hooks/useHeaderContentEvent.cy.d.ts +1 -0
  64. package/dist/src/hooks/useHeaderContentEvent.d.ts +3 -0
  65. package/dist/src/hooks/useLogin.d.ts +2 -0
  66. package/dist/src/hooks/useLoginStatus.d.ts +3 -0
  67. package/dist/src/hooks/useModalHook/ModalContext.d.ts +7 -0
  68. package/dist/src/hooks/useModalHook/ModalProvider.d.ts +5 -0
  69. package/dist/src/hooks/useModalHook/index.d.ts +3 -0
  70. package/dist/src/hooks/useModalHook/useModal.d.ts +8 -0
  71. package/dist/src/hooks/usePermissions.cy.d.ts +1 -0
  72. package/dist/src/hooks/usePermissions.d.ts +13 -0
  73. package/dist/src/hooks/useQueryParams.d.ts +2 -0
  74. package/dist/src/i18n.d.ts +9 -0
  75. package/dist/src/index.d.ts +36 -54
  76. package/dist/src/pages/ErrorPage.d.ts +14 -0
  77. package/dist/src/pages/LoaderPage.d.ts +7 -0
  78. package/dist/src/pages/LoginPage.d.ts +15 -0
  79. package/dist/src/providers/authConfig.d.ts +6 -0
  80. package/dist/src/providers/display.d.ts +5 -0
  81. package/dist/src/providers/metaInfo.d.ts +6 -0
  82. package/dist/src/providers/store.d.ts +171 -0
  83. package/dist/src/serviceWorkerRegistration.d.ts +2 -2
  84. package/dist/src/stores/SessionStore/CookiesManager.d.ts +11 -0
  85. package/dist/src/stores/SessionStore/SessionStore.cy.d.ts +1 -0
  86. package/dist/src/stores/SessionStore/SessionStore.d.ts +60 -0
  87. package/dist/src/stores/SessionStore/TokenCoordinator.cy.d.ts +1 -0
  88. package/dist/src/stores/SessionStore/TokenCoordinator.d.ts +46 -0
  89. package/dist/src/stores/SessionStore/index.d.ts +3 -0
  90. package/dist/src/stores/SessionStore/types.d.ts +62 -0
  91. package/dist/src/stores/appStore.d.ts +10 -0
  92. package/dist/src/stores/sessionStore.d.ts +83 -0
  93. package/dist/src/stores/userStore.d.ts +14 -0
  94. package/dist/src/theme.d.ts +2 -0
  95. package/dist/src/utils/authFetch.d.ts +10 -0
  96. package/dist/src/utils/cookies-manager.d.ts +9 -0
  97. package/dist/src/utils/display.d.ts +14 -0
  98. package/dist/src/utils/fetch.d.ts +9 -0
  99. package/dist/src/utils/service-worker.d.ts +1 -0
  100. package/dist/src/utils/stores.d.ts +26 -0
  101. package/dist/src/utils/text.d.ts +1 -0
  102. package/dist/src/utils/validateRedirect.cy.d.ts +1 -0
  103. package/dist/src/utils/validateRedirect.d.ts +1 -0
  104. package/dist/src/version.d.ts +1 -1
  105. 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,6 @@
1
+ import React from 'react';
2
+ import { type StyledRadioProps } from './styled';
3
+ export interface RadioProps extends Partial<StyledRadioProps> {
4
+ 'data-testid'?: string;
5
+ }
6
+ export declare const Radio: React.FC<RadioProps>;
@@ -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,6 @@
1
+ import React from 'react';
2
+ import { type StyledRadioGroupProps } from './styled';
3
+ export interface RadioGroupProps extends Partial<StyledRadioGroupProps> {
4
+ 'data-testid'?: string;
5
+ }
6
+ export declare const RadioGroup: React.FC<RadioGroupProps>;
@@ -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,7 @@
1
+ export function getAccessState(status: string): "accessible" | "no_permission" | "expired" | "not_purchased";
2
+ export namespace ACCESS_STATE_PRIORITY {
3
+ let no_permission: number;
4
+ let expired: number;
5
+ let not_purchased: number;
6
+ let accessible: number;
7
+ }
@@ -0,0 +1,5 @@
1
+ export function deriveButtons(status: string, daysSinceExpiry: number | null): Array<{
2
+ action: string;
3
+ requestType: string | null;
4
+ variant: "primary" | "secondary" | "link";
5
+ }>;
@@ -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,6 @@
1
+ export default useFeatures;
2
+ declare function useFeatures(): {
3
+ getFeature: (featureKey: any) => null;
4
+ getFeatures: (featureKeys: any) => any;
5
+ featuresMap: null;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ type ContentEventHandler = (event: string, payload?: unknown) => void;
2
+ export declare const useHeaderContentEvent: (handler: ContentEventHandler) => void;
3
+ export {};
@@ -0,0 +1,2 @@
1
+ export default useLogin;
2
+ declare function useLogin(scope: any, loginProps?: {}): () => void;
@@ -0,0 +1,3 @@
1
+ import { LoginStatus } from '../stores/SessionStore/types';
2
+ declare const useLoginStatus: () => LoginStatus;
3
+ export default useLoginStatus;
@@ -0,0 +1,7 @@
1
+ export default ModalContext;
2
+ declare const ModalContext: React.Context<{
3
+ showModal: null;
4
+ hideModal: null;
5
+ isOpenedModal: boolean;
6
+ }>;
7
+ import React from 'react';
@@ -0,0 +1,5 @@
1
+ export default ModalProvider;
2
+ declare function ModalProvider({ children }: {
3
+ children: any;
4
+ }): React.JSX.Element;
5
+ import React from 'react';
@@ -0,0 +1,3 @@
1
+ export { default as ModalContext } from "./ModalContext";
2
+ export { default as ModalProvider } from "./ModalProvider";
3
+ export { default as useModal } from "./useModal";
@@ -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,2 @@
1
+ export default useQueryParams;
2
+ declare function useQueryParams(): URLSearchParams;
@@ -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;
@@ -1,54 +1,36 @@
1
- import { AccessBlocker } from "./app/components/access";
2
- import { AccessGuard } from "./app/components/access";
3
- import App from "./app/components/app";
4
- import { Checkbox } from "./app/core/ui/Checkbox/Checkbox";
5
- import Container from "./app/components/container";
6
- import { Radio } from "./app/core/ui/Radio/Radio";
7
- import { RadioGroup } from "./app/core/ui/RadioGroup/RadioGroup";
8
- import { sidePanelDefaultProps } from "./app/components/sidePanel";
9
- import { withAccessGuard } from "./app/components/access";
10
- import { getDisplayMode } from "./app/utils/display";
11
- import { updateParentHeaderTitle } from "./app/utils/display";
12
- import { resetParentHeaderTitle } from "./app/utils/display";
13
- import { updateParentHeaderLeadingText } from "./app/utils/display";
14
- import { resetParentHeaderLeadingText } from "./app/utils/display";
15
- import { updateParentHeaderStyles } from "./app/utils/display";
16
- import { resetParentHeaderContent } from "./app/utils/display";
17
- import { resetParentHeaderStyles } from "./app/utils/display";
18
- import { updateParentHeaderContent } from "./app/utils/display";
19
- import useAccess from "./app/hooks/useAccess";
20
- import { useHeaderContentEvent } from "./app/hooks/useHeaderContentEvent";
21
- import { useDisplay } from "./app/providers/display";
22
- import useFeatures from "./app/hooks/useFeatures";
23
- import usePermissions from "./app/hooks/usePermissions";
24
- import { useStore } from "./app/providers/store";
25
- import useLogin from "./app/hooks/useLogin";
26
- import useLoginStatus from "./app/hooks/useLoginStatus";
27
- export function logout(): Promise<void>;
28
- export function refreshUserData(): Promise<{
29
- id: any;
30
- companyId: any;
31
- roleId: any;
32
- username: any;
33
- email: any;
34
- name: any;
35
- permissionsMap: any;
36
- featuresMap: {
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,7 @@
1
+ export default LoaderPage;
2
+ declare function LoaderPage(): React.JSX.Element;
3
+ declare namespace LoaderPage {
4
+ let propTypes: {};
5
+ let defaultProps: {};
6
+ }
7
+ 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,6 @@
1
+ export function AuthConfigProvider({ children, config }: {
2
+ children: any;
3
+ config: any;
4
+ }): React.JSX.Element;
5
+ export function useAuthConfig(): any;
6
+ import React from 'react';
@@ -0,0 +1,5 @@
1
+ export function DisplayProvider({ children }: {
2
+ children: any;
3
+ }): React.JSX.Element;
4
+ export function useDisplay(): any;
5
+ import React from 'react';
@@ -0,0 +1,6 @@
1
+ export function MetaInfoProvider({ children, info }: {
2
+ children: any;
3
+ info: any;
4
+ }): React.JSX.Element;
5
+ export function useMetaInfo(): any;
6
+ 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,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 {};
@@ -0,0 +1,3 @@
1
+ export { default } from './SessionStore';
2
+ export { TokenCoordinator, tokenCoordinator } from './TokenCoordinator';
3
+ export type { AuthEvent, AuthEventType, CookieData, LoginFormValidation, LoginStatus, QueuedRequest, Session, UserData, } from './types';