andoncloud-sdk 1.7.14 → 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,62 @@
1
+ export interface Session {
2
+ user: UserData | null;
3
+ accessToken: string;
4
+ refreshToken: string;
5
+ tokenType: string;
6
+ createdAt: number;
7
+ expiresIn: number;
8
+ }
9
+ export interface UserData {
10
+ id: number;
11
+ companyId: number;
12
+ roleId: number;
13
+ username: string;
14
+ email: string;
15
+ name: string;
16
+ permissionsMap: Record<string, string> | null;
17
+ featuresMap: Record<string, FeatureInfo | null> | null;
18
+ featuresRequestsMap: Record<string, unknown> | null;
19
+ [key: string]: unknown;
20
+ }
21
+ export interface FeatureInfo {
22
+ status: string;
23
+ entitlementType: string;
24
+ expiresAt: string | null;
25
+ daysSinceExpiry: number | null;
26
+ permissions: string[];
27
+ }
28
+ export interface QueuedRequest {
29
+ resolve: (value: Response) => void;
30
+ reject: (reason: Error) => void;
31
+ url: string;
32
+ options: RequestInit;
33
+ }
34
+ export type AuthEventType = 'TOKEN_REFRESHED' | 'LOGOUT';
35
+ export interface AuthEvent {
36
+ type: AuthEventType;
37
+ }
38
+ export interface CookieOptions {
39
+ domain: string;
40
+ secure: boolean;
41
+ sameSite: 'lax';
42
+ expires: number;
43
+ }
44
+ export interface CookieData {
45
+ 'access-token': string;
46
+ 'refresh-token': string;
47
+ 'token-type': string;
48
+ 'created-at': number;
49
+ 'expires-in': number;
50
+ }
51
+ export interface LoginFormValidation {
52
+ usernameError: string | null;
53
+ passwordError: string | null;
54
+ }
55
+ export interface LoginStatus {
56
+ status: 'connected' | 'not_authorized' | 'unknown';
57
+ authResponse?: {
58
+ accessToken: string;
59
+ tokenType: string;
60
+ user: UserData;
61
+ };
62
+ }
@@ -0,0 +1,10 @@
1
+ declare const _default: AppStore;
2
+ export default _default;
3
+ declare class AppStore {
4
+ appReady: boolean;
5
+ gtmReady: boolean;
6
+ sentryReady: boolean;
7
+ setAppReady(): void;
8
+ setGtmReady(): void;
9
+ setSentryReady(): void;
10
+ }
@@ -0,0 +1,83 @@
1
+ export default sessionStore;
2
+ declare const sessionStore: SessionStore;
3
+ declare class SessionStore {
4
+ loading: boolean;
5
+ loginStatus: {
6
+ status: string;
7
+ };
8
+ refreshTokenPromise: null;
9
+ api: SessionAPI;
10
+ networkError: any;
11
+ setLoading(value: any): void;
12
+ setConnectedLoginStatus(): void;
13
+ setNotAuthorizedLoginStatus(): void;
14
+ setAuthConfig(config: any): void;
15
+ setNetworkError(value: any): void;
16
+ isLoggedIn(): boolean;
17
+ requestHeaders(): {
18
+ 'Accept-Language': string;
19
+ } | {
20
+ Authorization: string;
21
+ 'Accept-Language': string;
22
+ };
23
+ authorize(credentials: any, storeSession?: boolean): Promise<null>;
24
+ session: any;
25
+ refresh(): Promise<null>;
26
+ recover(): Promise<void>;
27
+ logout(): Promise<void>;
28
+ 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
+ storeSession(): Promise<void>;
48
+ restoreSession(): Promise<void>;
49
+ removeSession(): void;
50
+ setCurrentUser(user: any): void;
51
+ removeCurrentUser(): void;
52
+ }
53
+ declare class SessionAPI {
54
+ setAuthConfig({ baseUrl, clientId, redirectUri }: {
55
+ baseUrl: any;
56
+ clientId: any;
57
+ redirectUri: any;
58
+ }): void;
59
+ baseUrl: any;
60
+ clientId: any;
61
+ redirectUri: any;
62
+ authorize(credentials: any): Promise<undefined>;
63
+ getUserData(authData: any): Promise<{
64
+ id: any;
65
+ companyId: any;
66
+ roleId: any;
67
+ username: any;
68
+ email: any;
69
+ name: any;
70
+ permissionsMap: any;
71
+ featuresMap: {
72
+ [k: string]: {
73
+ status: any;
74
+ entitlementType: any;
75
+ expiresAt: any;
76
+ daysSinceExpiry: any;
77
+ permissions: any;
78
+ } | null;
79
+ } | null;
80
+ featuresRequestsMap: {} | null;
81
+ } | null>;
82
+ signOut(token: any): Promise<void>;
83
+ }
@@ -0,0 +1,14 @@
1
+ declare const _default: UserStore;
2
+ export default _default;
3
+ declare class UserStore {
4
+ currentUser: null;
5
+ permissionsMap: null;
6
+ featuresMap: null;
7
+ featuresRequestsMap: null;
8
+ setCurrentUser(currentUser: any): void;
9
+ removeCurrentUser(): void;
10
+ setPermissionsMap(permissionsMap: any): void;
11
+ setFeaturesMap(featuresMap: any): void;
12
+ setFeaturesRequestsMap(featuresRequestsMap: any): void;
13
+ get getCurrentUserJS(): null;
14
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@mui/material/styles").Theme;
2
+ export default _default;
@@ -0,0 +1,10 @@
1
+ declare class AuthFetch {
2
+ callback: () => void;
3
+ constructor();
4
+ setCallback(callback: () => void): void;
5
+ removeCallback(): void;
6
+ }
7
+ declare const authFetchInstance: AuthFetch;
8
+ declare function authFetch(url: string, options?: Record<string, unknown>): Promise<Response | undefined>;
9
+ export default authFetchInstance;
10
+ export { authFetch as fetch };
@@ -0,0 +1,9 @@
1
+ export default class CookiesManager {
2
+ static rootDomain: any;
3
+ static recognizeRootDomain(): any;
4
+ static get(key: any): string & {
5
+ [key: string]: string;
6
+ };
7
+ static set(key: any, value: any): string | undefined;
8
+ static remove(key: any): void;
9
+ }
@@ -0,0 +1,14 @@
1
+ export function isTrustedOrigin(origin: any): boolean;
2
+ export function getDisplayMode(): "standalone" | "iframe";
3
+ export function postToParent(message: any): void;
4
+ export function updateParentHeaderLeadingText(text: any): void;
5
+ export function resetParentHeaderLeadingText(): void;
6
+ export function updateParentHeaderTitle(title: any): void;
7
+ export function resetParentHeaderTitle(): void;
8
+ export function updateParentHeaderStyles({ target, styles }: {
9
+ target: any;
10
+ styles: any;
11
+ }): void;
12
+ export function resetParentHeaderStyles(target: any): void;
13
+ export function updateParentHeaderContent(descriptor: any): void;
14
+ export function resetParentHeaderContent(): void;
@@ -0,0 +1,9 @@
1
+ export default andoncloudFetch;
2
+ export { acFetch as fetch };
3
+ declare const andoncloudFetch: AndoncloudFetch;
4
+ declare function acFetch(url: any, options?: {}): Promise<void | Response>;
5
+ declare class AndoncloudFetch {
6
+ callback: () => void;
7
+ setCallback(callback: any): void;
8
+ removeCallback(): void;
9
+ }
@@ -0,0 +1 @@
1
+ export function registerServiceWorker(config: any): void;
@@ -0,0 +1,26 @@
1
+ import { FeatureInfo } from '../stores/SessionStore/types';
2
+ interface RawFeatureInfo {
3
+ status: string;
4
+ entitlement_type: string;
5
+ expires_at: string | null;
6
+ days_since_expiry: number | null;
7
+ permissions: string[];
8
+ }
9
+ interface RawRequestInfo {
10
+ last_requested_at: string;
11
+ days_remaining: number;
12
+ }
13
+ interface CooldownStatus {
14
+ isInCooldown: boolean;
15
+ daysRemaining: number;
16
+ }
17
+ interface AccessButton {
18
+ requestType?: string;
19
+ }
20
+ type FeaturesRequestsMap = Record<string, Record<string, Record<string, CooldownStatus>>>;
21
+ export declare const convertFeatureInfoToCamelCase: (featureInfo: RawFeatureInfo | null) => FeatureInfo | null;
22
+ export declare const convertFeaturesMapToCamelCase: (featuresMap: Record<string, RawFeatureInfo> | null) => Record<string, FeatureInfo | null> | null;
23
+ export declare const convertFeaturesRequestsMapToCamelCase: (featuresRequestsMap: Record<string, Record<string, Record<string, RawRequestInfo>>> | null) => FeaturesRequestsMap | null;
24
+ export declare const getCooldownStatus: (featuresRequestsMap: FeaturesRequestsMap | null, featureKey: string, requestType: string, workplaceId?: string) => CooldownStatus;
25
+ export declare const getCooldownInfo: (featuresRequestsMap: FeaturesRequestsMap | null, featureKey: string, buttons: AccessButton[], workplaceId?: string) => Record<string, CooldownStatus>;
26
+ export {};
@@ -0,0 +1 @@
1
+ export function toCamelCase(str: any): any;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function validateRedirectUrl(url: string): string;
@@ -1 +1 @@
1
- export declare const LIBRARY_VERSION = "1.7.14";
1
+ export declare const LIBRARY_VERSION = "1.7.15";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "andoncloud-sdk",
3
- "version": "1.7.14",
3
+ "version": "1.7.15",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "source": "src/index.js",
@@ -55,10 +55,11 @@
55
55
  "@mui/lab": "^7.0.1-beta.23",
56
56
  "@mui/material": "^7.3.9",
57
57
  "@mui/x-date-pickers": "^8.27.2",
58
+ "@types/js-cookie": "^3.0.6",
58
59
  "@types/react": "^19.2.14",
59
60
  "@types/react-dom": "^19.2.3",
60
61
  "@types/react-gtm-module": "^2.0.4",
61
- "andoncloud-library-scripts": "^1.0.16",
62
+ "andoncloud-library-scripts": "^1.0.19",
62
63
  "babel-preset-react-app": "^10.1.0",
63
64
  "copyfiles": "^2.4.1",
64
65
  "cypress": "^15.11.0",
@@ -75,6 +76,8 @@
75
76
  "react-i18next": "^16.5.6",
76
77
  "react-router-dom": "^7.13.1",
77
78
  "react-scripts": "^5.0.1",
79
+ "typescript": "~5.8",
80
+ "webpack-cli": "^7.0.0",
78
81
  "webpack-dev-server": "^5.2.3"
79
82
  },
80
83
  "peerDependencies": {