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
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.17.0
20
8 changes: 4 additions & 4 deletions demos/quick-starter-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
"lint": "next lint"
},
"dependencies": {
"@frontegg/nextjs": "8.0.12",
"next": "^14.1.0",
"@frontegg/nextjs": "9.2.12",
"next": "^14.2.0",
"react": "^18",
"react-dom": "^18"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.0.1",
"eslint": "^10",
"eslint-config-next": "14.2.0",
"typescript": "^5"
}
}
64 changes: 32 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,46 +23,46 @@
"update-version": "node scripts/update-entry.js"
},
"devDependencies": {
"@babel/cli": "^7.25.9",
"@babel/core": "^7.25.9",
"@babel/node": "^7.25.9",
"@babel/cli": "^7.28.6",
"@babel/core": "^7.29.0",
"@babel/node": "^7.29.0",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-proposal-private-methods": "^7.18.6",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/plugin-transform-object-assign": "^7.25.9",
"@babel/plugin-transform-react-constant-elements": "^7.25.9",
"@babel/plugin-transform-runtime": "^7.25.9",
"@babel/preset-env": "^7.25.9",
"@babel/preset-react": "^7.25.9",
"@babel/preset-typescript": "^7.25.9",
"@babel/register": "^7.25.9",
"@playwright/test": "^1.48.1",
"@types/jest": "^29.5.0",
"@types/node": "^16.18.16",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@types/react-is": "^17.0.3",
"babel-loader": "^9.1.2",
"babel-plugin-module-resolver": "^5.0.0",
"@babel/plugin-transform-object-assign": "^7.27.1",
"@babel/plugin-transform-react-constant-elements": "^7.27.1",
"@babel/plugin-transform-runtime": "^7.29.0",
"@babel/preset-env": "^7.29.0",
"@babel/preset-react": "^7.28.5",
"@babel/preset-typescript": "^7.28.5",
"@babel/register": "^7.28.6",
"@playwright/test": "^1.58.2",
"@types/jest": "^30.0.0",
"@types/node": "^20.0.0",
"@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0",
"@types/react-is": "^18.3.0",
"babel-loader": "^10.0.0",
"babel-plugin-module-resolver": "^5.0.2",
"babel-plugin-optimize-clsx": "^2.6.2",
"concurrently": "^7.6.0",
"cross-env": "^7.0.3",
"danger": "11.2.4",
"concurrently": "^9.2.1",
"cross-env": "^10.1.0",
"danger": "13.0.5",
"danger-plugin-yarn": "1.6.0",
"eslint": "^8.36.0",
"express": "^4.21.1",
"jest": "^29.3.1",
"lerna": "8.1.8",
"eslint": "^10.0.2",
"express": "^5.2.1",
"jest": "^30.2.0",
"lerna": "9.0.4",
"pre-commit": "^1.2.2",
"prettier": "2.8.4",
"pretty-quick": "^3.1.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tslib": "^2.3.0",
"prettier": "3.8.1",
"pretty-quick": "^4.2.2",
"react": "^18.3.0",
"react-dom": "^18.3.0",
"tslib": "^2.8.1",
"tslint": "^6.1.3",
"typescript": "^4.9.4",
"webpack": "^5.95.0"
"typescript": "^5.9.3",
"webpack": "^5.105.2"
},
"nyc": {
"reporter": [
Expand Down
1 change: 1 addition & 0 deletions packages/example-app-directory/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
18 changes: 9 additions & 9 deletions packages/example-app-directory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
"lint": "next lint"
},
"dependencies": {
"@types/node": "18.11.9",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"eslint": "^8.30.0",
"eslint-config-next": "13.0.4",
"next": "13.0.4",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"typescript": "4.9.3"
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^10.0.2",
"eslint-config-next": "14.2.0",
"next": "14.2.0",
"react": "^18.3.0",
"react-dom": "^18.3.0",
"typescript": "5.9.3"
},
"browserslist": {
"production": [
Expand Down
3 changes: 2 additions & 1 deletion packages/example-app-directory/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"name": "next"
}
],
"module": "esnext"
"module": "esnext",
"strictNullChecks": true
},
"include": [
"**/*.ts",
Expand Down
18 changes: 9 additions & 9 deletions packages/example-pages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
"test:dev": "concurrently \"yarn test:dev-1\" \"yarn test:dev-2\" \"yarn test:dev-3\""
},
"dependencies": {
"next": "^12.2.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
"next": "^14.2.0",
"react": "^18.3.0",
"react-dom": "^18.3.0"
},
"devDependencies": {
"@types/node": "16.11.7",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"eslint": "^8.30.0",
"eslint-config-next": "13.0.4",
"typescript": "4.9.3"
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^10.0.2",
"eslint-config-next": "14.2.0",
"typescript": "5.9.3"
},
"browserslist": {
"production": [
Expand Down
14 changes: 7 additions & 7 deletions packages/example-ssg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
"lint": "next lint"
},
"dependencies": {
"next": "^14.0.4"
"next": "^14.2.0"
},
"devDependencies": {
"@types/node": "^18",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"eslint": "^8.30.0",
"eslint-config-next": "13.0.4",
"typescript": "4.9.3"
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^10.0.2",
"eslint-config-next": "14.2.0",
"typescript": "5.9.3"
},
"browserslist": {
"production": [
Expand Down
8 changes: 4 additions & 4 deletions packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
"lint-json": "eslint -c .eslintrc.json -o ./lint-report.json --format json --no-color ./src/**/*.{ts,tsx}"
},
"dependencies": {
"@frontegg/js": "7.95.0",
"@frontegg/react-hooks": "7.95.0",
"@frontegg/js": "7.101.0",
"@frontegg/react-hooks": "7.101.0",
"http-proxy": "^1.18.1",
"iron-session": "^6.3.1",
"jose": "^4.12.2"
"jose": "^5.9.6"
},
"devDependencies": {
"@types/http-proxy": "^1.17.9"
"@types/http-proxy": "^1.17.17"
},
"peerDependencies": {
"react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
Expand Down
14 changes: 10 additions & 4 deletions packages/nextjs/src/common/FronteggBaseProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,21 @@ const Connector: FC<FronteggProviderProps> = ({ router, appName = 'default', ...
const alwaysVisibleChildren = isSSR ? undefined : (
<>
<SSGRequestAuthorize isSSG={props.isSSG} shouldRequestAuthorize={props.shouldRequestAuthorize} />
<CustomComponentRegister app={app} themeOptions={props.themeOptions} />
{React.createElement(CustomComponentRegister as React.ComponentType<{ app: typeof app; themeOptions: any }>, {
app,
themeOptions: props.themeOptions,
})}
{props.alwaysVisibleChildren}
</>
);
return (
<AppContext.Provider value={app}>
<FronteggStoreProvider {...({ ...props, app } as any)} alwaysVisibleChildren={alwaysVisibleChildren}>
{props.children}
</FronteggStoreProvider>
{React.createElement(FronteggStoreProvider as React.ComponentType<any>, {
...props,
app,
alwaysVisibleChildren,
children: props.children,
})}
</AppContext.Provider>
);
};
Expand Down
6 changes: 6 additions & 0 deletions packages/nextjs/src/iron-session-edge.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** Type declaration for iron-session/edge to avoid pulling in broken package types */
declare module 'iron-session/edge' {
type PasswordOption = string | Record<string, string>;
export function unsealData<T>(seal: string, options: { password: PasswordOption }): Promise<T>;
export function sealData(data: unknown, options: { password: PasswordOption; ttl?: number }): Promise<string>;
}
7 changes: 6 additions & 1 deletion packages/nextjs/src/no-ssr/FronteggProviderNoSSR.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ const Connector: FC<ConnectorProps> = (_props) => {

return (
<AppContext.Provider value={app}>
<FronteggStoreProvider {...({ ...props, app } as any)}>{props.children}</FronteggStoreProvider>
{/* React.createElement + cast: FC from @frontegg/react-hooks doesn't satisfy strict React 18 JSX typings (ReactNode vs ReactPortal). JSX would cause TS2786. */}
{React.createElement(FronteggStoreProvider as React.ComponentType<any>, {
Comment thread
dianaKhortiuk-frontegg marked this conversation as resolved.
...props,
app,
children: props.children,
})}
</AppContext.Provider>
);
};
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { FronteggAppOptions } from '@frontegg/types';
import type { ILoginResponse, ITenantsResponse } from '@frontegg/rest-api';
import type { IncomingMessage } from 'http';
import type { ReactNode } from 'react';
import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context';
import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';
import type { NextRouter } from 'next/router';

export interface EncryptionUtils {
Expand Down
6 changes: 5 additions & 1 deletion packages/nextjs/src/utils/cookies/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import cookieSerializer from './serializer';
import type { RequestCookie } from 'next/dist/server/web/spec-extension/cookies';
/** Cookie shape for Next.js 14+ cookies() API compatibility */
interface RequestCookie {
name: string;
value: string;
}
import config from '../../config';
import { CookieSerializeOptions, CreateCookieOptions, RemoveCookiesOptions, RequestType, ResponseType } from './types';
import { COOKIE_MAX_LENGTH } from './constants';
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/src/utils/useOnRedirectTo/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMemo, useRef } from 'react';
import { RedirectOptions } from '@frontegg/rest-api';
import type { NextRouter } from 'next/router';
import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context';
import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';
import { isAuthRoute, AuthPageRoutes } from '@frontegg/redux-store';

const useOnRedirectTo = (
Expand Down
9 changes: 6 additions & 3 deletions packages/nextjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"extends": "../../tsconfig",
"include": ["src/**/*.ts*"],
"exclude": [
"build"
]
"exclude": ["build"],
"compilerOptions": {
"paths": {
"iron-session/edge": ["./src/iron-session-edge.d.ts"]
}
}
}
23 changes: 15 additions & 8 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,21 @@ async function run(argv) {
console.log(`running '${command}' with ${JSON.stringify(env)}`);
}

const { stderr, stdout } = await exec(command, { env: { ...process.env, ...env } });
if (stderr) {
throw new Error(`'${command}' failed with \n${stderr}`);
}

if (verbose) {
// eslint-disable-next-line no-console
console.log(stdout);
try {
const { stderr, stdout } = await exec(command, { env: { ...process.env, ...env } });
// Don't treat Node/babel deprecation warnings on stderr as failure
if (stderr && !/DeprecationWarning|url\.parse/.test(stderr)) {
throw new Error(`'${command}' failed with \n${stderr}`);
}
if (verbose) {
// eslint-disable-next-line no-console
console.log(stdout);
}
} catch (err) {
if (err.stderr) {
throw new Error(`'${command}' failed with \n${err.stderr}`);
}
throw err;
}
}

Expand Down
Loading
Loading