@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,343 @@
1
+ /**
2
+ * Common type definitions for the application
3
+ * Reduces the need for `any` types
4
+ */
5
+ /**
6
+ * Generic API response wrapper (auth-specific variant with optional response)
7
+ */
8
+ export interface AuthApiEnvelope<T = unknown> {
9
+ success: boolean;
10
+ response?: T;
11
+ message?: string;
12
+ errors?: Record<string, string[]>;
13
+ }
14
+ /**
15
+ * Paginated response
16
+ */
17
+ export interface PaginatedResponse<T> {
18
+ count: number;
19
+ next: string | null;
20
+ previous: string | null;
21
+ results: T[];
22
+ }
23
+ /**
24
+ * ID-only reference
25
+ */
26
+ export interface Ref {
27
+ id: string | number;
28
+ }
29
+ /**
30
+ * Timestamp fields
31
+ */
32
+ export interface Timestamps {
33
+ created_at: string;
34
+ updated_at: string;
35
+ }
36
+ /**
37
+ * Common metadata
38
+ */
39
+ export interface Metadata {
40
+ [key: string]: string | number | boolean | null;
41
+ }
42
+ /**
43
+ * Form field error
44
+ */
45
+ export interface FieldError {
46
+ field: string;
47
+ message: string;
48
+ }
49
+ /**
50
+ * Validation result
51
+ */
52
+ export interface ValidationResult {
53
+ valid: boolean;
54
+ errors: FieldError[];
55
+ }
56
+ /**
57
+ * API client configuration (for direct API clients)
58
+ */
59
+ export interface ApiClientConfig {
60
+ baseUrl: string;
61
+ apiVersion?: string;
62
+ timeout?: number;
63
+ headers?: Record<string, string>;
64
+ }
65
+ /**
66
+ * Request options
67
+ */
68
+ export interface RequestOptions {
69
+ headers?: Record<string, string>;
70
+ params?: Record<string, string | number | boolean>;
71
+ timeout?: number;
72
+ }
73
+ /**
74
+ * API error response
75
+ */
76
+ export interface ApiErrorResponse {
77
+ message: string;
78
+ code?: string;
79
+ details?: Record<string, unknown>;
80
+ status: number;
81
+ }
82
+ /**
83
+ * Generic API handler response
84
+ */
85
+ export type ApiHandlerResponse<T> = AuthApiEnvelope<T> & {
86
+ responseStatus?: number;
87
+ errorType?: string;
88
+ };
89
+ /**
90
+ * Nested API response shape returned by authService methods.
91
+ * The auth API wraps data in several envelope formats depending on the
92
+ * HTTP status and whether the response came through axios or fetch.
93
+ */
94
+ export interface AuthApiResponse {
95
+ status?: number;
96
+ data?: AuthResponseData;
97
+ response?: {
98
+ status?: number;
99
+ data?: AuthResponseData;
100
+ meta?: {
101
+ is_authenticated?: boolean;
102
+ };
103
+ };
104
+ meta?: {
105
+ is_authenticated?: boolean;
106
+ };
107
+ next_step?: AuthNextStep;
108
+ redirect_url?: string;
109
+ token?: string;
110
+ user?: AuthUser;
111
+ loginUser?: AuthUser;
112
+ roles?: UserRole[];
113
+ requires2FA?: boolean;
114
+ twoFactorMethods?: string[];
115
+ requiresPasswordReset?: boolean;
116
+ passwordResetReason?: string;
117
+ requiresOTP?: boolean;
118
+ authenticated?: boolean;
119
+ [key: string]: unknown;
120
+ }
121
+ interface AuthResponseData {
122
+ next_step?: AuthNextStep;
123
+ redirect_url?: string;
124
+ token?: string;
125
+ user?: AuthUser;
126
+ meta?: {
127
+ is_authenticated?: boolean;
128
+ };
129
+ status?: number;
130
+ [key: string]: unknown;
131
+ }
132
+ interface AuthNextStep {
133
+ id: string;
134
+ is_pending: boolean;
135
+ title?: string;
136
+ description?: string;
137
+ metadata?: AuthStepMetadata;
138
+ }
139
+ interface AuthStepMetadata {
140
+ roles?: UserRole[] | Record<string, string>;
141
+ method?: string;
142
+ type?: string;
143
+ methods?: string[];
144
+ reason?: string;
145
+ password_policy?: PasswordPolicyConfig;
146
+ [key: string]: unknown;
147
+ }
148
+ interface PasswordPolicyConfig {
149
+ min_length?: number;
150
+ max_length?: number;
151
+ require_uppercase?: boolean;
152
+ require_lowercase?: boolean;
153
+ require_numbers?: boolean;
154
+ require_special_chars?: boolean;
155
+ }
156
+ interface AuthUser {
157
+ id?: string;
158
+ email?: string;
159
+ name?: string;
160
+ username?: string;
161
+ phone?: string;
162
+ display?: string;
163
+ [key: string]: unknown;
164
+ }
165
+ /**
166
+ * Authentication result from login/OTP
167
+ */
168
+ export interface AuthResult extends AuthApiResponse {
169
+ redirect_url?: string;
170
+ requires_two_factor?: boolean;
171
+ session_token?: string;
172
+ }
173
+ /**
174
+ * Pending auth result stored during multi-step auth flows (SAML, OAuth, etc.)
175
+ */
176
+ export interface PendingAuthResult extends AuthApiResponse {
177
+ timestamp?: number;
178
+ }
179
+ /**
180
+ * Two-factor auth setup
181
+ */
182
+ export interface TwoFactorSetup {
183
+ qr_code_url?: string;
184
+ backup_codes?: string[];
185
+ secret?: string;
186
+ }
187
+ /**
188
+ * Two-factor verification
189
+ */
190
+ export interface TwoFactorVerify {
191
+ code: string;
192
+ backup_code?: boolean;
193
+ }
194
+ /**
195
+ * Password reset request
196
+ */
197
+ export interface PasswordResetRequest {
198
+ email: string;
199
+ }
200
+ /**
201
+ * Password reset confirmation
202
+ */
203
+ export interface PasswordResetConfirm {
204
+ uid: string;
205
+ token: string;
206
+ new_password: string;
207
+ confirm_password?: string;
208
+ }
209
+ /**
210
+ * Password change
211
+ */
212
+ export interface PasswordChange {
213
+ old_password: string;
214
+ new_password: string;
215
+ confirm_password?: string;
216
+ }
217
+ /**
218
+ * OAuth/SAML callback params
219
+ */
220
+ export interface OAuthCallbackParams {
221
+ code?: string;
222
+ state?: string;
223
+ error?: string;
224
+ error_description?: string;
225
+ }
226
+ /**
227
+ * SAML callback params
228
+ */
229
+ export interface SamlCallbackParams {
230
+ SAMLResponse?: string;
231
+ RelayState?: string;
232
+ }
233
+ /**
234
+ * Session information
235
+ */
236
+ export interface SessionInfo {
237
+ id: string;
238
+ user_agent: string;
239
+ ip_address: string;
240
+ created_at: string;
241
+ last_activity: string;
242
+ is_current: boolean;
243
+ }
244
+ /**
245
+ * User profile data
246
+ */
247
+ export interface UserProfile {
248
+ id: string;
249
+ email: string;
250
+ first_name?: string;
251
+ last_name?: string;
252
+ full_name?: string;
253
+ username?: string;
254
+ phone_number?: string;
255
+ avatar_url?: string;
256
+ date_joined?: string;
257
+ is_active?: boolean;
258
+ }
259
+ /**
260
+ * Profile form data
261
+ */
262
+ export interface ProfileFormData {
263
+ first_name: string;
264
+ last_name: string;
265
+ email: string;
266
+ phone_number?: string;
267
+ }
268
+ /**
269
+ * User role
270
+ */
271
+ export interface UserRole {
272
+ id: string;
273
+ name: string;
274
+ description?: string;
275
+ permissions?: string[];
276
+ }
277
+ /**
278
+ * Background style for CSS
279
+ */
280
+ export interface BackgroundStyle {
281
+ backgroundColor?: string;
282
+ backgroundImage?: string;
283
+ backgroundSize?: string;
284
+ backgroundPosition?: string;
285
+ backgroundRepeat?: string;
286
+ }
287
+ /**
288
+ * Simple auth display options (legacy — prefer AuthConfig from index.ts)
289
+ */
290
+ export interface AuthDisplayOptions {
291
+ showLogo?: boolean;
292
+ showRememberMe?: boolean;
293
+ allowPasswordReset?: boolean;
294
+ allowRegistration?: boolean;
295
+ }
296
+ /**
297
+ * Detailed theme configuration with design tokens
298
+ */
299
+ export interface DetailedThemeConfig {
300
+ colors?: {
301
+ primary?: string;
302
+ secondary?: string;
303
+ success?: string;
304
+ warning?: string;
305
+ error?: string;
306
+ gray?: string;
307
+ background?: string;
308
+ text?: string;
309
+ };
310
+ fonts?: {
311
+ body?: string;
312
+ heading?: string;
313
+ };
314
+ borderRadius?: {
315
+ small?: number;
316
+ medium?: number;
317
+ large?: number;
318
+ };
319
+ }
320
+ /**
321
+ * OAuth/OIDC/SAML provider configuration
322
+ */
323
+ export interface AuthProvider {
324
+ id: string;
325
+ provider: string;
326
+ label?: string;
327
+ name?: string;
328
+ display_name?: string;
329
+ icon_url?: string;
330
+ providerType?: string;
331
+ [key: string]: unknown;
332
+ }
333
+ /**
334
+ * Cached logo data
335
+ */
336
+ export interface LogoCacheData {
337
+ url: string;
338
+ base64Data: string | null;
339
+ version: string | null;
340
+ timestamp: number;
341
+ appName: string;
342
+ }
343
+ export {};
@@ -0,0 +1,278 @@
1
+ import { UserRole, AuthProvider } from './common';
2
+ import { PasswordPolicy } from './auth';
3
+ export * from './auth';
4
+ export * from './common';
5
+ export interface ApiConfig {
6
+ baseUrl?: string;
7
+ endpoints?: Record<string, string>;
8
+ timeout?: number;
9
+ headers?: Record<string, string>;
10
+ }
11
+ export interface RouteConfig {
12
+ path: string;
13
+ page_type: string;
14
+ entity?: string;
15
+ component?: string;
16
+ extra_params?: Record<string, unknown>;
17
+ [key: string]: unknown;
18
+ }
19
+ export type MenuItemType = 'item' | 'section';
20
+ export interface MenuItemConfig {
21
+ id: string;
22
+ type?: MenuItemType;
23
+ label: string;
24
+ name?: string;
25
+ path?: string;
26
+ url?: string;
27
+ uri?: string;
28
+ icon?: string;
29
+ route_id?: string;
30
+ children?: MenuItemConfig[];
31
+ [key: string]: unknown;
32
+ }
33
+ export interface AppConfig {
34
+ routes: RouteConfig[];
35
+ menu: MenuItemConfig[];
36
+ apiConfig: ApiConfig;
37
+ theme?: ThemeConfig;
38
+ metadata?: Record<string, unknown>;
39
+ [key: string]: unknown;
40
+ }
41
+ export interface ThemeConfig {
42
+ primaryColor?: string;
43
+ secondaryColor?: string;
44
+ [key: string]: unknown;
45
+ }
46
+ export interface ApiRequestConfig {
47
+ baseUrl: string;
48
+ apiUrl: string;
49
+ fullUrl: string;
50
+ headers: Record<string, string>;
51
+ entity?: string;
52
+ [key: string]: unknown;
53
+ }
54
+ export interface User {
55
+ id: string | number;
56
+ username?: string;
57
+ email?: string;
58
+ name?: string;
59
+ [key: string]: unknown;
60
+ }
61
+ export interface AuthState {
62
+ isAuthenticated: boolean;
63
+ user: User | null;
64
+ token?: string;
65
+ [key: string]: unknown;
66
+ }
67
+ export interface LayoutProps {
68
+ children: React.ReactNode;
69
+ className?: string;
70
+ }
71
+ export interface ApiResponse<T = unknown> {
72
+ success: boolean;
73
+ response: T;
74
+ responseStatus: number;
75
+ message?: string;
76
+ }
77
+ export interface SessionSecurityConfig {
78
+ enabled: boolean;
79
+ ping_url: string;
80
+ warn_after: number;
81
+ expire_after: number;
82
+ }
83
+ export interface FormField {
84
+ name: string;
85
+ label?: string;
86
+ type?: string;
87
+ required?: boolean;
88
+ [key: string]: unknown;
89
+ }
90
+ export interface CrudConfig {
91
+ api_endpoint: string;
92
+ fields?: FormField[];
93
+ actions?: string[];
94
+ [key: string]: unknown;
95
+ }
96
+ export interface AuthConfig {
97
+ debug?: boolean;
98
+ theme?: {
99
+ background?: {
100
+ color?: string;
101
+ image?: string;
102
+ gradient?: string;
103
+ };
104
+ primaryColor?: string;
105
+ secondaryColor?: string;
106
+ fontFamily?: string;
107
+ borderRadius?: string;
108
+ textColor?: string;
109
+ secondaryTextColor?: string;
110
+ mutedTextColor?: string;
111
+ linkColor?: string;
112
+ linkHoverColor?: string;
113
+ alignTitle?: 'left' | 'center' | 'right';
114
+ };
115
+ card?: {
116
+ backgroundColor?: string;
117
+ borderRadius?: string;
118
+ boxShadow?: string;
119
+ maxWidth?: string;
120
+ padding?: string;
121
+ border?: string;
122
+ };
123
+ logo?: {
124
+ url?: string;
125
+ width?: string;
126
+ height?: string;
127
+ alt?: string;
128
+ position?: 'center' | 'left' | 'right';
129
+ className?: string;
130
+ style?: React.CSSProperties;
131
+ };
132
+ login?: {
133
+ title?: string | React.ComponentType;
134
+ subtitle?: string | React.ComponentType;
135
+ customElementsBelowDescription?: React.ComponentType[];
136
+ customHeader?: React.ComponentType;
137
+ customFooter?: React.ComponentType;
138
+ formLabels?: {
139
+ email?: string;
140
+ mobile?: string;
141
+ password?: string;
142
+ };
143
+ formPlaceholders?: {
144
+ email?: string;
145
+ mobile?: string;
146
+ password?: string;
147
+ };
148
+ submitButtonText?: string;
149
+ rememberMeText?: string;
150
+ forgotPasswordText?: string;
151
+ otpButtonText?: string;
152
+ tabLabels?: {
153
+ email?: string;
154
+ mobile?: string;
155
+ };
156
+ redirectAfterLogin?: string;
157
+ showRememberMe?: boolean;
158
+ enableTabSwitching?: boolean;
159
+ defaultTab?: 'email' | 'mobile';
160
+ };
161
+ roleSelection?: {
162
+ title?: string | React.ComponentType;
163
+ subtitle?: string | React.ComponentType;
164
+ instructionText?: string;
165
+ continueButtonText?: string;
166
+ recommendedBadgeText?: string;
167
+ emptyStateMessage?: string;
168
+ cardLayout?: 'grid' | 'list';
169
+ gridColumns?: 2 | 3;
170
+ maxHeight?: string;
171
+ customRoleCard?: React.ComponentType<{
172
+ role: UserRole | Record<string, unknown>;
173
+ selected: boolean;
174
+ onSelect: () => void;
175
+ }>;
176
+ customEmptyState?: React.ComponentType;
177
+ roleCardStyling?: {
178
+ backgroundColor?: string;
179
+ selectedColor?: string;
180
+ hoverColor?: string;
181
+ borderRadius?: string;
182
+ };
183
+ };
184
+ twoFactor?: {
185
+ title?: string | React.ComponentType;
186
+ subtitle?: string | React.ComponentType;
187
+ instructionText?: string;
188
+ sendInstructionText?: string;
189
+ sendButtonText?: string;
190
+ codeInputLabel?: string;
191
+ submitButtonText?: string;
192
+ resendButtonText?: string;
193
+ backButtonText?: string;
194
+ resendCountdown?: number;
195
+ codeLength?: number;
196
+ methodLabels?: {
197
+ email?: string;
198
+ sms?: string;
199
+ mobile?: string;
200
+ };
201
+ customCodeInput?: React.ComponentType<Record<string, unknown>>;
202
+ customMethodSelector?: React.ComponentType<Record<string, unknown>>;
203
+ };
204
+ resetPassword?: {
205
+ forgotPassword?: {
206
+ title?: string | React.ComponentType;
207
+ subtitle?: string | React.ComponentType;
208
+ instructionText?: string;
209
+ emailLabel?: string;
210
+ emailPlaceholder?: string;
211
+ submitButtonText?: string;
212
+ backToLoginText?: string;
213
+ successMessage?: string;
214
+ errorMessage?: string;
215
+ };
216
+ resetForm?: {
217
+ title?: string | React.ComponentType;
218
+ subtitle?: string | React.ComponentType;
219
+ passwordLabel?: string;
220
+ confirmPasswordLabel?: string;
221
+ passwordPlaceholder?: string;
222
+ confirmPasswordPlaceholder?: string;
223
+ submitButtonText?: string;
224
+ successMessage?: string;
225
+ showPasswordRequirements?: boolean;
226
+ passwordRequirementsText?: string;
227
+ customPasswordRequirements?: React.ComponentType<{
228
+ policy: PasswordPolicy | Record<string, unknown>;
229
+ }>;
230
+ };
231
+ };
232
+ providers?: {
233
+ buttonStyle?: 'outline' | 'filled' | 'minimal';
234
+ showProviderIcons?: boolean;
235
+ customProviderButtons?: Record<string, React.ComponentType<{
236
+ provider: AuthProvider;
237
+ }>>;
238
+ separatorText?: string;
239
+ };
240
+ customComponents?: {
241
+ LoginPage?: React.ComponentType<Record<string, unknown>>;
242
+ LoginCard?: React.ComponentType<Record<string, unknown>>;
243
+ RoleSelection?: React.ComponentType<Record<string, unknown>>;
244
+ TwoFactorAuth?: React.ComponentType<Record<string, unknown>>;
245
+ ForgotPasswordPage?: React.ComponentType<Record<string, unknown>>;
246
+ ResetPasswordPage?: React.ComponentType<Record<string, unknown>>;
247
+ OAuthCallbackPage?: React.ComponentType<Record<string, unknown>>;
248
+ DynamicLoginForm?: React.ComponentType<Record<string, unknown>>;
249
+ OTPForm?: React.ComponentType<Record<string, unknown>>;
250
+ ProviderButton?: React.ComponentType<Record<string, unknown>>;
251
+ };
252
+ roleSelectionEndpoint?: string;
253
+ password_policy?: Record<string, unknown>;
254
+ messages?: {
255
+ validation?: {
256
+ required?: string;
257
+ /** Required-field message for the password input. `required` is worded for
258
+ * the identifier field, so the password field needs its own. */
259
+ passwordRequired?: string;
260
+ invalidEmail?: string;
261
+ invalidMobile?: string;
262
+ passwordTooShort?: string;
263
+ passwordsDoNotMatch?: string;
264
+ };
265
+ errors?: {
266
+ loginFailed?: string;
267
+ networkError?: string;
268
+ invalidOTP?: string;
269
+ expiredToken?: string;
270
+ };
271
+ success?: {
272
+ loginSuccess?: string;
273
+ otpSent?: string;
274
+ passwordReset?: string;
275
+ roleSelected?: string;
276
+ };
277
+ };
278
+ }