@asgardeo/react 0.1.0 → 0.1.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.
- package/README.md +27 -0
- package/dist/cjs/index.js +45007 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types/components/SignIn/SignIn.d.ts +31 -0
- package/dist/cjs/types/components/SignIn/fragments/BasicAuth.d.ts +35 -0
- package/dist/cjs/types/components/SignIn/fragments/EmailOtp.d.ts +32 -0
- package/dist/cjs/types/components/SignIn/fragments/LoginOptionsBox.d.ts +30 -0
- package/dist/cjs/types/components/SignIn/fragments/SmsOtp.d.ts +21 -0
- package/dist/cjs/types/components/SignIn/fragments/Totp.d.ts +33 -0
- package/dist/cjs/types/components/SignInButton/SignInButton.d.ts +29 -0
- package/dist/cjs/types/components/SignOutButton/SignOutButton.d.ts +27 -0
- package/dist/cjs/types/components/SignedIn/SignedIn.d.ts +29 -0
- package/dist/cjs/types/components/SignedOut/SignedOut.d.ts +29 -0
- package/dist/cjs/types/components/public-components.d.ts +22 -0
- package/dist/cjs/types/contexts/asgardeo-context.d.ts +21 -0
- package/dist/cjs/types/contexts/branding-preference-context.d.ts +21 -0
- package/dist/cjs/types/contexts/i18n-context.d.ts +21 -0
- package/dist/cjs/types/hooks/use-authentication.d.ts +27 -0
- package/dist/cjs/types/hooks/use-config.d.ts +23 -0
- package/dist/cjs/types/hooks/use-on.d.ts +20 -0
- package/dist/cjs/types/hooks/use-translations.d.ts +33 -0
- package/dist/cjs/types/index.d.ts +22 -0
- package/dist/cjs/types/models/asgardeo-provider-props.d.ts +24 -0
- package/dist/cjs/types/models/auth-context.d.ts +37 -0
- package/dist/cjs/types/models/basic-auth-props.d.ts +29 -0
- package/dist/cjs/types/models/branding-preference-provider-props.d.ts +22 -0
- package/dist/cjs/types/models/email-otp-props.d.ts +26 -0
- package/dist/cjs/types/models/i18n.d.ts +34 -0
- package/dist/cjs/types/models/jwt-verify-options.d.ts +25 -0
- package/dist/cjs/types/models/login-options-box-props.d.ts +24 -0
- package/dist/cjs/types/models/public-models.d.ts +19 -0
- package/dist/cjs/types/models/sign-in.d.ts +44 -0
- package/dist/cjs/types/models/signed-props.d.ts +22 -0
- package/dist/cjs/types/models/totp-props.d.ts +26 -0
- package/dist/cjs/types/models/use-authentication.d.ts +25 -0
- package/dist/cjs/types/models/use-config.d.ts +22 -0
- package/dist/cjs/types/models/use-on.d.ts +31 -0
- package/dist/cjs/types/models/use-translations.d.ts +22 -0
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignIn/SignIn.d.ts +79 -0
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInAlert/SignInAlert.d.ts +37 -0
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInButton/SignInButton.d.ts +27 -0
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInDivider/SignInDivider.d.ts +26 -0
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInFooter/SignInFooter.d.ts +29 -0
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInImage/SignInImage.d.ts +23 -0
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInLink/SignInLink.d.ts +25 -0
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInPaper/SignInPaper.d.ts +26 -0
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInPinInput/SignInPinInput.d.ts +30 -0
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInTextField/SignInTextField.d.ts +26 -0
- package/dist/cjs/types/oxygen-ui-react-auth-components/SignInTypography/SignInTypography.d.ts +32 -0
- package/dist/cjs/types/oxygen-ui-react-auth-components/index.d.ts +19 -0
- package/dist/cjs/types/oxygen-ui-react-auth-components/models/component.d.ts +27 -0
- package/dist/cjs/types/providers/AsgardeoProvider.d.ts +34 -0
- package/dist/cjs/types/providers/BrandingPreferenceProvider.d.ts +32 -0
- package/dist/cjs/types/providers/I18nProvider.d.ts +33 -0
- package/dist/cjs/types/theme/generate-theme-sign-in.d.ts +28 -0
- package/dist/cjs/types/theme/generate-theme.d.ts +30 -0
- package/dist/cjs/types/utils/crypto-utils.d.ts +52 -0
- package/dist/cjs/types/utils/session-store.d.ts +25 -0
- package/dist/esm/index.js +44980 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/components/SignIn/SignIn.d.ts +31 -0
- package/dist/esm/types/components/SignIn/fragments/BasicAuth.d.ts +35 -0
- package/dist/esm/types/components/SignIn/fragments/EmailOtp.d.ts +32 -0
- package/dist/esm/types/components/SignIn/fragments/LoginOptionsBox.d.ts +30 -0
- package/dist/esm/types/components/SignIn/fragments/SmsOtp.d.ts +21 -0
- package/dist/esm/types/components/SignIn/fragments/Totp.d.ts +33 -0
- package/dist/esm/types/components/SignInButton/SignInButton.d.ts +29 -0
- package/dist/esm/types/components/SignOutButton/SignOutButton.d.ts +27 -0
- package/dist/esm/types/components/SignedIn/SignedIn.d.ts +29 -0
- package/dist/esm/types/components/SignedOut/SignedOut.d.ts +29 -0
- package/dist/esm/types/components/public-components.d.ts +22 -0
- package/dist/esm/types/contexts/asgardeo-context.d.ts +21 -0
- package/dist/esm/types/contexts/branding-preference-context.d.ts +21 -0
- package/dist/esm/types/contexts/i18n-context.d.ts +21 -0
- package/dist/esm/types/hooks/use-authentication.d.ts +27 -0
- package/dist/esm/types/hooks/use-config.d.ts +23 -0
- package/dist/esm/types/hooks/use-on.d.ts +20 -0
- package/dist/esm/types/hooks/use-translations.d.ts +33 -0
- package/dist/esm/types/index.d.ts +22 -0
- package/dist/esm/types/models/asgardeo-provider-props.d.ts +24 -0
- package/dist/esm/types/models/auth-context.d.ts +37 -0
- package/dist/esm/types/models/basic-auth-props.d.ts +29 -0
- package/dist/esm/types/models/branding-preference-provider-props.d.ts +22 -0
- package/dist/esm/types/models/email-otp-props.d.ts +26 -0
- package/dist/esm/types/models/i18n.d.ts +34 -0
- package/dist/esm/types/models/jwt-verify-options.d.ts +25 -0
- package/dist/esm/types/models/login-options-box-props.d.ts +24 -0
- package/dist/esm/types/models/public-models.d.ts +19 -0
- package/dist/esm/types/models/sign-in.d.ts +44 -0
- package/dist/esm/types/models/signed-props.d.ts +22 -0
- package/dist/esm/types/models/totp-props.d.ts +26 -0
- package/dist/esm/types/models/use-authentication.d.ts +25 -0
- package/dist/esm/types/models/use-config.d.ts +22 -0
- package/dist/esm/types/models/use-on.d.ts +31 -0
- package/dist/esm/types/models/use-translations.d.ts +22 -0
- package/dist/esm/types/oxygen-ui-react-auth-components/SignIn/SignIn.d.ts +79 -0
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInAlert/SignInAlert.d.ts +37 -0
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInButton/SignInButton.d.ts +27 -0
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInDivider/SignInDivider.d.ts +26 -0
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInFooter/SignInFooter.d.ts +29 -0
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInImage/SignInImage.d.ts +23 -0
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInLink/SignInLink.d.ts +25 -0
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInPaper/SignInPaper.d.ts +26 -0
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInPinInput/SignInPinInput.d.ts +30 -0
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInTextField/SignInTextField.d.ts +26 -0
- package/dist/esm/types/oxygen-ui-react-auth-components/SignInTypography/SignInTypography.d.ts +32 -0
- package/dist/esm/types/oxygen-ui-react-auth-components/index.d.ts +19 -0
- package/dist/esm/types/oxygen-ui-react-auth-components/models/component.d.ts +27 -0
- package/dist/esm/types/providers/AsgardeoProvider.d.ts +34 -0
- package/dist/esm/types/providers/BrandingPreferenceProvider.d.ts +32 -0
- package/dist/esm/types/providers/I18nProvider.d.ts +33 -0
- package/dist/esm/types/theme/generate-theme-sign-in.d.ts +28 -0
- package/dist/esm/types/theme/generate-theme.d.ts +30 -0
- package/dist/esm/types/utils/crypto-utils.d.ts +52 -0
- package/dist/esm/types/utils/session-store.d.ts +25 -0
- package/dist/index.d.ts +355 -0
- package/package.json +10 -6
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { ReactElement, FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { BrandingProps, UIAuthConfig, Store, MeAPIResponse } from '@asgardeo/js';
|
|
3
|
+
export { UIAuthConfig } from '@asgardeo/js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
|
|
7
|
+
*
|
|
8
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
9
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
10
|
+
* in compliance with the License.
|
|
11
|
+
* You may obtain a copy of the License at
|
|
12
|
+
*
|
|
13
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
*
|
|
15
|
+
* Unless required by applicable law or agreed to in writing,
|
|
16
|
+
* software distributed under the License is distributed on an
|
|
17
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
18
|
+
* KIND, either express or implied. See the License for the
|
|
19
|
+
* specific language governing permissions and limitations
|
|
20
|
+
* under the License.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
interface SignInProps {
|
|
24
|
+
brandingProps?: BrandingProps;
|
|
25
|
+
showFooter?: boolean;
|
|
26
|
+
showLogo?: boolean;
|
|
27
|
+
showSignUp?: boolean;
|
|
28
|
+
}
|
|
29
|
+
interface SignInButtonProps extends SignInProps {
|
|
30
|
+
customComponent?: ReactElement;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
|
|
35
|
+
*
|
|
36
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
37
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
38
|
+
* in compliance with the License.
|
|
39
|
+
* You may obtain a copy of the License at
|
|
40
|
+
*
|
|
41
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
42
|
+
*
|
|
43
|
+
* Unless required by applicable law or agreed to in writing,
|
|
44
|
+
* software distributed under the License is distributed on an
|
|
45
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
46
|
+
* KIND, either express or implied. See the License for the
|
|
47
|
+
* specific language governing permissions and limitations
|
|
48
|
+
* under the License.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* This component provides the sign-in functionality.
|
|
53
|
+
*
|
|
54
|
+
* @param {SignInProps} props - Props injected to the component.
|
|
55
|
+
* @param {BrandingProps} props.brandingProps - Branding related props.
|
|
56
|
+
* @param {boolean} props.showSignUp - Show sign-up.
|
|
57
|
+
*
|
|
58
|
+
* @returns {ReactElement} - React element.
|
|
59
|
+
*/
|
|
60
|
+
declare const SignIn: FC<SignInProps>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
|
|
64
|
+
*
|
|
65
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
66
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
67
|
+
* in compliance with the License.
|
|
68
|
+
* You may obtain a copy of the License at
|
|
69
|
+
*
|
|
70
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
71
|
+
*
|
|
72
|
+
* Unless required by applicable law or agreed to in writing,
|
|
73
|
+
* software distributed under the License is distributed on an
|
|
74
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
75
|
+
* KIND, either express or implied. See the License for the
|
|
76
|
+
* specific language governing permissions and limitations
|
|
77
|
+
* under the License.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
interface SignedProps {
|
|
81
|
+
fallback?: ReactElement;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
|
|
86
|
+
*
|
|
87
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
88
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
89
|
+
* in compliance with the License.
|
|
90
|
+
* You may obtain a copy of the License at
|
|
91
|
+
*
|
|
92
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
93
|
+
*
|
|
94
|
+
* Unless required by applicable law or agreed to in writing,
|
|
95
|
+
* software distributed under the License is distributed on an
|
|
96
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
97
|
+
* KIND, either express or implied. See the License for the
|
|
98
|
+
* specific language governing permissions and limitations
|
|
99
|
+
* under the License.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* This component renders its children if the user is signed out.
|
|
104
|
+
*
|
|
105
|
+
* @param {PropsWithChildren<SignedProps>} props - Props injected to the component.
|
|
106
|
+
* @param {ReactElement} props.fallback - Fallback element to render.
|
|
107
|
+
*
|
|
108
|
+
* @return {JSX.Element}
|
|
109
|
+
*/
|
|
110
|
+
declare const SignedIn: FC<PropsWithChildren<SignedProps>>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
|
|
114
|
+
*
|
|
115
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
116
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
117
|
+
* in compliance with the License.
|
|
118
|
+
* You may obtain a copy of the License at
|
|
119
|
+
*
|
|
120
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
121
|
+
*
|
|
122
|
+
* Unless required by applicable law or agreed to in writing,
|
|
123
|
+
* software distributed under the License is distributed on an
|
|
124
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
125
|
+
* KIND, either express or implied. See the License for the
|
|
126
|
+
* specific language governing permissions and limitations
|
|
127
|
+
* under the License.
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* This component renders its children if the user is signed out.
|
|
132
|
+
*
|
|
133
|
+
* @param {PropsWithChildren<SignedProps>} props - Props injected to the component.
|
|
134
|
+
* @param {ReactElement} props.fallback - Fallback element to render.
|
|
135
|
+
*
|
|
136
|
+
* @return {JSX.Element}
|
|
137
|
+
*/
|
|
138
|
+
declare const SignedOut: FC<PropsWithChildren<SignedProps>>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
142
|
+
*
|
|
143
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
144
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
145
|
+
* in compliance with the License.
|
|
146
|
+
* You may obtain a copy of the License at
|
|
147
|
+
*
|
|
148
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
149
|
+
*
|
|
150
|
+
* Unless required by applicable law or agreed to in writing,
|
|
151
|
+
* software distributed under the License is distributed on an
|
|
152
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
153
|
+
* KIND, either express or implied. See the License for the
|
|
154
|
+
* specific language governing permissions and limitations
|
|
155
|
+
* under the License.
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* SignInButton component. This button will render a modal with the SignIn component when clicked.
|
|
160
|
+
*
|
|
161
|
+
* @param {Object} props - Component props.
|
|
162
|
+
* @param {ReactElement} props.customComponent - Optional custom component to be rendered.
|
|
163
|
+
* @returns {ReactElement} Rendered SignInButton component.
|
|
164
|
+
*/
|
|
165
|
+
declare const SignInButton: (props: SignInButtonProps) => ReactElement;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
|
|
169
|
+
*
|
|
170
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
171
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
172
|
+
* in compliance with the License.
|
|
173
|
+
* You may obtain a copy of the License at
|
|
174
|
+
*
|
|
175
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
176
|
+
*
|
|
177
|
+
* Unless required by applicable law or agreed to in writing,
|
|
178
|
+
* software distributed under the License is distributed on an
|
|
179
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
180
|
+
* KIND, either express or implied. See the License for the
|
|
181
|
+
* specific language governing permissions and limitations
|
|
182
|
+
* under the License.
|
|
183
|
+
*/
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* SignOutButton component.
|
|
187
|
+
*
|
|
188
|
+
* This component renders a sign out button. When clicked, it triggers the sign out process.
|
|
189
|
+
*
|
|
190
|
+
* @returns {ReactElement} Rendered SignOutButton component.
|
|
191
|
+
*/
|
|
192
|
+
declare const SignOutButton: () => ReactElement;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
|
|
196
|
+
*
|
|
197
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
198
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
199
|
+
* in compliance with the License.
|
|
200
|
+
* You may obtain a copy of the License at
|
|
201
|
+
*
|
|
202
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
203
|
+
*
|
|
204
|
+
* Unless required by applicable law or agreed to in writing,
|
|
205
|
+
* software distributed under the License is distributed on an
|
|
206
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
207
|
+
* KIND, either express or implied. See the License for the
|
|
208
|
+
* specific language governing permissions and limitations
|
|
209
|
+
* under the License.
|
|
210
|
+
*/
|
|
211
|
+
declare enum Hooks {
|
|
212
|
+
SignIn = 0,
|
|
213
|
+
SignOut = 1
|
|
214
|
+
}
|
|
215
|
+
interface UseOnProps {
|
|
216
|
+
/**
|
|
217
|
+
* The callback to be executed when the event is triggered.
|
|
218
|
+
*/
|
|
219
|
+
callback: (response?: any) => void | Promise<void>;
|
|
220
|
+
/**
|
|
221
|
+
* The event to listen to.
|
|
222
|
+
*/
|
|
223
|
+
event: Hooks;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
|
|
228
|
+
*
|
|
229
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
230
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
231
|
+
* in compliance with the License.
|
|
232
|
+
* You may obtain a copy of the License at
|
|
233
|
+
*
|
|
234
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
235
|
+
*
|
|
236
|
+
* Unless required by applicable law or agreed to in writing,
|
|
237
|
+
* software distributed under the License is distributed on an
|
|
238
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
239
|
+
* KIND, either express or implied. See the License for the
|
|
240
|
+
* specific language governing permissions and limitations
|
|
241
|
+
* under the License.
|
|
242
|
+
*/
|
|
243
|
+
|
|
244
|
+
interface AsgardeoProviderProps {
|
|
245
|
+
branding?: BrandingProps;
|
|
246
|
+
config: UIAuthConfig;
|
|
247
|
+
store?: Store;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
|
|
252
|
+
*
|
|
253
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
254
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
255
|
+
* in compliance with the License.
|
|
256
|
+
* You may obtain a copy of the License at
|
|
257
|
+
*
|
|
258
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
259
|
+
*
|
|
260
|
+
* Unless required by applicable law or agreed to in writing,
|
|
261
|
+
* software distributed under the License is distributed on an
|
|
262
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
263
|
+
* KIND, either express or implied. See the License for the
|
|
264
|
+
* specific language governing permissions and limitations
|
|
265
|
+
* under the License.
|
|
266
|
+
*/
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* `AsgardeoProvider` is a component that provides an Asgardeo context to all its children.
|
|
270
|
+
* It takes an object of type `AsgardeProviderProps` as props, which includes the children to render,
|
|
271
|
+
* a configuration object, a store instance, and a branding object.
|
|
272
|
+
*
|
|
273
|
+
* @param {PropsWithChildren<AsgardeoProviderProps>} props - The properties passed to the component.
|
|
274
|
+
* @param {ReactNode} props.children - The children to render inside the provider.
|
|
275
|
+
* @param {Config} props.config - The configuration object for the Asgardeo context.
|
|
276
|
+
* @param {Store} [props.store] - An optional store instance. If not provided, a new SessionStore will be created.
|
|
277
|
+
* @param {Branding} props.branding - The branding object for the Asgardeo context.
|
|
278
|
+
*
|
|
279
|
+
* @returns {ReactElement} A React element that provides the Asgardeo context to all its children.
|
|
280
|
+
*/
|
|
281
|
+
declare const AsgardeoProvider: FC<PropsWithChildren<AsgardeoProviderProps>>;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
|
|
285
|
+
*
|
|
286
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
287
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
288
|
+
* in compliance with the License.
|
|
289
|
+
* You may obtain a copy of the License at
|
|
290
|
+
*
|
|
291
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
292
|
+
*
|
|
293
|
+
* Unless required by applicable law or agreed to in writing,
|
|
294
|
+
* software distributed under the License is distributed on an
|
|
295
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
296
|
+
* KIND, either express or implied. See the License for the
|
|
297
|
+
* specific language governing permissions and limitations
|
|
298
|
+
* under the License.
|
|
299
|
+
*/
|
|
300
|
+
|
|
301
|
+
interface UseAuthentication {
|
|
302
|
+
accessToken: string;
|
|
303
|
+
isAuthenticated: Promise<boolean> | boolean;
|
|
304
|
+
signOut: () => void;
|
|
305
|
+
user: MeAPIResponse;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
|
|
310
|
+
*
|
|
311
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
312
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
313
|
+
* in compliance with the License.
|
|
314
|
+
* You may obtain a copy of the License at
|
|
315
|
+
*
|
|
316
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
317
|
+
*
|
|
318
|
+
* Unless required by applicable law or agreed to in writing,
|
|
319
|
+
* software distributed under the License is distributed on an
|
|
320
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
321
|
+
* KIND, either express or implied. See the License for the
|
|
322
|
+
* specific language governing permissions and limitations
|
|
323
|
+
* under the License.
|
|
324
|
+
*/
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* `useAuthentication` is a custom hook that provides access to the authentication context.
|
|
328
|
+
* It returns an object containing the current user, the authentication status, the access token, and a sign out function.
|
|
329
|
+
*
|
|
330
|
+
* @returns {UseAuthentication} An object containing the current user (`user`), the authentication status (`isAuthenticated`),
|
|
331
|
+
* the access token (`accessToken`), and a sign out function (`signOut`).
|
|
332
|
+
*/
|
|
333
|
+
declare const useAuthentication: () => UseAuthentication;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
|
|
337
|
+
*
|
|
338
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
339
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
340
|
+
* in compliance with the License.
|
|
341
|
+
* You may obtain a copy of the License at
|
|
342
|
+
*
|
|
343
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
344
|
+
*
|
|
345
|
+
* Unless required by applicable law or agreed to in writing,
|
|
346
|
+
* software distributed under the License is distributed on an
|
|
347
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
348
|
+
* KIND, either express or implied. See the License for the
|
|
349
|
+
* specific language governing permissions and limitations
|
|
350
|
+
* under the License.
|
|
351
|
+
*/
|
|
352
|
+
|
|
353
|
+
declare const useOn: (props: UseOnProps) => void;
|
|
354
|
+
|
|
355
|
+
export { AsgardeoProvider, Hooks, SignIn, SignInButton, SignOutButton, SignedIn, SignedOut, useAuthentication, useOn };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asgardeo/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "React Wrapper to build customizable login UIs for Asgardeo or Identity Server",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
"author": "WSO2",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"files": [
|
|
12
|
-
"dist"
|
|
12
|
+
"dist",
|
|
13
|
+
"LICENSE",
|
|
14
|
+
"README.md"
|
|
13
15
|
],
|
|
14
16
|
"homepage": "https://github.com/asgardeo/web-ui-sdks/tree/main/packages/react#readme",
|
|
15
17
|
"bugs": {
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
},
|
|
18
20
|
"repository": {
|
|
19
21
|
"type": "git",
|
|
20
|
-
"url": "https://github.com/asgardeo/web-ui-sdks
|
|
22
|
+
"url": "https://github.com/asgardeo/web-ui-sdks",
|
|
21
23
|
"directory": "packages/react"
|
|
22
24
|
},
|
|
23
25
|
"keywords": [
|
|
@@ -47,6 +49,7 @@
|
|
|
47
49
|
"prettier": "^3.2.5",
|
|
48
50
|
"react": "^18.2.0",
|
|
49
51
|
"react-dom": "^18.2.0",
|
|
52
|
+
"rollup": "^4.17.2",
|
|
50
53
|
"rollup-plugin-dts": "^6.1.0",
|
|
51
54
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
52
55
|
"rollup-plugin-styles": "^4.0.0",
|
|
@@ -63,12 +66,13 @@
|
|
|
63
66
|
"clsx": "^2.1.1",
|
|
64
67
|
"fast-sha256": "^1.3.0",
|
|
65
68
|
"jose": "^5.3.0",
|
|
66
|
-
"randombytes": "^2.1.0"
|
|
67
|
-
"rollup": "^4.17.2"
|
|
69
|
+
"randombytes": "^2.1.0"
|
|
68
70
|
},
|
|
69
71
|
"peerDependencies": {
|
|
70
72
|
"react": ">=18.0.0",
|
|
71
73
|
"react-dom": ">=18.0.0"
|
|
72
74
|
},
|
|
73
|
-
"scripts": {
|
|
75
|
+
"scripts": {
|
|
76
|
+
"build": "rollup -c"
|
|
77
|
+
}
|
|
74
78
|
}
|