@asgardeo/react 0.11.3 → 0.13.0

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 (36) hide show
  1. package/dist/api/createOrganization.d.ts +5 -1
  2. package/dist/api/getAllOrganizations.d.ts +5 -1
  3. package/dist/api/getMeOrganizations.d.ts +5 -1
  4. package/dist/api/getOrganization.d.ts +5 -1
  5. package/dist/api/getSchemas.d.ts +5 -1
  6. package/dist/api/getScim2Me.d.ts +5 -1
  7. package/dist/api/updateMeProfile.d.ts +5 -1
  8. package/dist/api/updateOrganization.d.ts +5 -1
  9. package/dist/cjs/index.js +2257 -1742
  10. package/dist/cjs/index.js.map +4 -4
  11. package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +5 -1
  12. package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +5 -1
  13. package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +5 -1
  14. package/dist/components/auth/Callback/Callback.d.ts +51 -0
  15. package/dist/components/presentation/UserDropdown/UserDropdown.d.ts +3 -0
  16. package/dist/components/presentation/auth/AcceptInvite/v2/BaseAcceptInvite.d.ts +6 -0
  17. package/dist/components/presentation/auth/InviteUser/v2/BaseInviteUser.d.ts +5 -0
  18. package/dist/components/presentation/auth/SignIn/v2/BaseSignIn.d.ts +5 -1
  19. package/dist/components/presentation/auth/SignIn/v2/SignIn.d.ts +5 -1
  20. package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +10 -1
  21. package/dist/contexts/FlowMeta/FlowMetaContext.d.ts +39 -0
  22. package/dist/contexts/FlowMeta/FlowMetaProvider.d.ts +50 -0
  23. package/dist/contexts/FlowMeta/useFlowMeta.d.ts +20 -0
  24. package/dist/contexts/Theme/ThemeProvider.d.ts +36 -39
  25. package/dist/contexts/Theme/v1/ThemeProvider.d.ts +88 -0
  26. package/dist/contexts/Theme/v2/ThemeProvider.d.ts +57 -0
  27. package/dist/hooks/useBrowserUrl.d.ts +8 -0
  28. package/dist/hooks/v2/useOAuthCallback.d.ts +82 -0
  29. package/dist/index.d.ts +2 -1
  30. package/dist/index.js +1666 -1149
  31. package/dist/index.js.map +4 -4
  32. package/dist/utils/applyThemeToDOM.d.ts +24 -0
  33. package/dist/utils/normalizeThemeConfig.d.ts +30 -0
  34. package/dist/utils/oauth.d.ts +24 -0
  35. package/dist/utils/v2/buildThemeConfigFromFlowMeta.d.ts +33 -0
  36. package/package.json +4 -4
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { type RefObject } from 'react';
19
+ export interface UseOAuthCallbackOptions {
20
+ /**
21
+ * Current flowId from component state
22
+ */
23
+ currentFlowId: string | null;
24
+ /**
25
+ * SessionStorage key for flowId (defaults to 'asgardeo_flow_id')
26
+ */
27
+ flowIdStorageKey?: string;
28
+ /**
29
+ * Whether the component is initialized and ready to process OAuth callback
30
+ */
31
+ isInitialized: boolean;
32
+ /**
33
+ * Whether a submission is currently in progress
34
+ */
35
+ isSubmitting?: boolean;
36
+ /**
37
+ * Callback when OAuth flow completes successfully
38
+ */
39
+ onComplete?: () => void;
40
+ /**
41
+ * Callback when OAuth flow encounters an error
42
+ */
43
+ onError?: (error: any) => void;
44
+ /**
45
+ * Function to handle flow response after submission
46
+ */
47
+ onFlowChange?: (response: any) => void;
48
+ /**
49
+ * Callback to set loading state at the start of OAuth processing
50
+ */
51
+ onProcessingStart?: () => void;
52
+ /**
53
+ * Function to submit OAuth code to the server
54
+ */
55
+ onSubmit: (payload: OAuthCallbackPayload) => Promise<any>;
56
+ /**
57
+ * Optional external ref to track processed state. If provided, the component
58
+ * manages the ref (allowing resets on flow clear/retry). Otherwise hook manages internally.
59
+ */
60
+ processedRef?: RefObject<boolean>;
61
+ /**
62
+ * Additional handler for setting state (e.g., setFlowId)
63
+ */
64
+ setFlowId?: (flowId: string) => void;
65
+ /**
66
+ * Ref to mark that token validation was attempted (prevents duplicate validation)
67
+ * Used in AcceptInvite to coordinate between OAuth callback and token validation
68
+ */
69
+ tokenValidationAttemptedRef?: RefObject<boolean>;
70
+ }
71
+ export interface OAuthCallbackPayload {
72
+ flowId: string;
73
+ inputs: {
74
+ code: string;
75
+ nonce?: string;
76
+ };
77
+ }
78
+ /**
79
+ * Processes OAuth callbacks by detecting auth code in URL, resolving flowId, and submitting to server.
80
+ * Used by SignIn, SignUp, and AcceptInvite components.
81
+ */
82
+ export declare function useOAuthCallback({ currentFlowId, flowIdStorageKey, isInitialized, isSubmitting, onComplete, onError, onFlowChange, onProcessingStart, onSubmit, processedRef, setFlowId, tokenValidationAttemptedRef, }: UseOAuthCallbackOptions): void;
package/dist/index.d.ts CHANGED
@@ -82,8 +82,9 @@ export { default as BaseSignUp } from './components/presentation/auth/SignUp/Bas
82
82
  export * from './components/presentation/auth/SignUp/BaseSignUp';
83
83
  export { default as SignUp } from './components/presentation/auth/SignUp/SignUp';
84
84
  export * from './components/presentation/auth/SignUp/SignUp';
85
- export { BaseInviteUser, InviteUser } from './components/presentation/auth/InviteUser';
85
+ export * from './components/presentation/auth/InviteUser';
86
86
  export { BaseAcceptInvite, AcceptInvite } from './components/presentation/auth/AcceptInvite';
87
+ export * from './components/auth/Callback/Callback';
87
88
  export { default as IdentifierFirst } from './components/presentation/auth/SignIn/v1/options/IdentifierFirst';
88
89
  export { default as UsernamePassword } from './components/presentation/auth/SignIn/v1/options/UsernamePassword';
89
90
  export { default as GoogleButton } from './components/adapters/GoogleButton';