@descope/web-component 0.0.25 → 0.0.26-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/descope-wc.js +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -36,4 +36,9 @@ render(){
|
|
|
36
36
|
<descope-wc project="myProjectId"></descope-wc>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
### Run the demo app
|
|
40
|
+
|
|
41
|
+
Edit the `index.html` file to use a real project and a flow and run `npm run start`.
|
|
42
|
+
|
|
43
|
+
|
|
39
44
|
*TODO: we shoud host this file so it can be included without installing the package, once we will publish it to a public registry, we can also use unpkg.com/ to serve it*
|
package/dist/descope-wc.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){"use strict";function t(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))}function e(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}function n(t,e,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(t,n):o?o.value=n:e.set(t,n),n}function r(t){this.message=t}r.prototype=new Error,r.prototype.name="InvalidCharacterError";var o="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new r("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,i=0,s=0,a="";o=e.charAt(s++);~o&&(n=i%4?64*n+o:o,i++%4)?a+=String.fromCharCode(255&n>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return a};function i(t){this.message=t}function s(t,e){if("string"!=typeof t)throw new i("Invalid token specified");var n=!0===(e=e||{}).header?0:1;try{return JSON.parse(function(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(o(t).replace(/(.)/g,(function(t,e){var n=e.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(e)}catch(t){return o(e)}}(t.split(".")[n]))}catch(t){throw new i("Invalid token specified: "+t.message)}}i.prototype=new Error,i.prototype.name="InvalidTokenError";var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},c="__lodash_hash_undefined__",d="[object Function]",u="[object GeneratorFunction]",l=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,h=/^\w*$/,p=/^\./,f=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,v=/\\(\\)?/g,g=/^\[object .+?Constructor\]$/,b="object"==typeof a&&a&&a.Object===Object&&a,m="object"==typeof self&&self&&self.Object===Object&&self,y=b||m||Function("return this")();var w,I=Array.prototype,j=Function.prototype,k=Object.prototype,O=y["__core-js_shared__"],x=(w=/[^.]+$/.exec(O&&O.keys&&O.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"",_=j.toString,E=k.hasOwnProperty,U=k.toString,S=RegExp("^"+_.call(E).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),P=y.Symbol,T=I.splice,R=H(y,"Map"),M=H(Object,"create"),A=P?P.prototype:void 0,$=A?A.toString:void 0;function C(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function L(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function q(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function N(t,e){for(var n,r,o=t.length;o--;)if((n=t[o][0])===(r=e)||n!=n&&r!=r)return o;return-1}function W(t,e){var n;e=function(t,e){if(Z(t))return!1;var n=typeof t;if("number"==n||"symbol"==n||"boolean"==n||null==t||K(t))return!0;return h.test(t)||!l.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:Z(n=e)?n:F(n);for(var r=0,o=e.length;null!=t&&r<o;)t=t[B(e[r++])];return r&&r==o?t:void 0}function D(t){if(!G(t)||(e=t,x&&x in e))return!1;var e,n=function(t){var e=G(t)?U.call(t):"";return e==d||e==u}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?S:g;return n.test(function(t){if(null!=t){try{return _.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function z(t,e){var n,r,o=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?o["string"==typeof e?"string":"hash"]:o.map}function H(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return D(n)?n:void 0}C.prototype.clear=function(){this.__data__=M?M(null):{}},C.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},C.prototype.get=function(t){var e=this.__data__;if(M){var n=e[t];return n===c?void 0:n}return E.call(e,t)?e[t]:void 0},C.prototype.has=function(t){var e=this.__data__;return M?void 0!==e[t]:E.call(e,t)},C.prototype.set=function(t,e){return this.__data__[t]=M&&void 0===e?c:e,this},L.prototype.clear=function(){this.__data__=[]},L.prototype.delete=function(t){var e=this.__data__,n=N(e,t);return!(n<0)&&(n==e.length-1?e.pop():T.call(e,n,1),!0)},L.prototype.get=function(t){var e=this.__data__,n=N(e,t);return n<0?void 0:e[n][1]},L.prototype.has=function(t){return N(this.__data__,t)>-1},L.prototype.set=function(t,e){var n=this.__data__,r=N(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},q.prototype.clear=function(){this.__data__={hash:new C,map:new(R||L),string:new C}},q.prototype.delete=function(t){return z(this,t).delete(t)},q.prototype.get=function(t){return z(this,t).get(t)},q.prototype.has=function(t){return z(this,t).has(t)},q.prototype.set=function(t,e){return z(this,t).set(t,e),this};var F=J((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(K(t))return $?$.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(e);var n=[];return p.test(t)&&n.push(""),t.replace(f,(function(t,e,r,o){n.push(r?o.replace(v,"$1"):e||t)})),n}));function B(t){if("string"==typeof t||K(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function J(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,o=e?e.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=t.apply(this,r);return n.cache=i.set(o,s),s};return n.cache=new(J.Cache||q),n}J.Cache=q;var Z=Array.isArray;function G(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function K(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==U.call(t)}var Q=function(t,e,n){var r=null==t?void 0:W(t,e);return void 0===r?n:r},V="/v1/auth/code/verify",X="/v1/auth/signin/otp",Y="/v1/auth/signup/otp",tt={email:"/v1/user/update/email/otp",phone:"/v1/user/update/phone/otp"},et="/v1/auth/sign-up-or-in/otp",nt="/v1/auth/magiclink/verify",rt="/v1/auth/signin/magiclink",ot="/v1/auth/signup/magiclink",it="/v1/auth/magiclink/session",st={email:"/v1/user/update/email/magiclink",phone:"/v1/user/update/phone/magiclink"},at="/v1/auth/sign-up-or-in/magiclink",ct="/v1/oauth/authorize",dt="/v1/auth/saml/authorize",ut="/v1/auth/verify/totp",lt="/v1/auth/signup/totp",ht="/v1/user/update/totp",pt={start:"/v1/webauthn/signup/start",finish:"/v1/webauthn/signup/finish"},ft={start:"/v1/webauthn/signin/start",finish:"/v1/webauthn/signin/finish"},vt={start:"/v1/webauthn/device/add/start",finish:"/v1/webauthn/device/add/finish"},gt="/v1/flow/start",bt="/v1/flow/next";const mt=()=>{const t={};return{headers(e){const n="function"==typeof e.entries?Object.fromEntries(e.entries()):e;return t.Headers=JSON.stringify(n),this},body(e){return t.Body=e,this},url(e){return t.Url=e.toString(),this},method(e){return t.Method=e,this},title(e){return t.Title=e,this},status(e){return t.Status=e,this},build:()=>Object.keys(t).flatMap((e=>t[e]?[`${"Title"!==e?`${e}: `:""}${t[e]}`]:[])).join("\n")}},yt=(...t)=>new Headers(t.reduce(((t,e)=>{const n=(t=>Array.isArray(t)?t:t instanceof Headers?Array.from(t.entries()):t?Object.entries(t):[])(e);return n.reduce(((e,[n,r])=>(t[n]=r,t)),t),t}),{})),wt=t=>void 0===t?void 0:JSON.stringify(t);var It;!function(t){t.get="GET",t.delete="DELETE",t.post="POST",t.put="PUT"}(It||(It={}));const jt=(t,e="")=>{let n=t;return""!==e&&(n=n+":"+e),{Authorization:`Bearer ${n}`}},kt=({baseUrl:e,projectId:n,baseConfig:r,logger:o})=>{const i=((e,n)=>{const r=n||fetch;if(!r)throw new Error("fetch is not defined");return e?(...n)=>t(void 0,void 0,void 0,(function*(){e.log((t=>mt().title("Request").url(t[0]).method(t[1].method).headers(t[1].headers).body(t[1].body).build())(n));const o=yield r(...n);return e[o.ok?"log":"error"](yield(e=>t(void 0,void 0,void 0,(function*(){const t=yield e.text();return e.text=()=>Promise.resolve(t),e.json=()=>Promise.resolve(JSON.parse(t)),mt().title("Response").url(e.url.toString()).status(`${e.status} ${e.statusText}`).headers(e.headers).body(t).build()})))(o)),o})):r})(o),s=({path:t,body:o,headers:s,queryParams:a,method:c,token:d})=>i((({path:t,baseUrl:e,queryParams:n})=>{const r=new URL(t,e);return n&&(r.search=new URLSearchParams(n).toString()),r})({path:t,baseUrl:e,queryParams:a}),{headers:yt(jt(n,d),(null==r?void 0:r.baseHeaders)||{},s),method:c,body:wt(o)});return{get:(t,{headers:e,queryParams:n,token:r}={})=>s({path:t,headers:e,queryParams:n,body:void 0,method:It.get,token:r}),post:(t,e,{headers:n,queryParams:r,token:o}={})=>s({path:t,headers:n,queryParams:r,body:e,method:It.post,token:o}),put:(t,e,{headers:n,queryParams:r,token:o}={})=>s({path:t,headers:n,queryParams:r,body:e,method:It.put,token:o}),delete:(t,e,{headers:n,queryParams:r,token:o}={})=>s({path:t,headers:n,queryParams:r,body:e,method:It.delete,token:o})}},Ot=t=>{if("string"!=typeof t||!t)throw new Error("Invalid token provided");const{exp:e}=s(t);return(new Date).getTime()/1e3>e},xt=(...t)=>t.join("/").replace(/\/{2,}/g,"/"),_t=e=>t(void 0,void 0,void 0,(function*(){const t=yield e,n={code:t.status,ok:t.ok,response:t},r=yield t.json();return t.ok?n.data=r:n.error=r,n}));var Et,Ut,St;!function(t){t.sms="sms",t.whatsapp="whatsapp"}(Et||(Et={})),function(t){t.email="email",t.sms="sms",t.whatsapp="whatsapp"}(Ut||(Ut={})),function(t){t.signUp="signup",t.signIn="signin",t.verify="verify"}(St||(St={}));const Pt=(t,e)=>(n=e)=>e=>!t(e)&&n.replace("{val}",e),Tt=(...t)=>({validate:e=>(t.forEach((t=>{const n=t(e);if(n)throw new Error(n)})),!0)}),Rt=t=>e=>t.test(e),Mt=Rt(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),At=Rt(/^\+[1-9]{1}[0-9]{3,14}$/),$t=Pt(Mt,'"{val}" is not a valid email'),Ct=Pt(At,'"{val}" is not a valid phone number'),Lt=Pt((1,t=>t.length>=1),"Minimum length is 1");const qt=Pt((t=>"string"==typeof t),"Input is not a string"),Nt=(...t)=>e=>(...n)=>(t.forEach(((t,e)=>Tt(...t).validate(n[e]))),e(...n)),Wt=t=>[qt(`"${t}" must be a string`),Lt(`"${t}" must not be empty`)],Dt=t=>[qt(`"${t}" must be a string`),$t()],zt=t=>[qt(`"${t}" must be a string`),Ct()];var Ht;!function(t){t.signUp="signup",t.signIn="signin",t.verify="verify",t.updatePhone="updatePhone"}(Ht||(Ht={}));const Ft=Wt("identifier"),Bt=Nt(Ft,Wt("code")),Jt=Nt(Ft),Zt=Nt(Ft,zt("phone")),Gt=Nt(Ft,Dt("email")),Kt=t=>({verify:Object.keys(Ut).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Bt(((e,r)=>_t(t.post(xt(V,n),{code:r,externalId:e}))))})),{}),signIn:Object.keys(Ut).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Jt((e=>_t(t.post(xt(X,n),{externalId:e}))))})),{}),signUp:Object.keys(Ut).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Jt(((e,r)=>_t(t.post(xt(Y,n),{externalId:e,user:r}))))})),{}),signUpOrIn:Object.keys(Ut).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Jt((e=>_t(t.post(xt(et,n),{externalId:e}))))})),{}),update:{email:Gt(((e,n,r)=>_t(t.post(tt.email,{externalId:e,email:n},{token:r})))),phone:Object.keys(Et).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Zt(((e,r,o)=>_t(t.post(xt(tt.phone,n),{externalId:e,phone:r},{token:o}))))})),{})}}),Qt=Wt("identifier"),Vt=Wt("uri"),Xt=Nt(Wt("token")),Yt=Nt(Qt,Vt),te=Nt(Wt("pendingRef")),ee=Nt(Qt,zt("phone"),Vt),ne=Nt(Qt,Dt("email"),Vt),re=e=>({verify:Xt((t=>_t(e.post(nt,{token:t})))),signIn:Object.keys(Ut).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Yt(((t,r)=>_t(e.post(xt(rt,n),{externalId:t,URI:r,crossDevice:!0}))))})),{}),signUpOrIn:Object.keys(Ut).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Yt(((t,r)=>_t(e.post(xt(at,n),{externalId:t,URI:r,crossDevice:!0}))))})),{}),signUp:Object.keys(Ut).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:Yt(((t,r,o)=>_t(e.post(xt(ot,n),{externalId:t,URI:r,user:o,crossDevice:!0}))))})),{}),waitForSession:te(((n,r)=>new Promise((o=>{const{pollingIntervalMs:i,timeoutMs:s}=(({pollingIntervalMs:t=1e3,timeoutMs:e=6e5}={})=>({pollingIntervalMs:Math.max(t||1e3,1e3),timeoutMs:Math.min(e||6e5,6e5)}))(r);let a;const c=setInterval((()=>t(void 0,void 0,void 0,(function*(){const t=yield e.post(it,{pendingRef:n});t.ok&&(clearInterval(c),a&&clearTimeout(a),o(_t(Promise.resolve(t))))}))),i);a=setTimeout((()=>{o({error:{message:`Session polling timeout exceeded: ${s}ms`,code:"0"},ok:!1}),clearInterval(c)}),s)})))),update:{email:ne(((t,n,r,o)=>_t(e.post(st.email,{externalId:t,email:n,URI:r,crossDevice:!0},{token:o})))),phone:Object.keys(Et).reduce(((t,n)=>Object.assign(Object.assign({},t),{[n]:ee(((t,r,o,i)=>_t(e.post(xt(st.phone,n),{externalId:t,phone:r,URI:o,crossDevice:!0},{token:i}))))})),{})}}),oe=t=>({verify:Xt((e=>_t(t.post(nt,{token:e})))),signIn:Object.keys(Ut).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Yt(((e,r)=>_t(t.post(xt(rt,n),{externalId:e,URI:r}))))})),{}),signUp:Object.keys(Ut).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Yt(((e,r,o)=>_t(t.post(xt(ot,n),{externalId:e,URI:r,user:o}))))})),{}),signUpOrIn:Object.keys(Ut).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Yt(((e,r)=>_t(t.post(xt(at,n),{externalId:e,URI:r}))))})),{}),update:{email:ne(((e,n,r,o)=>_t(t.post(st.email,{externalId:e,email:n,URI:r},{token:o})))),phone:Object.keys(Et).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:ee(((e,r,o,i)=>_t(t.post(xt(st.phone,n),{externalId:e,phone:r,URI:o},{token:i}))))})),{})},crossDevice:re(t)}),ie=Nt(Wt("code")),se=t=>({exchange:ie((e=>_t(t.get("/v1/auth/exchange",{queryParams:{code:e}}))))});var ae;!function(t){t.facebook="facebook",t.github="github",t.google="google",t.microsoft="microsoft",t.gitlab="gitlab",t.apple="apple"}(ae||(ae={}));const ce=e=>Object.assign({start:Object.keys(ae).reduce(((n,r)=>Object.assign(Object.assign({},n),{[r]:(n,{redirect:o=!1}={})=>t(void 0,void 0,void 0,(function*(){const t=yield e.get(ct,{queryParams:Object.assign({provider:r},n&&{redirectURL:n})});if(!o||!t.ok)return _t(Promise.resolve(t));const{url:i}=yield t.json();window.location.href=i}))})),{})},se(e)),de=Nt(Wt("flowId")),ue=Nt(Wt("executionId"),Wt("stepId"),Wt("actionId")),le=t=>({start:de((e=>_t(t.post(gt,{flowId:e})))),next:ue(((e,n,r,o)=>_t(t.post(bt,{executionId:e,stepId:n,actionId:r,input:o}))))}),he=Nt(Wt("tenant")),pe=e=>Object.assign({start:he(((n,r,{redirect:o=!1}={})=>t(void 0,void 0,void 0,(function*(){const t=yield e.get(dt,{queryParams:{tenant:n,redirectURL:r}});if(!o||!t.ok)return _t(Promise.resolve(t));const{url:i}=yield t.json();window.location.href=i}))))},se(e)),fe=Wt("identifier"),ve=Nt(fe,Wt("code")),ge=Nt(fe),be=Nt(fe),me=t=>({signUp:ge(((e,n)=>_t(t.post(lt,{externalId:e,user:n})))),verify:ve(((e,n)=>_t(t.post(ut,{externalId:e,code:n})))),update:be(((e,n)=>_t(t.post(ht,{externalId:e},{token:n}))))}),ye=Wt("identifier"),we=Wt("origin"),Ie=Nt(ye,we,Wt("name")),je=Nt(ye,we),ke=Nt(ye,we,Wt("token")),Oe=Nt(Wt("transactionId"),Wt("response")),xe=t=>({signUp:{start:Ie(((e,n,r)=>_t(t.post(pt.start,{user:{externalId:e,name:r},origin:n})))),finish:Oe(((e,n)=>_t(t.post(pt.finish,{transactionId:e,response:n}))))},signIn:{start:je(((e,n)=>_t(t.post(ft.start,{externalId:e,origin:n})))),finish:Oe(((e,n)=>_t(t.post(ft.finish,{transactionId:e,response:n}))))},add:{start:ke(((e,n,r)=>_t(t.post(vt.start,{externalId:e,origin:n},{token:r})))),finish:Oe(((e,n)=>_t(t.post(vt.finish,{transactionId:e,response:n}))))}}),_e=Nt(Wt("token"));var Ee;const Ue=Nt([("projectId",Ee=Wt("projectId"),Pt(((t,e)=>t=>Tt(...e).validate(Q(t,"projectId")))(0,Ee))())])((({projectId:t,logger:e,baseUrl:n})=>{return r=kt({baseUrl:n||"https://api.descope.com",projectId:t,logger:e}),{otp:Kt(r),magicLink:oe(r),oauth:ce(r),saml:pe(r),totp:me(r),webauthn:xe(r),flow:le(r),refresh:t=>_t(r.get("/v1/auth/refresh",{token:t})),logout:t=>_t(r.get("/v1/auth/logoutall",{token:t})),isJwtExpired:_e(Ot),httpClient:r};var r}));Ue.DeliveryMethods=Ut;const Se="descope-login-flow",Pe="code",Te="redirect",Re="poll";function Me(t){return new URLSearchParams(window.location.search).get(t)}function Ae(){return Me(Se)}function $e(t){if(window.history.replaceState&&Me(t)){const e=new URL(window.location.href),n=new URLSearchParams(e.search);n.delete(t),e.search=n.toString(),window.history.replaceState({},"",e.toString())}}var Ce;function Le(t){const e=`/${t}.html`,n=new URL("https://s3.eu-central-1.amazonaws.com/static.sandbox.descope.com/pages");return n.pathname+=e,n.toString()}function qe(t,e){if(!Number.isNaN(t)&&!Number.isNaN(e))return t>e?Ce.forward:t<e?Ce.backward:void 0}!function(t){t.backward="backward",t.forward="forward"}(Ce||(Ce={}));const Ne=()=>{const[t="",e=""]=(Ae()||"").split("_");return{executionId:t,stepId:e}},We=(t,e)=>{!function(t){if(window.history.pushState&&t!==Ae()){const e=new URL(window.location.href),n=new URLSearchParams(e.search);n.set(Se,t),e.search=n.toString(),window.history.pushState({},"",e.toString())}}([t,e].join("_"))};const De=(t,e,n="")=>{const r=t.getElementById(e);r&&(r.innerText=n,r.classList[n?"remove":"add"]("hide"))};var ze,He,Fe,Be,Je,Ze,Ge,Ke,Qe,Ve,Xe,Ye,tn,en,nn,rn,on,sn,an,cn,dn,un,ln,hn;class pn{constructor(t={}){ze.set(this,void 0),He.set(this,{}),Fe.set(this,0),n(this,ze,t,"f")}get current(){return Object.assign({},e(this,ze,"f"))}update(t){const r="function"==typeof t?t(e(this,ze,"f")):t,o=Object.assign(Object.assign({},e(this,ze,"f")),r);if(!function(t,e){const n=Object.getOwnPropertyNames(t),r=Object.getOwnPropertyNames(e);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r+=1){const o=n[r];if(t[o]!==e[o])return!1}return!0}(e(this,ze,"f"),o)){const t=e(this,ze,"f");n(this,ze,o,"f"),Object.freeze(e(this,ze,"f")),setTimeout((()=>{Object.values(e(this,He,"f")).forEach((e=>e(o,t,((t,e)=>n=>t[n]!==e[n])(o,t))))}),0)}}subscribe(t){return n(this,Fe,e(this,Fe,"f")+1,"f"),e(this,He,"f")[e(this,Fe,"f")]=t,e(this,Fe,"f").toString()}unsubscribe(t){const n=!!e(this,He,"f")[t];return n&&delete e(this,He,"f")[t],n}unsubscribeAll(){return n(this,He,{},"f"),!0}}ze=new WeakMap,He=new WeakMap,Fe=new WeakMap,function(t){t.waiting="waiting",t.completed="completed",t.failed="failed",t.running="running"}(Be||(Be={}));const fn=document.createElement("template");fn.innerHTML="\n\t<style>\n\t\t:host {\n\t\t\tdisplay: inline-block;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t}\n\t\t\n\t\tform {\n\t\t\theight: 100%;\n\t\t\ttransition: opacity 300ms ease-in-out;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1;\n\t\t}\n\n\t</style>\n\t<form></form>\n\t";class vn extends HTMLElement{constructor(){super(),Je.add(this),Ze.set(this,!1),Ge.set(this,new pn),Ke.set(this,new pn),Qe.set(this,void 0),Ve.set(this,void 0),Xe.set(this,void 0),Ye.set(this,{popstate:e(this,Je,"m",rn).bind(this)}),tn.set(this,void 0),cn.set(this,(t=>{var n,r;if(e(this,Je,"m",sn).call(this,t))return;const{executionId:o,stepId:i,status:s,action:a,screen:c,redirect:d,authInfo:u,error:l}=t.data;e(this,Je,"m",on).call(this,s,l,u)||e(this,Ge,"f").update({stepId:i,executionId:o,action:a,redirectUrl:null==d?void 0:d.url,screenId:null==c?void 0:c.id,screenErrorText:null===(n=null==c?void 0:c.state)||void 0===n?void 0:n.errorText,screenMessageText:null===(r=null==c?void 0:c.state)||void 0===r?void 0:r.messageText})})),e(this,Je,"m",en).call(this),e(this,Ge,"f").subscribe(e(this,Je,"m",an).bind(this)),e(this,Ke,"f").subscribe(e(this,Je,"m",un).bind(this))}static get observedAttributes(){return["project-id","flow-id","base-url"]}get"project-id"(){return this.getAttribute("project-id")}get"flow-id"(){return this.getAttribute("flow-id")}get"base-url"(){return this.getAttribute("base-url")||void 0}connectedCallback(){if(this.shadowRoot.isConnected){n(this,Ze,!0,"f"),e(this,Je,"m",nn).call(this);const{executionId:t,stepId:r}=Ne(),o=Me("t")||void 0;o&&$e("t");const i=Me(Pe)||void 0;i&&$e(Pe),e(this,Ge,"f").update({projectId:this["project-id"],flowId:this["flow-id"],baseUrl:this["base-url"],stepId:r,executionId:t,token:o,code:i}),window.addEventListener("popstate",e(this,Ye,"f").popstate)}}disconnectedCallback(){e(this,Ge,"f").unsubscribeAll(),e(this,Ke,"f").unsubscribeAll(),window.removeEventListener("popstate",e(this,Ye,"f").popstate)}attributeChangedCallback(t,n,r){if(this.shadowRoot.isConnected&&e(this,Ze,"f")&&n!==r&&vn.observedAttributes.includes(t)){e(this,Je,"m",nn).call(this);const o=null===n;e(this,Ge,"f").update((({stepId:e,executionId:n})=>{let i=e,s=n;return o||(s=null,i=null,$e(Se)),{[(a=t,a.replace(/-./g,(t=>t[1].toUpperCase())))]:r,stepId:i,executionId:s};var a}))}}}Ze=new WeakMap,Ge=new WeakMap,Ke=new WeakMap,Qe=new WeakMap,Ve=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,tn=new WeakMap,cn=new WeakMap,Je=new WeakSet,en=function(){this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(fn.content.cloneNode(!0)),n(this,Qe,this.shadowRoot.querySelector("form"),"f"),n(this,Ve,this.shadowRoot.querySelector("style"),"f")},nn=function(){const t=["base-url"];vn.observedAttributes.forEach((e=>{if(!t.includes(e)&&!this[e])throw Error(`${e} cannot be empty`)}))},rn=function(){const{stepId:t,executionId:n}=Ne();e(this,Ge,"f").update({stepId:t,executionId:n})},on=function(t,n,r){switch(t){case Be.failed:return e(this,Je,"m",hn).call(this,"error",n),!0;case Be.completed:return e(this,Je,"m",hn).call(this,"success",r),!0;default:return!1}},sn=function({ok:t,error:n}){return t||e(this,Je,"m",hn).call(this,"error",n),!t},an=function(r,o,i){return t(this,void 0,void 0,(function*(){const{projectId:s,flowId:a,baseUrl:c,stepId:d,executionId:u,action:l,screenId:h,screenErrorText:p,screenMessageText:f,redirectUrl:v,token:g,code:b}=r,m=i("projectId")||i("baseUrl");if(e(this,Xe,"f")&&(clearInterval(e(this,Xe,"f")),n(this,Xe,null,"f")),m){if(!s)return;n(this,tn,Ue({projectId:s,baseUrl:c}),"f")}if(!u){if(!a)return;const t=yield e(this,tn,"f").flow.start(a);return void e(this,cn,"f").call(this,t)}if(i("token")&&g||i("code")&&b){const t=yield e(this,tn,"f").flow.next(u,d,"submit",{token:g,code:b});return e(this,cn,"f").call(this,t),We(t.data.executionId,t.data.stepId),void e(this,Ge,"f").update({token:void 0,code:void 0})}if(l===Te)return v?void window.location.assign(v):void console.error("Did not get redirect url");if(l===Re&&n(this,Xe,setInterval((()=>t(this,void 0,void 0,(function*(){const t=yield e(this,tn,"f").flow.next(u,d,"submit",{});e(this,cn,"f").call(this,t)}))),2e3),"f"),!h)return void console.error("Refreshing the page during a flow is not supported yet");const y={direction:qe(+d,+o.stepId),screenErrorText:p,screenMessageText:f,htmlUrl:Le(h)};(m||i("executionId")||i("stepId"))&&(y.next=(...t)=>e(this,tn,"f").flow.next(u,d,...t)),e(this,Ke,"f").update(y)}))},dn=function(n){this.shadowRoot.querySelectorAll('button[type="button"]').forEach((r=>{const o=(t=>Array.from(t.attributes).reduce(((t,e)=>{var n;const r=null===(n=new RegExp("^data-descope-(\\S+)$").exec(e.name))||void 0===n?void 0:n[1];return r?Object.assign(t,{[r]:e.value}):t}),{}))(r),{action:i}=o,s=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}(o,["action"]);r.onclick=()=>t(this,void 0,void 0,(function*(){const t=yield n(i,s);e(this,cn,"f").call(this,t),We(t.data.executionId,t.data.stepId)}))})),e(this,Qe,"f").onsubmit=r=>t(this,void 0,void 0,(function*(){r.preventDefault();const t=Object.fromEntries(new FormData(r.target).entries()),o=yield n("submit",t);e(this,cn,"f").call(this,o),We(o.data.executionId,o.data.stepId)}))},un=function(n,r,o){return t(this,void 0,void 0,(function*(){const r="error",i="info",{htmlUrl:s,validations:a={},direction:c,next:d,screenErrorText:u,screenMessageText:l}=n;if(!o("htmlUrl"))return o("next")&&e(this,Je,"m",dn).call(this,d),o("screenErrorText")&&De(this.shadowRoot,r,u),void(o("screenMessageText")&&De(this.shadowRoot,i,l));const h=document.createElement("template");h.innerHTML=yield function(e){return t(this,void 0,void 0,(function*(){const t=yield fetch(e,{cache:"default"});if(!t.ok)throw new Error(e);return t.text()}))}(s);const p=h.content.cloneNode(!0),f=(t=>{var e;const n=Array.from(t.querySelectorAll("script[data-id]")).map((e=>{var n;const r=e.getAttribute("data-id"),o=null===(n=t.getElementById(r))||void 0===n?void 0:n.innerHTML,i=Function(o).bind(e.previousSibling);return e.remove(),i}));return null===(e=t.querySelector("scripts"))||void 0===e||e.remove(),n})(p),v=()=>{!function(t,e){Object.entries(e).forEach((([e,n])=>{const r=t.getElementById(e);if(!r)throw new Error(`Cannot find element with id: ${e}`);Object.entries(n).forEach((([t,e])=>{r.setAttribute(t,e.toString()),r.addEventListener("blur",(()=>r.classList.add("touched")),{once:!0})}))}))}(p,a),De(p,r,u),De(p,i,l);try{f.forEach((t=>t()))}catch(t){console.error(t)}e(this,Qe,"f").replaceChildren(p),e(this,Je,"m",dn).call(this,d),e(this,Je,"m",hn).call(this,"page-updated",{})};c?e(this,Je,"m",ln).call(this,v,c):v()}))},ln=function(t,n){e(this,Qe,"f").addEventListener("transitionend",(()=>{e(this,Qe,"f").classList.remove("fade-out"),t()}),{once:!0});const r=n===Ce.forward?"slide-forward":"slide-backward";Array.from(e(this,Qe,"f").getElementsByClassName("input-container")).forEach(((t,e)=>{t.style["transition-delay"]=40*e+"ms",t.classList.add(r)})),e(this,Qe,"f").classList.add("fade-out")},hn=function(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e}))},customElements.define("descope-wc",vn)}();
|
|
1
|
+
!function(){"use strict";function t(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{c(r.next(t))}catch(t){o(t)}}function a(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))}function e(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}function n(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n}function r(t){this.message=t}r.prototype=new Error,r.prototype.name="InvalidCharacterError";var i="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new r("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,i,o=0,s=0,a="";i=e.charAt(s++);~i&&(n=o%4?64*n+i:i,o++%4)?a+=String.fromCharCode(255&n>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return a};function o(t){this.message=t}function s(t,e){if("string"!=typeof t)throw new o("Invalid token specified");var n=!0===(e=e||{}).header?0:1;try{return JSON.parse(function(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(i(t).replace(/(.)/g,(function(t,e){var n=e.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(e)}catch(t){return i(e)}}(t.split(".")[n]))}catch(t){throw new o("Invalid token specified: "+t.message)}}o.prototype=new Error,o.prototype.name="InvalidTokenError";var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},c="__lodash_hash_undefined__",u="[object Function]",d="[object GeneratorFunction]",l=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,h=/^\w*$/,p=/^\./,f=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,g=/\\(\\)?/g,v=/^\[object .+?Constructor\]$/,b="object"==typeof a&&a&&a.Object===Object&&a,y="object"==typeof self&&self&&self.Object===Object&&self,w=b||y||Function("return this")();var m,I=Array.prototype,j=Function.prototype,O=Object.prototype,k=w["__core-js_shared__"],x=(m=/[^.]+$/.exec(k&&k.keys&&k.keys.IE_PROTO||""))?"Symbol(src)_1."+m:"",_=j.toString,E=O.hasOwnProperty,S=O.toString,U=RegExp("^"+_.call(E).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),T=w.Symbol,P=I.splice,R=H(w,"Map"),M=H(Object,"create"),A=T?T.prototype:void 0,C=A?A.toString:void 0;function $(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function L(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function N(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function q(t,e){for(var n,r,i=t.length;i--;)if((n=t[i][0])===(r=e)||n!=n&&r!=r)return i;return-1}function D(t,e){var n;e=function(t,e){if(B(t))return!1;var n=typeof t;if("number"==n||"symbol"==n||"boolean"==n||null==t||Z(t))return!0;return h.test(t)||!l.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:B(n=e)?n:z(n);for(var r=0,i=e.length;null!=t&&r<i;)t=t[K(e[r++])];return r&&r==i?t:void 0}function J(t){if(!G(t)||(e=t,x&&x in e))return!1;var e,n=function(t){var e=G(t)?S.call(t):"";return e==u||e==d}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?U:v;return n.test(function(t){if(null!=t){try{return _.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function W(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function H(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return J(n)?n:void 0}$.prototype.clear=function(){this.__data__=M?M(null):{}},$.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},$.prototype.get=function(t){var e=this.__data__;if(M){var n=e[t];return n===c?void 0:n}return E.call(e,t)?e[t]:void 0},$.prototype.has=function(t){var e=this.__data__;return M?void 0!==e[t]:E.call(e,t)},$.prototype.set=function(t,e){return this.__data__[t]=M&&void 0===e?c:e,this},L.prototype.clear=function(){this.__data__=[]},L.prototype.delete=function(t){var e=this.__data__,n=q(e,t);return!(n<0)&&(n==e.length-1?e.pop():P.call(e,n,1),!0)},L.prototype.get=function(t){var e=this.__data__,n=q(e,t);return n<0?void 0:e[n][1]},L.prototype.has=function(t){return q(this.__data__,t)>-1},L.prototype.set=function(t,e){var n=this.__data__,r=q(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},N.prototype.clear=function(){this.__data__={hash:new $,map:new(R||L),string:new $}},N.prototype.delete=function(t){return W(this,t).delete(t)},N.prototype.get=function(t){return W(this,t).get(t)},N.prototype.has=function(t){return W(this,t).has(t)},N.prototype.set=function(t,e){return W(this,t).set(t,e),this};var z=F((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(Z(t))return C?C.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(e);var n=[];return p.test(t)&&n.push(""),t.replace(f,(function(t,e,r,i){n.push(r?i.replace(g,"$1"):e||t)})),n}));function K(t){if("string"==typeof t||Z(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function F(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new(F.Cache||N),n}F.Cache=N;var B=Array.isArray;function G(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Z(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==S.call(t)}var Q,V=function(t,e,n){var r=null==t?void 0:D(t,e);return void 0===r?n:r},X="/v1/auth/code/verify",Y="/v1/auth/signin/otp",tt="/v1/auth/signup/otp",et={email:"/v1/user/update/email/otp",phone:"/v1/user/update/phone/otp"},nt="/v1/auth/sign-up-or-in/otp",rt="/v1/auth/magiclink/verify",it="/v1/auth/signin/magiclink",ot="/v1/auth/signup/magiclink",st="/v1/auth/magiclink/session",at={email:"/v1/user/update/email/magiclink",phone:"/v1/user/update/phone/magiclink"},ct="/v1/auth/sign-up-or-in/magiclink",ut="/v1/oauth/authorize",dt="/v1/auth/saml/authorize",lt="/v1/auth/verify/totp",ht="/v1/auth/signup/totp",pt="/v1/user/update/totp",ft={start:"/v1/webauthn/signup/start",finish:"/v1/webauthn/signup/finish"},gt={start:"/v1/webauthn/signin/start",finish:"/v1/webauthn/signin/finish"},vt={start:"/v1/webauthn/device/add/start",finish:"/v1/webauthn/device/add/finish"},bt="/v1/flow/start",yt="/v1/flow/next";!function(t){t.get="GET",t.delete="DELETE",t.post="POST",t.put="PUT"}(Q||(Q={}));const wt=()=>{const t={};return{headers(e){const n="function"==typeof e.entries?Object.fromEntries(e.entries()):e;return t.Headers=JSON.stringify(n),this},body(e){return t.Body=e,this},url(e){return t.Url=e.toString(),this},method(e){return t.Method=e,this},title(e){return t.Title=e,this},status(e){return t.Status=e,this},build:()=>Object.keys(t).flatMap((e=>t[e]?[`${"Title"!==e?`${e}: `:""}${t[e]}`]:[])).join("\n")}},mt=(...t)=>new Headers(t.reduce(((t,e)=>{const n=(t=>Array.isArray(t)?t:t instanceof Headers?Array.from(t.entries()):t?Object.entries(t):[])(e);return n.reduce(((e,[n,r])=>(t[n]=r,t)),t),t}),{})),It=t=>void 0===t?void 0:JSON.stringify(t),jt=(t,e="")=>{let n=t;return""!==e&&(n=n+":"+e),{Authorization:`Bearer ${n}`}},Ot=({baseUrl:t,projectId:e,baseConfig:n,logger:r,hooks:i})=>{const o=((t,e)=>{const n=e||fetch;if(!n)throw new Error("fetch is not defined");return t?async(...e)=>{t.log((t=>wt().title("Request").url(t[0]).method(t[1].method).headers(t[1].headers).body(t[1].body).build())(e));const r=await n(...e);return t[r.ok?"log":"error"](await(async t=>{const e=await t.text();return t.text=()=>Promise.resolve(e),t.json=()=>Promise.resolve(JSON.parse(e)),wt().title("Response").url(t.url.toString()).status(`${t.status} ${t.statusText}`).headers(t.headers).body(e).build()})(r)),r}:n})(r),s=r=>{const s=(null==i?void 0:i.beforeRequest)?i.beforeRequest(r):r,{path:a,body:c,headers:u,queryParams:d,method:l,token:h}=s;return o((({path:t,baseUrl:e,queryParams:n})=>{const r=new URL(t,e);return n&&(r.search=new URLSearchParams(n).toString()),r})({path:a,baseUrl:t,queryParams:d}),{headers:mt(jt(e,h),(null==n?void 0:n.baseHeaders)||{},u),method:l,body:It(c)})};return{get:(t,{headers:e,queryParams:n,token:r}={})=>s({path:t,headers:e,queryParams:n,body:void 0,method:Q.get,token:r}),post:(t,e,{headers:n,queryParams:r,token:i}={})=>s({path:t,headers:n,queryParams:r,body:e,method:Q.post,token:i}),put:(t,e,{headers:n,queryParams:r,token:i}={})=>s({path:t,headers:n,queryParams:r,body:e,method:Q.put,token:i}),delete:(t,e,{headers:n,queryParams:r,token:i}={})=>s({path:t,headers:n,queryParams:r,body:e,method:Q.delete,token:i})}},kt=t=>{if("string"!=typeof t||!t)throw new Error("Invalid token provided");const{exp:e}=s(t);return(new Date).getTime()/1e3>e},xt=(...t)=>t.join("/").replace(/\/{2,}/g,"/"),_t=async t=>{const e=await t,n={code:e.status,ok:e.ok,response:e},r=await e.json();return e.ok?n.data=r:n.error=r,n};var Et,St,Ut;!function(t){t.sms="sms",t.whatsapp="whatsapp"}(Et||(Et={})),function(t){t.email="email",t.sms="sms",t.whatsapp="whatsapp"}(St||(St={})),function(t){t.signUp="signup",t.signIn="signin",t.verify="verify"}(Ut||(Ut={}));const Tt=(t,e)=>(n=e)=>e=>!t(e)&&n.replace("{val}",e),Pt=(...t)=>({validate:e=>(t.forEach((t=>{const n=t(e);if(n)throw new Error(n)})),!0)}),Rt=t=>e=>t.test(e),Mt=Rt(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/),At=Rt(/^\+[1-9]{1}[0-9]{3,14}$/),Ct=Tt(Mt,'"{val}" is not a valid email'),$t=Tt(At,'"{val}" is not a valid phone number'),Lt=Tt((1,t=>t.length>=1),"Minimum length is 1");const Nt=Tt((t=>"string"==typeof t),"Input is not a string"),qt=(...t)=>e=>(...n)=>(t.forEach(((t,e)=>Pt(...t).validate(n[e]))),e(...n)),Dt=t=>[Nt(`"${t}" must be a string`),Lt(`"${t}" must not be empty`)],Jt=t=>[Nt(`"${t}" must be a string`),Ct()],Wt=t=>[Nt(`"${t}" must be a string`),$t()];var Ht;!function(t){t.signUp="signup",t.signIn="signin",t.verify="verify",t.updatePhone="updatePhone"}(Ht||(Ht={}));const zt=Dt("identifier"),Kt=qt(zt,Dt("code")),Ft=qt(zt),Bt=qt(zt,Wt("phone")),Gt=qt(zt,Jt("email")),Zt=t=>({verify:Object.keys(St).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Kt(((e,r)=>_t(t.post(xt(X,n),{code:r,externalId:e}))))})),{}),signIn:Object.keys(St).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Ft((e=>_t(t.post(xt(Y,n),{externalId:e}))))})),{}),signUp:Object.keys(St).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Ft(((e,r)=>_t(t.post(xt(tt,n),{externalId:e,user:r}))))})),{}),signUpOrIn:Object.keys(St).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Ft((e=>_t(t.post(xt(nt,n),{externalId:e}))))})),{}),update:{email:Gt(((e,n,r)=>_t(t.post(et.email,{externalId:e,email:n},{token:r})))),phone:Object.keys(Et).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Bt(((e,r,i)=>_t(t.post(xt(et.phone,n),{externalId:e,phone:r},{token:i}))))})),{})}}),Qt=Dt("identifier"),Vt=Dt("uri"),Xt=qt(Dt("token")),Yt=qt(Qt,Vt),te=qt(Dt("pendingRef")),ee=qt(Qt,Wt("phone"),Vt),ne=qt(Qt,Jt("email"),Vt),re=t=>({verify:Xt((e=>_t(t.post(rt,{token:e})))),signIn:Object.keys(St).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Yt(((e,r)=>_t(t.post(xt(it,n),{externalId:e,URI:r,crossDevice:!0}))))})),{}),signUpOrIn:Object.keys(St).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Yt(((e,r)=>_t(t.post(xt(ct,n),{externalId:e,URI:r,crossDevice:!0}))))})),{}),signUp:Object.keys(St).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Yt(((e,r,i)=>_t(t.post(xt(ot,n),{externalId:e,URI:r,user:i,crossDevice:!0}))))})),{}),waitForSession:te(((e,n)=>new Promise((r=>{const{pollingIntervalMs:i,timeoutMs:o}=(({pollingIntervalMs:t=1e3,timeoutMs:e=6e5}={})=>({pollingIntervalMs:Math.max(t||1e3,1e3),timeoutMs:Math.min(e||6e5,6e5)}))(n);let s;const a=setInterval((async()=>{const n=await t.post(st,{pendingRef:e});n.ok&&(clearInterval(a),s&&clearTimeout(s),r(_t(Promise.resolve(n))))}),i);s=setTimeout((()=>{r({error:{message:`Session polling timeout exceeded: ${o}ms`,code:"0"},ok:!1}),clearInterval(a)}),o)})))),update:{email:ne(((e,n,r,i)=>_t(t.post(at.email,{externalId:e,email:n,URI:r,crossDevice:!0},{token:i})))),phone:Object.keys(Et).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:ee(((e,r,i,o)=>_t(t.post(xt(at.phone,n),{externalId:e,phone:r,URI:i,crossDevice:!0},{token:o}))))})),{})}}),ie=t=>({verify:Xt((e=>_t(t.post(rt,{token:e})))),signIn:Object.keys(St).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Yt(((e,r)=>_t(t.post(xt(it,n),{externalId:e,URI:r}))))})),{}),signUp:Object.keys(St).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Yt(((e,r,i)=>_t(t.post(xt(ot,n),{externalId:e,URI:r,user:i}))))})),{}),signUpOrIn:Object.keys(St).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:Yt(((e,r)=>_t(t.post(xt(ct,n),{externalId:e,URI:r}))))})),{}),update:{email:ne(((e,n,r,i)=>_t(t.post(at.email,{externalId:e,email:n,URI:r},{token:i})))),phone:Object.keys(Et).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:ee(((e,r,i,o)=>_t(t.post(xt(at.phone,n),{externalId:e,phone:r,URI:i},{token:o}))))})),{})},crossDevice:re(t)}),oe=qt(Dt("code")),se=t=>({exchange:oe((e=>_t(t.get("/v1/auth/exchange",{queryParams:{code:e}}))))});var ae;!function(t){t.facebook="facebook",t.github="github",t.google="google",t.microsoft="microsoft",t.gitlab="gitlab",t.apple="apple"}(ae||(ae={}));const ce=t=>Object.assign({start:Object.keys(ae).reduce(((e,n)=>Object.assign(Object.assign({},e),{[n]:async(e,{redirect:r=!1}={})=>{const i=await t.get(ut,{queryParams:Object.assign({provider:n},e&&{redirectURL:e})});if(!r||!i.ok)return _t(Promise.resolve(i));const{url:o}=await i.json();window.location.href=o}})),{})},se(t)),ue=qt(Dt("flowId")),de=qt(Dt("executionId"),Dt("stepId"),Dt("actionId")),le=t=>({start:ue((e=>_t(t.post(bt,{flowId:e})))),next:de(((e,n,r,i)=>_t(t.post(yt,{executionId:e,stepId:n,actionId:r,input:i}))))}),he=qt(Dt("tenant")),pe=t=>Object.assign({start:he((async(e,n,{redirect:r=!1}={})=>{const i=await t.get(dt,{queryParams:{tenant:e,redirectURL:n}});if(!r||!i.ok)return _t(Promise.resolve(i));const{url:o}=await i.json();window.location.href=o}))},se(t)),fe=Dt("identifier"),ge=qt(fe,Dt("code")),ve=qt(fe),be=qt(fe),ye=t=>({signUp:ve(((e,n)=>_t(t.post(ht,{externalId:e,user:n})))),verify:ge(((e,n)=>_t(t.post(lt,{externalId:e,code:n})))),update:be(((e,n)=>_t(t.post(pt,{externalId:e},{token:n}))))}),we=Dt("identifier"),me=Dt("origin"),Ie=qt(we,me,Dt("name")),je=qt(we,me),Oe=qt(we,me,Dt("token")),ke=qt(Dt("transactionId"),Dt("response")),xe=t=>({signUp:{start:Ie(((e,n,r)=>_t(t.post(ft.start,{user:{externalId:e,name:r},origin:n})))),finish:ke(((e,n)=>_t(t.post(ft.finish,{transactionId:e,response:n}))))},signIn:{start:je(((e,n)=>_t(t.post(gt.start,{externalId:e,origin:n})))),finish:ke(((e,n)=>_t(t.post(gt.finish,{transactionId:e,response:n}))))},add:{start:Oe(((e,n,r)=>_t(t.post(vt.start,{externalId:e,origin:n},{token:r})))),finish:ke(((e,n)=>_t(t.post(vt.finish,{transactionId:e,response:n}))))}}),_e=qt(Dt("token"));var Ee;const Se=qt([("projectId",Ee=Dt("projectId"),Tt(((t,e)=>t=>Pt(...e).validate(V(t,"projectId")))(0,Ee))())])((({projectId:t,logger:e,baseUrl:n,hooks:r})=>{return i=Ot({baseUrl:n||"https://api.descope.com",projectId:t,logger:e,hooks:r}),{otp:Zt(i),magicLink:ie(i),oauth:ce(i),saml:pe(i),totp:ye(i),webauthn:xe(i),flow:le(i),refresh:t=>_t(i.get("/v1/auth/refresh",{token:t})),logout:t=>_t(i.get("/v1/auth/logoutall",{token:t})),isJwtExpired:_e(kt),httpClient:i};var i}));Se.DeliveryMethods=St;const Ue="descope-login-flow",Te="code",Pe="redirect",Re="poll",Me="webauthnCreate",Ae="webauthnGet";function Ce(t){return new URLSearchParams(window.location.search).get(t)}function $e(){return Ce(Ue)}function Le(t){if(window.history.replaceState&&Ce(t)){const e=new URL(window.location.href),n=new URLSearchParams(e.search);n.delete(t),e.search=n.toString(),window.history.replaceState({},"",e.toString())}}var Ne;function qe(t){const e=`/${t}.html`,n=new URL("https://s3.eu-central-1.amazonaws.com/static.sandbox.descope.com/pages");return n.pathname+=e,n.toString()}function De(t,e){if(!Number.isNaN(t)&&!Number.isNaN(e))return t>e?Ne.forward:t<e?Ne.backward:void 0}!function(t){t.backward="backward",t.forward="forward"}(Ne||(Ne={}));const Je=()=>{const[t="",e=""]=($e()||"").split("_");return{executionId:t,stepId:e}},We=(t,e)=>{!function(t){if(window.history.pushState&&t!==$e()){const e=new URL(window.location.href),n=new URLSearchParams(e.search);n.set(Ue,t),e.search=n.toString(),window.history.pushState({},"",e.toString())}}([t,e].join("_"))};const He=(t,e,n="")=>{const r=t.getElementById(e);r&&(r.innerText=n,r.classList[n?"remove":"add"]("hide"))},ze=t=>t.replace(/-./g,(t=>t[1].toUpperCase()));var Ke,Fe,Be,Ge,Ze,Qe,Ve,Xe,Ye,tn,en,nn,rn,on,sn,an,cn,un,dn,ln,hn,pn,fn,gn;class vn{constructor(t={}){Ke.set(this,void 0),Fe.set(this,{}),Be.set(this,0),n(this,Ke,t,"f")}get current(){return Object.assign({},e(this,Ke,"f"))}update(t){const r="function"==typeof t?t(e(this,Ke,"f")):t,i=Object.assign(Object.assign({},e(this,Ke,"f")),r);if(!function(t,e){const n=Object.getOwnPropertyNames(t),r=Object.getOwnPropertyNames(e);if(n.length!==r.length)return!1;for(let r=0;r<n.length;r+=1){const i=n[r];if(t[i]!==e[i])return!1}return!0}(e(this,Ke,"f"),i)){const t=e(this,Ke,"f");n(this,Ke,i,"f"),Object.freeze(e(this,Ke,"f")),setTimeout((()=>{Object.values(e(this,Fe,"f")).forEach((e=>e(i,t,((t,e)=>n=>t[n]!==e[n])(i,t))))}),0)}}subscribe(t){return n(this,Be,e(this,Be,"f")+1,"f"),e(this,Fe,"f")[e(this,Be,"f")]=t,e(this,Be,"f").toString()}unsubscribe(t){const n=!!e(this,Fe,"f")[t];return n&&delete e(this,Fe,"f")[t],n}unsubscribeAll(){return n(this,Fe,{},"f"),!0}}function bn(e){return t(this,void 0,void 0,(function*(){const t=function(t){var e;const n=JSON.parse(t);return n.publicKey.challenge=wn(n.publicKey.challenge),n.publicKey.user.id=wn(n.publicKey.user.id),null===(e=n.publicKey.excludeCredentials)||void 0===e||e.forEach((t=>{t.id=wn(t.id)})),n}(e),n=yield navigator.credentials.create(t);return r=n,JSON.stringify({id:r.id,rawId:mn(r.rawId),type:r.type,response:{attestationObject:mn(r.response.attestationObject),clientDataJSON:mn(r.response.clientDataJSON)}});var r}))}function yn(e){return t(this,void 0,void 0,(function*(){const t=function(t){var e;const n=JSON.parse(t);return n.publicKey.challenge=wn(n.publicKey.challenge),null===(e=n.publicKey.allowCredentials)||void 0===e||e.forEach((t=>{t.id=wn(t.id)})),n}(e),n=yield navigator.credentials.get(t);return r=n,JSON.stringify({id:r.id,rawId:mn(r.rawId),type:r.type,response:{authenticatorData:mn(r.response.authenticatorData),clientDataJSON:mn(r.response.clientDataJSON),signature:mn(r.response.signature),userHandle:mn(r.response.userHandle)}});var r}))}function wn(t){const e=t.replace(/-/g,"+").replace(/_/g,"/");return Uint8Array.from(atob(e),(t=>t.charCodeAt(0))).buffer}function mn(t){return btoa(String.fromCharCode.apply(null,new Uint8Array(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}Ke=new WeakMap,Fe=new WeakMap,Be=new WeakMap,function(t){t.waiting="waiting",t.completed="completed",t.failed="failed",t.running="running"}(Ge||(Ge={}));const In=document.createElement("template");In.innerHTML="\n\t<style>\n\t\t:host {\n\t\t\tdisplay: inline-block;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t}\n\t\t\n\t\tform {\n\t\t\theight: 100%;\n\t\t\ttransition: opacity 300ms ease-in-out;\n\t\t}\n\n\t\t.fade-out {\n\t\t\topacity: 0.1;\n\t\t}\n\n\t</style>\n\t<form></form>\n\t";class jn extends HTMLElement{constructor(){super(),Ze.add(this),Qe.set(this,!1),Ve.set(this,new vn),Xe.set(this,new vn),Ye.set(this,void 0),tn.set(this,void 0),en.set(this,void 0),nn.set(this,{popstate:e(this,Ze,"m",an).bind(this)}),rn.set(this,void 0),ln.set(this,(t=>{var n,r;if(e(this,Ze,"m",un).call(this,t))return;const{executionId:i,stepId:o,status:s,action:a,screen:c,redirect:u,authInfo:d,error:l,webauthn:h}=t.data;e(this,Ze,"m",cn).call(this,s,l,d)||e(this,Ve,"f").update({stepId:o,executionId:i,action:a,redirectUrl:null==u?void 0:u.url,screenId:null==c?void 0:c.id,screenErrorText:null===(n=null==c?void 0:c.state)||void 0===n?void 0:n.errorText,screenMessageText:null===(r=null==c?void 0:c.state)||void 0===r?void 0:r.messageText,webauthnTransactionId:null==h?void 0:h.transactionId,webauthnOptions:null==h?void 0:h.options})})),e(this,Ze,"m",on).call(this),e(this,Ve,"f").subscribe(e(this,Ze,"m",dn).bind(this)),e(this,Xe,"f").subscribe(e(this,Ze,"m",pn).bind(this))}static get observedAttributes(){return["project-id","flow-id","base-url"]}get"project-id"(){return this.getAttribute("project-id")}get"flow-id"(){return this.getAttribute("flow-id")}get"base-url"(){return this.getAttribute("base-url")||void 0}connectedCallback(){if(this.shadowRoot.isConnected){n(this,Qe,!0,"f"),e(this,Ze,"m",sn).call(this);const{executionId:t,stepId:r}=Je(),i=Ce("t")||void 0;i&&Le("t");const o=Ce(Te)||void 0;o&&Le(Te),e(this,Ve,"f").update({projectId:this["project-id"],flowId:this["flow-id"],baseUrl:this["base-url"],stepId:r,executionId:t,token:i,code:o}),window.addEventListener("popstate",e(this,nn,"f").popstate)}}disconnectedCallback(){e(this,Ve,"f").unsubscribeAll(),e(this,Xe,"f").unsubscribeAll(),window.removeEventListener("popstate",e(this,nn,"f").popstate)}attributeChangedCallback(t,n,r){if(this.shadowRoot.isConnected&&e(this,Qe,"f")&&n!==r&&jn.observedAttributes.includes(t)){e(this,Ze,"m",sn).call(this);const i=null===n;e(this,Ve,"f").update((({stepId:e,executionId:n})=>{let o=e,s=n;return i||(s=null,o=null,Le(Ue)),{[ze(t)]:r,stepId:o,executionId:s}}))}}}Qe=new WeakMap,Ve=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,tn=new WeakMap,en=new WeakMap,nn=new WeakMap,rn=new WeakMap,ln=new WeakMap,Ze=new WeakSet,on=function(){this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(In.content.cloneNode(!0)),n(this,Ye,this.shadowRoot.querySelector("form"),"f"),n(this,tn,this.shadowRoot.querySelector("style"),"f")},sn=function(){const t=["base-url"];jn.observedAttributes.forEach((e=>{if(!t.includes(e)&&!this[e])throw Error(`${e} cannot be empty`)}))},an=function(){const{stepId:t,executionId:n}=Je();e(this,Ve,"f").update({stepId:t,executionId:n})},cn=function(t,n,r){switch(t){case Ge.failed:return e(this,Ze,"m",gn).call(this,"error",n),!0;case Ge.completed:return e(this,Ze,"m",gn).call(this,"success",r),!0;default:return!1}},un=function({ok:t,error:n}){return t||e(this,Ze,"m",gn).call(this,"error",n),!t},dn=function(r,i,o){return t(this,void 0,void 0,(function*(){const{projectId:s,flowId:a,baseUrl:c,stepId:u,executionId:d,action:l,screenId:h,screenErrorText:p,screenMessageText:f,redirectUrl:g,token:v,code:b,webauthnTransactionId:y,webauthnOptions:w}=r,m=o("projectId")||o("baseUrl");if(e(this,en,"f")&&(clearInterval(e(this,en,"f")),n(this,en,null,"f")),m){if(!s)return;n(this,rn,Se({projectId:s,baseUrl:c}),"f")}if(!d){if(!a)return;const t=yield e(this,rn,"f").flow.start(a);return void e(this,ln,"f").call(this,t)}if(o("token")&&v||o("code")&&b){const t=yield e(this,rn,"f").flow.next(d,u,"submit",{token:v,code:b});return e(this,ln,"f").call(this,t),We(t.data.executionId,t.data.stepId),void e(this,Ve,"f").update({token:void 0,code:void 0})}if(l===Pe)return g?void window.location.assign(g):void console.error("Did not get redirect url");if(l===Me||l===Ae){if(!y||!w)return void console.error("Did not get webauthn transaction id or options");const t=l===Me?yield bn(w):yield yn(w),n=yield e(this,rn,"f").flow.next(d,u,"submit",{transactionId:y,response:t});return void e(this,ln,"f").call(this,n)}if(l===Re&&n(this,en,setInterval((()=>t(this,void 0,void 0,(function*(){const t=yield e(this,rn,"f").flow.next(d,u,"submit",{});e(this,ln,"f").call(this,t)}))),2e3),"f"),!h)return void console.error("Refreshing the page during a flow is not supported yet");const I={direction:De(+u,+i.stepId),screenErrorText:p,screenMessageText:f,htmlUrl:qe(h)};(m||o("executionId")||o("stepId"))&&(I.next=(...t)=>e(this,rn,"f").flow.next(d,u,...t)),e(this,Xe,"f").update(I)}))},hn=function(n){this.shadowRoot.querySelectorAll('button[type="button"]').forEach((r=>{const i=(t=>Array.from(t.attributes).reduce(((t,e)=>{var n;const r=null===(n=new RegExp("^data-descope-(\\S+)$").exec(e.name))||void 0===n?void 0:n[1];return r?Object.assign(t,{[r]:e.value}):t}),{}))(r),{action:o}=i,s=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(i,["action"]);r.onclick=()=>t(this,void 0,void 0,(function*(){const t=yield n(o,s);e(this,ln,"f").call(this,t),We(t.data.executionId,t.data.stepId)}))})),e(this,Ye,"f").onsubmit=r=>t(this,void 0,void 0,(function*(){r.preventDefault();const t=Object.fromEntries(new FormData(r.target).entries()),i=yield n("submit",Object.assign(Object.assign({},t),{origin:window.location.origin}));e(this,ln,"f").call(this,i),We(i.data.executionId,i.data.stepId)}))},pn=function(n,r,i){return t(this,void 0,void 0,(function*(){const r="error",o="info",{htmlUrl:s,validations:a={},direction:c,next:u,screenErrorText:d,screenMessageText:l}=n;if(!i("htmlUrl"))return i("next")&&e(this,Ze,"m",hn).call(this,u),i("screenErrorText")&&He(this.shadowRoot,r,d),void(i("screenMessageText")&&He(this.shadowRoot,o,l));const h=document.createElement("template");h.innerHTML=yield function(e){return t(this,void 0,void 0,(function*(){const t=yield fetch(e,{cache:"default"});if(!t.ok)throw new Error(e);return t.text()}))}(s);const p=h.content.cloneNode(!0),f=(t=>{var e;const n=Array.from(t.querySelectorAll("script[data-id]")).map((e=>{var n;const r=e.getAttribute("data-id"),i=null===(n=t.getElementById(r))||void 0===n?void 0:n.innerHTML,o=Function(i).bind(e.previousSibling);return e.remove(),o}));return null===(e=t.querySelector("scripts"))||void 0===e||e.remove(),n})(p),g=()=>{!function(t,e){Object.entries(e).forEach((([e,n])=>{const r=t.getElementById(e);if(!r)throw new Error(`Cannot find element with id: ${e}`);Object.entries(n).forEach((([t,e])=>{r.setAttribute(t,e.toString()),r.addEventListener("blur",(()=>r.classList.add("touched")),{once:!0})}))}))}(p,a),He(p,r,d),He(p,o,l);try{f.forEach((t=>t()))}catch(t){console.error(t)}e(this,Ye,"f").replaceChildren(p),e(this,Ze,"m",hn).call(this,u),e(this,Ze,"m",gn).call(this,"page-updated",{})};c?e(this,Ze,"m",fn).call(this,g,c):g()}))},fn=function(t,n){e(this,Ye,"f").addEventListener("transitionend",(()=>{e(this,Ye,"f").classList.remove("fade-out"),t()}),{once:!0});const r=n===Ne.forward?"slide-forward":"slide-backward";Array.from(e(this,Ye,"f").getElementsByClassName("input-container")).forEach(((t,e)=>{t.style["transition-delay"]=40*e+"ms",t.classList.add(r)})),e(this,Ye,"f").classList.add("fade-out")},gn=function(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e}))},customElements.define("descope-wc",jn)}();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@descope/web-component",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26-alpha.0",
|
|
4
4
|
"main": "dist/descope-wc",
|
|
5
5
|
"types": "dist/descope-wc.d.ts",
|
|
6
6
|
"description": "Descope WC",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"eslint-plugin-jest": "26.8.2",
|
|
40
40
|
"eslint-plugin-jest-dom": "4.0.2",
|
|
41
41
|
"eslint-plugin-jest-formatting": "3.1.0",
|
|
42
|
-
"eslint-plugin-n": "15.2.
|
|
42
|
+
"eslint-plugin-n": "15.2.5",
|
|
43
43
|
"eslint-plugin-no-only-tests": "3.0.0",
|
|
44
44
|
"eslint-plugin-prefer-arrow": "1.2.3",
|
|
45
45
|
"eslint-plugin-prettier": "4.2.1",
|
|
@@ -54,12 +54,13 @@
|
|
|
54
54
|
"rollup-plugin-dts": "^4.2.2",
|
|
55
55
|
"rollup-plugin-livereload": "^2.0.5",
|
|
56
56
|
"rollup-plugin-terser": "7.0.2",
|
|
57
|
+
"string-to-arraybuffer": "^1.0.2",
|
|
57
58
|
"ts-jest": "^28.0.0",
|
|
58
59
|
"ts-node": "10.9.1",
|
|
59
60
|
"typescript": "^4.5.3"
|
|
60
61
|
},
|
|
61
62
|
"dependencies": {
|
|
62
|
-
"@descope/core-js-sdk": "
|
|
63
|
+
"@descope/core-js-sdk": "0.0.41-alpha.12"
|
|
63
64
|
},
|
|
64
65
|
"overrides": {
|
|
65
66
|
"terser": "5.14.2"
|