@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.
- package/dist/ConfigurePage-DRzSb06z.js +29 -0
- package/dist/ConfigurePage-DRzSb06z.js.map +1 -0
- package/dist/LoginPageWithRoleSelection-xTr_eIWh.js +662 -0
- package/dist/LoginPageWithRoleSelection-xTr_eIWh.js.map +1 -0
- package/dist/PageTypeRegistry-5269IpiS.js +53 -0
- package/dist/PageTypeRegistry-5269IpiS.js.map +1 -0
- package/dist/index.framework-B8SMzgN1.js +28005 -0
- package/dist/index.framework-B8SMzgN1.js.map +1 -0
- package/dist/types/App.d.ts +14 -0
- package/dist/types/__tests__/mocks/data/appInitData.d.ts +197 -0
- package/dist/types/__tests__/mocks/data/authConfigData.d.ts +356 -0
- package/dist/types/__tests__/mocks/externalPackages.d.ts +42 -0
- package/dist/types/__tests__/mocks/handlers/appInit.handlers.d.ts +3 -0
- package/dist/types/__tests__/mocks/handlers/auth.handlers.d.ts +1 -0
- package/dist/types/__tests__/mocks/handlers/index.d.ts +5 -0
- package/dist/types/__tests__/mocks/handlers/profile.handlers.d.ts +15 -0
- package/dist/types/__tests__/mocks/handlers/session.handlers.d.ts +2 -0
- package/dist/types/__tests__/setup/setupDOMMatchers.d.ts +0 -0
- package/dist/types/__tests__/setup/setupMSW.d.ts +1 -0
- package/dist/types/__tests__/setup/setupTests.d.ts +34 -0
- package/dist/types/__tests__/utils/mockRouterUtils.d.ts +62 -0
- package/dist/types/__tests__/utils/renderWithProviders.d.ts +22 -0
- package/dist/types/__tests__/utils/waitForHelpers.d.ts +36 -0
- package/dist/types/auth/components/AuthMobileShell.d.ts +8 -0
- package/dist/types/auth/components/AuthProvider.d.ts +30 -0
- package/dist/types/auth/components/DynamicLoginForm.d.ts +9 -0
- package/dist/types/auth/components/ForgotPasswordForm.d.ts +11 -0
- package/dist/types/auth/components/LoginForm.d.ts +7 -0
- package/dist/types/auth/components/LoginRouter.d.ts +197 -0
- package/dist/types/auth/components/OAuthCallback.d.ts +19 -0
- package/dist/types/auth/components/OTPForm.d.ts +11 -0
- package/dist/types/auth/components/OTPInput.d.ts +8 -0
- package/dist/types/auth/components/PasswordResetRequired.d.ts +23 -0
- package/dist/types/auth/components/ProviderButton.d.ts +17 -0
- package/dist/types/auth/components/ResetPasswordForm.d.ts +12 -0
- package/dist/types/auth/components/RoleSelection.d.ts +25 -0
- package/dist/types/auth/components/SecondFactorAuth.d.ts +21 -0
- package/dist/types/auth/components/composable/OTPLoginForm.d.ts +17 -0
- package/dist/types/auth/components/composable/PasswordLoginForm.d.ts +17 -0
- package/dist/types/auth/components/composable/SSOButtons.d.ts +61 -0
- package/dist/types/auth/components/composable/index.d.ts +42 -0
- package/dist/types/auth/contexts/LoginContext.d.ts +6 -0
- package/dist/types/auth/hocs/withMultiStepAuth.d.ts +35 -0
- package/dist/types/auth/index.d.ts +23 -0
- package/dist/types/auth/pages/CompleteAuthFlow.d.ts +24 -0
- package/dist/types/auth/pages/LoginPage.d.ts +8 -0
- package/dist/types/auth/pages/LoginPageWithRoleSelection.d.ts +13 -0
- package/dist/types/auth/pages/OAuthCallbackPage.d.ts +17 -0
- package/dist/types/auth/pages/SAMLCallbackPage.d.ts +16 -0
- package/dist/types/auth/services/authService.d.ts +87 -0
- package/dist/types/auth/services/internal/apiClients.d.ts +9 -0
- package/dist/types/auth/services/internal/authState.d.ts +12 -0
- package/dist/types/auth/services/internal/errorHelper.d.ts +1 -0
- package/dist/types/auth/services/internal/oauthSamlService.d.ts +46 -0
- package/dist/types/auth/services/internal/passwordValidator.d.ts +17 -0
- package/dist/types/auth/services/network/api.d.ts +1629 -0
- package/dist/types/auth/services/network/base.d.ts +31 -0
- package/dist/types/auth/services/network/configuration.d.ts +74 -0
- package/dist/types/auth/services/network/index.d.ts +13 -0
- package/dist/types/auth/stores/index.d.ts +1 -0
- package/dist/types/auth/stores/useAuthStore.d.ts +6 -0
- package/dist/types/auth/types/index.d.ts +57 -0
- package/dist/types/auth/utils/authFlowHandler.d.ts +72 -0
- package/dist/types/auth/utils/authUtils.d.ts +21 -0
- package/dist/types/auth/utils/validators.d.ts +18 -0
- package/dist/types/components/ErrorBoundary.d.ts +23 -0
- package/dist/types/components/ErrorFallback.d.ts +8 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/ui/avatar.d.ts +11 -0
- package/dist/types/components/ui/button.d.ts +10 -0
- package/dist/types/components/ui/collapsible.d.ts +5 -0
- package/dist/types/components/ui/dialog.d.ts +13 -0
- package/dist/types/components/ui/dropdown-menu.d.ts +10 -0
- package/dist/types/components/ui/empty.d.ts +8 -0
- package/dist/types/components/ui/index.d.ts +12 -0
- package/dist/types/components/ui/input.d.ts +3 -0
- package/dist/types/components/ui/separator.d.ts +4 -0
- package/dist/types/components/ui/sheet.d.ts +14 -0
- package/dist/types/components/ui/sidebar.d.ts +69 -0
- package/dist/types/components/ui/skeleton.d.ts +2 -0
- package/dist/types/components/ui/tooltip.d.ts +7 -0
- package/dist/types/framework/ZangoApp.d.ts +19 -0
- package/dist/types/framework/components/CachedLogo.d.ts +9 -0
- package/dist/types/framework/components/CustomPageFallback.d.ts +13 -0
- package/dist/types/framework/components/CustomPageLoader.d.ts +10 -0
- package/dist/types/framework/components/DocumentHead.d.ts +5 -0
- package/dist/types/framework/components/RouteErrorBoundary.d.ts +16 -0
- package/dist/types/framework/components/SessionSecurityDialog.d.ts +10 -0
- package/dist/types/framework/components/SessionSecurityProvider.d.ts +8 -0
- package/dist/types/framework/components/SmartLink.d.ts +13 -0
- package/dist/types/framework/components/layout/AppSidebar.d.ts +36 -0
- package/dist/types/framework/components/layout/Breadcrumbs.d.ts +2 -0
- package/dist/types/framework/components/layout/CommandPalette.d.ts +2 -0
- package/dist/types/framework/components/layout/Layout.d.ts +2 -0
- package/dist/types/framework/components/layout/Navbar.d.ts +9 -0
- package/dist/types/framework/components/layout/NavbarIcon.d.ts +12 -0
- package/dist/types/framework/components/layout/Topbar.d.ts +50 -0
- package/dist/types/framework/components/layout/UserProfileDrawer.d.ts +7 -0
- package/dist/types/framework/components/layout/profile/PasswordCard.d.ts +18 -0
- package/dist/types/framework/components/layout/profile/PersonalInfoCard.d.ts +12 -0
- package/dist/types/framework/components/layout/profile/ProfileRail.d.ts +23 -0
- package/dist/types/framework/components/layout/profile/SessionsCard.d.ts +8 -0
- package/dist/types/framework/components/layout/profile/TokensCard.d.ts +11 -0
- package/dist/types/framework/components/layout/profile/TwoFactorCard.d.ts +7 -0
- package/dist/types/framework/config/defaultLayoutConfig.d.ts +34 -0
- package/dist/types/framework/constants/routes.d.ts +5 -0
- package/dist/types/framework/contexts/AppContext.d.ts +57 -0
- package/dist/types/framework/contexts/AuthConfigContext.d.ts +22 -0
- package/dist/types/framework/hooks/useProfileData.d.ts +73 -0
- package/dist/types/framework/hooks/useRoutes.d.ts +10 -0
- package/dist/types/framework/hooks/useSessionSecurity.d.ts +17 -0
- package/dist/types/framework/hooks/useSmartNavigation.d.ts +15 -0
- package/dist/types/framework/index.d.ts +35 -0
- package/dist/types/framework/pages/ConfigurePage.d.ts +2 -0
- package/dist/types/framework/pages/CrudPage.d.ts +6 -0
- package/dist/types/framework/pages/LoginPage.d.ts +5 -0
- package/dist/types/framework/pages/LogoutPage.d.ts +2 -0
- package/dist/types/framework/pages/NotFoundPage.d.ts +6 -0
- package/dist/types/framework/pages/TrainingPage.d.ts +6 -0
- package/dist/types/framework/routing/PageTypeRegistry.d.ts +43 -0
- package/dist/types/framework/routing/PageTypeRouter.d.ts +12 -0
- package/dist/types/framework/routing/dynamicPageRegistry.d.ts +41 -0
- package/dist/types/framework/routing/getRenderComponent.d.ts +6 -0
- package/dist/types/framework/types/layout.types.d.ts +107 -0
- package/dist/types/framework/utils/apiConfig.d.ts +41 -0
- package/dist/types/framework/utils/apiInterceptor.d.ts +12 -0
- package/dist/types/framework/utils/apiUrlUtils.d.ts +9 -0
- package/dist/types/framework/utils/authThemeUtils.d.ts +64 -0
- package/dist/types/framework/utils/colorUtils.d.ts +53 -0
- package/dist/types/framework/utils/cookieUtils.d.ts +20 -0
- package/dist/types/framework/utils/csrf.d.ts +27 -0
- package/dist/types/framework/utils/logoCache.d.ts +21 -0
- package/dist/types/framework/utils/logoutUtils.d.ts +15 -0
- package/dist/types/framework/utils/redirectUtils.d.ts +48 -0
- package/dist/types/framework/utils/safeRedirect.d.ts +21 -0
- package/dist/types/framework/utils/storageKeys.d.ts +44 -0
- package/dist/types/framework/utils/storageSanitizer.d.ts +20 -0
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/queries/index.d.ts +4 -0
- package/dist/types/hooks/queries/useAppInitQuery.d.ts +1 -0
- package/dist/types/hooks/queries/useAuthConfigQuery.d.ts +1 -0
- package/dist/types/hooks/queries/useProfileQuery.d.ts +8 -0
- package/dist/types/hooks/useBreakpoint.d.ts +2 -0
- package/dist/types/hooks/useMobile.d.ts +1 -0
- package/dist/types/index.d.ts +0 -0
- package/dist/types/index.framework.d.ts +39 -0
- package/dist/types/index.zango.d.ts +12 -0
- package/dist/types/lib/index.d.ts +1 -0
- package/dist/types/lib/utils.d.ts +2 -0
- package/dist/types/schemas/appInit.schema.d.ts +61 -0
- package/dist/types/schemas/index.d.ts +10 -0
- package/dist/types/schemas/profile.schema.d.ts +18 -0
- package/dist/types/schemas/route.schema.d.ts +9 -0
- package/dist/types/schemas/session.schema.d.ts +8 -0
- package/dist/types/schemas/theme.schema.d.ts +27 -0
- package/dist/types/services/api/index.d.ts +2 -0
- package/dist/types/services/api.d.ts +109 -0
- package/dist/types/services/index.d.ts +7 -0
- package/dist/types/services/legacyAdapter.d.ts +10 -0
- package/dist/types/services/logger.d.ts +32 -0
- package/dist/types/services/normalizeResponse.d.ts +29 -0
- package/dist/types/types/auth.d.ts +103 -0
- package/dist/types/types/common.d.ts +343 -0
- package/dist/types/types/index.d.ts +278 -0
- package/dist/zango-appbuilder.js +99 -0
- package/dist/zango-appbuilder.js.map +1 -0
- package/dist/zango-appbuilder.umd.cjs +247 -0
- package/dist/zango-appbuilder.umd.cjs.map +1 -0
- package/package.json +140 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
interface SmartLinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
|
|
3
|
+
to: string;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
onClick?: (e: MouseEvent<HTMLElement>) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* SmartLink component that automatically chooses between React Router Link
|
|
10
|
+
* and regular anchor tag based on the route availability
|
|
11
|
+
*/
|
|
12
|
+
export declare const SmartLink: React.ForwardRefExoticComponent<SmartLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MenuItemConfig } from '../../../types';
|
|
3
|
+
/** Typed config for AppSidebar's `config` prop */
|
|
4
|
+
interface AppSidebarConfig {
|
|
5
|
+
showLogo?: boolean;
|
|
6
|
+
showMenu?: boolean;
|
|
7
|
+
collapsible?: boolean;
|
|
8
|
+
customLogo?: React.ReactNode;
|
|
9
|
+
customMenuContent?: React.ReactNode;
|
|
10
|
+
customBottomContent?: React.ReactNode;
|
|
11
|
+
customNavbar?: React.ReactElement | null;
|
|
12
|
+
customMenu?: React.ReactNode;
|
|
13
|
+
theme?: 'light' | 'dark';
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
}
|
|
17
|
+
interface NavbarLogoProps {
|
|
18
|
+
appLogo?: string;
|
|
19
|
+
appName?: string;
|
|
20
|
+
linkTo?: string;
|
|
21
|
+
collapsed?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const NavbarLogo: React.FC<NavbarLogoProps>;
|
|
24
|
+
interface SidebarNavMenuProps {
|
|
25
|
+
menuItems?: MenuItemConfig[];
|
|
26
|
+
isDark?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare const SidebarNavMenu: React.FC<SidebarNavMenuProps>;
|
|
29
|
+
interface AppSidebarProps {
|
|
30
|
+
menuItems?: MenuItemConfig[];
|
|
31
|
+
appLogo?: string;
|
|
32
|
+
theme?: Record<string, unknown>;
|
|
33
|
+
config?: AppSidebarConfig;
|
|
34
|
+
}
|
|
35
|
+
export declare const AppSidebar: React.FC<AppSidebarProps>;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backward compatibility re-exports.
|
|
3
|
+
*
|
|
4
|
+
* The sidebar implementation has moved to AppSidebar.tsx (using shadcn/ui).
|
|
5
|
+
* This module preserves the public API so existing imports keep working:
|
|
6
|
+
*
|
|
7
|
+
* import { Navbar, NavbarLogo, NavbarMenu } from './Navbar';
|
|
8
|
+
*/
|
|
9
|
+
export { AppSidebar as Navbar, NavbarLogo, SidebarNavMenu as NavbarMenu } from './AppSidebar';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { MenuItemConfig } from '../../../types';
|
|
3
|
+
interface NavbarIconProps {
|
|
4
|
+
item: MenuItemConfig;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Renders a menu item icon. Handles SVG strings, emojis, and image URLs.
|
|
8
|
+
* Uses currentColor for SVG color inheritance — colors respond to
|
|
9
|
+
* hover/active states via CSS rather than imperative DOM manipulation.
|
|
10
|
+
*/
|
|
11
|
+
export declare const NavbarIcon: React.FC<NavbarIconProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/** Profile info shape from AppContext */
|
|
3
|
+
interface ProfileInfo {
|
|
4
|
+
name?: string;
|
|
5
|
+
profile_pic?: string;
|
|
6
|
+
current_role?: string;
|
|
7
|
+
user_role?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
/** Typed config for Topbar's `config` prop */
|
|
11
|
+
interface TopbarConfig {
|
|
12
|
+
showProfile?: boolean;
|
|
13
|
+
showLeftSection?: boolean;
|
|
14
|
+
showRightSection?: boolean;
|
|
15
|
+
showBreadcrumbs?: boolean;
|
|
16
|
+
customLeftContent?: React.ReactNode;
|
|
17
|
+
customRightContent?: React.ReactNode;
|
|
18
|
+
customProfileMenu?: React.ReactNode;
|
|
19
|
+
customViewProfile?: ((args: {
|
|
20
|
+
user?: ProfileInfo;
|
|
21
|
+
isOpen: boolean;
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
}) => React.ReactNode) | null;
|
|
24
|
+
theme?: 'light' | 'dark';
|
|
25
|
+
profileMenuConfig?: ProfileMenuConfig;
|
|
26
|
+
className?: string;
|
|
27
|
+
style?: React.CSSProperties;
|
|
28
|
+
}
|
|
29
|
+
interface ProfileMenuConfig {
|
|
30
|
+
showViewProfile?: boolean;
|
|
31
|
+
showLogout?: boolean;
|
|
32
|
+
showRoleSwitch?: boolean;
|
|
33
|
+
customMenuItems?: React.ReactNode[];
|
|
34
|
+
}
|
|
35
|
+
interface TopbarLogoutButtonProps {
|
|
36
|
+
onLogout: () => void;
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare const TopbarLogoutButton: React.FC<TopbarLogoutButtonProps>;
|
|
40
|
+
export declare const TopbarViewProfileButton: ({ onViewProfile, className, }: {
|
|
41
|
+
onViewProfile: () => void;
|
|
42
|
+
className?: string;
|
|
43
|
+
}) => React.ReactElement;
|
|
44
|
+
export declare const Topbar: ({ profileInfo, theme, config, hidden, }: {
|
|
45
|
+
profileInfo?: ProfileInfo;
|
|
46
|
+
theme?: Record<string, unknown>;
|
|
47
|
+
config?: TopbarConfig;
|
|
48
|
+
hidden?: boolean;
|
|
49
|
+
}) => React.ReactElement | null;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PasswordPolicy } from '../../../../types';
|
|
3
|
+
/** Extended policy with UI-level flags that the profile API returns */
|
|
4
|
+
interface ProfilePasswordPolicy extends PasswordPolicy {
|
|
5
|
+
allow_change?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface PasswordCardProps {
|
|
8
|
+
canSetPassword: boolean;
|
|
9
|
+
shouldSetPassword: boolean;
|
|
10
|
+
passwordPolicy: ProfilePasswordPolicy | null;
|
|
11
|
+
lastPasswordChange: string;
|
|
12
|
+
nextPasswordDue: string | null;
|
|
13
|
+
isMobile: boolean;
|
|
14
|
+
onServerMessage: (msg: string) => void;
|
|
15
|
+
onPasswordUpdated: () => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const PasswordCard: React.NamedExoticComponent<PasswordCardProps>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface PersonalInfoCardProps {
|
|
3
|
+
name: string;
|
|
4
|
+
email: string;
|
|
5
|
+
mobile: string;
|
|
6
|
+
originalName: string;
|
|
7
|
+
isMobile: boolean;
|
|
8
|
+
onNameSaved: (newName: string) => void;
|
|
9
|
+
onServerMessage: (msg: string) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const PersonalInfoCard: React.NamedExoticComponent<PersonalInfoCardProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface Role {
|
|
3
|
+
id: number;
|
|
4
|
+
name: string;
|
|
5
|
+
is_active: boolean;
|
|
6
|
+
is_default: boolean;
|
|
7
|
+
auth_config: {
|
|
8
|
+
redirect_url: string;
|
|
9
|
+
};
|
|
10
|
+
policies: number[];
|
|
11
|
+
policy_groups: number[];
|
|
12
|
+
}
|
|
13
|
+
interface ProfileRailProps {
|
|
14
|
+
name: string;
|
|
15
|
+
email: string;
|
|
16
|
+
currentRole: string;
|
|
17
|
+
roles: Role[];
|
|
18
|
+
profilePhoto: string | null;
|
|
19
|
+
isMobile: boolean;
|
|
20
|
+
onPhotoUpload: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const ProfileRail: React.FC<ProfileRailProps>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface Token {
|
|
3
|
+
role: string;
|
|
4
|
+
created: string;
|
|
5
|
+
expiry?: string;
|
|
6
|
+
}
|
|
7
|
+
interface TokensCardProps {
|
|
8
|
+
tokens: Token[];
|
|
9
|
+
}
|
|
10
|
+
export declare const TokensCard: React.NamedExoticComponent<TokensCardProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CustomComponentsType, LayoutConfigType, NavbarConfigType, TopbarConfigType } from '../types/layout.types';
|
|
2
|
+
/**
|
|
3
|
+
* Default Layout Configuration
|
|
4
|
+
*
|
|
5
|
+
* Provides default values for all layout configuration options.
|
|
6
|
+
* These defaults ensure backward compatibility and sensible fallbacks.
|
|
7
|
+
*/
|
|
8
|
+
export declare const defaultLayoutConfig: LayoutConfigType;
|
|
9
|
+
export declare const defaultTopbarConfig: TopbarConfigType;
|
|
10
|
+
export declare const defaultNavbarConfig: NavbarConfigType;
|
|
11
|
+
export declare const defaultCustomComponents: CustomComponentsType;
|
|
12
|
+
/**
|
|
13
|
+
* Merge configurations with defaults
|
|
14
|
+
* Deep merges user config with defaults to ensure all properties exist
|
|
15
|
+
*/
|
|
16
|
+
export declare function mergeWithDefaults<T>(userConfig: T, defaultConfig: T): T;
|
|
17
|
+
export declare function mergeWithDefaults(userConfig: Record<string, unknown>, defaultConfig: Record<string, unknown>): Record<string, unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* Get complete configuration
|
|
20
|
+
* Merges all user configurations with defaults
|
|
21
|
+
*/
|
|
22
|
+
interface GetCompleteConfigParams {
|
|
23
|
+
layoutConfig?: LayoutConfigType;
|
|
24
|
+
topbarConfig?: TopbarConfigType;
|
|
25
|
+
navbarConfig?: NavbarConfigType;
|
|
26
|
+
customComponents?: CustomComponentsType;
|
|
27
|
+
}
|
|
28
|
+
export declare const getCompleteConfig: ({ layoutConfig, topbarConfig, navbarConfig, customComponents, }?: GetCompleteConfigParams) => {
|
|
29
|
+
layout: LayoutConfigType;
|
|
30
|
+
topbar: TopbarConfigType;
|
|
31
|
+
navbar: NavbarConfigType;
|
|
32
|
+
components: CustomComponentsType;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { ApiConfig, AppConfig, AuthConfig, MenuItemConfig, RouteConfig, SessionSecurityConfig, ThemeConfig } from '../../types';
|
|
3
|
+
import { CustomComponentsType, LayoutConfigType, NavbarConfigType, TopbarConfigType } from '../types/layout.types';
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
app_initializer_endpoint?: string;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
interface AppData {
|
|
10
|
+
app_name?: string;
|
|
11
|
+
is_user_anonymous?: boolean;
|
|
12
|
+
routes?: RouteConfig[];
|
|
13
|
+
menu?: MenuItemConfig[];
|
|
14
|
+
profile_info?: Record<string, unknown>;
|
|
15
|
+
app_logo?: string;
|
|
16
|
+
metadata?: Record<string, unknown>;
|
|
17
|
+
theme?: ThemeConfig;
|
|
18
|
+
session_security?: SessionSecurityConfig;
|
|
19
|
+
session_security_config?: SessionSecurityConfig;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
interface AppContextType {
|
|
23
|
+
appData: AppData | null;
|
|
24
|
+
loading: boolean;
|
|
25
|
+
error: string | null;
|
|
26
|
+
config: AppConfig;
|
|
27
|
+
apiConfig: ApiConfig;
|
|
28
|
+
menu: MenuItemConfig[];
|
|
29
|
+
routes: RouteConfig[];
|
|
30
|
+
profileInfo: Record<string, unknown>;
|
|
31
|
+
appLogo: string;
|
|
32
|
+
appName: string;
|
|
33
|
+
metadata: Record<string, unknown>;
|
|
34
|
+
theme: ThemeConfig;
|
|
35
|
+
layoutConfig: LayoutConfigType;
|
|
36
|
+
topbarConfig: TopbarConfigType;
|
|
37
|
+
navbarConfig: NavbarConfigType;
|
|
38
|
+
customComponents: CustomComponentsType;
|
|
39
|
+
authConfig: AuthConfig;
|
|
40
|
+
sessionSecurity: SessionSecurityConfig | null;
|
|
41
|
+
pageTypeRegistry: Record<string, unknown> | null;
|
|
42
|
+
registryLoading: boolean;
|
|
43
|
+
registryError: string | null;
|
|
44
|
+
initializerEndpoint: string;
|
|
45
|
+
}
|
|
46
|
+
interface AppProviderProps {
|
|
47
|
+
children: ReactNode;
|
|
48
|
+
config?: AppConfig;
|
|
49
|
+
layoutConfig?: LayoutConfigType;
|
|
50
|
+
topbarConfig?: TopbarConfigType;
|
|
51
|
+
navbarConfig?: NavbarConfigType;
|
|
52
|
+
customComponents?: CustomComponentsType;
|
|
53
|
+
authConfig?: AuthConfig;
|
|
54
|
+
}
|
|
55
|
+
export declare const useAppContext: () => AppContextType;
|
|
56
|
+
export declare const AppProvider: React.FC<AppProviderProps>;
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { AuthConfig } from '../../types';
|
|
3
|
+
interface AuthConfigContextType {
|
|
4
|
+
authConfig: AuthConfig;
|
|
5
|
+
getLoginConfig: () => AuthConfig['login'];
|
|
6
|
+
getRoleSelectionConfig: () => AuthConfig['roleSelection'];
|
|
7
|
+
getTwoFactorConfig: () => AuthConfig['twoFactor'];
|
|
8
|
+
getResetPasswordConfig: () => AuthConfig['resetPassword'];
|
|
9
|
+
getThemeConfig: () => AuthConfig['theme'];
|
|
10
|
+
getCardConfig: () => AuthConfig['card'];
|
|
11
|
+
getLogoConfig: () => AuthConfig['logo'];
|
|
12
|
+
getProvidersConfig: () => AuthConfig['providers'];
|
|
13
|
+
getMessagesConfig: () => AuthConfig['messages'];
|
|
14
|
+
getCustomComponents: () => AuthConfig['customComponents'];
|
|
15
|
+
}
|
|
16
|
+
interface AuthConfigProviderProps {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
authConfig?: AuthConfig;
|
|
19
|
+
}
|
|
20
|
+
export declare const useAuthConfig: () => AuthConfigContextType;
|
|
21
|
+
export declare const AuthConfigProvider: React.FC<AuthConfigProviderProps>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
interface ProfileData {
|
|
2
|
+
name: string;
|
|
3
|
+
email: string;
|
|
4
|
+
mobile: string;
|
|
5
|
+
profile_pic: string | null;
|
|
6
|
+
last_password_changed?: string;
|
|
7
|
+
roles: Array<{
|
|
8
|
+
id: number;
|
|
9
|
+
name: string;
|
|
10
|
+
is_active: boolean;
|
|
11
|
+
is_default: boolean;
|
|
12
|
+
auth_config: {
|
|
13
|
+
redirect_url: string;
|
|
14
|
+
};
|
|
15
|
+
policies: number[];
|
|
16
|
+
policy_groups: number[];
|
|
17
|
+
}>;
|
|
18
|
+
auth_config: {
|
|
19
|
+
login_methods: Record<string, unknown>;
|
|
20
|
+
password_policy: {
|
|
21
|
+
reset: {
|
|
22
|
+
method: string[];
|
|
23
|
+
enabled: boolean;
|
|
24
|
+
expiry_hours: number;
|
|
25
|
+
};
|
|
26
|
+
min_length: number;
|
|
27
|
+
allow_change: boolean;
|
|
28
|
+
require_numbers: boolean;
|
|
29
|
+
require_lowercase: boolean;
|
|
30
|
+
require_uppercase: boolean;
|
|
31
|
+
password_expiry_days: number;
|
|
32
|
+
require_special_chars: boolean;
|
|
33
|
+
password_history_count: number;
|
|
34
|
+
};
|
|
35
|
+
two_factor_auth: {
|
|
36
|
+
required: boolean;
|
|
37
|
+
can_enable: boolean;
|
|
38
|
+
can_disable?: boolean;
|
|
39
|
+
issue?: string;
|
|
40
|
+
};
|
|
41
|
+
redirect_url: string;
|
|
42
|
+
};
|
|
43
|
+
password_policy: {
|
|
44
|
+
reset: {
|
|
45
|
+
method: string[];
|
|
46
|
+
enabled: boolean;
|
|
47
|
+
expiry_hours: number;
|
|
48
|
+
};
|
|
49
|
+
min_length: number;
|
|
50
|
+
allow_change: boolean;
|
|
51
|
+
require_numbers: boolean;
|
|
52
|
+
require_lowercase: boolean;
|
|
53
|
+
require_uppercase: boolean;
|
|
54
|
+
password_expiry_days: number;
|
|
55
|
+
require_special_chars: boolean;
|
|
56
|
+
password_history_count: number;
|
|
57
|
+
};
|
|
58
|
+
tokens: unknown[];
|
|
59
|
+
}
|
|
60
|
+
interface UseProfileDataReturn {
|
|
61
|
+
profileData: ProfileData | null;
|
|
62
|
+
loading: boolean;
|
|
63
|
+
error: string | null;
|
|
64
|
+
refetch: () => void;
|
|
65
|
+
shouldSetPassword: boolean;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Custom hook for fetching user profile data from the API
|
|
69
|
+
* @param shouldFetch - Whether to automatically fetch data on mount
|
|
70
|
+
* @returns Profile data, loading state, error state, and refetch function
|
|
71
|
+
*/
|
|
72
|
+
export declare const useProfileData: (shouldFetch?: boolean) => UseProfileDataReturn;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RouteConfig } from '../../types';
|
|
2
|
+
interface UseRoutesReturn {
|
|
3
|
+
routes: RouteConfig[];
|
|
4
|
+
pageTypeRegistry: Record<string, unknown> | null;
|
|
5
|
+
registryLoading: boolean;
|
|
6
|
+
registryError: string | null;
|
|
7
|
+
isValidRoute: (path: string) => boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const useRoutes: () => UseRoutesReturn;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SessionSecurityConfig } from '../../types';
|
|
2
|
+
interface UseSessionSecurityOptions {
|
|
3
|
+
config: SessionSecurityConfig;
|
|
4
|
+
onExpire?: () => void;
|
|
5
|
+
onWarning?: () => void;
|
|
6
|
+
onActivity?: () => void;
|
|
7
|
+
}
|
|
8
|
+
interface UseSessionSecurityReturn {
|
|
9
|
+
showWarning: boolean;
|
|
10
|
+
countdown: number;
|
|
11
|
+
hideWarning: () => void;
|
|
12
|
+
dismissWarning: () => void;
|
|
13
|
+
renewSession: () => void;
|
|
14
|
+
logoutNow: () => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const useSessionSecurity: ({ config, onExpire, onWarning, onActivity, }: UseSessionSecurityOptions) => UseSessionSecurityReturn;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface NavigationOptions {
|
|
2
|
+
replace?: boolean;
|
|
3
|
+
state?: unknown;
|
|
4
|
+
newTab?: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface SmartNavigationReturn {
|
|
7
|
+
navigateTo: (path: string, options?: NavigationOptions) => void;
|
|
8
|
+
isInternalRoute: (path: string) => boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Custom hook for smart navigation that handles both React Router routes
|
|
12
|
+
* and external navigation based on available routes from API
|
|
13
|
+
*/
|
|
14
|
+
export declare const useSmartNavigation: () => SmartNavigationReturn;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zango CRM React App Framework
|
|
3
|
+
*
|
|
4
|
+
* Main entry point for framework exports with composable architecture
|
|
5
|
+
*/
|
|
6
|
+
export * from '../services/api';
|
|
7
|
+
export { CachedLogo } from './components/CachedLogo';
|
|
8
|
+
export { CustomPageFallback } from './components/CustomPageFallback';
|
|
9
|
+
export { CustomPageLoader } from './components/CustomPageLoader';
|
|
10
|
+
export { DocumentHead } from './components/DocumentHead';
|
|
11
|
+
export { Layout } from './components/layout/Layout';
|
|
12
|
+
export { Navbar, NavbarLogo, NavbarMenu, } from './components/layout/Navbar';
|
|
13
|
+
export { Topbar, TopbarLogoutButton, TopbarViewProfileButton, } from './components/layout/Topbar';
|
|
14
|
+
export { UserProfileDrawer } from './components/layout/UserProfileDrawer';
|
|
15
|
+
export { SmartLink } from './components/SmartLink';
|
|
16
|
+
export { defaultCustomComponents, defaultLayoutConfig, defaultNavbarConfig, defaultTopbarConfig, getCompleteConfig, mergeWithDefaults, } from './config/defaultLayoutConfig';
|
|
17
|
+
export { AppProvider, useAppContext } from './contexts/AppContext';
|
|
18
|
+
export { useSmartNavigation } from './hooks/useSmartNavigation';
|
|
19
|
+
export { CrudPage } from './pages/CrudPage';
|
|
20
|
+
export { LoginPage } from './pages/LoginPage';
|
|
21
|
+
export { LogoutPage } from './pages/LogoutPage';
|
|
22
|
+
export { NotFoundPage } from './pages/NotFoundPage';
|
|
23
|
+
export { pageTypeRegistry } from './routing/PageTypeRegistry';
|
|
24
|
+
export { PageTypeRouter } from './routing/PageTypeRouter';
|
|
25
|
+
export type { AppConfigurationType, CustomComponentsType, LayoutConfigType, NavbarConfigType, TopbarConfigType, } from './types/layout.types';
|
|
26
|
+
export { getApiConfig, getBaseUrl, resolveApiUrl, useApiConfig, useRouteConfig, } from './utils/apiConfig';
|
|
27
|
+
export { buildApiUrl } from './utils/apiUrlUtils';
|
|
28
|
+
export { generateCSSVariables, getColor } from './utils/colorUtils';
|
|
29
|
+
export { deleteCookie } from './utils/cookieUtils';
|
|
30
|
+
export { getCsrfToken, getCsrfTokenForRequest, setCsrfToken, validateCsrfToken, } from './utils/csrf';
|
|
31
|
+
export { logoCache } from './utils/logoCache';
|
|
32
|
+
export { getNextParam, getValidRedirectUrl, validateRedirectUrl, } from './utils/redirectUtils';
|
|
33
|
+
export { safeNavigate, safeWindowRedirect, safeWindowReplace, } from './utils/safeRedirect';
|
|
34
|
+
export { getSafeSessionStorage, removeSafeSessionStorage, sanitizeForStorage, setSafeSessionStorage, } from './utils/storageSanitizer';
|
|
35
|
+
export { ZangoApp } from './ZangoApp';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface PageComponentProps {
|
|
3
|
+
basePath?: string;
|
|
4
|
+
matchedRoutePath?: string;
|
|
5
|
+
pageType?: string;
|
|
6
|
+
apiConfig?: {
|
|
7
|
+
apiUrl?: string;
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
};
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
interface CustomPageHandlerParams {
|
|
13
|
+
customPages: Record<string, React.ComponentType<Record<string, unknown>>>;
|
|
14
|
+
customPagePath: string;
|
|
15
|
+
location: Location;
|
|
16
|
+
matchedRoute?: {
|
|
17
|
+
path: string | null;
|
|
18
|
+
component?: string;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
} | null;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
export interface PageTypeConfig {
|
|
24
|
+
component?: React.ComponentType<PageComponentProps> | null;
|
|
25
|
+
includeBasePath?: boolean;
|
|
26
|
+
standalone?: boolean;
|
|
27
|
+
propsBuilder?: (params: PageComponentProps) => Record<string, unknown>;
|
|
28
|
+
handler?: (params: CustomPageHandlerParams) => React.ReactElement;
|
|
29
|
+
}
|
|
30
|
+
interface PageTypeRegistry {
|
|
31
|
+
[key: string]: PageTypeConfig;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Page Type Registry - Centralized configuration for all page types
|
|
35
|
+
*
|
|
36
|
+
* Each page type can have:
|
|
37
|
+
* - component: The React component to render
|
|
38
|
+
* - includeBasePath: Whether to pass basePath prop (defaults to true)
|
|
39
|
+
* - propsBuilder: Function to build additional props
|
|
40
|
+
* - handler: Custom rendering function (overrides component)
|
|
41
|
+
*/
|
|
42
|
+
export declare const pageTypeRegistry: PageTypeRegistry;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { RouteConfig } from '../../types';
|
|
3
|
+
interface PageTypeRouterProps {
|
|
4
|
+
customPages?: Record<string, React.ComponentType>;
|
|
5
|
+
forceRoute?: RouteConfig;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* PageTypeRouter - Dynamic routing component that determines which page component to render
|
|
9
|
+
* based on the current URL and route configuration from the API
|
|
10
|
+
*/
|
|
11
|
+
export declare const PageTypeRouter: React.FC<PageTypeRouterProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface PageTypeConfig {
|
|
3
|
+
component?: React.ComponentType<Record<string, unknown>> | React.LazyExoticComponent<React.ComponentType<Record<string, unknown>>> | null;
|
|
4
|
+
includeBasePath?: boolean;
|
|
5
|
+
standalone?: boolean;
|
|
6
|
+
propsBuilder?: (params: Record<string, unknown>) => Record<string, unknown>;
|
|
7
|
+
handler?: (params: Record<string, unknown>) => React.ReactElement;
|
|
8
|
+
}
|
|
9
|
+
interface PageTypeRegistry {
|
|
10
|
+
[key: string]: PageTypeConfig;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create dynamic page registry based on available packages and requested page types
|
|
14
|
+
*/
|
|
15
|
+
export declare const createDynamicPageRegistry: (requestedPageTypes?: string[]) => Promise<PageTypeRegistry>;
|
|
16
|
+
/**
|
|
17
|
+
* Extract unique page types from route configuration
|
|
18
|
+
*/
|
|
19
|
+
export declare const extractPageTypesFromRoutes: (routes: Array<{
|
|
20
|
+
page_type: string;
|
|
21
|
+
}>) => string[];
|
|
22
|
+
/**
|
|
23
|
+
* Create registry based on API route configuration
|
|
24
|
+
*/
|
|
25
|
+
export declare const createRegistryFromRoutes: (routes: Array<{
|
|
26
|
+
page_type: string;
|
|
27
|
+
}>) => Promise<PageTypeRegistry>;
|
|
28
|
+
/**
|
|
29
|
+
* Validate that a registry has the required page type
|
|
30
|
+
*/
|
|
31
|
+
export declare const hasPageType: (registry: PageTypeRegistry, pageType: string) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Get registry statistics for debugging
|
|
34
|
+
*/
|
|
35
|
+
export declare const getRegistryStats: (registry: PageTypeRegistry) => {
|
|
36
|
+
totalPages: number;
|
|
37
|
+
dynamicPages: number;
|
|
38
|
+
staticPages: string[];
|
|
39
|
+
availablePageTypes: string[];
|
|
40
|
+
};
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PageTypeConfig } from './PageTypeRegistry';
|
|
3
|
+
/**
|
|
4
|
+
* Get the appropriate component to render based on page type
|
|
5
|
+
*/
|
|
6
|
+
export declare const getRenderComponent: (pageType: string | null, registry: Record<string, PageTypeConfig>, context: Record<string, unknown>) => React.ReactElement;
|