Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,33 @@ export const dynamic = "force-dynamic";
type QueryValue = string | string[] | undefined;

type PageProps = {
searchParams?: {
searchParams?: Promise<{
appId?: QueryValue;
envId?: QueryValue;
companyId?: QueryValue;
};
}>;
};

function getQueryValue(value: QueryValue) {
return Array.isArray(value) ? (value[0] ?? "") : (value ?? "");
}

export default async function CompanyFlagsPage({ searchParams }: PageProps) {
const queryParams = await searchParams;
const apps = (await listApps()).data ?? [];
const requestedAppId = getQueryValue(searchParams?.appId);
const requestedAppId = getQueryValue(queryParams?.appId);
const selectedAppId =
apps.find((app) => app.id === requestedAppId)?.id ?? apps[0]?.id ?? "";

const envs = selectedAppId
? ((await listEnvironments(selectedAppId)).data ?? [])
: [];

const requestedEnvId = getQueryValue(searchParams?.envId);
const requestedEnvId = getQueryValue(queryParams?.envId);
const selectedEnvId =
envs.find((env) => env.id === requestedEnvId)?.id ?? envs[0]?.id ?? "";

const companyId = getQueryValue(searchParams?.companyId);
const companyId = getQueryValue(queryParams?.companyId);

const flags =
selectedAppId && selectedEnvId && companyId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,28 @@ export const dynamic = "force-dynamic";
type QueryValue = string | string[] | undefined;

type PageProps = {
searchParams?: {
searchParams?: Promise<{
appId?: QueryValue;
envId?: QueryValue;
};
}>;
};

function getQueryValue(value: QueryValue) {
return Array.isArray(value) ? (value[0] ?? "") : (value ?? "");
}

export default async function FlagsPage({ searchParams }: PageProps) {
const query = await searchParams;
const apps = (await listApps()).data ?? [];
const requestedAppId = getQueryValue(searchParams?.appId);
const requestedAppId = getQueryValue(query?.appId);
const selectedAppId =
apps.find((app) => app.id === requestedAppId)?.id ?? apps[0]?.id ?? "";

const envs = selectedAppId
? ((await listEnvironments(selectedAppId)).data ?? [])
: [];

const requestedEnvId = getQueryValue(searchParams?.envId);
const requestedEnvId = getQueryValue(query?.envId);
const selectedEnvId =
envs.find((env) => env.id === requestedEnvId)?.id ?? envs[0]?.id ?? "";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,33 @@ export const dynamic = "force-dynamic";
type QueryValue = string | string[] | undefined;

type PageProps = {
searchParams?: {
searchParams?: Promise<{
appId?: QueryValue;
envId?: QueryValue;
userId?: QueryValue;
};
}>;
};

function getQueryValue(value: QueryValue) {
return Array.isArray(value) ? (value[0] ?? "") : (value ?? "");
}

export default async function UserFlagsPage({ searchParams }: PageProps) {
const queryParams = await searchParams;
const apps = (await listApps()).data ?? [];
const requestedAppId = getQueryValue(searchParams?.appId);
const requestedAppId = getQueryValue(queryParams?.appId);
const selectedAppId =
apps.find((app) => app.id === requestedAppId)?.id ?? apps[0]?.id ?? "";

const envs = selectedAppId
? ((await listEnvironments(selectedAppId)).data ?? [])
: [];

const requestedEnvId = getQueryValue(searchParams?.envId);
const requestedEnvId = getQueryValue(queryParams?.envId);
const selectedEnvId =
envs.find((env) => env.id === requestedEnvId)?.id ?? envs[0]?.id ?? "";

const userId = getQueryValue(searchParams?.userId);
const userId = getQueryValue(queryParams?.userId);

const flags =
selectedAppId && selectedEnvId && userId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference path="./.next/types/routes.d.ts" />

Check warning on line 3 in packages/management-sdk/examples/customer-admin-panel/next-env.d.ts

View workflow job for this annotation

GitHub Actions / Build & Test

typescript-eslint(triple-slash-reference)

Do not use a triple slash reference for ./.next/types/routes.d.ts, use `import` style instead.

Check warning on line 3 in packages/management-sdk/examples/customer-admin-panel/next-env.d.ts

View workflow job for this annotation

GitHub Actions / Build & Test

typescript-eslint(triple-slash-reference)

Do not use a triple slash reference for ./.next/types/routes.d.ts, use `import` style instead.

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"@reflag/management-sdk": "workspace:*",
"next": "14.2.5",
"next": "15.5.24",
"react": "18.3.1",
"react-dom": "18.3.1"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/openfeature-browser-provider/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@openfeature/react-sdk": "^0.4.5",
"@openfeature/web-sdk": "^1.2.3",
"@reflag/react-sdk": "workspace:^",
"next": "14.2.26",
"next": "15.5.24",
"react": "^18",
"react-dom": "^18"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/openfeature-browser-provider/example/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
],
"paths": {
"@/*": ["./*"]
}
},
"target": "ES2017"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
Expand Down
2 changes: 1 addition & 1 deletion packages/react-sdk/dev/nextjs-bootstrap-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@reflag/node-sdk": "workspace:^",
"@reflag/react-sdk": "workspace:^",
"next": "16.1.5",
"next": "16.3.3",
"react": "^18",
"react-dom": "^18"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-sdk/dev/nextjs-flag-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"@reflag/react-sdk": "workspace:^",
"next": "15.5.10",
"next": "15.5.24",
"react": "^18",
"react-dom": "^18"
},
Expand Down
Loading
Loading