@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,61 @@
1
+ import { z } from 'zod';
2
+ type MenuItem = {
3
+ id: string;
4
+ label: string;
5
+ path?: string;
6
+ uri?: string;
7
+ icon?: string;
8
+ type?: string;
9
+ children?: MenuItem[];
10
+ };
11
+ declare const menuItemSchema: z.ZodType<MenuItem>;
12
+ export declare const appInitSchema: z.ZodObject<{
13
+ routes: z.ZodArray<z.ZodObject<{
14
+ path: z.ZodString;
15
+ page_type: z.ZodString;
16
+ entity: z.ZodOptional<z.ZodString>;
17
+ component: z.ZodOptional<z.ZodString>;
18
+ extra_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
19
+ }, z.core.$loose>>;
20
+ menu: z.ZodArray<z.ZodType<MenuItem, unknown, z.core.$ZodTypeInternals<MenuItem, unknown>>>;
21
+ app_name: z.ZodOptional<z.ZodString>;
22
+ is_user_anonymous: z.ZodOptional<z.ZodBoolean>;
23
+ profile_info: z.ZodOptional<z.ZodUnknown>;
24
+ app_logo: z.ZodOptional<z.ZodString>;
25
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
26
+ theme: z.ZodOptional<z.ZodObject<{
27
+ colors: z.ZodDefault<z.ZodObject<{
28
+ primary: z.ZodOptional<z.ZodString>;
29
+ secondary: z.ZodOptional<z.ZodString>;
30
+ success: z.ZodOptional<z.ZodString>;
31
+ warning: z.ZodOptional<z.ZodString>;
32
+ error: z.ZodOptional<z.ZodString>;
33
+ gray: z.ZodOptional<z.ZodString>;
34
+ background: z.ZodOptional<z.ZodString>;
35
+ text: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strip>>;
37
+ typography: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
38
+ borders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
39
+ shadows: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
40
+ spacing: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
41
+ fonts: z.ZodOptional<z.ZodObject<{
42
+ body: z.ZodOptional<z.ZodString>;
43
+ heading: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$strip>>;
45
+ borderRadius: z.ZodOptional<z.ZodObject<{
46
+ small: z.ZodOptional<z.ZodString>;
47
+ medium: z.ZodOptional<z.ZodString>;
48
+ large: z.ZodOptional<z.ZodString>;
49
+ }, z.core.$strip>>;
50
+ }, z.core.$loose>>;
51
+ session_security: z.ZodOptional<z.ZodBoolean>;
52
+ session_security_config: z.ZodOptional<z.ZodObject<{
53
+ enabled: z.ZodBoolean;
54
+ ping_url: z.ZodString;
55
+ warn_after: z.ZodNumber;
56
+ expire_after: z.ZodNumber;
57
+ }, z.core.$loose>>;
58
+ }, z.core.$loose>;
59
+ export type AppInitValidated = z.infer<typeof appInitSchema>;
60
+ export { menuItemSchema };
61
+ export type MenuItemValidated = MenuItem;
@@ -0,0 +1,10 @@
1
+ export type { AppInitValidated, MenuItemValidated } from './appInit.schema';
2
+ export { appInitSchema, menuItemSchema } from './appInit.schema';
3
+ export type { ProfileValidated } from './profile.schema';
4
+ export { profileSchema } from './profile.schema';
5
+ export type { RouteConfigValidated } from './route.schema';
6
+ export { routeConfigSchema } from './route.schema';
7
+ export type { SessionValidated } from './session.schema';
8
+ export { sessionSchema } from './session.schema';
9
+ export type { ThemeValidated } from './theme.schema';
10
+ export { themeSchema } from './theme.schema';
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ export declare const profileSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ email: z.ZodString;
5
+ mobile: z.ZodString;
6
+ profile_pic: z.ZodNullable<z.ZodString>;
7
+ roles: z.ZodArray<z.ZodObject<{
8
+ id: z.ZodNumber;
9
+ name: z.ZodString;
10
+ is_active: z.ZodOptional<z.ZodBoolean>;
11
+ is_default: z.ZodOptional<z.ZodBoolean>;
12
+ }, z.core.$loose>>;
13
+ last_password_changed: z.ZodOptional<z.ZodString>;
14
+ auth_config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
15
+ password_policy: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
16
+ tokens: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
17
+ }, z.core.$loose>;
18
+ export type ProfileValidated = z.infer<typeof profileSchema>;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export declare const routeConfigSchema: z.ZodObject<{
3
+ path: z.ZodString;
4
+ page_type: z.ZodString;
5
+ entity: z.ZodOptional<z.ZodString>;
6
+ component: z.ZodOptional<z.ZodString>;
7
+ extra_params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
8
+ }, z.core.$loose>;
9
+ export type RouteConfigValidated = z.infer<typeof routeConfigSchema>;
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod';
2
+ export declare const sessionSchema: z.ZodObject<{
3
+ enabled: z.ZodBoolean;
4
+ ping_url: z.ZodString;
5
+ warn_after: z.ZodNumber;
6
+ expire_after: z.ZodNumber;
7
+ }, z.core.$loose>;
8
+ export type SessionValidated = z.infer<typeof sessionSchema>;
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ export declare const themeSchema: z.ZodObject<{
3
+ colors: z.ZodDefault<z.ZodObject<{
4
+ primary: z.ZodOptional<z.ZodString>;
5
+ secondary: z.ZodOptional<z.ZodString>;
6
+ success: z.ZodOptional<z.ZodString>;
7
+ warning: z.ZodOptional<z.ZodString>;
8
+ error: z.ZodOptional<z.ZodString>;
9
+ gray: z.ZodOptional<z.ZodString>;
10
+ background: z.ZodOptional<z.ZodString>;
11
+ text: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>>;
13
+ typography: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
14
+ borders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
15
+ shadows: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
16
+ spacing: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
17
+ fonts: z.ZodOptional<z.ZodObject<{
18
+ body: z.ZodOptional<z.ZodString>;
19
+ heading: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>>;
21
+ borderRadius: z.ZodOptional<z.ZodObject<{
22
+ small: z.ZodOptional<z.ZodString>;
23
+ medium: z.ZodOptional<z.ZodString>;
24
+ large: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strip>>;
26
+ }, z.core.$loose>;
27
+ export type ThemeValidated = z.infer<typeof themeSchema>;
@@ -0,0 +1,2 @@
1
+ export { getApiTimeout, getApiUrl, getEndpoint, } from '../../framework/utils/apiConfig';
2
+ export * from '../api';
@@ -0,0 +1,109 @@
1
+ import { PasswordChange, ProfileFormData } from '../types';
2
+ interface ApiDetails {
3
+ url: string;
4
+ type: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
5
+ payload?: unknown;
6
+ }
7
+ interface ApiResponse {
8
+ response: unknown;
9
+ success: boolean;
10
+ responseStatus: number;
11
+ isNetworkError?: boolean;
12
+ }
13
+ export declare const callGetApi: ({ fullUrl }: {
14
+ fullUrl: string;
15
+ }) => Promise<Response>;
16
+ export declare const callPostApi: ({ fullUrl, payload }: {
17
+ fullUrl: string;
18
+ payload?: unknown;
19
+ }) => Promise<Response>;
20
+ export declare const callPutApi: ({ fullUrl, payload }: {
21
+ fullUrl: string;
22
+ payload?: unknown;
23
+ }) => Promise<Response>;
24
+ export declare const callDeleteApi: ({ fullUrl, payload, }: {
25
+ fullUrl: string;
26
+ payload?: unknown;
27
+ }) => Promise<Response>;
28
+ export declare const callPatchApi: ({ fullUrl, payload }: {
29
+ fullUrl: string;
30
+ payload?: unknown;
31
+ }) => Promise<Response>;
32
+ export declare const callApi: (apiDetails: ApiDetails) => Promise<ApiResponse>;
33
+ export declare const generateQueryString: (params: Record<string, unknown>) => string;
34
+ export declare const getAppInitData: () => {
35
+ url: string;
36
+ type: "GET";
37
+ };
38
+ export declare const getUserProfile: () => {
39
+ url: string;
40
+ type: "GET";
41
+ };
42
+ export declare const updateUserProfile: (payload: ProfileFormData) => {
43
+ url: string;
44
+ type: "PUT";
45
+ payload: ProfileFormData;
46
+ };
47
+ export declare const uploadProfilePhoto: (payload: FormData) => {
48
+ url: string;
49
+ type: "POST";
50
+ payload: FormData;
51
+ };
52
+ export declare const changePassword: (payload: PasswordChange) => {
53
+ url: string;
54
+ type: "PUT";
55
+ payload: PasswordChange;
56
+ };
57
+ export declare const toggleTwoFactor: (payload: Record<string, unknown>) => {
58
+ url: string;
59
+ type: "POST";
60
+ payload: Record<string, unknown>;
61
+ };
62
+ export declare const switchRole: (roleId: string) => {
63
+ url: string;
64
+ type: "POST";
65
+ };
66
+ export declare const getUserSessions: () => {
67
+ url: string;
68
+ type: "GET";
69
+ };
70
+ export declare const logoutSession: (sessionId: number) => {
71
+ url: string;
72
+ type: "DELETE";
73
+ payload: {
74
+ sessions: number[];
75
+ };
76
+ };
77
+ export declare const logoutAllSessions: (sessionIds: number[]) => {
78
+ url: string;
79
+ type: "DELETE";
80
+ payload: {
81
+ sessions: number[];
82
+ };
83
+ };
84
+ export declare const logout: () => {
85
+ url: string;
86
+ type: "DELETE";
87
+ };
88
+ export declare const performLogout: () => {
89
+ url: string;
90
+ type: "POST";
91
+ };
92
+ export declare const pingSessionSecurity: (pingUrl: string, idleFor: number) => {
93
+ url: string;
94
+ type: "GET";
95
+ };
96
+ export declare const fetchAppInitData: () => Promise<ApiResponse>;
97
+ export declare const fetchUserProfile: () => Promise<ApiResponse>;
98
+ export declare const fetchUserSessions: () => Promise<ApiResponse>;
99
+ export declare const saveUserProfile: (data: ProfileFormData) => Promise<ApiResponse>;
100
+ export declare const uploadPhoto: (formData: FormData) => Promise<ApiResponse>;
101
+ export declare const updatePassword: (passwordData: PasswordChange) => Promise<ApiResponse>;
102
+ export declare const setTwoFactor: (enabled: boolean) => Promise<ApiResponse>;
103
+ export declare const changeRole: (roleId: string) => Promise<ApiResponse>;
104
+ export declare const removeSession: (sessionId: number) => Promise<ApiResponse>;
105
+ export declare const removeAllSessions: (sessionIds: number[]) => Promise<ApiResponse>;
106
+ export declare const performAppLogout: () => Promise<ApiResponse>;
107
+ export declare const performDirectLogout: () => Promise<ApiResponse>;
108
+ export declare const pingSession: (pingUrl: string, idleFor: number) => Promise<ApiResponse>;
109
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Services exports
3
+ */
4
+ export * from './api';
5
+ export { type LegacyApiResponse, toLegacyResponse } from './legacyAdapter';
6
+ export * from './logger';
7
+ export { type ApiResult, normalizeAxiosResponse, normalizeError, normalizeFetchResponse, normalizeResponse, } from './normalizeResponse';
@@ -0,0 +1,10 @@
1
+ import { ApiResult } from './normalizeResponse';
2
+ export interface LegacyApiResponse<T = unknown> {
3
+ success: boolean;
4
+ response: T | {
5
+ message: string;
6
+ };
7
+ responseStatus: number;
8
+ message?: string;
9
+ }
10
+ export declare function toLegacyResponse<T>(result: ApiResult<T>): LegacyApiResponse<T>;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Logging utility with environment-aware behavior
3
+ * Development: console methods with level prefixes
4
+ * Production: console.warn/error (placeholder until monitoring service is wired)
5
+ */
6
+ interface LogContext {
7
+ [key: string]: unknown;
8
+ }
9
+ declare class Logger {
10
+ private isDev;
11
+ constructor();
12
+ /**
13
+ * Debug messages - only in development
14
+ */
15
+ debug(message: string, context?: LogContext): void;
16
+ /**
17
+ * Info messages
18
+ */
19
+ info(message: string, context?: LogContext): void;
20
+ /**
21
+ * Warning messages
22
+ */
23
+ warn(message: string, context?: LogContext): void;
24
+ /**
25
+ * Error messages - always logged
26
+ */
27
+ error(message: string, error?: Error | unknown, context?: LogContext): void;
28
+ /** Placeholder — wire to Sentry/DataDog when ready */
29
+ private sendToMonitoring;
30
+ }
31
+ export declare const logger: Logger;
32
+ export {};
@@ -0,0 +1,29 @@
1
+ export type ApiResult<T = unknown> = {
2
+ ok: true;
3
+ data: T;
4
+ status: number;
5
+ } | {
6
+ ok: false;
7
+ error: string;
8
+ status: number;
9
+ details?: unknown;
10
+ };
11
+ interface LegacyEnvelope {
12
+ success: boolean;
13
+ response: unknown;
14
+ responseStatus: number;
15
+ message?: string;
16
+ }
17
+ interface AxiosLikeResponse {
18
+ data: {
19
+ success?: boolean;
20
+ response?: unknown;
21
+ message?: string;
22
+ };
23
+ status: number;
24
+ }
25
+ export declare function normalizeResponse<T = unknown>(envelope: LegacyEnvelope): ApiResult<T>;
26
+ export declare function normalizeAxiosResponse<T = unknown>(response: AxiosLikeResponse): ApiResult<T>;
27
+ export declare function normalizeFetchResponse<T = unknown>(status: number, body: unknown): ApiResult<T>;
28
+ export declare function normalizeError(error: unknown): ApiResult<never>;
29
+ export {};
@@ -0,0 +1,103 @@
1
+ import { SessionInfo, UserProfile, UserRole } from './common';
2
+ export type { AuthResult, OAuthCallbackParams, PasswordChange, PasswordResetConfirm, PasswordResetRequest, PendingAuthResult, SamlCallbackParams, SessionInfo, TwoFactorSetup, TwoFactorVerify, UserProfile, UserRole, } from './common';
3
+ /**
4
+ * Login credentials
5
+ */
6
+ export interface LoginCredentials {
7
+ email: string;
8
+ password: string;
9
+ phone?: string;
10
+ username?: string;
11
+ remember?: boolean;
12
+ }
13
+ /**
14
+ * OTP login credentials
15
+ */
16
+ export interface OTPLoginCredentials {
17
+ email: string;
18
+ otp: string;
19
+ }
20
+ /**
21
+ * Login response
22
+ */
23
+ export interface LoginResponse {
24
+ success: boolean;
25
+ token?: string;
26
+ user?: UserProfile;
27
+ next_step?: NextStep;
28
+ redirect_url?: string;
29
+ }
30
+ /**
31
+ * Next step in multi-step auth
32
+ */
33
+ export interface NextStep {
34
+ id: string;
35
+ is_pending: boolean;
36
+ title?: string;
37
+ description?: string;
38
+ metadata?: Record<string, unknown>;
39
+ }
40
+ /**
41
+ * Multi-factor authentication state
42
+ */
43
+ export interface MFAState {
44
+ enabled: boolean;
45
+ method: 'totp' | 'sms' | 'email' | null;
46
+ backup_codes?: string[];
47
+ }
48
+ /**
49
+ * Full auth state with tokens and session (for future token-based auth)
50
+ */
51
+ export interface FullAuthState {
52
+ isAuthenticated: boolean;
53
+ isAnonymous: boolean;
54
+ user: UserProfile | null;
55
+ tokens: AuthTokens | null;
56
+ sessionInfo: SessionInfo | null;
57
+ }
58
+ /**
59
+ * Authentication tokens
60
+ */
61
+ export interface AuthTokens {
62
+ access_token: string;
63
+ refresh_token?: string;
64
+ expires_at?: string;
65
+ token_type?: string;
66
+ }
67
+ /**
68
+ * Role selection data
69
+ */
70
+ export interface RoleSelectionData {
71
+ user_id: string;
72
+ available_roles: UserRole[];
73
+ selected_role?: UserRole;
74
+ }
75
+ /**
76
+ * Two-factor auth verification result
77
+ */
78
+ export interface TwoFactorResult {
79
+ success: boolean;
80
+ requires_backup_code?: boolean;
81
+ remaining_attempts?: number;
82
+ }
83
+ /**
84
+ * Password policy
85
+ */
86
+ export interface PasswordPolicy {
87
+ min_length?: number;
88
+ require_uppercase?: boolean;
89
+ require_lowercase?: boolean;
90
+ require_numbers?: boolean;
91
+ require_special_chars?: boolean;
92
+ forbidden_patterns?: string[];
93
+ [key: string]: unknown;
94
+ }
95
+ /**
96
+ * Session security policy (server-side constraints)
97
+ */
98
+ export interface SessionPolicyConfig {
99
+ max_sessions: number;
100
+ session_timeout_minutes: number;
101
+ require_reauth_for_sensitive: boolean;
102
+ ip_whitelist?: string[];
103
+ }