@logto/react 3.0.3 → 3.0.4
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/lib/index.d.ts +1 -1
- package/lib/provider.cjs +2 -2
- package/lib/provider.d.ts +3 -2
- package/lib/provider.js +2 -2
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { LogtoContextProps, LogtoContext } from './context.js';
|
|
2
|
-
export type { LogtoConfig, IdTokenClaims, UserInfoResponse, LogtoErrorCode, LogtoClientErrorCode, InteractionMode, } from '@logto/browser';
|
|
2
|
+
export type { LogtoConfig, IdTokenClaims, UserInfoResponse, LogtoErrorCode, LogtoClientErrorCode, InteractionMode, AccessTokenClaims, } from '@logto/browser';
|
|
3
3
|
export { LogtoError, LogtoRequestError, LogtoClientError, OidcError, Prompt, ReservedScope, ReservedResource, UserScope, organizationUrnPrefix, buildOrganizationUrn, getOrganizationIdFromUrn, PersistKey, } from '@logto/browser';
|
|
4
4
|
export * from './provider.js';
|
|
5
5
|
export { useLogto, useHandleSignInCallback } from './hooks/index.js';
|
package/lib/provider.cjs
CHANGED
|
@@ -9,9 +9,9 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
9
9
|
|
|
10
10
|
var LogtoClient__default = /*#__PURE__*/_interopDefault(LogtoClient);
|
|
11
11
|
|
|
12
|
-
const LogtoProvider = ({ config, children, unstable_enableCache = false, }) => {
|
|
12
|
+
const LogtoProvider = ({ config, LogtoClientClass = LogtoClient__default.default, children, unstable_enableCache = false, }) => {
|
|
13
13
|
const [loadingCount, setLoadingCount] = react.useState(1);
|
|
14
|
-
const memorizedLogtoClient = react.useMemo(() => ({ logtoClient: new
|
|
14
|
+
const memorizedLogtoClient = react.useMemo(() => ({ logtoClient: new LogtoClientClass(config, unstable_enableCache) }), [LogtoClientClass, config, unstable_enableCache]);
|
|
15
15
|
const [isAuthenticated, setIsAuthenticated] = react.useState(false);
|
|
16
16
|
const [error, setError] = react.useState();
|
|
17
17
|
const isLoading = react.useMemo(() => loadingCount > 0, [loadingCount]);
|
package/lib/provider.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LogtoConfig } from '@logto/browser';
|
|
1
|
+
import LogtoClient, { type LogtoConfig } from '@logto/browser';
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
3
|
export type LogtoProviderProps = {
|
|
4
4
|
config: LogtoConfig;
|
|
@@ -7,6 +7,7 @@ export type LogtoProviderProps = {
|
|
|
7
7
|
* @default false
|
|
8
8
|
*/
|
|
9
9
|
unstable_enableCache?: boolean;
|
|
10
|
+
LogtoClientClass?: typeof LogtoClient;
|
|
10
11
|
children?: ReactNode;
|
|
11
12
|
};
|
|
12
|
-
export declare const LogtoProvider: ({ config, children, unstable_enableCache, }: LogtoProviderProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
13
|
+
export declare const LogtoProvider: ({ config, LogtoClientClass, children, unstable_enableCache, }: LogtoProviderProps) => import("react/jsx-runtime.js").JSX.Element;
|
package/lib/provider.js
CHANGED
|
@@ -3,9 +3,9 @@ import LogtoClient from '@logto/browser';
|
|
|
3
3
|
import { useState, useMemo, useCallback, useEffect } from 'react';
|
|
4
4
|
import { LogtoContext } from './context.js';
|
|
5
5
|
|
|
6
|
-
const LogtoProvider = ({ config, children, unstable_enableCache = false, }) => {
|
|
6
|
+
const LogtoProvider = ({ config, LogtoClientClass = LogtoClient, children, unstable_enableCache = false, }) => {
|
|
7
7
|
const [loadingCount, setLoadingCount] = useState(1);
|
|
8
|
-
const memorizedLogtoClient = useMemo(() => ({ logtoClient: new
|
|
8
|
+
const memorizedLogtoClient = useMemo(() => ({ logtoClient: new LogtoClientClass(config, unstable_enableCache) }), [LogtoClientClass, config, unstable_enableCache]);
|
|
9
9
|
const [isAuthenticated, setIsAuthenticated] = useState(false);
|
|
10
10
|
const [error, setError] = useState();
|
|
11
11
|
const isLoading = useMemo(() => loadingCount > 0, [loadingCount]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/react",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/index.cjs",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@silverhand/essentials": "^2.8.7",
|
|
25
|
-
"@logto/browser": "^2.2.
|
|
25
|
+
"@logto/browser": "^2.2.6"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@silverhand/eslint-config": "^5.0.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@testing-library/react": "^14.2.1",
|
|
35
35
|
"@types/jest": "^29.5.0",
|
|
36
36
|
"@types/react": "^18.2.56",
|
|
37
|
-
"eslint": "^8.
|
|
37
|
+
"eslint": "^8.57.0",
|
|
38
38
|
"jest": "^29.5.0",
|
|
39
39
|
"lint-staged": "^15.0.0",
|
|
40
40
|
"postcss": "^8.4.31",
|