@descope/react-sdk 2.3.5 → 2.3.7

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.
Files changed (50) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/components/AccessKeyManagement.js +1 -1
  3. package/dist/cjs/components/AccessKeyManagement.js.map +1 -1
  4. package/dist/cjs/components/ApplicationsPortal.js +1 -1
  5. package/dist/cjs/components/ApplicationsPortal.js.map +1 -1
  6. package/dist/cjs/components/AuditManagement.js +1 -1
  7. package/dist/cjs/components/AuditManagement.js.map +1 -1
  8. package/dist/cjs/components/AuthProvider/AuthProvider.js.map +1 -1
  9. package/dist/cjs/components/Descope.js +1 -1
  10. package/dist/cjs/components/Descope.js.map +1 -1
  11. package/dist/cjs/components/RoleManagement.js +1 -1
  12. package/dist/cjs/components/RoleManagement.js.map +1 -1
  13. package/dist/cjs/components/UserManagement.js +1 -1
  14. package/dist/cjs/components/UserManagement.js.map +1 -1
  15. package/dist/cjs/components/UserProfile.js +1 -1
  16. package/dist/cjs/components/UserProfile.js.map +1 -1
  17. package/dist/cjs/components/withPropsMapping/index.js +2 -0
  18. package/dist/cjs/components/withPropsMapping/index.js.map +1 -0
  19. package/dist/cjs/components/withPropsMapping/utils.js +2 -0
  20. package/dist/cjs/components/withPropsMapping/utils.js.map +1 -0
  21. package/dist/cjs/constants.js +1 -1
  22. package/dist/esm/components/AccessKeyManagement.js +1 -1
  23. package/dist/esm/components/AccessKeyManagement.js.map +1 -1
  24. package/dist/esm/components/ApplicationsPortal.js +1 -1
  25. package/dist/esm/components/ApplicationsPortal.js.map +1 -1
  26. package/dist/esm/components/AuditManagement.js +1 -1
  27. package/dist/esm/components/AuditManagement.js.map +1 -1
  28. package/dist/esm/components/AuthProvider/AuthProvider.js.map +1 -1
  29. package/dist/esm/components/Descope.js +1 -1
  30. package/dist/esm/components/Descope.js.map +1 -1
  31. package/dist/esm/components/RoleManagement.js +1 -1
  32. package/dist/esm/components/RoleManagement.js.map +1 -1
  33. package/dist/esm/components/UserManagement.js +1 -1
  34. package/dist/esm/components/UserManagement.js.map +1 -1
  35. package/dist/esm/components/UserProfile.js +1 -1
  36. package/dist/esm/components/UserProfile.js.map +1 -1
  37. package/dist/esm/components/withPropsMapping/index.js +2 -0
  38. package/dist/esm/components/withPropsMapping/index.js.map +1 -0
  39. package/dist/esm/components/withPropsMapping/utils.js +2 -0
  40. package/dist/esm/components/withPropsMapping/utils.js.map +1 -0
  41. package/dist/esm/constants.js +1 -1
  42. package/dist/index.d.ts +7 -5
  43. package/dist/index.umd.js +2 -2
  44. package/dist/index.umd.js.map +1 -1
  45. package/dist/types/components/AuthProvider/AuthProvider.d.ts +2 -2
  46. package/dist/types/components/withPropsMapping/index.d.ts +15 -0
  47. package/dist/types/components/withPropsMapping/utils.d.ts +5 -0
  48. package/dist/types/sdk.d.ts +12 -6
  49. package/dist/types/types.d.ts +2 -2
  50. package/package.json +12 -11
@@ -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 useMemo,\n useState,\n} from 'react';\nimport { baseHeaders } from '../constants';\nimport Context from '../hooks/Context';\nimport { DescopeProps } from '../types';\nimport { getGlobalSdk } from '../sdk';\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 module = await import('@descope/web-component');\n module.default.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: ({\n projectId,\n flowId,\n baseUrl,\n baseStaticUrl,\n innerRef,\n tenant,\n theme,\n locale,\n debug,\n redirectUrl,\n client,\n form,\n styleId,\n autoFocus,\n validateOnBlur,\n restartOnError,\n storeLastAuthenticatedUser,\n }) => (\n\t<descope-wc\n project-id={projectId}\n flow-id={flowId}\n base-url={baseUrl}\n base-static-url={baseStaticUrl}\n ref={innerRef}\n tenant={tenant}\n theme={theme}\n locale={locale}\n debug={debug}\n client={client}\n form={form}\n style-id={styleId}\n redirect-url={redirectUrl}\n auto-focus={autoFocus}\n validate-on-blur={validateOnBlur}\n restart-on-error={restartOnError}\n store-last-authenticated-user={storeLastAuthenticatedUser}\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 useEffect(() => {\n if (innerRef) {\n innerRef.errorTransformer = errorTransformer;\n }\n }, [innerRef, errorTransformer]);\n\n useEffect(() => {\n if (innerRef && logger) {\n innerRef.logger = logger;\n }\n }, [innerRef, logger]);\n\n const { form: stringifiedForm, client: stringifiedClient } = useMemo(\n () => ({\n form: JSON.stringify(form || {}),\n client: JSON.stringify(client || {}),\n }),\n [form, client],\n );\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 innerRef={setInnerRef}\n tenant={tenant}\n theme={theme}\n locale={locale}\n debug={debug}\n form={stringifiedForm}\n client={stringifiedClient}\n telemetryKey={telemetryKey}\n redirectUrl={redirectUrl}\n autoFocus={autoFocus}\n styleId={styleId}\n validateOnBlur={validateOnBlur}\n restartOnError={restartOnError}\n storeLastAuthenticatedUser={storeLastAuthenticatedUser}\n keepLastAuthenticatedUserAfterLogout={\n keepLastAuthenticatedUserAfterLogout\n }\n />\n\t\t</Suspense>\n\t</form>\n );\n },\n);\n\nexport default Descope;\n"],"names":["DescopeWC","lazy","async","import","default","sdkConfigOverrides","baseHeaders","persistTokens","hooks","beforeRequest","getGlobalSdk","httpClient","_","projectId","flowId","baseUrl","baseStaticUrl","innerRef","tenant","theme","locale","debug","redirectUrl","client","form","styleId","autoFocus","validateOnBlur","restartOnError","storeLastAuthenticatedUser","React","createElement","ref","Descope","forwardRef","onSuccess","onError","onReady","logger","telemetryKey","errorTransformer","setInnerRef","useState","useImperativeHandle","keepLastAuthenticatedUserAfterLogout","sdk","useContext","Context","handleSuccess","useCallback","e","afterRequest","Response","JSON","stringify","detail","useEffect","ele","addEventListener","removeEventListener","stringifiedForm","stringifiedClient","useMemo","Suspense","fallback"],"mappings":"4PAeA,MAAMA,EAAYC,GAAKC,iBACAC,OAAO,2BACrBC,QAAQC,mBAAqB,CAElCC,cAIAC,eAAe,EACfC,MAAO,CACL,iBAAIC,GAIF,OAAOC,IAAeC,WAAWH,MAAMC,aACxC,EACD,iBAAIA,CAAcG,GAGjB,IAIE,CACLR,QAAS,EACPS,YACAC,SACAC,UACAC,gBACAC,WACAC,SACAC,QACAC,SACAC,QACAC,cACAC,SACAC,OACAC,UACAC,YACAC,iBACAC,iBACAC,gCAELC,EAAAC,cAAA,aAAA,CAAA,aACmBlB,EACH,UAAAC,EACC,WAAAC,oBACOC,EACjBgB,IAAKf,EACLC,OAAQA,EACRC,MAAOA,EACPC,OAAQA,EACRC,MAAOA,EACPE,OAAQA,EACRC,KAAMA,aACIC,EAAO,eACHH,EACF,aAAAI,qBACMC,EAAc,mBACdC,EACa,gCAAAC,QAMjCI,EAAUH,EAAMI,YACpB,EAEIpB,SACAqB,YACAC,UACAC,UACAC,SACApB,SACAC,QACAC,SACAC,QACAE,SACAC,OACAe,eACAjB,cACAI,YACAC,iBACAC,iBACAY,mBACAf,WAEFO,KAEA,MAAOf,EAAUwB,GAAeC,EAAS,MAEzCC,EAAoBX,GAAK,IAAMf,IAE/B,MAAMJ,UACJA,EAASE,QACTA,EAAOC,cACPA,EAAaa,2BACbA,EAA0Be,qCAC1BA,EAAoCC,IACpCA,GACEf,EAAMgB,WAAWC,GAEfC,EAAgBC,GACpB/C,MAAOgD,UAGCL,EAAIlC,WAAWH,MAAM2C,aACzB,CAAA,EACA,IAAIC,SAASC,KAAKC,UAAUJ,EAAEK,UAE5BpB,GACFA,EAAUe,EACX,GAEH,CAACf,IAGHqB,GAAU,KACR,MAAMC,EAAMxC,EAKZ,OAJAwC,SAAAA,EAAKC,iBAAiB,UAAWV,GAC7BZ,IAASqB,SAAAA,EAAKC,iBAAiB,QAAStB,IACxCC,IAASoB,SAAAA,EAAKC,iBAAiB,QAASrB,IAErC,KACDD,IAASqB,SAAAA,EAAKE,oBAAoB,QAASvB,IAC3CC,IAASoB,SAAAA,EAAKE,oBAAoB,QAAStB,IAE/CoB,SAAAA,EAAKE,oBAAoB,UAAWX,EAAc,CACnD,GACA,CAAC/B,EAAUmB,EAASY,IAGvBQ,GAAU,KACR,MAAMC,EAAMxC,EAEZ,OADAwC,SAAAA,EAAKC,iBAAiB,UAAWV,GAC1B,KACLS,SAAAA,EAAKE,oBAAoB,UAAWX,EAAc,CACnD,GACA,CAAC/B,EAAU+B,IAGdQ,GAAU,KACR,MAAMC,EAAMxC,EAGZ,OAFImB,IAASqB,SAAAA,EAAKC,iBAAiB,QAAStB,IAErC,KACDA,IAASqB,SAAAA,EAAKE,oBAAoB,QAASvB,GAAQ,CACxD,GACA,CAACnB,EAAUmB,IAGdoB,GAAU,KACR,MAAMC,EAAMxC,EAGZ,OAFIoB,IAASoB,SAAAA,EAAKC,iBAAiB,QAASrB,IAErC,KACDA,IAASoB,SAAAA,EAAKE,oBAAoB,QAAStB,GAAQ,CACxD,GACA,CAACpB,EAAUoB,IAEdmB,GAAU,KACJvC,IACFA,EAASuB,iBAAmBA,EAC7B,GACA,CAACvB,EAAUuB,IAEdgB,GAAU,KACJvC,GAAYqB,IACdrB,EAASqB,OAASA,EACnB,GACA,CAACrB,EAAUqB,IAEd,MAAQd,KAAMoC,EAAiBrC,OAAQsC,GAAsBC,GAC3D,KAAO,CACLtC,KAAM6B,KAAKC,UAAU9B,GAAQ,CAAA,GAC7BD,OAAQ8B,KAAKC,UAAU/B,GAAU,CAAA,MAEnC,CAACC,EAAMD,IAGT,OAOHO,EAAAC,cAAA,OAAA,KACCD,EAAAC,cAACgC,EAAQ,CAACC,SAAU,MACnBlC,EAAAC,cAAC/B,EACQ,CAAAa,UAAWA,EACXC,OAAQA,EACRC,QAASA,EACTC,cAAeA,EACfC,SAAUwB,EACVvB,OAAQA,EACRC,MAAOA,EACPC,OAAQA,EACRC,MAAOA,EACPG,KAAMoC,EACNrC,OAAQsC,EACRtB,aAAcA,EACdjB,YAAaA,EACbI,UAAWA,EACXD,QAASA,EACTE,eAAgBA,EAChBC,eAAgBA,EAChBC,2BAA4BA,EAC5Be,qCACEA,KAKR"}
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 {...{\n // attributes\n 'tenant.attr': tenant,\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,MAAOwD,UAGCL,EAAItC,WAAWH,MAAM+C,aACzB,CAAA,EACA,IAAIC,SAASC,KAAKC,UAAUJ,EAAEK,UAE5BpC,GACFA,EAAU+B,EACX,GAEH,CAAC/B,IA8CH,OA3CAqC,GAAU,KACR,MAAMC,EAAMrB,EAKZ,OAJAqB,SAAAA,EAAKC,iBAAiB,UAAWV,GAC7B5B,IAASqC,SAAAA,EAAKC,iBAAiB,QAAStC,IACxCC,IAASoC,SAAAA,EAAKC,iBAAiB,QAASrC,IAErC,KACDD,IAASqC,SAAAA,EAAKE,oBAAoB,QAASvC,IAC3CC,IAASoC,SAAAA,EAAKE,oBAAoB,QAAStC,IAE/CoC,SAAAA,EAAKE,oBAAoB,UAAWX,EAAc,CACnD,GACA,CAACZ,EAAUhB,EAAS4B,IAGvBQ,GAAU,KACR,MAAMC,EAAMrB,EAEZ,OADAqB,SAAAA,EAAKC,iBAAiB,UAAWV,GAC1B,KACLS,SAAAA,EAAKE,oBAAoB,UAAWX,EAAc,CACnD,GACA,CAACZ,EAAUY,IAGdQ,GAAU,KACR,MAAMC,EAAMrB,EAGZ,OAFIhB,IAASqC,SAAAA,EAAKC,iBAAiB,QAAStC,IAErC,KACDA,IAASqC,SAAAA,EAAKE,oBAAoB,QAASvC,GAAQ,CACxD,GACA,CAACgB,EAAUhB,IAGdoC,GAAU,KACR,MAAMC,EAAMrB,EAGZ,OAFIf,IAASoC,SAAAA,EAAKC,iBAAiB,QAASrC,IAErC,KACDA,IAASoC,SAAAA,EAAKE,oBAAoB,QAAStC,GAAQ,CACxD,GACA,CAACe,EAAUf,IASZX,EAAAI,cAAA,OAAA,KACEJ,EAAAI,cAAC8C,EAAQ,CAACC,SAAU,MAClBnD,EAACI,cAAAtB,GACCgD,UAAWA,EACXtB,OAAQA,EACRuB,QAASA,EACTC,cAAeA,EACf7B,IAAKwB,EACLR,aAAcA,EACdC,YAAaA,EACbC,UAAWA,EACXI,QAASA,EACTH,eAAgBA,EAChBC,eAAgBA,EAChBW,qCACEA,EAIA,cAAerB,EACf,aAAcC,EACd,cAAeC,EACf,YAAaG,EACb,cAAeD,EACf,aAAcD,EACd,qCAAsCiB,EAEtC,wBAAyBT,EACzB,cAAeZ,KAKvB"}
@@ -1,2 +1,2 @@
1
- import e,{lazy as t,useState as a,useImperativeHandle as r,useEffect as n,Suspense as d}from"react";import l from"../hooks/Context.js";const o=t((async()=>(await import("@descope/role-management-widget"),{default:({projectId:t,baseUrl:a,baseStaticUrl:r,innerRef:n,tenant:d,widgetId:l,theme:o,debug:s,styleId:c})=>e.createElement("descope-role-management-widget",{"project-id":t,"widget-id":l,"base-url":a,"base-static-url":r,theme:o,tenant:d,debug:s,"style-id":c,ref:n})}))),s=e.forwardRef((({logger:t,tenant:s,theme:c,debug:i,widgetId:g,styleId:m},b)=>{const[u,f]=a(null);r(b,(()=>u));const{projectId:p,baseUrl:I,baseStaticUrl:w}=e.useContext(l);return n((()=>{u&&t&&(u.logger=t)}),[u,t]),e.createElement(d,{fallback:null},e.createElement(o,{projectId:p,widgetId:g,baseUrl:I,baseStaticUrl:w,innerRef:f,tenant:s,theme:c,styleId:m,debug:i}))}));export{s as default};
1
+ import e,{lazy as t,useState as r,useImperativeHandle as a,Suspense as o}from"react";import n from"../hooks/Context.js";import l from"./withPropsMapping/index.js";const s=t((async()=>(await import("@descope/role-management-widget"),{default:l(e.forwardRef(((t,r)=>e.createElement("descope-role-management-widget",Object.assign({ref:r},t)))))}))),d=e.forwardRef((({logger:t,tenant:l,theme:d,debug:c,widgetId:i,styleId:m},g)=>{const[p,f]=r(null);a(g,(()=>p));const{projectId:b,baseUrl:u,baseStaticUrl:w}=e.useContext(n);return e.createElement(o,{fallback:null},e.createElement(s,{projectId:b,widgetId:i,baseUrl:u,baseStaticUrl:w,innerRef:f,"tenant.attr":l,"theme.attr":d,"debug.attr":c,"styleId.attr":m,"logger.prop":t}))}));export{d as default};
2
2
  //# sourceMappingURL=RoleManagement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RoleManagement.js","sources":["../../../src/components/RoleManagement.tsx"],"sourcesContent":["import React, {\n lazy,\n Suspense,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\nimport Context from '../hooks/Context';\nimport { RoleManagementProps } from '../types';\n\n// web-component code uses browser API, but can be used in SSR apps, hence the lazy loading\nconst RoleManagementWC = lazy(async () => {\n await import('@descope/role-management-widget');\n\n return {\n default: ({\n projectId,\n baseUrl,\n baseStaticUrl,\n innerRef,\n tenant,\n widgetId,\n theme,\n debug,\n styleId,\n }) => (\n\t<descope-role-management-widget\n project-id={projectId}\n widget-id={widgetId}\n base-url={baseUrl}\n base-static-url={baseStaticUrl}\n theme={theme}\n tenant={tenant}\n debug={debug}\n style-id={styleId}\n ref={innerRef}\n />\n ),\n };\n});\n\nconst RoleManagement = React.forwardRef<HTMLElement, RoleManagementProps>(\n ({ logger, tenant, 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 useEffect(() => {\n if (innerRef && logger) {\n innerRef.logger = logger;\n }\n }, [innerRef, logger]);\n\n return (\n\t<Suspense fallback={null}>\n\t\t<RoleManagementWC\n projectId={projectId}\n widgetId={widgetId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n innerRef={setInnerRef}\n tenant={tenant}\n theme={theme}\n styleId={styleId}\n debug={debug}\n />\n\t</Suspense>\n );\n },\n);\n\nexport default RoleManagement;\n"],"names":["RoleManagementWC","lazy","async","import","default","projectId","baseUrl","baseStaticUrl","innerRef","tenant","widgetId","theme","debug","styleId","React","createElement","ref","RoleManagement","forwardRef","logger","setInnerRef","useState","useImperativeHandle","useContext","Context","useEffect","Suspense","fallback"],"mappings":"uIAWA,MAAMA,EAAmBC,GAAKC,gBACtBC,OAAO,mCAEN,CACLC,QAAS,EACPC,YACAC,UACAC,gBACAC,WACAC,SACAC,WACAC,QACAC,QACAC,aAELC,EAAAC,cAAA,iCAAA,CAAA,aACmBV,EACD,YAAAK,EACD,WAAAJ,EACO,kBAAAC,EACjBI,MAAOA,EACPF,OAAQA,EACRG,MAAOA,EACG,WAAAC,EACVG,IAAKR,QAMPS,EAAiBH,EAAMI,YAC3B,EAAGC,SAAQV,SAAQE,QAAOC,QAAOF,WAAUG,WAAWG,KACpD,MAAOR,EAAUY,GAAeC,EAAS,MAEzCC,EAAoBN,GAAK,IAAMR,IAE/B,MAAMH,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,GAAkBO,EAAMS,WAAWC,GAQ/D,OANAC,GAAU,KACJjB,GAAYW,IACdX,EAASW,OAASA,EACnB,GACA,CAACX,EAAUW,IAGjBL,EAACC,cAAAW,EAAS,CAAAC,SAAU,MACnBb,EAAAC,cAACf,EACO,CAAAK,UAAWA,EACXK,SAAUA,EACVJ,QAASA,EACTC,cAAeA,EACfC,SAAUY,EACVX,OAAQA,EACRE,MAAOA,EACPE,QAASA,EACTD,MAAOA,IAGX"}
1
+ {"version":3,"file":"RoleManagement.js","sources":["../../../src/components/RoleManagement.tsx"],"sourcesContent":["import React, { lazy, Suspense, useImperativeHandle, useState } from 'react';\nimport Context from '../hooks/Context';\nimport { RoleManagementProps } 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 RoleManagementWC = lazy(async () => {\n await import('@descope/role-management-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n <descope-role-management-widget ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst RoleManagement = React.forwardRef<HTMLElement, RoleManagementProps>(\n ({ logger, tenant, 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 <RoleManagementWC\n projectId={projectId}\n widgetId={widgetId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n innerRef={setInnerRef}\n {...{\n // attributes\n 'tenant.attr': tenant,\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 RoleManagement;\n"],"names":["RoleManagementWC","lazy","async","import","default","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","RoleManagement","logger","tenant","theme","debug","widgetId","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","useContext","Context","Suspense","fallback"],"mappings":"mKAMA,MAAMA,EAAmBC,GAAKC,gBACtBC,OAAO,mCAEN,CACLC,QAASC,EACPC,EAAMC,YAAwB,CAACC,EAAOC,IACpCH,EAAgCI,cAAA,iCAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAMhDK,EAAiBP,EAAMC,YAC3B,EAAGO,SAAQC,SAAQC,QAAOC,QAAOC,WAAUC,WAAWV,KACpD,MAAOW,EAAUC,GAAeC,EAAS,MAEzCC,EAAoBd,GAAK,IAAMW,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,GAAkBpB,EAAMqB,WAAWC,GAE/D,OACEtB,EAACI,cAAAmB,EAAS,CAAAC,SAAU,MAClBxB,EAACI,cAAAV,GACCwB,UAAWA,EACXN,SAAUA,EACVO,QAASA,EACTC,cAAeA,EACfN,SAAUC,EAGR,cAAeN,EACf,aAAcC,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeL,IAIrB"}
@@ -1,2 +1,2 @@
1
- import e,{lazy as t,useState as a,useImperativeHandle as r,useEffect as n,Suspense as d}from"react";import l from"../hooks/Context.js";const s=t((async()=>(await import("@descope/user-management-widget"),{default:({projectId:t,baseUrl:a,baseStaticUrl:r,innerRef:n,tenant:d,widgetId:l,theme:s,debug:o,styleId:c})=>e.createElement("descope-user-management-widget",{"project-id":t,"widget-id":l,"base-url":a,"base-static-url":r,theme:s,tenant:d,debug:o,"style-id":c,ref:n})}))),o=e.forwardRef((({logger:t,tenant:o,theme:c,debug:i,widgetId:g,styleId:m},u)=>{const[b,f]=a(null);r(u,(()=>b));const{projectId:p,baseUrl:I,baseStaticUrl:w}=e.useContext(l);return n((()=>{b&&t&&(b.logger=t)}),[b,t]),e.createElement(d,{fallback:null},e.createElement(s,{projectId:p,widgetId:g,baseUrl:I,baseStaticUrl:w,innerRef:f,tenant:o,theme:c,styleId:m,debug:i}))}));export{o as default};
1
+ import e,{lazy as t,useState as r,useImperativeHandle as a,Suspense as o}from"react";import n from"../hooks/Context.js";import s from"./withPropsMapping/index.js";const d=t((async()=>(await import("@descope/user-management-widget"),{default:s(e.forwardRef(((t,r)=>e.createElement("descope-user-management-widget",Object.assign({ref:r},t)))))}))),l=e.forwardRef((({logger:t,tenant:s,theme:l,debug:c,widgetId:m,styleId:i},g)=>{const[p,f]=r(null);a(g,(()=>p));const{projectId:u,baseUrl:b,baseStaticUrl:w}=e.useContext(n);return e.createElement(o,{fallback:null},e.createElement(d,{projectId:u,widgetId:m,baseUrl:b,baseStaticUrl:w,ref:f,"tenant.attr":s,"theme.attr":l,"debug.attr":c,"styleId.attr":i,"logger.prop":t}))}));export{l as default};
2
2
  //# sourceMappingURL=UserManagement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserManagement.js","sources":["../../../src/components/UserManagement.tsx"],"sourcesContent":["import React, {\n lazy,\n Suspense,\n useEffect,\n useImperativeHandle,\n useState,\n} from 'react';\nimport Context from '../hooks/Context';\nimport { UserManagementProps } from '../types';\n\n// web-component code uses browser API, but can be used in SSR apps, hence the lazy loading\nconst UserManagementWC = lazy(async () => {\n await import('@descope/user-management-widget');\n\n return {\n default: ({\n projectId,\n baseUrl,\n baseStaticUrl,\n innerRef,\n tenant,\n widgetId,\n theme,\n debug,\n styleId,\n }) => (\n\t<descope-user-management-widget\n project-id={projectId}\n widget-id={widgetId}\n base-url={baseUrl}\n base-static-url={baseStaticUrl}\n theme={theme}\n tenant={tenant}\n debug={debug}\n style-id={styleId}\n ref={innerRef}\n />\n ),\n };\n});\n\nconst UserManagement = React.forwardRef<HTMLElement, UserManagementProps>(\n ({ logger, tenant, 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 useEffect(() => {\n if (innerRef && logger) {\n innerRef.logger = logger;\n }\n }, [innerRef, logger]);\n\n return (\n\t<Suspense fallback={null}>\n\t\t<UserManagementWC\n projectId={projectId}\n widgetId={widgetId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n innerRef={setInnerRef}\n tenant={tenant}\n theme={theme}\n styleId={styleId}\n debug={debug}\n />\n\t</Suspense>\n );\n },\n);\n\nexport default UserManagement;\n"],"names":["UserManagementWC","lazy","async","import","default","projectId","baseUrl","baseStaticUrl","innerRef","tenant","widgetId","theme","debug","styleId","React","createElement","ref","UserManagement","forwardRef","logger","setInnerRef","useState","useImperativeHandle","useContext","Context","useEffect","Suspense","fallback"],"mappings":"uIAWA,MAAMA,EAAmBC,GAAKC,gBACtBC,OAAO,mCAEN,CACLC,QAAS,EACPC,YACAC,UACAC,gBACAC,WACAC,SACAC,WACAC,QACAC,QACAC,aAELC,EAAAC,cAAA,iCAAA,CAAA,aACmBV,EACD,YAAAK,EACD,WAAAJ,EACO,kBAAAC,EACjBI,MAAOA,EACPF,OAAQA,EACRG,MAAOA,EACG,WAAAC,EACVG,IAAKR,QAMPS,EAAiBH,EAAMI,YAC3B,EAAGC,SAAQV,SAAQE,QAAOC,QAAOF,WAAUG,WAAWG,KACpD,MAAOR,EAAUY,GAAeC,EAAS,MAEzCC,EAAoBN,GAAK,IAAMR,IAE/B,MAAMH,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,GAAkBO,EAAMS,WAAWC,GAQ/D,OANAC,GAAU,KACJjB,GAAYW,IACdX,EAASW,OAASA,EACnB,GACA,CAACX,EAAUW,IAGjBL,EAACC,cAAAW,EAAS,CAAAC,SAAU,MACnBb,EAAAC,cAACf,EACO,CAAAK,UAAWA,EACXK,SAAUA,EACVJ,QAASA,EACTC,cAAeA,EACfC,SAAUY,EACVX,OAAQA,EACRE,MAAOA,EACPE,QAASA,EACTD,MAAOA,IAGX"}
1
+ {"version":3,"file":"UserManagement.js","sources":["../../../src/components/UserManagement.tsx"],"sourcesContent":["import React, { lazy, Suspense, useImperativeHandle, useState } from 'react';\nimport Context from '../hooks/Context';\nimport { UserManagementProps } 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 UserManagementWC = lazy(async () => {\n await import('@descope/user-management-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n <descope-user-management-widget ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst UserManagement = React.forwardRef<HTMLElement, UserManagementProps>(\n ({ logger, tenant, 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 <UserManagementWC\n projectId={projectId}\n widgetId={widgetId}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n ref={setInnerRef}\n {...{\n // attributes\n 'tenant.attr': tenant,\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 UserManagement;\n"],"names":["UserManagementWC","lazy","async","import","default","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","UserManagement","logger","tenant","theme","debug","widgetId","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","useContext","Context","Suspense","fallback"],"mappings":"mKAMA,MAAMA,EAAmBC,GAAKC,gBACtBC,OAAO,mCAEN,CACLC,QAASC,EACPC,EAAMC,YAAwB,CAACC,EAAOC,IACpCH,EAAgCI,cAAA,iCAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAMhDK,EAAiBP,EAAMC,YAC3B,EAAGO,SAAQC,SAAQC,QAAOC,QAAOC,WAAUC,WAAWV,KACpD,MAAOW,EAAUC,GAAeC,EAAS,MAEzCC,EAAoBd,GAAK,IAAMW,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,GAAkBpB,EAAMqB,WAAWC,GAE/D,OACEtB,EAACI,cAAAmB,EAAS,CAAAC,SAAU,MAClBxB,EAACI,cAAAV,GACCwB,UAAWA,EACXN,SAAUA,EACVO,QAASA,EACTC,cAAeA,EACfjB,IAAKY,EAGH,cAAeN,EACf,aAAcC,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeL,IAIrB"}
@@ -1,2 +1,2 @@
1
- import e,{lazy as t,useState as r,useImperativeHandle as o,useEffect as d,Suspense as l}from"react";import s from"../hooks/Context.js";const a=t((async()=>(await import("@descope/user-profile-widget"),{default:({projectId:t,baseUrl:r,baseStaticUrl:o,innerRef:d,widgetId:l,theme:s,debug:a,styleId:i})=>e.createElement("descope-user-profile-widget",{"project-id":t,"widget-id":l,"base-url":r,"base-static-url":o,theme:s,debug:a,"style-id":i,ref:d})}))),i=e.forwardRef((({logger:t,theme:i,debug:n,widgetId:c,onLogout:u,styleId:g},b)=>{const[f,m]=r(null);o(b,(()=>f));const{projectId:p,baseUrl:I,baseStaticUrl:w}=e.useContext(s);return d((()=>{f&&t&&(f.logger=t)}),[f,t]),d((()=>{if(f&&u)return f.addEventListener("logout",u),()=>f.removeEventListener("logout",u)}),[f,u]),e.createElement(l,{fallback:null},e.createElement(a,{projectId:p,widgetId:c,baseUrl:I,baseStaticUrl:w,innerRef:m,theme:i,styleId:g,debug:n}))}));export{i as default};
1
+ import e,{lazy as t,useState as r,useImperativeHandle as o,useEffect as a,Suspense as s}from"react";import l from"../hooks/Context.js";import d from"./withPropsMapping/index.js";const n=t((async()=>(await import("@descope/user-profile-widget"),{default:d(e.forwardRef(((t,r)=>e.createElement("descope-user-profile-widget",Object.assign({ref:r},t)))))}))),i=e.forwardRef((({logger:t,theme:d,debug:i,widgetId:c,onLogout:p,styleId:f},g)=>{const[u,m]=r(null);o(g,(()=>u));const{projectId:b,baseUrl:w,baseStaticUrl:I}=e.useContext(l);return a((()=>{if(u&&p)return u.addEventListener("logout",p),()=>u.removeEventListener("logout",p)}),[u,p]),e.createElement(s,{fallback:null},e.createElement(n,{projectId:b,widgetId:c,baseUrl:w,baseStaticUrl:I,styleId:f,ref:m,"theme.attr":d,"debug.attr":i,"styleId.attr":f,"logger.prop":t}))}));export{i as default};
2
2
  //# sourceMappingURL=UserProfile.js.map
@@ -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';\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: ({\n projectId,\n baseUrl,\n baseStaticUrl,\n innerRef,\n widgetId,\n theme,\n debug,\n styleId,\n }) => (\n\t<descope-user-profile-widget\n project-id={projectId}\n widget-id={widgetId}\n base-url={baseUrl}\n base-static-url={baseStaticUrl}\n theme={theme}\n debug={debug}\n style-id={styleId}\n ref={innerRef}\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 && logger) {\n innerRef.logger = logger;\n }\n }, [innerRef, logger]);\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 innerRef={setInnerRef}\n theme={theme}\n styleId={styleId}\n debug={debug}\n />\n\t</Suspense>\n );\n },\n);\n\nexport default UserProfile;\n"],"names":["UserProfileWC","lazy","async","import","default","projectId","baseUrl","baseStaticUrl","innerRef","widgetId","theme","debug","styleId","React","ref","UserProfile","forwardRef","logger","onLogout","setInnerRef","useState","useImperativeHandle","useContext","Context","useEffect","addEventListener","removeEventListener","createElement","Suspense","fallback"],"mappings":"uIAWA,MAAMA,EAAgBC,GAAKC,gBACnBC,OAAO,gCAEN,CACLC,QAAS,EACPC,YACAC,UACAC,gBACAC,WACAC,WACAC,QACAC,QACAC,aAELC,4DACmBR,EAAS,YACVI,EACD,WAAAH,oBACOC,EACjBG,MAAOA,EACPC,MAAOA,EACG,WAAAC,EACVE,IAAKN,QAMPO,EAAcF,EAAMG,YACxB,EAAGC,SAAQP,QAAOC,QAAOF,WAAUS,WAAUN,WAAWE,KACtD,MAAON,EAAUW,GAAeC,EAAS,MAEzCC,EAAoBP,GAAK,IAAMN,IAE/B,MAAMH,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,GAAkBM,EAAMS,WAAWC,GAgB/D,OAdAC,GAAU,KACJhB,GAAYS,IACdT,EAASS,OAASA,EACnB,GACA,CAACT,EAAUS,IAEdO,GAAU,KACR,GAAIhB,GAAYU,EAEd,OADAV,EAASiB,iBAAiB,SAAUP,GAC7B,IAAMV,EAASkB,oBAAoB,SAAUR,EAEtC,GACf,CAACV,EAAUU,IAGjBL,EAACc,cAAAC,EAAS,CAAAC,SAAU,MACnBhB,EAAAc,cAAC3B,EACO,CAAAK,UAAWA,EACXI,SAAUA,EACVH,QAASA,EACTC,cAAeA,EACfC,SAAUW,EACVT,MAAOA,EACPE,QAASA,EACTD,MAAOA,IAGX"}
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"}
@@ -0,0 +1,2 @@
1
+ import r,{useMemo as t,useRef as e,useCallback as o,useImperativeHandle as s}from"react";import{kebabCase as c}from"@descope/sdk-helpers";import{transformKey as p,transformAttrValue as a}from"./utils.js";const n=n=>r.forwardRef(((u,i)=>{const{prop:m,attr:f,rest:l}=t((()=>Object.entries(u).reduce(((r,[t,e])=>{const{trimmedKey:o,category:s}=p(t);return"prop"===s?r.prop.push([o,e]):"attr"===s?r.attr.push([c(o),a(e)]):Object.assign(r.rest,{[c(o)]:e}),r}),{attr:[],prop:[],rest:{}})),[u]),d=e(null),b=o((r=>{d.current=r,r&&(m.forEach((([r,t])=>{d.current[r]=t})),f.forEach((([t,e])=>{null==e?r.removeAttribute(t):r.setAttribute(t,e)})))}),[m,f,d]);return s(i,(()=>d.current)),r.createElement(n,Object.assign({ref:b},l))}));export{n as default};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/withPropsMapping/index.tsx"],"sourcesContent":["import React, {\n useImperativeHandle,\n useMemo,\n ComponentType,\n useCallback,\n useRef,\n} from 'react';\nimport { kebabCase } from '@descope/sdk-helpers';\nimport { transformAttrValue, transformKey } from './utils';\n\n/**\n * withPropsMapping is a React HOC that adapts React props to work seamlessly\n * with web components by setting attributes and properties.\n *\n * - Props ending in `.prop` are set as properties on the web component.\n * - Props ending in `.attr` are transformed to kebab-case and set as attributes on the web component.\n * - All other props are set as kebab-case props\n *\n * This resolves attribute/property behavior differences in React 19.\n *\n * @see https://github.com/facebook/react/issues/29037\n */\nconst withPropsMapping = <P extends Record<string, any>>(\n Component: ComponentType<any>,\n) =>\n React.forwardRef<HTMLElement, P>((props, ref) => {\n const { prop, attr, rest } = useMemo(\n () =>\n Object.entries(props).reduce(\n (acc, [key, value]) => {\n const { trimmedKey, category } = transformKey(key);\n if (category === 'prop') acc.prop.push([trimmedKey, value]);\n else if (category === 'attr')\n acc.attr.push([kebabCase(trimmedKey), transformAttrValue(value)]);\n else Object.assign(acc.rest, { [kebabCase(trimmedKey)]: value });\n return acc;\n },\n { attr: [], prop: [], rest: {} },\n ),\n [props],\n );\n\n const currRef = useRef<HTMLElement | null>(null);\n\n const setInnerRef = useCallback(\n (innerRef) => {\n currRef.current = innerRef;\n if (innerRef) {\n prop.forEach(([key, value]) => {\n currRef.current[key] = value;\n });\n\n attr.forEach(([key, value]) => {\n if (value === undefined || value === null) {\n innerRef.removeAttribute(key);\n } else {\n innerRef.setAttribute(key, value);\n }\n });\n }\n },\n [prop, attr, currRef],\n );\n\n useImperativeHandle(ref, () => currRef.current);\n\n return <Component ref={setInnerRef} {...rest} />;\n });\n\nexport default withPropsMapping;\n"],"names":["withPropsMapping","Component","React","forwardRef","props","ref","prop","attr","rest","useMemo","Object","entries","reduce","acc","key","value","trimmedKey","category","transformKey","push","kebabCase","transformAttrValue","assign","currRef","useRef","setInnerRef","useCallback","innerRef","current","forEach","removeAttribute","setAttribute","useImperativeHandle","createElement"],"mappings":"4MAsBA,MAAMA,EACJC,GAEAC,EAAMC,YAA2B,CAACC,EAAOC,KACvC,MAAMC,KAAEA,EAAIC,KAAEA,EAAIC,KAAEA,GAASC,GAC3B,IACEC,OAAOC,QAAQP,GAAOQ,QACpB,CAACC,GAAMC,EAAKC,MACV,MAAMC,WAAEA,EAAUC,SAAEA,GAAaC,EAAaJ,GAK9C,MAJiB,SAAbG,EAAqBJ,EAAIP,KAAKa,KAAK,CAACH,EAAYD,IAC9B,SAAbE,EACPJ,EAAIN,KAAKY,KAAK,CAACC,EAAUJ,GAAaK,EAAmBN,KACtDL,OAAOY,OAAOT,EAAIL,KAAM,CAAE,CAACY,EAAUJ,IAAcD,IACjDF,CAAG,GAEZ,CAAEN,KAAM,GAAID,KAAM,GAAIE,KAAM,CAAA,KAEhC,CAACJ,IAGGmB,EAAUC,EAA2B,MAErCC,EAAcC,GACjBC,IACCJ,EAAQK,QAAUD,EACdA,IACFrB,EAAKuB,SAAQ,EAAEf,EAAKC,MAClBQ,EAAQK,QAAQd,GAAOC,CAAK,IAG9BR,EAAKsB,SAAQ,EAAEf,EAAKC,MACdA,QACFY,EAASG,gBAAgBhB,GAEzBa,EAASI,aAAajB,EAAKC,EAC5B,IAEJ,GAEH,CAACT,EAAMC,EAAMgB,IAKf,OAFAS,EAAoB3B,GAAK,IAAMkB,EAAQK,UAEhC1B,EAAA+B,cAAChC,EAAUS,OAAAY,OAAA,CAAAjB,IAAKoB,GAAiBjB,GAAQ"}
@@ -0,0 +1,2 @@
1
+ const t=t=>{const[,r,e]=/(.*)\.(prop|attr)$/.exec(t)||[,t,"rest"];return{trimmedKey:r,category:e}},r=t=>"string"==typeof t||null==t?t:JSON.stringify(t);export{r as transformAttrValue,t as transformKey};
2
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../../../../src/components/withPropsMapping/utils.ts"],"sourcesContent":["export const transformKey = (key: string) => {\n // eslint-disable-next-line no-sparse-arrays\n const [, trimmedKey, category] = /(.*)\\.(prop|attr)$/.exec(key) || [\n ,\n key,\n 'rest',\n ];\n return { trimmedKey, category };\n};\n\nexport const transformAttrValue = (value: any) =>\n typeof value === 'string' || value == null ? value : JSON.stringify(value);\n"],"names":["transformKey","key","trimmedKey","category","exec","transformAttrValue","value","JSON","stringify"],"mappings":"AAAa,MAAAA,EAAgBC,IAE3B,MAAM,CAAGC,EAAYC,GAAY,qBAAqBC,KAAKH,IAAQ,EAEjEA,EACA,QAEF,MAAO,CAAEC,aAAYC,WAAU,EAGpBE,EAAsBC,GAChB,iBAAVA,GAA+B,MAATA,EAAgBA,EAAQC,KAAKC,UAAUF"}
@@ -1,2 +1,2 @@
1
- const e={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.3.5"},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.7"},d="undefined"!=typeof window;export{d as IS_BROWSER,e as baseHeaders};
2
2
  //# sourceMappingURL=constants.js.map
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ interface IAuthProviderProps {
19
19
  sessionTokenViaCookie?: boolean;
20
20
  storeLastAuthenticatedUser?: boolean;
21
21
  keepLastAuthenticatedUserAfterLogout?: boolean;
22
- children?: JSX.Element;
22
+ children?: React.ReactNode;
23
23
  }
24
24
  declare const AuthProvider: FC<IAuthProviderProps>;
25
25
 
@@ -165,9 +165,10 @@ declare const createSdkWrapper: <P extends Omit<{
165
165
  };
166
166
  };
167
167
  fedcm: {
168
- oneTap(provider?: string, oneTapConfig?: _descope_web_js_sdk.OneTapConfig, loginOptions?: _1.LoginOptions, onSkip?: () => void): Promise<unknown>;
168
+ oneTap(provider?: string, oneTapConfig?: _descope_web_js_sdk.OneTapConfig, loginOptions?: _1.LoginOptions, onSkip?: (reason?: string) => void, onDismissed?: (reason?: string) => void): Promise<unknown>;
169
169
  launch(context?: "signin" | "signup" | "use" | "continue"): Promise<_1.SdkResponse<_1.JWTResponse>>;
170
170
  isSupported(): boolean;
171
+ isLoggedIn(context?: "signin" | "signup" | "use" | "continue"): Promise<boolean>;
171
172
  };
172
173
  accessKey: {
173
174
  exchange: (accessKey: string, loginOptions?: _1.AccessKeyLoginOptions) => Promise<_1.SdkResponse<_1.ExchangeAccessKeyResponse>>;
@@ -774,9 +775,10 @@ declare const createSdkWrapper: <P extends Omit<{
774
775
  };
775
776
  };
776
777
  fedcm: {
777
- oneTap(provider?: string, oneTapConfig?: _descope_web_js_sdk.OneTapConfig, loginOptions?: _1.LoginOptions, onSkip?: () => void): Promise<unknown>;
778
+ oneTap(provider?: string, oneTapConfig?: _descope_web_js_sdk.OneTapConfig, loginOptions?: _1.LoginOptions, onSkip?: (reason?: string) => void, onDismissed?: (reason?: string) => void): Promise<unknown>;
778
779
  launch(context?: "signin" | "signup" | "use" | "continue"): Promise<_1.SdkResponse<_1.JWTResponse>>;
779
780
  isSupported(): boolean;
781
+ isLoggedIn(context?: "signin" | "signup" | "use" | "continue"): Promise<boolean>;
780
782
  };
781
783
  accessKey: {
782
784
  exchange: (accessKey: string, loginOptions?: _1.AccessKeyLoginOptions) => Promise<_1.SdkResponse<_1.ExchangeAccessKeyResponse>>;
@@ -1307,7 +1309,7 @@ declare const getJwtPermissions: (token?: any, tenant?: string) => string[];
1307
1309
  declare const getJwtRoles: (token?: any, tenant?: string) => string[];
1308
1310
  declare const refresh: (token?: string) => Promise<_1.SdkResponse<_1.JWTResponse>>;
1309
1311
 
1310
- declare global {
1312
+ declare module 'react' {
1311
1313
  namespace JSX {
1312
1314
  interface IntrinsicElements {
1313
1315
  ['descope-wc']: DescopeCustomElement;
@@ -1334,7 +1336,7 @@ type JWTResponse = Required<Required<FlowResponse>['data']>['authInfo'];
1334
1336
  type CustomEventCb<T extends Record<string, any>> = (e: CustomEvent<T>) => void;
1335
1337
  type Sdk = ReturnType<typeof createSdkWrapper>;
1336
1338
  type CustomElement<T> = Partial<T & DOMAttributes<T> & {
1337
- children: React.ReactChild;
1339
+ children: React.ReactNode;
1338
1340
  ref: React.Ref<HTMLElement>;
1339
1341
  }>;
1340
1342
  type DescopeCustomElement = CustomElement<_descope_web_component__default>;