@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,6 @@
1
+ interface LoginContextType {
2
+ onLogin: (result: unknown) => void;
3
+ }
4
+ export declare const LoginContext: import('react').Context<LoginContextType | null>;
5
+ export declare const useLoginContext: () => LoginContextType | null;
6
+ export {};
@@ -0,0 +1,35 @@
1
+ import { default as React } from 'react';
2
+ interface WithMultiStepAuthOptions {
3
+ logo?: React.ReactNode;
4
+ roleSelectionTitle?: string;
5
+ roleSelectionSubtitle?: string;
6
+ twoFactorTitle?: string;
7
+ twoFactorSubtitle?: string;
8
+ passwordResetTitle?: string;
9
+ passwordResetSubtitle?: string;
10
+ }
11
+ /**
12
+ * Higher-Order Component that wraps custom login pages to provide automatic
13
+ * multi-step authentication handling (role selection, 2FA, password reset).
14
+ *
15
+ * @param CustomLoginCard - The custom login page component
16
+ * @param options - Optional configuration for auth flow screens
17
+ * @returns Wrapped component with multi-step auth support
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * const MyLogin = () => (
22
+ * <div>
23
+ * <OTPLoginForm />
24
+ * <SSOButtons />
25
+ * </div>
26
+ * );
27
+ *
28
+ * export default withMultiStepAuth(MyLogin, {
29
+ * logo: <img src="/logo.png" />,
30
+ * roleSelectionTitle: "Choose Your Role"
31
+ * });
32
+ * ```
33
+ */
34
+ export declare const withMultiStepAuth: (CustomLoginCard: React.ComponentType<Record<string, unknown>>, options?: WithMultiStepAuthOptions) => (props: Record<string, unknown>) => React.JSX.Element;
35
+ export {};
@@ -0,0 +1,23 @@
1
+ export { AuthProvider } from './components/AuthProvider';
2
+ export { OTPLoginForm, PasswordLoginForm, SSOButtons } from './components/composable';
3
+ export { DynamicLoginForm } from './components/DynamicLoginForm';
4
+ export { ForgotPasswordForm } from './components/ForgotPasswordForm';
5
+ export { LoginForm } from './components/LoginForm';
6
+ export { LoginRouter } from './components/LoginRouter';
7
+ export { OAuthCallback } from './components/OAuthCallback';
8
+ export { OTPForm } from './components/OTPForm';
9
+ export { OTPInput } from './components/OTPInput';
10
+ export { PasswordResetRequired } from './components/PasswordResetRequired';
11
+ export { ProviderButton } from './components/ProviderButton';
12
+ export { ResetPasswordForm } from './components/ResetPasswordForm';
13
+ export { RoleSelection } from './components/RoleSelection';
14
+ export { SecondFactorAuth } from './components/SecondFactorAuth';
15
+ export { LoginContext, useLoginContext } from './contexts/LoginContext';
16
+ export { useAuth } from './hooks/useAuth';
17
+ export { CompleteAuthFlow } from './pages/CompleteAuthFlow';
18
+ export { LoginPage } from './pages/LoginPage';
19
+ export { LoginPageWithRoleSelection } from './pages/LoginPageWithRoleSelection';
20
+ export { OAuthCallbackPage } from './pages/OAuthCallbackPage';
21
+ export { SAMLCallbackPage } from './pages/SAMLCallbackPage';
22
+ export * from './services/authService';
23
+ export * from './utils/authUtils';
@@ -0,0 +1,24 @@
1
+ import { default as React } from 'react';
2
+ import { ApiConfig, AuthConfig, AuthResult, PendingAuthResult } from '../../types';
3
+ interface CompleteAuthFlowProps {
4
+ logo?: React.ReactNode;
5
+ title?: string;
6
+ subtitle?: string;
7
+ apiConfig?: ApiConfig;
8
+ useDynamicConfig?: boolean;
9
+ staticConfig?: AuthConfig;
10
+ onAuthComplete: (result: AuthResult) => void;
11
+ roleSelectionTitle?: string;
12
+ roleSelectionSubtitle?: string;
13
+ twoFactorTitle?: string;
14
+ twoFactorSubtitle?: string;
15
+ passwordResetTitle?: string;
16
+ passwordResetSubtitle?: string;
17
+ initialAuthState?: PendingAuthResult;
18
+ redirectPath?: string;
19
+ initialRedirectUrl?: string | null;
20
+ skipLoginStep?: boolean;
21
+ initialNextParam?: string | null;
22
+ }
23
+ export declare const CompleteAuthFlow: React.FC<CompleteAuthFlowProps>;
24
+ export {};
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { LoginPageProps } from '../types';
3
+ interface ExtendedLoginPageProps extends LoginPageProps {
4
+ useDynamicConfig?: boolean;
5
+ staticConfig?: Record<string, unknown> | null;
6
+ }
7
+ export declare const LoginPage: React.FC<ExtendedLoginPageProps>;
8
+ export {};
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ export declare const LoginPageWithRoleSelection: ({ logo, title, subtitle, apiConfig, useDynamicConfig, staticConfig, onLoginSuccess, roleSelectionTitle, roleSelectionSubtitle, initialAuthResult, }: {
3
+ logo?: React.ReactNode;
4
+ title?: string;
5
+ subtitle?: string;
6
+ apiConfig?: Record<string, unknown>;
7
+ useDynamicConfig?: boolean;
8
+ staticConfig?: Record<string, unknown> | null;
9
+ onLoginSuccess?: (result: unknown) => void;
10
+ roleSelectionTitle?: string;
11
+ roleSelectionSubtitle?: string;
12
+ initialAuthResult?: unknown;
13
+ }) => React.JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ import { AuthResult } from '../../types';
3
+ import { ApiConfig } from '../types';
4
+ interface OAuthCallbackPageProps {
5
+ logo?: React.ReactNode;
6
+ apiConfig?: ApiConfig;
7
+ onAuthComplete?: (result: AuthResult) => void;
8
+ roleSelectionTitle?: string;
9
+ roleSelectionSubtitle?: string;
10
+ twoFactorTitle?: string;
11
+ twoFactorSubtitle?: string;
12
+ passwordResetTitle?: string;
13
+ passwordResetSubtitle?: string;
14
+ redirectPath?: string;
15
+ }
16
+ export declare const OAuthCallbackPage: React.FC<OAuthCallbackPageProps>;
17
+ export {};
@@ -0,0 +1,16 @@
1
+ import { default as React } from 'react';
2
+ import { AuthResult } from '../../types';
3
+ interface SAMLCallbackPageProps {
4
+ logo?: React.ReactNode;
5
+ title?: string;
6
+ subtitle?: string;
7
+ onAuthComplete?: (result: AuthResult) => void;
8
+ roleSelectionTitle?: string;
9
+ roleSelectionSubtitle?: string;
10
+ twoFactorTitle?: string;
11
+ twoFactorSubtitle?: string;
12
+ passwordResetTitle?: string;
13
+ passwordResetSubtitle?: string;
14
+ }
15
+ export declare const SAMLCallbackPage: React.FC<SAMLCallbackPageProps>;
16
+ export {};
@@ -0,0 +1,87 @@
1
+ import { LoginCredentials } from '../../types';
2
+ import { LoginSuccessResponse } from './network';
3
+ import { clearSamlSessionToken, getSAMLAuthMeta, getSamlSessionToken, initiateSAMLAuth, oauthRedirect, processOAuthCallback, setRole } from './internal/oauthSamlService';
4
+ export declare const authService: {
5
+ getAuthConfig(): Promise<Record<string, unknown>>;
6
+ getConfig(): Record<string, unknown> | null;
7
+ isPasswordLoginEnabled(): boolean;
8
+ isOTPLoginEnabled(): boolean;
9
+ isSSOEnabled(): boolean;
10
+ isOIDCEnabled(): boolean;
11
+ getOIDCProviders(): {};
12
+ getSSOProviders(): {};
13
+ getAllowedUsernames(): string[];
14
+ getOtpAllowedUsernames(): string[];
15
+ /**
16
+ * Identifier types to show for a given login method.
17
+ *
18
+ * Password and OTP draw their identifiers from different parts of the config
19
+ * — password from `login_methods.password.allowed_usernames`, OTP from
20
+ * `login_methods.otp.allowed_methods`. Callers that render either method were
21
+ * reaching for `getAllowedUsernames()` regardless, so an SMS-only OTP config
22
+ * still showed an email tab. Route method-dependent lookups through here so
23
+ * the choice is made in one place.
24
+ */
25
+ getAllowedUsernamesForMethod(method: "password" | "otp"): string[];
26
+ /**
27
+ * The login methods this deployment permits, in the order the UI offers them.
28
+ * Use instead of calling each `is*Enabled()` getter separately, so a screen
29
+ * cannot check three of the four and silently ignore the rest.
30
+ */
31
+ getEnabledLoginMethods(): Array<"password" | "otp" | "sso" | "oidc">;
32
+ isForgotPasswordEnabled(): boolean;
33
+ getPasswordResetLinkExpiry(): number;
34
+ getSessionPolicy(): {};
35
+ isRememberMeEnabled(): boolean;
36
+ getRememberMeDurationDays(): number;
37
+ getPasswordPolicy(): {};
38
+ getPasswordResetMethods(): import('./network').PasswordResetPolicyMethodEnum[];
39
+ isPasswordResetEnabled(): boolean;
40
+ getPasswordResetExpiry(): number;
41
+ isTwoFactorRequired(): boolean;
42
+ getTwoFactorMethods(): import('./network').TwoFactorAuthAllowedMethodsEnum[];
43
+ getTwoFactorHooks(): {
44
+ email: string | undefined;
45
+ sms: string | undefined;
46
+ };
47
+ login(credentials: LoginCredentials, _config?: Record<string, unknown>): Promise<Record<string, unknown> | LoginSuccessResponse | import('./network').LoginSuccessResponseAllOfResponse>;
48
+ logout(_config?: {}): Promise<void>;
49
+ getCurrentUser(): Promise<{
50
+ authenticated: boolean;
51
+ }>;
52
+ verifyToken(_token: string, _config?: {}): Promise<{
53
+ authenticated: boolean;
54
+ }>;
55
+ forgotPassword(data: {
56
+ email?: string;
57
+ phone?: string;
58
+ } | string): Promise<any>;
59
+ requestPasswordReset(data: {
60
+ email?: string;
61
+ phone?: string;
62
+ }): Promise<any>;
63
+ validatePasswordResetKey(key: string): Promise<any>;
64
+ confirmResetPassword(data: {
65
+ key: string;
66
+ password: string;
67
+ }): Promise<any>;
68
+ fetchLoginMethods(): Promise<{}>;
69
+ requestOTP(identifier: string): Promise<void | Record<string, unknown> | import('./network').LoginOTPResponseAllOfResponse | import('./network').LoginOTPResponseAllOfResponseData>;
70
+ verifyOTP(_identifier: string, otp: string): Promise<Record<string, unknown> | import('./network').LoginOTPResponseAllOfResponse | LoginSuccessResponse>;
71
+ selectRole(roleId: string): Promise<any>;
72
+ sendTwoFactorCode(method?: string): Promise<import('./network').GetMfaCodeResponse>;
73
+ verifyTwoFactorCode(code: string): Promise<LoginSuccessResponse>;
74
+ changePassword(currentPassword: string, newPassword: string): Promise<import('./network').SuccessResponse>;
75
+ setPassword(newPassword: string): Promise<Record<string, unknown> | import('./network').SetPassword200Response>;
76
+ processOAuthCallback: typeof processOAuthCallback;
77
+ clearConfig(): void;
78
+ isAuthenticated(): Promise<boolean>;
79
+ validatePassword(password: string): import('./internal/passwordValidator').PasswordValidationResult;
80
+ oauthRedirect: typeof oauthRedirect;
81
+ getUserProfile(): Promise<import('./network').ProfileResponse>;
82
+ initiateSAMLAuth: typeof initiateSAMLAuth;
83
+ getSAMLAuthMeta: typeof getSAMLAuthMeta;
84
+ setRole: typeof setRole;
85
+ clearSamlSessionToken: typeof clearSamlSessionToken;
86
+ getSamlSessionToken: typeof getSamlSessionToken;
87
+ };
@@ -0,0 +1,9 @@
1
+ import { ApplicationConfigurationApi, AuthenticationApi, Configuration, LoginWithOTPApi, MultiFactorAuthenticationApi, OAuthApi, PasswordManagementApi, RoleManagementApi } from '../network';
2
+ export declare const apiConfig: Configuration;
3
+ export declare const authApi: AuthenticationApi;
4
+ export declare const configApi: ApplicationConfigurationApi;
5
+ export declare const otpApi: LoginWithOTPApi;
6
+ export declare const mfaApi: MultiFactorAuthenticationApi;
7
+ export declare const passwordApi: PasswordManagementApi;
8
+ export declare const roleApi: RoleManagementApi;
9
+ export declare const oauthApi: OAuthApi;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Shared mutable state for authService.
3
+ *
4
+ * Why an object: `let` exports become snapshots when imported, breaking
5
+ * cross-module mutation. Wrapping state on an object keeps a single source
6
+ * of truth that all sub-modules can read AND write to.
7
+ */
8
+ export declare const authState: {
9
+ config: Record<string, unknown> | null;
10
+ configPromise: Promise<Record<string, unknown>> | null;
11
+ samlSessionToken: string | null;
12
+ };
@@ -0,0 +1 @@
1
+ export declare const extractErrorMessage: (error: unknown) => string;
@@ -0,0 +1,46 @@
1
+ import { RawAxiosRequestConfig } from 'axios';
2
+ import { LoginSuccessResponse, OauthCallbackProviderEnum, OauthRedirectProviderEnum } from '../network';
3
+ /**
4
+ * Process the callback from an OAuth provider (Google, etc).
5
+ * Returns either the login data or a multi-step auth response.
6
+ */
7
+ export declare function processOAuthCallback(provider: OauthCallbackProviderEnum, state: string, code: string, scope: string, authUser?: string, hd?: string, prompt?: string, options?: RawAxiosRequestConfig): Promise<LoginSuccessResponse | import('../network').LoginSuccessResponseAllOfResponse | import('../network').LoginSuccessResponseAllOfResponseData | {
8
+ status?: number;
9
+ data?: {
10
+ next_step?: unknown;
11
+ };
12
+ } | {
13
+ success?: boolean;
14
+ response?: {
15
+ status?: number;
16
+ data?: {
17
+ next_step?: unknown;
18
+ };
19
+ };
20
+ data?: {
21
+ next_step?: unknown;
22
+ };
23
+ }>;
24
+ /**
25
+ * Initiate OAuth redirect to the provider.
26
+ * Optionally encodes a `next` parameter so the backend can resume after callback.
27
+ */
28
+ export declare function oauthRedirect(provider: OauthRedirectProviderEnum, callbackUrl: string, nextParam?: string | null): Promise<import('../network').OAuthRedirectResponse>;
29
+ /**
30
+ * Initiate SAML SSO flow. Returns a redirect URL to the IdP.
31
+ */
32
+ export declare function initiateSAMLAuth(samlId: string, nextParam?: string | null): Promise<any>;
33
+ /**
34
+ * Get authentication metadata from a SAML callback (token + request_id).
35
+ * Stores the SAML session token if present, since the SAML flow may not set
36
+ * the sessionid cookie immediately.
37
+ */
38
+ export declare function getSAMLAuthMeta(token: string, requestId: string): Promise<any>;
39
+ /**
40
+ * Set the user's role after multi-step authentication.
41
+ * Includes the SAML session token header if available (SAML flow may not
42
+ * have set the sessionid cookie yet).
43
+ */
44
+ export declare function setRole(roleId: string): Promise<any>;
45
+ export declare function clearSamlSessionToken(): void;
46
+ export declare function getSamlSessionToken(): string | null;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Validate a password against a policy from auth config.
3
+ */
4
+ type PasswordPolicy = {
5
+ min_length?: number;
6
+ max_length?: number;
7
+ require_numbers?: boolean;
8
+ require_lowercase?: boolean;
9
+ require_uppercase?: boolean;
10
+ require_special_chars?: boolean;
11
+ };
12
+ export interface PasswordValidationResult {
13
+ valid: boolean;
14
+ errors: string[];
15
+ }
16
+ export declare const validatePasswordAgainstPolicy: (password: string, policy: PasswordPolicy) => PasswordValidationResult;
17
+ export {};