@frontegg/react 5.0.20-alpha.4036871419 → 5.0.21-alpha.4066444256

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/CHANGELOG.md CHANGED
@@ -1,23 +1,19 @@
1
1
  # Change Log
2
2
 
3
- ## [5.0.20](https://github.com/frontegg/frontegg-react/compare/v5.0.19...v5.0.20) (2023-1-29)
4
-
5
- - FR-10549 - fix error login with sms
6
- - FR-10437 - select color
7
- - FR-10518 - fix client id not show in model
8
- - FR-10485 - Update `@frontegg/rest-api` version
9
- - FR-10017 - Add `type="email"` to all email HTML inputs
10
- - FR-10501 - Expand LoginBox width in mobile devices
11
- - FR-10196 - Fix scroll in privacy page
12
- - FR-10489 - UI enhancements in SCIM
13
- - FR-10483 - Added the option to customize forget password button
14
- - FR-10374 - UI enhancements in split mode
15
- - FR-10184 - Add access tokens screen
16
- - FR-9995 - UI enhancements for Invitation text and icon
3
+ ## [5.0.21](https://github.com/frontegg/frontegg-react/compare/v5.0.20...v5.0.21) (2023-2-1)
17
4
 
18
5
 
19
- ## [5.0.19](https://github.com/frontegg/frontegg-react/compare/v5.0.18...v5.0.19) (2023-1-24)
20
-
6
+ ### React Wrapper 5.0.21:
7
+ - FR-10625 - Export HostedLogin class from @frontegg/js library
8
+ # Change Log
9
+
10
+ ## [5.0.20](https://github.com/frontegg/frontegg-react/compare/v5.0.19...v5.0.20) (2023-1-29)
11
+
12
+ - Fixed error message position in login with SMS screen
13
+ - Fixed missing client ID after creating API token
14
+
15
+ ## [5.0.19](https://github.com/frontegg/frontegg-react/compare/v5.0.18...v5.0.19) (2023-1-24)
16
+
21
17
  - FR-10485 - Update `@frontegg/rest-api` version
22
18
  - FR-10017 - Add `type="email"` to all email HTML inputs
23
19
  - FR-10501 - Expand LoginBox width in mobile devices
@@ -26,17 +22,17 @@
26
22
  - FR-10483 - Added the option to customize forget password button
27
23
  - FR-10374 - UI enhancements in split mode
28
24
  - FR-10184 - Add access tokens screen
29
- - FR-9995 - UI enhancements for Invitation text and icon
30
- - FR-10448 - add prettier pre-commit check
31
- - FR-10443 - Fix impersonation
32
- - FR-10282 - fix otc login for mobile
33
- - FR-10410 - fix policies mock
34
- - FR-10371 - sync vendor security policies
35
- - FR-10302 - Add impersonation indication for audit logs
36
- - FR-10281 - Impersonation
37
- - FR-10261 - fix sign up position in dark theme
38
- - FR-10369 - change mfa ff name
39
-
25
+ - FR-9995 - UI enhancements for Invitation text and icon
26
+ - FR-10448 - add prettier pre-commit check
27
+ - FR-10443 - Fix impersonation
28
+ - FR-10282 - fix otc login for mobile
29
+ - FR-10410 - fix policies mock
30
+ - FR-10371 - sync vendor security policies
31
+ - FR-10302 - Add impersonation indication for audit logs
32
+ - FR-10281 - Impersonation
33
+ - FR-10261 - fix sign up position in dark theme
34
+ - FR-10369 - change mfa ff name
35
+
40
36
  # Change Log
41
37
 
42
38
  ## [5.0.18](https://github.com/frontegg/frontegg-react/compare/v5.0.17...v5.0.18) (2023-1-16)
package/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from './FronteggProvider';
2
2
  export * from './AuthorizedContent';
3
3
  export * from './CheckoutDialog';
4
- export { AdminPortal, CheckoutDialog } from '@frontegg/js';
4
+ export { AdminPortal, CheckoutDialog, HostedLogin } from '@frontegg/js';
5
5
  export * from '@frontegg/react-hooks';
6
6
  export * from '@frontegg/types';
7
7
  export { ContextHolder } from '@frontegg/rest-api';
package/index.js CHANGED
@@ -317,6 +317,12 @@ Object.defineProperty(exports, 'CheckoutDialog', {
317
317
  return js.CheckoutDialog;
318
318
  }
319
319
  });
320
+ Object.defineProperty(exports, 'HostedLogin', {
321
+ enumerable: true,
322
+ get: function () {
323
+ return js.HostedLogin;
324
+ }
325
+ });
320
326
  Object.defineProperty(exports, 'ContextHolder', {
321
327
  enumerable: true,
322
328
  get: function () {
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/routerProxy.tsx","../src/queryKeeper.tsx","../src/CustomComponentHolder.tsx","../src/FronteggProvider.tsx","../src/AuthorizedContent.tsx","../src/CheckoutDialog.tsx"],"sourcesContent":["import * as ReactRouterDom from 'react-router-dom';\nimport { FC } from 'react';\nimport { BrowserRouterProps } from 'react-router-dom';\n\nexport type Path = string;\n\ntype Location = {\n pathname: string;\n search: string;\n state: any;\n hash: string;\n key?: string;\n};\n\ntype LocationDescriptor = string | Location;\n\nexport type UseHistory = {\n push(path: Path, state?: any): void;\n push(location: LocationDescriptor): void;\n replace(path: Path, state?: any): void;\n replace(location: LocationDescriptor): void;\n};\n\nexport const BrowserRouter: FC<BrowserRouterProps> = (ReactRouterDom.BrowserRouter as unknown) as FC<\n BrowserRouterProps\n>;\n\nexport const useHistory = (): UseHistory => {\n // @ts-ignore\n const navigate = ReactRouterDom.useInRouterContext?.() ? ReactRouterDom.useNavigate?.() : null;\n const history = ReactRouterDom.useHistory?.();\n\n if (navigate) {\n const push = (path: Path, state?: any): void => {\n if (state) {\n navigate(path, { state });\n } else {\n navigate(path);\n }\n };\n\n const replace = (path: Path, state?: any): void => {\n navigate(path, { state, replace: true });\n };\n\n return { push, replace };\n }\n return history;\n};\n","import { useEffect, useRef } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport { UseHistory } from './routerProxy';\n\ninterface UseQueryKeeperProps {\n history: UseHistory;\n routes: {\n [key: string]: string;\n };\n}\n\nconst removeRedirectUrlFromQuery = (query: string) => {\n const q = new URLSearchParams(query);\n q.delete('redirectUrl');\n return q.toString();\n};\n\nexport const useQueryKeeper = ({ routes, history }: UseQueryKeeperProps): void => {\n const queryParams = useRef<string>();\n const prevPathname = useRef<string>();\n const { pathname, search } = useLocation();\n\n useEffect(() => {\n if (!!search) {\n queryParams.current = search;\n prevPathname.current = pathname;\n }\n }, []);\n\n useEffect(() => {\n const shouldKeepQuery = !!Object.values(routes).find((route) => route === prevPathname.current);\n\n if (!search && !!queryParams.current && shouldKeepQuery) {\n const query = removeRedirectUrlFromQuery(queryParams.current);\n history.push(pathname + `?${query}`);\n }\n\n prevPathname.current = pathname;\n }, [pathname, search, routes]);\n};\n","import React, { FC, isValidElement, ReactElement, useCallback, useMemo, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport { FronteggAppInstance } from '@frontegg/types';\nimport { isElement } from 'react-is';\n\nexport class CustomComponentHolder {\n private static components: { [name in string]: ReactElement } = {};\n\n public static set(name: string, element: any) {\n CustomComponentHolder.components[name] = element;\n }\n\n public static get(name: string): ReactElement {\n return CustomComponentHolder.components[name];\n }\n}\n\nconst overrideValue = (object: any, key: string, value: any) => {\n const keys: string[] = key.split('.');\n let iterator = object;\n while (keys.length > 1) {\n iterator = iterator[keys.shift() as any];\n }\n iterator[keys.shift() as any] = value;\n};\nconst Registerer: FC<{ app: FronteggAppInstance; themeKey: string }> = (props) => {\n const { app, themeKey } = props;\n const value = CustomComponentHolder.get(themeKey);\n const [mounted, setMounted] = useState(false);\n\n const mount = useCallback(() => {\n setMounted(true);\n }, []);\n const unmount = useCallback(() => {\n setMounted(false);\n }, []);\n\n overrideValue(app.options.themeOptions!, themeKey, { type: 'slot', themeKey, mount, unmount });\n\n let element = app.loginBoxContainer?.querySelector(`[slot=\"${themeKey}\"]`);\n if (!element && typeof document !== undefined) {\n element = document.createElement('div');\n element.slot = themeKey;\n app.loginBoxContainer?.appendChild(element);\n }\n\n return element && mounted ? <React.Fragment>{ReactDOM.createPortal(value, element)}</React.Fragment> : <></>;\n};\n\nexport const CustomComponentRegister: FC<{ app: FronteggAppInstance; themeOptions: any }> = ({ app, themeOptions }) => {\n const keys = useMemo(() => {\n if (!themeOptions || !themeOptions.loginBox) {\n return [];\n }\n const loop = (key: string, obj: any, keyPath: string): string[] => {\n if (typeof obj !== 'object' && typeof obj !== 'function') {\n return [];\n }\n if (typeof obj === 'function') {\n try {\n obj = React.createElement(obj);\n if (isValidElement(obj) || isElement(obj)) {\n const generatedKey = `${keyPath}.${key}`;\n CustomComponentHolder.set(generatedKey, obj);\n return [generatedKey];\n }\n } catch (e) {}\n }\n if (isValidElement(obj) || isElement(obj)) {\n const generatedKey = `${keyPath}.${key}`;\n CustomComponentHolder.set(generatedKey, obj);\n return [generatedKey];\n } else {\n const elements: string[] = [];\n Object.keys(obj).forEach((k) => {\n elements.push(...loop(k, obj[k], keyPath === '' ? key : `${keyPath}.${key}`));\n });\n return elements;\n }\n };\n return loop('loginBox', themeOptions.loginBox, '');\n }, []);\n\n return (\n <>\n {keys.map((key) => (\n <Registerer key={key} app={app} themeKey={key} />\n ))}\n </>\n );\n};\n","import React, { FC, ReactNode, useCallback, useMemo } from 'react';\nimport { initialize } from '@frontegg/js';\nimport { FronteggAppOptions } from '@frontegg/types';\nimport { FronteggStoreProvider } from '@frontegg/react-hooks';\nimport { BrowserRouter, useHistory, UseHistory } from './routerProxy';\nimport { ContextHolder, RedirectOptions } from '@frontegg/rest-api';\nimport { AppHolder } from '@frontegg/js/AppHolder';\nimport { useQueryKeeper } from './queryKeeper';\nimport { CustomComponentRegister } from './CustomComponentHolder';\n\nexport type FronteggProviderProps = FronteggAppOptions & {\n appName?: string;\n history?: UseHistory;\n children?: ReactNode;\n};\ntype ConnectorProps = Omit<FronteggProviderProps, 'history'> & {\n history: {\n push: (path: string) => void;\n replace: (path: string) => void;\n };\n};\n\nexport const ConnectorHistory: FC<Omit<ConnectorProps, 'history'>> = (props) => {\n const history = useHistory();\n return <Connector history={history} {...props} />;\n};\n\nexport const Connector: FC<ConnectorProps> = ({ history, appName, ...props }) => {\n const isSSR = typeof window === 'undefined';\n\n // v6 or v5\n const baseName = props.basename ?? '';\n\n const onRedirectTo = useCallback((_path: string, opts?: RedirectOptions) => {\n let path = _path;\n // noinspection SuspiciousTypeOfGuard\n if (baseName && typeof baseName === 'string' && baseName.length > 0 && path.startsWith(baseName)) {\n path = path.substring(baseName.length);\n }\n if (opts?.preserveQueryParams) {\n path = `${path}${window.location.search}`;\n }\n if (opts?.refresh && !isSSR) {\n // @ts-ignore\n window.Cypress ? history.push(path) : (window.location.href = path);\n } else {\n opts?.replace ? history.replace(path) : history.push(path);\n }\n }, []);\n\n const app = useMemo(() => {\n try {\n return AppHolder.getInstance(appName ?? 'default');\n } catch (e) {\n return initialize(\n {\n ...props,\n basename: props.basename ?? baseName,\n contextOptions: {\n requestCredentials: 'include',\n ...props.contextOptions,\n },\n onRedirectTo,\n },\n appName ?? 'default'\n );\n }\n }, []);\n ContextHolder.setOnRedirectTo(onRedirectTo);\n\n const signUpUrl = app.store.getState().auth.routes.signUpUrl;\n useQueryKeeper({ routes: { signUpUrl }, history });\n\n return (\n <>\n <CustomComponentRegister app={app} themeOptions={props.themeOptions} />\n <FronteggStoreProvider {...({ ...props, app } as any)} />\n </>\n );\n};\n\nexport const FronteggProvider: FC<FronteggProviderProps> = (props) => {\n const history = useHistory();\n\n if (props.history || history) {\n return (\n <Connector history={props.history || history} {...props}>\n {props.children}\n </Connector>\n );\n }\n\n return (\n <BrowserRouter basename={props.basename}>\n <ConnectorHistory {...props}>{props.children}</ConnectorHistory>\n </BrowserRouter>\n );\n};\n","import React, { FC, ReactNode } from 'react';\nimport { useAuthUserOrNull } from '@frontegg/react-hooks';\n\nexport interface AuthorizationProps {\n requiredRoles?: string[];\n requiredPermissions?: string[];\n render?: (isAuthorized: boolean) => React.ReactNode | null;\n children?: ReactNode;\n}\n\nexport const AuthorizedContent: FC<AuthorizationProps> = (props) => {\n let isAuthorized = true; // Initially\n const user = useAuthUserOrNull();\n\n if (!user?.superUser) {\n if (props.requiredPermissions) {\n isAuthorized = false; // Reset - we are going to check that the user has at least one matching permission\n for (const permission of props.requiredPermissions) {\n if (user?.permissions?.find(({ key }) => key === permission)) {\n isAuthorized = true;\n }\n }\n }\n\n if (props.requiredRoles) {\n isAuthorized = false; // Reset - we are going to check that the user has at least one matching role\n for (const role of props.requiredRoles) {\n if (user?.roles?.find(({ key }) => key === role)) {\n isAuthorized = true;\n }\n }\n }\n }\n if (typeof props.render === 'function') {\n return <>{props.render(isAuthorized)}</>;\n }\n\n return isAuthorized ? <>{props.children}</> : null;\n};\n","import { useCallback, useMemo, useState } from 'react';\nimport { CheckoutDialog } from '@frontegg/js';\n\ninterface CheckoutDialogState {\n open: boolean;\n error: string | null;\n success: boolean;\n}\n\nexport interface CheckoutDialogHook {\n showDialog: (plan: string) => void;\n hideDialog: () => void;\n open: boolean;\n error: string | null;\n success: boolean;\n}\n\nexport const useCheckoutDialog = (appName = 'default'): CheckoutDialogHook => {\n const [{ open, error, success }, setState] = useState<CheckoutDialogState>({\n open: false,\n error: null,\n success: false,\n });\n\n const handleError = useCallback((error: string) => {\n setState({\n open: true,\n success: false,\n error,\n });\n }, []);\n\n const handleSuccess = useCallback(() => {\n setState({\n open: false,\n success: true,\n error: null,\n });\n }, []);\n\n const showDialog = useCallback(\n (plan: string) => {\n CheckoutDialog.show(\n {\n plan,\n onClose: hideDialog,\n onError: handleError,\n onSuccess: handleSuccess,\n },\n appName\n );\n setState({\n open: true,\n success: false,\n error: null,\n });\n },\n [appName]\n );\n\n const hideDialog = useCallback(() => {\n CheckoutDialog.hide(appName);\n setState({\n open: false,\n error: null,\n success: false,\n });\n }, [appName]);\n\n return useMemo(\n () => ({\n open,\n showDialog,\n hideDialog,\n error,\n success,\n }),\n [open, showDialog, hideDialog, error, success]\n );\n};\n"],"names":["ReactRouterDom.BrowserRouter","ReactRouterDom.useInRouterContext","ReactRouterDom.useNavigate","ReactRouterDom.useHistory","useRef","useLocation","useEffect","useState","useCallback","React","useMemo","isValidElement","isElement","AppHolder","initialize","ContextHolder","FronteggStoreProvider","__assign","useAuthUserOrNull","CheckoutDialog"],"mappings":";;;;;;;;;;;;;;;;;;AAuBO,IAAM,aAAa,GAA4BA,4BAErD,CAAC;AAEK,IAAM,UAAU,GAAG;;;IAExB,IAAM,QAAQ,GAAG,OAAAC,iCAAiC,+CAAjC,cAAc,WAA0BC,0BAA0B,+CAA1B,cAAc,IAAmB,IAAI,CAAC;IAC/F,IAAM,OAAO,SAAGC,yBAAyB,+CA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AC;KACJ,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,IAAM,UAAU,GAAGX,iBAAW,CAAC;QAC7BW,iBAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7B,QAAQ,CAAC;YACP,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,IAAI;YACX,OAAO,EAAE,KAAK;SACf,CAAC,CAAC;KACJ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAOT,aAAO,CACZ,cAAM,QAAC;QACL,IAAI,MAAA;QACJ,UAAU,YAAA;QACV,UAAU,YAAA;QACV,KAAK,OAAA;QACL,OAAO,SAAA;KACR,IAAC,EACF,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAC/C,CAAC;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/routerProxy.tsx","../src/queryKeeper.tsx","../src/CustomComponentHolder.tsx","../src/FronteggProvider.tsx","../src/AuthorizedContent.tsx","../src/CheckoutDialog.tsx"],"sourcesContent":["import * as ReactRouterDom from 'react-router-dom';\nimport { FC } from 'react';\nimport { BrowserRouterProps } from 'react-router-dom';\n\nexport type Path = string;\n\ntype Location = {\n pathname: string;\n search: string;\n state: any;\n hash: string;\n key?: string;\n};\n\ntype LocationDescriptor = string | Location;\n\nexport type UseHistory = {\n push(path: Path, state?: any): void;\n push(location: LocationDescriptor): void;\n replace(path: Path, state?: any): void;\n replace(location: LocationDescriptor): void;\n};\n\nexport const BrowserRouter: FC<BrowserRouterProps> = (ReactRouterDom.BrowserRouter as unknown) as FC<\n BrowserRouterProps\n>;\n\nexport const useHistory = (): UseHistory => {\n // @ts-ignore\n const navigate = ReactRouterDom.useInRouterContext?.() ? ReactRouterDom.useNavigate?.() : null;\n const history = ReactRouterDom.useHistory?.();\n\n if (navigate) {\n const push = (path: Path, state?: any): void => {\n if (state) {\n navigate(path, { state });\n } else {\n navigate(path);\n }\n };\n\n const replace = (path: Path, state?: any): void => {\n navigate(path, { state, replace: true });\n };\n\n return { push, replace };\n }\n return history;\n};\n","import { useEffect, useRef } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport { UseHistory } from './routerProxy';\n\ninterface UseQueryKeeperProps {\n history: UseHistory;\n routes: {\n [key: string]: string;\n };\n}\n\nconst removeRedirectUrlFromQuery = (query: string) => {\n const q = new URLSearchParams(query);\n q.delete('redirectUrl');\n return q.toString();\n};\n\nexport const useQueryKeeper = ({ routes, history }: UseQueryKeeperProps): void => {\n const queryParams = useRef<string>();\n const prevPathname = useRef<string>();\n const { pathname, search } = useLocation();\n\n useEffect(() => {\n if (!!search) {\n queryParams.current = search;\n prevPathname.current = pathname;\n }\n }, []);\n\n useEffect(() => {\n const shouldKeepQuery = !!Object.values(routes).find((route) => route === prevPathname.current);\n\n if (!search && !!queryParams.current && shouldKeepQuery) {\n const query = removeRedirectUrlFromQuery(queryParams.current);\n history.push(pathname + `?${query}`);\n }\n\n prevPathname.current = pathname;\n }, [pathname, search, routes]);\n};\n","import React, { FC, isValidElement, ReactElement, useCallback, useMemo, useState } from 'react';\nimport ReactDOM from 'react-dom';\nimport { FronteggAppInstance } from '@frontegg/types';\nimport { isElement } from 'react-is';\n\nexport class CustomComponentHolder {\n private static components: { [name in string]: ReactElement } = {};\n\n public static set(name: string, element: any) {\n CustomComponentHolder.components[name] = element;\n }\n\n public static get(name: string): ReactElement {\n return CustomComponentHolder.components[name];\n }\n}\n\nconst overrideValue = (object: any, key: string, value: any) => {\n const keys: string[] = key.split('.');\n let iterator = object;\n while (keys.length > 1) {\n iterator = iterator[keys.shift() as any];\n }\n iterator[keys.shift() as any] = value;\n};\nconst Registerer: FC<{ app: FronteggAppInstance; themeKey: string }> = (props) => {\n const { app, themeKey } = props;\n const value = CustomComponentHolder.get(themeKey);\n const [mounted, setMounted] = useState(false);\n\n const mount = useCallback(() => {\n setMounted(true);\n }, []);\n const unmount = useCallback(() => {\n setMounted(false);\n }, []);\n\n overrideValue(app.options.themeOptions!, themeKey, { type: 'slot', themeKey, mount, unmount });\n\n let element = app.loginBoxContainer?.querySelector(`[slot=\"${themeKey}\"]`);\n if (!element && typeof document !== undefined) {\n element = document.createElement('div');\n element.slot = themeKey;\n app.loginBoxContainer?.appendChild(element);\n }\n\n return element && mounted ? <React.Fragment>{ReactDOM.createPortal(value, element)}</React.Fragment> : <></>;\n};\n\nexport const CustomComponentRegister: FC<{ app: FronteggAppInstance; themeOptions: any }> = ({ app, themeOptions }) => {\n const keys = useMemo(() => {\n if (!themeOptions || !themeOptions.loginBox) {\n return [];\n }\n const loop = (key: string, obj: any, keyPath: string): string[] => {\n if (typeof obj !== 'object' && typeof obj !== 'function') {\n return [];\n }\n if (typeof obj === 'function') {\n try {\n obj = React.createElement(obj);\n if (isValidElement(obj) || isElement(obj)) {\n const generatedKey = `${keyPath}.${key}`;\n CustomComponentHolder.set(generatedKey, obj);\n return [generatedKey];\n }\n } catch (e) {}\n }\n if (isValidElement(obj) || isElement(obj)) {\n const generatedKey = `${keyPath}.${key}`;\n CustomComponentHolder.set(generatedKey, obj);\n return [generatedKey];\n } else {\n const elements: string[] = [];\n Object.keys(obj).forEach((k) => {\n elements.push(...loop(k, obj[k], keyPath === '' ? key : `${keyPath}.${key}`));\n });\n return elements;\n }\n };\n return loop('loginBox', themeOptions.loginBox, '');\n }, []);\n\n return (\n <>\n {keys.map((key) => (\n <Registerer key={key} app={app} themeKey={key} />\n ))}\n </>\n );\n};\n","import React, { FC, ReactNode, useCallback, useMemo } from 'react';\nimport { initialize } from '@frontegg/js';\nimport { FronteggAppOptions } from '@frontegg/types';\nimport { FronteggStoreProvider } from '@frontegg/react-hooks';\nimport { BrowserRouter, useHistory, UseHistory } from './routerProxy';\nimport { ContextHolder, RedirectOptions } from '@frontegg/rest-api';\nimport { AppHolder } from '@frontegg/js/AppHolder';\nimport { useQueryKeeper } from './queryKeeper';\nimport { CustomComponentRegister } from './CustomComponentHolder';\n\nexport type FronteggProviderProps = FronteggAppOptions & {\n appName?: string;\n history?: UseHistory;\n children?: ReactNode;\n};\ntype ConnectorProps = Omit<FronteggProviderProps, 'history'> & {\n history: {\n push: (path: string) => void;\n replace: (path: string) => void;\n };\n};\n\nexport const ConnectorHistory: FC<Omit<ConnectorProps, 'history'>> = (props) => {\n const history = useHistory();\n return <Connector history={history} {...props} />;\n};\n\nexport const Connector: FC<ConnectorProps> = ({ history, appName, ...props }) => {\n const isSSR = typeof window === 'undefined';\n\n // v6 or v5\n const baseName = props.basename ?? '';\n\n const onRedirectTo = useCallback((_path: string, opts?: RedirectOptions) => {\n let path = _path;\n // noinspection SuspiciousTypeOfGuard\n if (baseName && typeof baseName === 'string' && baseName.length > 0 && path.startsWith(baseName)) {\n path = path.substring(baseName.length);\n }\n if (opts?.preserveQueryParams) {\n path = `${path}${window.location.search}`;\n }\n if (opts?.refresh && !isSSR) {\n // @ts-ignore\n window.Cypress ? history.push(path) : (window.location.href = path);\n } else {\n opts?.replace ? history.replace(path) : history.push(path);\n }\n }, []);\n\n const app = useMemo(() => {\n try {\n return AppHolder.getInstance(appName ?? 'default');\n } catch (e) {\n return initialize(\n {\n ...props,\n basename: props.basename ?? baseName,\n contextOptions: {\n requestCredentials: 'include',\n ...props.contextOptions,\n },\n onRedirectTo,\n },\n appName ?? 'default'\n );\n }\n }, []);\n ContextHolder.setOnRedirectTo(onRedirectTo);\n\n const signUpUrl = app.store.getState().auth.routes.signUpUrl;\n useQueryKeeper({ routes: { signUpUrl }, history });\n\n return (\n <>\n <CustomComponentRegister app={app} themeOptions={props.themeOptions} />\n <FronteggStoreProvider {...({ ...props, app } as any)} />\n </>\n );\n};\n\nexport const FronteggProvider: FC<FronteggProviderProps> = (props) => {\n const history = useHistory();\n\n if (props.history || history) {\n return (\n <Connector history={props.history || history} {...props}>\n {props.children}\n </Connector>\n );\n }\n\n return (\n <BrowserRouter basename={props.basename}>\n <ConnectorHistory {...props}>{props.children}</ConnectorHistory>\n </BrowserRouter>\n );\n};\n","import React, { FC, ReactNode } from 'react';\nimport { useAuthUserOrNull } from '@frontegg/react-hooks';\n\nexport interface AuthorizationProps {\n requiredRoles?: string[];\n requiredPermissions?: string[];\n render?: (isAuthorized: boolean) => React.ReactNode | null;\n children?: ReactNode;\n}\n\nexport const AuthorizedContent: FC<AuthorizationProps> = (props) => {\n let isAuthorized = true; // Initially\n const user = useAuthUserOrNull();\n\n if (!user?.superUser) {\n if (props.requiredPermissions) {\n isAuthorized = false; // Reset - we are going to check that the user has at least one matching permission\n for (const permission of props.requiredPermissions) {\n if (user?.permissions?.find(({ key }) => key === permission)) {\n isAuthorized = true;\n }\n }\n }\n\n if (props.requiredRoles) {\n isAuthorized = false; // Reset - we are going to check that the user has at least one matching role\n for (const role of props.requiredRoles) {\n if (user?.roles?.find(({ key }) => key === role)) {\n isAuthorized = true;\n }\n }\n }\n }\n if (typeof props.render === 'function') {\n return <>{props.render(isAuthorized)}</>;\n }\n\n return isAuthorized ? <>{props.children}</> : null;\n};\n","import { useCallback, useMemo, useState } from 'react';\nimport { CheckoutDialog } from '@frontegg/js';\n\ninterface CheckoutDialogState {\n open: boolean;\n error: string | null;\n success: boolean;\n}\n\nexport interface CheckoutDialogHook {\n showDialog: (plan: string) => void;\n hideDialog: () => void;\n open: boolean;\n error: string | null;\n success: boolean;\n}\n\nexport const useCheckoutDialog = (appName = 'default'): CheckoutDialogHook => {\n const [{ open, error, success }, setState] = useState<CheckoutDialogState>({\n open: false,\n error: null,\n success: false,\n });\n\n const handleError = useCallback((error: string) => {\n setState({\n open: true,\n success: false,\n error,\n });\n }, []);\n\n const handleSuccess = useCallback(() => {\n setState({\n open: false,\n success: true,\n error: null,\n });\n }, []);\n\n const showDialog = useCallback(\n (plan: string) => {\n CheckoutDialog.show(\n {\n plan,\n onClose: hideDialog,\n onError: handleError,\n onSuccess: handleSuccess,\n },\n appName\n );\n setState({\n open: true,\n success: false,\n error: null,\n });\n },\n [appName]\n );\n\n const hideDialog = useCallback(() => {\n CheckoutDialog.hide(appName);\n setState({\n open: false,\n error: null,\n success: false,\n });\n }, [appName]);\n\n return useMemo(\n () => ({\n open,\n showDialog,\n hideDialog,\n error,\n success,\n }),\n [open, showDialog, hideDialog, error, success]\n );\n};\n"],"names":["ReactRouterDom.BrowserRouter","ReactRouterDom.useInRouterContext","ReactRouterDom.useNavigate","ReactRouterDom.useHistory","useRef","useLocation","useEffect","useState","useCallback","React","useMemo","isValidElement","isElement","AppHolder","initialize","ContextHolder","FronteggStoreProvider","__assign","useAuthUserOrNull","CheckoutDialog"],"mappings":";;;;;;;;;;;;;;;;;;AAuBO,IAAM,aAAa,GAA4BA,4BAErD,CAAC;AAEK,IAAM,UAAU,GAAG;;;IAExB,IAAM,QAAQ,GAAG,OAAAC,iCAAiC,+CAAjC,cAAc,WAA0BC,0BAA0B,+CAA1B,cAAc,IAAmB,IAAI,CAAC;IAC/F,IAAM,OAAO,SAAGC,yBAAyB,+CAAzB,cAAc,CAAe,CAAC;IAE9C,IAAI,QAAQ,EAAE;QACZ,IAAM,IAAI,GAAG,UAAC,IAAU,EAAE,KAAW;YACnC,IAAI,KAAK,EAAE;gBACT,QAAQ,CAAC,IAAI,EAAE,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;aAC3B;iBAAM;gBACL,QAAQ,CAAC,IAAI,CAAC,CAAC;aAChB;SACF,CAAC;QAEF,IAAM,OAAO,GAAG,UAAC,IAAU,EAAE,KAAW;YACtC,QAAQ,CAAC,IAAI,EAAE,EAAE,KAAK,OAAA,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;SAC1C,CAAC;QAEF,OAAO,EAAE,IAAI,MAAA,EAAE,OAAO,SAAA,EAAE,CAAC;KAC1B;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;;ACrCD,IAAM,0BAA0B,GAAG,UAAC,KAAa;IAC/C,IAAM,CAAC,GAAG,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;IACrC,CAA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react",
3
3
  "libName": "FronteggReact",
4
- "version": "5.0.20-alpha.4036871419",
4
+ "version": "5.0.21-alpha.4066444256",
5
5
  "author": "Frontegg LTD",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",