@asgardeo/react 0.1.1 → 0.2.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.
@@ -15,7 +15,7 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { ReactElement } from 'react';
18
+ import { PropsWithChildren, ReactElement } from 'react';
19
19
  import BasicAuthProps from '../../../models/basic-auth-props';
20
20
  import './basic-auth.scss';
21
21
  /**
@@ -31,5 +31,5 @@ import './basic-auth.scss';
31
31
  *
32
32
  * @return {ReactElement}
33
33
  */
34
- declare const BasicAuth: ({ handleAuthenticate, authenticator, alert, brandingProps, showSelfSignUp, renderLoginOptions, }: BasicAuthProps) => ReactElement;
34
+ declare const BasicAuth: ({ handleAuthenticate, authenticator, children, alert, brandingProps, showSelfSignUp, renderLoginOptions, }: PropsWithChildren<BasicAuthProps>) => ReactElement;
35
35
  export default BasicAuth;
@@ -15,7 +15,7 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { ReactElement } from 'react';
18
+ import { PropsWithChildren, ReactElement } from 'react';
19
19
  import EmailOtpProps from '../../../models/email-otp-props';
20
20
  import './email-otp.scss';
21
21
  /**
@@ -28,5 +28,5 @@ import './email-otp.scss';
28
28
  * @param {AlertType} props.alert - Alert type.
29
29
  * @return {ReactElement}
30
30
  */
31
- declare const EmailOtp: ({ alert, brandingProps, authenticator, handleAuthenticate }: EmailOtpProps) => ReactElement;
31
+ declare const EmailOtp: ({ alert, brandingProps, authenticator, children, handleAuthenticate }: PropsWithChildren<EmailOtpProps>) => ReactElement;
32
32
  export default EmailOtp;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Copyright (c) 2024, 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 { PropsWithChildren, ReactElement } from 'react';
19
+ import BasicAuthProps from '../../../models/basic-auth-props';
20
+ import './basic-auth.scss';
21
+ /**
22
+ * This component renders the IdentifierFirst authentication form.
23
+ *
24
+ * @param {IdentifierFirstProps} props - Props injected to the IdentifierFirst authentication component.
25
+ * @param {BrandingProps} props.brandingProps - Branding props.
26
+ * @param {Function} props.handleAuthenticate - Callback to handle authentication.
27
+ * @param {Authenticator} props.authenticator - Authenticator.
28
+ * @param {AlertType} props.alert - Alert type.
29
+ * @param {ReactElement[]} props.renderLoginOptions - Login options.
30
+ * @param {boolean} props.showSelfSignUp - Show self sign up.
31
+ *
32
+ * @return {ReactElement}
33
+ */
34
+ declare const IdentifierFirst: ({ handleAuthenticate, authenticator, alert, brandingProps, children, showSelfSignUp, renderLoginOptions, }: PropsWithChildren<BasicAuthProps>) => ReactElement;
35
+ export default IdentifierFirst;
@@ -15,7 +15,7 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { ReactElement } from 'react';
18
+ import { PropsWithChildren, ReactElement } from 'react';
19
19
  import EmailOtpProps from '../../../models/email-otp-props';
20
- declare const SmsOtp: ({ alert, brandingProps, authenticator, handleAuthenticate }: EmailOtpProps) => ReactElement;
20
+ declare const SmsOtp: ({ alert, brandingProps, authenticator, children, handleAuthenticate, }: PropsWithChildren<EmailOtpProps>) => ReactElement;
21
21
  export default SmsOtp;
@@ -15,7 +15,7 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { ReactElement } from 'react';
18
+ import { ReactElement, PropsWithChildren } from 'react';
19
19
  import TotpProps from '../../../models/totp-props';
20
20
  import './totp.scss';
21
21
  /**
@@ -29,5 +29,5 @@ import './totp.scss';
29
29
  *
30
30
  * @return {ReactElement}
31
31
  */
32
- declare const Totp: ({ brandingProps, authenticator, handleAuthenticate, alert }: TotpProps) => ReactElement;
32
+ declare const Totp: ({ brandingProps, authenticator, children, handleAuthenticate, alert, }: PropsWithChildren<TotpProps>) => ReactElement;
33
33
  export default Totp;
@@ -16,9 +16,10 @@
16
16
  * under the License.
17
17
  */
18
18
  /// <reference types="react" />
19
- import { UIAuthConfig, MeAPIResponse } from '@asgardeo/js';
19
+ import { UIAuthConfig, MeAPIResponse, AuthApiResponse } from '@asgardeo/js';
20
20
  interface AuthContext {
21
21
  accessToken: string;
22
+ authResponse: AuthApiResponse;
22
23
  config: UIAuthConfig;
23
24
  isAuthLoading: boolean;
24
25
  isAuthenticated: boolean | undefined;
@@ -26,12 +27,15 @@ interface AuthContext {
26
27
  isGlobalLoading: boolean;
27
28
  isTextLoading: boolean;
28
29
  onSignOutRef: React.MutableRefObject<Function>;
30
+ setAuthResponse: (response: AuthApiResponse) => void;
29
31
  setAuthentication: () => void;
30
32
  setIsAuthLoading: (value: boolean) => void;
31
33
  setIsBrandingLoading: (value: boolean) => void;
32
34
  setIsTextLoading: (value: boolean) => void;
33
35
  setOnSignIn: (response?: any) => void | Promise<void>;
34
36
  setOnSignOut: (response?: any) => void | Promise<void>;
37
+ setUsername: (username: string) => void;
35
38
  user: MeAPIResponse;
39
+ username: string;
36
40
  }
37
41
  export default AuthContext;
@@ -18,10 +18,15 @@
18
18
  import { BrandingProps } from '@asgardeo/js';
19
19
  import { ReactElement } from 'react';
20
20
  export interface SignInProps {
21
+ basicAuthChildren?: ReactElement;
21
22
  brandingProps?: BrandingProps;
23
+ emailOtpChildren?: ReactElement;
24
+ identifierFirstChildren?: ReactElement;
22
25
  showFooter?: boolean;
23
26
  showLogo?: boolean;
24
27
  showSignUp?: boolean;
28
+ smsOtpChildren?: ReactElement;
29
+ totpChildren?: ReactElement;
25
30
  }
26
31
  export type AlertType = {
27
32
  alertType: {
@@ -15,11 +15,14 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { MeAPIResponse } from '@asgardeo/js';
18
+ import { AuthApiResponse, MeAPIResponse } from '@asgardeo/js';
19
19
  interface UseAuthentication {
20
20
  accessToken: string;
21
+ authResponse: AuthApiResponse;
21
22
  isAuthenticated: Promise<boolean> | boolean;
23
+ setUsername: (username: string) => void;
22
24
  signOut: () => void;
23
25
  user: MeAPIResponse;
26
+ username: string;
24
27
  }
25
28
  export default UseAuthentication;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ReactElement, FC, PropsWithChildren } from 'react';
2
- import { BrandingProps, UIAuthConfig, Store, MeAPIResponse } from '@asgardeo/js';
2
+ import { BrandingProps, UIAuthConfig, Store, AuthApiResponse, MeAPIResponse } from '@asgardeo/js';
3
3
  export { UIAuthConfig } from '@asgardeo/js';
4
4
 
5
5
  /**
@@ -21,10 +21,15 @@ export { UIAuthConfig } from '@asgardeo/js';
21
21
  */
22
22
 
23
23
  interface SignInProps {
24
+ basicAuthChildren?: ReactElement;
24
25
  brandingProps?: BrandingProps;
26
+ emailOtpChildren?: ReactElement;
27
+ identifierFirstChildren?: ReactElement;
25
28
  showFooter?: boolean;
26
29
  showLogo?: boolean;
27
30
  showSignUp?: boolean;
31
+ smsOtpChildren?: ReactElement;
32
+ totpChildren?: ReactElement;
28
33
  }
29
34
  interface SignInButtonProps extends SignInProps {
30
35
  customComponent?: ReactElement;
@@ -300,9 +305,12 @@ declare const AsgardeoProvider: FC<PropsWithChildren<AsgardeoProviderProps>>;
300
305
 
301
306
  interface UseAuthentication {
302
307
  accessToken: string;
308
+ authResponse: AuthApiResponse;
303
309
  isAuthenticated: Promise<boolean> | boolean;
310
+ setUsername: (username: string) => void;
304
311
  signOut: () => void;
305
312
  user: MeAPIResponse;
313
+ username: string;
306
314
  }
307
315
 
308
316
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asgardeo/react",
3
- "version": "0.1.1",
3
+ "version": "0.2.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",