@descope/react-sdk 2.3.4 → 2.3.5
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/README.md +8 -0
- package/dist/cjs/components/AccessKeyManagement.js +2 -0
- package/dist/cjs/components/AccessKeyManagement.js.map +1 -0
- package/dist/cjs/components/ApplicationsPortal.js +2 -0
- package/dist/cjs/components/ApplicationsPortal.js.map +1 -0
- package/dist/cjs/components/AuditManagement.js +2 -0
- package/dist/cjs/components/AuditManagement.js.map +1 -0
- package/dist/cjs/components/AuthProvider/AuthProvider.js +2 -0
- package/dist/cjs/components/AuthProvider/AuthProvider.js.map +1 -0
- package/dist/cjs/components/AuthProvider/useSdk.js +2 -0
- package/dist/cjs/components/AuthProvider/useSdk.js.map +1 -0
- package/dist/cjs/components/DefaultFlows.js +2 -0
- package/dist/cjs/components/DefaultFlows.js.map +1 -0
- package/dist/cjs/components/Descope.js +2 -0
- package/dist/cjs/components/Descope.js.map +1 -0
- package/dist/cjs/components/RoleManagement.js +2 -0
- package/dist/cjs/components/RoleManagement.js.map +1 -0
- package/dist/cjs/components/UserManagement.js +2 -0
- package/dist/cjs/components/UserManagement.js.map +1 -0
- package/dist/cjs/components/UserProfile.js +2 -0
- package/dist/cjs/components/UserProfile.js.map +1 -0
- package/dist/cjs/constants.js +2 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/flows.js +2 -0
- package/dist/cjs/flows.js.map +1 -0
- package/dist/cjs/hooks/Context.js +2 -0
- package/dist/cjs/hooks/Context.js.map +1 -0
- package/dist/cjs/hooks/useContext.js +2 -0
- package/dist/cjs/hooks/useContext.js.map +1 -0
- package/dist/cjs/hooks/useDescope.js +2 -0
- package/dist/cjs/hooks/useDescope.js.map +1 -0
- package/dist/cjs/hooks/useSession.js +2 -0
- package/dist/cjs/hooks/useSession.js.map +1 -0
- package/dist/cjs/hooks/useUser.js +2 -0
- package/dist/cjs/hooks/useUser.js.map +1 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/sdk.js +2 -0
- package/dist/cjs/sdk.js.map +1 -0
- package/dist/cjs/utils.js +2 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/esm/components/AccessKeyManagement.js +2 -0
- package/dist/esm/components/AccessKeyManagement.js.map +1 -0
- package/dist/esm/components/ApplicationsPortal.js +2 -0
- package/dist/esm/components/ApplicationsPortal.js.map +1 -0
- package/dist/esm/components/AuditManagement.js +2 -0
- package/dist/esm/components/AuditManagement.js.map +1 -0
- package/dist/esm/components/AuthProvider/AuthProvider.js +2 -0
- package/dist/esm/components/AuthProvider/AuthProvider.js.map +1 -0
- package/dist/esm/components/AuthProvider/useSdk.js +2 -0
- package/dist/esm/components/AuthProvider/useSdk.js.map +1 -0
- package/dist/esm/components/DefaultFlows.js +2 -0
- package/dist/esm/components/DefaultFlows.js.map +1 -0
- package/dist/esm/components/Descope.js +2 -0
- package/dist/esm/components/Descope.js.map +1 -0
- package/dist/esm/components/RoleManagement.js +2 -0
- package/dist/esm/components/RoleManagement.js.map +1 -0
- package/dist/esm/components/UserManagement.js +2 -0
- package/dist/esm/components/UserManagement.js.map +1 -0
- package/dist/esm/components/UserProfile.js +2 -0
- package/dist/esm/components/UserProfile.js.map +1 -0
- package/dist/esm/constants.js +2 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/flows.js +2 -0
- package/dist/esm/flows.js.map +1 -0
- package/dist/esm/hooks/Context.js +2 -0
- package/dist/esm/hooks/Context.js.map +1 -0
- package/dist/esm/hooks/useContext.js +2 -0
- package/dist/esm/hooks/useContext.js.map +1 -0
- package/dist/esm/hooks/useDescope.js +2 -0
- package/dist/esm/hooks/useDescope.js.map +1 -0
- package/dist/esm/hooks/useSession.js +2 -0
- package/dist/esm/hooks/useSession.js.map +1 -0
- package/dist/esm/hooks/useUser.js +2 -0
- package/dist/esm/hooks/useUser.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/sdk.js +2 -0
- package/dist/esm/sdk.js.map +1 -0
- package/dist/esm/utils.js +2 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/index.d.ts +24 -54
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/{dts/src → types}/components/AccessKeyManagement.d.ts +1 -6
- package/dist/{dts/src → types}/components/ApplicationsPortal.d.ts +1 -6
- package/dist/{dts/src → types}/components/AuditManagement.d.ts +1 -6
- package/dist/{dts/src → types}/components/RoleManagement.d.ts +1 -6
- package/dist/{dts/src → types}/components/UserManagement.d.ts +1 -6
- package/dist/{dts/src → types}/components/UserProfile.d.ts +1 -6
- package/dist/{dts/src/index.d.ts → types/flows.d.ts} +0 -6
- package/dist/types/index.d.ts +2 -0
- package/dist/types/widgets.d.ts +6 -0
- package/package.json +30 -17
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/index.cjs.js.map +0 -1
- package/dist/index.esm.js +0 -2
- package/dist/index.esm.js.map +0 -1
- /package/dist/{dts/src → types}/components/AuthProvider/AuthProvider.d.ts +0 -0
- /package/dist/{dts/src → types}/components/AuthProvider/index.d.ts +0 -0
- /package/dist/{dts/src → types}/components/AuthProvider/useSdk.d.ts +0 -0
- /package/dist/{dts/src → types}/components/DefaultFlows.d.ts +0 -0
- /package/dist/{dts/src → types}/components/Descope.d.ts +0 -0
- /package/dist/{dts/src → types}/constants.d.ts +0 -0
- /package/dist/{dts/src → types}/hooks/Context.d.ts +0 -0
- /package/dist/{dts/src → types}/hooks/useContext.d.ts +0 -0
- /package/dist/{dts/src → types}/hooks/useDescope.d.ts +0 -0
- /package/dist/{dts/src → types}/hooks/useSession.d.ts +0 -0
- /package/dist/{dts/src → types}/hooks/useUser.d.ts +0 -0
- /package/dist/{dts/src → types}/sdk.d.ts +0 -0
- /package/dist/{dts/src → types}/types.d.ts +0 -0
- /package/dist/{dts/src → types}/utils.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDescope.js","sources":["../../../src/hooks/useDescope.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { Sdk } from '../types';\nimport useContext from './useContext';\nimport { createTempSdk } from '../sdk';\n\nconst generateErrorMsg = (entryType: string) =>\n `You can only use this ${entryType} after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component`;\n\n// handler which throw an error for every SDK function\nconst proxyThrowHandler = {\n // eslint-disable-next-line prefer-arrow/prefer-arrow-functions\n get(target: Record<string, any>, key: string) {\n if (typeof target[key] === 'object' && target[key] !== null) {\n return new Proxy(target[key], proxyThrowHandler);\n }\n\n if (typeof target[key] === 'function') {\n return () => {\n throw Error(generateErrorMsg('function'));\n };\n }\n\n throw Error(generateErrorMsg('attribute'));\n },\n};\n\nconst useDescope = (): Sdk => {\n const { sdk } = useContext();\n\n return useMemo(() => {\n if (!sdk) {\n // In case the SDK is not initialized, we want to throw an error when the SDK functions are called\n return new Proxy(createTempSdk(), proxyThrowHandler) as Sdk;\n }\n\n return sdk;\n }, [sdk]);\n};\n\nexport default useDescope;\n"],"names":["generateErrorMsg","entryType","proxyThrowHandler","get","target","key","Proxy","Error","useDescope","sdk","useContext","useMemo","createTempSdk"],"mappings":"yGAKA,MAAMA,EAAoBC,GACxB,yBAAyBA,4FAGrBC,EAAoB,CAExB,GAAAC,CAAIC,EAA6BC,GAC/B,GAA2B,iBAAhBD,EAAOC,IAAqC,OAAhBD,EAAOC,GAC5C,OAAO,IAAIC,MAAMF,EAAOC,GAAMH,GAGhC,GAA2B,mBAAhBE,EAAOC,GAChB,MAAO,KACL,MAAME,MAAMP,EAAiB,YAAY,EAI7C,MAAMO,MAAMP,EAAiB,aAC9B,GAGGQ,EAAa,KACjB,MAAMC,IAAEA,GAAQC,IAEhB,OAAOC,GAAQ,IACRF,GAEI,IAAIH,MAAMM,IAAiBV,IAInC,CAACO,GAAK"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useRef as s,useMemo as e,useEffect as t}from"react";import n from"./useContext.js";const o=()=>{const{session:o,isSessionLoading:i,fetchSession:r,isSessionFetched:c}=n(),u=s(i);e((()=>{u.current=i}),[i]);const a=!o&&!i;return e((()=>{a&&!c&&(u.current=!0)}),[c]),t((()=>{a&&r()}),[r]),{isSessionLoading:u.current,sessionToken:o,isAuthenticated:!!o}};export{o as default};
|
|
2
|
+
//# sourceMappingURL=useSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSession.js","sources":["../../../src/hooks/useSession.ts"],"sourcesContent":["import { useEffect, useMemo, useRef } from 'react';\nimport useContext from './useContext';\n\nconst useSession = () => {\n const { session, isSessionLoading, fetchSession, isSessionFetched } =\n useContext();\n\n // when session should be received, we want the return value of \"isSessionLoading\" to be true starting from the first call\n // (and not only when receiving an update from the context)\n const isLoading = useRef(isSessionLoading);\n\n // we want this to happen before returning a value so we are using \"useMemo\" and not \"useEffect\"\n useMemo(() => {\n isLoading.current = isSessionLoading;\n }, [isSessionLoading]);\n\n const shouldFetchSession = !session && !isSessionLoading;\n\n // we want this to happen before returning a value so we are using \"useMemo\" and not \"useEffect\"\n useMemo(() => {\n if (shouldFetchSession && !isSessionFetched) {\n isLoading.current = true;\n }\n }, [isSessionFetched]);\n\n // Fetch session if it's not already fetched\n // We want this to happen only once, so the dependency array should not contain shouldFetchSession\n useEffect(() => {\n if (shouldFetchSession) {\n fetchSession();\n }\n }, [fetchSession]);\n return {\n isSessionLoading: isLoading.current,\n sessionToken: session,\n isAuthenticated: !!session,\n };\n};\n\nexport default useSession;\n"],"names":["useSession","session","isSessionLoading","fetchSession","isSessionFetched","useContext","isLoading","useRef","useMemo","current","shouldFetchSession","useEffect","sessionToken","isAuthenticated"],"mappings":"0FAGM,MAAAA,EAAa,KACjB,MAAMC,QAAEA,EAAOC,iBAAEA,EAAgBC,aAAEA,EAAYC,iBAAEA,GAC/CC,IAIIC,EAAYC,EAAOL,GAGzBM,GAAQ,KACNF,EAAUG,QAAUP,CAAgB,GACnC,CAACA,IAEJ,MAAMQ,GAAsBT,IAAYC,EAgBxC,OAbAM,GAAQ,KACFE,IAAuBN,IACzBE,EAAUG,SAAU,EACrB,GACA,CAACL,IAIJO,GAAU,KACJD,GACFP,GACD,GACA,CAACA,IACG,CACLD,iBAAkBI,EAAUG,QAC5BG,aAAcX,EACdY,kBAAmBZ,EACpB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{useState as r,useRef as e,useMemo as s,useEffect as t}from"react";import o from"./useContext.js";const n=()=>{const{user:n,fetchUser:c,isUserLoading:i,session:u,isUserFetched:a}=o(),[d,f]=r(!1),m=e(i),U=s((()=>!n&&!i&&u&&!d),[c,u,d]);return s((()=>{m.current=i}),[i]),s((()=>{U&&!a&&(m.current=!0)}),[U,a]),t((()=>{U&&(f(!0),c())}),[U]),{isUserLoading:m.current,user:n}};export{n as default};
|
|
2
|
+
//# sourceMappingURL=useUser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUser.js","sources":["../../../src/hooks/useUser.ts"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from 'react';\nimport useContext from './useContext';\n\nconst useUser = () => {\n const { user, fetchUser, isUserLoading, session, isUserFetched } =\n useContext();\n const [isInit, setIsInit] = useState(false); // we want to get the user only in the first time we got a session\n\n // when session should be received, we want the return value of \"isUserLoading\" to be true starting from the first call\n // (and not only when receiving an update from the context)\n const isLoading = useRef(isUserLoading);\n\n const shouldFetchUser = useMemo(\n () => !user && !isUserLoading && session && !isInit,\n [fetchUser, session, isInit],\n );\n\n // we want this to happen before returning a value so we are using \"useMemo\" and not \"useEffect\"\n useMemo(() => {\n isLoading.current = isUserLoading;\n }, [isUserLoading]);\n\n // we want this to happen before returning a value so we are using \"useMemo\" and not \"useEffect\"\n useMemo(() => {\n if (shouldFetchUser && !isUserFetched) {\n isLoading.current = true;\n }\n }, [shouldFetchUser, isUserFetched]);\n\n useEffect(() => {\n if (shouldFetchUser) {\n setIsInit(true);\n fetchUser();\n }\n }, [shouldFetchUser]);\n\n return { isUserLoading: isLoading.current, user };\n};\n\nexport default useUser;\n"],"names":["useUser","user","fetchUser","isUserLoading","session","isUserFetched","useContext","isInit","setIsInit","useState","isLoading","useRef","shouldFetchUser","useMemo","current","useEffect"],"mappings":"wGAGM,MAAAA,EAAU,KACd,MAAMC,KAAEA,EAAIC,UAAEA,EAASC,cAAEA,EAAaC,QAAEA,EAAOC,cAAEA,GAC/CC,KACKC,EAAQC,GAAaC,GAAS,GAI/BC,EAAYC,EAAOR,GAEnBS,EAAkBC,GACtB,KAAOZ,IAASE,GAAiBC,IAAYG,GAC7C,CAACL,EAAWE,EAASG,IAsBvB,OAlBAM,GAAQ,KACNH,EAAUI,QAAUX,CAAa,GAChC,CAACA,IAGJU,GAAQ,KACFD,IAAoBP,IACtBK,EAAUI,SAAU,EACrB,GACA,CAACF,EAAiBP,IAErBU,GAAU,KACJH,IACFJ,GAAU,GACVN,IACD,GACA,CAACU,IAEG,CAAET,cAAeO,EAAUI,QAASb,OAAM"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{default as AuthProvider}from"./components/AuthProvider/AuthProvider.js";export{SignInFlow,SignUpFlow,SignUpOrInFlow}from"./components/DefaultFlows.js";export{default as Descope}from"./components/Descope.js";export{default as useDescope}from"./hooks/useDescope.js";export{default as useSession}from"./hooks/useSession.js";export{default as useUser}from"./hooks/useUser.js";export{getJwtPermissions,getJwtRoles,getRefreshToken,getSessionToken,isRefreshTokenExpired,isSessionTokenExpired,refresh}from"./sdk.js";export{baseHeaders}from"./constants.js";export{default as UserManagement}from"./components/UserManagement.js";export{default as RoleManagement}from"./components/RoleManagement.js";export{default as AccessKeyManagement}from"./components/AccessKeyManagement.js";export{default as AuditManagement}from"./components/AuditManagement.js";export{default as UserProfile}from"./components/UserProfile.js";export{default as ApplicationsPortal}from"./components/ApplicationsPortal.js";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/esm/sdk.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e from"@descope/web-js-sdk";import{IS_BROWSER as s}from"./constants.js";import{wrapInTry as o}from"./utils.js";let t;const n=o=>{const n=e(Object.assign({persistTokens:s,autoRefresh:s},o));return t=n,n},i=()=>n({projectId:"temp pid",persistTokens:!1,autoRefresh:!1,storeLastAuthenticatedUser:!1});t=i();const r=()=>s?null==t?void 0:t.getSessionToken():(console.warn("Get session token is not supported in SSR"),""),l=()=>s?null==t?void 0:t.getRefreshToken():(console.warn("Get refresh token is not supported in SSR"),""),d=(e=r())=>null==t?void 0:t.isJwtExpired(e),p=(e=l())=>null==t?void 0:t.isJwtExpired(e),u=o(((e=r(),s)=>null==t?void 0:t.getJwtPermissions(e,s))),a=o(((e=r(),s)=>null==t?void 0:t.getJwtRoles(e,s))),c=(e=l())=>null==t?void 0:t.refresh(e),f=()=>t;export{i as createTempSdk,n as default,f as getGlobalSdk,u as getJwtPermissions,a as getJwtRoles,l as getRefreshToken,r as getSessionToken,p as isRefreshTokenExpired,d as isSessionTokenExpired,c as refresh};
|
|
2
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["// workaround for TS issue https://github.com/microsoft/TypeScript/issues/42873\n// eslint-disable-next-line\nimport type * as _1 from '@descope/core-js-sdk';\nimport createSdk from '@descope/web-js-sdk';\nimport { IS_BROWSER } from './constants';\nimport { wrapInTry } from './utils';\n\ntype Sdk = ReturnType<typeof createSdkWrapper>;\nlet globalSdk: Sdk;\n\nconst createSdkWrapper = <P extends Parameters<typeof createSdk>[0]>(\n config: P,\n) => {\n const sdk = createSdk({\n persistTokens: IS_BROWSER as true,\n autoRefresh: IS_BROWSER as true,\n ...config,\n });\n globalSdk = sdk;\n\n return sdk;\n};\n\n// eslint-disable-next-line import/exports-last\nexport const createTempSdk = () =>\n createSdkWrapper({\n projectId: 'temp pid',\n persistTokens: false,\n autoRefresh: false,\n storeLastAuthenticatedUser: false,\n });\n\n/**\n * We want to make sure the getSessionToken fn is used only when persistTokens is on\n *\n * So we are keeping the SDK init in a single place,\n * and we are creating a temp instance in order to export the getSessionToken\n * even before the SDK was init\n */\nglobalSdk = createTempSdk();\n\nexport const getSessionToken = () => {\n if (IS_BROWSER) {\n return globalSdk?.getSessionToken();\n }\n\n // eslint-disable-next-line no-console\n console.warn('Get session token is not supported in SSR');\n return '';\n};\n\nexport const getRefreshToken = () => {\n if (IS_BROWSER) {\n return globalSdk?.getRefreshToken();\n }\n // eslint-disable-next-line no-console\n console.warn('Get refresh token is not supported in SSR');\n return '';\n};\n\nexport const isSessionTokenExpired = (token = getSessionToken()) =>\n globalSdk?.isJwtExpired(token);\n\nexport const isRefreshTokenExpired = (token = getRefreshToken()) =>\n globalSdk?.isJwtExpired(token);\n\nexport const getJwtPermissions = wrapInTry(\n (token = getSessionToken(), tenant?: string) =>\n globalSdk?.getJwtPermissions(token, tenant),\n);\n\nexport const getJwtRoles = wrapInTry(\n (token = getSessionToken(), tenant?: string) =>\n globalSdk?.getJwtRoles(token, tenant),\n);\n\nexport const refresh = (token = getRefreshToken()) => globalSdk?.refresh(token);\n\nexport const getGlobalSdk = () => globalSdk;\n\nexport default createSdkWrapper;\n"],"names":["globalSdk","createSdkWrapper","config","sdk","createSdk","Object","assign","persistTokens","IS_BROWSER","autoRefresh","createTempSdk","projectId","storeLastAuthenticatedUser","getSessionToken","console","warn","getRefreshToken","isSessionTokenExpired","token","isJwtExpired","isRefreshTokenExpired","getJwtPermissions","wrapInTry","tenant","getJwtRoles","refresh","getGlobalSdk"],"mappings":"sHAQA,IAAIA,EAEJ,MAAMC,EACJC,IAEA,MAAMC,EAAMC,EAASC,OAAAC,OAAA,CACnBC,cAAeC,EACfC,YAAaD,GACVN,IAIL,OAFAF,EAAYG,EAELA,CAAG,EAICO,EAAgB,IAC3BT,EAAiB,CACfU,UAAW,WACXJ,eAAe,EACfE,aAAa,EACbG,4BAA4B,IAUhCZ,EAAYU,IAEL,MAAMG,EAAkB,IACzBL,EACKR,aAAS,EAATA,EAAWa,mBAIpBC,QAAQC,KAAK,6CACN,IAGIC,EAAkB,IACzBR,EACKR,aAAS,EAATA,EAAWgB,mBAGpBF,QAAQC,KAAK,6CACN,IAGIE,EAAwB,CAACC,EAAQL,MAC5Cb,aAAA,EAAAA,EAAWmB,aAAaD,GAEbE,EAAwB,CAACF,EAAQF,MAC5ChB,aAAA,EAAAA,EAAWmB,aAAaD,GAEbG,EAAoBC,GAC/B,CAACJ,EAAQL,IAAmBU,IAC1BvB,aAAS,EAATA,EAAWqB,kBAAkBH,EAAOK,KAG3BC,EAAcF,GACzB,CAACJ,EAAQL,IAAmBU,IAC1BvB,aAAS,EAATA,EAAWwB,YAAYN,EAAOK,KAGrBE,EAAU,CAACP,EAAQF,MAAsBhB,aAAA,EAAAA,EAAWyB,QAAQP,GAE5DQ,EAAe,IAAM1B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const r=r=>(...t)=>{if(!r)throw Error("You can only use this function after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component");return r(...t)},t=r=>(...t)=>{let o;try{o=r(...t)}catch(r){console.error(r)}return o};export{r as withValidation,t as wrapInTry};
|
|
2
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["/**\n * Wrap a function with a validation that it exists\n * @param fn The function to wrap with the validation\n * @throws if function does not exist, an error with the relevant message will be thrown\n */\nexport const withValidation =\n <T extends Array<any>, U>(fn: (...args: T) => U) =>\n (...args: T): U => {\n if (!fn) {\n throw Error(\n `You can only use this function after sdk initialization. Make sure to supply 'projectId' to <AuthProvider /> component`,\n );\n }\n return fn(...args);\n };\n\nexport const wrapInTry =\n <T extends Array<any>, U>(fn: (...args: T) => U) =>\n (...args: T): U => {\n let res: U;\n try {\n res = fn(...args);\n } catch (err) {\n console.error(err); // eslint-disable-line no-console\n }\n return res;\n };\n"],"names":["withValidation","fn","args","Error","wrapInTry","res","err","console","error"],"mappings":"AAKO,MAAMA,EACeC,GAC1B,IAAIC,KACF,IAAKD,EACH,MAAME,MACJ,0HAGJ,OAAOF,KAAMC,EAAK,EAGTE,EACeH,GAC1B,IAAIC,KACF,IAAIG,EACJ,IACEA,EAAMJ,KAAMC,EACb,CAAC,MAAOI,GACPC,QAAQC,MAAMF,EACf,CACD,OAAOD,CAAG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1386,13 +1386,26 @@ declare const SignUpOrInFlow: (props: DefaultFlowProps) => React.JSX.Element;
|
|
|
1386
1386
|
|
|
1387
1387
|
declare const Descope: React.ForwardRefExoticComponent<DescopeProps & React.RefAttributes<HTMLElement>>;
|
|
1388
1388
|
|
|
1389
|
+
declare const useDescope: () => Sdk;
|
|
1390
|
+
|
|
1391
|
+
declare const useSession: () => {
|
|
1392
|
+
isSessionLoading: boolean;
|
|
1393
|
+
sessionToken: string;
|
|
1394
|
+
isAuthenticated: boolean;
|
|
1395
|
+
};
|
|
1396
|
+
|
|
1397
|
+
declare const useUser: () => {
|
|
1398
|
+
isUserLoading: boolean;
|
|
1399
|
+
user: _1.UserResponse;
|
|
1400
|
+
};
|
|
1401
|
+
|
|
1402
|
+
declare const baseHeaders: {
|
|
1403
|
+
'x-descope-sdk-name': string;
|
|
1404
|
+
'x-descope-sdk-version': string;
|
|
1405
|
+
};
|
|
1406
|
+
|
|
1389
1407
|
declare const UserManagement: React.ForwardRefExoticComponent<{
|
|
1390
|
-
logger?:
|
|
1391
|
-
error(...data: any[]): void;
|
|
1392
|
-
warn(...data: any[]): void;
|
|
1393
|
-
info(...data: any[]): void;
|
|
1394
|
-
debug(...data: any[]): void;
|
|
1395
|
-
}>;
|
|
1408
|
+
logger?: _descope_sdk_mixins_themeMixin.Logger;
|
|
1396
1409
|
tenant: string;
|
|
1397
1410
|
widgetId: string;
|
|
1398
1411
|
theme?: _descope_web_component.ThemeOptions;
|
|
@@ -1401,12 +1414,7 @@ declare const UserManagement: React.ForwardRefExoticComponent<{
|
|
|
1401
1414
|
} & React.RefAttributes<HTMLElement>>;
|
|
1402
1415
|
|
|
1403
1416
|
declare const RoleManagement: React.ForwardRefExoticComponent<{
|
|
1404
|
-
logger?:
|
|
1405
|
-
error(...data: any[]): void;
|
|
1406
|
-
warn(...data: any[]): void;
|
|
1407
|
-
info(...data: any[]): void;
|
|
1408
|
-
debug(...data: any[]): void;
|
|
1409
|
-
}>;
|
|
1417
|
+
logger?: _descope_sdk_mixins_themeMixin.Logger;
|
|
1410
1418
|
tenant: string;
|
|
1411
1419
|
widgetId: string;
|
|
1412
1420
|
theme?: _descope_web_component.ThemeOptions;
|
|
@@ -1415,12 +1423,7 @@ declare const RoleManagement: React.ForwardRefExoticComponent<{
|
|
|
1415
1423
|
} & React.RefAttributes<HTMLElement>>;
|
|
1416
1424
|
|
|
1417
1425
|
declare const AccessKeyManagement: React.ForwardRefExoticComponent<{
|
|
1418
|
-
logger?:
|
|
1419
|
-
error(...data: any[]): void;
|
|
1420
|
-
warn(...data: any[]): void;
|
|
1421
|
-
info(...data: any[]): void;
|
|
1422
|
-
debug(...data: any[]): void;
|
|
1423
|
-
}>;
|
|
1426
|
+
logger?: _descope_sdk_mixins_themeMixin.Logger;
|
|
1424
1427
|
tenant: string;
|
|
1425
1428
|
widgetId: string;
|
|
1426
1429
|
theme?: _descope_web_component.ThemeOptions;
|
|
@@ -1429,12 +1432,7 @@ declare const AccessKeyManagement: React.ForwardRefExoticComponent<{
|
|
|
1429
1432
|
} & React.RefAttributes<HTMLElement>>;
|
|
1430
1433
|
|
|
1431
1434
|
declare const AuditManagement: React.ForwardRefExoticComponent<{
|
|
1432
|
-
logger?:
|
|
1433
|
-
error(...data: any[]): void;
|
|
1434
|
-
warn(...data: any[]): void;
|
|
1435
|
-
info(...data: any[]): void;
|
|
1436
|
-
debug(...data: any[]): void;
|
|
1437
|
-
}>;
|
|
1435
|
+
logger?: _descope_sdk_mixins_themeMixin.Logger;
|
|
1438
1436
|
tenant: string;
|
|
1439
1437
|
widgetId: string;
|
|
1440
1438
|
theme?: _descope_web_component.ThemeOptions;
|
|
@@ -1443,12 +1441,7 @@ declare const AuditManagement: React.ForwardRefExoticComponent<{
|
|
|
1443
1441
|
} & React.RefAttributes<HTMLElement>>;
|
|
1444
1442
|
|
|
1445
1443
|
declare const UserProfile: React.ForwardRefExoticComponent<Omit<{
|
|
1446
|
-
logger?:
|
|
1447
|
-
error(...data: any[]): void;
|
|
1448
|
-
warn(...data: any[]): void;
|
|
1449
|
-
info(...data: any[]): void;
|
|
1450
|
-
debug(...data: any[]): void;
|
|
1451
|
-
}>;
|
|
1444
|
+
logger?: _descope_sdk_mixins_themeMixin.Logger;
|
|
1452
1445
|
tenant: string;
|
|
1453
1446
|
widgetId: string;
|
|
1454
1447
|
theme?: _descope_web_component.ThemeOptions;
|
|
@@ -1459,12 +1452,7 @@ declare const UserProfile: React.ForwardRefExoticComponent<Omit<{
|
|
|
1459
1452
|
} & React.RefAttributes<HTMLElement>>;
|
|
1460
1453
|
|
|
1461
1454
|
declare const ApplicationsPortal: React.ForwardRefExoticComponent<Omit<{
|
|
1462
|
-
logger?:
|
|
1463
|
-
error(...data: any[]): void;
|
|
1464
|
-
warn(...data: any[]): void;
|
|
1465
|
-
info(...data: any[]): void;
|
|
1466
|
-
debug(...data: any[]): void;
|
|
1467
|
-
}>;
|
|
1455
|
+
logger?: _descope_sdk_mixins_themeMixin.Logger;
|
|
1468
1456
|
tenant: string;
|
|
1469
1457
|
widgetId: string;
|
|
1470
1458
|
theme?: _descope_web_component.ThemeOptions;
|
|
@@ -1474,22 +1462,4 @@ declare const ApplicationsPortal: React.ForwardRefExoticComponent<Omit<{
|
|
|
1474
1462
|
onLogout?: (e: CustomEvent<any>) => void;
|
|
1475
1463
|
} & React.RefAttributes<HTMLElement>>;
|
|
1476
1464
|
|
|
1477
|
-
declare const useDescope: () => Sdk;
|
|
1478
|
-
|
|
1479
|
-
declare const useSession: () => {
|
|
1480
|
-
isSessionLoading: boolean;
|
|
1481
|
-
sessionToken: string;
|
|
1482
|
-
isAuthenticated: boolean;
|
|
1483
|
-
};
|
|
1484
|
-
|
|
1485
|
-
declare const useUser: () => {
|
|
1486
|
-
isUserLoading: boolean;
|
|
1487
|
-
user: _1.UserResponse;
|
|
1488
|
-
};
|
|
1489
|
-
|
|
1490
|
-
declare const baseHeaders: {
|
|
1491
|
-
'x-descope-sdk-name': string;
|
|
1492
|
-
'x-descope-sdk-version': string;
|
|
1493
|
-
};
|
|
1494
|
-
|
|
1495
1465
|
export { AccessKeyManagement, ApplicationsPortal, AuditManagement, AuthProvider, Descope, RoleManagement, SignInFlow, SignUpFlow, SignUpOrInFlow, UserManagement, UserProfile, baseHeaders, getJwtPermissions, getJwtRoles, getRefreshToken, getSessionToken, isRefreshTokenExpired, isSessionTokenExpired, refresh, useDescope, useSession, useUser };
|