@descope/react-sdk 2.3.24 → 2.3.25

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationsPortal.js","sources":["../../../src/components/ApplicationsPortal.tsx"],"sourcesContent":["import React, { lazy, Suspense, useImperativeHandle, useState } from 'react';\nimport Context from '../hooks/Context';\nimport { ApplicationsPortalProps } from '../types';\nimport withPropsMapping from './withPropsMapping';\n\n// web-component code uses browser API, but can be used in SSR apps, hence the lazy loading\nconst ApplicationsPortalWC = lazy(async () => {\n await import('@descope/applications-portal-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n <descope-applications-portal-widget ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst ApplicationsPortal = React.forwardRef<\n HTMLElement,\n ApplicationsPortalProps\n>(({ logger, theme, debug, widgetId, styleId }, ref) => {\n const [innerRef, setInnerRef] = useState(null);\n\n useImperativeHandle(ref, () => innerRef);\n\n const { projectId, baseUrl, baseStaticUrl } = React.useContext(Context);\n\n return (\n <Suspense fallback={null}>\n <ApplicationsPortalWC\n projectId={projectId}\n widgetId={widgetId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n innerRef={setInnerRef}\n {...{\n // attributes\n 'theme.attr': theme,\n 'debug.attr': debug,\n 'styleId.attr': styleId,\n // props\n 'logger.prop': logger,\n }}\n />\n </Suspense>\n );\n});\n\nexport default ApplicationsPortal;\n"],"names":["ApplicationsPortalWC","lazy","async","Promise","resolve","then","_interopNamespace","require","default","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","ApplicationsPortal","logger","theme","debug","widgetId","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","useContext","Context","Suspense","fallback"],"mappings":"uhBAMA,MAAMA,EAAuBC,EAAIA,MAACC,gBAC1BC,QAAAC,UAAAC,MAAA,WAAA,OAAAC,EAAAC,QAAO,uCAAqC,IAE3C,CACLC,QAASC,EAAgB,QACvBC,UAAMC,YAAwB,CAACC,EAAOC,IACpCH,EAAAA,QAAoCI,cAAA,qCAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAMpDK,EAAqBP,EAAK,QAACC,YAG/B,EAAGO,SAAQC,QAAOC,QAAOC,WAAUC,WAAWT,KAC9C,MAAOU,EAAUC,GAAeC,EAAQA,SAAC,MAEzCC,sBAAoBb,GAAK,IAAMU,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,GAAkBnB,UAAMoB,WAAWC,EAAAA,SAE/D,OACErB,EAAC,QAAAI,cAAAkB,EAAQA,SAAC,CAAAC,SAAU,MAClBvB,EAAAA,QAACI,cAAAd,GACC2B,UAAWA,EACXN,SAAUA,EACVO,QAASA,EACTC,cAAeA,EACfN,SAAUC,EAGR,aAAcL,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeJ,IAIrB"}
1
+ {"version":3,"file":"ApplicationsPortal.js","sources":["../../../src/components/ApplicationsPortal.tsx"],"sourcesContent":["import React, { lazy, Suspense, useImperativeHandle, useState } from 'react';\nimport Context from '../hooks/Context';\nimport { ApplicationsPortalProps } from '../types';\nimport withPropsMapping from './withPropsMapping';\n\n// web-component code uses browser API, but can be used in SSR apps, hence the lazy loading\nconst ApplicationsPortalWC = lazy(async () => {\n await import('@descope/applications-portal-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n\t<descope-applications-portal-widget ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst ApplicationsPortal = React.forwardRef<\n HTMLElement,\n ApplicationsPortalProps\n>(({ logger, theme, debug, widgetId, styleId }, ref) => {\n const [innerRef, setInnerRef] = useState(null);\n\n useImperativeHandle(ref, () => innerRef);\n\n const { projectId, baseUrl, baseStaticUrl } = React.useContext(Context);\n\n return (\n\t<Suspense fallback={null}>\n\t\t<ApplicationsPortalWC\n projectId={projectId}\n widgetId={widgetId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n innerRef={setInnerRef}\n {...{\n // attributes\n 'theme.attr': theme,\n 'debug.attr': debug,\n 'styleId.attr': styleId,\n // props\n 'logger.prop': logger,\n }}\n />\n\t</Suspense>\n );\n});\n\nexport default ApplicationsPortal;\n"],"names":["ApplicationsPortalWC","lazy","async","Promise","resolve","then","_interopNamespace","require","default","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","ApplicationsPortal","logger","theme","debug","widgetId","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","useContext","Context","Suspense","fallback"],"mappings":"uhBAMA,MAAMA,EAAuBC,EAAIA,MAACC,gBAC1BC,QAAAC,UAAAC,MAAA,WAAA,OAAAC,EAAAC,QAAO,uCAAqC,IAE3C,CACLC,QAASC,EAAgB,QACvBC,UAAMC,YAAwB,CAACC,EAAOC,IAC3CH,EAAAA,QAAoCI,cAAA,qCAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAM7CK,EAAqBP,EAAK,QAACC,YAG/B,EAAGO,SAAQC,QAAOC,QAAOC,WAAUC,WAAWT,KAC9C,MAAOU,EAAUC,GAAeC,EAAQA,SAAC,MAEzCC,sBAAoBb,GAAK,IAAMU,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,GAAkBnB,UAAMoB,WAAWC,EAAAA,SAE/D,OACDrB,EAAC,QAAAI,cAAAkB,EAAQA,SAAC,CAAAC,SAAU,MACnBvB,EAAAA,QAACI,cAAAd,GACK2B,UAAWA,EACXN,SAAUA,EACVO,QAASA,EACTC,cAAeA,EACfN,SAAUC,EAGR,aAAcL,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeJ,IAIrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"Descope.js","sources":["../../../src/components/Descope.tsx"],"sourcesContent":["import React, {\n lazy,\n Suspense,\n useCallback,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\nimport { baseHeaders } from '../constants';\nimport Context from '../hooks/Context';\nimport { DescopeProps } from '../types';\nimport { getGlobalSdk } from '../sdk';\nimport withPropsMapping from './withPropsMapping';\n\n// web-component code uses browser API, but can be used in SSR apps, hence the lazy loading\nconst DescopeWC = lazy(async () => {\n const WebComponent: any =\n customElements?.get('descope-wc') ||\n (await import('@descope/web-component').then((module) => module.default));\n\n WebComponent.sdkConfigOverrides = {\n // Overrides the web-component's base headers to indicate usage via the React SDK\n baseHeaders,\n // Disables token persistence within the web-component to delegate token management\n // to the global SDK hooks. This ensures token handling aligns with the SDK's configuration,\n // and web-component requests leverage the global SDK's beforeRequest hooks for consistency\n persistTokens: false,\n hooks: {\n get beforeRequest() {\n // Retrieves the beforeRequest hook from the global SDK, which is initialized\n // within the AuthProvider using the desired configuration. This approach ensures\n // the web-component utilizes the same beforeRequest hooks as the global SDK\n return getGlobalSdk().httpClient.hooks.beforeRequest;\n },\n set beforeRequest(_) {\n // The empty setter prevents runtime errors when attempts are made to assign a value to 'beforeRequest'.\n // JavaScript objects default to having both getters and setters\n },\n },\n };\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n <descope-wc ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst Descope = React.forwardRef<HTMLElement, DescopeProps>(\n (\n {\n flowId,\n onSuccess,\n onError,\n onReady,\n logger,\n tenant,\n theme,\n locale,\n debug,\n client,\n form,\n telemetryKey,\n redirectUrl,\n autoFocus,\n validateOnBlur,\n restartOnError,\n errorTransformer,\n styleId,\n },\n ref,\n ) => {\n const [innerRef, setInnerRef] = useState(null);\n\n useImperativeHandle(ref, () => innerRef);\n\n const {\n projectId,\n baseUrl,\n baseStaticUrl,\n storeLastAuthenticatedUser,\n keepLastAuthenticatedUserAfterLogout,\n sdk,\n } = React.useContext(Context);\n\n const handleSuccess = useCallback(\n async (e: CustomEvent) => {\n // In order to make sure all the after-hooks are running with the success response\n // we are generating a fake response with the success data and calling the http client after hook fn with it\n await sdk.httpClient.hooks.afterRequest(\n {} as any,\n new Response(JSON.stringify(e.detail)),\n );\n if (onSuccess) {\n onSuccess(e);\n }\n },\n [onSuccess],\n );\n\n useEffect(() => {\n const ele = innerRef;\n ele?.addEventListener('success', handleSuccess);\n if (onError) ele?.addEventListener('error', onError);\n if (onReady) ele?.addEventListener('ready', onReady);\n\n return () => {\n if (onError) ele?.removeEventListener('error', onError);\n if (onReady) ele?.removeEventListener('ready', onReady);\n\n ele?.removeEventListener('success', handleSuccess);\n };\n }, [innerRef, onError, handleSuccess]);\n\n // Success event\n useEffect(() => {\n const ele = innerRef;\n ele?.addEventListener('success', handleSuccess);\n return () => {\n ele?.removeEventListener('success', handleSuccess);\n };\n }, [innerRef, handleSuccess]);\n\n // Error event\n useEffect(() => {\n const ele = innerRef;\n if (onError) ele?.addEventListener('error', onError);\n\n return () => {\n if (onError) ele?.removeEventListener('error', onError);\n };\n }, [innerRef, onError]);\n\n // Ready event\n useEffect(() => {\n const ele = innerRef;\n if (onReady) ele?.addEventListener('ready', onReady);\n\n return () => {\n if (onReady) ele?.removeEventListener('error', onReady);\n };\n }, [innerRef, onReady]);\n\n return (\n /**\n * in order to avoid redundant remounting of the WC, we are wrapping it with a form element\n * this workaround is done in order to support webauthn passkeys\n * it can be removed once this issue will be solved\n * https://bugs.chromium.org/p/chromium/issues/detail?id=1404106#c2\n */\n <form>\n <Suspense fallback={null}>\n <DescopeWC\n projectId={projectId}\n flowId={flowId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n ref={setInnerRef}\n telemetryKey={telemetryKey}\n redirectUrl={redirectUrl}\n autoFocus={autoFocus}\n styleId={styleId}\n validateOnBlur={validateOnBlur}\n restartOnError={restartOnError}\n keepLastAuthenticatedUserAfterLogout={\n keepLastAuthenticatedUserAfterLogout\n }\n tenant={tenant}\n {...{\n // attributes\n 'theme.attr': theme,\n 'locale.attr': locale,\n 'form.attr': form,\n 'client.attr': client,\n 'debug.attr': debug,\n 'store-last-authenticated-user.attr': storeLastAuthenticatedUser,\n // props\n 'errorTransformer.prop': errorTransformer,\n 'logger.prop': logger,\n }}\n />\n </Suspense>\n </form>\n );\n },\n);\n\nexport default Descope;\n"],"names":["DescopeWC","lazy","async","customElements","get","Promise","resolve","then","_interopNamespace","require","module","default","sdkConfigOverrides","baseHeaders","persistTokens","hooks","beforeRequest","getGlobalSdk","httpClient","_","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","Descope","flowId","onSuccess","onError","onReady","logger","tenant","theme","locale","debug","client","form","telemetryKey","redirectUrl","autoFocus","validateOnBlur","restartOnError","errorTransformer","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout","sdk","useContext","Context","handleSuccess","useCallback","e","afterRequest","Response","JSON","stringify","detail","useEffect","ele","addEventListener","removeEventListener","Suspense","fallback"],"mappings":"2kBAeA,MAAMA,EAAYC,EAAIA,MAACC,YAEnB,OAAAC,qBAAA,IAAAA,oBAAA,EAAAA,eAAgBC,IAAI,sBACbC,QAAAC,UAAAC,MAAA,WAAA,OAAAC,EAAAC,QAAO,0BAAwB,IAAEF,MAAMG,GAAWA,EAAOC,WAErDC,mBAAqB,aAEhCC,EAAWA,YAIXC,eAAe,EACfC,MAAO,CACL,iBAAIC,GAIF,OAAOC,iBAAeC,WAAWH,MAAMC,aACxC,EACD,iBAAIA,CAAcG,GAGjB,IAIE,CACLR,QAASS,EAAgB,QACvBC,UAAMC,YAAwB,CAACC,EAAOC,IACpCH,EAAAA,QAAYI,cAAA,aAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAM5BK,EAAUP,EAAK,QAACC,YACpB,EAEIO,SACAC,YACAC,UACAC,UACAC,SACAC,SACAC,QACAC,SACAC,QACAC,SACAC,OACAC,eACAC,cACAC,YACAC,iBACAC,iBACAC,mBACAC,WAEFtB,KAEA,MAAOuB,EAAUC,GAAeC,EAAQA,SAAC,MAE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AAAA,QAAAI,cAAC8C,EAAAA,SAAQ,CAACC,SAAU,MAClBnD,EAAAA,QAACI,cAAAzB,EACC,CAAAmD,UAAWA,EACXtB,OAAQA,EACRuB,QAASA,EACTC,cAAeA,EACf7B,IAAKwB,EACLR,aAAcA,EACdC,YAAaA,EACbC,UAAWA,EACXI,QAASA,EACTH,eAAgBA,EAChBC,eAAgBA,EAChBW,qCACEA,EAEFrB,OAAQA,EAGN,aAAcC,EACd,cAAeC,EACf,YAAaG,EACb,cAAeD,EACf,aAAcD,EACd,qCAAsCiB,EAEtC,wBAAyBT,EACzB,cAAeZ,KAKvB"}
1
+ {"version":3,"file":"Descope.js","sources":["../../../src/components/Descope.tsx"],"sourcesContent":["import React, {\n lazy,\n Suspense,\n useCallback,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\nimport { baseHeaders } from '../constants';\nimport Context from '../hooks/Context';\nimport { DescopeProps } from '../types';\nimport { getGlobalSdk } from '../sdk';\nimport withPropsMapping from './withPropsMapping';\n\n// web-component code uses browser API, but can be used in SSR apps, hence the lazy loading\nconst DescopeWC = lazy(async () => {\n const WebComponent: any =\n customElements?.get('descope-wc') ||\n (await import('@descope/web-component').then((module) => module.default));\n\n WebComponent.sdkConfigOverrides = {\n // Overrides the web-component's base headers to indicate usage via the React SDK\n baseHeaders,\n // Disables token persistence within the web-component to delegate token management\n // to the global SDK hooks. This ensures token handling aligns with the SDK's configuration,\n // and web-component requests leverage the global SDK's beforeRequest hooks for consistency\n persistTokens: false,\n hooks: {\n get beforeRequest() {\n // Retrieves the beforeRequest hook from the global SDK, which is initialized\n // within the AuthProvider using the desired configuration. This approach ensures\n // the web-component utilizes the same beforeRequest hooks as the global SDK\n return getGlobalSdk().httpClient.hooks.beforeRequest;\n },\n set beforeRequest(_) {\n // The empty setter prevents runtime errors when attempts are made to assign a value to 'beforeRequest'.\n // JavaScript objects default to having both getters and setters\n },\n },\n };\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n\t<descope-wc ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst Descope = React.forwardRef<HTMLElement, DescopeProps>(\n (\n {\n flowId,\n onSuccess,\n onError,\n onReady,\n logger,\n tenant,\n theme,\n locale,\n debug,\n client,\n form,\n telemetryKey,\n redirectUrl,\n autoFocus,\n validateOnBlur,\n restartOnError,\n errorTransformer,\n styleId,\n },\n ref,\n ) => {\n const [innerRef, setInnerRef] = useState(null);\n\n useImperativeHandle(ref, () => innerRef);\n\n const {\n projectId,\n baseUrl,\n baseStaticUrl,\n storeLastAuthenticatedUser,\n keepLastAuthenticatedUserAfterLogout,\n sdk,\n } = React.useContext(Context);\n\n const handleSuccess = useCallback(\n async (e: CustomEvent) => {\n // In order to make sure all the after-hooks are running with the success response\n // we are generating a fake response with the success data and calling the http client after hook fn with it\n await sdk.httpClient.hooks.afterRequest(\n {} as any,\n new Response(JSON.stringify(e.detail)),\n );\n if (onSuccess) {\n onSuccess(e);\n }\n },\n [onSuccess],\n );\n\n useEffect(() => {\n const ele = innerRef;\n ele?.addEventListener('success', handleSuccess);\n if (onError) ele?.addEventListener('error', onError);\n if (onReady) ele?.addEventListener('ready', onReady);\n\n return () => {\n if (onError) ele?.removeEventListener('error', onError);\n if (onReady) ele?.removeEventListener('ready', onReady);\n\n ele?.removeEventListener('success', handleSuccess);\n };\n }, [innerRef, onError, handleSuccess]);\n\n // Success event\n useEffect(() => {\n const ele = innerRef;\n ele?.addEventListener('success', handleSuccess);\n return () => {\n ele?.removeEventListener('success', handleSuccess);\n };\n }, [innerRef, handleSuccess]);\n\n // Error event\n useEffect(() => {\n const ele = innerRef;\n if (onError) ele?.addEventListener('error', onError);\n\n return () => {\n if (onError) ele?.removeEventListener('error', onError);\n };\n }, [innerRef, onError]);\n\n // Ready event\n useEffect(() => {\n const ele = innerRef;\n if (onReady) ele?.addEventListener('ready', onReady);\n\n return () => {\n if (onReady) ele?.removeEventListener('error', onReady);\n };\n }, [innerRef, onReady]);\n\n return (\n /**\n * in order to avoid redundant remounting of the WC, we are wrapping it with a form element\n * this workaround is done in order to support webauthn passkeys\n * it can be removed once this issue will be solved\n * https://bugs.chromium.org/p/chromium/issues/detail?id=1404106#c2\n */\n\t<form>\n\t\t<Suspense fallback={null}>\n\t\t\t<DescopeWC\n projectId={projectId}\n flowId={flowId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n ref={setInnerRef}\n telemetryKey={telemetryKey}\n redirectUrl={redirectUrl}\n autoFocus={autoFocus}\n styleId={styleId}\n validateOnBlur={validateOnBlur}\n restartOnError={restartOnError}\n keepLastAuthenticatedUserAfterLogout={\n keepLastAuthenticatedUserAfterLogout\n }\n tenant={tenant}\n {...{\n // attributes\n 'theme.attr': theme,\n 'locale.attr': locale,\n 'form.attr': form,\n 'client.attr': client,\n 'debug.attr': debug,\n 'store-last-authenticated-user.attr': storeLastAuthenticatedUser,\n // props\n 'errorTransformer.prop': errorTransformer,\n 'logger.prop': logger,\n }}\n />\n\t\t</Suspense>\n\t</form>\n );\n },\n);\n\nexport default Descope;\n"],"names":["DescopeWC","lazy","async","customElements","get","Promise","resolve","then","_interopNamespace","require","module","default","sdkConfigOverrides","baseHeaders","persistTokens","hooks","beforeRequest","getGlobalSdk","httpClient","_","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","Descope","flowId","onSuccess","onError","onReady","logger","tenant","theme","locale","debug","client","form","telemetryKey","redirectUrl","autoFocus","validateOnBlur","restartOnError","errorTransformer","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout","sdk","useContext","Context","handleSuccess","useCallback","e","afterRequest","Response","JSON","stringify","detail","useEffect","ele","addEventListener","removeEventListener","Suspense","fallback"],"mappings":"2kBAeA,MAAMA,EAAYC,EAAIA,MAACC,YAEnB,OAAAC,qBAAA,IAAAA,oBAAA,EAAAA,eAAgBC,IAAI,sBACbC,QAAAC,UAAAC,MAAA,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A,WAAU,KACR,MAAMC,EAAMrB,EAEZ,OADAqB,SAAAA,EAAKC,iBAAiB,UAAWV,GAC1B,KACLS,SAAAA,EAAKE,oBAAoB,UAAWX,EAAc,CACnD,GACA,CAACZ,EAAUY,IAGdQ,EAAAA,WAAU,KACR,MAAMC,EAAMrB,EAGZ,OAFIhB,IAASqC,SAAAA,EAAKC,iBAAiB,QAAStC,IAErC,KACDA,IAASqC,SAAAA,EAAKE,oBAAoB,QAASvC,GAAQ,CACxD,GACA,CAACgB,EAAUhB,IAGdoC,EAAAA,WAAU,KACR,MAAMC,EAAMrB,EAGZ,OAFIf,IAASoC,SAAAA,EAAKC,iBAAiB,QAASrC,IAErC,KACDA,IAASoC,SAAAA,EAAKE,oBAAoB,QAAStC,GAAQ,CACxD,GACA,CAACe,EAAUf,IASjBX,UAAAI,cAAA,OAAA,KACCJ,EAAAA,QAAAI,cAAC8C,EAAAA,SAAQ,CAACC,SAAU,MACnBnD,EAAAA,QAACI,cAAAzB,EACQ,CAAAmD,UAAWA,EACXtB,OAAQA,EACRuB,QAASA,EACTC,cAAeA,EACf7B,IAAKwB,EACLR,aAAcA,EACdC,YAAaA,EACbC,UAAWA,EACXI,QAASA,EACTH,eAAgBA,EAChBC,eAAgBA,EAChBW,qCACEA,EAEFrB,OAAQA,EAGN,aAAcC,EACd,cAAeC,EACf,YAAaG,EACb,cAAeD,EACf,aAAcD,EACd,qCAAsCiB,EAEtC,wBAAyBT,EACzB,cAAeZ,KAKvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"UserProfile.js","sources":["../../../src/components/UserProfile.tsx"],"sourcesContent":["import React, {\n lazy,\n Suspense,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\nimport Context from '../hooks/Context';\nimport { UserProfileProps } from '../types';\nimport withPropsMapping from './withPropsMapping';\n\n// web-component code uses browser API, but can be used in SSR apps, hence the lazy loading\nconst UserProfileWC = lazy(async () => {\n await import('@descope/user-profile-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n <descope-user-profile-widget ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst UserProfile = React.forwardRef<HTMLElement, UserProfileProps>(\n ({ logger, theme, debug, widgetId, onLogout, styleId }, ref) => {\n const [innerRef, setInnerRef] = useState(null);\n\n useImperativeHandle(ref, () => innerRef);\n\n const { projectId, baseUrl, baseStaticUrl } = React.useContext(Context);\n\n useEffect(() => {\n if (innerRef && onLogout) {\n innerRef.addEventListener('logout', onLogout);\n return () => innerRef.removeEventListener('logout', onLogout);\n }\n return undefined;\n }, [innerRef, onLogout]);\n\n return (\n <Suspense fallback={null}>\n <UserProfileWC\n projectId={projectId}\n widgetId={widgetId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n styleId={styleId}\n ref={setInnerRef}\n {...{\n // attributes\n 'theme.attr': theme,\n 'debug.attr': debug,\n 'styleId.attr': styleId,\n // props\n 'logger.prop': logger,\n }}\n />\n </Suspense>\n );\n },\n);\n\nexport default UserProfile;\n"],"names":["UserProfileWC","lazy","async","Promise","resolve","then","_interopNamespace","require","default","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","UserProfile","logger","theme","debug","widgetId","onLogout","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","useContext","Context","useEffect","addEventListener","removeEventListener","Suspense","fallback"],"mappings":"uhBAYA,MAAMA,EAAgBC,EAAIA,MAACC,gBACnBC,QAAAC,UAAAC,MAAA,WAAA,OAAAC,EAAAC,QAAO,gCAA8B,IAEpC,CACLC,QAASC,EAAgB,QACvBC,UAAMC,YAAwB,CAACC,EAAOC,IACpCH,EAAAA,QAA6BI,cAAA,8BAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAM7CK,EAAcP,EAAK,QAACC,YACxB,EAAGO,SAAQC,QAAOC,QAAOC,WAAUC,WAAUC,WAAWV,KACtD,MAAOW,EAAUC,GAAeC,EAAQA,SAAC,MAEzCC,sBAAoBd,GAAK,IAAMW,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,GAAkBpB,UAAMqB,WAAWC,EAAAA,SAU/D,OARAC,EAAAA,WAAU,KACR,GAAIT,GAAYF,EAEd,OADAE,EAASU,iBAAiB,SAAUZ,GAC7B,IAAME,EAASW,oBAAoB,SAAUb,EAEtC,GACf,CAACE,EAAUF,IAGZZ,EAAC,QAAAI,cAAAsB,EAAQA,SAAC,CAAAC,SAAU,MAClB3B,EAAC,QAAAI,cAAAd,EACC,CAAA4B,UAAWA,EACXP,SAAUA,EACVQ,QAASA,EACTC,cAAeA,EACfP,QAASA,EACTV,IAAKY,EAGH,aAAcN,EACd,aAAcC,EACd,eAAgBG,EAEhB,cAAeL,IAIrB"}
1
+ {"version":3,"file":"UserProfile.js","sources":["../../../src/components/UserProfile.tsx"],"sourcesContent":["import React, {\n lazy,\n Suspense,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\nimport Context from '../hooks/Context';\nimport { UserProfileProps } from '../types';\nimport withPropsMapping from './withPropsMapping';\n\n// web-component code uses browser API, but can be used in SSR apps, hence the lazy loading\nconst UserProfileWC = lazy(async () => {\n await import('@descope/user-profile-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n\t<descope-user-profile-widget ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst UserProfile = React.forwardRef<HTMLElement, UserProfileProps>(\n ({ logger, theme, debug, widgetId, onLogout, styleId }, ref) => {\n const [innerRef, setInnerRef] = useState(null);\n\n useImperativeHandle(ref, () => innerRef);\n\n const { projectId, baseUrl, baseStaticUrl } = React.useContext(Context);\n\n useEffect(() => {\n if (innerRef && onLogout) {\n innerRef.addEventListener('logout', onLogout);\n return () => innerRef.removeEventListener('logout', onLogout);\n }\n return undefined;\n }, [innerRef, onLogout]);\n\n return (\n\t<Suspense fallback={null}>\n\t\t<UserProfileWC\n projectId={projectId}\n widgetId={widgetId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n styleId={styleId}\n ref={setInnerRef}\n {...{\n // attributes\n 'theme.attr': theme,\n 'debug.attr': debug,\n 'styleId.attr': styleId,\n // props\n 'logger.prop': logger,\n }}\n />\n\t</Suspense>\n );\n },\n);\n\nexport default UserProfile;\n"],"names":["UserProfileWC","lazy","async","Promise","resolve","then","_interopNamespace","require","default","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","UserProfile","logger","theme","debug","widgetId","onLogout","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","useContext","Context","useEffect","addEventListener","removeEventListener","Suspense","fallback"],"mappings":"uhBAYA,MAAMA,EAAgBC,EAAIA,MAACC,gBACnBC,QAAAC,UAAAC,MAAA,WAAA,OAAAC,EAAAC,QAAO,gCAA8B,IAEpC,CACLC,QAASC,EAAgB,QACvBC,UAAMC,YAAwB,CAACC,EAAOC,IAC3CH,EAAAA,QAA6BI,cAAA,8BAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAMtCK,EAAcP,EAAK,QAACC,YACxB,EAAGO,SAAQC,QAAOC,QAAOC,WAAUC,WAAUC,WAAWV,KACtD,MAAOW,EAAUC,GAAeC,EAAQA,SAAC,MAEzCC,sBAAoBd,GAAK,IAAMW,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,GAAkBpB,UAAMqB,WAAWC,EAAAA,SAU/D,OARAC,EAAAA,WAAU,KACR,GAAIT,GAAYF,EAEd,OADAE,EAASU,iBAAiB,SAAUZ,GAC7B,IAAME,EAASW,oBAAoB,SAAUb,EAEtC,GACf,CAACE,EAAUF,IAGjBZ,EAAC,QAAAI,cAAAsB,EAAQA,SAAC,CAAAC,SAAU,MACnB3B,EAAC,QAAAI,cAAAd,EACO,CAAA4B,UAAWA,EACXP,SAAUA,EACVQ,QAASA,EACTC,cAAeA,EACfP,QAASA,EACTV,IAAKY,EAGH,aAAcN,EACd,aAAcC,EACd,eAAgBG,EAEhB,cAAeL,IAIrB"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e="undefined"!=typeof window;exports.IS_BROWSER=e,exports.baseHeaders={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.3.24"};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e="undefined"!=typeof window;exports.IS_BROWSER=e,exports.baseHeaders={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.3.25"};
2
2
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationsPortal.js","sources":["../../../src/components/ApplicationsPortal.tsx"],"sourcesContent":["import React, { lazy, Suspense, useImperativeHandle, useState } from 'react';\nimport Context from '../hooks/Context';\nimport { ApplicationsPortalProps } from '../types';\nimport withPropsMapping from './withPropsMapping';\n\n// web-component code uses browser API, but can be used in SSR apps, hence the lazy loading\nconst ApplicationsPortalWC = lazy(async () => {\n await import('@descope/applications-portal-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n <descope-applications-portal-widget ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst ApplicationsPortal = React.forwardRef<\n HTMLElement,\n ApplicationsPortalProps\n>(({ logger, theme, debug, widgetId, styleId }, ref) => {\n const [innerRef, setInnerRef] = useState(null);\n\n useImperativeHandle(ref, () => innerRef);\n\n const { projectId, baseUrl, baseStaticUrl } = React.useContext(Context);\n\n return (\n <Suspense fallback={null}>\n <ApplicationsPortalWC\n projectId={projectId}\n widgetId={widgetId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n innerRef={setInnerRef}\n {...{\n // attributes\n 'theme.attr': theme,\n 'debug.attr': debug,\n 'styleId.attr': styleId,\n // props\n 'logger.prop': logger,\n }}\n />\n </Suspense>\n );\n});\n\nexport default ApplicationsPortal;\n"],"names":["ApplicationsPortalWC","lazy","async","import","default","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","ApplicationsPortal","logger","theme","debug","widgetId","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","useContext","Context","Suspense","fallback"],"mappings":"mKAMA,MAAMA,EAAuBC,GAAKC,gBAC1BC,OAAO,uCAEN,CACLC,QAASC,EACPC,EAAMC,YAAwB,CAACC,EAAOC,IACpCH,EAAoCI,cAAA,qCAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAMpDK,EAAqBP,EAAMC,YAG/B,EAAGO,SAAQC,QAAOC,QAAOC,WAAUC,WAAWT,KAC9C,MAAOU,EAAUC,GAAeC,EAAS,MAEzCC,EAAoBb,GAAK,IAAMU,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,GAAkBnB,EAAMoB,WAAWC,GAE/D,OACErB,EAACI,cAAAkB,EAAS,CAAAC,SAAU,MAClBvB,EAACI,cAAAV,GACCuB,UAAWA,EACXN,SAAUA,EACVO,QAASA,EACTC,cAAeA,EACfN,SAAUC,EAGR,aAAcL,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeJ,IAIrB"}
1
+ {"version":3,"file":"ApplicationsPortal.js","sources":["../../../src/components/ApplicationsPortal.tsx"],"sourcesContent":["import React, { lazy, Suspense, useImperativeHandle, useState } from 'react';\nimport Context from '../hooks/Context';\nimport { ApplicationsPortalProps } from '../types';\nimport withPropsMapping from './withPropsMapping';\n\n// web-component code uses browser API, but can be used in SSR apps, hence the lazy loading\nconst ApplicationsPortalWC = lazy(async () => {\n await import('@descope/applications-portal-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n\t<descope-applications-portal-widget ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst ApplicationsPortal = React.forwardRef<\n HTMLElement,\n ApplicationsPortalProps\n>(({ logger, theme, debug, widgetId, styleId }, ref) => {\n const [innerRef, setInnerRef] = useState(null);\n\n useImperativeHandle(ref, () => innerRef);\n\n const { projectId, baseUrl, baseStaticUrl } = React.useContext(Context);\n\n return (\n\t<Suspense fallback={null}>\n\t\t<ApplicationsPortalWC\n projectId={projectId}\n widgetId={widgetId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n innerRef={setInnerRef}\n {...{\n // attributes\n 'theme.attr': theme,\n 'debug.attr': debug,\n 'styleId.attr': styleId,\n // props\n 'logger.prop': logger,\n }}\n />\n\t</Suspense>\n );\n});\n\nexport default ApplicationsPortal;\n"],"names":["ApplicationsPortalWC","lazy","async","import","default","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","ApplicationsPortal","logger","theme","debug","widgetId","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","useContext","Context","Suspense","fallback"],"mappings":"mKAMA,MAAMA,EAAuBC,GAAKC,gBAC1BC,OAAO,uCAEN,CACLC,QAASC,EACPC,EAAMC,YAAwB,CAACC,EAAOC,IAC3CH,EAAoCI,cAAA,qCAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAM7CK,EAAqBP,EAAMC,YAG/B,EAAGO,SAAQC,QAAOC,QAAOC,WAAUC,WAAWT,KAC9C,MAAOU,EAAUC,GAAeC,EAAS,MAEzCC,EAAoBb,GAAK,IAAMU,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,GAAkBnB,EAAMoB,WAAWC,GAE/D,OACDrB,EAACI,cAAAkB,EAAS,CAAAC,SAAU,MACnBvB,EAACI,cAAAV,GACKuB,UAAWA,EACXN,SAAUA,EACVO,QAASA,EACTC,cAAeA,EACfN,SAAUC,EAGR,aAAcL,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeJ,IAIrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"Descope.js","sources":["../../../src/components/Descope.tsx"],"sourcesContent":["import React, {\n lazy,\n Suspense,\n useCallback,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\nimport { baseHeaders } from '../constants';\nimport Context from '../hooks/Context';\nimport { DescopeProps } from '../types';\nimport { getGlobalSdk } from '../sdk';\nimport withPropsMapping from './withPropsMapping';\n\n// web-component code uses browser API, but can be used in SSR apps, hence the lazy loading\nconst DescopeWC = lazy(async () => {\n const WebComponent: any =\n customElements?.get('descope-wc') ||\n (await import('@descope/web-component').then((module) => module.default));\n\n WebComponent.sdkConfigOverrides = {\n // Overrides the web-component's base headers to indicate usage via the React SDK\n baseHeaders,\n // Disables token persistence within the web-component to delegate token management\n // to the global SDK hooks. This ensures token handling aligns with the SDK's configuration,\n // and web-component requests leverage the global SDK's beforeRequest hooks for consistency\n persistTokens: false,\n hooks: {\n get beforeRequest() {\n // Retrieves the beforeRequest hook from the global SDK, which is initialized\n // within the AuthProvider using the desired configuration. This approach ensures\n // the web-component utilizes the same beforeRequest hooks as the global SDK\n return getGlobalSdk().httpClient.hooks.beforeRequest;\n },\n set beforeRequest(_) {\n // The empty setter prevents runtime errors when attempts are made to assign a value to 'beforeRequest'.\n // JavaScript objects default to having both getters and setters\n },\n },\n };\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n <descope-wc ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst Descope = React.forwardRef<HTMLElement, DescopeProps>(\n (\n {\n flowId,\n onSuccess,\n onError,\n onReady,\n logger,\n tenant,\n theme,\n locale,\n debug,\n client,\n form,\n telemetryKey,\n redirectUrl,\n autoFocus,\n validateOnBlur,\n restartOnError,\n errorTransformer,\n styleId,\n },\n ref,\n ) => {\n const [innerRef, setInnerRef] = useState(null);\n\n useImperativeHandle(ref, () => innerRef);\n\n const {\n projectId,\n baseUrl,\n baseStaticUrl,\n storeLastAuthenticatedUser,\n keepLastAuthenticatedUserAfterLogout,\n sdk,\n } = React.useContext(Context);\n\n const handleSuccess = useCallback(\n async (e: CustomEvent) => {\n // In order to make sure all the after-hooks are running with the success response\n // we are generating a fake response with the success data and calling the http client after hook fn with it\n await sdk.httpClient.hooks.afterRequest(\n {} as any,\n new Response(JSON.stringify(e.detail)),\n );\n if (onSuccess) {\n onSuccess(e);\n }\n },\n [onSuccess],\n );\n\n useEffect(() => {\n const ele = innerRef;\n ele?.addEventListener('success', handleSuccess);\n if (onError) ele?.addEventListener('error', onError);\n if (onReady) ele?.addEventListener('ready', onReady);\n\n return () => {\n if (onError) ele?.removeEventListener('error', onError);\n if (onReady) ele?.removeEventListener('ready', onReady);\n\n ele?.removeEventListener('success', handleSuccess);\n };\n }, [innerRef, onError, handleSuccess]);\n\n // Success event\n useEffect(() => {\n const ele = innerRef;\n ele?.addEventListener('success', handleSuccess);\n return () => {\n ele?.removeEventListener('success', handleSuccess);\n };\n }, [innerRef, handleSuccess]);\n\n // Error event\n useEffect(() => {\n const ele = innerRef;\n if (onError) ele?.addEventListener('error', onError);\n\n return () => {\n if (onError) ele?.removeEventListener('error', onError);\n };\n }, [innerRef, onError]);\n\n // Ready event\n useEffect(() => {\n const ele = innerRef;\n if (onReady) ele?.addEventListener('ready', onReady);\n\n return () => {\n if (onReady) ele?.removeEventListener('error', onReady);\n };\n }, [innerRef, onReady]);\n\n return (\n /**\n * in order to avoid redundant remounting of the WC, we are wrapping it with a form element\n * this workaround is done in order to support webauthn passkeys\n * it can be removed once this issue will be solved\n * https://bugs.chromium.org/p/chromium/issues/detail?id=1404106#c2\n */\n <form>\n <Suspense fallback={null}>\n <DescopeWC\n projectId={projectId}\n flowId={flowId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n ref={setInnerRef}\n telemetryKey={telemetryKey}\n redirectUrl={redirectUrl}\n autoFocus={autoFocus}\n styleId={styleId}\n validateOnBlur={validateOnBlur}\n restartOnError={restartOnError}\n keepLastAuthenticatedUserAfterLogout={\n keepLastAuthenticatedUserAfterLogout\n }\n tenant={tenant}\n {...{\n // attributes\n 'theme.attr': theme,\n 'locale.attr': locale,\n 'form.attr': form,\n 'client.attr': client,\n 'debug.attr': debug,\n 'store-last-authenticated-user.attr': storeLastAuthenticatedUser,\n // props\n 'errorTransformer.prop': errorTransformer,\n 'logger.prop': logger,\n }}\n />\n </Suspense>\n </form>\n );\n },\n);\n\nexport default Descope;\n"],"names":["DescopeWC","lazy","async","customElements","get","import","then","module","default","sdkConfigOverrides","baseHeaders","persistTokens","hooks","beforeRequest","getGlobalSdk","httpClient","_","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","Descope","flowId","onSuccess","onError","onReady","logger","tenant","theme","locale","debug","client","form","telemetryKey","redirectUrl","autoFocus","validateOnBlur","restartOnError","errorTransformer","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout","sdk","useContext","Context","handleSuccess","useCallback","e","afterRequest","Response","JSON","stringify","detail","useEffect","ele","addEventListener","removeEventListener","Suspense","fallback"],"mappings":"0RAeA,MAAMA,EAAYC,GAAKC,YAEnB,OAAAC,qBAAA,IAAAA,oBAAA,EAAAA,eAAgBC,IAAI,sBACbC,OAAO,0BAA0BC,MAAMC,GAAWA,EAAOC,WAErDC,mBAAqB,CAEhCC,cAIAC,eAAe,EACfC,MAAO,CACL,iBAAIC,GAIF,OAAOC,IAAeC,WAAWH,MAAMC,aACxC,EACD,iBAAIA,CAAcG,GAGjB,IAIE,CACLR,QAASS,EACPC,EAAMC,YAAwB,CAACC,EAAOC,IACpCH,EAAYI,cAAA,aAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAM5BK,EAAUP,EAAMC,YACpB,EAEIO,SACAC,YACAC,UACAC,UACAC,SACAC,SACAC,QACAC,SACAC,QACAC,SACAC,OACAC,eACAC,cACAC,YACAC,iBACAC,iBACAC,mBACAC,WAEFtB,KAEA,MAAOuB,EAAUC,GAAeC,EAAS,MAEzCC,EAAoB1B,GAAK,IAAMuB,IAE/B,MAAMI,UACJA,EAASC,QACTA,EAAOC,cACPA,EAAaC,2BACbA,EAA0BC,qCAC1BA,EAAoCC,IACpCA,GACEnC,EAAMoC,WAAWC,GAEfC,EAAgBC,GACpBvD,MA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AChBW,qCACEA,EAEFrB,OAAQA,EAGN,aAAcC,EACd,cAAeC,EACf,YAAaG,EACb,cAAeD,EACf,aAAcD,EACd,qCAAsCiB,EAEtC,wBAAyBT,EACzB,cAAeZ,KAKvB"}
1
+ {"version":3,"file":"Descope.js","sources":["../../../src/components/Descope.tsx"],"sourcesContent":["import React, {\n lazy,\n Suspense,\n useCallback,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\nimport { baseHeaders } from '../constants';\nimport Context from '../hooks/Context';\nimport { DescopeProps } from '../types';\nimport { getGlobalSdk } from '../sdk';\nimport withPropsMapping from './withPropsMapping';\n\n// web-component code uses browser API, but can be used in SSR apps, hence the lazy loading\nconst DescopeWC = lazy(async () => {\n const WebComponent: any =\n customElements?.get('descope-wc') ||\n (await import('@descope/web-component').then((module) => module.default));\n\n WebComponent.sdkConfigOverrides = {\n // Overrides the web-component's base headers to indicate usage via the React SDK\n baseHeaders,\n // Disables token persistence within the web-component to delegate token management\n // to the global SDK hooks. This ensures token handling aligns with the SDK's configuration,\n // and web-component requests leverage the global SDK's beforeRequest hooks for consistency\n persistTokens: false,\n hooks: {\n get beforeRequest() {\n // Retrieves the beforeRequest hook from the global SDK, which is initialized\n // within the AuthProvider using the desired configuration. This approach ensures\n // the web-component utilizes the same beforeRequest hooks as the global SDK\n return getGlobalSdk().httpClient.hooks.beforeRequest;\n },\n set beforeRequest(_) {\n // The empty setter prevents runtime errors when attempts are made to assign a value to 'beforeRequest'.\n // JavaScript objects default to having both getters and setters\n },\n },\n };\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n\t<descope-wc ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst Descope = React.forwardRef<HTMLElement, DescopeProps>(\n (\n {\n flowId,\n onSuccess,\n onError,\n onReady,\n logger,\n tenant,\n theme,\n locale,\n debug,\n client,\n form,\n telemetryKey,\n redirectUrl,\n autoFocus,\n validateOnBlur,\n restartOnError,\n errorTransformer,\n styleId,\n },\n ref,\n ) => {\n const [innerRef, setInnerRef] = useState(null);\n\n useImperativeHandle(ref, () => innerRef);\n\n const {\n projectId,\n baseUrl,\n baseStaticUrl,\n storeLastAuthenticatedUser,\n keepLastAuthenticatedUserAfterLogout,\n sdk,\n } = React.useContext(Context);\n\n const handleSuccess = useCallback(\n async (e: CustomEvent) => {\n // In order to make sure all the after-hooks are running with the success response\n // we are generating a fake response with the success data and calling the http client after hook fn with it\n await sdk.httpClient.hooks.afterRequest(\n {} as any,\n new Response(JSON.stringify(e.detail)),\n );\n if (onSuccess) {\n onSuccess(e);\n }\n },\n [onSuccess],\n );\n\n useEffect(() => {\n const ele = innerRef;\n ele?.addEventListener('success', handleSuccess);\n if (onError) ele?.addEventListener('error', onError);\n if (onReady) ele?.addEventListener('ready', onReady);\n\n return () => {\n if (onError) ele?.removeEventListener('error', onError);\n if (onReady) ele?.removeEventListener('ready', onReady);\n\n ele?.removeEventListener('success', handleSuccess);\n };\n }, [innerRef, onError, handleSuccess]);\n\n // Success event\n useEffect(() => {\n const ele = innerRef;\n ele?.addEventListener('success', handleSuccess);\n return () => {\n ele?.removeEventListener('success', handleSuccess);\n };\n }, [innerRef, handleSuccess]);\n\n // Error event\n useEffect(() => {\n const ele = innerRef;\n if (onError) ele?.addEventListener('error', onError);\n\n return () => {\n if (onError) ele?.removeEventListener('error', onError);\n };\n }, [innerRef, onError]);\n\n // Ready event\n useEffect(() => {\n const ele = innerRef;\n if (onReady) ele?.addEventListener('ready', onReady);\n\n return () => {\n if (onReady) ele?.removeEventListener('error', onReady);\n };\n }, [innerRef, onReady]);\n\n return (\n /**\n * in order to avoid redundant remounting of the WC, we are wrapping it with a form element\n * this workaround is done in order to support webauthn passkeys\n * it can be removed once this issue will be solved\n * https://bugs.chromium.org/p/chromium/issues/detail?id=1404106#c2\n */\n\t<form>\n\t\t<Suspense fallback={null}>\n\t\t\t<DescopeWC\n projectId={projectId}\n flowId={flowId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n ref={setInnerRef}\n telemetryKey={telemetryKey}\n redirectUrl={redirectUrl}\n autoFocus={autoFocus}\n styleId={styleId}\n validateOnBlur={validateOnBlur}\n restartOnError={restartOnError}\n keepLastAuthenticatedUserAfterLogout={\n keepLastAuthenticatedUserAfterLogout\n }\n tenant={tenant}\n {...{\n // attributes\n 'theme.attr': theme,\n 'locale.attr': locale,\n 'form.attr': form,\n 'client.attr': client,\n 'debug.attr': debug,\n 'store-last-authenticated-user.attr': storeLastAuthenticatedUser,\n // props\n 'errorTransformer.prop': errorTransformer,\n 'logger.prop': logger,\n }}\n />\n\t\t</Suspense>\n\t</form>\n );\n },\n);\n\nexport default Descope;\n"],"names":["DescopeWC","lazy","async","customElements","get","import","then","module","default","sdkConfigOverrides","baseHeaders","persistTokens","hooks","beforeRequest","getGlobalSdk","httpClient","_","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","Descope","flowId","onSuccess","onError","onReady","logger","tenant","theme","locale","debug","client","form","telemetryKey","redirectUrl","autoFocus","validateOnBlur","restartOnError","errorTransformer","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout","sdk","useContext","Context","handleSuccess","useCallback","e","afterRequest","Response","JSON","stringify","detail","useEffect","ele","addEventListener","removeEventListener","Suspense","fallback"],"mappings":"0RAeA,MAAMA,EAAYC,GAAKC,YAEnB,OAAAC,qBAAA,IAAAA,oBAAA,EAAAA,eAAgBC,IAAI,sBACbC,OAAO,0BAA0BC,MAAMC,GAAWA,EAAOC,WAErDC,mBAAqB,CAEhCC,cAIAC,eAAe,EACfC,MAAO,CACL,iBAAIC,GAIF,OAAOC,IAAeC,WAAWH,MAAMC,aACxC,EACD,iBAAIA,CAAcG,GAGjB,IAIE,CACLR,QAASS,EACPC,EAAMC,YAAwB,CAACC,EAAOC,IAC3CH,EAAYI,cAAA,aAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WA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AAA,EAAKC,iBAAiB,QAASrC,IAErC,KACDA,IAASoC,SAAAA,EAAKE,oBAAoB,QAAStC,GAAQ,CACxD,GACA,CAACe,EAAUf,IASjBX,EAAAI,cAAA,OAAA,KACCJ,EAAAI,cAAC8C,EAAQ,CAACC,SAAU,MACnBnD,EAACI,cAAAtB,EACQ,CAAAgD,UAAWA,EACXtB,OAAQA,EACRuB,QAASA,EACTC,cAAeA,EACf7B,IAAKwB,EACLR,aAAcA,EACdC,YAAaA,EACbC,UAAWA,EACXI,QAASA,EACTH,eAAgBA,EAChBC,eAAgBA,EAChBW,qCACEA,EAEFrB,OAAQA,EAGN,aAAcC,EACd,cAAeC,EACf,YAAaG,EACb,cAAeD,EACf,aAAcD,EACd,qCAAsCiB,EAEtC,wBAAyBT,EACzB,cAAeZ,KAKvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"UserProfile.js","sources":["../../../src/components/UserProfile.tsx"],"sourcesContent":["import React, {\n lazy,\n Suspense,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\nimport Context from '../hooks/Context';\nimport { UserProfileProps } from '../types';\nimport withPropsMapping from './withPropsMapping';\n\n// web-component code uses browser API, but can be used in SSR apps, hence the lazy loading\nconst UserProfileWC = lazy(async () => {\n await import('@descope/user-profile-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n <descope-user-profile-widget ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst UserProfile = React.forwardRef<HTMLElement, UserProfileProps>(\n ({ logger, theme, debug, widgetId, onLogout, styleId }, ref) => {\n const [innerRef, setInnerRef] = useState(null);\n\n useImperativeHandle(ref, () => innerRef);\n\n const { projectId, baseUrl, baseStaticUrl } = React.useContext(Context);\n\n useEffect(() => {\n if (innerRef && onLogout) {\n innerRef.addEventListener('logout', onLogout);\n return () => innerRef.removeEventListener('logout', onLogout);\n }\n return undefined;\n }, [innerRef, onLogout]);\n\n return (\n <Suspense fallback={null}>\n <UserProfileWC\n projectId={projectId}\n widgetId={widgetId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n styleId={styleId}\n ref={setInnerRef}\n {...{\n // attributes\n 'theme.attr': theme,\n 'debug.attr': debug,\n 'styleId.attr': styleId,\n // props\n 'logger.prop': logger,\n }}\n />\n </Suspense>\n );\n },\n);\n\nexport default UserProfile;\n"],"names":["UserProfileWC","lazy","async","import","default","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","UserProfile","logger","theme","debug","widgetId","onLogout","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","useContext","Context","useEffect","addEventListener","removeEventListener","Suspense","fallback"],"mappings":"kLAYA,MAAMA,EAAgBC,GAAKC,gBACnBC,OAAO,gCAEN,CACLC,QAASC,EACPC,EAAMC,YAAwB,CAACC,EAAOC,IACpCH,EAA6BI,cAAA,8BAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAM7CK,EAAcP,EAAMC,YACxB,EAAGO,SAAQC,QAAOC,QAAOC,WAAUC,WAAUC,WAAWV,KACtD,MAAOW,EAAUC,GAAeC,EAAS,MAEzCC,EAAoBd,GAAK,IAAMW,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,GAAkBpB,EAAMqB,WAAWC,GAU/D,OARAC,GAAU,KACR,GAAIT,GAAYF,EAEd,OADAE,EAASU,iBAAiB,SAAUZ,GAC7B,IAAME,EAASW,oBAAoB,SAAUb,EAEtC,GACf,CAACE,EAAUF,IAGZZ,EAACI,cAAAsB,EAAS,CAAAC,SAAU,MAClB3B,EAACI,cAAAV,EACC,CAAAwB,UAAWA,EACXP,SAAUA,EACVQ,QAASA,EACTC,cAAeA,EACfP,QAASA,EACTV,IAAKY,EAGH,aAAcN,EACd,aAAcC,EACd,eAAgBG,EAEhB,cAAeL,IAIrB"}
1
+ {"version":3,"file":"UserProfile.js","sources":["../../../src/components/UserProfile.tsx"],"sourcesContent":["import React, {\n lazy,\n Suspense,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\nimport Context from '../hooks/Context';\nimport { UserProfileProps } from '../types';\nimport withPropsMapping from './withPropsMapping';\n\n// web-component code uses browser API, but can be used in SSR apps, hence the lazy loading\nconst UserProfileWC = lazy(async () => {\n await import('@descope/user-profile-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n\t<descope-user-profile-widget ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst UserProfile = React.forwardRef<HTMLElement, UserProfileProps>(\n ({ logger, theme, debug, widgetId, onLogout, styleId }, ref) => {\n const [innerRef, setInnerRef] = useState(null);\n\n useImperativeHandle(ref, () => innerRef);\n\n const { projectId, baseUrl, baseStaticUrl } = React.useContext(Context);\n\n useEffect(() => {\n if (innerRef && onLogout) {\n innerRef.addEventListener('logout', onLogout);\n return () => innerRef.removeEventListener('logout', onLogout);\n }\n return undefined;\n }, [innerRef, onLogout]);\n\n return (\n\t<Suspense fallback={null}>\n\t\t<UserProfileWC\n projectId={projectId}\n widgetId={widgetId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n styleId={styleId}\n ref={setInnerRef}\n {...{\n // attributes\n 'theme.attr': theme,\n 'debug.attr': debug,\n 'styleId.attr': styleId,\n // props\n 'logger.prop': logger,\n }}\n />\n\t</Suspense>\n );\n },\n);\n\nexport default UserProfile;\n"],"names":["UserProfileWC","lazy","async","import","default","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","UserProfile","logger","theme","debug","widgetId","onLogout","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","useContext","Context","useEffect","addEventListener","removeEventListener","Suspense","fallback"],"mappings":"kLAYA,MAAMA,EAAgBC,GAAKC,gBACnBC,OAAO,gCAEN,CACLC,QAASC,EACPC,EAAMC,YAAwB,CAACC,EAAOC,IAC3CH,EAA6BI,cAAA,8BAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAMtCK,EAAcP,EAAMC,YACxB,EAAGO,SAAQC,QAAOC,QAAOC,WAAUC,WAAUC,WAAWV,KACtD,MAAOW,EAAUC,GAAeC,EAAS,MAEzCC,EAAoBd,GAAK,IAAMW,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,GAAkBpB,EAAMqB,WAAWC,GAU/D,OARAC,GAAU,KACR,GAAIT,GAAYF,EAEd,OADAE,EAASU,iBAAiB,SAAUZ,GAC7B,IAAME,EAASW,oBAAoB,SAAUb,EAEtC,GACf,CAACE,EAAUF,IAGjBZ,EAACI,cAAAsB,EAAS,CAAAC,SAAU,MACnB3B,EAACI,cAAAV,EACO,CAAAwB,UAAWA,EACXP,SAAUA,EACVQ,QAASA,EACTC,cAAeA,EACfP,QAASA,EACTV,IAAKY,EAGH,aAAcN,EACd,aAAcC,EACd,eAAgBG,EAEhB,cAAeL,IAIrB"}
@@ -1,2 +1,2 @@
1
- const e={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.3.24"},d="undefined"!=typeof window;export{d as IS_BROWSER,e as baseHeaders};
1
+ const e={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.3.25"},d="undefined"!=typeof window;export{d as IS_BROWSER,e as baseHeaders};
2
2
  //# sourceMappingURL=constants.js.map