@descope/react-sdk 2.13.2 → 2.14.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/Descope.js +1 -1
- package/dist/cjs/components/Descope.js.map +1 -1
- package/dist/cjs/constants.js +1 -1
- package/dist/esm/components/Descope.js +1 -1
- package/dist/esm/components/Descope.js.map +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/index.d.ts +29 -3
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/types/sdk.d.ts +81 -9
- package/dist/types/types.d.ts +2 -0
- package/package.json +10 -10
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../constants.js"),r=require("../hooks/Context.js"),s=require("../sdk.js"),n=require("./withPropsMapping/index.js");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../constants.js"),r=require("../hooks/Context.js"),s=require("../sdk.js"),n=require("./withPropsMapping/index.js");function o(e){return e&&e.__esModule?e:{default:e}}var a=o(e);const l=e.lazy((async()=>(((null===customElements||void 0===customElements?void 0:customElements.get("descope-wc"))||await import("@descope/web-component").then((e=>e.default))).sdkConfigOverrides={baseHeaders:t.baseHeaders,persistTokens:!1,hooks:{get beforeRequest(){return s.getGlobalSdk().httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:n.default(a.default.forwardRef(((e,t)=>a.default.createElement("descope-wc",Object.assign({ref:t},e)))))}))),u=a.default.forwardRef((({flowId:t,onSuccess:s,onError:n,onReady:o,logger:u,tenant:d,theme:c,nonce:i,locale:f,debug:p,client:m,form:v,telemetryKey:E,redirectUrl:b,autoFocus:h,validateOnBlur:L,restartOnError:g,errorTransformer:k,styleId:y,onScreenUpdate:U,dismissScreenErrorOnInput:w,outboundAppId:S,outboundAppScopes:C,children:q},I)=>{const[O,j]=e.useState(null);e.useImperativeHandle(I,(()=>O));const{projectId:R,baseUrl:A,baseStaticUrl:x,baseCdnUrl:_,storeLastAuthenticatedUser:H,keepLastAuthenticatedUserAfterLogout:M,refreshCookieName:N,sdk:T}=a.default.useContext(r.default),B=e.useCallback((async e=>{await T.httpClient.hooks.afterRequest({},new Response(JSON.stringify(e.detail))),s&&s(e)}),[s]);return e.useEffect((()=>{const e=O;return null==e||e.addEventListener("success",B),n&&(null==e||e.addEventListener("error",n)),o&&(null==e||e.addEventListener("ready",o)),()=>{n&&(null==e||e.removeEventListener("error",n)),o&&(null==e||e.removeEventListener("ready",o)),null==e||e.removeEventListener("success",B)}}),[O,n,B]),e.useEffect((()=>{const e=O;return null==e||e.addEventListener("success",B),()=>{null==e||e.removeEventListener("success",B)}}),[O,B]),e.useEffect((()=>{const e=O;return n&&(null==e||e.addEventListener("error",n)),()=>{n&&(null==e||e.removeEventListener("error",n))}}),[O,n]),e.useEffect((()=>{const e=O;return o&&(null==e||e.addEventListener("ready",o)),()=>{o&&(null==e||e.removeEventListener("error",o))}}),[O,o]),a.default.createElement("form",null,a.default.createElement(e.Suspense,{fallback:null},a.default.createElement(l,{projectId:R,flowId:t,baseUrl:A,baseStaticUrl:x,baseCdnUrl:_,ref:j,telemetryKey:E,redirectUrl:b,autoFocus:h,styleId:y,validateOnBlur:L,restartOnError:g,keepLastAuthenticatedUserAfterLogout:M,tenant:d,"theme.attr":c,"nonce.attr":i,"locale.attr":f,"form.attr":v,"client.attr":m,"debug.attr":p,"outbound-app-id.attr":S,"outbound-app-scopes.attr":C,"store-last-authenticated-user.attr":H,"refreshCookieName.attr":N,"dismiss-screen-error-on-input.attr":w,"errorTransformer.prop":k,"logger.prop":u,"onScreenUpdate.prop":U},q)))}));exports.default=u;
|
|
2
2
|
//# sourceMappingURL=Descope.js.map
|
|
@@ -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\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 nonce,\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 dismissScreenErrorOnInput,\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 refreshCookieName,\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 'nonce.attr': nonce,\n 'locale.attr': locale,\n 'form.attr': form,\n 'client.attr': client,\n 'debug.attr': debug,\n 'store-last-authenticated-user.attr': storeLastAuthenticatedUser,\n 'refreshCookieName.attr': refreshCookieName,\n 'dismiss-screen-error-on-input.attr': dismissScreenErrorOnInput,\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","nonce","locale","debug","client","form","telemetryKey","redirectUrl","autoFocus","validateOnBlur","restartOnError","errorTransformer","styleId","onScreenUpdate","dismissScreenErrorOnInput","children","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","baseCdnUrl","storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout","refreshCookieName","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,EAAAA,QAAMC,YACpB,EAEIO,SACAC,YACAC,UACAC,UACAC,SACAC,SACAC,QACAC,QACAC,SACAC,QACAC,SACAC,OACAC,eACAC,cACAC,YACAC,iBACAC,iBACAC,mBACAC,UACAC,iBACAC,4BACAC,
|
|
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 nonce,\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 dismissScreenErrorOnInput,\n outboundAppId,\n outboundAppScopes,\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 refreshCookieName,\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 'nonce.attr': nonce,\n 'locale.attr': locale,\n 'form.attr': form,\n 'client.attr': client,\n 'debug.attr': debug,\n 'outbound-app-id.attr': outboundAppId,\n 'outbound-app-scopes.attr': outboundAppScopes,\n 'store-last-authenticated-user.attr': storeLastAuthenticatedUser,\n 'refreshCookieName.attr': refreshCookieName,\n 'dismiss-screen-error-on-input.attr': dismissScreenErrorOnInput,\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","nonce","locale","debug","client","form","telemetryKey","redirectUrl","autoFocus","validateOnBlur","restartOnError","errorTransformer","styleId","onScreenUpdate","dismissScreenErrorOnInput","outboundAppId","outboundAppScopes","children","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","baseCdnUrl","storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout","refreshCookieName","sdk","useContext","Context","handleSuccess","useCallback","e","afterRequest","Response","JSON","stringify","detail","useEffect","ele","addEventListener","removeEventListener","Suspense","fallback"],"mappings":"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"}
|
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.14.1"};
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e,{lazy as t,useState as r,useImperativeHandle as n,useCallback as
|
|
1
|
+
import e,{lazy as t,useState as r,useImperativeHandle as n,useCallback as o,useEffect as s,Suspense as a}from"react";import{baseHeaders as l}from"../constants.js";import u from"../hooks/Context.js";import{getGlobalSdk as d}from"../sdk.js";import c from"./withPropsMapping/index.js";const i=t((async()=>(((null===customElements||void 0===customElements?void 0:customElements.get("descope-wc"))||await import("@descope/web-component").then((e=>e.default))).sdkConfigOverrides={baseHeaders:l,persistTokens:!1,hooks:{get beforeRequest(){return d().httpClient.hooks.beforeRequest},set beforeRequest(e){}}},{default:c(e.forwardRef(((t,r)=>e.createElement("descope-wc",Object.assign({ref:r},t)))))}))),p=e.forwardRef((({flowId:t,onSuccess:l,onError:d,onReady:c,logger:p,tenant:m,theme:f,nonce:v,locale:E,debug:b,client:h,form:L,telemetryKey:g,redirectUrl:k,autoFocus:y,validateOnBlur:U,restartOnError:w,errorTransformer:C,styleId:I,onScreenUpdate:O,dismissScreenErrorOnInput:R,outboundAppId:S,outboundAppScopes:j,children:A},q)=>{const[x,N]=r(null);n(q,(()=>x));const{projectId:T,baseUrl:B,baseStaticUrl:F,baseCdnUrl:K,storeLastAuthenticatedUser:H,keepLastAuthenticatedUserAfterLogout:J,refreshCookieName:M,sdk:P}=e.useContext(u),z=o((async e=>{await P.httpClient.hooks.afterRequest({},new Response(JSON.stringify(e.detail))),l&&l(e)}),[l]);return s((()=>{const e=x;return null==e||e.addEventListener("success",z),d&&(null==e||e.addEventListener("error",d)),c&&(null==e||e.addEventListener("ready",c)),()=>{d&&(null==e||e.removeEventListener("error",d)),c&&(null==e||e.removeEventListener("ready",c)),null==e||e.removeEventListener("success",z)}}),[x,d,z]),s((()=>{const e=x;return null==e||e.addEventListener("success",z),()=>{null==e||e.removeEventListener("success",z)}}),[x,z]),s((()=>{const e=x;return d&&(null==e||e.addEventListener("error",d)),()=>{d&&(null==e||e.removeEventListener("error",d))}}),[x,d]),s((()=>{const e=x;return c&&(null==e||e.addEventListener("ready",c)),()=>{c&&(null==e||e.removeEventListener("error",c))}}),[x,c]),e.createElement("form",null,e.createElement(a,{fallback:null},e.createElement(i,{projectId:T,flowId:t,baseUrl:B,baseStaticUrl:F,baseCdnUrl:K,ref:N,telemetryKey:g,redirectUrl:k,autoFocus:y,styleId:I,validateOnBlur:U,restartOnError:w,keepLastAuthenticatedUserAfterLogout:J,tenant:m,"theme.attr":f,"nonce.attr":v,"locale.attr":E,"form.attr":L,"client.attr":h,"debug.attr":b,"outbound-app-id.attr":S,"outbound-app-scopes.attr":j,"store-last-authenticated-user.attr":H,"refreshCookieName.attr":M,"dismiss-screen-error-on-input.attr":R,"errorTransformer.prop":C,"logger.prop":p,"onScreenUpdate.prop":O},A)))}));export{p as default};
|
|
2
2
|
//# sourceMappingURL=Descope.js.map
|
|
@@ -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\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 nonce,\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 dismissScreenErrorOnInput,\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 refreshCookieName,\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 'nonce.attr': nonce,\n 'locale.attr': locale,\n 'form.attr': form,\n 'client.attr': client,\n 'debug.attr': debug,\n 'store-last-authenticated-user.attr': storeLastAuthenticatedUser,\n 'refreshCookieName.attr': refreshCookieName,\n 'dismiss-screen-error-on-input.attr': dismissScreenErrorOnInput,\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","nonce","locale","debug","client","form","telemetryKey","redirectUrl","autoFocus","validateOnBlur","restartOnError","errorTransformer","styleId","onScreenUpdate","dismissScreenErrorOnInput","children","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","baseCdnUrl","storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout","refreshCookieName","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,QACAC,SACAC,QACAC,SACAC,OACAC,eACAC,cACAC,YACAC,iBACAC,iBACAC,mBACAC,UACAC,iBACAC,4BACAC,
|
|
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 nonce,\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 dismissScreenErrorOnInput,\n outboundAppId,\n outboundAppScopes,\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 refreshCookieName,\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 'nonce.attr': nonce,\n 'locale.attr': locale,\n 'form.attr': form,\n 'client.attr': client,\n 'debug.attr': debug,\n 'outbound-app-id.attr': outboundAppId,\n 'outbound-app-scopes.attr': outboundAppScopes,\n 'store-last-authenticated-user.attr': storeLastAuthenticatedUser,\n 'refreshCookieName.attr': refreshCookieName,\n 'dismiss-screen-error-on-input.attr': dismissScreenErrorOnInput,\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","nonce","locale","debug","client","form","telemetryKey","redirectUrl","autoFocus","validateOnBlur","restartOnError","errorTransformer","styleId","onScreenUpdate","dismissScreenErrorOnInput","outboundAppId","outboundAppScopes","children","innerRef","setInnerRef","useState","useImperativeHandle","projectId","baseUrl","baseStaticUrl","baseCdnUrl","storeLastAuthenticatedUser","keepLastAuthenticatedUserAfterLogout","refreshCookieName","sdk","useContext","Context","handleSuccess","useCallback","e","afterRequest","Response","JSON","stringify","detail","useEffect","ele","addEventListener","removeEventListener","Suspense","fallback"],"mappings":"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"}
|
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.14.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
|
@@ -121,7 +121,9 @@ declare const createSdkWrapper: <P extends Omit<{
|
|
|
121
121
|
};
|
|
122
122
|
thirdPartyAppStateId?: string;
|
|
123
123
|
applicationScopes?: string;
|
|
124
|
-
|
|
124
|
+
outboundAppId?: string;
|
|
125
|
+
outboundAppScopes?: string[];
|
|
126
|
+
}, "tenant" | "redirectUrl" | "redirectAuth" | "oidcIdpStateId" | "samlIdpStateId" | "samlIdpUsername" | "ssoAppId" | "thirdPartyAppId" | "oidcLoginHint" | "preview" | "abTestingKey" | "client" | "locale" | "oidcPrompt" | "oidcErrorRedirectUri" | "nativeOptions" | "thirdPartyAppStateId" | "applicationScopes" | "outboundAppId" | "outboundAppScopes"> & {
|
|
125
127
|
lastAuth?: Omit<{
|
|
126
128
|
authMethod?: "webauthn" | "otp" | "oauth" | "saml" | "totp" | "magiclink" | "enchantedlink";
|
|
127
129
|
oauthProvider?: string;
|
|
@@ -574,6 +576,12 @@ declare const createSdkWrapper: <P extends Omit<{
|
|
|
574
576
|
}>>;
|
|
575
577
|
exchangeOneTapIDToken: (provider: string, idToken: string, nonce: string, loginOptions?: _1.LoginOptions) => Promise<_1.SdkResponse<_1.JWTResponse>>;
|
|
576
578
|
};
|
|
579
|
+
outbound: {
|
|
580
|
+
connect: (appId: string, options?: {
|
|
581
|
+
redirectURL?: string;
|
|
582
|
+
scopes?: string[];
|
|
583
|
+
}, token?: string) => Promise<_1.SdkResponse<_1.URLResponse>>;
|
|
584
|
+
};
|
|
577
585
|
saml: {
|
|
578
586
|
start: (tenantIdOrEmail: string, redirectUrl?: string, loginOptions?: _1.LoginOptions, token?: string, ssoId?: string) => Promise<_1.SdkResponse<_1.URLResponse>>;
|
|
579
587
|
exchange: (code: string) => Promise<_1.SdkResponse<_1.JWTResponse>>;
|
|
@@ -766,7 +774,9 @@ declare const createSdkWrapper: <P extends Omit<{
|
|
|
766
774
|
};
|
|
767
775
|
thirdPartyAppStateId?: string;
|
|
768
776
|
applicationScopes?: string;
|
|
769
|
-
|
|
777
|
+
outboundAppId?: string;
|
|
778
|
+
outboundAppScopes?: string[];
|
|
779
|
+
}, "tenant" | "redirectUrl" | "redirectAuth" | "oidcIdpStateId" | "samlIdpStateId" | "samlIdpUsername" | "ssoAppId" | "thirdPartyAppId" | "oidcLoginHint" | "preview" | "abTestingKey" | "client" | "locale" | "oidcPrompt" | "oidcErrorRedirectUri" | "nativeOptions" | "thirdPartyAppStateId" | "applicationScopes" | "outboundAppId" | "outboundAppScopes"> & {
|
|
770
780
|
lastAuth?: Omit<{
|
|
771
781
|
authMethod?: "webauthn" | "otp" | "oauth" | "saml" | "totp" | "magiclink" | "enchantedlink";
|
|
772
782
|
oauthProvider?: string;
|
|
@@ -1219,6 +1229,12 @@ declare const createSdkWrapper: <P extends Omit<{
|
|
|
1219
1229
|
}>>;
|
|
1220
1230
|
exchangeOneTapIDToken: (provider: string, idToken: string, nonce: string, loginOptions?: _1.LoginOptions) => Promise<_1.SdkResponse<_1.JWTResponse>>;
|
|
1221
1231
|
};
|
|
1232
|
+
outbound: {
|
|
1233
|
+
connect: (appId: string, options?: {
|
|
1234
|
+
redirectURL?: string;
|
|
1235
|
+
scopes?: string[];
|
|
1236
|
+
}, token?: string) => Promise<_1.SdkResponse<_1.URLResponse>>;
|
|
1237
|
+
};
|
|
1222
1238
|
saml: {
|
|
1223
1239
|
start: (tenantIdOrEmail: string, redirectUrl?: string, loginOptions?: _1.LoginOptions, token?: string, ssoId?: string) => Promise<_1.SdkResponse<_1.URLResponse>>;
|
|
1224
1240
|
exchange: (code: string) => Promise<_1.SdkResponse<_1.JWTResponse>>;
|
|
@@ -1411,7 +1427,9 @@ declare const createSdkWrapper: <P extends Omit<{
|
|
|
1411
1427
|
};
|
|
1412
1428
|
thirdPartyAppStateId?: string;
|
|
1413
1429
|
applicationScopes?: string;
|
|
1414
|
-
|
|
1430
|
+
outboundAppId?: string;
|
|
1431
|
+
outboundAppScopes?: string[];
|
|
1432
|
+
}, "tenant" | "redirectUrl" | "redirectAuth" | "oidcIdpStateId" | "samlIdpStateId" | "samlIdpUsername" | "ssoAppId" | "thirdPartyAppId" | "oidcLoginHint" | "preview" | "abTestingKey" | "client" | "locale" | "oidcPrompt" | "oidcErrorRedirectUri" | "nativeOptions" | "thirdPartyAppStateId" | "applicationScopes" | "outboundAppId" | "outboundAppScopes"> & {
|
|
1415
1433
|
lastAuth?: Omit<{
|
|
1416
1434
|
authMethod?: "webauthn" | "otp" | "oauth" | "saml" | "totp" | "magiclink" | "enchantedlink";
|
|
1417
1435
|
oauthProvider?: string;
|
|
@@ -1864,6 +1882,12 @@ declare const createSdkWrapper: <P extends Omit<{
|
|
|
1864
1882
|
}>>;
|
|
1865
1883
|
exchangeOneTapIDToken: (provider: string, idToken: string, nonce: string, loginOptions?: _1.LoginOptions) => Promise<_1.SdkResponse<_1.JWTResponse>>;
|
|
1866
1884
|
};
|
|
1885
|
+
outbound: {
|
|
1886
|
+
connect: (appId: string, options?: {
|
|
1887
|
+
redirectURL?: string;
|
|
1888
|
+
scopes?: string[];
|
|
1889
|
+
}, token?: string) => Promise<_1.SdkResponse<_1.URLResponse>>;
|
|
1890
|
+
};
|
|
1867
1891
|
saml: {
|
|
1868
1892
|
start: (tenantIdOrEmail: string, redirectUrl?: string, loginOptions?: _1.LoginOptions, token?: string, ssoId?: string) => Promise<_1.SdkResponse<_1.URLResponse>>;
|
|
1869
1893
|
exchange: (code: string) => Promise<_1.SdkResponse<_1.JWTResponse>>;
|
|
@@ -2089,6 +2113,8 @@ type DescopeProps = {
|
|
|
2089
2113
|
debug?: boolean;
|
|
2090
2114
|
telemetryKey?: string;
|
|
2091
2115
|
redirectUrl?: string;
|
|
2116
|
+
outboundAppId?: string;
|
|
2117
|
+
outboundAppScopes?: string[];
|
|
2092
2118
|
errorTransformer?: (error: {
|
|
2093
2119
|
text: string;
|
|
2094
2120
|
type: string;
|