@zango-core/appbuilder 1.0.0-rc.1

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 (169) hide show
  1. package/dist/ConfigurePage-DRzSb06z.js +29 -0
  2. package/dist/ConfigurePage-DRzSb06z.js.map +1 -0
  3. package/dist/LoginPageWithRoleSelection-xTr_eIWh.js +662 -0
  4. package/dist/LoginPageWithRoleSelection-xTr_eIWh.js.map +1 -0
  5. package/dist/PageTypeRegistry-5269IpiS.js +53 -0
  6. package/dist/PageTypeRegistry-5269IpiS.js.map +1 -0
  7. package/dist/index.framework-B8SMzgN1.js +28005 -0
  8. package/dist/index.framework-B8SMzgN1.js.map +1 -0
  9. package/dist/types/App.d.ts +14 -0
  10. package/dist/types/__tests__/mocks/data/appInitData.d.ts +197 -0
  11. package/dist/types/__tests__/mocks/data/authConfigData.d.ts +356 -0
  12. package/dist/types/__tests__/mocks/externalPackages.d.ts +42 -0
  13. package/dist/types/__tests__/mocks/handlers/appInit.handlers.d.ts +3 -0
  14. package/dist/types/__tests__/mocks/handlers/auth.handlers.d.ts +1 -0
  15. package/dist/types/__tests__/mocks/handlers/index.d.ts +5 -0
  16. package/dist/types/__tests__/mocks/handlers/profile.handlers.d.ts +15 -0
  17. package/dist/types/__tests__/mocks/handlers/session.handlers.d.ts +2 -0
  18. package/dist/types/__tests__/setup/setupDOMMatchers.d.ts +0 -0
  19. package/dist/types/__tests__/setup/setupMSW.d.ts +1 -0
  20. package/dist/types/__tests__/setup/setupTests.d.ts +34 -0
  21. package/dist/types/__tests__/utils/mockRouterUtils.d.ts +62 -0
  22. package/dist/types/__tests__/utils/renderWithProviders.d.ts +22 -0
  23. package/dist/types/__tests__/utils/waitForHelpers.d.ts +36 -0
  24. package/dist/types/auth/components/AuthMobileShell.d.ts +8 -0
  25. package/dist/types/auth/components/AuthProvider.d.ts +30 -0
  26. package/dist/types/auth/components/DynamicLoginForm.d.ts +9 -0
  27. package/dist/types/auth/components/ForgotPasswordForm.d.ts +11 -0
  28. package/dist/types/auth/components/LoginForm.d.ts +7 -0
  29. package/dist/types/auth/components/LoginRouter.d.ts +197 -0
  30. package/dist/types/auth/components/OAuthCallback.d.ts +19 -0
  31. package/dist/types/auth/components/OTPForm.d.ts +11 -0
  32. package/dist/types/auth/components/OTPInput.d.ts +8 -0
  33. package/dist/types/auth/components/PasswordResetRequired.d.ts +23 -0
  34. package/dist/types/auth/components/ProviderButton.d.ts +17 -0
  35. package/dist/types/auth/components/ResetPasswordForm.d.ts +12 -0
  36. package/dist/types/auth/components/RoleSelection.d.ts +25 -0
  37. package/dist/types/auth/components/SecondFactorAuth.d.ts +21 -0
  38. package/dist/types/auth/components/composable/OTPLoginForm.d.ts +17 -0
  39. package/dist/types/auth/components/composable/PasswordLoginForm.d.ts +17 -0
  40. package/dist/types/auth/components/composable/SSOButtons.d.ts +61 -0
  41. package/dist/types/auth/components/composable/index.d.ts +42 -0
  42. package/dist/types/auth/contexts/LoginContext.d.ts +6 -0
  43. package/dist/types/auth/hocs/withMultiStepAuth.d.ts +35 -0
  44. package/dist/types/auth/index.d.ts +23 -0
  45. package/dist/types/auth/pages/CompleteAuthFlow.d.ts +24 -0
  46. package/dist/types/auth/pages/LoginPage.d.ts +8 -0
  47. package/dist/types/auth/pages/LoginPageWithRoleSelection.d.ts +13 -0
  48. package/dist/types/auth/pages/OAuthCallbackPage.d.ts +17 -0
  49. package/dist/types/auth/pages/SAMLCallbackPage.d.ts +16 -0
  50. package/dist/types/auth/services/authService.d.ts +87 -0
  51. package/dist/types/auth/services/internal/apiClients.d.ts +9 -0
  52. package/dist/types/auth/services/internal/authState.d.ts +12 -0
  53. package/dist/types/auth/services/internal/errorHelper.d.ts +1 -0
  54. package/dist/types/auth/services/internal/oauthSamlService.d.ts +46 -0
  55. package/dist/types/auth/services/internal/passwordValidator.d.ts +17 -0
  56. package/dist/types/auth/services/network/api.d.ts +1629 -0
  57. package/dist/types/auth/services/network/base.d.ts +31 -0
  58. package/dist/types/auth/services/network/configuration.d.ts +74 -0
  59. package/dist/types/auth/services/network/index.d.ts +13 -0
  60. package/dist/types/auth/stores/index.d.ts +1 -0
  61. package/dist/types/auth/stores/useAuthStore.d.ts +6 -0
  62. package/dist/types/auth/types/index.d.ts +57 -0
  63. package/dist/types/auth/utils/authFlowHandler.d.ts +72 -0
  64. package/dist/types/auth/utils/authUtils.d.ts +21 -0
  65. package/dist/types/auth/utils/validators.d.ts +18 -0
  66. package/dist/types/components/ErrorBoundary.d.ts +23 -0
  67. package/dist/types/components/ErrorFallback.d.ts +8 -0
  68. package/dist/types/components/index.d.ts +1 -0
  69. package/dist/types/components/ui/avatar.d.ts +11 -0
  70. package/dist/types/components/ui/button.d.ts +10 -0
  71. package/dist/types/components/ui/collapsible.d.ts +5 -0
  72. package/dist/types/components/ui/dialog.d.ts +13 -0
  73. package/dist/types/components/ui/dropdown-menu.d.ts +10 -0
  74. package/dist/types/components/ui/empty.d.ts +8 -0
  75. package/dist/types/components/ui/index.d.ts +12 -0
  76. package/dist/types/components/ui/input.d.ts +3 -0
  77. package/dist/types/components/ui/separator.d.ts +4 -0
  78. package/dist/types/components/ui/sheet.d.ts +14 -0
  79. package/dist/types/components/ui/sidebar.d.ts +69 -0
  80. package/dist/types/components/ui/skeleton.d.ts +2 -0
  81. package/dist/types/components/ui/tooltip.d.ts +7 -0
  82. package/dist/types/framework/ZangoApp.d.ts +19 -0
  83. package/dist/types/framework/components/CachedLogo.d.ts +9 -0
  84. package/dist/types/framework/components/CustomPageFallback.d.ts +13 -0
  85. package/dist/types/framework/components/CustomPageLoader.d.ts +10 -0
  86. package/dist/types/framework/components/DocumentHead.d.ts +5 -0
  87. package/dist/types/framework/components/RouteErrorBoundary.d.ts +16 -0
  88. package/dist/types/framework/components/SessionSecurityDialog.d.ts +10 -0
  89. package/dist/types/framework/components/SessionSecurityProvider.d.ts +8 -0
  90. package/dist/types/framework/components/SmartLink.d.ts +13 -0
  91. package/dist/types/framework/components/layout/AppSidebar.d.ts +36 -0
  92. package/dist/types/framework/components/layout/Breadcrumbs.d.ts +2 -0
  93. package/dist/types/framework/components/layout/CommandPalette.d.ts +2 -0
  94. package/dist/types/framework/components/layout/Layout.d.ts +2 -0
  95. package/dist/types/framework/components/layout/Navbar.d.ts +9 -0
  96. package/dist/types/framework/components/layout/NavbarIcon.d.ts +12 -0
  97. package/dist/types/framework/components/layout/Topbar.d.ts +50 -0
  98. package/dist/types/framework/components/layout/UserProfileDrawer.d.ts +7 -0
  99. package/dist/types/framework/components/layout/profile/PasswordCard.d.ts +18 -0
  100. package/dist/types/framework/components/layout/profile/PersonalInfoCard.d.ts +12 -0
  101. package/dist/types/framework/components/layout/profile/ProfileRail.d.ts +23 -0
  102. package/dist/types/framework/components/layout/profile/SessionsCard.d.ts +8 -0
  103. package/dist/types/framework/components/layout/profile/TokensCard.d.ts +11 -0
  104. package/dist/types/framework/components/layout/profile/TwoFactorCard.d.ts +7 -0
  105. package/dist/types/framework/config/defaultLayoutConfig.d.ts +34 -0
  106. package/dist/types/framework/constants/routes.d.ts +5 -0
  107. package/dist/types/framework/contexts/AppContext.d.ts +57 -0
  108. package/dist/types/framework/contexts/AuthConfigContext.d.ts +22 -0
  109. package/dist/types/framework/hooks/useProfileData.d.ts +73 -0
  110. package/dist/types/framework/hooks/useRoutes.d.ts +10 -0
  111. package/dist/types/framework/hooks/useSessionSecurity.d.ts +17 -0
  112. package/dist/types/framework/hooks/useSmartNavigation.d.ts +15 -0
  113. package/dist/types/framework/index.d.ts +35 -0
  114. package/dist/types/framework/pages/ConfigurePage.d.ts +2 -0
  115. package/dist/types/framework/pages/CrudPage.d.ts +6 -0
  116. package/dist/types/framework/pages/LoginPage.d.ts +5 -0
  117. package/dist/types/framework/pages/LogoutPage.d.ts +2 -0
  118. package/dist/types/framework/pages/NotFoundPage.d.ts +6 -0
  119. package/dist/types/framework/pages/TrainingPage.d.ts +6 -0
  120. package/dist/types/framework/routing/PageTypeRegistry.d.ts +43 -0
  121. package/dist/types/framework/routing/PageTypeRouter.d.ts +12 -0
  122. package/dist/types/framework/routing/dynamicPageRegistry.d.ts +41 -0
  123. package/dist/types/framework/routing/getRenderComponent.d.ts +6 -0
  124. package/dist/types/framework/types/layout.types.d.ts +107 -0
  125. package/dist/types/framework/utils/apiConfig.d.ts +41 -0
  126. package/dist/types/framework/utils/apiInterceptor.d.ts +12 -0
  127. package/dist/types/framework/utils/apiUrlUtils.d.ts +9 -0
  128. package/dist/types/framework/utils/authThemeUtils.d.ts +64 -0
  129. package/dist/types/framework/utils/colorUtils.d.ts +53 -0
  130. package/dist/types/framework/utils/cookieUtils.d.ts +20 -0
  131. package/dist/types/framework/utils/csrf.d.ts +27 -0
  132. package/dist/types/framework/utils/logoCache.d.ts +21 -0
  133. package/dist/types/framework/utils/logoutUtils.d.ts +15 -0
  134. package/dist/types/framework/utils/redirectUtils.d.ts +48 -0
  135. package/dist/types/framework/utils/safeRedirect.d.ts +21 -0
  136. package/dist/types/framework/utils/storageKeys.d.ts +44 -0
  137. package/dist/types/framework/utils/storageSanitizer.d.ts +20 -0
  138. package/dist/types/hooks/index.d.ts +2 -0
  139. package/dist/types/hooks/queries/index.d.ts +4 -0
  140. package/dist/types/hooks/queries/useAppInitQuery.d.ts +1 -0
  141. package/dist/types/hooks/queries/useAuthConfigQuery.d.ts +1 -0
  142. package/dist/types/hooks/queries/useProfileQuery.d.ts +8 -0
  143. package/dist/types/hooks/useBreakpoint.d.ts +2 -0
  144. package/dist/types/hooks/useMobile.d.ts +1 -0
  145. package/dist/types/index.d.ts +0 -0
  146. package/dist/types/index.framework.d.ts +39 -0
  147. package/dist/types/index.zango.d.ts +12 -0
  148. package/dist/types/lib/index.d.ts +1 -0
  149. package/dist/types/lib/utils.d.ts +2 -0
  150. package/dist/types/schemas/appInit.schema.d.ts +61 -0
  151. package/dist/types/schemas/index.d.ts +10 -0
  152. package/dist/types/schemas/profile.schema.d.ts +18 -0
  153. package/dist/types/schemas/route.schema.d.ts +9 -0
  154. package/dist/types/schemas/session.schema.d.ts +8 -0
  155. package/dist/types/schemas/theme.schema.d.ts +27 -0
  156. package/dist/types/services/api/index.d.ts +2 -0
  157. package/dist/types/services/api.d.ts +109 -0
  158. package/dist/types/services/index.d.ts +7 -0
  159. package/dist/types/services/legacyAdapter.d.ts +10 -0
  160. package/dist/types/services/logger.d.ts +32 -0
  161. package/dist/types/services/normalizeResponse.d.ts +29 -0
  162. package/dist/types/types/auth.d.ts +103 -0
  163. package/dist/types/types/common.d.ts +343 -0
  164. package/dist/types/types/index.d.ts +278 -0
  165. package/dist/zango-appbuilder.js +99 -0
  166. package/dist/zango-appbuilder.js.map +1 -0
  167. package/dist/zango-appbuilder.umd.cjs +247 -0
  168. package/dist/zango-appbuilder.umd.cjs.map +1 -0
  169. package/package.json +140 -0
@@ -0,0 +1,107 @@
1
+ import { ReactNode } from 'react';
2
+ import { MenuItemConfig } from '../../types';
3
+ /**
4
+ * Layout Configuration Types
5
+ *
6
+ * This file defines the TypeScript interfaces for the composable layout system.
7
+ * Following the same pattern as the CRUD composable architecture.
8
+ */
9
+ /**
10
+ * Layout Configuration
11
+ * Controls overall layout visibility and behavior
12
+ */
13
+ export interface LayoutConfigType {
14
+ showTopbar?: boolean;
15
+ showNavbar?: boolean;
16
+ layoutType?: 'wide' | 'compact';
17
+ showCommandPalette?: boolean;
18
+ }
19
+ /**
20
+ * Profile Menu Configuration
21
+ */
22
+ export interface ProfileMenuConfig {
23
+ showViewProfile?: boolean;
24
+ showLogout?: boolean;
25
+ showRoleSwitch?: boolean;
26
+ customMenuItems?: MenuItemConfig[];
27
+ }
28
+ /**
29
+ * Menu Configuration
30
+ */
31
+ export interface MenuConfig {
32
+ showIcons?: boolean;
33
+ showSubmenus?: boolean;
34
+ expandOnHover?: boolean;
35
+ customMenuItemRenderer?: (...args: unknown[]) => unknown;
36
+ }
37
+ /**
38
+ * Topbar Configuration
39
+ * Controls topbar customization and component overrides
40
+ */
41
+ export interface TopbarConfigType {
42
+ showProfile?: boolean;
43
+ showLeftSection?: boolean;
44
+ showRightSection?: boolean;
45
+ customLeftContent?: ReactNode;
46
+ customRightContent?: ReactNode;
47
+ customProfileMenu?: ReactNode;
48
+ customTopbar?: React.ComponentType<Record<string, unknown>>;
49
+ customViewProfile?: (options: {
50
+ user: unknown;
51
+ isOpen: boolean;
52
+ onClose: () => void;
53
+ }) => React.ReactNode;
54
+ profileMenuConfig?: ProfileMenuConfig;
55
+ showBreadcrumbs?: boolean;
56
+ theme?: 'light' | 'dark';
57
+ className?: string;
58
+ style?: React.CSSProperties;
59
+ }
60
+ /**
61
+ * Navbar Configuration
62
+ * Controls navbar customization and component overrides
63
+ */
64
+ export interface NavbarConfigType {
65
+ showLogo?: boolean;
66
+ showMenu?: boolean;
67
+ isCollapsed?: boolean;
68
+ collapsible?: boolean;
69
+ customLogo?: ReactNode;
70
+ customMenuContent?: ReactNode;
71
+ customBottomContent?: ReactNode;
72
+ onCollapseChange?: (collapsed: boolean) => void;
73
+ customNavbar?: React.ComponentType<Record<string, unknown>>;
74
+ customMenu?: React.ComponentType<Record<string, unknown>>;
75
+ menuConfig?: MenuConfig;
76
+ theme?: 'light' | 'dark';
77
+ className?: string;
78
+ style?: React.CSSProperties;
79
+ }
80
+ /**
81
+ * Custom Components
82
+ * Complete component replacements
83
+ */
84
+ export interface CustomComponentsType {
85
+ Layout?: React.ComponentType<Record<string, unknown>>;
86
+ Topbar?: React.ComponentType<Record<string, unknown>>;
87
+ Navbar?: React.ComponentType<Record<string, unknown>>;
88
+ ViewProfile?: React.ComponentType<Record<string, unknown>>;
89
+ Logo?: React.ComponentType<Record<string, unknown>>;
90
+ }
91
+ /**
92
+ * Main App Configuration Props
93
+ */
94
+ export interface AppConfigurationType {
95
+ layoutConfig?: LayoutConfigType;
96
+ topbarConfig?: TopbarConfigType;
97
+ navbarConfig?: NavbarConfigType;
98
+ customComponents?: CustomComponentsType;
99
+ customPages?: Record<string, React.ComponentType<Record<string, unknown>>>;
100
+ config?: Record<string, unknown>;
101
+ }
102
+ /**
103
+ * Default Configuration Values
104
+ */
105
+ export declare const defaultLayoutConfig: LayoutConfigType;
106
+ export declare const defaultTopbarConfig: TopbarConfigType;
107
+ export declare const defaultNavbarConfig: NavbarConfigType;
@@ -0,0 +1,41 @@
1
+ import { ApiConfig, ApiRequestConfig, RouteConfig } from '../../types';
2
+ /**
3
+ * Get full API URL by combining baseUrl with endpoint
4
+ */
5
+ export declare const getApiUrl: (endpoint: string, apiConfig?: ApiConfig) => string;
6
+ /**
7
+ * Get endpoint from API config
8
+ */
9
+ export declare const getEndpoint: (endpointKey: string, apiConfig?: ApiConfig) => string;
10
+ /**
11
+ * Get API timeout from config
12
+ */
13
+ export declare const getApiTimeout: (apiConfig?: ApiConfig) => number;
14
+ /**
15
+ * Get base URL from context API config
16
+ */
17
+ export declare const getBaseUrl: (apiConfig?: ApiConfig) => string;
18
+ /**
19
+ * Build a full API URL by resolving an endpoint against the context's base URL.
20
+ *
21
+ * Distinct from `buildApiUrl` in `apiUrlUtils`, which appends query parameters
22
+ * to an already-resolved URL. The two were briefly published under the same
23
+ * name from the package entry, so a caller passing a params object silently
24
+ * got base-URL resolution and lost its query string. Named for what it does to
25
+ * keep them apart.
26
+ */
27
+ export declare const resolveApiUrl: (endpoint: string, apiConfig?: ApiConfig) => string;
28
+ /**
29
+ * Hook to get API configuration for the current route
30
+ * Automatically finds the route config based on current location
31
+ */
32
+ export declare const useApiConfig: () => ApiRequestConfig;
33
+ /**
34
+ * Hook to get the full route configuration for the current route
35
+ * Returns the complete RouteConfig object that matches the current location
36
+ */
37
+ export declare const useRouteConfig: () => RouteConfig | null;
38
+ /**
39
+ * Simple function to get API config when you already know the endpoint
40
+ */
41
+ export declare const getApiConfig: (endpoint: string, apiConfig?: ApiConfig, options?: Record<string, unknown>) => ApiRequestConfig;
@@ -0,0 +1,12 @@
1
+ declare global {
2
+ interface XMLHttpRequest {
3
+ _requestUrl?: string | URL;
4
+ }
5
+ }
6
+ declare class ApiInterceptor {
7
+ constructor();
8
+ handleRedirect(location: string): void;
9
+ setupInterceptors(): void;
10
+ }
11
+ export declare const apiInterceptor: ApiInterceptor;
12
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Builds an API URL with query parameters
3
+ * Ensures the endpoint ends with '/' before adding query parameters
4
+ * Similar to buildApiUrl in pkg-zango-crud
5
+ * @param baseUrl - The base URL (will be normalized to end with /)
6
+ * @param params - Optional query parameters to append
7
+ * @returns The complete URL with query parameters
8
+ */
9
+ export declare function buildApiUrl(baseUrl: string, params?: Record<string, string>): string;
@@ -0,0 +1,64 @@
1
+ import { AuthConfig } from '../../types';
2
+ /**
3
+ * Generate CSS variables from AuthConfig theme configuration
4
+ */
5
+ export declare const generateAuthCSSVariables: (authConfig: AuthConfig) => string;
6
+ /**
7
+ * Apply auth theme to the document
8
+ */
9
+ export declare const applyAuthTheme: (authConfig: AuthConfig) => void;
10
+ /**
11
+ * Remove auth theme from the document
12
+ */
13
+ export declare const removeAuthTheme: () => void;
14
+ /**
15
+ * Get background style object from auth config
16
+ */
17
+ export declare const getAuthBackgroundStyle: (authConfig: AuthConfig) => React.CSSProperties;
18
+ /**
19
+ * Get card style object from auth config
20
+ */
21
+ export declare const getAuthCardStyle: (authConfig: AuthConfig) => React.CSSProperties;
22
+ /**
23
+ * Get logo style object from auth config
24
+ */
25
+ export declare const getAuthLogoStyle: (authConfig: AuthConfig) => React.CSSProperties;
26
+ /**
27
+ * Get text alignment based on logo position
28
+ */
29
+ export declare const getLogoAlignment: (authConfig: AuthConfig) => "left" | "center" | "right";
30
+ /**
31
+ * Get logo container style and classes for positioning
32
+ */
33
+ export declare const getLogoContainerStyle: (authConfig: AuthConfig) => {
34
+ className: string;
35
+ style: React.CSSProperties;
36
+ };
37
+ /**
38
+ * Utility to merge custom styles with auth config styles
39
+ */
40
+ export declare const mergeAuthStyles: (authConfig: AuthConfig, customStyles?: React.CSSProperties) => React.CSSProperties;
41
+ /**
42
+ * Check if auth config has theme customizations
43
+ */
44
+ export declare const hasAuthThemeCustomizations: (authConfig: AuthConfig) => boolean;
45
+ /**
46
+ * Get text style object from auth config
47
+ */
48
+ export declare const getAuthTextStyle: (authConfig: AuthConfig) => React.CSSProperties;
49
+ /**
50
+ * Get secondary text style object from auth config
51
+ */
52
+ export declare const getAuthSecondaryTextStyle: (authConfig: AuthConfig) => React.CSSProperties;
53
+ /**
54
+ * Get muted text style object from auth config
55
+ */
56
+ export declare const getAuthMutedTextStyle: (authConfig: AuthConfig) => React.CSSProperties;
57
+ /**
58
+ * Get link style object from auth config
59
+ */
60
+ export declare const getAuthLinkStyle: (authConfig: AuthConfig) => React.CSSProperties;
61
+ /**
62
+ * Generate responsive card styles based on screen size
63
+ */
64
+ export declare const getResponsiveCardStyle: (authConfig: AuthConfig) => React.CSSProperties;
@@ -0,0 +1,53 @@
1
+ interface ColorPalette {
2
+ 25: string;
3
+ 50: string;
4
+ 100: string;
5
+ 200: string;
6
+ 300: string;
7
+ 400: string;
8
+ 500: string;
9
+ 600: string;
10
+ 700: string;
11
+ 800: string;
12
+ 900: string;
13
+ 950: string;
14
+ }
15
+ interface ThemeColors {
16
+ primary: string;
17
+ success: string;
18
+ warning: string;
19
+ gray: string;
20
+ error: string;
21
+ }
22
+ interface ThemeConfig {
23
+ colors: ThemeColors;
24
+ typography?: Record<string, string>;
25
+ borders?: Record<string, string>;
26
+ shadows?: Record<string, string>;
27
+ spacing?: Record<string, number>;
28
+ }
29
+ /**
30
+ * Generate a complete color palette from a base color
31
+ */
32
+ export declare const generatePalette: (baseColor: string) => ColorPalette;
33
+ export declare function sanitizeCSSValue(value: unknown): string;
34
+ /**
35
+ * Generate CSS variables from theme configuration
36
+ */
37
+ export declare const generateCSSVariables: (theme: ThemeConfig) => string;
38
+ /**
39
+ * Check if a color is light or dark
40
+ */
41
+ export declare const isLightColor: (color: string) => boolean;
42
+ /**
43
+ * Get contrast color (black or white) based on background
44
+ */
45
+ export declare const getContrastColor: (bgColor: string) => string;
46
+ /**
47
+ * Get a specific color hex code from CSS custom properties
48
+ * @example
49
+ * getColor('brand', 500) // Returns '#5048ED'
50
+ * getColor('success', '100') // Returns '#CCF3E3'
51
+ */
52
+ export declare const getColor: (colorName: string, shade?: string | number) => string;
53
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Cookie utility functions for managing browser cookies
3
+ */
4
+ /**
5
+ * Delete a cookie by name
6
+ */
7
+ export declare const deleteCookie: (name: string, path?: string, domain?: string | null) => void;
8
+ /**
9
+ * Get a cookie value by name
10
+ */
11
+ export declare const getCookie: (name: string) => string | null;
12
+ /**
13
+ * Set a cookie
14
+ */
15
+ export declare const setCookie: (name: string, value: string, days?: number | null, path?: string, domain?: string | null) => void;
16
+ /**
17
+ * Check if user is authenticated by verifying the presence of zangocookie
18
+ * This is a fast, client-side check that doesn't require API calls
19
+ */
20
+ export declare const isAuthenticatedViaCookie: () => boolean;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * CSRF Token Handling Utility
3
+ * Centralizes CSRF token management with proper validation
4
+ */
5
+ /**
6
+ * Retrieves the CSRF token from cookies, meta tags, or alternative cookie names.
7
+ * @returns CSRF token or null if not found/invalid
8
+ */
9
+ export declare function getCsrfToken(): string | null;
10
+ /**
11
+ * Validates CSRF token format
12
+ * @param token - Token to validate
13
+ * @returns True if token appears valid
14
+ */
15
+ export declare function validateCsrfToken(token: string): boolean;
16
+ /**
17
+ * Sets a CSRF token (for testing or manual token management)
18
+ * @param token - Token to set
19
+ */
20
+ export declare function setCsrfToken(token: string): void;
21
+ /**
22
+ * Gets CSRF token for use in headers
23
+ * Includes fallback for development/testing
24
+ * @returns CSRF token
25
+ * @throws Error if token not available
26
+ */
27
+ export declare function getCsrfTokenForRequest(): string;
@@ -0,0 +1,21 @@
1
+ interface LogoCacheData {
2
+ url: string;
3
+ base64Data: string | null;
4
+ version: string | null;
5
+ timestamp: number;
6
+ appName: string;
7
+ }
8
+ declare class LogoCache {
9
+ private cacheKey;
10
+ constructor();
11
+ getCachedLogo(): LogoCacheData | null;
12
+ cacheLogoUrl(logoUrl: string, appName?: string): Promise<LogoCacheData | undefined>;
13
+ fetchAndConvertToBase64(url: string): Promise<string | null>;
14
+ generateHash(str: string): Promise<string>;
15
+ isCacheExpired(timestamp: number): boolean;
16
+ clearCache(): void;
17
+ needsUpdate(currentUrl: string): Promise<boolean>;
18
+ updateInBackground(logoUrl: string, appName?: string, onUpdate?: (cache: LogoCacheData) => void): Promise<void>;
19
+ }
20
+ export declare const logoCache: LogoCache;
21
+ export {};
@@ -0,0 +1,15 @@
1
+ interface LogoutOptions {
2
+ theme?: {
3
+ login_url?: string;
4
+ };
5
+ redirectUrl?: string;
6
+ preserveCurrentPath?: boolean;
7
+ /**
8
+ * The deployment's configured token key (`apiConfig.tokenKey`). Pass it when
9
+ * the app overrides the default, or the token survives the logout.
10
+ */
11
+ tokenKey?: string;
12
+ }
13
+ export declare const performLogout: (options?: LogoutOptions) => Promise<void>;
14
+ export declare const showLogoutConfirmation: (onConfirm: () => void) => void;
15
+ export {};
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Redirect utility functions with security validation
3
+ * Prevents open redirect vulnerabilities while preserving user's intended destination
4
+ */
5
+ /**
6
+ * Validates a redirect URL for security
7
+ * @param url - The URL to validate
8
+ * @returns true if the URL is safe to redirect to, false otherwise
9
+ */
10
+ export declare function validateRedirectUrl(url: string | null): boolean;
11
+ /**
12
+ * Extracts the 'next' parameter from a URL search string
13
+ * @param search - The URL search string (e.g., "?next=/app/page&other=value")
14
+ * @returns The decoded next parameter value, or null if not found
15
+ */
16
+ export declare function getNextParam(search: string): string | null;
17
+ /**
18
+ * Gets a valid redirect URL with security validation and fallback logic
19
+ * Priority: nextParam > serverRedirectUrl > defaultUrl
20
+ *
21
+ * @param nextParam - The 'next' parameter from the URL (highest priority)
22
+ * @param serverRedirectUrl - The redirect URL from server response (medium priority)
23
+ * @param defaultUrl - The default fallback URL (lowest priority, defaults to '/app')
24
+ * @returns A safe, validated redirect URL
25
+ */
26
+ export declare function getValidRedirectUrl(nextParam: string | null, serverRedirectUrl?: string | null, defaultUrl?: string): string;
27
+ /** Key used to persist the next param across SSO redirects */
28
+ export declare const SSO_NEXT_KEY: "sso_next_param";
29
+ /**
30
+ * Saves the `next` param to sessionStorage before SSO redirect.
31
+ * Always clears the key first — prevents stale values from a failed SSO attempt
32
+ * leaking into a new flow where the user has no ?next= param.
33
+ * Only writes if the value passes security validation.
34
+ */
35
+ export declare function saveNextParamToSession(nextParam: string | null): void;
36
+ /**
37
+ * Returns the stored next param and clears it from sessionStorage.
38
+ * Returns null if nothing was stored or the value fails security validation.
39
+ * Calling this always clears the key regardless of whether a valid value was found.
40
+ * Call this exactly once per auth completion in each terminal handler.
41
+ */
42
+ export declare function getNextParamFromSession(): string | null;
43
+ /**
44
+ * Clears the stored SSO next param without reading it.
45
+ * Use only when no redirect is needed but the key must be cleaned up
46
+ * (e.g., on auth error before retrying).
47
+ */
48
+ export declare function clearNextParamFromSession(): void;
@@ -0,0 +1,21 @@
1
+ import { NavigateOptions } from 'react-router-dom';
2
+ /**
3
+ * Safe navigation wrapper that validates URLs before redirecting
4
+ * @param navigate - React Router navigate function
5
+ * @param url - URL to navigate to
6
+ * @param fallback - Fallback URL if validation fails
7
+ * @param options - Navigation options
8
+ */
9
+ export declare function safeNavigate(navigate: (to: string, options?: NavigateOptions) => void, url: string | null | undefined, fallback?: string, options?: NavigateOptions): void;
10
+ /**
11
+ * Safe window.location.href redirect wrapper
12
+ * @param url - URL to redirect to
13
+ * @param fallback - Fallback URL if validation fails
14
+ */
15
+ export declare function safeWindowRedirect(url: string | null | undefined, fallback?: string): void;
16
+ /**
17
+ * Safe window.location.replace wrapper (doesn't add to history)
18
+ * @param url - URL to redirect to
19
+ * @param fallback - Fallback URL if validation fails
20
+ */
21
+ export declare function safeWindowReplace(url: string | null | undefined, fallback?: string): void;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Single registry of every browser-storage key this framework writes.
3
+ *
4
+ * Logout clears storage from this list rather than from a hand-maintained set
5
+ * of literals. A previous allowlist drifted out of sync with its writers and
6
+ * left an auth token behind on deployments that configure a custom `tokenKey`,
7
+ * so any new key must be added here and nowhere else.
8
+ *
9
+ * `AUTH_TOKEN` is the default only. The token key is configurable per
10
+ * deployment (`apiConfig.tokenKey`), which is why `clearAuthStorage` takes the
11
+ * resolved key as an argument instead of assuming the default.
12
+ */
13
+ /** Keys written to localStorage. */
14
+ export declare const LOCAL_STORAGE_KEYS: {
15
+ /** Default bearer-token key; overridden by `apiConfig.tokenKey`. */
16
+ readonly AUTH_TOKEN: "authToken";
17
+ readonly AUTH_STATE: "auth_state";
18
+ readonly AUTH_CONFIG: "auth_config";
19
+ readonly PENDING_AUTH_RESULT: "pendingAuthResult";
20
+ readonly PENDING_AUTH_STEP: "pendingAuthStep";
21
+ /** Cached org logo — per-user, so it must not survive a logout. */
22
+ readonly LOGO_CACHE: "zango_app_logo_cache";
23
+ };
24
+ /** Keys written to sessionStorage. */
25
+ export declare const SESSION_STORAGE_KEYS: {
26
+ /** Deep link persisted across an SSO round trip. */
27
+ readonly SSO_NEXT: "sso_next_param";
28
+ readonly SAML_ERROR: "saml_error";
29
+ readonly SAML_IN_PROGRESS: "saml_auth_in_progress";
30
+ readonly PENDING_AUTH_RESULT: "pendingAuthResult";
31
+ readonly PENDING_AUTH_STEP: "pendingAuthStep";
32
+ };
33
+ /**
34
+ * Removes every framework-owned key from both storages.
35
+ *
36
+ * @param tokenKey - The deployment's configured token key. Defaults to
37
+ * `authToken`; pass `apiConfig.tokenKey` so a custom key is cleared too.
38
+ *
39
+ * Each removal is individually guarded: storage access throws in private
40
+ * browsing and when a quota is exhausted, and one failing key must not skip
41
+ * the rest — a partial clear that silently leaves a token behind is the exact
42
+ * failure this registry exists to prevent.
43
+ */
44
+ export declare function clearAuthStorage(tokenKey?: string): void;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Storage sanitization utilities to prevent XSS attacks
3
+ * Sanitizes data before storing in/retrieving from sessionStorage
4
+ */
5
+ /**
6
+ * Recursively sanitizes an object or array for storage
7
+ */
8
+ export declare function sanitizeForStorage<T>(value: T): T;
9
+ /**
10
+ * Safely stores data in sessionStorage with sanitization
11
+ */
12
+ export declare function setSafeSessionStorage<T>(key: string, value: T): void;
13
+ /**
14
+ * Safely retrieves data from sessionStorage with sanitization
15
+ */
16
+ export declare function getSafeSessionStorage<T>(key: string): T | null;
17
+ /**
18
+ * Clears an item from sessionStorage
19
+ */
20
+ export declare function removeSafeSessionStorage(key: string): void;
@@ -0,0 +1,2 @@
1
+ export { type Breakpoint, useBreakpoint } from './useBreakpoint';
2
+ export { useIsMobile } from './useMobile';
@@ -0,0 +1,4 @@
1
+ export { useAppInitQuery } from './useAppInitQuery';
2
+ export { useAuthConfigQuery } from './useAuthConfigQuery';
3
+ export { useProfileQuery } from './useProfileQuery';
4
+ export { useDeleteAllSessionsMutation, useDeleteSessionMutation, useSessionsQuery } from './useSessionsQuery';
@@ -0,0 +1 @@
1
+ export declare const useAppInitQuery: () => import('@tanstack/react-query').UseQueryResult<unknown, Error>;
@@ -0,0 +1 @@
1
+ export declare const useAuthConfigQuery: () => import('@tanstack/react-query').UseQueryResult<Record<string, unknown>, Error>;
@@ -0,0 +1,8 @@
1
+ interface UseProfileQueryOptions {
2
+ enabled?: boolean;
3
+ }
4
+ export declare const useProfileQuery: ({ enabled }?: UseProfileQueryOptions) => import('@tanstack/react-query').UseQueryResult<{
5
+ profileData: Record<string, unknown>;
6
+ shouldSetPassword: boolean;
7
+ }, Error>;
8
+ export {};
@@ -0,0 +1,2 @@
1
+ export type Breakpoint = 'sm' | 'md' | 'lg' | 'xl';
2
+ export declare function useBreakpoint(): Breakpoint;
@@ -0,0 +1 @@
1
+ export declare function useIsMobile(): boolean;
File without changes
@@ -0,0 +1,39 @@
1
+ export { App as ZangoApp } from './App';
2
+ export { AuthProvider, useAuthContext } from './auth/components/AuthProvider';
3
+ export { OTPLoginForm } from './auth/components/composable/OTPLoginForm';
4
+ export { PasswordLoginForm } from './auth/components/composable/PasswordLoginForm';
5
+ export { SSOButtons } from './auth/components/composable/SSOButtons';
6
+ export { ForgotPasswordForm } from './auth/components/ForgotPasswordForm';
7
+ export { PasswordResetRequired } from './auth/components/PasswordResetRequired';
8
+ export { ResetPasswordForm } from './auth/components/ResetPasswordForm';
9
+ export { RoleSelection } from './auth/components/RoleSelection';
10
+ export { LoginContext, useLoginContext } from './auth/contexts/LoginContext';
11
+ export { withMultiStepAuth } from './auth/hocs/withMultiStepAuth';
12
+ export { useAuth } from './auth/hooks/useAuth';
13
+ export { authService } from './auth/services/authService';
14
+ export { CachedLogo } from './framework/components/CachedLogo';
15
+ export { CustomPageFallback } from './framework/components/CustomPageFallback';
16
+ export { CustomPageLoader } from './framework/components/CustomPageLoader';
17
+ export { DocumentHead } from './framework/components/DocumentHead';
18
+ export { Breadcrumbs } from './framework/components/layout/Breadcrumbs';
19
+ export { CommandPalette } from './framework/components/layout/CommandPalette';
20
+ export { Layout } from './framework/components/layout/Layout';
21
+ export { Navbar } from './framework/components/layout/Navbar';
22
+ export { Topbar } from './framework/components/layout/Topbar';
23
+ export { UserProfileDrawer } from './framework/components/layout/UserProfileDrawer';
24
+ export { SmartLink } from './framework/components/SmartLink';
25
+ export { AppProvider, useAppContext } from './framework/contexts/AppContext';
26
+ export { AuthConfigProvider, useAuthConfig } from './framework/contexts/AuthConfigContext';
27
+ export { useSmartNavigation } from './framework/hooks/useSmartNavigation';
28
+ export { CrudPage } from './framework/pages/CrudPage';
29
+ export { LoginPage } from './framework/pages/LoginPage';
30
+ export { LogoutPage } from './framework/pages/LogoutPage';
31
+ export { NotFoundPage } from './framework/pages/NotFoundPage';
32
+ export { getApiConfig, getApiTimeout, getApiUrl, getBaseUrl, getEndpoint, resolveApiUrl, useApiConfig, useRouteConfig, } from './framework/utils/apiConfig';
33
+ export { apiInterceptor } from './framework/utils/apiInterceptor';
34
+ export { buildApiUrl } from './framework/utils/apiUrlUtils';
35
+ export { generateCSSVariables, generatePalette, getColor, getContrastColor, isLightColor, } from './framework/utils/colorUtils';
36
+ export { deleteCookie, getCookie, isAuthenticatedViaCookie, setCookie } from './framework/utils/cookieUtils';
37
+ export { logoCache } from './framework/utils/logoCache';
38
+ export { clearNextParamFromSession, getNextParam, getNextParamFromSession, getValidRedirectUrl, saveNextParamToSession, validateRedirectUrl, } from './framework/utils/redirectUtils';
39
+ export { callApi, callDeleteApi, callGetApi, callPatchApi, callPostApi, callPutApi, changePassword, changeRole, fetchAppInitData, fetchUserProfile, fetchUserSessions, generateQueryString, getAppInitData, getUserProfile, getUserSessions, logout, logoutAllSessions, logoutSession, performAppLogout, performDirectLogout, performLogout, pingSession, pingSessionSecurity, removeAllSessions, removeSession, saveUserProfile, setTwoFactor, switchRole, toggleTwoFactor, updatePassword, updateUserProfile, uploadPhoto, uploadProfilePhoto, } from './services/api';
@@ -0,0 +1,12 @@
1
+ interface ZangoInitConfig {
2
+ apiUrl?: string;
3
+ basePath?: string;
4
+ [key: string]: unknown;
5
+ }
6
+ type InitZangoAppFn = (elementId: string, config?: ZangoInitConfig) => (() => void) | undefined;
7
+ declare global {
8
+ interface Window {
9
+ initZangoApp?: InitZangoAppFn;
10
+ }
11
+ }
12
+ export {};
@@ -0,0 +1 @@
1
+ export { cn } from './utils';
@@ -0,0 +1,2 @@
1
+ import { ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;