@descope/web-js-sdk
Advanced tools
Comparing version 1.13.0 to 1.13.1
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("@descope/core-js-sdk"),n=require("jwt-decode"),a=require("js-cookie"),i=require("@fingerprintjs/fingerprintjs-pro");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(t),s=o(n),l=o(a);const c=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,a)=>{var i;return n[a]=[].concat((null===(i=e.hooks)||void 0===i?void 0:i[a])||[]).concat((null==t?void 0:t[a])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},u=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(null==t?void 0:t.authInfo)||t||{}},d=async e=>{const t=await u(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},g="undefined"!=typeof localStorage,p=(e,t)=>g&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),f=e=>g&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),w=e=>g&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),h=(...e)=>{console.debug(...e)},v="undefined"!=typeof window,b=Math.pow(2,31)-1,y="DS",m="DSR";function S(e,t,{cookiePath:n,cookieDomain:a,cookieExpiration:i}){if(t){const o=new Date(1e3*i),r=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(a);l.default.set(e,t,{path:n,domain:r?a:void 0,expires:o,sameSite:"Strict",secure:!0})}}function I(e=""){return f(`${e}${m}`)||""}function O(e=""){w(`${e}${m}`),w(`${e}${y}`),l.default.remove(y)}const j=v&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",k="fp",_=(e=!1)=>{const t=localStorage.getItem(k);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},U=async(e,t=j)=>{try{if(_())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),a=new URL(t);a.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const o=new URL(t);o.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const r=o.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=i.load({apiKey:e,endpoint:[a.toString(),i.defaultEndpoint],scriptUrlPattern:[r,i.defaultScriptUrlPattern]}),l=await s,{requestId:c}=await l.get({linkedId:n}),u=((e,t)=>({vsid:e,vrid:t}))(n,c);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem(k,JSON.stringify(t))})(u)}catch(e){console.warn("Could not load fingerprint",e)}},x=e=>{const t=_(!0);return t&&e.body&&(e.body.fpData=t),e},D="dls_last_user_login_id",T="dls_last_user_display_name",A=()=>f(D),K=()=>f(T),R=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,a={}]=t,i=A(),o=K();i&&(null!==(n=a.lastAuth)&&void 0!==n||(a.lastAuth={}),a.lastAuth.loginId=i,a.lastAuth.name=o);return await e(...t)},J=e=>async(...t)=>{const n=await e(...t);return w(D),w(T),n};function C(){const e=[];return{pub:t=>{e.forEach((e=>e(t)))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}const E=e=>t=>async(...n)=>{const a=await t(...n);return O(e),a};async function N(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=F(n.publicKey.challenge),n.publicKey.user.id=F(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=F(e.id)})),n}(e),n=await navigator.credentials.create(t);return a=n,JSON.stringify({id:a.id,rawId:H(a.rawId),type:a.type,response:{attestationObject:H(a.response.attestationObject),clientDataJSON:H(a.response.clientDataJSON)}});var a}async function $(e){const t=P(e);return V(await navigator.credentials.get(t))}async function q(e,t){const n=P(e);n.signal=t.signal,n.mediation="conditional";return V(await navigator.credentials.get(n))}async function L(e=!1){if(!v)return Promise.resolve(!1);const t=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function P(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=F(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=F(e.id)})),n}function V(e){return JSON.stringify({id:e.id,rawId:H(e.rawId),type:e.type,response:{authenticatorData:H(e.response.authenticatorData),clientDataJSON:H(e.response.clientDataJSON),signature:H(e.response.signature),userHandle:e.response.userHandle?H(e.response.userHandle):void 0}})}function F(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function H(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var M,W=(M=e=>({async signUp(t,n){const a=await e.webauthn.signUp.start(t,window.location.origin,n);if(!a.ok)return a;const i=await N(a.data.options);return await e.webauthn.signUp.finish(a.data.transactionId,i)},async signIn(t){const n=await e.webauthn.signIn.start(t,window.location.origin);if(!n.ok)return n;const a=await $(n.data.options);return await e.webauthn.signIn.finish(n.data.transactionId,a)},async signUpOrIn(t){var n;const a=await e.webauthn.signUpOrIn.start(t,window.location.origin);if(!a.ok)return a;if(null===(n=a.data)||void 0===n?void 0:n.create){const t=await N(a.data.options);return await e.webauthn.signUp.finish(a.data.transactionId,t)}{const t=await $(a.data.options);return await e.webauthn.signIn.finish(a.data.transactionId,t)}},async update(t,n){const a=await e.webauthn.update.start(t,window.location.origin,n);if(!a.ok)return a;const i=await N(a.data.options);return await e.webauthn.update.finish(a.data.transactionId,i)},helpers:{create:N,get:$,isSupported:L,conditional:q}}),(...e)=>{const t=M(...e);return Object.assign(t.signUp,e[0].webauthn.signUp),Object.assign(t.signIn,e[0].webauthn.signIn),Object.assign(t.signUpOrIn,e[0].webauthn.signUpOrIn),Object.assign(t.update,e[0].webauthn.update),t});const G={config:"/fedcm/config"},B=(e,t)=>({async oneTap(t,n,a,i){const o=null!=t?t:"google",r=await e.oauth.startNative(o,a,!0);if(!r.ok)return r;const{clientId:s,stateId:l,nonce:c}=r.data,u=await async function(){return new Promise(((e,t)=>{if(window.google)return void e(window.google.accounts.id);let n=document.getElementById("google-gsi-client-script");n||(n=document.createElement("script"),document.head.appendChild(n),n.async=!0,n.defer=!0,n.id="google-gsi-client-script",n.src="https://accounts.google.com/gsi/client"),n.onload=function(){window.google?e(window.google.accounts.id):t("Failed to load Google GSI client script - not loaded properly")},n.onerror=function(){t("Failed to load Google GSI client script - failed to load")}}))}();return new Promise((t=>{var a,r;u.initialize(Object.assign(Object.assign({},n),{itp_support:null===(a=null==n?void 0:n.itp_support)||void 0===a||a,use_fedcm_for_prompt:null===(r=null==n?void 0:n.use_fedcm_for_prompt)||void 0===r||r,client_id:s,callback:n=>{t(e.oauth.finishNative(o,l,"","",n.credential))},nonce:c})),u.prompt((e=>{(null==e?void 0:e.isSkippedMoment())&&(null==i||i())}))}))},async launch(n){var a;const i={identity:{context:n||"signin",providers:[{configURL:e.httpClient.buildUrl(t+G.config),clientId:t}]}},o=await(null===(a=navigator.credentials)||void 0===a?void 0:a.get(i));return e.refresh(o.token)},isSupported:()=>v&&"IdentityCredential"in window});var Z=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await L(),a=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=a,e.flow.start(...t)}});const X=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((t=>n=>{var{fpKey:a,fpLoad:i}=n,o=e.__rest(n,["fpKey","fpLoad"]);return v?(a&&i&&U(a).catch((()=>null)),t(c(o,{beforeRequest:x}))):(console.warn("Fingerprint is a client side only capability and will not work when running in the server"),t(o))}),(n=>a=>{var{autoRefresh:i}=a,o=e.__rest(a,["autoRefresh"]);if(!i)return n(o);const{clearAllTimers:r,setTimer:l}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let d,g;v&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>d&&(h("Expiration time passed, refreshing session"),p.refresh(I()||g))}));const p=n(c(o,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:a}=await u(t);if(401===(null==t?void 0:t.status))h("Received 401, canceling all timers"),r();else if(a){if(d=(e=>{try{const t=s.default(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(a),!d)return void h("Could not extract expiration time from session token");g=n;let e=((i=d)?i.getTime()-(new Date).getTime():0)-2e4;e>b&&(h(`Timeout is too large (${e}ms), setting it to ${b}ms`),e=b),r();const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});h(`Setting refresh timer for ${t}. (${e}ms)`),l((()=>{h("Refreshing session due to timer"),p.refresh(I()||n)}),e)}var i}}));return t.wrapWith(p,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return h("Clearing all timers"),r(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.13.0"},t.baseHeaders)}))),(e=>n=>{const a=C(),i=C(),o=e(c(n,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))a.pub(null),i.pub(null);else{const e=await d(t);e&&i.pub(e);const{sessionJwt:n}=await u(t);n&&a.pub(n)}}})),r=t.wrapWith(o,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return a.pub(null),i.pub(null),n}));return Object.assign(r,{onSessionTokenChange:a.sub,onUserChange:i.sub})}),(n=>a=>{var{storeLastAuthenticatedUser:i=!0}=a,o=e.__rest(a,["storeLastAuthenticatedUser"]);if(!i)return Object.assign(n(o),{getLastUserLoginId:A,getLastUserDisplayName:K});const r=n(c(o,{afterRequest:async(e,t)=>{var n;const a=await d(t),i=null===(n=null==a?void 0:a.loginIds)||void 0===n?void 0:n[0],o=null==a?void 0:a.name;i&&((e=>{p(D,e)})(i),(e=>{p(T,e)})(o))}}));let s=t.wrapWith(r,["flow.start"],R);return s=t.wrapWith(s,["logout","logoutAll"],J),Object.assign(s,{getLastUserLoginId:A,getLastUserDisplayName:K})}),(n=>a=>{var{persistTokens:i,sessionTokenViaCookie:o,storagePrefix:r}=a,s=e.__rest(a,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!i||!v)return i&&console.warn("Storing auth tokens in local storage and cookies are a client side only capabilities and will not be done when running in the server"),n(s);const d=n(c(s,{beforeRequest:(g=r,e=>Object.assign(e,{token:e.token||I(g)})),afterRequest:async(t,n)=>{const a=/^\/v\d+\/mgmt\//.test(t.path);401===(null==n?void 0:n.status)?a||O(r):((t={},n,a)=>{var{refreshJwt:i,sessionJwt:o}=t,r=e.__rest(t,["refreshJwt","sessionJwt"]);void 0===n&&(n=!1),void 0===a&&(a=""),i&&p(`${a}${m}`,i),o&&(n?S(y,o,r):p(`${a}${y}`,o))})(await u(n),o,r)}}));var g;const w=t.wrapWith(d,["logout","logoutAll"],E(r));return Object.assign(w,{getRefreshToken:()=>I(r),getSessionToken:()=>function(e=""){return l.default.get(y)||f(`${e}${y}`)||""}(r)})}))(((...e)=>{const t=r.default(...e);return Object.assign(Object.assign({},t),{flow:Z(t),webauthn:W(t),fedcm:B(t,e[0].projectId)})}));exports.REFRESH_TOKEN_KEY=m,exports.SESSION_TOKEN_KEY=y,exports.clearFingerprintData=()=>{localStorage.removeItem(k)},exports.default=X,exports.ensureFingerprintIds=U; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),t=require("@descope/core-js-sdk"),n=require("jwt-decode"),a=require("js-cookie"),i=require("@fingerprintjs/fingerprintjs-pro");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(t),s=o(n),l=o(a);const c=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,a)=>{var i;return n[a]=[].concat((null===(i=e.hooks)||void 0===i?void 0:i[a])||[]).concat((null==t?void 0:t[a])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},u=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(null==t?void 0:t.authInfo)||t||{}},d=async e=>{const t=await u(e);return(null==t?void 0:t.user)||((null==t?void 0:t.hasOwnProperty("userId"))?t:void 0)},g="undefined"!=typeof localStorage,p=(e,t)=>g&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),f=e=>g&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),w=e=>g&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e)),h=(...e)=>{console.debug(...e)},v="undefined"!=typeof window,b=Math.pow(2,31)-1,y="DS",m="DSR";function S(e,t,{cookiePath:n,cookieDomain:a,cookieExpiration:i}){if(t){const o=new Date(1e3*i),r=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(a);l.default.set(e,t,{path:n,domain:r?a:void 0,expires:o,sameSite:"Strict",secure:!0})}}function I(e=""){return f(`${e}${m}`)||""}function O(e=""){w(`${e}${m}`),w(`${e}${y}`),l.default.remove(y)}const j=v&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",k="fp",_=(e=!1)=>{const t=localStorage.getItem(k);if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},U=async(e,t=j)=>{try{if(_())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),a=new URL(t);a.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const o=new URL(t);o.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const r=o.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=i.load({apiKey:e,endpoint:[a.toString(),i.defaultEndpoint],scriptUrlPattern:[r,i.defaultScriptUrlPattern]}),l=await s,{requestId:c}=await l.get({linkedId:n}),u=((e,t)=>({vsid:e,vrid:t}))(n,c);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem(k,JSON.stringify(t))})(u)}catch(e){console.warn("Could not load fingerprint",e)}},x=e=>{const t=_(!0);return t&&e.body&&(e.body.fpData=t),e},D="dls_last_user_login_id",T="dls_last_user_display_name",A=()=>f(D),K=()=>f(T),R=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,a={}]=t,i=A(),o=K();i&&(null!==(n=a.lastAuth)&&void 0!==n||(a.lastAuth={}),a.lastAuth.loginId=i,a.lastAuth.name=o);return await e(...t)},J=e=>async(...t)=>{const n=await e(...t);return w(D),w(T),n};function C(){const e=[];return{pub:t=>{e.forEach((e=>e(t)))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}const E=e=>t=>async(...n)=>{const a=await t(...n);return O(e),a};async function N(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=F(n.publicKey.challenge),n.publicKey.user.id=F(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=F(e.id)})),n}(e),n=await navigator.credentials.create(t);return a=n,JSON.stringify({id:a.id,rawId:H(a.rawId),type:a.type,response:{attestationObject:H(a.response.attestationObject),clientDataJSON:H(a.response.clientDataJSON)}});var a}async function $(e){const t=P(e);return V(await navigator.credentials.get(t))}async function q(e,t){const n=P(e);n.signal=t.signal,n.mediation="conditional";return V(await navigator.credentials.get(n))}async function L(e=!1){if(!v)return Promise.resolve(!1);const t=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function P(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=F(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=F(e.id)})),n}function V(e){return JSON.stringify({id:e.id,rawId:H(e.rawId),type:e.type,response:{authenticatorData:H(e.response.authenticatorData),clientDataJSON:H(e.response.clientDataJSON),signature:H(e.response.signature),userHandle:e.response.userHandle?H(e.response.userHandle):void 0}})}function F(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function H(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var M,W=(M=e=>({async signUp(t,n){const a=await e.webauthn.signUp.start(t,window.location.origin,n);if(!a.ok)return a;const i=await N(a.data.options);return await e.webauthn.signUp.finish(a.data.transactionId,i)},async signIn(t){const n=await e.webauthn.signIn.start(t,window.location.origin);if(!n.ok)return n;const a=await $(n.data.options);return await e.webauthn.signIn.finish(n.data.transactionId,a)},async signUpOrIn(t){var n;const a=await e.webauthn.signUpOrIn.start(t,window.location.origin);if(!a.ok)return a;if(null===(n=a.data)||void 0===n?void 0:n.create){const t=await N(a.data.options);return await e.webauthn.signUp.finish(a.data.transactionId,t)}{const t=await $(a.data.options);return await e.webauthn.signIn.finish(a.data.transactionId,t)}},async update(t,n){const a=await e.webauthn.update.start(t,window.location.origin,n);if(!a.ok)return a;const i=await N(a.data.options);return await e.webauthn.update.finish(a.data.transactionId,i)},helpers:{create:N,get:$,isSupported:L,conditional:q}}),(...e)=>{const t=M(...e);return Object.assign(t.signUp,e[0].webauthn.signUp),Object.assign(t.signIn,e[0].webauthn.signIn),Object.assign(t.signUpOrIn,e[0].webauthn.signUpOrIn),Object.assign(t.update,e[0].webauthn.update),t});const G={config:"/fedcm/config"},B=(e,t)=>({async oneTap(t,n,a,i){const o=null!=t?t:"google",r=await e.oauth.startNative(o,a,!0);if(!r.ok)return r;const{clientId:s,stateId:l,nonce:c}=r.data,u=await async function(){return new Promise(((e,t)=>{if(window.google)return void e(window.google.accounts.id);let n=document.getElementById("google-gsi-client-script");n||(n=document.createElement("script"),document.head.appendChild(n),n.async=!0,n.defer=!0,n.id="google-gsi-client-script",n.src="https://accounts.google.com/gsi/client"),n.onload=function(){window.google?e(window.google.accounts.id):t("Failed to load Google GSI client script - not loaded properly")},n.onerror=function(){t("Failed to load Google GSI client script - failed to load")}}))}();return new Promise((t=>{var a,r;u.initialize(Object.assign(Object.assign({},n),{itp_support:null===(a=null==n?void 0:n.itp_support)||void 0===a||a,use_fedcm_for_prompt:null===(r=null==n?void 0:n.use_fedcm_for_prompt)||void 0===r||r,client_id:s,callback:n=>{t(e.oauth.finishNative(o,l,"","",n.credential))},nonce:c})),u.prompt((e=>{(null==e?void 0:e.isSkippedMoment())&&(null==i||i())}))}))},async launch(n){var a;const i={identity:{context:n||"signin",providers:[{configURL:e.httpClient.buildUrl(t+G.config),clientId:t}]}},o=await(null===(a=navigator.credentials)||void 0===a?void 0:a.get(i));return e.refresh(o.token)},isSupported:()=>v&&"IdentityCredential"in window});var Z=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await L(),a=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=a,e.flow.start(...t)}});const X=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((t=>n=>{var{fpKey:a,fpLoad:i}=n,o=e.__rest(n,["fpKey","fpLoad"]);return v?(a&&i&&U(a).catch((()=>null)),t(c(o,{beforeRequest:x}))):(console.warn("Fingerprint is a client side only capability and will not work when running in the server"),t(o))}),(n=>a=>{var{autoRefresh:i}=a,o=e.__rest(a,["autoRefresh"]);if(!i)return n(o);const{clearAllTimers:r,setTimer:l}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let d,g;v&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>d&&(h("Expiration time passed, refreshing session"),p.refresh(I()||g))}));const p=n(c(o,{afterRequest:async(e,t)=>{const{refreshJwt:n,sessionJwt:a}=await u(t);if(401===(null==t?void 0:t.status))h("Received 401, canceling all timers"),r();else if(a){if(d=(e=>{try{const t=s.default(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(a),!d)return void h("Could not extract expiration time from session token");g=n;let e=((i=d)?i.getTime()-(new Date).getTime():0)-2e4;e>b&&(h(`Timeout is too large (${e}ms), setting it to ${b}ms`),e=b),r();const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});h(`Setting refresh timer for ${t}. (${e}ms)`),l((()=>{h("Refreshing session due to timer"),p.refresh(I()||n)}),e)}var i}}));return t.wrapWith(p,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return h("Clearing all timers"),r(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.13.1"},t.baseHeaders)}))),(e=>n=>{const a=C(),i=C(),o=e(c(n,{afterRequest:async(e,t)=>{if(401===(null==t?void 0:t.status))a.pub(null),i.pub(null);else{const e=await d(t);e&&i.pub(e);const{sessionJwt:n}=await u(t);n&&a.pub(n)}}})),r=t.wrapWith(o,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return a.pub(null),i.pub(null),n}));return Object.assign(r,{onSessionTokenChange:a.sub,onUserChange:i.sub})}),(n=>a=>{var{storeLastAuthenticatedUser:i=!0}=a,o=e.__rest(a,["storeLastAuthenticatedUser"]);if(!i)return Object.assign(n(o),{getLastUserLoginId:A,getLastUserDisplayName:K});const r=n(c(o,{afterRequest:async(e,t)=>{var n;const a=await d(t),i=null===(n=null==a?void 0:a.loginIds)||void 0===n?void 0:n[0],o=null==a?void 0:a.name;i&&((e=>{p(D,e)})(i),(e=>{p(T,e)})(o))}}));let s=t.wrapWith(r,["flow.start"],R);return s=t.wrapWith(s,["logout","logoutAll"],J),Object.assign(s,{getLastUserLoginId:A,getLastUserDisplayName:K})}),(n=>a=>{var{persistTokens:i,sessionTokenViaCookie:o,storagePrefix:r}=a,s=e.__rest(a,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!i||!v)return i&&console.warn("Storing auth tokens in local storage and cookies are a client side only capabilities and will not be done when running in the server"),n(s);const d=n(c(s,{beforeRequest:(g=r,e=>Object.assign(e,{token:e.token||I(g)})),afterRequest:async(t,n)=>{const a=/^\/v\d+\/mgmt\//.test(t.path);401===(null==n?void 0:n.status)?a||O(r):((t={},n,a)=>{var{refreshJwt:i,sessionJwt:o}=t,r=e.__rest(t,["refreshJwt","sessionJwt"]);void 0===n&&(n=!1),void 0===a&&(a=""),i&&p(`${a}${m}`,i),o&&(n?S(y,o,r):p(`${a}${y}`,o))})(await u(n),o,r)}}));var g;const w=t.wrapWith(d,["logout","logoutAll"],E(r));return Object.assign(w,{getRefreshToken:()=>I(r),getSessionToken:()=>function(e=""){return l.default.get(y)||f(`${e}${y}`)||""}(r)})}))(((...e)=>{const t=r.default(...e);return Object.assign(Object.assign({},t),{flow:Z(t),webauthn:W(t),fedcm:B(t,e[0].projectId)})}));exports.REFRESH_TOKEN_KEY=m,exports.SESSION_TOKEN_KEY=y,exports.clearFingerprintData=()=>{localStorage.removeItem(k)},exports.default=X,exports.ensureFingerprintIds=U; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import{__rest as t}from"tslib";import e,{wrapWith as n}from"@descope/core-js-sdk";import o from"jwt-decode";import i from"js-cookie";import{load as a,defaultEndpoint as r,defaultScriptUrlPattern as s}from"@fingerprintjs/fingerprintjs-pro";const l=(t,e)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,o)=>{var i;return n[o]=[].concat((null===(i=t.hooks)||void 0===i?void 0:i[o])||[]).concat((null==e?void 0:e[o])||[]),n}),null!==(n=t.hooks)&&void 0!==n?n:t.hooks={}),t},c=async t=>{if(!(null==t?void 0:t.ok))return{};const e=await(null==t?void 0:t.clone().json());return(null==e?void 0:e.authInfo)||e||{}},u=async t=>{const e=await c(t);return(null==e?void 0:e.user)||((null==e?void 0:e.hasOwnProperty("userId"))?e:void 0)},d="undefined"!=typeof localStorage,g=(t,e)=>d&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(t,e)),p=t=>d&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(t)),f=t=>d&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(t)),w=(...t)=>{console.debug(...t)},v="undefined"!=typeof window,h=Math.pow(2,31)-1,b="DS",m="DSR";function y(t,e,{cookiePath:n,cookieDomain:o,cookieExpiration:a}){if(e){const r=new Date(1e3*a),s=function(t){const e=window.location.hostname.split("."),n=t.split(".");return e.slice(-n.length).join(".")===t}(o);i.set(t,e,{path:n,domain:s?o:void 0,expires:r,sameSite:"Strict",secure:!0})}}function S(t=""){return p(`${t}${m}`)||""}function I(t=""){f(`${t}${m}`),f(`${t}${b}`),i.remove(b)}const O=v&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",k="fp",j=(t=!1)=>{const e=localStorage.getItem(k);if(!e)return null;const n=JSON.parse(e);return(new Date).getTime()>n.expiry&&!t?null:n.value},U=async(t,e=O)=>{try{if(j())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),o=new URL(e);o.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const i=new URL(e);i.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const l=i.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",c=a({apiKey:t,endpoint:[o.toString(),r],scriptUrlPattern:[l,s]}),u=await c,{requestId:d}=await u.get({linkedId:n}),g=((t,e)=>({vsid:t,vrid:e}))(n,d);(t=>{const e={value:t,expiry:(new Date).getTime()+864e5};localStorage.setItem(k,JSON.stringify(e))})(g)}catch(t){console.warn("Could not load fingerprint",t)}},D=()=>{localStorage.removeItem(k)},A=t=>{const e=j(!0);return e&&t.body&&(t.body.fpData=e),t},T="dls_last_user_login_id",x="dls_last_user_display_name",J=()=>p(T),_=()=>p(x),C=t=>async(...e)=>{var n;e[1]=e[1]||{};const[,o={}]=e,i=J(),a=_();i&&(null!==(n=o.lastAuth)&&void 0!==n||(o.lastAuth={}),o.lastAuth.loginId=i,o.lastAuth.name=a);return await t(...e)},R=t=>async(...e)=>{const n=await t(...e);return f(T),f(x),n};function K(){const t=[];return{pub:e=>{t.forEach((t=>t(e)))},sub:e=>{const n=t.push(e)-1;return()=>t.splice(n,1)}}}const $=t=>e=>async(...n)=>{const o=await e(...n);return I(t),o};async function L(t){const e=function(t){var e;const n=JSON.parse(t);return n.publicKey.challenge=H(n.publicKey.challenge),n.publicKey.user.id=H(n.publicKey.user.id),null===(e=n.publicKey.excludeCredentials)||void 0===e||e.forEach((t=>{t.id=H(t.id)})),n}(t),n=await navigator.credentials.create(e);return o=n,JSON.stringify({id:o.id,rawId:G(o.rawId),type:o.type,response:{attestationObject:G(o.response.attestationObject),clientDataJSON:G(o.response.clientDataJSON)}});var o}async function N(t){const e=E(t);return V(await navigator.credentials.get(e))}async function P(t,e){const n=E(t);n.signal=e.signal,n.mediation="conditional";return V(await navigator.credentials.get(n))}async function q(t=!1){if(!v)return Promise.resolve(!1);const e=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return e&&t&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():e}function E(t){var e;const n=JSON.parse(t);return n.publicKey.challenge=H(n.publicKey.challenge),null===(e=n.publicKey.allowCredentials)||void 0===e||e.forEach((t=>{t.id=H(t.id)})),n}function V(t){return JSON.stringify({id:t.id,rawId:G(t.rawId),type:t.type,response:{authenticatorData:G(t.response.authenticatorData),clientDataJSON:G(t.response.clientDataJSON),signature:G(t.response.signature),userHandle:t.response.userHandle?G(t.response.userHandle):void 0}})}function H(t){const e=t.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(e),(t=>t.charCodeAt(0))).buffer}function G(t){return btoa(String.fromCharCode.apply(null,new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var M,B=(M=t=>({async signUp(e,n){const o=await t.webauthn.signUp.start(e,window.location.origin,n);if(!o.ok)return o;const i=await L(o.data.options);return await t.webauthn.signUp.finish(o.data.transactionId,i)},async signIn(e){const n=await t.webauthn.signIn.start(e,window.location.origin);if(!n.ok)return n;const o=await N(n.data.options);return await t.webauthn.signIn.finish(n.data.transactionId,o)},async signUpOrIn(e){var n;const o=await t.webauthn.signUpOrIn.start(e,window.location.origin);if(!o.ok)return o;if(null===(n=o.data)||void 0===n?void 0:n.create){const e=await L(o.data.options);return await t.webauthn.signUp.finish(o.data.transactionId,e)}{const e=await N(o.data.options);return await t.webauthn.signIn.finish(o.data.transactionId,e)}},async update(e,n){const o=await t.webauthn.update.start(e,window.location.origin,n);if(!o.ok)return o;const i=await L(o.data.options);return await t.webauthn.update.finish(o.data.transactionId,i)},helpers:{create:L,get:N,isSupported:q,conditional:P}}),(...t)=>{const e=M(...t);return Object.assign(e.signUp,t[0].webauthn.signUp),Object.assign(e.signIn,t[0].webauthn.signIn),Object.assign(e.signUpOrIn,t[0].webauthn.signUpOrIn),Object.assign(e.update,t[0].webauthn.update),e});const F={config:"/fedcm/config"},Z=(t,e)=>({async oneTap(e,n,o,i){const a=null!=e?e:"google",r=await t.oauth.startNative(a,o,!0);if(!r.ok)return r;const{clientId:s,stateId:l,nonce:c}=r.data,u=await async function(){return new Promise(((t,e)=>{if(window.google)return void t(window.google.accounts.id);let n=document.getElementById("google-gsi-client-script");n||(n=document.createElement("script"),document.head.appendChild(n),n.async=!0,n.defer=!0,n.id="google-gsi-client-script",n.src="https://accounts.google.com/gsi/client"),n.onload=function(){window.google?t(window.google.accounts.id):e("Failed to load Google GSI client script - not loaded properly")},n.onerror=function(){e("Failed to load Google GSI client script - failed to load")}}))}();return new Promise((e=>{var o,r;u.initialize(Object.assign(Object.assign({},n),{itp_support:null===(o=null==n?void 0:n.itp_support)||void 0===o||o,use_fedcm_for_prompt:null===(r=null==n?void 0:n.use_fedcm_for_prompt)||void 0===r||r,client_id:s,callback:n=>{e(t.oauth.finishNative(a,l,"","",n.credential))},nonce:c})),u.prompt((t=>{(null==t?void 0:t.isSkippedMoment())&&(null==i||i())}))}))},async launch(n){var o;const i={identity:{context:n||"signin",providers:[{configURL:t.httpClient.buildUrl(e+F.config),clientId:e}]}},a=await(null===(o=navigator.credentials)||void 0===o?void 0:o.get(i));return t.refresh(a.token)},isSupported:()=>v&&"IdentityCredential"in window});var X=t=>Object.assign(Object.assign({},t.flow),{start:async(...e)=>{const n=await q(),o=Object.assign(Object.assign({location:window.location.href},e[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return e[1]=o,t.flow.start(...e)}});const z=function(...t){return e=>t.reduce(((t,e)=>e(t)),e)}((e=>n=>{var{fpKey:o,fpLoad:i}=n,a=t(n,["fpKey","fpLoad"]);return v?(o&&i&&U(o).catch((()=>null)),e(l(a,{beforeRequest:A}))):(console.warn("Fingerprint is a client side only capability and will not work when running in the server"),e(a))}),(e=>i=>{var{autoRefresh:a}=i,r=t(i,["autoRefresh"]);if(!a)return e(r);const{clearAllTimers:s,setTimer:u}=(()=>{const t=[];return{clearAllTimers:()=>{for(;t.length;)clearTimeout(t.pop())},setTimer:(e,n)=>{t.push(setTimeout(e,n))}}})();let d,g;v&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>d&&(w("Expiration time passed, refreshing session"),p.refresh(S()||g))}));const p=e(l(r,{afterRequest:async(t,e)=>{const{refreshJwt:n,sessionJwt:i}=await c(e);if(401===(null==e?void 0:e.status))w("Received 401, canceling all timers"),s();else if(i){if(d=(t=>{try{const e=o(t);if(e.exp)return new Date(1e3*e.exp)}catch(t){return null}})(i),!d)return void w("Could not extract expiration time from session token");g=n;let t=((a=d)?a.getTime()-(new Date).getTime():0)-2e4;t>h&&(w(`Timeout is too large (${t}ms), setting it to ${h}ms`),t=h),s();const e=new Date(Date.now()+t).toLocaleTimeString("en-US",{hour12:!1});w(`Setting refresh timer for ${e}. (${t}ms)`),u((()=>{w("Refreshing session due to timer"),p.refresh(S()||n)}),t)}var a}}));return n(p,["logout","logoutAll"],(t=>async(...e)=>{const n=await t(...e);return w("Clearing all timers"),s(),n}))}),(t=>e=>t(Object.assign(Object.assign({},e),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.13.0"},e.baseHeaders)}))),(t=>e=>{const o=K(),i=K(),a=t(l(e,{afterRequest:async(t,e)=>{if(401===(null==e?void 0:e.status))o.pub(null),i.pub(null);else{const t=await u(e);t&&i.pub(t);const{sessionJwt:n}=await c(e);n&&o.pub(n)}}})),r=n(a,["logout","logoutAll"],(t=>async(...e)=>{const n=await t(...e);return o.pub(null),i.pub(null),n}));return Object.assign(r,{onSessionTokenChange:o.sub,onUserChange:i.sub})}),(e=>o=>{var{storeLastAuthenticatedUser:i=!0}=o,a=t(o,["storeLastAuthenticatedUser"]);if(!i)return Object.assign(e(a),{getLastUserLoginId:J,getLastUserDisplayName:_});const r=e(l(a,{afterRequest:async(t,e)=>{var n;const o=await u(e),i=null===(n=null==o?void 0:o.loginIds)||void 0===n?void 0:n[0],a=null==o?void 0:o.name;i&&((t=>{g(T,t)})(i),(t=>{g(x,t)})(a))}}));let s=n(r,["flow.start"],C);return s=n(s,["logout","logoutAll"],R),Object.assign(s,{getLastUserLoginId:J,getLastUserDisplayName:_})}),(e=>o=>{var{persistTokens:a,sessionTokenViaCookie:r,storagePrefix:s}=o,u=t(o,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!a||!v)return a&&console.warn("Storing auth tokens in local storage and cookies are a client side only capabilities and will not be done when running in the server"),e(u);const d=e(l(u,{beforeRequest:(f=s,t=>Object.assign(t,{token:t.token||S(f)})),afterRequest:async(e,n)=>{const o=/^\/v\d+\/mgmt\//.test(e.path);401===(null==n?void 0:n.status)?o||I(s):((e={},n,o)=>{var{refreshJwt:i,sessionJwt:a}=e,r=t(e,["refreshJwt","sessionJwt"]);void 0===n&&(n=!1),void 0===o&&(o=""),i&&g(`${o}${m}`,i),a&&(n?y(b,a,r):g(`${o}${b}`,a))})(await c(n),r,s)}}));var f;const w=n(d,["logout","logoutAll"],$(s));return Object.assign(w,{getRefreshToken:()=>S(s),getSessionToken:()=>function(t=""){return i.get(b)||p(`${t}${b}`)||""}(s)})}))(((...t)=>{const n=e(...t);return Object.assign(Object.assign({},n),{flow:X(n),webauthn:B(n),fedcm:Z(n,t[0].projectId)})}));export{m as REFRESH_TOKEN_KEY,b as SESSION_TOKEN_KEY,D as clearFingerprintData,z as default,U as ensureFingerprintIds}; | ||
import{__rest as t}from"tslib";import e,{wrapWith as n}from"@descope/core-js-sdk";import o from"jwt-decode";import i from"js-cookie";import{load as a,defaultEndpoint as r,defaultScriptUrlPattern as s}from"@fingerprintjs/fingerprintjs-pro";const l=(t,e)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,o)=>{var i;return n[o]=[].concat((null===(i=t.hooks)||void 0===i?void 0:i[o])||[]).concat((null==e?void 0:e[o])||[]),n}),null!==(n=t.hooks)&&void 0!==n?n:t.hooks={}),t},c=async t=>{if(!(null==t?void 0:t.ok))return{};const e=await(null==t?void 0:t.clone().json());return(null==e?void 0:e.authInfo)||e||{}},u=async t=>{const e=await c(t);return(null==e?void 0:e.user)||((null==e?void 0:e.hasOwnProperty("userId"))?e:void 0)},d="undefined"!=typeof localStorage,g=(t,e)=>d&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(t,e)),p=t=>d&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(t)),f=t=>d&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(t)),w=(...t)=>{console.debug(...t)},v="undefined"!=typeof window,h=Math.pow(2,31)-1,b="DS",m="DSR";function y(t,e,{cookiePath:n,cookieDomain:o,cookieExpiration:a}){if(e){const r=new Date(1e3*a),s=function(t){const e=window.location.hostname.split("."),n=t.split(".");return e.slice(-n.length).join(".")===t}(o);i.set(t,e,{path:n,domain:s?o:void 0,expires:r,sameSite:"Strict",secure:!0})}}function S(t=""){return p(`${t}${m}`)||""}function I(t=""){f(`${t}${m}`),f(`${t}${b}`),i.remove(b)}const O=v&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com",k="fp",j=(t=!1)=>{const e=localStorage.getItem(k);if(!e)return null;const n=JSON.parse(e);return(new Date).getTime()>n.expiry&&!t?null:n.value},U=async(t,e=O)=>{try{if(j())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),o=new URL(e);o.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const i=new URL(e);i.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const l=i.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",c=a({apiKey:t,endpoint:[o.toString(),r],scriptUrlPattern:[l,s]}),u=await c,{requestId:d}=await u.get({linkedId:n}),g=((t,e)=>({vsid:t,vrid:e}))(n,d);(t=>{const e={value:t,expiry:(new Date).getTime()+864e5};localStorage.setItem(k,JSON.stringify(e))})(g)}catch(t){console.warn("Could not load fingerprint",t)}},D=()=>{localStorage.removeItem(k)},A=t=>{const e=j(!0);return e&&t.body&&(t.body.fpData=e),t},T="dls_last_user_login_id",x="dls_last_user_display_name",J=()=>p(T),_=()=>p(x),C=t=>async(...e)=>{var n;e[1]=e[1]||{};const[,o={}]=e,i=J(),a=_();i&&(null!==(n=o.lastAuth)&&void 0!==n||(o.lastAuth={}),o.lastAuth.loginId=i,o.lastAuth.name=a);return await t(...e)},R=t=>async(...e)=>{const n=await t(...e);return f(T),f(x),n};function K(){const t=[];return{pub:e=>{t.forEach((t=>t(e)))},sub:e=>{const n=t.push(e)-1;return()=>t.splice(n,1)}}}const $=t=>e=>async(...n)=>{const o=await e(...n);return I(t),o};async function L(t){const e=function(t){var e;const n=JSON.parse(t);return n.publicKey.challenge=H(n.publicKey.challenge),n.publicKey.user.id=H(n.publicKey.user.id),null===(e=n.publicKey.excludeCredentials)||void 0===e||e.forEach((t=>{t.id=H(t.id)})),n}(t),n=await navigator.credentials.create(e);return o=n,JSON.stringify({id:o.id,rawId:G(o.rawId),type:o.type,response:{attestationObject:G(o.response.attestationObject),clientDataJSON:G(o.response.clientDataJSON)}});var o}async function N(t){const e=E(t);return V(await navigator.credentials.get(e))}async function P(t,e){const n=E(t);n.signal=e.signal,n.mediation="conditional";return V(await navigator.credentials.get(n))}async function q(t=!1){if(!v)return Promise.resolve(!1);const e=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return e&&t&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():e}function E(t){var e;const n=JSON.parse(t);return n.publicKey.challenge=H(n.publicKey.challenge),null===(e=n.publicKey.allowCredentials)||void 0===e||e.forEach((t=>{t.id=H(t.id)})),n}function V(t){return JSON.stringify({id:t.id,rawId:G(t.rawId),type:t.type,response:{authenticatorData:G(t.response.authenticatorData),clientDataJSON:G(t.response.clientDataJSON),signature:G(t.response.signature),userHandle:t.response.userHandle?G(t.response.userHandle):void 0}})}function H(t){const e=t.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(e),(t=>t.charCodeAt(0))).buffer}function G(t){return btoa(String.fromCharCode.apply(null,new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var M,B=(M=t=>({async signUp(e,n){const o=await t.webauthn.signUp.start(e,window.location.origin,n);if(!o.ok)return o;const i=await L(o.data.options);return await t.webauthn.signUp.finish(o.data.transactionId,i)},async signIn(e){const n=await t.webauthn.signIn.start(e,window.location.origin);if(!n.ok)return n;const o=await N(n.data.options);return await t.webauthn.signIn.finish(n.data.transactionId,o)},async signUpOrIn(e){var n;const o=await t.webauthn.signUpOrIn.start(e,window.location.origin);if(!o.ok)return o;if(null===(n=o.data)||void 0===n?void 0:n.create){const e=await L(o.data.options);return await t.webauthn.signUp.finish(o.data.transactionId,e)}{const e=await N(o.data.options);return await t.webauthn.signIn.finish(o.data.transactionId,e)}},async update(e,n){const o=await t.webauthn.update.start(e,window.location.origin,n);if(!o.ok)return o;const i=await L(o.data.options);return await t.webauthn.update.finish(o.data.transactionId,i)},helpers:{create:L,get:N,isSupported:q,conditional:P}}),(...t)=>{const e=M(...t);return Object.assign(e.signUp,t[0].webauthn.signUp),Object.assign(e.signIn,t[0].webauthn.signIn),Object.assign(e.signUpOrIn,t[0].webauthn.signUpOrIn),Object.assign(e.update,t[0].webauthn.update),e});const F={config:"/fedcm/config"},Z=(t,e)=>({async oneTap(e,n,o,i){const a=null!=e?e:"google",r=await t.oauth.startNative(a,o,!0);if(!r.ok)return r;const{clientId:s,stateId:l,nonce:c}=r.data,u=await async function(){return new Promise(((t,e)=>{if(window.google)return void t(window.google.accounts.id);let n=document.getElementById("google-gsi-client-script");n||(n=document.createElement("script"),document.head.appendChild(n),n.async=!0,n.defer=!0,n.id="google-gsi-client-script",n.src="https://accounts.google.com/gsi/client"),n.onload=function(){window.google?t(window.google.accounts.id):e("Failed to load Google GSI client script - not loaded properly")},n.onerror=function(){e("Failed to load Google GSI client script - failed to load")}}))}();return new Promise((e=>{var o,r;u.initialize(Object.assign(Object.assign({},n),{itp_support:null===(o=null==n?void 0:n.itp_support)||void 0===o||o,use_fedcm_for_prompt:null===(r=null==n?void 0:n.use_fedcm_for_prompt)||void 0===r||r,client_id:s,callback:n=>{e(t.oauth.finishNative(a,l,"","",n.credential))},nonce:c})),u.prompt((t=>{(null==t?void 0:t.isSkippedMoment())&&(null==i||i())}))}))},async launch(n){var o;const i={identity:{context:n||"signin",providers:[{configURL:t.httpClient.buildUrl(e+F.config),clientId:e}]}},a=await(null===(o=navigator.credentials)||void 0===o?void 0:o.get(i));return t.refresh(a.token)},isSupported:()=>v&&"IdentityCredential"in window});var X=t=>Object.assign(Object.assign({},t.flow),{start:async(...e)=>{const n=await q(),o=Object.assign(Object.assign({location:window.location.href},e[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return e[1]=o,t.flow.start(...e)}});const z=function(...t){return e=>t.reduce(((t,e)=>e(t)),e)}((e=>n=>{var{fpKey:o,fpLoad:i}=n,a=t(n,["fpKey","fpLoad"]);return v?(o&&i&&U(o).catch((()=>null)),e(l(a,{beforeRequest:A}))):(console.warn("Fingerprint is a client side only capability and will not work when running in the server"),e(a))}),(e=>i=>{var{autoRefresh:a}=i,r=t(i,["autoRefresh"]);if(!a)return e(r);const{clearAllTimers:s,setTimer:u}=(()=>{const t=[];return{clearAllTimers:()=>{for(;t.length;)clearTimeout(t.pop())},setTimer:(e,n)=>{t.push(setTimeout(e,n))}}})();let d,g;v&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>d&&(w("Expiration time passed, refreshing session"),p.refresh(S()||g))}));const p=e(l(r,{afterRequest:async(t,e)=>{const{refreshJwt:n,sessionJwt:i}=await c(e);if(401===(null==e?void 0:e.status))w("Received 401, canceling all timers"),s();else if(i){if(d=(t=>{try{const e=o(t);if(e.exp)return new Date(1e3*e.exp)}catch(t){return null}})(i),!d)return void w("Could not extract expiration time from session token");g=n;let t=((a=d)?a.getTime()-(new Date).getTime():0)-2e4;t>h&&(w(`Timeout is too large (${t}ms), setting it to ${h}ms`),t=h),s();const e=new Date(Date.now()+t).toLocaleTimeString("en-US",{hour12:!1});w(`Setting refresh timer for ${e}. (${t}ms)`),u((()=>{w("Refreshing session due to timer"),p.refresh(S()||n)}),t)}var a}}));return n(p,["logout","logoutAll"],(t=>async(...e)=>{const n=await t(...e);return w("Clearing all timers"),s(),n}))}),(t=>e=>t(Object.assign(Object.assign({},e),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.13.1"},e.baseHeaders)}))),(t=>e=>{const o=K(),i=K(),a=t(l(e,{afterRequest:async(t,e)=>{if(401===(null==e?void 0:e.status))o.pub(null),i.pub(null);else{const t=await u(e);t&&i.pub(t);const{sessionJwt:n}=await c(e);n&&o.pub(n)}}})),r=n(a,["logout","logoutAll"],(t=>async(...e)=>{const n=await t(...e);return o.pub(null),i.pub(null),n}));return Object.assign(r,{onSessionTokenChange:o.sub,onUserChange:i.sub})}),(e=>o=>{var{storeLastAuthenticatedUser:i=!0}=o,a=t(o,["storeLastAuthenticatedUser"]);if(!i)return Object.assign(e(a),{getLastUserLoginId:J,getLastUserDisplayName:_});const r=e(l(a,{afterRequest:async(t,e)=>{var n;const o=await u(e),i=null===(n=null==o?void 0:o.loginIds)||void 0===n?void 0:n[0],a=null==o?void 0:o.name;i&&((t=>{g(T,t)})(i),(t=>{g(x,t)})(a))}}));let s=n(r,["flow.start"],C);return s=n(s,["logout","logoutAll"],R),Object.assign(s,{getLastUserLoginId:J,getLastUserDisplayName:_})}),(e=>o=>{var{persistTokens:a,sessionTokenViaCookie:r,storagePrefix:s}=o,u=t(o,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!a||!v)return a&&console.warn("Storing auth tokens in local storage and cookies are a client side only capabilities and will not be done when running in the server"),e(u);const d=e(l(u,{beforeRequest:(f=s,t=>Object.assign(t,{token:t.token||S(f)})),afterRequest:async(e,n)=>{const o=/^\/v\d+\/mgmt\//.test(e.path);401===(null==n?void 0:n.status)?o||I(s):((e={},n,o)=>{var{refreshJwt:i,sessionJwt:a}=e,r=t(e,["refreshJwt","sessionJwt"]);void 0===n&&(n=!1),void 0===o&&(o=""),i&&g(`${o}${m}`,i),a&&(n?y(b,a,r):g(`${o}${b}`,a))})(await c(n),r,s)}}));var f;const w=n(d,["logout","logoutAll"],$(s));return Object.assign(w,{getRefreshToken:()=>S(s),getSessionToken:()=>function(t=""){return i.get(b)||p(`${t}${b}`)||""}(s)})}))(((...t)=>{const n=e(...t);return Object.assign(Object.assign({},n),{flow:X(n),webauthn:B(n),fedcm:Z(n,t[0].projectId)})}));export{m as REFRESH_TOKEN_KEY,b as SESSION_TOKEN_KEY,D as clearFingerprintData,z as default,U as ensureFingerprintIds}; | ||
//# sourceMappingURL=index.esm.js.map |
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Descope=t()}(this,(function(){"use strict";const e=(e,t)=>{var n;return["beforeRequest","afterRequest"].reduce(((n,o)=>{var r;return n[o]=[].concat((null===(r=e.hooks)||void 0===r?void 0:r[o])||[]).concat((null==t?void 0:t[o])||[]),n}),null!==(n=e.hooks)&&void 0!==n?n:e.hooks={}),e},t=async e=>{if(!(null==e?void 0:e.ok))return{};const t=await(null==e?void 0:e.clone().json());return(null==t?void 0:t.authInfo)||t||{}},n=async e=>{const n=await t(e);return(null==n?void 0:n.user)||((null==n?void 0:n.hasOwnProperty("userId"))?n:void 0)},o="undefined"!=typeof localStorage,r=(e,t)=>o&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),i=e=>o&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),s=e=>o&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e));var a=function(){return a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},a.apply(this,arguments)};function c(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}function l(e){this.message=e}"function"==typeof SuppressedError&&SuppressedError,l.prototype=new Error,l.prototype.name="InvalidCharacterError";var u="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new l("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,r=0,i=0,s="";o=t.charAt(i++);~o&&(n=r%4?64*n+o:o,r++%4)?s+=String.fromCharCode(255&n>>(-2*r&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return s};function d(e){this.message=e}function p(e,t){if("string"!=typeof e)throw new d("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(function(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(u(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return u(t)}}(e.split(".")[n]))}catch(e){throw new d("Invalid token specified: "+e.message)}}d.prototype=new Error,d.prototype.name="InvalidTokenError";var g="/v1/auth/accesskey/exchange",f="/v1/auth/otp/verify",h="/v1/auth/otp/signin",v="/v1/auth/otp/signup",m={email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},w="/v1/auth/otp/signup-in",b="/v1/auth/magiclink/verify",y="/v1/auth/magiclink/signin",I="/v1/auth/magiclink/signup",k={email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},O="/v1/auth/magiclink/signup-in",j="/v1/auth/enchantedlink/verify",S="/v1/auth/enchantedlink/signin",U="/v1/auth/enchantedlink/signup",R="/v1/auth/enchantedlink/pending-session",P={email:"/v1/auth/enchantedlink/update/email"},E="/v1/auth/enchantedlink/signup-in",x="/v1/auth/oauth/authorize",T="/v1/auth/oauth/exchange",A="v1/auth/oauth/native/start",C="v1/auth/oauth/native/finish",$="/v1/auth/saml/authorize",D="/v1/auth/saml/exchange",q="/v1/auth/totp/verify",L="/v1/auth/totp/signup",_="/v1/auth/totp/update",J="/v1/auth/notp/whatsapp/signin",K="/v1/auth/notp/whatsapp/signup",N="/v1/auth/notp/whatsapp/signup-in",M="/v1/auth/notp/pending-session",V={start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},H={start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},B={start:"/v1/auth/webauthn/signup-in/start"},F={start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"},z="/v1/auth/password/signup",Z="/v1/auth/password/signin",G="/v1/auth/password/reset",X="/v1/auth/password/update",Y="/v1/auth/password/replace",Q="/v1/auth/password/policy",W="/v1/auth/refresh",ee="/v1/auth/tenant/select",te="/v1/auth/logout",ne="/v1/auth/logoutall",oe="/v1/auth/me",re="/v1/auth/me/history",ie="/v1/flow/start",se="/v1/flow/next";const ae="<region>",ce=`https://api.${ae}descope.com`,le=6e5,ue="dct",de=()=>{const e={};return{headers(t){const n="function"==typeof t.entries?Object.fromEntries(t.entries()):t;return e.Headers=JSON.stringify(n),this},body(t){return e.Body=t,this},url(t){return e.Url=t.toString(),this},method(t){return e.Method=t,this},title(t){return e.Title=t,this},status(t){return e.Status=t,this},build:()=>Object.keys(e).flatMap((t=>e[t]?[`${"Title"!==t?`${t}: `:""}${e[t]}`]:[])).join("\n")}};var pe;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT"}(pe||(pe={}));const ge=({path:e,baseUrl:t,queryParams:n,projectId:o})=>{const r=o.slice(1,-27);t=t.replace(ae,r?r+".":"");let i=e?`${t.replace(/\/$/,"")}/${null==e?void 0:e.replace(/^\//,"")}`:t;if(n){i=`${i}?`;const e=Object.keys(n);e.forEach(((t,o)=>{i=`${i}${t}=${n[t]}${o===e.length-1?"":"&"}`}))}return i},fe=(...e)=>new Headers(e.reduce(((e,t)=>{const n=(e=>Array.isArray(e)?e:e instanceof Headers?Array.from(e.entries()):e?Object.entries(e):[])(t);return n.reduce(((t,[n,o])=>(e[n]=o,e)),e),e}),{})),he=e=>void 0===e?void 0:JSON.stringify(e),ve=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},me=({baseUrl:e,projectId:t,baseConfig:n,logger:o,hooks:r,cookiePolicy:i,fetch:s})=>{const a=((e,t)=>{const n=(e=>async(...t)=>{const n=await e(...t),o=await n.text();return n.text=()=>Promise.resolve(o),n.json=()=>Promise.resolve(JSON.parse(o)),n.clone=()=>n,n})(t||fetch);return n||null==e||e.warn("Fetch is not defined, you will not be able to send http requests, if you are running in a test, make sure fetch is defined globally"),e?async(...t)=>{if(!n)throw Error("Cannot send http request, fetch is not defined, if you are running in a test, make sure fetch is defined globally");e.log((e=>de().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const o=await n(...t);return e[o.ok?"log":"error"](await(async e=>{const t=await e.text();return de().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(o)),o}:n})(o,s),c=async o=>{var s;const c=(null==r?void 0:r.beforeRequest)?r.beforeRequest(o):o,{path:l,body:u,headers:d,queryParams:p,method:g,token:f}=c,h={headers:fe(ve(t,f),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"2.20.0"},(null==n?void 0:n.baseHeaders)||{},d),method:g,body:he(u)};null!==i&&(h.credentials=i||"include");const v=await a(ge({path:l,baseUrl:e,queryParams:p,projectId:t}),h);if((null==r?void 0:r.afterRequest)&&await r.afterRequest(o,null==v?void 0:v.clone()),null==r?void 0:r.transformResponse){const e=await v.json(),t=((null===(s=v.headers)||void 0===s?void 0:s.get("set-cookie"))||"").split(";").reduce(((e,t)=>{const[n,o]=t.split("=");return Object.assign(Object.assign({},e),{[n.trim()]:o})}),{}),n=Object.assign(Object.assign({},v),{json:()=>Promise.resolve(e),cookies:t});return n.clone=()=>n,r.transformResponse(n)}return v};return{get:(e,{headers:t,queryParams:n,token:o}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:pe.get,token:o}),post:(e,t,{headers:n,queryParams:o,token:r}={})=>c({path:e,headers:n,queryParams:o,body:t,method:pe.post,token:r}),put:(e,t,{headers:n,queryParams:o,token:r}={})=>c({path:e,headers:n,queryParams:o,body:t,method:pe.put,token:r}),delete:(e,{headers:t,queryParams:n,token:o}={})=>c({path:e,headers:t,queryParams:n,body:void 0,method:pe.delete,token:o}),hooks:r,buildUrl:(n,o)=>ge({projectId:t,baseUrl:e,path:n,queryParams:o})}};var we=429;function be(e,t,n){var o;let r=ye(e);if(t){if(!(null==r?void 0:r.tenants)&&(null==r?void 0:r[ue])===t)return(null==r?void 0:r[n])||[];r=null===(o=null==r?void 0:r.tenants)||void 0===o?void 0:o[t]}const i=null==r?void 0:r[n];return Array.isArray(i)?i:[]}function ye(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return p(e)}function Ie(e){const{exp:t}=ye(e);return(new Date).getTime()/1e3>t}function ke(e){let t=ye(e);const n=Object.keys(null==t?void 0:t.tenants);return Array.isArray(n)?n:[]}function Oe(e,t){return be(e,t,"permissions")}function je(e,t){return be(e,t,"roles")}const Se=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function Ue(e,t){var n;const o=await e,r={code:o.status,ok:o.ok,response:o},i=await o.clone().json();return o.ok?r.data=t?t(i):i:(r.error=i,o.status===we&&Object.assign(r.error,{retryAfter:Number.parseInt(null===(n=o.headers)||void 0===n?void 0:n.get("retry-after"))||0})),r}const Re=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Pe=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Ee=e=>t=>e.test(t),xe=Ee(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),Te=Ee(/^\+[1-9]{1}[0-9]{3,14}$/),Ae=Re(xe,'"{val}" is not a valid email'),Ce=Re(Te,'"{val}" is not a valid phone number'),$e=Re((1,e=>e.length>=1),"Minimum length is 1");const De=Re((e=>"string"==typeof e),"Input is not a string"),qe=Re((e=>void 0===e),"Input is defined"),Le=(_e=[De(),qe()],"Input is not a string or undefined",(e="Input is not a string or undefined")=>t=>{const n=_e.filter((e=>e(t)));return!(n.length<_e.length)&&(e?e.replace("{val}",t):n.join(" OR "))});var _e;const Je=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>Pe(...e).validate(n[t]))),t(...n)),Ke=e=>[De(`"${e}" must be a string`)],Ne=e=>[De(`"${e}" must be a string`),$e(`"${e}" must not be empty`)],Me=e=>[De(`"${e}" must be a string`),Ae()],Ve=e=>[De(`"${e}" must be a string`),Ce()],He=Je(Ne("accessKey")),Be=e=>({exchange:He(((t,n)=>Ue(e.post(g,{loginOptions:n},{token:t}))))}),Fe=(e,t,n)=>(t.forEach((t=>{const o=t.split(".");let r=o.shift(),i=e;for(;o.length>0;){if(i=i[r],!r||!i)throw Error(`Invalid path "${t}", "${r}" is missing or has no value`);r=o.shift()}if("function"!=typeof i[r])throw Error(`"${t}" is not a function`);const s=i[r];i[r]=n(s)})),e),ze=({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||le,le)});var Ze,Ge;!function(e){e.sms="sms",e.voice="voice",e.whatsapp="whatsapp"}(Ze||(Ze={})),function(e){e.email="email"}(Ge||(Ge={}));const Xe=Object.assign(Object.assign({},Ze),Ge);var Ye;!function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(Ye||(Ye={}));const Qe=Ne("loginId"),We=Je(Ne("token")),et=Je(Qe),tt=Je(Ne("pendingRef")),nt=Je(Qe,Me("email")),ot=e=>({verify:We((t=>Ue(e.post(j,{token:t})))),signIn:et(((t,n,o,r)=>Ue(e.post(Se(S,Xe.email),{loginId:t,URI:n,loginOptions:o},{token:r})))),signUpOrIn:et(((t,n,o)=>Ue(e.post(Se(E,Xe.email),{loginId:t,URI:n,loginOptions:o})))),signUp:et(((t,n,o,r)=>Ue(e.post(Se(U,Xe.email),{loginId:t,URI:n,user:o,loginOptions:r})))),waitForSession:tt(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=ze(n);let s;const a=setInterval((async()=>{const n=await e.post(R,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(Ue(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)})))),update:{email:nt(((t,n,o,r,i)=>Ue(e.post(P.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r}))))}}),rt=Je(Ne("flowId")),it=Je(Ne("executionId"),Ne("stepId"),Ne("interactionId")),st=e=>({start:rt(((t,n,o,r,i,s,a)=>Ue(e.post(ie,{flowId:t,options:n,conditionInteractionId:o,interactionId:r,version:i,componentsVersion:s,input:a})))),next:it(((t,n,o,r,i,s)=>Ue(e.post(se,{executionId:t,stepId:n,interactionId:o,version:r,componentsVersion:i,input:s}))))}),at=Ne("loginId"),ct=Je(Ne("token")),lt=Je(at),ut=Je(at,Ve("phone")),dt=Je(at,Me("email")),pt=Object.keys(Xe).filter((e=>e!==Ze.voice)),gt=e=>({verify:ct((t=>Ue(e.post(b,{token:t})))),signIn:pt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:lt(((t,o,r,i)=>Ue(e.post(Se(y,n),{loginId:t,URI:o,loginOptions:r},{token:i}))))})),{}),signUp:pt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:lt(((t,o,r,i)=>Ue(e.post(Se(I,n),{loginId:t,URI:o,user:r,loginOptions:i}))))})),{}),signUpOrIn:pt.reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:lt(((t,o,r)=>Ue(e.post(Se(O,n),{loginId:t,URI:o,loginOptions:r}))))})),{}),update:{email:dt(((t,n,o,r,i)=>Ue(e.post(k.email,Object.assign({loginId:t,email:n,URI:o},i),{token:r})))),phone:Object.keys(Ze).filter((e=>e!==Ze.voice)).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ut(((t,o,r,i,s)=>Ue(e.post(Se(k.phone,n),Object.assign({loginId:t,phone:o,URI:r},s),{token:i}))))})),{})}});var ft;!function(e){e.facebook="facebook",e.github="github",e.google="google",e.microsoft="microsoft",e.gitlab="gitlab",e.apple="apple",e.discord="discord",e.linkedin="linkedin",e.slack="slack"}(ft||(ft={}));const ht=Je(Ne("code")),vt=e=>({start:Object.assign(((t,n,o,r)=>Ue(e.post(x,o||{},{queryParams:Object.assign({provider:t},n&&{redirectURL:n}),token:r}))),Object.keys(ft).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:(t,o,r)=>Ue(e.post(x,o||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:r}))})),{})),exchange:ht((t=>Ue(e.post(T,{code:t})))),startNative:(t,n,o)=>Ue(e.post(A,{provider:t,loginOptions:n,implicit:o})),finishNative:(t,n,o,r,i)=>Ue(e.post(C,{provider:t,stateId:n,user:o,code:r,idToken:i}))}),mt=Ne("loginId"),wt=Je(mt,Ne("code")),bt=Je(mt),yt=Je(mt,Ve("phone")),It=Je(mt,Me("email")),kt=e=>({verify:Object.keys(Xe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:wt(((t,o)=>Ue(e.post(Se(f,n),{code:o,loginId:t}))))})),{}),signIn:Object.keys(Xe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:bt(((t,o,r)=>Ue(e.post(Se(h,n),{loginId:t,loginOptions:o},{token:r}))))})),{}),signUp:Object.keys(Xe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:bt(((t,o,r)=>Ue(e.post(Se(v,n),{loginId:t,user:o,loginOptions:r}))))})),{}),signUpOrIn:Object.keys(Xe).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:bt(((t,o)=>Ue(e.post(Se(w,n),{loginId:t,loginOptions:o}))))})),{}),update:{email:It(((t,n,o,r)=>Ue(e.post(m.email,Object.assign({loginId:t,email:n},r),{token:o})))),phone:Object.keys(Ze).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:yt(((t,o,r,i)=>Ue(e.post(Se(m.phone,n),Object.assign({loginId:t,phone:o},i),{token:r}))))})),{})}}),Ot=Je(Ne("tenant")),jt=Je(Ne("code")),St=e=>({start:Ot(((t,n,o,r)=>Ue(e.post($,o||{},{queryParams:{tenant:t,redirectURL:n},token:r})))),exchange:jt((t=>Ue(e.post(D,{code:t}))))}),Ut=Ne("loginId"),Rt=Je(Ut,Ne("code")),Pt=Je(Ut),Et=Je(Ut),xt=e=>({signUp:Pt(((t,n)=>Ue(e.post(L,{loginId:t,user:n})))),verify:Rt(((t,n,o,r)=>Ue(e.post(q,{loginId:t,code:n,loginOptions:o},{token:r})))),update:Et(((t,n)=>Ue(e.post(_,{loginId:t},{token:n}))))}),Tt=Ne("loginId"),At=Ne("newPassword"),Ct=Je(Tt,Ne("password")),$t=Je(Tt),Dt=Je(Tt,At),qt=Je(Tt,Ne("oldPassword"),At),Lt=e=>({signUp:Ct(((t,n,o,r)=>Ue(e.post(z,{loginId:t,password:n,user:o,loginOptions:r})))),signIn:Ct(((t,n,o)=>Ue(e.post(Z,{loginId:t,password:n,loginOptions:o})))),sendReset:$t(((t,n,o)=>Ue(e.post(G,{loginId:t,redirectUrl:n,templateOptions:o})))),update:Dt(((t,n,o)=>Ue(e.post(X,{loginId:t,newPassword:n},{token:o})))),replace:qt(((t,n,o)=>Ue(e.post(Y,{loginId:t,oldPassword:n,newPassword:o})))),policy:()=>Ue(e.get(Q))}),_t=Ke("loginId"),Jt=Ne("loginId"),Kt=Ne("origin"),Nt=Je(Jt,Kt,Ne("name")),Mt=Je(Jt,Kt),Vt=Je(_t,Kt),Ht=Je(Jt,Kt,Ne("token")),Bt=Je(Ne("transactionId"),Ne("response")),Ft=e=>({signUp:{start:Nt(((t,n,o)=>Ue(e.post(V.start,{user:{loginId:t,name:o},origin:n})))),finish:Bt(((t,n)=>Ue(e.post(V.finish,{transactionId:t,response:n}))))},signIn:{start:Vt(((t,n,o,r)=>Ue(e.post(H.start,{loginId:t,origin:n,loginOptions:o},{token:r})))),finish:Bt(((t,n)=>Ue(e.post(H.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:Mt(((t,n)=>Ue(e.post(B.start,{loginId:t,origin:n}))))},update:{start:Ht(((t,n,o)=>Ue(e.post(F.start,{loginId:t,origin:n},{token:o})))),finish:Bt(((t,n)=>Ue(e.post(F.finish,{transactionId:t,response:n}))))}}),zt=Ke("loginId"),Zt=Je(zt),Gt=Je(Ne("pendingRef")),Xt=e=>({signUpOrIn:Zt(((t,n)=>Ue(e.post(N,{loginId:t,loginOptions:n})))),signUp:Zt(((t,n,o)=>Ue(e.post(K,{loginId:t,user:n,loginOptions:o})))),signIn:Zt(((t,n,o)=>Ue(e.post(J,{loginId:t,loginOptions:n},{token:o})))),waitForSession:Gt(((t,n)=>new Promise((o=>{const{pollingIntervalMs:r,timeoutMs:i}=ze(n);let s;const a=setInterval((async()=>{const n=await e.post(M,{pendingRef:t});n.ok&&(clearInterval(a),s&&clearTimeout(s),o(Ue(Promise.resolve(n))))}),r);s=setTimeout((()=>{o({error:{errorDescription:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(a)}),i)}))))}),Yt=Je(Ne("token")),Qt=Je([Le('"token" must be string or undefined')]);var Wt,en=Je([("projectId",Wt=Ne("projectId"),Re(((e,t)=>n=>Pe(...t).validate(((e,t,n)=>{const o=(Array.isArray(t)?t.join("."):String(t)).replace(/\[\\?("|')?(\w|d)+\\?("|')?\]/g,((e,t,n)=>"."+n)).split("."),r=o.length;let i=0,s=e===Object(e)?e:void 0;for(;null!=s&&i<r;)s=s[o[i++]];return i&&i===r&&void 0!==s?s:void 0})(n,e)))("projectId",Wt))())])((e=>{var t;return(({projectId:e,logger:t,baseUrl:n,hooks:o,cookiePolicy:r,baseHeaders:i={},fetch:s})=>{return a=me({baseUrl:n||ce,projectId:e,logger:t,hooks:o,cookiePolicy:r,baseConfig:{baseHeaders:i},fetch:s}),{accessKey:Be(a),otp:kt(a),magicLink:gt(a),enchantedLink:ot(a),oauth:vt(a),saml:St(a),totp:xt(a),notp:Xt(a),webauthn:Ft(a),password:Lt(a),flow:st(a),refresh:Qt((e=>Ue(a.post(W,{},{token:e})))),selectTenant:Je([De("tenantId")],[Le('"token" must be string or undefined')])(((e,t)=>Ue(a.post(ee,{tenant:e},{token:t})))),logout:Qt((e=>Ue(a.post(te,{},{token:e})))),logoutAll:Qt((e=>Ue(a.post(ne,{},{token:e})))),me:Qt((e=>Ue(a.get(oe,{token:e})))),history:Qt((e=>Ue(a.get(re,{token:e})))),isJwtExpired:Yt(Ie),getTenants:Yt(ke),getJwtPermissions:Yt(Oe),getJwtRoles:Yt(je),httpClient:a};var a})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:t=>{var n;const o=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.beforeRequest)||[]);return null==o?void 0:o.reduce(((e,t)=>t(e)),t)},afterRequest:async(t,n)=>{var o;const r=[].concat((null===(o=e.hooks)||void 0===o?void 0:o.afterRequest)||[]);(await Promise.allSettled(null==r?void 0:r.map((e=>e(t,null==n?void 0:n.clone()))))).forEach((t=>{var n;return"rejected"===t.status&&(null===(n=e.logger)||void 0===n?void 0:n.error(t.reason))}))},transformResponse:null===(t=e.hooks)||void 0===t?void 0:t.transformResponse}}))})),tn=Object.assign(en,{DeliveryMethods:Xe});const nn=(...e)=>{console.debug(...e)},on="undefined"!=typeof window,rn=Math.pow(2,31)-1; | ||
/*! js-cookie v3.0.5 | MIT */ | ||
function sn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var an=function e(t,n){function o(e,o,r){if("undefined"!=typeof document){"number"==typeof(r=sn({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var s in r)r[s]&&(i+="; "+s,!0!==r[s]&&(i+="="+r[s].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+i}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],o={},r=0;r<n.length;r++){var i=n[r].split("="),s=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(o[a]=t.read(s,a),e===a)break}catch(e){}}return e?o[e]:o}},remove:function(e,t){o(e,"",sn({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,sn({},this.attributes,t))},withConverter:function(t){return e(sn({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});const cn="DS",ln="DSR";function un(e,t,{cookiePath:n,cookieDomain:o,cookieExpiration:r}){if(t){const i=new Date(1e3*r),s=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(o);an.set(e,t,{path:n,domain:s?o:void 0,expires:i,sameSite:"Strict",secure:!0})}}function dn(e=""){return i(`${e}${ln}`)||""}function pn(e=""){s(`${e}${ln}`),s(`${e}${cn}`),an.remove(cn)}const gn=on&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com";var fn={default:"endpoint"},hn="Blocked by CSP",vn="The endpoint parameter is not a valid URL",mn="Failed to load the JS script of the agent",wn="9319";function bn(e,t){var n,o,r,i,s=[],a=(n=function(e){var t=function(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}([],e,!0);return{current:function(){return t[0]},postpone:function(){var e=t.shift();void 0!==e&&t.push(e)},exclude:function(){t.shift()}}}(e),100,3e3,i=0,o=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,i++))},r=new Set,[n.current(),function(e,t){var i,s=t instanceof Error?t.message:"";if(s===hn||s===vn)n.exclude(),i=0;else if(s===wn)n.exclude();else if(s===mn){var a=Date.now()-e.getTime()<50,c=n.current();c&&a&&!r.has(c)&&(r.add(c),i=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=i?i:e.getTime()+o()-Date.now()]}]),c=a[0],l=a[1];if(void 0===c)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var u=function(e){var n=new Date,o=function(t){return s.push({url:e,startedAt:n,finishedAt:new Date,error:t})},r=t(e);return r.then((function(){return o()}),o),r.catch((function(e){if(s.length>=5)throw e;var t=l(n,e);if(!t)throw e;var o,r=t[0],i=t[1];return(o=i,new Promise((function(e){return setTimeout(e,o)}))).then((function(){return u(r)}))}))};return u(c).then((function(e){return[e,s]}))}var yn="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",In=yn;function kn(e){var t;e.scriptUrlPattern;var n=e.token,o=e.apiKey,r=void 0===o?n:o,i=c(e,["scriptUrlPattern","token","apiKey"]),s=null!==(t=function(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)?e[t]:void 0}(e,"scriptUrlPattern"))&&void 0!==t?t:yn,l=function(){var e=[],t=function(){e.push({time:new Date,state:document.visibilityState})},n=function(e,t,n,o){return e.addEventListener(t,n,o),function(){return e.removeEventListener(t,n,o)}}(document,"visibilitychange",t);return t(),[e,n]}(),u=l[0],d=l[1];return Promise.resolve().then((function(){if(!r||"string"!=typeof r)throw new Error("API key required");var e=function(e,t){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,t){var n=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?n(t):"<loaderVersion>"===e?n("3.9.6"):e}))}(String(e),t)}))}(s,r);return bn(e,On)})).catch((function(e){throw d(),function(e){return e instanceof Error&&e.message===wn?new Error(mn):e}(e)})).then((function(e){var t=e[0],n=e[1];return d(),t.load(a(a({},i),{ldi:{attempts:n,visibilityStates:u}}))}))}function On(e){return function(e,t,n,o){var r,i=document,s="securitypolicyviolation",a=function(t){var n=new URL(e,location.href),o=t.blockedURI;o!==n.href&&o!==n.protocol.slice(0,-1)&&o!==n.origin||(r=t,c())};i.addEventListener(s,a);var c=function(){return i.removeEventListener(s,a)};return Promise.resolve().then(t).then((function(e){return c(),e}),(function(e){return new Promise((function(e){return setTimeout(e)})).then((function(){if(c(),r)return function(){throw new Error(hn)}();throw e}))}))}(e,(function(){return function(e){return new Promise((function(t,n){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(e){if(e instanceof Error&&"TypeError"===e.name)return!0;throw e}}(e))throw new Error(vn);var o=document.createElement("script"),r=function(){var e;return null===(e=o.parentNode)||void 0===e?void 0:e.removeChild(o)},i=document.head||document.getElementsByTagName("head")[0];o.onload=function(){r(),t()},o.onerror=function(){r(),n(new Error(mn))},o.async=!0,o.src=e,i.appendChild(o)}))}(e)})).then(jn)}function jn(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,o=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==o?void 0:o.configurable)?delete e[t]:o&&!o.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error(wn);return n}const Sn=(e=!1)=>{const t=localStorage.getItem("fp");if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},Un=async(e,t=gn)=>{try{if(Sn())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),o=new URL(t);o.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const i=r.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=kn({apiKey:e,endpoint:[o.toString(),fn],scriptUrlPattern:[i,In]}),a=await s,{requestId:c}=await a.get({linkedId:n}),l=((e,t)=>({vsid:e,vrid:t}))(n,c);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem("fp",JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},Rn=e=>{const t=Sn(!0);return t&&e.body&&(e.body.fpData=t),e},Pn="dls_last_user_login_id",En="dls_last_user_display_name",xn=()=>i(Pn),Tn=()=>i(En),An=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=xn(),i=Tn();r&&(null!==(n=o.lastAuth)&&void 0!==n||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i);return await e(...t)},Cn=e=>async(...t)=>{const n=await e(...t);return s(Pn),s(En),n};function $n(){const e=[];return{pub:t=>{e.forEach((e=>e(t)))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}const Dn=e=>t=>async(...n)=>{const o=await t(...n);return pn(e),o};async function qn(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Mn(n.publicKey.challenge),n.publicKey.user.id=Mn(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=Mn(e.id)})),n}(e),n=await navigator.credentials.create(t);return o=n,JSON.stringify({id:o.id,rawId:Vn(o.rawId),type:o.type,response:{attestationObject:Vn(o.response.attestationObject),clientDataJSON:Vn(o.response.clientDataJSON)}});var o}async function Ln(e){const t=Kn(e);return Nn(await navigator.credentials.get(t))}async function _n(e,t){const n=Kn(e);n.signal=t.signal,n.mediation="conditional";return Nn(await navigator.credentials.get(n))}async function Jn(e=!1){if(!on)return Promise.resolve(!1);const t=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function Kn(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Mn(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=Mn(e.id)})),n}function Nn(e){return JSON.stringify({id:e.id,rawId:Vn(e.rawId),type:e.type,response:{authenticatorData:Vn(e.response.authenticatorData),clientDataJSON:Vn(e.response.clientDataJSON),signature:Vn(e.response.signature),userHandle:e.response.userHandle?Vn(e.response.userHandle):void 0}})}function Mn(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function Vn(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var Hn,Bn=(Hn=e=>({async signUp(t,n){const o=await e.webauthn.signUp.start(t,window.location.origin,n);if(!o.ok)return o;const r=await qn(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,r)},async signIn(t){const n=await e.webauthn.signIn.start(t,window.location.origin);if(!n.ok)return n;const o=await Ln(n.data.options);return await e.webauthn.signIn.finish(n.data.transactionId,o)},async signUpOrIn(t){var n;const o=await e.webauthn.signUpOrIn.start(t,window.location.origin);if(!o.ok)return o;if(null===(n=o.data)||void 0===n?void 0:n.create){const t=await qn(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,t)}{const t=await Ln(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,t)}},async update(t,n){const o=await e.webauthn.update.start(t,window.location.origin,n);if(!o.ok)return o;const r=await qn(o.data.options);return await e.webauthn.update.finish(o.data.transactionId,r)},helpers:{create:qn,get:Ln,isSupported:Jn,conditional:_n}}),(...e)=>{const t=Hn(...e);return Object.assign(t.signUp,e[0].webauthn.signUp),Object.assign(t.signIn,e[0].webauthn.signIn),Object.assign(t.signUpOrIn,e[0].webauthn.signUpOrIn),Object.assign(t.update,e[0].webauthn.update),t});const Fn={config:"/fedcm/config"},zn=(e,t)=>({async oneTap(t,n,o,r){const i=null!=t?t:"google",s=await e.oauth.startNative(i,o,!0);if(!s.ok)return s;const{clientId:a,stateId:c,nonce:l}=s.data,u=await async function(){return new Promise(((e,t)=>{if(window.google)return void e(window.google.accounts.id);let n=document.getElementById("google-gsi-client-script");n||(n=document.createElement("script"),document.head.appendChild(n),n.async=!0,n.defer=!0,n.id="google-gsi-client-script",n.src="https://accounts.google.com/gsi/client"),n.onload=function(){window.google?e(window.google.accounts.id):t("Failed to load Google GSI client script - not loaded properly")},n.onerror=function(){t("Failed to load Google GSI client script - failed to load")}}))}();return new Promise((t=>{var o,s;u.initialize(Object.assign(Object.assign({},n),{itp_support:null===(o=null==n?void 0:n.itp_support)||void 0===o||o,use_fedcm_for_prompt:null===(s=null==n?void 0:n.use_fedcm_for_prompt)||void 0===s||s,client_id:a,callback:n=>{t(e.oauth.finishNative(i,c,"","",n.credential))},nonce:l})),u.prompt((e=>{(null==e?void 0:e.isSkippedMoment())&&(null==r||r())}))}))},async launch(n){var o;const r={identity:{context:n||"signin",providers:[{configURL:e.httpClient.buildUrl(t+Fn.config),clientId:t}]}},i=await(null===(o=navigator.credentials)||void 0===o?void 0:o.get(r));return e.refresh(i.token)},isSupported:()=>on&&"IdentityCredential"in window});var Zn=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Jn(),o=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=o,e.flow.start(...t)}});const Gn=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((t=>n=>{var{fpKey:o,fpLoad:r}=n,i=c(n,["fpKey","fpLoad"]);return on?(o&&r&&Un(o).catch((()=>null)),t(e(i,{beforeRequest:Rn}))):(console.warn("Fingerprint is a client side only capability and will not work when running in the server"),t(i))}),(n=>o=>{var{autoRefresh:r}=o,i=c(o,["autoRefresh"]);if(!r)return n(i);const{clearAllTimers:s,setTimer:a}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let l,u;on&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>l&&(nn("Expiration time passed, refreshing session"),d.refresh(dn()||u))}));const d=n(e(i,{afterRequest:async(e,n)=>{const{refreshJwt:o,sessionJwt:r}=await t(n);if(401===(null==n?void 0:n.status))nn("Received 401, canceling all timers"),s();else if(r){if(l=(e=>{try{const t=p(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(r),!l)return void nn("Could not extract expiration time from session token");u=o;let e=((i=l)?i.getTime()-(new Date).getTime():0)-2e4;e>rn&&(nn(`Timeout is too large (${e}ms), setting it to ${rn}ms`),e=rn),s();const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});nn(`Setting refresh timer for ${t}. (${e}ms)`),a((()=>{nn("Refreshing session due to timer"),d.refresh(dn()||o)}),e)}var i}}));return Fe(d,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return nn("Clearing all timers"),s(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.13.0"},t.baseHeaders)}))),(o=>r=>{const i=$n(),s=$n(),a=o(e(r,{afterRequest:async(e,o)=>{if(401===(null==o?void 0:o.status))i.pub(null),s.pub(null);else{const e=await n(o);e&&s.pub(e);const{sessionJwt:r}=await t(o);r&&i.pub(r)}}})),c=Fe(a,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return i.pub(null),s.pub(null),n}));return Object.assign(c,{onSessionTokenChange:i.sub,onUserChange:s.sub})}),(t=>o=>{var{storeLastAuthenticatedUser:i=!0}=o,s=c(o,["storeLastAuthenticatedUser"]);if(!i)return Object.assign(t(s),{getLastUserLoginId:xn,getLastUserDisplayName:Tn});const a=t(e(s,{afterRequest:async(e,t)=>{var o;const i=await n(t),s=null===(o=null==i?void 0:i.loginIds)||void 0===o?void 0:o[0],a=null==i?void 0:i.name;s&&((e=>{r(Pn,e)})(s),(e=>{r(En,e)})(a))}}));let l=Fe(a,["flow.start"],An);return l=Fe(l,["logout","logoutAll"],Cn),Object.assign(l,{getLastUserLoginId:xn,getLastUserDisplayName:Tn})}),(n=>o=>{var{persistTokens:s,sessionTokenViaCookie:a,storagePrefix:l}=o,u=c(o,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!s||!on)return s&&console.warn("Storing auth tokens in local storage and cookies are a client side only capabilities and will not be done when running in the server"),n(u);const d=n(e(u,{beforeRequest:(p=l,e=>Object.assign(e,{token:e.token||dn(p)})),afterRequest:async(e,n)=>{const o=/^\/v\d+\/mgmt\//.test(e.path);401===(null==n?void 0:n.status)?o||pn(l):((e={},t,n)=>{var{refreshJwt:o,sessionJwt:i}=e,s=c(e,["refreshJwt","sessionJwt"]);void 0===t&&(t=!1),void 0===n&&(n=""),o&&r(`${n}${ln}`,o),i&&(t?un(cn,i,s):r(`${n}${cn}`,i))})(await t(n),a,l)}}));var p;const g=Fe(d,["logout","logoutAll"],Dn(l));return Object.assign(g,{getRefreshToken:()=>dn(l),getSessionToken:()=>function(e=""){return an.get(cn)||i(`${e}${cn}`)||""}(l)})}))(((...e)=>{const t=tn(...e);return Object.assign(Object.assign({},t),{flow:Zn(t),webauthn:Bn(t),fedcm:zn(t,e[0].projectId)})}));return Gn.REFRESH_TOKEN_KEY=ln,Gn.SESSION_TOKEN_KEY=cn,Gn})); | ||
function sn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}var an=function e(t,n){function o(e,o,r){if("undefined"!=typeof document){"number"==typeof(r=sn({},n,r)).expires&&(r.expires=new Date(Date.now()+864e5*r.expires)),r.expires&&(r.expires=r.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var s in r)r[s]&&(i+="; "+s,!0!==r[s]&&(i+="="+r[s].split(";")[0]));return document.cookie=e+"="+t.write(o,e)+i}}return Object.create({set:o,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],o={},r=0;r<n.length;r++){var i=n[r].split("="),s=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(o[a]=t.read(s,a),e===a)break}catch(e){}}return e?o[e]:o}},remove:function(e,t){o(e,"",sn({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,sn({},this.attributes,t))},withConverter:function(t){return e(sn({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"});const cn="DS",ln="DSR";function un(e,t,{cookiePath:n,cookieDomain:o,cookieExpiration:r}){if(t){const i=new Date(1e3*r),s=function(e){const t=window.location.hostname.split("."),n=e.split(".");return t.slice(-n.length).join(".")===e}(o);an.set(e,t,{path:n,domain:s?o:void 0,expires:i,sameSite:"Strict",secure:!0})}}function dn(e=""){return i(`${e}${ln}`)||""}function pn(e=""){s(`${e}${ln}`),s(`${e}${cn}`),an.remove(cn)}const gn=on&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://api.descope.com";var fn={default:"endpoint"},hn="Blocked by CSP",vn="The endpoint parameter is not a valid URL",mn="Failed to load the JS script of the agent",wn="9319";function bn(e,t){var n,o,r,i,s=[],a=(n=function(e){var t=function(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}([],e,!0);return{current:function(){return t[0]},postpone:function(){var e=t.shift();void 0!==e&&t.push(e)},exclude:function(){t.shift()}}}(e),100,3e3,i=0,o=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,i++))},r=new Set,[n.current(),function(e,t){var i,s=t instanceof Error?t.message:"";if(s===hn||s===vn)n.exclude(),i=0;else if(s===wn)n.exclude();else if(s===mn){var a=Date.now()-e.getTime()<50,c=n.current();c&&a&&!r.has(c)&&(r.add(c),i=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=i?i:e.getTime()+o()-Date.now()]}]),c=a[0],l=a[1];if(void 0===c)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var u=function(e){var n=new Date,o=function(t){return s.push({url:e,startedAt:n,finishedAt:new Date,error:t})},r=t(e);return r.then((function(){return o()}),o),r.catch((function(e){if(s.length>=5)throw e;var t=l(n,e);if(!t)throw e;var o,r=t[0],i=t[1];return(o=i,new Promise((function(e){return setTimeout(e,o)}))).then((function(){return u(r)}))}))};return u(c).then((function(e){return[e,s]}))}var yn="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",In=yn;function kn(e){var t;e.scriptUrlPattern;var n=e.token,o=e.apiKey,r=void 0===o?n:o,i=c(e,["scriptUrlPattern","token","apiKey"]),s=null!==(t=function(e,t){return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)?e[t]:void 0}(e,"scriptUrlPattern"))&&void 0!==t?t:yn,l=function(){var e=[],t=function(){e.push({time:new Date,state:document.visibilityState})},n=function(e,t,n,o){return e.addEventListener(t,n,o),function(){return e.removeEventListener(t,n,o)}}(document,"visibilitychange",t);return t(),[e,n]}(),u=l[0],d=l[1];return Promise.resolve().then((function(){if(!r||"string"!=typeof r)throw new Error("API key required");var e=function(e,t){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,t){var n=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?n(t):"<loaderVersion>"===e?n("3.9.6"):e}))}(String(e),t)}))}(s,r);return bn(e,On)})).catch((function(e){throw d(),function(e){return e instanceof Error&&e.message===wn?new Error(mn):e}(e)})).then((function(e){var t=e[0],n=e[1];return d(),t.load(a(a({},i),{ldi:{attempts:n,visibilityStates:u}}))}))}function On(e){return function(e,t,n,o){var r,i=document,s="securitypolicyviolation",a=function(t){var n=new URL(e,location.href),o=t.blockedURI;o!==n.href&&o!==n.protocol.slice(0,-1)&&o!==n.origin||(r=t,c())};i.addEventListener(s,a);var c=function(){return i.removeEventListener(s,a)};return Promise.resolve().then(t).then((function(e){return c(),e}),(function(e){return new Promise((function(e){return setTimeout(e)})).then((function(){if(c(),r)return function(){throw new Error(hn)}();throw e}))}))}(e,(function(){return function(e){return new Promise((function(t,n){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(e){if(e instanceof Error&&"TypeError"===e.name)return!0;throw e}}(e))throw new Error(vn);var o=document.createElement("script"),r=function(){var e;return null===(e=o.parentNode)||void 0===e?void 0:e.removeChild(o)},i=document.head||document.getElementsByTagName("head")[0];o.onload=function(){r(),t()},o.onerror=function(){r(),n(new Error(mn))},o.async=!0,o.src=e,i.appendChild(o)}))}(e)})).then(jn)}function jn(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,o=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==o?void 0:o.configurable)?delete e[t]:o&&!o.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error(wn);return n}const Sn=(e=!1)=>{const t=localStorage.getItem("fp");if(!t)return null;const n=JSON.parse(t);return(new Date).getTime()>n.expiry&&!e?null:n.value},Un=async(e,t=gn)=>{try{if(Sn())return;const n=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),o=new URL(t);o.pathname="/fXj8gt3x8VulJBna/x96Emn69oZwcd7I6";const r=new URL(t);r.pathname="/fXj8gt3x8VulJBna/w78aRZnnDZ3Aqw0I";const i=r.toString()+"?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",s=kn({apiKey:e,endpoint:[o.toString(),fn],scriptUrlPattern:[i,In]}),a=await s,{requestId:c}=await a.get({linkedId:n}),l=((e,t)=>({vsid:e,vrid:t}))(n,c);(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem("fp",JSON.stringify(t))})(l)}catch(e){console.warn("Could not load fingerprint",e)}},Rn=e=>{const t=Sn(!0);return t&&e.body&&(e.body.fpData=t),e},Pn="dls_last_user_login_id",En="dls_last_user_display_name",xn=()=>i(Pn),Tn=()=>i(En),An=e=>async(...t)=>{var n;t[1]=t[1]||{};const[,o={}]=t,r=xn(),i=Tn();r&&(null!==(n=o.lastAuth)&&void 0!==n||(o.lastAuth={}),o.lastAuth.loginId=r,o.lastAuth.name=i);return await e(...t)},Cn=e=>async(...t)=>{const n=await e(...t);return s(Pn),s(En),n};function $n(){const e=[];return{pub:t=>{e.forEach((e=>e(t)))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}const Dn=e=>t=>async(...n)=>{const o=await t(...n);return pn(e),o};async function qn(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Mn(n.publicKey.challenge),n.publicKey.user.id=Mn(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=Mn(e.id)})),n}(e),n=await navigator.credentials.create(t);return o=n,JSON.stringify({id:o.id,rawId:Vn(o.rawId),type:o.type,response:{attestationObject:Vn(o.response.attestationObject),clientDataJSON:Vn(o.response.clientDataJSON)}});var o}async function Ln(e){const t=Kn(e);return Nn(await navigator.credentials.get(t))}async function _n(e,t){const n=Kn(e);n.signal=t.signal,n.mediation="conditional";return Nn(await navigator.credentials.get(n))}async function Jn(e=!1){if(!on)return Promise.resolve(!1);const t=!!(window.PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function Kn(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Mn(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=Mn(e.id)})),n}function Nn(e){return JSON.stringify({id:e.id,rawId:Vn(e.rawId),type:e.type,response:{authenticatorData:Vn(e.response.authenticatorData),clientDataJSON:Vn(e.response.clientDataJSON),signature:Vn(e.response.signature),userHandle:e.response.userHandle?Vn(e.response.userHandle):void 0}})}function Mn(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function Vn(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var Hn,Bn=(Hn=e=>({async signUp(t,n){const o=await e.webauthn.signUp.start(t,window.location.origin,n);if(!o.ok)return o;const r=await qn(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,r)},async signIn(t){const n=await e.webauthn.signIn.start(t,window.location.origin);if(!n.ok)return n;const o=await Ln(n.data.options);return await e.webauthn.signIn.finish(n.data.transactionId,o)},async signUpOrIn(t){var n;const o=await e.webauthn.signUpOrIn.start(t,window.location.origin);if(!o.ok)return o;if(null===(n=o.data)||void 0===n?void 0:n.create){const t=await qn(o.data.options);return await e.webauthn.signUp.finish(o.data.transactionId,t)}{const t=await Ln(o.data.options);return await e.webauthn.signIn.finish(o.data.transactionId,t)}},async update(t,n){const o=await e.webauthn.update.start(t,window.location.origin,n);if(!o.ok)return o;const r=await qn(o.data.options);return await e.webauthn.update.finish(o.data.transactionId,r)},helpers:{create:qn,get:Ln,isSupported:Jn,conditional:_n}}),(...e)=>{const t=Hn(...e);return Object.assign(t.signUp,e[0].webauthn.signUp),Object.assign(t.signIn,e[0].webauthn.signIn),Object.assign(t.signUpOrIn,e[0].webauthn.signUpOrIn),Object.assign(t.update,e[0].webauthn.update),t});const Fn={config:"/fedcm/config"},zn=(e,t)=>({async oneTap(t,n,o,r){const i=null!=t?t:"google",s=await e.oauth.startNative(i,o,!0);if(!s.ok)return s;const{clientId:a,stateId:c,nonce:l}=s.data,u=await async function(){return new Promise(((e,t)=>{if(window.google)return void e(window.google.accounts.id);let n=document.getElementById("google-gsi-client-script");n||(n=document.createElement("script"),document.head.appendChild(n),n.async=!0,n.defer=!0,n.id="google-gsi-client-script",n.src="https://accounts.google.com/gsi/client"),n.onload=function(){window.google?e(window.google.accounts.id):t("Failed to load Google GSI client script - not loaded properly")},n.onerror=function(){t("Failed to load Google GSI client script - failed to load")}}))}();return new Promise((t=>{var o,s;u.initialize(Object.assign(Object.assign({},n),{itp_support:null===(o=null==n?void 0:n.itp_support)||void 0===o||o,use_fedcm_for_prompt:null===(s=null==n?void 0:n.use_fedcm_for_prompt)||void 0===s||s,client_id:a,callback:n=>{t(e.oauth.finishNative(i,c,"","",n.credential))},nonce:l})),u.prompt((e=>{(null==e?void 0:e.isSkippedMoment())&&(null==r||r())}))}))},async launch(n){var o;const r={identity:{context:n||"signin",providers:[{configURL:e.httpClient.buildUrl(t+Fn.config),clientId:t}]}},i=await(null===(o=navigator.credentials)||void 0===o?void 0:o.get(r));return e.refresh(i.token)},isSupported:()=>on&&"IdentityCredential"in window});var Zn=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Jn(),o=Object.assign(Object.assign({location:window.location.href},t[1]),{deviceInfo:{webAuthnSupport:n},startOptionsVersion:1});return t[1]=o,e.flow.start(...t)}});const Gn=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((t=>n=>{var{fpKey:o,fpLoad:r}=n,i=c(n,["fpKey","fpLoad"]);return on?(o&&r&&Un(o).catch((()=>null)),t(e(i,{beforeRequest:Rn}))):(console.warn("Fingerprint is a client side only capability and will not work when running in the server"),t(i))}),(n=>o=>{var{autoRefresh:r}=o,i=c(o,["autoRefresh"]);if(!r)return n(i);const{clearAllTimers:s,setTimer:a}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})();let l,u;on&&document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState&&new Date>l&&(nn("Expiration time passed, refreshing session"),d.refresh(dn()||u))}));const d=n(e(i,{afterRequest:async(e,n)=>{const{refreshJwt:o,sessionJwt:r}=await t(n);if(401===(null==n?void 0:n.status))nn("Received 401, canceling all timers"),s();else if(r){if(l=(e=>{try{const t=p(e);if(t.exp)return new Date(1e3*t.exp)}catch(e){return null}})(r),!l)return void nn("Could not extract expiration time from session token");u=o;let e=((i=l)?i.getTime()-(new Date).getTime():0)-2e4;e>rn&&(nn(`Timeout is too large (${e}ms), setting it to ${rn}ms`),e=rn),s();const t=new Date(Date.now()+e).toLocaleTimeString("en-US",{hour12:!1});nn(`Setting refresh timer for ${t}. (${e}ms)`),a((()=>{nn("Refreshing session due to timer"),d.refresh(dn()||o)}),e)}var i}}));return Fe(d,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return nn("Clearing all timers"),s(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"1.13.1"},t.baseHeaders)}))),(o=>r=>{const i=$n(),s=$n(),a=o(e(r,{afterRequest:async(e,o)=>{if(401===(null==o?void 0:o.status))i.pub(null),s.pub(null);else{const e=await n(o);e&&s.pub(e);const{sessionJwt:r}=await t(o);r&&i.pub(r)}}})),c=Fe(a,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return i.pub(null),s.pub(null),n}));return Object.assign(c,{onSessionTokenChange:i.sub,onUserChange:s.sub})}),(t=>o=>{var{storeLastAuthenticatedUser:i=!0}=o,s=c(o,["storeLastAuthenticatedUser"]);if(!i)return Object.assign(t(s),{getLastUserLoginId:xn,getLastUserDisplayName:Tn});const a=t(e(s,{afterRequest:async(e,t)=>{var o;const i=await n(t),s=null===(o=null==i?void 0:i.loginIds)||void 0===o?void 0:o[0],a=null==i?void 0:i.name;s&&((e=>{r(Pn,e)})(s),(e=>{r(En,e)})(a))}}));let l=Fe(a,["flow.start"],An);return l=Fe(l,["logout","logoutAll"],Cn),Object.assign(l,{getLastUserLoginId:xn,getLastUserDisplayName:Tn})}),(n=>o=>{var{persistTokens:s,sessionTokenViaCookie:a,storagePrefix:l}=o,u=c(o,["persistTokens","sessionTokenViaCookie","storagePrefix"]);if(!s||!on)return s&&console.warn("Storing auth tokens in local storage and cookies are a client side only capabilities and will not be done when running in the server"),n(u);const d=n(e(u,{beforeRequest:(p=l,e=>Object.assign(e,{token:e.token||dn(p)})),afterRequest:async(e,n)=>{const o=/^\/v\d+\/mgmt\//.test(e.path);401===(null==n?void 0:n.status)?o||pn(l):((e={},t,n)=>{var{refreshJwt:o,sessionJwt:i}=e,s=c(e,["refreshJwt","sessionJwt"]);void 0===t&&(t=!1),void 0===n&&(n=""),o&&r(`${n}${ln}`,o),i&&(t?un(cn,i,s):r(`${n}${cn}`,i))})(await t(n),a,l)}}));var p;const g=Fe(d,["logout","logoutAll"],Dn(l));return Object.assign(g,{getRefreshToken:()=>dn(l),getSessionToken:()=>function(e=""){return an.get(cn)||i(`${e}${cn}`)||""}(l)})}))(((...e)=>{const t=tn(...e);return Object.assign(Object.assign({},t),{flow:Zn(t),webauthn:Bn(t),fedcm:zn(t,e[0].projectId)})}));return Gn.REFRESH_TOKEN_KEY=ln,Gn.SESSION_TOKEN_KEY=cn,Gn})); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@descope/web-js-sdk", | ||
"version": "1.13.0", | ||
"version": "1.13.1", | ||
"author": "Descope Team <info@descope.com>", | ||
@@ -45,3 +45,3 @@ "homepage": "https://github.com/descope/web-js-sdk", | ||
"@types/jest": "^29.0.0", | ||
"@types/node": "20.12.13", | ||
"@types/node": "20.13.0", | ||
"@types/js-cookie": "^3.0.2", | ||
@@ -48,0 +48,0 @@ "@typescript-eslint/parser": "^7.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
457200