@auth0/auth0-react 2.15.0 → 2.16.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.
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Auth0ClientOptions, User, ConnectAccountRedirectResult, ResponseType } from '@auth0/auth0-spa-js';
2
+ import { Auth0Client, Auth0ClientOptions, User, ConnectAccountRedirectResult, ResponseType } from '@auth0/auth0-spa-js';
3
3
  import { Auth0ContextInterface } from './auth0-context';
4
4
  /**
5
5
  * The account that has been connected during the connect flow.
@@ -15,10 +15,7 @@ export type AppState = {
15
15
  response_type?: ResponseType;
16
16
  [key: string]: any;
17
17
  };
18
- /**
19
- * The main configuration to instantiate the `Auth0Provider`.
20
- */
21
- export interface Auth0ProviderOptions<TUser extends User = User> extends Auth0ClientOptions {
18
+ type Auth0ProviderBaseOptions<TUser extends User = User> = {
22
19
  /**
23
20
  * The child nodes your Provider has wrapped
24
21
  */
@@ -61,7 +58,27 @@ export interface Auth0ProviderOptions<TUser extends User = User> extends Auth0Cl
61
58
  * 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)
62
59
  */
63
60
  context?: React.Context<Auth0ContextInterface<TUser>>;
64
- }
61
+ };
62
+ /**
63
+ * Options for `Auth0Provider` when configuring Auth0 via `domain` and `clientId`.
64
+ * Use this type when building wrapper components around `Auth0Provider`.
65
+ */
66
+ export type Auth0ProviderWithConfigOptions<TUser extends User = User> = Auth0ProviderBaseOptions<TUser> & Auth0ClientOptions & {
67
+ client?: never;
68
+ };
69
+ /**
70
+ * Options for `Auth0Provider` when supplying a pre-configured `Auth0Client` instance.
71
+ */
72
+ export type Auth0ProviderWithClientOptions<TUser extends User = User> = Auth0ProviderBaseOptions<TUser> & {
73
+ client: Auth0Client;
74
+ };
75
+ /**
76
+ * The main configuration to instantiate the `Auth0Provider`.
77
+ *
78
+ * Either provide `domain` and `clientId` (`Auth0ProviderWithConfigOptions`)
79
+ * or a pre-configured `client` instance (`Auth0ProviderWithClientOptions`).
80
+ */
81
+ export type Auth0ProviderOptions<TUser extends User = User> = Auth0ProviderWithConfigOptions<TUser> | Auth0ProviderWithClientOptions<TUser>;
65
82
  /**
66
83
  * ```jsx
67
84
  * <Auth0Provider
@@ -1 +1 @@
1
- {"version":3,"file":"auth0-provider.d.ts","sourceRoot":"","sources":["../src/auth0-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AACf,OAAO,EAEL,kBAAkB,EAMlB,IAAI,EAEJ,4BAA4B,EAC5B,YAAY,EAGb,MAAM,qBAAqB,CAAC;AAC7B,OAAqB,EACnB,qBAAqB,EAGtB,MAAM,iBAAiB,CAAC;AAUzB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,4BAA4B,EAAE,UAAU,GAAG,eAAe,CAAC,CAAC;AAEhG;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,KAAK,SAAS,IAAI,GAAG,IAAI,CAAE,SAAQ,kBAAkB;IACzF;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;IACjE;;;;;;;;;;;;OAYG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,qBAAqB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