@leancodepl/kratos 9.6.5 → 9.6.6
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/index.cjs.js +86 -86
- package/index.esm.js +73 -73
- package/package.json +2 -2
package/index.cjs.js
CHANGED
|
@@ -8,20 +8,20 @@ var reactForm = require('@tanstack/react-form');
|
|
|
8
8
|
var utils = require('@leancodepl/utils');
|
|
9
9
|
|
|
10
10
|
function _interopNamespaceDefault(e) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
}
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
21
19
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
var Slot__namespace = /*#__PURE__*/_interopNamespaceDefault(Slot);
|
|
@@ -8533,11 +8533,11 @@ function VerificationFlowWrapper(param) {
|
|
|
8533
8533
|
}
|
|
8534
8534
|
|
|
8535
8535
|
var index$5 = /*#__PURE__*/Object.freeze({
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8536
|
+
__proto__: null,
|
|
8537
|
+
VerificationFlow: VerificationFlow,
|
|
8538
|
+
VerificationFlowProvider: VerificationFlowProvider,
|
|
8539
|
+
VerificationFlowWrapper: VerificationFlowWrapper,
|
|
8540
|
+
useVerificationFlowContext: useVerificationFlowContext
|
|
8541
8541
|
});
|
|
8542
8542
|
|
|
8543
8543
|
var baseKey$3 = withQueryKeyPrefix("login_flow");
|
|
@@ -10771,8 +10771,8 @@ function LoginFlowWrapper(param) {
|
|
|
10771
10771
|
}
|
|
10772
10772
|
|
|
10773
10773
|
var index$4 = /*#__PURE__*/Object.freeze({
|
|
10774
|
-
|
|
10775
|
-
|
|
10774
|
+
__proto__: null,
|
|
10775
|
+
LoginFlow: LoginFlow
|
|
10776
10776
|
});
|
|
10777
10777
|
|
|
10778
10778
|
function asyncGeneratorStep$k(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -11048,8 +11048,8 @@ var useLogout = function() {
|
|
|
11048
11048
|
};
|
|
11049
11049
|
|
|
11050
11050
|
var index$3 = /*#__PURE__*/Object.freeze({
|
|
11051
|
-
|
|
11052
|
-
|
|
11051
|
+
__proto__: null,
|
|
11052
|
+
useLogout: useLogout
|
|
11053
11053
|
});
|
|
11054
11054
|
|
|
11055
11055
|
var chooseMethodFormContext = /*#__PURE__*/ react.createContext(undefined);
|
|
@@ -13078,8 +13078,8 @@ function RegistrationFlowWrapper(param) {
|
|
|
13078
13078
|
}
|
|
13079
13079
|
|
|
13080
13080
|
var index$2 = /*#__PURE__*/Object.freeze({
|
|
13081
|
-
|
|
13082
|
-
|
|
13081
|
+
__proto__: null,
|
|
13082
|
+
RegistrationFlow: RegistrationFlow
|
|
13083
13083
|
});
|
|
13084
13084
|
|
|
13085
13085
|
var baseKey$1 = withQueryKeyPrefix("settings_flow");
|
|
@@ -15577,11 +15577,11 @@ function SettingsFlowWrapper(param) {
|
|
|
15577
15577
|
}
|
|
15578
15578
|
|
|
15579
15579
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
15580
|
-
|
|
15581
|
-
|
|
15582
|
-
|
|
15583
|
-
|
|
15584
|
-
|
|
15580
|
+
__proto__: null,
|
|
15581
|
+
SettingsFlow: SettingsFlow,
|
|
15582
|
+
SettingsFlowProvider: SettingsFlowProvider,
|
|
15583
|
+
SettingsFlowWrapper: SettingsFlowWrapper,
|
|
15584
|
+
useSettingsFlowContext: useSettingsFlowContext
|
|
15585
15585
|
});
|
|
15586
15586
|
|
|
15587
15587
|
var codeFormContext = /*#__PURE__*/ react.createContext(undefined);
|
|
@@ -16962,8 +16962,8 @@ function RecoveryFlowWrapper(param) {
|
|
|
16962
16962
|
}
|
|
16963
16963
|
|
|
16964
16964
|
var index = /*#__PURE__*/Object.freeze({
|
|
16965
|
-
|
|
16966
|
-
|
|
16965
|
+
__proto__: null,
|
|
16966
|
+
RecoveryFlow: RecoveryFlow
|
|
16967
16967
|
});
|
|
16968
16968
|
|
|
16969
16969
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -17508,30 +17508,30 @@ function _object_spread(target) {
|
|
|
17508
17508
|
};
|
|
17509
17509
|
var providers = {
|
|
17510
17510
|
/**
|
|
17511
|
-
|
|
17512
|
-
|
|
17513
|
-
|
|
17514
|
-
|
|
17515
|
-
|
|
17516
|
-
|
|
17517
|
-
|
|
17518
|
-
|
|
17519
|
-
|
|
17520
|
-
|
|
17521
|
-
|
|
17522
|
-
|
|
17523
|
-
|
|
17524
|
-
|
|
17525
|
-
|
|
17526
|
-
|
|
17527
|
-
|
|
17528
|
-
|
|
17529
|
-
|
|
17530
|
-
|
|
17531
|
-
|
|
17532
|
-
|
|
17533
|
-
|
|
17534
|
-
|
|
17511
|
+
* Provides React context for Kratos authentication flows and session management.
|
|
17512
|
+
*
|
|
17513
|
+
* Combines `KratosClientProvider` for API access and `KratosSessionProvider` for session management
|
|
17514
|
+
* to enable authentication flows and session management throughout your component tree.
|
|
17515
|
+
* Must wrap your application or the parts that use Kratos functionality.
|
|
17516
|
+
*
|
|
17517
|
+
* @param children - React children components that will have access to Kratos context
|
|
17518
|
+
* @returns JSX element that provides Kratos context to child components
|
|
17519
|
+
* @example
|
|
17520
|
+
* ```tsx
|
|
17521
|
+
* function App() {
|
|
17522
|
+
* return (
|
|
17523
|
+
* <KratosProviders>
|
|
17524
|
+
* <Router>
|
|
17525
|
+
* <Routes>
|
|
17526
|
+
* <Route path="/login" element={<LoginPage />} />
|
|
17527
|
+
* <Route path="/profile" element={<ProfilePage />} />
|
|
17528
|
+
* </Routes>
|
|
17529
|
+
* </Router>
|
|
17530
|
+
* </KratosProviders>
|
|
17531
|
+
* );
|
|
17532
|
+
* }
|
|
17533
|
+
* ```
|
|
17534
|
+
*/ KratosProviders: function(param) {
|
|
17535
17535
|
var children = param.children;
|
|
17536
17536
|
return /*#__PURE__*/ jsxRuntime.jsx(KratosClientProvider, {
|
|
17537
17537
|
api: api,
|
|
@@ -17544,37 +17544,37 @@ function _object_spread(target) {
|
|
|
17544
17544
|
};
|
|
17545
17545
|
var session = {
|
|
17546
17546
|
/**
|
|
17547
|
-
|
|
17548
|
-
|
|
17549
|
-
|
|
17550
|
-
|
|
17551
|
-
|
|
17552
|
-
|
|
17553
|
-
|
|
17554
|
-
|
|
17555
|
-
|
|
17556
|
-
|
|
17557
|
-
|
|
17558
|
-
|
|
17559
|
-
|
|
17560
|
-
|
|
17561
|
-
|
|
17562
|
-
|
|
17563
|
-
|
|
17564
|
-
|
|
17565
|
-
|
|
17566
|
-
|
|
17567
|
-
|
|
17568
|
-
|
|
17569
|
-
|
|
17570
|
-
|
|
17571
|
-
|
|
17572
|
-
|
|
17573
|
-
|
|
17574
|
-
|
|
17575
|
-
|
|
17576
|
-
|
|
17577
|
-
|
|
17547
|
+
* Manages Ory Kratos session and identity state with React Query integration.
|
|
17548
|
+
*
|
|
17549
|
+
* Provides both async methods and React hooks for session management, identity access,
|
|
17550
|
+
* and authentication state. Can be extended with custom trait-specific methods when using
|
|
17551
|
+
* a custom SessionManager class.
|
|
17552
|
+
*
|
|
17553
|
+
* Available methods:
|
|
17554
|
+
* - Session management: `getSession()`, `useSession()`, `checkIfLoggedIn()`
|
|
17555
|
+
* - Identity access: `getIdentity()`, `useIdentity()`, `getUserId()`, `useUserId()`
|
|
17556
|
+
* - Authentication state: `isLoggedIn()`, `useIsLoggedIn()`, `useIsAal2Required()`
|
|
17557
|
+
*
|
|
17558
|
+
* @example
|
|
17559
|
+
* ```tsx
|
|
17560
|
+
* // Using hooks in components
|
|
17561
|
+
* function UserProfile() {
|
|
17562
|
+
* const { isLoggedIn, isLoading } = session.sessionManager.useIsLoggedIn();
|
|
17563
|
+
* const { userId } = session.sessionManager.useUserId();
|
|
17564
|
+
*
|
|
17565
|
+
* if (isLoading) return <div>Loading...</div>;
|
|
17566
|
+
* if (!isLoggedIn) return <div>Please log in</div>;
|
|
17567
|
+
*
|
|
17568
|
+
* return <div>Welcome, User ID: {userId}</div>;
|
|
17569
|
+
* }
|
|
17570
|
+
*
|
|
17571
|
+
* // Using async methods
|
|
17572
|
+
* const checkAuth = async () => {
|
|
17573
|
+
* const isLoggedIn = await session.sessionManager.isLoggedIn();
|
|
17574
|
+
* const userId = await session.sessionManager.getUserId();
|
|
17575
|
+
* };
|
|
17576
|
+
* ```
|
|
17577
|
+
*/ sessionManager: sessionManager
|
|
17578
17578
|
};
|
|
17579
17579
|
return {
|
|
17580
17580
|
flows: flows,
|
package/index.esm.js
CHANGED
|
@@ -8512,11 +8512,11 @@ function VerificationFlowWrapper(param) {
|
|
|
8512
8512
|
}
|
|
8513
8513
|
|
|
8514
8514
|
var index$5 = /*#__PURE__*/Object.freeze({
|
|
8515
|
-
|
|
8516
|
-
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8515
|
+
__proto__: null,
|
|
8516
|
+
VerificationFlow: VerificationFlow,
|
|
8517
|
+
VerificationFlowProvider: VerificationFlowProvider,
|
|
8518
|
+
VerificationFlowWrapper: VerificationFlowWrapper,
|
|
8519
|
+
useVerificationFlowContext: useVerificationFlowContext
|
|
8520
8520
|
});
|
|
8521
8521
|
|
|
8522
8522
|
var baseKey$3 = withQueryKeyPrefix("login_flow");
|
|
@@ -10750,8 +10750,8 @@ function LoginFlowWrapper(param) {
|
|
|
10750
10750
|
}
|
|
10751
10751
|
|
|
10752
10752
|
var index$4 = /*#__PURE__*/Object.freeze({
|
|
10753
|
-
|
|
10754
|
-
|
|
10753
|
+
__proto__: null,
|
|
10754
|
+
LoginFlow: LoginFlow
|
|
10755
10755
|
});
|
|
10756
10756
|
|
|
10757
10757
|
function asyncGeneratorStep$k(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -11027,8 +11027,8 @@ var useLogout = function() {
|
|
|
11027
11027
|
};
|
|
11028
11028
|
|
|
11029
11029
|
var index$3 = /*#__PURE__*/Object.freeze({
|
|
11030
|
-
|
|
11031
|
-
|
|
11030
|
+
__proto__: null,
|
|
11031
|
+
useLogout: useLogout
|
|
11032
11032
|
});
|
|
11033
11033
|
|
|
11034
11034
|
var chooseMethodFormContext = /*#__PURE__*/ createContext(undefined);
|
|
@@ -13057,8 +13057,8 @@ function RegistrationFlowWrapper(param) {
|
|
|
13057
13057
|
}
|
|
13058
13058
|
|
|
13059
13059
|
var index$2 = /*#__PURE__*/Object.freeze({
|
|
13060
|
-
|
|
13061
|
-
|
|
13060
|
+
__proto__: null,
|
|
13061
|
+
RegistrationFlow: RegistrationFlow
|
|
13062
13062
|
});
|
|
13063
13063
|
|
|
13064
13064
|
var baseKey$1 = withQueryKeyPrefix("settings_flow");
|
|
@@ -15556,11 +15556,11 @@ function SettingsFlowWrapper(param) {
|
|
|
15556
15556
|
}
|
|
15557
15557
|
|
|
15558
15558
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
15559
|
-
|
|
15560
|
-
|
|
15561
|
-
|
|
15562
|
-
|
|
15563
|
-
|
|
15559
|
+
__proto__: null,
|
|
15560
|
+
SettingsFlow: SettingsFlow,
|
|
15561
|
+
SettingsFlowProvider: SettingsFlowProvider,
|
|
15562
|
+
SettingsFlowWrapper: SettingsFlowWrapper,
|
|
15563
|
+
useSettingsFlowContext: useSettingsFlowContext
|
|
15564
15564
|
});
|
|
15565
15565
|
|
|
15566
15566
|
var codeFormContext = /*#__PURE__*/ createContext(undefined);
|
|
@@ -16941,8 +16941,8 @@ function RecoveryFlowWrapper(param) {
|
|
|
16941
16941
|
}
|
|
16942
16942
|
|
|
16943
16943
|
var index = /*#__PURE__*/Object.freeze({
|
|
16944
|
-
|
|
16945
|
-
|
|
16944
|
+
__proto__: null,
|
|
16945
|
+
RecoveryFlow: RecoveryFlow
|
|
16946
16946
|
});
|
|
16947
16947
|
|
|
16948
16948
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -17487,30 +17487,30 @@ function _object_spread(target) {
|
|
|
17487
17487
|
};
|
|
17488
17488
|
var providers = {
|
|
17489
17489
|
/**
|
|
17490
|
-
|
|
17491
|
-
|
|
17492
|
-
|
|
17493
|
-
|
|
17494
|
-
|
|
17495
|
-
|
|
17496
|
-
|
|
17497
|
-
|
|
17498
|
-
|
|
17499
|
-
|
|
17500
|
-
|
|
17501
|
-
|
|
17502
|
-
|
|
17503
|
-
|
|
17504
|
-
|
|
17505
|
-
|
|
17506
|
-
|
|
17507
|
-
|
|
17508
|
-
|
|
17509
|
-
|
|
17510
|
-
|
|
17511
|
-
|
|
17512
|
-
|
|
17513
|
-
|
|
17490
|
+
* Provides React context for Kratos authentication flows and session management.
|
|
17491
|
+
*
|
|
17492
|
+
* Combines `KratosClientProvider` for API access and `KratosSessionProvider` for session management
|
|
17493
|
+
* to enable authentication flows and session management throughout your component tree.
|
|
17494
|
+
* Must wrap your application or the parts that use Kratos functionality.
|
|
17495
|
+
*
|
|
17496
|
+
* @param children - React children components that will have access to Kratos context
|
|
17497
|
+
* @returns JSX element that provides Kratos context to child components
|
|
17498
|
+
* @example
|
|
17499
|
+
* ```tsx
|
|
17500
|
+
* function App() {
|
|
17501
|
+
* return (
|
|
17502
|
+
* <KratosProviders>
|
|
17503
|
+
* <Router>
|
|
17504
|
+
* <Routes>
|
|
17505
|
+
* <Route path="/login" element={<LoginPage />} />
|
|
17506
|
+
* <Route path="/profile" element={<ProfilePage />} />
|
|
17507
|
+
* </Routes>
|
|
17508
|
+
* </Router>
|
|
17509
|
+
* </KratosProviders>
|
|
17510
|
+
* );
|
|
17511
|
+
* }
|
|
17512
|
+
* ```
|
|
17513
|
+
*/ KratosProviders: function(param) {
|
|
17514
17514
|
var children = param.children;
|
|
17515
17515
|
return /*#__PURE__*/ jsx(KratosClientProvider, {
|
|
17516
17516
|
api: api,
|
|
@@ -17523,37 +17523,37 @@ function _object_spread(target) {
|
|
|
17523
17523
|
};
|
|
17524
17524
|
var session = {
|
|
17525
17525
|
/**
|
|
17526
|
-
|
|
17527
|
-
|
|
17528
|
-
|
|
17529
|
-
|
|
17530
|
-
|
|
17531
|
-
|
|
17532
|
-
|
|
17533
|
-
|
|
17534
|
-
|
|
17535
|
-
|
|
17536
|
-
|
|
17537
|
-
|
|
17538
|
-
|
|
17539
|
-
|
|
17540
|
-
|
|
17541
|
-
|
|
17542
|
-
|
|
17543
|
-
|
|
17544
|
-
|
|
17545
|
-
|
|
17546
|
-
|
|
17547
|
-
|
|
17548
|
-
|
|
17549
|
-
|
|
17550
|
-
|
|
17551
|
-
|
|
17552
|
-
|
|
17553
|
-
|
|
17554
|
-
|
|
17555
|
-
|
|
17556
|
-
|
|
17526
|
+
* Manages Ory Kratos session and identity state with React Query integration.
|
|
17527
|
+
*
|
|
17528
|
+
* Provides both async methods and React hooks for session management, identity access,
|
|
17529
|
+
* and authentication state. Can be extended with custom trait-specific methods when using
|
|
17530
|
+
* a custom SessionManager class.
|
|
17531
|
+
*
|
|
17532
|
+
* Available methods:
|
|
17533
|
+
* - Session management: `getSession()`, `useSession()`, `checkIfLoggedIn()`
|
|
17534
|
+
* - Identity access: `getIdentity()`, `useIdentity()`, `getUserId()`, `useUserId()`
|
|
17535
|
+
* - Authentication state: `isLoggedIn()`, `useIsLoggedIn()`, `useIsAal2Required()`
|
|
17536
|
+
*
|
|
17537
|
+
* @example
|
|
17538
|
+
* ```tsx
|
|
17539
|
+
* // Using hooks in components
|
|
17540
|
+
* function UserProfile() {
|
|
17541
|
+
* const { isLoggedIn, isLoading } = session.sessionManager.useIsLoggedIn();
|
|
17542
|
+
* const { userId } = session.sessionManager.useUserId();
|
|
17543
|
+
*
|
|
17544
|
+
* if (isLoading) return <div>Loading...</div>;
|
|
17545
|
+
* if (!isLoggedIn) return <div>Please log in</div>;
|
|
17546
|
+
*
|
|
17547
|
+
* return <div>Welcome, User ID: {userId}</div>;
|
|
17548
|
+
* }
|
|
17549
|
+
*
|
|
17550
|
+
* // Using async methods
|
|
17551
|
+
* const checkAuth = async () => {
|
|
17552
|
+
* const isLoggedIn = await session.sessionManager.isLoggedIn();
|
|
17553
|
+
* const userId = await session.sessionManager.getUserId();
|
|
17554
|
+
* };
|
|
17555
|
+
* ```
|
|
17556
|
+
*/ sessionManager: sessionManager
|
|
17557
17557
|
};
|
|
17558
17558
|
return {
|
|
17559
17559
|
flows: flows,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leancodepl/kratos",
|
|
3
|
-
"version": "9.6.
|
|
3
|
+
"version": "9.6.6",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"node": ">=18.0.0"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@leancodepl/utils": "9.6.
|
|
13
|
+
"@leancodepl/utils": "9.6.6",
|
|
14
14
|
"@radix-ui/react-slot": ">=1.0.0",
|
|
15
15
|
"@tanstack/react-form": ">=1.0.0",
|
|
16
16
|
"@tanstack/react-query": ">=5.0.0"
|