@descope/react-sdk 2.5.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/AccessKeyManagement.js.map +1 -1
- package/dist/cjs/components/ApplicationsPortal.js.map +1 -1
- package/dist/cjs/components/AuditManagement.js.map +1 -1
- package/dist/cjs/components/Descope.js.map +1 -1
- package/dist/cjs/components/RoleManagement.js.map +1 -1
- package/dist/cjs/components/UserManagement.js.map +1 -1
- package/dist/cjs/constants.js +1 -1
- package/dist/esm/components/AccessKeyManagement.js.map +1 -1
- package/dist/esm/components/ApplicationsPortal.js.map +1 -1
- package/dist/esm/components/AuditManagement.js.map +1 -1
- package/dist/esm/components/Descope.js.map +1 -1
- package/dist/esm/components/RoleManagement.js.map +1 -1
- package/dist/esm/components/UserManagement.js.map +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/types/sdk.d.ts +6 -6
- package/dist/types/types.d.ts +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessKeyManagement.js","sources":["../../../src/components/AccessKeyManagement.tsx"],"sourcesContent":["import React, { lazy, Suspense, useImperativeHandle, useState } from 'react';\nimport Context from '../hooks/Context';\nimport { AccessKeyManagementProps } 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 AccessKeyManagementWC = lazy(async () => {\n await import('@descope/access-key-management-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n
|
|
1
|
+
{"version":3,"file":"AccessKeyManagement.js","sources":["../../../src/components/AccessKeyManagement.tsx"],"sourcesContent":["import React, { lazy, Suspense, useImperativeHandle, useState } from 'react';\nimport Context from '../hooks/Context';\nimport { AccessKeyManagementProps } 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 AccessKeyManagementWC = lazy(async () => {\n await import('@descope/access-key-management-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n\t<descope-access-key-management-widget ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst AccessKeyManagement = React.forwardRef<\n HTMLElement,\n AccessKeyManagementProps\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, baseCdnUrl } =\n React.useContext(Context);\n\n return (\n\t<Suspense fallback={null}>\n\t\t<AccessKeyManagementWC\n projectId={projectId}\n widgetId={widgetId}\n tenant={tenant}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n baseCdnUrl={baseCdnUrl}\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 AccessKeyManagement;\n"],"names":["AccessKeyManagementWC","lazy","async","import","default","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","AccessKeyManagement","logger","tenant","theme","debug","widgetId","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","baseCdnUrl","useContext","Context","Suspense","fallback"],"mappings":"mOAMA,MAAMA,EAAwBC,EAAIA,MAACC,gBAC3BC,OAAO,yCAEN,CACLC,QAASC,EAAgBD,QACvBE,UAAMC,YAAwB,CAACC,EAAOC,IAC3CH,EAAAA,QAAsCI,cAAA,uCAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAM/CK,EAAsBP,EAAKF,QAACG,YAGhC,EAAGO,SAAQC,SAAQC,QAAOC,QAAOC,WAAUC,WAAWV,KACtD,MAAOW,EAAUC,GAAeC,EAAQA,SAAC,MAEzCC,sBAAoBd,GAAK,IAAMW,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,EAAaC,WAAEA,GACzCrB,EAAKF,QAACwB,WAAWC,EAAAA,SAEnB,OACDvB,EAACF,QAAAM,cAAAoB,EAAQA,SAAC,CAAAC,SAAU,MACnBzB,EAAAF,QAAAM,cAACV,EAAqB,CAChBwB,UAAWA,EACXN,SAAUA,EACVH,OAAQA,EACRU,QAASA,EACTC,cAAeA,EACfC,WAAYA,EACZP,SAAUC,EAGR,aAAcL,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeL,IAIrB"}
|
|
@@ -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
|
|
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, baseCdnUrl } =\n 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 baseCdnUrl={baseCdnUrl}\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","baseCdnUrl","useContext","Context","Suspense","fallback"],"mappings":"mOAMA,MAAMA,EAAuBC,EAAIA,MAACC,gBAC1BC,OAAO,uCAEN,CACLC,QAASC,EAAgBD,QACvBE,UAAMC,YAAwB,CAACC,EAAOC,IAC3CH,EAAAA,QAAoCI,cAAA,qCAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAM7CK,EAAqBP,EAAKF,QAACG,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,EAAaC,WAAEA,GACzCpB,EAAKF,QAACuB,WAAWC,EAAAA,SAEnB,OACDtB,EAACF,QAAAM,cAAAmB,EAAQA,SAAC,CAAAC,SAAU,MACnBxB,EAACF,QAAAM,cAAAV,EACK,CAAAuB,UAAWA,EACXN,SAAUA,EACVO,QAASA,EACTC,cAAeA,EACfC,WAAYA,EACZP,SAAUC,EAGR,aAAcL,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeJ,IAIrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuditManagement.js","sources":["../../../src/components/AuditManagement.tsx"],"sourcesContent":["import React, { lazy, Suspense, useImperativeHandle, useState } from 'react';\nimport Context from '../hooks/Context';\nimport { AuditManagementProps } 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 AuditManagementWC = lazy(async () => {\n await import('@descope/audit-management-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n
|
|
1
|
+
{"version":3,"file":"AuditManagement.js","sources":["../../../src/components/AuditManagement.tsx"],"sourcesContent":["import React, { lazy, Suspense, useImperativeHandle, useState } from 'react';\nimport Context from '../hooks/Context';\nimport { AuditManagementProps } 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 AuditManagementWC = lazy(async () => {\n await import('@descope/audit-management-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n\t<descope-audit-management-widget ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst AuditManagement = React.forwardRef<HTMLElement, AuditManagementProps>(\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, baseCdnUrl } =\n React.useContext(Context);\n\n return (\n\t<Suspense fallback={null}>\n\t\t<AuditManagementWC\n projectId={projectId}\n widgetId={widgetId}\n tenant={tenant}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n baseCdnUrl={baseCdnUrl}\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);\n\nexport default AuditManagement;\n"],"names":["AuditManagementWC","lazy","async","import","default","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","AuditManagement","logger","tenant","theme","debug","widgetId","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","baseCdnUrl","useContext","Context","Suspense","fallback"],"mappings":"mOAMA,MAAMA,EAAoBC,EAAIA,MAACC,gBACvBC,OAAO,oCAEN,CACLC,QAASC,EAAgBD,QACvBE,UAAMC,YAAwB,CAACC,EAAOC,IAC3CH,EAAAA,QAAiCI,cAAA,kCAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAM1CK,EAAkBP,EAAKF,QAACG,YAC5B,EAAGO,SAAQC,SAAQC,QAAOC,QAAOC,WAAUC,WAAWV,KACpD,MAAOW,EAAUC,GAAeC,EAAQA,SAAC,MAEzCC,sBAAoBd,GAAK,IAAMW,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,EAAaC,WAAEA,GACzCrB,EAAKF,QAACwB,WAAWC,EAAAA,SAEnB,OACHvB,EAACF,QAAAM,cAAAoB,EAAQA,SAAC,CAAAC,SAAU,MACnBzB,EAAAF,QAAAM,cAACV,EAAiB,CACVwB,UAAWA,EACXN,SAAUA,EACVH,OAAQA,EACRU,QAASA,EACTC,cAAeA,EACfC,WAAYA,EACZP,SAAUC,EAGR,aAAcL,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeL,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
|
|
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 onScreenUpdate,\n children,\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 baseCdnUrl,\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 baseCdnUrl={baseCdnUrl}\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 'onScreenUpdate.prop': onScreenUpdate,\n }}\n >\n\t\t\t\t{children}\n\t\t\t</DescopeWC>\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","onScreenUpdate","children","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","baseCdnUrl","storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout","sdk","useContext","Context","handleSuccess","useCallback","e","afterRequest","Response","JSON","stringify","detail","useEffect","ele","addEventListener","removeEventListener","Suspense","fallback"],"mappings":"uRAeA,MAAMA,EAAYC,EAAIA,MAACC,YAEnB,OAAAC,qBAAA,IAAAA,oBAAA,EAAAA,eAAgBC,IAAI,sBACbC,OAAO,0BAA0BC,MAAMC,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,EAAgBT,QACvBU,UAAMC,YAAwB,CAACC,EAAOC,IAC3CH,EAAAA,QAAYI,cAAA,aAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAMrBK,EAAUP,EAAKV,QAACW,YACpB,EAEIO,SACAC,YACAC,UACAC,UACAC,SACAC,SACAC,QACAC,SACAC,QACAC,SACAC,OACAC,eACAC,cACAC,YACAC,iBACAC,iBACAC,mBACAC,UACAC,iBACAC,YAEFxB,KAEA,MAAOyB,EAAUC,GAAeC,EAAQA,SAAC,MAEzCC,sBAAoB5B,GAAK,IAAMyB,IAE/B,MAAMI,UACJA,EAASC,QACTA,EAAOC,cACPA,EAAaC,WACbA,EAAUC,2BACVA,EAA0BC,qCAC1BA,EAAoCC,IACpCA,GACEtC,EAAAA,QAAMuC,WAAWC,EAAOlD,SAEtBmD,EAAgBC,eACpB1D,MAAO2D,UAGCL,EAAIzC,WAAWH,MAAMkD,aACzB,CAAA,EACA,IAAIC,SAASC,KAAKC,UAAUJ,EAAEK,UAE5BvC,GACFA,EAAUkC,EACX,GAEH,CAAClC,IA8CH,OA3CAwC,EAAAA,WAAU,KACR,MAAMC,EAAMtB,EAKZ,OAJAsB,SAAAA,EAAKC,iBAAiB,UAAWV,GAC7B/B,IAASwC,SAAAA,EAAKC,iBAAiB,QAASzC,IACxCC,IAASuC,SAAAA,EAAKC,iBAAiB,QAASxC,IAErC,KACDD,IAASwC,SAAAA,EAAKE,oBAAoB,QAAS1C,IAC3CC,IAASuC,SAAAA,EAAKE,oBAAoB,QAASzC,IAE/CuC,SAAAA,EAAKE,oBAAoB,UAAWX,EAAc,CACnD,GACA,CAACb,EAAUlB,EAAS+B,IAGvBQ,EAAAA,WAAU,KACR,MAAMC,EAAMtB,EAEZ,OADAsB,SAAAA,EAAKC,iBAAiB,UAAWV,GAC1B,KACLS,SAAAA,EAAKE,oBAAoB,UAAWX,EAAc,CACnD,GACA,CAACb,EAAUa,IAGdQ,EAAAA,WAAU,KACR,MAAMC,EAAMtB,EAGZ,OAFIlB,IAASwC,SAAAA,EAAKC,iBAAiB,QAASzC,IAErC,KACDA,IAASwC,SAAAA,EAAKE,oBAAoB,QAAS1C,GAAQ,CACxD,GACA,CAACkB,EAAUlB,IAGduC,EAAAA,WAAU,KACR,MAAMC,EAAMtB,EAGZ,OAFIjB,IAASuC,SAAAA,EAAKC,iBAAiB,QAASxC,IAErC,KACDA,IAASuC,SAAAA,EAAKE,oBAAoB,QAASzC,GAAQ,CACxD,GACA,CAACiB,EAAUjB,IASjBX,UAAAI,cAAA,OAAA,KACCJ,EAAAA,QAAAI,cAACiD,EAAAA,SAAQ,CAACC,SAAU,MACnBtD,EAACV,QAAAc,cAAAtB,EACQ,CAAAkD,UAAWA,EACXxB,OAAQA,EACRyB,QAASA,EACTC,cAAeA,EACfC,WAAYA,EACZhC,IAAK0B,EACLV,aAAcA,EACdC,YAAaA,EACbC,UAAWA,EACXI,QAASA,EACTH,eAAgBA,EAChBC,eAAgBA,EAChBc,qCACEA,EAEFxB,OAAQA,EAGN,aAAcC,EACd,cAAeC,EACf,YAAaG,EACb,cAAeD,EACf,aAAcD,EACd,qCAAsCoB,EAEtC,wBAAyBZ,EACzB,cAAeZ,EACf,sBAAuBc,GAGhCC,IAIC"}
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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\t<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, baseCdnUrl } =\n React.useContext(Context);\n\n return (\n\t<Suspense fallback={null}>\n\t\t<RoleManagementWC\n projectId={projectId}\n widgetId={widgetId}\n tenant={tenant}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n baseCdnUrl={baseCdnUrl}\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);\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","baseCdnUrl","useContext","Context","Suspense","fallback"],"mappings":"mOAMA,MAAMA,EAAmBC,EAAIA,MAACC,gBACtBC,OAAO,mCAEN,CACLC,QAASC,EAAgBD,QACvBE,UAAMC,YAAwB,CAACC,EAAOC,IAC3CH,EAAAA,QAAgCI,cAAA,iCAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAMzCK,EAAiBP,EAAKF,QAACG,YAC3B,EAAGO,SAAQC,SAAQC,QAAOC,QAAOC,WAAUC,WAAWV,KACpD,MAAOW,EAAUC,GAAeC,EAAQA,SAAC,MAEzCC,sBAAoBd,GAAK,IAAMW,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,EAAaC,WAAEA,GACzCrB,EAAKF,QAACwB,WAAWC,EAAAA,SAEnB,OACHvB,EAACF,QAAAM,cAAAoB,EAAQA,SAAC,CAAAC,SAAU,MACnBzB,EAAAF,QAAAM,cAACV,EAAgB,CACTwB,UAAWA,EACXN,SAAUA,EACVH,OAAQA,EACRU,QAASA,EACTC,cAAeA,EACfC,WAAYA,EACZP,SAAUC,EAGR,aAAcL,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeL,IAIrB"}
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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\t<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, baseCdnUrl } =\n React.useContext(Context);\n\n return (\n\t<Suspense fallback={null}>\n\t\t<UserManagementWC\n projectId={projectId}\n widgetId={widgetId}\n tenant={tenant}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n baseCdnUrl={baseCdnUrl}\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 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","baseCdnUrl","useContext","Context","Suspense","fallback"],"mappings":"mOAMA,MAAMA,EAAmBC,EAAIA,MAACC,gBACtBC,OAAO,mCAEN,CACLC,QAASC,EAAgBD,QACvBE,UAAMC,YAAwB,CAACC,EAAOC,IAC3CH,EAAAA,QAAgCI,cAAA,iCAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAMzCK,EAAiBP,EAAKF,QAACG,YAC3B,EAAGO,SAAQC,SAAQC,QAAOC,QAAOC,WAAUC,WAAWV,KACpD,MAAOW,EAAUC,GAAeC,EAAQA,SAAC,MAEzCC,sBAAoBd,GAAK,IAAMW,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,EAAaC,WAAEA,GACzCrB,EAAKF,QAACwB,WAAWC,EAAAA,SAEnB,OACHvB,EAACF,QAAAM,cAAAoB,EAAQA,SAAC,CAAAC,SAAU,MACnBzB,EAAAF,QAAAM,cAACV,EAAgB,CACTwB,UAAWA,EACXN,SAAUA,EACVH,OAAQA,EACRU,QAASA,EACTC,cAAeA,EACfC,WAAYA,EACZlB,IAAKY,EAGH,aAAcL,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeL,IAIrB"}
|
package/dist/cjs/constants.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e="undefined"!=typeof window;exports.IS_BROWSER=e,exports.baseHeaders={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.
|
|
1
|
+
"use strict";const e="undefined"!=typeof window;exports.IS_BROWSER=e,exports.baseHeaders={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.6.1"};
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccessKeyManagement.js","sources":["../../../src/components/AccessKeyManagement.tsx"],"sourcesContent":["import React, { lazy, Suspense, useImperativeHandle, useState } from 'react';\nimport Context from '../hooks/Context';\nimport { AccessKeyManagementProps } 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 AccessKeyManagementWC = lazy(async () => {\n await import('@descope/access-key-management-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n
|
|
1
|
+
{"version":3,"file":"AccessKeyManagement.js","sources":["../../../src/components/AccessKeyManagement.tsx"],"sourcesContent":["import React, { lazy, Suspense, useImperativeHandle, useState } from 'react';\nimport Context from '../hooks/Context';\nimport { AccessKeyManagementProps } 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 AccessKeyManagementWC = lazy(async () => {\n await import('@descope/access-key-management-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n\t<descope-access-key-management-widget ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst AccessKeyManagement = React.forwardRef<\n HTMLElement,\n AccessKeyManagementProps\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, baseCdnUrl } =\n React.useContext(Context);\n\n return (\n\t<Suspense fallback={null}>\n\t\t<AccessKeyManagementWC\n projectId={projectId}\n widgetId={widgetId}\n tenant={tenant}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n baseCdnUrl={baseCdnUrl}\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 AccessKeyManagement;\n"],"names":["AccessKeyManagementWC","lazy","async","import","default","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","AccessKeyManagement","logger","tenant","theme","debug","widgetId","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","baseCdnUrl","useContext","Context","Suspense","fallback"],"mappings":"mKAMA,MAAMA,EAAwBC,GAAKC,gBAC3BC,OAAO,yCAEN,CACLC,QAASC,EACPC,EAAMC,YAAwB,CAACC,EAAOC,IAC3CH,EAAsCI,cAAA,uCAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAM/CK,EAAsBP,EAAMC,YAGhC,EAAGO,SAAQC,SAAQC,QAAOC,QAAOC,WAAUC,WAAWV,KACtD,MAAOW,EAAUC,GAAeC,EAAS,MAEzCC,EAAoBd,GAAK,IAAMW,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,EAAaC,WAAEA,GACzCrB,EAAMsB,WAAWC,GAEnB,OACDvB,EAACI,cAAAoB,EAAS,CAAAC,SAAU,MACnBzB,EAAAI,cAACV,EAAqB,CAChBwB,UAAWA,EACXN,SAAUA,EACVH,OAAQA,EACRU,QAASA,EACTC,cAAeA,EACfC,WAAYA,EACZP,SAAUC,EAGR,aAAcL,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeL,IAIrB"}
|
|
@@ -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
|
|
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, baseCdnUrl } =\n 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 baseCdnUrl={baseCdnUrl}\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","baseCdnUrl","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,EAAaC,WAAEA,GACzCpB,EAAMqB,WAAWC,GAEnB,OACDtB,EAACI,cAAAmB,EAAS,CAAAC,SAAU,MACnBxB,EAACI,cAAAV,EACK,CAAAuB,UAAWA,EACXN,SAAUA,EACVO,QAASA,EACTC,cAAeA,EACfC,WAAYA,EACZP,SAAUC,EAGR,aAAcL,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeJ,IAIrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuditManagement.js","sources":["../../../src/components/AuditManagement.tsx"],"sourcesContent":["import React, { lazy, Suspense, useImperativeHandle, useState } from 'react';\nimport Context from '../hooks/Context';\nimport { AuditManagementProps } 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 AuditManagementWC = lazy(async () => {\n await import('@descope/audit-management-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n
|
|
1
|
+
{"version":3,"file":"AuditManagement.js","sources":["../../../src/components/AuditManagement.tsx"],"sourcesContent":["import React, { lazy, Suspense, useImperativeHandle, useState } from 'react';\nimport Context from '../hooks/Context';\nimport { AuditManagementProps } 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 AuditManagementWC = lazy(async () => {\n await import('@descope/audit-management-widget');\n\n return {\n default: withPropsMapping(\n React.forwardRef<HTMLElement>((props, ref) => (\n\t<descope-audit-management-widget ref={ref} {...props} />\n )),\n ),\n };\n});\n\nconst AuditManagement = React.forwardRef<HTMLElement, AuditManagementProps>(\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, baseCdnUrl } =\n React.useContext(Context);\n\n return (\n\t<Suspense fallback={null}>\n\t\t<AuditManagementWC\n projectId={projectId}\n widgetId={widgetId}\n tenant={tenant}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n baseCdnUrl={baseCdnUrl}\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);\n\nexport default AuditManagement;\n"],"names":["AuditManagementWC","lazy","async","import","default","withPropsMapping","React","forwardRef","props","ref","createElement","Object","assign","AuditManagement","logger","tenant","theme","debug","widgetId","styleId","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","baseCdnUrl","useContext","Context","Suspense","fallback"],"mappings":"mKAMA,MAAMA,EAAoBC,GAAKC,gBACvBC,OAAO,oCAEN,CACLC,QAASC,EACPC,EAAMC,YAAwB,CAACC,EAAOC,IAC3CH,EAAiCI,cAAA,kCAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAM1CK,EAAkBP,EAAMC,YAC5B,EAAGO,SAAQC,SAAQC,QAAOC,QAAOC,WAAUC,WAAWV,KACpD,MAAOW,EAAUC,GAAeC,EAAS,MAEzCC,EAAoBd,GAAK,IAAMW,IAE/B,MAAMI,UAAEA,EAASC,QAAEA,EAAOC,cAAEA,EAAaC,WAAEA,GACzCrB,EAAMsB,WAAWC,GAEnB,OACHvB,EAACI,cAAAoB,EAAS,CAAAC,SAAU,MACnBzB,EAAAI,cAACV,EAAiB,CACVwB,UAAWA,EACXN,SAAUA,EACVH,OAAQA,EACRU,QAASA,EACTC,cAAeA,EACfC,WAAYA,EACZP,SAAUC,EAGR,aAAcL,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeL,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
|
|
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 onScreenUpdate,\n children,\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 baseCdnUrl,\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 baseCdnUrl={baseCdnUrl}\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 'onScreenUpdate.prop': onScreenUpdate,\n }}\n >\n\t\t\t\t{children}\n\t\t\t</DescopeWC>\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","onScreenUpdate","children","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","baseCdnUrl","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,WAMrBK,EAAUP,EAAMC,YACpB,EAEIO,SACAC,YACAC,UACAC,UACAC,SACAC,SACAC,QACAC,SACAC,QACAC,SACAC,OACAC,eACAC,cACAC,YACAC,iBACAC,iBACAC,mBACAC,UACAC,iBACAC,YAEFxB,KAEA,MAAOyB,EAAUC,GAAeC,EAAS,MAEzCC,EAAoB5B,GAAK,IAAMyB,IAE/B,MAAMI,UACJA,EAASC,QACTA,EAAOC,cACPA,EAAaC,WACbA,EAAUC,2BACVA,EAA0BC,qCAC1BA,EAAoCC,IACpCA,GACEtC,EAAMuC,WAAWC,GAEfC,EAAgBC,GACpB1D,MAAO2D,UAGCL,EAAIzC,WAAWH,MAAMkD,aACzB,CAAA,EACA,IAAIC,SAASC,KAAKC,UAAUJ,EAAEK,UAE5BvC,GACFA,EAAUkC,EACX,GAEH,CAAClC,IA8CH,OA3CAwC,GAAU,KACR,MAAMC,EAAMtB,EAKZ,OAJAsB,SAAAA,EAAKC,iBAAiB,UAAWV,GAC7B/B,IAASwC,SAAAA,EAAKC,iBAAiB,QAASzC,IACxCC,IAASuC,SAAAA,EAAKC,iBAAiB,QAASxC,IAErC,KACDD,IAASwC,SAAAA,EAAKE,oBAAoB,QAAS1C,IAC3CC,IAASuC,SAAAA,EAAKE,oBAAoB,QAASzC,IAE/CuC,SAAAA,EAAKE,oBAAoB,UAAWX,EAAc,CACnD,GACA,CAACb,EAAUlB,EAAS+B,IAGvBQ,GAAU,KACR,MAAMC,EAAMtB,EAEZ,OADAsB,SAAAA,EAAKC,iBAAiB,UAAWV,GAC1B,KACLS,SAAAA,EAAKE,oBAAoB,UAAWX,EAAc,CACnD,GACA,CAACb,EAAUa,IAGdQ,GAAU,KACR,MAAMC,EAAMtB,EAGZ,OAFIlB,IAASwC,SAAAA,EAAKC,iBAAiB,QAASzC,IAErC,KACDA,IAASwC,SAAAA,EAAKE,oBAAoB,QAAS1C,GAAQ,CACxD,GACA,CAACkB,EAAUlB,IAGduC,GAAU,KACR,MAAMC,EAAMtB,EAGZ,OAFIjB,IAASuC,SAAAA,EAAKC,iBAAiB,QAASxC,IAErC,KACDA,IAASuC,SAAAA,EAAKE,oBAAoB,QAASzC,GAAQ,CACxD,GACA,CAACiB,EAAUjB,IASjBX,EAAAI,cAAA,OAAA,KACCJ,EAAAI,cAACiD,EAAQ,CAACC,SAAU,MACnBtD,EAACI,cAAAtB,EACQ,CAAAkD,UAAWA,EACXxB,OAAQA,EACRyB,QAASA,EACTC,cAAeA,EACfC,WAAYA,EACZhC,IAAK0B,EACLV,aAAcA,EACdC,YAAaA,EACbC,UAAWA,EACXI,QAASA,EACTH,eAAgBA,EAChBC,eAAgBA,EAChBc,qCACEA,EAEFxB,OAAQA,EAGN,aAAcC,EACd,cAAeC,EACf,YAAaG,EACb,cAAeD,EACf,aAAcD,EACd,qCAAsCoB,EAEtC,wBAAyBZ,EACzB,cAAeZ,EACf,sBAAuBc,GAGhCC,IAIC"}
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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\t<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, baseCdnUrl } =\n React.useContext(Context);\n\n return (\n\t<Suspense fallback={null}>\n\t\t<RoleManagementWC\n projectId={projectId}\n widgetId={widgetId}\n tenant={tenant}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n baseCdnUrl={baseCdnUrl}\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);\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","baseCdnUrl","useContext","Context","Suspense","fallback"],"mappings":"mKAMA,MAAMA,EAAmBC,GAAKC,gBACtBC,OAAO,mCAEN,CACLC,QAASC,EACPC,EAAMC,YAAwB,CAACC,EAAOC,IAC3CH,EAAgCI,cAAA,iCAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAMzCK,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,EAAaC,WAAEA,GACzCrB,EAAMsB,WAAWC,GAEnB,OACHvB,EAACI,cAAAoB,EAAS,CAAAC,SAAU,MACnBzB,EAAAI,cAACV,EAAgB,CACTwB,UAAWA,EACXN,SAAUA,EACVH,OAAQA,EACRU,QAASA,EACTC,cAAeA,EACfC,WAAYA,EACZP,SAAUC,EAGR,aAAcL,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeL,IAIrB"}
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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\t<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, baseCdnUrl } =\n React.useContext(Context);\n\n return (\n\t<Suspense fallback={null}>\n\t\t<UserManagementWC\n projectId={projectId}\n widgetId={widgetId}\n tenant={tenant}\n baseUrl={baseUrl}\n baseStaticUrl={baseStaticUrl}\n baseCdnUrl={baseCdnUrl}\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 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","baseCdnUrl","useContext","Context","Suspense","fallback"],"mappings":"mKAMA,MAAMA,EAAmBC,GAAKC,gBACtBC,OAAO,mCAEN,CACLC,QAASC,EACPC,EAAMC,YAAwB,CAACC,EAAOC,IAC3CH,EAAgCI,cAAA,iCAAAC,OAAAC,OAAA,CAAAH,IAAKA,GAASD,WAMzCK,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,EAAaC,WAAEA,GACzCrB,EAAMsB,WAAWC,GAEnB,OACHvB,EAACI,cAAAoB,EAAS,CAAAC,SAAU,MACnBzB,EAAAI,cAACV,EAAgB,CACTwB,UAAWA,EACXN,SAAUA,EACVH,OAAQA,EACRU,QAASA,EACTC,cAAeA,EACfC,WAAYA,EACZlB,IAAKY,EAGH,aAAcL,EACd,aAAcC,EACd,eAAgBE,EAEhB,cAAeL,IAIrB"}
|
package/dist/esm/constants.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.
|
|
1
|
+
const e={"x-descope-sdk-name":"react","x-descope-sdk-version":"2.6.1"},d="undefined"!=typeof window;export{d as IS_BROWSER,e as baseHeaders};
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -538,7 +538,7 @@ declare const createSdkWrapper: <P extends Omit<{
|
|
|
538
538
|
finishNative: (provider: string, stateId: string, user?: string, code?: string, idToken?: string) => Promise<_1.SdkResponse<_1.ResponseData>>;
|
|
539
539
|
};
|
|
540
540
|
saml: {
|
|
541
|
-
start: (tenantIdOrEmail: string, redirectUrl?: string, loginOptions?: _1.LoginOptions, token?: string) => Promise<_1.SdkResponse<_1.URLResponse>>;
|
|
541
|
+
start: (tenantIdOrEmail: string, redirectUrl?: string, loginOptions?: _1.LoginOptions, token?: string, ssoId?: string) => Promise<_1.SdkResponse<_1.URLResponse>>;
|
|
542
542
|
exchange: (code: string) => Promise<_1.SdkResponse<_1.JWTResponse>>;
|
|
543
543
|
};
|
|
544
544
|
totp: {
|
|
@@ -1148,7 +1148,7 @@ declare const createSdkWrapper: <P extends Omit<{
|
|
|
1148
1148
|
finishNative: (provider: string, stateId: string, user?: string, code?: string, idToken?: string) => Promise<_1.SdkResponse<_1.ResponseData>>;
|
|
1149
1149
|
};
|
|
1150
1150
|
saml: {
|
|
1151
|
-
start: (tenantIdOrEmail: string, redirectUrl?: string, loginOptions?: _1.LoginOptions, token?: string) => Promise<_1.SdkResponse<_1.URLResponse>>;
|
|
1151
|
+
start: (tenantIdOrEmail: string, redirectUrl?: string, loginOptions?: _1.LoginOptions, token?: string, ssoId?: string) => Promise<_1.SdkResponse<_1.URLResponse>>;
|
|
1152
1152
|
exchange: (code: string) => Promise<_1.SdkResponse<_1.JWTResponse>>;
|
|
1153
1153
|
};
|
|
1154
1154
|
totp: {
|
|
@@ -1316,7 +1316,7 @@ declare const getJwtPermissions: (token?: any, tenant?: string) => string[];
|
|
|
1316
1316
|
declare const getJwtRoles: (token?: any, tenant?: string) => string[];
|
|
1317
1317
|
declare const refresh: (token?: string) => Promise<_1.SdkResponse<_1.JWTResponse>>;
|
|
1318
1318
|
|
|
1319
|
-
declare
|
|
1319
|
+
declare global {
|
|
1320
1320
|
namespace JSX {
|
|
1321
1321
|
interface IntrinsicElements {
|
|
1322
1322
|
['descope-wc']: DescopeCustomElement;
|