@frontegg/react 4.0.30 → 5.0.1-alpha.2912555230

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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from './FronteggProvider';
2
2
  export * from './AuthorizedContent';
3
3
  export * from './CheckoutDialog';
4
- export { AdminPortal, CheckoutDialog } from '@frontegg/admin-portal';
4
+ export { AdminPortal, CheckoutDialog } from '@frontegg/js';
5
5
  export * from '@frontegg/react-hooks';
6
6
  export * from '@frontegg/types';
package/index.js CHANGED
@@ -7,11 +7,11 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
7
7
  var tslib = require('tslib');
8
8
  var React = require('react');
9
9
  var React__default = _interopDefault(React);
10
- var adminPortal = require('@frontegg/admin-portal');
10
+ var js = require('@frontegg/js');
11
11
  var reactHooks = require('@frontegg/react-hooks');
12
12
  var ReactRouterDom = require('react-router-dom');
13
13
  var restApi = require('@frontegg/rest-api');
14
- var AppHolder = require('@frontegg/admin-portal/AppHolder');
14
+ var AppHolder = require('@frontegg/js/AppHolder');
15
15
  var types = require('@frontegg/types');
16
16
 
17
17
  var BrowserRouter = ReactRouterDom.BrowserRouter;
@@ -96,7 +96,7 @@ var Connector = function (_a) {
96
96
  return AppHolder.AppHolder.getInstance(appName !== null && appName !== void 0 ? appName : 'default');
97
97
  }
98
98
  catch (e) {
99
- return adminPortal.initialize(tslib.__assign(tslib.__assign({}, props), { basename: (_a = props.basename) !== null && _a !== void 0 ? _a : baseName, contextOptions: tslib.__assign({ requestCredentials: 'include' }, props.contextOptions), onRedirectTo: onRedirectTo }), appName !== null && appName !== void 0 ? appName : 'default');
99
+ return js.initialize(tslib.__assign(tslib.__assign({}, props), { basename: (_a = props.basename) !== null && _a !== void 0 ? _a : baseName, contextOptions: tslib.__assign({ requestCredentials: 'include' }, props.contextOptions), onRedirectTo: onRedirectTo }), appName !== null && appName !== void 0 ? appName : 'default');
100
100
  }
101
101
  }, []);
102
102
  restApi.ContextHolder.setOnRedirectTo(onRedirectTo);
@@ -177,7 +177,7 @@ var useCheckoutDialog = function (appName) {
177
177
  });
178
178
  }, []);
179
179
  var showDialog = React.useCallback(function (plan) {
180
- adminPortal.CheckoutDialog.show({
180
+ js.CheckoutDialog.show({
181
181
  plan: plan,
182
182
  onClose: hideDialog,
183
183
  onError: handleError,
@@ -190,7 +190,7 @@ var useCheckoutDialog = function (appName) {
190
190
  });
191
191
  }, [appName]);
192
192
  var hideDialog = React.useCallback(function () {
193
- adminPortal.CheckoutDialog.hide(appName);
193
+ js.CheckoutDialog.hide(appName);
194
194
  setState({
195
195
  open: false,
196
196
  error: null,
@@ -225,13 +225,13 @@ Object.keys(types).forEach(function (k) {
225
225
  Object.defineProperty(exports, 'AdminPortal', {
226
226
  enumerable: true,
227
227
  get: function () {
228
- return adminPortal.AdminPortal;
228
+ return js.AdminPortal;
229
229
  }
230
230
  });
231
231
  Object.defineProperty(exports, 'CheckoutDialog', {
232
232
  enumerable: true,
233
233
  get: function () {
234
- return adminPortal.CheckoutDialog;
234
+ return js.CheckoutDialog;
235
235
  }
236
236
  });
237
237
  exports.AuthorizedContent = AuthorizedContent;
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/routerProxy.tsx","../src/queryKeeper.tsx","../src/FronteggProvider.tsx","../src/AuthorizedContent.tsx","../src/CheckoutDialog.tsx"],"sourcesContent":["import * as ReactRouterDom 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 = ReactRouterDom.BrowserRouter;\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, ReactNode, useCallback, useMemo } from 'react';\nimport { initialize } from '@frontegg/admin-portal';\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/admin-portal/AppHolder';\nimport { useQueryKeeper } from './queryKeeper';\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 <FronteggStoreProvider {...({ ...props, app } as any)} />;\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/admin-portal';\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","React","useCallback","useMemo","AppHolder","initialize","ContextHolder","FronteggStoreProvider","__assign","useAuthUserOrNull","useState","CheckoutDialog"],"mappings":";;;;;;;;;;;;;;;;AAqBO,IAAM,aAAa,GAAGA,4BAA4B,CAAC;AAEnD,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;;ACjCD,IAAM,0BAA0B,GAAG,UAAC,KAAa;IAC/C,IAAM,CAAC,GAAG,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACxB,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;AACtB,CAAC,CAAC;AAEK,IAAM,cAAc,GAAG,UAAC,EAAwC;QAAtC,MAAM,YAAA,EAAE,OAAO,aAAA;IAC9C,IAAM,WAAW,GAAGC,YAAM,EAAU,CAAC;IACrC,IAAM,YAAY,GAAG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KACJ,EAAE,EAAE,CAAC,CAAC;IAEP,IAAM,aAAa,GAAGA,iBAAW,CAAC;QAChC,QAAQ,CAAC;YACP,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,IAAI;YACb,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;KACJ,EAAE,EAAE,CAAC,CAAC;IAEP,IAAM,UAAU,GAAGA,iBAAW,CAC5B,UAAC,IAAY;QACXS,0BAAc,CAAC,IAAI,CACjB;YACE,IAAI,MAAA;YACJ,OAAO,EAAE,UAAU;YACnB,OAAO,EAAE,WAAW;YACpB,SAAS,EAAE,aAAa;SACzB,EACD,OAAO,CACR,CAAC;QACF,QAAQ,CAAC;YACP,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;KACJ,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,IAAM,UAAU,GAAGT,iBAAW,CAAC;QAC7BS,0BAAc,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,OAAOR,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/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, 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';\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 <FronteggStoreProvider {...({ ...props, app } as any)} />;\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","React","useCallback","useMemo","AppHolder","initialize","ContextHolder","FronteggStoreProvider","__assign","useAuthUserOrNull","useState","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;;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KAAK,OAAA;QACL,OAAO,SAAA;KACR,IAAC,EACF,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAC/C,CAAC;AACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@frontegg/react",
3
3
  "libName": "FronteggReact",
4
- "version": "4.0.30",
4
+ "version": "5.0.1-alpha.2912555230",
5
5
  "author": "Frontegg LTD",
6
6
  "main": "index.js",
7
7
  "types": "index.d.ts",
@@ -10,8 +10,8 @@
10
10
  "build:watch": "rm -rf dist && mkdir dist && rollup -w -c ./rollup.config.js"
11
11
  },
12
12
  "dependencies": {
13
- "@frontegg/admin-portal": "5.79.0",
14
- "@frontegg/react-hooks": "5.79.0"
13
+ "@frontegg/js": "6.0.3-alpha.3",
14
+ "@frontegg/react-hooks": "6.0.3-alpha.3"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "react": ">16.9.0",
package/routerProxy.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import * as ReactRouterDom from 'react-router-dom';
1
+ import { FC } from 'react';
2
+ import { BrowserRouterProps } from 'react-router-dom';
2
3
  export declare type Path = string;
3
4
  declare type Location = {
4
5
  pathname: string;
@@ -14,6 +15,6 @@ export declare type UseHistory = {
14
15
  replace(path: Path, state?: any): void;
15
16
  replace(location: LocationDescriptor): void;
16
17
  };
17
- export declare const BrowserRouter: typeof ReactRouterDom.BrowserRouter;
18
+ export declare const BrowserRouter: FC<BrowserRouterProps>;
18
19
  export declare const useHistory: () => UseHistory;
19
20
  export {};