Skip to content

Commit

Permalink
chore: release custom v2.2.4-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ramasilveyra committed Sep 30, 2024
1 parent 75fb24b commit 50de828
Show file tree
Hide file tree
Showing 30 changed files with 2,114 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ typings/

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
Expand Down
15 changes: 15 additions & 0 deletions dist/auth-state.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { User } from '@auth0/auth0-spa-js';
/**
* The auth state which, when combined with the auth methods, make up the return object of the `useAuth0` hook.
*/
export interface AuthState<TUser extends User = User> {
error?: Error;
isAuthenticated: boolean;
isLoading: boolean;
user?: TUser;
}
/**
* The initial auth state.
*/
export declare const initialAuthState: AuthState;
//# sourceMappingURL=auth-state.d.ts.map
1 change: 1 addition & 0 deletions dist/auth-state.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

136 changes: 136 additions & 0 deletions dist/auth0-context.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/// <reference types="react" />
import { GetTokenSilentlyOptions, GetTokenWithPopupOptions, IdToken, LogoutOptions as SPALogoutOptions, PopupLoginOptions, PopupConfigOptions, RedirectLoginResult, User, GetTokenSilentlyVerboseResponse, RedirectLoginOptions as SPARedirectLoginOptions } from '@auth0/auth0-spa-js';
import { AuthState } from './auth-state';
import { AppState } from './auth0-provider';
export interface LogoutOptions extends Omit<SPALogoutOptions, 'onRedirect'> {
}
export interface RedirectLoginOptions<TAppState = AppState> extends Omit<SPARedirectLoginOptions<TAppState>, 'onRedirect'> {
}
/**
* Contains the authenticated state and authentication methods provided by the `useAuth0` hook.
*/
export interface Auth0ContextInterface<TUser extends User = User> extends AuthState<TUser> {
/**
* ```js
* const token = await getAccessTokenSilently(options);
* ```
*
* If there's a valid token stored, return it. Otherwise, opens an
* iframe with the `/authorize` URL using the parameters provided
* as arguments. Random and secure `state` and `nonce` parameters
* will be auto-generated. If the response is successful, results
* will be valid according to their expiration times.
*
* If refresh tokens are used, the token endpoint is called directly with the
* 'refresh_token' grant. If no refresh token is available to make this call,
* the SDK will only fall back to using an iframe to the '/authorize' URL if
* the `useRefreshTokensFallback` setting has been set to `true`. By default this
* setting is `false`.
*
* This method may use a web worker to perform the token call if the in-memory
* cache is used.
*
* If an `audience` value is given to this function, the SDK always falls
* back to using an iframe to make the token exchange.
*
* Note that in all cases, falling back to an iframe requires access to
* the `auth0` cookie.
*/
getAccessTokenSilently: {
(options: GetTokenSilentlyOptions & {
detailedResponse: true;
}): Promise<GetTokenSilentlyVerboseResponse>;
(options?: GetTokenSilentlyOptions): Promise<string>;
(options: GetTokenSilentlyOptions): Promise<GetTokenSilentlyVerboseResponse | string>;
};
/**
* ```js
* const token = await getTokenWithPopup(options, config);
* ```
*
* Get an access token interactively.
*
* Opens a popup with the `/authorize` URL using the parameters
* provided as arguments. Random and secure `state` and `nonce`
* parameters will be auto-generated. If the response is successful,
* results will be valid according to their expiration times.
*/
getAccessTokenWithPopup: (options?: GetTokenWithPopupOptions, config?: PopupConfigOptions) => Promise<string | undefined>;
/**
* ```js
* const claims = await getIdTokenClaims();
* ```
*
* Returns all claims from the id_token if available.
*/
getIdTokenClaims: () => Promise<IdToken | undefined>;
/**
* ```js
* await loginWithRedirect(options);
* ```
*
* Performs a redirect to `/authorize` using the parameters
* provided as arguments. Random and secure `state` and `nonce`
* parameters will be auto-generated.
*/
loginWithRedirect: (options?: RedirectLoginOptions<AppState>) => Promise<void>;
/**
* ```js
* await loginWithPopup(options, config);
* ```
*
* Opens a popup with the `/authorize` URL using the parameters
* provided as arguments. Random and secure `state` and `nonce`
* parameters will be auto-generated. If the response is successful,
* results will be valid according to their expiration times.
*
* IMPORTANT: This method has to be called from an event handler
* that was started by the user like a button click, for example,
* otherwise the popup will be blocked in most browsers.
*/
loginWithPopup: (options?: PopupLoginOptions, config?: PopupConfigOptions) => Promise<void>;
/**
* ```js
* auth0.logout({ logoutParams: { returnTo: window.location.origin } });
* ```
*
* Clears the application session and performs a redirect to `/v2/logout`, using
* the parameters provided as arguments, to clear the Auth0 session.
* If the `logoutParams.federated` option is specified, it also clears the Identity Provider session.
* [Read more about how Logout works at Auth0](https://auth0.com/docs/logout).
*/
logout: (options?: LogoutOptions) => Promise<void>;
/**
* After the browser redirects back to the callback page,
* call `handleRedirectCallback` to handle success and error
* responses from Auth0. If the response is successful, results
* will be valid according to their expiration times.
*
* @param url The URL to that should be used to retrieve the `state` and `code` values. Defaults to `window.location.href` if not given.
*/
handleRedirectCallback: (url?: string) => Promise<RedirectLoginResult>;
}
/**
* @ignore
*/
export declare const initialContext: {
buildAuthorizeUrl: () => never;
buildLogoutUrl: () => never;
getAccessTokenSilently: () => never;
getAccessTokenWithPopup: () => never;
getIdTokenClaims: () => never;
loginWithRedirect: () => never;
loginWithPopup: () => never;
logout: () => never;
handleRedirectCallback: () => never;
error?: Error | undefined;
isAuthenticated: boolean;
isLoading: boolean;
user?: User | undefined;
};
/**
* The Auth0 Context
*/
declare const Auth0Context: import("react").Context<Auth0ContextInterface<User>>;
export default Auth0Context;
//# sourceMappingURL=auth0-context.d.ts.map
1 change: 1 addition & 0 deletions dist/auth0-context.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 76 additions & 0 deletions dist/auth0-provider.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import React from 'react';
import { Auth0Client, Auth0ClientOptions, User } from '@auth0/auth0-spa-js';
import { Auth0ContextInterface } from './auth0-context';
/**
* The state of the application before the user was redirected to the login page.
*/
export type AppState = {
returnTo?: string;
[key: string]: any;
};
/**
* The main configuration to instantiate the `Auth0Provider`.
*/
export interface Auth0ProviderOptions extends Auth0ClientOptions {
/**
* The child nodes your Provider has wrapped
*/
children?: React.ReactNode;
/**
* By default this removes the code and state parameters from the url when you are redirected from the authorize page.
* It uses `window.history` but you might want to overwrite this if you are using a custom router, like `react-router-dom`
* See the EXAMPLES.md for more info.
*/
onRedirectCallback?: (appState?: AppState, user?: User) => void;
/**
* By default, if the page url has code/state params, the SDK will treat them as Auth0's and attempt to exchange the
* code for a token. In some cases the code might be for something else (another OAuth SDK perhaps). In these
* instances you can instruct the client to ignore them eg
*
* ```jsx
* <Auth0Provider
* clientId={clientId}
* domain={domain}
* skipRedirectCallback={window.location.pathname === '/stripe-oauth-callback'}
* >
* ```
*/
skipRedirectCallback?: boolean;
/**
* Context to be used when creating the Auth0Provider, defaults to the internally created context.
*
* This allows multiple Auth0Providers to be nested within the same application, the context value can then be
* passed to useAuth0, withAuth0, or withAuthenticationRequired to use that specific Auth0Provider to access
* auth state and methods specifically tied to the provider that the context belongs to.
*
* When using multiple Auth0Providers in a single application you should do the following to ensure sessions are not
* overwritten:
*
* * Configure a different redirect_uri for each Auth0Provider, and set skipRedirectCallback for each provider to ignore
* the others redirect_uri
* * If using localstorage for both Auth0Providers, ensure that the audience and scope are different for so that the key
* used to store data is different
*
* For a sample on using multiple Auth0Providers review the [React Account Linking Sample](https://github.com/auth0-samples/auth0-link-accounts-sample/tree/react-variant)
*/
context?: React.Context<Auth0ContextInterface>;
/**
* The Auth0Client instance to be used for authentication.
*/
configuredClient?: Auth0Client;
}
/**
* ```jsx
* <Auth0Provider
* domain={domain}
* clientId={clientId}
* authorizationParams={{ redirect_uri: window.location.origin }}>
* <MyApp />
* </Auth0Provider>
* ```
*
* Provides the Auth0Context to its child components.
*/
declare const Auth0Provider: (opts: Auth0ProviderOptions) => JSX.Element;
export default Auth0Provider;
//# sourceMappingURL=auth0-provider.d.ts.map
1 change: 1 addition & 0 deletions dist/auth0-provider.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

567 changes: 567 additions & 0 deletions dist/auth0-react.cjs.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/auth0-react.cjs.js.map

Large diffs are not rendered by default.

549 changes: 549 additions & 0 deletions dist/auth0-react.esm.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/auth0-react.esm.js.map

Large diffs are not rendered by default.

571 changes: 571 additions & 0 deletions dist/auth0-react.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/auth0-react.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dist/auth0-react.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/auth0-react.min.js.map

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions dist/errors.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* An OAuth2 error will come from the authorization server and will have at least an `error` property which will
* be the error code. And possibly an `error_description` property
*
* See: https://openid.net/specs/openid-connect-core-1_0.html#rfc.section.3.1.2.6
*/
export declare class OAuthError extends Error {
error: string;
error_description?: string | undefined;
constructor(error: string, error_description?: string | undefined);
}
//# sourceMappingURL=errors.d.ts.map
1 change: 1 addition & 0 deletions dist/errors.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export { default as Auth0Provider, Auth0ProviderOptions, AppState, } from './auth0-provider';
export { default as useAuth0 } from './use-auth0';
export { default as withAuth0, WithAuth0Props } from './with-auth0';
export { default as withAuthenticationRequired, WithAuthenticationRequiredOptions, } from './with-authentication-required';
export { default as Auth0Context, Auth0ContextInterface, initialContext, LogoutOptions, RedirectLoginOptions, } from './auth0-context';
export { AuthorizationParams, PopupLoginOptions, PopupConfigOptions, GetTokenWithPopupOptions, LogoutUrlOptions, CacheLocation, GetTokenSilentlyOptions, IdToken, User, ICache, InMemoryCache, LocalStorageCache, Cacheable, TimeoutError, MfaRequiredError, PopupCancelledError, PopupTimeoutError, AuthenticationError, MissingRefreshTokenError, GenericError } from '@auth0/auth0-spa-js';
export { OAuthError } from './errors';
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions dist/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions dist/reducer.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { User } from '@auth0/auth0-spa-js';
import { AuthState } from './auth-state';
type Action = {
type: 'LOGIN_POPUP_STARTED';
} | {
type: 'INITIALISED' | 'LOGIN_POPUP_COMPLETE' | 'GET_ACCESS_TOKEN_COMPLETE' | 'HANDLE_REDIRECT_COMPLETE';
user?: User;
} | {
type: 'LOGOUT';
} | {
type: 'ERROR';
error: Error;
};
/**
* Handles how that state changes in the `useAuth0` hook.
*/
export declare const reducer: (state: AuthState, action: Action) => AuthState;
export {};
//# sourceMappingURL=reducer.d.ts.map
1 change: 1 addition & 0 deletions dist/reducer.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions dist/use-auth0.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/// <reference types="react" />
import { User } from '@auth0/auth0-spa-js';
import { Auth0ContextInterface } from './auth0-context';
/**
* ```js
* const {
* // Auth state:
* error,
* isAuthenticated,
* isLoading,
* user,
* // Auth methods:
* getAccessTokenSilently,
* getAccessTokenWithPopup,
* getIdTokenClaims,
* loginWithRedirect,
* loginWithPopup,
* logout,
* } = useAuth0<TUser>();
* ```
*
* Use the `useAuth0` hook in your components to access the auth state and methods.
*
* TUser is an optional type param to provide a type to the `user` field.
*/
declare const useAuth0: <TUser extends User = User>(context?: import("react").Context<Auth0ContextInterface<User>>) => Auth0ContextInterface<TUser>;
export default useAuth0;
//# sourceMappingURL=use-auth0.d.ts.map
1 change: 1 addition & 0 deletions dist/use-auth0.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions dist/utils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export declare const hasAuthParams: (searchParams?: string) => boolean;
export declare const loginError: (error: unknown) => Error;
export declare const tokenError: (error: unknown) => Error;
/**
* @ignore
* Helper function to map the v1 `redirectUri` option to the v2 `authorizationParams.redirect_uri`
* and log a warning.
*/
export declare const deprecateRedirectUri: (options?: any) => void;
//# sourceMappingURL=utils.d.ts.map
1 change: 1 addition & 0 deletions dist/utils.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions dist/with-auth0.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React, { ComponentType } from 'react';
import { Auth0ContextInterface } from './auth0-context';
/**
* Components wrapped in `withAuth0` will have an additional `auth0` prop
*/
export interface WithAuth0Props {
auth0: Auth0ContextInterface;
}
/**
* ```jsx
* class MyComponent extends Component {
* render() {
* // Access the auth context from the `auth0` prop
* const { user } = this.props.auth0;
* return <div>Hello {user.name}!</div>
* }
* }
* // Wrap your class component in withAuth0
* export default withAuth0(MyComponent);
* ```
*
* Wrap your class components in this Higher Order Component to give them access to the Auth0Context.
*
* Providing a context as the second argument allows you to configure the Auth0Provider the Auth0Context
* should come from f you have multiple within your application.
*/
declare const withAuth0: <P extends WithAuth0Props>(Component: React.ComponentType<P>, context?: React.Context<Auth0ContextInterface<import("@auth0/auth0-spa-js").User>>) => React.ComponentType<Omit<P, "auth0">>;
export default withAuth0;
//# sourceMappingURL=with-auth0.d.ts.map
Loading

0 comments on commit 50de828

Please sign in to comment.