@descope/web-js-sdk 0.1.0-alpha.27 → 0.1.0-alpha.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!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,r)=>{var o;return n[r]=[].concat((null===(o=e.hooks)||void 0===o?void 0:o[r])||[]).concat((null==t?void 0:t[r])||[]),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)},r="undefined"!=typeof localStorage,o=(e,t)=>r&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),i=e=>r&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),a=e=>r&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e));var s=function(){return s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)};function c(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function u(e){this.message=e}u.prototype=new Error,u.prototype.name="InvalidCharacterError";var l="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new u("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,o=0,i=0,a="";r=t.charAt(i++);~r&&(n=o%4?64*n+r:r,o++%4)?a+=String.fromCharCode(255&n>>(-2*o&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};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(l(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 l(t)}}(e.split(".")[n]))}catch(e){throw new d("Invalid token specified: "+e.message)}}d.prototype=new Error,d.prototype.name="InvalidTokenError";var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},h="__lodash_hash_undefined__",g="[object Function]",v="[object GeneratorFunction]",y=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,b=/^\w*$/,w=/^\./,m=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,k=/\\(\\)?/g,I=/^\[object .+?Constructor\]$/,O="object"==typeof f&&f&&f.Object===Object&&f,j="object"==typeof self&&self&&self.Object===Object&&self,_=O||j||Function("return this")();var S,U=Array.prototype,P=Function.prototype,R=Object.prototype,x=_["__core-js_shared__"],E=(S=/[^.]+$/.exec(x&&x.keys&&x.keys.IE_PROTO||""))?"Symbol(src)_1."+S:"",C=P.toString,T=R.hasOwnProperty,A=R.toString,q=RegExp("^"+C.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),D=_.Symbol,J=U.splice,$=Z(_,"Map"),K=Z(Object,"create"),M=D?D.prototype:void 0,N=M?M.toString:void 0;function L(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function F(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function B(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function H(e,t){for(var n,r,o=e.length;o--;)if((n=e[o][0])===(r=t)||n!=n&&r!=r)return o;return-1}function z(e,t){var n;t=function(e,t){if(Y(e))return!1;var n=typeof e;if("number"==n||"symbol"==n||"boolean"==n||null==e||te(e))return!0;return b.test(e)||!y.test(e)||null!=t&&e in Object(t)}(t,e)?[t]:Y(n=t)?n:Q(n);for(var r=0,o=t.length;null!=e&&r<o;)e=e[W(t[r++])];return r&&r==o?e:void 0}function V(e){if(!ee(e)||(t=e,E&&E in t))return!1;var t,n=function(e){var t=ee(e)?A.call(e):"";return t==g||t==v}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?q:I;return n.test(function(e){if(null!=e){try{return C.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function G(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function Z(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return V(n)?n:void 0}L.prototype.clear=function(){this.__data__=K?K(null):{}},L.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},L.prototype.get=function(e){var t=this.__data__;if(K){var n=t[e];return n===h?void 0:n}return T.call(t,e)?t[e]:void 0},L.prototype.has=function(e){var t=this.__data__;return K?void 0!==t[e]:T.call(t,e)},L.prototype.set=function(e,t){return this.__data__[e]=K&&void 0===t?h:t,this},F.prototype.clear=function(){this.__data__=[]},F.prototype.delete=function(e){var t=this.__data__,n=H(t,e);return!(n<0)&&(n==t.length-1?t.pop():J.call(t,n,1),!0)},F.prototype.get=function(e){var t=this.__data__,n=H(t,e);return n<0?void 0:t[n][1]},F.prototype.has=function(e){return H(this.__data__,e)>-1},F.prototype.set=function(e,t){var n=this.__data__,r=H(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},B.prototype.clear=function(){this.__data__={hash:new L,map:new($||F),string:new L}},B.prototype.delete=function(e){return G(this,e).delete(e)},B.prototype.get=function(e){return G(this,e).get(e)},B.prototype.has=function(e){return G(this,e).has(e)},B.prototype.set=function(e,t){return G(this,e).set(e,t),this};var Q=X((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(te(e))return N?N.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var n=[];return w.test(e)&&n.push(""),e.replace(m,(function(e,t,r,o){n.push(r?o.replace(k,"$1"):t||e)})),n}));function W(e){if("string"==typeof e||te(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function X(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(X.Cache||B),n}X.Cache=B;var Y=Array.isArray;function ee(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function te(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==A.call(e)}var ne=function(e,t,n){var r=null==e?void 0:z(e,t);return void 0===r?n:r},re="/v1/auth/accesskey/exchange",oe="/v1/auth/otp/verify",ie="/v1/auth/otp/signin",ae="/v1/auth/otp/signup",se={email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},ce="/v1/auth/otp/signup-in",ue="/v1/auth/magiclink/verify",le="/v1/auth/magiclink/signin",de="/v1/auth/magiclink/signup",pe={email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},fe="/v1/auth/magiclink/signup-in",he="/v1/auth/enchantedlink/verify",ge="/v1/auth/enchantedlink/signin",ve="/v1/auth/enchantedlink/signup",ye="/v1/auth/enchantedlink/pending-session",be={email:"/v1/auth/enchantedlink/update/email"},we="/v1/auth/enchantedlink/signup-in",me="/v1/auth/oauth/authorize",ke="/v1/auth/oauth/exchange",Ie="/v1/auth/saml/authorize",Oe="/v1/auth/saml/exchange",je="/v1/auth/totp/verify",_e="/v1/auth/totp/signup",Se="/v1/auth/totp/update",Ue={start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},Pe={start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},Re={start:"/v1/auth/webauthn/signup-in/start"},xe={start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"},Ee="/v1/auth/refresh",Ce="/v1/auth/logout",Te="/v1/auth/logoutall",Ae="/v1/auth/me",qe="/v1/flow/start",De="/v1/flow/next";const Je=()=>{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 $e;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT"}($e||($e={}));const Ke=(...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,r])=>(e[n]=r,e)),e),e}),{})),Me=e=>void 0===e?void 0:JSON.stringify(e),Ne=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},Le=({baseUrl:e,projectId:t,baseConfig:n,logger:r,hooks:o,cookiePolicy:i})=>{const a=((e,t)=>{const 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=>Je().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const r=await n(...t);return e[r.ok?"log":"error"](await(async e=>{const t=await(e.clone?e.clone().text():e.text());return e.text=()=>Promise.resolve(t),e.json=()=>Promise.resolve(JSON.parse(t)),Je().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(r)),r}:n})(r),s=async r=>{const s=(null==o?void 0:o.beforeRequest)?o.beforeRequest(r):r,{path:c,body:u,headers:l,queryParams:d,method:p,token:f}=s,h=await a((({path:e,baseUrl:t,queryParams:n})=>{const r=new URL(e,t);return n&&(r.search=new URLSearchParams(n).toString()),r})({path:c,baseUrl:e,queryParams:d}),{headers:Ke(Ne(t,f),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"0.0.41-alpha.49"},(null==n?void 0:n.baseHeaders)||{},l),method:p,body:Me(u),credentials:i||"include"});return(null==o?void 0:o.afterRequest)&&await o.afterRequest(r,null==h?void 0:h.clone()),h};return{get:(e,{headers:t,queryParams:n,token:r}={})=>s({path:e,headers:t,queryParams:n,body:void 0,method:$e.get,token:r}),post:(e,t,{headers:n,queryParams:r,token:o}={})=>s({path:e,headers:n,queryParams:r,body:t,method:$e.post,token:o}),put:(e,t,{headers:n,queryParams:r,token:o}={})=>s({path:e,headers:n,queryParams:r,body:t,method:$e.put,token:o}),delete:(e,t,{headers:n,queryParams:r,token:o}={})=>s({path:e,headers:n,queryParams:r,body:t,method:$e.delete,token:o}),hooks:o}};function Fe(e,t,n){var r;let o=Be(e);t&&(o=null===(r=o.tenants)||void 0===r?void 0:r[t]);const i=o[n];return Array.isArray(i)?i:[]}function Be(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return p(e)}function He(e){const{exp:t}=Be(e);return(new Date).getTime()/1e3>t}function ze(e,t){return Fe(e,t,"permissions")}function Ve(e,t){return Fe(e,t,"roles")}const Ge=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function Ze(e,t){const n=await e,r={code:n.status,ok:n.ok,response:n},o=await n.clone().json();return n.ok?r.data=t?t(o):o:r.error=o,r}const Qe=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),We=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Xe=e=>t=>e.test(t),Ye=Xe(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),et=Xe(/^\+[1-9]{1}[0-9]{3,14}$/),tt=Qe(Ye,'"{val}" is not a valid email'),nt=Qe(et,'"{val}" is not a valid phone number'),rt=Qe((1,e=>e.length>=1),"Minimum length is 1");const ot=Qe((e=>"string"==typeof e),"Input is not a string"),it=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>We(...e).validate(n[t]))),t(...n)),at=e=>[ot(`"${e}" must be a string`),rt(`"${e}" must not be empty`)],st=e=>[ot(`"${e}" must be a string`),tt()],ct=e=>[ot(`"${e}" must be a string`),nt()],ut=it(at("accessKey")),lt=e=>({exchange:ut((t=>Ze(e.post(re,{},{token:t}))))});var dt,pt,ft,ht;!function(e){e.sms="sms",e.whatsapp="whatsapp"}(dt||(dt={})),function(e){e.email="email",e.sms="sms",e.whatsapp="whatsapp"}(pt||(pt={})),function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(ft||(ft={})),function(e){e.signUp="signup",e.signIn="signin",e.verify="verify"}(ht||(ht={}));const gt=at("loginId"),vt=at("uri"),yt=it(at("token")),bt=it(gt,vt),wt=it(at("pendingRef")),mt=it(gt,st("email"),vt),kt=e=>({verify:yt((t=>Ze(e.post(he,{token:t})))),signIn:bt(((t,n,r,o)=>Ze(e.post(Ge(ge,pt.email),{loginId:t,URI:n,loginOptions:r},{token:o})))),signUpOrIn:bt(((t,n)=>Ze(e.post(Ge(we,pt.email),{loginId:t,URI:n})))),signUp:bt(((t,n,r)=>Ze(e.post(Ge(ve,pt.email),{loginId:t,URI:n,user:r})))),waitForSession:wt(((t,n)=>new Promise((r=>{const{pollingIntervalMs:o,timeoutMs:i}=(({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||6e5,6e5)}))(n);let a;const s=setInterval((async()=>{const n=await e.post(ye,{pendingRef:t});n.ok&&(clearInterval(s),a&&clearTimeout(a),r(Ze(Promise.resolve(n))))}),o);a=setTimeout((()=>{r({error:{message:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(s)}),i)})))),update:{email:mt(((t,n,r,o)=>Ze(e.post(be.email,{loginId:t,email:n,URI:r},{token:o}))))}}),It=it(at("flowId")),Ot=it(at("executionId"),at("stepId"),at("interactionId")),jt=e=>({start:It(((t,n,r,o)=>Ze(e.post(qe,{flowId:t,options:n,interactionId:r,input:o})))),next:Ot(((t,n,r,o)=>Ze(e.post(De,{executionId:t,stepId:n,interactionId:r,input:o}))))}),_t=at("loginId"),St=at("uri"),Ut=it(at("token")),Pt=it(_t,St),Rt=it(_t,ct("phone"),St),xt=it(_t,st("email"),St),Et=e=>({verify:Ut((t=>Ze(e.post(ue,{token:t})))),signIn:Object.keys(pt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Pt(((t,r,o,i)=>Ze(e.post(Ge(le,n),{loginId:t,URI:r,loginOptions:o},{token:i}))))})),{}),signUp:Object.keys(pt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Pt(((t,r,o)=>Ze(e.post(Ge(de,n),{loginId:t,URI:r,user:o}))))})),{}),signUpOrIn:Object.keys(pt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Pt(((t,r)=>Ze(e.post(Ge(fe,n),{loginId:t,URI:r}))))})),{}),update:{email:xt(((t,n,r,o)=>Ze(e.post(pe.email,{loginId:t,email:n,URI:r},{token:o})))),phone:Object.keys(dt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Rt(((t,r,o,i)=>Ze(e.post(Ge(pe.phone,n),{loginId:t,phone:r,URI:o},{token:i}))))})),{})}});var Ct;!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"}(Ct||(Ct={}));const Tt=it(at("code")),At=e=>({start:Object.keys(Ct).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:async(t,{redirect:r=!1}={},o,i)=>{const a=await e.post(me,o||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:i});if(!r||!a.ok)return Ze(Promise.resolve(a));const{url:s}=await a.json();window.location.href=s}})),{}),exchange:Tt((t=>Ze(e.post(ke,{code:t}))))});var qt;!function(e){e.signUp="signup",e.signIn="signin",e.verify="verify",e.updatePhone="updatePhone"}(qt||(qt={}));const Dt=at("loginId"),Jt=it(Dt,at("code")),$t=it(Dt),Kt=it(Dt,ct("phone")),Mt=it(Dt,st("email")),Nt=e=>({verify:Object.keys(pt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Jt(((t,r)=>Ze(e.post(Ge(oe,n),{code:r,loginId:t}))))})),{}),signIn:Object.keys(pt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:$t(((t,r,o)=>Ze(e.post(Ge(ie,n),{loginId:t,loginOptions:r},{token:o}))))})),{}),signUp:Object.keys(pt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:$t(((t,r)=>Ze(e.post(Ge(ae,n),{loginId:t,user:r}))))})),{}),signUpOrIn:Object.keys(pt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:$t((t=>Ze(e.post(Ge(ce,n),{loginId:t}))))})),{}),update:{email:Mt(((t,n,r)=>Ze(e.post(se.email,{loginId:t,email:n},{token:r})))),phone:Object.keys(dt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Kt(((t,r,o)=>Ze(e.post(Ge(se.phone,n),{loginId:t,phone:r},{token:o}))))})),{})}}),Lt=it(at("tenant")),Ft=it(at("code")),Bt=e=>({start:Lt((async(t,n,{redirect:r=!1}={},o,i)=>{const a=await e.post(Ie,o||{},{queryParams:{tenant:t,redirectURL:n},token:i});if(!r||!a.ok)return Ze(Promise.resolve(a));const{url:s}=await a.json();window.location.href=s})),exchange:Ft((t=>Ze(e.post(Oe,{code:t}))))}),Ht=at("loginId"),zt=it(Ht,at("code")),Vt=it(Ht),Gt=it(Ht),Zt=e=>({signUp:Vt(((t,n)=>Ze(e.post(_e,{loginId:t,user:n})))),verify:zt(((t,n,r,o)=>Ze(e.post(je,{loginId:t,code:n,loginOptions:r},{token:o})))),update:Gt(((t,n)=>Ze(e.post(Se,{loginId:t},{token:n}))))}),Qt=[ot('"loginId" must be a string')],Wt=at("loginId"),Xt=at("origin"),Yt=it(Wt,Xt,at("name")),en=it(Wt,Xt),tn=it(Qt,Xt),nn=it(Wt,Xt,at("token")),rn=it(at("transactionId"),at("response")),on=e=>({signUp:{start:Yt(((t,n,r)=>Ze(e.post(Ue.start,{user:{loginId:t,name:r},origin:n})))),finish:rn(((t,n)=>Ze(e.post(Ue.finish,{transactionId:t,response:n}))))},signIn:{start:tn(((t,n,r,o)=>Ze(e.post(Pe.start,{loginId:t,origin:n,loginOptions:r},{token:o})))),finish:rn(((t,n)=>Ze(e.post(Pe.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:en(((t,n)=>Ze(e.post(Re.start,{loginId:t,origin:n}))))},update:{start:nn(((t,n,r)=>Ze(e.post(xe.start,{loginId:t,origin:n},{token:r})))),finish:rn(((t,n)=>Ze(e.post(xe.finish,{transactionId:t,response:n}))))}}),an=it(at("token"));var sn,cn=it([("projectId",sn=at("projectId"),Qe(((e,t)=>e=>We(...t).validate(ne(e,"projectId")))(0,sn))())])((e=>{var t,n;const r=[].concat((null===(t=e.hooks)||void 0===t?void 0:t.beforeRequest)||[]),o=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.afterRequest)||[]);return(({projectId:e,logger:t=console,baseUrl:n,hooks:r,cookiePolicy:o,baseHeaders:i={}})=>{return a=Le({baseUrl:n||"https://api.descope.com",projectId:e,logger:t,hooks:r,cookiePolicy:o,baseConfig:{baseHeaders:i}}),{accessKey:lt(a),otp:Nt(a),magicLink:Et(a),enchantedLink:kt(a),oauth:At(a),saml:Bt(a),totp:Zt(a),webauthn:on(a),flow:jt(a),refresh:e=>Ze(a.post(Ee,{},{token:e})),logout:e=>Ze(a.post(Ce,{},{token:e})),logoutAll:e=>Ze(a.post(Te,{},{token:e})),me:e=>Ze(a.get(Ae,{token:e})),isJwtExpired:an(He),getJwtPermissions:an(ze),getJwtRoles:an(Ve),httpClient:a};var a})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:e=>null==r?void 0:r.reduce(((e,t)=>t(e)),e),afterRequest:async(t,n)=>{(await Promise.allSettled(null==o?void 0:o.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))}))}}}))}));const un=(e,t,n)=>(t.forEach((t=>{const r=t.split(".");let o=r.shift(),i=e;for(;r.length>0;){if(i=i[o],!o||!i)throw Error(`Invalid path "${t}", "${o}" is missing or has no value`);o=r.shift()}if("function"!=typeof i[o])throw Error(`"${t}" is not a function`);const a=i[o];i[o]=n(a)})),e);var ln=Object.assign(cn,{DeliveryMethods:pt});const dn="undefined"!=typeof window,pn=dn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://fp.descope.com";function fn(e,t){var n=[];return function(e,t){var n,r,o=(r=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}(e),{current:function(){return r[0]},postpone:function(){var e=r.shift();void 0!==e&&r.push(e)},exclude:function(){r.shift()}}),i=(100,3e3,n=0,function(){return Math.random()*Math.min(3e3,100*Math.pow(2,n++))}),a=o.current();if(void 0===a)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var s=function(e,n){return t(e).catch((function(e){if(n+1>=5)throw e;!function(e){if(!(e instanceof Error))return!1;var t=e.message;return"Blocked by CSP"===t||"9319"===t}(e)?o.postpone():o.exclude();var t,r=o.current();if(void 0===r)throw e;return(t=i(),new Promise((function(e){return setTimeout(e,t)}))).then((function(){return s(r,n+1)}))}))};return s(a,0)}(e,(function(e){var r=new Date,o=function(){return n.push({url:e,startedAt:r,finishedAt:new Date})},i=t(e);return i.then(o,o),i})).then((function(e){return[e,{attempts:n}]}))}var hn="Failed to load the JS script of the agent";function gn(e){var t;e.scriptUrlPattern;var n=e.token,r=e.apiKey,o=void 0===r?n:r,i=c(e,["scriptUrlPattern","token","apiKey"]),a=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:"https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js";return Promise.resolve().then((function(){if(!o||"string"!=typeof o)throw new Error("API key required");return fn(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.8.1"):e}))}(String(e),t)}))}(a,o),vn).catch(bn)})).then((function(e){var t=e[0],n=e[1];return t.load(s(s({},i),{ldi:n}))}))}function vn(e){return function(e,t,n,r){var o,i=document,a="securitypolicyviolation",s=function(t){var n=new URL(e,location.href),r=t.blockedURI;r!==n.href&&r!==n.protocol.slice(0,-1)&&r!==n.origin||(o=t,c())};i.addEventListener(a,s);var c=function(){return i.removeEventListener(a,s)};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(),o)return function(){throw new Error("Blocked by CSP")}();throw e}))}))}(e,(function(){return function(e){return new Promise((function(t,n){var r=document.createElement("script"),o=function(){var e;return null===(e=r.parentNode)||void 0===e?void 0:e.removeChild(r)},i=document.head||document.getElementsByTagName("head")[0];r.onload=function(){o(),t()},r.onerror=function(){o(),n(new Error(hn))},r.async=!0,r.src=e,i.appendChild(r)}))}(e)})).then(yn)}function yn(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,r=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==r?void 0:r.configurable)?delete e[t]:r&&!r.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error("9319");return n}function bn(e){throw e instanceof Error&&"9319"===e.message?new Error(hn):e}const wn=(e="",t="")=>({vsid:e,vrid:t}),mn=(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},kn=async e=>{try{if(mn())return;const t=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),n=gn({apiKey:e,endpoint:pn}),r=await n,{requestId:o}=await r.get({linkedId:t});(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem("fp",JSON.stringify(t))})(wn(t,o))}catch(e){global.FB_DEBUG&&console.error(e)}},In=e=>(e.body&&(e.body.fpData=mn(!0)||wn()),e),On="dls_last_user_login_id",jn=e=>async(...t)=>{t[1]=t[1]||{};const[,n]=t,r=i(On);r&&(n.lastUser={loginId:r});return await e(...t)},_n=e=>async(...t)=>{const n=await e(...t);return a(On),n};function Sn(){const e=[];return{pub:t=>{e.forEach((e=>e(t)))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}
|
|
1
|
+
!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,r)=>{var o;return n[r]=[].concat((null===(o=e.hooks)||void 0===o?void 0:o[r])||[]).concat((null==t?void 0:t[r])||[]),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)},r="undefined"!=typeof localStorage,o=(e,t)=>r&&(null===localStorage||void 0===localStorage?void 0:localStorage.setItem(e,t)),i=e=>r&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e)),a=e=>r&&(null===localStorage||void 0===localStorage?void 0:localStorage.removeItem(e));var s=function(){return s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},s.apply(this,arguments)};function u(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function c(e){this.message=e}c.prototype=new Error,c.prototype.name="InvalidCharacterError";var l="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new c("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,o=0,i=0,a="";r=t.charAt(i++);~r&&(n=o%4?64*n+r:r,o++%4)?a+=String.fromCharCode(255&n>>(-2*o&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};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(l(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 l(t)}}(e.split(".")[n]))}catch(e){throw new d("Invalid token specified: "+e.message)}}d.prototype=new Error,d.prototype.name="InvalidTokenError";var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},h="__lodash_hash_undefined__",g="[object Function]",v="[object GeneratorFunction]",y=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,b=/^\w*$/,w=/^\./,m=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,k=/\\(\\)?/g,I=/^\[object .+?Constructor\]$/,O="object"==typeof f&&f&&f.Object===Object&&f,j="object"==typeof self&&self&&self.Object===Object&&self,_=O||j||Function("return this")();var S,U=Array.prototype,P=Function.prototype,R=Object.prototype,x=_["__core-js_shared__"],E=(S=/[^.]+$/.exec(x&&x.keys&&x.keys.IE_PROTO||""))?"Symbol(src)_1."+S:"",C=P.toString,T=R.hasOwnProperty,A=R.toString,q=RegExp("^"+C.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),D=_.Symbol,J=U.splice,$=Z(_,"Map"),K=Z(Object,"create"),N=D?D.prototype:void 0,M=N?N.toString:void 0;function L(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function F(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function B(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function H(e,t){for(var n,r,o=e.length;o--;)if((n=e[o][0])===(r=t)||n!=n&&r!=r)return o;return-1}function z(e,t){var n;t=function(e,t){if(Y(e))return!1;var n=typeof e;if("number"==n||"symbol"==n||"boolean"==n||null==e||te(e))return!0;return b.test(e)||!y.test(e)||null!=t&&e in Object(t)}(t,e)?[t]:Y(n=t)?n:Q(n);for(var r=0,o=t.length;null!=e&&r<o;)e=e[W(t[r++])];return r&&r==o?e:void 0}function V(e){if(!ee(e)||(t=e,E&&E in t))return!1;var t,n=function(e){var t=ee(e)?A.call(e):"";return t==g||t==v}(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e)?q:I;return n.test(function(e){if(null!=e){try{return C.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function G(e,t){var n,r,o=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof t?"string":"hash"]:o.map}function Z(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return V(n)?n:void 0}L.prototype.clear=function(){this.__data__=K?K(null):{}},L.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},L.prototype.get=function(e){var t=this.__data__;if(K){var n=t[e];return n===h?void 0:n}return T.call(t,e)?t[e]:void 0},L.prototype.has=function(e){var t=this.__data__;return K?void 0!==t[e]:T.call(t,e)},L.prototype.set=function(e,t){return this.__data__[e]=K&&void 0===t?h:t,this},F.prototype.clear=function(){this.__data__=[]},F.prototype.delete=function(e){var t=this.__data__,n=H(t,e);return!(n<0)&&(n==t.length-1?t.pop():J.call(t,n,1),!0)},F.prototype.get=function(e){var t=this.__data__,n=H(t,e);return n<0?void 0:t[n][1]},F.prototype.has=function(e){return H(this.__data__,e)>-1},F.prototype.set=function(e,t){var n=this.__data__,r=H(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},B.prototype.clear=function(){this.__data__={hash:new L,map:new($||F),string:new L}},B.prototype.delete=function(e){return G(this,e).delete(e)},B.prototype.get=function(e){return G(this,e).get(e)},B.prototype.has=function(e){return G(this,e).has(e)},B.prototype.set=function(e,t){return G(this,e).set(e,t),this};var Q=X((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(te(e))return M?M.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var n=[];return w.test(e)&&n.push(""),e.replace(m,(function(e,t,r,o){n.push(r?o.replace(k,"$1"):t||e)})),n}));function W(e){if("string"==typeof e||te(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function X(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return n.cache=i.set(o,a),a};return n.cache=new(X.Cache||B),n}X.Cache=B;var Y=Array.isArray;function ee(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function te(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==A.call(e)}var ne=function(e,t,n){var r=null==e?void 0:z(e,t);return void 0===r?n:r},re="/v1/auth/accesskey/exchange",oe="/v1/auth/otp/verify",ie="/v1/auth/otp/signin",ae="/v1/auth/otp/signup",se={email:"/v1/auth/otp/update/email",phone:"/v1/auth/otp/update/phone"},ue="/v1/auth/otp/signup-in",ce="/v1/auth/magiclink/verify",le="/v1/auth/magiclink/signin",de="/v1/auth/magiclink/signup",pe={email:"/v1/auth/magiclink/update/email",phone:"/v1/auth/magiclink/update/phone"},fe="/v1/auth/magiclink/signup-in",he="/v1/auth/enchantedlink/verify",ge="/v1/auth/enchantedlink/signin",ve="/v1/auth/enchantedlink/signup",ye="/v1/auth/enchantedlink/pending-session",be={email:"/v1/auth/enchantedlink/update/email"},we="/v1/auth/enchantedlink/signup-in",me="/v1/auth/oauth/authorize",ke="/v1/auth/oauth/exchange",Ie="/v1/auth/saml/authorize",Oe="/v1/auth/saml/exchange",je="/v1/auth/totp/verify",_e="/v1/auth/totp/signup",Se="/v1/auth/totp/update",Ue={start:"/v1/auth/webauthn/signup/start",finish:"/v1/auth/webauthn/signup/finish"},Pe={start:"/v1/auth/webauthn/signin/start",finish:"/v1/auth/webauthn/signin/finish"},Re={start:"/v1/auth/webauthn/signup-in/start"},xe={start:"v1/auth/webauthn/update/start",finish:"/v1/auth/webauthn/update/finish"},Ee="/v1/auth/refresh",Ce="/v1/auth/logout",Te="/v1/auth/logoutall",Ae="/v1/auth/me",qe="/v1/flow/start",De="/v1/flow/next";const Je=()=>{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 $e;!function(e){e.get="GET",e.delete="DELETE",e.post="POST",e.put="PUT"}($e||($e={}));const Ke=(...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,r])=>(e[n]=r,e)),e),e}),{})),Ne=e=>void 0===e?void 0:JSON.stringify(e),Me=(e,t="")=>{let n=e;return t&&(n=n+":"+t),{Authorization:`Bearer ${n}`}},Le=({baseUrl:e,projectId:t,baseConfig:n,logger:r,hooks:o,cookiePolicy:i})=>{const a=((e,t)=>{const 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=>Je().title("Request").url(e[0]).method(e[1].method).headers(e[1].headers).body(e[1].body).build())(t));const r=await n(...t);return e[r.ok?"log":"error"](await(async e=>{const t=await(e.clone?e.clone().text():e.text());return e.text=()=>Promise.resolve(t),e.json=()=>Promise.resolve(JSON.parse(t)),Je().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})(r)),r}:n})(r),s=async r=>{const s=(null==o?void 0:o.beforeRequest)?o.beforeRequest(r):r,{path:u,body:c,headers:l,queryParams:d,method:p,token:f}=s,h=await a((({path:e,baseUrl:t,queryParams:n})=>{const r=new URL(e,t);return n&&(r.search=new URLSearchParams(n).toString()),r})({path:u,baseUrl:e,queryParams:d}),{headers:Ke(Me(t,f),{"x-descope-sdk-name":"core-js","x-descope-sdk-version":"0.0.41-alpha.51"},(null==n?void 0:n.baseHeaders)||{},l),method:p,body:Ne(c),credentials:i||"include"});return(null==o?void 0:o.afterRequest)&&await o.afterRequest(r,null==h?void 0:h.clone()),h};return{get:(e,{headers:t,queryParams:n,token:r}={})=>s({path:e,headers:t,queryParams:n,body:void 0,method:$e.get,token:r}),post:(e,t,{headers:n,queryParams:r,token:o}={})=>s({path:e,headers:n,queryParams:r,body:t,method:$e.post,token:o}),put:(e,t,{headers:n,queryParams:r,token:o}={})=>s({path:e,headers:n,queryParams:r,body:t,method:$e.put,token:o}),delete:(e,t,{headers:n,queryParams:r,token:o}={})=>s({path:e,headers:n,queryParams:r,body:t,method:$e.delete,token:o}),hooks:o}};var Fe=429;function Be(e,t,n){var r;let o=He(e);t&&(o=null===(r=null==o?void 0:o.tenants)||void 0===r?void 0:r[t]);const i=null==o?void 0:o[n];return Array.isArray(i)?i:[]}function He(e){if("string"!=typeof e||!e)throw new Error("Invalid token provided");return p(e)}function ze(e){const{exp:t}=He(e);return(new Date).getTime()/1e3>t}function Ve(e,t){return Be(e,t,"permissions")}function Ge(e,t){return Be(e,t,"roles")}const Ze=(...e)=>e.join("/").replace(/\/{2,}/g,"/");async function Qe(e,t){var n;const r=await e,o={code:r.status,ok:r.ok,response:r},i=await r.clone().json();return r.ok?o.data=t?t(i):i:(o.error=i,r.status===Fe&&Object.assign(o.error,{retryAfter:Number.parseInt(null===(n=r.headers)||void 0===n?void 0:n.get("retry-after"))||0})),o}const We=(e,t)=>(n=t)=>t=>!e(t)&&n.replace("{val}",t),Xe=(...e)=>({validate:t=>(e.forEach((e=>{const n=e(t);if(n)throw new Error(n)})),!0)}),Ye=e=>t=>e.test(t),et=Ye(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),tt=Ye(/^\+[1-9]{1}[0-9]{3,14}$/),nt=We(et,'"{val}" is not a valid email'),rt=We(tt,'"{val}" is not a valid phone number'),ot=We((1,e=>e.length>=1),"Minimum length is 1");const it=We((e=>"string"==typeof e),"Input is not a string"),at=(...e)=>t=>(...n)=>(e.forEach(((e,t)=>Xe(...e).validate(n[t]))),t(...n)),st=e=>[it(`"${e}" must be a string`),ot(`"${e}" must not be empty`)],ut=e=>[it(`"${e}" must be a string`),nt()],ct=e=>[it(`"${e}" must be a string`),rt()],lt=at(st("accessKey")),dt=e=>({exchange:lt((t=>Qe(e.post(re,{},{token:t}))))});var pt,ft,ht,gt;!function(e){e.sms="sms",e.whatsapp="whatsapp"}(pt||(pt={})),function(e){e.email="email",e.sms="sms",e.whatsapp="whatsapp"}(ft||(ft={})),function(e){e.waiting="waiting",e.running="running",e.completed="completed",e.failed="failed"}(ht||(ht={})),function(e){e.signUp="signup",e.signIn="signin",e.verify="verify"}(gt||(gt={}));const vt=st("loginId"),yt=st("uri"),bt=at(st("token")),wt=at(vt,yt),mt=at(st("pendingRef")),kt=at(vt,ut("email"),yt),It=e=>({verify:bt((t=>Qe(e.post(he,{token:t})))),signIn:wt(((t,n,r,o)=>Qe(e.post(Ze(ge,ft.email),{loginId:t,URI:n,loginOptions:r},{token:o})))),signUpOrIn:wt(((t,n)=>Qe(e.post(Ze(we,ft.email),{loginId:t,URI:n})))),signUp:wt(((t,n,r)=>Qe(e.post(Ze(ve,ft.email),{loginId:t,URI:n,user:r})))),waitForSession:mt(((t,n)=>new Promise((r=>{const{pollingIntervalMs:o,timeoutMs:i}=(({pollingIntervalMs:e=1e3,timeoutMs:t=6e5}={})=>({pollingIntervalMs:Math.max(e||1e3,1e3),timeoutMs:Math.min(t||6e5,6e5)}))(n);let a;const s=setInterval((async()=>{const n=await e.post(ye,{pendingRef:t});n.ok&&(clearInterval(s),a&&clearTimeout(a),r(Qe(Promise.resolve(n))))}),o);a=setTimeout((()=>{r({error:{message:`Session polling timeout exceeded: ${i}ms`,errorCode:"0"},ok:!1}),clearInterval(s)}),i)})))),update:{email:kt(((t,n,r,o)=>Qe(e.post(be.email,{loginId:t,email:n,URI:r},{token:o}))))}}),Ot=at(st("flowId")),jt=at(st("executionId"),st("stepId"),st("interactionId")),_t=e=>({start:Ot(((t,n,r,o)=>Qe(e.post(qe,{flowId:t,options:n,interactionId:r,input:o})))),next:jt(((t,n,r,o)=>Qe(e.post(De,{executionId:t,stepId:n,interactionId:r,input:o}))))}),St=st("loginId"),Ut=st("uri"),Pt=at(st("token")),Rt=at(St,Ut),xt=at(St,ct("phone"),Ut),Et=at(St,ut("email"),Ut),Ct=e=>({verify:Pt((t=>Qe(e.post(ce,{token:t})))),signIn:Object.keys(ft).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Rt(((t,r,o,i)=>Qe(e.post(Ze(le,n),{loginId:t,URI:r,loginOptions:o},{token:i}))))})),{}),signUp:Object.keys(ft).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Rt(((t,r,o)=>Qe(e.post(Ze(de,n),{loginId:t,URI:r,user:o}))))})),{}),signUpOrIn:Object.keys(ft).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Rt(((t,r)=>Qe(e.post(Ze(fe,n),{loginId:t,URI:r}))))})),{}),update:{email:Et(((t,n,r,o)=>Qe(e.post(pe.email,{loginId:t,email:n,URI:r},{token:o})))),phone:Object.keys(pt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:xt(((t,r,o,i)=>Qe(e.post(Ze(pe.phone,n),{loginId:t,phone:r,URI:o},{token:i}))))})),{})}});var Tt;!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"}(Tt||(Tt={}));const At=at(st("code")),qt=e=>({start:Object.keys(Tt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:async(t,{redirect:r=!1}={},o,i)=>{const a=await e.post(me,o||{},{queryParams:Object.assign({provider:n},t&&{redirectURL:t}),token:i});if(!r||!a.ok)return Qe(Promise.resolve(a));const{url:s}=await a.json();window.location.href=s}})),{}),exchange:At((t=>Qe(e.post(ke,{code:t}))))});var Dt;!function(e){e.signUp="signup",e.signIn="signin",e.verify="verify",e.updatePhone="updatePhone"}(Dt||(Dt={}));const Jt=st("loginId"),$t=at(Jt,st("code")),Kt=at(Jt),Nt=at(Jt,ct("phone")),Mt=at(Jt,ut("email")),Lt=e=>({verify:Object.keys(ft).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:$t(((t,r)=>Qe(e.post(Ze(oe,n),{code:r,loginId:t}))))})),{}),signIn:Object.keys(ft).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Kt(((t,r,o)=>Qe(e.post(Ze(ie,n),{loginId:t,loginOptions:r},{token:o}))))})),{}),signUp:Object.keys(ft).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Kt(((t,r)=>Qe(e.post(Ze(ae,n),{loginId:t,user:r}))))})),{}),signUpOrIn:Object.keys(ft).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Kt((t=>Qe(e.post(Ze(ue,n),{loginId:t}))))})),{}),update:{email:Mt(((t,n,r)=>Qe(e.post(se.email,{loginId:t,email:n},{token:r})))),phone:Object.keys(pt).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Nt(((t,r,o)=>Qe(e.post(Ze(se.phone,n),{loginId:t,phone:r},{token:o}))))})),{})}}),Ft=at(st("tenant")),Bt=at(st("code")),Ht=e=>({start:Ft((async(t,n,{redirect:r=!1}={},o,i)=>{const a=await e.post(Ie,o||{},{queryParams:{tenant:t,redirectURL:n},token:i});if(!r||!a.ok)return Qe(Promise.resolve(a));const{url:s}=await a.json();window.location.href=s})),exchange:Bt((t=>Qe(e.post(Oe,{code:t}))))}),zt=st("loginId"),Vt=at(zt,st("code")),Gt=at(zt),Zt=at(zt),Qt=e=>({signUp:Gt(((t,n)=>Qe(e.post(_e,{loginId:t,user:n})))),verify:Vt(((t,n,r,o)=>Qe(e.post(je,{loginId:t,code:n,loginOptions:r},{token:o})))),update:Zt(((t,n)=>Qe(e.post(Se,{loginId:t},{token:n}))))}),Wt=[it('"loginId" must be a string')],Xt=st("loginId"),Yt=st("origin"),en=at(Xt,Yt,st("name")),tn=at(Xt,Yt),nn=at(Wt,Yt),rn=at(Xt,Yt,st("token")),on=at(st("transactionId"),st("response")),an=e=>({signUp:{start:en(((t,n,r)=>Qe(e.post(Ue.start,{user:{loginId:t,name:r},origin:n})))),finish:on(((t,n)=>Qe(e.post(Ue.finish,{transactionId:t,response:n}))))},signIn:{start:nn(((t,n,r,o)=>Qe(e.post(Pe.start,{loginId:t,origin:n,loginOptions:r},{token:o})))),finish:on(((t,n)=>Qe(e.post(Pe.finish,{transactionId:t,response:n}))))},signUpOrIn:{start:tn(((t,n)=>Qe(e.post(Re.start,{loginId:t,origin:n}))))},update:{start:rn(((t,n,r)=>Qe(e.post(xe.start,{loginId:t,origin:n},{token:r})))),finish:on(((t,n)=>Qe(e.post(xe.finish,{transactionId:t,response:n}))))}}),sn=at(st("token"));var un,cn=at([("projectId",un=st("projectId"),We(((e,t)=>e=>Xe(...t).validate(ne(e,"projectId")))(0,un))())])((e=>{var t,n;const r=[].concat((null===(t=e.hooks)||void 0===t?void 0:t.beforeRequest)||[]),o=[].concat((null===(n=e.hooks)||void 0===n?void 0:n.afterRequest)||[]);return(({projectId:e,logger:t,baseUrl:n,hooks:r,cookiePolicy:o,baseHeaders:i={}})=>{return a=Le({baseUrl:n||"https://api.descope.com",projectId:e,logger:t,hooks:r,cookiePolicy:o,baseConfig:{baseHeaders:i}}),{accessKey:dt(a),otp:Lt(a),magicLink:Ct(a),enchantedLink:It(a),oauth:qt(a),saml:Ht(a),totp:Qt(a),webauthn:an(a),flow:_t(a),refresh:e=>Qe(a.post(Ee,{},{token:e})),logout:e=>Qe(a.post(Ce,{},{token:e})),logoutAll:e=>Qe(a.post(Te,{},{token:e})),me:e=>Qe(a.get(Ae,{token:e})),isJwtExpired:sn(ze),getJwtPermissions:sn(Ve),getJwtRoles:sn(Ge),httpClient:a};var a})(Object.assign(Object.assign({},e),{hooks:{beforeRequest:e=>null==r?void 0:r.reduce(((e,t)=>t(e)),e),afterRequest:async(t,n)=>{(await Promise.allSettled(null==o?void 0:o.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))}))}}}))}));const ln=(e,t,n)=>(t.forEach((t=>{const r=t.split(".");let o=r.shift(),i=e;for(;r.length>0;){if(i=i[o],!o||!i)throw Error(`Invalid path "${t}", "${o}" is missing or has no value`);o=r.shift()}if("function"!=typeof i[o])throw Error(`"${t}" is not a function`);const a=i[o];i[o]=n(a)})),e);var dn=Object.assign(cn,{DeliveryMethods:ft});const pn="undefined"!=typeof window,fn=pn&&(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("fingerprint.endpoint.url"))||"https://fp.descope.com";function hn(e,t){var n=[];return function(e,t){var n,r,o=(r=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}(e),{current:function(){return r[0]},postpone:function(){var e=r.shift();void 0!==e&&r.push(e)},exclude:function(){r.shift()}}),i=(100,3e3,n=0,function(){return Math.random()*Math.min(3e3,100*Math.pow(2,n++))}),a=o.current();if(void 0===a)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var s=function(e,n){return t(e).catch((function(e){if(n+1>=5)throw e;!function(e){if(!(e instanceof Error))return!1;var t=e.message;return"Blocked by CSP"===t||"9319"===t}(e)?o.postpone():o.exclude();var t,r=o.current();if(void 0===r)throw e;return(t=i(),new Promise((function(e){return setTimeout(e,t)}))).then((function(){return s(r,n+1)}))}))};return s(a,0)}(e,(function(e){var r=new Date,o=function(){return n.push({url:e,startedAt:r,finishedAt:new Date})},i=t(e);return i.then(o,o),i})).then((function(e){return[e,{attempts:n}]}))}var gn="Failed to load the JS script of the agent";function vn(e){var t;e.scriptUrlPattern;var n=e.token,r=e.apiKey,o=void 0===r?n:r,i=u(e,["scriptUrlPattern","token","apiKey"]),a=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:"https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js";return Promise.resolve().then((function(){if(!o||"string"!=typeof o)throw new Error("API key required");return hn(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.8.1"):e}))}(String(e),t)}))}(a,o),yn).catch(wn)})).then((function(e){var t=e[0],n=e[1];return t.load(s(s({},i),{ldi:n}))}))}function yn(e){return function(e,t,n,r){var o,i=document,a="securitypolicyviolation",s=function(t){var n=new URL(e,location.href),r=t.blockedURI;r!==n.href&&r!==n.protocol.slice(0,-1)&&r!==n.origin||(o=t,u())};i.addEventListener(a,s);var u=function(){return i.removeEventListener(a,s)};return Promise.resolve().then(t).then((function(e){return u(),e}),(function(e){return new Promise((function(e){return setTimeout(e)})).then((function(){if(u(),o)return function(){throw new Error("Blocked by CSP")}();throw e}))}))}(e,(function(){return function(e){return new Promise((function(t,n){var r=document.createElement("script"),o=function(){var e;return null===(e=r.parentNode)||void 0===e?void 0:e.removeChild(r)},i=document.head||document.getElementsByTagName("head")[0];r.onload=function(){o(),t()},r.onerror=function(){o(),n(new Error(gn))},r.async=!0,r.src=e,i.appendChild(r)}))}(e)})).then(bn)}function bn(){var e=window,t="__fpjs_p_l_b",n=e[t];if(function(e,t){var n,r=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t);(null==r?void 0:r.configurable)?delete e[t]:r&&!r.writable||(e[t]=void 0)}(e,t),"function"!=typeof(null==n?void 0:n.load))throw new Error("9319");return n}function wn(e){throw e instanceof Error&&"9319"===e.message?new Error(gn):e}const mn=(e="",t="")=>({vsid:e,vrid:t}),kn=(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},In=async e=>{try{if(kn())return;const t=(Date.now().toString(36)+Math.random().toString(36).substring(2)+Math.random().toString(36).substring(2)).substring(0,27),n=vn({apiKey:e,endpoint:fn}),r=await n,{requestId:o}=await r.get({linkedId:t});(e=>{const t={value:e,expiry:(new Date).getTime()+864e5};localStorage.setItem("fp",JSON.stringify(t))})(mn(t,o))}catch(e){global.FB_DEBUG&&console.error(e)}},On=e=>(e.body&&(e.body.fpData=kn(!0)||mn()),e),jn="dls_last_user_login_id",_n=e=>async(...t)=>{t[1]=t[1]||{};const[,n]=t,r=i(jn);r&&(n.lastUser={loginId:r});return await e(...t)},Sn=e=>async(...t)=>{const n=await e(...t);return a(jn),n};function Un(){const e=[];return{pub:t=>{e.forEach((e=>e(t)))},sub:t=>{const n=e.push(t)-1;return()=>e.splice(n,1)}}}
|
|
2
2
|
/*! js-cookie v3.0.1 | MIT */
|
|
3
|
-
function
|
|
3
|
+
function Pn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var Rn=function e(t,n){function r(e,r,o){if("undefined"!=typeof document){"number"==typeof(o=Pn({},n,o)).expires&&(o.expires=new Date(Date.now()+864e5*o.expires)),o.expires&&(o.expires=o.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var a in o)o[a]&&(i+="; "+a,!0!==o[a]&&(i+="="+o[a].split(";")[0]));return document.cookie=e+"="+t.write(r,e)+i}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],r={},o=0;o<n.length;o++){var i=n[o].split("="),a=i.slice(1).join("=");try{var s=decodeURIComponent(i[0]);if(r[s]=t.read(a,s),e===s)break}catch(e){}}return e?r[e]:r}},remove:function(e,t){r(e,"",Pn({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,Pn({},this.attributes,t))},withConverter:function(t){return e(Pn({},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 xn="DS",En="DSR";const Cn=(e={},t)=>{var{refreshJwt:n,sessionJwt:r}=e,i=u(e,["refreshJwt","sessionJwt"]);void 0===t&&(t=!1),n&&o(En,n),r&&(t?function(e,t,{cookiePath:n,cookieDomain:r,cookieExpiration:o}){if(t){const i=new Date(1e3*o);Rn.set(e,t,{path:n,domain:r,expires:i,sameSite:"None",secure:!0})}}(xn,r,i):o(xn,r))};function Tn(){return i(En)||""}function An(){return Rn.get(xn)||i(xn)||""}function qn(){a(En),a(xn),Rn.remove(xn)}const Dn=e=>Object.assign(e,{token:e.token||Tn()}),Jn=e=>async(...t)=>{const n=await e(...t);return qn(),n};async function $n(e){const t=function(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Bn(n.publicKey.challenge),n.publicKey.user.id=Bn(n.publicKey.user.id),null===(t=n.publicKey.excludeCredentials)||void 0===t||t.forEach((e=>{e.id=Bn(e.id)})),n}(e),n=await navigator.credentials.create(t);return r=n,JSON.stringify({id:r.id,rawId:Hn(r.rawId),type:r.type,response:{attestationObject:Hn(r.response.attestationObject),clientDataJSON:Hn(r.response.clientDataJSON)}});var r}async function Kn(e){const t=Ln(e);return Fn(await navigator.credentials.get(t))}async function Nn(e,t){const n=Ln(e);n.signal=t.signal,n.mediation="conditional";return Fn(await navigator.credentials.get(n))}async function Mn(e=!1){if(!pn)return Promise.resolve(!1);const t=!!(PublicKeyCredential&&navigator.credentials&&navigator.credentials.create&&navigator.credentials.get);return t&&e&&PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable():t}function Ln(e){var t;const n=JSON.parse(e);return n.publicKey.challenge=Bn(n.publicKey.challenge),null===(t=n.publicKey.allowCredentials)||void 0===t||t.forEach((e=>{e.id=Bn(e.id)})),n}function Fn(e){return JSON.stringify({id:e.id,rawId:Hn(e.rawId),type:e.type,response:{authenticatorData:Hn(e.response.authenticatorData),clientDataJSON:Hn(e.response.clientDataJSON),signature:Hn(e.response.signature),userHandle:e.response.userHandle?Hn(e.response.userHandle):void 0}})}function Bn(e){const t=e.replace(/_/g,"/").replace(/-/g,"+");return Uint8Array.from(atob(t),(e=>e.charCodeAt(0))).buffer}function Hn(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}var zn,Vn=(zn=e=>({async signUp(t,n){const r=await e.webauthn.signUp.start(t,window.location.origin,n);if(!r.ok)return r;const o=await $n(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,o)},async signIn(t){const n=await e.webauthn.signIn.start(t,window.location.origin);if(!n.ok)return n;const r=await Kn(n.data.options);return await e.webauthn.signIn.finish(n.data.transactionId,r)},async signUpOrIn(t){var n;const r=await e.webauthn.signUpOrIn.start(t,window.location.origin);if(!r.ok)return r;if(null===(n=r.data)||void 0===n?void 0:n.create){const t=await $n(r.data.options);return await e.webauthn.signUp.finish(r.data.transactionId,t)}{const t=await Kn(r.data.options);return await e.webauthn.signIn.finish(r.data.transactionId,t)}},async update(t,n){const r=await e.webauthn.update.start(t,window.location.origin,n);if(!r.ok)return r;const o=await $n(r.data.options);return await e.webauthn.update.finish(r.data.transactionId,o)},helpers:{create:$n,get:Kn,isSupported:Mn,conditional:Nn}}),(...e)=>{const t=zn(...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}),Gn=e=>Object.assign(Object.assign({},e.flow),{start:async(...t)=>{const n=await Mn(),r=Object.assign(Object.assign({},t[1]),{redirectUrl:window.location.href,deviceInfo:{webAuthnSupport:n}});return t[1]=r,e.flow.start(...t)}});const Zn=function(...e){return t=>e.reduce(((e,t)=>t(e)),t)}((t=>r=>{const i=t(e(r,{afterRequest:async(e,t)=>{var r;const i=await n(t),a=null===(r=null==i?void 0:i.loginIds)||void 0===r?void 0:r[0];a&&(e=>{o(jn,e)})(a)}}));let a=ln(i,["flow.start"],_n);return a=ln(a,["logout","logoutAll"],Sn),a}),(t=>n=>{var{fpKey:r,fpLoad:o}=n,i=u(n,["fpKey","fpLoad"]);return r?(pn?o&&In(r).catch((()=>null)):console.warn("Fingerprint is a client side only capability and will not work when running in the server"),t(e(i,{beforeRequest:On}))):t(Object.assign({},i))}),(n=>r=>{var o=u(r,["autoRefresh"]);const{clearAllTimers:i,setTimer:a}=(()=>{const e=[];return{clearAllTimers:()=>{for(;e.length;)clearTimeout(e.pop())},setTimer:(t,n)=>{e.push(setTimeout(t,n))}}})(),s=n(e(o,{afterRequest:async(e,n)=>{const{refreshJwt:r,sessionJwt:o}=await t(n);if(401===(null==n?void 0:n.status))i();else if(o){const e=((u=(e=>{const t=e.split(".");try{if(3===t.length){const e=JSON.parse(window.atob(t[1]));if(e.exp)return new Date(1e3*e.exp)}}catch(e){}return null})(o))?u.getTime()-(new Date).getTime():0)-2e4;i(),a((()=>s.refresh(r)),e)}var u}}));return ln(s,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return i(),n}))}),(e=>t=>e(Object.assign(Object.assign({},t),{baseHeaders:Object.assign({"x-descope-sdk-name":"web-js","x-descope-sdk-version":"0.1.0-alpha.29"},t.baseHeaders)}))),(r=>o=>{const i=Un(),a=Un(),s=r(e(o,{afterRequest:async(e,r)=>{if(401===(null==r?void 0:r.status))i.pub(null),a.pub(null);else{const e=await n(r);e&&a.pub(e);const{sessionJwt:o}=await t(r);o&&i.pub(o)}}})),u=ln(s,["logout","logoutAll"],(e=>async(...t)=>{const n=await e(...t);return i.pub(null),a.pub(null),n}));return Object.assign(u,{onSessionTokenChange:i.sub,onUserChange:a.sub})}),(n=>r=>{var{persistTokens:o,sessionTokenViaCookie:i}=r,a=u(r,["persistTokens","sessionTokenViaCookie"]);if(pn||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"),!o||!pn)return n(a);const s=n(e(a,{beforeRequest:Dn,afterRequest:async(e,n)=>{401===(null==n?void 0:n.status)?qn():Cn(await t(n),i)}})),c=ln(s,["logout","logoutAll"],Jn);return Object.assign(c,{getRefreshToken:Tn,getSessionToken:An})}))(((...e)=>{const t=dn(...e);return Object.assign(Object.assign({},t),{flow:Gn(t),webauthn:Vn(t)})}));return Zn}));
|
|
4
4
|
//# sourceMappingURL=index.umd.js.map
|