Skip to content

Commit 4a08020

Browse files
authored
chore(console, core): add dev feature guard (#7441)
add dev feature guard
1 parent 0e9eedc commit 4a08020

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

packages/console/src/pages/CustomizeJwtDetails/utils/config.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ declare interface CustomJwtClaims extends Record<string, any> {}
3434
*
3535
* @param {${JwtCustomizerTypeDefinitionKey.JwtCustomizerUserContext}} user - The user info associated with the token.
3636
* @param {${JwtCustomizerTypeDefinitionKey.JwtCustomizerGrantContext}} [grant] - The grant context associated with the token.
37-
* @param {${JwtCustomizerTypeDefinitionKey.JwtCustomizerUserInteractionContext}} [interaction] - The user interaction context associated with the token.
37+
* ${isDevFeaturesEnabled ? `@param {${JwtCustomizerTypeDefinitionKey.JwtCustomizerUserInteractionContext}} [interaction] - The user interaction context associated with the token.` : ''}
3838
*/
3939
declare type Context = {
4040
/**
@@ -48,7 +48,7 @@ declare type Context = {
4848
/**
4949
* The user interaction context associated with the token.
5050
*/
51-
interaction?: ${JwtCustomizerTypeDefinitionKey.JwtCustomizerUserInteractionContext};
51+
${isDevFeaturesEnabled ? `interaction?: ${JwtCustomizerTypeDefinitionKey.JwtCustomizerUserInteractionContext};` : ''}
5252
}
5353
5454
declare type Payload = {
@@ -59,9 +59,9 @@ declare type Payload = {
5959
/**
6060
* Logto internal data that can be used to pass additional information.
6161
*
62-
* @params {${JwtCustomizerTypeDefinitionKey.JwtCustomizerUserContext}} user
63-
* @params {${JwtCustomizerTypeDefinitionKey.JwtCustomizerGrantContext}} [grant]
64-
* @params {${JwtCustomizerTypeDefinitionKey.JwtCustomizerUserInteractionContext}} [interaction]
62+
* @param {${JwtCustomizerTypeDefinitionKey.JwtCustomizerUserContext}} user
63+
* @param {${JwtCustomizerTypeDefinitionKey.JwtCustomizerGrantContext}} [grant]
64+
* ${isDevFeaturesEnabled ? `@param {${JwtCustomizerTypeDefinitionKey.JwtCustomizerUserInteractionContext}} [interaction]` : ''}
6565
*/
6666
context: Context;
6767
/**

packages/core/src/libraries/session.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { z } from 'zod';
77
import type Queries from '#src/tenants/Queries.js';
88
import assertThat from '#src/utils/assert-that.js';
99

10+
import { EnvSet } from '../env-set/index.js';
11+
1012
const updateInteractionResult = async (
1113
ctx: Context,
1214
provider: Provider,
@@ -94,6 +96,11 @@ const saveInteractionLastSubmissionToSession = async (
9496
queries: Queries,
9597
interactionDetails: Awaited<ReturnType<Provider['interactionDetails']>>
9698
) => {
99+
// TODO: Remove this check when the feature is ready to be released. @simeng
100+
if (!EnvSet.values.isDevFeaturesEnabled) {
101+
return;
102+
}
103+
97104
const { session, lastSubmission } = interactionDetails;
98105

99106
if (!session || !lastSubmission) {

packages/core/src/oidc/extra-token-claims.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ const getInteractionLastSubmission = async (
101101
queries: Queries,
102102
{ accountId, sessionUid }: AccessToken
103103
) => {
104+
// TODO: Remove this check when the feature is ready to be released. @simeng
104105
if (!EnvSet.values.isDevFeaturesEnabled) {
105106
return;
106107
}

0 commit comments

Comments
 (0)