@frontegg/nextjs 9.2.12 → 9.2.13-alpha.22623015259
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/api/index.d.ts +1 -1
- package/app/ClientFronteggProvider.js +1 -2
- package/app/ClientFronteggProvider.js.map +1 -1
- package/app/FronteggAppProvider.d.ts +2 -2
- package/app/FronteggAppRouter.d.ts +2 -1
- package/common/AppContext.d.ts +0 -1
- package/common/FronteggBaseProvider.js +6 -8
- package/common/FronteggBaseProvider.js.map +1 -1
- package/common/FronteggRouterBase.d.ts +2 -2
- package/common/FronteggRouterBase.js +1 -2
- package/common/FronteggRouterBase.js.map +1 -1
- package/common/cmc/base.js +1 -2
- package/common/cmc/base.js.map +1 -1
- package/common/cmc/hooks.js +1 -2
- package/common/cmc/hooks.js.map +1 -1
- package/config/constants.js +96 -0
- package/config/constants.js.map +1 -1
- package/config/index.js +0 -1
- package/config/index.js.map +1 -1
- package/edge/redirectToLogin.d.ts +1 -1
- package/edge/shouldBypassMiddleware.d.ts +1 -1
- package/index.js +1 -1
- package/iron-session-edge.d.ts +6 -0
- package/middleware/FronteggProxy.d.ts +1 -1
- package/middleware/ProxyRequestCallback.d.ts +0 -1
- package/middleware/helpers.d.ts +1 -1
- package/no-ssr/ExpireInListener.d.ts +2 -1
- package/no-ssr/ExpireInListener.js +1 -2
- package/no-ssr/ExpireInListener.js.map +1 -1
- package/no-ssr/FronteggProviderNoSSR.js +3 -5
- package/no-ssr/FronteggProviderNoSSR.js.map +1 -1
- package/no-ssr/NoSSRStoreHolder.js +1 -5
- package/no-ssr/NoSSRStoreHolder.js.map +1 -1
- package/package.json +4 -4
- package/pages/FronteggRouter/FronteggRouter.d.ts +2 -1
- package/pages/helpers.d.ts +0 -1
- package/pages/withFronteggApp/withFronteggApp.js +1 -2
- package/pages/withFronteggApp/withFronteggApp.js.map +1 -1
- package/sdkVersion.js +1 -1
- package/sdkVersion.js.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.js.map +1 -1
- package/utils/cookies/index.d.ts +5 -1
- package/utils/cookies/index.js +2 -0
- package/utils/cookies/index.js.map +1 -1
- package/utils/cookies/types.d.ts +0 -1
- package/utils/fronteggLogger/index.js +0 -2
- package/utils/fronteggLogger/index.js.map +1 -1
- package/utils/jwt/index.js +0 -3
- package/utils/jwt/index.js.map +1 -1
- package/utils/useOnRedirectTo/index.d.ts +1 -1
- package/utils/useOnRedirectTo/index.js.map +1 -1
package/utils/jwt/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_jose","require","_api","_interopRequireDefault","_fronteggLogger","_config","JwtUtils","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_jose","require","_api","_interopRequireDefault","_fronteggLogger","_config","JwtUtils","loadPublicKey","logger","fronteggLogger","child","tag","publicKey","_config$jwtPublicKeyJ","JSON","parse","config","jwtPublicKeyJson","info","e","api","importJWK","alg","getPublicKey","undefined","verify","jwt","jwtVerify","_default","exports","default"],"sources":["../../../../../packages/nextjs/src/utils/jwt/index.ts"],"sourcesContent":["import type { KeyLike } from 'jose';\nimport { importJWK, jwtVerify } from 'jose';\nimport api from '../../api';\nimport type { JWTVerifyResult } from 'jose/dist/types/types';\nimport fronteggLogger from '../fronteggLogger';\nimport config from '../../config';\n\nclass JwtUtils {\n private publicKey: (KeyLike | Uint8Array) | undefined;\n\n /**\n * Get the JWT public key from Frontegg service\n * to verify user's access token when calling getSession\n * in getServerSideProps and ServerComponents\n * @private\n */\n private async loadPublicKey(): Promise<KeyLike | Uint8Array> {\n const logger = fronteggLogger.child({ tag: 'JwtManager.loadPublicKey' });\n\n let publicKey;\n try {\n publicKey = JSON.parse(config.jwtPublicKeyJson ?? '{}');\n logger.info('Public key loaded from env variable');\n } catch (e) {\n logger.info('Going to load public key from frontegg jwks');\n publicKey = await api.loadPublicKey();\n }\n logger.info('Importing Public key into jose');\n this.publicKey = await importJWK(publicKey, publicKey.alg);\n return this.publicKey;\n }\n\n /**\n * Load public key from Frontegg services if not cached\n * @private\n */\n private async getPublicKey(): Promise<KeyLike | Uint8Array> {\n if (this.publicKey === undefined) {\n return await this.loadPublicKey();\n }\n return this.publicKey;\n }\n\n /**\n * verify JWT token with current loaded public key from Frontegg services\n */\n async verify(jwt: string | Uint8Array): Promise<JWTVerifyResult> {\n const publicKey = await this.getPublicKey();\n return await jwtVerify(jwt, publicKey);\n }\n}\n\nexport default new JwtUtils();\n"],"mappings":";;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,eAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,OAAA,GAAAF,sBAAA,CAAAF,OAAA;AAEA,MAAMK,QAAQ,CAAC;EAGb;AACF;AACA;AACA;AACA;AACA;EACE,MAAcC,aAAaA,CAAA,EAAkC;IAC3D,MAAMC,MAAM,GAAGC,uBAAc,CAACC,KAAK,CAAC;MAAEC,GAAG,EAAE;IAA2B,CAAC,CAAC;IAExE,IAAIC,SAAS;IACb,IAAI;MAAA,IAAAC,qBAAA;MACFD,SAAS,GAAGE,IAAI,CAACC,KAAK,EAAAF,qBAAA,GAACG,eAAM,CAACC,gBAAgB,YAAAJ,qBAAA,GAAI,IAAI,CAAC;MACvDL,MAAM,CAACU,IAAI,CAAC,qCAAqC,CAAC;IACpD,CAAC,CAAC,OAAOC,CAAC,EAAE;MACVX,MAAM,CAACU,IAAI,CAAC,6CAA6C,CAAC;MAC1DN,SAAS,GAAG,MAAMQ,YAAG,CAACb,aAAa,CAAC,CAAC;IACvC;IACAC,MAAM,CAACU,IAAI,CAAC,gCAAgC,CAAC;IAC7C,IAAI,CAACN,SAAS,GAAG,MAAM,IAAAS,eAAS,EAACT,SAAS,EAAEA,SAAS,CAACU,GAAG,CAAC;IAC1D,OAAO,IAAI,CAACV,SAAS;EACvB;;EAEA;AACF;AACA;AACA;EACE,MAAcW,YAAYA,CAAA,EAAkC;IAC1D,IAAI,IAAI,CAACX,SAAS,KAAKY,SAAS,EAAE;MAChC,OAAO,MAAM,IAAI,CAACjB,aAAa,CAAC,CAAC;IACnC;IACA,OAAO,IAAI,CAACK,SAAS;EACvB;;EAEA;AACF;AACA;EACE,MAAMa,MAAMA,CAACC,GAAwB,EAA4B;IAC/D,MAAMd,SAAS,GAAG,MAAM,IAAI,CAACW,YAAY,CAAC,CAAC;IAC3C,OAAO,MAAM,IAAAI,eAAS,EAACD,GAAG,EAAEd,SAAS,CAAC;EACxC;AACF;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAIxB,QAAQ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RedirectOptions } from '@frontegg/rest-api';
|
|
2
2
|
import type { NextRouter } from 'next/router';
|
|
3
|
-
import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context';
|
|
3
|
+
import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';
|
|
4
4
|
import { AuthPageRoutes } from '@frontegg/redux-store';
|
|
5
5
|
declare const useOnRedirectTo: (baseName: string, router: AppRouterInstance | NextRouter, routes?: Partial<AuthPageRoutes>) => (_path: string, opts?: RedirectOptions) => void;
|
|
6
6
|
export default useOnRedirectTo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_react","require","_reduxStore","useOnRedirectTo","baseName","router","routes","isAuthRouteRef","useRef","onRedirectTo","_path","opts","useMemo","current","path","isAuthRoute","isSSR","window","undefined","startsWith","substring","length","preserveQueryParams","location","search","refresh","Cypress","push","href","replace","_default","exports","default"],"sources":["../../../../../packages/nextjs/src/utils/useOnRedirectTo/index.ts"],"sourcesContent":["import { useMemo, useRef } from 'react';\nimport { RedirectOptions } from '@frontegg/rest-api';\nimport type { NextRouter } from 'next/router';\nimport type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context';\nimport { isAuthRoute, AuthPageRoutes } from '@frontegg/redux-store';\n\nconst useOnRedirectTo = (\n baseName: string,\n router: AppRouterInstance | NextRouter,\n routes?: Partial<AuthPageRoutes>\n) => {\n const isAuthRouteRef = useRef<(path: string) => boolean>(() => false);\n const onRedirectTo = useRef((_path: string, opts?: RedirectOptions) => {});\n\n useMemo(() => {\n isAuthRouteRef.current = (path) => isAuthRoute(path, routes);\n }, [routes]);\n\n onRedirectTo.current = (_path: string, opts?: RedirectOptions) => {\n const isSSR = typeof window == undefined;\n let path = _path;\n if (path.startsWith(baseName)) {\n path = path.substring(baseName.length);\n }\n if (opts?.preserveQueryParams || isAuthRouteRef.current(path)) {\n path = `${path}${window.location.search}`;\n }\n if (opts?.refresh && !isSSR) {\n // @ts-ignore\n window.Cypress ? router.push(path) : (window.location.href = path);\n } else {\n opts?.replace ? router.replace(path) : router.push(path);\n }\n };\n\n return onRedirectTo.current;\n};\n\nexport default useOnRedirectTo;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,WAAA,GAAAD,OAAA;AAEA,MAAME,eAAe,GAAGA,CACtBC,QAAgB,EAChBC,MAAsC,EACtCC,MAAgC,KAC7B;EACH,MAAMC,cAAc,GAAG,IAAAC,aAAM,EAA4B,MAAM,KAAK,CAAC;EACrE,MAAMC,YAAY,GAAG,IAAAD,aAAM,EAAC,CAACE,KAAa,EAAEC,IAAsB,KAAK,CAAC,CAAC,CAAC;EAE1E,IAAAC,cAAO,EAAC,MAAM;IACZL,cAAc,CAACM,OAAO,GAAIC,IAAI,IAAK,IAAAC,uBAAW,EAACD,IAAI,EAAER,MAAM,CAAC;EAC9D,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EAEZG,YAAY,CAACI,OAAO,GAAG,CAACH,KAAa,EAAEC,IAAsB,KAAK;IAChE,MAAMK,KAAK,GAAG,OAAOC,MAAM,IAAIC,SAAS;IACxC,IAAIJ,IAAI,GAAGJ,KAAK;IAChB,IAAII,IAAI,CAACK,UAAU,CAACf,QAAQ,CAAC,EAAE;MAC7BU,IAAI,GAAGA,IAAI,CAACM,SAAS,CAAChB,QAAQ,CAACiB,MAAM,CAAC;IACxC;IACA,IAAIV,IAAI,YAAJA,IAAI,CAAEW,mBAAmB,IAAIf,cAAc,CAACM,OAAO,CAACC,IAAI,CAAC,EAAE;MAC7DA,IAAI,GAAG,GAAGA,IAAI,GAAGG,MAAM,CAACM,QAAQ,CAACC,MAAM,EAAE;IAC3C;IACA,IAAIb,IAAI,YAAJA,IAAI,CAAEc,OAAO,IAAI,CAACT,KAAK,EAAE;MAC3B;MACAC,MAAM,CAACS,OAAO,GAAGrB,MAAM,CAACsB,IAAI,CAACb,IAAI,CAAC,GAAIG,MAAM,CAACM,QAAQ,CAACK,IAAI,GAAGd,IAAK;IACpE,CAAC,MAAM;MACLH,IAAI,YAAJA,IAAI,CAAEkB,OAAO,GAAGxB,MAAM,CAACwB,OAAO,CAACf,IAAI,CAAC,GAAGT,MAAM,CAACsB,IAAI,CAACb,IAAI,CAAC;IAC1D;EACF,CAAC;EAED,OAAOL,YAAY,CAACI,OAAO;AAC7B,CAAC;AAAC,IAAAiB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa7B,eAAe","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","require","_reduxStore","useOnRedirectTo","baseName","router","routes","isAuthRouteRef","useRef","onRedirectTo","_path","opts","useMemo","current","path","isAuthRoute","isSSR","window","undefined","startsWith","substring","length","preserveQueryParams","location","search","refresh","Cypress","push","href","replace","_default","exports","default"],"sources":["../../../../../packages/nextjs/src/utils/useOnRedirectTo/index.ts"],"sourcesContent":["import { useMemo, useRef } from 'react';\nimport { RedirectOptions } from '@frontegg/rest-api';\nimport type { NextRouter } from 'next/router';\nimport type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';\nimport { isAuthRoute, AuthPageRoutes } from '@frontegg/redux-store';\n\nconst useOnRedirectTo = (\n baseName: string,\n router: AppRouterInstance | NextRouter,\n routes?: Partial<AuthPageRoutes>\n) => {\n const isAuthRouteRef = useRef<(path: string) => boolean>(() => false);\n const onRedirectTo = useRef((_path: string, opts?: RedirectOptions) => {});\n\n useMemo(() => {\n isAuthRouteRef.current = (path) => isAuthRoute(path, routes);\n }, [routes]);\n\n onRedirectTo.current = (_path: string, opts?: RedirectOptions) => {\n const isSSR = typeof window == undefined;\n let path = _path;\n if (path.startsWith(baseName)) {\n path = path.substring(baseName.length);\n }\n if (opts?.preserveQueryParams || isAuthRouteRef.current(path)) {\n path = `${path}${window.location.search}`;\n }\n if (opts?.refresh && !isSSR) {\n // @ts-ignore\n window.Cypress ? router.push(path) : (window.location.href = path);\n } else {\n opts?.replace ? router.replace(path) : router.push(path);\n }\n };\n\n return onRedirectTo.current;\n};\n\nexport default useOnRedirectTo;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,WAAA,GAAAD,OAAA;AAEA,MAAME,eAAe,GAAGA,CACtBC,QAAgB,EAChBC,MAAsC,EACtCC,MAAgC,KAC7B;EACH,MAAMC,cAAc,GAAG,IAAAC,aAAM,EAA4B,MAAM,KAAK,CAAC;EACrE,MAAMC,YAAY,GAAG,IAAAD,aAAM,EAAC,CAACE,KAAa,EAAEC,IAAsB,KAAK,CAAC,CAAC,CAAC;EAE1E,IAAAC,cAAO,EAAC,MAAM;IACZL,cAAc,CAACM,OAAO,GAAIC,IAAI,IAAK,IAAAC,uBAAW,EAACD,IAAI,EAAER,MAAM,CAAC;EAC9D,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EAEZG,YAAY,CAACI,OAAO,GAAG,CAACH,KAAa,EAAEC,IAAsB,KAAK;IAChE,MAAMK,KAAK,GAAG,OAAOC,MAAM,IAAIC,SAAS;IACxC,IAAIJ,IAAI,GAAGJ,KAAK;IAChB,IAAII,IAAI,CAACK,UAAU,CAACf,QAAQ,CAAC,EAAE;MAC7BU,IAAI,GAAGA,IAAI,CAACM,SAAS,CAAChB,QAAQ,CAACiB,MAAM,CAAC;IACxC;IACA,IAAIV,IAAI,YAAJA,IAAI,CAAEW,mBAAmB,IAAIf,cAAc,CAACM,OAAO,CAACC,IAAI,CAAC,EAAE;MAC7DA,IAAI,GAAG,GAAGA,IAAI,GAAGG,MAAM,CAACM,QAAQ,CAACC,MAAM,EAAE;IAC3C;IACA,IAAIb,IAAI,YAAJA,IAAI,CAAEc,OAAO,IAAI,CAACT,KAAK,EAAE;MAC3B;MACAC,MAAM,CAACS,OAAO,GAAGrB,MAAM,CAACsB,IAAI,CAACb,IAAI,CAAC,GAAIG,MAAM,CAACM,QAAQ,CAACK,IAAI,GAAGd,IAAK;IACpE,CAAC,MAAM;MACLH,IAAI,YAAJA,IAAI,CAAEkB,OAAO,GAAGxB,MAAM,CAACwB,OAAO,CAACf,IAAI,CAAC,GAAGT,MAAM,CAACsB,IAAI,CAACb,IAAI,CAAC;IAC1D;EACF,CAAC;EAED,OAAOL,YAAY,CAACI,OAAO;AAC7B,CAAC;AAAC,IAAAiB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa7B,eAAe","ignoreList":[]}
|