@asgardeo/react 0.6.16 → 0.6.18

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 (51) hide show
  1. package/dist/cjs/index.js +1760 -1316
  2. package/dist/cjs/index.js.map +4 -4
  3. package/dist/components/adapters/CheckboxInput.d.ts +2 -2
  4. package/dist/components/adapters/DateInput.d.ts +2 -2
  5. package/dist/components/adapters/DividerComponent.d.ts +2 -2
  6. package/dist/components/adapters/EmailInput.d.ts +2 -2
  7. package/dist/components/adapters/FormContainer.d.ts +2 -2
  8. package/dist/components/adapters/ImageComponent.d.ts +2 -2
  9. package/dist/components/adapters/NumberInput.d.ts +2 -2
  10. package/dist/components/adapters/PasswordInput.d.ts +2 -2
  11. package/dist/components/adapters/SelectInput.d.ts +2 -2
  12. package/dist/components/adapters/SocialButton.d.ts +2 -2
  13. package/dist/components/adapters/SubmitButton.d.ts +2 -2
  14. package/dist/components/adapters/TelephoneInput.d.ts +2 -2
  15. package/dist/components/adapters/TextInput.d.ts +2 -2
  16. package/dist/components/adapters/Typography.d.ts +2 -2
  17. package/dist/components/presentation/{SignIn/component-driven/SignInOptionFactory.d.ts → auth/AuthOptionFactory.d.ts} +14 -2
  18. package/dist/components/presentation/{SignIn → auth/SignIn}/BaseSignIn.d.ts +2 -2
  19. package/dist/components/presentation/{SignIn → auth/SignIn}/SignIn.d.ts +3 -3
  20. package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/BaseSignIn.d.ts +1 -1
  21. package/dist/components/presentation/{SignIn/component-driven → auth/SignIn/v2}/BaseSignIn.d.ts +3 -3
  22. package/dist/components/presentation/{SignIn/component-driven → auth/SignIn/v2}/SignIn.d.ts +1 -1
  23. package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts +27 -0
  24. package/dist/components/presentation/{SignUp → auth/SignUp}/SignUp.d.ts +6 -13
  25. package/dist/components/presentation/{SignUp → auth/SignUp/v1}/BaseSignUp.d.ts +3 -53
  26. package/dist/components/presentation/auth/SignUp/v1/SignUp.d.ts +38 -0
  27. package/dist/components/presentation/{SignUp → auth/SignUp/v1}/SignUpOptionFactory.d.ts +3 -52
  28. package/dist/components/presentation/auth/SignUp/v2/BaseSignUp.d.ts +171 -0
  29. package/dist/components/presentation/auth/SignUp/v2/SignUp.d.ts +38 -0
  30. package/dist/index.d.ts +16 -16
  31. package/dist/index.js +1463 -1011
  32. package/dist/index.js.map +4 -4
  33. package/dist/models/adapters.d.ts +68 -0
  34. package/dist/utils/v2/flowTransformer.d.ts +111 -0
  35. package/dist/utils/v2/getAuthComponentHeadings.d.ts +69 -0
  36. package/dist/utils/v2/resolveTranslation.d.ts +27 -0
  37. package/dist/utils/v2/resolveTranslationsInArray.d.ts +27 -0
  38. package/dist/{components/presentation/SignIn/component-driven/transformer.d.ts → utils/v2/resolveTranslationsInObject.d.ts} +8 -11
  39. package/package.json +6 -6
  40. package/dist/components/presentation/SignUp/transformer.d.ts +0 -104
  41. /package/dist/components/presentation/{SignIn → auth/SignIn}/BaseSignIn.styles.d.ts +0 -0
  42. /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/EmailOtp.d.ts +0 -0
  43. /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/IdentifierFirst.d.ts +0 -0
  44. /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/MultiOptionButton.d.ts +0 -0
  45. /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/SignInOptionFactory.d.ts +0 -0
  46. /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/SmsOtp.d.ts +0 -0
  47. /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/SocialButton.d.ts +0 -0
  48. /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/Totp.d.ts +0 -0
  49. /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/options/UsernamePassword.d.ts +0 -0
  50. /package/dist/components/presentation/{SignIn/non-component-driven → auth/SignIn/v1}/types.d.ts +0 -0
  51. /package/dist/components/presentation/{SignUp → auth/SignUp}/BaseSignUp.styles.d.ts +0 -0
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Copyright (c) 2025, 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 { EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteResponse } from '@asgardeo/browser';
19
+ import { FC, ReactNode } from 'react';
20
+ import { CardProps } from '../../../../primitives/Card/Card';
21
+ /**
22
+ * Render props for custom UI rendering
23
+ */
24
+ export interface BaseSignUpRenderProps {
25
+ /**
26
+ * Form values
27
+ */
28
+ values: Record<string, string>;
29
+ /**
30
+ * Form errors
31
+ */
32
+ errors: Record<string, string>;
33
+ /**
34
+ * Touched fields
35
+ */
36
+ touched: Record<string, boolean>;
37
+ /**
38
+ * Whether the form is valid
39
+ */
40
+ isValid: boolean;
41
+ /**
42
+ * Loading state
43
+ */
44
+ isLoading: boolean;
45
+ /**
46
+ * Flow components
47
+ */
48
+ components: any[];
49
+ /**
50
+ * Function to handle input changes
51
+ */
52
+ handleInputChange: (name: string, value: string) => void;
53
+ /**
54
+ * Function to handle form submission
55
+ */
56
+ handleSubmit: (component: any, data?: Record<string, any>) => Promise<void>;
57
+ /**
58
+ * Function to validate the form
59
+ */
60
+ validateForm: () => {
61
+ isValid: boolean;
62
+ errors: Record<string, string>;
63
+ };
64
+ /**
65
+ * Flow title
66
+ */
67
+ title: string;
68
+ /**
69
+ * Flow subtitle
70
+ */
71
+ subtitle: string;
72
+ /**
73
+ * Flow messages
74
+ */
75
+ messages: Array<{
76
+ message: string;
77
+ type: string;
78
+ }>;
79
+ }
80
+ /**
81
+ * Props for the BaseSignUp component.
82
+ */
83
+ export interface BaseSignUpProps {
84
+ /**
85
+ * URL to redirect after successful sign-up.
86
+ */
87
+ afterSignUpUrl?: string;
88
+ /**
89
+ * Custom CSS class name for the submit button.
90
+ */
91
+ buttonClassName?: string;
92
+ /**
93
+ * Custom CSS class name for the form container.
94
+ */
95
+ className?: string;
96
+ /**
97
+ * Custom CSS class name for error messages.
98
+ */
99
+ errorClassName?: string;
100
+ /**
101
+ * Custom CSS class name for form inputs.
102
+ */
103
+ inputClassName?: string;
104
+ isInitialized?: boolean;
105
+ /**
106
+ * Custom CSS class name for info messages.
107
+ */
108
+ messageClassName?: string;
109
+ /**
110
+ * Callback function called when the sign-up flow completes and requires redirection.
111
+ * This allows platform-specific handling of redirects (e.g., Next.js router.push).
112
+ * @param response - The response from the sign-up flow containing the redirect URL, etc.
113
+ */
114
+ onComplete?: (response: EmbeddedFlowExecuteResponse) => void;
115
+ /**
116
+ * Callback function called when sign-up fails.
117
+ * @param error - The error that occurred during sign-up.
118
+ */
119
+ onError?: (error: Error) => void;
120
+ /**
121
+ * Callback function called when sign-up flow status changes.
122
+ * @param response - The current sign-up response.
123
+ */
124
+ onFlowChange?: (response: EmbeddedFlowExecuteResponse) => void;
125
+ /**
126
+ * Function to initialize sign-up flow.
127
+ * @returns Promise resolving to the initial sign-up response.
128
+ */
129
+ onInitialize?: (payload?: EmbeddedFlowExecuteRequestPayload) => Promise<EmbeddedFlowExecuteResponse>;
130
+ /**
131
+ * Function to handle sign-up steps.
132
+ * @param payload - The sign-up payload.
133
+ * @returns Promise resolving to the sign-up response.
134
+ */
135
+ onSubmit?: (payload: EmbeddedFlowExecuteRequestPayload) => Promise<EmbeddedFlowExecuteResponse>;
136
+ /**
137
+ * Size variant for the component.
138
+ */
139
+ size?: 'small' | 'medium' | 'large';
140
+ /**
141
+ * Theme variant for the component.
142
+ */
143
+ variant?: CardProps['variant'];
144
+ /**
145
+ * Whether to redirect after sign-up.
146
+ */
147
+ shouldRedirectAfterSignUp?: boolean;
148
+ /**
149
+ * Render props function for custom UI
150
+ */
151
+ children?: (props: BaseSignUpRenderProps) => ReactNode;
152
+ /**
153
+ * Whether to show the title.
154
+ */
155
+ showTitle?: boolean;
156
+ /**
157
+ * Whether to show the subtitle.
158
+ */
159
+ showSubtitle?: boolean;
160
+ /**
161
+ * Whether to show the logo.
162
+ */
163
+ showLogo?: boolean;
164
+ }
165
+ /**
166
+ * BaseSignUp component that provides embedded sign-up flow for AsgardeoV2.
167
+ * This component handles both the presentation layer and sign-up flow logic.
168
+ * It accepts API functions as props to maintain framework independence.
169
+ */
170
+ declare const BaseSignUp: FC<BaseSignUpProps>;
171
+ export default BaseSignUp;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Copyright (c) 2025, 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 { FC, ReactNode } from 'react';
19
+ import { BaseSignUpProps, BaseSignUpRenderProps } from './BaseSignUp';
20
+ /**
21
+ * Render props function parameters (re-exported from BaseSignUp for convenience)
22
+ */
23
+ export type SignUpRenderProps = BaseSignUpRenderProps;
24
+ /**
25
+ * Props for the SignUp component.
26
+ */
27
+ export type SignUpProps = BaseSignUpProps & {
28
+ /**
29
+ * Render props function for custom UI
30
+ */
31
+ children?: (props: SignUpRenderProps) => ReactNode;
32
+ };
33
+ /**
34
+ * A styled SignUp component for AsgardeoV2 (AKA Thunder) platform that provides embedded sign-up flow with pre-built styling.
35
+ * This component handles the API calls for sign-up and delegates UI logic to BaseSignUp.
36
+ */
37
+ declare const SignUp: FC<SignUpProps>;
38
+ export default SignUp;
package/dist/index.d.ts CHANGED
@@ -83,28 +83,28 @@ export { default as SignedOut } from './components/control/SignedOut';
83
83
  export * from './components/control/SignedOut';
84
84
  export { default as Loading } from './components/control/Loading';
85
85
  export * from './components/control/Loading';
86
- export { default as BaseSignIn } from './components/presentation/SignIn/BaseSignIn';
87
- export * from './components/presentation/SignIn/BaseSignIn';
88
- export { default as SignIn } from './components/presentation/SignIn/SignIn';
89
- export * from './components/presentation/SignIn/SignIn';
90
- export { default as BaseSignUp } from './components/presentation/SignUp/BaseSignUp';
91
- export * from './components/presentation/SignUp/BaseSignUp';
92
- export { default as SignUp } from './components/presentation/SignUp/SignUp';
93
- export * from './components/presentation/SignUp/SignUp';
94
- export { default as IdentifierFirst } from './components/presentation/SignIn/non-component-driven/options/IdentifierFirst';
95
- export { default as UsernamePassword } from './components/presentation/SignIn/non-component-driven/options/UsernamePassword';
86
+ export { default as BaseSignIn } from './components/presentation/auth/SignIn/BaseSignIn';
87
+ export * from './components/presentation/auth/SignIn/BaseSignIn';
88
+ export { default as SignIn } from './components/presentation/auth/SignIn/SignIn';
89
+ export * from './components/presentation/auth/SignIn/SignIn';
90
+ export { default as BaseSignUp } from './components/presentation/auth/SignUp/BaseSignUp';
91
+ export * from './components/presentation/auth/SignUp/BaseSignUp';
92
+ export { default as SignUp } from './components/presentation/auth/SignUp/SignUp';
93
+ export * from './components/presentation/auth/SignUp/SignUp';
94
+ export { default as IdentifierFirst } from './components/presentation/auth/SignIn/v1/options/IdentifierFirst';
95
+ export { default as UsernamePassword } from './components/presentation/auth/SignIn/v1/options/UsernamePassword';
96
96
  export { default as GoogleButton } from './components/adapters/GoogleButton';
97
97
  export { default as GitHubButton } from './components/adapters/GitHubButton';
98
98
  export { default as MicrosoftButton } from './components/adapters/MicrosoftButton';
99
99
  export { default as FacebookButton } from './components/adapters/FacebookButton';
100
100
  export { default as LinkedInButton } from './components/adapters/LinkedInButton';
101
101
  export { default as SignInWithEthereumButton } from './components/adapters/SignInWithEthereumButton';
102
- export { default as EmailOtp } from './components/presentation/SignIn/non-component-driven/options/EmailOtp';
103
- export { default as Totp } from './components/presentation/SignIn/non-component-driven/options/Totp';
104
- export { default as SmsOtp } from './components/presentation/SignIn/non-component-driven/options/SmsOtp';
105
- export { default as SocialButton } from './components/presentation/SignIn/non-component-driven/options/SocialButton';
106
- export { default as MultiOptionButton } from './components/presentation/SignIn/non-component-driven/options/MultiOptionButton';
107
- export * from './components/presentation/SignIn/non-component-driven/options/SignInOptionFactory';
102
+ export { default as EmailOtp } from './components/presentation/auth/SignIn/v1/options/EmailOtp';
103
+ export { default as Totp } from './components/presentation/auth/SignIn/v1/options/Totp';
104
+ export { default as SmsOtp } from './components/presentation/auth/SignIn/v1/options/SmsOtp';
105
+ export { default as SocialButton } from './components/presentation/auth/SignIn/v1/options/SocialButton';
106
+ export { default as MultiOptionButton } from './components/presentation/auth/SignIn/v1/options/MultiOptionButton';
107
+ export * from './components/presentation/auth/SignIn/v1/options/SignInOptionFactory';
108
108
  export { default as BaseUser } from './components/presentation/User/BaseUser';
109
109
  export * from './components/presentation/User/BaseUser';
110
110
  export { default as User } from './components/presentation/User/User';